Skip to content
Snippets Groups Projects
Commit 7915bd8e authored by Sergi Rodriguez Bosca's avatar Sergi Rodriguez Bosca Committed by Melissa Yexley
Browse files

updating the python file and addressing some L1 comments

parent 2491cbc9
No related branches found
No related tags found
No related merge requests found
......@@ -97,7 +97,7 @@ private:
std::string m_par_t0containerkey; //"/TRT/Calib/T0"
// ReadHandleKeys
SG::ReadHandleKey<xAOD::VertexContainer> m_verticesKey {this, "VerticesKey" , "PrimaryVertices" , "RHK for primary veritces" };
SG::ReadHandleKey<xAOD::VertexContainer> m_verticesKey {this, "VerticesKey" , "PrimaryVertices" , "RHK for primary vertices" };
SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey {this, "EventInfoKey" , "EventInfo" , "RHK for xAOD::EventInfo" };
SG::ReadHandleKey<TrackCollection> m_TrkCollection {this, "TrkCollectionKey", "CombinedInDetTracks", "RHKs for track collections"};
};
......
......@@ -5,48 +5,73 @@ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from IOVDbSvc.IOVDbSvcConfig import addFolders, addOverride
from IOVDbSvc.IOVDbSvcConfig import addFolders
from AthenaConfiguration.Enums import Format
# Tool to write a track-tuple with TRT hit info
def FillAlignTrkInfoCfg(flags,name='FillAlignTrkInfo',**kwargs) :
acc = ComponentAccumulator()
if "TrackSummaryTool" not in kwargs:
from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg
InDetTrackSummaryTool = acc.popToolsAndMerge(InDetTrackSummaryToolCfg(flags))
acc.addPublicTool(InDetTrackSummaryTool)
AlignTrkInfo = CompFactory.FillAlignTrkInfo()
from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg
AlignTrkInfo.TrackSummaryTool = acc.popToolsAndMerge(InDetTrackSummaryToolCfg(flags))
# if "TrackSummaryTool" not in kwargs:
# from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg
# InDetTrackSummaryTool = acc.popToolsAndMerge(InDetTrackSummaryToolCfg(flags))
# acc.addPublicTool(InDetTrackSummaryTool)
# acc.setPrivateTools(acc.popToolsAndMerge(FillAlignTrkInfoCfg(flags, name, **kwargs)))
acc.setPrivateTools(CompFactory.FillAlignTrkInfo(TrackSummaryTool=InDetTrackSummaryTool))
acc.setPrivateTools(AlignTrkInfo)
return acc
# SERGI - This function should be in the correct athena pkg.. not here
# Tool to write a hit-tuple with R-t info
def FillAlignTRTHitsCfg(flags,name='FillAlignTRTHits',**kwargs) :
acc = ComponentAccumulator()
AlignTRTHits = CompFactory.FillAlignTRTHits(name, **kwargs)
AlignTRTHits.minTimebinsOverThreshold = 0
from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
AlignTRTHits.TRTCalDbTool = acc.popToolsAndMerge(TRT_CalDbToolCfg(flags))
from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawStatusSummaryToolCfg
AlignTRTHits.TRTStrawSummaryTool = acc.popToolsAndMerge(TRT_StrawStatusSummaryToolCfg(flags))
acc.setPrivateTools(AlignTRTHits)
# if "NeighbourSvc" not in kwargs:
# from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawNeighbourSvcCfg
# TRT_StrawNeighbourSvc = acc.popToolsAndMerge(TRT_StrawNeighbourSvcCfg(flags))
# kwargs.setdefault("NeighbourSvc" , TRT_StrawNeighbourSvc)
# acc.addPublicTool(TRT_StrawNeighbourSvc)
if "TRTCaldbTool" not in kwargs:
from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
TRT_CalDbTool = acc.popToolsAndMerge(TRT_CalDbToolCfg(flags))
kwargs.setdefault("TRTCalDbTool", TRT_CalDbTool)
acc.addPublicTool(TRT_CalDbTool)
if "TRTStrawSummaryTool" not in kwargs:
from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawStatusSummaryToolCfg
InDetStrawSummaryTool = acc.popToolsAndMerge(TRT_StrawStatusSummaryToolCfg(flags))
kwargs.setdefault("TRTStrawSummaryTool", InDetStrawSummaryTool)
acc.addPublicTool(InDetStrawSummaryTool)
kwargs.setdefault("minTimebinsOverThreshold",0)
acc.setPrivateTools(acc.popToolsAndMerge(FillAlignTRTHitsCfg(flags, name, **kwargs)))
# from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawNeighbourSvcCfg
# TRT_StrawNeighbourSvc = acc.popToolsAndMerge(CompFactory.TRT_StrawNeighbourSvc("TRT_StrawNeighbourSvc"))
# kwargs.setdefault("NeighbourSvc" , TRT_StrawNeighbourSvc)
# acc.addPublicTool(TRT_StrawNeighbourSvc)
# if "TRTCaldbTool" not in kwargs:
# from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
# TRT_CalDbTool = acc.popToolsAndMerge(TRT_CalDbToolCfg(flags))
# kwargs.setdefault("TRTCalDbTool", TRT_CalDbTool)
# acc.addPublicTool(TRT_CalDbTool)
# if "TRTStrawSummaryTool" not in kwargs:
# from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawStatusSummaryToolCfg
# InDetStrawSummaryTool = acc.popToolsAndMerge(TRT_StrawStatusSummaryToolCfg(flags))
# kwargs.setdefault("TRTStrawSummaryTool", InDetStrawSummaryTool)
# acc.addPublicTool(InDetStrawSummaryTool)
# kwargs.setdefault("minTimebinsOverThreshold",0)
return acc
# Tool to refit tracks
def FitToolCfg(flags,**kwargs):
acc = ComponentAccumulator()
acc.setPrivateTools(acc.popToolsAndMerge(FitToolCfg(flags, **kwargs)))
def FitToolCfg(flags, name = "FitToolCfg" ,**kwargs):
acc = ComponentAccumulator()
FittingTool = acc.popToolsAndMerge(CompFactory.FitTool(name, **kwargs))
acc.setPrivateTools(FittingTool)
return acc
# Tool to process R-t ntuple. Produces histograms and calibration text files.
......@@ -108,30 +133,42 @@ def TRT_CalibrationMgrCfg(flags,name='TRT_CalibrationMgr',calibconstants='',**kw
acc = ComponentAccumulator()
# Is this an accumulatiuon or a calibration job?
kwargs.setdefault("DoCalibration",False)
kwargs.setdefault("DoCalibrate",False)
# NOTE 'TRTCalibrationMgr' object has no attribute 'TRT_CalDbTool' - it should be romeved
# Needed tools (in addition to TRTCalibrator)
if "TRT_CalDbTool" not in kwargs:
from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
kwargs.setdefault("TRT_CalDbTool", acc.popToolsAndMerge(TRT_CalDbToolCfg(flags)))
# if "TRT_CalDbTool" not in kwargs:
# from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
# kwargs.setdefault("TRTCalDbTool", acc.popToolsAndMerge(TRT_CalDbToolCfg(flags)))
if "InDetDetailedTrackSelectorTool" not in kwargs:
kwargs.setdefault("TRTTrackSelectorTool", acc.popToolsAndMerge(InDetDetailedTrackSelectorToolCfg(flags)))
# NOTE 'TRTCalibrationMgr' object has no attribute 'TRTTrackSelectorTool'
# if "InDetDetailedTrackSelectorTool" not in kwargs:
# kwargs.setdefault("TRTTrackSelectorTool", acc.popToolsAndMerge(InDetDetailedTrackSelectorToolCfg(flags)))
if "AlignTrackTools" not in kwargs:
kwargs.setdefault("AlignTrkTools", [acc.popToolsAndMerge(FillAlignTrkInfoCfg(flags)), acc.popToolsAndMerge(FillAlignTRTHitsCfg(flags))])
kwargs.setdefault("AlignTrkTools", [acc.popToolsAndMerge(FillAlignTrkInfoCfg(flags)), acc.popToolsAndMerge(FillAlignTRTHitsCfg(flags))] )
if "FitTools" not in kwargs:
kwargs.setdefault("FitTools", [acc.popToolsAndMerge(FitToolCfg(flags))])
# SERGI - FitTool.cxx is empty?? why it is actually used?
# if "FitTools" not in kwargs:
# kwargs.setdefault("FitTools", [acc.popToolsAndMerge(FitToolCfg(flags))])
# Include analysis of DCS information
if flags.Input.Format is not Format.POOL :
acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/BARREL <cache>600</cache>"))
acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/ENDCAPA <cache>600</cache>"))
acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/ENDCAPC <cache>600</cache>"))
# if flags.Input.Format is not Format.POOL :
# acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/BARREL <cache>600</cache>"))
# acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/ENDCAPA <cache>600</cache>"))
# acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/ENDCAPC <cache>600</cache>"))
# acc.merge(addFolders(flags, "/TRT/DCS/HV/BARREL" , "DCS_OFL", className="CondAttrListCollection"))
# acc.merge(addFolders(flags, "/TRT/DCS/HV/ENDCAPA", "DCS_OFL", className="CondAttrListCollection"))
# acc.merge(addFolders(flags, "/TRT/DCS/HV/ENDCAPC", "DCS_OFL", className="CondAttrListCollection"))
# acc.merge(addFolders(flags, "/TRT/DCS/HV/BARREL" , "DCS_OFL"))
# acc.merge(addFolders(flags, "/TRT/DCS/HV/ENDCAPA", "DCS_OFL"))
# acc.merge(addFolders(flags, "/TRT/DCS/HV/ENDCAPC", "DCS_OFL"))
# Let all straws participate in trackfinding as default
acc.merge(addOverride('/TRT/Cond/Status','TRTCondStatus-empty-00-00'))
# FIXME! Let all straws participate in trackfinding as default - SERGI This is wrong and needs to be UPDATED @peter
# acc.merge(addOverride('/TRT/Cond/Status','TRTCondStatus-empty-00-00'))
# TypeError: addOverride() missing 1 required positional argument: 'tag'
# acc.merge(addOverride('/TRT/Cond/Status','TRTCondStatus-empty-00-00'))
# if a text file is in the arguments, use the constants in that instead of the DB
if not calibconstants=="":
......@@ -177,6 +214,11 @@ def TRT_CalibrationCfg(flags, name="TRT_CalibrationCfg"):
TRTCalibAlgo = CompFactory.TRTCalibrationMgr(name)
# SERGI: IS this tool actually used in the TRTCalibrationMgr algo?
# from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
# CalDbTool = acc.popToolsAndMerge(TRT_CalDbToolCfg(flags))
if flags.Input.Format is not Format.POOL:
acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/BARREL <cache>600</cache>"))
acc.merge(addFolders('DCS_OFL',"/TRT/DCS/HV/ENDCAPA <cache>600</cache>"))
......
......@@ -40,7 +40,7 @@ PURPOSE: Tool
FillAlignTRTHits::FillAlignTRTHits(const std::string& type, const std::string& name, const IInterface* parent) :
AthAlgTool(type, name, parent),
m_DetID(nullptr), m_TRTID(nullptr),
m_trtcaldbTool("ITRT_CalDbTool", this),
// m_trtcaldbTool("ITRT_CalDbTool", this),
m_neighbourSvc("ITRT_StrawNeighbourSvc", name),
m_TRTStrawSummaryTool("InDetTRTStrawStatusSummaryTool",this),
m_updator(nullptr),
......@@ -55,7 +55,7 @@ FillAlignTRTHits::FillAlignTRTHits(const std::string& type, const std::string& n
m_f(nullptr), m_ntuple(nullptr)
{
declareInterface<IFillAlignTrkInfo>(this);
declareProperty("TRTCalDbTool",m_trtcaldbTool);
// declareProperty("TRTCalDbTool",m_trtcaldbTool);
declareProperty("NeighbourSvc",m_neighbourSvc);
declareProperty("maxDistance",m_maxDistance) ;
declareProperty("maxTimeResidual",m_maxTimeResidual) ;
......
......@@ -64,7 +64,7 @@ private:
ToolHandle< ITRT_DriftFunctionTool > m_driftFunctionTool{this, "TRTDriftFunctionTool", "TRT_DriftFunctionTool", "Drift function tool name"};
ToolHandle<Trk::IUpdator> m_updatorHandle{this, "UpdatorTool", "Trk::KalmanUpdator/TrkKalmanUpdator", "Measurement updator to calculate unbiased track states"};
ToolHandle<ITRT_CalDbTool> m_trtcaldbTool ;
ToolHandle<ITRT_CalDbTool> m_trtcaldbTool {this, "TRTCalDbTool", "ITRT_CalDbTool", "Access to the folder of the calibration constants"};
ServiceHandle<ITRT_StrawNeighbourSvc> m_neighbourSvc ;
ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool; //!< The ConditionsSummaryTool
......
......@@ -1001,6 +1001,8 @@ bool TRTCalibrator::calibrate ATLAS_NOT_THREAD_SAFE () {
//caldata startdata(true,tbins,rbins);
caldata startdata(true,55,100);
//caldata startdata(true,64,64);
// This is the start if the timing histogram (lower edge).
startdata.t0=5.0;
std::map<std::string,TDirectory*> dirmap;
TDirectory* trtdir=gDirectory;
......
......@@ -30,8 +30,9 @@ class ITRT_CalDbTool: virtual public IAlgTool
public:
typedef TRTCond::RtRelationMultChanContainer RtRelationContainer ;
typedef TRTCond::StrawT0MultChanContainer StrawT0Container ;
DeclareInterfaceID(ITRT_CalDbTool, 1, 0);
static const InterfaceID& interfaceID();
// DeclareInterfaceID(ITRT_CalDbTool, 1, 0);
virtual float getT0( const Identifier& , int level = TRTCond::ExpandedIdentifier::STRAW ) const = 0;
virtual const TRTCond::RtRelation* getRtRelation( const Identifier& , int level = TRTCond::ExpandedIdentifier::STRAW ) const = 0;
......@@ -48,4 +49,9 @@ class ITRT_CalDbTool: virtual public IAlgTool
};
inline const InterfaceID& ITRT_CalDbTool::interfaceID() {
static const InterfaceID IID("ITRT_CalDbTool",1,0);
return IID;
}
#endif // ITRT_CALDBTOOL_H
......@@ -19,16 +19,19 @@ def TRT_StrawStatusSummaryToolCfg(flags, name="TRT_StrawStatusSummaryTool", forc
from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTStrawStatusCondAlgCfg
acc.merge(TRTStrawStatusCondAlgCfg(flags))
kwargs.setdefault("isGEANT4", flags.GeoModel.Align.LegacyConditionsAccess or forceLegacyAccess)
StrawStatusSummaryTool = CompFactory.TRT_StrawStatusSummaryTool(name, **kwargs)
StrawStatusSummaryTool.isGEANT4 = flags.GeoModel.Align.LegacyConditionsAccess or forceLegacyAccess
acc.setPrivateTools(CompFactory.TRT_StrawStatusSummaryTool(name, **kwargs))
acc.setPrivateTools(StrawStatusSummaryTool)
return acc
def TRT_CalDbToolCfg(flags, name="TRT_CalDbTool", **kwargs):
def TRT_CalDbToolCfg(flags, name="TRT_CalDbTool"):
"""Return a ComponentAccumulator for TRT_CalDbTool"""
from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
acc = ComponentAccumulator()
acc.merge(addFoldersSplitOnline(flags, "TRT", "/TRT/Onl/Calib/RT", "/TRT/Calib/RT",
className="TRTCond::RtRelationMultChanContainer"))
acc.merge(addFoldersSplitOnline(flags, "TRT", "/TRT/Onl/Calib/T0", "/TRT/Calib/T0",
......@@ -37,8 +40,10 @@ def TRT_CalDbToolCfg(flags, name="TRT_CalDbTool", **kwargs):
className="TRTCond::RtRelationMultChanContainer"))
acc.merge(addFoldersSplitOnline(flags, "TRT", "/TRT/Onl/Calib/slopes", "/TRT/Calib/slopes",
className='TRTCond::RtRelationMultChanContainer'))
tool = CompFactory.TRT_CalDbTool(name)
acc.setPrivateTools(CompFactory.TRT_CalDbTool(name="TRT_CalDbTool", **kwargs))
acc.setPrivateTools(tool)
return acc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment