Belle II Software  release-08-01-10
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 
24 namespace 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 
50 
51  ARICHDatabaseImporter(int experiment, int run);
52 
53 
57  virtual ~ARICHDatabaseImporter() {};
58 
59  void SetIOV(int experimentLow, int runLow, int experimentHigh, int runHigh);
60 
61  void setExperimentAndRun(int experiment, int run);
62 
63  // classes used in simulation/reconstruction software
64 
69 
74 
75 
79  void printSimulationPar();
80 
87  void importModulesInfo();
88 
92  void printModulesInfo();
93 
97  void setHAPDQE(unsigned modID, double qe = 0.27, bool import = false);
98 
102  void importGlobalAlignment();
103 
107  void importMirrorAlignment();
108 
113 
117  void importMergerCoolingGeo();
118 
122  tessellatedSolidStr readTessellatedSolidVerticesFromDATfile(const std::string& inDATfile);
123 
130  void importChannelMask();
131 
137  void importChannelMask(TH1* h);
138 
139 
143  void printChannelMask(bool makeHist = false);
144 
148  void importChannelMapping();
149 
153  void printChannelMapping();
154 
159  void importFEMappings();
160 
164  void printMergerMapping();
165 
169  void printCopperMapping();
170 
174  void printReconstructionPar();
175 
179  void printGeometryConfig();
180 
187  void dumpQEMap(bool simple = false);
188 
192  void dumpHvMappings();
193 
197  void printFEMappings();
198 
202  void dumpMergerMapping(bool sn = true);
203 
207  void dumpModuleNumbering();
208 
214  void dumpAerogelOpticalProperties(std::string outRootFileName = "ARICH_AerogelOpticalProperties.root");
215 
220 
224  void importGeometryConfig();
225 
229  void importAeroTilesInfo();
230 
234  void importAeroRayleighScatteringFit(std::string commentSingleWord = "");
235 
239  int getAeroTileRing(int slot);
240 
244  int getAeroTileColumn(int slot);
245 
249  void printAeroTileInfo();
250 
254  void printGlobalAlignment();
255 
259  void printMirrorAlignment();
260 
265 
266  // DAQ classes
267 
271  void importBiasMappings();
272 
276  void importHvMappings();
277 
282 
286  void printBiasMappings();
287 
291  void printHvMappings();
292 
297 
302  void printNominalBiasVoltageForChannel(std::vector<int> channel);
303 
310  void printHapdPositionFromCrateSlot(int crate, int slot, int channelID);
311 
317  int getFebDaqSlot(unsigned febSlot);
318 
319 
320  // classes used in conditions DB
321 
325  void importAerogelInfo(TString coreNameSuffix = "");
326 
330  void exportAerogelInfo(int verboseLevel = 0);
331 
335  void importAerogelMap();
336 
340  void exportAerogelMap();
341 
346 
351 
355  void importHapdQA();
356 
360  void exportHapdQA();
361 
365  void importAsicInfo();
366 
370  void importAsicInfoRoot();
371 
375  void exportAsicInfo();
376 
381  TTimeStamp timedate(std::string enddate);
382 
388  TTimeStamp getAsicDate(const std::string& asicSerial, const std::string& type);
389 
393  std::vector<int> channelsList(std::string badCH);
394 
398  void importFebTest();
399 
403  void importFebTestRoot();
404 
408  std::tuple<std::string, float, float, float> getFebLVtestData(int serial, int lvRun);
409 
413  std::tuple<std::string, float> getFebHVtestData(int serial, int hvRun);
414 
418  std::vector<int> getDeadChFEB(const std::string& dna);
419 
424  TTimeStamp timedate2(std::string time);
425 
429  std::pair<std::vector<float>, std::vector<float>> getSlopes(int serialNum, const std::string& runSCAN);
430 
434  std::vector<std::pair<float, float>> getFwhm(int serialNum, const std::string& runSCAN);
435 
439  std::vector<TH3F*> getFebTestHistograms(const std::string& dna, const std::string& run, int febposition);
440 
444  TH2F* getFebTestPulse(const std::string& dna, const std::string& run, int febposition);
445 
449  void exportFebTest();
450 
454  void importHapdChipInfo();
455 
459  void exportHapdChipInfo();
460 
464  void importHapdInfo();
465 
469  std::vector<int> channelsListHapd(std::string chlist, std::string chipDelay);
470 
477  int getChannelPosition(const std::string& XY, const std::string& chip_2d, int chipnum);
478 
488  TGraph* getGraphGainCurrent(const std::string& bomb_aval, const std::string& g_i, const std::string& chip_label, int i, float* HV,
489  float* gain_current);
490 
498  TH2F* getBiasGraph(const std::string& chip_2d, const std::string& voltage_current, int* chipnum, float* bias_v_i);
499 
503  void exportHapdInfo();
504 
508  void importHapdQE();
509 
513  void exportHapdQE();
514 
519  void printBiasVoltagesForHapdChip(const std::string& serialNumber);
520 
525  void printMyParams(const std::string& aeroSerialNumber);
526 
531  std::map<std::string, float> getAerogelParams(const std::string& aeroSerialNumber);
532 
536  void importFEBoardInfo();
537 
541  void exportFEBoardInfo();
542 
546  void importModuleTest(const std::string& mypath, const std::string& HVtest);
547 
551  void exportModuleTest(const std::string& HVtest);
552 
556  void importSensorModuleInfo();
557 
561  void importSensorModuleMap();
562 
566  void exportSensorModuleMap();
567  void exportSensorModuleMapInfo(int number);
568 
572  void importMagnetTest();
573 
577  void exportMagnetTest();
578 
582  void exportAll();
583 
584 
585  private:
586 
587  std::vector<std::string> m_inputFilesHapdQA;
588  std::vector<std::string> m_inputFilesAsicRoot;
589  std::vector<std::string> m_inputFilesAsicTxt;
590  std::vector<std::string> m_inputFilesHapdQE;
591  std::vector<std::string> m_inputFilesFebTest;
593  IntervalOfValidity m_iov;
594 
600  template <typename Container_t>
601  inline auto printContainer(const Container_t& rContainer, std::ostream& rStream = std::cout) noexcept -> void
602  {
603  if (rContainer.empty())
604  return void();
605 
606  rStream << rContainer.front();
607  for (auto i = 1ul; i < rContainer.size(); ++i)
608  rStream << " - " << rContainer[i];
609  rStream << '\n';
610  }
611 
612  };
613 
615 } // Belle2 namespace
616 #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 importMagnetTest()
Import results of magnet test.
std::vector< int > channelsList(std::string badCH)
Get lists of problematic ASIC channels.
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 and info 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.