/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
ExampleTree::ExampleTreeAlg Class Reference
Inheritance diagram for ExampleTree::ExampleTreeAlg:
Inheritance graph
[legend]
Collaboration diagram for ExampleTree::ExampleTreeAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 statsSvc
 simTree
 simTime
 nSimHits
 maxSimHits
 simHitPmtId
 simHitTime

Detailed Description

Definition at line 20 of file ExampleTree.py.


Constructor & Destructor Documentation

def ExampleTree::ExampleTreeAlg::__init__ (   self,
  name 
)

Definition at line 22 of file ExampleTree.py.

00023                            :
00024         DybPythonAlg.__init__(self,name)
00025         return


Member Function Documentation

def ExampleTree::ExampleTreeAlg::initialize (   self)

Definition at line 26 of file ExampleTree.py.

00027                         :
00028         status = DybPythonAlg.initialize(self)
00029         if status.isFailure(): return status
00030         self.info("initializing")
00031 
00032         # Initialize services
00033         #  Statistics Service: Use for histograms, graphs, trees
00034         self.statsSvc = self.svc('IStatisticsSvc','StatisticsSvc')
00035         if self.statsSvc == None:
00036             self.error("Failed to initialize statistics service.")
00037             return FAILURE        
00038 
00039         # Make a tree
00040         self.simTree= TTree("simTree","Tree of Simulated Hits")
00041 
00042         # Make branch addresses for single-numbers. 'i'=int, 'd'=double
00043         self.simTime = array('d',[0])
00044         self.nSimHits = array('i',[0])
00045         # Make branch addresses for array branches
00046         self.maxSimHits = 4096
00047         self.simHitPmtId = array('i',self.maxSimHits*[0])
00048         self.simHitTime = array('d',self.maxSimHits*[0])
00049 
00050         # Make Branches
00051         self.simTree.Branch('simTime',self.simTime,'simTimeSec/D')
00052         self.simTree.Branch('nSimHits',self.nSimHits,'nSimHits/I')
00053         self.simTree.Branch('simHitPmtId',self.simHitPmtId,
00054                             'simHitPmtId[nSimHits]/I')
00055         self.simTree.Branch('simHitTime',self.simHitTime,
00056                             'simHitTime[nSimHits]/D')
00057 
00058         status = self.statsSvc.put('/file0/sim/simTree', self.simTree)
00059         if status.isFailure(): return status
00060 
00061         return SUCCESS

def ExampleTree::ExampleTreeAlg::execute (   self)

Definition at line 62 of file ExampleTree.py.

00063                      :
00064         self.info("executing")
00065 
00066         # Access current data
00067         evt = self.evtSvc()
00068         simHdr = evt["/Event/Sim/SimHeader"]
00069         if simHdr == None:
00070             self.error("Failed to get current sim header")
00071             return FAILURE
00072 
00073         # Set Branch values
00074         self.simTime[0] = simHdr.timeStamp().GetSeconds()
00075         # Loop over hits in each detector
00076         shh = simHdr.hits()
00077         hitCollectionMap = shh.hitCollection()
00078         nHits = 0
00079         for shcPair in irange(hitCollectionMap.begin(),
00080                               hitCollectionMap.end()):
00081             detectorId = shcPair.first
00082             hitCollection = shcPair.second
00083             self.info( "Found %d hits for detector %d"
00084                        % ( hitCollection.collection().size(),
00085                            detectorId )
00086                        )
00087             for hit in hitCollection.collection():
00088                 self.simHitPmtId[nHits] = hit.sensDetId()
00089                 self.simHitTime[nHits] = hit.hitTime()
00090                 nHits += 1
00091         self.nSimHits[0] = nHits
00092 
00093         # Fill the tree with current branch values
00094         self.simTree.Fill()
00095 
00096         return SUCCESS
        
def ExampleTree::ExampleTreeAlg::finalize (   self)

Definition at line 97 of file ExampleTree.py.

00098                       :
00099         self.info("finalizing")
00100         status = DybPythonAlg.finalize(self)
00101         return status
00102 


Member Data Documentation

Definition at line 26 of file ExampleTree.py.

Definition at line 26 of file ExampleTree.py.

Definition at line 26 of file ExampleTree.py.

Definition at line 26 of file ExampleTree.py.

Definition at line 26 of file ExampleTree.py.

Definition at line 26 of file ExampleTree.py.

Definition at line 26 of file ExampleTree.py.


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

Generated on Fri May 16 2014 09:49:50 for DivingIn by doxygen 1.7.4