Belle II Software development
CDCDedxValidationAlgorithm Class Reference

A validation algorithm for CDC dE/dx electron. More...

#include <CDCDedxValidationAlgorithm.h>

Inheritance diagram for CDCDedxValidationAlgorithm:
CalibrationAlgorithm

Public Types

enum  EResult {
  c_OK ,
  c_Iterate ,
  c_NotEnoughData ,
  c_Failure ,
  c_Undefined
}
 The result of calibration. More...
 

Public Member Functions

 CDCDedxValidationAlgorithm ()
 Constructor: Sets the description, the properties and the parameters of the algorithm.
 
virtual ~CDCDedxValidationAlgorithm ()
 Destructor.
 
void printCanvasRun (std::map< int, TH1D * > &htemp, std::string namesfx)
 Draw dE/dx per run histogram canvas.
 
void printCanvas (std::vector< TH1D * > &htemp, std::string namesfx, std::string svar)
 Draw dE/dx histograms across bins.
 
void fitGaussianWRange (TH1D *&temphist, std::string &status)
 Perform Gaussian fit with range on a histogram.
 
void getExpRunInfo ()
 function to get extract calibration run/exp
 
void defineHisto (std::vector< TH1D * > &htemp, std::string var, std::string stype)
 Define dE/dx histograms for plotting.
 
void wireGain (std::vector< TH1D * > &hdedxhit)
 Validate wire gain data using dE/dx histograms.
 
void printCanvasWire (std::vector< TH1D * > temp, std::string namesfx, const std::vector< double > &vdedx_mean)
 Plot dE/dx vs wire number.
 
void fit (TH1D *&hist, double &mean, double &meanErr, double &sigma, double &sigmaErr)
 Perform full Gaussian fit and extract parameters.
 
void bhabhaValidation ()
 Validate dE/dx using bhabha sample (vs run, cosine)
 
void radeeValidation ()
 Validate dE/dx using radee sample (vs momentum, injection time)
 
void defineTimeBins (std::vector< double > &vtlocaledges)
 Set bin edges for injection time.
 
void printCanvasdEdx (std::array< std::vector< TH1D * >, 2 > &htemp, std::string namesfx, std::string svar)
 Draw dE/dx histograms for momentum and cosine bins.
 
std::string getTimeBinLabel (const double &tedges, const int &it)
 Get time bin label string.
 
void setTestingPayload (const std::string &testingPayloadName)
 Set testing payload name.
 
void setGlobalTag (const std::string &globalTagName)
 Set Global Tag name.
 
void setTextCosmetics (TPaveText pt, Color_t color)
 Set text cosmetics for TPaveText.
 
void plotEventStats ()
 Plot summary statistics of selected events.
 
void DatabaseIN (int experiment, int run)
 Load database payload for given run.
 
WireGainData getwiregain (int experiment, int run)
 Retrieve wire gain data from DB.
 
CosGainData getcosgain (int experiment, int run)
 Retrieve cosine gain data from DB.
 
OnedData getonedgain (int experiment, int run)
 Retrieve 1D gain data from DB.
 
double getrungain (int experiment, int run)
 Retrieve run gain data from DB.
 
void resetDatabase ()
 Clear current DB pointers and state.
 
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 algorithm (set by developers in constructor)
 
bool loadInputJson (const std::string &jsonString)
 Load the m_inputJson variable from a string (useful from Python interface). The return 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
 Main calibration method.
 
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 internally 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

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

double m_sigmaR
 fit dedx dist in sigma range
 
int m_dedxBins
 bins for dedx histogram
 
double m_dedxMin
 min range of dedx
 
double m_dedxMax
 max range of dedx
 
int m_cosBins
 bins for cosine
 
double m_cosMin
 min range of cosine
 
double m_cosMax
 max range of cosine
 
int m_momBins
 bins for momentum
 
double m_momMin
 min range of momentum
 
double m_momMax
 max range of momentum
 
double * m_tedges
 internal time array (copy of vtlocaledges)
 
unsigned int m_tbins
 internal time bins
 
int m_eaBin
 
double m_eaMin
 lower edge of entrance angle
 
double m_eaMax
 upper edge of entrance angle
 
std::array< std::string, 2 > m_sring {"ler", "her"}
 injection ring name
 
std::string m_suffix
 suffix string to separate plots
 
DBObjPtr< CDCGeometrym_cdcGeo
 Geometry of CDC.
 
std::string m_testingPayloadName = ""
 Testing payload location.
 
std::string m_GlobalTagName = ""
 Global Tag name.
 
StoreObjPtr< EventMetaDatam_EventMetaData
 Event metadata.
 
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

A validation algorithm for CDC dE/dx electron.

Definition at line 86 of file CDCDedxValidationAlgorithm.h.

Member Enumeration Documentation

◆ EResult

enum EResult
inherited

The result of calibration.

Enumerator
c_OK 

Finished successfully =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,
43 c_NotEnoughData,
44 c_Failure,
45 c_Undefined
46 };

Constructor & Destructor Documentation

◆ CDCDedxValidationAlgorithm()

Constructor: Sets the description, the properties and the parameters of the algorithm.

Definition at line 37 of file CDCDedxValidationAlgorithm.cc.

