| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

FloatingDaqFeePedestalSvc Class Reference

#include <FloatingDaqFeePedestalSvc.h>

Inheritance diagram for FloatingDaqFeePedestalSvc:

[legend]
Collaboration diagram for FloatingDaqFeePedestalSvc:
[legend]
List of all members.

Public Types

typedef std::map< DayaBay::FeeChannelId,
std::list< float > > 
PreAdcArray
typedef std::map< DayaBay::FeeChannelId,
double > 
PedestalArray
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status

Public Member Functions

 FloatingDaqFeePedestalSvc (const std::string &name, ISvcLocator *svc)
 ~FloatingDaqFeePedestalSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
StatusCode cumulate (const DayaBay::ReadoutHeader *rh)
double pedestal (const DayaBay::FeeChannelId &channelId, int gain) const
virtual unsigned long addRef ()
virtual unsigned long release ()
virtual const std::string & name () const
virtual const InterfaceIDtype () const
virtual StatusCode configure ()
virtual StatusCode start ()
virtual StatusCode stop ()
virtual StatusCode terminate ()
virtual Gaudi::StateMachine::State FSMState () const
virtual Gaudi::StateMachine::State targetFSMState () const
virtual StatusCode reinitialize ()
virtual StatusCode restart ()
virtual StatusCode sysInitialize ()
virtual StatusCode sysStart ()
virtual StatusCode sysStop ()
virtual StatusCode sysFinalize ()
virtual StatusCode sysReinitialize ()
virtual StatusCode sysRestart ()
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
virtual const std::vector<
Property * > & 
getProperties () const
ISvcLocatorserviceLocator () const
IMessageSvcmsgSvc ()
IMessageSvcmsgSvc () const
IMessageSvcmessageService ()
IMessageSvcmessageService () const
StatusCode setProperties ()
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
IAuditorSvcauditorSvc () const

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Protected Member Functions

int outputLevel () const

Protected Attributes

IntegerProperty m_outputLevel
Gaudi::StateMachine::State m_state
Gaudi::StateMachine::State m_targetState
IMessageSvcm_messageSvc

Private Member Functions

double updatePedestal (std::list< float > &PreAdcs, float newPreAdc)

Private Attributes

double m_limit
 number of preAdcs used to calculate average
double m_timeCutInSec
TimeStamp m_lastTrig
PreAdcArray m_finePreAdc
PreAdcArray m_crsePreAdc
PedestalArray m_finePedes
PedestalArray m_crsePedes

Friends

friend class ServiceManager

Detailed Description

Definition at line 22 of file FloatingDaqFeePedestalSvc.h.


Member Typedef Documentation

typedef std::map<DayaBay::FeeChannelId, std::list<float> > FloatingDaqFeePedestalSvc::PreAdcArray

Definition at line 44 of file FloatingDaqFeePedestalSvc.h.

typedef std::map<DayaBay::FeeChannelId, double > FloatingDaqFeePedestalSvc::PedestalArray

Definition at line 45 of file FloatingDaqFeePedestalSvc.h.


Constructor & Destructor Documentation

FloatingDaqFeePedestalSvc::FloatingDaqFeePedestalSvc ( const std::string &  name,
ISvcLocator svc 
)

Definition at line 18 of file FloatingDaqFeePedestalSvc.cc.

00019   : Service(name,svc)
00020 {
00021   declareProperty("Limit",m_limit=500,
00022                   "Number of preAdcs to document");
00023 
00024   declareProperty("TimeCutInSec",m_timeCutInSec=0.0001,  // 100 us
00025                   "Time cut in second to remove afterpulses");
00026 }

FloatingDaqFeePedestalSvc::~FloatingDaqFeePedestalSvc (  ) 

Definition at line 28 of file FloatingDaqFeePedestalSvc.cc.

00029 {
00030 }


Member Function Documentation

StatusCode FloatingDaqFeePedestalSvc::initialize (  )  [virtual]

Reimplemented from Service.

Definition at line 32 of file FloatingDaqFeePedestalSvc.cc.

00033 {
00034   StatusCode sc;
00035   sc = this->Service::initialize();
00036 
00037   m_finePreAdc.clear();
00038   m_crsePreAdc.clear();
00039 
00040   m_finePedes.clear();
00041   m_crsePedes.clear();
00042 
00043   m_lastTrig = TimeStamp::GetBOT();
00044 
00045   return sc;
00046 }

StatusCode FloatingDaqFeePedestalSvc::finalize (  )  [virtual]

Reimplemented from Service.

Definition at line 48 of file FloatingDaqFeePedestalSvc.cc.

00049 {
00050   StatusCode sc;
00051   sc = this->Service::finalize();
00052 
00053   return sc;
00054 }

StatusCode FloatingDaqFeePedestalSvc::queryInterface ( const InterfaceID riid,
void **  ppvInterface 
) [virtual]

Reimplemented from Service.

Definition at line 56 of file FloatingDaqFeePedestalSvc.cc.

00058 {
00059   StatusCode sc = StatusCode::FAILURE;
00060   if (ppvInterface) {
00061     *ppvInterface = 0;
00062     
00063     if (IFloatingFeePedestalSvc::interfaceID().versionMatch(riid)) {
00064       *ppvInterface = static_cast<IFloatingFeePedestalSvc*>(this);
00065       sc = StatusCode::SUCCESS;
00066       addRef();
00067     }
00068     else sc = Service::queryInterface( riid, ppvInterface );
00069   }
00070   return sc;
00071 }

StatusCode FloatingDaqFeePedestalSvc::cumulate ( const DayaBay::ReadoutHeader rh  )  [virtual]

