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

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def finalize

Public Attributes

 cableSvc

Detailed Description

Definition at line 11 of file Compare.py.


Constructor & Destructor Documentation

def RollingGainAuto::Compare::Compare::__init__ (   self,
  name 
)

Definition at line 12 of file Compare.py.

00013                            :
00014         print "Make PlotOneframe:",name
00015         DybPythonAlg.__init__(self,name)


Member Function Documentation

def RollingGainAuto::Compare::Compare::initialize (   self)

Definition at line 16 of file Compare.py.

00017                         :
00018         print "Init PlotOneframe:",self.name()
00019         status = DybPythonAlg.initialize(self)
00020         if status.isFailure(): return status
00021 
00022         # Cable Svc, that is all this needs
00023         from DataSvc.DataSvcConf import StaticCableSvc
00024         self.cableSvc = self.svc('ICableSvc','CableSvc')
00025 
00026         # Init context and svc mode
00027         from GaudiPython import gbl
00028         context = gbl.Context()
00029         context.SetSite(gbl.Site.kAll)
00030         context.SetSimFlag(1)   # data
00031         context.SetDetId(gbl.DetectorId.kAll)        
00032         context.SetTimeStamp(gbl.TimeStamp(1300000000,0))   # To do: Need to figure out the time more smartly
00033         svcMode = gbl.ServiceMode(context,0);
00034 
00035         # Get pmt sensor <-> cable map
00036         adPmtSensors = self.cableSvc.adPmtSensors(svcMode)
00037         poolPmtSensors = self.cableSvc.poolPmtSensors(svcMode);
00038         print "\n\n number of AD PMT sensors =",adPmtSensors.size()
00039         print "\n\n number of pool PMT sensors =",poolPmtSensors.size()
00040         
00041         # Name the two input files
00042         Name = "RollingGain"
00043         NameRef = "Random"
00044         
00045         # Edit this
00046         #  Aug. 1 AD1
00047         #File = '../0011596-0011596/Rolling01/pmtDataTable_01.txt'
00048         #FileRef = '../LED_runs/yuzy/0801_EH1_AD/pmtCalibTable_EH1_AD1_1.5e7_combinedrung11565t11575_LED.txt'
00049         #  Aug. 1 AD2
00050         #File = '../0011595-0011595/Rolling01/pmtDataTable_01.txt'
00051         #FileRef = '../LED_runs/yuzy/0801_EH1_AD/pmtCalibTable_EH1_AD2_1.5e7_combinedrung11551t11576_LED.txt'
00052 
00053         #  Aug. 13 AD1
00054         #File = '../0012312-0012312/Rolling01/pmtDataTable_01.txt'
00055         #FileRef = '../LED_runs/yuzy/0813_EH1_AD/AD1_12261.txt'
00056         #  Aug. 13 AD2
00057         #File = '../0012312-0012312/Rolling01/pmtDataTable_01.txt'
00058         #FileRef = '../LED_runs/yuzy/0813_EH1_AD/AD2_12278.txt'
00059 
00060         #  Aug. 14 AD1
00061         #File = '../0012313-0012313/Rolling01/pmtDataTable_01.txt'
00062         #FileRef = '../LED_runs/yuzy/0814-AD1-12313-AD2-12334.txt'
00063         #  Aug. 14 AD2
00064         #File = '../0012334-0012334/Rolling01/pmtDataTable_01.txt'
00065         #FileRef = '../LED_runs/yuzy/0814-AD1-12313-AD2-12334.txt'
00066 
00067         #  Aug. 17 AD1
00068         #File = '../0012492-0012577/Rolling01/pmtDataTable_01.txt'
00069         #FileRef = '../LED_runs/yuzy/0817-AD1-12493-AD2-12515.txt'
00070         #  Aug. 17 AD2
00071         #File = '../0012492-0012577/Rolling01/pmtDataTable_01.txt'
00072         #FileRef = '../LED_runs/yuzy/0817-AD1-12493-AD2-12515.txt'
00073 
00074         #  Aug. 19 AD1
00075         #File = '../0012658-0012658/Rolling01/pmtDataTable_01.txt'
00076         #FileRef = '../LED_runs/yuzy/0819-AD1-12658-AD2-12677.txt'
00077         #  Aug. 19 AD2
00078         #File = '../0012677-0012677/Rolling01/pmtDataTable_01.txt'
00079         #FileRef = '../LED_runs/yuzy/0819-AD1-12658-AD2-12677.txt'
00080 
00081         # 17094, AD1
00082         #File =    '../RG-Random-Compare/0017094-0017094-RG/Rolling01/pmtDataTable_04.txt'
00083         #FileRef = '../RG-Random-Compare/0017094-0017094-Random/Rolling01/pmtDataTable_01.txt'
00084         # 17094, AD2
00085         #File =    '../RG-Random-Compare/0017094-0017094-RG/Rolling01/pmtDataTable_02.txt'
00086         #FileRef = '../RG-Random-Compare/0017094-0017094-Random/Rolling01/pmtDataTable_02.txt'
00087         # 17094, IWS
00088         #File =    '../RG-Random-Compare/0017094-0017094-RG/Rolling01/pmtDataTable_06.txt'
00089         #FileRef = '../RG-Random-Compare/0017094-0017094-Random/Rolling01/pmtDataTable_06.txt'
00090         # 17094, OWS
00091         #File =    '../RG-Random-Compare/0017094-0017094-RG/Rolling01/pmtDataTable_01.txt'
00092         #FileRef = '../RG-Random-Compare/0017094-0017094-Random/Rolling01/pmtDataTable_03.txt'
00093         
00094         # 17268, AD1
00095         #File =    '../RG-Random-Compare/0017268-0017268-RG/Rolling01/pmtDataTable_02.txt'
00096         #FileRef = '../RG-Random-Compare/0017268-0017268-Random/Rolling01/pmtDataTable_01.txt'
00097         # 17268, IWS
00098         #File =    '../RG-Random-Compare/0017268-0017268-RG/Rolling01/pmtDataTable_07.txt'
00099         #FileRef = '../RG-Random-Compare/0017268-0017268-Random/Rolling01/pmtDataTable_05.txt'
00100         # 17268, OWS
00101         File =    '../RG-Random-Compare/0017268-0017268-RG/Rolling01/pmtDataTable_01.txt'
00102         FileRef = '../RG-Random-Compare/0017268-0017268-Random/Rolling01/pmtDataTable_02.txt'
00103         
00104         # Open and parse two tables
00105         table = Table()
00106         table.read( File )
00107         
00108         tableRef = Table()
00109         tableRef.read( FileRef )
00110 
00111         # Create a TTree to hold all useful variables
00112         from CalibTree import CalibTree
00113         calibt = CalibTree("comp.root")
00114 
00115         for rowIdx in range(table.nRows):
00116             calibt.reset()
00117             calibt.Time[0] = 0
00118 
00119             pmtId = gbl.DayaBay.DetectorSensor( int(table.columns['pmtID'][rowIdx]) )
00120             calibt.Site[0] = pmtId.site()
00121             calibt.Detector[0] = pmtId.detectorId()
00122 
00123             channelId = self.cableSvc.elecChannelId( pmtId, svcMode )
00124             calibt.Board[0] = channelId.board()
00125             calibt.Channel[0] = channelId.connector()
00126             
00127             if pmtId.isAD():
00128                 adPmtId = gbl.DayaBay.AdPmtSensor( int(table.columns['pmtID'][rowIdx]) )
00129                 calibt.Ring[0] = adPmtId.ring()
00130                 calibt.Column[0] = adPmtId.column()
00131 
00132             if pmtId.isWaterShield():
00133                 poolPmtId = gbl.DayaBay.PoolPmtSensor( int(table.columns['pmtID'][rowIdx]) )
00134                 calibt.Wall[0] = poolPmtId.wallNumber()
00135                 calibt.Spot[0] = poolPmtId.wallSpot()
00136                 calibt.Inward[0] = poolPmtId.inwardFacing()
00137                                                     
00138             calibt.Spe[0]      = float( table.columns['speHigh'][rowIdx]    )
00139             calibt.SpeErr[0]   = float( table.columns['gainErr'][rowIdx]    )
00140             calibt.SpeSigma[0] = float( table.columns['sigmaSpe'][rowIdx]   )
00141             calibt.Ped[0]      = float( table.columns['preAdc'][rowIdx]     )
00142             calibt.PedErr[0]   = float( table.columns['preAdcErr'][rowIdx]  )
00143             calibt.Nhit[0]     = int( table.columns['nhits'][rowIdx]        )
00144             calibt.Chi2ndf[0]  = float( table.columns['chi2ndf'][rowIdx]    )
00145             calibt.FitStat[0]  = int( table.columns['fitStat'][rowIdx]      )
00146 
00147             calibt.DarkRate[0]      = float( table.columns['darkRate'][rowIdx]     )
00148             calibt.DarkRateErr[0]   = float( table.columns['darkRateErr'][rowIdx]  )
00149             calibt.ElecRate[0]      = float( table.columns['elecNoiseRate'][rowIdx]     )
00150             calibt.ElecRateErr[0]   = float( table.columns['elecNoiseRateErr'][rowIdx]  )
00151 
00152             # Then search the reference table for the same channel
00153             for refIdx in range(tableRef.nRows):
00154                 refPmtId = gbl.DayaBay.DetectorSensor( int(tableRef.columns['pmtID'][refIdx]) )
00155                 if refPmtId == pmtId:
00156                     calibt.RefSpe[0]      = float( tableRef.columns['speHigh'][refIdx]    )
00157                     calibt.RefSpeSigma[0] = float( tableRef.columns['sigmaSpe'][refIdx]   )
00158                     break
00159             
00160             if calibt.Nhit[0] > 300:
00161                 calibt.fill()
00162 
00163         calibt.close()
00164 
00165         return SUCCESS

