Belle II Software development
ARICHCalibrationChecker Class Reference

ARICH calibration checker. More...

#include <ARICHCalibrationChecker.h>

Public Member Functions

 ARICHCalibrationChecker ()
 Constructor.
 
 ~ARICHCalibrationChecker ()
 Destructor.
 
void setExperimentRun (int experiment, int run)
 Set experiment and run numbers.
 
void setTestingPayload (const std::string &testingPayloadName)
 Set testing payload name.
 
void setGlobalTag (const std::string &globalTagName)
 Set Global Tag name.
 
void setChannelMaskResultsFile (const std::string &channelMaskResultsFile)
 Set channel mask results file.
 
void checkChannelMask ()
 Check channel mask.
 
int getSector (int modID)
 Get HAPD sector number.
 
int getRing (int modID)
 Get HAPD ring number.
 

Private Member Functions

void initializeDatabase ()
 Initialize the database.
 
void resetDatabase ()
 Reset the database.
 
template<class T>
void printPayloadInformation (DBObjPtr< T > &dbObject)
 Print payload information.
 

Private Attributes

int m_experiment
 Experiment number.
 
int m_run
 Run number.
 
std::string m_testingPayloadName = ""
 Testing payload location.
 
std::string m_GlobalTagName = ""
 Global Tag name.
 
std::string m_channelMaskResultsFile = "channel_mask.root"
 Output file for channel mask results.
 
StoreObjPtr< EventMetaDatam_EventMetaData
 Event metadata.
 

Detailed Description

ARICH calibration checker.

Definition at line 29 of file ARICHCalibrationChecker.h.

Constructor & Destructor Documentation

◆ ARICHCalibrationChecker()

Constructor.

Definition at line 27 of file ARICHCalibrationChecker.cc.

27 :
28 m_experiment(0),
29 m_run(0)
30{
31}

◆ ~ARICHCalibrationChecker()

Destructor.

Definition at line 33 of file ARICHCalibrationChecker.cc.

34{
35}

Member Function Documentation

◆ checkChannelMask()

void checkChannelMask ( )

Check channel mask.

Definition at line 101 of file ARICHCalibrationChecker.cc.

102{
103 /* Initialize the database. */
105 /* Now we can read the payload. */
106 DBObjPtr<ARICHChannelMask> channelMask;
107 if (!channelMask.isValid())
108 B2FATAL("ARICHChannelMask is not valid.");
109 if (m_GlobalTagName != "")
110 printPayloadInformation(channelMask);
111 /* Create tree with fractions of masked channels in each sector. */
112 float frac_masked_sector[6] = {0.};
113 float frac_masked = 0.;
114 TFile* channelMaskResults =
115 new TFile(m_channelMaskResultsFile.c_str(), "recreate");
116 TTree* maskTree = new TTree("arich_masked", "ARICH channel masking");
117 maskTree->Branch("experiment", &m_experiment, "experiment/I");
118 maskTree->Branch("run", &m_run, "run/I");
119 maskTree->Branch("frac_masked_sector", &frac_masked_sector, "frac_masked_sector[6]/F");
120 maskTree->Branch("frac_masked", &frac_masked, "frac_masked/F");
121
122 for (int mod = 1; mod < 421; mod++) {
123 int sector = getSector(mod);
124 for (int chn = 0; chn < 144; chn++) {
125 if (!channelMask->isActive(mod, chn)) { frac_masked_sector[sector - 1]++; frac_masked++;}
126 }
127 }
128
129 for (int sec = 0; sec < 6; sec++) frac_masked_sector[sec] /= 10080.;
130 frac_masked /= 60480.;
131 maskTree->Fill();
132
133 maskTree->Write();
134 delete maskTree;
135 delete channelMaskResults;
136 /* Reset the database. Needed to avoid mess if we call this method multiple times with different GTs. */
138}
void resetDatabase()
Reset the database.
void initializeDatabase()
Initialize the database.
std::string m_channelMaskResultsFile
Output file for channel mask results.
int getSector(int modID)
Get HAPD sector number.
std::string m_GlobalTagName
Global Tag name.
void printPayloadInformation(DBObjPtr< T > &dbObject)
Print payload information.
bool isValid() const
Check whether a valid object was obtained from the database.

◆ getRing()

int getRing ( int modID)

Get HAPD ring number.

Definition at line 77 of file ARICHCalibrationChecker.cc.

78{
79 if (modID <= 42) return 1;
80 if (modID <= 90) return 2;
81 if (modID <= 144) return 3;
82 if (modID <= 204) return 4;
83 if (modID <= 270) return 5;
84 if (modID <= 342) return 6;
85 if (modID <= 420) return 7;
86 return 0;
87}

◆ getSector()

int getSector ( int modID)

Get HAPD sector number.

Definition at line 89 of file ARICHCalibrationChecker.cc.

