]>
Commit | Line | Data |
---|---|---|
44210957 | 1 | AliAnalysisTaskJetHBOM *AddTaskJetHBOM(char* bRec = "AOD",char* bGen = "",UInt_t filterMask = 272, UInt_t iPhysicsSelectionFlag = AliVEvent::kAny,Char_t *jf = "KT", Float_t radius = 0.4,Int_t kWriteAOD = kFALSE,char* deltaFile = "",Float_t ptTrackCut = 0.15, Float_t etaTrackWindow = 0.9,Float_t vertexWindow = 10.,TString effLoc = "$ALICE_ROOT/OADB/PWGJE/HBOM/fastMCInput_LHC10h_110719a.root",Int_t fNHBOM = 0, Int_t constCone = kFALSE, Float_t constConePhi = 0, Float_t constConeEta = 0); |
bcf7a476 | 2 | |
3 | Int_t kBackgroundModeCl = 0; | |
4 | Float_t kPtTrackCutCl = 0.15; | |
5 | Float_t kTrackEtaWindowCl = 0.8; | |
6 | Float_t kVertexWindowCl = 10; | |
7 | ||
8 | ||
44210957 | 9 | AliAnalysisTaskJetHBOM *AddTaskJetHBOM(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,TString effLoc,Int_t fNHBOM, Int_t constCone, Float_t constConePhi,Float_t constConeEta) |
bcf7a476 | 10 | { |
44210957 | 11 | //if constCone is true, the random Cone positon is set to constConePhi and constConeEta. Else the cone is random set and the parameters constConePhi and constConeEta are irrelevant |
12 | ||
bcf7a476 | 13 | // Creates a jet fider task, configures it and adds it to the analysis manager. |
14 | kPtTrackCutCl = ptTrackCut; | |
15 | kTrackEtaWindowCl = etaTrackWindow; | |
16 | kVertexWindowCl = vertexWindow; | |
17 | ||
18 | TString outputFile(deltaFile); | |
19 | // Get the pointer to the existing analysis manager via the static access method. | |
20 | //============================================================================== | |
21 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
22 | if (!mgr) { | |
23 | ::Error("AddTaskJetHBOM", "No analysis manager to connect to."); | |
24 | return NULL; | |
25 | } | |
26 | ||
27 | // Check the analysis type using the event handlers connected to the analysis manager. | |
28 | //============================================================================== | |
29 | if (!mgr->GetInputEventHandler()) { | |
30 | ::Error("AddTaskJetHBOM", "This task requires an input event handler"); | |
31 | return NULL; | |
32 | } | |
33 | ||
34 | TString type = mgr->GetInputEventHandler()->GetDataType(); | |
35 | TString typeRec(bRec); | |
36 | TString typeGen(bGen); | |
37 | if(!typeRec.Contains("AODextra")) { | |
38 | typeGen.ToUpper(); | |
39 | typeRec.ToUpper(); | |
40 | } | |
41 | cout << "typeRec: " << typeRec << endl; | |
42 | // Create the task and configure it. | |
43 | //=========================================================================== | |
44 | ||
45 | ||
46 | TString cAdd = ""; | |
47 | cAdd += Form("%02d_",(int)((radius+0.01)*10.)); | |
48 | cAdd += Form("B%d",(int)kBackgroundModeCl); | |
49 | cAdd += Form("_Filter%05d",filterMask); | |
50 | cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl)); | |
51 | cAdd += Form("_hbom%02d",fNHBOM); | |
44210957 | 52 | if(constCone){ |
53 | cAdd += Form("_constConePhi%02dEta%02d",constConePhi,constConeEta); | |
54 | } | |
bcf7a476 | 55 | Printf("%s %E",cAdd.Data(),kPtTrackCutCl); |
56 | AliAnalysisTaskJetHBOM* hbom = new AliAnalysisTaskJetHBOM(Form("JetHBOM%s_%s%s",bRec,jf,cAdd.Data())); | |
57 | ||
58 | hbom->SetFilterMask(filterMask); | |
59 | // hbom->SetUseGlobalSelection(kTRUE); | |
60 | hbom->SetVtxCuts(kVertexWindowCl,1);//sets fVtxZCut and fVtxR2Cut | |
61 | if(type == "AOD"){ | |
62 | // Assume all jet are produced already | |
63 | hbom->SetAODTrackInput(kTRUE); | |
64 | hbom->SetAODMCInput(kTRUE); | |
65 | } | |
66 | ||
67 | if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD | |
68 | hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCChargedAcceptance); | |
69 | hbom->SetTrackPtCut(kPtTrackCutCl); | |
70 | hbom->SetTrackEtaWindow(kTrackEtaWindowCl); | |
71 | } | |
72 | else if (typeRec.Contains("AODMC2")){ | |
73 | hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCCharged); | |
74 | hbom->SetTrackPtCut(kPtTrackCutCl); | |
75 | hbom->SetTrackEtaWindow(5); | |
76 | } | |
77 | else if (typeRec.Contains("AODMC")){ | |
78 | hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCAll); | |
79 | hbom->SetTrackPtCut(kPtTrackCutCl); | |
80 | hbom->SetTrackEtaWindow(5); | |
81 | } | |
82 | else if (typeRec.Contains("AODextraonly")) { | |
83 | hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextraonly); | |
84 | hbom->SetTrackPtCut(kPtTrackCutCl); | |
85 | hbom->SetTrackEtaWindow(kTrackEtaWindowCl); | |
86 | } | |
87 | else if (typeRec.Contains("AODextra")) { | |
88 | cout << "AliAnalysisTaskJetHBOM::kTrackAODextra: " << AliAnalysisTaskJetHBOM::kTrackAODextra << endl; | |
89 | hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextra); | |
90 | hbom->SetTrackPtCut(kPtTrackCutCl); | |
91 | hbom->SetTrackEtaWindow(kTrackEtaWindowCl); | |
92 | } | |
93 | else if (typeRec.Contains("AOD")) { | |
94 | hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAOD); | |
95 | hbom->SetTrackPtCut(kPtTrackCutCl); | |
96 | hbom->SetTrackEtaWindow(kTrackEtaWindowCl); | |
97 | } | |
98 | ||
99 | hbom->SetRparam(radius); | |
100 | hbom->SetGhostArea(0.005); | |
101 | hbom->SetGhostEtamax(kTrackEtaWindowCl); | |
102 | ||
103 | switch (jf) { | |
104 | case "ANTIKT": | |
105 | hbom->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh | |
106 | break; | |
107 | case "CA": | |
108 | hbom->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh | |
109 | break; | |
110 | case "KT": | |
111 | hbom->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh | |
112 | break; | |
113 | default: | |
114 | ::Error("AddTaskJetHBOM", "Wrong jet finder selected\n"); | |
115 | return 0; | |
116 | } | |
117 | ||
44210957 | 118 | //Constant Cone analysis |
119 | if(constCone){ | |
120 | hbom->SetRandConePos(constConeEta,constConePhi); | |
121 | } | |
122 | ||
bcf7a476 | 123 | |
124 | if(kWriteAOD){ | |
125 | if(outputFile.Length())hbom->SetJetOutputFile(outputFile); | |
126 | hbom->SetJetOutputBranch(Form("hbom%s_%s%s",bRec,jf,cAdd.Data())); | |
127 | hbom->SetJetOutputMinPt(0); // store only jets above a certain threshold | |
128 | } | |
129 | ||
130 | //sets number of detector hits | |
131 | hbom->SetfNHBOM(fNHBOM); | |
132 | ||
133 | //physics Selection | |
9ff03102 | 134 | if(iPhysicsSelectionFlag)hbom->SelectCollisionCandidates(iPhysicsSelectionFlag); |
bcf7a476 | 135 | |
136 | mgr->AddTask(hbom); | |
137 | ||
138 | // Create ONLY the output containers for the data produced by the task. | |
139 | // Get and connect other common input/output containers via the manager as below | |
140 | //============================================================================== | |
141 | AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer(Form("hbom_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_hbom_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data())); | |
142 | ||
143 | mgr->ConnectInput (hbom, 0, mgr->GetCommonInputContainer()); | |
144 | mgr->ConnectOutput (hbom, 0, mgr->GetCommonOutputContainer()); | |
145 | mgr->ConnectOutput (hbom, 1, coutput1_Spec ); | |
146 | ||
147 | //loads efficiencies | |
9ff03102 | 148 | hbom->SetEfficiencyPt(GetEfficiencyPt(effLoc)); |
149 | hbom->SetEfficiencyPhi(GetEfficiencyPhi(effLoc)); | |
71a4c9f1 | 150 | |
bcf7a476 | 151 | return hbom; |
152 | } | |
153 | ||
154 | //loads single track pT efficiency from root file | |
9ff03102 | 155 | TH1F *GetEfficiencyPt(TString effLoc){ |
71a4c9f1 | 156 | TFile *fIn = 0; |
157 | TH1F *hEffPt = 0; | |
bcf7a476 | 158 | |
bcf7a476 | 159 | if(!fIn)fIn = TFile::Open(effLoc.Data()); |
792cf46b | 160 | if(!fIn)Printf("%s%d no input data",(char*)__FILE__,__LINE__); |
bcf7a476 | 161 | if(!hEffPt)hEffPt = (TH1F*)fIn->Get("hSingleTrackEffPt"); |
792cf46b | 162 | if(!hEffPt)Printf("%s%d no single track efficiency spectrum available",(char*)__FILE__,__LINE__); |
71a4c9f1 | 163 | gROOT->cd(); |
164 | ||
165 | TH1F *hEffPtClone = (TH1F*)hEffPt->Clone(hEffPt->GetName()); | |
166 | fIn->Close(); | |
167 | return hEffPtClone; | |
bcf7a476 | 168 | |
bcf7a476 | 169 | |
170 | } | |
171 | ||
172 | //loads phi-pT efficiency from root file | |
9ff03102 | 173 | TH2D *GetEfficiencyPhi(TString effLoc){ |
71a4c9f1 | 174 | TFile *fIn = 0; |
175 | TH2D *hPhiPt = 0; | |
bcf7a476 | 176 | |
bcf7a476 | 177 | if(!fIn)fIn = TFile::Open(effLoc.Data()); |
792cf46b | 178 | if(!fIn)Printf("%s%d no input data",(char*)__FILE__,__LINE__); |
bcf7a476 | 179 | if(!hPhiPt)hPhiPt = (TH2D*)fIn->Get("h2TrackPtPhiNorm"); |
180 | if(!hPhiPt) cout<<"Could not load h2TrackPtPhiNorm"<<endl; | |
792cf46b | 181 | if(!hPhiPt)Printf("%s%d no phi-pt efficiency spectrum available",(char*)__FILE__,__LINE__); |
bcf7a476 | 182 | |
71a4c9f1 | 183 | gROOT->cd(); |
184 | TH2D *hPhiPtClone = (TH2D*)hPhiPt->Clone(hPhiPt->GetName()); | |
185 | fIn->Close(); | |
186 | return hPhiPtClone; | |
bcf7a476 | 187 | |
188 | } |