Skip to content

Commit

Permalink
Merge pull request #1 from alibuild/alibot-cleanup-13356
Browse files Browse the repository at this point in the history
Please consider the following formatting changes to AliceO2Group#13356
  • Loading branch information
nivram-phy authored Aug 8, 2024
2 parents 25a75e6 + d07ffba commit e3dd57f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ class NoiseMap
while (chipID--) {
const auto& map = mNoisyPixels[chipID];
for (const auto& pair : map) {
if (pair.second <= t) {
if (pair.second <= t) {
continue;
}
}
n++;
auto key = pair.first;
auto row = key2Row(key);
auto col = key2Col(key);
std::cout << "chip, row, col, noise: " << chipID << ' ' << row << ' ' << col << ' ' << pair.second << '\n';
std::cout << "chip, row, col, noise: " << chipID << ' ' << row << ' ' << col << ' ' << pair.second << '\n';
}
}
return n;
Expand Down Expand Up @@ -202,29 +202,28 @@ class NoiseMap
return std::ceil((1. + 1. / t) / (relErr * relErr));
}

NoiseMap merge(NoiseMap* prev){
int incre=0;
for (size_t i = 0; i < (int)mNoisyPixels.size(); ++i) { //920 is the total number of chips in MFT
for (const auto& prev_np : prev->mNoisyPixels[i]) { //only enters this for loop if the "i" chip exists.
bool existsInCurrentMap = false;
for (const auto& current_np : mNoisyPixels[i]) {
if(prev_np.first==current_np.first)
{
existsInCurrentMap = true;
break;
}
}//end of for loop on elements of previous noise map

if (!existsInCurrentMap) {
incre++;
mNoisyPixels[i][prev_np.first] = prev_np.second;
}
}//end of for loop on elements of previous noise map
}//end of for loop on i (chip ID)
return(mNoisyPixels);
}//end of void merge


NoiseMap merge(NoiseMap* prev)
{
int incre = 0;
for (size_t i = 0; i < (int)mNoisyPixels.size(); ++i) { // 920 is the total number of chips in MFT
for (const auto& prev_np : prev->mNoisyPixels[i]) { // only enters this for loop if the "i" chip exists.
bool existsInCurrentMap = false;
for (const auto& current_np : mNoisyPixels[i]) {
if (prev_np.first == current_np.first) {
existsInCurrentMap = true;
break;
}
} // end of for loop on elements of previous noise map

if (!existsInCurrentMap) {
incre++;
mNoisyPixels[i][prev_np.first] = prev_np.second;
}
} // end of for loop on elements of previous noise map
} // end of for loop on i (chip ID)
return (mNoisyPixels);
} // end of void merge

size_t size() const { return mNoisyPixels.size(); }
void setNumOfStrobes(long n) { mNumOfStrobes = n; }
void addStrobes(long n) { mNumOfStrobes += n; }
Expand Down
39 changes: 19 additions & 20 deletions Detectors/ITSMFT/MFT/calibration/src/NoiseCalibratorSpec.cxx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//AA Copyright 2019-2020 CERN and copyright holders of ALICE O2.A
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
// AA Copyright 2019-2020 CERN and copyright holders of ALICE O2.A
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// @file NoiseCalibratorSpec.cxx

Expand Down Expand Up @@ -49,7 +49,7 @@ void NoiseCalibratorSpec::init(InitContext& ic)
mStopMeOnly = ic.options().get<bool>("stop-me-only");
mPath = ic.options().get<std::string>("path-CCDB");
mPathMerge = ic.options().get<std::string>("path-CCDB-merge");

