@@ -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