Belle II Software development
KLMTimeAlgorithm Class Reference

KLM time calibration algorithm. More...

#include <KLMTimeAlgorithm.h>

Inheritance diagram for KLMTimeAlgorithm:
CalibrationAlgorithm

Classes

struct  Event
 Event data. More...
 

Public Types

enum  ChannelCalibrationStatus {
  c_NotEnoughData = 0 ,
  c_FailedFit = 1 ,
  c_SuccessfulCalibration = 2
}
 Channel calibration status. More...
 
enum  EResult {
  c_OK ,
  c_Iterate ,
  c_NotEnoughData ,
  c_Failure ,
  c_Undefined
}
 The result of calibration. More...
 

Public Member Functions

 KLMTimeAlgorithm ()
 Constructor.
 
 ~KLMTimeAlgorithm ()
 Destructor.
 
void setDebug ()
 Turn on debug mode (prints histograms and output running log).
 
void setMC (bool mc)
 Set flag indicating whether the input is MC sample.
 
void useEvtT0 ()
 Use event T0 as the initial time point or not.
 
void setMinimalDigitNumber (int minimalDigitNumber)
 Set minimal digit number (total).
 
void setLowerLimit (int counts)
 Set the lower number of hits collected on one single strip.
 
void saveHist ()
 Save histograms to 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.
 
std::pair< int, double > tS_lowerStrip (const KLMChannelIndex &klmChannel)
 Tracing available channels with decreasing strip number.
 
double esti_timeRes (const KLMChannelIndex &klmChannel)
 Estimate value of calibration constant for calibrated channels.
 
std::pair< int, double > tR_upperStrip (const KLMChannelIndex &klmChannel)
 Tracing available channels with increasing strip number.
 
std::pair< int, double > tR_lowerStrip (const KLMChannelIndex &klmChannel)
 Tracing available channels with decreasing strip number.
 
std::string getPrefix () const
 Get the prefix used for getting calibration data.
 
bool checkPyExpRun (PyObject *pyObj)
 Checks that a PyObject can be successfully converted to an ExpRun type.
 
Calibration::ExpRun convertPyExpRun (PyObject *pyObj)
 Performs the conversion of PyObject to ExpRun.
 
std::string getCollectorName () const
 Alias for prefix.
 
void setPrefix (const std::string &prefix)
 Set the prefix used to identify datastore objects.
 
void setInputFileNames (PyObject *inputFileNames)
 Set the input file names used for this algorithm from a Python list.
 
PyObject * getInputFileNames ()
 Get the input file names used for this algorithm and pass them out as a Python list of unicode strings.
 
std::vector< Calibration::ExpRun > getRunListFromAllData () const
 Get the complete list of runs from inspection of collected data.
 
RunRange getRunRangeFromAllData () const
 Get the complete RunRange from inspection of collected data.
 
IntervalOfValidity getIovFromAllData () const
 Get the complete IoV from inspection of collected data.
 
void fillRunToInputFilesMap ()
 Fill the mapping of ExpRun -> Files.
 
std::string getGranularity () const
 Get the granularity of collected data.
 
EResult execute (std::vector< Calibration::ExpRun > runs={}, int iteration=0, IntervalOfValidity iov=IntervalOfValidity())
 Runs calibration over vector of runs for a given iteration.
 
EResult execute (PyObject *runs, int iteration=0, IntervalOfValidity iov=IntervalOfValidity())
 Runs calibration over Python list of runs. Converts to C++ and then calls the other execute() function.
 
std::list< Database::DBImportQuery > & getPayloads ()
 Get constants (in TObjects) for database update from last execution.
 
std::list< Database::DBImportQuerygetPayloadValues ()
 Get constants (in TObjects) for database update from last execution but passed by VALUE.
 
bool commit ()
 Submit constants from last calibration into database.
 
bool commit (std::list< Database::DBImportQuery > payloads)
 Submit constants from a (potentially previous) set of payloads.
 
const std::string & getDescription () const
 Get the description of the algoithm (set by developers in constructor)
 
bool loadInputJson (const std::string &jsonString)
 Load the m_inputJson variable from a string (useful from Python interface). The rturn bool indicates success or failure.
 
const std::string dumpOutputJson () const
 Dump the JSON string of the output JSON object.
 
const std::vector< Calibration::ExpRun > findPayloadBoundaries (std::vector< Calibration::ExpRun > runs, int iteration=0)
 Used to discover the ExpRun boundaries that you want the Python CAF to execute on. This is optional and only used in some.
 
template<>
std::shared_ptr< TTree > getObjectPtr (const std::string &name, const std::vector< Calibration::ExpRun > &requestedRuns)
 Specialization of getObjectPtr<TTree>.
 

Protected Member Functions

virtual EResult calibrate () override
 Run algorithm on data.
 
void setInputFileNames (std::vector< std::string > inputFileNames)
 Set the input file names used for this algorithm.
 
virtual bool isBoundaryRequired (const Calibration::ExpRun &)
 Given the current collector data, make a decision about whether or not this run should be the start of a payload boundary.
 
virtual void boundaryFindingSetup (std::vector< Calibration::ExpRun >, int)
 If you need to make some changes to your algorithm class before 'findPayloadBoundaries' is run, make them in this function.
 
virtual void boundaryFindingTearDown ()
 Put your algorithm back into a state ready for normal execution if you need to.
 
const std::vector< Calibration::ExpRun > & getRunList () const
 Get the list of runs for which calibration is called.
 
int getIteration () const
 Get current iteration.
 
std::vector< std::string > getVecInputFileNames () const
 Get the input file names used for this algorithm as a STL vector.
 
template<class T >
std::shared_ptr< T > getObjectPtr (const std::string &name, const std::vector< Calibration::ExpRun > &requestedRuns)
 Get calibration data object by name and list of runs, the Merge function will be called to generate the overall object.
 
template<class T >
std::shared_ptr< T > getObjectPtr (std::string name)
 Get calibration data object (for all runs the calibration is requested for) This function will only work during or after execute() has been called once.
 
template<>
shared_ptr< TTree > getObjectPtr (const string &name, const vector< ExpRun > &requestedRuns)
 We cheekily cast the TChain to TTree for the returned pointer so that the user never knows Hopefully this doesn't cause issues if people do low level stuff to the tree...
 
std::string getGranularityFromData () const
 Get the granularity of collected data.
 
void saveCalibration (TClonesArray *data, const std::string &name)
 Store DBArray payload with given name with default IOV.
 
void saveCalibration (TClonesArray *data, const std::string &name, const IntervalOfValidity &iov)
 Store DBArray with given name and custom IOV.
 
void saveCalibration (TObject *data)
 Store DB payload with default name and default IOV.
 
void saveCalibration (TObject *data, const IntervalOfValidity &iov)
 Store DB payload with default name and custom IOV.
 
void saveCalibration (TObject *data, const std::string &name)
 Store DB payload with given name with default IOV.
 
void saveCalibration (TObject *data, const std::string &name, const IntervalOfValidity &iov)
 Store DB payload with given name and custom IOV.
 
void updateDBObjPtrs (const unsigned int event, const int run, const int experiment)
 Updates any DBObjPtrs by calling update(event) for DBStore.
 
void setDescription (const std::string &description)
 Set algorithm description (in constructor)
 
void clearCalibrationData ()
 Clear calibration data.
 
Calibration::ExpRun getAllGranularityExpRun () const
 Returns the Exp,Run pair that means 'Everything'. Currently unused.
 
void resetInputJson ()
 Clears the m_inputJson member variable.
 
void resetOutputJson ()
 Clears the m_outputJson member variable.
 
template<class T >
void setOutputJsonValue (const std::string &key, const T &value)
 Set a key:value pair for the outputJson object, expected to used interally during calibrate()
 
template<class T >
const T getOutputJsonValue (const std::string &key) const
 Get a value using a key from the JSON output object, not sure why you would want to do this.
 
template<class T >
const T getInputJsonValue (const std::string &key) const
 Get an input JSON value using a key. The normal exceptions are raised when the key doesn't exist.
 
const nlohmann::json & getInputJsonObject () const
 Get the entire top level JSON object. We explicitly say this must be of object type so that we might pick.
 
bool inputJsonKeyExists (const std::string &key) const
 Test for a key in the input JSON object.
 

Protected Attributes

std::vector< Calibration::ExpRun > m_boundaries
 When using the boundaries functionality from isBoundaryRequired, this is used to store the boundaries. It is cleared when.
 

Private Member Functions

void setupDatabase ()
 Setup the database.
 
CalibrationAlgorithm::EResult readCalibrationData ()
 Read calibration data.
 
void createHistograms ()
 Create histograms.
 
void fillTimeDistanceProfiles (TProfile *profileRpcPhi, TProfile *profileRpcZ, TProfile *profileBKLMScintillatorPhi, TProfile *profileBKLMScintillatorZ, TProfile *profileEKLMScintillatorPlane1, TProfile *profileEKLMScintillatorPlane2, bool fill2dHistograms)
 Fill profiles of time versus distance.
 
void timeDistance2dFit (const std::vector< std::pair< KLMChannelNumber, unsigned int > > &channels, double &delay, double &delayError)
 Two-dimensional fit for individual channels.
 
std::string getExpRunString (Calibration::ExpRun &expRun) const
 Gets the "exp.run" string repr. of (exp,run)
 
std::string getFullObjectPath (const std::string &name, Calibration::ExpRun expRun) const
 constructs the full TDirectory + Key name of an object in a TFile based on its name and exprun
 

Private Attributes

std::map< KLMChannelNumber, std::vector< struct Event > > m_evts
 Container of hit information.
 
std::map< KLMChannelNumber, int > m_cFlag
 Calibration flag if the channel has enough hits collected and fitted OK.
 
std::map< KLMChannelNumber, double > m_timeShift
 Shift values of each channel.
 
std::map< KLMChannelNumber, double > m_timeRes
 Resolution values of each channel.
 
std::map< KLMChannelNumber, double > m_time_channel
 Time distribution central value of each channel.
 
std::map< KLMChannelNumber, double > m_etime_channel
 Time distribution central value Error of each channel.
 
std::map< KLMChannelNumber, double > m_ctime_channel
 Calibrated time distribution central value of each channel.
 
std::map< KLMChannelNumber, double > mc_etime_channel
 Calibrated time distribution central value Error of each channel.
 
double m_LowerTimeBoundaryRPC = -10.0
 Lower time boundary for RPC.
 
double m_UpperTimeBoundaryRPC = 10.0
 Upper time boundary for RPC.
 
double m_LowerTimeBoundaryScintillatorsBKLM = 20.0
 Lower time boundary for BKLM scintillators.
 
double m_UpperTimeBoundaryScintillatorsBKLM = 70.0
 Upper time boundary for BKLM scintillators.
 
double m_LowerTimeBoundaryScintillatorsEKLM = 20.0
 Lower time boundary for EKLM scintillators.
 
double m_UpperTimeBoundaryScintillatorsEKLM = 70.0
 Upper time boundary for BKLM scintillators.
 
double m_LowerTimeBoundaryCalibratedRPC = -40.0
 Lower time boundary for RPC (calibrated data).
 
double m_UpperTimeBoundaryCalibratedRPC = 40.0
 Upper time boundary for RPC (calibrated data).
 
double m_LowerTimeBoundaryCalibratedScintillatorsBKLM = -40.0
 Lower time boundary for BKLM scintillators (calibrated data).
 
double m_UpperTimeBoundaryCalibratedScintillatorsBKLM = 40.0
 Upper time boundary for BKLM scintillators (calibrated data).
 
double m_LowerTimeBoundaryCalibratedScintillatorsEKLM = -40.0
 Lower time boundary for EKLM scintillators (calibrated data).
 
double m_UpperTimeBoundaryCalibratedScintillatorsEKLM = 40.0
 Upper time boundary for BKLM scintillators (calibrated data).
 
double m_time_channelAvg_rpc = 0.0
 Central value of the global time distribution (BKLM RPC part).
 
double m_etime_channelAvg_rpc = 0.0
 Central value error of the global time distribution (BKLM RPC part).
 
double m_time_channelAvg_scint = 0.0
 Central value of the global time distribution (BKLM scintillator part).
 
double m_etime_channelAvg_scint = 0.0
 Central value error of the global time distribution (BKLM scintillator part).
 
double m_time_channelAvg_scint_end = 0.0
 Central value of the global time distribution (EKLM scintillator part).
 
double m_etime_channelAvg_scint_end = 0.0
 Central value error of the global time distribution (EKLM scintillator part).
 
double m_ctime_channelAvg_rpc = 0.0
 Calibrated central value of the global time distribution (BKLM RPC part).
 
double mc_etime_channelAvg_rpc = 0.0
 Calibrated central value error of the global time distribution (BKLM RPC part).
 
double m_ctime_channelAvg_scint = 0.0
 Calibrated central value of the global time distribution (BKLM scintillator part).
 
double mc_etime_channelAvg_scint = 0.0
 Calibrated central value error of the global time distribution (BKLM scintillator part).
 
double m_ctime_channelAvg_scint_end = 0.0
 Calibrated central value of the global time distribution (EKLM scintillator part).
 
double mc_etime_channelAvg_scint_end = 0.0
 Calibrated central value error of the global time distribution (EKLM scintillator part).
 
int m_MinimalDigitNumber = 100000000
 Minimal digit number (total).
 
int m_lower_limit_counts = 50
 Lower limit of hits collected for on single channel.
 
const KLMElementNumbersm_ElementNumbers
 Element numbers.
 
const bklm::GeometryParm_BKLMGeometry = nullptr
 BKLM geometry data.
 
const EKLM::GeometryDatam_EKLMGeometry = nullptr
 EKLM geometry data.
 
KLMChannelIndex m_klmChannels
 KLM ChannelIndex object.
 
ROOT::Math::MinimizerOptions m_minimizerOptions
 Minimization options.
 
KLMTimeConstantsm_timeConstants = nullptr
 DBObject of time cost on some parts of the detector.
 
KLMTimeCableDelaym_timeCableDelay = nullptr
 DBObject of the calibration constant of each channel due to cable decay.
 
KLMTimeResolutionm_timeResolution = nullptr
 DBObject of time resolution.
 
bool m_debug = false
 Debug mode.
 
bool m_mc = false
 MC or data.
 
bool m_useEventT0 = true
 Whether to use event T0 from CDC.
 
TH1I * h_calibrated = nullptr
 Calibration statistics for each channel.
 
TH1I * hc_calibrated = nullptr
 Calibration statistics for each channel.
 
TH1F * h_diff = nullptr
 Distance between global and local position.
 
TGraphErrors * gre_time_channel_rpc = nullptr
 BKLM RPC.
 
TGraphErrors * gre_time_channel_scint = nullptr
 BKLM Scintillator.
 
TGraphErrors * gre_time_channel_scint_end = nullptr
 EKLM.
 
TGraphErrors * gre_ctime_channel_rpc = nullptr
 BKLM RPC.
 
TGraphErrors * gre_ctime_channel_scint = nullptr
 BKLM Scintillator.
 
TGraphErrors * gre_ctime_channel_scint_end = nullptr
 EKLM.
 
TGraph * gr_timeShift_channel_rpc = nullptr
 BKLM RPC.
 
TGraph * gr_timeShift_channel_scint = nullptr
 BKLM scintillator.
 
TGraph * gr_timeShift_channel_scint_end = nullptr
 EKLM.
 
TGraph * gr_timeRes_channel_rpc = nullptr
 BKLM RPC.
 
TGraph * gr_timeRes_channel_scint = nullptr
 BKLM scintillator.
 
TGraph * gr_timeRes_channel_scint_end = nullptr
 EKLM.
 
TProfile * m_ProfileRpcPhi = nullptr
 For BKLM RPC phi plane.
 
TProfile * m_ProfileRpcZ = nullptr
 For BKLM RPC z plane.
 
TProfile * m_ProfileBKLMScintillatorPhi = nullptr
 For BKLM scintillator phi plane.
 
TProfile * m_ProfileBKLMScintillatorZ = nullptr
 For BKLM scintillator z plane.
 
TProfile * m_ProfileEKLMScintillatorPlane1 = nullptr
 For EKLM scintillator plane1.
 
TProfile * m_ProfileEKLMScintillatorPlane2 = nullptr
 For EKLM scintillator plane2.
 
TProfile * m_Profile2RpcPhi = nullptr
 For BKLM RPC phi plane.
 
TProfile * m_Profile2RpcZ = nullptr
 For BKLM RPC z plane.
 
TProfile * m_Profile2BKLMScintillatorPhi = nullptr
 For BKLM scintillator phi plane.
 
TProfile * m_Profile2BKLMScintillatorZ = nullptr
 For BKLM scintillator z plane.
 
TProfile * m_Profile2EKLMScintillatorPlane1 = nullptr
 For EKLM scintillator plane1.
 
TProfile * m_Profile2EKLMScintillatorPlane2 = nullptr
 For EKLM scintillator plane2.
 
TH1F * h_time_rpc_tc = nullptr
 BKLM RPC part.
 
TH1F * h_time_scint_tc = nullptr
 BKLM scintillator part.
 
TH1F * h_time_scint_tc_end = nullptr
 EKLM part.
 
TH1F * h_time_rpc = nullptr
 BKLM RPC part.
 
TH1F * h_time_scint = nullptr
 BKLM scintillator part.
 
TH1F * h_time_scint_end = nullptr
 EKLM part.
 
TH1F * hc_time_rpc = nullptr
 BKLM RPC part.
 
TH1F * hc_time_scint = nullptr
 BKLM scintillator part.
 
TH1F * hc_time_scint_end = nullptr
 EKLM part.
 
TH1F * h_timeF_rpc [2] = {nullptr}
 BKLM RPC part.
 
TH1F * h_timeF_scint [2] = {nullptr}
 BKLM scintillator part.
 
TH1F * h_timeF_scint_end [2] = {nullptr}
 EKLM part.
 
TH1F * hc_timeF_rpc [2] = {nullptr}
 BKLM RPC part.
 
TH1F * hc_timeF_scint [2] = {nullptr}
 BKLM scintillator part.
 
TH1F * hc_timeF_scint_end [2] = {nullptr}
 EKLM part.
 
TH2F * h2_timeF_rpc [2] = {nullptr}
 BKLM RPC part.
 
TH2F * h2_timeF_scint [2] = {nullptr}
 BKLM scintillator part.
 
TH2F * h2_timeF_scint_end [2] = {nullptr}
 EKLM part.
 
TH2F * h2c_timeF_rpc [2] = {nullptr}
 BKLM RPC part.
 
TH2F * h2c_timeF_scint [2] = {nullptr}
 BKLM scintillator part.
 
TH2F * h2c_timeF_scint_end [2] = {nullptr}
 EKLM part.
 
TH1F * h_timeFS_rpc [2][8] = {{nullptr}}
 BKLM RPC part.
 
TH1F * h_timeFS_scint [2][8] = {{nullptr}}
 BKLM scintillator part.
 
TH1F * h_timeFS_scint_end [2][4] = {{nullptr}}
 EKLM part.
 
TH1F * hc_timeFS_rpc [2][8] = {{nullptr}}
 BKLM RPC part.
 
TH1F * hc_timeFS_scint [2][8] = {{nullptr}}
 BKLM scintillator part.
 
TH1F * hc_timeFS_scint_end [2][4] = {{nullptr}}
 EKLM part.
 
TH2F * h2_timeFS [2][8] = {{nullptr}}
 BKLM part.
 
TH2F * h2_timeFS_end [2][4] = {{nullptr}}
 EKLM part.
 
TH2F * h2c_timeFS [2][8] = {{nullptr}}
 BKLM part.
 
TH2F * h2c_timeFS_end [2][4] = {{nullptr}}
 EKLM part.
 
TH1F * h_timeFSL [2][8][15] = {{{nullptr}}}
 BKLM part.
 
TH1F * h_timeFSL_end [2][4][14] = {{{nullptr}}}
 EKLM part.
 
TH1F * hc_timeFSL [2][8][15] = {{{nullptr}}}
 BKLM part.
 
TH1F * hc_timeFSL_end [2][4][14] = {{{nullptr}}}
 EKLM part.
 
TH1F * h_timeFSLP [2][8][15][2] = {{{{nullptr}}}}
 BKLM part.
 
TH1F * h_timeFSLP_end [2][4][14][2] = {{{{nullptr}}}}
 EKLM part.
 
TH1F * hc_timeFSLP [2][8][15][2] = {{{{nullptr}}}}
 BKLM part.
 
TH1F * hc_timeFSLP_end [2][4][14][2] = {{{{nullptr}}}}
 EKLM part.
 
TH2F * h2_timeFSLP [2][8][15][2] = {{{{nullptr}}}}
 BKLM part.
 
TH2F * h2_timeFSLP_end [2][4][14][2] = {{{{nullptr}}}}
 EKLM part.
 
TH2F * h2c_timeFSLP [2][8][15][2] = {{{{nullptr}}}}
 BKLM part.
 
TH2F * h2c_timeFSLP_end [2][4][14][2] = {{{{nullptr}}}}
 EKLM part.
 
TH1F * h_timeFSLPC_tc [2][8][15][2][54] = {{{{{nullptr}}}}}
 BKLM part, used for effective light speed estimation.
 
TH1F * h_timeFSLPC [2][8][15][2][54] = {{{{{nullptr}}}}}
 BKLM part.
 
TH2F * m_HistTimeLengthBKLM [2][8][15][2][54] = {{{{{nullptr}}}}}
 Two-dimensional distributions of time versus propagation length.
 
TH1F * h_timeFSLPC_tc_end [2][4][14][2][75] = {{{{{nullptr}}}}}
 EKLM part, used for effective light speed estimation.
 
TH1F * h_timeFSLPC_end [2][4][14][2][75] = {{{{{nullptr}}}}}
 EKLM part.
 
TH2F * m_HistTimeLengthEKLM [2][4][14][2][75] = {{{{{nullptr}}}}}
 Two-dimensional distributions of time versus propagation length.
 
TH1F * hc_timeFSLPC [2][8][15][2][54] = {{{{{nullptr}}}}}
 BKLM part.
 
TH1F * hc_timeFSLPC_end [2][4][14][2][75] = {{{{{nullptr}}}}}
 EKLM part.
 
TF1 * fcn_pol1 = nullptr
 Pol1 function.
 
TF1 * fcn_const = nullptr
 Const function.
 
TF1 * fcn_gaus = nullptr
 Gaussian function.
 
TF1 * fcn_land = nullptr
 Landau function.
 
TFile * m_outFile = nullptr
 Output file.
 
std::vector< std::string > m_inputFileNames
 List of input files to the Algorithm, will initially be user defined but then gets the wildcards expanded during execute()
 
std::map< Calibration::ExpRun, std::vector< std::string > > m_runsToInputFiles
 Map of Runs to input files. Gets filled when you call getRunRangeFromAllData, gets cleared when setting input files again.
 
std::string m_granularityOfData
 Granularity of input data. This only changes when the input files change so it isn't specific to an execution.
 
