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

ObfValsTool Class Reference

calculates Obf values More...

Inheritance diagram for ObfValsTool:

Inheritance graph
[legend]
Collaboration diagram for ObfValsTool:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ObfValsTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ObfValsTool ()
StatusCode initialize ()
StatusCode calculate ()
 calculate all values; implemented by each XxxValsTool

StatusCode finalize ()

Private Attributes

int m_nGrbHitsX
int m_nGrbHitsY
float m_grbSlpX
float m_grbSlpY
float m_grbIntX
float m_grbIntY
float m_grbZ
float m_grbXdir
float m_grbYdir
float m_grbZdir
float m_grbAngSep
int m_gamStatus
int m_gamState
int m_hipStatus
int m_hipState
int m_mipStatus
int m_mipState
int m_dgnStatus
int m_dgnState
int m_gamStage
float m_gamEnergy
int m_warnNoFilterStatus
int m_fswGamStatus
int m_fswGamState
int m_fswGamPrescaleIndex
int m_fswGamPrescaleFactor
float m_fswGamEnergy
int m_fswGamStage
int m_fswGamVersion
int m_fswHipStatus
int m_fswHipState
int m_fswMipStatus
int m_fswMipState
int m_fswDgnStatus
int m_fswDgnState
int m_fswDgnPrescaleIndex
int m_fswDgnPrescaleFactor

Detailed Description

calculates Obf values

Authors:

Definition at line 35 of file ObfValsTool.cxx.


Constructor & Destructor Documentation

ObfValsTool::ObfValsTool const std::string &  type,
const std::string &  name,
const IInterface *  parent
 

Definition at line 107 of file ObfValsTool.cxx.

00110                          : ValBase( type, name, parent )
00111 {    
00112     // Declare additional interface
00113     declareInterface<IValsTool>(this); 
00114 }

virtual ObfValsTool::~ObfValsTool  )  [inline, virtual]
 

Definition at line 43 of file ObfValsTool.cxx.

00043 { }


Member Function Documentation

StatusCode ObfValsTool::calculate  )  [virtual]
 

calculate all values; implemented by each XxxValsTool

Reimplemented from ValBase.

Definition at line 250 of file ObfValsTool.cxx.

References m_dgnState, m_dgnStatus, m_fswDgnPrescaleFactor, m_fswDgnPrescaleIndex, m_fswDgnState, m_fswDgnStatus, m_fswGamEnergy, m_fswGamPrescaleFactor, m_fswGamPrescaleIndex, m_fswGamStage, m_fswGamState, m_fswGamStatus, m_fswGamVersion, m_fswHipState, m_fswHipStatus, m_fswMipState, m_fswMipStatus, m_gamEnergy, m_gamStage, m_gamState, m_gamStatus, m_grbAngSep, m_grbIntX, m_grbIntY, m_grbSlpX, m_grbSlpY, m_grbXdir, m_grbYdir, m_grbZ, m_grbZdir, m_hipState, m_hipStatus, m_mipState, m_mipStatus, m_nGrbHitsX, m_nGrbHitsY, ValBase::m_pEventSvc, and m_warnNoFilterStatus.

