CMS 3D CMS Logo

ESRecoSummary.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ESRecoSummary
4 // Class: ESRecoSummary
5 // Original Author: Martina Malberti
6 //
7 // system include files
8 #include <cmath>
9 #include <iostream>
10 #include <memory>
11 
12 // user include files
14 
16 
19 
21 
28 
38 
39 //
40 // constructors and destructor
41 //
43  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
44 
45  // now do what ever initialization is needed
46  esRecHitCollection_ = consumes<ESRecHitCollection>(ps.getParameter<edm::InputTag>("recHitCollection_ES"));
48  consumes<reco::PreshowerClusterCollection>(ps.getParameter<edm::InputTag>("ClusterCollectionX_ES"));
50  consumes<reco::PreshowerClusterCollection>(ps.getParameter<edm::InputTag>("ClusterCollectionY_ES"));
51 
53  consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("superClusterCollection_EE"));
54 }
55 
57  // Monitor Elements (ex THXD)
58  iBooker.setCurrentFolder(prefixME_ + "/ESRecoSummary"); // to organise the histos in folders
59 
60  // Preshower ----------------------------------------------
61  h_recHits_ES_energyMax = iBooker.book1D("recHits_ES_energyMax", "recHits_ES_energyMax", 200, 0., 0.01);
62  h_recHits_ES_time = iBooker.book1D("recHits_ES_time", "recHits_ES_time", 200, -100., 100.);
63 
64  h_esClusters_energy_plane1 = iBooker.book1D("esClusters_energy_plane1", "esClusters_energy_plane1", 200, 0., 0.01);
65  h_esClusters_energy_plane2 = iBooker.book1D("esClusters_energy_plane2", "esClusters_energy_plane2", 200, 0., 0.01);
66  h_esClusters_energy_ratio = iBooker.book1D("esClusters_energy_ratio", "esClusters_energy_ratio", 200, 0., 20.);
67 }
68 
69 //
70 // member functions
71 //
72 
73 // ------------ method called to for each event ------------
75  // Preshower RecHits
77  ev.getByToken(esRecHitCollection_, recHitsES);
78  const ESRecHitCollection *thePreShowerRecHits = recHitsES.product();
79 
80  if (!recHitsES.isValid()) {
81  std::cerr << "ESRecoSummary::analyze --> recHitsES not found" << std::endl;
82  }
83 
84  float maxRecHitEnergyES = -999.;
85 
86  for (ESRecHitCollection::const_iterator esItr = thePreShowerRecHits->begin(); esItr != thePreShowerRecHits->end();
87  ++esItr) {
88  h_recHits_ES_time->Fill(esItr->time());
89  if (esItr->energy() > maxRecHitEnergyES)
90  maxRecHitEnergyES = esItr->energy();
91 
92  } // end loop over ES rec Hits
93 
94  h_recHits_ES_energyMax->Fill(maxRecHitEnergyES);
95 
96  // ES clusters in X plane
98  ev.getByToken(esClusterCollectionX_, esClustersX);
99  const reco::PreshowerClusterCollection *ESclustersX = esClustersX.product();
100 
101  // ES clusters in Y plane
103  ev.getByToken(esClusterCollectionY_, esClustersY);
104  const reco::PreshowerClusterCollection *ESclustersY = esClustersY.product();
105 
106  // ... endcap
108  ev.getByToken(superClusterCollection_EE_, superClusters_EE_h);
109  const reco::SuperClusterCollection *theEndcapSuperClusters = superClusters_EE_h.product();
110  if (!superClusters_EE_h.isValid()) {
111  std::cerr << "EcalRecHitSummary::analyze --> superClusters_EE_h not found" << std::endl;
112  }
113 
114  // loop over all super clusters
115  for (reco::SuperClusterCollection::const_iterator itSC = theEndcapSuperClusters->begin();
116  itSC != theEndcapSuperClusters->end();
117  ++itSC) {
118  if (fabs(itSC->eta()) < 1.65 || fabs(itSC->eta()) > 2.6)
119  continue;
120 
121  float ESenergyPlane1 = 0.;
122  float ESenergyPlane2 = 0.;
123 
124  // Loop over all ECAL Basic clusters in the supercluster
125  for (reco::CaloCluster_iterator ecalBasicCluster = itSC->clustersBegin(); ecalBasicCluster != itSC->clustersEnd();
126  ecalBasicCluster++) {
127  const reco::CaloClusterPtr ecalBasicClusterPtr = *(ecalBasicCluster);
128 
129  for (reco::PreshowerClusterCollection::const_iterator iESClus = ESclustersX->begin();
130  iESClus != ESclustersX->end();
131  ++iESClus) {
132  const reco::CaloClusterPtr preshBasicCluster = iESClus->basicCluster();
133  const reco::PreshowerCluster *esCluster = &*iESClus;
134  if (preshBasicCluster == ecalBasicClusterPtr) {
135  ESenergyPlane1 += esCluster->energy();
136  }
137  } // end of x loop
138 
139  for (reco::PreshowerClusterCollection::const_iterator iESClus = ESclustersY->begin();
140  iESClus != ESclustersY->end();
141  ++iESClus) {
142  const reco::CaloClusterPtr preshBasicCluster = iESClus->basicCluster();
143  const reco::PreshowerCluster *esCluster = &*iESClus;
144  if (preshBasicCluster == ecalBasicClusterPtr) {
145  ESenergyPlane2 += esCluster->energy();
146  }
147  } // end of y loop
148  } // end loop over all basic clusters in the supercluster
149 
150  // cout<<"DQM : "<<ESenergyPlane1<<" "<<ESenergyPlane2<<endl;
151  h_esClusters_energy_plane1->Fill(ESenergyPlane1);
152  h_esClusters_energy_plane2->Fill(ESenergyPlane2);
153  if (ESenergyPlane1 > 0 && ESenergyPlane2 > 0)
154  h_esClusters_energy_ratio->Fill(ESenergyPlane1 / ESenergyPlane2);
155 
156  } // end loop over superclusters
157 }
158 
159 // define this as a plug-in
ESRecoSummary
Definition: ESRecoSummary.h:15
ESRecoSummary::h_esClusters_energy_ratio
MonitorElement * h_esClusters_energy_ratio
Definition: ESRecoSummary.h:32
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
ESRecoSummary::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ESRecoSummary.cc:56
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::Run
Definition: Run.h:45
BasicCluster.h
ESRecoSummary::h_recHits_ES_energyMax
MonitorElement * h_recHits_ES_energyMax
Definition: ESRecoSummary.h:27
PreshowerCluster.h
reco::PreshowerCluster
Definition: PreshowerCluster.h:17
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::PtrVectorItr
Definition: PtrVector.h:51
edm::SortedCollection< EcalRecHit >
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ESRecoSummary::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ESRecoSummary.cc:74
ESDetId.h
edm::Handle
Definition: AssociativeIterator.h:50
ESRecoSummary::h_esClusters_energy_plane2
MonitorElement * h_esClusters_energy_plane2
Definition: ESRecoSummary.h:31
BasicClusterFwd.h
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
ESRecoSummary::h_recHits_ES_time
MonitorElement * h_recHits_ES_time
Definition: ESRecoSummary.h:28
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
ESRecoSummary::esClusterCollectionX_
edm::EDGetTokenT< reco::PreshowerClusterCollection > esClusterCollectionX_
Definition: ESRecoSummary.h:38
reco::PreshowerClusterCollection
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
Definition: PreshowerClusterFwd.h:12
EcalSeverityLevelAlgo.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
EcalClusterTools.h
ESRecoSummary::h_esClusters_energy_plane1
MonitorElement * h_esClusters_energy_plane1
Definition: ESRecoSummary.h:30
CaloTopologyRecord.h
ESRecoSummary.h
edm::EventSetup
Definition: EventSetup.h:57
EcalTools.h
ESRecoSummary::esClusterCollectionY_
edm::EDGetTokenT< reco::PreshowerClusterCollection > esClusterCollectionY_
Definition: ESRecoSummary.h:39
EcalCleaningAlgo.h
ESRecoSummary::prefixME_
std::string prefixME_
Definition: ESRecoSummary.h:24
edm::Ptr< CaloCluster >
CaloTopology.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CaloSubdetectorTopology.h
Frameworkfwd.h
SuperCluster.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CaloGeometry.h
ESRecoSummary::esRecHitCollection_
edm::EDGetTokenT< ESRecHitCollection > esRecHitCollection_
Definition: ESRecoSummary.h:37
dqm::implementation::IBooker
Definition: DQMStore.h:43
ESRecoSummary::ESRecoSummary
ESRecoSummary(const edm::ParameterSet &)
Definition: ESRecoSummary.cc:42
ParameterSet.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
GlobalPoint.h
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
ESRecoSummary::superClusterCollection_EE_
edm::EDGetTokenT< reco::SuperClusterCollection > superClusterCollection_EE_
Definition: ESRecoSummary.h:36