CMS 3D CMS Logo

ElectronGeneralAnalyzer.cc
Go to the documentation of this file.
1 
3 
5 
12 
19 
20 //#include "CLHEP/Units/GlobalPhysicalConstants.h"
21 //#include "TMath.h"
22 
23 #include <iostream>
24 
25 using namespace reco;
26 
28  // collection input tags
29  electronCollection_ = consumes<GsfElectronCollection>(conf.getParameter<edm::InputTag>("ElectronCollection"));
31  consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("MatchingObjectCollection"));
32  trackCollection_ = consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("TrackCollection"));
33  vertexCollection_ = consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("VertexCollection"));
34  gsftrackCollection_ = consumes<reco::GsfTrackCollection>(conf.getParameter<edm::InputTag>("GsfTrackCollection"));
35  beamSpotTag_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("BeamSpot"));
36  triggerResults_ = consumes<edm::TriggerResults>(conf.getParameter<edm::InputTag>("TriggerResults"));
37 
38  // // for trigger
39  // HLTPathsByName_= conf.getParameter<std::vector<std::string > >("HltPaths");
40  // HLTPathsByIndex_.resize(HLTPathsByName_.size());
41 }
42 
44 
47  bookH2(iBooker, "beamSpotXvsY", "beam spot x vs y", 100, -0.2, 0.2, 100, -0.2, 0.2, "x (cm)", "y (cm)");
49  bookP1(iBooker, "nElectronsVsLs", "# gsf electrons vs LS", 150, 0., 1500., 0., 20., "LS", "<N_{ele}>");
51  bookP1(iBooker, "nClustersVsLs", "# clusters vs LS", 150, 0., 1500., 0., 100., "LS", "<N_{SC}>");
53  bookP1(iBooker, "nGsfTracksVsLs", "# gsf tracks vs LS", 150, 0., 1500., 0., 20., "LS", "<N_{GSF tk}>");
54  py_ele_nTracksVsLs = bookP1(iBooker, "nTracksVsLs", "# tracks vs LS", 150, 0., 1500., 0., 100., "LS", "<N_{gen tk}>");
56  bookP1(iBooker, "nVerticesVsLs", "# vertices vs LS", 150, 0., 1500., 0., 10., "LS", "<N_{vert}>");
57  h1_ele_triggers = bookH1(iBooker, "triggers", "hlt triggers", 256, 0., 256., "HLT bit");
58 }
59 
64  iEvent.getByToken(matchingObjectCollection_, recoClusters);
66  iEvent.getByToken(trackCollection_, tracks);
70  iEvent.getByToken(vertexCollection_, vertices);
71  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
72  iEvent.getByToken(beamSpotTag_, recoBeamSpotHandle);
73  const BeamSpot bs = *recoBeamSpotHandle;
74 
75  edm::EventNumber_t ievt = iEvent.id().event();
76  edm::RunNumber_t irun = iEvent.id().run();
77  edm::LuminosityBlockNumber_t ils = iEvent.luminosityBlock();
78 
79  edm::LogInfo("ElectronGeneralAnalyzer::analyze")
80  << "Treating " << gsfElectrons.product()->size() << " electrons"
81  << " from event " << ievt << " in run " << irun << " and lumiblock " << ils;
82 
83  h2_ele_beamSpotXvsY->Fill(bs.position().x(), bs.position().y());
84  py_ele_nElectronsVsLs->Fill(float(ils), (*gsfElectrons).size());
85  py_ele_nClustersVsLs->Fill(float(ils), (*recoClusters).size());
86  py_ele_nGsfTracksVsLs->Fill(float(ils), (*gsfTracks).size());
87  py_ele_nTracksVsLs->Fill(float(ils), (*tracks).size());
88  py_ele_nVerticesVsLs->Fill(float(ils), (*vertices).size());
89 
90  // trigger
93  if (triggerResults.isValid()) {
94  unsigned int i, n = triggerResults->size();
95  for (i = 0; i != n; ++i) {
96  if (triggerResults->accept(i)) {
97  h1_ele_triggers->Fill(float(i));
98  }
99  }
100  }
101 }
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
Handle.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TriggerResults.h
edm::Run
Definition: Run.h:45
ElectronDqmAnalyzerBase
Definition: ElectronDqmAnalyzerBase.h:19
triggerResults
static const std::string triggerResults
Definition: EdmProvDump.cc:45
ElectronGeneralAnalyzer::matchingObjectCollection_
edm::EDGetTokenT< reco::SuperClusterCollection > matchingObjectCollection_
Definition: ElectronGeneralAnalyzer.h:37
DQMStore.h
EDAnalyzer.h
ElectronGeneralAnalyzer::trackCollection_
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
Definition: ElectronGeneralAnalyzer.h:39
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ElectronGeneralAnalyzer::h1_ele_triggers
MonitorElement * h1_ele_triggers
Definition: ElectronGeneralAnalyzer.h:64
ElectronGeneralAnalyzer.h
electronIsolatorFromEffectiveArea_cfi.gsfElectrons
gsfElectrons
Definition: electronIsolatorFromEffectiveArea_cfi.py:4
edm::Handle
Definition: AssociativeIterator.h:50
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
BasicClusterFwd.h
MakerMacros.h
cms::cuda::bs
bs
Definition: HistoContainer.h:127
BeamSpot.h
ElectronGeneralAnalyzer::beamSpotTag_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
Definition: ElectronGeneralAnalyzer.h:41
ElectronGeneralAnalyzer::vertexCollection_
edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
Definition: ElectronGeneralAnalyzer.h:40
ElectronGeneralAnalyzer::h2_ele_beamSpotXvsY
MonitorElement * h2_ele_beamSpotXvsY
Definition: ElectronGeneralAnalyzer.h:58
ElectronGeneralAnalyzer::py_ele_nElectronsVsLs
MonitorElement * py_ele_nElectronsVsLs
Definition: ElectronGeneralAnalyzer.h:59
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
reco::BeamSpot
Definition: BeamSpot.h:21
ElectronDqmAnalyzerBase::bookH2
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")
Definition: ElectronDqmAnalyzerBase.cc:111
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
ecalDrivenGsfElectronCoresFromMultiCl_cff.gsfTracks
gsfTracks
Definition: ecalDrivenGsfElectronCoresFromMultiCl_cff.py:4
GsfElectron.h
ElectronGeneralAnalyzer::gsftrackCollection_
edm::EDGetTokenT< reco::GsfTrackCollection > gsftrackCollection_
Definition: ElectronGeneralAnalyzer.h:38
ElectronGeneralAnalyzer::py_ele_nTracksVsLs
MonitorElement * py_ele_nTracksVsLs
Definition: ElectronGeneralAnalyzer.h:62
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ElectronGeneralAnalyzer::triggerResults_
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
Definition: ElectronGeneralAnalyzer.h:44
iEvent
int iEvent
Definition: GenABIO.cc:224
ElectronGeneralAnalyzer::~ElectronGeneralAnalyzer
~ElectronGeneralAnalyzer() override
Definition: ElectronGeneralAnalyzer.cc:43
GsfTrack.h
ElectronDqmAnalyzerBase::bookH1
MonitorElement * bookH1(DQMStore::IBooker &, const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
Definition: ElectronDqmAnalyzerBase.cc:57
edm::EventSetup
Definition: EventSetup.h:57
ElectronGeneralAnalyzer::electronCollection_
edm::EDGetTokenT< reco::GsfElectronCollection > electronCollection_
Definition: ElectronGeneralAnalyzer.h:36
ElectronGeneralAnalyzer::py_ele_nClustersVsLs
MonitorElement * py_ele_nClustersVsLs
Definition: ElectronGeneralAnalyzer.h:60
ElectronGeneralAnalyzer::py_ele_nGsfTracksVsLs
MonitorElement * py_ele_nGsfTracksVsLs
Definition: ElectronGeneralAnalyzer.h:61
ElectronGeneralAnalyzer::py_ele_nVerticesVsLs
MonitorElement * py_ele_nVerticesVsLs
Definition: ElectronGeneralAnalyzer.h:63
ElectronDqmAnalyzerBase::bookP1
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")
Definition: ElectronDqmAnalyzerBase.cc:171
ElectronGeneralAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ElectronGeneralAnalyzer.cc:45
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
ParameterSet.h
ElectronGeneralAnalyzer::ElectronGeneralAnalyzer
ElectronGeneralAnalyzer(const edm::ParameterSet &conf)
Definition: ElectronGeneralAnalyzer.cc:27
ElectronGeneralAnalyzer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: ElectronGeneralAnalyzer.cc:60
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7