9#include <arich/calibration/ARICHDatabaseImporter.h>
10#include <arich/calibration/ARICHDatabaseTools.h>
11#include <arich/dbobjects/ARICHAerogelMap.h>
12#include <arich/dbobjects/ARICHAerogelInfo.h>
13#include <arich/dbobjects/ARICHAerogelRayleighScatteringFit.h>
14#include <arich/dbobjects/ARICHAsicInfo.h>
15#include <arich/dbobjects/ARICHHapdQA.h>
16#include <arich/dbobjects/ARICHFebTest.h>
17#include <arich/dbobjects/ARICHHapdChipInfo.h>
18#include <arich/dbobjects/ARICHHapdInfo.h>
19#include <arich/dbobjects/ARICHHapdQE.h>
20#include <arich/dbobjects/ARICHMagnetTest.h>
21#include <arich/dbobjects/ARICHModuleTest.h>
22#include <arich/dbobjects/ARICHSensorModuleInfo.h>
23#include <arich/dbobjects/ARICHSensorModuleMap.h>
24#include <arich/dbobjects/ARICHBiasCablesMapping.h>
25#include <arich/dbobjects/ARICHBiasChannelsMapping.h>
26#include <arich/dbobjects/ARICHBiasVoltages.h>
27#include <arich/dbobjects/ARICHBiasCrateCableMapping.h>
28#include <arich/dbobjects/ARICHHvCablesMapping.h>
29#include <arich/dbobjects/ARICHHvChannelsMapping.h>
30#include <arich/dbobjects/ARICHHvCrateCableMapping.h>
32#include <arich/dbobjects/ARICHChannelMask.h>
33#include <arich/dbobjects/ARICHChannelMapping.h>
34#include <arich/dbobjects/ARICHModulesInfo.h>
35#include <arich/dbobjects/ARICHMergerMapping.h>
36#include <arich/dbobjects/ARICHCopperMapping.h>
37#include <arich/dbobjects/ARICHSimulationPar.h>
38#include <arich/dbobjects/ARICHReconstructionPar.h>
39#include <arich/dbobjects/ARICHGeometryConfig.h>
40#include <arich/dbobjects/ARICHAeroTilesInfo.h>
41#include <arich/dbobjects/ARICHGlobalAlignment.h>
42#include <arich/dbobjects/ARICHMirrorAlignment.h>
43#include <arich/dbobjects/ARICHPositionElement.h>
44#include <arich/dbobjects/ARICHAeroTilesAlignment.h>
45#include <arich/dbobjects/ARICHGeoMergerCooling.h>
48#include <arich/utility/ARICHChannelHist.h>
49#include <arich/utility/ARICHAerogelHist.h>
51#include <framework/gearbox/GearDir.h>
52#include <framework/gearbox/Unit.h>
53#include <framework/logging/Logger.h>
54#include <framework/database/EventDependency.h>
56#include <framework/database/IntervalOfValidity.h>
57#include <framework/database/Database.h>
58#include <framework/database/DBArray.h>
59#include <framework/database/DBObjPtr.h>
60#include <framework/database/DBImportObjPtr.h>
75#include <TClonesArray.h>
84 const vector<string>& inputFilesAsicTxt,
const vector<string>& inputFilesHapdQE,
const vector<string>& inputFilesFebTest)
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]); }
102 meta->setRun(run); meta->setExperiment(experiment);
103 B2INFO(
"Experiment " << experiment <<
", run " << run);
116 meta->setRun(run); meta->setExperiment(experiment);
117 B2INFO(
"Experiment " << experiment <<
", run " << run);
136 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content/ChannelMapping");
137 istringstream chstream;
139 chstream.str(content.getString(
"QAChannelMapping"));
140 while (chstream >> x >> y >> asic) {
145 GearDir installedModules =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content/InstalledModules");
146 B2INFO(
"Installed modules\n");
148 std::vector<std::string> installed;
151 std::string hapdID = module.getString(
"@hapdID");
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');
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);
163 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
166 std::vector<float> qs;
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++) {
175 qs[asicCh] = qe2d->GetBinContent(k, l);
179 B2INFO(
" Channels QE map found and set.\n");
184 for (
int k = 0; k < 144; k++) {
187 B2WARNING(
"ARICHDatabaseImporter::importModulesInfo: QE map for hapd " << hapdID <<
" not found! Setting 27% QE for all channels!");
190 modInfo.
addModule(moduleID, qs, isActive);
203 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
204 GearDir alignPars(content,
"GlobalAlignment");
219 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
220 GearDir alignPars(content,
"MirrorAlignment");
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);
249 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
250 GearDir alignPars(content,
"AeroTilesAlignment");
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");
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);
298 for (
const auto& test : moduleTest) {
299 if (hapdID == test.getHapdSN()) {
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!");
308 B2INFO(
" List of dead channels (from module test) found and set.\n");
313 B2WARNING(
"ARICHDatabaseImporter::importLWClasses: List of dead channels for hapd " << hapdID <<
314 " not found! All channels set to active.");
329 GearDir mergerCoolingParams =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content/mergerCoolingBodiesv2");
333 for (
auto mergerCoolingNode : mergerCoolingParams.
getNodes(
"BodiesDatFileName/Body")) {
344 B2INFO(
"--> Mergers cooling bodies geometry imported.");
354 std::ifstream infile(inDATfile.c_str(), std::ifstream::in);
356 if (infile.is_open()) {
358 while (infile >> mot) {
359 if (mot ==
"BodyPositionID")
365 infile >> solidStr.
nCells;
369 if (mot ==
"nApexPerCell")
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" }
378 for (
unsigned int i = 0; i < 3; i++) {
380 if (mot != apexNamesStr[0][i])
382 std::vector<double> valv;
383 for (
unsigned int j = 0; j < solidStr.
nCells; j++) {
387 solidStr.
posV1.push_back(valv);
390 for (
unsigned int i = 0; i < 3; i++) {
392 if (mot != apexNamesStr[1][i])
394 std::vector<double> valv;
395 for (
unsigned int j = 0; j < solidStr.
nCells; j++) {
399 solidStr.
posV2.push_back(valv);
402 for (
unsigned int i = 0; i < 3; i++) {
404 if (mot != apexNamesStr[2][i])
406 std::vector<double> valv;
407 for (
unsigned int j = 0; j < solidStr.
nCells; j++) {
411 solidStr.
posV3.push_back(valv);
416 B2WARNING(
"Unable to open file : " << inDATfile <<
" with cooling bodies geometry.");
424 B2ERROR(
"--> NULL Histogram");
430 int numChannels = h->GetNbinsX();
431 const int NumberOfChannelsPerHapd = 144;
432 const int NumberOfHapds = 420;
434 if (numChannels != NumberOfHapds * NumberOfChannelsPerHapd) {
435 B2ERROR(
"There should be " << NumberOfHapds * NumberOfChannelsPerHapd <<
" in the histogram!");
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++;
446 mask.setActiveCh(moduleID, channelID, value);
452 B2INFO(
"--> Channel Mask imported. Number of disabled channels=" << inactive <<
" Number of all channels=" << numChannels);
460 recPar.initializeDefault();
473 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content/SimulationParameters");
475 double qeScale = content.getDouble(
"qeScale");
476 double winAbs = content.getDouble(
"windowAbsorbtion");
477 double crossTalk = content.getDouble(
"chipNegativeCrosstalk");
478 double colEff = content.getDouble(
"colEff");
480 GearDir qeParams(content,
"QE");
483 double peakQE = qeParams.
getDouble(
"peakQE");
485 std::vector<float> qes;
486 for (
const auto& qeff : qeParams.
getNodes(
"Qeffi")) {
487 qes.push_back(qeff.getDouble(
"qe"));
490 simPar.
setQECurve(lambdaFirst, lambdaStep, qes);
507 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
510 istringstream chstream;
512 chstream.str(content.getString(
"ChannelMapping/SoftChannelMapping"));
514 B2INFO(
"Importing channel x,y to asic channel map\n");
515 B2INFO(
" x y asic\n");
516 while (chstream >> x >> y >> asic) {
518 B2INFO(
" " << setw(2) << x <<
" " << setw(2) << y <<
" " << setw(3) << asic <<
'\n');
530 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
536 GearDir mapping(content,
"FrontEndMapping");
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';
560 unsigned copperID = (unsigned) merger.getInt(
"COPPERid");
561 string finesseSlot = merger.getString(
"FinesseSlot");
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;}
568 B2ERROR(merger.getPath() <<
"/FinesseSlot " << finesseSlot <<
569 " ***invalid slot (valid are A, B, C, D)");
572 copperMap.
addMapping(mergerID, copperID, finesse);
573 std::cout <<
"Merger " << mergerID <<
" connected to copper " << copperID <<
", finesse " << finesse <<
'\n';
590 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
594 importObj.
construct(arichGeometryConfig);
601 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content");
602 GearDir cosmic(content,
"CosmicTest");
610 GearDir masterDir(cosmic,
"MasterVolume");
618 GearDir aerogel(cosmic,
"Aerogel");
621 plane.setSimple(par);
624 GearDir scints(cosmic,
"Scintilators");
626 std::string scintMat = scints.
getString(
"Material");
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);
649 elements.getEntries();
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();
665 for (
const auto& elementInfo : elementsInfo) {
666 if (elementInfo.getAerogelSN() == aeroID) {
667 refractiveIndex = elementInfo.getAerogelRefractiveIndex();
668 transmissionLength = elementInfo.getAerogelTransmissionLength();
669 thickness = elementInfo.getAerogelThickness();
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);
691 if (slot < 23) ring = 1;
692 else if (slot < 51) ring = 2;
693 else if (slot < 85) ring = 3;
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;
764 GearDir content =
GearDir(
"/DetectorCables[@name='ARICH']/Content");
769 GearDir mapping(content,
"biasCableMapping");
772 unsigned cableID = (unsigned) module.getInt(
"cableID");
773 unsigned innerID = module.getInt(
"innerID");
774 unsigned ring = module.getInt(
"ring");
775 unsigned azimuth = module.getInt(
"azimuth");
776 for (
unsigned sector = 1; sector < 7; sector++) {
777 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
778 biasMap.
addMapping(moduleID, sector, cableID, innerID);
783 GearDir mappingCH(content,
"biasChannelMapping");
786 int crate = module.getInt(
"crate");
787 int slot = module.getInt(
"slot");
788 int channelID = module.getInt(
"channelID");
789 int pinID = module.getInt(
"pinID");
790 int connectionID = module.getInt(
"connectionID");
791 int innerID = module.getInt(
"innerID");
792 std::string type = module.getString(
"type");
793 channelsMap.
addMapping(crate, slot, channelID, pinID, connectionID, innerID, type);
797 GearDir mappingCrate(content,
"biasCrateToCable");
800 int connectionID = module.getInt(
"connectionID");
801 int sector = module.getInt(
"sector");
802 int cable = module.getInt(
"cable");
803 std::vector<int> sectorCable{sector, cable};
805 crateMap.
addMapping(connectionID, sectorCable);
824 GearDir content =
GearDir(
"/DetectorCables[@name='ARICH']/Content");
829 GearDir mapping(content,
"hvCableToModuleMapping");
832 unsigned cableID = (unsigned) module.getInt(
"cableID");
833 unsigned innerID = module.getInt(
"innerID");
834 unsigned ring = module.getInt(
"ring");
835 unsigned azimuth = module.getInt(
"azimuth");
836 for (
unsigned sector = 1; sector < 7; sector++) {
837 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
838 hvMap.
addMapping(moduleID, sector, cableID, innerID);
843 GearDir mappingCH(content,
"hvChannelMapping");
846 int crate = module.getInt(
"crate");
847 int slot = module.getInt(
"slot");
848 int channelID = module.getInt(
"channelID");
849 int connectionID = module.getInt(
"connectionID");
850 int pinID = module.getInt(
"pinID");
851 channelsMap.
addMapping(crate, slot, channelID, connectionID, pinID);
855 GearDir mappingCrate(content,
"hvCrateToCable");
858 int connectionID = module.getInt(
"connectionID");
859 int sector = module.getInt(
"sector");
860 int cable = module.getInt(
"cable");
861 std::vector<int> sectorCable{sector, cable};
863 crateMap.
addMapping(connectionID, sectorCable);
884 GearDir content =
GearDir(
"/DetectorCables[@name='ARICH']/Content");
889 GearDir biasVoltages(content,
"biasVoltages");
892 std::string hapdID = module.getString(
"@id");
893 int biasA = module.getInt(
"biasA");
894 int biasB = module.getInt(
"biasB");
895 int biasC = module.getInt(
"biasC");
896 int biasD = module.getInt(
"biasD");
897 int guard = module.getInt(
"guard");
898 std::vector<int> voltages{biasA, biasB, biasC, biasD, guard};
913 channelsMap->print();
955 for (
int hapdID = 1; hapdID < 421; hapdID++) {
956 int val = hvMap->getCableID(hapdID) * 100 + hvMap->getInnerID(hapdID);
957 hist->setBinContent(hapdID, val);
959 hist->SetOption(
"TEXT");
960 hist->SaveAs(
"HVMapping.root");
982 elements.getEntries();
984 int connectionID = std::get<0>(channelsMap->getInnerConnection(channel));
985 int innerCable = std::get<1>(channelsMap->getInnerConnection(channel));
986 std::string biasType = std::get<2>(channelsMap->getInnerConnection(channel));
988 int sector = crateMap->getSector(connectionID);
989 int outerCable = crateMap->getCable(connectionID);
991 int moduleID = (int) biasMap->getModuleID(sector, outerCable, innerCable);
992 std::string hapdID =
"";
993 for (
const auto& element : elements) {
994 if (element.getSensorModuleID() == moduleID) hapdID = element.getHAPDserial();
997 std::vector<int> voltages = biasVolt->getBiasVoltages(hapdID);
998 int appliedVoltage = 0;
1000 if (biasType ==
"bias-a") appliedVoltage = voltages[0];
1001 if (biasType ==
"bias-b") appliedVoltage = voltages[1];
1002 if (biasType ==
"bias-c") appliedVoltage = voltages[2];
1003 if (biasType ==
"bias-d") appliedVoltage = voltages[3];
1004 if (biasType ==
"guard") appliedVoltage = voltages[4];
1007 B2INFO(
"Crate " << channel[0] <<
", slot " << channel[1] <<
", slot channel " << channel[2] <<
" belongs to hapd " << hapdID <<
1008 " (module ID = " << moduleID <<
") in sector " << sector <<
".\n Corresponding cable is " << sector <<
"-" << outerCable <<
1009 ".\n Cable type is " << biasType <<
" with applied voltage " << appliedVoltage <<
" V.");
1021 elements.getEntries();
1023 std::vector<int> channel{crate, slot, channelID};
1024 int connectionID = std::get<0>(channelsMap->getInnerConnection(channel));
1025 int innerCableNum = std::get<1>(channelsMap->getInnerConnection(channel));
1026 std::string biasType = channelsMap->getType(channel);
1028 int sector = crateMap->getSector(connectionID);
1029 int outerCable = crateMap->getCable(connectionID);
1031 int moduleID = (int)biasMap->getModuleID(sector, outerCable, innerCableNum);
1033 unsigned mergerID = mrgMap->getMergerID((
unsigned)moduleID);
1034 unsigned mergerSN = mrgMap->getMergerSN((
unsigned)mergerID);
1035 unsigned febSlot = mrgMap->getFEBSlot((
unsigned)moduleID);
1038 for (
const auto& element : elements) {
1039 if (element.getSensorGlobalID() == moduleID) B2INFO(
"HAPD for crate " << crate + 1 <<
", slot " << slot <<
", inner cable " <<
1040 innerCableNum <<
" has ID number " << moduleID <<
". Bias cable number is " << sector <<
"-" << outerCable <<
1041 ".\n Position is: RING " << element.getSensorModuleRingID() <<
" COLUMN " << element.getSensorModuleColumnID() <<
1042 ". \n Bias type for channel " << channelID <<
" is " << biasType <<
".\n It belongs to merger " << mergerID <<
" (SN " <<
1043 mergerSN <<
") and has DAQ feb slot " << febSlotDaq);
1050 std::map<unsigned, int> febSlots;
1051 febSlots.insert(std::pair<unsigned, int>(6, 0));
1052 febSlots.insert(std::pair<unsigned, int>(5, 1));
1053 febSlots.insert(std::pair<unsigned, int>(4, 2));
1054 febSlots.insert(std::pair<unsigned, int>(1, 3));
1055 febSlots.insert(std::pair<unsigned, int>(2, 4));
1056 febSlots.insert(std::pair<unsigned, int>(3, 5));
1058 int febDaqSlot = febSlots.find(febSlot)->second;
1143 importObjRec.
import(recPar.getIoV());
1156 for (
int hapdID = 1; hapdID < 421; hapdID++) {
1157 for (
int ichn = 0; ichn < 144; ichn++) {
1158 if (chMask->isActive(hapdID, ichn)) hist->setBinContent(hapdID, ichn, 1.0);
1161 hist->SaveAs(
"channelMask.root");
1175 for (
int hapdID = 1; hapdID < 421; hapdID++) {
1176 int val = mgrMap->getMergerID(hapdID);
1177 if (sn) val = mgrMap->getMergerSN(val);
1178 hist->setBinContent(hapdID, val);
1180 hist->SetOption(
"TEXT");
1181 hist->SaveAs(
"MergerMapping.root");
1192 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name='ARICH']/Content/InstalledModules");
1194 cout <<
"{ \"hapdmap\": [" << endl;
1195 for (
unsigned hapdID = 1; hapdID < 421; hapdID++) {
1197 for (
const GearDir& module : content.getNodes(
"Module")) {
1198 hapdsn = module.getString(
"@hapdID");
1199 unsigned sector = module.getInt(
"Sector");
1200 unsigned ring = module.getInt(
"Ring");
1201 unsigned azimuth = module.getInt(
"Azimuth");
1202 unsigned moduleID = geoConfig->getDetectorPlane().getSlotIDFromSRF(sector, ring, azimuth);
1203 if (moduleID == hapdID)
break;
1206 int val = mgrMap->getMergerID(hapdID);
1207 cout <<
"{\n" <<
"\"ID\": \"" << hapdID <<
"\"," << endl;
1208 cout <<
"\"sn\": \"" << hapdsn <<
"\"," << endl;
1209 cout <<
"\"mrg\": \"" << val <<
"\"," << endl;
1210 cout <<
"\"mrgSN\": \"" << mgrMap->getMergerSN(val) <<
"\"," << endl;
1211 cout <<
"\"feb\": \"" << mgrMap->getFEBSlot(hapdID) - 1 <<
"\"," << endl;
1212 cout <<
"\"cpr\": \"" << cprMap->getCopperID(val) <<
"\"," << endl;
1213 cout <<
"\"hslb\": \"" << cprMap->getFinesse(val) <<
"\"" << endl;
1214 if (hapdID < 420) cout <<
"}," << endl;
1215 else cout <<
"}" << endl;
1217 cout <<
"]}" << endl;
1226 for (
int hapdID = 1; hapdID < 421; hapdID++) {
1227 hist->setBinContent(hapdID, hapdID);
1229 hist->SetOption(
"TEXT");
1230 hist->SaveAs(
"ModuleNumbering.root");
1241 TGraph2D* gr =
new TGraph2D();
1243 for (
int i = 1; i < 421; i++) {
1244 if (modInfo->isInstalled(i)) {
1245 for (
int j = 0; j < 144; j++) {
1247 chMap->getXYFromAsic(j, xCh, yCh);
1248 ROOT::Math::XYVector chPos = geoConfig->getChannelPosition(i, xCh, yCh);
1249 gr->SetPoint(point, chPos.X(), chPos.Y(), modInfo->getChannelQE(i, j));
1254 gr->SaveAs(
"QEMap.root");
1257 for (
int hapdID = 1; hapdID < 421; hapdID++) {
1258 if (!modInfo->isInstalled(hapdID))
continue;
1259 for (
int chID = 0; chID < 144; chID++) {
1260 hist->setBinContent(hapdID, chID, modInfo->getChannelQE(hapdID, chID));
1263 hist->SaveAs(
"QEMap.root");
1277 std::string condDBname =
"ARICHdata";
1279 if (condDBname ==
"ARICHdata") {
1288 for (
const auto& elementM : elementsM) {
1289 if (elementM.getAerogelLayer(0) == 1) {
1290 for (
const auto& elementI : elementsI) {
1291 if (elementI.getAerogelSN() == elementM.getAerogelSN()) {
1294 elementM.getAerogelColumnID()), elementI.getAerogelRefractiveIndex());
1295 h2_aerogel_down_transmL->SetBinContent(h2_aerogel_down_transmL->
GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1296 elementM.getAerogelColumnID()), elementI.getAerogelTransmissionLength());
1297 h2_aerogel_down_thick->SetBinContent(h2_aerogel_down_thick->
GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1298 elementM.getAerogelColumnID()), elementI.getAerogelThickness());
1302 if (elementM.getAerogelLayer(1) == 1) {
1303 for (
const auto& elementI : elementsI) {
1304 if (elementI.getAerogelSN() == elementM.getAerogelSN()) {
1306 h2_aerogel_up_n->SetBinContent(h2_aerogel_up_n->
GetBinIDFromRingColumn(elementM.getAerogelRingID(), elementM.getAerogelColumnID()),
1307 elementI.getAerogelRefractiveIndex());
1308 h2_aerogel_up_transmL->SetBinContent(h2_aerogel_up_transmL->
GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1309 elementM.getAerogelColumnID()), elementI.getAerogelTransmissionLength());
1310 h2_aerogel_up_thick->SetBinContent(h2_aerogel_up_thick->
GetBinIDFromRingColumn(elementM.getAerogelRingID(),
1311 elementM.getAerogelColumnID()), elementI.getAerogelThickness());
1323 TFile* rootFile =
new TFile(outRootFileName.c_str(),
"RECREATE",
" Histograms", 1);
1325 if (rootFile->IsZombie()) {
1326 B2ERROR(
" ERROR ---> file : " << outRootFileName.c_str() <<
" is zombi");
1328 h2_aerogel_up_n->Write();
1329 h2_aerogel_up_transmL->Write();
1330 h2_aerogel_up_thick->Write();
1331 h2_aerogel_down_n->Write();
1332 h2_aerogel_down_transmL->Write();
1333 h2_aerogel_down_thick->Write();
1345 TClonesArray agelFitConstants(
"Belle2::ARICHAerogelRayleighScatteringFit");
1348 float version = (float) content.getDouble(
"version");
1351 for (
const auto& aerogel : content.getNodes(
"aerogeltile")) {
1353 serial = aerogel.getString(
"serial");
1355 vPar.push_back((
float)aerogel.getDouble(
"p0"));
1356 vPar.push_back((
float)aerogel.getDouble(
"p1"));
1357 vPar.push_back((
float)aerogel.getDouble(
"p2"));
1358 vPar.push_back((
float)aerogel.getDouble(
"p3"));
1359 vPar.push_back((
float)aerogel.getDouble(
"p4"));
1360 vPar.push_back((
float)aerogel.getDouble(
"p5"));
1361 vPar.push_back((
float)aerogel.getDouble(
"p6"));
1367 agelFitConstants[agel] = aeroRayScatFit;
1374 TString coreName =
"ARICHAerogelRayleighScatteringFit";
1375 TString coreNameSuffix = commentSingleWord;
1376 if (coreNameSuffix !=
"")
1377 coreName += coreNameSuffix;
1385 GearDir content =
GearDir(
"/ArichData/AllData/AerogelData/Content");
1388 TClonesArray agelConstants(
"Belle2::ARICHAerogelInfo");
1392 for (
const auto& aerogel : content.getNodes(
"aerogel")) {
1393 float version = (float) aerogel.getDouble(
"version");
1394 string serial = aerogel.getString(
"serial");
1395 string id = aerogel.getString(
"id");
1396 float index = (float) aerogel.getDouble(
"index");
1397 float trlen = ((float) aerogel.getDouble(
"translength")) *
Unit::mm;
1398 float thickness = ((float) aerogel.getDouble(
"thick")) *
Unit::mm;
1399 vector<int> lambdas;
1400 vector<float> transmittances;
1401 for (
const auto& transmittance : aerogel.getNodes(
"transmittance/transpoint")) {
1402 int lambda = transmittance.getInt(
"@lambda");
1403 float val = (float) transmittance.getDouble(
".");
1404 lambdas.push_back(lambda);
1405 transmittances.push_back(val);
1409 new (agelConstants[agel])
ARICHAerogelInfo(version, serial,
id, index, trlen, thickness, lambdas, transmittances);
1418 TString coreName =
"ARICHAerogelInfo";
1419 if (coreNameSuffix !=
"")
1420 coreName += coreNameSuffix;
1461 elements.getEntries();
1464 for (
const auto& element : elements) {
1465 B2INFO(
"Version = " << element.getAerogelVersion() <<
", serial = " << element.getAerogelSN() <<
1466 ", id = " << element.getAerogelID() <<
", n = " << element.getAerogelRefractiveIndex() <<
", transmLength = " <<
1467 element.getAerogelTransmissionLength() <<
", thickness = " << element.getAerogelThickness());
1468 if (verboseLevel > 0) {
1469 unsigned int ii = 0;
1471 while (lllambda > 0) {
1472 lllambda = element.getAerogelTransmittanceLambda(ii);
1475 float llval = element.getAerogelTransmittance(ii);
1476 B2INFO(
" Lambda = " << lllambda <<
" Transmittance = " << llval);
1490 TClonesArray agelMap(
"Belle2::ARICHAerogelMap");
1493 for (
int layer = 0; layer < 2; layer++) {
1495 for (
const auto& aerogel : content.getNodes(
"position")) {
1496 string agelserial =
"";
1497 int ring = aerogel.getInt(
"ring");
1498 int phi = aerogel.getInt(
"phi");
1499 if (layer == 1) agelserial = aerogel.getString(
"upaerogelserial");
1500 if (layer == 0) agelserial = aerogel.getString(
"downaerogelserial");
1506 agelConst->setAerogelRingID(ring);
1507 agelConst->setAerogelColumnID(phi);
1508 agelConst->setAerogelLayer(layer, 1);
1524 elements.getEntries();
1527 for (
const auto& element : elements) {
1529 if (element.getAerogelLayer(0) == 1) layer =
"down";
1530 if (element.getAerogelLayer(1) == 1) layer =
"up";
1531 B2INFO(
"ID = " << element.getAerogelSN() <<
", ring = " << element.getAerogelRingID() <<
1532 ", column = " << element.getAerogelColumnID() <<
", layer: " << layer);
1539 GearDir content =
GearDir(
"/ArichData/AllData/AerogelData/Content");
1542 TClonesArray agelConstantsA(
"Belle2::ARICHAerogelInfo");
1543 TClonesArray agelConstantsB(
"Belle2::ARICHAerogelInfo");
1544 TClonesArray agelConstantsC(
"Belle2::ARICHAerogelInfo");
1547 for (
int someint = 0; someint < 3; someint++) {
1550 for (
const auto& aerogel : content.getNodes(
"aerogel")) {
1554 if (someint == 0) version = (float) aerogel.getDouble(
"version");
1555 if (someint == 1) version = 4.0;
1556 if (someint == 2) version = 5.0;
1558 string serial = aerogel.getString(
"serial");
1559 string id = aerogel.getString(
"id");
1560 float index = (float) aerogel.getDouble(
"index");
1561 float trlen = ((float) aerogel.getDouble(
"translength")) *
Unit::mm;
1562 float thickness = ((float) aerogel.getDouble(
"thick")) *
Unit::mm;
1563 vector<int> lambdas;
1564 vector<float> transmittances;
1565 for (
const auto& transmittance : aerogel.getNodes(
"transmittance/transpoint")) {
1566 int lambda = transmittance.getInt(
"@lambda");
1567 float val = (float) transmittance.getDouble(
".");
1568 lambdas.push_back(lambda);
1569 transmittances.push_back(val);
1573 if (someint == 0)
new (agelConstantsA[agel])
ARICHAerogelInfo(version, serial,
id, index, trlen, thickness, lambdas,
1575 if (someint == 1)
new (agelConstantsB[agel])
ARICHAerogelInfo(version, serial,
id, index, trlen, thickness, lambdas,
1577 if (someint == 2)
new (agelConstantsC[agel])
ARICHAerogelInfo(version, serial,
id, index, trlen, thickness, lambdas,
1584 TObject* agelObj[3];
1585 agelObj[0] =
static_cast<TObject*
>(&agelConstantsA);
1586 agelObj[1] =
static_cast<TObject*
>(&agelConstantsB);
1587 agelObj[2] =
static_cast<TObject*
>(&agelConstantsC);
1591 intraRun.
add(500, agelObj[1]);
1592 intraRun.
add(1000, agelObj[2]);
1619 TObject* data = std::get<0>(podatki);
1621 TObject* myobject = data2->
getObject(event);
1622 TClonesArray* elements =
static_cast<TClonesArray*
>(myobject);
1625 (*elements).GetEntries();
1626 for (
int i = 0; i < elements->GetSize(); i++) {
1654 TClonesArray hapdQAConstants(
"Belle2::ARICHHapdQA");
1659 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
1661 int size = inputFile.length();
1662 string hapdSerial = inputFile.substr(size - 16, 6);
1664 vector<TGraph*> leakCurrent;
1665 TH2F* hitData2D = 0;
1666 vector<TGraph*> noise;
1667 vector<TH1S*> hitCount;
1668 TTimeStamp arrivalDate;
1673 TIter next(f->GetListOfKeys());
1675 while ((key = (TKey*)next())) {
1677 string strime = key->GetName();
1679 if (strime.compare(0, 8,
"gcurrent") == 0) {
1680 TGraph* graphcurrent = (TGraph*)f->Get(strime.c_str());
1681 leakCurrent.push_back(graphcurrent);
1684 else if (strime.compare(0, 7,
"h2dscan") == 0) {
1685 hitData2D = (TH2F*)f->Get(strime.c_str());
1686 hitData2D->SetDirectory(0);
1689 else if (strime.compare(0, 9,
"gnoise_ch") == 0) {
1690 TGraph* graphnoise = (TGraph*)f->Get(strime.c_str());
1691 noise.push_back(graphnoise);
1694 else if (strime.compare(0, 7,
"hchscan") == 0) {
1695 TH1F* hhist3 = (TH1F*)f->Get(strime.c_str());
1696 hhist3->SetDirectory(0);
1700 const char* hhist3_ime = hhist3->GetName();
1701 const char* hhist3_naslov = hhist3->GetTitle();
1702 int hhist3_nbins = hhist3->GetSize();
1703 TH1S* hhist3short =
new TH1S(hhist3_ime, hhist3_naslov, hhist3_nbins - 2, 0, 1);
1704 for (
int bin = 0; bin < hhist3_nbins; bin++) {
1705 hhist3short->SetBinContent(bin, hhist3->GetBinContent(bin));
1707 hhist3short->SetDirectory(0);
1708 hitCount.push_back(hhist3short);
1711 else if (strime.compare(0, 4,
"tree") == 0) {
1712 tree = (TTree*)f->Get(strime.c_str());
1713 tree->SetBranchAddress(
"arrival", &arrival);
1715 arrivalDate = TTimeStamp(arrival, 0);
1718 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()); }
1722 new (hapdQAConstants[
hapd])
ARICHHapdQA(hapdSerial, arrivalDate, leakCurrent, hitData2D, noise, hitCount);
1734 elements.getEntries();
1737 for (
const auto& element : elements) {
1738 B2INFO(
"Serial number = " << element.getHapdSerialNumber() <<
"; arrival date = " << element.getHapdArrivalDate());
1746 TClonesArray asicConstants(
"Belle2::ARICHAsicInfo");
1749 for (
const auto& asiclist : content.getNodes(
"asicinfo")) {
1750 string asicSerial = asiclist.getString(
"serial");
1751 string comment = asiclist.getString(
"comment");
1752 string numCH = asiclist.getString(
"num");
1765 if (numCH.find(
"many") != string::npos) {num = 5000; }
1766 else if (numCH.find(
"all") != string::npos) {num = 10000; }
1767 else {num = atoi(numCH.c_str()); }
1772 auto* asicConst =
static_cast<ARICHAsicInfo*
>(asicConstants[asic]);
1775 asicConst->setTimeFinishGain(timeFinishGain);
1776 asicConst->setTimeFinishOffset(timeFinishOffset);
1777 asicConst->setDeadChannels(nosignalCHs);
1778 asicConst->setBadConnChannels(badconnCHs);
1779 asicConst->setBadOffsetChannels(badoffsetCHs);
1780 asicConst->setBadLinChannels(badlinCHs);
1781 asicConst->setNumOfProblematicChannels(num);
1782 asicConst->setComment(comment);
1792 TFile f1(
"asicInfoHistograms.root",
"recreate");
1799 string asicSerial =
"";
1802 TTree* tree =
new TTree(
"asicInfo",
"asic info data");
1804 tree->Branch(
"asicSerial", (
void*)asicSerial.c_str(),
"string/C", 1024);
1805 tree->Branch(
"gain0",
"TH3F", &gain0);
1806 tree->Branch(
"gain1",
"TH3F", &gain1);
1807 tree->Branch(
"gain2",
"TH3F", &gain2);
1808 tree->Branch(
"gain3",
"TH3F", &gain3);
1809 tree->Branch(
"offsetF",
"TH3F", &offsetF);
1810 tree->Branch(
"offsetR",
"TH3F", &offsetR);
1815 string inputFileNew = (string) inputFile;
1816 string asicName = inputFileNew.substr(inputFileNew.find(
"/asicData") + 17);
1817 size_t findRoot = asicName.find(
".root");
1818 if (findRoot != string::npos) {
1820 TFile* f = TFile::Open(inputFile.c_str(),
"READ",
"", 0);
1821 TIter next(f->GetListOfKeys());
1825 while ((key = (TKey*)next())) {
1826 string strname = key->GetName();
1827 if (strname.find(
"_g0") != string::npos) gain0 = (TH3F*)f->Get(strname.c_str());
1828 else if (strname.find(
"_g1") != string::npos) gain1 = (TH3F*)f->Get(strname.c_str());
1829 else if (strname.find(
"_g2") != string::npos) gain2 = (TH3F*)f->Get(strname.c_str());
1830 else if (strname.find(
"_g3") != string::npos) gain3 = (TH3F*)f->Get(strname.c_str());
1831 else if (strname.find(
"_f") != string::npos) offsetF = (TH3F*)f->Get(strname.c_str());
1832 else if (strname.find(
"_c") != string::npos) offsetR = (TH3F*)f->Get(strname.c_str());
1833 else B2INFO(
"Key name does not match any of the following: gain, offset!");
1851 TTimeStamp timeFinish;
1853 size_t findText = 100;
1857 string inputFileNew = (string) inputFile;
1858 if (type ==
"gain") { findText = inputFileNew.find(
"dateGain.txt"); }
1859 else if (type ==
"offset") { findText = inputFileNew.find(
"dateOffset.txt"); }
1860 else {B2INFO(
"Check type of measurement!"); }
1861 if (findText != string::npos) {
1862 std::ifstream ifs(inputFile);
1863 if (ifs.is_open()) {
1864 while (ifs.good()) {
1865 std::getline(ifs, line);
1866 string asicSerial2 = asicSerial +
":";
1867 size_t findSerial = line.find(asicSerial2);
1881 string dateEnd = enddate.substr(enddate.find(
":") + 2);
1882 string yearStr = dateEnd.substr(0, 4);
1883 string monthStr = dateEnd.substr(4, 2);
1884 string dayStr = dateEnd.substr(6, 2);
1885 string hourStr = dateEnd.substr(8, 2);
1886 string minStr = dateEnd.substr(10, 2);
1887 int year = atoi(yearStr.c_str());
1888 int month = atoi(monthStr.c_str());
1889 int day = atoi(dayStr.c_str());
1890 int hour = atoi(hourStr.c_str());
1891 int min = atoi(minStr.c_str());
1892 TTimeStamp datum = TTimeStamp(year, month, day, hour, min, 0, 0, kTRUE, -9 * 60 * 60);
1901 if ((badCH.find(
"many") != string::npos) || (badCH.find(
"all") != string::npos)) CHs.emplace_back(-1);
1902 else ARICHTools::StringToVector::convert<int>(badCH,
',');
1912 elements.getEntries();
1915 for (
const auto& element : elements) {
1916 B2INFO(
"asic SN: " << element.getAsicID());
1925 TClonesArray febConstants(
"Belle2::ARICHFebTest");
1931 GearDir content2 =
GearDir(
"/ArichData/AllData/FEBData/Content");
1933 for (
const auto& runserial : content.getNodes(
"run")) {
1934 int serial = runserial.getInt(
"sn");
1937 auto* febConst =
static_cast<ARICHFebTest*
>(febConstants[feb]);
1940 string runLV = runserial.getString(
"lv");
1941 string runHV = runserial.getString(
"hv");
1942 string runSCAN = runserial.getString(
"scan");
1943 string comment = runserial.getString(
"comment");
1945 febConst->setRunLV(runLV);
1946 febConst->setRunHV(runHV);
1947 febConst->setRunSlowC(runSCAN);
1948 febConst->setComment(comment);
1953 for (
const auto& febmap : content1.
getNodes(
"febps")) {
1954 string somedna = febmap.getString(
"@dna");
1955 int sn = febmap.getInt(
"sn");
1956 if ((l == 0) && (sn == serial)) {
1958 febConst->setFebDna(dna);
1965 if (!runSCAN.empty()) {
1967 if (stoi(runSCAN.c_str()) < 23) {scanRun = stoi(runSCAN.c_str());}
1968 else {scanRun = stoi(runSCAN.c_str()) - 77;}
1969 for (
const auto& testFEB : content2.
getNodes(
"febtest[" + std::to_string(scanRun) +
"]")) {
1970 string timeSlowC = testFEB.getString(
"time");
1972 int positionOld = 0;
1974 for (
const auto& testFEBslowctest : testFEB.getNodes(
"slowc")) {
1975 int position = testFEBslowctest.getInt(
"id");
1976 if (position == positionOld) {i++; }
1979 string dnaNew = testFEBslowctest.getString(
"dna");
1980 if (dnaNew == dna) {
1981 float tmon0 = (float) testFEBslowctest.getDouble(
"TMON0");
1982 float tmon1 = (float) testFEBslowctest.getDouble(
"TMON1");
1983 float vdd = (float) testFEBslowctest.getDouble(
"VDD");
1984 float v2p = (float) testFEBslowctest.getDouble(
"V2P");
1985 float v2n = (float) testFEBslowctest.getDouble(
"V2N");
1986 float vss = (float) testFEBslowctest.getDouble(
"VSS");
1987 float vth1 = (float) testFEBslowctest.getDouble(
"VTH1");
1988 float vth2 = (float) testFEBslowctest.getDouble(
"VTH2");
1989 float vcc12 = (float) testFEBslowctest.getDouble(
"VCC12");
1990 float vcc15 = (float) testFEBslowctest.getDouble(
"VCC15");
1991 float vcc25 = (float) testFEBslowctest.getDouble(
"VCC25");
1992 float v38p = (float) testFEBslowctest.getDouble(
"V38P");
1994 febConst->setTemperature0(tmon0);
1995 febConst->setTemperature1(tmon1);
1996 febConst->setVdd(vdd);
1997 febConst->setV2p(v2p);
1998 febConst->setV2n(v2n);
1999 febConst->setVss(vss);
2000 febConst->setVth1(vth1);
2001 febConst->setVth2(vth2);
2002 febConst->setVcc12(vcc12);
2003 febConst->setVcc15(vcc15);
2004 febConst->setVcc25(vcc25);
2005 febConst->setV38p(v38p);
2010 positionOld = position;
2017 febConst->setSlopesFine(slopes.first);
2018 febConst->setSlopesRough(slopes.second);
2022 febConst->setFWHM(fwhm);
2027 if (!runHV.empty()) {
2029 if (stoi(runHV.c_str()) < 43) {hvRun = stoi(runHV.c_str());}
2030 else {hvRun = stoi(runHV.c_str()) - 57;}
2033 febConst->setCurrentV99p(get<1>(HVtest));
2038 if (!runLV.empty()) {
2040 if (stoi(runLV.c_str()) < 43) {lvRun = stoi(runLV.c_str());}
2041 else {lvRun = stoi(runLV.c_str()) - 57;}
2044 febConst->setCurrentV20p(get<1>(LVtest));
2045 febConst->setCurrentV21n(get<2>(LVtest));
2046 febConst->setCurrentV38p(get<3>(LVtest));
2061 TFile f(
"febTestHistograms.root",
"recreate");
2062 TH3F* offsetRough = 0;
2063 TH3F* offsetFine = 0;
2064 TH2F* testPulse = 0;
2068 TTree* tree =
new TTree(
"febTest",
"feb test data");
2070 tree->Branch(
"serial", &serial,
"sn/I");
2071 tree->Branch(
"offsetRough",
"TH3F", &offsetRough);
2072 tree->Branch(
"offsetFine",
"TH3F", &offsetFine);
2073 tree->Branch(
"testPulse",
"TH2F", &testPulse);
2075 int febposition = -1;
2079 GearDir content2 =
GearDir(
"/ArichData/AllData/FEBData/Content");
2081 for (
const auto& runserial : content.getNodes(
"run")) {
2082 serial = runserial.getInt(
"sn");
2083 string runSCAN = runserial.getString(
"scan");
2087 for (
const auto& febmap : content1.
getNodes(
"febps")) {
2088 string somedna = febmap.getString(
"@dna");
2089 int sn = febmap.getInt(
"sn");
2090 if ((l == 0) && (sn == serial)) {
2096 if (!runSCAN.empty()) {
2098 if (stoi(runSCAN.c_str()) < 23) {scanRun = stoi(runSCAN.c_str());}
2099 else {scanRun = stoi(runSCAN.c_str()) - 77;}
2100 for (
const auto& testFEB : content2.
getNodes(
"febtest[" + std::to_string(scanRun) +
"]")) {
2102 int positionOld = 0;
2104 for (
const auto& testFEBslowctest : testFEB.getNodes(
"slowc")) {
2105 int position = testFEBslowctest.getInt(
"id");
2106 if (position == positionOld) {i++; }
2109 string dnaNew = testFEBslowctest.getString(
"dna");
2110 if (dnaNew == dna) febposition = position;
2112 positionOld = position;
2116 offsetRough = histograms[0];
2117 offsetFine = histograms[1];
2121 testPulse->SetDirectory(0);
2122 offsetRough->SetDirectory(0);
2123 offsetFine->SetDirectory(0);
2145 GearDir content2LV =
GearDir(
"/ArichData/AllData/FEBDataLV/Content");
2146 std::tuple<std::string, float, float, float> LVtest;
2147 float currentV20p = 0.0, currentV21n = 0.0, currentV38p = 0.0;
2149 for (
const auto& testFEBlv : content2LV.
getNodes(
"febtest[" + std::to_string(lvRun) +
"]")) {
2150 string timeLV = testFEBlv.getString(
"time");
2151 for (
const auto& testFEBlv_sn : testFEBlv.getNodes(
"lvtest/feb[sn='" + to_string(serial) +
"']/febps/n[@id='14']")) {
2152 for (
const auto& testFEBlv_pw : testFEBlv_sn.getNodes(
"pw18")) {
2153 if (testFEBlv_pw.getInt(
"@id") == 0) { currentV20p = (float) testFEBlv_pw.getDouble(
"I"); }
2154 if (testFEBlv_pw.getInt(
"@id") == 1) { currentV21n = (float) testFEBlv_pw.getDouble(
"I"); }
2155 if (testFEBlv_pw.getInt(
"@id") == 2) { currentV38p = (float) testFEBlv_pw.getDouble(
"I"); }
2156 LVtest = make_tuple(timeLV, currentV20p, currentV21n, currentV38p);
2166 GearDir content2HV =
GearDir(
"/ArichData/AllData/FEBDataHV/Content");
2167 std::tuple<std::string, float> HVtest;
2168 for (
const auto& testFEBhv : content2HV.
getNodes(
"febtest[" + std::to_string(hvRun) +
"]")) {
2169 string timeHV = testFEBhv.getString(
"time");
2170 for (
const auto& testFEBhv_sn : testFEBhv.getNodes(
"hvtest/feb[sn='" + to_string(serial) +
"']/febhv/n[@id='9']")) {
2171 float currentV99p = (float) testFEBhv_sn.getDouble(
"n1470/I");
2172 HVtest = std::make_tuple(timeHV, currentV99p);
2180 vector<int> listCHs;
2182 ifstream fileFEB(
"febTest/FEBdeadChannels.txt");
2183 if (fileFEB.is_open()) {
2184 while (getline(fileFEB, line)) {
2185 string ch2 = line.substr(line.find(
",") + 1);
2186 string dna2 = line.erase(line.find(
",") - 1);
2187 if (dna2 == dna) { listCHs.push_back(atoi(ch2.c_str())); }
2189 }
else { B2INFO(
"No file FEBdeadChannels.txt"); }
2198 string dateMeas = time.substr(4);
2199 string yearStr = dateMeas.substr(16, 4);
2200 string monthStr = dateMeas.substr(0, 3);
2201 string dayStr = dateMeas.substr(4, 2);
2202 string hourStr = dateMeas.substr(7, 2);
2203 string minStr = dateMeas.substr(10, 2);
2204 string secStr = dateMeas.substr(13, 2);
2206 int year = atoi(yearStr.c_str());
2207 int day = atoi(dayStr.c_str());
2208 int hour = atoi(hourStr.c_str());
2209 int min = atoi(minStr.c_str());
2210 int sec = atoi(secStr.c_str());
2211 map<string, int> months {
2212 {
"Jan", 1 }, {
"Feb", 2 }, {
"Mar", 3 }, {
"Apr", 4 }, {
"May", 5 }, {
"Jun", 6 }, {
"Jul", 7 }, {
"Aug", 8 }, {
"Sep", 9 }, {
"Oct", 10 }, {
"Nov", 11 }, {
"Dec", 12 }
2214 int month = months.find(monthStr)->second;
2216 TTimeStamp datum = TTimeStamp(year, month, day, hour, min, sec, 0, kTRUE, 0);
2222 GearDir contentData =
GearDir(
"/ArichData/AllData/SlopesFebTest/Content");
2223 pair<vector<float>, vector<float>> slopesFebTest;
2224 vector<float> slopesCoarse, slopesFine;
2226 for (
const auto& contentSlopes : contentData.
getNodes(
"febtest")) {
2227 if ((contentSlopes.getInt(
"@id") == serialNum) && (contentSlopes.getString(
"@run") == run)) {
2228 for (
int i = 0; i < 144; i++) {
2229 for (
const auto& contSlopes : contentSlopes.getNodes(
"slope/ch[@id='" + to_string(i) +
"']")) {
2230 float slopeCoarse = ((float) contSlopes.getDouble(
"coarse")) * 2.5 / 1024;
2231 float slopeFine = ((float) contSlopes.getDouble(
"fine")) * 2.5 / 1024;
2232 slopesCoarse.push_back(slopeCoarse);
2233 slopesFine.push_back(slopeFine);
2237 slopesFebTest = std::make_pair(slopesFine, slopesCoarse);
2239 return slopesFebTest;
2244 GearDir contentData =
GearDir(
"/ArichData/AllData/SlopesFebTest/Content");
2245 vector<pair<float, float>> fwhm;
2247 for (
const auto& contentSlopes : contentData.
getNodes(
"febtest")) {
2248 if ((contentSlopes.getInt(
"@id") == serialNum) && (contentSlopes.getString(
"@run") == run)) {
2249 for (
const auto& contSlopes : contentSlopes.getNodes(
"data/ch")) {
2250 float fwhmVal = (float) contSlopes.getDouble(
"fwhm");
2251 float fwhmSig = (float) contSlopes.getDouble(
"sigma");
2252 pair<float, float> fwhmPair = std::make_pair(fwhmVal, fwhmSig);
2253 fwhm.push_back(fwhmPair);
2262 vector<TH3F*> histogrami;
2266 if (inputFile.find(run) != string::npos) {
2267 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
2268 int iMIN = 0, iMAX = 0, delta, stepsNum = 16, i = 0, point2 = 24;
2270 float stepsMax = 15.5;
2273 TIter next(f->GetListOfKeys());
2275 while ((key = (TKey*)next())) {
2276 string strime = key->GetName();
2277 if (strime.compare(0, 5,
"h2d_0") == 0) i++;
2281 for (
int k = 0; k < 2; k++) {
2286 if (k == 0) { option =
"coarse"; iMIN = 2; iMAX = 16; delta = 2;}
2287 if (k == 1) { option =
"fine"; iMIN = 17; iMAX = 31; delta = 17; }
2289 if (k == 0) { option =
"coarse"; iMIN = 2; iMAX = 17; delta = 2; }
2290 if (k == 1) { option =
"fine"; iMIN = 18; iMAX = 33; delta = 18; }
2293 TH3F* histogram =
new TH3F((option +
" " + dna).c_str(), (option +
" " + dna).c_str(), 144, -0.5, 143.5, 250, 299, 799, stepsNum,
2296 for (
int j = iMIN; j < iMAX + 1; j++) {
2297 TH2F* hist2d = (TH2F*)f->Get((
"h2d_0;" + std::to_string(j)).c_str());
2298 hist2d->SetDirectory(0);
2301 if ((j - delta) < 8) {binZ = 8 - (j - delta);}
2302 if ((j - delta) > 7) {binZ = point2 - (j - delta);}
2304 for (
int binX = 144 * febposition + 1; binX < 144 * (febposition + 1) + 1; binX++) {
2305 for (
int binY = 1; binY < 251; binY++) {
2306 histogram->SetBinContent(binX - 144 * febposition, binY, binZ, hist2d->GetBinContent(binX, binY));
2310 histogram->SetDirectory(0);
2311 histogrami.push_back(histogram);
2312 for (
int kanal = 1; kanal < 145; kanal ++) {
2313 for (
int offset = 1; offset < stepsNum + 1; offset++) {
2314 TH1D* h1 = histogram->ProjectionY(
"A", kanal, kanal, offset, offset);
2315 h1->SetName((dna +
" kanal: " + to_string(kanal) +
", offset: " + to_string(offset)).c_str());
2328 TH2F* testPulse =
new TH2F((
"test pulse " + dna).c_str(), (
"test pulse " + dna).c_str(), 144, -0.5, 143.5, 250, 299, 799);
2331 if (inputFile.find(run) != string::npos) {
2332 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
2333 TH2F* pulseTest = (TH2F*)f->Get(
"h2d_0;1");
2334 pulseTest->SetDirectory(0);
2335 for (
int binX = 144 * febposition + 1; binX < 144 * (febposition + 1) + 1; binX++) {
2336 for (
int binY = 1; binY < 251; binY++) {
2337 testPulse->SetBinContent(binX - 144 * febposition, binY, pulseTest->GetBinContent(binX, binY));
2352 elements.getEntries();
2355 for (
const auto& element : elements) {
2356 B2INFO(
"Serial = " << element.getFebSerial() <<
"; dna = " << element.getFebDna() <<
"; slope R (ch143) = " <<
2357 element.getSlopeRough(143) <<
"; slope F (ch143) = " << element.getSlopeFine(143) <<
"; comment = " << element.getComment());
2365 GearDir content =
GearDir(
"/ArichData/AllData/hapdData/Content");
2368 TClonesArray chipConstants(
"Belle2::ARICHHapdChipInfo");
2371 for (
const auto& hapdInfo : content.getNodes(
"hapd")) {
2373 string sn = hapdInfo.getString(
"serial");
2377 int channel_label_aval[4], bias[4], gain[4];
2378 TGraph** bombardmentGain, **avalancheGain;
2379 bombardmentGain =
new TGraph *[4];
2380 avalancheGain =
new TGraph *[4];
2381 TH2F** bias2DV, **bias2DI;
2382 bias2DV =
new TH2F *[4];
2383 bias2DI =
new TH2F *[4];
2384 vector<int> badlist[4], cutlist[4];
2385 vector<TGraph*> bombCurrents[4], avalCurrents[4];
2389 for (
const auto& chipInfo : hapdInfo.getNodes(
"chipinfo")) {
2390 chip[chip_ABCD] = chipInfo.getString(
"chip");
2391 bias[chip_ABCD] = chipInfo.getInt(
"bias");
2392 string badL = chipInfo.getString(
"deadlist");
2393 string cutL = chipInfo.getString(
"cutlist");
2396 string gain_str = chipInfo.getString(
"gain");
2397 gain[chip_ABCD] = atoi(gain_str.c_str());
2405 float hv_bomb[n3], gain_bomb[n3], current1_bomb[n3], current2_bomb[n3], current3_bomb[n3];
2407 for (
const auto& BG : hapdInfo.getNodes(
"bombardmentgain/ch")) {
2408 string value = BG.getString(
"value");
2409 string chip_label = value.erase(1);
2410 for (
const auto& BG2 : BG.getNodes(
"point")) {
2411 hv_bomb[i3] = (float) BG2.getDouble(
"hv");
2412 gain_bomb[i3] = (float) BG2.getDouble(
"gain");
2413 current1_bomb[i3] = (float) BG2.getDouble(
"current1");
2414 current2_bomb[i3] = (float) BG2.getDouble(
"current2");
2415 current3_bomb[i3] = (float) BG2.getDouble(
"current3");
2426 bombCurrents[chip_ABCD].push_back(bombardmentCurrent1);
2427 bombCurrents[chip_ABCD].push_back(bombardmentCurrent2);
2428 bombCurrents[chip_ABCD].push_back(bombardmentCurrent3);
2436 float hv_aval[n4], gain_aval[n4], current1_aval[n4], current2_aval[n4], current3_aval[n4];
2438 for (
const auto& BG : hapdInfo.getNodes(
"avalanchegain/ch")) {
2439 string value = BG.getString(
"value");
2440 string value_1 = value;
2441 string chip_label = value.erase(1);
2442 string value_2 = value_1.substr(2);
2443 channel_label_aval[chip_ABCD] = atoi(value_2.c_str());
2444 for (
const auto& BG2 : BG.getNodes(
"point")) {
2445 hv_aval[i4] = (float) BG2.getDouble(
"biasv");
2446 gain_aval[i4] = (float) BG2.getDouble(
"gain");
2447 current1_aval[i4] = (float) BG2.getDouble(
"current1");
2448 current2_aval[i4] = (float) BG2.getDouble(
"current2");
2449 current3_aval[i4] = (float) BG2.getDouble(
"current3");
2460 avalCurrents[chip_ABCD].push_back(avalancheCurrent1);
2461 avalCurrents[chip_ABCD].push_back(avalancheCurrent2);
2462 avalCurrents[chip_ABCD].push_back(avalancheCurrent3);
2472 int i5 = 0, chipnum[n5];
2473 float biasv[n5], biasi[n5];
2474 for (
const auto& HI : hapdInfo.getNodes(
"bias2d/biasvalue")) {
2475 string chip_2d = HI.getString(
"@chip");
2476 chipnum[i5] = HI.getInt(
"@ch");
2477 biasv[i5] = (float) HI.getDouble(
"biasv");
2478 biasi[i5] = (float) HI.getDouble(
"biasi");
2479 if (chipnum[i5] == 36) {
2489 for (
unsigned int l = 0; l < 4; l++) {
2491 auto* chipConst =
static_cast<ARICHHapdChipInfo*
>(chipConstants[4 * chip_i + l]);
2494 chipConst->setChipLabel(chip[l]);
2495 chipConst->setBiasVoltage(bias[l]);
2496 chipConst->setGain(gain[l]);
2497 chipConst->setBadChannel(badlist[l]);
2498 chipConst->setCutChannel(cutlist[l]);
2499 chipConst->setBombardmentGain(bombardmentGain[l]);
2500 chipConst->setBombardmentCurrent(bombCurrents[l]);
2501 chipConst->setAvalancheGain(avalancheGain[l]);
2502 chipConst->setAvalancheCurrent(avalCurrents[l]);
2503 chipConst->setChannelNumber(channel_label_aval[l]);
2504 chipConst->setBiasVoltage2D(bias2DV[l]);
2505 chipConst->setBiasCurrent2D(bias2DI[l]);
2510 delete[] bombardmentGain;
2511 delete[] avalancheGain;
2523 elements.getEntries();
2525 for (
const auto& element : elements) {
2526 B2INFO(
"Serial = " << element.getHapdSerial() <<
", chip = " << element.getChipLabel() <<
", bias= " << element.getBiasVoltage());
2535 GearDir content =
GearDir(
"/ArichData/AllData/hapdData/Content");
2538 TClonesArray hapdConstants(
"Belle2::ARICHHapdInfo");
2541 for (
const auto& hapdInfo : content.getNodes(
"hapd")) {
2544 auto* hapdConst =
static_cast<ARICHHapdInfo*
>(hapdConstants[hapd_i]);
2547 string serial = hapdInfo.getString(
"serial");
2548 float qe400 = (float) hapdInfo.getDouble(
"qe400");
2549 float hv = 1000 * (float) hapdInfo.getDouble(
"hv");
2550 float current = (float) hapdInfo.getDouble(
"current");
2551 string gb = hapdInfo.getString(
"guardbias");
2552 int guardbias = atoi(gb.c_str());
2556 float lambda[n1], qepoint[n1];
2558 for (
const auto& QE : hapdInfo.getNodes(
"qe/qepoint")) {
2559 lambda[i1] = (float) QE.getInt(
"@lambda");
2560 qepoint[i1] = (float) QE.getDouble(
".");
2563 TGraph* qe =
new TGraph(i1, lambda, qepoint);
2566 qe->GetXaxis()->SetTitle(
"lambda");
2567 qe->GetYaxis()->SetTitle(
"qe");
2570 const int n2 = 4100;
2571 int channel_adc[n2], pulse_adc[n2];
2573 for (
const auto& ADC : hapdInfo.getNodes(
"adc/value")) {
2574 channel_adc[i2] = ADC.getInt(
"@ch");
2575 string str = ADC.getString(
".");
2576 pulse_adc[i2] = atoi(str.c_str());
2579 TGraph* adc =
new TGraph(i2, channel_adc, pulse_adc);
2580 adc->SetName(
"adc");
2581 adc->SetTitle(
"Pulse Height Distribution");
2582 adc->GetXaxis()->SetTitle(
"channel");
2583 adc->GetYaxis()->SetTitle(
"pulse height");
2586 hapdConst->setSerialNumber(serial);
2587 hapdConst->setQuantumEfficiency400(qe400);
2588 hapdConst->setHighVoltage(hv);
2589 hapdConst->setGuardBias(guardbias);
2590 hapdConst->setCurrent(current);
2591 hapdConst->setQuantumEfficiency(qe);
2592 hapdConst->setPulseHeightDistribution(adc);
2598 for (
const auto& element : elementsChip) {
2599 if (element.getHapdSerial() == serial) {
2601 if (element.getChipLabel() ==
"A") hapdConst->setHapdChipInfo(0, &elementValue);
2602 if (element.getChipLabel() ==
"B") hapdConst->setHapdChipInfo(1, &elementValue);
2603 if (element.getChipLabel() ==
"C") hapdConst->setHapdChipInfo(2, &elementValue);
2604 if (element.getChipLabel() ==
"D") hapdConst->setHapdChipInfo(3, &elementValue);
2619 B2INFO(
"channel list = " << chlist <<
", chip = " << chipDelay);
2620 string chlistDig = ARICHTools::remove_chars_if_not(chlist,
"0123456789,~");
2622 vector<int> CHs = ARICHTools::getDeadCutList(*chipDelay.c_str(), ARICHTools::StringToVector::parse<int>(chlistDig,
','));
2624 B2INFO(
"All channels: ");
2631 const std::string& chip_label,
int i,
float* HV,
2632 float* gain_current)
2634 TGraph* hapd_graph =
new TGraph(i, HV, gain_current);
2635 string title = bomb_aval +
" " + g_i +
", chip " + chip_label;
2636 hapd_graph->SetTitle(title.c_str());
2637 hapd_graph->GetXaxis()->SetTitle(
"high voltage");
2638 hapd_graph->GetYaxis()->SetTitle(g_i.c_str());
2645 int x = 100, y = 100;
2646 if (chip_2d ==
"A") {
2653 }
else if (chip_2d ==
"B") {
2660 }
else if (chip_2d ==
"C") {
2667 }
else if (chip_2d ==
"D") {
2676 if (
XY ==
"x") {
return x;}
2677 else if (
XY ==
"y") {
return y;}
2685 string name =
"bias " + voltage_current +
", chip " + chip_2d;
2686 TH2F* bias2d =
new TH2F(
"bias2d", name.c_str(), 6, 0, 6, 6, 0, 6);
2687 for (
int XYname = 0; XYname < 6; XYname++) {
2688 bias2d->GetXaxis()->SetBinLabel(XYname + 1, to_string(XYname).c_str());
2689 bias2d->GetYaxis()->SetBinLabel(XYname + 1, to_string(6 * XYname).c_str());
2691 for (
int XY = 0;
XY < 36;
XY++) {
2693 int y = 0 + chipnum[
XY];
2698 bias2d->SetBinContent(x, y, bias_v_i[
XY]);
2700 bias2d->SetDirectory(0);
2708 elements.getEntries();
2710 for (
const auto& element : elements) {
2711 B2INFO(
"Serial = " << element.getSerialNumber() <<
"; HV = " << element.getHighVoltage() <<
"; qe400 = " <<
2712 element.getQuantumEfficiency400());
2713 for (
int n = 0; n < 4; n++) {
2715 B2INFO(
"biasV(chip" << n <<
") = " << newelement->
getBiasVoltage());
2729 TClonesArray hapdQEConstants(
"Belle2::ARICHHapdQE");
2735 TFile* f = TFile::Open(inputFile.c_str(),
"READ");
2737 int size = inputFile.length();
2738 string hapdSerial = inputFile.substr(size - 11, 6);
2742 TIter next(f->GetListOfKeys());
2744 while ((key = (TKey*)next())) {
2746 string strime = key->GetName();
2748 if (strime.compare(0, 11,
"hqe2d_pixel") == 0) {
2749 qe2D = (TH2F*)f->Get(strime.c_str());
2750 qe2D->SetTitle(
"quantum efficiency");
2751 qe2D->SetName(
"QE");
2752 qe2D->SetDirectory(0);
2755 else { B2INFO(
"Key name does not match 'hqe2d_pixel'!"); }
2772 elements.getEntries();
2773 gROOT->SetBatch(kTRUE);
2776 for (
const auto& element : elements) {
2777 B2INFO(
" SN = " << element.getHapdSerialNumber());
2778 TH2F* qe2d = element.getQuantumEfficiency2D();
2779 TFile file(
"QEhists.root",
"update");
2792 elements.getEntries();
2794 for (
const auto& element : elements) {
2795 if (element.getHapdSerial() == serialNumber) {
2796 TGraph* avalgain = element.getAvalancheGain();
2821 TGraph* gainnew =
new TGraph(avalgain->GetN());
2822 double xpoint, ypoint;
2823 for (
int j = 0; j < avalgain->GetN(); j++) {
2824 avalgain->GetPoint(j, xpoint, ypoint);
2825 gainnew->SetPoint(j, ypoint, xpoint);
2827 B2INFO(
"serial#-chip = " << element.getHapdSerial() <<
"-" << element.getChipLabel() <<
"; " <<
"V(gain=40) = " << (
int)(
2828 gainnew->Eval(40) + 0.5));
2837 B2INFO(
"SN = " << aeroSerialNumber <<
"; n = " << aerogelParams.find(
"refractiveIndex")->second <<
"; transLen = " <<
2838 aerogelParams.find(
"transmissionLength")->second <<
"; thickness = " << aerogelParams.find(
"thickness")->second);
2848 std::map<std::string, float> aerogelParams;
2850 elements.getEntries();
2851 for (
const auto& element : elements) {
2852 if ((element.getAerogelSN()) == aeroSerialNumber) {
2854 {
"refractiveIndex", element.getAerogelRefractiveIndex() },
2855 {
"transmissionLength", element.getAerogelTransmissionLength() },
2856 {
"thickness", element.getAerogelThickness() }
2860 return aerogelParams;
2869 TClonesArray febConstants(
"Belle2::ARICHFEBoardInfo");
2873 for (
const auto& febinfo : content.getNodes(
"febasic")) {
2874 int febSN = (float) febinfo.getInt(
"sn");
2875 string asic1 = febinfo.getString(
"asic1");
2876 string asic2 = febinfo.getString(
"asic2");
2877 string asic3 = febinfo.getString(
"asic3");
2878 string asic4 = febinfo.getString(
"asic4");
2879 string delivery = febinfo.getString(
"delivered");
2880 string sentKEK = febinfo.getString(
"sentKEK");
2882 if (delivery.size() != 10) cout <<
"feb sn " << febSN <<
" check delivery time!" << endl;
2884 string year = delivery.substr(6, 4);
2885 delivery = febinfo.getString(
"delivered");
2886 string month = delivery.substr(3, 2);
2887 delivery = febinfo.getString(
"delivered");
2888 string day = delivery.substr(0, 2);
2890 int deliveryINT = atoi((year + month + day +
"u").c_str());
2891 TTimeStamp deliverytime(deliveryINT, 0u, 0u);
2893 string location =
"";
2894 if (!sentKEK.empty()) location =
"KEK";
2900 febConst->setAsicPosition(0, asic1);
2901 febConst->setAsicPosition(1, asic2);
2902 febConst->setAsicPosition(2, asic3);
2903 febConst->setAsicPosition(3, asic4);
2904 febConst->setTimeStamp(deliverytime);
2905 febConst->setFEBoardLocation(location);
2909 for (
const auto& element : elementsAsic) {
2910 if (element.getAsicID() == asic1) {
2912 febConst->setAsicInfo(0, &elementValue);
2914 if (element.getAsicID() == asic2) {
2916 febConst->setAsicInfo(1, &elementValue);
2918 if (element.getAsicID() == asic3) {
2920 febConst->setAsicInfo(2, &elementValue);
2922 if (element.getAsicID() == asic4) {
2924 febConst->setAsicInfo(3, &elementValue);
2938 elements.getEntries();
2940 for (
const auto& element : elements) {
2941 B2INFO(
"Feb sn = " << element.getFEBoardSerial());
2942 for (
int i = 0; i < 4; i++) {
2943 B2INFO(
"ASIC " << i <<
" = " << element.getAsicPosition(i));
2954 if (HVtest ==
"no") path =
"/ArichData/AllData/moduletest";
2955 else if (HVtest ==
"yes") path =
"/ArichData/AllData/moduletestHV";
2956 else B2INFO(
"Check HVB test parameter!");
2961 TClonesArray moduleConstants(
"Belle2::ARICHModuleTest");
2965 for (
const auto& moduletest : content.getNodes(
"module")) {
2966 int febSN = (float) moduletest.getInt(
"febserial");
2967 string hapdSN = moduletest.getString(
"hapdserial");
2969 if (HVtest ==
"yes") hvbSN = (float) moduletest.getInt(
"hvbserial");
2970 int run = moduletest.getInt(
"run");
2971 int runposition = moduletest.getInt(
"runposition");
2972 int isok = moduletest.getInt(
"isok");
2974 if (isok == 1) isOK =
true;
2975 string comment = moduletest.getString(
"comment");
2977 vector<int> deadChannels;
2979 if (HVtest ==
"no") {
2980 auto ids = ARICHTools::StringToVector::convert<ARICHTools::ModuleID_t>(moduletest.getString(
"dead"),
',');
2981 deadChannels.reserve(ids.size());
2982 for (
const auto& rID : ids)
2983 deadChannels.emplace_back(rID.getNumbering());
2988 if (HVtest ==
"yes") {
2989 deadChannels = ARICHTools::StringToVector::convert<int>(moduletest.getString(
"dead"),
',');
2992 B2INFO(
"Dead channels: ");
2995 TGraph* guardBias_th = 0;
2996 TGraph* chipVdiff_th[4] = {0};
2997 TGraph* chipLeak_th[4] = {0};
3000 TGraph* guardBias_2Dx = 0;
3001 TGraph* chipVdiff_2Dx[4] = {0};
3002 TGraph* chipLeak_2Dx[4] = {0};
3005 TGraph* guardBias_2Dy = 0;
3006 TGraph* chipVdiff_2Dy[4] = {0};
3007 TGraph* chipLeak_2Dy[4] = {0};
3017 if (run < 10) runStr =
"000" + to_string(run);
3018 if ((run > 9) && (run < 100)) runStr =
"00" + to_string(run);
3019 if (run > 99) runStr =
"0" + to_string(run);
3020 TFile* f = TFile::Open((mypath + runStr +
"/" + runStr +
"_" + hapdSN +
"_out.root").c_str(),
"READ");
3023 TIter next(f->GetListOfKeys());
3025 while ((key = (TKey*)next())) {
3027 string strime = key->GetName();
3029 if (strime.find(
"Guard") != string::npos) {
3030 if (strime.find(
"_T_0") != string::npos) {
3031 guardBias_th = (TGraph*)f->Get(strime.c_str());
3033 if (strime.find(
"_T_1") != string::npos) {
3034 guardBias_2Dx = (TGraph*)f->Get(strime.c_str());
3036 if (strime.find(
"_T_2") != string::npos) {
3037 guardBias_2Dy = (TGraph*)f->Get(strime.c_str());
3041 if (strime.find(
"BiasDifference") != string::npos) {
3042 for (
int i = 0; i < 4; i++) {
3043 if (strime.find((
"CHIP_" + to_string(i) +
"_T_0").c_str()) != string::npos) {
3044 chipVdiff_th[i] = (TGraph*)f->Get(strime.c_str());
3046 if (strime.find((
"CHIP_" + to_string(i) +
"_T_1").c_str()) != string::npos) {
3047 chipVdiff_2Dx[i] = (TGraph*)f->Get(strime.c_str());
3049 if (strime.find((
"CHIP_" + to_string(i) +
"_T_2").c_str()) != string::npos) {
3050 chipVdiff_2Dy[i] = (TGraph*)f->Get(strime.c_str());
3055 if (strime.find(
"LeakageCurrent") != string::npos) {
3056 for (
int i = 0; i < 4; i++) {
3057 if (strime.find((
"CHIP_" + to_string(i) +
"_T_0").c_str()) != string::npos) {
3058 chipLeak_th[i] = (TGraph*)f->Get(strime.c_str());
3060 if (strime.find((
"CHIP_" + to_string(i) +
"_T_1").c_str()) != string::npos) {
3061 chipLeak_2Dx[i] = (TGraph*)f->Get(strime.c_str());
3063 if (strime.find((
"CHIP_" + to_string(i) +
"_T_2").c_str()) != string::npos) {
3064 chipLeak_2Dy[i] = (TGraph*)f->Get(strime.c_str());
3069 if (strime.find(
"HV") != string::npos) {
3070 if (strime.find(
"_T_0") != string::npos) {
3071 HV_th = (TGraph*)f->Get(strime.c_str());
3073 if (strime.find(
"_T_1") != string::npos) {
3074 HV_2Dx = (TGraph*)f->Get(strime.c_str());
3076 if (strime.find(
"_T_2") != string::npos) {
3077 HV_2Dy = (TGraph*)f->Get(strime.c_str());
3081 if (strime.find(
"Gain_1D") != string::npos) {
3082 gain = (TH1F*)f->Get(strime.c_str());
3083 gain->SetDirectory(0);
3086 if (strime.find(
"Charge_2D") != string::npos) {
3087 charge = (TH2D*)f->Get(strime.c_str());
3088 charge->SetDirectory(0);
3091 if (strime.find(
"Threshold_2D") != string::npos) {
3092 th = (TH2D*)f->Get(strime.c_str());
3093 th->SetDirectory(0);
3096 if (strime.find(
"Scan_2D_X") != string::npos) {
3097 scanX = (TH2D*)f->Get(strime.c_str());
3098 scanX->SetDirectory(0);
3101 if (strime.find(
"Scan_2D_Y") != string::npos) {
3102 scanY = (TH2D*)f->Get(strime.c_str());
3103 scanY->SetDirectory(0);
3109 auto* moduleConst =
static_cast<ARICHModuleTest*
>(moduleConstants[module]);
3111 moduleConst->setHapdSN(hapdSN);
3112 moduleConst->setRun(run);
3113 moduleConst->setRunPosition(runposition);
3114 moduleConst->setOK(isOK);
3115 moduleConst->setDeadChs(deadChannels);
3116 moduleConst->setComment(comment);
3117 moduleConst->setGuardBiasTH(guardBias_th);
3118 moduleConst->setHighVoltageTH(HV_th);
3119 moduleConst->setGuardBias2Dx(guardBias_2Dx);
3120 moduleConst->setHighVoltage2Dx(HV_2Dx);
3121 moduleConst->setGuardBias2Dy(guardBias_2Dy);
3122 moduleConst->setHighVoltage2Dy(HV_2Dy);
3123 moduleConst->setGain(gain);
3124 moduleConst->setChargeScan(charge);
3125 moduleConst->setTresholdScan(th);
3126 moduleConst->setLaserScanX(scanX);
3127 moduleConst->setLaserScanY(scanY);
3129 for (
int i = 0; i < 4; i++) {
3130 moduleConst->setChipVdiffTH(i, chipVdiff_th[i]);
3131 moduleConst->setChipLeakTH(i, chipLeak_th[i]);
3132 moduleConst->setChipVdiff2Dx(i, chipVdiff_2Dx[i]);
3133 moduleConst->setChipLeak2Dx(i, chipLeak_2Dx[i]);
3134 moduleConst->setChipVdiff2Dy(i, chipVdiff_2Dy[i]);
3135 moduleConst->setChipLeak2Dy(i, chipLeak_2Dy[i]);
3137 if (HVtest ==
"yes") moduleConst->setHvbSN(hvbSN);
3140 B2INFO(
"module no " << module - 1 <<
" saved to DB. HAPD SN = " << hapdSN <<
", FEB SN = " << febSN);
3152 if (HVtest ==
"no") {
3154 elements.getEntries();
3155 for (
const auto& element : elements) {
3156 B2INFO(
"Feb sn = " << element.getFebSN() <<
", hapd sn = " << element.getHapdSN() <<
", run = " << element.getRun() <<
3157 ", run position = " << element.getRunPosition() <<
", module is ok = " << element.getOK() <<
", comment = " <<
3158 element.getComment());
3159 for (
int i = 0; i < element.getDeadChsSize(); i++) {
3160 B2INFO(
"dead channel = " << element.getDeadCh(i) <<
" (hapd mapping)");
3165 if (HVtest ==
"yes") {
3167 elements.getEntries();
3168 for (
const auto& element : elements) {
3169 B2INFO(
"Feb sn = " << element.getFebSN() <<
", hapd sn = " << element.getHapdSN() <<
", hvb sn = " << element.getHvbSN() <<
3170 ", run = " << element.getRun() <<
", run position = " << element.getRunPosition() <<
", module is ok = " << element.getOK() <<
3171 ", comment = " << element.getComment());
3172 for (
int i = 0; i < element.getDeadChsSize(); i++) {
3173 B2INFO(
"dead channel = " << element.getDeadCh(i) <<
" (asic mapping)");
3184 TClonesArray moduleInfoConstants(
"Belle2::ARICHSensorModuleInfo");
3189 for (
const auto& sensor : content.getNodes(
"position")) {
3190 int febSerial = sensor.getInt(
"febserial");
3191 string hapdSerial = sensor.getString(
"hapdserial");
3192 int id = sensor.getInt(
"moduleID");
3193 int hvSerial = sensor.getInt(
"HVserial");
3199 moduleInfoConst->setFEBserial(febSerial);
3200 moduleInfoConst->setHAPDserial(hapdSerial);
3201 moduleInfoConst->setHVboardID(hvSerial);
3205 for (
const auto& element : elementsHapd) {
3206 if (element.getSerialNumber() == hapdSerial) {
3208 moduleInfoConst->setHapdID(&elementValue);
3214 for (
const auto& element : elementsFeb) {
3215 if (element.getFEBoardSerial() == febSerial) {
3217 moduleInfoConst->setFEBoardID(&elementValue);
3223 for (
const auto& element : elementsModule) {
3224 if (element.getFebSN() == febSerial) {
3226 moduleInfoConst->setModuleTest(&elementValue);
3244 TClonesArray moduleMapConstants(
"Belle2::ARICHSensorModuleMap");
3249 for (
const auto& sensor : content.getNodes(
"position")) {
3250 int sextant = sensor.getInt(
"sector");
3251 int ring = sensor.getInt(
"ring");
3252 int column = sensor.getInt(
"column");
3253 int id = sensor.getInt(
"moduleID");
3259 moduleMapConst->setSensorModuleRingID(ring);
3260 moduleMapConst->setSensorModuleColumnID(column);
3261 moduleMapConst->setSensorGlobalID(
id);
3265 for (
const auto& element : elementsModule) {
3266 if (element.getSensorModuleID() ==
id) {
3268 moduleMapConst->setSensorModuleId(&elementValue);
3282 elements.getEntries();
3284 for (
const auto& element : elements) {
3285 B2INFO(
"Sextant = " << element.getSensorModuleSextantID() <<
", ring = " << element.getSensorModuleRingID() <<
", column = " <<
3286 element.getSensorModuleColumnID());
3293 for (
int i = 0; i < 4; i++) {
3295 B2INFO(
"Hapd Serial = " << newestelement->
getHapdSerial() <<
"; chip = " << newestelement->
getChipLabel() <<
"; gain = " <<
3304 elements.getEntries();
3306 for (
const auto& element : elements) {
3309 B2INFO(
"Sextant = " << element.getSensorModuleSextantID() <<
", ring = " << element.getSensorModuleRingID() <<
", column = " <<
3310 element.getSensorModuleColumnID());
3316 for (
int i = 0; i < 4; i++) {
3318 B2INFO(
"Hapd Serial = " << newestelement->
getHapdSerial() <<
"; chip = " << newestelement->
getChipLabel() <<
"; gain = " <<
3329 TClonesArray magnetConstants(
"Belle2::ARICHMagnetTest");
3334 for (
const auto& module : content.getNodes(
"module")) {
3337 auto* magnetConst =
static_cast<ARICHMagnetTest*
>(magnetConstants[num]);
3339 int snint = module.getInt(
"hapdID");
3340 if (snint < 5000) sn =
"KA";
3343 sprintf(hapdID,
"%s%04d", sn.c_str(), snint);
3344 magnetConst->setSerialNumber(hapdID);
3346 vector<float> deadtimes;
3347 for (
const auto& time : module.getNodes(
"deadtime/measurement")) {
3348 if (time.getString(
".") !=
"-") {
3349 float deadtime = (float) time.getDouble(
".");
3350 deadtimes.push_back(deadtime);
3353 magnetConst->setDeadTime(deadtimes);
3355 if (module.getString(
"lowerA") !=
"-") magnetConst->setDeadTimeLowerA((
float) module.getDouble(
"lowerA"));
3356 if (module.getString(
"lowerB") !=
"-") magnetConst->setDeadTimeLowerB((
float) module.getDouble(
"lowerB"));
3357 if (module.getString(
"lowerC") !=
"-") magnetConst->setDeadTimeLowerC((
float) module.getDouble(
"lowerC"));
3358 if (module.getString(
"lowerD") !=
"-") magnetConst->setDeadTimeLowerD((
float) module.getDouble(
"lowerD"));
3360 bool getter_reactivation = module.getBool(
"getter");
3361 string comment = module.getString(
"comment");
3362 magnetConst->setGetter(getter_reactivation);
3363 magnetConst->setComment(comment);
3376 elements.getEntries();
3378 for (
const auto& element : elements) {
3379 string getter =
"no";
3380 if (element.getGetter() == 1) getter =
"yes";
3381 B2INFO(
"SN = " << element.getSerialNumber() <<
"; after getter reactivation? " << getter);
3382 for (
int i = 0; i < element.getDeadTimeSize();
3383 i++) B2INFO(
"dead time = " << element.getDeadTime(i) <<
" (" << (i + 1) <<
". measurement)");
3384 if (element.getDeadTimeLowerA() > 0.) B2INFO(
"lower voltage on chip A = " << element.getDeadTimeLowerA());
3385 if (element.getDeadTimeLowerB() > 0.) B2INFO(
"lower voltage on chip B = " << element.getDeadTimeLowerB());
3386 if (element.getDeadTimeLowerC() > 0.) B2INFO(
"lower voltage on chip C = " << element.getDeadTimeLowerC());
3387 if (element.getDeadTimeLowerD() > 0.) B2INFO(
"lower voltage on chip D = " << element.getDeadTimeLowerD());
3388 B2INFO(
"comment = " << element.getComment());
Alignment parameters for aerogel tiles.
void setAlignmentElement(int id, const ARICHPositionElement &pars)
Sets alignment parameters (element) for aerogel tile.
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.
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.
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.
Map of the Aerogel placement.
void setAerogelSN(const std::string &agelid)
Set Aerogel serial number.
The Class for ARICH aerogel Rayleigh scattering fit parameters.
void setAsicID(const std::string &id)
Set ASIC identifier.
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.
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.
ARICH histogram with HAPD plane 3 options for bin segmentation are available type 0 - one bin per HAP...
The Class for ARICH HAPD channel mapping.
int getAsicFromXY(unsigned xChn, unsigned yChn) const
Get asic channel number from HAPD channel X,Y numbers.
void mapXY2Asic(unsigned xChn, unsigned yChn, unsigned asicChn)
Add entry to channel map.
The Class for ARICH HAPD channel mask.
void setActiveCh(unsigned modId, unsigned chNo, bool active)
Set active/non-active channel.
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.
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 printMergerMapping(bool dump=false)
Prints merger to FEB mappings from the database.
void printCopperMapping(bool dump=false)
Prints Copper to merger mappings from the database.
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 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 importAerogelInfoEventDep()
Import intrarun dependant ARICH aerogel data in the database.
std::vector< std::string > m_inputFilesFebTest
Input root files from FEB test (coarse/fine offset settings, test pulse)
void printAeroTileInfo(bool dump=false)
Prints mapping of aerogel tiles and their optical properties.
void dumpHvMappings()
Dumps detector map of HAPD modules to HV cable channels.
void printBiasMappings(bool dump=false)
Prints mappings of power supply to bias cables and cables to HAPDs and nominal values of bias voltage...
void importReconstructionParams()
Import reconstruction parameters (for now only initializes "default" values and imports)
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 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.
void printHvMappings(bool dump=false)
Prints mappings of power supply to HV cables and cables to HAPDs from the database.
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.
std::vector< int > getDeadChFEB(const std::string &dna)
Returns list of dead channels on FEB.
void printChannelMapping(bool dump=false)
Prints HAPD (asic) channel mapping from the database.
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 printGlobalAlignment(bool dump=false)
Prints global alignment constants.
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 printModulesInfo(bool dump=false)
Print HAPD modules info from the database (lightweight class for sim/rec=)
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.
void printChannelMask(bool makeHist=false, bool dump=false)
Print channel mask of all HAPD modules from the database (lightweight class for sim/rec)
std::vector< std::string > m_inputFilesHapdQE
Input root files for HAPD quantum efficiency.
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 printNominalBiasVoltages(bool dump=false)
Prints mappings of nominal values of bias voltages from the database.
int getAeroTileRing(int slot)
Get aerogel ring number from global indetifier.
void printMirrorAlignment(bool dump=false)
Prints mirror alignment constants.
void exportFebTest()
Export ARICH FEB test data from the database.
void printSimulationPar(bool dump=false)
Print simulation parameters from the database (QE curve, etc.)
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 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 printReconstructionPar(bool dump=false)
Prints reconstruction parameters.
void importAsicInfo()
Import ARICH ASICs data in the database.
void printAeroTilesAlignment(bool dump=false)
Prints aerogel tiles alignment constants.
void exportHapdQA()
Export ARICH HAPD QA data from the database.
std::vector< std::string > m_inputFilesAsicRoot
Input root files for ASICs.
void printGeometryConfig(bool dump=false)
Prints geometry configuration parameters 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 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 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.
Front End Electronics Boards.
void setFEBoardSerial(int serial)
Set Front-End Board identifier.
void setFebSerial(int serial)
Set FEB serial number.
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 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.
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.
Geometry parameters of ARICH Master volume (envelope).
void setAlignmentElement(const ARICHPositionElement &align)
Sets alignment parameters (element).
Contains manufacturer data of one of the 4 photo sensors chips.
std::string getChipLabel() const
Get chip label.
int getGain() const
Get chip gain at operational voltage.
void setHapdSerial(const std::string &serial)
Set HAPD serial number.
std::string getHapdSerial() const
Get HAPD Serial number.
int getBiasVoltage() const
Get chip bias Voltage.
Contains manufacturer data of the photo sensor - HAPD.
std::string getSerialNumber() const
Return HAPD Serial Number.
float getHighVoltage() const
Return operational High Voltage.
ARICHHapdChipInfo * getHapdChipInfo(unsigned int i) const
Return HapdChipInfo of the chip i.
float getQuantumEfficiency400() const
Return quantum efficiency at 400 nm.
Contains manufacturer data of the photo sensor - HAPD.
Contains manufacturer data of the photo sensor - HAPD.
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.
Contains fractions of dead times measured in a magnet.
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.
Mirror alignment parameters for ARICH.
void setAlignmentElement(int id, const ARICHPositionElement &pars)
Sets Alignment parameters (element) for mirror plate.
void setFebSN(int serial)
Set FEB serial number.
The Class for information on HAPD modules installed in ARICH.
void addModule(unsigned modId, std::vector< float > &qeList, bool active)
Add installed module.
Position element for ARICH.
void print(const std::string &title="Parameters of position element") const override
Print the content of the class.
The Class for ARICH reconstruction parameters.
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.
void setSensorModuleID(int id)
Set Sensor-module identifier.
Mapping of the sensor-board connections to the detector.
void setSensorModuleSextantID(int sextant)
Set sensor-module sextant identifier.
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 absorption 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.
IntervalOfValidity getIoV() const
Return current IoV of the object.
Class for accessing arrays of objects in the database.
int getEntries() const
Get the number of objects in the array.
bool import(const IntervalOfValidity &iov)
Import the object to database.
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.
Class for accessing objects in the database.
bool addPayload(const std::string &name, const std::string &fileName, const IntervalOfValidity &iov)
Add a payload file to the database.
Class for handling changing conditions as a function of event number.
void add(unsigned int event, TObject *object)
Add an object to the intra run dependency.
GearDir is the basic class used for accessing the parameter store.
virtual std::string getString(const std::string &path="") const noexcept(false) override
Get the parameter path as a string.
A class that describes the interval of experiments/runs for which an object in the database is valid.
TObject * getObject(const EventMetaData &event) const
Get the conditions object that is valid for the given event.
Type-safe access to single objects in the data store.
static const double mm
[millimeters]
static const double nm
[nanometers]
double getAngle(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard angle unit.
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.
double getDouble(const std::string &path="") const noexcept(false)
Get the parameter path as a double.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
std::vector< GearDir > getNodes(const std::string &path="") const
Get vector of GearDirs which point to all the nodes the given path evaluates to.
TH1F * hapd[6]
histogram of hits for each hapd
std::pair< TObject *, IntervalOfValidity > getData(const EventMetaData &event, const std::string &name)
Request an object from the database.
static Database & Instance()
Instance of a singleton Database.
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
Abstract base class for different kinds of events.
Structure which holds apexes of the tessellation volumes.
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