diff --git a/Detectors/ITSMFT/ITS/postprocessing/studies/include/ITSStudies/Occupancy.h b/Detectors/ITSMFT/ITS/postprocessing/studies/include/ITSStudies/Occupancy.h index 1ce3d04ed6513..58132e814ae76 100644 --- a/Detectors/ITSMFT/ITS/postprocessing/studies/include/ITSStudies/Occupancy.h +++ b/Detectors/ITSMFT/ITS/postprocessing/studies/include/ITSStudies/Occupancy.h @@ -24,7 +24,7 @@ namespace study { using mask_t = o2::dataformats::GlobalTrackID::mask_t; -o2::framework::DataProcessorSpec getOccupancyStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC); +o2::framework::DataProcessorSpec getOccupancyStudy(mask_t srcClustersMask, bool useMC); } // namespace study } // namespace its } // namespace o2 diff --git a/Detectors/ITSMFT/ITS/postprocessing/studies/src/Occupancy.cxx b/Detectors/ITSMFT/ITS/postprocessing/studies/src/Occupancy.cxx index 83196e91394bf..210c06ee7bd65 100644 --- a/Detectors/ITSMFT/ITS/postprocessing/studies/src/Occupancy.cxx +++ b/Detectors/ITSMFT/ITS/postprocessing/studies/src/Occupancy.cxx @@ -78,6 +78,9 @@ class Occupancy : public Task void setClusterDictionary(const o2::itsmft::TopologyDictionary* d) { mDict = d; } private: + int tfCounter = 0; + int pvCounter = 0; + // Other functions void process(o2::globaltracking::RecoContainer&); @@ -91,6 +94,7 @@ class Occupancy : public Task // Running options bool mUseMC; + bool mSuppressNoise = false; // Suppress noise clusters (skip clusters with size 1) // Data std::shared_ptr mGGCCDBRequest; @@ -103,36 +107,41 @@ class Occupancy : public Task // Output plots std::unique_ptr mDBGOut; std::vector mOccupancyHistos{}; + std::unique_ptr mNormalisationCounter{}; std::string mOutName; std::shared_ptr mKineReader; }; void Occupancy::init(InitContext& ic) { + LOG(info) << "Initialising"; o2::base::GRPGeomHelper::instance().setRequest(mGGCCDBRequest); prepareOutput(); } void Occupancy::prepareOutput() { + LOG(info) << "Preparing output"; auto& params = o2::its::study::ITSOccupancyParamConfig::Instance(); mOutName = params.outFileName; mDBGOut = std::make_unique(mOutName.c_str(), "recreate"); - std::vector nStaves{12, 16, 20, 24, 30, 42, 48}; + mNormalisationCounter = std::make_unique("mNormalisationCounter", "Normalisation counter", 2, 0, 2); + mNormalisationCounter->SetDirectory(nullptr); + mNormalisationCounter->GetXaxis()->SetBinLabel(1, "TF"); + mNormalisationCounter->GetXaxis()->SetBinLabel(2, "PV"); + std::vector nStaves{12, 16, 20, 98, 122, 170, 194}; // L3 has 24 staves with 2 sub-staves each with 2 lines of chips each, L4 has 30 staves with 2 sub-staves each with 3 lines of chips each + std::vector nChips{9, 9, 9, 28, 28, 49, 49}; // L3 has 4 modules with 7 chips each, L4 has 4 modules with 7 chips each for (int layer{0}; layer < 7; layer++) { - if (layer < 3) { - mOccupancyHistos.push_back(new TH2F(Form("Occupancy chip map L%i", layer), "; Chip ID; Stave ID; # Hits / # PVs", 9, -0.5, 8.5, nStaves[layer], -0.5, nStaves[layer] - 0.5)); - } else { - mOccupancyHistos.push_back(new TH2F(Form("Occupancy chip map L%i", layer), "; Chip ID; Stave ID; #LT Cluster size #GT", 49, -0.5, 48.5, 4 * nStaves[layer], -0.5, 4 * nStaves[layer] - 0.5)); - } + mOccupancyHistos.push_back(new TH2F(Form("Occupancy chip map L%i", layer), "; Chip ID; Stave ID; # Hits ", nChips[layer], -0.5, nChips[layer] - 0.5, nStaves[layer], -0.5, nStaves[layer] - 0.5)); mOccupancyHistos[layer]->SetDirectory(nullptr); } } void Occupancy::run(ProcessingContext& pc) { + LOG(info) << "Running"; o2::globaltracking::RecoContainer recoData; recoData.collectData(pc, *mDataRequest.get()); updateTimeDependentParams(pc); // Make sure this is called after recoData.collectData, which may load some conditions @@ -163,6 +172,7 @@ void Occupancy::fillIBmap(TH2F* histo, int sta, int chipInMod, float weight) void Occupancy::fillOBmap(TH2F* histo, int sta, int chipInMod, float weight, int ssta, int mod) { + // In the OB 14 Pixel Chips are aligned in 2 parallel rows of 7 chip for 7 modules auto xCoord = chipInMod < 7 ? (mod - 1) * 7 + chipInMod : (mod - 1) * 7 + 14 - chipInMod; auto yCoord = 4 * sta + ssta * 2 + 1 * (chipInMod < 7); histo->Fill(xCoord, yCoord, weight); @@ -170,11 +180,14 @@ void Occupancy::fillOBmap(TH2F* histo, int sta, int chipInMod, float weight, int void Occupancy::process(o2::globaltracking::RecoContainer& recoData) { + LOG(info) << "Processing"; auto& params = o2::its::study::ITSOccupancyParamConfig::Instance(); bool isMCTarget = false; PVertex pv; + LOG(info) << "Processing event"; auto compClus = recoData.getITSClusters(); + LOG(info) << "Number of clusters " << compClus.size(); getClusters(compClus, 1.); // Default weight is 1 saveHistograms(); } @@ -190,6 +203,7 @@ void Occupancy::updateTimeDependentParams(ProcessingContext& pc) } } + void Occupancy::saveHistograms() { mDBGOut.reset(); @@ -198,10 +212,12 @@ void Occupancy::saveHistograms() for (auto& histo : mOccupancyHistos) { histo->Write(); } - + mNormalisationCounter->SetBinContent(1, tfCounter); + mNormalisationCounter->Write(); fout.Close(); } + void Occupancy::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) { if (o2::base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) { @@ -214,14 +230,13 @@ void Occupancy::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) } } -DataProcessorSpec getOccupancyStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC) +DataProcessorSpec getOccupancyStudy(mask_t srcClustersMask, bool useMC) { std::vector outputs; auto dataRequest = std::make_shared(); - dataRequest->requestTracks(srcTracksMask, useMC); dataRequest->requestClusters(srcClustersMask, useMC); // dataRequest->requestPrimaryVerterticesTMP(useMC); - + LOG(info) << "Requesting clusters"; auto ggRequest = std::make_shared(false, // orbitResetTime true, // GRPECS=true false, // GRPLHCIF @@ -230,6 +245,7 @@ DataProcessorSpec getOccupancyStudy(mask_t srcTracksMask, mask_t srcClustersMask o2::base::GRPGeomRequest::Aligned, // geometry dataRequest->inputs, true); + LOG(info) << "Requesting GRPGeomRequest"; return DataProcessorSpec{ "its-study-Occupancy", dataRequest->inputs, diff --git a/Detectors/ITSMFT/ITS/postprocessing/workflow/standalone-postprocessing-workflow.cxx b/Detectors/ITSMFT/ITS/postprocessing/workflow/standalone-postprocessing-workflow.cxx index a4b8666b968a3..fc71ef2df34a5 100644 --- a/Detectors/ITSMFT/ITS/postprocessing/workflow/standalone-postprocessing-workflow.cxx +++ b/Detectors/ITSMFT/ITS/postprocessing/workflow/standalone-postprocessing-workflow.cxx @@ -42,12 +42,22 @@ void customize(std::vector& workflowOptions) {"cluster-sources", VariantType::String, std::string{"ITS"}, {"comma-separated list of cluster sources to use"}}, {"disable-root-input", VariantType::Bool, false, {"disable root-files input reader"}}, {"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}}, + {"disable-tracking", VariantType::Bool, false, {"disable MC propagation even if available"}}, {"cluster-size-study", VariantType::Bool, false, {"Perform the average cluster size study"}}, {"track-study", VariantType::Bool, false, {"Perform the track study"}}, {"occupancy-study", VariantType::Bool, false, {"Perform the occupancy study"}}, {"impact-parameter-study", VariantType::Bool, false, {"Perform the impact parameter study"}}, {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}}; - o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2_tfidinfo.root"); + + // add the option to match the tf id info + bool useMC = !options[3].defaultValue.get(); + if (useMC) { + LOG(info) << "Using MC: adding o2simdigitizerworkflow_configuration.ini"; + o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2simdigitizerworkflow_configuration.ini"); + } else { + LOG(info) << "Using data: adding o2_tfidinfo.root"; + o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2_tfidinfo.root"); + } std::swap(workflowOptions, options); } @@ -91,7 +101,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) } if (configcontext.options().get("occupancy-study")) { anyStudy = true; - specs.emplace_back(o2::its::study::getOccupancyStudy(srcTrc, srcCls, useMC)); + specs.emplace_back(o2::its::study::getOccupancyStudy(srcCls, useMC)); } if (!anyStudy) { LOGP(info, "No study selected, dryrunning");