File indexing completed on 2024-04-06 12:00:04
0001 #ifndef CaloOnlineTools_EcalTools_EcalPedHists_h
0002 #define CaloOnlineTools_EcalTools_EcalPedHists_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/EventSetup.h"
0016 #include "FWCore/Framework/interface/MakerMacros.h"
0017 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0018 #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h"
0019 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h"
0020 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h"
0021 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0022 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
0023 #include "Geometry/EcalMapping/interface/EcalMappingRcd.h"
0024 #include "CaloOnlineTools/EcalTools/interface/EcalFedMap.h"
0025
0026 #include <iostream>
0027 #include <vector>
0028 #include <set>
0029 #include "TFile.h"
0030 #include "TH1.h"
0031 #include "TDirectory.h"
0032
0033 typedef std::map<std::string, TH1F*> stringHistMap;
0034
0035 class EcalPedHists : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0036 public:
0037 EcalPedHists(const edm::ParameterSet& ps);
0038 ~EcalPedHists() override;
0039
0040 protected:
0041 void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0042 void beginRun(edm::Run const&, edm::EventSetup const& c) override;
0043 void endRun(edm::Run const&, edm::EventSetup const& c) override;
0044 void endJob(void) override;
0045
0046 private:
0047 std::string intToString(int num);
0048 void readEBdigis(edm::Handle<EBDigiCollection> digis);
0049 void readEEdigis(edm::Handle<EEDigiCollection> digis);
0050 void initHists(int FED);
0051
0052 int runNum_;
0053 bool inputIsOk_;
0054 bool allFEDsSelected_;
0055 bool histsFilled_;
0056 std::string fileName_;
0057 const edm::InputTag barrelDigiCollection_;
0058 const edm::InputTag endcapDigiCollection_;
0059 const edm::InputTag headerProducer_;
0060 std::vector<int> listChannels_;
0061 std::vector<int> listSamples_;
0062 std::vector<int> listFEDs_;
0063 std::vector<std::string> listEBs_;
0064 std::map<int, stringHistMap> FEDsAndHistMaps_;
0065 std::set<int> theRealFedSet_;
0066 EcalFedMap* fedMap_;
0067 TFile* root_file_;
0068
0069 const edm::EDGetTokenT<EcalRawDataCollection> rawDataToken_;
0070 const edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0071 const edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0072 const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> ecalMappingToken_;
0073
0074 const EcalElectronicsMapping* ecalElectronicsMap_;
0075 };
0076
0077 #endif