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
7 changes: 4 additions & 3 deletions Modules/MFT/include/MFT/BasicDigitQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ class BasicDigitQcTask final : public TaskInterface

private:
// variables
const double gPixelHitMapsMaxBinX = 1023.5;
const double gPixelHitMapsMaxBinY = 511.5;
const double gPixelHitMapsMinBin = -0.5;
const double gPixelHitMapsMaxBinX = 1024;
const double gPixelHitMapsMaxBinY = 512;
const double gPixelHitMapsMinBin = 0;
const double gPixelHitMapsShift = 0.5;
const int gPixelHitMapsBinWidth = 1;

const int nHitMaps = 20;
Expand Down
6 changes: 2 additions & 4 deletions Modules/MFT/src/BasicClusterQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ void BasicClusterQcTask::initialize(o2::framework::InitContext& /*ctx*/)

mMFT_ClusterSensorID_H = std::make_unique<TH1F>("mMFT_ClusterSensorID_H", "mMFT_ClusterSensorID_H", 936, -0.5, 935.5);
getObjectsManager()->startPublishing(mMFT_ClusterSensorID_H.get());
getObjectsManager()->addMetadata(mMFT_ClusterSensorID_H->GetName(), "custom", "34");

mMFT_ClusterPatternID_H = std::make_unique<TH1F>("mMFT_ClusterPatternID_H", "mMFT_ClusterPatternID_H", 2048, -0.5, 2047.5);
getObjectsManager()->startPublishing(mMFT_ClusterPatternID_H.get());
getObjectsManager()->addMetadata(mMFT_ClusterPatternID_H->GetName(), "custom", "34");
}

void BasicClusterQcTask::startOfActivity(Activity& /*activity*/)
Expand All @@ -73,8 +71,8 @@ void BasicClusterQcTask::monitorData(o2::framework::ProcessingContext& ctx)
return;
// fill the histograms
for (auto& one_cluster : clusters) {
mMFT_ClusterSensorID_H->Fill(one_cluster.getSensorID());
mMFT_ClusterPatternID_H->Fill(one_cluster.getPatternID());
mMFT_ClusterSensorID_H->Fill(one_cluster.getSensorID() + 1);
mMFT_ClusterPatternID_H->Fill(one_cluster.getPatternID() + 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Modules/MFT/src/BasicDigitQcCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void BasicDigitQcCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality chec
if (mo->getName().find("mMFTChipHitMap") != std::string::npos) {
auto* h = dynamic_cast<TH2F*>(mo->getObject());

TPaveText* message = new TPaveText(0.3, 0.8, 0.75, 0.9, "NDC");
TPaveText* message = new TPaveText(0.35, 0.9, 0.65, 0.95, "NDC");
h->GetListOfFunctions()->Add(message);
message->SetBorderSize(1);

Expand Down
48 changes: 4 additions & 44 deletions Modules/MFT/src/BasicDigitQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void BasicDigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)

auto pxlhitmap = std::make_unique<TH2F>(
FolderName, HistogramName,
gPixelHitMapsMaxBinX / gPixelHitMapsBinWidth, gPixelHitMapsMinBin, gPixelHitMapsMaxBinX,
gPixelHitMapsMaxBinY / gPixelHitMapsBinWidth, gPixelHitMapsMinBin, gPixelHitMapsMaxBinY);
gPixelHitMapsMaxBinX / gPixelHitMapsBinWidth, gPixelHitMapsMinBin - gPixelHitMapsShift, gPixelHitMapsMaxBinX - gPixelHitMapsShift,
gPixelHitMapsMaxBinY / gPixelHitMapsBinWidth, gPixelHitMapsMinBin - gPixelHitMapsShift, gPixelHitMapsMaxBinY - gPixelHitMapsShift);
pxlhitmap->SetStats(0);
mMFTPixelHitMap.push_back(std::move(pxlhitmap));
if (TaskLevel == 2 || TaskLevel == 4)
Expand Down Expand Up @@ -145,8 +145,8 @@ void BasicDigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
// fill pixel hit maps
mMFTPixelHitMap[vectorIndex]->Fill(one_digit.getColumn(), one_digit.getRow());
// fill overview histograms
mMFT_chip_index_H->SetBinContent(chipIndex, mMFTPixelHitMap[vectorIndex]->GetEntries());
mMFT_chip_std_dev_H->SetBinContent(chipIndex, mMFTPixelHitMap[vectorIndex]->GetStdDev(1));
mMFT_chip_index_H->SetBinContent(chipIndex + 1, mMFTPixelHitMap[vectorIndex]->GetEntries());
mMFT_chip_std_dev_H->SetBinContent(chipIndex + 1, mMFTPixelHitMap[vectorIndex]->GetStdDev(1));
// }
}

Expand Down Expand Up @@ -267,44 +267,4 @@ int BasicDigitQcTask::getChipIndex(int vectorID)
return chipID;
}

// void BasicDigitQcTask::readTable()
// {
// // reset arrays
// for (int i = 0; i < nChip; i++) {
// half[i] = 0;
// disk[i] = 0;
// face[i] = 0;
// zone[i] = 0;
// ladder[i] = 0;
// sensor[i] = 0;
// transID[i] = 0;
// layer[i] = 0;
// x[i] = 0;
// y[i] = 0;
// z[i] = 0;
// binx[i] = 0;
// biny[i] = 0;
// }

