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

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 hist
 target_de_name
 coorSvc
 statsSvc

Detailed Description

Definition at line 20 of file __init__.py.


Constructor & Destructor Documentation

def chkGamma::plotGammaBasics::__init__ (   self,
  name 
)

Definition at line 22 of file __init__.py.

00023                            :
00024         GaudiAlgo.__init__(self,name)
00025         self.hist = {}
00026         return
    

Member Function Documentation

def chkGamma::plotGammaBasics::initialize (   self)

Definition at line 27 of file __init__.py.

00028                         :
00029         print "Initializing the gamma basic ploter", self.name()
00030         status = GaudiAlgo.initialize(self)
00031         if status.isFailure(): return status
00032         self.target_de_name = '/dd/Structure/AD/db-ade1/db-sst1/db-oil1'
00033 #        self.target_de_name = '/dd/Structure/AD/db-oil1'
00034 
00035         # What services do you need?
00036         self.coorSvc = self.svc('ICoordSysSvc', 'CoordSysSvc')
00037         if not self.coorSvc:
00038             print 'Failed to get CoordSysSvc'
00039             return FAILURE
00040 
00041 #        self.histSvc = self.svc('ITHistSvc', 'THistSvc')
00042 
00043         self.statsSvc = self.svc('IStatisticsSvc','StatisticsSvc')
00044         if self.statsSvc == None:
00045             self.error("Failed to initialize IStat service.")
00046             return FAILURE        
00047 
00048         self.hist["genRZ"] = TH2D("genRZ", "Generation Vertex R-Z", \
00049                                       100, 0.0, 6.1504, 100, -2.48, 2.48)
00050         status = self.statsSvc.put('/file1/basics/genRZ', \
00051                                           self.hist["genRZ"])
00052         if status.isFailure(): return status
00053         
00054         self.hist["genXY"] = TH2D("genXY", "Generation Vertex X-Y", \
00055                                       100, -2.48, 2.48, 100, -2.48, 2.48)
00056         status = self.statsSvc.put('/file1/basics/genXY', \
00057                                           self.hist["genXY"])
00058         if status.isFailure(): return status
00059         
00060         self.hist["HitTime"] = TH1F("HitTime", "Hit Time",
00061                                     100, 0.0, 100)
00062         status = self.statsSvc.put('/file1/basics/HitTime',
00063                                       self.hist["HitTime"])
00064         if status.isFailure(): return status
00065         
00066         self.hist["peGen_GdLS"] = TH1F("peGen_GdLS", "pe of a gamma (in GdLS)",
00067                                        500, 0, 1400)
00068         status = self.statsSvc.put('/file1/basics/peGen_GdLS', 
00069                                       self.hist["peGen_GdLS"])
00070         if status.isFailure(): return status
00071         
00072         self.hist["peGen_LS"] = TH1F("peGen_LS",
00073                                      "pe of a gamma(in LS)",
00074                                      500, 0, 1400)
00075         status = self.statsSvc.put('/file1/basics/peGen_LS', 
00076                                       self.hist["peGen_LS"])
00077         if status.isFailure(): return status
00078         
00079         self.hist["peGen_inLS"] = TH1F("peGen_inLS", 
00080                                        "pe of a gamma (within LS)", 
00081                                        500, 0, 1400)
00082         status = self.statsSvc.put('/file1/basics/peGen_inLS', 
00083                                       self.hist["peGen_inLS"])
00084         if status.isFailure(): return status
00085         
00086         self.hist["peGen_MO"] = TH1F("peGen_MO", 
00087                                      "pe of a gamma (in MO)", 
00088                                      500, 0, 1400)
00089         status = self.statsSvc.put('/file1/basics/peGen_MO', 
00090                                       self.hist["peGen_MO"])
00091         if status.isFailure(): return status
00092         
00093         self.hist["peGen_all"] = TH1F("peGen_all",
00094                                       "pe of a gamma (in AD)", 
00095                                       500, 0, 1400)
00096         status = self.statsSvc.put('/file1/basics/peGen_all', 
00097                                       self.hist["peGen_all"])
00098         if status.isFailure(): return status
00099         
00100         self.hist["peCap_GdLS"] = TH1F("peCap_GdLS", 
00101                                        "pe of a gamma stop in GdLS", 
00102                                        500, 0, 1400)
00103         status = self.statsSvc.put('/file1/basics/peCap_GdLS', 
00104                                       self.hist["peCap_GdLS"])
00105         if status.isFailure(): return status
00106         
00107         self.hist["peCap_LS"] = TH1F("peCap_LS", 
00108                                      "pe of a gamma stop in LS", 
00109                                      500, 0, 1400)
00110         status = self.statsSvc.put('/file1/basics/peCap_LS', 
00111                                       self.hist["peCap_LS"])
00112         if status.isFailure(): return status
00113         
00114         self.hist["peCap_MO"] = TH1F("peCap_MO",
00115                                      "pe of a gamma stop in MO",
00116                                      500, 0, 1400)
00117         status = self.statsSvc.put('/file1/basics/peCap_MO', 
00118                                       self.hist["peCap_MO"])
00119         if status.isFailure(): return status
00120         
00121         self.hist["peGenCap_GdLS"] = TH1F("peGenCap_GdLS", 
00122                                           "pe of a gamma in AD",
00123                                           500, 0, 1400)
00124         status = self.statsSvc.put('/file1/basics/peGenCap_GdLS', 
00125                                       self.hist["peGenCap_GdLS"])
00126         if status.isFailure(): return status
00127         
00128         self.hist["eDepInGdLS"] = TH1D("eDepInGdLS", "Deposited Energy [MeV]",
00129                                        70, 0, 7)
00130         status = self.statsSvc.put('/file1/basics/eDepInGdLS', 
00131                                       self.hist["eDepInGdLS"])
00132         if status.isFailure(): return status
00133         
00134         self.hist["eDepInLS"] = TH1D("eDepInLS", "Deposited Energy [MeV]", 
00135                                      70, 0, 7)
00136         status = self.statsSvc.put('/file1/basics/eDepInLS',
00137                                       self.hist["eDepInLS"])
00138         if status.isFailure(): return status
00139         
00140         self.hist["eDepInAD"] = TH1D("eDepInAD", "Deposited Energy [MeV]", 
00141                                      700, 0, 7)
00142         status = self.statsSvc.put('/file1/basics/eDepInAD',
00143                                       self.hist["eDepInAD"])
00144         if status.isFailure(): return status
00145         
00146         self.hist["eInitial"] = TH1D("eInitial", "Intial Energy [MeV]", 
00147                                      70, 0, 7)
00148         status = self.statsSvc.put('/file1/basics/eInitial',
00149                                       self.hist["eInitial"])
00150         if status.isFailure(): return status
00151         
00152         self.hist["drift_Gamma"] = TH1F("drift_Gamma",
00153                                        "Gamma Drift Distance [cm]",
00154                                         250, 0, 250)
00155         status = self.statsSvc.put('/file1/basics/drift_Gamma', 
00156                                       self.hist["drift_Gamma"])
00157         if status.isFailure(): return status
00158         
00159         self.hist["drift_GdLS"] = TH1F("drift_GdLS",
00160                                        "Gamma Drift Distance in GdLS [cm]",
00161                                        250, 0, 250)
00162         status = self.statsSvc.put('/file1/basics/drift_GdLS', 
00163                                       self.hist["drift_GdLS"])
00164         if status.isFailure(): return status
00165         
00166         self.hist["drift_LS"] = TH1F("drift_LS",
00167                                      "Gamma Drift Distance in LS [cm]",
00168                                      250, 0, 250)
00169         status = self.statsSvc.put('/file1/basics/drift_LS', 
00170                                       self.hist["drift_LS"])
00171         if status.isFailure(): return status
00172         
00173         self.hist["time_GdLS"] = TH1F("time_GdLS",
00174                                       "Gamma drift time in GdLS [ns]",
00175                                       40, 0, 20)
00176         status = self.statsSvc.put('/file1/basics/time_GdLS', 
00177                                       self.hist["time_GdLS"])
00178         if status.isFailure(): return status
00179 
00180         self.hist["time_LS"] = TH1F("time_LS",
00181                                     "Gamma Capture Time in LS [ns]",
00182                                     40, 0, 20)
00183         status = self.statsSvc.put('/file1/basics/time_LS', 
00184                                       self.hist["time_LS"])
00185         if status.isFailure(): return status
00186 
00187         return SUCCESS

