Skip to content

Commit b9dbcf0

Browse files
peressounkoDmitri Peresunko
andauthored
Validity range fix; debug info added (#8430)
* ccdb path fixed * Validity range fix; debug info added Co-authored-by: Dmitri Peresunko <Dmitri.Peresunko@cern.ch>
1 parent 08591bf commit b9dbcf0

File tree

10 files changed

+48
-19
lines changed

10 files changed

+48
-19
lines changed

DataFormats/Detectors/PHOS/include/DataFormatsPHOS/Cluster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Cluster
6363
void setDispersion(float d) { mDispersion = d; }
6464

6565
float getDistanceToBadChannel() const { return mDistToBadChannel; }
66-
void getElipsAxis(float lambdaShort, float lambdaLong) const
66+
void getElipsAxis(float& lambdaShort, float& lambdaLong) const
6767
{
6868
lambdaShort = mLambdaShort;
6969
lambdaLong = mLambdaLong;

Detectors/PHOS/calib/src/PHOSBadMapCalibDevice.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ void PHOSBadMapCalibDevice::sendOutput(DataAllocator& output)
135135
std::string flName = o2::ccdb::CcdbApi::generateFileName("BadMap");
136136
std::string kind;
137137
if (mMode == 0) { // Occupancy
138-
kind = "PHS/Calib/BadMapOcc";
138+
kind = "PHS/BadMap/Occ";
139139
}
140140
if (mMode == 1) { // Chi2
141-
kind = "PHS/Calib/BadMapChi";
141+
kind = "PHS/BadMap/Chi";
142142
}
143143
if (mMode == 2) { // Pedestals
144-
kind = "PHS/Calib/BadMapPed";
144+
kind = "PHS/BadMap/Ped";
145145
}
146146
std::map<std::string, std::string> md;
147147
o2::ccdb::CcdbObjectInfo info(kind, "BadMap", flName, md, mRunStartTime, mValidityTime);

Detectors/PHOS/calib/src/PHOSHGLGRatioCalibDevice.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ void PHOSHGLGRatioCalibDevice::run(o2::framework::ProcessingContext& ctx)
4545

4646
// scan Cells stream, collect HG/LG pairs
4747
if (mRunStartTime == 0) {
48-
mRunStartTime = o2::header::get<o2::framework::DataProcessingHeader*>(ctx.inputs().get("cellTriggerRecords").header)->startTime;
48+
const auto ref = ctx.inputs().getFirstValid(true);
49+
mRunStartTime = DataRefUtils::getHeader<DataProcessingHeader*>(ref)->creation; // approximate time in ms
4950
}
5051

5152
if (mStatistics <= 0) { // skip the rest of the run

Detectors/PHOS/calib/src/PHOSPedestalCalibDevice.cxx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ void PHOSPedestalCalibDevice::init(o2::framework::InitContext& ic)
3232
{
3333

3434
mStatistics = ic.options().get<int>("statistics"); // desired number of events
35-
35+
LOG(info) << "PHOS pedestal init: will collect " << mStatistics << " events";
36+
LOG(info) << "mUseCCDB (try to get current object) = " << mUseCCDB;
37+
LOG(info) << "mForceUpdate (update CCDB anyway) =" << mForceUpdate;
3638
// Create histograms for mean and RMS
3739
short n = o2::phos::Mapping::NCHANNELS - 1792;
3840
mMeanHG.reset(new TH2F("MeanHighGain", "MeanHighGain", n, 1792.5, n + 1792.5, 100, 0., 100.));
@@ -43,14 +45,19 @@ void PHOSPedestalCalibDevice::init(o2::framework::InitContext& ic)
4345

4446
void PHOSPedestalCalibDevice::run(o2::framework::ProcessingContext& ctx)
4547
{
46-
// scan Cells stream, collect mean and RMS then calculateaverage and post
48+
// scan Cells stream, collect mean and RMS then calculate average and post
49+
4750
if (mRunStartTime == 0) {
48-
mRunStartTime = o2::header::get<o2::framework::DataProcessingHeader*>(ctx.inputs().get("cellTriggerRecords").header)->startTime;
51+
const auto ref = ctx.inputs().getFirstValid(true);
52+
mRunStartTime = DataRefUtils::getHeader<DataProcessingHeader*>(ref)->creation; // approximate time in ms
4953
}
5054

5155
if (mStatistics <= 0) { // skip the rest of the run
5256
return;
5357
}
58+
if (mStatistics % 100 == 0) {
59+
LOG(info) << mStatistics << " left to produce calibration";
60+
}
5461
auto cells = ctx.inputs().get<gsl::span<o2::phos::Cell>>("cells");
5562
LOG(debug) << "[PHOSPedestalCalibDevice - run] Received " << cells.size() << " cells, running calibration ...";
5663
auto cellsTR = ctx.inputs().get<gsl::span<o2::phos::TriggerRecord>>("cellTriggerRecords");
@@ -70,6 +77,7 @@ void PHOSPedestalCalibDevice::run(o2::framework::ProcessingContext& ctx)
7077
--mStatistics;
7178
}
7279
if (mStatistics <= 0) {
80+
LOG(info) << "Start calculating pedestals";
7381
calculatePedestals();
7482
checkPedestals();
7583
sendOutput(ctx.outputs());
@@ -107,6 +115,19 @@ void PHOSPedestalCalibDevice::sendOutput(DataAllocator& output)
107115
header::DataHeader::SubSpecificationType subSpec{(header::DataHeader::SubSpecificationType)0};
108116
output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "PHOS_Pedestal", subSpec}, *image.get());
109117
output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, "PHOS_Pedestal", subSpec}, info);
118+
// Now same for DCS as vector
119+
std::vector<short> dcsPedestals(2 * (o2::phos::Mapping::NCHANNELS - 1792));
120+
// copy HG then LG pedestals
121+
for (short absId = 1793; absId <= o2::phos::Mapping::NCHANNELS; absId++) {
122+
dcsPedestals.emplace_back(mPedestals->getHGPedestal(absId));
123+
}
124+
for (short absId = 1793; absId <= o2::phos::Mapping::NCHANNELS; absId++) {
125+
dcsPedestals.emplace_back(mPedestals->getLGPedestal(absId));
126+
}
127+
auto imageDCS = o2::ccdb::CcdbApi::createObjectImage(&dcsPedestals, &info);
128+
header::DataHeader::SubSpecificationType subSpec1{(header::DataHeader::SubSpecificationType)1};
129+
output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBPayload, "PHOS_Pedestal", subSpec1}, *imageDCS.get());
130+
output.snapshot(Output{o2::calibration::Utils::gDataOriginCDBWrapper, "PHOS_Pedestal", subSpec1}, info);
110131
}
111132
// Anyway send change to QC
112133
LOG(info) << "[PHOSPedestalCalibDevice - run] Sending QC ";
@@ -137,6 +158,7 @@ void PHOSPedestalCalibDevice::calculatePedestals()
137158
mPedestals->setLGRMS(cellId, a);
138159
pr->Delete();
139160
}
161+
LOG(info) << "Pedestals calculated";
140162
}
141163

