#include <SimpPmtCalibTool.h>
Inheritance diagram for SimpPmtCalibTool:
Public Types | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
| enum | Status |
Public Member Functions | |
| SimpPmtCalibTool (const std::string &type, const std::string &name, const IInterface *parent) | |
| virtual | ~SimpPmtCalibTool () |
| virtual StatusCode | calibration (const DayaBay::DaqCrate *, DayaBay::CalibReadout *) |
| This is the extension. Sub classes must provide it. | |
| virtual StatusCode | initialize () |
| virtual StatusCode | finalize () |
| INTupleSvc * | ntupleSvc () const |
| INTupleSvc * | evtColSvc () const |
| IDataProviderSvc * | detSvc () const |
| IDataProviderSvc * | evtSvc () const |
| IIncidentSvc * | incSvc () const |
| IChronoStatSvc * | chronoSvc () const |
| IHistogramSvc * | histoSvc () const |
| IAlgContextSvc * | contextSvc () const |
| DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
| DataObject * | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
| Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
| TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
| TYPE * | getDet (const std::string &location) const |
| bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| bool | exist (const std::string &location, const bool useRootInTES=true) const |
| bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
| bool | existDet (const std::string &location) const |
| TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
| TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
| TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
| SERVICE * | svc (const std::string &name, const bool create=true) const |
| IUpdateManagerSvc * | updMgrSvc () const |
| IDataProviderSvc * | fastContainersSvc () const |
| StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
| StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
| StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
| StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| MsgStream & | msgStream (const MSG::Level level) const |
| MsgStream & | always () const |
| MsgStream & | fatal () const |
| MsgStream & | err () const |
| MsgStream & | error () const |
| MsgStream & | warning () const |
| MsgStream & | info () const |
| MsgStream & | debug () const |
| MsgStream & | verbose () const |
| MsgStream & | msg () const |
| const Statistics & | counters () const |
| StatEntity & | counter (const std::string &tag) const |
| MSG::Level | msgLevel () const |
| bool | msgLevel (const MSG::Level level) const |
| void | resetMsgStream () const |
| bool | typePrint () const |
| bool | propsPrint () const |
| bool | statPrint () const |
| bool | errorsPrint () const |
| long | printStat (const MSG::Level level=MSG::ALWAYS) const |
| long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
| long | printProps (const MSG::Level level=MSG::ALWAYS) const |
| void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
| void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
| void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
| void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
| StatusCode | runUpdate () |
| TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
| StatusCode | release (const IInterface *interface) const |
| virtual unsigned long | release () |
| const std::string & | context () const |
| const std::string & | rootInTES () const |
| double | globalTimeOffset () const |
| virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
| virtual unsigned long | addRef () |
| virtual const std::string & | name () const |
| virtual const std::string & | type () const |
| virtual const IInterface * | parent () const |
| virtual StatusCode | configure () |
| virtual StatusCode | start () |
| virtual StatusCode | stop () |
| virtual StatusCode | terminate () |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | restart () |
| virtual Gaudi::StateMachine::State | FSMState () const |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| 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 Property & | getProperty (const std::string &name) const |
| virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
| virtual const std::vector< Property * > & | getProperties () const |
| PropertyMgr * | getPropertyMgr () |
| ISvcLocator * | serviceLocator () const |
| ISvcLocator * | svcLoc () const |
| IMessageSvc * | msgSvc () const |
| IToolSvc * | toolSvc () const |
| StatusCode | setProperties () |
| StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const |
| StatusCode | service (const std::string &type, const std::string &name, T *&svc) const |
| void | declInterface (const InterfaceID &, void *) |
| Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
| Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
| IAuditorSvc * | auditorSvc () const |
| IMonitorSvc * | monitorSvc () const |
| void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
| void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
| virtual const std::string & | type () const =0 |
| virtual const IInterface * | parent () const =0 |
| virtual StatusCode | configure ()=0 |
| virtual StatusCode | start ()=0 |
| virtual StatusCode | stop ()=0 |
| virtual StatusCode | terminate ()=0 |
| virtual StatusCode | reinitialize ()=0 |
| virtual StatusCode | restart ()=0 |
| virtual Gaudi::StateMachine::State | FSMState () const =0 |
| virtual StatusCode | sysInitialize ()=0 |
| virtual StatusCode | sysStart ()=0 |
| virtual StatusCode | sysStop ()=0 |
| virtual StatusCode | sysFinalize ()=0 |
| virtual StatusCode | sysReinitialize ()=0 |
| virtual StatusCode | sysRestart ()=0 |
| virtual unsigned long | refCount () const =0 |
| virtual const std::string & | name () const =0 |
| virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)=0 |
| virtual unsigned long | addRef ()=0 |
| virtual unsigned long | release ()=0 |
Static Public Member Functions | |
| static const InterfaceID & | interfaceID () |
| static const InterfaceID & | interfaceID () |
| static const InterfaceID & | interfaceID () |
| static const InterfaceID & | interfaceID () |
| Retrieve interface ID. | |
Public Attributes | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
Protected Types | |
| typedef std::map< std::string, StatEntity > | Statistics |
| typedef std::map< std::string, unsigned int > | Counter |
| typedef std::vector< IAlgTool * > | AlgTools |
| typedef std::pair< IInterface *, std::string > | ServiceEntry |
| typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
| StatusCode | releaseTool (const IAlgTool *tool) const |
| StatusCode | releaseSvc (const IInterface *svc) const |
| int | outputLevel () const |
| virtual unsigned long | refCount () const |
| IntegerProperty & | outputLevelProperty () |
| void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
| static const bool | IgnoreRootInTES |
| static const bool | UseRootInTES |
Private Attributes | |
| std::string | m_calibDataSvcName |
| ICalibDataSvc * | m_calibDataSvc |
| std::string | m_cableSvcName |
| bool | m_useDynamicPedestal |
| bool | m_useUncalibratedCharge |
| bool | m_useUncalibratedTime |
| ICableSvc * | m_cableSvc |
Definition at line 26 of file SimpPmtCalibTool.h.
| SimpPmtCalibTool::SimpPmtCalibTool | ( | const std::string & | type, | |
| const std::string & | name, | |||
| const IInterface * | parent | |||
| ) |
Definition at line 31 of file SimpPmtCalibTool.cc.
00034 : GaudiTool(type, name, parent) 00035 , m_calibDataSvc(0) 00036 , m_cableSvc(0) 00037 { 00038 declareInterface< ICalibTool >(this); 00039 declareProperty("CalibDataSvcName", m_calibDataSvcName = "StaticCalibDataSvc", 00040 "Name of Pmt calibration data Service"); 00041 declareProperty("CableSvcName", m_cableSvcName = "StaticCableSvc", 00042 "Name of Cable Service"); 00043 declareProperty("UseDynamicPedestal", m_useDynamicPedestal=true, 00044 "Use pedestal value embedded with each hit"); 00045 declareProperty("UseUncalibratedCharge", m_useUncalibratedCharge=false, 00046 "Use approximate charge calibration"); 00047 declareProperty("UseUncalibratedTime", m_useUncalibratedTime=false, 00048 "Use approximate time calibration"); 00049 }
| SimpPmtCalibTool::~SimpPmtCalibTool | ( | ) | [virtual] |
| StatusCode SimpPmtCalibTool::calibration | ( | const DayaBay::DaqCrate * | , | |
| DayaBay::CalibReadout * | ||||
| ) | [virtual] |
This is the extension. Sub classes must provide it.
Implements ICalibTool.
Definition at line 72 of file SimpPmtCalibTool.cc.
00074 { 00075 debug() << "running calibration() " << endreq; 00076 StatusCode sc; 00077 00078 // Convert to PMT crate readout 00079 const DayaBay::DaqPmtCrate* pmtReadout = readout->asPmtCrate(); 00080 if(!pmtReadout){ 00081 error() << "calibration(): no pmt readouts." << endreq; 00082 return StatusCode::FAILURE; 00083 } 00084 00085 DayaBay::CalibReadoutPmtCrate* calibReadoutCrate 00086 = dynamic_cast<DayaBay::CalibReadoutPmtCrate*>(calibReadout); 00087 // Check CalibReadoutCrate 00088 if(calibReadoutCrate == NULL) { 00089 error() << "calibration(): no calib pmt readouts." << endreq; 00090 return StatusCode::FAILURE; 00091 } 00092 00093 const std::vector<DayaBay::DaqPmtChannel*>& channels 00094 = pmtReadout->channelReadouts(); 00095 std::vector<DayaBay::DaqPmtChannel*>::const_iterator channelIter, 00096 channelEnd = channels.end(); 00097 00098 int task = 0; 00099 Context context = calibReadoutCrate->header()->context(); 00100 ServiceMode svcMode(context, task); 00101 00102 // Simple calibration channel by channel 00103 for(channelIter = channels.begin(); 00104 channelIter!=channelEnd; 00105 channelIter++){ 00106 const DayaBay::DaqPmtChannel* channel = *channelIter; 00107 const DayaBay::FeeChannelId& channelId = channel->channelId(); 00108 00109 // Get pmt calib data from CalibDataSvc 00110 const DayaBay::DetectorSensor& sensDetId 00111 = m_cableSvc->sensor(channelId, svcMode); 00112 00113 calibReadoutCrate->addSensor(sensDetId); 00114 DayaBay::CalibReadoutPmtChannel& cro_ch 00115 = *(calibReadoutCrate->sensor(sensDetId)); 00116 00117 const DayaBay::PmtCalibData* pmtCalib = 0; 00118 if(!m_useUncalibratedCharge || !m_useUncalibratedTime){ 00119 pmtCalib = m_calibDataSvc->pmtCalibData(sensDetId, svcMode); 00120 if(!pmtCalib) { 00121 error() << "No calibration properties for PMT: " << sensDetId 00122 << endreq; 00123 return StatusCode::FAILURE; 00124 } 00125 } 00126 00127 const DayaBay::FeeCalibData* feeCalib = 0; 00128 if(!m_useDynamicPedestal){ 00129 feeCalib = m_calibDataSvc->feeCalibData(channelId, svcMode); 00130 if(!feeCalib) { 00131 error() << "No calibration properties for FEE channel: " 00132 << channelId << endreq; 00133 return StatusCode::FAILURE; 00134 } 00135 } 00136 00137 // simple tdc calibration 00138 std::vector<double> calib_time; 00139 std::vector<double> calib_charge; 00140 double tdcToTime = -(1.0/DayaBay::TdcFrequencyHz) * Units::second; 00141 for(unsigned int hitIdx=0; hitIdx<channel->hitCount(); hitIdx++){ 00142 // Convert TDC to nanoseconds, and remove PMT time offset 00143 double calibTime = channel->tdc(hitIdx) * tdcToTime; 00144 if(!m_useUncalibratedTime) calibTime -= pmtCalib->m_timeOffset; 00145 calib_time.push_back( calibTime ); 00146 00147 double adcBaseline = 0.; 00148 double adcToSpe = 0.; 00149 if(channel->adc(hitIdx)==0) { 00150 // Catch invalid ADC values, set to zero charge 00151 calib_charge.push_back(0.); 00152 continue; 00153 } 00154 // Find ADC pedestal for this channel 00155 if(m_useDynamicPedestal){ 00156 adcBaseline = channel->preAdcAvg(hitIdx); 00157 }else{ 00158 if( channel->isHighGainAdc(hitIdx) ){ 00159 adcBaseline = feeCalib->m_adcBaselineHigh; 00160 }else{ 00161 adcBaseline = feeCalib->m_adcBaselineLow; 00162 } 00163 } 00164 00165 // Find ADC to charge conversion 00166 if(m_useUncalibratedCharge){ 00167 // Use mean charge conversion, instead of PMT calibration parameters 00168 adcToSpe = 1. / 20.; 00169 if(! channel->isHighGainAdc(hitIdx) ) adcToSpe = 1.0; 00170 }else{ 00171 // Use PMT calibration parameters 00172 if(channel->isHighGainAdc(hitIdx)) { //high 00173 adcToSpe = 1.0 / pmtCalib->m_speHigh; 00174 }else{ 00175 adcToSpe = 1.0 / pmtCalib->m_speLow; 00176 } 00177 } 00178 calib_charge.push_back( (channel->adc(hitIdx) - adcBaseline) * adcToSpe); 00179 00180 } 00181 cro_ch.setTime(calib_time); 00182 cro_ch.setCharge(calib_charge); 00183 } 00184 00185 return StatusCode::SUCCESS; 00186 }
| StatusCode SimpPmtCalibTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 53 of file SimpPmtCalibTool.cc.
00054 { 00055 // Get CalibData Service 00056 m_calibDataSvc = svc<ICalibDataSvc>(m_calibDataSvcName, true); 00057 00058 // Get CableData Service 00059 m_cableSvc = svc<ICableSvc>(m_cableSvcName, true); 00060 00061 debug() << "successfully get CableSvc and CalibSvc" << endreq; 00062 00063 return StatusCode::SUCCESS; 00064 }
| StatusCode SimpPmtCalibTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 67 of file SimpPmtCalibTool.cc.
00068 { 00069 return StatusCode::SUCCESS; 00070 }
| const InterfaceID & ICalibTool::interfaceID | ( | ) | [static, inherited] |
Retrieve interface ID.
Reimplemented from IAlgTool.
Definition at line 8 of file ICalibTool.cc.
00009 { 00010 return IID_ICalibTool; 00011 }
std::string SimpPmtCalibTool::m_calibDataSvcName [private] |
Definition at line 44 of file SimpPmtCalibTool.h.
ICalibDataSvc* SimpPmtCalibTool::m_calibDataSvc [private] |
Definition at line 47 of file SimpPmtCalibTool.h.
std::string SimpPmtCalibTool::m_cableSvcName [private] |
Definition at line 50 of file SimpPmtCalibTool.h.
bool SimpPmtCalibTool::m_useDynamicPedestal [private] |
Definition at line 53 of file SimpPmtCalibTool.h.
bool SimpPmtCalibTool::m_useUncalibratedCharge [private] |
Definition at line 56 of file SimpPmtCalibTool.h.
bool SimpPmtCalibTool::m_useUncalibratedTime [private] |
Definition at line 59 of file SimpPmtCalibTool.h.
ICableSvc* SimpPmtCalibTool::m_cableSvc [private] |
Definition at line 62 of file SimpPmtCalibTool.h.
1.4.7