Belle II Software development
ARICHDatabaseImporter.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#ifndef ARICHDATABASEIMPORTER_H
9#define ARICHDATABASEIMPORTER_H
10
11#include <TGraph.h>
12#include <TH1.h>
13#include <TH2F.h>
14#include <TH3F.h>
15#include <TTimeStamp.h>
16#include <map>
17#include <tuple>
18#include <vector>
19#include <iostream>
20#include <string>
21#include <framework/database/IntervalOfValidity.h>
22#include <arich/dbobjects/tessellatedSolidStr.h>
23
24namespace Belle2 {
31
35
36 public:
41 m_inputFilesFebTest(), m_iov(0, 0, -1, -1) {};
42
46 ARICHDatabaseImporter(const std::vector<std::string>& inputFilesHapdQA, const std::vector<std::string>& inputFilesAsicRoot,
47 const std::vector<std::string>& inputFilesAsicTxt, const std::vector<std::string>& inputFilesHapdQE,
48 const std::vector<std::string>& inputFilesFebTest);
49
53 ARICHDatabaseImporter(int experiment, int run);
54
55
60
64 void SetIOV(int experimentLow, int runLow, int experimentHigh, int runHigh);
65
69 void setExperimentAndRun(int experiment, int run);
70
71 // classes used in simulation/reconstruction software
72
77
82
83
87 void printSimulationPar();
88
95 void importModulesInfo();
96
100 void printModulesInfo();
101
105 void setHAPDQE(unsigned modID, double qe = 0.27, bool import = false);
106
111
116
121
126
131
138 void importChannelMask();
139
145 void importChannelMask(TH1* h);
146
147
151 void printChannelMask(bool makeHist = false);
152
157
161 void printChannelMapping();
162
167 void importFEMappings();
168
172 void printMergerMapping();
173
177 void printCopperMapping();
178
183
187 void printGeometryConfig();
188
195 void dumpQEMap(bool simple = false);
196
200 void dumpHvMappings();
201
205 void printFEMappings();
206
210 void dumpMergerMapping(bool sn = true);
211
215 void dumpModuleNumbering();
216
222 void dumpAerogelOpticalProperties(std::string outRootFileName = "ARICH_AerogelOpticalProperties.root");
223
228
233
237 void importAeroTilesInfo();
238
242 void importAeroRayleighScatteringFit(std::string commentSingleWord = "");
243
247 int getAeroTileRing(int slot);
248
252 int getAeroTileColumn(int slot);
253
257 void printAeroTileInfo();
258
263
268
273
274 // DAQ classes
275
279 void importBiasMappings();
280
284 void importHvMappings();
285
290
294 void printBiasMappings();
295
299 void printHvMappings();
300
305
310 void printNominalBiasVoltageForChannel(std::vector<int> channel);
311
318 void printHapdPositionFromCrateSlot(int crate, int slot, int channelID);
319
325 int getFebDaqSlot(unsigned febSlot);
326
327
328 // classes used in conditions DB
329
333 void importAerogelInfo(TString coreNameSuffix = "");
334
338 void exportAerogelInfo(int verboseLevel = 0);
339
343 void importAerogelMap();
344
348 void exportAerogelMap();
349
354
359
363 void importHapdQA();
364
368 void exportHapdQA();
369
373 void importAsicInfo();
374
378 void importAsicInfoRoot();
379
383 void exportAsicInfo();
384
389 TTimeStamp timedate(std::string enddate);
390
396 TTimeStamp getAsicDate(const std::string& asicSerial, const std::string& type);
397
401 std::vector<int> channelsList(std::string badCH);
402
406 void importFebTest();
407
411 void importFebTestRoot();
412
416 std::tuple<std::string, float, float, float> getFebLVtestData(int serial, int lvRun);
417
421 std::tuple<std::string, float> getFebHVtestData(int serial, int hvRun);
422
426 std::vector<int> getDeadChFEB(const std::string& dna);
427
432 TTimeStamp timedate2(std::string time);
433
437 std::pair<std::vector<float>, std::vector<float>> getSlopes(int serialNum, const std::string& runSCAN);
438
442 std::vector<std::pair<float, float>> getFwhm(int serialNum, const std::string& runSCAN);
443
447 std::vector<TH3F*> getFebTestHistograms(const std::string& dna, const std::string& run, int febposition);
448
452 TH2F* getFebTestPulse(const std::string& dna, const std::string& run, int febposition);
453
457 void exportFebTest();
458
462 void importHapdChipInfo();
463
467 void exportHapdChipInfo();
468
472 void importHapdInfo();
473
477 std::vector<int> channelsListHapd(std::string chlist, std::string chipDelay);
478
485 int getChannelPosition(const std::string& XY, const std::string& chip_2d, int chipnum);
486
496 TGraph* getGraphGainCurrent(const std::string& bomb_aval, const std::string& g_i, const std::string& chip_label, int i, float* HV,
497 float* gain_current);
498
506 TH2F* getBiasGraph(const std::string& chip_2d, const std::string& voltage_current, int* chipnum, float* bias_v_i);
507
511 void exportHapdInfo();
512
516 void importHapdQE();
517
521 void exportHapdQE();
522
527 void printBiasVoltagesForHapdChip(const std::string& serialNumber);
528
533 void printMyParams(const std::string& aeroSerialNumber);
534
539 std::map<std::string, float> getAerogelParams(const std::string& aeroSerialNumber);
540
544 void importFEBoardInfo();
545
549 void exportFEBoardInfo();
550
554 void importModuleTest(const std::string& mypath, const std::string& HVtest);
555
559 void exportModuleTest(const std::string& HVtest);
560
565
570
575
579 void exportSensorModuleMapInfo(int number);
580
584 void importMagnetTest();
585
589 void exportMagnetTest();
590
594 void exportAll();
595
596
597 private:
598
599 std::vector<std::string> m_inputFilesHapdQA;
600 std::vector<std::string> m_inputFilesAsicRoot;
601 std::vector<std::string> m_inputFilesAsicTxt;
602 std::vector<std::string> m_inputFilesHapdQE;
603 std::vector<std::string> m_inputFilesFebTest;
612 template <typename Container_t>
613 inline auto printContainer(const Container_t& rContainer, std::ostream& rStream = std::cout) noexcept -> void
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 }
623
624 };
625
627} // Belle2 namespace
628#endif
void exportHapdQE()
Export HAPD quantum efficiency from the database.
void importModulesInfo()
Import HAPD modules info from the xml file and database (2D QE maps) Goes through the list of install...
std::vector< std::string > m_inputFilesHapdQA
Input root files for HAPD QA.
void exportModuleTest(const std::string &HVtest)
Export module test results.
int getAeroTileColumn(int slot)
Get aerogel ring number from global indetifier.
void importAeroTilesInfo()
Import optical information of aerogel tiles into database.
void importHvMappings()
Imports mappings of power supply to high voltage cables.
void importChannelMapping()
Imports HAPD (asic) channel mappings from the xml file.
void importAeroTilesAlignment()
Import aerogel tiles alignment parameters from ARICH-AeroTilesAlignment.xml.
void exportMagnetTest()
Export results of magnet test.
void printChannelMask(bool makeHist=false)
Print channel mask of all HAPD modules from the database (lightweight class for sim/rec)
void importSensorModuleInfo()
Import module sensor info classes.
int getChannelPosition(const std::string &XY, const std::string &chip_2d, int chipnum)
Get position of channel on HAPD.
std::vector< std::pair< float, float > > getFwhm(int serialNum, const std::string &runSCAN)
Returns lists of FWHM values&sigmas.
void printReconstructionPar()
Prints reconstruction parameters.
void dumpModuleNumbering()
Dumps module numbering scheme into root file (module position on the detector plane -> module number)
tessellatedSolidStr readTessellatedSolidVerticesFromDATfile(const std::string &inDATfile)
reads merger cooling bodies geometry from dat files
void importAeroRayleighScatteringFit(std::string commentSingleWord="")
Import optical information of aerogel tiles into database.
void printMirrorAlignment()
Prints mirror alignment constants.
void importAerogelInfoEventDep()
Import intrarun dependant ARICH aerogel data in the database.
void printGlobalAlignment()
Prints global alignment constants.
std::vector< std::string > m_inputFilesFebTest
Input root files from FEB test (coarse/fine offset settings, test pulse)
void dumpHvMappings()
Dumps detector map of HAPD modules to HV cable channels.
virtual ~ARICHDatabaseImporter()
Destructor.
void importReconstructionParams()
Import reconstruction parameters (for now only initializes "default" values and imports)
void setHAPDQE(unsigned modID, double qe=0.27, bool import=false)
Example function for importing HAPD QE to database class (ARICHModulesInfo)
void importFEBoardInfo()
Import module test results.
void exportFEBoardInfo()
Export module test results.
void exportSensorModuleMapInfo(int number)
Export module sensor map info classes from database.
void importMagnetTest()
Import results of magnet test.
IntervalOfValidity m_iov
interval of validity
std::vector< int > channelsList(std::string badCH)
Get lists of problematic ASIC channels.
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 printAeroTilesAlignment()
Prints aerogel tiles alignment constants.
void importSimulationParams()
Import simulation parameters from the xml file (QE curve, etc.)
TTimeStamp timedate2(std::string time)
Convert date (FEB) to TTimeStamp.
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.
std::tuple< std::string, float > getFebHVtestData(int serial, int hvRun)
Returns data from high voltage test.
void dumpQEMap(bool simple=false)
Dumps 2D QE map of full detector surface from the database into root file (from ARICHModulesInfo)
void dumpMergerMapping(bool sn=true)
Dumps module - merger mapping into root file.
void importHapdInfo()
Import ARICH HAPD data in the database.
void printSimulationPar()
Print simulation parameters from the database (QE curve, etc.)
std::vector< int > getDeadChFEB(const std::string &dna)
Returns list of dead channels on FEB.
auto printContainer(const Container_t &rContainer, std::ostream &rStream=std::cout) noexcept -> void
printContainer used for debugging purposes...
void exportHapdInfo()
Export ARICH HAPD info and chip info data from the database.
void exportAerogelInfoEventDep()
Export intrarun dependant ARICH aerogel data from the database.
void printNominalBiasVoltageForChannel(std::vector< int > channel)
Prints nominal bias voltage for channel on power supply from the database.
void importHapdQE()
Import HAPD quantum efficiency in the database.
void importFEMappings()
Imports mappings of FE electronics from the xml file (ARICH-FrontEndMapping.xml) to the database Mapp...
void importNominalBiasVoltages()
Imports mappings of nominal values of bias voltages.
void printBiasVoltagesForHapdChip(const std::string &serialNumber)
Export ARICH HAPD chip info data from the database and calculate bias voltages for one HAPD.
std::vector< TH3F * > getFebTestHistograms(const std::string &dna, const std::string &run, int febposition)
Returns TH3F histograms - offset settings.
void importFebTest()
Import ARICH FEB test data in the database.
void importAerogelMap()
Import ARICH aerogel map in the database.
void exportSensorModuleMap()
Export module sensor map classes from database.
void importBiasMappings()
Imports mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltag...
ARICHDatabaseImporter()
Default constructor.
std::vector< std::string > m_inputFilesHapdQE
Input root files for HAPD quantum efficiency.
void printModulesInfo()
Print HAPD modules info from the database (lightweight class for sim/rec=)
void printFEMappings()
Prints electronics mappings for all modules (merger ID + SN, merger port, copper, finnese)
void importAsicInfoRoot()
Import large histograms from ARICH ASICs data in the database.
void importGlobalAlignment()
Import global alignment parameters from ARICH-GlobalAlignment.xml.
std::map< std::string, float > getAerogelParams(const std::string &aeroSerialNumber)
Function that returns refractive index, thickness and transmission length of aerogel.
void printHvMappings()
Prints mappings of power supply to HV cables and cables to HAPDs from the database.
int getAeroTileRing(int slot)
Get aerogel ring number from global indetifier.
void printAeroTileInfo()
Prints mapping of aerogel tiles and their optical properties.
void exportFebTest()
Export ARICH FEB test data from the database.
void exportAsicInfo()
Export ARICH ASICs data from the database.
void exportAerogelMap()
Export ARICH aerogel map in the database.
void exportAerogelInfo(int verboseLevel=0)
Export ARICH aerogel data from the database.
TTimeStamp timedate(std::string enddate)
Convert date (ASICs) to TTimeStamp.
void importModuleTest(const std::string &mypath, const std::string &HVtest)
Import module test results.
std::pair< std::vector< float >, std::vector< float > > getSlopes(int serialNum, const std::string &runSCAN)
Returns lists of slopes (fine & rough)
std::vector< std::string > m_inputFilesAsicTxt
Input txt files for ASICs.
void importGeometryConfig()
Import geometry configuration parameters to the database.
void exportAll()
Export all the data.
void importAerogelInfo(TString coreNameSuffix="")
Import ARICH aerogel data in the database.
TTimeStamp getAsicDate(const std::string &asicSerial, const std::string &type)
Get date for ASIC measurement.
void printMergerMapping()
Prints merger to FEB mappings from the database.
void importChannelMask()
Import channel mask for all HAPD modules from the database (list of dead channels) Goes through the l...
void importCosmicTestGeometry()
Import parameters of the cosmic test geometry configuration.
void importSensorModuleMap()
Import module sensor map classes.
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.
void printGeometryConfig()
Prints geometry configuration parameters from the database.
void importAsicInfo()
Import ARICH ASICs data in the database.
void exportHapdQA()
Export ARICH HAPD QA data from the database.
void printNominalBiasVoltages()
Prints mappings of nominal values of bias voltages from the database.
std::vector< std::string > m_inputFilesAsicRoot
Input root files for ASICs.
void printChannelMapping()
Prints HAPD (asic) channel mapping from the database.
void importFebTestRoot()
Import large histograms from ARICH FEB test data in the database.
void printHapdPositionFromCrateSlot(int crate, int slot, int channelID)
Prints HAPD position (sector, ring, azimuth) and merger connection (merger, feb slot) from the databa...
void importMergerCoolingGeo()
Import Merger cooling bodies geometry.
void printBiasMappings()
Prints mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltage...
void printMyParams(const std::string &aeroSerialNumber)
Example that shows how to use data from the database.
TH2F * getFebTestPulse(const std::string &dna, const std::string &run, int febposition)
Returns TH2F histogram of pulse test.
void dumpAerogelOpticalProperties(std::string outRootFileName="ARICH_AerogelOpticalProperties.root")
Dumps aerogel tile properties (aerogel optical properties - AOP) into root file with arich/utility/AR...
int getFebDaqSlot(unsigned febSlot)
Returns feb daq position from feb slot.
void printCopperMapping()
Prints Copper to merger mappings from the database.
void importHapdChipInfo()
Import ARICH HAPD chip data in the database.
void exportHapdChipInfo()
Export ARICH HAPD chip data from the database.
std::vector< int > channelsListHapd(std::string chlist, std::string chipDelay)
Get lists of problematic HAPD channels.
std::tuple< std::string, float, float, float > getFebLVtestData(int serial, int lvRun)
Returns data from low voltage test.
void importHapdQA()
Import ARICH HAPD QA data in the database.
void importMirrorAlignment()
Import mirror alignment parameters from ARICH-MirrorAlignment.xml.
A class that describes the interval of experiments/runs for which an object in the database is valid.
Abstract base class for different kinds of events.
Structure which holds apexes of the tessellation volumes.
Point.