Fix
[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@pd.infn.it
23 /////////////////////////////////////////////////////////////
24
25
26 #include <TH1F.h>
27 #include <TH2F.h>
28 #include <THnSparse.h>
29 #include <TDatabasePDG.h>
30 #include <TMath.h>
31 #include <TROOT.h>
32 #include "AliAODEvent.h"
33 #include "AliAODRecoDecayHF2Prong.h"
34 #include "AliAODRecoDecayHF.h"
35 #include "AliAODRecoDecay.h"
36 #include "AliAnalysisDataSlot.h"
37 #include "AliAnalysisDataContainer.h"
38 #include "AliAODTrack.h"
39 #include "AliAODHandler.h"
40 #include "AliESDtrack.h"
41 #include "AliAODVertex.h"
42 #include "AliESDVertex.h"
43 #include "AliVertexerTracks.h"
44 #include "AliAODMCParticle.h"
45 #include "AliAODPid.h"
46 #include "AliTPCPIDResponse.h"
47 #include "AliAODMCHeader.h"
48 #include "AliAnalysisVertexingHF.h"
49 #include "AliAnalysisTaskSECharmFraction.h"
50 #include "AliRDHFCutsD0toKpi.h"
51 #include "AliAODInputHandler.h"
52 #include "AliAnalysisManager.h"
53 #include "AliNormalizationCounter.h"
54
55 class TCanvas;
56 class TTree;
57 class TChain;
58 class AliAnalysisTaskSE;
59
60
61 ClassImp(AliAnalysisTaskSECharmFraction)
62  
63 //________________________________________________________________________
64   AliAnalysisTaskSECharmFraction::AliAnalysisTaskSECharmFraction() 
65     : AliAnalysisTaskSE(),
66       fCutsLoose(0),
67       fCutsTight(0),
68       fFastAnalysis(1),
69       fReadMC(kFALSE),
70       fsplitMassD0D0bar(kTRUE),
71       fLikeSign(kFALSE),
72       fusePID(kTRUE),
73       fmD0PDG(),
74       fnbins(1),
75       fptbins(0),
76       fNtrMaxforVtx(-1),
77       fptAll(),                          
78       fptAllSq(),                        
79       fptMax(),
80       fAcceptanceCuts(),
81       fsignalInvMassCut(),
82       flargeInvMassCut(),
83       fsidebandInvMassCut(),
84       fsidebandInvMassWindow(),
85       fUseMC(kTRUE),
86       fCleanCandOwnVtx(kFALSE),
87       fNentries(0),
88       fSignalType(0),
89       fSignalTypeLsCuts(0),
90       fSignalTypeTghCuts(0),
91       fCounter(0),
92       flistMCproperties(0),
93       flistNoCutsSignal(0),
94       flistNoCutsBack(0),
95       flistNoCutsFromB(0),
96       flistNoCutsFromDstar(0),
97       flistNoCutsOther(0),
98       flistLsCutsSignal(0),
99       flistLsCutsBack(0),
100       flistLsCutsFromB(0),
101       flistLsCutsFromDstar(0),
102       flistLsCutsOther(0),
103       flistTghCutsSignal(0),
104       flistTghCutsBack(0),
105       flistTghCutsFromB(0),
106       flistTghCutsFromDstar(0),
107       flistTghCutsOther(0)
108    
109 {
110   //Default constructor
111 }
112 //________________________________________________________________________
113   AliAnalysisTaskSECharmFraction::AliAnalysisTaskSECharmFraction(const char *name) 
114     : AliAnalysisTaskSE(name),
115       fCutsLoose(0x0),
116       fCutsTight(0x0),
117       fFastAnalysis(1),
118       fReadMC(kFALSE),
119       fsplitMassD0D0bar(kTRUE),
120       fLikeSign(kFALSE),
121       fusePID(kTRUE),
122       fmD0PDG(),
123       fnbins(1),
124       fptbins(0),
125       fNtrMaxforVtx(-1),
126       fptAll(),                          
127       fptAllSq(),                        
128       fptMax(),
129       fAcceptanceCuts(),
130       fsignalInvMassCut(-1.),
131       flargeInvMassCut(-1.),
132       fsidebandInvMassCut(-1.),
133       fsidebandInvMassWindow(-1.),
134       fUseMC(kFALSE),
135       fCleanCandOwnVtx(kFALSE),
136       fNentries(0),
137       fSignalType(0),
138       fSignalTypeLsCuts(0),
139       fSignalTypeTghCuts(0),
140       fCounter(0),
141       flistMCproperties(0),
142       flistNoCutsSignal(0),
143       flistNoCutsBack(0),
144       flistNoCutsFromB(0),
145       flistNoCutsFromDstar(0),
146       flistNoCutsOther(0),
147       flistLsCutsSignal(0),
148       flistLsCutsBack(0),
149       flistLsCutsFromB(0),
150       flistLsCutsFromDstar(0),
151       flistLsCutsOther(0),
152       flistTghCutsSignal(0),
153       flistTghCutsBack(0),
154       flistTghCutsFromB(0),
155       flistTghCutsFromDstar(0),
156       flistTghCutsOther(0)
157    
158 {
159   // Constructor
160  
161   // Define input and output slots here
162   // Input slot #0 works with a TChain
163   // Output slot #0 writes into a TH1 container
164
165   //Standard pt bin
166   fnbins=SetStandardCuts(fptbins);// THIS TO SET NBINS AND BINNING
167  
168   DefineOutput(1, TH1F::Class());
169   DefineOutput(2, TH1F::Class());
170   DefineOutput(3, TH1F::Class());
171   DefineOutput(4, TH1F::Class());
172   DefineOutput(5, AliNormalizationCounter::Class());
173
174   for(Int_t j=6;j<22;j++){
175     DefineOutput(j, TList::Class());
176   }
177
178   // Output slot for the Cut Objects 
179   DefineOutput(22,AliRDHFCutsD0toKpi::Class());  //My private output
180   DefineOutput(23,AliRDHFCutsD0toKpi::Class());  //My private output
181
182 }
183
184
185 AliAnalysisTaskSECharmFraction::AliAnalysisTaskSECharmFraction(const char *name,AliRDHFCutsD0toKpi *cutsA,AliRDHFCutsD0toKpi *cutsB) 
186   : AliAnalysisTaskSE(name),
187     fCutsLoose(0),
188     fCutsTight(0),
189     fFastAnalysis(1),
190     fReadMC(kFALSE),
191     fsplitMassD0D0bar(kTRUE),
192     fLikeSign(kFALSE),
193     fusePID(kTRUE),
194     fmD0PDG(),
195     fnbins(1),
196     fptbins(0),
197     fNtrMaxforVtx(-1),
198     fptAll(),                          
199     fptAllSq(),                        
200     fptMax(),
201     fAcceptanceCuts(),
202     fsignalInvMassCut(-1.),
203     flargeInvMassCut(-1.),
204     fsidebandInvMassCut(-1.),
205     fsidebandInvMassWindow(-1.),
206     fUseMC(kFALSE),
207     fCleanCandOwnVtx(kFALSE),
208     fNentries(0),
209     fSignalType(0),
210     fSignalTypeLsCuts(0),
211     fSignalTypeTghCuts(0),
212     fCounter(0),
213     flistMCproperties(0),
214     flistNoCutsSignal(0),
215     flistNoCutsBack(0),
216     flistNoCutsFromB(0),
217     flistNoCutsFromDstar(0),
218     flistNoCutsOther(0),
219     flistLsCutsSignal(0),
220     flistLsCutsBack(0),
221     flistLsCutsFromB(0),
222     flistLsCutsFromDstar(0),
223     flistLsCutsOther(0),
224     flistTghCutsSignal(0),
225     flistTghCutsBack(0),
226     flistTghCutsFromB(0),
227     flistTghCutsFromDstar(0),
228     flistTghCutsOther(0)
229 {
230   // Constructor
231   if(fCutsTight){
232     delete fCutsTight;fCutsTight=NULL;
233   }
234   if(fCutsLoose){
235     delete fCutsLoose;fCutsLoose=NULL;
236   }
237   
238   //Check consistency between sets of cuts:
239   if(cutsA->GetNPtBins()!=cutsB->GetNPtBins()){
240     printf("Different number of pt bins between the two sets of cuts: SWITCH TO STANDARD CUTS \n");
241     fnbins=SetStandardCuts(fptbins);
242   }
243   else{
244     fCutsTight=new AliRDHFCutsD0toKpi(*cutsA);
245     fCutsLoose=new AliRDHFCutsD0toKpi(*cutsB);
246     for(Int_t j=0;j<cutsA->GetNPtBins();j++){
247       if(TMath::Abs(cutsA->GetPtBinLimits()[j]-cutsB->GetPtBinLimits()[j])>1.e-7){
248         printf("Different pt bin limits in the two set of cuts: use the first as reference \n");
249         fCutsLoose->SetPtBins(cutsA->GetNPtBins(),cutsA->GetPtBinLimits());
250         break;
251       }     
252     }
253     SetPtBins(fCutsTight->GetNPtBins(),fCutsTight->GetPtBinLimits());   
254   }
255   
256   // Output slot #0 writes into a TH1 container
257   DefineOutput(1, TH1F::Class());
258   DefineOutput(2, TH1F::Class());
259   DefineOutput(3, TH1F::Class());
260   DefineOutput(4, TH1F::Class());
261   DefineOutput(5, AliNormalizationCounter::Class());
262
263   for(Int_t j=6;j<22;j++){
264
265     DefineOutput(j, TList::Class());
266   }
267  // Output slot for the Cut Objects 
268   DefineOutput(22,AliRDHFCutsD0toKpi::Class());  //My private output
269   DefineOutput(23,AliRDHFCutsD0toKpi::Class());  //My private output
270  
271 }
272
273 //________________________________________________________________________
274 AliAnalysisTaskSECharmFraction::~AliAnalysisTaskSECharmFraction()
275 { //Destructor 
276   
277   if (fCutsTight) {   
278     delete fCutsTight;
279     fCutsTight = 0;
280   }
281   if (fCutsLoose) {  
282     delete fCutsLoose;
283     fCutsLoose = 0;
284   }
285   if(fptbins){
286     delete fptbins;
287     fptbins =0;
288   }
289   /*  if(fAcceptanceCuts){
290     delete fAcceptanceCuts;
291     fAcceptanceCuts=0;
292     }*/
293   if (fNentries) {
294     delete fNentries;
295     fNentries = 0;
296   }   
297   if (fSignalType) {
298     delete fSignalType;
299     fSignalType = 0;
300   } 
301   if (fSignalTypeLsCuts) {
302     delete fSignalTypeLsCuts;
303     fSignalTypeLsCuts = 0;
304   } 
305   if (fSignalTypeTghCuts) {
306     delete fSignalTypeTghCuts;
307     fSignalTypeTghCuts = 0;
308   } 
309   
310   if (fCounter) {
311     delete fCounter;
312     fCounter = 0;
313   } 
314   
315   if(flistMCproperties){
316     flistMCproperties->Delete();
317     delete flistMCproperties;
318     flistMCproperties=0;
319   }
320   
321   if(flistNoCutsSignal){
322     flistNoCutsSignal->Delete();
323     delete flistNoCutsSignal;
324     flistNoCutsSignal=0;
325   }
326   if(flistNoCutsBack){
327     flistNoCutsBack->Delete();
328     delete flistNoCutsBack;
329     flistNoCutsBack=0;
330   }
331   if(flistNoCutsFromB){
332     flistNoCutsFromB->Delete();
333     delete flistNoCutsFromB;
334     flistNoCutsFromB=0;
335   }
336   if(flistNoCutsFromDstar){
337     flistNoCutsFromDstar->Delete();
338     delete flistNoCutsFromDstar;
339     flistNoCutsFromDstar=0;
340   }
341   if(flistNoCutsOther){
342     flistNoCutsOther->Delete();
343     delete flistNoCutsOther;
344     flistNoCutsOther=0;
345   }
346   
347  if(flistLsCutsSignal){
348    flistLsCutsSignal->Delete();
349     delete flistLsCutsSignal;
350     flistLsCutsSignal=0;
351   }
352   if(flistLsCutsBack){
353     flistLsCutsBack->Delete();
354     delete flistLsCutsBack;
355     flistLsCutsBack=0;
356   }
357   if(flistLsCutsFromB){
358     flistLsCutsFromB->Delete();
359     delete flistLsCutsFromB;
360     flistLsCutsFromB=0;
361   }
362   if(flistLsCutsFromDstar){
363     flistLsCutsFromDstar->Delete();
364     delete flistLsCutsFromDstar;
365     flistLsCutsFromDstar=0;
366   }
367   if(flistLsCutsOther){
368     flistLsCutsOther->Delete();
369     delete flistLsCutsOther;
370     flistLsCutsOther=0;
371   }
372   
373  if(flistTghCutsSignal){
374    flistTghCutsSignal->Delete();
375     delete flistTghCutsSignal;
376     flistTghCutsSignal=0;
377   }
378   if(flistTghCutsBack){
379     flistTghCutsBack->Delete();
380     delete flistTghCutsBack;
381     flistTghCutsBack=0;
382   }
383   if(flistTghCutsFromB){
384     flistTghCutsFromB->Delete();
385     delete flistTghCutsFromB;
386     flistTghCutsFromB=0;
387   }
388   if(flistTghCutsFromDstar){
389     flistTghCutsFromDstar->Delete();
390     delete flistTghCutsFromDstar;
391     flistTghCutsFromDstar=0;
392   }
393   if(flistTghCutsOther){
394     flistTghCutsOther->Delete();
395     delete flistTghCutsOther;
396     flistTghCutsOther=0;
397   }
398   
399   
400 }  
401
402
403 //________________________________________________________________________
404 void AliAnalysisTaskSECharmFraction::Init()
405 {
406   // Initialization
407   
408   if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n");
409   fmD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
410   
411   //  gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C");
412   // gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/D0fromBSetCuts.C");
413   // 2 sets of dedicated cuts: fCutsTight is assumed as the standard cut object
414   
415   // SetAcceptanceCut();
416   if(fNtrMaxforVtx<0)SetNMaxTrForVtx(3); //DEFAULT : NO SELECTION
417   if(fsignalInvMassCut<0.||flargeInvMassCut<0.||fsidebandInvMassCut<0.||fsidebandInvMassWindow<0.){
418     printf("AliAnalysisTaskSECharmFraction: Not All info for mass selection provided: switch to default values \n");
419     SetStandardMassSelection();
420   }
421   
422   AliRDHFCutsD0toKpi* copyfCutsTight=new AliRDHFCutsD0toKpi(*fCutsTight);
423   const char* nameoutputTight=GetOutputSlot(22)->GetContainer()->GetName();
424   copyfCutsTight->SetName(nameoutputTight);
425   AliRDHFCutsD0toKpi* copyfCutsLoose=new AliRDHFCutsD0toKpi(*fCutsLoose);
426   const char* nameoutputLoose=GetOutputSlot(23)->GetContainer()->GetName();
427   copyfCutsLoose->SetName(nameoutputLoose);
428
429   // Post the data
430   PostData(22,copyfCutsTight);  
431   PostData(23,copyfCutsLoose);
432   
433   
434   fCleanCandOwnVtx=kFALSE;
435   if(fCutsTight->GetIsPrimaryWithoutDaughters()^fCutsLoose->GetIsPrimaryWithoutDaughters()) {
436     printf("Two cut objects have different selection for primary vertex recalculation w/o daughters:\n Dangerous for variable drawing!! \n");   
437   }
438   else{
439     if(fCutsTight->GetIsPrimaryWithoutDaughters()){
440       fCleanCandOwnVtx=kTRUE;
441       fCutsTight->SetRemoveDaughtersFromPrim(kFALSE);
442       fCutsLoose->SetRemoveDaughtersFromPrim(kFALSE);
443     }
444   }
445    
446
447
448   
449   return;
450 }
451
452 //________________________________________________________________________
453 void AliAnalysisTaskSECharmFraction::UserCreateOutputObjects()
454 {
455   // Create histograms
456   // Called once
457   
458   // ################ NAMING SCHEME ###################################
459   //            LISTS NAMING SCHEME
460   // "list" + cut selection string + MC selection string
461   //      cut strings:  "NC" =nocuts, "LSC"= loose cuts, "TGHC"= tight cuts
462   //      MC sel. strings: "sign"= D0 from c quark
463   //                       "fromDstar" = D0 from Dstar from c quark
464   //                       "fromB"= D0from B decay (->from b quark) + D0from Dstar from B
465   //                       "back"= backgroun, generic except the cas "other"
466   //                       "other"= background case for candidates made of a pion and a kaon coming from the same D0 (in 4 prong) or from D+
467   //
468   //           HISTS NAMING SCHEME 
469   // 
470   //  "h" + specific name + cut selection string + MC selection string + (InvMass region string) + (pt string)
471   //
472   //        cut selection strings    = those for lists
473   //        MC selection strings     = those for lists
474   //        inv mass region strings  : "PM" or "SB" for global properties and pt integrated histos
475   //                                   "_PkMss" or "_SBMss" for impact par. pt dependent histos
476   //                   pt string     : "_pt" + integer number of ptbin
477   //
478   //###################################################################
479
480   TString namehist;
481   TString titlehist;
482   TString strnamept,strtitlept;
483   Printf("INSIDE USER CREATE \n");
484   
485   // fNentries=new TH1F("nentriesChFr", "Look at the number of entries! = number of AODs", 2,1.,2.);
486   
487   fNentries=new TH1F("nentriesChFr", "Analyzed sample properties", 21,-0.5,20.5);
488
489   fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
490
491   fNentries->GetXaxis()->SetBinLabel(2,"nEvTGHTsel");
492   fNentries->GetXaxis()->SetBinLabel(3,"nEvTGHTPile-up Rej");
493   fNentries->GetXaxis()->SetBinLabel(4,"nEvTGHTGoodVtxS");
494   fNentries->GetXaxis()->SetBinLabel(5,"nEvTGHTRejVtxZ");
495   fNentries->GetXaxis()->SetBinLabel(6,"nTracksTGHTEv");
496   fNentries->GetXaxis()->SetBinLabel(7,"nCandTGHTEv");
497   fNentries->GetXaxis()->SetBinLabel(8,"nCandSelTGHTEv");
498   fNentries->GetXaxis()->SetBinLabel(20,"nUnexpErrorTGHT");
499
500   fNentries->GetXaxis()->SetBinLabel(9,"nEvLSsel");
501   fNentries->GetXaxis()->SetBinLabel(10,"nEvLSPile-up Rej");
502   fNentries->GetXaxis()->SetBinLabel(11,"nEvLSGoodVtxS");
503   fNentries->GetXaxis()->SetBinLabel(12,"nEvLSRejVtxZ");
504   fNentries->GetXaxis()->SetBinLabel(13,"nTracksLSEv");
505   fNentries->GetXaxis()->SetBinLabel(14,"nCandLSEv");
506   fNentries->GetXaxis()->SetBinLabel(15,"nCandSelLSEv");
507   fNentries->GetXaxis()->SetBinLabel(21,"nUnexpErrorTGHT");
508
509   /*   -----------------  NOT ACTIVATED YET ------------------
510     fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1");
511     fNentries->GetXaxis()->SetBinLabel(6,"no daughter");
512     fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)");
513     fNentries->GetXaxis()->SetBinLabel(8,"PID=0");
514     fNentries->GetXaxis()->SetBinLabel(9,"PID=1");
515     fNentries->GetXaxis()->SetBinLabel(10,"PID=2");
516     fNentries->GetXaxis()->SetBinLabel(11,"PID=3");
517     fNentries->GetXaxis()->SetBinLabel(12,"K");
518     fNentries->GetXaxis()->SetBinLabel(13,"Lambda");
519     fNentries->GetXaxis()->SetBinLabel(14,"Pile-up Rej");
520     fNentries->GetXaxis()->SetBinLabel(15,"N. of 0SMH");
521   */
522
523   fNentries->GetXaxis()->SetNdivisions(1,kFALSE);
524
525   fSignalType=new TH1F("hsignaltype", "Histo for type of MC signal", 61,-1.,60.);
526   fSignalTypeLsCuts=new TH1F("hsignaltypeLsCuts", "Histo for type of MC signal with loose cuts", 61,-1.,60.);
527   fSignalTypeTghCuts=new TH1F("hsignaltypeTghCuts", "Histo for type of MC signal with tight cuts", 61,-1.,60.);
528
529
530
531   fCounter = new AliNormalizationCounter(Form("%s",GetOutputSlot(5)->GetContainer()->GetName()));
532   fCounter->Init(); 
533
534   //##########  DEFINE THE TLISTS ##################
535   flistMCproperties=new TList();
536   flistMCproperties->SetOwner();
537   flistMCproperties->SetName("listMCproperties");
538
539   flistNoCutsSignal = new TList();
540   flistNoCutsSignal->SetOwner();
541   flistNoCutsSignal->SetName("listNCsign");
542
543   flistNoCutsBack = new TList();
544   flistNoCutsBack->SetOwner();
545   flistNoCutsBack->SetName("listNCback");
546
547   flistNoCutsFromB = new TList();
548   flistNoCutsFromB->SetOwner();
549   flistNoCutsFromB->SetName("listNCfromB");
550
551   flistNoCutsFromDstar = new TList();
552   flistNoCutsFromDstar->SetOwner();
553   flistNoCutsFromDstar->SetName("listNCfromDstar");
554
555   flistNoCutsOther = new TList();
556   flistNoCutsOther->SetOwner();
557   flistNoCutsOther->SetName("listNCother");
558
559
560   flistLsCutsSignal = new TList();
561   flistLsCutsSignal->SetOwner();
562   flistLsCutsSignal->SetName("listLSCsign");
563
564   flistLsCutsBack = new TList();
565   flistLsCutsBack->SetOwner();
566   flistLsCutsBack->SetName("listLSCback");
567
568   flistLsCutsFromB = new TList();
569   flistLsCutsFromB->SetOwner();
570   flistLsCutsFromB->SetName("listLSCfromB");
571
572   flistLsCutsFromDstar = new TList();
573   flistLsCutsFromDstar->SetOwner();
574   flistLsCutsFromDstar->SetName("listLSCfromDstar");
575
576   flistLsCutsOther = new TList();
577   flistLsCutsOther->SetOwner();
578   flistLsCutsOther->SetName("listLSCother");
579
580
581   flistTghCutsSignal = new TList();
582   flistTghCutsSignal->SetOwner();
583   flistTghCutsSignal->SetName("listTGHCsign");
584
585   flistTghCutsBack = new TList();
586   flistTghCutsBack->SetOwner();
587   flistTghCutsBack->SetName("listTGHCback");
588
589   flistTghCutsFromB = new TList();
590   flistTghCutsFromB->SetOwner();
591   flistTghCutsFromB->SetName("listTGHCfromB");
592
593   flistTghCutsFromDstar = new TList();
594   flistTghCutsFromDstar->SetOwner();
595   flistTghCutsFromDstar->SetName("listTGHCfromDstar");
596
597   flistTghCutsOther = new TList();
598   flistTghCutsOther->SetOwner();
599   flistTghCutsOther->SetName("listTGHCother");
600
601
602
603   Float_t ptbinsD0arr[35]={0.,0.1,0.2,0.3,0.4,0.5,0.6,0.8,1.,1.25,1.5,1.75,2.,2.3,2.6,3.,3.5,4.,4.5,5.,5.5,6.,7.,8.,9.,10.,12.,14.,16.,20.,25.,30.,40.,50.,100.};
604   Float_t dumbinning[201];
605   for(Int_t j=0;j<201;j++){
606     dumbinning[j]=(Float_t)j*0.5;
607   }
608
609   // DEFINE EDGES FOR SPARSE HISTOS
610   const Int_t nPtbinsForSparse=91;//nuber of edges, -1 to get number of bins
611   Double_t ptbinsForNsparse[nPtbinsForSparse];//Binning in pt: step: 0.2 GeV/c up to 8 GeV/c, 0.5 Upto 20, 1 GeV/c up to 40, 5 upt to 70-> 8/0.2+12/0.5+20/1.+30./5
612   Double_t pT=0;
613   Double_t massbins[186],impparbins[401];  
614   Double_t massHypoBins[4]={1.,2.,3.,4.};
615   Int_t nbinsSparse[5]={185,185,nPtbinsForSparse-1,400,3};
616   for(Int_t nBins=0;nBins<nPtbinsForSparse;nBins++){    
617     ptbinsForNsparse[nBins]=pT;
618     if(pT<8.)pT+=0.2;
619     else if(pT<20)pT+=0.5;
620     else if(pT<40)pT+=1;
621     else if(pT<70)pT+=5.;  
622   }  
623   for(Int_t nBins=0;nBins<186;nBins++){
624     massbins[nBins]=1.680+nBins*(2.050-1.680)/185.;
625   }
626   for(Int_t nBins=0;nBins<401;nBins++){
627     impparbins[nBins]=-1000+nBins*(2000.)/400.;
628   }
629
630   
631   // Lxy and CosPointXY study
632   Int_t nbinsSparsCxyLxy[4]={84,fCutsTight->GetNPtBins(),10,25}; 
633   Double_t binLowLimitSparseCxyLxy[4]={1.680,fCutsTight->GetPtBinLimits()[0],0.99,0.};// Use OverFlow/UnderFlow to get other cases
634   Double_t binUpLimitSparseCxyLxy[4]={2.100,fCutsTight->GetPtBinLimits()[fCutsTight->GetNPtBins()],1.,50.};
635   Double_t *ptbinlimitsCxyLxy=new Double_t[fCutsTight->GetNPtBins()+1];
636   for(Int_t nBins=0;nBins<=fCutsTight->GetNPtBins();nBins++){
637     ptbinlimitsCxyLxy[nBins]=fCutsTight->GetPtBinLimits()[nBins];
638   }
639   
640
641   //################################################################################################
642   //                                                                                               #
643   //                HISTO FOR MC PROPERTIES OF D0, c quarks and B mesons                           #
644   //                                                                                               # 
645   //################################################################################################
646   TH1F *hMCcquarkAllPt=new TH1F("hMCcquarkAllPt","c quark Pt (all cquarks produced)",34,ptbinsD0arr);
647   TH1F *hMCcquarkAllEta=new TH1F("hMCcquarkAllEta","c quark Eta (all cquarks produced)",50,-3.,3.);
648   TH1F *hMCcquarkAllEnergy=new TH1F("hMCcquarkAllEnergy","c quark Pt (all cquarks produced)",200,0.,100.);
649   TH1F *hMCcquarkNdaught=new TH1F("hMCcquarkNdaught","N cquark daughters (all cquarks produced)",100,0.,100.);
650   TH1F *hMCD0fromcPt=new TH1F("hMCD0fromcPt","D0 from c Pt",34,ptbinsD0arr);
651   TH1F *hMCD0fromcEta=new TH1F("hMCD0fromcEta","D0 from c Eta",50,-3.,3.);
652   TH1F *hMCD0fromcEnergy=new TH1F("hMCD0fromcEnergy","D0 from c Energy",200,0.,100.);
653   
654   TH2F *hMCD0VscquarkPt=new TH2F("hMCD0VscquarkPt","D0 pt Vs cquark pt",34,ptbinsD0arr,34,ptbinsD0arr);
655   TH2F *hMCD0VscquarkEnergy=new TH2F("hMCD0VscquarkEnergy","D0 Energy Vs cquark Energy",200,0.,50.,200,0.,50.);
656   TH1F *hMCD0deltacquarkEnergy=new TH1F("hMCD0deltacquarkEnergy","Fractional D0 Energy w.r.t. cquark Energy",20,0.,1.);
657   TH1F *hMCD0EnergyVsAvcquarkDaughtEn=new TH1F("hMCD0EnergyVsAvcquarkDaughtEn","#Delta(E^{D^0}-E_{avg})/E_{cquark}",40,-1.,1.);
658   TH1F *hMCD0cquarkAngle=new TH1F("hMCD0cquarkAngle","cosine of the angle between D0 and c quark particle",40,-1.,1.);
659   TH2F *hMCD0cquarkAngleEnergy=new TH2F("hMCD0cquarkAngleEnergy","cosine of the angle between D0 and c quark particle as a function of Energy",25,0.,50.,40,-1.,1.);
660
661   TH1I *hMCfromBpdgB=new TH1I("hMCfromBpdgB","hMCfromBpdgB",10000,0.,10000);
662   TH1F *hMCBhadrPt=new TH1F("hMCBhadrPt","B hadr Pt",34,ptbinsD0arr);
663   TH1F *hMCBhadrEta=new TH1F("hMCBhadrEta","B hadr Eta",50,-3.,3.);
664   TH1F *hMCBhadrEnergy=new TH1F("hMCBhadrEnergy","B hadr Pt",200,0.,100.);
665   TH1F *hMCBhadrNdaught=new TH1F("hMCBhadrNdaught","N Bhadr daughters",100,0.,100.);
666   TH1F *hMCD0fromBPt=new TH1F("hMCD0fromBPt","D0 from B Pt",34,ptbinsD0arr);
667   TH1F *hMCD0fromBEta=new TH1F("hMCD0fromBEta","D0 from B Eta",50,-3.,3.);
668   TH1F *hMCD0fromBEnergy=new TH1F("hMCD0fromBEnergy","D0 from B Energy",200,0.,100.);
669
670   TH2F *hMCD0VsBhadrPt=new TH2F("hMCD0VsBhadrPt","D0 pt Vs Bhadr pt",34,ptbinsD0arr,34,ptbinsD0arr);
671   TH2F *hMCD0VsBhadrEnergy=new TH2F("hMCD0VsBhadrEnergy","D0 Energy Vs Bhadr Energy",200,0.,50.,200,0.,50.);
672   TH1F *hMCD0deltaBhadrEnergy=new TH1F("hMCD0deltaBhadrEnergy","Fractional D0 Energy w.r.t. Bhadr Energy",20,0.,1.);
673   TH1F *hMCD0EnergyVsAvBDaughtEn=new TH1F("hMCD0EnergyVsAvBDaughtEn","#Delta(E^{D^0}-E_{avg})/E_{Bahdr}",40,-1.,1.);
674   TH1F *hMCD0BhadrAngle=new TH1F("hMCD0BhadrAngle","cosine of the angle between D0 and Bhadr particle",40,-1.,1.);
675   TH2F *hMCD0BhadrAngleEnergy=new TH2F("hMCD0BhadrAngleEnergy","cosine of the angle between D0 and Bhadr particle as a function of Energy",25,0.,50.,40,-1.,1.);
676
677   TH1I *hMCPartFound=new TH1I("hMCPartFound","1=c,2=D0,3=fromBall,4=fromBmeson,5=fromBbaryon",6,0,6); 
678  
679
680   flistMCproperties->Add(hMCcquarkAllPt);
681   flistMCproperties->Add(hMCcquarkAllEta);
682   flistMCproperties->Add(hMCcquarkAllEnergy);
683   flistMCproperties->Add(hMCcquarkNdaught);
684   flistMCproperties->Add(hMCD0fromcPt);
685   flistMCproperties->Add(hMCD0fromcEta);
686   flistMCproperties->Add(hMCD0fromcEnergy);
687   flistMCproperties->Add(hMCD0VscquarkPt);
688   flistMCproperties->Add(hMCD0VscquarkEnergy);
689   flistMCproperties->Add(hMCD0deltacquarkEnergy);
690   flistMCproperties->Add(hMCD0EnergyVsAvcquarkDaughtEn);
691   flistMCproperties->Add(hMCD0cquarkAngle);
692   flistMCproperties->Add(hMCD0cquarkAngleEnergy);
693   
694   flistMCproperties->Add(hMCfromBpdgB);
695   flistMCproperties->Add(hMCBhadrPt);
696   flistMCproperties->Add(hMCBhadrEta);
697   flistMCproperties->Add(hMCBhadrEnergy);
698   flistMCproperties->Add(hMCBhadrNdaught);
699   flistMCproperties->Add(hMCD0fromBPt);
700   flistMCproperties->Add(hMCD0fromBEta);
701   flistMCproperties->Add(hMCD0fromBEnergy);
702   flistMCproperties->Add(hMCD0VsBhadrPt);
703   flistMCproperties->Add(hMCD0VsBhadrEnergy);
704   flistMCproperties->Add(hMCD0deltaBhadrEnergy);
705   flistMCproperties->Add(hMCD0EnergyVsAvBDaughtEn);
706   flistMCproperties->Add(hMCD0BhadrAngle);
707   flistMCproperties->Add(hMCD0BhadrAngleEnergy);
708   flistMCproperties->Add(hMCPartFound);
709
710   //################################################################################################
711   //                                                                                               #
712   //                         HISTOS FOR NO CUTS CASE                                               #
713   //                                                                                               #
714   //################################################################################################
715   Printf("AFTER MC HISTOS \n");
716
717   //############ NO CUTS SIGNAL HISTOGRAMS ###############
718   //
719   // ####### global properties histo ############
720
721   TH2F *hCPtaVSd0d0NCsign=new TH2F("hCPtaVSd0d0NCsign","hCPtaVSd0d0_NoCuts_Signal",1000,-100000.,100000.,100,-1.,1.);
722   TH1F *hSecVtxZNCsign=new TH1F("hSecVtxZNCsign","hSecVtxZ_NoCuts_Signal",1000,-8.,8.);
723   TH1F *hSecVtxXNCsign=new TH1F("hSecVtxXNCsign","hSecVtxX_NoCuts_Signal",1000,-3000.,3000.);
724   TH1F *hSecVtxYNCsign=new TH1F("hSecVtxYNCsign","hSecVtxY_NoCuts_Signal",1000,-3000.,3000.);
725   TH2F *hSecVtxXYNCsign=new TH2F("hSecVtxXYNCsign","hSecVtxXY_NoCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
726   TH1F *hSecVtxPhiNCsign=new TH1F("hSecVtxPhiNCsign","hSecVtxPhi_NoCuts_Signal",180,-180.1,180.1);
727   TH1F *hd0singlTrackNCsign=new TH1F("hd0singlTrackNCsign","hd0singlTrackNoCuts_Signal",1000,-5000.,5000.);
728   TH1F *hCPtaNCsign=new TH1F("hCPtaNCsign","hCPta_NoCuts_Signal",100,-1.,1.);
729   TH1F *hd0xd0NCsign=new TH1F("hd0xd0NCsign","hd0xd0_NoCuts_Signal",1000,-100000.,100000.);
730   TH1F *hMassTrueNCsign=new TH1F("hMassTrueNCsign","D^{0} MC inv. Mass No Cuts Signal(All momenta)",600,1.600,2.200);
731   TH1F *hMassNCsign=new TH1F("hMassNCsign","D^{0} inv. Mass No Cuts Signal (All momenta)",600,1.600,2.200);
732   hMassNCsign->Sumw2();
733   TH1F *hMassTrueNCsignPM=new TH1F("hMassTrueNCsignPM","D^{0} MC inv. Mass No Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
734   TH1F *hMassNCsignPM=new TH1F("hMassNCsignPM","D^{0} inv. Mass No Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
735   hMassNCsignPM->Sumw2();
736
737   TH1F *hMassTrueNCsignSB=new TH1F("hMassTrueNCsignSB","D^{0} MC inv. Mass in Side Bands No Cuts Signal(All momenta)",600,1.600,2.200);
738   TH1F *hMassNCsignSB=new TH1F("hMassNCsignSB","D^{0} inv. Mass in Side Bands No Cuts Signal (All momenta)",600,1.600,2.200);
739   hMassNCsignSB->Sumw2();
740
741   flistNoCutsSignal->Add(hCPtaVSd0d0NCsign);
742   flistNoCutsSignal->Add(hSecVtxZNCsign);
743   flistNoCutsSignal->Add(hSecVtxYNCsign);
744   flistNoCutsSignal->Add(hSecVtxXNCsign);
745   flistNoCutsSignal->Add(hSecVtxXYNCsign);
746   flistNoCutsSignal->Add(hSecVtxPhiNCsign);
747   flistNoCutsSignal->Add(hd0singlTrackNCsign);
748   flistNoCutsSignal->Add(hCPtaNCsign);
749   flistNoCutsSignal->Add(hd0xd0NCsign);
750   flistNoCutsSignal->Add(hMassTrueNCsign);
751   flistNoCutsSignal->Add(hMassNCsign);
752   flistNoCutsSignal->Add(hMassTrueNCsignPM);
753   flistNoCutsSignal->Add(hMassNCsignPM);
754   flistNoCutsSignal->Add(hMassTrueNCsignSB);
755   flistNoCutsSignal->Add(hMassNCsignSB);
756   
757   //%%% NEW HISTOS %%%%%%%%%%%%%%%%
758   TH1F *hdcaNCsign=new TH1F("hdcaNCsign","hdca_NoCuts_Signal",100,0.,1000.);
759   hdcaNCsign->SetXTitle("dca   [#mum]");
760   hdcaNCsign->SetYTitle("Entries");
761   TH1F *hcosthetastarNCsign=new TH1F("hcosthetastarNCsign","hCosThetaStar_NoCuts_Signal",50,-1.,1.);
762   hcosthetastarNCsign->SetXTitle("cos #theta^{*}");
763   hcosthetastarNCsign->SetYTitle("Entries");
764   TH1F *hptD0NCsign=new TH1F("hptD0NCsign","D^{0} transverse momentum distribution",34,ptbinsD0arr);
765   hptD0NCsign->SetXTitle("p_{t}  [GeV/c]");
766   hptD0NCsign->SetYTitle("Entries");
767   TH1F *hptD0VsMaxPtNCsign=new TH1F("hptD0VsMaxPtNCsign","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
768   TH2F *hptD0PTallsqrtNCsign=new TH2F("hptD0PTallsqrtNCsign","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
769   TH2F *hptD0PTallNCsign=new TH2F("hptD0PTallNCsign","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
770   TH2F *hptD0vsptBNCsign=new TH2F("hptD0vsptBNCsign","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
771   TH2F *hpD0vspBNCsign=new TH2F("hpD0vspBNCsign","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
772   TH2F *hptD0vsptcquarkNCsign=new TH2F("hptD0vsptcquarkNCsign","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
773   TH2F *hpD0vspcquarkNCsign=new TH2F("hpD0vspcquarkNCsign","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
774   flistNoCutsSignal->Add(hdcaNCsign);
775   flistNoCutsSignal->Add(hcosthetastarNCsign);
776   flistNoCutsSignal->Add(hptD0NCsign);
777   flistNoCutsSignal->Add(hptD0VsMaxPtNCsign);
778   flistNoCutsSignal->Add(hptD0PTallsqrtNCsign);
779   flistNoCutsSignal->Add(hptD0PTallNCsign);
780   flistNoCutsSignal->Add(hptD0vsptBNCsign);
781   flistNoCutsSignal->Add(hpD0vspBNCsign);
782   flistNoCutsSignal->Add(hptD0vsptcquarkNCsign);
783   flistNoCutsSignal->Add(hpD0vspcquarkNCsign);
784
785   TH1F *hd0zD0ptNCsign;
786   TH1F *hInvMassD0NCsign,*hInvMassD0barNCsign;
787   TH2F *hInvMassPtNCsign=new TH2F("hInvMassPtNCsign","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
788   flistNoCutsSignal->Add(hInvMassPtNCsign);
789   THnSparseF *hSparseNCsign=new THnSparseF("hSparseNCsign","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
790   hSparseNCsign->SetBinEdges(0,massbins);
791   hSparseNCsign->SetBinEdges(1,massbins);
792   hSparseNCsign->SetBinEdges(2,ptbinsForNsparse);
793   hSparseNCsign->SetBinEdges(3,impparbins);
794   hSparseNCsign->SetBinEdges(4,massHypoBins); 
795   flistNoCutsSignal->Add(hSparseNCsign);
796
797
798
799
800   THnSparseF *hSparseCxyLxyNCsign=new THnSparseF("hSparseCxyLxyNCsign","Candidate Mass;massD0;Pt;CosXY;Lxy",4,nbinsSparsCxyLxy,binLowLimitSparseCxyLxy,binUpLimitSparseCxyLxy);
801   hSparseCxyLxyNCsign->SetBinEdges(1,ptbinlimitsCxyLxy);
802   hSparseCxyLxyNCsign->GetAxis(0)->SetName("mass");
803   hSparseCxyLxyNCsign->GetAxis(0)->SetTitle("Invariant Mass (K#pi) [GeV/c^{2}]");
804   hSparseCxyLxyNCsign->GetAxis(1)->SetName("pt");
805   hSparseCxyLxyNCsign->GetAxis(1)->SetTitle("p_{t} [GeV/c]");
806   hSparseCxyLxyNCsign->GetAxis(2)->SetName("CosPointXY");
807   hSparseCxyLxyNCsign->GetAxis(2)->SetTitle("Cos#theta_{point}^{XY}");
808   hSparseCxyLxyNCsign->GetAxis(3)->SetName("NormDecLengthXY");
809   hSparseCxyLxyNCsign->GetAxis(3)->SetTitle("Normalized XY decay length");
810   
811   flistNoCutsSignal->Add(hSparseCxyLxyNCsign);
812
813   
814
815   TH1F *hetaNCsign;
816   TH1F *hCosPDPBNCsign;
817   TH1F *hCosPcPDNCsign;
818   // ADDITIONAL HISTOS
819   TH2F *hd0D0VSd0xd0NCsignpt;
820   TH2F *hangletracksVSd0xd0NCsignpt;
821   TH2F *hangletracksVSd0D0NCsignpt;
822   TH1F *hd0xd0NCsignpt;
823   // AZIMUHAL HISTOS
824   TH1F *hPhiHistPMNCsignpt,*hPhiHistSBNCsignpt;
825
826   
827   TH2F *hTOFpidNCsign=new TH2F("hTOFpidNCsign","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
828   flistNoCutsSignal->Add(hTOFpidNCsign);
829  
830   
831
832   //##################
833   for(Int_t i=0;i<fnbins;i++){
834     //Printf("INSIDE HISTOS CREATION LOOP: %d \n",fnbins);
835     
836     namehist="hPhiHistPMNCsign_pt";
837     namehist+=i;
838     titlehist="Azimuthal correlation No Cuts Sign PM ptbin=";
839     titlehist+=i;
840     hPhiHistPMNCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
841     hPhiHistPMNCsignpt->Sumw2();
842     flistNoCutsSignal->Add(hPhiHistPMNCsignpt);
843
844     namehist="hPhiHistSBNCsign_pt";
845     namehist+=i;
846     titlehist="Azimuthal correlation No Cuts Sign SB ptbin=";
847     titlehist+=i;
848     hPhiHistSBNCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
849     hPhiHistSBNCsignpt->Sumw2();
850     flistNoCutsSignal->Add(hPhiHistSBNCsignpt);
851     
852
853     namehist="hd0zD0ptNCsign_pt";
854     namehist+=i;
855     titlehist="d0(z) No Cuts Signalm ptbin=";
856     titlehist+=i;
857     hd0zD0ptNCsign=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
858     hd0zD0ptNCsign->SetXTitle("d_{0}(z)    [#mum]");
859     hd0zD0ptNCsign->SetYTitle("Entries");
860     flistNoCutsSignal->Add(hd0zD0ptNCsign);
861
862     namehist="hInvMassD0NCsign_pt";
863     namehist+=i;
864     titlehist="Invariant Mass D0 No Cuts Signal ptbin=";
865     titlehist+=i;
866     hInvMassD0NCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
867     hInvMassD0NCsign->SetXTitle("Invariant Mass    [GeV]");
868     hInvMassD0NCsign->SetYTitle("Entries");
869     flistNoCutsSignal->Add(hInvMassD0NCsign);
870
871
872     namehist="hInvMassD0barNCsign_pt";
873     namehist+=i;
874     titlehist="Invariant Mass D0bar No Cuts Signal ptbin=";
875     titlehist+=i;
876     hInvMassD0barNCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
877     hInvMassD0barNCsign->SetXTitle("Invariant Mass    [GeV]");
878     hInvMassD0barNCsign->SetYTitle("Entries");
879     flistNoCutsSignal->Add(hInvMassD0barNCsign);
880
881
882     namehist="hetaNCsign_pt";
883     namehist+=i;
884     titlehist="eta No Cuts Signal ptbin=";
885     titlehist+=i;
886     hetaNCsign=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
887     hetaNCsign->SetXTitle("Pseudorapidity");
888     hetaNCsign->SetYTitle("Entries");
889     flistNoCutsSignal->Add(hetaNCsign);
890
891     namehist="hCosPDPBNCsign_pt";
892     namehist+=i;
893     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
894     titlehist+=i;
895     hCosPDPBNCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
896     hCosPDPBNCsign->SetXTitle("Cosine between D0 momentum and B momentum");
897     hCosPDPBNCsign->SetYTitle("Entries");
898     flistNoCutsSignal->Add(hCosPDPBNCsign);
899
900     namehist="hCosPcPDNCsign_pt";
901     namehist+=i;
902     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
903     titlehist+=i;
904     hCosPcPDNCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
905     hCosPcPDNCsign->SetXTitle("Cosine between c quark momentum and D0 momentum");
906     hCosPcPDNCsign->SetYTitle("Entries");
907     flistNoCutsSignal->Add(hCosPcPDNCsign);
908     
909
910     // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
911     namehist="hd0xd0NCsign_pt";
912     namehist+=i;
913     titlehist="d0xd0 No Cuts Signal ptbin=";
914     titlehist+=i;
915     hd0xd0NCsignpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
916     hd0xd0NCsignpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
917     hd0xd0NCsignpt->SetYTitle("Entries");
918     flistNoCutsSignal->Add(hd0xd0NCsignpt);
919
920
921     namehist="hd0D0VSd0xd0NCsign_pt";
922     namehist+=i;
923     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Signal ptbin=";
924     titlehist+=i;
925     hd0D0VSd0xd0NCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
926     hd0D0VSd0xd0NCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
927     hd0D0VSd0xd0NCsignpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
928     flistNoCutsSignal->Add(hd0D0VSd0xd0NCsignpt);
929     
930     
931     namehist="hangletracksVSd0xd0NCsign_pt";
932     namehist+=i;
933     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Signal ptbin=";
934     titlehist+=i;
935     hangletracksVSd0xd0NCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
936     hangletracksVSd0xd0NCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
937     hangletracksVSd0xd0NCsignpt->SetYTitle(" angle between K and #p tracks  [rad]");
938     flistNoCutsSignal->Add(hangletracksVSd0xd0NCsignpt);
939     
940
941     namehist="hangletracksVSd0D0NCsign_pt";
942     namehist+=i;
943     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Signal ptbin=";
944     titlehist+=i;
945     hangletracksVSd0D0NCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
946     hangletracksVSd0D0NCsignpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
947     hangletracksVSd0D0NCsignpt->SetYTitle(" angle between K and #p tracks  [rad]");
948     flistNoCutsSignal->Add(hangletracksVSd0D0NCsignpt);
949
950   }
951   Printf("AFTER LOOP HISTOS CREATION \n");
952   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
953   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
954
955   // ####### d0 D0 histos ############
956   TH1F *hd0D0NCsignPM = new TH1F("hd0D0NCsignPM","D^{0} impact par. plot , No Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
957   hd0D0NCsignPM->SetXTitle("Impact parameter [#mum]");
958   hd0D0NCsignPM->SetYTitle("Entries");
959
960   TH1F *hd0D0VtxTrueNCsignPM = new TH1F("hd0D0VtxTrueNCsignPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
961   hd0D0VtxTrueNCsignPM->SetXTitle("Impact parameter [#mum]");
962   hd0D0VtxTrueNCsignPM->SetYTitle("Entries");
963
964   TH1F *hMCd0D0NCsignPM = new TH1F("hMCd0D0NCsignPM","D^{0} impact par. plot, No Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
965   hMCd0D0NCsignPM->SetXTitle("MC Impact parameter [#mum]");
966   hMCd0D0NCsignPM->SetYTitle("Entries");
967
968   TH1F *hd0D0NCsignSB = new TH1F("hd0D0NCsignSB","D^{0} impact par. plot , No Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
969   hd0D0NCsignSB->SetXTitle("Impact parameter [#mum]");
970   hd0D0NCsignSB->SetYTitle("Entries");
971
972   TH1F *hd0D0VtxTrueNCsignSB = new TH1F("hd0D0VtxTrueNCsignSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
973   hd0D0VtxTrueNCsignSB->SetXTitle("Impact parameter [#mum]");
974   hd0D0VtxTrueNCsignSB->SetYTitle("Entries");
975
976   TH1F *hMCd0D0NCsignSB = new TH1F("hMCd0D0NCsignSB","D^{0} impact par. plot, No Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
977   hMCd0D0NCsignSB->SetXTitle("MC Impact parameter [#mum]");
978   hMCd0D0NCsignSB->SetYTitle("Entries");
979
980   flistNoCutsSignal->Add(hd0D0NCsignPM);
981   flistNoCutsSignal->Add(hd0D0VtxTrueNCsignPM);
982   flistNoCutsSignal->Add(hMCd0D0NCsignPM);
983   flistNoCutsSignal->Add(hd0D0NCsignSB);
984   flistNoCutsSignal->Add(hd0D0VtxTrueNCsignSB);
985   flistNoCutsSignal->Add(hMCd0D0NCsignSB);
986   
987   TH1F *hd0D0ptNCsignPM;
988   TH1F *hMCd0D0ptNCsignPM;
989   TH1F *hd0D0VtxTrueptNCsignPM;
990   TH1F *hd0D0ptNCsignSB;
991   TH1F *hMCd0D0ptNCsignSB;
992   TH1F *hd0D0VtxTrueptNCsignSB;
993   namehist="hd0D0ptNCsign_";
994   titlehist="D^{0} impact par. plot, No Cuts, Signal, ";
995   for(Int_t i=0;i<fnbins;i++){
996     //Printf("IN HISTOS CREATION USING PTBINS VALUES for NAMES \n");
997     strnamept=namehist;
998     strnamept.Append("PkMss_pt");
999     strnamept+=i;
1000
1001     strtitlept=titlehist;
1002     strtitlept.Append(" Mass Peak, ");
1003
1004     strtitlept+=fptbins[i];
1005     //Printf("IN HISTOS CREATION USING PTBINS VALUES for NAMES %d: %f\n",i,fptbins[i]);
1006     strtitlept.Append("<= pt <");
1007     strtitlept+=fptbins[i+1];
1008     strtitlept.Append(" [GeV/c]");
1009     
1010     hd0D0ptNCsignPM= new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1011     hd0D0ptNCsignPM->SetXTitle("Impact parameter [#mum] ");
1012     hd0D0ptNCsignPM->SetYTitle("Entries");
1013     flistNoCutsSignal->Add(hd0D0ptNCsignPM);
1014
1015     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1016     hMCd0D0ptNCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1017     hMCd0D0ptNCsignPM->SetXTitle("MC Impact parameter [#mum] ");
1018     hMCd0D0ptNCsignPM->SetYTitle("Entries");
1019     flistNoCutsSignal->Add(hMCd0D0ptNCsignPM);
1020  
1021
1022     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1023     hd0D0VtxTrueptNCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1024     hd0D0VtxTrueptNCsignPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1025     hd0D0VtxTrueptNCsignPM->SetYTitle("Entries");
1026     flistNoCutsSignal->Add(hd0D0VtxTrueptNCsignPM);
1027     
1028     strnamept=namehist;
1029     strnamept.Append("SBMss_pt");
1030     strnamept+=i;
1031
1032     strtitlept=titlehist;
1033     strtitlept.Append(" Side Bands, ");
1034     strtitlept+=fptbins[i];
1035     strtitlept.Append("<= pt <");
1036     strtitlept+=fptbins[i+1];
1037     strtitlept.Append(" [GeV/c]");
1038     
1039     hd0D0ptNCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1040     hd0D0ptNCsignSB->SetXTitle("Impact parameter [#mum] ");
1041     hd0D0ptNCsignSB->SetYTitle("Entries");
1042     flistNoCutsSignal->Add(hd0D0ptNCsignSB);
1043
1044     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1045     hMCd0D0ptNCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1046     hMCd0D0ptNCsignSB->SetXTitle("MC Impact parameter [#mum] ");
1047     hMCd0D0ptNCsignSB->SetYTitle("Entries");
1048     flistNoCutsSignal->Add(hMCd0D0ptNCsignSB);
1049
1050     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1051     hd0D0VtxTrueptNCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1052     hd0D0VtxTrueptNCsignSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1053     hd0D0VtxTrueptNCsignSB->SetYTitle("Entries");
1054     flistNoCutsSignal->Add(hd0D0VtxTrueptNCsignSB);
1055   }
1056
1057   //Printf("AFTER SIGNAL HISTOS CREATION for NOCUTS\n");
1058
1059
1060   //############ NO CUTS BACKGROUND HISTOGRAMS ###########
1061   //
1062   //   ######## global properties histos #######
1063   TH2F *hCPtaVSd0d0NCback=new TH2F("hCPtaVSd0d0NCback","hCPtaVSd0d0_NoCuts_Background",1000,-100000.,100000.,100,-1.,1.);
1064   TH1F *hSecVtxZNCback=new TH1F("hSecVtxZNCback","hSecVtxZ_NoCuts_Background",1000,-8.,8.);
1065   TH1F *hSecVtxXNCback=new TH1F("hSecVtxXNCback","hSecVtxX_NoCuts_Background",1000,-3000.,3000.);
1066   TH1F *hSecVtxYNCback=new TH1F("hSecVtxYNCback","hSecVtxY_NoCuts_Background",1000,-3000.,3000.);
1067   TH2F *hSecVtxXYNCback=new TH2F("hSecVtxXYNCback","hSecVtxXY_NoCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
1068   TH1F *hSecVtxPhiNCback=new TH1F("hSecVtxPhiNCback","hSecVtxPhi_NoCuts_Background",180,-180.1,180.1);
1069   TH1F *hd0singlTrackNCback=new TH1F("hd0singlTrackNCback","hd0singlTrackNoCuts_Back",1000,-5000.,5000.);
1070   TH1F *hCPtaNCback=new TH1F("hCPtaNCback","hCPta_NoCuts_Background",100,-1.,1.);
1071   TH1F *hd0xd0NCback=new TH1F("hd0xd0NCback","hd0xd0_NoCuts_Background",1000,-100000.,100000.);
1072   TH1F *hMassTrueNCback=new TH1F("hMassTrueNCback","D^{0} MC inv. Mass No Cuts Background(All momenta)",600,1.600,2.200);
1073   TH1F *hMassNCback=new TH1F("hMassNCback","D^{0} inv. Mass No Cuts Background (All momenta)",600,1.600,2.200);
1074   hMassNCback->Sumw2();
1075   TH1F *hMassTrueNCbackPM=new TH1F("hMassTrueNCbackPM","D^{0} MC inv. Mass No Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
1076   TH1F *hMassNCbackPM=new TH1F("hMassNCbackPM","D^{0} inv. Mass No Cuts Background (All momenta), MassPeak",600,1.600,2.200);
1077   hMassNCbackPM->Sumw2();
1078   TH1F *hMassTrueNCbackSB=new TH1F("hMassTrueNCbackSB","D^{0} MC inv. Mass in Side Bands No Cuts Background(All momenta)",600,1.600,2.200);
1079   TH1F *hMassNCbackSB=new TH1F("hMassNCbackSB","D^{0} inv. Mass in Side Bands No Cuts Background (All momenta)",600,1.600,2.200);
1080   hMassNCbackSB->Sumw2();
1081
1082   flistNoCutsBack->Add(hCPtaVSd0d0NCback);
1083   flistNoCutsBack->Add(hSecVtxZNCback);
1084   flistNoCutsBack->Add(hSecVtxYNCback);
1085   flistNoCutsBack->Add(hSecVtxXNCback);
1086   flistNoCutsBack->Add(hSecVtxXYNCback);
1087   flistNoCutsBack->Add(hSecVtxPhiNCback);
1088   flistNoCutsBack->Add(hd0singlTrackNCback);
1089   flistNoCutsBack->Add(hCPtaNCback);
1090   flistNoCutsBack->Add(hd0xd0NCback);
1091   flistNoCutsBack->Add(hMassTrueNCback);
1092   flistNoCutsBack->Add(hMassNCback);
1093   flistNoCutsBack->Add(hMassTrueNCbackPM);
1094   flistNoCutsBack->Add(hMassNCbackPM);
1095   flistNoCutsBack->Add(hMassTrueNCbackSB);
1096   flistNoCutsBack->Add(hMassNCbackSB);
1097
1098
1099  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1100   TH1F *hdcaNCback=new TH1F("hdcaNCback","hdca_NoCuts_Backgr",100,0.,1000.);
1101   hdcaNCback->SetXTitle("dca   [#mum]");
1102   hdcaNCback->SetYTitle("Entries");
1103   TH1F *hcosthetastarNCback=new TH1F("hcosthetastarNCback","hCosThetaStar_NoCuts_Backgr",50,-1.,1.);
1104   hcosthetastarNCback->SetXTitle("cos #theta^{*}");
1105   hcosthetastarNCback->SetYTitle("Entries");
1106   TH1F *hptD0NCback=new TH1F("hptD0NCback","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1107   hptD0NCback->SetXTitle("p_{t}  [GeV/c]");
1108   hptD0NCback->SetYTitle("Entries");
1109   TH1F *hptD0VsMaxPtNCback=new TH1F("hptD0VsMaxPtNCback","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1110   TH2F *hptD0PTallsqrtNCback=new TH2F("hptD0PTallsqrtNCback","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1111   TH2F *hptD0PTallNCback=new TH2F("hptD0PTallNCback","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1112   TH2F *hptD0vsptBNCback=new TH2F("hptD0vsptBNCback","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1113   TH2F *hpD0vspBNCback=new TH2F("hpD0vspBNCback","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1114   TH2F *hptD0vsptcquarkNCback=new TH2F("hptD0vsptcquarkNCback","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1115   TH2F *hpD0vspcquarkNCback=new TH2F("hpD0vspcquarkNCback","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1116   flistNoCutsBack->Add(hdcaNCback);
1117   flistNoCutsBack->Add(hcosthetastarNCback);
1118   flistNoCutsBack->Add(hptD0NCback);
1119   flistNoCutsBack->Add(hptD0VsMaxPtNCback);
1120   flistNoCutsBack->Add(hptD0PTallsqrtNCback);
1121   flistNoCutsBack->Add(hptD0PTallNCback);
1122   flistNoCutsBack->Add(hptD0vsptBNCback);
1123   flistNoCutsBack->Add(hpD0vspBNCback);
1124   flistNoCutsBack->Add(hptD0vsptcquarkNCback);
1125   flistNoCutsBack->Add(hpD0vspcquarkNCback);
1126  
1127   TH1F *hd0zD0ptNCback;
1128   TH1F *hInvMassD0NCback,*hInvMassD0barNCback;
1129   TH2F *hInvMassPtNCback=new TH2F("hInvMassPtNCback","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1130   THnSparseF *hSparseNCback=new THnSparseF("hSparseNCback","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1131   hSparseNCback->SetBinEdges(0,massbins);
1132   hSparseNCback->SetBinEdges(1,massbins);
1133   hSparseNCback->SetBinEdges(2,ptbinsForNsparse);
1134   hSparseNCback->SetBinEdges(3,impparbins);
1135   hSparseNCback->SetBinEdges(4,massHypoBins); 
1136   flistNoCutsBack->Add(hSparseNCback);
1137
1138   TH1F *hetaNCback;
1139   TH1F *hCosPDPBNCback;
1140   TH1F *hCosPcPDNCback;
1141    // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1142   TH2F *hd0D0VSd0xd0NCbackpt;
1143   TH2F *hangletracksVSd0xd0NCbackpt;
1144   TH2F *hangletracksVSd0D0NCbackpt;
1145   TH1F *hd0xd0NCbackpt;
1146   flistNoCutsBack->Add(hInvMassPtNCback);
1147
1148   TH2F *hTOFpidNCback=new TH2F("hTOFpidNCback","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1149   flistNoCutsBack->Add(hTOFpidNCback);
1150
1151   for(Int_t i=0;i<fnbins;i++){
1152     namehist="hd0zD0ptNCback_pt";
1153     namehist+=i;
1154     titlehist="d0(z) No Cuts Backgrm ptbin=";
1155     titlehist+=i;
1156     hd0zD0ptNCback=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1157     hd0zD0ptNCback->SetXTitle("d_{0}(z)    [#mum]");
1158     hd0zD0ptNCback->SetYTitle("Entries");
1159     flistNoCutsBack->Add(hd0zD0ptNCback);
1160
1161     namehist="hInvMassD0NCback_pt";
1162     namehist+=i;
1163     titlehist="Invariant Mass No Cuts Backgr ptbin=";
1164     titlehist+=i;
1165     hInvMassD0NCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1166     hInvMassD0NCback->SetXTitle("Invariant Mass    [GeV]");
1167     hInvMassD0NCback->SetYTitle("Entries");
1168     flistNoCutsBack->Add(hInvMassD0NCback);
1169
1170     
1171     namehist="hInvMassD0barNCback_pt";
1172     namehist+=i;
1173     titlehist="Invariant Mass D0bar No Cuts Back ptbin=";
1174     titlehist+=i;
1175     hInvMassD0barNCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1176     hInvMassD0barNCback->SetXTitle("Invariant Mass    [GeV]");
1177     hInvMassD0barNCback->SetYTitle("Entries");
1178     flistNoCutsBack->Add(hInvMassD0barNCback);
1179
1180
1181     namehist="hetaNCback_pt";
1182     namehist+=i;
1183     titlehist="eta No Cuts Backgr ptbin=";
1184     titlehist+=i;
1185     hetaNCback=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1186     hetaNCback->SetXTitle("Pseudorapidity");
1187     hetaNCback->SetYTitle("Entries");
1188     flistNoCutsBack->Add(hetaNCback);
1189
1190     namehist="hCosPDPBNCback_pt";
1191     namehist+=i;
1192     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1193     titlehist+=i;
1194     hCosPDPBNCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1195     hCosPDPBNCback->SetXTitle("Cosine between D0 momentum and B momentum");
1196     hCosPDPBNCback->SetYTitle("Entries");
1197     flistNoCutsBack->Add(hCosPDPBNCback);
1198
1199     namehist="hCosPcPDNCback_pt";
1200     namehist+=i;
1201     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1202     titlehist+=i;
1203     hCosPcPDNCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1204     hCosPcPDNCback->SetXTitle("Cosine between c quark momentum and D0 momentum");
1205     hCosPcPDNCback->SetYTitle("Entries");
1206     flistNoCutsBack->Add(hCosPcPDNCback);
1207
1208
1209     // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1210     namehist="hd0xd0NCback_pt";
1211     namehist+=i;
1212     titlehist="d0xd0 No Cuts Background ptbin=";
1213     titlehist+=i;
1214     hd0xd0NCbackpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1215     hd0xd0NCbackpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
1216     hd0xd0NCbackpt->SetYTitle("Entries");
1217     flistNoCutsBack->Add(hd0xd0NCbackpt);
1218
1219
1220     namehist="hd0D0VSd0xd0NCback_pt";
1221     namehist+=i;
1222     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Back ptbin=";
1223     titlehist+=i;
1224     hd0D0VSd0xd0NCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1225     hd0D0VSd0xd0NCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1226     hd0D0VSd0xd0NCbackpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
1227     flistNoCutsBack->Add(hd0D0VSd0xd0NCbackpt);
1228     
1229     
1230     namehist="hangletracksVSd0xd0NCback_pt";
1231     namehist+=i;
1232     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Back ptbin=";
1233     titlehist+=i;
1234     hangletracksVSd0xd0NCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1235     hangletracksVSd0xd0NCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1236     hangletracksVSd0xd0NCbackpt->SetYTitle(" angle between K and #p tracks  [rad]");
1237     flistNoCutsBack->Add(hangletracksVSd0xd0NCbackpt);
1238     
1239
1240     namehist="hangletracksVSd0D0NCback_pt";
1241     namehist+=i;
1242     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Back ptbin=";
1243     titlehist+=i;
1244     hangletracksVSd0D0NCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1245     hangletracksVSd0D0NCbackpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1246     hangletracksVSd0D0NCbackpt->SetYTitle(" angle between K and #p tracks  [rad]");
1247     flistNoCutsBack->Add(hangletracksVSd0D0NCbackpt);
1248
1249
1250     
1251   }
1252   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1253   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254
1255
1256
1257   // ####### d0 D0 histos ############
1258   
1259  TH1F *hd0D0NCbackPM = new TH1F("hd0D0NCbackPM","D^{0} impact par. plot , No Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1260   hd0D0NCbackPM->SetXTitle("Impact parameter [#mum]");
1261   hd0D0NCbackPM->SetYTitle("Entries");
1262
1263   TH1F *hd0D0VtxTrueNCbackPM = new TH1F("hd0D0VtxTrueNCbackPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1264   hd0D0VtxTrueNCbackPM->SetXTitle("Impact parameter [#mum]");
1265   hd0D0VtxTrueNCbackPM->SetYTitle("Entries");
1266
1267   TH1F *hMCd0D0NCbackPM = new TH1F("hMCd0D0NCbackPM","D^{0} impact par. plot, No Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
1268   hMCd0D0NCbackPM->SetXTitle("MC Impact parameter [#mum]");
1269   hMCd0D0NCbackPM->SetYTitle("Entries");
1270
1271   TH1F *hd0D0NCbackSB = new TH1F("hd0D0NCbackSB","D^{0} impact par. plot , No Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1272   hd0D0NCbackSB->SetXTitle("Impact parameter [#mum]");
1273   hd0D0NCbackSB->SetYTitle("Entries");
1274
1275   TH1F *hd0D0VtxTrueNCbackSB = new TH1F("hd0D0VtxTrueNCbackSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1276   hd0D0VtxTrueNCbackSB->SetXTitle("Impact parameter [#mum]");
1277   hd0D0VtxTrueNCbackSB->SetYTitle("Entries");
1278
1279   TH1F *hMCd0D0NCbackSB = new TH1F("hMCd0D0NCbackSB","D^{0} impact par. plot, No Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
1280   hMCd0D0NCbackSB->SetXTitle("MC Impact parameter [#mum]");
1281   hMCd0D0NCbackSB->SetYTitle("Entries");
1282
1283   flistNoCutsBack->Add(hd0D0NCbackPM);
1284   flistNoCutsBack->Add(hd0D0VtxTrueNCbackPM);
1285   flistNoCutsBack->Add(hMCd0D0NCbackPM);
1286   flistNoCutsBack->Add(hd0D0NCbackSB);
1287   flistNoCutsBack->Add(hd0D0VtxTrueNCbackSB);
1288   flistNoCutsBack->Add(hMCd0D0NCbackSB);
1289   
1290   TH1F *hd0D0ptNCbackPM;
1291   TH1F *hMCd0D0ptNCbackPM;
1292   TH1F *hd0D0VtxTrueptNCbackPM;
1293   TH1F *hd0D0ptNCbackSB;
1294   TH1F *hMCd0D0ptNCbackSB;
1295   TH1F *hd0D0VtxTrueptNCbackSB;
1296   namehist="hd0D0ptNCback_";
1297   titlehist="D^{0} impact par. plot, No Cuts, Background, ";
1298   for(Int_t i=0;i<fnbins;i++){
1299     strnamept=namehist;
1300     strnamept.Append("PkMss_pt");
1301     strnamept+=i;
1302
1303     strtitlept=titlehist;
1304     strtitlept.Append(" Mass Peak, ");
1305     strtitlept+=fptbins[i];
1306     strtitlept.Append("<= pt <");
1307     strtitlept+=fptbins[i+1];
1308     strtitlept.Append(" [GeV/c]");
1309     
1310     hd0D0ptNCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1311     hd0D0ptNCbackPM->SetXTitle("Impact parameter [#mum] ");
1312     hd0D0ptNCbackPM->SetYTitle("Entries");
1313     flistNoCutsBack->Add(hd0D0ptNCbackPM);
1314
1315     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1316     hMCd0D0ptNCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1317     hMCd0D0ptNCbackPM->SetXTitle("MC Impact parameter [#mum] ");
1318     hMCd0D0ptNCbackPM->SetYTitle("Entries");
1319     flistNoCutsBack->Add(hMCd0D0ptNCbackPM);
1320  
1321
1322     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1323     hd0D0VtxTrueptNCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1324     hd0D0VtxTrueptNCbackPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1325     hd0D0VtxTrueptNCbackPM->SetYTitle("Entries");
1326     flistNoCutsBack->Add(hd0D0VtxTrueptNCbackPM);
1327     
1328     strnamept=namehist;
1329     strnamept.Append("SBMss_pt");
1330     strnamept+=i;
1331
1332     strtitlept=titlehist;
1333     strtitlept.Append(" Side Bands, ");
1334     strtitlept+=fptbins[i];
1335     strtitlept.Append("<= pt <");
1336     strtitlept+=fptbins[i+1];
1337     strtitlept.Append(" [GeV/c]");
1338     
1339     hd0D0ptNCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1340     hd0D0ptNCbackSB->SetXTitle("Impact parameter [#mum] ");
1341     hd0D0ptNCbackSB->SetYTitle("Entries");
1342     flistNoCutsBack->Add(hd0D0ptNCbackSB);
1343
1344     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1345     hMCd0D0ptNCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1346     hMCd0D0ptNCbackSB->SetXTitle("MC Impact parameter [#mum] ");
1347     hMCd0D0ptNCbackSB->SetYTitle("Entries");
1348     flistNoCutsBack->Add(hMCd0D0ptNCbackSB);
1349
1350     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1351     hd0D0VtxTrueptNCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1352     hd0D0VtxTrueptNCbackSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1353     hd0D0VtxTrueptNCbackSB->SetYTitle("Entries");
1354     flistNoCutsBack->Add(hd0D0VtxTrueptNCbackSB);
1355   }
1356
1357
1358
1359  //############ NO CUTS FROMB HISTOGRAMS ###########
1360   //
1361   //#######  global properties histos
1362
1363   TH2F *hCPtaVSd0d0NCfromB=new TH2F("hCPtaVSd0d0NCfromB","hCPtaVSd0d0_NoCuts_FromB",1000,-100000.,100000.,100,-1.,1.);
1364   TH1F *hSecVtxZNCfromB=new TH1F("hSecVtxZNCfromB","hSecVtxZ_NoCuts_FromB",1000,-8.,8.);
1365   TH1F *hSecVtxXNCfromB=new TH1F("hSecVtxXNCfromB","hSecVtxX_NoCuts_FromB",1000,-3000.,3000.);
1366   TH1F *hSecVtxYNCfromB=new TH1F("hSecVtxYNCfromB","hSecVtxY_NoCuts_FromB",1000,-3000.,3000.);
1367   TH2F *hSecVtxXYNCfromB=new TH2F("hSecVtxXYNCfromB","hSecVtxXY_NoCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
1368   TH1F *hSecVtxPhiNCfromB=new TH1F("hSecVtxPhiNCfromB","hSecVtxPhi_NoCuts_FromB",180,-180.1,180.1);
1369   TH1F *hd0singlTrackNCfromB=new TH1F("hd0singlTrackNCfromB","hd0singlTrackNoCuts_FromB",1000,-5000.,5000.);
1370   TH1F *hCPtaNCfromB=new TH1F("hCPtaNCfromB","hCPta_NoCuts_FromB",100,-1.,1.);
1371   TH1F *hd0xd0NCfromB=new TH1F("hd0xd0NCfromB","hd0xd0_NoCuts_FromB",1000,-100000.,100000.);
1372   TH1F *hMassTrueNCfromB=new TH1F("hMassTrueNCfromB","D^{0} MC inv. Mass No Cuts FromB(All momenta)",600,1.600,2.200);
1373   TH1F *hMassNCfromB=new TH1F("hMassNCfromB","D^{0} inv. Mass No Cuts FromB (All momenta)",600,1.600,2.200);
1374   hMassNCfromB->Sumw2();
1375   TH1F *hMassTrueNCfromBPM=new TH1F("hMassTrueNCfromBPM","D^{0} MC inv. Mass No Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
1376   TH1F *hMassNCfromBPM=new TH1F("hMassNCfromBPM","D^{0} inv. Mass No Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
1377   hMassNCfromB->Sumw2();
1378   TH1F *hMassTrueNCfromBSB=new TH1F("hMassTrueNCfromBSB","D^{0} MC inv. Mass in Side Bands No Cuts FromB(All momenta)",600,1.600,2.200);
1379   TH1F *hMassNCfromBSB=new TH1F("hMassNCfromBSB","D^{0} inv. Mass in Side Bands No Cuts FromB (All momenta)",600,1.600,2.200);
1380   hMassNCfromBSB->Sumw2();
1381
1382   flistNoCutsFromB->Add(hCPtaVSd0d0NCfromB);
1383   flistNoCutsFromB->Add(hSecVtxZNCfromB);
1384   flistNoCutsFromB->Add(hSecVtxYNCfromB);
1385   flistNoCutsFromB->Add(hSecVtxXNCfromB);
1386   flistNoCutsFromB->Add(hSecVtxXYNCfromB);
1387   flistNoCutsFromB->Add(hSecVtxPhiNCfromB);
1388   flistNoCutsFromB->Add(hd0singlTrackNCfromB);
1389   flistNoCutsFromB->Add(hCPtaNCfromB);
1390   flistNoCutsFromB->Add(hd0xd0NCfromB);
1391   flistNoCutsFromB->Add(hMassTrueNCfromB);
1392   flistNoCutsFromB->Add(hMassNCfromB);
1393   flistNoCutsFromB->Add(hMassTrueNCfromBPM);
1394   flistNoCutsFromB->Add(hMassNCfromBPM);
1395   flistNoCutsFromB->Add(hMassTrueNCfromBSB);
1396   flistNoCutsFromB->Add(hMassNCfromBSB);
1397
1398
1399
1400
1401
1402  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1403   TH1F *hdcaNCfromB=new TH1F("hdcaNCfromB","hdca_NoCuts_FromB",100,0.,1000.);
1404   hdcaNCfromB->SetXTitle("dca   [#mum]");
1405   hdcaNCfromB->SetYTitle("Entries");
1406   TH1F *hcosthetastarNCfromB=new TH1F("hcosthetastarNCfromB","hCosThetaStar_NoCuts_FromB",50,-1.,1.);
1407   hcosthetastarNCfromB->SetXTitle("cos #theta^{*}");
1408   hcosthetastarNCfromB->SetYTitle("Entries");
1409   TH1F *hptD0NCfromB=new TH1F("hptD0NCfromB","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1410   hptD0NCfromB->SetXTitle("p_{t}  [GeV/c]");
1411   hptD0NCfromB->SetYTitle("Entries");
1412   TH1F *hptD0VsMaxPtNCfromB=new TH1F("hptD0VsMaxPtNCfromB","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1413   TH2F *hptD0PTallsqrtNCfromB=new TH2F("hptD0PTallsqrtNCfromB","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1414   TH2F *hptD0PTallNCfromB=new TH2F("hptD0PTallNCfromB","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1415   TH2F *hptD0vsptBNCfromB=new TH2F("hptD0vsptBNCfromB","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1416   TH2F *hpD0vspBNCfromB=new TH2F("hpD0vspBNCfromB","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1417   TH2F *hptD0vsptcquarkNCfromB=new TH2F("hptD0vsptcquarkNCfromB","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1418   TH2F *hpD0vspcquarkNCfromB=new TH2F("hpD0vspcquarkNCfromB","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1419   flistNoCutsFromB->Add(hdcaNCfromB);
1420   flistNoCutsFromB->Add(hcosthetastarNCfromB);
1421   flistNoCutsFromB->Add(hptD0NCfromB);
1422   flistNoCutsFromB->Add(hptD0VsMaxPtNCfromB);
1423   flistNoCutsFromB->Add(hptD0PTallsqrtNCfromB);
1424   flistNoCutsFromB->Add(hptD0PTallNCfromB);
1425   flistNoCutsFromB->Add(hptD0vsptBNCfromB);
1426   flistNoCutsFromB->Add(hpD0vspBNCfromB);
1427   flistNoCutsFromB->Add(hptD0vsptcquarkNCfromB);
1428   flistNoCutsFromB->Add(hpD0vspcquarkNCfromB);
1429  
1430   TH1F *hd0zD0ptNCfromB;
1431   TH1F *hInvMassD0NCfromB,*hInvMassD0barNCfromB;
1432   TH2F *hInvMassPtNCfromB=new TH2F("hInvMassPtNCfromB","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1433   THnSparseF *hSparseNCfromB=new THnSparseF("hSparseNCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1434   hSparseNCfromB->SetBinEdges(0,massbins);
1435   hSparseNCfromB->SetBinEdges(1,massbins);
1436   hSparseNCfromB->SetBinEdges(2,ptbinsForNsparse);
1437   hSparseNCfromB->SetBinEdges(3,impparbins);
1438   hSparseNCfromB->SetBinEdges(4,massHypoBins); 
1439   flistNoCutsFromB->Add(hSparseNCfromB);
1440
1441
1442
1443   THnSparseF *hSparseRecoNCfromB=new THnSparseF("hSparseRecoNCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1444   hSparseRecoNCfromB->SetBinEdges(0,massbins);
1445   hSparseRecoNCfromB->SetBinEdges(1,massbins);
1446   hSparseRecoNCfromB->SetBinEdges(2,ptbinsForNsparse);
1447   hSparseRecoNCfromB->SetBinEdges(3,impparbins);
1448   hSparseRecoNCfromB->SetBinEdges(4,massHypoBins); 
1449   flistNoCutsFromB->Add(hSparseRecoNCfromB);
1450
1451
1452   TH1F *hetaNCfromB;
1453   TH1F *hCosPDPBNCfromB;
1454   TH1F *hCosPcPDNCfromB;
1455
1456    // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1457   TH2F *hd0D0VSd0xd0NCfromBpt;
1458   TH2F *hangletracksVSd0xd0NCfromBpt;
1459   TH2F *hangletracksVSd0D0NCfromBpt;
1460   TH1F *hd0xd0NCfromBpt;
1461   flistNoCutsFromB->Add(hInvMassPtNCfromB);
1462
1463   TH2F *hTOFpidNCfromB=new TH2F("hTOFpidNCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1464   flistNoCutsFromB->Add(hTOFpidNCfromB);
1465
1466   for(Int_t i=0;i<fnbins;i++){
1467     namehist="hd0zD0ptNCfromB_pt";
1468     namehist+=i;
1469     titlehist="d0(z) No Cuts FromB ptbin=";
1470     titlehist+=i;
1471     hd0zD0ptNCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1472     hd0zD0ptNCfromB->SetXTitle("d_{0}(z)    [#mum]");
1473     hd0zD0ptNCfromB->SetYTitle("Entries");
1474     flistNoCutsFromB->Add(hd0zD0ptNCfromB);
1475
1476     namehist="hInvMassD0NCfromB_pt";
1477     namehist+=i;
1478     titlehist="Invariant Mass No Cuts FromB ptbin=";
1479     titlehist+=i;
1480     hInvMassD0NCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1481     hInvMassD0NCfromB->SetXTitle("Invariant Mass    [GeV]");
1482     hInvMassD0NCfromB->SetYTitle("Entries");
1483     flistNoCutsFromB->Add(hInvMassD0NCfromB);
1484
1485
1486     namehist="hInvMassD0barNCfromB_pt";
1487     namehist+=i;
1488     titlehist="Invariant Mass D0bar No Cuts FromB ptbin=";
1489     titlehist+=i;
1490     hInvMassD0barNCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1491     hInvMassD0barNCfromB->SetXTitle("Invariant Mass    [GeV]");
1492     hInvMassD0barNCfromB->SetYTitle("Entries");
1493     flistNoCutsFromB->Add(hInvMassD0barNCfromB);
1494
1495
1496
1497     namehist="hetaNCfromB_pt";
1498     namehist+=i;
1499     titlehist="eta No Cuts FromB ptbin=";
1500     titlehist+=i;
1501     hetaNCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1502     hetaNCfromB->SetXTitle("Pseudorapidity");
1503     hetaNCfromB->SetYTitle("Entries");
1504     flistNoCutsFromB->Add(hetaNCfromB);
1505
1506     namehist="hCosPDPBNCfromB_pt";
1507     namehist+=i;
1508     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1509     titlehist+=i;
1510     hCosPDPBNCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1511     hCosPDPBNCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
1512     hCosPDPBNCfromB->SetYTitle("Entries");
1513     flistNoCutsFromB->Add(hCosPDPBNCfromB);
1514
1515     namehist="hCosPcPDNCfromB_pt";
1516     namehist+=i;
1517     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1518     titlehist+=i;
1519     hCosPcPDNCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1520     hCosPcPDNCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
1521     hCosPcPDNCfromB->SetYTitle("Entries");
1522     flistNoCutsFromB->Add(hCosPcPDNCfromB);
1523
1524 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1525     namehist="hd0xd0NCfromB_pt";
1526     namehist+=i;
1527     titlehist="d0xd0 No Cuts FromB ptbin=";
1528     titlehist+=i;
1529     hd0xd0NCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1530     hd0xd0NCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
1531     hd0xd0NCfromBpt->SetYTitle("Entries");
1532     flistNoCutsFromB->Add(hd0xd0NCfromBpt);
1533
1534
1535     namehist="hd0D0VSd0xd0NCfromB_pt";
1536     namehist+=i;
1537     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromB ptbin=";
1538     titlehist+=i;
1539     hd0D0VSd0xd0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1540     hd0D0VSd0xd0NCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1541     hd0D0VSd0xd0NCfromBpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
1542     flistNoCutsFromB->Add(hd0D0VSd0xd0NCfromBpt);
1543     
1544     
1545     namehist="hangletracksVSd0xd0NCfromB_pt";
1546     namehist+=i;
1547     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromB ptbin=";
1548     titlehist+=i;
1549     hangletracksVSd0xd0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1550     hangletracksVSd0xd0NCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1551     hangletracksVSd0xd0NCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
1552     flistNoCutsFromB->Add(hangletracksVSd0xd0NCfromBpt);
1553     
1554
1555     namehist="hangletracksVSd0D0NCfromB_pt";
1556     namehist+=i;
1557     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts FromB ptbin=";
1558     titlehist+=i;
1559     hangletracksVSd0D0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1560     hangletracksVSd0D0NCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1561     hangletracksVSd0D0NCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
1562     flistNoCutsFromB->Add(hangletracksVSd0D0NCfromBpt);
1563
1564     
1565   }
1566   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1567   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1568
1569
1570
1571   // ######### d0 D0 histos ##############
1572   TH1F *hd0D0NCfromBPM = new TH1F("hd0D0NCfromBPM","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1573   hd0D0NCfromBPM->SetXTitle("Impact parameter [#mum]");
1574   hd0D0NCfromBPM->SetYTitle("Entries");
1575
1576   TH1F *hd0D0VtxTrueNCfromBPM = new TH1F("hd0D0VtxTrueNCfromBPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1577   hd0D0VtxTrueNCfromBPM->SetXTitle("Impact parameter [#mum]");
1578   hd0D0VtxTrueNCfromBPM->SetYTitle("Entries");
1579
1580   TH1F *hMCd0D0NCfromBPM = new TH1F("hMCd0D0NCfromBPM","D^{0} impact par. plot, No Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
1581   hMCd0D0NCfromBPM->SetXTitle("MC Impact parameter [#mum]");
1582   hMCd0D0NCfromBPM->SetYTitle("Entries");
1583
1584   TH1F *hd0D0NCfromBSB = new TH1F("hd0D0NCfromBSB","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1585   hd0D0NCfromBSB->SetXTitle("Impact parameter [#mum]");
1586   hd0D0NCfromBSB->SetYTitle("Entries");
1587
1588   TH1F *hd0D0VtxTrueNCfromBSB = new TH1F("hd0D0VtxTrueNCfromBSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1589   hd0D0VtxTrueNCfromBSB->SetXTitle("Impact parameter [#mum]");
1590   hd0D0VtxTrueNCfromBSB->SetYTitle("Entries");
1591
1592   TH1F *hMCd0D0NCfromBSB = new TH1F("hMCd0D0NCfromBSB","D^{0} impact par. plot, No Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
1593   hMCd0D0NCfromBSB->SetXTitle("MC Impact parameter [#mum]");
1594   hMCd0D0NCfromBSB->SetYTitle("Entries");
1595
1596   flistNoCutsFromB->Add(hd0D0NCfromBPM);
1597   flistNoCutsFromB->Add(hd0D0VtxTrueNCfromBPM);
1598   flistNoCutsFromB->Add(hMCd0D0NCfromBPM);
1599   flistNoCutsFromB->Add(hd0D0NCfromBSB);
1600   flistNoCutsFromB->Add(hd0D0VtxTrueNCfromBSB);
1601   flistNoCutsFromB->Add(hMCd0D0NCfromBSB);
1602   
1603   TH1F *hd0D0ptNCfromBPM;
1604   TH1F *hMCd0D0ptNCfromBPM;
1605   TH1F *hd0D0VtxTrueptNCfromBPM;
1606   TH1F *hd0D0ptNCfromBSB;
1607   TH1F *hMCd0D0ptNCfromBSB;
1608   TH1F *hd0D0VtxTrueptNCfromBSB;
1609   namehist="hd0D0ptNCfromB_";
1610   titlehist="D^{0} impact par. plot, No Cuts, FromB, ";
1611   for(Int_t i=0;i<fnbins;i++){
1612     strnamept=namehist;
1613     strnamept.Append("PkMss_pt");
1614     strnamept+=i;
1615
1616     strtitlept=titlehist;
1617     strtitlept.Append(" Mass Peak, ");
1618     strtitlept+=fptbins[i];
1619     strtitlept.Append("<= pt <");
1620     strtitlept+=fptbins[i+1];
1621     strtitlept.Append(" [GeV/c]");
1622     
1623     hd0D0ptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1624     hd0D0ptNCfromBPM->SetXTitle("Impact parameter [#mum] ");
1625     hd0D0ptNCfromBPM->SetYTitle("Entries");
1626     flistNoCutsFromB->Add(hd0D0ptNCfromBPM);
1627
1628     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1629     hMCd0D0ptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1630     hMCd0D0ptNCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
1631     hMCd0D0ptNCfromBPM->SetYTitle("Entries");
1632     flistNoCutsFromB->Add(hMCd0D0ptNCfromBPM);
1633  
1634
1635     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1636     hd0D0VtxTrueptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1637     hd0D0VtxTrueptNCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1638     hd0D0VtxTrueptNCfromBPM->SetYTitle("Entries");
1639     flistNoCutsFromB->Add(hd0D0VtxTrueptNCfromBPM);
1640     
1641     strnamept=namehist;
1642     strnamept.Append("SBMss_pt");
1643     strnamept+=i;
1644
1645     strtitlept=titlehist;
1646     strtitlept.Append(" Side Bands, ");
1647     strtitlept+=fptbins[i];
1648     strtitlept.Append("<= pt <");
1649     strtitlept+=fptbins[i+1];
1650     strtitlept.Append(" [GeV/c]");
1651     
1652     hd0D0ptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1653     hd0D0ptNCfromBSB->SetXTitle("Impact parameter [#mum] ");
1654     hd0D0ptNCfromBSB->SetYTitle("Entries");
1655     flistNoCutsFromB->Add(hd0D0ptNCfromBSB);
1656
1657     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1658     hMCd0D0ptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1659     hMCd0D0ptNCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
1660     hMCd0D0ptNCfromBSB->SetYTitle("Entries");
1661     flistNoCutsFromB->Add(hMCd0D0ptNCfromBSB);
1662
1663     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1664     hd0D0VtxTrueptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1665     hd0D0VtxTrueptNCfromBSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1666     hd0D0VtxTrueptNCfromBSB->SetYTitle("Entries");
1667     flistNoCutsFromB->Add(hd0D0VtxTrueptNCfromBSB);
1668   }
1669
1670
1671
1672   //############ NO CUTS FROM DSTAR HISTOGRAMS ###########
1673   //
1674   //#############  global properties histos #######
1675
1676   TH2F *hCPtaVSd0d0NCfromDstar=new TH2F("hCPtaVSd0d0NCfromDstar","hCPtaVSd0d0_NoCuts_FromDStar",1000,-100000.,100000.,100,-1.,1.);
1677   TH1F *hSecVtxZNCfromDstar=new TH1F("hSecVtxZNCfromDstar","hSecVtxZ_NoCuts_FromDStar",1000,-8.,8.);
1678   TH1F *hSecVtxXNCfromDstar=new TH1F("hSecVtxXNCfromDstar","hSecVtxX_NoCuts_FromDStar",1000,-3000.,3000.);
1679   TH1F *hSecVtxYNCfromDstar=new TH1F("hSecVtxYNCfromDstar","hSecVtxY_NoCuts_FromDStar",1000,-3000.,3000.);
1680   TH2F *hSecVtxXYNCfromDstar=new TH2F("hSecVtxXYNCfromDstar","hSecVtxXY_NoCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
1681   TH1F *hSecVtxPhiNCfromDstar=new TH1F("hSecVtxPhiNCfromDstar","hSecVtxPhi_NoCuts_FromDStar",180,-180.1,180.1);
1682   TH1F *hd0singlTrackNCfromDstar=new TH1F("hd0singlTrackNCfromDstar","hd0singlTrackNoCuts_fromDstar",1000,-5000.,5000.);
1683   TH1F *hCPtaNCfromDstar=new TH1F("hCPtaNCfromDstar","hCPta_NoCuts_FromDStar",100,-1.,1.);
1684   TH1F *hd0xd0NCfromDstar=new TH1F("hd0xd0NCfromDstar","hd0xd0_NoCuts_FromDStar",1000,-100000.,100000.);
1685   TH1F *hMassTrueNCfromDstar=new TH1F("hMassTrueNCfromDstar","D^{0} MC inv. Mass No Cuts FromDStar(All momenta)",600,1.600,2.200);
1686   TH1F *hMassNCfromDstar=new TH1F("hMassNCfromDstar","D^{0} inv. Mass No Cuts FromDStar (All momenta)",600,1.600,2.200);
1687   hMassNCfromDstar->Sumw2();
1688   TH1F *hMassTrueNCfromDstarPM=new TH1F("hMassTrueNCfromDstarPM","D^{0} MC inv. Mass No Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
1689   TH1F *hMassNCfromDstarPM=new TH1F("hMassNCfromDstarPM","D^{0} inv. Mass No Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
1690   hMassNCfromDstarPM->Sumw2();
1691   TH1F *hMassTrueNCfromDstarSB=new TH1F("hMassTrueNCfromDstarSB","D^{0} MC inv. Mass in Side Bands No Cuts FromDStar(All momenta)",600,1.600,2.200);
1692   TH1F *hMassNCfromDstarSB=new TH1F("hMassNCfromDstarSB","D^{0} inv. Mass in Side Bands No Cuts FromDStar (All momenta)",600,1.600,2.200);
1693   hMassNCfromDstarSB->Sumw2();
1694
1695   flistNoCutsFromDstar->Add(hCPtaVSd0d0NCfromDstar);
1696   flistNoCutsFromDstar->Add(hSecVtxZNCfromDstar);
1697   flistNoCutsFromDstar->Add(hSecVtxYNCfromDstar);
1698   flistNoCutsFromDstar->Add(hSecVtxXNCfromDstar);
1699   flistNoCutsFromDstar->Add(hSecVtxXYNCfromDstar);
1700   flistNoCutsFromDstar->Add(hSecVtxPhiNCfromDstar);
1701   flistNoCutsFromDstar->Add(hd0singlTrackNCfromDstar);
1702   flistNoCutsFromDstar->Add(hCPtaNCfromDstar);
1703   flistNoCutsFromDstar->Add(hd0xd0NCfromDstar);
1704   flistNoCutsFromDstar->Add(hMassTrueNCfromDstar);
1705   flistNoCutsFromDstar->Add(hMassNCfromDstar);
1706   flistNoCutsFromDstar->Add(hMassTrueNCfromDstarPM);
1707   flistNoCutsFromDstar->Add(hMassNCfromDstarPM);
1708   flistNoCutsFromDstar->Add(hMassTrueNCfromDstarSB);
1709   flistNoCutsFromDstar->Add(hMassNCfromDstarSB);
1710
1711
1712
1713
1714 //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1715   TH1F *hdcaNCfromDstar=new TH1F("hdcaNCfromDstar","hdca_NoCuts_FromDstar",100,0.,1000.);
1716   hdcaNCfromDstar->SetXTitle("dca   [#mum]");
1717   hdcaNCfromDstar->SetYTitle("Entries");
1718   TH1F *hcosthetastarNCfromDstar=new TH1F("hcosthetastarNCfromDstar","hCosThetaStar_NoCuts_FromDstar",50,-1.,1.);
1719   hcosthetastarNCfromDstar->SetXTitle("cos #theta^{*}");
1720   hcosthetastarNCfromDstar->SetYTitle("Entries");
1721   TH1F *hptD0NCfromDstar=new TH1F("hptD0NCfromDstar","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1722   hptD0NCfromDstar->SetXTitle("p_{t}  [GeV/c]");
1723   hptD0NCfromDstar->SetYTitle("Entries");
1724   TH1F *hptD0VsMaxPtNCfromDstar=new TH1F("hptD0VsMaxPtNCfromDstar","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1725   TH2F *hptD0PTallsqrtNCfromDstar=new TH2F("hptD0PTallsqrtNCfromDstar","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1726   TH2F *hptD0PTallNCfromDstar=new TH2F("hptD0PTallNCfromDstar","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1727   TH2F *hptD0vsptBNCfromDstar=new TH2F("hptD0vsptBNCfromDstar","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1728   TH2F *hpD0vspBNCfromDstar=new TH2F("hpD0vspBNCfromDstar","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1729   TH2F *hptD0vsptcquarkNCfromDstar=new TH2F("hptD0vsptcquarkNCfromDstar","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1730   TH2F *hpD0vspcquarkNCfromDstar=new TH2F("hpD0vspcquarkNCfromDstar","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1731   flistNoCutsFromDstar->Add(hdcaNCfromDstar);
1732   flistNoCutsFromDstar->Add(hcosthetastarNCfromDstar);
1733   flistNoCutsFromDstar->Add(hptD0NCfromDstar);
1734   flistNoCutsFromDstar->Add(hptD0VsMaxPtNCfromDstar);
1735   flistNoCutsFromDstar->Add(hptD0PTallsqrtNCfromDstar);
1736   flistNoCutsFromDstar->Add(hptD0PTallNCfromDstar);
1737   flistNoCutsFromDstar->Add(hptD0vsptBNCfromDstar);
1738   flistNoCutsFromDstar->Add(hpD0vspBNCfromDstar);
1739   flistNoCutsFromDstar->Add(hptD0vsptcquarkNCfromDstar);
1740   flistNoCutsFromDstar->Add(hpD0vspcquarkNCfromDstar);
1741  
1742   TH1F *hd0zD0ptNCfromDstar;
1743   TH1F *hInvMassD0NCfromDstar,*hInvMassD0barNCfromDstar;
1744   TH2F *hInvMassPtNCfromDstar=new TH2F("hInvMassPtNCfromDstar","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1745  THnSparseF *hSparseNCfromDstar=new THnSparseF("hSparseNCfromDstar","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1746   hSparseNCfromDstar->SetBinEdges(0,massbins);
1747   hSparseNCfromDstar->SetBinEdges(1,massbins);
1748   hSparseNCfromDstar->SetBinEdges(2,ptbinsForNsparse);
1749   hSparseNCfromDstar->SetBinEdges(3,impparbins);
1750   hSparseNCfromDstar->SetBinEdges(4,massHypoBins); 
1751   flistNoCutsFromDstar->Add(hSparseNCfromDstar);
1752   TH1F *hetaNCfromDstar;
1753   TH1F *hCosPDPBNCfromDstar;
1754   TH1F *hCosPcPDNCfromDstar;
1755   flistNoCutsFromDstar->Add(hInvMassPtNCfromDstar);
1756   // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1757   TH2F *hd0D0VSd0xd0NCfromDstarpt;
1758   TH2F *hangletracksVSd0xd0NCfromDstarpt;
1759   TH2F *hangletracksVSd0D0NCfromDstarpt;
1760   TH1F *hd0xd0NCfromDstarpt;
1761
1762   TH2F *hTOFpidNCfromDstar=new TH2F("hTOFpidNCfromDstar","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1763   flistNoCutsFromDstar->Add(hTOFpidNCfromDstar);
1764
1765   for(Int_t i=0;i<fnbins;i++){
1766     namehist="hd0zD0ptNCfromDstar_pt";
1767     namehist+=i;
1768     titlehist="d0(z) No Cuts FromDstarm ptbin=";
1769     titlehist+=i;
1770     hd0zD0ptNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1771     hd0zD0ptNCfromDstar->SetXTitle("d_{0}(z)    [#mum]");
1772     hd0zD0ptNCfromDstar->SetYTitle("Entries");
1773     flistNoCutsFromDstar->Add(hd0zD0ptNCfromDstar);
1774
1775     namehist="hInvMassD0NCfromDstar_pt";
1776     namehist+=i;
1777     titlehist="Invariant Mass No Cuts FromDstar ptbin=";
1778     titlehist+=i;
1779     hInvMassD0NCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1780     hInvMassD0NCfromDstar->SetXTitle("Invariant Mass    [GeV]");
1781     hInvMassD0NCfromDstar->SetYTitle("Entries");
1782     flistNoCutsFromDstar->Add(hInvMassD0NCfromDstar);
1783
1784
1785    namehist="hInvMassD0barNCfromDstar_pt";
1786     namehist+=i;
1787     titlehist="Invariant Mass D0bar No Cuts FromDstar ptbin=";
1788     titlehist+=i;
1789     hInvMassD0barNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1790     hInvMassD0barNCfromDstar->SetXTitle("Invariant Mass    [GeV]");
1791     hInvMassD0barNCfromDstar->SetYTitle("Entries");
1792     flistNoCutsFromDstar->Add(hInvMassD0barNCfromDstar);
1793
1794
1795
1796     namehist="hetaNCfromDstar_pt";
1797     namehist+=i;
1798     titlehist="eta No Cuts FromDstar ptbin=";
1799     titlehist+=i;
1800     hetaNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1801     hetaNCfromDstar->SetXTitle("Pseudorapidity");
1802     hetaNCfromDstar->SetYTitle("Entries");
1803     flistNoCutsFromDstar->Add(hetaNCfromDstar);
1804
1805     namehist="hCosPDPBNCfromDstar_pt";
1806     namehist+=i;
1807     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1808     titlehist+=i;
1809     hCosPDPBNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1810     hCosPDPBNCfromDstar->SetXTitle("Cosine between D0 momentum and B momentum");
1811     hCosPDPBNCfromDstar->SetYTitle("Entries");
1812     flistNoCutsFromDstar->Add(hCosPDPBNCfromDstar);
1813
1814     namehist="hCosPcPDNCfromDstar_pt";
1815     namehist+=i;
1816     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1817     titlehist+=i;
1818     hCosPcPDNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1819     hCosPcPDNCfromDstar->SetXTitle("Cosine between c quark momentum and D0 momentum");
1820     hCosPcPDNCfromDstar->SetYTitle("Entries");
1821     flistNoCutsFromDstar->Add(hCosPcPDNCfromDstar);
1822   
1823  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1824     namehist="hd0xd0NCfromDstar_pt";
1825     namehist+=i;
1826     titlehist="d0xd0 No Cuts FromDstar ptbin=";
1827     titlehist+=i;
1828     hd0xd0NCfromDstarpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1829     hd0xd0NCfromDstarpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
1830     hd0xd0NCfromDstarpt->SetYTitle("Entries");
1831     flistNoCutsFromDstar->Add(hd0xd0NCfromDstarpt);
1832
1833
1834     namehist="hd0D0VSd0xd0NCfromDstar_pt";
1835     namehist+=i;
1836     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromDstar ptbin=";
1837     titlehist+=i;
1838     hd0D0VSd0xd0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1839     hd0D0VSd0xd0NCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1840     hd0D0VSd0xd0NCfromDstarpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
1841     flistNoCutsFromDstar->Add(hd0D0VSd0xd0NCfromDstarpt);
1842     
1843     
1844     namehist="hangletracksVSd0xd0NCfromDstar_pt";
1845     namehist+=i;
1846     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromDstar ptbin=";
1847     titlehist+=i;
1848     hangletracksVSd0xd0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1849     hangletracksVSd0xd0NCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1850     hangletracksVSd0xd0NCfromDstarpt->SetYTitle(" angle between K and #p tracks  [rad]");
1851     flistNoCutsFromDstar->Add(hangletracksVSd0xd0NCfromDstarpt);
1852     
1853
1854     namehist="hangletracksVSd0D0NCfromDstar_pt";
1855     namehist+=i;
1856     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts FromDstar ptbin=";
1857     titlehist+=i;
1858     hangletracksVSd0D0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1859     hangletracksVSd0D0NCfromDstarpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1860     hangletracksVSd0D0NCfromDstarpt->SetYTitle(" angle between K and #p tracks  [rad]");
1861     flistNoCutsFromDstar->Add(hangletracksVSd0D0NCfromDstarpt);
1862   
1863   }
1864   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1865   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1866
1867
1868   //########## d0 D0 histos #############  
1869   TH1F *hd0D0NCfromDstPM = new TH1F("hd0D0NCfromDstarPM","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1870   hd0D0NCfromDstPM->SetXTitle("Impact parameter [#mum]");
1871   hd0D0NCfromDstPM->SetYTitle("Entries");
1872
1873   TH1F *hd0D0VtxTrueNCfromDstPM = new TH1F("hd0D0VtxTrueNCfromDstarPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1874   hd0D0VtxTrueNCfromDstPM->SetXTitle("Impact parameter [#mum]");
1875   hd0D0VtxTrueNCfromDstPM->SetYTitle("Entries");
1876
1877   TH1F *hMCd0D0NCfromDstPM = new TH1F("hMCd0D0NCfromDstarPM","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
1878   hMCd0D0NCfromDstPM->SetXTitle("MC Impact parameter [#mum]");
1879   hMCd0D0NCfromDstPM->SetYTitle("Entries");
1880
1881   TH1F *hd0D0NCfromDstSB = new TH1F("hd0D0NCfromDstarSB","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1882   hd0D0NCfromDstSB->SetXTitle("Impact parameter [#mum]");
1883   hd0D0NCfromDstSB->SetYTitle("Entries");
1884
1885   TH1F *hd0D0VtxTrueNCfromDstSB = new TH1F("hd0D0VtxTrueNCfromDstarSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1886   hd0D0VtxTrueNCfromDstSB->SetXTitle("Impact parameter [#mum]");
1887   hd0D0VtxTrueNCfromDstSB->SetYTitle("Entries");
1888
1889   TH1F *hMCd0D0NCfromDstSB = new TH1F("hMCd0D0NCfromDstarSB","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
1890   hMCd0D0NCfromDstSB->SetXTitle("MC Impact parameter [#mum]");
1891   hMCd0D0NCfromDstSB->SetYTitle("Entries");
1892
1893   flistNoCutsFromDstar->Add(hd0D0NCfromDstPM);
1894   flistNoCutsFromDstar->Add(hd0D0VtxTrueNCfromDstPM);
1895   flistNoCutsFromDstar->Add(hMCd0D0NCfromDstPM);
1896   flistNoCutsFromDstar->Add(hd0D0NCfromDstSB);
1897   flistNoCutsFromDstar->Add(hd0D0VtxTrueNCfromDstSB);
1898   flistNoCutsFromDstar->Add(hMCd0D0NCfromDstSB);
1899   
1900   TH1F *hd0D0ptNCfromDstPM;
1901   TH1F *hMCd0D0ptNCfromDstPM;
1902   TH1F *hd0D0VtxTrueptNCfromDstPM;
1903   TH1F *hd0D0ptNCfromDstSB;
1904   TH1F *hMCd0D0ptNCfromDstSB;
1905   TH1F *hd0D0VtxTrueptNCfromDstSB;
1906   namehist="hd0D0ptNCfromDstar_";
1907   titlehist="D^{0} impact par. plot, No Cuts, FromDStar, ";
1908   for(Int_t i=0;i<fnbins;i++){
1909     strnamept=namehist;
1910     strnamept.Append("PkMss_pt");
1911     strnamept+=i;
1912
1913     strtitlept=titlehist;
1914     strtitlept.Append(" Mass Peak, ");
1915     strtitlept+=fptbins[i];
1916     strtitlept.Append("<= pt <");
1917     strtitlept+=fptbins[i+1];
1918     strtitlept.Append(" [GeV/c]");
1919     
1920     hd0D0ptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1921     hd0D0ptNCfromDstPM->SetXTitle("Impact parameter [#mum] ");
1922     hd0D0ptNCfromDstPM->SetYTitle("Entries");
1923     flistNoCutsFromDstar->Add(hd0D0ptNCfromDstPM);
1924
1925     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1926     hMCd0D0ptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1927     hMCd0D0ptNCfromDstPM->SetXTitle("MC Impact parameter [#mum] ");
1928     hMCd0D0ptNCfromDstPM->SetYTitle("Entries");
1929     flistNoCutsFromDstar->Add(hMCd0D0ptNCfromDstPM);
1930  
1931
1932     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1933     hd0D0VtxTrueptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1934     hd0D0VtxTrueptNCfromDstPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1935     hd0D0VtxTrueptNCfromDstPM->SetYTitle("Entries");
1936     flistNoCutsFromDstar->Add(hd0D0VtxTrueptNCfromDstPM);
1937     
1938     strnamept=namehist;
1939     strnamept.Append("SBMss_pt");
1940     strnamept+=i;
1941
1942     strtitlept=titlehist;
1943     strtitlept.Append(" Side Bands, ");
1944     strtitlept+=fptbins[i];
1945     strtitlept.Append("<= pt <");
1946     strtitlept+=fptbins[i+1];
1947     strtitlept.Append(" [GeV/c]");
1948     
1949     hd0D0ptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1950     hd0D0ptNCfromDstSB->SetXTitle("Impact parameter [#mum] ");
1951     hd0D0ptNCfromDstSB->SetYTitle("Entries");
1952     flistNoCutsFromDstar->Add(hd0D0ptNCfromDstSB);
1953
1954     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1955     hMCd0D0ptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1956     hMCd0D0ptNCfromDstSB->SetXTitle("MC Impact parameter [#mum] ");
1957     hMCd0D0ptNCfromDstSB->SetYTitle("Entries");
1958     flistNoCutsFromDstar->Add(hMCd0D0ptNCfromDstSB);
1959
1960     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1961     hd0D0VtxTrueptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1962     hd0D0VtxTrueptNCfromDstSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1963     hd0D0VtxTrueptNCfromDstSB->SetYTitle("Entries");
1964     flistNoCutsFromDstar->Add(hd0D0VtxTrueptNCfromDstSB);
1965   }
1966
1967
1968   //############ NO CUTS OTHER HISTOGRAMS ###########
1969   //
1970   //########### global properties histos ###########
1971
1972   TH2F *hCPtaVSd0d0NCother=new TH2F("hCPtaVSd0d0NCother","hCPtaVSd0d0_NoCuts_other",1000,-100000.,100000.,100,-1.,1.);
1973   TH1F *hSecVtxZNCother=new TH1F("hSecVtxZNCother","hSecVtxZ_NoCuts_other",1000,-8.,8.);
1974   TH1F *hSecVtxXNCother=new TH1F("hSecVtxXNCother","hSecVtxX_NoCuts_other",1000,-3000.,3000.);
1975   TH1F *hSecVtxYNCother=new TH1F("hSecVtxYNCother","hSecVtxY_NoCuts_other",1000,-3000.,3000.);
1976   TH2F *hSecVtxXYNCother=new TH2F("hSecVtxXYNCother","hSecVtxXY_NoCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
1977   TH1F *hSecVtxPhiNCother=new TH1F("hSecVtxPhiNCother","hSecVtxPhi_NoCuts_other",180,-180.1,180.1);
1978   TH1F *hd0singlTrackNCother=new TH1F("hd0singlTrackNCother","hd0singlTrackNoCuts_Other",1000,-5000.,5000.);
1979   TH1F *hCPtaNCother=new TH1F("hCPtaNCother","hCPta_NoCuts_other",100,-1.,1.);
1980   TH1F *hd0xd0NCother=new TH1F("hd0xd0NCother","hd0xd0_NoCuts_other",1000,-100000.,100000.);
1981   TH1F *hMassTrueNCother=new TH1F("hMassTrueNCother","D^{0} MC inv. Mass No Cuts other(All momenta)",600,1.600,2.200);
1982   TH1F *hMassNCother=new TH1F("hMassNCother","D^{0} inv. Mass No Cuts other (All momenta)",600,1.600,2.200);
1983   hMassNCother->Sumw2();
1984   TH1F *hMassTrueNCotherPM=new TH1F("hMassTrueNCotherPM","D^{0} MC inv. Mass No Cuts Other, Mass Peak. (All momenta)",600,1.600,2.200);
1985   TH1F *hMassNCotherPM=new TH1F("hMassNCotherPM","D^{0} inv. Mass No Cuts Other (All momenta), MassPeak",600,1.600,2.200);
1986   hMassNCotherPM->Sumw2();
1987   TH1F *hMassTrueNCotherSB=new TH1F("hMassTrueNCotherSB","D^{0} MC inv. Mass in Side Bands No Cuts other(All momenta)",600,1.600,2.200);
1988   TH1F *hMassNCotherSB=new TH1F("hMassNCotherSB","D^{0} inv. Mass in Side Bands No Cuts other (All momenta)",600,1.600,2.200);
1989   hMassNCotherSB->Sumw2();
1990
1991   flistNoCutsOther->Add(hCPtaVSd0d0NCother);
1992   flistNoCutsOther->Add(hSecVtxZNCother);
1993   flistNoCutsOther->Add(hSecVtxYNCother);
1994   flistNoCutsOther->Add(hSecVtxXNCother);
1995   flistNoCutsOther->Add(hSecVtxXYNCother);
1996   flistNoCutsOther->Add(hSecVtxPhiNCother);
1997   flistNoCutsOther->Add(hd0singlTrackNCother);
1998   flistNoCutsOther->Add(hCPtaNCother);
1999   flistNoCutsOther->Add(hd0xd0NCother);
2000   flistNoCutsOther->Add(hMassTrueNCother);
2001   flistNoCutsOther->Add(hMassNCother);
2002   flistNoCutsOther->Add(hMassTrueNCotherPM);
2003   flistNoCutsOther->Add(hMassNCotherPM);
2004   flistNoCutsOther->Add(hMassTrueNCotherSB);
2005   flistNoCutsOther->Add(hMassNCotherSB);
2006
2007
2008
2009  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2010   TH1F *hdcaNCother=new TH1F("hdcaNCother","hdca_NoCuts_Other",100,0.,1000.);
2011   hdcaNCother->SetXTitle("dca   [#mum]");
2012   hdcaNCother->SetYTitle("Entries");
2013   TH1F *hcosthetastarNCother=new TH1F("hcosthetastarNCother","hCosThetaStar_NoCuts_Other",50,-1.,1.);
2014   hcosthetastarNCother->SetXTitle("cos #theta^{*}");
2015   hcosthetastarNCother->SetYTitle("Entries");
2016   TH1F *hptD0NCother=new TH1F("hptD0NCother","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2017   hptD0NCother->SetXTitle("p_{t}  [GeV/c]");
2018   hptD0NCother->SetYTitle("Entries");
2019   TH1F *hptD0VsMaxPtNCother=new TH1F("hptD0VsMaxPtNCother","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2020   TH2F *hptD0PTallsqrtNCother=new TH2F("hptD0PTallsqrtNCother","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2021   TH2F *hptD0PTallNCother=new TH2F("hptD0PTallNCother","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2022   TH2F *hptD0vsptBNCother=new TH2F("hptD0vsptBNCother","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2023   TH2F *hpD0vspBNCother=new TH2F("hpD0vspBNCother","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2024   TH2F *hptD0vsptcquarkNCother=new TH2F("hptD0vsptcquarkNCother","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2025   TH2F *hpD0vspcquarkNCother=new TH2F("hpD0vspcquarkNCother","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2026   flistNoCutsOther->Add(hdcaNCother);
2027   flistNoCutsOther->Add(hcosthetastarNCother);
2028   flistNoCutsOther->Add(hptD0NCother);
2029   flistNoCutsOther->Add(hptD0VsMaxPtNCother);
2030   flistNoCutsOther->Add(hptD0PTallsqrtNCother);
2031   flistNoCutsOther->Add(hptD0PTallNCother);
2032   flistNoCutsOther->Add(hptD0vsptBNCother);
2033   flistNoCutsOther->Add(hpD0vspBNCother);
2034   flistNoCutsOther->Add(hptD0vsptcquarkNCother);
2035   flistNoCutsOther->Add(hpD0vspcquarkNCother);
2036
2037   TH1F *hd0zD0ptNCother;
2038   TH1F *hInvMassD0NCother,*hInvMassD0barNCother;
2039   TH2F *hInvMassPtNCother=new TH2F("hInvMassPtNCother","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2040  THnSparseF *hSparseNCother=new THnSparseF("hSparseNCother","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2041   hSparseNCother->SetBinEdges(0,massbins);
2042   hSparseNCother->SetBinEdges(1,massbins);
2043   hSparseNCother->SetBinEdges(2,ptbinsForNsparse);
2044   hSparseNCother->SetBinEdges(3,impparbins);
2045   hSparseNCother->SetBinEdges(4,massHypoBins); 
2046   flistNoCutsOther->Add(hSparseNCother);
2047   TH1F *hetaNCother;
2048   TH1F *hCosPDPBNCother;
2049   TH1F *hCosPcPDNCother;
2050   flistNoCutsOther->Add(hInvMassPtNCother);
2051   // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2052   TH2F *hd0D0VSd0xd0NCotherpt;
2053   TH2F *hangletracksVSd0xd0NCotherpt;
2054   TH2F *hangletracksVSd0D0NCotherpt;
2055   TH1F *hd0xd0NCotherpt;
2056
2057   TH2F *hTOFpidNCother=new TH2F("hTOFpidNCother","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2058   flistNoCutsOther->Add(hTOFpidNCother);
2059
2060   for(Int_t i=0;i<fnbins;i++){
2061     namehist="hd0zD0ptNCother_pt";
2062     namehist+=i;
2063     titlehist="d0(z) No Cuts Otherm ptbin=";
2064     titlehist+=i;
2065     hd0zD0ptNCother=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2066     hd0zD0ptNCother->SetXTitle("d_{0}(z)    [#mum]");
2067     hd0zD0ptNCother->SetYTitle("Entries");
2068     flistNoCutsOther->Add(hd0zD0ptNCother);
2069
2070     namehist="hInvMassD0NCother_pt";
2071     namehist+=i;
2072     titlehist="Invariant Mass No Cuts Other ptbin=";
2073     titlehist+=i;
2074     hInvMassD0NCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2075     hInvMassD0NCother->SetXTitle("Invariant Mass    [GeV]");
2076     hInvMassD0NCother->SetYTitle("Entries");
2077     flistNoCutsOther->Add(hInvMassD0NCother);
2078
2079
2080    namehist="hInvMassD0barNCother_pt";
2081     namehist+=i;
2082     titlehist="Invariant Mass D0bar No Cuts Other ptbin=";
2083     titlehist+=i;
2084     hInvMassD0barNCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2085     hInvMassD0barNCother->SetXTitle("Invariant Mass    [GeV]");
2086     hInvMassD0barNCother->SetYTitle("Entries");
2087     flistNoCutsOther->Add(hInvMassD0barNCother);
2088
2089
2090     namehist="hetaNCother_pt";
2091     namehist+=i;
2092     titlehist="eta No Cuts Other ptbin=";
2093     titlehist+=i;
2094     hetaNCother=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2095     hetaNCother->SetXTitle("Pseudorapidity");
2096     hetaNCother->SetYTitle("Entries");
2097     flistNoCutsOther->Add(hetaNCother);
2098
2099     namehist="hCosPDPBNCother_pt";
2100     namehist+=i;
2101     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2102     titlehist+=i;
2103     hCosPDPBNCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2104     hCosPDPBNCother->SetXTitle("Cosine between D0 momentum and B momentum");
2105     hCosPDPBNCother->SetYTitle("Entries");
2106     flistNoCutsOther->Add(hCosPDPBNCother);
2107
2108     namehist="hCosPcPDNCother_pt";
2109     namehist+=i;
2110     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2111     titlehist+=i;
2112     hCosPcPDNCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2113     hCosPcPDNCother->SetXTitle("Cosine between c quark momentum and D0 momentum");
2114     hCosPcPDNCother->SetYTitle("Entries");
2115     flistNoCutsOther->Add(hCosPcPDNCother);
2116     
2117
2118  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2119     namehist="hd0xd0NCother_pt";
2120     namehist+=i;
2121     titlehist="d0xd0 No Cuts Other ptbin=";
2122     titlehist+=i;
2123     hd0xd0NCotherpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2124     hd0xd0NCotherpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
2125     hd0xd0NCotherpt->SetYTitle("Entries");
2126     flistNoCutsOther->Add(hd0xd0NCotherpt);
2127
2128
2129     namehist="hd0D0VSd0xd0NCother_pt";
2130     namehist+=i;
2131     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Other ptbin=";
2132     titlehist+=i;
2133     hd0D0VSd0xd0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2134     hd0D0VSd0xd0NCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2135     hd0D0VSd0xd0NCotherpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
2136     flistNoCutsOther->Add(hd0D0VSd0xd0NCotherpt);
2137     
2138     
2139     namehist="hangletracksVSd0xd0NCother_pt";
2140     namehist+=i;
2141     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Other ptbin=";
2142     titlehist+=i;
2143     hangletracksVSd0xd0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2144     hangletracksVSd0xd0NCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2145     hangletracksVSd0xd0NCotherpt->SetYTitle(" angle between K and #p tracks  [rad]");
2146     flistNoCutsOther->Add(hangletracksVSd0xd0NCotherpt);
2147     
2148
2149     namehist="hangletracksVSd0D0NCother_pt";
2150     namehist+=i;
2151     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Other ptbin=";
2152     titlehist+=i;
2153     hangletracksVSd0D0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2154     hangletracksVSd0D0NCotherpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2155     hangletracksVSd0D0NCotherpt->SetYTitle(" angle between K and #p tracks  [rad]");
2156     flistNoCutsOther->Add(hangletracksVSd0D0NCotherpt);
2157
2158   }
2159   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2160   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2161
2162
2163
2164
2165   //############# d0 D0 histos ###############à
2166   TH1F *hd0D0NCotherPM = new TH1F("hd0D0NCotherPM","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2167   hd0D0NCotherPM->SetXTitle("Impact parameter [#mum]");
2168   hd0D0NCotherPM->SetYTitle("Entries");
2169
2170   TH1F *hd0D0VtxTrueNCotherPM = new TH1F("hd0D0VtxTrueNCotherPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2171   hd0D0VtxTrueNCotherPM->SetXTitle("Impact parameter [#mum]");
2172   hd0D0VtxTrueNCotherPM->SetYTitle("Entries");
2173
2174   TH1F *hMCd0D0NCotherPM = new TH1F("hMCd0D0NCotherPM","D^{0} impact par. plot, No Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
2175   hMCd0D0NCotherPM->SetXTitle("MC Impact parameter [#mum]");
2176   hMCd0D0NCotherPM->SetYTitle("Entries");
2177
2178   TH1F *hd0D0NCotherSB = new TH1F("hd0D0NCotherSB","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2179   hd0D0NCotherSB->SetXTitle("Impact parameter [#mum]");
2180   hd0D0NCotherSB->SetYTitle("Entries");
2181
2182   TH1F *hd0D0VtxTrueNCotherSB = new TH1F("hd0D0VtxTrueNCotherSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2183   hd0D0VtxTrueNCotherSB->SetXTitle("Impact parameter [#mum]");
2184   hd0D0VtxTrueNCotherSB->SetYTitle("Entries");
2185
2186   TH1F *hMCd0D0NCotherSB = new TH1F("hMCd0D0NCotherSB","D^{0} impact par. plot, No Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
2187   hMCd0D0NCotherSB->SetXTitle("MC Impact parameter [#mum]");
2188   hMCd0D0NCotherSB->SetYTitle("Entries");
2189
2190   flistNoCutsOther->Add(hd0D0NCotherPM);
2191   flistNoCutsOther->Add(hd0D0VtxTrueNCotherPM);
2192   flistNoCutsOther->Add(hMCd0D0NCotherPM);
2193   flistNoCutsOther->Add(hd0D0NCotherSB);
2194   flistNoCutsOther->Add(hd0D0VtxTrueNCotherSB);
2195   flistNoCutsOther->Add(hMCd0D0NCotherSB);
2196   
2197   TH1F *hd0D0ptNCotherPM;
2198   TH1F *hMCd0D0ptNCotherPM;
2199   TH1F *hd0D0VtxTrueptNCotherPM;
2200   TH1F *hd0D0ptNCotherSB;
2201   TH1F *hMCd0D0ptNCotherSB;
2202   TH1F *hd0D0VtxTrueptNCotherSB;
2203   namehist="hd0D0ptNCother_";
2204   titlehist="D^{0} impact par. plot, No Cuts, Other, ";
2205   for(Int_t i=0;i<fnbins;i++){
2206     strnamept=namehist;
2207     strnamept.Append("PkMss_pt");
2208     strnamept+=i;
2209
2210     strtitlept=titlehist;
2211     strtitlept.Append(" Mass Peak, ");
2212     strtitlept+=fptbins[i];
2213     strtitlept.Append("<= pt <");
2214     strtitlept+=fptbins[i+1];
2215     strtitlept.Append(" [GeV/c]");
2216     
2217     hd0D0ptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2218     hd0D0ptNCotherPM->SetXTitle("Impact parameter [#mum] ");
2219     hd0D0ptNCotherPM->SetYTitle("Entries");
2220     flistNoCutsOther->Add(hd0D0ptNCotherPM);
2221
2222     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2223     hMCd0D0ptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2224     hMCd0D0ptNCotherPM->SetXTitle("MC Impact parameter [#mum] ");
2225     hMCd0D0ptNCotherPM->SetYTitle("Entries");
2226     flistNoCutsOther->Add(hMCd0D0ptNCotherPM);
2227  
2228
2229     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2230     hd0D0VtxTrueptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2231     hd0D0VtxTrueptNCotherPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2232     hd0D0VtxTrueptNCotherPM->SetYTitle("Entries");
2233     flistNoCutsOther->Add(hd0D0VtxTrueptNCotherPM);
2234     
2235     strnamept=namehist;
2236     strnamept.Append("SBMss_pt");
2237     strnamept+=i;
2238
2239     strtitlept=titlehist;
2240     strtitlept.Append(" Side Bands, ");
2241     strtitlept+=fptbins[i];
2242     strtitlept.Append("<= pt <");
2243     strtitlept+=fptbins[i+1];
2244     strtitlept.Append(" [GeV/c]");
2245     
2246     hd0D0ptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2247     hd0D0ptNCotherSB->SetXTitle("Impact parameter [#mum] ");
2248     hd0D0ptNCotherSB->SetYTitle("Entries");
2249     flistNoCutsOther->Add(hd0D0ptNCotherSB);
2250
2251     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2252     hMCd0D0ptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2253     hMCd0D0ptNCotherSB->SetXTitle("MC Impact parameter [#mum] ");
2254     hMCd0D0ptNCotherSB->SetYTitle("Entries");
2255     flistNoCutsOther->Add(hMCd0D0ptNCotherSB);
2256
2257     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2258     hd0D0VtxTrueptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2259     hd0D0VtxTrueptNCotherSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2260     hd0D0VtxTrueptNCotherSB->SetYTitle("Entries");
2261     flistNoCutsOther->Add(hd0D0VtxTrueptNCotherSB);
2262   }
2263
2264
2265   //################################################################################################
2266   //                                                                                               #
2267   //                         HISTOS FOR LOOSE CUTS                                                 #
2268   //                                                                                               #
2269   //################################################################################################
2270
2271   //############ LOOSE CUTS SIGNAL HISTOGRAMS ###############
2272   //
2273   // ####### global properties histo ############
2274
2275   TH2F *hCPtaVSd0d0LSCsign=new TH2F("hCPtaVSd0d0LSCsign","hCPtaVSd0d0_LooseCuts_Signal",1000,-100000.,100000.,100,-1.,1.);
2276   TH1F *hSecVtxZLSCsign=new TH1F("hSecVtxZLSCsign","hSecVtxZ_LooseCuts_Signal",1000,-8.,8.);
2277   TH1F *hSecVtxXLSCsign=new TH1F("hSecVtxXLSCsign","hSecVtxX_LooseCuts_Signal",1000,-3000.,3000.);
2278   TH1F *hSecVtxYLSCsign=new TH1F("hSecVtxYLSCsign","hSecVtxY_LooseCuts_Signal",1000,-3000.,3000.);
2279   TH2F *hSecVtxXYLSCsign=new TH2F("hSecVtxXYLSCsign","hSecVtxXY_LooseCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
2280   TH1F *hSecVtxPhiLSCsign=new TH1F("hSecVtxPhiLSCsign","hSecVtxPhi_LooseCuts_Signal",180,-180.1,180.1);
2281   TH1F *hd0singlTrackLSCsign=new TH1F("hd0singlTrackLSCsign","hd0singlTrackLooseCuts_Signal",1000,-5000.,5000.);
2282   TH1F *hCPtaLSCsign=new TH1F("hCPtaLSCsign","hCPta_LooseCuts_Signal",100,-1.,1.);
2283   TH1F *hd0xd0LSCsign=new TH1F("hd0xd0LSCsign","hd0xd0_LooseCuts_Signal",1000,-100000.,100000.);
2284   TH1F *hMassTrueLSCsign=new TH1F("hMassTrueLSCsign","D^{0} MC inv. Mass Loose Cuts Signal(All momenta)",600,1.600,2.200);
2285   TH1F *hMassLSCsign=new TH1F("hMassLSCsign","D^{0} inv. Mass Loose Cuts Signal (All momenta)",600,1.600,2.200);
2286   hMassLSCsign->Sumw2();
2287   TH1F *hMassTrueLSCsignPM=new TH1F("hMassTrueLSCsignPM","D^{0} MC inv. Mass Loose Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
2288   TH1F *hMassLSCsignPM=new TH1F("hMassLSCsignPM","D^{0} inv. Mass Loose Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
2289   hMassLSCsignPM->Sumw2();
2290   TH1F *hMassTrueLSCsignSB=new TH1F("hMassTrueLSCsignSB","D^{0} MC inv. Mass in Side Bands Loose Cuts Signal(All momenta)",600,1.600,2.200);
2291   TH1F *hMassLSCsignSB=new TH1F("hMassLSCsignSB","D^{0} inv. Mass in Side Bands Loose Cuts Signal (All momenta)",600,1.600,2.200);
2292   hMassLSCsignSB->Sumw2();
2293
2294   flistLsCutsSignal->Add(hCPtaVSd0d0LSCsign);
2295   flistLsCutsSignal->Add(hSecVtxZLSCsign);
2296   flistLsCutsSignal->Add(hSecVtxYLSCsign);
2297   flistLsCutsSignal->Add(hSecVtxXLSCsign);
2298   flistLsCutsSignal->Add(hSecVtxXYLSCsign);
2299   flistLsCutsSignal->Add(hSecVtxPhiLSCsign);
2300   flistLsCutsSignal->Add(hd0singlTrackLSCsign);
2301   flistLsCutsSignal->Add(hCPtaLSCsign);
2302   flistLsCutsSignal->Add(hd0xd0LSCsign);
2303   flistLsCutsSignal->Add(hMassTrueLSCsign);
2304   flistLsCutsSignal->Add(hMassLSCsign);
2305   flistLsCutsSignal->Add(hMassTrueLSCsignPM);
2306   flistLsCutsSignal->Add(hMassLSCsignPM);
2307   flistLsCutsSignal->Add(hMassTrueLSCsignSB);
2308   flistLsCutsSignal->Add(hMassLSCsignSB);
2309
2310
2311   //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2312   TH1F *hdcaLSCsign=new TH1F("hdcaLSCsign","hdca_LooseCuts_Sign",100,0.,1000.);
2313   hdcaLSCsign->SetXTitle("dca   [#mum]");
2314   hdcaLSCsign->SetYTitle("Entries");
2315   TH1F *hcosthetastarLSCsign=new TH1F("hcosthetastarLSCsign","hCosThetaStar_LooseCuts_Sign",50,-1.,1.);
2316   hcosthetastarLSCsign->SetXTitle("cos #theta^{*}");
2317   hcosthetastarLSCsign->SetYTitle("Entries");
2318   TH1F *hptD0LSCsign=new TH1F("hptD0LSCsign","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2319   hptD0LSCsign->SetXTitle("p_{t}  [GeV/c]");
2320   hptD0LSCsign->SetYTitle("Entries");
2321   TH1F *hptD0VsMaxPtLSCsign=new TH1F("hptD0VsMaxPtLSCsign","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2322   TH2F *hptD0PTallsqrtLSCsign=new TH2F("hptD0PTallsqrtLSCsign","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2323   TH2F *hptD0PTallLSCsign=new TH2F("hptD0PTallLSCsign","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2324   TH2F *hptD0vsptBLSCsign=new TH2F("hptD0vsptBLSCsign","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2325   TH2F *hpD0vspBLSCsign=new TH2F("hpD0vspBLSCsign","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2326   TH2F *hptD0vsptcquarkLSCsign=new TH2F("hptD0vsptcquarkLSCsign","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2327   TH2F *hpD0vspcquarkLSCsign=new TH2F("hpD0vspcquarkLSCsign","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2328   flistLsCutsSignal->Add(hdcaLSCsign);
2329   flistLsCutsSignal->Add(hcosthetastarLSCsign);
2330   flistLsCutsSignal->Add(hptD0LSCsign);
2331   flistLsCutsSignal->Add(hptD0VsMaxPtLSCsign);
2332   flistLsCutsSignal->Add(hptD0PTallsqrtLSCsign);
2333   flistLsCutsSignal->Add(hptD0PTallLSCsign);
2334   flistLsCutsSignal->Add(hptD0vsptBLSCsign);
2335   flistLsCutsSignal->Add(hpD0vspBLSCsign);
2336   flistLsCutsSignal->Add(hptD0vsptcquarkLSCsign);
2337   flistLsCutsSignal->Add(hpD0vspcquarkLSCsign);
2338  
2339   TH1F *hd0zD0ptLSCsign;
2340   TH1F *hInvMassD0LSCsign,*hInvMassD0barLSCsign;
2341   TH2F *hInvMassPtLSCsign=new TH2F("hInvMassPtLSCsign","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2342  THnSparseF *hSparseLSCsign=new THnSparseF("hSparseLSCsign","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2343   hSparseLSCsign->SetBinEdges(0,massbins);
2344   hSparseLSCsign->SetBinEdges(1,massbins);
2345   hSparseLSCsign->SetBinEdges(2,ptbinsForNsparse);
2346   hSparseLSCsign->SetBinEdges(3,impparbins);
2347   hSparseLSCsign->SetBinEdges(4,massHypoBins); 
2348   flistLsCutsSignal->Add(hSparseLSCsign);
2349   TH1F *hetaLSCsign;
2350   TH1F *hCosPDPBLSCsign;
2351   TH1F *hCosPcPDLSCsign;
2352   flistLsCutsSignal->Add(hInvMassPtLSCsign);
2353
2354
2355   
2356  THnSparseF *hSparseCxyLxyLSCsign=new THnSparseF("hSparseCxyLxyLSCsign","Candidate Mass;massD0;Pt;CosXY;Lxy",4,nbinsSparsCxyLxy,binLowLimitSparseCxyLxy,binUpLimitSparseCxyLxy);
2357   hSparseCxyLxyLSCsign->SetBinEdges(1,ptbinlimitsCxyLxy); 
2358   hSparseCxyLxyLSCsign->GetAxis(0)->SetName("mass");
2359   hSparseCxyLxyLSCsign->GetAxis(0)->SetTitle("Invariant Mass (K#pi) [GeV/c^{2}]");
2360   hSparseCxyLxyLSCsign->GetAxis(1)->SetName("pt");
2361   hSparseCxyLxyLSCsign->GetAxis(1)->SetTitle("p_{t} [GeV/c]");
2362   hSparseCxyLxyLSCsign->GetAxis(2)->SetName("CosPointXY");
2363   hSparseCxyLxyLSCsign->GetAxis(2)->SetTitle("Cos#theta_{point}^{XY}");
2364   hSparseCxyLxyLSCsign->GetAxis(3)->SetName("NormDecLengthXY");
2365   hSparseCxyLxyLSCsign->GetAxis(3)->SetTitle("Normalized XY decay length");
2366
2367   flistLsCutsSignal->Add(hSparseCxyLxyLSCsign);
2368   // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2369   TH2F *hd0D0VSd0xd0LSCsignpt;
2370   TH2F *hangletracksVSd0xd0LSCsignpt;
2371   TH2F *hangletracksVSd0D0LSCsignpt;
2372   TH1F *hd0xd0LSCsignpt;
2373   TH1F *hPhiHistPMLSCsignpt,*hPhiHistSBLSCsignpt;
2374
2375   TH2F *hTOFpidLSCsign=new TH2F("hTOFpidLSCsign","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2376   flistLsCutsSignal->Add(hTOFpidLSCsign);
2377
2378   for(Int_t i=0;i<fnbins;i++){
2379  
2380     namehist="hPhiHistPMLSCsign_pt";
2381     namehist+=i;
2382     titlehist="Azimuthal correlation LS Cuts Sign PM ptbin=";
2383     titlehist+=i;
2384     hPhiHistPMLSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
2385     hPhiHistPMLSCsignpt->Sumw2();
2386     flistLsCutsSignal->Add(hPhiHistPMLSCsignpt);
2387
2388     namehist="hPhiHistSBLSCsign_pt";
2389     namehist+=i;
2390     titlehist="Azimuthal correlation LS Cuts Sign SB ptbin=";
2391     titlehist+=i;
2392     hPhiHistSBLSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
2393     hPhiHistSBLSCsignpt->Sumw2();
2394     flistLsCutsSignal->Add(hPhiHistSBLSCsignpt);
2395
2396   
2397
2398     namehist="hd0zD0ptLSCsign_pt";
2399     namehist+=i;
2400     titlehist="d0(z) Loose Cuts Signm ptbin=";
2401     titlehist+=i;
2402     hd0zD0ptLSCsign=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2403     hd0zD0ptLSCsign->SetXTitle("d_{0}(z)    [#mum]");
2404     hd0zD0ptLSCsign->SetYTitle("Entries");
2405     flistLsCutsSignal->Add(hd0zD0ptLSCsign);
2406
2407     namehist="hInvMassD0LSCsign_pt";
2408     namehist+=i;
2409     titlehist="Invariant Mass Loose Cuts Sign ptbin=";
2410     titlehist+=i;
2411     hInvMassD0LSCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2412     hInvMassD0LSCsign->SetXTitle("Invariant Mass    [GeV]");
2413     hInvMassD0LSCsign->SetYTitle("Entries");
2414     flistLsCutsSignal->Add(hInvMassD0LSCsign);
2415
2416
2417     namehist="hInvMassD0barLSCsign_pt";
2418     namehist+=i;
2419     titlehist="Invariant Mass D0bar Loose Cuts Signal ptbin=";
2420     titlehist+=i;
2421     hInvMassD0barLSCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2422     hInvMassD0barLSCsign->SetXTitle("Invariant Mass    [GeV]");
2423     hInvMassD0barLSCsign->SetYTitle("Entries");
2424     flistLsCutsSignal->Add(hInvMassD0barLSCsign);
2425
2426     namehist="hetaLSCsign_pt";
2427     namehist+=i;
2428     titlehist="eta Loose Cuts Sign ptbin=";
2429     titlehist+=i;
2430     hetaLSCsign=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2431     hetaLSCsign->SetXTitle("Pseudorapidity");
2432     hetaLSCsign->SetYTitle("Entries");
2433     flistLsCutsSignal->Add(hetaLSCsign);
2434
2435     namehist="hCosPDPBLSCsign_pt";
2436     namehist+=i;
2437     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2438     titlehist+=i;
2439     hCosPDPBLSCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2440     hCosPDPBLSCsign->SetXTitle("Cosine between D0 momentum and B momentum");
2441     hCosPDPBLSCsign->SetYTitle("Entries");
2442     flistLsCutsSignal->Add(hCosPDPBLSCsign);
2443
2444     namehist="hCosPcPDLSCsign_pt";
2445     namehist+=i;
2446     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2447     titlehist+=i;
2448     hCosPcPDLSCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2449     hCosPcPDLSCsign->SetXTitle("Cosine between c quark momentum and D0 momentum");
2450     hCosPcPDLSCsign->SetYTitle("Entries");
2451     flistLsCutsSignal->Add(hCosPcPDLSCsign);
2452
2453
2454  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2455     namehist="hd0xd0LSCsign_pt";
2456     namehist+=i;
2457     titlehist="d0xd0 Loose Cuts Sign ptbin=";
2458     titlehist+=i;
2459     hd0xd0LSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2460     hd0xd0LSCsignpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
2461     hd0xd0LSCsignpt->SetYTitle("Entries");
2462     flistLsCutsSignal->Add(hd0xd0LSCsignpt);
2463
2464
2465     namehist="hd0D0VSd0xd0LSCsign_pt";
2466     namehist+=i;
2467     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Sign ptbin=";
2468     titlehist+=i;
2469     hd0D0VSd0xd0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2470     hd0D0VSd0xd0LSCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2471     hd0D0VSd0xd0LSCsignpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
2472     flistLsCutsSignal->Add(hd0D0VSd0xd0LSCsignpt);
2473     
2474     
2475     namehist="hangletracksVSd0xd0LSCsign_pt";
2476     namehist+=i;
2477     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Sign ptbin=";
2478     titlehist+=i;
2479     hangletracksVSd0xd0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2480     hangletracksVSd0xd0LSCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2481     hangletracksVSd0xd0LSCsignpt->SetYTitle(" angle between K and #p tracks  [rad]");
2482     flistLsCutsSignal->Add(hangletracksVSd0xd0LSCsignpt);
2483     
2484
2485     namehist="hangletracksVSd0D0LSCsign_pt";
2486     namehist+=i;
2487     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Sign ptbin=";
2488     titlehist+=i;
2489     hangletracksVSd0D0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2490     hangletracksVSd0D0LSCsignpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2491     hangletracksVSd0D0LSCsignpt->SetYTitle(" angle between K and #p tracks  [rad]");
2492     flistLsCutsSignal->Add(hangletracksVSd0D0LSCsignpt);
2493
2494     
2495   }
2496   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2497   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2498
2499
2500   // ####### d0 D0 histos ############
2501   TH1F *hd0D0LSCsignPM = new TH1F("hd0D0LSCsignPM","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2502   hd0D0LSCsignPM->SetXTitle("Impact parameter [#mum]");
2503   hd0D0LSCsignPM->SetYTitle("Entries");
2504
2505   TH1F *hd0D0VtxTrueLSCsignPM = new TH1F("hd0D0VtxTrueLSCsignPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2506   hd0D0VtxTrueLSCsignPM->SetXTitle("Impact parameter [#mum]");
2507   hd0D0VtxTrueLSCsignPM->SetYTitle("Entries");
2508
2509   TH1F *hMCd0D0LSCsignPM = new TH1F("hMCd0D0LSCsignPM","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
2510   hMCd0D0LSCsignPM->SetXTitle("MC Impact parameter [#mum]");
2511   hMCd0D0LSCsignPM->SetYTitle("Entries");
2512
2513   TH1F *hd0D0LSCsignSB = new TH1F("hd0D0LSCsignSB","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2514   hd0D0LSCsignSB->SetXTitle("Impact parameter [#mum]");
2515   hd0D0LSCsignSB->SetYTitle("Entries");
2516
2517   TH1F *hd0D0VtxTrueLSCsignSB = new TH1F("hd0D0VtxTrueLSCsignSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2518   hd0D0VtxTrueLSCsignSB->SetXTitle("Impact parameter [#mum]");
2519   hd0D0VtxTrueLSCsignSB->SetYTitle("Entries");
2520
2521   TH1F *hMCd0D0LSCsignSB = new TH1F("hMCd0D0LSCsignSB","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
2522   hMCd0D0LSCsignSB->SetXTitle("MC Impact parameter [#mum]");
2523   hMCd0D0LSCsignSB->SetYTitle("Entries");
2524
2525   flistLsCutsSignal->Add(hd0D0LSCsignPM);
2526   flistLsCutsSignal->Add(hd0D0VtxTrueLSCsignPM);
2527   flistLsCutsSignal->Add(hMCd0D0LSCsignPM);
2528   flistLsCutsSignal->Add(hd0D0LSCsignSB);
2529   flistLsCutsSignal->Add(hd0D0VtxTrueLSCsignSB);
2530   flistLsCutsSignal->Add(hMCd0D0LSCsignSB);
2531   
2532   TH1F *hd0D0ptLSCsignPM;
2533   TH1F *hMCd0D0ptLSCsignPM;
2534   TH1F *hd0D0VtxTrueptLSCsignPM;
2535   TH1F *hd0D0ptLSCsignSB;
2536   TH1F *hMCd0D0ptLSCsignSB;
2537   TH1F *hd0D0VtxTrueptLSCsignSB;
2538   namehist="hd0D0ptLSCsign_";
2539   titlehist="D^{0} impact par. plot, Loose Cuts, Signal, ";
2540   for(Int_t i=0;i<fnbins;i++){
2541     strnamept=namehist;
2542     strnamept.Append("PkMss_pt");
2543     strnamept+=i;
2544
2545     strtitlept=titlehist;
2546     strtitlept.Append(" Mass Peak, ");
2547     strtitlept+=fptbins[i];
2548     strtitlept.Append("<= pt <");
2549     strtitlept+=fptbins[i+1];
2550     strtitlept.Append(" [GeV/c]");
2551     
2552     hd0D0ptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2553     hd0D0ptLSCsignPM->SetXTitle("Impact parameter [#mum] ");
2554     hd0D0ptLSCsignPM->SetYTitle("Entries");
2555     flistLsCutsSignal->Add(hd0D0ptLSCsignPM);
2556
2557     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2558     hMCd0D0ptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2559     hMCd0D0ptLSCsignPM->SetXTitle("MC Impact parameter [#mum] ");
2560     hMCd0D0ptLSCsignPM->SetYTitle("Entries");
2561     flistLsCutsSignal->Add(hMCd0D0ptLSCsignPM);
2562  
2563
2564     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2565     hd0D0VtxTrueptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2566     hd0D0VtxTrueptLSCsignPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2567     hd0D0VtxTrueptLSCsignPM->SetYTitle("Entries");
2568     flistLsCutsSignal->Add(hd0D0VtxTrueptLSCsignPM);
2569     
2570     strnamept=namehist;
2571     strnamept.Append("SBMss_pt");
2572     strnamept+=i;
2573
2574     strtitlept=titlehist;
2575     strtitlept.Append(" Side Bands, ");
2576     strtitlept+=fptbins[i];
2577     strtitlept.Append("<= pt <");
2578     strtitlept+=fptbins[i+1];
2579     strtitlept.Append(" [GeV/c]");
2580     
2581     hd0D0ptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2582     hd0D0ptLSCsignSB->SetXTitle("Impact parameter [#mum] ");
2583     hd0D0ptLSCsignSB->SetYTitle("Entries");
2584     flistLsCutsSignal->Add(hd0D0ptLSCsignSB);
2585
2586     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2587     hMCd0D0ptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2588     hMCd0D0ptLSCsignSB->SetXTitle("MC Impact parameter [#mum] ");
2589     hMCd0D0ptLSCsignSB->SetYTitle("Entries");
2590     flistLsCutsSignal->Add(hMCd0D0ptLSCsignSB);
2591
2592     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2593     hd0D0VtxTrueptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2594     hd0D0VtxTrueptLSCsignSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2595     hd0D0VtxTrueptLSCsignSB->SetYTitle("Entries");
2596     flistLsCutsSignal->Add(hd0D0VtxTrueptLSCsignSB);
2597   }
2598
2599
2600   //############ LOOSE CUTS BACKGROUND HISTOGRAMS ###########
2601   //
2602   //   ######## global properties histos #######
2603   TH2F *hCPtaVSd0d0LSCback=new TH2F("hCPtaVSd0d0LSCback","hCPtaVSd0d0_LooseCuts_Background",1000,-100000.,100000.,100,-1.,1.);
2604   TH1F *hSecVtxZLSCback=new TH1F("hSecVtxZLSCback","hSecVtxZ_LooseCuts_Background",1000,-8.,8.);
2605   TH1F *hSecVtxXLSCback=new TH1F("hSecVtxXLSCback","hSecVtxX_LooseCuts_Background",1000,-3000.,3000.);
2606   TH1F *hSecVtxYLSCback=new TH1F("hSecVtxYLSCback","hSecVtxY_LooseCuts_Background",1000,-3000.,3000.);
2607   TH2F *hSecVtxXYLSCback=new TH2F("hSecVtxXYLSCback","hSecVtxXY_LooseCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
2608   TH1F *hSecVtxPhiLSCback=new TH1F("hSecVtxPhiLSCback","hSecVtxPhi_LooseCuts_Background",180,-180.1,180.1);
2609   TH1F *hd0singlTrackLSCback=new TH1F("hd0singlTrackLSCback","hd0singlTrackLooseCuts_Back",1000,-5000.,5000.);
2610   TH1F *hCPtaLSCback=new TH1F("hCPtaLSCback","hCPta_LooseCuts_Background",100,-1.,1.);
2611   TH1F *hd0xd0LSCback=new TH1F("hd0xd0LSCback","hd0xd0_LooseCuts_Background",1000,-100000.,100000.);
2612   TH1F *hMassTrueLSCback=new TH1F("hMassTrueLSCback","D^{0} MC inv. Mass Loose Cuts Background(All momenta)",600,1.600,2.200);
2613   TH1F *hMassLSCback=new TH1F("hMassLSCback","D^{0} inv. Mass Loose Cuts Background (All momenta)",600,1.600,2.200);
2614   hMassLSCback->Sumw2();
2615   TH1F *hMassTrueLSCbackPM=new TH1F("hMassTrueLSCbackPM","D^{0} MC inv. Mass Loose Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
2616   TH1F *hMassLSCbackPM=new TH1F("hMassLSCbackPM","D^{0} inv. Mass Loose Cuts Background (All momenta), MassPeak",600,1.600,2.200);
2617   hMassLSCbackPM->Sumw2();
2618   TH1F *hMassTrueLSCbackSB=new TH1F("hMassTrueLSCbackSB","D^{0} MC inv. Mass in Side Bands Loose Cuts Background(All momenta)",600,1.600,2.200);
2619   TH1F *hMassLSCbackSB=new TH1F("hMassLSCbackSB","D^{0} inv. Mass in Side Bands Loose Cuts Background (All momenta)",600,1.600,2.200);
2620   hMassLSCbackSB->Sumw2();
2621
2622   flistLsCutsBack->Add(hCPtaVSd0d0LSCback);
2623   flistLsCutsBack->Add(hSecVtxZLSCback);
2624   flistLsCutsBack->Add(hSecVtxYLSCback);
2625   flistLsCutsBack->Add(hSecVtxXLSCback);
2626   flistLsCutsBack->Add(hSecVtxXYLSCback);
2627   flistLsCutsBack->Add(hSecVtxPhiLSCback);
2628   flistLsCutsBack->Add(hd0singlTrackLSCback);
2629   flistLsCutsBack->Add(hCPtaLSCback);
2630   flistLsCutsBack->Add(hd0xd0LSCback);
2631   flistLsCutsBack->Add(hMassTrueLSCback);
2632   flistLsCutsBack->Add(hMassLSCback);
2633   flistLsCutsBack->Add(hMassTrueLSCbackPM);
2634   flistLsCutsBack->Add(hMassLSCbackPM);
2635   flistLsCutsBack->Add(hMassTrueLSCbackSB);
2636   flistLsCutsBack->Add(hMassLSCbackSB);
2637
2638
2639
2640
2641
2642
2643
2644
2645  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2646   TH1F *hdcaLSCback=new TH1F("hdcaLSCback","hdca_LooseCuts_Backgr",100,0.,1000.);
2647   hdcaLSCback->SetXTitle("dca   [#mum]");
2648   hdcaLSCback->SetYTitle("Entries");
2649   TH1F *hcosthetastarLSCback=new TH1F("hcosthetastarLSCback","hCosThetaStar_LooseCuts_Backgr",50,-1.,1.);
2650   hcosthetastarLSCback->SetXTitle("cos #theta^{*}");
2651   hcosthetastarLSCback->SetYTitle("Entries");
2652   TH1F *hptD0LSCback=new TH1F("hptD0LSCback","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2653   hptD0LSCback->SetXTitle("p_{t}  [GeV/c]");
2654   hptD0LSCback->SetYTitle("Entries");
2655   TH1F *hptD0VsMaxPtLSCback=new TH1F("hptD0VsMaxPtLSCback","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2656   TH2F *hptD0PTallsqrtLSCback=new TH2F("hptD0PTallsqrtLSCback","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2657   TH2F *hptD0PTallLSCback=new TH2F("hptD0PTallLSCback","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2658   TH2F *hptD0vsptBLSCback=new TH2F("hptD0vsptBLSCback","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2659   TH2F *hpD0vspBLSCback=new TH2F("hpD0vspBLSCback","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2660   TH2F *hptD0vsptcquarkLSCback=new TH2F("hptD0vsptcquarkLSCback","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2661   TH2F *hpD0vspcquarkLSCback=new TH2F("hpD0vspcquarkLSCback","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2662   flistLsCutsBack->Add(hdcaLSCback);
2663   flistLsCutsBack->Add(hcosthetastarLSCback);
2664   flistLsCutsBack->Add(hptD0LSCback);
2665   flistLsCutsBack->Add(hptD0VsMaxPtLSCback);
2666   flistLsCutsBack->Add(hptD0PTallsqrtLSCback);
2667   flistLsCutsBack->Add(hptD0PTallLSCback);
2668   flistLsCutsBack->Add(hptD0vsptBLSCback);
2669   flistLsCutsBack->Add(hpD0vspBLSCback);
2670   flistLsCutsBack->Add(hptD0vsptcquarkLSCback);
2671   flistLsCutsBack->Add(hpD0vspcquarkLSCback);
2672  
2673   TH1F *hd0zD0ptLSCback;
2674   TH1F *hInvMassD0LSCback,*hInvMassD0barLSCback;
2675   TH2F *hInvMassPtLSCback=new TH2F("hInvMassPtLSCback","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2676  THnSparseF *hSparseLSCback=new THnSparseF("hSparseLSCback","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2677   hSparseLSCback->SetBinEdges(0,massbins);
2678   hSparseLSCback->SetBinEdges(1,massbins);
2679   hSparseLSCback->SetBinEdges(2,ptbinsForNsparse);
2680   hSparseLSCback->SetBinEdges(3,impparbins);
2681   hSparseLSCback->SetBinEdges(4,massHypoBins); 
2682   flistLsCutsBack->Add(hSparseLSCback);
2683   TH1F *hetaLSCback;
2684   TH1F *hCosPDPBLSCback;
2685   TH1F *hCosPcPDLSCback;
2686   flistLsCutsBack->Add(hInvMassPtLSCback);
2687  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2688   TH2F *hd0D0VSd0xd0LSCbackpt;
2689   TH2F *hangletracksVSd0xd0LSCbackpt;
2690   TH2F *hangletracksVSd0D0LSCbackpt;
2691   TH1F *hd0xd0LSCbackpt;
2692
2693   TH2F *hTOFpidLSCback=new TH2F("hTOFpidLSCback","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2694   flistLsCutsBack->Add(hTOFpidLSCback);
2695
2696   for(Int_t i=0;i<fnbins;i++){
2697     namehist="hd0zD0ptLSCback_pt";
2698     namehist+=i;
2699     titlehist="d0(z) Loose Cuts Backgr ptbin=";
2700     titlehist+=i;
2701     hd0zD0ptLSCback=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2702     hd0zD0ptLSCback->SetXTitle("d_{0}(z)    [#mum]");
2703     hd0zD0ptLSCback->SetYTitle("Entries");
2704     flistLsCutsBack->Add(hd0zD0ptLSCback);
2705
2706     namehist="hInvMassD0LSCback_pt";
2707     namehist+=i;
2708     titlehist="Invariant Mass Loose Cuts Backgr ptbin=";
2709     titlehist+=i;
2710     hInvMassD0LSCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2711     hInvMassD0LSCback->SetXTitle("Invariant Mass    [GeV]");
2712     hInvMassD0LSCback->SetYTitle("Entries");
2713     flistLsCutsBack->Add(hInvMassD0LSCback);
2714     
2715     namehist="hInvMassD0barLSCback_pt";
2716     namehist+=i;
2717     titlehist="Invariant Mass D0bar Loose Cuts Back ptbin=";
2718     titlehist+=i;
2719     hInvMassD0barLSCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2720     hInvMassD0barLSCback->SetXTitle("Invariant Mass    [GeV]");
2721     hInvMassD0barLSCback->SetYTitle("Entries");
2722     flistLsCutsBack->Add(hInvMassD0barLSCback);
2723
2724
2725     namehist="hetaLSCback_pt";
2726     namehist+=i;
2727     titlehist="eta Loose Cuts Backgr ptbin=";
2728     titlehist+=i;
2729     hetaLSCback=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2730     hetaLSCback->SetXTitle("Pseudorapidity");
2731     hetaLSCback->SetYTitle("Entries");
2732     flistLsCutsBack->Add(hetaLSCback);
2733
2734     namehist="hCosPDPBLSCback_pt";
2735     namehist+=i;
2736     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2737     titlehist+=i;
2738     hCosPDPBLSCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2739     hCosPDPBLSCback->SetXTitle("Cosine between D0 momentum and B momentum");
2740     hCosPDPBLSCback->SetYTitle("Entries");
2741     flistLsCutsBack->Add(hCosPDPBLSCback);
2742
2743     namehist="hCosPcPDLSCback_pt";
2744     namehist+=i;
2745     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2746     titlehist+=i;
2747     hCosPcPDLSCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2748     hCosPcPDLSCback->SetXTitle("Cosine between c quark momentum and D0 momentum");
2749     hCosPcPDLSCback->SetYTitle("Entries");
2750     flistLsCutsBack->Add(hCosPcPDLSCback);
2751
2752  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2753     namehist="hd0xd0LSCback_pt";
2754     namehist+=i;
2755     titlehist="d0xd0 Loose Cuts Back ptbin=";
2756     titlehist+=i;
2757     hd0xd0LSCbackpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2758     hd0xd0LSCbackpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
2759     hd0xd0LSCbackpt->SetYTitle("Entries");
2760     flistLsCutsBack->Add(hd0xd0LSCbackpt);
2761
2762
2763     namehist="hd0D0VSd0xd0LSCback_pt";
2764     namehist+=i;
2765     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Back ptbin=";
2766     titlehist+=i;
2767     hd0D0VSd0xd0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2768     hd0D0VSd0xd0LSCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2769     hd0D0VSd0xd0LSCbackpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
2770     flistLsCutsBack->Add(hd0D0VSd0xd0LSCbackpt);
2771     
2772     
2773     namehist="hangletracksVSd0xd0LSCback_pt";
2774     namehist+=i;
2775     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Back ptbin=";
2776     titlehist+=i;
2777     hangletracksVSd0xd0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2778     hangletracksVSd0xd0LSCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2779     hangletracksVSd0xd0LSCbackpt->SetYTitle(" angle between K and #p tracks  [rad]");
2780     flistLsCutsBack->Add(hangletracksVSd0xd0LSCbackpt);
2781     
2782
2783     namehist="hangletracksVSd0D0LSCback_pt";
2784     namehist+=i;
2785     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Back ptbin=";
2786     titlehist+=i;
2787     hangletracksVSd0D0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2788     hangletracksVSd0D0LSCbackpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2789     hangletracksVSd0D0LSCbackpt->SetYTitle(" angle between K and #p tracks  [rad]");
2790     flistLsCutsBack->Add(hangletracksVSd0D0LSCbackpt);
2791     
2792   }
2793   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2794   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2795
2796
2797
2798
2799
2800
2801
2802   // ####### d0 D0 histos ############
2803   
2804  TH1F *hd0D0LSCbackPM = new TH1F("hd0D0LSCbackPM","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2805   hd0D0LSCbackPM->SetXTitle("Impact parameter [#mum]");
2806   hd0D0LSCbackPM->SetYTitle("Entries");
2807
2808   TH1F *hd0D0VtxTrueLSCbackPM = new TH1F("hd0D0VtxTrueLSCbackPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2809   hd0D0VtxTrueLSCbackPM->SetXTitle("Impact parameter [#mum]");
2810   hd0D0VtxTrueLSCbackPM->SetYTitle("Entries");
2811
2812   TH1F *hMCd0D0LSCbackPM = new TH1F("hMCd0D0LSCbackPM","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
2813   hMCd0D0LSCbackPM->SetXTitle("MC Impact parameter [#mum]");
2814   hMCd0D0LSCbackPM->SetYTitle("Entries");
2815
2816   TH1F *hd0D0LSCbackSB = new TH1F("hd0D0LSCbackSB","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2817   hd0D0LSCbackSB->SetXTitle("Impact parameter [#mum]");
2818   hd0D0LSCbackSB->SetYTitle("Entries");
2819
2820   TH1F *hd0D0VtxTrueLSCbackSB = new TH1F("hd0D0VtxTrueLSCbackSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2821   hd0D0VtxTrueLSCbackSB->SetXTitle("Impact parameter [#mum]");
2822   hd0D0VtxTrueLSCbackSB->SetYTitle("Entries");
2823
2824   TH1F *hMCd0D0LSCbackSB = new TH1F("hMCd0D0LSCbackSB","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
2825   hMCd0D0LSCbackSB->SetXTitle("MC Impact parameter [#mum]");
2826   hMCd0D0LSCbackSB->SetYTitle("Entries");
2827
2828   flistLsCutsBack->Add(hd0D0LSCbackPM);
2829   flistLsCutsBack->Add(hd0D0VtxTrueLSCbackPM);
2830   flistLsCutsBack->Add(hMCd0D0LSCbackPM);
2831   flistLsCutsBack->Add(hd0D0LSCbackSB);
2832   flistLsCutsBack->Add(hd0D0VtxTrueLSCbackSB);
2833   flistLsCutsBack->Add(hMCd0D0LSCbackSB);
2834   
2835   TH1F *hd0D0ptLSCbackPM;
2836   TH1F *hMCd0D0ptLSCbackPM;
2837   TH1F *hd0D0VtxTrueptLSCbackPM;
2838   TH1F *hd0D0ptLSCbackSB;
2839   TH1F *hMCd0D0ptLSCbackSB;
2840   TH1F *hd0D0VtxTrueptLSCbackSB;
2841   namehist="hd0D0ptLSCback_";
2842   titlehist="D^{0} impact par. plot, Loose Cuts, Background, ";
2843   for(Int_t i=0;i<fnbins;i++){
2844     strnamept=namehist;
2845     strnamept.Append("PkMss_pt");
2846     strnamept+=i;
2847
2848     strtitlept=titlehist;
2849     strtitlept.Append(" Mass Peak, ");
2850     strtitlept+=fptbins[i];
2851     strtitlept.Append("<= pt <");
2852     strtitlept+=fptbins[i+1];
2853     strtitlept.Append(" [GeV/c]");
2854     
2855     hd0D0ptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2856     hd0D0ptLSCbackPM->SetXTitle("Impact parameter [#mum] ");
2857     hd0D0ptLSCbackPM->SetYTitle("Entries");
2858     flistLsCutsBack->Add(hd0D0ptLSCbackPM);
2859
2860     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2861     hMCd0D0ptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2862     hMCd0D0ptLSCbackPM->SetXTitle("MC Impact parameter [#mum] ");
2863     hMCd0D0ptLSCbackPM->SetYTitle("Entries");
2864     flistLsCutsBack->Add(hMCd0D0ptLSCbackPM);
2865  
2866
2867     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2868     hd0D0VtxTrueptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2869     hd0D0VtxTrueptLSCbackPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2870     hd0D0VtxTrueptLSCbackPM->SetYTitle("Entries");
2871     flistLsCutsBack->Add(hd0D0VtxTrueptLSCbackPM);
2872     
2873     strnamept=namehist;
2874     strnamept.Append("SBMss_pt");
2875     strnamept+=i;
2876
2877     strtitlept=titlehist;
2878     strtitlept.Append(" Side Bands, ");
2879     strtitlept+=fptbins[i];
2880     strtitlept.Append("<= pt <");
2881     strtitlept+=fptbins[i+1];
2882     strtitlept.Append(" [GeV/c]");
2883     
2884     hd0D0ptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2885     hd0D0ptLSCbackSB->SetXTitle("Impact parameter [#mum] ");
2886     hd0D0ptLSCbackSB->SetYTitle("Entries");
2887     flistLsCutsBack->Add(hd0D0ptLSCbackSB);
2888
2889     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2890     hMCd0D0ptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2891     hMCd0D0ptLSCbackSB->SetXTitle("MC Impact parameter [#mum] ");
2892     hMCd0D0ptLSCbackSB->SetYTitle("Entries");
2893     flistLsCutsBack->Add(hMCd0D0ptLSCbackSB);
2894
2895     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2896     hd0D0VtxTrueptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2897     hd0D0VtxTrueptLSCbackSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2898     hd0D0VtxTrueptLSCbackSB->SetYTitle("Entries");
2899     flistLsCutsBack->Add(hd0D0VtxTrueptLSCbackSB);
2900   }
2901
2902
2903
2904  //############ LOOSE CUTS FROMB HISTOGRAMS ###########
2905   //
2906   //#######  global properties histos
2907
2908   TH2F *hCPtaVSd0d0LSCfromB=new TH2F("hCPtaVSd0d0LSCfromB","hCPtaVSd0d0_LooseCuts_FromB",1000,-100000.,100000.,100,-1.,1.);
2909   TH1F *hSecVtxZLSCfromB=new TH1F("hSecVtxZLSCfromB","hSecVtxZ_LooseCuts_FromB",1000,-8.,8.);
2910   TH1F *hSecVtxXLSCfromB=new TH1F("hSecVtxXLSCfromB","hSecVtxX_LooseCuts_FromB",1000,-3000.,3000.);
2911   TH1F *hSecVtxYLSCfromB=new TH1F("hSecVtxYLSCfromB","hSecVtxY_LooseCuts_FromB",1000,-3000.,3000.);
2912   TH2F *hSecVtxXYLSCfromB=new TH2F("hSecVtxXYLSCfromB","hSecVtxXY_LooseCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
2913   TH1F *hSecVtxPhiLSCfromB=new TH1F("hSecVtxPhiLSCfromB","hSecVtxPhi_LooseCuts_FromB",180,-180.1,180.1);
2914   TH1F *hd0singlTrackLSCfromB=new TH1F("hd0singlTrackLSCfromB","hd0singlTrackLooseCuts_FromB",1000,-5000.,5000.);
2915   TH1F *hCPtaLSCfromB=new TH1F("hCPtaLSCfromB","hCPta_LooseCuts_FromB",100,-1.,1.);
2916   TH1F *hd0xd0LSCfromB=new TH1F("hd0xd0LSCfromB","hd0xd0_LooseCuts_FromB",1000,-100000.,100000.);
2917   TH1F *hMassTrueLSCfromB=new TH1F("hMassTrueLSCfromB","D^{0} MC inv. Mass Loose Cuts FromB(All momenta)",600,1.600,2.200);
2918   TH1F *hMassLSCfromB=new TH1F("hMassLSCfromB","D^{0} inv. Mass Loose Cuts FromB (All momenta)",600,1.600,2.200);
2919   hMassLSCfromB->Sumw2();
2920   TH1F *hMassTrueLSCfromBPM=new TH1F("hMassTrueLSCfromBPM","D^{0} MC inv. Mass Loose Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
2921   TH1F *hMassLSCfromBPM=new TH1F("hMassLSCfromBPM","D^{0} inv. Mass Loose Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
2922   hMassLSCfromBPM->Sumw2();
2923   TH1F *hMassTrueLSCfromBSB=new TH1F("hMassTrueLSCfromBSB","D^{0} MC inv. Mass in Side Bands Loose Cuts FromB(All momenta)",600,1.600,2.200);
2924   TH1F *hMassLSCfromBSB=new TH1F("hMassLSCfromBSB","D^{0} inv. Mass in Side Bands Loose Cuts FromB (All momenta)",600,1.600,2.200);
2925   hMassLSCfromBSB->Sumw2();
2926
2927   flistLsCutsFromB->Add(hCPtaVSd0d0LSCfromB);
2928   flistLsCutsFromB->Add(hSecVtxZLSCfromB);
2929   flistLsCutsFromB->Add(hSecVtxYLSCfromB);
2930   flistLsCutsFromB->Add(hSecVtxXLSCfromB);
2931   flistLsCutsFromB->Add(hSecVtxXYLSCfromB);
2932   flistLsCutsFromB->Add(hSecVtxPhiLSCfromB);
2933   flistLsCutsFromB->Add(hd0singlTrackLSCfromB);
2934   flistLsCutsFromB->Add(hCPtaLSCfromB);
2935   flistLsCutsFromB->Add(hd0xd0LSCfromB);
2936   flistLsCutsFromB->Add(hMassTrueLSCfromB);
2937   flistLsCutsFromB->Add(hMassLSCfromB);
2938   flistLsCutsFromB->Add(hMassTrueLSCfromBPM);
2939   flistLsCutsFromB->Add(hMassLSCfromBPM);
2940   flistLsCutsFromB->Add(hMassTrueLSCfromBSB);
2941   flistLsCutsFromB->Add(hMassLSCfromBSB);
2942
2943
2944
2945
2946  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2947   TH1F *hdcaLSCfromB=new TH1F("hdcaLSCfromB","hdca_LooseCuts_FromB",100,0.,1000.);
2948   hdcaLSCfromB->SetXTitle("dca   [#mum]");
2949   hdcaLSCfromB->SetYTitle("Entries");
2950   TH1F *hcosthetastarLSCfromB=new TH1F("hcosthetastarLSCfromB","hCosThetaStar_LooseCuts_FromB",50,-1.,1.);
2951   hcosthetastarLSCfromB->SetXTitle("cos #theta^{*}");
2952   hcosthetastarLSCfromB->SetYTitle("Entries");
2953   TH1F *hptD0LSCfromB=new TH1F("hptD0LSCfromB","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2954   hptD0LSCfromB->SetXTitle("p_{t}  [GeV/c]");
2955   hptD0LSCfromB->SetYTitle("Entries");
2956   TH1F *hptD0VsMaxPtLSCfromB=new TH1F("hptD0VsMaxPtLSCfromB","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2957   TH2F *hptD0PTallsqrtLSCfromB=new TH2F("hptD0PTallsqrtLSCfromB","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2958   TH2F *hptD0PTallLSCfromB=new TH2F("hptD0PTallLSCfromB","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2959   TH2F *hptD0vsptBLSCfromB=new TH2F("hptD0vsptBLSCfromB","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2960   TH2F *hpD0vspBLSCfromB=new TH2F("hpD0vspBLSCfromB","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2961   TH2F *hptD0vsptcquarkLSCfromB=new TH2F("hptD0vsptcquarkLSCfromB","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2962   TH2F *hpD0vspcquarkLSCfromB=new TH2F("hpD0vspcquarkLSCfromB","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2963   flistLsCutsFromB->Add(hdcaLSCfromB);
2964   flistLsCutsFromB->Add(hcosthetastarLSCfromB);
2965   flistLsCutsFromB->Add(hptD0LSCfromB);
2966   flistLsCutsFromB->Add(hptD0VsMaxPtLSCfromB);
2967   flistLsCutsFromB->Add(hptD0PTallsqrtLSCfromB);
2968   flistLsCutsFromB->Add(hptD0PTallLSCfromB);
2969   flistLsCutsFromB->Add(hptD0vsptBLSCfromB);
2970   flistLsCutsFromB->Add(hpD0vspBLSCfromB);
2971   flistLsCutsFromB->Add(hptD0vsptcquarkLSCfromB);
2972   flistLsCutsFromB->Add(hpD0vspcquarkLSCfromB);
2973  
2974   TH1F *hd0zD0ptLSCfromB;
2975   TH1F *hInvMassD0LSCfromB,*hInvMassD0barLSCfromB;
2976   TH2F *hInvMassPtLSCfromB=new TH2F("hInvMassPtLSCfromB","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2977  THnSparseF *hSparseLSCfromB=new THnSparseF("hSparseLSCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2978   hSparseLSCfromB->SetBinEdges(0,massbins);
2979   hSparseLSCfromB->SetBinEdges(1,massbins);
2980   hSparseLSCfromB->SetBinEdges(2,ptbinsForNsparse);
2981   hSparseLSCfromB->SetBinEdges(3,impparbins);
2982   hSparseLSCfromB->SetBinEdges(4,massHypoBins); 
2983   flistLsCutsFromB->Add(hSparseLSCfromB);
2984
2985
2986   THnSparseF *hSparseRecoLSCfromB=new THnSparseF("hSparseRecoLSCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2987   hSparseRecoLSCfromB->SetBinEdges(0,massbins);
2988   hSparseRecoLSCfromB->SetBinEdges(1,massbins);
2989   hSparseRecoLSCfromB->SetBinEdges(2,ptbinsForNsparse);
2990   hSparseRecoLSCfromB->SetBinEdges(3,impparbins);
2991   hSparseRecoLSCfromB->SetBinEdges(4,massHypoBins); 
2992   flistLsCutsFromB->Add(hSparseRecoLSCfromB);
2993
2994
2995   TH1F *hetaLSCfromB;
2996   TH1F *hCosPDPBLSCfromB;
2997   TH1F *hCosPcPDLSCfromB;
2998   flistLsCutsFromB->Add(hInvMassPtLSCfromB);
2999    // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3000   TH2F *hd0D0VSd0xd0LSCfromBpt;
3001   TH2F *hangletracksVSd0xd0LSCfromBpt;
3002   TH2F *hangletracksVSd0D0LSCfromBpt;
3003   TH1F *hd0xd0LSCfromBpt;
3004
3005
3006   TH2F *hTOFpidLSCfromB=new TH2F("hTOFpidLSCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
3007   flistLsCutsFromB->Add(hTOFpidLSCfromB);
3008
3009   for(Int_t i=0;i<fnbins;i++){
3010     namehist="hd0zD0ptLSCfromB_pt";
3011     namehist+=i;
3012     titlehist="d0(z) Loose Cuts FromBm ptbin=";
3013     titlehist+=i;
3014     hd0zD0ptLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
3015     hd0zD0ptLSCfromB->SetXTitle("d_{0}(z)    [#mum]");
3016     hd0zD0ptLSCfromB->SetYTitle("Entries");
3017     flistLsCutsFromB->Add(hd0zD0ptLSCfromB);
3018
3019     namehist="hInvMassD0LSCfromB_pt";
3020     namehist+=i;
3021     titlehist="Invariant Mass Loose Cuts FromB ptbin=";
3022     titlehist+=i;
3023     hInvMassD0LSCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3024     hInvMassD0LSCfromB->SetXTitle("Invariant Mass    [GeV]");
3025     hInvMassD0LSCfromB->SetYTitle("Entries");
3026     flistLsCutsFromB->Add(hInvMassD0LSCfromB);
3027
3028     namehist="hInvMassD0barLSCfromB_pt";
3029     namehist+=i;
3030     titlehist="Invariant Mass D0bar Loose Cuts FromB ptbin=";
3031     titlehist+=i;
3032     hInvMassD0barLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3033     hInvMassD0barLSCfromB->SetXTitle("Invariant Mass    [GeV]");
3034     hInvMassD0barLSCfromB->SetYTitle("Entries");
3035     flistLsCutsFromB->Add(hInvMassD0barLSCfromB);
3036
3037     namehist="hetaLSCfromB_pt";
3038     namehist+=i;
3039     titlehist="eta Loose Cuts FromB ptbin=";
3040     titlehist+=i;
3041     hetaLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
3042     hetaLSCfromB->SetXTitle("Pseudorapidity");
3043     hetaLSCfromB->SetYTitle("Entries");
3044     flistLsCutsFromB->Add(hetaLSCfromB);
3045
3046     namehist="hCosPDPBLSCfromB_pt";
3047     namehist+=i;
3048     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
3049     titlehist+=i;
3050     hCosPDPBLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3051     hCosPDPBLSCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
3052     hCosPDPBLSCfromB->SetYTitle("Entries");
3053     flistLsCutsFromB->Add(hCosPDPBLSCfromB);
3054
3055     namehist="hCosPcPDLSCfromB_pt";
3056     namehist+=i;
3057     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
3058     titlehist+=i;
3059     hCosPcPDLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3060     hCosPcPDLSCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
3061     hCosPcPDLSCfromB->SetYTitle("Entries");
3062     flistLsCutsFromB->Add(hCosPcPDLSCfromB);
3063
3064  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3065     namehist="hd0xd0LSCfromB_pt";
3066     namehist+=i;
3067     titlehist="d0xd0 Loose Cuts FromB ptbin=";
3068     titlehist+=i;
3069     hd0xd0LSCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
3070     hd0xd0LSCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
3071     hd0xd0LSCfromBpt->SetYTitle("Entries");
3072     flistLsCutsFromB->Add(hd0xd0LSCfromBpt);
3073
3074
3075     namehist="hd0D0VSd0xd0LSCfromB_pt";
3076     namehist+=i;
3077     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromB ptbin=";
3078     titlehist+=i;
3079     hd0D0VSd0xd0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
3080     hd0D0VSd0xd0LSCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3081     hd0D0VSd0xd0LSCfromBpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
3082     flistLsCutsFromB->Add(hd0D0VSd0xd0LSCfromBpt);
3083     
3084     
3085     namehist="hangletracksVSd0xd0LSCfromB_pt";
3086     namehist+=i;
3087     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromB ptbin=";
3088     titlehist+=i;
3089     hangletracksVSd0xd0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
3090     hangletracksVSd0xd0LSCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3091     hangletracksVSd0xd0LSCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
3092     flistLsCutsFromB->Add(hangletracksVSd0xd0LSCfromBpt);
3093     
3094
3095     namehist="hangletracksVSd0D0LSCfromB_pt";
3096     namehist+=i;
3097     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts FromB ptbin=";
3098     titlehist+=i;
3099     hangletracksVSd0D0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
3100     hangletracksVSd0D0LSCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
3101     hangletracksVSd0D0LSCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
3102     flistLsCutsFromB->Add(hangletracksVSd0D0LSCfromBpt);
3103     
3104   }
3105   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
3106   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3107
3108
3109
3110
3111
3112   // ######### d0 D0 histos ##############
3113   TH1F *hd0D0LSCfromBPM = new TH1F("hd0D0LSCfromBPM","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3114   hd0D0LSCfromBPM->SetXTitle("Impact parameter [#mum]");
3115   hd0D0LSCfromBPM->SetYTitle("Entries");
3116
3117   TH1F *hd0D0VtxTrueLSCfromBPM = new TH1F("hd0D0VtxTrueLSCfromBPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3118   hd0D0VtxTrueLSCfromBPM->SetXTitle("Impact parameter [#mum]");
3119   hd0D0VtxTrueLSCfromBPM->SetYTitle("Entries");
3120
3121   TH1F *hMCd0D0LSCfromBPM = new TH1F("hMCd0D0LSCfromBPM","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
3122   hMCd0D0LSCfromBPM->SetXTitle("MC Impact parameter [#mum]");
3123   hMCd0D0LSCfromBPM->SetYTitle("Entries");
3124
3125   TH1F *hd0D0LSCfromBSB = new TH1F("hd0D0LSCfromBSB","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3126   hd0D0LSCfromBSB->SetXTitle("Impact parameter [#mum]");
3127   hd0D0LSCfromBSB->SetYTitle("Entries");
3128
3129   TH1F *hd0D0VtxTrueLSCfromBSB = new TH1F("hd0D0VtxTrueLSCfromBSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3130   hd0D0VtxTrueLSCfromBSB->SetXTitle("Impact parameter [#mum]");
3131   hd0D0VtxTrueLSCfromBSB->SetYTitle("Entries");
3132
3133   TH1F *hMCd0D0LSCfromBSB = new TH1F("hMCd0D0LSCfromBSB","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
3134   hMCd0D0LSCfromBSB->SetXTitle("MC Impact parameter [#mum]");
3135   hMCd0D0LSCfromBSB->SetYTitle("Entries");
3136
3137   flistLsCutsFromB->Add(hd0D0LSCfromBPM);
3138   flistLsCutsFromB->Add(hd0D0VtxTrueLSCfromBPM);
3139   flistLsCutsFromB->Add(hMCd0D0LSCfromBPM);
3140   flistLsCutsFromB->Add(hd0D0LSCfromBSB);
3141   flistLsCutsFromB->Add(hd0D0VtxTrueLSCfromBSB);
3142   flistLsCutsFromB->Add(hMCd0D0LSCfromBSB);
3143   
3144   TH1F *hd0D0ptLSCfromBPM;
3145   TH1F *hMCd0D0ptLSCfromBPM;
3146   TH1F *hd0D0VtxTrueptLSCfromBPM;
3147   TH1F *hd0D0ptLSCfromBSB;
3148   TH1F *hMCd0D0ptLSCfromBSB;
3149   TH1F *hd0D0VtxTrueptLSCfromBSB;
3150   namehist="hd0D0ptLSCfromB_";
3151   titlehist="D^{0} impact par. plot, Loose Cuts, FromB, ";
3152   for(Int_t i=0;i<fnbins;i++){
3153     strnamept=namehist;
3154     strnamept.Append("PkMss_pt");
3155     strnamept+=i;
3156
3157     strtitlept=titlehist;
3158     strtitlept.Append(" Mass Peak, ");
3159     strtitlept+=fptbins[i];
3160     strtitlept.Append("<= pt <");
3161     strtitlept+=fptbins[i+1];
3162     strtitlept.Append(" [GeV/c]");
3163     
3164     hd0D0ptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3165     hd0D0ptLSCfromBPM->SetXTitle("Impact parameter [#mum] ");
3166     hd0D0ptLSCfromBPM->SetYTitle("Entries");
3167     flistLsCutsFromB->Add(hd0D0ptLSCfromBPM);
3168
3169     strnamept.ReplaceAll("hd0D0","hMCd0D0");
3170     hMCd0D0ptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3171     hMCd0D0ptLSCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
3172     hMCd0D0ptLSCfromBPM->SetYTitle("Entries");
3173     flistLsCutsFromB->Add(hMCd0D0ptLSCfromBPM);
3174  
3175
3176     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3177     hd0D0VtxTrueptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3178     hd0D0VtxTrueptLSCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3179     hd0D0VtxTrueptLSCfromBPM->SetYTitle("Entries");
3180     flistLsCutsFromB->Add(hd0D0VtxTrueptLSCfromBPM);
3181     
3182     strnamept=namehist;
3183     strnamept.Append("SBMss_pt");
3184     strnamept+=i;
3185
3186     strtitlept=titlehist;
3187     strtitlept.Append(" Side Bands, ");
3188     strtitlept+=fptbins[i];
3189     strtitlept.Append("<= pt <");
3190     strtitlept+=fptbins[i+1];
3191     strtitlept.Append(" [GeV/c]");
3192     
3193     hd0D0ptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3194     hd0D0ptLSCfromBSB->SetXTitle("Impact parameter [#mum] ");
3195     hd0D0ptLSCfromBSB->SetYTitle("Entries");
3196     flistLsCutsFromB->Add(hd0D0ptLSCfromBSB);
3197
3198     strnamept.ReplaceAll("hd0D0","hMCd0D0");
3199     hMCd0D0ptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3200     hMCd0D0ptLSCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
3201     hMCd0D0ptLSCfromBSB->SetYTitle("Entries");
3202     flistLsCutsFromB->Add(h