CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalDeadCellDeltaRFilter Class Reference

#include <EcalDeadCellDeltaRFilter.cc>

Inheritance diagram for EcalDeadCellDeltaRFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalDeadCellDeltaRFilter (const edm::ParameterSet &)
 
 ~EcalDeadCellDeltaRFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
int dPhiToMETfunc (const std::vector< reco::Jet > &jetTVec, const double &dPhiCutVal, std::vector< reco::Jet > &closeToMETjetsVec)
 
int dRtoMaskedChnsEvtFilterFunc (const std::vector< reco::Jet > &jetTVec, const int &chnStatus, const double &dRCutVal)
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void envSet (const edm::EventSetup &)
 
int etaToBoundary (const std::vector< reco::Jet > &jetTVec)
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
int getChannelStatusMaps ()
 
int isCloseToBadEcalChannel (const reco::Jet &jet, const double &deltaRCut, const int &chnStatus, std::map< double, DetId > &deltaRdetIdMap)
 
void loadEventInfo (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void loadJets (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void loadMET (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 

Private Attributes

double calomet
 
double calometPhi
 
const int chnStatusToBeEvaluated_
 
const std::vector< double > cracksHBHEdef_
 
const std::vector< double > cracksHEHFdef_
 
const bool debug_
 
const bool doCracks_
 
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
 
std::map< DetId, EcalTrigTowerDetIdEcalAllDeadChannelsTTMap
 
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
 
const std::vector< double > EcalDeadCellDeltaRFilterInput_
 
edm::ESHandle< EcalChannelStatusecalStatus
 
edm::EventNumber_t event
 
int evtProcessedCnt
 
edm::ESHandle< CaloGeometrygeometry
 
TH1F * h1_dummy
 
edm::ESHandle< HcalChannelQualityhcalStatus
 
bool isdata
 
bool isPrintedOnce
 
const bool isProd_
 
edm::Handle< edm::View< reco::Jet > > jets
 
const std::vector< double > jetSelCuts_
 
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
 
edm::LuminosityBlockNumber_t ls
 
const bool makeProfileRoot_
 
const int maskedEcalChannelStatusThreshold_
 
edm::Handle< edm::View< reco::MET > > met
 
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
 
double pfmet
 
double pfmetPhi
 
const bool printSkimInfo_
 
TFile * profFile
 
const std::string profileRootName_
 
edm::RunNumber_t run
 
const bool taggingMode_
 
double tcmet
 
double tcmetPhi
 
int totTPFilteredCnt
 
edm::ESHandle< EcalTrigTowerConstituentsMapttMap_
 
const int verbose_
 
double wtdEvtProcessed
 
double wtdTPFiltered
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>=""> Event filtering for RA2 analysis (filtering status is stored in the event)

Definition at line 96 of file EcalDeadCellDeltaRFilter.cc.

Constructor & Destructor Documentation

EcalDeadCellDeltaRFilter::EcalDeadCellDeltaRFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 221 of file EcalDeadCellDeltaRFilter.cc.

References h1_dummy, makeProfileRoot_, profFile, and profileRootName_.

222  : jetToken_ (consumes<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("jetInputTag")))
223  , jetSelCuts_ (iConfig.getParameter<std::vector<double> >("jetSelCuts"))
224 
225  , metToken_ (consumes<edm::View<reco::MET> >(iConfig.getParameter<edm::InputTag>("metInputTag")))
226 
227  , debug_ (iConfig.getUntrackedParameter<bool>("debug",false))
228  , printSkimInfo_ (iConfig.getUntrackedParameter<bool>("printSkimInfo",false))
229 
230  , maskedEcalChannelStatusThreshold_ (iConfig.getParameter<int>("maskedEcalChannelStatusThreshold"))
231  , chnStatusToBeEvaluated_ (iConfig.getParameter<int>("chnStatusToBeEvaluated"))
232 
233  , makeProfileRoot_ (iConfig.getUntrackedParameter<bool>("makeProfileRoot", true))
234  , profileRootName_ (iConfig.getUntrackedParameter<std::string>("profileRootName", "EcalDeadCellDeltaRFilter.root"))
235 
236  , isProd_ (iConfig.getUntrackedParameter<bool>("isProd"))
237  , verbose_ (iConfig.getParameter<int>("verbose"))
238 
239  , doCracks_ (iConfig.getUntrackedParameter<bool>("doCracks"))
240  , cracksHBHEdef_ (iConfig.getParameter<std::vector<double> > ("cracksHBHEdef"))
241  , cracksHEHFdef_ (iConfig.getParameter<std::vector<double> > ("cracksHEHFdef"))
242 
243  , EcalDeadCellDeltaRFilterInput_ (iConfig.getParameter<std::vector<double> >("EcalDeadCellDeltaRFilterInput"))
244 
245  , taggingMode_ (iConfig.getParameter<bool>("taggingMode"))
246 {
247  produces<int> ("deadCellStatus"); produces<int> ("boundaryStatus");
248  produces<bool>();
249 
250  if( makeProfileRoot_ ){
251  profFile = new TFile(profileRootName_.c_str(), "RECREATE");
252  h1_dummy = new TH1F("dummy", "dummy", 500, 0, 500);
253  }
254 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
const std::vector< double > cracksHBHEdef_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const std::vector< double > cracksHEHFdef_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
const std::vector< double > jetSelCuts_
const std::vector< double > EcalDeadCellDeltaRFilterInput_
EcalDeadCellDeltaRFilter::~EcalDeadCellDeltaRFilter ( )
override

Definition at line 256 of file EcalDeadCellDeltaRFilter.cc.

References h1_dummy, makeProfileRoot_, and profFile.

256  {
257  if( makeProfileRoot_ ){
258  profFile->cd();
259 
260  h1_dummy->Write();
261 
262  profFile->Close();
263  delete profFile;
264  }
265 }

Member Function Documentation

void EcalDeadCellDeltaRFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 335 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, and debug_.

335  {
336  if (debug_) std::cout << "beginJob" << std::endl;
337 }
void EcalDeadCellDeltaRFilter::beginLuminosityBlock ( const edm::LuminosityBlock iLSblock,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 362 of file EcalDeadCellDeltaRFilter.cc.

References edm::EventSetup::get(), hcalStatus, and edm::ESHandleBase::isValid().

362  {
363 
364  // needs per-LS access, if used at all
365  iSetup.get<HcalChannelQualityRcd>().get("withTopo",hcalStatus);
366  if( !hcalStatus.isValid() ) throw "Failed to get HCAL channel status!";
367  return;
368 }
T get() const
Definition: EventSetup.h:71
bool isValid() const
Definition: ESHandle.h:44
edm::ESHandle< HcalChannelQuality > hcalStatus
void EcalDeadCellDeltaRFilter::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 345 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, debug_, EcalAllDeadChannelsBitMap, EcalAllDeadChannelsValMap, envSet(), and getChannelStatusMaps().

345  {
346  if (debug_) std::cout << "beginRun" << std::endl;
347 // Channel status might change for each run (data)
348 // Event setup
349  envSet(iSetup);
351  if( debug_) std::cout<< "EcalAllDeadChannelsValMap.size() : "<<EcalAllDeadChannelsValMap.size()<<" EcalAllDeadChannelsBitMap.size() : "<<EcalAllDeadChannelsBitMap.size()<<std::endl;
352  return;
353 }
virtual void envSet(const edm::EventSetup &)
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
int EcalDeadCellDeltaRFilter::dPhiToMETfunc ( const std::vector< reco::Jet > &  jetTVec,
const double &  dPhiCutVal,
std::vector< reco::Jet > &  closeToMETjetsVec 
)
private

Definition at line 391 of file EcalDeadCellDeltaRFilter.cc.

References funct::abs(), reco::deltaPhi(), hiPixelPairStep_cff::deltaPhi, cuy::ii, metsig::jet, and reco::LeafCandidate::phi().

Referenced by filter().

391  {
392 
393  closeToMETjetsVec.clear();
394 
395  double minDphi = 999.0;
396  int minIdx = -1;
397  for(unsigned int ii=0; ii<jetTVec.size(); ii++){
398 
399  const reco::Jet& jet = jetTVec[ii];
400 
401  double deltaPhi = std::abs(reco::deltaPhi( jet.phi(), (*met)[0].phi() ) );
402  if( deltaPhi > dPhiCutVal ) continue;
403 
404  closeToMETjetsVec.push_back(jetTVec[ii]);
405 
406  if( deltaPhi < minDphi ){
407  minDphi = deltaPhi;
408  minIdx = ii;
409  }
410  }
411 
412  if( minIdx == -1 ){} // removing a stupid compiling WARNING that minIdx NOT used.
413 // if( minIdx == -1 ) return 0;
414 // closeToMETjetsVec.push_back(jetTVec[minIdx]);
415 
416  return (int)closeToMETjetsVec.size();
417 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
Base class for all types of Jets.
Definition: Jet.h:20
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ii
Definition: cuy.py:590
double phi() const final
momentum azimuthal angle
int EcalDeadCellDeltaRFilter::dRtoMaskedChnsEvtFilterFunc ( const std::vector< reco::Jet > &  jetTVec,
const int &  chnStatus,
const double &  dRCutVal 
)
private

Definition at line 420 of file EcalDeadCellDeltaRFilter.cc.

References cuy::ii, isCloseToBadEcalChannel(), and metsig::jet.

Referenced by filter().

420  {
421 
422  int isClose = 0;
423 
424  for(unsigned int ii=0; ii<jetTVec.size(); ii++){
425 
426  const reco::Jet& jet = jetTVec[ii];
427 
428  std::map<double, DetId> dummy;
429  int isPerJetClose = isCloseToBadEcalChannel(jet, dRCutVal, chnStatus, dummy);
430 // if( isPerJetClose ){ isClose = 1; break; }
431  if( isPerJetClose ){ isClose ++; }
432  }
433 
434  return isClose;
435 
436 }
Base class for all types of Jets.
Definition: Jet.h:20
int isCloseToBadEcalChannel(const reco::Jet &jet, const double &deltaRCut, const int &chnStatus, std::map< double, DetId > &deltaRdetIdMap)
ii
Definition: cuy.py:590
void EcalDeadCellDeltaRFilter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 340 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, and debug_.

340  {
341  if (debug_) std::cout << "endJob" << std::endl;
342 }
void EcalDeadCellDeltaRFilter::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 356 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, and debug_.

356  {
357  if (debug_) std::cout << "endRun" << std::endl;
358  return;
359 }
void EcalDeadCellDeltaRFilter::envSet ( const edm::EventSetup iSetup)
privatevirtual

Definition at line 267 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, debug_, ecalStatus, edm::EventSetup::get(), and ttMap_.

Referenced by beginRun().

267  {
268 
269  if (debug_) std::cout << "***envSet***" << std::endl;
270 
271  iSetup.get<IdealGeometryRecord>().get(ttMap_);
272 
273  iSetup.get<EcalChannelStatusRcd> ().get(ecalStatus);
274  iSetup.get<CaloGeometryRecord> ().get(geometry);
275 
276  if( !ecalStatus.isValid() ) throw "Failed to get ECAL channel status!";
277  if( !geometry.isValid() ) throw "Failed to get the geometry!";
278 
279 }
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
T get() const
Definition: EventSetup.h:71
edm::ESHandle< EcalChannelStatus > ecalStatus
int EcalDeadCellDeltaRFilter::etaToBoundary ( const std::vector< reco::Jet > &  jetTVec)
private

Definition at line 370 of file EcalDeadCellDeltaRFilter.cc.

References funct::abs(), cracksHBHEdef_, cracksHEHFdef_, and funct::pow().

Referenced by filter().

370  {
371 
372  int isClose = 0;
373 
374  int cntOrder10 = 0;
375  for(unsigned int ij=0; ij<jetTVec.size(); ij++){
376 
377  double recoJetEta = jetTVec[ij].eta();
378 
379  if( std::abs(recoJetEta)>cracksHBHEdef_[0] && std::abs(recoJetEta)<cracksHBHEdef_[1] ) isClose += (cntOrder10*10 + 1);
380  if( std::abs(recoJetEta)>cracksHEHFdef_[0] && std::abs(recoJetEta)<cracksHEHFdef_[1] ) isClose += (cntOrder10*10 + 2);
381 
382  if( isClose/pow(10, cntOrder10) >=3 ) cntOrder10 = isClose/10 + 1;
383  }
384 
385  return isClose;
386 
387 }
const std::vector< double > cracksHBHEdef_
const std::vector< double > cracksHEHFdef_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool EcalDeadCellDeltaRFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 282 of file EcalDeadCellDeltaRFilter.cc.

References funct::abs(), chnStatusToBeEvaluated_, debug_, doCracks_, dPhiToMETfunc(), dRtoMaskedChnsEvtFilterFunc(), EcalDeadCellDeltaRFilterInput_, etaToBoundary(), jets, jetSelCuts_, loadEventInfo(), loadJets(), loadMET(), ls, makeProfileRoot_, met, phi, EnergyCorrector::pt, edm::Event::put(), run, and taggingMode_.

282  {
283 
284  loadEventInfo(iEvent, iSetup);
285  loadJets(iEvent, iSetup);
286  loadMET(iEvent, iSetup);
287 
288 // XXX: In the following, never assign pass to true again
289 // Currently, always true
290  bool pass = true;
291 
292  using namespace edm;
293 
294  std::vector<reco::Jet> seledJets;
295 
296  for( edm::View<reco::Jet>::const_iterator ij = jets->begin(); ij != jets->end(); ij++){
297  if( ij->pt() > jetSelCuts_[0] && std::abs(ij->eta()) < jetSelCuts_[1] ){
298  seledJets.push_back(reco::Jet(*ij));
299  }
300  }
301 
302  if( seledJets.empty() ) return pass;
303 
304  double dPhiToMET = EcalDeadCellDeltaRFilterInput_[0], dRtoDeadCell = EcalDeadCellDeltaRFilterInput_[1];
305 
306  std::vector<reco::Jet> closeToMETjetsVec;
307 
308  int dPhiToMETstatus = dPhiToMETfunc(seledJets, dPhiToMET, closeToMETjetsVec);
309 
310 // Get event filter for simple dR cut
311  int deadCellStatus = dRtoMaskedChnsEvtFilterFunc(closeToMETjetsVec, chnStatusToBeEvaluated_, dRtoDeadCell);
312 
313  int boundaryStatus = etaToBoundary(closeToMETjetsVec);
314 
315  if(debug_ ){
316  printf("\nrun : %8u event : %12llu ls : %8u dPhiToMETstatus : %d deadCellStatus : %d boundaryStatus : %d\n", run, event, ls, dPhiToMETstatus, deadCellStatus, boundaryStatus);
317  printf("met : %6.2f metphi : % 6.3f dPhiToMET : %5.3f dRtoDeadCell : %5.3f\n", (*met)[0].pt(), (*met)[0].phi(), dPhiToMET, dRtoDeadCell);
318  }
319 
320  if( makeProfileRoot_ ){
321 // h1_dummy->Fill(xxx);
322  }
323 
324  iEvent.put(std::make_unique<int>(deadCellStatus), "deadCellStatus");
325  iEvent.put(std::make_unique<int>(boundaryStatus), "boundaryStatus");
326 
327  if( deadCellStatus || (doCracks_ && boundaryStatus) ) pass = false;
328 
329  iEvent.put(std::make_unique<bool>(pass));
330 
331  return taggingMode_ || pass;
332 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
Base class for all types of Jets.
Definition: Jet.h:20
int dPhiToMETfunc(const std::vector< reco::Jet > &jetTVec, const double &dPhiCutVal, std::vector< reco::Jet > &closeToMETjetsVec)
int dRtoMaskedChnsEvtFilterFunc(const std::vector< reco::Jet > &jetTVec, const int &chnStatus, const double &dRCutVal)
void loadMET(const edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::Handle< edm::View< reco::MET > > met
edm::LuminosityBlockNumber_t ls
void loadEventInfo(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int etaToBoundary(const std::vector< reco::Jet > &jetTVec)
void loadJets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const std::vector< double > jetSelCuts_
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::Handle< edm::View< reco::Jet > > jets
const std::vector< double > EcalDeadCellDeltaRFilterInput_
Definition: event.py:1
int EcalDeadCellDeltaRFilter::getChannelStatusMaps ( )
private

Definition at line 476 of file EcalDeadCellDeltaRFilter.cc.

References DEFINE_FWK_MODULE, EcalAllDeadChannelsBitMap, EcalAllDeadChannelsTTMap, EcalAllDeadChannelsValMap, ecalStatus, PVValHelper::eta, EBDetId::ETAPHIMODE, CaloSubdetectorGeometry::getGeometry(), maskedEcalChannelStatusThreshold_, phi, mps_update::status, theta(), EcalTrigTowerConstituentsMap::towerOf(), ttMap_, EBDetId::validDetId(), EEDetId::validDetId(), and EEDetId::XYMODE.

Referenced by beginRun().

476  {
477 
479 
480 // Loop over EB ...
481  for( int ieta=-85; ieta<=85; ieta++ ){
482  for( int iphi=0; iphi<=360; iphi++ ){
483  if(! EBDetId::validDetId( ieta, iphi ) ) continue;
484 
485  const EBDetId detid = EBDetId( ieta, iphi, EBDetId::ETAPHIMODE );
486  EcalChannelStatus::const_iterator chit = ecalStatus->find( detid );
487 // refer https://twiki.cern.ch/twiki/bin/viewauth/CMS/EcalChannelStatus
488  int status = ( chit != ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
489 
490  const CaloSubdetectorGeometry* subGeom = geometry->getSubdetectorGeometry (detid);
491  auto cellGeom = subGeom->getGeometry (detid);
492  double eta = cellGeom->getPosition ().eta ();
493  double phi = cellGeom->getPosition ().phi ();
494  double theta = cellGeom->getPosition().theta();
495 
496  if(status >= maskedEcalChannelStatusThreshold_){
497  std::vector<double> valVec; std::vector<int> bitVec;
498  valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
499  bitVec.push_back(1); bitVec.push_back(ieta); bitVec.push_back(iphi); bitVec.push_back(status);
500  EcalAllDeadChannelsValMap.insert( std::make_pair(detid, valVec) );
501  EcalAllDeadChannelsBitMap.insert( std::make_pair(detid, bitVec) );
502  }
503  } // end loop iphi
504  } // end loop ieta
505 
506 // Loop over EE detid
507  for( int ix=0; ix<=100; ix++ ){
508  for( int iy=0; iy<=100; iy++ ){
509  for( int iz=-1; iz<=1; iz++ ){
510  if(iz==0) continue;
511  if(! EEDetId::validDetId( ix, iy, iz ) ) continue;
512 
513  const EEDetId detid = EEDetId( ix, iy, iz, EEDetId::XYMODE );
514  EcalChannelStatus::const_iterator chit = ecalStatus->find( detid );
515  int status = ( chit != ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
516 
517  const CaloSubdetectorGeometry* subGeom = geometry->getSubdetectorGeometry (detid);
518  auto cellGeom = subGeom->getGeometry (detid);
519  double eta = cellGeom->getPosition ().eta () ;
520  double phi = cellGeom->getPosition ().phi () ;
521  double theta = cellGeom->getPosition().theta();
522 
523  if(status >= maskedEcalChannelStatusThreshold_){
524  std::vector<double> valVec; std::vector<int> bitVec;
525  valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
526  bitVec.push_back(2); bitVec.push_back(ix); bitVec.push_back(iy); bitVec.push_back(iz); bitVec.push_back(status);
527  EcalAllDeadChannelsValMap.insert( std::make_pair(detid, valVec) );
528  EcalAllDeadChannelsBitMap.insert( std::make_pair(detid, bitVec) );
529  }
530  } // end loop iz
531  } // end loop iy
532  } // end loop ix
533 
534  EcalAllDeadChannelsTTMap.clear();
535  std::map<DetId, std::vector<int> >::iterator bitItor;
536  for(bitItor = EcalAllDeadChannelsBitMap.begin(); bitItor != EcalAllDeadChannelsBitMap.end(); bitItor++){
537  const DetId id = bitItor->first;
538  EcalTrigTowerDetId ttDetId = ttMap_->towerOf(id);
539  EcalAllDeadChannelsTTMap.insert(std::make_pair(id, ttDetId) );
540  }
541 
542  return 1;
543 }
static const int XYMODE
Definition: EEDetId.h:335
std::map< DetId, EcalTrigTowerDetId > EcalAllDeadChannelsTTMap
Geom::Theta< T > theta() const
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
static const int ETAPHIMODE
Definition: EBDetId.h:158
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
Definition: DetId.h:18
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
std::vector< Item >::const_iterator const_iterator
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
edm::ESHandle< EcalChannelStatus > ecalStatus
int EcalDeadCellDeltaRFilter::isCloseToBadEcalChannel ( const reco::Jet jet,
const double &  deltaRCut,
const int &  chnStatus,
std::map< double, DetId > &  deltaRdetIdMap 
)
private

Definition at line 439 of file EcalDeadCellDeltaRFilter.cc.

References funct::abs(), gather_cfg::cout, reco::deltaR(), EcalAllDeadChannelsBitMap, EcalAllDeadChannelsValMap, PVValHelper::eta, reco::LeafCandidate::eta(), reco::btau::jetEta, reco::btau::jetPhi, phi, reco::LeafCandidate::phi(), and mps_update::status.

Referenced by dRtoMaskedChnsEvtFilterFunc().

439  {
440 
441  double jetEta = jet.eta(), jetPhi = jet.phi();
442 
443  deltaRdetIdMap.clear();
444 
445  double min_dist = 999;
446  DetId min_detId;
447 
448  std::map<DetId, std::vector<int> >::iterator bitItor;
449  for(bitItor = EcalAllDeadChannelsBitMap.begin(); bitItor != EcalAllDeadChannelsBitMap.end(); bitItor++){
450 
451  DetId maskedDetId = bitItor->first;
452 // int subdet = bitItor->second.front();
453  int status = bitItor->second.back();
454 
455  if( chnStatus >0 && status != chnStatus ) continue;
456  if( chnStatus <0 && status < abs(chnStatus) ) continue;
457 
458  std::map<DetId, std::vector<double> >::iterator valItor = EcalAllDeadChannelsValMap.find(maskedDetId);
459  if( valItor == EcalAllDeadChannelsValMap.end() ){ std::cout<<"Error cannot find maskedDetId in EcalAllDeadChannelsValMap ?!"<<std::endl; continue; }
460 
461  double eta = (valItor->second)[0], phi = (valItor->second)[1];
462 
463  double dist = reco::deltaR(eta, phi, jetEta, jetPhi);
464 
465  if( min_dist > dist ){ min_dist = dist; min_detId = maskedDetId; }
466  }
467 
468  if( min_dist > deltaRCut && deltaRCut >0 ) return 0;
469 
470  deltaRdetIdMap.insert( std::make_pair(min_dist, min_detId) );
471 
472  return 1;
473 }
double eta() const final
momentum pseudorapidity
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
Definition: DetId.h:18
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
double phi() const final
momentum azimuthal angle
void EcalDeadCellDeltaRFilter::loadEventInfo ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 192 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, debug_, edm::EventID::event(), edm::EventBase::id(), isdata, isPrintedOnce, edm::EventBase::isRealData(), ls, edm::EventBase::luminosityBlock(), edm::EventID::run(), and run.

Referenced by filter().

192  {
193  run = iEvent.id().run();
194  event = iEvent.id().event();
195  ls = iEvent.luminosityBlock();
196  isdata = iEvent.isRealData();
197 
198  if( !isPrintedOnce ){
199  if( debug_ ){
200  if( isdata ) std::cout<<"\nInput dataset is DATA"<<std::endl<<std::endl;
201  else std::cout<<"\nInput dataset is MC"<<std::endl<<std::endl;
202  }
203  isPrintedOnce = true;
204  }
205 
206 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
bool isRealData() const
Definition: EventBase.h:62
edm::LuminosityBlockNumber_t ls
edm::EventID id() const
Definition: EventBase.h:59
void EcalDeadCellDeltaRFilter::loadJets ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 208 of file EcalDeadCellDeltaRFilter.cc.

References edm::Event::getByToken(), jets, and jetToken_.

Referenced by filter().

208  {
209 
210  iEvent.getByToken(jetToken_, jets);
211 
212 }
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::Handle< edm::View< reco::Jet > > jets
void EcalDeadCellDeltaRFilter::loadMET ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 186 of file EcalDeadCellDeltaRFilter.cc.

References edm::Event::getByToken(), met, and metToken_.

Referenced by filter().

186  {
187 
188  iEvent.getByToken(metToken_, met);
189 
190 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::Handle< edm::View< reco::MET > > met
edm::EDGetTokenT< edm::View< reco::MET > > metToken_

Member Data Documentation

double EcalDeadCellDeltaRFilter::calomet
private

Definition at line 134 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::calometPhi
private

Definition at line 134 of file EcalDeadCellDeltaRFilter.cc.

const int EcalDeadCellDeltaRFilter::chnStatusToBeEvaluated_
private

Definition at line 144 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

const std::vector<double> EcalDeadCellDeltaRFilter::cracksHBHEdef_
private

Definition at line 171 of file EcalDeadCellDeltaRFilter.cc.

Referenced by etaToBoundary().

const std::vector<double> EcalDeadCellDeltaRFilter::cracksHEHFdef_
private

Definition at line 171 of file EcalDeadCellDeltaRFilter.cc.

Referenced by etaToBoundary().

const bool EcalDeadCellDeltaRFilter::debug_
private
const bool EcalDeadCellDeltaRFilter::doCracks_
private

Definition at line 169 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

std::map<DetId, std::vector<int> > EcalDeadCellDeltaRFilter::EcalAllDeadChannelsBitMap
private
std::map<DetId, EcalTrigTowerDetId> EcalDeadCellDeltaRFilter::EcalAllDeadChannelsTTMap
private

Definition at line 154 of file EcalDeadCellDeltaRFilter.cc.

Referenced by getChannelStatusMaps().

std::map<DetId, std::vector<double> > EcalDeadCellDeltaRFilter::EcalAllDeadChannelsValMap
private
const std::vector<double> EcalDeadCellDeltaRFilter::EcalDeadCellDeltaRFilterInput_
private

Definition at line 174 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

edm::ESHandle<EcalChannelStatus> EcalDeadCellDeltaRFilter::ecalStatus
private

Definition at line 137 of file EcalDeadCellDeltaRFilter.cc.

Referenced by envSet(), and getChannelStatusMaps().

edm::EventNumber_t EcalDeadCellDeltaRFilter::event
private

Definition at line 130 of file EcalDeadCellDeltaRFilter.cc.

Referenced by Types.EventID::cppID().

int EcalDeadCellDeltaRFilter::evtProcessedCnt
private

Definition at line 158 of file EcalDeadCellDeltaRFilter.cc.

edm::ESHandle<CaloGeometry> EcalDeadCellDeltaRFilter::geometry
private
TH1F* EcalDeadCellDeltaRFilter::h1_dummy
private
edm::ESHandle<HcalChannelQuality> EcalDeadCellDeltaRFilter::hcalStatus
private

Definition at line 138 of file EcalDeadCellDeltaRFilter.cc.

Referenced by beginLuminosityBlock().

bool EcalDeadCellDeltaRFilter::isdata
private

Definition at line 132 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadEventInfo().

bool EcalDeadCellDeltaRFilter::isPrintedOnce
private

Definition at line 123 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadEventInfo().

const bool EcalDeadCellDeltaRFilter::isProd_
private

Definition at line 166 of file EcalDeadCellDeltaRFilter.cc.

edm::Handle<edm::View<reco::Jet> > EcalDeadCellDeltaRFilter::jets
private

Definition at line 113 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter(), and loadJets().

const std::vector<double> EcalDeadCellDeltaRFilter::jetSelCuts_
private

Definition at line 116 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

edm::EDGetTokenT<edm::View<reco::Jet> > EcalDeadCellDeltaRFilter::jetToken_
private

Definition at line 112 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadJets().

edm::LuminosityBlockNumber_t EcalDeadCellDeltaRFilter::ls
private
const bool EcalDeadCellDeltaRFilter::makeProfileRoot_
private
const int EcalDeadCellDeltaRFilter::maskedEcalChannelStatusThreshold_
private

Definition at line 143 of file EcalDeadCellDeltaRFilter.cc.

Referenced by getChannelStatusMaps().

edm::Handle<edm::View<reco::MET> > EcalDeadCellDeltaRFilter::met
private

Definition at line 119 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter(), and loadMET().

edm::EDGetTokenT<edm::View<reco::MET> > EcalDeadCellDeltaRFilter::metToken_
private

Definition at line 118 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadMET().

double EcalDeadCellDeltaRFilter::pfmet
private

Definition at line 134 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::pfmetPhi
private

Definition at line 134 of file EcalDeadCellDeltaRFilter.cc.

const bool EcalDeadCellDeltaRFilter::printSkimInfo_
private

Definition at line 121 of file EcalDeadCellDeltaRFilter.cc.

TFile* EcalDeadCellDeltaRFilter::profFile
private
const std::string EcalDeadCellDeltaRFilter::profileRootName_
private

Definition at line 162 of file EcalDeadCellDeltaRFilter.cc.

Referenced by EcalDeadCellDeltaRFilter().

edm::RunNumber_t EcalDeadCellDeltaRFilter::run
private
const bool EcalDeadCellDeltaRFilter::taggingMode_
private

Definition at line 183 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

double EcalDeadCellDeltaRFilter::tcmet
private

Definition at line 134 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::tcmetPhi
private

Definition at line 134 of file EcalDeadCellDeltaRFilter.cc.

int EcalDeadCellDeltaRFilter::totTPFilteredCnt
private

Definition at line 158 of file EcalDeadCellDeltaRFilter.cc.

edm::ESHandle<EcalTrigTowerConstituentsMap> EcalDeadCellDeltaRFilter::ttMap_
private

Definition at line 141 of file EcalDeadCellDeltaRFilter.cc.

Referenced by envSet(), and getChannelStatusMaps().

const int EcalDeadCellDeltaRFilter::verbose_
private

Definition at line 167 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::wtdEvtProcessed
private

Definition at line 159 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::wtdTPFiltered
private

Definition at line 159 of file EcalDeadCellDeltaRFilter.cc.