BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
Ekhara Class Reference

#include <Ekhara.h>

+ Inheritance diagram for Ekhara:

Public Member Functions

 Ekhara (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 19 of file Ekhara.h.

Constructor & Destructor Documentation

◆ Ekhara()

Ekhara::Ekhara ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 83 of file Ekhara.cxx.

83 : Algorithm(name, pSvcLocator)
84{
85 declareProperty( "Ecm", m_E = 1.02 ); // CMS-energy (GeV)
86 declareProperty( "InitialSeed", m_initSeed = 100);
87 declareProperty( "InitialEvents", m_ngUpperBound = 50000 ); // # of events to determine the maximum
88 declareProperty( "Channel", m_channel_id = 2 ); // pi+pi-(1),pi0(2),, eta(3), eta' (4)
89 declareProperty( "Thetaminpositron", cut_th1min = 0.00 ); //minimum angle e+
90 declareProperty( "Thetamaxpositron", cut_th1max = 180.00 ); //maximum angle e+
91 declareProperty( "Energyminpositron", cut_E1min = 0.00 ); //minimum Energy e+
92 declareProperty( "Energymaxpositron", cut_E1max = 110.00 ); //maximum Energy e+
93 declareProperty( "Thetaminelectron", cut_th2min = 0.00 ); //minimum angle e-
94 declareProperty( "Thetamaxelectron", cut_th2max = 180.00 ); //maximum angle e-
95 declareProperty( "Energyminelectron", cut_E2min = 0.00 ); //minimum Energy e-
96 declareProperty( "Energymaxelectron", cut_E2max = 110.00 ); //maximum Energy e-
97 declareProperty( "Thetaminpion", cut_thpionmin = 0.00 ); //minimum angle pi0
98 declareProperty( "Thetamaxpion", cut_thpionmax = 180.00 ); //maximum angle pi0
99 declareProperty( "Eminpion", cut_Epionmin = 0.00 ); //minimum Energy pi0
100 declareProperty( "Emaxpion", cut_Epionmax = 100.00 ); //maximum Energy pi0
101 declareProperty( "sw_silent", m_sw_silent = 1 ); //suppress output to stdout
102 declareProperty( "sw_2pi", m_sw_2pi = 2 ); // s (1); t (2); s+t (3); s = signal
103 declareProperty( "sw_1pi", m_sw_1pi = 2 ); // s (1); t (2); s+t (3); s = signal
104 declareProperty( "sw", m_sw = 2 );
105 declareProperty( "Formfactor", m_piggFFsw = 5 );
106 //
107}

Member Function Documentation

◆ execute()

StatusCode Ekhara::execute ( )

Definition at line 199 of file Ekhara.cxx.

199 {
200 MsgStream log(msgSvc(), name());
201 log << MSG::INFO << "Ekhara in execute()" << endreq;
202
203 EKHARA(0);
204
205 //std::ofstream file1;
206 //file1.open("file1.txt");
207
208
209 double p1[4],p2[4],q1[4],q2[4];
210 double pi1[4],pi2[4],qpion[4];
211
212 for (int i=0;i<4;i++) {
213 p1[i]=0.0;
214 p2[i]=0.0;
215 q1[i]=0.0;
216 q2[i]=0.0;
217 pi1[i]=0.0;
218 pi2[i]=0.0;
219 qpion[i]=0.0;
220 }
221
222 GET_MOMENTUM(p1,p2,q1,q2,pi1,pi2,qpion);
223
224 double PosiMom = sqrt(q1[1]*q1[1]+q1[2]*q1[2]+q1[3]*q1[3]);
225 double PosiThe = acos(q1[3]/PosiMom);
226 double PosiPhi = atan2(q1[2],q1[1]);
227
228 double ElecMom = sqrt(q2[1]*q2[1]+q2[2]*q2[2]+q2[3]*q2[3]);
229 double ElecThe = acos(q2[3]/ElecMom);
230 double ElecPhi = atan2(q2[2],q2[1]);
231
232 double EtaPMom = sqrt(qpion[1]*qpion[1]+qpion[2]*qpion[2]+qpion[3]*qpion[3]);
233 double EtaPThe = acos(qpion[3]/EtaPMom);
234 double EtaPPhi = atan2(qpion[2],qpion[1]);
235
236 hMCPosiMom->fill(PosiMom);
237 hMCElecMom->fill(ElecMom);
238 hMCEtaPMom->fill(EtaPMom);
239
240 hMCPosiPhi->fill(PosiPhi*TMath::RadToDeg());
241 hMCElecPhi->fill(ElecPhi*TMath::RadToDeg());
242 hMCEtaPPhi->fill(EtaPPhi*TMath::RadToDeg());
243
244 hMCPosiThe->fill(PosiThe*TMath::RadToDeg());
245 hMCElecThe->fill(ElecThe*TMath::RadToDeg());
246 hMCEtaPThe->fill(EtaPThe*TMath::RadToDeg());
247
248
249
250 // Fill event information
251 GenEvent* evt = new GenEvent(1,1);
252
253 GenVertex* prod_vtx = new GenVertex();
254 evt->add_vertex( prod_vtx );
255
256 // incoming beam e+
257 GenParticle* p = new GenParticle( HepLorentzVector(p1[1],p1[2],p1[3],p1[0]), -11, 3);
258 p->suggest_barcode(1 );
259 prod_vtx->add_particle_in(p);
260
261 // incoming beam e-
262 p = new GenParticle(HepLorentzVector(p2[1],p2[2],p2[3],p2[0]), 11, 3);
263 p->suggest_barcode( 2 );
264 prod_vtx->add_particle_in(p);
265
266
267 // outcoming beam e+
268 p = new GenParticle(HepLorentzVector(q1[1],q1[2],q1[3],q1[0]), -11, 1);
269 p->suggest_barcode(3 );
270 prod_vtx->add_particle_out(p);
271
272 // outcoming beam e-
273 p = new GenParticle( HepLorentzVector(q2[1],q2[2],q2[3],q2[0] ), 11, 1);
274 p->suggest_barcode( 4 );
275 prod_vtx->add_particle_out(p);
276
277 if (m_channel_id == 2){ //e+e- pi0
278 p = new GenParticle( HepLorentzVector( qpion[1],qpion[2],qpion[3],qpion[0]), 111, 1);
279 p->suggest_barcode( 5 );
280 prod_vtx->add_particle_out(p);
281 }
282 else if (m_channel_id == 3){ //e+e- eta
283 p = new GenParticle( HepLorentzVector( qpion[1],qpion[2],qpion[3],qpion[0]), 221, 1);
284 p->suggest_barcode( 5 );
285 prod_vtx->add_particle_out(p);
286 }
287 else if (m_channel_id == 4){ //e+e- eta'
288 p = new GenParticle( HepLorentzVector( qpion[1],qpion[2],qpion[3],qpion[0]), 331, 1);
289 p->suggest_barcode( 5 );
290 prod_vtx->add_particle_out(p);
291 }
292 else if (m_channel_id == 1) { // e+e-pi+ pi-
293 // pi+
294 p = new GenParticle( HepLorentzVector( pi1[1],pi1[2],pi1[3],pi1[0]),211, 1);
295 p->suggest_barcode( 5 );
296 prod_vtx->add_particle_out(p);
297 // pi-
298 p = new GenParticle( HepLorentzVector(pi2[1],pi2[2],pi2[3],pi2[0]), -211, 1);
299 p->suggest_barcode( 6 );
300 prod_vtx->add_particle_out(p);
301 }
302
303 if( log.level() <= MSG::INFO )
304 {
305
306 evt->print();
307
308 // file1<<qpion[1]<<endl;
309
310 }
311
312 // Check if the McCollection already exists
313 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
314 if (anMcCol!=0)
315 {
316 // Add event to existing collection
317 MsgStream log(messageService(), name());
318 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
319 McGenEvent* mcEvent = new McGenEvent(evt);
320 anMcCol->push_back(mcEvent);
321 }
322 else
323 {
324 // Create Collection and add to the transient store
325 McGenEventCol *mcColl = new McGenEventCol;
326 McGenEvent* mcEvent = new McGenEvent(evt);
327 mcColl->push_back(mcEvent);
328 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
329 if (sc != StatusCode::SUCCESS)
330 {
331 log << MSG::ERROR << "Could not register McGenEvent" << endreq;
332 delete mcColl;
333 delete evt;
334 delete mcEvent;
335 return StatusCode::FAILURE;
336 }
337 else
338 {
339 log << MSG::INFO << "McGenEventCol created " << endreq;
340 }
341 //file1.close();
342 }
343
344 log<<MSG::INFO<< "before execute() return"<<endreq;
345 return StatusCode::SUCCESS;
346
347}
#define GET_MOMENTUM(p1, p2, q1, q2, pi1, pi2, qpion)
Definition: Ekhara.cxx:81
#define EKHARA(i)
Definition: Ekhara.cxx:69
ObjectVector< McGenEvent > McGenEventCol
Definition: McGenEvent.h:39
IMessageSvc * msgSvc()

◆ finalize()

StatusCode Ekhara::finalize ( )

Definition at line 349 of file Ekhara.cxx.

349 {
350 MsgStream log(msgSvc(), name());
351 log << MSG::INFO << "Ekhara in finalize()" << endreq;
352 log << MSG::INFO << "Ekhara is terminated now successfully" << endreq;
353 DIAGNOSE();
354 EKHARA(1);
355 return StatusCode::SUCCESS;
356}
#define DIAGNOSE()
Definition: Ekhara.cxx:75

◆ initialize()

StatusCode Ekhara::initialize ( )

Definition at line 109 of file Ekhara.cxx.

109 {
110 MsgStream log(msgSvc(), name());
111 log << MSG::INFO << "Ekhara in initialize()" << endreq;
112
113
114 hMCPosiMom = histoSvc()->book("MonteCarlo",1,"PosiMom",250,0.,5.);
115 hMCPosiThe = histoSvc()->book("MonteCarlo",2,"PosiThe",45,0.,180.);
116 hMCPosiPhi = histoSvc()->book("MonteCarlo",3,"PosiPhi",90,-180.,180.);
117 hMCElecMom = histoSvc()->book("MonteCarlo",4,"ElecMom",250,0.,5.);
118 hMCElecThe = histoSvc()->book("MonteCarlo",5,"ElecThe",45,0.,180.);
119 hMCElecPhi = histoSvc()->book("MonteCarlo",6,"ElecPhi",90,-180.,180.);
120 hMCEtaPMom = histoSvc()->book("MonteCarlo",7,"EtaPMom",250,0.,5.);
121 hMCEtaPThe = histoSvc()->book("MonteCarlo",8,"EtaPThe",45,0.,180.);
122 hMCEtaPPhi = histoSvc()->book("MonteCarlo",9,"EtaPPhi",90,-180.,180.);
123
124
125 //set Bes unified random engine
126 static const bool CREATEIFNOTTHERE(true);
127 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
128 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
129 {
130 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
131 return RndmStatus;
132 }
133 HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("Ekhara");
135
136 CHANNELSEL.channel_id = m_channel_id;
137 SWDIAG.sw_2pi=m_sw_2pi;
138 SWDIAG.sw_1pi=m_sw_1pi;
139 PIONFFSW.piggFFsw=m_piggFFsw;
140 /*
141 if(m_channel_id==1){
142 m_sw=m_sw_2pi;}
143 else if(m_channel_id==2||m_channel_id==3||m_channel_id==4){
144 m_sw=m_sw_1pi;}
145 */
146
147// --- print run data ------------------------------
148 cout << "-------------------------------------------------------------" << endl;
149 if (CHANNELSEL.channel_id == 2)
150 cout << " EKHARA 2.1 : e^+ e^- -> e^+ e^- pi^0" << endl;
151 else if (CHANNELSEL.channel_id == 1)
152 cout << " EKHARA 2.1: e^+ e^- -> e^+ e^- pi^+ pi^-" << endl;
153 else if (CHANNELSEL.channel_id == 3)
154 cout << " EKHARA 2.1: e^+ e^- -> e^+ e^- eta" << endl;
155 else if (CHANNELSEL.channel_id == 4)
156 cout << " EKHARA 2.1: e^+ e^- -> e^+ e^- eta'" << endl;
157
158
159 if(m_channel_id ==2||m_channel_id ==3||m_channel_id ==4)
160 printf(" %s %f,%f\n","angular cuts on e+ = ",cut_th1min,cut_th1max);
161 printf(" %s %f,%f\n","angular cuts on e- = ",cut_th2min,cut_th2max);
162 printf(" %s %f,%f\n","Energy cuts on e+ = ",cut_E1min,cut_E1max);
163 printf(" %s %f,%f\n","Energy cuts on e- = ",cut_E2min,cut_E2max);
164 //---------------------------------
165
166 double xpar[100];
167 xpar[0]=m_E;
168
169 xpar[1]=m_ngUpperBound;
170 xpar[2]=m_channel_id;
171 xpar[3]=cut_th1min;
172 xpar[4]=cut_th1max;
173 xpar[5]=cut_E1min;
174 xpar[6]=cut_E1max;
175 xpar[7]=cut_th2min;
176 xpar[8]=cut_th2max;
177 xpar[9]=cut_E2min;
178 xpar[10]=cut_E2max;
179 xpar[11]=cut_thpionmin;
180 xpar[12]=cut_thpionmax;
181 xpar[13]=cut_Epionmin;
182 xpar[14]=cut_Epionmax;
183
184 log << MSG::DEBUG << "Options filled in array" << endreq;
185 BOSS_INIT_READ(xpar);
186 log << MSG::DEBUG << "Options read by FORTRAN routine" << endreq;
187 DIAGNOSE();
188 log << MSG::DEBUG << "FORTRAN diagnose passed" << endreq;
189 EKHARA(-1);
190 log << MSG::DEBUG << "Ekhara Fortran routines initialized" << endreq;
191 //EKHARA_SET_ONE_EVENT_MODE();
192 //log << MSG::DEBUG << "Ekhara set to single event mode" << endreq;
193 // EKHARA_SET_SILENT();
194 //log << MSG::DEBUG << "Ekhara set to silent operation" << endreq;
195
196 return StatusCode::SUCCESS;
197}
#define CHANNELSEL
Definition: Ekhara.cxx:45
#define SWDIAG
Definition: Ekhara.cxx:53
#define PIONFFSW
Definition: Ekhara.cxx:61
#define BOSS_INIT_READ(xpar)
Definition: Ekhara.cxx:72
IHistogramSvc * histoSvc()
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.

The documentation for this class was generated from the following files: