SPaganGrisoVtxPileupStudies
PileUp studies package
Getting ready
Up to now the package is in my group repository. We should find a better place for it.
Checkout the package doing:
svn co svn+ssh://svn.cern.ch/reps/atlasusr/spagan/Vertex/PUStudies/trunk/ PUStudies
- The folder
share/
contains jobOptions for running tracking and/or vertexing and/or vertex D3PD
- The folder
run/scripts/
contains useful scripts to submit job to grid, both for pathena as well as for local analysis jobs (see macros/
folder)
- The folder
macros/D3PD/
contains the D3PD analysis code
- The folder
macros/drawing/
contains the D3PD analysis output drawing macros
Running vertex algorithm, creating D3PD and friends
jobOptions for athena
In the foder
share/
you can find jobOptions to make sevaral actions running them with
athena
. Most of them run on ESD/AOD. See the README file in the same folder for the most recent information (and please, keep it updated!).
Some of them still dump the information in the older D3PD format (hereby called VTX_MON), based on InDetRecExample package. A new D3PD format is now available defined in TrackD3PDMaker and will be explained below. This latter format is called IDVTXD3PD and can either be run through jobOptions (see example jobOption below) or through Reco_trf.py (see section below).
Most common action include:
* ReadInDet_MakeVtxD3PD.py
Trigger creation of vertex !D3PD from AOD. Do not run anything, just dump.
Superseed by GroupVertexD3PDMaker (using Reco_trf.py), see below.
* ReadInDet_MakeAODandVtxD3PD.py
Mostly used for event pick-up for further debugging. Create output AOD and VTX_MON !D3PD
* jobOption_RedoVtxAndD3PD.py
Job option to trigger vertex reconstruction with ad-hoc cuts using athena from AOD files.
New Information is dumped to new format !IDVTXD3PD.
* TrackingRecoTrf.py
Job fragment to trigger reconstruction (with modified tracking settings) with preInclude of Reco_trf.py. Currently under superseed.
* jobOption_RedoTrkAndVtxD3PD.py
Job option to trigger tracking and vertex reconstruction with ad-hoc cuts using athena and RDO -> ESD/AOD.
Dumps information through VTX_MON !D3PD
* ReadInDet_RedoTrkAndVtxD3PD.py
Job option to trigger tracking and vertex reconstruction with ad-hoc cuts using athena and ESD -> ESD/AOD.
Dumps information through VTX_MON !D3PD
Each file has a first section called
Settings
which can be edited to configure input file and other common settings.
IDVTXD3PD creation through Reco_trf.py
You can create vertex d3pd using directly Reco_trf.py and steer various options through preExec.
Prerequisites: Use release >=
17.2.0.4
and >=
TrackD3PDMaker-01-01-16-07
An example is the following (substitute maxEvents and input/output arguments as you need them).
Reco_trf.py maxEvents=__MAXEVENTS__ autoConfiguration=everything preExec='InDetFlags.doVertexFindingForMonitoring.set_Value_and_Lock(True);InDetFlags.doSplitVertexFindingForMonitoring.set_Value_and_Lock(True);InDetFlags.useBeamConstraint.set_Value_and_Lock(False);from@TrackD3PDMaker.VertexD3PDAnalysisFlags@import@VertexD3PDAnalysisFlags;VertexD3PDAnalysisFlags.filterTightTruth.set_Value_and_Lock(True)' inputAODFile=%IN outputNTUP_IDVTXFile=%OUT.IDVTXD3PD.root
See section below for easy submission script based on template commands that you can find in the
share/
folder.
In the
share/
folder there are several
Vertex*D3PD*.txt
files which contains these templates, you can also you them as example for customized ones.
See
TrackingD3PDMaker/python/VertexD3PDAnalysisFlags.py
for a full list of options currently implemented.
Easy grid-submission scripts
You can use the script
run/scripts/runPAthena.py
to submit easily to the grid one or a list of dataset.
[AtlasVtxStudies_17.0.X - 17.0.2.10] PUStudies$ python run/scripts/submitPAthena.py -h
Usage:
./submitPAthena.py [options] -a ACTION -s datasets_file | dataset1 [dataset2 [...]]
Dataset file with format (space-separated fields):
<InputDataset> [<OutputDataset> [<nFilesPerJob> [...]]] []=optional
Available ACTIONs are:
vtxmon: Produce tracking and vertexing VTXD3PD D3PD (includes split vertices)
trk: Re-run tracking and produce AOD and VTXD3PD D3PD
vtx: Re-run vertexing and produce AOD and VTXD3PD D3PD
custom: Use custom job option file (no dynamic substitution possible, use --job-options)
trf: Use custom job option as text file for readong transform command and arguments
trfFullRecoIdCl: PUTF reconstruction trasnform. In input file Use extra fields <cutLevel> [<pileup>]
trfvtx: Produce Vertex Group D3PD (includes split and non BC vertices)
trfvtxlumi: Produce Vertex Lumi D3PD (detailed info; includes non BC vertices)
trfvtxlowmu: Produce Vertex Group D3PD with doLowMuRunSetup tracking/vertexing
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-a ACTION, --action=ACTION
Select what action to submit
-s SAMPLESFILE, --samples-file=SAMPLESFILE
file with input samples
-v VERSION, --out-dataset-version=VERSION
Include a versioning suffix (mandatory if not --no-
version
--no-version disable versioning requirement
-j JOBOPTIONS, --job-options=JOBOPTIONS
Custom job options (can be used with all actions.
Prepend '@' for current test area )
--nosubmit do not submit the jobs
--test Submit test job
--nFilesPerJob=NFILESPERJOB
Number of input files processed in each jobs. If 0.X,
means use X events/job instead. User is then expected
to handle %SKIPEVENTS.
--maxFiles=MAXFILESPERDATASET
Limit maximum number of files to analyze for each
dataset.
--site=USETHISSITE Force jobs to go to this site
-b BLACKLIST, --black-list=BLACKLIST
Comma-separated list of sites to black-list
-u USER, --user=USER Username for output dataset, if needed (default:
`whoami`).
--official Submit an official sample using perf-idtracking proxy
-r RUNDIR, --run-dir=RUNDIR
Directory where to store modified job options (action:
trk)
-t TRKSETUP, --tracking-setup=TRKSETUP
Tracking or Vertexing setup (action: trk,vtx)
As an example, to produce vertexing D3PD for a dataset you can just call:
python run/scripts/submitPAthena.py -a trfvtx -v v1.0 --nFilesPerJob 5 -u spagan data11_7TeV.periodB.physics_MinBias.PhysCont.AOD.repro09_v01/
Analysis macros
In the folder
macros/D3PD
there are currently implemented few executables.
- TrackingAna.exe: Main executable performing several performance studies.
- SkimD3PD: simple skimming utility to filter vertex D3PD based on user info (e.g. trigger, ..)
- ExtractMu: simple program to quickly extract the mu distribution of a sample, to be used later for mu-reweighting if necessary.
To compile them you also need to compile the tool used for trigger matching and GRL selection (before you compile it).
For this you can just call from your testarea
$ cd $TestArea
$ PUStudies/scripts/checkout.sh
$ config and make RootCore packages:
$ cd RootCore
$ ./configure
$ cd ../
$ ./RootCore/scripts/find_packages.sh
$ ./RootCore/scripts/compile.sh
You may have an error on the compilation of
GoodRunsLists.. I never
traced that back seriously, you can "fix" it just compiling
GoodRunsLists standalone:
$ cd GoodRunsLists/cmt
$ make -f Makefile.Standalone
$ cd ../../
Finally compile the macros:
$ cd PUStudies/macros/D3PD
$ make
this will produce few executables. The main analysis routing is
TrackingAna.exe
. Very useful is also
SkimD3PD
which allows you to skim an existing
D3PD based on trigger and GRL.
For each executable call with no arguments or with
-h
for a list of options.
TrackingAna.exe
I try to keep an updated help inside the program. To see it just call the executable without arguments:
[AtlasVtxStudies_17.0.X - 17.0.2.10] D3PD$ ./TrackingAna.exe
Number of input files: 0
Chain created. Processing..
ERROR: No ROOT input files supplied.
Usge:
./TrackingAna.exe [options] [-i InputFileName | InputFile1.root [InputFile2.root [...]]]
i: Uses files listed in InputFileName as input.
List of other options:
D Print verbose debug(debugLevel=100).
T Enable MC-based plots.
d: Set debug level.
o: Set output prefix (.root and .txt will be added).
e: Set number of events to process.
z: |Z| interval for selection efficiency evaluation.
v: Quality of reconstructed vertices (version.modifier.parameter)
G: Generated vertices selection version.
t: Set trigger requirement
g: Set GRL XML file to be used (if not provided, none will be used)
m: Mu Filtering/weighting (actualIntPerXing). Set minimum mu filter requirement OR input file for source Mu distribution
M: Mu Filtering/weighting (actualIntPerXing). Set maximum mu filter requirement OR input file for dest Mu distribution
U: Mu scaling. Arguments is three integer dot-separated (see MuScaling.h): Sample.Scaling.Systematics
B: do not analyze non Beamspot-constrained vertices and split ones (vxnbc*, vxsplit*).
I Runs interactive ROOT session, do not quit after it ends.
h: Print this screen.
The main class performing the performance studies is in the files
AnaInDetTree.h/.cxx
(it's a
TSelector
).
Few options of
TrackingAna.exe
I'd like to discuss further are:
- -T: I recommend using this option everytime you run on MC sample. Enables truth-based plots, including vertex matching. Important: From mc10b the truth information for pileup interactions is lost. You must use samples without truth slimming to get information about it (to be specially requested case by case).
- -v: This option sets the quality requirement on the reconstructed vertices considered for the studies. This is specified through a version, with the format
X.Y.Z
. The default one is 1.0.2
which requires the first vertex to have >=2 tracks for the event to be considered and look at reconstructed pileup vertices with the same requirement; changing the last digit you can increase the number of tracks, so for example 1.0.5
consider vertices with >=5 tracks and only events where the first vertex satisfy the same requirement. Full explanation in AnaInDetTree.cxx
file, above the function: AnaInDetTree::isGoodVertex
:
//Determine if vertexToCheck is a good vertex, if -1 check all verttices and find the first tagged good one
//qualityVertexVersion: x.y.z -- y and/or z can be omitted if 0
// x = general quality requirenents:
// 1 = standard, requires at least "z" tracks at the vertex to check (if not provided: the first one)
// 2 = DR requirement on 2-,3-track vertices
// 3 = Require at least N (default=5, otherwise=z) tracks pointing to the vertex
// y = additional vertex requirements
// 0 = none
// 1 = Accept only events where tagged vertex has N(=z) tracks
// >100, if (x=1) = interpret as a pT cuts on number of tracks
// z = Optional parameter for a given "y" mode
// examples:
// 1: standard
// 2.1.5: DR req. on 2-,3-trk vertices + tagged vertex required with at least 5 tracks
- -G: This option sets a requirement on the denominator of several truth-based efficiencies. It filters which truth-vertices to consider. See
VtxTmAlg.h
file, above the function: VtxTmAlg::SetGenVertexRequirementVersion
. Current implementation consistst of:
/** Set requirements on generated vertices to be considered.
* Depending on version the defined requirements are:
* 1: InTimePileup (default)
* 2: InTimePileup, 2 charged particles with |eta| < 2.5, pT > 400 MeV
* 3: InTimePileup, 5 charged particles with |eta| < 2.5, pT > 400 MeV
*/
An example of how to run the code is:
./TrackingAna.exe -T -o./out/test -v1.0.2 /eliza18/atlas/spagan/VtxStudies/VtxPUTF/VTX_MON/mc11_Run190728/*root*
This will produce three output files:
- ./out/test.txt: contians a summary of some efficiencies and settings
- ./out/test.root contains output histograms
- ./out/test.h: this is an easy shortcut for loading the output histograms for easy and quick plotting. Include this file and call loadHistogram to load all saved histogram in variables.
Truth-matchingdata12_8TeV.00200805.physics_MinBias.merge.AOD.f437_m1126
At the moment a prototype of vertex truth matching algorithm is implemented in the class
VtxTmAlg
. It is used in
AnaInDetTree
to study the composition of beam-constrained and non-beam-constrained vertices.
Some debug plots can be filled as well.
Plotting routines
Various plotting routines are available in
PUStudies/macros/drawing
. Most of them take as input the output of
TrackingAna.exe
. Some of them take the output of the EnhancedVertexMonitor as well.
As as simple example to make a new one, see
plot.C
. Basically each output is loaded through the automatically generated header in a different namespace. Then you can access the various plots and make your comparisons.
Each plotting routing can be executed or compiled, see the beginning of the file for instructions:
In particular:
- plot_PUStudies_Comparison.C: useful to compare output from different pile-up samples or tracking settings. Takes some basic performance plots and show them as function of the interesting variable.
- plot_PU_Comparison.C: Takes output of the plot_PUStudies_Comparison.C for various samples and put the plots on top of each other. Useful to see sample dependence of the previous studies.
- plot_NVtxMu_mc_data11_comparison.C: useful for data/MC and MC/MC comparisons in basic quantities. NVtx-Mu analysis and related.
- plot_vtxmon_dataMC.C: compare mostly the resolution. Useful since it combines the one obtained with truth-matching output from TrackingAna.exe and the data-driven (split-vertex) method output obtained by the EnhncedVertexMonitor package.
Some useful datasets
--
SPaganGriso - 15-Dec-2011