CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DQMSourceEleCalib Class Reference
Inheritance diagram for DQMSourceEleCalib:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 DQMSourceEleCalib (const edm::ParameterSet &)
 
 ~DQMSourceEleCalib () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

void fillAroundBarrel (const EcalRecHitCollection *, int, int)
 fills local occupancy graphs More...
 
void fillAroundEndcap (const EcalRecHitCollection *, int, int)
 
DetId findMaxHit (const std::vector< std::pair< DetId, float >> &, const EcalRecHitCollection *, const EcalRecHitCollection *)
 find the MOX More...
 

Private Attributes

MonitorElementElectronsNumber_
 Number of electrons. More...
 
MonitorElementESCoP_
 ESCoP. More...
 
int eventCounter_
 
std::string fileName_
 Output file name if required. More...
 
std::string folderName_
 DQM folder name. More...
 
MonitorElementHitsVsAssociatedHits_
 recHits over associated recHits More...
 
MonitorElementLocalOccupancyEB_
 
MonitorElementLocalOccupancyEE_
 
MonitorElementOccupancyEB_
 Occupancy. More...
 
MonitorElementOccupancyEEM_
 
MonitorElementOccupancyEEP_
 
unsigned int prescaleFactor_
 Monitor every prescaleFactor_ events. More...
 
edm::EDGetTokenT< EcalRecHitCollectionproductMonitoredEB_
 object to monitor More...
 
edm::EDGetTokenT< EcalRecHitCollectionproductMonitoredEE_
 object to monitor More...
 
edm::EDGetTokenT< reco::GsfElectronCollectionproductMonitoredElectrons_
 electrons to monitor More...
 
MonitorElementrecHitsPerElectron_
 Number of recHits per electron. More...
 
bool saveToFile_
 Write to file. More...
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 34 of file DQMSourceEleCalib.cc.

Constructor & Destructor Documentation

◆ DQMSourceEleCalib()

DQMSourceEleCalib::DQMSourceEleCalib ( const edm::ParameterSet ps)

Definition at line 96 of file DQMSourceEleCalib.cc.

References fileName_, folderName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), prescaleFactor_, productMonitoredEB_, productMonitoredEE_, productMonitoredElectrons_, saveToFile_, and AlCaHLTBitMon_QueryRunRegistry::string.

96  : eventCounter_(0) {
97  folderName_ = ps.getUntrackedParameter<std::string>("FolderName", "ALCAStreamEcalSingleEle");
98  productMonitoredEB_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("AlCaStreamEBTag"));
99  productMonitoredEE_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("AlCaStreamEETag"));
100 
101  saveToFile_ = ps.getUntrackedParameter<bool>("SaveToFile", false);
102  fileName_ = ps.getUntrackedParameter<std::string>("FileName", "MonitorAlCaEcalSingleEle.root");
104  consumes<reco::GsfElectronCollection>(ps.getParameter<edm::InputTag>("electronCollection"));
105  prescaleFactor_ = ps.getUntrackedParameter<unsigned int>("prescaleFactor", 1);
106 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string fileName_
Output file name if required.
edm::EDGetTokenT< EcalRecHitCollection > productMonitoredEE_
object to monitor
T getUntrackedParameter(std::string const &, T const &) const
bool saveToFile_
Write to file.
edm::EDGetTokenT< EcalRecHitCollection > productMonitoredEB_
object to monitor
std::string folderName_
DQM folder name.
unsigned int prescaleFactor_
Monitor every prescaleFactor_ events.
edm::EDGetTokenT< reco::GsfElectronCollection > productMonitoredElectrons_
electrons to monitor

◆ ~DQMSourceEleCalib()

DQMSourceEleCalib::~DQMSourceEleCalib ( )
override

Definition at line 108 of file DQMSourceEleCalib.cc.

108 {}

Member Function Documentation

◆ analyze()

void DQMSourceEleCalib::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 133 of file DQMSourceEleCalib.cc.

References edm::SortedCollection< T, SORT >::begin(), EcalBarrel, EcalEndcap, ElectronsNumber_, edm::SortedCollection< T, SORT >::end(), ESCoP_, eventCounter_, dqm::impl::MonitorElement::Fill(), fillAroundBarrel(), fillAroundEndcap(), findMaxHit(), HitsVsAssociatedHits_, l1ctLayer2EG_cff::id, hcalRecHitTable_cff::ieta, EBDetId::ieta(), iEvent, hcalRecHitTable_cff::iphi, EBDetId::iphi(), edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), METSkim_cff::Max, OccupancyEB_, OccupancyEEM_, OccupancyEEP_, edm::Handle< T >::product(), productMonitoredEB_, productMonitoredEE_, productMonitoredElectrons_, recHitsPerElectron_, edm::SortedCollection< T, SORT >::size(), and ecaldqm::zside().