37 :
38 CalibrationAlgorithm("ElectronValCollector"),
39 m_sigmaR(2.0),
40 m_dedxBins(600),
41 m_dedxMin(0.0),
42 m_dedxMax(5.0),
43 m_cosBins(100),
44 m_cosMin(-1.0),
45 m_cosMax(1.0),
46 m_momBins(80),
47 m_momMin(0.0),
48 m_momMax(8.0),
49 m_eaBin(316),
50 m_eaMin(-TMath::Pi() / 2),
51 m_eaMax(+TMath::Pi() / 2),
52 m_suffix("")
53{
54 // Set module properties
55 setDescription("A validation algorithm for CDC dE/dx electron");
56}
double m_eaMax
upper edge of entrance angle
double m_sigmaR
fit dedx dist in sigma range
std::string m_suffix
suffix string to separate plots
double m_eaMin
lower edge of entrance angle
void setDescription(const std::string &description)
Set algorithm description (in constructor)
CalibrationAlgorithm(const std::string &collectorModuleName)
Constructor - sets the prefix for collected objects (won't be accesses until execute(....

◆ ~CDCDedxValidationAlgorithm()

virtual ~CDCDedxValidationAlgorithm ( )
inlinevirtual

Destructor.

Definition at line 98 of file CDCDedxValidationAlgorithm.h.

98{}

Member Function Documentation

◆ bhabhaValidation()

void bhabhaValidation ( )

Validate dE/dx using bhabha sample (vs run, cosine)

Definition at line 251 of file CDCDedxValidationAlgorithm.cc.

252{
253 auto ttree = getObjectPtr<TTree>("tBhabha");
254
255 double dedx, costh;
256 int run, charge;
257
258 std::vector<int>* wire = 0;
259 ttree->SetBranchAddress("wire", &wire);
260
261 std::vector<double>* dedxhit = 0;
262 ttree->SetBranchAddress("dedxhit", &dedxhit);
263
264 ttree->SetBranchAddress("dedx", &dedx);
265 ttree->SetBranchAddress("run", &run);
266 ttree->SetBranchAddress("charge", &charge);
267 ttree->SetBranchAddress("costh", &costh);
268
269 std::map<int, TH1D*> hdedx_run;
270 std::array<std::vector<TH1D*>, 3> hdedx_cos;
271 std::array<std::vector<TH1D*>, 2> hdedx_cos_peaks;
272 std::vector<TH1D*> hdedxhit(c_nSenseWires);
273
274 const double cosBinWidth = (m_cosMax - m_cosMin) / m_cosBins;
275 const double cosBinW = (m_cosMax - m_cosMin) / 4;
276
277 std::string stype[3] = {"all", "posi", "elec"};
278
279 for (int it = 0; it < 3; ++it) {
280 hdedx_cos[it].resize(m_cosBins);
281 defineHisto(hdedx_cos[it], "costh", stype[it]);
282 }
283
284 for (int ir = 0; ir < 2; ir++) {
285 hdedx_cos_peaks[ir].resize(4);
286 defineHisto(hdedx_cos_peaks[ir], "cos_peaks", Form("%s", stype[ir + 1].data()));
287 }
288
289 defineHisto(hdedxhit, "wire", "wire");
290
291 // Loop over all the entries in the tree
292 for (int i = 0; i < ttree->GetEntries(); ++i) {
293 ttree->GetEvent(i);
294 if (dedx <= 0) continue;
295
296 // Check if a dE/dx histogram for this run number already exists
297 if (hdedx_run.find(run) == hdedx_run.end()) {
298 std::string histName = Form("hist_dedx_run_%d", run);
299 std::string histTitle = Form("dE/dx Histogram for Run %d", run);
300 hdedx_run[run] = new TH1D(histName.data(), histTitle.data(), m_dedxBins, m_dedxMin, m_dedxMax);
301 }
302
303 // Fill run-specific histogram
304 hdedx_run[run]->Fill(dedx);
305
306 // Fill cos(theta) histograms (all charge + by charge sign)
307 int binIndex = static_cast<int>((costh - m_cosMin) / cosBinWidth);
308 if (binIndex >= 0 && binIndex < m_cosBins) {
309 hdedx_cos[0][binIndex]->Fill(dedx); // All charge
310
311 if (charge > 0)
312 hdedx_cos[1][binIndex]->Fill(dedx);
313 else if (charge < 0)
314 hdedx_cos[2][binIndex]->Fill(dedx);
315 }
316
317 // Fill dE/dx for each wire hit
318 for (unsigned int j = 0; j < wire->size(); ++j) {
319 int jwire = wire->at(j);
320 double jhitdedx = dedxhit->at(j);
321 hdedxhit[jwire]->Fill(jhitdedx);
322 }
323
324 // Fill cos(theta) peaks histograms
325 int binI = static_cast<int>((costh - m_cosMin) / cosBinW);
326 if (binI >= 0 && binI < 4) {
327 if (charge > 0)
328 hdedx_cos_peaks[0][binI]->Fill(dedx);
329 else if (charge < 0)
330 hdedx_cos_peaks[1][binI]->Fill(dedx);
331 }
332 }
333
334 printCanvasRun(hdedx_run, Form("plots/run/dedx_vs_run_%s", m_suffix.data()));
335 printCanvas(hdedx_cos[0], Form("plots/costh/dedx_vs_cos_all_%s", m_suffix.data()), "costh");
336 printCanvas(hdedx_cos[1], Form("plots/costh/dedx_vs_cos_positrons_%s", m_suffix.data()), "costh");
337 printCanvas(hdedx_cos[2], Form("plots/costh/dedx_vs_cos_electrons_%s", m_suffix.data()), "costh");
338 printCanvasdEdx(hdedx_cos_peaks, Form("plots/costh/dedxpeaks_vs_cos_%s", m_suffix.data()), "costh");
339 wireGain(hdedxhit);
340}
void wireGain(std::vector< TH1D * > &hdedxhit)
Validate wire gain data using dE/dx histograms.
void printCanvasdEdx(std::array< std::vector< TH1D * >, 2 > &htemp, std::string namesfx, std::string svar)
Draw dE/dx histograms for momentum and cosine bins.
void printCanvasRun(std::map< int, TH1D * > &htemp, std::string namesfx)
Draw dE/dx per run histogram canvas.
void printCanvas(std::vector< TH1D * > &htemp, std::string namesfx, std::string svar)
Draw dE/dx histograms across bins.
void defineHisto(std::vector< TH1D * > &htemp, std::string var, std::string stype)
Define dE/dx histograms for plotting.
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 t...
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition EvtPDLUtil.cc:44

◆ 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 PXDAnalyticGainCalibrationAlgorithm, PXDValidationAlgorithm, SVD3SampleCoGTimeCalibrationAlgorithm, SVD3SampleELSTimeCalibrationAlgorithm, SVDCoGTimeCalibrationAlgorithm, TestBoundarySettingAlgorithm, and TestCalibrationAlgorithm.

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

Main calibration method.

Implements CalibrationAlgorithm.

Definition at line 62 of file CDCDedxValidationAlgorithm.cc.

63{
64
66
67 std::vector<std::string> subdirs = {"run", "costh", "mom", "wire", "injection", "oneD"};
68 for (const auto& dir : subdirs) {
69 gSystem->Exec(Form("mkdir -p plots/%s", dir.c_str()));
70 }
71
72 // Get data objects
73 auto tBhabha = getObjectPtr<TTree>("tBhabha");
74
75 // require at least 100 tracks
76 if (tBhabha->GetEntries() < 100) return c_NotEnoughData;
77
78 // Get data objects
79 auto tRadee = getObjectPtr<TTree>("tRadee");
80
81 // require at least 100 tracks
82 if (tRadee->GetEntries() < 100) return c_NotEnoughData;
83
87 return c_OK;
88}
void bhabhaValidation()
Validate dE/dx using bhabha sample (vs run, cosine)
void radeeValidation()
Validate dE/dx using radee sample (vs momentum, injection time)
void getExpRunInfo()
function to get extract calibration run/exp
void plotEventStats()
Plot summary statistics of selected events.
@ c_OK
Finished successfully =0 in Python.
@ c_NotEnoughData
Needs more data =2 in Python.

◆ 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.

324{m_data.clearCalibrationData();}

◆ 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:41
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
Definition Database.cc:140

◆ 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}

◆ DatabaseIN()

void DatabaseIN ( int experiment,
int run )

Load database payload for given run.

Parameters
experimentExperiment number
runRun number

Definition at line 833 of file CDCDedxValidationAlgorithm.cc.

834{
835 if (m_EventMetaData.isValid()) {
836 m_EventMetaData->setExperiment(experiment);
837 m_EventMetaData->setRun(run);
838 }
839
840 auto& dbConfiguration = Conditions::Configuration::getInstance();
841 dbConfiguration.setGlobalTags({"online"});
842 if (!m_testingPayloadName.empty() && m_GlobalTagName.empty()) {
843 dbConfiguration.prependTestingPayloadLocation(m_testingPayloadName);
844 } else if (m_testingPayloadName.empty() && !m_GlobalTagName.empty()) {
845 dbConfiguration.prependGlobalTag(m_GlobalTagName);
846 } else
847 B2FATAL("Setting both testing payload and Global Tag or setting no one of them.");
848
849 /* Mimic a module initialization. */
851 m_EventMetaData.registerInDataStore();
853 if (!m_EventMetaData.isValid())
854 m_EventMetaData.construct(1, run, experiment);
855
856 /* Database instance and configuration. */
857 DBStore& dbStore = DBStore::Instance();
858 dbStore.update();
859 dbStore.updateEvent();
860}
std::string m_testingPayloadName
Testing payload location.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
static Configuration & getInstance()
Get a reference to the instance which will be used when the Database is initialized.
static DataStore & Instance()
Instance of singleton Store.
Definition DataStore.cc:53
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition DataStore.cc:93
static DBStore & Instance()
Instance of a singleton DBStore.
Definition DBStore.cc:26
void updateEvent()
Updates all intra-run dependent objects.
Definition DBStore.cc:140
void update()
Updates all objects that are outside their interval of validity.
Definition DBStore.cc:77

◆ defineHisto()

void defineHisto ( std::vector< TH1D * > & htemp,
std::string var,
std::string stype )

