Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-03 02:23:14

0001 #! /usr/bin/env python3
0002 from __future__ import print_function
0003 import ROOT
0004 import optparse
0005 import re
0006 import os
0007 
0008 def main():
0009     parser = optparse.OptionParser()
0010     (options, args) = parser.parse_args()
0011     ROOT.gROOT.SetBatch(True)
0012     for filename in args:
0013         if "vDrift_segment_" in filename:
0014             #name="DQM"
0015             m=re.search("vDrift_segment_(\d*)",filename)
0016             run=m.group(1)
0017             
0018             #path="DQMData/Run "+run+"/DT/Run summary/DTCalibValidation"
0019 
0020             f = open('dtVDriftAnalyzer_cfg.py','w')
0021             print("from CalibMuon.DTCalibration.Workflow.addPoolDBESSource import addPoolDBESSource", file=f)
0022             print("from CalibMuon.DTCalibration.dtVDriftAnalyzer_cfg import process", file=f)
0023             print("addPoolDBESSource(process = process, moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift', connect = 'sqlite_file:"+filename+"')", file=f)
0024             print("process.dtVDriftAnalyzer.rootFileName = 'dtVDriftAnalyzer_dtVDriftCalibration"+run+".root'", file=f)
0025             f.close()
0026             os.system("cmsRun dtVDriftAnalyzer_cfg.py")
0027             name="vdrift"
0028             runvdrift(name, run, "dtVDriftAnalyzer_dtVDriftCalibration"+run+".root")
0029 
0030         if "vDrift_meantimer_" in filename:
0031             #name="DQM"
0032             m=re.search("vDrift_meantimer_(\d*)",filename)
0033             run=m.group(1)
0034             
0035             #path="DQMData/Run "+run+"/DT/Run summary/DTCalibValidation"
0036 
0037             f = open('dtVDriftAnalyzer_cfg.py','w')
0038             print("from CalibMuon.DTCalibration.Workflow.addPoolDBESSource import addPoolDBESSource", file=f)
0039             print("from CalibMuon.DTCalibration.dtVDriftAnalyzer_cfg import process", file=f)
0040             print("addPoolDBESSource(process = process, moduleName = 'vDriftDB',record = 'DTMtimeRcd',tag = 'vDrift', connect = 'sqlite_file:"+filename+"')", file=f)
0041             print("process.dtVDriftAnalyzer.rootFileName = 'dtVDriftAnalyzer_dtVDriftCalibration"+run+".root'", file=f)
0042             f.close()
0043             os.system("cmsRun dtVDriftAnalyzer_cfg.py")
0044             name="vdrift"
0045             runvdrift(name, run, "dtVDriftAnalyzer_dtVDriftCalibration"+run+".root")
0046 
0047         elif "DQM" in filename:
0048             name="DQM"
0049             m=re.search("R000(\d*)__",filename)
0050             run=m.group(1)
0051             path="DQMData/Run "+run+"/DT/Run summary/DTCalibValidation"
0052             runttrig(name, filename, path, run)
0053         elif "TestPulses" in filename:
0054             name="T0"
0055             runt0(name,filename,123456)
0056         else:
0057             name="DTRV"
0058             m=re.search("DTResidualValidation_(\d*)\.root",filename)
0059             run=m.group(1)
0060             path="DTResiduals"
0061             runttrig(name, filename, path, run)
0062 
0063 def runttrig(name, filename, path, run):
0064     from CalibMuon.DTCalibration.PlottingTools.plotResiduals import *
0065     for SL in [1,2,3]:
0066         mean,sigma = plot(filename, SL,dir=path)
0067         mean[0].Print(name+run+"-SL"+str(SL)+"-mean.pdf")
0068         mean[0].SaveAs(name+run+"-SL"+str(SL)+"-mean.root")
0069         sigma[0].Print(name+run+"-SL"+str(SL)+"-sigma.pdf")
0070         sigma[0].SaveAs(name+run+"-SL"+str(SL)+"-sigma.root")
0071 def runvdrift(name, run, filename):
0072     from CalibMuon.DTCalibration.PlottingTools.plotVDriftFromHistos import *
0073     for SL in [1,2,3]:
0074         mean = plot(filename, SL)
0075         mean[0].Print(name+run+"-SL"+str(SL)+"-mean.pdf")
0076         mean[0].SaveAs(name+run+"-SL"+str(SL)+"-mean.root")
0077         #sigma[0].Print(name+run+"-SL"+str(SL)+"-sigma.pdf")
0078         
0079     #plot("DTResidualValidation_210614.root", 1,dir="DTResiduals")
0080     #plot("DQM_V0001_R000210634__StreamExpress__HIRun2013-DtCalib-Express-v1-dtTtrigCalibrationFromResiduals-NEW-usedb-rev1__ALCARECO.root", 1,dir="DQMData/Run 210634/DT/Run summary/DTCalibValidation")
0081 def runt0(name,filename,run):
0082     from CalibMuon.DTCalibration.PlottingTools.plotT0FromHistos import *
0083     for SL in [1,2,3]:
0084         mean = plot(filename, SL ,run)
0085         mean[0].Print(name+run+"-SL"+str(SL)+"-mean.pdf")
0086         mean[0].SaveAs(name+run+"-SL"+str(SL)+"-mean.root")
0087 
0088 if __name__=="__main__":
0089     main()