/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
GenTools::histograms::HistVerts Class Reference
Inheritance diagram for GenTools::histograms::HistVerts:
Inheritance graph
[legend]
Collaboration diagram for GenTools::histograms::HistVerts:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def fill_vertex
def __init__
def initialize
def site_ad_by_point
def execute
def finalize
def verbose
def debug
def info
def warning
def error
def fatal
def getAES
def initializeHeader
def finalizeHeader

Public Attributes

 prefix
 sites
 msgSvc
 archiveSvc
 stats
 defaultInputLocation
 execNumber
 currentJobId

Detailed Description

Definition at line 96 of file histograms.py.


Constructor & Destructor Documentation

def GenTools::histograms::HistVerts::__init__ (   self,
  name = 'GenVertex',
  prefix = '/file1/gen' 
)

Reimplemented from GenTools::histograms::HistBase.

Definition at line 97 of file histograms.py.

00098                                                            :
00099         HistBase.__init__(self,name,prefix)
00100         return


Member Function Documentation

StatusCode GtRockGammaTool::initialize (   self)

Reimplemented from GenTools::histograms::HistBase.

Definition at line 101 of file histograms.py.

00102                         :
00103         print 'Calling HistBase.initialize(self)'
00104         sc = HistBase.initialize(self)
00105         if sc.isFailure(): return sc
00106 
00107         binsPerMeter = 10
00108         for site in self.sites:
00109             k = site.keeper
00110             nick = site.nick
00111             
00112             #print 'Booking histograms for "%s"' % nick
00113             # Pool
00114             pool_height = 11.0
00115             pool_xsize = 17.0
00116             pool_ysize = 11.0
00117             nads = 2
00118             if nick == 'far':
00119                 pool_ysize = 17.0
00120                 nads = 4
00121             k.poolXY = TH2F('poolXY','%s Pool X-Y Vertices (m)'%nick.upper(),
00122                             pool_xsize*binsPerMeter,-pool_xsize/2,pool_xsize/2,
00123                             pool_ysize*binsPerMeter,-pool_ysize/2,pool_ysize/2)
00124 
00125             k.poolXZ = TH2F('poolXZ','%s Pool X-Z Vertices (m)'%nick.upper(),
00126                             pool_xsize*binsPerMeter,-pool_xsize/2,pool_xsize/2,
00127                             pool_height*binsPerMeter,0,-pool_height)
00128 
00129             k.poolYZ = TH2F('poolYZ','%s Pool Y-Z Vertices (m)'%nick.upper(),
00130                             pool_ysize*binsPerMeter,-pool_ysize/2,pool_ysize/2,
00131                             pool_height*binsPerMeter,0,-pool_height)
00132 
00133             # ADs
00134             ad_radius = 5.0
00135             ad_height = 5.0
00136             for iad in range(nads):
00137                 iad += 1
00138                 ad = 'AD%d' % iad
00139                 #print 'Booking AD #%d/%d' % (iad,nads)
00140 
00141                 nam = ad+'_XY'
00142                 nbinsx = 2*ad_radius*binsPerMeter
00143                 nbinsy = 2*ad_radius*binsPerMeter
00144                 #print 'TH2F %s with %d * %d = %d' % (nam,nbinsx,nbinsy,nbinsx*nbinsy)
00145                 h1 = TH2F(nam,'%s %s X-Y Vertices (m)'%(nick.upper(), ad.upper()),
00146                          nbinsx,-ad_radius,ad_radius,
00147                          nbinsy,-ad_radius,ad_radius)
00148                 k.__setattr__(nam,h1)
00149 
00150                 nam = ad+'_R2Z'
00151                 nbinsx = 2*ad_radius**2*binsPerMeter/10
00152                 nbinsy = ad_height*binsPerMeter
00153                 #print 'TH2F %s with %d * %d = %d' % (nam,nbinsx,nbinsy,nbinsx*nbinsy)
00154                 h2 = TH2F(nam,'%s %s R2Z Vertices (m2 v m)'%(nick.upper(), ad.upper()),
00155                          nbinsx,0,ad_radius**2,
00156                          nbinsy,-ad_height/2.0,ad_height/2.0)
00157                 k.__setattr__(nam,h2)
00158 
00159                 continue        # loop over ADs
00160             continue            # loop over site
00161         return SUCCESS          # initialize()

