#include <CenterOfChargePosTool.h>
Inheritance diagram for CenterOfChargePosTool:
Public Types | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
| SUCCESS | |
| NO_INTERFACE | |
| VERSMISMATCH | |
| LAST_ERROR | |
| enum | Status |
Public Member Functions | |
| CenterOfChargePosTool (const std::string &type, const std::string &name, const IInterface *parent) | |
| virtual | ~CenterOfChargePosTool () |
| 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 |
| std::string | m_pmtGeomSvcName |
| IPmtGeomInfoSvc * | m_pmtGeomSvc |
| bool | m_applyScaling |
Definition at line 23 of file CenterOfChargePosTool.h.
| CenterOfChargePosTool::CenterOfChargePosTool | ( | const std::string & | type, | |
| const std::string & | name, | |||
| const IInterface * | parent | |||
| ) |
Definition at line 19 of file CenterOfChargePosTool.cc.
00022 : GaudiTool(type,name,parent) 00023 , m_cableSvc(0) 00024 , m_calibDataSvc(0) 00025 , m_pmtGeomSvc(0) 00026 { 00027 declareInterface< IReconTool >(this) ; 00028 declareProperty("CableSvcName",m_cableSvcName="StaticCableSvc", 00029 "Name of service to map between detector, hardware, and electronic IDs"); 00030 declareProperty("CalibDataSvcName", m_calibDataSvcName="StaticCalibDataSvc", 00031 "Name of calibration data service"); 00032 declareProperty("PmtGeomSvcName", m_pmtGeomSvcName="PmtGeomInfoSvc", 00033 "Name of PMT geometry data service"); 00034 declareProperty("ApplyScaling", m_applyScaling=true, 00035 "Apply empirical scaling factor to get a 'reconstructed' position"); 00036 }
| CenterOfChargePosTool::~CenterOfChargePosTool | ( | ) | [virtual] |
| StatusCode CenterOfChargePosTool::reconstruct | ( | const DayaBay::CalibReadout & | readout, | |
| DayaBay::RecTrigger & | recTrigger | |||
| ) | [virtual] |
Implements IReconTool.
Definition at line 55 of file CenterOfChargePosTool.cc.
00057 { 00058 if( !readout.detector().isAD() ){ 00059 debug() << "Not an AD readout; ignoring detector " 00060 << readout.detector().detName() << endreq; 00061 recTrigger.setPositionStatus( ReconStatus::kNotProcessed ); 00062 return StatusCode::SUCCESS; 00063 } 00064 00065 const CalibReadoutPmtCrate* pmtReadout 00066 = dynamic_cast<const CalibReadoutPmtCrate*>(&readout); 00067 if(!pmtReadout){ 00068 error() << "Incorrect type of readout crate for detector " 00069 << readout.detector().detName() << endreq; 00070 recTrigger.setPositionStatus( ReconStatus::kBadReadout ); 00071 return StatusCode::FAILURE; 00072 } 00073 00074 // Context for this data 00075 int task = 0; 00076 ServiceMode svcMode(readout.header()->context(), task); 00077 00078 // Loop over hits and determine charge-weighted mean position 00079 double pos[3]; 00080 double posSquare[3]; 00081 for(int idx = 0; idx<3; idx++){ pos[idx]=0; posSquare[idx]=0; } 00082 double time = 0; 00083 double qSum = 0; 00084 int nHits = 0; 00085 CalibReadoutPmtCrate::PmtChannelReadouts::const_iterator chanIter, 00086 chanEnd = pmtReadout->channelReadout().end(); 00087 for(chanIter=pmtReadout->channelReadout().begin(); chanIter != chanEnd; 00088 chanIter++){ 00089 const CalibReadoutPmtChannel& channel = *chanIter; 00090 AdPmtSensor pmtId(channel.pmtSensorId().fullPackedData()); 00091 if( pmtId.ring()<1 ){ continue; } // Ignore calibration pmts 00092 const PmtCalibData* pmtCalib = m_calibDataSvc->pmtCalibData(pmtId, svcMode); 00093 if( !pmtCalib ){ 00094 error() << "No calibration data for pmt ID: " << pmtId << endreq; 00095 recTrigger.setPositionStatus( ReconStatus::kBadReadout ); 00096 return StatusCode::FAILURE; 00097 } 00098 if( pmtCalib->m_status != PmtCalibData::kGood ) { continue; } 00099 const CLHEP::Hep3Vector& pmtPos 00100 = m_pmtGeomSvc->get(pmtId.fullPackedData())->localPosition(); 00101 double peakAdc = channel.maxCharge(); 00102 double firstTdc = channel.earliestTime(); 00103 for(int idx = 0; idx<3; idx++){ 00104 pos[idx] += peakAdc*pmtPos[idx]; 00105 posSquare[idx] += peakAdc*pmtPos[idx]*pmtPos[idx]; 00106 } 00107 time += firstTdc; 00108 qSum += peakAdc; 00109 nHits++; 00110 } 00111 00112 if(nHits<1){ 00113 recTrigger.setPositionStatus( ReconStatus::kNoHits ); 00114 return StatusCode::SUCCESS; 00115 } 00116 double posStdDev = 0; 00117 for(int idx = 0; idx<3; idx++){ 00118 posStdDev += posSquare[idx] - pos[idx]*pos[idx]/qSum; 00119 pos[idx] /= qSum; 00120 } 00121 posStdDev /= qSum; 00122 posStdDev = sqrt(posStdDev); 00123 time /= qSum; 00124 00125 if(m_applyScaling){ 00126 // Apply empirical rho, z scaling to vertex position 00127 // This is not very good, but is useful as a prefit 00128 double rho = sqrt(pos[0]*pos[0] + pos[1]*pos[1]); 00129 double rhoNorm = rho/2340.; 00130 double zNorm = pos[2]/1750.; 00131 if(zNorm<0) zNorm *= -1; 00132 double rhoScaled = 1-(1-rhoNorm)/TMath::Power((1+rhoNorm), 3.13); 00133 double zScaled = 00134 1-(1-zNorm)/TMath::Power((1+zNorm), 00135 10.0*(1-sqrt(rhoNorm))); 00136 //warning() << "Scaling by: " << rhoScaled << " , " << zScaled << endreq; 00137 pos[0] *= rhoScaled/rhoNorm; 00138 pos[1] *= rhoScaled/rhoNorm; 00139 pos[2] *= zScaled/zNorm; 00140 } 00141 00142 CLHEP::HepLorentzVector position(pos[0], pos[1], pos[2], time); 00143 recTrigger.setPosition( position ); 00144 // Set quality to charge-weighted standard deviation of hit positions 00145 recTrigger.setPositionQuality( posStdDev ); 00146 recTrigger.setPositionStatus( ReconStatus::kGood ); 00147 00148 return StatusCode::SUCCESS; 00149 }
| StatusCode CenterOfChargePosTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 40 of file CenterOfChargePosTool.cc.
00041 { 00042 // Get Cable Service 00043 m_cableSvc = svc<ICableSvc>(m_cableSvcName,true); 00044 m_calibDataSvc = svc<ICalibDataSvc>(m_calibDataSvcName,true); 00045 m_pmtGeomSvc = svc<IPmtGeomInfoSvc>(m_pmtGeomSvcName,true); 00046 00047 return StatusCode::SUCCESS; 00048 }
| StatusCode CenterOfChargePosTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 50 of file CenterOfChargePosTool.cc.
00051 { 00052 return StatusCode::SUCCESS; 00053 }
std::string CenterOfChargePosTool::m_cableSvcName [private] |
Definition at line 41 of file CenterOfChargePosTool.h.
ICableSvc* CenterOfChargePosTool::m_cableSvc [private] |
Definition at line 43 of file CenterOfChargePosTool.h.
std::string CenterOfChargePosTool::m_calibDataSvcName [private] |
Definition at line 46 of file CenterOfChargePosTool.h.
Definition at line 48 of file CenterOfChargePosTool.h.
std::string CenterOfChargePosTool::m_pmtGeomSvcName [private] |
Definition at line 51 of file CenterOfChargePosTool.h.
Definition at line 53 of file CenterOfChargePosTool.h.
bool CenterOfChargePosTool::m_applyScaling [private] |
Definition at line 56 of file CenterOfChargePosTool.h.
1.4.7