Skip to content

Commit 2fe9230

Browse files
mvishiu11andreasmolander
authored andcommitted
feat: BC-based approach to ref channel fitting
1 parent e59797d commit 2fe9230

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

Modules/FIT/FT0/etc/ft0-aging-laser-postproc.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"query": "digits:FT0/DIGITSBC/0;channels:FT0/DIGITSCH/0"
2323
},
2424
"taskParameters": {
25-
"referenceChannelIDs": "208,209,210",
25+
"referenceChannelIDs": "208,209,210,211",
2626
"laserTriggerBCs": "0,1783",
2727
"detectorBCdelay": "131",
28-
"referencePeak1BCdelays": "115,115,115",
29-
"referencePeak2BCdelays": "136,142,135",
28+
"referencePeak1BCdelays": "115,115,115,115",
29+
"referencePeak2BCdelays": "136,142,135,141",
3030
"debug": "false"
3131
}
3232
}
@@ -42,8 +42,6 @@
4242
"default": {
4343
"default": {
4444
"agingTaskSourcePath": "FT0/MO/AgingLaser",
45-
"refPeakWindowMin": "150",
46-
"refPeakWindowMax": "600",
4745
"fracWindowLow": "0.30",
4846
"fracWindowHigh": "0.30",
4947
"ignoreDetectorChannels": "",

Modules/FIT/FT0/include/FT0/AgingLaserPostProcTask.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class AgingLaserPostProcTask final : public quality_control::postprocessing::Pos
5252
std::vector<uint8_t> mDetectorChIDs; ///< Detector (target) channels
5353
std::vector<uint8_t> mReferenceChIDs; ///< Reference channels
5454

55-
double mADCSearchMin = 150.; ///< lower edge of peak-search window (ADC) for ref channels
56-
double mADCSearchMax = 600.; ///< upper edge of peak-search window (ADC) for ref channels
5755
double mFracWindowA = 0.25; ///< low fractional window parameter a
5856
double mFracWindowB = 0.25; ///< high fractional window parameter b
5957

Modules/FIT/FT0/src/AgingLaserPostProcTask.cxx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ void AgingLaserPostProcTask::configure(const boost::property_tree::ptree& cfg)
6666
}
6767
}
6868

69-
mADCSearchMin = o2::quality_control_modules::common::getFromConfig<double>(mCustomParameters, "refPeakWindowMin", mADCSearchMin);
70-
mADCSearchMax = o2::quality_control_modules::common::getFromConfig<double>(mCustomParameters, "refPeakWindowMax", mADCSearchMax);
7169
mFracWindowA = o2::quality_control_modules::common::getFromConfig<double>(mCustomParameters, "fracWindowLow", mFracWindowA);
7270
mFracWindowB = o2::quality_control_modules::common::getFromConfig<double>(mCustomParameters, "fracWindowHigh", mFracWindowB);
7371
}
@@ -77,7 +75,6 @@ void AgingLaserPostProcTask::initialize(Trigger, framework::ServiceRegistryRef)
7775
ILOG(Debug, Devel) << "initialize AgingLaserPostProcTask" << ENDM;
7876

7977
ILOG(Debug, Devel) << "agingTaskSourcePath : " << mAmpMoPath << ENDM;
80-
ILOG(Debug, Devel) << "ADC search window : [" << mADCSearchMin << ", " << mADCSearchMax << "]" << ENDM;
8178
ILOG(Debug, Devel) << "fractional window : a=" << mFracWindowA << " b=" << mFracWindowB << ENDM;
8279

8380
mAmpVsChNormWeightedMeanA = fit::helper::registerHist<TH1F>(
@@ -101,30 +98,44 @@ void AgingLaserPostProcTask::update(Trigger t, framework::ServiceRegistryRef srv
10198
/* ---- fetch source histogram ---- */
10299
auto& qcdb = srv.get<quality_control::repository::DatabaseInterface>();
103100
auto moIn = qcdb.retrieveMO(mAmpMoPath, "AmpPerChannel", t.timestamp, t.activity);
101+
auto moIn0 = qcdb.retrieveMO(mAmpMoPath, "AmpPerChannelPeak1ADC0", t.timestamp, t.activity);
102+
auto moIn1 = qcdb.retrieveMO(mAmpMoPath, "AmpPerChannelPeak1ADC1", t.timestamp, t.activity);
104103
TH2* h2amp = moIn ? dynamic_cast<TH2*>(moIn->getObject()) : nullptr;
104+
TH2* h2amp0 = moIn0 ? dynamic_cast<TH2*>(moIn0->getObject()) : nullptr;
105+
TH2* h2amp1 = moIn1 ? dynamic_cast<TH2*>(moIn1->getObject()) : nullptr;
106+
TH2* h2ampMerged = nullptr;
107+
if (h2amp0 && h2amp1) {
108+
h2ampMerged = new TH2F("h2ampMerged", "h2ampMerged", 96, 0, 96, 112, 96, 208);
109+
h2ampMerged->Add(h2amp0);
110+
h2ampMerged->Add(h2amp1);
111+
}
105112

106113
if (!h2amp) {
107114
ILOG(Error) << "Could not retrieve " << mAmpMoPath << "/AmpPerChannel for timestamp "
108115
<< t.timestamp << ENDM;
109116
return;
110117
}
111118

119+
if (!h2amp0 || !h2amp1) {
120+
ILOG(Error) << "Could not retrieve " << mAmpMoPath << "/AmpPerChannelPeak1ADC0 or " << mAmpMoPath << "/AmpPerChannelPeak1ADC1 for timestamp "
121+
<< t.timestamp << ENDM;
122+
return;
123+
}
124+
125+
if (!h2ampMerged) {
126+
ILOG(Error) << "Could not create merged histogram from " << mAmpMoPath << "/AmpPerChannelPeak1ADC0 and " << mAmpMoPath << "/AmpPerChannelPeak1ADC1 for timestamp "
127+
<< t.timestamp << ENDM;
128+
return;
129+
}
130+
112131
/* ---- 1. Reference-channel Gaussian fits ---- */
113132
std::vector<double> refMus;
114133

115134
for (auto chId : mReferenceChIDs) {
116-
auto h1 = std::unique_ptr<TH1>(h2amp->ProjectionY(
135+
auto h1 = std::unique_ptr<TH1>(h2ampMerged->ProjectionY(
117136
Form("ref_%d", chId), chId + 1, chId + 1));
118137

119-
const int binLow = h1->FindBin(mADCSearchMin);
120-
const int binHigh = h1->FindBin(mADCSearchMax);
121-
122-
int binMax = binLow;
123-
for (int b = binLow + 1; b <= binHigh; ++b) {
124-
if (h1->GetBinContent(b) > h1->GetBinContent(binMax)) {
125-
binMax = b;
126-
}
127-
}
138+
int binMax = h1->GetMaximumBin();
128139
const double xMax = h1->GetBinCenter(binMax);
129140
const double winLo = TMath::Max(0., (1. - mFracWindowA) * xMax);
130141
const double winHi = (1. + mFracWindowB) * xMax;

0 commit comments

Comments
 (0)