142164
void PHOSPedestalCalibDevice::checkPedestals()

Detectors/PHOS/calib/src/PHOSRunbyrunCalibDevice.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ void PHOSRunbyrunCalibDevice::init(o2::framework::InitContext& ic)
3232
}
3333
void PHOSRunbyrunCalibDevice::run(o2::framework::ProcessingContext& pc)
3434
{
35+
if (mRunStartTime == 0) {
36+
const auto ref = pc.inputs().getFirstValid(true);
37+
mRunStartTime = DataRefUtils::getHeader<DataProcessingHeader*>(ref)->creation; // approximate time in ms
38+
}
3539
auto tfcounter = o2::header::get<o2::framework::DataProcessingHeader*>(pc.inputs().get("clusters").header)->startTime; // is this the timestamp of the current TF?
3640
auto clusters = pc.inputs().get<gsl::span<Cluster>>("clusters");
3741
auto cluTR = pc.inputs().get<gsl::span<TriggerRecord>>("cluTR");
@@ -68,10 +72,10 @@ void PHOSRunbyrunCalibDevice::endOfStream(o2::framework::EndOfStreamContext& ec)
6872
<< mRunByRun[4] << "+-" << mRunByRun[5] << ", "
6973
<< mRunByRun[6] << "+-" << mRunByRun[7];
7074
}
71-
//TODO! Send mRunByRun for QC and trending plots
75+
// TODO! Send mRunByRun for QC and trending plots
7276
//
7377

74-
//Get ready for next run
78+
// Get ready for next run
7579
mCalibrator->initOutput(); // reset the outputs once they are already sent
7680
}
7781
bool PHOSRunbyrunCalibDevice::checkFitResult()

