1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | #include <iostream> |
8 | #include <sstream> |
9 | #include "JEventProcessor_PSPair_online.h" |
10 | |
11 | using namespace std; |
12 | using namespace jana; |
13 | |
14 | #include <PAIR_SPECTROMETER/DPSCPair.h> |
15 | #include <PAIR_SPECTROMETER/DPSPair.h> |
16 | #include <PAIR_SPECTROMETER/DPSGeometry.h> |
17 | #include <TAGGER/DTAGHHit.h> |
18 | #include <TAGGER/DTAGHGeometry.h> |
19 | #include <TAGGER/DTAGMHit.h> |
20 | #include <TAGGER/DTAGMGeometry.h> |
21 | |
22 | #include <JANA/JApplication.h> |
23 | #include <JANA/JFactory.h> |
24 | #include <TDirectory.h> |
25 | #include <TH1.h> |
26 | #include <TH2.h> |
27 | |
28 | |
29 | const int Narms = DPSGeometry::NUM_ARMS; |
30 | const int NC_PSC = DPSGeometry::NUM_COARSE_COLUMNS; |
31 | const int NC_PS = DPSGeometry::NUM_FINE_COLUMNS; |
32 | const int NC_TAGH = DTAGHGeometry::kCounterCount; |
33 | const int NC_TAGM = DTAGMGeometry::kColumnCount; |
34 | |
35 | static TH1I *hPSC_NHitPairs; |
36 | static TH1I *hPS_NHitPairs; |
37 | |
38 | static TH2F *hPSC_PSCIDLeftVsIDRight; |
39 | static TH2I *hPSC_tdiffVsPSCIDLeft[NC_PSC]; |
40 | static TH2I *hPSC_tdiffVsPSCIDRight[NC_PSC]; |
41 | |
42 | static TH1I *pspair_num_events; |
43 | static TH2F *hPS_PSCIDLeftVsIDRight; |
44 | static TH2F *hPS_PSIDLeftVsIDRight; |
45 | static TH2F *hPS_ElVsEr; |
46 | static TH1F *hPS_E; |
47 | static TH2F *hPS_timeVsE; |
48 | static TH2I *hPS_PSIDLeftVsPSCIDLeft; |
49 | static TH2I *hPS_PSIDRightVsPSCIDRight; |
50 | static TH2I *hPS_ElVsPSCIDLeft; |
51 | static TH2I *hPS_ErVsPSCIDRight; |
52 | |
53 | static TH1F *hPS_TAGHCounterID; |
54 | static TH1F *hPS_Etagh; |
55 | static TH2F *hPS_timeVsEtagh; |
56 | static TH1F *hPS_TAGMColumn; |
57 | static TH1F *hPS_Etagm; |
58 | static TH2F *hPS_timeVsEtagm; |
59 | |
60 | static TH2F *hPSTAGH_tdiffVsEdiff; |
61 | static TH2I *hPSTAGH_EVsEtagh; |
62 | static TH2F *hPSTAGH_PSCIDLeftVsIDRight; |
63 | static TH2F *hPSTAGH_PSIDLeftVsIDRight; |
64 | static TH2F *hPSTAGH_ElVsEr; |
65 | static TH1F *hPSTAGH_E; |
66 | static TH2F *hPSTAGH_timeVsE; |
67 | static TH1F *hPSTAGH_TAGHCounterID; |
68 | static TH1F *hPSTAGH_Etagh; |
69 | static TH2F *hPSTAGH_timeVsEtagh; |
70 | static TH2I *hPSTAGH_EdiffVsTAGHCounterID; |
71 | static TH2I *hPSTAGH_EdiffVsEtagh; |
72 | static TH2I *hPSTAGH_tdiffVsTAGHCounterID_L[NC_PSC]; |
73 | static TH2I *hPSTAGH_tdiffVsTAGHCounterID_R[NC_PSC]; |
74 | |
75 | static TH2F *hPSTAGM_tdiffVsEdiff; |
76 | static TH2I *hPSTAGM_EVsEtagm; |
77 | static TH2F *hPSTAGM_PSCIDLeftVsIDRight; |
78 | static TH2F *hPSTAGM_PSIDLeftVsIDRight; |
79 | static TH2F *hPSTAGM_ElVsEr; |
80 | static TH1F *hPSTAGM_E; |
81 | static TH2F *hPSTAGM_timeVsE; |
82 | static TH1F *hPSTAGM_TAGMColumn; |
83 | static TH1F *hPSTAGM_Etagm; |
84 | static TH2F *hPSTAGM_timeVsEtagm; |
85 | static TH2I *hPSTAGM_EdiffVsTAGMColumn; |
86 | static TH2I *hPSTAGM_EdiffVsEtagm; |
87 | static TH2I *hPSTAGM_tdiffVsTAGMColumn_L[NC_PSC]; |
88 | static TH2I *hPSTAGM_tdiffVsTAGMColumn_R[NC_PSC]; |
89 | |
90 | |
91 | extern "C"{ |
92 | void InitPlugin(JApplication *app){ |
93 | InitJANAPlugin(app); |
94 | app->AddProcessor(new JEventProcessor_PSPair_online()); |
95 | |
96 | } |
97 | } |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | JEventProcessor_PSPair_online::JEventProcessor_PSPair_online() |
104 | { |
105 | |
106 | } |
107 | |
108 | |
109 | |
110 | |
111 | JEventProcessor_PSPair_online::~JEventProcessor_PSPair_online() |
112 | { |
113 | |
114 | } |
115 | |
116 | |
117 | |
118 | |
119 | jerror_t JEventProcessor_PSPair_online::init(void) |
120 | { |
121 | |
122 | const double Ebw_PS = 0.1; |
123 | const double Ebl_PS = 5.0; const double Ebl_PSarm = 2.0; |
124 | const double Ebh_PS = 13.0; const double Ebh_PSarm = 7.0; |
125 | const int NEb_PS = int((Ebh_PS-Ebl_PS)/Ebw_PS); const int NEb_PSarm = int((Ebh_PSarm-Ebl_PSarm)/Ebw_PS); |
126 | const double Ebw_TAG = 0.1; |
127 | const double Ebl_TAG = 2.5; |
128 | const double Ebh_TAG = 10.5; |
129 | const int NEb_TAG = int((Ebh_TAG-Ebl_TAG)/Ebw_TAG); |
130 | |
131 | const double Tbw = 0.06; |
132 | const double Tbl_PS = -4.5; |
133 | const double Tbh_PS = 4.5; |
134 | const int NTb_PS = int((Tbh_PS-Tbl_PS)/Tbw); |
135 | const double Tbl_TAG = -30.0; |
136 | const double Tbh_TAG = 30.0; |
137 | const int NTb_TAG = int((Tbh_TAG-Tbl_TAG)/Tbw); |
138 | |
139 | japp->RootWriteLock(); |
140 | |
141 | TDirectory *mainDir = gDirectory(TDirectory::CurrentDirectory()); |
142 | TDirectory *psPairDir = gDirectory(TDirectory::CurrentDirectory())->mkdir("PSPair"); |
143 | psPairDir->cd(); |
144 | |
145 | pspair_num_events = new TH1I("pspair_num_events","PS pair number of events",1,0.5,1.5); |
146 | hPSC_NHitPairs = new TH1I("PSC_NHitPairs","PSC pair multiplicity",8,0.5,8.5); |
147 | hPS_NHitPairs = new TH1I("PS_NHitPairs","PS pair multiplicity",8,0.5,8.5); |
148 | |
149 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSC")->cd(); |
150 | hPSC_PSCIDLeftVsIDRight = new TH2F("PSC_PSCIDLeftVsIDRight","PSC pair: Coarse PS ID left arm vs. ID right arm;module(right arm);module(left arm)",NC_PSC,0.5,0.5+NC_PSC,NC_PSC,0.5,0.5+NC_PSC); |
151 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSCRightArmTimeOffsets")->cd(); |
152 | for (int i=0;i<NC_PSC;i++) { |
153 | stringstream ss; ss << i+1; |
154 | TString id = ss.str(); |
155 | TString strN = "_L" + id; |
156 | hPSC_tdiffVsPSCIDRight[i] = new TH2I("PSC_tdiffVsPSCIDRight"+strN,"PSC pair: TDC time difference vs. right arm module, fixed left arm module "+id+";module(right arm);time(module "+id+", left arm) - time(right arm) [ns]",NC_PSC,0.5,0.5+NC_PSC,NTb_PS,Tbl_PS,Tbh_PS); |
157 | } |
158 | gDirectory(TDirectory::CurrentDirectory())->cd("../"); |
159 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSCLeftArmTimeOffsets")->cd(); |
160 | for (int i=0;i<NC_PSC;i++) { |
161 | stringstream ss; ss << i+1; |
162 | TString id = ss.str(); |
163 | TString strN = "_R" + id; |
164 | hPSC_tdiffVsPSCIDLeft[i] = new TH2I("PSC_tdiffVsPSCIDLeft"+strN,"PSC pair: TDC time difference vs. left arm module, fixed right arm module "+id+";module(left arm);time(left arm) - time(module "+id+", right arm) [ns]",NC_PSC,0.5,0.5+NC_PSC,NTb_PS,Tbl_PS,Tbh_PS); |
165 | } |
166 | psPairDir->cd(); |
167 | |
168 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSC_PS")->cd(); |
169 | hPS_PSCIDLeftVsIDRight = new TH2F("PS_PSCIDLeftVsIDRight","PS pair: Coarse PS ID left arm vs. ID right arm;module(right arm);module(left arm)",NC_PSC,0.5,0.5+NC_PSC,NC_PSC,0.5,0.5+NC_PSC); |
170 | hPS_PSIDLeftVsIDRight = new TH2F("PS_PSIDLeftVsIDRight","PS pair: Fine PS ID left arm vs. ID right arm;column(right arm);column(left arm)",NC_PS,0.5,0.5+NC_PS,NC_PS,0.5,0.5+NC_PS); |
171 | hPS_ElVsEr = new TH2F("PS_ElVsEr","PS pair: left-arm energy vs. right-arm energy;energy(right arm) [GeV];energy(left arm) [GeV]",NEb_PSarm,Ebl_PSarm,Ebh_PSarm,NEb_PSarm,Ebl_PSarm,Ebh_PSarm); |
172 | hPS_E = new TH1F("PS_E","PS pair energy;PS pair energy [GeV];events",NEb_PS,Ebl_PS,Ebh_PS); |
173 | hPS_timeVsE = new TH2F("PS_timeVsE","PSC TDC time, Left arm vs. PS pair energy;PS pair energy [GeV];PSC TDC time, Left arm [ns]",NEb_PS,Ebl_PS,Ebh_PS,NTb_PS,Tbl_PS,Tbh_PS); |
174 | |
175 | hPS_PSIDLeftVsPSCIDLeft = new TH2I("PS_PSIDLeftVsPSCIDLeft","PS pair: Fine PS ID left arm vs. Coarse PS ID left arm;coarse PS module(left arm);fine PS column(left arm)",NC_PSC,0.5,0.5+NC_PSC,NC_PS,0.5,0.5+NC_PS); |
176 | hPS_PSIDRightVsPSCIDRight = new TH2I("PS_PSIDRightVsPSCIDRight","PS pair: Fine PS ID right arm vs. Coarse PS ID right arm;coarse PS module(right arm);fine PS column(right arm)",NC_PSC,0.5,0.5+NC_PSC,NC_PS,0.5,0.5+NC_PS); |
177 | hPS_ElVsPSCIDLeft = new TH2I("PS_ElVsPSCIDLeft","PS pair: PS left-arm energy vs. Coarse PS ID left arm;coarse PS module(left arm);PS energy(left arm)",NC_PSC,0.5,0.5+NC_PSC,NEb_PSarm,Ebl_PSarm,Ebh_PSarm); |
178 | hPS_ErVsPSCIDRight = new TH2I("PS_ErVsPSCIDRight","PS pair: PS right-arm energy vs. Coarse PS ID right arm;coarse PS module(right arm);PS energy(right arm)",NC_PSC,0.5,0.5+NC_PSC,NEb_PSarm,Ebl_PSarm,Ebh_PSarm); |
179 | |
180 | gDirectory(TDirectory::CurrentDirectory())->mkdir("TAGX_AllHits")->cd(); |
181 | hPS_TAGHCounterID = new TH1F("PS_TAGHCounterID","PS pair: TAGH counter ID, all hits;TAGH counter ID;hits",NC_TAGH,0.5,0.5+NC_TAGH); |
182 | hPS_Etagh = new TH1F("PS_Etagh","PS pair: TAGH photon energy, all hits;TAGH photon energy [GeV];hits",NEb_TAG,Ebl_TAG,Ebh_TAG); |
183 | hPS_timeVsEtagh = new TH2F("PS_timeVsEtagh","PS pair: TAGH time vs. photon energy, all hits;TAGH photon energy [GeV];time [ns]",NEb_TAG,Ebl_TAG,Ebh_TAG,NTb_TAG,Tbl_TAG,Tbh_TAG); |
184 | hPS_TAGMColumn = new TH1F("PS_TAGMColumn","PS pair: TAGM column, all hits;TAGM column;hits",NC_TAGM,0.5,0.5+NC_TAGM); |
185 | hPS_Etagm = new TH1F("PS_Etagm","PS pair: TAGM photon energy, all hits;TAGM photon energy [GeV];hits",NEb_PS,Ebl_PS,Ebh_PS); |
186 | hPS_timeVsEtagm = new TH2F("PS_timeVsEtagm","PS pair: TAGM time vs. photon energy, all hits;TAGM photon energy [GeV];time [ns]",NEb_PS,Ebl_PS,Ebh_PS,NTb_TAG,Tbl_TAG,Tbh_TAG); |
187 | psPairDir->cd(); |
188 | |
189 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSC_PS_TAGH")->cd(); |
190 | hPSTAGH_tdiffVsEdiff = new TH2F("PSTAGH_tdiffVsEdiff","PS pair - TAGH: PS-TAGH time difference vs. PS-TAGH energy difference;[E(PS) - E(TAGH)] / E(PS);PSC/TAGH time difference [ns]",80,-0.15,0.15,NTb_TAG,Tbl_TAG,Tbh_TAG); |
191 | hPSTAGH_TAGHCounterID = new TH1F("PSTAGH_TAGHCounterID","PS pair - TAGH: TAGH counter ID;TAGH counter ID;events",NC_TAGH,0.5,0.5+NC_TAGH); |
192 | hPSTAGH_Etagh = new TH1F("PSTAGH_Etagh","PS pair - TAGH: TAGH photon energy;TAGH photon energy [GeV];events",NEb_TAG,Ebl_TAG,Ebh_TAG); |
193 | hPSTAGH_timeVsEtagh = new TH2F("PSTAGH_timeVsEtagh","PS pair - TAGH: TAGH time vs. photon energy;TAGH photon energy [GeV];time [ns]",NEb_TAG,Ebl_TAG,Ebh_TAG,NTb_TAG,Tbl_TAG,Tbh_TAG); |
194 | hPSTAGH_EVsEtagh = new TH2I("PSTAGH_EVsEtagh","PS pair - TAGH: PS energy vs. TAGH energy;TAGH energy [GeV];PS energy [GeV]",NEb_PS,Ebl_PS,Ebh_PS,NEb_PS,Ebl_PS,Ebh_PS); |
195 | hPSTAGH_EdiffVsEtagh = new TH2I("PSTAGH_EdiffVsEtagh","PS pair - TAGH: PS-TAGH energy difference vs. TAGH energy;TAGH energy [GeV];[E(PS) - E(TAGH)] / E(PS)",NEb_TAG,Ebl_TAG,Ebh_TAG,80,-0.15,0.15); |
196 | hPSTAGH_EdiffVsTAGHCounterID = new TH2I("PSTAGH_EdiffVsTAGHCounterID","PS pair - TAGH: PS-TAGH energy difference vs. TAGH counter ID;TAGH counter ID;[E(PS) - E(TAGH)] / E(PS)",NC_TAGH,0.5,0.5+NC_TAGH,80,-0.15,0.15); |
197 | hPSTAGH_PSCIDLeftVsIDRight = new TH2F("PSTAGH_PSCIDLeftVsIDRight","PS pair - TAGH: Coarse PS ID left arm vs. ID right arm;module(right arm);module(left arm)",NC_PSC,0.5,0.5+NC_PSC,NC_PSC,0.5,0.5+NC_PSC); |
198 | hPSTAGH_PSIDLeftVsIDRight = new TH2F("PSTAGH_PSIDLeftVsIDRight","PS pair - TAGH: Fine PS ID left arm vs. ID right arm;column(right arm);column(left arm)",NC_PS,0.5,0.5+NC_PS,NC_PS,0.5,0.5+NC_PS); |
199 | hPSTAGH_ElVsEr = new TH2F("PSTAGH_ElVsEr","PS pair - TAGH: left-arm energy vs. right-arm energy;energy(right arm) [GeV];energy(left arm) [GeV]",NEb_PSarm,Ebl_PSarm,Ebh_PSarm,NEb_PSarm,Ebl_PSarm,Ebh_PSarm); |
200 | hPSTAGH_E = new TH1F("PSTAGH_E","PS pair - TAGH: PS pair energy;PS pair energy [GeV];events",NEb_PS,Ebl_PS,Ebh_PS); |
201 | hPSTAGH_timeVsE = new TH2F("PSTAGH_timeVsE","PSC/TAGH time difference vs. PS pair energy;PS pair energy [GeV];PSC/TAGH time difference [ns]",NEb_PS,Ebl_PS,Ebh_PS,NTb_TAG,Tbl_TAG,Tbh_TAG); |
202 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSTAGHTimeOffsets_L")->cd(); |
203 | for (int i=0; i<NC_PSC; i++) { |
204 | stringstream ss; ss << i+1; |
205 | TString id = ss.str(); |
206 | hPSTAGH_tdiffVsTAGHCounterID_L[i] = new TH2I("PSTAGH_tdiffVsTAGHCounterID_L"+id,"PS-TAGH TDC time difference vs. TAGH counter ID, fixed left arm PSC module "+id+";TAGH counter ID;time(PSC module "+id+", left arm) - time(TAGH) [ns]",NC_TAGH,0.5,0.5+NC_TAGH,NTb_TAG,Tbl_TAG,Tbh_TAG); |
207 | } |
208 | gDirectory(TDirectory::CurrentDirectory())->cd("../"); |
209 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSTAGHTimeOffsets_R")->cd(); |
210 | for (int i=0; i<NC_PSC; i++) { |
211 | stringstream ss; ss << i+1; |
212 | TString id = ss.str(); |
213 | hPSTAGH_tdiffVsTAGHCounterID_R[i] = new TH2I("PSTAGH_tdiffVsTAGHCounterID_R"+id,"PS-TAGH TDC time difference vs. TAGH counter ID, fixed right arm PSC module "+id+";TAGH counter ID;time(PSC module "+id+", right arm) - time(TAGH) [ns]",NC_TAGH,0.5,0.5+NC_TAGH,NTb_TAG,Tbl_TAG,Tbh_TAG); |
214 | } |
215 | psPairDir->cd(); |
216 | |
217 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSC_PS_TAGM")->cd(); |
218 | hPSTAGM_tdiffVsEdiff = new TH2F("PSTAGM_tdiffVsEdiff","PS pair - TAGM: PS-TAGM time difference vs. PS-TAGM energy difference;[E(PS) - E(TAGM)] / E(PS);PSC/TAGM time difference [ns]",80,-0.15,0.15,NTb_TAG,Tbl_TAG,Tbh_TAG); |
219 | hPSTAGM_TAGMColumn = new TH1F("PSTAGM_TAGMColumn","PS pair - TAGM: TAGM column;TAGM column;events",NC_TAGM,0.5,0.5+NC_TAGM); |
220 | hPSTAGM_Etagm = new TH1F("PSTAGM_Etagm","PS pair - TAGM: TAGM photon energy;TAGM photon energy [GeV];events",NEb_PS,Ebl_PS,Ebh_PS); |
221 | hPSTAGM_timeVsEtagm = new TH2F("PSTAGM_timeVsEtagm","PS pair - TAGM: TAGM time vs. photon energy;TAGM photon energy [GeV];time [ns]",NEb_PS,Ebl_PS,Ebh_PS,NTb_TAG,Tbl_TAG,Tbh_TAG); |
222 | hPSTAGM_EVsEtagm = new TH2I("PSTAGM_EVsEtagm","PS pair - TAGM: PS energy vs. TAGM energy;TAGM energy [GeV];PS energy [GeV]",NEb_PS,Ebl_PS,Ebh_PS,NEb_PS,Ebl_PS,Ebh_PS); |
223 | hPSTAGM_EdiffVsEtagm = new TH2I("PSTAGM_EdiffVsEtagm","PS pair - TAGM: PS-TAGM energy difference vs. TAGM energy;TAGM energy [GeV];[E(PS) - E(TAGM)] / E(PS)",NEb_PS,Ebl_PS,Ebh_PS,80,-0.15,0.15); |
224 | hPSTAGM_EdiffVsTAGMColumn = new TH2I("PSTAGM_EdiffVsTAGMColumn","PS pair - TAGM: PS-TAGM energy difference vs. TAGM column;TAGM column;[E(PS) - E(TAGM)] / E(PS)",NC_TAGM,0.5,0.5+NC_TAGM,80,-0.15,0.15); |
225 | hPSTAGM_PSCIDLeftVsIDRight = new TH2F("PSTAGM_PSCIDLeftVsIDRight","PS pair - TAGM: Coarse PS ID left arm vs. ID right arm;module(right arm);module(left arm)",NC_PSC,0.5,0.5+NC_PSC,NC_PSC,0.5,0.5+NC_PSC); |
226 | hPSTAGM_PSIDLeftVsIDRight = new TH2F("PSTAGM_PSIDLeftVsIDRight","PS pair - TAGM: Fine PS ID left arm vs. ID right arm;column(right arm);column(left arm)",NC_PS,0.5,0.5+NC_PS,NC_PS,0.5,0.5+NC_PS); |
227 | hPSTAGM_ElVsEr = new TH2F("PSTAGM_ElVsEr","PS pair - TAGM: left-arm energy vs. right-arm energy;energy(right arm) [GeV];energy(left arm) [GeV]",NEb_PSarm,Ebl_PSarm,Ebh_PSarm,NEb_PSarm,Ebl_PSarm,Ebh_PSarm); |
228 | hPSTAGM_E = new TH1F("PSTAGM_E","PS pair - TAGM: PS pair energy;PS pair energy [GeV];events",NEb_PS,Ebl_PS,Ebh_PS); |
229 | hPSTAGM_timeVsE = new TH2F("PSTAGM_timeVsE","PSC/TAGM time difference vs. PS pair energy;PS pair energy [GeV];PSC/TAGM time difference [ns]",NEb_PS,Ebl_PS,Ebh_PS,NTb_TAG,Tbl_TAG,Tbh_TAG); |
230 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSTAGMTimeOffsets_L")->cd(); |
231 | for (int i=0; i<NC_PSC; i++) { |
232 | stringstream ss; ss << i+1; |
233 | TString id = ss.str(); |
234 | hPSTAGM_tdiffVsTAGMColumn_L[i] = new TH2I("PSTAGM_tdiffVsTAGMColumn_L"+id,"PS-TAGM TDC time difference vs. TAGM column, fixed left arm PSC module "+id+";TAGM column;time(PSC module "+id+", left arm) - time(TAGM) [ns]",NC_TAGM,0.5,0.5+NC_TAGM,NTb_TAG,Tbl_TAG,Tbh_TAG); |
235 | } |
236 | gDirectory(TDirectory::CurrentDirectory())->cd("../"); |
237 | gDirectory(TDirectory::CurrentDirectory())->mkdir("PSTAGMTimeOffsets_R")->cd(); |
238 | for (int i=0; i<NC_PSC; i++) { |
239 | stringstream ss; ss << i+1; |
240 | TString id = ss.str(); |
241 | hPSTAGM_tdiffVsTAGMColumn_R[i] = new TH2I("PSTAGM_tdiffVsTAGMColumn_R"+id,"PS-TAGM TDC time difference vs. TAGM column, fixed right arm PSC module "+id+";TAGM column;time(PSC module "+id+", right arm) - time(TAGM) [ns]",NC_TAGM,0.5,0.5+NC_TAGM,NTb_TAG,Tbl_TAG,Tbh_TAG); |
242 | } |
243 | |
244 | mainDir->cd(); |
245 | |
246 | japp->RootUnLock(); |
247 | |
248 | return NOERROR; |
249 | } |
250 | |
251 | |
252 | |
253 | |
254 | jerror_t JEventProcessor_PSPair_online::brun(JEventLoop *eventLoop, int runnumber) |
255 | { |
256 | |
257 | |
258 | vector<const DPSGeometry*> psGeomVect; |
259 | eventLoop->Get(psGeomVect); |
260 | if (psGeomVect.size() < 1) |
261 | return OBJECT_NOT_AVAILABLE; |
262 | const DPSGeometry& psGeom = *(psGeomVect[0]); |
263 | |
264 | double Elows_PSarm[Narms][NC_PS+1]; |
265 | double wl_min=0.05,wr_min = 0.05; |
266 | for (int i=0;i<NC_PS;i++) { |
267 | Elows_PSarm[0][i] = psGeom.getElow(0,i+1); |
268 | Elows_PSarm[1][i] = psGeom.getElow(1,i+1); |
269 | |
270 | double wl = psGeom.getEhigh(0,i+1) - psGeom.getElow(0,i+1); |
271 | double wr = psGeom.getEhigh(1,i+1) - psGeom.getElow(1,i+1); |
272 | if (wl<wl_min) wl_min = wl; |
273 | if (wr<wr_min) wr_min = wr; |
274 | } |
275 | |
276 | Elows_PSarm[0][NC_PS] = psGeom.getEhigh(0,NC_PS); |
277 | Elows_PSarm[1][NC_PS] = psGeom.getEhigh(1,NC_PS); |
278 | |
279 | double Ebw_PS = wl_min + wr_min; |
280 | const double Ebl_PS = psGeom.getElow(0,1) + psGeom.getElow(1,1); |
281 | double Ebh_PS = psGeom.getEhigh(0,NC_PS) + psGeom.getEhigh(1,NC_PS); |
282 | double range = Ebh_PS-Ebl_PS; |
283 | int NEb_PS = range/Ebw_PS-int(range/Ebw_PS) < 0.5 ? int(range/Ebw_PS) : int(range/Ebw_PS) + 1; |
284 | double desired_range = NEb_PS*Ebw_PS; |
285 | Ebh_PS = Ebl_PS + desired_range; |
| Value stored to 'Ebh_PS' is never read |
286 | double Elows_PS[NEb_PS+1]; |
287 | for (int i=0;i<NEb_PS+1;i++) { |
288 | Elows_PS[i] = Ebl_PS + i*Ebw_PS; |
289 | } |
290 | |
291 | vector<const DTAGHGeometry*> taghGeomVect; |
292 | eventLoop->Get(taghGeomVect); |
293 | if (taghGeomVect.size() < 1) |
294 | return OBJECT_NOT_AVAILABLE; |
295 | const DTAGHGeometry& taghGeom = *(taghGeomVect[0]); |
296 | |
297 | double Elows_TAGH[NC_TAGH+1]; |
298 | for (int i=0;i<NC_TAGH;i++) { |
299 | Elows_TAGH[i] = taghGeom.getElow(NC_TAGH-i); |
300 | } |
301 | |
302 | Elows_TAGH[NC_TAGH] = taghGeom.getEhigh(1); |
303 | |
304 | vector<const DTAGMGeometry*> tagmGeomVect; |
305 | eventLoop->Get(tagmGeomVect); |
306 | if (tagmGeomVect.size() < 1) |
307 | return OBJECT_NOT_AVAILABLE; |
308 | const DTAGMGeometry& tagmGeom = *(tagmGeomVect[0]); |
309 | |
310 | double Elows_TAGM[NC_TAGM+1]; |
311 | for (int i=0;i<NC_TAGM;i++) { |
312 | Elows_TAGM[i] = tagmGeom.getElow(NC_TAGM-i); |
313 | } |
314 | |
315 | Elows_TAGM[NC_TAGM] = tagmGeom.getEhigh(1); |
316 | |
317 | const int NEdiff = 80; |
318 | double EdiffLows[NEdiff+1]; |
319 | for (int i=0;i<NEdiff+1;i++) { |
320 | EdiffLows[i] = -0.15 + i*0.00375; |
321 | } |
322 | double modules[NC_PSC+1]; |
323 | for (int i=0;i<=NC_PSC;i++) { |
324 | modules[i] = 0.5+i; |
325 | } |
326 | const int NTb = 2000; |
327 | double Tlows[NTb+1]; |
328 | for (int i=0;i<=NTb;i++) { |
329 | Tlows[i] = -400.0+i*0.4; |
330 | } |
331 | japp->RootWriteLock(); |
332 | |
333 | |
334 | if (hPS_ElVsEr->GetEntries()==0) hPS_ElVsEr->SetBins(NC_PS,Elows_PSarm[1],NC_PS,Elows_PSarm[0]); |
335 | if (hPS_ElVsPSCIDLeft->GetEntries()==0) hPS_ElVsPSCIDLeft->SetBins(NC_PSC,modules,NC_PS,Elows_PSarm[0]); |
336 | if (hPS_ErVsPSCIDRight->GetEntries()==0) hPS_ErVsPSCIDRight->SetBins(NC_PSC,modules,NC_PS,Elows_PSarm[1]); |
337 | if (hPSTAGH_ElVsEr->GetEntries()==0) hPSTAGH_ElVsEr->SetBins(NC_PS,Elows_PSarm[1],NC_PS,Elows_PSarm[0]); |
338 | if (hPSTAGM_ElVsEr->GetEntries()==0) hPSTAGM_ElVsEr->SetBins(NC_PS,Elows_PSarm[1],NC_PS,Elows_PSarm[0]); |
339 | if (hPS_E->GetEntries()==0) hPS_E->SetBins(NEb_PS,Elows_PS); |
340 | if (hPSTAGH_E->GetEntries()==0) hPSTAGH_E->SetBins(NEb_PS,Elows_PS); |
341 | if (hPSTAGM_E->GetEntries()==0) hPSTAGM_E->SetBins(NEb_PS,Elows_PS); |
342 | if (hPS_timeVsE->GetEntries()==0) hPS_timeVsE->SetBins(NEb_PS,Elows_PS,NTb,Tlows); |
343 | if (hPSTAGH_timeVsE->GetEntries()==0) hPSTAGH_timeVsE->SetBins(NEb_PS,Elows_PS,NTb,Tlows); |
344 | if (hPSTAGM_timeVsE->GetEntries()==0) hPSTAGM_timeVsE->SetBins(NEb_PS,Elows_PS,NTb,Tlows); |
345 | |
346 | if (hPS_Etagh->GetEntries()==0) hPS_Etagh->SetBins(NC_TAGH,Elows_TAGH); |
347 | if (hPS_timeVsEtagh->GetEntries()==0) hPS_timeVsEtagh->SetBins(NC_TAGH,Elows_TAGH,NTb,Tlows); |
348 | if (hPSTAGH_Etagh->GetEntries()==0) hPSTAGH_Etagh->SetBins(NC_TAGH,Elows_TAGH); |
349 | if (hPSTAGH_EVsEtagh->GetEntries()==0) hPSTAGH_EVsEtagh->SetBins(NC_TAGH,Elows_TAGH,NEb_PS,Elows_PS); |
350 | if (hPSTAGH_timeVsEtagh->GetEntries()==0) hPSTAGH_timeVsEtagh->SetBins(NC_TAGH,Elows_TAGH,NTb,Tlows); |
351 | if (hPSTAGH_EdiffVsEtagh->GetEntries()==0) hPSTAGH_EdiffVsEtagh->SetBins(NC_TAGH,Elows_TAGH,NEdiff,EdiffLows); |
352 | |
353 | if (hPS_Etagm->GetEntries()==0) hPS_Etagm->SetBins(NC_TAGM,Elows_TAGM); |
354 | if (hPS_timeVsEtagm->GetEntries()==0) hPS_timeVsEtagm->SetBins(NC_TAGM,Elows_TAGM,NTb,Tlows); |
355 | if (hPSTAGM_Etagm->GetEntries()==0) hPSTAGM_Etagm->SetBins(NC_TAGM,Elows_TAGM); |
356 | if (hPSTAGM_EVsEtagm->GetEntries()==0) hPSTAGM_EVsEtagm->SetBins(NC_TAGM,Elows_TAGM,NEb_PS,Elows_PS); |
357 | if (hPSTAGM_timeVsEtagm->GetEntries()==0) hPSTAGM_timeVsEtagm->SetBins(NC_TAGM,Elows_TAGM,NTb,Tlows); |
358 | if (hPSTAGM_EdiffVsEtagm->GetEntries()==0) hPSTAGM_EdiffVsEtagm->SetBins(NC_TAGM,Elows_TAGM,NEdiff,EdiffLows); |
359 | japp->RootUnLock(); |
360 | |
361 | return NOERROR; |
362 | } |
363 | |
364 | |
365 | |
366 | |
367 | jerror_t JEventProcessor_PSPair_online::evnt(JEventLoop *loop, int eventnumber) |
368 | { |
369 | |
370 | |
371 | |
372 | |
373 | |
374 | |
375 | vector<const DPSCPair*> cpairs; |
376 | loop->Get(cpairs); |
377 | |
378 | vector<const DPSPair*> fpairs; |
379 | loop->Get(fpairs); |
380 | |
381 | vector<const DTAGHHit*> taghhits; |
382 | loop->Get(taghhits); |
383 | vector<const DTAGMHit*> tagmhits; |
384 | loop->Get(tagmhits); |
385 | |
386 | japp->RootWriteLock(); |
387 | hPSC_NHitPairs->Fill(cpairs.size()); |
388 | hPS_NHitPairs->Fill(fpairs.size()); |
389 | |
390 | if (cpairs.size()>=1) { |
391 | |
392 | const DPSCHit* clhit = cpairs[0]->ee.first; |
393 | const DPSCHit* crhit = cpairs[0]->ee.second; |
394 | hPSC_PSCIDLeftVsIDRight->Fill(crhit->module,clhit->module); |
395 | hPSC_tdiffVsPSCIDRight[clhit->module-1]->Fill(crhit->module,clhit->t-crhit->t); |
396 | hPSC_tdiffVsPSCIDLeft[crhit->module-1]->Fill(clhit->module,clhit->t-crhit->t); |
397 | |
398 | if (fpairs.size()>=1) { |
399 | pspair_num_events->Fill(1); |
400 | |
401 | const DPSHit* flhit = fpairs[0]->ee.first; |
402 | const DPSHit* frhit = fpairs[0]->ee.second; |
403 | double E_pair = flhit->E+frhit->E; |
404 | hPS_PSCIDLeftVsIDRight->Fill(crhit->module,clhit->module); |
405 | hPS_PSIDLeftVsIDRight->Fill(frhit->column,flhit->column); |
406 | hPS_ElVsEr->Fill(frhit->E,flhit->E); |
407 | hPS_E->Fill(E_pair); |
408 | hPS_timeVsE->Fill(E_pair,clhit->t); |
409 | |
410 | hPS_PSIDLeftVsPSCIDLeft->Fill(clhit->module,flhit->column); |
411 | hPS_PSIDRightVsPSCIDRight->Fill(crhit->module,frhit->column); |
412 | hPS_ElVsPSCIDLeft->Fill(clhit->module,flhit->E); |
413 | hPS_ErVsPSCIDRight->Fill(crhit->module,frhit->E); |
414 | |
415 | double EdiffMax = 0.15; |
416 | for (unsigned int i=0; i < taghhits.size(); i++) { |
417 | const DTAGHHit* tag = taghhits[i]; |
418 | if (!tag->has_TDC||!tag->has_fADC) continue; |
419 | hPS_TAGHCounterID->Fill(tag->counter_id); |
420 | hPS_Etagh->Fill(tag->E); |
421 | hPS_timeVsEtagh->Fill(tag->E,tag->t); |
422 | hPSTAGH_tdiffVsEdiff->Fill((E_pair-tag->E)/E_pair,clhit->t-tag->t); |
423 | if (fabs(E_pair-tag->E)/E_pair > EdiffMax) continue; |
424 | hPSTAGH_TAGHCounterID->Fill(tag->counter_id); |
425 | hPSTAGH_Etagh->Fill(tag->E); |
426 | hPSTAGH_timeVsEtagh->Fill(tag->E,tag->t); |
427 | hPSTAGH_EVsEtagh->Fill(tag->E,E_pair); |
428 | hPSTAGH_EdiffVsEtagh->Fill(tag->E,(E_pair-tag->E)/E_pair); |
429 | hPSTAGH_EdiffVsTAGHCounterID->Fill(tag->counter_id,(E_pair-tag->E)/E_pair); |
430 | hPSTAGH_tdiffVsTAGHCounterID_L[clhit->module-1]->Fill(tag->counter_id,clhit->t-tag->t); |
431 | hPSTAGH_tdiffVsTAGHCounterID_R[crhit->module-1]->Fill(tag->counter_id,crhit->t-tag->t); |
432 | hPSTAGH_PSCIDLeftVsIDRight->Fill(crhit->module,clhit->module); |
433 | hPSTAGH_PSIDLeftVsIDRight->Fill(frhit->column,flhit->column); |
434 | hPSTAGH_ElVsEr->Fill(frhit->E,flhit->E); |
435 | hPSTAGH_E->Fill(E_pair); |
436 | hPSTAGH_timeVsE->Fill(E_pair,clhit->t-tag->t); |
437 | } |
438 | |
439 | for (unsigned int i=0; i < tagmhits.size(); i++) { |
440 | const DTAGMHit* tag = tagmhits[i]; |
441 | if (!tag->has_TDC||!tag->has_fADC) continue; |
442 | if (tag->row!=0) continue; |
443 | hPS_TAGMColumn->Fill(tag->column); |
444 | hPS_Etagm->Fill(tag->E); |
445 | hPS_timeVsEtagm->Fill(tag->E,tag->t); |
446 | hPSTAGM_tdiffVsEdiff->Fill((E_pair-tag->E)/E_pair,clhit->t-tag->t); |
447 | if (fabs(E_pair-tag->E)/E_pair > EdiffMax) continue; |
448 | hPSTAGM_TAGMColumn->Fill(tag->column); |
449 | hPSTAGM_Etagm->Fill(tag->E); |
450 | hPSTAGM_timeVsEtagm->Fill(tag->E,tag->t); |
451 | hPSTAGM_EVsEtagm->Fill(tag->E,E_pair); |
452 | hPSTAGM_EdiffVsEtagm->Fill(tag->E,(E_pair-tag->E)/E_pair); |
453 | hPSTAGM_EdiffVsTAGMColumn->Fill(tag->column,(E_pair-tag->E)/E_pair); |
454 | hPSTAGM_tdiffVsTAGMColumn_L[clhit->module-1]->Fill(tag->column,clhit->t-tag->t); |
455 | hPSTAGM_tdiffVsTAGMColumn_R[crhit->module-1]->Fill(tag->column,crhit->t-tag->t); |
456 | hPSTAGM_PSCIDLeftVsIDRight->Fill(crhit->module,clhit->module); |
457 | hPSTAGM_PSIDLeftVsIDRight->Fill(frhit->column,flhit->column); |
458 | hPSTAGM_ElVsEr->Fill(frhit->E,flhit->E); |
459 | hPSTAGM_E->Fill(E_pair); |
460 | hPSTAGM_timeVsE->Fill(E_pair,clhit->t-tag->t); |
461 | } |
462 | } |
463 | } |
464 | |
465 | japp->RootUnLock(); |
466 | |
467 | return NOERROR; |
468 | } |
469 | |
470 | |
471 | |
472 | |
473 | jerror_t JEventProcessor_PSPair_online::erun(void) |
474 | { |
475 | |
476 | |
477 | |
478 | return NOERROR; |
479 | } |
480 | |
481 | |
482 | |
483 | |
484 | jerror_t JEventProcessor_PSPair_online::fini(void) |
485 | { |
486 | |
487 | return NOERROR; |
488 | } |
489 | |