00251 {
00252     StatusCode sc = StatusCode::SUCCESS;
00253     MsgStream log(msgSvc(), name());
00254 
00255     // We'll use these when copying to the deprecated variables
00256     unsigned int filterStatusHi = 0;
00257     unsigned int filterStatusLo = 0;
00258 
00259     // Start with the status information returned from the filters
00260     // Look up the TDS class containing this information
00261     SmartDataPtr<OnboardFilterTds::ObfFilterStatus> 
00262         obfStatus(m_pEventSvc, "/Event/Filter/ObfFilterStatus");
00263 
00264     m_gamState = enums::Lsf::INVALID;
00265     m_dgnState = enums::Lsf::INVALID;
00266     m_hipState = enums::Lsf::INVALID;
00267     m_mipState = enums::Lsf::INVALID;
00268 
00269     // If it exists then fill filter status info
00270     if (obfStatus)
00271     {
00272         // Pointer to our retrieved objects
00273         const OnboardFilterTds::IObfStatus* obfResult = 0;
00274 
00275         // Start with Gamma Filter
00276         if (obfResult   = 
00277                 obfStatus->getFilterStatus(OnboardFilterTds::ObfFilterStatus::GammaFilter))
00278         {
00279             m_gamStatus    = obfResult->getStatusWord();
00280             m_gamState     = obfResult->getState();
00281             m_gamStage     = dynamic_cast<const OnboardFilterTds::ObfGammaStatus*>(obfResult)->getStage();
00282             m_gamEnergy    = dynamic_cast<const OnboardFilterTds::ObfGammaStatus*>(obfResult)->getEnergy();
00283         }
00284         else m_gamStatus = -1;
00285 
00286         // HFC Filter results
00287         if (obfResult   = 
00288                 obfStatus->getFilterStatus(OnboardFilterTds::ObfFilterStatus::HIPFilter))
00289         {
00290             m_hipStatus    = obfResult->getStatusWord();
00291             m_hipState     = obfResult->getState();
00292         }
00293         else m_hipStatus = -1;
00294 
00295         // MIP Filter results
00296         if (obfResult   = 
00297                 obfStatus->getFilterStatus(OnboardFilterTds::ObfFilterStatus::MIPFilter))
00298         {
00299             m_mipStatus    = obfResult->getStatusWord();
00300             m_mipState     = obfResult->getState();
00301         }
00302         else m_mipStatus = -1;
00303 
00304         // DFC Filter results
00305         if (obfResult   = 
00306                 obfStatus->getFilterStatus(OnboardFilterTds::ObfFilterStatus::DGNFilter))
00307         {
00308             m_dgnStatus    = obfResult ? obfResult->getStatusWord() : -1;
00309             m_dgnState     = obfResult->getState();
00310         }
00311         else m_dgnStatus = -1;
00312     }
00313     else 
00314     {
00315         m_warnNoFilterStatus++;
00316         if (   m_warnNoFilterStatus <= 10 ) 
00317         {
00318             log << MSG::WARNING << "ObfFilterStatus not found" ;
00319             if ( m_warnNoFilterStatus == 10 ) {
00320                 log << " -- Further WARNINGs on missing FilterStatus are suppressed"; }
00321             log  << endreq;
00322         }
00323     }
00324     // Next, try to find the Fsw versions of the above
00325 
00326     m_fswGamPrescaleIndex = LSF_INVALID_UINT;
00327     m_fswGamPrescaleFactor = LSF_INVALID_UINT;
00328 
00329     m_fswDgnPrescaleIndex = LSF_INVALID_UINT;
00330     m_fswDgnPrescaleFactor = LSF_INVALID_UINT;
00331 
00332     m_fswGamState = enums::Lsf::INVALID;
00333     m_fswDgnState = enums::Lsf::INVALID;
00334     m_fswHipState = enums::Lsf::INVALID;
00335     m_fswMipState = enums::Lsf::INVALID;
00336     
00337     m_fswGamVersion = enums::Lsf::INVALID;
00338 
00339     SmartDataPtr<LsfEvent::MetaEvent>  metaEventTds(m_pEventSvc, "/Event/MetaEvent");
00340     if (metaEventTds) {
00341         const lsfData::GammaHandler* gamma = metaEventTds->gammaFilter();
00342         if (gamma) {
00343             // rsd is Result Summary Data 
00344             if(gamma->rsd()) {
00345                 m_fswGamStatus = gamma->rsd()->status();  
00346                 m_fswGamVersion = gamma->version();
00347             }
00348             m_fswGamState = gamma->state();  
00349             m_fswGamPrescaleFactor = gamma->prescaleFactor();    
00350             m_fswGamPrescaleIndex  = gamma->lpaHandler().prescaleIndex();
00351             m_fswGamEnergy         = static_cast<float>(gamma->rsd()->energyInLeus())/4.0;
00352             m_fswGamStage          = gamma->rsd()->stage();
00353         }
00354         const lsfData::DgnHandler* dgn = metaEventTds->dgnFilter();
00355         if (dgn) {
00356             // rsd is Result Summary Data 
00357             if(dgn->rsd()) m_fswDgnStatus = dgn->rsd()->status();  
00358             m_fswDgnState = dgn->state();  
00359             m_fswDgnPrescaleFactor = dgn->prescaleFactor();  
00360             m_fswDgnPrescaleIndex  = dgn->lpaHandler().prescaleIndex(); 
00361         }
00362 
00363         const lsfData::HipHandler* hip = metaEventTds->hipFilter();       if (hip) {
00364             // rsd is Result Summary Data 
00365             if(hip->rsd()) m_fswHipStatus = hip->rsd()->status();  
00366             m_fswHipState = hip->state();  
00367             //m_fswHipPrescaleFactor = hip->prescaleFactor();  
00368             //m_fswHipPrescaleIndex  = hip->lpaHandler().prescaleIndex(); 
00369         }
00370 
00371         const lsfData::MipHandler* mip = metaEventTds->mipFilter();
00372         if (mip) {
00373             // rsd is Result Summary Data 
00374             if(mip->rsd()) m_fswMipStatus = mip->rsd()->status();  
00375             m_fswMipState = mip->state();  
00376             //m_fswMipPrescaleFactor = mip->prescaleFactor();  
00377             //m_fswMipPrescaleIndex  = mip->lpaHandler().prescaleIndex(); 
00378         }
00379 
00380 
00381     } else {
00382         log << MSG::DEBUG << "No MetaEvent" << endreq;
00383     }
00384 
00385     // Get the summary tracking information on the "best" track
00386     SmartDataPtr<OnboardFilterTds::ObfFilterTrack> 
00387         filterTrack(m_pEventSvc, "/Event/Filter/ObfFilterTrack");
00388 
00389     if( filterTrack )
00390     {
00391         m_nGrbHitsX = filterTrack->get_nXhits();
00392         m_nGrbHitsY = filterTrack->get_nYhits();
00393         m_grbSlpX   = filterTrack->get_slpXZ();
00394         m_grbSlpY   = filterTrack->get_slpYZ();
00395         m_grbIntX   = filterTrack->get_xInt();
00396         m_grbIntY   = filterTrack->get_yInt();
00397         m_grbZ      = filterTrack->get_z();
00398 
00399         // Calculate direction cosines for GRB track first
00400         if (m_nGrbHitsX > 0 && m_nGrbHitsY > 0)
00401         {
00402             double alpha = atan2(m_grbSlpY, m_grbSlpX);
00403 
00404             if (alpha < 0.) alpha += 2. * M_PI;
00405 
00406             double slope = sqrt(pow(m_grbSlpX,2) + pow(m_grbSlpY,2));
00407             double beta  = atan(slope);
00408 
00409             m_grbXdir = cos(alpha)*sin(beta);
00410             m_grbYdir = sin(alpha)*sin(beta);
00411             m_grbZdir = cos(beta);
00412 
00413             // Look up the McParticle collection in case its there... 
00414             SmartDataPtr<Event::McParticleCol> mcParticleCol(m_pEventSvc, EventModel::MC::McParticleCol);
00415 
00416             // If running Monte Carlo, determine FilterAngSep here
00417             if (mcParticleCol)
00418             {
00419                 // We only care about incident particle direction here, so can use the first particle
00420                 // in the McParticleCol
00421                 Event::McParticle* mcPart = *(mcParticleCol->begin());
00422 
00423                 CLHEP::HepLorentzVector Mc_p0 = mcPart->initialFourMomentum();
00424                 Vector                  Mc_t0 = Vector(Mc_p0.x(),Mc_p0.y(), Mc_p0.z()).unit();
00425                 Vector                  filtDir(-m_grbXdir, -m_grbYdir, -m_grbZdir);
00426 
00427                 double cosTheta = filtDir.dot(Mc_t0);
00428 
00429                 m_grbAngSep = acos(cosTheta);
00430             }
00431         }
00432     }
00433 
00434     return sc;
00435 }

