CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CaloOnlineTools/EcalTools/plugins/EcalDisplaysByEvent.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:   EcalDisplaysByEvent 
00004 // Class:     EcalDisplaysByEvent 
00005 // 
00013 //
00014 // Original Author:  Seth COOPER
00015 //         Created:  Th Aug 28 5:46:22 CEST 2007
00016 // $Id: EcalDisplaysByEvent.h,v 1.3 2010/01/16 14:46:16 hegner Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include <vector>
00024 #include <map>
00025 #include <set>
00026 
00027 // user include files
00028 #include "FWCore/Framework/interface/Frameworkfwd.h"
00029 #include "FWCore/Framework/interface/EDAnalyzer.h"
00030 #include "FWCore/Framework/interface/Event.h"
00031 #include "FWCore/Framework/interface/EventSetup.h"
00032 #include "FWCore/Framework/interface/MakerMacros.h"
00033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00034 #include "FWCore/Framework/interface/ESHandle.h"
00035 #include "FWCore/ServiceRegistry/interface/Service.h"
00036 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00037 #include "Geometry/EcalMapping/interface/EcalMappingRcd.h"
00038 
00039 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00040 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00041 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00042 #include "DataFormats/DetId/interface/DetId.h"
00043 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00044 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
00045 
00046 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
00047 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00048 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00049 
00050 #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h"
00051 
00052 #include "TFile.h"
00053 #include "TH1F.h"
00054 #include "TH2F.h"
00055 #include "TH3F.h"
00056 #include "TGraph.h"
00057 #include "TTree.h"
00058 #include "TCanvas.h"
00059 
00060 
00061 //
00062 // class declaration
00063 //
00064 
00065 class EcalDisplaysByEvent : public edm::EDAnalyzer {
00066    public:
00067       explicit EcalDisplaysByEvent(const edm::ParameterSet&);
00068       ~EcalDisplaysByEvent();
00069 
00070 
00071    private:
00072       virtual void beginRun(edm::Run const &, edm::EventSetup const &) ;
00073       virtual void analyze(edm::Event const &, edm::EventSetup const &);
00074       virtual void endJob() ;
00075       std::string intToString(int num);
00076       std::string floatToString(float num);
00077       void initHists(int);
00078       void initEvtByEvtHists(int naiveEvtNum_, int ievt);
00079       void deleteEvtByEvtHists();
00080       void initAllEventHistos();
00081       enum Ecal2DHistSubDetType {
00082          EB_FINE        = 0,
00083          EB_COARSE      = 1,
00084          EEM_FINE       = 2,
00085          EEM_COARSE     = 3,
00086          EEP_FINE       = 4,
00087          EEP_COARSE     = 5
00088       };
00089       TH2F* init2DEcalHist(std::string histTypeName, int subDet);
00090       TH3F* init3DEcalHist(std::string histTypeName, int dubDet);
00091       TCanvas* init2DEcalCanvas(std::string canvasName);
00092       void selectHits(edm::Handle<EcalRecHitCollection> hits,
00093           int ievt, edm::ESHandle<CaloTopology> caloTopo);
00094       TGraph* selectDigi(DetId det, int ievt);
00095       int getEEIndex(EcalElectronicsId elecId);
00096       void makeHistos(edm::Handle<EBDigiCollection> ebDigis);
00097       void makeHistos(edm::Handle<EEDigiCollection> eeDigis);
00098       void makeHistos(edm::Handle<EcalRecHitCollection> hits);
00099       void drawHistos();
00100       void drawCanvas(TCanvas* canvas, TH1F* hist1, TH1F* hist2, TH1F* hist3);
00101       void drawCanvas(TCanvas* canvas, TH2F* hist1, TH2F* hist2, TH2F* hist3);
00102       void drawCanvas(TCanvas* canvas, TH3F* hist1, TH3F* hist2, TH3F* hist3);
00103       void drawTimingErrors(TProfile2D* profile);
00104       void drawEELines();
00105 
00106     // ----------member data ---------------------------
00107 
00108   edm::InputTag EBRecHitCollection_;
00109   edm::InputTag EERecHitCollection_;
00110   edm::InputTag EBDigis_;
00111   edm::InputTag EEDigis_;
00112   edm::InputTag headerProducer_;
00113 
00114   edm::Handle<EBDigiCollection> EBdigisHandle;
00115   edm::Handle<EEDigiCollection> EEdigisHandle;
00116 
00117   int runNum_;
00118   int side_;
00119   double threshold_;
00120   double minTimingAmp_;
00121   bool makeDigiGraphs_;
00122   bool makeTimingHistos_;
00123   bool makeEnergyHistos_;
00124   bool makeOccupancyHistos_;
00125   double histRangeMin_;
00126   double histRangeMax_;
00127   double minTimingEnergyEB_;
00128   double minTimingEnergyEE_;
00129 
00130   std::set<EBDetId> listEBChannels;
00131   std::set<EEDetId> listEEChannels;
00132     
00133   int abscissa[10];
00134   int ordinate[10];
00135 
00136   static float gainRatio[3];
00137   static edm::Service<TFileService> fileService;
00138 
00139   std::vector<std::string>* names;
00140   std::vector<std::string>* histoCanvasNamesVector;
00141   std::vector<int> maskedChannels_;
00142   std::vector<int> maskedFEDs_;
00143   std::vector<int> seedCrys_;
00144   std::vector<std::string> maskedEBs_;
00145   std::map<int,TH1F*> FEDsAndTimingHists_;
00146   std::map<int,float> crysAndAmplitudesMap_;
00147   std::map<int,EcalDCCHeaderBlock> FEDsAndDCCHeaders_;
00148   std::map<std::string,int> seedFrequencyMap_;
00149   
00150   TH1F* allFedsTimingHist_;
00151   // For event-by-evet histos
00152   TH1F* timingEB_;
00153   TH1F* timingEEM_;
00154   TH1F* timingEEP_;
00155   TH1F* energyEB_;
00156   TH1F* energyEEM_;
00157   TH1F* energyEEP_;
00158   TH2F* energyMapEB_;
00159   TH2F* energyMapEBcoarse_;
00160   TH2F* energyMapEEM_;
00161   TH2F* energyMapEEMcoarse_;
00162   TH2F* energyMapEEP_;
00163   TH2F* energyMapEEPcoarse_;
00164   TH2F* recHitOccupancyEB_;
00165   TH2F* recHitOccupancyEBcoarse_;
00166   TH2F* recHitOccupancyEEM_;
00167   TH2F* recHitOccupancyEEMcoarse_;
00168   TH2F* recHitOccupancyEEP_;
00169   TH2F* recHitOccupancyEEPcoarse_;
00170   TH2F* digiOccupancyEB_;
00171   TH2F* digiOccupancyEBcoarse_;
00172   TH2F* digiOccupancyEEM_;
00173   TH2F* digiOccupancyEEMcoarse_;
00174   TH2F* digiOccupancyEEP_;
00175   TH2F* digiOccupancyEEPcoarse_;
00176   TH3F* timingMapEBCoarse_;
00177   TH3F* timingMapEEMCoarse_;
00178   TH3F* timingMapEEPCoarse_;
00179   TH3F* timingMapEB_;
00180   TH3F* timingMapEEM_;
00181   TH3F* timingMapEEP_;
00182   TCanvas* timingCanvas_;
00183   TCanvas* energyCanvas_;
00184   TCanvas* energyMapCanvas_;
00185   TCanvas* energyMapCoarseCanvas_;
00186   TCanvas* recHitOccupancyCanvas_;
00187   TCanvas* recHitOccupancyCoarseCanvas_;
00188   TCanvas* digiOccupancyCanvas_;
00189   TCanvas* digiOccupancyCoarseCanvas_;
00190   TCanvas* timingMapCoarseCanvas_;
00191   TCanvas* timingMapCanvas_;
00192 
00193   // For all-event hitos
00194   TH1F* timingEBAll_;
00195   TH1F* timingEEMAll_;
00196   TH1F* timingEEPAll_;
00197   TH1F* energyEBAll_;
00198   TH1F* energyEEMAll_;
00199   TH1F* energyEEPAll_;
00200   TH2F* energyMapEBAll_;
00201   TH2F* energyMapEBcoarseAll_;
00202   TH2F* energyMapEEMAll_;
00203   TH2F* energyMapEEMcoarseAll_;
00204   TH2F* energyMapEEPAll_;
00205   TH2F* energyMapEEPcoarseAll_;
00206   TH2F* recHitOccupancyEBAll_;
00207   TH2F* recHitOccupancyEBcoarseAll_;
00208   TH2F* recHitOccupancyEEMAll_;
00209   TH2F* recHitOccupancyEEMcoarseAll_;
00210   TH2F* recHitOccupancyEEPAll_;
00211   TH2F* recHitOccupancyEEPcoarseAll_;
00212   TH2F* digiOccupancyEBAll_;
00213   TH2F* digiOccupancyEBcoarseAll_;
00214   TH2F* digiOccupancyEEMAll_;
00215   TH2F* digiOccupancyEEMcoarseAll_;
00216   TH2F* digiOccupancyEEPAll_;
00217   TH2F* digiOccupancyEEPcoarseAll_;
00218   TH3F* timingMapEBCoarseAll_;
00219   TH3F* timingMapEEMCoarseAll_;
00220   TH3F* timingMapEEPCoarseAll_;
00221   TH3F* timingMapEBAll_;
00222   TH3F* timingMapEEMAll_;
00223   TH3F* timingMapEEPAll_;
00224   TCanvas* timingCanvasAll_;
00225   TCanvas* energyCanvasAll_;
00226   TCanvas* energyMapCanvasAll_;
00227   TCanvas* energyMapCoarseCanvasAll_;
00228   TCanvas* recHitOccupancyCanvasAll_;
00229   TCanvas* recHitOccupancyCoarseCanvasAll_;
00230   TCanvas* digiOccupancyCanvasAll_;
00231   TCanvas* digiOccupancyCoarseCanvasAll_;
00232   TCanvas* timingMapCoarseCanvasAll_;
00233   TCanvas* timingMapCanvasAll_;
00234   
00235   TTree* canvasNames_;
00236   TTree* histoCanvasNames_;
00237   EcalFedMap* fedMap_;
00238   const EcalElectronicsMapping* ecalElectronicsMap_;
00239  
00240   int naiveEvtNum_; 
00241 };