Belle II Software development
KLMTimeAlgorithm.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11/* KLM headers. */
12#include <klm/bklm/geometry/GeometryPar.h>
13#include <klm/dataobjects/KLMChannelIndex.h>
14#include <klm/dataobjects/KLMElementNumbers.h>
15#include <klm/dbobjects/KLMTimeCableDelay.h>
16#include <klm/dbobjects/KLMTimeConstants.h>
17#include <klm/dbobjects/KLMTimeResolution.h>
18#include <klm/dbobjects/KLMEventT0HitResolution.h>
19#include <klm/eklm/geometry/GeometryData.h>
20
21/* Basf2 headers. */
22#include <calibration/CalibrationAlgorithm.h>
23
24/* ROOT headers. */
25#include <Math/MinimizerOptions.h>
26#include <TF1.h>
27#include <TGraphErrors.h>
28#include <TH1F.h>
29#include <TH1I.h>
30#include <TH2F.h>
31#include <TProfile.h>
32
33/* C++ STL headers. */
34#include <functional>
35#include <map>
36#include <utility>
37#include <vector>
38
39class TFile; // forward declaration
40
41namespace Belle2 {
46
51
52 public:
53
57 struct Event {
58
60 double Run = 0;
61
63 double Events = 0;
64
66 double nTrack = 0;
67
69 double Track_Charge = 0;
70
72 double t0 = 0;
73
75 double t0_uc = 0;
76
78 double flyTime = 0;
79
81 double recTime = 0;
82
84 double dist = 0;
85
87 double diffDistX = 0;
88
90 double diffDistY = 0;
91
93 double diffDistZ = 0;
94
96 double eDep = 0;
97
99 double nPE = 0;
100
102 int channelId = 0;
103
105 bool inRPC = 0;
106
108 bool isFlipped = 0;
109
111 bool isGood = 0;
112
114 uint16_t getADCcount = 0;
115
119 double time() const
120 {
121 return recTime - flyTime;
122 }
123
124 };
125
130
131 /* Not enough data. */
132 c_NotEnoughData = 0,
133
134 /* Failed fit. */
135 c_FailedFit = 1,
136
137 /* Successful calibration. */
138 c_SuccessfulCalibration = 2,
139
140 };
141
146
151
155 void setDebug()
156 {
157 m_debug = true;
158 }
159
165 void setMC(bool mc)
166 {
167 m_mc = mc;
168 }
169
173 void useEvtT0()
174 {
175 m_useEventT0 = true;
176 }
177
181 void setMinimalDigitNumber(int minimalDigitNumber)
182 {
183 m_MinimalDigitNumber = minimalDigitNumber;
184 }
185
191 void setLowerLimit(int counts)
192 {
193 m_lower_limit_counts = counts;
194 }
195
203 {
205 }
206
211 void setSaveAllPlots(bool on)
212 {
213 m_saveAllPlots = on;
214 }
215
222 {
224 }
225
229 void saveHist();
230
235 double esti_timeShift(const KLMChannelIndex& klmChannel);
236
241 std::pair<int, double> tS_upperStrip(const KLMChannelIndex& klmChannel);
242
247 std::pair<int, double> tS_lowerStrip(const KLMChannelIndex& klmChannel);
248
253 double esti_timeRes(const KLMChannelIndex& klmChannel);
254
259 std::pair<int, double> tR_upperStrip(const KLMChannelIndex& klmChannel);
260
265 std::pair<int, double> tR_lowerStrip(const KLMChannelIndex& klmChannel);
266
267
268 protected:
269
273 virtual EResult calibrate() override;
274
275 private:
276
280 void setupDatabase();
281
289
294 void readCalibrationDataCounts(std::map<KLMChannelNumber, unsigned int>& eventCounts);
295
302 const std::vector<std::pair<KLMChannelNumber, unsigned int>>& channelsBKLM,
303 const std::vector<std::pair<KLMChannelNumber, unsigned int>>& channelsEKLM);
304
309 void readCalibrationDataBatch(std::function<bool(const KLMChannelIndex&)> channelFilter);
310
314 void createHistograms();
315
323 void writeThenDelete_(TH1* h, bool write, TDirectory* dir = nullptr);
324
326 void writeThenDelete_(TH2* h, bool write, TDirectory* dir = nullptr);
327
335 bool passesADCCut(const Event& event, int subdetector, int layer) const;
336
362 TProfile* profileRpcPhi, TProfile* profileRpcZ,
363 TProfile* profileBKLMScintillatorPhi, TProfile* profileBKLMScintillatorZ,
364 TProfile* profileEKLMScintillatorPlane1,
365 TProfile* profileEKLMScintillatorPlane2, bool fill2dHistograms);
366
374 const std::vector< std::pair<KLMChannelNumber, unsigned int> >& channels,
375 double& delay, double& delayError);
376
381 std::map<KLMChannelNumber, std::vector<struct Event> > m_evts;
382
387 std::map<KLMChannelNumber, int> m_cFlag;
388
390 std::map<KLMChannelNumber, double> m_timeShift;
391
393 std::map<KLMChannelNumber, double> m_timeRes;
394
396 std::map<KLMChannelNumber, double> m_time_channel;
397
399 std::map<KLMChannelNumber, double> m_etime_channel;
400
402 std::map<KLMChannelNumber, double> m_ctime_channel;
403
405 std::map<KLMChannelNumber, double> mc_etime_channel;
406
409
412
415
418
421
424
427
430
438 bool m_useFixedRPCDelay = false;
439
445 double m_fixedRPCDelay = 0.0667;
446
449
452
455
458
461
464
468
472
476
480
483
486
490
494
498
502
504 int m_MinimalDigitNumber = 100000000;
505
508
511
514
517
520
522 ROOT::Math::MinimizerOptions m_minimizerOptions;
523
526
532
535
538
540 bool m_debug = false;
541
543 bool m_mc = false;
544
546 bool m_useEventT0 = true;
547
550
552 TH1I* h_calibrated = nullptr;
553
555 TH1I* hc_calibrated = nullptr;
556
558 TH1F* h_diff = nullptr;
559
560 /* Monitor graphs of peak value of time distribution for each channel. */
561
563 TGraphErrors* gre_time_channel_rpc = nullptr;
564
566 TGraphErrors* gre_time_channel_scint = nullptr;
567
569 TGraphErrors* gre_time_channel_scint_end = nullptr;
570
571 /* Monitor graphs of peak value of calibrated time distribution for each channel. */
572
574 TGraphErrors* gre_ctime_channel_rpc = nullptr;
575
577 TGraphErrors* gre_ctime_channel_scint = nullptr;
578
580 TGraphErrors* gre_ctime_channel_scint_end = nullptr;
581
582 /* Monitor graphs of calibration constant value of each channel. */
583
585 TGraph* gr_timeShift_channel_rpc = nullptr;
586
588 TGraph* gr_timeShift_channel_scint = nullptr;
589
592
593 /* Monitor graphs of calibrated time resolution value of each channel. */
594
596 TGraph* gr_timeRes_channel_rpc = nullptr;
597
599 TGraph* gr_timeRes_channel_scint = nullptr;
600
603
604 /* Profiles used for effective light speed estimation. */
605
607 TProfile* m_ProfileRpcPhi = nullptr;
608
610 TProfile* m_ProfileRpcZ = nullptr;
611
613 TProfile* m_ProfileBKLMScintillatorPhi = nullptr;
614
616 TProfile* m_ProfileBKLMScintillatorZ = nullptr;
617
620
623
624 /* Profiles of time versus distance (after fit). */
625
627 TProfile* m_Profile2RpcPhi = nullptr;
628
630 TProfile* m_Profile2RpcZ = nullptr;
631
633 TProfile* m_Profile2BKLMScintillatorPhi = nullptr;
634
636 TProfile* m_Profile2BKLMScintillatorZ = nullptr;
637
640
643
644 /*
645 * Histograms of global time distribution used for effective light speed
646 * estimation.
647 */
648
650 TH1F* h_time_rpc_tc = nullptr;
651
653 TH1F* h_time_scint_tc = nullptr;
654
656 TH1F* h_time_scint_tc_end = nullptr;
657
658 /* Histograms of global time distribution before calibration. */
659
661 TH1F* h_time_rpc = nullptr;
662
664 TH1F* h_time_scint = nullptr;
665
667 TH1F* h_time_scint_end = nullptr;
668
669 /* Histograms of global time distribution after calibration. */
670
672 TH1F* hc_time_rpc = nullptr;
673
675 TH1F* hc_time_scint = nullptr;
676
678 TH1F* hc_time_scint_end = nullptr;
679
680 /*
681 * Histograms of time distribution for forward (backward)
682 * before calibration.
683 */
684
686 TH1F* h_timeF_rpc[2] = {nullptr};
687
689 TH1F* h_timeF_scint[2] = {nullptr};
690
692 TH1F* h_timeF_scint_end[2] = {nullptr};
693
694 /*
695 * Histograms of time distribution for forward (backward)
696 * after calibration.
697 */
698
700 TH1F* hc_timeF_rpc[2] = {nullptr};
701
703 TH1F* hc_timeF_scint[2] = {nullptr};
704
706 TH1F* hc_timeF_scint_end[2] = {nullptr};
707
708 /*
709 * Histograms of time dependent on sector for forward (backward)
710 * before calibration.
711 */
712
714 TH2F* h2_timeF_rpc[2] = {nullptr};
715
717 TH2F* h2_timeF_scint[2] = {nullptr};
718
720 TH2F* h2_timeF_scint_end[2] = {nullptr};
721
722 /*
723 * Histograms of time dependent on sector for forward (backward)
724 * after calibration.
725 */
726
728 TH2F* h2c_timeF_rpc[2] = {nullptr};
729
731 TH2F* h2c_timeF_scint[2] = {nullptr};
732
734 TH2F* h2c_timeF_scint_end[2] = {nullptr};
735
736 /* Histograms of time distribution for sectors before calibration. */
737
739 TH1F* h_timeFS_rpc[2][8] = {{nullptr}};
740
742 TH1F* h_timeFS_scint[2][8] = {{nullptr}};
743
745 TH1F* h_timeFS_scint_end[2][4] = {{nullptr}};
746
747 /* Histograms of time distribution for sectors after calibration. */
748
750 TH1F* hc_timeFS_rpc[2][8] = {{nullptr}};
751
753 TH1F* hc_timeFS_scint[2][8] = {{nullptr}};
754
756 TH1F* hc_timeFS_scint_end[2][4] = {{nullptr}};
757
758 /*
759 * Histograms of time distribution dependent on layer of sectors
760 * before calibration.
761 */
762
764 TH2F* h2_timeFS[2][8] = {{nullptr}};
765
767 TH2F* h2_timeFS_end[2][4] = {{nullptr}};
768
769 /*
770 * Histograms of time distribution dependent on layer of sectors
771 * after calibration.
772 */
773
775 TH2F* h2c_timeFS[2][8] = {{nullptr}};
776
778 TH2F* h2c_timeFS_end[2][4] = {{nullptr}};
779
780 /* Histograms of time distribution of one layer before calibration. */
781
783 TH1F* h_timeFSL[2][8][15] = {{{nullptr}}};
784
786 TH1F* h_timeFSL_end[2][4][14] = {{{nullptr}}};
787
788 /* Histograms of time distribution of one layer after calibration. */
789
791 TH1F* hc_timeFSL[2][8][15] = {{{nullptr}}};
792
794 TH1F* hc_timeFSL_end[2][4][14] = {{{nullptr}}};
795
796 /* Histograms of time distribution of one plane before calibration. */
797
799 TH1F* h_timeFSLP[2][8][15][2] = {{{{nullptr}}}};
800
802 TH1F* h_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}};
803
804 /* Histograms of time distribution of one plane after calibration. */
805
807 TH1F* hc_timeFSLP[2][8][15][2] = {{{{nullptr}}}};
808
810 TH1F* hc_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}};
811
812 /*
813 * Histograms of time distribution dependent on channels
814 * before calibration.
815 */
816
818 TH2F* h2_timeFSLP[2][8][15][2] = {{{{nullptr}}}};
819
821 TH2F* h2_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}};
822
823 /*
824 * Histograms of time distribution dependent on channels
825 * after calibration.
826 */
827
829 TH2F* h2c_timeFSLP[2][8][15][2] = {{{{nullptr}}}};
830
832 TH2F* h2c_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}};
833
834 /* Histograms of time distribution of each channel before calibration. */
835
837 TH1F* h_timeFSLPC_tc[2][8][15][2][54] = {{{{{nullptr}}}}};
838
840 TH1F* h_timeFSLPC[2][8][15][2][54] = {{{{{nullptr}}}}};
841
843 TH2F* m_HistTimeLengthBKLM[2][8][15][2][54] = {{{{{nullptr}}}}};
844
846 TH1F* h_timeFSLPC_tc_end[2][4][14][2][75] = {{{{{nullptr}}}}};
847
849 TH1F* h_timeFSLPC_end[2][4][14][2][75] = {{{{{nullptr}}}}};
850
852 TH2F* m_HistTimeLengthEKLM[2][4][14][2][75] = {{{{{nullptr}}}}};
853
854 /* Histograms of time distribution of each channel after calibration. */
855
857 TH1F* hc_timeFSLPC[2][8][15][2][54] = {{{{{nullptr}}}}};
858
860 TH1F* hc_timeFSLPC_end[2][4][14][2][75] = {{{{{nullptr}}}}};
861
863 TH1F* h_eventT0_rpc = nullptr;
864
866 TH1F* h_eventT0_scint = nullptr;
867
869 TH1F* h_eventT0_scint_end = nullptr;
870
872 TH1F* hc_eventT0_rpc = nullptr;
873
875 TH1F* hc_eventT0_scint = nullptr;
876
878 TH1F* hc_eventT0_scint_end = nullptr;
879
882
885
888
891
894
897
900
903
906
909
912
915
918
921
924
927
930
933
936
939
942
945
948
951
952 /* Formulas used for fitting. */
953
955 TF1* fcn_pol1 = nullptr;
956
958 TF1* fcn_const = nullptr;
959
961 TF1* fcn_gaus = nullptr;
962
964 TF1* fcn_land = nullptr;
965
967 TFile* m_outFile = nullptr;
968
970 bool m_saveAllPlots = false;
971
973 bool m_saveChannelHists = false;
974
979 TDirectory* m_channelHistDir_BKLM[2][8][15][2] = {};
980
985 TDirectory* m_channelHistDir_EKLM[2][4][14][2] = {};
986
987 };
988
990}
EResult
The result of calibration.
CalibrationAlgorithm(const std::string &collectorModuleName)
Constructor - sets the prefix for collected objects (won't be accesses until execute(....
EKLM geometry data.
KLM channel index.
Class to store per-hit time resolution (sigma) for KLM EventT0, separated by detector type.
TProfile * m_Profile2EKLMScintillatorPlane2
For EKLM scintillator plane2.
TDirectory * m_channelHistDir_BKLM[2][8][15][2]
Directory structure for per-channel histograms (BKLM).
double mc_etime_channelAvg_rpc
Calibrated central value error of the global time distribution (BKLM RPC part).
TH2F * m_HistTimeLengthEKLM[2][4][14][2][75]
Two-dimensional distributions of time versus propagation length.
bool m_applyChargeRestriction
Whether to apply ADC/charge restriction cuts for scintillators.
TH1F * h_timeFSLPC_tc[2][8][15][2][54]
BKLM part, used for effective light speed estimation.
TH2F * h2c_timeF_scint_end[2]
EKLM part.
TH1F * h_timeFSLPC_tc_end[2][4][14][2][75]
EKLM part, used for effective light speed estimation.
KLMTimeResolution * m_timeResolution
DBObject of time resolution.
TH1F * hc_eventT0_scint_end_highN
Corrected EventT0 for EKLM scintillator with high hit count.
TProfile * prof_deltaT0_rms_vs_v_scint_end
DeltaT0 RMS vs inverse hit count profile for EKLM scintillator.
TH1F * h_time_scint_tc_end
EKLM part.
TH1F * hc_eventT0_scint_midN
Corrected EventT0 for BKLM scintillator with medium hit count.
void createHistograms()
Create histograms.
TGraphErrors * gre_time_channel_scint
BKLM Scintillator.
TH1F * h_timeFSL[2][8][15]
BKLM part.
TH1F * hc_timeFSLPC_end[2][4][14][2][75]
EKLM part.
TH1F * hc_timeFSL_end[2][4][14]
EKLM part.
TH1F * h_timeFSLP_end[2][4][14][2]
EKLM part.
TGraph * gr_timeRes_channel_rpc
BKLM RPC.
TH1F * hc_timeFSLP_end[2][4][14][2]
EKLM part.
TH1F * h_timeFSLP[2][8][15][2]
BKLM part.
TH1F * hc_timeF_scint_end[2]
EKLM part.
void setApplyChargeRestriction(bool apply)
Enable or disable ADC/charge restriction cuts for scintillators.
std::map< KLMChannelNumber, double > m_timeShift
Shift values of each channel.
TH1F * h_time_scint
BKLM scintillator part.
double m_time_channelAvg_scint
Central value of the global time distribution (BKLM scintillator part).
TH1F * hc_timeFS_scint_end[2][4]
EKLM part.
double esti_timeRes(const KLMChannelIndex &klmChannel)
Estimate value of calibration constant for calibrated channels.
double m_UpperTimeBoundaryCalibratedRPC
Upper time boundary for RPC (calibrated data).
double m_ctime_channelAvg_rpc
Calibrated central value of the global time distribution (BKLM RPC part).
KLMTimeConstants * m_timeConstants
DBObject of time cost on some parts of the detector.
void setupDatabase()
Setup the database.
void setMinimalDigitNumber(int minimalDigitNumber)
Set minimal digit number (total).
TProfile * prof_deltaT0_rms_vs_v_rpc
DeltaT0 RMS vs inverse hit count profile for RPC.
TH1F * h_eventT0_scint
EventT0 seen by BKLM scintillator hits.
TH1F * hc_timeFS_scint[2][8]
BKLM scintillator part.
std::map< KLMChannelNumber, double > m_time_channel
Time distribution central value of each channel.
TH1F * hc_eventT0_rpc_lowN
Corrected EventT0 for RPC with low hit count.
double m_ctime_channelAvg_scint_end
Calibrated central value of the global time distribution (EKLM scintillator part).
CalibrationAlgorithm::EResult readCalibrationData()
Read calibration data.
TH1F * hc_eventT0_scint_lowN
Corrected EventT0 for BKLM scintillator with low hit count.
TGraph * gr_timeShift_channel_scint_end
EKLM.
TGraph * gr_timeRes_channel_scint
BKLM scintillator.
TH2F * h2_deltaT0_vs_v_scint
DeltaT0 vs inverse hit count for BKLM scintillator.
TH1F * hc_timeF_scint[2]
BKLM scintillator part.
TH1F * h_timeFS_scint[2][8]
BKLM scintillator part.
bool m_saveChannelHists
Write per-channel temporary histograms (tc/raw/hc) in minimal mode.
double m_UpperTimeBoundaryScintillatorsBKLM
Upper time boundary for BKLM scintillators.
const KLMElementNumbers * m_ElementNumbers
Element numbers.
void writeThenDelete_(TH1 *h, bool write, TDirectory *dir=nullptr)
Optionally write a histogram, then delete it to free memory.
std::pair< int, double > tR_upperStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with increasing strip number.
TH1F * hc_timeF_rpc[2]
BKLM RPC part.
TH2F * h2c_timeFS_end[2][4]
EKLM part.
TH1F * h_timeFSLPC_end[2][4][14][2][75]
EKLM part.
const EKLM::GeometryData * m_EKLMGeometry
EKLM geometry data.
TGraphErrors * gre_ctime_channel_scint_end
EKLM.
TH1F * h_nHits_plus_scint_end
Number of EKLM scintillator hits per mu+ track.
TProfile * m_Profile2BKLMScintillatorPhi
For BKLM scintillator phi plane.
TH1F * hc_time_scint_end
EKLM part.
TH1F * hc_eventT0_scint
Corrected EventT0 for BKLM scintillator hits.
TGraphErrors * gre_time_channel_scint_end
EKLM.
TH2F * h2_timeFSLP[2][8][15][2]
BKLM part.
double m_UpperTimeBoundaryCalibratedScintillatorsEKLM
Upper time boundary for BKLM scintillators (calibrated data).
TGraph * gr_timeShift_channel_scint
BKLM scintillator.
double m_time_channelAvg_scint_end
Central value of the global time distribution (EKLM scintillator part).
TProfile * m_Profile2EKLMScintillatorPlane1
For EKLM scintillator plane1.
TH1F * hc_timeFS_rpc[2][8]
BKLM RPC part.
double m_UpperTimeBoundaryScintillatorsEKLM
Upper time boundary for BKLM scintillators.
void fillTimeDistanceProfiles(TProfile *profileRpcPhi, TProfile *profileRpcZ, TProfile *profileBKLMScintillatorPhi, TProfile *profileBKLMScintillatorZ, TProfile *profileEKLMScintillatorPlane1, TProfile *profileEKLMScintillatorPlane2, bool fill2dHistograms)
Fill profiles of time versus distance.
TFile * m_outFile
Output file.
double esti_timeShift(const KLMChannelIndex &klmChannel)
Estimate value of calibration constant for uncalibrated channels.
std::pair< int, double > tS_upperStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with increasing strip number.
double m_LowerTimeBoundaryCalibratedScintillatorsEKLM
Lower time boundary for EKLM scintillators (calibrated data).
TH1F * hc_timeFSLP[2][8][15][2]
BKLM part.
TGraphErrors * gre_ctime_channel_rpc
BKLM RPC.
void saveHist()
Save histograms to file.
const bklm::GeometryPar * m_BKLMGeometry
BKLM geometry data.
bool m_saveAllPlots
Default minimal unless you set true in your header script.
TH2F * h2c_timeFSLP[2][8][15][2]
BKLM part.
double m_ctime_channelAvg_scint
Calibrated central value of the global time distribution (BKLM scintillator part).
TF1 * fcn_const
Const function.
double m_UpperTimeBoundaryCalibratedScintillatorsBKLM
Upper time boundary for BKLM scintillators (calibrated data).
TProfile * m_Profile2RpcZ
For BKLM RPC z plane.
TH1F * h_timeFSLPC[2][8][15][2][54]
BKLM part.
TH1F * h_nHits_minus_rpc
Number of RPC hits per mu- track.
void setDebug()
Turn on debug mode (prints histograms and output running log).
TH2F * m_HistTimeLengthBKLM[2][8][15][2][54]
Two-dimensional distributions of time versus propagation length.
TH2F * h2_timeFSLP_end[2][4][14][2]
EKLM part.
TH1I * hc_calibrated
Calibration statistics for each channel.
TH1F * h_eventT0_rpc
EventT0 seen by RPC hits.
void timeDistance2dFit(const std::vector< std::pair< KLMChannelNumber, unsigned int > > &channels, double &delay, double &delayError)
Two-dimensional fit for individual channels.
TGraph * gr_timeRes_channel_scint_end
EKLM.
TH1I * h_calibrated
Calibration statistics for each channel.
TProfile * m_ProfileBKLMScintillatorZ
For BKLM scintillator z plane.
double m_LowerTimeBoundaryScintillatorsBKLM
Lower time boundary for BKLM scintillators.
TH1F * hc_eventT0_scint_end_midN
Corrected EventT0 for EKLM scintillator with medium hit count.
TH1F * h_time_rpc_tc
BKLM RPC part.
TH1F * h_time_scint_end
EKLM part.
TH2F * h2c_timeF_scint[2]
BKLM scintillator part.
TF1 * fcn_pol1
Pol1 function.
double m_etime_channelAvg_scint_end
Central value error of the global time distribution (EKLM scintillator part).
TH1F * hc_time_rpc
BKLM RPC part.
double mc_etime_channelAvg_scint
Calibrated central value error of the global time distribution (BKLM scintillator part).
TH2F * h2c_timeFSLP_end[2][4][14][2]
EKLM part.
double mc_etime_channelAvg_scint_end
Calibrated central value error of the global time distribution (EKLM scintillator part).
bool passesADCCut(const Event &event, int subdetector, int layer) const
Check if event passes ADC count cuts for quality selection.
TH2F * h2_timeF_scint_end[2]
EKLM part.
void useEvtT0()
Use event T0 as the initial time point or not.
KLMEventT0HitResolution * m_eventT0HitResolution
DBObject of per-hit time resolution for EventT0.
TF1 * fcn_gaus
Gaussian function.
double m_LowerTimeBoundaryCalibratedScintillatorsBKLM
Lower time boundary for BKLM scintillators (calibrated data).
TH1F * h_timeF_rpc[2]
BKLM RPC part.
TProfile * m_ProfileBKLMScintillatorPhi
For BKLM scintillator phi plane.
void setSaveAllPlots(bool on)
Save every preallocated debug histogram family (sectors/layers/planes/2D maps).
TH1F * hc_time_scint
BKLM scintillator part.
TH2F * h2_timeFS[2][8]
BKLM part.
double m_fixedRPCDelay
Fixed propagation delay for RPCs (ns/cm).
double m_etime_channelAvg_scint
Central value error of the global time distribution (BKLM scintillator part).
TH1F * h_timeF_scint_end[2]
EKLM part.
TH1F * hc_eventT0_scint_end
Corrected EventT0 for EKLM scintillator hits.
TProfile * m_ProfileRpcPhi
For BKLM RPC phi plane.
TGraphErrors * gre_ctime_channel_scint
BKLM Scintillator.
TH2F * h2_deltaT0_vs_nhits_scint
DeltaT0 vs total hit count for BKLM scintillator.
TH2F * h2_deltaT0_vs_nhits_rpc
DeltaT0 vs total hit count for RPC.
TProfile * m_ProfileEKLMScintillatorPlane2
For EKLM scintillator plane2.
TH1F * h_time_rpc
BKLM RPC part.
TH1F * h_timeFSL_end[2][4][14]
EKLM part.
TProfile * m_Profile2RpcPhi
For BKLM RPC phi plane.
TH1F * h_timeF_scint[2]
BKLM scintillator part.
TH1F * hc_timeFSL[2][8][15]
BKLM part.
TProfile * m_Profile2BKLMScintillatorZ
For BKLM scintillator z plane.
TH2F * h2_deltaT0_vs_v_scint_end
DeltaT0 vs inverse hit count for EKLM scintillator.
TH1F * h_timeFS_rpc[2][8]
BKLM RPC part.
KLMChannelIndex m_klmChannels
KLM ChannelIndex object.
TGraph * gr_timeShift_channel_rpc
BKLM RPC.
std::map< KLMChannelNumber, double > m_timeRes
Resolution values of each channel.
TH1F * h_eventT0_scint_end
EventT0 seen by EKLM scintillator hits.
TH1F * h_diff
Distance between global and local position.
TH1F * hc_eventT0_rpc_highN
Corrected EventT0 for RPC with high hit count.
TH1F * h_nHits_plus_scint
Number of BKLM scintillator hits per mu+ track.
TH2F * h2_timeF_scint[2]
BKLM scintillator part.
TH1F * h_time_scint_tc
BKLM scintillator part.
double m_LowerTimeBoundaryRPC
Lower time boundary for RPC.
virtual EResult calibrate() override
Run algorithm on data.
std::map< KLMChannelNumber, double > m_ctime_channel
Calibrated time distribution central value of each channel.
double m_LowerTimeBoundaryCalibratedRPC
Lower time boundary for RPC (calibrated data).
TH2F * h2_deltaT0_vs_nhits_scint_end
DeltaT0 vs total hit count for EKLM scintillator.
bool m_useEventT0
Whether to use event T0 from CDC.
int m_MinimalDigitNumber
Minimal digit number (total).
void setLowerLimit(int counts)
Set the lower number of hits collected on one single strip.
ChannelCalibrationStatus
Channel calibration status.
void setSaveChannelHists(bool on)
When running in minimal mode, also write the per-channel temporary histograms (the vital tc,...
TProfile * m_ProfileEKLMScintillatorPlane1
For EKLM scintillator plane1.
double m_UpperTimeBoundaryRPC
Upper time boundary for RPC.
TH2F * h2c_timeF_rpc[2]
BKLM RPC part.
TH1F * hc_eventT0_scint_highN
Corrected EventT0 for BKLM scintillator with high hit count.
TF1 * fcn_land
Landau function.
KLMTimeCableDelay * m_timeCableDelay
DBObject of the calibration constant of each channel due to cable decay.
TH2F * h2_deltaT0_vs_v_rpc
DeltaT0 vs inverse hit count for RPC.
std::pair< int, double > tS_lowerStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with decreasing strip number.
TProfile * m_ProfileRpcZ
For BKLM RPC z plane.
bool m_useFixedRPCDelay
Whether to use fixed propagation delay for RPCs.
std::map< KLMChannelNumber, double > mc_etime_channel
Calibrated time distribution central value Error of each channel.
std::pair< int, double > tR_lowerStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with decreasing strip number.
void setMC(bool mc)
Set flag indicating whether the input is MC sample.
void readCalibrationDataBatch(std::function< bool(const KLMChannelIndex &)> channelFilter)
Load calibration data for a specific batch of channels.
TH1F * hc_eventT0_rpc_midN
Corrected EventT0 for RPC with medium hit count.
TH1F * h_nHits_minus_scint
Number of BKLM scintillator hits per mu- track.
TH1F * hc_timeFSLPC[2][8][15][2][54]
BKLM part.
ROOT::Math::MinimizerOptions m_minimizerOptions
Minimization options.
TProfile * prof_deltaT0_rms_vs_v_scint
DeltaT0 RMS vs inverse hit count profile for BKLM scintillator.
std::map< KLMChannelNumber, int > m_cFlag
Calibration flag if the channel has enough hits collected and fitted OK.
TGraphErrors * gre_time_channel_rpc
BKLM RPC.
TH2F * h2_timeFS_end[2][4]
EKLM part.
TH2F * h2_timeF_rpc[2]
BKLM RPC part.
TH1F * h_nHits_plus_rpc
Number of RPC hits per mu+ track.
std::map< KLMChannelNumber, std::vector< struct Event > > m_evts
Container of hit information.
TDirectory * m_channelHistDir_EKLM[2][4][14][2]
Directory structure for per-channel histograms (EKLM).
TH1F * hc_eventT0_rpc
Corrected EventT0 for RPC hits.
TH1F * h_nHits_minus_scint_end
Number of EKLM scintillator hits per mu- track.
TH1F * h_timeFS_scint_end[2][4]
EKLM part.
double m_time_channelAvg_rpc
Central value of the global time distribution (BKLM RPC part).
TH2F * h2c_timeFS[2][8]
BKLM part.
double m_etime_channelAvg_rpc
Central value error of the global time distribution (BKLM RPC part).
double m_LowerTimeBoundaryScintillatorsEKLM
Lower time boundary for EKLM scintillators.
void readCalibrationDataCounts(std::map< KLMChannelNumber, unsigned int > &eventCounts)
Count events per channel (lightweight scan without loading full data).
std::map< KLMChannelNumber, double > m_etime_channel
Time distribution central value Error of each channel.
int m_lower_limit_counts
Lower limit of hits collected for on single channel.
TH1F * hc_eventT0_scint_end_lowN
Corrected EventT0 for EKLM scintillator with low hit count.
void readCalibrationDataFor2DFit(const std::vector< std::pair< KLMChannelNumber, unsigned int > > &channelsBKLM, const std::vector< std::pair< KLMChannelNumber, unsigned int > > &channelsEKLM)
Load calibration data only for channels needed for 2D fit.
Class to store BKLM delay time coused by cable in the database.
Class to store KLM constants related to time.
Class to store KLM time resolution in the database.
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition GeometryPar.h:37
Abstract base class for different kinds of events.
double flyTime
Particle flying time.
double diffDistX
Global position difference between klmHit2d and ExtHit (X).
double t0
EventT0 for the digit.
int channelId
Unique channel id Barral and endcap merged.
bool inRPC
BKLM RPC flag, used for testing and not necessary.
double eDep
Collect energy eV.
bool isGood
Flag the good and bad hits.
double diffDistY
Global position difference between klmHit2d and ExtHit (Y).
double t0_uc
Event T0 resolution.
double diffDistZ
Global position difference between klmHit2d and ExtHit (Z).
double time() const
Get propagation time + cableDelay time.
double dist
Propagation distance from hit to FEE.
double nPE
Number of photon electron.
double recTime
Recosntruction time respected to the trigger time.
bool isFlipped
If phi and z plane flipped, used for testing and not necessary.