Belle II Software development
SVDDetectorConfigurationImporter Class Reference

This class import to the database the dbobjects SVDGlobalConfigParameters and SVDLocalConfigParameters. More...

#include <SVDDetectorConfigurationImporter.h>

Public Member Functions

 SVDDetectorConfigurationImporter ()
 Default constructor.
 
 SVDDetectorConfigurationImporter (int fexp, int frun, int lexp, int lrun)
 A constructor accepting as arguments the interval of validity coordinates.
 
virtual ~SVDDetectorConfigurationImporter ()
 Destructor.
 
void importSVDGlobalXMLFile (const std::string &fileName=std::string("svd/data/global.xml"))
 This method import to the database the global configuration xml file used during data taking.
 
void importSVDGlobalConfigParametersFromXML (const std::string &xmlFileName)
 This method import to the database the global configuration parameters used during data taking.
 
void importSVDLocalConfigParametersFromXML (const std::string &xmlFileName)
 This method import to the database the local configuration parameters used during data taking.
 

Private Attributes

int m_firstExperiment
 The interval of validity coordinates are defined as private members.
 
int m_firstRun
 First run.
 
int m_lastExperiment
 Last experiment.
 
int m_lastRun
 Last run.
 

Detailed Description

This class import to the database the dbobjects SVDGlobalConfigParameters and SVDLocalConfigParameters.

Definition at line 25 of file SVDDetectorConfigurationImporter.h.

Constructor & Destructor Documentation

◆ SVDDetectorConfigurationImporter() [1/2]

Default constructor.

Definition at line 32 of file SVDDetectorConfigurationImporter.h.

◆ SVDDetectorConfigurationImporter() [2/2]

SVDDetectorConfigurationImporter ( int  fexp,
int  frun,
int  lexp,
int  lrun 
)
inline

A constructor accepting as arguments the interval of validity coordinates.

Definition at line 42 of file SVDDetectorConfigurationImporter.h.

42 :
43 m_firstExperiment(fexp), m_firstRun(frun),
44 m_lastExperiment(lexp), m_lastRun(lrun)
45 {
46 }

◆ ~SVDDetectorConfigurationImporter()

virtual ~SVDDetectorConfigurationImporter ( )
inlinevirtual

Destructor.

Definition at line 52 of file SVDDetectorConfigurationImporter.h.

53 {}

Member Function Documentation

◆ importSVDGlobalConfigParametersFromXML()

void importSVDGlobalConfigParametersFromXML ( const std::string &  xmlFileName)

This method import to the database the global configuration parameters used during data taking.

Parameters
xmlFileNameis the file name of the xml file

Definition at line 55 of file SVDDetectorConfigurationImporter.cc.

56{
57 // This is the property tree
58 ptree pt;
59
60 // Load the XML file into the property tree. If reading fails
61 // (cannot open file, parse error), an exception is thrown.
62 read_xml(xmlFileName, pt);
63
64 //auxilairy variables to store the XML file values
65 int maskFilter = 0;
66 float zeroSuppression = 0;
67 float latency = 0;
68 std::string systemClock = "";
69 float hv = 0;
70 int relativeTimeShift = 0;
71 int nrFrames = 0;
72
73 for (ptree::value_type const& cfgDocumentChild :
74 pt.get_child("cfg_document")) {
75
76 if (cfgDocumentChild.first == "noise_run") {
77 maskFilter = cfgDocumentChild.second.get<int>("<xmlattr>.mask") ;
78 B2INFO(" masking bitmap = " << maskFilter);
79
80 }
81 if (cfgDocumentChild.first == "hardware_run") {
82 zeroSuppression = cfgDocumentChild.second.get<float>("<xmlattr>.zs_cut") ;
83 B2INFO(" zero suppression cut = " << zeroSuppression);
84
85 }
86
87 if (cfgDocumentChild.first == "i2c") {
88 latency = cfgDocumentChild.second.get<float>("<xmlattr>.lat") ;
89 B2INFO(" latency = " << latency);
90
91 }
92
93 if (cfgDocumentChild.first == "fadc_ctrl") {
94 systemClock = cfgDocumentChild.second.get<std::string>("<xmlattr>.system_clock") ;
95 B2INFO(" APV clock units = " << systemClock);
96 nrFrames = cfgDocumentChild.second.get<int>("<xmlattr>.nr_frames") ;
97 B2INFO(" Number of Frames = " << nrFrames);
98
99 }
100
101 if (cfgDocumentChild.first == "controller") {
102 relativeTimeShift = cfgDocumentChild.second.get<int>("<xmlattr>.mix_trg_delay") ;
103 B2INFO(" delay of 3-sample VS 6-sample in units of APV clock /4 = " << relativeTimeShift);
104 if (relativeTimeShift < 0)
105 B2FATAL("OOPS!! The relative time shift is negative. This is not allowed. Please check the global xml. For the moment we set it to 0.");
106 else if (relativeTimeShift > 15)
107 B2FATAL("OOPS!! The relative time shift = " << relativeTimeShift <<
108 " is not allowed! It must be an int between 0 and 15 included. Please check the global xml. For the moment we set it to 0.");
109 }
110 }
111
112 for (ptree::value_type const& cfgDocumentChild :
113 pt.get_child("cfg_document.ps_setup.hv_config")) {
114 if (cfgDocumentChild.first == "config") {
115 hv = cfgDocumentChild.second.get<float>("<xmlattr>.v_conf") ;
116 B2INFO(" HV = " << hv);
117 }
118
119 }
120
121 DBImportObjPtr<SVDGlobalConfigParameters> svdGlobalConfig("SVDGlobalConfigParameters");
122
123 svdGlobalConfig.construct(xmlFileName);
124
125 svdGlobalConfig->setZeroSuppression(zeroSuppression);
126 svdGlobalConfig->setLatency(latency);
127 svdGlobalConfig->setMaskFilter(maskFilter);
128 svdGlobalConfig->setAPVClockInRFCUnits(systemClock);
129 svdGlobalConfig->setHV(hv);
130 svdGlobalConfig->setRelativeTimeShift(relativeTimeShift);
131 svdGlobalConfig->setNrFrames(nrFrames);
132
135
136 svdGlobalConfig.import(iov);
137 B2RESULT("SVDGlobalConfigParameters imported to database.");
138
139}
Class for importing a single object to the database.
A class that describes the interval of experiments/runs for which an object in the database is valid.

