Added LHC10h run list for flow analysis (Giacomo)
[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   TH1F *hetaNCfromB;
1441   TH1F *hCosPDPBNCfromB;
1442   TH1F *hCosPcPDNCfromB;
1443
1444    // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1445   TH2F *hd0D0VSd0xd0NCfromBpt;
1446   TH2F *hangletracksVSd0xd0NCfromBpt;
1447   TH2F *hangletracksVSd0D0NCfromBpt;
1448   TH1F *hd0xd0NCfromBpt;
1449   flistNoCutsFromB->Add(hInvMassPtNCfromB);
1450
1451   TH2F *hTOFpidNCfromB=new TH2F("hTOFpidNCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1452   flistNoCutsFromB->Add(hTOFpidNCfromB);
1453
1454   for(Int_t i=0;i<fnbins;i++){
1455     namehist="hd0zD0ptNCfromB_pt";
1456     namehist+=i;
1457     titlehist="d0(z) No Cuts FromB ptbin=";
1458     titlehist+=i;
1459     hd0zD0ptNCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1460     hd0zD0ptNCfromB->SetXTitle("d_{0}(z)    [#mum]");
1461     hd0zD0ptNCfromB->SetYTitle("Entries");
1462     flistNoCutsFromB->Add(hd0zD0ptNCfromB);
1463
1464     namehist="hInvMassD0NCfromB_pt";
1465     namehist+=i;
1466     titlehist="Invariant Mass No Cuts FromB ptbin=";
1467     titlehist+=i;
1468     hInvMassD0NCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1469     hInvMassD0NCfromB->SetXTitle("Invariant Mass    [GeV]");
1470     hInvMassD0NCfromB->SetYTitle("Entries");
1471     flistNoCutsFromB->Add(hInvMassD0NCfromB);
1472
1473
1474     namehist="hInvMassD0barNCfromB_pt";
1475     namehist+=i;
1476     titlehist="Invariant Mass D0bar No Cuts FromB ptbin=";
1477     titlehist+=i;
1478     hInvMassD0barNCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1479     hInvMassD0barNCfromB->SetXTitle("Invariant Mass    [GeV]");
1480     hInvMassD0barNCfromB->SetYTitle("Entries");
1481     flistNoCutsFromB->Add(hInvMassD0barNCfromB);
1482
1483
1484
1485     namehist="hetaNCfromB_pt";
1486     namehist+=i;
1487     titlehist="eta No Cuts FromB ptbin=";
1488     titlehist+=i;
1489     hetaNCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1490     hetaNCfromB->SetXTitle("Pseudorapidity");
1491     hetaNCfromB->SetYTitle("Entries");
1492     flistNoCutsFromB->Add(hetaNCfromB);
1493
1494     namehist="hCosPDPBNCfromB_pt";
1495     namehist+=i;
1496     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1497     titlehist+=i;
1498     hCosPDPBNCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1499     hCosPDPBNCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
1500     hCosPDPBNCfromB->SetYTitle("Entries");
1501     flistNoCutsFromB->Add(hCosPDPBNCfromB);
1502
1503     namehist="hCosPcPDNCfromB_pt";
1504     namehist+=i;
1505     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1506     titlehist+=i;
1507     hCosPcPDNCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1508     hCosPcPDNCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
1509     hCosPcPDNCfromB->SetYTitle("Entries");
1510     flistNoCutsFromB->Add(hCosPcPDNCfromB);
1511
1512 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1513     namehist="hd0xd0NCfromB_pt";
1514     namehist+=i;
1515     titlehist="d0xd0 No Cuts FromB ptbin=";
1516     titlehist+=i;
1517     hd0xd0NCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1518     hd0xd0NCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
1519     hd0xd0NCfromBpt->SetYTitle("Entries");
1520     flistNoCutsFromB->Add(hd0xd0NCfromBpt);
1521
1522
1523     namehist="hd0D0VSd0xd0NCfromB_pt";
1524     namehist+=i;
1525     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromB ptbin=";
1526     titlehist+=i;
1527     hd0D0VSd0xd0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1528     hd0D0VSd0xd0NCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1529     hd0D0VSd0xd0NCfromBpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
1530     flistNoCutsFromB->Add(hd0D0VSd0xd0NCfromBpt);
1531     
1532     
1533     namehist="hangletracksVSd0xd0NCfromB_pt";
1534     namehist+=i;
1535     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromB ptbin=";
1536     titlehist+=i;
1537     hangletracksVSd0xd0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1538     hangletracksVSd0xd0NCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1539     hangletracksVSd0xd0NCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
1540     flistNoCutsFromB->Add(hangletracksVSd0xd0NCfromBpt);
1541     
1542
1543     namehist="hangletracksVSd0D0NCfromB_pt";
1544     namehist+=i;
1545     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts FromB ptbin=";
1546     titlehist+=i;
1547     hangletracksVSd0D0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1548     hangletracksVSd0D0NCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1549     hangletracksVSd0D0NCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
1550     flistNoCutsFromB->Add(hangletracksVSd0D0NCfromBpt);
1551
1552     
1553   }
1554   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1555   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1556
1557
1558
1559   // ######### d0 D0 histos ##############
1560   TH1F *hd0D0NCfromBPM = new TH1F("hd0D0NCfromBPM","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1561   hd0D0NCfromBPM->SetXTitle("Impact parameter [#mum]");
1562   hd0D0NCfromBPM->SetYTitle("Entries");
1563
1564   TH1F *hd0D0VtxTrueNCfromBPM = new TH1F("hd0D0VtxTrueNCfromBPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1565   hd0D0VtxTrueNCfromBPM->SetXTitle("Impact parameter [#mum]");
1566   hd0D0VtxTrueNCfromBPM->SetYTitle("Entries");
1567
1568   TH1F *hMCd0D0NCfromBPM = new TH1F("hMCd0D0NCfromBPM","D^{0} impact par. plot, No Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
1569   hMCd0D0NCfromBPM->SetXTitle("MC Impact parameter [#mum]");
1570   hMCd0D0NCfromBPM->SetYTitle("Entries");
1571
1572   TH1F *hd0D0NCfromBSB = new TH1F("hd0D0NCfromBSB","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1573   hd0D0NCfromBSB->SetXTitle("Impact parameter [#mum]");
1574   hd0D0NCfromBSB->SetYTitle("Entries");
1575
1576   TH1F *hd0D0VtxTrueNCfromBSB = new TH1F("hd0D0VtxTrueNCfromBSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1577   hd0D0VtxTrueNCfromBSB->SetXTitle("Impact parameter [#mum]");
1578   hd0D0VtxTrueNCfromBSB->SetYTitle("Entries");
1579
1580   TH1F *hMCd0D0NCfromBSB = new TH1F("hMCd0D0NCfromBSB","D^{0} impact par. plot, No Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
1581   hMCd0D0NCfromBSB->SetXTitle("MC Impact parameter [#mum]");
1582   hMCd0D0NCfromBSB->SetYTitle("Entries");
1583
1584   flistNoCutsFromB->Add(hd0D0NCfromBPM);
1585   flistNoCutsFromB->Add(hd0D0VtxTrueNCfromBPM);
1586   flistNoCutsFromB->Add(hMCd0D0NCfromBPM);
1587   flistNoCutsFromB->Add(hd0D0NCfromBSB);
1588   flistNoCutsFromB->Add(hd0D0VtxTrueNCfromBSB);
1589   flistNoCutsFromB->Add(hMCd0D0NCfromBSB);
1590   
1591   TH1F *hd0D0ptNCfromBPM;
1592   TH1F *hMCd0D0ptNCfromBPM;
1593   TH1F *hd0D0VtxTrueptNCfromBPM;
1594   TH1F *hd0D0ptNCfromBSB;
1595   TH1F *hMCd0D0ptNCfromBSB;
1596   TH1F *hd0D0VtxTrueptNCfromBSB;
1597   namehist="hd0D0ptNCfromB_";
1598   titlehist="D^{0} impact par. plot, No Cuts, FromB, ";
1599   for(Int_t i=0;i<fnbins;i++){
1600     strnamept=namehist;
1601     strnamept.Append("PkMss_pt");
1602     strnamept+=i;
1603
1604     strtitlept=titlehist;
1605     strtitlept.Append(" Mass Peak, ");
1606     strtitlept+=fptbins[i];
1607     strtitlept.Append("<= pt <");
1608     strtitlept+=fptbins[i+1];
1609     strtitlept.Append(" [GeV/c]");
1610     
1611     hd0D0ptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1612     hd0D0ptNCfromBPM->SetXTitle("Impact parameter [#mum] ");
1613     hd0D0ptNCfromBPM->SetYTitle("Entries");
1614     flistNoCutsFromB->Add(hd0D0ptNCfromBPM);
1615
1616     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1617     hMCd0D0ptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1618     hMCd0D0ptNCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
1619     hMCd0D0ptNCfromBPM->SetYTitle("Entries");
1620     flistNoCutsFromB->Add(hMCd0D0ptNCfromBPM);
1621  
1622
1623     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1624     hd0D0VtxTrueptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1625     hd0D0VtxTrueptNCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1626     hd0D0VtxTrueptNCfromBPM->SetYTitle("Entries");
1627     flistNoCutsFromB->Add(hd0D0VtxTrueptNCfromBPM);
1628     
1629     strnamept=namehist;
1630     strnamept.Append("SBMss_pt");
1631     strnamept+=i;
1632
1633     strtitlept=titlehist;
1634     strtitlept.Append(" Side Bands, ");
1635     strtitlept+=fptbins[i];
1636     strtitlept.Append("<= pt <");
1637     strtitlept+=fptbins[i+1];
1638     strtitlept.Append(" [GeV/c]");
1639     
1640     hd0D0ptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1641     hd0D0ptNCfromBSB->SetXTitle("Impact parameter [#mum] ");
1642     hd0D0ptNCfromBSB->SetYTitle("Entries");
1643     flistNoCutsFromB->Add(hd0D0ptNCfromBSB);
1644
1645     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1646     hMCd0D0ptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1647     hMCd0D0ptNCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
1648     hMCd0D0ptNCfromBSB->SetYTitle("Entries");
1649     flistNoCutsFromB->Add(hMCd0D0ptNCfromBSB);
1650
1651     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1652     hd0D0VtxTrueptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1653     hd0D0VtxTrueptNCfromBSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1654     hd0D0VtxTrueptNCfromBSB->SetYTitle("Entries");
1655     flistNoCutsFromB->Add(hd0D0VtxTrueptNCfromBSB);
1656   }
1657
1658
1659
1660   //############ NO CUTS FROM DSTAR HISTOGRAMS ###########
1661   //
1662   //#############  global properties histos #######
1663
1664   TH2F *hCPtaVSd0d0NCfromDstar=new TH2F("hCPtaVSd0d0NCfromDstar","hCPtaVSd0d0_NoCuts_FromDStar",1000,-100000.,100000.,100,-1.,1.);
1665   TH1F *hSecVtxZNCfromDstar=new TH1F("hSecVtxZNCfromDstar","hSecVtxZ_NoCuts_FromDStar",1000,-8.,8.);
1666   TH1F *hSecVtxXNCfromDstar=new TH1F("hSecVtxXNCfromDstar","hSecVtxX_NoCuts_FromDStar",1000,-3000.,3000.);
1667   TH1F *hSecVtxYNCfromDstar=new TH1F("hSecVtxYNCfromDstar","hSecVtxY_NoCuts_FromDStar",1000,-3000.,3000.);
1668   TH2F *hSecVtxXYNCfromDstar=new TH2F("hSecVtxXYNCfromDstar","hSecVtxXY_NoCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
1669   TH1F *hSecVtxPhiNCfromDstar=new TH1F("hSecVtxPhiNCfromDstar","hSecVtxPhi_NoCuts_FromDStar",180,-180.1,180.1);
1670   TH1F *hd0singlTrackNCfromDstar=new TH1F("hd0singlTrackNCfromDstar","hd0singlTrackNoCuts_fromDstar",1000,-5000.,5000.);
1671   TH1F *hCPtaNCfromDstar=new TH1F("hCPtaNCfromDstar","hCPta_NoCuts_FromDStar",100,-1.,1.);
1672   TH1F *hd0xd0NCfromDstar=new TH1F("hd0xd0NCfromDstar","hd0xd0_NoCuts_FromDStar",1000,-100000.,100000.);
1673   TH1F *hMassTrueNCfromDstar=new TH1F("hMassTrueNCfromDstar","D^{0} MC inv. Mass No Cuts FromDStar(All momenta)",600,1.600,2.200);
1674   TH1F *hMassNCfromDstar=new TH1F("hMassNCfromDstar","D^{0} inv. Mass No Cuts FromDStar (All momenta)",600,1.600,2.200);
1675   hMassNCfromDstar->Sumw2();
1676   TH1F *hMassTrueNCfromDstarPM=new TH1F("hMassTrueNCfromDstarPM","D^{0} MC inv. Mass No Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
1677   TH1F *hMassNCfromDstarPM=new TH1F("hMassNCfromDstarPM","D^{0} inv. Mass No Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
1678   hMassNCfromDstarPM->Sumw2();
1679   TH1F *hMassTrueNCfromDstarSB=new TH1F("hMassTrueNCfromDstarSB","D^{0} MC inv. Mass in Side Bands No Cuts FromDStar(All momenta)",600,1.600,2.200);
1680   TH1F *hMassNCfromDstarSB=new TH1F("hMassNCfromDstarSB","D^{0} inv. Mass in Side Bands No Cuts FromDStar (All momenta)",600,1.600,2.200);
1681   hMassNCfromDstarSB->Sumw2();
1682
1683   flistNoCutsFromDstar->Add(hCPtaVSd0d0NCfromDstar);
1684   flistNoCutsFromDstar->Add(hSecVtxZNCfromDstar);
1685   flistNoCutsFromDstar->Add(hSecVtxYNCfromDstar);
1686   flistNoCutsFromDstar->Add(hSecVtxXNCfromDstar);
1687   flistNoCutsFromDstar->Add(hSecVtxXYNCfromDstar);
1688   flistNoCutsFromDstar->Add(hSecVtxPhiNCfromDstar);
1689   flistNoCutsFromDstar->Add(hd0singlTrackNCfromDstar);
1690   flistNoCutsFromDstar->Add(hCPtaNCfromDstar);
1691   flistNoCutsFromDstar->Add(hd0xd0NCfromDstar);
1692   flistNoCutsFromDstar->Add(hMassTrueNCfromDstar);
1693   flistNoCutsFromDstar->Add(hMassNCfromDstar);
1694   flistNoCutsFromDstar->Add(hMassTrueNCfromDstarPM);
1695   flistNoCutsFromDstar->Add(hMassNCfromDstarPM);
1696   flistNoCutsFromDstar->Add(hMassTrueNCfromDstarSB);
1697   flistNoCutsFromDstar->Add(hMassNCfromDstarSB);
1698
1699
1700
1701
1702 //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1703   TH1F *hdcaNCfromDstar=new TH1F("hdcaNCfromDstar","hdca_NoCuts_FromDstar",100,0.,1000.);
1704   hdcaNCfromDstar->SetXTitle("dca   [#mum]");
1705   hdcaNCfromDstar->SetYTitle("Entries");
1706   TH1F *hcosthetastarNCfromDstar=new TH1F("hcosthetastarNCfromDstar","hCosThetaStar_NoCuts_FromDstar",50,-1.,1.);
1707   hcosthetastarNCfromDstar->SetXTitle("cos #theta^{*}");
1708   hcosthetastarNCfromDstar->SetYTitle("Entries");
1709   TH1F *hptD0NCfromDstar=new TH1F("hptD0NCfromDstar","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1710   hptD0NCfromDstar->SetXTitle("p_{t}  [GeV/c]");
1711   hptD0NCfromDstar->SetYTitle("Entries");
1712   TH1F *hptD0VsMaxPtNCfromDstar=new TH1F("hptD0VsMaxPtNCfromDstar","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1713   TH2F *hptD0PTallsqrtNCfromDstar=new TH2F("hptD0PTallsqrtNCfromDstar","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1714   TH2F *hptD0PTallNCfromDstar=new TH2F("hptD0PTallNCfromDstar","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1715   TH2F *hptD0vsptBNCfromDstar=new TH2F("hptD0vsptBNCfromDstar","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1716   TH2F *hpD0vspBNCfromDstar=new TH2F("hpD0vspBNCfromDstar","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1717   TH2F *hptD0vsptcquarkNCfromDstar=new TH2F("hptD0vsptcquarkNCfromDstar","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1718   TH2F *hpD0vspcquarkNCfromDstar=new TH2F("hpD0vspcquarkNCfromDstar","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1719   flistNoCutsFromDstar->Add(hdcaNCfromDstar);
1720   flistNoCutsFromDstar->Add(hcosthetastarNCfromDstar);
1721   flistNoCutsFromDstar->Add(hptD0NCfromDstar);
1722   flistNoCutsFromDstar->Add(hptD0VsMaxPtNCfromDstar);
1723   flistNoCutsFromDstar->Add(hptD0PTallsqrtNCfromDstar);
1724   flistNoCutsFromDstar->Add(hptD0PTallNCfromDstar);
1725   flistNoCutsFromDstar->Add(hptD0vsptBNCfromDstar);
1726   flistNoCutsFromDstar->Add(hpD0vspBNCfromDstar);
1727   flistNoCutsFromDstar->Add(hptD0vsptcquarkNCfromDstar);
1728   flistNoCutsFromDstar->Add(hpD0vspcquarkNCfromDstar);
1729  
1730   TH1F *hd0zD0ptNCfromDstar;
1731   TH1F *hInvMassD0NCfromDstar,*hInvMassD0barNCfromDstar;
1732   TH2F *hInvMassPtNCfromDstar=new TH2F("hInvMassPtNCfromDstar","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1733  THnSparseF *hSparseNCfromDstar=new THnSparseF("hSparseNCfromDstar","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1734   hSparseNCfromDstar->SetBinEdges(0,massbins);
1735   hSparseNCfromDstar->SetBinEdges(1,massbins);
1736   hSparseNCfromDstar->SetBinEdges(2,ptbinsForNsparse);
1737   hSparseNCfromDstar->SetBinEdges(3,impparbins);
1738   hSparseNCfromDstar->SetBinEdges(4,massHypoBins); 
1739   flistNoCutsFromDstar->Add(hSparseNCfromDstar);
1740   TH1F *hetaNCfromDstar;
1741   TH1F *hCosPDPBNCfromDstar;
1742   TH1F *hCosPcPDNCfromDstar;
1743   flistNoCutsFromDstar->Add(hInvMassPtNCfromDstar);
1744   // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1745   TH2F *hd0D0VSd0xd0NCfromDstarpt;
1746   TH2F *hangletracksVSd0xd0NCfromDstarpt;
1747   TH2F *hangletracksVSd0D0NCfromDstarpt;
1748   TH1F *hd0xd0NCfromDstarpt;
1749
1750   TH2F *hTOFpidNCfromDstar=new TH2F("hTOFpidNCfromDstar","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1751   flistNoCutsFromDstar->Add(hTOFpidNCfromDstar);
1752
1753   for(Int_t i=0;i<fnbins;i++){
1754     namehist="hd0zD0ptNCfromDstar_pt";
1755     namehist+=i;
1756     titlehist="d0(z) No Cuts FromDstarm ptbin=";
1757     titlehist+=i;
1758     hd0zD0ptNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1759     hd0zD0ptNCfromDstar->SetXTitle("d_{0}(z)    [#mum]");
1760     hd0zD0ptNCfromDstar->SetYTitle("Entries");
1761     flistNoCutsFromDstar->Add(hd0zD0ptNCfromDstar);
1762
1763     namehist="hInvMassD0NCfromDstar_pt";
1764     namehist+=i;
1765     titlehist="Invariant Mass No Cuts FromDstar ptbin=";
1766     titlehist+=i;
1767     hInvMassD0NCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1768     hInvMassD0NCfromDstar->SetXTitle("Invariant Mass    [GeV]");
1769     hInvMassD0NCfromDstar->SetYTitle("Entries");
1770     flistNoCutsFromDstar->Add(hInvMassD0NCfromDstar);
1771
1772
1773    namehist="hInvMassD0barNCfromDstar_pt";
1774     namehist+=i;
1775     titlehist="Invariant Mass D0bar No Cuts FromDstar ptbin=";
1776     titlehist+=i;
1777     hInvMassD0barNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1778     hInvMassD0barNCfromDstar->SetXTitle("Invariant Mass    [GeV]");
1779     hInvMassD0barNCfromDstar->SetYTitle("Entries");
1780     flistNoCutsFromDstar->Add(hInvMassD0barNCfromDstar);
1781
1782
1783
1784     namehist="hetaNCfromDstar_pt";
1785     namehist+=i;
1786     titlehist="eta No Cuts FromDstar ptbin=";
1787     titlehist+=i;
1788     hetaNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1789     hetaNCfromDstar->SetXTitle("Pseudorapidity");
1790     hetaNCfromDstar->SetYTitle("Entries");
1791     flistNoCutsFromDstar->Add(hetaNCfromDstar);
1792
1793     namehist="hCosPDPBNCfromDstar_pt";
1794     namehist+=i;
1795     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1796     titlehist+=i;
1797     hCosPDPBNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1798     hCosPDPBNCfromDstar->SetXTitle("Cosine between D0 momentum and B momentum");
1799     hCosPDPBNCfromDstar->SetYTitle("Entries");
1800     flistNoCutsFromDstar->Add(hCosPDPBNCfromDstar);
1801
1802     namehist="hCosPcPDNCfromDstar_pt";
1803     namehist+=i;
1804     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1805     titlehist+=i;
1806     hCosPcPDNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1807     hCosPcPDNCfromDstar->SetXTitle("Cosine between c quark momentum and D0 momentum");
1808     hCosPcPDNCfromDstar->SetYTitle("Entries");
1809     flistNoCutsFromDstar->Add(hCosPcPDNCfromDstar);
1810   
1811  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1812     namehist="hd0xd0NCfromDstar_pt";
1813     namehist+=i;
1814     titlehist="d0xd0 No Cuts FromDstar ptbin=";
1815     titlehist+=i;
1816     hd0xd0NCfromDstarpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1817     hd0xd0NCfromDstarpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
1818     hd0xd0NCfromDstarpt->SetYTitle("Entries");
1819     flistNoCutsFromDstar->Add(hd0xd0NCfromDstarpt);
1820
1821
1822     namehist="hd0D0VSd0xd0NCfromDstar_pt";
1823     namehist+=i;
1824     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromDstar ptbin=";
1825     titlehist+=i;
1826     hd0D0VSd0xd0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1827     hd0D0VSd0xd0NCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1828     hd0D0VSd0xd0NCfromDstarpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
1829     flistNoCutsFromDstar->Add(hd0D0VSd0xd0NCfromDstarpt);
1830     
1831     
1832     namehist="hangletracksVSd0xd0NCfromDstar_pt";
1833     namehist+=i;
1834     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromDstar ptbin=";
1835     titlehist+=i;
1836     hangletracksVSd0xd0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1837     hangletracksVSd0xd0NCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1838     hangletracksVSd0xd0NCfromDstarpt->SetYTitle(" angle between K and #p tracks  [rad]");
1839     flistNoCutsFromDstar->Add(hangletracksVSd0xd0NCfromDstarpt);
1840     
1841
1842     namehist="hangletracksVSd0D0NCfromDstar_pt";
1843     namehist+=i;
1844     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts FromDstar ptbin=";
1845     titlehist+=i;
1846     hangletracksVSd0D0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1847     hangletracksVSd0D0NCfromDstarpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1848     hangletracksVSd0D0NCfromDstarpt->SetYTitle(" angle between K and #p tracks  [rad]");
1849     flistNoCutsFromDstar->Add(hangletracksVSd0D0NCfromDstarpt);
1850   
1851   }
1852   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1853   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1854
1855
1856   //########## d0 D0 histos #############  
1857   TH1F *hd0D0NCfromDstPM = new TH1F("hd0D0NCfromDstarPM","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1858   hd0D0NCfromDstPM->SetXTitle("Impact parameter [#mum]");
1859   hd0D0NCfromDstPM->SetYTitle("Entries");
1860
1861   TH1F *hd0D0VtxTrueNCfromDstPM = new TH1F("hd0D0VtxTrueNCfromDstarPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1862   hd0D0VtxTrueNCfromDstPM->SetXTitle("Impact parameter [#mum]");
1863   hd0D0VtxTrueNCfromDstPM->SetYTitle("Entries");
1864
1865   TH1F *hMCd0D0NCfromDstPM = new TH1F("hMCd0D0NCfromDstarPM","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
1866   hMCd0D0NCfromDstPM->SetXTitle("MC Impact parameter [#mum]");
1867   hMCd0D0NCfromDstPM->SetYTitle("Entries");
1868
1869   TH1F *hd0D0NCfromDstSB = new TH1F("hd0D0NCfromDstarSB","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1870   hd0D0NCfromDstSB->SetXTitle("Impact parameter [#mum]");
1871   hd0D0NCfromDstSB->SetYTitle("Entries");
1872
1873   TH1F *hd0D0VtxTrueNCfromDstSB = new TH1F("hd0D0VtxTrueNCfromDstarSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
1874   hd0D0VtxTrueNCfromDstSB->SetXTitle("Impact parameter [#mum]");
1875   hd0D0VtxTrueNCfromDstSB->SetYTitle("Entries");
1876
1877   TH1F *hMCd0D0NCfromDstSB = new TH1F("hMCd0D0NCfromDstarSB","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak  (All momenta)",1000,-1000.,1000.);
1878   hMCd0D0NCfromDstSB->SetXTitle("MC Impact parameter [#mum]");
1879   hMCd0D0NCfromDstSB->SetYTitle("Entries");
1880
1881   flistNoCutsFromDstar->Add(hd0D0NCfromDstPM);
1882   flistNoCutsFromDstar->Add(hd0D0VtxTrueNCfromDstPM);
1883   flistNoCutsFromDstar->Add(hMCd0D0NCfromDstPM);
1884   flistNoCutsFromDstar->Add(hd0D0NCfromDstSB);
1885   flistNoCutsFromDstar->Add(hd0D0VtxTrueNCfromDstSB);
1886   flistNoCutsFromDstar->Add(hMCd0D0NCfromDstSB);
1887   
1888   TH1F *hd0D0ptNCfromDstPM;
1889   TH1F *hMCd0D0ptNCfromDstPM;
1890   TH1F *hd0D0VtxTrueptNCfromDstPM;
1891   TH1F *hd0D0ptNCfromDstSB;
1892   TH1F *hMCd0D0ptNCfromDstSB;
1893   TH1F *hd0D0VtxTrueptNCfromDstSB;
1894   namehist="hd0D0ptNCfromDstar_";
1895   titlehist="D^{0} impact par. plot, No Cuts, FromDStar, ";
1896   for(Int_t i=0;i<fnbins;i++){
1897     strnamept=namehist;
1898     strnamept.Append("PkMss_pt");
1899     strnamept+=i;
1900
1901     strtitlept=titlehist;
1902     strtitlept.Append(" Mass Peak, ");
1903     strtitlept+=fptbins[i];
1904     strtitlept.Append("<= pt <");
1905     strtitlept+=fptbins[i+1];
1906     strtitlept.Append(" [GeV/c]");
1907     
1908     hd0D0ptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1909     hd0D0ptNCfromDstPM->SetXTitle("Impact parameter [#mum] ");
1910     hd0D0ptNCfromDstPM->SetYTitle("Entries");
1911     flistNoCutsFromDstar->Add(hd0D0ptNCfromDstPM);
1912
1913     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1914     hMCd0D0ptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1915     hMCd0D0ptNCfromDstPM->SetXTitle("MC Impact parameter [#mum] ");
1916     hMCd0D0ptNCfromDstPM->SetYTitle("Entries");
1917     flistNoCutsFromDstar->Add(hMCd0D0ptNCfromDstPM);
1918  
1919
1920     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1921     hd0D0VtxTrueptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1922     hd0D0VtxTrueptNCfromDstPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1923     hd0D0VtxTrueptNCfromDstPM->SetYTitle("Entries");
1924     flistNoCutsFromDstar->Add(hd0D0VtxTrueptNCfromDstPM);
1925     
1926     strnamept=namehist;
1927     strnamept.Append("SBMss_pt");
1928     strnamept+=i;
1929
1930     strtitlept=titlehist;
1931     strtitlept.Append(" Side Bands, ");
1932     strtitlept+=fptbins[i];
1933     strtitlept.Append("<= pt <");
1934     strtitlept+=fptbins[i+1];
1935     strtitlept.Append(" [GeV/c]");
1936     
1937     hd0D0ptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1938     hd0D0ptNCfromDstSB->SetXTitle("Impact parameter [#mum] ");
1939     hd0D0ptNCfromDstSB->SetYTitle("Entries");
1940     flistNoCutsFromDstar->Add(hd0D0ptNCfromDstSB);
1941
1942     strnamept.ReplaceAll("hd0D0","hMCd0D0");
1943     hMCd0D0ptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1944     hMCd0D0ptNCfromDstSB->SetXTitle("MC Impact parameter [#mum] ");
1945     hMCd0D0ptNCfromDstSB->SetYTitle("Entries");
1946     flistNoCutsFromDstar->Add(hMCd0D0ptNCfromDstSB);
1947
1948     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1949     hd0D0VtxTrueptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1950     hd0D0VtxTrueptNCfromDstSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1951     hd0D0VtxTrueptNCfromDstSB->SetYTitle("Entries");
1952     flistNoCutsFromDstar->Add(hd0D0VtxTrueptNCfromDstSB);
1953   }
1954
1955
1956   //############ NO CUTS OTHER HISTOGRAMS ###########
1957   //
1958   //########### global properties histos ###########
1959
1960   TH2F *hCPtaVSd0d0NCother=new TH2F("hCPtaVSd0d0NCother","hCPtaVSd0d0_NoCuts_other",1000,-100000.,100000.,100,-1.,1.);
1961   TH1F *hSecVtxZNCother=new TH1F("hSecVtxZNCother","hSecVtxZ_NoCuts_other",1000,-8.,8.);
1962   TH1F *hSecVtxXNCother=new TH1F("hSecVtxXNCother","hSecVtxX_NoCuts_other",1000,-3000.,3000.);
1963   TH1F *hSecVtxYNCother=new TH1F("hSecVtxYNCother","hSecVtxY_NoCuts_other",1000,-3000.,3000.);
1964   TH2F *hSecVtxXYNCother=new TH2F("hSecVtxXYNCother","hSecVtxXY_NoCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
1965   TH1F *hSecVtxPhiNCother=new TH1F("hSecVtxPhiNCother","hSecVtxPhi_NoCuts_other",180,-180.1,180.1);
1966   TH1F *hd0singlTrackNCother=new TH1F("hd0singlTrackNCother","hd0singlTrackNoCuts_Other",1000,-5000.,5000.);
1967   TH1F *hCPtaNCother=new TH1F("hCPtaNCother","hCPta_NoCuts_other",100,-1.,1.);
1968   TH1F *hd0xd0NCother=new TH1F("hd0xd0NCother","hd0xd0_NoCuts_other",1000,-100000.,100000.);
1969   TH1F *hMassTrueNCother=new TH1F("hMassTrueNCother","D^{0} MC inv. Mass No Cuts other(All momenta)",600,1.600,2.200);
1970   TH1F *hMassNCother=new TH1F("hMassNCother","D^{0} inv. Mass No Cuts other (All momenta)",600,1.600,2.200);
1971   hMassNCother->Sumw2();
1972   TH1F *hMassTrueNCotherPM=new TH1F("hMassTrueNCotherPM","D^{0} MC inv. Mass No Cuts Other, Mass Peak. (All momenta)",600,1.600,2.200);
1973   TH1F *hMassNCotherPM=new TH1F("hMassNCotherPM","D^{0} inv. Mass No Cuts Other (All momenta), MassPeak",600,1.600,2.200);
1974   hMassNCotherPM->Sumw2();
1975   TH1F *hMassTrueNCotherSB=new TH1F("hMassTrueNCotherSB","D^{0} MC inv. Mass in Side Bands No Cuts other(All momenta)",600,1.600,2.200);
1976   TH1F *hMassNCotherSB=new TH1F("hMassNCotherSB","D^{0} inv. Mass in Side Bands No Cuts other (All momenta)",600,1.600,2.200);
1977   hMassNCotherSB->Sumw2();
1978
1979   flistNoCutsOther->Add(hCPtaVSd0d0NCother);
1980   flistNoCutsOther->Add(hSecVtxZNCother);
1981   flistNoCutsOther->Add(hSecVtxYNCother);
1982   flistNoCutsOther->Add(hSecVtxXNCother);
1983   flistNoCutsOther->Add(hSecVtxXYNCother);
1984   flistNoCutsOther->Add(hSecVtxPhiNCother);
1985   flistNoCutsOther->Add(hd0singlTrackNCother);
1986   flistNoCutsOther->Add(hCPtaNCother);
1987   flistNoCutsOther->Add(hd0xd0NCother);
1988   flistNoCutsOther->Add(hMassTrueNCother);
1989   flistNoCutsOther->Add(hMassNCother);
1990   flistNoCutsOther->Add(hMassTrueNCotherPM);
1991   flistNoCutsOther->Add(hMassNCotherPM);
1992   flistNoCutsOther->Add(hMassTrueNCotherSB);
1993   flistNoCutsOther->Add(hMassNCotherSB);
1994
1995
1996
1997  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1998   TH1F *hdcaNCother=new TH1F("hdcaNCother","hdca_NoCuts_Other",100,0.,1000.);
1999   hdcaNCother->SetXTitle("dca   [#mum]");
2000   hdcaNCother->SetYTitle("Entries");
2001   TH1F *hcosthetastarNCother=new TH1F("hcosthetastarNCother","hCosThetaStar_NoCuts_Other",50,-1.,1.);
2002   hcosthetastarNCother->SetXTitle("cos #theta^{*}");
2003   hcosthetastarNCother->SetYTitle("Entries");
2004   TH1F *hptD0NCother=new TH1F("hptD0NCother","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2005   hptD0NCother->SetXTitle("p_{t}  [GeV/c]");
2006   hptD0NCother->SetYTitle("Entries");
2007   TH1F *hptD0VsMaxPtNCother=new TH1F("hptD0VsMaxPtNCother","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2008   TH2F *hptD0PTallsqrtNCother=new TH2F("hptD0PTallsqrtNCother","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2009   TH2F *hptD0PTallNCother=new TH2F("hptD0PTallNCother","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2010   TH2F *hptD0vsptBNCother=new TH2F("hptD0vsptBNCother","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2011   TH2F *hpD0vspBNCother=new TH2F("hpD0vspBNCother","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2012   TH2F *hptD0vsptcquarkNCother=new TH2F("hptD0vsptcquarkNCother","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2013   TH2F *hpD0vspcquarkNCother=new TH2F("hpD0vspcquarkNCother","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2014   flistNoCutsOther->Add(hdcaNCother);
2015   flistNoCutsOther->Add(hcosthetastarNCother);
2016   flistNoCutsOther->Add(hptD0NCother);
2017   flistNoCutsOther->Add(hptD0VsMaxPtNCother);
2018   flistNoCutsOther->Add(hptD0PTallsqrtNCother);
2019   flistNoCutsOther->Add(hptD0PTallNCother);
2020   flistNoCutsOther->Add(hptD0vsptBNCother);
2021   flistNoCutsOther->Add(hpD0vspBNCother);
2022   flistNoCutsOther->Add(hptD0vsptcquarkNCother);
2023   flistNoCutsOther->Add(hpD0vspcquarkNCother);
2024
2025   TH1F *hd0zD0ptNCother;
2026   TH1F *hInvMassD0NCother,*hInvMassD0barNCother;
2027   TH2F *hInvMassPtNCother=new TH2F("hInvMassPtNCother","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2028  THnSparseF *hSparseNCother=new THnSparseF("hSparseNCother","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2029   hSparseNCother->SetBinEdges(0,massbins);
2030   hSparseNCother->SetBinEdges(1,massbins);
2031   hSparseNCother->SetBinEdges(2,ptbinsForNsparse);
2032   hSparseNCother->SetBinEdges(3,impparbins);
2033   hSparseNCother->SetBinEdges(4,massHypoBins); 
2034   flistNoCutsOther->Add(hSparseNCother);
2035   TH1F *hetaNCother;
2036   TH1F *hCosPDPBNCother;
2037   TH1F *hCosPcPDNCother;
2038   flistNoCutsOther->Add(hInvMassPtNCother);
2039   // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2040   TH2F *hd0D0VSd0xd0NCotherpt;
2041   TH2F *hangletracksVSd0xd0NCotherpt;
2042   TH2F *hangletracksVSd0D0NCotherpt;
2043   TH1F *hd0xd0NCotherpt;
2044
2045   TH2F *hTOFpidNCother=new TH2F("hTOFpidNCother","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2046   flistNoCutsOther->Add(hTOFpidNCother);
2047
2048   for(Int_t i=0;i<fnbins;i++){
2049     namehist="hd0zD0ptNCother_pt";
2050     namehist+=i;
2051     titlehist="d0(z) No Cuts Otherm ptbin=";
2052     titlehist+=i;
2053     hd0zD0ptNCother=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2054     hd0zD0ptNCother->SetXTitle("d_{0}(z)    [#mum]");
2055     hd0zD0ptNCother->SetYTitle("Entries");
2056     flistNoCutsOther->Add(hd0zD0ptNCother);
2057
2058     namehist="hInvMassD0NCother_pt";
2059     namehist+=i;
2060     titlehist="Invariant Mass No Cuts Other ptbin=";
2061     titlehist+=i;
2062     hInvMassD0NCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2063     hInvMassD0NCother->SetXTitle("Invariant Mass    [GeV]");
2064     hInvMassD0NCother->SetYTitle("Entries");
2065     flistNoCutsOther->Add(hInvMassD0NCother);
2066
2067
2068    namehist="hInvMassD0barNCother_pt";
2069     namehist+=i;
2070     titlehist="Invariant Mass D0bar No Cuts Other ptbin=";
2071     titlehist+=i;
2072     hInvMassD0barNCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2073     hInvMassD0barNCother->SetXTitle("Invariant Mass    [GeV]");
2074     hInvMassD0barNCother->SetYTitle("Entries");
2075     flistNoCutsOther->Add(hInvMassD0barNCother);
2076
2077
2078     namehist="hetaNCother_pt";
2079     namehist+=i;
2080     titlehist="eta No Cuts Other ptbin=";
2081     titlehist+=i;
2082     hetaNCother=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2083     hetaNCother->SetXTitle("Pseudorapidity");
2084     hetaNCother->SetYTitle("Entries");
2085     flistNoCutsOther->Add(hetaNCother);
2086
2087     namehist="hCosPDPBNCother_pt";
2088     namehist+=i;
2089     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2090     titlehist+=i;
2091     hCosPDPBNCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2092     hCosPDPBNCother->SetXTitle("Cosine between D0 momentum and B momentum");
2093     hCosPDPBNCother->SetYTitle("Entries");
2094     flistNoCutsOther->Add(hCosPDPBNCother);
2095
2096     namehist="hCosPcPDNCother_pt";
2097     namehist+=i;
2098     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2099     titlehist+=i;
2100     hCosPcPDNCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2101     hCosPcPDNCother->SetXTitle("Cosine between c quark momentum and D0 momentum");
2102     hCosPcPDNCother->SetYTitle("Entries");
2103     flistNoCutsOther->Add(hCosPcPDNCother);
2104     
2105
2106  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2107     namehist="hd0xd0NCother_pt";
2108     namehist+=i;
2109     titlehist="d0xd0 No Cuts Other ptbin=";
2110     titlehist+=i;
2111     hd0xd0NCotherpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2112     hd0xd0NCotherpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
2113     hd0xd0NCotherpt->SetYTitle("Entries");
2114     flistNoCutsOther->Add(hd0xd0NCotherpt);
2115
2116
2117     namehist="hd0D0VSd0xd0NCother_pt";
2118     namehist+=i;
2119     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Other ptbin=";
2120     titlehist+=i;
2121     hd0D0VSd0xd0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2122     hd0D0VSd0xd0NCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2123     hd0D0VSd0xd0NCotherpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
2124     flistNoCutsOther->Add(hd0D0VSd0xd0NCotherpt);
2125     
2126     
2127     namehist="hangletracksVSd0xd0NCother_pt";
2128     namehist+=i;
2129     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Other ptbin=";
2130     titlehist+=i;
2131     hangletracksVSd0xd0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2132     hangletracksVSd0xd0NCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2133     hangletracksVSd0xd0NCotherpt->SetYTitle(" angle between K and #p tracks  [rad]");
2134     flistNoCutsOther->Add(hangletracksVSd0xd0NCotherpt);
2135     
2136
2137     namehist="hangletracksVSd0D0NCother_pt";
2138     namehist+=i;
2139     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Other ptbin=";
2140     titlehist+=i;
2141     hangletracksVSd0D0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2142     hangletracksVSd0D0NCotherpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2143     hangletracksVSd0D0NCotherpt->SetYTitle(" angle between K and #p tracks  [rad]");
2144     flistNoCutsOther->Add(hangletracksVSd0D0NCotherpt);
2145
2146   }
2147   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2148   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2149
2150
2151
2152
2153   //############# d0 D0 histos ###############à
2154   TH1F *hd0D0NCotherPM = new TH1F("hd0D0NCotherPM","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2155   hd0D0NCotherPM->SetXTitle("Impact parameter [#mum]");
2156   hd0D0NCotherPM->SetYTitle("Entries");
2157
2158   TH1F *hd0D0VtxTrueNCotherPM = new TH1F("hd0D0VtxTrueNCotherPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2159   hd0D0VtxTrueNCotherPM->SetXTitle("Impact parameter [#mum]");
2160   hd0D0VtxTrueNCotherPM->SetYTitle("Entries");
2161
2162   TH1F *hMCd0D0NCotherPM = new TH1F("hMCd0D0NCotherPM","D^{0} impact par. plot, No Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
2163   hMCd0D0NCotherPM->SetXTitle("MC Impact parameter [#mum]");
2164   hMCd0D0NCotherPM->SetYTitle("Entries");
2165
2166   TH1F *hd0D0NCotherSB = new TH1F("hd0D0NCotherSB","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2167   hd0D0NCotherSB->SetXTitle("Impact parameter [#mum]");
2168   hd0D0NCotherSB->SetYTitle("Entries");
2169
2170   TH1F *hd0D0VtxTrueNCotherSB = new TH1F("hd0D0VtxTrueNCotherSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2171   hd0D0VtxTrueNCotherSB->SetXTitle("Impact parameter [#mum]");
2172   hd0D0VtxTrueNCotherSB->SetYTitle("Entries");
2173
2174   TH1F *hMCd0D0NCotherSB = new TH1F("hMCd0D0NCotherSB","D^{0} impact par. plot, No Cuts, Other,Mass Peak  (All momenta)",1000,-1000.,1000.);
2175   hMCd0D0NCotherSB->SetXTitle("MC Impact parameter [#mum]");
2176   hMCd0D0NCotherSB->SetYTitle("Entries");
2177
2178   flistNoCutsOther->Add(hd0D0NCotherPM);
2179   flistNoCutsOther->Add(hd0D0VtxTrueNCotherPM);
2180   flistNoCutsOther->Add(hMCd0D0NCotherPM);
2181   flistNoCutsOther->Add(hd0D0NCotherSB);
2182   flistNoCutsOther->Add(hd0D0VtxTrueNCotherSB);
2183   flistNoCutsOther->Add(hMCd0D0NCotherSB);
2184   
2185   TH1F *hd0D0ptNCotherPM;
2186   TH1F *hMCd0D0ptNCotherPM;
2187   TH1F *hd0D0VtxTrueptNCotherPM;
2188   TH1F *hd0D0ptNCotherSB;
2189   TH1F *hMCd0D0ptNCotherSB;
2190   TH1F *hd0D0VtxTrueptNCotherSB;
2191   namehist="hd0D0ptNCother_";
2192   titlehist="D^{0} impact par. plot, No Cuts, Other, ";
2193   for(Int_t i=0;i<fnbins;i++){
2194     strnamept=namehist;
2195     strnamept.Append("PkMss_pt");
2196     strnamept+=i;
2197
2198     strtitlept=titlehist;
2199     strtitlept.Append(" Mass Peak, ");
2200     strtitlept+=fptbins[i];
2201     strtitlept.Append("<= pt <");
2202     strtitlept+=fptbins[i+1];
2203     strtitlept.Append(" [GeV/c]");
2204     
2205     hd0D0ptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2206     hd0D0ptNCotherPM->SetXTitle("Impact parameter [#mum] ");
2207     hd0D0ptNCotherPM->SetYTitle("Entries");
2208     flistNoCutsOther->Add(hd0D0ptNCotherPM);
2209
2210     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2211     hMCd0D0ptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2212     hMCd0D0ptNCotherPM->SetXTitle("MC Impact parameter [#mum] ");
2213     hMCd0D0ptNCotherPM->SetYTitle("Entries");
2214     flistNoCutsOther->Add(hMCd0D0ptNCotherPM);
2215  
2216
2217     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2218     hd0D0VtxTrueptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2219     hd0D0VtxTrueptNCotherPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2220     hd0D0VtxTrueptNCotherPM->SetYTitle("Entries");
2221     flistNoCutsOther->Add(hd0D0VtxTrueptNCotherPM);
2222     
2223     strnamept=namehist;
2224     strnamept.Append("SBMss_pt");
2225     strnamept+=i;
2226
2227     strtitlept=titlehist;
2228     strtitlept.Append(" Side Bands, ");
2229     strtitlept+=fptbins[i];
2230     strtitlept.Append("<= pt <");
2231     strtitlept+=fptbins[i+1];
2232     strtitlept.Append(" [GeV/c]");
2233     
2234     hd0D0ptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2235     hd0D0ptNCotherSB->SetXTitle("Impact parameter [#mum] ");
2236     hd0D0ptNCotherSB->SetYTitle("Entries");
2237     flistNoCutsOther->Add(hd0D0ptNCotherSB);
2238
2239     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2240     hMCd0D0ptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2241     hMCd0D0ptNCotherSB->SetXTitle("MC Impact parameter [#mum] ");
2242     hMCd0D0ptNCotherSB->SetYTitle("Entries");
2243     flistNoCutsOther->Add(hMCd0D0ptNCotherSB);
2244
2245     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2246     hd0D0VtxTrueptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2247     hd0D0VtxTrueptNCotherSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2248     hd0D0VtxTrueptNCotherSB->SetYTitle("Entries");
2249     flistNoCutsOther->Add(hd0D0VtxTrueptNCotherSB);
2250   }
2251
2252
2253   //################################################################################################
2254   //                                                                                               #
2255   //                         HISTOS FOR LOOSE CUTS                                                 #
2256   //                                                                                               #
2257   //################################################################################################
2258
2259   //############ LOOSE CUTS SIGNAL HISTOGRAMS ###############
2260   //
2261   // ####### global properties histo ############
2262
2263   TH2F *hCPtaVSd0d0LSCsign=new TH2F("hCPtaVSd0d0LSCsign","hCPtaVSd0d0_LooseCuts_Signal",1000,-100000.,100000.,100,-1.,1.);
2264   TH1F *hSecVtxZLSCsign=new TH1F("hSecVtxZLSCsign","hSecVtxZ_LooseCuts_Signal",1000,-8.,8.);
2265   TH1F *hSecVtxXLSCsign=new TH1F("hSecVtxXLSCsign","hSecVtxX_LooseCuts_Signal",1000,-3000.,3000.);
2266   TH1F *hSecVtxYLSCsign=new TH1F("hSecVtxYLSCsign","hSecVtxY_LooseCuts_Signal",1000,-3000.,3000.);
2267   TH2F *hSecVtxXYLSCsign=new TH2F("hSecVtxXYLSCsign","hSecVtxXY_LooseCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
2268   TH1F *hSecVtxPhiLSCsign=new TH1F("hSecVtxPhiLSCsign","hSecVtxPhi_LooseCuts_Signal",180,-180.1,180.1);
2269   TH1F *hd0singlTrackLSCsign=new TH1F("hd0singlTrackLSCsign","hd0singlTrackLooseCuts_Signal",1000,-5000.,5000.);
2270   TH1F *hCPtaLSCsign=new TH1F("hCPtaLSCsign","hCPta_LooseCuts_Signal",100,-1.,1.);
2271   TH1F *hd0xd0LSCsign=new TH1F("hd0xd0LSCsign","hd0xd0_LooseCuts_Signal",1000,-100000.,100000.);
2272   TH1F *hMassTrueLSCsign=new TH1F("hMassTrueLSCsign","D^{0} MC inv. Mass Loose Cuts Signal(All momenta)",600,1.600,2.200);
2273   TH1F *hMassLSCsign=new TH1F("hMassLSCsign","D^{0} inv. Mass Loose Cuts Signal (All momenta)",600,1.600,2.200);
2274   hMassLSCsign->Sumw2();
2275   TH1F *hMassTrueLSCsignPM=new TH1F("hMassTrueLSCsignPM","D^{0} MC inv. Mass Loose Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
2276   TH1F *hMassLSCsignPM=new TH1F("hMassLSCsignPM","D^{0} inv. Mass Loose Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
2277   hMassLSCsignPM->Sumw2();
2278   TH1F *hMassTrueLSCsignSB=new TH1F("hMassTrueLSCsignSB","D^{0} MC inv. Mass in Side Bands Loose Cuts Signal(All momenta)",600,1.600,2.200);
2279   TH1F *hMassLSCsignSB=new TH1F("hMassLSCsignSB","D^{0} inv. Mass in Side Bands Loose Cuts Signal (All momenta)",600,1.600,2.200);
2280   hMassLSCsignSB->Sumw2();
2281
2282   flistLsCutsSignal->Add(hCPtaVSd0d0LSCsign);
2283   flistLsCutsSignal->Add(hSecVtxZLSCsign);
2284   flistLsCutsSignal->Add(hSecVtxYLSCsign);
2285   flistLsCutsSignal->Add(hSecVtxXLSCsign);
2286   flistLsCutsSignal->Add(hSecVtxXYLSCsign);
2287   flistLsCutsSignal->Add(hSecVtxPhiLSCsign);
2288   flistLsCutsSignal->Add(hd0singlTrackLSCsign);
2289   flistLsCutsSignal->Add(hCPtaLSCsign);
2290   flistLsCutsSignal->Add(hd0xd0LSCsign);
2291   flistLsCutsSignal->Add(hMassTrueLSCsign);
2292   flistLsCutsSignal->Add(hMassLSCsign);
2293   flistLsCutsSignal->Add(hMassTrueLSCsignPM);
2294   flistLsCutsSignal->Add(hMassLSCsignPM);
2295   flistLsCutsSignal->Add(hMassTrueLSCsignSB);
2296   flistLsCutsSignal->Add(hMassLSCsignSB);
2297
2298
2299   //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2300   TH1F *hdcaLSCsign=new TH1F("hdcaLSCsign","hdca_LooseCuts_Sign",100,0.,1000.);
2301   hdcaLSCsign->SetXTitle("dca   [#mum]");
2302   hdcaLSCsign->SetYTitle("Entries");
2303   TH1F *hcosthetastarLSCsign=new TH1F("hcosthetastarLSCsign","hCosThetaStar_LooseCuts_Sign",50,-1.,1.);
2304   hcosthetastarLSCsign->SetXTitle("cos #theta^{*}");
2305   hcosthetastarLSCsign->SetYTitle("Entries");
2306   TH1F *hptD0LSCsign=new TH1F("hptD0LSCsign","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2307   hptD0LSCsign->SetXTitle("p_{t}  [GeV/c]");
2308   hptD0LSCsign->SetYTitle("Entries");
2309   TH1F *hptD0VsMaxPtLSCsign=new TH1F("hptD0VsMaxPtLSCsign","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2310   TH2F *hptD0PTallsqrtLSCsign=new TH2F("hptD0PTallsqrtLSCsign","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2311   TH2F *hptD0PTallLSCsign=new TH2F("hptD0PTallLSCsign","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2312   TH2F *hptD0vsptBLSCsign=new TH2F("hptD0vsptBLSCsign","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2313   TH2F *hpD0vspBLSCsign=new TH2F("hpD0vspBLSCsign","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2314   TH2F *hptD0vsptcquarkLSCsign=new TH2F("hptD0vsptcquarkLSCsign","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2315   TH2F *hpD0vspcquarkLSCsign=new TH2F("hpD0vspcquarkLSCsign","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2316   flistLsCutsSignal->Add(hdcaLSCsign);
2317   flistLsCutsSignal->Add(hcosthetastarLSCsign);
2318   flistLsCutsSignal->Add(hptD0LSCsign);
2319   flistLsCutsSignal->Add(hptD0VsMaxPtLSCsign);
2320   flistLsCutsSignal->Add(hptD0PTallsqrtLSCsign);
2321   flistLsCutsSignal->Add(hptD0PTallLSCsign);
2322   flistLsCutsSignal->Add(hptD0vsptBLSCsign);
2323   flistLsCutsSignal->Add(hpD0vspBLSCsign);
2324   flistLsCutsSignal->Add(hptD0vsptcquarkLSCsign);
2325   flistLsCutsSignal->Add(hpD0vspcquarkLSCsign);
2326  
2327   TH1F *hd0zD0ptLSCsign;
2328   TH1F *hInvMassD0LSCsign,*hInvMassD0barLSCsign;
2329   TH2F *hInvMassPtLSCsign=new TH2F("hInvMassPtLSCsign","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2330  THnSparseF *hSparseLSCsign=new THnSparseF("hSparseLSCsign","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2331   hSparseLSCsign->SetBinEdges(0,massbins);
2332   hSparseLSCsign->SetBinEdges(1,massbins);
2333   hSparseLSCsign->SetBinEdges(2,ptbinsForNsparse);
2334   hSparseLSCsign->SetBinEdges(3,impparbins);
2335   hSparseLSCsign->SetBinEdges(4,massHypoBins); 
2336   flistLsCutsSignal->Add(hSparseLSCsign);
2337   TH1F *hetaLSCsign;
2338   TH1F *hCosPDPBLSCsign;
2339   TH1F *hCosPcPDLSCsign;
2340   flistLsCutsSignal->Add(hInvMassPtLSCsign);
2341
2342
2343   
2344  THnSparseF *hSparseCxyLxyLSCsign=new THnSparseF("hSparseCxyLxyLSCsign","Candidate Mass;massD0;Pt;CosXY;Lxy",4,nbinsSparsCxyLxy,binLowLimitSparseCxyLxy,binUpLimitSparseCxyLxy);
2345   hSparseCxyLxyLSCsign->SetBinEdges(1,ptbinlimitsCxyLxy); 
2346   hSparseCxyLxyLSCsign->GetAxis(0)->SetName("mass");
2347   hSparseCxyLxyLSCsign->GetAxis(0)->SetTitle("Invariant Mass (K#pi) [GeV/c^{2}]");
2348   hSparseCxyLxyLSCsign->GetAxis(1)->SetName("pt");
2349   hSparseCxyLxyLSCsign->GetAxis(1)->SetTitle("p_{t} [GeV/c]");
2350   hSparseCxyLxyLSCsign->GetAxis(2)->SetName("CosPointXY");
2351   hSparseCxyLxyLSCsign->GetAxis(2)->SetTitle("Cos#theta_{point}^{XY}");
2352   hSparseCxyLxyLSCsign->GetAxis(3)->SetName("NormDecLengthXY");
2353   hSparseCxyLxyLSCsign->GetAxis(3)->SetTitle("Normalized XY decay length");
2354
2355   flistLsCutsSignal->Add(hSparseCxyLxyLSCsign);
2356   // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2357   TH2F *hd0D0VSd0xd0LSCsignpt;
2358   TH2F *hangletracksVSd0xd0LSCsignpt;
2359   TH2F *hangletracksVSd0D0LSCsignpt;
2360   TH1F *hd0xd0LSCsignpt;
2361   TH1F *hPhiHistPMLSCsignpt,*hPhiHistSBLSCsignpt;
2362
2363   TH2F *hTOFpidLSCsign=new TH2F("hTOFpidLSCsign","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2364   flistLsCutsSignal->Add(hTOFpidLSCsign);
2365
2366   for(Int_t i=0;i<fnbins;i++){
2367  
2368     namehist="hPhiHistPMLSCsign_pt";
2369     namehist+=i;
2370     titlehist="Azimuthal correlation LS Cuts Sign PM ptbin=";
2371     titlehist+=i;
2372     hPhiHistPMLSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
2373     hPhiHistPMLSCsignpt->Sumw2();
2374     flistLsCutsSignal->Add(hPhiHistPMLSCsignpt);
2375
2376     namehist="hPhiHistSBLSCsign_pt";
2377     namehist+=i;
2378     titlehist="Azimuthal correlation LS Cuts Sign SB ptbin=";
2379     titlehist+=i;
2380     hPhiHistSBLSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
2381     hPhiHistSBLSCsignpt->Sumw2();
2382     flistLsCutsSignal->Add(hPhiHistSBLSCsignpt);
2383
2384   
2385
2386     namehist="hd0zD0ptLSCsign_pt";
2387     namehist+=i;
2388     titlehist="d0(z) Loose Cuts Signm ptbin=";
2389     titlehist+=i;
2390     hd0zD0ptLSCsign=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2391     hd0zD0ptLSCsign->SetXTitle("d_{0}(z)    [#mum]");
2392     hd0zD0ptLSCsign->SetYTitle("Entries");
2393     flistLsCutsSignal->Add(hd0zD0ptLSCsign);
2394
2395     namehist="hInvMassD0LSCsign_pt";
2396     namehist+=i;
2397     titlehist="Invariant Mass Loose Cuts Sign ptbin=";
2398     titlehist+=i;
2399     hInvMassD0LSCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2400     hInvMassD0LSCsign->SetXTitle("Invariant Mass    [GeV]");
2401     hInvMassD0LSCsign->SetYTitle("Entries");
2402     flistLsCutsSignal->Add(hInvMassD0LSCsign);
2403
2404
2405     namehist="hInvMassD0barLSCsign_pt";
2406     namehist+=i;
2407     titlehist="Invariant Mass D0bar Loose Cuts Signal ptbin=";
2408     titlehist+=i;
2409     hInvMassD0barLSCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2410     hInvMassD0barLSCsign->SetXTitle("Invariant Mass    [GeV]");
2411     hInvMassD0barLSCsign->SetYTitle("Entries");
2412     flistLsCutsSignal->Add(hInvMassD0barLSCsign);
2413
2414     namehist="hetaLSCsign_pt";
2415     namehist+=i;
2416     titlehist="eta Loose Cuts Sign ptbin=";
2417     titlehist+=i;
2418     hetaLSCsign=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2419     hetaLSCsign->SetXTitle("Pseudorapidity");
2420     hetaLSCsign->SetYTitle("Entries");
2421     flistLsCutsSignal->Add(hetaLSCsign);
2422
2423     namehist="hCosPDPBLSCsign_pt";
2424     namehist+=i;
2425     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2426     titlehist+=i;
2427     hCosPDPBLSCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2428     hCosPDPBLSCsign->SetXTitle("Cosine between D0 momentum and B momentum");
2429     hCosPDPBLSCsign->SetYTitle("Entries");
2430     flistLsCutsSignal->Add(hCosPDPBLSCsign);
2431
2432     namehist="hCosPcPDLSCsign_pt";
2433     namehist+=i;
2434     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2435     titlehist+=i;
2436     hCosPcPDLSCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2437     hCosPcPDLSCsign->SetXTitle("Cosine between c quark momentum and D0 momentum");
2438     hCosPcPDLSCsign->SetYTitle("Entries");
2439     flistLsCutsSignal->Add(hCosPcPDLSCsign);
2440
2441
2442  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2443     namehist="hd0xd0LSCsign_pt";
2444     namehist+=i;
2445     titlehist="d0xd0 Loose Cuts Sign ptbin=";
2446     titlehist+=i;
2447     hd0xd0LSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2448     hd0xd0LSCsignpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
2449     hd0xd0LSCsignpt->SetYTitle("Entries");
2450     flistLsCutsSignal->Add(hd0xd0LSCsignpt);
2451
2452
2453     namehist="hd0D0VSd0xd0LSCsign_pt";
2454     namehist+=i;
2455     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Sign ptbin=";
2456     titlehist+=i;
2457     hd0D0VSd0xd0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2458     hd0D0VSd0xd0LSCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2459     hd0D0VSd0xd0LSCsignpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
2460     flistLsCutsSignal->Add(hd0D0VSd0xd0LSCsignpt);
2461     
2462     
2463     namehist="hangletracksVSd0xd0LSCsign_pt";
2464     namehist+=i;
2465     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Sign ptbin=";
2466     titlehist+=i;
2467     hangletracksVSd0xd0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2468     hangletracksVSd0xd0LSCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2469     hangletracksVSd0xd0LSCsignpt->SetYTitle(" angle between K and #p tracks  [rad]");
2470     flistLsCutsSignal->Add(hangletracksVSd0xd0LSCsignpt);
2471     
2472
2473     namehist="hangletracksVSd0D0LSCsign_pt";
2474     namehist+=i;
2475     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Sign ptbin=";
2476     titlehist+=i;
2477     hangletracksVSd0D0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2478     hangletracksVSd0D0LSCsignpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2479     hangletracksVSd0D0LSCsignpt->SetYTitle(" angle between K and #p tracks  [rad]");
2480     flistLsCutsSignal->Add(hangletracksVSd0D0LSCsignpt);
2481
2482     
2483   }
2484   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2485   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2486
2487
2488   // ####### d0 D0 histos ############
2489   TH1F *hd0D0LSCsignPM = new TH1F("hd0D0LSCsignPM","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2490   hd0D0LSCsignPM->SetXTitle("Impact parameter [#mum]");
2491   hd0D0LSCsignPM->SetYTitle("Entries");
2492
2493   TH1F *hd0D0VtxTrueLSCsignPM = new TH1F("hd0D0VtxTrueLSCsignPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2494   hd0D0VtxTrueLSCsignPM->SetXTitle("Impact parameter [#mum]");
2495   hd0D0VtxTrueLSCsignPM->SetYTitle("Entries");
2496
2497   TH1F *hMCd0D0LSCsignPM = new TH1F("hMCd0D0LSCsignPM","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
2498   hMCd0D0LSCsignPM->SetXTitle("MC Impact parameter [#mum]");
2499   hMCd0D0LSCsignPM->SetYTitle("Entries");
2500
2501   TH1F *hd0D0LSCsignSB = new TH1F("hd0D0LSCsignSB","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2502   hd0D0LSCsignSB->SetXTitle("Impact parameter [#mum]");
2503   hd0D0LSCsignSB->SetYTitle("Entries");
2504
2505   TH1F *hd0D0VtxTrueLSCsignSB = new TH1F("hd0D0VtxTrueLSCsignSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2506   hd0D0VtxTrueLSCsignSB->SetXTitle("Impact parameter [#mum]");
2507   hd0D0VtxTrueLSCsignSB->SetYTitle("Entries");
2508
2509   TH1F *hMCd0D0LSCsignSB = new TH1F("hMCd0D0LSCsignSB","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak  (All momenta)",1000,-1000.,1000.);
2510   hMCd0D0LSCsignSB->SetXTitle("MC Impact parameter [#mum]");
2511   hMCd0D0LSCsignSB->SetYTitle("Entries");
2512
2513   flistLsCutsSignal->Add(hd0D0LSCsignPM);
2514   flistLsCutsSignal->Add(hd0D0VtxTrueLSCsignPM);
2515   flistLsCutsSignal->Add(hMCd0D0LSCsignPM);
2516   flistLsCutsSignal->Add(hd0D0LSCsignSB);
2517   flistLsCutsSignal->Add(hd0D0VtxTrueLSCsignSB);
2518   flistLsCutsSignal->Add(hMCd0D0LSCsignSB);
2519   
2520   TH1F *hd0D0ptLSCsignPM;
2521   TH1F *hMCd0D0ptLSCsignPM;
2522   TH1F *hd0D0VtxTrueptLSCsignPM;
2523   TH1F *hd0D0ptLSCsignSB;
2524   TH1F *hMCd0D0ptLSCsignSB;
2525   TH1F *hd0D0VtxTrueptLSCsignSB;
2526   namehist="hd0D0ptLSCsign_";
2527   titlehist="D^{0} impact par. plot, Loose Cuts, Signal, ";
2528   for(Int_t i=0;i<fnbins;i++){
2529     strnamept=namehist;
2530     strnamept.Append("PkMss_pt");
2531     strnamept+=i;
2532
2533     strtitlept=titlehist;
2534     strtitlept.Append(" Mass Peak, ");
2535     strtitlept+=fptbins[i];
2536     strtitlept.Append("<= pt <");
2537     strtitlept+=fptbins[i+1];
2538     strtitlept.Append(" [GeV/c]");
2539     
2540     hd0D0ptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2541     hd0D0ptLSCsignPM->SetXTitle("Impact parameter [#mum] ");
2542     hd0D0ptLSCsignPM->SetYTitle("Entries");
2543     flistLsCutsSignal->Add(hd0D0ptLSCsignPM);
2544
2545     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2546     hMCd0D0ptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2547     hMCd0D0ptLSCsignPM->SetXTitle("MC Impact parameter [#mum] ");
2548     hMCd0D0ptLSCsignPM->SetYTitle("Entries");
2549     flistLsCutsSignal->Add(hMCd0D0ptLSCsignPM);
2550  
2551
2552     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2553     hd0D0VtxTrueptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2554     hd0D0VtxTrueptLSCsignPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2555     hd0D0VtxTrueptLSCsignPM->SetYTitle("Entries");
2556     flistLsCutsSignal->Add(hd0D0VtxTrueptLSCsignPM);
2557     
2558     strnamept=namehist;
2559     strnamept.Append("SBMss_pt");
2560     strnamept+=i;
2561
2562     strtitlept=titlehist;
2563     strtitlept.Append(" Side Bands, ");
2564     strtitlept+=fptbins[i];
2565     strtitlept.Append("<= pt <");
2566     strtitlept+=fptbins[i+1];
2567     strtitlept.Append(" [GeV/c]");
2568     
2569     hd0D0ptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2570     hd0D0ptLSCsignSB->SetXTitle("Impact parameter [#mum] ");
2571     hd0D0ptLSCsignSB->SetYTitle("Entries");
2572     flistLsCutsSignal->Add(hd0D0ptLSCsignSB);
2573
2574     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2575     hMCd0D0ptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2576     hMCd0D0ptLSCsignSB->SetXTitle("MC Impact parameter [#mum] ");
2577     hMCd0D0ptLSCsignSB->SetYTitle("Entries");
2578     flistLsCutsSignal->Add(hMCd0D0ptLSCsignSB);
2579
2580     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2581     hd0D0VtxTrueptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2582     hd0D0VtxTrueptLSCsignSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2583     hd0D0VtxTrueptLSCsignSB->SetYTitle("Entries");
2584     flistLsCutsSignal->Add(hd0D0VtxTrueptLSCsignSB);
2585   }
2586
2587
2588   //############ LOOSE CUTS BACKGROUND HISTOGRAMS ###########
2589   //
2590   //   ######## global properties histos #######
2591   TH2F *hCPtaVSd0d0LSCback=new TH2F("hCPtaVSd0d0LSCback","hCPtaVSd0d0_LooseCuts_Background",1000,-100000.,100000.,100,-1.,1.);
2592   TH1F *hSecVtxZLSCback=new TH1F("hSecVtxZLSCback","hSecVtxZ_LooseCuts_Background",1000,-8.,8.);
2593   TH1F *hSecVtxXLSCback=new TH1F("hSecVtxXLSCback","hSecVtxX_LooseCuts_Background",1000,-3000.,3000.);
2594   TH1F *hSecVtxYLSCback=new TH1F("hSecVtxYLSCback","hSecVtxY_LooseCuts_Background",1000,-3000.,3000.);
2595   TH2F *hSecVtxXYLSCback=new TH2F("hSecVtxXYLSCback","hSecVtxXY_LooseCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
2596   TH1F *hSecVtxPhiLSCback=new TH1F("hSecVtxPhiLSCback","hSecVtxPhi_LooseCuts_Background",180,-180.1,180.1);
2597   TH1F *hd0singlTrackLSCback=new TH1F("hd0singlTrackLSCback","hd0singlTrackLooseCuts_Back",1000,-5000.,5000.);
2598   TH1F *hCPtaLSCback=new TH1F("hCPtaLSCback","hCPta_LooseCuts_Background",100,-1.,1.);
2599   TH1F *hd0xd0LSCback=new TH1F("hd0xd0LSCback","hd0xd0_LooseCuts_Background",1000,-100000.,100000.);
2600   TH1F *hMassTrueLSCback=new TH1F("hMassTrueLSCback","D^{0} MC inv. Mass Loose Cuts Background(All momenta)",600,1.600,2.200);
2601   TH1F *hMassLSCback=new TH1F("hMassLSCback","D^{0} inv. Mass Loose Cuts Background (All momenta)",600,1.600,2.200);
2602   hMassLSCback->Sumw2();
2603   TH1F *hMassTrueLSCbackPM=new TH1F("hMassTrueLSCbackPM","D^{0} MC inv. Mass Loose Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
2604   TH1F *hMassLSCbackPM=new TH1F("hMassLSCbackPM","D^{0} inv. Mass Loose Cuts Background (All momenta), MassPeak",600,1.600,2.200);
2605   hMassLSCbackPM->Sumw2();
2606   TH1F *hMassTrueLSCbackSB=new TH1F("hMassTrueLSCbackSB","D^{0} MC inv. Mass in Side Bands Loose Cuts Background(All momenta)",600,1.600,2.200);
2607   TH1F *hMassLSCbackSB=new TH1F("hMassLSCbackSB","D^{0} inv. Mass in Side Bands Loose Cuts Background (All momenta)",600,1.600,2.200);
2608   hMassLSCbackSB->Sumw2();
2609
2610   flistLsCutsBack->Add(hCPtaVSd0d0LSCback);
2611   flistLsCutsBack->Add(hSecVtxZLSCback);
2612   flistLsCutsBack->Add(hSecVtxYLSCback);
2613   flistLsCutsBack->Add(hSecVtxXLSCback);
2614   flistLsCutsBack->Add(hSecVtxXYLSCback);
2615   flistLsCutsBack->Add(hSecVtxPhiLSCback);
2616   flistLsCutsBack->Add(hd0singlTrackLSCback);
2617   flistLsCutsBack->Add(hCPtaLSCback);
2618   flistLsCutsBack->Add(hd0xd0LSCback);
2619   flistLsCutsBack->Add(hMassTrueLSCback);
2620   flistLsCutsBack->Add(hMassLSCback);
2621   flistLsCutsBack->Add(hMassTrueLSCbackPM);
2622   flistLsCutsBack->Add(hMassLSCbackPM);
2623   flistLsCutsBack->Add(hMassTrueLSCbackSB);
2624   flistLsCutsBack->Add(hMassLSCbackSB);
2625
2626
2627
2628
2629
2630
2631
2632
2633  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2634   TH1F *hdcaLSCback=new TH1F("hdcaLSCback","hdca_LooseCuts_Backgr",100,0.,1000.);
2635   hdcaLSCback->SetXTitle("dca   [#mum]");
2636   hdcaLSCback->SetYTitle("Entries");
2637   TH1F *hcosthetastarLSCback=new TH1F("hcosthetastarLSCback","hCosThetaStar_LooseCuts_Backgr",50,-1.,1.);
2638   hcosthetastarLSCback->SetXTitle("cos #theta^{*}");
2639   hcosthetastarLSCback->SetYTitle("Entries");
2640   TH1F *hptD0LSCback=new TH1F("hptD0LSCback","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2641   hptD0LSCback->SetXTitle("p_{t}  [GeV/c]");
2642   hptD0LSCback->SetYTitle("Entries");
2643   TH1F *hptD0VsMaxPtLSCback=new TH1F("hptD0VsMaxPtLSCback","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2644   TH2F *hptD0PTallsqrtLSCback=new TH2F("hptD0PTallsqrtLSCback","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2645   TH2F *hptD0PTallLSCback=new TH2F("hptD0PTallLSCback","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2646   TH2F *hptD0vsptBLSCback=new TH2F("hptD0vsptBLSCback","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2647   TH2F *hpD0vspBLSCback=new TH2F("hpD0vspBLSCback","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2648   TH2F *hptD0vsptcquarkLSCback=new TH2F("hptD0vsptcquarkLSCback","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2649   TH2F *hpD0vspcquarkLSCback=new TH2F("hpD0vspcquarkLSCback","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2650   flistLsCutsBack->Add(hdcaLSCback);
2651   flistLsCutsBack->Add(hcosthetastarLSCback);
2652   flistLsCutsBack->Add(hptD0LSCback);
2653   flistLsCutsBack->Add(hptD0VsMaxPtLSCback);
2654   flistLsCutsBack->Add(hptD0PTallsqrtLSCback);
2655   flistLsCutsBack->Add(hptD0PTallLSCback);
2656   flistLsCutsBack->Add(hptD0vsptBLSCback);
2657   flistLsCutsBack->Add(hpD0vspBLSCback);
2658   flistLsCutsBack->Add(hptD0vsptcquarkLSCback);
2659   flistLsCutsBack->Add(hpD0vspcquarkLSCback);
2660  
2661   TH1F *hd0zD0ptLSCback;
2662   TH1F *hInvMassD0LSCback,*hInvMassD0barLSCback;
2663   TH2F *hInvMassPtLSCback=new TH2F("hInvMassPtLSCback","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2664  THnSparseF *hSparseLSCback=new THnSparseF("hSparseLSCback","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2665   hSparseLSCback->SetBinEdges(0,massbins);
2666   hSparseLSCback->SetBinEdges(1,massbins);
2667   hSparseLSCback->SetBinEdges(2,ptbinsForNsparse);
2668   hSparseLSCback->SetBinEdges(3,impparbins);
2669   hSparseLSCback->SetBinEdges(4,massHypoBins); 
2670   flistLsCutsBack->Add(hSparseLSCback);
2671   TH1F *hetaLSCback;
2672   TH1F *hCosPDPBLSCback;
2673   TH1F *hCosPcPDLSCback;
2674   flistLsCutsBack->Add(hInvMassPtLSCback);
2675  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2676   TH2F *hd0D0VSd0xd0LSCbackpt;
2677   TH2F *hangletracksVSd0xd0LSCbackpt;
2678   TH2F *hangletracksVSd0D0LSCbackpt;
2679   TH1F *hd0xd0LSCbackpt;
2680
2681   TH2F *hTOFpidLSCback=new TH2F("hTOFpidLSCback","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2682   flistLsCutsBack->Add(hTOFpidLSCback);
2683
2684   for(Int_t i=0;i<fnbins;i++){
2685     namehist="hd0zD0ptLSCback_pt";
2686     namehist+=i;
2687     titlehist="d0(z) Loose Cuts Backgr ptbin=";
2688     titlehist+=i;
2689     hd0zD0ptLSCback=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2690     hd0zD0ptLSCback->SetXTitle("d_{0}(z)    [#mum]");
2691     hd0zD0ptLSCback->SetYTitle("Entries");
2692     flistLsCutsBack->Add(hd0zD0ptLSCback);
2693
2694     namehist="hInvMassD0LSCback_pt";
2695     namehist+=i;
2696     titlehist="Invariant Mass Loose Cuts Backgr ptbin=";
2697     titlehist+=i;
2698     hInvMassD0LSCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2699     hInvMassD0LSCback->SetXTitle("Invariant Mass    [GeV]");
2700     hInvMassD0LSCback->SetYTitle("Entries");
2701     flistLsCutsBack->Add(hInvMassD0LSCback);
2702     
2703     namehist="hInvMassD0barLSCback_pt";
2704     namehist+=i;
2705     titlehist="Invariant Mass D0bar Loose Cuts Back ptbin=";
2706     titlehist+=i;
2707     hInvMassD0barLSCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2708     hInvMassD0barLSCback->SetXTitle("Invariant Mass    [GeV]");
2709     hInvMassD0barLSCback->SetYTitle("Entries");
2710     flistLsCutsBack->Add(hInvMassD0barLSCback);
2711
2712
2713     namehist="hetaLSCback_pt";
2714     namehist+=i;
2715     titlehist="eta Loose Cuts Backgr ptbin=";
2716     titlehist+=i;
2717     hetaLSCback=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2718     hetaLSCback->SetXTitle("Pseudorapidity");
2719     hetaLSCback->SetYTitle("Entries");
2720     flistLsCutsBack->Add(hetaLSCback);
2721
2722     namehist="hCosPDPBLSCback_pt";
2723     namehist+=i;
2724     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2725     titlehist+=i;
2726     hCosPDPBLSCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2727     hCosPDPBLSCback->SetXTitle("Cosine between D0 momentum and B momentum");
2728     hCosPDPBLSCback->SetYTitle("Entries");
2729     flistLsCutsBack->Add(hCosPDPBLSCback);
2730
2731     namehist="hCosPcPDLSCback_pt";
2732     namehist+=i;
2733     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2734     titlehist+=i;
2735     hCosPcPDLSCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2736     hCosPcPDLSCback->SetXTitle("Cosine between c quark momentum and D0 momentum");
2737     hCosPcPDLSCback->SetYTitle("Entries");
2738     flistLsCutsBack->Add(hCosPcPDLSCback);
2739
2740  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2741     namehist="hd0xd0LSCback_pt";
2742     namehist+=i;
2743     titlehist="d0xd0 Loose Cuts Back ptbin=";
2744     titlehist+=i;
2745     hd0xd0LSCbackpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2746     hd0xd0LSCbackpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
2747     hd0xd0LSCbackpt->SetYTitle("Entries");
2748     flistLsCutsBack->Add(hd0xd0LSCbackpt);
2749
2750
2751     namehist="hd0D0VSd0xd0LSCback_pt";
2752     namehist+=i;
2753     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Back ptbin=";
2754     titlehist+=i;
2755     hd0D0VSd0xd0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2756     hd0D0VSd0xd0LSCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2757     hd0D0VSd0xd0LSCbackpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
2758     flistLsCutsBack->Add(hd0D0VSd0xd0LSCbackpt);
2759     
2760     
2761     namehist="hangletracksVSd0xd0LSCback_pt";
2762     namehist+=i;
2763     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Back ptbin=";
2764     titlehist+=i;
2765     hangletracksVSd0xd0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2766     hangletracksVSd0xd0LSCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2767     hangletracksVSd0xd0LSCbackpt->SetYTitle(" angle between K and #p tracks  [rad]");
2768     flistLsCutsBack->Add(hangletracksVSd0xd0LSCbackpt);
2769     
2770
2771     namehist="hangletracksVSd0D0LSCback_pt";
2772     namehist+=i;
2773     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Back ptbin=";
2774     titlehist+=i;
2775     hangletracksVSd0D0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2776     hangletracksVSd0D0LSCbackpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2777     hangletracksVSd0D0LSCbackpt->SetYTitle(" angle between K and #p tracks  [rad]");
2778     flistLsCutsBack->Add(hangletracksVSd0D0LSCbackpt);
2779     
2780   }
2781   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2782   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2783
2784
2785
2786
2787
2788
2789
2790   // ####### d0 D0 histos ############
2791   
2792  TH1F *hd0D0LSCbackPM = new TH1F("hd0D0LSCbackPM","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2793   hd0D0LSCbackPM->SetXTitle("Impact parameter [#mum]");
2794   hd0D0LSCbackPM->SetYTitle("Entries");
2795
2796   TH1F *hd0D0VtxTrueLSCbackPM = new TH1F("hd0D0VtxTrueLSCbackPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2797   hd0D0VtxTrueLSCbackPM->SetXTitle("Impact parameter [#mum]");
2798   hd0D0VtxTrueLSCbackPM->SetYTitle("Entries");
2799
2800   TH1F *hMCd0D0LSCbackPM = new TH1F("hMCd0D0LSCbackPM","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
2801   hMCd0D0LSCbackPM->SetXTitle("MC Impact parameter [#mum]");
2802   hMCd0D0LSCbackPM->SetYTitle("Entries");
2803
2804   TH1F *hd0D0LSCbackSB = new TH1F("hd0D0LSCbackSB","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2805   hd0D0LSCbackSB->SetXTitle("Impact parameter [#mum]");
2806   hd0D0LSCbackSB->SetYTitle("Entries");
2807
2808   TH1F *hd0D0VtxTrueLSCbackSB = new TH1F("hd0D0VtxTrueLSCbackSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
2809   hd0D0VtxTrueLSCbackSB->SetXTitle("Impact parameter [#mum]");
2810   hd0D0VtxTrueLSCbackSB->SetYTitle("Entries");
2811
2812   TH1F *hMCd0D0LSCbackSB = new TH1F("hMCd0D0LSCbackSB","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak  (All momenta)",1000,-1000.,1000.);
2813   hMCd0D0LSCbackSB->SetXTitle("MC Impact parameter [#mum]");
2814   hMCd0D0LSCbackSB->SetYTitle("Entries");
2815
2816   flistLsCutsBack->Add(hd0D0LSCbackPM);
2817   flistLsCutsBack->Add(hd0D0VtxTrueLSCbackPM);
2818   flistLsCutsBack->Add(hMCd0D0LSCbackPM);
2819   flistLsCutsBack->Add(hd0D0LSCbackSB);
2820   flistLsCutsBack->Add(hd0D0VtxTrueLSCbackSB);
2821   flistLsCutsBack->Add(hMCd0D0LSCbackSB);
2822   
2823   TH1F *hd0D0ptLSCbackPM;
2824   TH1F *hMCd0D0ptLSCbackPM;
2825   TH1F *hd0D0VtxTrueptLSCbackPM;
2826   TH1F *hd0D0ptLSCbackSB;
2827   TH1F *hMCd0D0ptLSCbackSB;
2828   TH1F *hd0D0VtxTrueptLSCbackSB;
2829   namehist="hd0D0ptLSCback_";
2830   titlehist="D^{0} impact par. plot, Loose Cuts, Background, ";
2831   for(Int_t i=0;i<fnbins;i++){
2832     strnamept=namehist;
2833     strnamept.Append("PkMss_pt");
2834     strnamept+=i;
2835
2836     strtitlept=titlehist;
2837     strtitlept.Append(" Mass Peak, ");
2838     strtitlept+=fptbins[i];
2839     strtitlept.Append("<= pt <");
2840     strtitlept+=fptbins[i+1];
2841     strtitlept.Append(" [GeV/c]");
2842     
2843     hd0D0ptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2844     hd0D0ptLSCbackPM->SetXTitle("Impact parameter [#mum] ");
2845     hd0D0ptLSCbackPM->SetYTitle("Entries");
2846     flistLsCutsBack->Add(hd0D0ptLSCbackPM);
2847
2848     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2849     hMCd0D0ptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2850     hMCd0D0ptLSCbackPM->SetXTitle("MC Impact parameter [#mum] ");
2851     hMCd0D0ptLSCbackPM->SetYTitle("Entries");
2852     flistLsCutsBack->Add(hMCd0D0ptLSCbackPM);
2853  
2854
2855     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2856     hd0D0VtxTrueptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2857     hd0D0VtxTrueptLSCbackPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2858     hd0D0VtxTrueptLSCbackPM->SetYTitle("Entries");
2859     flistLsCutsBack->Add(hd0D0VtxTrueptLSCbackPM);
2860     
2861     strnamept=namehist;
2862     strnamept.Append("SBMss_pt");
2863     strnamept+=i;
2864
2865     strtitlept=titlehist;
2866     strtitlept.Append(" Side Bands, ");
2867     strtitlept+=fptbins[i];
2868     strtitlept.Append("<= pt <");
2869     strtitlept+=fptbins[i+1];
2870     strtitlept.Append(" [GeV/c]");
2871     
2872     hd0D0ptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2873     hd0D0ptLSCbackSB->SetXTitle("Impact parameter [#mum] ");
2874     hd0D0ptLSCbackSB->SetYTitle("Entries");
2875     flistLsCutsBack->Add(hd0D0ptLSCbackSB);
2876
2877     strnamept.ReplaceAll("hd0D0","hMCd0D0");
2878     hMCd0D0ptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2879     hMCd0D0ptLSCbackSB->SetXTitle("MC Impact parameter [#mum] ");
2880     hMCd0D0ptLSCbackSB->SetYTitle("Entries");
2881     flistLsCutsBack->Add(hMCd0D0ptLSCbackSB);
2882
2883     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2884     hd0D0VtxTrueptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2885     hd0D0VtxTrueptLSCbackSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2886     hd0D0VtxTrueptLSCbackSB->SetYTitle("Entries");
2887     flistLsCutsBack->Add(hd0D0VtxTrueptLSCbackSB);
2888   }
2889
2890
2891
2892  //############ LOOSE CUTS FROMB HISTOGRAMS ###########
2893   //
2894   //#######  global properties histos
2895
2896   TH2F *hCPtaVSd0d0LSCfromB=new TH2F("hCPtaVSd0d0LSCfromB","hCPtaVSd0d0_LooseCuts_FromB",1000,-100000.,100000.,100,-1.,1.);
2897   TH1F *hSecVtxZLSCfromB=new TH1F("hSecVtxZLSCfromB","hSecVtxZ_LooseCuts_FromB",1000,-8.,8.);
2898   TH1F *hSecVtxXLSCfromB=new TH1F("hSecVtxXLSCfromB","hSecVtxX_LooseCuts_FromB",1000,-3000.,3000.);
2899   TH1F *hSecVtxYLSCfromB=new TH1F("hSecVtxYLSCfromB","hSecVtxY_LooseCuts_FromB",1000,-3000.,3000.);
2900   TH2F *hSecVtxXYLSCfromB=new TH2F("hSecVtxXYLSCfromB","hSecVtxXY_LooseCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
2901   TH1F *hSecVtxPhiLSCfromB=new TH1F("hSecVtxPhiLSCfromB","hSecVtxPhi_LooseCuts_FromB",180,-180.1,180.1);
2902   TH1F *hd0singlTrackLSCfromB=new TH1F("hd0singlTrackLSCfromB","hd0singlTrackLooseCuts_FromB",1000,-5000.,5000.);
2903   TH1F *hCPtaLSCfromB=new TH1F("hCPtaLSCfromB","hCPta_LooseCuts_FromB",100,-1.,1.);
2904   TH1F *hd0xd0LSCfromB=new TH1F("hd0xd0LSCfromB","hd0xd0_LooseCuts_FromB",1000,-100000.,100000.);
2905   TH1F *hMassTrueLSCfromB=new TH1F("hMassTrueLSCfromB","D^{0} MC inv. Mass Loose Cuts FromB(All momenta)",600,1.600,2.200);
2906   TH1F *hMassLSCfromB=new TH1F("hMassLSCfromB","D^{0} inv. Mass Loose Cuts FromB (All momenta)",600,1.600,2.200);
2907   hMassLSCfromB->Sumw2();
2908   TH1F *hMassTrueLSCfromBPM=new TH1F("hMassTrueLSCfromBPM","D^{0} MC inv. Mass Loose Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
2909   TH1F *hMassLSCfromBPM=new TH1F("hMassLSCfromBPM","D^{0} inv. Mass Loose Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
2910   hMassLSCfromBPM->Sumw2();
2911   TH1F *hMassTrueLSCfromBSB=new TH1F("hMassTrueLSCfromBSB","D^{0} MC inv. Mass in Side Bands Loose Cuts FromB(All momenta)",600,1.600,2.200);
2912   TH1F *hMassLSCfromBSB=new TH1F("hMassLSCfromBSB","D^{0} inv. Mass in Side Bands Loose Cuts FromB (All momenta)",600,1.600,2.200);
2913   hMassLSCfromBSB->Sumw2();
2914
2915   flistLsCutsFromB->Add(hCPtaVSd0d0LSCfromB);
2916   flistLsCutsFromB->Add(hSecVtxZLSCfromB);
2917   flistLsCutsFromB->Add(hSecVtxYLSCfromB);
2918   flistLsCutsFromB->Add(hSecVtxXLSCfromB);
2919   flistLsCutsFromB->Add(hSecVtxXYLSCfromB);
2920   flistLsCutsFromB->Add(hSecVtxPhiLSCfromB);
2921   flistLsCutsFromB->Add(hd0singlTrackLSCfromB);
2922   flistLsCutsFromB->Add(hCPtaLSCfromB);
2923   flistLsCutsFromB->Add(hd0xd0LSCfromB);
2924   flistLsCutsFromB->Add(hMassTrueLSCfromB);
2925   flistLsCutsFromB->Add(hMassLSCfromB);
2926   flistLsCutsFromB->Add(hMassTrueLSCfromBPM);
2927   flistLsCutsFromB->Add(hMassLSCfromBPM);
2928   flistLsCutsFromB->Add(hMassTrueLSCfromBSB);
2929   flistLsCutsFromB->Add(hMassLSCfromBSB);
2930
2931
2932
2933
2934  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2935   TH1F *hdcaLSCfromB=new TH1F("hdcaLSCfromB","hdca_LooseCuts_FromB",100,0.,1000.);
2936   hdcaLSCfromB->SetXTitle("dca   [#mum]");
2937   hdcaLSCfromB->SetYTitle("Entries");
2938   TH1F *hcosthetastarLSCfromB=new TH1F("hcosthetastarLSCfromB","hCosThetaStar_LooseCuts_FromB",50,-1.,1.);
2939   hcosthetastarLSCfromB->SetXTitle("cos #theta^{*}");
2940   hcosthetastarLSCfromB->SetYTitle("Entries");
2941   TH1F *hptD0LSCfromB=new TH1F("hptD0LSCfromB","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2942   hptD0LSCfromB->SetXTitle("p_{t}  [GeV/c]");
2943   hptD0LSCfromB->SetYTitle("Entries");
2944   TH1F *hptD0VsMaxPtLSCfromB=new TH1F("hptD0VsMaxPtLSCfromB","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2945   TH2F *hptD0PTallsqrtLSCfromB=new TH2F("hptD0PTallsqrtLSCfromB","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2946   TH2F *hptD0PTallLSCfromB=new TH2F("hptD0PTallLSCfromB","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2947   TH2F *hptD0vsptBLSCfromB=new TH2F("hptD0vsptBLSCfromB","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2948   TH2F *hpD0vspBLSCfromB=new TH2F("hpD0vspBLSCfromB","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2949   TH2F *hptD0vsptcquarkLSCfromB=new TH2F("hptD0vsptcquarkLSCfromB","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2950   TH2F *hpD0vspcquarkLSCfromB=new TH2F("hpD0vspcquarkLSCfromB","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2951   flistLsCutsFromB->Add(hdcaLSCfromB);
2952   flistLsCutsFromB->Add(hcosthetastarLSCfromB);
2953   flistLsCutsFromB->Add(hptD0LSCfromB);
2954   flistLsCutsFromB->Add(hptD0VsMaxPtLSCfromB);
2955   flistLsCutsFromB->Add(hptD0PTallsqrtLSCfromB);
2956   flistLsCutsFromB->Add(hptD0PTallLSCfromB);
2957   flistLsCutsFromB->Add(hptD0vsptBLSCfromB);
2958   flistLsCutsFromB->Add(hpD0vspBLSCfromB);
2959   flistLsCutsFromB->Add(hptD0vsptcquarkLSCfromB);
2960   flistLsCutsFromB->Add(hpD0vspcquarkLSCfromB);
2961  
2962   TH1F *hd0zD0ptLSCfromB;
2963   TH1F *hInvMassD0LSCfromB,*hInvMassD0barLSCfromB;
2964   TH2F *hInvMassPtLSCfromB=new TH2F("hInvMassPtLSCfromB","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2965  THnSparseF *hSparseLSCfromB=new THnSparseF("hSparseLSCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2966   hSparseLSCfromB->SetBinEdges(0,massbins);
2967   hSparseLSCfromB->SetBinEdges(1,massbins);
2968   hSparseLSCfromB->SetBinEdges(2,ptbinsForNsparse);
2969   hSparseLSCfromB->SetBinEdges(3,impparbins);
2970   hSparseLSCfromB->SetBinEdges(4,massHypoBins); 
2971   flistLsCutsFromB->Add(hSparseLSCfromB);
2972   TH1F *hetaLSCfromB;
2973   TH1F *hCosPDPBLSCfromB;
2974   TH1F *hCosPcPDLSCfromB;
2975   flistLsCutsFromB->Add(hInvMassPtLSCfromB);
2976    // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2977   TH2F *hd0D0VSd0xd0LSCfromBpt;
2978   TH2F *hangletracksVSd0xd0LSCfromBpt;
2979   TH2F *hangletracksVSd0D0LSCfromBpt;
2980   TH1F *hd0xd0LSCfromBpt;
2981
2982
2983   TH2F *hTOFpidLSCfromB=new TH2F("hTOFpidLSCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2984   flistLsCutsFromB->Add(hTOFpidLSCfromB);
2985
2986   for(Int_t i=0;i<fnbins;i++){
2987     namehist="hd0zD0ptLSCfromB_pt";
2988     namehist+=i;
2989     titlehist="d0(z) Loose Cuts FromBm ptbin=";
2990     titlehist+=i;
2991     hd0zD0ptLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2992     hd0zD0ptLSCfromB->SetXTitle("d_{0}(z)    [#mum]");
2993     hd0zD0ptLSCfromB->SetYTitle("Entries");
2994     flistLsCutsFromB->Add(hd0zD0ptLSCfromB);
2995
2996     namehist="hInvMassD0LSCfromB_pt";
2997     namehist+=i;
2998     titlehist="Invariant Mass Loose Cuts FromB ptbin=";
2999     titlehist+=i;
3000     hInvMassD0LSCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3001     hInvMassD0LSCfromB->SetXTitle("Invariant Mass    [GeV]");
3002     hInvMassD0LSCfromB->SetYTitle("Entries");
3003     flistLsCutsFromB->Add(hInvMassD0LSCfromB);
3004
3005     namehist="hInvMassD0barLSCfromB_pt";
3006     namehist+=i;
3007     titlehist="Invariant Mass D0bar Loose Cuts FromB ptbin=";
3008     titlehist+=i;
3009     hInvMassD0barLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3010     hInvMassD0barLSCfromB->SetXTitle("Invariant Mass    [GeV]");
3011     hInvMassD0barLSCfromB->SetYTitle("Entries");
3012     flistLsCutsFromB->Add(hInvMassD0barLSCfromB);
3013
3014     namehist="hetaLSCfromB_pt";
3015     namehist+=i;
3016     titlehist="eta Loose Cuts FromB ptbin=";
3017     titlehist+=i;
3018     hetaLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
3019     hetaLSCfromB->SetXTitle("Pseudorapidity");
3020     hetaLSCfromB->SetYTitle("Entries");
3021     flistLsCutsFromB->Add(hetaLSCfromB);
3022
3023     namehist="hCosPDPBLSCfromB_pt";
3024     namehist+=i;
3025     titlehist="Cosine between D0 momentum and B momentum, ptbin=";
3026     titlehist+=i;
3027     hCosPDPBLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3028     hCosPDPBLSCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
3029     hCosPDPBLSCfromB->SetYTitle("Entries");
3030     flistLsCutsFromB->Add(hCosPDPBLSCfromB);
3031
3032     namehist="hCosPcPDLSCfromB_pt";
3033     namehist+=i;
3034     titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
3035     titlehist+=i;
3036     hCosPcPDLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3037     hCosPcPDLSCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
3038     hCosPcPDLSCfromB->SetYTitle("Entries");
3039     flistLsCutsFromB->Add(hCosPcPDLSCfromB);
3040
3041  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3042     namehist="hd0xd0LSCfromB_pt";
3043     namehist+=i;
3044     titlehist="d0xd0 Loose Cuts FromB ptbin=";
3045     titlehist+=i;
3046     hd0xd0LSCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
3047     hd0xd0LSCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi}   [#mum^2]");
3048     hd0xd0LSCfromBpt->SetYTitle("Entries");
3049     flistLsCutsFromB->Add(hd0xd0LSCfromBpt);
3050
3051
3052     namehist="hd0D0VSd0xd0LSCfromB_pt";
3053     namehist+=i;
3054     titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromB ptbin=";
3055     titlehist+=i;
3056     hd0D0VSd0xd0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
3057     hd0D0VSd0xd0LSCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3058     hd0D0VSd0xd0LSCfromBpt->SetYTitle(" d_{0}^{D^{0}}    [#mum]");
3059     flistLsCutsFromB->Add(hd0D0VSd0xd0LSCfromBpt);
3060     
3061     
3062     namehist="hangletracksVSd0xd0LSCfromB_pt";
3063     namehist+=i;
3064     titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromB ptbin=";
3065     titlehist+=i;
3066     hangletracksVSd0xd0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
3067     hangletracksVSd0xd0LSCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3068     hangletracksVSd0xd0LSCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
3069     flistLsCutsFromB->Add(hangletracksVSd0xd0LSCfromBpt);
3070     
3071
3072     namehist="hangletracksVSd0D0LSCfromB_pt";
3073     namehist+=i;
3074     titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts FromB ptbin=";
3075     titlehist+=i;
3076     hangletracksVSd0D0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
3077     hangletracksVSd0D0LSCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
3078     hangletracksVSd0D0LSCfromBpt->SetYTitle(" angle between K and #p tracks  [rad]");
3079     flistLsCutsFromB->Add(hangletracksVSd0D0LSCfromBpt);
3080     
3081   }
3082   // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
3083   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3084
3085
3086
3087
3088
3089   // ######### d0 D0 histos ##############
3090   TH1F *hd0D0LSCfromBPM = new TH1F("hd0D0LSCfromBPM","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3091   hd0D0LSCfromBPM->SetXTitle("Impact parameter [#mum]");
3092   hd0D0LSCfromBPM->SetYTitle("Entries");
3093
3094   TH1F *hd0D0VtxTrueLSCfromBPM = new TH1F("hd0D0VtxTrueLSCfromBPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3095   hd0D0VtxTrueLSCfromBPM->SetXTitle("Impact parameter [#mum]");
3096   hd0D0VtxTrueLSCfromBPM->SetYTitle("Entries");
3097
3098   TH1F *hMCd0D0LSCfromBPM = new TH1F("hMCd0D0LSCfromBPM","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
3099   hMCd0D0LSCfromBPM->SetXTitle("MC Impact parameter [#mum]");
3100   hMCd0D0LSCfromBPM->SetYTitle("Entries");
3101
3102   TH1F *hd0D0LSCfromBSB = new TH1F("hd0D0LSCfromBSB","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3103   hd0D0LSCfromBSB->SetXTitle("Impact parameter [#mum]");
3104   hd0D0LSCfromBSB->SetYTitle("Entries");
3105
3106   TH1F *hd0D0VtxTrueLSCfromBSB = new TH1F("hd0D0VtxTrueLSCfromBSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3107   hd0D0VtxTrueLSCfromBSB->SetXTitle("Impact parameter [#mum]");
3108   hd0D0VtxTrueLSCfromBSB->SetYTitle("Entries");
3109
3110   TH1F *hMCd0D0LSCfromBSB = new TH1F("hMCd0D0LSCfromBSB","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak  (All momenta)",1000,-1000.,1000.);
3111   hMCd0D0LSCfromBSB->SetXTitle("MC Impact parameter [#mum]");
3112   hMCd0D0LSCfromBSB->SetYTitle("Entries");
3113
3114   flistLsCutsFromB->Add(hd0D0LSCfromBPM);
3115   flistLsCutsFromB->Add(hd0D0VtxTrueLSCfromBPM);
3116   flistLsCutsFromB->Add(hMCd0D0LSCfromBPM);
3117   flistLsCutsFromB->Add(hd0D0LSCfromBSB);
3118   flistLsCutsFromB->Add(hd0D0VtxTrueLSCfromBSB);
3119   flistLsCutsFromB->Add(hMCd0D0LSCfromBSB);
3120   
3121   TH1F *hd0D0ptLSCfromBPM;
3122   TH1F *hMCd0D0ptLSCfromBPM;
3123   TH1F *hd0D0VtxTrueptLSCfromBPM;
3124   TH1F *hd0D0ptLSCfromBSB;
3125   TH1F *hMCd0D0ptLSCfromBSB;
3126   TH1F *hd0D0VtxTrueptLSCfromBSB;
3127   namehist="hd0D0ptLSCfromB_";
3128   titlehist="D^{0} impact par. plot, Loose Cuts, FromB, ";
3129   for(Int_t i=0;i<fnbins;i++){
3130     strnamept=namehist;
3131     strnamept.Append("PkMss_pt");
3132     strnamept+=i;
3133
3134     strtitlept=titlehist;
3135     strtitlept.Append(" Mass Peak, ");
3136     strtitlept+=fptbins[i];
3137     strtitlept.Append("<= pt <");
3138     strtitlept+=fptbins[i+1];
3139     strtitlept.Append(" [GeV/c]");
3140     
3141     hd0D0ptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3142     hd0D0ptLSCfromBPM->SetXTitle("Impact parameter [#mum] ");
3143     hd0D0ptLSCfromBPM->SetYTitle("Entries");
3144     flistLsCutsFromB->Add(hd0D0ptLSCfromBPM);
3145
3146     strnamept.ReplaceAll("hd0D0","hMCd0D0");
3147     hMCd0D0ptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3148     hMCd0D0ptLSCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
3149     hMCd0D0ptLSCfromBPM->SetYTitle("Entries");
3150     flistLsCutsFromB->Add(hMCd0D0ptLSCfromBPM);
3151  
3152
3153     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3154     hd0D0VtxTrueptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3155     hd0D0VtxTrueptLSCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3156     hd0D0VtxTrueptLSCfromBPM->SetYTitle("Entries");
3157     flistLsCutsFromB->Add(hd0D0VtxTrueptLSCfromBPM);
3158     
3159     strnamept=namehist;
3160     strnamept.Append("SBMss_pt");
3161     strnamept+=i;
3162
3163     strtitlept=titlehist;
3164     strtitlept.Append(" Side Bands, ");
3165     strtitlept+=fptbins[i];
3166     strtitlept.Append("<= pt <");
3167     strtitlept+=fptbins[i+1];
3168     strtitlept.Append(" [GeV/c]");
3169     
3170     hd0D0ptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3171     hd0D0ptLSCfromBSB->SetXTitle("Impact parameter [#mum] ");
3172     hd0D0ptLSCfromBSB->SetYTitle("Entries");
3173     flistLsCutsFromB->Add(hd0D0ptLSCfromBSB);
3174
3175     strnamept.ReplaceAll("hd0D0","hMCd0D0");
3176     hMCd0D0ptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3177     hMCd0D0ptLSCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
3178     hMCd0D0ptLSCfromBSB->SetYTitle("Entries");
3179     flistLsCutsFromB->Add(hMCd0D0ptLSCfromBSB);
3180
3181     strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3182     hd0D0VtxTrueptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3183     hd0D0VtxTrueptLSCfromBSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3184     hd0D0VtxTrueptLSCfromBSB->SetYTitle("Entries");
3185     flistLsCutsFromB->Add(hd0D0VtxTrueptLSCfromBSB);
3186   }
3187
3188
3189
3190  //############ LOOSE CUTS FROM DSTAR HISTOGRAMS ###########
3191  //
3192   //############## global properties histos
3193   TH2F *hCPtaVSd0d0LSCfromDstar=new TH2F("hCPtaVSd0d0LSCfromDstar","hCPtaVSd0d0_LooseCuts_FromDStar",1000,-100000.,100000.,100,-1.,1.);
3194   TH1F *hSecVtxZLSCfromDstar=new TH1F("hSecVtxZLSCfromDstar","hSecVtxZ_LooseCuts_FromDStar",1000,-8.,8.);
3195   TH1F *hSecVtxXLSCfromDstar=new TH1F("hSecVtxXLSCfromDstar","hSecVtxX_LooseCuts_FromDStar",1000,-3000.,3000.);
3196   TH1F *hSecVtxYLSCfromDstar=new TH1F("hSecVtxYLSCfromDstar","hSecVtxY_LooseCuts_FromDStar",1000,-3000.,3000.);
3197   TH2F *hSecVtxXYLSCfromDstar=new TH2F("hSecVtxXYLSCfromDstar","hSecVtxXY_LooseCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
3198   TH1F *hSecVtxPhiLSCfromDstar=new TH1F("hSecVtxPhiLSCfromDstar","hSecVtxPhi_LooseCuts_FromDStar",180,-180.1,180.1);
3199   TH1F *hd0singlTrackLSCfromDstar=new TH1F("hd0singlTrackLSCfromDstar","hd0singlTrackLooseCuts_FromDstar",1000,-5000.,5000.);