mMeta = ic.options().get<std::string>("meta");
mStart = ic.options().get<int64_t>("tstart");
mEnd = ic.options().get<int64_t>("tend");
Expand All @@ -75,7 +75,7 @@ void NoiseCalibratorSpec::run(ProcessingContext& pc)
if (mOutputType.compare("CCDB") == 0) {
LOG(info) << "Sending an object to Production-CCDB";
sendOutputCcdb(pc.outputs());
LOG(info) << "Sending an object to Production-CCDBMerge";
LOG(info) << "Sending an object to Production-CCDBMerge";
sendOutputCcdbMerge(pc.outputs());
} else if (mOutputType.compare("DCS") == 0) {
LOG(info) << "Sending an object to DCS-CCDB";
Expand All @@ -97,7 +97,7 @@ void NoiseCalibratorSpec::run(ProcessingContext& pc)
if (mOutputType.compare("CCDB") == 0) {
LOG(info) << "Sending an object to Production-CCDB";
sendOutputCcdb(pc.outputs());
LOG(info) << "Sending an object to Production-CCDBMerge";
LOG(info) << "Sending an object to Production-CCDBMerge";
sendOutputCcdbMerge(pc.outputs());
} else if (mOutputType.compare("DCS") == 0) {
LOG(info) << "Sending an object to DCS-CCDB";
Expand Down Expand Up @@ -168,7 +168,7 @@ void NoiseCalibratorSpec::sendOutputCcdbDcs(DataAllocator& output)

const auto& payload = mCalibrator->getNoiseMap();
// const auto& payload = mCalibrator->getNoiseMap(starTF, endTF); //For TimeSlot calibration

o2::ccdb::CcdbObjectInfo info(mPath, "NoiseMap", "noise.root", meta, tstart, tend);
auto flName = o2::ccdb::CcdbApi::generateFileName("noise");
auto image = o2::ccdb::CcdbApi::createObjectImage(&payload, &info);
Expand All @@ -182,7 +182,6 @@ void NoiseCalibratorSpec::sendOutputCcdbDcs(DataAllocator& output)
output.snapshot(Output{clbUtils::gDataOriginCDBPayload, "MFT_NoiseMap", 0}, *image.get());
output.snapshot(Output{clbUtils::gDataOriginCDBWrapper, "MFT_NoiseMap", 0}, info);


setOutputDcs(payload);

o2::ccdb::CcdbObjectInfo infoDcs(mPathDcs, "NoiseMap", "noise.root", meta, tstart, tend);
Expand Down Expand Up @@ -298,13 +297,13 @@ void NoiseCalibratorSpec::sendOutputCcdbMerge(DataAllocator& output)
// const auto& payload = mCalibrator->getNoiseMap(starTF, endTF); //For TimeSlot calibration
map<string, string> headers;
map<std::string, std::string> filter;
auto *payloadPrev1 = api.retrieveFromTFileAny<o2::itsmft::NoiseMap>(mPath, filter,-1, &headers);
auto* payloadPrev1 = api.retrieveFromTFileAny<o2::itsmft::NoiseMap>(mPath, filter, -1, &headers);
long validtime = std::stol(headers["Valid-From"]);
validtime=validtime-60;
auto *payloadPrev2 = api.retrieveFromTFileAny<o2::itsmft::NoiseMap>(mPath, filter,validtime, &headers);
auto bufferPL= payloadPrev2->merge(payloadPrev1);
auto mergedPL= payload.merge(&bufferPL);
//payload.merge(payloadPrev);
validtime = validtime - 60;
auto* payloadPrev2 = api.retrieveFromTFileAny<o2::itsmft::NoiseMap>(mPath, filter, validtime, &headers);
auto bufferPL = payloadPrev2->merge(payloadPrev1);
auto mergedPL = payload.merge(&bufferPL);
// payload.merge(payloadPrev);
o2::ccdb::CcdbObjectInfo info(mPathMerge, "NoiseMap", "noise.root", meta, tstart, tend);
auto flName = o2::ccdb::CcdbApi::generateFileName("noise");
auto image = o2::ccdb::CcdbApi::createObjectImage(&mergedPL, &info);
Expand Down Expand Up @@ -360,7 +359,7 @@ void NoiseCalibratorSpec::sendOutputDcs(DataAllocator& output)

const auto& payload = mCalibrator->getNoiseMap();
// const auto& payload = mCalibrator->getNoiseMap(starTF, endTF); //For TimeSlot calibration

setOutputDcs(payload);

o2::ccdb::CcdbObjectInfo infoDcs(mPathDcs, "NoiseMap", "noise.root", meta, tstart, tend);
Expand Down

0 comments on commit e3dd57f

Please sign in to comment.