CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual 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)
 
virtual void endJob () override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void envSet (const edm::EventSetup &)
 
int etaToBoundary (const std::vector< reco::Jet > &jetTVec)
 
virtual 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,
EcalTrigTowerDetId
EcalAllDeadChannelsTTMap
 
std::map< DetId, std::vector
< double > > 
EcalAllDeadChannelsValMap
 
const std::vector< double > EcalDeadCellDeltaRFilterInput_
 
EcalTPGScale ecalScale_
 
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
< EcalTrigTowerConstituentsMap
ttMap_
 
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
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 &)
 
- 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 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 97 of file EcalDeadCellDeltaRFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 222 of file EcalDeadCellDeltaRFilter.cc.

References h1_dummy, makeProfileRoot_, profFile, and profileRootName_.

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

Definition at line 257 of file EcalDeadCellDeltaRFilter.cc.

References h1_dummy, makeProfileRoot_, and profFile.

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

Member Function Documentation

void EcalDeadCellDeltaRFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 342 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, and debug_.

342  {
343  if (debug_) std::cout << "beginJob" << std::endl;
344 }
tuple cout
Definition: gather_cfg.py:121
void EcalDeadCellDeltaRFilter::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 352 of file EcalDeadCellDeltaRFilter.cc.

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

352  {
353  if (debug_) std::cout << "beginRun" << std::endl;
354 // Channel status might change for each run (data)
355 // Event setup
356  envSet(iSetup);
358  if( debug_) std::cout<< "EcalAllDeadChannelsValMap.size() : "<<EcalAllDeadChannelsValMap.size()<<" EcalAllDeadChannelsBitMap.size() : "<<EcalAllDeadChannelsBitMap.size()<<std::endl;
359  return;
360 }
virtual void envSet(const edm::EventSetup &)
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
tuple cout
Definition: gather_cfg.py:121
int EcalDeadCellDeltaRFilter::dPhiToMETfunc ( const std::vector< reco::Jet > &  jetTVec,
const double &  dPhiCutVal,
std::vector< reco::Jet > &  closeToMETjetsVec 
)
private

Definition at line 390 of file EcalDeadCellDeltaRFilter.cc.

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

Referenced by filter().

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

Definition at line 419 of file EcalDeadCellDeltaRFilter.cc.

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

Referenced by filter().

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

Reimplemented from edm::EDFilter.

Definition at line 347 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, and debug_.

347  {
348  if (debug_) std::cout << "endJob" << std::endl;
349 }
tuple cout
Definition: gather_cfg.py:121
void EcalDeadCellDeltaRFilter::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 363 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, and debug_.

363  {
364  if (debug_) std::cout << "endRun" << std::endl;
365  return;
366 }
tuple cout
Definition: gather_cfg.py:121
void EcalDeadCellDeltaRFilter::envSet ( const edm::EventSetup iSetup)
privatevirtual

Definition at line 268 of file EcalDeadCellDeltaRFilter.cc.

References gather_cfg::cout, debug_, ecalScale_, ecalStatus, geometry, edm::EventSetup::get(), hcalStatus, edm::ESHandleBase::isValid(), EcalTPGScale::setEventSetup(), and ttMap_.

Referenced by beginRun().

268  {
269 
270  if (debug_) std::cout << "***envSet***" << std::endl;
271 
272  ecalScale_.setEventSetup( iSetup );
273  iSetup.get<IdealGeometryRecord>().get(ttMap_);
274 
275  iSetup.get<EcalChannelStatusRcd> ().get(ecalStatus);
276  iSetup.get<HcalChannelQualityRcd>().get("withTopo",hcalStatus);
277  iSetup.get<CaloGeometryRecord> ().get(geometry);
278 
279  if( !ecalStatus.isValid() ) throw "Failed to get ECAL channel status!";
280  if( !hcalStatus.isValid() ) throw "Failed to get HCAL channel status!";
281  if( !geometry.isValid() ) throw "Failed to get the geometry!";
282 
283 }
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalTPGScale.cc:19
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
edm::ESHandle< CaloGeometry > geometry
const T & get() const
Definition: EventSetup.h:56
edm::ESHandle< EcalChannelStatus > ecalStatus
tuple cout
Definition: gather_cfg.py:121
bool isValid() const
Definition: ESHandle.h:47
edm::ESHandle< HcalChannelQuality > hcalStatus
int EcalDeadCellDeltaRFilter::etaToBoundary ( const std::vector< reco::Jet > &  jetTVec)
private

