Belle II Software development
KLMDatabaseImporter Class Reference

KLM database importer. More...

#include <KLMDatabaseImporter.h>

Public Member Functions

 KLMDatabaseImporter ()
 Constructor.
 
 ~KLMDatabaseImporter ()
 Destructor.
 
void setIOV (int experimentLow, int runLow, int experimentHigh, int runHigh)
 Set interval of validity.
 
void importChannelStatus (const KLMChannelStatus *channelStatus)
 Import channel status.
 
void importReconstructionParameters (const KLMReconstructionParameters *digitizationParameters)
 Import reconstruction parameters.
 
void importScintillatorDigitizationParameters (const KLMScintillatorDigitizationParameters *digitizationParameters)
 Import scintillator simulation parameters.
 
void importTimeConversion (const KLMTimeConversion *timeConversion)
 Import time conversion parameters.
 
void importTimeWindow (KLMTimeWindow *timeWindow)
 Import KLM time window parameters.
 
void loadStripEfficiency (KLMStripEfficiency *stripEfficiency, std::string fileName)
 Load strip efficiencies.
 
void importStripEfficiency (const KLMStripEfficiency *stripEfficiency)
 Import strip efficiencies.
 
void importAlignment (const BKLMAlignment *bklmAlignment, const EKLMAlignment *eklmAlignment, const EKLMSegmentAlignment *eklmSegmentAlignment, bool displacement=false)
 Import alignment.
 

Private Member Functions

void importBKLMAlignment (const BKLMAlignment *bklmAlignment, bool displacement=false)
 Import BKLM alignment.
 
void importEKLMAlignment (const EKLMAlignment *eklmAlignment, bool displacement=false)
 Import EKLM alignment.
 
void importEKLMSegmentAlignment (const EKLMSegmentAlignment *eklmSegmentAlignment, bool displacement=false)
 Import EKLM segment alignment.
 

Private Attributes

int m_ExperimentLow = 0
 Low experiment.
 
int m_RunLow = 0
 Low run.
 
int m_ExperimentHigh = -1
 High experiment.
 
int m_RunHigh = -1
 High run.
 

Detailed Description

KLM database importer.

Definition at line 31 of file KLMDatabaseImporter.h.

Constructor & Destructor Documentation

◆ KLMDatabaseImporter()

Constructor.

Definition at line 26 of file KLMDatabaseImporter.cc.

27{
28}

◆ ~KLMDatabaseImporter()

Destructor.

Definition at line 30 of file KLMDatabaseImporter.cc.

31{
32}

Member Function Documentation

◆ importAlignment()

void importAlignment ( const BKLMAlignment bklmAlignment,
const EKLMAlignment eklmAlignment,
const EKLMSegmentAlignment eklmSegmentAlignment,
bool  displacement = false 
)

Import alignment.

Parameters
[in]bklmAlignmentBKLM alignment.
[in]eklmAlignmentEKLM alignment.
[in]eklmSegmentAlignmentEKLM segment alignment.
[in]displacementImport displacement payload.

Definition at line 188 of file KLMDatabaseImporter.cc.

191{
192 importBKLMAlignment(bklmAlignment, displacement);
193 importEKLMAlignment(eklmAlignment, displacement);
194 importEKLMSegmentAlignment(eklmSegmentAlignment, displacement);
195}
void importEKLMSegmentAlignment(const EKLMSegmentAlignment *eklmSegmentAlignment, bool displacement=false)
Import EKLM segment alignment.
void importEKLMAlignment(const EKLMAlignment *eklmAlignment, bool displacement=false)
Import EKLM alignment.
void importBKLMAlignment(const BKLMAlignment *bklmAlignment, bool displacement=false)
Import BKLM alignment.

◆ importBKLMAlignment()

void importBKLMAlignment ( const BKLMAlignment bklmAlignment,
bool  displacement = false 
)
private

Import BKLM alignment.

Parameters
[in]bklmAlignmentBKLM alignment.
[in]displacementImport displacement payload.

Definition at line 143 of file KLMDatabaseImporter.cc.

145{
146 std::string payloadName;
147 if (displacement)
148 payloadName = "BKLMDisplacement";
149 else
150 payloadName = "BKLMAlignment";
151 DBImportObjPtr<BKLMAlignment> bklmAlignmentImport(payloadName);
152 bklmAlignmentImport.construct(*bklmAlignment);
155 bklmAlignmentImport.import(iov);
156}
Class for importing a single object to the database.
A class that describes the interval of experiments/runs for which an object in the database is valid.
int m_ExperimentHigh
High experiment.
int m_ExperimentLow
Low experiment.

◆ importChannelStatus()

void importChannelStatus ( const KLMChannelStatus channelStatus)

Import channel status.

Definition at line 43 of file KLMDatabaseImporter.cc.

45{
46 DBImportObjPtr<KLMChannelStatus> channelStatusImport;
47 channelStatusImport.construct(*channelStatus);
50 channelStatusImport.import(iov);
51}
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.

◆ importEKLMAlignment()

void importEKLMAlignment ( const EKLMAlignment eklmAlignment,
bool  displacement = false 
)
private

Import EKLM alignment.

Parameters
[in]eklmAlignmentEKLM alignment.
[in]displacementImport displacement payload.

Definition at line 158 of file KLMDatabaseImporter.cc.

160{
161 std::string payloadName;
162 if (displacement)
163 payloadName = "EKLMDisplacement";
164 else
165 payloadName = "EKLMAlignment";
166 DBImportObjPtr<EKLMAlignment> eklmAlignmentImport(payloadName);
167 eklmAlignmentImport.construct(*eklmAlignment);
170 eklmAlignmentImport.import(iov);
171}

◆ importEKLMSegmentAlignment()

