major dielectron update (included also the data and plotting macros for paper)
[u/mrichter/AliRoot.git] / PWG3 / dielectron / macros / ConfigJpsi2eeData.C
CommitLineData
48609e3d 1void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
2void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
3void InitHistogramsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
4void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
572b0139 5
48609e3d 6AliESDtrackCuts *SetupESDtrackCutsDieleData(Int_t cutDefinition);
572b0139 7
1201a1a9 8TString namesDieleData=("basicQ+SPDfirst+pt>1+PID; basicQ+SPDany+pt>1+PID");
572b0139 9
1201a1a9 10TObjArray *arrNamesDieleData=namesDieleData.Tokenize("; ");
61d106d3 11
48609e3d 12const Int_t nDie=arrNamesDieleData->GetEntries();
61d106d3 13
48609e3d 14AliDielectron* ConfigJpsi2ee(Int_t cutDefinition, Bool_t isAOD=kFALSE)
572b0139 15{
16 //
17 // Setup the instance of AliDielectron
18 //
19
20 // create the actual framework object
48609e3d 21 TString name=Form("%02d",cutDefinition);
22 if (cutDefinition<arrNamesDieleData->GetEntriesFast()){
23 name=arrNamesDieleData->At(cutDefinition)->GetName();
572b0139 24 }
48609e3d 25 AliDielectron *diele = new AliDielectron(Form("%s",name.Data()),
164bfb53 26 Form("Track cuts: %s",name.Data()));
61d106d3 27
572b0139 28 // cut setup
48609e3d 29 SetupTrackCutsDieleData(diele, cutDefinition, isAOD);
30 SetupPairCutsDieleData(diele, cutDefinition, isAOD);
572b0139 31
32 //
33 // histogram setup
34 // only if an AliDielectronHistos object is attached to the
48609e3d 35 // dielelectron framework histograms will be filled
572b0139 36 //
48609e3d 37 InitHistogramsDieleData(diele, cutDefinition, isAOD);
572b0139 38
39 // the last definition uses no cuts and only the QA histograms should be filled!
48609e3d 40// if (cutDefinition<nDie-1)
41 InitCFDieleData(diele, cutDefinition, isAOD);
42
1201a1a9 43 AliDielectronTrackRotator *rot=new AliDielectronTrackRotator;
ba15fdfb 44 rot->SetConeAnglePhi(TMath::Pi());
45 rot->SetIterations(10);
1201a1a9 46 diele->SetTrackRotator(rot);
48609e3d 47 return diele;
48}
61d106d3 49
48609e3d 50//______________________________________________________________________________________
48609e3d 51void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
572b0139 52{
53 //
54 // Setup the track cuts
55 //
56
164bfb53 57 //ESD quality cuts DielectronTrackCuts
48609e3d 58 if (!isAOD) {
59 diele->GetTrackFilter().AddCuts(SetupESDtrackCutsDieleData(cutDefinition));
164bfb53 60 } else {
61 AliDielectronTrackCuts *trackCuts=new AliDielectronTrackCuts("trackCuts","trackCuts");
48609e3d 62 if (cutDefinition==0)
bc75eeb5 63 trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
48609e3d 64 else if (cutDefinition==1)
bc75eeb5 65 trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
164bfb53 66 trackCuts->SetRequireTPCRefit(kTRUE);
67 trackCuts->SetRequireITSRefit(kTRUE);
48609e3d 68 diele->GetTrackFilter().AddCuts(trackCuts);
164bfb53 69 }
572b0139 70
bc75eeb5 71 //Pt cut ----------------------------------------------------------
72 AliDielectronVarCuts *pt = new AliDielectronVarCuts("ptCut","pt cut");
fb7d2d99 73 pt->AddCut(AliDielectronVarManager::kPt,1.,1e30);
74 pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
75
bc75eeb5 76 //AOD additions since there are no AliESDtrackCuts -----------------
77 //
48609e3d 78 if (isAOD){
bc75eeb5 79 // TPC #clusteres cut
ba15fdfb 80 pt->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);
fb7d2d99 81 pt->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
bc75eeb5 82 //TODO: DCA cuts to be investigated!!!
164bfb53 83// pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
84// pt->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
572b0139 85 }
48609e3d 86 diele->GetTrackFilter().AddCuts(pt);
bc75eeb5 87
88 // PID cuts --------------------------------------------------------
fb7d2d99 89 AliDielectronPID *pid = new AliDielectronPID("PID10","TPC nSigma |e|<3 + |Pi|>3 + |P|>3 + TOF nSigma |e|<3");
90 pid->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.);
1201a1a9 91 pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.,3.,0.,0.,kTRUE);
92 pid->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-20.,3.,0.,0.,kTRUE);
48609e3d 93 diele->GetTrackFilter().AddCuts(pid);
572b0139 94}
95
96//______________________________________________________________________________________
48609e3d 97void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
572b0139 98{
99 //
100 // Setup the pair cuts
101 //
102
164bfb53 103 //Invariant mass and rapidity selection
fb7d2d99 104 AliDielectronVarCuts *pairCut=new AliDielectronVarCuts("2<M<4+|Y|<.9","2<M<4 + |Y|<.9");
105// pairCut->AddCut(AliDielectronVarManager::kM,2.,4.);
106 pairCut->AddCut(AliDielectronVarManager::kY,-0.9,0.9);
48609e3d 107 diele->GetPairFilter().AddCuts(pairCut);
572b0139 108}
109
110//______________________________________________________________________________________
48609e3d 111AliESDtrackCuts *SetupESDtrackCutsDieleData(Int_t cutDefinition)
572b0139 112{
113 //
114 // Setup default AliESDtrackCuts
115 //
116 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;
ba15fdfb 117
61d106d3 118 // basic track quality cuts (basicQ)
572b0139 119 esdTrackCuts->SetMaxDCAToVertexZ(3.0);
61d106d3 120 esdTrackCuts->SetMaxDCAToVertexXY(1.0);
ba15fdfb 121
fb7d2d99 122 esdTrackCuts->SetEtaRange( -0.9 , 0.9 );
ba15fdfb 123
572b0139 124 esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
61d106d3 125 esdTrackCuts->SetRequireITSRefit(kTRUE);
126 esdTrackCuts->SetRequireTPCRefit(kTRUE);
ba15fdfb 127
128 esdTrackCuts->SetPtRange(.8,1e30);
129
130 esdTrackCuts->SetMinNClustersTPC(70);
572b0139 131 esdTrackCuts->SetMaxChi2PerClusterTPC(4);
fb7d2d99 132
133 // default SPD any
134 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
ba15fdfb 135
48609e3d 136 if (cutDefinition==0)
bc75eeb5 137 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
ba15fdfb 138
572b0139 139 return esdTrackCuts;
140}
141
61d106d3 142
572b0139 143//______________________________________________________________________________________
48609e3d 144void InitHistogramsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
572b0139 145{
146 //
61d106d3 147 // Initialise the histograms
572b0139 148 //
61d106d3 149
150 //Setup histogram Manager
48609e3d 151 AliDielectronHistos *histos=new AliDielectronHistos(diele->GetName(),diele->GetTitle());
572b0139 152
153 //Initialise histogram classes
154 histos->SetReservedWords("Track;Pair");
155
61d106d3 156 //Track classes
157 //to fill also track info from 2nd event loop until 2
572b0139 158 for (Int_t i=0; i<2; ++i){
159 histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));
160 }
161
61d106d3 162 //Pair classes
163 // to fill also mixed event histograms loop until 10
572b0139 164 for (Int_t i=0; i<3; ++i){
165 histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
166 }
61d106d3 167
168 //legs from pair
169 for (Int_t i=0; i<3; ++i){
170 histos->AddClass(Form("Track_Legs_%s",AliDielectron::PairClassName(i)));
572b0139 171 }
2a14a7b1 172 //track rotation
fb7d2d99 173// histos->AddClass(Form("Pair_%s",PairClassName(AliDielectron::kEv1PMRot)));
174// histos->AddClass(Form("Track_Legs_%s",PairClassName(AliDielectron::kEv1PMRot)));
2a14a7b1 175
572b0139 176
48609e3d 177 //add histograms to event class
fb7d2d99 178 if (cutDefinition==0) {
48609e3d 179 histos->AddClass("Event");
180 histos->UserHistogram("Event","VtxZ","Vertex Z;Z[cm]",300,-15.,15.,AliDielectronVarManager::kZvPrim);
181 }
182
572b0139 183 //add histograms to Track classes
61d106d3 184 histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",400,0,20.,AliDielectronVarManager::kPt);
185 histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTPC);
186
187 histos->UserHistogram("Track","dXY","dXY;dXY [cm];#tracks",500,-1.,1.,AliDielectronVarManager::kImpactParXY);
188 histos->UserHistogram("Track","dZ","dZ;dZ [cm];#tracks",600,-3.,3.,AliDielectronVarManager::kImpactParZ);
189 histos->UserHistogram("Track","Eta_Phi","Eta Phi Map; Eta; Phi;#tracks",
bc75eeb5 190 100,-1,1,144,0,6.285,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
61d106d3 191
572b0139 192 histos->UserHistogram("Track","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
bc75eeb5 193 200,0.2,20.,100,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
572b0139 194 histos->UserHistogram("Track","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons;#tracks",
bc75eeb5 195 200,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
61d106d3 196
572b0139 197 //add histograms to Pair classes
198 histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
61d106d3 199 201,-.01,4.01,AliDielectronVarManager::kM);
572b0139 200 histos->UserHistogram("Pair","Rapidity","Rapidity;Rapidity;#pairs",
61d106d3 201 100,-1.,1.,AliDielectronVarManager::kY);
572b0139 202 histos->UserHistogram("Pair","OpeningAngle","Opening angle;angle",
203 100,0.,3.15,AliDielectronVarManager::kOpeningAngle);
572b0139 204
48609e3d 205 diele->SetHistogramManager(histos);
572b0139 206}
207
208
48609e3d 209void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
572b0139 210{
211 //
212 // Setupd the CF Manager if needed
213 //
61d106d3 214
48609e3d 215 AliDielectronCF *cf=new AliDielectronCF(diele->GetName(),diele->GetTitle());
572b0139 216
217 //pair variables
fb7d2d99 218 cf->AddVariable(AliDielectronVarManager::kPt,"0.0, 1.0, 2.0, 3.0, 5., 7.0, 10.0, 100.0");
ba15fdfb 219
220 cf->AddVariable(AliDielectronVarManager::kY,"-5,-1,-0.9,-0.8,-0.7,-0.5,-0.3,0.3,0.5,0.7,0.8,0.9,1.0,5");
fb7d2d99 221 cf->AddVariable(AliDielectronVarManager::kM,125,0.,125*.04); //40Mev Steps
ba15fdfb 222 cf->AddVariable(AliDielectronVarManager::kPairType,"-0.5,0.5,1.5,2.5");
223 cf->AddVariable(AliDielectronVarManager::kThetaHE, "-2.0, -1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0, 2.0");
224 cf->AddVariable(AliDielectronVarManager::kThetaCS, "-2.0, -1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0, 2.0");
572b0139 225 //leg variables
ba15fdfb 226 cf->AddVariable(AliDielectronVarManager::kPt,"0.0, 0.8, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 100.0",kTRUE);
227 cf->AddVariable(AliDielectronVarManager::kNclsTPC,"0, 70, 75, 80, 85, 90, 100, 120, 160",kTRUE);
228 cf->AddVariable(AliDielectronVarManager::kEta,"-5,-1,-0.9,-0.85,-0.8,-0.75,0.75,0.8,0.85,0.9,1.0,5",kTRUE);
229
fb7d2d99 230// cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,"-2.5,-2,-1.5,-1,-0.5,4.",kTRUE);
1201a1a9 231 cf->AddVariable(AliDielectronVarManager::kTPCnSigmaPio,"3.,3.5,4.,100",kTRUE);
232 cf->AddVariable(AliDielectronVarManager::kTPCnSigmaPro,"3.,3.5,4.,100",kTRUE);
ba15fdfb 233
234 //event variables
235 cf->AddVariable(AliDielectronVarManager::kNaccTrcklts,"0.0, 9.0, 17.0, 25.0, 36.0, 55.0, 500.0");
236
237 if (!isAOD){
238 Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
239 if (hasMC){
240 cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
241 cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
242 cf->AddVariable(AliDielectronVarManager::kPdgCodeGrandMother,10000,-5000.5,4999.5,kTRUE);
243 }
244 }
245 //only in this case write MC truth info
246 if (cutDefinition==0){
247 cf->SetStepForMCtruth();
248 }
249
48609e3d 250 diele->SetCFManagerPair(cf);
61d106d3 251
572b0139 252}
61d106d3 253