File indexing completed on 2024-04-06 12:29:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <memory>
0019 #include <utility>
0020
0021
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024
0025 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h"
0026 #include "EcalTPInputAnalyzer.h"
0027
0028 EcalTPInputAnalyzer::EcalTPInputAnalyzer(const edm::ParameterSet &iConfig)
0029 : producer_(iConfig.getParameter<std::string>("Producer")),
0030 ebLabel_(iConfig.getParameter<std::string>("EBLabel")),
0031 eeLabel_(iConfig.getParameter<std::string>("EELabel")),
0032 ebToken_(consumes<EBDigiCollection>(edm::InputTag(producer_, ebLabel_))),
0033 eeToken_(consumes<EEDigiCollection>(edm::InputTag(producer_, eeLabel_))) {
0034 usesResource(TFileService::kSharedResource);
0035
0036 edm::Service<TFileService> fs;
0037 histEndc = fs->make<TH1I>("AdcE", "Adc-s for Endcap", 100, 0., 5000.);
0038 histBar = fs->make<TH1I>("AdcB", "Adc-s for Barrel", 100, 0., 5000.);
0039 ecal_parts_.push_back("Barrel");
0040 ecal_parts_.push_back("Endcap");
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 }
0051
0052
0053
0054
0055
0056
0057 void EcalTPInputAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0058 bool barrel = true;
0059 const edm::Handle<EBDigiCollection> &ebDigis = iEvent.getHandle(ebToken_);
0060 if (!ebDigis.isValid()) {
0061 barrel = false;
0062 edm::LogWarning("EcalTPG") << " Couldnt find Barrel dataframes with Producer:" << producer_
0063 << " and label: " << ebLabel_;
0064 }
0065 bool endcap = true;
0066 const edm::Handle<EEDigiCollection> &eeDigis = iEvent.getHandle(eeToken_);
0067 if (!eeDigis.isValid()) {
0068 endcap = false;
0069 edm::LogWarning("EcalTPG") << " Couldnt find Endcap dataframes with Producer:" << producer_
0070 << " and label: " << eeLabel_;
0071 }
0072
0073 if (barrel) {
0074 const EBDigiCollection *ebdb = ebDigis.product();
0075 for (unsigned int i = 0; i < ebDigis->size(); ++i) {
0076 EBDataFrame ebdf = (*ebdb)[i];
0077 int nrSamples = ebdf.size();
0078
0079 for (int is = 0; is < nrSamples; ++is) {
0080
0081 EcalMGPASample sam = ebdf[is];
0082 histBar->Fill(sam.adc());
0083 }
0084 }
0085 }
0086
0087 if (endcap) {
0088 const EEDigiCollection *eedb = eeDigis.product();
0089 for (unsigned int i = 0; i < eeDigis->size(); ++i) {
0090 EEDataFrame eedf = (*eedb)[i];
0091 int nrSamples = eedf.size();
0092 for (int is = 0; is < nrSamples; ++is) {
0093 EcalMGPASample sam = eedf[is];
0094 histEndc->Fill(sam.adc());
0095 }
0096 }
0097 }
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107 }