void importEKLMSegmentAlignment ( const EKLMSegmentAlignment eklmSegmentAlignment,
bool  displacement = false 
)
private

Import EKLM segment alignment.

Parameters
[in]eklmSegmentAlignmentEKLM segment alignment.
[in]displacementImport displacement payload.

Definition at line 173 of file KLMDatabaseImporter.cc.

175{
176 std::string payloadName;
177 if (displacement)
178 payloadName = "EKLMSegmentDisplacement";
179 else
180 payloadName = "EKLMSegmentAlignment";
181 DBImportObjPtr<EKLMSegmentAlignment> eklmSegmentAlignmentImport(payloadName);
182 eklmSegmentAlignmentImport.construct(*eklmSegmentAlignment);
185 eklmSegmentAlignmentImport.import(iov);
186}

◆ importReconstructionParameters()

void importReconstructionParameters ( const KLMReconstructionParameters digitizationParameters)

Import reconstruction parameters.

Definition at line 53 of file KLMDatabaseImporter.cc.

55{
57 digPar.construct(*digitizationParameters);
60 digPar.import(iov);
61}

◆ importScintillatorDigitizationParameters()

void importScintillatorDigitizationParameters ( const KLMScintillatorDigitizationParameters digitizationParameters)

Import scintillator simulation parameters.

Definition at line 63 of file KLMDatabaseImporter.cc.

65{
67 digPar.construct(*digitizationParameters);
70 digPar.import(iov);
71}

◆ importStripEfficiency()

void importStripEfficiency ( const KLMStripEfficiency stripEfficiency)

Import strip efficiencies.

Parameters
[in]stripEfficiencyStrip efficiency.

Definition at line 133 of file KLMDatabaseImporter.cc.

135{
136 DBImportObjPtr<KLMStripEfficiency> stripEfficiencyImport;
137 stripEfficiencyImport.construct(*stripEfficiency);
140 stripEfficiencyImport.import(iov);
141}

◆ importTimeConversion()

void importTimeConversion ( const KLMTimeConversion timeConversion)

Import time conversion parameters.

Parameters
[in]timeConversionTime conversion parameters.

Definition at line 73 of file KLMDatabaseImporter.cc.

75{
76 DBImportObjPtr<KLMTimeConversion> timeConversionImport;
77 timeConversionImport.construct(*timeConversion);
80 timeConversionImport.import(iov);
81}

◆ importTimeWindow()

void importTimeWindow ( KLMTimeWindow timeWindow)

Import KLM time window parameters.

Parameters
[in]timeWindowTime window.

Definition at line 83 of file KLMDatabaseImporter.cc.

84{
85 DBImportObjPtr<KLMTimeWindow> timeWindowImport;
86 timeWindowImport.construct(*timeWindow);
89 timeWindowImport.import(iov);
90}

◆ loadStripEfficiency()

void loadStripEfficiency ( KLMStripEfficiency stripEfficiency,
std::string  fileName 
)

Load strip efficiencies.

Parameters
[out]stripEfficiencyStrip efficiency.
[in]fileNameName of the ROOT file containing the efficiencies.

Definition at line 92 of file KLMDatabaseImporter.cc.

94{
95 TFile* file = TFile::Open(fileName.c_str(), "r");
96 if (!file) {
97 B2ERROR("KLMDatabaseImporter: calibration file " << fileName << " *** failed to open");
98 } else {
99 TTree* tree = (TTree*)file->Get("tree");
100 if (!tree) {
101 B2ERROR("KLMDatabaseImporter: calibration file " << fileName << " *** no tree named 'tree' found");
102 file->Close();
103 } else {
104 int isBarrel = 0;
105 tree->SetBranchAddress("isBarrel", &isBarrel);
106 int section = 0;
107 tree->SetBranchAddress("isForward", &section);
108 int sector = 0;
109 tree->SetBranchAddress("sector", &sector);
110 int layer = 0;
111 tree->SetBranchAddress("layer", &layer);
112 int plane = 0;
113 tree->SetBranchAddress("plane", &plane);
114 int strip = 0;
115 tree->SetBranchAddress("strip", &strip);
116 float efficiency = 1.;
117 tree->SetBranchAddress("efficiency", &efficiency);
118 float efficiencyError = 0.;
119 tree->SetBranchAddress("efficiencyError", &efficiencyError);
120
121 for (int i = 0; i < tree->GetEntries(); i++) {
122 tree->GetEntry(i);
123 if (isBarrel)
124 stripEfficiency->setBarrelEfficiency(section, sector, layer, plane, strip, efficiency, efficiencyError);
125 else
126 stripEfficiency->setEndcapEfficiency(section, sector, layer, plane, strip, efficiency, efficiencyError);
127 }
128 }
129 file->Close();
130 }
131}
bool isBarrel(int cellId)
Check whether the crystal is in barrel ECL.

◆ setIOV()

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

Set interval of validity.

Definition at line 34 of file KLMDatabaseImporter.cc.

36{
37 m_ExperimentLow = experimentLow;
38 m_RunLow = runLow;
39 m_ExperimentHigh = experimentHigh;
40 m_RunHigh = runHigh;
41}

Member Data Documentation

◆ m_ExperimentHigh

int m_ExperimentHigh = -1
private

High experiment.

Definition at line 143 of file KLMDatabaseImporter.h.

◆ m_ExperimentLow

int m_ExperimentLow = 0
private

Low experiment.

Definition at line 137 of file KLMDatabaseImporter.h.

◆ m_RunHigh

int m_RunHigh = -1
private

High run.

Definition at line 146 of file KLMDatabaseImporter.h.

◆ m_RunLow

int m_RunLow = 0
private

Low run.

Definition at line 140 of file KLMDatabaseImporter.h.


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