Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

FT1Alg Class Reference

Extract info from tuple, etc. to add ft1 items to this of another tree. More...

Collaboration diagram for FT1Alg:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Private Attributes

FT1workerm_worker
 this guy does the work!

int m_count
IDataProviderSvc * m_pEventSvc
IDataProviderSvc * m_pCalibDataSvc
ICalibPathSvc * m_pCalibPathSvc
BooleanProperty m_aberrate
 set true to enable aberration correction

StringProperty m_flavor
 set to a flavor to enable the corrrection

std::string m_path
 calibration service


Detailed Description

Extract info from tuple, etc. to add ft1 items to this of another tree.

Definition at line 46 of file FT1Alg.cxx.


Constructor & Destructor Documentation

FT1Alg::FT1Alg const std::string &  name,
ISvcLocator *  pSvcLocator
 

Definition at line 120 of file FT1Alg.cxx.

References m_aberrate, and m_flavor.

00121 : Algorithm(name, pSvcLocator)
00122 , m_count(0)
00123 {
00124     declareProperty("TreeName",  treename="MeritTuple");
00125     declareProperty("NbOfEvtsInFile", nbOfEvtsInFile=100000);
00126     declareProperty("CorrectForAberration", m_aberrate=false);
00127     declareProperty("AlignmentFlavor"     , m_flavor="");
00128 }


Member Function Documentation

StatusCode FT1Alg::execute  ) 
 

Definition at line 183 of file FT1Alg.cxx.

References FT1worker::evaluate(), m_count, m_flavor, m_path, m_pCalibDataSvc, m_pEventSvc, and m_worker.

00184 {
00185     StatusCode sc = StatusCode::SUCCESS;
00186 
00187     MsgStream log(msgSvc(), name());
00188     m_count++;
00189 
00190     if(! m_flavor.value().empty() ){
00191         // update alignment if necessary -- this code grateful curtesy of J. Bogart!
00192 
00193 
00194         static unsigned serial = 0; // serial number of last calibration used
00195 
00196         SmartDataPtr<CalibData::CalibLATAlignment> alignCalib(m_pCalibDataSvc, m_path);
00197         if ( !alignCalib ) {
00198             log << MSG::ERROR << "Failed access to CalibLATAlignment via smart ptr with path"
00199                 << m_path << endreq;
00200             return StatusCode::FAILURE;
00201         }
00202         unsigned newSerial = alignCalib->getSerNo();
00203 
00204         if( serial != newSerial) {
00205             serial = newSerial;
00206 
00207             static double arcsec2deg(M_PI/648000);
00208             const CalibData::ALIGN_ROT* r = alignCalib->getR();
00209             // explanation from Joanne for the following: 
00210             //"The type of (*r)  is a  3-element array of double, so applying a subscript
00211             // should give you one of the doubles in that array. r itself is a pointer to something 3 doubles long "
00212             double x((*r)[0]), y((*r)[1]), z((*r)[2]);
00213             gps->setAlignmentRotation( 
00214                 CLHEP::HepRotationX(x * arcsec2deg)
00215                 *CLHEP::HepRotationY(y* arcsec2deg)
00216                 *CLHEP::HepRotationZ(z* arcsec2deg)
00217                 );
00218             log << MSG::INFO << "setting alignment parameters: ("
00219                 << x<<", "<< y<< "," << z << ") arcsec" << endreq;
00220         }
00221     }
00222 
00223     
00224     SmartDataPtr<Event::EventHeader> header(m_pEventSvc, EventModel::EventHeader);
00225 
00226     // get event time from header, and make sure gps is in sync 
00227     double etime(header->time());
00228     gps->time(etime); 
00229 
00230     m_worker->evaluate();
00231     return sc;
00232 }

StatusCode FT1Alg::finalize  ) 
 

Definition at line 234 of file FT1Alg.cxx.

00235 {
00236     return StatusCode::SUCCESS;
00237 }

StatusCode FT1Alg::initialize  ) 
 

