BOSS 8.0.0
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//
22#include "EvtMassH1.hh"
42#include <stdlib.h>
43#include <string>
44
45#include "TApplication.h"
46#include "TAxis.h"
47#include "TFile.h"
48#include "TH1.h"
49#include "TH2.h"
50#include "TROOT.h"
51// #include "CLHEP/config/CLHEP.h"
52// #include "CLHEP/config/TemplateFunctions.h"
53
54using std::endl;
55
57
58void EvtMassH1::getName( std::string& model_name ) { model_name = "MassH1"; }
59
61
63
64 // check that there are 4 arguments: Invariant mass part. Index: i,j, histor. file name, Hid
65 checkNArg( 0 );
67}
69
71
72 const char* fl = setFileName();
73 const char* hp = setHpoint();
74 int* dp;
75 dp = setDaugPair();
76 int d1 = dp[0];
77 int d2 = dp[1];
78
79 TFile f( fl );
80 TH1F* hid = (TH1F*)f.Get( hp );
81 TAxis* xaxis = hid->GetXaxis();
82
83 double BLE = xaxis->GetBinLowEdge( 1 );
84 int BINS = xaxis->GetLast();
85 // double yvalue[BINS+2],ymax=0.0;
86 double yvalue[20000], ymax = 0.0;
87 int i;
88 // double Ntotal=0,yc[BINS+2];
89 double Ntotal = 0, yc[20000];
90
91 for ( i = 1; i < BINS + 1; i++ )
92 {
93 yvalue[i] = hid->GetBinContent( i );
94 if ( yvalue[i] > ymax ) ymax = yvalue[i];
95 }
96
97loop:
99
100 EvtParticle *v, *s1;
101 EvtVector4R pv, ps;
102 double ppr;
103
104 v = p->getDaug( d1 );
105 s1 = p->getDaug( d2 );
106 pv = v->getP4Lab();
107 ps = s1->getP4Lab();
108 ppr = ( pv + ps ).mass();
109
110 int xbin = hid->FindBin( ppr );
111 double xratio = ( hid->GetBinContent( xbin ) ) / ymax;
112
113 double rd1 = EvtRandom::Flat( 0.0, 1.0 );
114 if ( rd1 > xratio ) goto loop;
115 return;
116}
double mass
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
**********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
EvtId getParentId()
EvtId * getDaugs()
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
EvtDecayBase * clone()
Definition EvtMassH1.cc:60
int * setDaugPair()
Definition UserMassH1.cc:24
void init()
Definition EvtMassH1.cc:62
void getName(std::string &name)
Definition EvtMassH1.cc:58
const char * setFileName()
Definition UserMassH1.cc:11
virtual ~EvtMassH1()
Definition EvtMassH1.cc:56
void decay(EvtParticle *p)
Definition EvtMassH1.cc:70
void initProbMax()
Definition EvtMassH1.cc:68
const char * setHpoint()
Definition UserMassH1.cc:18
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.hh:66
EvtVector4R getP4Lab()
EvtParticle * getDaug(int i)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
static double Flat()
Definition EvtRandom.cc:69