/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
DumpPmt::DumpPmt Class Reference

List of all members.

Public Member Functions

def __init__
def getFileTimeInfo
def dumpPmt

Detailed Description

Get Rate from ROOT file

Definition at line 27 of file DumpPmt.py.


Constructor & Destructor Documentation

def DumpPmt::DumpPmt::__init__ (   self,
  inputFilename 
)

Definition at line 29 of file DumpPmt.py.

00030 :
    #def __init__(self):

Member Function Documentation

def DumpPmt::DumpPmt::getFileTimeInfo (   self,
  runNo,
  fileNo 
)
Constructor
Talk to offline DB and get the time range of the run

Definition at line 42 of file DumpPmt.py.

00043                                             :
00044         """Talk to offline DB and get the time range of the run"""
00045         try:
00046             con = MySQLdb.connect( host = dbhost,
00047                                    user = dbuser,
00048                                    passwd = dbpasswd,
00049                                    db = database )
00050             cursor = con.cursor()
00051             cursor.execute( "SELECT DaqRawDataFileInfoVld.timestart, DaqRawDataFileInfoVld.timeend FROM DaqRawDataFileInfoVld, DaqRawDataFileInfo WHERE DaqRawDataFileInfoVld.seqno = DaqRawDataFileInfo.seqno AND DaqRawDataFileInfo.runNo = %s AND DaqRawDataFileInfo.fileNo = %s" % (runNo, fileNo) )
00052             row = cursor.fetchone()
00053             if row:
00054                 print "get file time info successfully"
00055         except MySQLdb.Error,e:
00056             print "Error %d: %s" % (e.args[0], e.args[1])
00057             sys.exit(1)
00058 
00059         cursor.close()
00060         con.close()
00061         return row
        
def DumpPmt::DumpPmt::dumpPmt (   self)
calculate rate

Definition at line 62 of file DumpPmt.py.

00063                      :
00064         """calculate rate"""
00065         runTime = self.getFileTimeInfo(self.runNo, self.fileNo)
00066         import calendar
00067         starttime = calendar.timegm( runTime[0].timetuple() )
00068         endtime = calendar.timegm( runTime[1].timetuple() )
00069 
00070         rootfile = TFile(self.inputFilename)
00071         tree = rootfile.Get(self.treepath)
00072         nEntries = tree.GetEntriesFast()
00073         
00074         # a work around to get the site info
00075         tree.GetEntry(0)
00076         pmt = DetectorSensor( int(tree.GetLeaf("pmtID").GetValue()) )
00077         site = pmt.site()
00078 
00079         wrt = DQPmt.Wrt()
00080         cr = ContextRange( site,
00081                            SimFlag.kData|SimFlag.kMC,
00082                            TimeStamp(starttime),
00083                            TimeStamp(endtime) )
00084         wrt.ctx(contextrange=cr, versiondate=TimeStamp(0,0))
00085         
00086         for i in range(nEntries):
00087             tree.GetEntry(i)
00088             record = DQPmt.Create( RunNo = int(self.runNo),
00089                                    FileNo = int(self.fileNo),
00090                                    PmtId = DetectorSensor( int(tree.GetLeaf("pmtID").GetValue()) ),
00091                                    Status = tree.GetLeaf("fitStatus").GetValue(),
00092                                    Chi2ndf = tree.GetLeaf("chiSquare").GetValue(),
00093                                    Gain = tree.GetLeaf("gain").GetValue(),
00094                                    GainErr = tree.GetLeaf("gainErr").GetValue(),
00095                                    DarkRate = tree.GetLeaf("darkRate").GetValue(),
00096                                    DarkRateErr = tree.GetLeaf("darkRateErr").GetValue(),
00097                                    ElecNoiseRate = tree.GetLeaf("elecNoiseRate").GetValue(),
00098                                    ElecNoiseRateErr = tree.GetLeaf("elecNoiseRateErr").GetValue(),
00099                                    PreAdc = tree.GetLeaf("preADC").GetValue(),
00100                                    PreAdcErr = tree.GetLeaf("preADCErr").GetValue() )
00101             wrt.Write(record) 
00102         wrt.Close()
00103         return


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:54:23 for DQDump by doxygen 1.7.4