110 B2INFO(
"eclHadronTimeCalibrationValidationCollector: Experiment = " <<
m_EventMetaData->getExperiment() <<
116 double binSize = 2000.0 / pow(2, 12);
117 double halfBinSize = binSize / 2.0;
121 double nBinsNeg = floor((
m_timeAbsMax - halfBinSize) / binSize);
122 double min_t = -nBinsNeg * binSize - halfBinSize;
123 int nbins = nBinsNeg * 2 + 1;
124 double max_t = min_t + nbins * binSize;
128 const Int_t N_E_BIN_EDGES = 64;
129 const Int_t N_E_BINS = N_E_BIN_EDGES - 1;
130 Double_t energyBinEdges[N_E_BIN_EDGES] = {0, 0.05, 0.051, 0.052, 0.053, 0.054, 0.055, 0.056, 0.057, 0.058, 0.059, 0.06, 0.062, 0.064, 0.066, 0.068, 0.07, 0.075, 0.08, 0.085, 0.09, 0.095, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.25, 0.3, 0.35, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.25, 2.5, 2.8, 3.2, 3.6, 4, 4.4, 4.8, 5.2, 5.6, 6, 6.4, 6.8, 7.2, 7.6, 8};
133 auto cutflow =
new TH1F(
"cutflow",
" ;Cut label number ;Number of events passing cut", 10, 0, 10) ;
136 auto clusterTime =
new TH1F(
"clusterTime",
";Photon ECL cluster time [ns]; number of photon ECL clusters", nbins, min_t, max_t) ;
139 auto clusterTime_cid =
new TH2F(
"clusterTime_cid",
144 auto clusterTime_run =
new TH2F(
"clusterTime_run",
145 ";Run number ;Photon ECL cluster time [ns]", 7000, 0, 7000, nbins, min_t, max_t) ;
149 auto clusterTimeClusterE =
new TH2F(
"clusterTimeClusterE",
150 ";Photon cluster energy [GeV];Photon cluster time [ns]", N_E_BINS, energyBinEdges, nbins, min_t, max_t) ;
154 auto dt99_clusterE =
new TH2F(
"dt99_clusterE",
155 ";Photon cluster energy [GeV];dt99 [ns]", N_E_BINS, energyBinEdges, nbins, 0, max_t) ;
159 auto eventT0 =
new TH1F(
"eventT0",
";event t0 [ns]; number of events", nbins, min_t, max_t) ;
162 auto eventT0Detector =
new TH1F(
"eventT0Detector",
163 "detector used for eventT0 (SVD=2, CDC=4, TOP=8, ECL=32);detector number; number of events", 48, 0, 48) ;
166 auto clusterTimeE0E1diff =
new TH1F(
"clusterTimeE0E1diff",
167 ";ECL cluster time of max E photon - ECL cluster time of 2nd max E photon [ns]; number of photon ECL cluster time differences",
168 nbins, min_t, max_t) ;
181 int cutIndexPassed = 0;
183 B2DEBUG(22,
"Cutflow: no cuts: index = " << cutIndexPassed);
190 int tempCrysID = eclCalDigit.getCellId() - 1;
191 m_EperCrys[tempCrysID] = eclCalDigit.getEnergy();
196 double evt_t0 = -1000 ;
197 double evt_t0_unc = -1000 ;
198 int evt_t0_detector = 0;
210 evt_t0_unc =
m_eventT0->getEventT0Uncertainty() ;
211 if (
m_eventT0->isSVDEventT0()) {evt_t0_detector += 2;}
212 if (
m_eventT0->isCDCEventT0()) {evt_t0_detector += 4;}
213 if (
m_eventT0->isTOPEventT0()) {evt_t0_detector += 8;}
214 if (
m_eventT0->isECLEventT0()) {evt_t0_detector += 32;}
216 B2DEBUG(26,
"Found event t0") ;
222 int nTrkAll =
tracks.getEntries() ;
231 for (
int iTrk = 0 ; iTrk < nTrkAll ; iTrk++) {
235 if (not tempTrackFit) {continue ;}
239 double z0 = tempTrackFit->
getZ0() ;
240 double d0 = tempTrackFit->
getD0() ;
279 B2DEBUG(26,
"Found loose and tight tracks") ;
282 int numGoodTightTracks_minCut = 4 ;
283 if (nTrkTight < numGoodTightTracks_minCut) {
289 B2DEBUG(22,
"Cutflow: At least " << numGoodTightTracks_minCut <<
" tight tracks: index = " << cutIndexPassed) ;
292 int numGoodLooseTracks_minCut = numGoodTightTracks_minCut ;
293 if (nTrkLoose < numGoodLooseTracks_minCut) {
299 B2DEBUG(22,
"Cutflow: No additional loose tracks: index = " << cutIndexPassed) ;
304 double clusterE_minCut = 0.1 ;
306 int nGoodClusts = 0 ;
307 vector<int> goodClusterIdxs ;
308 for (
int ic = 0; ic < nclust; ic++) {
310 if (eClust > clusterE_minCut) {
311 goodClusterIdxs.push_back(ic) ;
318 int numGoodEMclusters_minCut = 5 ;
319 if (nGoodClusts < numGoodEMclusters_minCut) {
325 B2DEBUG(22,
"Cutflow: At least " << numGoodEMclusters_minCut <<
" ECL clusters: index = " << cutIndexPassed) ;
331 double photonE_minCut = 0.05 ;
332 double zernikeMVA_minCut = 0.2 ;
335 vector<int> goodPhotonClusterIdxs ;
336 for (
int ic = 0; ic < nclust; ic++) {
344 if ((eClust > photonE_minCut) &&
347 (!badPhotonTimeResolution) &&
348 (zernikeMVA > zernikeMVA_minCut) &&
350 goodPhotonClusterIdxs.push_back(ic) ;
358 int numGoodPhotonclusters_minCut = 1 ;
359 if (nPhotons < numGoodPhotonclusters_minCut) {
365 B2DEBUG(22,
"Cutflow: At least " << numGoodPhotonclusters_minCut <<
" good photon: index = " << cutIndexPassed) ;
372 vector<double> goodClustTimes ;
373 vector<double> goodClust_dt99 ;
374 vector<double> goodClusters_crysE ;
375 vector<double> goodClustE ;
376 vector<int> goodClustMaxEcrys_cid ;
377 for (
long unsigned int i = 0; i < goodPhotonClusterIdxs.size(); i++) {
378 int ic = goodPhotonClusterIdxs[i] ;
384 goodClustMaxEcrys_cid.push_back(cid) ;
387 goodClusters_crysE.push_back(
m_EperCrys[cid - 1]) ;
388 goodClustE.push_back(eClust);
395 vector< pair<double, double> > pair_energy_time ;
396 for (
long unsigned int ic = 0; ic < goodClusters_crysE.size(); ic++) {
397 pair_energy_time.push_back(make_pair(goodClusters_crysE[ic], goodClustTimes[ic])) ;
402 sort(pair_energy_time.begin(), pair_energy_time.end(), greater<>()) ;
406 B2DEBUG(22,
"Event passed all cuts");
413 bool isSVDt0 =
m_eventT0->isSVDEventT0();
414 bool isCDCt0 =
m_eventT0->isCDCEventT0();
415 bool isECLt0 =
m_eventT0->isECLEventT0();
416 string t0Detector =
"UNKNOWN... WHY?";
419 }
else if (isCDCt0) {
421 }
else if (isECLt0) {
425 B2DEBUG(26,
"t0 = " << evt_t0 <<
" ns. t0 is from SVD?=" << isSVDt0 <<
", t0 is from CDC?=" << isCDCt0 <<
", t0 is from ECL?=" <<
426 isECLt0 <<
" t0 from " <<
432 for (
long unsigned int i = 0 ; i < goodPhotonClusterIdxs.size() ; i++) {
434 getObjectPtr<TH2F>(
"clusterTime_cid")->Fill(goodClustMaxEcrys_cid[i] + 0.001, goodClustTimes[i], 1) ;
436 getObjectPtr<TH2F>(
"clusterTimeClusterE")->Fill(goodClustE[i], goodClustTimes[i], 1) ;
458 B2DEBUG(26,
"Filled cluster tree") ;
461 if (pair_energy_time.size() >= 2) {
462 getObjectPtr<TH1F>(
"clusterTimeE0E1diff")->Fill(pair_energy_time[0].second - pair_energy_time[1].second) ;
481 B2DEBUG(26,
"Filled event tree") ;