Implements IFloatingFeePedestalSvc.

Definition at line 74 of file FloatingDaqFeePedestalSvc.cc.

00075 {
00076     MsgStream log(msgSvc(), "FloatingFeePedestalSvc");
00077 
00078       const DaqCrate* daqCrate = rh->daqCrate();
00079       if(!daqCrate) {
00080         log << MSG::ERROR <<"Failed to get daqCrate from header"<<endreq;
00081         return StatusCode::FAILURE;
00082       }
00083 
00085       // check for rpc's sneaking in
00086       if( ! (daqCrate->detector().isAD() || daqCrate->detector().isWaterShield() ) ) {
00087           return StatusCode::SUCCESS;
00088       }
00089 
00091       TimeStamp trigTime = daqCrate->triggerTime();
00092 
00094       if( (m_lastTrig == TimeStamp::GetBOT()) ||
00095           ((trigTime-m_lastTrig).GetSeconds() > m_timeCutInSec) ) {
00096 
00098           const DaqPmtCrate* pPmtCrate=daqCrate->asPmtCrate();
00099           if(!pPmtCrate) {
00100               log << MSG::ERROR <<"Failed to get ReadoutPmtCrate"<<endreq;
00101               return StatusCode::FAILURE;
00102           }
00103 
00105           DaqPmtCrate::PmtChannelPtrList channels = pPmtCrate->pmtChannelReadouts();
00106           DaqPmtCrate::PmtChannelPtrList::iterator ci, ci_end = channels.end();
00107 
00108           for(ci = channels.begin(); ci!=ci_end; ci++) {
00109 
00111               DaqPmtChannel *channel = *ci;
00112               FeeChannelId channelId = channel->channelId();
00113 
00114               float preAdc = channel->preAdcAvg(0);
00115               int range  = channel->isHighGainAdc(0) ? FeeGain::kHigh 
00116                                                      : FeeGain::kLow ;
00117 
00119               if( range == FeeGain::kHigh ) {
00120                   list<float>& preAdcs = m_finePreAdc[ channelId ];
00121                   m_finePedes[ channelId ] = updatePedestal( preAdcs, preAdc );
00122               }
00123               if( range == FeeGain::kLow ) {
00124                   list<float>& preAdcs = m_crsePreAdc[ channelId ];
00125                   m_crsePedes[ channelId ] = updatePedestal( preAdcs, preAdc );
00126               }
00127           }
00128 
00129           m_lastTrig = trigTime;
00130       }
00131 
00132       return StatusCode::SUCCESS;
00133 }

double FloatingDaqFeePedestalSvc::pedestal ( const DayaBay::FeeChannelId channelId,
int  gain 
) const [virtual]

Implements IFloatingFeePedestalSvc.

Definition at line 136 of file FloatingDaqFeePedestalSvc.cc.

00138 {
00139   MsgStream log(msgSvc(), "FloatingDaqFeePedestalSvc");
00140 
00141   if( gain==FeeGain::kHigh ) {
00142     PedestalArray::const_iterator ci;
00143     ci = m_finePedes.find( channelId );
00144     if( ci != m_finePedes.end() ) {
00145       return ci->second;
00146     } else {
00147       log << MSG::WARNING <<"Incomplete fine range pedestal map. Try preADC."<<endreq;
00148       return -1000;
00149     }
00150   }
00151 
00152   if( gain==FeeGain::kLow ) {
00153     PedestalArray::const_iterator ci;
00154     ci = m_crsePedes.find( channelId );
00155     if( ci != m_crsePedes.end() ) {
00156       return ci->second;
00157     } else {
00158       log << MSG::WARNING <<"Incomplete coarse range pedestal map. Try preADC."<<endreq;
00159       return -1000;
00160     }
00161   }
00162 
00163   log << MSG::ERROR <<"Query with wrong gain parameter"<<endreq;
00164   return -1000;
00165 }

double FloatingDaqFeePedestalSvc::updatePedestal ( std::list< float > &  PreAdcs,
float  newPreAdc 
) [private]

static const InterfaceID& IFloatingFeePedestalSvc::interfaceID (  )  [inline, static, inherited]

Reimplemented from IInterface.

Definition at line 25 of file IFloatingFeePedestalSvc.h.

00025                                          {
00026     return IID_IFloatingFeePedestalSvc;
00027   }


Member Data Documentation

double FloatingDaqFeePedestalSvc::m_limit [private]

number of preAdcs used to calculate average

Definition at line 49 of file FloatingDaqFeePedestalSvc.h.

double FloatingDaqFeePedestalSvc::m_timeCutInSec [private]

Definition at line 51 of file FloatingDaqFeePedestalSvc.h.

TimeStamp FloatingDaqFeePedestalSvc::m_lastTrig [private]

Definition at line 52 of file FloatingDaqFeePedestalSvc.h.

PreAdcArray FloatingDaqFeePedestalSvc::m_finePreAdc [private]

Definition at line 54 of file FloatingDaqFeePedestalSvc.h.

PreAdcArray FloatingDaqFeePedestalSvc::m_crsePreAdc [private]

Definition at line 55 of file FloatingDaqFeePedestalSvc.h.

PedestalArray FloatingDaqFeePedestalSvc::m_finePedes [private]

Definition at line 57 of file FloatingDaqFeePedestalSvc.h.

PedestalArray FloatingDaqFeePedestalSvc::m_crsePedes [private]

Definition at line 58 of file FloatingDaqFeePedestalSvc.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:29:21 2011 for FloatingFeePedestalSvc by doxygen 1.4.7