Belle II Software development
ARICHDatabaseImporter Class Reference

ARICH database importer. More...

#include <ARICHDatabaseImporter.h>

Public Member Functions

 ARICHDatabaseImporter ()
 Default constructor.
 
 ARICHDatabaseImporter (const std::vector< std::string > &inputFilesHapdQA, const std::vector< std::string > &inputFilesAsicRoot, const std::vector< std::string > &inputFilesAsicTxt, const std::vector< std::string > &inputFilesHapdQE, const std::vector< std::string > &inputFilesFebTest)
 Constructor.
 
 ARICHDatabaseImporter (int experiment, int run)
 Constructor from experiment and run number.
 
virtual ~ARICHDatabaseImporter ()
 Destructor.
 
void SetIOV (int experimentLow, int runLow, int experimentHigh, int runHigh)
 Set Interval of Validity.
 
void setExperimentAndRun (int experiment, int run)
 Set experiment and run number.
 
void importSimulationParams ()
 Import simulation parameters from the xml file (QE curve, etc.)
 
void importReconstructionParams ()
 Import reconstruction parameters (for now only initializes "default" values and imports)
 
void printSimulationPar ()
 Print simulation parameters from the database (QE curve, etc.)
 
void importModulesInfo ()
 Import HAPD modules info from the xml file and database (2D QE maps) Goes through the list of installed modules in ARICH-InstalledModules.xml, finds corresponding 2D QE maps in the database and imports lightweight ARICHModulesInfo class (which is used in sim/rec) into database.
 
void printModulesInfo ()
 Print HAPD modules info from the database (lightweight class for sim/rec=)
 
void setHAPDQE (unsigned modID, double qe=0.27, bool import=false)
 Example function for importing HAPD QE to database class (ARICHModulesInfo)
 
void importGlobalAlignment ()
 Import global alignment parameters from ARICH-GlobalAlignment.xml.
 
void importMirrorAlignment ()
 Import mirror alignment parameters from ARICH-MirrorAlignment.xml.
 
void importAeroTilesAlignment ()
 Import aerogel tiles alignment parameters from ARICH-AeroTilesAlignment.xml.
 
void importMergerCoolingGeo ()
 Import Merger cooling bodies geometry.
 
tessellatedSolidStr readTessellatedSolidVerticesFromDATfile (const std::string &inDATfile)
 reads merger cooling bodies geometry from dat files
 
void importChannelMask ()
 Import channel mask for all HAPD modules from the database (list of dead channels) Goes through the list of installed modules in ARICH-InstalledModules.xml, finds corresponding lists of dead channels in the database and imports lightweight ARICHChannelMask class (which is used in sim/rec) into database.
 
void importChannelMask (TH1 *h)
 Import channel mask from the calibration histogram ( list of dead and hot channels ) to ARICHChannelMask class into database.
 
void printChannelMask (bool makeHist=false)
 Print channel mask of all HAPD modules from the database (lightweight class for sim/rec)
 
void importChannelMapping ()
 Imports HAPD (asic) channel mappings from the xml file.
 
void printChannelMapping ()
 Prints HAPD (asic) channel mapping from the database.
 
void importFEMappings ()
 Imports mappings of FE electronics from the xml file (ARICH-FrontEndMapping.xml) to the database Mapping of modules to mergers and mergers to coppers.
 
void printMergerMapping ()
 Prints merger to FEB mappings from the database.
 
void printCopperMapping ()
 Prints Copper to merger mappings from the database.
 
void printReconstructionPar ()
 Prints reconstruction parameters.
 
void printGeometryConfig ()
 Prints geometry configuration parameters from the database.
 
void dumpQEMap (bool simple=false)
 Dumps 2D QE map of full detector surface from the database into root file (from ARICHModulesInfo)
 
void dumpHvMappings ()
 Dumps detector map of HAPD modules to HV cable channels.
 
void printFEMappings ()
 Prints electronics mappings for all modules (merger ID + SN, merger port, copper, finnese)
 
void dumpMergerMapping (bool sn=true)
 Dumps module - merger mapping into root file.
 
void dumpModuleNumbering ()
 Dumps module numbering scheme into root file (module position on the detector plane -> module number)
 
void dumpAerogelOpticalProperties (std::string outRootFileName="ARICH_AerogelOpticalProperties.root")
 Dumps aerogel tile properties (aerogel optical properties - AOP) into root file with arich/utility/ARICHAerogelHist histos.
 
void importCosmicTestGeometry ()
 Import parameters of the cosmic test geometry configuration.
 
void importGeometryConfig ()
 Import geometry configuration parameters to the database.
 
void importAeroTilesInfo ()
 Import optical information of aerogel tiles into database.
 
void importAeroRayleighScatteringFit (std::string commentSingleWord="")
 Import optical information of aerogel tiles into database.
 
int getAeroTileRing (int slot)
 Get aerogel ring number from global indetifier.
 
int getAeroTileColumn (int slot)
 Get aerogel ring number from global indetifier.
 
void printAeroTileInfo ()
 Prints mapping of aerogel tiles and their optical properties.
 
void printGlobalAlignment ()
 Prints global alignment constants.
 
void printMirrorAlignment ()
 Prints mirror alignment constants.
 
void printAeroTilesAlignment ()
 Prints aerogel tiles alignment constants.
 
void importBiasMappings ()
 Imports mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltages.
 
void importHvMappings ()
 Imports mappings of power supply to high voltage cables.
 
void importNominalBiasVoltages ()
 Imports mappings of nominal values of bias voltages.
 
void printBiasMappings ()
 Prints mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltages from the database.
 
void printHvMappings ()
 Prints mappings of power supply to HV cables and cables to HAPDs from the database.
 
void printNominalBiasVoltages ()
 Prints mappings of nominal values of bias voltages from the database.
 
void printNominalBiasVoltageForChannel (std::vector< int > channel)
 Prints nominal bias voltage for channel on power supply from the database.
 
void printHapdPositionFromCrateSlot (int crate, int slot, int channelID)
 Prints HAPD position (sector, ring, azimuth) and merger connection (merger, feb slot) from the database.
 
int getFebDaqSlot (unsigned febSlot)
 Returns feb daq position from feb slot.
 
void importAerogelInfo (TString coreNameSuffix="")
 Import ARICH aerogel data in the database.
 
void exportAerogelInfo (int verboseLevel=0)
 Export ARICH aerogel data from the database.
 
void importAerogelMap ()
 Import ARICH aerogel map in the database.
 
void exportAerogelMap ()
 Export ARICH aerogel map in the database.
 
void importAerogelInfoEventDep ()
 Import intrarun dependant ARICH aerogel data in the database.
 
void exportAerogelInfoEventDep ()
 Export intrarun dependant ARICH aerogel data from the database.
 
void importHapdQA ()
 Import ARICH HAPD QA data in the database.
 
void exportHapdQA ()
 Export ARICH HAPD QA data from the database.
 
void importAsicInfo ()
 Import ARICH ASICs data in the database.
 
void importAsicInfoRoot ()
 Import large histograms from ARICH ASICs data in the database.
 
void exportAsicInfo ()
 Export ARICH ASICs data from the database.
 
TTimeStamp timedate (std::string enddate)
 Convert date (ASICs) to TTimeStamp.
 
TTimeStamp getAsicDate (const std::string &asicSerial, const std::string &type)
 Get date for ASIC measurement.
 
std::vector< int > channelsList (std::string badCH)
 Get lists of problematic ASIC channels.
 
void importFebTest ()
 Import ARICH FEB test data in the database.
 
void importFebTestRoot ()
 Import large histograms from ARICH FEB test data in the database.
 
std::tuple< std::string, float, float, float > getFebLVtestData (int serial, int lvRun)
 Returns data from low voltage test.
 
std::tuple< std::string, float > getFebHVtestData (int serial, int hvRun)
 Returns data from high voltage test.
 
std::vector< int > getDeadChFEB (const std::string &dna)
 Returns list of dead channels on FEB.
 
TTimeStamp timedate2 (std::string time)
 Convert date (FEB) to TTimeStamp.
 
std::pair< std::vector< float >, std::vector< float > > getSlopes (int serialNum, const std::string &runSCAN)
 Returns lists of slopes (fine & rough)
 
std::vector< std::pair< float, float > > getFwhm (int serialNum, const std::string &runSCAN)
 Returns lists of FWHM values&sigmas.
 
std::vector< TH3F * > getFebTestHistograms (const std::string &dna, const std::string &run, int febposition)
 Returns TH3F histograms - offset settings.
 
TH2F * getFebTestPulse (const std::string &dna, const std::string &run, int febposition)
 Returns TH2F histogram of pulse test.
 
void exportFebTest ()
 Export ARICH FEB test data from the database.
 
void importHapdChipInfo ()
 Import ARICH HAPD chip data in the database.
 
void exportHapdChipInfo ()
 Export ARICH HAPD chip data from the database.
 
void importHapdInfo ()
 Import ARICH HAPD data in the database.
 
std::vector< int > channelsListHapd (std::string chlist, std::string chipDelay)
 Get lists of problematic HAPD channels.
 
int getChannelPosition (const std::string &XY, const std::string &chip_2d, int chipnum)
 Get position of channel on HAPD.
 
TGraph * getGraphGainCurrent (const std::string &bomb_aval, const std::string &g_i, const std::string &chip_label, int i, float *HV, float *gain_current)
 Get graphs for bombardment and avalanche gain and current.
 
TH2F * getBiasGraph (const std::string &chip_2d, const std::string &voltage_current, int *chipnum, float *bias_v_i)
 Get histograms for bias voltage and current.
 
void exportHapdInfo ()
 Export ARICH HAPD info and chip info data from the database.
 
void importHapdQE ()
 Import HAPD quantum efficiency in the database.
 
void exportHapdQE ()
 Export HAPD quantum efficiency from the database.
 
void printBiasVoltagesForHapdChip (const std::string &serialNumber)
 Export ARICH HAPD chip info data from the database and calculate bias voltages for one HAPD.
 
void printMyParams (const std::string &aeroSerialNumber)
 Example that shows how to use data from the database.
 
std::map< std::string, float > getAerogelParams (const std::string &aeroSerialNumber)
 Function that returns refractive index, thickness and transmission length of aerogel.
 
void importFEBoardInfo ()
 Import module test results.
 
void exportFEBoardInfo ()
 Export module test results.
 
void importModuleTest (const std::string &mypath, const std::string &HVtest)
 Import module test results.
 
void exportModuleTest (const std::string &HVtest)
 Export module test results.
 
void importSensorModuleInfo ()
 Import module sensor info classes.
 
void importSensorModuleMap ()
 Import module sensor map classes.
 
void exportSensorModuleMap ()
 Export module sensor map classes from database.
 
void exportSensorModuleMapInfo (int number)
 Export module sensor map info classes from database.
 
void importMagnetTest ()
 Import results of magnet test.
 
void exportMagnetTest ()
 Export results of magnet test.
 
void exportAll ()
 Export all the data.
 

Private Member Functions

template<typename Container_t >
auto printContainer (const Container_t &rContainer, std::ostream &rStream=std::cout) noexcept -> void
 printContainer used for debugging purposes...
 

Private Attributes

std::vector< std::string > m_inputFilesHapdQA
 Input root files for HAPD QA.
 
std::vector< std::string > m_inputFilesAsicRoot
 Input root files for ASICs.
 
std::vector< std::string > m_inputFilesAsicTxt
 Input txt files for ASICs.
 
std::vector< std::string > m_inputFilesHapdQE
 Input root files for HAPD quantum efficiency.
 
std::vector< std::string > m_inputFilesFebTest
 Input root files from FEB test (coarse/fine offset settings, test pulse)
 
IntervalOfValidity m_iov
 interval of validity
 

Detailed Description

ARICH database importer.

This module writes data to database.

Definition at line 34 of file ARICHDatabaseImporter.h.

Constructor & Destructor Documentation

◆ ARICHDatabaseImporter() [1/3]

Default constructor.

Definition at line 40 of file ARICHDatabaseImporter.h.

41 m_inputFilesFebTest(), m_iov(0, 0, -1, -1) {};
std::vector< std::string > m_inputFilesHapdQA
Input root files for HAPD QA.
std::vector< std::string > m_inputFilesFebTest
Input root files from FEB test (coarse/fine offset settings, test pulse)
IntervalOfValidity m_iov
interval of validity
std::vector< std::string > m_inputFilesHapdQE
Input root files for HAPD quantum efficiency.
std::vector< std::string > m_inputFilesAsicTxt
Input txt files for ASICs.
std::vector< std::string > m_inputFilesAsicRoot
Input root files for ASICs.

◆ ARICHDatabaseImporter() [2/3]

ARICHDatabaseImporter ( const std::vector< std::string > &  inputFilesHapdQA,
const std::vector< std::string > &  inputFilesAsicRoot,
const std::vector< std::string > &  inputFilesAsicTxt,
const std::vector< std::string > &  inputFilesHapdQE,
const std::vector< std::string > &  inputFilesFebTest 
)

Constructor.

Definition at line 83 of file ARICHDatabaseImporter.cc.

85{
86 m_inputFilesHapdQA.reserve(inputFilesHapdQA.size());
87 m_inputFilesAsicRoot.reserve(inputFilesAsicRoot.size());
88 m_inputFilesAsicTxt.reserve(inputFilesAsicTxt.size());
89 m_inputFilesHapdQE.reserve(inputFilesHapdQE.size());
90 m_inputFilesFebTest.reserve(inputFilesFebTest.size());
91 for (unsigned int i = 0; i < inputFilesHapdQA.size(); i++) { m_inputFilesHapdQA.push_back(inputFilesHapdQA[i]); }
92 for (unsigned int i = 0; i < inputFilesAsicRoot.size(); i++) { m_inputFilesAsicRoot.push_back(inputFilesAsicRoot[i]); }
93 for (unsigned int i = 0; i < inputFilesAsicTxt.size(); i++) { m_inputFilesAsicTxt.push_back(inputFilesAsicTxt[i]); }
94 for (unsigned int i = 0; i < inputFilesHapdQE.size(); i++) { m_inputFilesHapdQE.push_back(inputFilesHapdQE[i]); }
95 for (unsigned int i = 0; i < inputFilesFebTest.size(); i++) { m_inputFilesFebTest.push_back(inputFilesFebTest[i]); }
96 m_iov = IntervalOfValidity(0, 0, -1, -1);
97}
A class that describes the interval of experiments/runs for which an object in the database is valid.

◆ ARICHDatabaseImporter() [3/3]

ARICHDatabaseImporter ( int  experiment,
int  run 
)

Constructor from experiment and run number.

Definition at line 99 of file ARICHDatabaseImporter.cc.

100{
102 meta->setRun(run); meta->setExperiment(experiment);
103 B2INFO("Experiment " << experiment << ", run " << run);
104 m_iov = IntervalOfValidity(0, 0, -1, -1);
105}
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96

◆ ~ARICHDatabaseImporter()

virtual ~ARICHDatabaseImporter ( )
inlinevirtual

Destructor.

Definition at line 59 of file ARICHDatabaseImporter.h.

59{};

Member Function Documentation

◆ channelsList()

vector< int > channelsList ( std::string  badCH)

Get lists of problematic ASIC channels.

Definition at line 1795 of file ARICHDatabaseImporter.cc.

1796{
1797
1798 vector<int> CHs;
1799
1800 if ((badCH.find("many") != string::npos) || (badCH.find("all") != string::npos)) CHs.emplace_back(-1);
1801 else ARICHTools::StringToVector::convert<int>(badCH, ',');
1802
1803 return CHs;
1804}

◆ channelsListHapd()

std::vector< int > channelsListHapd ( std::string  chlist,
std::string  chipDelay 
)

Get lists of problematic HAPD channels.

Definition at line 2516 of file ARICHDatabaseImporter.cc.

2517{
2518 B2INFO("channel list = " << chlist << ", chip = " << chipDelay);
2519 string chlistDig = ARICHTools::remove_chars_if_not(chlist, "0123456789,~");
2520
2521 vector<int> CHs = ARICHTools::getDeadCutList(*chipDelay.c_str(), ARICHTools::StringToVector::parse<int>(chlistDig, ','));
2522
2523 B2INFO("All channels: ");
2524 printContainer(CHs);
2525 return CHs;
2526}
auto printContainer(const Container_t &rContainer, std::ostream &rStream=std::cout) noexcept -> void
printContainer used for debugging purposes...

◆ dumpAerogelOpticalProperties()

void dumpAerogelOpticalProperties ( std::string  outRootFileName = "ARICH_AerogelOpticalProperties.root")

Dumps aerogel tile properties (aerogel optical properties - AOP) into root file with arich/utility/ARICHAerogelHist histos.

Parameters
outRootFileNamestring with output name

Definition at line 1166 of file ARICHDatabaseImporter.cc.

1167{
1168
1169 ARICHAerogelHist* h2_aerogel_up_n = new ARICHAerogelHist("h2_aerogel_up_n", "aerogel up n");
1170 ARICHAerogelHist* h2_aerogel_up_transmL = new ARICHAerogelHist("h2_aerogel_up_transmL", "aerogel up transmL");
1171 ARICHAerogelHist* h2_aerogel_up_thick = new ARICHAerogelHist("h2_aerogel_up_thick", "aerogel up thick");
1172 ARICHAerogelHist* h2_aerogel_down_n = new ARICHAerogelHist("h2_aerogel_down_n", "aerogel down n");
1173 ARICHAerogelHist* h2_aerogel_down_transmL = new ARICHAerogelHist("h2_aerogel_down_transmL", "aerogel down transmL");
1174 ARICHAerogelHist* h2_aerogel_down_thick = new ARICHAerogelHist("h2_aerogel_down_thick", "aerogel down thick");
1175
1176 std::string condDBname = "ARICHdata";
1177 // cppcheck-suppress knownConditionTrueFalse
1178 if (condDBname == "ARICHdata") {
1179
1180 //
1181 DBArray<ARICHAerogelMap> elementsM("ARICHAerogelMap");
1182 elementsM.getEntries();
1183 DBArray<ARICHAerogelInfo> elementsI("ARICHAerogelInfo");
1184 elementsI.getEntries();
1185
1186 //
1187 for (const auto& elementM : elementsM) {
1188 if (elementM.getAerogelLayer(0) == 1) {
1189 for (const auto& elementI : elementsI) {
1190 if (elementI.getAerogelSN() == elementM.getAerogelSN()) {
1191 //down
1192 h2_aerogel_down_n->SetBinContent(h2_aerogel_down_n->GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1193 elementM.getAerogelColumnID()), elementI.getAerogelRefractiveIndex());
1194 h2_aerogel_down_transmL->SetBinContent(h2_aerogel_down_transmL->GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1195 elementM.getAerogelColumnID()), elementI.getAerogelTransmissionLength());
1196 h2_aerogel_down_thick->SetBinContent(h2_aerogel_down_thick->GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1197 elementM.getAerogelColumnID()), elementI.getAerogelThickness());
1198 }// if (elementI.getAerogelSN() == elementM.getAerogelSN()){
1199 }// for (const auto& elementI : elementsI) {
1200 }
1201 if (elementM.getAerogelLayer(1) == 1) {
1202 for (const auto& elementI : elementsI) {
1203 if (elementI.getAerogelSN() == elementM.getAerogelSN()) {
1204 //up
1205 h2_aerogel_up_n->SetBinContent(h2_aerogel_up_n->GetBinIDFromRingColumn(elementM.getAerogelRingID(), elementM.getAerogelColumnID()),
1206 elementI.getAerogelRefractiveIndex());
1207 h2_aerogel_up_transmL->SetBinContent(h2_aerogel_up_transmL->GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1208 elementM.getAerogelColumnID()), elementI.getAerogelTransmissionLength());
1209 h2_aerogel_up_thick->SetBinContent(h2_aerogel_up_thick->GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1210 elementM.getAerogelColumnID()), elementI.getAerogelThickness());
1211 }// if (elementI.getAerogelSN() == elementM.getAerogelSN()){
1212 }// for (const auto& elementI : elementsI) {
1213 }
1214 }// for (const auto& elementM : elementsM) {
1215
1216 }// if (condDBname = "ARICHdata") {
1217 //else { // if (condDBname = "ARICHdata") {
1218 //To be added later when the information about aerogel optical properties
1219 //would be available not only in ARICHdata
1220 //}
1221
1222 TFile* rootFile = new TFile(outRootFileName.c_str(), "RECREATE", " Histograms", 1);
1223 rootFile->cd();
1224 if (rootFile->IsZombie()) {
1225 B2ERROR(" ERROR ---> file : " << outRootFileName.c_str() << " is zombi");
1226 }
1227 h2_aerogel_up_n->Write();
1228 h2_aerogel_up_transmL->Write();
1229 h2_aerogel_up_thick->Write();
1230 h2_aerogel_down_n->Write();
1231 h2_aerogel_down_transmL->Write();
1232 h2_aerogel_down_thick->Write();
1233 rootFile->Close();
1234}
Base class for geometry parameters.
Int_t GetBinIDFromRingColumn(Int_t ring, Int_t column)
Function which return histogram bin id from ring and column id's.
Class for accessing arrays of objects in the database.
Definition: DBArray.h:26

◆ dumpHvMappings()

void dumpHvMappings ( )

Dumps detector map of HAPD modules to HV cable channels.

Definition at line 902 of file ARICHDatabaseImporter.cc.

903{
905
906 ARICHChannelHist* hist = new ARICHChannelHist("hvMapping", "module - HV cable mapping", 1);
907 for (int hapdID = 1; hapdID < 421; hapdID++) {
908 int val = hvMap->getCableID(hapdID) * 100 + hvMap->getInnerID(hapdID);
909 hist->setBinContent(hapdID, val);
910 }
911 hist->SetOption("TEXT");
912 hist->SaveAs("HVMapping.root");
913}
ARICH histogram with HAPD plane 3 options for bin segmentation are available type 0 - one bin per HAP...
Class for accessing objects in the database.
Definition: DBObjPtr.h:21

◆ dumpMergerMapping()

void dumpMergerMapping ( bool  sn = true)

Dumps module - merger mapping into root file.

Definition at line 1070 of file ARICHDatabaseImporter.cc.

