|
|
|
# About
|
|
|
|
RooUnfoldAlgorithm is a top-class implementation in RooUnfold to provide a standardized interface incorporating useful features like plotting and saving the object making the process of unfolding more intuitive and easier for users, along with decoupling the implementation from the interface, allowing to shift to ROOT.
|
|
|
|
|
|
|
|
The features provided by RooUnfoldAlgorithm are as follows.
|
|
|
|
- Provide a standardised interface for accessing all methods (main objective of RooUnfold)
|
|
|
|
- Making the iterative process of unfolding easier and faster by allowing to just change a parameter and rerun the task without allocating new objects.
|
|
|
|
- Abstract away the implementation from the interface, allowing RooUnfold to decouple the interface from implementation and shift the implementation to ROOT
|
|
|
|
- Making it easier to make Errors and Optimization plots by intuitive APIs and encapsulating RooUnfoldError and RooUnfoldParms class with the rest of the library by a top-class implementation.
|
|
|
|
|
|
|
|
The proposed architecture ensures:
|
|
|
|
- Backward Compatible
|
|
|
|
- Ability to easily expand and plug in new unfolding method implementation, including the changes in the dev branch
|
|
|
|
|
|
|
|
# Proposed Architecture
|
|
|
|
|
|
|
|
## Proposed class UML
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
Huh, quite a lot of stuff going on here !! Let' break this and see parts separately.
|
|
|
|
|
|
|
|
Note: Some of the parameters(of settings) and redundant getters setter are removed from the UML for clarity purposes
|
|
|
|
|
|
|
|
### Current Architecture of RooUnfold
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
The top part of the UML is the current architecture of the RooUnfold library. The new RooUnfoldAlgorithm class will have an object of the current existing implementation of the Unfolding methods (hence diamond arrow). As being a top-class implementation, internally accessing features provided by other classes through their object would not hamper the current implementation of the library, hence making it **backwards compatible**. As well as abstracting away the details of the implementation, hence decoupling the interface with implementation.
|
|
|
|
|
|
|
|
### Unfolding using different algorithms and parameters
|
|
|
|
<img width="80%" src="uploads/efc49b48b766c0c9a3d48ebf029f05d5/RooUnfold_part_onepng.png" alt="alt text" >
|
|
|
|
|
|
|
|
Now let's first look at the upper part of RooUnfoldAlgorithm Class, where we have variables and the methods to support the heart of the idea, the ability to have a **standardized interface** for different unfolding methods.
|
|
|
|
|
|
|
|
Here we have variables to store the object of various unfolding methods as well as a variety of parameters available. The class contains overloaded constructors and destructors as well as some ritual functions like `getCov()` , `Reset()`, `Impl()`
|
|
|
|
|
|
|
|
Internally RooUnfold algorithm initialize the unfold object based on the method specified by the user and pass the parameters corresponding to that method—something like.
|
|
|
|
|
|
|
|
```plaintext
|
|
|
|
void RooUnfoldAlgorithm(res, mes, method, reg){
|
|
|
|
if (method == kBayes)
|
|
|
|
unfold = new RooUnfoldBayes(res, mes, reg);
|
|
|
|
if (method == kBinBybin)
|
|
|
|
unfold = new RooUnfoldBinbyBin(res, mes, reg);
|
|
|
|
.
|
|
|
|
.
|
|
|
|
.
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: This oversimplified implementation is just for understanding. The real implementation may vary.
|
|
|
|
|
|
|
|
This provides the ability to have a standard interface of `RooUnfoldAlgorithm` to **access various unfolding methods.**
|
|
|
|
|
|
|
|
The `getCov()` and other helper functions will internally call the unfold object.
|
|
|
|
|
|
|
|
```plaintext
|
|
|
|
void getCov(){
|
|
|
|
unfold.getCov();
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
As this is a top-class implementation, the class have getters for this unfold object to **provide user complete control** if they wish. Furthermore, the RooUnfoldAlgorithm class have getters and setters of every possible parameter for unfolding.
|
|
|
|
|
|
|
|
Unfolding is an iterative process where we have to try different things and see which works. RoounfoldAlgorithm will enable users to just **initialise the object once**, as the `response` and `measured` matrix is usually large; hence initialising again comes with overhead. Users can experiment with different methods and parameters using the same object, making this complete iterative cycle **faster, quicker with less code, and more efficient**.
|
|
|
|
|
|
|
|
Here is a sample code for the same
|
|
|
|
|
|
|
|
```plaintext
|
|
|
|
algo = new RooUnfoldAlgorithm(response, measured, 'bayes');
|
|
|
|
algo.unfold();
|
|
|
|
algo.plotError();
|
|
|
|
algo.setReg(3.4);
|
|
|
|
algo.unfold();
|
|
|
|
algo.plotError();
|
|
|
|
algo.setMethod('invert');
|
|
|
|
algo.unfold();
|
|
|
|
algo.plotErrors();
|
|
|
|
```
|
|
|
|
|
|
|
|
##### Ambiguity in parameters
|
|
|
|
|
|
|
|
Some parameter and method-specific, like `lambdaM` is used in IDS but not in other methods. So, for example, if a user has specified the parameter `lambdaM` and using the Bayes method, that parameter will be ignored, and a **message of the parameters used will be displayed to the user**.
|
|
|
|
|
|
|
|
Apart from this, RooUnfoldAlgorithm will also provide features **including Toys and IncludeSystematics**, also computes Residuals, Pulls and other necessary metrics.
|
|
|
|
|
|
|
|
### Plotting Errors and Optimization plots
|
|
|
|
<img width="80%" src="uploads/77caf7d05042a4b03dfdb4fea4d2c452/RooUnfold_plot.png" alt="alt text" >
|
|
|
|
|
|
|
|
Plotting a graph is an essential component of analysing the unfolded results. RooUnfold currently possesses RooUnfoldErrors and RooUnfoldParms for giving out and plotting these errors like:
|
|
|
|
|
|
|
|
The method provided by RooUnfoldError:
|
|
|
|
1. A graph of the errors from the unfolding (Unf_err())
|
|
|
|
2. A graph of the errors due to the spread of the reconstructed points (Spread())
|
|
|
|
3. An error matrix based on the spread of the reconstructed points (True_err())
|
|
|
|
|
|
|
|
The method provided by RooUnfoldParms:
|
|
|
|
1. Chi-squared values vs regularisation parameter (GetChi2())
|
|
|
|
2. RMS of the residuals given by the true and the unfolded distribution vs regularisation parameter (GetRes())
|
|
|
|
3. RMS spread of the residuals vs regularisation parameter (GetRMSSpread())
|
|
|
|
|
|
|
|
However, RooUnfoldError and RooUnfoldParms are **two separate classes** from the rest of the library. RooUnfoldAlgorithm aims to **unite these features** and provide an intuitive **easy to use interface** for these functions.
|
|
|
|
|
|
|
|
This enables the user to quickly iterate over the cycle of _unfold -> plot and analyse -> change parms -> unfold again_ with just one object using just the interface of RooUnfoldAlgorithm, making the **process easier with fewer lines of code**.
|
|
|
|
|
|
|
|
RooUnfoldAlgorithm will use the object of RooUnfoldError and RooUnfoldParms under the hood to implement these features. RooUnfoldAlgorithm has a method to either get the TH1 object the respective plot. For example, TH1 objects errors from the unfolding, **allowing the user to plot as they wish**. Also, the class have a default `plot()` function to plot in a predetermined manner with a predefined axis in case **user is fine with default** and just want to get work done fastest.
|
|
|
|
|
|
|
|
### Serialization: We love our unfolded result... let's not forget it :)
|
|
|
|
|
|
|
|
<img width="80%" src="uploads/3cb9b538c3b73b186017dd55f961b454/RooUnfold_last.png" alt="alt text" >
|
|
|
|
|
|
|
|
To facilitate users to **save and share their work** RooUnfoldAlgorithm class provides the feature to **serialize the class object** **to a ROOT workspace**. This feature will allow users to store the current object to resume work after switching off also **share their publication results**, including all the variables like response matrix, settings used etc., making the **process of duplication easy.** |
|
|
|
\ No newline at end of file |