Skip to content

Commit 2e2c3aa

Browse files
mconcasshahor02
authored andcommitted
Add dumping of deltas on file in CreateDictionaries
1 parent 0c902c7 commit 2e2c3aa

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#include <unordered_map>
3333
#endif
3434

35-
void CreateDictionaries(std::string clusfile = "o2clus_its.root",
35+
void CreateDictionaries(bool saveDeltas = false,
36+
std::string clusfile = "o2clus_its.root",
3637
std::string hitfile = "o2sim_HitsITS.root",
3738
std::string collContextfile = "collisioncontext.root",
3839
std::string inputGeom = "",
@@ -56,6 +57,14 @@ void CreateDictionaries(std::string clusfile = "o2clus_its.root",
5657
std::unordered_map<int, int> hadronicMCMap; // mapping from MC event entry to hadronic event ID
5758
std::vector<HitVec*> hitVecPool;
5859
std::vector<MC2HITS_map> mc2hitVec;
60+
61+
TFile* fout = nullptr;
62+
TNtuple* nt = nullptr;
63+
if (saveDeltas) {
64+
fout = TFile::Open("CreateDictionaries.root", "recreate");
65+
nt = new TNtuple("nt", "hashes ntuple", "hash:dx:dz");
66+
}
67+
5968
const o2::steer::DigitizationContext* digContext = nullptr;
6069
TStopwatch sw;
6170
sw.Start();
@@ -214,6 +223,9 @@ void CreateDictionaries(std::string clusfile = "o2clus_its.root",
214223
const auto locC = o2::itsmft::TopologyDictionary::getClusterCoordinates(cluster, pattern, false);
215224
dX = locH.X() - locC.X();
216225
dZ = locH.Z() - locC.Z();
226+
if (saveDeltas) {
227+
nt->Fill(topology.getHash(), dX, dZ);
228+
}
217229
if (checkOutliers > 0.) {
218230
if (std::abs(dX) > topology.getRowSpan() * o2::itsmft::SegmentationAlpide::PitchRow * checkOutliers ||
219231
std::abs(dZ) > topology.getColumnSpan() * o2::itsmft::SegmentationAlpide::PitchCol * checkOutliers) { // ignore outlier
@@ -299,4 +311,8 @@ void CreateDictionaries(std::string clusfile = "o2clus_its.root",
299311
sw.Stop();
300312
sw.Print();
301313
}
314+
if (saveDeltas) {
315+
fout->cd();
316+
nt->Write();
317+
}
302318
}

0 commit comments

Comments
 (0)