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

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 det
 runno
 Nevts
 prevTimeSec
 prevTimeNanoSec
 firstTimeSec
 firstTimeNanoSec
 lastTimeSec
 lastTimeNanoSec
 statsSvc

Detailed Description

Definition at line 29 of file readCo60data.py.


Constructor & Destructor Documentation

def readCo60data::getCo60ESAlg::__init__ (   self,
  name 
)

Definition at line 31 of file readCo60data.py.

00032                            :
00033         DybPythonAlg.__init__(self,name)
00034         self.det = None
00035         self.runno = None
00036         return


Member Function Documentation

def readCo60data::getCo60ESAlg::initialize (   self)

Definition at line 37 of file readCo60data.py.

00038                         :
00039         status = DybPythonAlg.initialize(self)
00040         if status.isFailure(): return status
00041         self.info("initializing")
00042         
00043         # global variables
00044         self.Nevts=0;
00045         self.prevTimeSec=0;
00046         self.prevTimeNanoSec=0;
00047         self.firstTimeSec=0;
00048         self.firstTimeNanoSec=0;
00049         self.lastTimeSec=0;
00050         self.lastTimeNanoSec=0;
00051 
00052         #  Statistics Service
00053         self.statsSvc = self.svc('IStatisticsSvc','StatisticsSvc')
00054         if self.statsSvc == None:
00055             self.error("Failed to initialize statistics service.")
00056             return FAILURE
00057         
00058         # energy histogram
00059         self.stats["/file0/Co60energy/h_e"] = TH1F("h_e","",100,0,740);
00060         self.stats["/file0/Co60energy/h_e"].GetXaxis().SetTitle("Q_{corr}^{nominal} (PEs)");
00061 
00062         self.stats["/file0/Co60energy/h_n"] = TH1F("h_n","",193,-0.5,192.5);
00063         self.stats["/file0/Co60energy/h_n"].GetXaxis().SetTitle("N_{hit}");
00064         
00065         return SUCCESS

def readCo60data::getCo60ESAlg::execute (   self)

Definition at line 66 of file readCo60data.py.

00067                      :
00068         #self.info("executing")
00069         evt = self.evtSvc()
00070 
00071         # Access the Calib Readout Header.
00072         # This is a container for calibrated data
00073         calibHdr = evt["/Event/CalibReadout/CalibReadoutHeader"]
00074         if calibHdr == None:
00075             self.error("Failed to get current calib readout header")
00076             return FAILURE
00077         
00078         # Access the Readout.  This is the calibrated data from one trigger.
00079         calibReadout = calibHdr.calibReadout()
00080         if calibReadout == None:
00081             self.error("Failed to get calibrated readout from header")
00082             return FAILURE
00083 
00084         #  Remove events that are too close to other events in the same hall
00085         triggerTime = calibReadout.triggerTime()
00086         triggerTimeSec=triggerTime.GetSec()
00087         triggerTimeNanoSec=triggerTime.GetNanoSec()
00088 
00089         deltat=(triggerTimeSec-self.prevTimeSec)+1e-9*(triggerTimeNanoSec-self.prevTimeNanoSec)
00090         
00091         self.prevTimeSec=triggerTimeSec
00092         self.prevTimeNanoSec=triggerTimeNanoSec
00093 
00094         if deltat<200e-6:
00095             return SUCCESS;
00096 
00097         # Avoid irrelevant triggers (from other detectors and/or non-Physics)
00098         triggerType = calibReadout.triggerType();
00099         if triggerType & Trigger.kCalib != Trigger.kNone:
00100             return SUCCESS;
00101         if triggerType & Trigger.kRandom != Trigger.kNone:
00102             return SUCCESS;
00103         detId = Detector(calibHdr.context().GetSite(),calibHdr.context().GetDetId());
00104         if detId.isAD()!=1:
00105             return SUCCESS;
00106         if calibHdr.context().GetDetId()!=self.det:
00107             return SUCCESS;
00108 
00109         # Increment counter and record times
00110         self.Nevts+=1
00111         self.lastTimeSec=triggerTimeSec
00112         self.lastTimeNanoSec=triggerTimeNanoSec;
00113         if self.Nevts==1:
00114             self.firstTimeSec=triggerTimeSec;
00115             self.firstTimeNanoSec=triggerTimeNanoSec;
00116                     
00117         # Access the Calibrated Statistics Data Header.
00118         calibStats = evt["/Event/Data/CalibStats"]
00119         if calibStats == None:
00120             self.debug("No calibrated statistics!")
00121             return FAILURE
00122         
00123         # Access variables from CalibStats
00124         Qnominal = calibStats.get('NominalCharge').value()                
00125         nPMT = calibStats.get('nActivePMTs').value()
00126         nHit = calibStats.get('nHit').value()
00127         
00128         # fill histogram
00129         corrE=Qnominal*192/nPMT
00130         corrN=nHit*192/nPMT
00131         self.stats["/file0/Co60energy/h_e"].Fill(corrE);
00132         self.stats["/file0/Co60energy/h_n"].Fill(corrN);
00133         
00134         return SUCCESS

def readCo60data::getCo60ESAlg::finalize (   self)

Definition at line 135 of file readCo60data.py.

00136                       :
00137         self.info("finalizing")
00138 
00139         # save first and last times (for normalization)
00140         print "trying to save estas ondas"
00141         self.stats["/file0/Co60energy/firstTimeSec"] = TParameter(int)("firstTimeSec",self.firstTimeSec)
00142         self.stats["/file0/Co60energy/firstTimeNanoSec"] = TParameter(int)("firstTimeNanoSec",self.firstTimeNanoSec)
00143         self.stats["/file0/Co60energy/lastTimeSec"] = TParameter(int)("lastTimeSec",self.lastTimeSec)
00144         self.stats["/file0/Co60energy/lastTimeNanoSec"] = TParameter(int)("lastTimeNanoSec",self.lastTimeNanoSec)
00145         
00146         # finalize--
00147         status = DybPythonAlg.finalize(self)
00148         return status
00149 


Member Data Documentation

Definition at line 31 of file readCo60data.py.

Definition at line 31 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.py.

Definition at line 37 of file readCo60data.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:28 for Co60Auto by doxygen 1.7.4