-
Notifications
You must be signed in to change notification settings - Fork 2
Step 5: FritSignal
Extractor2Dataset> cd ../Fit
The aim of this step is to fit the signal and extract the corresponding Probability Density Function (PDF) from the datasets generated in the previous step.
The script that fills this role is fritSignal.cc
. Your PDF are defined as objects of SignalFunctions and BackgroundFunctions classes (see SignalFunctions.h
and BackgroundFunctions.h
) which are heritated from BaseFunction abstract mother class (BaseFunction.h
). These daughter classes construct PDF from the functions defined in RooFit, as RooKeysPdf for example.
In the main script, fritSignal.cc
, you create a signal PDF for each category of your analysis, i. e. if you are in the muon or electron channel. This is realized by the getCategoriesPdf
function implemented in Functions.h
.
Note: Usually, in the code, we will use these definitions:
- category refers to the lepton channel (i. e. electron or muon) ;
- type refers to "signal" or "background".
Finally, once your PDF are chosen for each category, the signal is fitted for the different category (using RooSimultaneous PDF).
Your work and results are saved in different ways and will be used in the next steps:
- The number of found signal events, its error and the chi2 of the fit are stored in frit_efficiencies.json for each mass point, category and b-tag selection ;
- The PDF and fit results are saved in a RooWorkSpace in `/frit/_workspace.root``;
- Plots of the fit and the data are drawn and saved in
frit
directory.
You will run the script on the datasets you produced in the previous step. The first thing you have to do is to create a symbolic link to these datasets (this will remove the date from the name of the directory and you will be able to use directly fritSignalForAllMasses*.py
later):
Fit> cd ../Extractor2Dataset/datasets
datasets> ln -s <aDate> Latest
datasets> cd ../../Fit
You can decide to work on several analysis corresponding to different configurations. To start a new one, use startAnalysis.py
script:
Fit> ./startAnalysis.py
Then, follow the instructions and fill the informations that are required (a name and a description for your analysis for example). Each of your analysis are identified by a unique ID which is then necessary for the fritSignal.cc
script to know on which analysis it has to run on.
This automatically generates an analysis
directory (if it doesn't exist already) in which a directory, whose name is the ID number, is created. Particulary, in this last directory, you can find the configuration files in the fit_configuration
directory (pasted from the current analysis one). The work space and plots you will generate for your analysis will be then saved in the frit
directory.
The informations concerning your analysis are stored in analysis.json
which is automatically updated by the startAnalysis.py
script.
To switch from an analysis to an other one, use setCurrentAnalysis.py
and follow the instructions:
Fit> ./setCurrentAnalysis.py
The configuration is read from the fit_configuration/frit_pdf.json
by default, and this is how this file is construct:
{
"muon": {
"signal": {
"name": "keyspdf",
"parameters": "none"
},
"background": {
"name": "exp",
"parameters": "exp_mu"
}
},
"electron": {
"signal": {
"name": "keyspdf",
"parameters": "none"
},
"background": {
"name": "exp",
"parameters": "exp_e"
}
}
}
As it is shown, for each category, electron or muon, you have to specify:
- name: the PDF name for both signal and background ;
- parameters: the parameters associated to these PDF, used for their construction in RooFit.
The parameters are defined in fit_configuration/pdf_parameters.json
where you have to specify a beginning value, a low bound and a high bound for each parameter. For example, for the crystal ball parameters for both electron and muon channels, you can have:
{
"crystalball_mu": {
"mean": ["%mass%", "%low_bound%", "%high_bound%"],
"sigma": [55., 50., 200.],
"alpha": [1.13, 0.1, 10.],
"n": [1., 0.5, 300.]
},
"crystalball_e": {
"mean": ["%mass%", "%low_bound%", "%high_bound%"],
"sigma": [55., 50., 200.],
"alpha": [2.8, 0.1, 10.],
"n": [1., 0.5, 300.]
}
}
Note: Currently, the signal is fitted with a non-analytic PDF (RooKeysPdf), according to an "only signal" hypothesis. Previously, it was fitted according to a "signal+background" hypothesis, combining a crystal ball PDF for the signal and a decreasing exponential to modelized the reconstruction errors. So in the first case, a background PDF is not needed but the script will crash if none is given in the configuration file. Finally, the code removes this background PDF from the global one.
This is the usage of fritSignal script:
./fritSignal {--input-list <string>|-i <string>} [--save-workspace]
[--config-file <string>] --b-tag <int> -m <integer> [--pdf
<string>] [--pileup <string>] [--jer <string>] [--jec
<string>] [--] [--version] [-h]
Where:
--input-list <string>
(OR required) A text file containing a list of input files
-- OR --
-i <string>, --input-file <string>
(OR required) The input file
--save-workspace
Save the workspace for redoing plot after
--config-file <string>
Fit configuration file
--b-tag <int>
(required) Number of b-tagged jets
-m <integer>, --mass <integer>
(required) Zprime mass
--pdf <string>
Run the frit for this specific pdf syst.
--pileup <string>
Run the frit for this specific pileup syst.
--jer <string>
Run the frit for this specific jer.
--jec <string>
Run the frit for this specific jec.
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
--version
Displays version information and exits.
-h, --help
Displays usage information and exits.
For example, to fit a Z' with a mass of 750 GeV, with one b-tagged jets and the default configuration, the command will be:
./fritSignal -m 750 --b-tag 1 -i ../Extractor2Dataset/MTT_Zprime_750_Narrow_2012_08Nov_merged.root
You have to redo this operation for each mass point and for each b-tagged jets number (1 and 2). Fortunately, a script is doing it automatically for you:
Fit> make
To run it on narrow signal datasets:
Fit> ./fritSignalForAllMassesNarrow.py
Fit> ./fritSignalForAllMassesNarrowSyst.py
To run it on large signal datasets:
Fit> ./fritSignalForAllMassesLarge.py
Fit> ./fritSignalForAllMassesLargeSyst.py
Warning: Don't work on large and narrow resonances at the same time! Indeed, the fritSignal
script overwrite automatically the frit_efficiencies.json
file, which is then used in step 6. So be carefull.