I run the macros in interactive mode:
root -l -b -q macroname.cxx
I compared the run-time with a compilied version before with no significant difference. So for ease of use I've stuck with running them in interactive mode. The code probably won't even pass through the compiler without errors now
Event
contains classes to read in each event from the ntuplesTL1DataClass.h
is a class for each tree in the ntuplesTL1PrimitiveClass.h
allows access to all the relevant treesTL1EventClass.h
manipulates the information from the trees. Gets all the relevant variables such as level-1 quantities, recalculations of certain variables, selection criteria, ...
Plotting
is completely separate fromEvent
. Contains the logic for plottingTL1Plots.h
is the base class for all the plots and contains virtual functions to initialise the plots, Fill the plots and save the plots as pdfs. Additional parameters label the dataset, output directory, pu binning, ...TL1*.h
for the other header files each represent a different plot type: PU weights, rates vs efficiency, rates, resolutions, turnons, xvsy scatter plotstdrstyle.C
sets the general style used throughout
Tests
contains test macros. Can be disregarded for now. Mainly for development purposesUtilities
contains macros which are helpful but not necessarily requiredTL1DateTime.C
uses root'sTDatime.h
for the date in the format YearMonthDay to label output filesTL1Progress.C
prints the progress bar by taking the current event and the total number of events
- In the main directory
DefaultPlots.md
lists the default plots created from each*.cxx
file (may not be true in the master, but all these plots can be made)generatePUWeights.cxx
generates a root-file containing the pu weights for MC samples. Weighted to an input data sample. Also makes a plot of the PU weightsmakeJetResolutions.cxx
creates plots of (L1-Offline)/Offline [for energy] or (L1-Offline) [for position] for jetsmakeJetTurnons.cxx
creates turnon plots for jetsmakeJetXvsY.cxx
creates a 2D scatter plots of variable X vs variable Y for jetsmakeRateEfficiency.cxx
creates a plot of the L1 Rate (calculated frommakeRates.cxx
) against the absolute efficiency (for a different sample)makeRates.cxx
creates a plot of the rate against L1 thresholdmakeResolutions.cxx
creates resolution plots for energy sumsmakeTurnons.cxx
creates turnon plots for energy sumsmakeXvsY.cxx
creates a 2D scatter plot of variable X vs. variable Y for energy sums
- Create an object (named
event
for example) of classTL1EventClass
with a single input argument, a vector of strings representing the directories where the root-files are located - Call the
Next()
function of classTL1EventClass
. This returns a boolean, true if there is a next event, false if not. Hence this can be placed in the argument of a while statement - If we want to access the sums tree from l1RecoJetTree we can get to this like so:
event->GetPEvent()->fSums
- The names for the ntuple trees are in
Event/TL1PrimitiveEvent.h
.GetPEvent()
returns a constant to an object of classTL1PrimitiveEventClass
. The trees fromTL1PrimitiveEventClass
are public, so caution must be taken if creating an object ofTL1PrimitiveEventClass
- To get the level-1 upgrade tree parameters (since these are stored in arrays) they are accessed from
TL1EventClass
and are public (due to laziness), e.g. fL1Met, fL1EmuMetHF, ...
- Change the sample (only Data is really implemented thus far)
- Choose the trigger name and title (name is placed in file names and title is placed on plot titles - this is the naming convention used throughout)
- Choose the run number, or make it a range, or something like "2016B_v1"
- Input the output directory in outDirBase
- Select the pile-up bin splitting. This will generate the plots in the chosen pile-up bins (note that the plots inclusive of pile-up are still produced)
- Change inDir to point at the directory that contains all root-files you want to run over. The code uses the wildcard "*.root" in this directory to select the root-files
- Change outDir to conform to how you want the output directory to look like. I like:
${OUTDIRBASE}/${DATE}_${SAMPLE}_${RUN}_${TRIGGER}/ XvsY/ XvsYJets/ Resolutions/ ResolutionsJets/ Turnons/ TurnonsJets/
The object xvsy is a vector of TL1XvsY objects. Each one represents a different type of xvsy plot. xvsy.emplace_back(new TL1XvsY());
to create a new element in the vector, then set:
SetXBins(bins)
wherebins
is a vector with the edges of the bins desired (I typically have functions that generate this vector)SetX(name,title)
wherename
andtitle
are the respective x-name and x-title as stringsSetYBins(bins)
to set the y binning (typically the same as the x binning)SetY(name,title)
to set the y-name and y-titleSetOutName(name)
to set the output name for this plot, e.g.triggerName+"_"+xName+"_vs_"+yName+"_"+requirements
whererequirements
is a string describing any requirements for this plot (e.g. barrel only)SetAddMark(mark)
adds amark
(some test) on the plot that can describe any requirements if desired (e.g. eta range selected)
Now repeat this for all plots desired. Further down in the code inside the event loop (while( event->Next() )
) is the logic of filling the plots. After getting the pile-up start filling using Fill(xval, yval, pu)
applying some requirements:
- For XvsY I typically include a requirement of
xval>0.0
andyval>0.0
to prevent the z-scale from screwing up - For the
xval
andyval
these are obtained fromevent->GetPEvent()
if they are found in the ntuples originally. If they are created inTL1EventClass.h
(such as level-1 values) then they are acquired viaevent
, e.g.double offlineMht = event->GetPEvent->fSums->mHt; double l1Mht = event->fL1Mht;
- There are a few flags in
TL1EventClass
(event
is an object of this). For MET in SingleMuon I typically use:bool muonFilterFlag = event->fMuonFilterPassFlag; bool metFilterFlag = event->fMetFilterPassFlag;
- If using a phi variable as x or y, I send it through the
FoldPhi(phi)
function to get it in the range of 0 to pi.