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