Crombie Tools
TwoScaleFactorCorrector.h
Go to the documentation of this file.
1 /**
2  @file TwoScaleFactorCorrector.h
3 
4  Header file for the TwoScaleFactorCorrector class.
5 
6  @author Daniel Abercrombie <dabercro@mit.edu>
7 */
8 
9 #ifndef CROMBIETOOLS_SKIMMINGTOOLS_TWOSCALEFACTORCORRECTOR_H
10 #define CROMBIETOOLS_SKIMMINGTOOLS_TWOSCALEFACTORCORRECTOR_H
11 
12 #include <vector>
13 #include "TString.h"
14 #include "TTree.h"
15 
16 #include "Corrector.h"
17 
18 /**
19  @ingroup skimminggroup
20  @class TwoScaleFactorCorrector
21  @brief Can be created using the CrombieTools.SkimmingTools.TwoScaleFactorCorrector module.
22 
23  A TwoScaleFactorCorrector reads from a tree and histogram and returns a correction factor.
24  The CorrectorApplicator facilitates this application by providing the trees
25  and writes the result to a branch.
26 
27  Unlike the Corrector, there are two different scale factors for two different legs considered.
28  Cuts and conditions are given explicitly for when to apply which scale factor to which leg
29  by supplying this Corrector with four regular Corrector objects.
30 
31  A condition that results in a combinatoric scale factor is also given.
32  If this condition is true, for example, if we require two loose leptons,
33  with at least one also tight (though both can be tight),
34  we use the following scale factor when both leptons are tight:
35  \f[
36  SF = \frac{SF_{1,tight}^2 SF_{2,loose} + SF_{1,loose} SF_{2,tight}^2}
37  {SF_{1,tight} + SF_{2,tight}}
38  \f]
39 
40 */
41 
43 {
44  public:
45  /// Constructor setting the name of a branch it would like to write to.
47  TwoScaleFactorCorrector( TString name,
48  Corrector* Leg1Loose, Corrector* Leg1Tight,
49  Corrector* Leg2Loose, Corrector* Leg2Tight );
50  virtual ~TwoScaleFactorCorrector();
51 
52  /// Copy this TwoScaleFactorCorrector for parallelization
54 
55  /// Set the pointer to the TTree the Corrector objects inside are reading.
56  void SetInTree ( TTree* tree );
57 
58  /// Gets the list of formulas that this corrector is using
59  std::vector<TString> GetFormulas ();
60 
61  private:
62  /// Evaluate the TTree pointer fInTree at its current entry.
63  Float_t DoEval ();
64 
65  static constexpr int TSFCORRECTOR_NCORRECTORS = 4;
66  std::vector<Corrector*> fCorrectors; ///< Pointers to the Correctors
67 
68  ClassDef(TwoScaleFactorCorrector,1)
69 };
70 
71 #endif