hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SimpZBiOptimizationProcessor.h
Go to the documentation of this file.
1#ifndef __SIMPZBI_ANAPROCESSOR_H__
2#define __SIMPZBI_ANAPROCESSOR_H__
3
4// HPSTR
5#include "Processor.h"
6#include "ZBiHistos.h"
8#include "SimpEquations.h"
9#include "SimpAnaTTree.h"
10
11// ROOT
12#include "TFile.h"
13#include "TTree.h"
14#include "TRefArray.h"
15#include "TBranch.h"
16#include "TVector3.h"
17#include "TLorentzVector.h"
18#include "TH1F.h"
19#include "TH2F.h"
20#include "TF1.h"
21#include "TEfficiency.h"
22#include "TGraph.h"
23
24// C++
25#include <memory>
26
32
33 public:
34
35 SimpZBiOptimizationProcessor(const std::string& name, Process& process);
36
38
42 virtual void configure(const ParameterSet& parameters);
43
47 virtual void initialize(TTree* tree) {};
48
52 virtual bool process(IEvent* event) {};
53
57 virtual void finalize();
58
62 virtual bool process();
63
67 virtual void initialize(std::string inFilename, std::string outFilename);
68
72 double calculateZBi(double n_on, double n_off, double tau);
73
78
82 bool failTestCut(std::string cutname, SimpAnaTTree* MTT);
83
87 void writeGraph(TFile* outF, std::string folder, TGraph* g);
88
92 void writeTH1F(TFile* outF, std::string folder, TH1F* h);
93
97 double round(double var);
98
102 void getSignalMCAnaVtxZ_h(std::string signalMCAnaFilename, std::string signal_pdgid);
103
107 double countControlRegionBackgroundRate(std::string inFilename, std::string tree_name,
108 double m_Ap, double Mbin=30.0, double dNdm_sf = 1.0);
109
113 void addNewVariables(SimpAnaTTree* MTT, std::string variable, double param);
114
118 void fillEventHistograms(std::shared_ptr<ZBiHistos> histos, SimpAnaTTree* MTT);
119
120 private:
121
122 // Configuration parameters //
123 int debug_{0};
124 int year_ = 2016; //<! description
125 std::string cuts_cfgFile_{""}; //<! description
126 std::string outFileName_{"zbi_out.root"}; //<! description
127 TFile* outFile_{nullptr}; //<! description
128 std::vector<std::string> cutVariables_; //<! description
129 std::vector<std::string> new_variables_; //<! description
130 std::vector<double> new_variable_params_; //<! description
131 std::string eq_cfgFile_{""}; //<! description
132 bool scan_zcut_ = false; //<! description
133 double step_size_ = 0.01; //<! description
134 int max_iteration_ = 75; //<! description
135
136 //Background config
137 std::string bkgVtxAnaFilename_{""}; //<! description
138 std::string bkgVtxAnaTreename_{""}; //<! description
139 SimpAnaTTree* bkgMTT_{nullptr}; //<! description
140 double min_ztail_events_ = 0.5; //<! description
141 double background_sf_; //<! description
142
143 // Signal //
144 std::string variableHistCfgFilename_{""}; //<! description
145 std::string signalVtxAnaFilename_{""}; //<! description
146 std::string signalVtxAnaTreename_{""}; //<! description
147 std::string signalVtxMCSelection_{""}; //<! description
148 std::string signalMCAnaFilename_{""}; //<! description
149 std::string signal_pdgid_{""}; //<! description
150 TH1F* signalSimZ_h_{nullptr}; //<! description
151 SimpAnaTTree* signalMTT_{nullptr}; //<! description
152 double signal_sf_ = 1.0; //<! description
153 double signal_mass_; //<! description
154 double logEps2_; //<! description
155 double massResolution_; //<! description
156 double mass_window_nsigma_; //<! description
157 double E_Vd_ = 1.35; //<! mean truth signal energy...default is 1.35
158
159 //Histograms
160 std::shared_ptr<ZBiHistos> signalHistos_; //<! description
161 std::shared_ptr<ZBiHistos> bkgHistos_; //<! description
162 std::shared_ptr<ZBiHistos> testCutHistos_; //<! description
163 std::shared_ptr<ZBiHistos> processorHistos_; //<! description
164
165 //cuts
166 typedef std::map<std::string, std::pair<double,int>>::iterator cut_iter_; //<! description
167 std::map<std::string,double> initialIntegrals_; //<! description
168
169 //Cuts
170 IterativeCutSelector *testCutsSelector_{nullptr}; //<! description
171 std::map<std::string, std::pair<double,int>>* testCutsPtr_; //<! description
173 std::map<std::string, std::pair<double,int>>* persistentCutsPtr_; //<! description
174
175 //backgroun
176 std::string tritrigFilename_{""}; //<! description
177 std::map<std::string,double*> tritrig_tuple_; //<! description
178 TTree* tritrigTree_{nullptr}; //<! description
179
180 //simp equations
181 SimpEquations* simpEqs_{nullptr}; //<! description
182
183 //Total A' Rate terms
184 double radFrac_ = 0.0;
185 double radAcc_ = 0.0;
186 double dNdm_ = 0.0;
187 double dNdm_sf_ = 1.0;
190
191 //mass window
192 double highMass_; //<! description
193 double lowMass_; //<! description
194
195};
196
197#endif
Base classes for all user event processing components to extend.
Definition IEvent.h:7
description
Base class for all event processing components.
Definition Processor.h:34
Read in flat TTree and create new cut variables for SIMP analysis.
All SIMP Equations for calculating expected signal.
Cutflow optimization tool for SIMPS.
double calculateZBi(double n_on, double n_off, double tau)
description
std::shared_ptr< ZBiHistos > bkgHistos_
void fillEventHistograms(std::shared_ptr< ZBiHistos > histos, SimpAnaTTree *MTT)
description
std::map< std::string, std::pair< double, int > >::iterator cut_iter_
virtual void configure(const ParameterSet &parameters)
description
double countControlRegionBackgroundRate(std::string inFilename, std::string tree_name, double m_Ap, double Mbin=30.0, double dNdm_sf=1.0)
description
void getSignalMCAnaVtxZ_h(std::string signalMCAnaFilename, std::string signal_pdgid)
description
bool failTestCut(std::string cutname, SimpAnaTTree *MTT)
description
virtual void initialize(TTree *tree)
description
std::vector< std::string > new_variables_
bool failPersistentCuts(SimpAnaTTree *MTT)
description
void writeTH1F(TFile *outF, std::string folder, TH1F *h)
description
void writeGraph(TFile *outF, std::string folder, TGraph *g)
description
std::map< std::string, std::pair< double, int > > * testCutsPtr_
std::shared_ptr< ZBiHistos > processorHistos_
void addNewVariables(SimpAnaTTree *MTT, std::string variable, double param)
description
std::map< std::string, std::pair< double, int > > * persistentCutsPtr_
std::shared_ptr< ZBiHistos > signalHistos_
std::map< std::string, double > initialIntegrals_
std::shared_ptr< ZBiHistos > testCutHistos_
std::map< std::string, double * > tritrig_tuple_
virtual bool process(IEvent *event)
description