BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtNT3.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4//
5// Module: EvtGen/EvtNT3.hh
6//
7// Description: Class to handle NTuple for three body decays
8// usage:
9// Users need to provide the MC and data file in NTuple style. The decays are described as
10// A-> x1 + x2 + x3
11// angular distribution: costheta1, costheta2 ,costheta3
12// mass distribution: m12, m13, and m23, here, m12 ==> mass of x1 and x2, etc.
13// these variables are defined as double type, the tree name is mc and data, repectively
14// Modification history:
15//
16// PING RG September 11, 2010 Module created
17//
18//------------------------------------------------------------------------
19#include "EvtGenBase/EvtNT3.hh"
20#include <stdlib.h>
21#include <string>
22#include <fstream>
23#include <iostream>
24
26 max=0;
27 Ncos=20;
28 chainMC = new TChain("mc");
29 chainDT = new TChain("data");
30
31 chainMC->SetDirectory(0);
32 chainDT->SetDirectory(0);
33
34 chainMC->Add(mcfile);
35 chainDT->Add(datafile);
36 //--MC
37 chainMC->SetBranchAddress("costheta1",&costheta1);
38 chainMC->SetBranchAddress("costheta2",&costheta2);
39 chainMC->SetBranchAddress("costheta3",&costheta3);
40 chainMC->SetBranchAddress("m12",&m12);
41 chainMC->SetBranchAddress("m13",&m13);
42 chainMC->SetBranchAddress("m23",&m23);
43 //--Data
44 chainDT->SetBranchAddress("costheta1",&costheta1);
45 chainDT->SetBranchAddress("costheta2",&costheta2);
46 chainDT->SetBranchAddress("costheta3",&costheta3);
47 chainDT->SetBranchAddress("m12",&m12);
48 chainDT->SetBranchAddress("m13",&m13);
49 chainDT->SetBranchAddress("m23",&m23);
50
51 entriesMC=(Int_t)chainMC->GetEntries();
52 entriesDT=(Int_t)chainDT->GetEntries();
53
54 m12_low=chainDT->GetMinimum("m12");
55 m13_low=chainDT->GetMinimum("m13");
56 m23_low=chainDT->GetMinimum("m23");
57
58 m12_up =chainDT->GetMaximum("m12");
59 m13_up =chainDT->GetMaximum("m13");
60 m23_up =chainDT->GetMaximum("m23");
61
62 Int_t ny=calculateBins(entriesDT); //bins in mass axisis (Y-axisis)
63
64 MC1 = new TH2F("myMC1","",Ncos,-1.0,1.0,ny,m23_low,m23_up); // costheta1 vs. m23
65 MC2 = new TH2F("myMC2","",Ncos,-1.0,1.0,ny,m13_low,m13_up); // costheta2 vs. m13
66 MC3 = new TH2F("myMC3","",Ncos,-1.0,1.0,ny,m12_low,m12_up); // costheta3 vs. m12
67
68 DT1 = new TH2F("myDT1","",Ncos,-1.0,1.0,ny,m23_low,m23_up); // costheta1 vs. m23
69 DT2 = new TH2F("myDT2","",Ncos,-1.0,1.0,ny,m13_low,m13_up); // costheta2 vs. m13
70 DT3 = new TH2F("myDT3","",Ncos,-1.0,1.0,ny,m12_low,m12_up); // costheta3 vs. m12
71
72 WT1 = new TH2F("myWT1","",Ncos,-1.0,1.0,ny,m23_low,m23_up); // costheta1 vs. m23
73 WT2 = new TH2F("myWT2","",Ncos,-1.0,1.0,ny,m13_low,m13_up); // costheta2 vs. m13
74 WT3 = new TH2F("myWT3","",Ncos,-1.0,1.0,ny,m12_low,m12_up); // costheta3 vs. m12
75
76 MC1->SetDirectory(0);
77 MC2->SetDirectory(0);
78 MC3->SetDirectory(0);
79
80 DT1->SetDirectory(0);
81 DT2->SetDirectory(0);
82 DT3->SetDirectory(0);
83
84 WT1->SetDirectory(0);
85 WT2->SetDirectory(0);
86 WT3->SetDirectory(0);
87
88 //filling MC histogram
89 for(Int_t j=0;j<entriesMC;j++) {
90 chainMC->GetEntry(j);
91 MC1->Fill(costheta1,m23);
92 MC2->Fill(costheta2,m13);
93 MC3->Fill(costheta3,m12);
94 }
95
96 //filling data histogram
97 for(Int_t j=0;j<entriesDT;j++) {
98 chainDT->GetEntry(j);
99 DT1->Fill(costheta1,m23);
100 DT2->Fill(costheta2,m13);
101 DT3->Fill(costheta3,m12);
102 }
103 //--------debugging ---------
104 // showFrame(MC1);
105 // showFrame(MC2);
106 // showFrame(MC3);
107
108 EvtHis2F::init(MC1,DT1,WT1);
109 WT1 = EvtHis2F::getHwt();
110 max1 = EvtHis2F::getZmax();
111
112 EvtHis2F::init(MC2,DT2,WT2);
113 WT2 = EvtHis2F::getHwt();
114 max2 = EvtHis2F::getZmax();
115
116 EvtHis2F::init(MC3,DT3,WT3);
117 WT3 = EvtHis2F::getHwt();
118 max3 = EvtHis2F::getZmax();
119
120 //------------
121
122 /*
123 show(WT1);
124 std::cout<<"================================================="<<std::endl;
125 show(WT2);
126 std::cout<<"================================================="<<std::endl;
127 show(WT3);
128 */
129
130}
131
132
133int EvtNT3::calculateBins(int entries){
134 int bins,ncell;
135 ncell=30; //at lease to require each cell to have 30 events
136 bins=entries/ncell/Ncos;
137 if(bins>100){bins=100;}
138 return bins;
139}
140
141
142bool EvtNT3::AR1(double costheta, double mass){
143 bool accept=false;
144 accept= EvtHis2F::AR(costheta,mass,max1,WT1);
145 //--- debugging
146 // std::cout<<"Max_mass= "<<getZmax()<<std::endl;
147
148 return accept;
149}
150
151bool EvtNT3::AR2(double costheta, double mass){
152 bool accept=false;
153 accept= EvtHis2F::AR(costheta,mass,max2,WT2);
154
155 return accept;
156}
157
158
159bool EvtNT3::AR3(double costheta, double mass){
160 bool accept=false;
161 accept= EvtHis2F::AR(costheta,mass,max3,WT3);
162
163 return accept;
164}
165
double mass
int bins[20]
void init()
Definition: EvtHis2F.cc:98
double getZmax()
Definition: EvtHis2F.cc:192
bool AR(double xmass2, double ymass2)
Definition: EvtHis2F.cc:205
TH2F * getHwt()
Definition: EvtHis2F.cc:63
bool AR3(double costheta, double mass)
Definition: EvtNT3.cc:159
bool AR2(double costheta, double mass)
Definition: EvtNT3.cc:151
int calculateBins(int entries)
Definition: EvtNT3.cc:133
bool AR1(double costheta, double mass)
Definition: EvtNT3.cc:142
void init()
Definition: EvtNT3.cc:25
float costheta