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.
Loading...
Searching...
No Matches
OptimizationProcessor.h
Go to the documentation of this file.
1#ifndef __OPTIMIZATION_ANAPROCESSOR_H__
2#define __OPTIMIZATION_ANAPROCESSOR_H__
3
4// HPSTR
5#include "BaseSelector.h"
6#include "Processor.h"
7#include "ZBiHistos.h"
8
9// ROOT
10#include "TBranch.h"
11#include "TEfficiency.h"
12#include "TF1.h"
13#include "TFile.h"
14#include "TGraph.h"
15#include "TH1F.h"
16#include "TH2F.h"
17#include "TLorentzVector.h"
18#include "TRefArray.h"
19#include "TTree.h"
20#include "TVector3.h"
21
22// C++
23#include <memory>
24
28
30 public:
31 OptimizationProcessor(const std::string& name, Process& process);
32
34
38 virtual void configure(const ParameterSet& parameters);
39
43 virtual void initialize(TTree* tree) {};
44
48 virtual bool process(IEvent* event) {};
49
53 virtual void finalize();
54
58 virtual bool process();
59
63 virtual void initialize(std::string inFilename, std::string outFilename);
64
68 double calculateZBi(double n_on, double n_off, double tau);
69
73 void writeGraph(TFile* outF, std::string folder, TGraph* g);
74
78 void writeTH1F(TFile* outF, std::string folder, TH1F* h);
79
80 protected:
81 typedef std::map<std::string, std::pair<double, int>>::iterator cut_iter_; //<! iterator for BaseCutSelector
82
83 // Configuration parameters
84 int debug_{0}; //<! debug level
85 int year_ = 2021; //<! year
86
87 std::string cuts_cfgFile_{""}; //<! configuration file for cuts
88 std::string outFileName_{""}; //<! output file name
89 TFile* outFile_{nullptr}; //<! output file pointer
90
91 std::vector<std::string> cutVariables_; //<! list of cut variables
92 std::vector<std::string> new_variables_; //<! list of new variables
93 std::vector<double> new_variable_params_; //<! list of new variable parameters
94 std::string variableHistCfgFilename_{""}; //<! histogram config file
95
96 // Background config
97 std::string bkgVtxAnaFilename_{""}; //<! description
98 std::string bkgVtxAnaTreename_{""}; //<! description
99 TFile* bkgVtxAnaFile_{nullptr}; //<! background vertex analysis file pointer
100 double background_sf_; //<! background scale factor
101
102 // Signal config
103 std::string signalVtxAnaFilename_{""}; //<! description
104 std::string signalVtxAnaTreename_{""}; //<! description
105 TFile* signalVtxAnaFile_{nullptr}; //<! signal vertex analysis file pointer
106 double signal_sf_ = 1.0; //<! signal scale factor
107
108 std::string signalMCAnaFilename_{""}; //<! pre-trigger signal MC analysis file
109 std::string signalMCAnaTreename_{""}; //<! pre-trigger signal MC analysis tree name
110 TFile* signalMCAnaFile_{nullptr}; //<! pre-trigger signal MC
111 std::string signal_pdgid_{""}; //<! PDG ID of signal particle
112
113 double signal_mass_; //<! signal mass in GeV
114 double eps_; //<! coupling strength
115 double massResolution_; //<! mass resolution at signal mass
116 double mass_window_nsigma_; //<! width of mass window in number of sigmas
117 double lowMass_; //<! low edge of mass window
118 double highMass_; //<! high edge of mass window
119
120 // Histograms
121 std::shared_ptr<ZBiHistos> signalHistos_; //<! description
122 std::shared_ptr<ZBiHistos> bkgHistos_; //<! description
123 std::shared_ptr<ZBiHistos> testCutHistos_; //<! description
124 std::shared_ptr<ZBiHistos> processorHistos_; //<! description
125
126 // Cuts
127 BaseSelector* testCutsSelector_{nullptr}; //<! cuts to be optimized
128 std::map<std::string, std::pair<double, int>>* testCutsPtr_; //<! pointer to test cut
129 BaseSelector* persistentCutsSelector_{nullptr}; //<! cuts that are always applied
130 std::map<std::string, std::pair<double, int>>* persistentCutsPtr_; //<! pointer to persistent cut
131
132 double step_size_ = 0.01; //<! Cut step_size% of signal with each iteration
133 int max_iteration_ = 75; //<! maximum number of iterations
134};
135
136#endif
Base classes for all user event processing components to extend.
brief description
Definition IEvent.h:7
double calculateZBi(double n_on, double n_off, double tau)
description
std::vector< double > new_variable_params_
std::shared_ptr< ZBiHistos > bkgHistos_
std::map< std::string, std::pair< double, int > >::iterator cut_iter_
virtual void configure(const ParameterSet &parameters)
description
virtual void initialize(TTree *tree)
description
std::vector< std::string > cutVariables_
virtual void finalize()
description
std::vector< std::string > new_variables_
BaseSelector * persistentCutsSelector_
std::map< std::string, std::pair< double, int > > * persistentCutsPtr_
OptimizationProcessor(const std::string &name, Process &process)
void writeTH1F(TFile *outF, std::string folder, TH1F *h)
description
void writeGraph(TFile *outF, std::string folder, TGraph *g)
description
std::shared_ptr< ZBiHistos > processorHistos_
std::shared_ptr< ZBiHistos > signalHistos_
std::shared_ptr< ZBiHistos > testCutHistos_
virtual bool process(IEvent *event)
description
virtual bool process()
description
std::map< std::string, std::pair< double, int > > * testCutsPtr_
description
Processor(const std::string &name, Process &process)
Class constructor.
Definition Processor.cxx:10