def GenTools::histograms::HistVerts::execute (   self)

Definition at line 162 of file histograms.py.

00163                      :
00164         evt = self.evtSvc()
00165         path = '/Event/Gen/GenHeader'
00166         gh = evt[path]
00167         event = gh.event()
00168 
00169         if event is None:
00170             self.error('Failed to get GenHeader from "%s"' % path)
00171             return FAILURE
00172 
00173 
00174         for vtx in irange(event.vertices_begin(),event.vertices_end()):
00175             
00176             pos = vtx.position()
00177             gpoint = Gaudi.XYZPoint(pos.x(),pos.y(),pos.z())
00178             site,ad = self.site_ad_by_point(gpoint)
00179             if not site:
00180                 self.warning('Found vertex not in site: (%s,%s,%s) (meter)' % \
00181                                  (pos.x()/units.meter,
00182                                   pos.y()/units.meter,
00183                                   pos.z()/units.meter))
00184                 continue
00185 
00186             self.fill_vertex(gpoint,site,ad)
00187             continue
00188         return SUCCESS

def GenTools::histograms::HistVerts::fill_vertex (   self,
  gpoint,
  site,
  ad_de = None 
)
Fill vertex histograms using given gpoint using the site and ad_de

Definition at line 189 of file histograms.py.

00190                                                   :
00191         '''
00192         Fill vertex histograms using given gpoint using the site and ad_de
00193         '''
00194         k = site.keeper
00195         site_point = site.site_de.geometry().toLocal(gpoint)
00196         sx_m = site_point.x()/units.meter
00197         sy_m = site_point.y()/units.meter
00198         sz_m = site_point.z()/units.meter
00199         k.poolXY.Fill(sx_m,sy_m)
00200         k.poolXZ.Fill(sx_m,sz_m)
00201         k.poolYZ.Fill(sy_m,sz_m)
00202 
00203         if not ad_de: return
00204 
00205         ad_point = ad_de.geometry().toLocal(gpoint)
00206 
00207         adx_m = ad_point.x()/units.meter
00208         ady_m = ad_point.y()/units.meter
00209         adz_m = ad_point.z()/units.meter
00210 
00211         iad = site.ad_de.index(ad_de) + 1
00212         k.__getattr__('AD%d_XY'%iad).Fill(adx_m,ady_m)
00213         k.__getattr__('AD%d_R2Z'%iad).Fill(adx_m**2+ady_m**2,adz_m)
00214         return

def GenTools::histograms::HistBase::site_ad_by_point (   self,
  gaudi_point 
) [inherited]
Return tuple of (site,ad_de) that contains the given global gaudi point.
If not in a site, both are None.  If not in an AD ad_de is None.

Definition at line 75 of file histograms.py.

00076                                            :
00077         '''
00078         Return tuple of (site,ad_de) that contains the given global gaudi point.
00079         If not in a site, both are None.  If not in an AD ad_de is None.
00080         '''
00081 
00082         xyz  = [gaudi_point.x(),gaudi_point.y(),gaudi_point.z()]
00083         xyz_m = map(lambda x: x/units.meter, xyz)
00084         for site in self.sites:
00085             site_gi = site.site_de.geometry()
00086             local_point = site_gi.toLocal(gaudi_point)
00087             if not site_gi.isInside(gaudi_point):
00088                 continue
00089             for ad_de in site.ad_de:
00090                 if ad_de.geometry().isInside(gaudi_point):
00091                     return (site,ad_de)
00092                 continue
00093             return (site,None)
00094             continue
00095         return (None,None)


Member Data Documentation

Definition at line 44 of file histograms.py.

Definition at line 44 of file histograms.py.


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

Generated on Fri May 16 2014 10:18:51 for GenTools by doxygen 1.7.4