-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunJetFindingOnTree.C
93 lines (78 loc) · 3.32 KB
/
runJetFindingOnTree.C
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
void runJetFindingOnTree(
Int_t cenMin = 0,
Int_t cenMax = 10,
Int_t file = 0,
Int_t rejectNJ = 0,
Float_t minConstPt = 0.,
Float_t leadingHadronPt = 0,
Float_t leadingHadronMaxPt = 1e9,
Float_t splitTracksFrom = 1e9,
Float_t splitThemIn = 0,
Bool_t randomize = kFALSE,
Bool_t randomizeEtaPhi = kFALSE)
{
// example macro to read data from a ttree and perform simple analysis
// author: Redmer Alexander Bertens ([email protected])
gSystem->AddIncludePath("-Wno-deprecated");
gSystem->AddIncludePath("-I$FASTJET/include");
gSystem->Load("libCGAL");
gSystem->Load("libfastjet");
gSystem->Load("libsiscone");
gSystem->Load("libsiscone_spherical");
gSystem->Load("libfastjetplugins");
gSystem->Load("libfastjettools");
gSystem->Load("libfastjetcontribfragile");
gROOT->LoadMacro("AliGMFHistogramManager.cxx++O");
gROOT->LoadMacro("AliGMFTTreeHeader.cxx++O");
gROOT->LoadMacro("AliGMFTTreeTrack.cxx++O");
gROOT->LoadMacro("AliGMFEventContainer.cxx++O");
gROOT->LoadMacro("AliGMFEventReader.cxx++O");
gROOT->LoadMacro("AliGMFSimpleTrackCuts.cxx++O");
gROOT->LoadMacro("AliGMFSimpleEventCuts.cxx++O");
// compile the jet finding classes
gROOT->LoadMacro("AliGMFSimpleJetFinder.cxx++O");
// add the desired numbers to a chain (not exception safe for now!)
TChain* myChain = new TChain("tree");
myChain->Add(Form("%i.root", file));
// myChain->Add("merge/137844.root");
// initialize the reader and jet finder
AliGMFEventReader* reader = new AliGMFEventReader(myChain);
cout << reader->GetNumberOfEvents() << " events available for analysis " << endl;
TFile* of = new TFile(Form("SE_jets_%i_%i.root", cenMin, cenMax), "RECREATE");
Int_t iEvents = reader->GetNumberOfEvents();
// initialize the jet finder
AliGMFSimpleJetFinder* jetFinder[3];
float radii[] = {.2, .4, .6};
// create the event cuts
AliGMFSimpleEventCuts* eventCuts = new AliGMFSimpleEventCuts();
eventCuts->SetCentralityRange(cenMin, cenMax);
AliGMFSimpleTrackCuts* trackCuts = new AliGMFSimpleTrackCuts();
trackCuts->SetTrackMinPt(minConstPt);
for(int i = 0; i < 3; i++) {
jetFinder[i] = new AliGMFSimpleJetFinder();
jetFinder[i]->SetJetResolution(radii[i]);
jetFinder[i]->SetJetResolutionBkg(radii[i]);
jetFinder[i]->SetSplittingForTracksWithPtHigherThan(splitTracksFrom);
jetFinder[i]->SetSplitTrackPt(splitThemIn);
jetFinder[i]->SetRandomizeSplitTrackEtaPhi(randomize);
jetFinder[i]->SetLeadingHadronPt(leadingHadronPt);
jetFinder[i]->SetLeadingHadronMaxPt(leadingHadronMaxPt);
// pass the event cuts to the jet finder
jetFinder[i]->SetEventCuts(eventCuts);
jetFinder[i]->SetTrackCuts(trackCuts);
jetFinder[i]->SetRejectNHardestJets(rejectNJ);
jetFinder[i]->SetDoRandomConeAnalysis(kTRUE);
jetFinder[i]->Initialize();
}
for (int i = 0; i < iEvents; i ++) {
for(int j = 0; j < 3; j++) {
jetFinder[j]->AnalyzeEvent(reader->GetEvent(i));
// cout <<"Event: " << i << "\r"; cout.flush();
}
}
for (int i = 0; i < 3; i++) {
jetFinder[i]->Finalize(of);
delete jetFinder[i];
}
delete reader;
}