Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#pragma link C++ class o2::itsmft::CTF + ;
#pragma link C++ class o2::ctf::EncodedBlocks < o2::itsmft::CTFHeader, 10, uint32_t> + ;

#pragma link C++ class std::map < unsigned long, std::vector < uint16_t>> + ;

#pragma link C++ function o2::itsmft::getROFData(const gsl::span <const o2::itsmft::Digit> tfdata) const;
#pragma link C++ function o2::itsmft::getROFData(const gsl::span <const o2::itsmft::Cluster> tfdata) const;
#pragma link C++ function o2::itsmft::getROFData(const gsl::span <const o2::itsmft::CompCluster> tfdata) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#pragma link C++ class o2::itsmft::ChipStat + ;
#pragma link C++ class std::map < unsigned long, std::pair < o2::itsmft::ClusterTopology, unsigned long>> + ;

#pragma link C++ class std::map < unsigned long, std::vector < uint16_t>> + ;

#pragma link C++ class o2::itsmft::ClustererParam < o2::detectors::DetID::ITS> + ;
#pragma link C++ class o2::itsmft::ClustererParam < o2::detectors::DetID::MFT> + ;
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::itsmft::ClustererParam < o2::detectors::DetID::ITS>> + ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <ITSMFTReconstruction/RawPixelDecoder.h> //o2::itsmft::RawPixelDecoder
#include "DetectorsCalibration/Utils.h"
#include "DetectorsCommonDataFormats/FileMetaData.h"
#include "DetectorsBase/GRPGeomHelper.h" //nicolo
#include "DetectorsBase/GRPGeomHelper.h"
#include "CCDB/CcdbApi.h"
#include "CommonUtils/MemFileHelper.h"

Expand Down Expand Up @@ -91,17 +91,17 @@ class ITSMFTDeadMapBuilder : public Task
std::string mObjectName;
std::string mLocalOutputDir;

std::string MAP_VERSION = "1"; // to change in case the encoding or the format change
std::string MAP_VERSION = "2"; // to change in case the encoding or the format change

std::vector<uint16_t>* mDeadMapTF = nullptr;
std::vector<uint16_t> mDeadMapTF{};

Long64_t mFirstOrbitTF = 0x0;
unsigned long mFirstOrbitTF = 0x0;

std::string mDataSource = "chipsstatus";

int mTFSampling = 1000;

TTree* mTreeObject = nullptr;
std::map<unsigned long, std::vector<uint16_t>> mMapObject{};

void finalizeOutput();
void PrepareOutputCcdb(DataAllocator& output);
Expand Down
34 changes: 15 additions & 19 deletions Detectors/ITSMFT/common/workflow/src/DeadMapBuilderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ ITSMFTDeadMapBuilder::ITSMFTDeadMapBuilder(std::string datasource, bool doMFT)
ITSMFTDeadMapBuilder::~ITSMFTDeadMapBuilder()
{
// Clear dynamic memory
delete mDeadMapTF;
delete mTreeObject;
return;
}

//////////////////////////////////////////////////////////////////////////////
Expand All @@ -52,11 +51,9 @@ void ITSMFTDeadMapBuilder::init(InitContext& ic)
N_CHIPS = o2::itsmft::ChipMappingITS::getNChips();
}

mDeadMapTF = new std::vector<uint16_t>{};
mDeadMapTF.clear();

mTreeObject = new TTree("ccdb_object", "ccdb_object");
mTreeObject->Branch("orbit", &mFirstOrbitTF);
mTreeObject->Branch("deadmap", &mDeadMapTF);
mMapObject.clear();

mTFSampling = ic.options().get<int>("tf-sampling");
mTFLength = ic.options().get<int>("tf-length");
Expand Down Expand Up @@ -95,13 +92,11 @@ void ITSMFTDeadMapBuilder::finalizeOutput()
if (mDoLocalOutput) {
std::string localoutfilename = mLocalOutputDir + "/" + mObjectName;
TFile outfile(localoutfilename.c_str(), "RECREATE");
outfile.cd();
mTreeObject->Write();
outfile.WriteObjectAny(&mMapObject, "std::map<unsigned long, std::vector<uint16_t>>", "ccdb_object");
outfile.Close();
}
return;

} // finalizeOutput
}

//////////////////////////////////////////////////////////////////////////////
// Main running function
Expand All @@ -120,14 +115,14 @@ void ITSMFTDeadMapBuilder::run(ProcessingContext& pc)

mFirstOrbitTF = pc.services().get<o2::framework::TimingInfo>().firstTForbit;

if ((Long64_t)(mFirstOrbitTF / mTFLength) % mTFSampling != 0) {
if ((unsigned long)(mFirstOrbitTF / mTFLength) % mTFSampling != 0) {
return;
}

mStepCounter++;
LOG(info) << "Processing step #" << mStepCounter << " out of " << mTFCounter << " TF received. First orbit " << mFirstOrbitTF;

mDeadMapTF->clear();
mDeadMapTF.clear();

std::vector<bool> ElementsStatus(getElementIDFromChip(N_CHIPS), false);

Expand Down Expand Up @@ -170,18 +165,18 @@ void ITSMFTDeadMapBuilder::run(ProcessingContext& pc)
bool previous_dead = (el > 0 && !ElementsStatus.at(el - 1));
bool next_dead = (el < ElementsStatus.size() - 1 && !ElementsStatus.at(el + 1));
if (!previous_dead && next_dead) {
mDeadMapTF->push_back(el | (uint16_t)(0x8000));
mDeadMapTF.push_back(el | (uint16_t)(0x8000));
} else if (previous_dead && next_dead) {
continue;
} else {
mDeadMapTF->push_back(el);
mDeadMapTF.push_back(el);
}
}

LOG(info) << "TF contains " << CountDead << " dead elements, saved into " << mDeadMapTF->size() << " words.";
LOG(info) << "TF contains " << CountDead << " dead elements, saved into " << mDeadMapTF.size() << " words.";

// filling the tree
mTreeObject->Fill();
// filling the map
mMapObject[mFirstOrbitTF] = mDeadMapTF;

end = std::chrono::high_resolution_clock::now();
int difference = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
Expand All @@ -207,7 +202,8 @@ void ITSMFTDeadMapBuilder::PrepareOutputCcdb(DataAllocator& output)

o2::ccdb::CcdbObjectInfo info((path + name_str), "time_dead_map", mObjectName, md, tstart, tend);

auto image = o2::ccdb::CcdbApi::createObjectImage(mTreeObject, &info);
auto image = o2::ccdb::CcdbApi::createObjectImage(&mMapObject, &info);
info.setFileName(mObjectName);

info.setAdjustableEOV();

Expand Down Expand Up @@ -241,7 +237,7 @@ void ITSMFTDeadMapBuilder::endOfStream(EndOfStreamContext& ec)
}

//////////////////////////////////////////////////////////////////////////////
// DDS stop method: simply close the latest tree
// DDS stop method: create local output if endOfStream not processed
void ITSMFTDeadMapBuilder::stop()
{
if (!isEnded) {
Expand Down