Define dE/dx histograms for plotting.

Parameters
htempVector to hold histograms
varVariable name
stypecharge type

Definition at line 343 of file CDCDedxValidationAlgorithm.cc.

344{
345 int xbins;
346 double xmin, xmax;
347 double binWidth = 0.0;
348
349 if (var == "mom") {
350 xbins = m_momBins; xmin = m_momMin; xmax = m_momMax;
351 } else if (var == "oned") {
352 xbins = m_eaBin; xmin = m_eaMin; xmax = m_eaMax; m_dedxBins = 250;
353 } else if (var == "costh") {
354 xbins = m_cosBins; xmin = m_cosMin; xmax = m_cosMax;
355 } else if (var == "inj") {
356 xbins = m_tbins;
357 } else if (var == "mom_peaks") {
358 xbins = 4; xmin = m_momMin; xmax = 4.0;
359 } else if (var == "cos_peaks") {
360 xbins = 4; xmin = m_cosMin; xmax = m_cosMax;
361 } else {
362 xbins = c_nSenseWires; m_dedxBins = 250;
363 }
364
365 if (var == "costh" || var == "mom" || var == "mom_peaks" || var == "cos_peaks" || var == "oned") {
366 binWidth = (xmax - xmin) / xbins;
367 }
368
369 for (int ic = 0; ic < xbins; ic++) {
370 std::string title = Form("dedxhit-dist, wire:%d", ic);
371 std::string name = Form("hdedx_%s_%d", var.data(), ic);
372
373 if (var == "costh" || var == "mom" || var == "mom_peaks" || var == "cos_peaks" || var == "oned") {
374 double min = ic * binWidth + xmin;
375 double max = min + binWidth;
376 title = Form("%s: (%0.02f, %0.02f) %s", var.data(), min, max, stype.data());
377 name = Form("hdedx_%s_%s_%d", var.data(), stype.data(), ic);
378 } else if (var == "inj") {
379 std::string label = getTimeBinLabel(m_tedges[ic], ic);
380 title = Form("%s, time(%s)", stype.data(), label.data());
381 name = Form("h%s_%s_t%d", var.data(), stype.data(), ic);
382 }
383 htemp[ic] = new TH1D(name.data(), "", m_dedxBins, m_dedxMin, m_dedxMax);
384 htemp[ic]->SetTitle(Form("%s;dedx;entries", title.data()));
385 }
386}
double * m_tedges
internal time array (copy of vtlocaledges)
std::string getTimeBinLabel(const double &tedges, const int &it)
Get time bin label string.

◆ defineTimeBins()

void defineTimeBins ( std::vector< double > & vtlocaledges)

Set bin edges for injection time.

Parameters
vtlocaledgesVector of time bin edges

Definition at line 792 of file CDCDedxValidationAlgorithm.cc.

793{
794 double fixedges[69];
795 for (int ib = 0; ib < 69; ib++) {
796 fixedges[ib] = ib * 0.5 * 1e3;
797 if (ib > 40 && ib <= 60) fixedges[ib] = fixedges[ib - 1] + 1.0 * 1e3;
798 else if (ib > 60 && ib <= 64) fixedges[ib] = fixedges[ib - 1] + 10.0 * 1e3;
799 else if (ib > 64 && ib <= 65) fixedges[ib] = fixedges[ib - 1] + 420.0 * 1e3;
800 else if (ib > 65 && ib <= 66) fixedges[ib] = fixedges[ib - 1] + 500.0 * 1e3;
801 else if (ib > 66) fixedges[ib] = fixedges[ib - 1] + 2e6;
802 vtlocaledges.push_back(fixedges[ib]);
803 }
804}

◆ 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();}

◆ 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++");
100 m_data.setResult(c_Failure);
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).");
108 m_data.setResult(c_Failure);
109 return c_Failure;
110 }
111 return execute(vecRuns, iteration, iov);
112}
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.
ExecutionData m_data
Data specific to a SINGLE execution of the algorithm. Gets reset at the beginning of execution.

◆ 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()");
124 m_data.setResult(c_Failure);
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.");
144 m_data.setResult(c_Failure);
145 return c_Failure;
146 }
147 for (auto expRun : runs) {
148 B2DEBUG(29, "ExpRun requested = (" << expRun.first << ", " << expRun.second << ")");
149 }
150 }
151
152 m_data.setRequestedRuns(runs);
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 }
157 m_data.setRequestedIov(iov);
158 // After here, the getObject<...>(...) helpers start to work
159
161 m_data.setResult(result);
162 return result;
163}
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...
EResult
The result of calibration.
@ c_Undefined
Not yet known (before execution) =4 in Python.
virtual EResult calibrate()=0
Run algo on data - pure virtual: needs to be implemented.
std::string getGranularity() const
Get the granularity of collected data.

◆ 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...
const std::set< Calibration::ExpRun > & getExpRunSet()
Get access to the stored set.
Definition RunRange.h:64

◆ 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
558 m_data.clearCalibrationData();
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...

◆ fit()

void fit ( TH1D *& hist,
double & mean,
double & meanErr,
double & sigma,
double & sigmaErr )

Perform full Gaussian fit and extract parameters.

Parameters
histHistogram to fit
meanFitted mean
meanErrError on the mean
sigmaFitted sigma
sigmaErrError on the sigma

Definition at line 565 of file CDCDedxValidationAlgorithm.cc.

566{
567
568 std::string status = "";
569
570 if (hist->Integral() > 100)
571 fitGaussianWRange(hist, status);
572
573 if (status != "fitOK") {
574 hist->SetFillColor(kOrange);
575 mean = 0.0, meanErr = 0.0, sigma = 0.0, sigmaErr = 0.0;
576 } else {
577 mean = hist->GetFunction("gaus")->GetParameter(1);
578 meanErr = hist->GetFunction("gaus")->GetParError(1);
579 sigma = hist->GetFunction("gaus")->GetParameter(2);
580 sigmaErr = hist->GetFunction("gaus")->GetParError(2);
581 hist->SetFillColor(kYellow);
582 }
583}
void fitGaussianWRange(TH1D *&temphist, std::string &status)
Perform Gaussian fit with range on a histogram.

◆ fitGaussianWRange()

void fitGaussianWRange ( TH1D *& temphist,
std::string & status )

Perform Gaussian fit with range on a histogram.

Parameters
temphistHistogram to fit
statusStatus string updated based on fit result

Definition at line 643 of file CDCDedxValidationAlgorithm.cc.

644{
645 double histmean = temphist->GetMean();
646 double histrms = temphist->GetRMS();
647 temphist->GetXaxis()->SetRangeUser(histmean - 5.0 * histrms, histmean + 5.0 * histrms);
648
649 int fs = temphist->Fit("gaus", "Q0");
650 if (fs != 0) {
651 B2INFO(Form("\tFit (round 1) for hist (%s) failed (status = %d)", temphist->GetName(), fs));
652 status = "fitFailed";
653 return;
654 } else {
655 double mean = temphist->GetFunction("gaus")->GetParameter(1);
656 double width = temphist->GetFunction("gaus")->GetParameter(2);
657 temphist->GetXaxis()->SetRangeUser(mean - 5.0 * width, mean + 5.0 * width);
658 fs = temphist->Fit("gaus", "QR", "", mean - m_sigmaR * width, mean + m_sigmaR * width);
659 if (fs != 0) {
660 B2INFO(Form("\tFit (round 2) for hist (%s) failed (status = %d)", temphist->GetName(), fs));
661 status = "fitFailed";
662 return;
663 } else {
664 temphist->GetXaxis()->SetRangeUser(mean - 5.0 * width, mean + 5.0 * width);
665 B2INFO(Form("\tFit for hist (%s) successful (status = %d)", temphist->GetName(), fs));
666 status = "fitOK";
667 }
668 }
669}

