4 from AthenaConfiguration.ComponentFactory
import CompFactory
5 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
10 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg,chanSelStr
13 from IOVDbSvc.IOVDbSvcConfig
import addFolders
16 if flags.LArCalib.isSC:
17 from LArConfiguration.LArElecCalibDBConfig
import LArElecCalibDBMCSCCfg
21 result.merge(
addFolders(flags,
"/LAR/ElecCalibMC/Shape",detDb=
"LAR_OFL", db=
"OFLP200",tag=
"LARElecCalibMCShapeLArPileupShape-RUN2-2018",className=
"LArShape32MC",modifiers=
"<key>LArShapeMC</key>"))
22 result.merge(
addFolders(flags,
"/LAR/ElecCalibMC/fSampl",detDb=
"LAR_OFL", db=
"OFLP200",tag=
"LARElecCalibMCfSampl-G4101-20371-FTFP_BERT_BIRK_v2",className=
"LArfSamplMC"))
23 result.merge(
addFolders(flags,
"/LAR/ElecCalibMC/MinBias",detDb=
"LAR_OFL", db=
"OFLP200",tag=
"LARElecCalibMCMinBias-mc16-Epos-A3-s3687",className=
"LArMinBiasMC"))
25 result.addCondAlgo(CompFactory.LArMCSymCondAlg())
27 LArShapeSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArShape32MC, LArShape32Sym>")
28 result.addCondAlgo(
LArShapeSymAlg(ReadKey=
"LArShapeMC",WriteKey=
"LArShapeSym"))
30 LArfSamplSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArfSamplMC, LArfSamplSym>")
31 result.addCondAlgo(
LArfSamplSymAlg(ReadKey=
"LArfSampl", WriteKey=
"LArfSamplSym"))
33 LArMinBiasSymAlg = CompFactory.getComp(
"LArSymConditionsAlg<LArMinBiasMC, LArMinBiasSym>")
34 result.addCondAlgo(
LArMinBiasSymAlg(ReadKey=
"LArMinBias",WriteKey=
"LArMinBiasSym"))
36 from LArCalibProcessing.utils
import FolderTagResolver
37 FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
38 if flags.LArCalib.isSC:
39 FolderTagResolver._defaultSuffix=
"-UPD3-00"
40 rs=FolderTagResolver(dbname=
"sqlite://;schema=%s;dbname=CONDBR2"%flags.LArCalib.Input.Database)
41 AutoCorrTag=rs.getFolderTag(flags.LArCalib.AutoCorr.Folder)
42 PedestalTag=rs.getFolderTag(flags.LArCalib.Pedestal.Folder)
43 RampTag=rs.getFolderTag(flags.LArCalib.Ramp.Folder)
44 MpMcTag=rs.getFolderTag(flags.LArCalib.MphysOverMcal.Folder)
45 rsac=FolderTagResolver(dbname=
"COOLOFL_LAR/CONDBR2")
46 PhysAutoCorrTag= rsac.getFolderTag(flags.LArCalib.PhysAutoCorr.Folder)
47 nColl=flags.LArCalib.OFC.Ncoll
48 if (nColl>0
and "mu" not in PhysAutoCorrTag):
50 elems=PhysAutoCorrTag.split(
"-")
51 PhysAutoCorrTag=
"-".
join([elems[0]+
"_mu_%i"%nColl,]+elems[1:])
56 result.merge(
addFolders(flags,flags.LArCalib.AutoCorr.Folder,detDb=flags.LArCalib.Input.Database, tag=AutoCorrTag, modifiers=
chanSelStr(flags)+
"<key>LArAutoCorr</key>",
57 className=
"LArAutoCorrComplete"))
58 result.merge(
addFolders(flags,flags.LArCalib.Pedestal.Folder,detDb=flags.LArCalib.Input.Database, tag=PedestalTag, modifiers=
chanSelStr(flags)+
"<key>LArPedestal</key>",
59 className=
"LArPedestalComplete"))
60 result.merge(
addFolders(flags,flags.LArCalib.Ramp.Folder,detDb=flags.LArCalib.Input.Database, tag=RampTag, modifiers=
chanSelStr(flags),
61 className=
"LArRampComplete"))
62 result.merge(
addFolders(flags,flags.LArCalib.MphysOverMcal.Folder,detDb=flags.LArCalib.Input.Database, tag=MpMcTag, modifiers=
chanSelStr(flags),
63 className=
"LArMphysOverMcalComplete"))
67 if flags.LArCalib.isSC:
68 requiredConditions=[
"DAC2uA",
"HVScaleCorr"]
72 requiredConditions=[
"DAC2uA",
"uA2MeV",
"HVScaleCorr"]
73 if flags.LArCalib.isSC:
74 from LArConfiguration.LArElecCalibDBConfig
import LArElecCalibDBSCCfg
76 mapKey=
"LArOnOffIdMapSC"
77 bcKey =
"LArBadChannelSC"
79 DACKey =
"LArDAC2uASC"
80 HVKey =
"LArHVScaleCorrSC"
82 from LArConfiguration.LArElecCalibDBConfig
import LArElecCalibDBCfg
84 mapKey=
"LArOnOffIdMap"
85 bcKey =
"LArBadChannel"
88 HVKey =
"LArHVScaleCorr"
90 result.addCondAlgo(CompFactory.LArADC2MeVCondAlg(UseFEBGainTresholds=
False,LArOnOffIdMappingKey=mapKey,CompleteDetector=
False,LAruA2MeVKey=uAKey,LArDAC2uAKey=DACKey,LArHVScaleCorrKey=HVKey,isSuperCell=flags.LArCalib.isSC))
92 theLArAutoCorrTotalCondAlg=CompFactory.LArAutoCorrTotalCondAlg()
93 theLArAutoCorrTotalCondAlg.Nsamples=flags.LArCalib.OFC.Nsamples
95 theLArAutoCorrTotalCondAlg.deltaBunch=
int(flags.Beam.BunchSpacing/( 25.*ns)+0.5)
96 theLArAutoCorrTotalCondAlg.isSuperCell=flags.LArCalib.isSC
97 theLArAutoCorrTotalCondAlg.isMC=
False
98 theLArAutoCorrTotalCondAlg.LArAutoCorrObjKey=
"LArAutoCorr"
99 theLArAutoCorrTotalCondAlg.LArAutoCorrTotalObjKey=
"LArPhysAutoCorr"
100 theLArAutoCorrTotalCondAlg.LArOnOffIdMappingObjKey=mapKey
101 theLArAutoCorrTotalCondAlg.LArPedestalObjKey=
"LArPedestal"
102 if flags.LArCalib.isSC:
103 theLArAutoCorrTotalCondAlg.LArShapeObjKey =
"LArShapeSC"
104 theLArAutoCorrTotalCondAlg.LArfSamplObjKey =
"LArfSamplSC"
105 theLArAutoCorrTotalCondAlg.LArMinBiasObjKey =
"LArMinBiasSC"
107 result.addCondAlgo(theLArAutoCorrTotalCondAlg)
109 result.addEventAlgo(CompFactory.LArAutoCorrAlgToDB(GroupingType=flags.LArCalib.GroupingType,
110 NMinbias=nColl,isSC=flags.LArCalib.isSC))
114 rootfile=flags.LArCalib.Output.ROOTFile
116 result.addEventAlgo(CompFactory.LArAutoCorr2Ntuple(ContainerKey=
"LArPhysAutoCorr",OffId=
True,isSC=flags.LArCalib.isSC,
117 BadChanKey=bcKey, AddCalib=
True))
119 if os.path.exists(rootfile):
121 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
122 result.setAppProperty(
"HistogramPersistency",
"ROOT")
127 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
129 outputFile=flags.LArCalib.Output.POOLFile,
130 ObjectList=[
"LArAutoCorrComplete#LArPhysAutoCorr#"+flags.LArCalib.PhysAutoCorr.Folder,],
131 IOVTagList=[PhysAutoCorrTag,],
132 Run1=flags.LArCalib.IOVStart,
133 Run2=flags.LArCalib.IOVEnd
138 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
139 result.getService(
"IOVDbSvc").DBInstance=
""
143 from McEventSelector.McEventSelectorConfig
import McEventSelectorCfg
145 RunNumber = flags.LArCalib.Input.RunNumbers[0],
148 InitialTimeStamp = 0,
149 TimeStampInterval = 1))
152 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
160 if __name__ ==
"__main__":
163 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
165 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
167 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
169 ConfigFlags.Input.Files=[]
170 ConfigFlags.LArCalib.Input.RunNumbers=[400939,]
171 ConfigFlags.LArCalib.Input.Database=
"/home/wlampl/calibTest/00400939_00400943_00400945_Barrel-EMB-EMEC_HIGH_40_21.0.20_1/poolFiles/myDB200_00400939_00400943_00400945_EB-EMBA_one.db_Delay"
172 ConfigFlags.LArCalib.Input.SubDet=
"EM"
173 ConfigFlags.LArCalib.BadChannelDB=
"/home/wlampl/calibTest/00400939_00400943_00400945_Barrel-EMB-EMEC_HIGH_40_21.0.20_1/poolFiles/SnapshotBadChannel_00400939_00400943_00400945_EB-EMBA.db"
174 ConfigFlags.LArCalib.BadChannelTag=
"-RUN2-UPD3-00"
175 ConfigFlags.LArCalib.Output.ROOTFile=
"physAC.root"
176 ConfigFlags.IOVDb.DatabaseInstance=
"CONDBR2"
177 ConfigFlags.IOVDb.DBConnection=
"sqlite://;schema=output.sqlite;dbname=CONDBR2"
178 ConfigFlags.IOVDb.GlobalTag=
"LARCALIB-RUN2-02"
179 ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
181 ConfigFlags.LArCalib.OFC.Ncoll=20
182 ConfigFlags.LArCalib.OFC.Nsamples=5
184 ConfigFlags.fillFromArgs()
192 print(cfg.getService(
"IOVDbSvc").Folders)
194 print(cfg.getCondAlgo(
"LArADC2MeVCondAlg"))
195 print(
"AutoCorrTotal:")
196 print(cfg.getCondAlgo(
"LArAutoCorrTotalCondAlg"))
199 print(
"Start running...")
200 sys.exit(cfg.run(1).isFailure())