// // read file
// std::ifstream read_table;
// read_table.open("./table_file_binidx.txt");
// for (int i = 0; i < nChip; ++i) {
// read_table >> half[i];
// read_table >> disk[i];
// read_table >> face[i];
// read_table >> zone[i];
// read_table >> ladder[i];
// read_table >> sensor[i];
// read_table >> transID[i];
// read_table >> layer[i];
// read_table >> x[i];
// read_table >> y[i];
// read_table >> z[i];
// read_table >> binx[i];
// read_table >> biny[i];
// }
// read_table.close();
// }

} // namespace o2::quality_control_modules::mft
63 changes: 44 additions & 19 deletions Modules/MFT/src/runDigitsRootFileReaderMFT.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,57 @@ class DigitsRootFileReaderMFT : public o2::framework::Task
ic.services().get<ControlService>().readyToQuit(QuitRequest::Me);
return;
}

// get the tree
mTree = (TTree*)mFile->Get("o2sim");
mTree->SetBranchAddress("MFTDigit", &pdigits);
mTree->SetBranchAddress("MFTDigitROF", &profs);

// check that it has entries
nTFs = mTree->GetEntries();
if (nTFs == 0) {
LOG(ERROR) << "DigitsRootFileReaderMFT::init. No TFs ";
ic.services().get<ControlService>().endOfStream();
ic.services().get<ControlService>().readyToQuit(QuitRequest::Me);
return;
}
LOG(INFO) << " oooooooooooo In DigitsRootFileReaderMFT::init ... nTFs = " << nTFs;
}

//_________________________________________________________________________________________________

void run(framework::ProcessingContext& pc)
{
// get vector of ROF
std::unique_ptr<TTree> tree((TTree*)mFile->Get("o2sim"));
std::vector<o2::itsmft::ROFRecord> rofs, *profs = &rofs;
tree->SetBranchAddress("MFTDigitROF", &profs);
tree->GetEntry(0);

// Check if there is a new ROF
auto nROFs = rofs.size();
if (currentROF >= nROFs) {
// if (currentROF >= 50) {
// Check if this is the last TF
if (currentTF == nTFs) {
LOG(INFO) << " DigitsRootFileReaderMFT::run. End of file reached";
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
return;
}

// check if we need to read a new TF
if (currentROF == nROFs) {
mTree->GetEntry(currentTF); // get new TF
currentTF++;
nROFs = rofs.size(); // get number of ROFs in this TF
currentROF = 0;
LOG(INFO) << " oooooooooooo Reading TF " << currentTF << " from " << nTFs
<< " with " << nROFs << " ROFs";
}

// prepare the rof output
std::vector<o2::itsmft::ROFRecord>* oneROFvec = new std::vector<o2::itsmft::ROFRecord>();
std::copy(rofs.begin() + currentROF, rofs.begin() + currentROF + 1, std::back_inserter(*oneROFvec));
// get the current ROF
auto& rof = rofs[currentROF];
currentROF++;

// get the digits in current ROF
// --> get digit branch
std::vector<o2::itsmft::Digit> digits, *pdigits = &digits;
tree->SetBranchAddress("MFTDigit", &pdigits);
tree->GetEntry(0);
// --> get the current ROF
auto& rof = rofs[currentROF];
// --> find the ranges
int index = rof.getFirstEntry(); // first digit position
int nDigitsInROF = rof.getNEntries(); // number of digits
int lastIndex = index + nDigitsInROF;

// --> fill in the corresponding digits
std::vector<o2::itsmft::Digit>* DigitsInROF = new std::vector<o2::itsmft::Digit>();
std::copy(digits.begin() + index, digits.begin() + lastIndex, std::back_inserter(*DigitsInROF));
Expand All @@ -102,11 +116,22 @@ class DigitsRootFileReaderMFT : public o2::framework::Task
// LOG(INFO) << " DigitsRootFileReaderMFT::run. In this ROF there are " << DigitsInROF.size() << " digits";
pc.outputs().snapshot(Output{ "MFT", "DIGITS", 0, Lifetime::Timeframe }, *DigitsInROF);
pc.outputs().snapshot(Output{ "MFT", "MFTDigitROF", 0, Lifetime::Timeframe }, *oneROFvec);

// update the ROF counter
currentROF++;
// usleep(100);
}

private:
std::unique_ptr<TFile> mFile = nullptr;
unsigned long currentROF = 0;
std::unique_ptr<TFile> mFile = nullptr; // file to be read
TTree* mTree = nullptr; // tree inside the file
std::vector<o2::itsmft::ROFRecord> rofs, *profs = &rofs; // pointer to ROF branch
std::vector<o2::itsmft::Digit> digits, *pdigits = &digits; // pointer to digit branch

unsigned long nTFs = 0; // number of TF
unsigned long nROFs = 0; // number of ROFs in current TF
unsigned long currentROF = 0; // idx of current ROF
unsigned long currentTF = 0; // idx of current TF

}; // end class definition

Expand Down