CMS 3D CMS Logo

CSCValHists.h

Go to the documentation of this file.
00001 #ifndef RecoLocalMuon_CSCValHists_H
00002 #define RecoLocalMuon_CSCValHists_H
00003 
00004 
00014 // system include files
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 using namespace std;
00035 
00036 class CSCValHists{
00037 
00038   public:
00039 
00040   // constructor
00041   CSCValHists();
00042 
00043   // destructor
00044   ~CSCValHists();
00045 
00046     // write histograms the theFile
00047   void writeHists(TFile* theFile);
00048 
00049   // write trees to theFile
00050   void writeTrees(TFile* theFile);
00051 
00052   // setup trees
00053   void setupTrees();
00054 
00055   // fill the global rechit position tree (this needs work!)  
00056   void fillRechitTree(float x, float y, float gx, float gy,
00057                       int en, int st, int ri, int ch, int la);
00058 
00059   // fill the global segment position tree
00060   void fillSegmentTree(float x, float y, float gx, float gy,
00061                        int en, int st, int ri, int ch);
00062 
00063   // insert any TH1 into the big map
00064   void insertPlot(TH1* thePlot, string name, string folder);
00065 
00066   // calib hists are special because they are constants stored in a histogram, 1 per bin
00067   void fillCalibHist(float x, string name, string title, int bins, float xmin, float xmax,
00068                      int bin, string folder);
00069 
00070   // fill 1D histogram 
00071   void fill1DHist(float x, string name, string title,
00072                   int bins, float xmin, float xmax, string folder);
00073 
00074   // fill 2D histogram
00075   void fill2DHist(float x, float y, string name, string title,
00076                   int binsx, float xmin, float xmax,
00077                   int binsy, float ymin, float ymax, string folder);
00078 
00079   // fill 1D histogram
00080   // a histogram is created for every chamber type
00081   void fill1DHistByType(float x, string name, string title, CSCDetId id,
00082                         int bins, float xmin, float xmax, string folder);
00083 
00084   // fill 2D histogram
00085   // a histogram is created for every chamber type
00086   void fill2DHistByType(float x, float y, string name, string title, CSCDetId id,
00087                         int binsx, float xmin, float xmax,
00088                         int binsy, float ymin, float ymax, string folder);
00089 
00090   // fill 2D histogram
00091   // a histogram is created for every station
00092   void fill2DHistByStation(float x, float y, string name, string title, CSCDetId id,
00093                            int binsx, float xmin, float xmax,
00094                            int binsy, float ymin, float ymax, string folder);
00095 
00096   // fill 1D histogram
00097   // a histogram is created for every chamber
00098   void fill1DHistByChamber(float x, string name, string title, CSCDetId id,
00099                            int bins, float xmin, float xmax, string folder);
00100 
00101   // fill 2D histogram
00102   // a histogram is created for every chamber
00103   void fill2DHistByChamber(float x, float y, string name, string title, CSCDetId id,
00104                            int binsx, float xmin, float xmax,
00105                            int binsy, float ymin, float ymax, string folder);
00106 
00107   // fill 1D histogram
00108   // a histogram is created for every layer in every chamber
00109   void fill1DHistByLayer(float x, string name, string title, CSCDetId id,
00110                          int bins, float xmin, float xmax, string folder);
00111 
00112   // fill 2D histogram
00113   // a histogram is created for every layer in every chamber
00114   void fill2DHistByLayer(float x, float y, string name, string title, CSCDetId id,
00115                          int binsx, float xmin, float xmax,
00116                          int binsy, float ymin, float ymax, string folder);
00117 
00118 
00119   // make a profile histogram
00120   void fillProfile(float x, float y, string name, string title, 
00121                    int binsx, float xmin, float xmax,
00122                    float ymin, float ymax, string folder);
00123 
00124   // make a profile histogram
00125   // one will be made for every chamber type
00126   void fillProfileByType(float x, float y, string name, string title, CSCDetId id,
00127                          int binsx, float xmin, float xmax,
00128                          float ymin, float ymax, string folder);
00129 
00130   // make a profile histogram
00131   // one will be made for every chamber
00132   void fillProfileByChamber(float x, float y, string name, string title, CSCDetId id,
00133                             int binsx, float xmin, float xmax,
00134                             float ymin, float ymax, string folder);
00135 
00136   // make a 2D profile histogram (usefull for summary plots)
00137   void fill2DProfile(float x, float y, float z, string name, string title, 
00138                      int binsx, float xmin, float xmax,
00139                      int binsy, float ymin, float ymax,
00140                      float zmin, float zmax, string folder);
00141 
00142   protected:
00143 
00144   private:
00145 
00146   // map to hold histograms
00147   map<string,pair<TH1*,string> > theMap;
00148 
00149   // A struct for creating a Tree/Branch of position info
00150   struct posRecord {
00151     int endcap;
00152     int station;
00153     int ring;
00154     int chamber;
00155     int layer;
00156     float localx;
00157     float localy;
00158     float globalx;
00159     float globaly;
00160   } rHpos, segpos;
00161 
00162   // The root tree
00163   TTree *rHTree;
00164   TTree *segTree;
00165 
00166 };
00167 
00168 #endif   

Generated on Tue Jun 9 17:43:52 2009 for CMSSW by  doxygen 1.5.4