1071{
1073 ARICHChannelHist* hist = new ARICHChannelHist("mergerNum", "module - merger mapping", 1);
1074 for (int hapdID = 1; hapdID < 421; hapdID++) {
1075 int val = mgrMap->getMergerID(hapdID);
1076 if (sn) val = mgrMap->getMergerSN(val);
1077 hist->setBinContent(hapdID, val);
1078 }
1079 hist->SetOption("TEXT");
1080 hist->SaveAs("MergerMapping.root");
1081
1082}

◆ dumpModuleNumbering()

void dumpModuleNumbering ( )

Dumps module numbering scheme into root file (module position on the detector plane -> module number)

Definition at line 1121 of file ARICHDatabaseImporter.cc.

1122{
1123
1124 ARICHChannelHist* hist = new ARICHChannelHist("moduleNum", "HAPD module slot numbering", 1);
1125 for (int hapdID = 1; hapdID < 421; hapdID++) {
1126 hist->setBinContent(hapdID, hapdID);
1127 }
1128 hist->SetOption("TEXT");
1129 hist->SaveAs("ModuleNumbering.root");
1130
1131}

◆ dumpQEMap()

void dumpQEMap ( bool  simple = false)

Dumps 2D QE map of full detector surface from the database into root file (from ARICHModulesInfo)

Parameters
simplefalse for proper histogram with bin for each channel, true for simpler plot with point for each channel (smaller file, faster) for simple option, draw TGraph2D with "pcolz" option and set view to "top"

Definition at line 1133 of file ARICHDatabaseImporter.cc.

1134{
1138
1139 if (simple) {
1140 TGraph2D* gr = new TGraph2D();
1141 int point = 0;
1142 for (int i = 1; i < 421; i++) {
1143 if (modInfo->isInstalled(i)) {
1144 for (int j = 0; j < 144; j++) {
1145 int xCh, yCh;
1146 chMap->getXYFromAsic(j, xCh, yCh);
1147 ROOT::Math::XYVector chPos = geoConfig->getChannelPosition(i, xCh, yCh);
1148 gr->SetPoint(point, chPos.X(), chPos.Y(), modInfo->getChannelQE(i, j));
1149 point++;
1150 }
1151 }
1152 }
1153 gr->SaveAs("QEMap.root");
1154 } else {
1155 ARICHChannelHist* hist = new ARICHChannelHist("hapdQE", "hapd QE map");
1156 for (int hapdID = 1; hapdID < 421; hapdID++) {
1157 if (!modInfo->isInstalled(hapdID)) continue;
1158 for (int chID = 0; chID < 144; chID++) {
1159 hist->setBinContent(hapdID, chID, modInfo->getChannelQE(hapdID, chID));
1160 }
1161 }
1162 hist->SaveAs("QEMap.root");
1163 }
1164}

◆ exportAerogelInfo()

void exportAerogelInfo ( int  verboseLevel = 0)

Export ARICH aerogel data from the database.

Definition at line 1323 of file ARICHDatabaseImporter.cc.

1324{
1325
1326 // Definition:
1327 // This function extracts data from the database for chosen event.
1328
1329 /*
1330 // Extract data from payload with bounded validity
1331
1332 // Define event, run and experiment numbers
1333 EventMetaData event = EventMetaData(1200,4,0); // (event, run, exp)
1334
1335 // Extract object and IOV from database
1336 std::pair<TObject*, IntervalOfValidity> podatki = Database::Instance().getData(event, "dbstore", "ARICHAerogelInfo");
1337
1338 // print interval of validity
1339 // IntervalOfValidity iov = std::get<1>(podatki);
1340 // B2INFO("iov = " << iov);
1341
1342 // Convert between different class types and extract TClonesArray
1343 // for chosen event
1344 TObject* data;
1345 data = std::get<0>(podatki);
1346 TClonesArray* elements = static_cast<TClonesArray*>(data);
1347
1348 // Get entries from TClonesArray and print aerogel info
1349 (*elements).GetEntries();
1350 for (int i = 0; i < elements->GetSize(); i++) {
1351 ARICHAerogelInfo* myelement = static_cast<ARICHAerogelInfo*>(elements->At(i));
1352 B2INFO("Version = " << myelement->getAerogelVersion() << ", SN = " << myelement->getAerogelSN() << ", n = " << myelement->getAerogelRefractiveIndex() << ", trl = " << myelement->getAerogelTransmissionLength() << ", thickness = " << myelement->getAerogelThickness());
1353 }
1354 */
1355
1356
1357
1358 // Extract data from payload with unbounded validity
1359 DBArray<ARICHAerogelInfo> elements("ARICHAerogelInfo");
1360 elements.getEntries();
1361
1362 // Print aerogel info
1363 for (const auto& element : elements) {
1364 B2INFO("Version = " << element.getAerogelVersion() << ", serial = " << element.getAerogelSN() <<
1365 ", id = " << element.getAerogelID() << ", n = " << element.getAerogelRefractiveIndex() << ", transmLength = " <<
1366 element.getAerogelTransmissionLength() << ", thickness = " << element.getAerogelThickness());
1367 if (verboseLevel > 0) {
1368 unsigned int ii = 0;
1369 int lllambda = 200;
1370 while (lllambda > 0) {
1371 lllambda = element.getAerogelTransmittanceLambda(ii);
1372 if (lllambda < 0)
1373 break;
1374 float llval = element.getAerogelTransmittance(ii);
1375 B2INFO(" Lambda = " << lllambda << " Transmittance = " << llval);
1376 ii++;
1377 }// while(lllambda > 0){
1378 }// if(verboseLevel>0){
1379 }// for (const auto& element : elements) {
1380
1381}

◆ exportAerogelInfoEventDep()

void exportAerogelInfoEventDep ( )

Export intrarun dependant ARICH aerogel data from the database.

-> Example for intrarun dependat data!

Definition at line 1498 of file ARICHDatabaseImporter.cc.

1499{
1500 // Definition:
1501 // This function extracts intrarun dependant data from the database.
1502 // It converts between different class types to get the saved
1503 // TClonesArray for chosen event, run and experiment.
1504
1505
1506 // Define event, run and experiment numbers
1507 EventMetaData event = EventMetaData(1200, 4, 0); // (event, run, exp)
1508
1509 // Extract object and IOV from database
1510 std::pair<TObject*, IntervalOfValidity> podatki = Database::Instance().getData(event, "ARICHAerogelInfoEventDep");
1511
1512 // print interval of validity
1513// IntervalOfValidity iov = std::get<1>(podatki);
1514// B2INFO("iov = " << iov);
1515
1516 // Convert between different class types and extract TClonesArray
1517 // for chosen event
1518 TObject* data = std::get<0>(podatki);
1519 EventDependency* data2 = static_cast<EventDependency*>(data);
1520 TObject* myobject = data2->getObject(event);
1521 TClonesArray* elements = static_cast<TClonesArray*>(myobject);
1522
1523 // Get entries from TClonesArray and print aerogel info
1524 (*elements).GetEntries();
1525 for (int i = 0; i < elements->GetSize(); i++) {
1526 ARICHAerogelInfo* myelement = (ARICHAerogelInfo*)elements->At(i);
1527 B2INFO("Version = " << myelement->getAerogelVersion() << ", SN = " << myelement->getAerogelSN() << ", n = " <<
1528 myelement->getAerogelRefractiveIndex() << ", trl = " << myelement->getAerogelTransmissionLength() << ", thickness = " <<
1529 myelement->getAerogelThickness());
1530 }
1531
1532 /*
1533
1534 // Extract data from the last added payload
1535 DBArray<ARICHAerogelInfo> elements("ARICHAerogelInfo");
1536 elements.getEntries();
1537
1538 // Print aerogel info
1539
1540 for (const auto& element : elements) {
1541 B2INFO("Version = " << element.getAerogelVersion() << ", serial = " << element.getAerogelSN() <<
1542 ", id = " << element.getAerogelID() << ", n = " << element.getAerogelRefractiveIndex() << ", transmLength = " <<
1543 element.getAerogelTransmissionLength() << ", thickness = " << element.getAerogelThickness())
1544 }
1545
1546 */
1547}
The Class for ARICH Aerogel Parameters.
float getAerogelVersion() const
Get aerogel version.
float getAerogelRefractiveIndex() const
Get refractive index of aerogel.
std::string getAerogelSN() const
Get aerogel serial number.
float getAerogelThickness() const
Get aerogel thickness.
float getAerogelTransmissionLength() const
Get transmission length at 400 nm.
Class for handling changing conditions as a function of event number.
Store event, run, and experiment numbers.
Definition: EventMetaData.h:33
TObject * getObject(const EventMetaData &event) const
Get the conditions object that is valid for the given event.
std::pair< TObject *, IntervalOfValidity > getData(const EventMetaData &event, const std::string &name)
Request an object from the database.
Definition: Database.cc:72
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42

◆ exportAerogelMap()

void exportAerogelMap ( )

Export ARICH aerogel map in the database.

Definition at line 1419 of file ARICHDatabaseImporter.cc.

1420{
1421
1422 DBArray<ARICHAerogelMap> elements("ARICHAerogelMap");
1423 elements.getEntries();
1424
1425 // Print aerogel info
1426 for (const auto& element : elements) {
1427 string layer;
1428 if (element.getAerogelLayer(0) == 1) layer = "down";
1429 if (element.getAerogelLayer(1) == 1) layer = "up";
1430 B2INFO("ID = " << element.getAerogelSN() << ", ring = " << element.getAerogelRingID() <<
1431 ", column = " << element.getAerogelColumnID() << ", layer: " << layer);
1432 }
1433}

◆ exportAll()

void exportAll ( )

Export all the data.

Definition at line 3291 of file ARICHDatabaseImporter.cc.

3292{
3300}
void exportHapdQE()
Export HAPD quantum efficiency from the database.
void exportModuleTest(const std::string &HVtest)
Export module test results.
void exportFEBoardInfo()
Export module test results.
void exportSensorModuleMap()
Export module sensor map classes from database.
void exportFebTest()
Export ARICH FEB test data from the database.
void exportAerogelInfo(int verboseLevel=0)
Export ARICH aerogel data from the database.

◆ exportAsicInfo()

void exportAsicInfo ( )

Export ARICH ASICs data from the database.

Definition at line 1807 of file ARICHDatabaseImporter.cc.

1808{
1809
1810 DBArray<ARICHAsicInfo> elements("ARICHAsicInfo");
1811 elements.getEntries();
1812
1813 // Print serial numbers of ASICs
1814 for (const auto& element : elements) {
1815 B2INFO("asic SN: " << element.getAsicID());
1816 }
1817}

◆ exportFEBoardInfo()

void exportFEBoardInfo ( )

Export module test results.

Definition at line 2834 of file ARICHDatabaseImporter.cc.

2835{
2836 DBArray<ARICHFEBoardInfo> elements("ARICHFEBoardInfo");
2837 elements.getEntries();
2838
2839 for (const auto& element : elements) {
2840 B2INFO("Feb sn = " << element.getFEBoardSerial());
2841 for (int i = 0; i < 4; i++) {
2842 B2INFO("ASIC " << i << " = " << element.getAsicPosition(i));
2843 }
2844 }
2845}

◆ exportFebTest()

void exportFebTest ( )

Export ARICH FEB test data from the database.

Definition at line 2247 of file ARICHDatabaseImporter.cc.

2248{
2249
2250 DBArray<ARICHFebTest> elements("ARICHFebTest");
2251 elements.getEntries();
2252
2253 // Print serial numbers of FEBs
2254 for (const auto& element : elements) {
2255 B2INFO("Serial = " << element.getFebSerial() << "; dna = " << element.getFebDna() << "; slope R (ch143) = " <<
2256 element.getSlopeRough(143) << "; slope F (ch143) = " << element.getSlopeFine(143) << "; comment = " << element.getComment());
2257 }
2258
2259}

◆ exportHapdChipInfo()

void exportHapdChipInfo ( )

Export ARICH HAPD chip data from the database.

Definition at line 2419 of file ARICHDatabaseImporter.cc.

2420{
2421 DBArray<ARICHHapdChipInfo> elements("ARICHHapdChipInfo");
2422 elements.getEntries();
2423
2424 for (const auto& element : elements) {
2425 B2INFO("Serial = " << element.getHapdSerial() << ", chip = " << element.getChipLabel() << ", bias= " << element.getBiasVoltage());
2426 }
2427}

◆ exportHapdInfo()

void exportHapdInfo ( )

Export ARICH HAPD info and chip info data from the database.

Definition at line 2603 of file ARICHDatabaseImporter.cc.

2604{
2605
2606 DBArray<ARICHHapdInfo> elements("ARICHHapdInfo");
2607 elements.getEntries();
2608
2609 for (const auto& element : elements) {
2610 B2INFO("Serial = " << element.getSerialNumber() << "; HV = " << element.getHighVoltage() << "; qe400 = " <<
2611 element.getQuantumEfficiency400());
2612 for (int n = 0; n < 4; n++) {
2613 ARICHHapdChipInfo* newelement = element.getHapdChipInfo(n);
2614 B2INFO("biasV(chip" << n << ") = " << newelement->getBiasVoltage());
2615 }
2616 /* TGraph* adc = element.getPulseHeightDistribution();
2617 TFile file("histogrami.root", "update");
2618 adc->Write();
2619 file.Close();
2620 */
2621 }
2622}
Contains manufacturer data of one of the 4 photo sensors chips.
int getBiasVoltage() const
Get chip bias Voltage.

◆ exportHapdQA()

void exportHapdQA ( )

Export ARICH HAPD QA data from the database.

Definition at line 1630 of file ARICHDatabaseImporter.cc.

1631{
1632 DBArray<ARICHHapdQA> elements("ARICHHapdQA");
1633 elements.getEntries();
1634
1635 // Print serial numbers of HAPDs
1636 for (const auto& element : elements) {
1637 B2INFO("Serial number = " << element.getHapdSerialNumber() << "; arrival date = " << element.getHapdArrivalDate());
1638 }
1639}

◆ exportHapdQE()

void exportHapdQE ( )

Export HAPD quantum efficiency from the database.

Definition at line 2668 of file ARICHDatabaseImporter.cc.

2669{
2670 DBArray<ARICHHapdQE> elements("ARICHHapdQE");
2671 elements.getEntries();
2672 gROOT->SetBatch(kTRUE);
2673
2674 // Example that prints serial numbers of HAPDs and saves QE 2D histograms to root file
2675 for (const auto& element : elements) {
2676 B2INFO(" SN = " << element.getHapdSerialNumber());
2677 TH2F* qe2d = element.getQuantumEfficiency2D();
2678 TFile file("QEhists.root", "update");
2679 qe2d->Write();
2680 file.Close();
2681 }
2682
2683}

◆ exportMagnetTest()

void exportMagnetTest ( )

Export results of magnet test.

Definition at line 3271 of file ARICHDatabaseImporter.cc.

3272{
3273
3274 DBArray<ARICHMagnetTest> elements("ARICHMagnetTest");
3275 elements.getEntries();
3276
3277 for (const auto& element : elements) {
3278 string getter = "no";
3279 if (element.getGetter() == 1) getter = "yes";
3280 B2INFO("SN = " << element.getSerialNumber() << "; after getter reactivation? " << getter);
3281 for (int i = 0; i < element.getDeadTimeSize();
3282 i++) B2INFO("dead time = " << element.getDeadTime(i) << " (" << (i + 1) << ". measurement)");
3283 if (element.getDeadTimeLowerA() > 0.) B2INFO("lower voltage on chip A = " << element.getDeadTimeLowerA());
3284 if (element.getDeadTimeLowerB() > 0.) B2INFO("lower voltage on chip B = " << element.getDeadTimeLowerB());
3285 if (element.getDeadTimeLowerC() > 0.) B2INFO("lower voltage on chip C = " << element.getDeadTimeLowerC());
3286 if (element.getDeadTimeLowerD() > 0.) B2INFO("lower voltage on chip D = " << element.getDeadTimeLowerD());
3287 B2INFO("comment = " << element.getComment());
3288 }
3289}

◆ exportModuleTest()

void exportModuleTest ( const std::string &  HVtest)

Export module test results.

Definition at line 3048 of file ARICHDatabaseImporter.cc.

3049{
3050
3051 if (HVtest == "no") {
3052 DBArray<ARICHModuleTest> elements("ARICHModuleTest");
3053 elements.getEntries();
3054 for (const auto& element : elements) {
3055 B2INFO("Feb sn = " << element.getFebSN() << ", hapd sn = " << element.getHapdSN() << ", run = " << element.getRun() <<
3056 ", run position = " << element.getRunPosition() << ", module is ok = " << element.getOK() << ", comment = " <<
3057 element.getComment());
3058 for (int i = 0; i < element.getDeadChsSize(); i++) {
3059 B2INFO("dead channel = " << element.getDeadCh(i) << " (hapd mapping)");
3060 }
3061 }
3062 }
3063
3064 if (HVtest == "yes") {
3065 DBArray<ARICHModuleTest> elements("ARICHModuleTestHV");
3066 elements.getEntries();
3067 for (const auto& element : elements) {
3068 B2INFO("Feb sn = " << element.getFebSN() << ", hapd sn = " << element.getHapdSN() << ", hvb sn = " << element.getHvbSN() <<
3069 ", run = " << element.getRun() << ", run position = " << element.getRunPosition() << ", module is ok = " << element.getOK() <<
3070 ", comment = " << element.getComment());
3071 for (int i = 0; i < element.getDeadChsSize(); i++) {
3072 B2INFO("dead channel = " << element.getDeadCh(i) << " (asic mapping)");
3073 }
3074 }
3075 }
3076}

◆ exportSensorModuleMap()

void exportSensorModuleMap ( )

Export module sensor map classes from database.

Definition at line 3178 of file ARICHDatabaseImporter.cc.

3179{
3180 DBArray<ARICHSensorModuleMap> elements("ARICHSensorModuleMap");
3181 elements.getEntries();
3182
3183 for (const auto& element : elements) {
3184 B2INFO("Sextant = " << element.getSensorModuleSextantID() << ", ring = " << element.getSensorModuleRingID() << ", column = " <<
3185 element.getSensorModuleColumnID());
3186 ARICHSensorModuleInfo* newelement = element.getSensorModuleId();
3187 B2INFO("module ID = " << newelement->getSensorModuleID() << ", feb = " << newelement->getFEBserial() << ", hapd = " <<
3188 newelement->getHAPDserial());
3189 ARICHHapdInfo* newerelement = newelement->getHapdID();
3190 B2INFO("Hapd Serial = " << newerelement->getSerialNumber() << "; HV = " << newerelement->getHighVoltage() << "; qe400 = " <<
3191 newerelement->getQuantumEfficiency400());
3192 for (int i = 0; i < 4; i++) {
3193 ARICHHapdChipInfo* newestelement = newerelement->getHapdChipInfo(i);
3194 B2INFO("Hapd Serial = " << newestelement->getHapdSerial() << "; chip = " << newestelement->getChipLabel() << "; gain = " <<
3195 newestelement->getGain());
3196 }
3197 }
3198}
std::string getChipLabel() const
Get chip label.
int getGain() const
Get chip gain at operational voltage.
std::string getHapdSerial() const
Get HAPD Serial number.
Contains manufacturer data of the photo sensor - HAPD.
Definition: ARICHHapdInfo.h:23
std::string getSerialNumber() const
Return HAPD Serial Number.
Definition: ARICHHapdInfo.h:61
float getHighVoltage() const
Return operational High Voltage.
Definition: ARICHHapdInfo.h:85
ARICHHapdChipInfo * getHapdChipInfo(unsigned int i) const
Return HapdChipInfo of the chip i.
float getQuantumEfficiency400() const
Return quantum efficiency at 400 nm.
Definition: ARICHHapdInfo.h:73
Sensor-module information.
int getSensorModuleID() const
Get sensor-module identifier.
int getFEBserial() const
Get FEB serial number.
std::string getHAPDserial() const
Get HAPD serial number.
ARICHHapdInfo * getHapdID() const
Get HAPD Identifier.

◆ exportSensorModuleMapInfo()

void exportSensorModuleMapInfo ( int  number)

Export module sensor map info classes from database.

Definition at line 3200 of file ARICHDatabaseImporter.cc.

3201{
3202 DBArray<ARICHSensorModuleMap> elements("ARICHSensorModuleMap");
3203 elements.getEntries();
3204
3205 for (const auto& element : elements) {
3206 ARICHSensorModuleInfo* newelement = element.getSensorModuleId();
3207 if (!(newelement->getSensorModuleID() == number)) continue;
3208 B2INFO("Sextant = " << element.getSensorModuleSextantID() << ", ring = " << element.getSensorModuleRingID() << ", column = " <<
3209 element.getSensorModuleColumnID());
3210 B2INFO("module ID = " << newelement->getSensorModuleID() << ", feb = " << newelement->getFEBserial() << ", hapd = " <<
3211 newelement->getHAPDserial());
3212 ARICHHapdInfo* newerelement = newelement->getHapdID();
3213 B2INFO("Hapd Serial = " << newerelement->getSerialNumber() << "; HV = " << newerelement->getHighVoltage() << "; qe400 = " <<
3214 newerelement->getQuantumEfficiency400());
3215 for (int i = 0; i < 4; i++) {
3216 ARICHHapdChipInfo* newestelement = newerelement->getHapdChipInfo(i);
3217 B2INFO("Hapd Serial = " << newestelement->getHapdSerial() << "; chip = " << newestelement->getChipLabel() << "; gain = " <<
3218 newestelement->getGain());
3219 }
3220 }
3221}

◆ getAerogelParams()

std::map< std::string, float > getAerogelParams ( const std::string &  aeroSerialNumber)

Function that returns refractive index, thickness and transmission length of aerogel.

Parameters
aeroSerialNumberaerogel serial number

Definition at line 2741 of file ARICHDatabaseImporter.cc.

2742{
2743 // Description:
2744 // This function loops over aerogel tiles and returns refractive index,
2745 // thickness and transmission length of aerogel for serial number
2746
2747 std::map<std::string, float> aerogelParams;
2748 DBArray<ARICHAerogelInfo> elements("ARICHAerogelInfo");
2749 elements.getEntries();
2750 for (const auto& element : elements) {
2751 if ((element.getAerogelSN()) == aeroSerialNumber) {
2752 aerogelParams = {
2753 { "refractiveIndex", element.getAerogelRefractiveIndex() },
2754 { "transmissionLength", element.getAerogelTransmissionLength() },
2755 { "thickness", element.getAerogelThickness() }
2756 };
2757 }
2758 }
2759 return aerogelParams;
2760}

