CMS 3D CMS Logo

ElectronGeneralAnalyzer.cc
Go to the documentation of this file.
1 
3 
5 
12 
18 
19 //#include "CLHEP/Units/GlobalPhysicalConstants.h"
20 //#include "TMath.h"
21 
22 #include <iostream>
23 
24 using namespace reco;
25 
27  // collection input tags
28  electronCollection_ = consumes<GsfElectronCollection>(conf.getParameter<edm::InputTag>("ElectronCollection"));
30  consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("MatchingObjectCollection"));
31  trackCollection_ = consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("TrackCollection"));
32  vertexCollection_ = consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("VertexCollection"));
33  gsftrackCollection_ = consumes<reco::GsfTrackCollection>(conf.getParameter<edm::InputTag>("GsfTrackCollection"));
34  beamSpotTag_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("BeamSpot"));
35 }
36 
38 
41  bookH2(iBooker, "beamSpotXvsY", "beam spot x vs y", 100, -0.2, 0.2, 100, -0.2, 0.2, "x (cm)", "y (cm)");
43  bookP1(iBooker, "nElectronsVsLs", "# gsf electrons vs LS", 150, 0., 1500., 0., 20., "LS", "<N_{ele}>");
45  bookP1(iBooker, "nClustersVsLs", "# clusters vs LS", 150, 0., 1500., 0., 100., "LS", "<N_{SC}>");
47  bookP1(iBooker, "nGsfTracksVsLs", "# gsf tracks vs LS", 150, 0., 1500., 0., 20., "LS", "<N_{GSF tk}>");
48  py_ele_nTracksVsLs = bookP1(iBooker, "nTracksVsLs", "# tracks vs LS", 150, 0., 1500., 0., 100., "LS", "<N_{gen tk}>");
50  bookP1(iBooker, "nVerticesVsLs", "# vertices vs LS", 150, 0., 1500., 0., 10., "LS", "<N_{vert}>");
51 }
52 
57  iEvent.getByToken(matchingObjectCollection_, recoClusters);
59  iEvent.getByToken(trackCollection_, tracks);
63  iEvent.getByToken(vertexCollection_, vertices);
64  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
65  iEvent.getByToken(beamSpotTag_, recoBeamSpotHandle);
66  const BeamSpot bs = *recoBeamSpotHandle;
67 
68  edm::EventNumber_t ievt = iEvent.id().event();
69  edm::RunNumber_t irun = iEvent.id().run();
70  edm::LuminosityBlockNumber_t ils = iEvent.luminosityBlock();
71 
72  edm::LogInfo("ElectronGeneralAnalyzer::analyze")
73  << "Treating " << gsfElectrons.product()->size() << " electrons"
74  << " from event " << ievt << " in run " << irun << " and lumiblock " << ils;
75 
76  h2_ele_beamSpotXvsY->Fill(bs.position().x(), bs.position().y());
77  py_ele_nElectronsVsLs->Fill(float(ils), (*gsfElectrons).size());
78  py_ele_nClustersVsLs->Fill(float(ils), (*recoClusters).size());
79  py_ele_nGsfTracksVsLs->Fill(float(ils), (*gsfTracks).size());
80  py_ele_nTracksVsLs->Fill(float(ils), (*tracks).size());
81  py_ele_nVerticesVsLs->Fill(float(ils), (*vertices).size());
82 }
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
MonitorElement * py_ele_nGsfTracksVsLs
MonitorElement * h2_ele_beamSpotXvsY
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * py_ele_nVerticesVsLs
MonitorElement * py_ele_nElectronsVsLs
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
ElectronGeneralAnalyzer(const edm::ParameterSet &conf)
unsigned long long EventNumber_t
unsigned int LuminosityBlockNumber_t
MonitorElement * py_ele_nClustersVsLs
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void Fill(long long x)
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::GsfElectronCollection > electronCollection_
MonitorElement * bookP1(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="E1 P")
edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
Log< level::Info, false > LogInfo
fixed size matrix
MonitorElement * bookH2(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
unsigned int RunNumber_t
edm::EDGetTokenT< reco::GsfTrackCollection > gsftrackCollection_
edm::EDGetTokenT< reco::SuperClusterCollection > matchingObjectCollection_
Definition: Run.h:45