133  {
134  // if (eventCounter_% prescaleFactor_ ) return; //FIXME
135  eventCounter_++;
136  int numberOfHits = 0;
137  int numberOfElectrons = 0;
138  int numberOfAssociatedHits = 0;
139  // reads the recHits
142 
143  iEvent.getByToken(productMonitoredEB_, rhEB);
144  iEvent.getByToken(productMonitoredEE_, rhEE);
145 
147 
148  // reads the electrons
150  iEvent.getByToken(productMonitoredElectrons_, pElectrons);
151 
152  if (pElectrons.isValid()) {
153  ElectronsNumber_->Fill(pElectrons->size() + 0.1);
154  numberOfElectrons = pElectrons->size();
155  for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
156  ESCoP_->Fill(eleIt->eSuperClusterOverP());
157  numberOfAssociatedHits += eleIt->superCluster()->size();
158  DetId Max = findMaxHit(eleIt->superCluster()->hitsAndFractions(), rhEB.product(), rhEE.product());
159  if (!Max.det())
160  continue;
161  if (Max.subdetId() == EcalBarrel) {
162  EBDetId EBMax(Max);
163  fillAroundBarrel(rhEB.product(), EBMax.ieta(), EBMax.iphi());
164  }
165  if (Max.subdetId() == EcalEndcap) {
166  EEDetId EEMax(Max);
167  fillAroundEndcap(rhEE.product(), EEMax.ix(), EEMax.iy());
168  }
169  }
170  } // is valid electron
171 
172  // fill EB histos
173  if (rhEB.isValid()) {
174  numberOfHits += rhEB->size();
175  for (itb = rhEB->begin(); itb != rhEB->end(); ++itb) {
176  EBDetId id(itb->id());
177  OccupancyEB_->Fill(id.iphi(), id.ieta());
178  } // Eb rechits
179  } // is Valid
180  if (rhEE.isValid()) {
181  numberOfHits += rhEE->size();
182  for (itb = rhEE->begin(); itb != rhEE->end(); ++itb) {
183  EEDetId id(itb->id());
184  if (id.zside() > 0) {
185  OccupancyEEP_->Fill(id.ix(), id.iy());
186  } // zside>0
187  else if (id.zside() < 0) {
188  OccupancyEEM_->Fill(id.ix(), id.iy());
189  } // zside<0
190 
191  } // EE reChit
192  } // is Valid
193  if (numberOfElectrons)
194  recHitsPerElectron_->Fill((double)numberOfHits / ((double)numberOfElectrons));
195  if (numberOfHits)
196  HitsVsAssociatedHits_->Fill((double)numberOfAssociatedHits / ((double)numberOfHits));
197 } // end of the analyzer
MonitorElement * ESCoP_
ESCoP.
size_type size() const
T const * product() const
Definition: Handle.h:70
DetId findMaxHit(const std::vector< std::pair< DetId, float >> &, const EcalRecHitCollection *, const EcalRecHitCollection *)
find the MOX
std::vector< EcalRecHit >::const_iterator const_iterator
int zside(DetId const &)
edm::EDGetTokenT< EcalRecHitCollection > productMonitoredEE_
object to monitor
void Fill(long long x)
MonitorElement * OccupancyEEM_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< EcalRecHitCollection > productMonitoredEB_
object to monitor
MonitorElement * HitsVsAssociatedHits_
recHits over associated recHits
const_iterator begin() const
MonitorElement * OccupancyEEP_
void fillAroundEndcap(const EcalRecHitCollection *, int, int)
MonitorElement * recHitsPerElectron_
Number of recHits per electron.
const_iterator end() const
void fillAroundBarrel(const EcalRecHitCollection *, int, int)
fills local occupancy graphs
Definition: DetId.h:17
MonitorElement * OccupancyEB_
Occupancy.
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * ElectronsNumber_
Number of electrons.
edm::EDGetTokenT< reco::GsfElectronCollection > productMonitoredElectrons_
electrons to monitor

◆ bookHistograms()

void DQMSourceEleCalib::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  irun,
edm::EventSetup const &  isetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 111 of file DQMSourceEleCalib.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), ElectronsNumber_, ESCoP_, folderName_, HitsVsAssociatedHits_, LocalOccupancyEB_, LocalOccupancyEE_, OccupancyEB_, OccupancyEEM_, OccupancyEEP_, recHitsPerElectron_, and dqm::implementation::NavigatorBase::setCurrentFolder().