◆ getAeroTileColumn()

int getAeroTileColumn ( int  slot)

Get aerogel ring number from global indetifier.

Definition at line 699 of file ARICHDatabaseImporter.cc.

700{
701 int column = 0;
702 if (slot < 23) column = slot;
703 else if (slot < 51) column = slot - 22;
704 else if (slot < 85) column = slot - 50;
705 else column = slot - 84;
706
707 return column;
708}

◆ getAeroTileRing()

int getAeroTileRing ( int  slot)

Get aerogel ring number from global indetifier.

Definition at line 688 of file ARICHDatabaseImporter.cc.

689{
690 int ring = 0;
691 if (slot < 23) ring = 1;
692 else if (slot < 51) ring = 2;
693 else if (slot < 85) ring = 3;
694 else ring = 4;
695
696 return ring;
697}

◆ getAsicDate()

TTimeStamp getAsicDate ( const std::string &  asicSerial,
const std::string &  type 
)

Get date for ASIC measurement.

Parameters
asicSerial- serial number of asic
type- gain or offset

Definition at line 1748 of file ARICHDatabaseImporter.cc.

1749{
1750 TTimeStamp timeFinish;
1751 string line;
1752 size_t findText = 100;
1753
1754 // extract measurement date for serial number
1755 for (const string& inputFile : m_inputFilesAsicTxt) {
1756 string inputFileNew = (string) inputFile;
1757 if (type == "gain") { findText = inputFileNew.find("dateGain.txt"); }
1758 else if (type == "offset") { findText = inputFileNew.find("dateOffset.txt"); }
1759 else {B2INFO("Check type of measurement!"); }
1760 if (findText != string::npos) {
1761 std::ifstream ifs(inputFile);
1762 if (ifs.is_open()) {
1763 while (ifs.good()) {
1764 std::getline(ifs, line);
1765 string asicSerial2 = asicSerial + ":";
1766 size_t findSerial = line.find(asicSerial2);
1767 if (findSerial != string::npos) {timeFinish = ARICHDatabaseImporter::timedate(line);}
1768 }
1769 }
1770 ifs.clear();
1771 ifs.close();
1772 }
1773 }
1774 return timeFinish;
1775}
TTimeStamp timedate(std::string enddate)
Convert date (ASICs) to TTimeStamp.

◆ getBiasGraph()

TH2F * getBiasGraph ( const std::string &  chip_2d,
const std::string &  voltage_current,
int *  chipnum,
float *  bias_v_i 
)

Get histograms for bias voltage and current.

Parameters
chip_2d- chip label
voltage_current- voltage or current
chipnum- channel number
bias_v_i- bias voltage/current

Definition at line 2581 of file ARICHDatabaseImporter.cc.

2583{
2584 string name = "bias " + voltage_current + ", chip " + chip_2d;
2585 TH2F* bias2d = new TH2F("bias2d", name.c_str(), 6, 0, 6, 6, 0, 6);
2586 for (int XYname = 0; XYname < 6; XYname++) {
2587 bias2d->GetXaxis()->SetBinLabel(XYname + 1, to_string(XYname).c_str());
2588 bias2d->GetYaxis()->SetBinLabel(XYname + 1, to_string(6 * XYname).c_str());
2589 }
2590 for (int XY = 0; XY < 36; XY++) {
2591 int x = 1;
2592 int y = 0 + chipnum[XY];
2593 while (y > 6) {
2594 y = y - 6;
2595 x = x + 1;
2596 }
2597 bias2d->SetBinContent(x, y, bias_v_i[XY]);
2598 }
2599 bias2d->SetDirectory(0);
2600 return bias2d;
2601}
Point.

◆ getChannelPosition()

int getChannelPosition ( const std::string &  XY,
const std::string &  chip_2d,
int  chipnum 
)

Get position of channel on HAPD.

Parameters
XY- choose X/Y coordinate
chip_2d- chip label
chipnum- channel number

Definition at line 2542 of file ARICHDatabaseImporter.cc.

2543{
2544 int x = 100, y = 100;
2545 if (chip_2d == "A") {
2546 y = 12;
2547 x = 0 + chipnum;
2548 while (x > 6) {
2549 x = x - 6;
2550 y = y - 1;
2551 }
2552 } else if (chip_2d == "B") {
2553 x = 12;
2554 y = 13 - chipnum;
2555 while (y < 7) {
2556 y = y + 6;
2557 x = x - 1;
2558 }
2559 } else if (chip_2d == "C") {
2560 y = 1;
2561 x = 13 - chipnum;
2562 while (x < 7) {
2563 x = x + 6;
2564 y = y + 1;
2565 }
2566 } else if (chip_2d == "D") {
2567 x = 1;
2568 y = 0 + chipnum;
2569 while (y > 6) {
2570 y = y - 6;
2571 x = x + 1;
2572 }
2573 }
2574
2575 if (XY == "x") { return x;}
2576 else if (XY == "y") { return y;}
2577 else {return 100;}
2578}

◆ getDeadChFEB()

std::vector< int > getDeadChFEB ( const std::string &  dna)

Returns list of dead channels on FEB.

Definition at line 2077 of file ARICHDatabaseImporter.cc.

2078{
2079 vector<int> listCHs;
2080 string line;
2081 ifstream fileFEB("febTest/FEBdeadChannels.txt");
2082 if (fileFEB.is_open()) {
2083 while (getline(fileFEB, line)) {
2084 string ch2 = line.substr(line.find(",") + 1);
2085 string dna2 = line.erase(line.find(",") - 1);
2086 if (dna2 == dna) { listCHs.push_back(atoi(ch2.c_str())); }
2087 }
2088 } else { B2INFO("No file FEBdeadChannels.txt"); }
2089 fileFEB.close();
2090
2091 return listCHs;
2092}

◆ getFebDaqSlot()

int getFebDaqSlot ( unsigned  febSlot)

Returns feb daq position from feb slot.

Parameters
febSlotfeb slot number on merger
Returns
feb daq number

Definition at line 994 of file ARICHDatabaseImporter.cc.

995{
996 std::map<unsigned, int> febSlots;
997 febSlots.insert(std::pair<unsigned, int>(6, 0));
998 febSlots.insert(std::pair<unsigned, int>(5, 1));
999 febSlots.insert(std::pair<unsigned, int>(4, 2));
1000 febSlots.insert(std::pair<unsigned, int>(1, 3));
1001 febSlots.insert(std::pair<unsigned, int>(2, 4));
1002 febSlots.insert(std::pair<unsigned, int>(3, 5));
1003
1004 int febDaqSlot = febSlots.find(febSlot)->second;
1005
1006 return febDaqSlot;
1007}

◆ getFebHVtestData()

std::tuple< std::string, float > getFebHVtestData ( int  serial,
int  hvRun 
)

Returns data from high voltage test.

Definition at line 2063 of file ARICHDatabaseImporter.cc.

2064{
2065 GearDir content2HV = GearDir("/ArichData/AllData/FEBDataHV/Content");
2066 std::tuple<std::string, float> HVtest;
2067 for (const auto& testFEBhv : content2HV.getNodes("febtest[" + std::to_string(hvRun) + "]")) {
2068 string timeHV = testFEBhv.getString("time");
2069 for (const auto& testFEBhv_sn : testFEBhv.getNodes("hvtest/feb[sn='" + to_string(serial) + "']/febhv/n[@id='9']")) {
2070 float currentV99p = (float) testFEBhv_sn.getDouble("n1470/I");
2071 HVtest = std::make_tuple(timeHV, currentV99p);
2072 }
2073 }
2074 return HVtest;
2075}
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
std::vector< GearDir > getNodes(const std::string &path="") const
Get vector of GearDirs which point to all the nodes the given path evaluates to.
Definition: Interface.cc:21

◆ getFebLVtestData()

std::tuple< std::string, float, float, float > getFebLVtestData ( int  serial,
int  lvRun 
)

Returns data from low voltage test.

Definition at line 2042 of file ARICHDatabaseImporter.cc.

2043{
2044 GearDir content2LV = GearDir("/ArichData/AllData/FEBDataLV/Content");
2045 std::tuple<std::string, float, float, float> LVtest;
2046 float currentV20p = 0.0, currentV21n = 0.0, currentV38p = 0.0;
2047
2048 for (const auto& testFEBlv : content2LV.getNodes("febtest[" + std::to_string(lvRun) + "]")) {
2049 string timeLV = testFEBlv.getString("time");
2050 for (const auto& testFEBlv_sn : testFEBlv.getNodes("lvtest/feb[sn='" + to_string(serial) + "']/febps/n[@id='14']")) {
2051 for (const auto& testFEBlv_pw : testFEBlv_sn.getNodes("pw18")) {
2052 if (testFEBlv_pw.getInt("@id") == 0) { currentV20p = (float) testFEBlv_pw.getDouble("I"); }
2053 if (testFEBlv_pw.getInt("@id") == 1) { currentV21n = (float) testFEBlv_pw.getDouble("I"); }
2054 if (testFEBlv_pw.getInt("@id") == 2) { currentV38p = (float) testFEBlv_pw.getDouble("I"); }
2055 LVtest = make_tuple(timeLV, currentV20p, currentV21n, currentV38p);
2056 }
2057 }
2058 }
2059 return LVtest;
2060}

◆ getFebTestHistograms()

std::vector< TH3F * > getFebTestHistograms ( const std::string &  dna,
const std::string &  run,
int  febposition 
)

Returns TH3F histograms - offset settings.

Definition at line 2159 of file ARICHDatabaseImporter.cc.

2160{
2161 vector<TH3F*> histogrami;
2162
2163 for (const string& inputFile : m_inputFilesFebTest) {
2164
2165 if (inputFile.find(run) != string::npos) {
2166 TFile* f = TFile::Open(inputFile.c_str(), "READ");
2167 int iMIN = 0, iMAX = 0, delta, stepsNum = 16, i = 0, point2 = 24;
2168 string option;
2169 float stepsMax = 15.5;
2170
2171 // check how many steps were measured
2172 TIter next(f->GetListOfKeys());
2173 TKey* key;
2174 while ((key = (TKey*)next())) {
2175 string strime = key->GetName();
2176 if (strime.compare(0, 5, "h2d_0") == 0) i++;
2177 }
2178
2179 // fill histogram for coarse/fine settings
2180 for (int k = 0; k < 2; k++) {
2181 if (i < 32) {
2182 stepsNum = 15;
2183 stepsMax = 14.5;
2184 point2 = 23;
2185 if (k == 0) { option = "coarse"; iMIN = 2; iMAX = 16; delta = 2;}
2186 if (k == 1) { option = "fine"; iMIN = 17; iMAX = 31; delta = 17; }
2187 } else {
2188 if (k == 0) { option = "coarse"; iMIN = 2; iMAX = 17; delta = 2; }
2189 if (k == 1) { option = "fine"; iMIN = 18; iMAX = 33; delta = 18; }
2190 }
2191
2192 TH3F* histogram = new TH3F((option + " " + dna).c_str(), (option + " " + dna).c_str(), 144, -0.5, 143.5, 250, 299, 799, stepsNum,
2193 -0.5, stepsMax);
2194
2195 for (int j = iMIN; j < iMAX + 1; j++) {
2196 TH2F* hist2d = (TH2F*)f->Get(("h2d_0;" + std::to_string(j)).c_str());
2197 hist2d->SetDirectory(0);
2198
2199 int binZ;
2200 if ((j - delta) < 8) {binZ = 8 - (j - delta);}
2201 if ((j - delta) > 7) {binZ = point2 - (j - delta);}
2202 // conversion TH2F -> TH3F
2203 for (int binX = 144 * febposition + 1; binX < 144 * (febposition + 1) + 1; binX++) {
2204 for (int binY = 1; binY < 251; binY++) {
2205 histogram->SetBinContent(binX - 144 * febposition, binY, binZ, hist2d->GetBinContent(binX, binY));
2206 }
2207 }
2208 }
2209 histogram->SetDirectory(0);
2210 histogrami.push_back(histogram);
2211 for (int kanal = 1; kanal < 145; kanal ++) {
2212 for (int offset = 1; offset < stepsNum + 1; offset++) {
2213 TH1D* h1 = histogram->ProjectionY("A", kanal, kanal, offset, offset);
2214 h1->SetName((dna + " kanal: " + to_string(kanal) + ", offset: " + to_string(offset)).c_str());
2215 }
2216 }
2217 }
2218 f->Close();
2219 }
2220 }
2221
2222 return histogrami;
2223}

◆ getFebTestPulse()

TH2F * getFebTestPulse ( const std::string &  dna,
const std::string &  run,
int  febposition 
)

Returns TH2F histogram of pulse test.

Definition at line 2225 of file ARICHDatabaseImporter.cc.

2226{
2227 TH2F* testPulse = new TH2F(("test pulse " + dna).c_str(), ("test pulse " + dna).c_str(), 144, -0.5, 143.5, 250, 299, 799);
2228
2229 for (const string& inputFile : m_inputFilesFebTest) {
2230 if (inputFile.find(run) != string::npos) {
2231 TFile* f = TFile::Open(inputFile.c_str(), "READ");
2232 TH2F* pulseTest = (TH2F*)f->Get("h2d_0;1");
2233 pulseTest->SetDirectory(0);
2234 for (int binX = 144 * febposition + 1; binX < 144 * (febposition + 1) + 1; binX++) {
2235 for (int binY = 1; binY < 251; binY++) {
2236 testPulse->SetBinContent(binX - 144 * febposition, binY, pulseTest->GetBinContent(binX, binY));
2237 }
2238 }
2239 f->Close();
2240 }
2241 }
2242 return testPulse;
2243}

◆ getFwhm()

std::vector< std::pair< float, float > > getFwhm ( int  serialNum,
const std::string &  runSCAN 
)

Returns lists of FWHM values&sigmas.

Definition at line 2141 of file ARICHDatabaseImporter.cc.

2142{
2143 GearDir contentData = GearDir("/ArichData/AllData/SlopesFebTest/Content");
2144 vector<pair<float, float>> fwhm;
2145
2146 for (const auto& contentSlopes : contentData.getNodes("febtest")) {
2147 if ((contentSlopes.getInt("@id") == serialNum) && (contentSlopes.getString("@run") == run)) {
2148 for (const auto& contSlopes : contentSlopes.getNodes("data/ch")) {
2149 float fwhmVal = (float) contSlopes.getDouble("fwhm");
2150 float fwhmSig = (float) contSlopes.getDouble("sigma");
2151 pair<float, float> fwhmPair = std::make_pair(fwhmVal, fwhmSig);
2152 fwhm.push_back(fwhmPair);
2153 }
2154 }
2155 }
2156 return fwhm;
2157}

◆ getGraphGainCurrent()

TGraph * getGraphGainCurrent ( const std::string &  bomb_aval,
const std::string &  g_i,
const std::string &  chip_label,
int  i,
float *  HV,
float *  gain_current 
)

Get graphs for bombardment and avalanche gain and current.

Parameters
bomb_aval- bombardment or avalanche
g_i- gain or current
chip_label- chip label
i- number of entries
HV- voltage
gain_current- gain/current

Definition at line 2529 of file ARICHDatabaseImporter.cc.

2532{
2533 TGraph* hapd_graph = new TGraph(i, HV, gain_current);
2534 string title = bomb_aval + " " + g_i + ", chip " + chip_label;
2535 hapd_graph->SetTitle(title.c_str());
2536 hapd_graph->GetXaxis()->SetTitle("high voltage");
2537 hapd_graph->GetYaxis()->SetTitle(g_i.c_str());
2538 return hapd_graph;
2539}

◆ getSlopes()

std::pair< std::vector< float >, std::vector< float > > getSlopes ( int  serialNum,
const std::string &  runSCAN 
)

Returns lists of slopes (fine & rough)

Definition at line 2119 of file ARICHDatabaseImporter.cc.

2120{
2121 GearDir contentData = GearDir("/ArichData/AllData/SlopesFebTest/Content");
2122 pair<vector<float>, vector<float>> slopesFebTest;
2123 vector<float> slopesCoarse, slopesFine;
2124
2125 for (const auto& contentSlopes : contentData.getNodes("febtest")) {
2126 if ((contentSlopes.getInt("@id") == serialNum) && (contentSlopes.getString("@run") == run)) {
2127 for (int i = 0; i < 144; i++) {
2128 for (const auto& contSlopes : contentSlopes.getNodes("slope/ch[@id='" + to_string(i) + "']")) {
2129 float slopeCoarse = ((float) contSlopes.getDouble("coarse")) * 2.5 / 1024; // slope in V/step
2130 float slopeFine = ((float) contSlopes.getDouble("fine")) * 2.5 / 1024; // slope in V/step
2131 slopesCoarse.push_back(slopeCoarse);
2132 slopesFine.push_back(slopeFine);
2133 }
2134 }
2135 }
2136 slopesFebTest = std::make_pair(slopesFine, slopesCoarse);
2137 }
2138 return slopesFebTest;
2139}

◆ importAerogelInfo()

void importAerogelInfo ( TString  coreNameSuffix = "")

Import ARICH aerogel data in the database.

Definition at line 1282 of file ARICHDatabaseImporter.cc.

1283{
1284 GearDir content = GearDir("/ArichData/AllData/AerogelData/Content");
1285
1286 // define data array
1287 TClonesArray agelConstants("Belle2::ARICHAerogelInfo");
1288 int agel = 0;
1289
1290 // loop over xml files and extract the data
1291 for (const auto& aerogel : content.getNodes("aerogel")) {
1292 float version = (float) aerogel.getDouble("version");
1293 string serial = aerogel.getString("serial");
1294 string id = aerogel.getString("id");
1295 float index = (float) aerogel.getDouble("index");
1296 float trlen = ((float) aerogel.getDouble("translength")) * Unit::mm;
1297 float thickness = ((float) aerogel.getDouble("thick")) * Unit::mm;
1298 vector<int> lambdas;
1299 vector<float> transmittances;
1300 for (const auto& transmittance : aerogel.getNodes("transmittance/transpoint")) {
1301 int lambda = transmittance.getInt("@lambda");
1302 float val = (float) transmittance.getDouble(".");
1303 lambdas.push_back(lambda);
1304 transmittances.push_back(val);
1305 }
1306
1307 // save data as an element of the array
1308 new (agelConstants[agel]) ARICHAerogelInfo(version, serial, id, index, trlen, thickness, lambdas, transmittances);
1309 agel++;
1310 }
1311
1312 // define interval of validity
1313
1314 // store under default name:
1315 // Database::Instance().storeData(&agelConstants, iov);
1316 // store under user defined name:
1317 TString coreName = "ARICHAerogelInfo";
1318 if (coreNameSuffix != "")
1319 coreName += coreNameSuffix;
1320 Database::Instance().storeData(coreName.Data(), &agelConstants, m_iov);
1321}
static const double mm
[millimeters]
Definition: Unit.h:70
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
Definition: Database.cc:141

◆ importAerogelInfoEventDep()

void importAerogelInfoEventDep ( )

Import intrarun dependant ARICH aerogel data in the database.

-> Example for intrarun dependat data!

Definition at line 1436 of file ARICHDatabaseImporter.cc.

1437{
1438 GearDir content = GearDir("/ArichData/AllData/AerogelData/Content");
1439
1440 // define data arrays
1441 TClonesArray agelConstantsA("Belle2::ARICHAerogelInfo");
1442 TClonesArray agelConstantsB("Belle2::ARICHAerogelInfo");
1443 TClonesArray agelConstantsC("Belle2::ARICHAerogelInfo");
1444
1445
1446 for (int someint = 0; someint < 3; someint++) {
1447 int agel = 0;
1448 // loop over xml files and extract the data
1449 for (const auto& aerogel : content.getNodes("aerogel")) {
1450 // different version is made up - only used to check performance
1451 // of intrarun dependat function
1452 float version = 0;
1453 if (someint == 0) version = (float) aerogel.getDouble("version");
1454 if (someint == 1) version = 4.0;
1455 if (someint == 2) version = 5.0;
1456
1457 string serial = aerogel.getString("serial");
1458 string id = aerogel.getString("id");
1459 float index = (float) aerogel.getDouble("index");
1460 float trlen = ((float) aerogel.getDouble("translength")) * Unit::mm;
1461 float thickness = ((float) aerogel.getDouble("thick")) * Unit::mm;
1462 vector<int> lambdas;
1463 vector<float> transmittances;
1464 for (const auto& transmittance : aerogel.getNodes("transmittance/transpoint")) {
1465 int lambda = transmittance.getInt("@lambda");
1466 float val = (float) transmittance.getDouble(".");
1467 lambdas.push_back(lambda);
1468 transmittances.push_back(val);
1469 }
1470
1471 // save data as an element of the array
1472 if (someint == 0) new (agelConstantsA[agel]) ARICHAerogelInfo(version, serial, id, index, trlen, thickness, lambdas,
1473 transmittances);
1474 if (someint == 1) new (agelConstantsB[agel]) ARICHAerogelInfo(version, serial, id, index, trlen, thickness, lambdas,
1475 transmittances);
1476 if (someint == 2) new (agelConstantsC[agel]) ARICHAerogelInfo(version, serial, id, index, trlen, thickness, lambdas,
1477 transmittances);
1478 agel++;
1479 }
1480 }
1481
1482 // convert pointers to ARICHAerogelInfo into pointers to TObject
1483 TObject* agelObj[3];
1484 agelObj[0] = static_cast<TObject*>(&agelConstantsA);
1485 agelObj[1] = static_cast<TObject*>(&agelConstantsB);
1486 agelObj[2] = static_cast<TObject*>(&agelConstantsC);
1487
1488 // add objects with different validity
1489 EventDependency intraRun(agelObj[0]);
1490 intraRun.add(500, agelObj[1]); // valid from event number 500
1491 intraRun.add(1000, agelObj[2]); // valid from event number 1000
1492
1493 // store under user defined name
1494 Database::Instance().storeData("ARICHAerogelInfoEventDep", &intraRun, m_iov);
1495
1496}

◆ importAerogelMap()

void importAerogelMap ( )

Import ARICH aerogel map in the database.

Definition at line 1384 of file ARICHDatabaseImporter.cc.