◆ importSVDGlobalXMLFile()

void importSVDGlobalXMLFile ( const std::string &  fileName = std::string("svd/data/global.xml"))

This method import to the database the global configuration xml file used during data taking.

Parameters
fileNamename of the XML file

Definition at line 41 of file SVDDetectorConfigurationImporter.cc.

42{
43
45 const std::string filename = FileSystem::findFile(fileName);
46 B2INFO("Importing the global run configuration xml file " << fileName << "\n");
47
48 const std::string payloadname = "SVDGlobalXMLFile.xml";
49 if (Database::Instance().addPayload(payloadname, filename, iov))
50 B2INFO("Success!");
51 else
52 B2INFO("Failure :( ua uaa uaa uaa uaaaa)");
53}
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:151
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:41

◆ importSVDLocalConfigParametersFromXML()

void importSVDLocalConfigParametersFromXML ( const std::string &  xmlFileName)

This method import to the database the local configuration parameters used during data taking.

Parameters
xmlFileNameis the file name of the xml file

Definition at line 141 of file SVDDetectorConfigurationImporter.cc.

142{
143
144 // This is the property tree
145 ptree pt;
146
147 // Load the XML file into the property tree. If reading fails
148 // (cannot open file, parse error), an exception is thrown.
149 read_xml(xmlFileName, pt);
150
151 //auxilairy variables to store the XML file values
152 // TODO: calInjectedCharge is not used! Check if it can be removed.
153 std::string calInjectedCharge;
154 std::string calibTimeUnits = "";
155 std::string calibDate = "";
156
157 for (ptree::value_type const& apvChild :
158 pt.get_child("cfg_document.back_end_layout.fadc.adc.apv25")) {
159
160
161 if (apvChild.first == "cal_peaks") {
162 calInjectedCharge = apvChild.second.get<std::string>("<xmlattr>.units");
163 B2INFO(" injected charge from XML = " << calInjectedCharge << ", but actually set to 22500, hardcoded");
164 }
165
166 if (apvChild.first == "cal_peak_time") {
167 calibTimeUnits = apvChild.second.get<std::string>("<xmlattr>.units");
168 B2INFO(" calibration time units = " << calibTimeUnits);
169
170 }
171 }
172 for (ptree::value_type const& latestRunChild :
173 pt.get_child("cfg_document.latest_runs")) {
174
175 if (latestRunChild.first == "Noise") {
176 calibDate = latestRunChild.second.get<std::string>("<xmlattr>.end_of_run");
177 B2INFO(" calibration date = " << calibDate);
178
179 }
180 }
181
182 DBImportObjPtr<SVDLocalConfigParameters> svdLocalConfig("SVDLocalConfigParameters");
183
184 svdLocalConfig.construct(xmlFileName);
185
186 svdLocalConfig->setCalibrationTimeInRFCUnits(calibTimeUnits);
187 svdLocalConfig->setCalibDate(calibDate);
188 /* Injected charge set is HARDCODED here, by default 22500 electrons
189 */
190 svdLocalConfig->setInjectedCharge(22500);
191
192
195
196 svdLocalConfig.import(iov);
197 B2RESULT("SVDLocalConfigParameters imported to database.");
198
199}

Member Data Documentation

◆ m_firstExperiment

int m_firstExperiment
private

The interval of validity coordinates are defined as private members.

First experiment.

Definition at line 83 of file SVDDetectorConfigurationImporter.h.

◆ m_firstRun

int m_firstRun
private

First run.

Definition at line 84 of file SVDDetectorConfigurationImporter.h.

◆ m_lastExperiment

int m_lastExperiment
private

Last experiment.

Definition at line 85 of file SVDDetectorConfigurationImporter.h.

◆ m_lastRun

int m_lastRun
private

Last run.

Definition at line 86 of file SVDDetectorConfigurationImporter.h.


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