forked from amissert/atmFitTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistoFactory.h
60 lines (54 loc) · 2.34 KB
/
histoFactory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef HISTOFACTORY_H
#define HISTOFACTORY_H
#include "sharedPars.h"
#include "histoManager.h"
#include "shared.h"
using namespace std;
//class for building histograms from sorted data and mc trees
class histoFactory{
public:
histoFactory(int nsampl,int nbins,int ncomp,const char* name=""); //creates blank histogram factory
histoFactory(const char* parfile, bool separateneutmode = false);//< initialize using parameters in par file
histoFactory(int nsampl,int nbins,int ncomp,int nmode, bool separateneutmode, const std::string name = "");
histoManager* hManager;
TChain* dataTree; //tree containing data events
TChain* mcTree; //tree conttaining MC events
fQreader* fqData; //reads data tree
fQreader* fqMC; //reads MC tree
TString nameTag; //name associated with this instance
TFile* fout; //output file for filled histograms
TH1D* htmp; //temporary histogram pointer for drawing and comparison
TH1D* hnorm;
int nSamples; //number of data samples
int nComponents; //number of MC components
int nAttributes; //number of attributes (fiTQun outputs)
int nBins; //number of bins in data
int nModes;
bool separateNeutMode;
int nDataEvents; //number of data events
int nMCEvents; //number of MC events
double normMC; //normalization factor for MC
double att[NATTMAX]; //array of all attribute values
//TString attType[NATTMAX]; //array of attribute type codes
void init(); //initialize after attributes have been set (sets branch addresses, creates histograms)
//void addAttribute(int iatt); //add an attribute (fiTQun variable) to list of histograms to be made
TH1D* getHistogram(int iatt,const char* thename); //returns pointer to MC histogram
TH1D* getHistogramData(int iatt,const char* thename); //returns pointer to Data histogram
void fillAttributesData(); //fills all data histograms
void fillAttributesMC(); //fills all MC histograms
void fillHistos(); //fills all histograms
//setters
void setDataTree(TTree* tr);
void setDataTree(TChain* ch);
void setMCTree(TTree* tr);
void setMCTree(TChain* ch);
void saveToFile();
TString outputFileName;
TString getOutputFileName(){return outputFileName;}
void setOutputFileName(const char *name){outputFileName=name;}
void normalizeHistos(double scale=-1.);
void runHistoFactory();
TString parFileName;
sharedPars* runpars;
};
#endif