CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTangentFilter.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 
6  fMuLabel = iConfig.getParameter<std::string>("MuLabel");
7  fMuonD0Min = iConfig.getParameter<double>("MuD0Min");
8  fMuonD0Max = iConfig.getParameter<double>("MuD0Max");
9  fVerbose = iConfig.getParameter<bool>("Verbose");
10  cout << "----------------------------------------------------------------------" << std::endl;
11  cout << "--- EcalTangentFilter constructor" << std::endl;
12  cout << "--- MuLabel: " << fMuLabel << std::endl;
13  cout << "--- MuonD0Min: " << fMuonD0Min << std::endl;
14  cout << "--- MuonD0Max: " << fMuonD0Max << std::endl;
15  cout << "--- Verbose: " << fVerbose << std::endl;
16  cout << "----------------------------------------------------------------------" << std::endl;
17  fNgood = 0;
18  fNtot = 0;
19 }
20 
21 
23  std::cout << "==> EcalTangentFilter> Number of accepted/total events = " << fNgood << "/" << fNtot << std::endl;
24 }
25 
26 
27 // ------------ method called on each new Event ------------
29  ++fNtot;
30  bool goodEvent(false);
31  using namespace edm;
32  using namespace reco;
34  iEvent.getByLabel(fMuLabel, Muons);
35  for (MuonCollection::const_iterator muon=Muons->begin(); muon!=Muons->end(); ++muon){
36  reco::TrackRef ref;
37  if(muon->outerTrack().isNonnull()){
38  ref = muon->outerTrack();
39  // Cut on impact parameter
40  double d0 = ref->d0();
41  if(fabs(d0) > fMuonD0Min && fabs(d0) < fMuonD0Max) goodEvent = true;
42  }
43  }
44  if(goodEvent){
45  ++fNgood;
46  if(fVerbose) std::cout << "==> EcalTangentFilter> new event r" << iEvent.id().run() << "/ev" << iEvent.id().event() << " accepted, so far: " << fNgood << std::endl;
47  }
48  return goodEvent;
49 }
50 
51 // ------------ method called once each job just before starting event loop ------------
53 }
54 
55 // ------------ method called once each job just after ending the event loop ------------
57 }
58 
59 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
virtual void endJob()
EventNumber_t event() const
Definition: EventID.h:41
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
EcalTangentFilter(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
virtual void beginJob()
edm::EventID id() const
Definition: EventBase.h:60
tuple cout
Definition: gather_cfg.py:121
virtual bool filter(edm::Event &, const edm::EventSetup &) override