forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_match_TPCITS.C
More file actions
109 lines (91 loc) · 3.97 KB
/
Copy pathrun_match_TPCITS.C
File metadata and controls
109 lines (91 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <TFile.h>
#include <TChain.h>
#include <TTree.h>
#include <TGeoGlobalMagField.h>
#include <string>
#include <FairLogger.h>
#include "Field/MagneticField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DetectorsBase/GeometryManager.h"
#include "DetectorsBase/Propagator.h"
#include "DataFormatsTPC/ClusterNativeHelper.h"
#include "TPCReconstruction/TPCFastTransformHelperO2.h"
#include "GlobalTracking/MatchTPCITS.h"
#include "ITSMFTBase/DPLAlpideParam.h"
#endif
void run_match_TPCITS(std::string path = "./", std::string outputfile = "o2match_itstpc.root",
std::string inputTracksITS = "o2trac_its.root",
std::string inputTracksTPC = "tpctracks.root",
std::string inputClustersITS = "o2clus_its.root",
std::string inputClustersTPC = "tpc-native-clusters.root",
std::string inputFITInfo = "o2reco_t0.root", // optional FIT (T0) info
std::string inputGeom = "O2geometry.root",
std::string inputGRP = "o2sim_grp.root")
{
o2::globaltracking::MatchTPCITS matching;
if (path.back() != '/') {
path += '/';
}
//>>>---------- attach input data --------------->>>
TChain itsTracks("o2sim");
itsTracks.AddFile((path + inputTracksITS).c_str());
matching.setInputTreeITSTracks(&itsTracks);
TChain itsTrackROF("ITSTracksROF");
itsTrackROF.AddFile((path + inputTracksITS).c_str());
matching.setInputTreeITSTrackROFRec(&itsTrackROF);
TChain tpcTracks("events");
tpcTracks.AddFile((path + inputTracksTPC).c_str());
matching.setInputTreeTPCTracks(&tpcTracks);
TChain itsClusters("o2sim");
itsClusters.AddFile((path + inputClustersITS).c_str());
matching.setInputTreeITSClusters(&itsClusters);
TChain itsClusterROF("ITSClustersROF");
itsClusterROF.AddFile((path + inputClustersITS).c_str());
matching.setInputTreeITSClusterROFRec(&itsClusterROF);
bool canUseFIT = false;
TChain fitInfo("o2sim");
if (!inputFITInfo.empty()) {
if (!gSystem->AccessPathName((path + inputFITInfo).c_str())) {
fitInfo.AddFile((path + inputFITInfo).c_str());
matching.setInputTreeFITInfo(&fitInfo);
canUseFIT = true;
} else {
LOG(ERROR) << "ATTENTION: FIT input " << inputFITInfo << " requested but not available";
}
}
o2::tpc::ClusterNativeHelper::Reader tcpClusterReader;
tcpClusterReader.init(inputClustersTPC.c_str());
matching.setInputTPCClustersReader(&tcpClusterReader);
//<<<---------- attach input data ---------------<<<
// create/attach output tree
TFile outFile((path + outputfile).c_str(), "recreate");
TTree outTree("matchTPCITS", "Matched TPC-ITS tracks");
matching.setOutputTree(&outTree);
#ifdef _ALLOW_DEBUG_TREES_
matching.setDebugTreeFileName(path + matching.getDebugTreeFileName());
// dump accepted pairs only
matching.setDebugFlag(o2::globaltracking::MatchTPCITS::MatchTreeAccOnly);
// dump all checked pairs
// matching.setDebugFlag(o2::globaltracking::MatchTPCITS::MatchTreeAll);
// dump winner matches
matching.setDebugFlag(o2::globaltracking::MatchTPCITS::WinnerMatchesTree);
#endif
//-------- init geometry and field --------//
o2::base::GeometryManager::loadGeometry(path + inputGeom, "FAIRGeom");
o2::base::Propagator::initFieldFromGRP(path + inputGRP);
//-------------------- settings -----------//
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
matching.setITSROFrameLengthMUS(alpParams.roFrameLength / 1.e3); // ITS ROFrame duration in \mus
matching.setCutMatchingChi2(100.);
std::array<float, o2::track::kNParams> cutsAbs = { 2.f, 2.f, 0.2f, 0.2f, 4.f };
std::array<float, o2::track::kNParams> cutsNSig2 = { 49.f, 49.f, 49.f, 49.f, 49.f };
matching.setCrudeAbsDiffCut(cutsAbs);
matching.setCrudeNSigma2Cut(cutsNSig2);
matching.setTPCTimeEdgeZSafeMargin(3);
matching.init();
matching.run();
outFile.cd();
outTree.Write();
outFile.Close();
}