CMS 3D CMS Logo

CSCValHists.h
Go to the documentation of this file.
1 #ifndef RecoLocalMuon_CSCValHists_H
2 #define RecoLocalMuon_CSCValHists_H
3 
12 // system include files
13 #include <memory>
14 #include <iostream>
15 #include <vector>
16 #include <map>
17 #include <string>
18 #include <sstream>
19 #include <iomanip>
20 #include <fstream>
21 #include <cmath>
22 
23 #include "TH1F.h"
24 #include "TH2F.h"
25 #include "TH3F.h"
26 #include "TProfile.h"
27 #include "TProfile2D.h"
28 #include "TFile.h"
29 #include "TTree.h"
31 
32 class CSCValHists {
33 public:
34  // constructor
35  CSCValHists();
36 
37  // destructor
38  ~CSCValHists();
39 
40  // write histograms the theFile
41  void writeHists(TFile* theFile);
42 
43  // write trees to theFile
44  void writeTrees(TFile* theFile);
45 
46  // setup trees
47  void setupTrees();
48 
49  // fill the global rechit position tree (this needs work!)
50  void fillRechitTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch, int la);
51 
52  // fill the global segment position tree
53  void fillSegmentTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch);
54 
55  // insert any TH1 into the big map
56  void insertPlot(TH1* thePlot, std::string name, std::string folder);
57 
58  // calib hists are special because they are constants stored in a histogram, 1 per bin
59  void fillCalibHist(
60  float x, std::string name, std::string title, int bins, float xmin, float xmax, int bin, std::string folder);
61 
62  // fill 1D histogram
63  void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder);
64 
65  // fill 2D histogram
66  void fill2DHist(float x,
67  float y,
70  int binsx,
71  float xmin,
72  float xmax,
73  int binsy,
74  float ymin,
75  float ymax,
77 
78  // fill 1D histogram
79  // a histogram is created for every chamber type
80  void fill1DHistByType(
81  float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder);
82 
83  // fill 2D histogram
84  // a histogram is created for every chamber type
85  void fill2DHistByType(float x,
86  float y,
89  CSCDetId id,
90  int binsx,
91  float xmin,
92  float xmax,
93  int binsy,
94  float ymin,
95  float ymax,
97 
98  // fill 1D histogram
99  // a histogram is created for every peripheral crate
100  void fill1DHistByCrate(
101  float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder);
102 
103  // fill 2D histogram
104  // a histogram is created for every peripheral crate
105  void fill2DHistByCrate(float x,
106  float y,
109  CSCDetId id,
110  int binsx,
111  float xmin,
112  float xmax,
113  int binsy,
114  float ymin,
115  float ymax,
117 
118  // fill 2D histogram
119  // a histogram is created for every station
120  void fill1DHistByStation(
121  float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder);
122 
123  // fill 2D histogram
124  // a histogram is created for every station
125  void fill2DHistByStation(float x,
126  float y,
129  CSCDetId id,
130  int binsx,
131  float xmin,
132  float xmax,
133  int binsy,
134  float ymin,
135  float ymax,
137 
138  // fill 1D histogram
139  // a histogram is created for every chamber
140  void fill1DHistByChamber(
141  float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder);
142 
143  // fill 2D histogram
144  // a histogram is created for every chamber
145  void fill2DHistByChamber(float x,
146  float y,
149  CSCDetId id,
150  int binsx,
151  float xmin,
152  float xmax,
153  int binsy,
154  float ymin,
155  float ymax,
157 
158  // fill 2D histogram of entire detector
159  // once per event
160  void fill2DHistByEvent(
162 
163  // fill 2D histogram of entire detector
164  // with a value z for the specified chamber
166 
167  // fill 1D histogram
168  // a histogram is created for every layer in every chamber
169  void fill1DHistByLayer(
170  float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder);
171 
172  // fill 2D histogram
173  // a histogram is created for every layer in every chamber
174  void fill2DHistByLayer(float x,
175  float y,
178  CSCDetId id,
179  int binsx,
180  float xmin,
181  float xmax,
182  int binsy,
183  float ymin,
184  float ymax,
186 
187  // make a profile histogram
188  void fillProfile(float x,
189  float y,
192  int binsx,
193  float xmin,
194  float xmax,
195  float ymin,
196  float ymax,
198 
199  // make a profile histogram
200  // one will be made for every chamber type
201  void fillProfileByType(float x,
202  float y,
205  CSCDetId id,
206  int binsx,
207  float xmin,
208  float xmax,
209  float ymin,
210  float ymax,
212 
213  // make a profile histogram
214  // one will be made for every chamber
215  void fillProfileByChamber(float x,
216  float y,
219  CSCDetId id,
220  int binsx,
221  float xmin,
222  float xmax,
223  float ymin,
224  float ymax,
226 
227  // make a 2D profile histogram (usefull for summary plots)
228  void fill2DProfile(float x,
229  float y,
230  float z,
233  int binsx,
234  float xmin,
235  float xmax,
236  int binsy,
237  float ymin,
238  float ymax,
239  float zmin,
240  float zmax,
242 
243  // look-up which crate this chamber belongs to
244  int crate_lookup(CSCDetId id);
245 
246 protected:
247 private:
248  // map to hold histograms
249  std::map<std::string, std::pair<TH1*, std::string> > theMap;
250 
251  // A struct for creating a Tree/Branch of position info
252  struct posRecord {
253  int endcap;
254  int station;
255  int ring;
256  int chamber;
257  int layer;
258  float localx;
259  float localy;
260  float globalx;
261  float globaly;
262  } rHpos, segpos;
263 
264  // The root tree
265  TTree* rHTree;
266  TTree* segTree;
267 };
268 
269 #endif
DDAxes::y
CSCValHists::fillCalibHist
void fillCalibHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, int bin, std::string folder)
Definition: CSCValHists.cc:82
CSCValHists::fillProfileByType
void fillProfileByType(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:481
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
CSCValHists::setupTrees
void setupTrees()
Definition: CSCValHists.cc:39
CSCValHists::posRecord::endcap
int endcap
Definition: CSCValHists.h:253
CSCValHists::~CSCValHists
~CSCValHists()
Definition: CSCValHists.cc:8
printsummarytable.folder
folder
Definition: printsummarytable.py:7
DDAxes::x
CSCValHists::fill1DHist
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:93
alignmentValidation.binsx
binsx
Definition: alignmentValidation.py:1040
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
CSCValHists::posRecord::globaly
float globaly
Definition: CSCValHists.h:261
CSCValHists::fill1DHistByLayer
void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:401
CSCDetId.h
CSCValHists::segTree
TTree * segTree
Definition: CSCValHists.h:266
CSCValHists::writeTrees
void writeTrees(TFile *theFile)
Definition: CSCValHists.cc:29
CSCValHists::fillProfile
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:461
CSCValHists::writeHists
void writeHists(TFile *theFile)
Definition: CSCValHists.cc:10
CSCValHists::fill2DHistByCrate
void fill2DHistByCrate(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:201
interactiveExample.theFile
theFile
Definition: interactiveExample.py:17
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
CSCValHists::posRecord::ring
int ring
Definition: CSCValHists.h:255
CSCValHists::fillProfileByChamber
void fillProfileByChamber(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:515
CSCValHists::insertPlot
void insertPlot(TH1 *thePlot, std::string name, std::string folder)
Definition: CSCValHists.cc:78
CSCValHists::theMap
std::map< std::string, std::pair< TH1 *, std::string > > theMap
Definition: CSCValHists.h:249
DDAxes::z
CSCValHists
Definition: CSCValHists.h:32
CSCValHists::rHpos
struct CSCValHists::posRecord rHpos
CSCValHists::fill1DHistByType
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:125
CSCValHists::fill2DHistByLayer
void fill2DHistByLayer(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:425
CSCValHists::fill2DHist
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:104
CSCValHists::posRecord::chamber
int chamber
Definition: CSCValHists.h:256
CSCValHists::posRecord::layer
int layer
Definition: CSCValHists.h:257
CSCValHists::rHTree
TTree * rHTree
Definition: CSCValHists.h:265
CSCDetId
Definition: CSCDetId.h:26
CSCValHists::posRecord::station
int station
Definition: CSCValHists.h:254
CSCValHists::posRecord::localx
float localx
Definition: CSCValHists.h:258
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignmentValidation.binsy
binsy
Definition: alignmentValidation.py:1040
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
CSCValHists::fillRechitTree
void fillRechitTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch, int la)
Definition: CSCValHists.cc:50
CSCValHists::fill1DHistByCrate
void fill1DHistByCrate(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:182
CSCValHists::fill2DHistByType
void fill2DHistByType(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:148
writedatasetfile.run
run
Definition: writedatasetfile.py:27
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
CSCValHists::fill1DHistByStation
void fill1DHistByStation(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:231
CSCValHists::fill1DHistByChamber
void fill1DHistByChamber(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:288
CSCValHists::fill2DHistByChamber
void fill2DHistByChamber(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:311
CSCValHists::fill2DProfile
void fill2DProfile(float x, float y, float z, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, float zmin, float zmax, std::string folder)
Definition: CSCValHists.cc:549
CSCValHists::fill2DHistByEvent
void fill2DHistByEvent(int run, int event, float x, std::string name, std::string title, CSCDetId id, std::string folder)
Definition: CSCValHists.cc:345
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CSCValHists::crate_lookup
int crate_lookup(CSCDetId id)
Definition: CSCValHists.cc:575
CSCValHists::posRecord::localy
float localy
Definition: CSCValHists.h:259
CSCValHists::posRecord
Definition: CSCValHists.h:252
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
CSCValHists::fillSegmentTree
void fillSegmentTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch)
Definition: CSCValHists.cc:64
event
Definition: event.py:1
CSCValHists::posRecord::globalx
float globalx
Definition: CSCValHists.h:260
CSCValHists::segpos
struct CSCValHists::posRecord segpos
CSCValHists::CSCValHists
CSCValHists()
Definition: CSCValHists.cc:6
CSCValHists::fill2DHistByStation
void fill2DHistByStation(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:254