Definition at line 369 of file EcalDeadCellDeltaRFilter.cc.

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

Referenced by filter().

369  {
370 
371  int isClose = 0;
372 
373  int cntOrder10 = 0;
374  for(unsigned int ij=0; ij<jetTVec.size(); ij++){
375 
376  double recoJetEta = jetTVec[ij].eta();
377 
378  if( std::abs(recoJetEta)>cracksHBHEdef_[0] && std::abs(recoJetEta)<cracksHBHEdef_[1] ) isClose += (cntOrder10*10 + 1);
379  if( std::abs(recoJetEta)>cracksHEHFdef_[0] && std::abs(recoJetEta)<cracksHEHFdef_[1] ) isClose += (cntOrder10*10 + 2);
380 
381  if( isClose/pow(10, cntOrder10) >=3 ) cntOrder10 = isClose/10 + 1;
382  }
383 
384  return isClose;
385 
386 }
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 
)
overrideprivatevirtual

Implements edm::EDFilter.

Definition at line 286 of file EcalDeadCellDeltaRFilter.cc.

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

286  {
287 
288  loadEventInfo(iEvent, iSetup);
289  loadJets(iEvent, iSetup);
290  loadMET(iEvent, iSetup);
291 
292 // XXX: In the following, never assign pass to true again
293 // Currently, always true
294  bool pass = true;
295 
296  using namespace edm;
297 
298  std::vector<reco::Jet> seledJets;
299 
300  for( edm::View<reco::Jet>::const_iterator ij = jets->begin(); ij != jets->end(); ij++){
301  if( ij->pt() > jetSelCuts_[0] && std::abs(ij->eta()) < jetSelCuts_[1] ){
302  seledJets.push_back(reco::Jet(*ij));
303  }
304  }
305 
306  if( seledJets.empty() ) return pass;
307 
308  double dPhiToMET = EcalDeadCellDeltaRFilterInput_[0], dRtoDeadCell = EcalDeadCellDeltaRFilterInput_[1];
309 
310  std::vector<reco::Jet> closeToMETjetsVec;
311 
312  int dPhiToMETstatus = dPhiToMETfunc(seledJets, dPhiToMET, closeToMETjetsVec);
313 
314 // Get event filter for simple dR cut
315  int deadCellStatus = dRtoMaskedChnsEvtFilterFunc(closeToMETjetsVec, chnStatusToBeEvaluated_, dRtoDeadCell);
316 
317  int boundaryStatus = etaToBoundary(closeToMETjetsVec);
318 
319  if(debug_ ){
320  printf("\nrun : %8u event : %12llu ls : %8u dPhiToMETstatus : %d deadCellStatus : %d boundaryStatus : %d\n", run, event, ls, dPhiToMETstatus, deadCellStatus, boundaryStatus);
321  printf("met : %6.2f metphi : % 6.3f dPhiToMET : %5.3f dRtoDeadCell : %5.3f\n", (*met)[0].pt(), (*met)[0].phi(), dPhiToMET, dRtoDeadCell);
322  }
323 
324  if( makeProfileRoot_ ){
325 // h1_dummy->Fill(xxx);
326  }
327 
328  std::auto_ptr<int> deadCellStatusPtr ( new int(deadCellStatus) );
329  std::auto_ptr<int> boundaryStatusPtr ( new int(boundaryStatus) );
330 
331  iEvent.put( deadCellStatusPtr, "deadCellStatus");
332  iEvent.put( boundaryStatusPtr, "boundaryStatus");
333 
334  if( deadCellStatus || (doCracks_ && boundaryStatus) ) pass = false;
335 
336  iEvent.put( std::auto_ptr<bool>(new bool(pass)) );
337 
338  return taggingMode_ || pass;
339 }
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)
const_iterator begin() const
edm::Handle< edm::View< reco::MET > > met
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
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_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
const_iterator end() const
edm::Handle< edm::View< reco::Jet > > jets
const std::vector< double > EcalDeadCellDeltaRFilterInput_
int EcalDeadCellDeltaRFilter::getChannelStatusMaps ( )
private

Definition at line 475 of file EcalDeadCellDeltaRFilter.cc.