1385{
1386 GearDir content = GearDir("/ArichData/AllData/aerogelposition");
1387
1388 // define data array
1389 TClonesArray agelMap("Belle2::ARICHAerogelMap");
1390 int agel = 0;
1391
1392 for (int layer = 0; layer < 2; layer++) {
1393 // loop over xml files and extract the data
1394 for (const auto& aerogel : content.getNodes("position")) {
1395 string agelserial = "";
1396 int ring = aerogel.getInt("ring");
1397 int phi = aerogel.getInt("phi");
1398 if (layer == 1) agelserial = aerogel.getString("upaerogelserial");
1399 if (layer == 0) agelserial = aerogel.getString("downaerogelserial");
1400
1401 // save data as an element of the array
1402 new (agelMap[agel]) ARICHAerogelMap();
1403 auto* agelConst = static_cast<ARICHAerogelMap*>(agelMap[agel]);
1404 agelConst->setAerogelSN(agelserial);
1405 agelConst->setAerogelRingID(ring);
1406 agelConst->setAerogelColumnID(phi);
1407 agelConst->setAerogelLayer(layer, 1);
1408
1409 agel++;
1410 }
1411 }
1412
1413 // store under user defined name:
1414 Database::Instance().storeData("ARICHAerogelMap", &agelMap, m_iov);
1415}
Map of the Aerogel placement.
void setAerogelSN(const std::string &agelid)
Set Aerogel serial number.

◆ importAeroRayleighScatteringFit()

void importAeroRayleighScatteringFit ( std::string  commentSingleWord = "")

Import optical information of aerogel tiles into database.

Definition at line 1237 of file ARICHDatabaseImporter.cc.

1238{
1239 GearDir content = GearDir("/aerogelFit");
1240
1241 //cout<<" ARICHDatabaseImporter::importAeroRayleighScatteringFit "<<endl;
1242
1243 // define data array
1244 TClonesArray agelFitConstants("Belle2::ARICHAerogelRayleighScatteringFit");
1245 int agel = 0;
1246 string serial;
1247 float version = (float) content.getDouble("version");
1248
1249 // loop over xml files and extract the data
1250 for (const auto& aerogel : content.getNodes("aerogeltile")) {
1251 //cout<<agel<<" serial : "<<<<endl;
1252 serial = aerogel.getString("serial");
1253 vector<float> vPar;
1254 vPar.push_back((float)aerogel.getDouble("p0"));
1255 vPar.push_back((float)aerogel.getDouble("p1"));
1256 vPar.push_back((float)aerogel.getDouble("p2"));
1257 vPar.push_back((float)aerogel.getDouble("p3"));
1258 vPar.push_back((float)aerogel.getDouble("p4"));
1259 vPar.push_back((float)aerogel.getDouble("p5"));
1260 vPar.push_back((float)aerogel.getDouble("p6"));
1261 ARICHAerogelRayleighScatteringFit* aeroRayScatFit = new ARICHAerogelRayleighScatteringFit(version, serial, commentSingleWord, vPar);
1262 //if(agel == 0)
1263 // aeroRayScatFit->printContent(true);
1264 //else
1265 // aeroRayScatFit->printContent();
1266 agelFitConstants[agel] = aeroRayScatFit;
1267 agel++;
1268 }
1269
1270 // store under default name:
1271 // Database::Instance().storeData(&agelConstants, iov);
1272 // store under user defined name:
1273 TString coreName = "ARICHAerogelRayleighScatteringFit";
1274 TString coreNameSuffix = commentSingleWord;
1275 if (coreNameSuffix != "")
1276 coreName += coreNameSuffix;
1277 Database::Instance().storeData(coreName.Data(), &agelFitConstants, m_iov);
1278
1279}
The Class for ARICH aerogel Rayleigh scattering fit parameters.

◆ importAeroTilesAlignment()

void importAeroTilesAlignment ( )

Import aerogel tiles alignment parameters from ARICH-AeroTilesAlignment.xml.

Definition at line 246 of file ARICHDatabaseImporter.cc.

247{
248
249 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
250 GearDir alignPars(content, "AeroTilesAlignment");
251
252 ARICHAeroTilesAlignment tileAlign;
253
254 for (auto tile : alignPars.getNodes("Slot")) {
255 int id = tile.getInt("@id");
256 double r = tile.getLength("r");
257 double phi = tile.getAngle("phi");
258 double z = tile.getLength("z");
259 double alpha = tile.getLength("alpha");
260 double beta = tile.getLength("beta");
261 double gamma = tile.getLength("gamma");
262 ARICHPositionElement alignEl(r * cos(phi), r * sin(phi), z, alpha, beta, gamma);
263 tileAlign.setAlignmentElement(id, alignEl);
264 alignEl.print();
265 }
266
268 importObj.construct(tileAlign);
269 importObj.import(m_iov);
270
271}
Alignment parameters for aerogel tiles.
void setAlignmentElement(int id, const ARICHPositionElement &pars)
Sets alignment parameters (element) for aerogel tile.
Position element for ARICH.
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.

◆ importAeroTilesInfo()

void importAeroTilesInfo ( )

Import optical information of aerogel tiles into database.

Definition at line 644 of file ARICHDatabaseImporter.cc.

645{
646 ARICHAeroTilesInfo tilesInfo;
647
648 DBArray<ARICHAerogelMap> elements("ARICHAerogelMap");
649 elements.getEntries();
650 DBArray<ARICHAerogelInfo> elementsInfo("ARICHAerogelInfo");
651 elementsInfo.getEntries();
652
653 for (int slot = 1; slot < 125; slot++) {
656 std::string aeroID = "";
657 float refractiveIndex = 0.;
658 float transmissionLength = 0.;
659 float thickness = 0.;
660 for (int layer = 0; layer < 2; layer++) {
661 for (const auto& element : elements) {
662 if (element.getAerogelLayer(layer) == 1 && element.getAerogelRingID() == ring
663 && element.getAerogelColumnID() == column) aeroID = element.getAerogelSN();
664 }
665 for (const auto& elementInfo : elementsInfo) {
666 if (elementInfo.getAerogelSN() == aeroID) {
667 refractiveIndex = elementInfo.getAerogelRefractiveIndex();
668 transmissionLength = elementInfo.getAerogelTransmissionLength();
669 thickness = elementInfo.getAerogelThickness();
670 }
671 }
672
673 B2INFO("adding mapping... slot " << slot
674 << ", layer " << layer
675 << ", refIn " << refractiveIndex
676 << ", transLen " << transmissionLength
677 << ", thick " << thickness << '\n');
678 tilesInfo.addMapping(slot, layer, refractiveIndex, transmissionLength, thickness);
679
680 }
681 }
682
684 importObj.construct(tilesInfo);
685 importObj.import(m_iov);
686}
The Class for ARICH aerogel tiles properties for even reconstruction.
void addMapping(int slot, int layer, float refractiveIndex, float transmissionLength, float thickness)
Add mapping entry.
int getAeroTileColumn(int slot)
Get aerogel ring number from global indetifier.
int getAeroTileRing(int slot)
Get aerogel ring number from global indetifier.

◆ importAsicInfo()

void importAsicInfo ( )

Import ARICH ASICs data in the database.

Definition at line 1641 of file ARICHDatabaseImporter.cc.

1642{
1643 GearDir content = GearDir("/ArichData/AllData/asicList");
1644 // define data array
1645 TClonesArray asicConstants("Belle2::ARICHAsicInfo");
1646 int asic = 0;
1647
1648 for (const auto& asiclist : content.getNodes("asicinfo")) {
1649 string asicSerial = asiclist.getString("serial");
1650 string comment = asiclist.getString("comment");
1651 string numCH = asiclist.getString("num");
1652
1653 // get time of measurement
1654 TTimeStamp timeFinishGain = ARICHDatabaseImporter::getAsicDate(asicSerial, "gain");
1655 TTimeStamp timeFinishOffset = ARICHDatabaseImporter::getAsicDate(asicSerial, "offset");
1656
1657 // get lists of bad channels
1658 vector<int> nosignalCHs = ARICHDatabaseImporter::channelsList(asiclist.getString("nosignal"));
1659 vector<int> badconnCHs = ARICHDatabaseImporter::channelsList(asiclist.getString("badconn"));
1660 vector<int> badoffsetCHs = ARICHDatabaseImporter::channelsList(asiclist.getString("badoffset"));
1661 vector<int> badlinCHs = ARICHDatabaseImporter::channelsList(asiclist.getString("badlin"));
1662
1663 int num = 0;
1664 if (numCH.find("many") != string::npos) {num = 5000; }
1665 else if (numCH.find("all") != string::npos) {num = 10000; }
1666 else {num = atoi(numCH.c_str()); }
1667
1668
1669 // save data as an element of the array
1670 new (asicConstants[asic]) ARICHAsicInfo();
1671 auto* asicConst = static_cast<ARICHAsicInfo*>(asicConstants[asic]);
1672
1673 asicConst->setAsicID(asicSerial);
1674 asicConst->setTimeFinishGain(timeFinishGain);
1675 asicConst->setTimeFinishOffset(timeFinishOffset);
1676 asicConst->setDeadChannels(nosignalCHs);
1677 asicConst->setBadConnChannels(badconnCHs);
1678 asicConst->setBadOffsetChannels(badoffsetCHs);
1679 asicConst->setBadLinChannels(badlinCHs);
1680 asicConst->setNumOfProblematicChannels(num);
1681 asicConst->setComment(comment);
1682
1683 asic++;
1684 }
1685
1686 Database::Instance().storeData("ARICHAsicInfo", &asicConstants, m_iov);
1687}
Tested ASIC chips.
Definition: ARICHAsicInfo.h:25
void setAsicID(const std::string &id)
Set ASIC identifier.
Definition: ARICHAsicInfo.h:60
std::vector< int > channelsList(std::string badCH)
Get lists of problematic ASIC channels.
TTimeStamp getAsicDate(const std::string &asicSerial, const std::string &type)
Get date for ASIC measurement.

◆ importAsicInfoRoot()

void importAsicInfoRoot ( )

Import large histograms from ARICH ASICs data in the database.

Definition at line 1689 of file ARICHDatabaseImporter.cc.

1690{
1691 TFile f1("asicInfoHistograms.root", "recreate");
1692 TH3F* gain0 = 0;
1693 TH3F* gain1 = 0;
1694 TH3F* gain2 = 0;
1695 TH3F* gain3 = 0;
1696 TH3F* offsetF = 0;
1697 TH3F* offsetR = 0;
1698 string asicSerial = "";
1699
1700 // define tree
1701 TTree* tree = new TTree("asicInfo", "asic info data");
1702
1703 tree->Branch("asicSerial", (void*)asicSerial.c_str(), "string/C", 1024);
1704 tree->Branch("gain0", "TH3F", &gain0);
1705 tree->Branch("gain1", "TH3F", &gain1);
1706 tree->Branch("gain2", "TH3F", &gain2);
1707 tree->Branch("gain3", "TH3F", &gain3);
1708 tree->Branch("offsetF", "TH3F", &offsetF);
1709 tree->Branch("offsetR", "TH3F", &offsetR);
1710
1711 // loop over root files
1712 for (const string& inputFile : m_inputFilesAsicRoot) {
1713
1714 string inputFileNew = (string) inputFile;
1715 string asicName = inputFileNew.substr(inputFileNew.find("/asicData") + 17);
1716 size_t findRoot = asicName.find(".root");
1717 if (findRoot != string::npos) {
1718 // extract the data from files
1719 TFile* f = TFile::Open(inputFile.c_str(), "READ", "", 0);
1720 TIter next(f->GetListOfKeys());
1721 TKey* key;
1722
1723 // fill vectors with histograms with different gain and offset settings
1724 while ((key = (TKey*)next())) {
1725 string strname = key->GetName();
1726 if (strname.find("_g0") != string::npos) gain0 = (TH3F*)f->Get(strname.c_str());
1727 else if (strname.find("_g1") != string::npos) gain1 = (TH3F*)f->Get(strname.c_str());
1728 else if (strname.find("_g2") != string::npos) gain2 = (TH3F*)f->Get(strname.c_str());
1729 else if (strname.find("_g3") != string::npos) gain3 = (TH3F*)f->Get(strname.c_str());
1730 else if (strname.find("_f") != string::npos) offsetF = (TH3F*)f->Get(strname.c_str());
1731 else if (strname.find("_c") != string::npos) offsetR = (TH3F*)f->Get(strname.c_str());
1732 else B2INFO("Key name does not match any of the following: gain, offset!");
1733 }
1734
1735 tree->Fill();
1736 f->Close();
1737 }
1738 }
1739
1740 f1.cd();
1741 tree->Write();
1742 f1.Close();
1743
1744// define IOV and store data to the DB
1745 Database::Instance().addPayload("ARICHAsicInfoRoot", "asicInfoHistograms.root", m_iov);
1746}
bool addPayload(const std::string &name, const std::string &fileName, const IntervalOfValidity &iov)
Add a payload file to the database.
Definition: Database.h:192

◆ importBiasMappings()

void importBiasMappings ( )

Imports mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltages.

Definition at line 737 of file ARICHDatabaseImporter.cc.

738{
739
740 GearDir content = GearDir("/DetectorCables[@name='ARICH']/Content");
741
743
745 GearDir mapping(content, "biasCableMapping");
746
747 for (const GearDir& module : mapping.getNodes("cableMap")) {
748 unsigned cableID = (unsigned) module.getInt("cableID");
749 unsigned innerID = module.getInt("innerID");
750 unsigned ring = module.getInt("ring");
751 unsigned azimuth = module.getInt("azimuth");
752 for (unsigned sector = 1; sector < 7; sector++) {
753 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
754 biasMap.addMapping(moduleID, sector, cableID, innerID);
755 }
756 }
757
758 ARICHBiasChannelsMapping channelsMap;
759 GearDir mappingCH(content, "biasChannelMapping");
760
761 for (const GearDir& module : mappingCH.getNodes("channelMap")) {
762 int crate = module.getInt("crate");
763 int slot = module.getInt("slot");
764 int channelID = module.getInt("channelID");
765 int pinID = module.getInt("pinID");
766 int connectionID = module.getInt("connectionID");
767 int innerID = module.getInt("innerID");
768 std::string type = module.getString("type");
769 channelsMap.addMapping(crate, slot, channelID, pinID, connectionID, innerID, type);
770 }
771
773 GearDir mappingCrate(content, "biasCrateToCable");
774
775 for (const GearDir& module : mappingCrate.getNodes("connection")) {
776 int connectionID = module.getInt("connectionID");
777 int sector = module.getInt("sector");
778 int cable = module.getInt("cable");
779 std::vector<int> sectorCable{sector, cable};
780
781 crateMap.addMapping(connectionID, sectorCable);
782 }
783
785 importObjBias.construct(biasMap);
786 importObjBias.import(m_iov);
787
789 importObjBiasCH.construct(channelsMap);
790 importObjBiasCH.import(m_iov);
791
793 importObjBiasCrate.construct(crateMap);
794 importObjBiasCrate.import(m_iov);
795}
The Class for ARICH mapping of bias cables to modules.
void addMapping(int moduleID, int sectorID, int cableID, int innerID)
Add mapping entry.
This class provides ARICH mapping of HAPD modules to bias power supply channels.
void addMapping(int crate, int slot, int channelID, int pinID, int connectionID, int innerID, const std::string &type)
Add new entry to the mapping table.
This class provides ARICH bias voltages at gain 40.
void addMapping(int connectionID, std::vector< int > sectorCable)
Add new entry to the mapping table.

◆ importChannelMapping()

void importChannelMapping ( )

Imports HAPD (asic) channel mappings from the xml file.

Definition at line 505 of file ARICHDatabaseImporter.cc.

506{
507 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
509
510 istringstream chstream;
511 int x, y, asic;
512 chstream.str(content.getString("ChannelMapping/SoftChannelMapping"));
513
514 B2INFO("Importing channel x,y to asic channel map\n");
515 B2INFO(" x y asic\n");
516 while (chstream >> x >> y >> asic) {
517 chMap.mapXY2Asic(x, y, asic);
518 B2INFO(" " << setw(2) << x << " " << setw(2) << y << " " << setw(3) << asic << '\n');
519 }
520
522 importObjMap.construct(chMap);
523 importObjMap.import(m_iov);
524
525}
The Class for ARICH HAPD channel mapping.
void mapXY2Asic(unsigned xChn, unsigned yChn, unsigned asicChn)
Add entry to channel map.

◆ importChannelMask() [1/2]

void importChannelMask ( )

Import channel mask for all HAPD modules from the database (list of dead channels) Goes through the list of installed modules in ARICH-InstalledModules.xml, finds corresponding lists of dead channels in the database and imports lightweight ARICHChannelMask class (which is used in sim/rec) into database.

Definition at line 274 of file ARICHDatabaseImporter.cc.

275{
276
278
279 // module test results from DB (we take list of dead channels from here)
280 DBArray<ARICHModuleTest> moduleTest("ARICHModuleTestHV");
281
282 ARICHChannelMask chanMask;
283
284 // loop over installed modules (from xml file)
285 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content/InstalledModules");
286 B2INFO("Installed modules\n");
287 for (const GearDir& module : content.getNodes("Module")) {
288 std::string hapdID = module.getString("@hapdID");
289 unsigned sector = module.getInt("Sector");
290 unsigned ring = module.getInt("Ring");
291 unsigned azimuth = module.getInt("Azimuth");
292 bool isActive = (bool)module.getInt("isActive");
293 B2INFO(" " << hapdID << ": S " << sector << " R " << ring << " Z " << azimuth << ", isActive: " << isActive << '\n');
294 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
295
296 // get and set channel mask (mask dead channels)
297 bool init = false;
298 for (const auto& test : moduleTest) {
299 if (hapdID == test.getHapdSN()) {
300
301 // loop over list of dead channels
302 for (int i = 0; i < test.getDeadChsSize(); i++) {
303 unsigned asicCh = test.getDeadCh(i);
304 if (asicCh > 143)B2ERROR("ARICHDatabaseImporter::importLWClasses: Asic channel for HAPD " << hapdID << " is out of range!");
305 chanMask.setActiveCh(moduleID, asicCh, false);
306 }
307 init = true;
308 B2INFO(" List of dead channels (from module test) found and set.\n");
309 }
310 }
311
312 if (!init) {
313 B2WARNING("ARICHDatabaseImporter::importLWClasses: List of dead channels for hapd " << hapdID <<
314 " not found! All channels set to active.");
315 continue;
316 }
317 }
318
320 importObj.construct(chanMask);
321 importObj.import(m_iov);
322
323}
The Class for ARICH HAPD channel mask.
void setActiveCh(unsigned modId, unsigned chNo, bool active)
Set active/non-active channel.

◆ importChannelMask() [2/2]

void importChannelMask ( TH1 *  h)

Import channel mask from the calibration histogram ( list of dead and hot channels ) to ARICHChannelMask class into database.

Parameters
hTH1F root histogram with 420*144 bins

Definition at line 421 of file ARICHDatabaseImporter.cc.

422{
423 if (h == NULL) {
424 B2ERROR("--> NULL Histogram");
425 return;
426 }
427
428 ARICHChannelMask mask;
429 int inactive = 0;
430 int numChannels = h->GetNbinsX();
431 const int NumberOfChannelsPerHapd = 144;
432 const int NumberOfHapds = 420;
433
434 if (numChannels != NumberOfHapds * NumberOfChannelsPerHapd) {
435 B2ERROR("There should be " << NumberOfHapds * NumberOfChannelsPerHapd << " in the histogram!");
436 return;
437 }
438
439 for (int bin = 1; bin <= numChannels; ++bin) {
440 int moduleID = (bin - 1) / NumberOfChannelsPerHapd + 1;
441 int channelID = (bin - 1) % NumberOfChannelsPerHapd;
442 bool value = (h->GetBinContent(bin) > 0);
443 if (!value) inactive++;
444 //B2INFO("--> moduleID " << moduleID << " channelID " << channelID << " ACTIVE:" << inactive);
445
446 mask.setActiveCh(moduleID, channelID, value);
447 }
448
450 importObj.construct(mask);
451 importObj.import(m_iov);
452 B2INFO("--> Channel Mask imported. Number of disabled channels=" << inactive << " Number of all channels=" << numChannels);
453}

◆ importCosmicTestGeometry()

void importCosmicTestGeometry ( )

Import parameters of the cosmic test geometry configuration.

Definition at line 599 of file ARICHDatabaseImporter.cc.

600{
601 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
602 GearDir cosmic(content, "CosmicTest");
604
606 geoImport.construct(*geoConfig);
607
608 ARICHGeometryConfig& geo = (ARICHGeometryConfig&)geoImport;
609
610 GearDir masterDir(cosmic, "MasterVolume");
612 master.setPlacement(masterDir.getLength("Position/x"), masterDir.getLength("Position/y"), masterDir.getLength("Position/z"),
613 masterDir.getAngle("Rotation/x"), masterDir.getAngle("Rotation/y"), masterDir.getAngle("Rotation/z"));
614 master.setVolume(master.getInnerRadius(), master.getOuterRadius(), 100., master.getMaterial());
615 geo.setMasterVolume(master);
616
617
618 GearDir aerogel(cosmic, "Aerogel");
619 std::vector<double> par = {aerogel.getLength("xSize"), aerogel.getLength("ySize"), aerogel.getLength("xPosition"), aerogel.getLength("yPosition"), aerogel.getAngle("zRotation")};
621 plane.setSimple(par);
622 geo.setAerogelPlane(plane);
623
624 GearDir scints(cosmic, "Scintilators");
625 double size[3] = {scints.getLength("xSize"), scints.getLength("ySize"), scints.getLength("zSize")};
626 std::string scintMat = scints.getString("Material");
627
628 ARICHGeoSupport support = geo.getSupportStructure();
629 support.clearBoxes();
630 for (const GearDir& scint : scints.getNodes("Scintilator")) {
631 std::string name = scint.getString("@name");
632 double position[3] = {scint.getLength("Position/x"), scint.getLength("Position/y"), scint.getLength("Position/z")};
633 double rotation[3] = {scint.getAngle("Rotation/x"), scint.getAngle("Rotation/y"), scint.getAngle("Rotation/z")};
634 support.addBox(name, scintMat, size, position, rotation);
635 }
636
637 geo.setSupportStructure(support);
638
639 IntervalOfValidity iov(0, 0, -1, -1); // IOV (0,0,-1,-1) is valid for all runs and experiments
640 geoImport.import(iov);
641
642}
Geometry parameters of HAPD.
Geometry parameters of ARICH Master volume (envelope)
double getOuterRadius() const
Get ARICH master volume outer radius.
double getInnerRadius() const
Get ARICH master volume inner radius.
void setVolume(double innerR, double outerR, double length, const std::string &material)
Sets parameters of ARICH master volume.
const std::string & getMaterial() const
Get material of ARICH master volume.
void setPlacement(double x, double y, double z, double rx, double ry, double rz)
Sets positioning of ARICH master volume in global Belle II coordinate system.
Geometry parameters of ARICH support structures and neutron shield.
void clearBoxes()
Clear container of boxes.
void addBox(const std::string &name, const std::string &material, double size[3], double position[3], double rotation[3])
Add box volume.
The Class for ARICH Geometry Parameters.
const ARICHGeoAerogelPlane & getAerogelPlane() const
Get geometry configuration of aerogel plane.
void setAerogelPlane(const ARICHGeoAerogelPlane &aerogelPlane)
Set geometry configuration of aerogel plane.
void setMasterVolume(const ARICHGeoMasterVolume &masterVolume)
Set master volume geometry configuration.
const ARICHGeoMasterVolume & getMasterVolume() const
Get ARICH master volume geometry configuration.
const ARICHGeoSupport & getSupportStructure() const
Get ARICH support structure geometry configuration.
void setSupportStructure(const ARICHGeoSupport &supportStructure)
Set support structure geometry configuration.