StatusCode ObfValsTool::finalize  ) 
 

Definition at line 437 of file ObfValsTool.cxx.

References m_warnNoFilterStatus.

00437                                  {
00438 
00439     MsgStream log(msgSvc(), name());
00440     log << MSG::INFO ;
00441     log << endreq;
00442     if(m_warnNoFilterStatus>0)
00443         log << MSG::INFO 
00444         << "Number of warnings (FilterStatus not found): "
00445         << m_warnNoFilterStatus << endreq;
00446 
00447     //setFinalized(); //  prevent being called again
00448 
00449     return StatusCode::SUCCESS;
00450 }

StatusCode ObfValsTool::initialize  )  [virtual]
 

Reimplemented from ValBase.

Definition at line 188 of file ObfValsTool.cxx.

References ValBase::addItem(), ValBase::initialize(), m_dgnState, m_dgnStatus, m_fswDgnPrescaleFactor, m_fswDgnPrescaleIndex, m_fswDgnState, m_fswDgnStatus, m_fswGamEnergy, m_fswGamPrescaleFactor, m_fswGamPrescaleIndex, m_fswGamStage, m_fswGamState, m_fswGamStatus, m_fswGamVersion, m_fswHipState, m_fswHipStatus, m_fswMipState, m_fswMipStatus, m_gamEnergy, m_gamStage, m_gamState, m_gamStatus, m_grbAngSep, m_grbIntX, m_grbIntY, m_grbSlpX, m_grbSlpY, m_grbXdir, m_grbYdir, m_grbZ, m_grbZdir, m_hipState, m_hipStatus, m_mipState, m_mipStatus, m_nGrbHitsX, m_nGrbHitsY, m_warnNoFilterStatus, and ValBase::zeroVals().