113  {
114  // create and cd into new folder
115  ibooker.setCurrentFolder(folderName_);
116 
117  recHitsPerElectron_ = ibooker.book1D("recHitsPerElectron_", "recHitPerElectron", 200, 0, 200);
118  ElectronsNumber_ = ibooker.book1D("ElectronsNumber_", "electrons in the event", 40, 0, 40);
119  ESCoP_ = ibooker.book1D("ESCoP", "ESCoP", 50, 0, 5);
120 
121  OccupancyEB_ = ibooker.book2D("OccupancyEB_", "OccupancyEB", 360, 1, 361, 171, -85, 86);
122  OccupancyEEP_ = ibooker.book2D("OccupancyEEP_", "Occupancy EE Plus", 100, 1, 101, 100, 1, 101);
123  OccupancyEEM_ = ibooker.book2D("OccupancyEEM_", "Occupancy EE Minus", 100, 1, 101, 100, 1, 101);
124  HitsVsAssociatedHits_ = ibooker.book1D("HitsVsAssociatedHits_", "HitsVsAssociatedHits", 100, 0, 5);
125  LocalOccupancyEB_ = ibooker.book2D("LocalOccupancyEB_", "Local occupancy Barrel", 9, -4, 5, 9, -4, 5);
126  LocalOccupancyEE_ = ibooker.book2D("LocalOccupancyEE_", "Local occupancy Endcap", 9, -4, 5, 9, -4, 5);
127 }
MonitorElement * ESCoP_
ESCoP.
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * LocalOccupancyEE_
MonitorElement * OccupancyEEM_
MonitorElement * HitsVsAssociatedHits_
recHits over associated recHits
std::string folderName_
DQM folder name.
MonitorElement * OccupancyEEP_
MonitorElement * recHitsPerElectron_
Number of recHits per electron.
MonitorElement * OccupancyEB_
Occupancy.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * ElectronsNumber_
Number of electrons.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * LocalOccupancyEB_

◆ fillAroundBarrel()

void DQMSourceEleCalib::fillAroundBarrel ( const EcalRecHitCollection recHits,
int  eta,
int  phi 
)
private

fills local occupancy graphs

Definition at line 239 of file DQMSourceEleCalib.cc.

References PVValHelper::eta, dqm::impl::MonitorElement::Fill(), EBDetId::ieta(), EBDetId::iphi(), LocalOccupancyEB_, phi, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by analyze().

239  {
240  for (EcalRecHitCollection::const_iterator elem = recHits->begin(); elem != recHits->end(); ++elem) {
241  EBDetId elementId = elem->id();
242  LocalOccupancyEB_->Fill(elementId.ieta() - eta, elementId.iphi() - phi, elem->energy());
243  }
244  return;
245 }
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
std::vector< EcalRecHit >::const_iterator const_iterator
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
void Fill(long long x)
MonitorElement * LocalOccupancyEB_

◆ fillAroundEndcap()

void DQMSourceEleCalib::fillAroundEndcap ( const EcalRecHitCollection recHits,
int  ics,
int  ips 
)
private

Definition at line 249 of file DQMSourceEleCalib.cc.

References dqm::impl::MonitorElement::Fill(), Ecal07UnpackerData_cfi::ics, EEDetId::ix(), EEDetId::iy(), LocalOccupancyEE_, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by analyze().

249  {
250  for (EcalRecHitCollection::const_iterator elem = recHits->begin(); elem != recHits->end(); ++elem) {
251  EEDetId elementId = elem->id();
252  LocalOccupancyEE_->Fill(elementId.ix() - ics, elementId.iy() - ips, elem->energy());
253  }
254  return;
255 }
int ix() const
Definition: EEDetId.h:77
MonitorElement * LocalOccupancyEE_
std::vector< EcalRecHit >::const_iterator const_iterator
void Fill(long long x)
int iy() const
Definition: EEDetId.h:83

◆ findMaxHit()

DetId DQMSourceEleCalib::findMaxHit ( const std::vector< std::pair< DetId, float >> &  v1,
const EcalRecHitCollection EBhits,
const EcalRecHitCollection EEhits 
)
private

find the MOX

Definition at line 203 of file DQMSourceEleCalib.cc.

References EcalBarrel, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), MTVHistoProducerAlgoForTrackerBlock_cfi::maxHit, and trackerHitRTTI::vector.

Referenced by analyze().

