8 def _OFPhasePickerCfg(flags, inputSuffix="4samples3bins17phases",outputSuffix="4samples1phase",keySuffix="",nColl=0,loadInputs=True, storeShape=True, InputSCOFCPhaseDb = "", SCOFCPhaseTag = "", InputSCOFCWeightDb="", SCOFCWeightTag=""):
11 FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
12 if flags.LArCalib.isSC:
13 FolderTagResolver._defaultSuffix=
"-UPD3-00"
14 rs=FolderTagResolver(dbname=
"sqlite://;schema=%s;dbname=CONDBR2"%flags.LArCalib.Input.Database)
16 tagstr=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+inputSuffix)
17 tagpref=tagstr[0:tagstr.find(inputSuffix)+len(inputSuffix)]
18 tagpost=tagstr[tagstr.find(inputSuffix)+len(inputSuffix):]
20 if 'mu' not in tagstr:
21 inputOFCTag=f
'{tagpref}-mu-{nc}{tagpost}'
24 tagstr=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+outputSuffix)
25 tagpref=tagstr[0:tagstr.find(outputSuffix)+len(outputSuffix)]
26 tagpost=tagstr[tagstr.find(outputSuffix)+len(outputSuffix):]
27 outputOFCTag=f
'{tagpref}-mu-{nc}{tagpost}'
29 inputOFCTag=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+inputSuffix)
30 outputOFCTag=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+outputSuffix)
32 inputShapeTag=rs.getFolderTag(flags.LArCalib.Shape.Folder+inputSuffix)
33 if flags.LArCalib.OFC.ShapeCorrection:
34 tagstr=rs.getFolderTag(flags.LArCalib.Shape.Folder+outputSuffix)
35 tagpref=tagstr[0:tagstr.find(outputSuffix)+len(outputSuffix)]
36 tagpost=tagstr[tagstr.find(outputSuffix)+len(outputSuffix):]
37 outputShapeTag=f
'{tagpref}-corr{tagpost}'
39 outputShapeTag=rs.getFolderTag(flags.LArCalib.Shape.Folder+outputSuffix)
44 from LArCalibProcessing.LArCalibBaseConfig
import chanSelStr
46 result.merge(
addFolders(flags,flags.LArCalib.OFCPhys.Folder+inputSuffix,detDb=flags.LArCalib.Input.Database,
47 tag=inputOFCTag, modifiers=
chanSelStr(flags)+
"<key>LArOFC"+keySuffix+
"</key>"))
48 result.merge(
addFolders(flags,flags.LArCalib.Shape.Folder+inputSuffix,detDb=flags.LArCalib.Input.Database,
49 tag=inputShapeTag, modifiers=
chanSelStr(flags)+
"<key>LArShape"+keySuffix+
"</key>"))
51 LArOFPhasePick = CompFactory.LArOFPhasePicker(
"LArOFPhasePicker"+keySuffix)
52 if flags.LArCalib.isSC:
53 LArOFPhasePick.KeyPhase =
"LArSCOFCPhase"
55 print(
"InputSCOFCPhaseDb: ",InputSCOFCPhaseDb)
56 result.merge(
addFolders(flags,
"/LAR/ElecCalibOflSC/OFCBin/PhysShift",detDb=InputSCOFCPhaseDb,tag=SCOFCPhaseTag,
57 modifiers=
"<key>LArSCOFCPhase</key>"))
58 if InputSCOFCWeightDb !=
"" and SCOFCWeightTag !=
"":
59 result.merge(
addFolders(flags,
"/LAR/ElecCalibOflSC/OFCFactor",detDb=InputSCOFCWeightDb,tag=SCOFCWeightTag,className=
"CondAttrListCollection"))
60 LArOFCWeightCondAlg=CompFactory.getComp(
"LArFlatConditionsAlg<LArOFCweightSC>")
61 result.addCondAlgo(LArOFCWeightCondAlg(ReadKey=
"/LAR/ElecCalibOflSC/OFCFactor", WriteKey=
"LArOFCbWSC"))
62 LArOFPhasePick.OFCbWeightKey=
"LArOFCbWSC"
65 LArOFPhasePick.KeyPhase =
""
72 LArOFPhasePick.KeyOFC_new =
"LArOFC"+muSuffix
73 LArOFPhasePick.KeyOFC =
"LArOFC"+keySuffix
75 LArOFPhasePick.KeyShape_new =
"LArShape"+
"_uncorr" if flags.LArCalib.OFC.ShapeCorrection
else "LArShape"
76 LArOFPhasePick.KeyShape =
"LArShape"+keySuffix
78 LArOFPhasePick.doShape =
False
79 LArOFPhasePick.GroupingType = flags.LArCalib.GroupingType
80 LArOFPhasePick.DefaultPhase = 4
81 LArOFPhasePick.TimeOffsetCorrection = 12
82 LArOFPhasePick.isSC = flags.LArCalib.isSC
84 LArOFPhasePick.OutputLevel=DEBUG
86 result.addEventAlgo(LArOFPhasePick)
88 if flags.LArCalib.OFC.ShapeCorrection
and storeShape:
89 result.merge(
addFolders(flags,
"/LAR/ElecCalibOfl/Shape/Residuals/5samples",
"LAR_OFL"))
90 resShapeCorr=CompFactory.LArShapeCorrector(
"LArShapeCorr"+keySuffix)
91 resShapeCorr.KeyShape=
"LArShape_uncorr"
92 resShapeCorr.KeyShape_newcorr=
"LArShape"
93 result.addEventAlgo(resShapeCorr)
95 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
96 Obj=[
"LArOFCComplete#LArOFC"+muSuffix+
"#"+flags.LArCalib.OFCPhys.Folder+outputSuffix,]
99 Obj+=[
"LArShapeComplete#LArShape#"+flags.LArCalib.Shape.Folder+outputSuffix,]
100 Tag+=[outputShapeTag,]
103 outputFile=flags.LArCalib.Output.POOLFile,
106 Run1=flags.LArCalib.IOVStart,
107 Run2=flags.LArCalib.IOVEnd
111 rootfile=flags.LArCalib.Output.ROOTFile
113 bcKey =
"LArBadChannelSC" if flags.LArCalib.isSC
else "LArBadChannel"
114 OFC2Ntup=CompFactory.LArOFC2Ntuple(
"LArOFC2Ntuple"+muSuffix)
115 OFC2Ntup.ContainerKey =
"LArOFC"+muSuffix
116 OFC2Ntup.NtupleName =
"OFC"+muSuffix
117 OFC2Ntup.AddFEBTempInfo =
False
118 OFC2Ntup.AddCalib =
True
119 OFC2Ntup.isSC = flags.LArCalib.isSC
120 OFC2Ntup.BadChanKey = bcKey
121 result.addEventAlgo(OFC2Ntup)
123 Shape2Ntup=CompFactory.LArShape2Ntuple(
"LArShape2Ntuple")
124 Shape2Ntup.ContainerKey=
"LArShape"
125 Shape2Ntup.NtupleName=
"SHAPE"
126 Shape2Ntup.AddFEBTempInfo =
False
127 Shape2Ntup.AddCalib =
True
128 Shape2Ntup.isSC = flags.LArCalib.isSC
129 Shape2Ntup.BadChanKey = bcKey
130 result.addEventAlgo(Shape2Ntup)