00189 {
00190     StatusCode sc = StatusCode::SUCCESS;
00191 
00192     MsgStream log(msgSvc(), name());
00193 
00194     if( ValBase::initialize().isFailure()) return StatusCode::FAILURE;
00195 
00196     // Status information from filters
00197     addItem("ObfGamStatus",         &m_gamStatus);
00198     addItem("ObfGamState",          &m_gamState);
00199     addItem("ObfGamStage",          &m_gamStage);
00200     addItem("ObfGamEnergy",         &m_gamEnergy);
00201 
00202     addItem("ObfHipStatus",         &m_hipStatus);
00203     addItem("ObfHipState",          &m_hipState);
00204 
00205     addItem("ObfMipStatus",         &m_mipStatus);
00206     addItem("ObfMipState",          &m_mipState);
00207 
00208     addItem("ObfDgnStatus",         &m_dgnStatus);
00209     addItem("ObfDgnState",          &m_dgnState);
00210 
00211     // "Best" track information
00212     addItem("GrbXHits",             &m_nGrbHitsX);
00213     addItem("GrbYHits",             &m_nGrbHitsY);
00214     addItem("GrbSlpX",              &m_grbSlpX);
00215     addItem("GrbSlpY",              &m_grbSlpY);
00216     addItem("GrbIntX",              &m_grbIntX);
00217     addItem("GrbIntY",              &m_grbIntY);
00218     addItem("GrbZ",                 &m_grbZ);
00219     addItem("GrbXDir",              &m_grbXdir);
00220     addItem("GrbYDir",              &m_grbYdir);
00221     addItem("GrbZDir",              &m_grbZdir);
00222     addItem("GrbMcAngSep",          &m_grbAngSep);
00223 
00224     addItem("FswGamStatus",         &m_fswGamStatus);
00225     addItem("FswGamState",          &m_fswGamState);
00226     addItem("FswGamEnergy",         &m_fswGamEnergy);
00227     addItem("FswGamStage",          &m_fswGamStage);
00228     addItem("FswGamPrescaleIndex",  &m_fswGamPrescaleIndex);
00229     addItem("FswGamPrescaleFactor", &m_fswGamPrescaleFactor);
00230     addItem("FswGamVersion",        &m_fswGamVersion);
00231 
00232     addItem("FswHipStatus",         &m_fswHipStatus);
00233     addItem("FswHipState",          &m_fswHipState);
00234     addItem("FswMipStatus",         &m_fswMipStatus);
00235     addItem("FswMipState",          &m_fswMipState);
00236 
00237     addItem("FswDgnStatus",         &m_fswDgnStatus);
00238     addItem("FswDgnState",          &m_fswDgnState);
00239     addItem("FswDgnPrescaleIndex",  &m_fswDgnPrescaleIndex);
00240     addItem("FswDgnPrescaleFactor", &m_fswDgnPrescaleFactor);
00241 
00242 
00243     zeroVals();
00244 
00245     m_warnNoFilterStatus = 0;
00246 
00247     return sc;
00248 }


Member Data Documentation

int ObfValsTool::m_dgnState [private]
 

Definition at line 74 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_dgnStatus [private]
 

Definition at line 73 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswDgnPrescaleFactor [private]
 

Definition at line 98 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswDgnPrescaleIndex [private]
 

Definition at line 97 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswDgnState [private]
 

Definition at line 96 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswDgnStatus [private]
 

Definition at line 95 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_fswGamEnergy [private]
 

Definition at line 86 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswGamPrescaleFactor [private]
 

Definition at line 85 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswGamPrescaleIndex [private]
 

Definition at line 84 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswGamStage [private]
 

Definition at line 87 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswGamState [private]
 

Definition at line 83 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswGamStatus [private]
 

Definition at line 82 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswGamVersion [private]
 

Definition at line 88 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswHipState [private]
 

Definition at line 91 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswHipStatus [private]
 

Definition at line 90 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswMipState [private]
 

Definition at line 93 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_fswMipStatus [private]
 

Definition at line 92 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_gamEnergy [private]
 

Definition at line 77 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_gamStage [private]
 

Definition at line 76 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_gamState [private]
 

Definition at line 68 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_gamStatus [private]
 

Definition at line 67 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbAngSep [private]
 

Definition at line 64 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbIntX [private]
 

Definition at line 58 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbIntY [private]
 

Definition at line 59 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbSlpX [private]
 

Definition at line 56 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbSlpY [private]
 

Definition at line 57 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbXdir [private]
 

Definition at line 61 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbYdir [private]
 

Definition at line 62 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbZ [private]
 

Definition at line 60 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

float ObfValsTool::m_grbZdir [private]
 

Definition at line 63 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_hipState [private]
 

Definition at line 70 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_hipStatus [private]
 

Definition at line 69 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_mipState [private]
 

Definition at line 72 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_mipStatus [private]
 

Definition at line 71 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_nGrbHitsX [private]
 

Definition at line 54 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_nGrbHitsY [private]
 

Definition at line 55 of file ObfValsTool.cxx.

Referenced by calculate(), and initialize().

int ObfValsTool::m_warnNoFilterStatus [private]
 

Definition at line 79 of file ObfValsTool.cxx.

Referenced by calculate(), finalize(), and initialize().


The documentation for this class was generated from the following file:
Generated on Mon Dec 1 20:09:11 2008 by doxygen 1.3.3