◆ 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;}

◆ 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 algorithm.

Definition at line 164 of file CalibrationAlgorithm.h.

164{return getPrefix();}

◆ getcosgain()

CosGainData getcosgain ( int experiment,
int run )

Retrieve cosine gain data from DB.

Parameters
experimentExperiment number
runRun number
Returns
CosGainData structure

Definition at line 900 of file CDCDedxValidationAlgorithm.cc.

901{
902
903 DatabaseIN(experiment, run);
904
905 std::vector<double> cosgain, cos;
906
907 DBObjPtr<CDCDedxCosineCor> DBCosineCor;
908 if (!DBCosineCor.isValid()) B2FATAL("Cosine gain data are not valid.");
909
910 unsigned int nCosBins = DBCosineCor->getSize();
911
912 for (unsigned int il = 0; il < nCosBins; ++il) {
913 double costh = -1.0 + (il + 0.5) * 2.0 / nCosBins;
914 costh += .000001;
915 cosgain.push_back(DBCosineCor->getMean(il));
916 cos.push_back(costh);
917 }
918
920 return {cosgain, cos};
921}
void resetDatabase()
Clear current DB pointers and state.
void DatabaseIN(int experiment, int run)
Load database payload for given run.
bool isValid() const
Check whether a valid object was obtained from the database.

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

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

Definition at line 216 of file CalibrationAlgorithm.h.

216{return m_description;}

◆ getExpRunInfo()

void getExpRunInfo ( )

function to get extract calibration run/exp

Definition at line 91 of file CDCDedxValidationAlgorithm.cc.

92{
93
94 int cruns = 0;
95 for (auto expRun : getRunList()) {
96 if (cruns == 0) B2INFO("start exp " << expRun.first << " and run " << expRun.second << "");
97 cruns++;
98 }
99
100 const auto erStart = getRunList()[0];
101 int estart = erStart.first;
102 int rstart = erStart.second;
103
104 updateDBObjPtrs(1, rstart, estart);
105
106 if (m_suffix.length() > 0) m_suffix = Form("%s_e%d_r%d", m_suffix.data(), estart, rstart);
107 else m_suffix = Form("e%d_r%d", estart, rstart);
108}
void updateDBObjPtrs(const unsigned int event, const int run, const int experiment)
Updates any DBObjPtrs by calling update(event) for DBStore.
const std::vector< Calibration::ExpRun > & getRunList() const
Get the list of runs for which calibration is called.

◆ 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;};

◆ 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;}

◆ getInputJsonValue()

template<class T>
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(); }

◆ getObjectPtr()

template<class T>
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)
288 fillRunToInputFilesMap();
289 return getObjectPtr<T>(name, m_data.getRequestedRuns());
290 }

◆ getonedgain()

OnedData getonedgain ( int experiment,
int run )

Retrieve 1D gain data from DB.

Parameters
experimentExperiment number
runRun number
Returns
OnedData structure

Definition at line 923 of file CDCDedxValidationAlgorithm.cc.

924{
925
926 DatabaseIN(experiment, run);
927
928 std::vector<double> inner1D, outer1D, Enta;
929
930 DBObjPtr<CDCDedx1DCell> DBOneDCell;
931 if (!DBOneDCell.isValid()) B2FATAL("OneD cell gain data are not valid.");
932
933 for (int i = 0; i < 2; i++) {
934
935 unsigned int nBins = DBOneDCell->getNBins(i);
936 double binSize = TMath::Pi() / nBins;
937
938 for (unsigned int nbin = 0; nbin < nBins; nbin++) {
939
940 double enta = (-1 * TMath::Pi() / 2.0) + binSize * nbin;
941 if (i == 0) {
942 Enta.push_back(enta);
943 inner1D.push_back(DBOneDCell->getMean(0, nbin));
944 } else
945 outer1D.push_back(DBOneDCell->getMean(17, nbin));
946 }
947 }
949 return {inner1D, outer1D, Enta};
950
951}

◆ getOutputJsonValue()

template<class T>
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();}

◆ 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();}

◆ 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;}

◆ getrungain()

double getrungain ( int experiment,
int run )

Retrieve run gain data from DB.

Parameters
experimentExperiment number
runRun number
Returns
double

Definition at line 953 of file CDCDedxValidationAlgorithm.cc.

954{
955
956 DatabaseIN(experiment, run);
957
958 DBObjPtr<CDCDedxRunGain> RunGain;
959 if (!RunGain.isValid()) B2FATAL("Run gain data are not valid.");
960 double gain = RunGain->getRunGain();
961 return gain;
962}

◆ 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

◆ getTimeBinLabel()

std::string getTimeBinLabel ( const double & tedges,
const int & it )
inline

Get time bin label string.

Parameters
tedgesTime edge
itIndex of the bin
Returns
Formatted time bin label string

Definition at line 189 of file CDCDedxValidationAlgorithm.h.

190 {
191 std::string label = "";
192 if (tedges < 2e4)label = Form("%0.01f-%0.01fK", m_tedges[it] / 1e3, m_tedges[it + 1] / 1e3);
193 else if (tedges < 1e5)label = Form("%0.0f-%0.0fK", m_tedges[it] / 1e3, m_tedges[it + 1] / 1e3);
194 else label = Form("%0.01f-%0.01fM", m_tedges[it] / 1e6, m_tedges[it + 1] / 1e6);
195 return label;
196 }

◆ 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;}

◆ getwiregain()

WireGainData getwiregain ( int experiment,
int run )

Retrieve wire gain data from DB.

Parameters
experimentExperiment number
runRun number
Returns
WireGainData structure

Definition at line 862 of file CDCDedxValidationAlgorithm.cc.

863{
864
865 DatabaseIN(experiment, run);
866
867 std::vector<double> wiregain;
868 std::vector<double> layermean(c_maxNSenseLayers);
869
870 DBObjPtr<CDCDedxWireGain> DBWireGains;
871 if (!DBWireGains.isValid()) B2FATAL("Wire gain data are not valid.");
872
873 CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance(&(*m_cdcGeo));
874
875 int jwire = -1;
876 for (unsigned int il = 0; il < c_maxNSenseLayers; ++il) {
877
878 int activewires = 0;
879 layermean[il] = 0.0;
880
881 for (unsigned int iw = 0; iw < cdcgeo.nWiresInLayer(il); ++iw) {
882 jwire++;
883
884 wiregain.push_back(DBWireGains->getWireGain(jwire));
885
886 if (wiregain.at(jwire) > 0) {
887 layermean[il] += wiregain.at(jwire);
888 activewires++;
889 }
890 }
891
892 if (activewires > 0) layermean[il] /= activewires;
893 else layermean[il] = 1.0;
894 }
895
897 return { wiregain, layermean };
898}
DBObjPtr< CDCGeometry > m_cdcGeo
Geometry of CDC.
unsigned nWiresInLayer(int layerId) const
Returns wire numbers in a layer.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.

◆ 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 PXDAnalyticGainCalibrationAlgorithm, PXDValidationAlgorithm, SVD3SampleCoGTimeCalibrationAlgorithm, SVD3SampleELSTimeCalibrationAlgorithm, SVDCoGTimeCalibrationAlgorithm, TestBoundarySettingAlgorithm, and TestCalibrationAlgorithm.

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 return 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}
nlohmann::json m_jsonExecutionInput
Optional input JSON object used to make decisions about how to execute the algorithm code.

◆ plotEventStats()

void plotEventStats ( )

Plot summary statistics of selected events.

Definition at line 807 of file CDCDedxValidationAlgorithm.cc.