def RollingGainAuto::Compare::Compare::execute (   self)

Definition at line 166 of file Compare.py.

00167                      :
00168         return SUCCESS

def RollingGainAuto::Compare::Compare::finalize (   self)

Definition at line 169 of file Compare.py.

00170                       :
00171 
00172         # Draw the ps file
00173         from ROOT import gROOT, gDirectory, TCanvas, TFile, TTree, TPad, TLatex
00174         f = TFile("comp.root", "read")
00175         t = gDirectory.Get( 't' )
00176         
00177         name = "comp-17268-EH2-OWS-RG-vs-Random"
00178         #AD = True
00179         AD = False
00180 
00181         canv = TCanvas("canv",name)
00182         # Troublesome title pad
00183         TitlePad = TPad("TitlePad","Title pad",0,0.95,1,1)
00184         TitlePad.Draw()
00185         TitlePad.SetNumber(1)
00186                 
00187         # Plots pad
00188         PlotPad  = TPad("PlotPad", "Plot pad",0,0,1,0.95)
00189         PlotPad.Draw()
00190         PlotPad.SetNumber(2)
00191 
00192         # Add title
00193         canv.cd(1)
00194         l = TLatex()
00195         l.DrawLatex(0.3,0.5,"#scale[12]{"+name+"}")
00196 
00197         # Add plots
00198         PlotPad.Divide(3,2)
00199 
00200         if AD:
00201             PlotPad.cd(1)
00202             t.Draw("Ring:Column","(Spe)*(Ring>0)","colz")
00203             PlotPad.cd(2)
00204             t.Draw("Ring:Column","(RefSpe)*(Ring>0)","colz")
00205             PlotPad.cd(3)
00206             t.Draw("Ring:Column","(Spe-RefSpe)*(Ring>0)","colz")
00207             PlotPad.cd(4)
00208             t.Draw("Spe-RefSpe","(Ring>0)")
00209 
00210             t.SetMarkerStyle(21)
00211             t.SetMarkerSize(0.5)
00212             PlotPad.cd(5)
00213             t.Draw("Spe-RefSpe:Board*16+Channel","(Ring>0)")
00214             PlotPad.cd(6)
00215             t.Draw("Spe-RefSpe:Ring*24+Column","(Ring>0)")
00216         else:
00217             PlotPad.cd(1)
00218             t.Draw("Wall:Spot+Inward*15","(Spe)","colz")
00219             PlotPad.cd(2)
00220             t.Draw("Wall:Spot+Inward*15","(RefSpe)","colz")
00221             PlotPad.cd(3)
00222             t.Draw("Wall:Spot+Inward*15","(Spe-RefSpe)","colz")
00223             PlotPad.cd(4)
00224             t.Draw("Spe-RefSpe","")
00225 
00226             t.SetMarkerStyle(21)
00227             t.SetMarkerSize(0.5)
00228             PlotPad.cd(5)
00229             t.Draw("Spe-RefSpe:Wall*30+Spot+Inward*15","")
00230             PlotPad.cd(6)
00231             t.Draw("Spe-RefSpe:Wall*30+Spot+Inward*15","")
00232 
00233 
00234         canv.SaveAs(name+".ps")
00235         
00236         status = DybPythonAlg.finalize(self)
00237         return status


Member Data Documentation

Definition at line 16 of file Compare.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:59:50 for RollingGainAuto by doxygen 1.7.4