ExecutionData m_data
 Data specific to a SINGLE execution of the algorithm. Gets reset at the beginning of execution.
 
std::string m_description {""}
 Description of the algorithm.
 
std::string m_prefix {""}
 The name of the TDirectory the collector objects are contained within.
 
nlohmann::json m_jsonExecutionInput = nlohmann::json::object()
 Optional input JSON object used to make decisions about how to execute the algorithm code.
 
nlohmann::json m_jsonExecutionOutput = nlohmann::json::object()
 Optional output JSON object that can be set during the execution by the underlying algorithm code.
 

Static Private Attributes

static const Calibration::ExpRun m_allExpRun = make_pair(-1, -1)
 allExpRun
 

Detailed Description

KLM time calibration algorithm.

Definition at line 41 of file KLMTimeAlgorithm.h.

Member Enumeration Documentation

◆ ChannelCalibrationStatus

Channel calibration status.

Definition at line 99 of file KLMTimeAlgorithm.h.

99 {
100
101 /* Not enough data. */
102 c_NotEnoughData = 0,
103
104 /* Failed fit. */
105 c_FailedFit = 1,
106
107 /* Successful calibration. */
108 c_SuccessfulCalibration = 2,
109
110 };

◆ EResult

enum EResult
inherited

The result of calibration.

Enumerator
c_OK 

Finished successfuly =0 in Python.

c_Iterate 

Needs iteration =1 in Python.

c_NotEnoughData 

Needs more data =2 in Python.

c_Failure 

Failed =3 in Python.

c_Undefined 

Not yet known (before execution) =4 in Python.

Definition at line 40 of file CalibrationAlgorithm.h.

40 {
41 c_OK,
42 c_Iterate,
44 c_Failure,
46 };
@ c_OK
Finished successfuly =0 in Python.
@ c_Iterate
Needs iteration =1 in Python.
@ c_NotEnoughData
Needs more data =2 in Python.
@ c_Failure
Failed =3 in Python.
@ c_Undefined
Not yet known (before execution) =4 in Python.

Constructor & Destructor Documentation

◆ KLMTimeAlgorithm()

Constructor.

Definition at line 93 of file KLMTimeAlgorithm.cc.

93 :
94 CalibrationAlgorithm("KLMTimeCollector")
95{
97 m_minimizerOptions = ROOT::Math::MinimizerOptions();
98}
Base class for calibration algorithms.
static const KLMElementNumbers & Instance()
Instantiation.
const KLMElementNumbers * m_ElementNumbers
Element numbers.
ROOT::Math::MinimizerOptions m_minimizerOptions
Minimization options.

◆ ~KLMTimeAlgorithm()

Destructor.

Definition at line 100 of file KLMTimeAlgorithm.cc.

101{
102}

Member Function Documentation

◆ boundaryFindingSetup()

virtual void boundaryFindingSetup ( std::vector< Calibration::ExpRun >  ,
int   
)
inlineprotectedvirtualinherited

If you need to make some changes to your algorithm class before 'findPayloadBoundaries' is run, make them in this function.

Reimplemented in TestBoundarySettingAlgorithm, TestCalibrationAlgorithm, PXDAnalyticGainCalibrationAlgorithm, PXDValidationAlgorithm, SVD3SampleCoGTimeCalibrationAlgorithm, SVD3SampleELSTimeCalibrationAlgorithm, and SVDCoGTimeCalibrationAlgorithm.

Definition at line 252 of file CalibrationAlgorithm.h.

252{};

◆ boundaryFindingTearDown()

virtual void boundaryFindingTearDown ( )
inlineprotectedvirtualinherited

Put your algorithm back into a state ready for normal execution if you need to.

Definition at line 257 of file CalibrationAlgorithm.h.

257{};

◆ calibrate()

CalibrationAlgorithm::EResult calibrate ( )
overrideprotectedvirtual

Run algorithm on data.

=======================================================================================

Implements CalibrationAlgorithm.

Definition at line 740 of file KLMTimeAlgorithm.cc.

741{
742 int channelId;
743 gROOT->SetBatch(kTRUE);
748
749 fcn_gaus = new TF1("fcn_gaus", "gaus");
750 fcn_land = new TF1("fcn_land", "landau");
751 fcn_pol1 = new TF1("fcn_pol1", "pol1");
752 fcn_const = new TF1("fcn_const", "pol0");
753
755 if (result != CalibrationAlgorithm::c_OK)
756 return result;
757
758 /* Choose non-existing file name. */
759 std::string name = "time_calibration.root";
760 int i = 1;
761 while (1) {
762 struct stat buffer;
763 if (stat(name.c_str(), &buffer) != 0)
764 break;
765 name = "time_calibration_" + std::to_string(i) + ".root";
766 i = i + 1;
767 /* Overflow. */
768 if (i < 0)
769 break;
770 }
771 m_outFile = new TFile(name.c_str(), "recreate");
773
774 std::vector<struct Event>::iterator it;
775 std::vector<struct Event> eventsChannel;
776
777 eventsChannel.clear();
778 m_cFlag.clear();
779 m_minimizerOptions.SetDefaultStrategy(2);
780
781 /* Sort channels by number of events. */
782 std::vector< std::pair<KLMChannelNumber, unsigned int> > channelsBKLM;
783 std::vector< std::pair<KLMChannelNumber, unsigned int> > channelsEKLM;
784 KLMChannelIndex klmChannels;
785 for (KLMChannelIndex& klmChannel : klmChannels) {
786 KLMChannelNumber channel = klmChannel.getKLMChannelNumber();
787 m_cFlag[channel] = ChannelCalibrationStatus::c_NotEnoughData;
788 if (m_evts.find(channel) == m_evts.end())
789 continue;
790 int nEvents = m_evts[channel].size();
791 if (nEvents < m_lower_limit_counts) {
792 B2WARNING("Not enough calibration data collected."
793 << LogVar("channel", channel)
794 << LogVar("number of digit", nEvents));
795 continue;
796 }
797 m_cFlag[channel] = ChannelCalibrationStatus::c_FailedFit;
798 if (klmChannel.getSubdetector() == KLMElementNumbers::c_BKLM &&
799 klmChannel.getLayer() < BKLMElementNumbers::c_FirstRPCLayer) {
800 channelsBKLM.push_back(
801 std::pair<KLMChannelNumber, unsigned int>(channel, nEvents));
802 }
803 if (klmChannel.getSubdetector() == KLMElementNumbers::c_EKLM) {
804 channelsEKLM.push_back(
805 std::pair<KLMChannelNumber, unsigned int>(channel, nEvents));
806 }
807 }
808 std::sort(channelsBKLM.begin(), channelsBKLM.end(), compareEventNumber);
809 std::sort(channelsEKLM.begin(), channelsEKLM.end(), compareEventNumber);
810
811 /* Two-dimensional fit for the channel with the maximal number of events. */
812 double delayBKLM, delayBKLMError;
813 double delayEKLM, delayEKLMError;
814 timeDistance2dFit(channelsBKLM, delayBKLM, delayBKLMError);
815 timeDistance2dFit(channelsEKLM, delayEKLM, delayEKLMError);
816
817 /**********************************
818 * First loop
819 * Estimation of effective light speed for Scintillators and RPCs, separately.
820 **********************************/
821 B2INFO("Effective light speed Estimation.");
822 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
823 channelId = klmChannel.getKLMChannelNumber();
824 if (m_cFlag[channelId] == ChannelCalibrationStatus::c_NotEnoughData)
825 continue;
826
827 eventsChannel = m_evts[channelId];
828 int iSub = klmChannel.getSubdetector();
829
830 for (it = eventsChannel.begin(); it != eventsChannel.end(); ++it) {
831 XYZVector diffD = XYZVector(it->diffDistX, it->diffDistY, it->diffDistZ);
832 h_diff->Fill(diffD.R());
833 double timeHit = it->time();
834 if (m_useEventT0)
835 timeHit = timeHit - it->t0;
836 if (iSub == KLMElementNumbers::c_BKLM) {
837 int iF = klmChannel.getSection();
838 int iS = klmChannel.getSector() - 1;
839 int iL = klmChannel.getLayer() - 1;
840 int iP = klmChannel.getPlane();
841 int iC = klmChannel.getStrip() - 1;
842 h_timeFSLPC_tc[iF][iS][iL][iP][iC]->Fill(timeHit);
843 if (iL > 1) {
844 h_time_rpc_tc->Fill(timeHit);
845 } else {
846 h_time_scint_tc->Fill(timeHit);
847 }
848 } else {
849 int iF = klmChannel.getSection() - 1;
850 int iS = klmChannel.getSector() - 1;
851 int iL = klmChannel.getLayer() - 1;
852 int iP = klmChannel.getPlane() - 1;
853 int iC = klmChannel.getStrip() - 1;
854 h_timeFSLPC_tc_end[iF][iS][iL][iP][iC]->Fill(timeHit);
855 h_time_scint_tc_end->Fill(timeHit);
856 }
857 }
858 }
859 B2INFO("Effective light speed Estimation! Hists and Graph filling done.");
860
861 m_timeShift.clear();
862
863 double tmpMean_rpc_global = h_time_rpc_tc->GetMean();
864 double tmpMean_scint_global = h_time_scint_tc->GetMean();
865 double tmpMean_scint_global_end = h_time_scint_tc_end->GetMean();
866
867 B2INFO("Global Mean for Raw." << LogVar("RPC", tmpMean_rpc_global) << LogVar("Scint BKLM",
868 tmpMean_scint_global) << LogVar("Scint EKLM", tmpMean_scint_global_end));
869
870 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
871 channelId = klmChannel.getKLMChannelNumber();
872 if (m_cFlag[channelId] == ChannelCalibrationStatus::c_NotEnoughData)
873 continue;
874
875 int iSub = klmChannel.getSubdetector();
876 if (iSub == KLMElementNumbers::c_BKLM) {
877 int iF = klmChannel.getSection();
878 int iS = klmChannel.getSector() - 1;
879 int iL = klmChannel.getLayer() - 1;
880 int iP = klmChannel.getPlane();
881 int iC = klmChannel.getStrip() - 1;
882 h_timeFSLPC_tc[iF][iS][iL][iP][iC]->Fit(fcn_gaus, "LESQ");
883 double tmpMean_channel = fcn_gaus->GetParameter(1);
884 if (iL > 1) {
885 m_timeShift[channelId] = tmpMean_channel - tmpMean_rpc_global;
886 } else {
887 m_timeShift[channelId] = tmpMean_channel - tmpMean_scint_global;
888 }
889 } else {
890 int iF = klmChannel.getSection() - 1;
891 int iS = klmChannel.getSector() - 1;
892 int iL = klmChannel.getLayer() - 1;
893 int iP = klmChannel.getPlane() - 1;
894 int iC = klmChannel.getStrip() - 1;
895 h_timeFSLPC_tc_end[iF][iS][iL][iP][iC]->Fit(fcn_gaus, "LESQ");
896 double tmpMean_channel = fcn_gaus->GetParameter(1);
897 m_timeShift[channelId] = tmpMean_channel - tmpMean_scint_global_end;
898 }
899 }
900
901 delete h_time_scint_tc;
902 delete h_time_scint_tc_end;
903 delete h_time_rpc_tc;
904 B2INFO("Effective Light m_timeShift obtained. done.");
905
910
911 B2INFO("Effective light speed fitting.");
912 m_ProfileRpcPhi->Fit("fcn_pol1", "EMQ");
913 double delayRPCPhi = fcn_pol1->GetParameter(1);
914 double e_slope_rpc_phi = fcn_pol1->GetParError(1);
915
916 m_ProfileRpcZ->Fit("fcn_pol1", "EMQ");
917 double delayRPCZ = fcn_pol1->GetParameter(1);
918 double e_slope_rpc_z = fcn_pol1->GetParError(1);
919
920 m_ProfileBKLMScintillatorPhi->Fit("fcn_pol1", "EMQ");
921 double slope_scint_phi = fcn_pol1->GetParameter(1);
922 double e_slope_scint_phi = fcn_pol1->GetParError(1);
923
924 m_ProfileBKLMScintillatorZ->Fit("fcn_pol1", "EMQ");
925 double slope_scint_z = fcn_pol1->GetParameter(1);
926 double e_slope_scint_z = fcn_pol1->GetParError(1);
927
928 m_ProfileEKLMScintillatorPlane1->Fit("fcn_pol1", "EMQ");
929 double slope_scint_plane1_end = fcn_pol1->GetParameter(1);
930 double e_slope_scint_plane1_end = fcn_pol1->GetParError(1);
931
932 m_ProfileEKLMScintillatorPlane2->Fit("fcn_pol1", "EMQ");
933 double slope_scint_plane2_end = fcn_pol1->GetParameter(1);
934 double e_slope_scint_plane2_end = fcn_pol1->GetParError(1);
935
936 TString logStr_phi, logStr_z;
937 logStr_phi = Form("%.4f +/- %.4f ns/cm", delayRPCPhi, e_slope_rpc_phi);
938 logStr_z = Form("%.4f +/- %.4f ns/cm", delayRPCZ, e_slope_rpc_z);
939 B2INFO("Delay in RPCs:"
940 << LogVar("Fitted Value (phi readout) ", logStr_phi.Data())
941 << LogVar("Fitted Value (z readout) ", logStr_z.Data()));
942 logStr_phi = Form("%.4f +/- %.4f ns/cm", slope_scint_phi, e_slope_scint_phi);
943 logStr_z = Form("%.4f +/- %.4f ns/cm", slope_scint_z, e_slope_scint_z);
944 B2INFO("Delay in BKLM scintillators:"
945 << LogVar("Fitted Value (phi readout) ", logStr_phi.Data())
946 << LogVar("Fitted Value (z readout) ", logStr_z.Data()));
947 logStr_phi = Form("%.4f +/- %.4f ns/cm", slope_scint_plane1_end,
948 e_slope_scint_plane1_end);
949 logStr_z = Form("%.4f +/- %.4f ns/cm", slope_scint_plane2_end,
950 e_slope_scint_plane2_end);
951 B2INFO("Delay in EKLM scintillators:"
952 << LogVar("Fitted Value (plane1 readout) ", logStr_phi.Data())
953 << LogVar("Fitted Value (plane2 readout) ", logStr_z.Data()));
954
955 logStr_z = Form("%.4f +/- %.4f ns/cm", delayBKLM, delayBKLMError);
956 B2INFO("Delay in BKLM scintillators:"
957 << LogVar("Fitted Value (2d fit) ", logStr_z.Data()));
958 logStr_z = Form("%.4f +/- %.4f ns/cm", delayEKLM, delayEKLMError);
959 B2INFO("Delay in EKLM scintillators:"
960 << LogVar("Fitted Value (2d fit) ", logStr_z.Data()));
961
962 // Default Effective light speed in current Database
963 //delayEKLM = 0.5 * (slope_scint_plane1_end + slope_scint_plane2_end);
964 //delayBKLM = 0.5 * (slope_scint_phi + slope_scint_z);
965
970
972 B2INFO("Time distribution filling begins.");
973 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
974 channelId = klmChannel.getKLMChannelNumber();
975 int iSub = klmChannel.getSubdetector();
976
977 if (m_cFlag[channelId] == ChannelCalibrationStatus::c_NotEnoughData)
978 continue;
979 eventsChannel = m_evts[channelId];
980
981 for (it = eventsChannel.begin(); it != eventsChannel.end(); ++it) {
982 double timeHit = it->time();
983 if (m_useEventT0)
984 timeHit = timeHit - it->t0;
985 if (iSub == KLMElementNumbers::c_BKLM) {
986 int iF = klmChannel.getSection();
987 int iS = klmChannel.getSector() - 1;
988 int iL = klmChannel.getLayer() - 1;
989 int iP = klmChannel.getPlane();
990 int iC = klmChannel.getStrip() - 1;
991 if (iL > 1) {
992 double propgationT;
994 propgationT = it->dist * delayRPCZ;
995 else
996 propgationT = it->dist * delayRPCPhi;
997 double time = timeHit - propgationT;
998 h_time_rpc->Fill(time);
999 h_timeF_rpc[iF]->Fill(time);
1000 h_timeFS_rpc[iF][iS]->Fill(time);
1001 h_timeFSL[iF][iS][iL]->Fill(time);
1002 h_timeFSLP[iF][iS][iL][iP]->Fill(time);
1003 h_timeFSLPC[iF][iS][iL][iP][iC]->Fill(time);
1004 h2_timeF_rpc[iF]->Fill(iS, time);
1005 h2_timeFS[iF][iS]->Fill(iL, time);
1006 h2_timeFSLP[iF][iS][iL][iP]->Fill(iC, time);
1007 } else {
1008 double propgationT = it->dist * delayBKLM;
1009 double time = timeHit - propgationT;
1010 h_time_scint->Fill(time);
1011 h_timeF_scint[iF]->Fill(time);
1012 h_timeFS_scint[iF][iS]->Fill(time);
1013 h_timeFSL[iF][iS][iL]->Fill(time);
1014 h_timeFSLP[iF][iS][iL][iP]->Fill(time);
1015 h_timeFSLPC[iF][iS][iL][iP][iC]->Fill(time);
1016 h2_timeF_scint[iF]->Fill(iS, time);
1017 h2_timeFS[iF][iS]->Fill(iL, time);
1018 h2_timeFSLP[iF][iS][iL][iP]->Fill(iC, time);
1019 }
1020 } else {
1021 int iF = klmChannel.getSection() - 1;
1022 int iS = klmChannel.getSector() - 1;
1023 int iL = klmChannel.getLayer() - 1;
1024 int iP = klmChannel.getPlane() - 1;
1025 int iC = klmChannel.getStrip() - 1;
1026 double propgationT = it->dist * delayEKLM;
1027 double time = timeHit - propgationT;
1028 h_time_scint_end->Fill(time);
1029 h_timeF_scint_end[iF]->Fill(time);
1030 h_timeFS_scint_end[iF][iS]->Fill(time);
1031 h_timeFSL_end[iF][iS][iL]->Fill(time);
1032 h_timeFSLP_end[iF][iS][iL][iP]->Fill(time);
1033 h_timeFSLPC_end[iF][iS][iL][iP][iC]->Fill(time);
1034 h2_timeF_scint_end[iF]->Fill(iS, time);
1035 h2_timeFS_end[iF][iS]->Fill(iL, time);
1036 h2_timeFSLP_end[iF][iS][iL][iP]->Fill(iC, time);
1037 }
1038 }
1039 }
1040
1041 B2INFO("Original filling done.");
1042
1043 int iChannel_rpc = 0;
1044 int iChannel = 0;
1045 int iChannel_end = 0;
1046 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1047 channelId = klmChannel.getKLMChannelNumber();
1048 if (m_cFlag[channelId] == ChannelCalibrationStatus::c_NotEnoughData)
1049 continue;
1050 int iSub = klmChannel.getSubdetector();
1051
1052 if (iSub == KLMElementNumbers::c_BKLM) {
1053 int iF = klmChannel.getSection();
1054 int iS = klmChannel.getSector() - 1;
1055 int iL = klmChannel.getLayer() - 1;
1056 int iP = klmChannel.getPlane();
1057 int iC = klmChannel.getStrip() - 1;
1058
1059 TFitResultPtr r = h_timeFSLPC[iF][iS][iL][iP][iC]->Fit(fcn_gaus, "LESQ");
1060 if (int(r) != 0)
1061 continue;
1062 if (int(r) == 0)
1063 m_cFlag[channelId] = ChannelCalibrationStatus::c_SuccessfulCalibration;
1064 m_time_channel[channelId] = fcn_gaus->GetParameter(1);
1065 m_etime_channel[channelId] = fcn_gaus->GetParError(1);
1066 if (iL > 1) {
1067 gre_time_channel_rpc->SetPoint(iChannel_rpc, channelId, m_time_channel[channelId]);
1068 gre_time_channel_rpc->SetPointError(iChannel_rpc, 0., m_etime_channel[channelId]);
1069 iChannel_rpc++;
1070 } else {
1071 gre_time_channel_scint->SetPoint(iChannel, channelId, m_time_channel[channelId]);
1072 gre_time_channel_scint->SetPointError(iChannel, 0., m_etime_channel[channelId]);
1073 iChannel++;
1074 }
1075 } else {
1076 int iF = klmChannel.getSection() - 1;
1077 int iS = klmChannel.getSector() - 1;
1078 int iL = klmChannel.getLayer() - 1;
1079 int iP = klmChannel.getPlane() - 1;
1080 int iC = klmChannel.getStrip() - 1;
1081
1082 TFitResultPtr r = h_timeFSLPC_end[iF][iS][iL][iP][iC]->Fit(fcn_gaus, "LESQ");
1083 if (int(r) != 0)
1084 continue;
1085 if (int(r) == 0)
1086 m_cFlag[channelId] = ChannelCalibrationStatus::c_SuccessfulCalibration;
1087 m_time_channel[channelId] = fcn_gaus->GetParameter(1);
1088 m_etime_channel[channelId] = fcn_gaus->GetParError(1);
1089 gre_time_channel_scint_end->SetPoint(iChannel_end, channelId, m_time_channel[channelId]);
1090 gre_time_channel_scint_end->SetPointError(iChannel_end, 0., m_etime_channel[channelId]);
1091 iChannel_end++;
1092 }
1093 }
1094
1095 gre_time_channel_scint->Fit("fcn_const", "EMQ");
1096 m_time_channelAvg_scint = fcn_const->GetParameter(0);
1097 m_etime_channelAvg_scint = fcn_const->GetParError(0);
1098
1099 gre_time_channel_scint_end->Fit("fcn_const", "EMQ");
1100 m_time_channelAvg_scint_end = fcn_const->GetParameter(0);
1101 m_etime_channelAvg_scint_end = fcn_const->GetParError(0);
1102
1103 gre_time_channel_rpc->Fit("fcn_const", "EMQ");
1104 m_time_channelAvg_rpc = fcn_const->GetParameter(0);
1105 m_etime_channelAvg_rpc = fcn_const->GetParError(0);
1106
1107 B2INFO("Channel's time distribution fitting done.");
1108 B2DEBUG(20, LogVar("Average time (RPC)", m_time_channelAvg_rpc)
1109 << LogVar("Average time (BKLM scintillators)", m_time_channelAvg_scint)
1110 << LogVar("Average time (EKLM scintillators)", m_time_channelAvg_scint_end));
1111
1112 B2INFO("Calibrated channel's time distribution filling begins.");
1113
1114 m_timeShift.clear();
1115 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1116 channelId = klmChannel.getKLMChannelNumber();
1117 h_calibrated->Fill(m_cFlag[channelId]);
1118 if (m_time_channel.find(channelId) == m_time_channel.end())
1119 continue;
1120 double timeShift = m_time_channel[channelId];
1121 int iSub = klmChannel.getSubdetector();
1122 if (iSub == KLMElementNumbers::c_BKLM) {
1123 int iL = klmChannel.getLayer() - 1;
1124 if (iL > 1)
1125 m_timeShift[channelId] = timeShift;
1126 else
1127 m_timeShift[channelId] = timeShift;
1128 } else {
1129 m_timeShift[channelId] = timeShift;
1130 }
1131 m_timeCableDelay->setTimeDelay(channelId, m_timeShift[channelId]);
1132 }
1133
1134 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1135 channelId = klmChannel.getKLMChannelNumber();
1136 if (m_timeShift.find(channelId) != m_timeShift.end())
1137 continue;
1138 m_timeShift[channelId] = esti_timeShift(klmChannel);
1139 m_timeCableDelay->setTimeDelay(channelId, m_timeShift[channelId]);
1140 B2DEBUG(20, "Uncalibrated Estimation " << LogVar("Channel", channelId) << LogVar("Estimated value", m_timeShift[channelId]));
1141 }
1142
1143 iChannel_rpc = 0;
1144 iChannel = 0;
1145 iChannel_end = 0;
1146 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1147 channelId = klmChannel.getKLMChannelNumber();
1148 if (m_timeShift.find(channelId) == m_timeShift.end()) {
1149 B2ERROR("!!! Not All Channels Calibration Constant Set. Error Happened on " << LogVar("Channel", channelId));
1150 continue;
1151 }
1152 int iSub = klmChannel.getSubdetector();
1153 if (iSub == KLMElementNumbers::c_BKLM) {
1154 int iL = klmChannel.getLayer();
1155 if (iL > 2) {
1156 gr_timeShift_channel_rpc->SetPoint(iChannel_rpc, channelId, m_timeShift[channelId]);
1157 iChannel_rpc++;
1158 } else {
1159 gr_timeShift_channel_scint->SetPoint(iChannel, channelId, m_timeShift[channelId]);
1160 iChannel++;
1161 }
1162 } else {
1163 gr_timeShift_channel_scint_end->SetPoint(iChannel_end, channelId, m_timeShift[channelId]);
1164 iChannel_end++;
1165 }
1166 }
1167
1172
1173 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1174 channelId = klmChannel.getKLMChannelNumber();
1175 int iSub = klmChannel.getSubdetector();
1176 eventsChannel = m_evts[channelId];
1177 for (it = eventsChannel.begin(); it != eventsChannel.end(); ++it) {
1178 double timeHit = it->time();
1179 if (m_useEventT0)
1180 timeHit = timeHit - it->t0;
1181 if (iSub == KLMElementNumbers::c_BKLM) {
1182 int iF = klmChannel.getSection();
1183 int iS = klmChannel.getSector() - 1;
1184 int iL = klmChannel.getLayer() - 1;
1185 int iP = klmChannel.getPlane();
1186 int iC = klmChannel.getStrip() - 1;
1187 if (iL > 1) {
1188 double propgationT;
1190 propgationT = it->dist * delayRPCZ;
1191 else
1192 propgationT = it->dist * delayRPCPhi;
1193 double time = timeHit - propgationT - m_timeShift[channelId];
1194 hc_time_rpc->Fill(time);
1195 hc_timeF_rpc[iF]->Fill(time);
1196 hc_timeFS_rpc[iF][iS]->Fill(time);
1197 hc_timeFSL[iF][iS][iL]->Fill(time);
1198 hc_timeFSLP[iF][iS][iL][iP]->Fill(time);
1199 hc_timeFSLPC[iF][iS][iL][iP][iC]->Fill(time);
1200 h2c_timeF_rpc[iF]->Fill(iS, time);
1201 h2c_timeFS[iF][iS]->Fill(iL, time);
1202 h2c_timeFSLP[iF][iS][iL][iP]->Fill(iC, time);
1203 } else {
1204 double propgationT = it->dist * delayBKLM;
1205 double time = timeHit - propgationT - m_timeShift[channelId];
1206 hc_time_scint->Fill(time);
1207 hc_timeF_scint[iF]->Fill(time);
1208 hc_timeFS_scint[iF][iS]->Fill(time);
1209 hc_timeFSL[iF][iS][iL]->Fill(time);
1210 hc_timeFSLP[iF][iS][iL][iP]->Fill(time);
1211 hc_timeFSLPC[iF][iS][iL][iP][iC]->Fill(time);
1212 h2c_timeF_scint[iF]->Fill(iS, time);
1213 h2c_timeFS[iF][iS]->Fill(iL, time);
1214 h2c_timeFSLP[iF][iS][iL][iP]->Fill(iC, time);
1215 }
1216 } else {
1217 int iF = klmChannel.getSection() - 1;
1218 int iS = klmChannel.getSector() - 1;
1219 int iL = klmChannel.getLayer() - 1;
1220 int iP = klmChannel.getPlane() - 1;
1221 int iC = klmChannel.getStrip() - 1;
1222 double propgationT = it->dist * delayEKLM;
1223 double time = timeHit - propgationT - m_timeShift[channelId];
1224 hc_time_scint_end->Fill(time);
1225 hc_timeF_scint_end[iF]->Fill(time);
1226 hc_timeFS_scint_end[iF][iS]->Fill(time);
1227 hc_timeFSL_end[iF][iS][iL]->Fill(time);
1228 hc_timeFSLP_end[iF][iS][iL][iP]->Fill(time);
1229 hc_timeFSLPC_end[iF][iS][iL][iP][iC]->Fill(time);
1230 h2c_timeF_scint_end[iF]->Fill(iS, time);
1231 h2c_timeFS_end[iF][iS]->Fill(iL, time);
1232 h2c_timeFSLP_end[iF][iS][iL][iP]->Fill(iC, time);
1233 }
1234 }
1235 }
1236
1237 int icChannel_rpc = 0;
1238 int icChannel = 0;
1239 int icChannel_end = 0;
1240 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1241 channelId = klmChannel.getKLMChannelNumber();
1242 if (m_cFlag[channelId] == ChannelCalibrationStatus::c_NotEnoughData)
1243 continue;
1244 int iSub = klmChannel.getSubdetector();
1245
1246 if (iSub == KLMElementNumbers::c_BKLM) {
1247 int iF = klmChannel.getSection();
1248 int iS = klmChannel.getSector() - 1;
1249 int iL = klmChannel.getLayer() - 1;
1250 int iP = klmChannel.getPlane();
1251 int iC = klmChannel.getStrip() - 1;
1252
1253 TFitResultPtr rc = hc_timeFSLPC[iF][iS][iL][iP][iC]->Fit(fcn_gaus, "LESQ");
1254 if (int(rc) != 0)
1255 continue;
1256 if (int(rc) == 0)
1257 m_cFlag[channelId] = ChannelCalibrationStatus::c_SuccessfulCalibration;
1258 m_ctime_channel[channelId] = fcn_gaus->GetParameter(1);
1259 mc_etime_channel[channelId] = fcn_gaus->GetParError(1);
1260 if (iL > 1) {
1261 gre_ctime_channel_rpc->SetPoint(icChannel_rpc, channelId, m_ctime_channel[channelId]);
1262 gre_ctime_channel_rpc->SetPointError(icChannel_rpc, 0., mc_etime_channel[channelId]);
1263 icChannel_rpc++;
1264 } else {
1265 gre_ctime_channel_scint->SetPoint(icChannel, channelId, m_ctime_channel[channelId]);
1266 gre_ctime_channel_scint->SetPointError(icChannel, 0., mc_etime_channel[channelId]);
1267 icChannel++;
1268 }
1269 } else {
1270 int iF = klmChannel.getSection() - 1;
1271 int iS = klmChannel.getSector() - 1;
1272 int iL = klmChannel.getLayer() - 1;
1273 int iP = klmChannel.getPlane() - 1;
1274 int iC = klmChannel.getStrip() - 1;
1275
1276 TFitResultPtr rc = hc_timeFSLPC_end[iF][iS][iL][iP][iC]->Fit(fcn_gaus, "LESQ");
1277 if (int(rc) != 0)
1278 continue;
1279 if (int(rc) == 0)
1280 m_cFlag[channelId] = ChannelCalibrationStatus::c_SuccessfulCalibration;
1281 m_ctime_channel[channelId] = fcn_gaus->GetParameter(1);
1282 mc_etime_channel[channelId] = fcn_gaus->GetParError(1);
1283 gre_ctime_channel_scint_end->SetPoint(icChannel_end, channelId, m_ctime_channel[channelId]);
1284 gre_ctime_channel_scint_end->SetPointError(icChannel_end, 0., mc_etime_channel[channelId]);
1285 icChannel_end++;
1286 }
1287 }
1288
1289 gre_ctime_channel_scint->Fit("fcn_const", "EMQ");
1290 m_ctime_channelAvg_scint = fcn_const->GetParameter(0);
1291 mc_etime_channelAvg_scint = fcn_const->GetParError(0);
1292
1293 gre_ctime_channel_scint_end->Fit("fcn_const", "EMQ");
1294 m_ctime_channelAvg_scint_end = fcn_const->GetParameter(0);
1295 mc_etime_channelAvg_scint_end = fcn_const->GetParError(0);
1296
1297 gre_ctime_channel_rpc->Fit("fcn_const", "EMQ");
1298 m_ctime_channelAvg_rpc = fcn_const->GetParameter(0);
1299 mc_etime_channelAvg_rpc = fcn_const->GetParError(0);
1300
1301 B2INFO("Channel's time distribution fitting done.");
1302 B2DEBUG(20, LogVar("Average calibrated time (RPC)", m_ctime_channelAvg_rpc)
1303 << LogVar("Average calibrated time (BKLM scintillators)", m_ctime_channelAvg_scint)
1304 << LogVar("Average calibrated time (EKLM scintillators)", m_ctime_channelAvg_scint_end));
1305
1306 B2INFO("Calibrated channel's time distribution filling begins.");
1307
1308 m_timeRes.clear();
1309 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1310 channelId = klmChannel.getKLMChannelNumber();
1311 hc_calibrated->Fill(m_cFlag[channelId]);
1312 if (m_ctime_channel.find(channelId) == m_ctime_channel.end())
1313 continue;
1314 double timeRes = m_ctime_channel[channelId];
1315 int iSub = klmChannel.getSubdetector();
1316 if (iSub == KLMElementNumbers::c_BKLM) {
1317 int iL = klmChannel.getLayer() - 1;
1318 if (iL > 1)
1319 m_timeRes[channelId] = timeRes;
1320 else
1321 m_timeRes[channelId] = timeRes;
1322 } else {
1323 m_timeRes[channelId] = timeRes;
1324 }
1325 m_timeResolution->setTimeResolution(channelId, m_timeRes[channelId]);
1326 }
1327
1328 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1329 channelId = klmChannel.getKLMChannelNumber();
1330 if (m_timeRes.find(channelId) != m_timeRes.end())
1331 continue;
1332 m_timeRes[channelId] = esti_timeRes(klmChannel);
1333 m_timeResolution->setTimeResolution(channelId, m_timeRes[channelId]);
1334 B2DEBUG(20, "Calibrated Estimation " << LogVar("Channel", channelId) << LogVar("Estimated value", m_timeRes[channelId]));
1335 }
1336
1337 icChannel_rpc = 0;
1338 icChannel = 0;
1339 icChannel_end = 0;
1340 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
1341 channelId = klmChannel.getKLMChannelNumber();
1342 if (m_timeRes.find(channelId) == m_timeRes.end()) {
1343 B2ERROR("!!! Not All Channels Calibration Constant Set. Error Happened on " << LogVar("Channel", channelId));
1344 continue;
1345 }
1346 int iSub = klmChannel.getSubdetector();
1347 if (iSub == KLMElementNumbers::c_BKLM) {
1348 int iL = klmChannel.getLayer();
1349 if (iL > 2) {
1350 gr_timeRes_channel_rpc->SetPoint(icChannel_rpc, channelId, m_timeRes[channelId]);
1351 icChannel_rpc++;
1352 } else {
1353 gr_timeRes_channel_scint->SetPoint(icChannel, channelId, m_timeRes[channelId]);
1354 icChannel++;
1355 }
1356 } else {
1357 gr_timeRes_channel_scint_end->SetPoint(icChannel_end, channelId, m_timeRes[channelId]);
1358 icChannel_end++;
1359 }
1360 }
1361 saveHist();
1362
1363 delete fcn_const;
1364 m_evts.clear();
1365 m_timeShift.clear();
1366 m_timeRes.clear();
1367 m_cFlag.clear();
1368
1369 saveCalibration(m_timeCableDelay, "KLMTimeCableDelay");
1370 saveCalibration(m_timeConstants, "KLMTimeConstants");
1371 saveCalibration(m_timeResolution, "KLMTimeResolution");
1373}
@ c_FirstRPCLayer
First RPC layer.
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default IOV.
EResult
The result of calibration.
KLM channel index.
KLMChannelIndex begin()
First channel.
KLMChannelIndex & end()
Last channel.
TProfile * m_Profile2EKLMScintillatorPlane2
For EKLM scintillator plane2.
double mc_etime_channelAvg_rpc
Calibrated central value error of the global time distribution (BKLM RPC part).
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 * h_time_scint_tc_end
EKLM part.
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.
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_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.
TH1F * hc_timeFS_scint[2][8]
BKLM scintillator part.
std::map< KLMChannelNumber, double > m_time_channel
Time distribution central value of each channel.
double m_ctime_channelAvg_scint_end
Calibrated central value of the global time distribution (EKLM scintillator part).
CalibrationAlgorithm::EResult readCalibrationData()
Read calibration data.
TGraph * gr_timeShift_channel_scint_end
EKLM.
TGraph * gr_timeRes_channel_scint
BKLM scintillator.
TH1F * hc_timeF_scint[2]
BKLM scintillator part.
TH1F * h_timeFS_scint[2][8]
BKLM scintillator part.
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.
TGraphErrors * gre_ctime_channel_scint_end
EKLM.
TProfile * m_Profile2BKLMScintillatorPhi
For BKLM scintillator phi plane.
TH1F * hc_time_scint_end
EKLM part.
TGraphErrors * gre_time_channel_scint_end
EKLM.
TH2F * h2_timeFSLP[2][8][15][2]
BKLM part.
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.
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.
TH1F * hc_timeFSLP[2][8][15][2]
BKLM part.
TGraphErrors * gre_ctime_channel_rpc
BKLM RPC.
void saveHist()
Save histograms to file.
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.
TProfile * m_Profile2RpcZ
For BKLM RPC z plane.
TH1F * h_timeFSLPC[2][8][15][2][54]
BKLM part.
TH2F * h2_timeFSLP_end[2][4][14][2]
EKLM part.
TH1I * hc_calibrated
Calibration statistics for each channel.
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.
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).
TH2F * h2_timeF_scint_end[2]
EKLM part.
TF1 * fcn_gaus
Gaussian function.
TH1F * h_timeF_rpc[2]
BKLM RPC part.
TProfile * m_ProfileBKLMScintillatorPhi
For BKLM scintillator phi plane.
TH1F * hc_time_scint
BKLM scintillator part.
TH2F * h2_timeFS[2][8]
BKLM part.
double m_etime_channelAvg_scint
Central value error of the global time distribution (BKLM scintillator part).
TH1F * h_timeF_scint_end[2]
EKLM part.
TProfile * m_ProfileRpcPhi
For BKLM RPC phi plane.
TGraphErrors * gre_ctime_channel_scint
BKLM Scintillator.
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.
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_diff
Distance between global and local position.
TH2F * h2_timeF_scint[2]
BKLM scintillator part.
TH1F * h_time_scint_tc
BKLM scintillator part.
std::map< KLMChannelNumber, double > m_ctime_channel
Calibrated time distribution central value of each channel.
bool m_useEventT0
Whether to use event T0 from CDC.
TProfile * m_ProfileEKLMScintillatorPlane1
For EKLM scintillator plane1.
TH2F * h2c_timeF_rpc[2]
BKLM RPC part.
TF1 * fcn_land
Landau function.
KLMTimeCableDelay * m_timeCableDelay
DBObject of the calibration constant of each channel due to cable decay.
TProfile * m_ProfileRpcZ
For BKLM RPC z plane.
std::map< KLMChannelNumber, double > mc_etime_channel
Calibrated time distribution central value Error of each channel.
TH1F * hc_timeFSLPC[2][8][15][2][54]
BKLM part.
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.
std::map< KLMChannelNumber, std::vector< struct Event > > m_evts
Container of hit information.
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).
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.
Class to store BKLM delay time coused by cable in the database.
void setTimeDelay(KLMChannelNumber channel, float timeDelay)
Set the time calibration constant.
Class to store KLM constants related to time.
@ c_BKLM
BKLM scintillator.
@ c_EKLM
EKLM scintillator.
void setDelay(float delay, int cType)
Set effective light speed of scintillators.
Class to store KLM time resolution in the database.
void setTimeResolution(KLMChannelNumber channel, float resolution)
Set time resolution.
Class to store variables with their name which were sent to the logging service.
uint16_t KLMChannelNumber
Channel number.