808{
809
810 TCanvas cstats("cstats", "cstats", 800, 400);
811 cstats.SetBatch(kTRUE);
812 cstats.Divide(2, 1);
813
814 cstats.cd(1);
815 auto hestats = getObjectPtr<TH1I>("hestats");
816 if (hestats) {
817 hestats->SetName(Form("hestats_%s", m_suffix.data()));
818 hestats->SetStats(0);
819 hestats->DrawCopy("");
820 }
821
822 cstats.cd(2);
823 auto htstats = getObjectPtr<TH1I>("htstats");
824 if (htstats) {
825 htstats->SetName(Form("htstats_%s", m_suffix.data()));
826 htstats->SetStats(0);
827 htstats->DrawCopy("");
828 }
829
830 cstats.Print(Form("cdcdedx_stats_%s.pdf", m_suffix.data()));
831}

◆ printCanvas()

void printCanvas ( std::vector< TH1D * > & htemp,
std::string namesfx,
std::string svar )

Draw dE/dx histograms across bins.

Parameters
htempVector of histograms
namesfxSuffix to distinguish output
svarVariable name for binning

Definition at line 475 of file CDCDedxValidationAlgorithm.cc.

476{
477 int xbins;
478 double xmin, xmax;
479
480 if (svar == "mom") {
481 xbins = m_momBins; xmin = m_momMin; xmax = m_momMax;
482 } else if (svar == "oned") {
483 xbins = m_eaBin; xmin = m_eaMin; xmax = m_eaMax;
484 } else if (svar == "costh") {
485 xbins = m_cosBins; xmin = m_cosMin; xmax = m_cosMax;
486 } else if (svar == "inj") {
487 xbins = m_tbins;
488 } else if (svar == "mom_peaks") {
489 xbins = 4; xmin = m_momMin; xmax = 4.0;
490 } else {
491 B2FATAL("wrong input");
492 }
493
494 // Set up the TCanvas with 4x4 grid
495 TCanvas* ctmp = new TCanvas("tmp", "tmp", 1200, 1200);
496 ctmp->Divide(4, 4); // Divide into 4x4 grid
497
498 // Prepare the PDF output
499 std::stringstream psname;
500 psname << Form("%s.pdf[", namesfx.data());
501 ctmp->Print(psname.str().c_str());
502 psname.str("");
503 psname << Form("%s.pdf", namesfx.data());
504
505 std::ofstream outFile;
506 outFile.open(Form("%s.txt", namesfx.data()));
507 CDCDedxWireGainAlgorithm wireg;
508
509 // Iterate through the histograms and plot them in the canvas
510 for (int i = 0; i < xbins; ++i) {
511
512 ctmp->cd(i % 16 + 1);
513 TPaveText pt(0.6, 0.73, 0.85, 0.89, "NBNDC");
514 setTextCosmetics(pt, kBlack);
515
516 if (svar == "oned") {
517 unsigned int minbin, maxbin;
518 wireg.getTruncatedBins(htemp[i], minbin, maxbin);
519 htemp[i]->SetTitle(Form("dedxhit-dist, entabin: %d ;%d;%d", i, minbin, maxbin));
520
521 double dedxmean = wireg.getTruncationMean(htemp[i], minbin, maxbin);
522
523 const double binWidth = (xmax - xmin) / xbins;
524 double binCenter = xmin + (i + 0.5) * binWidth; // Calculate bin center for cos(theta) or mom
525
526 outFile << binCenter << " " << dedxmean << std::endl;
527 } else {
528 double mean, meanErr, sigma, sigmaErr;
529 fit(htemp[i], mean, meanErr, sigma, sigmaErr);
530
531 if (svar == "mom" || svar == "costh" || svar == "mom_peaks") {
532 const double binWidth = (xmax - xmin) / xbins;
533 double binCenter = xmin + (i + 0.5) * binWidth; // Calculate bin center for cos(theta) or mom
534
535 outFile << binCenter << " " << mean << " " << meanErr << " " << sigma << " " << sigmaErr << std::endl;
536 } else {
537 std::string label = getTimeBinLabel(m_tedges[i], i);
538 outFile << i << " " << label << " " << mean << " " << meanErr << " " << sigma << " " << sigmaErr << std::endl;
539 }
540
541 pt.AddText(Form("#mu_{fit}: %0.03f#pm%0.03f", mean, meanErr));
542 pt.AddText(Form("#sigma_{fit}: %0.03f#pm%0.03f", sigma, sigmaErr));
543 }
544 htemp[i]->SetStats(0);
545 htemp[i]->DrawCopy("");
546 pt.DrawClone("same");
547
548 if ((i + 1) % 16 == 0 || ((i + 1) == xbins)) {
549 ctmp->SetBatch(kTRUE);
550 ctmp->Print(psname.str().c_str());
551 ctmp->Clear("D");
552 }
553 }
554
555 // ctmp->Print(psname.str().c_str());
556 psname.str("");
557 psname << Form("%s.pdf]", namesfx.data());
558 ctmp->Print(psname.str().c_str());
559
560 outFile.close();
561
562 delete ctmp;
563}
void setTextCosmetics(TPaveText pt, Color_t color)
Set text cosmetics for TPaveText.
void fit(TH1D *&hist, double &mean, double &meanErr, double &sigma, double &sigmaErr)
Perform full Gaussian fit and extract parameters.
void getTruncatedBins(TH1D *hdedxhit, unsigned int &binlow, unsigned int &binhigh)
function to get bins of truncation from histogram
double getTruncationMean(TH1D *hdedxhit, int binlow, int binhigh)
function to get mean of truncation from histogram

◆ printCanvasdEdx()

void printCanvasdEdx ( std::array< std::vector< TH1D * >, 2 > & htemp,
std::string namesfx,
std::string svar )

Draw dE/dx histograms for momentum and cosine bins.

Parameters
htempArray of vectors of histograms
namesfxSuffix to distinguish output
svarVariable name ("momentum" or "cosTheta")

Definition at line 388 of file CDCDedxValidationAlgorithm.cc.

