Skip to content

Commit

Permalink
Minor cleanups (cms-sw#56)
Browse files Browse the repository at this point in the history
* Script to make it easier to run L1TrackNtuplePlot.C

* Avoid need to edit Settings.h when running Tracklet algo

* Updated comments

* Updated comments
  • Loading branch information
tomalin authored Nov 25, 2020
1 parent 1f9e5ac commit be22f8d
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 5 deletions.
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace trklet {
//Comment out to run tracklet-only algorithm
#ifdef CMSSW_GIT_HASH
#ifndef USEHYBRID
#error USEHYBRID is not defined
#pragma message "USEHYBRID is undefined, so Hybrid L1 tracking disabled."
#endif
#endif
}
Expand Down
11 changes: 7 additions & 4 deletions L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
############################################################

GEOMETRY = "D49"
L1TRKALGO = 'HYBRID' # L1 tracking algorithm: 'HYBRID' (baseline, 4par fit) or 'HYBRID_DISPLACED' (extended, 5par fit)
# Set L1 tracking algorithm:
# 'HYBRID' (baseline, 4par fit) or 'HYBRID_DISPLACED' (extended, 5par fit).
# (Or legacy algos 'TMTT' or 'TRACKLET').
L1TRKALGO = 'HYBRID'

WRITE_DATA = False

Expand Down Expand Up @@ -106,8 +109,8 @@ def getTxtFile(txtFileName):

# LEGACY ALGORITHM (EXPERTS ONLY): TRACKLET
elif (L1TRKALGO == 'TRACKLET'):
print "\n WARNING - this is not a recommended algorithm! Please use HYBRID (HYBRID_DISPLACED)!"
print "\n To run the tracklet-only algorithm, please ensure you have commented out #define USEHYBRID in interface/Settings.h + recompiled! \n"
print "\n WARNING: This is not the baseline algorithm! Prefer HYBRID or HYBRID_DISPLACED!"
print "\n To run the Tracklet-only algorithm, ensure you have commented out 'CXXFLAGS=-DUSEHYBRID' in BuildFile.xml & recompiled! \n"
process.TTTracksEmulation = cms.Path(process.L1HybridTracks)
process.TTTracksEmulationWithTruth = cms.Path(process.L1HybridTracksWithAssociators)
NHELIXPAR = 4
Expand All @@ -117,7 +120,7 @@ def getTxtFile(txtFileName):

# LEGACY ALGORITHM (EXPERTS ONLY): TMTT
elif (L1TRKALGO == 'TMTT'):
print "\n WARNING - this is not a recommended algorithm! Please use HYBRID (HYBRID_DISPLACED)! \n"
print "\n WARNING: This is not the baseline algorithm! Prefer HYBRID or HYBRID_DISPLACED! \n"
process.load("L1Trigger.TrackFindingTMTT.TMTrackProducer_Ultimate_cff")
L1TRK_PROC = process.TMTrackProducer
L1TRK_NAME = "TMTrackProducer"
Expand Down
51 changes: 51 additions & 0 deletions L1Trigger/TrackFindingTracklet/test/makeHists.csh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/tcsh
###########################################################################
# Create L1 track histograms & print summary of tracking performance, #
# by running ROOT macro L1TrackNtuplePlot.C on .root file #
# from L1TrackNtupleMaker_cfg.py #
# #
# To use: #
# makeHists.csh rootFileName #
# #
# (where rootFileName is the name of the input .root file, #
# including its directory name, if its not in the current one. #
# If rootFileName not specified, it defaults to TTbar_PU200_hybrid.root) #
###########################################################################

if ($#argv == 0) then
set inputFullFileName = "TTbar_PU200_D49.root"
else
set inputFullFileName = $1
endif

if ( -e $inputFullFileName) then
echo "Processing $inputFullFileName"
else
echo "ERROR: Input file $inputFullFileName not found"
exit(1)
endif

# Get directory name
set dirName = `dirname $inputFullFileName`/
# Get file name without directory name
set fileName = `basename $inputFullFileName`
# Get stem of filename, removing ".root".
set inputFileStem = `echo $fileName | awk -F . '{print $1;}'`

# Find plotting macro
eval `scramv1 runtime -csh`
set plotMacro = $CMSSW_BASE/src/L1Trigger/TrackFindingTracklet/test/L1TrackNtuplePlot.C
if ( -e $plotMacro ) then
# Run plotting macro
if (-e TrkPlots) rm -r TrkPlots
\root -b -q ${plotMacro}'("'${inputFileStem}'","'${dirName}'")' | tail -n 19 >! results.out
cat results.out
echo "Tracking performance summary written to results.out"
echo "Histograms written to TrkPlots/"
else if ( -e ../L1TrackNtuplePlot.C ) then
else
echo "ERROR: $plotMacro not found"
exit(2)
endif

exit

0 comments on commit be22f8d

Please sign in to comment.