7 ReadMapFromDB(period,
run);
11BmnStatus BmnDchRaw2Digit::ReadMapFromDB(Int_t period, Int_t
run)
14 for (
size_t i = 0;
i < fMap1.size();
i++)
19 for (
size_t i = 0;
i < fMap2.size();
i++)
24 LOG(info) <<
"Loading the DCH Map from DB: Period " << period <<
", Run " <<
run <<
"...";
28 if (pDetectorParameter1 != NULL)
29 pDetectorParameter1->
GetValue(fMap1);
32 if (pDetectorParameter2 != NULL)
33 pDetectorParameter2->
GetValue(fMap2);
34 delete pDetectorParameter1;
35 delete pDetectorParameter2;
40BmnStatus BmnDchRaw2Digit::ReadMapFromFile(Int_t period)
43 TString fileName = Form(
"DCH_map_Run%d.txt", period);
44 TString path = TString(getenv(
"VMCWORKDIR")) +
"/input/" + fileName;
72 ifstream inFile(path.Data());
73 if (!inFile.is_open())
74 cout <<
"Error opening map-file (" << path <<
")!" << endl;
75 inFile >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy;
77 while (!inFile.eof()) {
78 inFile >>
name >> group >> std::hex >> ser >> std::dec >> slot >> ch_l >> ch_h;
81 for (Int_t planeId = 0; planeId < 16; ++planeId) {
82 if (name != planes[planeId])
87 if (planeId / 8 == 0) {
89 pCurValue->
plane = planeId;
90 pCurValue->
group = group;
91 pCurValue->
crate = ser;
92 pCurValue->
slot = slot;
95 fMap1.push_back(pCurValue);
98 pCurValue->
plane = planeId;
99 pCurValue->
group = group;
100 pCurValue->
crate = ser;
101 pCurValue->
slot = slot;
104 fMap2.push_back(pCurValue);
115 for (Int_t
i = 0;
i < tdc->GetEntriesFast();
i++) {
120 Long64_t timeShift = (it != ts->end()) ? it->second : 0;
121 if (FindInMap(digit, dch, timeShift, t0, 1) ==
kBMNERROR)
122 FindInMap(digit, dch, timeShift, t0, 2);
126Int_t BmnDchRaw2Digit::GetChTDC64v(UInt_t tdc, UInt_t ch)
130 const Int_t tdc64v_tdcch2ch[2][32] = {{31, 15, 30, 14, 13, 29, 28, 12, 11, 27, 26, 10, 25, 9, 24, 8,
131 23, 7, 22, 6, 21, 5, 20, 4, 19, 3, 18, 2, 17, 1, 16, 0},
132 {31, 15, 30, 14, 29, 13, 28, 12, 27, 11, 26, 10, 25, 9, 24, 8,
133 23, 7, 22, 6, 21, 5, 20, 4, 19, 3, 18, 2, 17, 1, 16, 0}};
134 Int_t
val = tdc64v_tdcch2ch[tdc - 1][ch];
140BmnStatus BmnDchRaw2Digit::FindInMap(
BmnTDCDigit* dig, TClonesArray* arr, Long64_t ts, Double_t t0, Int_t dchId)
142 vector<UniValue*> mapArr = (dchId == 1) ? fMap1 : fMap2;
143 Int_t nEntriesInMap = mapArr.size();
144 for (Int_t iMap = 0; iMap < nEntriesInMap; ++iMap) {
149 if ((
id < 1) || (
id > 2))
151 UInt_t ch = GetChTDC64v(
id, dig->
GetChannel());
154 Double_t tm = dig->
GetValue() / 10.0 - t0 + ts;
void FillEvent(TClonesArray *tdc, unordered_map< UInt_t, Long64_t > *ts, TClonesArray *dch, Double_t t0)
UChar_t GetHptdcId() const
UChar_t GetChannel() const
int GetValue(vector< UniValue * > ¶meter_value)
get value of detector parameter presented by an array
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database