Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-05 22:25:52

0001 // -*- C++ -*-
0002 //
0003 // Package:   EcalMipGraphs
0004 // Class:     EcalMipGraphs
0005 //
0006 /**\class EcalMipGraphs EcalMipGraphs.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Seth COOPER
0015 //         Created:  Th Nov 22 5:46:22 CEST 2007
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 #include <vector>
0022 #include <map>
0023 #include <set>
0024 #include <string>
0025 
0026 // user include files
0027 #include "FWCore/Framework/interface/Frameworkfwd.h"
0028 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0029 #include "FWCore/Framework/interface/Event.h"
0030 #include "FWCore/Framework/interface/EventSetup.h"
0031 #include "FWCore/Framework/interface/MakerMacros.h"
0032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0033 #include "FWCore/ServiceRegistry/interface/Service.h"
0034 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0035 #include "Geometry/EcalMapping/interface/EcalMappingRcd.h"
0036 
0037 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0038 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0039 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0040 #include "DataFormats/DetId/interface/DetId.h"
0041 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0042 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
0043 
0044 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
0045 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0046 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0047 
0048 #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h"
0049 
0050 #include "TFile.h"
0051 #include "TH1F.h"
0052 #include "TGraph.h"
0053 #include "TTree.h"
0054 
0055 //
0056 // class declaration
0057 //
0058 
0059 class EcalMipGraphs : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0060 public:
0061   explicit EcalMipGraphs(const edm::ParameterSet&);
0062   ~EcalMipGraphs() override;
0063 
0064 private:
0065   void beginRun(edm::Run const&, edm::EventSetup const&) override;
0066   void endRun(edm::Run const&, edm::EventSetup const&) override;
0067   void analyze(edm::Event const&, edm::EventSetup const&) override;
0068   void endJob() override;
0069   std::string intToString(int num);
0070   std::string floatToString(float num);
0071   void writeGraphs();
0072   void initHists(int);
0073   void selectHits(edm::Handle<EcalRecHitCollection> hits, int ievt);
0074   TGraph* selectDigi(DetId det, int ievt);
0075   int getEEIndex(EcalElectronicsId elecId);
0076 
0077   // ----------member data ---------------------------
0078 
0079   const edm::InputTag EBRecHitCollection_;
0080   const edm::InputTag EERecHitCollection_;
0081   const edm::InputTag EBDigis_;
0082   const edm::InputTag EEDigis_;
0083   const edm::InputTag headerProducer_;
0084 
0085   edm::Handle<EBDigiCollection> EBdigisHandle;
0086   edm::Handle<EEDigiCollection> EEdigisHandle;
0087 
0088   const edm::EDGetTokenT<EcalRawDataCollection> rawDataToken_;
0089   const edm::EDGetTokenT<EcalRecHitCollection> ebRecHitToken_;
0090   const edm::EDGetTokenT<EcalRecHitCollection> eeRecHitToken_;
0091   const edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0092   const edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0093 
0094   const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> ecalMappingToken_;
0095   const edm::ESGetToken<CaloTopology, CaloTopologyRecord> topologyToken_;
0096 
0097   int runNum_;
0098   const int side_;
0099   const double threshold_;
0100   const double minTimingAmp_;
0101 
0102   std::set<EBDetId> listEBChannels;
0103   std::set<EEDetId> listEEChannels;
0104 
0105   int abscissa[10];
0106   int ordinate[10];
0107 
0108   static float gainRatio[3];
0109   static edm::Service<TFileService> fileService;
0110 
0111   std::vector<std::string>* names;
0112   std::vector<int> maskedChannels_;
0113   std::vector<int> maskedFEDs_;
0114   std::vector<int> seedCrys_;
0115   std::vector<std::string> maskedEBs_;
0116   std::map<int, TH1F*> FEDsAndTimingHists_;
0117   std::map<int, float> crysAndAmplitudesMap_;
0118   std::map<int, EcalDCCHeaderBlock> FEDsAndDCCHeaders_;
0119   std::map<std::string, int> seedFrequencyMap_;
0120 
0121   TH1F* allFedsTimingHist_;
0122 
0123   TFile* file_;
0124   TTree* canvasNames_;
0125   EcalFedMap* fedMap_;
0126   const EcalElectronicsMapping* ecalElectronicsMap_;
0127   const CaloTopology* caloTopo_;
0128 
0129   int naiveEvtNum_;
0130 };