Definition at line 130 of file FT1Alg.cxx.

References m_aberrate, m_flavor, m_path, m_pCalibDataSvc, m_pCalibPathSvc, m_pEventSvc, and m_worker.

00131 {
00132     StatusCode  sc = StatusCode::SUCCESS;
00133 
00134     MsgStream log(msgSvc(), name());
00135 
00136     // Use the Job options service to get the Algorithm's parameters
00137     setProperties();
00138 
00139     IDataProviderSvc* eventsvc = 0;
00140     sc = serviceLocator()->service( "EventDataSvc", eventsvc, true );
00141     if(sc.isFailure()){
00142         log << MSG::ERROR << "Could not find EventDataSvc" << std::endl;
00143         return sc;
00144     }
00145     m_pEventSvc = eventsvc;
00146 
00147 
00148     // get a pointer to RootTupleSvc 
00149     if( (sc = service("RootTupleSvc", rootTupleSvc, true) ). isFailure() ) {
00150         log << MSG::ERROR << " failed to get the RootTupleSvc" << endreq;
00151         return sc;
00152     }
00153 
00154     m_worker =  new FT1worker();
00155 
00156     // get the GPS instance: 
00157     gps = astro::GPS::instance();
00158 
00159     // enable aberration correction if requested
00160     if( m_aberrate.value() ){
00161         gps->enableAberration(true);
00162         log << MSG::INFO << "Correction for aberration is enabled" << endreq;
00163     }
00164     // stuff for getting the calibration -- this code grateful curtesy of J. Bogart!
00165     if( !m_flavor.value().empty() ) {
00166         if( (sc=service("CalibDataSvc", m_pCalibDataSvc, true)).isFailure()) { // needed for any access to calib. tds
00167             log << MSG::ERROR << " failed to get the CalibDataSvc" << endreq;
00168             return sc;
00169         }
00170         if( (sc=service("CalibDataSvc", m_pCalibPathSvc, true)).isFailure()){ // preferred way to form paths into calib tds
00171             log << MSG::ERROR << " failed to get the CalibDataSvc (or maybe CalibPathSvc)" << endreq;
00172             return sc;
00173         }
00174 
00175         m_path = m_pCalibPathSvc->getCalibPath(ICalibPathSvc::Calib_NAS_LATAlignment, m_flavor); // form path
00176         log << MSG::INFO << "Using alignment flavor "<< m_flavor.value() << endreq;
00177 
00178     }
00179     return sc;
00180 }


Member Data Documentation

BooleanProperty FT1Alg::m_aberrate [private]
 

set true to enable aberration correction

Definition at line 64 of file FT1Alg.cxx.

Referenced by FT1Alg(), and initialize().

int FT1Alg::m_count [private]
 

Definition at line 58 of file FT1Alg.cxx.

Referenced by execute().

StringProperty FT1Alg::m_flavor [private]
 

set to a flavor to enable the corrrection

Definition at line 65 of file FT1Alg.cxx.

Referenced by execute(), FT1Alg(), and initialize().

std::string FT1Alg::m_path [private]
 

calibration service

Definition at line 67 of file FT1Alg.cxx.

Referenced by execute(), and initialize().

IDataProviderSvc* FT1Alg::m_pCalibDataSvc [private]
 

Definition at line 61 of file FT1Alg.cxx.

Referenced by execute(), and initialize().

ICalibPathSvc* FT1Alg::m_pCalibPathSvc [private]
 

Definition at line 62 of file FT1Alg.cxx.

Referenced by initialize().

IDataProviderSvc* FT1Alg::m_pEventSvc [private]
 

Definition at line 59 of file FT1Alg.cxx.

Referenced by execute(), and initialize().

FT1worker* FT1Alg::m_worker [private]
 

this guy does the work!

Definition at line 56 of file FT1Alg.cxx.

Referenced by execute(), and initialize().


The documentation for this class was generated from the following file:
Generated on Wed Nov 26 14:03:25 2008 by doxygen 1.3.3