◆ importFEBoardInfo()

void importFEBoardInfo ( )

Import module test results.

Definition at line 2762 of file ARICHDatabaseImporter.cc.

2763{
2764
2765 GearDir content = GearDir("/ArichData/AllData/febasicmapping");
2766
2767 // define data array
2768 TClonesArray febConstants("Belle2::ARICHFEBoardInfo");
2769 int feb = 0;
2770
2771 // loop over xml files and extract the data
2772 for (const auto& febinfo : content.getNodes("febasic")) {
2773 int febSN = (float) febinfo.getInt("sn");
2774 string asic1 = febinfo.getString("asic1");
2775 string asic2 = febinfo.getString("asic2");
2776 string asic3 = febinfo.getString("asic3");
2777 string asic4 = febinfo.getString("asic4");
2778 string delivery = febinfo.getString("delivered");
2779 string sentKEK = febinfo.getString("sentKEK");
2780
2781 if (delivery.size() != 10) cout << "feb sn " << febSN << " check delivery time!" << endl;
2782
2783 string year = delivery.substr(6, 4);
2784 delivery = febinfo.getString("delivered");
2785 string month = delivery.substr(3, 2);
2786 delivery = febinfo.getString("delivered");
2787 string day = delivery.substr(0, 2);
2788
2789 int deliveryINT = atoi((year + month + day + "u").c_str());
2790 TTimeStamp deliverytime(deliveryINT, 0u, 0u);
2791
2792 string location = "";
2793 if (!sentKEK.empty()) location = "KEK";
2794
2795 // save data as an element of the array
2796 new (febConstants[feb]) ARICHFEBoardInfo();
2797 auto* febConst = static_cast<ARICHFEBoardInfo*>(febConstants[feb]);
2798 febConst->setFEBoardSerial(febSN);
2799 febConst->setAsicPosition(0, asic1);
2800 febConst->setAsicPosition(1, asic2);
2801 febConst->setAsicPosition(2, asic3);
2802 febConst->setAsicPosition(3, asic4);
2803 febConst->setTimeStamp(deliverytime);
2804 febConst->setFEBoardLocation(location);
2805
2806 DBArray<ARICHAsicInfo> elementsAsic("ARICHAsicInfo");
2807 elementsAsic.getEntries();
2808 for (const auto& element : elementsAsic) {
2809 if (element.getAsicID() == asic1) {
2810 ARICHAsicInfo& elementValue = const_cast<ARICHAsicInfo&>(element);
2811 febConst->setAsicInfo(0, &elementValue);
2812 }
2813 if (element.getAsicID() == asic2) {
2814 ARICHAsicInfo& elementValue = const_cast<ARICHAsicInfo&>(element);
2815 febConst->setAsicInfo(1, &elementValue);
2816 }
2817 if (element.getAsicID() == asic3) {
2818 ARICHAsicInfo& elementValue = const_cast<ARICHAsicInfo&>(element);
2819 febConst->setAsicInfo(2, &elementValue);
2820 }
2821 if (element.getAsicID() == asic4) {
2822 ARICHAsicInfo& elementValue = const_cast<ARICHAsicInfo&>(element);
2823 febConst->setAsicInfo(3, &elementValue);
2824 }
2825 }
2826
2827 feb++;
2828 }
2829
2830 // store under user defined name:
2831 Database::Instance().storeData("ARICHFEBoardInfo", &febConstants, m_iov);
2832}
Front End Electronics Boards.
void setFEBoardSerial(int serial)
Set Front-End Board identifier.

◆ importFebTest()

void importFebTest ( )

Import ARICH FEB test data in the database.

Definition at line 1820 of file ARICHDatabaseImporter.cc.

1821{
1822
1823 // define data array
1824 TClonesArray febConstants("Belle2::ARICHFebTest");
1825
1826 int feb = 0;
1827
1828 GearDir content = GearDir("/ArichData/AllData/arich");
1829 GearDir content1 = GearDir("/ArichData/AllData/dnamap");
1830 GearDir content2 = GearDir("/ArichData/AllData/FEBData/Content");
1831
1832 for (const auto& runserial : content.getNodes("run")) {
1833 int serial = runserial.getInt("sn");
1834 // save data as an element of the array
1835 new (febConstants[feb]) ARICHFebTest();
1836 auto* febConst = static_cast<ARICHFebTest*>(febConstants[feb]);
1837 febConst->setFebSerial(serial);
1838
1839 string runLV = runserial.getString("lv");
1840 string runHV = runserial.getString("hv");
1841 string runSCAN = runserial.getString("scan");
1842 string comment = runserial.getString("comment");
1843
1844 febConst->setRunLV(runLV);
1845 febConst->setRunHV(runHV);
1846 febConst->setRunSlowC(runSCAN);
1847 febConst->setComment(comment);
1848
1849 int l = 0;
1850 string dna;
1851
1852 for (const auto& febmap : content1.getNodes("febps")) {
1853 string somedna = febmap.getString("@dna");
1854 int sn = febmap.getInt("sn");
1855 if ((l == 0) && (sn == serial)) {
1856 dna = somedna;
1857 febConst->setFebDna(dna);
1858 //febConst->setDeadChannels(ARICHDatabaseImporter::getDeadChFEB(dna));
1859 l++;
1860 }
1861 }
1862
1863 // slow control data
1864 if (!runSCAN.empty()) {
1865 int scanRun;
1866 if (stoi(runSCAN.c_str()) < 23) {scanRun = stoi(runSCAN.c_str());}
1867 else {scanRun = stoi(runSCAN.c_str()) - 77;}
1868 for (const auto& testFEB : content2.getNodes("febtest[" + std::to_string(scanRun) + "]")) {
1869 string timeSlowC = testFEB.getString("time");
1870 int i = 0;
1871 int positionOld = 0;
1872
1873 for (const auto& testFEBslowctest : testFEB.getNodes("slowc")) {
1874 int position = testFEBslowctest.getInt("id");
1875 if (position == positionOld) {i++; }
1876 else {i = 1; }
1877 if (i == 10) {
1878 string dnaNew = testFEBslowctest.getString("dna");
1879 if (dnaNew == dna) {
1880 float tmon0 = (float) testFEBslowctest.getDouble("TMON0");
1881 float tmon1 = (float) testFEBslowctest.getDouble("TMON1");
1882 float vdd = (float) testFEBslowctest.getDouble("VDD");
1883 float v2p = (float) testFEBslowctest.getDouble("V2P");
1884 float v2n = (float) testFEBslowctest.getDouble("V2N");
1885 float vss = (float) testFEBslowctest.getDouble("VSS");
1886 float vth1 = (float) testFEBslowctest.getDouble("VTH1");
1887 float vth2 = (float) testFEBslowctest.getDouble("VTH2");
1888 float vcc12 = (float) testFEBslowctest.getDouble("VCC12");
1889 float vcc15 = (float) testFEBslowctest.getDouble("VCC15");
1890 float vcc25 = (float) testFEBslowctest.getDouble("VCC25");
1891 float v38p = (float) testFEBslowctest.getDouble("V38P");
1892
1893 febConst->setTemperature0(tmon0);
1894 febConst->setTemperature1(tmon1);
1895 febConst->setVdd(vdd);
1896 febConst->setV2p(v2p);
1897 febConst->setV2n(v2n);
1898 febConst->setVss(vss);
1899 febConst->setVth1(vth1);
1900 febConst->setVth2(vth2);
1901 febConst->setVcc12(vcc12);
1902 febConst->setVcc15(vcc15);
1903 febConst->setVcc25(vcc25);
1904 febConst->setV38p(v38p);
1905 febConst->setTimeSlowC(ARICHDatabaseImporter::timedate2(timeSlowC));
1906
1907 }
1908 }
1909 positionOld = position;
1910 }
1911 }
1912
1913 // slopes (from offset settings measurements)
1914 pair<vector<float>, vector<float>> slopes = ARICHDatabaseImporter::getSlopes(serial, runSCAN);
1915
1916 febConst->setSlopesFine(slopes.first); // std::vector<float>
1917 febConst->setSlopesRough(slopes.second); // std::vector<float>
1918
1919 // set FWHM values&sigmas)
1920 vector<pair<float, float>> fwhm = ARICHDatabaseImporter::getFwhm(serial, runSCAN);
1921 febConst->setFWHM(fwhm);
1922 }
1923
1924
1925 // high voltage test data
1926 if (!runHV.empty()) {
1927 int hvRun;
1928 if (stoi(runHV.c_str()) < 43) {hvRun = stoi(runHV.c_str());}
1929 else {hvRun = stoi(runHV.c_str()) - 57;}
1930 tuple<string, float> HVtest = ARICHDatabaseImporter::getFebHVtestData(serial, hvRun);
1931 febConst->setTimeHV(ARICHDatabaseImporter::timedate2(get<0>(HVtest)));
1932 febConst->setCurrentV99p(get<1>(HVtest));
1933 }
1934
1935
1936 // low voltage test data
1937 if (!runLV.empty()) {
1938 int lvRun;
1939 if (stoi(runLV.c_str()) < 43) {lvRun = stoi(runLV.c_str());}
1940 else {lvRun = stoi(runLV.c_str()) - 57;}
1941 tuple<string, float, float, float> LVtest = ARICHDatabaseImporter::getFebLVtestData(serial, lvRun);
1942 febConst->setTimeLV(ARICHDatabaseImporter::timedate2(get<0>(LVtest)));
1943 febConst->setCurrentV20p(get<1>(LVtest));
1944 febConst->setCurrentV21n(get<2>(LVtest));
1945 febConst->setCurrentV38p(get<3>(LVtest));
1946 }
1947
1948 feb++;
1949
1950 }
1951
1952// define IOV and store data to the DB
1953 Database::Instance().storeData("ARICHFebTest", &febConstants, m_iov);
1954}
std::vector< std::pair< float, float > > getFwhm(int serialNum, const std::string &runSCAN)
Returns lists of FWHM values&sigmas.
TTimeStamp timedate2(std::string time)
Convert date (FEB) to TTimeStamp.
std::tuple< std::string, float > getFebHVtestData(int serial, int hvRun)
Returns data from high voltage test.
std::pair< std::vector< float >, std::vector< float > > getSlopes(int serialNum, const std::string &runSCAN)
Returns lists of slopes (fine & rough)
std::tuple< std::string, float, float, float > getFebLVtestData(int serial, int lvRun)
Returns data from low voltage test.
ARICH FEB test data.
Definition: ARICHFebTest.h:30
void setFebSerial(int serial)
Set FEB serial number.
Definition: ARICHFebTest.h:66

◆ importFebTestRoot()

void importFebTestRoot ( )

Import large histograms from ARICH FEB test data in the database.

Definition at line 1958 of file ARICHDatabaseImporter.cc.

1959{
1960 TFile f("febTestHistograms.root", "recreate");
1961 TH3F* offsetRough = 0;
1962 TH3F* offsetFine = 0;
1963 TH2F* testPulse = 0;
1964 int serial;
1965
1966 // define tree
1967 TTree* tree = new TTree("febTest", "feb test data");
1968
1969 tree->Branch("serial", &serial, "sn/I");
1970 tree->Branch("offsetRough", "TH3F", &offsetRough);
1971 tree->Branch("offsetFine", "TH3F", &offsetFine);
1972 tree->Branch("testPulse", "TH2F", &testPulse);
1973
1974 int febposition = -1;
1975
1976 GearDir content = GearDir("/ArichData/AllData/arich");
1977 GearDir content1 = GearDir("/ArichData/AllData/dnamap");
1978 GearDir content2 = GearDir("/ArichData/AllData/FEBData/Content");
1979
1980 for (const auto& runserial : content.getNodes("run")) {
1981 serial = runserial.getInt("sn");
1982 string runSCAN = runserial.getString("scan");
1983 int l = 0;
1984 string dna;
1985
1986 for (const auto& febmap : content1.getNodes("febps")) {
1987 string somedna = febmap.getString("@dna");
1988 int sn = febmap.getInt("sn");
1989 if ((l == 0) && (sn == serial)) {
1990 dna = somedna;
1991 l++;
1992 }
1993 }
1994 // slow control data
1995 if (!runSCAN.empty()) {
1996 int scanRun;
1997 if (stoi(runSCAN.c_str()) < 23) {scanRun = stoi(runSCAN.c_str());}
1998 else {scanRun = stoi(runSCAN.c_str()) - 77;}
1999 for (const auto& testFEB : content2.getNodes("febtest[" + std::to_string(scanRun) + "]")) {
2000 int i = 0;
2001 int positionOld = 0;
2002
2003 for (const auto& testFEBslowctest : testFEB.getNodes("slowc")) {
2004 int position = testFEBslowctest.getInt("id");
2005 if (position == positionOld) {i++; }
2006 else {i = 1; }
2007 if (i == 10) {
2008 string dnaNew = testFEBslowctest.getString("dna");
2009 if (dnaNew == dna) febposition = position;
2010 }
2011 positionOld = position;
2012 }
2013 }
2014 vector<TH3F*> histograms = getFebTestHistograms(dna, runSCAN, febposition);
2015 offsetRough = histograms[0];
2016 offsetFine = histograms[1];
2017
2018 testPulse = ARICHDatabaseImporter::getFebTestPulse(dna, runSCAN, febposition); // TH2F*
2019
2020 testPulse->SetDirectory(0);
2021 offsetRough->SetDirectory(0);
2022 offsetFine->SetDirectory(0);
2023
2024 tree->Fill();
2025
2026 delete testPulse;
2027 delete offsetRough;
2028 delete offsetFine;
2029 }
2030 }
2031
2032 f.cd();
2033 tree->Write();
2034 f.Close();
2035
2036
2037// define IOV and store data to the DB
2038 Database::Instance().addPayload("ARICHFebTestRoot", "febTestHistograms.root", m_iov);
2039
2040}
std::vector< TH3F * > getFebTestHistograms(const std::string &dna, const std::string &run, int febposition)
Returns TH3F histograms - offset settings.
TH2F * getFebTestPulse(const std::string &dna, const std::string &run, int febposition)
Returns TH2F histogram of pulse test.

◆ importFEMappings()

void importFEMappings ( )

Imports mappings of FE electronics from the xml file (ARICH-FrontEndMapping.xml) to the database Mapping of modules to mergers and mergers to coppers.

Definition at line 527 of file ARICHDatabaseImporter.cc.

528{
529
530 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
531
533
534 ARICHMergerMapping mergerMap;
535 ARICHCopperMapping copperMap;
536 GearDir mapping(content, "FrontEndMapping");
537
538 for (const GearDir& merger : mapping.getNodes("Merger")) {
539 unsigned mergerID = (unsigned) merger.getInt("@id");
540 unsigned mergerSN = (unsigned) merger.getInt("@sn");
541 B2INFO('\n' << "Mapping of modules to merger no. " << mergerID << ", SN = " << mergerSN << '\n');
542 for (const GearDir& module : merger.getNodes("Modules/Module")) {
543 unsigned sector = module.getInt("Sector");
544 unsigned ring = module.getInt("Ring");
545 unsigned azimuth = module.getInt("Azimuth");
546 std::cout << "ring = " << ring << '\n';
547 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
548 std::cout << "moduleID = " << moduleID << '\n';
549 unsigned slot = (unsigned) module.getInt("@FEBSlot");
550 mergerMap.addMapping(moduleID, mergerID, slot, mergerSN);
551 std::cout << '\n' << " FEB slot: " << slot << ", module position: S" << sector << " R" << ring << " Z" << azimuth <<
552 ", module ID: " << moduleID << '\n';
553 std::cout << " crosscheck: mergerMap.getMergerID(" << moduleID << ") = " << mergerMap.getMergerID(
554 moduleID) << ", mergerMap.getFEBSlot(" << moduleID << ") = " << mergerMap.getFEBSlot(moduleID) << ", mergerMap.getModuleID(" <<
555 mergerID << "," << slot << ") = " << mergerMap.getModuleID(mergerID, slot) << '\n';
556
557 }
558 std::cout << '\n';
559
560 unsigned copperID = (unsigned) merger.getInt("COPPERid");
561 string finesseSlot = merger.getString("FinesseSlot");
562 int finesse = 0;
563 if (finesseSlot == "A") {finesse = 0;}
564 else if (finesseSlot == "B") {finesse = 1;}
565 else if (finesseSlot == "C") {finesse = 2;}
566 else if (finesseSlot == "D") {finesse = 3;}
567 else {
568 B2ERROR(merger.getPath() << "/FinesseSlot " << finesseSlot <<
569 " ***invalid slot (valid are A, B, C, D)");
570 continue;
571 }
572 copperMap.addMapping(mergerID, copperID, finesse);
573 std::cout << "Merger " << mergerID << " connected to copper " << copperID << ", finesse " << finesse << '\n';
574
575 }
576
578 importObjMerger.construct(mergerMap);
579 importObjMerger.import(m_iov);
580
582 importObjCopper.construct(copperMap);
583 importObjCopper.import(m_iov);
584
585}
The Class for ARICH mapping of merger to copper boards.
void addMapping(unsigned mergerID, unsigned copperID, unsigned finesse)
Add new entry to the mapping table.
The Class for ARICH mapping of modules to merger boards.
unsigned getModuleID(unsigned mergerID, unsigned febSlot) const
Get ID of module connected to merger at FEB slot.
void addMapping(unsigned moduleID, unsigned mergerID, unsigned febSlot, unsigned mergerSN)
Add mapping entry.
unsigned getMergerID(unsigned moduleID) const
Get ID of merger to which module is connected.
unsigned getFEBSlot(unsigned moduleID) const
Get FEB slot to which module is connected.

◆ importGeometryConfig()

void importGeometryConfig ( )

Import geometry configuration parameters to the database.

Definition at line 587 of file ARICHDatabaseImporter.cc.

588{
589
590 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
591 ARICHGeometryConfig arichGeometryConfig(content);
592
594 importObj.construct(arichGeometryConfig);
595 importObj.import(m_iov);
596
597}

◆ importGlobalAlignment()

void importGlobalAlignment ( )

Import global alignment parameters from ARICH-GlobalAlignment.xml.

Definition at line 200 of file ARICHDatabaseImporter.cc.

201{
202
203 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
204 GearDir alignPars(content, "GlobalAlignment");
205 ARICHGlobalAlignment arichAlign;
206 ARICHPositionElement alignel(alignPars.getLength("x"), alignPars.getLength("y"), alignPars.getLength("z"),
207 alignPars.getAngle("alpha"), alignPars.getAngle("beta"), alignPars.getAngle("gamma"));
208 arichAlign.setAlignmentElement(alignel);
209
211 importObj.construct(arichAlign);
212 importObj.import(m_iov);
213}
Geometry parameters of ARICH Master volume (envelope).
void setAlignmentElement(const ARICHPositionElement &align)
Sets alignment parameters (element).

◆ importHapdChipInfo()

void importHapdChipInfo ( )

Import ARICH HAPD chip data in the database.

Definition at line 2261 of file ARICHDatabaseImporter.cc.