389{
390 int xbins = 4;
391 double xmin, xmax;
392
393 if (svar == "mom") {
394 xmin = m_momMin; xmax = 4.0;
395 } else if (svar == "costh") {
396 xmin = m_cosMin; xmax = m_cosMax;
397 } else {
398 B2FATAL("wrong input");
399 }
400 double binWidth = (xmax - xmin) / xbins;
401
402 // Set up the TCanvas with 2x2 grid
403 TCanvas* ctmp = new TCanvas("tmp", "tmp", 1200, 1200);
404 ctmp->Divide(2, 2); // Divide into 2x2 grid
405
406 // Prepare the PDF output
407 std::stringstream psname;
408 psname << Form("%s.pdf[", namesfx.data());
409 ctmp->Print(psname.str().c_str());
410 psname.str("");
411 psname << Form("%s.pdf", namesfx.data());
412
413 // Iterate through the histograms and plot them in the canvas
414 for (int i = 0; i < xbins; ++i) {
415
416 ctmp->cd(i % 4 + 1);
417
418 double emean, emeanErr, esigma, esigmaErr;
419 double pmean, pmeanErr, psigma, psigmaErr;
420
421 fit(htemp[0][i], emean, emeanErr, esigma, esigmaErr);
422 fit(htemp[1][i], pmean, pmeanErr, psigma, psigmaErr);
423
424 double min = i * binWidth + xmin;
425 double max = min + binWidth;
426
427 TPaveText pt(0.6, 0.63, 0.85, 0.89, "NBNDC");
428 setTextCosmetics(pt, kBlack);
429 pt.AddText("e+");
430 pt.AddText(Form("#mu_{fit}: %0.03f#pm%0.03f", emean, emeanErr));
431 pt.AddText(Form("#sigma_{fit}: %0.03f#pm%0.03f", esigma, esigmaErr));
432
433 pt.AddText("e-");
434 pt.AddText(Form("#mu_{fit}: %0.03f#pm%0.03f", pmean, pmeanErr));
435 pt.AddText(Form("#sigma_{fit}: %0.03f#pm%0.03f", psigma, psigmaErr));
436
437 htemp[0][i]->SetStats(0);
438 htemp[1][i]->SetStats(0);
439 htemp[0][i]->SetFillColor(0);
440 htemp[1][i]->SetFillColor(0);
441 htemp[0][i]->SetLineColor(8);
442 htemp[1][i]->SetLineColor(9);
443 htemp[0][i]->SetTitle(Form("%s: (%0.02f, %0.02f)", svar.data(), min, max));
444 if (htemp[0][i]->GetEntries() > 0)
445 htemp[0][i]->Scale(1.0 / htemp[0][i]->GetEntries());
446 if (htemp[1][i]->GetEntries() > 0)
447 htemp[1][i]->Scale(1.0 / htemp[1][i]->GetEntries());
448
449 if (htemp[1][i]->GetMaximum() > htemp[0][i]->GetMaximum())
450 htemp[0][i]->SetMaximum(htemp[1][i]->GetMaximum());
451
452 htemp[0][i]->DrawCopy("HIST");
453 htemp[1][i]->DrawCopy("same HIST");
454 pt.DrawClone("same");
455
456 TLegend* lego = new TLegend(0.15, 0.67, 0.3, 0.8);
457 lego->AddEntry(htemp[0][i], "e+", "l");
458 lego->AddEntry(htemp[1][i], "e-", "l");
459 lego->Draw("same");
460
461 if ((i + 1) % 4 == 0 || i == xbins - 1) {
462 ctmp->SetBatch(kTRUE);
463 ctmp->Print(psname.str().c_str());
464 if ((i + 1) % 4 == 0) ctmp->Clear("D");
465 }
466 }
467
468 psname.str("");
469 psname << Form("%s.pdf]", namesfx.data());
470 ctmp->Print(psname.str().c_str());
471
472 delete ctmp;
473}

◆ printCanvasRun()

void printCanvasRun ( std::map< int, TH1D * > & htemp,
std::string namesfx )

Draw dE/dx per run histogram canvas.

Parameters
htempHistogram map (run number -> TH1D pointer)
namesfxSuffix to distinguish output

Definition at line 585 of file CDCDedxValidationAlgorithm.cc.

586{
587 // Set up the TCanvas with 4x4 grid
588 TCanvas* ctmp = new TCanvas("tmp", "tmp", 1200, 1200);
589 ctmp->Divide(4, 4); // Divide into 4x4 grid
590
591 // Prepare the PDF output
592 std::stringstream psname;
593 psname << Form("%s.pdf[", namesfx.data());
594 ctmp->Print(psname.str().c_str());
595 psname.str("");
596 psname << Form("%s.pdf", namesfx.data());
597
598 std::ofstream outFile;
599 outFile.open(Form("%s.txt", namesfx.data()));
600
601 // Iterate through the histograms and plot them in the canvas
602 int irun = 0;
603 for (const auto& entry : htemp) {
604 int run = entry.first;
605 TH1D* hist = entry.second;
606
607 ctmp->cd(irun % 16 + 1);
608
609 TPaveText pt(0.6, 0.73, 0.85, 0.89, "NBNDC");
610 setTextCosmetics(pt, kBlack);
611
612 double mean, meanErr, sigma, sigmaErr;
613 fit(hist, mean, meanErr, sigma, sigmaErr);
614
615 outFile << run << " " << mean << " " << meanErr << " " << sigma << " " << sigmaErr << std::endl;
616
617 pt.AddText(Form("#mu_{fit}: %0.03f#pm%0.03f", mean, meanErr));
618 pt.AddText(Form("#sigma_{fit}: %0.03f#pm%0.03f", sigma, sigmaErr));
619
620 hist->SetStats(0);
621 hist->DrawCopy("");
622 pt.DrawClone("same");
623
624 if ((irun + 1) % 16 == 0 || irun == int(htemp.size() - 1)) {
625 ctmp->SetBatch(kTRUE);
626 ctmp->Print(psname.str().c_str());
627 ctmp->Clear("D");
628 }
629 irun++;
630 }
631
632 ctmp->Print(psname.str().c_str());
633 psname.str("");
634 psname << Form("%s.pdf]", namesfx.data());
635 ctmp->Print(psname.str().c_str());
636
637 outFile.close();
638
639 delete ctmp;
640}

◆ printCanvasWire()

void printCanvasWire ( std::vector< TH1D * > temp,
std::string namesfx,
const std::vector< double > & vdedx_mean )

Plot dE/dx vs wire number.

Parameters
tempVector of histograms
namesfxSuffix to distinguish output
vdedx_meanVector of mean dE/dx values

Definition at line 750 of file CDCDedxValidationAlgorithm.cc.

752{
753 TCanvas* ctmp = new TCanvas("tmp", "tmp", 900, 900);
754 ctmp->Divide(4, 4);
755
756 std::stringstream psname;
757 psname << Form("%s.pdf[", namesfx.data());
758 ctmp->Print(psname.str().c_str());
759 psname.str("");
760 psname << Form("%s.pdf", namesfx.data());
761
762 for (unsigned int ip = 0; ip < c_nwireCDC; ip++) {
763 int minbin = std::stoi(temp[ip]->GetXaxis()->GetTitle());
764 int maxbin = std::stoi(temp[ip]->GetYaxis()->GetTitle());
765 temp[ip]->SetFillColor(kYellow - 9);
766 temp[ip]->SetTitle(Form("%s, #mu_{trunc} %0.03f;dedxhit;entries", temp[ip]->GetTitle(), vdedx_mean.at(ip)));
767
768 ctmp->cd(ip % 16 + 1);
769 gPad->cd();
770 temp[ip]->DrawCopy("hist");
771 TH1D* hdedxhitC = (TH1D*)temp[ip]->Clone(Form("%sC", temp[ip]->GetName()));
772 hdedxhitC->GetXaxis()->SetRange(minbin, maxbin);
773 hdedxhitC->SetFillColor(kAzure + 1);
774 hdedxhitC->DrawCopy("same histo");
775
776 if ((ip + 1) % 16 == 0) {
777 ctmp->SetBatch(kTRUE);
778 ctmp->Print(psname.str().c_str());
779 ctmp->Clear("D");
780 }
781 delete temp[ip];
782 delete hdedxhitC;
783
784 }
785
786 psname.str("");
787 psname << Form("%s.pdf]", namesfx.data());
788 ctmp->Print(psname.str().c_str());
789 delete ctmp;
790}

◆ radeeValidation()

void radeeValidation ( )

Validate dE/dx using radee sample (vs momentum, injection time)

Definition at line 111 of file CDCDedxValidationAlgorithm.cc.

