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