@@ -59,6 +59,34 @@ class CPVNoiseCalibratorSpec : public o2::framework::Task
5959 void finaliseCCDB (o2::framework::ConcreteDataMatcher& matcher, void * obj) final
6060 {
6161 o2::base::GRPGeomHelper::instance ().finaliseCCDB (matcher, obj);
62+ if (matcher == framework::ConcreteDataMatcher (" CPV" , " CPV_PedEffs" , 0 )) {
63+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : accessing CPV/PedestalRun/ChannelEfficiencies" ;
64+ auto pedEffs = static_cast <std::vector<float >*>(obj);
65+ mCalibrator ->setPedEfficiencies (pedEffs);
66+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : I got pedestal efficiencies vetor of size " << pedEffs->size ();
67+ return ;
68+ }
69+ if (matcher == framework::ConcreteDataMatcher (" CPV" , " CPV_DeadChnls" , 0 )) {
70+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : accessing CPV/PedestalRun/DeadChannels" ;
71+ auto deadChs = static_cast <std::vector<int >*>(obj);
72+ mCalibrator ->setDeadChannels (deadChs);
73+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : I got dead channels vetor of size " << deadChs->size ();
74+ return ;
75+ }
76+ if (matcher == framework::ConcreteDataMatcher (" CPV" , " CPV_HighThrs" , 0 )) {
77+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : accessing CPV/PedestalRun/HighPedChannels" ;
78+ auto highPeds = static_cast <std::vector<int >*>(obj);
79+ mCalibrator ->setHighPedChannels (highPeds);
80+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : I got high pedestals vetor of size " << highPeds->size ();
81+ return ;
82+ }
83+ if (matcher == framework::ConcreteDataMatcher (" CPV" , " CPV_PersiBads" , 0 )) {
84+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : accessing CPV/Config/PersistentBadChannels" ;
85+ auto persBadChs = static_cast <std::vector<int >*>(obj);
86+ mCalibrator ->setPersistentBadChannels (persBadChs);
87+ LOG (info) << " NoiseCalibratorSpec::finaliseCCDB() : I got persistent bad channels vector of size " << persBadChs->size ();
88+ return ;
89+ }
6290 }
6391
6492 // _________________________________________________________________
@@ -68,9 +96,14 @@ class CPVNoiseCalibratorSpec : public o2::framework::Task
6896 o2::base::TFIDInfoHelper::fillTFIDInfo (pc, mCalibrator ->getCurrentTFInfo ());
6997 TFType tfcounter = mCalibrator ->getCurrentTFInfo ().startTime ;
7098
71- // update config
99+ // fetch ccdb objects
72100 static bool isConfigFetched = false ;
73101 if (!isConfigFetched) {
102+ pc.inputs ().get <std::vector<float >*>(" pedeffs" );
103+ pc.inputs ().get <std::vector<int >*>(" persbadchs" );
104+ pc.inputs ().get <std::vector<int >*>(" deadchs" );
105+ pc.inputs ().get <std::vector<int >*>(" highpeds" );
106+
74107 LOG (info) << " NoiseCalibratorSpec::run() : fetching o2::cpv::CPVCalibParams from CCDB" ;
75108 pc.inputs ().get <o2::cpv::CPVCalibParams*>(" calibparams" );
76109 LOG (info) << " NoiseCalibratorSpec::run() : o2::cpv::CPVCalibParams::Instance() now is following:" ;
@@ -79,32 +112,6 @@ class CPVNoiseCalibratorSpec : public o2::framework::Task
79112 isConfigFetched = true ;
80113 }
81114
82- // read pedestal efficiencies, dead and high ped channels from pedestal run
83- // do it only once as they don't change during noise scan
84- if (!mCalibrator ->isSettedPedEfficiencies ()) {
85- const auto pedEffs = pc.inputs ().get <std::vector<float >*>(" pedeffs" );
86- if (pedEffs) {
87- mCalibrator ->setPedEfficiencies (new std::vector<float >(pedEffs->begin (), pedEffs->end ()));
88- LOG (info) << " NoiseCalibratorSpec()::run() : I got pedestal efficiencies vetor of size " << pedEffs->size ();
89- }
90- }
91- if (!mCalibrator ->isSettedDeadChannels ()) {
92- // const auto deadChs = o2::framework::DataRefUtils::as<CCDBSerialized<std::vector<int>>>(pc.inputs().get("deadchs"));
93- const auto deadChs = pc.inputs ().get <std::vector<int >*>(" deadchs" );
94- if (deadChs) {
95- mCalibrator ->setDeadChannels (new std::vector<int >(deadChs->begin (), deadChs->end ()));
96- LOG (info) << " NoiseCalibratorSpec()::run() : I got dead channels vetor of size " << deadChs->size ();
97- }
98- }
99- if (!mCalibrator ->isSettedHighPedChannels ()) {
100- // const auto highPeds = o2::framework::DataRefUtils::as<CCDBSerialized<std::vector<int>>>(pc.inputs().get("highpeds"));
101- const auto highPeds = pc.inputs ().get <std::vector<int >*>(" highpeds" );
102- if (highPeds) {
103- mCalibrator ->setHighPedChannels (new std::vector<int >(highPeds->begin (), highPeds->end ()));
104- LOG (info) << " NoiseCalibratorSpec()::run() : I got high pedestal channels vetor of size " << highPeds->size ();
105- }
106- }
107-
108115 // process data
109116 auto && digits = pc.inputs ().get <gsl::span<o2::cpv::Digit>>(" digits" );
110117 auto && trigrecs = pc.inputs ().get <gsl::span<o2::cpv::TriggerRecord>>(" trigrecs" );
@@ -147,6 +154,9 @@ class CPVNoiseCalibratorSpec : public o2::framework::Task
147154 auto && infoVec = mCalibrator ->getCcdbInfoBadChannelMapVector (); // use non-const version as we update it
148155
149156 assert (payloadVec.size () == infoVec.size ());
157+ if (payloadVec.size () == 0 ) { // don't need to do anything if there is nothing to send
158+ return ;
159+ }
150160
151161 for (uint32_t i = 0 ; i < payloadVec.size (); i++) {
152162 auto & w = infoVec[i];
@@ -174,6 +184,8 @@ DataProcessorSpec getCPVNoiseCalibratorSpec()
174184 inputs.emplace_back (" deadchs" , " CPV" , " CPV_DeadChnls" , 0 , Lifetime::Condition, ccdbParamSpec (" CPV/PedestalRun/DeadChannels" ));
175185 inputs.emplace_back (" highpeds" , " CPV" , " CPV_HighThrs" , 0 , Lifetime::Condition, ccdbParamSpec (" CPV/PedestalRun/HighPedChannels" ));
176186 inputs.emplace_back (" calibparams" , " CPV" , " CPV_CalibPars" , 0 , Lifetime::Condition, ccdbParamSpec (" CPV/Config/CPVCalibParams" ));
187+ inputs.emplace_back (" persbadchs" , " CPV" , " CPV_PersiBads" , 0 , Lifetime::Condition, ccdbParamSpec (" CPV/Config/PersistentBadChannels" ));
188+
177189 auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(true , // orbitResetTime
178190 true , // GRPECS=true
179191 false , // GRPLHCIF
0 commit comments