Crombie Tools
XSecAdder.h
Go to the documentation of this file.
1 /**
2  @file XSecAdder.h
3 
4  Header file for the XSecAdder class.
5 
6  @author Daniel Abercrombie <dabercro@mit.edu>
7 */
8 
9 #ifndef CROMBIETOOLS_SKIMMINGTOOLS_XSECADDER_H
10 #define CROMBIETOOLS_SKIMMINGTOOLS_XSECADDER_H
11 
12 #include <vector>
13 
14 #include "TString.h"
15 #include "ParallelRunner.h"
16 
17 /**
18  @ingroup analysisgroup
19  @class XSecAdder
20  @brief Can be created using the CrombieTools.AnalysisTools.XSecAdder module.
21 
22  A XSecAdder reads from a config file and adds a branch for a XSec weight.
23  Still needs to be multiplied by Luminosity to get proper number of events.
24 */
25 
26 class XSecAdder : public ParallelRunner
27 {
28  public:
29  /// Constructor setting the name of a branch it would like to write to.
30  XSecAdder( TString name = "XSecWeight" );
31  virtual ~XSecAdder();
32 
33  /// Loops through all the stored files and adds a XSec branch to the right tree
34  void AddXSecs ();
35 
36  /// Set the name of the tree to read to get number of events
37  void SetInTreeName ( TString name ) { fInTreeName = name; }
38  /// Set the name of the tree to write to
39  void SetOutTreeName ( TString name ) { fOutTreeName = name; }
40  /// Set the name of the branch to write to
41  void SetBranchName ( TString name ) { fBranchName = name; }
42  /// Add a branch to merge into the new cross section branch
43  void AddMergeBranch ( TString name ) { fMergeBranches.push_back(name); }
44 
45  private:
46  TString fInTreeName = "events"; ///< Name of Tree to read to get number of events
47  TString fOutTreeName = "events"; ///< Name of Tree to write to
48  TString fBranchName; ///< Name of Branch to write to
49 
50  std::vector<TString> fMergeBranches; ///< List of branches to merge into the new branch
51 
52  void RunFile(FileInfo& info); ///< Run over a single file
53 
54  ClassDef(XSecAdder,1)
55 };
56 
57 #endif