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