10 #include <ecl/modules/eclBhabhaTCollector/ECLBhabhaTCollectorModule.h>
13 #include <ecl/dataobjects/ECLCalDigit.h>
14 #include <ecl/dataobjects/ECLDigit.h>
15 #include <ecl/dataobjects/ECLElementNumbers.h>
16 #include <ecl/dbobjects/ECLCrystalCalib.h>
17 #include <ecl/dbobjects/ECLReferenceCrystalPerCrateCalib.h>
18 #include <ecl/digitization/EclConfiguration.h>
19 #include <ecl/geometry/ECLGeometryPar.h>
22 #include <analysis/ClusterUtility/ClusterUtils.h>
23 #include <analysis/utility/PCmsLabTransform.h>
24 #include <framework/dataobjects/EventMetaData.h>
25 #include <framework/gearbox/Const.h>
26 #include <mdst/dataobjects/ECLCluster.h>
27 #include <mdst/dataobjects/HitPatternCDC.h>
28 #include <mdst/dataobjects/Track.h>
29 #include <tracking/dataobjects/RecoTrack.h>
50 m_ElectronicsDB(
"ECLCrystalElectronics"),
51 m_ElectronicsTimeDB(
"ECLCrystalElectronicsTime"),
52 m_FlightTimeDB(
"ECLCrystalFlightTime"),
53 m_PreviousCrystalTimeDB(
"ECLCrystalTimeOffset"),
54 m_CrateTimeDB(
"ECLCrateTimeOffset"),
55 m_RefCrystalsCalibDB(
"ECLReferenceCrystalPerCrateCalib"),
56 m_channelMapDB(
"ECLChannelMap")
58 setDescription(
"This module generates sum of all event times per crystal");
61 "Events with fabs(getTimeFit) > m_timeAbsMax "
62 "are excluded", (
short)80);
65 "First CellId to handle.", 1);
70 "If true, TTree 'tree' with more detailed event info is saved in "
71 "the output file specified by HistoManager",
78 addParam(
"skipTrgSel",
skipTrgSel,
"boolean to skip the trigger skim selection",
false);
81 "CDC bhabha t0 bias correction (ns)", 0.);
96 m_dbgTree_electrons =
new TTree(
"tree_electrons",
"Debug data for bhabha time calibration - one entry per electron");
102 &
m_tree_E1Etot)->SetTitle(
"Max Energy Crystal Fraction Energy of Cluster");
104 &
m_tree_E1E2)->SetTitle(
"Max Energy Crystal DIV second max energy crystal in cluster");
121 m_dbgTree_tracks =
new TTree(
"tree_tracks",
"Debug data for bhabha time calibration - one entry per track");
132 "Debug data for bhabha time calibration - one entry per electron - one entry per crystal");
144 m_dbgTree_event =
new TTree(
"tree_event",
"Debug data for bhabha time calibration - one entry per event");
151 "Debug data for bhabha time calibration - one entry per event after all the cuts");
169 "Debug data for bhabha time calibration - one entry per crystal per cluster entry after all cuts");
175 ->SetTitle(
"Time of a crystal within the cluster after application of previous calibrations except t0, ns");
195 "Debug data for bhabha time calibration - one entry per max E crystal entry after cuts");
204 &
m_tree_E1Etot)->SetTitle(
"Max Energy Crystal Fraction Energy of Cluster");
206 &
m_tree_E1E2)->SetTitle(
"Max Energy Crystal DIV second max energy crystal in cluster");
224 B2INFO(
"ECLBhabhaTCollector: Experiment = " <<
m_EventMetaData->getExperiment() <<
234 auto TimevsCrysPrevCrateCalibPrevCrystCalib =
new TH2F(
"TimevsCrysPrevCrateCalibPrevCrystCalib",
235 "Time t psi - ts - tcrate (previous calibs) vs crystal cell ID;crystal cell ID;Time t_psi with previous calib (ns)",
237 registerObject<TH2F>(
"TimevsCrysPrevCrateCalibPrevCrystCalib", TimevsCrysPrevCrateCalibPrevCrystCalib);
239 auto TimevsCratePrevCrateCalibPrevCrystCalib =
new TH2F(
"TimevsCratePrevCrateCalibPrevCrystCalib",
240 "Time t psi - ts - tcrate (previous calibs) vs crate ID;crate ID;Time t_psi previous calib (ns)",
241 52, 1, 52 + 1, nbins, min_t, max_t);
242 registerObject<TH2F>(
"TimevsCratePrevCrateCalibPrevCrystCalib", TimevsCratePrevCrateCalibPrevCrystCalib);
244 auto TimevsCrysNoCalibrations =
new TH2F(
"TimevsCrysNoCalibrations",
247 registerObject<TH2F>(
"TimevsCrysNoCalibrations", TimevsCrysNoCalibrations);
249 auto TimevsCrateNoCalibrations =
new TH2F(
"TimevsCrateNoCalibrations",
250 "Time tpsi vs crate ID;crate ID;Time t_psi (ns)", 52, 1, 52 + 1, nbins, min_t, max_t);
251 registerObject<TH2F>(
"TimevsCrateNoCalibrations", TimevsCrateNoCalibrations);
253 auto TimevsCrysPrevCrateCalibNoCrystCalib =
new TH2F(
"TimevsCrysPrevCrateCalibNoCrystCalib",
254 "Time tpsi - tcrate (previous calib) vs crystal cell ID;crystal cell ID;Time t_psi including previous crate calib (ns)",
256 registerObject<TH2F>(
"TimevsCrysPrevCrateCalibNoCrystCalib", TimevsCrysPrevCrateCalibNoCrystCalib);
258 auto TimevsCrateNoCrateCalibPrevCrystCalib =
new TH2F(
"TimevsCrateNoCrateCalibPrevCrystCalib",
259 "Time tpsi - ts (previous calib) vs crate ID;crate ID;Time t_psi including previous crystal calib (ns)",
260 52, 1, 52 + 1, nbins, min_t, max_t);
261 registerObject<TH2F>(
"TimevsCrateNoCrateCalibPrevCrystCalib", TimevsCrateNoCrateCalibPrevCrystCalib);
266 registerObject<TH1F>(
"TsDatabase", TsDatabase);
270 registerObject<TH1F>(
"TsDatabaseUnc", TsDatabaseUnc);
274 registerObject<TH1F>(
"TcrateDatabase", TcrateDatabase);
278 registerObject<TH1F>(
"TcrateUncDatabase", TcrateUncDatabase);
281 auto tcrateDatabase_ns =
new TH1F(
"tcrateDatabase_ns",
";crate id;tcrate derived from database", 52, 1, 52 + 1);
282 registerObject<TH1F>(
"tcrateDatabase_ns", tcrateDatabase_ns);
285 auto databaseCounter =
new TH1I(
"databaseCounter",
286 ";A database was read in;Number of times database was saved to histogram", 1, 1, 2);
287 registerObject<TH1I>(
"databaseCounter", databaseCounter);
290 auto numCrystalEntriesPerEvent =
new TH1F(
"numCrystalEntriesPerEvent",
291 ";Number crystal entries;Number of events", 15, 0, 15);
292 registerObject<TH1F>(
"numCrystalEntriesPerEvent", numCrystalEntriesPerEvent);
294 auto cutflow =
new TH1F(
"cutflow",
";Cut label number;Number of events passing cut", 20, 0, 20);
295 registerObject<TH1F>(
"cutflow", cutflow);
297 auto maxEcrsytalEnergyFraction =
new TH1F(
"maxEcrsytalEnergyFraction",
298 ";Maximum energy crystal energy / (sum) cluster energy;Number", 22, 0, 1.1);
299 registerObject<TH1F>(
"maxEcrsytalEnergyFraction", maxEcrsytalEnergyFraction);
301 auto refCrysIDzeroingCrate =
new TH1F(
"refCrysIDzeroingCrate",
";cell id;Boolean - is reference crystal",
303 registerObject<TH1F>(
"refCrysIDzeroingCrate", refCrysIDzeroingCrate);
305 auto CDCEventT0Correction =
new TH1F(
"CDCEventT0Correction",
";;CDC event t0 offset correction [ns]", 1, 1, 2);
306 registerObject<TH1F>(
"CDCEventT0Correction", CDCEventT0Correction);
317 " ns correction to CDC event t0 will be applied");
325 int cutIndexPassed = 0;
326 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
327 B2DEBUG(22,
"Cutflow: no cuts: index = " << cutIndexPassed);
337 B2WARNING(
"SoftwareTriggerResult required to select bhabha event is not found");
343 const std::map<std::string, int>& fresults =
m_TrgResult->getResults();
344 if (fresults.find(
"software_trigger_cut&skim&accept_bhabha") == fresults.end()) {
345 B2WARNING(
"Can't find required bhabha trigger identifier");
349 const bool eBhabha = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_bhabha") ==
351 B2DEBUG(22,
"eBhabha (trigger passed) = " << eBhabha);
361 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
362 B2DEBUG(22,
"Cutflow: Trigger cut passed: index = " << cutIndexPassed);
372 if (ECLchannelMapHasChanged) {
373 B2INFO(
"ECLBhabhaTCollectorModule::collect() " <<
LogVar(
"ECLchannelMapHasChanged", ECLchannelMapHasChanged));
375 B2FATAL(
"ECLBhabhaTCollectorModule::collect() : Can't initialize eclChannelMapper!");
399 B2DEBUG(29,
"Finished checking if previous crystal time payload has changed");
404 B2DEBUG(29,
"Finished checking if previous crate time payload has changed");
405 B2DEBUG(29,
"m_CrateTime size = " <<
m_CrateTime.size());
409 B2DEBUG(29,
"Finished checking if previous crate time payload has changed");
413 B2DEBUG(29,
"Finished checking if reference crystal cell ids payload has changed");
416 B2DEBUG(25,
"ECLBhabhaTCollector:: loaded ECLCrystalTimeOffset from the database"
419 B2DEBUG(25,
"ECLBhabhaTCollector:: loaded ECLCrateTimeOffset from the database"
422 B2DEBUG(25,
"ECLBhabhaTCollector:: loaded ECLCrystalElectronics from the database"
425 B2DEBUG(25,
"ECLBhabhaTCollector:: loaded ECLCrystalElectronicsTime from the database"
428 B2DEBUG(25,
"ECLBhabhaTCollector:: loaded ECLCrystalFlightTime from the database"
431 B2DEBUG(25,
"ECLBhabhaTCollector:: loaded ECLReferenceCrystalPerCrateCalib from the database"
443 vector<float> Crate_time_ns(52, 0.0);
448 Crate_time_ns[crateID_temp - 1] =
m_CrateTime[crysID] * TICKS_TO_NS;
458 for (
int crateID_temp = 1; crateID_temp <= 52; crateID_temp++) {
459 getObjectPtr<TH1F>(
"refCrysIDzeroingCrate")->Fill(
m_RefCrystalsCalib[crateID_temp - 1] + 0.001);
467 getObjectPtr<TH1F>(
"TcrateDatabase")->SetBinContent(crysID + 0.001,
m_CrateTime[crysID - 1]);
468 getObjectPtr<TH1F>(
"TcrateUncDatabase")->SetBinContent(crysID + 0.001,
m_CrateTimeUnc[crysID - 1]);
471 B2INFO(
"ECLBhabhaTCollector:: ECLCrystalTimeOffset from the database information:"
474 B2INFO(
"First event so print out previous ts values");
484 for (
int crateID_temp = 1; crateID_temp <= 52; crateID_temp++) {
485 getObjectPtr<TH1F>(
"tcrateDatabase_ns")->SetBinContent(crateID_temp + 0.001, Crate_time_ns[crateID_temp - 1]);
490 getObjectPtr<TH1I>(
"databaseCounter")->SetBinContent(1, 1);
502 double evt_t0_unc = -1;
503 double evt_t0_ECL_closestCDC = -1;
504 double evt_t0_ECL_minChi2 = -1;
510 }
else if (!
m_eventT0->hasTemporaryEventT0(Const::EDetector::CDC)) {
516 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
517 B2DEBUG(22,
"Cutflow: Event t0 exists: index = " << cutIndexPassed);
522 vector<EventT0::EventT0Component> evt_t0_list =
m_eventT0->getTemporaryEventT0s(Const::EDetector::CDC);
523 evt_t0 = evt_t0_list.back().eventT0;
524 evt_t0_unc = evt_t0_list.back().eventT0Uncertainty;
532 if (
m_eventT0->hasTemporaryEventT0(Const::EDetector::ECL)) {
533 vector<EventT0::EventT0Component> evt_t0_list_ECL =
m_eventT0->getTemporaryEventT0s(Const::EDetector::ECL);
536 double smallest_CDC_ECL_t0_diff = fabs(evt_t0_list_ECL[0].eventT0 - evt_t0);
537 int smallest_CDC_ECL_t0_diff_idx = 0;
538 for (
long unsigned int ECLi = 0; ECLi < evt_t0_list_ECL.size(); ECLi++) {
539 double tempt_ECL_t0 = evt_t0_list_ECL[ECLi].eventT0;
540 if (fabs(tempt_ECL_t0 - evt_t0) < smallest_CDC_ECL_t0_diff) {
541 smallest_CDC_ECL_t0_diff = fabs(tempt_ECL_t0 - evt_t0);
542 smallest_CDC_ECL_t0_diff_idx = ECLi;
546 evt_t0_ECL_closestCDC = evt_t0_list_ECL[smallest_CDC_ECL_t0_diff_idx].eventT0;
547 B2DEBUG(26,
"evt_t0_ECL_closestCDC = " << evt_t0_ECL_closestCDC);
551 double smallest_ECL_t0_minChi2 = evt_t0_list_ECL[0].quality;
552 int smallest_ECL_t0_minChi2_idx = 0;
554 B2DEBUG(26,
"evt_t0_list_ECL[0].quality = " << evt_t0_list_ECL[0].quality
555 <<
", with ECL event t0 = " << evt_t0_list_ECL[0].eventT0);
557 for (
long unsigned int ECLi = 0; ECLi < evt_t0_list_ECL.size(); ECLi++) {
558 B2DEBUG(26,
"evt_t0_list_ECL[" << ECLi <<
"].quality = " << evt_t0_list_ECL[ECLi].quality
559 <<
", with ECL event t0 = " <<
560 evt_t0_list_ECL[ECLi].eventT0);
561 if (evt_t0_list_ECL[ECLi].quality < smallest_ECL_t0_minChi2) {
562 smallest_ECL_t0_minChi2 = evt_t0_list_ECL[ECLi].quality;
563 smallest_ECL_t0_minChi2_idx = ECLi;
567 evt_t0_ECL_minChi2 = evt_t0_list_ECL[smallest_ECL_t0_minChi2_idx].eventT0;
569 B2DEBUG(26,
"evt_t0_ECL_minChi2 = " << evt_t0_ECL_minChi2);
570 B2DEBUG(26,
"smallest_ECL_t0_minChi2_idx = " << smallest_ECL_t0_minChi2_idx);
588 int tempCrysID = eclCalDigit.getCellId() - 1;
589 m_EperCrys[tempCrysID] = eclCalDigit.getEnergy();
596 int tempCrysID = eclDigit.getCellId() - 1;
611 double maxp[2] = {0., 0.};
612 int maxiTrk[2] = { -1, -1};
613 int nTrkAll =
tracks.getEntries();
621 for (
int iTrk = 0; iTrk < nTrkAll; iTrk++) {
625 if (not tempTrackFit) {
continue;}
629 double z0 = tempTrackFit->
getZ0();
630 double d0 = tempTrackFit->
getD0();
685 if (charge > 0) {icharge = 1;}
686 if (p > maxp[icharge]) {
688 maxiTrk[icharge] = iTrk;
697 if (nTrkTight != 2) {
702 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
703 B2DEBUG(22,
"Cutflow: Two tight tracks: index = " << cutIndexPassed);
706 if (nTrkLoose != 2) {
711 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
712 B2DEBUG(22,
"Cutflow: No additional loose tracks: index = " << cutIndexPassed);
718 bool oppositelyChargedTracksPassed = maxiTrk[0] != -1 && maxiTrk[1] != -1;
719 if (!oppositelyChargedTracksPassed) {
724 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
725 B2DEBUG(22,
"Cutflow: Oppositely charged tracks: index = " << cutIndexPassed);
734 double trkEClustLab[2] = {0., 0.};
735 double trkEClustCOM[2] = {0., 0.};
738 ROOT::Math::PxPyPzEVector trkp4Lab[2];
739 ROOT::Math::PxPyPzEVector trkp4COM[2];
742 int crysIDMax[2] = { -1, -1 };
743 double crysEMax[2] = { -1, -1 };
744 double crysE2Max[2] = { -1, -1 };
745 int numClustersPerTrack[2] = { 0, 0 };
747 double clusterTime[2] = {0, 0};
751 vector<double> time_ECLCaldigits_bothClusters;
752 vector<int> cid_ECLCaldigits_bothClusters;
753 vector<double> E_ECLCaldigits_bothClusters;
754 vector<double> amp_ECLDigits_bothClusters;
755 vector<int> chargeID_ECLCaldigits_bothClusters;
757 for (
int icharge = 0; icharge < 2; icharge++) {
758 if (maxiTrk[icharge] > -1) {
759 B2DEBUG(22,
"looping over the 2 max pt tracks");
762 if (not tempTrackFit) {
continue;}
764 trkp4COM[icharge] = boostrotate.
rotateLabToCms() * trkp4Lab[icharge];
765 trkpLab[icharge] = trkp4Lab[icharge].P();
766 trkpCOM[icharge] = trkp4COM[icharge].P();
772 auto eclClusterRelationsFromTracks =
tracks[maxiTrk[icharge]]->getRelationsTo<
ECLCluster>();
773 for (
unsigned int clusterIdx = 0; clusterIdx < eclClusterRelationsFromTracks.size(); clusterIdx++) {
775 B2DEBUG(22,
"Looking at clusters. index = " << clusterIdx);
776 auto cluster = eclClusterRelationsFromTracks[clusterIdx];
777 bool goodClusterType =
false;
781 goodClusterType =
true;
782 numClustersPerTrack[icharge]++;
785 if (goodClusterType) {
787 clusterTime[icharge] = cluster->getTime();
789 auto eclClusterRelations = cluster->getRelationsTo<
ECLCalDigit>(
"ECLCalDigits");
792 for (
unsigned int ir = 0; ir < eclClusterRelations.size(); ir++) {
793 const auto calDigit = eclClusterRelations.object(ir);
794 int tempCrysID = calDigit->
getCellId() - 1;
801 if (tempE > crysEMax[icharge]) {
803 crysE2Max[icharge] = crysEMax[icharge];
805 crysEMax[icharge] = tempE;
806 crysIDMax[icharge] = tempCrysID;
809 if (tempE > crysE2Max[icharge] && tempCrysID != crysIDMax[icharge]) {
810 crysE2Max[icharge] = tempE;
817 B2DEBUG(26,
"calDigit(ir" << ir <<
") time = " << calDigit->getTime() <<
"ns , with E = " << tempE <<
" GeV");
818 time_ECLCaldigits_bothClusters.push_back(calDigit->getTime());
819 cid_ECLCaldigits_bothClusters.push_back(tempCrysID);
820 E_ECLCaldigits_bothClusters.push_back(tempE);
821 amp_ECLDigits_bothClusters.push_back(ecl_dig->
getAmp());
822 chargeID_ECLCaldigits_bothClusters.push_back(icharge);
827 trkEClustCOM[icharge] = trkEClustLab[icharge] * trkpCOM[icharge] / trkpLab[icharge];
832 E_DIV_p[icharge] = trkEClustCOM[icharge] / trkpCOM[icharge];
844 int numCrystalsPassingCuts = 0;
846 int crystalIDs[2] = { -1, -1};
847 int crateIDs[2] = { -1, -1};
848 double ts_prevCalib[2] = { -1, -1};
849 double tcrate_prevCalib[2] = { -1, -1};
850 double times_noPreviousCalibrations[2] = { -1, -1};
851 bool crystalCutsPassed[2] = {
false,
false};
852 double crystalEnergies[2] = { -1, -1};
853 double crystalEnergies2[2] = { -1, -1};
855 for (
int iCharge = 0; iCharge < 2; iCharge++) {
856 int crystal_idx = crysIDMax[iCharge];
866 auto amplitude = ecl_dig->
getAmp();
867 crystalEnergies[iCharge] = en;
870 double time = ecl_dig->
getTimeFit() * TICKS_TO_NS - evt_t0;
879 double energyTimeShift =
m_ECLTimeUtil->energyDependentTimeOffsetElectronic(amplitude *
m_Electronics[cid - 1]) * TICKS_TO_NS;
881 B2DEBUG(29,
"cellid = " << cid <<
", amplitude = " << amplitude <<
", time before t(E) shift = " << time <<
882 ", t(E) shift = " << energyTimeShift <<
" ns");
883 time -= energyTimeShift;
896 crystalIDs[iCharge] = cid;
901 tcrate_prevCalib[iCharge] =
m_CrateTime[cid - 1] * TICKS_TO_NS;
902 times_noPreviousCalibrations[iCharge] = time;
905 B2DEBUG(26,
"iCharge = " << iCharge);
906 B2DEBUG(26,
"crateIDs[iCharge] = " << crateIDs[iCharge]);
907 B2DEBUG(26,
"times_noPreviousCalibrations[iCharge] = " << times_noPreviousCalibrations[iCharge]);
908 B2DEBUG(26,
"tcrate_prevCalib[iCharge] = " << tcrate_prevCalib[iCharge]);
909 B2DEBUG(26,
"ts_prevCalib[iCharge] = " << ts_prevCalib[iCharge]);
912 crystalCutsPassed[iCharge] =
true;
916 crystalEnergies2[iCharge] = crysE2Max[iCharge];
944 getObjectPtr<TH1F>(
"maxEcrsytalEnergyFraction")->Fill(en / trkEClustLab[iCharge]);
954 bool E_DIV_p_instance_passed[2] = {
false,
false};
955 double E_DIV_p_CUT = 0.7;
956 for (
int icharge = 0; icharge < 2; icharge++) {
957 E_DIV_p_instance_passed[icharge] = E_DIV_p[icharge] > E_DIV_p_CUT;
959 if (!E_DIV_p_instance_passed[0] || !E_DIV_p_instance_passed[1]) {
964 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
965 B2DEBUG(22,
"Cutflow: E_i/p_i > " << E_DIV_p_CUT <<
": index = " << cutIndexPassed);
971 double invMassTrk = (trkp4Lab[0] + trkp4Lab[1]).M();
972 double invMass_CUT = 0.9;
981 bool invMassCutsPassed = invMassTrk > (invMass_CUT * boostrotate.
getCMSEnergy());
982 if (!invMassCutsPassed) {
987 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
988 B2DEBUG(22,
"Cutflow: m(track 1+2) > " << invMass_CUT <<
"*E_COM = " << invMass_CUT <<
" * " << boostrotate.
getCMSEnergy() <<
989 " : index = " << cutIndexPassed);
994 for (
int iCharge = 0; iCharge < 2; iCharge++) {
995 if (crystalCutsPassed[iCharge]) {
996 getObjectPtr<TH2F>(
"TimevsCrysPrevCrateCalibPrevCrystCalib")->Fill((crystalIDs[iCharge]) + 0.001,
997 times_noPreviousCalibrations[iCharge] - ts_prevCalib[iCharge] - tcrate_prevCalib[iCharge], 1);
998 getObjectPtr<TH2F>(
"TimevsCratePrevCrateCalibPrevCrystCalib")->Fill((crateIDs[iCharge]) + 0.001,
999 times_noPreviousCalibrations[iCharge] - ts_prevCalib[iCharge] - tcrate_prevCalib[iCharge], 1);
1000 getObjectPtr<TH2F>(
"TimevsCrysNoCalibrations")->Fill((crystalIDs[iCharge]) + 0.001, times_noPreviousCalibrations[iCharge], 1);
1001 getObjectPtr<TH2F>(
"TimevsCrateNoCalibrations")->Fill((crateIDs[iCharge]) + 0.001, times_noPreviousCalibrations[iCharge], 1);
1002 getObjectPtr<TH2F>(
"TimevsCrysPrevCrateCalibNoCrystCalib")->Fill((crystalIDs[iCharge]) + 0.001,
1003 times_noPreviousCalibrations[iCharge] - tcrate_prevCalib[iCharge], 1);
1004 getObjectPtr<TH2F>(
"TimevsCrateNoCrateCalibPrevCrystCalib")->Fill((crateIDs[iCharge]) + 0.001,
1005 times_noPreviousCalibrations[iCharge] - ts_prevCalib[iCharge], 1);
1008 numCrystalsPassingCuts++;
1016 if (crystalCutsPassed[0] || crystalCutsPassed[1]) {
1019 getObjectPtr<TH1F>(
"cutflow")->Fill(cutIndexPassed);
1020 B2DEBUG(22,
"Cutflow: At least one crystal time and quality cuts passed: index = " << cutIndexPassed);
1022 getObjectPtr<TH1F>(
"numCrystalEntriesPerEvent")->Fill(numCrystalsPassingCuts);
1027 for (
int iCharge = 0; iCharge < 2; iCharge++) {
1028 if (crystalCutsPassed[iCharge]) {
1033 m_tree_time = times_noPreviousCalibrations[iCharge];
1037 m_tree_E1Etot = crystalEnergies[iCharge] / trkEClustLab[iCharge];
1038 m_tree_E1E2 = crystalEnergies[iCharge] / crystalEnergies2[iCharge];
1039 m_tree_E1p = crystalEnergies[iCharge] / trkpLab[iCharge];
1058 if (crystalCutsPassed[0] && crystalCutsPassed[1] &&
1059 numClustersPerTrack[0] == 1 && numClustersPerTrack[1] == 1) {
1080 B2DEBUG(26,
"CDC evt_t0 = " << evt_t0);
1085 for (
long unsigned int digit_i = 0; digit_i < time_ECLCaldigits_bothClusters.size(); digit_i++) {
1095 ts_prevCalib[chargeID_ECLCaldigits_bothClusters[digit_i]] -
1096 tcrate_prevCalib[chargeID_ECLCaldigits_bothClusters[digit_i]];
1097 m_tree_cid = cid_ECLCaldigits_bothClusters[digit_i];
1108 B2DEBUG(26,
"This was for event number = " <<
m_tree_evtNum);
Calibration collector module base class.
static const ChargedStable pion
charged pion particle
bool hasChanged()
Check whether the object has changed since the last call to hasChanged of the accessor).
double m_tree_d0
Track d0 for debug TTree output.
double m_tree_maxEcrystNegClust
Time of the highest energy crystal in the cluster associated to negatively charged track,...
std::vector< float > m_CrateTime
vector obtained from DB object
std::vector< int > m_eclDigitID
ECL digit id sorter.
double m_tree_timeF
ECL fitting time for debug TTree output.
double m_tree_E1Etot
Energy of crystal with maximum energy within ECL cluster divided by total cluster energy,...
double m_tree_tClustNeg
Cluster time of cluster associated to negatively charged track, ns for debug TTree output.
DBObjPtr< ECLCrystalCalib > m_CrateTimeDB
Time offset from crate time calibration (also this calibration) from database.
TTree * m_dbgTree_crystals
Debug TTree output per crystal.
StoreObjPtr< EventT0 > m_eventT0
StoreObjPtr for T0.
StoreArray< ECLDigit > m_eclDigitArray
Required input array of ECLDigits.
double m_tree_clustCrysE
crystal energy, only for the crystals that meet all the selection criteria for debug TTree output
std::vector< float > m_FlightTime
vector obtained from DB object
double m_tree_timetsPreviousTimeCalibs
Time for Ts distribution after application of previous time calibrations for debug TTree output.
double m_looseTrkD0
Loose track d0 minimum cut.
double m_tree_E1E2
Energy of crystal with maximum energy within ECL cluster divided by second most energetic crystal in ...
double m_tree_ECLDigitAmplitude
Amplitude (used to calculate energy) of an ECLDigit within a cluster, for debug TTree output.
double m_tree_tClustPos
Cluster time of cluster associated to positively charged track, ns for debug TTree output.
int m_tree_quality
ECL fit quality for debug TTree output.
bool m_saveTree
If true, save TTree with more detailed event info.
double m_tree_enNeg
Energy of cluster associated to negatively charged track, GeV for debug TTree output.
DBObjPtr< ECLCrystalCalib > m_ElectronicsTimeDB
Time offset from electronics calibration from database.
double m_tree_tClust
Cluster time of a cluster, ns for debug TTree output.
double m_E_DIV_p
Energy divided by momentum, for debug TTree output.
double m_tree_en
Energy of crystal with maximum energy within ECL cluster, GeV for debug TTree output.
int m_minCrystal
First CellId to handle.
std::vector< int > m_eclCalDigitID
ECL cal digit id sorter.
bool m_storeCalib
Boolean for whether or not to store the previous calibration calibration constants.
StoreArray< ECLCluster > m_eclClusterArray
Required input array of ECLClusters.
short m_timeAbsMax
Events with abs(time) > m_timeAbsMax are excluded, mostly for histogram x-range purposes.
DBObjPtr< ECLReferenceCrystalPerCrateCalib > m_RefCrystalsCalibDB
Crystal IDs of the one reference crystal per crate from database.
int m_crystalCrate
Crate id for the crystal.
int m_tree_cid
ECL Cell ID (1..ECLElementNumbers::c_NCrystals) for debug TTree output.
double m_tree_time
Time for Ts distribution for debug TTree output.
double m_massInvTracks
invariant mass of the two tracks, for debug TTree output
double m_tree_nCDChits
Number of CDC hits along the track for debug TTree output.
double m_tree_enPlus
Energy of cluster associated to positively charged track, GeV for debug TTree output.
int m_tree_evtNum
Event number for debug TTree output.
double m_tightTrkZ0
Tight track z0 minimum cut.
DBObjPtr< Belle2::ECLChannelMap > m_channelMapDB
Mapper of ecl channels to various other objects, like crates.
std::vector< short > m_RefCrystalsCalib
vector obtained from DB object
double m_tree_t0_ECL_minChi2
EventT0 (from ECL) min chi2 for debug TTree output.
double m_tree_maxEcrystPosClust
Time of the highest energy crystal in the cluster associated to positively charged track,...
void collect() override
Select events and crystals and accumulate histograms.
std::vector< float > m_CrateTimeUnc
uncertainty vector obtained from DB object
TTree * m_dbgTree_allCuts
Debug TTree output after all cuts.
double m_tree_ECLCalDigitTime
Time of an ECLCalDigit within a cluster, ns for debug TTree output.
StoreArray< ECLCalDigit > m_eclCalDigitArray
Required input array of ECLCalDigits.
TTree * m_dbgTree_event
Debug TTree output per event.
double m_tree_z0
Track z0 for debug TTree output.
std::vector< float > m_EperCrys
ECL cal digit energy for each crystal.
bool skipTrgSel
flag to skip the trigger skim selection in the module
double m_tree_p
Track momentum for debug TTree output.
void prepare() override
Define histograms and read payloads from DB.
std::vector< float > m_PreviousCrystalTime
vector obtained from DB object
int m_maxCrystal
Last CellId to handle.
DBObjPtr< ECLCrystalCalib > m_PreviousCrystalTimeDB
Time offset from previous crystal time calibration (this calibration) from database.
double m_tightTrkD0
Tight track d0 minimum cut.
double m_tree_t0
EventT0 (not from ECL) for debug TTree output.
int m_tree_amp
Fitting amplitude from ECL for debug TTree output.
double m_tree_E1p
Energy of crystal with maximum energy within ECL cluster divided by total cluster energy divided by t...
TTree * m_dbgTree_evt_allCuts
Debug TTree output per event after all cuts.
std::vector< float > m_Electronics
vector obtained from DB object
void inDefineHisto() override
Replacement for defineHisto() in CalibrationCollector modules.
int m_charge
particle charge, for debug TTree output
TTree * m_dbgTree_electrons
Output tree with detailed event data.
std::vector< float > m_PreviousCrystalTimeUnc
vector obtained from DB object
std::unique_ptr< Belle2::ECL::ECLTimingUtilities > m_ECLTimeUtil
ECL timing tools.
StoreArray< Track > tracks
StoreArray for tracks.
double m_tree_t0_ECLclosestCDC
EventT0 (from ECL) closest to CDC for debug TTree output.
TTree * m_dbgTree_crys_allCuts
Debug TTree output per crystal after all cuts.
double m_tree_clustCrysE_DIV_maxEcrys
ratio of crystal energy to energy of the crystal that has the maximum energy, only for the crystals t...
DBObjPtr< ECLCrystalCalib > m_FlightTimeDB
Time offset from flight time b/w IP and crystal from database.
DBObjPtr< ECLCrystalCalib > m_ElectronicsDB
electronics amplitude calibration from database Scale amplitudefor each crystal and for dead pre-amps
double m_tree_ECLCalDigitE
Energy of an ECLCalDigit within a cluster, GeV for debug TTree output.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
double m_tree_t0_unc
EventT0 uncertainty for debug TTree output.
std::unique_ptr< Belle2::ECL::ECLChannelMapper > m_crystalMapper
ECL object for keeping track of mapping between crystals and crates etc.
virtual ~ECLBhabhaTCollectorModule()
Module destructor.
double m_hadronEventT0_TO_bhabhaEventT0_correction
correction to apply to CDC event t0 values in bhabha events to correct for CDC event t0 bias compared...
std::vector< float > m_ElectronicsTime
vector obtained from DB object
ECLBhabhaTCollectorModule()
Module constructor.
StoreObjPtr< SoftwareTriggerResult > m_TrgResult
Store array for Trigger selection.
TTree * m_dbgTree_tracks
Debug TTree output per track.
double m_looseTrkZ0
Loose track z0 minimum cut.
Class to store calibrated ECLDigits: ECLCalDigits.
int getCellId() const
Get Cell ID.
double getEnergy() const
Get Calibrated Energy.
@ c_nPhotons
CR is split into n photons (N1)
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
int getAmp() const
Get Fitting Amplitude.
int getQuality() const
Get Fitting Quality.
int getCellId() const
Get Cell ID.
int getTimeFit() const
Get Fitting Time.
static double getRF()
See m_rf.
unsigned short getNHits() const
Get the total Number of CDC hits in the fit.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Values of the result of a track fit with a given particle hypothesis.
short getChargeSign() const
Return track charge (1 or -1).
ROOT::Math::PxPyPzEVector get4Momentum() const
Getter for the 4Momentum at the closest approach of the track in the r/phi projection.
double getD0() const
Getter for d0.
double getZ0() const
Getter for z0.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
Class to store variables with their name which were sent to the logging service.
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
@ c_accept
Accept this event.
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.