#include <QsumLinearityEnergyTool.h>
Inheritance diagram for QsumLinearityEnergyTool:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
QsumLinearityEnergyTool (const std::string &type, const std::string &name, const IInterface *parent) | |
virtual | ~QsumLinearityEnergyTool () |
virtual StatusCode | reconstruct (const DayaBay::CalibReadout &readout, DayaBay::RecTrigger &recTrigger) |
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 () |
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_cableSvcName |
ICableSvc * | m_cableSvc |
std::string | m_calibDataSvcName |
ICalibDataSvc * | m_calibDataSvc |
Definition at line 26 of file QsumLinearityEnergyTool.h.
QsumLinearityEnergyTool::QsumLinearityEnergyTool | ( | const std::string & | type, | |
const std::string & | name, | |||
const IInterface * | parent | |||
) |
Definition at line 15 of file QsumLinearityEnergyTool.cc.
00018 : GaudiTool(type,name,parent) 00019 , m_cableSvc(0) 00020 , m_calibDataSvc(0) 00021 { 00022 declareInterface< IReconTool >(this) ; 00023 declareProperty("CableSvcName",m_cableSvcName="StaticCableSvc", 00024 "Name of service to map between detector, hardware, and electronic IDs"); 00025 declareProperty("CalibDataSvcName", m_calibDataSvcName="StaticCalibDataSvc", 00026 "Name of calibration data service"); 00027 }
QsumLinearityEnergyTool::~QsumLinearityEnergyTool | ( | ) | [virtual] |
StatusCode QsumLinearityEnergyTool::reconstruct | ( | const DayaBay::CalibReadout & | readout, | |
DayaBay::RecTrigger & | recTrigger | |||
) | [virtual] |
Implements IReconTool.
Definition at line 45 of file QsumLinearityEnergyTool.cc.
00047 { 00048 if( !readout.detector().isAD() ){ 00049 debug() << "Not an AD readout; ignoring detector " 00050 << readout.detector().detName() << endreq; 00051 recTrigger.setEnergyStatus( ReconStatus::kNotProcessed ); 00052 return StatusCode::SUCCESS; 00053 } 00054 00055 const CalibReadoutPmtCrate* pmtReadout 00056 = dynamic_cast<const CalibReadoutPmtCrate*>(&readout); 00057 if(!pmtReadout){ 00058 error() << "Incorrect type of readout crate for detector " 00059 << readout.detector().detName() << endreq; 00060 recTrigger.setEnergyStatus( ReconStatus::kBadReadout ); 00061 return StatusCode::FAILURE; 00062 } 00063 00064 // Context for this data 00065 int task = 0; 00066 ServiceMode svcMode(readout.header()->context(), task); 00067 00068 // Loop over hits and add up charge 00069 double qSum = 0; 00070 double qSquareSum = 0; 00071 int nHits = 0; 00072 CalibReadoutPmtCrate::PmtChannelReadouts::const_iterator chanIter, 00073 chanEnd = pmtReadout->channelReadout().end(); 00074 for(chanIter=pmtReadout->channelReadout().begin(); chanIter != chanEnd; 00075 chanIter++){ 00076 const CalibReadoutPmtChannel& channel = *chanIter; 00077 AdPmtSensor pmtId(channel.pmtSensorId().fullPackedData()); 00078 //AdPmtSensor pmtId = m_cableSvc->adPmtSensor(channel.channelId(), svcMode); 00079 if( pmtId.ring()<1 ){ continue; } // Ignore calibration pmts 00080 const PmtCalibData* pmtCalib = m_calibDataSvc->pmtCalibData(pmtId, svcMode); 00081 if( !pmtCalib ){ 00082 error() << "No calibration data for pmt ID: " << pmtId << endreq; 00083 recTrigger.setEnergyStatus( ReconStatus::kBadReadout ); 00084 return StatusCode::FAILURE; 00085 } 00086 if( pmtCalib->m_status != PmtCalibData::kGood ) { continue; } 00087 double peakAdc = channel.maxCharge(); 00088 qSum += peakAdc; 00089 qSquareSum += peakAdc*peakAdc; 00090 nHits++; 00091 } 00092 00093 if(nHits<1){ 00094 recTrigger.setEnergyStatus( ReconStatus::kNoHits ); 00095 return StatusCode::SUCCESS; 00096 } 00097 00098 //the next constant value is based on the results of DYB-doc-4061 00099 //PE=133.1*Energy-10.7 00100 double indexPEtoEnergy = 133.1; // FIXME: add to calibration data service 00101 double interceptOfLinearity=10.7; // the intercept of the linearity fitting; 00102 //FIXME: add to calibration data service 00103 double energy = (qSum +interceptOfLinearity)/ indexPEtoEnergy; 00104 00105 00106 recTrigger.setEnergy( energy ); 00107 // Set quality to standard deviation of hits 00108 recTrigger.setEnergyQuality(sqrt((qSquareSum - qSum*qSum/nHits)/(nHits-1))); 00109 recTrigger.setEnergyStatus( ReconStatus::kGood ); 00110 00111 return StatusCode::SUCCESS; 00112 }
StatusCode QsumLinearityEnergyTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 31 of file QsumLinearityEnergyTool.cc.
00032 { 00033 // Get Cable Service 00034 m_cableSvc = svc<ICableSvc>(m_cableSvcName,true); 00035 m_calibDataSvc = svc<ICalibDataSvc>(m_calibDataSvcName,true); 00036 00037 return StatusCode::SUCCESS; 00038 }
StatusCode QsumLinearityEnergyTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 40 of file QsumLinearityEnergyTool.cc.
00041 { 00042 return StatusCode::SUCCESS; 00043 }
std::string QsumLinearityEnergyTool::m_cableSvcName [private] |
Definition at line 44 of file QsumLinearityEnergyTool.h.
ICableSvc* QsumLinearityEnergyTool::m_cableSvc [private] |
Definition at line 47 of file QsumLinearityEnergyTool.h.
std::string QsumLinearityEnergyTool::m_calibDataSvcName [private] |
Definition at line 50 of file QsumLinearityEnergyTool.h.
Definition at line 53 of file QsumLinearityEnergyTool.h.