2262{
2263 int chip_i = 0;
2264 GearDir content = GearDir("/ArichData/AllData/hapdData/Content");
2265
2266 // define data array
2267 TClonesArray chipConstants("Belle2::ARICHHapdChipInfo");
2268
2269 // extract chip info, such as bias voltage, lists of dead and bad channels etc.
2270 for (const auto& hapdInfo : content.getNodes("hapd")) {
2271 // extract information about HAPD
2272 string sn = hapdInfo.getString("serial");
2273
2274 // define objects for chip info
2275 string chip[4];
2276 int channel_label_aval[4], bias[4], gain[4];
2277 TGraph** bombardmentGain, **avalancheGain;
2278 bombardmentGain = new TGraph *[4];
2279 avalancheGain = new TGraph *[4];
2280 TH2F** bias2DV, **bias2DI;
2281 bias2DV = new TH2F *[4];
2282 bias2DI = new TH2F *[4];
2283 vector<int> badlist[4], cutlist[4];
2284 vector<TGraph*> bombCurrents[4], avalCurrents[4];
2285 int chip_ABCD = 0;
2286
2287 // extract information for each chip
2288 for (const auto& chipInfo : hapdInfo.getNodes("chipinfo")) {
2289 chip[chip_ABCD] = chipInfo.getString("chip");
2290 bias[chip_ABCD] = chipInfo.getInt("bias");
2291 string badL = chipInfo.getString("deadlist");
2292 string cutL = chipInfo.getString("cutlist");
2293 if (badL.find("ch") != string::npos) { string badLsub = badL.substr(3); badlist[chip_ABCD] = ARICHDatabaseImporter::channelsListHapd(badLsub.c_str(), chip[chip_ABCD]); }
2294 if (cutL.find("ch") != string::npos) { string cutLsub = cutL.substr(3); cutlist[chip_ABCD] = ARICHDatabaseImporter::channelsListHapd(cutLsub.c_str(), chip[chip_ABCD]); }
2295 string gain_str = chipInfo.getString("gain");
2296 gain[chip_ABCD] = atoi(gain_str.c_str());
2297 chip_ABCD++;
2298 }
2299
2300 // prepare TGraphs for bombardment gain and current
2301 const int n3 = 30;
2302 int i3 = 0;
2303 //int channel_label_bomb;
2304 float hv_bomb[n3], gain_bomb[n3], current1_bomb[n3], current2_bomb[n3], current3_bomb[n3];
2305 chip_ABCD = 0;
2306 for (const auto& BG : hapdInfo.getNodes("bombardmentgain/ch")) {
2307 string value = BG.getString("value");
2308 string chip_label = value.erase(1);
2309 for (const auto& BG2 : BG.getNodes("point")) {
2310 hv_bomb[i3] = (float) BG2.getDouble("hv");
2311 gain_bomb[i3] = (float) BG2.getDouble("gain");
2312 current1_bomb[i3] = (float) BG2.getDouble("current1");
2313 current2_bomb[i3] = (float) BG2.getDouble("current2");
2314 current3_bomb[i3] = (float) BG2.getDouble("current3");
2315 i3++;
2316 }
2317
2318 bombardmentGain[chip_ABCD] = ARICHDatabaseImporter::getGraphGainCurrent("Bombardment", "gain", chip_label, i3, hv_bomb, gain_bomb);
2319 TGraph* bombardmentCurrent1 = ARICHDatabaseImporter::getGraphGainCurrent("Bombardment", "current1", chip_label, i3, hv_bomb,
2320 current1_bomb);
2321 TGraph* bombardmentCurrent2 = ARICHDatabaseImporter::getGraphGainCurrent("Bombardment", "current2", chip_label, i3, hv_bomb,
2322 current2_bomb);
2323 TGraph* bombardmentCurrent3 = ARICHDatabaseImporter::getGraphGainCurrent("Bombardment", "current3", chip_label, i3, hv_bomb,
2324 current3_bomb);
2325 bombCurrents[chip_ABCD].push_back(bombardmentCurrent1);
2326 bombCurrents[chip_ABCD].push_back(bombardmentCurrent2);
2327 bombCurrents[chip_ABCD].push_back(bombardmentCurrent3);
2328 chip_ABCD++;
2329 i3 = 0;
2330 }
2331
2332 // prepare TGraphs for avalanche gain and current
2333 const int n4 = 30;
2334 int i4 = 0;
2335 float hv_aval[n4], gain_aval[n4], current1_aval[n4], current2_aval[n4], current3_aval[n4];
2336 chip_ABCD = 0;
2337 for (const auto& BG : hapdInfo.getNodes("avalanchegain/ch")) {
2338 string value = BG.getString("value");
2339 string value_1 = value;
2340 string chip_label = value.erase(1);
2341 string value_2 = value_1.substr(2);
2342 channel_label_aval[chip_ABCD] = atoi(value_2.c_str());
2343 for (const auto& BG2 : BG.getNodes("point")) {
2344 hv_aval[i4] = (float) BG2.getDouble("biasv");
2345 gain_aval[i4] = (float) BG2.getDouble("gain");
2346 current1_aval[i4] = (float) BG2.getDouble("current1");
2347 current2_aval[i4] = (float) BG2.getDouble("current2");
2348 current3_aval[i4] = (float) BG2.getDouble("current3");
2349 i4++;
2350 }
2351
2352 avalancheGain[chip_ABCD] = ARICHDatabaseImporter::getGraphGainCurrent("Avalanche", "gain", chip_label, i4, hv_aval, gain_aval);
2353 TGraph* avalancheCurrent1 = ARICHDatabaseImporter::getGraphGainCurrent("Avalanche", "current1", chip_label, i4, hv_aval,
2354 current1_aval);
2355 TGraph* avalancheCurrent2 = ARICHDatabaseImporter::getGraphGainCurrent("Avalanche", "current2", chip_label, i4, hv_aval,
2356 current2_aval);
2357 TGraph* avalancheCurrent3 = ARICHDatabaseImporter::getGraphGainCurrent("Avalanche", "current3", chip_label, i4, hv_aval,
2358 current3_aval);
2359 avalCurrents[chip_ABCD].push_back(avalancheCurrent1);
2360 avalCurrents[chip_ABCD].push_back(avalancheCurrent2);
2361 avalCurrents[chip_ABCD].push_back(avalancheCurrent3);
2362
2363 chip_ABCD++;
2364 i4 = 0;
2365 }
2366
2367
2368 chip_ABCD = 0;
2369 // prepare 2D histograms for bias voltage and current
2370 const int n5 = 150;
2371 int i5 = 0, chipnum[n5];
2372 float biasv[n5], biasi[n5];
2373 for (const auto& HI : hapdInfo.getNodes("bias2d/biasvalue")) {
2374 string chip_2d = HI.getString("@chip");
2375 chipnum[i5] = HI.getInt("@ch");
2376 biasv[i5] = (float) HI.getDouble("biasv");
2377 biasi[i5] = (float) HI.getDouble("biasi");
2378 if (chipnum[i5] == 36) {
2379 bias2DV[chip_ABCD] = ARICHDatabaseImporter::getBiasGraph(chip_2d, "voltage", chipnum, biasv);
2380 bias2DI[chip_ABCD] = ARICHDatabaseImporter::getBiasGraph(chip_2d, "current", chipnum, biasi);
2381 i5 = -1;
2382 chip_ABCD++;
2383 }
2384 i5++;
2385 }
2386
2387 // prepare ARICHHapdChipInfo class for each chip
2388 for (unsigned int l = 0; l < 4; l++) {
2389 new (chipConstants[4 * chip_i + l]) ARICHHapdChipInfo();
2390 auto* chipConst = static_cast<ARICHHapdChipInfo*>(chipConstants[4 * chip_i + l]);
2391
2392 chipConst->setHapdSerial(sn);
2393 chipConst->setChipLabel(chip[l]);
2394 chipConst->setBiasVoltage(bias[l]);
2395 chipConst->setGain(gain[l]);
2396 chipConst->setBadChannel(badlist[l]);
2397 chipConst->setCutChannel(cutlist[l]);
2398 chipConst->setBombardmentGain(bombardmentGain[l]);
2399 chipConst->setBombardmentCurrent(bombCurrents[l]);
2400 chipConst->setAvalancheGain(avalancheGain[l]);
2401 chipConst->setAvalancheCurrent(avalCurrents[l]);
2402 chipConst->setChannelNumber(channel_label_aval[l]);
2403 chipConst->setBiasVoltage2D(bias2DV[l]);
2404 chipConst->setBiasCurrent2D(bias2DI[l]);
2405 }
2406
2407 chip_i++;
2408
2409 delete[] bombardmentGain;
2410 delete[] avalancheGain;
2411 delete[] bias2DV;
2412 delete[] bias2DI;
2413 }
2414
2415 // define IOV and store data to the DB
2416 Database::Instance().storeData("ARICHHapdChipInfo", &chipConstants, m_iov);
2417}
TH2F * getBiasGraph(const std::string &chip_2d, const std::string &voltage_current, int *chipnum, float *bias_v_i)
Get histograms for bias voltage and current.
TGraph * getGraphGainCurrent(const std::string &bomb_aval, const std::string &g_i, const std::string &chip_label, int i, float *HV, float *gain_current)
Get graphs for bombardment and avalanche gain and current.
std::vector< int > channelsListHapd(std::string chlist, std::string chipDelay)
Get lists of problematic HAPD channels.
void setHapdSerial(const std::string &serial)
Set HAPD serial number.

◆ importHapdInfo()

void importHapdInfo ( )

Import ARICH HAPD data in the database.

Definition at line 2431 of file ARICHDatabaseImporter.cc.

2432{
2433 int hapd_i = 0;
2434 GearDir content = GearDir("/ArichData/AllData/hapdData/Content");
2435
2436 // define data array
2437 TClonesArray hapdConstants("Belle2::ARICHHapdInfo");
2438
2439 // extract chip info, such as bias voltage, lists of dead and bad channels etc.
2440 for (const auto& hapdInfo : content.getNodes("hapd")) {
2441 // define element of TClonesArray
2442 new (hapdConstants[hapd_i]) ARICHHapdInfo();
2443 auto* hapdConst = static_cast<ARICHHapdInfo*>(hapdConstants[hapd_i]);
2444
2445 // extract information about HAPD
2446 string serial = hapdInfo.getString("serial");
2447 float qe400 = (float) hapdInfo.getDouble("qe400");
2448 float hv = 1000 * (float) hapdInfo.getDouble("hv");
2449 float current = (float) hapdInfo.getDouble("current");
2450 string gb = hapdInfo.getString("guardbias");
2451 int guardbias = atoi(gb.c_str());
2452
2453 // prepare TGraph of quantum efficiency as function of lambda
2454 const int n1 = 70;
2455 float lambda[n1], qepoint[n1];
2456 int i1 = 0;
2457 for (const auto& QE : hapdInfo.getNodes("qe/qepoint")) {
2458 lambda[i1] = (float) QE.getInt("@lambda");
2459 qepoint[i1] = (float) QE.getDouble(".");
2460 i1++;
2461 }
2462 TGraph* qe = new TGraph(i1, lambda, qepoint);
2463 qe->SetName("qe");
2464 qe->SetTitle("qe");
2465 qe->GetXaxis()->SetTitle("lambda");
2466 qe->GetYaxis()->SetTitle("qe");
2467
2468 // prepare TGraph of pulse height distribution
2469 const int n2 = 4100;
2470 int channel_adc[n2], pulse_adc[n2];
2471 int i2 = 0;
2472 for (const auto& ADC : hapdInfo.getNodes("adc/value")) {
2473 channel_adc[i2] = ADC.getInt("@ch");
2474 string str = ADC.getString(".");
2475 pulse_adc[i2] = atoi(str.c_str());
2476 i2++;
2477 }
2478 TGraph* adc = new TGraph(i2, channel_adc, pulse_adc);
2479 adc->SetName("adc");
2480 adc->SetTitle("Pulse Height Distribution");
2481 adc->GetXaxis()->SetTitle("channel");
2482 adc->GetYaxis()->SetTitle("pulse height");
2483
2484 // save HAPD data to the element of TClonesArray
2485 hapdConst->setSerialNumber(serial);
2486 hapdConst->setQuantumEfficiency400(qe400);
2487 hapdConst->setHighVoltage(hv);
2488 hapdConst->setGuardBias(guardbias);
2489 hapdConst->setCurrent(current);
2490 hapdConst->setQuantumEfficiency(qe);
2491 hapdConst->setPulseHeightDistribution(adc);
2492
2493 // export ARICHHapdChipInfo class for each chip from DB and
2494 // add it as an element of ARICHHapdInfo class
2495 DBArray<ARICHHapdChipInfo> elementsChip("ARICHHapdChipInfo");
2496 elementsChip.getEntries();
2497 for (const auto& element : elementsChip) {
2498 if (element.getHapdSerial() == serial) {
2499 ARICHHapdChipInfo& elementValue = const_cast<ARICHHapdChipInfo&>(element);
2500 if (element.getChipLabel() == "A") hapdConst->setHapdChipInfo(0, &elementValue);
2501 if (element.getChipLabel() == "B") hapdConst->setHapdChipInfo(1, &elementValue);
2502 if (element.getChipLabel() == "C") hapdConst->setHapdChipInfo(2, &elementValue);
2503 if (element.getChipLabel() == "D") hapdConst->setHapdChipInfo(3, &elementValue);
2504 }
2505 }
2506
2507 hapd_i++;
2508 }
2509
2510 // define IOV and store data to the DB
2511 Database::Instance().storeData("ARICHHapdInfo", &hapdConstants, m_iov);
2512}

◆ importHapdQA()

void importHapdQA ( )

Import ARICH HAPD QA data in the database.

Definition at line 1550 of file ARICHDatabaseImporter.cc.

1551{
1552 // define data array
1553 TClonesArray hapdQAConstants("Belle2::ARICHHapdQA");
1554 int hapd = 0;
1555
1556 // loop over root riles
1557 for (const string& inputFile : m_inputFilesHapdQA) {
1558 TFile* f = TFile::Open(inputFile.c_str(), "READ");
1559
1560 int size = inputFile.length();
1561 string hapdSerial = inputFile.substr(size - 16, 6);
1562
1563 vector<TGraph*> leakCurrent;
1564 TH2F* hitData2D = 0;
1565 vector<TGraph*> noise;
1566 vector<TH1S*> hitCount;
1567 TTimeStamp arrivalDate;
1568 int arrival;
1569 TTree* tree = 0;
1570
1571 // extract data
1572 TIter next(f->GetListOfKeys());
1573 TKey* key;
1574 while ((key = (TKey*)next())) {
1575
1576 string strime = key->GetName();
1577
1578 if (strime.compare(0, 8, "gcurrent") == 0) {
1579 TGraph* graphcurrent = (TGraph*)f->Get(strime.c_str());
1580 leakCurrent.push_back(graphcurrent);
1581 }
1582
1583 else if (strime.compare(0, 7, "h2dscan") == 0) {
1584 hitData2D = (TH2F*)f->Get(strime.c_str());
1585 hitData2D->SetDirectory(0);
1586 }
1587
1588 else if (strime.compare(0, 9, "gnoise_ch") == 0) {
1589 TGraph* graphnoise = (TGraph*)f->Get(strime.c_str());
1590 noise.push_back(graphnoise);
1591 }
1592
1593 else if (strime.compare(0, 7, "hchscan") == 0) {
1594 TH1F* hhist3 = (TH1F*)f->Get(strime.c_str());
1595 hhist3->SetDirectory(0);
1596
1597 // conversion TH1F -> TH1S
1598
1599 const char* hhist3_ime = hhist3->GetName();
1600 const char* hhist3_naslov = hhist3->GetTitle();
1601 int hhist3_nbins = hhist3->GetSize();
1602 TH1S* hhist3short = new TH1S(hhist3_ime, hhist3_naslov, hhist3_nbins - 2, 0, 1);
1603 for (int bin = 0; bin < hhist3_nbins; bin++) {
1604 hhist3short->SetBinContent(bin, hhist3->GetBinContent(bin));
1605 }
1606 hhist3short->SetDirectory(0);
1607 hitCount.push_back(hhist3short);
1608 }
1609
1610 else if (strime.compare(0, 4, "tree") == 0) {
1611 tree = (TTree*)f->Get(strime.c_str());
1612 tree->SetBranchAddress("arrival", &arrival);
1613 tree->GetEntry(0);
1614 arrivalDate = TTimeStamp(arrival, 0);
1615 }
1616
1617 else { B2INFO("Key name does not match any of the following: gcurrent, 2dscan, gnoise, hchscan, tree_ts! - serial number: " << hapdSerial << "; key name = " << strime.c_str()); }
1618 }
1619
1620 // save data as an element of the array
1621 new (hapdQAConstants[hapd]) ARICHHapdQA(hapdSerial, arrivalDate, leakCurrent, hitData2D, noise, hitCount);
1622 hapd++;
1623 }
1624
1625 // define IOV and store data to the DB
1626 Database::Instance().storeData("ARICHHapdQA", &hapdQAConstants, m_iov);
1627}
Contains manufacturer data of the photo sensor - HAPD.
Definition: ARICHHapdQA.h:26
TH1F * hapd[6]
histogram of hits for each hapd

◆ importHapdQE()

void importHapdQE ( )

Import HAPD quantum efficiency in the database.

Definition at line 2625 of file ARICHDatabaseImporter.cc.

2626{
2627 // define data array
2628 TClonesArray hapdQEConstants("Belle2::ARICHHapdQE");
2629 int hapd = 0;
2630
2631 // loop over root riles
2632 for (const string& inputFile : m_inputFilesHapdQE) {
2633
2634 TFile* f = TFile::Open(inputFile.c_str(), "READ");
2635
2636 int size = inputFile.length();
2637 string hapdSerial = inputFile.substr(size - 11, 6);
2638 TH2F* qe2D = 0;
2639
2640 // extract data
2641 TIter next(f->GetListOfKeys());
2642 TKey* key;
2643 while ((key = (TKey*)next())) {
2644
2645 string strime = key->GetName();
2646
2647 if (strime.compare(0, 11, "hqe2d_pixel") == 0) {
2648 qe2D = (TH2F*)f->Get(strime.c_str());
2649 qe2D->SetTitle("quantum efficiency");
2650 qe2D->SetName("QE");
2651 qe2D->SetDirectory(0);
2652 }
2653
2654 else { B2INFO("Key name does not match 'hqe2d_pixel'!"); }
2655 }
2656
2657 // save data as an element of the array
2658 new (hapdQEConstants[hapd]) ARICHHapdQE(hapdSerial, qe2D);
2659 hapd++;
2660 f->Close();
2661 }
2662
2663 // define IOV and store data to the DB
2664 Database::Instance().storeData("ARICHHapdQE", &hapdQEConstants, m_iov);
2665}
Contains manufacturer data of the photo sensor - HAPD.
Definition: ARICHHapdQE.h:22

◆ importHvMappings()

void importHvMappings ( )

Imports mappings of power supply to high voltage cables.

Definition at line 797 of file ARICHDatabaseImporter.cc.

798{
799
800 GearDir content = GearDir("/DetectorCables[@name='ARICH']/Content");
801
803
805 GearDir mapping(content, "hvCableToModuleMapping");
806
807 for (const GearDir& module : mapping.getNodes("cableMap")) {
808 unsigned cableID = (unsigned) module.getInt("cableID");
809 unsigned innerID = module.getInt("innerID");
810 unsigned ring = module.getInt("ring");
811 unsigned azimuth = module.getInt("azimuth");
812 for (unsigned sector = 1; sector < 7; sector++) {
813 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
814 hvMap.addMapping(moduleID, sector, cableID, innerID);
815 }
816 }
817
818 ARICHHvChannelsMapping channelsMap;
819 GearDir mappingCH(content, "hvChannelMapping");
820
821 for (const GearDir& module : mappingCH.getNodes("channelMap")) {
822 int crate = module.getInt("crate");
823 int slot = module.getInt("slot");
824 int channelID = module.getInt("channelID");
825 int connectionID = module.getInt("connectionID");
826 int pinID = module.getInt("pinID");
827 channelsMap.addMapping(crate, slot, channelID, connectionID, pinID);
828 }
829
831 GearDir mappingCrate(content, "hvCrateToCable");
832
833 for (const GearDir& module : mappingCrate.getNodes("connection")) {
834 int connectionID = module.getInt("connectionID");
835 int sector = module.getInt("sector");
836 int cable = module.getInt("cable");
837 std::vector<int> sectorCable{sector, cable};
838
839 crateMap.addMapping(connectionID, sectorCable);
840 }
841
843 importObjHv.construct(hvMap);
844 importObjHv.import(m_iov);
845
847 importObjHvCH.construct(channelsMap);
848 importObjHvCH.import(m_iov);
849
851 importObjHvCrate.construct(crateMap);
852 importObjHvCrate.import(m_iov);
853}
The Class for ARICH mapping of bias cables to modules.
void addMapping(int moduleID, int sectorID, int cableID, int innerID)
Add mapping entry.
The Class for ARICH mapping of bias power supply channels to modules.
void addMapping(int crate, int slot, int channelID, int connectionID, int pinID)
Add new entry to the mapping table.
The Class for ARICH bias voltages at gain 40.
void addMapping(int connectionID, std::vector< int > sectorCable)
Add new entry to the mapping table.

◆ importMagnetTest()

void importMagnetTest ( )

Import results of magnet test.

Definition at line 3223 of file ARICHDatabaseImporter.cc.

3224{
3225 GearDir content = GearDir("/ArichData/AllData/magnetTest");
3226
3227 // define data array
3228 TClonesArray magnetConstants("Belle2::ARICHMagnetTest");
3229 int num = 0;
3230 string sn;
3231
3232 // loop over xml files and extract the data
3233 for (const auto& module : content.getNodes("module")) {
3234 // save data as an element of the array
3235 new (magnetConstants[num]) ARICHMagnetTest();
3236 auto* magnetConst = static_cast<ARICHMagnetTest*>(magnetConstants[num]);
3237
3238 int snint = module.getInt("hapdID");
3239 if (snint < 5000) sn = "KA";
3240 else sn = "ZJ";
3241 char hapdID[6];
3242 sprintf(hapdID, "%s%04d", sn.c_str(), snint);
3243 magnetConst->setSerialNumber(hapdID);
3244
3245 vector<float> deadtimes;
3246 for (const auto& time : module.getNodes("deadtime/measurement")) {
3247 if (time.getString(".") != "-") {
3248 float deadtime = (float) time.getDouble(".");
3249 deadtimes.push_back(deadtime);
3250 }
3251 }
3252 magnetConst->setDeadTime(deadtimes);
3253
3254 if (module.getString("lowerA") != "-") magnetConst->setDeadTimeLowerA((float) module.getDouble("lowerA"));
3255 if (module.getString("lowerB") != "-") magnetConst->setDeadTimeLowerB((float) module.getDouble("lowerB"));
3256 if (module.getString("lowerC") != "-") magnetConst->setDeadTimeLowerC((float) module.getDouble("lowerC"));
3257 if (module.getString("lowerD") != "-") magnetConst->setDeadTimeLowerD((float) module.getDouble("lowerD"));
3258
3259 bool getter_reactivation = module.getBool("getter");
3260 string comment = module.getString("comment");
3261 magnetConst->setGetter(getter_reactivation);
3262 magnetConst->setComment(comment);
3263
3264 num++;
3265 }
3266
3267 // store under default name:
3268 Database::Instance().storeData("ARICHMagnetTest", &magnetConstants, m_iov);
3269}
Contains fractions of dead times measured in a magnet.

◆ importMergerCoolingGeo()

void importMergerCoolingGeo ( )

Import Merger cooling bodies geometry.

Definition at line 325 of file ARICHDatabaseImporter.cc.

