new dielectron tasks from Remi
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / macrosLMEE / ConfigRemiLMEEPbPb2011AOD.C
1 //#include "PWGDQ/dielectron/macrosLMEE/LMEECutLib.C"
2
3 void InitHistograms(AliDielectron *die, Int_t cutDefinition);
4 void InitCF(AliDielectron* die, Int_t cutDefinition);
5 void EnableMC();
6
7 TString names=("noPairing;TPCTOFCentnoRej;TPCTOFSemiCent1noRej;TPCTOFSemiCent2noRej;TPCTOFPerinoRej;TPCTOFAllCentnoRej;TPCTOFCentRej;TPCTOFSemiCent1Rej;TPCTOFSemiCent2Rej;TPCTOFPeriRej;TPCTOFAllCentRej;");
8 TObjArray *arrNames=names.Tokenize(";");
9 const Int_t nDie=arrNames->GetEntries();
10
11 Bool_t MCenabled=kFALSE;
12
13
14 AliDielectron* ConfigRemiLMEEPbPb2011AOD(Int_t cutDefinition, Bool_t hasMC=kFALSE, Bool_t ESDanalysis=kFALSE)
15 {
16
17   Int_t selectedPID=-1;
18   Int_t selectedCentrality=-1;
19   Int_t selectedPairCut=-1;
20   Bool_t rejectionStep=kFALSE;
21   Bool_t PairCut=kFALSE;
22   LMEECutLibRemi*  LMCL = new LMEECutLibRemi();
23
24   //
25   // Setup the instance of AliDielectron
26   //
27
28   MCenabled=hasMC;
29
30   // create the actual framework object
31
32   TString name=Form("%02d",cutDefinition);
33   if ((cutDefinition)<arrNames->GetEntriesFast()){
34         name=arrNames->At((cutDefinition))->GetName();
35   }
36
37   //thisCut only relevant for MC:
38   AliDielectron *die =
39         new AliDielectron(Form
40                 ("%s",name.Data()),
41                 Form("Track cuts: %s",name.Data()));
42   //      die->SetZDCRecenteringFilename("/home/tanizaki/nfs/ZDCrpH1Recentering/ZDCRecenteringProfile.root");
43   //  die->SetZDCRecenteringFilename("alien:///alice/cern.ch/user/r/rtanizak/ZDCrpH1/ZDCRecentProf/ZDCRecenteringProfile.root")
44
45   //Setup AnalysisSelection:
46   if (cutDefinition==0) {
47         //not yet implemented
48   }
49   else if (cutDefinition==1) {
50     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
51     selectedCentrality = LMEECutLibRemi::kPbPb2011Central;
52     rejectionStep = kFALSE;
53     PairCut = kFALSE;
54
55   }
56   else if (cutDefinition==2) {
57     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
58     selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral1;
59     rejectionStep = kFALSE;
60     PairCut = kFALSE;
61
62   }
63   else if (cutDefinition==3) {
64     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
65     selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral2;
66     rejectionStep = kFALSE;
67     PairCut = kFALSE;
68
69   }
70   else if (cutDefinition==4) {
71     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
72     selectedCentrality = LMEECutLibRemi::kPbPb2011Peripheral;
73     rejectionStep = kFALSE;
74     PairCut = kFALSE;
75
76   }
77   else if (cutDefinition==5) {
78     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
79     selectedCentrality = LMEECutLibRemi::kPbPb2011AllCentral;
80     rejectionStep = kFALSE;
81     PairCut = kFALSE;
82
83   }
84
85   else if (cutDefinition==6) {
86         selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
87         selectedCentrality = LMEECutLibRemi::kPbPb2011Central;
88         rejectionStep = kFALSE;
89         PairCut = kTRUE;
90
91   }
92   else if (cutDefinition==7) {
93     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
94     selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral1;
95     rejectionStep = kFALSE;
96     PairCut = kTRUE;
97
98   }
99   else if (cutDefinition==8) {
100     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
101     selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral2;
102     rejectionStep = kFALSE;
103     PairCut = kTRUE;
104
105   }
106   else if (cutDefinition==9) {
107     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
108     selectedCentrality = LMEECutLibRemi::kPbPb2011Peripheral;
109     rejectionStep = kFALSE;
110     PairCut = kTRUE;
111
112   }
113   else if (cutDefinition==10) {
114     selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
115     selectedCentrality = LMEECutLibRemi::kPbPb2011AllCentral;
116     rejectionStep = kFALSE;
117     PairCut = kTRUE;
118
119   }
120
121   else {
122         cout << " =============================== " << endl;
123         cout << " ==== INVALID CONFIGURATION ==== " << endl;
124         cout << " =============================== " << endl;
125   }
126
127
128   //Now configure task
129
130   //Apply correct Pre-Filter Scheme, if necessary
131   die->SetPreFilterAllSigns();
132
133   //switch off KF PArticle:
134   die->SetUseKF(kFALSE);
135
136   if (selectedPID == LMEECutLibRemi::kPbPb2011NoPID) {
137           die->SetNoPairing();
138    }
139
140   if (rejectionStep) {
141     if (ESDanalysis) {
142       die->GetTrackFilter().AddCuts( LMCL->GetESDTrackCutsAna(selectedPID) );
143       die->GetPairPreFilterLegs().AddCuts( LMCL->GetESDTrackCutsAna(selectedPID) );
144     }
145
146     //die->GetTrackFilter().AddCuts(LMCL->GetPIDCutsPre(selectedPID) );
147     die->GetTrackFilter().AddCuts(LMCL->GetPIDCutsAna(selectedPID) );
148     die->GetPairPreFilterLegs().AddCuts(LMCL->GetPIDCutsAna(selectedPID) );
149     die->GetPairPreFilter().AddCuts(LMCL->GetPairCuts(selectedPID) );
150
151     //    if(PairCut){
152     //      die->GetPairFilter().AddCuts( LMCL->GetPairCutsInvMass(selectedPairCut));
153     //    }
154   }
155   else { //No Prefilter, no Pairfilter
156     
157     if (ESDanalysis) {
158       die->GetTrackFilter().AddCuts( LMCL->GetESDTrackCutsAna(selectedPID) );
159     }
160     
161     die->GetTrackFilter().AddCuts( LMCL->GetTrackCutsAna(selectedPID) );
162     die->GetTrackFilter().AddCuts( LMCL->GetPIDCutsAna(selectedPID) );
163     die->GetEventFilter().AddCuts(LMCL->GetCentralityCuts(selectedCentrality));
164     
165     //    if(PairCut){
166     //      die->GetPairFilter().AddCuts( LMCL->GetPairCutsInvMass(selectedPairCut));
167     //    }
168     die->GetPairFilter().AddCuts(LMCL->GetPairCuts2(selectedPID,kFALSE));
169     
170   }
171   //Introduce NULL-check for pp?
172   die->GetEventFilter().AddCuts(LMCL->GetCentralityCuts(selectedCentrality));
173
174
175
176
177   AliDielectronTrackRotator *rot= 0x0;
178   /*AliDielectronTrackRotator *rot= LMCL->GetTrackRotator(selectedPID);
179   die->SetTrackRotator(rot);
180    */
181   AliDielectronMixingHandler *mix=LMCL->GetMixingHandler(selectedPID);
182   die->SetMixingHandler(mix);
183
184   // histogram setup
185   // only if an AliDielectronHistos object is attached to the
186   // dielectron framework histograms will be filled
187   //
188   InitHistograms(die,cutDefinition);
189
190   // the last definition uses no cuts and only the QA histograms should be filled!
191 //  InitCF(die,cutDefinition);
192
193   return die;
194 }
195
196 //______________________________________________________________________________________
197
198 void InitHistograms(AliDielectron *die, Int_t cutDefinition)
199 {
200   //
201   // Initialise the histograms
202   //
203
204   //Setup histogram Manager
205   AliDielectronHistos *histos=
206         new AliDielectronHistos(die->GetName(),
207                 die->GetTitle());
208   //Initialise histogram classes
209   histos->SetReservedWords("Track;Pair;Pre;RejTrack;RejPair");
210
211   //Event class
212 //  if (cutDefinition==nDie-1) 
213                 histos->AddClass("Event");
214
215   //Track classes
216   //to fill also track info from 2nd event loop until 2
217   for (Int_t i=0; i<2; ++i){
218         histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));
219   }
220
221   //Pair classes
222   // to fill also mixed event histograms loop until 10
223   for (Int_t i=0; i<3; ++i){
224         histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
225   }
226
227   //ME and track rot
228   if (die->GetMixingHandler()) {
229         histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(3)));
230         histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(4)));
231         histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(6)));
232         histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(7)));
233   }
234   if (die->GetTrackRotator()) {
235         histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(10)));
236   }
237
238   //PreFilter Classes
239   //to fill also track info from 2nd event loop until 2
240   for (Int_t i=0; i<2; ++i){
241         histos->AddClass(Form("Pre_%s",AliDielectron::TrackClassName(i)));
242   }
243
244
245   //Create Classes for Rejected Tracks/Pairs:
246   for (Int_t i=0; i<2; ++i){
247         histos->AddClass(Form("RejTrack_%s",AliDielectron::TrackClassName(i)));
248   }
249   for (Int_t i=0; i<3; ++i){
250         histos->AddClass(Form("RejPair_%s",AliDielectron::PairClassName(i)));
251   }
252
253   /*
254   //track rotation
255
256   histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(AliDielectron::kEv1PMRot)));
257   histos->AddClass(Form("Track_Legs_%s",AliDielectron::PairClassName(AliDielectron::kEv1PMRot)));
258   */
259         //add histograms to event class
260         histos->UserHistogram("Event","nEvents","Number of processed events after cuts;Number events",
261                 1,0.,1.,AliDielectronVarManager::kNevents);
262         histos->UserHistogram("Event","Centrality","Centrality;Centrality [%]","0,10,20,40,80,100,101",
263                 AliDielectronVarManager::kCentrality);
264         /*        histos->UserHistogram("Event","v0ACrpH2","VZERO-AC;v0ACrpH2",
265                               100,-2.0,2.0,
266                               AliDielectronVarManager::kv0ACrpH2);
267         histos->UserHistogram("Event","v0ArpH2","VZERO-A;v0ArpH2",
268                               100,-2.0,2.0,
269                               AliDielectronVarManager::kv0ArpH2);
270         histos->UserHistogram("Event","v0CrpH2","VZERO-C;v0CrpH2",
271                               100,-2.0,2.0,
272                               AliDielectronVarManager::kv0CrpH2);
273         histos->UserHistogram("Event","v0ArpH2_vs_v0CrpH2","VZERO-A vs VZERO-C;v0ArpH2;v0CrpH2",
274                               100,-2.0,2.0,100, -2.0, 2.0,
275                               AliDielectronVarManager::kv0ArpH2,AliDielectronVarManager::kv0CrpH2);
276         //      histos->UserHistgram("Event","resov0ACrpH2","VZERO-A;v0ArpH2",
277         //                           100, -2.0,2.0, AliDielectronVarManager::kresov0ACrpH2);
278         */
279
280         histos->UserHistogram("Event","ZDCArpH1","ZDC-ZN-A;ZDCrpH1",
281                               100,-3.5,3.5,
282                               AliDielectronVarManager::kZDCArpH1);
283         /*        histos->UserHistogram("Event","ZDCrpResH1","ZDC;ZDCrpResH1",
284                               100,-3.5,3.5,
285                               AliDielectronVarManager::kZDCrpResH1);
286         histos->UserHistogram("Event","v0ZDCrpRes","ZDC;v0ZDCrpRes",
287                               100,-3.5,3.5,
288                               AliDielectronVarManager::kv0ZDCrpRes);
289         */
290         histos->UserProfile("Event","ZDCrpResH1Prof","ZDC;ZDCrpResH1",
291                             AliDielectronVarManager::kZDCrpResH1, 
292                             10, 0, 100,
293                               AliDielectronVarManager::kCentrality);
294     
295         histos->UserProfile("Event","v0ZDCrpResProf","ZDC;v0ZDCrpRes",
296                              AliDielectronVarManager::kv0ZDCrpRes,
297                              10, 0, 100,
298                             AliDielectronVarManager::kCentrality);
299         
300         
301         histos->UserHistogram("Event","RefMult","RefMultiplicity;Multiplixity",
302                               100,-3.5,3.5,
303                               AliDielectronVarManager::kRefMult);
304         histos->UserHistogram("Event","kXvPrim","VertexX;vertex_x",
305                               100,0.03,0.1,
306                               AliDielectronVarManager::kXvPrim);
307         histos->UserHistogram("Event","kYvPrim","VartexY;vertex_y",
308                               100,0.2,0.3,
309                               AliDielectronVarManager::kYvPrim);
310         
311
312
313         histos->UserHistogram("Pair","InvMassAllPairplaneMagInPro","Inner Product of Mag and ee plane vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
314                               1000, 0.0,1.0,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
315         histos->UserHistogram("Pair","InvMassLowPairplaneMagInPro","ee plane Mag component vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
316                               300, 0.0,0.03,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
317         histos->UserHistogram("Pair","InvMassMiddlePairplaneMagInPro","ee plane Mag component vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
318                                180,0.12, 0.3,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
319         histos->UserHistogram("Pair","InvMassHighPairplaneMagInPro","ee plane Mag component vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
320                                200, 0.3, 0.5,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
321
322
323         histos->UserHistogram("Pair","PtAllPairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
324                               500,0.0,10.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
325         histos->UserHistogram("Pair","PtLowPairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
326                               100,0.0,1.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
327         histos->UserHistogram("Pair","PtMiddlePairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
328                               100,1.0,2.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
329         histos->UserHistogram("Pair","PtHighPairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
330                               200,2.0,10.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
331
332
333         /*      histos->UserHistogram("Pair","AllInvMassPtPairplaneMagInPro","ee plane Mag component",
334                               1000,0.0 ,0.5,500,0.0,10.0,100,-2.0,2.0,
335                               AliDielectronVarManager::kM,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro,
336                               kFALSE,kFALSE,kFALSE,999);
337         */
338
339         
340         //              histos->UserHistogram("Pair","AllInvMassPtPairplaneMagInPro","ee plane Mag component vs Pt;Inv.Mass[GeV];Pt [GeV];Phi [rad]",
341         //                                    1000,0.0,0.5,500,0.0,10.0,100,-2.0,2.0,
342         //                                    AliDielectronVarManager::kM,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
343         
344
345   //add histograms to Track classes
346         /*  histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPt);
347   histos->UserHistogram("Track","Px","Px;Px [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPx);
348   histos->UserHistogram("Track","Py","Py;Py [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPy);
349   histos->UserHistogram("Track","Pz","Pz;Pz [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPz);
350   histos->UserHistogram("Track","P","P;P [GeV];#tracks",200,0,20.,AliDielectronVarManager::kP);
351         */
352   /*
353   histos->UserHistogram("Track","NclsSFracTPC","NclsSFracTPC; NclsSFracTPC;#tracks",200,0,10.,AliDielectronVarManager::kNclsSFracTPC);
354   histos->UserHistogram("Track","TPCclsDiff","TPCclsDiff; TPCclsDiff;#tracks",200,0,10.,AliDielectronVarManager::kTPCclsDiff);
355
356   histos->UserHistogram("Track","ITS_dEdx_P","ITS_dEdx;P [GeV];ITS signal (arb units);#tracks",
357           400,0.0,20.,1000,0.,1000.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal,kTRUE);
358
359   histos->UserHistogram("Track","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
360           400,0.0,20.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
361
362   histos->UserHistogram("Track","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons;#tracks",
363           400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
364   histos->UserHistogram("Track","TPCnSigmaKao_P","TPC number of sigmas Kaons;P [GeV];TPC number of sigmas Kaons;#tracks",
365           400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,kTRUE);
366   histos->UserHistogram("Track","TPCnSigmaPio_P","TPC number of sigmas Pions;P [GeV];TPC number of sigmas Pions;#tracks",
367           400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,kTRUE);
368
369   histos->UserHistogram("Track","TRDpidPobEle_P","TRD PID probability Electrons;P [GeV];TRD prob Electrons;#tracks",
370           400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobEle,kTRUE);
371   histos->UserHistogram("Track","TRDpidPobPio_P","TRD PID probability Pions;P [GeV];TRD prob Pions;#tracks",
372           400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobPio,kTRUE);
373
374   histos->UserHistogram("Track","TOFnSigmaKao_P","TOF number of sigmas Kaons;P [GeV];TOF number of sigmas Kaons;#tracks",
375           400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaKao,kTRUE);
376   histos->UserHistogram("Track","TOFnSigmaPro_P","TOF number of sigmas Protons;P [GeV];TOF number of sigmas Protons;#tracks",
377           400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaPro,kTRUE);
378
379   histos->UserHistogram("Track","TOFbeta","TOF beta;P [GeV];TOF beta;#tracks",
380           400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta,kTRUE);
381
382
383   histos->UserHistogram("Track","Eta","Eta; Eta;#tracks",
384           200,-2,2,AliDielectronVarManager::kEta);
385   histos->UserHistogram("Track","Phi","Phi; Phi;#tracks",
386           200,0.,3.15,AliDielectronVarManager::kPhi);
387
388   histos->UserHistogram("Track","Eta_Phi","Eta Phi Map; Eta; Phi;#tracks",
389           200,-2,2,200,0,3.15,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
390
391   histos->UserHistogram("Track","dXY_dZ","dXY dZ Map; dXY; dZ;#tracks",
392           200,-2,2,200,-2,2.,AliDielectronVarManager::kImpactParXY,AliDielectronVarManager::kImpactParZ);
393
394
395   histos->UserHistogram("Track","dXY","dXY;dXY [cm];#tracks",200,-2.,2.,AliDielectronVarManager::kImpactParXY);
396   histos->UserHistogram("Track","dZ","dZ;dZ [cm];#tracks",200,-2.,2.,AliDielectronVarManager::kImpactParZ);
397
398           histos->UserHistogram("Track","TPCcrossedRowsOverFindable","Number of Crossed Rows TPC over Findable;TPC crossed rows over findable;#tracks",100,0.,1.,AliDielectronVarManager::kNFclsTPCfCross);
399           histos->UserHistogram("Track","TPCcrossedRows","Number of Crossed Rows TPC;TPC crossed rows;#tracks",159,0.,159.,AliDielectronVarManager::kNFclsTPCr);
400           histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",159,0.,159.,AliDielectronVarManager::kNclsTPC);
401           histos->UserHistogram("Track","ITSnCls","Number of Clusters ITS;ITS number clusteres;#tracks",159,0.,159.,AliDielectronVarManager::kNclsITS);
402
403           histos->UserHistogram("Track","TPCchi2","TPC Chi2 value;TPC chi2;#tracks",100,0.,10.,AliDielectronVarManager::kTPCchi2Cl);
404           histos->UserHistogram("Track","ITSchi2","ITS Chi2 value;ITS chi2;#tracks",100,0.,10.,AliDielectronVarManager::kITSchi2Cl);
405
406           histos->UserHistogram("Track","TPCnCls_kNFclsTPCr","nTPC vs nTPCr;nTPC vs nTPCr;#tracks",159,0.,159.,159,0.,159.,AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kNFclsTPCr);
407
408           histos->UserHistogram("Track","kNFclsTPCr_pT","nTPCr vs pt;nTPCr vs pt;#tracks",159,0.,159.,200,0.,20.,AliDielectronVarManager::kNFclsTPCr,AliDielectronVarManager::kPt);
409
410   */
411           //add histograms to Pair classes
412           histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
413                   500,0.0,5.00,AliDielectronVarManager::kM);
414           histos->UserHistogram("Pair","Rapidity","Rapidity;Rapidity;#pairs",
415                   100,-2.,2.,AliDielectronVarManager::kY);
416           histos->UserHistogram("Pair","OpeningAngle","Opening angle;angle",
417                   100,0.,3.15,AliDielectronVarManager::kOpeningAngle);
418           //2D Histo Plot
419           histos->UserHistogram("Pair","InvMassPairPt","Inv.Mass vs PairPt;Inv. Mass [GeV], pT [GeV];#pairs",
420                   500,0.0,5.0,500,0.,50.,AliDielectronVarManager::kM,AliDielectronVarManager::kPt);
421
422           histos->UserHistogram("Pair","InvMassOpeningAngle","Opening Angle vs Inv.Mass;Inv. Mass [GeV];#pairs",
423                   500,0.0,5.0,200,0.,6.3,AliDielectronVarManager::kM,AliDielectronVarManager::kOpeningAngle);
424           /*
425           //add histograms to Track classes
426           histos->UserHistogram("Pre","Pt","Pt;Pt [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPt);
427
428           histos->UserHistogram("Pre","ITS_dEdx_P","ITS_dEdx;P [GeV];ITS signal (arb units);#tracks",
429                   400,0.0,20.,1000,0.,1000.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal,kTRUE);
430
431           histos->UserHistogram("Pre","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
432                   400,0.0,20.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
433
434
435           histos->UserHistogram("Pre","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons;#tracks",
436                   400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
437           histos->UserHistogram("Pre","TPCnSigmaKao_P","TPC number of sigmas Kaons;P [GeV];TPC number of sigmas Kaons;#tracks",
438                   400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,kTRUE);
439           histos->UserHistogram("Pre","TPCnSigmaPio_P","TPC number of sigmas Pions;P [GeV];TPC number of sigmas Pions;#tracks",
440                   400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,kTRUE);
441
442           histos->UserHistogram("Pre","TRDpidPobEle_P","TRD PID probability Electrons;P [GeV];TRD prob Electrons;#tracks",
443                   400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobEle,kTRUE);
444           histos->UserHistogram("Pre","TRDpidPobPio_P","TRD PID probability Pions;P [GeV];TRD prob Pions;#tracks",
445                   400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobPio,kTRUE);
446
447           histos->UserHistogram("Pre","TOFnSigmaKao_P","TOF number of sigmas Kaons;P [GeV];TOF number of sigmas Kaons;#tracks",
448                   400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaKao,kTRUE);
449           histos->UserHistogram("Pre","TOFnSigmaPro_P","TOF number of sigmas Protons;P [GeV];TOF number of sigmas Protons;#tracks",
450                   400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaPro,kTRUE);
451
452           histos->UserHistogram("Pre","Eta_Phi","Eta Phi Map; Eta; Phi;#tracks",
453                   200,-2,2,200,0,3.15,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
454
455           histos->UserHistogram("Pre","dXY","dXY;dXY [cm];#tracks",200,-2.,2.,AliDielectronVarManager::kImpactParXY);
456
457   histos->UserHistogram("Pre","ZVertex ","ZVertex ;ZVertex[cm];#tracks",20,-20,20,AliDielectronVarManager::kZv);
458   histos->UserHistogram("Pre","XVertex ","XVertex ;XVertex[cm];#tracks",20,-20,20,AliDielectronVarManager::kXv);
459   histos->UserHistogram("Pre","YVertex ","YVertex ;YVertex[cm];#tracks",20,-20,20,AliDielectronVarManager::kYv);
460
461   histos->UserHistogram("Pre","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",159,0.,159.,AliDielectronVarManager::kNclsTPC);
462           */
463   //add histograms to Pair classes For Rejected Pairs:
464   die->SetHistogramManager(histos);
465 }
466
467
468 void InitCF(AliDielectron* die, Int_t cutDefinition)
469 {
470   //
471   // Setupd the CF Manager if needed
472   //
473   AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
474
475   //pair variables
476   cf->AddVariable(AliDielectronVarManager::kP,200,0,20);
477   cf->AddVariable(AliDielectronVarManager::kM,201,-0.01,4.01); //20Mev Steps
478   cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);
479
480   cf->AddVariable(AliDielectronVarManager::kCentrality,"0.,10.0,30.0,40.0,60.,80.,100.");
481
482   //leg variables
483   cf->AddVariable(AliDielectronVarManager::kP,200,0.,20.,kTRUE);
484     cf->AddVariable(AliDielectronVarManager::kITSsignal,1000,0.0.,1000.,kTRUE);
485   cf->AddVariable(AliDielectronVarManager::kTPCsignal,500,0.0.,500.,kTRUE);
486   cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10,kTRUE);
487
488   //only in this case write MC truth info
489   if (MCenabled) {
490         cf->SetStepForMCtruth();
491         cf->SetStepsForMCtruthOnly();
492         cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
493         cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
494   }
495
496   cf->SetStepsForSignal();
497   die->SetCFManagerPair(cf);
498 }
499
500 //--------------------------------------
501 void EnableMC() {
502   MCenabled=kTRUE;
503 }
504