References cond::rpcobgas::detid, EcalAllDeadChannelsBitMap, EcalAllDeadChannelsTTMap, EcalAllDeadChannelsValMap, ecalStatus, eta, PV3DBase< T, PVType, FrameType >::eta(), EBDetId::ETAPHIMODE, geometry, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), maskedEcalChannelStatusThreshold_, phi, PV3DBase< T, PVType, FrameType >::phi(), ntuplemaker::status, PV3DBase< T, PVType, FrameType >::theta(), theta(), ttMap_, EBDetId::validDetId(), EEDetId::validDetId(), and EEDetId::XYMODE.

Referenced by beginRun().

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

Definition at line 438 of file EcalDeadCellDeltaRFilter.cc.

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

Referenced by dRtoMaskedChnsEvtFilterFunc().

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

Definition at line 193 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().

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

Definition at line 209 of file EcalDeadCellDeltaRFilter.cc.

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

Referenced by filter().

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

Definition at line 187 of file EcalDeadCellDeltaRFilter.cc.

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

Referenced by filter().

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

Member Data Documentation

double EcalDeadCellDeltaRFilter::calomet
private

Definition at line 133 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::calometPhi
private

Definition at line 133 of file EcalDeadCellDeltaRFilter.cc.

const int EcalDeadCellDeltaRFilter::chnStatusToBeEvaluated_
private

Definition at line 145 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

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

Definition at line 172 of file EcalDeadCellDeltaRFilter.cc.

Referenced by etaToBoundary().

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

Definition at line 172 of file EcalDeadCellDeltaRFilter.cc.

Referenced by etaToBoundary().

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

Definition at line 170 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 155 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 175 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

EcalTPGScale EcalDeadCellDeltaRFilter::ecalScale_
private

Definition at line 142 of file EcalDeadCellDeltaRFilter.cc.

Referenced by envSet().

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

Definition at line 136 of file EcalDeadCellDeltaRFilter.cc.

Referenced by envSet(), and getChannelStatusMaps().

edm::EventNumber_t EcalDeadCellDeltaRFilter::event
private

Definition at line 129 of file EcalDeadCellDeltaRFilter.cc.

Referenced by Types.EventID::cppID(), and filter().

int EcalDeadCellDeltaRFilter::evtProcessedCnt
private

Definition at line 159 of file EcalDeadCellDeltaRFilter.cc.

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

Definition at line 137 of file EcalDeadCellDeltaRFilter.cc.

Referenced by envSet().

bool EcalDeadCellDeltaRFilter::isdata
private

Definition at line 131 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadEventInfo().

bool EcalDeadCellDeltaRFilter::isPrintedOnce
private

Definition at line 122 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadEventInfo().

const bool EcalDeadCellDeltaRFilter::isProd_
private

Definition at line 167 of file EcalDeadCellDeltaRFilter.cc.

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

Definition at line 112 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter(), and loadJets().

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

Definition at line 115 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

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

Definition at line 111 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 144 of file EcalDeadCellDeltaRFilter.cc.

Referenced by getChannelStatusMaps().

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

Definition at line 118 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter(), and loadMET().

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

Definition at line 117 of file EcalDeadCellDeltaRFilter.cc.

Referenced by loadMET().

double EcalDeadCellDeltaRFilter::pfmet
private

Definition at line 133 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::pfmetPhi
private

Definition at line 133 of file EcalDeadCellDeltaRFilter.cc.

const bool EcalDeadCellDeltaRFilter::printSkimInfo_
private

Definition at line 120 of file EcalDeadCellDeltaRFilter.cc.

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

Definition at line 163 of file EcalDeadCellDeltaRFilter.cc.

Referenced by EcalDeadCellDeltaRFilter().

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

Definition at line 184 of file EcalDeadCellDeltaRFilter.cc.

Referenced by filter().

double EcalDeadCellDeltaRFilter::tcmet
private

Definition at line 133 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::tcmetPhi
private

Definition at line 133 of file EcalDeadCellDeltaRFilter.cc.

int EcalDeadCellDeltaRFilter::totTPFilteredCnt
private

Definition at line 159 of file EcalDeadCellDeltaRFilter.cc.

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

Definition at line 140 of file EcalDeadCellDeltaRFilter.cc.

Referenced by envSet(), and getChannelStatusMaps().

const int EcalDeadCellDeltaRFilter::verbose_
private

Definition at line 168 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::wtdEvtProcessed
private

Definition at line 160 of file EcalDeadCellDeltaRFilter.cc.

double EcalDeadCellDeltaRFilter::wtdTPFiltered
private

Definition at line 160 of file EcalDeadCellDeltaRFilter.cc.