CMS 3D CMS Logo

SiPixelPhase1Analyzer.h
Go to the documentation of this file.
1 #ifndef DQM_TRACKERREMAPPER_SIPIXELPHASE1ANALYZER_H
2 #define DQM_TRACKERREMAPPER_SIPIXELPHASE1ANALYZER_H
3 
11 //
12 // Original Author: Pawel Jurgielewicz
13 // Created: Tue, 21 Feb 2017 09:42:19 GMT
14 //
15 //
16 
17 // system include files
18 #include <memory>
19 
20 // #include <iostream>
21 #include <fstream>
22 #include <string>
23 
24 #include <algorithm>
25 
26 #include <vector>
27 #include <map>
28 
29 // user include files
54 
55 #include "TH2.h"
56 #include "TProfile2D.h"
57 #include "TH2Poly.h"
58 #include "TGraph.h"
59 
60 #define CODE_FORWARD(s, d, b) ((unsigned short)((b << 8) + (d << 4) + s))
61 
62 //#define DEBUG_MODE
63 
64 //
65 // class declaration
66 //
67 
69 
70 class SiPixelPhase1Analyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
71 public:
73  ~SiPixelPhase1Analyzer() override;
74 
75  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
76 
77 private:
78  void analyze(const edm::Event&, const edm::EventSetup&) override;
79  void BookHistograms();
80 
81  void BookBarrelHistograms(TDirectory* currentDir, const std::string& currentHistoName);
82  void BookForwardHistograms(TDirectory* currentDir, const std::string& currentHistoName);
83 
84  void BookBins(const TrackerGeometry& theTrackerGeometry, const TrackerTopology* tt);
85  void BookBarrelBins(const TrackerGeometry& theTrackerGeometry, const TrackerTopology* tt);
86  void BookForwardBins(const TrackerGeometry& theTrackerGeometry, const TrackerTopology* tt);
87 
89 
91  const TrackerGeometry& theTrackerGeometry,
92  const TrackerTopology* tt);
93 
94  void FillBarrelBinsAnalyze(const TrackerGeometry& theTrackerGeometry,
95  const TrackerTopology* tt,
96  unsigned rawId,
97  const GlobalPoint& globalPoint);
98  void FillForwardBinsAnalyze(const TrackerGeometry& theTrackerGeometry,
99  const TrackerTopology* tt,
100  unsigned rawId,
101  const GlobalPoint& globalPoint);
102 
103  void FillBarrelBinsRemap(const TrackerGeometry& theTrackerGeometry, const TrackerTopology* tt);
104  void FillForwardBinsRemap(const TrackerGeometry& theTrackerGeometry, const TrackerTopology* tt);
105 
106  // ----------member data ---------------------------
109 
111 
113 
115  std::ofstream debugFile;
116 
118 
120 
121  std::map<uint32_t, TGraph*> bins, binsSummary;
122 
123  std::map<std::string, std::vector<TH2Poly*> > th2PolyBarrel;
124  std::map<std::string, TH2Poly*> th2PolyBarrelSummary;
125 
126 #ifdef DEBUG_MODE
127  std::map<std::string, std::vector<TH2*> > th2PolyBarrelDebug;
128 #endif
129 
130  std::map<std::string, std::vector<TH2Poly*> > pxfTh2PolyForward;
131  std::map<std::string, TH2Poly*> pxfTh2PolyForwardSummary;
132 
133 #ifdef DEBUG_MODE
134  std::map<std::string, std::vector<TH2*> > pxfTh2PolyForwardDebug;
135 #endif
136 
138 
140  mat4 mat[2];
141  unsigned rawId[2];
142  };
143  // used to hold information about elements': ids & matrices which are of the same side, disk and barrel but different panel
144  // to build trapezoidal ring elements
145  std::map<unsigned short, complementaryElements> mapOfComplementaryElements;
146 
147  //Input root file handle;
149 
150  // read input histograms
151  std::vector<unsigned> isBarrelSource;
152  std::vector<std::string> analazedRootFileName;
153  std::vector<std::string> pathToHistograms;
154  std::vector<std::string> baseHistogramName;
155 
156  // temporal functionality
157  void SaveDetectorData(bool isBarrel, unsigned rawId, int shell_hc, int layer_disk, int ladder_blade) {
158  std::ofstream file("det.data", std::ofstream::out);
159 
160  file << isBarrel << "\t" << rawId << "\t" << shell_hc << "\t" << layer_disk << "\t" << ladder_blade << std::endl;
161  }
162 };
163 
164 #endif
Definition: mat4.h:9
void BookForwardBins(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt)
void FillBins(edm::Handle< reco::TrackCollection > *tracks, const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt)
std::vector< std::string > pathToHistograms
std::map< std::string, std::vector< TH2Poly * > > th2PolyBarrel
std::map< uint32_t, TGraph * > binsSummary
std::vector< unsigned > isBarrelSource
void BookBarrelBins(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt)
std::map< std::string, std::vector< TH2Poly * > > pxfTh2PolyForward
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
std::map< unsigned short, complementaryElements > mapOfComplementaryElements
std::map< std::string, TH2Poly * > pxfTh2PolyForwardSummary
edm::EDGetTokenT< reco::TrackCollection > tracksToken
SiPixelPhase1Analyzer(const edm::ParameterSet &)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
void SaveDetectorData(bool isBarrel, unsigned rawId, int shell_hc, int layer_disk, int ladder_blade)
void FillBarrelBinsAnalyze(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt, unsigned rawId, const GlobalPoint &globalPoint)
std::vector< std::string > analazedRootFileName
std::map< uint32_t, TGraph * > bins
void analyze(const edm::Event &, const edm::EventSetup &) override
void BookBarrelHistograms(TDirectory *currentDir, const std::string &currentHistoName)
auto const & tracks
cannot be loose
void SaveDetectorVertices(const TrackerTopology *tt)
void BookBins(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::Service< TFileService > fs
void FillForwardBinsRemap(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt)
void FillForwardBinsAnalyze(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt, unsigned rawId, const GlobalPoint &globalPoint)
std::vector< std::string > baseHistogramName
void FillBarrelBinsRemap(const TrackerGeometry &theTrackerGeometry, const TrackerTopology *tt)
std::map< std::string, TH2Poly * > th2PolyBarrelSummary
void BookForwardHistograms(TDirectory *currentDir, const std::string &currentHistoName)