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