326{
327
328 ARICHGeoMergerCooling cooling;
329 GearDir mergerCoolingParams = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content/mergerCoolingBodiesv2");
330
331 cooling.setMergerCoolingBodiesMaterialName(mergerCoolingParams.getString("material"));
332 //std::cout<<"Merger cooling material -> "<<mergerCoolingParams.getString("material")<<std::endl;
333 for (auto mergerCoolingNode : mergerCoolingParams.getNodes("BodiesDatFileName/Body")) {
334 //std::cout<<"@positionID = "<<mergerCoolingNode.getInt("@positionID")<<std::endl;
335 tessellatedSolidStr mergerTessellation = readTessellatedSolidVerticesFromDATfile(mergerCoolingNode.getString());
336 cooling.addMergerCoolingBodiesInfo(mergerTessellation);
337 }
338 cooling.setMergerCoolingPositionID(mergerCoolingParams.getArray("mergerCoolingPositionID"));
340
342 importObj.construct(cooling);
343 importObj.import(m_iov);
344 B2INFO("--> Mergers cooling bodies geometry imported.");
345
346}
tessellatedSolidStr readTessellatedSolidVerticesFromDATfile(const std::string &inDATfile)
reads merger cooling bodies geometry from dat files
Geometry parameters of Merger Cooling System - version2 (v2).
void addMergerCoolingBodiesInfo(tessellatedSolidStr mergerCoolingBodiesStr)
Set vector of structures which holds apexes of the tessellation volumes for (merger cooling bodyes).
void checkMergerCoolingSystemDataConsistency() const
Check data consistency of the cooling system (v2) positions In case of failure print the basf2 ERROR ...
void setMergerCoolingBodiesMaterialName(const std::string &materialName)
Set material name of merger cooling bodies.
void setMergerCoolingPositionID(const std::vector< double > &mergerCoolingPositionID)
Set vector of merger cooling body shape id (positionID) for each merger PCB.
virtual std::string getString(const std::string &path="") const noexcept(false) override
Get the parameter path as a string.
Definition: GearDir.h:69
std::vector< double > getArray(const std::string &path) const noexcept(false)
Get the parameter path as a list of double values converted to the standard unit.
Definition: Interface.cc:123
Structure which holds apexes of the tessellation volumes.

◆ importMirrorAlignment()

void importMirrorAlignment ( )

Import mirror alignment parameters from ARICH-MirrorAlignment.xml.

Definition at line 216 of file ARICHDatabaseImporter.cc.

217{
218
219 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content");
220 GearDir alignPars(content, "MirrorAlignment");
221
223
224 ARICHMirrorAlignment mirrAlign;
225
226 for (auto plate : alignPars.getNodes("Plate")) {
227 int id = plate.getInt("@id");
228 double r = plate.getLength("r");
229 double phi = plate.getAngle("phi");
230 double z = plate.getLength("z");
231 double alpha = plate.getLength("alpha");
232 double beta = plate.getLength("beta");
233 double gamma = plate.getLength("gamma");
234 double origPhi = geoConfig->getMirrors().getPoint(id).Phi();
235 ARICHPositionElement alignEl(r * cos(origPhi + phi), r * sin(origPhi + phi), z, alpha, beta, gamma);
236 mirrAlign.setAlignmentElement(id, alignEl);
237 alignEl.print();
238 }
239
241 importObj.construct(mirrAlign);
242 importObj.import(m_iov);
243
244}
Mirror alignment parameters for ARICH.
void setAlignmentElement(int id, const ARICHPositionElement &pars)
Sets Alignment parameters (element) for mirror plate.

◆ importModulesInfo()

void importModulesInfo ( )

Import HAPD modules info from the xml file and database (2D QE maps) Goes through the list of installed modules in ARICH-InstalledModules.xml, finds corresponding 2D QE maps in the database and imports lightweight ARICHModulesInfo class (which is used in sim/rec) into database.

Definition at line 121 of file ARICHDatabaseImporter.cc.

122{
123
124 // geometry configuration
126
127 // QE 2D maps from DB
128 DBArray<ARICHHapdQE> QEMaps("ARICHHapdQE");
129
130 ARICHModulesInfo modInfo;
131
132 // channel mapping used in QA tests (QE measurements, etc.)
133 ARICHChannelMapping QAChMap;
134
135 // read mapping from xml file
136 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content/ChannelMapping");
137 istringstream chstream;
138 int x, y, asic;
139 chstream.str(content.getString("QAChannelMapping"));
140 while (chstream >> x >> y >> asic) {
141 QAChMap.mapXY2Asic(x, y, asic);
142 }
143
144 // get list of installed modules from xml
145 GearDir installedModules = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content/InstalledModules");
146 B2INFO("Installed modules\n");
147
148 std::vector<std::string> installed;
149
150 for (const GearDir& module : installedModules.getNodes("Module")) {
151 std::string hapdID = module.getString("@hapdID");
152
153 unsigned sector = module.getInt("Sector");
154 unsigned ring = module.getInt("Ring");
155 unsigned azimuth = module.getInt("Azimuth");
156 bool isActive = (bool)module.getInt("isActive");
157 B2INFO(" " << hapdID << ": S " << sector << " R " << ring << " Z " << azimuth << ", isActive: " << isActive << '\n');
158
159 if (std::find(installed.begin(), installed.end(), hapdID) != installed.end()) {
160 B2WARNING("ARICHDatabaseImporter::importModulesInfo: hapd " << hapdID << " installed multiple times!");
161 } else installed.push_back(hapdID);
162
163 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
164
165 // get and set QE map
166 std::vector<float> qs;
167 qs.assign(144, 0);
168 bool init = false;
169 for (const auto& QEMap : QEMaps) {
170 if (hapdID == QEMap.getHapdSerialNumber()) {
171 TH2F* qe2d = QEMap.getQuantumEfficiency2D();
172 for (int k = 1; k < 13; k++) {
173 for (int l = 1; l < 13; l++) {
174 int asicCh = QAChMap.getAsicFromXY(k - 1, l - 1);
175 qs[asicCh] = qe2d->GetBinContent(k, l);
176 }
177 }
178 init = true;
179 B2INFO(" Channels QE map found and set.\n");
180 }
181 }
182
183 if (!init) {
184 for (int k = 0; k < 144; k++) {
185 qs[k] = 27.0;
186 }
187 B2WARNING("ARICHDatabaseImporter::importModulesInfo: QE map for hapd " << hapdID << " not found! Setting 27% QE for all channels!");
188 }
189
190 modInfo.addModule(moduleID, qs, isActive);
191
192 }
193
195 importObj.construct(modInfo);
196 importObj.import(m_iov);
197
198}
int getAsicFromXY(unsigned xChn, unsigned yChn) const
Get asic channel number from HAPD channel X,Y numbers.
The Class for information on HAPD modules installed in ARICH.
void addModule(unsigned modId, std::vector< float > &qeList, bool active)
Add installed module.

◆ importModuleTest()

void importModuleTest ( const std::string &  mypath,
const std::string &  HVtest 
)

Import module test results.

Definition at line 2848 of file ARICHDatabaseImporter.cc.

2849{
2850
2851
2852 std::string path;
2853 if (HVtest == "no") path = "/ArichData/AllData/moduletest";
2854 else if (HVtest == "yes") path = "/ArichData/AllData/moduletestHV";
2855 else B2INFO("Check HVB test parameter!");
2856
2857 GearDir content = GearDir(path);
2858
2859 // define data array
2860 TClonesArray moduleConstants("Belle2::ARICHModuleTest");
2861 int module = 0;
2862
2863 // loop over xml files and extract the data
2864 for (const auto& moduletest : content.getNodes("module")) {
2865 int febSN = (float) moduletest.getInt("febserial");
2866 string hapdSN = moduletest.getString("hapdserial");
2867 int hvbSN = -1;
2868 if (HVtest == "yes") hvbSN = (float) moduletest.getInt("hvbserial");
2869 int run = moduletest.getInt("run");
2870 int runposition = moduletest.getInt("runposition");
2871 int isok = moduletest.getInt("isok");
2872 bool isOK = false;
2873 if (isok == 1) isOK = true;
2874 string comment = moduletest.getString("comment");
2875
2876 vector<int> deadChannels;
2877
2878 if (HVtest == "no") {
2879 auto ids = ARICHTools::StringToVector::convert<ARICHTools::ModuleID_t>(moduletest.getString("dead"), ',');
2880 deadChannels.reserve(ids.size());
2881 for (const auto& rID : ids)
2882 deadChannels.emplace_back(rID.getNumbering());
2883 }
2884
2885
2886
2887 if (HVtest == "yes") {
2888 deadChannels = ARICHTools::StringToVector::convert<int>(moduletest.getString("dead"), ',');
2889 }
2890
2891 B2INFO("Dead channels: ");
2892 printContainer(deadChannels);
2893 // define histograms
2894 TGraph* guardBias_th = 0;
2895 TGraph* chipVdiff_th[4] = {0};
2896 TGraph* chipLeak_th[4] = {0};
2897 TGraph* HV_th = 0;
2898
2899 TGraph* guardBias_2Dx = 0;
2900 TGraph* chipVdiff_2Dx[4] = {0};
2901 TGraph* chipLeak_2Dx[4] = {0};
2902 TGraph* HV_2Dx = 0;
2903
2904 TGraph* guardBias_2Dy = 0;
2905 TGraph* chipVdiff_2Dy[4] = {0};
2906 TGraph* chipLeak_2Dy[4] = {0};
2907 TGraph* HV_2Dy = 0;
2908
2909 TH1F* gain = 0;
2910 TH2D* charge = 0;
2911 TH2D* th = 0;
2912 TH2D* scanX = 0;
2913 TH2D* scanY = 0;
2914
2915 string runStr = "";
2916 if (run < 10) runStr = "000" + to_string(run);
2917 if ((run > 9) && (run < 100)) runStr = "00" + to_string(run);
2918 if (run > 99) runStr = "0" + to_string(run);
2919 TFile* f = TFile::Open((mypath + runStr + "/" + runStr + "_" + hapdSN + "_out.root").c_str(), "READ");
2920
2921 // extract data
2922 TIter next(f->GetListOfKeys());
2923 TKey* key;
2924 while ((key = (TKey*)next())) {
2925
2926 string strime = key->GetName();
2927
2928 if (strime.find("Guard") != string::npos) {
2929 if (strime.find("_T_0") != string::npos) {
2930 guardBias_th = (TGraph*)f->Get(strime.c_str());
2931 }
2932 if (strime.find("_T_1") != string::npos) {
2933 guardBias_2Dx = (TGraph*)f->Get(strime.c_str());
2934 }
2935 if (strime.find("_T_2") != string::npos) {
2936 guardBias_2Dy = (TGraph*)f->Get(strime.c_str());
2937 }
2938 }
2939
2940 if (strime.find("BiasDifference") != string::npos) {
2941 for (int i = 0; i < 4; i++) {
2942 if (strime.find(("CHIP_" + to_string(i) + "_T_0").c_str()) != string::npos) {
2943 chipVdiff_th[i] = (TGraph*)f->Get(strime.c_str());
2944 }
2945 if (strime.find(("CHIP_" + to_string(i) + "_T_1").c_str()) != string::npos) {
2946 chipVdiff_2Dx[i] = (TGraph*)f->Get(strime.c_str());
2947 }
2948 if (strime.find(("CHIP_" + to_string(i) + "_T_2").c_str()) != string::npos) {
2949 chipVdiff_2Dy[i] = (TGraph*)f->Get(strime.c_str());
2950 }
2951 }
2952 }
2953
2954 if (strime.find("LeakageCurrent") != string::npos) {
2955 for (int i = 0; i < 4; i++) {
2956 if (strime.find(("CHIP_" + to_string(i) + "_T_0").c_str()) != string::npos) {
2957 chipLeak_th[i] = (TGraph*)f->Get(strime.c_str());
2958 }
2959 if (strime.find(("CHIP_" + to_string(i) + "_T_1").c_str()) != string::npos) {
2960 chipLeak_2Dx[i] = (TGraph*)f->Get(strime.c_str());
2961 }
2962 if (strime.find(("CHIP_" + to_string(i) + "_T_2").c_str()) != string::npos) {
2963 chipLeak_2Dy[i] = (TGraph*)f->Get(strime.c_str());
2964 }
2965 }
2966 }
2967
2968 if (strime.find("HV") != string::npos) {
2969 if (strime.find("_T_0") != string::npos) {
2970 HV_th = (TGraph*)f->Get(strime.c_str());
2971 }
2972 if (strime.find("_T_1") != string::npos) {
2973 HV_2Dx = (TGraph*)f->Get(strime.c_str());
2974 }
2975 if (strime.find("_T_2") != string::npos) {
2976 HV_2Dy = (TGraph*)f->Get(strime.c_str());
2977 }
2978 }
2979
2980 if (strime.find("Gain_1D") != string::npos) {
2981 gain = (TH1F*)f->Get(strime.c_str());
2982 gain->SetDirectory(0);
2983 }
2984
2985 if (strime.find("Charge_2D") != string::npos) {
2986 charge = (TH2D*)f->Get(strime.c_str());
2987 charge->SetDirectory(0);
2988 }
2989
2990 if (strime.find("Threshold_2D") != string::npos) {
2991 th = (TH2D*)f->Get(strime.c_str());
2992 th->SetDirectory(0);
2993 }
2994
2995 if (strime.find("Scan_2D_X") != string::npos) {
2996 scanX = (TH2D*)f->Get(strime.c_str());
2997 scanX->SetDirectory(0);
2998 }
2999
3000 if (strime.find("Scan_2D_Y") != string::npos) {
3001 scanY = (TH2D*)f->Get(strime.c_str());
3002 scanY->SetDirectory(0);
3003 }
3004 }
3005
3006 // save data as an element of the array
3007 new (moduleConstants[module]) ARICHModuleTest();
3008 auto* moduleConst = static_cast<ARICHModuleTest*>(moduleConstants[module]);
3009 moduleConst->setFebSN(febSN);
3010 moduleConst->setHapdSN(hapdSN);
3011 moduleConst->setRun(run);
3012 moduleConst->setRunPosition(runposition);
3013 moduleConst->setOK(isOK);
3014 moduleConst->setDeadChs(deadChannels);
3015 moduleConst->setComment(comment);
3016 moduleConst->setGuardBiasTH(guardBias_th);
3017 moduleConst->setHighVoltageTH(HV_th);
3018 moduleConst->setGuardBias2Dx(guardBias_2Dx);
3019 moduleConst->setHighVoltage2Dx(HV_2Dx);
3020 moduleConst->setGuardBias2Dy(guardBias_2Dy);
3021 moduleConst->setHighVoltage2Dy(HV_2Dy);
3022 moduleConst->setGain(gain);
3023 moduleConst->setChargeScan(charge);
3024 moduleConst->setTresholdScan(th);
3025 moduleConst->setLaserScanX(scanX);
3026 moduleConst->setLaserScanY(scanY);
3027
3028 for (int i = 0; i < 4; i++) {
3029 moduleConst->setChipVdiffTH(i, chipVdiff_th[i]);
3030 moduleConst->setChipLeakTH(i, chipLeak_th[i]);
3031 moduleConst->setChipVdiff2Dx(i, chipVdiff_2Dx[i]);
3032 moduleConst->setChipLeak2Dx(i, chipLeak_2Dx[i]);
3033 moduleConst->setChipVdiff2Dy(i, chipVdiff_2Dy[i]);
3034 moduleConst->setChipLeak2Dy(i, chipLeak_2Dy[i]);
3035 }
3036 if (HVtest == "yes") moduleConst->setHvbSN(hvbSN);
3037
3038 module++;
3039 B2INFO("module no " << module - 1 << " saved to DB. HAPD SN = " << hapdSN << ", FEB SN = " << febSN);
3040 f->Close();
3041 }
3042
3043 // store under user defined name:
3044 if (HVtest == "no") Database::Instance().storeData("ARICHModuleTest", &moduleConstants, m_iov);
3045 if (HVtest == "yes") Database::Instance().storeData("ARICHModuleTestHV", &moduleConstants, m_iov);
3046}
ARICH module test data.
void setFebSN(int serial)
Set FEB serial number.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ importNominalBiasVoltages()

void importNominalBiasVoltages ( )

Imports mappings of nominal values of bias voltages.

Definition at line 857 of file ARICHDatabaseImporter.cc.

858{
859
860 GearDir content = GearDir("/DetectorCables[@name='ARICH']/Content");
861
863
864 ARICHBiasVoltages biasVolt;
865 GearDir biasVoltages(content, "biasVoltages");
866
867 for (const GearDir& module : biasVoltages.getNodes("hapd")) {
868 std::string hapdID = module.getString("@id");
869 int biasA = module.getInt("biasA");
870 int biasB = module.getInt("biasB");
871 int biasC = module.getInt("biasC");
872 int biasD = module.getInt("biasD");
873 int guard = module.getInt("guard");
874 std::vector<int> voltages{biasA, biasB, biasC, biasD, guard};
875 biasVolt.addVoltages(hapdID, voltages);
876 }
877
878 DBImportObjPtr<ARICHBiasVoltages> importObjBiasVolt;
879 importObjBiasVolt.construct(biasVolt);
880 importObjBiasVolt.import(m_iov);
881}
The Class for ARICH bias voltages at gain 40.
void addVoltages(const std::string &hapdID, std::vector< int > biasVoltages)
Add new entry to the mapping table.

◆ importReconstructionParams()

void importReconstructionParams ( )

Import reconstruction parameters (for now only initializes "default" values and imports)

Definition at line 457 of file ARICHDatabaseImporter.cc.

458{
460 recPar.initializeDefault();
461
463 importObj.construct(recPar);
464 importObj.import(m_iov);
465
466}
The Class for ARICH reconstruction parameters.

◆ importSensorModuleInfo()

void importSensorModuleInfo ( )

Import module sensor info classes.

Definition at line 3078 of file ARICHDatabaseImporter.cc.

3079{
3080 GearDir content = GearDir("/ArichData/AllData/moduleposition");
3081
3082 // define data array
3083 TClonesArray moduleInfoConstants("Belle2::ARICHSensorModuleInfo");
3084
3085 int module = 0;
3086
3087 // loop over xml files and extract the data
3088 for (const auto& sensor : content.getNodes("position")) {
3089 int febSerial = sensor.getInt("febserial");
3090 string hapdSerial = sensor.getString("hapdserial");
3091 int id = sensor.getInt("moduleID");
3092 int hvSerial = sensor.getInt("HVserial");
3093
3094 // save data as an element of the array
3095 new (moduleInfoConstants[module]) ARICHSensorModuleInfo();
3096 auto* moduleInfoConst = static_cast<ARICHSensorModuleInfo*>(moduleInfoConstants[module]);
3097 moduleInfoConst->setSensorModuleID(id);
3098 moduleInfoConst->setFEBserial(febSerial);
3099 moduleInfoConst->setHAPDserial(hapdSerial);
3100 moduleInfoConst->setHVboardID(hvSerial);
3101
3102 DBArray<ARICHHapdInfo> elementsHapd("ARICHHapdInfo");
3103 elementsHapd.getEntries();
3104 for (const auto& element : elementsHapd) {
3105 if (element.getSerialNumber() == hapdSerial) {
3106 ARICHHapdInfo& elementValue = const_cast<ARICHHapdInfo&>(element);
3107 moduleInfoConst->setHapdID(&elementValue);
3108 }
3109 }
3110
3111 DBArray<ARICHFEBoardInfo> elementsFeb("ARICHFEBoardInfo");
3112 elementsFeb.getEntries();
3113 for (const auto& element : elementsFeb) {
3114 if (element.getFEBoardSerial() == febSerial) {
3115 ARICHFEBoardInfo& elementValue = const_cast<ARICHFEBoardInfo&>(element);
3116 moduleInfoConst->setFEBoardID(&elementValue);
3117 }
3118 }
3119
3120 DBArray<ARICHModuleTest> elementsModule("ARICHModuleTestHV");
3121 elementsModule.getEntries();
3122 for (const auto& element : elementsModule) {
3123 if (element.getFebSN() == febSerial) {
3124 ARICHModuleTest& elementValue = const_cast<ARICHModuleTest&>(element);
3125 moduleInfoConst->setModuleTest(&elementValue);
3126 }
3127 }
3128
3129 module++;
3130 }
3131
3132 // store under default name:
3133 Database::Instance().storeData("ARICHSensorModuleInfo", &moduleInfoConstants, m_iov);
3134}
void setSensorModuleID(int id)
Set Sensor-module identifier.

◆ importSensorModuleMap()

void importSensorModuleMap ( )

Import module sensor map classes.

Definition at line 3137 of file ARICHDatabaseImporter.cc.

3138{
3139
3140 GearDir content = GearDir("/ArichData/AllData/moduleposition");
3141
3142 // define data array
3143 TClonesArray moduleMapConstants("Belle2::ARICHSensorModuleMap");
3144
3145 int module = 0;
3146
3147 // loop over xml files and extract the data
3148 for (const auto& sensor : content.getNodes("position")) {
3149 int sextant = sensor.getInt("sector");
3150 int ring = sensor.getInt("ring");
3151 int column = sensor.getInt("column");
3152 int id = sensor.getInt("moduleID");
3153
3154 // save data as an element of the array
3155 new (moduleMapConstants[module]) ARICHSensorModuleMap();
3156 auto* moduleMapConst = static_cast<ARICHSensorModuleMap*>(moduleMapConstants[module]);
3157 moduleMapConst->setSensorModuleSextantID(sextant);
3158 moduleMapConst->setSensorModuleRingID(ring);
3159 moduleMapConst->setSensorModuleColumnID(column);
3160 moduleMapConst->setSensorGlobalID(id);
3161
3162 DBArray<ARICHSensorModuleInfo> elementsModule("ARICHSensorModuleInfo");
3163 elementsModule.getEntries();
3164 for (const auto& element : elementsModule) {
3165 if (element.getSensorModuleID() == id) {
3166 ARICHSensorModuleInfo& elementValue = const_cast<ARICHSensorModuleInfo&>(element);
3167 moduleMapConst->setSensorModuleId(&elementValue);
3168 }
3169 }
3170
3171 module++;
3172 }
3173
3174 // store under default name:
3175 Database::Instance().storeData("ARICHSensorModuleMap", &moduleMapConstants, m_iov);
3176}
Mapping of the sensor-board connections to the detector.
void setSensorModuleSextantID(int sextant)
Set sensor-module sextant identifier.

◆ importSimulationParams()

void importSimulationParams ( )

Import simulation parameters from the xml file (QE curve, etc.)

Definition at line 468 of file ARICHDatabaseImporter.cc.