Detectors/PHOS/calib/src/PHOSRunbyrunCalibrator.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void PHOSRunbyrunSlot::fill(const gsl::span<const Cluster>& clusters, const gsl:
6868
auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance();
6969
ccdbManager.setURL(o2::base::NameConf::getCCDBServer());
7070
LOG(info) << " set-up CCDB " << o2::base::NameConf::getCCDBServer();
71-
mBadMap = std::make_unique<o2::phos::BadChannelsMap>(*(ccdbManager.get<o2::phos::BadChannelsMap>("PHS/BadMap")));
71+
mBadMap = std::make_unique<o2::phos::BadChannelsMap>(*(ccdbManager.get<o2::phos::BadChannelsMap>("PHS/Calib/BadMap")));
7272

7373
if (!mBadMap) { // was not read from CCDB, but expected
7474
LOG(fatal) << "Can not read BadMap from CCDB, you may use --not-use-ccdb option to create default bad map";
@@ -287,4 +287,4 @@ double PHOSRunbyrunCalibrator::CBSignal(double* x, double* par)
287287
double PHOSRunbyrunCalibrator::bg(double* x, double* par)
288288
{
289289
return par[0] + par[1] * x[0] + par[2] * x[0] * x[0];
290-
}
290+
}

Detectors/PHOS/reconstruction/src/Clusterer.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ void Clusterer::processCells(gsl::span<const Cell> cells, gsl::span<const Trigge
131131
x, z, i, 1.);
132132
}
133133
mLastElementInEvent = cluelements.size();
134-
135134
makeClusters(clusters, cluelements);
136-
137-
LOG(debug) << "Found clusters from " << indexStart << " to " << clusters.size();
138135
trigRec.emplace_back(tr.getBCData(), indexStart, clusters.size() - indexStart);
139136
}
140137
if (mProcessMC) {
@@ -148,6 +145,7 @@ void Clusterer::makeClusters(std::vector<Cluster>& clusters, std::vector<CluElem
148145
// Cluster contains first and (next-to) last index of the combined list of clusterelements, so
149146
// add elements to final list and mark element in internal list as used (zero energy)
150147

148+
LOG(debug) << "makeClusters: clusters size=" << clusters.size() << " elements=" << cluelements.size();
151149
int iFirst = 0; // first index of digit which potentially can be a part of cluster
152150
int n = mCluEl.size();
153151
for (int i = iFirst; i < n; i++) {
@@ -202,6 +200,7 @@ void Clusterer::makeClusters(std::vector<Cluster>& clusters, std::vector<CluElem
202200
}
203201
} // loop over cluster
204202
clu->setLastCluEl(cluelements.size());
203+
LOG(debug) << "Cluster: elements from " << clu->getFirstCluEl() << " last=" << cluelements.size();
205204

206205
// Unfold overlapped clusters
207206
// Split clusters with several local maxima if necessary
@@ -627,10 +626,12 @@ char Clusterer::getNumberOfLocalMax(Cluster& clu, std::vector<CluElement>& cluel
627626
mIsLocalMax.reserve(clu.getMultiplicity());
628627

629628
uint32_t iFirst = clu.getFirstCluEl(), iLast = clu.getLastCluEl();
629+
LOG(debug) << "getNumberOfLocalMax: iFirst=" << iFirst << " iLast=" << iLast << " elements=" << cluel.size();
630630
for (uint32_t i = iFirst; i < iLast; i++) {
631631
mIsLocalMax.push_back(cluel[i].energy > cluSeed);
632632
}
633633

634+
LOG(debug) << "mIsLocalMax size=" << mIsLocalMax.size();
634635
for (uint32_t i = iFirst; i < iLast - 1; i++) {
635636
for (int j = i + 1; j < iLast; j++) {
636637

@@ -652,6 +653,7 @@ char Clusterer::getNumberOfLocalMax(Cluster& clu, std::vector<CluElement>& cluel
652653
} // digit j
653654
} // digit i
654655

656+
LOG(debug) << " Filled mIsLocalMax";
655657
int iDigitN = 0;
656658
for (int i = 0; i < mIsLocalMax.size(); i++) {
657659
if (mIsLocalMax[i]) {

Detectors/PHOS/workflow/src/CellConverterSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void CellConverterSpec::run(framework::ProcessingContext& ctx)
7575
auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance();
7676
ccdbManager.setURL(o2::base::NameConf::getCCDBServer());
7777
LOG(info) << " set-up CCDB " << o2::base::NameConf::getCCDBServer();
78-
mBadMap = ccdbManager.get<o2::phos::BadChannelsMap>("PHS/BadMap");
78+
mBadMap = ccdbManager.get<o2::phos::BadChannelsMap>("PHS/Calib/BadMap");
7979
if (!mBadMap) {
8080
LOG(fatal) << "[PHOSCellConverter - run] can not get Bad Map";
8181
}

Detectors/PHOS/workflow/src/ClusterizerSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ void ClusterizerSpec::init(framework::InitContext& ctx)
4343
ccdbManager.setURL(o2::base::NameConf::getCCDBServer());
4444
LOG(info) << " set-up CCDB " << o2::base::NameConf::getCCDBServer();
4545

46-
BadChannelsMap* badMap = ccdbManager.get<o2::phos::BadChannelsMap>("PHS/BadMap");
47-
CalibParams* calibParams = ccdbManager.get<o2::phos::CalibParams>("PHS/Calib");
46+
BadChannelsMap* badMap = ccdbManager.get<o2::phos::BadChannelsMap>("PHS/Calib/BadMap");
47+
CalibParams* calibParams = ccdbManager.get<o2::phos::CalibParams>("PHS/Calib/CalibParams");
4848
if (badMap) {
4949
mClusterizer.setBadMap(badMap);
5050
} else {

Detectors/PHOS/workflow/src/StandaloneAODProducerSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
9191
c.getEnergy(), // lnAmplitude (dummy value)
9292
(c.getType() == TRU2x2) ? 0 : 1, // triggerBits 0:L0 2x2, 1: L1 4x4
9393
0); // caloType 0: PHOS
94-
continue;
9594
}
9695

96+
// TODO: should bad map be applied here? Unrecoverable loss of channels: special loose map?
9797
// short absId = c.getAbsId();
9898
// if (isBadChannel(absId)) {
9999
// continue;

0 commit comments

Comments
 (0)