Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include <getopt.h>
#include <fstream>
#include <sstream>
#include <string>
#include "Examples/D0ToKsPipPim/D0ToKsPipPimHist.hh"
#include "Examples/D0ToKsPipPim/D0ToKsPipPimEventList.hh"
#include "PwaUtils/KinUtils.hh"
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TMath.h"
#include "TNtuple.h"
#include "TLorentzVector.h"
#include "ErrLogger/ErrLogger.hh"
D0ToKsPipPimHist::D0ToKsPipPimHist(boost::shared_ptr<const EvtDataBaseListNew> theEvtList) :
_theTFile(0),
_dalitzDataHist(0),
_dalitzMcHist(0),
_dalitzFittedHist(0),
_pippimMassDataHist(0),
_pippimMassMcHist(0),
_pippimMassFittedHist(0),
_KspipMassDataHist(0),
_KspipMassMcHist(0),
_KspipMassFittedHist(0),
_KspimMassDataHist(0),
_KspimMassMcHist(0),
_KspimMassFittedHist(0)
{
if(0==theEvtList){
Alert <<"D0ToKsPipPimEventList* theEvtList is a 0 pointer !!!!" ; // << endmsg;
exit(1);
}
initRootStuff();
const std::vector<EvtDataNew*> dataList=theEvtList->getDataVecs();
std::vector<EvtDataNew*>::const_iterator it=dataList.begin();
while(it!=dataList.end())
{
const double evtWeight=(*it)->evtWeight;
plotDalitz(_dalitzDataHist, (*it), evtWeight);
plotPiPi(_pippimMassDataHist, (*it), evtWeight );
plotKsPip(_KspipMassDataHist, (*it), evtWeight );
plotKsPim(_KspimMassDataHist, (*it), evtWeight );
++it;
}
const std::vector<EvtDataNew*> mcList=theEvtList->getMcVecs();
it=mcList.begin();
while(it!=mcList.end())
{
plotDalitz(_dalitzMcHist, (*it), 1.);
plotPiPi(_pippimMassMcHist, (*it), 1. );
plotKsPip(_KspipMassMcHist, (*it), 1. );
plotKsPim(_KspimMassMcHist, (*it), 1. );
++it;
}
}
D0ToKsPipPimHist::D0ToKsPipPimHist(boost::shared_ptr<AbsLhNew> theLh, fitParamsNew& theFitParms):
_theTFile(0),
_dalitzDataHist(0),
_dalitzMcHist(0),
_dalitzFittedHist(0),
_pippimMassDataHist(0),
_pippimMassMcHist(0),
_pippimMassFittedHist(0),
_KspipMassDataHist(0),
_KspipMassMcHist(0),
_KspipMassFittedHist(0),
_KspimMassDataHist(0),
_KspimMassMcHist(0),
_KspimMassFittedHist(0)
{
if(0==theLh){
Alert <<"AbsLh* is a 0 pointer !!!!" ; // << endmsg;
exit(1);
}
initRootStuff();
boost::shared_ptr<const EvtDataBaseListNew> theEvtList=theLh->getEventList();
const std::vector<EvtDataNew*> dataList=theEvtList->getDataVecs();
std::vector<EvtDataNew*>::const_iterator it=dataList.begin();
while(it!=dataList.end())
{
const double evtWeight=(*it)->evtWeight;
plotDalitz(_dalitzDataHist, (*it), evtWeight);
plotPiPi(_pippimMassDataHist, (*it), evtWeight );
plotKsPip(_KspipMassDataHist, (*it), evtWeight );
plotKsPim(_KspimMassDataHist, (*it), evtWeight );
++it;
}
const std::vector<EvtDataNew*> mcList=theEvtList->getMcVecs();
it=mcList.begin();
while(it!=mcList.end())
{
plotDalitz(_dalitzMcHist, (*it), 1.);
plotPiPi(_pippimMassMcHist, (*it), 1. );
plotKsPip(_KspipMassMcHist, (*it), 1. );
plotKsPim(_KspimMassMcHist, (*it), 1. );
double evtWeight= theLh->calcEvtIntensity( (*it), theFitParms );
plotDalitz(_dalitzFittedHist, (*it), evtWeight);
plotPiPi(_pippimMassFittedHist, (*it), evtWeight );
plotKsPip(_KspipMassFittedHist, (*it), evtWeight );
plotKsPim(_KspimMassFittedHist, (*it), evtWeight );
++it;
}
double integralDataWoWeight=(double) theEvtList->getDataVecs().size();
Info <<"No of data events without weight " << integralDataWoWeight ; // << endmsg;
double integralDataWWeight=(double) theEvtList->NoOfWeightedDataEvts();
Info <<"No of data events with weight " << integralDataWWeight ; // << endmsg;
double integralMC=(double) theEvtList->NoOfWeightedMcEvts();
Info <<"No of MC events " << integralMC ; // << endmsg;
Info <<"scaling factor " << integralDataWWeight/integralMC ; // << endmsg;
double scaleFactor = integralDataWWeight/integralMC;
_dalitzFittedHist->Scale(scaleFactor);
_pippimMassFittedHist->Scale(scaleFactor);
_KspipMassFittedHist->Scale(scaleFactor);
_KspimMassFittedHist->Scale(scaleFactor);
double integralFitted=(double) _pippimMassFittedHist->Integral();
Info <<"No of fit events " << integralFitted ; // << endmsg;
}
D0ToKsPipPimHist::~D0ToKsPipPimHist()
{
_theTFile->Write();
_theTFile->Close();
}
void D0ToKsPipPimHist::initRootStuff()
{
std::string rootFileName="./D0ToKsPipPim.root";
_theTFile=new TFile(rootFileName.c_str(),"recreate");
int xbins = 200;
double xmin=0.;
double xmax =3.2;
int ybins=xbins;
double ymin=xmin;
double ymax=xmax;
_dalitzDataHist= new TH2F("_dalitzDataHist","Dpl K_{s} #pi^{+} #pi^{-} data",xbins, xmin, xmax, ybins, ymin, ymax );
_dalitzMcHist= new TH2F("_dalitzMcHist","Dpl K_{s} #pi^{+} #pi^{-} MC",xbins, xmin, xmax, ybins, ymin, ymax);
_dalitzFittedHist= new TH2F("_dalitzFittedHist","Dpl K_{s} #pi^{+} #pi^{-} fit",xbins, xmin, xmax, ybins, ymin, ymax );
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
int nbins=200;
xmin=0.2;
xmax=1.5;
_pippimMassDataHist = new TH1F("_pippimMassDataHist", "M(#pi^{+} #pi^{-}) data", nbins, xmin, xmax);
_pippimMassMcHist = new TH1F("_pippimMassMcHist", "M(#pi^{+} #pi^{-}) MC", nbins, xmin, xmax);
_pippimMassFittedHist = new TH1F("_pippimMassFittedHist", "M(#pi^{+} #pi^{-}) fit", nbins, xmin, xmax);
nbins=200;
xmin=0.5;
xmax=1.8;
_KspipMassDataHist = new TH1F("_KspipMassDataHist", "M(K_{s} #pi^{+}) data", nbins, xmin, xmax);
_KspipMassMcHist = new TH1F("_KspipMassMcHist", "M(K_{s} #pi^{+}) MC", nbins, xmin, xmax);
_KspipMassFittedHist = new TH1F("_KspipMassFittedHist", "M(K_{s} #pi^{+}) fit", nbins, xmin, xmax);
_KspimMassDataHist = new TH1F("_KspimMassDataHist", "M(K_{s} #pi^{-}) data", nbins, xmin, xmax);
_KspimMassMcHist = new TH1F("_KspimMassMcHist", "M(K_{s} #pi^{-}) MC", nbins, xmin, xmax);
_KspimMassFittedHist = new TH1F("_KspimMassFittedHist", "M(K_{s} #pi^{-}) fit", nbins, xmin, xmax);
}
void D0ToKsPipPimHist::plotDalitz(TH2F* theHisto, EvtDataNew* theData, double weight)
{
Vector4<double>& V4_KsPip_HeliD0 = theData->FourVecsDec[enumD0KsPiPi4V::V4_KsPip_HeliD0] ;
Vector4<double>& V4_KsPim_HeliD0 = theData->FourVecsDec[enumD0KsPiPi4V::V4_KsPim_HeliD0] ;
theHisto->Fill( V4_KsPip_HeliD0.M()*V4_KsPip_HeliD0.M(), V4_KsPim_HeliD0.M()*V4_KsPim_HeliD0.M(),weight);
}
void D0ToKsPipPimHist::plotPiPi(TH1F* theHisto, EvtDataNew* theData, double weight){
Vector4<double> v4 = theData->FourVecsDec[enumD0KsPiPi4V::V4_PipPim_HeliD0];
theHisto->Fill( v4.M(), weight );
}
void D0ToKsPipPimHist::plotKsPip(TH1F* theHisto, EvtDataNew* theData, double weight){
Vector4<double>& v4 = theData->FourVecsDec[enumD0KsPiPi4V::V4_KsPip_HeliD0];
theHisto->Fill( v4.M(), weight );
}
void D0ToKsPipPimHist::plotKsPim(TH1F* theHisto, EvtDataNew* theData, double weight){
Vector4<double>& v4 = theData->FourVecsDec[enumD0KsPiPi4V::V4_KsPim_HeliD0];
theHisto->Fill( v4.M(), weight );
}