60 void GenerateDataEvent(
TRandom *rnd);
61 void GenerateSignalEvent(
TRandom *rnd);
62 void GenerateBgrEvent(
TRandom *rnd);
64 inline Double_t GetPtRec(
void)
const {
return fPtRec; }
65 inline Double_t GetEtaRec(
void)
const {
return fEtaRec; }
66 inline Double_t GetDiscriminator(
void)
const {
return fDiscriminator; }
67 inline Bool_t IsTriggered(
void)
const {
return fIsTriggered; }
70 inline Double_t GetPtGen(
void)
const {
71 if(IsSignal())
return fPtGen;
74 inline Double_t GetEtaGen(
void)
const {
75 if(IsSignal())
return fEtaGen;
78 inline Bool_t IsSignal(
void)
const {
return fIsSignal; }
83 void GenerateReco(
TRandom *rnd);
105 const Int_t neventData = 20000;
106 Double_t const neventSignalMC =2000000;
107 Double_t const neventBgrMC =2000000;
109 Float_t etaRec,ptRec,discr,etaGen,ptGen;
110 Int_t istriggered,issignal;
115 TFile *dataFile=
new TFile(
"testUnfold5_data.root",
"recreate");
116 TTree *dataTree=
new TTree(
"data",
"event");
118 dataTree->Branch(
"etarec",&etaRec,
"etarec/F");
119 dataTree->Branch(
"ptrec",&ptRec,
"ptrec/F");
120 dataTree->Branch(
"discr",&discr,
"discr/F");
123 dataTree->Branch(
"istriggered",&istriggered,
"istriggered/I");
125 dataTree->Branch(
"etagen",&etaGen,
"etagen/F");
126 dataTree->Branch(
"ptgen",&ptGen,
"ptgen/F");
127 dataTree->Branch(
"issignal",&issignal,
"issignal/I");
129 cout<<
"fill data tree\n";
131 Int_t nEvent=0,nTriggered=0;
132 while(nTriggered<neventData) {
134 event.GenerateDataEvent(g_rnd);
136 etaRec=
event.GetEtaRec();
137 ptRec=
event.GetPtRec();
138 discr=
event.GetDiscriminator();
139 istriggered=
event.IsTriggered() ? 1 : 0;
140 etaGen=
event.GetEtaGen();
141 ptGen=
event.GetPtGen();
142 issignal=
event.IsSignal() ? 1 : 0;
146 if(!(nEvent%100000)) cout<<
" data event "<<nEvent<<
"\n";
148 if(istriggered) nTriggered++;
160 TFile *signalFile=
new TFile(
"testUnfold5_signal.root",
"recreate");
161 TTree *signalTree=
new TTree(
"signal",
"event");
163 signalTree->Branch(
"etarec",&etaRec,
"etarec/F");
164 signalTree->Branch(
"ptrec",&ptRec,
"ptrec/F");
165 signalTree->Branch(
"discr",&discr,
"discr/F");
166 signalTree->Branch(
"istriggered",&istriggered,
"istriggered/I");
167 signalTree->Branch(
"etagen",&etaGen,
"etagen/F");
168 signalTree->Branch(
"ptgen",&ptGen,
"ptgen/F");
170 cout<<
"fill signal tree\n";
172 for(
int ievent=0;ievent<neventSignalMC;ievent++) {
174 event.GenerateSignalEvent(g_rnd);
176 etaRec=
event.GetEtaRec();
177 ptRec=
event.GetPtRec();
178 discr=
event.GetDiscriminator();
179 istriggered=
event.IsTriggered() ? 1 : 0;
180 etaGen=
event.GetEtaGen();
181 ptGen=
event.GetPtGen();
183 if(!(ievent%100000)) cout<<
" signal event "<<ievent<<
"\n";
195 TFile *bgrFile=
new TFile(
"testUnfold5_background.root",
"recreate");
196 TTree *bgrTree=
new TTree(
"background",
"event");
198 bgrTree->Branch(
"etarec",&etaRec,
"etarec/F");
199 bgrTree->Branch(
"ptrec",&ptRec,
"ptrec/F");
200 bgrTree->Branch(
"discr",&discr,
"discr/F");
201 bgrTree->Branch(
"istriggered",&istriggered,
"istriggered/I");
203 cout<<
"fill background tree\n";
205 for(
int ievent=0;ievent<neventBgrMC;ievent++) {
207 event.GenerateBgrEvent(g_rnd);
208 etaRec=
event.GetEtaRec();
209 ptRec=
event.GetPtRec();
210 discr=
event.GetDiscriminator();
211 istriggered=
event.IsTriggered() ? 1 : 0;
213 if(!(ievent%100000)) cout<<
" background event "<<ievent<<
"\n";
223 Double_t ToyEvent::kDataSignalFraction=0.8;
225 void ToyEvent::GenerateDataEvent(
TRandom *rnd) {
226 fIsSignal=rnd->
Uniform()<kDataSignalFraction;
228 GenerateSignalKinematics(rnd,
kTRUE);
230 GenerateBgrKinematics(rnd,
kTRUE);
235 void ToyEvent::GenerateSignalEvent(
TRandom *rnd) {
237 GenerateSignalKinematics(rnd,
kFALSE);
241 void ToyEvent::GenerateBgrEvent(
TRandom *rnd) {
243 GenerateBgrKinematics(rnd,
kFALSE);
247 void ToyEvent::GenerateSignalKinematics(
TRandom *rnd,
Bool_t isData) {
263 if(rnd->
Uniform()>=0.5) fEtaGen= -fEtaGen;
265 fEtaGen=rnd->
Uniform(-etaMax,etaMax);
268 Double_t T0=e_T0 + e_T0_eta*fEtaGen;
279 void ToyEvent::GenerateBgrKinematics(
TRandom *rnd,
Bool_t isData) {
282 fPtRec=rnd->
Exp(2.5);
286 void ToyEvent::GenerateReco(
TRandom *rnd) {
289 Double_t eGen=fPtGen*(expEta+1./expEta);
294 eRec=rnd->
Gaus(eGen,sigmaE);
297 fEtaRec=rnd->
Gaus(fEtaGen,sigmaEta);
298 fPtRec=eRec/(expEta+1./expEta);
300 Double_t tauDiscr=0.08-0.04/(1.+fPtRec/10.0);
302 fDiscriminator=1.0-rnd->
Exp(tauDiscr)+rnd->
Gaus(0.,sigmaDiscr);
303 }
while((fDiscriminator<=0.)||(fDiscriminator>=1.));
313 Double_t tauDiscr=0.15-0.05/(1.+fPtRec/5.0)+0.1*fEtaRec;
314 Double_t sigmaDiscr=0.02+0.01*fEtaRec;
315 fDiscriminator=rnd->
Exp(tauDiscr)+rnd->
Gaus(0.,sigmaDiscr);
316 }
while((fDiscriminator<=0.)||(fDiscriminator>=1.));
Random number generator class based on M.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
T etaMax()
Function providing the maximum possible value of pseudorapidity for a non-zero rho, in the Scalar type with the largest dynamic range.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
This is the base class for the ROOT Random number generators.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Double_t Sqrt(Double_t x)
virtual Double_t Exp(Double_t tau)
Returns an exponential deviate.