CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtMassH1.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of models developed at BES collaboration
5// based on the EvtGen framework. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/BesCopyright
9// Copyright (A) 2006 Ping Rong-Gang @IHEP
10//
11// Module: EvtMassH1.cc
12//
13// Description: Routine to decay a particle using the invariant mass distribution of histogram
14// dimension one.
15//
16// Modification history:
17//
18// Ping R.-G. December, 2006 Module created
19//
20//------------------------------------------------------------------------
21//
23#include <stdlib.h>
26#include "EvtGenBase/EvtPDL.hh"
43#include <string>
44
45#include "TH1.h"
46#include "TAxis.h"
47#include "TH2.h"
48#include "TFile.h"
49#include "TApplication.h"
50#include "TROOT.h"
51//#include "CLHEP/config/CLHEP.h"
52//#include "CLHEP/config/TemplateFunctions.h"
53
54
55using std::endl;
56
58
59void EvtMassH1::getName(std::string& model_name){
60
61 model_name="MassH1";
62
63}
64
66
67 return new EvtMassH1;
68
69}
70
71
73
74 // check that there are 4 arguments: Invariant mass part. Index: i,j, histor. file name, Hid
75 checkNArg(0);
77}
79
80 noProbMax();
81
82}
83
85
86 const char* fl=setFileName();
87 const char* hp=setHpoint();
88 int* dp;
89 dp=setDaugPair();
90 int d1=dp[0];
91 int d2=dp[1];
92
93 TFile f(fl);
94 TH1F *hid = (TH1F*)f.Get(hp);
95 TAxis* xaxis = hid->GetXaxis();
96
97 double BLE =xaxis->GetBinLowEdge(1);
98 int BINS =xaxis->GetLast();
99// double yvalue[BINS+2],ymax=0.0;
100 double yvalue[20000],ymax=0.0;
101 int i;
102// double Ntotal=0,yc[BINS+2];
103 double Ntotal=0,yc[20000];
104
105 for(i=1;i<BINS+1;i++){
106 yvalue[i]=hid->GetBinContent(i);
107 if(yvalue[i]>ymax) ymax=yvalue[i];
108 }
109
110
111loop:
113
114 EvtParticle *v,*s1;
115 EvtVector4R pv,ps;
116 double ppr;
117
118 v =p->getDaug(d1);
119 s1=p->getDaug(d2);
120 pv=v->getP4Lab();
121 ps=s1->getP4Lab();
122 ppr=(pv+ps).mass();
123
124 int xbin =hid->FindBin(ppr);
125 double xratio=(hid->GetBinContent(xbin))/ymax;
126
127 double rd1=EvtRandom::Flat(0.0, 1.0);
128 if(rd1>xratio) goto loop;
129 return ;
130}
131
132
double mass
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
void noProbMax()
EvtId getParentId()
Definition: EvtDecayBase.hh:60
EvtId * getDaugs()
Definition: EvtDecayBase.hh:65
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
EvtDecayBase * clone()
Definition: EvtMassH1.cc:65
int * setDaugPair()
Definition: UserMassH1.cc:24
void init()
Definition: EvtMassH1.cc:72
void getName(std::string &name)
Definition: EvtMassH1.cc:59
const char * setFileName()
Definition: UserMassH1.cc:11
virtual ~EvtMassH1()
Definition: EvtMassH1.cc:57
void decay(EvtParticle *p)
Definition: EvtMassH1.cc:84
void initProbMax()
Definition: EvtMassH1.cc:78
const char * setHpoint()
Definition: UserMassH1.cc:18
static EvtSpinType::spintype getSpinType(EvtId i)
Definition: EvtPDL.hh:61
EvtVector4R getP4Lab()
Definition: EvtParticle.cc:683
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
static double Flat()
Definition: EvtRandom.cc:73