Skip to content

Commit

Permalink
Add description of how to add a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
CeliaFernandez committed Jan 9, 2023
1 parent 8656711 commit df839c1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ scram b -j 8

<p> The analyzer consists of three folders: </p>
<ul>
<li> plugins: which contains the plugins (EDAnalyzer's) where the analyzers are defined in `.cc` files. These are the main code.</li>
<li> python : which contains cfi files to setup the sequences that run with the plugins contained in `plugins/`. A sequence is an specific configuration of the parameters that run with one of the plugins defined in `plugins`. One single plugin may have different sequences defined in the same or multiple files.</li>
<li> test: which contains cfg files to run the sequences defined in the `python/` folder.</li>
<li> <strong>plugins/</strong>: which contains the plugins (EDAnalyzer's) where the analyzers are defined in .cc files. These are the main code.</li>
<li> <strong>python/</strong>: which contains cfi files to setup the sequences that run with the plugins contained in plugins/. A sequence is an specific configuration of the parameters that run with one of the plugins defined in plugins. One single plugin may have different sequences defined in the same or multiple files.</li>
<li> <strong>test/</strong>: which contains cfg files to run the sequences defined in the python/ folder.</li>
</ul>

## How to run
Expand All @@ -54,7 +54,19 @@ cmsRun test/runNtuplizer_cfg.py

In this section (to be completed) there are several examples of how modify the existing analyzer.

### How to add new variables
### How to add new variables of an existing collection

1) We first need to declare a new variable that will act as a container for the value we want to store e.g. the number of displacedGlobalMuon tracks ```ndgl```. It is defined in the constructor of the EDAnalyzer as a private variable (although it could be also a global variable):
https://github.com/CeliaFernandez/standard-Ntuplizer/blob/8656711d7fa7d640a9ec160daa955738d283720e/plugins/ntuplizer.cc#L79

2) We then need to link this variable's address ```&ndlg``` to the TTree branch. This is done at the beginning, where the TTree is created in ```beginJob()```:
https://github.com/CeliaFernandez/standard-Ntuplizer/blob/8656711d7fa7d640a9ec160daa955738d283720e/plugins/ntuplizer.cc#L147

3) This variable will be saved inside the TTree once the Fill() command is executed:
https://github.com/CeliaFernandez/standard-Ntuplizer/blob/8656711d7fa7d640a9ec160daa955738d283720e/plugins/ntuplizer.cc#L244
So the value of this variable should be assigned before that like:
https://github.com/CeliaFernandez/standard-Ntuplizer/blob/8656711d7fa7d640a9ec160daa955738d283720e/plugins/ntuplizer.cc#L210
https://github.com/CeliaFernandez/standard-Ntuplizer/blob/8656711d7fa7d640a9ec160daa955738d283720e/plugins/ntuplizer.cc#L216

### How to read a new collection

0 comments on commit df839c1

Please sign in to comment.