--
RamdasMakhmanazarov - 2023-01-27
iPatFitter
Overview
The place of IPatFitter in the Reconstruction chain
Code
Checkout iPat from Athena
First - make your fork of Athena in Gitlab (more details:
https://atlassoftwaredocs.web.cern.ch/gittutorial/
).
Then (in your lxplus):
mkdir ipatdevel #your development area
cd ipatdevel
setupATLAS
lsetup git
git atlas init-workdir https://:@gitlab.cern.ch:8443/atlas/athena.git
cd athena
git atlas addpkg TrkiPatFitter TrkiPatFitterUtils MuidTrackBuilder
git atlas addpkg MuonRecExample MuonCombinedRecExample MuonConfig MuonCombinedConfig
git fetch upstream
git checkout -b my-ipat-development upstream/master --no-track
mkdir ../build ; cd ../build
asetup master,latest,Athena
cmake ../athena/Projects/WorkDir
make
mkdir ../run
cd ../run
source ../build/x86_64-centos7-gcc11-opt/setup.sh #or other system parameters of your machine
All other details are here:
https://atlassoftwaredocs.web.cern.ch/gittutorial/
Inheritance order of iPat
IPatFitter is a descendant of
ITrackFitter, which is an interface and the ancestor of all fitters.
The inheritance scheme is the following:
ITrackFitter (interface) :
{
IPatFitter,
DistributedKalmanFitter,
IGlobalTrackFitter:
{
GlobalChi2Fitter,
IPatGlobalFitter
}
}
Main repository for iPat
- https://gitlab.cern.ch/atlas/athena/-/tree/master/Tracking/TrkFitter/TrkiPatFitter
- https://gitlab.cern.ch/atlas/athena/-/tree/master/Tracking/TrkFitter/TrkiPatFitterUtils
The iPatFitter class itself assembles measurements and material (using the
MaterialCollector) and then calls the
FitProcedure to perform the fit and build the track from the resulting measurements. The
FitProcedure object is not a tool: instead, an instance of it is created when the iPatFitter is initialized. The iPatFitter uses its own
FitMeasurement objects to perform the fit. Extrapolation and calculation of derivatives and residuals is done by the
MeasurementProcessor class.
iPatFitter is represented my two objects: Fitter and
FitterSL. The later (Straight Line) is used in those regions of the detector, where magnets are off.
https://gitlab.cern.ch/atlas/athena/-/blob/master/Reconstruction/MuonIdentification/MuidTrackBuilder
The
CombinedMuonTrackBuilder is the interface for the iPatFitter via its three main methods, standaloneFit, combinedFit, and standaloneRefit.
Starting from the MS, calorimeter material (from the
TrkMaterialProviderTool) is associated to the track, and a perigee surface is created. The perigee, vertex, calorimeter, and MS entrance TSOS’s [https://twiki.cern.ch/twiki/pub/Sandbox/IPatFitter/Muon_Event_Data_Model_and_Dataflow_Overview.pdf] are added to the MS TSOS’s, a track is created from them, and the fitter is called. The hits in the resulting track are then recalibrated and the fit is run again. At this point the fit is redone with scaled errors and the cleaner is run. (If the change in momentum is large, the fit will be iterated once more.) The calo TSOS are then re-associated and the fit run once more. Finally, the hit recovery is run and the track is refitted with updated errors, either by inflating the errors to reflect alignment problems (old method) or using the new
AlignmentEffectOnTrack TSOS’s (new method).
The algorithm is fairly similar, except that now the ID TSOS’s are also used (material is still associated to the track from the outside in). Additionally, hits are not recalibrated.
the algorithm is similar but simpler. The calorimeter material is taken from the combined track and the ID Eloss (but not the ID hits) are used. Additionally, the usual step of refining the calorimeter material is skipped and the cleaner and hit recovery are not run, though the error optimizer is.
Configuration of fitter (this chapter needs to be verified)
Fitters have to be configured and steered inside the reconstruction algorithms. Unfortunately, we have two places where this happens.
One is the legacy rec excommon which is super hard to understand (Links with Rec in their names - we should use them for now) because there's no clear data flow visible. This will be superseded in the near future by the component accumulator. The first two packages contain the configuration for the MS track building and the other ones for the combined muon reconstruction.
https://gitlab.cern.ch/atlas/athena/-/tree/master/MuonSpectrometer/MuonReconstruction/MuonRecExample
https://gitlab.cern.ch/atlas/athena/-/tree/master/MuonSpectrometer/MuonConfig
https://gitlab.cern.ch/atlas/athena/-/blob/master/Reconstruction/MuonIdentification/MuonCombinedRecExample
https://gitlab.cern.ch/atlas/athena/-/tree/master/Reconstruction/MuonIdentification/MuonCombinedConfig
Run Reconstruction
You can run your reconstruction process using data (bytestream file) or MC simulation (using HITS). Here is the example with HITS:
# Get hits. For example like this:
cp /eos/atlas/atlascerngroupdisk/data-art/grid-input/CampaignInputs/mc21/HITS/mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.simul.HITS.e8453_s3873/50events.HITS.pool.root .
# Run Reconstruction
Reco_tf.py --inputHITSFile 50events.HITS.pool.root --outputESDFile myESD.root --outputAODFile myAOD.root --preExec='all:from AthenaMonitoring.DQMonFlags import DQMonFlags; DQMonFlags.doHLTMon=False;rec.doTrigger=False; rec.doJetMissingETTag.set_Value_and_Lock(False); rec.doTau.set_Value_and_Lock(False);' --steering='doRAWtoALL' --multithreaded True --autoConfiguration='everything' --conditionsTag='OFLCOND-MC21-SDR-RUN3-10' 2>&1 | tee ./log.txt
checkFile.py myAOD.root # if you have interest
checkFile 50events.HITS.pool.root
# Run validation
runMuonPhysVal.py --filesInput myAOD.root --outputFile myPhysVal.root
#Explore myPhysVal.root .....
Example of Reco_tf command, when you reconstruct data:
Reco_tf.py \
--inputBSFile '../data22_13p6TeV.00437548.physics_Main.daq.RAW._lb1666._SFO-19._0001.data' \
--maxEvents '1000' \
--outputAODFile 'myAOD.pool.root' \
--outputESDFile 'myESD.pool.root' \
--multithreaded 'True' \
--preExec 'all:from RecExConfig.RecFlags import rec; rec.doZdc.set_Value_and_Lock(False); from AthenaConfiguration.AllConfigFlags import ConfigFlags; ConfigFlags.Trigger.triggerConfig="DB";
ConfigFlags.DQ.Steering.HLT.doBjet=True; ConfigFlags.DQ.Steering.HLT.doInDet=True; ConfigFlags.DQ.Steering.HLT.doBphys=True; ConfigFlags.DQ.Steering.HLT.doCalo=True; ConfigFlags.DQ.Steering.HLT.doEgamma=True; ConfigFlags.DQ.Steering.HLT.doMET=True; ConfigFlags.DQ.Steering.HLT.doJet=True;
ConfigFlags.DQ.Steering.HLT.doMinBias=True; ConfigFlags.DQ.Steering.HLT.doMuon=True; ConfigFlags.DQ.Steering.HLT.doTau=True; rec.doDetailedPerfMonMT = True;' \
--postExec 'all:from AthenaCommon.AlgScheduler import AlgScheduler; AlgScheduler.CheckDependencies(True); AlgScheduler.ShowControlFlow(True); AlgScheduler.ShowDataDependencies(True); svcMgr.PerfMonMTSvc.memFitLowerLimit
= 300; svcMgr.AlgResourcePool.CountAlgorithmInstanceMisses=True;' \
--autoConfiguration 'everything' \
--conditionsTag 'CONDBR2-BLKPA-2022-08' \
--geometryVersion 'ATLAS-R3S-2021-03-01-00' \
--runNumber '437548' \
--steering 'doRAWtoALL'
Switch off iPat in Recotf.py :
preExec='InDetFlags.iPatRec= False’
Helpful Sources:
- Johannes presentation with the role of iPat in reconstruction (22.07.22): https://twiki.cern.ch/twiki/pub/Sandbox/IPatFitter/Review_of_the_Muon_EDM.pdf
- Twiki for iPatRec (Obsolete version of IPatFitter) from Alan (2007): https://twiki.cern.ch/twiki/bin/view/AtlasComputing/IPatRec
- Reco-validation: https://gitlab.cern.ch/atlas/athena/-/tree/master/MuonSpectrometer/MuonValidation/MuonRecValidation
- ATLAS Tracking Software Tutorial: https://atlassoftwaredocs.web.cern.ch/trackingTutorial/index.html
- Muon Software Review (2016): https://twiki.cern.ch/twiki/pub/Sandbox/IPatFitter/Muon_Software_Review_2016.pdf