def chkGamma::plotGammaBasics::execute (   self)

Definition at line 188 of file __init__.py.

00189                      :
00190         print "Executing plotGammaBasics", self.name()
00191         evt = self.evtSvc()
00192         simhdr = evt['/Event/Sim/SimHeader']
00193 
00194         det = self.detSvc(self.target_de_name)
00195 
00196         # Unobservables
00197         statshdr = simhdr.unobservableStatistics()
00198         stats = statshdr.stats()
00199         tGen = stats["t_Trk1"].sum()
00200         xGen = stats["x_Trk1"].sum()
00201         yGen = stats["y_Trk1"].sum()
00202         zGen = stats["z_Trk1"].sum()
00203         
00204         tCap = stats["tEnd_Trk1"].sum()
00205         xCap = stats["xEnd_Trk1"].sum()
00206         yCap = stats["yEnd_Trk1"].sum()
00207         zCap = stats["zEnd_Trk1"].sum()
00208         
00209         # Get underlying DE object
00210         de = self.getDet(self.target_de_name)
00211         if not de:
00212             print 'Failed to get DE',self.target_de_name
00213             return FAILURE
00214         
00215         # Get the AD coordinates of the vertexes
00216         import PyCintex
00217         Gaudi = PyCintex.makeNamespace('Gaudi')
00218         genGlbPoint = Gaudi.XYZPoint(xGen, yGen, zGen)
00219         capGlbPoint = Gaudi.XYZPoint(xCap, yCap, zCap)
00220 #        point = de.geometry().toGlobal(point)
00221         genLclPoint = de.geometry().toLocal(genGlbPoint)
00222         capLclPoint = de.geometry().toLocal(capGlbPoint)
00223 #        print 'Current point is [',point.x(),point.y(),point.z(),']'
00224 #        print 'In global coordinate [',gpoint.x(),gpoint.y(),gpoint.z(),']'
00225 
00226         ndrift = ROOT.TVector3(xCap-xGen, yCap-yGen, zCap-zGen)
00227         
00228         capTime = tCap - tGen
00229         capDis = ndrift.Mag()
00230 
00231         print 'Generation locations', \
00232             '[', genGlbPoint.x(), genGlbPoint.y(), genGlbPoint.z(),']', \
00233             '[', genLclPoint.x()/units.cm, genLclPoint.y()/units.cm, genLclPoint.z()/units.cm,']'
00234         
00235         self.hist["genRZ"].Fill(genLclPoint.x()/units.meter * genLclPoint.x()/units.meter + genLclPoint.y()/units.meter * genLclPoint.y()/units.meter, genLclPoint.z()/units.meter)
00236 
00237         self.hist["genXY"].Fill(genLclPoint.x()/units.meter,genLclPoint.y()/units.meter)
00238 
00239         self.hist["drift_Gamma"].Fill(capDis/units.cm)
00240         
00241         # Find the interesting volumes
00242         genDE = self.coorSvc.coordSysDE(genGlbPoint)
00243         capDE = self.coorSvc.coordSysDE(capGlbPoint)
00244         if not genDE:
00245             print 'Failed to find coordinate system DE for generation', \
00246                 '[', genGlbPoint.x(), genGlbPoint.y(), genGlbPoint.z(),']', \
00247                 '[', genLclPoint.x()/units.mm, genLclPoint.y()/units.mm, genLclPoint.z()/units.mm,']'
00248             return FAILURE
00249         else:
00250             gendmvol = genDE.geometry().belongsToPath(genGlbPoint,-1)
00251 
00252         if not capDE:
00253             print 'Failed to find coordinate system DE for capture'\
00254                 '[',capGlbPoint.x(),capGlbPoint.y(),capGlbPoint.z(),']'
00255             return FAILURE
00256         else:
00257             capdmvol = capDE.geometry().belongsToPath(capGlbPoint,-1)
00258 
00259         import re
00260         genDM = re.split('/', gendmvol).pop()
00261         capDM = re.split('/', capdmvol).pop()
00262         print "Generated in ", genDM
00263         print "Captured in ", capDM
00264         
00265         pmtHits = 0
00266         simhits = simhdr.hits()
00267         for detector in simhits.hitDetectors():
00268             hitCollection = simhits.hitsByDetector(detector)
00269             if hitCollection == None:
00270                 print "No hits in ", detector
00271             hits = hitCollection.collection()
00272             for hit in hits:
00273 #                print " PMT", hit.sensDetId(), "hit @ time: ", \
00274 #                    hit.hitTime()/units.nanosecond
00275                 self.hist["HitTime"].Fill(hit.hitTime()/units.nanosecond)
00276                 pmtHits += 1
00277 
00278         # Unobservables
00279         PID_trk1 = stats["pdgId_Trk1"].sum()
00280 
00281         if PID_trk1 != 22:
00282             print "PID of track 1 is", PID_trk1
00283             print "Not an gamma event."
00284             return FAILURE
00285 
00286         self.hist["peGen_all"].Fill(pmtHits)
00287 
00288         if genDM ==  'db-gds1':
00289             self.hist["peGen_GdLS"].Fill(pmtHits)
00290 
00291         if genDM ==  'db-lso1':
00292             self.hist["peGen_LS"].Fill(pmtHits)
00293 
00294         if re.search('db-lso1',gendmvol):
00295             self.hist["peGen_inLS"].Fill(pmtHits)
00296 
00297         if genDM ==  'db-oil1':
00298             self.hist["peGen_MO"].Fill(pmtHits)
00299 
00300         if capDM == 'db-lso1':
00301             self.hist["peCap_LS"].Fill(pmtHits)
00302 
00303         if capDM == 'db-oil1':
00304             self.hist["peCap_MO"].Fill(pmtHits)
00305 
00306         if capDM == 'db-gds1':
00307             self.hist["peCap_GdLS"].Fill(pmtHits)
00308 
00309         if genDM == 'db-gds1' and capDM == 'db-gds1':
00310             self.hist["peGenCap_GdLS"].Fill(pmtHits)
00311             self.hist["time_GdLS"].Fill(capTime/units.nanosecond)
00312             self.hist["drift_GdLS"].Fill(capDis/units.cm)
00313 
00314         if genDM == 'db-lso1' and capDM == 'db-lso1':
00315             self.hist["time_LS"].Fill(capTime/units.nanosecond)
00316             self.hist["drift_LS"].Fill(capDis/units.cm)
00317 
00318         eDepInGdLS = stats["EDepInGdLS"].sum()
00319         eDepInLS = stats["EDepInLS"].sum()
00320         self.hist["eDepInGdLS"].Fill(eDepInGdLS/units.MeV)
00321         self.hist["eDepInLS"].Fill(eDepInLS/units.MeV)
00322 
00323         self.hist["eDepInAD"].Fill((eDepInLS+eDepInGdLS)/units.MeV)
00324 
00325         if eDepInLS+eDepInGdLS > 6: print "Accumulative: ", str(eDepInLS+eDepInGdLS)
00326 
00327         eInitial = stats["e_Trk1"].sum()
00328         self.hist["eInitial"].Fill(eInitial/units.MeV)
00329 
00330         return SUCCESS
    
def chkGamma::plotGammaBasics::finalize (   self)

Definition at line 331 of file __init__.py.

00332                       :
00333         print "Finalizing ", self.name()
00334         status = GaudiAlgo.finalize(self)
00335         return status


Member Data Documentation

Definition at line 22 of file __init__.py.

Definition at line 27 of file __init__.py.

Definition at line 28 of file __init__.py.

Definition at line 28 of file __init__.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:55:05 for MDC09a by doxygen 1.7.4