Changeset 12896
- Timestamp:
- 02/16/12 21:07:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/pyfact_rename.py
r12895 r12896 113 113 self.maxAmp = None 114 114 115 116 115 def next_event(self): 117 116 """ load the next event from disk and calibrate it … … 122 121 self.calibrate_drs_amplitude() 123 122 124 125 123 def calibrate_drs_amplitude(self): 126 124 """ perform the drs amplitude calibration of the event data … … 137 135 tom = np.reshape(self.tom, (self.npix, 1024) ) 138 136 gm = np.reshape(self.gm, (self.npix, 1024) ) 139 140 # print 'acal Data ', acal_data.shape141 # print 'blm shape ', blm.shape142 # print 'gm shape ', gm.shape143 137 144 138 for pixel in range( self.npix ): … … 174 168 175 169 def filter_CFD(self, length=10, ratio=0.75): 176 """ constant fraction filter170 """ constant fraction discriminator (implemented as FIR) 177 171 178 172 using: … … 184 178 185 179 if self.data_saverage_out == None: 186 print ('error pyfact.filter_CFD was called without187 prior call to filter_sliding_average ')188 print ' variable self.data_saverage_out is needed '189 pass190 180 print """error pyfact.filter_CFD was called without 181 prior call to filter_sliding_average 182 variable self.data_saverage_out is needed 183 """ 184 191 185 data_CFD_out = self.data_saverage_out.copy() 192 186 b = np.zeros(length) … … 256 250 257 251 try: 258 f = TFile( file)252 f = TFile(file) 259 253 except: 260 254 print 'Baseline data file could not be read: ', file 261 255 return 262 256 263 h = f.Get( bsl_hist)264 265 for i in range( self.npix):266 self.v_bsl[i] = h.GetBinContent( i+1)257 h = f.Get(bsl_hist) 258 259 for i in range(self.npix): 260 self.v_bsl[i] = h.GetBinContent(i+1) 267 261 268 262 f.Close() 269 270 263 271 264 def baseline_correct(self): … … 274 267 """ 275 268 276 for pixel in range( self.npix):269 for pixel in range(self.npix): 277 270 self.acal_data[pixel,:] -= self.v_bsl[pixel] 278 279 271 280 272 def info(self): 281 273 """ print run information … … 296 288 """ 297 289 298 def __init__( 290 def __init__(self, specifier = ['012', '023', '2011', '11', '24'], 299 291 rpath = '/scratch_nfs/res/bsl/', 300 292 zipped = True): … … 305 297 rpath : directory path for the results; YYYYMMDD will be appended to rpath 306 298 zipped : use zipped (True) or unzipped (Data) 307 """ 299 300 """ 301 308 302 self.specifier = specifier 309 303 self.rpath = rpath … … 311 305 312 306 self.make( self.specifier, self.rpath, self.zipped ) 313 # end of def __init__ 307 314 308 315 309 def make( self, specifier, rpath, zipped ): … … 352 346 self.results = self.names['results'] 353 347 354 # end of make355 356 348 def info( self ): 357 349 """ print complete filenames … … 363 355 print 'drs-cal: ', self.names['drscal'] 364 356 print 'results: ', self.names['results'] 365 # end of def info366 357 367 358 # end of class definition: fnames( object ) 368 359 369 370 371 class histogramList( object ):372 373 def __init__( self, name ):374 """ set the name and create empty lists """375 self.name = name # name of the list376 self.list = [] # list of the histograms377 self.dict = {} # dictionary of histograms378 self.hList = TObjArray() # list a la ROOT of the histograms379 380 def add( self, tag, h ):381 self.list.append( h )382 self.dict[tag] = h383 self.hList.Add( h )384 385 386 class pixelHisto1d ( object ):387 388 def __init__( self, name, title, Nbin, first, last, xtitle, ytitle, npix ):389 """390 book one dimensional histograms for each pixel391 """392 self.name = name393 394 self.list = [ x for x in range( npix ) ]395 self.hList = TObjArray()396 397 for pixel in range( npix ):398 399 hname = name + ' ' + str( pixel )400 htitle = title + ' ' + str( pixel )401 self.list[pixel] = TH1F( hname, htitle, Nbin, first, last )402 403 self.list[pixel].GetXaxis().SetTitle( xtitle )404 self.list[pixel].GetYaxis().SetTitle( ytitle )405 self.hList.Add( self.list[pixel] )406 407 # simple test method408 360 if __name__ == '__main__': 409 361 """
Note:
See TracChangeset
for help on using the changeset viewer.