112{
113 auto ttree = getObjectPtr<TTree>("tRadee");
114
115 double dedx, costh, p, injtime = 0.0, injring = 1.0;
116 int charge;
117
118 std::vector<double>* dedxhit = 0, *enta = 0;
119 std::vector<int>* layer = 0;
120
121 ttree->SetBranchAddress("dedx", &dedx);
122 ttree->SetBranchAddress("p", &p);
123 ttree->SetBranchAddress("costh", &costh);
124 ttree->SetBranchAddress("charge", &charge);
125 ttree->SetBranchAddress("injtime", &injtime);
126 ttree->SetBranchAddress("injring", &injring);
127 ttree->SetBranchAddress("dedxhit", &dedxhit);
128 ttree->SetBranchAddress("entaRS", &enta);
129 ttree->SetBranchAddress("layer", &layer);
130
131 std::vector<double> vtlocaledges;
132 defineTimeBins(vtlocaledges);
133 m_tbins = vtlocaledges.size() - 1;
134 m_tedges = &vtlocaledges[0];
135
136 std::array<std::array<std::vector<TH1D*>, 2>, 13> hdedx_mom;
137 std::array<std::vector<TH1D*>, 2> hdedx_mom_peaks, hdedx_inj, hdedx_oned;
138 TH1D* htimes = new TH1D("htimes", "", m_tbins, m_tedges);
139
140 const double momBinWidth = (m_momMax - m_momMin) / m_momBins;
141 const double momBinW = (4.0 - m_momMin) / 4;
142
143 std::string scos[13] = {"acos", "cos#theta > 0.0", "cos#theta < 0.0", "cos#theta <= -0.8",
144 "cos#theta > -0.8 and cos#theta <= -0.6",
145 "cos#theta > -0.6 and cos#theta <= -0.4", "cos#theta > -0.4 and cos#theta <= -0.2",
146 "cos#theta > -0.2 and cos#theta <= 0", "cos#theta > 0 and cos#theta <= 0.2",
147 "cos#theta > 0.2 and cos#theta <= 0.4", "cos#theta > 0.4 and cos#theta <= 0.6",
148 "cos#theta > 0.6 and cos#theta <= 0.8", "cos#theta > 0.8"
149 };
150 std::string stype[2] = {"posi", "elec"};
151 std::string sLayer[2] = {"IL", "OL"};
152
153 // Define histograms for momentum bins and charge types
154 for (int ic = 0; ic < 13; ic++) {
155 for (int it = 0; it < 2; ++it) {
156 hdedx_mom[ic][it].resize(m_momBins);
157 defineHisto(hdedx_mom[ic][it], "mom", Form("%d_%s", ic, stype[it].data()));
158 }
159 }
160
161 // Define histograms for injection time bins and rings
162 for (unsigned int ir = 0; ir < 2; ir++) {
163 hdedx_inj[ir].resize(m_tbins);
164 hdedx_mom_peaks[ir].resize(4);
165 hdedx_oned[ir].resize(m_eaBin);
166
167 defineHisto(hdedx_inj[ir], "inj", m_sring[ir].data());
168 defineHisto(hdedx_mom_peaks[ir], "mom_peaks", Form("%s", stype[ir].data()));
169 defineHisto(hdedx_oned[ir], "oned", Form("%s", sLayer[ir].data()));
170 }
171
172 double eaBW = (m_eaMax - m_eaMin) / m_eaBin;
173 double icos[3] = {0, -1, -1};
174 double chgtype;
175
176 // Loop over all the entries in the tree
177 for (int i = 0; i < ttree->GetEntries(); ++i) {
178 ttree->GetEvent(i);
179
180 // Skip invalid events
181 if (dedx <= 0 || injtime < 0 || injring < 0) continue;
182
183 // Calculate momentum bin index for hdedx_mom
184 int binIndex = static_cast<int>((abs(p) - m_momMin) / momBinWidth);
185
186 // Determine cos(theta) category
187
188 icos[1] = (costh > 0) ? 1 : 2;
189 icos[2] = int((costh + 1.0) / 0.2) + 3;
190 if (icos[2] < 3) icos[2] = 3;
191 if (icos[2] > 12) icos[2] = 12;
192
193 // Determine charge type
194 chgtype = (charge > 0) ? 0 : 1;
195
196 // Fill momentum histograms (only if binIndex is valid)
197 if (binIndex >= 0 && binIndex < m_momBins) {
198 hdedx_mom[icos[0]][chgtype][binIndex]->Fill(dedx);
199 hdedx_mom[icos[1]][chgtype][binIndex]->Fill(dedx);
200 hdedx_mom[icos[2]][chgtype][binIndex]->Fill(dedx);
201 }
202
203 // Add larger times to the last bin
204 if (injtime > m_tedges[m_tbins]) injtime = m_tedges[m_tbins] - 10.0;
205
206 // Injection ring type
207 int wr = (injring > 0.5) ? 1 : 0;
208
209 // Injection time bin
210 unsigned int tb = htimes->GetXaxis()->FindBin(injtime);
211 tb = std::min(tb, static_cast<unsigned int>(m_tbins)) - 1;
212
213 // Fill injection time and dE/dx histograms
214 htimes->Fill(injtime);
215 hdedx_inj[wr][tb]->Fill(dedx);
216
217 // Fill hdedx_mom_peaks with its own binning
218 int binI = static_cast<int>((abs(p) - m_momMin) / momBinW);
219 if (binI >= 0 && binI < 4) {
220 hdedx_mom_peaks[chgtype][binI]->Fill(dedx);
221 }
222
223 // Fill dE/dx in enta bins from hits
224 for (unsigned int j = 0; j < dedxhit->size(); ++j) {
225 if (dedxhit->at(j) == 0) continue;
226
227 double entaval = enta->at(j);
228 int ibin = std::floor((entaval - m_eaMin) / eaBW);
229 if (ibin < 0 || ibin >= m_eaBin) continue;
230
231 int mL = (layer->at(j) < 8) ? 0 : 1;
232 hdedx_oned[mL][ibin]->Fill(dedxhit->at(j));
233 }
234 }
235
236
237 for (int ic = 0; ic < 13; ic++) {
238 for (int it = 0; it < 2; ++it) {
239 printCanvas(hdedx_mom[ic][it], Form("plots/mom/dedx_vs_mom_%d_%s_%s", ic, stype[it].data(), m_suffix.data()), "mom");
240 }
241 }
242 for (int it = 0; it < 2; ++it) {
243 printCanvas(hdedx_inj[it], Form("plots/injection/dedx_vs_inj_%s_%s", m_sring[it].data(), m_suffix.data()), "inj");
244 printCanvas(hdedx_oned[it], Form("plots/oneD/dedx_vs_1D_%s_%s", sLayer[it].data(), m_suffix.data()), "oned");
245 }
246
247 printCanvasdEdx(hdedx_mom_peaks, Form("plots/mom/dedxpeaks_vs_mom_%s", m_suffix.data()), "mom");
248
249}
void defineTimeBins(std::vector< double > &vtlocaledges)
Set bin edges for injection time.
std::array< std::string, 2 > m_sring
injection ring name

◆ resetDatabase()

void resetDatabase ( )

Clear current DB pointers and state.

Definition at line 964 of file CDCDedxValidationAlgorithm.cc.

965{
966 /* Reset both DataStore and Database. */
968 Database::Instance().reset(false);
969 DBStore::Instance().reset(false);
970}
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition DataStore.cc:85
void reset(bool keepEntries=false)
Invalidate all payloads.
Definition DBStore.cc:175
static void reset(bool keepConfig=false)
Reset the database instance.
Definition Database.cc:49

◆ 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{
299 saveCalibration(data, name, m_data.getRequestedIov());
300}
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default 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:150

◆ 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{
294 saveCalibration(data, name, m_data.getRequestedIov());
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}

◆ 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;}

◆ setGlobalTag()

void setGlobalTag ( const std::string & globalTagName)
inline

Set Global Tag name.

Parameters
globalTagNameName of the global tag

Definition at line 211 of file CDCDedxValidationAlgorithm.h.

212 {
213 m_GlobalTagName = globalTagName;
214 }

◆ 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 m_granularityOfData
Granularity of input data. This only changes when the input files change so it isn't specific to an e...
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.

◆ setOutputJsonValue()

template<class T>
void setOutputJsonValue ( const std::string & key,
const T & value )
inlineprotectedinherited

Set a key:value pair for the outputJson object, expected to used internally 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;}

◆ setTestingPayload()

void setTestingPayload ( const std::string & testingPayloadName)
inline

Set testing payload name.

Parameters
testingPayloadNameName of the payload

Definition at line 202 of file CDCDedxValidationAlgorithm.h.

