CMS 3D CMS Logo

PixelResolutionHistograms.h
Go to the documentation of this file.
1 #ifndef FastSimulation_TrackingRecHitProducer_PixelResolutionHistograms_h
2 #define FastSimulation_TrackingRecHitProducer_PixelResolutionHistograms_h 1
3 
4 class TFile;
5 class TH1F;
6 class TH2F;
7 class TAxis;
10 
11 #include <memory>
12 #include <string>
13 
17 
18 static constexpr unsigned int COTBETA_HIST_MAX = 30;
19 static constexpr unsigned int COTALPHA_HIST_MAX = 20;
20 static constexpr unsigned int QBIN_HIST_MAX = 4;
21 
23 public:
24  //--- Constructor to use when generating resolution histograms.
25  // We make empty histograms (which we own), but generator pointers
26  // remain null.
27  //
28  PixelResolutionHistograms(std::string filename, // ROOT file for histograms
29  std::string rootdir, // Subdirectory in the file, "" if none
30  std::string descTitle, // Descriptive title
31  unsigned int detType, // Where we are... (&&& do we need this?)
32  double cotbetaBinWidth, // cot(beta) : bin width,
33  double cotbetaLowEdge, // : low endpoint,
34  int cotbetaBins, // : # of bins
35  double cotalphaBinWidth, // cot(alpha): bin width,
36  double cotalphaLowEdge, // : low endpoint,
37  int cotalphaBins); // : # of bins
38  //int qbinWidth,
39  //int qbins )
40 
41  //--- Constructor to use when reading the histograms from a file (e.g. when
42  // inside a running FastSim job). We get the histograms from a
43  // ROOT file, and we do *not* own them. But we do own the
44  // generators.
45  //
46  PixelResolutionHistograms(std::string filename, // ROOT file for histograms
47  std::string rootdir = "", // ROOT dir, "" if none
48  int detType = -1, // default: read from ROOT file.
49  bool ignore_multi = false, // Forward Big is always single
50  bool ignore_single = false, // Edge does not need single pixels
51  bool ignore_qBin = false); // qBin histograms not used right now (future expansion)
52 
53  //--- Destructor (virtual, just in case)
55 
56  //--- Status after construction (esp.loading from file). Non-zero if there
57  // were problems.
58  inline int status() { return status_; }
59 
60  //--- Fill one entry in one resolution histogram. Use when making histograms.
61  int Fill(double dx,
62  double dy, // the difference wrt true hit
63  double cotalpha,
64  double cotbeta, // cotangent of local angles
65  int qbin, // Qbin = category for how much charge we have
66  int nxpix,
67  int nypix); // length of cluster along x,y (only care if ==1 or not)
68 
69  //--- Get generators, for resolution in X and Y. Use in FastSim.
70  const SimpleHistogramGenerator* getGeneratorX(double cotalpha, double cotbeta, int qbin, bool singlex);
71 
72  const SimpleHistogramGenerator* getGeneratorY(double cotalpha, double cotbeta, int qbin, bool singley);
73 
74 private:
75  // Do we own the histograms, or not?
77 
78  // Where we are.
79  unsigned int detType_; // 1 for barrel, 0 for forward /// May not need this?
80 
81  // Resolution binning
89  int qbins_;
90 
91  // The dummy histogram to hold the binning, and the two cached axes.
93  TAxis* cotbetaAxis_;
94  TAxis* cotalphaAxis_;
95 
96  // Resolution histograms. I (Petar) tried to dynamically allocate
97  // these histograms, but all possible implementations were somewhat
98  // complicated, which would make the code harder to understand,
99  // debug, and thus support in the long term. Since we are here only
100  // booking pointers of histograms, we will instead book larger
101  // matrices, and leave them partially empty. But who cares -- the
102  // wasted memory of a few hundred null pointers is negligible.
103  //
104  // The constructor will then fill only the first cotbetaBins_ x
105  // cotalphaBins_ x qbinBins_ histograms in the matrix, and we'll
106  // ignore the rest.
107  //
113 
114  // File with histograms to load.
115  std::unique_ptr<TFile> file_;
116 
117  // Status of loading. Check if there were errors.
118  int status_;
119 
120  // Identical binning and parameterization for FastSim generators.
126 };
127 #endif
PixelResolutionHistograms::qbinWidth_
int qbinWidth_
Definition: PixelResolutionHistograms.h:88
PixelResolutionHistograms::~PixelResolutionHistograms
virtual ~PixelResolutionHistograms()
Definition: PixelResolutionHistograms.cc:431
PixelResolutionHistograms::cotbetaBins_
int cotbetaBins_
Definition: PixelResolutionHistograms.h:84
PixelResolutionHistograms::PixelResolutionHistograms
PixelResolutionHistograms(std::string filename, std::string rootdir, std::string descTitle, unsigned int detType, double cotbetaBinWidth, double cotbetaLowEdge, int cotbetaBins, double cotalphaBinWidth, double cotalphaLowEdge, int cotalphaBins)
Definition: PixelResolutionHistograms.cc:62
PixelResolutionHistograms::status_
int status_
Definition: PixelResolutionHistograms.h:118
QBIN_HIST_MAX
static constexpr unsigned int QBIN_HIST_MAX
Definition: PixelResolutionHistograms.h:20
PixelResolutionHistograms::qbins_
int qbins_
Definition: PixelResolutionHistograms.h:89
PixelResolutionHistograms::resSinglePixelXGen_
SimpleHistogramGenerator * resSinglePixelXGen_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX]
Definition: PixelResolutionHistograms.h:122
COTBETA_HIST_MAX
static constexpr unsigned int COTBETA_HIST_MAX
Definition: PixelResolutionHistograms.h:18
PixelResolutionHistograms::binningHisto_
TH2F * binningHisto_
Definition: PixelResolutionHistograms.h:92
PixelResolutionHistograms::qbinGen_
SimpleHistogramGenerator * qbinGen_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX]
Definition: PixelResolutionHistograms.h:125
PixelResolutionHistograms::cotalphaBinWidth_
double cotalphaBinWidth_
Definition: PixelResolutionHistograms.h:85
PixelResolutionHistograms::cotbetaLowEdge_
double cotbetaLowEdge_
Definition: PixelResolutionHistograms.h:83
PixelResolutionHistograms::getGeneratorX
const SimpleHistogramGenerator * getGeneratorX(double cotalpha, double cotbeta, int qbin, bool singlex)
Definition: PixelResolutionHistograms.cc:500
PixelResolutionHistograms::cotalphaLowEdge_
double cotalphaLowEdge_
Definition: PixelResolutionHistograms.h:86
PixelResolutionHistograms::getGeneratorY
const SimpleHistogramGenerator * getGeneratorY(double cotalpha, double cotbeta, int qbin, bool singley)
Definition: PixelResolutionHistograms.cc:539
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
PixelResolutionHistograms::resMultiPixelYGen_
SimpleHistogramGenerator * resMultiPixelYGen_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX][QBIN_HIST_MAX]
Definition: PixelResolutionHistograms.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PixelResolutionHistograms::resMultiPixelYHist_
TH1F * resMultiPixelYHist_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX][QBIN_HIST_MAX]
Definition: PixelResolutionHistograms.h:110
PixelResolutionHistograms::cotalphaBins_
int cotalphaBins_
Definition: PixelResolutionHistograms.h:87
PixelResolutionHistograms::qbinHist_
TH1F * qbinHist_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX]
Definition: PixelResolutionHistograms.h:112
SimpleHistogramGenerator
Definition: SimpleHistogramGenerator.h:21
PVValHelper::dy
Definition: PVValidationHelpers.h:49
PixelResolutionHistograms::resMultiPixelXGen_
SimpleHistogramGenerator * resMultiPixelXGen_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX][QBIN_HIST_MAX]
Definition: PixelResolutionHistograms.h:121
PixelResolutionHistograms::detType_
unsigned int detType_
Definition: PixelResolutionHistograms.h:79
PixelResolutionHistograms
Definition: PixelResolutionHistograms.h:22
PixelResolutionHistograms::resSinglePixelYHist_
TH1F * resSinglePixelYHist_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX]
Definition: PixelResolutionHistograms.h:111
PixelResolutionHistograms::status
int status()
Definition: PixelResolutionHistograms.h:58
PixelResolutionHistograms::cotalphaAxis_
TAxis * cotalphaAxis_
Definition: PixelResolutionHistograms.h:94
PixelResolutionHistograms::resSinglePixelXHist_
TH1F * resSinglePixelXHist_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX]
Definition: PixelResolutionHistograms.h:109
PixelResolutionHistograms::weOwnHistograms_
bool weOwnHistograms_
Definition: PixelResolutionHistograms.h:76
PixelResolutionHistograms::cotbetaAxis_
TAxis * cotbetaAxis_
Definition: PixelResolutionHistograms.h:93
PixelResolutionHistograms::file_
std::unique_ptr< TFile > file_
Definition: PixelResolutionHistograms.h:115
PixelResolutionHistograms::resMultiPixelXHist_
TH1F * resMultiPixelXHist_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX][QBIN_HIST_MAX]
Definition: PixelResolutionHistograms.h:108
PixelResolutionHistograms::resSinglePixelYGen_
SimpleHistogramGenerator * resSinglePixelYGen_[COTBETA_HIST_MAX][COTALPHA_HIST_MAX]
Definition: PixelResolutionHistograms.h:124
PixelResolutionHistograms::cotbetaBinWidth_
double cotbetaBinWidth_
Definition: PixelResolutionHistograms.h:82
PVValHelper::dx
Definition: PVValidationHelpers.h:48
PixelResolutionHistograms::Fill
int Fill(double dx, double dy, double cotalpha, double cotbeta, int qbin, int nxpix, int nypix)
Definition: PixelResolutionHistograms.cc:473
COTALPHA_HIST_MAX
static constexpr unsigned int COTALPHA_HIST_MAX
Definition: PixelResolutionHistograms.h:19
RandomEngineAndDistribution
Definition: RandomEngineAndDistribution.h:18