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