18 std::cout <<
"ElectronGenerator: generating " << m_nevents <<
" electrons" << std::endl;
19 std::cout <<
"\t\t" << m_upperbg <<
"\t" << m_lowerbg << std::endl;
34 double dedx_cur, dedx_res;
37 TTree* gentrack =
new TTree(
"track",
"Fake track sample");
39 gentrack->Branch(
"run",&run,
"run/I");
40 gentrack->Branch(
"numGoodHits",&nhit,
"numGoodHits/I");
41 gentrack->Branch(
"dedx",&dedxpub,
"dedx/D");
42 gentrack->Branch(
"dedxcur",&dedx_cur,
"dedxcur/D");
43 gentrack->Branch(
"dedxres",&dedx_res,
"dedxres/D");
44 gentrack->Branch(
"dedxsat",&dedx,
"dedxsat/D");
45 gentrack->Branch(
"q",&
q,
"q/D");
46 gentrack->Branch(
"pF",&p,
"pF/D");
47 gentrack->Branch(
"bg",&
bg,
"bg/D");
48 gentrack->Branch(
"costh",&costh,
"costh/D");
49 gentrack->Branch(
"db",&db,
"db/D");
50 gentrack->Branch(
"dz",&dz,
"dz/D");
51 gentrack->Branch(
"chiPi",&chiPi,
"chiPi/D");
52 gentrack->Branch(
"eopst",&eop,
"eopst/D");
55 TTree* genhit =
new TTree(
"hit",
"Fake hit sample");
57 const int kMaxHits = 100;
58 double doca[kMaxHits];
59 double enta[kMaxHits];
60 double dedxhit[kMaxHits];
62 genhit->Branch(
"numGoodHits",&nhit,
"numGoodHits/I");
63 genhit->Branch(
"doca",doca,
"doca[numGoodHits]/D");
64 genhit->Branch(
"enta",enta,
"enta[numGoodHits]/D");
65 genhit->Branch(
"dedxhit",dedxhit,
"dedxhit[numGoodHits]/D");
66 genhit->Branch(
"dedx",&dedxpub,
"dedx/D");
67 genhit->Branch(
"dedxsat",&dedx,
"dedxsat/D");
68 genhit->Branch(
"pF",&p,
"pF/D");
69 genhit->Branch(
"costh",&costh,
"costh/D");
70 genhit->Branch(
"db",&db,
"db/D");
71 genhit->Branch(
"dz",&dz,
"dz/D");
72 genhit->Branch(
"chiPi",&chiPi,
"chiPi/D");
74 TH2F* dedx_costh =
new TH2F(
"dedx_costh",
"dE/dx vs. cos(#theta);cos(#theta);dE/dx",
75 100,-1.0,1.0,100,0.0,10.0);
76 TH2F* dedx_pq =
new TH2F(
"dedx_pq",
"dE/dx vs. pq;pq [GeV];dE/dx",
77 100,-1.0*m_upperbg,m_upperbg,100,0.8,1.2);
79 TRandom *r0 =
new TRandom();
83 double mass = Widget::melectron;
85 TF1 empcor(
"empcor",
"1-0.15*TMath::Exp(-5*x)",0.2,2);
86 TF1 docashape(
"docashape",
"-78.3*x^2+75.5",-1,1);
87 TF1 enta1(
"enta1",
"1500*TMath::Landau(x,0.125,0.05)",0,3);
88 TF1 enta2(
"enta2",
"2000*TMath::Landau(TMath::Abs(x),0.125,0.05)",-3,0);
89 TF1 entashape(
"entashape",
"enta1+enta2",-3,3);
90 TF1 satshape(
"satshape",
"1.0-2.0*TMath::Landau(TMath::Abs(x),0.01,0.05)",-1,1);
93 for(
int i = 0; i < m_nevents; ++i ){
95 std::cout << i <<
" events" << std::endl;
99 double q = (r0->Rndm(i) < 0.5) ? -1.0 : 1.0;
101 p = r0->Rndm(i)*(m_upperbg-m_lowerbg)+m_lowerbg;
102 while( p < m_lowerbg || p > m_upperbg )
103 p = r0->Rndm(i)*(m_upperbg-m_lowerbg)+m_lowerbg;
106 costh = 2*(r0->Rndm(i))-1;
107 while( costh < -1.0 || costh > 1.0 )
108 costh = 2*(r0->Rndm(i))-1;
110 dedx = (
q < 0) ? (2 - empcor.Eval(p)) : empcor.Eval(p);
111 dedx = dedx*satshape.Eval(costh);
113 dedx_res = 1.05-empcor.Eval(p);
116 while( nhit > 100 || nhit < 0 )
119 chiPi = r0->Gaus(1.0);
121 for(
int j = 0; j < nhit; ++j ){
122 enta[j] = entashape.GetRandom();
123 doca[j] = docashape.GetRandom();
124 dedxhit[j] = r0->Landau(dedx,dedx_res);
129 dedx_costh->Fill(costh,dedx);
130 dedx_pq->Fill(p*
q,dedx);
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
void generateEvents(TFile *outfile)