205  {
206  double currEnergy = 0.;
207  DetId maxHit;
208  for (std::vector<std::pair<DetId, float>>::const_iterator idsIt = v1.begin(); idsIt != v1.end(); ++idsIt) {
209  if (idsIt->first.subdetId() == EcalBarrel) {
211  itrechit = EBhits->find((*idsIt).first);
212  if (itrechit == EBhits->end()) {
213  edm::LogInfo("reading") << "[findMaxHit] rechit not found! ";
214  continue;
215  }
216  // FIXME: wnat to use the fraction i.e. .second??
217  if (itrechit->energy() > currEnergy) {
218  currEnergy = itrechit->energy();
219  maxHit = (*idsIt).first;
220  }
221  } else {
223  itrechit = EEhits->find((*idsIt).first);
224  if (itrechit == EEhits->end()) {
225  edm::LogInfo("reading") << "[findMaxHit] rechit not found! ";
226  continue;
227  }
228 
229  // FIXME: wnat to use the fraction i.e. .second??
230  if (itrechit->energy() > currEnergy) {
231  currEnergy = itrechit->energy();
232  maxHit = (*idsIt).first;
233  }
234  }
235  }
236  return maxHit;
237 }
std::vector< EcalRecHit >::const_iterator const_iterator
const_iterator end() const
Log< level::Info, false > LogInfo
Definition: DetId.h:17
iterator find(key_type k)

Member Data Documentation

◆ ElectronsNumber_

MonitorElement* DQMSourceEleCalib::ElectronsNumber_
private

Number of electrons.

Definition at line 58 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ ESCoP_

MonitorElement* DQMSourceEleCalib::ESCoP_
private

ESCoP.

Definition at line 60 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ eventCounter_

int DQMSourceEleCalib::eventCounter_
private

Definition at line 53 of file DQMSourceEleCalib.cc.

Referenced by analyze().

◆ fileName_

std::string DQMSourceEleCalib::fileName_
private

Output file name if required.

Definition at line 89 of file DQMSourceEleCalib.cc.

Referenced by DQMSourceEleCalib().

◆ folderName_

std::string DQMSourceEleCalib::folderName_
private

DQM folder name.

Definition at line 83 of file DQMSourceEleCalib.cc.

Referenced by bookHistograms(), and DQMSourceEleCalib().

◆ HitsVsAssociatedHits_

MonitorElement* DQMSourceEleCalib::HitsVsAssociatedHits_
private

recHits over associated recHits

Definition at line 69 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ LocalOccupancyEB_

MonitorElement* DQMSourceEleCalib::LocalOccupancyEB_
private

Definition at line 65 of file DQMSourceEleCalib.cc.

Referenced by bookHistograms(), and fillAroundBarrel().

◆ LocalOccupancyEE_

MonitorElement* DQMSourceEleCalib::LocalOccupancyEE_
private

Definition at line 66 of file DQMSourceEleCalib.cc.

Referenced by bookHistograms(), and fillAroundEndcap().

◆ OccupancyEB_

MonitorElement* DQMSourceEleCalib::OccupancyEB_
private

Occupancy.

Definition at line 62 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ OccupancyEEM_

MonitorElement* DQMSourceEleCalib::OccupancyEEM_
private

Definition at line 64 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ OccupancyEEP_

MonitorElement* DQMSourceEleCalib::OccupancyEEP_
private

Definition at line 63 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ prescaleFactor_

unsigned int DQMSourceEleCalib::prescaleFactor_
private

Monitor every prescaleFactor_ events.

Definition at line 80 of file DQMSourceEleCalib.cc.

Referenced by DQMSourceEleCalib().

◆ productMonitoredEB_

edm::EDGetTokenT<EcalRecHitCollection> DQMSourceEleCalib::productMonitoredEB_
private

object to monitor

Definition at line 72 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and DQMSourceEleCalib().

◆ productMonitoredEE_

edm::EDGetTokenT<EcalRecHitCollection> DQMSourceEleCalib::productMonitoredEE_
private

object to monitor

Definition at line 75 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and DQMSourceEleCalib().

◆ productMonitoredElectrons_

edm::EDGetTokenT<reco::GsfElectronCollection> DQMSourceEleCalib::productMonitoredElectrons_
private

electrons to monitor

Definition at line 77 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and DQMSourceEleCalib().

◆ recHitsPerElectron_

MonitorElement* DQMSourceEleCalib::recHitsPerElectron_
private

Number of recHits per electron.

Definition at line 56 of file DQMSourceEleCalib.cc.

Referenced by analyze(), and bookHistograms().

◆ saveToFile_

bool DQMSourceEleCalib::saveToFile_
private

Write to file.

Definition at line 86 of file DQMSourceEleCalib.cc.

Referenced by DQMSourceEleCalib().