469{
470
471 ARICHSimulationPar simPar;
472
473 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content/SimulationParameters");
474
475 double qeScale = content.getDouble("qeScale");
476 double winAbs = content.getDouble("windowAbsorbtion");
477 double crossTalk = content.getDouble("chipNegativeCrosstalk");
478 double colEff = content.getDouble("colEff");
479
480 GearDir qeParams(content, "QE");
481 float lambdaFirst = qeParams.getLength("LambdaFirst") / Unit::nm;
482 float lambdaStep = qeParams.getLength("LambdaStep") / Unit::nm;
483 double peakQE = qeParams.getDouble("peakQE");
484
485 std::vector<float> qes;
486 for (const auto& qeff : qeParams.getNodes("Qeffi")) {
487 qes.push_back(qeff.getDouble("qe"));
488 }
489
490 simPar.setQECurve(lambdaFirst, lambdaStep, qes);
491 simPar.setCollectionEff(colEff);
492 simPar.setChipNegativeCrosstalk(crossTalk);
493 simPar.setWindowAbsorbtion(winAbs);
494 simPar.setQEScaling(qeScale);
495 simPar.setPeakQE(peakQE);
496
497 simPar.print();
498
500 importObj.construct(simPar);
501 importObj.import(m_iov);
502
503}
The Class for ARICH simulation parameters.
void setPeakQE(double peak)
Set peak QE value (for HAPD with maximal QE, at later stage HAPD dependent scaling is done)
void setQECurve(float lambdaFirst, float lambdaStep, const std::vector< float > &qe)
Set QE curve.
void setChipNegativeCrosstalk(double cross)
Set factor to suppress p.e.
void setWindowAbsorbtion(double abs)
Set absorbtion probability for photons internally reflected in HAPD window.
void setQEScaling(double qescale)
Set QE scaling factor for photons internally reflected in HAPD window.
void print() const
print class content
void setCollectionEff(double colEff)
Set HAPD collection efficiency.
static const double nm
[nanometers]
Definition: Unit.h:72

◆ printAeroTileInfo()

void printAeroTileInfo ( )

Prints mapping of aerogel tiles and their optical properties.

Definition at line 711 of file ARICHDatabaseImporter.cc.

712{
714 tilesInfo->print();
715}

◆ printAeroTilesAlignment()

void printAeroTilesAlignment ( )

Prints aerogel tiles alignment constants.

Definition at line 729 of file ARICHDatabaseImporter.cc.

730{
732 align->print();
733}

◆ printBiasMappings()

void printBiasMappings ( )

Prints mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltages from the database.

Definition at line 884 of file ARICHDatabaseImporter.cc.

885{
887 biasMap->print();
889 channelsMap->print();
891 crateMap->print();
892}

◆ printBiasVoltagesForHapdChip()

void printBiasVoltagesForHapdChip ( const std::string &  serialNumber)

Export ARICH HAPD chip info data from the database and calculate bias voltages for one HAPD.

Parameters
serialNumberHAPD serial number

Definition at line 2685 of file ARICHDatabaseImporter.cc.

2686{
2687 // example that shows how to extract and use data
2688 // it calculates bias voltage at gain = 40 for each chip
2689
2690 DBArray<ARICHHapdChipInfo> elements("ARICHHapdChipInfo");
2691 elements.getEntries();
2692
2693 for (const auto& element : elements) {
2694 if (element.getHapdSerial() == serialNumber) {
2695 TGraph* avalgain = element.getAvalancheGain();
2696
2697 // use linear interpolation to get bias voltage at gain = 40
2698 /*
2699 // 1) you can do it by hand
2700
2701 double A, B, C, D;
2702 for(int j = 0; j < 100; j++) {
2703 avalgain->GetPoint(j, A, B);
2704 if(B>40) {
2705 avalgain->GetPoint(j-1, A, B);
2706 avalgain->GetPoint(j, C, D);
2707 float k = (B-D)/(A-C);
2708 float n = B - k*A;
2709 float xgain = (40 - n)/k;
2710 B2INFO("serial#-chip = " << element.getHapdSerial() << "-" << element.getChipLabel() << "; " << "V(gain=40) = " << (int)(xgain+0.5));
2711 j = 100;
2712 }
2713 }
2714 */
2715
2716 // 2) use "Eval" function
2717 // - avalgain graph is gain(voltage)
2718 // - function "Eval" can be used to interpolate around chosen x
2719 // - convert graph gain(voltage) to voltage(gain) to interpolate around gain = 40
2720 TGraph* gainnew = new TGraph(avalgain->GetN());
2721 double xpoint, ypoint;
2722 for (int j = 0; j < avalgain->GetN(); j++) {
2723 avalgain->GetPoint(j, xpoint, ypoint);
2724 gainnew->SetPoint(j, ypoint, xpoint);
2725 }
2726 B2INFO("serial#-chip = " << element.getHapdSerial() << "-" << element.getChipLabel() << "; " << "V(gain=40) = " << (int)(
2727 gainnew->Eval(40) + 0.5));
2728 }
2729 }
2730}

◆ printChannelMapping()

void printChannelMapping ( )

Prints HAPD (asic) channel mapping from the database.

Definition at line 1022 of file ARICHDatabaseImporter.cc.

1023{
1025 chMap->print();
1026}

◆ printChannelMask()

void printChannelMask ( bool  makeHist = false)

Print channel mask of all HAPD modules from the database (lightweight class for sim/rec)

Definition at line 1053 of file ARICHDatabaseImporter.cc.

1054{
1055
1057 chMask->print();
1058
1059 if (makeHist) {
1060 ARICHChannelHist* hist = new ARICHChannelHist("channelMask", "Map of active channels");
1061 for (int hapdID = 1; hapdID < 421; hapdID++) {
1062 for (int ichn = 0; ichn < 144; ichn++) {
1063 if (chMask->isActive(hapdID, ichn)) hist->setBinContent(hapdID, ichn, 1.0);
1064 }
1065 }
1066 hist->SaveAs("channelMask.root");
1067 }
1068}

◆ printContainer()

auto printContainer ( const Container_t &  rContainer,
std::ostream &  rStream = std::cout 
) -> void
inlineprivatenoexcept

printContainer used for debugging purposes...

Parameters
rContainer
rStream

Definition at line 613 of file ARICHDatabaseImporter.h.

614 {
615 if (rContainer.empty())
616 return void();
617
618 rStream << rContainer.front();
619 for (auto i = 1ul; i < rContainer.size(); ++i)
620 rStream << " - " << rContainer[i];
621 rStream << '\n';
622 }

◆ printCopperMapping()

void printCopperMapping ( )

Prints Copper to merger mappings from the database.

Definition at line 1034 of file ARICHDatabaseImporter.cc.

1035{
1037 copMap->print();
1038}

◆ printFEMappings()

void printFEMappings ( )

Prints electronics mappings for all modules (merger ID + SN, merger port, copper, finnese)

Definition at line 1084 of file ARICHDatabaseImporter.cc.

1085{
1086
1090
1091 GearDir content = GearDir("/Detector/DetectorComponent[@name='ARICH']/Content/InstalledModules");
1092
1093 cout << "{ \"hapdmap\": [" << endl;
1094 for (unsigned hapdID = 1; hapdID < 421; hapdID++) {
1095 std::string hapdsn;
1096 for (const GearDir& module : content.getNodes("Module")) {
1097 hapdsn = module.getString("@hapdID");
1098 unsigned sector = module.getInt("Sector");
1099 unsigned ring = module.getInt("Ring");
1100 unsigned azimuth = module.getInt("Azimuth");
1101 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
1102 if (moduleID == hapdID) break;
1103 }
1104
1105 int val = mgrMap->getMergerID(hapdID);
1106 cout << "{\n" << "\"ID\": \"" << hapdID << "\"," << endl;
1107 cout << "\"sn\": \"" << hapdsn << "\"," << endl;
1108 cout << "\"mrg\": \"" << val << "\"," << endl;
1109 cout << "\"mrgSN\": \"" << mgrMap->getMergerSN(val) << "\"," << endl;
1110 cout << "\"feb\": \"" << mgrMap->getFEBSlot(hapdID) - 1 << "\"," << endl;
1111 cout << "\"cpr\": \"" << cprMap->getCopperID(val) << "\"," << endl;
1112 cout << "\"hslb\": \"" << cprMap->getFinesse(val) << "\"" << endl;
1113 if (hapdID < 420) cout << "}," << endl;
1114 else cout << "}" << endl;
1115 }
1116 cout << "]}" << endl;
1117
1118
1119}

◆ printGeometryConfig()

void printGeometryConfig ( )

Prints geometry configuration parameters from the database.

Definition at line 1015 of file ARICHDatabaseImporter.cc.

1016{
1018 geoConfig->print();
1019
1020}

◆ printGlobalAlignment()

void printGlobalAlignment ( )

Prints global alignment constants.

Definition at line 717 of file ARICHDatabaseImporter.cc.

718{
720 align->print();
721}

◆ printHapdPositionFromCrateSlot()

void printHapdPositionFromCrateSlot ( int  crate,
int  slot,
int  channelID 
)

Prints HAPD position (sector, ring, azimuth) and merger connection (merger, feb slot) from the database.

Parameters
cratecrate on power supply
slotslot on power supply
channelIDchannel number on power supply

Definition at line 959 of file ARICHDatabaseImporter.cc.

960{
965
966 DBArray<ARICHSensorModuleMap> elements("ARICHSensorModuleMap");
967 elements.getEntries();
968
969 std::vector<int> channel{crate, slot, channelID};
970 int connectionID = std::get<0>(channelsMap->getInnerConnection(channel));
971 int innerCableNum = std::get<1>(channelsMap->getInnerConnection(channel));
972 std::string biasType = channelsMap->getType(channel);
973
974 int sector = crateMap->getSector(connectionID);
975 int outerCable = crateMap->getCable(connectionID);
976
977 int moduleID = (int)biasMap->getModuleID(sector, outerCable, innerCableNum);
978
979 unsigned mergerID = mrgMap->getMergerID((unsigned)moduleID);
980 unsigned mergerSN = mrgMap->getMergerSN((unsigned)mergerID);
981 unsigned febSlot = mrgMap->getFEBSlot((unsigned)moduleID);
982 int febSlotDaq = ARICHDatabaseImporter::getFebDaqSlot(febSlot);
983
984 for (const auto& element : elements) {
985 if (element.getSensorGlobalID() == moduleID) B2INFO("HAPD for crate " << crate + 1 << ", slot " << slot << ", inner cable " <<
986 innerCableNum << " has ID number " << moduleID << ". Bias cable number is " << sector << "-" << outerCable <<
987 ".\n Position is: RING " << element.getSensorModuleRingID() << " COLUMN " << element.getSensorModuleColumnID() <<
988 ". \n Bias type for channel " << channelID << " is " << biasType << ".\n It belongs to merger " << mergerID << " (SN " <<
989 mergerSN << ") and has DAQ feb slot " << febSlotDaq);
990 }
991
992}
int getFebDaqSlot(unsigned febSlot)
Returns feb daq position from feb slot.

◆ printHvMappings()

void printHvMappings ( )

Prints mappings of power supply to HV cables and cables to HAPDs from the database.

Definition at line 894 of file ARICHDatabaseImporter.cc.

895{
897 hvMap->print();
899 crateMap->print();
900}

◆ printMergerMapping()

void printMergerMapping ( )

Prints merger to FEB mappings from the database.

Definition at line 1028 of file ARICHDatabaseImporter.cc.

1029{
1031 mrgMap->print();
1032}

◆ printMirrorAlignment()

void printMirrorAlignment ( )

Prints mirror alignment constants.

Definition at line 723 of file ARICHDatabaseImporter.cc.

724{
726 align->print();
727}

◆ printModulesInfo()

void printModulesInfo ( )

Print HAPD modules info from the database (lightweight class for sim/rec=)

Definition at line 1040 of file ARICHDatabaseImporter.cc.

1041{
1043 modinfo->print();
1044}

◆ printMyParams()

void printMyParams ( const std::string &  aeroSerialNumber)

Example that shows how to use data from the database.

Parameters
aeroSerialNumberaerogel serial number

Definition at line 2732 of file ARICHDatabaseImporter.cc.

2733{
2734 map<string, float> aerogelParams = ARICHDatabaseImporter::getAerogelParams(aeroSerialNumber);
2735
2736 B2INFO("SN = " << aeroSerialNumber << "; n = " << aerogelParams.find("refractiveIndex")->second << "; transLen = " <<
2737 aerogelParams.find("transmissionLength")->second << "; thickness = " << aerogelParams.find("thickness")->second);
2738}
std::map< std::string, float > getAerogelParams(const std::string &aeroSerialNumber)
Function that returns refractive index, thickness and transmission length of aerogel.

◆ printNominalBiasVoltageForChannel()

void printNominalBiasVoltageForChannel ( std::vector< int >  channel)

Prints nominal bias voltage for channel on power supply from the database.

Parameters
channelvector of values crate, slot and channel on power supply

Definition at line 921 of file ARICHDatabaseImporter.cc.

922{
927 DBArray<ARICHSensorModuleInfo> elements("ARICHSensorModuleInfo");
928 elements.getEntries();
929
930 int connectionID = std::get<0>(channelsMap->getInnerConnection(channel));
931 int innerCable = std::get<1>(channelsMap->getInnerConnection(channel));
932 std::string biasType = std::get<2>(channelsMap->getInnerConnection(channel));
933
934 int sector = crateMap->getSector(connectionID);
935 int outerCable = crateMap->getCable(connectionID);
936
937 int moduleID = (int) biasMap->getModuleID(sector, outerCable, innerCable);
938 std::string hapdID = "";
939 for (const auto& element : elements) {
940 if (element.getSensorModuleID() == moduleID) hapdID = element.getHAPDserial();
941 }
942
943 std::vector<int> voltages = biasVolt->getBiasVoltages(hapdID);
944 int appliedVoltage = 0;
945// std::string appliedVoltage = "zero";
946 if (biasType == "bias-a") appliedVoltage = voltages[0];
947 if (biasType == "bias-b") appliedVoltage = voltages[1];
948 if (biasType == "bias-c") appliedVoltage = voltages[2];
949 if (biasType == "bias-d") appliedVoltage = voltages[3];
950 if (biasType == "guard") appliedVoltage = voltages[4];
951
952
953 B2INFO("Crate " << channel[0] << ", slot " << channel[1] << ", slot channel " << channel[2] << " belongs to hapd " << hapdID <<
954 " (module ID = " << moduleID << ") in sector " << sector << ".\n Corresponding cable is " << sector << "-" << outerCable <<
955 ".\n Cable type is " << biasType << " with applied voltage " << appliedVoltage << " V.");
956// B2INFO(channel[0] << "," << channel[1] << "," << channel[2] << "," << moduleID << "," << sector << "," << outerCable << "," << biasType << "," << appliedVoltage);
957}

◆ printNominalBiasVoltages()

void printNominalBiasVoltages ( )

Prints mappings of nominal values of bias voltages from the database.

Definition at line 915 of file ARICHDatabaseImporter.cc.

916{
918 biasVolt->print();
919}

◆ printReconstructionPar()

void printReconstructionPar ( )

Prints reconstruction parameters.

Definition at line 1046 of file ARICHDatabaseImporter.cc.

1047{
1049 recPar->print();
1050}

◆ printSimulationPar()

void printSimulationPar ( )

Print simulation parameters from the database (QE curve, etc.)

Definition at line 1009 of file ARICHDatabaseImporter.cc.

1010{
1012 simPar->print();
1013}

◆ readTessellatedSolidVerticesFromDATfile()

tessellatedSolidStr readTessellatedSolidVerticesFromDATfile ( const std::string &  inDATfile)

reads merger cooling bodies geometry from dat files

Definition at line 349 of file ARICHDatabaseImporter.cc.

350{
351
352 tessellatedSolidStr solidStr;
353 std::string mot;
354 std::ifstream infile(inDATfile.c_str(), std::ifstream::in);
355
356 if (infile.is_open()) {
357 double val = 0.0;
358 while (infile >> mot) {
359 if (mot == "BodyPositionID")
360 infile >> solidStr.tessellatedSolidID;
361 else
362 assert(0);
363 infile >> mot;
364 if (mot == "nCells")
365 infile >> solidStr.nCells;
366 else
367 assert(0);
368 infile >> mot;
369 if (mot == "nApexPerCell")
370 infile >> solidStr.nApexPerCell;
371 else
372 assert(0);
373
374 TString apexNamesStr[3][3] = { { "Apex_1_x", "Apex_1_y", "Apex_1_z" },
375 { "Apex_2_x", "Apex_2_y", "Apex_2_z" },
376 { "Apex_3_x", "Apex_3_y", "Apex_3_z" }
377 };
378 for (unsigned int i = 0; i < 3; i++) {
379 infile >> mot;
380 if (mot != apexNamesStr[0][i])
381 assert(0);
382 std::vector<double> valv;
383 for (unsigned int j = 0; j < solidStr.nCells; j++) {
384 infile >> val;
385 valv.push_back(val);
386 }
387 solidStr.posV1.push_back(valv);
388 }
389 //Apex_2_x, Apex_2_y, Apex_2_z
390 for (unsigned int i = 0; i < 3; i++) {
391 infile >> mot;
392 if (mot != apexNamesStr[1][i])
393 assert(0);
394 std::vector<double> valv;
395 for (unsigned int j = 0; j < solidStr.nCells; j++) {
396 infile >> val;
397 valv.push_back(val);
398 }
399 solidStr.posV2.push_back(valv);
400 }
401 //Apex_3_x, Apex_3_y, Apex_3_z
402 for (unsigned int i = 0; i < 3; i++) {
403 infile >> mot;
404 if (mot != apexNamesStr[2][i])
405 assert(0);
406 std::vector<double> valv;
407 for (unsigned int j = 0; j < solidStr.nCells; j++) {
408 infile >> val;
409 valv.push_back(val);
410 }
411 solidStr.posV3.push_back(valv);
412 }
413 }
414 infile.close();
415 } else {
416 B2WARNING("Unable to open file : " << inDATfile << " with cooling bodies geometry.");
417 }
418 return solidStr;
419}
std::vector< std::vector< double > > posV1
x, y, z of apex1.
std::vector< std::vector< double > > posV3
x, y, z of apex3.
int tessellatedSolidID
tessellated solid ID
std::vector< std::vector< double > > posV2
x, y, z of apex2.
unsigned int nApexPerCell
number of apexes per cell
unsigned int nCells
number of cells

◆ setExperimentAndRun()

void setExperimentAndRun ( int  experiment,
int  run 
)

Set experiment and run number.

Definition at line 113 of file ARICHDatabaseImporter.cc.

114{
116 meta->setRun(run); meta->setExperiment(experiment);
117 B2INFO("Experiment " << experiment << ", run " << run);
118}

◆ SetIOV()

void SetIOV ( int  experimentLow,
int  runLow,
int  experimentHigh,
int  runHigh 
)

Set Interval of Validity.

Definition at line 107 of file ARICHDatabaseImporter.cc.

108{
109 m_iov = IntervalOfValidity(experimentLow, runLow, experimentHigh, runHigh);
110}

◆ timedate()

TTimeStamp timedate ( std::string  enddate)

Convert date (ASICs) to TTimeStamp.

Parameters
enddate- time as string

Definition at line 1777 of file ARICHDatabaseImporter.cc.

1778{
1779 // convert string into TTimeStamp
1780 string dateEnd = enddate.substr(enddate.find(":") + 2);
1781 string yearStr = dateEnd.substr(0, 4);
1782 string monthStr = dateEnd.substr(4, 2);
1783 string dayStr = dateEnd.substr(6, 2);
1784 string hourStr = dateEnd.substr(8, 2);
1785 string minStr = dateEnd.substr(10, 2);
1786 int year = atoi(yearStr.c_str());
1787 int month = atoi(monthStr.c_str());
1788 int day = atoi(dayStr.c_str());
1789 int hour = atoi(hourStr.c_str());
1790 int min = atoi(minStr.c_str());
1791 TTimeStamp datum = TTimeStamp(year, month, day, hour, min, 0, 0, kTRUE, -9 * 60 * 60);
1792 return datum;
1793}

◆ timedate2()

TTimeStamp timedate2 ( std::string  time)

Convert date (FEB) to TTimeStamp.

Parameters
time- time as string

Definition at line 2094 of file ARICHDatabaseImporter.cc.

2095{
2096 // convert string into TTimeStamp
2097 string dateMeas = time.substr(4);
2098 string yearStr = dateMeas.substr(16, 4);
2099 string monthStr = dateMeas.substr(0, 3);
2100 string dayStr = dateMeas.substr(4, 2);
2101 string hourStr = dateMeas.substr(7, 2);
2102 string minStr = dateMeas.substr(10, 2);
2103 string secStr = dateMeas.substr(13, 2);
2104
2105 int year = atoi(yearStr.c_str());
2106 int day = atoi(dayStr.c_str());
2107 int hour = atoi(hourStr.c_str());
2108 int min = atoi(minStr.c_str());
2109 int sec = atoi(secStr.c_str());
2110 map<string, int> months {
2111 { "Jan", 1 }, { "Feb", 2 }, { "Mar", 3 }, { "Apr", 4 }, { "May", 5 }, { "Jun", 6 }, { "Jul", 7 }, { "Aug", 8 }, { "Sep", 9 }, { "Oct", 10 }, { "Nov", 11 }, { "Dec", 12 }
2112 };
2113 int month = months.find(monthStr)->second;
2114
2115 TTimeStamp datum = TTimeStamp(year, month, day, hour, min, sec, 0, kTRUE, 0);
2116 return datum;
2117}

Member Data Documentation

◆ m_inputFilesAsicRoot

std::vector<std::string> m_inputFilesAsicRoot
private

Input root files for ASICs.

Definition at line 600 of file ARICHDatabaseImporter.h.

◆ m_inputFilesAsicTxt

std::vector<std::string> m_inputFilesAsicTxt
private

Input txt files for ASICs.

Definition at line 601 of file ARICHDatabaseImporter.h.

◆ m_inputFilesFebTest

std::vector<std::string> m_inputFilesFebTest
private

Input root files from FEB test (coarse/fine offset settings, test pulse)

Definition at line 603 of file ARICHDatabaseImporter.h.

◆ m_inputFilesHapdQA

std::vector<std::string> m_inputFilesHapdQA
private

Input root files for HAPD QA.

Definition at line 599 of file ARICHDatabaseImporter.h.

◆ m_inputFilesHapdQE

std::vector<std::string> m_inputFilesHapdQE
private

Input root files for HAPD quantum efficiency.

Definition at line 602 of file ARICHDatabaseImporter.h.

◆ m_iov

IntervalOfValidity m_iov
private

interval of validity

Definition at line 605 of file ARICHDatabaseImporter.h.


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