90{
91 if (getRing(modID) == 1) return (modID - 1) / 7 + 1;
92 if (getRing(modID) == 2) return (modID - 43) / 8 + 1;
93 if (getRing(modID) == 3) return (modID - 91) / 9 + 1;
94 if (getRing(modID) == 4) return (modID - 145) / 10 + 1;
95 if (getRing(modID) == 5) return (modID - 205) / 11 + 1;
96 if (getRing(modID) == 6) return (modID - 271) / 12 + 1;
97 if (getRing(modID) == 7) return (modID - 343) / 13 + 1;
98 return 0;
99}
int getRing(int modID)
Get HAPD ring number.

◆ initializeDatabase()

void initializeDatabase ( )
private

Initialize the database.

Definition at line 47 of file ARICHCalibrationChecker.cc.

48{
49 /* Mimic a module initialization. */
51 m_EventMetaData.registerInDataStore();
53 if (!m_EventMetaData.isValid())
54 m_EventMetaData.construct(1, m_run, m_experiment);
55 /* Database instance and configuration. */
56 DBStore& dbStore = DBStore::Instance();
57 dbStore.update();
58 dbStore.updateEvent();
59 auto& dbConfiguration = Conditions::Configuration::getInstance();
60 if ((m_testingPayloadName != "") and (m_GlobalTagName == ""))
61 dbConfiguration.prependTestingPayloadLocation(m_testingPayloadName);
62 else if ((m_testingPayloadName == "") and (m_GlobalTagName != ""))
63 dbConfiguration.prependGlobalTag(m_GlobalTagName);
64 else
65 B2FATAL("Setting both testing payload and Global Tag or setting no one of them.");
66}
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

◆ printPayloadInformation()

template<class T>
void printPayloadInformation ( DBObjPtr< T > & dbObject)
inlineprivate

Print payload information.

Definition at line 103 of file ARICHCalibrationChecker.h.

104 {
105 B2INFO("Analyzing the following payload:"
106 << LogVar("Global Tag", m_GlobalTagName.c_str())
107 << LogVar("Name", dbObject.getName())
108 << LogVar("Revision", dbObject.getRevision())
109 << LogVar("IoV", dbObject.getIoV()));
110 }

◆ resetDatabase()

void resetDatabase ( )
private

Reset the database.

Definition at line 68 of file ARICHCalibrationChecker.cc.

69{
70 /* Reset both DataStore and Database. */
72 // Database::Instance().reset(false);
73 Database::Instance().reset(true); // keep the configuration
74 DBStore::Instance().reset(false);
75}
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 Database & Instance()
Instance of a singleton Database.
Definition Database.cc:41
static void reset(bool keepConfig=false)
Reset the database instance.
Definition Database.cc:49

◆ setChannelMaskResultsFile()

void setChannelMaskResultsFile ( const std::string & channelMaskResultsFile)
inline

Set channel mask results file.

Definition at line 67 of file ARICHCalibrationChecker.h.

69 {
70 m_channelMaskResultsFile = channelMaskResultsFile;
71 }

◆ setExperimentRun()

void setExperimentRun ( int experiment,
int run )

Set experiment and run numbers.

Definition at line 37 of file ARICHCalibrationChecker.cc.

38{
39 m_experiment = experiment;
40 m_run = run;
41 if (m_EventMetaData.isValid()) {
42 m_EventMetaData->setExperiment(experiment);
43 m_EventMetaData->setRun(run);
44 }
45}

◆ setGlobalTag()

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

Set Global Tag name.

Definition at line 59 of file ARICHCalibrationChecker.h.

60 {
61 m_GlobalTagName = globalTagName;
62 }

◆ setTestingPayload()

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

Set testing payload name.

Definition at line 51 of file ARICHCalibrationChecker.h.

52 {
53 m_testingPayloadName = testingPayloadName;
54 }

Member Data Documentation

◆ m_channelMaskResultsFile

std::string m_channelMaskResultsFile = "channel_mask.root"
private

Output file for channel mask results.

Definition at line 125 of file ARICHCalibrationChecker.h.

◆ m_EventMetaData

StoreObjPtr<EventMetaData> m_EventMetaData
private

Event metadata.

Definition at line 128 of file ARICHCalibrationChecker.h.

◆ m_experiment

int m_experiment
private

Experiment number.

Definition at line 113 of file ARICHCalibrationChecker.h.

◆ m_GlobalTagName

std::string m_GlobalTagName = ""
private

Global Tag name.

Definition at line 122 of file ARICHCalibrationChecker.h.

◆ m_run

int m_run
private

Run number.

Definition at line 116 of file ARICHCalibrationChecker.h.

◆ m_testingPayloadName

std::string m_testingPayloadName = ""
private

Testing payload location.

Definition at line 119 of file ARICHCalibrationChecker.h.


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