18 #include <JANA/JApplication.h>
19 #include <JANA/JFactory.h>
37 #define F1TaggerTypes(X) \
44 template<
typename T>
static bool F1Check(
const T* hit);
47 template<
typename T>
static double F1tdiff(
const T* hit);
48 template<
typename T>
static double F1tdiff2(
const T* hit,
const T* hit2);
79 {
return (hit->row==hit2->row) && (hit->column==hit2->column); }
87 {
return (hit->gPlane==hit2->gPlane) && (hit->element==hit2->element); }
97 {
return hit->t_TDC - hit2->t_ADC; }
99 {
return (hit->module==hit2->module) && (hit->layer==hit2->layer)
100 && (hit->sector==hit2->sector) && (hit->end==hit2->end); }
112 for(
auto hit : hits){
115 vector<const DF1TDCHit*> f1hits;
117 for(
auto f1hit : f1hits){
118 pair<int,int> rocid_slot(f1hit->rocid, f1hit->slot);
119 double fbin = f1tdc_bin_map[rocid_slot];
121 dF1TDC_fADC_tdiff->Fill(fbin, tdiff);
131 for(
auto hit2 : hits) {
134 vector<const DF1TDCHit*> f1hits;
136 for(
auto f1hit : f1hits){
137 pair<int,int> rocid_slot(f1hit->rocid, f1hit->slot);
138 double fbin = f1tdc_bin_map[rocid_slot];
140 dF1TDC_fADC_tdiff->Fill(fbin, tdiff);
178 japp->RootWriteLock();
181 TDirectory *
main = gDirectory;
183 gDirectory->mkdir(
"highlevel")->cd();
186 last_timestamp = 0.0;
188 dHist_EventInfo =
new TH1D(
"EventInfo",
"Misc. event info used to communicate event time to macros", 2, 0.0 , 2.0);
193 double ns_per_bin = 0.2;
195 double RFhi = RFlo + ns_per_bin*(double)NRFbins;
196 double dft_min = 50.0;
197 double dft_max = 900.0;
198 int Ndft_bins = (1.0/dft_min - 1.0/dft_max)*1000.0/ns_per_bin;
199 dHist_BeamBunchPeriod =
new TH1I(
"RFBeamBunchPeriod",
"RF Beam Bunch Period;TAGH #Deltat (Within Same Counter) (ns)", NRFbins, RFlo, RFhi);
200 dHist_BeamBunchPeriod_DFT =
new TH1F(
"RFBeamBunchPeriod_DFT",
"Fourier Transform of RF Beam Bunch Period;Beam bunch frequency (MHz)", Ndft_bins, dft_min, dft_max);
204 dNumHadronicTriggers_CoherentPeak_RFSignal.assign(33, 0.0);
205 dNumHadronicTriggers_CoherentPeak_RFSideband.assign(33, 0.0);
207 dRFSidebandBunchRange = pair<int, int>(3, 5);
208 dShowerEOverPCut = 0.75;
210 dHist_NumTriggers =
new TH2I(
"NumTriggers",
";Trigger Bit", 33, 0.5, 33.5, 4, 0.5, 4.5);
211 dHist_NumTriggers->GetYaxis()->SetBinLabel(1,
"# Triggers");
212 dHist_NumTriggers->GetYaxis()->SetBinLabel(2,
"# Front Panel Triggers");
213 dHist_NumTriggers->GetYaxis()->SetBinLabel(3,
"# Hadronic Triggers");
214 dHist_NumTriggers->GetYaxis()->SetBinLabel(4,
"# Hadronic Triggers, Coherent Peak");
215 for(
int loc_i = 1; loc_i <= 32; ++loc_i)
217 ostringstream locBinStream;
218 locBinStream << loc_i;
219 dHist_NumTriggers->GetXaxis()->SetBinLabel(loc_i, locBinStream.str().c_str());
221 dHist_NumTriggers->GetXaxis()->SetBinLabel(33,
"Total");
223 dHist_BCALVsFCAL_TrigBit1 =
new TH2I(
"BCALVsFCAL_TrigBit1",
"TRIG BIT 1;E (FCAL) (count);E (BCAL) (count)", 200, 0., 10000, 200, 0., 50000);
225 dHist_L1bits_gtp =
new TH1I(
"L1bits_gtp",
"L1 trig bits from GTP;Trig. bit (1-32)", 34, 0.5, 34.5);
226 dHist_L1bits_fp =
new TH1I(
"L1bits_fp",
"L1 trig bits from FP;Trig. bit (1-32)", 32, 0.5, 32.5);
231 dHist_NumHighLevelObjects =
new TH2I(
"NumHighLevelObjects",
";;# Objects / Event", 12, 0.5, 12.5, 101, -0.5, 100.5);
232 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(1,
"DSCHit");
233 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(2,
"DTOFPoint");
234 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(3,
"DBCALShower");
235 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(4,
"DFCALShower");
236 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(5,
"DTimeBasedTrack");
237 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(6,
"TrackSCMatches");
238 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(7,
"TrackTOFMatches");
239 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(8,
"TrackBCALMatches");
240 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(9,
"TrackFCALMatches");
241 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(10,
"DBeamPhoton");
242 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(11,
"DChargedTrack");
243 dHist_NumHighLevelObjects->GetXaxis()->SetBinLabel(12,
"DNeutralShower");
248 dHist_BeamEnergy =
new TH1I(
"BeamEnergy",
"Reconstructed Tagger Beam Energy;Beam Energy (GeV)", 240, 0.0, 12.0);
251 dHist_PSPairEnergy =
new TH1I(
"PSPairEnergy",
"Reconstructed PS Beam Energy;Beam Energy (GeV)", 250, 7.0, 12.0);
254 dHist_PVsTheta_Tracks =
new TH2I(
"PVsTheta_Tracks",
"P vs. #theta for time-based tracks;#theta#circ;p (GeV/c)", 280, 0.0, 140.0, 150, 0.0, 12.0);
257 dHist_PhiVsTheta_Tracks =
new TH2I(
"PhiVsTheta_Tracks",
"#phi vs. #theta for time-based tracks;#theta#circ;#phi#circ", 280, 0.0, 140.0, 60, -180.0, 180.0);
262 dEventVertexZ =
new TH1I(
"EventVertexZ",
"Reconstructed Event Vertex Z;Event Vertex-Z (cm)", 600, 0.0, 200.0);
265 dEventVertexYVsX =
new TH2I(
"EventVertexYVsX",
"Reconstructed Event Vertex X/Y;Event Vertex-X (cm);Event Vertex-Y (cm)", 400, -10.0, 10.0, 400, -10.0, 10.0);
269 d2gamma =
new TH1I(
"TwoGammaMass",
"2#gamma inv. mass;2#gamma inv. mass (GeV)", 400, 0.0, 1.2);
272 dpip_pim =
new TH1I(
"PiPlusPiMinus",
"#pi^{+}#pi^{-} inv. mass w/ identified proton;#pi^{+}#pi^{-} inv. mass (GeV)", 400, 0.0, 2.0);
275 dKp_Km =
new TH1I(
"KPlusKMinus",
"K^{+}K^{-} inv. mass w/ identified proton;K^{+}K^{-} inv. mass (GeV)", 400, 0.0, 2.0);
278 dpip_pim_pi0 =
new TH1I(
"PiPlusPiMinusPiZero",
"#pi^{+}#pi^{-}#pi^{o} inv. mass w/ identified proton;#pi^{+}#pi^{-}#pi^{o} inv. mass (GeV)", 200, 0.035, 2.0);
279 dptrans =
new TH1I(
"PiPlusPiMinusPiZeroProton_t",
";#pi^{+}#pi^{-}#pi^{o}p transverse momentum(GeV)", 500, 0.0, 1.0);
281 dbeta_vs_p =
new TH2I(
"BetaVsP",
"#beta vs. p (best FOM all charged tracks);p (GeV);#beta", 200, 0.0, 2.0, 100, 0.0, 1.2);
286 map<int, set<int>> f1tdc_rocid_slot;
287 for(
int slot=3; slot<=17; slot++){
288 if( slot==11 || slot==12)
continue;
289 if( slot<=16 ) f1tdc_rocid_slot[75].insert(slot);
290 if( slot<=4 ) f1tdc_rocid_slot[95].insert(slot);
291 if( slot<=13 ) f1tdc_rocid_slot[36].insert(slot);
292 if( slot<=13 ) f1tdc_rocid_slot[33].insert(slot);
293 if( slot<=13 ) f1tdc_rocid_slot[39].insert(slot);
294 if( slot<=13 ) f1tdc_rocid_slot[42].insert(slot);
295 if( slot<=17 ) f1tdc_rocid_slot[51].insert(slot);
296 if( slot<=16 ) f1tdc_rocid_slot[54].insert(slot);
297 if( slot<=16 ) f1tdc_rocid_slot[63].insert(slot);
298 if( slot<=16 ) f1tdc_rocid_slot[64].insert(slot);
302 for(
auto p : f1tdc_rocid_slot){
304 for(
int slot : p.second){
305 f1tdc_bin_map[ pair<int,int>(rocid,slot) ] = (
double)f1tdc_bin_map.size();
310 dF1TDC_fADC_tdiff =
new TH2D(
"F1TDC_fADC_tdiff",
"F1TDC - fADC Time diff", f1tdc_bin_map.size(), 0.5, 0.5+(double)f1tdc_bin_map.size(), 64, -64.0, 64.0);
311 dF1TDC_fADC_tdiff->SetStats(0);
312 dF1TDC_fADC_tdiff->SetYTitle(
"TDC - ADC in ns (or TDC/50 time for FDC)");
313 for(
auto p : f1tdc_bin_map){
314 int rocid = p.first.first;
315 int slot = p.first.second;
318 sprintf(str,
"rocid%d slot%d", rocid, slot);
319 dF1TDC_fADC_tdiff->GetXaxis()->SetBinLabel(jbin, str);
337 vector<double> locBeamPeriodVector;
338 locEventLoop->GetCalib(
"PHOTON_BEAM/RF/beam_period", locBeamPeriodVector);
339 dBeamBunchPeriod = locBeamPeriodVector[0];
341 dCoherentPeakRange = pair<double, double>(8.4, 9.0);
342 map<string, double> photon_beam_param;
343 if(locEventLoop->GetCalib(
"/ANALYSIS/beam_asymmetry/coherent_energy", photon_beam_param) ==
false)
344 dCoherentPeakRange = pair<double, double>(photon_beam_param[
"cohmin_energy"], photon_beam_param[
"cohedge_energy"]);
349 fcal_row_mask_min = 26;
350 fcal_row_mask_max = 32;
351 fcal_col_mask_min = 26;
352 fcal_col_mask_max = 32;
354 if( runnumber < 11127 )
356 fcal_row_mask_min = 24;
357 fcal_row_mask_max = 34;
358 fcal_col_mask_min = 24;
359 fcal_col_mask_max = 34;
370 vector<const DTrackTimeBased*> locTrackTimeBasedVector;
371 locEventLoop->Get(locTrackTimeBasedVector);
373 vector<const DBeamPhoton*> locBeamPhotons;
374 locEventLoop->Get(locBeamPhotons);
376 vector<const DPSPair*> locPSPairs;
377 locEventLoop->Get(locPSPairs);
379 vector<const DPSCPair*> locPSCPairs;
380 locEventLoop->Get(locPSCPairs);
382 vector<const DFCALShower*> locFCALShowers;
383 locEventLoop->Get(locFCALShowers);
385 vector<const DBCALShower*> locBCALShowers;
386 locEventLoop->Get(locBCALShowers);
388 vector<const DNeutralShower*> locNeutralShowers;
389 locEventLoop->Get(locNeutralShowers);
391 vector<const DNeutralParticle*> locNeutralParticles;
392 locEventLoop->Get(locNeutralParticles,
"PreSelect");
394 vector<const DTOFPoint*> locTOFPoints;
395 locEventLoop->Get(locTOFPoints);
397 vector<const DSCHit*> locSCHits;
398 locEventLoop->Get(locSCHits);
400 vector<const DTAGHHit*> locTAGHHits;
401 locEventLoop->Get(locTAGHHits);
403 vector<const DBCALDigiHit*> locBCALDigiHits;
404 locEventLoop->Get(locBCALDigiHits);
406 vector<const DFCALDigiHit*> locFCALDigiHits;
407 locEventLoop->Get(locFCALDigiHits);
410 try {locEventLoop->GetSingle(locCODAEventInfo);}
catch(...){}
413 try {locEventLoop->GetSingle(locEPICSvalue);}
catch(...){}
416 locEventLoop->GetSingle(locDetectorMatches);
419 locEventLoop->GetSingle(locEventRFBunch);
421 const DVertex* locVertex = NULL;
422 locEventLoop->GetSingle(locVertex);
424 vector<const DL1Trigger*> locL1Triggers;
425 locEventLoop->Get(locL1Triggers);
426 const DL1Trigger* locL1Trigger = locL1Triggers.empty() ? NULL : locL1Triggers[0];
428 vector<const DChargedTrack*> locChargedTracks;
429 locEventLoop->Get(locChargedTracks,
"PreSelect");
434 vector<const A*> v##A; \
435 locEventLoop->Get(v##A);
436 #define GetTaggerVect(A) \
437 vector<const A*> v##A; \
438 locEventLoop->Get(v##A,"Calib");
479 if(locEPICSvalue && (unix_time==0)){
484 double timestamp = 0.0;
485 if(locCODAEventInfo) timestamp = (double)locCODAEventInfo->
avg_timestamp / 250.0E6;
487 if(timestamp != 0.0) last_timestamp = timestamp;
488 if(unix_time!=0.0 && last_timestamp!=0.0) unix_offset = (double)unix_time - last_timestamp;
489 if( (unix_time==0) && (timestamp!=0.0) && (unix_offset!=0.0) ) unix_time = (unix_offset + timestamp);
494 double *rf_dft = NULL;
495 if(dHist_BeamBunchPeriod->GetEntries() > 100){
497 int NRF_bins = dHist_BeamBunchPeriod->GetNbinsX();
498 int Ndft_bins = dHist_BeamBunchPeriod_DFT->GetNbinsX();
499 double ns_per_bin = dHist_BeamBunchPeriod->GetBinWidth(1);
500 double rfdomain = ns_per_bin*(double)NRF_bins;
501 rf_dft =
new double[Ndft_bins];
502 for(
int ibin=1; ibin<=Ndft_bins; ibin++){
505 double f = dHist_BeamBunchPeriod_DFT->GetXaxis()->GetBinCenter(ibin);
506 double k = rfdomain/(1000.0/
f);
508 double dphi = TMath::TwoPi()*k/(double)NRF_bins;
512 for(
int jbin=1; jbin<=(int)NRF_bins; jbin++){
514 double v = dHist_BeamBunchPeriod->GetBinContent(jbin);
515 double theta = (double)jbin*dphi;
516 sumc += v*cos(theta);
517 sums += v*
sin(theta);
520 rf_dft[ibin-1] =
sqrt(sumc*sumc + sums*sums);
527 map<int, set<double> > locTAGHHitMap;
528 for(
size_t loc_i = 0; loc_i < locTAGHHits.size(); ++loc_i)
530 if(locTAGHHits[loc_i]->has_TDC)
531 locTAGHHitMap[locTAGHHits[loc_i]->counter_id].insert(locTAGHHits[loc_i]->time_tdc);
535 map<int, set<double> >::iterator locTAGHIterator = locTAGHHitMap.begin();
536 vector<double> locTAGHDeltaTs;
537 for(; locTAGHIterator != locTAGHHitMap.end(); ++locTAGHIterator)
539 set<double>& locCounterHits = locTAGHIterator->second;
540 if(locCounterHits.size() < 2)
542 set<double>::iterator locSetIterator = locCounterHits.begin();
543 set<double>::iterator locPreviousSetIterator = locSetIterator;
544 for(++locSetIterator; locSetIterator != locCounterHits.end(); ++locSetIterator, ++locPreviousSetIterator)
545 locTAGHDeltaTs.push_back(*locSetIterator - *locPreviousSetIterator);
550 vector<unsigned int> locgtpTrigBits(32, 0);
551 vector<unsigned int> locfpTrigBits(32, 0);
553 if(locL1Trigger != NULL)
555 for(
unsigned int bit = 0; bit < 32; ++bit){
556 locgtpTrigBits[bit] = (locL1Trigger->
trig_mask & (1 << bit)) ? 1 : 0;
557 locfpTrigBits[bit] = (locL1Trigger->
fp_trig_mask & (1 << bit)) ? 1 : 0;
563 for(
auto fcal_hit : locFCALDigiHits){
564 int row = fcal_hit->row;
565 int col = fcal_hit->column;
566 if( (row >= fcal_row_mask_min) && (row <= fcal_row_mask_max) ){
567 if( (col >= fcal_col_mask_min) && (col <= fcal_col_mask_max) )
continue;
570 if( ((int32_t)fcal_hit->pulse_peak-100) <= fcal_cell_thr)
continue;
572 uint32_t adc_time = (fcal_hit->pulse_time >> 6) & 0x1FF;
573 if((adc_time < 15) || (adc_time > 50))
continue;
575 Int_t pulse_int = fcal_hit->pulse_integral - fcal_hit->nsamples_integral*100;
576 if(pulse_int < 0)
continue;
577 fcal_tot_en += pulse_int;
582 for(
auto bcal_hit : locBCALDigiHits){
583 if( ((int32_t)bcal_hit->pulse_peak-100) <= bcal_cell_thr)
continue;
584 Int_t pulse_int = bcal_hit->pulse_integral - bcal_hit->nsamples_integral*100;
585 if(pulse_int < 0)
continue;
586 bcal_tot_en += pulse_int;
591 vector<const DBeamPhoton*> locBeamPhotons_InTime;
592 for(
auto locBeamPhoton : locBeamPhotons)
594 double locDeltaT = locBeamPhoton->time() - locEventRFBunch->
dTime;
595 if(fabs(locDeltaT) <= 0.5*dBeamBunchPeriod)
596 locBeamPhotons_InTime.push_back(locBeamPhoton);
600 if(!locPSCPairs.empty()){
601 for(
auto pspair : locPSPairs){
602 auto flhit = pspair->ee.first;
603 auto frhit = pspair->ee.second;
604 double E = flhit->E + frhit->E;
611 bool locIsHadronicEventFlag =
false;
612 for(
auto locTrack : locChargedTracks)
615 auto locChargedHypo = locTrack->Get_BestTrackingFOM();
618 auto locDetector = locChargedHypo->t1_detector();
619 double locDeltaT = locChargedHypo->time() - locChargedHypo->t0();
620 if(fabs(locDeltaT) > dTimingCutMap[
Electron][locDetector])
622 locIsHadronicEventFlag =
true;
627 double locP = locChargedHypo->momentum().Mag();
628 double locShowerEOverP = 0.0;
629 auto locFCALShowerMatchParams = locChargedHypo->Get_FCALShowerMatchParams();
630 auto locBCALShowerMatchParams = locChargedHypo->Get_BCALShowerMatchParams();
631 if(locFCALShowerMatchParams != NULL)
633 const DFCALShower* locFCALShower = locFCALShowerMatchParams->dFCALShower;
634 locShowerEOverP = locFCALShower->
getEnergy()/locP;
636 else if(locBCALShowerMatchParams != NULL)
638 const DBCALShower* locBCALShower = locBCALShowerMatchParams->dBCALShower;
639 locShowerEOverP = locBCALShower->
E/locP;
643 locIsHadronicEventFlag =
true;
647 if(locShowerEOverP < dShowerEOverPCut)
649 locIsHadronicEventFlag =
true;
654 int locNumHadronicTriggers_CoherentPeak_RFSignal = 0;
655 int locNumHadronicTriggers_CoherentPeak_RFSideband = 0;
656 double locNumRFSidebandBunches = 2.0*double(dRFSidebandBunchRange.second - dRFSidebandBunchRange.first);
657 if(locIsHadronicEventFlag)
660 for(
auto& locBeamPhoton : locBeamPhotons)
662 if(std::isnan(locEventRFBunch->
dTime))
664 if((locBeamPhoton->energy() < dCoherentPeakRange.first) || (locBeamPhoton->energy() > dCoherentPeakRange.second))
668 double locSidebandMinDeltaT = dBeamBunchPeriod*(double(dRFSidebandBunchRange.first) - 0.5);
669 double locSidebandMaxDeltaT = dBeamBunchPeriod*(double(dRFSidebandBunchRange.first) + 0.5);
671 double locBeamRFDeltaT = locBeamPhoton->time() - locEventRFBunch->
dTime;
672 if(fabs(locBeamRFDeltaT) <= 0.5*dBeamBunchPeriod)
673 ++locNumHadronicTriggers_CoherentPeak_RFSignal;
674 else if((fabs(locBeamRFDeltaT) >= locSidebandMinDeltaT) && (fabs(locBeamRFDeltaT) <= locSidebandMaxDeltaT))
675 ++locNumHadronicTriggers_CoherentPeak_RFSideband;
681 japp->RootFillLock(
this);
686 #define F1Fill(A) FillF1Hist(v##A);
693 dHist_EventInfo->SetBinContent(1, 1);
694 dHist_EventInfo->SetBinContent(2, unix_time);
699 for(
size_t loc_i = 0; loc_i < locTAGHDeltaTs.size(); ++loc_i)
700 dHist_BeamBunchPeriod->Fill(locTAGHDeltaTs[loc_i]);
703 for(
int i=0; i<dHist_BeamBunchPeriod_DFT->GetNbinsX(); i++){
704 dHist_BeamBunchPeriod_DFT->SetBinContent(i+1, rf_dft[i]);
711 if(locL1Trigger != NULL)
713 if(locgtpTrigBits[0] == 1)
714 dHist_BCALVsFCAL_TrigBit1->Fill(Float_t(fcal_tot_en), Float_t(bcal_tot_en));
717 for(
int bit=1; bit<=32; bit++){
718 if(locgtpTrigBits[bit-1]) dHist_L1bits_gtp->Fill(bit);
719 if(locfpTrigBits[bit-1] ) dHist_L1bits_fp->Fill(bit);
723 if( locgtpTrigBits[1-1] | locgtpTrigBits[3-1] ) dHist_L1bits_gtp->Fill(33);
727 dHist_NumTriggers->Fill(33, 1);
729 dHist_NumTriggers->Fill(33, 2);
732 for(
int locTriggerBit = 1; locTriggerBit <= 32; ++locTriggerBit)
734 if(locgtpTrigBits[locTriggerBit - 1])
735 dHist_NumTriggers->Fill(locTriggerBit, 1);
736 if(locfpTrigBits[locTriggerBit - 1])
737 dHist_NumTriggers->Fill(locTriggerBit, 2);
741 if(locIsHadronicEventFlag)
746 dHist_NumTriggers->Fill(33, 3);
749 dNumHadronicTriggers_CoherentPeak_RFSignal[32] += double(locNumHadronicTriggers_CoherentPeak_RFSignal);
750 dNumHadronicTriggers_CoherentPeak_RFSideband[32] += double(locNumHadronicTriggers_CoherentPeak_RFSideband);
751 int locNumHadronicTriggers_CoherentPeak = int(dNumHadronicTriggers_CoherentPeak_RFSignal[32] - dNumHadronicTriggers_CoherentPeak_RFSideband[32]/locNumRFSidebandBunches + 0.5);
752 dHist_NumTriggers->SetBinContent(33, 4, locNumHadronicTriggers_CoherentPeak);
756 for(
int locTriggerBit = 1; locTriggerBit <= 32; ++locTriggerBit)
758 if(!locgtpTrigBits[locTriggerBit - 1])
762 dHist_NumTriggers->Fill(locTriggerBit, 3);
765 dNumHadronicTriggers_CoherentPeak_RFSignal[locTriggerBit - 1] += double(locNumHadronicTriggers_CoherentPeak_RFSignal);
766 dNumHadronicTriggers_CoherentPeak_RFSideband[locTriggerBit - 1] += double(locNumHadronicTriggers_CoherentPeak_RFSideband);
767 double locNumHadronicTriggers_CoherentPeak = dNumHadronicTriggers_CoherentPeak_RFSignal[locTriggerBit - 1] - dNumHadronicTriggers_CoherentPeak_RFSideband[locTriggerBit - 1]/locNumRFSidebandBunches;
768 dHist_NumTriggers->SetBinContent(locTriggerBit, 4, locNumHadronicTriggers_CoherentPeak);
772 double locHadronicCoherentPeakRate = dHist_NumTriggers->GetBinContent(33, 4)/dHist_NumTriggers->GetBinContent(33, 1);
774 ostringstream locHistTitle;
775 locHistTitle <<
"Total Hadronic Coherent Peak Rate = " << locHadronicCoherentPeakRate;
776 dHist_NumTriggers->SetTitle(locHistTitle.str().c_str());
781 if(!locL1Trigger || (locL1Trigger && (locL1Trigger->
fp_trig_mask>0))) {
782 japp->RootFillUnLock(
this);
789 dHist_NumHighLevelObjects->Fill(1, (Double_t)locSCHits.size());
790 dHist_NumHighLevelObjects->Fill(2, (Double_t)locTOFPoints.size());
791 dHist_NumHighLevelObjects->Fill(3, (Double_t)locBCALShowers.size());
792 dHist_NumHighLevelObjects->Fill(4, (Double_t)locFCALShowers.size());
793 dHist_NumHighLevelObjects->Fill(5, (Double_t)locTrackTimeBasedVector.size());
798 dHist_NumHighLevelObjects->Fill(10, (Double_t)locBeamPhotons.size());
799 dHist_NumHighLevelObjects->Fill(11, (Double_t)locChargedTracks.size());
800 dHist_NumHighLevelObjects->Fill(12, (Double_t)locNeutralShowers.size());
804 for(
size_t loc_i = 0; loc_i < locBeamPhotons.size(); ++loc_i)
805 dHist_BeamEnergy->Fill(locBeamPhotons[loc_i]->energy());
807 for(
auto E : Eps) dHist_PSPairEnergy->Fill(E);
809 for(
size_t loc_i = 0; loc_i < locChargedTracks.size(); ++loc_i)
811 auto locChargedHypo = locChargedTracks[loc_i]->Get_BestTrackingFOM();
812 if(locChargedHypo->t1_detector() ==
SYS_NULL)
continue;
813 double locP = locChargedHypo->momentum().Mag();
814 double locTheta = locChargedHypo->momentum().Theta()*180.0/TMath::Pi();
815 double locPhi = locChargedHypo->momentum().Phi()*180.0/TMath::Pi();
816 double locBeta = locChargedHypo->measuredBeta();
817 dHist_PVsTheta_Tracks->Fill(locTheta, locP);
818 dHist_PhiVsTheta_Tracks->Fill(locTheta, locPhi);
819 dbeta_vs_p->Fill(locP, locBeta);
824 if(locChargedTracks.size() >= 2)
832 vector<DLorentzVector> pi0s;
833 for(uint32_t i=0; i<locNeutralParticles.size(); i++){
835 auto hypoth1 = locNeutralParticles[i]->Get_Hypothesis(
Gamma);
836 if(!hypoth1)
continue;
839 auto dectector1 = hypoth1->t1_detector();
840 double locDeltaT = hypoth1->time() - hypoth1->t0();
841 if(fabs(locDeltaT) > dTimingCutMap[
Gamma][dectector1])
846 for(uint32_t j=i+1; j<locNeutralParticles.size(); j++){
848 auto hypoth2 = locNeutralParticles[j]->Get_Hypothesis(
Gamma);
849 if(!hypoth2)
continue;
852 auto dectector2 = hypoth2->t1_detector();
853 locDeltaT = hypoth2->time() - hypoth2->t0();
854 if(fabs(locDeltaT) > dTimingCutMap[
Gamma][dectector2])
860 double mass = ptot.M();
862 if(mass>0.1 && mass<0.17) pi0s.push_back(ptot);
868 for(
auto t1 : locChargedTracks){
870 auto hypoth1 =
t1->Get_Hypothesis(
PiPlus);
871 if(!hypoth1)
continue;
874 auto dectector1 = hypoth1->t1_detector();
875 double locDeltaT = hypoth1->time() - hypoth1->t0();
876 if(fabs(locDeltaT) > dTimingCutMap[
PiPlus][dectector1])
881 for(
auto t2 : locChargedTracks){
882 if(t2 ==
t1)
continue;
885 auto hypoth2 = t2->Get_Hypothesis(
PiMinus);
886 if(!hypoth2)
continue;
889 auto dectector2 = hypoth2->t1_detector();
890 locDeltaT = hypoth2->time() - hypoth2->t0();
891 if(fabs(locDeltaT) > dTimingCutMap[
PiMinus][dectector2])
896 for(
auto t3 : locChargedTracks){
897 if(t3 ==
t1)
continue;
898 if(t3 == t2)
continue;
901 auto hypoth3 = t3->Get_Hypothesis(
Proton);
902 if(!hypoth3)
continue;
905 auto dectector3 = hypoth3->t1_detector();
906 locDeltaT = hypoth3->time() - hypoth3->t0();
907 if(fabs(locDeltaT) > dTimingCutMap[
Proton][dectector3])
916 for(
auto locBeamPhoton : locBeamPhotons_InTime)
918 DLorentzVector locMissingP4 = locBeamPhoton->lorentzMomentum() + locTargetP4 - locFinalStateP4;
919 if(fabs(locMissingP4.M2()) > 0.01)
921 dpip_pim->Fill(rhomom.M());
925 for(uint32_t i=0; i<pi0s.size(); i++){
930 locFinalStateP4 = omegamom + protonmom;
931 for(
auto locBeamPhoton : locBeamPhotons_InTime)
933 DLorentzVector locMissingP4 = locBeamPhoton->lorentzMomentum() + locTargetP4 - locFinalStateP4;
934 if(fabs(locMissingP4.M2()) > 0.01)
936 dpip_pim_pi0->Fill(omegamom.M());
940 double ptrans = locFinalStateP4.Perp();
941 dptrans->Fill(ptrans);
942 if(ptrans > 0.1)
continue;
950 for(
auto t1 : locChargedTracks){
952 auto hypoth1 =
t1->Get_Hypothesis(
KPlus);
953 if(!hypoth1)
continue;
956 auto dectector1 = hypoth1->t1_detector();
957 double locDeltaT = hypoth1->time() - hypoth1->t0();
958 if(fabs(locDeltaT) > dTimingCutMap[
PiPlus][dectector1])
963 for(
auto t2 : locChargedTracks){
964 if(t2 ==
t1)
continue;
967 auto hypoth2 = t2->Get_Hypothesis(
KMinus);
968 if(!hypoth2)
continue;
971 auto dectector2 = hypoth2->t1_detector();
972 locDeltaT = hypoth2->time() - hypoth2->t0();
973 if(fabs(locDeltaT) > dTimingCutMap[
PiMinus][dectector2])
978 for(
auto t3 : locChargedTracks){
979 if(t3 ==
t1)
continue;
980 if(t3 == t2)
continue;
983 auto hypoth3 = t3->Get_Hypothesis(
Proton);
984 if(!hypoth3)
continue;
987 auto dectector3 = hypoth3->t1_detector();
988 locDeltaT = hypoth3->time() - hypoth3->t0();
989 if(fabs(locDeltaT) > dTimingCutMap[
Proton][dectector3])
998 for(
auto locBeamPhoton : locBeamPhotons_InTime)
1000 DLorentzVector locMissingP4 = locBeamPhoton->lorentzMomentum() + locTargetP4 - locFinalStateP4;
1001 if(fabs(locMissingP4.M2()) > 0.01)
1003 dKp_Km->Fill(phimom.M());
1011 japp->RootFillUnLock(
this);
double F1tdiff2< DBCALUnifiedHit >(const DBCALUnifiedHit *hit, const DBCALUnifiedHit *hit2)
bool F1CheckTDCOnly< DSCHit >(const DSCHit *hit)
static double F1tdiff(const T *hit)
double F1tdiff2< DSCHit >(const DSCHit *hit, const DSCHit *hit2)
double F1tdiff2< DTAGHHit >(const DTAGHHit *hit, const DTAGHHit *hit2)
sprintf(text,"Post KinFit Cut")
bool F1Check< DFDCHit >(const DFDCHit *hit)
bool F1CheckADCOnly< DTAGHHit >(const DTAGHHit *hit)
double F1tdiff< DBCALUnifiedHit >(const DBCALUnifiedHit *hit)
double F1tdiff2< DFDCHit >(const DFDCHit *hit, const DFDCHit *hit2)
bool F1CheckADCOnly< DRFTime >(const DRFTime *hit)
bool F1CheckSameChannel< DSCHit >(const DSCHit *hit, const DSCHit *hit2)
size_t Get_NumTrackFCALMatches(void) const
size_t Get_NumTrackSCMatches(void) const
TLorentzVector DLorentzVector
double F1tdiff2< DRFTime >(const DRFTime *hit, const DRFTime *hit2)
static bool F1CheckTDCOnly(const T *hit)
bool F1CheckADCOnly< DBCALUnifiedHit >(const DBCALUnifiedHit *hit)
bool F1CheckSameChannel< DFDCHit >(const DFDCHit *hit, const DFDCHit *hit2)
static bool F1CheckSameChannel(const T *hit, const T *hit2)
bool F1CheckTDCOnly< DBCALUnifiedHit >(const DBCALUnifiedHit *hit)
bool F1Check< DTAGHHit >(const DTAGHHit *hit)
bool F1CheckTDCOnly< DFDCHit >(const DFDCHit *hit)
double F1tdiff< DTAGMHit >(const DTAGMHit *hit)
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
double F1tdiff2< DTAGMHit >(const DTAGMHit *hit, const DTAGMHit *hit2)
bool F1Check< DSCHit >(const DSCHit *hit)
double F1tdiff< DFDCHit >(const DFDCHit *hit)
bool F1CheckSameChannel< DBCALUnifiedHit >(const DBCALUnifiedHit *hit, const DBCALUnifiedHit *hit2)
bool F1Check< DRFTime >(const DRFTime *hit)
double F1tdiff< DTAGHHit >(const DTAGHHit *hit)
DLorentzVector dSpacetimeVertex
static double F1tdiff2(const T *hit, const T *hit2)
static bool F1Check(const T *hit)
bool F1CheckSameChannel< DTAGHHit >(const DTAGHHit *hit, const DTAGHHit *hit2)
static double ParticleMass(Particle_t p)
bool F1CheckTDCOnly< DRFTime >(const DRFTime *hit)
bool F1CheckADCOnly< DTAGMHit >(const DTAGMHit *hit)
bool F1CheckTDCOnly< DTAGMHit >(const DTAGMHit *hit)
bool F1CheckADCOnly< DSCHit >(const DSCHit *hit)
size_t Get_NumTrackBCALMatches(void) const
size_t Get_NumTrackTOFMatches(void) const
void FillF1Hist(vector< const T * > hits)
bool F1CheckADCOnly< DFDCHit >(const DFDCHit *hit)
static bool F1CheckADCOnly(const T *hit)
bool F1CheckSameChannel< DRFTime >(const DRFTime *hit, const DRFTime *hit2)
bool F1CheckTDCOnly< DTAGHHit >(const DTAGHHit *hit)
bool F1Check< DTAGMHit >(const DTAGMHit *hit)
double F1tdiff< DRFTime >(const DRFTime *hit)
bool F1Check< DBCALUnifiedHit >(const DBCALUnifiedHit *hit)
bool F1CheckSameChannel< DTAGMHit >(const DTAGMHit *hit, const DTAGMHit *hit2)
int main(int argc, char *argv[])
A DEPICSvalue object holds information for a single EPICS value read from the data stream...
double F1tdiff< DSCHit >(const DSCHit *hit)
jerror_t brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
class DFDCHit: definition for a basic FDC hit data type.