CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalStripHaloFilter.cc
Go to the documentation of this file.
7 
9 
10  public:
11 
12  explicit HcalStripHaloFilter(const edm::ParameterSet & iConfig);
14 
15  private:
16 
17  virtual bool filter(edm::StreamID iID, edm::Event & iEvent, const edm::EventSetup & iSetup) const override;
18 
19  const bool taggingMode_;
22 };
23 
25  : taggingMode_ (iConfig.getParameter<bool> ("taggingMode"))
26  , maxWeightedStripLength_ (iConfig.getParameter<int>("maxWeightedStripLength"))
27  , beamHaloSummaryToken_(consumes<reco::BeamHaloSummary>(edm::InputTag("BeamHaloSummary")))
28 {
29  produces<bool>();
30 }
31 
33 
34  edm::Handle<reco::BeamHaloSummary> beamHaloSummary;
35  iEvent.getByToken(beamHaloSummaryToken_ , beamHaloSummary);
36 
37  bool pass = true;
38  auto const& problematicStrips = beamHaloSummary->getProblematicStrips();
39  for (unsigned int iStrip = 0; iStrip < problematicStrips.size(); iStrip++) {
40  int numContiguousCells = 0;
41  auto const& problematicStrip = problematicStrips[iStrip];
42  for (unsigned int iTower = 0; iTower < problematicStrip.cellTowerIds.size(); iTower++) {
43  numContiguousCells += (int)problematicStrip.cellTowerIds[iTower].first;
44  }
45  if(numContiguousCells > maxWeightedStripLength_) {
46  pass = false;
47  break;
48  }
49  }
50 
51  iEvent.put( std::auto_ptr<bool>(new bool(pass)) );
52 
53  return taggingMode_ || pass; // return false if it is a beamhalo event
54 }
55 
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< reco::BeamHaloSummary > beamHaloSummaryToken_
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
HcalStripHaloFilter(const edm::ParameterSet &iConfig)
virtual bool filter(edm::StreamID iID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override