9 #include <JANA/JApplication.h>
26 #include <TDirectory.h>
29 #include <TProfile2D.h>
127 NOtrig=0; FPtrig=0; GTPtrig=0; FPGTPtrig=0; trigUS=0; trigDS=0; trigCosmic=0;
130 TDirectory *
main = gDirectory;
131 gDirectory->mkdir(
"bcalLED")->cd();
135 int timemin_ns = -200;
136 int timemax_ns = 400;
137 int timeminTDC_ns = -300;
138 int timemaxTDC_ns = 900;
139 float Ehit_min = -0.2;
140 float Ehit_max = 2.0;
142 gStyle->SetTitleOffset(1,
"Y");
143 gStyle->SetTitleSize(0.05,
"xyz");
144 gStyle->SetTitleSize(0.08,
"h");
145 gStyle->SetLabelSize(0.05,
"xyz");
146 gStyle->SetTitleX(0);
147 gStyle->SetTitleAlign(13);
148 gStyle->SetNdivisions(505,
"xy");
150 bcal_num_events =
new TH1I(
"bcal_num_events",
"BCAL Number of LEDevents",1, 0.5, 1.5);
152 bcal_fadc_digi_time =
new TH1I(
"bcal_fadc_digi_time",
"ADC Time (DBCALDigiHit);Time (fADC time/62.5 ps)", 550, -600, 6000);
153 bcal_fadc_digi_occ =
new TH2I(
"bcal_fadc_digi_occ",
"ADC occupancy (DBCALDigiHit);Module", 48, 0.5, 48.5, 33, 0.5, 33.5);
155 "Mean pedestal per cell (DBCALDigiHit);Module",
156 48, 0.5, 48.5, 33, 0.5, 33.5);
161 bcal_fadc_digi_occ_layer1 =
new TH1I(
"bcal_fadc_digi_occ_layer1",
"Occupancy in layer 1 (DBCALDigiHit);global sector (4 x module + sector)",192, 0.5, 192.5);
162 bcal_fadc_digi_occ_layer2 =
new TH1I(
"bcal_fadc_digi_occ_layer2",
"Occupancy in layer 2 (DBCALDigiHit);global sector (4 x module + sector)",192, 0.5, 192.5);
163 bcal_fadc_digi_occ_layer3 =
new TH1I(
"bcal_fadc_digi_occ_layer3",
"Occupancy in layer 3 (DBCALDigiHit);global sector (4 x module + sector)",192, 0.5, 192.5);
164 bcal_fadc_digi_occ_layer4 =
new TH1I(
"bcal_fadc_digi_occ_layer4",
"Occupancy in layer 4 (DBCALDigiHit);global sector (4 x module + sector)",192, 0.5, 192.5);
167 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
173 bcal_fadc_digi_pedestal_vevent =
new TProfile(
"bcal_fadc_digi_pedestal_vevent",
"Avg BCAL pedestal vs event;event num;pedestal (all chan avg)",200,0.0,10000.0);
174 bcal_fadc_digi_integral_vevent =
new TProfile(
"bcal_fadc_digi_integral_vevent",
"Avg BCAL integral vs event;event num;integral (all chan avg)",200,0.0,10000.0);
175 bcal_fadc_digi_peak_vevent =
new TProfile(
"bcal_fadc_digi_peak_vevent",
"Avg BCAL peak vs event;event num;peak (all chan avg)",200,0.0,10000.0);
176 bcal_fadc_digi_pedsubint_vevent =
new TProfile(
"bcal_fadc_digi_pedsubint_vevent",
"Avg BCAL ped sub integral vs event;event num;integral - pedestal (all chan avg)",200,0.0,10000.0);
177 bcal_fadc_digi_pedsubpeak_vevent =
new TProfile(
"bcal_fadc_digi_pedsubpeak_vevent",
"Avg BCAL ped sub peak vs event;event num;peak - pedestal (all chan avg)",200,0.0,10000.0);
178 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
191 bcal_fadc_digi_pedestal_vchannel =
new TProfile(
"bcal_fadc_digi_pedestal_vchannel",
"Avg BCAL pedestal vs channel;channel num;pedestal (all chan avg)",1536,0,1536);
192 bcal_fadc_digi_integral_vchannel =
new TProfile(
"bcal_fadc_digi_integral_vchannel",
"Avg BCAL integral vs channel;channel num;integral (all chan avg)",1536,0,1536);
193 bcal_fadc_digi_peak_vchannel =
new TProfile(
"bcal_fadc_digi_peak_vchannel",
"Avg BCAL peak vs channel;channel num;peak (all chan avg)",1536,0,1536);
194 bcal_fadc_digi_pedsubint_vchannel =
new TProfile(
"bcal_fadc_digi_pedsubint_vchannel",
"Avg BCAL ped sub integral vs channel;channel num;integral - pedestal (all chan avg)",1536,0,1536);
195 bcal_fadc_digi_pedsubpeak_vchannel =
new TProfile(
"bcal_fadc_digi_pedsubpeak_vchannel",
"Avg BCAL ped sub peak vs channel;channel num;peak - pedestal (all chan avg)",1536,0,1536);
196 bcal_tdc_digi_time =
new TH1I(
"bcal_tdc_digi_time",
"TDC Time (DBCALDigiTDCHit);Time (F1TDC counts)", 500, 0, 66000);
197 bcal_tdc_digi_reltime =
new TH2I(
"bcal_tdc_digi_reltime",
"Relative TDC Time (DBCALDigiTDCHit);Time (F1TDC counts); TDC trig time",
198 100, 0, 70000, 100, 0, 600);
199 bcal_tdc_digi_occ =
new TH2I(
"bcal_tdc_digi_occ",
"TDC occupancy (DBCALDigiTDCHit);Module", 48, 0.5, 48.5, 25, 0.5, 25.5);
201 bcal_tdc_digi_occ_layer1 =
new TH1I(
"bcal_tdc_digi_occ_layer1",
"Occupancy in layer 1 (DBCALDigiTDCHit);global sector (4 x module + sector)",192, 0.5, 192.5);
202 bcal_tdc_digi_occ_layer2 =
new TH1I(
"bcal_tdc_digi_occ_layer2",
"Occupancy in layer 2 (DBCALDigiTDCHit);global sector (4 x module + sector)",192, 0.5, 192.5);
203 bcal_tdc_digi_occ_layer3 =
new TH1I(
"bcal_tdc_digi_occ_layer3",
"Occupancy in layer 3 (DBCALDigiTDCHit);global sector (4 x module + sector)",192, 0.5, 192.5);
207 bcal_fadc_E =
new TH1I(
"bcal_fadc_E",
"Uncorrected Energy (DBCALHit);Energy, not atten. corr. (GeV)", 500, Ehit_min, Ehit_max);
208 bcal_fadc_t =
new TH1I(
"bcal_fadc_t",
"ADC Time (DBCALHit);Time (ns)", 1200, timemin_ns, timemax_ns);
209 bcal_fadc_occ =
new TH2I(
"bcal_fadc_occ",
"ADC occupancy (DBCALHit);Module", 48, 0.5, 48.5, 33, 0.5, 33.5);
210 bcal_fadc_avgE =
new TH2D(
"bcal_fadc_avgE",
"Average Energy x Occupancy (DBCALHit);Module", 48, 0.5, 48.5, 33, 0.5, 33.5);
211 bcal_fadc_saturated =
new TH2I(
"bcal_fadc_saturated",
"Saturated Occupancy (DBCALHit);Module", 48, 0.5, 48.5, 33, 0.5, 33.5);
213 bcal_tdc_t =
new TH1I(
"bcal_tdc_t",
"TDC Time (DBCALTDCHit);Time (ns)", 1200, timeminTDC_ns, timemaxTDC_ns);
214 bcal_tdc_occ =
new TH2I(
"bcal_tdc_occ",
"TDC occupancy (DBCALTDCHit);Module", 48, 0.5, 48.5, 25, 0.5, 25.5);
216 bcal_num_hits =
new TH1I(
"bcal_num_hits",
"Number of BCAL hits;Number of hits per event", 250, 0, 250);
217 bcal_Uhit_E =
new TH1I(
"bcal_Uhit_E",
"Uncorrected Energy (DBCALUnifiedHit);Energy, not atten. corr. (GeV)", 500, Ehit_min, Ehit_max);
218 bcal_Uhit_t =
new TH1I(
"bcal_Uhit_t",
"Unified time (DBCALUnifiedHit);time (ns)", 1200, timeminTDC_ns, timemaxTDC_ns);
219 bcal_Uhit_t_TDC =
new TH1I(
"bcal_Uhit_t_TDC",
"TDC time (DBCALUnifiedHit);Timewalk corrected TDC time (ns)", 1200, timeminTDC_ns, timemaxTDC_ns);
220 bcal_Uhit_t_ADC =
new TH1I(
"bcal_Uhit_t_ADC",
"ADC time (DBCALUnifiedHit);ADC time (ns)", 1000, timemin_ns, timemax_ns);
221 bcal_Uhit_noTDC_E =
new TH1I(
"bcal_Uhit_noTDC_E",
"Energy for no TDC (DBCALUnifiedHit);Energy", 500, Ehit_min, Ehit_max);
222 bcal_Uhit_tTDC_tADC =
new TH2I(
"bcal_Uhit_tTDC_tADC",
"ADC vs TDC time (DBCALUnifiedHit);TDC time;ADC time (ns)",
223 100, timemin_ns, timemax_ns, 100, timemin_ns, timemax_ns);
224 bcal_Uhit_tdiff =
new TH1I(
"bcal_Uhit_tdiff",
"time diff. (ADC-TDC) (DBCALUnifiedHit);(TDC - ADC) time (ns)",
226 bcal_Uhit_tTDC_E =
new TH2I(
"bcal_Uhit_tTDC_E",
"TDC time vs Energy (DBCALUnifiedHit);Energy, not atten. corr. (GeV);Timewalk corrected TDC time",
227 100, Ehit_min, Ehit_max, 100, timeminTDC_ns, timemaxTDC_ns);
228 bcal_Uhit_tADC_E =
new TH2I(
"bcal_Uhit_tADC_E",
"ADC time vs Energy (DBCALUnifiedHit);Energy, not atten. corr. (GeV);ADC time (ns)",
229 100, Ehit_min, Ehit_max, 100, timemin_ns, timemax_ns);
230 bcal_Uhit_tTDC_twalk =
new TH1I(
"bcal_Uhit_tTDC_twalk",
"TDC timewalk correction (DBCALUnifiedHit);Timewalk correction (ns)",
232 bcal_Uhit_tdiff_ave =
new TProfile2D(
"bcal_Uhit_tdiff_ave",
"Mean time diff. (TDC-ADC) (DBCALDigiHit);Module",
233 48, 0.5, 48.5, 33, 0.5, 33.5);
261 for(
int ibin=1; ibin<=16; ibin++){
264 int layer = 1 + (idy%4);
265 int sector = 1 + idy/4;
269 ss <<
"S"<<sector<<
" L"<<
layer;
271 bcal_fadc_occ->GetYaxis()->SetBinLabel(ibin, ss.str().c_str());
280 ss <<
"S"<<sector<<
" L"<<
layer;
282 bcal_fadc_occ->GetYaxis()->SetBinLabel(ibin+17, ss.str().c_str());
283 bcal_fadc_avgE->GetYaxis()->SetBinLabel(ibin+17, ss.str().c_str());
291 for(
int ibin=1; ibin<=12; ibin++){
294 int layer = 1 + (idy%3);
295 int sector = 1 + idy/3;
299 ss <<
"S"<<sector<<
" L"<<
layer;
301 bcal_tdc_occ->GetYaxis()->SetBinLabel(ibin, ss.str().c_str());
306 ss <<
"S"<<sector<<
" L"<<
layer;
308 bcal_tdc_occ->GetYaxis()->SetBinLabel(ibin+13, ss.str().c_str());
339 vector<const DBCALGeometry *> BCALGeomVec;
340 loop->Get(BCALGeomVec);
341 if(BCALGeomVec.size() == 0)
342 throw JException(
"Could not load locBCALGeometry object!");
346 vector<const DBCALDigiHit*> dbcaldigihits;
347 vector<const DBCALTDCDigiHit*> dbcaltdcdigihits;
348 vector<const DBCALHit*> dbcalhits;
349 vector<const DBCALTDCHit*> dbcaltdchits;
350 vector<const DBCALUnifiedHit*> dbcaluhits;
352 bool LED_US=0, LED_DS=0;
356 loop->GetSingle(trig);
394 if (LED_US || LED_DS) {
396 loop->Get(dbcaldigihits);
397 loop->Get(dbcaltdcdigihits);
398 loop->Get(dbcalhits);
399 loop->Get(dbcaltdchits);
400 loop->Get(dbcaluhits);
404 japp->RootFillLock(
this);
406 if( (dbcaldigihits.size() > 0) || (dbcaltdcdigihits.size() > 0) )
429 for(
unsigned int i=0; i<dbcaldigihits.size(); i++) {
477 for(
unsigned int i=0; i<dbcaltdcdigihits.size(); i++) {
481 vector<const DF1TDCHit*> f1tdchits;
483 if(f1tdchits.size() > 0)
500 for(
unsigned int i=0; i<dbcalhits.size(); i++) {
504 vector<const DBCALDigiHit*> assoc_BCALDigiHit;
505 hit->Get(assoc_BCALDigiHit);
506 if (assoc_BCALDigiHit.size()>0) {
507 vector<const Df250PulseIntegral*> f250PulseIntegral;
508 assoc_BCALDigiHit[0]->Get(f250PulseIntegral);
510 if (f250PulseIntegral.size()>0) {
511 vector<const Df250WindowRawData*> f250WindowRawData;
512 f250PulseIntegral[0]->Get(f250WindowRawData);
513 if (f250WindowRawData.size()>0) {
515 if (f250WindowRawData[0]->overflow==1) {
522 vector<const Df250PulseData*> f250PulseData;
523 assoc_BCALDigiHit[0]->Get(f250PulseData);
525 if (f250PulseData.size()>0) {
526 vector<const Df250WindowRawData*> f250WindowRawData;
527 f250PulseData[0]->Get(f250WindowRawData);
528 if (f250WindowRawData.size()>0) {
530 if (f250WindowRawData[0]->overflow==1) {
562 for(
unsigned int i=0; i<dbcaltdchits.size(); i++) {
576 for(
unsigned int i=0; i<dbcaluhits.size(); i++) {
582 if (Uhit->
t_TDC != 0) {
588 vector<const DBCALTDCHit*> tdchits;
605 japp->RootFillUnLock(
this);
620 printf(
"\nTrigger statistics");
621 printf(
"------------------------\n");
622 printf(
"%20s: %10i\n",
"no triggers",NOtrig);
623 printf(
"%20s: %10i\n",
"Front Panel",FPtrig);
624 printf(
"%20s: %10i\n",
"GTP",GTPtrig);
625 printf(
"%20s: %10i\n",
"FP && GTP",FPGTPtrig);
626 printf(
"%20s: %10i\n",
"US LED",trigUS);
627 printf(
"%20s: %10i\n",
"DS LED",trigDS);
628 printf(
"%20s: %10i\n",
"BCAL",trigCosmic);
static TH1I * bcal_tdc_digi_occ_layer2
static TH1I * bcal_fadc_digi_occ_layer3
static TProfile * bcal_fadc_digi_integral_vchannel
static TH2I * bcal_tdc_digi_occ
static TH1I * bcal_Uhit_t
if(locHist_BCALShowerPhiVsZ!=NULL)
float t_TDC
Time of TDC hit that is closes t to the ADC time.
static TH1I * bcal_Uhit_t_ADC
~JEventProcessor_BCAL_LEDonline()
static TH1I * bcal_Uhit_E
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
static TProfile * bcal_fadc_digi_integral_vevent
static TH1I * bcal_Uhit_noTDC_E
static TProfile2D * bcal_fadc_digi_pedestal_ave
static TH2I * bcal_Uhit_tADC_E
static TH1I * bcal_fadc_digi_occ_layer4
static TH2I * bcal_tdc_occ
static TH2I * bcal_fadc_occ
uint32_t nsamples_integral
number of samples used in integral
JEventProcessor_BCAL_LEDonline()
static TH1I * bcal_fadc_t
static TH2I * bcal_fadc_digi_occ
jerror_t fini(void)
Called after last event of last event source has been processed.
static TH1I * bcal_fadc_digi_nsamples_integral
uint32_t pulse_peak
identified pulse height as returned by FPGA algorithm
uint32_t pulse_integral
identified pulse integral as returned by FPGA algorithm
int getglobalchannelnumber(int module, int layer, int sector, int end) const
Return a BCAL channel number, in order of significance (module, layer, sector, end).
static TH1I * bcal_tdc_digi_occ_layer3
jerror_t init(void)
Called once at program start.
static TProfile * bcal_fadc_digi_pedsubint_vevent
static TH1I * bcal_fadc_digi_nhits_evnt
static TH1I * bcal_Uhit_t_TDC
static TH1I * bcal_fadc_digi_time
uint32_t nsamples_pedestal
number of samples used in pedestal
static TProfile * bcal_fadc_digi_pedsubpeak_vchannel
float t_ADC
Time from fADC.
static TH1I * bcal_fadc_E
static TH1I * bcal_num_events
static TH1I * bcal_tdc_digi_nhits_evnt
static TH2I * bcal_Uhit_tTDC_tADC
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
static TProfile * bcal_fadc_digi_peak_vchannel
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
int getglobalsector(int module, int sector) const
static TH2I * bcal_tdc_digi_reltime
static TH1I * bcal_num_hits
uint32_t pedestal
pedestal info used by FPGA (if any)
static TProfile * bcal_fadc_digi_peak_vevent
static TProfile * bcal_fadc_digi_pedsubpeak_vevent
static TH2I * bcal_fadc_saturated
static TH1I * bcal_tdc_digi_time
static TProfile * bcal_fadc_digi_pedsubint_vchannel
uint32_t pulse_time
identified pulse time as returned by FPGA algorithm
static TProfile2D * bcal_Uhit_tdiff_ave
static TH1I * bcal_fadc_digi_nsamples_pedestal
static TH1I * bcal_fadc_digi_occ_layer2
static TH1I * bcal_tdc_digi_occ_layer1
static TH2D * bcal_fadc_avgE
static TProfile * bcal_fadc_digi_pedestal_vevent
printf("string=%s", string)
static TProfile * bcal_fadc_digi_pedestal_vchannel
static TH1I * bcal_fadc_digi_occ_layer1
static TH1I * bcal_Uhit_tTDC_twalk
int main(int argc, char *argv[])
static TH1I * bcal_Uhit_tdiff
static TH2I * bcal_Uhit_tTDC_E
float t
Unified time, obtained from ADC and/or TDC and used for further analysis.