]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/macrosLMEE/LMEECutLibTaku.C
update from pr task : sjena
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / macrosLMEE / LMEECutLibTaku.C
1 class LMEECutLibTaku {
2
3   public:
4   static  enum LMMECutSet {
5     kPbPb2011TPCandTOF,  //TOF required
6     kPbPb2011TPCandTOFwide, //TOF required, more relaxed cut on TPC
7     kPbPb2011TPCorTOF,
8     kpp2010TPCandTOF,
9     kpp2010TPCorTOF,
10     kCUTSETMAX
11   };
12   
13   static  enum LMMECentSel {
14     kPbPb2011Central,
15     kPbPb2011SemiCentral1,
16     kPbPb2011SemiCentral2,
17     kPbPb2011Peripheral,
18     kCENTSELMAX
19   };
20   
21
22   static  enum LMMEPairCutSet {
23     kPbPb2011Mass,  //Mass cut 
24     kPbPb2011OP,  //Opening angle cut    
25     kPbPb2011Phiv,  //Phiv cut
26     kPAIRCUTSETMAX
27   };
28
29   
30   //char* LMEECutNames[kCUTSETMAX] = { "PbPb2011TPCandTOF","PbPb2011TPCorTOF"};
31   
32   Bool_t useMC;
33   
34   
35   LMEECutLib() {useMC=kFALSE;}
36   
37   AliDielectronEventCuts*     GetEventCuts(Int_t cutSet);
38   AliAnalysisCuts*            GetCentralityCuts(Int_t centSel);
39   AliDielectronTrackRotator*  GetTrackRotator(Int_t cutSet);
40   AliDielectronMixingHandler* GetMixingHandler(Int_t cutSet);
41   
42   AliAnalysisCuts* GetPIDCutsAna(Int_t cutSet);  
43   AliAnalysisCuts* GetPIDCutsPre(Int_t cutSet);  
44   
45   AliAnalysisCuts* GetPairCuts(Int_t cutSet);  
46   AliAnalysisCuts* GetPairPreFilterCuts(Int_t cutSet);  
47   
48   AliAnalysisCuts* GetTrackCutsAna(Int_t cutSet);  
49   AliAnalysisCuts* GetTrackCutsPre(Int_t cutSet);  
50   
51   void SetMCFlag( Bool_t isMC=kTRUE) {useMC=isMC;}
52   
53
54
55
56   AliDielectronEventCuts* GetEventCuts(Int_t cutSet) {
57     AliDielectronEventCuts* eventCuts = 0x0;
58     switch (cutSet) {
59     case kPbPb2011TPCandTOF :
60     case kPbPb2011TPCandTOFwide :
61     case kPbPb2011TPCorTOF  :
62     case kpp2010TPCandTOF :
63     case kpp2010TPCorTOF  :
64       eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
65       eventCuts->SetRequireVertex();
66       eventCuts->SetMinVtxContributors(1);
67       eventCuts->SetVertexZ(-10.,10.);
68       break;
69     default: cout << "No Event Cut defined" << endl;
70     }
71     return eventCuts;
72   }
73   
74   AliAnalysisCuts* GetCentralityCuts(Int_t centSel) {
75     AliDielectronVarCuts* centCuts = 0x0;
76     switch (centSel) {
77     case kPbPb2011Central:
78       centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011Central");
79       centCuts->AddCut(AliDielectronVarManager::kCentrality,0.,10.);
80       break;
81     case kPbPb2011SemiCentral1:
82       centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011SemiCentral1");
83       centCuts->AddCut(AliDielectronVarManager::kCentrality,10.,30.);
84       break;
85     case kPbPb2011SemiCentral2:
86       centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011SemiCentral2");
87       centCuts->AddCut(AliDielectronVarManager::kCentrality,30.,50.);
88       break;
89     case kPbPb2011Peripheral:
90       centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011Peripheral");
91       centCuts->AddCut(AliDielectronVarManager::kCentrality,50.,90.);
92       break;
93     default: cout << "No Centrality selected" << endl;
94     }
95     return centCuts;
96   }
97   
98   
99   AliDielectronTrackRotator* GetTrackRotator(Int_t cutSet) {
100     AliDielectronTrackRotator* trackRotator = 0x0;
101     switch (cutSet) {
102     case kPbPb2011TPCandTOF :
103     case kPbPb2011TPCandTOFwide :
104     case kPbPb2011TPCorTOF  :
105     case kpp2010TPCandTOF :
106     case kpp2010TPCorTOF  :
107       trackRotator = new AliDielectronTrackRotator();
108       trackRotator->SetIterations(20);
109       trackRotator->SetConeAnglePhi(TMath::Pi()/180*165);
110       trackRotator->SetStartAnglePhi(TMath::Pi());
111       break;
112     default: cout << "No Rotator defined" << endl;
113     }
114     return trackRotator;
115   }
116   
117
118   AliDielectronMixingHandler* GetMixingHandler(Int_t cutSet) {
119     AliDielectronMixingHandler* mixingHandler = 0x0;
120     switch (cutSet) {
121     case kPbPb2011TPCandTOF :
122     case kPbPb2011TPCandTOFwide :
123     case kPbPb2011TPCorTOF  :
124       mixingHandler = new AliDielectronMixingHandler;
125       mixingHandler->AddVariable(AliDielectronVarManager::kZvPrim,"-10,-5,0,5,10");
126       mixingHandler->AddVariable(AliDielectronVarManager::kCentrality,"0,5,10,20,40,80,100");
127       mixingHandler->AddVariable(AliDielectronVarManager::kv0ACrpH2,"-6*(TMath::Pi()/6),-5*(TMath::Pi()/6),-4*(TMath::Pi()/6),-3*(TMath::Pi()/6),-2*(TMath::Pi()/6),-1*(TMath::Pi()/6),0,1*(TMath::Pi()/6),2*(TMath::Pi()/6),3*(TMath::Pi()/6),4*(TMath::Pi()/6),5*(TMath::Pi()/6),6*(TMath::Pi()/6)");
128       //mixingHandler->SetDepth(50);
129       mixingHandler->SetDepth(15);
130       mixingHandler->SetMixType(AliDielectronMixingHandler::kAll);
131       break;
132     case kpp2010TPCandTOF :
133     case kpp2010TPCorTOF  :
134       mixingHandler = new AliDielectronMixingHandler;
135       mixingHandler->AddVariable(AliDielectronVarManager::kZvPrim,"-10,-5,0,5,10");
136       mixingHandler->AddVariable(AliDielectronVarManager::kNacc,"0,10000");
137       //might want to add multiplicity?
138       mixingHandler->SetDepth(25);
139       mixingHandler->SetMixType(AliDielectronMixingHandler::kAll);
140       break;
141     default: cout << "No Mixing Handler defined" << endl;
142     }
143     return mixingHandler;
144   }
145
146
147   AliAnalysisCuts* GetPIDCutsAna(Int_t cutSet) {
148     AliAnalysisCuts* anaCuts=0x0;
149     
150     // + [2] added for Dec2010 Cut! 
151     TF1 *lowerCut = new TF1("lowerCut", "[0] * TMath::Exp([1]*x) + [2]", 0, 20);
152           /* until Nov2010
153                  lowerCut->SetParameter(0, -2.7);
154                  lowerCut->SetParameter(1, -0.4357);
155            */
156           /* 18.01.2011 ALiHFEpid.cxx */
157     lowerCut->SetParameter(0,-3.7);
158     lowerCut->SetParameter(1,-0.8);
159     lowerCut->SetParameter(2,-0.35);
160     
161     if (useMC) { //overwrite parameters
162       lowerCut->SetParameter(0,-2.5);
163       lowerCut->SetParameter(2,-2.2);
164     }
165     
166     //---------------------------------------------
167     AliDielectronPID *pidTPCTOFeOnly = new AliDielectronPID("TPC-TOF","TPC-TOF");
168     pidTPCTOFeOnly->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3. ,3.,0.0,100.,kFALSE);
169     pidTPCTOFeOnly->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.0 , 100., kFALSE );
170     
171     AliDielectronPID *pidTPCandTOF = new AliDielectronPID("TPC-TOF-HFE","TPC-TOF-HFE");
172     pidTPCandTOF->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.,0.0,100.,kFALSE);
173     pidTPCandTOF->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.,3.,0.,100.,kTRUE);
174     pidTPCandTOF->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.0 , 100., kFALSE );
175     
176     AliDielectronPID *pidTPChardTOF = new AliDielectronPID("TPC-TOF-HFE","TPC-TOF-HFE");
177     pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,lowerCut,3.,0.0,100.,kFALSE);
178     pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.,3.,0.,100.,kTRUE);
179     pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-3.,3.,0.,100.,kTRUE);
180     pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kKaon,-3.,3.,0.,100.,kTRUE);
181     pidTPChardTOF->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.0 , 100., kFALSE );
182     //___________________________________________
183     AliDielectronPID *pidTT = new AliDielectronPID("TPC-TOF","TPC-TOF");
184     pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-1.5,3.,0.2,0.4,kFALSE);
185     pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3,3.,0.4,100.,kFALSE);
186     pidTT->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.2 , 100., kFALSE );
187     
188     pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3,3.,0.,100.,kTRUE);
189     pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-3.,3.,0.,100.,kTRUE);
190     pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kKaon,-3.,3.,0.,100.,kTRUE);
191     //___________________________________________
192     AliDielectronVarCuts *pidTPCsignal = new AliDielectronVarCuts("pidTPCsignal","cut on the TPC signal");
193     if (useMC) {
194       pidTPCsignal->AddCut(AliDielectronVarManager::kTPCsignal,65.,85.); 
195     }
196     else {
197       pidTPCsignal->AddCut(AliDielectronVarManager::kTPCsignal,75.,90.); 
198     }
199     //___________________________________________
200     AliDielectronVarCuts *pidTPCsignalWide = new AliDielectronVarCuts("pidTPCsignalWide","cut on the TPC signal");
201     pidTPCsignalWide->AddCut(AliDielectronVarManager::kTPCsignal,70.,90.); 
202     //___________________________________________
203     
204     AliDielectronVarCuts *pTPC = new AliDielectronVarCuts("Py>.4","Py>.4");
205     pTPC->AddCut(AliDielectronVarManager::kPt,.4,5.);
206     
207     AliDielectronVarCuts *pMin = new AliDielectronVarCuts("P>.2","P>.2");
208     pMin->AddCut(AliDielectronVarManager::kPt,.2,5.);
209     
210     switch (cutSet) {
211     case kPbPb2011TPCandTOF :
212       AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
213       cgSecondTrackFilterPIDTPC1->AddCut(pTPC);
214       cgSecondTrackFilterPIDTPC1->AddCut(pidTPCandTOF);
215       cgSecondTrackFilterPIDTPC1->AddCut(pidTPCsignal);
216       cgSecondTrackFilterPIDTPC1->AddCut(GetTrackCutsAna(cutSet));
217       anaCuts = cgSecondTrackFilterPIDTPC1;
218       break;
219     case kPbPb2011TPCandTOFwide :
220       AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
221       cgSecondTrackFilterPIDTPC1->AddCut(pTPC);
222       cgSecondTrackFilterPIDTPC1->AddCut(pidTPCandTOF);
223       cgSecondTrackFilterPIDTPC1->AddCut(pidTPCsignalWide);
224       cgSecondTrackFilterPIDTPC1->AddCut(GetTrackCutsAna(cutSet));
225       anaCuts = cgSecondTrackFilterPIDTPC1;
226       break;
227     case kPbPb2011TPCorTOF  :
228       AliDielectronCutGroup* cgSecondTrackFilterPIDTPC2 = new AliDielectronCutGroup("cgPIDTPC2","cgPIDTPC2",AliDielectronCutGroup::kCompAND);
229       cgSecondTrackFilterPIDTPC2->AddCut(pMin);
230       cgSecondTrackFilterPIDTPC2->AddCut(pidTT);
231       cgSecondTrackFilterPIDTPC2->AddCut(pidTPCsignal);
232       cgSecondTrackFilterPIDTPC2->AddCut(GetTrackCutsAna(cutSet));
233       anaCuts = cgSecondTrackFilterPIDTPC2;
234       break;
235     case kpp2010TPCandTOF :
236       AliDielectronCutGroup* cgSecondTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
237       cgSecondTrackFilterPIDTPC->AddCut(pTPC);
238       //cgSecondTrackFilterPIDTPC->AddCut(pidTPChardTOF);
239       cgSecondTrackFilterPIDTPC->AddCut(pidTPCandTOF);
240       cgSecondTrackFilterPIDTPC->AddCut(pidTPCTOFeOnly);
241       cgSecondTrackFilterPIDTPC->AddCut(GetTrackCutsAna(cutSet));
242       anaCuts = cgSecondTrackFilterPIDTPC;
243       break;
244     case kpp2010TPCorTOF  :
245       AliDielectronCutGroup* cgSecondTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
246       cgSecondTrackFilterPIDTPC->AddCut(pMin);
247       cgSecondTrackFilterPIDTPC->AddCut(pidTT);
248       cgSecondTrackFilterPIDTPC->AddCut(GetTrackCutsAna(cutSet));
249       anaCuts = cgSecondTrackFilterPIDTPC;
250       break;
251     default: cout << "No Analysis PID Cut defined " << endl;
252     }
253     return anaCuts;
254   }
255   
256   AliAnalysisCuts* GetPIDCutsPre(Int_t cutSet) {
257     AliAnalysisCuts* anaCuts=0x0;
258     switch (cutSet) {
259     case kPbPb2011TPCandTOF :
260     case kPbPb2011TPCandTOFwide :
261     case kPbPb2011TPCorTOF  :
262     case kpp2010TPCandTOF :
263     case kpp2010TPCorTOF  :
264       AliDielectronCutGroup* cgSecondTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
265       AliDielectronCutGroup* cgITSTPC = new AliDielectronCutGroup("cgITSTPC","cgITSTPC",AliDielectronCutGroup::kCompAND);
266       AliDielectronPID *pidITSTPC = new AliDielectronPID("TPCpre","TPCpre");
267       pidITSTPC->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.);
268       cgITSTPC->AddCut(pidITSTPC);
269       cgITSTPC->AddCut(GetTrackCutsAna(cutSet));
270       
271       AliDielectronCutGroup* cgITSSA = new AliDielectronCutGroup("cgITSSA","cgITSSA",AliDielectronCutGroup::kCompAND);
272       AliDielectronPID *pidITSSA = new  AliDielectronPID("pidITSSA","pidITSSA");
273       pidITSSA->AddCut(AliDielectronPID::kITS,AliPID::kElectron,-3.,3.);
274       cgITSSA->AddCut(pidITSSA);
275       cgITSSA->AddCut(GetTrackCutsPre(cutSet));
276       
277       AliDielectronCutGroup* cgInitialTrackFilter = new AliDielectronCutGroup("cgInitialTrackFilter","cgInitialTrackFilter",AliDielectronCutGroup::kCompOR);
278       cgInitialTrackFilter->AddCut(cgITSTPC);
279       cgInitialTrackFilter->AddCut(cgITSSA);
280       anaCuts = cgInitialTrackFilter;
281       break;
282     default: cout << "No Pre-PID Cut defined " << endl;
283     }
284     return anaCuts;
285   }
286   
287   /*  
288   AliAnalysisCuts* GetPairCuts(Int_t cutSet)  {  
289     AliDielectronVarCuts* pairCuts=0x0;
290     switch (cutSet) {
291     case kPbPb2011TPCorTOF  :
292     case kpp2010TPCandTOF :
293       pairCuts = new AliDielectronVarCuts("InvMass","InvMass > 150 MeV");
294       pairCuts->AddCut(AliDielectronVarManager::kM,0.15,100.,kTRUE);
295       break;
296     case kPbPb2011TPCandTOF :
297     case kPbPb2011TPCandTOFwide :
298     case kpp2010TPCorTOF  :
299       pairCuts =new AliDielectronVarCuts("OpeningAngle","Opening angle > .035rad");
300       pairCuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.035);
301       break;
302     default: cout << "No Pair Cuts defined " << endl;
303     } 
304     return pairCuts;
305   }
306   */
307
308   AliAnalysisCuts* GetPairCuts(Int_t cutSet) {                                                                                 
309     AliDielectronVarCuts* pairCuts=0x0;
310     switch (cutSet) {                             
311     case kPbPb2011Mass:
312       pairCuts = new AliDielectronVarCuts("InvMass","InvMass > 150 MeV");     
313       pairCuts->AddCut(AliDielectronVarManager::kM, 0.15,100.);          
314       break;
315     case kPbPb2011OP:
316       pairCuts =new AliDielectronVarCuts("OpeningAngle","Opening angle > .035rad"); 
317       pairCuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.035, kTRUE); ///exclude 
318       break;
319     case kPbPb2011Phiv:
320       pairCuts =new AliDielectronVarCuts("Phiv Cuts","Phiv<2.0rad"); 
321       pairCuts->SetCutType(AliDielectronVarCuts::kAny);
322       pairCuts->AddCut(AliDielectronVarManager::kPhivPair, 0.0, 2.0);
323       pairCuts->AddCut(AliDielectronVarManager::kM, 0.15, 100.0);
324       break;
325     default: cout << "No Pair Cuts defined " << endl;                                                                        
326     }                                                                                                                       
327     return pairCuts; 
328   }
329
330
331   //// for the pairprefilter
332   //// this cut is defined to "reject" pairs 
333   //// for the paircuts, defintion is based on "accept" pairs.
334   AliAnalysisCuts* GetPairPreFilterCuts(Int_t cutSet) {                                                                                 
335     AliDielectronVarCuts* pairCuts=0x0;
336     switch (cutSet) {                             
337     case kPbPb2011Mass:
338       pairCuts = new AliDielectronVarCuts("InvMass","InvMass > 150 MeV");     
339       pairCuts->AddCut(AliDielectronVarManager::kM, 0.15,100.,kTRUE);          
340       break;
341     case kPbPb2011OP:
342       pairCuts =new AliDielectronVarCuts("OpeningAngle","Opening angle > .035rad"); 
343       pairCuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.035);
344       break;
345     case kPbPb2011Phiv:
346       pairCuts =new AliDielectronVarCuts("Phiv Cut and Mee Cut","Phiv<2.0rad"); 
347       pairCuts->AddCut(AliDielectronVarManager::kPhivPair, 2.0, TMath::ACos(-1.0));
348       pairCuts->AddCut(AliDielectronVarManager::kM, 0, 0.15);          
349       break;
350     default: cout << "No Pair Cuts defined " << endl;                                                                        
351     }                                                                                                                       
352     return pairCuts; 
353   }
354
355
356   AliAnalysisCuts* GetTrackCutsAna(Int_t cutSet) {
357     AliESDtrackCuts* trackCuts=0x0;
358     switch (cutSet) {
359     case kPbPb2011TPCandTOF :
360     case kPbPb2011TPCandTOFwide :
361     case kPbPb2011TPCorTOF  :
362     case kpp2010TPCandTOF :
363     case kpp2010TPCorTOF  :
364       trackCuts = new AliESDtrackCuts();
365       trackCuts->SetDCAToVertex2D(kTRUE);
366       trackCuts->SetMaxDCAToVertexZ(3.0);
367       trackCuts->SetMaxDCAToVertexXY(1.0);
368       //trackCuts->SetMaxNsigmaToVertex(3.0); 
369       trackCuts->SetPtRange(  0.05 , 200.0);
370       trackCuts->SetEtaRange( -0.84 , 0.84 );
371       trackCuts->SetAcceptKinkDaughters(kFALSE);
372       trackCuts->SetRequireITSRefit(kTRUE);
373       trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
374       trackCuts->SetMinNClustersITS(3);
375       trackCuts->SetRequireTPCRefit(kTRUE);
376       //trackCuts->SetMinNClustersTPC(60);
377       trackCuts->SetMinNCrossedRowsTPC(110);
378       trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.7);
379       trackCuts->SetMaxChi2PerClusterTPC(3.5);
380       //trackCuts->SetMaxChi2PerClusterITS(6);
381       break;
382     default: cout << "No Analysis Track Cut defined " << endl;
383     }
384     return trackCuts;
385   } 
386   
387   AliAnalysisCuts* GetTrackCutsPre(Int_t cutSet) {
388     AliESDtrackCuts* trackCuts=0x0;
389     switch (cutSet) {
390     case kPbPb2011TPCandTOF :
391     case kPbPb2011TPCandTOFwide :
392     case kPbPb2011TPCorTOF  :
393     case kpp2010TPCandTOF :
394     case kpp2010TPCorTOF  :
395       trackCuts = new AliESDtrackCuts();
396       trackCuts->SetDCAToVertex2D(kTRUE);
397       trackCuts->SetMaxDCAToVertexZ(3.0);
398       trackCuts->SetMaxDCAToVertexXY(1.0);
399       trackCuts->SetEtaRange( -0.84 , 0.84 );
400       trackCuts->SetPtRange(  0.05 , 0.5);
401       trackCuts->SetAcceptKinkDaughters(kFALSE);
402       trackCuts->SetRequireITSRefit(kTRUE);
403       trackCuts->SetRequireITSStandAlone(kTRUE);
404       trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
405       trackCuts->SetMinNClustersITS(3); //PhotonGroup-Dalitz: 2?!
406       break;
407     default: cout << "No Pre-Track Cut defined " << endl;
408     }
409     return trackCuts;
410   }
411
412 };