Skip to content

Commit e23cc52

Browse files
committed
ITS/MFT dict. name queried from NameConf
Standard dictionary will be named ITSdictionary.bin / MFTdictionary.bin
1 parent 8659b1a commit e23cc52

16 files changed

Lines changed: 111 additions & 65 deletions

Detectors/ITSMFT/ITS/macros/EVE/DisplayEventsComp.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "DataFormatsITSMFT/TopologyDictionary.h"
3838
#include "DataFormatsITSMFT/ROFRecord.h"
3939
#include "DataFormatsITS/TrackITS.h"
40+
#include "DetectorsCommonDataFormats/NameConf.h"
4041
#endif
4142

4243
using namespace o2::itsmft;
@@ -429,7 +430,7 @@ void init(int entry = 0, int chip = 13,
429430
std::string tracfile = "o2trac_its.root",
430431
std::string inputGeom = "")
431432
{
432-
dict.readBinaryFile("complete_dictionary.bin");
433+
dict.readBinaryFile(o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, "", ".bin"));
433434

434435
TEveManager::Create(kTRUE, "V");
435436
TEveBrowser* browser = gEve->GetBrowser();

Detectors/ITSMFT/ITS/macros/test/CheckCOG.C

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
#include "DataFormatsITSMFT/CompCluster.h"
2121
#include "DataFormatsITSMFT/TopologyDictionary.h"
2222
#include "MathUtils/Cartesian3D.h"
23+
#include "DetectorsCommonDataFormats/NameConf.h"
2324

2425
#endif
2526

