BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesBdkRc Class Reference

#include <BesBdkRc.h>

Inheritance diagram for BesBdkRc:

Public Member Functions

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

Detailed Description

Definition at line 21 of file BesBdkRc.h.

Constructor & Destructor Documentation

◆ BesBdkRc()

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

Definition at line 126 of file BesBdkRc.cxx.

127 : Algorithm( name, pSvcLocator ) {
128 // declareProperty("InitialSeed",m_iseed=1001);
129 declareProperty( "CMEnergy", m_CMEnergy = 3.097 ); // 2*Ebeam [GeV]
130 declareProperty( "W2min", m_w2min = 0.02 ); // Cut on invariant gamma-gamma mass
131 declareProperty( "EstimatedMaxWeight", m_ewe = 2.5 );
132 declareProperty( "SoftPhotonMaxEnergy", m_kzero = 0.002 );
133 qmass[0] = 0.2;
134 qmass[1] = 0.2;
135 qmass[2] = 0.5;
136 qmass[3] = 1.5;
137 qmass[4] = 4.5;
138 qmass[5] = 180.;
139 declareProperty( "MaxNTry", m_maxNTry );
140 declareProperty( "FinalState", m_ifinal );
141 declareProperty( "MinTheta", m_tcmin );
142 declareProperty( "MinMomentum", m_pcmin );
143
144 m_numberEvent = 0;
145 toRad = M_PI / 180.0;
146 toDeg = 180.0 / M_PI;
147}
#define M_PI
Definition TConstant.h:4

Member Function Documentation

◆ execute()

StatusCode BesBdkRc::execute ( )

Definition at line 189 of file BesBdkRc.cxx.

189 {
190 MsgStream log( msgSvc(), name() );
191 log << MSG::INFO << "BesBdkRc executing" << endmsg;
192 HepMC::HEPEVT_Wrapper::set_max_number_entries( 2000 );
193 HepMC::HEPEVT_Wrapper::set_sizeof_real( 8 );
194 HepMC::IO_HEPEVT HepEvtIO;
195
196 HEPEVT_CLEAN();
197 GEN1EVT();
198
199 if ( FLAGS.GOODEVT != 1 )
200 {
201 log << MSG::ERROR << " BesBdkRc: fail to generate good event" << endl;
202 return StatusCode::FAILURE;
203 }
204
205 m_numberEvent++;
206 if ( log.level() < MSG::INFO ) LULIST( 1 );
207 // LULIST(1);
208 LUHEPC( 1 );
209 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
210 evt->set_event_number( m_numberEvent );
211 evt->set_signal_process_id( 1 );
212 // evt->print();
213 // Check if the McCollection already exists
214 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(), "/Event/Gen" );
215 if ( anMcCol != 0 )
216 {
217 // Add event to existing collection
218 MsgStream log( msgSvc(), name() );
219 log << MSG::INFO << "Add McGenEvent to existing collection" << endmsg;
220 McGenEvent* mcEvent = new McGenEvent( evt );
221 anMcCol->push_back( mcEvent );
222 }
223 else
224 {
225 // Create Collection and add to the transient store
226 McGenEventCol* mcColl = new McGenEventCol;
227 McGenEvent* mcEvent = new McGenEvent( evt );
228 mcColl->push_back( mcEvent );
229 StatusCode sc = eventSvc()->registerObject( "/Event/Gen", mcColl );
230 if ( sc != StatusCode::SUCCESS )
231 {
232 log << MSG::ERROR << "Could not register McGenEvent" << endmsg;
233 delete mcColl;
234 delete evt;
235 delete mcEvent;
236 return StatusCode::FAILURE;
237 }
238 }
239 // string s;
240 // getline(cin,s);
241
242 return StatusCode::SUCCESS;
243}
#define LULIST(ICONV)
Definition BesBdkRc.cxx:93
#define FLAGS
Definition BesBdkRc.cxx:78
#define GEN1EVT()
Definition BesBdkRc.cxx:116
#define LUHEPC(ICONV)
Definition BesBdkRc.cxx:90
#define HEPEVT_CLEAN()
Definition BesBdkRc.cxx:96
ObjectVector< McGenEvent > McGenEventCol
IMessageSvc * msgSvc()

◆ finalize()

StatusCode BesBdkRc::finalize ( )

Definition at line 245 of file BesBdkRc.cxx.

245 {
246 MsgStream log( msgSvc(), name() );
247 log << MSG::INFO << "BesBdkRc finalized" << endmsg;
248 int itot;
249 itot = XSECTC.ITOT;
250 double cstot;
251 double cserr;
252 FINISH( itot, cstot, cserr );
253 float effcut = 0;
254 float cscut = 0;
255 float efferr = 0;
256 float cscuterr = 0;
257 if ( XSECTC.NEVUNW )
258 {
259 effcut = float( DELPHC.NEVCUT ) / float( XSECTC.NEVUNW );
260 cscut = effcut * cstot;
261 efferr = sqrt( effcut * ( 1.0 - effcut ) / float( XSECTC.NEVUNW ) );
262 cscuterr = sqrt( cstot * efferr * cstot * efferr + effcut * effcut * cserr * cserr );
263 }
264 printf( "BDKRC SUMMARY: Cross section after user cuts= %G +- %G nb\n", cscut, cscuterr );
265 printf( " Cut acceptance = %G +- %G \n", effcut, efferr );
266 return StatusCode::SUCCESS;
267}
#define DELPHC
Definition BesBdkRc.cxx:64
#define FINISH(IN, SIGT, ER)
Definition BesBdkRc.cxx:105
#define XSECTC
Definition BesBdkRc.cxx:72

◆ initialize()

StatusCode BesBdkRc::initialize ( )

Definition at line 149 of file BesBdkRc.cxx.

149 {
150 MsgStream log( msgSvc(), name() );
151 log << MSG::WARNING << "BesBdkRc initialize" << endmsg;
152
153 static const bool CREATEIFNOTTHERE( true );
154 StatusCode RndmStatus = service( "BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE );
155 if ( !RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc )
156 {
157 log << MSG::ERROR << " Could not initialize Random Number Service" << endmsg;
158 return RndmStatus;
159 }
160 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine( "BesBdkRc" );
161 engine->showStatus();
163
164 //"INIT" subroutine action is replaced by c++ code
165 // for gen_init fortran code is called
166
167 FINCUT.TCHMIN = m_tcmin * toRad;
168 FINCUT.PCHMIN = m_pcmin;
169 // RLUXGO(3,m_iseed,0,0);
170
171 DELPHC.MAXNTRY = m_maxNTry;
172
173 COLCHC.IFINAL = m_ifinal;
174
175 INPUT.EB = 0.5 * m_CMEnergy;
176
177 LOCALC.W2MINR = m_w2min;
178 LOCALC.EBEAM = 0.5 * m_CMEnergy;
179 LOCALC.MAXESW = m_ewe;
180 LOCALC.KZERO = m_kzero;
181 // LOCALC.ISEED=m_iseed;
182 for ( int i = 0; i < 6; i++ ) LOCALC.QMASS[i] = qmass[i];
183 GEN_INIT();
184 XSECTC.NEVUNW = 0;
185
186 return StatusCode::SUCCESS;
187}
#define COLCHC
Definition BesBdkRc.cxx:58
#define INPUT
Definition BesBdkRc.cxx:31
#define GEN_INIT()
Definition BesBdkRc.cxx:113
#define FINCUT
Definition BesBdkRc.cxx:43
#define LOCALC
Definition BesBdkRc.cxx:51
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)

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