/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 | Private Member Functions
SimHistsExample::UserData::GenSimData Class Reference
Inheritance diagram for SimHistsExample::UserData::GenSimData:
Inheritance graph
[legend]
Collaboration diagram for SimHistsExample::UserData::GenSimData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def initTagList
def check

Public Attributes

 tag
 data
 gen
 sim

Private Member Functions

def _fill_gen
def _fill_sim

Detailed Description

Definition at line 9 of file UserData.py.


Member Function Documentation

def SimHistsExample::UserData::GenSimData::initTagList (   self)

Definition at line 11 of file UserData.py.

00012                          :
00013 
00014         self.tag = self.tagSet.GenSimTag = Tag()
00015         self.data = self.tag.dataSet.GenSimData = Data('/Event/UserData/SimHistsExample/GenSim')
00016         self.gen = self.data.GenSimData.Gen
00017         self.sim = self.data.GenSimData.Sim
00018         
00019         self.gen.number = Int()
00020         self.gen.pid = IntArray()
00021         self.gen.mass = FloatArray()
00022         self.gen.energy = FloatArray()
00023         self.gen.x, self.gen.y, self.gen.z, self.gen.dx, self.gen.dy, self.gen.dz = \
00024             map (lambda x: FloatArray(), range(6))
00025 
00026         self.sim.nhits = Int()
00027         self.sim.weight = FloatArray()
00028         self.sim.detid = IntArray()
00029         self.sim.time = FloatArray()
00030 
00031         return

def SimHistsExample::UserData::GenSimData::check (   self,
  evt 
)

Definition at line 32 of file UserData.py.

00033                        :
00034         
00035         gh = evt['/Event/Gen/GenHeader']
00036         if not gh:
00037             self.error('No GenHeader found')
00038             return FAILURE
00039         self._fill_gen(gh)
00040 
00041         sh = evt['/Event/Sim/SimHeader']
00042         if not sh:
00043             self.error('No SimHeader found')
00044             return FAILURE
00045         self._fill_sim(sh)
00046 
00047         self.tag.tagIt()
00048 
00049         return SUCCESS

def SimHistsExample::UserData::GenSimData::_fill_gen (   self,
  gh 
) [private]

Definition at line 50 of file UserData.py.

00051                           :
00052         ge = gh.event()
00053         if not ge:
00054             self.error('Failed to get a GenEvent')
00055             return FAILURE
00056 
00057         self.gen.number = ge.particles_size()
00058         for part in irange(ge.particles_begin(),ge.particles_end()):
00059             self.gen.pid.append(part.pdg_id())
00060             self.gen.mass.append(part.generated_mass())
00061             mom = part.momentum()
00062             mag = mom.mag()
00063             self.gen.energy.append(mom.e())
00064             vtx = part.production_vertex()
00065             self.gen.x.append(vtx.x())
00066             self.gen.y.append(vtx.y())
00067             self.gen.z.append(vtx.z())
00068             self.gen.dx.append(mom.x()/mag)
00069             self.gen.dy.append(mom.y()/mag)
00070             self.gen.dz.append(mom.z()/mag)
00071         return SUCCESS
        
def SimHistsExample::UserData::GenSimData::_fill_sim (   self,
  sh 
) [private]

Definition at line 72 of file UserData.py.

00073                           :
00074         shh = sh.hits()
00075         hcmap = shh.hitCollection()
00076         for shcoll in irange(hcmap.begin(),hcmap.end()):
00077             detid = shcoll.first                # detector
00078             shcont = shcoll.second.collection() # vector<SimHit*>
00079 
00080             for hit in irange(shcont.begin(),shcont.end()):
00081 
00082                 self.sim.detid.append(detid)
00083                 self.sim.weight.append(hit.weight())
00084                 self.sim.time.append(hit.time())
00085 
00086                 continue
00087             continue
00088         self.sim.nhits = len(self.sim.detid)
00089         return SUCCESS
00090 

Member Data Documentation

Definition at line 11 of file UserData.py.

Definition at line 11 of file UserData.py.

Definition at line 11 of file UserData.py.

Definition at line 11 of file UserData.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 10:19:50 for SimHistsExample by doxygen 1.7.4