00001 #ifndef RecoLocalMuon_CSCValHists_H
00002 #define RecoLocalMuon_CSCValHists_H
00003
00004
00014
00015 #include <memory>
00016 #include <iostream>
00017 #include <vector>
00018 #include <map>
00019 #include <string>
00020 #include <sstream>
00021 #include <iomanip>
00022 #include <fstream>
00023 #include <cmath>
00024
00025 #include "TH1F.h"
00026 #include "TH2F.h"
00027 #include "TH3F.h"
00028 #include "TProfile.h"
00029 #include "TProfile2D.h"
00030 #include "TFile.h"
00031 #include "TTree.h"
00032 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00033
00034
00035
00036 class CSCValHists{
00037
00038 public:
00039
00040
00041 CSCValHists();
00042
00043
00044 ~CSCValHists();
00045
00046
00047 void writeHists(TFile* theFile);
00048
00049
00050 void writeTrees(TFile* theFile);
00051
00052
00053 void setupTrees();
00054
00055
00056 void fillRechitTree(float x, float y, float gx, float gy,
00057 int en, int st, int ri, int ch, int la);
00058
00059
00060 void fillSegmentTree(float x, float y, float gx, float gy,
00061 int en, int st, int ri, int ch);
00062
00063
00064 void insertPlot(TH1* thePlot, std::string name, std::string folder);
00065
00066
00067 void fillCalibHist(float x, std::string name, std::string title, int bins, float xmin, float xmax,
00068 int bin, std::string folder);
00069
00070
00071 void fill1DHist(float x, std::string name, std::string title,
00072 int bins, float xmin, float xmax, std::string folder);
00073
00074
00075 void fill2DHist(float x, float y, std::string name, std::string title,
00076 int binsx, float xmin, float xmax,
00077 int binsy, float ymin, float ymax, std::string folder);
00078
00079
00080
00081 void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id,
00082 int bins, float xmin, float xmax, std::string folder);
00083
00084
00085
00086 void fill2DHistByType(float x, float y, std::string name, std::string title, CSCDetId id,
00087 int binsx, float xmin, float xmax,
00088 int binsy, float ymin, float ymax, std::string folder);
00089
00090
00091
00092 void fill1DHistByCrate(float x, std::string name, std::string title, CSCDetId id,
00093 int bins, float xmin, float xmax, std::string folder);
00094
00095
00096
00097 void fill2DHistByCrate(float x, float y, std::string name, std::string title, CSCDetId id,
00098 int binsx, float xmin, float xmax,
00099 int binsy, float ymin, float ymax, std::string folder);
00100
00101
00102
00103 void fill1DHistByStation(float x, std::string name, std::string title, CSCDetId id,
00104 int bins, float xmin, float xmax, std::string folder);
00105
00106
00107
00108
00109 void fill2DHistByStation(float x, float y, std::string name, std::string title, CSCDetId id,
00110 int binsx, float xmin, float xmax,
00111 int binsy, float ymin, float ymax, std::string folder);
00112
00113
00114
00115 void fill1DHistByChamber(float x, std::string name, std::string title, CSCDetId id,
00116 int bins, float xmin, float xmax, std::string folder);
00117
00118
00119
00120 void fill2DHistByChamber(float x, float y, std::string name, std::string title, CSCDetId id,
00121 int binsx, float xmin, float xmax,
00122 int binsy, float ymin, float ymax, std::string folder);
00123
00124
00125
00126 void fill2DHistByEvent(int run, int event, float x, std::string name, std::string title, CSCDetId id, std::string folder);
00127
00128
00129
00130 void fill2DHist(float z, std::string name, std::string title, CSCDetId id, std::string folder);
00131
00132
00133
00134 void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id,
00135 int bins, float xmin, float xmax, std::string folder);
00136
00137
00138
00139 void fill2DHistByLayer(float x, float y, std::string name, std::string title, CSCDetId id,
00140 int binsx, float xmin, float xmax,
00141 int binsy, float ymin, float ymax, std::string folder);
00142
00143
00144
00145 void fillProfile(float x, float y, std::string name, std::string title,
00146 int binsx, float xmin, float xmax,
00147 float ymin, float ymax, std::string folder);
00148
00149
00150
00151 void fillProfileByType(float x, float y, std::string name, std::string title, CSCDetId id,
00152 int binsx, float xmin, float xmax,
00153 float ymin, float ymax, std::string folder);
00154
00155
00156
00157 void fillProfileByChamber(float x, float y, std::string name, std::string title, CSCDetId id,
00158 int binsx, float xmin, float xmax,
00159 float ymin, float ymax, std::string folder);
00160
00161
00162 void fill2DProfile(float x, float y, float z, std::string name, std::string title,
00163 int binsx, float xmin, float xmax,
00164 int binsy, float ymin, float ymax,
00165 float zmin, float zmax, std::string folder);
00166
00167
00168 int crate_lookup(CSCDetId id);
00169
00170 protected:
00171
00172 private:
00173
00174
00175 std::map<std::string,std::pair<TH1*,std::string> > theMap;
00176
00177
00178 struct posRecord {
00179 int endcap;
00180 int station;
00181 int ring;
00182 int chamber;
00183 int layer;
00184 float localx;
00185 float localy;
00186 float globalx;
00187 float globaly;
00188 } rHpos, segpos;
00189
00190
00191 TTree *rHTree;
00192 TTree *segTree;
00193
00194 };
00195
00196 #endif