#include <ValiNTuple.h>
Inheritance diagram for ValiNTuple:
Public Member Functions | |
| ValiNTuple (const std::string &name, ISvcLocator *pSvcLocator) | |
| virtual | ~ValiNTuple () |
| virtual StatusCode | initialize () |
| virtual StatusCode | execute () |
| virtual StatusCode | finalize () |
| virtual StatusCode | sysExecute () |
| void | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
| void | 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 |
| bool | registerContext () const |
| INTupleSvc * | evtColSvc () const |
| IAlgContextSvc * | contextSvc () 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 |
| unsigned long | release () |
| const std::string & | context () const |
| const std::string & | rootInTES () const |
| double | globalTimeOffset () const |
| virtual StatusCode | sysStart () |
| virtual StatusCode | sysInitialize () |
| virtual StatusCode | sysReinitialize () |
| virtual StatusCode | sysRestart () |
| virtual StatusCode | sysStop () |
| virtual StatusCode | sysFinalize () |
| virtual StatusCode | sysBeginRun () |
| virtual StatusCode | sysEndRun () |
| virtual const std::string & | name () const |
| virtual const std::string & | version () const |
| virtual StatusCode | configure () |
| virtual StatusCode | terminate () |
| virtual StatusCode | start () |
| virtual StatusCode | stop () |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | restart () |
| virtual bool | isExecuted () const |
| virtual void | setExecuted (bool state) |
| virtual void | resetExecuted () |
| virtual StatusCode | beginRun () |
| virtual StatusCode | endRun () |
| virtual Gaudi::StateMachine::State | FSMState () const |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| virtual bool | isEnabled () const |
| virtual bool | filterPassed () const |
| virtual void | setFilterPassed (bool state) |
| 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 |
| void | setOutputLevel (int level) |
| IAuditorSvc * | auditorSvc () const |
| IChronoStatSvc * | chronoSvc () const |
| IChronoStatSvc * | chronoStatService () const |
| IDataProviderSvc * | detSvc () const |
| IDataProviderSvc * | detDataService () const |
| IConversionSvc * | detCnvSvc () const |
| IConversionSvc * | detDataCnvService () const |
| IDataProviderSvc * | eventSvc () const |
| IDataProviderSvc * | evtSvc () const |
| IDataProviderSvc * | eventDataService () const |
| IConversionSvc * | eventCnvSvc () const |
| IConversionSvc * | eventDataCnvService () const |
| IHistogramSvc * | histoSvc () const |
| IHistogramSvc * | histogramDataService () const |
| IMessageSvc * | msgSvc () const |
| IMessageSvc * | messageService () const |
| INTupleSvc * | ntupleSvc () const |
| INTupleSvc * | ntupleService () const |
| IRndmGenSvc * | randSvc () const |
| IToolSvc * | toolSvc () const |
| IExceptionSvc * | exceptionSvc () const |
| ISvcLocator * | serviceLocator () const |
| ISvcLocator * | svcLoc () const |
| StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
| std::vector< Algorithm * > * | subAlgorithms () const |
| 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 |
| StatusCode | setProperties () |
| 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 |
| 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 |
| unsigned long | addRef () |
| StatusCode | queryInterface (const InterfaceID &riid, void **) |
Static Public Member Functions | |
| 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 |
| bool | isInitialized () const |
| bool | isFinalized () const |
| int | outputLevel () const |
| IntegerProperty & | outputLevelProperty () |
| void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
| static const bool | IgnoreRootInTES |
| static const bool | UseRootInTES |
Private Member Functions | |
| StatusCode | BookVertices () |
Private Attributes | |
| std::string | m_location |
| Property: Location - TES path to the generated kinematics. | |
| std::string | m_volume |
| Property: Volume - TDS path to the physical volume (detector element) used when generating kinematic vertex locations. | |
| std::string | m_filepath |
| Property: FilePath - path to use when registering histograms. | |
| double | m_maxEnergy |
| Property MaxEnergy - max value for energy histogram. | |
| double | m_energyUnits |
| Property EnergyUnits - units for energy. | |
| ITHistSvc * | m_hsvc |
| TTree * | m_outTree |
Definition at line 19 of file ValiNTuple.h.
| ValiNTuple::ValiNTuple | ( | const std::string & | name, | |
| ISvcLocator * | pSvcLocator | |||
| ) |
Definition at line 46 of file ValiNTuple.cc.
00047 : GaudiAlgorithm(name,pSvcLocator) 00048 , m_hsvc(0) 00049 , m_outTree(0) 00050 { 00051 declareProperty("Location",m_location=DayaBay::SimHeaderLocation::Default, 00052 "Location in the TES to get HepMCEvents"); 00053 declareProperty("FilePath",m_filepath="/file1/sim/", 00054 "File path with with to register TTree ."); 00055 00056 if (!detector_bins.size()) { 00057 DayaBay::Detector dets[] = { 00058 DayaBay::Detector(Site::kDayaBay,DetectorId::kAD1), 00059 DayaBay::Detector(Site::kDayaBay,DetectorId::kAD2), 00060 DayaBay::Detector(Site::kDayaBay,DetectorId::kOWS), 00061 DayaBay::Detector(Site::kDayaBay,DetectorId::kIWS), 00062 DayaBay::Detector(Site::kDayaBay,DetectorId::kRPC), 00063 DayaBay::Detector(Site::kLingAo,DetectorId::kAD1), 00064 DayaBay::Detector(Site::kLingAo,DetectorId::kAD2), 00065 DayaBay::Detector(Site::kLingAo,DetectorId::kOWS), 00066 DayaBay::Detector(Site::kLingAo,DetectorId::kIWS), 00067 DayaBay::Detector(Site::kLingAo,DetectorId::kRPC), 00068 DayaBay::Detector(Site::kFar,DetectorId::kAD1), 00069 DayaBay::Detector(Site::kFar,DetectorId::kAD2), 00070 DayaBay::Detector(Site::kFar,DetectorId::kAD3), 00071 DayaBay::Detector(Site::kFar,DetectorId::kAD4), 00072 DayaBay::Detector(Site::kFar,DetectorId::kOWS), 00073 DayaBay::Detector(Site::kFar,DetectorId::kIWS), 00074 DayaBay::Detector(Site::kFar,DetectorId::kRPC), 00075 DayaBay::Detector(), 00076 }; 00077 00078 detector_bins[0] = pair<int,string>(0,"unknown"); 00079 for (int ind=0; dets[ind].site(); ++ind) { 00080 detector_bins[dets[ind].siteDetPackedData()] 00081 = pair<int,string>(ind+1,dets[ind].detName()); 00082 } 00083 } 00084 00085 00086 }
| ValiNTuple::~ValiNTuple | ( | ) | [virtual] |
| StatusCode ValiNTuple::initialize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 91 of file ValiNTuple.cc.
00092 { 00093 this->GaudiAlgorithm::initialize(); 00094 00095 // Get the histogram service 00096 if ( service("THistSvc", m_hsvc).isFailure()) { 00097 error() << " No THistSvc available." << endreq; 00098 return StatusCode::FAILURE; 00099 } 00100 00101 m_outTree = new TTree("nOutTree","Output from DetSim"); 00102 string outstring= m_filepath+"nOutTree"; 00103 if (m_hsvc->regTree(outstring,m_outTree).isFailure()) { 00104 error() << "Could not register " << m_filepath+"nOutTree" << endreq; 00105 delete m_outTree; m_outTree = 0; 00106 return StatusCode::FAILURE; 00107 } 00108 00109 return StatusCode::SUCCESS; 00110 }
| StatusCode ValiNTuple::execute | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 112 of file ValiNTuple.cc.
00113 { 00114 00115 DayaBay::SimHeader* shead = get<DayaBay::SimHeader>(m_location); 00116 00117 // Get hit info 00118 const DayaBay::SimHitHeader* shith = shead->hits(); 00119 const DayaBay::SimHitHeader::hc_map& hcmap = shith->hitCollection(); 00120 DayaBay::SimHitHeader::hc_map::const_iterator it, done = hcmap.end(); 00121 00122 00123 // Get Primary Track Info. 00124 const DayaBay::SimParticleHistory* shist = shead->particleHistory(); 00125 const std::list<const DayaBay::SimTrack*>& priTrks = shist->primaryTracks(); 00126 std::list<const DayaBay::SimTrack*>::const_iterator priIt, priEnd=priTrks.end(); 00127 00128 //Get UnObservable Statistics info 00129 const DayaBay::SimUnobservableStatisticsHeader* unobSt = shead->unobservableStatistics(); 00130 const DayaBay::SimUnobservableStatisticsHeader::stat_map& statmap = unobSt->stats(); 00131 DayaBay::SimUnobservableStatisticsHeader::stat_map::const_iterator st, stdone = statmap.end(); 00132 00133 00134 // if(statmap.size()){ 00135 for (st=statmap.begin(); st != stdone; ++st) { 00136 00137 info () << " stat first " << st->first << " stat second sum " << st->second.sum() <<endreq; 00138 } 00139 // } 00140 00141 00142 int hitsize(0),hitInCont(0); 00143 double trkLengInOws(0),trkLengInIws(0); 00144 00145 hitsize=hcmap.size(); 00146 info () << " Hit size " << hitsize <<endreq; 00147 00148 // hitStruct* hitCol[hitsize]; 00149 00150 hitStruct singleHit; 00151 00152 //**** hit information** 00153 m_outTree->Branch("hitTime",&singleHit.hitTime,"hitTime/D"); 00154 m_outTree->Branch("hitDetID",&singleHit.sensDetId,"hitDetID/I"); 00155 m_outTree->Branch("hitWt",&singleHit.weight,"hitWt/F"); 00156 m_outTree->Branch("hitancPDG",&singleHit.ancestorPdg,"hitancPDG/I"); 00157 m_outTree->Branch("hitpX",&singleHit.PosX,"hitpX/D"); 00158 m_outTree->Branch("hitpY",&singleHit.PosY,"hitpY/D"); 00159 m_outTree->Branch("hitpZ",&singleHit.PosZ,"hitpZ/D"); 00160 m_outTree->Branch("hitWavl",&singleHit.wavelt,"hitWavl/D"); 00161 00162 //*** *** 00163 m_outTree->Branch("hitsize",&hitsize,"hitsize/I"); 00164 m_outTree->Branch("hitInCont",&hitInCont,"hitInCont/I"); 00165 m_outTree->Branch("trkLengInOws",&trkLengInOws,"trkLengInOws/D"); 00166 m_outTree->Branch("trkLengInIws",&trkLengInIws,"trkLengInIws/D"); 00167 00168 00169 info () << " 01010101010101010 " << endreq; 00170 00171 // m_outTree.Branch("hitCol", &hitCol,"hitCol[hitsize]/F"); 00172 00173 info () << " 000000000 " << endreq; 00174 00175 00176 00177 // Iterate to get the hit informatioin. 00178 for (it=hcmap.begin(); it != done; ++it) { 00179 DayaBay::Detector det(it->first); 00180 pair<int,string> bin = detector_bins[det.siteDetPackedData()]; 00181 00182 info () << "Got hit collection from " << det.detName() 00183 << " in bin " << bin.first << endreq; 00184 00185 size_t siz = it->second->collection().size(); 00186 info () << " #hits in this Det " << siz << endreq; 00187 00188 // const DayaBay::SimHitCollection::hit_container hitcont=it->second->collection(); 00189 // DayaBay::SimHitCollection::hit_container::const_iterator ithit; 00190 00191 const std::vector<DayaBay::SimHit*>& hitcont=it->second->collection(); 00192 std::vector<DayaBay::SimHit*>::const_iterator ithit; 00193 00194 hitInCont=siz; 00195 00196 if(siz!=0){ 00197 for(ithit=hitcont.begin(); ithit !=hitcont.end();++ithit) { 00198 singleHit.hitTime=(*ithit)->hitTime(); 00199 // info () << " Hit time "<< singleHit.hitTime << endreq; 00200 singleHit.sensDetId=(*ithit)->sensDetId(); 00201 singleHit.weight=(*ithit)->weight(); 00202 if((*ithit)->ancestor().track()){ 00203 singleHit.ancestorPdg=(*ithit)->ancestor().track()->particle(); //particle PDG//generate error 00204 } 00205 singleHit.PosX=(*ithit)->localPos().x(); 00206 singleHit.PosY=(*ithit)->localPos().y(); 00207 singleHit.PosZ=(*ithit)->localPos().z(); 00208 // info () << " x: "<< singleHit.PosX <<singleHit.PosY << singleHit.PosZ << endreq; 00209 00210 const DayaBay::SimPmtHit* pmthit = static_cast<const DayaBay::SimPmtHit*>(*ithit); 00211 00212 // info () << " 22222222 " << endreq; 00213 00214 // singleHit.wavelt=(*pmthit).wavelength(); 00215 // m_outTree->Fill(); 00216 } 00217 } 00218 else m_outTree->Fill(); 00219 } 00220 00221 00222 00223 00224 // m_outTree->Write(); 00225 return StatusCode::SUCCESS; 00226 }
| StatusCode ValiNTuple::finalize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 228 of file ValiNTuple.cc.
00229 { 00230 00231 return this->GaudiAlgorithm::finalize(); 00232 }
| StatusCode ValiNTuple::BookVertices | ( | ) | [private] |
std::string ValiNTuple::m_location [private] |
Property: Location - TES path to the generated kinematics.
Defaults to DayaBay::HepMCEventLocation::Default
Definition at line 35 of file ValiNTuple.h.
std::string ValiNTuple::m_volume [private] |
Property: Volume - TDS path to the physical volume (detector element) used when generating kinematic vertex locations.
Definition at line 39 of file ValiNTuple.h.
std::string ValiNTuple::m_filepath [private] |
Property: FilePath - path to use when registering histograms.
Must end in "/". Default "/file1/gen/"
Definition at line 43 of file ValiNTuple.h.
double ValiNTuple::m_maxEnergy [private] |
double ValiNTuple::m_energyUnits [private] |
ITHistSvc* ValiNTuple::m_hsvc [private] |
Definition at line 57 of file ValiNTuple.h.
TTree* ValiNTuple::m_outTree [private] |
Definition at line 63 of file ValiNTuple.h.
1.4.7