AliPhysics  b76e98e (b76e98e)
AliAnalysisTaskSECharmFraction.cxx
Go to the documentation of this file.
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 
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
24 
25 
26 #include <TH1F.h>
27 #include <TH2F.h>
28 #include <TH3F.h>
29 #include <TF1.h>
30 #include <THnSparse.h>
31 #include <TDatabasePDG.h>
32 #include <TMath.h>
33 #include <TROOT.h>
34 #include "AliAODEvent.h"
36 #include "AliAODRecoDecayHF.h"
37 #include "AliAODRecoDecay.h"
38 #include "AliAnalysisDataSlot.h"
39 #include "AliAnalysisDataContainer.h"
40 #include "AliAODTrack.h"
41 #include "AliAODHandler.h"
42 #include "AliESDtrack.h"
43 #include "AliAODVertex.h"
44 #include "AliESDVertex.h"
45 #include "AliVertexerTracks.h"
46 #include "AliAODMCParticle.h"
47 #include "AliAODPid.h"
48 #include "AliTPCPIDResponse.h"
49 #include "AliAODMCHeader.h"
50 #include "AliAnalysisVertexingHF.h"
52 #include "AliRDHFCutsD0toKpi.h"
53 #include "AliAODInputHandler.h"
54 #include "AliAnalysisManager.h"
56 #include "AliVertexingHFUtils.h"
57 
58 class TCanvas;
59 class TTree;
60 class TChain;
61 class AliAnalysisTaskSE;
62 
66 
67 //________________________________________________________________________
70  fCutsLoose(0),
71  fCutsTight(0),
72  fFastAnalysis(1),
73  fLightOutput(kFALSE),
74  fReadMC(kFALSE),
75  fcheckD0Bit(kTRUE),
76  fsplitMassD0D0bar(kTRUE),
77  fLikeSign(kFALSE),
78  fusePID(kTRUE),
79  fmD0PDG(),
80  fnbins(1),
81  fptbins(0),
82  fNtrMaxforVtx(-1),
83  fptAll(),
84  fptAllSq(),
85  fptMax(),
86  fAcceptanceCuts(),
87  fsignalInvMassCut(),
88  flargeInvMassCut(),
89  fsidebandInvMassCut(),
90  fsidebandInvMassWindow(),
91  fUseMC(kTRUE),
92  fCleanCandOwnVtx(kFALSE),
93  fAODProtection(1),
94  fNentries(0),
95  fSignalType(0),
96  fSignalTypeLsCuts(0),
97  fSignalTypeTghCuts(0),
98  fCounter(0),
99  flistMCproperties(0),
100  flistNoCutsSignal(0),
101  flistNoCutsBack(0),
102  flistNoCutsFromB(0),
103  flistNoCutsFromDstar(0),
104  flistNoCutsOther(0),
105  flistLsCutsSignal(0),
106  flistLsCutsBack(0),
107  flistLsCutsFromB(0),
108  flistLsCutsFromDstar(0),
109  flistLsCutsOther(0),
110  flistTghCutsSignal(0),
111  flistTghCutsBack(0),
112  flistTghCutsFromB(0),
113  flistTghCutsFromDstar(0),
114  flistTghCutsOther(0),
115  fVertUtil(0),
116  fselectForUpgrade(0),
117  fskipEventSelection(kFALSE),
118  fZvtxUpgr(10.),
119  fWeightPt(0x0),
120  fFillTree(kFALSE),
121  fTreeNCsign(0),
122  fTreeNCback(0),
123  fTreeNCfromB(0),
124  fTreeRecoNCfromB(0),
125  fTreeNCfromDstar(0),
126  fTreeNCother(0),
127  fTreeLSCsign(0),
128  fTreeLSCback(0),
129  fTreeLSCfromB(0),
130  fTreeRecoLSCfromB(0),
131  fTreeLSCfromDstar(0),
132  fTreeLSCother(0),
133  fTreeTGHCsign(0),
134  fTreeTGHCback(0),
135  fTreeTGHCfromB(0),
136  fTreeRecoTGHCfromB(0),
137  fTreeTGHCfromDstar(0),
138  fTreeTGHCother(0),
139  fVariablesTreeNCsign(),
140  fVariablesTreeNCback(),
141  fVariablesTreeNCfromB(),
142  fVariablesTreeRecoNCfromB(),
143  fVariablesTreeNCfromDstar(),
144  fVariablesTreeNCother(),
145  fVariablesTreeLSCsign(),
146  fVariablesTreeLSCback(),
147  fVariablesTreeLSCfromB(),
148  fVariablesTreeRecoLSCfromB(),
149  fVariablesTreeLSCfromDstar(),
150  fVariablesTreeLSCother(),
151  fVariablesTreeTGHCsign(),
152  fVariablesTreeTGHCback(),
153  fVariablesTreeTGHCfromB(),
154  fVariablesTreeRecoTGHCfromB(),
155  fVariablesTreeTGHCfromDstar(),
156  fVariablesTreeTGHCother()
157 {
159 }
160 //________________________________________________________________________
162  : AliAnalysisTaskSE(name),
163  fCutsLoose(0x0),
164  fCutsTight(0x0),
165  fFastAnalysis(1),
166  fLightOutput(kFALSE),
167  fReadMC(kFALSE),
168  fcheckD0Bit(kTRUE),
169  fsplitMassD0D0bar(kTRUE),
170  fLikeSign(kFALSE),
171  fusePID(kTRUE),
172  fmD0PDG(),
173  fnbins(1),
174  fptbins(0),
175  fNtrMaxforVtx(-1),
176  fptAll(),
177  fptAllSq(),
178  fptMax(),
179  fAcceptanceCuts(),
180  fsignalInvMassCut(-1.),
181  flargeInvMassCut(-1.),
182  fsidebandInvMassCut(-1.),
184  fUseMC(kFALSE),
185  fCleanCandOwnVtx(kFALSE),
186  fAODProtection(1),
187  fNentries(0),
188  fSignalType(0),
191  fCounter(0),
194  flistNoCutsBack(0),
195  flistNoCutsFromB(0),
197  flistNoCutsOther(0),
199  flistLsCutsBack(0),
200  flistLsCutsFromB(0),
202  flistLsCutsOther(0),
204  flistTghCutsBack(0),
208  fVertUtil(0),
210  fskipEventSelection(kFALSE),
211  fZvtxUpgr(10.),
212  fWeightPt(0x0),
213  fFillTree(kFALSE),
214  fTreeNCsign(0),
215  fTreeNCback(0),
216  fTreeNCfromB(0),
217  fTreeRecoNCfromB(0),
218  fTreeNCfromDstar(0),
219  fTreeNCother(0),
220  fTreeLSCsign(0),
221  fTreeLSCback(0),
222  fTreeLSCfromB(0),
225  fTreeLSCother(0),
226  fTreeTGHCsign(0),
227  fTreeTGHCback(0),
228  fTreeTGHCfromB(0),
231  fTreeTGHCother(0),
250  {
252 
256 
257  //Standard pt bin
258  fnbins=SetStandardCuts();// THIS TO SET NBINS AND BINNING
259 
260  DefineOutput(1, TH1F::Class());
261  DefineOutput(2, TH1F::Class());
262  DefineOutput(3, TH1F::Class());
263  DefineOutput(4, TH1F::Class());
264  DefineOutput(5, AliNormalizationCounter::Class());
265 
266  for(Int_t j=6;j<22;j++){
267  DefineOutput(j, TList::Class());
268  }
270  // Output slot for the Cut Objects
271  DefineOutput(22,AliRDHFCutsD0toKpi::Class()); //My private output
272  DefineOutput(23,AliRDHFCutsD0toKpi::Class()); //My private output
273 
274 }
275 
276 
278  : AliAnalysisTaskSE(name),
279  fCutsLoose(0),
280  fCutsTight(0),
281  fFastAnalysis(1),
282  fLightOutput(kFALSE),
283  fReadMC(kFALSE),
284  fcheckD0Bit(kTRUE),
285  fsplitMassD0D0bar(kTRUE),
286  fLikeSign(kFALSE),
287  fusePID(kTRUE),
288  fmD0PDG(),
289  fnbins(1),
290  fptbins(0),
291  fNtrMaxforVtx(-1),
292  fptAll(),
293  fptAllSq(),
294  fptMax(),
295  fAcceptanceCuts(),
296  fsignalInvMassCut(-1.),
297  flargeInvMassCut(-1.),
298  fsidebandInvMassCut(-1.),
300  fUseMC(kFALSE),
301  fCleanCandOwnVtx(kFALSE),
302  fAODProtection(1),
303  fNentries(0),
304  fSignalType(0),
307  fCounter(0),
310  flistNoCutsBack(0),
311  flistNoCutsFromB(0),
313  flistNoCutsOther(0),
315  flistLsCutsBack(0),
316  flistLsCutsFromB(0),
318  flistLsCutsOther(0),
320  flistTghCutsBack(0),
324  fVertUtil(0),
326  fskipEventSelection(kFALSE),
327  fZvtxUpgr(10.),
328  fWeightPt(0x0),
329  fFillTree(kFALSE),
330  fTreeNCsign(0),
331  fTreeNCback(0),
332  fTreeNCfromB(0),
333  fTreeRecoNCfromB(0),
334  fTreeNCfromDstar(0),
335  fTreeNCother(0),
336  fTreeLSCsign(0),
337  fTreeLSCback(0),
338  fTreeLSCfromB(0),
341  fTreeLSCother(0),
342  fTreeTGHCsign(0),
343  fTreeTGHCback(0),
344  fTreeTGHCfromB(0),
347  fTreeTGHCother(0),
366 {
368  if(fCutsTight){
369  delete fCutsTight;fCutsTight=NULL;
370  }
371  if(fCutsLoose){
372  delete fCutsLoose;fCutsLoose=NULL;
373  }
374 
375  //Check consistency between sets of cuts:
376  if(cutsA->GetNPtBins()!=cutsB->GetNPtBins()){
377  printf("Different number of pt bins between the two sets of cuts: SWITCH TO STANDARD CUTS \n");
379  }
380  else{
381  fCutsTight=new AliRDHFCutsD0toKpi(*cutsA);
382  fCutsLoose=new AliRDHFCutsD0toKpi(*cutsB);
383  for(Int_t j=0;j<cutsA->GetNPtBins();j++){
384  if(TMath::Abs(cutsA->GetPtBinLimits()[j]-cutsB->GetPtBinLimits()[j])>1.e-7){
385  printf("Different pt bin limits in the two set of cuts: use the first as reference \n");
386  fCutsLoose->SetPtBins(cutsA->GetNPtBins(),cutsA->GetPtBinLimits());
387  break;
388  }
389  }
391  }
392 
394  // Output slot #0 writes into a TH1 container
395  DefineOutput(1, TH1F::Class());
396  DefineOutput(2, TH1F::Class());
397  DefineOutput(3, TH1F::Class());
398  DefineOutput(4, TH1F::Class());
399  DefineOutput(5, AliNormalizationCounter::Class());
400 
401  for(Int_t j=6;j<22;j++){
402 
403  DefineOutput(j, TList::Class());
404  }
405  // Output slot for the Cut Objects
406  DefineOutput(22,AliRDHFCutsD0toKpi::Class()); //My private output
407  DefineOutput(23,AliRDHFCutsD0toKpi::Class()); //My private output
408 
409 }
410 
411 //________________________________________________________________________
413 {
414 
415  if (fCutsTight) {
416  delete fCutsTight;
417  fCutsTight = 0;
418  }
419  if (fCutsLoose) {
420  delete fCutsLoose;
421  fCutsLoose = 0;
422  }
423  if(fptbins){
424  delete fptbins;
425  fptbins =0;
426  }
427  /* if(fAcceptanceCuts){
428  delete fAcceptanceCuts;
429  fAcceptanceCuts=0;
430  }*/
431  if (fNentries) {
432  delete fNentries;
433  fNentries = 0;
434  }
435  if (fSignalType) {
436  delete fSignalType;
437  fSignalType = 0;
438  }
439  if (fSignalTypeLsCuts) {
440  delete fSignalTypeLsCuts;
441  fSignalTypeLsCuts = 0;
442  }
443  if (fSignalTypeTghCuts) {
444  delete fSignalTypeTghCuts;
445  fSignalTypeTghCuts = 0;
446  }
447 
448  if (fCounter) {
449  delete fCounter;
450  fCounter = 0;
451  }
452 
453  if(flistMCproperties){
454  flistMCproperties->Delete();
455  delete flistMCproperties;
457  }
458 
459  if(flistNoCutsSignal){
460  flistNoCutsSignal->Delete();
461  delete flistNoCutsSignal;
463  }
464  if(flistNoCutsBack){
465  flistNoCutsBack->Delete();
466  delete flistNoCutsBack;
467  flistNoCutsBack=0;
468  }
469  if(flistNoCutsFromB){
470  flistNoCutsFromB->Delete();
471  delete flistNoCutsFromB;
473  }
475  flistNoCutsFromDstar->Delete();
476  delete flistNoCutsFromDstar;
478  }
479  if(flistNoCutsOther){
480  flistNoCutsOther->Delete();
481  delete flistNoCutsOther;
483  }
484 
485  if(flistLsCutsSignal){
486  flistLsCutsSignal->Delete();
487  delete flistLsCutsSignal;
489  }
490  if(flistLsCutsBack){
491  flistLsCutsBack->Delete();
492  delete flistLsCutsBack;
493  flistLsCutsBack=0;
494  }
495  if(flistLsCutsFromB){
496  flistLsCutsFromB->Delete();
497  delete flistLsCutsFromB;
499  }
501  flistLsCutsFromDstar->Delete();
502  delete flistLsCutsFromDstar;
504  }
505  if(flistLsCutsOther){
506  flistLsCutsOther->Delete();
507  delete flistLsCutsOther;
509  }
510 
511  if(flistTghCutsSignal){
512  flistTghCutsSignal->Delete();
513  delete flistTghCutsSignal;
515  }
516  if(flistTghCutsBack){
517  flistTghCutsBack->Delete();
518  delete flistTghCutsBack;
520  }
521  if(flistTghCutsFromB){
522  flistTghCutsFromB->Delete();
523  delete flistTghCutsFromB;
525  }
527  flistTghCutsFromDstar->Delete();
528  delete flistTghCutsFromDstar;
530  }
531  if(flistTghCutsOther){
532  flistTghCutsOther->Delete();
533  delete flistTghCutsOther;
535  }
536  delete fWeightPt;
537  delete fVertUtil;
538 }
539 
540 
541 //________________________________________________________________________
543 {
545 
546  if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n");
547  fmD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
548 
549  // gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C");
550  // gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/D0fromBSetCuts.C");
551  // 2 sets of dedicated cuts: fCutsTight is assumed as the standard cut object
552 
553  // SetAcceptanceCut();
554  if(fNtrMaxforVtx<0)SetNMaxTrForVtx(3); //DEFAULT : NO SELECTION
556  printf("AliAnalysisTaskSECharmFraction: Not All info for mass selection provided: switch to default values \n");
558  }
559 
560  AliRDHFCutsD0toKpi* copyfCutsTight=new AliRDHFCutsD0toKpi(*fCutsTight);
561  const char* nameoutputTight=GetOutputSlot(22)->GetContainer()->GetName();
562  copyfCutsTight->SetName(nameoutputTight);
563  AliRDHFCutsD0toKpi* copyfCutsLoose=new AliRDHFCutsD0toKpi(*fCutsLoose);
564  const char* nameoutputLoose=GetOutputSlot(23)->GetContainer()->GetName();
565  copyfCutsLoose->SetName(nameoutputLoose);
566 
567  // Post the data
568  PostData(22,copyfCutsTight);
569  PostData(23,copyfCutsLoose);
570 
571 
572  fCleanCandOwnVtx=kFALSE;
574  printf("Two cut objects have different selection for primary vertex recalculation w/o daughters:\n Dangerous for variable drawing!! \n");
575  }
576  else{
578  fCleanCandOwnVtx=kTRUE;
581  }
582  }
583 
584 
585 
586 
587  return;
588 }
589 
590 //________________________________________________________________________
592 {
594 
595 
596  // ################ NAMING SCHEME ###################################
597  // LISTS NAMING SCHEME
598  // "list" + cut selection string + MC selection string
599  // cut strings: "NC" =nocuts, "LSC"= loose cuts, "TGHC"= tight cuts
600  // MC sel. strings: "sign"= D0 from c quark
601  // "fromDstar" = D0 from Dstar from c quark
602  // "fromB"= D0from B decay (->from b quark) + D0from Dstar from B
603  // "back"= backgroun, generic except the cas "other"
604  // "other"= background case for candidates made of a pion and a kaon coming from the same D0 (in 4 prong) or from D+
605  //
606  // HISTS NAMING SCHEME
607  //
608  // "h" + specific name + cut selection string + MC selection string + (InvMass region string) + (pt string)
609  //
610  // cut selection strings = those for lists
611  // MC selection strings = those for lists
612  // inv mass region strings : "PM" or "SB" for global properties and pt integrated histos
613  // "_PkMss" or "_SBMss" for impact par. pt dependent histos
614  // pt string : "_pt" + integer number of ptbin
615  //
616  //###################################################################
617 
618  TString namehist;
619  TString titlehist;
620  TString strnamept,strtitlept;
621  Printf("INSIDE USER CREATE \n");
622 
623  // fNentries=new TH1F("nentriesChFr", "Look at the number of entries! = number of AODs", 2,1.,2.);
624 
625  fNentries=new TH1F("nentriesChFr", "Analyzed sample properties", 21,-0.5,20.5);
626 
627  fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
628 
629  fNentries->GetXaxis()->SetBinLabel(2,"nEvTGHTsel");
630  fNentries->GetXaxis()->SetBinLabel(3,"nEvTGHTPile-up Rej");
631  fNentries->GetXaxis()->SetBinLabel(4,"nEvTGHTGoodVtxS");
632  fNentries->GetXaxis()->SetBinLabel(5,"nEvTGHTRejVtxZ");
633  fNentries->GetXaxis()->SetBinLabel(6,"nTracksTGHTEv");
634  fNentries->GetXaxis()->SetBinLabel(7,"nCandTGHTEv");
635  fNentries->GetXaxis()->SetBinLabel(8,"nCandSelTGHTEv");
636  fNentries->GetXaxis()->SetBinLabel(20,"nUnexpErrorTGHT");
637 
638  fNentries->GetXaxis()->SetBinLabel(9,"nEvLSsel");
639  fNentries->GetXaxis()->SetBinLabel(10,"nEvLSPile-up Rej");
640  fNentries->GetXaxis()->SetBinLabel(11,"nEvLSGoodVtxS");
641  fNentries->GetXaxis()->SetBinLabel(12,"nEvLSRejVtxZ");
642  fNentries->GetXaxis()->SetBinLabel(13,"nTracksLSEv");
643  fNentries->GetXaxis()->SetBinLabel(14,"nCandLSEv");
644  fNentries->GetXaxis()->SetBinLabel(15,"nCandSelLSEv");
645  fNentries->GetXaxis()->SetBinLabel(21,"nUnexpErrorTGHT");
646 
647  /* ----------------- NOT ACTIVATED YET ------------------
648  fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1");
649  fNentries->GetXaxis()->SetBinLabel(6,"no daughter");
650  fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)");
651  fNentries->GetXaxis()->SetBinLabel(8,"PID=0");
652  fNentries->GetXaxis()->SetBinLabel(9,"PID=1");
653  fNentries->GetXaxis()->SetBinLabel(10,"PID=2");
654  fNentries->GetXaxis()->SetBinLabel(11,"PID=3");
655  fNentries->GetXaxis()->SetBinLabel(12,"K");
656  fNentries->GetXaxis()->SetBinLabel(13,"Lambda");
657  fNentries->GetXaxis()->SetBinLabel(14,"Pile-up Rej");
658  fNentries->GetXaxis()->SetBinLabel(15,"N. of 0SMH");
659  */
660 
661  fNentries->GetXaxis()->SetNdivisions(1,kFALSE);
662 
663  fSignalType=new TH1F("hsignaltype", "Histo for type of MC signal", 61,-1.,60.);
664  fSignalTypeLsCuts=new TH1F("hsignaltypeLsCuts", "Histo for type of MC signal with loose cuts", 61,-1.,60.);
665  fSignalTypeTghCuts=new TH1F("hsignaltypeTghCuts", "Histo for type of MC signal with tight cuts", 61,-1.,60.);
666 
667 
668 
669  fCounter = new AliNormalizationCounter(Form("%s",GetOutputSlot(5)->GetContainer()->GetName()));
670  fCounter->Init();
671 
672  //########## DEFINE THE TLISTS ##################
673  flistMCproperties=new TList();
674  flistMCproperties->SetOwner();
675  flistMCproperties->SetName("listMCproperties");
676 
677  flistNoCutsSignal = new TList();
678  flistNoCutsSignal->SetOwner();
679  flistNoCutsSignal->SetName("listNCsign");
680 
681  flistNoCutsBack = new TList();
682  flistNoCutsBack->SetOwner();
683  flistNoCutsBack->SetName("listNCback");
684 
685  flistNoCutsFromB = new TList();
686  flistNoCutsFromB->SetOwner();
687  flistNoCutsFromB->SetName("listNCfromB");
688 
689  flistNoCutsFromDstar = new TList();
690  flistNoCutsFromDstar->SetOwner();
691  flistNoCutsFromDstar->SetName("listNCfromDstar");
692 
693  flistNoCutsOther = new TList();
694  flistNoCutsOther->SetOwner();
695  flistNoCutsOther->SetName("listNCother");
696 
697 
698  flistLsCutsSignal = new TList();
699  flistLsCutsSignal->SetOwner();
700  flistLsCutsSignal->SetName("listLSCsign");
701 
702  flistLsCutsBack = new TList();
703  flistLsCutsBack->SetOwner();
704  flistLsCutsBack->SetName("listLSCback");
705 
706  flistLsCutsFromB = new TList();
707  flistLsCutsFromB->SetOwner();
708  flistLsCutsFromB->SetName("listLSCfromB");
709 
710  flistLsCutsFromDstar = new TList();
711  flistLsCutsFromDstar->SetOwner();
712  flistLsCutsFromDstar->SetName("listLSCfromDstar");
713 
714  flistLsCutsOther = new TList();
715  flistLsCutsOther->SetOwner();
716  flistLsCutsOther->SetName("listLSCother");
717 
718 
719  flistTghCutsSignal = new TList();
720  flistTghCutsSignal->SetOwner();
721  flistTghCutsSignal->SetName("listTGHCsign");
722 
723  flistTghCutsBack = new TList();
724  flistTghCutsBack->SetOwner();
725  flistTghCutsBack->SetName("listTGHCback");
726 
727  flistTghCutsFromB = new TList();
728  flistTghCutsFromB->SetOwner();
729  flistTghCutsFromB->SetName("listTGHCfromB");
730 
732  flistTghCutsFromDstar->SetOwner();
733  flistTghCutsFromDstar->SetName("listTGHCfromDstar");
734 
735  flistTghCutsOther = new TList();
736  flistTghCutsOther->SetOwner();
737  flistTghCutsOther->SetName("listTGHCother");
738 
739 
740 
741  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.};
742  Float_t dumbinning[201];
743  for(Int_t j=0;j<201;j++){
744  dumbinning[j]=(Float_t)j*0.5;
745  }
746 
747  // DEFINE EDGES FOR SPARSE HISTOS
748  const Int_t nPtbinsForSparse=91;//nuber of edges, -1 to get number of bins
749  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
750  Double_t pT=0;
751  Double_t massbins[186],impparbins[401];
752  Double_t massHypoBins[4]={1.,2.,3.,4.};
753  Int_t nbinsSparse[5]={185,185,nPtbinsForSparse-1,400,3};
754  for(Int_t nBins=0;nBins<nPtbinsForSparse;nBins++){
755  ptbinsForNsparse[nBins]=pT;
756  if(pT<8.)pT+=0.2;
757  else if(pT<20)pT+=0.5;
758  else if(pT<40)pT+=1;
759  else if(pT<70)pT+=5.;
760  }
761  for(Int_t nBins=0;nBins<186;nBins++){
762  massbins[nBins]=1.680+nBins*(2.050-1.680)/185.;
763  }
764  for(Int_t nBins=0;nBins<401;nBins++){
765  impparbins[nBins]=-1000+nBins*(2000.)/400.;
766  }
767 
768 
769  // Lxy and CosPointXY study
770  Int_t nbinsSparsCxyLxy[4]={84,fCutsTight->GetNPtBins(),10,20};
771  Double_t binLowLimitSparseCxyLxy[4]={1.680,fCutsTight->GetPtBinLimits()[0],0.99,0.};// Use OverFlow/UnderFlow to get other cases
772  Double_t binUpLimitSparseCxyLxy[4]={2.100,fCutsTight->GetPtBinLimits()[fCutsTight->GetNPtBins()],1.,20.};
773  Double_t *ptbinlimitsCxyLxy=new Double_t[fCutsTight->GetNPtBins()+1];
774  for(Int_t nBins=0;nBins<=fCutsTight->GetNPtBins();nBins++){
775  ptbinlimitsCxyLxy[nBins]=fCutsTight->GetPtBinLimits()[nBins];
776  }
777 
778 
779  //################################################################################################
780  // #
781  // HISTO FOR MC PROPERTIES OF D0, c quarks and B mesons #
782  // #
783  //################################################################################################
784  TH1F *hMCcquarkAllPt=new TH1F("hMCcquarkAllPt","c quark Pt (all cquarks produced)",34,ptbinsD0arr);
785  TH1F *hMCcquarkAllEta=new TH1F("hMCcquarkAllEta","c quark Eta (all cquarks produced)",50,-3.,3.);
786  TH1F *hMCcquarkAllEnergy=new TH1F("hMCcquarkAllEnergy","c quark Pt (all cquarks produced)",200,0.,100.);
787  TH1F *hMCcquarkNdaught=new TH1F("hMCcquarkNdaught","N cquark daughters (all cquarks produced)",100,0.,100.);
788  TH1F *hMCD0fromcPt=new TH1F("hMCD0fromcPt","D0 from c Pt",34,ptbinsD0arr);
789  TH1F *hMCD0fromcEta=new TH1F("hMCD0fromcEta","D0 from c Eta",50,-3.,3.);
790  TH1F *hMCD0fromcEnergy=new TH1F("hMCD0fromcEnergy","D0 from c Energy",200,0.,100.);
791 
792  TH2F *hMCD0VscquarkPt=new TH2F("hMCD0VscquarkPt","D0 pt Vs cquark pt",34,ptbinsD0arr,34,ptbinsD0arr);
793  TH2F *hMCD0VscquarkEnergy=new TH2F("hMCD0VscquarkEnergy","D0 Energy Vs cquark Energy",200,0.,50.,200,0.,50.);
794  TH1F *hMCD0deltacquarkEnergy=new TH1F("hMCD0deltacquarkEnergy","Fractional D0 Energy w.r.t. cquark Energy",20,0.,1.);
795  TH1F *hMCD0EnergyVsAvcquarkDaughtEn=new TH1F("hMCD0EnergyVsAvcquarkDaughtEn","#Delta(E^{D^0}-E_{avg})/E_{cquark}",40,-1.,1.);
796  TH1F *hMCD0cquarkAngle=new TH1F("hMCD0cquarkAngle","cosine of the angle between D0 and c quark particle",40,-1.,1.);
797  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.);
798 
799  TH1I *hMCfromBpdgB=new TH1I("hMCfromBpdgB","hMCfromBpdgB",10000,0.,10000);
800  TH1F *hMCBhadrPt=new TH1F("hMCBhadrPt","B hadr Pt",34,ptbinsD0arr);
801  TH1F *hMCBhadrEta=new TH1F("hMCBhadrEta","B hadr Eta",50,-3.,3.);
802  TH1F *hMCBhadrEnergy=new TH1F("hMCBhadrEnergy","B hadr Pt",200,0.,100.);
803  TH1F *hMCBhadrNdaught=new TH1F("hMCBhadrNdaught","N Bhadr daughters",100,0.,100.);
804  TH1F *hMCD0fromBPt=new TH1F("hMCD0fromBPt","D0 from B Pt",34,ptbinsD0arr);
805  TH1F *hMCD0fromBEta=new TH1F("hMCD0fromBEta","D0 from B Eta",50,-3.,3.);
806  TH1F *hMCD0fromBEnergy=new TH1F("hMCD0fromBEnergy","D0 from B Energy",200,0.,100.);
807 
808  TH2F *hMCD0VsBhadrPt=new TH2F("hMCD0VsBhadrPt","D0 pt Vs Bhadr pt",34,ptbinsD0arr,34,ptbinsD0arr);
809  TH2F *hMCD0VsBhadrEnergy=new TH2F("hMCD0VsBhadrEnergy","D0 Energy Vs Bhadr Energy",200,0.,50.,200,0.,50.);
810  TH1F *hMCD0deltaBhadrEnergy=new TH1F("hMCD0deltaBhadrEnergy","Fractional D0 Energy w.r.t. Bhadr Energy",20,0.,1.);
811  TH1F *hMCD0EnergyVsAvBDaughtEn=new TH1F("hMCD0EnergyVsAvBDaughtEn","#Delta(E^{D^0}-E_{avg})/E_{Bahdr}",40,-1.,1.);
812  TH1F *hMCD0BhadrAngle=new TH1F("hMCD0BhadrAngle","cosine of the angle between D0 and Bhadr particle",40,-1.,1.);
813  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.);
814 
815  TH1I *hMCPartFound=new TH1I("hMCPartFound","1=c,2=D0,3=fromBall,4=fromBmeson,5=fromBbaryon",6,0,6);
816 
817 
818  flistMCproperties->Add(hMCcquarkAllPt);
819  flistMCproperties->Add(hMCcquarkAllEta);
820  flistMCproperties->Add(hMCcquarkAllEnergy);
821  flistMCproperties->Add(hMCcquarkNdaught);
822  flistMCproperties->Add(hMCD0fromcPt);
823  flistMCproperties->Add(hMCD0fromcEta);
824  flistMCproperties->Add(hMCD0fromcEnergy);
825  flistMCproperties->Add(hMCD0VscquarkPt);
826  flistMCproperties->Add(hMCD0VscquarkEnergy);
827  flistMCproperties->Add(hMCD0deltacquarkEnergy);
828  flistMCproperties->Add(hMCD0EnergyVsAvcquarkDaughtEn);
829  flistMCproperties->Add(hMCD0cquarkAngle);
830  flistMCproperties->Add(hMCD0cquarkAngleEnergy);
831 
832  flistMCproperties->Add(hMCfromBpdgB);
833  flistMCproperties->Add(hMCBhadrPt);
834  flistMCproperties->Add(hMCBhadrEta);
835  flistMCproperties->Add(hMCBhadrEnergy);
836  flistMCproperties->Add(hMCBhadrNdaught);
837  flistMCproperties->Add(hMCD0fromBPt);
838  flistMCproperties->Add(hMCD0fromBEta);
839  flistMCproperties->Add(hMCD0fromBEnergy);
840  flistMCproperties->Add(hMCD0VsBhadrPt);
841  flistMCproperties->Add(hMCD0VsBhadrEnergy);
842  flistMCproperties->Add(hMCD0deltaBhadrEnergy);
843  flistMCproperties->Add(hMCD0EnergyVsAvBDaughtEn);
844  flistMCproperties->Add(hMCD0BhadrAngle);
845  flistMCproperties->Add(hMCD0BhadrAngleEnergy);
846  flistMCproperties->Add(hMCPartFound);
847 
848  //################################################################################################
849  // #
850  // HISTOS FOR NO CUTS CASE #
851  // #
852  //################################################################################################
853  Printf("AFTER MC HISTOS \n");
854 
855  //############ NO CUTS SIGNAL HISTOGRAMS ###############
856  //
857  // ####### global properties histo ############
858 
859  TH2F *hCPtaVSd0d0NCsign=new TH2F("hCPtaVSd0d0NCsign","hCPtaVSd0d0_NoCuts_Signal",1000,-100000.,100000.,100,-1.,1.);
860  TH1F *hSecVtxZNCsign=new TH1F("hSecVtxZNCsign","hSecVtxZ_NoCuts_Signal",1000,-8.,8.);
861  TH1F *hSecVtxXNCsign=new TH1F("hSecVtxXNCsign","hSecVtxX_NoCuts_Signal",1000,-3000.,3000.);
862  TH1F *hSecVtxYNCsign=new TH1F("hSecVtxYNCsign","hSecVtxY_NoCuts_Signal",1000,-3000.,3000.);
863  TH2F *hSecVtxXYNCsign=new TH2F("hSecVtxXYNCsign","hSecVtxXY_NoCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
864  TH1F *hSecVtxPhiNCsign=new TH1F("hSecVtxPhiNCsign","hSecVtxPhi_NoCuts_Signal",180,-180.1,180.1);
865  TH1F *hd0singlTrackNCsign=new TH1F("hd0singlTrackNCsign","hd0singlTrackNoCuts_Signal",1000,-5000.,5000.);
866  TH1F *hCPtaNCsign=new TH1F("hCPtaNCsign","hCPta_NoCuts_Signal",100,-1.,1.);
867  TH1F *hd0xd0NCsign=new TH1F("hd0xd0NCsign","hd0xd0_NoCuts_Signal",1000,-100000.,100000.);
868  TH1F *hMassTrueNCsign=new TH1F("hMassTrueNCsign","D^{0} MC inv. Mass No Cuts Signal(All momenta)",600,1.600,2.200);
869  TH1F *hMassNCsign=new TH1F("hMassNCsign","D^{0} inv. Mass No Cuts Signal (All momenta)",600,1.600,2.200);
870  hMassNCsign->Sumw2();
871  TH1F *hMassTrueNCsignPM=new TH1F("hMassTrueNCsignPM","D^{0} MC inv. Mass No Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
872  TH1F *hMassNCsignPM=new TH1F("hMassNCsignPM","D^{0} inv. Mass No Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
873  hMassNCsignPM->Sumw2();
874 
875  TH1F *hMassTrueNCsignSB=new TH1F("hMassTrueNCsignSB","D^{0} MC inv. Mass in Side Bands No Cuts Signal(All momenta)",600,1.600,2.200);
876  TH1F *hMassNCsignSB=new TH1F("hMassNCsignSB","D^{0} inv. Mass in Side Bands No Cuts Signal (All momenta)",600,1.600,2.200);
877  hMassNCsignSB->Sumw2();
878 
879  flistNoCutsSignal->Add(hCPtaVSd0d0NCsign);
880  flistNoCutsSignal->Add(hSecVtxZNCsign);
881  flistNoCutsSignal->Add(hSecVtxYNCsign);
882  flistNoCutsSignal->Add(hSecVtxXNCsign);
883  flistNoCutsSignal->Add(hSecVtxXYNCsign);
884  flistNoCutsSignal->Add(hSecVtxPhiNCsign);
885  flistNoCutsSignal->Add(hd0singlTrackNCsign);
886  flistNoCutsSignal->Add(hCPtaNCsign);
887  flistNoCutsSignal->Add(hd0xd0NCsign);
888  flistNoCutsSignal->Add(hMassTrueNCsign);
889  flistNoCutsSignal->Add(hMassNCsign);
890  flistNoCutsSignal->Add(hMassTrueNCsignPM);
891  flistNoCutsSignal->Add(hMassNCsignPM);
892  flistNoCutsSignal->Add(hMassTrueNCsignSB);
893  flistNoCutsSignal->Add(hMassNCsignSB);
894 
895  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
896  TH1F *hdcaNCsign=new TH1F("hdcaNCsign","hdca_NoCuts_Signal",100,0.,1000.);
897  hdcaNCsign->SetXTitle("dca [#mum]");
898  hdcaNCsign->SetYTitle("Entries");
899  TH1F *hcosthetastarNCsign=new TH1F("hcosthetastarNCsign","hCosThetaStar_NoCuts_Signal",50,-1.,1.);
900  hcosthetastarNCsign->SetXTitle("cos #theta^{*}");
901  hcosthetastarNCsign->SetYTitle("Entries");
902  TH1F *hptD0NCsign=new TH1F("hptD0NCsign","D^{0} transverse momentum distribution",34,ptbinsD0arr);
903  hptD0NCsign->SetXTitle("p_{t} [GeV/c]");
904  hptD0NCsign->SetYTitle("Entries");
905  TH1F *hptD0VsMaxPtNCsign=new TH1F("hptD0VsMaxPtNCsign","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
906  TH2F *hptD0PTallsqrtNCsign=new TH2F("hptD0PTallsqrtNCsign","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
907  TH2F *hptD0PTallNCsign=new TH2F("hptD0PTallNCsign","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
908  TH2F *hptD0vsptBNCsign=new TH2F("hptD0vsptBNCsign","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
909  TH2F *hpD0vspBNCsign=new TH2F("hpD0vspBNCsign","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
910  TH2F *hptD0vsptcquarkNCsign=new TH2F("hptD0vsptcquarkNCsign","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
911  TH2F *hpD0vspcquarkNCsign=new TH2F("hpD0vspcquarkNCsign","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
912  flistNoCutsSignal->Add(hdcaNCsign);
913  flistNoCutsSignal->Add(hcosthetastarNCsign);
914  flistNoCutsSignal->Add(hptD0NCsign);
915  flistNoCutsSignal->Add(hptD0VsMaxPtNCsign);
916  flistNoCutsSignal->Add(hptD0PTallsqrtNCsign);
917  flistNoCutsSignal->Add(hptD0PTallNCsign);
918  flistNoCutsSignal->Add(hptD0vsptBNCsign);
919  flistNoCutsSignal->Add(hpD0vspBNCsign);
920  flistNoCutsSignal->Add(hptD0vsptcquarkNCsign);
921  flistNoCutsSignal->Add(hpD0vspcquarkNCsign);
922 
923  TH1F *hd0zD0ptNCsign;
924  TH1F *hInvMassD0NCsign,*hInvMassD0barNCsign;
925  TH2F *hInvMassPtNCsign=new TH2F("hInvMassPtNCsign","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
926  flistNoCutsSignal->Add(hInvMassPtNCsign);
927 
928  TH3F *hInvMassPtSelSignOnlyNCsign=new TH3F("hInvMassPtSelSignOnlyNCsign","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
929  flistNoCutsSignal->Add(hInvMassPtSelSignOnlyNCsign);
930  TH3F *hInvMassPtSelReflOnlyNCsign=new TH3F("hInvMassPtSelReflOnlyNCsign","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
931  flistNoCutsSignal->Add(hInvMassPtSelReflOnlyNCsign);
932 
933  THnSparseF *hSparseNCsign=new THnSparseF("hSparseNCsign","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
934  hSparseNCsign->SetBinEdges(0,massbins);
935  hSparseNCsign->SetBinEdges(1,massbins);
936  hSparseNCsign->SetBinEdges(2,ptbinsForNsparse);
937  hSparseNCsign->SetBinEdges(3,impparbins);
938  hSparseNCsign->SetBinEdges(4,massHypoBins);
939  flistNoCutsSignal->Add(hSparseNCsign);
940 
941  const Int_t nVar=10;
942  TString *candidateVariableNames = new TString[nVar];
943  candidateVariableNames[0]="massD0";
944  candidateVariableNames[1]="massD0bar";
945  candidateVariableNames[2]="pt";
946  candidateVariableNames[3]="impactpar";
947  candidateVariableNames[4]="selcase";
948  candidateVariableNames[5]="impactparxy";
949  candidateVariableNames[6]="impactparz";
950  candidateVariableNames[7]="impactparcov0";
951  candidateVariableNames[8]="impactparcov1";
952  candidateVariableNames[9]="impactparcov2";
953  fTreeNCsign = new TTree("fTreeNCsign","Candidate variables tree");
955  for(Int_t ivar=0; ivar<nVar; ivar++){
956  fTreeNCsign->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeNCsign[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
957  }
959 
960 
961  THnSparseF *hSparseCxyLxyNCsign=new THnSparseF("hSparseCxyLxyNCsign","Candidate Mass;massD0;Pt;CosXY;Lxy",4,nbinsSparsCxyLxy,binLowLimitSparseCxyLxy,binUpLimitSparseCxyLxy);
962  hSparseCxyLxyNCsign->SetBinEdges(1,ptbinlimitsCxyLxy);
963  hSparseCxyLxyNCsign->GetAxis(0)->SetName("mass");
964  hSparseCxyLxyNCsign->GetAxis(0)->SetTitle("Invariant Mass (K#pi) [GeV/c^{2}]");
965  hSparseCxyLxyNCsign->GetAxis(1)->SetName("pt");
966  hSparseCxyLxyNCsign->GetAxis(1)->SetTitle("p_{t} [GeV/c]");
967  hSparseCxyLxyNCsign->GetAxis(2)->SetName("CosPointXY");
968  hSparseCxyLxyNCsign->GetAxis(2)->SetTitle("Cos#theta_{point}^{XY}");
969  hSparseCxyLxyNCsign->GetAxis(3)->SetName("NormDecLengthXY");
970  hSparseCxyLxyNCsign->GetAxis(3)->SetTitle("Normalized XY decay length");
971 
972  flistNoCutsSignal->Add(hSparseCxyLxyNCsign);
973 
974 
975 
976  TH1F *hetaNCsign;
977  TH1F *hCosPDPBNCsign;
978  TH1F *hCosPcPDNCsign;
979  // ADDITIONAL HISTOS
980  TH2F *hd0D0VSd0xd0NCsignpt;
981  TH2F *hangletracksVSd0xd0NCsignpt;
982  TH2F *hangletracksVSd0D0NCsignpt;
983  TH1F *hd0xd0NCsignpt;
984  // AZIMUHAL HISTOS
985  TH1F *hPhiHistPMNCsignpt,*hPhiHistSBNCsignpt;
986 
987 
988  TH2F *hTOFpidNCsign=new TH2F("hTOFpidNCsign","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
989  flistNoCutsSignal->Add(hTOFpidNCsign);
990 
991 
992 
993  //##################
994  for(Int_t i=0;i<fnbins;i++){
995  //Printf("INSIDE HISTOS CREATION LOOP: %d \n",fnbins);
996 
997  namehist="hPhiHistPMNCsign_pt";
998  namehist+=i;
999  titlehist="Azimuthal correlation No Cuts Sign PM ptbin=";
1000  titlehist+=i;
1001  hPhiHistPMNCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
1002  hPhiHistPMNCsignpt->Sumw2();
1003  flistNoCutsSignal->Add(hPhiHistPMNCsignpt);
1004 
1005  namehist="hPhiHistSBNCsign_pt";
1006  namehist+=i;
1007  titlehist="Azimuthal correlation No Cuts Sign SB ptbin=";
1008  titlehist+=i;
1009  hPhiHistSBNCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
1010  hPhiHistSBNCsignpt->Sumw2();
1011  flistNoCutsSignal->Add(hPhiHistSBNCsignpt);
1012 
1013 
1014  namehist="hd0zD0ptNCsign_pt";
1015  namehist+=i;
1016  titlehist="d0(z) No Cuts Signalm ptbin=";
1017  titlehist+=i;
1018  hd0zD0ptNCsign=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1019  hd0zD0ptNCsign->SetXTitle("d_{0}(z) [#mum]");
1020  hd0zD0ptNCsign->SetYTitle("Entries");
1021  flistNoCutsSignal->Add(hd0zD0ptNCsign);
1022 
1023  namehist="hInvMassD0NCsign_pt";
1024  namehist+=i;
1025  titlehist="Invariant Mass D0 No Cuts Signal ptbin=";
1026  titlehist+=i;
1027  hInvMassD0NCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1028  hInvMassD0NCsign->SetXTitle("Invariant Mass [GeV]");
1029  hInvMassD0NCsign->SetYTitle("Entries");
1030  flistNoCutsSignal->Add(hInvMassD0NCsign);
1031 
1032 
1033  namehist="hInvMassD0barNCsign_pt";
1034  namehist+=i;
1035  titlehist="Invariant Mass D0bar No Cuts Signal ptbin=";
1036  titlehist+=i;
1037  hInvMassD0barNCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1038  hInvMassD0barNCsign->SetXTitle("Invariant Mass [GeV]");
1039  hInvMassD0barNCsign->SetYTitle("Entries");
1040  flistNoCutsSignal->Add(hInvMassD0barNCsign);
1041 
1042 
1043  namehist="hetaNCsign_pt";
1044  namehist+=i;
1045  titlehist="eta No Cuts Signal ptbin=";
1046  titlehist+=i;
1047  hetaNCsign=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1048  hetaNCsign->SetXTitle("Pseudorapidity");
1049  hetaNCsign->SetYTitle("Entries");
1050  flistNoCutsSignal->Add(hetaNCsign);
1051 
1052  namehist="hCosPDPBNCsign_pt";
1053  namehist+=i;
1054  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1055  titlehist+=i;
1056  hCosPDPBNCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1057  hCosPDPBNCsign->SetXTitle("Cosine between D0 momentum and B momentum");
1058  hCosPDPBNCsign->SetYTitle("Entries");
1059  flistNoCutsSignal->Add(hCosPDPBNCsign);
1060 
1061  namehist="hCosPcPDNCsign_pt";
1062  namehist+=i;
1063  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1064  titlehist+=i;
1065  hCosPcPDNCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1066  hCosPcPDNCsign->SetXTitle("Cosine between c quark momentum and D0 momentum");
1067  hCosPcPDNCsign->SetYTitle("Entries");
1068  flistNoCutsSignal->Add(hCosPcPDNCsign);
1069 
1070 
1071  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1072  namehist="hd0xd0NCsign_pt";
1073  namehist+=i;
1074  titlehist="d0xd0 No Cuts Signal ptbin=";
1075  titlehist+=i;
1076  hd0xd0NCsignpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1077  hd0xd0NCsignpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
1078  hd0xd0NCsignpt->SetYTitle("Entries");
1079  flistNoCutsSignal->Add(hd0xd0NCsignpt);
1080 
1081 
1082  namehist="hd0D0VSd0xd0NCsign_pt";
1083  namehist+=i;
1084  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Signal ptbin=";
1085  titlehist+=i;
1086  hd0D0VSd0xd0NCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1087  hd0D0VSd0xd0NCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1088  hd0D0VSd0xd0NCsignpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
1089  flistNoCutsSignal->Add(hd0D0VSd0xd0NCsignpt);
1090 
1091 
1092  namehist="hangletracksVSd0xd0NCsign_pt";
1093  namehist+=i;
1094  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Signal ptbin=";
1095  titlehist+=i;
1096  hangletracksVSd0xd0NCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1097  hangletracksVSd0xd0NCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1098  hangletracksVSd0xd0NCsignpt->SetYTitle(" angle between K and #p tracks [rad]");
1099  flistNoCutsSignal->Add(hangletracksVSd0xd0NCsignpt);
1100 
1101 
1102  namehist="hangletracksVSd0D0NCsign_pt";
1103  namehist+=i;
1104  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Signal ptbin=";
1105  titlehist+=i;
1106  hangletracksVSd0D0NCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1107  hangletracksVSd0D0NCsignpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1108  hangletracksVSd0D0NCsignpt->SetYTitle(" angle between K and #p tracks [rad]");
1109  flistNoCutsSignal->Add(hangletracksVSd0D0NCsignpt);
1110 
1111  }
1112  Printf("AFTER LOOP HISTOS CREATION \n");
1113  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1114  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115 
1116  // ####### d0 D0 histos ############
1117  TH1F *hd0D0NCsignPM = new TH1F("hd0D0NCsignPM","D^{0} impact par. plot , No Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1118  hd0D0NCsignPM->SetXTitle("Impact parameter [#mum]");
1119  hd0D0NCsignPM->SetYTitle("Entries");
1120 
1121  TH1F *hd0D0VtxTrueNCsignPM = new TH1F("hd0D0VtxTrueNCsignPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1122  hd0D0VtxTrueNCsignPM->SetXTitle("Impact parameter [#mum]");
1123  hd0D0VtxTrueNCsignPM->SetYTitle("Entries");
1124 
1125  TH1F *hMCd0D0NCsignPM = new TH1F("hMCd0D0NCsignPM","D^{0} impact par. plot, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1126  hMCd0D0NCsignPM->SetXTitle("MC Impact parameter [#mum]");
1127  hMCd0D0NCsignPM->SetYTitle("Entries");
1128 
1129  TH1F *hd0D0NCsignSB = new TH1F("hd0D0NCsignSB","D^{0} impact par. plot , No Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1130  hd0D0NCsignSB->SetXTitle("Impact parameter [#mum]");
1131  hd0D0NCsignSB->SetYTitle("Entries");
1132 
1133  TH1F *hd0D0VtxTrueNCsignSB = new TH1F("hd0D0VtxTrueNCsignSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1134  hd0D0VtxTrueNCsignSB->SetXTitle("Impact parameter [#mum]");
1135  hd0D0VtxTrueNCsignSB->SetYTitle("Entries");
1136 
1137  TH1F *hMCd0D0NCsignSB = new TH1F("hMCd0D0NCsignSB","D^{0} impact par. plot, No Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
1138  hMCd0D0NCsignSB->SetXTitle("MC Impact parameter [#mum]");
1139  hMCd0D0NCsignSB->SetYTitle("Entries");
1140 
1141  flistNoCutsSignal->Add(hd0D0NCsignPM);
1142  flistNoCutsSignal->Add(hd0D0VtxTrueNCsignPM);
1143  flistNoCutsSignal->Add(hMCd0D0NCsignPM);
1144  flistNoCutsSignal->Add(hd0D0NCsignSB);
1145  flistNoCutsSignal->Add(hd0D0VtxTrueNCsignSB);
1146  flistNoCutsSignal->Add(hMCd0D0NCsignSB);
1147 
1148  TH1F *hd0D0ptNCsignPM;
1149  TH1F *hMCd0D0ptNCsignPM;
1150  TH1F *hd0D0VtxTrueptNCsignPM;
1151  TH1F *hd0D0ptNCsignSB;
1152  TH1F *hMCd0D0ptNCsignSB;
1153  TH1F *hd0D0VtxTrueptNCsignSB;
1154  namehist="hd0D0ptNCsign_";
1155  titlehist="D^{0} impact par. plot, No Cuts, Signal, ";
1156  for(Int_t i=0;i<fnbins;i++){
1157  //Printf("IN HISTOS CREATION USING PTBINS VALUES for NAMES \n");
1158  strnamept=namehist;
1159  strnamept.Append("PkMss_pt");
1160  strnamept+=i;
1161 
1162  strtitlept=titlehist;
1163  strtitlept.Append(" Mass Peak, ");
1164 
1165  strtitlept+=fptbins[i];
1166  //Printf("IN HISTOS CREATION USING PTBINS VALUES for NAMES %d: %f\n",i,fptbins[i]);
1167  strtitlept.Append("<= pt <");
1168  strtitlept+=fptbins[i+1];
1169  strtitlept.Append(" [GeV/c]");
1170 
1171  hd0D0ptNCsignPM= new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1172  hd0D0ptNCsignPM->SetXTitle("Impact parameter [#mum] ");
1173  hd0D0ptNCsignPM->SetYTitle("Entries");
1174  flistNoCutsSignal->Add(hd0D0ptNCsignPM);
1175 
1176  strnamept.ReplaceAll("hd0D0","hMCd0D0");
1177  hMCd0D0ptNCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1178  hMCd0D0ptNCsignPM->SetXTitle("MC Impact parameter [#mum] ");
1179  hMCd0D0ptNCsignPM->SetYTitle("Entries");
1180  flistNoCutsSignal->Add(hMCd0D0ptNCsignPM);
1181 
1182 
1183  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1184  hd0D0VtxTrueptNCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1185  hd0D0VtxTrueptNCsignPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1186  hd0D0VtxTrueptNCsignPM->SetYTitle("Entries");
1187  flistNoCutsSignal->Add(hd0D0VtxTrueptNCsignPM);
1188 
1189  strnamept=namehist;
1190  strnamept.Append("SBMss_pt");
1191  strnamept+=i;
1192 
1193  strtitlept=titlehist;
1194  strtitlept.Append(" Side Bands, ");
1195  strtitlept+=fptbins[i];
1196  strtitlept.Append("<= pt <");
1197  strtitlept+=fptbins[i+1];
1198  strtitlept.Append(" [GeV/c]");
1199 
1200  hd0D0ptNCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1201  hd0D0ptNCsignSB->SetXTitle("Impact parameter [#mum] ");
1202  hd0D0ptNCsignSB->SetYTitle("Entries");
1203  flistNoCutsSignal->Add(hd0D0ptNCsignSB);
1204 
1205  strnamept.ReplaceAll("hd0D0","hMCd0D0");
1206  hMCd0D0ptNCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1207  hMCd0D0ptNCsignSB->SetXTitle("MC Impact parameter [#mum] ");
1208  hMCd0D0ptNCsignSB->SetYTitle("Entries");
1209  flistNoCutsSignal->Add(hMCd0D0ptNCsignSB);
1210 
1211  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1212  hd0D0VtxTrueptNCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1213  hd0D0VtxTrueptNCsignSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1214  hd0D0VtxTrueptNCsignSB->SetYTitle("Entries");
1215  flistNoCutsSignal->Add(hd0D0VtxTrueptNCsignSB);
1216  }
1217 
1218  //Printf("AFTER SIGNAL HISTOS CREATION for NOCUTS\n");
1219 
1220 
1221  //############ NO CUTS BACKGROUND HISTOGRAMS ###########
1222  //
1223  // ######## global properties histos #######
1224  TH2F *hCPtaVSd0d0NCback=new TH2F("hCPtaVSd0d0NCback","hCPtaVSd0d0_NoCuts_Background",1000,-100000.,100000.,100,-1.,1.);
1225  TH1F *hSecVtxZNCback=new TH1F("hSecVtxZNCback","hSecVtxZ_NoCuts_Background",1000,-8.,8.);
1226  TH1F *hSecVtxXNCback=new TH1F("hSecVtxXNCback","hSecVtxX_NoCuts_Background",1000,-3000.,3000.);
1227  TH1F *hSecVtxYNCback=new TH1F("hSecVtxYNCback","hSecVtxY_NoCuts_Background",1000,-3000.,3000.);
1228  TH2F *hSecVtxXYNCback=new TH2F("hSecVtxXYNCback","hSecVtxXY_NoCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
1229  TH1F *hSecVtxPhiNCback=new TH1F("hSecVtxPhiNCback","hSecVtxPhi_NoCuts_Background",180,-180.1,180.1);
1230  TH1F *hd0singlTrackNCback=new TH1F("hd0singlTrackNCback","hd0singlTrackNoCuts_Back",1000,-5000.,5000.);
1231  TH1F *hCPtaNCback=new TH1F("hCPtaNCback","hCPta_NoCuts_Background",100,-1.,1.);
1232  TH1F *hd0xd0NCback=new TH1F("hd0xd0NCback","hd0xd0_NoCuts_Background",1000,-100000.,100000.);
1233  TH1F *hMassTrueNCback=new TH1F("hMassTrueNCback","D^{0} MC inv. Mass No Cuts Background(All momenta)",600,1.600,2.200);
1234  TH1F *hMassNCback=new TH1F("hMassNCback","D^{0} inv. Mass No Cuts Background (All momenta)",600,1.600,2.200);
1235  hMassNCback->Sumw2();
1236  TH1F *hMassTrueNCbackPM=new TH1F("hMassTrueNCbackPM","D^{0} MC inv. Mass No Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
1237  TH1F *hMassNCbackPM=new TH1F("hMassNCbackPM","D^{0} inv. Mass No Cuts Background (All momenta), MassPeak",600,1.600,2.200);
1238  hMassNCbackPM->Sumw2();
1239  TH1F *hMassTrueNCbackSB=new TH1F("hMassTrueNCbackSB","D^{0} MC inv. Mass in Side Bands No Cuts Background(All momenta)",600,1.600,2.200);
1240  TH1F *hMassNCbackSB=new TH1F("hMassNCbackSB","D^{0} inv. Mass in Side Bands No Cuts Background (All momenta)",600,1.600,2.200);
1241  hMassNCbackSB->Sumw2();
1242 
1243  flistNoCutsBack->Add(hCPtaVSd0d0NCback);
1244  flistNoCutsBack->Add(hSecVtxZNCback);
1245  flistNoCutsBack->Add(hSecVtxYNCback);
1246  flistNoCutsBack->Add(hSecVtxXNCback);
1247  flistNoCutsBack->Add(hSecVtxXYNCback);
1248  flistNoCutsBack->Add(hSecVtxPhiNCback);
1249  flistNoCutsBack->Add(hd0singlTrackNCback);
1250  flistNoCutsBack->Add(hCPtaNCback);
1251  flistNoCutsBack->Add(hd0xd0NCback);
1252  flistNoCutsBack->Add(hMassTrueNCback);
1253  flistNoCutsBack->Add(hMassNCback);
1254  flistNoCutsBack->Add(hMassTrueNCbackPM);
1255  flistNoCutsBack->Add(hMassNCbackPM);
1256  flistNoCutsBack->Add(hMassTrueNCbackSB);
1257  flistNoCutsBack->Add(hMassNCbackSB);
1258 
1259 
1260  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1261  TH1F *hdcaNCback=new TH1F("hdcaNCback","hdca_NoCuts_Backgr",100,0.,1000.);
1262  hdcaNCback->SetXTitle("dca [#mum]");
1263  hdcaNCback->SetYTitle("Entries");
1264  TH1F *hcosthetastarNCback=new TH1F("hcosthetastarNCback","hCosThetaStar_NoCuts_Backgr",50,-1.,1.);
1265  hcosthetastarNCback->SetXTitle("cos #theta^{*}");
1266  hcosthetastarNCback->SetYTitle("Entries");
1267  TH1F *hptD0NCback=new TH1F("hptD0NCback","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1268  hptD0NCback->SetXTitle("p_{t} [GeV/c]");
1269  hptD0NCback->SetYTitle("Entries");
1270  TH1F *hptD0VsMaxPtNCback=new TH1F("hptD0VsMaxPtNCback","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1271  TH2F *hptD0PTallsqrtNCback=new TH2F("hptD0PTallsqrtNCback","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1272  TH2F *hptD0PTallNCback=new TH2F("hptD0PTallNCback","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1273  TH2F *hptD0vsptBNCback=new TH2F("hptD0vsptBNCback","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1274  TH2F *hpD0vspBNCback=new TH2F("hpD0vspBNCback","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1275  TH2F *hptD0vsptcquarkNCback=new TH2F("hptD0vsptcquarkNCback","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1276  TH2F *hpD0vspcquarkNCback=new TH2F("hpD0vspcquarkNCback","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1277  flistNoCutsBack->Add(hdcaNCback);
1278  flistNoCutsBack->Add(hcosthetastarNCback);
1279  flistNoCutsBack->Add(hptD0NCback);
1280  flistNoCutsBack->Add(hptD0VsMaxPtNCback);
1281  flistNoCutsBack->Add(hptD0PTallsqrtNCback);
1282  flistNoCutsBack->Add(hptD0PTallNCback);
1283  flistNoCutsBack->Add(hptD0vsptBNCback);
1284  flistNoCutsBack->Add(hpD0vspBNCback);
1285  flistNoCutsBack->Add(hptD0vsptcquarkNCback);
1286  flistNoCutsBack->Add(hpD0vspcquarkNCback);
1287 
1288  TH1F *hd0zD0ptNCback;
1289  TH1F *hInvMassD0NCback,*hInvMassD0barNCback;
1290  TH2F *hInvMassPtNCback=new TH2F("hInvMassPtNCback","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1291  THnSparseF *hSparseNCback=new THnSparseF("hSparseNCback","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1292  hSparseNCback->SetBinEdges(0,massbins);
1293  hSparseNCback->SetBinEdges(1,massbins);
1294  hSparseNCback->SetBinEdges(2,ptbinsForNsparse);
1295  hSparseNCback->SetBinEdges(3,impparbins);
1296  hSparseNCback->SetBinEdges(4,massHypoBins);
1297  flistNoCutsBack->Add(hSparseNCback);
1298 
1299  fTreeNCback = new TTree("fTreeNCback","Candidate variables tree");
1301  for(Int_t ivar=0; ivar<nVar; ivar++){
1302  fTreeNCback->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeNCback[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
1303  }
1305 
1306 
1307  TH1F *hetaNCback;
1308  TH1F *hCosPDPBNCback;
1309  TH1F *hCosPcPDNCback;
1310  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1311  TH2F *hd0D0VSd0xd0NCbackpt;
1312  TH2F *hangletracksVSd0xd0NCbackpt;
1313  TH2F *hangletracksVSd0D0NCbackpt;
1314  TH1F *hd0xd0NCbackpt;
1315  flistNoCutsBack->Add(hInvMassPtNCback);
1316 
1317  TH2F *hTOFpidNCback=new TH2F("hTOFpidNCback","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1318  flistNoCutsBack->Add(hTOFpidNCback);
1319 
1320  for(Int_t i=0;i<fnbins;i++){
1321  namehist="hd0zD0ptNCback_pt";
1322  namehist+=i;
1323  titlehist="d0(z) No Cuts Backgrm ptbin=";
1324  titlehist+=i;
1325  hd0zD0ptNCback=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1326  hd0zD0ptNCback->SetXTitle("d_{0}(z) [#mum]");
1327  hd0zD0ptNCback->SetYTitle("Entries");
1328  flistNoCutsBack->Add(hd0zD0ptNCback);
1329 
1330  namehist="hInvMassD0NCback_pt";
1331  namehist+=i;
1332  titlehist="Invariant Mass No Cuts Backgr ptbin=";
1333  titlehist+=i;
1334  hInvMassD0NCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1335  hInvMassD0NCback->SetXTitle("Invariant Mass [GeV]");
1336  hInvMassD0NCback->SetYTitle("Entries");
1337  flistNoCutsBack->Add(hInvMassD0NCback);
1338 
1339 
1340  namehist="hInvMassD0barNCback_pt";
1341  namehist+=i;
1342  titlehist="Invariant Mass D0bar No Cuts Back ptbin=";
1343  titlehist+=i;
1344  hInvMassD0barNCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1345  hInvMassD0barNCback->SetXTitle("Invariant Mass [GeV]");
1346  hInvMassD0barNCback->SetYTitle("Entries");
1347  flistNoCutsBack->Add(hInvMassD0barNCback);
1348 
1349 
1350  namehist="hetaNCback_pt";
1351  namehist+=i;
1352  titlehist="eta No Cuts Backgr ptbin=";
1353  titlehist+=i;
1354  hetaNCback=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1355  hetaNCback->SetXTitle("Pseudorapidity");
1356  hetaNCback->SetYTitle("Entries");
1357  flistNoCutsBack->Add(hetaNCback);
1358 
1359  namehist="hCosPDPBNCback_pt";
1360  namehist+=i;
1361  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1362  titlehist+=i;
1363  hCosPDPBNCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1364  hCosPDPBNCback->SetXTitle("Cosine between D0 momentum and B momentum");
1365  hCosPDPBNCback->SetYTitle("Entries");
1366  flistNoCutsBack->Add(hCosPDPBNCback);
1367 
1368  namehist="hCosPcPDNCback_pt";
1369  namehist+=i;
1370  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1371  titlehist+=i;
1372  hCosPcPDNCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1373  hCosPcPDNCback->SetXTitle("Cosine between c quark momentum and D0 momentum");
1374  hCosPcPDNCback->SetYTitle("Entries");
1375  flistNoCutsBack->Add(hCosPcPDNCback);
1376 
1377 
1378  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1379  namehist="hd0xd0NCback_pt";
1380  namehist+=i;
1381  titlehist="d0xd0 No Cuts Background ptbin=";
1382  titlehist+=i;
1383  hd0xd0NCbackpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1384  hd0xd0NCbackpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
1385  hd0xd0NCbackpt->SetYTitle("Entries");
1386  flistNoCutsBack->Add(hd0xd0NCbackpt);
1387 
1388 
1389  namehist="hd0D0VSd0xd0NCback_pt";
1390  namehist+=i;
1391  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Back ptbin=";
1392  titlehist+=i;
1393  hd0D0VSd0xd0NCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1394  hd0D0VSd0xd0NCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1395  hd0D0VSd0xd0NCbackpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
1396  flistNoCutsBack->Add(hd0D0VSd0xd0NCbackpt);
1397 
1398 
1399  namehist="hangletracksVSd0xd0NCback_pt";
1400  namehist+=i;
1401  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Back ptbin=";
1402  titlehist+=i;
1403  hangletracksVSd0xd0NCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1404  hangletracksVSd0xd0NCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1405  hangletracksVSd0xd0NCbackpt->SetYTitle(" angle between K and #p tracks [rad]");
1406  flistNoCutsBack->Add(hangletracksVSd0xd0NCbackpt);
1407 
1408 
1409  namehist="hangletracksVSd0D0NCback_pt";
1410  namehist+=i;
1411  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Back ptbin=";
1412  titlehist+=i;
1413  hangletracksVSd0D0NCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1414  hangletracksVSd0D0NCbackpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1415  hangletracksVSd0D0NCbackpt->SetYTitle(" angle between K and #p tracks [rad]");
1416  flistNoCutsBack->Add(hangletracksVSd0D0NCbackpt);
1417 
1418 
1419 
1420  }
1421  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1422  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1423 
1424 
1425 
1426  // ####### d0 D0 histos ############
1427 
1428  TH1F *hd0D0NCbackPM = new TH1F("hd0D0NCbackPM","D^{0} impact par. plot , No Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1429  hd0D0NCbackPM->SetXTitle("Impact parameter [#mum]");
1430  hd0D0NCbackPM->SetYTitle("Entries");
1431 
1432  TH1F *hd0D0VtxTrueNCbackPM = new TH1F("hd0D0VtxTrueNCbackPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1433  hd0D0VtxTrueNCbackPM->SetXTitle("Impact parameter [#mum]");
1434  hd0D0VtxTrueNCbackPM->SetYTitle("Entries");
1435 
1436  TH1F *hMCd0D0NCbackPM = new TH1F("hMCd0D0NCbackPM","D^{0} impact par. plot, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1437  hMCd0D0NCbackPM->SetXTitle("MC Impact parameter [#mum]");
1438  hMCd0D0NCbackPM->SetYTitle("Entries");
1439 
1440  TH1F *hd0D0NCbackSB = new TH1F("hd0D0NCbackSB","D^{0} impact par. plot , No Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1441  hd0D0NCbackSB->SetXTitle("Impact parameter [#mum]");
1442  hd0D0NCbackSB->SetYTitle("Entries");
1443 
1444  TH1F *hd0D0VtxTrueNCbackSB = new TH1F("hd0D0VtxTrueNCbackSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1445  hd0D0VtxTrueNCbackSB->SetXTitle("Impact parameter [#mum]");
1446  hd0D0VtxTrueNCbackSB->SetYTitle("Entries");
1447 
1448  TH1F *hMCd0D0NCbackSB = new TH1F("hMCd0D0NCbackSB","D^{0} impact par. plot, No Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
1449  hMCd0D0NCbackSB->SetXTitle("MC Impact parameter [#mum]");
1450  hMCd0D0NCbackSB->SetYTitle("Entries");
1451 
1452  flistNoCutsBack->Add(hd0D0NCbackPM);
1453  flistNoCutsBack->Add(hd0D0VtxTrueNCbackPM);
1454  flistNoCutsBack->Add(hMCd0D0NCbackPM);
1455  flistNoCutsBack->Add(hd0D0NCbackSB);
1456  flistNoCutsBack->Add(hd0D0VtxTrueNCbackSB);
1457  flistNoCutsBack->Add(hMCd0D0NCbackSB);
1458 
1459  TH1F *hd0D0ptNCbackPM;
1460  TH1F *hMCd0D0ptNCbackPM;
1461  TH1F *hd0D0VtxTrueptNCbackPM;
1462  TH1F *hd0D0ptNCbackSB;
1463  TH1F *hMCd0D0ptNCbackSB;
1464  TH1F *hd0D0VtxTrueptNCbackSB;
1465  namehist="hd0D0ptNCback_";
1466  titlehist="D^{0} impact par. plot, No Cuts, Background, ";
1467  for(Int_t i=0;i<fnbins;i++){
1468  strnamept=namehist;
1469  strnamept.Append("PkMss_pt");
1470  strnamept+=i;
1471 
1472  strtitlept=titlehist;
1473  strtitlept.Append(" Mass Peak, ");
1474  strtitlept+=fptbins[i];
1475  strtitlept.Append("<= pt <");
1476  strtitlept+=fptbins[i+1];
1477  strtitlept.Append(" [GeV/c]");
1478 
1479  hd0D0ptNCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1480  hd0D0ptNCbackPM->SetXTitle("Impact parameter [#mum] ");
1481  hd0D0ptNCbackPM->SetYTitle("Entries");
1482  flistNoCutsBack->Add(hd0D0ptNCbackPM);
1483 
1484  strnamept.ReplaceAll("hd0D0","hMCd0D0");
1485  hMCd0D0ptNCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1486  hMCd0D0ptNCbackPM->SetXTitle("MC Impact parameter [#mum] ");
1487  hMCd0D0ptNCbackPM->SetYTitle("Entries");
1488  flistNoCutsBack->Add(hMCd0D0ptNCbackPM);
1489 
1490 
1491  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1492  hd0D0VtxTrueptNCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1493  hd0D0VtxTrueptNCbackPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1494  hd0D0VtxTrueptNCbackPM->SetYTitle("Entries");
1495  flistNoCutsBack->Add(hd0D0VtxTrueptNCbackPM);
1496 
1497  strnamept=namehist;
1498  strnamept.Append("SBMss_pt");
1499  strnamept+=i;
1500 
1501  strtitlept=titlehist;
1502  strtitlept.Append(" Side Bands, ");
1503  strtitlept+=fptbins[i];
1504  strtitlept.Append("<= pt <");
1505  strtitlept+=fptbins[i+1];
1506  strtitlept.Append(" [GeV/c]");
1507 
1508  hd0D0ptNCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1509  hd0D0ptNCbackSB->SetXTitle("Impact parameter [#mum] ");
1510  hd0D0ptNCbackSB->SetYTitle("Entries");
1511  flistNoCutsBack->Add(hd0D0ptNCbackSB);
1512 
1513  strnamept.ReplaceAll("hd0D0","hMCd0D0");
1514  hMCd0D0ptNCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1515  hMCd0D0ptNCbackSB->SetXTitle("MC Impact parameter [#mum] ");
1516  hMCd0D0ptNCbackSB->SetYTitle("Entries");
1517  flistNoCutsBack->Add(hMCd0D0ptNCbackSB);
1518 
1519  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1520  hd0D0VtxTrueptNCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1521  hd0D0VtxTrueptNCbackSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1522  hd0D0VtxTrueptNCbackSB->SetYTitle("Entries");
1523  flistNoCutsBack->Add(hd0D0VtxTrueptNCbackSB);
1524  }
1525 
1526 
1527 
1528  //############ NO CUTS FROMB HISTOGRAMS ###########
1529  //
1530  //####### global properties histos
1531 
1532  TH2F *hCPtaVSd0d0NCfromB=new TH2F("hCPtaVSd0d0NCfromB","hCPtaVSd0d0_NoCuts_FromB",1000,-100000.,100000.,100,-1.,1.);
1533  TH1F *hSecVtxZNCfromB=new TH1F("hSecVtxZNCfromB","hSecVtxZ_NoCuts_FromB",1000,-8.,8.);
1534  TH1F *hSecVtxXNCfromB=new TH1F("hSecVtxXNCfromB","hSecVtxX_NoCuts_FromB",1000,-3000.,3000.);
1535  TH1F *hSecVtxYNCfromB=new TH1F("hSecVtxYNCfromB","hSecVtxY_NoCuts_FromB",1000,-3000.,3000.);
1536  TH2F *hSecVtxXYNCfromB=new TH2F("hSecVtxXYNCfromB","hSecVtxXY_NoCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
1537  TH1F *hSecVtxPhiNCfromB=new TH1F("hSecVtxPhiNCfromB","hSecVtxPhi_NoCuts_FromB",180,-180.1,180.1);
1538  TH1F *hd0singlTrackNCfromB=new TH1F("hd0singlTrackNCfromB","hd0singlTrackNoCuts_FromB",1000,-5000.,5000.);
1539  TH1F *hCPtaNCfromB=new TH1F("hCPtaNCfromB","hCPta_NoCuts_FromB",100,-1.,1.);
1540  TH1F *hd0xd0NCfromB=new TH1F("hd0xd0NCfromB","hd0xd0_NoCuts_FromB",1000,-100000.,100000.);
1541  TH1F *hMassTrueNCfromB=new TH1F("hMassTrueNCfromB","D^{0} MC inv. Mass No Cuts FromB(All momenta)",600,1.600,2.200);
1542  TH1F *hMassNCfromB=new TH1F("hMassNCfromB","D^{0} inv. Mass No Cuts FromB (All momenta)",600,1.600,2.200);
1543  hMassNCfromB->Sumw2();
1544  TH1F *hMassTrueNCfromBPM=new TH1F("hMassTrueNCfromBPM","D^{0} MC inv. Mass No Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
1545  TH1F *hMassNCfromBPM=new TH1F("hMassNCfromBPM","D^{0} inv. Mass No Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
1546  hMassNCfromB->Sumw2();
1547  TH1F *hMassTrueNCfromBSB=new TH1F("hMassTrueNCfromBSB","D^{0} MC inv. Mass in Side Bands No Cuts FromB(All momenta)",600,1.600,2.200);
1548  TH1F *hMassNCfromBSB=new TH1F("hMassNCfromBSB","D^{0} inv. Mass in Side Bands No Cuts FromB (All momenta)",600,1.600,2.200);
1549  hMassNCfromBSB->Sumw2();
1550 
1551  flistNoCutsFromB->Add(hCPtaVSd0d0NCfromB);
1552  flistNoCutsFromB->Add(hSecVtxZNCfromB);
1553  flistNoCutsFromB->Add(hSecVtxYNCfromB);
1554  flistNoCutsFromB->Add(hSecVtxXNCfromB);
1555  flistNoCutsFromB->Add(hSecVtxXYNCfromB);
1556  flistNoCutsFromB->Add(hSecVtxPhiNCfromB);
1557  flistNoCutsFromB->Add(hd0singlTrackNCfromB);
1558  flistNoCutsFromB->Add(hCPtaNCfromB);
1559  flistNoCutsFromB->Add(hd0xd0NCfromB);
1560  flistNoCutsFromB->Add(hMassTrueNCfromB);
1561  flistNoCutsFromB->Add(hMassNCfromB);
1562  flistNoCutsFromB->Add(hMassTrueNCfromBPM);
1563  flistNoCutsFromB->Add(hMassNCfromBPM);
1564  flistNoCutsFromB->Add(hMassTrueNCfromBSB);
1565  flistNoCutsFromB->Add(hMassNCfromBSB);
1566 
1567 
1568 
1569 
1570 
1571  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1572  TH1F *hdcaNCfromB=new TH1F("hdcaNCfromB","hdca_NoCuts_FromB",100,0.,1000.);
1573  hdcaNCfromB->SetXTitle("dca [#mum]");
1574  hdcaNCfromB->SetYTitle("Entries");
1575  TH1F *hcosthetastarNCfromB=new TH1F("hcosthetastarNCfromB","hCosThetaStar_NoCuts_FromB",50,-1.,1.);
1576  hcosthetastarNCfromB->SetXTitle("cos #theta^{*}");
1577  hcosthetastarNCfromB->SetYTitle("Entries");
1578  TH1F *hptD0NCfromB=new TH1F("hptD0NCfromB","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1579  hptD0NCfromB->SetXTitle("p_{t} [GeV/c]");
1580  hptD0NCfromB->SetYTitle("Entries");
1581  TH1F *hptD0VsMaxPtNCfromB=new TH1F("hptD0VsMaxPtNCfromB","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1582  TH2F *hptD0PTallsqrtNCfromB=new TH2F("hptD0PTallsqrtNCfromB","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1583  TH2F *hptD0PTallNCfromB=new TH2F("hptD0PTallNCfromB","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1584  TH2F *hptD0vsptBNCfromB=new TH2F("hptD0vsptBNCfromB","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1585  TH2F *hpD0vspBNCfromB=new TH2F("hpD0vspBNCfromB","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1586  TH2F *hptD0vsptcquarkNCfromB=new TH2F("hptD0vsptcquarkNCfromB","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1587  TH2F *hpD0vspcquarkNCfromB=new TH2F("hpD0vspcquarkNCfromB","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1588  flistNoCutsFromB->Add(hdcaNCfromB);
1589  flistNoCutsFromB->Add(hcosthetastarNCfromB);
1590  flistNoCutsFromB->Add(hptD0NCfromB);
1591  flistNoCutsFromB->Add(hptD0VsMaxPtNCfromB);
1592  flistNoCutsFromB->Add(hptD0PTallsqrtNCfromB);
1593  flistNoCutsFromB->Add(hptD0PTallNCfromB);
1594  flistNoCutsFromB->Add(hptD0vsptBNCfromB);
1595  flistNoCutsFromB->Add(hpD0vspBNCfromB);
1596  flistNoCutsFromB->Add(hptD0vsptcquarkNCfromB);
1597  flistNoCutsFromB->Add(hpD0vspcquarkNCfromB);
1598 
1599  TH1F *hd0zD0ptNCfromB;
1600  TH1F *hInvMassD0NCfromB,*hInvMassD0barNCfromB;
1601  TH2F *hInvMassPtNCfromB=new TH2F("hInvMassPtNCfromB","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1602  TH3F *hInvMassPtSelSignOnlyNCfromB=new TH3F("hInvMassPtSelSignOnlyNCfromB","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
1603  flistNoCutsFromB->Add(hInvMassPtSelSignOnlyNCfromB);
1604  TH3F *hInvMassPtSelReflOnlyNCfromB=new TH3F("hInvMassPtSelReflOnlyNCfromB","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
1605  flistNoCutsFromB->Add(hInvMassPtSelReflOnlyNCfromB);
1606 
1607  THnSparseF *hSparseNCfromB=new THnSparseF("hSparseNCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1608  hSparseNCfromB->SetBinEdges(0,massbins);
1609  hSparseNCfromB->SetBinEdges(1,massbins);
1610  hSparseNCfromB->SetBinEdges(2,ptbinsForNsparse);
1611  hSparseNCfromB->SetBinEdges(3,impparbins);
1612  hSparseNCfromB->SetBinEdges(4,massHypoBins);
1613  flistNoCutsFromB->Add(hSparseNCfromB);
1614 
1615  fTreeNCfromB = new TTree("fTreeNCfromB","Candidate variables tree");
1617  for(Int_t ivar=0; ivar<nVar; ivar++){
1618  fTreeNCfromB->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeNCfromB[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
1619  }
1621 
1622  THnSparseF *hSparseRecoNCfromB=new THnSparseF("hSparseRecoNCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1623  hSparseRecoNCfromB->SetBinEdges(0,massbins);
1624  hSparseRecoNCfromB->SetBinEdges(1,massbins);
1625  hSparseRecoNCfromB->SetBinEdges(2,ptbinsForNsparse);
1626  hSparseRecoNCfromB->SetBinEdges(3,impparbins);
1627  hSparseRecoNCfromB->SetBinEdges(4,massHypoBins);
1628  flistNoCutsFromB->Add(hSparseRecoNCfromB);
1629 
1630  fTreeRecoNCfromB = new TTree("fTreeRecoNCfromB","Candidate variables tree");
1632  for(Int_t ivar=0; ivar<nVar; ivar++){
1633  fTreeRecoNCfromB->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeRecoNCfromB[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
1634  }
1636 
1637 
1638  TH1F *hetaNCfromB;
1639  TH1F *hCosPDPBNCfromB;
1640  TH1F *hCosPcPDNCfromB;
1641 
1642  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1643  TH2F *hd0D0VSd0xd0NCfromBpt;
1644  TH2F *hangletracksVSd0xd0NCfromBpt;
1645  TH2F *hangletracksVSd0D0NCfromBpt;
1646  TH1F *hd0xd0NCfromBpt;
1647  flistNoCutsFromB->Add(hInvMassPtNCfromB);
1648 
1649  TH2F *hTOFpidNCfromB=new TH2F("hTOFpidNCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1650  flistNoCutsFromB->Add(hTOFpidNCfromB);
1651 
1652  for(Int_t i=0;i<fnbins;i++){
1653  namehist="hd0zD0ptNCfromB_pt";
1654  namehist+=i;
1655  titlehist="d0(z) No Cuts FromB ptbin=";
1656  titlehist+=i;
1657  hd0zD0ptNCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1658  hd0zD0ptNCfromB->SetXTitle("d_{0}(z) [#mum]");
1659  hd0zD0ptNCfromB->SetYTitle("Entries");
1660  flistNoCutsFromB->Add(hd0zD0ptNCfromB);
1661 
1662  namehist="hInvMassD0NCfromB_pt";
1663  namehist+=i;
1664  titlehist="Invariant Mass No Cuts FromB ptbin=";
1665  titlehist+=i;
1666  hInvMassD0NCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1667  hInvMassD0NCfromB->SetXTitle("Invariant Mass [GeV]");
1668  hInvMassD0NCfromB->SetYTitle("Entries");
1669  flistNoCutsFromB->Add(hInvMassD0NCfromB);
1670 
1671 
1672  namehist="hInvMassD0barNCfromB_pt";
1673  namehist+=i;
1674  titlehist="Invariant Mass D0bar No Cuts FromB ptbin=";
1675  titlehist+=i;
1676  hInvMassD0barNCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1677  hInvMassD0barNCfromB->SetXTitle("Invariant Mass [GeV]");
1678  hInvMassD0barNCfromB->SetYTitle("Entries");
1679  flistNoCutsFromB->Add(hInvMassD0barNCfromB);
1680 
1681 
1682 
1683  namehist="hetaNCfromB_pt";
1684  namehist+=i;
1685  titlehist="eta No Cuts FromB ptbin=";
1686  titlehist+=i;
1687  hetaNCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
1688  hetaNCfromB->SetXTitle("Pseudorapidity");
1689  hetaNCfromB->SetYTitle("Entries");
1690  flistNoCutsFromB->Add(hetaNCfromB);
1691 
1692  namehist="hCosPDPBNCfromB_pt";
1693  namehist+=i;
1694  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
1695  titlehist+=i;
1696  hCosPDPBNCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1697  hCosPDPBNCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
1698  hCosPDPBNCfromB->SetYTitle("Entries");
1699  flistNoCutsFromB->Add(hCosPDPBNCfromB);
1700 
1701  namehist="hCosPcPDNCfromB_pt";
1702  namehist+=i;
1703  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
1704  titlehist+=i;
1705  hCosPcPDNCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
1706  hCosPcPDNCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
1707  hCosPcPDNCfromB->SetYTitle("Entries");
1708  flistNoCutsFromB->Add(hCosPcPDNCfromB);
1709 
1710 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1711  namehist="hd0xd0NCfromB_pt";
1712  namehist+=i;
1713  titlehist="d0xd0 No Cuts FromB ptbin=";
1714  titlehist+=i;
1715  hd0xd0NCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
1716  hd0xd0NCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
1717  hd0xd0NCfromBpt->SetYTitle("Entries");
1718  flistNoCutsFromB->Add(hd0xd0NCfromBpt);
1719 
1720 
1721  namehist="hd0D0VSd0xd0NCfromB_pt";
1722  namehist+=i;
1723  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromB ptbin=";
1724  titlehist+=i;
1725  hd0D0VSd0xd0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
1726  hd0D0VSd0xd0NCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1727  hd0D0VSd0xd0NCfromBpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
1728  flistNoCutsFromB->Add(hd0D0VSd0xd0NCfromBpt);
1729 
1730 
1731  namehist="hangletracksVSd0xd0NCfromB_pt";
1732  namehist+=i;
1733  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromB ptbin=";
1734  titlehist+=i;
1735  hangletracksVSd0xd0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
1736  hangletracksVSd0xd0NCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
1737  hangletracksVSd0xd0NCfromBpt->SetYTitle(" angle between K and #p tracks [rad]");
1738  flistNoCutsFromB->Add(hangletracksVSd0xd0NCfromBpt);
1739 
1740 
1741  namehist="hangletracksVSd0D0NCfromB_pt";
1742  namehist+=i;
1743  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts FromB ptbin=";
1744  titlehist+=i;
1745  hangletracksVSd0D0NCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
1746  hangletracksVSd0D0NCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
1747  hangletracksVSd0D0NCfromBpt->SetYTitle(" angle between K and #p tracks [rad]");
1748  flistNoCutsFromB->Add(hangletracksVSd0D0NCfromBpt);
1749 
1750 
1751  }
1752  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
1753  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1754 
1755 
1756 
1757  // ######### d0 D0 histos ##############
1758  TH1F *hd0D0NCfromBPM = new TH1F("hd0D0NCfromBPM","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1759  hd0D0NCfromBPM->SetXTitle("Impact parameter [#mum]");
1760  hd0D0NCfromBPM->SetYTitle("Entries");
1761 
1762  TH1F *hd0D0VtxTrueNCfromBPM = new TH1F("hd0D0VtxTrueNCfromBPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1763  hd0D0VtxTrueNCfromBPM->SetXTitle("Impact parameter [#mum]");
1764  hd0D0VtxTrueNCfromBPM->SetYTitle("Entries");
1765 
1766  TH1F *hMCd0D0NCfromBPM = new TH1F("hMCd0D0NCfromBPM","D^{0} impact par. plot, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1767  hMCd0D0NCfromBPM->SetXTitle("MC Impact parameter [#mum]");
1768  hMCd0D0NCfromBPM->SetYTitle("Entries");
1769 
1770  TH1F *hd0D0NCfromBSB = new TH1F("hd0D0NCfromBSB","D^{0} impact par. plot , No Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1771  hd0D0NCfromBSB->SetXTitle("Impact parameter [#mum]");
1772  hd0D0NCfromBSB->SetYTitle("Entries");
1773 
1774  TH1F *hd0D0VtxTrueNCfromBSB = new TH1F("hd0D0VtxTrueNCfromBSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1775  hd0D0VtxTrueNCfromBSB->SetXTitle("Impact parameter [#mum]");
1776  hd0D0VtxTrueNCfromBSB->SetYTitle("Entries");
1777 
1778  TH1F *hMCd0D0NCfromBSB = new TH1F("hMCd0D0NCfromBSB","D^{0} impact par. plot, No Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
1779  hMCd0D0NCfromBSB->SetXTitle("MC Impact parameter [#mum]");
1780  hMCd0D0NCfromBSB->SetYTitle("Entries");
1781 
1782  flistNoCutsFromB->Add(hd0D0NCfromBPM);
1783  flistNoCutsFromB->Add(hd0D0VtxTrueNCfromBPM);
1784  flistNoCutsFromB->Add(hMCd0D0NCfromBPM);
1785  flistNoCutsFromB->Add(hd0D0NCfromBSB);
1786  flistNoCutsFromB->Add(hd0D0VtxTrueNCfromBSB);
1787  flistNoCutsFromB->Add(hMCd0D0NCfromBSB);
1788 
1789  TH1F *hd0D0ptNCfromBPM;
1790  TH1F *hMCd0D0ptNCfromBPM;
1791  TH1F *hd0D0VtxTrueptNCfromBPM;
1792  TH1F *hd0D0ptNCfromBSB;
1793  TH1F *hMCd0D0ptNCfromBSB;
1794  TH1F *hd0D0VtxTrueptNCfromBSB;
1795  namehist="hd0D0ptNCfromB_";
1796  titlehist="D^{0} impact par. plot, No Cuts, FromB, ";
1797  for(Int_t i=0;i<fnbins;i++){
1798  strnamept=namehist;
1799  strnamept.Append("PkMss_pt");
1800  strnamept+=i;
1801 
1802  strtitlept=titlehist;
1803  strtitlept.Append(" Mass Peak, ");
1804  strtitlept+=fptbins[i];
1805  strtitlept.Append("<= pt <");
1806  strtitlept+=fptbins[i+1];
1807  strtitlept.Append(" [GeV/c]");
1808 
1809  hd0D0ptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1810  hd0D0ptNCfromBPM->SetXTitle("Impact parameter [#mum] ");
1811  hd0D0ptNCfromBPM->SetYTitle("Entries");
1812  flistNoCutsFromB->Add(hd0D0ptNCfromBPM);
1813 
1814  strnamept.ReplaceAll("hd0D0","hMCd0D0");
1815  hMCd0D0ptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1816  hMCd0D0ptNCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
1817  hMCd0D0ptNCfromBPM->SetYTitle("Entries");
1818  flistNoCutsFromB->Add(hMCd0D0ptNCfromBPM);
1819 
1820 
1821  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1822  hd0D0VtxTrueptNCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1823  hd0D0VtxTrueptNCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1824  hd0D0VtxTrueptNCfromBPM->SetYTitle("Entries");
1825  flistNoCutsFromB->Add(hd0D0VtxTrueptNCfromBPM);
1826 
1827  strnamept=namehist;
1828  strnamept.Append("SBMss_pt");
1829  strnamept+=i;
1830 
1831  strtitlept=titlehist;
1832  strtitlept.Append(" Side Bands, ");
1833  strtitlept+=fptbins[i];
1834  strtitlept.Append("<= pt <");
1835  strtitlept+=fptbins[i+1];
1836  strtitlept.Append(" [GeV/c]");
1837 
1838  hd0D0ptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1839  hd0D0ptNCfromBSB->SetXTitle("Impact parameter [#mum] ");
1840  hd0D0ptNCfromBSB->SetYTitle("Entries");
1841  flistNoCutsFromB->Add(hd0D0ptNCfromBSB);
1842 
1843  strnamept.ReplaceAll("hd0D0","hMCd0D0");
1844  hMCd0D0ptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1845  hMCd0D0ptNCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
1846  hMCd0D0ptNCfromBSB->SetYTitle("Entries");
1847  flistNoCutsFromB->Add(hMCd0D0ptNCfromBSB);
1848 
1849  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
1850  hd0D0VtxTrueptNCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
1851  hd0D0VtxTrueptNCfromBSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
1852  hd0D0VtxTrueptNCfromBSB->SetYTitle("Entries");
1853  flistNoCutsFromB->Add(hd0D0VtxTrueptNCfromBSB);
1854  }
1855 
1856 
1857 
1858  //############ NO CUTS FROM DSTAR HISTOGRAMS ###########
1859  //
1860  //############# global properties histos #######
1861 
1862  TH2F *hCPtaVSd0d0NCfromDstar=new TH2F("hCPtaVSd0d0NCfromDstar","hCPtaVSd0d0_NoCuts_FromDStar",1000,-100000.,100000.,100,-1.,1.);
1863  TH1F *hSecVtxZNCfromDstar=new TH1F("hSecVtxZNCfromDstar","hSecVtxZ_NoCuts_FromDStar",1000,-8.,8.);
1864  TH1F *hSecVtxXNCfromDstar=new TH1F("hSecVtxXNCfromDstar","hSecVtxX_NoCuts_FromDStar",1000,-3000.,3000.);
1865  TH1F *hSecVtxYNCfromDstar=new TH1F("hSecVtxYNCfromDstar","hSecVtxY_NoCuts_FromDStar",1000,-3000.,3000.);
1866  TH2F *hSecVtxXYNCfromDstar=new TH2F("hSecVtxXYNCfromDstar","hSecVtxXY_NoCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
1867  TH1F *hSecVtxPhiNCfromDstar=new TH1F("hSecVtxPhiNCfromDstar","hSecVtxPhi_NoCuts_FromDStar",180,-180.1,180.1);
1868  TH1F *hd0singlTrackNCfromDstar=new TH1F("hd0singlTrackNCfromDstar","hd0singlTrackNoCuts_fromDstar",1000,-5000.,5000.);
1869  TH1F *hCPtaNCfromDstar=new TH1F("hCPtaNCfromDstar","hCPta_NoCuts_FromDStar",100,-1.,1.);
1870  TH1F *hd0xd0NCfromDstar=new TH1F("hd0xd0NCfromDstar","hd0xd0_NoCuts_FromDStar",1000,-100000.,100000.);
1871  TH1F *hMassTrueNCfromDstar=new TH1F("hMassTrueNCfromDstar","D^{0} MC inv. Mass No Cuts FromDStar(All momenta)",600,1.600,2.200);
1872  TH1F *hMassNCfromDstar=new TH1F("hMassNCfromDstar","D^{0} inv. Mass No Cuts FromDStar (All momenta)",600,1.600,2.200);
1873  hMassNCfromDstar->Sumw2();
1874  TH1F *hMassTrueNCfromDstarPM=new TH1F("hMassTrueNCfromDstarPM","D^{0} MC inv. Mass No Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
1875  TH1F *hMassNCfromDstarPM=new TH1F("hMassNCfromDstarPM","D^{0} inv. Mass No Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
1876  hMassNCfromDstarPM->Sumw2();
1877  TH1F *hMassTrueNCfromDstarSB=new TH1F("hMassTrueNCfromDstarSB","D^{0} MC inv. Mass in Side Bands No Cuts FromDStar(All momenta)",600,1.600,2.200);
1878  TH1F *hMassNCfromDstarSB=new TH1F("hMassNCfromDstarSB","D^{0} inv. Mass in Side Bands No Cuts FromDStar (All momenta)",600,1.600,2.200);
1879  hMassNCfromDstarSB->Sumw2();
1880 
1881  flistNoCutsFromDstar->Add(hCPtaVSd0d0NCfromDstar);
1882  flistNoCutsFromDstar->Add(hSecVtxZNCfromDstar);
1883  flistNoCutsFromDstar->Add(hSecVtxYNCfromDstar);
1884  flistNoCutsFromDstar->Add(hSecVtxXNCfromDstar);
1885  flistNoCutsFromDstar->Add(hSecVtxXYNCfromDstar);
1886  flistNoCutsFromDstar->Add(hSecVtxPhiNCfromDstar);
1887  flistNoCutsFromDstar->Add(hd0singlTrackNCfromDstar);
1888  flistNoCutsFromDstar->Add(hCPtaNCfromDstar);
1889  flistNoCutsFromDstar->Add(hd0xd0NCfromDstar);
1890  flistNoCutsFromDstar->Add(hMassTrueNCfromDstar);
1891  flistNoCutsFromDstar->Add(hMassNCfromDstar);
1892  flistNoCutsFromDstar->Add(hMassTrueNCfromDstarPM);
1893  flistNoCutsFromDstar->Add(hMassNCfromDstarPM);
1894  flistNoCutsFromDstar->Add(hMassTrueNCfromDstarSB);
1895  flistNoCutsFromDstar->Add(hMassNCfromDstarSB);
1896 
1897 
1898 
1899 
1900 //%%% NEW HISTOS %%%%%%%%%%%%%%%%
1901  TH1F *hdcaNCfromDstar=new TH1F("hdcaNCfromDstar","hdca_NoCuts_FromDstar",100,0.,1000.);
1902  hdcaNCfromDstar->SetXTitle("dca [#mum]");
1903  hdcaNCfromDstar->SetYTitle("Entries");
1904  TH1F *hcosthetastarNCfromDstar=new TH1F("hcosthetastarNCfromDstar","hCosThetaStar_NoCuts_FromDstar",50,-1.,1.);
1905  hcosthetastarNCfromDstar->SetXTitle("cos #theta^{*}");
1906  hcosthetastarNCfromDstar->SetYTitle("Entries");
1907  TH1F *hptD0NCfromDstar=new TH1F("hptD0NCfromDstar","D^{0} transverse momentum distribution",34,ptbinsD0arr);
1908  hptD0NCfromDstar->SetXTitle("p_{t} [GeV/c]");
1909  hptD0NCfromDstar->SetYTitle("Entries");
1910  TH1F *hptD0VsMaxPtNCfromDstar=new TH1F("hptD0VsMaxPtNCfromDstar","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
1911  TH2F *hptD0PTallsqrtNCfromDstar=new TH2F("hptD0PTallsqrtNCfromDstar","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
1912  TH2F *hptD0PTallNCfromDstar=new TH2F("hptD0PTallNCfromDstar","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
1913  TH2F *hptD0vsptBNCfromDstar=new TH2F("hptD0vsptBNCfromDstar","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1914  TH2F *hpD0vspBNCfromDstar=new TH2F("hpD0vspBNCfromDstar","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1915  TH2F *hptD0vsptcquarkNCfromDstar=new TH2F("hptD0vsptcquarkNCfromDstar","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1916  TH2F *hpD0vspcquarkNCfromDstar=new TH2F("hpD0vspcquarkNCfromDstar","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
1917  flistNoCutsFromDstar->Add(hdcaNCfromDstar);
1918  flistNoCutsFromDstar->Add(hcosthetastarNCfromDstar);
1919  flistNoCutsFromDstar->Add(hptD0NCfromDstar);
1920  flistNoCutsFromDstar->Add(hptD0VsMaxPtNCfromDstar);
1921  flistNoCutsFromDstar->Add(hptD0PTallsqrtNCfromDstar);
1922  flistNoCutsFromDstar->Add(hptD0PTallNCfromDstar);
1923  flistNoCutsFromDstar->Add(hptD0vsptBNCfromDstar);
1924  flistNoCutsFromDstar->Add(hpD0vspBNCfromDstar);
1925  flistNoCutsFromDstar->Add(hptD0vsptcquarkNCfromDstar);
1926  flistNoCutsFromDstar->Add(hpD0vspcquarkNCfromDstar);
1927 
1928  TH1F *hd0zD0ptNCfromDstar;
1929  TH1F *hInvMassD0NCfromDstar,*hInvMassD0barNCfromDstar;
1930  TH2F *hInvMassPtNCfromDstar=new TH2F("hInvMassPtNCfromDstar","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
1931  TH3F *hInvMassPtSelSignOnlyNCfromDstar=new TH3F("hInvMassPtSelSignOnlyNCfromDstar","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
1932  flistNoCutsFromDstar->Add(hInvMassPtSelSignOnlyNCfromDstar);
1933  TH3F *hInvMassPtSelReflOnlyNCfromDstar=new TH3F("hInvMassPtSelReflOnlyNCfromDstar","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
1934  flistNoCutsFromDstar->Add(hInvMassPtSelReflOnlyNCfromDstar);
1935 
1936  THnSparseF *hSparseNCfromDstar=new THnSparseF("hSparseNCfromDstar","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
1937  hSparseNCfromDstar->SetBinEdges(0,massbins);
1938  hSparseNCfromDstar->SetBinEdges(1,massbins);
1939  hSparseNCfromDstar->SetBinEdges(2,ptbinsForNsparse);
1940  hSparseNCfromDstar->SetBinEdges(3,impparbins);
1941  hSparseNCfromDstar->SetBinEdges(4,massHypoBins);
1942  flistNoCutsFromDstar->Add(hSparseNCfromDstar);
1943 
1944  fTreeNCfromDstar = new TTree("fTreeNCfromDstar","Candidate variables tree");
1946  for(Int_t ivar=0; ivar<nVar; ivar++){
1947  fTreeNCfromDstar->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeNCfromDstar[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
1948  }
1950 
1951 
1952  TH1F *hetaNCfromDstar;
1953  TH1F *hCosPDPBNCfromDstar;
1954  TH1F *hCosPcPDNCfromDstar;
1955  flistNoCutsFromDstar->Add(hInvMassPtNCfromDstar);
1956  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
1957  TH2F *hd0D0VSd0xd0NCfromDstarpt;
1958  TH2F *hangletracksVSd0xd0NCfromDstarpt;
1959  TH2F *hangletracksVSd0D0NCfromDstarpt;
1960  TH1F *hd0xd0NCfromDstarpt;
1961 
1962  TH2F *hTOFpidNCfromDstar=new TH2F("hTOFpidNCfromDstar","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
1963  flistNoCutsFromDstar->Add(hTOFpidNCfromDstar);
1964 
1965  for(Int_t i=0;i<fnbins;i++){
1966  namehist="hd0zD0ptNCfromDstar_pt";
1967  namehist+=i;
1968  titlehist="d0(z) No Cuts FromDstarm ptbin=";
1969  titlehist+=i;
1970  hd0zD0ptNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
1971  hd0zD0ptNCfromDstar->SetXTitle("d_{0}(z) [#mum]");
1972  hd0zD0ptNCfromDstar->SetYTitle("Entries");
1973  flistNoCutsFromDstar->Add(hd0zD0ptNCfromDstar);
1974 
1975  namehist="hInvMassD0NCfromDstar_pt";
1976  namehist+=i;
1977  titlehist="Invariant Mass No Cuts FromDstar ptbin=";
1978  titlehist+=i;
1979  hInvMassD0NCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1980  hInvMassD0NCfromDstar->SetXTitle("Invariant Mass [GeV]");
1981  hInvMassD0NCfromDstar->SetYTitle("Entries");
1982  flistNoCutsFromDstar->Add(hInvMassD0NCfromDstar);
1983 
1984 
1985  namehist="hInvMassD0barNCfromDstar_pt";
1986  namehist+=i;
1987  titlehist="Invariant Mass D0bar No Cuts FromDstar ptbin=";
1988  titlehist+=i;
1989  hInvMassD0barNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
1990  hInvMassD0barNCfromDstar->SetXTitle("Invariant Mass [GeV]");
1991  hInvMassD0barNCfromDstar->SetYTitle("Entries");
1992  flistNoCutsFromDstar->Add(hInvMassD0barNCfromDstar);
1993 
1994 
1995 
1996  namehist="hetaNCfromDstar_pt";
1997  namehist+=i;
1998  titlehist="eta No Cuts FromDstar ptbin=";
1999  titlehist+=i;
2000  hetaNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2001  hetaNCfromDstar->SetXTitle("Pseudorapidity");
2002  hetaNCfromDstar->SetYTitle("Entries");
2003  flistNoCutsFromDstar->Add(hetaNCfromDstar);
2004 
2005  namehist="hCosPDPBNCfromDstar_pt";
2006  namehist+=i;
2007  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2008  titlehist+=i;
2009  hCosPDPBNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2010  hCosPDPBNCfromDstar->SetXTitle("Cosine between D0 momentum and B momentum");
2011  hCosPDPBNCfromDstar->SetYTitle("Entries");
2012  flistNoCutsFromDstar->Add(hCosPDPBNCfromDstar);
2013 
2014  namehist="hCosPcPDNCfromDstar_pt";
2015  namehist+=i;
2016  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2017  titlehist+=i;
2018  hCosPcPDNCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2019  hCosPcPDNCfromDstar->SetXTitle("Cosine between c quark momentum and D0 momentum");
2020  hCosPcPDNCfromDstar->SetYTitle("Entries");
2021  flistNoCutsFromDstar->Add(hCosPcPDNCfromDstar);
2022 
2023  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2024  namehist="hd0xd0NCfromDstar_pt";
2025  namehist+=i;
2026  titlehist="d0xd0 No Cuts FromDstar ptbin=";
2027  titlehist+=i;
2028  hd0xd0NCfromDstarpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2029  hd0xd0NCfromDstarpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
2030  hd0xd0NCfromDstarpt->SetYTitle("Entries");
2031  flistNoCutsFromDstar->Add(hd0xd0NCfromDstarpt);
2032 
2033 
2034  namehist="hd0D0VSd0xd0NCfromDstar_pt";
2035  namehist+=i;
2036  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromDstar ptbin=";
2037  titlehist+=i;
2038  hd0D0VSd0xd0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2039  hd0D0VSd0xd0NCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2040  hd0D0VSd0xd0NCfromDstarpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
2041  flistNoCutsFromDstar->Add(hd0D0VSd0xd0NCfromDstarpt);
2042 
2043 
2044  namehist="hangletracksVSd0xd0NCfromDstar_pt";
2045  namehist+=i;
2046  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts FromDstar ptbin=";
2047  titlehist+=i;
2048  hangletracksVSd0xd0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2049  hangletracksVSd0xd0NCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2050  hangletracksVSd0xd0NCfromDstarpt->SetYTitle(" angle between K and #p tracks [rad]");
2051  flistNoCutsFromDstar->Add(hangletracksVSd0xd0NCfromDstarpt);
2052 
2053 
2054  namehist="hangletracksVSd0D0NCfromDstar_pt";
2055  namehist+=i;
2056  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts FromDstar ptbin=";
2057  titlehist+=i;
2058  hangletracksVSd0D0NCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2059  hangletracksVSd0D0NCfromDstarpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2060  hangletracksVSd0D0NCfromDstarpt->SetYTitle(" angle between K and #p tracks [rad]");
2061  flistNoCutsFromDstar->Add(hangletracksVSd0D0NCfromDstarpt);
2062 
2063  }
2064  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2065  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2066 
2067 
2068  //########## d0 D0 histos #############
2069  TH1F *hd0D0NCfromDstPM = new TH1F("hd0D0NCfromDstarPM","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2070  hd0D0NCfromDstPM->SetXTitle("Impact parameter [#mum]");
2071  hd0D0NCfromDstPM->SetYTitle("Entries");
2072 
2073  TH1F *hd0D0VtxTrueNCfromDstPM = new TH1F("hd0D0VtxTrueNCfromDstarPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2074  hd0D0VtxTrueNCfromDstPM->SetXTitle("Impact parameter [#mum]");
2075  hd0D0VtxTrueNCfromDstPM->SetYTitle("Entries");
2076 
2077  TH1F *hMCd0D0NCfromDstPM = new TH1F("hMCd0D0NCfromDstarPM","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2078  hMCd0D0NCfromDstPM->SetXTitle("MC Impact parameter [#mum]");
2079  hMCd0D0NCfromDstPM->SetYTitle("Entries");
2080 
2081  TH1F *hd0D0NCfromDstSB = new TH1F("hd0D0NCfromDstarSB","D^{0} impact par. plot , No Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2082  hd0D0NCfromDstSB->SetXTitle("Impact parameter [#mum]");
2083  hd0D0NCfromDstSB->SetYTitle("Entries");
2084 
2085  TH1F *hd0D0VtxTrueNCfromDstSB = new TH1F("hd0D0VtxTrueNCfromDstarSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2086  hd0D0VtxTrueNCfromDstSB->SetXTitle("Impact parameter [#mum]");
2087  hd0D0VtxTrueNCfromDstSB->SetYTitle("Entries");
2088 
2089  TH1F *hMCd0D0NCfromDstSB = new TH1F("hMCd0D0NCfromDstarSB","D^{0} impact par. plot, No Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
2090  hMCd0D0NCfromDstSB->SetXTitle("MC Impact parameter [#mum]");
2091  hMCd0D0NCfromDstSB->SetYTitle("Entries");
2092 
2093  flistNoCutsFromDstar->Add(hd0D0NCfromDstPM);
2094  flistNoCutsFromDstar->Add(hd0D0VtxTrueNCfromDstPM);
2095  flistNoCutsFromDstar->Add(hMCd0D0NCfromDstPM);
2096  flistNoCutsFromDstar->Add(hd0D0NCfromDstSB);
2097  flistNoCutsFromDstar->Add(hd0D0VtxTrueNCfromDstSB);
2098  flistNoCutsFromDstar->Add(hMCd0D0NCfromDstSB);
2099 
2100  TH1F *hd0D0ptNCfromDstPM;
2101  TH1F *hMCd0D0ptNCfromDstPM;
2102  TH1F *hd0D0VtxTrueptNCfromDstPM;
2103  TH1F *hd0D0ptNCfromDstSB;
2104  TH1F *hMCd0D0ptNCfromDstSB;
2105  TH1F *hd0D0VtxTrueptNCfromDstSB;
2106  namehist="hd0D0ptNCfromDstar_";
2107  titlehist="D^{0} impact par. plot, No Cuts, FromDStar, ";
2108  for(Int_t i=0;i<fnbins;i++){
2109  strnamept=namehist;
2110  strnamept.Append("PkMss_pt");
2111  strnamept+=i;
2112 
2113  strtitlept=titlehist;
2114  strtitlept.Append(" Mass Peak, ");
2115  strtitlept+=fptbins[i];
2116  strtitlept.Append("<= pt <");
2117  strtitlept+=fptbins[i+1];
2118  strtitlept.Append(" [GeV/c]");
2119 
2120  hd0D0ptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2121  hd0D0ptNCfromDstPM->SetXTitle("Impact parameter [#mum] ");
2122  hd0D0ptNCfromDstPM->SetYTitle("Entries");
2123  flistNoCutsFromDstar->Add(hd0D0ptNCfromDstPM);
2124 
2125  strnamept.ReplaceAll("hd0D0","hMCd0D0");
2126  hMCd0D0ptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2127  hMCd0D0ptNCfromDstPM->SetXTitle("MC Impact parameter [#mum] ");
2128  hMCd0D0ptNCfromDstPM->SetYTitle("Entries");
2129  flistNoCutsFromDstar->Add(hMCd0D0ptNCfromDstPM);
2130 
2131 
2132  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2133  hd0D0VtxTrueptNCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2134  hd0D0VtxTrueptNCfromDstPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2135  hd0D0VtxTrueptNCfromDstPM->SetYTitle("Entries");
2136  flistNoCutsFromDstar->Add(hd0D0VtxTrueptNCfromDstPM);
2137 
2138  strnamept=namehist;
2139  strnamept.Append("SBMss_pt");
2140  strnamept+=i;
2141 
2142  strtitlept=titlehist;
2143  strtitlept.Append(" Side Bands, ");
2144  strtitlept+=fptbins[i];
2145  strtitlept.Append("<= pt <");
2146  strtitlept+=fptbins[i+1];
2147  strtitlept.Append(" [GeV/c]");
2148 
2149  hd0D0ptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2150  hd0D0ptNCfromDstSB->SetXTitle("Impact parameter [#mum] ");
2151  hd0D0ptNCfromDstSB->SetYTitle("Entries");
2152  flistNoCutsFromDstar->Add(hd0D0ptNCfromDstSB);
2153 
2154  strnamept.ReplaceAll("hd0D0","hMCd0D0");
2155  hMCd0D0ptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2156  hMCd0D0ptNCfromDstSB->SetXTitle("MC Impact parameter [#mum] ");
2157  hMCd0D0ptNCfromDstSB->SetYTitle("Entries");
2158  flistNoCutsFromDstar->Add(hMCd0D0ptNCfromDstSB);
2159 
2160  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2161  hd0D0VtxTrueptNCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2162  hd0D0VtxTrueptNCfromDstSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2163  hd0D0VtxTrueptNCfromDstSB->SetYTitle("Entries");
2164  flistNoCutsFromDstar->Add(hd0D0VtxTrueptNCfromDstSB);
2165  }
2166 
2167 
2168  //############ NO CUTS OTHER HISTOGRAMS ###########
2169  //
2170  //########### global properties histos ###########
2171 
2172  TH2F *hCPtaVSd0d0NCother=new TH2F("hCPtaVSd0d0NCother","hCPtaVSd0d0_NoCuts_other",1000,-100000.,100000.,100,-1.,1.);
2173  TH1F *hSecVtxZNCother=new TH1F("hSecVtxZNCother","hSecVtxZ_NoCuts_other",1000,-8.,8.);
2174  TH1F *hSecVtxXNCother=new TH1F("hSecVtxXNCother","hSecVtxX_NoCuts_other",1000,-3000.,3000.);
2175  TH1F *hSecVtxYNCother=new TH1F("hSecVtxYNCother","hSecVtxY_NoCuts_other",1000,-3000.,3000.);
2176  TH2F *hSecVtxXYNCother=new TH2F("hSecVtxXYNCother","hSecVtxXY_NoCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
2177  TH1F *hSecVtxPhiNCother=new TH1F("hSecVtxPhiNCother","hSecVtxPhi_NoCuts_other",180,-180.1,180.1);
2178  TH1F *hd0singlTrackNCother=new TH1F("hd0singlTrackNCother","hd0singlTrackNoCuts_Other",1000,-5000.,5000.);
2179  TH1F *hCPtaNCother=new TH1F("hCPtaNCother","hCPta_NoCuts_other",100,-1.,1.);
2180  TH1F *hd0xd0NCother=new TH1F("hd0xd0NCother","hd0xd0_NoCuts_other",1000,-100000.,100000.);
2181  TH1F *hMassTrueNCother=new TH1F("hMassTrueNCother","D^{0} MC inv. Mass No Cuts other(All momenta)",600,1.600,2.200);
2182  TH1F *hMassNCother=new TH1F("hMassNCother","D^{0} inv. Mass No Cuts other (All momenta)",600,1.600,2.200);
2183  hMassNCother->Sumw2();
2184  TH1F *hMassTrueNCotherPM=new TH1F("hMassTrueNCotherPM","D^{0} MC inv. Mass No Cuts Other, Mass Peak. (All momenta)",600,1.600,2.200);
2185  TH1F *hMassNCotherPM=new TH1F("hMassNCotherPM","D^{0} inv. Mass No Cuts Other (All momenta), MassPeak",600,1.600,2.200);
2186  hMassNCotherPM->Sumw2();
2187  TH1F *hMassTrueNCotherSB=new TH1F("hMassTrueNCotherSB","D^{0} MC inv. Mass in Side Bands No Cuts other(All momenta)",600,1.600,2.200);
2188  TH1F *hMassNCotherSB=new TH1F("hMassNCotherSB","D^{0} inv. Mass in Side Bands No Cuts other (All momenta)",600,1.600,2.200);
2189  hMassNCotherSB->Sumw2();
2190 
2191  flistNoCutsOther->Add(hCPtaVSd0d0NCother);
2192  flistNoCutsOther->Add(hSecVtxZNCother);
2193  flistNoCutsOther->Add(hSecVtxYNCother);
2194  flistNoCutsOther->Add(hSecVtxXNCother);
2195  flistNoCutsOther->Add(hSecVtxXYNCother);
2196  flistNoCutsOther->Add(hSecVtxPhiNCother);
2197  flistNoCutsOther->Add(hd0singlTrackNCother);
2198  flistNoCutsOther->Add(hCPtaNCother);
2199  flistNoCutsOther->Add(hd0xd0NCother);
2200  flistNoCutsOther->Add(hMassTrueNCother);
2201  flistNoCutsOther->Add(hMassNCother);
2202  flistNoCutsOther->Add(hMassTrueNCotherPM);
2203  flistNoCutsOther->Add(hMassNCotherPM);
2204  flistNoCutsOther->Add(hMassTrueNCotherSB);
2205  flistNoCutsOther->Add(hMassNCotherSB);
2206 
2207 
2208 
2209  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2210  TH1F *hdcaNCother=new TH1F("hdcaNCother","hdca_NoCuts_Other",100,0.,1000.);
2211  hdcaNCother->SetXTitle("dca [#mum]");
2212  hdcaNCother->SetYTitle("Entries");
2213  TH1F *hcosthetastarNCother=new TH1F("hcosthetastarNCother","hCosThetaStar_NoCuts_Other",50,-1.,1.);
2214  hcosthetastarNCother->SetXTitle("cos #theta^{*}");
2215  hcosthetastarNCother->SetYTitle("Entries");
2216  TH1F *hptD0NCother=new TH1F("hptD0NCother","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2217  hptD0NCother->SetXTitle("p_{t} [GeV/c]");
2218  hptD0NCother->SetYTitle("Entries");
2219  TH1F *hptD0VsMaxPtNCother=new TH1F("hptD0VsMaxPtNCother","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2220  TH2F *hptD0PTallsqrtNCother=new TH2F("hptD0PTallsqrtNCother","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2221  TH2F *hptD0PTallNCother=new TH2F("hptD0PTallNCother","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2222  TH2F *hptD0vsptBNCother=new TH2F("hptD0vsptBNCother","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2223  TH2F *hpD0vspBNCother=new TH2F("hpD0vspBNCother","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2224  TH2F *hptD0vsptcquarkNCother=new TH2F("hptD0vsptcquarkNCother","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2225  TH2F *hpD0vspcquarkNCother=new TH2F("hpD0vspcquarkNCother","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2226  flistNoCutsOther->Add(hdcaNCother);
2227  flistNoCutsOther->Add(hcosthetastarNCother);
2228  flistNoCutsOther->Add(hptD0NCother);
2229  flistNoCutsOther->Add(hptD0VsMaxPtNCother);
2230  flistNoCutsOther->Add(hptD0PTallsqrtNCother);
2231  flistNoCutsOther->Add(hptD0PTallNCother);
2232  flistNoCutsOther->Add(hptD0vsptBNCother);
2233  flistNoCutsOther->Add(hpD0vspBNCother);
2234  flistNoCutsOther->Add(hptD0vsptcquarkNCother);
2235  flistNoCutsOther->Add(hpD0vspcquarkNCother);
2236 
2237  TH1F *hd0zD0ptNCother;
2238  TH1F *hInvMassD0NCother,*hInvMassD0barNCother;
2239  TH2F *hInvMassPtNCother=new TH2F("hInvMassPtNCother","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2240  THnSparseF *hSparseNCother=new THnSparseF("hSparseNCother","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2241  hSparseNCother->SetBinEdges(0,massbins);
2242  hSparseNCother->SetBinEdges(1,massbins);
2243  hSparseNCother->SetBinEdges(2,ptbinsForNsparse);
2244  hSparseNCother->SetBinEdges(3,impparbins);
2245  hSparseNCother->SetBinEdges(4,massHypoBins);
2246  flistNoCutsOther->Add(hSparseNCother);
2247 
2248  fTreeNCother = new TTree("fTreeNCother","Candidate variables tree");
2250  for(Int_t ivar=0; ivar<nVar; ivar++){
2251  fTreeNCother->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeNCother[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
2252  }
2254 
2255 
2256 
2257  TH1F *hetaNCother;
2258  TH1F *hCosPDPBNCother;
2259  TH1F *hCosPcPDNCother;
2260  flistNoCutsOther->Add(hInvMassPtNCother);
2261  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2262  TH2F *hd0D0VSd0xd0NCotherpt;
2263  TH2F *hangletracksVSd0xd0NCotherpt;
2264  TH2F *hangletracksVSd0D0NCotherpt;
2265  TH1F *hd0xd0NCotherpt;
2266 
2267  TH2F *hTOFpidNCother=new TH2F("hTOFpidNCother","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2268  flistNoCutsOther->Add(hTOFpidNCother);
2269 
2270  for(Int_t i=0;i<fnbins;i++){
2271  namehist="hd0zD0ptNCother_pt";
2272  namehist+=i;
2273  titlehist="d0(z) No Cuts Otherm ptbin=";
2274  titlehist+=i;
2275  hd0zD0ptNCother=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2276  hd0zD0ptNCother->SetXTitle("d_{0}(z) [#mum]");
2277  hd0zD0ptNCother->SetYTitle("Entries");
2278  flistNoCutsOther->Add(hd0zD0ptNCother);
2279 
2280  namehist="hInvMassD0NCother_pt";
2281  namehist+=i;
2282  titlehist="Invariant Mass No Cuts Other ptbin=";
2283  titlehist+=i;
2284  hInvMassD0NCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2285  hInvMassD0NCother->SetXTitle("Invariant Mass [GeV]");
2286  hInvMassD0NCother->SetYTitle("Entries");
2287  flistNoCutsOther->Add(hInvMassD0NCother);
2288 
2289 
2290  namehist="hInvMassD0barNCother_pt";
2291  namehist+=i;
2292  titlehist="Invariant Mass D0bar No Cuts Other ptbin=";
2293  titlehist+=i;
2294  hInvMassD0barNCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2295  hInvMassD0barNCother->SetXTitle("Invariant Mass [GeV]");
2296  hInvMassD0barNCother->SetYTitle("Entries");
2297  flistNoCutsOther->Add(hInvMassD0barNCother);
2298 
2299 
2300  namehist="hetaNCother_pt";
2301  namehist+=i;
2302  titlehist="eta No Cuts Other ptbin=";
2303  titlehist+=i;
2304  hetaNCother=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2305  hetaNCother->SetXTitle("Pseudorapidity");
2306  hetaNCother->SetYTitle("Entries");
2307  flistNoCutsOther->Add(hetaNCother);
2308 
2309  namehist="hCosPDPBNCother_pt";
2310  namehist+=i;
2311  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2312  titlehist+=i;
2313  hCosPDPBNCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2314  hCosPDPBNCother->SetXTitle("Cosine between D0 momentum and B momentum");
2315  hCosPDPBNCother->SetYTitle("Entries");
2316  flistNoCutsOther->Add(hCosPDPBNCother);
2317 
2318  namehist="hCosPcPDNCother_pt";
2319  namehist+=i;
2320  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2321  titlehist+=i;
2322  hCosPcPDNCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2323  hCosPcPDNCother->SetXTitle("Cosine between c quark momentum and D0 momentum");
2324  hCosPcPDNCother->SetYTitle("Entries");
2325  flistNoCutsOther->Add(hCosPcPDNCother);
2326 
2327 
2328  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2329  namehist="hd0xd0NCother_pt";
2330  namehist+=i;
2331  titlehist="d0xd0 No Cuts Other ptbin=";
2332  titlehist+=i;
2333  hd0xd0NCotherpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2334  hd0xd0NCotherpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
2335  hd0xd0NCotherpt->SetYTitle("Entries");
2336  flistNoCutsOther->Add(hd0xd0NCotherpt);
2337 
2338 
2339  namehist="hd0D0VSd0xd0NCother_pt";
2340  namehist+=i;
2341  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Other ptbin=";
2342  titlehist+=i;
2343  hd0D0VSd0xd0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2344  hd0D0VSd0xd0NCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2345  hd0D0VSd0xd0NCotherpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
2346  flistNoCutsOther->Add(hd0D0VSd0xd0NCotherpt);
2347 
2348 
2349  namehist="hangletracksVSd0xd0NCother_pt";
2350  namehist+=i;
2351  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} No Cuts Other ptbin=";
2352  titlehist+=i;
2353  hangletracksVSd0xd0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2354  hangletracksVSd0xd0NCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2355  hangletracksVSd0xd0NCotherpt->SetYTitle(" angle between K and #p tracks [rad]");
2356  flistNoCutsOther->Add(hangletracksVSd0xd0NCotherpt);
2357 
2358 
2359  namehist="hangletracksVSd0D0NCother_pt";
2360  namehist+=i;
2361  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} No Cuts Other ptbin=";
2362  titlehist+=i;
2363  hangletracksVSd0D0NCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2364  hangletracksVSd0D0NCotherpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2365  hangletracksVSd0D0NCotherpt->SetYTitle(" angle between K and #p tracks [rad]");
2366  flistNoCutsOther->Add(hangletracksVSd0D0NCotherpt);
2367 
2368  }
2369  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2370  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2371 
2372 
2373 
2374 
2375  //############# d0 D0 histos ###############à
2376  TH1F *hd0D0NCotherPM = new TH1F("hd0D0NCotherPM","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2377  hd0D0NCotherPM->SetXTitle("Impact parameter [#mum]");
2378  hd0D0NCotherPM->SetYTitle("Entries");
2379 
2380  TH1F *hd0D0VtxTrueNCotherPM = new TH1F("hd0D0VtxTrueNCotherPM","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2381  hd0D0VtxTrueNCotherPM->SetXTitle("Impact parameter [#mum]");
2382  hd0D0VtxTrueNCotherPM->SetYTitle("Entries");
2383 
2384  TH1F *hMCd0D0NCotherPM = new TH1F("hMCd0D0NCotherPM","D^{0} impact par. plot, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2385  hMCd0D0NCotherPM->SetXTitle("MC Impact parameter [#mum]");
2386  hMCd0D0NCotherPM->SetYTitle("Entries");
2387 
2388  TH1F *hd0D0NCotherSB = new TH1F("hd0D0NCotherSB","D^{0} impact par. plot , No Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2389  hd0D0NCotherSB->SetXTitle("Impact parameter [#mum]");
2390  hd0D0NCotherSB->SetYTitle("Entries");
2391 
2392  TH1F *hd0D0VtxTrueNCotherSB = new TH1F("hd0D0VtxTrueNCotherSB","D^{0} impact par. w.r.t. True Vtx, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2393  hd0D0VtxTrueNCotherSB->SetXTitle("Impact parameter [#mum]");
2394  hd0D0VtxTrueNCotherSB->SetYTitle("Entries");
2395 
2396  TH1F *hMCd0D0NCotherSB = new TH1F("hMCd0D0NCotherSB","D^{0} impact par. plot, No Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
2397  hMCd0D0NCotherSB->SetXTitle("MC Impact parameter [#mum]");
2398  hMCd0D0NCotherSB->SetYTitle("Entries");
2399 
2400  flistNoCutsOther->Add(hd0D0NCotherPM);
2401  flistNoCutsOther->Add(hd0D0VtxTrueNCotherPM);
2402  flistNoCutsOther->Add(hMCd0D0NCotherPM);
2403  flistNoCutsOther->Add(hd0D0NCotherSB);
2404  flistNoCutsOther->Add(hd0D0VtxTrueNCotherSB);
2405  flistNoCutsOther->Add(hMCd0D0NCotherSB);
2406 
2407  TH1F *hd0D0ptNCotherPM;
2408  TH1F *hMCd0D0ptNCotherPM;
2409  TH1F *hd0D0VtxTrueptNCotherPM;
2410  TH1F *hd0D0ptNCotherSB;
2411  TH1F *hMCd0D0ptNCotherSB;
2412  TH1F *hd0D0VtxTrueptNCotherSB;
2413  namehist="hd0D0ptNCother_";
2414  titlehist="D^{0} impact par. plot, No Cuts, Other, ";
2415  for(Int_t i=0;i<fnbins;i++){
2416  strnamept=namehist;
2417  strnamept.Append("PkMss_pt");
2418  strnamept+=i;
2419 
2420  strtitlept=titlehist;
2421  strtitlept.Append(" Mass Peak, ");
2422  strtitlept+=fptbins[i];
2423  strtitlept.Append("<= pt <");
2424  strtitlept+=fptbins[i+1];
2425  strtitlept.Append(" [GeV/c]");
2426 
2427  hd0D0ptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2428  hd0D0ptNCotherPM->SetXTitle("Impact parameter [#mum] ");
2429  hd0D0ptNCotherPM->SetYTitle("Entries");
2430  flistNoCutsOther->Add(hd0D0ptNCotherPM);
2431 
2432  strnamept.ReplaceAll("hd0D0","hMCd0D0");
2433  hMCd0D0ptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2434  hMCd0D0ptNCotherPM->SetXTitle("MC Impact parameter [#mum] ");
2435  hMCd0D0ptNCotherPM->SetYTitle("Entries");
2436  flistNoCutsOther->Add(hMCd0D0ptNCotherPM);
2437 
2438 
2439  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2440  hd0D0VtxTrueptNCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2441  hd0D0VtxTrueptNCotherPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2442  hd0D0VtxTrueptNCotherPM->SetYTitle("Entries");
2443  flistNoCutsOther->Add(hd0D0VtxTrueptNCotherPM);
2444 
2445  strnamept=namehist;
2446  strnamept.Append("SBMss_pt");
2447  strnamept+=i;
2448 
2449  strtitlept=titlehist;
2450  strtitlept.Append(" Side Bands, ");
2451  strtitlept+=fptbins[i];
2452  strtitlept.Append("<= pt <");
2453  strtitlept+=fptbins[i+1];
2454  strtitlept.Append(" [GeV/c]");
2455 
2456  hd0D0ptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2457  hd0D0ptNCotherSB->SetXTitle("Impact parameter [#mum] ");
2458  hd0D0ptNCotherSB->SetYTitle("Entries");
2459  flistNoCutsOther->Add(hd0D0ptNCotherSB);
2460 
2461  strnamept.ReplaceAll("hd0D0","hMCd0D0");
2462  hMCd0D0ptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2463  hMCd0D0ptNCotherSB->SetXTitle("MC Impact parameter [#mum] ");
2464  hMCd0D0ptNCotherSB->SetYTitle("Entries");
2465  flistNoCutsOther->Add(hMCd0D0ptNCotherSB);
2466 
2467  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2468  hd0D0VtxTrueptNCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2469  hd0D0VtxTrueptNCotherSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2470  hd0D0VtxTrueptNCotherSB->SetYTitle("Entries");
2471  flistNoCutsOther->Add(hd0D0VtxTrueptNCotherSB);
2472  }
2473 
2474 
2475  //################################################################################################
2476  // #
2477  // HISTOS FOR LOOSE CUTS #
2478  // #
2479  //################################################################################################
2480 
2481  //############ LOOSE CUTS SIGNAL HISTOGRAMS ###############
2482  //
2483  // ####### global properties histo ############
2484 
2485  TH2F *hCPtaVSd0d0LSCsign=new TH2F("hCPtaVSd0d0LSCsign","hCPtaVSd0d0_LooseCuts_Signal",1000,-100000.,100000.,100,-1.,1.);
2486  TH1F *hSecVtxZLSCsign=new TH1F("hSecVtxZLSCsign","hSecVtxZ_LooseCuts_Signal",1000,-8.,8.);
2487  TH1F *hSecVtxXLSCsign=new TH1F("hSecVtxXLSCsign","hSecVtxX_LooseCuts_Signal",1000,-3000.,3000.);
2488  TH1F *hSecVtxYLSCsign=new TH1F("hSecVtxYLSCsign","hSecVtxY_LooseCuts_Signal",1000,-3000.,3000.);
2489  TH2F *hSecVtxXYLSCsign=new TH2F("hSecVtxXYLSCsign","hSecVtxXY_LooseCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
2490  TH1F *hSecVtxPhiLSCsign=new TH1F("hSecVtxPhiLSCsign","hSecVtxPhi_LooseCuts_Signal",180,-180.1,180.1);
2491  TH1F *hd0singlTrackLSCsign=new TH1F("hd0singlTrackLSCsign","hd0singlTrackLooseCuts_Signal",1000,-5000.,5000.);
2492  TH1F *hCPtaLSCsign=new TH1F("hCPtaLSCsign","hCPta_LooseCuts_Signal",100,-1.,1.);
2493  TH1F *hd0xd0LSCsign=new TH1F("hd0xd0LSCsign","hd0xd0_LooseCuts_Signal",1000,-100000.,100000.);
2494  TH1F *hMassTrueLSCsign=new TH1F("hMassTrueLSCsign","D^{0} MC inv. Mass Loose Cuts Signal(All momenta)",600,1.600,2.200);
2495  TH1F *hMassLSCsign=new TH1F("hMassLSCsign","D^{0} inv. Mass Loose Cuts Signal (All momenta)",600,1.600,2.200);
2496  hMassLSCsign->Sumw2();
2497  TH1F *hMassTrueLSCsignPM=new TH1F("hMassTrueLSCsignPM","D^{0} MC inv. Mass Loose Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
2498  TH1F *hMassLSCsignPM=new TH1F("hMassLSCsignPM","D^{0} inv. Mass Loose Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
2499  hMassLSCsignPM->Sumw2();
2500  TH1F *hMassTrueLSCsignSB=new TH1F("hMassTrueLSCsignSB","D^{0} MC inv. Mass in Side Bands Loose Cuts Signal(All momenta)",600,1.600,2.200);
2501  TH1F *hMassLSCsignSB=new TH1F("hMassLSCsignSB","D^{0} inv. Mass in Side Bands Loose Cuts Signal (All momenta)",600,1.600,2.200);
2502  hMassLSCsignSB->Sumw2();
2503 
2504  flistLsCutsSignal->Add(hCPtaVSd0d0LSCsign);
2505  flistLsCutsSignal->Add(hSecVtxZLSCsign);
2506  flistLsCutsSignal->Add(hSecVtxYLSCsign);
2507  flistLsCutsSignal->Add(hSecVtxXLSCsign);
2508  flistLsCutsSignal->Add(hSecVtxXYLSCsign);
2509  flistLsCutsSignal->Add(hSecVtxPhiLSCsign);
2510  flistLsCutsSignal->Add(hd0singlTrackLSCsign);
2511  flistLsCutsSignal->Add(hCPtaLSCsign);
2512  flistLsCutsSignal->Add(hd0xd0LSCsign);
2513  flistLsCutsSignal->Add(hMassTrueLSCsign);
2514  flistLsCutsSignal->Add(hMassLSCsign);
2515  flistLsCutsSignal->Add(hMassTrueLSCsignPM);
2516  flistLsCutsSignal->Add(hMassLSCsignPM);
2517  flistLsCutsSignal->Add(hMassTrueLSCsignSB);
2518  flistLsCutsSignal->Add(hMassLSCsignSB);
2519 
2520 
2521  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2522  TH1F *hdcaLSCsign=new TH1F("hdcaLSCsign","hdca_LooseCuts_Sign",100,0.,1000.);
2523  hdcaLSCsign->SetXTitle("dca [#mum]");
2524  hdcaLSCsign->SetYTitle("Entries");
2525  TH1F *hcosthetastarLSCsign=new TH1F("hcosthetastarLSCsign","hCosThetaStar_LooseCuts_Sign",50,-1.,1.);
2526  hcosthetastarLSCsign->SetXTitle("cos #theta^{*}");
2527  hcosthetastarLSCsign->SetYTitle("Entries");
2528  TH1F *hptD0LSCsign=new TH1F("hptD0LSCsign","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2529  hptD0LSCsign->SetXTitle("p_{t} [GeV/c]");
2530  hptD0LSCsign->SetYTitle("Entries");
2531  TH1F *hptD0VsMaxPtLSCsign=new TH1F("hptD0VsMaxPtLSCsign","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2532  TH2F *hptD0PTallsqrtLSCsign=new TH2F("hptD0PTallsqrtLSCsign","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2533  TH2F *hptD0PTallLSCsign=new TH2F("hptD0PTallLSCsign","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2534  TH2F *hptD0vsptBLSCsign=new TH2F("hptD0vsptBLSCsign","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2535  TH2F *hpD0vspBLSCsign=new TH2F("hpD0vspBLSCsign","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2536  TH2F *hptD0vsptcquarkLSCsign=new TH2F("hptD0vsptcquarkLSCsign","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2537  TH2F *hpD0vspcquarkLSCsign=new TH2F("hpD0vspcquarkLSCsign","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2538  flistLsCutsSignal->Add(hdcaLSCsign);
2539  flistLsCutsSignal->Add(hcosthetastarLSCsign);
2540  flistLsCutsSignal->Add(hptD0LSCsign);
2541  flistLsCutsSignal->Add(hptD0VsMaxPtLSCsign);
2542  flistLsCutsSignal->Add(hptD0PTallsqrtLSCsign);
2543  flistLsCutsSignal->Add(hptD0PTallLSCsign);
2544  flistLsCutsSignal->Add(hptD0vsptBLSCsign);
2545  flistLsCutsSignal->Add(hpD0vspBLSCsign);
2546  flistLsCutsSignal->Add(hptD0vsptcquarkLSCsign);
2547  flistLsCutsSignal->Add(hpD0vspcquarkLSCsign);
2548 
2549  TH1F *hd0zD0ptLSCsign;
2550  TH1F *hInvMassD0LSCsign,*hInvMassD0barLSCsign;
2551  TH2F *hInvMassPtLSCsign=new TH2F("hInvMassPtLSCsign","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2552  TH3F *hInvMassPtSelSignOnlyLSCsign=new TH3F("hInvMassPtSelSignOnlyLSCsign","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
2553  flistLsCutsSignal->Add(hInvMassPtSelSignOnlyLSCsign);
2554  TH3F *hInvMassPtSelReflOnlyLSCsign=new TH3F("hInvMassPtSelReflOnlyLSCsign","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
2555  flistLsCutsSignal->Add(hInvMassPtSelReflOnlyLSCsign);
2556 
2557  THnSparseF *hSparseLSCsign=new THnSparseF("hSparseLSCsign","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2558  hSparseLSCsign->SetBinEdges(0,massbins);
2559  hSparseLSCsign->SetBinEdges(1,massbins);
2560  hSparseLSCsign->SetBinEdges(2,ptbinsForNsparse);
2561  hSparseLSCsign->SetBinEdges(3,impparbins);
2562  hSparseLSCsign->SetBinEdges(4,massHypoBins);
2563  flistLsCutsSignal->Add(hSparseLSCsign);
2564  TH1F *hetaLSCsign;
2565  TH1F *hCosPDPBLSCsign;
2566  TH1F *hCosPcPDLSCsign;
2567  flistLsCutsSignal->Add(hInvMassPtLSCsign);
2568 
2569  fTreeLSCsign = new TTree("fTreeLSCsign","Candidate variables tree");
2571  for(Int_t ivar=0; ivar<nVar; ivar++){
2572  fTreeLSCsign->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeLSCsign[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
2573  }
2575 
2576 
2577 
2578  THnSparseF *hSparseCxyLxyLSCsign=new THnSparseF("hSparseCxyLxyLSCsign","Candidate Mass;massD0;Pt;CosXY;Lxy",4,nbinsSparsCxyLxy,binLowLimitSparseCxyLxy,binUpLimitSparseCxyLxy);
2579  hSparseCxyLxyLSCsign->SetBinEdges(1,ptbinlimitsCxyLxy);
2580  hSparseCxyLxyLSCsign->GetAxis(0)->SetName("mass");
2581  hSparseCxyLxyLSCsign->GetAxis(0)->SetTitle("Invariant Mass (K#pi) [GeV/c^{2}]");
2582  hSparseCxyLxyLSCsign->GetAxis(1)->SetName("pt");
2583  hSparseCxyLxyLSCsign->GetAxis(1)->SetTitle("p_{t} [GeV/c]");
2584  hSparseCxyLxyLSCsign->GetAxis(2)->SetName("CosPointXY");
2585  hSparseCxyLxyLSCsign->GetAxis(2)->SetTitle("Cos#theta_{point}^{XY}");
2586  hSparseCxyLxyLSCsign->GetAxis(3)->SetName("NormDecLengthXY");
2587  hSparseCxyLxyLSCsign->GetAxis(3)->SetTitle("Normalized XY decay length");
2588 
2589  flistLsCutsSignal->Add(hSparseCxyLxyLSCsign);
2590  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2591  TH2F *hd0D0VSd0xd0LSCsignpt;
2592  TH2F *hangletracksVSd0xd0LSCsignpt;
2593  TH2F *hangletracksVSd0D0LSCsignpt;
2594  TH1F *hd0xd0LSCsignpt;
2595  TH1F *hPhiHistPMLSCsignpt,*hPhiHistSBLSCsignpt;
2596 
2597  TH2F *hTOFpidLSCsign=new TH2F("hTOFpidLSCsign","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2598  flistLsCutsSignal->Add(hTOFpidLSCsign);
2599 
2600  for(Int_t i=0;i<fnbins;i++){
2601 
2602  namehist="hPhiHistPMLSCsign_pt";
2603  namehist+=i;
2604  titlehist="Azimuthal correlation LS Cuts Sign PM ptbin=";
2605  titlehist+=i;
2606  hPhiHistPMLSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
2607  hPhiHistPMLSCsignpt->Sumw2();
2608  flistLsCutsSignal->Add(hPhiHistPMLSCsignpt);
2609 
2610  namehist="hPhiHistSBLSCsign_pt";
2611  namehist+=i;
2612  titlehist="Azimuthal correlation LS Cuts Sign SB ptbin=";
2613  titlehist+=i;
2614  hPhiHistSBLSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
2615  hPhiHistSBLSCsignpt->Sumw2();
2616  flistLsCutsSignal->Add(hPhiHistSBLSCsignpt);
2617 
2618 
2619 
2620  namehist="hd0zD0ptLSCsign_pt";
2621  namehist+=i;
2622  titlehist="d0(z) Loose Cuts Signm ptbin=";
2623  titlehist+=i;
2624  hd0zD0ptLSCsign=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2625  hd0zD0ptLSCsign->SetXTitle("d_{0}(z) [#mum]");
2626  hd0zD0ptLSCsign->SetYTitle("Entries");
2627  flistLsCutsSignal->Add(hd0zD0ptLSCsign);
2628 
2629  namehist="hInvMassD0LSCsign_pt";
2630  namehist+=i;
2631  titlehist="Invariant Mass Loose Cuts Sign ptbin=";
2632  titlehist+=i;
2633  hInvMassD0LSCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2634  hInvMassD0LSCsign->SetXTitle("Invariant Mass [GeV]");
2635  hInvMassD0LSCsign->SetYTitle("Entries");
2636  flistLsCutsSignal->Add(hInvMassD0LSCsign);
2637 
2638 
2639  namehist="hInvMassD0barLSCsign_pt";
2640  namehist+=i;
2641  titlehist="Invariant Mass D0bar Loose Cuts Signal ptbin=";
2642  titlehist+=i;
2643  hInvMassD0barLSCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2644  hInvMassD0barLSCsign->SetXTitle("Invariant Mass [GeV]");
2645  hInvMassD0barLSCsign->SetYTitle("Entries");
2646  flistLsCutsSignal->Add(hInvMassD0barLSCsign);
2647 
2648  namehist="hetaLSCsign_pt";
2649  namehist+=i;
2650  titlehist="eta Loose Cuts Sign ptbin=";
2651  titlehist+=i;
2652  hetaLSCsign=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2653  hetaLSCsign->SetXTitle("Pseudorapidity");
2654  hetaLSCsign->SetYTitle("Entries");
2655  flistLsCutsSignal->Add(hetaLSCsign);
2656 
2657  namehist="hCosPDPBLSCsign_pt";
2658  namehist+=i;
2659  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2660  titlehist+=i;
2661  hCosPDPBLSCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2662  hCosPDPBLSCsign->SetXTitle("Cosine between D0 momentum and B momentum");
2663  hCosPDPBLSCsign->SetYTitle("Entries");
2664  flistLsCutsSignal->Add(hCosPDPBLSCsign);
2665 
2666  namehist="hCosPcPDLSCsign_pt";
2667  namehist+=i;
2668  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2669  titlehist+=i;
2670  hCosPcPDLSCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2671  hCosPcPDLSCsign->SetXTitle("Cosine between c quark momentum and D0 momentum");
2672  hCosPcPDLSCsign->SetYTitle("Entries");
2673  flistLsCutsSignal->Add(hCosPcPDLSCsign);
2674 
2675 
2676  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2677  namehist="hd0xd0LSCsign_pt";
2678  namehist+=i;
2679  titlehist="d0xd0 Loose Cuts Sign ptbin=";
2680  titlehist+=i;
2681  hd0xd0LSCsignpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2682  hd0xd0LSCsignpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
2683  hd0xd0LSCsignpt->SetYTitle("Entries");
2684  flistLsCutsSignal->Add(hd0xd0LSCsignpt);
2685 
2686 
2687  namehist="hd0D0VSd0xd0LSCsign_pt";
2688  namehist+=i;
2689  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Sign ptbin=";
2690  titlehist+=i;
2691  hd0D0VSd0xd0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2692  hd0D0VSd0xd0LSCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2693  hd0D0VSd0xd0LSCsignpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
2694  flistLsCutsSignal->Add(hd0D0VSd0xd0LSCsignpt);
2695 
2696 
2697  namehist="hangletracksVSd0xd0LSCsign_pt";
2698  namehist+=i;
2699  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Sign ptbin=";
2700  titlehist+=i;
2701  hangletracksVSd0xd0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
2702  hangletracksVSd0xd0LSCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2703  hangletracksVSd0xd0LSCsignpt->SetYTitle(" angle between K and #p tracks [rad]");
2704  flistLsCutsSignal->Add(hangletracksVSd0xd0LSCsignpt);
2705 
2706 
2707  namehist="hangletracksVSd0D0LSCsign_pt";
2708  namehist+=i;
2709  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Sign ptbin=";
2710  titlehist+=i;
2711  hangletracksVSd0D0LSCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
2712  hangletracksVSd0D0LSCsignpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
2713  hangletracksVSd0D0LSCsignpt->SetYTitle(" angle between K and #p tracks [rad]");
2714  flistLsCutsSignal->Add(hangletracksVSd0D0LSCsignpt);
2715 
2716 
2717  }
2718  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
2719  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2720 
2721 
2722  // ####### d0 D0 histos ############
2723  TH1F *hd0D0LSCsignPM = new TH1F("hd0D0LSCsignPM","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2724  hd0D0LSCsignPM->SetXTitle("Impact parameter [#mum]");
2725  hd0D0LSCsignPM->SetYTitle("Entries");
2726 
2727  TH1F *hd0D0VtxTrueLSCsignPM = new TH1F("hd0D0VtxTrueLSCsignPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2728  hd0D0VtxTrueLSCsignPM->SetXTitle("Impact parameter [#mum]");
2729  hd0D0VtxTrueLSCsignPM->SetYTitle("Entries");
2730 
2731  TH1F *hMCd0D0LSCsignPM = new TH1F("hMCd0D0LSCsignPM","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2732  hMCd0D0LSCsignPM->SetXTitle("MC Impact parameter [#mum]");
2733  hMCd0D0LSCsignPM->SetYTitle("Entries");
2734 
2735  TH1F *hd0D0LSCsignSB = new TH1F("hd0D0LSCsignSB","D^{0} impact par. plot , Loose Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2736  hd0D0LSCsignSB->SetXTitle("Impact parameter [#mum]");
2737  hd0D0LSCsignSB->SetYTitle("Entries");
2738 
2739  TH1F *hd0D0VtxTrueLSCsignSB = new TH1F("hd0D0VtxTrueLSCsignSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2740  hd0D0VtxTrueLSCsignSB->SetXTitle("Impact parameter [#mum]");
2741  hd0D0VtxTrueLSCsignSB->SetYTitle("Entries");
2742 
2743  TH1F *hMCd0D0LSCsignSB = new TH1F("hMCd0D0LSCsignSB","D^{0} impact par. plot, Loose Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
2744  hMCd0D0LSCsignSB->SetXTitle("MC Impact parameter [#mum]");
2745  hMCd0D0LSCsignSB->SetYTitle("Entries");
2746 
2747  flistLsCutsSignal->Add(hd0D0LSCsignPM);
2748  flistLsCutsSignal->Add(hd0D0VtxTrueLSCsignPM);
2749  flistLsCutsSignal->Add(hMCd0D0LSCsignPM);
2750  flistLsCutsSignal->Add(hd0D0LSCsignSB);
2751  flistLsCutsSignal->Add(hd0D0VtxTrueLSCsignSB);
2752  flistLsCutsSignal->Add(hMCd0D0LSCsignSB);
2753 
2754  TH1F *hd0D0ptLSCsignPM;
2755  TH1F *hMCd0D0ptLSCsignPM;
2756  TH1F *hd0D0VtxTrueptLSCsignPM;
2757  TH1F *hd0D0ptLSCsignSB;
2758  TH1F *hMCd0D0ptLSCsignSB;
2759  TH1F *hd0D0VtxTrueptLSCsignSB;
2760  namehist="hd0D0ptLSCsign_";
2761  titlehist="D^{0} impact par. plot, Loose Cuts, Signal, ";
2762  for(Int_t i=0;i<fnbins;i++){
2763  strnamept=namehist;
2764  strnamept.Append("PkMss_pt");
2765  strnamept+=i;
2766 
2767  strtitlept=titlehist;
2768  strtitlept.Append(" Mass Peak, ");
2769  strtitlept+=fptbins[i];
2770  strtitlept.Append("<= pt <");
2771  strtitlept+=fptbins[i+1];
2772  strtitlept.Append(" [GeV/c]");
2773 
2774  hd0D0ptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2775  hd0D0ptLSCsignPM->SetXTitle("Impact parameter [#mum] ");
2776  hd0D0ptLSCsignPM->SetYTitle("Entries");
2777  flistLsCutsSignal->Add(hd0D0ptLSCsignPM);
2778 
2779  strnamept.ReplaceAll("hd0D0","hMCd0D0");
2780  hMCd0D0ptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2781  hMCd0D0ptLSCsignPM->SetXTitle("MC Impact parameter [#mum] ");
2782  hMCd0D0ptLSCsignPM->SetYTitle("Entries");
2783  flistLsCutsSignal->Add(hMCd0D0ptLSCsignPM);
2784 
2785 
2786  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2787  hd0D0VtxTrueptLSCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2788  hd0D0VtxTrueptLSCsignPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2789  hd0D0VtxTrueptLSCsignPM->SetYTitle("Entries");
2790  flistLsCutsSignal->Add(hd0D0VtxTrueptLSCsignPM);
2791 
2792  strnamept=namehist;
2793  strnamept.Append("SBMss_pt");
2794  strnamept+=i;
2795 
2796  strtitlept=titlehist;
2797  strtitlept.Append(" Side Bands, ");
2798  strtitlept+=fptbins[i];
2799  strtitlept.Append("<= pt <");
2800  strtitlept+=fptbins[i+1];
2801  strtitlept.Append(" [GeV/c]");
2802 
2803  hd0D0ptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2804  hd0D0ptLSCsignSB->SetXTitle("Impact parameter [#mum] ");
2805  hd0D0ptLSCsignSB->SetYTitle("Entries");
2806  flistLsCutsSignal->Add(hd0D0ptLSCsignSB);
2807 
2808  strnamept.ReplaceAll("hd0D0","hMCd0D0");
2809  hMCd0D0ptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2810  hMCd0D0ptLSCsignSB->SetXTitle("MC Impact parameter [#mum] ");
2811  hMCd0D0ptLSCsignSB->SetYTitle("Entries");
2812  flistLsCutsSignal->Add(hMCd0D0ptLSCsignSB);
2813 
2814  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
2815  hd0D0VtxTrueptLSCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
2816  hd0D0VtxTrueptLSCsignSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
2817  hd0D0VtxTrueptLSCsignSB->SetYTitle("Entries");
2818  flistLsCutsSignal->Add(hd0D0VtxTrueptLSCsignSB);
2819  }
2820 
2821 
2822  //############ LOOSE CUTS BACKGROUND HISTOGRAMS ###########
2823  //
2824  // ######## global properties histos #######
2825  TH2F *hCPtaVSd0d0LSCback=new TH2F("hCPtaVSd0d0LSCback","hCPtaVSd0d0_LooseCuts_Background",1000,-100000.,100000.,100,-1.,1.);
2826  TH1F *hSecVtxZLSCback=new TH1F("hSecVtxZLSCback","hSecVtxZ_LooseCuts_Background",1000,-8.,8.);
2827  TH1F *hSecVtxXLSCback=new TH1F("hSecVtxXLSCback","hSecVtxX_LooseCuts_Background",1000,-3000.,3000.);
2828  TH1F *hSecVtxYLSCback=new TH1F("hSecVtxYLSCback","hSecVtxY_LooseCuts_Background",1000,-3000.,3000.);
2829  TH2F *hSecVtxXYLSCback=new TH2F("hSecVtxXYLSCback","hSecVtxXY_LooseCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
2830  TH1F *hSecVtxPhiLSCback=new TH1F("hSecVtxPhiLSCback","hSecVtxPhi_LooseCuts_Background",180,-180.1,180.1);
2831  TH1F *hd0singlTrackLSCback=new TH1F("hd0singlTrackLSCback","hd0singlTrackLooseCuts_Back",1000,-5000.,5000.);
2832  TH1F *hCPtaLSCback=new TH1F("hCPtaLSCback","hCPta_LooseCuts_Background",100,-1.,1.);
2833  TH1F *hd0xd0LSCback=new TH1F("hd0xd0LSCback","hd0xd0_LooseCuts_Background",1000,-100000.,100000.);
2834  TH1F *hMassTrueLSCback=new TH1F("hMassTrueLSCback","D^{0} MC inv. Mass Loose Cuts Background(All momenta)",600,1.600,2.200);
2835  TH1F *hMassLSCback=new TH1F("hMassLSCback","D^{0} inv. Mass Loose Cuts Background (All momenta)",600,1.600,2.200);
2836  hMassLSCback->Sumw2();
2837  TH1F *hMassTrueLSCbackPM=new TH1F("hMassTrueLSCbackPM","D^{0} MC inv. Mass Loose Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
2838  TH1F *hMassLSCbackPM=new TH1F("hMassLSCbackPM","D^{0} inv. Mass Loose Cuts Background (All momenta), MassPeak",600,1.600,2.200);
2839  hMassLSCbackPM->Sumw2();
2840  TH1F *hMassTrueLSCbackSB=new TH1F("hMassTrueLSCbackSB","D^{0} MC inv. Mass in Side Bands Loose Cuts Background(All momenta)",600,1.600,2.200);
2841  TH1F *hMassLSCbackSB=new TH1F("hMassLSCbackSB","D^{0} inv. Mass in Side Bands Loose Cuts Background (All momenta)",600,1.600,2.200);
2842  hMassLSCbackSB->Sumw2();
2843 
2844  flistLsCutsBack->Add(hCPtaVSd0d0LSCback);
2845  flistLsCutsBack->Add(hSecVtxZLSCback);
2846  flistLsCutsBack->Add(hSecVtxYLSCback);
2847  flistLsCutsBack->Add(hSecVtxXLSCback);
2848  flistLsCutsBack->Add(hSecVtxXYLSCback);
2849  flistLsCutsBack->Add(hSecVtxPhiLSCback);
2850  flistLsCutsBack->Add(hd0singlTrackLSCback);
2851  flistLsCutsBack->Add(hCPtaLSCback);
2852  flistLsCutsBack->Add(hd0xd0LSCback);
2853  flistLsCutsBack->Add(hMassTrueLSCback);
2854  flistLsCutsBack->Add(hMassLSCback);
2855  flistLsCutsBack->Add(hMassTrueLSCbackPM);
2856  flistLsCutsBack->Add(hMassLSCbackPM);
2857  flistLsCutsBack->Add(hMassTrueLSCbackSB);
2858  flistLsCutsBack->Add(hMassLSCbackSB);
2859 
2860 
2861 
2862 
2863 
2864 
2865 
2866 
2867  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
2868  TH1F *hdcaLSCback=new TH1F("hdcaLSCback","hdca_LooseCuts_Backgr",100,0.,1000.);
2869  hdcaLSCback->SetXTitle("dca [#mum]");
2870  hdcaLSCback->SetYTitle("Entries");
2871  TH1F *hcosthetastarLSCback=new TH1F("hcosthetastarLSCback","hCosThetaStar_LooseCuts_Backgr",50,-1.,1.);
2872  hcosthetastarLSCback->SetXTitle("cos #theta^{*}");
2873  hcosthetastarLSCback->SetYTitle("Entries");
2874  TH1F *hptD0LSCback=new TH1F("hptD0LSCback","D^{0} transverse momentum distribution",34,ptbinsD0arr);
2875  hptD0LSCback->SetXTitle("p_{t} [GeV/c]");
2876  hptD0LSCback->SetYTitle("Entries");
2877  TH1F *hptD0VsMaxPtLSCback=new TH1F("hptD0VsMaxPtLSCback","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
2878  TH2F *hptD0PTallsqrtLSCback=new TH2F("hptD0PTallsqrtLSCback","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
2879  TH2F *hptD0PTallLSCback=new TH2F("hptD0PTallLSCback","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
2880  TH2F *hptD0vsptBLSCback=new TH2F("hptD0vsptBLSCback","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2881  TH2F *hpD0vspBLSCback=new TH2F("hpD0vspBLSCback","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2882  TH2F *hptD0vsptcquarkLSCback=new TH2F("hptD0vsptcquarkLSCback","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2883  TH2F *hpD0vspcquarkLSCback=new TH2F("hpD0vspcquarkLSCback","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
2884  flistLsCutsBack->Add(hdcaLSCback);
2885  flistLsCutsBack->Add(hcosthetastarLSCback);
2886  flistLsCutsBack->Add(hptD0LSCback);
2887  flistLsCutsBack->Add(hptD0VsMaxPtLSCback);
2888  flistLsCutsBack->Add(hptD0PTallsqrtLSCback);
2889  flistLsCutsBack->Add(hptD0PTallLSCback);
2890  flistLsCutsBack->Add(hptD0vsptBLSCback);
2891  flistLsCutsBack->Add(hpD0vspBLSCback);
2892  flistLsCutsBack->Add(hptD0vsptcquarkLSCback);
2893  flistLsCutsBack->Add(hpD0vspcquarkLSCback);
2894 
2895  TH1F *hd0zD0ptLSCback;
2896  TH1F *hInvMassD0LSCback,*hInvMassD0barLSCback;
2897  TH2F *hInvMassPtLSCback=new TH2F("hInvMassPtLSCback","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
2898  THnSparseF *hSparseLSCback=new THnSparseF("hSparseLSCback","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
2899  hSparseLSCback->SetBinEdges(0,massbins);
2900  hSparseLSCback->SetBinEdges(1,massbins);
2901  hSparseLSCback->SetBinEdges(2,ptbinsForNsparse);
2902  hSparseLSCback->SetBinEdges(3,impparbins);
2903  hSparseLSCback->SetBinEdges(4,massHypoBins);
2904  flistLsCutsBack->Add(hSparseLSCback);
2905 
2906  fTreeLSCback = new TTree("fTreeLSCback","Candidate variables tree");
2908  for(Int_t ivar=0; ivar<nVar; ivar++){
2909  fTreeLSCback->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeLSCback[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
2910  }
2912 
2913  TH1F *hetaLSCback;
2914  TH1F *hCosPDPBLSCback;
2915  TH1F *hCosPcPDLSCback;
2916  flistLsCutsBack->Add(hInvMassPtLSCback);
2917  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2918  TH2F *hd0D0VSd0xd0LSCbackpt;
2919  TH2F *hangletracksVSd0xd0LSCbackpt;
2920  TH2F *hangletracksVSd0D0LSCbackpt;
2921  TH1F *hd0xd0LSCbackpt;
2922 
2923  TH2F *hTOFpidLSCback=new TH2F("hTOFpidLSCback","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
2924  flistLsCutsBack->Add(hTOFpidLSCback);
2925 
2926  for(Int_t i=0;i<fnbins;i++){
2927  namehist="hd0zD0ptLSCback_pt";
2928  namehist+=i;
2929  titlehist="d0(z) Loose Cuts Backgr ptbin=";
2930  titlehist+=i;
2931  hd0zD0ptLSCback=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
2932  hd0zD0ptLSCback->SetXTitle("d_{0}(z) [#mum]");
2933  hd0zD0ptLSCback->SetYTitle("Entries");
2934  flistLsCutsBack->Add(hd0zD0ptLSCback);
2935 
2936  namehist="hInvMassD0LSCback_pt";
2937  namehist+=i;
2938  titlehist="Invariant Mass Loose Cuts Backgr ptbin=";
2939  titlehist+=i;
2940  hInvMassD0LSCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2941  hInvMassD0LSCback->SetXTitle("Invariant Mass [GeV]");
2942  hInvMassD0LSCback->SetYTitle("Entries");
2943  flistLsCutsBack->Add(hInvMassD0LSCback);
2944 
2945  namehist="hInvMassD0barLSCback_pt";
2946  namehist+=i;
2947  titlehist="Invariant Mass D0bar Loose Cuts Back ptbin=";
2948  titlehist+=i;
2949  hInvMassD0barLSCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
2950  hInvMassD0barLSCback->SetXTitle("Invariant Mass [GeV]");
2951  hInvMassD0barLSCback->SetYTitle("Entries");
2952  flistLsCutsBack->Add(hInvMassD0barLSCback);
2953 
2954 
2955  namehist="hetaLSCback_pt";
2956  namehist+=i;
2957  titlehist="eta Loose Cuts Backgr ptbin=";
2958  titlehist+=i;
2959  hetaLSCback=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
2960  hetaLSCback->SetXTitle("Pseudorapidity");
2961  hetaLSCback->SetYTitle("Entries");
2962  flistLsCutsBack->Add(hetaLSCback);
2963 
2964  namehist="hCosPDPBLSCback_pt";
2965  namehist+=i;
2966  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
2967  titlehist+=i;
2968  hCosPDPBLSCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2969  hCosPDPBLSCback->SetXTitle("Cosine between D0 momentum and B momentum");
2970  hCosPDPBLSCback->SetYTitle("Entries");
2971  flistLsCutsBack->Add(hCosPDPBLSCback);
2972 
2973  namehist="hCosPcPDLSCback_pt";
2974  namehist+=i;
2975  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
2976  titlehist+=i;
2977  hCosPcPDLSCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
2978  hCosPcPDLSCback->SetXTitle("Cosine between c quark momentum and D0 momentum");
2979  hCosPcPDLSCback->SetYTitle("Entries");
2980  flistLsCutsBack->Add(hCosPcPDLSCback);
2981 
2982  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
2983  namehist="hd0xd0LSCback_pt";
2984  namehist+=i;
2985  titlehist="d0xd0 Loose Cuts Back ptbin=";
2986  titlehist+=i;
2987  hd0xd0LSCbackpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
2988  hd0xd0LSCbackpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
2989  hd0xd0LSCbackpt->SetYTitle("Entries");
2990  flistLsCutsBack->Add(hd0xd0LSCbackpt);
2991 
2992 
2993  namehist="hd0D0VSd0xd0LSCback_pt";
2994  namehist+=i;
2995  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Back ptbin=";
2996  titlehist+=i;
2997  hd0D0VSd0xd0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
2998  hd0D0VSd0xd0LSCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
2999  hd0D0VSd0xd0LSCbackpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
3000  flistLsCutsBack->Add(hd0D0VSd0xd0LSCbackpt);
3001 
3002 
3003  namehist="hangletracksVSd0xd0LSCback_pt";
3004  namehist+=i;
3005  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Back ptbin=";
3006  titlehist+=i;
3007  hangletracksVSd0xd0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
3008  hangletracksVSd0xd0LSCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3009  hangletracksVSd0xd0LSCbackpt->SetYTitle(" angle between K and #p tracks [rad]");
3010  flistLsCutsBack->Add(hangletracksVSd0xd0LSCbackpt);
3011 
3012 
3013  namehist="hangletracksVSd0D0LSCback_pt";
3014  namehist+=i;
3015  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Back ptbin=";
3016  titlehist+=i;
3017  hangletracksVSd0D0LSCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
3018  hangletracksVSd0D0LSCbackpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
3019  hangletracksVSd0D0LSCbackpt->SetYTitle(" angle between K and #p tracks [rad]");
3020  flistLsCutsBack->Add(hangletracksVSd0D0LSCbackpt);
3021 
3022  }
3023  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
3024  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3025 
3026 
3027 
3028 
3029 
3030 
3031 
3032  // ####### d0 D0 histos ############
3033 
3034  TH1F *hd0D0LSCbackPM = new TH1F("hd0D0LSCbackPM","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
3035  hd0D0LSCbackPM->SetXTitle("Impact parameter [#mum]");
3036  hd0D0LSCbackPM->SetYTitle("Entries");
3037 
3038  TH1F *hd0D0VtxTrueLSCbackPM = new TH1F("hd0D0VtxTrueLSCbackPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
3039  hd0D0VtxTrueLSCbackPM->SetXTitle("Impact parameter [#mum]");
3040  hd0D0VtxTrueLSCbackPM->SetYTitle("Entries");
3041 
3042  TH1F *hMCd0D0LSCbackPM = new TH1F("hMCd0D0LSCbackPM","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
3043  hMCd0D0LSCbackPM->SetXTitle("MC Impact parameter [#mum]");
3044  hMCd0D0LSCbackPM->SetYTitle("Entries");
3045 
3046  TH1F *hd0D0LSCbackSB = new TH1F("hd0D0LSCbackSB","D^{0} impact par. plot , Loose Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
3047  hd0D0LSCbackSB->SetXTitle("Impact parameter [#mum]");
3048  hd0D0LSCbackSB->SetYTitle("Entries");
3049 
3050  TH1F *hd0D0VtxTrueLSCbackSB = new TH1F("hd0D0VtxTrueLSCbackSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
3051  hd0D0VtxTrueLSCbackSB->SetXTitle("Impact parameter [#mum]");
3052  hd0D0VtxTrueLSCbackSB->SetYTitle("Entries");
3053 
3054  TH1F *hMCd0D0LSCbackSB = new TH1F("hMCd0D0LSCbackSB","D^{0} impact par. plot, Loose Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
3055  hMCd0D0LSCbackSB->SetXTitle("MC Impact parameter [#mum]");
3056  hMCd0D0LSCbackSB->SetYTitle("Entries");
3057 
3058  flistLsCutsBack->Add(hd0D0LSCbackPM);
3059  flistLsCutsBack->Add(hd0D0VtxTrueLSCbackPM);
3060  flistLsCutsBack->Add(hMCd0D0LSCbackPM);
3061  flistLsCutsBack->Add(hd0D0LSCbackSB);
3062  flistLsCutsBack->Add(hd0D0VtxTrueLSCbackSB);
3063  flistLsCutsBack->Add(hMCd0D0LSCbackSB);
3064 
3065  TH1F *hd0D0ptLSCbackPM;
3066  TH1F *hMCd0D0ptLSCbackPM;
3067  TH1F *hd0D0VtxTrueptLSCbackPM;
3068  TH1F *hd0D0ptLSCbackSB;
3069  TH1F *hMCd0D0ptLSCbackSB;
3070  TH1F *hd0D0VtxTrueptLSCbackSB;
3071  namehist="hd0D0ptLSCback_";
3072  titlehist="D^{0} impact par. plot, Loose Cuts, Background, ";
3073  for(Int_t i=0;i<fnbins;i++){
3074  strnamept=namehist;
3075  strnamept.Append("PkMss_pt");
3076  strnamept+=i;
3077 
3078  strtitlept=titlehist;
3079  strtitlept.Append(" Mass Peak, ");
3080  strtitlept+=fptbins[i];
3081  strtitlept.Append("<= pt <");
3082  strtitlept+=fptbins[i+1];
3083  strtitlept.Append(" [GeV/c]");
3084 
3085  hd0D0ptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3086  hd0D0ptLSCbackPM->SetXTitle("Impact parameter [#mum] ");
3087  hd0D0ptLSCbackPM->SetYTitle("Entries");
3088  flistLsCutsBack->Add(hd0D0ptLSCbackPM);
3089 
3090  strnamept.ReplaceAll("hd0D0","hMCd0D0");
3091  hMCd0D0ptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3092  hMCd0D0ptLSCbackPM->SetXTitle("MC Impact parameter [#mum] ");
3093  hMCd0D0ptLSCbackPM->SetYTitle("Entries");
3094  flistLsCutsBack->Add(hMCd0D0ptLSCbackPM);
3095 
3096 
3097  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3098  hd0D0VtxTrueptLSCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3099  hd0D0VtxTrueptLSCbackPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3100  hd0D0VtxTrueptLSCbackPM->SetYTitle("Entries");
3101  flistLsCutsBack->Add(hd0D0VtxTrueptLSCbackPM);
3102 
3103  strnamept=namehist;
3104  strnamept.Append("SBMss_pt");
3105  strnamept+=i;
3106 
3107  strtitlept=titlehist;
3108  strtitlept.Append(" Side Bands, ");
3109  strtitlept+=fptbins[i];
3110  strtitlept.Append("<= pt <");
3111  strtitlept+=fptbins[i+1];
3112  strtitlept.Append(" [GeV/c]");
3113 
3114  hd0D0ptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3115  hd0D0ptLSCbackSB->SetXTitle("Impact parameter [#mum] ");
3116  hd0D0ptLSCbackSB->SetYTitle("Entries");
3117  flistLsCutsBack->Add(hd0D0ptLSCbackSB);
3118 
3119  strnamept.ReplaceAll("hd0D0","hMCd0D0");
3120  hMCd0D0ptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3121  hMCd0D0ptLSCbackSB->SetXTitle("MC Impact parameter [#mum] ");
3122  hMCd0D0ptLSCbackSB->SetYTitle("Entries");
3123  flistLsCutsBack->Add(hMCd0D0ptLSCbackSB);
3124 
3125  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3126  hd0D0VtxTrueptLSCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3127  hd0D0VtxTrueptLSCbackSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3128  hd0D0VtxTrueptLSCbackSB->SetYTitle("Entries");
3129  flistLsCutsBack->Add(hd0D0VtxTrueptLSCbackSB);
3130  }
3131 
3132 
3133 
3134  //############ LOOSE CUTS FROMB HISTOGRAMS ###########
3135  //
3136  //####### global properties histos
3137 
3138  TH2F *hCPtaVSd0d0LSCfromB=new TH2F("hCPtaVSd0d0LSCfromB","hCPtaVSd0d0_LooseCuts_FromB",1000,-100000.,100000.,100,-1.,1.);
3139  TH1F *hSecVtxZLSCfromB=new TH1F("hSecVtxZLSCfromB","hSecVtxZ_LooseCuts_FromB",1000,-8.,8.);
3140  TH1F *hSecVtxXLSCfromB=new TH1F("hSecVtxXLSCfromB","hSecVtxX_LooseCuts_FromB",1000,-3000.,3000.);
3141  TH1F *hSecVtxYLSCfromB=new TH1F("hSecVtxYLSCfromB","hSecVtxY_LooseCuts_FromB",1000,-3000.,3000.);
3142  TH2F *hSecVtxXYLSCfromB=new TH2F("hSecVtxXYLSCfromB","hSecVtxXY_LooseCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
3143  TH1F *hSecVtxPhiLSCfromB=new TH1F("hSecVtxPhiLSCfromB","hSecVtxPhi_LooseCuts_FromB",180,-180.1,180.1);
3144  TH1F *hd0singlTrackLSCfromB=new TH1F("hd0singlTrackLSCfromB","hd0singlTrackLooseCuts_FromB",1000,-5000.,5000.);
3145  TH1F *hCPtaLSCfromB=new TH1F("hCPtaLSCfromB","hCPta_LooseCuts_FromB",100,-1.,1.);
3146  TH1F *hd0xd0LSCfromB=new TH1F("hd0xd0LSCfromB","hd0xd0_LooseCuts_FromB",1000,-100000.,100000.);
3147  TH1F *hMassTrueLSCfromB=new TH1F("hMassTrueLSCfromB","D^{0} MC inv. Mass Loose Cuts FromB(All momenta)",600,1.600,2.200);
3148  TH1F *hMassLSCfromB=new TH1F("hMassLSCfromB","D^{0} inv. Mass Loose Cuts FromB (All momenta)",600,1.600,2.200);
3149  hMassLSCfromB->Sumw2();
3150  TH1F *hMassTrueLSCfromBPM=new TH1F("hMassTrueLSCfromBPM","D^{0} MC inv. Mass Loose Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
3151  TH1F *hMassLSCfromBPM=new TH1F("hMassLSCfromBPM","D^{0} inv. Mass Loose Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
3152  hMassLSCfromBPM->Sumw2();
3153  TH1F *hMassTrueLSCfromBSB=new TH1F("hMassTrueLSCfromBSB","D^{0} MC inv. Mass in Side Bands Loose Cuts FromB(All momenta)",600,1.600,2.200);
3154  TH1F *hMassLSCfromBSB=new TH1F("hMassLSCfromBSB","D^{0} inv. Mass in Side Bands Loose Cuts FromB (All momenta)",600,1.600,2.200);
3155  hMassLSCfromBSB->Sumw2();
3156 
3157  flistLsCutsFromB->Add(hCPtaVSd0d0LSCfromB);
3158  flistLsCutsFromB->Add(hSecVtxZLSCfromB);
3159  flistLsCutsFromB->Add(hSecVtxYLSCfromB);
3160  flistLsCutsFromB->Add(hSecVtxXLSCfromB);
3161  flistLsCutsFromB->Add(hSecVtxXYLSCfromB);
3162  flistLsCutsFromB->Add(hSecVtxPhiLSCfromB);
3163  flistLsCutsFromB->Add(hd0singlTrackLSCfromB);
3164  flistLsCutsFromB->Add(hCPtaLSCfromB);
3165  flistLsCutsFromB->Add(hd0xd0LSCfromB);
3166  flistLsCutsFromB->Add(hMassTrueLSCfromB);
3167  flistLsCutsFromB->Add(hMassLSCfromB);
3168  flistLsCutsFromB->Add(hMassTrueLSCfromBPM);
3169  flistLsCutsFromB->Add(hMassLSCfromBPM);
3170  flistLsCutsFromB->Add(hMassTrueLSCfromBSB);
3171  flistLsCutsFromB->Add(hMassLSCfromBSB);
3172 
3173 
3174 
3175 
3176  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
3177  TH1F *hdcaLSCfromB=new TH1F("hdcaLSCfromB","hdca_LooseCuts_FromB",100,0.,1000.);
3178  hdcaLSCfromB->SetXTitle("dca [#mum]");
3179  hdcaLSCfromB->SetYTitle("Entries");
3180  TH1F *hcosthetastarLSCfromB=new TH1F("hcosthetastarLSCfromB","hCosThetaStar_LooseCuts_FromB",50,-1.,1.);
3181  hcosthetastarLSCfromB->SetXTitle("cos #theta^{*}");
3182  hcosthetastarLSCfromB->SetYTitle("Entries");
3183  TH1F *hptD0LSCfromB=new TH1F("hptD0LSCfromB","D^{0} transverse momentum distribution",34,ptbinsD0arr);
3184  hptD0LSCfromB->SetXTitle("p_{t} [GeV/c]");
3185  hptD0LSCfromB->SetYTitle("Entries");
3186  TH1F *hptD0VsMaxPtLSCfromB=new TH1F("hptD0VsMaxPtLSCfromB","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
3187  TH2F *hptD0PTallsqrtLSCfromB=new TH2F("hptD0PTallsqrtLSCfromB","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
3188  TH2F *hptD0PTallLSCfromB=new TH2F("hptD0PTallLSCfromB","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
3189  TH2F *hptD0vsptBLSCfromB=new TH2F("hptD0vsptBLSCfromB","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3190  TH2F *hpD0vspBLSCfromB=new TH2F("hpD0vspBLSCfromB","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3191  TH2F *hptD0vsptcquarkLSCfromB=new TH2F("hptD0vsptcquarkLSCfromB","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3192  TH2F *hpD0vspcquarkLSCfromB=new TH2F("hpD0vspcquarkLSCfromB","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3193  flistLsCutsFromB->Add(hdcaLSCfromB);
3194  flistLsCutsFromB->Add(hcosthetastarLSCfromB);
3195  flistLsCutsFromB->Add(hptD0LSCfromB);
3196  flistLsCutsFromB->Add(hptD0VsMaxPtLSCfromB);
3197  flistLsCutsFromB->Add(hptD0PTallsqrtLSCfromB);
3198  flistLsCutsFromB->Add(hptD0PTallLSCfromB);
3199  flistLsCutsFromB->Add(hptD0vsptBLSCfromB);
3200  flistLsCutsFromB->Add(hpD0vspBLSCfromB);
3201  flistLsCutsFromB->Add(hptD0vsptcquarkLSCfromB);
3202  flistLsCutsFromB->Add(hpD0vspcquarkLSCfromB);
3203 
3204  TH1F *hd0zD0ptLSCfromB;
3205  TH1F *hInvMassD0LSCfromB,*hInvMassD0barLSCfromB;
3206  TH2F *hInvMassPtLSCfromB=new TH2F("hInvMassPtLSCfromB","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
3207 
3208  TH3F *hInvMassPtSelSignOnlyLSCfromB=new TH3F("hInvMassPtSelSignOnlyLSCfromB","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
3209  flistLsCutsFromB->Add(hInvMassPtSelSignOnlyLSCfromB);
3210  TH3F *hInvMassPtSelReflOnlyLSCfromB=new TH3F("hInvMassPtSelReflOnlyLSCfromB","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
3211  flistLsCutsFromB->Add(hInvMassPtSelReflOnlyLSCfromB);
3212 
3213  THnSparseF *hSparseLSCfromB=new THnSparseF("hSparseLSCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
3214  hSparseLSCfromB->SetBinEdges(0,massbins);
3215  hSparseLSCfromB->SetBinEdges(1,massbins);
3216  hSparseLSCfromB->SetBinEdges(2,ptbinsForNsparse);
3217  hSparseLSCfromB->SetBinEdges(3,impparbins);
3218  hSparseLSCfromB->SetBinEdges(4,massHypoBins);
3219  flistLsCutsFromB->Add(hSparseLSCfromB);
3220 
3221  fTreeLSCfromB = new TTree("fTreeLSCfromB","Candidate variables tree");
3223  for(Int_t ivar=0; ivar<nVar; ivar++){
3224  fTreeLSCfromB->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeLSCfromB[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
3225  }
3227 
3228 
3229  THnSparseF *hSparseRecoLSCfromB=new THnSparseF("hSparseRecoLSCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
3230  hSparseRecoLSCfromB->SetBinEdges(0,massbins);
3231  hSparseRecoLSCfromB->SetBinEdges(1,massbins);
3232  hSparseRecoLSCfromB->SetBinEdges(2,ptbinsForNsparse);
3233  hSparseRecoLSCfromB->SetBinEdges(3,impparbins);
3234  hSparseRecoLSCfromB->SetBinEdges(4,massHypoBins);
3235  flistLsCutsFromB->Add(hSparseRecoLSCfromB);
3236 
3237  fTreeRecoLSCfromB = new TTree("fTreeRecoLSCfromB","Candidate variables tree");
3239  for(Int_t ivar=0; ivar<nVar; ivar++){
3240  fTreeRecoLSCfromB->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeRecoLSCfromB[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
3241  }
3243 
3244 
3245  TH1F *hetaLSCfromB;
3246  TH1F *hCosPDPBLSCfromB;
3247  TH1F *hCosPcPDLSCfromB;
3248  flistLsCutsFromB->Add(hInvMassPtLSCfromB);
3249  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3250  TH2F *hd0D0VSd0xd0LSCfromBpt;
3251  TH2F *hangletracksVSd0xd0LSCfromBpt;
3252  TH2F *hangletracksVSd0D0LSCfromBpt;
3253  TH1F *hd0xd0LSCfromBpt;
3254 
3255 
3256  TH2F *hTOFpidLSCfromB=new TH2F("hTOFpidLSCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
3257  flistLsCutsFromB->Add(hTOFpidLSCfromB);
3258 
3259  for(Int_t i=0;i<fnbins;i++){
3260  namehist="hd0zD0ptLSCfromB_pt";
3261  namehist+=i;
3262  titlehist="d0(z) Loose Cuts FromBm ptbin=";
3263  titlehist+=i;
3264  hd0zD0ptLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
3265  hd0zD0ptLSCfromB->SetXTitle("d_{0}(z) [#mum]");
3266  hd0zD0ptLSCfromB->SetYTitle("Entries");
3267  flistLsCutsFromB->Add(hd0zD0ptLSCfromB);
3268 
3269  namehist="hInvMassD0LSCfromB_pt";
3270  namehist+=i;
3271  titlehist="Invariant Mass Loose Cuts FromB ptbin=";
3272  titlehist+=i;
3273  hInvMassD0LSCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3274  hInvMassD0LSCfromB->SetXTitle("Invariant Mass [GeV]");
3275  hInvMassD0LSCfromB->SetYTitle("Entries");
3276  flistLsCutsFromB->Add(hInvMassD0LSCfromB);
3277 
3278  namehist="hInvMassD0barLSCfromB_pt";
3279  namehist+=i;
3280  titlehist="Invariant Mass D0bar Loose Cuts FromB ptbin=";
3281  titlehist+=i;
3282  hInvMassD0barLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3283  hInvMassD0barLSCfromB->SetXTitle("Invariant Mass [GeV]");
3284  hInvMassD0barLSCfromB->SetYTitle("Entries");
3285  flistLsCutsFromB->Add(hInvMassD0barLSCfromB);
3286 
3287  namehist="hetaLSCfromB_pt";
3288  namehist+=i;
3289  titlehist="eta Loose Cuts FromB ptbin=";
3290  titlehist+=i;
3291  hetaLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
3292  hetaLSCfromB->SetXTitle("Pseudorapidity");
3293  hetaLSCfromB->SetYTitle("Entries");
3294  flistLsCutsFromB->Add(hetaLSCfromB);
3295 
3296  namehist="hCosPDPBLSCfromB_pt";
3297  namehist+=i;
3298  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
3299  titlehist+=i;
3300  hCosPDPBLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3301  hCosPDPBLSCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
3302  hCosPDPBLSCfromB->SetYTitle("Entries");
3303  flistLsCutsFromB->Add(hCosPDPBLSCfromB);
3304 
3305  namehist="hCosPcPDLSCfromB_pt";
3306  namehist+=i;
3307  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
3308  titlehist+=i;
3309  hCosPcPDLSCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3310  hCosPcPDLSCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
3311  hCosPcPDLSCfromB->SetYTitle("Entries");
3312  flistLsCutsFromB->Add(hCosPcPDLSCfromB);
3313 
3314  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3315  namehist="hd0xd0LSCfromB_pt";
3316  namehist+=i;
3317  titlehist="d0xd0 Loose Cuts FromB ptbin=";
3318  titlehist+=i;
3319  hd0xd0LSCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
3320  hd0xd0LSCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
3321  hd0xd0LSCfromBpt->SetYTitle("Entries");
3322  flistLsCutsFromB->Add(hd0xd0LSCfromBpt);
3323 
3324 
3325  namehist="hd0D0VSd0xd0LSCfromB_pt";
3326  namehist+=i;
3327  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromB ptbin=";
3328  titlehist+=i;
3329  hd0D0VSd0xd0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
3330  hd0D0VSd0xd0LSCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3331  hd0D0VSd0xd0LSCfromBpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
3332  flistLsCutsFromB->Add(hd0D0VSd0xd0LSCfromBpt);
3333 
3334 
3335  namehist="hangletracksVSd0xd0LSCfromB_pt";
3336  namehist+=i;
3337  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromB ptbin=";
3338  titlehist+=i;
3339  hangletracksVSd0xd0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
3340  hangletracksVSd0xd0LSCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3341  hangletracksVSd0xd0LSCfromBpt->SetYTitle(" angle between K and #p tracks [rad]");
3342  flistLsCutsFromB->Add(hangletracksVSd0xd0LSCfromBpt);
3343 
3344 
3345  namehist="hangletracksVSd0D0LSCfromB_pt";
3346  namehist+=i;
3347  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts FromB ptbin=";
3348  titlehist+=i;
3349  hangletracksVSd0D0LSCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
3350  hangletracksVSd0D0LSCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
3351  hangletracksVSd0D0LSCfromBpt->SetYTitle(" angle between K and #p tracks [rad]");
3352  flistLsCutsFromB->Add(hangletracksVSd0D0LSCfromBpt);
3353 
3354  }
3355  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
3356  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3357 
3358 
3359 
3360 
3361 
3362  // ######### d0 D0 histos ##############
3363  TH1F *hd0D0LSCfromBPM = new TH1F("hd0D0LSCfromBPM","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3364  hd0D0LSCfromBPM->SetXTitle("Impact parameter [#mum]");
3365  hd0D0LSCfromBPM->SetYTitle("Entries");
3366 
3367  TH1F *hd0D0VtxTrueLSCfromBPM = new TH1F("hd0D0VtxTrueLSCfromBPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3368  hd0D0VtxTrueLSCfromBPM->SetXTitle("Impact parameter [#mum]");
3369  hd0D0VtxTrueLSCfromBPM->SetYTitle("Entries");
3370 
3371  TH1F *hMCd0D0LSCfromBPM = new TH1F("hMCd0D0LSCfromBPM","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3372  hMCd0D0LSCfromBPM->SetXTitle("MC Impact parameter [#mum]");
3373  hMCd0D0LSCfromBPM->SetYTitle("Entries");
3374 
3375  TH1F *hd0D0LSCfromBSB = new TH1F("hd0D0LSCfromBSB","D^{0} impact par. plot , Loose Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3376  hd0D0LSCfromBSB->SetXTitle("Impact parameter [#mum]");
3377  hd0D0LSCfromBSB->SetYTitle("Entries");
3378 
3379  TH1F *hd0D0VtxTrueLSCfromBSB = new TH1F("hd0D0VtxTrueLSCfromBSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3380  hd0D0VtxTrueLSCfromBSB->SetXTitle("Impact parameter [#mum]");
3381  hd0D0VtxTrueLSCfromBSB->SetYTitle("Entries");
3382 
3383  TH1F *hMCd0D0LSCfromBSB = new TH1F("hMCd0D0LSCfromBSB","D^{0} impact par. plot, Loose Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
3384  hMCd0D0LSCfromBSB->SetXTitle("MC Impact parameter [#mum]");
3385  hMCd0D0LSCfromBSB->SetYTitle("Entries");
3386 
3387  flistLsCutsFromB->Add(hd0D0LSCfromBPM);
3388  flistLsCutsFromB->Add(hd0D0VtxTrueLSCfromBPM);
3389  flistLsCutsFromB->Add(hMCd0D0LSCfromBPM);
3390  flistLsCutsFromB->Add(hd0D0LSCfromBSB);
3391  flistLsCutsFromB->Add(hd0D0VtxTrueLSCfromBSB);
3392  flistLsCutsFromB->Add(hMCd0D0LSCfromBSB);
3393 
3394  TH1F *hd0D0ptLSCfromBPM;
3395  TH1F *hMCd0D0ptLSCfromBPM;
3396  TH1F *hd0D0VtxTrueptLSCfromBPM;
3397  TH1F *hd0D0ptLSCfromBSB;
3398  TH1F *hMCd0D0ptLSCfromBSB;
3399  TH1F *hd0D0VtxTrueptLSCfromBSB;
3400  namehist="hd0D0ptLSCfromB_";
3401  titlehist="D^{0} impact par. plot, Loose Cuts, FromB, ";
3402  for(Int_t i=0;i<fnbins;i++){
3403  strnamept=namehist;
3404  strnamept.Append("PkMss_pt");
3405  strnamept+=i;
3406 
3407  strtitlept=titlehist;
3408  strtitlept.Append(" Mass Peak, ");
3409  strtitlept+=fptbins[i];
3410  strtitlept.Append("<= pt <");
3411  strtitlept+=fptbins[i+1];
3412  strtitlept.Append(" [GeV/c]");
3413 
3414  hd0D0ptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3415  hd0D0ptLSCfromBPM->SetXTitle("Impact parameter [#mum] ");
3416  hd0D0ptLSCfromBPM->SetYTitle("Entries");
3417  flistLsCutsFromB->Add(hd0D0ptLSCfromBPM);
3418 
3419  strnamept.ReplaceAll("hd0D0","hMCd0D0");
3420  hMCd0D0ptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3421  hMCd0D0ptLSCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
3422  hMCd0D0ptLSCfromBPM->SetYTitle("Entries");
3423  flistLsCutsFromB->Add(hMCd0D0ptLSCfromBPM);
3424 
3425 
3426  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3427  hd0D0VtxTrueptLSCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3428  hd0D0VtxTrueptLSCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3429  hd0D0VtxTrueptLSCfromBPM->SetYTitle("Entries");
3430  flistLsCutsFromB->Add(hd0D0VtxTrueptLSCfromBPM);
3431 
3432  strnamept=namehist;
3433  strnamept.Append("SBMss_pt");
3434  strnamept+=i;
3435 
3436  strtitlept=titlehist;
3437  strtitlept.Append(" Side Bands, ");
3438  strtitlept+=fptbins[i];
3439  strtitlept.Append("<= pt <");
3440  strtitlept+=fptbins[i+1];
3441  strtitlept.Append(" [GeV/c]");
3442 
3443  hd0D0ptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3444  hd0D0ptLSCfromBSB->SetXTitle("Impact parameter [#mum] ");
3445  hd0D0ptLSCfromBSB->SetYTitle("Entries");
3446  flistLsCutsFromB->Add(hd0D0ptLSCfromBSB);
3447 
3448  strnamept.ReplaceAll("hd0D0","hMCd0D0");
3449  hMCd0D0ptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3450  hMCd0D0ptLSCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
3451  hMCd0D0ptLSCfromBSB->SetYTitle("Entries");
3452  flistLsCutsFromB->Add(hMCd0D0ptLSCfromBSB);
3453 
3454  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3455  hd0D0VtxTrueptLSCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3456  hd0D0VtxTrueptLSCfromBSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3457  hd0D0VtxTrueptLSCfromBSB->SetYTitle("Entries");
3458  flistLsCutsFromB->Add(hd0D0VtxTrueptLSCfromBSB);
3459  }
3460 
3461 
3462 
3463  //############ LOOSE CUTS FROM DSTAR HISTOGRAMS ###########
3464  //
3465  //############## global properties histos
3466  TH2F *hCPtaVSd0d0LSCfromDstar=new TH2F("hCPtaVSd0d0LSCfromDstar","hCPtaVSd0d0_LooseCuts_FromDStar",1000,-100000.,100000.,100,-1.,1.);
3467  TH1F *hSecVtxZLSCfromDstar=new TH1F("hSecVtxZLSCfromDstar","hSecVtxZ_LooseCuts_FromDStar",1000,-8.,8.);
3468  TH1F *hSecVtxXLSCfromDstar=new TH1F("hSecVtxXLSCfromDstar","hSecVtxX_LooseCuts_FromDStar",1000,-3000.,3000.);
3469  TH1F *hSecVtxYLSCfromDstar=new TH1F("hSecVtxYLSCfromDstar","hSecVtxY_LooseCuts_FromDStar",1000,-3000.,3000.);
3470  TH2F *hSecVtxXYLSCfromDstar=new TH2F("hSecVtxXYLSCfromDstar","hSecVtxXY_LooseCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
3471  TH1F *hSecVtxPhiLSCfromDstar=new TH1F("hSecVtxPhiLSCfromDstar","hSecVtxPhi_LooseCuts_FromDStar",180,-180.1,180.1);
3472  TH1F *hd0singlTrackLSCfromDstar=new TH1F("hd0singlTrackLSCfromDstar","hd0singlTrackLooseCuts_FromDstar",1000,-5000.,5000.);
3473  TH1F *hCPtaLSCfromDstar=new TH1F("hCPtaLSCfromDstar","hCPta_LooseCuts_FromDStar",100,-1.,1.);
3474  TH1F *hd0xd0LSCfromDstar=new TH1F("hd0xd0LSCfromDstar","hd0xd0_LooseCuts_FromDStar",1000,-100000.,100000.);
3475  TH1F *hMassTrueLSCfromDstar=new TH1F("hMassTrueLSCfromDstar","D^{0} MC inv. Mass Loose Cuts FromDStar(All momenta)",600,1.600,2.200);
3476  TH1F *hMassLSCfromDstar=new TH1F("hMassLSCfromDstar","D^{0} inv. Mass Loose Cuts FromDStar (All momenta)",600,1.600,2.200);
3477  hMassLSCfromDstar->Sumw2();
3478  TH1F *hMassTrueLSCfromDstarPM=new TH1F("hMassTrueLSCfromDstarPM","D^{0} MC inv. Mass Loose Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
3479  TH1F *hMassLSCfromDstarPM=new TH1F("hMassLSCfromDstarPM","D^{0} inv. Mass Loose Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
3480  hMassLSCfromDstarPM->Sumw2();
3481  TH1F *hMassTrueLSCfromDstarSB=new TH1F("hMassTrueLSCfromDstarSB","D^{0} MC inv. Mass in Side Bands Loose Cuts FromDStar(All momenta)",600,1.600,2.200);
3482  TH1F *hMassLSCfromDstarSB=new TH1F("hMassLSCfromDstarSB","D^{0} inv. Mass in Side Bands Loose Cuts FromDStar (All momenta)",600,1.600,2.200);
3483  hMassLSCfromDstarSB->Sumw2();
3484 
3485  flistLsCutsFromDstar->Add(hCPtaVSd0d0LSCfromDstar);
3486  flistLsCutsFromDstar->Add(hSecVtxZLSCfromDstar);
3487  flistLsCutsFromDstar->Add(hSecVtxYLSCfromDstar);
3488  flistLsCutsFromDstar->Add(hSecVtxXLSCfromDstar);
3489  flistLsCutsFromDstar->Add(hSecVtxXYLSCfromDstar);
3490  flistLsCutsFromDstar->Add(hSecVtxPhiLSCfromDstar);
3491  flistLsCutsFromDstar->Add(hd0singlTrackLSCfromDstar);
3492  flistLsCutsFromDstar->Add(hCPtaLSCfromDstar);
3493  flistLsCutsFromDstar->Add(hd0xd0LSCfromDstar);
3494  flistLsCutsFromDstar->Add(hMassTrueLSCfromDstar);
3495  flistLsCutsFromDstar->Add(hMassLSCfromDstar);
3496  flistLsCutsFromDstar->Add(hMassTrueLSCfromDstarPM);
3497  flistLsCutsFromDstar->Add(hMassLSCfromDstarPM);
3498  flistLsCutsFromDstar->Add(hMassTrueLSCfromDstarSB);
3499  flistLsCutsFromDstar->Add(hMassLSCfromDstarSB);
3500 
3501 
3502 
3503 
3504 
3505 
3506 
3507  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
3508  TH1F *hdcaLSCfromDstar=new TH1F("hdcaLSCfromDstar","hdca_LooseCuts_FromDstar",100,0.,1000.);
3509  hdcaLSCfromDstar->SetXTitle("dca [#mum]");
3510  hdcaLSCfromDstar->SetYTitle("Entries");
3511  TH1F *hcosthetastarLSCfromDstar=new TH1F("hcosthetastarLSCfromDstar","hCosThetaStar_LooseCuts_FromDstar",50,-1.,1.);
3512  hcosthetastarLSCfromDstar->SetXTitle("cos #theta^{*}");
3513  hcosthetastarLSCfromDstar->SetYTitle("Entries");
3514  TH1F *hptD0LSCfromDstar=new TH1F("hptD0LSCfromDstar","D^{0} transverse momentum distribution",34,ptbinsD0arr);
3515  hptD0LSCfromDstar->SetXTitle("p_{t} [GeV/c]");
3516  hptD0LSCfromDstar->SetYTitle("Entries");
3517  TH1F *hptD0VsMaxPtLSCfromDstar=new TH1F("hptD0VsMaxPtLSCfromDstar","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
3518  TH2F *hptD0PTallsqrtLSCfromDstar=new TH2F("hptD0PTallsqrtLSCfromDstar","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
3519  TH2F *hptD0PTallLSCfromDstar=new TH2F("hptD0PTallLSCfromDstar","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
3520  TH2F *hptD0vsptBLSCfromDstar=new TH2F("hptD0vsptBLSCfromDstar","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3521  TH2F *hpD0vspBLSCfromDstar=new TH2F("hpD0vspBLSCfromDstar","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3522  TH2F *hptD0vsptcquarkLSCfromDstar=new TH2F("hptD0vsptcquarkLSCfromDstar","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3523  TH2F *hpD0vspcquarkLSCfromDstar=new TH2F("hpD0vspcquarkLSCfromDstar","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3524  flistLsCutsFromDstar->Add(hdcaLSCfromDstar);
3525  flistLsCutsFromDstar->Add(hcosthetastarLSCfromDstar);
3526  flistLsCutsFromDstar->Add(hptD0LSCfromDstar);
3527  flistLsCutsFromDstar->Add(hptD0VsMaxPtLSCfromDstar);
3528  flistLsCutsFromDstar->Add(hptD0PTallsqrtLSCfromDstar);
3529  flistLsCutsFromDstar->Add(hptD0PTallLSCfromDstar);
3530  flistLsCutsFromDstar->Add(hptD0vsptBLSCfromDstar);
3531  flistLsCutsFromDstar->Add(hpD0vspBLSCfromDstar);
3532  flistLsCutsFromDstar->Add(hptD0vsptcquarkLSCfromDstar);
3533  flistLsCutsFromDstar->Add(hpD0vspcquarkLSCfromDstar);
3534 
3535  TH1F *hd0zD0ptLSCfromDstar;
3536  TH1F *hInvMassD0LSCfromDstar,*hInvMassD0barLSCfromDstar;
3537  TH2F *hInvMassPtLSCfromDstar=new TH2F("hInvMassPtLSCfromDstar","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
3538  TH3F *hInvMassPtSelSignOnlyLSCfromDstar=new TH3F("hInvMassPtSelSignOnlyLSCfromDstar","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
3539  flistLsCutsFromDstar->Add(hInvMassPtSelSignOnlyLSCfromDstar);
3540  TH3F *hInvMassPtSelReflOnlyLSCfromDstar=new TH3F("hInvMassPtSelReflOnlyLSCfromDstar","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
3541  flistLsCutsFromDstar->Add(hInvMassPtSelReflOnlyLSCfromDstar);
3542 
3543  THnSparseF *hSparseLSCfromDstar=new THnSparseF("hSparseLSCfromDstar","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
3544  hSparseLSCfromDstar->SetBinEdges(0,massbins);
3545  hSparseLSCfromDstar->SetBinEdges(1,massbins);
3546  hSparseLSCfromDstar->SetBinEdges(2,ptbinsForNsparse);
3547  hSparseLSCfromDstar->SetBinEdges(3,impparbins);
3548  hSparseLSCfromDstar->SetBinEdges(4,massHypoBins);
3549  flistLsCutsFromDstar->Add(hSparseLSCfromDstar);
3550 
3551  fTreeLSCfromDstar = new TTree("fTreeLSCfromDstar","Candidate variables tree");
3553  for(Int_t ivar=0; ivar<nVar; ivar++){
3554  fTreeLSCfromDstar->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeLSCfromDstar[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
3555  }
3557 
3558  TH1F *hetaLSCfromDstar;
3559  TH1F *hCosPDPBLSCfromDstar;
3560  TH1F *hCosPcPDLSCfromDstar;
3561  flistLsCutsFromDstar->Add(hInvMassPtLSCfromDstar);
3562  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3563  TH2F *hd0D0VSd0xd0LSCfromDstarpt;
3564  TH2F *hangletracksVSd0xd0LSCfromDstarpt;
3565  TH2F *hangletracksVSd0D0LSCfromDstarpt;
3566  TH1F *hd0xd0LSCfromDstarpt;
3567 
3568  TH2F *hTOFpidLSCfromDstar=new TH2F("hTOFpidLSCfromDstar","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
3569  flistLsCutsFromDstar->Add(hTOFpidLSCfromDstar);
3570 
3571  for(Int_t i=0;i<fnbins;i++){
3572  namehist="hd0zD0ptLSCfromDstar_pt";
3573  namehist+=i;
3574  titlehist="d0(z) Loose Cuts FromDstarm ptbin=";
3575  titlehist+=i;
3576  hd0zD0ptLSCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
3577  hd0zD0ptLSCfromDstar->SetXTitle("d_{0}(z) [#mum]");
3578  hd0zD0ptLSCfromDstar->SetYTitle("Entries");
3579  flistLsCutsFromDstar->Add(hd0zD0ptLSCfromDstar);
3580 
3581  namehist="hInvMassD0LSCfromDstar_pt";
3582  namehist+=i;
3583  titlehist="Invariant Mass Loose Cuts FromDstar ptbin=";
3584  titlehist+=i;
3585  hInvMassD0LSCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3586  hInvMassD0LSCfromDstar->SetXTitle("Invariant Mass [GeV]");
3587  hInvMassD0LSCfromDstar->SetYTitle("Entries");
3588  flistLsCutsFromDstar->Add(hInvMassD0LSCfromDstar);
3589 
3590  namehist="hInvMassD0barLSCfromDstar_pt";
3591  namehist+=i;
3592  titlehist="Invariant Mass D0bar Loose Cuts FromDstar ptbin=";
3593  titlehist+=i;
3594  hInvMassD0barLSCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3595  hInvMassD0barLSCfromDstar->SetXTitle("Invariant Mass [GeV]");
3596  hInvMassD0barLSCfromDstar->SetYTitle("Entries");
3597  flistLsCutsFromDstar->Add(hInvMassD0barLSCfromDstar);
3598 
3599  namehist="hetaLSCfromDstar_pt";
3600  namehist+=i;
3601  titlehist="eta Loose Cuts FromDstar ptbin=";
3602  titlehist+=i;
3603  hetaLSCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
3604  hetaLSCfromDstar->SetXTitle("Pseudorapidity");
3605  hetaLSCfromDstar->SetYTitle("Entries");
3606  flistLsCutsFromDstar->Add(hetaLSCfromDstar);
3607 
3608  namehist="hCosPDPBLSCfromDstar_pt";
3609  namehist+=i;
3610  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
3611  titlehist+=i;
3612  hCosPDPBLSCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3613  hCosPDPBLSCfromDstar->SetXTitle("Cosine between D0 momentum and B momentum");
3614  hCosPDPBLSCfromDstar->SetYTitle("Entries");
3615  flistLsCutsFromDstar->Add(hCosPDPBLSCfromDstar);
3616 
3617  namehist="hCosPcPDLSCfromDstar_pt";
3618  namehist+=i;
3619  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
3620  titlehist+=i;
3621  hCosPcPDLSCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3622  hCosPcPDLSCfromDstar->SetXTitle("Cosine between c quark momentum and D0 momentum");
3623  hCosPcPDLSCfromDstar->SetYTitle("Entries");
3624  flistLsCutsFromDstar->Add(hCosPcPDLSCfromDstar);
3625 
3626  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3627  namehist="hd0xd0LSCfromDstar_pt";
3628  namehist+=i;
3629  titlehist="d0xd0 Loose Cuts FromDstar ptbin=";
3630  titlehist+=i;
3631  hd0xd0LSCfromDstarpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
3632  hd0xd0LSCfromDstarpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
3633  hd0xd0LSCfromDstarpt->SetYTitle("Entries");
3634  flistLsCutsFromDstar->Add(hd0xd0LSCfromDstarpt);
3635 
3636 
3637  namehist="hd0D0VSd0xd0LSCfromDstar_pt";
3638  namehist+=i;
3639  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromDstar ptbin=";
3640  titlehist+=i;
3641  hd0D0VSd0xd0LSCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
3642  hd0D0VSd0xd0LSCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3643  hd0D0VSd0xd0LSCfromDstarpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
3644  flistLsCutsFromDstar->Add(hd0D0VSd0xd0LSCfromDstarpt);
3645 
3646 
3647  namehist="hangletracksVSd0xd0LSCfromDstar_pt";
3648  namehist+=i;
3649  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts FromDstar ptbin=";
3650  titlehist+=i;
3651  hangletracksVSd0xd0LSCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
3652  hangletracksVSd0xd0LSCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3653  hangletracksVSd0xd0LSCfromDstarpt->SetYTitle(" angle between K and #p tracks [rad]");
3654  flistLsCutsFromDstar->Add(hangletracksVSd0xd0LSCfromDstarpt);
3655 
3656 
3657  namehist="hangletracksVSd0D0LSCfromDstar_pt";
3658  namehist+=i;
3659  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts FromDstar ptbin=";
3660  titlehist+=i;
3661  hangletracksVSd0D0LSCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
3662  hangletracksVSd0D0LSCfromDstarpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
3663  hangletracksVSd0D0LSCfromDstarpt->SetYTitle(" angle between K and #p tracks [rad]");
3664  flistLsCutsFromDstar->Add(hangletracksVSd0D0LSCfromDstarpt);
3665 
3666 
3667  }
3668  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
3669  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3670 
3671 
3672 
3673 
3674 
3675 
3676  //########## d0 D0 histos #############
3677  TH1F *hd0D0LSCfromDstPM = new TH1F("hd0D0LSCfromDstarPM","D^{0} impact par. plot , Loose Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
3678  hd0D0LSCfromDstPM->SetXTitle("Impact parameter [#mum]");
3679  hd0D0LSCfromDstPM->SetYTitle("Entries");
3680 
3681  TH1F *hd0D0VtxTrueLSCfromDstPM = new TH1F("hd0D0VtxTrueLSCfromDstarPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
3682  hd0D0VtxTrueLSCfromDstPM->SetXTitle("Impact parameter [#mum]");
3683  hd0D0VtxTrueLSCfromDstPM->SetYTitle("Entries");
3684 
3685  TH1F *hMCd0D0LSCfromDstPM = new TH1F("hMCd0D0LSCfromDstarPM","D^{0} impact par. plot, Loose Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
3686  hMCd0D0LSCfromDstPM->SetXTitle("MC Impact parameter [#mum]");
3687  hMCd0D0LSCfromDstPM->SetYTitle("Entries");
3688 
3689  TH1F *hd0D0LSCfromDstSB = new TH1F("hd0D0LSCfromDstarSB","D^{0} impact par. plot , Loose Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
3690  hd0D0LSCfromDstSB->SetXTitle("Impact parameter [#mum]");
3691  hd0D0LSCfromDstSB->SetYTitle("Entries");
3692 
3693  TH1F *hd0D0VtxTrueLSCfromDstSB = new TH1F("hd0D0VtxTrueLSCfromDstarSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
3694  hd0D0VtxTrueLSCfromDstSB->SetXTitle("Impact parameter [#mum]");
3695  hd0D0VtxTrueLSCfromDstSB->SetYTitle("Entries");
3696 
3697  TH1F *hMCd0D0LSCfromDstSB = new TH1F("hMCd0D0LSCfromDstarSB","D^{0} impact par. plot, Loose Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
3698  hMCd0D0LSCfromDstSB->SetXTitle("MC Impact parameter [#mum]");
3699  hMCd0D0LSCfromDstSB->SetYTitle("Entries");
3700 
3701  flistLsCutsFromDstar->Add(hd0D0LSCfromDstPM);
3702  flistLsCutsFromDstar->Add(hd0D0VtxTrueLSCfromDstPM);
3703  flistLsCutsFromDstar->Add(hMCd0D0LSCfromDstPM);
3704  flistLsCutsFromDstar->Add(hd0D0LSCfromDstSB);
3705  flistLsCutsFromDstar->Add(hd0D0VtxTrueLSCfromDstSB);
3706  flistLsCutsFromDstar->Add(hMCd0D0LSCfromDstSB);
3707 
3708  TH1F *hd0D0ptLSCfromDstPM;
3709  TH1F *hMCd0D0ptLSCfromDstPM;
3710  TH1F *hd0D0VtxTrueptLSCfromDstPM;
3711  TH1F *hd0D0ptLSCfromDstSB;
3712  TH1F *hMCd0D0ptLSCfromDstSB;
3713  TH1F *hd0D0VtxTrueptLSCfromDstSB;
3714  namehist="hd0D0ptLSCfromDstar_";
3715  titlehist="D^{0} impact par. plot, Loose Cuts, FromDStar, ";
3716  for(Int_t i=0;i<fnbins;i++){
3717  strnamept=namehist;
3718  strnamept.Append("PkMss_pt");
3719  strnamept+=i;
3720 
3721  strtitlept=titlehist;
3722  strtitlept.Append(" Mass Peak, ");
3723  strtitlept+=fptbins[i];
3724  strtitlept.Append("<= pt <");
3725  strtitlept+=fptbins[i+1];
3726  strtitlept.Append(" [GeV/c]");
3727 
3728  hd0D0ptLSCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3729  hd0D0ptLSCfromDstPM->SetXTitle("Impact parameter [#mum] ");
3730  hd0D0ptLSCfromDstPM->SetYTitle("Entries");
3731  flistLsCutsFromDstar->Add(hd0D0ptLSCfromDstPM);
3732 
3733  strnamept.ReplaceAll("hd0D0","hMCd0D0");
3734  hMCd0D0ptLSCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3735  hMCd0D0ptLSCfromDstPM->SetXTitle("MC Impact parameter [#mum] ");
3736  hMCd0D0ptLSCfromDstPM->SetYTitle("Entries");
3737  flistLsCutsFromDstar->Add(hMCd0D0ptLSCfromDstPM);
3738 
3739 
3740  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3741  hd0D0VtxTrueptLSCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3742  hd0D0VtxTrueptLSCfromDstPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3743  hd0D0VtxTrueptLSCfromDstPM->SetYTitle("Entries");
3744  flistLsCutsFromDstar->Add(hd0D0VtxTrueptLSCfromDstPM);
3745 
3746  strnamept=namehist;
3747  strnamept.Append("SBMss_pt");
3748  strnamept+=i;
3749 
3750  strtitlept=titlehist;
3751  strtitlept.Append(" Side Bands, ");
3752  strtitlept+=fptbins[i];
3753  strtitlept.Append("<= pt <");
3754  strtitlept+=fptbins[i+1];
3755  strtitlept.Append(" [GeV/c]");
3756 
3757  hd0D0ptLSCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3758  hd0D0ptLSCfromDstSB->SetXTitle("Impact parameter [#mum] ");
3759  hd0D0ptLSCfromDstSB->SetYTitle("Entries");
3760  flistLsCutsFromDstar->Add(hd0D0ptLSCfromDstSB);
3761 
3762  strnamept.ReplaceAll("hd0D0","hMCd0D0");
3763  hMCd0D0ptLSCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3764  hMCd0D0ptLSCfromDstSB->SetXTitle("MC Impact parameter [#mum] ");
3765  hMCd0D0ptLSCfromDstSB->SetYTitle("Entries");
3766  flistLsCutsFromDstar->Add(hMCd0D0ptLSCfromDstSB);
3767 
3768  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
3769  hd0D0VtxTrueptLSCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
3770  hd0D0VtxTrueptLSCfromDstSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
3771  hd0D0VtxTrueptLSCfromDstSB->SetYTitle("Entries");
3772  flistLsCutsFromDstar->Add(hd0D0VtxTrueptLSCfromDstSB);
3773  }
3774 
3775 
3776  //############ LOOSE CUTS OTHER HISTOGRAMS ###########
3777  //
3778  //########### global properties histos ###########
3779 
3780  TH2F *hCPtaVSd0d0LSCother=new TH2F("hCPtaVSd0d0LSCother","hCPtaVSd0d0_LooseCuts_other",1000,-100000.,100000.,100,-1.,1.);
3781  TH1F *hSecVtxZLSCother=new TH1F("hSecVtxZLSCother","hSecVtxZ_LooseCuts_other",1000,-8.,8.);
3782  TH1F *hSecVtxXLSCother=new TH1F("hSecVtxXLSCother","hSecVtxX_LooseCuts_other",1000,-3000.,3000.);
3783  TH1F *hSecVtxYLSCother=new TH1F("hSecVtxYLSCother","hSecVtxY_LooseCuts_other",1000,-3000.,3000.);
3784  TH2F *hSecVtxXYLSCother=new TH2F("hSecVtxXYLSCother","hSecVtxXY_LooseCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
3785  TH1F *hSecVtxPhiLSCother=new TH1F("hSecVtxPhiLSCother","hSecVtxPhi_LooseCuts_other",180,-180.1,180.1);
3786  TH1F *hd0singlTrackLSCother=new TH1F("hd0singlTrackLSCother","hd0singlTrackLooseCuts_Other",1000,-5000.,5000.);
3787  TH1F *hCPtaLSCother=new TH1F("hCPtaLSCother","hCPta_LooseCuts_other",100,-1.,1.);
3788  TH1F *hd0xd0LSCother=new TH1F("hd0xd0LSCother","hd0xd0_LooseCuts_other",1000,-100000.,100000.);
3789  TH1F *hMassTrueLSCother=new TH1F("hMassTrueLSCother","D^{0} MC inv. Mass Loose Cuts other(All momenta)",600,1.600,2.200);
3790  TH1F *hMassLSCother=new TH1F("hMassLSCother","D^{0} inv. Mass Loose Cuts other (All momenta)",600,1.600,2.200);
3791  hMassLSCother->Sumw2();
3792  TH1F *hMassTrueLSCotherPM=new TH1F("hMassTrueLSCotherPM","D^{0} MC inv. Mass Loose Cuts other, Mass Peak. (All momenta)",600,1.600,2.200);
3793  TH1F *hMassLSCotherPM=new TH1F("hMassLSCotherPM","D^{0} inv. Mass Loose Cuts other (All momenta), MassPeak",600,1.600,2.200);
3794  hMassLSCotherPM->Sumw2();
3795  TH1F *hMassTrueLSCotherSB=new TH1F("hMassTrueLSCotherSB","D^{0} MC inv. Mass in Side Bands Loose Cuts other(All momenta)",600,1.600,2.200);
3796  TH1F *hMassLSCotherSB=new TH1F("hMassLSCotherSB","D^{0} inv. Mass in Side Bands Loose Cuts other (All momenta)",600,1.600,2.200);
3797  hMassLSCotherSB->Sumw2();
3798 
3799  flistLsCutsOther->Add(hCPtaVSd0d0LSCother);
3800  flistLsCutsOther->Add(hSecVtxZLSCother);
3801  flistLsCutsOther->Add(hSecVtxYLSCother);
3802  flistLsCutsOther->Add(hSecVtxXLSCother);
3803  flistLsCutsOther->Add(hSecVtxXYLSCother);
3804  flistLsCutsOther->Add(hSecVtxPhiLSCother);
3805  flistLsCutsOther->Add(hd0singlTrackLSCother);
3806  flistLsCutsOther->Add(hCPtaLSCother);
3807  flistLsCutsOther->Add(hd0xd0LSCother);
3808  flistLsCutsOther->Add(hMassTrueLSCother);
3809  flistLsCutsOther->Add(hMassLSCother);
3810  flistLsCutsOther->Add(hMassTrueLSCotherPM);
3811  flistLsCutsOther->Add(hMassLSCotherPM);
3812  flistLsCutsOther->Add(hMassTrueLSCotherSB);
3813  flistLsCutsOther->Add(hMassLSCotherSB);
3814 
3815 
3816 
3817 
3818  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
3819  TH1F *hdcaLSCother=new TH1F("hdcaLSCother","hdca_LooseCuts_Other",100,0.,1000.);
3820  hdcaLSCother->SetXTitle("dca [#mum]");
3821  hdcaLSCother->SetYTitle("Entries");
3822  TH1F *hcosthetastarLSCother=new TH1F("hcosthetastarLSCother","hCosThetaStar_LooseCuts_Other",50,-1.,1.);
3823  hcosthetastarLSCother->SetXTitle("cos #theta^{*}");
3824  hcosthetastarLSCother->SetYTitle("Entries");
3825  TH1F *hptD0LSCother=new TH1F("hptD0LSCother","D^{0} transverse momentum distribution",34,ptbinsD0arr);
3826  hptD0LSCother->SetXTitle("p_{t} [GeV/c]");
3827  hptD0LSCother->SetYTitle("Entries");
3828  TH1F *hptD0VsMaxPtLSCother=new TH1F("hptD0VsMaxPtLSCother","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
3829  TH2F *hptD0PTallsqrtLSCother=new TH2F("hptD0PTallsqrtLSCother","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
3830  TH2F *hptD0PTallLSCother=new TH2F("hptD0PTallLSCother","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
3831  TH2F *hptD0vsptBLSCother=new TH2F("hptD0vsptBLSCother","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3832  TH2F *hpD0vspBLSCother=new TH2F("hpD0vspBLSCother","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3833  TH2F *hptD0vsptcquarkLSCother=new TH2F("hptD0vsptcquarkLSCother","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3834  TH2F *hpD0vspcquarkLSCother=new TH2F("hpD0vspcquarkLSCother","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
3835  flistLsCutsOther->Add(hdcaLSCother);
3836  flistLsCutsOther->Add(hcosthetastarLSCother);
3837  flistLsCutsOther->Add(hptD0LSCother);
3838  flistLsCutsOther->Add(hptD0VsMaxPtLSCother);
3839  flistLsCutsOther->Add(hptD0PTallsqrtLSCother);
3840  flistLsCutsOther->Add(hptD0PTallLSCother);
3841  flistLsCutsOther->Add(hptD0vsptBLSCother);
3842  flistLsCutsOther->Add(hpD0vspBLSCother);
3843  flistLsCutsOther->Add(hptD0vsptcquarkLSCother);
3844  flistLsCutsOther->Add(hpD0vspcquarkLSCother);
3845 
3846  TH1F *hd0zD0ptLSCother;
3847  TH1F *hInvMassD0LSCother,*hInvMassD0barLSCother;
3848  TH2F *hInvMassPtLSCother=new TH2F("hInvMassPtLSCother","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
3849  THnSparseF *hSparseLSCother=new THnSparseF("hSparseLSCother","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
3850  hSparseLSCother->SetBinEdges(0,massbins);
3851  hSparseLSCother->SetBinEdges(1,massbins);
3852  hSparseLSCother->SetBinEdges(2,ptbinsForNsparse);
3853  hSparseLSCother->SetBinEdges(3,impparbins);
3854  hSparseLSCother->SetBinEdges(4,massHypoBins);
3855  flistLsCutsOther->Add(hSparseLSCother);
3856  TH1F *hetaLSCother;
3857  TH1F *hCosPDPBLSCother;
3858  TH1F *hCosPcPDLSCother;
3859  flistLsCutsOther->Add(hInvMassPtLSCother);
3860 
3861  fTreeLSCother = new TTree("fTreeLSCother","Candidate variables tree");
3863  for(Int_t ivar=0; ivar<nVar; ivar++){
3864  fTreeLSCother->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeLSCother[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
3865  }
3867 
3868  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3869  TH2F *hd0D0VSd0xd0LSCotherpt;
3870  TH2F *hangletracksVSd0xd0LSCotherpt;
3871  TH2F *hangletracksVSd0D0LSCotherpt;
3872  TH1F *hd0xd0LSCotherpt;
3873 
3874  TH2F *hTOFpidLSCother=new TH2F("hTOFpidLSCother","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
3875  flistLsCutsOther->Add(hTOFpidLSCother);
3876 
3877  for(Int_t i=0;i<fnbins;i++){
3878  namehist="hd0zD0ptLSCother_pt";
3879  namehist+=i;
3880  titlehist="d0(z) Loose Cuts Otherm ptbin=";
3881  titlehist+=i;
3882  hd0zD0ptLSCother=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
3883  hd0zD0ptLSCother->SetXTitle("d_{0}(z) [#mum]");
3884  hd0zD0ptLSCother->SetYTitle("Entries");
3885  flistLsCutsOther->Add(hd0zD0ptLSCother);
3886 
3887  namehist="hInvMassD0LSCother_pt";
3888  namehist+=i;
3889  titlehist="Invariant Mass Loose Cuts Other ptbin=";
3890  titlehist+=i;
3891  hInvMassD0LSCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3892  hInvMassD0LSCother->SetXTitle("Invariant Mass [GeV]");
3893  hInvMassD0LSCother->SetYTitle("Entries");
3894  flistLsCutsOther->Add(hInvMassD0LSCother);
3895 
3896  namehist="hInvMassD0barLSCother_pt";
3897  namehist+=i;
3898  titlehist="Invariant Mass D0bar Loose Cuts Other ptbin=";
3899  titlehist+=i;
3900  hInvMassD0barLSCother=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
3901  hInvMassD0barLSCother->SetXTitle("Invariant Mass [GeV]");
3902  hInvMassD0barLSCother->SetYTitle("Entries");
3903  flistLsCutsOther->Add(hInvMassD0barLSCother);
3904 
3905  namehist="hetaLSCother_pt";
3906  namehist+=i;
3907  titlehist="eta Loose Cuts Other ptbin=";
3908  titlehist+=i;
3909  hetaLSCother=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
3910  hetaLSCother->SetXTitle("Pseudorapidity");
3911  hetaLSCother->SetYTitle("Entries");
3912  flistLsCutsOther->Add(hetaLSCother);
3913 
3914  namehist="hCosPDPBLSCother_pt";
3915  namehist+=i;
3916  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
3917  titlehist+=i;
3918  hCosPDPBLSCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3919  hCosPDPBLSCother->SetXTitle("Cosine between D0 momentum and B momentum");
3920  hCosPDPBLSCother->SetYTitle("Entries");
3921  flistLsCutsOther->Add(hCosPDPBLSCother);
3922 
3923  namehist="hCosPcPDLSCother_pt";
3924  namehist+=i;
3925  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
3926  titlehist+=i;
3927  hCosPcPDLSCother=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
3928  hCosPcPDLSCother->SetXTitle("Cosine between c quark momentum and D0 momentum");
3929  hCosPcPDLSCother->SetYTitle("Entries");
3930  flistLsCutsOther->Add(hCosPcPDLSCother);
3931 
3932  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
3933  namehist="hd0xd0LSCother_pt";
3934  namehist+=i;
3935  titlehist="d0xd0 Loose Cuts Other ptbin=";
3936  titlehist+=i;
3937  hd0xd0LSCotherpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
3938  hd0xd0LSCotherpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
3939  hd0xd0LSCotherpt->SetYTitle("Entries");
3940  flistLsCutsOther->Add(hd0xd0LSCotherpt);
3941 
3942 
3943  namehist="hd0D0VSd0xd0LSCother_pt";
3944  namehist+=i;
3945  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Other ptbin=";
3946  titlehist+=i;
3947  hd0D0VSd0xd0LSCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
3948  hd0D0VSd0xd0LSCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3949  hd0D0VSd0xd0LSCotherpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
3950  flistLsCutsOther->Add(hd0D0VSd0xd0LSCotherpt);
3951 
3952 
3953  namehist="hangletracksVSd0xd0LSCother_pt";
3954  namehist+=i;
3955  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Loose Cuts Other ptbin=";
3956  titlehist+=i;
3957  hangletracksVSd0xd0LSCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
3958  hangletracksVSd0xd0LSCotherpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
3959  hangletracksVSd0xd0LSCotherpt->SetYTitle(" angle between K and #p tracks [rad]");
3960  flistLsCutsOther->Add(hangletracksVSd0xd0LSCotherpt);
3961 
3962 
3963  namehist="hangletracksVSd0D0LSCother_pt";
3964  namehist+=i;
3965  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Loose Cuts Other ptbin=";
3966  titlehist+=i;
3967  hangletracksVSd0D0LSCotherpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
3968  hangletracksVSd0D0LSCotherpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
3969  hangletracksVSd0D0LSCotherpt->SetYTitle(" angle between K and #p tracks [rad]");
3970  flistLsCutsOther->Add(hangletracksVSd0D0LSCotherpt);
3971 
3972 
3973  }
3974  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
3975  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3976 
3977 
3978 
3979  //############# d0 D0 histos ###############à
3980  TH1F *hd0D0LSCotherPM = new TH1F("hd0D0LSCotherPM","D^{0} impact par. plot , Loose Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
3981  hd0D0LSCotherPM->SetXTitle("Impact parameter [#mum]");
3982  hd0D0LSCotherPM->SetYTitle("Entries");
3983 
3984  TH1F *hd0D0VtxTrueLSCotherPM = new TH1F("hd0D0VtxTrueLSCotherPM","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
3985  hd0D0VtxTrueLSCotherPM->SetXTitle("Impact parameter [#mum]");
3986  hd0D0VtxTrueLSCotherPM->SetYTitle("Entries");
3987 
3988  TH1F *hMCd0D0LSCotherPM = new TH1F("hMCd0D0LSCotherPM","D^{0} impact par. plot, Loose Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
3989  hMCd0D0LSCotherPM->SetXTitle("MC Impact parameter [#mum]");
3990  hMCd0D0LSCotherPM->SetYTitle("Entries");
3991 
3992  TH1F *hd0D0LSCotherSB = new TH1F("hd0D0LSCotherSB","D^{0} impact par. plot , Loose Cuts ,Other,Mass Peak (All momenta)",1000,-1000.,1000.);
3993  hd0D0LSCotherSB->SetXTitle("Impact parameter [#mum]");
3994  hd0D0LSCotherSB->SetYTitle("Entries");
3995 
3996  TH1F *hd0D0VtxTrueLSCotherSB = new TH1F("hd0D0VtxTrueLSCotherSB","D^{0} impact par. w.r.t. True Vtx, Loose Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
3997  hd0D0VtxTrueLSCotherSB->SetXTitle("Impact parameter [#mum]");
3998  hd0D0VtxTrueLSCotherSB->SetYTitle("Entries");
3999 
4000  TH1F *hMCd0D0LSCotherSB = new TH1F("hMCd0D0LSCotherSB","D^{0} impact par. plot, Loose Cuts, Other,Mass Peak (All momenta)",1000,-1000.,1000.);
4001  hMCd0D0LSCotherSB->SetXTitle("MC Impact parameter [#mum]");
4002  hMCd0D0LSCotherSB->SetYTitle("Entries");
4003 
4004  flistLsCutsOther->Add(hd0D0LSCotherPM);
4005  flistLsCutsOther->Add(hd0D0VtxTrueLSCotherPM);
4006  flistLsCutsOther->Add(hMCd0D0LSCotherPM);
4007  flistLsCutsOther->Add(hd0D0LSCotherSB);
4008  flistLsCutsOther->Add(hd0D0VtxTrueLSCotherSB);
4009  flistLsCutsOther->Add(hMCd0D0LSCotherSB);
4010 
4011  TH1F *hd0D0ptLSCotherPM;
4012  TH1F *hMCd0D0ptLSCotherPM;
4013  TH1F *hd0D0VtxTrueptLSCotherPM;
4014  TH1F *hd0D0ptLSCotherSB;
4015  TH1F *hMCd0D0ptLSCotherSB;
4016  TH1F *hd0D0VtxTrueptLSCotherSB;
4017  namehist="hd0D0ptLSCother_";
4018  titlehist="D^{0} impact par. plot, Loose Cuts, Other, ";
4019  for(Int_t i=0;i<fnbins;i++){
4020  strnamept=namehist;
4021  strnamept.Append("PkMss_pt");
4022  strnamept+=i;
4023 
4024  strtitlept=titlehist;
4025  strtitlept.Append(" Mass Peak, ");
4026  strtitlept+=fptbins[i];
4027  strtitlept.Append("<= pt <");
4028  strtitlept+=fptbins[i+1];
4029  strtitlept.Append(" [GeV/c]");
4030 
4031  hd0D0ptLSCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4032  hd0D0ptLSCotherPM->SetXTitle("Impact parameter [#mum] ");
4033  hd0D0ptLSCotherPM->SetYTitle("Entries");
4034  flistLsCutsOther->Add(hd0D0ptLSCotherPM);
4035 
4036  strnamept.ReplaceAll("hd0D0","hMCd0D0");
4037  hMCd0D0ptLSCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4038  hMCd0D0ptLSCotherPM->SetXTitle("MC Impact parameter [#mum] ");
4039  hMCd0D0ptLSCotherPM->SetYTitle("Entries");
4040  flistLsCutsOther->Add(hMCd0D0ptLSCotherPM);
4041 
4042 
4043  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
4044  hd0D0VtxTrueptLSCotherPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4045  hd0D0VtxTrueptLSCotherPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
4046  hd0D0VtxTrueptLSCotherPM->SetYTitle("Entries");
4047  flistLsCutsOther->Add(hd0D0VtxTrueptLSCotherPM);
4048 
4049  strnamept=namehist;
4050  strnamept.Append("SBMss_pt");
4051  strnamept+=i;
4052 
4053  strtitlept=titlehist;
4054  strtitlept.Append(" Side Bands, ");
4055  strtitlept+=fptbins[i];
4056  strtitlept.Append("<= pt <");
4057  strtitlept+=fptbins[i+1];
4058  strtitlept.Append(" [GeV/c]");
4059 
4060  hd0D0ptLSCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4061  hd0D0ptLSCotherSB->SetXTitle("Impact parameter [#mum] ");
4062  hd0D0ptLSCotherSB->SetYTitle("Entries");
4063  flistLsCutsOther->Add(hd0D0ptLSCotherSB);
4064 
4065  strnamept.ReplaceAll("hd0D0","hMCd0D0");
4066  hMCd0D0ptLSCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4067  hMCd0D0ptLSCotherSB->SetXTitle("MC Impact parameter [#mum] ");
4068  hMCd0D0ptLSCotherSB->SetYTitle("Entries");
4069  flistLsCutsOther->Add(hMCd0D0ptLSCotherSB);
4070 
4071  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
4072  hd0D0VtxTrueptLSCotherSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4073  hd0D0VtxTrueptLSCotherSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
4074  hd0D0VtxTrueptLSCotherSB->SetYTitle("Entries");
4075  flistLsCutsOther->Add(hd0D0VtxTrueptLSCotherSB);
4076  }
4077 
4078  //Printf("END OF LSCUTS HISTOS CREATION \n");
4079 
4080 
4081  //################################################################################################
4082  // #
4083  // HISTOS FOR TIGHT CUTS #
4084  // #
4085  //################################################################################################
4086 
4087  //############ TIGHT CUTS SIGNAL HISTOGRAMS ###############
4088  //
4089  // ####### global properties histo ############
4090 
4091  TH2F *hCPtaVSd0d0TGHCsign=new TH2F("hCPtaVSd0d0TGHCsign","hCPtaVSd0d0_TightCuts_Signal",1000,-100000.,100000.,100,-1.,1.);
4092  TH1F *hSecVtxZTGHCsign=new TH1F("hSecVtxZTGHCsign","hSecVtxZ_TightCuts_Signal",1000,-8.,8.);
4093  TH1F *hSecVtxXTGHCsign=new TH1F("hSecVtxXTGHCsign","hSecVtxX_TightCuts_Signal",1000,-3000.,3000.);
4094  TH1F *hSecVtxYTGHCsign=new TH1F("hSecVtxYTGHCsign","hSecVtxY_TightCuts_Signal",1000,-3000.,3000.);
4095  TH2F *hSecVtxXYTGHCsign=new TH2F("hSecVtxXYTGHCsign","hSecVtxXY_TightCuts_Signal",1000,-3000.,3000.,1000,-3000.,3000.);
4096  TH1F *hSecVtxPhiTGHCsign=new TH1F("hSecVtxPhiTGHCsign","hSecVtxPhi_TightCuts_Signal",180,-180.1,180.1);
4097  TH1F *hd0singlTrackTGHCsign=new TH1F("hd0singlTrackTGHCsign","hd0singlTrackTightCuts_Signal",1000,-5000.,5000.);
4098  TH1F *hCPtaTGHCsign=new TH1F("hCPtaTGHCsign","hCPta_TightCuts_Signal",100,-1.,1.);
4099  TH1F *hd0xd0TGHCsign=new TH1F("hd0xd0TGHCsign","hd0xd0_TightCuts_Signal",1000,-100000.,100000.);
4100  TH1F *hMassTrueTGHCsign=new TH1F("hMassTrueTGHCsign","D^{0} MC inv. Mass Tight Cuts Signal(All momenta)",600,1.600,2.200);
4101  TH1F *hMassTGHCsign=new TH1F("hMassTGHCsign","D^{0} inv. Mass Tight Cuts Signal (All momenta)",600,1.600,2.200);
4102  hMassTGHCsign->Sumw2();
4103  TH1F *hMassTrueTGHCsignPM=new TH1F("hMassTrueTGHCsignPM","D^{0} MC inv. Mass Tight Cuts Signal, Mass Peak. (All momenta)",600,1.600,2.200);
4104  TH1F *hMassTGHCsignPM=new TH1F("hMassTGHCsignPM","D^{0} inv. Mass Tight Cuts Signal (All momenta), MassPeak",600,1.600,2.200);
4105  hMassTGHCsignPM->Sumw2();
4106  TH1F *hMassTrueTGHCsignSB=new TH1F("hMassTrueTGHCsignSB","D^{0} MC inv. Mass in Side Bands Tight Cuts Signal(All momenta)",600,1.600,2.200);
4107  TH1F *hMassTGHCsignSB=new TH1F("hMassTGHCsignSB","D^{0} inv. Mass in Side Bands Tight Cuts Signal (All momenta)",600,1.600,2.200);
4108  hMassTGHCsignSB->Sumw2();
4109 
4110  flistTghCutsSignal->Add(hCPtaVSd0d0TGHCsign);
4111  flistTghCutsSignal->Add(hSecVtxZTGHCsign);
4112  flistTghCutsSignal->Add(hSecVtxYTGHCsign);
4113  flistTghCutsSignal->Add(hSecVtxXTGHCsign);
4114  flistTghCutsSignal->Add(hSecVtxXYTGHCsign);
4115  flistTghCutsSignal->Add(hSecVtxPhiTGHCsign);
4116  flistTghCutsSignal->Add(hd0singlTrackTGHCsign);
4117  flistTghCutsSignal->Add(hCPtaTGHCsign);
4118  flistTghCutsSignal->Add(hd0xd0TGHCsign);
4119  flistTghCutsSignal->Add(hMassTrueTGHCsign);
4120  flistTghCutsSignal->Add(hMassTGHCsign);
4121  flistTghCutsSignal->Add(hMassTrueTGHCsignPM);
4122  flistTghCutsSignal->Add(hMassTGHCsignPM);
4123  flistTghCutsSignal->Add(hMassTrueTGHCsignSB);
4124 
4125 flistTghCutsSignal->Add(hMassTGHCsignSB);
4126 
4127 
4128 
4129 
4130 
4131 
4132  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
4133  TH1F *hdcaTGHCsign=new TH1F("hdcaTGHCsign","hdca_TightCuts_Signal",100,0.,1000.);
4134  hdcaTGHCsign->SetXTitle("dca [#mum]");
4135  hdcaTGHCsign->SetYTitle("Entries");
4136  TH1F *hcosthetastarTGHCsign=new TH1F("hcosthetastarTGHCsign","hCosThetaStar_TightCuts_Signal",50,-1.,1.);
4137  hcosthetastarTGHCsign->SetXTitle("cos #theta^{*}");
4138  hcosthetastarTGHCsign->SetYTitle("Entries");
4139  TH1F *hptD0TGHCsign=new TH1F("hptD0TGHCsign","D^{0} transverse momentum distribution",34,ptbinsD0arr);
4140  hptD0TGHCsign->SetXTitle("p_{t} [GeV/c]");
4141  hptD0TGHCsign->SetYTitle("Entries");
4142  TH1F *hptD0VsMaxPtTGHCsign=new TH1F("hptD0VsMaxPtTGHCsign","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
4143  TH2F *hptD0PTallsqrtTGHCsign=new TH2F("hptD0PTallsqrtTGHCsign","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
4144  TH2F *hptD0PTallTGHCsign=new TH2F("hptD0PTallTGHCsign","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
4145  TH2F *hptD0vsptBTGHCsign=new TH2F("hptD0vsptBTGHCsign","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4146  TH2F *hpD0vspBTGHCsign=new TH2F("hpD0vspBTGHCsign","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4147  TH2F *hptD0vsptcquarkTGHCsign=new TH2F("hptD0vsptcquarkTGHCsign","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4148  TH2F *hpD0vspcquarkTGHCsign=new TH2F("hpD0vspcquarkTGHCsign","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4149  flistTghCutsSignal->Add(hdcaTGHCsign);
4150  flistTghCutsSignal->Add(hcosthetastarTGHCsign);
4151  flistTghCutsSignal->Add(hptD0TGHCsign);
4152  flistTghCutsSignal->Add(hptD0VsMaxPtTGHCsign);
4153  flistTghCutsSignal->Add(hptD0PTallsqrtTGHCsign);
4154  flistTghCutsSignal->Add(hptD0PTallTGHCsign);
4155  flistTghCutsSignal->Add(hptD0vsptBTGHCsign);
4156  flistTghCutsSignal->Add(hpD0vspBTGHCsign);
4157  flistTghCutsSignal->Add(hptD0vsptcquarkTGHCsign);
4158  flistTghCutsSignal->Add(hpD0vspcquarkTGHCsign);
4159 
4160  TH1F *hd0zD0ptTGHCsign;
4161  TH1F *hInvMassD0TGHCsign,*hInvMassD0barTGHCsign;
4162  TH2F *hInvMassPtTGHCsign=new TH2F("hInvMassPtTGHCsign","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
4163  TH3F *hInvMassPtSelSignOnlyTGHCsign=new TH3F("hInvMassPtSelSignOnlyTGHCsign","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
4164  flistTghCutsSignal->Add(hInvMassPtSelSignOnlyTGHCsign);
4165  TH3F *hInvMassPtSelReflOnlyTGHCsign=new TH3F("hInvMassPtSelReflOnlyTGHCsign","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
4166  flistTghCutsSignal->Add(hInvMassPtSelReflOnlyTGHCsign);
4167 
4168 
4169  THnSparseF *hSparseTGHCsign=new THnSparseF("hSparseTGHCsign","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
4170  hSparseTGHCsign->SetBinEdges(0,massbins);
4171  hSparseTGHCsign->SetBinEdges(1,massbins);
4172  hSparseTGHCsign->SetBinEdges(2,ptbinsForNsparse);
4173  hSparseTGHCsign->SetBinEdges(3,impparbins);
4174  hSparseTGHCsign->SetBinEdges(4,massHypoBins);
4175  flistTghCutsSignal->Add(hSparseTGHCsign);
4176 
4177  fTreeTGHCsign = new TTree("fTreeTGHCsign","Candidate variables tree");
4179  for(Int_t ivar=0; ivar<nVar; ivar++){
4180  fTreeTGHCsign->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeTGHCsign[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
4181  }
4183 
4184 
4185 
4186  THnSparseF *hSparseCxyLxyTGHCsign=new THnSparseF("hSparseCxyLxyTGHCsign","Candidate Mass;massD0;Pt;CosXY;Lxy",4,nbinsSparsCxyLxy,binLowLimitSparseCxyLxy,binUpLimitSparseCxyLxy);
4187  hSparseCxyLxyTGHCsign->SetBinEdges(1,ptbinlimitsCxyLxy);
4188  hSparseCxyLxyTGHCsign->GetAxis(0)->SetName("mass");
4189  hSparseCxyLxyTGHCsign->GetAxis(0)->SetTitle("Invariant Mass (K#pi) [GeV/c^{2}]");
4190  hSparseCxyLxyTGHCsign->GetAxis(1)->SetName("pt");
4191  hSparseCxyLxyTGHCsign->GetAxis(1)->SetTitle("p_{t} [GeV/c]");
4192  hSparseCxyLxyTGHCsign->GetAxis(2)->SetName("CosPointXY");
4193  hSparseCxyLxyTGHCsign->GetAxis(2)->SetTitle("Cos#theta_{point}^{XY}");
4194  hSparseCxyLxyTGHCsign->GetAxis(3)->SetName("NormDecLengthXY");
4195  hSparseCxyLxyTGHCsign->GetAxis(3)->SetTitle("Normalized XY decay length");
4196  flistTghCutsSignal->Add(hSparseCxyLxyTGHCsign);
4197 
4198 
4199  TH1F *hetaTGHCsign;
4200  TH1F *hCosPDPBTGHCsign;
4201  TH1F *hCosPcPDTGHCsign;
4202  flistTghCutsSignal->Add(hInvMassPtTGHCsign);
4203 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
4204  TH2F *hd0D0VSd0xd0TGHCsignpt;
4205  TH2F *hangletracksVSd0xd0TGHCsignpt;
4206  TH2F *hangletracksVSd0D0TGHCsignpt;
4207  TH1F *hd0xd0TGHCsignpt;
4208  TH1F *hPhiHistPMTGHCsignpt,*hPhiHistSBTGHCsignpt;
4209 
4210  TH2F *hTOFpidTGHCsign=new TH2F("hTOFpidTGHCsign","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
4211  flistTghCutsSignal->Add(hTOFpidTGHCsign);
4212 
4213  for(Int_t i=0;i<fnbins;i++){
4214  // Printf("INSIDE FIRST LOOP FOR TIGHT CUTS HISTO CREATION %d\n", fnbins);
4215  namehist="hPhiHistPMTGHCsign_pt";
4216  namehist+=i;
4217  titlehist="Azimuthal correlation TGH Cuts Sign PM ptbin=";
4218  titlehist+=i;
4219  hPhiHistPMTGHCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
4220  hPhiHistPMTGHCsignpt->Sumw2();
4221  flistTghCutsSignal->Add(hPhiHistPMTGHCsignpt);
4222 
4223  namehist="hPhiHistSBTGHCsign_pt";
4224  namehist+=i;
4225  titlehist="Azimuthal correlation TGH Cuts Sign SB ptbin=";
4226  titlehist+=i;
4227  hPhiHistSBTGHCsignpt=new TH1F(namehist.Data(),titlehist.Data(),100,-3.15,3.15);
4228  hPhiHistSBTGHCsignpt->Sumw2();
4229  flistTghCutsSignal->Add(hPhiHistSBTGHCsignpt);
4230 
4231  namehist="hd0zD0ptTGHCsign_pt";
4232  namehist+=i;
4233  titlehist="d0(z) Tight Cuts Signal ptbin=";
4234  titlehist+=i;
4235  hd0zD0ptTGHCsign=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
4236  hd0zD0ptTGHCsign->SetXTitle("d_{0}(z) [#mum]");
4237  hd0zD0ptTGHCsign->SetYTitle("Entries");
4238  flistTghCutsSignal->Add(hd0zD0ptTGHCsign);
4239 
4240  namehist="hInvMassD0TGHCsign_pt";
4241  namehist+=i;
4242  titlehist="Invariant Mass Tight Cuts Signal ptbin=";
4243  titlehist+=i;
4244  hInvMassD0TGHCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
4245  hInvMassD0TGHCsign->SetXTitle("Invariant Mass [GeV]");
4246  hInvMassD0TGHCsign->SetYTitle("Entries");
4247  flistTghCutsSignal->Add(hInvMassD0TGHCsign);
4248 
4249  namehist="hInvMassD0barTGHCsign_pt";
4250  namehist+=i;
4251  titlehist="Invariant Mass D0bar Tight Cuts Signal ptbin=";
4252  titlehist+=i;
4253  hInvMassD0barTGHCsign=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
4254  hInvMassD0barTGHCsign->SetXTitle("Invariant Mass [GeV]");
4255  hInvMassD0barTGHCsign->SetYTitle("Entries");
4256  flistTghCutsSignal->Add(hInvMassD0barTGHCsign);
4257 
4258 
4259  namehist="hetaTGHCsign_pt";
4260  namehist+=i;
4261  titlehist="eta Tight Cuts Signal ptbin=";
4262  titlehist+=i;
4263  hetaTGHCsign=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
4264  hetaTGHCsign->SetXTitle("Pseudorapidity");
4265  hetaTGHCsign->SetYTitle("Entries");
4266  flistTghCutsSignal->Add(hetaTGHCsign);
4267 
4268  namehist="hCosPDPBTGHCsign_pt";
4269  namehist+=i;
4270  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
4271  titlehist+=i;
4272  hCosPDPBTGHCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
4273  hCosPDPBTGHCsign->SetXTitle("Cosine between D0 momentum and B momentum");
4274  hCosPDPBTGHCsign->SetYTitle("Entries");
4275  flistTghCutsSignal->Add(hCosPDPBTGHCsign);
4276 
4277  namehist="hCosPcPDTGHCsign_pt";
4278  namehist+=i;
4279  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
4280  titlehist+=i;
4281  hCosPcPDTGHCsign=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
4282  hCosPcPDTGHCsign->SetXTitle("Cosine between c quark momentum and D0 momentum");
4283  hCosPcPDTGHCsign->SetYTitle("Entries");
4284  flistTghCutsSignal->Add(hCosPcPDTGHCsign);
4285 
4286  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
4287  namehist="hd0xd0TGHCsign_pt";
4288  namehist+=i;
4289  titlehist="d0xd0 Tight Cuts Signal ptbin=";
4290  titlehist+=i;
4291  hd0xd0TGHCsignpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
4292  hd0xd0TGHCsignpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
4293  hd0xd0TGHCsignpt->SetYTitle("Entries");
4294  flistTghCutsSignal->Add(hd0xd0TGHCsignpt);
4295 
4296 
4297  namehist="hd0D0VSd0xd0TGHCsign_pt";
4298  namehist+=i;
4299  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts Signal ptbin=";
4300  titlehist+=i;
4301  hd0D0VSd0xd0TGHCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
4302  hd0D0VSd0xd0TGHCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
4303  hd0D0VSd0xd0TGHCsignpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
4304  flistTghCutsSignal->Add(hd0D0VSd0xd0TGHCsignpt);
4305 
4306 
4307  namehist="hangletracksVSd0xd0TGHCsign_pt";
4308  namehist+=i;
4309  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts Signal ptbin=";
4310  titlehist+=i;
4311  hangletracksVSd0xd0TGHCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
4312  hangletracksVSd0xd0TGHCsignpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
4313  hangletracksVSd0xd0TGHCsignpt->SetYTitle(" angle between K and #p tracks [rad]");
4314  flistTghCutsSignal->Add(hangletracksVSd0xd0TGHCsignpt);
4315 
4316 
4317  namehist="hangletracksVSd0D0TGHCsign_pt";
4318  namehist+=i;
4319  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Tight Cuts Signal ptbin=";
4320  titlehist+=i;
4321  hangletracksVSd0D0TGHCsignpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
4322  hangletracksVSd0D0TGHCsignpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
4323  hangletracksVSd0D0TGHCsignpt->SetYTitle(" angle between K and #p tracks [rad]");
4324  flistTghCutsSignal->Add(hangletracksVSd0D0TGHCsignpt);
4325 
4326  }
4327  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
4328  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4329 
4330 
4331 
4332 
4333 
4334 
4335 
4336 
4337  // ####### d0 D0 histos ############
4338  TH1F *hd0D0TGHCsignPM = new TH1F("hd0D0TGHCsignPM","D^{0} impact par. plot , Tight Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
4339  hd0D0TGHCsignPM->SetXTitle("Impact parameter [#mum]");
4340  hd0D0TGHCsignPM->SetYTitle("Entries");
4341 
4342  TH1F *hd0D0VtxTrueTGHCsignPM = new TH1F("hd0D0VtxTrueTGHCsignPM","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
4343  hd0D0VtxTrueTGHCsignPM->SetXTitle("Impact parameter [#mum]");
4344  hd0D0VtxTrueTGHCsignPM->SetYTitle("Entries");
4345 
4346  TH1F *hMCd0D0TGHCsignPM = new TH1F("hMCd0D0TGHCsignPM","D^{0} impact par. plot, Tight Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
4347  hMCd0D0TGHCsignPM->SetXTitle("MC Impact parameter [#mum]");
4348  hMCd0D0TGHCsignPM->SetYTitle("Entries");
4349 
4350  TH1F *hd0D0TGHCsignSB = new TH1F("hd0D0TGHCsignSB","D^{0} impact par. plot , Tight Cuts ,Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
4351  hd0D0TGHCsignSB->SetXTitle("Impact parameter [#mum]");
4352  hd0D0TGHCsignSB->SetYTitle("Entries");
4353 
4354  TH1F *hd0D0VtxTrueTGHCsignSB = new TH1F("hd0D0VtxTrueTGHCsignSB","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
4355  hd0D0VtxTrueTGHCsignSB->SetXTitle("Impact parameter [#mum]");
4356  hd0D0VtxTrueTGHCsignSB->SetYTitle("Entries");
4357 
4358  TH1F *hMCd0D0TGHCsignSB = new TH1F("hMCd0D0TGHCsignSB","D^{0} impact par. plot, Tight Cuts, Signal,Mass Peak (All momenta)",1000,-1000.,1000.);
4359  hMCd0D0TGHCsignSB->SetXTitle("MC Impact parameter [#mum]");
4360  hMCd0D0TGHCsignSB->SetYTitle("Entries");
4361 
4362  flistTghCutsSignal->Add(hd0D0TGHCsignPM);
4363  flistTghCutsSignal->Add(hd0D0VtxTrueTGHCsignPM);
4364  flistTghCutsSignal->Add(hMCd0D0TGHCsignPM);
4365  flistTghCutsSignal->Add(hd0D0TGHCsignSB);
4366  flistTghCutsSignal->Add(hd0D0VtxTrueTGHCsignSB);
4367  flistTghCutsSignal->Add(hMCd0D0TGHCsignSB);
4368 
4369  TH1F *hd0D0ptTGHCsignPM;
4370  TH1F *hMCd0D0ptTGHCsignPM;
4371  TH1F *hd0D0VtxTrueptTGHCsignPM;
4372  TH1F *hd0D0ptTGHCsignSB;
4373  TH1F *hMCd0D0ptTGHCsignSB;
4374  TH1F *hd0D0VtxTrueptTGHCsignSB;
4375  namehist="hd0D0ptTGHCsign_";
4376  titlehist="D^{0} impact par. plot, Tight Cuts, Signal, ";
4377  for(Int_t i=0;i<fnbins;i++){
4378  strnamept=namehist;
4379  strnamept.Append("PkMss_pt");
4380  strnamept+=i;
4381 
4382  strtitlept=titlehist;
4383  strtitlept.Append(" Mass Peak, ");
4384  strtitlept+=fptbins[i];
4385  strtitlept.Append("<= pt <");
4386  strtitlept+=fptbins[i+1];
4387  strtitlept.Append(" [GeV/c]");
4388 
4389  hd0D0ptTGHCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4390  hd0D0ptTGHCsignPM->SetXTitle("Impact parameter [#mum] ");
4391  hd0D0ptTGHCsignPM->SetYTitle("Entries");
4392  flistTghCutsSignal->Add(hd0D0ptTGHCsignPM);
4393 
4394  strnamept.ReplaceAll("hd0D0","hMCd0D0");
4395  hMCd0D0ptTGHCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4396  hMCd0D0ptTGHCsignPM->SetXTitle("MC Impact parameter [#mum] ");
4397  hMCd0D0ptTGHCsignPM->SetYTitle("Entries");
4398  flistTghCutsSignal->Add(hMCd0D0ptTGHCsignPM);
4399 
4400 
4401  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
4402  hd0D0VtxTrueptTGHCsignPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4403  hd0D0VtxTrueptTGHCsignPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
4404  hd0D0VtxTrueptTGHCsignPM->SetYTitle("Entries");
4405  flistTghCutsSignal->Add(hd0D0VtxTrueptTGHCsignPM);
4406 
4407  strnamept=namehist;
4408  strnamept.Append("SBMss_pt");
4409  strnamept+=i;
4410 
4411  strtitlept=titlehist;
4412  strtitlept.Append(" Side Bands, ");
4413  strtitlept+=fptbins[i];
4414  strtitlept.Append("<= pt <");
4415  strtitlept+=fptbins[i+1];
4416  strtitlept.Append(" [GeV/c]");
4417 
4418  hd0D0ptTGHCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4419  hd0D0ptTGHCsignSB->SetXTitle("Impact parameter [#mum] ");
4420  hd0D0ptTGHCsignSB->SetYTitle("Entries");
4421  flistTghCutsSignal->Add(hd0D0ptTGHCsignSB);
4422 
4423  strnamept.ReplaceAll("hd0D0","hMCd0D0");
4424  hMCd0D0ptTGHCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4425  hMCd0D0ptTGHCsignSB->SetXTitle("MC Impact parameter [#mum] ");
4426  hMCd0D0ptTGHCsignSB->SetYTitle("Entries");
4427  flistTghCutsSignal->Add(hMCd0D0ptTGHCsignSB);
4428 
4429  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
4430  hd0D0VtxTrueptTGHCsignSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4431  hd0D0VtxTrueptTGHCsignSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
4432  hd0D0VtxTrueptTGHCsignSB->SetYTitle("Entries");
4433  flistTghCutsSignal->Add(hd0D0VtxTrueptTGHCsignSB);
4434  }
4435 
4436 
4437  //############ TIGHT CUTS BACKGROUND HISTOGRAMS ###########
4438  //
4439  // ######## global properties histos #######
4440  TH2F *hCPtaVSd0d0TGHCback=new TH2F("hCPtaVSd0d0TGHCback","hCPtaVSd0d0_TightCuts_Background",1000,-100000.,100000.,100,-1.,1.);
4441  TH1F *hSecVtxZTGHCback=new TH1F("hSecVtxZTGHCback","hSecVtxZ_TightCuts_Background",1000,-8.,8.);
4442  TH1F *hSecVtxXTGHCback=new TH1F("hSecVtxXTGHCback","hSecVtxX_TightCuts_Background",1000,-3000.,3000.);
4443  TH1F *hSecVtxYTGHCback=new TH1F("hSecVtxYTGHCback","hSecVtxY_TightCuts_Background",1000,-3000.,3000.);
4444  TH2F *hSecVtxXYTGHCback=new TH2F("hSecVtxXYTGHCback","hSecVtxXY_TightCuts_Background",1000,-3000.,3000.,1000,-3000.,3000.);
4445  TH1F *hSecVtxPhiTGHCback=new TH1F("hSecVtxPhiTGHCback","hSecVtxPhi_TightCuts_Background",180,-180.1,180.1);
4446  TH1F *hd0singlTrackTGHCback=new TH1F("hd0singlTrackTGHCback","hd0singlTrackTightCuts_Back",1000,-5000.,5000.);
4447  TH1F *hCPtaTGHCback=new TH1F("hCPtaTGHCback","hCPta_TightCuts_Background",100,-1.,1.);
4448  TH1F *hd0xd0TGHCback=new TH1F("hd0xd0TGHCback","hd0xd0_TightCuts_Background",1000,-100000.,100000.);
4449  TH1F *hMassTrueTGHCback=new TH1F("hMassTrueTGHCback","D^{0} MC inv. Mass Tight Cuts Background(All momenta)",600,1.600,2.200);
4450  TH1F *hMassTGHCback=new TH1F("hMassTGHCback","D^{0} inv. Mass Tight Cuts Background (All momenta)",600,1.600,2.200);
4451  hMassTGHCback->Sumw2();
4452  TH1F *hMassTrueTGHCbackPM=new TH1F("hMassTrueTGHCbackPM","D^{0} MC inv. Mass Tight Cuts Background, Mass Peak. (All momenta)",600,1.600,2.200);
4453  TH1F *hMassTGHCbackPM=new TH1F("hMassTGHCbackPM","D^{0} inv. Mass Tight Cuts Background (All momenta), MassPeak",600,1.600,2.200);
4454  hMassTGHCbackPM->Sumw2();
4455  TH1F *hMassTrueTGHCbackSB=new TH1F("hMassTrueTGHCbackSB","D^{0} MC inv. Mass in Side Bands Tight Cuts Backgrround(All momenta)",600,1.600,2.200);
4456  TH1F *hMassTGHCbackSB=new TH1F("hMassTGHCbackSB","D^{0} inv. Mass in Side Bands Tight Cuts Background (All momenta)",600,1.600,2.200);
4457  hMassTGHCbackSB->Sumw2();
4458 
4459  flistTghCutsBack->Add(hCPtaVSd0d0TGHCback);
4460  flistTghCutsBack->Add(hSecVtxZTGHCback);
4461  flistTghCutsBack->Add(hSecVtxYTGHCback);
4462  flistTghCutsBack->Add(hSecVtxXTGHCback);
4463  flistTghCutsBack->Add(hSecVtxXYTGHCback);
4464  flistTghCutsBack->Add(hSecVtxPhiTGHCback);
4465  flistTghCutsBack->Add(hd0singlTrackTGHCback);
4466  flistTghCutsBack->Add(hCPtaTGHCback);
4467  flistTghCutsBack->Add(hd0xd0TGHCback);
4468  flistTghCutsBack->Add(hMassTrueTGHCback);
4469  flistTghCutsBack->Add(hMassTGHCback);
4470  flistTghCutsBack->Add(hMassTrueTGHCbackPM);
4471  flistTghCutsBack->Add(hMassTGHCbackPM);
4472  flistTghCutsBack->Add(hMassTrueTGHCbackSB);
4473  flistTghCutsBack->Add(hMassTGHCbackSB);
4474 
4475 
4476 
4477 
4478 
4479 
4480 
4481  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
4482  TH1F *hdcaTGHCback=new TH1F("hdcaTGHCback","hdca_TightCuts_Backgr",100,0.,1000.);
4483  hdcaTGHCback->SetXTitle("dca [#mum]");
4484  hdcaTGHCback->SetYTitle("Entries");
4485  TH1F *hcosthetastarTGHCback=new TH1F("hcosthetastarTGHCback","hCosThetaStar_TightCuts_Backgr",50,-1.,1.);
4486  hcosthetastarTGHCback->SetXTitle("cos #theta^{*}");
4487  hcosthetastarTGHCback->SetYTitle("Entries");
4488  TH1F *hptD0TGHCback=new TH1F("hptD0TGHCback","D^{0} transverse momentum distribution",34,ptbinsD0arr);
4489  hptD0TGHCback->SetXTitle("p_{t} [GeV/c]");
4490  hptD0TGHCback->SetYTitle("Entries");
4491  TH1F *hptD0VsMaxPtTGHCback=new TH1F("hptD0VsMaxPtTGHCback","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
4492  TH2F *hptD0PTallsqrtTGHCback=new TH2F("hptD0PTallsqrtTGHCback","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
4493  TH2F *hptD0PTallTGHCback=new TH2F("hptD0PTallTGHCback","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
4494  TH2F *hptD0vsptBTGHCback=new TH2F("hptD0vsptBTGHCback","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4495  TH2F *hpD0vspBTGHCback=new TH2F("hpD0vspBTGHCback","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4496  TH2F *hptD0vsptcquarkTGHCback=new TH2F("hptD0vsptcquarkTGHCback","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4497  TH2F *hpD0vspcquarkTGHCback=new TH2F("hpD0vspcquarkTGHCback","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4498  flistTghCutsBack->Add(hdcaTGHCback);
4499  flistTghCutsBack->Add(hcosthetastarTGHCback);
4500  flistTghCutsBack->Add(hptD0TGHCback);
4501  flistTghCutsBack->Add(hptD0VsMaxPtTGHCback);
4502  flistTghCutsBack->Add(hptD0PTallsqrtTGHCback);
4503  flistTghCutsBack->Add(hptD0PTallTGHCback);
4504  flistTghCutsBack->Add(hptD0vsptBTGHCback);
4505  flistTghCutsBack->Add(hpD0vspBTGHCback);
4506  flistTghCutsBack->Add(hptD0vsptcquarkTGHCback);
4507  flistTghCutsBack->Add(hpD0vspcquarkTGHCback);
4508 
4509  TH1F *hd0zD0ptTGHCback;
4510  TH1F *hInvMassD0TGHCback,*hInvMassD0barTGHCback;
4511  TH2F *hInvMassPtTGHCback=new TH2F("hInvMassPtTGHCback","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
4512  THnSparseF *hSparseTGHCback=new THnSparseF("hSparseTGHCback","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
4513  hSparseTGHCback->SetBinEdges(0,massbins);
4514  hSparseTGHCback->SetBinEdges(1,massbins);
4515  hSparseTGHCback->SetBinEdges(2,ptbinsForNsparse);
4516  hSparseTGHCback->SetBinEdges(3,impparbins);
4517  hSparseTGHCback->SetBinEdges(4,massHypoBins);
4518  flistTghCutsBack->Add(hSparseTGHCback);
4519 
4520 
4521  fTreeTGHCback = new TTree("fTreeTGHCback","Candidate variables tree");
4523  for(Int_t ivar=0; ivar<nVar; ivar++){
4524  fTreeTGHCback->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeTGHCback[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
4525  }
4527 
4528 
4529  TH1F *hetaTGHCback;
4530  TH1F *hCosPDPBTGHCback;
4531  TH1F *hCosPcPDTGHCback;
4532  flistTghCutsBack->Add(hInvMassPtTGHCback);
4533 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
4534  TH2F *hd0D0VSd0xd0TGHCbackpt;
4535  TH2F *hangletracksVSd0xd0TGHCbackpt;
4536  TH2F *hangletracksVSd0D0TGHCbackpt;
4537  TH1F *hd0xd0TGHCbackpt;
4538 
4539  TH2F *hTOFpidTGHCback=new TH2F("hTOFpidTGHCback","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
4540  flistTghCutsBack->Add(hTOFpidTGHCback);
4541 
4542 
4543  for(Int_t i=0;i<fnbins;i++){
4544  namehist="hd0zD0ptTGHCback_pt";
4545  namehist+=i;
4546  titlehist="d0(z) Tight Cuts Backgrm ptbin=";
4547  titlehist+=i;
4548  hd0zD0ptTGHCback=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
4549  hd0zD0ptTGHCback->SetXTitle("d_{0}(z) [#mum]");
4550  hd0zD0ptTGHCback->SetYTitle("Entries");
4551  flistTghCutsBack->Add(hd0zD0ptTGHCback);
4552 
4553  namehist="hInvMassD0TGHCback_pt";
4554  namehist+=i;
4555  titlehist="Invariant Mass Tight Cuts Backgr ptbin=";
4556  titlehist+=i;
4557  hInvMassD0TGHCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
4558  hInvMassD0TGHCback->SetXTitle("Invariant Mass [GeV]");
4559  hInvMassD0TGHCback->SetYTitle("Entries");
4560  flistTghCutsBack->Add(hInvMassD0TGHCback);
4561 
4562  namehist="hInvMassD0barTGHCback_pt";
4563  namehist+=i;
4564  titlehist="Invariant Mass D0bar Tight Cuts Back ptbin=";
4565  titlehist+=i;
4566  hInvMassD0barTGHCback=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
4567  hInvMassD0barTGHCback->SetXTitle("Invariant Mass [GeV]");
4568  hInvMassD0barTGHCback->SetYTitle("Entries");
4569  flistTghCutsBack->Add(hInvMassD0barTGHCback);
4570 
4571  namehist="hetaTGHCback_pt";
4572  namehist+=i;
4573  titlehist="eta Tight Cuts Backgr ptbin=";
4574  titlehist+=i;
4575  hetaTGHCback=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
4576  hetaTGHCback->SetXTitle("Pseudorapidity");
4577  hetaTGHCback->SetYTitle("Entries");
4578  flistTghCutsBack->Add(hetaTGHCback);
4579 
4580  namehist="hCosPDPBTGHCback_pt";
4581  namehist+=i;
4582  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
4583  titlehist+=i;
4584  hCosPDPBTGHCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
4585  hCosPDPBTGHCback->SetXTitle("Cosine between D0 momentum and B momentum");
4586  hCosPDPBTGHCback->SetYTitle("Entries");
4587  flistTghCutsBack->Add(hCosPDPBTGHCback);
4588 
4589  namehist="hCosPcPDTGHCback_pt";
4590  namehist+=i;
4591  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
4592  titlehist+=i;
4593  hCosPcPDTGHCback=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
4594  hCosPcPDTGHCback->SetXTitle("Cosine between c quark momentum and D0 momentum");
4595  hCosPcPDTGHCback->SetYTitle("Entries");
4596  flistTghCutsBack->Add(hCosPcPDTGHCback);
4597 
4598  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
4599  namehist="hd0xd0TGHCback_pt";
4600  namehist+=i;
4601  titlehist="d0xd0 Tight Cuts Back ptbin=";
4602  titlehist+=i;
4603  hd0xd0TGHCbackpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
4604  hd0xd0TGHCbackpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
4605  hd0xd0TGHCbackpt->SetYTitle("Entries");
4606  flistTghCutsBack->Add(hd0xd0TGHCbackpt);
4607 
4608 
4609  namehist="hd0D0VSd0xd0TGHCback_pt";
4610  namehist+=i;
4611  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts Back ptbin=";
4612  titlehist+=i;
4613  hd0D0VSd0xd0TGHCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
4614  hd0D0VSd0xd0TGHCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
4615  hd0D0VSd0xd0TGHCbackpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
4616  flistTghCutsBack->Add(hd0D0VSd0xd0TGHCbackpt);
4617 
4618 
4619  namehist="hangletracksVSd0xd0TGHCback_pt";
4620  namehist+=i;
4621  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts Back ptbin=";
4622  titlehist+=i;
4623  hangletracksVSd0xd0TGHCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
4624  hangletracksVSd0xd0TGHCbackpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
4625  hangletracksVSd0xd0TGHCbackpt->SetYTitle(" angle between K and #p tracks [rad]");
4626  flistTghCutsBack->Add(hangletracksVSd0xd0TGHCbackpt);
4627 
4628 
4629  namehist="hangletracksVSd0D0TGHCback_pt";
4630  namehist+=i;
4631  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Tight Cuts Back ptbin=";
4632  titlehist+=i;
4633  hangletracksVSd0D0TGHCbackpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
4634  hangletracksVSd0D0TGHCbackpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
4635  hangletracksVSd0D0TGHCbackpt->SetYTitle(" angle between K and #p tracks [rad]");
4636  flistTghCutsBack->Add(hangletracksVSd0D0TGHCbackpt);
4637 
4638 
4639  }
4640  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
4641  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4642 
4643 
4644 
4645 
4646  // ####### d0 D0 histos ############
4647 
4648  TH1F *hd0D0TGHCbackPM = new TH1F("hd0D0TGHCbackPM","D^{0} impact par. plot , Tight Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
4649  hd0D0TGHCbackPM->SetXTitle("Impact parameter [#mum]");
4650  hd0D0TGHCbackPM->SetYTitle("Entries");
4651 
4652  TH1F *hd0D0VtxTrueTGHCbackPM = new TH1F("hd0D0VtxTrueTGHCbackPM","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
4653  hd0D0VtxTrueTGHCbackPM->SetXTitle("Impact parameter [#mum]");
4654  hd0D0VtxTrueTGHCbackPM->SetYTitle("Entries");
4655 
4656  TH1F *hMCd0D0TGHCbackPM = new TH1F("hMCd0D0TGHCbackPM","D^{0} impact par. plot, Tight Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
4657  hMCd0D0TGHCbackPM->SetXTitle("MC Impact parameter [#mum]");
4658  hMCd0D0TGHCbackPM->SetYTitle("Entries");
4659 
4660  TH1F *hd0D0TGHCbackSB = new TH1F("hd0D0TGHCbackSB","D^{0} impact par. plot , Tight Cuts ,Background,Mass Peak (All momenta)",1000,-1000.,1000.);
4661  hd0D0TGHCbackSB->SetXTitle("Impact parameter [#mum]");
4662  hd0D0TGHCbackSB->SetYTitle("Entries");
4663 
4664  TH1F *hd0D0VtxTrueTGHCbackSB = new TH1F("hd0D0VtxTrueTGHCbackSB","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
4665  hd0D0VtxTrueTGHCbackSB->SetXTitle("Impact parameter [#mum]");
4666  hd0D0VtxTrueTGHCbackSB->SetYTitle("Entries");
4667 
4668  TH1F *hMCd0D0TGHCbackSB = new TH1F("hMCd0D0TGHCbackSB","D^{0} impact par. plot, Tight Cuts, Background,Mass Peak (All momenta)",1000,-1000.,1000.);
4669  hMCd0D0TGHCbackSB->SetXTitle("MC Impact parameter [#mum]");
4670  hMCd0D0TGHCbackSB->SetYTitle("Entries");
4671 
4672  flistTghCutsBack->Add(hd0D0TGHCbackPM);
4673  flistTghCutsBack->Add(hd0D0VtxTrueTGHCbackPM);
4674  flistTghCutsBack->Add(hMCd0D0TGHCbackPM);
4675  flistTghCutsBack->Add(hd0D0TGHCbackSB);
4676  flistTghCutsBack->Add(hd0D0VtxTrueTGHCbackSB);
4677  flistTghCutsBack->Add(hMCd0D0TGHCbackSB);
4678 
4679  TH1F *hd0D0ptTGHCbackPM;
4680  TH1F *hMCd0D0ptTGHCbackPM;
4681  TH1F *hd0D0VtxTrueptTGHCbackPM;
4682  TH1F *hd0D0ptTGHCbackSB;
4683  TH1F *hMCd0D0ptTGHCbackSB;
4684  TH1F *hd0D0VtxTrueptTGHCbackSB;
4685  namehist="hd0D0ptTGHCback_";
4686  titlehist="D^{0} impact par. plot, Tight Cuts, Background, ";
4687  for(Int_t i=0;i<fnbins;i++){
4688  strnamept=namehist;
4689  strnamept.Append("PkMss_pt");
4690  strnamept+=i;
4691 
4692  strtitlept=titlehist;
4693  strtitlept.Append(" Mass Peak, ");
4694  strtitlept+=fptbins[i];
4695  strtitlept.Append("<= pt <");
4696  strtitlept+=fptbins[i+1];
4697  strtitlept.Append(" [GeV/c]");
4698 
4699  hd0D0ptTGHCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4700  hd0D0ptTGHCbackPM->SetXTitle("Impact parameter [#mum] ");
4701  hd0D0ptTGHCbackPM->SetYTitle("Entries");
4702  flistTghCutsBack->Add(hd0D0ptTGHCbackPM);
4703 
4704  strnamept.ReplaceAll("hd0D0","hMCd0D0");
4705  hMCd0D0ptTGHCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4706  hMCd0D0ptTGHCbackPM->SetXTitle("MC Impact parameter [#mum] ");
4707  hMCd0D0ptTGHCbackPM->SetYTitle("Entries");
4708  flistTghCutsBack->Add(hMCd0D0ptTGHCbackPM);
4709 
4710 
4711  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
4712  hd0D0VtxTrueptTGHCbackPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4713  hd0D0VtxTrueptTGHCbackPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
4714  hd0D0VtxTrueptTGHCbackPM->SetYTitle("Entries");
4715  flistTghCutsBack->Add(hd0D0VtxTrueptTGHCbackPM);
4716 
4717  strnamept=namehist;
4718  strnamept.Append("SBMss_pt");
4719  strnamept+=i;
4720 
4721  strtitlept=titlehist;
4722  strtitlept.Append(" Side Bands, ");
4723  strtitlept+=fptbins[i];
4724  strtitlept.Append("<= pt <");
4725  strtitlept+=fptbins[i+1];
4726  strtitlept.Append(" [GeV/c]");
4727 
4728  hd0D0ptTGHCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4729  hd0D0ptTGHCbackSB->SetXTitle("Impact parameter [#mum] ");
4730  hd0D0ptTGHCbackSB->SetYTitle("Entries");
4731  flistTghCutsBack->Add(hd0D0ptTGHCbackSB);
4732 
4733  strnamept.ReplaceAll("hd0D0","hMCd0D0");
4734  hMCd0D0ptTGHCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4735  hMCd0D0ptTGHCbackSB->SetXTitle("MC Impact parameter [#mum] ");
4736  hMCd0D0ptTGHCbackSB->SetYTitle("Entries");
4737  flistTghCutsBack->Add(hMCd0D0ptTGHCbackSB);
4738 
4739  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
4740  hd0D0VtxTrueptTGHCbackSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
4741  hd0D0VtxTrueptTGHCbackSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
4742  hd0D0VtxTrueptTGHCbackSB->SetYTitle("Entries");
4743  flistTghCutsBack->Add(hd0D0VtxTrueptTGHCbackSB);
4744  }
4745 
4746 
4747 
4748  //############ TIGHT CUTS FROMB HISTOGRAMS ###########
4749  //
4750  //####### global properties histos
4751 
4752  TH2F *hCPtaVSd0d0TGHCfromB=new TH2F("hCPtaVSd0d0TGHCfromB","hCPtaVSd0d0_TightCuts_FromB",1000,-100000.,100000.,100,-1.,1.);
4753  TH1F *hSecVtxZTGHCfromB=new TH1F("hSecVtxZTGHCfromB","hSecVtxZ_TightCuts_FromB",1000,-8.,8.);
4754  TH1F *hSecVtxXTGHCfromB=new TH1F("hSecVtxXTGHCfromB","hSecVtxX_TightCuts_FromB",1000,-3000.,3000.);
4755  TH1F *hSecVtxYTGHCfromB=new TH1F("hSecVtxYTGHCfromB","hSecVtxY_TightCuts_FromB",1000,-3000.,3000.);
4756  TH2F *hSecVtxXYTGHCfromB=new TH2F("hSecVtxXYTGHCfromB","hSecVtxXY_TightCuts_FromB",1000,-3000.,3000.,1000,-3000.,3000.);
4757  TH1F *hSecVtxPhiTGHCfromB=new TH1F("hSecVtxPhiTGHCfromB","hSecVtxPhi_TightCuts_FromB",180,-180.1,180.1);
4758  TH1F *hd0singlTrackTGHCfromB=new TH1F("hd0singlTrackTGHCfromB","hd0singlTrackTightCuts_FromB",1000,-5000.,5000.);
4759  TH1F *hCPtaTGHCfromB=new TH1F("hCPtaTGHCfromB","hCPta_TightCuts_FromB",100,-1.,1.);
4760  TH1F *hd0xd0TGHCfromB=new TH1F("hd0xd0TGHCfromB","hd0xd0_TightCuts_FromB",1000,-100000.,100000.);
4761  TH1F *hMassTrueTGHCfromB=new TH1F("hMassTrueTGHCfromB","D^{0} MC inv. Mass Tight Cuts FromB(All momenta)",600,1.600,2.200);
4762  TH1F *hMassTGHCfromB=new TH1F("hMassTGHCfromB","D^{0} inv. Mass Tight Cuts FromB (All momenta)",600,1.600,2.200);
4763  hMassTGHCfromB->Sumw2();
4764  TH1F *hMassTrueTGHCfromBPM=new TH1F("hMassTrueTGHCfromBPM","D^{0} MC inv. Mass Tight Cuts FromB, Mass Peak. (All momenta)",600,1.600,2.200);
4765  TH1F *hMassTGHCfromBPM=new TH1F("hMassTGHCfromBPM","D^{0} inv. Mass Tight Cuts FromB (All momenta), MassPeak",600,1.600,2.200);
4766  hMassTGHCfromBPM->Sumw2();
4767  TH1F *hMassTrueTGHCfromBSB=new TH1F("hMassTrueTGHCfromBSB","D^{0} MC inv. Mass in Side Bands Tight Cuts FromB(All momenta)",600,1.600,2.200);
4768  TH1F *hMassTGHCfromBSB=new TH1F("hMassTGHCfromBSB","D^{0} inv. Mass in Side Bands Tight Cuts FromB (All momenta)",600,1.600,2.200);
4769  hMassTGHCfromBSB->Sumw2();
4770 
4771  flistTghCutsFromB->Add(hCPtaVSd0d0TGHCfromB);
4772  flistTghCutsFromB->Add(hSecVtxZTGHCfromB);
4773  flistTghCutsFromB->Add(hSecVtxYTGHCfromB);
4774  flistTghCutsFromB->Add(hSecVtxXTGHCfromB);
4775  flistTghCutsFromB->Add(hSecVtxXYTGHCfromB);
4776  flistTghCutsFromB->Add(hSecVtxPhiTGHCfromB);
4777  flistTghCutsFromB->Add(hd0singlTrackTGHCfromB);
4778  flistTghCutsFromB->Add(hCPtaTGHCfromB);
4779  flistTghCutsFromB->Add(hd0xd0TGHCfromB);
4780  flistTghCutsFromB->Add(hMassTrueTGHCfromB);
4781  flistTghCutsFromB->Add(hMassTGHCfromB);
4782  flistTghCutsFromB->Add(hMassTrueTGHCfromBPM);
4783  flistTghCutsFromB->Add(hMassTGHCfromBPM);
4784  flistTghCutsFromB->Add(hMassTrueTGHCfromBSB);
4785  flistTghCutsFromB->Add(hMassTGHCfromBSB);
4786 
4787 
4788 
4789  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
4790  TH1F *hdcaTGHCfromB=new TH1F("hdcaTGHCfromB","hdca_TightCuts_FromB",100,0.,1000.);
4791  hdcaTGHCfromB->SetXTitle("dca [#mum]");
4792  hdcaTGHCfromB->SetYTitle("Entries");
4793  TH1F *hcosthetastarTGHCfromB=new TH1F("hcosthetastarTGHCfromB","hCosThetaStar_TightCuts_FromB",50,-1.,1.);
4794  hcosthetastarTGHCfromB->SetXTitle("cos #theta^{*}");
4795  hcosthetastarTGHCfromB->SetYTitle("Entries");
4796  TH1F *hptD0TGHCfromB=new TH1F("hptD0TGHCfromB","D^{0} transverse momentum distribution",34,ptbinsD0arr);
4797  hptD0TGHCfromB->SetXTitle("p_{t} [GeV/c]");
4798  hptD0TGHCfromB->SetYTitle("Entries");
4799  TH1F *hptD0VsMaxPtTGHCfromB=new TH1F("hptD0VsMaxPtTGHCfromB","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
4800  TH2F *hptD0PTallsqrtTGHCfromB=new TH2F("hptD0PTallsqrtTGHCfromB","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
4801  TH2F *hptD0PTallTGHCfromB=new TH2F("hptD0PTallTGHCfromB","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
4802  TH2F *hptD0vsptBTGHCfromB=new TH2F("hptD0vsptBTGHCfromB","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4803  TH2F *hpD0vspBTGHCfromB=new TH2F("hpD0vspBTGHCfromB","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4804  TH2F *hptD0vsptcquarkTGHCfromB=new TH2F("hptD0vsptcquarkTGHCfromB","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4805  TH2F *hpD0vspcquarkTGHCfromB=new TH2F("hpD0vspcquarkTGHCfromB","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
4806  flistTghCutsFromB->Add(hdcaTGHCfromB);
4807  flistTghCutsFromB->Add(hcosthetastarTGHCfromB);
4808  flistTghCutsFromB->Add(hptD0TGHCfromB);
4809  flistTghCutsFromB->Add(hptD0VsMaxPtTGHCfromB);
4810  flistTghCutsFromB->Add(hptD0PTallsqrtTGHCfromB);
4811  flistTghCutsFromB->Add(hptD0PTallTGHCfromB);
4812  flistTghCutsFromB->Add(hptD0vsptBTGHCfromB);
4813  flistTghCutsFromB->Add(hpD0vspBTGHCfromB);
4814  flistTghCutsFromB->Add(hptD0vsptcquarkTGHCfromB);
4815  flistTghCutsFromB->Add(hpD0vspcquarkTGHCfromB);
4816 
4817  TH1F *hd0zD0ptTGHCfromB;
4818  TH1F *hInvMassD0TGHCfromB,*hInvMassD0barTGHCfromB;
4819  TH2F *hInvMassPtTGHCfromB=new TH2F("hInvMassPtTGHCfromB","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
4820  TH3F *hInvMassPtSelSignOnlyTGHCfromB=new TH3F("hInvMassPtSelSignOnlyTGHCfromB","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
4821  flistTghCutsFromB->Add(hInvMassPtSelSignOnlyTGHCfromB);
4822  TH3F *hInvMassPtSelReflOnlyTGHCfromB=new TH3F("hInvMassPtSelReflOnlyTGHCfromB","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
4823  flistTghCutsFromB->Add(hInvMassPtSelReflOnlyTGHCfromB);
4824 
4825 
4826  THnSparseF *hSparseTGHCfromB=new THnSparseF("hSparseTGHCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
4827  hSparseTGHCfromB->SetBinEdges(0,massbins);
4828  hSparseTGHCfromB->SetBinEdges(1,massbins);
4829  hSparseTGHCfromB->SetBinEdges(2,ptbinsForNsparse);
4830  hSparseTGHCfromB->SetBinEdges(3,impparbins);
4831  hSparseTGHCfromB->SetBinEdges(4,massHypoBins);
4832  flistTghCutsFromB->Add(hSparseTGHCfromB);
4833 
4834 
4835  fTreeTGHCfromB = new TTree("fTreeTGHCfromB","Candidate variables tree");
4837  for(Int_t ivar=0; ivar<nVar; ivar++){
4838  fTreeTGHCfromB->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeTGHCfromB[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
4839  }
4841 
4842 
4843  THnSparseF *hSparseRecoTGHCfromB=new THnSparseF("hSparseRecoTGHCfromB","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
4844  hSparseRecoTGHCfromB->SetBinEdges(0,massbins);
4845  hSparseRecoTGHCfromB->SetBinEdges(1,massbins);
4846  hSparseRecoTGHCfromB->SetBinEdges(2,ptbinsForNsparse);
4847  hSparseRecoTGHCfromB->SetBinEdges(3,impparbins);
4848  hSparseRecoTGHCfromB->SetBinEdges(4,massHypoBins);
4849  flistTghCutsFromB->Add(hSparseRecoTGHCfromB);
4850 
4851  fTreeRecoTGHCfromB = new TTree("fTreeRecoTGHCfromB","Candidate variables tree");
4853  for(Int_t ivar=0; ivar<nVar; ivar++){
4854  fTreeRecoTGHCfromB->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeRecoTGHCfromB[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
4855  }
4857 
4858  TH1F *hetaTGHCfromB;
4859  TH1F *hCosPDPBTGHCfromB;
4860  TH1F *hCosPcPDTGHCfromB;
4861  flistTghCutsFromB->Add(hInvMassPtTGHCfromB);
4862 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
4863  TH2F *hd0D0VSd0xd0TGHCfromBpt;
4864  TH2F *hangletracksVSd0xd0TGHCfromBpt;
4865  TH2F *hangletracksVSd0D0TGHCfromBpt;
4866  TH1F *hd0xd0TGHCfromBpt;
4867 
4868  TH2F *hTOFpidTGHCfromB=new TH2F("hTOFpidTGHCfromB","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
4869  flistTghCutsFromB->Add(hTOFpidTGHCfromB);
4870 
4871 
4872  for(Int_t i=0;i<fnbins;i++){
4873  namehist="hd0zD0ptTGHCfromB_pt";
4874  namehist+=i;
4875  titlehist="d0(z) Tight Cuts FromBm ptbin=";
4876  titlehist+=i;
4877  hd0zD0ptTGHCfromB=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
4878  hd0zD0ptTGHCfromB->SetXTitle("d_{0}(z) [#mum]");
4879  hd0zD0ptTGHCfromB->SetYTitle("Entries");
4880  flistTghCutsFromB->Add(hd0zD0ptTGHCfromB);
4881 
4882  namehist="hInvMassD0TGHCfromB_pt";
4883  namehist+=i;
4884  titlehist="Invariant Mass Tight Cuts FromB ptbin=";
4885  titlehist+=i;
4886  hInvMassD0TGHCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
4887  hInvMassD0TGHCfromB->SetXTitle("Invariant Mass [GeV]");
4888  hInvMassD0TGHCfromB->SetYTitle("Entries");
4889  flistTghCutsFromB->Add(hInvMassD0TGHCfromB);
4890 
4891  namehist="hInvMassD0barTGHCfromB_pt";
4892  namehist+=i;
4893  titlehist="Invariant Mass D0bar Tight Cuts FromB ptbin=";
4894  titlehist+=i;
4895  hInvMassD0barTGHCfromB=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
4896  hInvMassD0barTGHCfromB->SetXTitle("Invariant Mass [GeV]");
4897  hInvMassD0barTGHCfromB->SetYTitle("Entries");
4898  flistTghCutsFromB->Add(hInvMassD0barTGHCfromB);
4899 
4900  namehist="hetaTGHCfromB_pt";
4901  namehist+=i;
4902  titlehist="eta Tight Cuts FromB ptbin=";
4903  titlehist+=i;
4904  hetaTGHCfromB=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
4905  hetaTGHCfromB->SetXTitle("Pseudorapidity");
4906  hetaTGHCfromB->SetYTitle("Entries");
4907  flistTghCutsFromB->Add(hetaTGHCfromB);
4908 
4909  namehist="hCosPDPBTGHCfromB_pt";
4910  namehist+=i;
4911  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
4912  titlehist+=i;
4913  hCosPDPBTGHCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
4914  hCosPDPBTGHCfromB->SetXTitle("Cosine between D0 momentum and B momentum");
4915  hCosPDPBTGHCfromB->SetYTitle("Entries");
4916  flistTghCutsFromB->Add(hCosPDPBTGHCfromB);
4917 
4918  namehist="hCosPcPDTGHCfromB_pt";
4919  namehist+=i;
4920  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
4921  titlehist+=i;
4922  hCosPcPDTGHCfromB=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
4923  hCosPcPDTGHCfromB->SetXTitle("Cosine between c quark momentum and D0 momentum");
4924  hCosPcPDTGHCfromB->SetYTitle("Entries");
4925  flistTghCutsFromB->Add(hCosPcPDTGHCfromB);
4926 
4927 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
4928  namehist="hd0xd0TGHCfromB_pt";
4929  namehist+=i;
4930  titlehist="d0xd0 Tight Cuts FromB ptbin=";
4931  titlehist+=i;
4932  hd0xd0TGHCfromBpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
4933  hd0xd0TGHCfromBpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
4934  hd0xd0TGHCfromBpt->SetYTitle("Entries");
4935  flistTghCutsFromB->Add(hd0xd0TGHCfromBpt);
4936 
4937 
4938  namehist="hd0D0VSd0xd0TGHCfromB_pt";
4939  namehist+=i;
4940  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts FromB ptbin=";
4941  titlehist+=i;
4942  hd0D0VSd0xd0TGHCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
4943  hd0D0VSd0xd0TGHCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
4944  hd0D0VSd0xd0TGHCfromBpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
4945  flistTghCutsFromB->Add(hd0D0VSd0xd0TGHCfromBpt);
4946 
4947 
4948  namehist="hangletracksVSd0xd0TGHCfromB_pt";
4949  namehist+=i;
4950  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts FromB ptbin=";
4951  titlehist+=i;
4952  hangletracksVSd0xd0TGHCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
4953  hangletracksVSd0xd0TGHCfromBpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
4954  hangletracksVSd0xd0TGHCfromBpt->SetYTitle(" angle between K and #p tracks [rad]");
4955  flistTghCutsFromB->Add(hangletracksVSd0xd0TGHCfromBpt);
4956 
4957 
4958  namehist="hangletracksVSd0D0TGHCfromB_pt";
4959  namehist+=i;
4960  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Tight Cuts FromB ptbin=";
4961  titlehist+=i;
4962  hangletracksVSd0D0TGHCfromBpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
4963  hangletracksVSd0D0TGHCfromBpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
4964  hangletracksVSd0D0TGHCfromBpt->SetYTitle(" angle between K and #p tracks [rad]");
4965  flistTghCutsFromB->Add(hangletracksVSd0D0TGHCfromBpt);
4966 
4967  }
4968  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
4969  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4970 
4971 
4972 
4973 
4974 
4975  // ######### d0 D0 histos ##############
4976  TH1F *hd0D0TGHCfromBPM = new TH1F("hd0D0TGHCfromBPM","D^{0} impact par. plot , Tight Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
4977  hd0D0TGHCfromBPM->SetXTitle("Impact parameter [#mum]");
4978  hd0D0TGHCfromBPM->SetYTitle("Entries");
4979 
4980  TH1F *hd0D0VtxTrueTGHCfromBPM = new TH1F("hd0D0VtxTrueTGHCfromBPM","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
4981  hd0D0VtxTrueTGHCfromBPM->SetXTitle("Impact parameter [#mum]");
4982  hd0D0VtxTrueTGHCfromBPM->SetYTitle("Entries");
4983 
4984  TH1F *hMCd0D0TGHCfromBPM = new TH1F("hMCd0D0TGHCfromBPM","D^{0} impact par. plot, Tight Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
4985  hMCd0D0TGHCfromBPM->SetXTitle("MC Impact parameter [#mum]");
4986  hMCd0D0TGHCfromBPM->SetYTitle("Entries");
4987 
4988  TH1F *hd0D0TGHCfromBSB = new TH1F("hd0D0TGHCfromBSB","D^{0} impact par. plot , Tight Cuts ,FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
4989  hd0D0TGHCfromBSB->SetXTitle("Impact parameter [#mum]");
4990  hd0D0TGHCfromBSB->SetYTitle("Entries");
4991 
4992  TH1F *hd0D0VtxTrueTGHCfromBSB = new TH1F("hd0D0VtxTrueTGHCfromBSB","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
4993  hd0D0VtxTrueTGHCfromBSB->SetXTitle("Impact parameter [#mum]");
4994  hd0D0VtxTrueTGHCfromBSB->SetYTitle("Entries");
4995 
4996  TH1F *hMCd0D0TGHCfromBSB = new TH1F("hMCd0D0TGHCfromBSB","D^{0} impact par. plot, Tight Cuts, FromB,Mass Peak (All momenta)",1000,-1000.,1000.);
4997  hMCd0D0TGHCfromBSB->SetXTitle("MC Impact parameter [#mum]");
4998  hMCd0D0TGHCfromBSB->SetYTitle("Entries");
4999 
5000  flistTghCutsFromB->Add(hd0D0TGHCfromBPM);
5001  flistTghCutsFromB->Add(hd0D0VtxTrueTGHCfromBPM);
5002  flistTghCutsFromB->Add(hMCd0D0TGHCfromBPM);
5003  flistTghCutsFromB->Add(hd0D0TGHCfromBSB);
5004  flistTghCutsFromB->Add(hd0D0VtxTrueTGHCfromBSB);
5005  flistTghCutsFromB->Add(hMCd0D0TGHCfromBSB);
5006 
5007  TH1F *hd0D0ptTGHCfromBPM;
5008  TH1F *hMCd0D0ptTGHCfromBPM;
5009  TH1F *hd0D0VtxTrueptTGHCfromBPM;
5010  TH1F *hd0D0ptTGHCfromBSB;
5011  TH1F *hMCd0D0ptTGHCfromBSB;
5012  TH1F *hd0D0VtxTrueptTGHCfromBSB;
5013  namehist="hd0D0ptTGHCfromB_";
5014  titlehist="D^{0} impact par. plot, Tight Cuts, FromB, ";
5015  for(Int_t i=0;i<fnbins;i++){
5016  strnamept=namehist;
5017  strnamept.Append("PkMss_pt");
5018  strnamept+=i;
5019 
5020  strtitlept=titlehist;
5021  strtitlept.Append(" Mass Peak, ");
5022  strtitlept+=fptbins[i];
5023  strtitlept.Append("<= pt <");
5024  strtitlept+=fptbins[i+1];
5025  strtitlept.Append(" [GeV/c]");
5026 
5027  hd0D0ptTGHCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5028  hd0D0ptTGHCfromBPM->SetXTitle("Impact parameter [#mum] ");
5029  hd0D0ptTGHCfromBPM->SetYTitle("Entries");
5030  flistTghCutsFromB->Add(hd0D0ptTGHCfromBPM);
5031 
5032  strnamept.ReplaceAll("hd0D0","hMCd0D0");
5033  hMCd0D0ptTGHCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5034  hMCd0D0ptTGHCfromBPM->SetXTitle("MC Impact parameter [#mum] ");
5035  hMCd0D0ptTGHCfromBPM->SetYTitle("Entries");
5036  flistTghCutsFromB->Add(hMCd0D0ptTGHCfromBPM);
5037 
5038 
5039  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
5040  hd0D0VtxTrueptTGHCfromBPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5041  hd0D0VtxTrueptTGHCfromBPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
5042  hd0D0VtxTrueptTGHCfromBPM->SetYTitle("Entries");
5043  flistTghCutsFromB->Add(hd0D0VtxTrueptTGHCfromBPM);
5044 
5045  strnamept=namehist;
5046  strnamept.Append("SBMss_pt");
5047  strnamept+=i;
5048 
5049  strtitlept=titlehist;
5050  strtitlept.Append(" Side Bands, ");
5051  strtitlept+=fptbins[i];
5052  strtitlept.Append("<= pt <");
5053  strtitlept+=fptbins[i+1];
5054  strtitlept.Append(" [GeV/c]");
5055 
5056  hd0D0ptTGHCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5057  hd0D0ptTGHCfromBSB->SetXTitle("Impact parameter [#mum] ");
5058  hd0D0ptTGHCfromBSB->SetYTitle("Entries");
5059  flistTghCutsFromB->Add(hd0D0ptTGHCfromBSB);
5060 
5061  strnamept.ReplaceAll("hd0D0","hMCd0D0");
5062  hMCd0D0ptTGHCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5063  hMCd0D0ptTGHCfromBSB->SetXTitle("MC Impact parameter [#mum] ");
5064  hMCd0D0ptTGHCfromBSB->SetYTitle("Entries");
5065  flistTghCutsFromB->Add(hMCd0D0ptTGHCfromBSB);
5066 
5067  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
5068  hd0D0VtxTrueptTGHCfromBSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5069  hd0D0VtxTrueptTGHCfromBSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
5070  hd0D0VtxTrueptTGHCfromBSB->SetYTitle("Entries");
5071  flistTghCutsFromB->Add(hd0D0VtxTrueptTGHCfromBSB);
5072  }
5073 
5074 
5075 
5076  //############ TIGHT CUTS FROM DSTAR HISTOGRAMS ###########
5077  //
5078  //############## global properties histos
5079  TH2F *hCPtaVSd0d0TGHCfromDstar=new TH2F("hCPtaVSd0d0TGHCfromDstar","hCPtaVSd0d0_TightCuts_FromDStar",1000,-100000.,100000.,100,-1.,1.);
5080  TH1F *hSecVtxZTGHCfromDstar=new TH1F("hSecVtxZTGHCfromDstar","hSecVtxZ_TightCuts_FromDStar",1000,-8.,8.);
5081  TH1F *hSecVtxXTGHCfromDstar=new TH1F("hSecVtxXTGHCfromDstar","hSecVtxX_TightCuts_FromDStar",1000,-3000.,3000.);
5082  TH1F *hSecVtxYTGHCfromDstar=new TH1F("hSecVtxYTGHCfromDstar","hSecVtxY_TightCuts_FromDStar",1000,-3000.,3000.);
5083  TH2F *hSecVtxXYTGHCfromDstar=new TH2F("hSecVtxXYTGHCfromDstar","hSecVtxXY_TightCuts_FromDStar",1000,-3000.,3000.,1000,-3000.,3000.);
5084  TH1F *hSecVtxPhiTGHCfromDstar=new TH1F("hSecVtxPhiTGHCfromDstar","hSecVtxPhi_TightCuts_FromDStar",180,-180.1,180.1);
5085  TH1F *hd0singlTrackTGHCfromDstar=new TH1F("hd0singlTrackTGHCfromDstar","hd0singlTrackTightCuts_FromDstar",1000,-5000.,5000.);
5086  TH1F *hCPtaTGHCfromDstar=new TH1F("hCPtaTGHCfromDstar","hCPta_TightCuts_FromDStar",100,-1.,1.);
5087  TH1F *hd0xd0TGHCfromDstar=new TH1F("hd0xd0TGHCfromDstar","hd0xd0_TightCuts_FromDStar",1000,-100000.,100000.);
5088  TH1F *hMassTrueTGHCfromDstar=new TH1F("hMassTrueTGHCfromDstar","D^{0} MC inv. Mass Tight Cuts FromDStar(All momenta)",600,1.600,2.200);
5089  TH1F *hMassTGHCfromDstar=new TH1F("hMassTGHCfromDstar","D^{0} inv. Mass Tight Cuts FromDStar (All momenta)",600,1.600,2.200);
5090  hMassTGHCfromDstar->Sumw2();
5091  TH1F *hMassTrueTGHCfromDstarPM=new TH1F("hMassTrueTGHCfromDstarPM","D^{0} MC inv. Mass Tight Cuts FromDStar, Mass Peak. (All momenta)",600,1.600,2.200);
5092  TH1F *hMassTGHCfromDstarPM=new TH1F("hMassTGHCfromDstarPM","D^{0} inv. Mass Tight Cuts FromDStar (All momenta), MassPeak",600,1.600,2.200);
5093  hMassTGHCfromDstarPM->Sumw2();
5094  TH1F *hMassTrueTGHCfromDstarSB=new TH1F("hMassTrueTGHCfromDstarSB","D^{0} MC inv. Mass in Side Bands Tight Cuts FromDStar(All momenta)",600,1.600,2.200);
5095  TH1F *hMassTGHCfromDstarSB=new TH1F("hMassTGHCfromDstarSB","D^{0} inv. Mass in Side Bands Tight Cuts FromDStar (All momenta)",600,1.600,2.200);
5096  hMassTGHCfromDstarSB->Sumw2();
5097 
5098  flistTghCutsFromDstar->Add(hCPtaVSd0d0TGHCfromDstar);
5099  flistTghCutsFromDstar->Add(hSecVtxZTGHCfromDstar);
5100  flistTghCutsFromDstar->Add(hSecVtxYTGHCfromDstar);
5101  flistTghCutsFromDstar->Add(hSecVtxXTGHCfromDstar);
5102  flistTghCutsFromDstar->Add(hSecVtxXYTGHCfromDstar);
5103  flistTghCutsFromDstar->Add(hSecVtxPhiTGHCfromDstar);
5104  flistTghCutsFromDstar->Add(hd0singlTrackTGHCfromDstar);
5105  flistTghCutsFromDstar->Add(hCPtaTGHCfromDstar);
5106  flistTghCutsFromDstar->Add(hd0xd0TGHCfromDstar);
5107  flistTghCutsFromDstar->Add(hMassTrueTGHCfromDstar);
5108  flistTghCutsFromDstar->Add(hMassTGHCfromDstar);
5109  flistTghCutsFromDstar->Add(hMassTrueTGHCfromDstarPM);
5110  flistTghCutsFromDstar->Add(hMassTGHCfromDstarPM);
5111  flistTghCutsFromDstar->Add(hMassTrueTGHCfromDstarSB);
5112  flistTghCutsFromDstar->Add(hMassTGHCfromDstarSB);
5113 
5114 
5115 
5116 
5117 
5118  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
5119  TH1F *hdcaTGHCfromDstar=new TH1F("hdcaTGHCfromDstar","hdca_TightCuts_FromDstar",100,0.,1000.);
5120  hdcaTGHCfromDstar->SetXTitle("dca [#mum]");
5121  hdcaTGHCfromDstar->SetYTitle("Entries");
5122  TH1F *hcosthetastarTGHCfromDstar=new TH1F("hcosthetastarTGHCfromDstar","hCosThetaStar_TightCuts_FromDstar",50,-1.,1.);
5123  hcosthetastarTGHCfromDstar->SetXTitle("cos #theta^{*}");
5124  hcosthetastarTGHCfromDstar->SetYTitle("Entries");
5125  TH1F *hptD0TGHCfromDstar=new TH1F("hptD0TGHCfromDstar","D^{0} transverse momentum distribution",34,ptbinsD0arr);
5126  hptD0TGHCfromDstar->SetXTitle("p_{t} [GeV/c]");
5127  hptD0TGHCfromDstar->SetYTitle("Entries");
5128  TH1F *hptD0VsMaxPtTGHCfromDstar=new TH1F("hptD0VsMaxPtTGHCfromDstar","Difference between D^{0} pt and highest (or second) pt",400,-50.,50.);
5129  TH2F *hptD0PTallsqrtTGHCfromDstar=new TH2F("hptD0PTallsqrtTGHCfromDstar","D^{0} pt Vs Sqrt(Sum pt square)",34,ptbinsD0arr,200,dumbinning);
5130  TH2F *hptD0PTallTGHCfromDstar=new TH2F("hptD0PTallTGHCfromDstar","D^{0} pt Vs Sum pt ",34,ptbinsD0arr,200,dumbinning);
5131  TH2F *hptD0vsptBTGHCfromDstar=new TH2F("hptD0vsptBTGHCfromDstar","D^{0} pt Vs B pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
5132  TH2F *hpD0vspBTGHCfromDstar=new TH2F("hpD0vspBTGHCfromDstar","D^{0} tot momentum Vs B tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
5133  TH2F *hptD0vsptcquarkTGHCfromDstar=new TH2F("hptD0vsptcquarkTGHCfromDstar","D^{0} pt Vs cquark pt distribution",34,ptbinsD0arr,34,ptbinsD0arr);
5134  TH2F *hpD0vspcquarkTGHCfromDstar=new TH2F("hpD0vspcquarkTGHCfromDstar","D^{0} tot momentum Vs cquark tot momentum distribution",34,ptbinsD0arr,34,ptbinsD0arr);
5135  flistTghCutsFromDstar->Add(hdcaTGHCfromDstar);
5136  flistTghCutsFromDstar->Add(hcosthetastarTGHCfromDstar);
5137  flistTghCutsFromDstar->Add(hptD0TGHCfromDstar);
5138  flistTghCutsFromDstar->Add(hptD0VsMaxPtTGHCfromDstar);
5139  flistTghCutsFromDstar->Add(hptD0PTallsqrtTGHCfromDstar);
5140  flistTghCutsFromDstar->Add(hptD0PTallTGHCfromDstar);
5141  flistTghCutsFromDstar->Add(hptD0vsptBTGHCfromDstar);
5142  flistTghCutsFromDstar->Add(hpD0vspBTGHCfromDstar);
5143  flistTghCutsFromDstar->Add(hptD0vsptcquarkTGHCfromDstar);
5144  flistTghCutsFromDstar->Add(hpD0vspcquarkTGHCfromDstar);
5145 
5146  TH1F *hd0zD0ptTGHCfromDstar;
5147  TH1F *hInvMassD0TGHCfromDstar,*hInvMassD0barTGHCfromDstar;
5148  TH1F *hetaTGHCfromDstar;
5149  TH2F *hInvMassPtTGHCfromDstar=new TH2F("hInvMassPtTGHCfromDstar","Candidate p_{t} Vs invariant mass",330,1.700,2.030,200,0.,20.);
5150 
5151  TH3F *hInvMassPtSelSignOnlyTGHCfromDstar=new TH3F("hInvMassPtSelSignOnlyTGHCfromDstar","Candidate p_{t} Vs invariant mass vs sel case for signal only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
5152  flistTghCutsFromDstar->Add(hInvMassPtSelSignOnlyTGHCfromDstar);
5153  TH3F *hInvMassPtSelReflOnlyTGHCfromDstar=new TH3F("hInvMassPtSelReflOnlyTGHCfromDstar","Candidate p_{t} Vs invariant mass vs sel case for reflections only",600,1.600,2.200,72,0.,36.,3,0.5,3.5);
5154  flistTghCutsFromDstar->Add(hInvMassPtSelReflOnlyTGHCfromDstar);
5155 
5156  THnSparseF *hSparseTGHCfromDstar=new THnSparseF("hSparseTGHCfromDstar","Candidate Masses, pt, Imp Par;massD0;massD0bar;pt;impactpar;selcase",5,nbinsSparse);
5157  hSparseTGHCfromDstar->SetBinEdges(0,massbins);
5158  hSparseTGHCfromDstar->SetBinEdges(1,massbins);
5159  hSparseTGHCfromDstar->SetBinEdges(2,ptbinsForNsparse);
5160  hSparseTGHCfromDstar->SetBinEdges(3,impparbins);
5161  hSparseTGHCfromDstar->SetBinEdges(4,massHypoBins);
5162  flistTghCutsFromDstar->Add(hSparseTGHCfromDstar);
5163 
5164  fTreeTGHCfromDstar = new TTree("fTreeTGHCfromDstar","Candidate variables tree");
5166  for(Int_t ivar=0; ivar<nVar; ivar++){
5167  fTreeTGHCfromDstar->Branch(candidateVariableNames[ivar].Data(),&fVariablesTreeTGHCfromDstar[ivar],Form("%s/d",candidateVariableNames[ivar].Data()));
5168  }
5170 
5171  TH1F *hCosPDPBTGHCfromDstar;
5172  TH1F *hCosPcPDTGHCfromDstar;
5173  flistTghCutsFromDstar->Add(hInvMassPtTGHCfromDstar);
5174 // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
5175  TH2F *hd0D0VSd0xd0TGHCfromDstarpt;
5176  TH2F *hangletracksVSd0xd0TGHCfromDstarpt;
5177  TH2F *hangletracksVSd0D0TGHCfromDstarpt;
5178  TH1F *hd0xd0TGHCfromDstarpt;
5179 
5180  TH2F *hTOFpidTGHCfromDstar=new TH2F("hTOFpidTGHCfromDstar","TOF time VS momentum",10,0.,4.,50,-50000.,50000.);
5181  flistTghCutsFromDstar->Add(hTOFpidTGHCfromDstar);
5182 
5183  for(Int_t i=0;i<fnbins;i++){
5184  namehist="hd0zD0ptTGHCfromDstar_pt";
5185  namehist+=i;
5186  titlehist="d0(z) Tight Cuts FromDstarm ptbin=";
5187  titlehist+=i;
5188  hd0zD0ptTGHCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),1000,-3000,3000.);
5189  hd0zD0ptTGHCfromDstar->SetXTitle("d_{0}(z) [#mum]");
5190  hd0zD0ptTGHCfromDstar->SetYTitle("Entries");
5191  flistTghCutsFromDstar->Add(hd0zD0ptTGHCfromDstar);
5192 
5193  namehist="hInvMassD0TGHCfromDstar_pt";
5194  namehist+=i;
5195  titlehist="Invariant Mass Tight Cuts FromDstar ptbin=";
5196  titlehist+=i;
5197  hInvMassD0TGHCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
5198  hInvMassD0TGHCfromDstar->SetXTitle("Invariant Mass [GeV]");
5199  hInvMassD0TGHCfromDstar->SetYTitle("Entries");
5200  flistTghCutsFromDstar->Add(hInvMassD0TGHCfromDstar);
5201 
5202  namehist="hInvMassD0barTGHCfromDstar_pt";
5203  namehist+=i;
5204  titlehist="Invariant Mass D0bar Tight Cuts FromDstar ptbin=";
5205  titlehist+=i;
5206  hInvMassD0barTGHCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),600,1.600,2.200);
5207  hInvMassD0barTGHCfromDstar->SetXTitle("Invariant Mass [GeV]");
5208  hInvMassD0barTGHCfromDstar->SetYTitle("Entries");
5209  flistTghCutsFromDstar->Add(hInvMassD0barTGHCfromDstar);
5210 
5211  namehist="hetaTGHCfromDstar_pt";
5212  namehist+=i;
5213  titlehist="eta Tight Cuts FromDstar ptbin=";
5214  titlehist+=i;
5215  hetaTGHCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),100,-3.,3.);
5216  hetaTGHCfromDstar->SetXTitle("Pseudorapidity");
5217  hetaTGHCfromDstar->SetYTitle("Entries");
5218  flistTghCutsFromDstar->Add(hetaTGHCfromDstar);
5219 
5220  namehist="hCosPDPBTGHCfromDstar_pt";
5221  namehist+=i;
5222  titlehist="Cosine between D0 momentum and B momentum, ptbin=";
5223  titlehist+=i;
5224  hCosPDPBTGHCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
5225  hCosPDPBTGHCfromDstar->SetXTitle("Cosine between D0 momentum and B momentum");
5226  hCosPDPBTGHCfromDstar->SetYTitle("Entries");
5227  flistTghCutsFromDstar->Add(hCosPDPBTGHCfromDstar);
5228 
5229  namehist="hCosPcPDTGHCfromDstar_pt";
5230  namehist+=i;
5231  titlehist="Cosine between cquark momentum and D0 momentum, ptbin=";
5232  titlehist+=i;
5233  hCosPcPDTGHCfromDstar=new TH1F(namehist.Data(),titlehist.Data(),50,-1.,1.);
5234  hCosPcPDTGHCfromDstar->SetXTitle("Cosine between c quark momentum and D0 momentum");
5235  hCosPcPDTGHCfromDstar->SetYTitle("Entries");
5236  flistTghCutsFromDstar->Add(hCosPcPDTGHCfromDstar);
5237 
5238  // %%%%%%%%%%% HERE THE ADDITIONAL HISTS %%%%%%%%%%%%%%%%%
5239  namehist="hd0xd0TGHCfromDstar_pt";
5240  namehist+=i;
5241  titlehist="d0xd0 Tight Cuts FromDstar ptbin=";
5242  titlehist+=i;
5243  hd0xd0TGHCfromDstarpt=new TH1F(namehist.Data(),titlehist.Data(),1000,-50000.,10000.);
5244  hd0xd0TGHCfromDstarpt->SetXTitle("d_{0}^{K}xd_{0}^{#pi} [#mum^2]");
5245  hd0xd0TGHCfromDstarpt->SetYTitle("Entries");
5246  flistTghCutsFromDstar->Add(hd0xd0TGHCfromDstarpt);
5247 
5248 
5249  namehist="hd0D0VSd0xd0TGHCfromDstar_pt";
5250  namehist+=i;
5251  titlehist="d_{0}^{D^{0}} Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts FromDstar ptbin=";
5252  titlehist+=i;
5253  hd0D0VSd0xd0TGHCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,100,-300,300);
5254  hd0D0VSd0xd0TGHCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
5255  hd0D0VSd0xd0TGHCfromDstarpt->SetYTitle(" d_{0}^{D^{0}} [#mum]");
5256  flistTghCutsFromDstar->Add(hd0D0VSd0xd0TGHCfromDstarpt);
5257 
5258 
5259  namehist="hangletracksVSd0xd0TGHCfromDstar_pt";
5260  namehist+=i;
5261  titlehist="Angle between K and #pi tracks Vs d_{0}^{K}xd_{0}^{#pi} Tight Cuts FromDstar ptbin=";
5262  titlehist+=i;
5263  hangletracksVSd0xd0TGHCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-50000.,30000.,40,-0.1,3.24);
5264  hangletracksVSd0xd0TGHCfromDstarpt->SetXTitle(" d_{0}^{K}xd_{0}^{#pi} [#mum]");
5265  hangletracksVSd0xd0TGHCfromDstarpt->SetYTitle(" angle between K and #p tracks [rad]");
5266  flistTghCutsFromDstar->Add(hangletracksVSd0xd0TGHCfromDstarpt);
5267 
5268 
5269  namehist="hangletracksVSd0D0TGHCfromDstar_pt";
5270  namehist+=i;
5271  titlehist="Angle between K and #pi tracks Vs d_{0}^{D^{0}} Tight Cuts FromDstar ptbin=";
5272  titlehist+=i;
5273  hangletracksVSd0D0TGHCfromDstarpt=new TH2F(namehist.Data(),titlehist.Data(),200,-400.,400.,40,-0.12,3.24);
5274  hangletracksVSd0D0TGHCfromDstarpt->SetXTitle(" d_{0}^{D^{0}} [#mum]");
5275  hangletracksVSd0D0TGHCfromDstarpt->SetYTitle(" angle between K and #p tracks [rad]");
5276  flistTghCutsFromDstar->Add(hangletracksVSd0D0TGHCfromDstarpt);
5277 
5278 
5279  }
5280  // %%%%%%%% END OF NEW HISTOS %%%%%%%%%%%%%
5281  //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5282 
5283 
5284  //########## d0 D0 histos #############
5285  TH1F *hd0D0TGHCfromDstPM = new TH1F("hd0D0TGHCfromDstarPM","D^{0} impact par. plot , Tight Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
5286  hd0D0TGHCfromDstPM->SetXTitle("Impact parameter [#mum]");
5287  hd0D0TGHCfromDstPM->SetYTitle("Entries");
5288 
5289  TH1F *hd0D0VtxTrueTGHCfromDstPM = new TH1F("hd0D0VtxTrueTGHCfromDstarPM","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
5290  hd0D0VtxTrueTGHCfromDstPM->SetXTitle("Impact parameter [#mum]");
5291  hd0D0VtxTrueTGHCfromDstPM->SetYTitle("Entries");
5292 
5293  TH1F *hMCd0D0TGHCfromDstPM = new TH1F("hMCd0D0TGHCfromDstarPM","D^{0} impact par. plot, Tight Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
5294  hMCd0D0TGHCfromDstPM->SetXTitle("MC Impact parameter [#mum]");
5295  hMCd0D0TGHCfromDstPM->SetYTitle("Entries");
5296 
5297  TH1F *hd0D0TGHCfromDstSB = new TH1F("hd0D0TGHCfromDstarSB","D^{0} impact par. plot , Tight Cuts ,FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
5298  hd0D0TGHCfromDstSB->SetXTitle("Impact parameter [#mum]");
5299  hd0D0TGHCfromDstSB->SetYTitle("Entries");
5300 
5301  TH1F *hd0D0VtxTrueTGHCfromDstSB = new TH1F("hd0D0VtxTrueTGHCfromDstarSB","D^{0} impact par. w.r.t. True Vtx, Tight Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
5302  hd0D0VtxTrueTGHCfromDstSB->SetXTitle("Impact parameter [#mum]");
5303  hd0D0VtxTrueTGHCfromDstSB->SetYTitle("Entries");
5304 
5305  TH1F *hMCd0D0TGHCfromDstSB = new TH1F("hMCd0D0TGHCfromDstarSB","D^{0} impact par. plot, Tight Cuts, FromDStar,Mass Peak (All momenta)",1000,-1000.,1000.);
5306  hMCd0D0TGHCfromDstSB->SetXTitle("MC Impact parameter [#mum]");
5307  hMCd0D0TGHCfromDstSB->SetYTitle("Entries");
5308 
5309  flistTghCutsFromDstar->Add(hd0D0TGHCfromDstPM);
5310  flistTghCutsFromDstar->Add(hd0D0VtxTrueTGHCfromDstPM);
5311  flistTghCutsFromDstar->Add(hMCd0D0TGHCfromDstPM);
5312  flistTghCutsFromDstar->Add(hd0D0TGHCfromDstSB);
5313  flistTghCutsFromDstar->Add(hd0D0VtxTrueTGHCfromDstSB);
5314  flistTghCutsFromDstar->Add(hMCd0D0TGHCfromDstSB);
5315 
5316  TH1F *hd0D0ptTGHCfromDstPM;
5317  TH1F *hMCd0D0ptTGHCfromDstPM;
5318  TH1F *hd0D0VtxTrueptTGHCfromDstPM;
5319  TH1F *hd0D0ptTGHCfromDstSB;
5320  TH1F *hMCd0D0ptTGHCfromDstSB;
5321  TH1F *hd0D0VtxTrueptTGHCfromDstSB;
5322  namehist="hd0D0ptTGHCfromDstar_";
5323  titlehist="D^{0} impact par. plot, Tight Cuts, FromDStar, ";
5324  for(Int_t i=0;i<fnbins;i++){
5325  strnamept=namehist;
5326  strnamept.Append("PkMss_pt");
5327  strnamept+=i;
5328 
5329  strtitlept=titlehist;
5330  strtitlept.Append(" Mass Peak, ");
5331  strtitlept+=fptbins[i];
5332  strtitlept.Append("<= pt <");
5333  strtitlept+=fptbins[i+1];
5334  strtitlept.Append(" [GeV/c]");
5335 
5336  hd0D0ptTGHCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5337  hd0D0ptTGHCfromDstPM->SetXTitle("Impact parameter [#mum] ");
5338  hd0D0ptTGHCfromDstPM->SetYTitle("Entries");
5339  flistTghCutsFromDstar->Add(hd0D0ptTGHCfromDstPM);
5340 
5341  strnamept.ReplaceAll("hd0D0","hMCd0D0");
5342  hMCd0D0ptTGHCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5343  hMCd0D0ptTGHCfromDstPM->SetXTitle("MC Impact parameter [#mum] ");
5344  hMCd0D0ptTGHCfromDstPM->SetYTitle("Entries");
5345  flistTghCutsFromDstar->Add(hMCd0D0ptTGHCfromDstPM);
5346 
5347 
5348  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
5349  hd0D0VtxTrueptTGHCfromDstPM = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5350  hd0D0VtxTrueptTGHCfromDstPM->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
5351  hd0D0VtxTrueptTGHCfromDstPM->SetYTitle("Entries");
5352  flistTghCutsFromDstar->Add(hd0D0VtxTrueptTGHCfromDstPM);
5353 
5354  strnamept=namehist;
5355  strnamept.Append("SBMss_pt");
5356  strnamept+=i;
5357 
5358  strtitlept=titlehist;
5359  strtitlept.Append(" Side Bands, ");
5360  strtitlept+=fptbins[i];
5361  strtitlept.Append("<= pt <");
5362  strtitlept+=fptbins[i+1];
5363  strtitlept.Append(" [GeV/c]");
5364 
5365  hd0D0ptTGHCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5366  hd0D0ptTGHCfromDstSB->SetXTitle("Impact parameter [#mum] ");
5367  hd0D0ptTGHCfromDstSB->SetYTitle("Entries");
5368  flistTghCutsFromDstar->Add(hd0D0ptTGHCfromDstSB);
5369 
5370  strnamept.ReplaceAll("hd0D0","hMCd0D0");
5371  hMCd0D0ptTGHCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5372  hMCd0D0ptTGHCfromDstSB->SetXTitle("MC Impact parameter [#mum] ");
5373  hMCd0D0ptTGHCfromDstSB->SetYTitle("Entries");
5374  flistTghCutsFromDstar->Add(hMCd0D0ptTGHCfromDstSB);
5375 
5376  strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
5377  hd0D0VtxTrueptTGHCfromDstSB = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
5378  hd0D0VtxTrueptTGHCfromDstSB->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
5379  hd0D0VtxTrueptTGHCfromDstSB->SetYTitle("Entries");
5380  flistTghCutsFromDstar->Add(hd0D0VtxTrueptTGHCfromDstSB);
5381  }
5382 
5383 
5384  //############ TIGHT CUTS OTHER HISTOGRAMS ###########
5385  //
5386  //########### global properties histos ###########
5387 
5388  TH2F *hCPtaVSd0d0TGHCother=new TH2F("hCPtaVSd0d0TGHCother","hCPtaVSd0d0_TightCuts_other",1000,-100000.,100000.,100,-1.,1.);
5389  TH1F *hSecVtxZTGHCother=new TH1F("hSecVtxZTGHCother","hSecVtxZ_TightCuts_other",1000,-8.,8.);
5390  TH1F *hSecVtxXTGHCother=new TH1F("hSecVtxXTGHCother","hSecVtxX_TightCuts_other",1000,-3000.,3000.);
5391  TH1F *hSecVtxYTGHCother=new TH1F("hSecVtxYTGHCother","hSecVtxY_TightCuts_other",1000,-3000.,3000.);
5392  TH2F *hSecVtxXYTGHCother=new TH2F("hSecVtxXYTGHCother","hSecVtxXY_TightCuts_other",1000,-3000.,3000.,1000,-3000.,3000.);
5393  TH1F *hSecVtxPhiTGHCother=new TH1F("hSecVtxPhiTGHCother","hSecVtxPhi_TightCuts_other",180,-180.1,180.1);
5394  TH1F *hd0singlTrackTGHCother=new TH1F("hd0singlTrackTGHCother","hd0singlTrackTightCuts_Other",1000,-5000.,5000.);
5395  TH1F *hCPtaTGHCother=new TH1F("hCPtaTGHCother","hCPta_TightCuts_other",100,-1.,1.);
5396  TH1F *hd0xd0TGHCother=new TH1F("hd0xd0TGHCother","hd0xd0_TightCuts_other",1000,-100000.,100000.);
5397  TH1F *hMassTrueTGHCother=new TH1F("hMassTrueTGHCother","D^{0} MC inv. Mass Tight Cuts other(All momenta)",600,1.600,2.200);
5398  TH1F *hMassTGHCother=new TH1F("hMassTGHCother","D^{0} inv. Mass Tight Cuts other (All momenta)",600,1.600,2.200);
5399  hMassTGHCother->Sumw2();
5400  TH1F *hMassTrueTGHCotherPM=new TH1F("hMassTrueTGHCotherPM","D^{0} MC inv. Mass Tight Cuts other, Mass Peak. (All momenta)",600,1.600,2.200);
5401  TH1F *hMassTGHCotherPM=new TH1F("hMassTGHCotherPM","D^{0} inv. Mass Tight Cuts other (All momenta), MassPeak",600,1.600,2.200);
5402  hMassTGHCotherPM->Sumw2();
5403  TH1F *hMassTrueTGHCotherSB=new TH1F("hMassTrueTGHCotherSB","D^{0} MC inv. Mass in Side Bands Tight Cuts other(All momenta)",600,1.600,2.200);
5404  TH1F *hMassTGHCotherSB=new TH1F("hMassTGHCotherSB","D^{0} inv. Mass in Side Bands Tight Cuts other (All momenta)",600,1.600,2.200);
5405  hMassTGHCotherSB->Sumw2();
5406 
5407  flistTghCutsOther->Add(hCPtaVSd0d0TGHCother);
5408  flistTghCutsOther->Add(hSecVtxZTGHCother);
5409  flistTghCutsOther->Add(hSecVtxYTGHCother);
5410  flistTghCutsOther->Add(hSecVtxXTGHCother);
5411  flistTghCutsOther->Add(hSecVtxXYTGHCother);
5412  flistTghCutsOther->Add(hSecVtxPhiTGHCother);
5413  flistTghCutsOther->Add(hd0singlTrackTGHCother);
5414  flistTghCutsOther->Add(hCPtaTGHCother);
5415  flistTghCutsOther->Add(hd0xd0TGHCother);
5416  flistTghCutsOther->Add(hMassTrueTGHCother);
5417  flistTghCutsOther->Add(hMassTGHCother);
5418  flistTghCutsOther->Add(hMassTrueTGHCotherPM);
5419  flistTghCutsOther->Add(hMassTGHCotherPM);
5420  flistTghCutsOther->Add(hMassTrueTGHCotherSB);
5421  flistTghCutsOther->Add(hMassTGHCotherSB);
5422 
5423 
5424 
5425 
5426  //%%% NEW HISTOS %%%%%%%%%%%%%%%%
5427  TH1F *hdcaTGHCother=new TH1F("hdcaTGHCother","hdca_TightCuts_Other",100,0.,1000.);
5428  hdcaTGHCother->SetXTitle("dca [#mum]");
5429  hdcaTGHCother->SetYTitle("Entries");
5430  TH1F *hcosthetastarTGHCother=new TH1F("hcosthetastarTGHCother","hCosThetaStar_TightCuts_Other",50,-1.,1.);
5431  hcosthetastarTGHCother->SetXTitle("cos #theta^{*}");
5432  hcosthetastarTGHCother->SetYTitle("Entries");
5433  TH1F *hptD0TGHCother=new TH1F("hptD0TGHCother","D^{0} transverse momentum distribution",34,ptbinsD0arr);
543