203 {
204 m_testingPayloadName = testingPayloadName;
205 }

◆ setTextCosmetics()

void setTextCosmetics ( TPaveText pt,
Color_t color )
inline

Set text cosmetics for TPaveText.

Parameters
ptTPaveText object
colorColor to apply

Definition at line 221 of file CDCDedxValidationAlgorithm.h.

222 {
223 pt.SetBorderSize(0);
224 pt.SetShadowColor(kWhite);
225 pt.SetTextColor(color);
226 }

◆ 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 unnecessary...)
412}

◆ wireGain()

void wireGain ( std::vector< TH1D * > & hdedxhit)

Validate wire gain data using dE/dx histograms.

Parameters
hdedxhitVector of dE/dx hit histograms

Definition at line 671 of file CDCDedxValidationAlgorithm.cc.

672{
673
674 std::vector<double> vdedx_means;
675 std::vector<double> layermean(c_maxNSenseLayers);
676 std::vector<double> lgmean(c_maxNSenseLayers);
677
678 std::ofstream outFile, outFileLayer, outFileAvg, outFilebdwire;
679 outFile.open(Form("plots/wire/dedx_mean_gwire_%s.txt", m_suffix.data()));
680 outFilebdwire.open(Form("plots/wire/dedx_mean_badwire_%s.txt", m_suffix.data()));
681 outFileLayer.open(Form("plots/wire/dedx_mean_layer_%s.txt", m_suffix.data()));
682 outFileAvg.open(Form("plots/wire/dedx_mean_layer_avg_%s.txt", m_suffix.data()));
683
684 int activelayers = 0;
685 double layeravg = 0.0;
686
687 CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance(&(*m_cdcGeo));
688 CDCDedxWireGainAlgorithm wireg;
689
690 DBObjPtr<CDCDedxBadWires> Badwire;
691
692 int jwire = -1;
693 for (unsigned int il = 0; il < c_maxNSenseLayers; ++il) {
694
695 int activewires = 0, goodwires = 0;
696 layermean[il] = 0.0;
697 lgmean[il] = 0.0;
698
699 for (unsigned int iw = 0; iw < cdcgeo.nWiresInLayer(il); ++iw) {
700 jwire++;
701
702 unsigned int minbin, maxbin;
703 wireg.getTruncatedBins(hdedxhit[jwire], minbin, maxbin);
704 hdedxhit[jwire]->SetTitle(Form("dedxhit-dist, wire: %d ;%d;%d", jwire, minbin, maxbin));
705
706 double dedxmean = wireg.getTruncationMean(hdedxhit[jwire], minbin, maxbin);
707 vdedx_means.push_back(dedxmean);
708
709 if (Badwire->getBadWireStatus(jwire) == kTRUE)
710 outFilebdwire << jwire << " " << dedxmean << std::endl;
711 else
712 outFile << jwire << " " << dedxmean << std::endl;
713
714 if (vdedx_means.at(jwire) > 0) {
715 layermean[il] += vdedx_means.at(jwire);
716 activewires++;
717 if (Badwire->getBadWireStatus(jwire) != kTRUE) {
718 lgmean[il] += vdedx_means.at(jwire);
719 goodwires++;
720 }
721 }
722 }
723
724 if (activewires > 0) layermean[il] /= activewires;
725 else layermean[il] = 1.0;
726
727 if (goodwires > 0) lgmean[il] /= goodwires;
728 else lgmean[il] = 1.0;
729
730 outFileLayer << il << " " << layermean[il] << " " << lgmean[il] << std::endl;
731
732 //calculate outer layer average for active layer
733 if (il >= 8 && layermean[il] > 0) {
734 layeravg += layermean[il];
735 activelayers++;
736 }
737 }
738
739 //normalisation of wiregains to get outergain ~1.0
740 if (activelayers > 0) layeravg /= activelayers;
741 outFileAvg << layeravg << std::endl;
742
743 outFile.close();
744 outFilebdwire.close();
745 outFileLayer.close();
746 outFileAvg.close();
747 printCanvasWire(hdedxhit, Form("plots/wire/dedx_vs_wire_%s", m_suffix.data()), vdedx_means);
748}
void printCanvasWire(std::vector< TH1D * > temp, std::string namesfx, const std::vector< double > &vdedx_mean)
Plot dE/dx vs wire number.

Member Data Documentation

◆ m_allExpRun

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

allExpRun

Definition at line 364 of file CalibrationAlgorithm.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_cdcGeo

DBObjPtr<CDCGeometry> m_cdcGeo
private

Geometry of CDC.

Definition at line 310 of file CDCDedxValidationAlgorithm.h.

◆ m_cosBins

int m_cosBins
private

bins for cosine

Definition at line 291 of file CDCDedxValidationAlgorithm.h.

◆ m_cosMax

double m_cosMax
private

max range of cosine

Definition at line 293 of file CDCDedxValidationAlgorithm.h.

◆ m_cosMin

double m_cosMin
private

min range of cosine

Definition at line 292 of file CDCDedxValidationAlgorithm.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_dedxBins

int m_dedxBins
private

bins for dedx histogram

Definition at line 287 of file CDCDedxValidationAlgorithm.h.

◆ m_dedxMax

double m_dedxMax
private

max range of dedx

Definition at line 289 of file CDCDedxValidationAlgorithm.h.

◆ m_dedxMin

double m_dedxMin
private

min range of dedx

Definition at line 288 of file CDCDedxValidationAlgorithm.h.

◆ m_description

std::string m_description {""}
privateinherited

Description of the algorithm.

Definition at line 385 of file CalibrationAlgorithm.h.

385{""};

◆ m_eaBin

int m_eaBin
private

of bins for entrance angle

Definition at line 302 of file CDCDedxValidationAlgorithm.h.

◆ m_eaMax

double m_eaMax
private

upper edge of entrance angle

Definition at line 304 of file CDCDedxValidationAlgorithm.h.

◆ m_eaMin

double m_eaMin
private

lower edge of entrance angle

Definition at line 303 of file CDCDedxValidationAlgorithm.h.

◆ m_EventMetaData

StoreObjPtr<EventMetaData> m_EventMetaData
private

Event metadata.

Definition at line 319 of file CDCDedxValidationAlgorithm.h.

◆ m_GlobalTagName

std::string m_GlobalTagName = ""
private

Global Tag name.

Definition at line 316 of file CDCDedxValidationAlgorithm.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_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_momBins

int m_momBins
private

bins for momentum

Definition at line 295 of file CDCDedxValidationAlgorithm.h.

◆ m_momMax

double m_momMax
private

max range of momentum

Definition at line 297 of file CDCDedxValidationAlgorithm.h.

◆ m_momMin

double m_momMin
private

min range of momentum

Definition at line 296 of file CDCDedxValidationAlgorithm.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.

388{""};

◆ 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_sigmaR

double m_sigmaR
private

fit dedx dist in sigma range

Definition at line 285 of file CDCDedxValidationAlgorithm.h.

◆ m_sring

std::array<std::string, 2> m_sring {"ler", "her"}
private

injection ring name

Definition at line 306 of file CDCDedxValidationAlgorithm.h.

306{"ler", "her"};

◆ m_suffix

std::string m_suffix
private

suffix string to separate plots

Definition at line 308 of file CDCDedxValidationAlgorithm.h.

◆ m_tbins

unsigned int m_tbins
private

internal time bins

Definition at line 300 of file CDCDedxValidationAlgorithm.h.

◆ m_tedges

double* m_tedges
private

internal time array (copy of vtlocaledges)

Definition at line 299 of file CDCDedxValidationAlgorithm.h.

◆ m_testingPayloadName

std::string m_testingPayloadName = ""
private

Testing payload location.

Definition at line 313 of file CDCDedxValidationAlgorithm.h.


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