26-
void CheckCOG(std::string clusfile = "o2clus_its.root", std::string inputGeom = "o2sim_geometry.root", std::string dictionary_file = "complete_dictionary.bin")
27+
void CheckCOG(std::string clusfile = "o2clus_its.root", std::string inputGeom = "", std::string dictionary_file = "")
2728
{
2829
gStyle->SetOptStat(0);
2930
using namespace o2::base;
@@ -34,6 +35,10 @@ void CheckCOG(std::string clusfile = "o2clus_its.root", std::string inputGeom =
3435
using o2::itsmft::CompClusterExt;
3536
using o2::itsmft::TopologyDictionary;
3637

38+
if (dictionary_file.empty()) {
39+
dictionary_file = o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, "", ".bin");
40+
}
41+
3742
// Geometry
3843
o2::base::GeometryManager::loadGeometry(inputGeom);
3944
auto gman = o2::its::GeometryTGeo::Instance();

Detectors/ITSMFT/ITS/macros/test/CheckClusters.C

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
#include "MathUtils/Utils.h"
2020
#include "SimulationDataFormat/MCCompLabel.h"
2121
#include "SimulationDataFormat/MCTruthContainer.h"
22+
#include "DetectorsCommonDataFormats/NameConf.h"
2223
#endif
2324

24-
void CheckClusters(std::string clusfile = "o2clus_its.root", std::string hitfile = "o2sim_HitsITS.root", std::string inputGeom = "o2sim_geometry.root", std::string paramfile = "o2sim_par.root", std::string dictfile = "complete_dictionary.bin")
25+
void CheckClusters(std::string clusfile = "o2clus_its.root", std::string hitfile = "o2sim_HitsITS.root",
26+
std::string inputGeom = "", std::string paramfile = "o2sim_par.root",
27+
std::string dictfile = "")
2528
{
2629
const int QEDSourceID = 99; // Clusters from this MC source correspond to QED electrons
2730

@@ -66,7 +69,9 @@ void CheckClusters(std::string clusfile = "o2clus_its.root", std::string hitfile
6669
if (pattBranch) {
6770
pattBranch->SetAddress(&patternsPtr);
6871
}
69-
72+
if (dictfile.empty()) {
73+
dictfile = o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, "", ".bin");
74+
}
7075
o2::itsmft::TopologyDictionary dict;
7176
std::ifstream file(dictfile.c_str());
7277
if (file.good()) {

Detectors/ITSMFT/ITS/macros/test/CheckLUtime.C

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@
1818
#include "ITSMFTReconstruction/LookUp.h"
1919
#include "DataFormatsITSMFT/Cluster.h"
2020
#include "DataFormatsITSMFT/CompCluster.h"
21+
#include "DetectorsCommonDataFormats/NameConf.h"
2122

2223
#endif
2324

24-
void CheckLUtime(std::string clusfile = "o2clus_its.root", std::string dictfile = "complete_dictionary.bin")
25+
void CheckLUtime(std::string clusfile = "o2clus_its.root", std::string dictfile = "")
2526
{
2627
using o2::itsmft::Cluster;
2728
using o2::itsmft::CompClusterExt;
2829
using o2::itsmft::LookUp;
2930

31+
if (dictfile.empty()) {
32+
dictfile = o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, "", ".bin");
33+
}
3034
LookUp finder(dictfile.c_str());
3135
ofstream time_output("time.txt");
3236

Detectors/ITSMFT/ITS/macros/test/CheckLookUp.C

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
#include "ITSMFTReconstruction/BuildTopologyDictionary.h"
2222
#include "DataFormatsITSMFT/CompCluster.h"
2323
#include "ITSMFTReconstruction/LookUp.h"
24+
#include "DetectorsCommonDataFormats/NameConf.h"
2425

2526
#endif
2627

2728
bool verbose = true;
2829

29-
void CheckLookUp(std::string clusfile = "o2clus_its_comp.root", std::string dictfile = "complete_dictionary.bin")
30+
void CheckLookUp(std::string clusfile = "o2clus_its_comp.root", std::string dictfile = "")
3031
{
3132
#ifndef _ClusterTopology_
3233
std::cout << "This macro needs clusters in full format!" << std::endl;
@@ -40,9 +41,14 @@ void CheckLookUp(std::string clusfile = "o2clus_its_comp.root", std::string dict
4041
using o2::itsmft::LookUp;
4142
using o2::itsmft::TopologyDictionary;
4243

43-
LookUp finder("complete_dictionary.bin");
44+
std::ofstream output_check("check_lookup.txt");
45+
46+
if (dictfile.empty()) {
47+
dictfile = o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, "", ".bin");
48+
}
49+
LookUp finder(dictfile);
4450
TopologyDictionary dict;
45-
dict.readBinaryFile(dictfile.c_str());
51+
dict.readBinaryFile(dictfile);
4652
ofstream check_output("checkLU.txt");
4753
ofstream mist("mist.txt");
4854
TFile outroot("checkLU.root", "RECREATE");

Detectors/ITSMFT/ITS/macros/test/CheckTopologies.C

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
#include "MathUtils/Cartesian3D.h"
2626
#include "SimulationDataFormat/MCCompLabel.h"
2727
#include "SimulationDataFormat/MCTruthContainer.h"
28+
#include "DetectorsCommonDataFormats/NameConf.h"
2829

2930
#endif
3031

31-
void CheckTopologies(std::string clusfile = "o2clus_its.root", std::string hitfile = "o2sim_HitsITS.root", std::string inputGeom = "o2sim_geometry.root")
32+
void CheckTopologies(std::string clusfile = "o2clus_its.root", std::string hitfile = "o2sim_HitsITS.root", std::string inputGeom = "")
3233
{
3334
using namespace o2::base;
3435
using namespace o2::its;
@@ -37,7 +38,6 @@ void CheckTopologies(std::string clusfile = "o2clus_its.root", std::string hitfi
3738
using o2::itsmft::ClusterTopology;
3839
using o2::itsmft::CompClusterExt;
3940
using o2::itsmft::Hit;
40-
4141
std::ofstream output_check("check_topologies.txt");
4242

4343
// Geometry
@@ -146,11 +146,14 @@ void CheckTopologies(std::string clusfile = "o2clus_its.root", std::string hitfi
146146
completeDictionary.accountTopology(topology, dx, dz);
147147
}
148148
}
149+
150+
auto dID = o2::detectors::DetID::ITS;
151+
149152
completeDictionary.setThreshold(0.0001);
150153
completeDictionary.groupRareTopologies();
151-
completeDictionary.printDictionaryBinary("complete_dictionary.bin");
152-
completeDictionary.printDictionary("complete_dictionary.txt");
153-
completeDictionary.saveDictionaryRoot("complete_dictionary.root");
154+
completeDictionary.printDictionaryBinary(o2::base::NameConf::getDictionaryFileName(dID, "", ".bin"));
155+
completeDictionary.printDictionary(o2::base::NameConf::getDictionaryFileName(dID, "", ".txt"));
156+
completeDictionary.saveDictionaryRoot(o2::base::NameConf::getDictionaryFileName(dID, "", ".root"));
154157

155158
TFile histogramOutput("histograms.root", "recreate");
156159
TCanvas* cComplete = new TCanvas("cComplete", "Distribution of all the topologies");
@@ -171,14 +174,14 @@ void CheckTopologies(std::string clusfile = "o2clus_its.root", std::string hitfi
171174
if (clusLabArr) {
172175
noiseDictionary.setThreshold(0.0001);
173176
noiseDictionary.groupRareTopologies();
174-
noiseDictionary.printDictionaryBinary("noise_dictionary.bin");
175-
noiseDictionary.printDictionary("noise_dictionary.txt");
176-
noiseDictionary.saveDictionaryRoot("noise_dictionary.root");
177+
noiseDictionary.printDictionaryBinary(o2::base::NameConf::getDictionaryFileName(dID, "noise", ".bin"));
178+
noiseDictionary.printDictionary(o2::base::NameConf::getDictionaryFileName(dID, "noise", ".txt"));
179+
noiseDictionary.saveDictionaryRoot(o2::base::NameConf::getDictionaryFileName(dID, "noise", ".root"));
177180
signalDictionary.setThreshold(0.0001);
178181
signalDictionary.groupRareTopologies();
179-
signalDictionary.printDictionaryBinary("signal_dictionary.bin");
180-
signalDictionary.printDictionary("signal_dictionary.txt");
181-
signalDictionary.saveDictionaryRoot("signal_dictionary.root");
182+
signalDictionary.printDictionaryBinary(o2::base::NameConf::getDictionaryFileName(dID, "signal", ".bin"));
183+
signalDictionary.printDictionary(o2::base::NameConf::getDictionaryFileName(dID, "signal", ".txt"));
184+
signalDictionary.saveDictionaryRoot(o2::base::NameConf::getDictionaryFileName(dID, "signal", ".root"));
182185

183186
cNoise = new TCanvas("cNoise", "Distribution of noise topologies");
184187
cNoise->cd();

Detectors/ITSMFT/ITS/macros/test/dictionary_integrity_test.C

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@
99
#include "DataFormatsITSMFT/ClusterPattern.h"
1010
#include "DataFormatsITSMFT/TopologyDictionary.h"
1111
#include "ITSMFTReconstruction/LookUp.h"
12+
#include "DetectorsCommonDataFormats/NameConf.h"
1213
#endif
1314

1415
using o2::itsmft::Cluster;
1516
using o2::itsmft::ClusterPattern;
1617
using o2::itsmft::LookUp;
1718
using o2::itsmft::TopologyDictionary;
1819

19-
void dictionary_integrity_test(string intput_name = "complete_dictionary.bin", string output_name = "dictionary_test.txt")
20+
void dictionary_integrity_test(std::string dictfile = "", std::string output_name = "dictionary_test.txt")
2021
{
2122

2223
TopologyDictionary dict;
23-
dict.readBinaryFile(intput_name.c_str());
24-
LookUp finder(intput_name.c_str());
24+
if (dictfile.empty()) {
25+
dictfile = o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, "", ".bin");
26+
}
27+
dict.readBinaryFile(dictfile);
28+
LookUp finder(dictfile);
2529

2630
int mistake_counter = 0;
2731

Detectors/ITSMFT/ITS/macros/test/run_buildTopoDict_its.C

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "SimulationDataFormat/MCCompLabel.h"
2828
#include "SimulationDataFormat/MCTruthContainer.h"
2929
#include <unordered_map>
30+
#include "DetectorsCommonDataFormats/NameConf.h"
3031
#endif
3132

3233
/// Build dictionary of topologies from the root file with full clusters
@@ -194,9 +195,11 @@ void run_buildTopoDict_its(std::string clusfile = "o2clus_its.root",
194195

195196
dict.setThreshold(0.0001);
196197
dict.groupRareTopologies();
197-
dict.printDictionaryBinary("dictionary.bin");
198-
dict.printDictionary("dictionary.txt");
199-
dict.saveDictionaryRoot("dictionary.root");
198+
199+
auto dID = o2::detectors::DetID::ITS;
200+
dict.printDictionaryBinary(o2::base::NameConf::getDictionaryFileName(dID, "", ".bin"));
201+
dict.printDictionary(o2::base::NameConf::getDictionaryFileName(dID, "", ".txt"));
202+
dict.saveDictionaryRoot(o2::base::NameConf::getDictionaryFileName(dID, "", ".root"));
200203

201204
TFile histogramOutput("dict_histograms.root", "recreate");
202205
TCanvas* cComplete = new TCanvas("cComplete", "Distribution of all the topologies");

Detectors/ITSMFT/ITS/reconstruction/src/CookedTracker.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,8 @@ void CookedTracker::process(gsl::span<const o2::itsmft::CompClusterExt> const& c
491491
Point3D<float> locXYZ;
492492
float sigmaY2 = 0.0015 * 0.0015, sigmaZ2 = sigmaY2, sigmaYZ = 0; //Dummy COG errors (about half pixel size)
493493
if (pattID != itsmft::CompCluster::InvalidPatternID) {
494-
sigmaY2 = dict.getErrX(pattID);
495-
sigmaY2 *= sigmaY2;
496-
sigmaZ2 = dict.getErrZ(pattID);
497-
sigmaZ2 *= sigmaZ2;
494+
sigmaY2 = dict.getErr2X(pattID);
495+
sigmaZ2 = dict.getErr2Z(pattID);
498496
if (!dict.isGroup(pattID)) {
499497
locXYZ = dict.getClusterCoordinates(comp);
500498
} else {

Detectors/ITSMFT/ITS/workflow/src/ClustererSpec.cxx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "ITSBase/GeometryTGeo.h"
2929
#include "ITSMFTBase/DPLAlpideParam.h"
3030
#include "CommonConstants/LHCConstants.h"
31+
#include "DetectorsCommonDataFormats/NameConf.h"
3132

3233
using namespace o2::framework;
3334

@@ -64,14 +65,15 @@ void ClustererDPL::init(InitContext& ic)
6465
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
6566
mClusterer->setMaxBCSeparationToMask(alpParams.roFrameLength / o2::constants::lhc::LHCBunchSpacingNS + 10);
6667

67-
auto filename = ic.options().get<std::string>("its-dictionary-file");
68-
mFile = std::make_unique<std::ifstream>(filename.c_str(), std::ios::in | std::ios::binary);
69-
if (mFile->good()) {
70-
mClusterer->loadDictionary(filename);
71-
LOG(INFO) << "ITSClusterer running with a provided dictionary: " << filename.c_str();
72-
mState = 1;
68+
std::string dictPath = ic.options().get<std::string>("its-dictionary-path");
69+
std::string dictFile = o2::base::NameConf::getDictionaryFileName(o2::detectors::DetID::ITS, dictPath, ".bin");
70+
if (o2::base::NameConf::pathExists(dictFile)) {
71+
mClusterer->loadDictionary(dictFile);
72+
LOG(INFO) << "ITSClusterer running with a provided dictionary: " << dictFile;
73+
} else {
74+
LOG(INFO) << "Dictionary " << dictFile << " is absent, ITSClusterer expects cluster patterns";
7375
}
74-
76+
mState = 1;
7577
mClusterer->print();
7678
}
7779

@@ -164,7 +166,7 @@ DataProcessorSpec getClustererSpec(bool useMC)
164166
outputs,
165167
AlgorithmSpec{adaptFromTask<ClustererDPL>(useMC)},
166168
Options{
167-
{"its-dictionary-file", VariantType::String, "complete_dictionary.bin", {"Name of the cluster-topology dictionary file"}},
169+
{"its-dictionary-path", VariantType::String, "", {"Path of the cluster-topology dictionary file"}},
168170
{"grp-file", VariantType::String, "o2sim_grp.root", {"Name of the grp file"}},
169171
{"full-clusters", o2::framework::VariantType::Bool, false, {"Produce full clusters"}},
170172
{"no-patterns", o2::framework::VariantType::Bool, false, {"Do not save rare cluster patterns"}}}};

0 commit comments

Comments
 (0)