Public Methods | |
| FluxTestAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
| Constructor of this form must be provided. More... | |
| StatusCode | initialize () |
| StatusCode | execute () |
| StatusCode | finalize () |
Private Attributes | |
| IFlux * | m_flux |
| std::string | m_source_name |
| IParticlePropertySvc * | m_partSvc |
| std::ostream * | m_out |
| std::ostream * | m_diffsources |
Definition at line 38 of file FluxTestAlg.cxx.
|
||||||||||||
|
Constructor of this form must be provided.
Definition at line 68 of file FluxTestAlg.cxx. References m_source_name.
00068 :
00069 Algorithm(name, pSvcLocator){
00070
00071 declareProperty("source_name", m_source_name="default");
00072 }
|
|
|
Definition at line 132 of file FluxTestAlg.cxx. References m_flux, m_out, m_partSvc, and IFlux::time().
00132 {
00133
00134 StatusCode sc = StatusCode::SUCCESS;
00135 MsgStream log( msgSvc(), name() );
00136
00137
00138 Event::McParticleCol* pcol = 0;
00139 eventSvc()->retrieveObject(EventModel::MC::McParticleCol, (DataObject *&)pcol);
00140
00141 if(pcol==0){
00142 log << MSG::ERROR << " Could not find "<< EventModel::MC::McParticleCol << endreq;
00143 return StatusCode::FAILURE;
00144 }
00145
00146 SmartDataPtr<Event::EventHeader> header(eventSvc(), EventModel::EventHeader);
00147 if( 0==header) {
00148 log << MSG::ERROR << " Could not find "<< EventModel::EventHeader << endreq;
00149 return StatusCode::FAILURE;
00150 }
00151
00152
00153
00154 Event::McParticleCol::iterator elem = (*pcol).begin();
00155 HepVector3D d = (*elem)->initialFourMomentum().v().unit();
00156 HepVector3D p = (*elem)->finalPosition();
00157
00158 double energy = (*elem)->initialFourMomentum().e();
00159 /*StdHepId*/int pID = (*elem)->particleProperty();
00160 std::string partName = m_partSvc->findByStdHepID(pID)->particle();
00161
00162 log << MSG::INFO << partName
00163 << "(" << energy
00164 << " MeV), Launch: "
00165 << "(" << p.x() <<", "<< p.y() <<", "<<p.z()<<")"
00166 << " Dir "
00167 << "(" << d.x() <<", "<< d.y() <<", "<<d.z()<<")"
00168 << ", Elapsed Time = " << header->time()
00169 << endreq;
00170
00171 #if 0 // enable for tests: see above
00172 double theta = acos(d.z()/(d.mag()));
00173
00174 double phi = atan2(d.y(),d.x());
00175
00176 //and here's the file output.
00177 std::ostream& out = *m_out;
00178 out<<m_flux->time() <<'\t';
00179 out<<d.x() <<'\t';
00180 out<< d.y()<<'\t';
00181 out<< d.z()<<'\t';
00182 out<< theta<<'\t';
00183 out<< phi<<'\t' << std::endl;
00184 #endif
00185 return sc;
00186 }
|
|
|
Definition at line 190 of file FluxTestAlg.cxx. References m_diffsources, m_flux, m_out, and IFlux::writeSourceCharacteristic().
00190 {
00191 #if 0 //enable for tests
00192 std::ostream& diffsources = *m_diffsources;
00193 m_flux->writeSourceCharacteristic(diffsources);
00194 delete m_diffsources;
00195 delete m_out;
00196 #endif
00197 return StatusCode::SUCCESS;
00198 }
|
|
|
Definition at line 77 of file FluxTestAlg.cxx. References m_diffsources, m_flux, m_out, m_partSvc, m_source_name, IFlux::rate(), IFluxSvc::source(), IFlux::targetArea(), and IFlux::title().
00077 {
00078
00079
00080 MsgStream log(msgSvc(), name());
00081 log << MSG::INFO << "initializing..." << endreq;
00082
00083 // Use the Job options service to set the Algorithm's parameters
00084 setProperties();
00085
00086 if ( service("ParticlePropertySvc", m_partSvc).isFailure() ){
00087 log << MSG::ERROR << "Couldn't find the ParticlePropertySvc!" << endreq;
00088 return StatusCode::FAILURE;
00089 }
00090
00091 #if 0 // this does not make sense for testing FluxAlg
00092 //set the output file.
00093 m_out = new std::ofstream("TestOutputData.out");
00094 m_diffsources = new std::ofstream("SourceCharacteristics.out");
00095
00096 // get the pointer to the flux Service
00097 IFluxSvc* fsvc;
00098
00099 // get the service
00100 StatusCode sc = service("FluxSvc", fsvc);
00101
00102 if( sc.isFailure()) {
00103 log << MSG::ERROR << "Could not find FluxSvc" << endreq;
00104 return sc;
00105 }
00106
00107 //uncomment this to set the rocking method.
00108 //fsvc->setRockType(GPS::UPDOWN);
00109
00110 log << MSG::INFO << "loading source..." << endreq;
00111
00112
00113 sc = fsvc->source(m_source_name, m_flux);
00114 if( sc.isFailure()) {
00115 log << MSG::ERROR << "Could not find flux " << m_source_name << endreq;
00116 return sc;
00117 }
00118
00119 // then do the output here.
00120 log << MSG::INFO << "start of other loops" << endreq;
00121 log << MSG::INFO << "Source title: " << m_flux->title() << endreq;
00122 log << MSG::INFO << " area: " << m_flux->targetArea() << endreq;
00123 log << MSG::INFO << " rate: " << m_flux->rate() << endreq;
00124
00125 #endif
00126
00127 return StatusCode::SUCCESS;
00128 }
|
|
|
Definition at line 54 of file FluxTestAlg.cxx. Referenced by finalize(), and initialize(). |
|
|
Definition at line 50 of file FluxTestAlg.cxx. Referenced by execute(), finalize(), and initialize(). |
|
|
Definition at line 53 of file FluxTestAlg.cxx. Referenced by execute(), finalize(), and initialize(). |
|
|
Definition at line 52 of file FluxTestAlg.cxx. Referenced by execute(), and initialize(). |
|
|
Definition at line 51 of file FluxTestAlg.cxx. Referenced by FluxTestAlg(), and initialize(). |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001