New version of task for prompt charm fraction analysis (A. Rossi)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisTaskSECharmFraction.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /////////////////////////////////////////////////////////////
17 //
18 // Class AliAnalysisTaskSECharmFraction
19 // AliAnalysisTaskSE for the extraction of the fraction of prompt charm
20 // using the charm hadron impact parameter to the primary vertex
21 //
22 // Author: Andrea Rossi, andrea.rossi@ts.infn.it
23 /////////////////////////////////////////////////////////////
24
25 #include <TChain.h>
26 #include <TTree.h>
27 #include <TH1F.h>
28 #include <TH2F.h>
29 #include <TCanvas.h>
30 #include <TDatabasePDG.h>
31 #include <TMath.h>
32 #include <TROOT.h>
33 #include "AliAnalysisTaskSE.h"
34 #include "AliAnalysisManager.h"
35 #include "AliAODEvent.h"
36 #include "AliAODInputHandler.h"
37 #include "AliAnalysisVertexingHF.h"
38 #include "AliAODRecoDecayHF2Prong.h"
39 #include "AliAODRecoDecayHF.h"
40 #include "AliAODRecoDecay.h"
41 #include "AliAODTrack.h"
42 #include "AliAODVertex.h"
43 #include "AliAODMCParticle.h"
44 #include "AliAODMCHeader.h"
45 #include "AliAnalysisTaskSECharmFraction.h"
46
47 ClassImp(AliAnalysisTaskSECharmFraction)
48  
49 //________________________________________________________________________
50   AliAnalysisTaskSECharmFraction::AliAnalysisTaskSECharmFraction() 
51     : AliAnalysisTaskSE(),
52       fVHFloose(0),
53       fVHFtight(0),
54       fmD0PDG(),
55       fnbins(),
56       fptbins(0),
57       fsignalInvMassCut(),
58       flargeInvMassCut(),
59       fsidebandInvMassCut(),
60       fsidebandInvMassWindow(),
61       fUseMC(kTRUE),
62       fNentries(0),
63       fSignalType(0),
64       fSignalTypeLsCuts(0),
65       fSignalTypeTghCuts(0),
66       flist_NoCuts_Signal(0),
67       flist_NoCuts_Back(0),
68       flist_NoCuts_FromB(0),
69       flist_NoCuts_FromDstar(0),
70       flist_NoCuts_Other(0),
71       flist_LsCuts_Signal(0),
72       flist_LsCuts_Back(0),
73       flist_LsCuts_FromB(0),
74       flist_LsCuts_FromDstar(0),
75       flist_LsCuts_Other(0),
76       flist_TghCuts_Signal(0),
77       flist_TghCuts_Back(0),
78       flist_TghCuts_FromB(0),
79       flist_TghCuts_FromDstar(0),
80       flist_TghCuts_Other(0)
81    
82 {
83   //Default constructor
84 }
85 //________________________________________________________________________
86   AliAnalysisTaskSECharmFraction::AliAnalysisTaskSECharmFraction(const char *name) 
87     : AliAnalysisTaskSE(name),
88       fVHFloose(0),
89       fVHFtight(0),
90       fmD0PDG(),
91       fnbins(),
92       fptbins(0),
93       fsignalInvMassCut(),
94       flargeInvMassCut(),
95       fsidebandInvMassCut(),
96       fsidebandInvMassWindow(),
97       fUseMC(kTRUE),
98       fNentries(0),
99       fSignalType(0),
100       fSignalTypeLsCuts(0),
101       fSignalTypeTghCuts(0),
102       flist_NoCuts_Signal(0),
103       flist_NoCuts_Back(0),
104       flist_NoCuts_FromB(0),
105       flist_NoCuts_FromDstar(0),
106       flist_NoCuts_Other(0),
107       flist_LsCuts_Signal(0),
108       flist_LsCuts_Back(0),
109       flist_LsCuts_FromB(0),
110       flist_LsCuts_FromDstar(0),
111       flist_LsCuts_Other(0),
112       flist_TghCuts_Signal(0),
113       flist_TghCuts_Back(0),
114       flist_TghCuts_FromB(0),
115       flist_TghCuts_FromDstar(0),
116       flist_TghCuts_Other(0)
117    
118 {
119   // Constructor
120  
121   // Define input and output slots here
122   // Input slot #0 works with a TChain
123   // Output slot #0 writes into a TH1 container
124
125   //Standard pt bin
126   fnbins=4;
127   fptbins=new Double_t[fnbins+1];
128   fptbins[0]=0.;
129   fptbins[1]=1.;
130   fptbins[2]=3.;
131   fptbins[3]=5.;
132   fptbins[4]=1000.;
133
134   SetStandardMassSelection();
135   DefineOutput(1, TH1F::Class());
136   DefineOutput(2, TH1F::Class());
137   DefineOutput(3, TH1F::Class());
138   DefineOutput(4, TH1F::Class());
139   for(Int_t j=5;j<20;j++){
140     DefineOutput(j, TList::Class());
141   }
142
143
144 }
145
146
147 AliAnalysisTaskSECharmFraction::AliAnalysisTaskSECharmFraction(const char *name,Int_t nptbins,Double_t *ptbins) 
148   : AliAnalysisTaskSE(name),
149     fVHFloose(0),
150     fVHFtight(0),
151     fmD0PDG(),
152     fnbins(),
153     fptbins(0),
154     fsignalInvMassCut(),
155     flargeInvMassCut(),
156     fsidebandInvMassCut(),
157     fsidebandInvMassWindow(),
158     fUseMC(kTRUE),
159     fNentries(0),
160     fSignalType(0),
161     fSignalTypeLsCuts(0),
162     fSignalTypeTghCuts(0),
163     flist_NoCuts_Signal(0),
164     flist_NoCuts_Back(0),
165     flist_NoCuts_FromB(0),
166     flist_NoCuts_FromDstar(0),
167     flist_NoCuts_Other(0),
168     flist_LsCuts_Signal(0),
169     flist_LsCuts_Back(0),
170     flist_LsCuts_FromB(0),
171     flist_LsCuts_FromDstar(0),
172     flist_LsCuts_Other(0),
173     flist_TghCuts_Signal(0),
174     flist_TghCuts_Back(0),
175     flist_TghCuts_FromB(0),
176     flist_TghCuts_FromDstar(0),
177     flist_TghCuts_Other(0)
178 {
179   // Constructor
180   // ptbins must be of dimension nptbins +1
181   
182   SetNPtBins(nptbins,ptbins);
183   SetStandardMassSelection();
184   // Define input and output slots here
185  
186   // Output slot #0 writes into a TH1 container
187   DefineOutput(1, TH1F::Class());
188   DefineOutput(2, TH1F::Class());
189   DefineOutput(3, TH1F::Class());
190   DefineOutput(4, TH1F::Class());
191   for(Int_t j=5;j<20;j++){
192
193     DefineOutput(j, TList::Class());
194   }
195
196  
197 }
198
199 //________________________________________________________________________
200 AliAnalysisTaskSECharmFraction::~AliAnalysisTaskSECharmFraction()
201 { //Destructor 
202   
203   if (fVHFtight) {
204     delete fVHFtight;
205     fVHFtight = 0;
206   }
207   if (fVHFloose) {
208     delete fVHFloose;
209     fVHFloose = 0;
210   }
211   if (fNentries) {
212     delete fNentries;
213     fNentries = 0;
214   }   
215   if (fSignalType) {
216     delete fSignalType;
217     fSignalType = 0;
218   } 
219   if (fSignalTypeLsCuts) {
220     delete fSignalTypeLsCuts;
221     fSignalTypeLsCuts = 0;
222   } 
223   if (fSignalTypeTghCuts) {
224     delete fSignalTypeTghCuts;
225     fSignalTypeTghCuts = 0;
226   } 
227   if(flist_NoCuts_Signal){
228     delete flist_NoCuts_Signal;
229     flist_NoCuts_Signal=0;
230   }
231   if(flist_NoCuts_Back){
232     delete flist_NoCuts_Back;
233     flist_NoCuts_Back=0;
234   }
235   if(flist_NoCuts_FromB){
236     delete flist_NoCuts_FromB;
237     flist_NoCuts_FromB=0;
238   }
239   if(flist_NoCuts_FromDstar){
240     delete flist_NoCuts_FromDstar;
241     flist_NoCuts_FromDstar=0;
242   }
243   if(flist_NoCuts_Other){
244     delete flist_NoCuts_Other;
245     flist_NoCuts_Other=0;
246   }
247   
248  if(flist_LsCuts_Signal){
249     delete flist_LsCuts_Signal;
250     flist_LsCuts_Signal=0;
251   }
252   if(flist_LsCuts_Back){
253     delete flist_LsCuts_Back;
254     flist_LsCuts_Back=0;
255   }
256   if(flist_LsCuts_FromB){
257     delete flist_LsCuts_FromB;
258     flist_LsCuts_FromB=0;
259   }
260   if(flist_LsCuts_FromDstar){
261     delete flist_LsCuts_FromDstar;
262     flist_LsCuts_FromDstar=0;
263   }
264   if(flist_LsCuts_Other){
265     delete flist_LsCuts_Other;
266     flist_LsCuts_Other=0;
267   }
268   
269  if(flist_TghCuts_Signal){
270     delete flist_TghCuts_Signal;
271     flist_TghCuts_Signal=0;
272   }
273   if(flist_TghCuts_Back){
274     delete flist_TghCuts_Back;
275     flist_TghCuts_Back=0;
276   }
277   if(flist_TghCuts_FromB){
278     delete flist_TghCuts_FromB;
279     flist_TghCuts_FromB=0;
280   }
281   if(flist_TghCuts_FromDstar){
282     delete flist_TghCuts_FromDstar;
283     flist_TghCuts_FromDstar=0;
284   }
285   if(flist_TghCuts_Other){
286     delete flist_TghCuts_Other;
287     flist_TghCuts_Other=0;
288   }
289   
290   
291 }  
292
293
294 //________________________________________________________________________
295 void AliAnalysisTaskSECharmFraction::Init()
296 {
297   // Initialization
298   
299   if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n");
300   fmD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
301   
302   gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C");
303   
304   // 2 sets of dedidcated cuts -- defined in UserExec
305   //  the config file and the way the cuts are set is for further development
306   //   (to be interfaced with AliAnalsysTaskSETuneCuts)
307
308   fVHFtight = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
309   fVHFloose = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");  
310   if(!fptbins){
311     //SET STANDARD PT BINNING
312     fnbins=4;
313     fptbins=new Double_t[fnbins+1];
314     fptbins[0]=0.;
315     fptbins[1]=1.;
316     fptbins[2]=3.;
317     fptbins[3]=5.;
318     fptbins[4]=1000.;
319   }
320   return;
321 }
322
323 //________________________________________________________________________
324 void AliAnalysisTaskSECharmFraction::UserCreateOutputObjects()
325 {
326   // Create histograms
327   // Called once
328
329
330   TString namehist;
331   TString titlehist;
332   TString strnamept,strtitlept;
333  
334   fNentries=new TH1F("nentriesChFr", "Look at the number of entries! = number of AODs", 2,1.,2.);
335   fSignalType=new TH1F("hsignaltype", "Histo for type of MC signal", 21,-1.,20.);
336   fSignalTypeLsCuts=new TH1F("hsignaltypeLsCuts", "Histo for type of MC signal with loose cuts", 21,-1.,20.);
337   fSignalTypeTghCuts=new TH1F("hsignaltypeTghCuts", "Histo for type of MC signal with tight cuts", 21,-1.,20.);
338
339   //##########  DEFINE THE TLISTS ##################
340   
341   flist_NoCuts_Signal = new TList();
342   flist_NoCuts_Signal->SetOwner();
343   flist_NoCuts_Signal->SetName("list_nc_sign");
344
345   flist_NoCuts_Back = new TList();
346   flist_NoCuts_Back->SetOwner();
347   flist_NoCuts_Back->SetName("list_nc_back");
348
349   flist_NoCuts_FromB = new TList();
350   flist_NoCuts_FromB->SetOwner();
351   flist_NoCuts_FromB->SetName("list_nc_fromB");
352
353   flist_NoCuts_FromDstar = new TList();
354   flist_NoCuts_FromDstar->SetOwner();
355   flist_NoCuts_FromDstar->SetName("list_nc_fromDstar");
356
357   flist_NoCuts_Other = new TList();
358   flist_NoCuts_Other->SetOwner();
359   flist_NoCuts_Other->SetName("list_nc_other");
360
361
362   flist_LsCuts_Signal = new TList();
363   flist_LsCuts_Signal->SetOwner();
364   flist_LsCuts_Signal->SetName("list_ls_sign");
365
366   flist_LsCuts_Back = new TList();
367   flist_LsCuts_Back->SetOwner();
368   flist_LsCuts_Back->SetName("list_ls_back");
369
370   flist_LsCuts_FromB = new TList();
371   flist_LsCuts_FromB->SetOwner();
372   flist_LsCuts_FromB->SetName("list_ls_fromB");
373
374   flist_LsCuts_FromDstar = new TList();
375   flist_LsCuts_FromDstar->SetOwner();
376   flist_LsCuts_FromDstar->SetName("list_ls_fromDstar");
377
378   flist_LsCuts_Other = new TList();
379   flist_LsCuts_Other->SetOwner();
380   flist_LsCuts_Other->SetName("list_ls_other");
381
382
383   flist_TghCuts_Signal = new TList();
384   flist_TghCuts_Signal->SetOwner();
385   flist_TghCuts_Signal->SetName("list_tgh_sign");
386
387   flist_TghCuts_Back = new TList();
388   flist_TghCuts_Back->SetOwner();
389   flist_TghCuts_Back->SetName("list_tgh_back");
390
391   flist_TghCuts_FromB = new TList();
392   flist_TghCuts_FromB->SetOwner();
393   flist_TghCuts_FromB->SetName("list_tgh_fromB");
394
395   flist_TghCuts_FromDstar = new TList();
396   flist_TghCuts_FromDstar->SetOwner();
397   flist_TghCuts_FromDstar->SetName("list_tgh_fromDstar");
398
399   flist_TghCuts_Other = new TList();
400   flist_TghCuts_Other->SetOwner();
401   flist_TghCuts_Other->SetName("list_tgh_other");
402
403
404
405
406   //################################################################################################
407   //                                                                                               #
408   //                         HISTOS FOR NO CUTS CASE                                               #
409   //                                                                                               #
410   //################################################################################################
411
412
413   //############ NO CUTS SIGNAL HISTOGRAMS ###############
414   //
415   // ####### global properties histo ############
416
417   TH2F *hCPtaVSd0d0_nc_sign=new TH2F("hCPtaVSd0d0_nc_sign","hCPtaVSd0d0_NoCuts_Signal",1000,-100000.,100000.,100,0.,1.);
418   TH1F *hSecVtxZ_nc_sign=new TH1F("hSecVtxZ_nc_sign","hSecVtxZ_NoCuts_Signal",1000,-8.,8.);
419   TH1F *hSecVtxX_nc_sign=new TH1F("hSecVtxX_nc_sign","hSecVtxX_NoCuts_Signal",1000,-3000.,3000.);
420   TH1F *hSecVtxY_nc_sign=new TH1F("hSecVtxY_nc_sign","hSecVtxY_NoCuts_Signal",1000,-3000.,3000.);
421   TH2F *hSecVtxXY_nc_sign=new TH2F("hSecVtxXY_nc_sign","hSecVtxXY_NoCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
422   TH1F *hSecVtxPhi_nc_sign=new TH1F("hSecVtxPhi_nc_sign","hSecVtxPhi_NoCuts_Signal",180,-180.1,180.1);
423   TH1F *hCPta_nc_sign=new TH1F("hCPta_nc_sign","hCPta_NoCuts_Signal",100,0.,1.);
424   TH1F *hd0xd0_nc_sign=new TH1F("hd0xd0_nc_sign","hd0xd0_NoCuts_Signal",1000,-100000.,100000.);
425   TH1F *hMassTrue_nc_sign=new TH1F("hMassTrue_nc_sign","D^{0} MC inv. Mass No Cuts Signal(All momenta)",600,1.600,2.200);
426   TH1F *hMass_nc_sign=new TH1F("hMass_nc_sign","D^{0} inv. Mass No Cuts Signal (All momenta)",600,1.600,2.200);
427   hMass_nc_sign->Sumw2();
428   TH1F *hMassTrue_nc_sign_pm=new TH1F("hMassTrue_nc_sign_pm","D^{0} MC inv. Mass No Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
429   TH1F *hMass_nc_sign_pm=new TH1F("hMass_nc_sign_pm","D^{0} inv. Mass No Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
430   hMass_nc_sign_pm->Sumw2();
431
432   TH1F *hMassTrue_SB_nc_sign=new TH1F("hMassTrue_nc_sign_sb","D^{0} MC inv. Mass in Side Bands No Cuts Signal(All momenta)",600,1.600,2.200);
433   TH1F *hMass_SB_nc_sign=new TH1F("hMass_nc_sign_sb","D^{0} inv. Mass in Side Bands No Cuts Signal (All momenta)",600,1.600,2.200);
434   hMass_SB_nc_sign->Sumw2();
435
436   flist_NoCuts_Signal->Add(hCPtaVSd0d0_nc_sign);
437   flist_NoCuts_Signal->Add(hSecVtxZ_nc_sign);
438   flist_NoCuts_Signal->Add(hSecVtxY_nc_sign);
439   flist_NoCuts_Signal->Add(hSecVtxX_nc_sign);
440   flist_NoCuts_Signal->Add(hSecVtxXY_nc_sign);
441   flist_NoCuts_Signal->Add(hSecVtxPhi_nc_sign);
442   flist_NoCuts_Signal->Add(hCPta_nc_sign);
443   flist_NoCuts_Signal->Add(hd0xd0_nc_sign);
444   flist_NoCuts_Signal->Add(hMassTrue_nc_sign);
445   flist_NoCuts_Signal->Add(hMass_nc_sign);
446   flist_NoCuts_Signal->Add(hMassTrue_nc_sign_pm);
447   flist_NoCuts_Signal->Add(hMass_nc_sign_pm);
448   flist_NoCuts_Signal->Add(hMassTrue_SB_nc_sign);
449   flist_NoCuts_Signal->Add(hMass_SB_nc_sign);
450
451   // ####### d0 D0 histos ############
452   TH1F *hd0D0_nc_sign_pm = new TH1F("hd0D0_nc_sign_pm","D^{0} impact par. plot , No Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
453   hd0D0_nc_sign_pm->SetXTitle("Impact parameter [#mum]");
454   hd0D0_nc_sign_pm->SetYTitle("Entries");
455
456   TH1F *hd0D0VtxTrue_nc_sign_pm = new TH1F("hd0D0VtxTrue_nc_sign_pm","D^{0} impact par. w.r.t. True Vtx, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
457   hd0D0VtxTrue_nc_sign_pm->SetXTitle("Impact parameter [#mum]");
458   hd0D0VtxTrue_nc_sign_pm->SetYTitle("Entries");
459
460   TH1F *hMCd0D0_nc_sign_pm = new TH1F("hMCd0D0_nc_sign_pm","D^{0} impact par. plot, No Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
461   hMCd0D0_nc_sign_pm->SetXTitle("MC Impact parameter [#mum]");
462   hMCd0D0_nc_sign_pm->SetYTitle("Entries");
463
464   TH1F *hd0D0_nc_sign_sb = new TH1F("hd0D0_nc_sign_sb","D^{0} impact par. plot , No Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
465   hd0D0_nc_sign_sb->SetXTitle("Impact parameter [#mum]");
466   hd0D0_nc_sign_sb->SetYTitle("Entries");
467
468   TH1F *hd0D0VtxTrue_nc_sign_sb = new TH1F("hd0D0VtxTrue_nc_sign_sb","D^{0} impact par. w.r.t. True Vtx, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
469   hd0D0VtxTrue_nc_sign_sb->SetXTitle("Impact parameter [#mum]");
470   hd0D0VtxTrue_nc_sign_sb->SetYTitle("Entries");
471
472   TH1F *hMCd0D0_nc_sign_sb = new TH1F("hMCd0D0_nc_sign_sb","D^{0} impact par. plot, No Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
473   hMCd0D0_nc_sign_sb->SetXTitle("MC Impact parameter [#mum]");
474   hMCd0D0_nc_sign_sb->SetYTitle("Entries");
475
476   flist_NoCuts_Signal->Add(hd0D0_nc_sign_pm);
477   flist_NoCuts_Signal->Add(hd0D0VtxTrue_nc_sign_pm);
478   flist_NoCuts_Signal->Add(hMCd0D0_nc_sign_pm);
479   flist_NoCuts_Signal->Add(hd0D0_nc_sign_sb);
480   flist_NoCuts_Signal->Add(hd0D0VtxTrue_nc_sign_sb);
481   flist_NoCuts_Signal->Add(hMCd0D0_nc_sign_sb);
482   
483   TH1F **hd0D0pt_nc_sign_pm=new TH1F*[fnbins];
484   TH1F **hMCd0D0pt_nc_sign_pm=new TH1F*[fnbins];
485   TH1F ** hd0D0VtxTruept_nc_sign_pm=new TH1F*[fnbins];
486   TH1F **hd0D0pt_nc_sign_sb=new TH1F*[fnbins];
487   TH1F **hMCd0D0pt_nc_sign_sb=new TH1F*[fnbins];
488   TH1F ** hd0D0VtxTruept_nc_sign_sb=new TH1F*[fnbins];
489   namehist="hd0D0pt_nc_sign_";
490   titlehist="D^{0} impact par. plot, No Cuts, Signal, ";
491   for(Int_t i=0;i<fnbins;i++){
492     strnamept=namehist;
493     strnamept.Append("PkMss_pt");
494     strnamept+=i;
495
496     strtitlept=titlehist;
497     strtitlept.Append(" Mass Peak, ");
498     strtitlept+=fptbins[i];
499     strtitlept.Append("<= pt <");
500     strtitlept+=fptbins[i+1];
501     strtitlept.Append(" [GeV/c]");
502     
503     hd0D0pt_nc_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
504     hd0D0pt_nc_sign_pm[i]->SetXTitle("Impact parameter [#mum] ");
505     hd0D0pt_nc_sign_pm[i]->SetYTitle("Entries");
506     flist_NoCuts_Signal->Add(hd0D0pt_nc_sign_pm[i]);
507
508     strnamept.ReplaceAll("hd0D0","hMCd0D0");
509     hMCd0D0pt_nc_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
510     hMCd0D0pt_nc_sign_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
511     hMCd0D0pt_nc_sign_pm[i]->SetYTitle("Entries");
512     flist_NoCuts_Signal->Add(hMCd0D0pt_nc_sign_pm[i]);
513  
514
515     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
516     hd0D0VtxTruept_nc_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
517     hd0D0VtxTruept_nc_sign_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
518     hd0D0VtxTruept_nc_sign_pm[i]->SetYTitle("Entries");
519     flist_NoCuts_Signal->Add(hd0D0VtxTruept_nc_sign_pm[i]);
520     
521     strnamept=namehist;
522     strnamept.Append("SBMss_pt");
523     strnamept+=i;
524
525     strtitlept=titlehist;
526     strtitlept.Append(" Side Bands, ");
527     strtitlept+=fptbins[i];
528     strtitlept.Append("<= pt <");
529     strtitlept+=fptbins[i+1];
530     strtitlept.Append(" [GeV/c]");
531     
532     hd0D0pt_nc_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
533     hd0D0pt_nc_sign_sb[i]->SetXTitle("Impact parameter [#mum] ");
534     hd0D0pt_nc_sign_sb[i]->SetYTitle("Entries");
535     flist_NoCuts_Signal->Add(hd0D0pt_nc_sign_sb[i]);
536
537     strnamept.ReplaceAll("hd0D0","hMCd0D0");
538     hMCd0D0pt_nc_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
539     hMCd0D0pt_nc_sign_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
540     hMCd0D0pt_nc_sign_sb[i]->SetYTitle("Entries");
541     flist_NoCuts_Signal->Add(hMCd0D0pt_nc_sign_sb[i]);
542
543     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
544     hd0D0VtxTruept_nc_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
545     hd0D0VtxTruept_nc_sign_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
546     hd0D0VtxTruept_nc_sign_sb[i]->SetYTitle("Entries");
547     flist_NoCuts_Signal->Add(hd0D0VtxTruept_nc_sign_sb[i]);
548   }
549
550
551   //############ NO CUTS BACKGROUND HISTOGRAMS ###########
552   //
553   //   ######## global properties histos #######
554   TH2F *hCPtaVSd0d0_nc_back=new TH2F("hCPtaVSd0d0_nc_back","hCPtaVSd0d0_NoCuts_Background",1000,-100000.,100000.,100,0.,1.);
555   TH1F *hSecVtxZ_nc_back=new TH1F("hSecVtxZ_nc_back","hSecVtxZ_NoCuts_Background",1000,-8.,8.);
556   TH1F *hSecVtxX_nc_back=new TH1F("hSecVtxX_nc_back","hSecVtxX_NoCuts_Background",1000,-3000.,3000.);
557   TH1F *hSecVtxY_nc_back=new TH1F("hSecVtxY_nc_back","hSecVtxY_NoCuts_Background",1000,-3000.,3000.);
558   TH2F *hSecVtxXY_nc_back=new TH2F("hSecVtxXY_nc_back","hSecVtxXY_NoCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
559   TH1F *hSecVtxPhi_nc_back=new TH1F("hSecVtxPhi_nc_back","hSecVtxPhi_NoCuts_Background",180,-180.1,180.1);
560   TH1F *hCPta_nc_back=new TH1F("hCPta_nc_back","hCPta_NoCuts_Background",100,0.,1.);
561   TH1F *hd0xd0_nc_back=new TH1F("hd0xd0_nc_back","hd0xd0_NoCuts_Background",1000,-100000.,100000.);
562   TH1F *hMassTrue_nc_back=new TH1F("hMassTrue_nc_back","D^{0} MC inv. Mass No Cuts Background(All momenta)",600,1.600,2.200);
563   TH1F *hMass_nc_back=new TH1F("hMass_nc_back","D^{0} inv. Mass No Cuts Background (All momenta)",600,1.600,2.200);
564   hMass_nc_back->Sumw2();
565   TH1F *hMassTrue_nc_back_pm=new TH1F("hMassTrue_nc_back_pm","D^{0} MC inv. Mass No Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
566   TH1F *hMass_nc_back_pm=new TH1F("hMass_nc_back_pm","D^{0} inv. Mass No Cuts Background (All momenta), MassPeak",600,1.600,2.200);
567   hMass_nc_back_pm->Sumw2();
568   TH1F *hMassTrue_SB_nc_back=new TH1F("hMassTrue_nc_back_sb","D^{0} MC inv. Mass in Side Bands No Cuts Background(All momenta)",600,1.600,2.200);
569   TH1F *hMass_SB_nc_back=new TH1F("hMass_nc_back_sb","D^{0} inv. Mass in Side Bands No Cuts Background (All momenta)",600,1.600,2.200);
570   hMass_SB_nc_back->Sumw2();
571
572   flist_NoCuts_Back->Add(hCPtaVSd0d0_nc_back);
573   flist_NoCuts_Back->Add(hSecVtxZ_nc_back);
574   flist_NoCuts_Back->Add(hSecVtxY_nc_back);
575   flist_NoCuts_Back->Add(hSecVtxX_nc_back);
576   flist_NoCuts_Back->Add(hSecVtxXY_nc_back);
577   flist_NoCuts_Back->Add(hSecVtxPhi_nc_back);
578   flist_NoCuts_Back->Add(hCPta_nc_back);
579   flist_NoCuts_Back->Add(hd0xd0_nc_back);
580   flist_NoCuts_Back->Add(hMassTrue_nc_back);
581   flist_NoCuts_Back->Add(hMass_nc_back);
582   flist_NoCuts_Back->Add(hMassTrue_nc_back_pm);
583   flist_NoCuts_Back->Add(hMass_nc_back_pm);
584   flist_NoCuts_Back->Add(hMassTrue_SB_nc_back);
585   flist_NoCuts_Back->Add(hMass_SB_nc_back);
586
587
588   // ####### d0 D0 histos ############
589   
590  TH1F *hd0D0_nc_back_pm = new TH1F("hd0D0_nc_back_pm","D^{0} impact par. plot , No Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
591   hd0D0_nc_back_pm->SetXTitle("Impact parameter [#mum]");
592   hd0D0_nc_back_pm->SetYTitle("Entries");
593
594   TH1F *hd0D0VtxTrue_nc_back_pm = new TH1F("hd0D0VtxTrue_nc_back_pm","D^{0} impact par. w.r.t. True Vtx, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
595   hd0D0VtxTrue_nc_back_pm->SetXTitle("Impact parameter [#mum]");
596   hd0D0VtxTrue_nc_back_pm->SetYTitle("Entries");
597
598   TH1F *hMCd0D0_nc_back_pm = new TH1F("hMCd0D0_nc_back_pm","D^{0} impact par. plot, No Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
599   hMCd0D0_nc_back_pm->SetXTitle("MC Impact parameter [#mum]");
600   hMCd0D0_nc_back_pm->SetYTitle("Entries");
601
602   TH1F *hd0D0_nc_back_sb = new TH1F("hd0D0_nc_back_sb","D^{0} impact par. plot , No Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
603   hd0D0_nc_back_sb->SetXTitle("Impact parameter [#mum]");
604   hd0D0_nc_back_sb->SetYTitle("Entries");
605
606   TH1F *hd0D0VtxTrue_nc_back_sb = new TH1F("hd0D0VtxTrue_nc_back_sb","D^{0} impact par. w.r.t. True Vtx, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
607   hd0D0VtxTrue_nc_back_sb->SetXTitle("Impact parameter [#mum]");
608   hd0D0VtxTrue_nc_back_sb->SetYTitle("Entries");
609
610   TH1F *hMCd0D0_nc_back_sb = new TH1F("hMCd0D0_nc_back_sb","D^{0} impact par. plot, No Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
611   hMCd0D0_nc_back_sb->SetXTitle("MC Impact parameter [#mum]");
612   hMCd0D0_nc_back_sb->SetYTitle("Entries");
613
614   flist_NoCuts_Back->Add(hd0D0_nc_back_pm);
615   flist_NoCuts_Back->Add(hd0D0VtxTrue_nc_back_pm);
616   flist_NoCuts_Back->Add(hMCd0D0_nc_back_pm);
617   flist_NoCuts_Back->Add(hd0D0_nc_back_sb);
618   flist_NoCuts_Back->Add(hd0D0VtxTrue_nc_back_sb);
619   flist_NoCuts_Back->Add(hMCd0D0_nc_back_sb);
620   
621   TH1F **hd0D0pt_nc_back_pm=new TH1F*[fnbins];
622   TH1F **hMCd0D0pt_nc_back_pm=new TH1F*[fnbins];
623   TH1F ** hd0D0VtxTruept_nc_back_pm=new TH1F*[fnbins];
624   TH1F **hd0D0pt_nc_back_sb=new TH1F*[fnbins];
625   TH1F **hMCd0D0pt_nc_back_sb=new TH1F*[fnbins];
626   TH1F ** hd0D0VtxTruept_nc_back_sb=new TH1F*[fnbins];
627   namehist="hd0D0pt_nc_back_";
628   titlehist="D^{0} impact par. plot, No Cuts, Background, ";
629   for(Int_t i=0;i<fnbins;i++){
630     strnamept=namehist;
631     strnamept.Append("PkMss_pt");
632     strnamept+=i;
633
634     strtitlept=titlehist;
635     strtitlept.Append(" Mass Peak, ");
636     strtitlept+=fptbins[i];
637     strtitlept.Append("<= pt <");
638     strtitlept+=fptbins[i+1];
639     strtitlept.Append(" [GeV/c]");
640     
641     hd0D0pt_nc_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
642     hd0D0pt_nc_back_pm[i]->SetXTitle("Impact parameter [#mum] ");
643     hd0D0pt_nc_back_pm[i]->SetYTitle("Entries");
644     flist_NoCuts_Back->Add(hd0D0pt_nc_back_pm[i]);
645
646     strnamept.ReplaceAll("hd0D0","hMCd0D0");
647     hMCd0D0pt_nc_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
648     hMCd0D0pt_nc_back_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
649     hMCd0D0pt_nc_back_pm[i]->SetYTitle("Entries");
650     flist_NoCuts_Back->Add(hMCd0D0pt_nc_back_pm[i]);
651  
652
653     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
654     hd0D0VtxTruept_nc_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
655     hd0D0VtxTruept_nc_back_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
656     hd0D0VtxTruept_nc_back_pm[i]->SetYTitle("Entries");
657     flist_NoCuts_Back->Add(hd0D0VtxTruept_nc_back_pm[i]);
658     
659     strnamept=namehist;
660     strnamept.Append("SBMss_pt");
661     strnamept+=i;
662
663     strtitlept=titlehist;
664     strtitlept.Append(" Side Bands, ");
665     strtitlept+=fptbins[i];
666     strtitlept.Append("<= pt <");
667     strtitlept+=fptbins[i+1];
668     strtitlept.Append(" [GeV/c]");
669     
670     hd0D0pt_nc_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
671     hd0D0pt_nc_back_sb[i]->SetXTitle("Impact parameter [#mum] ");
672     hd0D0pt_nc_back_sb[i]->SetYTitle("Entries");
673     flist_NoCuts_Back->Add(hd0D0pt_nc_back_sb[i]);
674
675     strnamept.ReplaceAll("hd0D0","hMCd0D0");
676     hMCd0D0pt_nc_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
677     hMCd0D0pt_nc_back_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
678     hMCd0D0pt_nc_back_sb[i]->SetYTitle("Entries");
679     flist_NoCuts_Back->Add(hMCd0D0pt_nc_back_sb[i]);
680
681     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
682     hd0D0VtxTruept_nc_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
683     hd0D0VtxTruept_nc_back_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
684     hd0D0VtxTruept_nc_back_sb[i]->SetYTitle("Entries");
685     flist_NoCuts_Back->Add(hd0D0VtxTruept_nc_back_sb[i]);
686   }
687
688
689
690  //############ NO CUTS FROMB HISTOGRAMS ###########
691   //
692   //#######  global properties histos
693
694   TH2F *hCPtaVSd0d0_nc_fromB=new TH2F("hCPtaVSd0d0_nc_fromB","hCPtaVSd0d0_NoCuts_FromB",1000,-100000.,100000.,100,0.,1.);
695   TH1F *hSecVtxZ_nc_fromB=new TH1F("hSecVtxZ_nc_fromB","hSecVtxZ_NoCuts_FromB",1000,-8.,8.);
696   TH1F *hSecVtxX_nc_fromB=new TH1F("hSecVtxX_nc_fromB","hSecVtxX_NoCuts_FromB",1000,-3000.,3000.);
697   TH1F *hSecVtxY_nc_fromB=new TH1F("hSecVtxY_nc_fromB","hSecVtxY_NoCuts_FromB",1000,-3000.,3000.);
698   TH2F *hSecVtxXY_nc_fromB=new TH2F("hSecVtxXY_nc_fromB","hSecVtxXY_NoCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
699   TH1F *hSecVtxPhi_nc_fromB=new TH1F("hSecVtxPhi_nc_fromB","hSecVtxPhi_NoCuts_FromB",180,-180.1,180.1);
700   TH1F *hCPta_nc_fromB=new TH1F("hCPta_nc_fromB","hCPta_NoCuts_FromB",100,0.,1.);
701   TH1F *hd0xd0_nc_fromB=new TH1F("hd0xd0_nc_fromB","hd0xd0_NoCuts_FromB",1000,-100000.,100000.);
702   TH1F *hMassTrue_nc_fromB=new TH1F("hMassTrue_nc_fromB","D^{0} MC inv. Mass No Cuts FromB(All momenta)",600,1.600,2.200);
703   TH1F *hMass_nc_fromB=new TH1F("hMass_nc_fromB","D^{0} inv. Mass No Cuts FromB (All momenta)",600,1.600,2.200);
704   hMass_nc_fromB->Sumw2();
705   TH1F *hMassTrue_nc_fromB_pm=new TH1F("hMassTrue_nc_fromB_pm","D^{0} MC inv. Mass No Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
706   TH1F *hMass_nc_fromB_pm=new TH1F("hMass_nc_fromB_pm","D^{0} inv. Mass No Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
707   hMass_nc_fromB->Sumw2();
708   TH1F *hMassTrue_SB_nc_fromB=new TH1F("hMassTrue_nc_fromB_sb","D^{0} MC inv. Mass in Side Bands No Cuts FromB(All momenta)",600,1.600,2.200);
709   TH1F *hMass_SB_nc_fromB=new TH1F("hMass_nc_fromB_sb","D^{0} inv. Mass in Side Bands No Cuts FromB (All momenta)",600,1.600,2.200);
710   hMass_SB_nc_fromB->Sumw2();
711
712   flist_NoCuts_FromB->Add(hCPtaVSd0d0_nc_fromB);
713   flist_NoCuts_FromB->Add(hSecVtxZ_nc_fromB);
714   flist_NoCuts_FromB->Add(hSecVtxY_nc_fromB);
715   flist_NoCuts_FromB->Add(hSecVtxX_nc_fromB);
716   flist_NoCuts_FromB->Add(hSecVtxXY_nc_fromB);
717   flist_NoCuts_FromB->Add(hSecVtxPhi_nc_fromB);
718   flist_NoCuts_FromB->Add(hCPta_nc_fromB);
719   flist_NoCuts_FromB->Add(hd0xd0_nc_fromB);
720   flist_NoCuts_FromB->Add(hMassTrue_nc_fromB);
721   flist_NoCuts_FromB->Add(hMass_nc_fromB);
722   flist_NoCuts_FromB->Add(hMassTrue_nc_fromB_pm);
723   flist_NoCuts_FromB->Add(hMass_nc_fromB_pm);
724   flist_NoCuts_FromB->Add(hMassTrue_SB_nc_fromB);
725   flist_NoCuts_FromB->Add(hMass_SB_nc_fromB);
726
727   // ######### d0 D0 histos ##############
728   TH1F *hd0D0_nc_fromB_pm = new TH1F("hd0D0_nc_fromB_pm","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
729   hd0D0_nc_fromB_pm->SetXTitle("Impact parameter [#mum]");
730   hd0D0_nc_fromB_pm->SetYTitle("Entries");
731
732   TH1F *hd0D0VtxTrue_nc_fromB_pm = new TH1F("hd0D0VtxTrue_nc_fromB_pm","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
733   hd0D0VtxTrue_nc_fromB_pm->SetXTitle("Impact parameter [#mum]");
734   hd0D0VtxTrue_nc_fromB_pm->SetYTitle("Entries");
735
736   TH1F *hMCd0D0_nc_fromB_pm = new TH1F("hMCd0D0_nc_fromB_pm","D^{0} impact par. plot, No Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
737   hMCd0D0_nc_fromB_pm->SetXTitle("MC Impact parameter [#mum]");
738   hMCd0D0_nc_fromB_pm->SetYTitle("Entries");
739
740   TH1F *hd0D0_nc_fromB_sb = new TH1F("hd0D0_nc_fromB_sb","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
741   hd0D0_nc_fromB_sb->SetXTitle("Impact parameter [#mum]");
742   hd0D0_nc_fromB_sb->SetYTitle("Entries");
743
744   TH1F *hd0D0VtxTrue_nc_fromB_sb = new TH1F("hd0D0VtxTrue_nc_fromB_sb","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
745   hd0D0VtxTrue_nc_fromB_sb->SetXTitle("Impact parameter [#mum]");
746   hd0D0VtxTrue_nc_fromB_sb->SetYTitle("Entries");
747
748   TH1F *hMCd0D0_nc_fromB_sb = new TH1F("hMCd0D0_nc_fromB_sb","D^{0} impact par. plot, No Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
749   hMCd0D0_nc_fromB_sb->SetXTitle("MC Impact parameter [#mum]");
750   hMCd0D0_nc_fromB_sb->SetYTitle("Entries");
751
752   flist_NoCuts_FromB->Add(hd0D0_nc_fromB_pm);
753   flist_NoCuts_FromB->Add(hd0D0VtxTrue_nc_fromB_pm);
754   flist_NoCuts_FromB->Add(hMCd0D0_nc_fromB_pm);
755   flist_NoCuts_FromB->Add(hd0D0_nc_fromB_sb);
756   flist_NoCuts_FromB->Add(hd0D0VtxTrue_nc_fromB_sb);
757   flist_NoCuts_FromB->Add(hMCd0D0_nc_fromB_sb);
758   
759   TH1F **hd0D0pt_nc_fromB_pm=new TH1F*[fnbins];
760   TH1F **hMCd0D0pt_nc_fromB_pm=new TH1F*[fnbins];
761   TH1F ** hd0D0VtxTruept_nc_fromB_pm=new TH1F*[fnbins];
762   TH1F **hd0D0pt_nc_fromB_sb=new TH1F*[fnbins];
763   TH1F **hMCd0D0pt_nc_fromB_sb=new TH1F*[fnbins];
764   TH1F ** hd0D0VtxTruept_nc_fromB_sb=new TH1F*[fnbins];
765   namehist="hd0D0pt_nc_fromB_";
766   titlehist="D^{0} impact par. plot, No Cuts, FromB, ";
767   for(Int_t i=0;i<fnbins;i++){
768     strnamept=namehist;
769     strnamept.Append("PkMss_pt");
770     strnamept+=i;
771
772     strtitlept=titlehist;
773     strtitlept.Append(" Mass Peak, ");
774     strtitlept+=fptbins[i];
775     strtitlept.Append("<= pt <");
776     strtitlept+=fptbins[i+1];
777     strtitlept.Append(" [GeV/c]");
778     
779     hd0D0pt_nc_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
780     hd0D0pt_nc_fromB_pm[i]->SetXTitle("Impact parameter [#mum] ");
781     hd0D0pt_nc_fromB_pm[i]->SetYTitle("Entries");
782     flist_NoCuts_FromB->Add(hd0D0pt_nc_fromB_pm[i]);
783
784     strnamept.ReplaceAll("hd0D0","hMCd0D0");
785     hMCd0D0pt_nc_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
786     hMCd0D0pt_nc_fromB_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
787     hMCd0D0pt_nc_fromB_pm[i]->SetYTitle("Entries");
788     flist_NoCuts_FromB->Add(hMCd0D0pt_nc_fromB_pm[i]);
789  
790
791     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
792     hd0D0VtxTruept_nc_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
793     hd0D0VtxTruept_nc_fromB_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
794     hd0D0VtxTruept_nc_fromB_pm[i]->SetYTitle("Entries");
795     flist_NoCuts_FromB->Add(hd0D0VtxTruept_nc_fromB_pm[i]);
796     
797     strnamept=namehist;
798     strnamept.Append("SBMss_pt");
799     strnamept+=i;
800
801     strtitlept=titlehist;
802     strtitlept.Append(" Side Bands, ");
803     strtitlept+=fptbins[i];
804     strtitlept.Append("<= pt <");
805     strtitlept+=fptbins[i+1];
806     strtitlept.Append(" [GeV/c]");
807     
808     hd0D0pt_nc_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
809     hd0D0pt_nc_fromB_sb[i]->SetXTitle("Impact parameter [#mum] ");
810     hd0D0pt_nc_fromB_sb[i]->SetYTitle("Entries");
811     flist_NoCuts_FromB->Add(hd0D0pt_nc_fromB_sb[i]);
812
813     strnamept.ReplaceAll("hd0D0","hMCd0D0");
814     hMCd0D0pt_nc_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
815     hMCd0D0pt_nc_fromB_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
816     hMCd0D0pt_nc_fromB_sb[i]->SetYTitle("Entries");
817     flist_NoCuts_FromB->Add(hMCd0D0pt_nc_fromB_sb[i]);
818
819     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
820     hd0D0VtxTruept_nc_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
821     hd0D0VtxTruept_nc_fromB_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
822     hd0D0VtxTruept_nc_fromB_sb[i]->SetYTitle("Entries");
823     flist_NoCuts_FromB->Add(hd0D0VtxTruept_nc_fromB_sb[i]);
824   }
825
826
827
828   //############ NO CUTS FROM DSTAR HISTOGRAMS ###########
829   //
830   //#############  global properties histos #######
831
832   TH2F *hCPtaVSd0d0_nc_fromDstar=new TH2F("hCPtaVSd0d0_nc_fromDstar","hCPtaVSd0d0_NoCuts_FromDStar",1000,-100000.,100000.,100,0.,1.);
833   TH1F *hSecVtxZ_nc_fromDstar=new TH1F("hSecVtxZ_nc_fromDstar","hSecVtxZ_NoCuts_FromDStar",1000,-8.,8.);
834   TH1F *hSecVtxX_nc_fromDstar=new TH1F("hSecVtxX_nc_fromDstar","hSecVtxX_NoCuts_FromDStar",1000,-3000.,3000.);
835   TH1F *hSecVtxY_nc_fromDstar=new TH1F("hSecVtxY_nc_fromDstar","hSecVtxY_NoCuts_FromDStar",1000,-3000.,3000.);
836   TH2F *hSecVtxXY_nc_fromDstar=new TH2F("hSecVtxXY_nc_fromDstar","hSecVtxXY_NoCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
837   TH1F *hSecVtxPhi_nc_fromDstar=new TH1F("hSecVtxPhi_nc_fromDstar","hSecVtxPhi_NoCuts_FromDStar",180,-180.1,180.1);
838   TH1F *hCPta_nc_fromDstar=new TH1F("hCPta_nc_fromDstar","hCPta_NoCuts_FromDStar",100,0.,1.);
839   TH1F *hd0xd0_nc_fromDstar=new TH1F("hd0xd0_nc_fromDstar","hd0xd0_NoCuts_FromDStar",1000,-100000.,100000.);
840   TH1F *hMassTrue_nc_fromDstar=new TH1F("hMassTrue_nc_fromDstar","D^{0} MC inv. Mass No Cuts FromDStar(All momenta)",600,1.600,2.200);
841   TH1F *hMass_nc_fromDstar=new TH1F("hMass_nc_fromDstar","D^{0} inv. Mass No Cuts FromDStar (All momenta)",600,1.600,2.200);
842   hMass_nc_fromDstar->Sumw2();
843   TH1F *hMassTrue_nc_fromDstar_pm=new TH1F("hMassTrue_nc_fromDstar_pm","D^{0} MC inv. Mass No Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
844   TH1F *hMass_nc_fromDstar_pm=new TH1F("hMass_nc_fromDstar_pm","D^{0} inv. Mass No Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
845   hMass_nc_fromDstar_pm->Sumw2();
846   TH1F *hMassTrue_SB_nc_fromDstar=new TH1F("hMassTrue_nc_fromDstar_sb","D^{0} MC inv. Mass in Side Bands No Cuts FromDStar(All momenta)",600,1.600,2.200);
847   TH1F *hMass_SB_nc_fromDstar=new TH1F("hMass_nc_fromDstar_sb","D^{0} inv. Mass in Side Bands No Cuts FromDStar (All momenta)",600,1.600,2.200);
848   hMass_SB_nc_fromDstar->Sumw2();
849
850   flist_NoCuts_FromDstar->Add(hCPtaVSd0d0_nc_fromDstar);
851   flist_NoCuts_FromDstar->Add(hSecVtxZ_nc_fromDstar);
852   flist_NoCuts_FromDstar->Add(hSecVtxY_nc_fromDstar);
853   flist_NoCuts_FromDstar->Add(hSecVtxX_nc_fromDstar);
854   flist_NoCuts_FromDstar->Add(hSecVtxXY_nc_fromDstar);
855   flist_NoCuts_FromDstar->Add(hSecVtxPhi_nc_fromDstar);
856   flist_NoCuts_FromDstar->Add(hCPta_nc_fromDstar);
857   flist_NoCuts_FromDstar->Add(hd0xd0_nc_fromDstar);
858   flist_NoCuts_FromDstar->Add(hMassTrue_nc_fromDstar);
859   flist_NoCuts_FromDstar->Add(hMass_nc_fromDstar);
860   flist_NoCuts_FromDstar->Add(hMassTrue_nc_fromDstar_pm);
861   flist_NoCuts_FromDstar->Add(hMass_nc_fromDstar_pm);
862   flist_NoCuts_FromDstar->Add(hMassTrue_SB_nc_fromDstar);
863   flist_NoCuts_FromDstar->Add(hMass_SB_nc_fromDstar);
864
865   //########## d0 D0 histos #############  
866   TH1F *hd0D0_nc_fromDst_pm = new TH1F("hd0D0_nc_fromDstar_pm","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
867   hd0D0_nc_fromDst_pm->SetXTitle("Impact parameter [#mum]");
868   hd0D0_nc_fromDst_pm->SetYTitle("Entries");
869
870   TH1F *hd0D0VtxTrue_nc_fromDst_pm = new TH1F("hd0D0VtxTrue_nc_fromDstar_pm","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
871   hd0D0VtxTrue_nc_fromDst_pm->SetXTitle("Impact parameter [#mum]");
872   hd0D0VtxTrue_nc_fromDst_pm->SetYTitle("Entries");
873
874   TH1F *hMCd0D0_nc_fromDst_pm = new TH1F("hMCd0D0_nc_fromDstar_pm","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
875   hMCd0D0_nc_fromDst_pm->SetXTitle("MC Impact parameter [#mum]");
876   hMCd0D0_nc_fromDst_pm->SetYTitle("Entries");
877
878   TH1F *hd0D0_nc_fromDst_sb = new TH1F("hd0D0_nc_fromDstar_sb","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
879   hd0D0_nc_fromDst_sb->SetXTitle("Impact parameter [#mum]");
880   hd0D0_nc_fromDst_sb->SetYTitle("Entries");
881
882   TH1F *hd0D0VtxTrue_nc_fromDst_sb = new TH1F("hd0D0VtxTrue_nc_fromDstar_sb","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
883   hd0D0VtxTrue_nc_fromDst_sb->SetXTitle("Impact parameter [#mum]");
884   hd0D0VtxTrue_nc_fromDst_sb->SetYTitle("Entries");
885
886   TH1F *hMCd0D0_nc_fromDst_sb = new TH1F("hMCd0D0_nc_fromDstar_sb","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
887   hMCd0D0_nc_fromDst_sb->SetXTitle("MC Impact parameter [#mum]");
888   hMCd0D0_nc_fromDst_sb->SetYTitle("Entries");
889
890   flist_NoCuts_FromDstar->Add(hd0D0_nc_fromDst_pm);
891   flist_NoCuts_FromDstar->Add(hd0D0VtxTrue_nc_fromDst_pm);
892   flist_NoCuts_FromDstar->Add(hMCd0D0_nc_fromDst_pm);
893   flist_NoCuts_FromDstar->Add(hd0D0_nc_fromDst_sb);
894   flist_NoCuts_FromDstar->Add(hd0D0VtxTrue_nc_fromDst_sb);
895   flist_NoCuts_FromDstar->Add(hMCd0D0_nc_fromDst_sb);
896   
897   TH1F **hd0D0pt_nc_fromDst_pm=new TH1F*[fnbins];
898   TH1F **hMCd0D0pt_nc_fromDst_pm=new TH1F*[fnbins];
899   TH1F ** hd0D0VtxTruept_nc_fromDst_pm=new TH1F*[fnbins];
900   TH1F **hd0D0pt_nc_fromDst_sb=new TH1F*[fnbins];
901   TH1F **hMCd0D0pt_nc_fromDst_sb=new TH1F*[fnbins];
902   TH1F ** hd0D0VtxTruept_nc_fromDst_sb=new TH1F*[fnbins];
903   namehist="hd0D0pt_nc_fromDstar_";
904   titlehist="D^{0} impact par. plot, No Cuts, FromDStar, ";
905   for(Int_t i=0;i<fnbins;i++){
906     strnamept=namehist;
907     strnamept.Append("PkMss_pt");
908     strnamept+=i;
909
910     strtitlept=titlehist;
911     strtitlept.Append(" Mass Peak, ");
912     strtitlept+=fptbins[i];
913     strtitlept.Append("<= pt <");
914     strtitlept+=fptbins[i+1];
915     strtitlept.Append(" [GeV/c]");
916     
917     hd0D0pt_nc_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
918     hd0D0pt_nc_fromDst_pm[i]->SetXTitle("Impact parameter [#mum] ");
919     hd0D0pt_nc_fromDst_pm[i]->SetYTitle("Entries");
920     flist_NoCuts_FromDstar->Add(hd0D0pt_nc_fromDst_pm[i]);
921
922     strnamept.ReplaceAll("hd0D0","hMCd0D0");
923     hMCd0D0pt_nc_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
924     hMCd0D0pt_nc_fromDst_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
925     hMCd0D0pt_nc_fromDst_pm[i]->SetYTitle("Entries");
926     flist_NoCuts_FromDstar->Add(hMCd0D0pt_nc_fromDst_pm[i]);
927  
928
929     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
930     hd0D0VtxTruept_nc_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
931     hd0D0VtxTruept_nc_fromDst_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
932     hd0D0VtxTruept_nc_fromDst_pm[i]->SetYTitle("Entries");
933     flist_NoCuts_FromDstar->Add(hd0D0VtxTruept_nc_fromDst_pm[i]);
934     
935     strnamept=namehist;
936     strnamept.Append("SBMss_pt");
937     strnamept+=i;
938
939     strtitlept=titlehist;
940     strtitlept.Append(" Side Bands, ");
941     strtitlept+=fptbins[i];
942     strtitlept.Append("<= pt <");
943     strtitlept+=fptbins[i+1];
944     strtitlept.Append(" [GeV/c]");
945     
946     hd0D0pt_nc_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
947     hd0D0pt_nc_fromDst_sb[i]->SetXTitle("Impact parameter [#mum] ");
948     hd0D0pt_nc_fromDst_sb[i]->SetYTitle("Entries");
949     flist_NoCuts_FromDstar->Add(hd0D0pt_nc_fromDst_sb[i]);
950
951     strnamept.ReplaceAll("hd0D0","hMCd0D0");
952     hMCd0D0pt_nc_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
953     hMCd0D0pt_nc_fromDst_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
954     hMCd0D0pt_nc_fromDst_sb[i]->SetYTitle("Entries");
955     flist_NoCuts_FromDstar->Add(hMCd0D0pt_nc_fromDst_sb[i]);
956
957     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
958     hd0D0VtxTruept_nc_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
959     hd0D0VtxTruept_nc_fromDst_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
960     hd0D0VtxTruept_nc_fromDst_sb[i]->SetYTitle("Entries");
961     flist_NoCuts_FromDstar->Add(hd0D0VtxTruept_nc_fromDst_sb[i]);
962   }
963
964
965   //############ NO CUTS OTHER HISTOGRAMS ###########
966   //
967   //########### global properties histos ###########
968
969   TH2F *hCPtaVSd0d0_nc_other=new TH2F("hCPtaVSd0d0_nc_other","hCPtaVSd0d0_NoCuts_other",1000,-100000.,100000.,100,0.,1.);
970   TH1F *hSecVtxZ_nc_other=new TH1F("hSecVtxZ_nc_other","hSecVtxZ_NoCuts_other",1000,-8.,8.);
971   TH1F *hSecVtxX_nc_other=new TH1F("hSecVtxX_nc_other","hSecVtxX_NoCuts_other",1000,-3000.,3000.);
972   TH1F *hSecVtxY_nc_other=new TH1F("hSecVtxY_nc_other","hSecVtxY_NoCuts_other",1000,-3000.,3000.);
973   TH2F *hSecVtxXY_nc_other=new TH2F("hSecVtxXY_nc_other","hSecVtxXY_NoCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
974   TH1F *hSecVtxPhi_nc_other=new TH1F("hSecVtxPhi_nc_other","hSecVtxPhi_NoCuts_other",180,-180.1,180.1);
975   TH1F *hCPta_nc_other=new TH1F("hCPta_nc_other","hCPta_NoCuts_other",100,0.,1.);
976   TH1F *hd0xd0_nc_other=new TH1F("hd0xd0_nc_other","hd0xd0_NoCuts_other",1000,-100000.,100000.);
977   TH1F *hMassTrue_nc_other=new TH1F("hMassTrue_nc_other","D^{0} MC inv. Mass No Cuts other(All momenta)",600,1.600,2.200);
978   TH1F *hMass_nc_other=new TH1F("hMass_nc_other","D^{0} inv. Mass No Cuts other (All momenta)",600,1.600,2.200);
979   hMass_nc_other->Sumw2();
980   TH1F *hMassTrue_nc_other_pm=new TH1F("hMassTrue_nc_other_pm","D^{0} MC inv. Mass No Cuts Other, Mass Peak. (All momenta)",600,1.600,2.200);
981   TH1F *hMass_nc_other_pm=new TH1F("hMass_nc_other_pm","D^{0} inv. Mass No Cuts Other (All momenta), MassPeak",600,1.600,2.200);
982   hMass_nc_other_pm->Sumw2();
983   TH1F *hMassTrue_SB_nc_other=new TH1F("hMassTrue_nc_other_sb","D^{0} MC inv. Mass in Side Bands No Cuts other(All momenta)",600,1.600,2.200);
984   TH1F *hMass_SB_nc_other=new TH1F("hMass_nc_other_sb","D^{0} inv. Mass in Side Bands No Cuts other (All momenta)",600,1.600,2.200);
985   hMass_SB_nc_other->Sumw2();
986
987   flist_NoCuts_Other->Add(hCPtaVSd0d0_nc_other);
988   flist_NoCuts_Other->Add(hSecVtxZ_nc_other);
989   flist_NoCuts_Other->Add(hSecVtxY_nc_other);
990   flist_NoCuts_Other->Add(hSecVtxX_nc_other);
991   flist_NoCuts_Other->Add(hSecVtxXY_nc_other);
992   flist_NoCuts_Other->Add(hSecVtxPhi_nc_other);
993   flist_NoCuts_Other->Add(hCPta_nc_other);
994   flist_NoCuts_Other->Add(hd0xd0_nc_other);
995   flist_NoCuts_Other->Add(hMassTrue_nc_other);
996   flist_NoCuts_Other->Add(hMass_nc_other);
997   flist_NoCuts_Other->Add(hMassTrue_nc_other_pm);
998   flist_NoCuts_Other->Add(hMass_nc_other_pm);
999   flist_NoCuts_Other->Add(hMassTrue_SB_nc_other);
1000   flist_NoCuts_Other->Add(hMass_SB_nc_other);
1001
1002   //############# d0 D0 histos ###############à
1003   TH1F *hd0D0_nc_other_pm = new TH1F("hd0D0_nc_other_pm","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1004   hd0D0_nc_other_pm->SetXTitle("Impact parameter [#mum]");
1005   hd0D0_nc_other_pm->SetYTitle("Entries");
1006
1007   TH1F *hd0D0VtxTrue_nc_other_pm = new TH1F("hd0D0VtxTrue_nc_other_pm","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1008   hd0D0VtxTrue_nc_other_pm->SetXTitle("Impact parameter [#mum]");
1009   hd0D0VtxTrue_nc_other_pm->SetYTitle("Entries");
1010
1011   TH1F *hMCd0D0_nc_other_pm = new TH1F("hMCd0D0_nc_other_pm","D^{0} impact par. plot, No Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
1012   hMCd0D0_nc_other_pm->SetXTitle("MC Impact parameter [#mum]");
1013   hMCd0D0_nc_other_pm->SetYTitle("Entries");
1014
1015   TH1F *hd0D0_nc_other_sb = new TH1F("hd0D0_nc_other_sb","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1016   hd0D0_nc_other_sb->SetXTitle("Impact parameter [#mum]");
1017   hd0D0_nc_other_sb->SetYTitle("Entries");
1018
1019   TH1F *hd0D0VtxTrue_nc_other_sb = new TH1F("hd0D0VtxTrue_nc_other_sb","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1020   hd0D0VtxTrue_nc_other_sb->SetXTitle("Impact parameter [#mum]");
1021   hd0D0VtxTrue_nc_other_sb->SetYTitle("Entries");
1022
1023   TH1F *hMCd0D0_nc_other_sb = new TH1F("hMCd0D0_nc_other_sb","D^{0} impact par. plot, No Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
1024   hMCd0D0_nc_other_sb->SetXTitle("MC Impact parameter [#mum]");
1025   hMCd0D0_nc_other_sb->SetYTitle("Entries");
1026
1027   flist_NoCuts_Other->Add(hd0D0_nc_other_pm);
1028   flist_NoCuts_Other->Add(hd0D0VtxTrue_nc_other_pm);
1029   flist_NoCuts_Other->Add(hMCd0D0_nc_other_pm);
1030   flist_NoCuts_Other->Add(hd0D0_nc_other_sb);
1031   flist_NoCuts_Other->Add(hd0D0VtxTrue_nc_other_sb);
1032   flist_NoCuts_Other->Add(hMCd0D0_nc_other_sb);
1033   
1034   TH1F **hd0D0pt_nc_other_pm=new TH1F*[fnbins];
1035   TH1F **hMCd0D0pt_nc_other_pm=new TH1F*[fnbins];
1036   TH1F ** hd0D0VtxTruept_nc_other_pm=new TH1F*[fnbins];
1037   TH1F **hd0D0pt_nc_other_sb=new TH1F*[fnbins];
1038   TH1F **hMCd0D0pt_nc_other_sb=new TH1F*[fnbins];
1039   TH1F ** hd0D0VtxTruept_nc_other_sb=new TH1F*[fnbins];
1040   namehist="hd0D0pt_nc_other_";
1041   titlehist="D^{0} impact par. plot, No Cuts, Other, ";
1042   for(Int_t i=0;i<fnbins;i++){
1043     strnamept=namehist;
1044     strnamept.Append("PkMss_pt");
1045     strnamept+=i;
1046
1047     strtitlept=titlehist;
1048     strtitlept.Append(" Mass Peak, ");
1049     strtitlept+=fptbins[i];
1050     strtitlept.Append("<= pt <");
1051     strtitlept+=fptbins[i+1];
1052     strtitlept.Append(" [GeV/c]");
1053     
1054     hd0D0pt_nc_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1055     hd0D0pt_nc_other_pm[i]->SetXTitle("Impact parameter [#mum] ");
1056     hd0D0pt_nc_other_pm[i]->SetYTitle("Entries");
1057     flist_NoCuts_Other->Add(hd0D0pt_nc_other_pm[i]);
1058
1059     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1060     hMCd0D0pt_nc_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1061     hMCd0D0pt_nc_other_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1062     hMCd0D0pt_nc_other_pm[i]->SetYTitle("Entries");
1063     flist_NoCuts_Other->Add(hMCd0D0pt_nc_other_pm[i]);
1064  
1065
1066     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1067     hd0D0VtxTruept_nc_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1068     hd0D0VtxTruept_nc_other_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1069     hd0D0VtxTruept_nc_other_pm[i]->SetYTitle("Entries");
1070     flist_NoCuts_Other->Add(hd0D0VtxTruept_nc_other_pm[i]);
1071     
1072     strnamept=namehist;
1073     strnamept.Append("SBMss_pt");
1074     strnamept+=i;
1075
1076     strtitlept=titlehist;
1077     strtitlept.Append(" Side Bands, ");
1078     strtitlept+=fptbins[i];
1079     strtitlept.Append("<= pt <");
1080     strtitlept+=fptbins[i+1];
1081     strtitlept.Append(" [GeV/c]");
1082     
1083     hd0D0pt_nc_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1084     hd0D0pt_nc_other_sb[i]->SetXTitle("Impact parameter [#mum] ");
1085     hd0D0pt_nc_other_sb[i]->SetYTitle("Entries");
1086     flist_NoCuts_Other->Add(hd0D0pt_nc_other_sb[i]);
1087
1088     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1089     hMCd0D0pt_nc_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1090     hMCd0D0pt_nc_other_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1091     hMCd0D0pt_nc_other_sb[i]->SetYTitle("Entries");
1092     flist_NoCuts_Other->Add(hMCd0D0pt_nc_other_sb[i]);
1093
1094     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1095     hd0D0VtxTruept_nc_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1096     hd0D0VtxTruept_nc_other_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1097     hd0D0VtxTruept_nc_other_sb[i]->SetYTitle("Entries");
1098     flist_NoCuts_Other->Add(hd0D0VtxTruept_nc_other_sb[i]);
1099   }
1100
1101
1102   //################################################################################################
1103   //                                                                                               #
1104   //                         HISTOS FOR LOOSE CUTS                                                 #
1105   //                                                                                               #
1106   //################################################################################################
1107
1108   //############ LOOSE CUTS SIGNAL HISTOGRAMS ###############
1109   //
1110   // ####### global properties histo ############
1111
1112   TH2F *hCPtaVSd0d0_ls_sign=new TH2F("hCPtaVSd0d0_ls_sign","hCPtaVSd0d0_LooseCuts_Signal",1000,-100000.,100000.,100,0.,1.);
1113   TH1F *hSecVtxZ_ls_sign=new TH1F("hSecVtxZ_ls_sign","hSecVtxZ_LooseCuts_Signal",1000,-8.,8.);
1114   TH1F *hSecVtxX_ls_sign=new TH1F("hSecVtxX_ls_sign","hSecVtxX_LooseCuts_Signal",1000,-3000.,3000.);
1115   TH1F *hSecVtxY_ls_sign=new TH1F("hSecVtxY_ls_sign","hSecVtxY_LooseCuts_Signal",1000,-3000.,3000.);
1116   TH2F *hSecVtxXY_ls_sign=new TH2F("hSecVtxXY_ls_sign","hSecVtxXY_LooseCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
1117   TH1F *hSecVtxPhi_ls_sign=new TH1F("hSecVtxPhi_ls_sign","hSecVtxPhi_LooseCuts_Signal",180,-180.1,180.1);
1118   TH1F *hCPta_ls_sign=new TH1F("hCPta_ls_sign","hCPta_LooseCuts_Signal",100,0.,1.);
1119   TH1F *hd0xd0_ls_sign=new TH1F("hd0xd0_ls_sign","hd0xd0_LooseCuts_Signal",1000,-100000.,100000.);
1120   TH1F *hMassTrue_ls_sign=new TH1F("hMassTrue_ls_sign","D^{0} MC inv. Mass Loose Cuts Signal(All momenta)",600,1.600,2.200);
1121   TH1F *hMass_ls_sign=new TH1F("hMass_ls_sign","D^{0} inv. Mass Loose Cuts Signal (All momenta)",600,1.600,2.200);
1122   hMass_ls_sign->Sumw2();
1123   TH1F *hMassTrue_ls_sign_pm=new TH1F("hMassTrue_ls_sign_pm","D^{0} MC inv. Mass Loose Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
1124   TH1F *hMass_ls_sign_pm=new TH1F("hMass_ls_sign_pm","D^{0} inv. Mass Loose Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
1125   hMass_ls_sign_pm->Sumw2();
1126   TH1F *hMassTrue_SB_ls_sign=new TH1F("hMassTrue_ls_sign_sb","D^{0} MC inv. Mass in Side Bands Loose Cuts Signal(All momenta)",600,1.600,2.200);
1127   TH1F *hMass_SB_ls_sign=new TH1F("hMass_ls_sign_sb","D^{0} inv. Mass in Side Bands Loose Cuts Signal (All momenta)",600,1.600,2.200);
1128   hMass_SB_ls_sign->Sumw2();
1129
1130   flist_LsCuts_Signal->Add(hCPtaVSd0d0_ls_sign);
1131   flist_LsCuts_Signal->Add(hSecVtxZ_ls_sign);
1132   flist_LsCuts_Signal->Add(hSecVtxY_ls_sign);
1133   flist_LsCuts_Signal->Add(hSecVtxX_ls_sign);
1134   flist_LsCuts_Signal->Add(hSecVtxXY_ls_sign);
1135   flist_LsCuts_Signal->Add(hSecVtxPhi_ls_sign);
1136   flist_LsCuts_Signal->Add(hCPta_ls_sign);
1137   flist_LsCuts_Signal->Add(hd0xd0_ls_sign);
1138   flist_LsCuts_Signal->Add(hMassTrue_ls_sign);
1139   flist_LsCuts_Signal->Add(hMass_ls_sign);
1140   flist_LsCuts_Signal->Add(hMassTrue_ls_sign_pm);
1141   flist_LsCuts_Signal->Add(hMass_ls_sign_pm);
1142   flist_LsCuts_Signal->Add(hMassTrue_SB_ls_sign);
1143   flist_LsCuts_Signal->Add(hMass_SB_ls_sign);
1144
1145   // ####### d0 D0 histos ############
1146   TH1F *hd0D0_ls_sign_pm = new TH1F("hd0D0_ls_sign_pm","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1147   hd0D0_ls_sign_pm->SetXTitle("Impact parameter [#mum]");
1148   hd0D0_ls_sign_pm->SetYTitle("Entries");
1149
1150   TH1F *hd0D0VtxTrue_ls_sign_pm = new TH1F("hd0D0VtxTrue_ls_sign_pm","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1151   hd0D0VtxTrue_ls_sign_pm->SetXTitle("Impact parameter [#mum]");
1152   hd0D0VtxTrue_ls_sign_pm->SetYTitle("Entries");
1153
1154   TH1F *hMCd0D0_ls_sign_pm = new TH1F("hMCd0D0_ls_sign_pm","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
1155   hMCd0D0_ls_sign_pm->SetXTitle("MC Impact parameter [#mum]");
1156   hMCd0D0_ls_sign_pm->SetYTitle("Entries");
1157
1158   TH1F *hd0D0_ls_sign_sb = new TH1F("hd0D0_ls_sign_sb","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1159   hd0D0_ls_sign_sb->SetXTitle("Impact parameter [#mum]");
1160   hd0D0_ls_sign_sb->SetYTitle("Entries");
1161
1162   TH1F *hd0D0VtxTrue_ls_sign_sb = new TH1F("hd0D0VtxTrue_ls_sign_sb","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1163   hd0D0VtxTrue_ls_sign_sb->SetXTitle("Impact parameter [#mum]");
1164   hd0D0VtxTrue_ls_sign_sb->SetYTitle("Entries");
1165
1166   TH1F *hMCd0D0_ls_sign_sb = new TH1F("hMCd0D0_ls_sign_sb","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
1167   hMCd0D0_ls_sign_sb->SetXTitle("MC Impact parameter [#mum]");
1168   hMCd0D0_ls_sign_sb->SetYTitle("Entries");
1169
1170   flist_LsCuts_Signal->Add(hd0D0_ls_sign_pm);
1171   flist_LsCuts_Signal->Add(hd0D0VtxTrue_ls_sign_pm);
1172   flist_LsCuts_Signal->Add(hMCd0D0_ls_sign_pm);
1173   flist_LsCuts_Signal->Add(hd0D0_ls_sign_sb);
1174   flist_LsCuts_Signal->Add(hd0D0VtxTrue_ls_sign_sb);
1175   flist_LsCuts_Signal->Add(hMCd0D0_ls_sign_sb);
1176   
1177   TH1F **hd0D0pt_ls_sign_pm=new TH1F*[fnbins];
1178   TH1F **hMCd0D0pt_ls_sign_pm=new TH1F*[fnbins];
1179   TH1F ** hd0D0VtxTruept_ls_sign_pm=new TH1F*[fnbins];
1180   TH1F **hd0D0pt_ls_sign_sb=new TH1F*[fnbins];
1181   TH1F **hMCd0D0pt_ls_sign_sb=new TH1F*[fnbins];
1182   TH1F ** hd0D0VtxTruept_ls_sign_sb=new TH1F*[fnbins];
1183   namehist="hd0D0pt_ls_sign_";
1184   titlehist="D^{0} impact par. plot, Loose Cuts, Signal, ";
1185   for(Int_t i=0;i<fnbins;i++){
1186     strnamept=namehist;
1187     strnamept.Append("PkMss_pt");
1188     strnamept+=i;
1189
1190     strtitlept=titlehist;
1191     strtitlept.Append(" Mass Peak, ");
1192     strtitlept+=fptbins[i];
1193     strtitlept.Append("<= pt <");
1194     strtitlept+=fptbins[i+1];
1195     strtitlept.Append(" [GeV/c]");
1196     
1197     hd0D0pt_ls_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1198     hd0D0pt_ls_sign_pm[i]->SetXTitle("Impact parameter [#mum] ");
1199     hd0D0pt_ls_sign_pm[i]->SetYTitle("Entries");
1200     flist_LsCuts_Signal->Add(hd0D0pt_ls_sign_pm[i]);
1201
1202     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1203     hMCd0D0pt_ls_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1204     hMCd0D0pt_ls_sign_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1205     hMCd0D0pt_ls_sign_pm[i]->SetYTitle("Entries");
1206     flist_LsCuts_Signal->Add(hMCd0D0pt_ls_sign_pm[i]);
1207  
1208
1209     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1210     hd0D0VtxTruept_ls_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1211     hd0D0VtxTruept_ls_sign_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1212     hd0D0VtxTruept_ls_sign_pm[i]->SetYTitle("Entries");
1213     flist_LsCuts_Signal->Add(hd0D0VtxTruept_ls_sign_pm[i]);
1214     
1215     strnamept=namehist;
1216     strnamept.Append("SBMss_pt");
1217     strnamept+=i;
1218
1219     strtitlept=titlehist;
1220     strtitlept.Append(" Side Bands, ");
1221     strtitlept+=fptbins[i];
1222     strtitlept.Append("<= pt <");
1223     strtitlept+=fptbins[i+1];
1224     strtitlept.Append(" [GeV/c]");
1225     
1226     hd0D0pt_ls_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1227     hd0D0pt_ls_sign_sb[i]->SetXTitle("Impact parameter [#mum] ");
1228     hd0D0pt_ls_sign_sb[i]->SetYTitle("Entries");
1229     flist_LsCuts_Signal->Add(hd0D0pt_ls_sign_sb[i]);
1230
1231     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1232     hMCd0D0pt_ls_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1233     hMCd0D0pt_ls_sign_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1234     hMCd0D0pt_ls_sign_sb[i]->SetYTitle("Entries");
1235     flist_LsCuts_Signal->Add(hMCd0D0pt_ls_sign_sb[i]);
1236
1237     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1238     hd0D0VtxTruept_ls_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1239     hd0D0VtxTruept_ls_sign_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1240     hd0D0VtxTruept_ls_sign_sb[i]->SetYTitle("Entries");
1241     flist_LsCuts_Signal->Add(hd0D0VtxTruept_ls_sign_sb[i]);
1242   }
1243
1244
1245   //############ LOOSE CUTS BACKGROUND HISTOGRAMS ###########
1246   //
1247   //   ######## global properties histos #######
1248   TH2F *hCPtaVSd0d0_ls_back=new TH2F("hCPtaVSd0d0_ls_back","hCPtaVSd0d0_LooseCuts_Background",1000,-100000.,100000.,100,0.,1.);
1249   TH1F *hSecVtxZ_ls_back=new TH1F("hSecVtxZ_ls_back","hSecVtxZ_LooseCuts_Background",1000,-8.,8.);
1250   TH1F *hSecVtxX_ls_back=new TH1F("hSecVtxX_ls_back","hSecVtxX_LooseCuts_Background",1000,-3000.,3000.);
1251   TH1F *hSecVtxY_ls_back=new TH1F("hSecVtxY_ls_back","hSecVtxY_LooseCuts_Background",1000,-3000.,3000.);
1252   TH2F *hSecVtxXY_ls_back=new TH2F("hSecVtxXY_ls_back","hSecVtxXY_LooseCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
1253   TH1F *hSecVtxPhi_ls_back=new TH1F("hSecVtxPhi_ls_back","hSecVtxPhi_LooseCuts_Background",180,-180.1,180.1);
1254   TH1F *hCPta_ls_back=new TH1F("hCPta_ls_back","hCPta_LooseCuts_Background",100,0.,1.);
1255   TH1F *hd0xd0_ls_back=new TH1F("hd0xd0_ls_back","hd0xd0_LooseCuts_Background",1000,-100000.,100000.);
1256   TH1F *hMassTrue_ls_back=new TH1F("hMassTrue_ls_back","D^{0} MC inv. Mass Loose Cuts Background(All momenta)",600,1.600,2.200);
1257   TH1F *hMass_ls_back=new TH1F("hMass_ls_back","D^{0} inv. Mass Loose Cuts Background (All momenta)",600,1.600,2.200);
1258   hMass_ls_back->Sumw2();
1259   TH1F *hMassTrue_ls_back_pm=new TH1F("hMassTrue_ls_back_pm","D^{0} MC inv. Mass Loose Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
1260   TH1F *hMass_ls_back_pm=new TH1F("hMass_ls_back_pm","D^{0} inv. Mass Loose Cuts Background (All momenta), MassPeak",600,1.600,2.200);
1261   hMass_ls_back_pm->Sumw2();
1262   TH1F *hMassTrue_SB_ls_back=new TH1F("hMassTrue_ls_back_sb","D^{0} MC inv. Mass in Side Bands Loose Cuts Background(All momenta)",600,1.600,2.200);
1263   TH1F *hMass_SB_ls_back=new TH1F("hMass_ls_back_sb","D^{0} inv. Mass in Side Bands Loose Cuts Background (All momenta)",600,1.600,2.200);
1264   hMass_SB_ls_back->Sumw2();
1265
1266   flist_LsCuts_Back->Add(hCPtaVSd0d0_ls_back);
1267   flist_LsCuts_Back->Add(hSecVtxZ_ls_back);
1268   flist_LsCuts_Back->Add(hSecVtxY_ls_back);
1269   flist_LsCuts_Back->Add(hSecVtxX_ls_back);
1270   flist_LsCuts_Back->Add(hSecVtxXY_ls_back);
1271   flist_LsCuts_Back->Add(hSecVtxPhi_ls_back);
1272   flist_LsCuts_Back->Add(hCPta_ls_back);
1273   flist_LsCuts_Back->Add(hd0xd0_ls_back);
1274   flist_LsCuts_Back->Add(hMassTrue_ls_back);
1275   flist_LsCuts_Back->Add(hMass_ls_back);
1276   flist_LsCuts_Back->Add(hMassTrue_ls_back_pm);
1277   flist_LsCuts_Back->Add(hMass_ls_back_pm);
1278   flist_LsCuts_Back->Add(hMassTrue_SB_ls_back);
1279   flist_LsCuts_Back->Add(hMass_SB_ls_back);
1280
1281
1282   // ####### d0 D0 histos ############
1283   
1284  TH1F *hd0D0_ls_back_pm = new TH1F("hd0D0_ls_back_pm","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1285   hd0D0_ls_back_pm->SetXTitle("Impact parameter [#mum]");
1286   hd0D0_ls_back_pm->SetYTitle("Entries");
1287
1288   TH1F *hd0D0VtxTrue_ls_back_pm = new TH1F("hd0D0VtxTrue_ls_back_pm","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1289   hd0D0VtxTrue_ls_back_pm->SetXTitle("Impact parameter [#mum]");
1290   hd0D0VtxTrue_ls_back_pm->SetYTitle("Entries");
1291
1292   TH1F *hMCd0D0_ls_back_pm = new TH1F("hMCd0D0_ls_back_pm","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
1293   hMCd0D0_ls_back_pm->SetXTitle("MC Impact parameter [#mum]");
1294   hMCd0D0_ls_back_pm->SetYTitle("Entries");
1295
1296   TH1F *hd0D0_ls_back_sb = new TH1F("hd0D0_ls_back_sb","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1297   hd0D0_ls_back_sb->SetXTitle("Impact parameter [#mum]");
1298   hd0D0_ls_back_sb->SetYTitle("Entries");
1299
1300   TH1F *hd0D0VtxTrue_ls_back_sb = new TH1F("hd0D0VtxTrue_ls_back_sb","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1301   hd0D0VtxTrue_ls_back_sb->SetXTitle("Impact parameter [#mum]");
1302   hd0D0VtxTrue_ls_back_sb->SetYTitle("Entries");
1303
1304   TH1F *hMCd0D0_ls_back_sb = new TH1F("hMCd0D0_ls_back_sb","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
1305   hMCd0D0_ls_back_sb->SetXTitle("MC Impact parameter [#mum]");
1306   hMCd0D0_ls_back_sb->SetYTitle("Entries");
1307
1308   flist_LsCuts_Back->Add(hd0D0_ls_back_pm);
1309   flist_LsCuts_Back->Add(hd0D0VtxTrue_ls_back_pm);
1310   flist_LsCuts_Back->Add(hMCd0D0_ls_back_pm);
1311   flist_LsCuts_Back->Add(hd0D0_ls_back_sb);
1312   flist_LsCuts_Back->Add(hd0D0VtxTrue_ls_back_sb);
1313   flist_LsCuts_Back->Add(hMCd0D0_ls_back_sb);
1314   
1315   TH1F **hd0D0pt_ls_back_pm=new TH1F*[fnbins];
1316   TH1F **hMCd0D0pt_ls_back_pm=new TH1F*[fnbins];
1317   TH1F ** hd0D0VtxTruept_ls_back_pm=new TH1F*[fnbins];
1318   TH1F **hd0D0pt_ls_back_sb=new TH1F*[fnbins];
1319   TH1F **hMCd0D0pt_ls_back_sb=new TH1F*[fnbins];
1320   TH1F ** hd0D0VtxTruept_ls_back_sb=new TH1F*[fnbins];
1321   namehist="hd0D0pt_ls_back_";
1322   titlehist="D^{0} impact par. plot, Loose Cuts, Background, ";
1323   for(Int_t i=0;i<fnbins;i++){
1324     strnamept=namehist;
1325     strnamept.Append("PkMss_pt");
1326     strnamept+=i;
1327
1328     strtitlept=titlehist;
1329     strtitlept.Append(" Mass Peak, ");
1330     strtitlept+=fptbins[i];
1331     strtitlept.Append("<= pt <");
1332     strtitlept+=fptbins[i+1];
1333     strtitlept.Append(" [GeV/c]");
1334     
1335     hd0D0pt_ls_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1336     hd0D0pt_ls_back_pm[i]->SetXTitle("Impact parameter [#mum] ");
1337     hd0D0pt_ls_back_pm[i]->SetYTitle("Entries");
1338     flist_LsCuts_Back->Add(hd0D0pt_ls_back_pm[i]);
1339
1340     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1341     hMCd0D0pt_ls_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1342     hMCd0D0pt_ls_back_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1343     hMCd0D0pt_ls_back_pm[i]->SetYTitle("Entries");
1344     flist_LsCuts_Back->Add(hMCd0D0pt_ls_back_pm[i]);
1345  
1346
1347     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1348     hd0D0VtxTruept_ls_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1349     hd0D0VtxTruept_ls_back_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1350     hd0D0VtxTruept_ls_back_pm[i]->SetYTitle("Entries");
1351     flist_LsCuts_Back->Add(hd0D0VtxTruept_ls_back_pm[i]);
1352     
1353     strnamept=namehist;
1354     strnamept.Append("SBMss_pt");
1355     strnamept+=i;
1356
1357     strtitlept=titlehist;
1358     strtitlept.Append(" Side Bands, ");
1359     strtitlept+=fptbins[i];
1360     strtitlept.Append("<= pt <");
1361     strtitlept+=fptbins[i+1];
1362     strtitlept.Append(" [GeV/c]");
1363     
1364     hd0D0pt_ls_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1365     hd0D0pt_ls_back_sb[i]->SetXTitle("Impact parameter [#mum] ");
1366     hd0D0pt_ls_back_sb[i]->SetYTitle("Entries");
1367     flist_LsCuts_Back->Add(hd0D0pt_ls_back_sb[i]);
1368
1369     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1370     hMCd0D0pt_ls_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1371     hMCd0D0pt_ls_back_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1372     hMCd0D0pt_ls_back_sb[i]->SetYTitle("Entries");
1373     flist_LsCuts_Back->Add(hMCd0D0pt_ls_back_sb[i]);
1374
1375     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1376     hd0D0VtxTruept_ls_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1377     hd0D0VtxTruept_ls_back_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1378     hd0D0VtxTruept_ls_back_sb[i]->SetYTitle("Entries");
1379     flist_LsCuts_Back->Add(hd0D0VtxTruept_ls_back_sb[i]);
1380   }
1381
1382
1383
1384  //############ LOOSE CUTS FROMB HISTOGRAMS ###########
1385   //
1386   //#######  global properties histos
1387
1388   TH2F *hCPtaVSd0d0_ls_fromB=new TH2F("hCPtaVSd0d0_ls_fromB","hCPtaVSd0d0_LooseCuts_FromB",1000,-100000.,100000.,100,0.,1.);
1389   TH1F *hSecVtxZ_ls_fromB=new TH1F("hSecVtxZ_ls_fromB","hSecVtxZ_LooseCuts_FromB",1000,-8.,8.);
1390   TH1F *hSecVtxX_ls_fromB=new TH1F("hSecVtxX_ls_fromB","hSecVtxX_LooseCuts_FromB",1000,-3000.,3000.);
1391   TH1F *hSecVtxY_ls_fromB=new TH1F("hSecVtxY_ls_fromB","hSecVtxY_LooseCuts_FromB",1000,-3000.,3000.);
1392   TH2F *hSecVtxXY_ls_fromB=new TH2F("hSecVtxXY_ls_fromB","hSecVtxXY_LooseCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
1393   TH1F *hSecVtxPhi_ls_fromB=new TH1F("hSecVtxPhi_ls_fromB","hSecVtxPhi_LooseCuts_FromB",180,-180.1,180.1);
1394   TH1F *hCPta_ls_fromB=new TH1F("hCPta_ls_fromB","hCPta_LooseCuts_FromB",100,0.,1.);
1395   TH1F *hd0xd0_ls_fromB=new TH1F("hd0xd0_ls_fromB","hd0xd0_LooseCuts_FromB",1000,-100000.,100000.);
1396   TH1F *hMassTrue_ls_fromB=new TH1F("hMassTrue_ls_fromB","D^{0} MC inv. Mass Loose Cuts FromB(All momenta)",600,1.600,2.200);
1397   TH1F *hMass_ls_fromB=new TH1F("hMass_ls_fromB","D^{0} inv. Mass Loose Cuts FromB (All momenta)",600,1.600,2.200);
1398   hMass_ls_fromB->Sumw2();
1399   TH1F *hMassTrue_ls_fromB_pm=new TH1F("hMassTrue_ls_fromB_pm","D^{0} MC inv. Mass Loose Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
1400   TH1F *hMass_ls_fromB_pm=new TH1F("hMass_ls_fromB_pm","D^{0} inv. Mass Loose Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
1401   hMass_ls_fromB_pm->Sumw2();
1402   TH1F *hMassTrue_SB_ls_fromB=new TH1F("hMassTrue_ls_fromB_sb","D^{0} MC inv. Mass in Side Bands Loose Cuts FromB(All momenta)",600,1.600,2.200);
1403   TH1F *hMass_SB_ls_fromB=new TH1F("hMass_ls_fromB_sb","D^{0} inv. Mass in Side Bands Loose Cuts FromB (All momenta)",600,1.600,2.200);
1404   hMass_SB_ls_fromB->Sumw2();
1405
1406   flist_LsCuts_FromB->Add(hCPtaVSd0d0_ls_fromB);
1407   flist_LsCuts_FromB->Add(hSecVtxZ_ls_fromB);
1408   flist_LsCuts_FromB->Add(hSecVtxY_ls_fromB);
1409   flist_LsCuts_FromB->Add(hSecVtxX_ls_fromB);
1410   flist_LsCuts_FromB->Add(hSecVtxXY_ls_fromB);
1411   flist_LsCuts_FromB->Add(hSecVtxPhi_ls_fromB);
1412   flist_LsCuts_FromB->Add(hCPta_ls_fromB);
1413   flist_LsCuts_FromB->Add(hd0xd0_ls_fromB);
1414   flist_LsCuts_FromB->Add(hMassTrue_ls_fromB);
1415   flist_LsCuts_FromB->Add(hMass_ls_fromB);
1416   flist_LsCuts_FromB->Add(hMassTrue_ls_fromB_pm);
1417   flist_LsCuts_FromB->Add(hMass_ls_fromB_pm);
1418   flist_LsCuts_FromB->Add(hMassTrue_SB_ls_fromB);
1419   flist_LsCuts_FromB->Add(hMass_SB_ls_fromB);
1420
1421   // ######### d0 D0 histos ##############
1422   TH1F *hd0D0_ls_fromB_pm = new TH1F("hd0D0_ls_fromB_pm","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1423   hd0D0_ls_fromB_pm->SetXTitle("Impact parameter [#mum]");
1424   hd0D0_ls_fromB_pm->SetYTitle("Entries");
1425
1426   TH1F *hd0D0VtxTrue_ls_fromB_pm = new TH1F("hd0D0VtxTrue_ls_fromB_pm","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1427   hd0D0VtxTrue_ls_fromB_pm->SetXTitle("Impact parameter [#mum]");
1428   hd0D0VtxTrue_ls_fromB_pm->SetYTitle("Entries");
1429
1430   TH1F *hMCd0D0_ls_fromB_pm = new TH1F("hMCd0D0_ls_fromB_pm","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
1431   hMCd0D0_ls_fromB_pm->SetXTitle("MC Impact parameter [#mum]");
1432   hMCd0D0_ls_fromB_pm->SetYTitle("Entries");
1433
1434   TH1F *hd0D0_ls_fromB_sb = new TH1F("hd0D0_ls_fromB_sb","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1435   hd0D0_ls_fromB_sb->SetXTitle("Impact parameter [#mum]");
1436   hd0D0_ls_fromB_sb->SetYTitle("Entries");
1437
1438   TH1F *hd0D0VtxTrue_ls_fromB_sb = new TH1F("hd0D0VtxTrue_ls_fromB_sb","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1439   hd0D0VtxTrue_ls_fromB_sb->SetXTitle("Impact parameter [#mum]");
1440   hd0D0VtxTrue_ls_fromB_sb->SetYTitle("Entries");
1441
1442   TH1F *hMCd0D0_ls_fromB_sb = new TH1F("hMCd0D0_ls_fromB_sb","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
1443   hMCd0D0_ls_fromB_sb->SetXTitle("MC Impact parameter [#mum]");
1444   hMCd0D0_ls_fromB_sb->SetYTitle("Entries");
1445
1446   flist_LsCuts_FromB->Add(hd0D0_ls_fromB_pm);
1447   flist_LsCuts_FromB->Add(hd0D0VtxTrue_ls_fromB_pm);
1448   flist_LsCuts_FromB->Add(hMCd0D0_ls_fromB_pm);
1449   flist_LsCuts_FromB->Add(hd0D0_ls_fromB_sb);
1450   flist_LsCuts_FromB->Add(hd0D0VtxTrue_ls_fromB_sb);
1451   flist_LsCuts_FromB->Add(hMCd0D0_ls_fromB_sb);
1452   
1453   TH1F **hd0D0pt_ls_fromB_pm=new TH1F*[fnbins];
1454   TH1F **hMCd0D0pt_ls_fromB_pm=new TH1F*[fnbins];
1455   TH1F ** hd0D0VtxTruept_ls_fromB_pm=new TH1F*[fnbins];
1456   TH1F **hd0D0pt_ls_fromB_sb=new TH1F*[fnbins];
1457   TH1F **hMCd0D0pt_ls_fromB_sb=new TH1F*[fnbins];
1458   TH1F ** hd0D0VtxTruept_ls_fromB_sb=new TH1F*[fnbins];
1459   namehist="hd0D0pt_ls_fromB_";
1460   titlehist="D^{0} impact par. plot, Loose Cuts, FromB, ";
1461   for(Int_t i=0;i<fnbins;i++){
1462     strnamept=namehist;
1463     strnamept.Append("PkMss_pt");
1464     strnamept+=i;
1465
1466     strtitlept=titlehist;
1467     strtitlept.Append(" Mass Peak, ");
1468     strtitlept+=fptbins[i];
1469     strtitlept.Append("<= pt <");
1470     strtitlept+=fptbins[i+1];
1471     strtitlept.Append(" [GeV/c]");
1472     
1473     hd0D0pt_ls_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1474     hd0D0pt_ls_fromB_pm[i]->SetXTitle("Impact parameter [#mum] ");
1475     hd0D0pt_ls_fromB_pm[i]->SetYTitle("Entries");
1476     flist_LsCuts_FromB->Add(hd0D0pt_ls_fromB_pm[i]);
1477
1478     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1479     hMCd0D0pt_ls_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1480     hMCd0D0pt_ls_fromB_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1481     hMCd0D0pt_ls_fromB_pm[i]->SetYTitle("Entries");
1482     flist_LsCuts_FromB->Add(hMCd0D0pt_ls_fromB_pm[i]);
1483  
1484
1485     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1486     hd0D0VtxTruept_ls_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1487     hd0D0VtxTruept_ls_fromB_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1488     hd0D0VtxTruept_ls_fromB_pm[i]->SetYTitle("Entries");
1489     flist_LsCuts_FromB->Add(hd0D0VtxTruept_ls_fromB_pm[i]);
1490     
1491     strnamept=namehist;
1492     strnamept.Append("SBMss_pt");
1493     strnamept+=i;
1494
1495     strtitlept=titlehist;
1496     strtitlept.Append(" Side Bands, ");
1497     strtitlept+=fptbins[i];
1498     strtitlept.Append("<= pt <");
1499     strtitlept+=fptbins[i+1];
1500     strtitlept.Append(" [GeV/c]");
1501     
1502     hd0D0pt_ls_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1503     hd0D0pt_ls_fromB_sb[i]->SetXTitle("Impact parameter [#mum] ");
1504     hd0D0pt_ls_fromB_sb[i]->SetYTitle("Entries");
1505     flist_LsCuts_FromB->Add(hd0D0pt_ls_fromB_sb[i]);
1506
1507     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1508     hMCd0D0pt_ls_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1509     hMCd0D0pt_ls_fromB_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1510     hMCd0D0pt_ls_fromB_sb[i]->SetYTitle("Entries");
1511     flist_LsCuts_FromB->Add(hMCd0D0pt_ls_fromB_sb[i]);
1512
1513     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1514     hd0D0VtxTruept_ls_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1515     hd0D0VtxTruept_ls_fromB_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1516     hd0D0VtxTruept_ls_fromB_sb[i]->SetYTitle("Entries");
1517     flist_LsCuts_FromB->Add(hd0D0VtxTruept_ls_fromB_sb[i]);
1518   }
1519
1520
1521
1522  //############ LOOSE CUTS FROM DSTAR HISTOGRAMS ###########
1523  //
1524   //############## global properties histos
1525   TH2F *hCPtaVSd0d0_ls_fromDstar=new TH2F("hCPtaVSd0d0_ls_fromDstar","hCPtaVSd0d0_LooseCuts_FromDStar",1000,-100000.,100000.,100,0.,1.);
1526   TH1F *hSecVtxZ_ls_fromDstar=new TH1F("hSecVtxZ_ls_fromDstar","hSecVtxZ_LooseCuts_FromDStar",1000,-8.,8.);
1527   TH1F *hSecVtxX_ls_fromDstar=new TH1F("hSecVtxX_ls_fromDstar","hSecVtxX_LooseCuts_FromDStar",1000,-3000.,3000.);
1528   TH1F *hSecVtxY_ls_fromDstar=new TH1F("hSecVtxY_ls_fromDstar","hSecVtxY_LooseCuts_FromDStar",1000,-3000.,3000.);
1529   TH2F *hSecVtxXY_ls_fromDstar=new TH2F("hSecVtxXY_ls_fromDstar","hSecVtxXY_LooseCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
1530   TH1F *hSecVtxPhi_ls_fromDstar=new TH1F("hSecVtxPhi_ls_fromDstar","hSecVtxPhi_LooseCuts_FromDStar",180,-180.1,180.1);
1531   TH1F *hCPta_ls_fromDstar=new TH1F("hCPta_ls_fromDstar","hCPta_LooseCuts_FromDStar",100,0.,1.);
1532   TH1F *hd0xd0_ls_fromDstar=new TH1F("hd0xd0_ls_fromDstar","hd0xd0_LooseCuts_FromDStar",1000,-100000.,100000.);
1533   TH1F *hMassTrue_ls_fromDstar=new TH1F("hMassTrue_ls_fromDstar","D^{0} MC inv. Mass Loose Cuts FromDStar(All momenta)",600,1.600,2.200);
1534   TH1F *hMass_ls_fromDstar=new TH1F("hMass_ls_fromDstar","D^{0} inv. Mass Loose Cuts FromDStar (All momenta)",600,1.600,2.200);
1535   hMass_ls_fromDstar->Sumw2();
1536   TH1F *hMassTrue_ls_fromDstar_pm=new TH1F("hMassTrue_ls_fromDstar_pm","D^{0} MC inv. Mass Loose Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
1537   TH1F *hMass_ls_fromDstar_pm=new TH1F("hMass_ls_fromDstar_pm","D^{0} inv. Mass Loose Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
1538   hMass_ls_fromDstar_pm->Sumw2();
1539   TH1F *hMassTrue_SB_ls_fromDstar=new TH1F("hMassTrue_ls_fromDstar_sb","D^{0} MC inv. Mass in Side Bands Loose Cuts FromDStar(All momenta)",600,1.600,2.200);
1540   TH1F *hMass_SB_ls_fromDstar=new TH1F("hMass_ls_fromDstar_sb","D^{0} inv. Mass in Side Bands Loose Cuts FromDStar (All momenta)",600,1.600,2.200);
1541   hMass_SB_ls_fromDstar->Sumw2();
1542
1543   flist_LsCuts_FromDstar->Add(hCPtaVSd0d0_ls_fromDstar);
1544   flist_LsCuts_FromDstar->Add(hSecVtxZ_ls_fromDstar);
1545   flist_LsCuts_FromDstar->Add(hSecVtxY_ls_fromDstar);
1546   flist_LsCuts_FromDstar->Add(hSecVtxX_ls_fromDstar);
1547   flist_LsCuts_FromDstar->Add(hSecVtxXY_ls_fromDstar);
1548   flist_LsCuts_FromDstar->Add(hSecVtxPhi_ls_fromDstar);
1549   flist_LsCuts_FromDstar->Add(hCPta_ls_fromDstar);
1550   flist_LsCuts_FromDstar->Add(hd0xd0_ls_fromDstar);
1551   flist_LsCuts_FromDstar->Add(hMassTrue_ls_fromDstar);
1552   flist_LsCuts_FromDstar->Add(hMass_ls_fromDstar);
1553  flist_LsCuts_FromDstar->Add(hMassTrue_ls_fromDstar_pm);
1554   flist_LsCuts_FromDstar->Add(hMass_ls_fromDstar_pm);
1555   flist_LsCuts_FromDstar->Add(hMassTrue_SB_ls_fromDstar);
1556   flist_LsCuts_FromDstar->Add(hMass_SB_ls_fromDstar);
1557
1558   //########## d0 D0 histos #############  
1559   TH1F *hd0D0_ls_fromDst_pm = new TH1F("hd0D0_ls_fromDstar_pm","D^{0} impact par. plot , Loose Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1560   hd0D0_ls_fromDst_pm->SetXTitle("Impact parameter [#mum]");
1561   hd0D0_ls_fromDst_pm->SetYTitle("Entries");
1562
1563   TH1F *hd0D0VtxTrue_ls_fromDst_pm = new TH1F("hd0D0VtxTrue_ls_fromDstar_pm","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1564   hd0D0VtxTrue_ls_fromDst_pm->SetXTitle("Impact parameter [#mum]");
1565   hd0D0VtxTrue_ls_fromDst_pm->SetYTitle("Entries");
1566
1567   TH1F *hMCd0D0_ls_fromDst_pm = new TH1F("hMCd0D0_ls_fromDstar_pm","D^{0} impact par. plot, Loose Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
1568   hMCd0D0_ls_fromDst_pm->SetXTitle("MC Impact parameter [#mum]");
1569   hMCd0D0_ls_fromDst_pm->SetYTitle("Entries");
1570
1571   TH1F *hd0D0_ls_fromDst_sb = new TH1F("hd0D0_ls_fromDstar_sb","D^{0} impact par. plot , Loose Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1572   hd0D0_ls_fromDst_sb->SetXTitle("Impact parameter [#mum]");
1573   hd0D0_ls_fromDst_sb->SetYTitle("Entries");
1574
1575   TH1F *hd0D0VtxTrue_ls_fromDst_sb = new TH1F("hd0D0VtxTrue_ls_fromDstar_sb","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1576   hd0D0VtxTrue_ls_fromDst_sb->SetXTitle("Impact parameter [#mum]");
1577   hd0D0VtxTrue_ls_fromDst_sb->SetYTitle("Entries");
1578
1579   TH1F *hMCd0D0_ls_fromDst_sb = new TH1F("hMCd0D0_ls_fromDstar_sb","D^{0} impact par. plot, Loose Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
1580   hMCd0D0_ls_fromDst_sb->SetXTitle("MC Impact parameter [#mum]");
1581   hMCd0D0_ls_fromDst_sb->SetYTitle("Entries");
1582
1583   flist_LsCuts_FromDstar->Add(hd0D0_ls_fromDst_pm);
1584   flist_LsCuts_FromDstar->Add(hd0D0VtxTrue_ls_fromDst_pm);
1585   flist_LsCuts_FromDstar->Add(hMCd0D0_ls_fromDst_pm);
1586   flist_LsCuts_FromDstar->Add(hd0D0_ls_fromDst_sb);
1587   flist_LsCuts_FromDstar->Add(hd0D0VtxTrue_ls_fromDst_sb);
1588   flist_LsCuts_FromDstar->Add(hMCd0D0_ls_fromDst_sb);
1589   
1590   TH1F **hd0D0pt_ls_fromDst_pm=new TH1F*[fnbins];
1591   TH1F **hMCd0D0pt_ls_fromDst_pm=new TH1F*[fnbins];
1592   TH1F ** hd0D0VtxTruept_ls_fromDst_pm=new TH1F*[fnbins];
1593   TH1F **hd0D0pt_ls_fromDst_sb=new TH1F*[fnbins];
1594   TH1F **hMCd0D0pt_ls_fromDst_sb=new TH1F*[fnbins];
1595   TH1F ** hd0D0VtxTruept_ls_fromDst_sb=new TH1F*[fnbins];
1596   namehist="hd0D0pt_ls_fromDstar_";
1597   titlehist="D^{0} impact par. plot, Loose Cuts, FromDStar, ";
1598   for(Int_t i=0;i<fnbins;i++){
1599     strnamept=namehist;
1600     strnamept.Append("PkMss_pt");
1601     strnamept+=i;
1602
1603     strtitlept=titlehist;
1604     strtitlept.Append(" Mass Peak, ");
1605     strtitlept+=fptbins[i];
1606     strtitlept.Append("<= pt <");
1607     strtitlept+=fptbins[i+1];
1608     strtitlept.Append(" [GeV/c]");
1609     
1610     hd0D0pt_ls_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1611     hd0D0pt_ls_fromDst_pm[i]->SetXTitle("Impact parameter [#mum] ");
1612     hd0D0pt_ls_fromDst_pm[i]->SetYTitle("Entries");
1613     flist_LsCuts_FromDstar->Add(hd0D0pt_ls_fromDst_pm[i]);
1614
1615     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1616     hMCd0D0pt_ls_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1617     hMCd0D0pt_ls_fromDst_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1618     hMCd0D0pt_ls_fromDst_pm[i]->SetYTitle("Entries");
1619     flist_LsCuts_FromDstar->Add(hMCd0D0pt_ls_fromDst_pm[i]);
1620  
1621
1622     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1623     hd0D0VtxTruept_ls_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1624     hd0D0VtxTruept_ls_fromDst_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1625     hd0D0VtxTruept_ls_fromDst_pm[i]->SetYTitle("Entries");
1626     flist_LsCuts_FromDstar->Add(hd0D0VtxTruept_ls_fromDst_pm[i]);
1627     
1628     strnamept=namehist;
1629     strnamept.Append("SBMss_pt");
1630     strnamept+=i;
1631
1632     strtitlept=titlehist;
1633     strtitlept.Append(" Side Bands, ");
1634     strtitlept+=fptbins[i];
1635     strtitlept.Append("<= pt <");
1636     strtitlept+=fptbins[i+1];
1637     strtitlept.Append(" [GeV/c]");
1638     
1639     hd0D0pt_ls_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1640     hd0D0pt_ls_fromDst_sb[i]->SetXTitle("Impact parameter [#mum] ");
1641     hd0D0pt_ls_fromDst_sb[i]->SetYTitle("Entries");
1642     flist_LsCuts_FromDstar->Add(hd0D0pt_ls_fromDst_sb[i]);
1643
1644     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1645     hMCd0D0pt_ls_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1646     hMCd0D0pt_ls_fromDst_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1647     hMCd0D0pt_ls_fromDst_sb[i]->SetYTitle("Entries");
1648     flist_LsCuts_FromDstar->Add(hMCd0D0pt_ls_fromDst_sb[i]);
1649
1650     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1651     hd0D0VtxTruept_ls_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1652     hd0D0VtxTruept_ls_fromDst_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1653     hd0D0VtxTruept_ls_fromDst_sb[i]->SetYTitle("Entries");
1654     flist_LsCuts_FromDstar->Add(hd0D0VtxTruept_ls_fromDst_sb[i]);
1655   }
1656
1657
1658   //############ LOOSE CUTS OTHER HISTOGRAMS ###########
1659   //
1660   //########### global properties histos ###########
1661
1662   TH2F *hCPtaVSd0d0_ls_other=new TH2F("hCPtaVSd0d0_ls_other","hCPtaVSd0d0_LooseCuts_other",1000,-100000.,100000.,100,0.,1.);
1663   TH1F *hSecVtxZ_ls_other=new TH1F("hSecVtxZ_ls_other","hSecVtxZ_LooseCuts_other",1000,-8.,8.);
1664   TH1F *hSecVtxX_ls_other=new TH1F("hSecVtxX_ls_other","hSecVtxX_LooseCuts_other",1000,-3000.,3000.);
1665   TH1F *hSecVtxY_ls_other=new TH1F("hSecVtxY_ls_other","hSecVtxY_LooseCuts_other",1000,-3000.,3000.);
1666   TH2F *hSecVtxXY_ls_other=new TH2F("hSecVtxXY_ls_other","hSecVtxXY_LooseCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
1667   TH1F *hSecVtxPhi_ls_other=new TH1F("hSecVtxPhi_ls_other","hSecVtxPhi_LooseCuts_other",180,-180.1,180.1);
1668   TH1F *hCPta_ls_other=new TH1F("hCPta_ls_other","hCPta_LooseCuts_other",100,0.,1.);
1669   TH1F *hd0xd0_ls_other=new TH1F("hd0xd0_ls_other","hd0xd0_LooseCuts_other",1000,-100000.,100000.);
1670   TH1F *hMassTrue_ls_other=new TH1F("hMassTrue_ls_other","D^{0} MC inv. Mass Loose Cuts other(All momenta)",600,1.600,2.200);
1671   TH1F *hMass_ls_other=new TH1F("hMass_ls_other","D^{0} inv. Mass Loose Cuts other (All momenta)",600,1.600,2.200);
1672   hMass_ls_other->Sumw2();
1673   TH1F *hMassTrue_ls_other_pm=new TH1F("hMassTrue_ls_other_pm","D^{0} MC inv. Mass Loose Cuts other, Mass Peak. (All momenta)",600,1.600,2.200);
1674   TH1F *hMass_ls_other_pm=new TH1F("hMass_ls_other_pm","D^{0} inv. Mass Loose Cuts other (All momenta), MassPeak",600,1.600,2.200);
1675   hMass_ls_other_pm->Sumw2();
1676   TH1F *hMassTrue_SB_ls_other=new TH1F("hMassTrue_ls_other_sb","D^{0} MC inv. Mass in Side Bands Loose Cuts other(All momenta)",600,1.600,2.200);
1677   TH1F *hMass_SB_ls_other=new TH1F("hMass_ls_other_sb","D^{0} inv. Mass in Side Bands Loose Cuts other (All momenta)",600,1.600,2.200);
1678   hMass_SB_ls_other->Sumw2();
1679
1680   flist_LsCuts_Other->Add(hCPtaVSd0d0_ls_other);
1681   flist_LsCuts_Other->Add(hSecVtxZ_ls_other);
1682   flist_LsCuts_Other->Add(hSecVtxY_ls_other);
1683   flist_LsCuts_Other->Add(hSecVtxX_ls_other);
1684   flist_LsCuts_Other->Add(hSecVtxXY_ls_other);
1685   flist_LsCuts_Other->Add(hSecVtxPhi_ls_other);
1686   flist_LsCuts_Other->Add(hCPta_ls_other);
1687   flist_LsCuts_Other->Add(hd0xd0_ls_other);
1688   flist_LsCuts_Other->Add(hMassTrue_ls_other);
1689   flist_LsCuts_Other->Add(hMass_ls_other);
1690   flist_LsCuts_Other->Add(hMassTrue_ls_other_pm);
1691   flist_LsCuts_Other->Add(hMass_ls_other_pm);
1692   flist_LsCuts_Other->Add(hMassTrue_SB_ls_other);
1693   flist_LsCuts_Other->Add(hMass_SB_ls_other);
1694
1695   //############# d0 D0 histos ###############à
1696   TH1F *hd0D0_ls_other_pm = new TH1F("hd0D0_ls_other_pm","D^{0} impact par. plot , Loose Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1697   hd0D0_ls_other_pm->SetXTitle("Impact parameter [#mum]");
1698   hd0D0_ls_other_pm->SetYTitle("Entries");
1699
1700   TH1F *hd0D0VtxTrue_ls_other_pm = new TH1F("hd0D0VtxTrue_ls_other_pm","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1701   hd0D0VtxTrue_ls_other_pm->SetXTitle("Impact parameter [#mum]");
1702   hd0D0VtxTrue_ls_other_pm->SetYTitle("Entries");
1703
1704   TH1F *hMCd0D0_ls_other_pm = new TH1F("hMCd0D0_ls_other_pm","D^{0} impact par. plot, Loose Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
1705   hMCd0D0_ls_other_pm->SetXTitle("MC Impact parameter [#mum]");
1706   hMCd0D0_ls_other_pm->SetYTitle("Entries");
1707
1708   TH1F *hd0D0_ls_other_sb = new TH1F("hd0D0_ls_other_sb","D^{0} impact par. plot , Loose Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1709   hd0D0_ls_other_sb->SetXTitle("Impact parameter [#mum]");
1710   hd0D0_ls_other_sb->SetYTitle("Entries");
1711
1712   TH1F *hd0D0VtxTrue_ls_other_sb = new TH1F("hd0D0VtxTrue_ls_other_sb","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
1713   hd0D0VtxTrue_ls_other_sb->SetXTitle("Impact parameter [#mum]");
1714   hd0D0VtxTrue_ls_other_sb->SetYTitle("Entries");
1715
1716   TH1F *hMCd0D0_ls_other_sb = new TH1F("hMCd0D0_ls_other_sb","D^{0} impact par. plot, Loose Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
1717   hMCd0D0_ls_other_sb->SetXTitle("MC Impact parameter [#mum]");
1718   hMCd0D0_ls_other_sb->SetYTitle("Entries");
1719
1720   flist_LsCuts_Other->Add(hd0D0_ls_other_pm);
1721   flist_LsCuts_Other->Add(hd0D0VtxTrue_ls_other_pm);
1722   flist_LsCuts_Other->Add(hMCd0D0_ls_other_pm);
1723   flist_LsCuts_Other->Add(hd0D0_ls_other_sb);
1724   flist_LsCuts_Other->Add(hd0D0VtxTrue_ls_other_sb);
1725   flist_LsCuts_Other->Add(hMCd0D0_ls_other_sb);
1726   
1727   TH1F **hd0D0pt_ls_other_pm=new TH1F*[fnbins];
1728   TH1F **hMCd0D0pt_ls_other_pm=new TH1F*[fnbins];
1729   TH1F ** hd0D0VtxTruept_ls_other_pm=new TH1F*[fnbins];
1730   TH1F **hd0D0pt_ls_other_sb=new TH1F*[fnbins];
1731   TH1F **hMCd0D0pt_ls_other_sb=new TH1F*[fnbins];
1732   TH1F ** hd0D0VtxTruept_ls_other_sb=new TH1F*[fnbins];
1733   namehist="hd0D0pt_ls_other_";
1734   titlehist="D^{0} impact par. plot, Loose Cuts, Other, ";
1735   for(Int_t i=0;i<fnbins;i++){
1736     strnamept=namehist;
1737     strnamept.Append("PkMss_pt");
1738     strnamept+=i;
1739
1740     strtitlept=titlehist;
1741     strtitlept.Append(" Mass Peak, ");
1742     strtitlept+=fptbins[i];
1743     strtitlept.Append("<= pt <");
1744     strtitlept+=fptbins[i+1];
1745     strtitlept.Append(" [GeV/c]");
1746     
1747     hd0D0pt_ls_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1748     hd0D0pt_ls_other_pm[i]->SetXTitle("Impact parameter [#mum] ");
1749     hd0D0pt_ls_other_pm[i]->SetYTitle("Entries");
1750     flist_LsCuts_Other->Add(hd0D0pt_ls_other_pm[i]);
1751
1752     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1753     hMCd0D0pt_ls_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1754     hMCd0D0pt_ls_other_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1755     hMCd0D0pt_ls_other_pm[i]->SetYTitle("Entries");
1756     flist_LsCuts_Other->Add(hMCd0D0pt_ls_other_pm[i]);
1757  
1758
1759     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1760     hd0D0VtxTruept_ls_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1761     hd0D0VtxTruept_ls_other_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1762     hd0D0VtxTruept_ls_other_pm[i]->SetYTitle("Entries");
1763     flist_LsCuts_Other->Add(hd0D0VtxTruept_ls_other_pm[i]);
1764     
1765     strnamept=namehist;
1766     strnamept.Append("SBMss_pt");
1767     strnamept+=i;
1768
1769     strtitlept=titlehist;
1770     strtitlept.Append(" Side Bands, ");
1771     strtitlept+=fptbins[i];
1772     strtitlept.Append("<= pt <");
1773     strtitlept+=fptbins[i+1];
1774     strtitlept.Append(" [GeV/c]");
1775     
1776     hd0D0pt_ls_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1777     hd0D0pt_ls_other_sb[i]->SetXTitle("Impact parameter [#mum] ");
1778     hd0D0pt_ls_other_sb[i]->SetYTitle("Entries");
1779     flist_LsCuts_Other->Add(hd0D0pt_ls_other_sb[i]);
1780
1781     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1782     hMCd0D0pt_ls_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1783     hMCd0D0pt_ls_other_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1784     hMCd0D0pt_ls_other_sb[i]->SetYTitle("Entries");
1785     flist_LsCuts_Other->Add(hMCd0D0pt_ls_other_sb[i]);
1786
1787     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1788     hd0D0VtxTruept_ls_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1789     hd0D0VtxTruept_ls_other_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1790     hd0D0VtxTruept_ls_other_sb[i]->SetYTitle("Entries");
1791     flist_LsCuts_Other->Add(hd0D0VtxTruept_ls_other_sb[i]);
1792   }
1793
1794
1795
1796
1797   //################################################################################################
1798   //                                                                                               #
1799   //                         HISTOS FOR TIGHT CUTS                                                 #
1800   //                                                                                               #
1801   //################################################################################################
1802
1803   //############ TIGHT CUTS SIGNAL HISTOGRAMS ###############
1804   //
1805   // ####### global properties histo ############
1806
1807   TH2F *hCPtaVSd0d0_tgh_sign=new TH2F("hCPtaVSd0d0_tgh_sign","hCPtaVSd0d0_TightCuts_Signal",1000,-100000.,100000.,100,0.,1.);
1808   TH1F *hSecVtxZ_tgh_sign=new TH1F("hSecVtxZ_tgh_sign","hSecVtxZ_TightCuts_Signal",1000,-8.,8.);
1809   TH1F *hSecVtxX_tgh_sign=new TH1F("hSecVtxX_tgh_sign","hSecVtxX_TightCuts_Signal",1000,-3000.,3000.);
1810   TH1F *hSecVtxY_tgh_sign=new TH1F("hSecVtxY_tgh_sign","hSecVtxY_TightCuts_Signal",1000,-3000.,3000.);
1811   TH2F *hSecVtxXY_tgh_sign=new TH2F("hSecVtxXY_tgh_sign","hSecVtxXY_TightCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
1812   TH1F *hSecVtxPhi_tgh_sign=new TH1F("hSecVtxPhi_tgh_sign","hSecVtxPhi_TightCuts_Signal",180,-180.1,180.1);
1813   TH1F *hCPta_tgh_sign=new TH1F("hCPta_tgh_sign","hCPta_TightCuts_Signal",100,0.,1.);
1814   TH1F *hd0xd0_tgh_sign=new TH1F("hd0xd0_tgh_sign","hd0xd0_TightCuts_Signal",1000,-100000.,100000.);
1815   TH1F *hMassTrue_tgh_sign=new TH1F("hMassTrue_tgh_sign","D^{0} MC inv. Mass Tight Cuts Signal(All momenta)",600,1.600,2.200);
1816   TH1F *hMass_tgh_sign=new TH1F("hMass_tgh_sign","D^{0} inv. Mass Tight Cuts Signal (All momenta)",600,1.600,2.200);
1817   hMass_tgh_sign->Sumw2();
1818   TH1F *hMassTrue_tgh_sign_pm=new TH1F("hMassTrue_tgh_sign_pm","D^{0} MC inv. Mass Tight Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
1819   TH1F *hMass_tgh_sign_pm=new TH1F("hMass_tgh_sign_pm","D^{0} inv. Mass Tight Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
1820   hMass_tgh_sign_pm->Sumw2();
1821   TH1F *hMassTrue_SB_tgh_sign=new TH1F("hMassTrue_tgh_sign_sb","D^{0} MC inv. Mass in Side Bands Tight Cuts Signal(All momenta)",600,1.600,2.200);
1822   TH1F *hMass_SB_tgh_sign=new TH1F("hMass_tgh_sign_sb","D^{0} inv. Mass in Side Bands Tight Cuts Signal (All momenta)",600,1.600,2.200);
1823   hMass_SB_tgh_sign->Sumw2();
1824
1825   flist_TghCuts_Signal->Add(hCPtaVSd0d0_tgh_sign);
1826   flist_TghCuts_Signal->Add(hSecVtxZ_tgh_sign);
1827   flist_TghCuts_Signal->Add(hSecVtxY_tgh_sign);
1828   flist_TghCuts_Signal->Add(hSecVtxX_tgh_sign);
1829   flist_TghCuts_Signal->Add(hSecVtxXY_tgh_sign);
1830   flist_TghCuts_Signal->Add(hSecVtxPhi_tgh_sign);
1831   flist_TghCuts_Signal->Add(hCPta_tgh_sign);
1832   flist_TghCuts_Signal->Add(hd0xd0_tgh_sign);
1833   flist_TghCuts_Signal->Add(hMassTrue_tgh_sign);
1834   flist_TghCuts_Signal->Add(hMass_tgh_sign);
1835   flist_TghCuts_Signal->Add(hMassTrue_tgh_sign_pm);
1836   flist_TghCuts_Signal->Add(hMass_tgh_sign_pm);
1837   flist_TghCuts_Signal->Add(hMassTrue_SB_tgh_sign);
1838   flist_TghCuts_Signal->Add(hMass_SB_tgh_sign);
1839
1840   // ####### d0 D0 histos ############
1841   TH1F *hd0D0_tgh_sign_pm = new TH1F("hd0D0_tgh_sign_pm","D^{0} impact par. plot , Tight Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1842   hd0D0_tgh_sign_pm->SetXTitle("Impact parameter [#mum]");
1843   hd0D0_tgh_sign_pm->SetYTitle("Entries");
1844
1845   TH1F *hd0D0VtxTrue_tgh_sign_pm = new TH1F("hd0D0VtxTrue_tgh_sign_pm","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1846   hd0D0VtxTrue_tgh_sign_pm->SetXTitle("Impact parameter [#mum]");
1847   hd0D0VtxTrue_tgh_sign_pm->SetYTitle("Entries");
1848
1849   TH1F *hMCd0D0_tgh_sign_pm = new TH1F("hMCd0D0_tgh_sign_pm","D^{0} impact par. plot, Tight Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
1850   hMCd0D0_tgh_sign_pm->SetXTitle("MC Impact parameter [#mum]");
1851   hMCd0D0_tgh_sign_pm->SetYTitle("Entries");
1852
1853   TH1F *hd0D0_tgh_sign_sb = new TH1F("hd0D0_tgh_sign_sb","D^{0} impact par. plot , Tight Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1854   hd0D0_tgh_sign_sb->SetXTitle("Impact parameter [#mum]");
1855   hd0D0_tgh_sign_sb->SetYTitle("Entries");
1856
1857   TH1F *hd0D0VtxTrue_tgh_sign_sb = new TH1F("hd0D0VtxTrue_tgh_sign_sb","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1858   hd0D0VtxTrue_tgh_sign_sb->SetXTitle("Impact parameter [#mum]");
1859   hd0D0VtxTrue_tgh_sign_sb->SetYTitle("Entries");
1860
1861   TH1F *hMCd0D0_tgh_sign_sb = new TH1F("hMCd0D0_tgh_sign_sb","D^{0} impact par. plot, Tight Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
1862   hMCd0D0_tgh_sign_sb->SetXTitle("MC Impact parameter [#mum]");
1863   hMCd0D0_tgh_sign_sb->SetYTitle("Entries");
1864
1865   flist_TghCuts_Signal->Add(hd0D0_tgh_sign_pm);
1866   flist_TghCuts_Signal->Add(hd0D0VtxTrue_tgh_sign_pm);
1867   flist_TghCuts_Signal->Add(hMCd0D0_tgh_sign_pm);
1868   flist_TghCuts_Signal->Add(hd0D0_tgh_sign_sb);
1869   flist_TghCuts_Signal->Add(hd0D0VtxTrue_tgh_sign_sb);
1870   flist_TghCuts_Signal->Add(hMCd0D0_tgh_sign_sb);
1871   
1872   TH1F **hd0D0pt_tgh_sign_pm=new TH1F*[fnbins];
1873   TH1F **hMCd0D0pt_tgh_sign_pm=new TH1F*[fnbins];
1874   TH1F ** hd0D0VtxTruept_tgh_sign_pm=new TH1F*[fnbins];
1875   TH1F **hd0D0pt_tgh_sign_sb=new TH1F*[fnbins];
1876   TH1F **hMCd0D0pt_tgh_sign_sb=new TH1F*[fnbins];
1877   TH1F ** hd0D0VtxTruept_tgh_sign_sb=new TH1F*[fnbins];
1878   namehist="hd0D0pt_tgh_sign_";
1879   titlehist="D^{0} impact par. plot, Tight Cuts, Signal, ";
1880   for(Int_t i=0;i<fnbins;i++){
1881     strnamept=namehist;
1882     strnamept.Append("PkMss_pt");
1883     strnamept+=i;
1884
1885     strtitlept=titlehist;
1886     strtitlept.Append(" Mass Peak, ");
1887     strtitlept+=fptbins[i];
1888     strtitlept.Append("<= pt <");
1889     strtitlept+=fptbins[i+1];
1890     strtitlept.Append(" [GeV/c]");
1891     
1892     hd0D0pt_tgh_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1893     hd0D0pt_tgh_sign_pm[i]->SetXTitle("Impact parameter [#mum] ");
1894     hd0D0pt_tgh_sign_pm[i]->SetYTitle("Entries");
1895     flist_TghCuts_Signal->Add(hd0D0pt_tgh_sign_pm[i]);
1896
1897     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1898     hMCd0D0pt_tgh_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1899     hMCd0D0pt_tgh_sign_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
1900     hMCd0D0pt_tgh_sign_pm[i]->SetYTitle("Entries");
1901     flist_TghCuts_Signal->Add(hMCd0D0pt_tgh_sign_pm[i]);
1902  
1903
1904     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1905     hd0D0VtxTruept_tgh_sign_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1906     hd0D0VtxTruept_tgh_sign_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1907     hd0D0VtxTruept_tgh_sign_pm[i]->SetYTitle("Entries");
1908     flist_TghCuts_Signal->Add(hd0D0VtxTruept_tgh_sign_pm[i]);
1909     
1910     strnamept=namehist;
1911     strnamept.Append("SBMss_pt");
1912     strnamept+=i;
1913
1914     strtitlept=titlehist;
1915     strtitlept.Append(" Side Bands, ");
1916     strtitlept+=fptbins[i];
1917     strtitlept.Append("<= pt <");
1918     strtitlept+=fptbins[i+1];
1919     strtitlept.Append(" [GeV/c]");
1920     
1921     hd0D0pt_tgh_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1922     hd0D0pt_tgh_sign_sb[i]->SetXTitle("Impact parameter [#mum] ");
1923     hd0D0pt_tgh_sign_sb[i]->SetYTitle("Entries");
1924     flist_TghCuts_Signal->Add(hd0D0pt_tgh_sign_sb[i]);
1925
1926     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1927     hMCd0D0pt_tgh_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1928     hMCd0D0pt_tgh_sign_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
1929     hMCd0D0pt_tgh_sign_sb[i]->SetYTitle("Entries");
1930     flist_TghCuts_Signal->Add(hMCd0D0pt_tgh_sign_sb[i]);
1931
1932     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1933     hd0D0VtxTruept_tgh_sign_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1934     hd0D0VtxTruept_tgh_sign_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1935     hd0D0VtxTruept_tgh_sign_sb[i]->SetYTitle("Entries");
1936     flist_TghCuts_Signal->Add(hd0D0VtxTruept_tgh_sign_sb[i]);
1937   }
1938
1939
1940   //############ TIGHT CUTS BACKGROUND HISTOGRAMS ###########
1941   //
1942   //   ######## global properties histos #######
1943   TH2F *hCPtaVSd0d0_tgh_back=new TH2F("hCPtaVSd0d0_tgh_back","hCPtaVSd0d0_TightCuts_Background",1000,-100000.,100000.,100,0.,1.);
1944   TH1F *hSecVtxZ_tgh_back=new TH1F("hSecVtxZ_tgh_back","hSecVtxZ_TightCuts_Background",1000,-8.,8.);
1945   TH1F *hSecVtxX_tgh_back=new TH1F("hSecVtxX_tgh_back","hSecVtxX_TightCuts_Background",1000,-3000.,3000.);
1946   TH1F *hSecVtxY_tgh_back=new TH1F("hSecVtxY_tgh_back","hSecVtxY_TightCuts_Background",1000,-3000.,3000.);
1947   TH2F *hSecVtxXY_tgh_back=new TH2F("hSecVtxXY_tgh_back","hSecVtxXY_TightCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
1948   TH1F *hSecVtxPhi_tgh_back=new TH1F("hSecVtxPhi_tgh_back","hSecVtxPhi_TightCuts_Background",180,-180.1,180.1);
1949   TH1F *hCPta_tgh_back=new TH1F("hCPta_tgh_back","hCPta_TightCuts_Background",100,0.,1.);
1950   TH1F *hd0xd0_tgh_back=new TH1F("hd0xd0_tgh_back","hd0xd0_TightCuts_Background",1000,-100000.,100000.);
1951   TH1F *hMassTrue_tgh_back=new TH1F("hMassTrue_tgh_back","D^{0} MC inv. Mass Tight Cuts Background(All momenta)",600,1.600,2.200);
1952   TH1F *hMass_tgh_back=new TH1F("hMass_tgh_back","D^{0} inv. Mass Tight Cuts Background (All momenta)",600,1.600,2.200);
1953   hMass_tgh_back->Sumw2();
1954   TH1F *hMassTrue_tgh_back_pm=new TH1F("hMassTrue_tgh_back_pm","D^{0} MC inv. Mass Tight Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
1955   TH1F *hMass_tgh_back_pm=new TH1F("hMass_tgh_back_pm","D^{0} inv. Mass Tight Cuts Background (All momenta), MassPeak",600,1.600,2.200);
1956   hMass_tgh_back_pm->Sumw2();
1957   TH1F *hMassTrue_SB_tgh_back=new TH1F("hMassTrue_tgh_back_sb","D^{0} MC inv. Mass in Side Bands Tight Cuts Backgrround(All momenta)",600,1.600,2.200);
1958   TH1F *hMass_SB_tgh_back=new TH1F("hMass_tgh_back_sb","D^{0} inv. Mass in Side Bands Tight Cuts Background (All momenta)",600,1.600,2.200);
1959   hMass_SB_tgh_back->Sumw2();
1960
1961   flist_TghCuts_Back->Add(hCPtaVSd0d0_tgh_back);
1962   flist_TghCuts_Back->Add(hSecVtxZ_tgh_back);
1963   flist_TghCuts_Back->Add(hSecVtxY_tgh_back);
1964   flist_TghCuts_Back->Add(hSecVtxX_tgh_back);
1965   flist_TghCuts_Back->Add(hSecVtxXY_tgh_back);
1966   flist_TghCuts_Back->Add(hSecVtxPhi_tgh_back);
1967   flist_TghCuts_Back->Add(hCPta_tgh_back);
1968   flist_TghCuts_Back->Add(hd0xd0_tgh_back);
1969   flist_TghCuts_Back->Add(hMassTrue_tgh_back);
1970   flist_TghCuts_Back->Add(hMass_tgh_back);
1971   flist_TghCuts_Back->Add(hMassTrue_tgh_back_pm);
1972   flist_TghCuts_Back->Add(hMass_tgh_back_pm);
1973   flist_TghCuts_Back->Add(hMassTrue_SB_tgh_back);
1974   flist_TghCuts_Back->Add(hMass_SB_tgh_back);
1975
1976
1977   // ####### d0 D0 histos ############
1978   
1979  TH1F *hd0D0_tgh_back_pm = new TH1F("hd0D0_tgh_back_pm","D^{0} impact par. plot , Tight Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1980   hd0D0_tgh_back_pm->SetXTitle("Impact parameter [#mum]");
1981   hd0D0_tgh_back_pm->SetYTitle("Entries");
1982
1983   TH1F *hd0D0VtxTrue_tgh_back_pm = new TH1F("hd0D0VtxTrue_tgh_back_pm","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1984   hd0D0VtxTrue_tgh_back_pm->SetXTitle("Impact parameter [#mum]");
1985   hd0D0VtxTrue_tgh_back_pm->SetYTitle("Entries");
1986
1987   TH1F *hMCd0D0_tgh_back_pm = new TH1F("hMCd0D0_tgh_back_pm","D^{0} impact par. plot, Tight Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
1988   hMCd0D0_tgh_back_pm->SetXTitle("MC Impact parameter [#mum]");
1989   hMCd0D0_tgh_back_pm->SetYTitle("Entries");
1990
1991   TH1F *hd0D0_tgh_back_sb = new TH1F("hd0D0_tgh_back_sb","D^{0} impact par. plot , Tight Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1992   hd0D0_tgh_back_sb->SetXTitle("Impact parameter [#mum]");
1993   hd0D0_tgh_back_sb->SetYTitle("Entries");
1994
1995   TH1F *hd0D0VtxTrue_tgh_back_sb = new TH1F("hd0D0VtxTrue_tgh_back_sb","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1996   hd0D0VtxTrue_tgh_back_sb->SetXTitle("Impact parameter [#mum]");
1997   hd0D0VtxTrue_tgh_back_sb->SetYTitle("Entries");
1998
1999   TH1F *hMCd0D0_tgh_back_sb = new TH1F("hMCd0D0_tgh_back_sb","D^{0} impact par. plot, Tight Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
2000   hMCd0D0_tgh_back_sb->SetXTitle("MC Impact parameter [#mum]");
2001   hMCd0D0_tgh_back_sb->SetYTitle("Entries");
2002
2003   flist_TghCuts_Back->Add(hd0D0_tgh_back_pm);
2004   flist_TghCuts_Back->Add(hd0D0VtxTrue_tgh_back_pm);
2005   flist_TghCuts_Back->Add(hMCd0D0_tgh_back_pm);
2006   flist_TghCuts_Back->Add(hd0D0_tgh_back_sb);
2007   flist_TghCuts_Back->Add(hd0D0VtxTrue_tgh_back_sb);
2008   flist_TghCuts_Back->Add(hMCd0D0_tgh_back_sb);
2009   
2010   TH1F **hd0D0pt_tgh_back_pm=new TH1F*[fnbins];
2011   TH1F **hMCd0D0pt_tgh_back_pm=new TH1F*[fnbins];
2012   TH1F ** hd0D0VtxTruept_tgh_back_pm=new TH1F*[fnbins];
2013   TH1F **hd0D0pt_tgh_back_sb=new TH1F*[fnbins];
2014   TH1F **hMCd0D0pt_tgh_back_sb=new TH1F*[fnbins];
2015   TH1F ** hd0D0VtxTruept_tgh_back_sb=new TH1F*[fnbins];
2016   namehist="hd0D0pt_tgh_back_";
2017   titlehist="D^{0} impact par. plot, Tight Cuts, Background, ";
2018   for(Int_t i=0;i<fnbins;i++){
2019     strnamept=namehist;
2020     strnamept.Append("PkMss_pt");
2021     strnamept+=i;
2022
2023     strtitlept=titlehist;
2024     strtitlept.Append(" Mass Peak, ");
2025     strtitlept+=fptbins[i];
2026     strtitlept.Append("<= pt <");
2027     strtitlept+=fptbins[i+1];
2028     strtitlept.Append(" [GeV/c]");
2029     
2030     hd0D0pt_tgh_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2031     hd0D0pt_tgh_back_pm[i]->SetXTitle("Impact parameter [#mum] ");
2032     hd0D0pt_tgh_back_pm[i]->SetYTitle("Entries");
2033     flist_TghCuts_Back->Add(hd0D0pt_tgh_back_pm[i]);
2034
2035     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2036     hMCd0D0pt_tgh_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2037     hMCd0D0pt_tgh_back_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
2038     hMCd0D0pt_tgh_back_pm[i]->SetYTitle("Entries");
2039     flist_TghCuts_Back->Add(hMCd0D0pt_tgh_back_pm[i]);
2040  
2041
2042     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2043     hd0D0VtxTruept_tgh_back_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2044     hd0D0VtxTruept_tgh_back_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2045     hd0D0VtxTruept_tgh_back_pm[i]->SetYTitle("Entries");
2046     flist_TghCuts_Back->Add(hd0D0VtxTruept_tgh_back_pm[i]);
2047     
2048     strnamept=namehist;
2049     strnamept.Append("SBMss_pt");
2050     strnamept+=i;
2051
2052     strtitlept=titlehist;
2053     strtitlept.Append(" Side Bands, ");
2054     strtitlept+=fptbins[i];
2055     strtitlept.Append("<= pt <");
2056     strtitlept+=fptbins[i+1];
2057     strtitlept.Append(" [GeV/c]");
2058     
2059     hd0D0pt_tgh_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2060     hd0D0pt_tgh_back_sb[i]->SetXTitle("Impact parameter [#mum] ");
2061     hd0D0pt_tgh_back_sb[i]->SetYTitle("Entries");
2062     flist_TghCuts_Back->Add(hd0D0pt_tgh_back_sb[i]);
2063
2064     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2065     hMCd0D0pt_tgh_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2066     hMCd0D0pt_tgh_back_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
2067     hMCd0D0pt_tgh_back_sb[i]->SetYTitle("Entries");
2068     flist_TghCuts_Back->Add(hMCd0D0pt_tgh_back_sb[i]);
2069
2070     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2071     hd0D0VtxTruept_tgh_back_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2072     hd0D0VtxTruept_tgh_back_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2073     hd0D0VtxTruept_tgh_back_sb[i]->SetYTitle("Entries");
2074     flist_TghCuts_Back->Add(hd0D0VtxTruept_tgh_back_sb[i]);
2075   }
2076
2077
2078
2079  //############ TIGHT CUTS FROMB HISTOGRAMS ###########
2080   //
2081   //#######  global properties histos
2082
2083   TH2F *hCPtaVSd0d0_tgh_fromB=new TH2F("hCPtaVSd0d0_tgh_fromB","hCPtaVSd0d0_TightCuts_FromB",1000,-100000.,100000.,100,0.,1.);
2084   TH1F *hSecVtxZ_tgh_fromB=new TH1F("hSecVtxZ_tgh_fromB","hSecVtxZ_TightCuts_FromB",1000,-8.,8.);
2085   TH1F *hSecVtxX_tgh_fromB=new TH1F("hSecVtxX_tgh_fromB","hSecVtxX_TightCuts_FromB",1000,-3000.,3000.);
2086   TH1F *hSecVtxY_tgh_fromB=new TH1F("hSecVtxY_tgh_fromB","hSecVtxY_TightCuts_FromB",1000,-3000.,3000.);
2087   TH2F *hSecVtxXY_tgh_fromB=new TH2F("hSecVtxXY_tgh_fromB","hSecVtxXY_TightCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
2088   TH1F *hSecVtxPhi_tgh_fromB=new TH1F("hSecVtxPhi_tgh_fromB","hSecVtxPhi_TightCuts_FromB",180,-180.1,180.1);
2089   TH1F *hCPta_tgh_fromB=new TH1F("hCPta_tgh_fromB","hCPta_TightCuts_FromB",100,0.,1.);
2090   TH1F *hd0xd0_tgh_fromB=new TH1F("hd0xd0_tgh_fromB","hd0xd0_TightCuts_FromB",1000,-100000.,100000.);
2091   TH1F *hMassTrue_tgh_fromB=new TH1F("hMassTrue_tgh_fromB","D^{0} MC inv. Mass Tight Cuts FromB(All momenta)",600,1.600,2.200);
2092   TH1F *hMass_tgh_fromB=new TH1F("hMass_tgh_fromB","D^{0} inv. Mass Tight Cuts FromB (All momenta)",600,1.600,2.200);
2093   hMass_tgh_fromB->Sumw2();
2094   TH1F *hMassTrue_tgh_fromB_pm=new TH1F("hMassTrue_tgh_fromB_pm","D^{0} MC inv. Mass Tight Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
2095   TH1F *hMass_tgh_fromB_pm=new TH1F("hMass_tgh_fromB_pm","D^{0} inv. Mass Tight Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
2096   hMass_tgh_fromB_pm->Sumw2();
2097   TH1F *hMassTrue_SB_tgh_fromB=new TH1F("hMassTrue_tgh_fromB_sb","D^{0} MC inv. Mass in Side Bands Tight Cuts FromB(All momenta)",600,1.600,2.200);
2098   TH1F *hMass_SB_tgh_fromB=new TH1F("hMass_tgh_fromB_sb","D^{0} inv. Mass in Side Bands Tight Cuts FromB (All momenta)",600,1.600,2.200);
2099   hMass_SB_tgh_fromB->Sumw2();
2100
2101   flist_TghCuts_FromB->Add(hCPtaVSd0d0_tgh_fromB);
2102   flist_TghCuts_FromB->Add(hSecVtxZ_tgh_fromB);
2103   flist_TghCuts_FromB->Add(hSecVtxY_tgh_fromB);
2104   flist_TghCuts_FromB->Add(hSecVtxX_tgh_fromB);
2105   flist_TghCuts_FromB->Add(hSecVtxXY_tgh_fromB);
2106   flist_TghCuts_FromB->Add(hSecVtxPhi_tgh_fromB);
2107   flist_TghCuts_FromB->Add(hCPta_tgh_fromB);
2108   flist_TghCuts_FromB->Add(hd0xd0_tgh_fromB);
2109   flist_TghCuts_FromB->Add(hMassTrue_tgh_fromB);
2110   flist_TghCuts_FromB->Add(hMass_tgh_fromB);
2111   flist_TghCuts_FromB->Add(hMassTrue_tgh_fromB_pm);
2112   flist_TghCuts_FromB->Add(hMass_tgh_fromB_pm);
2113   flist_TghCuts_FromB->Add(hMassTrue_SB_tgh_fromB);
2114   flist_TghCuts_FromB->Add(hMass_SB_tgh_fromB);
2115
2116   // ######### d0 D0 histos ##############
2117   TH1F *hd0D0_tgh_fromB_pm = new TH1F("hd0D0_tgh_fromB_pm","D^{0} impact par. plot , Tight Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
2118   hd0D0_tgh_fromB_pm->SetXTitle("Impact parameter [#mum]");
2119   hd0D0_tgh_fromB_pm->SetYTitle("Entries");
2120
2121   TH1F *hd0D0VtxTrue_tgh_fromB_pm = new TH1F("hd0D0VtxTrue_tgh_fromB_pm","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
2122   hd0D0VtxTrue_tgh_fromB_pm->SetXTitle("Impact parameter [#mum]");
2123   hd0D0VtxTrue_tgh_fromB_pm->SetYTitle("Entries");
2124
2125   TH1F *hMCd0D0_tgh_fromB_pm = new TH1F("hMCd0D0_tgh_fromB_pm","D^{0} impact par. plot, Tight Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
2126   hMCd0D0_tgh_fromB_pm->SetXTitle("MC Impact parameter [#mum]");
2127   hMCd0D0_tgh_fromB_pm->SetYTitle("Entries");
2128
2129   TH1F *hd0D0_tgh_fromB_sb = new TH1F("hd0D0_tgh_fromB_sb","D^{0} impact par. plot , Tight Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
2130   hd0D0_tgh_fromB_sb->SetXTitle("Impact parameter [#mum]");
2131   hd0D0_tgh_fromB_sb->SetYTitle("Entries");
2132
2133   TH1F *hd0D0VtxTrue_tgh_fromB_sb = new TH1F("hd0D0VtxTrue_tgh_fromB_sb","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
2134   hd0D0VtxTrue_tgh_fromB_sb->SetXTitle("Impact parameter [#mum]");
2135   hd0D0VtxTrue_tgh_fromB_sb->SetYTitle("Entries");
2136
2137   TH1F *hMCd0D0_tgh_fromB_sb = new TH1F("hMCd0D0_tgh_fromB_sb","D^{0} impact par. plot, Tight Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
2138   hMCd0D0_tgh_fromB_sb->SetXTitle("MC Impact parameter [#mum]");
2139   hMCd0D0_tgh_fromB_sb->SetYTitle("Entries");
2140
2141   flist_TghCuts_FromB->Add(hd0D0_tgh_fromB_pm);
2142   flist_TghCuts_FromB->Add(hd0D0VtxTrue_tgh_fromB_pm);
2143   flist_TghCuts_FromB->Add(hMCd0D0_tgh_fromB_pm);
2144   flist_TghCuts_FromB->Add(hd0D0_tgh_fromB_sb);
2145   flist_TghCuts_FromB->Add(hd0D0VtxTrue_tgh_fromB_sb);
2146   flist_TghCuts_FromB->Add(hMCd0D0_tgh_fromB_sb);
2147   
2148   TH1F **hd0D0pt_tgh_fromB_pm=new TH1F*[fnbins];
2149   TH1F **hMCd0D0pt_tgh_fromB_pm=new TH1F*[fnbins];
2150   TH1F ** hd0D0VtxTruept_tgh_fromB_pm=new TH1F*[fnbins];
2151   TH1F **hd0D0pt_tgh_fromB_sb=new TH1F*[fnbins];
2152   TH1F **hMCd0D0pt_tgh_fromB_sb=new TH1F*[fnbins];
2153   TH1F ** hd0D0VtxTruept_tgh_fromB_sb=new TH1F*[fnbins];
2154   namehist="hd0D0pt_tgh_fromB_";
2155   titlehist="D^{0} impact par. plot, Tight Cuts, FromB, ";
2156   for(Int_t i=0;i<fnbins;i++){
2157     strnamept=namehist;
2158     strnamept.Append("PkMss_pt");
2159     strnamept+=i;
2160
2161     strtitlept=titlehist;
2162     strtitlept.Append(" Mass Peak, ");
2163     strtitlept+=fptbins[i];
2164     strtitlept.Append("<= pt <");
2165     strtitlept+=fptbins[i+1];
2166     strtitlept.Append(" [GeV/c]");
2167     
2168     hd0D0pt_tgh_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2169     hd0D0pt_tgh_fromB_pm[i]->SetXTitle("Impact parameter [#mum] ");
2170     hd0D0pt_tgh_fromB_pm[i]->SetYTitle("Entries");
2171     flist_TghCuts_FromB->Add(hd0D0pt_tgh_fromB_pm[i]);
2172
2173     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2174     hMCd0D0pt_tgh_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2175     hMCd0D0pt_tgh_fromB_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
2176     hMCd0D0pt_tgh_fromB_pm[i]->SetYTitle("Entries");
2177     flist_TghCuts_FromB->Add(hMCd0D0pt_tgh_fromB_pm[i]);
2178  
2179
2180     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2181     hd0D0VtxTruept_tgh_fromB_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2182     hd0D0VtxTruept_tgh_fromB_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2183     hd0D0VtxTruept_tgh_fromB_pm[i]->SetYTitle("Entries");
2184     flist_TghCuts_FromB->Add(hd0D0VtxTruept_tgh_fromB_pm[i]);
2185     
2186     strnamept=namehist;
2187     strnamept.Append("SBMss_pt");
2188     strnamept+=i;
2189
2190     strtitlept=titlehist;
2191     strtitlept.Append(" Side Bands, ");
2192     strtitlept+=fptbins[i];
2193     strtitlept.Append("<= pt <");
2194     strtitlept+=fptbins[i+1];
2195     strtitlept.Append(" [GeV/c]");
2196     
2197     hd0D0pt_tgh_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2198     hd0D0pt_tgh_fromB_sb[i]->SetXTitle("Impact parameter [#mum] ");
2199     hd0D0pt_tgh_fromB_sb[i]->SetYTitle("Entries");
2200     flist_TghCuts_FromB->Add(hd0D0pt_tgh_fromB_sb[i]);
2201
2202     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2203     hMCd0D0pt_tgh_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2204     hMCd0D0pt_tgh_fromB_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
2205     hMCd0D0pt_tgh_fromB_sb[i]->SetYTitle("Entries");
2206     flist_TghCuts_FromB->Add(hMCd0D0pt_tgh_fromB_sb[i]);
2207
2208     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2209     hd0D0VtxTruept_tgh_fromB_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2210     hd0D0VtxTruept_tgh_fromB_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2211     hd0D0VtxTruept_tgh_fromB_sb[i]->SetYTitle("Entries");
2212     flist_TghCuts_FromB->Add(hd0D0VtxTruept_tgh_fromB_sb[i]);
2213   }
2214
2215
2216
2217  //############ TIGHT CUTS FROM DSTAR HISTOGRAMS ###########
2218  //
2219   //############## global properties histos
2220   TH2F *hCPtaVSd0d0_tgh_fromDstar=new TH2F("hCPtaVSd0d0_tgh_fromDstar","hCPtaVSd0d0_TightCuts_FromDStar",1000,-100000.,100000.,100,0.,1.);
2221   TH1F *hSecVtxZ_tgh_fromDstar=new TH1F("hSecVtxZ_tgh_fromDstar","hSecVtxZ_TightCuts_FromDStar",1000,-8.,8.);
2222   TH1F *hSecVtxX_tgh_fromDstar=new TH1F("hSecVtxX_tgh_fromDstar","hSecVtxX_TightCuts_FromDStar",1000,-3000.,3000.);
2223   TH1F *hSecVtxY_tgh_fromDstar=new TH1F("hSecVtxY_tgh_fromDstar","hSecVtxY_TightCuts_FromDStar",1000,-3000.,3000.);
2224   TH2F *hSecVtxXY_tgh_fromDstar=new TH2F("hSecVtxXY_tgh_fromDstar","hSecVtxXY_TightCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
2225   TH1F *hSecVtxPhi_tgh_fromDstar=new TH1F("hSecVtxPhi_tgh_fromDstar","hSecVtxPhi_TightCuts_FromDStar",180,-180.1,180.1);
2226   TH1F *hCPta_tgh_fromDstar=new TH1F("hCPta_tgh_fromDstar","hCPta_TightCuts_FromDStar",100,0.,1.);
2227   TH1F *hd0xd0_tgh_fromDstar=new TH1F("hd0xd0_tgh_fromDstar","hd0xd0_TightCuts_FromDStar",1000,-100000.,100000.);
2228   TH1F *hMassTrue_tgh_fromDstar=new TH1F("hMassTrue_tgh_fromDstar","D^{0} MC inv. Mass Tight Cuts FromDStar(All momenta)",600,1.600,2.200);
2229   TH1F *hMass_tgh_fromDstar=new TH1F("hMass_tgh_fromDstar","D^{0} inv. Mass Tight Cuts FromDStar (All momenta)",600,1.600,2.200);
2230   hMass_tgh_fromDstar->Sumw2();
2231   TH1F *hMassTrue_tgh_fromDstar_pm=new TH1F("hMassTrue_tgh_fromDstar_pm","D^{0} MC inv. Mass Tight Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
2232   TH1F *hMass_tgh_fromDstar_pm=new TH1F("hMass_tgh_fromDstar_pm","D^{0} inv. Mass Tight Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
2233   hMass_tgh_fromDstar_pm->Sumw2();
2234   TH1F *hMassTrue_SB_tgh_fromDstar=new TH1F("hMassTrue_tgh_fromDstar_sb","D^{0} MC inv. Mass in Side Bands Tight Cuts FromDStar(All momenta)",600,1.600,2.200);
2235   TH1F *hMass_SB_tgh_fromDstar=new TH1F("hMass_tgh_fromDstar_sb","D^{0} inv. Mass in Side Bands Tight Cuts FromDStar (All momenta)",600,1.600,2.200);
2236   hMass_SB_tgh_fromDstar->Sumw2();
2237
2238   flist_TghCuts_FromDstar->Add(hCPtaVSd0d0_tgh_fromDstar);
2239   flist_TghCuts_FromDstar->Add(hSecVtxZ_tgh_fromDstar);
2240   flist_TghCuts_FromDstar->Add(hSecVtxY_tgh_fromDstar);
2241   flist_TghCuts_FromDstar->Add(hSecVtxX_tgh_fromDstar);
2242   flist_TghCuts_FromDstar->Add(hSecVtxXY_tgh_fromDstar);
2243   flist_TghCuts_FromDstar->Add(hSecVtxPhi_tgh_fromDstar);
2244   flist_TghCuts_FromDstar->Add(hCPta_tgh_fromDstar);
2245   flist_TghCuts_FromDstar->Add(hd0xd0_tgh_fromDstar);
2246   flist_TghCuts_FromDstar->Add(hMassTrue_tgh_fromDstar);
2247   flist_TghCuts_FromDstar->Add(hMass_tgh_fromDstar);
2248   flist_TghCuts_FromDstar->Add(hMassTrue_tgh_fromDstar_pm);
2249   flist_TghCuts_FromDstar->Add(hMass_tgh_fromDstar_pm);
2250   flist_TghCuts_FromDstar->Add(hMassTrue_SB_tgh_fromDstar);
2251   flist_TghCuts_FromDstar->Add(hMass_SB_tgh_fromDstar);
2252
2253   //########## d0 D0 histos #############  
2254   TH1F *hd0D0_tgh_fromDst_pm = new TH1F("hd0D0_tgh_fromDstar_pm","D^{0} impact par. plot , Tight Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2255   hd0D0_tgh_fromDst_pm->SetXTitle("Impact parameter [#mum]");
2256   hd0D0_tgh_fromDst_pm->SetYTitle("Entries");
2257
2258   TH1F *hd0D0VtxTrue_tgh_fromDst_pm = new TH1F("hd0D0VtxTrue_tgh_fromDstar_pm","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2259   hd0D0VtxTrue_tgh_fromDst_pm->SetXTitle("Impact parameter [#mum]");
2260   hd0D0VtxTrue_tgh_fromDst_pm->SetYTitle("Entries");
2261
2262   TH1F *hMCd0D0_tgh_fromDst_pm = new TH1F("hMCd0D0_tgh_fromDstar_pm","D^{0} impact par. plot, Tight Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
2263   hMCd0D0_tgh_fromDst_pm->SetXTitle("MC Impact parameter [#mum]");
2264   hMCd0D0_tgh_fromDst_pm->SetYTitle("Entries");
2265
2266   TH1F *hd0D0_tgh_fromDst_sb = new TH1F("hd0D0_tgh_fromDstar_sb","D^{0} impact par. plot , Tight Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2267   hd0D0_tgh_fromDst_sb->SetXTitle("Impact parameter [#mum]");
2268   hd0D0_tgh_fromDst_sb->SetYTitle("Entries");
2269
2270   TH1F *hd0D0VtxTrue_tgh_fromDst_sb = new TH1F("hd0D0VtxTrue_tgh_fromDstar_sb","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2271   hd0D0VtxTrue_tgh_fromDst_sb->SetXTitle("Impact parameter [#mum]");
2272   hd0D0VtxTrue_tgh_fromDst_sb->SetYTitle("Entries");
2273
2274   TH1F *hMCd0D0_tgh_fromDst_sb = new TH1F("hMCd0D0_tgh_fromDstar_sb","D^{0} impact par. plot, Tight Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
2275   hMCd0D0_tgh_fromDst_sb->SetXTitle("MC Impact parameter [#mum]");
2276   hMCd0D0_tgh_fromDst_sb->SetYTitle("Entries");
2277
2278   flist_TghCuts_FromDstar->Add(hd0D0_tgh_fromDst_pm);
2279   flist_TghCuts_FromDstar->Add(hd0D0VtxTrue_tgh_fromDst_pm);
2280   flist_TghCuts_FromDstar->Add(hMCd0D0_tgh_fromDst_pm);
2281   flist_TghCuts_FromDstar->Add(hd0D0_tgh_fromDst_sb);
2282   flist_TghCuts_FromDstar->Add(hd0D0VtxTrue_tgh_fromDst_sb);
2283   flist_TghCuts_FromDstar->Add(hMCd0D0_tgh_fromDst_sb);
2284   
2285   TH1F **hd0D0pt_tgh_fromDst_pm=new TH1F*[fnbins];
2286   TH1F **hMCd0D0pt_tgh_fromDst_pm=new TH1F*[fnbins];
2287   TH1F ** hd0D0VtxTruept_tgh_fromDst_pm=new TH1F*[fnbins];
2288   TH1F **hd0D0pt_tgh_fromDst_sb=new TH1F*[fnbins];
2289   TH1F **hMCd0D0pt_tgh_fromDst_sb=new TH1F*[fnbins];
2290   TH1F ** hd0D0VtxTruept_tgh_fromDst_sb=new TH1F*[fnbins];
2291   namehist="hd0D0pt_tgh_fromDstar_";
2292   titlehist="D^{0} impact par. plot, Tight Cuts, FromDStar, ";
2293   for(Int_t i=0;i<fnbins;i++){
2294     strnamept=namehist;
2295     strnamept.Append("PkMss_pt");
2296     strnamept+=i;
2297
2298     strtitlept=titlehist;
2299     strtitlept.Append(" Mass Peak, ");
2300     strtitlept+=fptbins[i];
2301     strtitlept.Append("<= pt <");
2302     strtitlept+=fptbins[i+1];
2303     strtitlept.Append(" [GeV/c]");
2304     
2305     hd0D0pt_tgh_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2306     hd0D0pt_tgh_fromDst_pm[i]->SetXTitle("Impact parameter [#mum] ");
2307     hd0D0pt_tgh_fromDst_pm[i]->SetYTitle("Entries");
2308     flist_TghCuts_FromDstar->Add(hd0D0pt_tgh_fromDst_pm[i]);
2309
2310     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2311     hMCd0D0pt_tgh_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2312     hMCd0D0pt_tgh_fromDst_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
2313     hMCd0D0pt_tgh_fromDst_pm[i]->SetYTitle("Entries");
2314     flist_TghCuts_FromDstar->Add(hMCd0D0pt_tgh_fromDst_pm[i]);
2315  
2316
2317     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2318     hd0D0VtxTruept_tgh_fromDst_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2319     hd0D0VtxTruept_tgh_fromDst_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2320     hd0D0VtxTruept_tgh_fromDst_pm[i]->SetYTitle("Entries");
2321     flist_TghCuts_FromDstar->Add(hd0D0VtxTruept_tgh_fromDst_pm[i]);
2322     
2323     strnamept=namehist;
2324     strnamept.Append("SBMss_pt");
2325     strnamept+=i;
2326
2327     strtitlept=titlehist;
2328     strtitlept.Append(" Side Bands, ");
2329     strtitlept+=fptbins[i];
2330     strtitlept.Append("<= pt <");
2331     strtitlept+=fptbins[i+1];
2332     strtitlept.Append(" [GeV/c]");
2333     
2334     hd0D0pt_tgh_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2335     hd0D0pt_tgh_fromDst_sb[i]->SetXTitle("Impact parameter [#mum] ");
2336     hd0D0pt_tgh_fromDst_sb[i]->SetYTitle("Entries");
2337     flist_TghCuts_FromDstar->Add(hd0D0pt_tgh_fromDst_sb[i]);
2338
2339     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2340     hMCd0D0pt_tgh_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2341     hMCd0D0pt_tgh_fromDst_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
2342     hMCd0D0pt_tgh_fromDst_sb[i]->SetYTitle("Entries");
2343     flist_TghCuts_FromDstar->Add(hMCd0D0pt_tgh_fromDst_sb[i]);
2344
2345     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2346     hd0D0VtxTruept_tgh_fromDst_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2347     hd0D0VtxTruept_tgh_fromDst_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2348     hd0D0VtxTruept_tgh_fromDst_sb[i]->SetYTitle("Entries");
2349     flist_TghCuts_FromDstar->Add(hd0D0VtxTruept_tgh_fromDst_sb[i]);
2350   }
2351
2352
2353   //############ TIGHT CUTS OTHER HISTOGRAMS ###########
2354   //
2355   //########### global properties histos ###########
2356
2357   TH2F *hCPtaVSd0d0_tgh_other=new TH2F("hCPtaVSd0d0_tgh_other","hCPtaVSd0d0_TightCuts_other",1000,-100000.,100000.,100,0.,1.);
2358   TH1F *hSecVtxZ_tgh_other=new TH1F("hSecVtxZ_tgh_other","hSecVtxZ_TightCuts_other",1000,-8.,8.);
2359   TH1F *hSecVtxX_tgh_other=new TH1F("hSecVtxX_tgh_other","hSecVtxX_TightCuts_other",1000,-3000.,3000.);
2360   TH1F *hSecVtxY_tgh_other=new TH1F("hSecVtxY_tgh_other","hSecVtxY_TightCuts_other",1000,-3000.,3000.);
2361   TH2F *hSecVtxXY_tgh_other=new TH2F("hSecVtxXY_tgh_other","hSecVtxXY_TightCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
2362   TH1F *hSecVtxPhi_tgh_other=new TH1F("hSecVtxPhi_tgh_other","hSecVtxPhi_TightCuts_other",180,-180.1,180.1);
2363   TH1F *hCPta_tgh_other=new TH1F("hCPta_tgh_other","hCPta_TightCuts_other",100,0.,1.);
2364   TH1F *hd0xd0_tgh_other=new TH1F("hd0xd0_tgh_other","hd0xd0_TightCuts_other",1000,-100000.,100000.);
2365   TH1F *hMassTrue_tgh_other=new TH1F("hMassTrue_tgh_other","D^{0} MC inv. Mass Tight Cuts other(All momenta)",600,1.600,2.200);
2366   TH1F *hMass_tgh_other=new TH1F("hMass_tgh_other","D^{0} inv. Mass Tight Cuts other (All momenta)",600,1.600,2.200);
2367   hMass_tgh_other->Sumw2();
2368   TH1F *hMassTrue_tgh_other_pm=new TH1F("hMassTrue_tgh_other_pm","D^{0} MC inv. Mass Tight Cuts other, Mass Peak. (All momenta)",600,1.600,2.200);
2369   TH1F *hMass_tgh_other_pm=new TH1F("hMass_tgh_other_pm","D^{0} inv. Mass Tight Cuts other (All momenta), MassPeak",600,1.600,2.200);
2370   hMass_tgh_other_pm->Sumw2();
2371   TH1F *hMassTrue_SB_tgh_other=new TH1F("hMassTrue_tgh_other_sb","D^{0} MC inv. Mass in Side Bands Tight Cuts other(All momenta)",600,1.600,2.200);
2372   TH1F *hMass_SB_tgh_other=new TH1F("hMass_tgh_other_sb","D^{0} inv. Mass in Side Bands Tight Cuts other (All momenta)",600,1.600,2.200);
2373   hMass_SB_tgh_other->Sumw2();
2374
2375   flist_TghCuts_Other->Add(hCPtaVSd0d0_tgh_other);
2376   flist_TghCuts_Other->Add(hSecVtxZ_tgh_other);
2377   flist_TghCuts_Other->Add(hSecVtxY_tgh_other);
2378   flist_TghCuts_Other->Add(hSecVtxX_tgh_other);
2379   flist_TghCuts_Other->Add(hSecVtxXY_tgh_other);
2380   flist_TghCuts_Other->Add(hSecVtxPhi_tgh_other);
2381   flist_TghCuts_Other->Add(hCPta_tgh_other);
2382   flist_TghCuts_Other->Add(hd0xd0_tgh_other);
2383   flist_TghCuts_Other->Add(hMassTrue_tgh_other);
2384   flist_TghCuts_Other->Add(hMass_tgh_other);
2385   flist_TghCuts_Other->Add(hMassTrue_tgh_other_pm);
2386   flist_TghCuts_Other->Add(hMass_tgh_other_pm);
2387   flist_TghCuts_Other->Add(hMassTrue_SB_tgh_other);
2388   flist_TghCuts_Other->Add(hMass_SB_tgh_other);
2389
2390   //############# d0 D0 histos ###############à
2391   TH1F *hd0D0_tgh_other_pm = new TH1F("hd0D0_tgh_other_pm","D^{0} impact par. plot , Tight Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2392   hd0D0_tgh_other_pm->SetXTitle("Impact parameter [#mum]");
2393   hd0D0_tgh_other_pm->SetYTitle("Entries");
2394
2395   TH1F *hd0D0VtxTrue_tgh_other_pm = new TH1F("hd0D0VtxTrue_tgh_other_pm","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2396   hd0D0VtxTrue_tgh_other_pm->SetXTitle("Impact parameter [#mum]");
2397   hd0D0VtxTrue_tgh_other_pm->SetYTitle("Entries");
2398
2399   TH1F *hMCd0D0_tgh_other_pm = new TH1F("hMCd0D0_tgh_other_pm","D^{0} impact par. plot, Tight Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
2400   hMCd0D0_tgh_other_pm->SetXTitle("MC Impact parameter [#mum]");
2401   hMCd0D0_tgh_other_pm->SetYTitle("Entries");
2402
2403   TH1F *hd0D0_tgh_other_sb = new TH1F("hd0D0_tgh_other_sb","D^{0} impact par. plot , Tight Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2404   hd0D0_tgh_other_sb->SetXTitle("Impact parameter [#mum]");
2405   hd0D0_tgh_other_sb->SetYTitle("Entries");
2406
2407   TH1F *hd0D0VtxTrue_tgh_other_sb = new TH1F("hd0D0VtxTrue_tgh_other_sb","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2408   hd0D0VtxTrue_tgh_other_sb->SetXTitle("Impact parameter [#mum]");
2409   hd0D0VtxTrue_tgh_other_sb->SetYTitle("Entries");
2410
2411   TH1F *hMCd0D0_tgh_other_sb = new TH1F("hMCd0D0_tgh_other_sb","D^{0} impact par. plot, Tight Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
2412   hMCd0D0_tgh_other_sb->SetXTitle("MC Impact parameter [#mum]");
2413   hMCd0D0_tgh_other_sb->SetYTitle("Entries");
2414
2415   flist_TghCuts_Other->Add(hd0D0_tgh_other_pm);
2416   flist_TghCuts_Other->Add(hd0D0VtxTrue_tgh_other_pm);
2417   flist_TghCuts_Other->Add(hMCd0D0_tgh_other_pm);
2418   flist_TghCuts_Other->Add(hd0D0_tgh_other_sb);
2419   flist_TghCuts_Other->Add(hd0D0VtxTrue_tgh_other_sb);
2420   flist_TghCuts_Other->Add(hMCd0D0_tgh_other_sb);
2421   
2422   TH1F **hd0D0pt_tgh_other_pm=new TH1F*[fnbins];
2423   TH1F **hMCd0D0pt_tgh_other_pm=new TH1F*[fnbins];
2424   TH1F ** hd0D0VtxTruept_tgh_other_pm=new TH1F*[fnbins];
2425   TH1F **hd0D0pt_tgh_other_sb=new TH1F*[fnbins];
2426   TH1F **hMCd0D0pt_tgh_other_sb=new TH1F*[fnbins];
2427   TH1F ** hd0D0VtxTruept_tgh_other_sb=new TH1F*[fnbins];
2428   namehist="hd0D0pt_tgh_other_";
2429   titlehist="D^{0} impact par. plot, Tight Cuts, Other, ";
2430   for(Int_t i=0;i<fnbins;i++){
2431     strnamept=namehist;
2432     strnamept.Append("PkMss_pt");
2433     strnamept+=i;
2434
2435     strtitlept=titlehist;
2436     strtitlept.Append(" Mass Peak, ");
2437     strtitlept+=fptbins[i];
2438     strtitlept.Append("<= pt <");
2439     strtitlept+=fptbins[i+1];
2440     strtitlept.Append(" [GeV/c]");
2441     
2442     hd0D0pt_tgh_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2443     hd0D0pt_tgh_other_pm[i]->SetXTitle("Impact parameter [#mum] ");
2444     hd0D0pt_tgh_other_pm[i]->SetYTitle("Entries");
2445     flist_TghCuts_Other->Add(hd0D0pt_tgh_other_pm[i]);
2446
2447     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2448     hMCd0D0pt_tgh_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2449     hMCd0D0pt_tgh_other_pm[i]->SetXTitle("MC Impact parameter [#mum] ");
2450     hMCd0D0pt_tgh_other_pm[i]->SetYTitle("Entries");
2451     flist_TghCuts_Other->Add(hMCd0D0pt_tgh_other_pm[i]);
2452  
2453
2454     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2455     hd0D0VtxTruept_tgh_other_pm[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2456     hd0D0VtxTruept_tgh_other_pm[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2457     hd0D0VtxTruept_tgh_other_pm[i]->SetYTitle("Entries");
2458     flist_TghCuts_Other->Add(hd0D0VtxTruept_tgh_other_pm[i]);
2459     
2460     strnamept=namehist;
2461     strnamept.Append("SBMss_pt");
2462     strnamept+=i;
2463
2464     strtitlept=titlehist;
2465     strtitlept.Append(" Side Bands, ");
2466     strtitlept+=fptbins[i];
2467     strtitlept.Append("<= pt <");
2468     strtitlept+=fptbins[i+1];
2469     strtitlept.Append(" [GeV/c]");
2470     
2471     hd0D0pt_tgh_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2472     hd0D0pt_tgh_other_sb[i]->SetXTitle("Impact parameter [#mum] ");
2473     hd0D0pt_tgh_other_sb[i]->SetYTitle("Entries");
2474     flist_TghCuts_Other->Add(hd0D0pt_tgh_other_sb[i]);
2475
2476     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2477     hMCd0D0pt_tgh_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2478     hMCd0D0pt_tgh_other_sb[i]->SetXTitle("MC Impact parameter [#mum] ");
2479     hMCd0D0pt_tgh_other_sb[i]->SetYTitle("Entries");
2480     flist_TghCuts_Other->Add(hMCd0D0pt_tgh_other_sb[i]);
2481
2482     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2483     hd0D0VtxTruept_tgh_other_sb[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2484     hd0D0VtxTruept_tgh_other_sb[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2485     hd0D0VtxTruept_tgh_other_sb[i]->SetYTitle("Entries");
2486     flist_TghCuts_Other->Add(hd0D0VtxTruept_tgh_other_sb[i]);
2487   }
2488
2489   
2490 }
2491
2492
2493
2494 //________________________________________________________________________
2495 void AliAnalysisTaskSECharmFraction::UserExec(Option_t */*option*/)
2496 {
2497   // Execute analysis for current event:
2498   // heavy flavor candidates association to MC truth
2499   
2500   AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
2501
2502  
2503   // load D0->Kpi candidates                                                   
2504   TClonesArray *arrayD0toKpi =
2505     (TClonesArray*)aod->GetList()->FindObject("D0toKpi");
2506   if(!arrayD0toKpi) {
2507     Printf("AliAnalysisTaskSECharmFraction::UserExec: D0toKpi branch not found!\n");
2508     return;
2509   }
2510   
2511   // AOD primary vertex
2512   AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
2513   
2514   
2515   // load MC particles
2516   TClonesArray *arrayMC = 
2517     (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
2518   if(!arrayMC) {
2519     Printf("AliAnalysisTaskSECharmFraction::UserExec: MC particles branch not found!\n");
2520     return;
2521   }
2522   
2523   // load MC header
2524   AliAODMCHeader *aodmcHeader = 
2525     (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
2526   if(!aodmcHeader) {
2527     Printf("AliAnalysisTaskSECharmFraction::UserExec: MC header branch not found!\n");
2528     return;
2529   }
2530   
2531   // MC primary vertex
2532   Double_t vtxTrue[3];
2533   aodmcHeader->GetVertex(vtxTrue);
2534   
2535   if (!aod) {
2536     Printf("ERROR: aod not available");
2537     return;
2538   }
2539   //histogram filled with 1 for every AOD
2540   fNentries->Fill(1);
2541   PostData(1,fNentries);
2542
2543
2544   //Printf("There are %d tracks in this event", aod->GetNumberOfTracks());
2545   //  Int_t nTotHF=0,nTotDstar=0,nTot3Prong=0;
2546   Int_t nTotD0toKpi=0;
2547   Int_t okD0_tight,okD0bar_tight,okD0_loose,okD0bar_loose;
2548   Bool_t isPeakD0,isPeakD0bar,isSideBandD0,isSideBandD0bar,isSideBand;
2549   Int_t signallevel=-1;
2550   Int_t ptbin; 
2551   //  const  Int_t nptbins=10;
2552   Double_t invMassD0,invMassD0bar,ptD0,massmumtrue;
2553   
2554  
2555   AliAODRecoDecayHF *aodDMC=0x0;// to be used to create a fake true sec vertex
2556   // make trkIDtoEntry register (temporary)
2557   Int_t trkIDtoEntry[100000];
2558   for(Int_t it=0;it<aod->GetNumberOfTracks();it++) {
2559     AliAODTrack *track = aod->GetTrack(it);
2560     if(track->GetID()<0) {
2561       //printf("Track ID <0, id= %d\n",track->GetID());
2562       return;
2563     }
2564     trkIDtoEntry[track->GetID()]=it;
2565   }
2566   
2567   
2568   // loop over D0->Kpi candidates
2569   Int_t nD0toKpi = arrayD0toKpi->GetEntriesFast();
2570   nTotD0toKpi += nD0toKpi;
2571   //    cout<<"Number of D0->Kpi: "<<nD0toKpi<<endl;
2572   
2573   for (Int_t iD0toKpi = 0; iD0toKpi < nD0toKpi; iD0toKpi++) {
2574     if(aodDMC!=0x0)delete aodDMC;
2575       
2576     isPeakD0=kFALSE;
2577     isPeakD0bar=kFALSE;
2578     isSideBandD0=kFALSE;
2579     isSideBandD0bar=kFALSE;
2580     isSideBand=kFALSE;
2581     okD0_tight=0;
2582     okD0bar_tight=0;
2583     okD0_loose=0;
2584     okD0bar_loose=0;
2585   
2586     signallevel=-1;
2587     
2588
2589     AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)arrayD0toKpi->UncheckedAt(iD0toKpi);
2590     Bool_t unsetvtx=kFALSE;
2591     if(!d->GetOwnPrimaryVtx()) {
2592       d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
2593       unsetvtx=kTRUE;
2594     }
2595     
2596     ptD0=d->Pt();
2597       
2598     //####### DATA SELECTION ###########
2599     
2600     
2601     //######## INVARIANT MASS SELECTION ###############
2602     CheckInvMassD0(d,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBandD0,isSideBandD0bar);
2603     if(isSideBandD0&&isSideBandD0bar)isSideBand=kTRUE;// TEMPORARY, NOT DONE IN THE METHOD CALLED ABOVE ONLY FOR FURTHER SIDE BAND STUDY
2604   
2605     // INVESTIGATE SIGNAL TYPE : ACCESS TO MC INFORMATION
2606     aodDMC=GetD0toKPiSignalType(d,arrayMC,signallevel,massmumtrue,vtxTrue);
2607     fSignalType->Fill(signallevel);
2608     // END OF BACKGROUND TYPE SELECTION
2609
2610     // NOW APPLY CUTS
2611     //NO CUTS CASE IS FOR FREE
2612     
2613     // CHECK TIGHTER CUTS 
2614     ptbin=SetStandardCuts(ptD0,flargeInvMassCut);
2615     d->SelectD0(fVHFtight->GetD0toKpiCuts(),okD0_tight,okD0bar_tight);
2616     if((isPeakD0&&okD0_tight)||(isPeakD0bar&&okD0bar_tight))fSignalTypeTghCuts->Fill(signallevel);
2617     
2618     // CHECK LOOSER CUTS 
2619     ptbin=SetStandardCuts(ptD0,flargeInvMassCut);
2620     d->SelectD0(fVHFloose->GetD0toKpiCuts(),okD0_loose,okD0bar_loose);
2621     if((isPeakD0&&okD0_loose)||(isPeakD0bar&&okD0bar_loose))fSignalTypeLsCuts->Fill(signallevel);
2622    
2623     
2624     //###################    FILL HISTOS      ########################
2625     //################################################################
2626     //
2627     //######## improvement: SPEED HERE CAN BE IMPROVED: CALCULATE ONCE AND FOR ALL 
2628     //            CANDIDATE VARIABLES   
2629
2630     //NO CUTS Case: force okD0 and okD0bar = kTRUE
2631     if(signallevel==1)FillHistos(d,flist_NoCuts_Signal,ptbin,kTRUE,kTRUE,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2632     else if(signallevel==2)FillHistos(d,flist_NoCuts_FromDstar,ptbin,kTRUE,kTRUE,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2633     else if(signallevel==3)FillHistos(d,flist_NoCuts_FromB,ptbin,kTRUE,kTRUE,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2634     else if(signallevel==4||signallevel==7||signallevel==8)FillHistos(d,flist_NoCuts_Back,ptbin,kTRUE,kTRUE,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2635     else if(signallevel==5||signallevel==6)FillHistos(d,flist_NoCuts_Other,ptbin,kTRUE,kTRUE,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2636
2637     //LOOSE CUTS Case
2638     if(signallevel==1)FillHistos(d,flist_LsCuts_Signal,ptbin,okD0_loose,okD0bar_loose,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2639     else if(signallevel==2)FillHistos(d,flist_LsCuts_FromDstar,ptbin,okD0_loose,okD0bar_loose,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2640     else if(signallevel==3)FillHistos(d,flist_LsCuts_FromB,ptbin,okD0_loose,okD0bar_loose,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2641     else if(signallevel==4||signallevel==7||signallevel==8)FillHistos(d,flist_LsCuts_Back,ptbin,okD0_loose,okD0bar_loose,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2642     else if(signallevel==5||signallevel==6)FillHistos(d,flist_LsCuts_Other,ptbin,okD0_loose,okD0bar_loose,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2643
2644     //TIGHT CUTS Case
2645     if(signallevel==1)FillHistos(d,flist_TghCuts_Signal,ptbin,okD0_tight,okD0bar_tight,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2646     else if(signallevel==2)FillHistos(d,flist_TghCuts_FromDstar,ptbin,okD0_tight,okD0bar_tight,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2647     else if(signallevel==3)FillHistos(d,flist_TghCuts_FromB,ptbin,okD0_tight,okD0bar_tight,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2648     else if(signallevel==4||signallevel==7||signallevel==8)FillHistos(d,flist_TghCuts_Back,ptbin,okD0_tight,okD0bar_tight,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2649     else if(signallevel==5||signallevel==6)FillHistos(d,flist_TghCuts_Other,ptbin,okD0_tight,okD0bar_tight,invMassD0,invMassD0bar,isPeakD0,isPeakD0bar,isSideBand,massmumtrue,aodDMC,vtxTrue);
2650    
2651     
2652     if(aodDMC!=0x0){
2653       delete aodDMC;
2654       aodDMC=0x0;
2655     }
2656    
2657     if(unsetvtx) d->UnsetOwnPrimaryVtx();
2658           
2659   }
2660
2661   // ####################### POST OUTPUT TLIST DATA #########################
2662   // ####### histo for #AOD entries already posted
2663   
2664   PostData(2,fSignalType);
2665   PostData(3,fSignalTypeLsCuts);
2666   PostData(4,fSignalTypeTghCuts);
2667   PostData(5,flist_NoCuts_Signal);
2668   PostData(6,flist_NoCuts_Back);
2669   PostData(7,flist_NoCuts_FromB);
2670   PostData(8,flist_NoCuts_FromDstar);
2671   PostData(9,flist_NoCuts_Other);
2672   PostData(10,flist_LsCuts_Signal);
2673   PostData(11,flist_LsCuts_Back);
2674   PostData(12,flist_LsCuts_FromB);
2675   PostData(13,flist_LsCuts_FromDstar);
2676   PostData(14,flist_LsCuts_Other);
2677   PostData(15,flist_TghCuts_Signal);
2678   PostData(16,flist_TghCuts_Back);
2679   PostData(17,flist_TghCuts_FromB);
2680   PostData(18,flist_TghCuts_FromDstar);
2681   PostData(19,flist_TghCuts_Other);
2682
2683   return;
2684 }
2685
2686 //_________________________________________
2687 Int_t AliAnalysisTaskSECharmFraction::SetStandardCuts(Double_t pt,Double_t invMassCut){
2688   //#############
2689   // TEMPORARY: to be change in :
2690   //             for(j<nptbins)
2691   //                       if pt < standardptbin[j+1]
2692   //                            SetCuts, bin=j
2693   //                            break 
2694   //                            
2695   // the way the cuts are set is for further development
2696   //   (to be interfaced with AliAnalsysTaskSETuneCuts)
2697   Int_t ptbin=-1;
2698   if (pt>0. && pt<=1.) {
2699     ptbin=0;
2700     fVHFtight->SetD0toKpiCuts(invMassCut,0.04,0.8,0.5,0.5,0.05,0.05,-0.0003,0.7);
2701     fVHFloose->SetD0toKpiCuts(invMassCut,0.04,0.8,0.5,0.5,0.05,0.05,-0.00025,0.7);
2702   }
2703   
2704   if(pt>1. && pt<=3.) {
2705     ptbin=1;  
2706     fVHFtight->SetD0toKpiCuts(invMassCut,0.02,0.8,0.7,0.7,0.05,0.05,-0.0003,0.9);
2707     fVHFloose->SetD0toKpiCuts(invMassCut,0.02,0.8,0.7,0.7,1,1,-0.00025,0.8);
2708     //printf("I'm in the bin %d\n",ptbin);
2709   }
2710   
2711   if(pt>3. && pt<=5.){
2712     ptbin=2;  
2713     fVHFtight->SetD0toKpiCuts(invMassCut,0.015,0.8,0.7,0.7,0.05,0.05,-0.0002,0.9);
2714     fVHFloose->SetD0toKpiCuts(invMassCut,0.02,0.8,0.7,0.7,0.05,0.05,-0.00015,0.8);
2715     //printf("I'm in the bin %d\n",ptbin);
2716   }
2717   if(pt>5.){
2718     ptbin=3;
2719     fVHFtight->SetD0toKpiCuts(invMassCut,0.015,0.8,0.7,0.7,0.05,0.05,-0.0002,0.95);
2720     fVHFloose->SetD0toKpiCuts(invMassCut,0.02,0.8,0.7,0.7,0.05,0.05,-0.00015,0.9);
2721   }//if(pt>5)
2722   return ptbin;
2723 }
2724
2725 //__________________________________________________________
2726 void AliAnalysisTaskSECharmFraction::CheckInvMassD0(AliAODRecoDecayHF2Prong *d,Double_t &invMassD0,Double_t &invMassD0bar,Bool_t &isPeakD0,Bool_t &isPeakD0bar,Bool_t &isSideBandD0,Bool_t &isSideBandD0bar){
2727   //Check wheter the candidate inv. mass is compatible with signal or sideband inv. mass selection
2728       
2729   d->InvMassD0(invMassD0,invMassD0bar);
2730   //CHECK if ISPEAK 
2731   if(TMath::Abs(invMassD0-fmD0PDG)<fsignalInvMassCut)isPeakD0=kTRUE;
2732   if(TMath::Abs(invMassD0bar-fmD0PDG)<fsignalInvMassCut)isPeakD0bar=kTRUE;
2733   //CHECK if ISSIDEBAND: no constraint is present between signal region definition and side band definition
2734   // ######## TO BE CHANGED the distinction between sidebandD0 and sidebandD0bar is meaningless 
2735   //               and it is present only for side band region study (see which inv mass has the D0(D0bar) 
2736   //               in case the D0bar(D0) is in the sideband) #######
2737   if(TMath::Abs(invMassD0-fmD0PDG)>fsidebandInvMassCut&&TMath::Abs(invMassD0-fmD0PDG)<fsidebandInvMassCut+fsidebandInvMassWindow){
2738     isSideBandD0=kTRUE;
2739   }
2740   if(TMath::Abs(invMassD0bar-fmD0PDG)>fsidebandInvMassCut&&TMath::Abs(invMassD0bar-fmD0PDG)<fsidebandInvMassCut+fsidebandInvMassWindow){
2741     isSideBandD0bar=kTRUE;
2742   }
2743   
2744 }
2745         
2746
2747
2748 //_______________________
2749 AliAODRecoDecayHF* AliAnalysisTaskSECharmFraction::GetD0toKPiSignalType(AliAODRecoDecayHF2Prong *d,TClonesArray *arrayMC,Int_t &signaltype,Double_t &massMumTrue,Double_t *primaryVtx){
2750   //THIS METHOD CHECK THE TYPE OF SIGNAL/BACKGROUND THE CANDIDATE IS. 
2751   //  IF (!AND ONLY IF) THE TWO DAUGHTERS COME FROM A COMMONE MOTHER A FAKE TRUE SECONDARY VERTEX IS CONSTRUCTED (aodDMC)  
2752   //
2753   // THE FOLLOWING SCHEME IS ADOPTED: signaltype is set to
2754                         //  1:signal (D0 prompt); 2: signal D0 from Dstar; 3: D0 fromB 
2755                         // then background categories: -1 and 4: one or both daughters is a fake track
2756                         //                             5: one or both daughters come from a D meson != D0
2757                         //                             6: both daughters come from a D0->4prongs  
2758                         //                             7: both daughetrs are primaries
2759                         //                             8: generic background (can include one of the previous if desired)
2760                         //
2761                         //                            10: pathologic cases (not clear)
2762                         //                            11: end of the method without output
2763                         //                            12: different result than MatchToMC method
2764
2765   AliAODMCParticle *mum1=0x0;
2766   AliAODMCParticle *b1=0x0,*b2=0x0;
2767   AliAODMCParticle *grandmoth1=0x0;
2768   massMumTrue=-1;
2769   
2770   Int_t pdgmum,dglabels[2],matchtoMC;
2771   Int_t pdgdaughters[2]={211,321};
2772   // get daughter AOD tracks
2773   AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0);
2774   AliAODTrack *trk1 = (AliAODTrack*)d->GetDaughter(1);
2775   AliAODRecoDecayHF *aodDMC=0x0;
2776   if(trk0==0x0||trk1==0x0){
2777     AliDebug(2,"Delete tracks I AM \n");
2778   
2779     signaltype=-1;
2780     return aodDMC;
2781    
2782   }
2783   dglabels[0]=trk0->GetLabel();
2784   dglabels[1]=trk1->GetLabel();
2785   if(dglabels[0]==-1||dglabels[1]==-1){
2786     AliDebug(2,"HERE I AM \n");
2787
2788     //fake tracks
2789     
2790     signaltype=4;
2791     return aodDMC;
2792
2793   }
2794   //      printf("Before entering the MC checks \n");
2795   
2796   b1=(AliAODMCParticle*)arrayMC->At(trk0->GetLabel());
2797   b2=(AliAODMCParticle*)arrayMC->At(trk1->GetLabel());
2798   
2799   if(b1->GetMother()==-1||b2->GetMother()==-1){
2800     //Tracks with no mother  ????? FAKE DECAY VERTEX
2801  
2802     
2803     signaltype=10;
2804     return aodDMC;
2805   }
2806   
2807   mum1=(AliAODMCParticle*)arrayMC->At(b1->GetMother());
2808   //  mum2=(AliAODMCParticle*)arrayMC->At(b2->GetMother());//FOR FURTHER USE
2809   
2810   if(b1->GetMother()!=b2->GetMother()){
2811     //Check the label of the mother is the same
2812     // NOT SAME MOTHER
2813    
2814
2815     signaltype=8;
2816     return aodDMC;
2817   }
2818   massMumTrue=mum1->GetCalcMass();
2819   
2820   matchtoMC=d->MatchToMC(421,arrayMC,2,pdgdaughters);
2821   aodDMC=ConstructFakeTrueSecVtx(b1,b2,mum1,primaryVtx);
2822  
2823   if(aodDMC==0x0){
2824     signaltype=10;
2825     return aodDMC;
2826   }
2827
2828   // if((mum1->GetPdgCode()!=mum2->GetPdgCode()))continue; //Check the mother is the same particle
2829   // printf("Particle codes: tr1: %d, tr2: %d, mum1: %d, mum 2: %d \n",b1->GetPdgCode(),b2->GetPdgCode(),mum1->GetPdgCode(),mum2->GetPdgCode());
2830   if(!((TMath::Abs(b1->GetPdgCode())==321&&TMath::Abs(b1->GetPdgCode())!=211)||(TMath::Abs(b1->GetPdgCode())==211&&TMath::Abs(b1->GetPdgCode()!=321)))){
2831     // Not a Kaon and a Pion
2832    
2833     signaltype=8;
2834     return aodDMC;
2835   }
2836   
2837   pdgmum=mum1->GetPdgCode();
2838   if(TMath::Abs(pdgmum)!=421){
2839     if(TMath::Abs(pdgmum)==411||TMath::Abs(pdgmum)==431||TMath::Abs(pdgmum)==443){
2840       // IT IS A SECONDARY VERTEX FROM CHARM BUT NOT A D0
2841       
2842       signaltype=5;
2843       return aodDMC;
2844     }
2845     else {
2846        signaltype=8;
2847        return aodDMC;
2848     }
2849   }
2850
2851   if(mum1->GetDaughter(1)-mum1->GetDaughter(0)+1!=2){
2852     // from D0 but NOT A 2 PRONG DECAY
2853     signaltype=6;
2854     return aodDMC;
2855    
2856   }
2857   
2858   if(mum1->GetMother()==-1){
2859     // A particle coming from nothing
2860     signaltype=10;
2861     return aodDMC;
2862  
2863   }
2864
2865   matchtoMC=d->MatchToMC(421,arrayMC,2,pdgdaughters);
2866   grandmoth1=(AliAODMCParticle*)arrayMC->At(mum1->GetMother());
2867   if(TMath::Abs(grandmoth1->GetPdgCode())==413||TMath::Abs(grandmoth1->GetPdgCode())==423){
2868     // D0 COMING FROM A D0*
2869     if(matchtoMC!=-1){
2870       signaltype=2;
2871       return aodDMC;
2872      
2873     }
2874     else {
2875       signaltype=12;
2876       return aodDMC;
2877       
2878     }
2879   }
2880   //      if(fcheckMCD0){//THIS CHECK IS NEEDED TO AVOID POSSIBLE FAILURE IN THE SECOND WHILE, FOR DEBUGGING
2881   while(TMath::Abs(grandmoth1->GetPdgCode())!=4&&TMath::Abs(grandmoth1->GetPdgCode())!=5){
2882     if(grandmoth1->GetMother()==-1){
2883       //### THE FOLLOWING IN CASE OF DEBUGGING ##########à
2884       /*printf("mother=-1, pdgcode: %d \n",grandmoth1->GetPdgCode());
2885         Int_t son=grandmoth1->GetDaughter(0);
2886         sonpart=(AliAODMCParticle*)arrayMC->At(son);
2887         while(TMath::Abs(sonpart->GetPdgCode())!=421){
2888         printf("mother=-1, pdgcode: %d \n",sonpart->GetPdgCode());
2889         son++;
2890         sonpart=(AliAODMCParticle*)arrayMC->At(son);
2891         }*/
2892    
2893       signaltype=10;
2894       return aodDMC;
2895     }
2896     grandmoth1=(AliAODMCParticle*)arrayMC->At(grandmoth1->GetMother());
2897   }
2898   
2899   if(TMath::Abs(grandmoth1->GetPdgCode())==4){
2900     if(matchtoMC!=-1){
2901     
2902       signaltype=1;
2903       return aodDMC;
2904     }
2905     else {
2906       signaltype=12;
2907       return aodDMC;
2908     
2909     }
2910   }
2911   else if(TMath::Abs(grandmoth1->GetPdgCode())==5){
2912     if(matchtoMC!=-1){
2913       signaltype=3;
2914       return aodDMC;
2915       
2916     }
2917     else {
2918      
2919       signaltype=12;
2920       return aodDMC;
2921     }
2922   }
2923   signaltype=11;// JUST FOR SAFETY: SHOULD NEVER REACH THIS POINT
2924   return aodDMC;
2925   //  return 11;
2926 }
2927
2928 //___________________________________
2929 AliAODRecoDecayHF* AliAnalysisTaskSECharmFraction::ConstructFakeTrueSecVtx(AliAODMCParticle *b1, AliAODMCParticle *b2, AliAODMCParticle *mum,Double_t *primaryVtxTrue){
2930   // CONSTRUCT A FAKE TRUE SECONDARY VERTEX (aodDMC)  
2931   //!!!NOTE THAT ONLY ONE MOTHER IS CONSIDERED: THE METHOD REQUIRES THE DAUGHTERS COME FROM THE SAME MOTHER !!
2932   if(b1==0x0||b2==0x0)return 0x0;
2933   if(mum==0x0)return 0x0;
2934   Double_t pD[3],xD[3],pXtrTrue[2],pYtrTrue[2],pZtrTrue[2],xtr1[3],xtr2[3];
2935   Int_t charge[2]={0,0};
2936   if(b1->Charge()==-1)charge[0]=1;
2937   else {
2938     if(b2->Charge()==-1){
2939       //printf("Same charges for prongs \n");
2940       return 0x0;
2941     }
2942     charge[1]=1;
2943   }
2944   
2945   pXtrTrue[charge[0]]=b1->Px();
2946   pYtrTrue[charge[0]]=b1->Py();
2947   pZtrTrue[charge[0]]=b1->Pz();
2948   if(!b1->XvYvZv(xtr1)){
2949     return 0x0;
2950   }
2951   
2952   pXtrTrue[charge[1]]=b2->Px();
2953   pYtrTrue[charge[1]]=b2->Py();
2954   pZtrTrue[charge[1]]=b2->Pz();
2955   
2956   if(!mum->PxPyPz(pD)){
2957     //printf("!D from B:Get momentum failed \n");
2958     return 0x0;
2959   }
2960   if(!mum->XvYvZv(xD)){
2961     //printf("!D from B:Get position failed \n");
2962     return 0x0;
2963   }
2964   /* ############ THIS HAPPENS FROM TIME TO TIME: NUMERIC PROBLEM KNOWN #################
2965      if(pXtrTrue[0]+pXtrTrue[1]!=pD[0]){
2966      }*/
2967   
2968   
2969   if(!b2->XvYvZv(xtr2)){
2970     return 0x0;
2971   }
2972   Double_t d0dummy[2]={0.,0.};//TEMPORARY : dummy d0 for AliAODRecoDeay constructor
2973   AliAODRecoDecayHF* aodDMC=new AliAODRecoDecayHF(primaryVtxTrue,xD,2,0,pXtrTrue,pYtrTrue,pZtrTrue,d0dummy);
2974   
2975   /*   ######## THE FOLLOWINF FOR DEBUGGING ############
2976        Printf("testing the Fake vertex: SecVtxX: %f, Px: %f, Py: %f, Pz:%f \n ",aodDMC->GetSecVtxX(),aodDMC->Px(),aodDMC->Py(),aodDMC->Pz());
2977        Printf("pD: x=%f, y=%f,z=%f\n",pD[0],pD[1],pD[2]);
2978        Printf("Daughters :px1:%f, px2:%f \n",pXtrTrue[0],pXtrTrue[1]);
2979        Printf("Daughters :py1:%f, py2:%f \n",pYtrTrue[0],pYtrTrue[1]);
2980        Printf("Daughters :pz1:%f, pz2:%f \n",pZtrTrue[0],pZtrTrue[1]);
2981        Printf("Mother pdg: %d",mum->GetPdgCode());
2982        Printf("Impact Par Prod: %f\n",aodDMC->ImpParXY());
2983   */
2984
2985   return aodDMC;
2986 }
2987
2988 //________________________________________________________
2989 Bool_t AliAnalysisTaskSECharmFraction::FillHistos(AliAODRecoDecayHF2Prong *d,TList *&list,Int_t ptbin,Int_t okD0,Int_t okD0bar,Double_t invMassD0,Double_t invMassD0bar,Bool_t isPeakD0,Bool_t isPeakD0bar,Bool_t isSideBand,Double_t massmumtrue,AliAODRecoDecayHF *aodDMC,Double_t *vtxTrue){
2990   
2991   if((!okD0)&&(!okD0bar))return kTRUE;
2992   
2993   // ######### Get Standard label for hist in tlist ###############
2994   TString namehist=list->GetName(),str;
2995   namehist.ReplaceAll("list","");
2996
2997   //  ######### Global properties histos #################
2998   str="hCPtaVSd0d0";
2999   str.Append(namehist.Data());
3000   ((TH1F*)list->FindObject(str.Data()))->Fill(1e8*d->Prodd0d0(),d->CosPointingAngle());
3001
3002   str="hSecVtxZ";
3003   str.Append(namehist.Data());
3004   ((TH1F*)list->FindObject(str.Data()))->Fill(d->GetSecVtxZ());
3005
3006   str="hSecVtxX";
3007   str.Append(namehist.Data());
3008   ((TH1F*)list->FindObject(str.Data()))->Fill(d->GetSecVtxX()*10000.);
3009
3010   str="hSecVtxY";
3011   str.Append(namehist.Data());
3012   ((TH1F*)list->FindObject(str.Data()))->Fill(d->GetSecVtxY()*10000.);
3013   
3014   str="hSecVtxXY";
3015   str.Append(namehist.Data());
3016   ((TH2F*)list->FindObject(str.Data()))->Fill(d->GetSecVtxX()*10000.,d->GetSecVtxY()*10000.);
3017
3018   str="hSecVtxPhi";
3019   str.Append(namehist.Data());
3020   ((TH1F*)list->FindObject(str.Data()))->Fill(TMath::ATan2(d->GetSecVtxY()*10000.,d->GetSecVtxX()*10000.)*TMath::RadToDeg());
3021
3022    str="hCPta";
3023    str.Append(namehist.Data());
3024    ((TH1F*)list->FindObject(str.Data()))->Fill(d->CosPointingAngle());
3025
3026    str="hd0xd0";
3027    str.Append(namehist.Data());
3028    ((TH1F*)list->FindObject(str.Data()))->Fill(1e8*d->Prodd0d0());
3029
3030
3031    //  ######### Invariant mass histos #################
3032    str="hMass";
3033    str.Append(namehist.Data());
3034    ((TH1F*)list->FindObject(str.Data()))->Fill(invMassD0);
3035    ((TH1F*)list->FindObject(str.Data()))->Fill(invMassD0bar);
3036    
3037       
3038    if(isPeakD0||isPeakD0bar){
3039      str="hMass";
3040      str.Append(namehist.Data());
3041      str.Append("_pm");
3042      if(isPeakD0&&okD0)((TH1F*)list->FindObject(str.Data()))->Fill(invMassD0);
3043      if(isPeakD0bar&&okD0bar)((TH1F*)list->FindObject(str.Data()))->Fill(invMassD0bar);
3044    }
3045    if(isSideBand){
3046      str="hMass";
3047      str.Append(namehist.Data());
3048      str.Append("_sb");
3049      if(okD0)((TH1F*)list->FindObject(str.Data()))->Fill(invMassD0);
3050      if(okD0bar)((TH1F*)list->FindObject(str.Data()))->Fill(invMassD0bar);
3051    }
3052
3053    if(massmumtrue>0.){
3054      str="hMassTrue";
3055      str.Append(namehist.Data());
3056      ((TH1F*)list->FindObject(str.Data()))->Fill(massmumtrue);
3057      
3058      if(isPeakD0||isPeakD0bar){
3059        str="hMassTrue";
3060        str.Append(namehist.Data());
3061        str.Append("_pm");
3062        ((TH1F*)list->FindObject(str.Data()))->Fill(massmumtrue);
3063      }
3064      if(isSideBand){
3065        str="hMassTrue";
3066        str.Append(namehist.Data());
3067        str.Append("_sb");
3068        ((TH1F*)list->FindObject(str.Data()))->Fill(massmumtrue);
3069      }
3070    }
3071
3072    // ################ D0 Impact Parameter Histos #####################
3073    if(isPeakD0||isPeakD0bar){
3074      str="hd0D0";
3075      str.Append(namehist.Data());
3076      str.Append("_pm");
3077      ((TH1F*)list->FindObject(str.Data()))->Fill(d->ImpParXY()*10000.);
3078
3079      str="hd0D0pt";
3080      str.Append(namehist.Data());
3081      str.Append("_PkMss_pt");
3082      str+=ptbin;
3083      ((TH1F*)list->FindObject(str.Data()))->Fill(d->ImpParXY()*10000.);
3084      
3085    
3086      if(vtxTrue){
3087        str="hd0D0VtxTrue";
3088        str.Append(namehist.Data());
3089        str.Append("_pm");
3090        ((TH1F*)list->FindObject(str.Data()))->Fill(d->AliAODRecoDecay::ImpParXY(vtxTrue)*10000.);
3091
3092        str="hd0D0VtxTruept";
3093        str.Append(namehist.Data());
3094        str.Append("_PkMss_pt");
3095        str+=ptbin;
3096        ((TH1F*)list->FindObject(str.Data()))->Fill(d->AliAODRecoDecay::ImpParXY(vtxTrue)*10000.);
3097        
3098      }
3099   
3100      if(aodDMC!=0x0){
3101        aodDMC->Print("");
3102        aodDMC->ImpParXY();
3103        aodDMC->Print("");
3104        str="hMCd0D0";
3105        str.Append(namehist.Data());
3106        str.Append("_pm");
3107        ((TH1F*)list->FindObject(str.Data()))->Fill(aodDMC->ImpParXY()*10000.);
3108      
3109        str="hMCd0D0pt";
3110         str.Append(namehist.Data());
3111         str.Append("_PkMss_pt");
3112         str+=ptbin;
3113         ((TH1F*)list->FindObject(str.Data()))->Fill(aodDMC->ImpParXY()*10000.);
3114      }
3115      
3116    }
3117    else if(isSideBand){
3118      str="hd0D0";
3119      str.Append(namehist.Data());
3120      str.Append("_sb");
3121      ((TH1F*)list->FindObject(str.Data()))->Fill(d->ImpParXY()*10000.);
3122  
3123      str="hd0D0pt";
3124      str.Append(namehist.Data());
3125      str.Append("_SBMss_pt");
3126      str+=ptbin;
3127      ((TH1F*)list->FindObject(str.Data()))->Fill(d->ImpParXY()*10000.);
3128      
3129   
3130      if(vtxTrue){
3131        str="hd0D0VtxTrue";
3132        str.Append(namehist.Data());
3133        str.Append("_sb");
3134        ((TH1F*)list->FindObject(str.Data()))->Fill(d->AliAODRecoDecay::ImpParXY(vtxTrue)*10000.);
3135     
3136        str="hd0D0VtxTruept";
3137        str.Append(namehist.Data());
3138        str.Append("_SBMss_pt");
3139        str+=ptbin;
3140        ((TH1F*)list->FindObject(str.Data()))->Fill(d->AliAODRecoDecay::ImpParXY(vtxTrue)*10000.);
3141        
3142      }
3143  
3144      if(aodDMC!=0x0){
3145        str="hMCd0D0";
3146        str.Append(namehist.Data());
3147        str.Append("_sb");
3148        ((TH1F*)list->FindObject(str.Data()))->Fill(aodDMC->ImpParXY()*10000.);
3149     
3150        str="hMCd0D0pt";
3151        str.Append(namehist.Data());
3152        str.Append("_SBMss_pt");
3153        str+=ptbin;
3154         ((TH1F*)list->FindObject(str.Data()))->Fill(aodDMC->ImpParXY()*10000.);
3155      }
3156      
3157    }
3158      
3159    return kTRUE;
3160 }
3161
3162 void AliAnalysisTaskSECharmFraction::Terminate(const Option_t*){
3163   //TERMINATE METHOD: NOTHING TO DO
3164
3165
3166 }