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