◆ checkPyExpRun()

bool checkPyExpRun ( PyObject *  pyObj)
inherited

Checks that a PyObject can be successfully converted to an ExpRun type.

Checks if the PyObject can be converted to ExpRun.

Definition at line 28 of file CalibrationAlgorithm.cc.

29{
30 // Is it a sequence?
31 if (PySequence_Check(pyObj)) {
32 Py_ssize_t nObj = PySequence_Length(pyObj);
33 // Does it have 2 objects in it?
34 if (nObj != 2) {
35 B2DEBUG(29, "ExpRun was a Python sequence which didn't have exactly 2 entries!");
36 return false;
37 }
38 PyObject* item1, *item2;
39 item1 = PySequence_GetItem(pyObj, 0);
40 item2 = PySequence_GetItem(pyObj, 1);
41 // Did the GetItem work?
42 if ((item1 == NULL) || (item2 == NULL)) {
43 B2DEBUG(29, "A PyObject pointer was NULL in the sequence");
44 return false;
45 }
46 // Are they longs?
47 if (PyLong_Check(item1) && PyLong_Check(item2)) {
48 long value1, value2;
49 value1 = PyLong_AsLong(item1);
50 value2 = PyLong_AsLong(item2);
51 if (((value1 == -1) || (value2 == -1)) && PyErr_Occurred()) {
52 B2DEBUG(29, "An error occurred while converting the PyLong to long");
53 return false;
54 }
55 } else {
56 B2DEBUG(29, "One or more of the PyObjects in the ExpRun wasn't a long");
57 return false;
58 }
59 // Make sure to kill off the reference GetItem gave us responsibility for
60 Py_DECREF(item1);
61 Py_DECREF(item2);
62 } else {
63 B2DEBUG(29, "ExpRun was not a Python sequence.");
64 return false;
65 }
66 return true;
67}

◆ clearCalibrationData()

void clearCalibrationData ( )
inlineprotectedinherited

Clear calibration data.

Definition at line 324 of file CalibrationAlgorithm.h.

void clearCalibrationData()
Clear calibration data.
ExecutionData m_data
Data specific to a SINGLE execution of the algorithm. Gets reset at the beginning of execution.

◆ commit() [1/2]

bool commit ( )
inherited

Submit constants from last calibration into database.

Definition at line 302 of file CalibrationAlgorithm.cc.

303{
304 if (getPayloads().empty())
305 return false;
306 list<Database::DBImportQuery> payloads = getPayloads();
307 B2INFO("Committing " << payloads.size() << " payloads to database.");
308 return Database::Instance().storeData(payloads);
309}
std::list< Database::DBImportQuery > & getPayloads()
Get constants (in TObjects) for database update from last execution.
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
Definition: Database.cc:141

◆ commit() [2/2]

bool commit ( std::list< Database::DBImportQuery payloads)
inherited

Submit constants from a (potentially previous) set of payloads.

Definition at line 311 of file CalibrationAlgorithm.cc.

312{
313 if (payloads.empty())
314 return false;
315 return Database::Instance().storeData(payloads);
316}

◆ convertPyExpRun()

ExpRun convertPyExpRun ( PyObject *  pyObj)
inherited

Performs the conversion of PyObject to ExpRun.

Converts the PyObject to an ExpRun. We've preoviously checked the object so this assumes a lot about the PyObject.

Definition at line 70 of file CalibrationAlgorithm.cc.

71{
72 ExpRun expRun;
73 PyObject* itemExp, *itemRun;
74 itemExp = PySequence_GetItem(pyObj, 0);
75 itemRun = PySequence_GetItem(pyObj, 1);
76 expRun.first = PyLong_AsLong(itemExp);
77 Py_DECREF(itemExp);
78 expRun.second = PyLong_AsLong(itemRun);
79 Py_DECREF(itemRun);
80 return expRun;
81}
Struct containing exp number and run number.
Definition: Splitter.h:51

◆ createHistograms()

void createHistograms ( )
private

Create histograms.

Hist declaration Global time distribution

Definition at line 174 of file KLMTimeAlgorithm.cc.

175{
176 if (m_mc) {
183 } else {
184 m_LowerTimeBoundaryRPC = -800.0;
185 m_UpperTimeBoundaryRPC = -600.0;
190
191 }
192 int nBin = 200;
193 int nBin_scint = 400;
194
195 TString iFstring[2] = {"Backward", "Forward"};
196 TString iPstring[2] = {"ZReadout", "PhiReadout"};
197 TString hn, ht;
198
199 h_diff = new TH1F("h_diff", "Position difference between bklmHit2d and extHit;position difference", 100, 0, 10);
200 h_calibrated = new TH1I("h_calibrated_summary", "h_calibrated_summary;calibrated or not", 3, 0, 3);
201 hc_calibrated = new TH1I("hc_calibrated_summary", "hc_calibrated_summary;calibrated or not", 3, 0, 3);
202
203 gre_time_channel_scint = new TGraphErrors();
204 gre_time_channel_rpc = new TGraphErrors();
205 gre_time_channel_scint_end = new TGraphErrors();
206
207 gr_timeShift_channel_scint = new TGraph();
208 gr_timeShift_channel_rpc = new TGraph();
209 gr_timeShift_channel_scint_end = new TGraph();
210
211 gre_ctime_channel_scint = new TGraphErrors();
212 gre_ctime_channel_rpc = new TGraphErrors();
213 gre_ctime_channel_scint_end = new TGraphErrors();
214
215 gr_timeRes_channel_scint = new TGraph();
216 gr_timeRes_channel_rpc = new TGraph();
217 gr_timeRes_channel_scint_end = new TGraph();
218
219 double maximalPhiStripLengthBKLM =
221 double maximalZStripLengthBKLM =
223 double maximalStripLengthEKLM =
225
226 m_ProfileRpcPhi = new TProfile("hprf_rpc_phi_effC",
227 "Time over propagation length for RPCs (Phi_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]", 400, 0.0,
228 400.0);
229 m_ProfileRpcZ = new TProfile("hprf_rpc_z_effC",
230 "Time over propagation length for RPCs (Z_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]", 400, 0.0,
231 400.0);
232 m_ProfileBKLMScintillatorPhi = new TProfile("hprf_scint_phi_effC",
233 "Time over propagation length for scintillators (Phi_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
234 200, 0.0, maximalPhiStripLengthBKLM);
235 m_ProfileBKLMScintillatorZ = new TProfile("hprf_scint_z_effC",
236 "Time over propagation length for scintillators (Z_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
237 200, 0.0, maximalZStripLengthBKLM);
238 m_ProfileEKLMScintillatorPlane1 = new TProfile("hprf_scint_plane1_effC_end",
239 "Time over propagation length for scintillators (plane1, Endcap); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
240 200, 0.0, maximalStripLengthEKLM);
241 m_ProfileEKLMScintillatorPlane2 = new TProfile("hprf_scint_plane2_effC_end",
242 "Time over propagation length for scintillators (plane2, Endcap); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
243 200, 0.0, maximalStripLengthEKLM);
244
245 m_Profile2RpcPhi = new TProfile("hprf2_rpc_phi_effC",
246 "Time over propagation length for RPCs (Phi_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]", 400, 0.0,
247 400.0);
248 m_Profile2RpcZ = new TProfile("hprf2_rpc_z_effC",
249 "Time over propagation length for RPCs (Z_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]", 400, 0.0,
250 400.0);
251 m_Profile2BKLMScintillatorPhi = new TProfile("hprf2_scint_phi_effC",
252 "Time over propagation length for scintillators (Phi_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
253 200, 0.0, maximalPhiStripLengthBKLM);
254 m_Profile2BKLMScintillatorZ = new TProfile("hprf2_scint_z_effC",
255 "Time over propagation length for scintillators (Z_Readout); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
256 200, 0.0, maximalZStripLengthBKLM);
257 m_Profile2EKLMScintillatorPlane1 = new TProfile("hprf2_scint_plane1_effC_end",
258 "Time over propagation length for scintillators (plane1, Endcap); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
259 200, 0.0, maximalStripLengthEKLM);
260 m_Profile2EKLMScintillatorPlane2 = new TProfile("hprf2_scint_plane2_effC_end",
261 "Time over propagation length for scintillators (plane2, Endcap); propagation distance[cm]; T_rec-T_0-T_fly-'T_calibration'[ns]",
262 200, 0.0, maximalStripLengthEKLM);
263
264 h_time_rpc_tc = new TH1F("h_time_rpc_tc", "time distribution for RPC", nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
265 h_time_scint_tc = new TH1F("h_time_scint_tc", "time distribution for Scintillator", nBin_scint,
267 h_time_scint_tc_end = new TH1F("h_time_scint_tc_end", "time distribution for Scintillator (Endcap)", nBin_scint,
270
272 h_time_rpc = new TH1F("h_time_rpc", "time distribution for RPC; T_rec-T_0-T_fly-T_propagation[ns]", nBin, m_LowerTimeBoundaryRPC,
274 h_time_scint = new TH1F("h_time_scint", "time distribution for Scintillator; T_rec-T_0-T_fly-T_propagation[ns]", nBin_scint,
276 h_time_scint_end = new TH1F("h_time_scint_end", "time distribution for Scintillator (Endcap); T_rec-T_0-T_fly-T_propagation[ns]",
278
279 hc_time_rpc = new TH1F("hc_time_rpc", "Calibrated time distribution for RPC; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
281 hc_time_scint = new TH1F("hc_time_scint",
282 "Calibrated time distribution for Scintillator; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", nBin_scint,
285 hc_time_scint_end = new TH1F("hc_time_scint_end",
286 "Calibrated time distribution for Scintillator (Endcap); T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", nBin_scint,
288
289 for (int iF = 0; iF < 2; ++iF) {
290 hn = Form("h_timeF%d_rpc", iF);
291 ht = Form("Time distribution for RPC of %s; T_rec-T_0-T_fly-T_propagation[ns]", iFstring[iF].Data());
292 h_timeF_rpc[iF] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
293 hn = Form("h_timeF%d_scint", iF);
294 ht = Form("Time distribution for Scintillator of %s; T_rec-T_0-T_fly-T_propagation[ns]", iFstring[iF].Data());
295 h_timeF_scint[iF] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
297 hn = Form("h_timeF%d_scint_end", iF);
298 ht = Form("Time distribution for Scintillator of %s (Endcap); T_rec-T_0-T_fly-T_propagation[ns]", iFstring[iF].Data());
299 h_timeF_scint_end[iF] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
301
302 hn = Form("h2_timeF%d_rpc", iF);
303 ht = Form("Time distribution for RPC of %s; Sector Index; T_rec-T_0-T_fly-T_propagation[ns]", iFstring[iF].Data());
304 h2_timeF_rpc[iF] = new TH2F(hn.Data(), ht.Data(), 8, 0, 8, nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
305 hn = Form("h2_timeF%d_scint", iF);
306 ht = Form("Time distribution for Scintillator of %s; Sector Index; T_rec-T_0-T_fly-T_propagation[ns]", iFstring[iF].Data());
307 h2_timeF_scint[iF] = new TH2F(hn.Data(), ht.Data(), 8, 0, 8, nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
309 hn = Form("h2_timeF%d_scint_end", iF);
310 ht = Form("Time distribution for Scintillator of %s (Endcap); Sector Index; T_rec-T_0-T_fly-T_propagation[ns]",
311 iFstring[iF].Data());
312 h2_timeF_scint_end[iF] = new TH2F(hn.Data(), ht.Data(), 4, 0, 4, nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
314
315 hn = Form("hc_timeF%d_rpc", iF);
316 ht = Form("Calibrated time distribution for RPC of %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", iFstring[iF].Data());
317 hc_timeF_rpc[iF] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryCalibratedRPC, m_UpperTimeBoundaryCalibratedRPC);
318 hn = Form("hc_timeF%d_scint", iF);
319 ht = Form("Calibrated time distribution for Scintillator of %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
320 iFstring[iF].Data());
321 hc_timeF_scint[iF] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
323 hn = Form("hc_timeF%d_scint_end", iF);
324 ht = Form("Calibrated time distribution for Scintillator of %s (Endcap); T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
325 iFstring[iF].Data());
326 hc_timeF_scint_end[iF] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsEKLM,
328
329 hn = Form("h2c_timeF%d_rpc", iF);
330 ht = Form("Calibrated time distribution for RPC of %s; Sector Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
331 iFstring[iF].Data());
332 h2c_timeF_rpc[iF] = new TH2F(hn.Data(), ht.Data(), 8, 0, 8, nBin, m_LowerTimeBoundaryCalibratedRPC,
334 hn = Form("h2c_timeF%d_scint", iF);
335 ht = Form("Calibrated time distribution for Scintillator of %s; Sector Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
336 iFstring[iF].Data());
337 h2c_timeF_scint[iF] = new TH2F(hn.Data(), ht.Data(), 8, 0, 8, nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
339 hn = Form("h2c_timeF%d_scint_end", iF);
340 ht = Form("Calibrated time distribution for Scintillator of %s (Endcap) ; Sector Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
341 iFstring[iF].Data());
342 h2c_timeF_scint_end[iF] = new TH2F(hn.Data(), ht.Data(), 4, 0, 4, nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsEKLM,
344
345 for (int iS = 0; iS < 8; ++iS) {
346 // Barrel parts
347 hn = Form("h_timeF%d_S%d_scint", iF, iS);
348 ht = Form("Time distribution for Scintillator of Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iS, iFstring[iF].Data());
349 h_timeFS_scint[iF][iS] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
351 hn = Form("h_timeF%d_S%d_rpc", iF, iS);
352 ht = Form("Time distribution for RPC of Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iS, iFstring[iF].Data());
353 h_timeFS_rpc[iF][iS] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
354 hn = Form("h2_timeF%d_S%d", iF, iS);
355 ht = Form("Time distribution of Sector%d, %s; Layer Index; T_rec-T_0-T_fly-T_propagation[ns]", iS, iFstring[iF].Data());
356 h2_timeFS[iF][iS] = new TH2F(hn.Data(), ht.Data(), 15, 0, 15, nBin_scint, m_LowerTimeBoundaryRPC,
358
359 hn = Form("hc_timeF%d_S%d_scint", iF, iS);
360 ht = Form("Calibrated time distribution for Scintillator of Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", iS,
361 iFstring[iF].Data());
362 hc_timeFS_scint[iF][iS] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
364 hn = Form("hc_timeF%d_S%d_rpc", iF, iS);
365 ht = Form("Calibrated time distribution for RPC of Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", iS,
366 iFstring[iF].Data());
367 hc_timeFS_rpc[iF][iS] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedRPC,
369 hn = Form("h2c_timeF%d_S%d", iF, iS);
370 ht = Form("Calibrated time distribution of Sector%d, %s; Layer Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", iS,
371 iFstring[iF].Data());
372 h2c_timeFS[iF][iS] = new TH2F(hn.Data(), ht.Data(), 15, 0, 15, nBin_scint, m_LowerTimeBoundaryCalibratedRPC,
374
375 // Inner 2 layers --> Scintillators
376 for (int iL = 0; iL < 2; ++iL) {
377 hn = Form("h_timeF%d_S%d_L%d", iF, iS, iL);
378 ht = Form("Time distribution for Scintillator of Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iL, iS,
379 iFstring[iF].Data());
380 h_timeFSL[iF][iS][iL] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
382 hn = Form("hc_timeF%d_S%d_L%d", iF, iS, iL);
383 ht = Form("Calibrated time distribution for Scintillator of Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
384 iL, iS, iFstring[iF].Data());
385 hc_timeFSL[iF][iS][iL] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
387
388 for (int iP = 0; iP < 2; ++iP) {
389 hn = Form("h_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
390 ht = Form("Time distribution for Scintillator of %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]",
391 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
392 h_timeFSLP[iF][iS][iL][iP] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
394 hn = Form("h2_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
395 ht = Form("Time distribution for Scintillator of %s, Layer%d, Sector%d, %s; Channel Index; T_rec-T_0-T_fly-T_propagation[ns]",
396 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
397 h2_timeFSLP[iF][iS][iL][iP] = new TH2F(hn.Data(), ht.Data(), 54, 0, 54, nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
399
400 hn = Form("hc_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
401 ht = Form("Calibrated time distribution for Scintillator of %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
402 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
403 hc_timeFSLP[iF][iS][iL][iP] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
405 hn = Form("h2c_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
406 ht = Form("Calibrated time distribution for Scintillator of %s, Layer%d, Sector%d, %s; Channel Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
407 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
408 h2c_timeFSLP[iF][iS][iL][iP] = new TH2F(hn.Data(), ht.Data(), 54, 0, 54, nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
410
411 int nchannel_max = BKLMElementNumbers::getNStrips(iF, iS + 1, iL + 1, iP);
412 for (int iC = 0; iC < nchannel_max; ++iC) {
413 hn = Form("h_timeF%d_S%d_L%d_P%d_C%d_tc", iF, iS, iL, iP, iC);
414 ht = Form("time distribution for Scintillator of Channel%d, %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iC,
415 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
416 h_timeFSLPC_tc[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
418
419 hn = Form("h_timeF%d_S%d_L%d_P%d_C%d", iF, iS, iL, iP, iC);
420 ht = Form("time distribution for Scintillator of Channel%d, %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iC,
421 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
422 h_timeFSLPC[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsBKLM,
424
425 hn = Form("hc_timeF%d_S%d_L%d_P%d_C%d", iF, iS, iL, iP, iC);
426 ht = Form("Calibrated time distribution for Scintillator of Channel%d, %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
427 iC, iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
428 hc_timeFSLPC[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsBKLM,
430 hn = Form("time_length_bklm_F%d_S%d_L%d_P%d_C%d", iF, iS, iL, iP, iC);
431 double stripLength = 200;
432 m_HistTimeLengthBKLM[iF][iS][iL][iP][iC] =
433 new TH2F(hn.Data(),
434 "Time versus propagation length; "
435 "propagation distance[cm]; "
436 "T_rec-T_0-T_fly-'T_calibration'[ns]",
437 200, 0.0, stripLength,
440 }
441 }
442 }
443
444 for (int iL = 2; iL < 15; ++iL) {
445 hn = Form("h_timeF%d_S%d_L%d", iF, iS, iL);
446 ht = Form("time distribution for RPC of Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iL, iS, iFstring[iF].Data());
447 h_timeFSL[iF][iS][iL] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
448
449 hn = Form("hc_timeF%d_S%d_L%d", iF, iS, iL);
450 ht = Form("Calibrated time distribution for RPC of Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]", iL, iS,
451 iFstring[iF].Data());
452 hc_timeFSL[iF][iS][iL] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryCalibratedRPC, m_UpperTimeBoundaryCalibratedRPC);
453
454 for (int iP = 0; iP < 2; ++iP) {
455 hn = Form("h_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
456 ht = Form("time distribution for RPC of %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iPstring[iP].Data(), iL, iS,
457 iFstring[iF].Data());
458 h_timeFSLP[iF][iS][iL][iP] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
459
460 hn = Form("h2_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
461 ht = Form("time distribution for RPC of %s, Layer%d, Sector%d, %s; Channel Index; T_rec-T_0-T_fly-T_propagation[ns]",
462 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
463 h2_timeFSLP[iF][iS][iL][iP] = new TH2F(hn.Data(), ht.Data(), 48, 0, 48, nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
464
465 hn = Form("hc_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
466 ht = Form("Calibrated time distribution for RPC of %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
467 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
468 hc_timeFSLP[iF][iS][iL][iP] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryCalibratedRPC,
470
471 hn = Form("h2c_timeF%d_S%d_L%d_P%d", iF, iS, iL, iP);
472 ht = Form("Calibrated time distribution for RPC of %s, Layer%d, Sector%d, %s; Channel Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
473 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
474 h2c_timeFSLP[iF][iS][iL][iP] = new TH2F(hn.Data(), ht.Data(), 48, 0, 48, nBin, m_LowerTimeBoundaryCalibratedRPC,
476
477 int nchannel_max = BKLMElementNumbers::getNStrips(iF, iS + 1, iL + 1, iP);
478 for (int iC = 0; iC < nchannel_max; ++iC) {
479 hn = Form("h_timeF%d_S%d_L%d_P%d_C%d_tc", iF, iS, iL, iP, iC);
480 ht = Form("Time distribution for RPC of Channel%d, %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iC,
481 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
482 h_timeFSLPC_tc[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
483
484 hn = Form("h_timeF%d_S%d_L%d_P%d_C%d", iF, iS, iL, iP, iC);
485 ht = Form("Time distribution for RPC of Channel%d, %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation[ns]", iC,
486 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
487 h_timeFSLPC[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryRPC, m_UpperTimeBoundaryRPC);
488
489 hn = Form("hc_timeF%d_S%d_L%d_P%d_C%d", iF, iS, iL, iP, iC);
490 ht = Form("Calibrated time distribution for RPC of Channel%d, %s, Layer%d, Sector%d, %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
491 iC, iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
492 hc_timeFSLPC[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin, m_LowerTimeBoundaryCalibratedRPC,
494 }
495 }
496 }
497 }
498 // Endcap part
499 int maxLay = 12 + 2 * iF;
500 for (int iS = 0; iS < 4; ++iS) {
501 hn = Form("h_timeF%d_S%d_scint_end", iF, iS);
502 ht = Form("Time distribution for Scintillator of Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation[ns]", iS,
503 iFstring[iF].Data());
504 h_timeFS_scint_end[iF][iS] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
506 hn = Form("h2_timeF%d_S%d_end", iF, iS);
507 ht = Form("Time distribution of Sector%d, %s (Endcap); Layer Index; T_rec-T_0-T_fly-T_propagation[ns]", iS, iFstring[iF].Data());
508 h2_timeFS_end[iF][iS] = new TH2F(hn.Data(), ht.Data(), maxLay, 0, maxLay, nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
510 hn = Form("hc_timeF%d_S%d_scint_end", iF, iS);
511 ht = Form("Calibrated time distribution for Scintillator of Sector%d (Endcap), %s; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
512 iS, iFstring[iF].Data());
513 hc_timeFS_scint_end[iF][iS] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsEKLM,
515 hn = Form("h2c_timeF%d_S%d_end", iF, iS);
516 ht = Form("Calibrated time distribution of Sector%d, %s (Endcap); Layer Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
517 iS, iFstring[iF].Data());
518 h2c_timeFS_end[iF][iS] = new TH2F(hn.Data(), ht.Data(), maxLay, 0, maxLay, nBin_scint,
521
522 for (int iL = 0; iL < maxLay; ++iL) {
523 hn = Form("h_timeF%d_S%d_L%d_end", iF, iS, iL);
524 ht = Form("Time distribution for Scintillator of Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation[ns]", iL, iS,
525 iFstring[iF].Data());
526 h_timeFSL_end[iF][iS][iL] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
528 hn = Form("hc_timeF%d_S%d_L%d_end", iF, iS, iL);
529 ht = Form("Calibrated time distribution for Scintillator of Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
530 iL, iS, iFstring[iF].Data());
531 hc_timeFSL_end[iF][iS][iL] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsEKLM,
533
534 for (int iP = 0; iP < 2; ++iP) {
535 hn = Form("h_timeF%d_S%d_L%d_P%d_end", iF, iS, iL, iP);
536 ht = Form("Time distribution for Scintillator of %s, Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation[ns]",
537 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
538 h_timeFSLP_end[iF][iS][iL][iP] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
540
541 hn = Form("h2_timeF%d_S%d_L%d_P%d_end", iF, iS, iL, iP);
542 ht = Form("Time distribution for Scintillator of %s, Layer%d, Sector%d, %s (Endcap); Channel Index; T_rec-T_0-T_fly-T_propagation[ns]",
543 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
544 h2_timeFSLP_end[iF][iS][iL][iP] = new TH2F(hn.Data(), ht.Data(), 75, 0, 75, nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
546
547 hn = Form("hc_timeF%d_S%d_L%d_P%d_end", iF, iS, iL, iP);
548 ht = Form("Calibrated time distribution for Scintillator of %s, Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
549 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
550 hc_timeFSLP_end[iF][iS][iL][iP] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsEKLM,
552
553 hn = Form("h2c_timeF%d_S%d_L%d_P%d_end", iF, iS, iL, iP);
554 ht = Form("Calibrated time distribution for Scintillator of %s, Layer%d, Sector%d, %s (Endcap); Channel Index; T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
555 iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
556 h2c_timeFSLP_end[iF][iS][iL][iP] = new TH2F(hn.Data(), ht.Data(), 75, 0, 75, nBin_scint,
559
560 for (int iC = 0; iC < 75; ++iC) {
561 hn = Form("h_timeF%d_S%d_L%d_P%d_C%d_tc_end", iF, iS, iL, iP, iC);
562 ht = Form("Time distribution for Scintillator of Channel%d, %s, Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation[ns]",
563 iC, iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
564 h_timeFSLPC_tc_end[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
566
567 hn = Form("h_timeF%d_S%d_L%d_P%d_C%d_end", iF, iS, iL, iP, iC);
568 ht = Form("Time distribution for Scintillator of Channel%d, %s, Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation[ns]",
569 iC, iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
570 h_timeFSLPC_end[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryScintillatorsEKLM,
572 hn = Form("hc_timeF%d_S%d_L%d_P%d_C%d_end", iF, iS, iL, iP, iC);
573 ht = Form("Calibrated time distribution for Scintillator of Channel%d, %s, Layer%d, Sector%d, %s (Endcap); T_rec-T_0-T_fly-T_propagation-T_calibration[ns]",
574 iC, iPstring[iP].Data(), iL, iS, iFstring[iF].Data());
575 hc_timeFSLPC_end[iF][iS][iL][iP][iC] = new TH1F(hn.Data(), ht.Data(), nBin_scint, m_LowerTimeBoundaryCalibratedScintillatorsEKLM,
577 hn = Form("time_length_eklm_F%d_S%d_L%d_P%d_C%d", iF, iS, iL, iP, iC);
578 double stripLength = m_EKLMGeometry->getStripLength(iC + 1) /
579 CLHEP::cm * Unit::cm;
580 m_HistTimeLengthEKLM[iF][iS][iL][iP][iC] =
581 new TH2F(hn.Data(),
582 "Time versus propagation length; "
583 "propagation distance[cm]; "
584 "T_rec-T_0-T_fly-'T_calibration'[ns]",
585 200, 0.0, stripLength,
588 }
589 }
590 }
591 }
592 }
593}
static int getNStrips(int section, int sector, int layer, int plane)
Get number of strips.
double getStripLength(int strip) const
Get strip length.
Definition: GeometryData.h:71
double getMaximalStripLength() const
Get maximal strip length.
Definition: GeometryData.h:79
TH2F * m_HistTimeLengthEKLM[2][4][14][2][75]
Two-dimensional distributions of time versus propagation length.
double m_UpperTimeBoundaryCalibratedRPC
Upper time boundary for RPC (calibrated data).
double m_UpperTimeBoundaryScintillatorsBKLM
Upper time boundary for BKLM scintillators.
const EKLM::GeometryData * m_EKLMGeometry
EKLM geometry data.
double m_UpperTimeBoundaryCalibratedScintillatorsEKLM
Upper time boundary for BKLM scintillators (calibrated data).
double m_UpperTimeBoundaryScintillatorsEKLM
Upper time boundary for BKLM scintillators.
double m_LowerTimeBoundaryCalibratedScintillatorsEKLM
Lower time boundary for EKLM scintillators (calibrated data).
const bklm::GeometryPar * m_BKLMGeometry
BKLM geometry data.
double m_UpperTimeBoundaryCalibratedScintillatorsBKLM
Upper time boundary for BKLM scintillators (calibrated data).
TH2F * m_HistTimeLengthBKLM[2][8][15][2][54]
Two-dimensional distributions of time versus propagation length.
double m_LowerTimeBoundaryScintillatorsBKLM
Lower time boundary for BKLM scintillators.
double m_LowerTimeBoundaryCalibratedScintillatorsBKLM
Lower time boundary for BKLM scintillators (calibrated data).
double m_LowerTimeBoundaryRPC
Lower time boundary for RPC.
double m_LowerTimeBoundaryCalibratedRPC
Lower time boundary for RPC (calibrated data).
double m_UpperTimeBoundaryRPC
Upper time boundary for RPC.
double m_LowerTimeBoundaryScintillatorsEKLM
Lower time boundary for EKLM scintillators.
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47
double getMaximalZStripLength() const
Get maximal Z strip length (for scintillators).
Definition: GeometryPar.h:289
double getMaximalPhiStripLength() const
Get maximal phi strip length (for scintillators).
Definition: GeometryPar.h:283

◆ dumpOutputJson()

const std::string dumpOutputJson ( ) const
inlineinherited

Dump the JSON string of the output JSON object.

Definition at line 223 of file CalibrationAlgorithm.h.

223{return m_jsonExecutionOutput.dump();}
nlohmann::json m_jsonExecutionOutput
Optional output JSON object that can be set during the execution by the underlying algorithm code.

◆ esti_timeRes()

double esti_timeRes ( const KLMChannelIndex klmChannel)

Estimate value of calibration constant for calibrated channels.

Parameters
[in]klmChannelKLM channel index.

Definition at line 1633 of file KLMTimeAlgorithm.cc.

1634{
1635 double tR = 0.0;
1636 int iSub = klmChannel.getSubdetector();
1637 int iF = klmChannel.getSection();
1638 int iS = klmChannel.getSector();
1639 int iL = klmChannel.getLayer();
1640 int iP = klmChannel.getPlane();
1641 int iC = klmChannel.getStrip();
1643 if (iSub == KLMElementNumbers::c_BKLM)
1644 totNStrips = BKLMElementNumbers::getNStrips(iF, iS, iL, iP);
1645 if (iC == 1) {
1646 KLMChannelIndex kCIndex_upper(iSub, iF, iS, iL, iP, iC + 1);
1647 tR = tR_upperStrip(kCIndex_upper).second;
1648 } else if (iC == totNStrips) {
1649 KLMChannelIndex kCIndex_lower(iSub, iF, iS, iL, iP, iC - 1);
1650 tR = tR_lowerStrip(kCIndex_lower).second;
1651 } else {
1652 KLMChannelIndex kCIndex_upper(iSub, iF, iS, iL, iP, iC + 1);
1653 KLMChannelIndex kCIndex_lower(iSub, iF, iS, iL, iP, iC - 1);
1654 std::pair<int, double> tR_upper = tR_upperStrip(kCIndex_upper);
1655 std::pair<int, double> tR_lower = tR_lowerStrip(kCIndex_lower);
1656 unsigned int tr_upper = tR_upper.first - iC;
1657 unsigned int tr_lower = iC - tR_lower.first;
1658 unsigned int tr = tR_upper.first - tR_lower.first;
1659 tR = (double(tr_upper) * tR_lower.second + double(tr_lower) * tR_upper.second) / double(tr);
1660 }
1661 return tR;
1662}
static constexpr int getMaximalStripNumber()
Get maximal strip number.
int getSubdetector() const
Get subdetector.
int getLayer() const
Get layer.
int getSection() const
Get section.
int getPlane() const
Get plane.
int getStrip() const
Get strip.
int getSector() const
Get sector.
std::pair< int, double > tR_upperStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with increasing strip number.
std::pair< int, double > tR_lowerStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with decreasing strip number.

◆ esti_timeShift()

double esti_timeShift ( const KLMChannelIndex klmChannel)

Estimate value of calibration constant for uncalibrated channels.

Parameters
[in]klmChannelKLM channel index.

Definition at line 1553 of file KLMTimeAlgorithm.cc.

1554{
1555 double tS = 0.0;
1556 int iSub = klmChannel.getSubdetector();
1557 int iF = klmChannel.getSection();
1558 int iS = klmChannel.getSector();
1559 int iL = klmChannel.getLayer();
1560 int iP = klmChannel.getPlane();
1561 int iC = klmChannel.getStrip();
1563 if (iSub == KLMElementNumbers::c_BKLM)
1564 totNStrips = BKLMElementNumbers::getNStrips(iF, iS, iL, iP);
1565 if (iC == 1) {
1566 KLMChannelIndex kCIndex_upper(iSub, iF, iS, iL, iP, iC + 1);
1567 tS = tS_upperStrip(kCIndex_upper).second;
1568 } else if (iC == totNStrips) {
1569 KLMChannelIndex kCIndex_lower(iSub, iF, iS, iL, iP, iC - 1);
1570 tS = tS_lowerStrip(kCIndex_lower).second;
1571 } else {
1572 KLMChannelIndex kCIndex_upper(iSub, iF, iS, iL, iP, iC + 1);
1573 KLMChannelIndex kCIndex_lower(iSub, iF, iS, iL, iP, iC - 1);
1574 std::pair<int, double> tS_upper = tS_upperStrip(kCIndex_upper);
1575 std::pair<int, double> tS_lower = tS_lowerStrip(kCIndex_lower);
1576 unsigned int td_upper = tS_upper.first - iC;
1577 unsigned int td_lower = iC - tS_lower.first;
1578 unsigned int td = tS_upper.first - tS_lower.first;
1579 tS = (double(td_upper) * tS_lower.second + double(td_lower) * tS_upper.second) / double(td);
1580 }
1581 return tS;
1582}
std::pair< int, double > tS_upperStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with increasing strip number.
std::pair< int, double > tS_lowerStrip(const KLMChannelIndex &klmChannel)
Tracing available channels with decreasing strip number.

◆ execute() [1/2]

CalibrationAlgorithm::EResult execute ( PyObject *  runs,
int  iteration = 0,
IntervalOfValidity  iov = IntervalOfValidity() 
)
inherited

Runs calibration over Python list of runs. Converts to C++ and then calls the other execute() function.

Definition at line 83 of file CalibrationAlgorithm.cc.

84{
85 B2DEBUG(29, "Running execute() using Python Object as input argument");
86 // Reset the execution specific data in case the algorithm was previously called
87 m_data.reset();
88 m_data.setIteration(iteration);
89 vector<ExpRun> vecRuns;
90 // Is it a list?
91 if (PySequence_Check(runs)) {
92 boost::python::handle<> handle(boost::python::borrowed(runs));
93 boost::python::list listRuns(handle);
94
95 int nList = boost::python::len(listRuns);
96 for (int iList = 0; iList < nList; ++iList) {
97 boost::python::object pyExpRun(listRuns[iList]);
98 if (!checkPyExpRun(pyExpRun.ptr())) {
99 B2ERROR("Received Python ExpRuns couldn't be converted to C++");
101 return c_Failure;
102 } else {
103 vecRuns.push_back(convertPyExpRun(pyExpRun.ptr()));
104 }
105 }
106 } else {
107 B2ERROR("Tried to set the input runs but we didn't receive a Python sequence object (list,tuple).");
109 return c_Failure;
110 }
111 return execute(vecRuns, iteration, iov);
112}
void setResult(EResult result)
Setter for current iteration.
void setIteration(int iteration)
Setter for current iteration.
void reset()
Resets this class back to what is needed at the beginning of an execution.
bool checkPyExpRun(PyObject *pyObj)
Checks that a PyObject can be successfully converted to an ExpRun type.
EResult execute(std::vector< Calibration::ExpRun > runs={}, int iteration=0, IntervalOfValidity iov=IntervalOfValidity())
Runs calibration over vector of runs for a given iteration.
Calibration::ExpRun convertPyExpRun(PyObject *pyObj)
Performs the conversion of PyObject to ExpRun.

◆ execute() [2/2]

CalibrationAlgorithm::EResult execute ( std::vector< Calibration::ExpRun >  runs = {},
int  iteration = 0,
IntervalOfValidity  iov = IntervalOfValidity() 
)
inherited

Runs calibration over vector of runs for a given iteration.

You can also specify the IoV to save the database payload as. By default the Algorithm will create an IoV from your requested ExpRuns, or from the overall ExpRuns of the input data if you haven't specified ExpRuns in this function.

No checks are performed to make sure that a IoV you specify matches the data you ran over, it simply labels the IoV to commit to the database later.

Definition at line 114 of file CalibrationAlgorithm.cc.

115{
116 // Check if we are calling this function directly and need to reset, or through Python where it was already done.
117 if (m_data.getResult() != c_Undefined) {
118 m_data.reset();
119 m_data.setIteration(iteration);
120 }
121
122 if (m_inputFileNames.empty()) {
123 B2ERROR("There aren't any input files set. Please use CalibrationAlgorithm::setInputFiles()");
125 return c_Failure;
126 }
127
128 // Did we receive runs to execute over explicitly?
129 if (!(runs.empty())) {
130 for (auto expRun : runs) {
131 B2DEBUG(29, "ExpRun requested = (" << expRun.first << ", " << expRun.second << ")");
132 }
133 // We've asked explicitly for certain runs, but we should check if the data granularity is 'run'
134 if (strcmp(getGranularity().c_str(), "all") == 0) {
135 B2ERROR(("The data is collected with granularity=all (exp=-1,run=-1), but you seem to request calibration for specific runs."
136 " We'll continue but using ALL the input data given instead of the specific runs requested."));
137 }
138 } else {
139 // If no runs are provided, infer the runs from all collected data
140 runs = getRunListFromAllData();
141 // Let's check that we have some now
142 if (runs.empty()) {
143 B2ERROR("No collected data in input files.");
145 return c_Failure;
146 }
147 for (auto expRun : runs) {
148 B2DEBUG(29, "ExpRun requested = (" << expRun.first << ", " << expRun.second << ")");
149 }
150 }
151
153 if (iov.empty()) {
154 // If no user specified IoV we use the IoV from the executed run list
155 iov = IntervalOfValidity(runs[0].first, runs[0].second, runs[runs.size() - 1].first, runs[runs.size() - 1].second);
156 }
158 // After here, the getObject<...>(...) helpers start to work
159
161 m_data.setResult(result);
162 return result;
163}
void setRequestedIov(const IntervalOfValidity &iov=IntervalOfValidity(0, 0, -1, -1))
Sets the requested IoV for this execution, based on the.
void setRequestedRuns(const std::vector< Calibration::ExpRun > &requestedRuns)
Sets the vector of ExpRuns.
EResult getResult() const
Getter for current result.
std::vector< Calibration::ExpRun > getRunListFromAllData() const
Get the complete list of runs from inspection of collected data.
std::vector< std::string > m_inputFileNames
List of input files to the Algorithm, will initially be user defined but then gets the wildcards expa...
virtual EResult calibrate()=0
Run algo on data - pure virtual: needs to be implemented.
std::string getGranularity() const
Get the granularity of collected data.
A class that describes the interval of experiments/runs for which an object in the database is valid.

◆ fillRunToInputFilesMap()

void fillRunToInputFilesMap ( )
inherited

Fill the mapping of ExpRun -> Files.

Definition at line 330 of file CalibrationAlgorithm.cc.

331{
332 m_runsToInputFiles.clear();
333 // Save TDirectory to change back at the end
334 TDirectory* dir = gDirectory;
335 RunRange* runRange;
336 // Construct the TDirectory name where we expect our objects to be
337 string runRangeObjName(getPrefix() + "/" + RUN_RANGE_OBJ_NAME);
338 for (const auto& fileName : m_inputFileNames) {
339 //Open TFile to get the objects
340 unique_ptr<TFile> f;
341 f.reset(TFile::Open(fileName.c_str(), "READ"));
342 runRange = dynamic_cast<RunRange*>(f->Get(runRangeObjName.c_str()));
343 if (runRange) {
344 // Insert or extend the run -> file mapping for this ExpRun
345 auto expRuns = runRange->getExpRunSet();
346 for (const auto& expRun : expRuns) {
347 auto runFiles = m_runsToInputFiles.find(expRun);
348 if (runFiles != m_runsToInputFiles.end()) {
349 (runFiles->second).push_back(fileName);
350 } else {
351 m_runsToInputFiles.insert(std::make_pair(expRun, std::vector<std::string> {fileName}));
352 }
353 }
354 } else {
355 B2WARNING("Missing a RunRange object for file: " << fileName);
356 }
357 }
358 dir->cd();
359}
std::string getPrefix() const
Get the prefix used for getting calibration data.
std::map< Calibration::ExpRun, std::vector< std::string > > m_runsToInputFiles
Map of Runs to input files. Gets filled when you call getRunRangeFromAllData, gets cleared when setti...
Mergeable object holding (unique) set of (exp,run) pairs.
Definition: RunRange.h:25
const std::set< Calibration::ExpRun > & getExpRunSet()
Get access to the stored set.
Definition: RunRange.h:64

◆ fillTimeDistanceProfiles()

void fillTimeDistanceProfiles ( TProfile *  profileRpcPhi,
TProfile *  profileRpcZ,
TProfile *  profileBKLMScintillatorPhi,
TProfile *  profileBKLMScintillatorZ,
TProfile *  profileEKLMScintillatorPlane1,
TProfile *  profileEKLMScintillatorPlane2,
bool  fill2dHistograms 
)
private

Fill profiles of time versus distance.

Parameters
[out]profileRpcPhiBKLM RPC phi plane.
[out]profileRpcZBKLM RPC z plane.
[out]profileBKLMScintillatorPhiBKLM scintillator phi plane.
[out]profileBKLMScintillatorZBKLM scintillator z plane.
[out]profileEKLMScintillatorPlane1EKLM scintillator plane1.
[out]profileEKLMScintillatorPlane2EKLM scintillator plane2.
[in]fill2dHistogramsWhether to fill 2d histograms.

Definition at line 595 of file KLMTimeAlgorithm.cc.

600{
601 for (KLMChannelIndex klmChannel = m_klmChannels.begin(); klmChannel != m_klmChannels.end(); ++klmChannel) {
602 KLMChannelNumber channel = klmChannel.getKLMChannelNumber();
603 if (m_cFlag[channel] == ChannelCalibrationStatus::c_NotEnoughData)
604 continue;
605
606 std::vector<struct Event>::iterator it;
607 std::vector<struct Event> eventsChannel;
608 eventsChannel = m_evts[channel];
609 int iSub = klmChannel.getSubdetector();
610
611 for (it = eventsChannel.begin(); it != eventsChannel.end(); ++it) {
612 double timeHit = it->time() - m_timeShift[channel];
613 if (m_useEventT0)
614 timeHit = timeHit - it->t0;
615 double distHit = it->dist;
616
617 if (iSub == KLMElementNumbers::c_BKLM) {
618 int iF = klmChannel.getSection();
619 int iS = klmChannel.getSector() - 1;
620 int iL = klmChannel.getLayer() - 1;
621 int iP = klmChannel.getPlane();
622 int iC = klmChannel.getStrip() - 1;
623 if (iL > 1) {
624 if (iP) {
625 profileRpcPhi->Fill(distHit, timeHit);
626 } else {
627 profileRpcZ->Fill(distHit, timeHit);
628 }
629 } else {
630 if (fill2dHistograms)
631 m_HistTimeLengthBKLM[iF][iS][iL][iP][iC]->Fill(distHit, timeHit);
632 if (iP) {
633 profileBKLMScintillatorPhi->Fill(distHit, timeHit);
634 } else {
635 profileBKLMScintillatorZ->Fill(distHit, timeHit);
636 }
637 }
638 } else {
639 int iF = klmChannel.getSection() - 1;
640 int iS = klmChannel.getSector() - 1;
641 int iL = klmChannel.getLayer() - 1;
642 int iP = klmChannel.getPlane() - 1;
643 int iC = klmChannel.getStrip() - 1;
644 if (fill2dHistograms)
645 m_HistTimeLengthEKLM[iF][iS][iL][iP][iC]->Fill(distHit, timeHit);
646 if (iP) {
647 profileEKLMScintillatorPlane1->Fill(distHit, timeHit);
648 } else {
649 profileEKLMScintillatorPlane2->Fill(distHit, timeHit);
650 }
651 }
652 }
653 }
654}

◆ findPayloadBoundaries()

const std::vector< ExpRun > findPayloadBoundaries ( std::vector< Calibration::ExpRun >  runs,
int  iteration = 0 
)
inherited

Used to discover the ExpRun boundaries that you want the Python CAF to execute on. This is optional and only used in some.

Definition at line 520 of file CalibrationAlgorithm.cc.

521{
522 m_boundaries.clear();
523 if (m_inputFileNames.empty()) {
524 B2ERROR("There aren't any input files set. Please use CalibrationAlgorithm::setInputFiles()");
525 return m_boundaries;
526 }
527 // Reset the internal execution data just in case something is hanging around
528 m_data.reset();
529 if (runs.empty()) {
530 // Want to loop over all runs we could possibly know about
531 runs = getRunListFromAllData();
532 }
533 // Let's check that we have some now
534 if (runs.empty()) {
535 B2ERROR("No collected data in input files.");
536 return m_boundaries;
537 }
538 // In order to find run boundaries we must have collected with data granularity == 'run'
539 if (strcmp(getGranularity().c_str(), "all") == 0) {
540 B2ERROR("The data is collected with granularity='all' (exp=-1,run=-1), and we can't use that to find run boundaries.");
541 return m_boundaries;
542 }
543 m_data.setIteration(iteration);
544 // User defined setup function
545 boundaryFindingSetup(runs, iteration);
546 std::vector<ExpRun> runList;
547 // Loop over run list and call derived class "isBoundaryRequired" member function
548 for (auto currentRun : runs) {
549 runList.push_back(currentRun);
550 m_data.setRequestedRuns(runList);
551 // After here, the getObject<...>(...) helpers start to work
552 if (isBoundaryRequired(currentRun)) {
553 m_boundaries.push_back(currentRun);
554 }
555 // Only want run-by-run
556 runList.clear();
557 // Don't want memory hanging around
559 }
560 m_data.reset();
562 return m_boundaries;
563}
std::vector< Calibration::ExpRun > m_boundaries
When using the boundaries functionality from isBoundaryRequired, this is used to store the boundaries...
virtual void boundaryFindingTearDown()
Put your algorithm back into a state ready for normal execution if you need to.
virtual void boundaryFindingSetup(std::vector< Calibration::ExpRun >, int)
If you need to make some changes to your algorithm class before 'findPayloadBoundaries' is run,...
virtual bool isBoundaryRequired(const Calibration::ExpRun &)
Given the current collector data, make a decision about whether or not this run should be the start o...

◆ getAllGranularityExpRun()

Calibration::ExpRun getAllGranularityExpRun ( ) const
inlineprotectedinherited

Returns the Exp,Run pair that means 'Everything'. Currently unused.

Definition at line 327 of file CalibrationAlgorithm.h.

327{return m_allExpRun;}
static const Calibration::ExpRun m_allExpRun
allExpRun

◆ getCollectorName()

std::string getCollectorName ( ) const
inlineinherited

Alias for prefix.

For convenience and less writing, we say developers to set this to default collector module name in constructor of base class. One can however use the dublets of collector+algorithm multiple times with different settings. To bind these together correctly, the prefix has to be set the same for algo and collector. So we call the setter setPrefix rather than setModuleName or whatever. This getter will work out of the box for default cases -> return the name of module you have to add to your path to collect data for this algorihtm.

Definition at line 164 of file CalibrationAlgorithm.h.

164{return getPrefix();}

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Get the description of the algoithm (set by developers in constructor)

Definition at line 216 of file CalibrationAlgorithm.h.

216{return m_description;}
std::string m_description
Description of the algorithm.

◆ getExpRunString()

string getExpRunString ( Calibration::ExpRun &  expRun) const
privateinherited

Gets the "exp.run" string repr. of (exp,run)

Definition at line 254 of file CalibrationAlgorithm.cc.

255{
256 string expRunString;
257 expRunString += to_string(expRun.first);
258 expRunString += ".";
259 expRunString += to_string(expRun.second);
260 return expRunString;
261}

◆ getFullObjectPath()

string getFullObjectPath ( const std::string &  name,
Calibration::ExpRun  expRun 
) const
privateinherited

constructs the full TDirectory + Key name of an object in a TFile based on its name and exprun

Definition at line 263 of file CalibrationAlgorithm.cc.

264{
265 string dirName = getPrefix() + "/" + name;
266 string objName = name + "_" + getExpRunString(expRun);
267 return dirName + "/" + objName;
268}
std::string getExpRunString(Calibration::ExpRun &expRun) const
Gets the "exp.run" string repr. of (exp,run)

◆ getGranularity()

std::string getGranularity ( ) const
inlineinherited

Get the granularity of collected data.

Definition at line 188 of file CalibrationAlgorithm.h.

188{return m_granularityOfData;};
std::string m_granularityOfData
Granularity of input data. This only changes when the input files change so it isn't specific to an e...

◆ getGranularityFromData()

string getGranularityFromData ( ) const
protectedinherited

Get the granularity of collected data.

Definition at line 383 of file CalibrationAlgorithm.cc.

384{
385 // Save TDirectory to change back at the end
386 TDirectory* dir = gDirectory;
387 RunRange* runRange;
388 string runRangeObjName(getPrefix() + "/" + RUN_RANGE_OBJ_NAME);
389 // We only check the first file
390 string fileName = m_inputFileNames[0];
391 unique_ptr<TFile> f;
392 f.reset(TFile::Open(fileName.c_str(), "READ"));
393 runRange = dynamic_cast<RunRange*>(f->Get(runRangeObjName.c_str()));
394 if (!runRange) {
395 B2FATAL("The input file " << fileName << " does not contain a RunRange object at "
396 << runRangeObjName << ". Please set your input files to exclude it.");
397 return "";
398 }
399 string granularity = runRange->getGranularity();
400 dir->cd();
401 return granularity;
402}
std::string getGranularity() const
Gets the m_granularity.
Definition: RunRange.h:110

◆ getInputFileNames()

PyObject * getInputFileNames ( )
inherited

Get the input file names used for this algorithm and pass them out as a Python list of unicode strings.

Definition at line 245 of file CalibrationAlgorithm.cc.

246{
247 PyObject* objInputFileNames = PyList_New(m_inputFileNames.size());
248 for (size_t i = 0; i < m_inputFileNames.size(); ++i) {
249 PyList_SetItem(objInputFileNames, i, Py_BuildValue("s", m_inputFileNames[i].c_str()));
250 }
251 return objInputFileNames;
252}

◆ getInputJsonObject()

const nlohmann::json & getInputJsonObject ( ) const
inlineprotectedinherited

Get the entire top level JSON object. We explicitly say this must be of object type so that we might pick.

Definition at line 357 of file CalibrationAlgorithm.h.

357{return m_jsonExecutionInput;}
nlohmann::json m_jsonExecutionInput
Optional input JSON object used to make decisions about how to execute the algorithm code.

◆ getInputJsonValue()

const T getInputJsonValue ( const std::string &  key) const
inlineprotectedinherited

Get an input JSON value using a key. The normal exceptions are raised when the key doesn't exist.

Definition at line 350 of file CalibrationAlgorithm.h.

351 {
352 return m_jsonExecutionInput.at(key);
353 }

◆ getIovFromAllData()

IntervalOfValidity getIovFromAllData ( ) const
inherited

Get the complete IoV from inspection of collected data.

Definition at line 325 of file CalibrationAlgorithm.cc.

326{
328}
RunRange getRunRangeFromAllData() const
Get the complete RunRange from inspection of collected data.
IntervalOfValidity getIntervalOfValidity()
Make IntervalOfValidity from the set, spanning all runs. Works because sets are sorted by default.
Definition: RunRange.h:70

◆ getIteration()

int getIteration ( ) const
inlineprotectedinherited

Get current iteration.

Definition at line 269 of file CalibrationAlgorithm.h.

269{ return m_data.getIteration(); }
int getIteration() const
Getter for current iteration.

◆ getObjectPtr()

std::shared_ptr< T > getObjectPtr ( std::string  name)
inlineprotectedinherited

Get calibration data object (for all runs the calibration is requested for) This function will only work during or after execute() has been called once.

Definition at line 285 of file CalibrationAlgorithm.h.

286 {
287 if (m_runsToInputFiles.size() == 0)
289 return getObjectPtr<T>(name, m_data.getRequestedRuns());
290 }
const std::vector< Calibration::ExpRun > & getRequestedRuns() const
Returns the vector of ExpRuns.
void fillRunToInputFilesMap()
Fill the mapping of ExpRun -> Files.

◆ getOutputJsonValue()

const T getOutputJsonValue ( const std::string &  key) const
inlineprotectedinherited

Get a value using a key from the JSON output object, not sure why you would want to do this.

Definition at line 342 of file CalibrationAlgorithm.h.

343 {
344 return m_jsonExecutionOutput.at(key);
345 }

◆ getPayloads()

std::list< Database::DBImportQuery > & getPayloads ( )
inlineinherited

Get constants (in TObjects) for database update from last execution.

Definition at line 204 of file CalibrationAlgorithm.h.

204{return m_data.getPayloads();}
std::list< Database::DBImportQuery > & getPayloads()
Get constants (in TObjects) for database update from last calibration.

◆ getPayloadValues()

std::list< Database::DBImportQuery > getPayloadValues ( )
inlineinherited

Get constants (in TObjects) for database update from last execution but passed by VALUE.

Definition at line 207 of file CalibrationAlgorithm.h.

207{return m_data.getPayloadValues();}
std::list< Database::DBImportQuery > getPayloadValues()
Get constants (in TObjects) for database update from last calibration but passed by VALUE.

◆ getPrefix()

std::string getPrefix ( ) const
inlineinherited

Get the prefix used for getting calibration data.

Definition at line 146 of file CalibrationAlgorithm.h.

146{return m_prefix;}
std::string m_prefix
The name of the TDirectory the collector objects are contained within.

◆ getRunList()

const std::vector< Calibration::ExpRun > & getRunList ( ) const
inlineprotectedinherited

Get the list of runs for which calibration is called.

Definition at line 266 of file CalibrationAlgorithm.h.

266{return m_data.getRequestedRuns();}

◆ getRunListFromAllData()

vector< ExpRun > getRunListFromAllData ( ) const
inherited

Get the complete list of runs from inspection of collected data.

Definition at line 318 of file CalibrationAlgorithm.cc.

319{
320 RunRange runRange = getRunRangeFromAllData();
321 set<ExpRun> expRunSet = runRange.getExpRunSet();
322 return vector<ExpRun>(expRunSet.begin(), expRunSet.end());
323}

◆ getRunRangeFromAllData()

RunRange getRunRangeFromAllData ( ) const
inherited

Get the complete RunRange from inspection of collected data.

Definition at line 361 of file CalibrationAlgorithm.cc.

362{
363 // Save TDirectory to change back at the end
364 TDirectory* dir = gDirectory;
365 RunRange runRange;
366 // Construct the TDirectory name where we expect our objects to be
367 string runRangeObjName(getPrefix() + "/" + RUN_RANGE_OBJ_NAME);
368 for (const auto& fileName : m_inputFileNames) {
369 //Open TFile to get the objects
370 unique_ptr<TFile> f;
371 f.reset(TFile::Open(fileName.c_str(), "READ"));
372 RunRange* runRangeOther = dynamic_cast<RunRange*>(f->Get(runRangeObjName.c_str()));
373 if (runRangeOther) {
374 runRange.merge(runRangeOther);
375 } else {
376 B2WARNING("Missing a RunRange object for file: " << fileName);
377 }
378 }
379 dir->cd();
380 return runRange;
381}
virtual void merge(const RunRange *other)
Implementation of merging - other is added to the set (union)
Definition: RunRange.h:52

◆ getVecInputFileNames()

std::vector< std::string > getVecInputFileNames ( ) const
inlineprotectedinherited

Get the input file names used for this algorithm as a STL vector.

Definition at line 275 of file CalibrationAlgorithm.h.

275{return m_inputFileNames;}

◆ inputJsonKeyExists()

bool inputJsonKeyExists ( const std::string &  key) const
inlineprotectedinherited

Test for a key in the input JSON object.

Definition at line 360 of file CalibrationAlgorithm.h.

360{return m_jsonExecutionInput.count(key);}

◆ isBoundaryRequired()

virtual bool isBoundaryRequired ( const Calibration::ExpRun &  )
inlineprotectedvirtualinherited

Given the current collector data, make a decision about whether or not this run should be the start of a payload boundary.

Reimplemented in TestBoundarySettingAlgorithm, PXDAnalyticGainCalibrationAlgorithm, PXDValidationAlgorithm, TestCalibrationAlgorithm, SVD3SampleCoGTimeCalibrationAlgorithm, SVD3SampleELSTimeCalibrationAlgorithm, and SVDCoGTimeCalibrationAlgorithm.

Definition at line 243 of file CalibrationAlgorithm.h.

244 {
245 B2ERROR("You didn't implement a isBoundaryRequired() member function in your CalibrationAlgorithm but you are calling it!");
246 return false;
247 }

◆ loadInputJson()

bool loadInputJson ( const std::string &  jsonString)
inherited

Load the m_inputJson variable from a string (useful from Python interface). The rturn bool indicates success or failure.

Definition at line 502 of file CalibrationAlgorithm.cc.

503{
504 try {
505 auto jsonInput = nlohmann::json::parse(jsonString);
506 // Input string has an object (dict) as the top level object?
507 if (jsonInput.is_object()) {
508 m_jsonExecutionInput = jsonInput;
509 return true;
510 } else {
511 B2ERROR("JSON input string isn't an object type i.e. not a '{}' at the top level.");
512 return false;
513 }
514 } catch (nlohmann::json::parse_error&) {
515 B2ERROR("Parsing of JSON input string failed");
516 return false;
517 }
518}

◆ readCalibrationData()

CalibrationAlgorithm::EResult readCalibrationData ( )
private

Read calibration data.

Returns
CalibrationAlgorithm::c_OK if the amount of data is sufficient, CalibrationAlgorithm::c_NotEnoughData otherwise.

Definition at line 141 of file KLMTimeAlgorithm.cc.

142{
143 B2INFO("Read tree entries and separate events by module id.");
144 Event event;
145 std::shared_ptr<TTree> timeCalibrationData;
146 timeCalibrationData = getObjectPtr<TTree>("time_calibration_data");
147 timeCalibrationData->SetBranchAddress("t0", &event.t0);
148 timeCalibrationData->SetBranchAddress("flyTime", &event.flyTime);
149 timeCalibrationData->SetBranchAddress("recTime", &event.recTime);
150 timeCalibrationData->SetBranchAddress("dist", &event.dist);
151 timeCalibrationData->SetBranchAddress("diffDistX", &event.diffDistX);
152 timeCalibrationData->SetBranchAddress("diffDistY", &event.diffDistY);
153 timeCalibrationData->SetBranchAddress("diffDistZ", &event.diffDistZ);
154 timeCalibrationData->SetBranchAddress("eDep", &event.eDep);
155 timeCalibrationData->SetBranchAddress("nPE", &event.nPE);
156 timeCalibrationData->SetBranchAddress("channelId", &event.channelId);
157 timeCalibrationData->SetBranchAddress("inRPC", &event.inRPC);
158 timeCalibrationData->SetBranchAddress("isFlipped", &event.isFlipped);
159
160 B2INFO(LogVar("Total number of digits:", timeCalibrationData->GetEntries()));
161 m_evts.clear();
162
163 int n = timeCalibrationData->GetEntries();
164 if (n < m_MinimalDigitNumber)
166 for (int i = 0; i < n; ++i) {
167 timeCalibrationData->GetEntry(i);
168 m_evts[event.channelId].push_back(event);
169 }
170 B2INFO("Events packing finish.");
172}
int m_MinimalDigitNumber
Minimal digit number (total).

◆ resetInputJson()

void resetInputJson ( )
inlineprotectedinherited

Clears the m_inputJson member variable.

Definition at line 330 of file CalibrationAlgorithm.h.

330{m_jsonExecutionInput.clear();}

◆ resetOutputJson()

void resetOutputJson ( )
inlineprotectedinherited

Clears the m_outputJson member variable.

Definition at line 333 of file CalibrationAlgorithm.h.

333{m_jsonExecutionOutput.clear();}

◆ saveCalibration() [1/6]

void saveCalibration ( TClonesArray *  data,
const std::string &  name 
)
protectedinherited

Store DBArray payload with given name with default IOV.

Definition at line 297 of file CalibrationAlgorithm.cc.

298{
300}
const IntervalOfValidity & getRequestedIov() const
Getter for requested IOV.

◆ saveCalibration() [2/6]

void saveCalibration ( TClonesArray *  data,
const std::string &  name,
const IntervalOfValidity iov 
)
protectedinherited

Store DBArray with given name and custom IOV.

Definition at line 276 of file CalibrationAlgorithm.cc.

277{
278 B2DEBUG(29, "Saving calibration TClonesArray '" << name << "' to payloads list.");
279 getPayloads().emplace_back(name, data, iov);
280}

◆ saveCalibration() [3/6]

void saveCalibration ( TObject *  data)
protectedinherited

Store DB payload with default name and default IOV.

Definition at line 287 of file CalibrationAlgorithm.cc.

288{
289 saveCalibration(data, DataStore::objectName(data->IsA(), ""));
290}
static std::string objectName(const TClass *t, const std::string &name)
Return the storage name for an object of the given TClass and name.
Definition: DataStore.cc:151

◆ saveCalibration() [4/6]

void saveCalibration ( TObject *  data,
const IntervalOfValidity iov 
)
protectedinherited

Store DB payload with default name and custom IOV.

Definition at line 282 of file CalibrationAlgorithm.cc.

283{
284 saveCalibration(data, DataStore::objectName(data->IsA(), ""), iov);
285}

◆ saveCalibration() [5/6]

void saveCalibration ( TObject *  data,
const std::string &  name 
)
protectedinherited

Store DB payload with given name with default IOV.

Definition at line 292 of file CalibrationAlgorithm.cc.

293{
295}

◆ saveCalibration() [6/6]

void saveCalibration ( TObject *  data,
const std::string &  name,
const IntervalOfValidity iov 
)
protectedinherited

Store DB payload with given name and custom IOV.

Definition at line 270 of file CalibrationAlgorithm.cc.

271{
272 B2DEBUG(29, "Saving calibration TObject = '" << name << "' to payloads list.");
273 getPayloads().emplace_back(name, data, iov);
274}

◆ saveHist()

void saveHist ( )

Save histograms to file.

Definition at line 1376 of file KLMTimeAlgorithm.cc.

1377{
1378 m_outFile->cd();
1379 B2INFO("Save Histograms into Files.");
1380 TDirectory* dir_monitor = m_outFile->mkdir("monitor_Hists", "", true);
1381 dir_monitor->cd();
1382 h_calibrated->SetDirectory(dir_monitor);
1383 hc_calibrated->SetDirectory(dir_monitor);
1384 h_diff->SetDirectory(dir_monitor);
1385
1386 m_outFile->cd();
1387 TDirectory* dir_effC = m_outFile->mkdir("effC_Hists", "", true);
1388 dir_effC->cd();
1389 m_ProfileRpcPhi->SetDirectory(dir_effC);
1390 m_ProfileRpcZ->SetDirectory(dir_effC);
1391 m_ProfileBKLMScintillatorPhi->SetDirectory(dir_effC);
1392 m_ProfileBKLMScintillatorZ->SetDirectory(dir_effC);
1393 m_ProfileEKLMScintillatorPlane1->SetDirectory(dir_effC);
1394 m_ProfileEKLMScintillatorPlane2->SetDirectory(dir_effC);
1395 m_Profile2RpcPhi->SetDirectory(dir_effC);
1396 m_Profile2RpcZ->SetDirectory(dir_effC);
1397 m_Profile2BKLMScintillatorPhi->SetDirectory(dir_effC);
1398 m_Profile2BKLMScintillatorZ->SetDirectory(dir_effC);
1399 m_Profile2EKLMScintillatorPlane1->SetDirectory(dir_effC);
1400 m_Profile2EKLMScintillatorPlane2->SetDirectory(dir_effC);
1401
1402 m_outFile->cd();
1403 TDirectory* dir_time = m_outFile->mkdir("time", "", true);
1404 dir_time->cd();
1405
1406 h_time_scint->SetDirectory(dir_time);
1407 hc_time_scint->SetDirectory(dir_time);
1408
1409 h_time_scint_end->SetDirectory(dir_time);
1410 hc_time_scint_end->SetDirectory(dir_time);
1411
1412 h_time_rpc->SetDirectory(dir_time);
1413 hc_time_rpc->SetDirectory(dir_time);
1414
1415 gre_time_channel_rpc->Write("gre_time_channel_rpc");
1416 gre_time_channel_scint->Write("gre_time_channel_scint");
1417 gre_time_channel_scint_end->Write("gre_time_channel_scint_end");
1418 gr_timeShift_channel_rpc->Write("gr_timeShift_channel_rpc");
1419 gr_timeShift_channel_scint->Write("gr_timeShift_channel_scint");
1420 gr_timeShift_channel_scint_end->Write("gr_timeShift_channel_scint_end");
1421 gre_ctime_channel_rpc->Write("gre_ctime_channel_rpc");
1422 gre_ctime_channel_scint->Write("gre_ctime_channel_scint");
1423 gre_ctime_channel_scint_end->Write("gre_ctime_channel_scint_end");
1424 gr_timeRes_channel_rpc->Write("gr_timeRes_channel_rpc");
1425 gr_timeRes_channel_scint->Write("gr_timeRes_channel_scint");
1426 gr_timeRes_channel_scint_end->Write("gr_timeRes_channel_scint_end");
1427
1428 B2INFO("Top file setup Done.");
1429
1430 TDirectory* dir_time_F[2];
1431 TDirectory* dir_time_FS[2][8];
1432 TDirectory* dir_time_FSL[2][8][15];
1433 TDirectory* dir_time_FSLP[2][8][15][2];
1434 TDirectory* dir_time_F_end[2];
1435 TDirectory* dir_time_FS_end[2][4];
1436 TDirectory* dir_time_FSL_end[2][4][14];
1437 TDirectory* dir_time_FSLP_end[2][4][14][2];
1438 char dirname[50];
1439 B2INFO("Sub files declare Done.");
1440 for (int iF = 0; iF < 2; ++iF) {
1441 h_timeF_rpc[iF]->SetDirectory(dir_time);
1442 hc_timeF_rpc[iF]->SetDirectory(dir_time);
1443
1444 h2_timeF_rpc[iF]->SetDirectory(dir_time);
1445 h2c_timeF_rpc[iF]->SetDirectory(dir_time);
1446
1447 h_timeF_scint[iF]->SetDirectory(dir_time);
1448 hc_timeF_scint[iF]->SetDirectory(dir_time);
1449
1450 h2_timeF_scint[iF]->SetDirectory(dir_time);
1451 h2c_timeF_scint[iF]->SetDirectory(dir_time);
1452
1453 h_timeF_scint_end[iF]->SetDirectory(dir_time);
1454 hc_timeF_scint_end[iF]->SetDirectory(dir_time);
1455
1456 h2_timeF_scint_end[iF]->SetDirectory(dir_time);
1457 h2c_timeF_scint_end[iF]->SetDirectory(dir_time);
1458
1459 sprintf(dirname, "isForward_%d", iF);
1460 dir_time_F[iF] = dir_time->mkdir(dirname, "", true);
1461 dir_time_F[iF]->cd();
1462
1463 for (int iS = 0; iS < 8; ++iS) {
1464 h_timeFS_rpc[iF][iS]->SetDirectory(dir_time_F[iF]);
1465 hc_timeFS_rpc[iF][iS]->SetDirectory(dir_time_F[iF]);
1466
1467 h_timeFS_scint[iF][iS]->SetDirectory(dir_time_F[iF]);
1468 hc_timeFS_scint[iF][iS]->SetDirectory(dir_time_F[iF]);
1469
1470 h2_timeFS[iF][iS]->SetDirectory(dir_time_F[iF]);
1471 h2c_timeFS[iF][iS]->SetDirectory(dir_time_F[iF]);
1472
1473 sprintf(dirname, "Sector_%d", iS + 1);
1474 dir_time_FS[iF][iS] = dir_time_F[iF]->mkdir(dirname, "", true);
1475 dir_time_FS[iF][iS]->cd();
1476
1477 for (int iL = 0; iL < 15; ++iL) {
1478 h_timeFSL[iF][iS][iL]->SetDirectory(dir_time_FS[iF][iS]);
1479 hc_timeFSL[iF][iS][iL]->SetDirectory(dir_time_FS[iF][iS]);
1480
1481 sprintf(dirname, "Layer_%d", iL + 1);
1482 dir_time_FSL[iF][iS][iL] = dir_time_FS[iF][iS]->mkdir(dirname, "", true);
1483 dir_time_FSL[iF][iS][iL]->cd();
1484 for (int iP = 0; iP < 2; ++iP) {
1485 h_timeFSLP[iF][iS][iL][iP]->SetDirectory(dir_time_FSL[iF][iS][iL]);
1486 hc_timeFSLP[iF][iS][iL][iP]->SetDirectory(dir_time_FSL[iF][iS][iL]);
1487 h2_timeFSLP[iF][iS][iL][iP]->SetDirectory(dir_time_FSL[iF][iS][iL]);
1488 h2c_timeFSLP[iF][iS][iL][iP]->SetDirectory(dir_time_FSL[iF][iS][iL]);
1489
1490 sprintf(dirname, "Plane_%d", iP);
1491 dir_time_FSLP[iF][iS][iL][iP] = dir_time_FSL[iF][iS][iL]->mkdir(dirname, "", true);
1492 dir_time_FSLP[iF][iS][iL][iP]->cd();
1493
1494 int nchannel_max = BKLMElementNumbers::getNStrips(iF, iS + 1, iL + 1, iP);
1495 for (int iC = 0; iC < nchannel_max; ++iC) {
1496 if (iL < 2)
1497 m_HistTimeLengthBKLM[iF][iS][iL][iP][iC]->SetDirectory(dir_time_FSLP[iF][iS][iL][iP]);
1498 h_timeFSLPC[iF][iS][iL][iP][iC]->SetDirectory(dir_time_FSLP[iF][iS][iL][iP]);
1499 hc_timeFSLPC[iF][iS][iL][iP][iC]->SetDirectory(dir_time_FSLP[iF][iS][iL][iP]);
1500 delete h_timeFSLPC_tc[iF][iS][iL][iP][iC];
1501 }
1502 }
1503 }
1504 }
1505
1506 sprintf(dirname, "isForward_%d_end", iF + 1);
1507 dir_time_F_end[iF] = dir_time->mkdir(dirname, "", true);
1508 dir_time_F_end[iF]->cd();
1509 int maxLayer = 12 + 2 * iF;
1510 for (int iS = 0; iS < 4; ++iS) {
1511 h_timeFS_scint_end[iF][iS]->SetDirectory(dir_time_F_end[iF]);
1512 hc_timeFS_scint_end[iF][iS]->SetDirectory(dir_time_F_end[iF]);
1513
1514 h2_timeFS_end[iF][iS]->SetDirectory(dir_time_F_end[iF]);
1515 h2c_timeFS_end[iF][iS]->SetDirectory(dir_time_F_end[iF]);
1516
1517 sprintf(dirname, "Sector_%d_end", iS + 1);
1518 dir_time_FS_end[iF][iS] = dir_time_F_end[iF]->mkdir(dirname, "", true);
1519 dir_time_FS_end[iF][iS]->cd();
1520 for (int iL = 0; iL < maxLayer; ++iL) {
1521 h_timeFSL_end[iF][iS][iL]->SetDirectory(dir_time_FS_end[iF][iS]);
1522 hc_timeFSL_end[iF][iS][iL]->SetDirectory(dir_time_FS_end[iF][iS]);
1523
1524 sprintf(dirname, "Layer_%d_end", iL + 1);
1525 dir_time_FSL_end[iF][iS][iL] = dir_time_FS_end[iF][iS]->mkdir(dirname, "", true);
1526 dir_time_FSL_end[iF][iS][iL]->cd();
1527 for (int iP = 0; iP < 2; ++iP) {
1528 h_timeFSLP_end[iF][iS][iL][iP]->SetDirectory(dir_time_FSL_end[iF][iS][iL]);
1529 hc_timeFSLP_end[iF][iS][iL][iP]->SetDirectory(dir_time_FSL_end[iF][iS][iL]);
1530 h2_timeFSLP_end[iF][iS][iL][iP]->SetDirectory(dir_time_FSL_end[iF][iS][iL]);
1531 h2c_timeFSLP_end[iF][iS][iL][iP]->SetDirectory(dir_time_FSL_end[iF][iS][iL]);
1532
1533 sprintf(dirname, "plane_%d_end", iP);
1534 dir_time_FSLP_end[iF][iS][iL][iP] = dir_time_FSL_end[iF][iS][iL]->mkdir(dirname, "", true);
1535 dir_time_FSLP_end[iF][iS][iL][iP]->cd();
1536
1537 for (int iC = 0; iC < 75; ++iC) {
1538 h_timeFSLPC_end[iF][iS][iL][iP][iC]->SetDirectory(dir_time_FSLP_end[iF][iS][iL][iP]);
1539 hc_timeFSLPC_end[iF][iS][iL][iP][iC]->SetDirectory(dir_time_FSLP_end[iF][iS][iL][iP]);
1540 m_HistTimeLengthEKLM[iF][iS][iL][iP][iC]->SetDirectory(dir_time_FSLP_end[iF][iS][iL][iP]);
1541 delete h_timeFSLPC_tc_end[iF][iS][iL][iP][iC];
1542 }
1543 }
1544 }
1545 }
1546 }
1547 m_outFile->cd();
1548 m_outFile->Write();
1549 m_outFile->Close();
1550 B2INFO("File Write and Close. Done.");
1551}

◆ setDebug()

void setDebug ( )
inline

Turn on debug mode (prints histograms and output running log).

Definition at line 125 of file KLMTimeAlgorithm.h.

126 {
127 m_debug = true;
128 }

◆ setDescription()

void setDescription ( const std::string &  description)
inlineprotectedinherited

Set algorithm description (in constructor)

Definition at line 321 of file CalibrationAlgorithm.h.

321{m_description = description;}

◆ setInputFileNames() [1/2]

void setInputFileNames ( PyObject *  inputFileNames)
inherited

Set the input file names used for this algorithm from a Python list.

Set the input file names used for this algorithm and resolve the wildcards.

Definition at line 166 of file CalibrationAlgorithm.cc.

167{
168 // The reasoning for this very 'manual' approach to extending the Python interface
169 // (instead of using boost::python) is down to my fear of putting off final users with
170 // complexity on their side.
171 //
172 // I didn't want users that inherit from this class to be forced to use boost and
173 // to have to define a new python module just to use the CAF. A derived class from
174 // from a boost exposed class would need to have its own boost python module definition
175 // to allow access from a steering file and to the base class functions (I think).
176 // I also couldn't be bothered to write a full framework to get around the issue in a similar
177 // way to Module()...maybe there's an easy way.
178 //
179 // But this way we can allow people to continue using their ROOT implemented classes and inherit
180 // easily from this one. But add in a few helper functions that work with Python objects
181 // created in their steering file i.e. instead of being forced to use STL objects as input
182 // to the algorithm.
183 if (PyList_Check(inputFileNames)) {
184 boost::python::handle<> handle(boost::python::borrowed(inputFileNames));
185 boost::python::list listInputFileNames(handle);
186 auto vecInputFileNames = PyObjConvUtils::convertPythonObject(listInputFileNames, vector<string>());
187 setInputFileNames(vecInputFileNames);
188 } else {
189 B2ERROR("Tried to set the input files but we didn't receive a Python list.");
190 }
191}
void setInputFileNames(PyObject *inputFileNames)
Set the input file names used for this algorithm from a Python list.
Scalar convertPythonObject(const boost::python::object &pyObject, Scalar)
Convert from Python to given type.

◆ setInputFileNames() [2/2]

void setInputFileNames ( std::vector< std::string >  inputFileNames)
protectedinherited

Set the input file names used for this algorithm.

Set the input file names used for this algorithm and resolve the wildcards.

Definition at line 194 of file CalibrationAlgorithm.cc.

195{
196 // A lot of code below is tweaked from RootInputModule::initialize,
197 // since we're basically copying the functionality anyway.
198 if (inputFileNames.empty()) {
199 B2WARNING("You have called setInputFileNames() with an empty list. Did you mean to do that?");
200 return;
201 }
202 auto tmpInputFileNames = RootIOUtilities::expandWordExpansions(inputFileNames);
203
204 // We'll use a set to enforce sorted unique file paths as we check them
205 set<string> setInputFileNames;
206 // Check that files exist and convert to absolute paths
207 for (auto path : tmpInputFileNames) {
208 string fullPath = fs::absolute(path).string();
209 if (fs::exists(fullPath)) {
210 setInputFileNames.insert(fs::canonical(fullPath).string());
211 } else {
212 B2WARNING("Couldn't find the file " << path);
213 }
214 }
215
216 if (setInputFileNames.empty()) {
217 B2WARNING("No valid files specified!");
218 return;
219 } else {
220 // Reset the run -> files map as our files are likely different
221 m_runsToInputFiles.clear();
222 }
223
224 // Open TFile to check they can be accessed by ROOT
225 TDirectory* dir = gDirectory;
226 for (const string& fileName : setInputFileNames) {
227 unique_ptr<TFile> f;
228 try {
229 f.reset(TFile::Open(fileName.c_str(), "READ"));
230 } catch (logic_error&) {
231 //this might happen for ~invaliduser/foo.root
232 //actually undefined behaviour per standard, reported as ROOT-8490 in JIRA
233 }
234 if (!f || !f->IsOpen()) {
235 B2FATAL("Couldn't open input file " + fileName);
236 }
237 }
238 dir->cd();
239
240 // Copy the entries of the set to a vector
241 m_inputFileNames = vector<string>(setInputFileNames.begin(), setInputFileNames.end());
243}
std::string getGranularityFromData() const
Get the granularity of collected data.
std::vector< std::string > expandWordExpansions(const std::vector< std::string > &filenames)
Performs wildcard expansion using wordexp(), returns matches.

◆ setLowerLimit()

void setLowerLimit ( int  counts)
inline

Set the lower number of hits collected on one single strip.

If the hit number is lower than the limit, the strip will not be calibrated and set the average value of the calibration constant.

Definition at line 161 of file KLMTimeAlgorithm.h.

162 {
163 m_lower_limit_counts = counts;
164 }

◆ setMC()

void setMC ( bool  mc)
inline

Set flag indicating whether the input is MC sample.

The histogram ranges are different for data and MC. This setting cannot be determined automatically, because the collector output does not contain metadata.

Definition at line 135 of file KLMTimeAlgorithm.h.

136 {
137 m_mc = mc;
138 }

◆ setMinimalDigitNumber()

void setMinimalDigitNumber ( int  minimalDigitNumber)
inline

Set minimal digit number (total).

Definition at line 151 of file KLMTimeAlgorithm.h.

152 {
153 m_MinimalDigitNumber = minimalDigitNumber;
154 }

◆ setOutputJsonValue()

void setOutputJsonValue ( const std::string &  key,
const T &  value 
)
inlineprotectedinherited

Set a key:value pair for the outputJson object, expected to used interally during calibrate()

Definition at line 337 of file CalibrationAlgorithm.h.

337{m_jsonExecutionOutput[key] = value;}

◆ setPrefix()

void setPrefix ( const std::string &  prefix)
inlineinherited

Set the prefix used to identify datastore objects.

Definition at line 167 of file CalibrationAlgorithm.h.

167{m_prefix = prefix;}

◆ setupDatabase()

void setupDatabase ( )
private

Setup the database.

Definition at line 104 of file KLMTimeAlgorithm.cc.

105{
106 const std::vector<Calibration::ExpRun>& runs = getRunList();
107 int firstExperiment = runs[0].first;
108 int lastExperiment = runs[runs.size() - 1].first;
109 if (firstExperiment != lastExperiment) {
110 B2FATAL("Runs from different experiments are used "
111 "for KLM time calibration (single algorithm run).");
112 }
113 /* DataStore. */
115 StoreObjPtr<EventMetaData> eventMetaData;
116 eventMetaData.registerInDataStore();
118 /* Database. */
119 if (eventMetaData.isValid()) {
120 if (eventMetaData->getExperiment() != firstExperiment) {
121 B2FATAL("Runs from different experiments are used "
122 "for KLM time calibration (consecutive algorithm runs).");
123 }
124 eventMetaData->setExperiment(firstExperiment);
125 eventMetaData->setRun(runs[0].second);
126 } else {
127 eventMetaData.construct(1, runs[0].second, firstExperiment);
128 }
129 DBStore& dbStore = DBStore::Instance();
130 dbStore.update();
131 dbStore.updateEvent();
132 /*
133 * For calibration algorithms, the database is not initialized on class
134 * creation. Do not move the database object to class members.
135 */
136 DBObjPtr<BKLMGeometryPar> bklmGeometry;
139}
const std::vector< Calibration::ExpRun > & getRunList() const
Get the list of runs for which calibration is called.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Singleton class to cache database objects.
Definition: DBStore.h:31
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:94
static const GeometryData & Instance(enum DataSource dataSource=c_Database, const GearDir *gearDir=nullptr)
Instantiation.
Definition: GeometryData.cc:33
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:111
bool construct(Args &&... params)
Construct an object of type T in this StoreObjPtr, using the provided constructor arguments.
Definition: StoreObjPtr.h:119
static GeometryPar * instance(void)
Static method to get a reference to the singleton GeometryPar instance.
Definition: GeometryPar.cc:27
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:28
void updateEvent()
Updates all intra-run dependent objects.
Definition: DBStore.cc:142
void update()
Updates all objects that are outside their interval of validity.
Definition: DBStore.cc:79

◆ timeDistance2dFit()

void timeDistance2dFit ( const std::vector< std::pair< KLMChannelNumber, unsigned int > > &  channels,
double &  delay,
double &  delayError 
)
private

Two-dimensional fit for individual channels.

Parameters
[in]channelsChannels.
[out]delayDelay (ns / cm).
[out]delayErrorDelay error.

Definition at line 656 of file KLMTimeAlgorithm.cc.

659{
660 std::vector<struct Event>::iterator it;
661 std::vector<struct Event> eventsChannel;
662 int nFits = 1000;
663 int nConvergedFits = 0;
664 delay = 0;
665 delayError = 0;
666 if (nFits > (int)channels.size())
667 nFits = channels.size();
668 for (int i = 0; i < nFits; ++i) {
669 int subdetector, section, sector, layer, plane, strip;
671 channels[i].first, &subdetector, &section, &sector, &layer, &plane,
672 &strip);
673 if (subdetector == KLMElementNumbers::c_BKLM) {
674 s_LowerTimeBoundary = m_LowerTimeBoundaryScintillatorsBKLM;
675 s_UpperTimeBoundary = m_UpperTimeBoundaryScintillatorsBKLM;
676 const bklm::Module* module =
677 m_BKLMGeometry->findModule(section, sector, layer);
678 s_StripLength = module->getStripLength(plane, strip);
679 } else {
680 s_LowerTimeBoundary = m_LowerTimeBoundaryScintillatorsEKLM;
681 s_UpperTimeBoundary = m_UpperTimeBoundaryScintillatorsEKLM;
682 s_StripLength = m_EKLMGeometry->getStripLength(strip) /
683 CLHEP::cm * Unit::cm;
684 }
685 for (int j = 0; j < c_NBinsTime; ++j) {
686 for (int k = 0; k < c_NBinsDistance; ++k)
687 s_BinnedData[j][k] = 0;
688 }
689 eventsChannel = m_evts[channels[i].first];
690 double averageTime = 0;
691 for (it = eventsChannel.begin(); it != eventsChannel.end(); ++it) {
692 double timeHit = it->time();
693 if (m_useEventT0)
694 timeHit = timeHit - it->t0;
695 averageTime = averageTime + timeHit;
696 int timeBin = std::floor((timeHit - s_LowerTimeBoundary) * c_NBinsTime /
697 (s_UpperTimeBoundary - s_LowerTimeBoundary));
698 if (timeBin < 0 || timeBin >= c_NBinsTime)
699 continue;
700 int distanceBin = std::floor(it->dist * c_NBinsDistance / s_StripLength);
701 if (distanceBin < 0 || distanceBin >= c_NBinsDistance) {
702 B2ERROR("The distance to SiPM is greater than the strip length.");
703 continue;
704 }
705 s_BinnedData[timeBin][distanceBin] += 1;
706 }
707 averageTime = averageTime / eventsChannel.size();
708 TMinuit minuit(5);
709 minuit.SetPrintLevel(-1);
710 int minuitResult;
711 minuit.mnparm(0, "P0", 1, 0.001, 0, 0, minuitResult);
712 minuit.mnparm(1, "N", 10, 0.001, 0, 0, minuitResult);
713 minuit.mnparm(2, "T0", averageTime, 0.001, 0, 0, minuitResult);
714 minuit.mnparm(3, "SIGMA", 10, 0.001, 0, 0, minuitResult);
715 minuit.mnparm(4, "DELAY", 0.0, 0.001, 0, 0, minuitResult);
716 minuit.SetFCN(fcn);
717 minuit.mncomd("FIX 2 3 4 5", minuitResult);
718 minuit.mncomd("MIGRAD 10000", minuitResult);
719 minuit.mncomd("RELEASE 2", minuitResult);
720 minuit.mncomd("MIGRAD 10000", minuitResult);
721 minuit.mncomd("RELEASE 3", minuitResult);
722 minuit.mncomd("MIGRAD 10000", minuitResult);
723 minuit.mncomd("RELEASE 4", minuitResult);
724 minuit.mncomd("MIGRAD 10000", minuitResult);
725 minuit.mncomd("RELEASE 5", minuitResult);
726 minuit.mncomd("MIGRAD 10000", minuitResult);
727 /* Require converged fit with accurate error matrix. */
728 if (minuit.fISW[1] != 3)
729 continue;
730 nConvergedFits++;
731 double channelDelay, channelDelayError;
732 minuit.GetParameter(4, channelDelay, channelDelayError);
733 delay = delay + channelDelay;
734 delayError = delayError + channelDelayError * channelDelayError;
735 }
736 delay = delay / nConvergedFits;
737 delayError = sqrt(delayError) / (nConvergedFits - 1);
738}
void channelNumberToElementNumbers(KLMChannelNumber channel, int *subdetector, int *section, int *sector, int *layer, int *plane, int *strip) const
Get element numbers by channel number.
const Module * findModule(int section, int sector, int layer) const
Get the pointer to the definition of a module.
Definition: GeometryPar.cc:721
Define the geometry of a BKLM module Each sector [octant] contains Modules.
Definition: Module.h:76
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ tR_lowerStrip()

std::pair< int, double > tR_lowerStrip ( const KLMChannelIndex klmChannel)

Tracing available channels with decreasing strip number.

Parameters
[in]klmChannelKLM channel index.

Definition at line 1690 of file KLMTimeAlgorithm.cc.

1691{
1692 std::pair<int, double> tR;
1693 int cId = klmChannel.getKLMChannelNumber();
1694 int iSub = klmChannel.getSubdetector();
1695 int iF = klmChannel.getSection();
1696 int iS = klmChannel.getSector();
1697 int iL = klmChannel.getLayer();
1698 int iP = klmChannel.getPlane();
1699 int iC = klmChannel.getStrip();
1700 if (m_timeRes.find(cId) != m_timeRes.end()) {
1701 tR.first = iC;
1702 tR.second = m_timeRes[cId];
1703 } else if (iC == 1) {
1704 tR.first = iC;
1705 tR.second = 0.0;
1706 } else {
1707 KLMChannelIndex kCIndex(iSub, iF, iS, iL, iP, iC - 1);
1708 tR = tR_lowerStrip(kCIndex);
1709 }
1710 return tR;
1711}
KLMChannelNumber getKLMChannelNumber() const
Get KLM channel number.

◆ tR_upperStrip()

std::pair< int, double > tR_upperStrip ( const KLMChannelIndex klmChannel)

Tracing available channels with increasing strip number.

Parameters
[in]klmChannelKLM channel index.

Definition at line 1664 of file KLMTimeAlgorithm.cc.

1665{
1666 std::pair<int, double> tR;
1667 int cId = klmChannel.getKLMChannelNumber();
1668 int iSub = klmChannel.getSubdetector();
1669 int iF = klmChannel.getSection();
1670 int iS = klmChannel.getSector();
1671 int iL = klmChannel.getLayer();
1672 int iP = klmChannel.getPlane();
1673 int iC = klmChannel.getStrip();
1675 if (iSub == KLMElementNumbers::c_BKLM)
1676 totNStrips = BKLMElementNumbers::getNStrips(iF, iS, iL, iP);
1677 if (m_timeRes.find(cId) != m_timeRes.end()) {
1678 tR.first = iC;
1679 tR.second = m_timeRes[cId];
1680 } else if (iC == totNStrips) {
1681 tR.first = iC;
1682 tR.second = 0.0;
1683 } else {
1684 KLMChannelIndex kCIndex(iSub, iF, iS, iL, iP, iC + 1);
1685 tR = tR_upperStrip(kCIndex);
1686 }
1687 return tR;
1688}

◆ tS_lowerStrip()

std::pair< int, double > tS_lowerStrip ( const KLMChannelIndex klmChannel)

Tracing available channels with decreasing strip number.

Parameters
[in]klmChannelKLM channel index.

Definition at line 1610 of file KLMTimeAlgorithm.cc.

1611{
1612 std::pair<int, double> tS;
1613 int cId = klmChannel.getKLMChannelNumber();
1614 int iSub = klmChannel.getSubdetector();
1615 int iF = klmChannel.getSection();
1616 int iS = klmChannel.getSector();
1617 int iL = klmChannel.getLayer();
1618 int iP = klmChannel.getPlane();
1619 int iC = klmChannel.getStrip();
1620 if (m_timeShift.find(cId) != m_timeShift.end()) {
1621 tS.first = iC;
1622 tS.second = m_timeShift[cId];
1623 } else if (iC == 1) {
1624 tS.first = iC;
1625 tS.second = 0.0;
1626 } else {
1627 KLMChannelIndex kCIndex(iSub, iF, iS, iL, iP, iC - 1);
1628 tS = tS_lowerStrip(kCIndex);
1629 }
1630 return tS;
1631}

◆ tS_upperStrip()

std::pair< int, double > tS_upperStrip ( const KLMChannelIndex klmChannel)

Tracing available channels with increasing strip number.

Parameters
[in]klmChannelKLM channel index.

Definition at line 1584 of file KLMTimeAlgorithm.cc.

1585{
1586 std::pair<int, double> tS;
1587 int cId = klmChannel.getKLMChannelNumber();
1588 int iSub = klmChannel.getSubdetector();
1589 int iF = klmChannel.getSection();
1590 int iS = klmChannel.getSector();
1591 int iL = klmChannel.getLayer();
1592 int iP = klmChannel.getPlane();
1593 int iC = klmChannel.getStrip();
1595 if (iSub == KLMElementNumbers::c_BKLM)
1596 totNStrips = BKLMElementNumbers::getNStrips(iF, iS, iL, iP);
1597 if (m_timeShift.find(cId) != m_timeShift.end()) {
1598 tS.first = iC;
1599 tS.second = m_timeShift[cId];
1600 } else if (iC == totNStrips) {
1601 tS.first = iC;
1602 tS.second = 0.0;
1603 } else {
1604 KLMChannelIndex kCIndex(iSub, iF, iS, iL, iP, iC + 1);
1605 tS = tS_upperStrip(kCIndex);
1606 }
1607 return tS;
1608}

◆ updateDBObjPtrs()

void updateDBObjPtrs ( const unsigned int  event = 1,
const int  run = 0,
const int  experiment = 0 
)
protectedinherited

Updates any DBObjPtrs by calling update(event) for DBStore.

Definition at line 404 of file CalibrationAlgorithm.cc.

405{
406 // Construct an EventMetaData object but NOT in the Datastore
407 EventMetaData emd(event, run, experiment);
408 // Explicitly update while avoiding registering a Datastore object
410 // Also update the intra-run objects to the event at the same time (maybe unnessary...)
412}
Store event, run, and experiment numbers.
Definition: EventMetaData.h:33

◆ useEvtT0()

void useEvtT0 ( )
inline

Use event T0 as the initial time point or not.

Definition at line 143 of file KLMTimeAlgorithm.h.

144 {
145 m_useEventT0 = true;
146 }

Member Data Documentation

◆ fcn_const

TF1* fcn_const = nullptr
private

Const function.

Global time distribution fitting.

Definition at line 744 of file KLMTimeAlgorithm.h.

◆ fcn_gaus

TF1* fcn_gaus = nullptr
private

Gaussian function.

Scitillator time distribution fitting.

Definition at line 747 of file KLMTimeAlgorithm.h.

◆ fcn_land

TF1* fcn_land = nullptr
private

Landau function.

RPC time distribution fitting.

Definition at line 750 of file KLMTimeAlgorithm.h.

◆ fcn_pol1

TF1* fcn_pol1 = nullptr
private

Pol1 function.

Effective light speed fitting.

Definition at line 741 of file KLMTimeAlgorithm.h.

◆ gr_timeRes_channel_rpc

TGraph* gr_timeRes_channel_rpc = nullptr
private

BKLM RPC.

Definition at line 472 of file KLMTimeAlgorithm.h.

◆ gr_timeRes_channel_scint

TGraph* gr_timeRes_channel_scint = nullptr
private

BKLM scintillator.

Definition at line 475 of file KLMTimeAlgorithm.h.

◆ gr_timeRes_channel_scint_end

TGraph* gr_timeRes_channel_scint_end = nullptr
private

EKLM.

Definition at line 478 of file KLMTimeAlgorithm.h.

◆ gr_timeShift_channel_rpc

TGraph* gr_timeShift_channel_rpc = nullptr
private

BKLM RPC.

Definition at line 461 of file KLMTimeAlgorithm.h.

◆ gr_timeShift_channel_scint

TGraph* gr_timeShift_channel_scint = nullptr
private

BKLM scintillator.

Definition at line 464 of file KLMTimeAlgorithm.h.

◆ gr_timeShift_channel_scint_end

TGraph* gr_timeShift_channel_scint_end = nullptr
private

EKLM.

Definition at line 467 of file KLMTimeAlgorithm.h.

◆ gre_ctime_channel_rpc

TGraphErrors* gre_ctime_channel_rpc = nullptr
private

BKLM RPC.

Definition at line 450 of file KLMTimeAlgorithm.h.

◆ gre_ctime_channel_scint

TGraphErrors* gre_ctime_channel_scint = nullptr
private

BKLM Scintillator.

Definition at line 453 of file KLMTimeAlgorithm.h.

◆ gre_ctime_channel_scint_end

TGraphErrors* gre_ctime_channel_scint_end = nullptr
private

EKLM.

Definition at line 456 of file KLMTimeAlgorithm.h.

◆ gre_time_channel_rpc

TGraphErrors* gre_time_channel_rpc = nullptr
private

BKLM RPC.

Definition at line 439 of file KLMTimeAlgorithm.h.

◆ gre_time_channel_scint

TGraphErrors* gre_time_channel_scint = nullptr
private

BKLM Scintillator.

Definition at line 442 of file KLMTimeAlgorithm.h.

◆ gre_time_channel_scint_end

TGraphErrors* gre_time_channel_scint_end = nullptr
private

EKLM.

Definition at line 445 of file KLMTimeAlgorithm.h.

◆ h2_timeF_rpc

TH2F* h2_timeF_rpc[2] = {nullptr}
private

BKLM RPC part.

Definition at line 590 of file KLMTimeAlgorithm.h.

◆ h2_timeF_scint

TH2F* h2_timeF_scint[2] = {nullptr}
private

BKLM scintillator part.

Definition at line 593 of file KLMTimeAlgorithm.h.

◆ h2_timeF_scint_end

TH2F* h2_timeF_scint_end[2] = {nullptr}
private

EKLM part.

Definition at line 596 of file KLMTimeAlgorithm.h.

◆ h2_timeFS

TH2F* h2_timeFS[2][8] = {{nullptr}}
private

BKLM part.

Definition at line 640 of file KLMTimeAlgorithm.h.

◆ h2_timeFS_end

TH2F* h2_timeFS_end[2][4] = {{nullptr}}
private

EKLM part.

Definition at line 643 of file KLMTimeAlgorithm.h.

◆ h2_timeFSLP

TH2F* h2_timeFSLP[2][8][15][2] = {{{{nullptr}}}}
private

BKLM part.

Definition at line 694 of file KLMTimeAlgorithm.h.

◆ h2_timeFSLP_end

TH2F* h2_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}}
private

EKLM part.

Definition at line 697 of file KLMTimeAlgorithm.h.

◆ h2c_timeF_rpc

TH2F* h2c_timeF_rpc[2] = {nullptr}
private

BKLM RPC part.

Definition at line 604 of file KLMTimeAlgorithm.h.

◆ h2c_timeF_scint

TH2F* h2c_timeF_scint[2] = {nullptr}
private

BKLM scintillator part.

Definition at line 607 of file KLMTimeAlgorithm.h.

◆ h2c_timeF_scint_end

TH2F* h2c_timeF_scint_end[2] = {nullptr}
private

EKLM part.

Definition at line 610 of file KLMTimeAlgorithm.h.

◆ h2c_timeFS

TH2F* h2c_timeFS[2][8] = {{nullptr}}
private

BKLM part.

Definition at line 651 of file KLMTimeAlgorithm.h.

◆ h2c_timeFS_end

TH2F* h2c_timeFS_end[2][4] = {{nullptr}}
private

EKLM part.

Definition at line 654 of file KLMTimeAlgorithm.h.

◆ h2c_timeFSLP

TH2F* h2c_timeFSLP[2][8][15][2] = {{{{nullptr}}}}
private

BKLM part.

Definition at line 705 of file KLMTimeAlgorithm.h.

◆ h2c_timeFSLP_end

TH2F* h2c_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}}
private

EKLM part.

Definition at line 708 of file KLMTimeAlgorithm.h.

◆ h_calibrated

TH1I* h_calibrated = nullptr
private

Calibration statistics for each channel.

Definition at line 428 of file KLMTimeAlgorithm.h.

◆ h_diff

TH1F* h_diff = nullptr
private

Distance between global and local position.

Definition at line 434 of file KLMTimeAlgorithm.h.

◆ h_time_rpc

TH1F* h_time_rpc = nullptr
private

BKLM RPC part.

Definition at line 537 of file KLMTimeAlgorithm.h.

◆ h_time_rpc_tc

TH1F* h_time_rpc_tc = nullptr
private

BKLM RPC part.

Definition at line 526 of file KLMTimeAlgorithm.h.

◆ h_time_scint

TH1F* h_time_scint = nullptr
private

BKLM scintillator part.

Definition at line 540 of file KLMTimeAlgorithm.h.

◆ h_time_scint_end

TH1F* h_time_scint_end = nullptr
private

EKLM part.

Definition at line 543 of file KLMTimeAlgorithm.h.

◆ h_time_scint_tc

TH1F* h_time_scint_tc = nullptr
private

BKLM scintillator part.

Definition at line 529 of file KLMTimeAlgorithm.h.

◆ h_time_scint_tc_end

TH1F* h_time_scint_tc_end = nullptr
private

EKLM part.

Definition at line 532 of file KLMTimeAlgorithm.h.

◆ h_timeF_rpc

TH1F* h_timeF_rpc[2] = {nullptr}
private

BKLM RPC part.

Definition at line 562 of file KLMTimeAlgorithm.h.

◆ h_timeF_scint

TH1F* h_timeF_scint[2] = {nullptr}
private

BKLM scintillator part.

Definition at line 565 of file KLMTimeAlgorithm.h.

◆ h_timeF_scint_end

TH1F* h_timeF_scint_end[2] = {nullptr}
private

EKLM part.

Definition at line 568 of file KLMTimeAlgorithm.h.

◆ h_timeFS_rpc

TH1F* h_timeFS_rpc[2][8] = {{nullptr}}
private

BKLM RPC part.

Definition at line 615 of file KLMTimeAlgorithm.h.

◆ h_timeFS_scint

TH1F* h_timeFS_scint[2][8] = {{nullptr}}
private

BKLM scintillator part.

Definition at line 618 of file KLMTimeAlgorithm.h.

◆ h_timeFS_scint_end

TH1F* h_timeFS_scint_end[2][4] = {{nullptr}}
private

EKLM part.

Definition at line 621 of file KLMTimeAlgorithm.h.

◆ h_timeFSL

TH1F* h_timeFSL[2][8][15] = {{{nullptr}}}
private

BKLM part.

Definition at line 659 of file KLMTimeAlgorithm.h.

◆ h_timeFSL_end

TH1F* h_timeFSL_end[2][4][14] = {{{nullptr}}}
private

EKLM part.

Definition at line 662 of file KLMTimeAlgorithm.h.

◆ h_timeFSLP

TH1F* h_timeFSLP[2][8][15][2] = {{{{nullptr}}}}
private

BKLM part.

Definition at line 675 of file KLMTimeAlgorithm.h.

◆ h_timeFSLP_end

TH1F* h_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}}
private

EKLM part.

Definition at line 678 of file KLMTimeAlgorithm.h.

◆ h_timeFSLPC

TH1F* h_timeFSLPC[2][8][15][2][54] = {{{{{nullptr}}}}}
private

BKLM part.

Definition at line 716 of file KLMTimeAlgorithm.h.

◆ h_timeFSLPC_end

TH1F* h_timeFSLPC_end[2][4][14][2][75] = {{{{{nullptr}}}}}
private

EKLM part.

Definition at line 725 of file KLMTimeAlgorithm.h.

◆ h_timeFSLPC_tc

TH1F* h_timeFSLPC_tc[2][8][15][2][54] = {{{{{nullptr}}}}}
private

BKLM part, used for effective light speed estimation.

Definition at line 713 of file KLMTimeAlgorithm.h.

◆ h_timeFSLPC_tc_end

TH1F* h_timeFSLPC_tc_end[2][4][14][2][75] = {{{{{nullptr}}}}}
private

EKLM part, used for effective light speed estimation.

Definition at line 722 of file KLMTimeAlgorithm.h.

◆ hc_calibrated

TH1I* hc_calibrated = nullptr
private

Calibration statistics for each channel.

Definition at line 431 of file KLMTimeAlgorithm.h.

◆ hc_time_rpc

TH1F* hc_time_rpc = nullptr
private

BKLM RPC part.

Definition at line 548 of file KLMTimeAlgorithm.h.

◆ hc_time_scint

TH1F* hc_time_scint = nullptr
private

BKLM scintillator part.

Definition at line 551 of file KLMTimeAlgorithm.h.

◆ hc_time_scint_end

TH1F* hc_time_scint_end = nullptr
private

EKLM part.

Definition at line 554 of file KLMTimeAlgorithm.h.

◆ hc_timeF_rpc

TH1F* hc_timeF_rpc[2] = {nullptr}
private

BKLM RPC part.

Definition at line 576 of file KLMTimeAlgorithm.h.

◆ hc_timeF_scint

TH1F* hc_timeF_scint[2] = {nullptr}
private

BKLM scintillator part.

Definition at line 579 of file KLMTimeAlgorithm.h.

◆ hc_timeF_scint_end

TH1F* hc_timeF_scint_end[2] = {nullptr}
private

EKLM part.

Definition at line 582 of file KLMTimeAlgorithm.h.

◆ hc_timeFS_rpc

TH1F* hc_timeFS_rpc[2][8] = {{nullptr}}
private

BKLM RPC part.

Definition at line 626 of file KLMTimeAlgorithm.h.

◆ hc_timeFS_scint

TH1F* hc_timeFS_scint[2][8] = {{nullptr}}
private

BKLM scintillator part.

Definition at line 629 of file KLMTimeAlgorithm.h.

◆ hc_timeFS_scint_end

TH1F* hc_timeFS_scint_end[2][4] = {{nullptr}}
private

EKLM part.

Definition at line 632 of file KLMTimeAlgorithm.h.

◆ hc_timeFSL

TH1F* hc_timeFSL[2][8][15] = {{{nullptr}}}
private

BKLM part.

Definition at line 667 of file KLMTimeAlgorithm.h.

◆ hc_timeFSL_end

TH1F* hc_timeFSL_end[2][4][14] = {{{nullptr}}}
private

EKLM part.

Definition at line 670 of file KLMTimeAlgorithm.h.

◆ hc_timeFSLP

TH1F* hc_timeFSLP[2][8][15][2] = {{{{nullptr}}}}
private

BKLM part.

Definition at line 683 of file KLMTimeAlgorithm.h.

◆ hc_timeFSLP_end

TH1F* hc_timeFSLP_end[2][4][14][2] = {{{{nullptr}}}}
private

EKLM part.

Definition at line 686 of file KLMTimeAlgorithm.h.

◆ hc_timeFSLPC

TH1F* hc_timeFSLPC[2][8][15][2][54] = {{{{{nullptr}}}}}
private

BKLM part.

Definition at line 733 of file KLMTimeAlgorithm.h.

◆ hc_timeFSLPC_end

TH1F* hc_timeFSLPC_end[2][4][14][2][75] = {{{{{nullptr}}}}}
private

EKLM part.

Definition at line 736 of file KLMTimeAlgorithm.h.

◆ m_allExpRun

const ExpRun m_allExpRun = make_pair(-1, -1)
staticprivateinherited

allExpRun

Definition at line 364 of file CalibrationAlgorithm.h.

◆ m_BKLMGeometry

const bklm::GeometryPar* m_BKLMGeometry = nullptr
private

BKLM geometry data.

Definition at line 395 of file KLMTimeAlgorithm.h.

◆ m_boundaries

std::vector<Calibration::ExpRun> m_boundaries
protectedinherited

When using the boundaries functionality from isBoundaryRequired, this is used to store the boundaries. It is cleared when.

Definition at line 261 of file CalibrationAlgorithm.h.

◆ m_cFlag

std::map<KLMChannelNumber, int> m_cFlag
private

Calibration flag if the channel has enough hits collected and fitted OK.

Definition at line 285 of file KLMTimeAlgorithm.h.

◆ m_ctime_channel

std::map<KLMChannelNumber, double> m_ctime_channel
private

Calibrated time distribution central value of each channel.

Definition at line 300 of file KLMTimeAlgorithm.h.

◆ m_ctime_channelAvg_rpc

double m_ctime_channelAvg_rpc = 0.0
private

Calibrated central value of the global time distribution (BKLM RPC part).

Definition at line 364 of file KLMTimeAlgorithm.h.

◆ m_ctime_channelAvg_scint

double m_ctime_channelAvg_scint = 0.0
private

Calibrated central value of the global time distribution (BKLM scintillator part).

Definition at line 371 of file KLMTimeAlgorithm.h.

◆ m_ctime_channelAvg_scint_end

double m_ctime_channelAvg_scint_end = 0.0
private

Calibrated central value of the global time distribution (EKLM scintillator part).

Definition at line 379 of file KLMTimeAlgorithm.h.

◆ m_data

ExecutionData m_data
privateinherited

Data specific to a SINGLE execution of the algorithm. Gets reset at the beginning of execution.

Definition at line 382 of file CalibrationAlgorithm.h.

◆ m_debug

bool m_debug = false
private

Debug mode.

Definition at line 419 of file KLMTimeAlgorithm.h.

◆ m_description

std::string m_description {""}
privateinherited

Description of the algorithm.

Definition at line 385 of file CalibrationAlgorithm.h.

◆ m_EKLMGeometry

const EKLM::GeometryData* m_EKLMGeometry = nullptr
private

EKLM geometry data.

Definition at line 398 of file KLMTimeAlgorithm.h.

◆ m_ElementNumbers

const KLMElementNumbers* m_ElementNumbers
private

Element numbers.

Definition at line 392 of file KLMTimeAlgorithm.h.

◆ m_etime_channel

std::map<KLMChannelNumber, double> m_etime_channel
private

Time distribution central value Error of each channel.

Definition at line 297 of file KLMTimeAlgorithm.h.

◆ m_etime_channelAvg_rpc

double m_etime_channelAvg_rpc = 0.0
private

Central value error of the global time distribution (BKLM RPC part).

Definition at line 345 of file KLMTimeAlgorithm.h.

◆ m_etime_channelAvg_scint

double m_etime_channelAvg_scint = 0.0
private

Central value error of the global time distribution (BKLM scintillator part).

Definition at line 353 of file KLMTimeAlgorithm.h.

◆ m_etime_channelAvg_scint_end

double m_etime_channelAvg_scint_end = 0.0
private

Central value error of the global time distribution (EKLM scintillator part).

Definition at line 361 of file KLMTimeAlgorithm.h.

◆ m_evts

std::map<KLMChannelNumber, std::vector<struct Event> > m_evts
private

Container of hit information.

the global element number of the strip is used as the key.

Definition at line 279 of file KLMTimeAlgorithm.h.

◆ m_granularityOfData

std::string m_granularityOfData
privateinherited

Granularity of input data. This only changes when the input files change so it isn't specific to an execution.

Definition at line 379 of file CalibrationAlgorithm.h.

◆ m_HistTimeLengthBKLM

TH2F* m_HistTimeLengthBKLM[2][8][15][2][54] = {{{{{nullptr}}}}}
private

Two-dimensional distributions of time versus propagation length.

Definition at line 719 of file KLMTimeAlgorithm.h.

◆ m_HistTimeLengthEKLM

TH2F* m_HistTimeLengthEKLM[2][4][14][2][75] = {{{{{nullptr}}}}}
private

Two-dimensional distributions of time versus propagation length.

Definition at line 728 of file KLMTimeAlgorithm.h.

◆ m_inputFileNames

std::vector<std::string> m_inputFileNames
privateinherited

List of input files to the Algorithm, will initially be user defined but then gets the wildcards expanded during execute()

Definition at line 373 of file CalibrationAlgorithm.h.

◆ m_jsonExecutionInput

nlohmann::json m_jsonExecutionInput = nlohmann::json::object()
privateinherited

Optional input JSON object used to make decisions about how to execute the algorithm code.

Definition at line 397 of file CalibrationAlgorithm.h.

◆ m_jsonExecutionOutput

nlohmann::json m_jsonExecutionOutput = nlohmann::json::object()
privateinherited

Optional output JSON object that can be set during the execution by the underlying algorithm code.

Definition at line 403 of file CalibrationAlgorithm.h.

◆ m_klmChannels

KLMChannelIndex m_klmChannels
private

KLM ChannelIndex object.

Definition at line 401 of file KLMTimeAlgorithm.h.

◆ m_lower_limit_counts

int m_lower_limit_counts = 50
private

Lower limit of hits collected for on single channel.

Definition at line 389 of file KLMTimeAlgorithm.h.

◆ m_LowerTimeBoundaryCalibratedRPC

double m_LowerTimeBoundaryCalibratedRPC = -40.0
private

Lower time boundary for RPC (calibrated data).

Definition at line 324 of file KLMTimeAlgorithm.h.

◆ m_LowerTimeBoundaryCalibratedScintillatorsBKLM

double m_LowerTimeBoundaryCalibratedScintillatorsBKLM = -40.0
private

Lower time boundary for BKLM scintillators (calibrated data).

Definition at line 330 of file KLMTimeAlgorithm.h.

◆ m_LowerTimeBoundaryCalibratedScintillatorsEKLM

double m_LowerTimeBoundaryCalibratedScintillatorsEKLM = -40.0
private

Lower time boundary for EKLM scintillators (calibrated data).

Definition at line 336 of file KLMTimeAlgorithm.h.

◆ m_LowerTimeBoundaryRPC

double m_LowerTimeBoundaryRPC = -10.0
private

Lower time boundary for RPC.

Definition at line 306 of file KLMTimeAlgorithm.h.

◆ m_LowerTimeBoundaryScintillatorsBKLM

double m_LowerTimeBoundaryScintillatorsBKLM = 20.0
private

Lower time boundary for BKLM scintillators.

Definition at line 312 of file KLMTimeAlgorithm.h.

◆ m_LowerTimeBoundaryScintillatorsEKLM

double m_LowerTimeBoundaryScintillatorsEKLM = 20.0
private

Lower time boundary for EKLM scintillators.

Definition at line 318 of file KLMTimeAlgorithm.h.

◆ m_mc

bool m_mc = false
private

MC or data.

Definition at line 422 of file KLMTimeAlgorithm.h.

◆ m_MinimalDigitNumber

int m_MinimalDigitNumber = 100000000
private

Minimal digit number (total).

Definition at line 386 of file KLMTimeAlgorithm.h.

◆ m_minimizerOptions

ROOT::Math::MinimizerOptions m_minimizerOptions
private

Minimization options.

Definition at line 404 of file KLMTimeAlgorithm.h.

◆ m_outFile

TFile* m_outFile = nullptr
private

Output file.

Definition at line 753 of file KLMTimeAlgorithm.h.

◆ m_prefix

std::string m_prefix {""}
privateinherited

The name of the TDirectory the collector objects are contained within.

Definition at line 388 of file CalibrationAlgorithm.h.

◆ m_Profile2BKLMScintillatorPhi

TProfile* m_Profile2BKLMScintillatorPhi = nullptr
private

For BKLM scintillator phi plane.

Definition at line 509 of file KLMTimeAlgorithm.h.

◆ m_Profile2BKLMScintillatorZ

TProfile* m_Profile2BKLMScintillatorZ = nullptr
private

For BKLM scintillator z plane.

Definition at line 512 of file KLMTimeAlgorithm.h.

◆ m_Profile2EKLMScintillatorPlane1

TProfile* m_Profile2EKLMScintillatorPlane1 = nullptr
private

For EKLM scintillator plane1.

Definition at line 515 of file KLMTimeAlgorithm.h.

◆ m_Profile2EKLMScintillatorPlane2

TProfile* m_Profile2EKLMScintillatorPlane2 = nullptr
private

For EKLM scintillator plane2.

Definition at line 518 of file KLMTimeAlgorithm.h.

◆ m_Profile2RpcPhi

TProfile* m_Profile2RpcPhi = nullptr
private

For BKLM RPC phi plane.

Definition at line 503 of file KLMTimeAlgorithm.h.

◆ m_Profile2RpcZ

TProfile* m_Profile2RpcZ = nullptr
private

For BKLM RPC z plane.

Definition at line 506 of file KLMTimeAlgorithm.h.

◆ m_ProfileBKLMScintillatorPhi

TProfile* m_ProfileBKLMScintillatorPhi = nullptr
private

For BKLM scintillator phi plane.

Definition at line 489 of file KLMTimeAlgorithm.h.

◆ m_ProfileBKLMScintillatorZ

TProfile* m_ProfileBKLMScintillatorZ = nullptr
private

For BKLM scintillator z plane.

Definition at line 492 of file KLMTimeAlgorithm.h.

◆ m_ProfileEKLMScintillatorPlane1

TProfile* m_ProfileEKLMScintillatorPlane1 = nullptr
private

For EKLM scintillator plane1.

Definition at line 495 of file KLMTimeAlgorithm.h.

◆ m_ProfileEKLMScintillatorPlane2

TProfile* m_ProfileEKLMScintillatorPlane2 = nullptr
private

For EKLM scintillator plane2.

Definition at line 498 of file KLMTimeAlgorithm.h.

◆ m_ProfileRpcPhi

TProfile* m_ProfileRpcPhi = nullptr
private

For BKLM RPC phi plane.

Definition at line 483 of file KLMTimeAlgorithm.h.

◆ m_ProfileRpcZ

TProfile* m_ProfileRpcZ = nullptr
private

For BKLM RPC z plane.

Definition at line 486 of file KLMTimeAlgorithm.h.

◆ m_runsToInputFiles

std::map<Calibration::ExpRun, std::vector<std::string> > m_runsToInputFiles
privateinherited

Map of Runs to input files. Gets filled when you call getRunRangeFromAllData, gets cleared when setting input files again.

Definition at line 376 of file CalibrationAlgorithm.h.

◆ m_time_channel

std::map<KLMChannelNumber, double> m_time_channel
private

Time distribution central value of each channel.

Definition at line 294 of file KLMTimeAlgorithm.h.

◆ m_time_channelAvg_rpc

double m_time_channelAvg_rpc = 0.0
private

Central value of the global time distribution (BKLM RPC part).

Definition at line 342 of file KLMTimeAlgorithm.h.

◆ m_time_channelAvg_scint

double m_time_channelAvg_scint = 0.0
private

Central value of the global time distribution (BKLM scintillator part).

Definition at line 349 of file KLMTimeAlgorithm.h.

◆ m_time_channelAvg_scint_end

double m_time_channelAvg_scint_end = 0.0
private

Central value of the global time distribution (EKLM scintillator part).

Definition at line 357 of file KLMTimeAlgorithm.h.

◆ m_timeCableDelay

KLMTimeCableDelay* m_timeCableDelay = nullptr
private

DBObject of the calibration constant of each channel due to cable decay.

Definition at line 413 of file KLMTimeAlgorithm.h.

◆ m_timeConstants

KLMTimeConstants* m_timeConstants = nullptr
private

DBObject of time cost on some parts of the detector.

Definition at line 407 of file KLMTimeAlgorithm.h.

◆ m_timeRes

std::map<KLMChannelNumber, double> m_timeRes
private

Resolution values of each channel.

Definition at line 291 of file KLMTimeAlgorithm.h.

◆ m_timeResolution

KLMTimeResolution* m_timeResolution = nullptr
private

DBObject of time resolution.

Definition at line 416 of file KLMTimeAlgorithm.h.

◆ m_timeShift

std::map<KLMChannelNumber, double> m_timeShift
private

Shift values of each channel.

Definition at line 288 of file KLMTimeAlgorithm.h.

◆ m_UpperTimeBoundaryCalibratedRPC

double m_UpperTimeBoundaryCalibratedRPC = 40.0
private

Upper time boundary for RPC (calibrated data).

Definition at line 327 of file KLMTimeAlgorithm.h.

◆ m_UpperTimeBoundaryCalibratedScintillatorsBKLM

double m_UpperTimeBoundaryCalibratedScintillatorsBKLM = 40.0
private

Upper time boundary for BKLM scintillators (calibrated data).

Definition at line 333 of file KLMTimeAlgorithm.h.

◆ m_UpperTimeBoundaryCalibratedScintillatorsEKLM

double m_UpperTimeBoundaryCalibratedScintillatorsEKLM = 40.0
private

Upper time boundary for BKLM scintillators (calibrated data).

Definition at line 339 of file KLMTimeAlgorithm.h.

◆ m_UpperTimeBoundaryRPC

double m_UpperTimeBoundaryRPC = 10.0
private

Upper time boundary for RPC.

Definition at line 309 of file KLMTimeAlgorithm.h.

◆ m_UpperTimeBoundaryScintillatorsBKLM

double m_UpperTimeBoundaryScintillatorsBKLM = 70.0
private

Upper time boundary for BKLM scintillators.

Definition at line 315 of file KLMTimeAlgorithm.h.

◆ m_UpperTimeBoundaryScintillatorsEKLM

double m_UpperTimeBoundaryScintillatorsEKLM = 70.0
private

Upper time boundary for BKLM scintillators.

Definition at line 321 of file KLMTimeAlgorithm.h.

◆ m_useEventT0

bool m_useEventT0 = true
private

Whether to use event T0 from CDC.

Definition at line 425 of file KLMTimeAlgorithm.h.

◆ mc_etime_channel

std::map<KLMChannelNumber, double> mc_etime_channel
private

Calibrated time distribution central value Error of each channel.

Definition at line 303 of file KLMTimeAlgorithm.h.

◆ mc_etime_channelAvg_rpc

double mc_etime_channelAvg_rpc = 0.0
private

Calibrated central value error of the global time distribution (BKLM RPC part).

Definition at line 367 of file KLMTimeAlgorithm.h.

◆ mc_etime_channelAvg_scint

double mc_etime_channelAvg_scint = 0.0
private

Calibrated central value error of the global time distribution (BKLM scintillator part).

Definition at line 375 of file KLMTimeAlgorithm.h.

◆ mc_etime_channelAvg_scint_end

double mc_etime_channelAvg_scint_end = 0.0
private

Calibrated central value error of the global time distribution (EKLM scintillator part).

Definition at line 383 of file KLMTimeAlgorithm.h.


The documentation for this class was generated from the following files: