CMS 3D CMS Logo

MuonEnergyDepositAnalyzer.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author G. Mila - INFN Torino
5  */
6 
8 
10 
12 
18 
19 #include <cmath>
20 #include <string>
21 using namespace std;
22 using namespace edm;
23 
25  parameters = pSet;
26 
27  theMuonCollectionLabel_ = consumes<reco::MuonCollection>(parameters.getParameter<InputTag>("MuonCollection"));
28 
29  AlgoName = parameters.getParameter<std::string>("AlgoName");
30  emNoBin = parameters.getParameter<int>("emSizeBin");
31  emNoMin = parameters.getParameter<double>("emSizeMin");
32  emNoMax = parameters.getParameter<double>("emSizeMax");
33 
34  hadNoBin = parameters.getParameter<int>("hadSizeBin");
35  hadNoMin = parameters.getParameter<double>("hadSizeMin");
36  hadNoMax = parameters.getParameter<double>("hadSizeMax");
37 
38  emS9NoBin = parameters.getParameter<int>("emS9SizeBin");
39  emS9NoMin = parameters.getParameter<double>("emS9SizeMin");
40  emS9NoMax = parameters.getParameter<double>("emS9SizeMax");
41 
42  hadS9NoBin = parameters.getParameter<int>("hadS9SizeBin");
43  hadS9NoMin = parameters.getParameter<double>("hadS9SizeMin");
44  hadS9NoMax = parameters.getParameter<double>("hadS9SizeMax");
45 
46  hoNoBin = parameters.getParameter<int>("hoSizeBin");
47  hoNoMin = parameters.getParameter<double>("hoSizeMin");
48  hoNoMax = parameters.getParameter<double>("hoSizeMax");
49 
50  hoS9NoBin = parameters.getParameter<int>("hoS9SizeBin");
51  hoS9NoMin = parameters.getParameter<double>("hoS9SizeMin");
52  hoS9NoMax = parameters.getParameter<double>("hoS9SizeMax");
53 }
56  edm::Run const& /*iRun*/,
57  edm::EventSetup const& /* iSetup */) {
58  ibooker.cd();
59  ibooker.setCurrentFolder("Muons/MuonEnergyDepositAnalyzer");
60 
61  std::string histname = "ecalDepositedEnergyBarrel_";
62  ecalDepEnergyBarrel =
63  ibooker.book1D(histname + AlgoName, "Energy deposited in the ECAL barrel cells", emNoBin, emNoMin, emNoMax);
64  ecalDepEnergyBarrel->setAxisTitle("GeV");
65 
66  histname = "ecalDepositedEnergyEndcap_";
67  ecalDepEnergyEndcap =
68  ibooker.book1D(histname + AlgoName, "Energy deposited in the ECAL endcap cells", emNoBin, emNoMin, emNoMax);
69  ecalDepEnergyEndcap->setAxisTitle("GeV");
70 
71  histname = "ecalS9DepositedEnergyBarrel_";
72  ecalS9DepEnergyBarrel = ibooker.book1D(
73  histname + AlgoName, "Energy deposited in the ECAL barrel 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
74  ecalS9DepEnergyBarrel->setAxisTitle("GeV");
75  histname = "ecalS9DepositedEnergyEndcap_";
76  ecalS9DepEnergyEndcap = ibooker.book1D(
77  histname + AlgoName, "Energy deposited in the ECAL endcap 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
78  ecalS9DepEnergyEndcap->setAxisTitle("GeV");
79  histname = "ecalS9PointingMuDepositedEnergy_Glb_";
80  ecalS9PointingMuDepEnergy_Glb = ibooker.book1D(histname + AlgoName,
81  "Pointing glb muons energy deposited in the ECAL 3*3 towers",
82  emS9NoBin,
83  emS9NoMin,
84  emS9NoMax);
85  ecalS9PointingMuDepEnergy_Glb->setAxisTitle("GeV");
86  histname = "ecalS9PointingMuDepositedEnergy_Tk_";
87  ecalS9PointingMuDepEnergy_Tk = ibooker.book1D(
88  histname + AlgoName, "Pointing tk muons energy deposited in the ECAL 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
89  ecalS9PointingMuDepEnergy_Tk->setAxisTitle("GeV");
90  histname = "ecalS9PointingMuDepositedEnergy_Sta_";
91  ecalS9PointingMuDepEnergy_Sta = ibooker.book1D(histname + AlgoName,
92  "Pointing sta muons energy deposited in the ECAL 3*3 towers",
93  emS9NoBin,
94  emS9NoMin,
95  emS9NoMax);
96  ecalS9PointingMuDepEnergy_Sta->setAxisTitle("GeV");
97 
98  histname = "hadDepositedEnergyBarrel_";
99  hcalDepEnergyBarrel =
100  ibooker.book1D(histname + AlgoName, "Energy deposited in the HCAL barrel cells", hadNoBin, hadNoMin, hadNoMax);
101  hcalDepEnergyBarrel->setAxisTitle("GeV");
102  histname = "hadDepositedEnergyEndcap_";
103  hcalDepEnergyEndcap =
104  ibooker.book1D(histname + AlgoName, "Energy deposited in the HCAL endcap cells", hadNoBin, hadNoMin, hadNoMax);
105  hcalDepEnergyEndcap->setAxisTitle("GeV");
106 
107  histname = "hadS9DepositedEnergyBarrel_";
108  hcalS9DepEnergyBarrel = ibooker.book1D(
109  histname + AlgoName, "Energy deposited in the HCAL barrel 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
110  hcalS9DepEnergyBarrel->setAxisTitle("GeV");
111  histname = "hadS9DepositedEnergyEndcap_";
112  hcalS9DepEnergyEndcap = ibooker.book1D(
113  histname + AlgoName, "Energy deposited in the HCAL endcap 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
114  hcalS9DepEnergyEndcap->setAxisTitle("GeV");
115  histname = "hadS9PointingMuDepositedEnergy_Glb_";
116  hcalS9PointingMuDepEnergy_Glb = ibooker.book1D(histname + AlgoName,
117  "Pointing glb muons energy deposited in the HCAL endcap 3*3 towers",
118  hadS9NoBin,
119  hadS9NoMin,
120  hadS9NoMax);
121  hcalS9PointingMuDepEnergy_Glb->setAxisTitle("GeV");
122  histname = "hadS9PointingMuDepositedEnergy_Tk_";
123  hcalS9PointingMuDepEnergy_Tk = ibooker.book1D(histname + AlgoName,
124  "Pointing tk muons energy deposited in the HCAL endcap 3*3 towers",
125  hadS9NoBin,
126  hadS9NoMin,
127  hadS9NoMax);
128  hcalS9PointingMuDepEnergy_Tk->setAxisTitle("GeV");
129  histname = "hadS9PointingMuDepositedEnergy_Sta_";
130  hcalS9PointingMuDepEnergy_Sta = ibooker.book1D(histname + AlgoName,
131  "Pointing sta muons energy deposited in the HCAL endcap 3*3 towers",
132  hadS9NoBin,
133  hadS9NoMin,
134  hadS9NoMax);
135  hcalS9PointingMuDepEnergy_Sta->setAxisTitle("GeV");
136 
137  histname = "hoDepositedEnergy_";
138  hoDepEnergy = ibooker.book1D(histname + AlgoName, "Energy deposited in the HO cells", hoNoBin, hoNoMin, hoNoMax);
139  hoDepEnergy->setAxisTitle("GeV");
140 
141  histname = "hoS9DepositedEnergy_";
142  hoS9DepEnergy =
143  ibooker.book1D(histname + AlgoName, "Energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
144  hoS9DepEnergy->setAxisTitle("GeV");
145  histname = "hoS9PointingMuDepositedEnergy_Glb_";
146  hoS9PointingMuDepEnergy_Glb = ibooker.book1D(
147  histname + AlgoName, "Pointing glb muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
148  hoS9PointingMuDepEnergy_Glb->setAxisTitle("GeV");
149  histname = "hoS9PointingMuDepositedEnergy_Tk_";
150  hoS9PointingMuDepEnergy_Tk = ibooker.book1D(
151  histname + AlgoName, "Pointing tk muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
152  hoS9PointingMuDepEnergy_Tk->setAxisTitle("GeV");
153  histname = "hoS9PointingMuDepositedEnergy_Sta_";
154  hoS9PointingMuDepEnergy_Sta = ibooker.book1D(
155  histname + AlgoName, "Pointing sta muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
156  hoS9PointingMuDepEnergy_Sta->setAxisTitle("GeV");
157 }
159  LogTrace(metname) << "[MuonEnergyDepositAnalyzer] Filling the histos";
160 
161  // Take the muon container
163  iEvent.getByToken(theMuonCollectionLabel_, muons);
164 
165  if (!muons.isValid())
166  return;
167 
168  for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu != muons->end(); ++recoMu) {
169  // get all the mu energy deposits
170  reco::MuonEnergy muEnergy = recoMu->calEnergy();
171 
172  // energy deposited in ECAL
173  LogTrace(metname) << "Energy deposited in ECAL: " << muEnergy.em;
174  if (fabs(recoMu->eta()) > 1.479)
175  ecalDepEnergyEndcap->Fill(muEnergy.em);
176  else
177  ecalDepEnergyBarrel->Fill(muEnergy.em);
178 
179  // energy deposited in HCAL
180  LogTrace(metname) << "Energy deposited in HCAL: " << muEnergy.had;
181  if (fabs(recoMu->eta()) > 1.4)
182  hcalDepEnergyEndcap->Fill(muEnergy.had);
183  else
184  hcalDepEnergyBarrel->Fill(muEnergy.had);
185 
186  // energy deposited in HO
187  LogTrace(metname) << "Energy deposited in HO: " << muEnergy.ho;
188  if (fabs(recoMu->eta()) < 1.26)
189  hoDepEnergy->Fill(muEnergy.ho);
190 
191  // energy deposited in ECAL in 3*3 towers
192  LogTrace(metname) << "Energy deposited in ECAL: " << muEnergy.emS9;
193  if (fabs(recoMu->eta()) > 1.479)
194  ecalS9DepEnergyEndcap->Fill(muEnergy.emS9);
195  else
196  ecalS9DepEnergyBarrel->Fill(muEnergy.emS9);
197 
198  // energy deposited in HCAL in 3*3 crystals
199  LogTrace(metname) << "Energy deposited in HCAL: " << muEnergy.hadS9;
200  if (fabs(recoMu->eta()) > 1.4)
201  hcalS9DepEnergyEndcap->Fill(muEnergy.hadS9);
202  else
203  hcalS9DepEnergyBarrel->Fill(muEnergy.hadS9);
204 
205  // energy deposited in HO in 3*3 crystals
206  LogTrace(metname) << "Energy deposited in HO: " << muEnergy.hoS9;
207  if (fabs(recoMu->eta()) < 1.26)
208  hoS9DepEnergy->Fill(muEnergy.hoS9);
209 
210  // plot for energy tests
212  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theB);
213  reco::TransientTrack TransTrack;
214 
215  if (recoMu->isGlobalMuon())
216  TransTrack = theB->build(recoMu->globalTrack());
217  else if ((recoMu->isTrackerMuon() || recoMu->isRPCMuon()))
218  TransTrack = theB->build(recoMu->innerTrack());
219  else if (recoMu->isStandAloneMuon())
220  TransTrack = theB->build(recoMu->outerTrack());
221  else
222  continue;
223 
225  TSOS = TransTrack.impactPointState();
226  // section for vertex pointing muon
227  if ((abs(TSOS.globalPosition().z()) < 30) && (abs(TSOS.globalPosition().perp()) < 20)) {
228  // GLB muon
229  if (recoMu->isGlobalMuon()) {
230  ecalS9PointingMuDepEnergy_Glb->Fill(muEnergy.emS9);
231  hcalS9PointingMuDepEnergy_Glb->Fill(muEnergy.hadS9);
232  hoS9PointingMuDepEnergy_Glb->Fill(muEnergy.hoS9);
233  }
234  // TK muon
235  else if (recoMu->isTrackerMuon()) {
236  ecalS9PointingMuDepEnergy_Tk->Fill(muEnergy.emS9);
237  hcalS9PointingMuDepEnergy_Tk->Fill(muEnergy.hadS9);
238  hoS9PointingMuDepEnergy_Tk->Fill(muEnergy.hoS9);
239  }
240  // STA muon
241  else if (recoMu->isStandAloneMuon()) {
242  ecalS9PointingMuDepEnergy_Sta->Fill(muEnergy.emS9);
243  hcalS9PointingMuDepEnergy_Sta->Fill(muEnergy.hadS9);
244  hoS9PointingMuDepEnergy_Sta->Fill(muEnergy.hoS9);
245  }
246  }
247  }
248 }
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
reco::MuonEnergy
Definition: MuonEnergy.h:17
Handle.h
MessageLogger.h
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
reco::MuonEnergy::had
float had
Definition: MuonEnergy.h:36
MuonEnergyDepositAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: MuonEnergyDepositAnalyzer.cc:158
TransientTrack.h
reco::MuonEnergy::hadS9
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
Definition: MuonEnergy.h:38
edm::Handle< reco::MuonCollection >
HLTSiStripMonitoring_cff.AlgoName
AlgoName
Definition: HLTSiStripMonitoring_cff.py:232
MuonEnergyDepositAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: MuonEnergyDepositAnalyzer.cc:55
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackFwd.h
TransientTrackRecord
Definition: TransientTrackRecord.h:11
edm::ESHandle< TransientTrackBuilder >
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
reco::MuonEnergy::ho
float ho
energy deposited in crossed HO towers
Definition: MuonEnergy.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonEnergyDepositAnalyzer::MuonEnergyDepositAnalyzer
MuonEnergyDepositAnalyzer(const edm::ParameterSet &)
Constructor.
Definition: MuonEnergyDepositAnalyzer.cc:24
reco::MuonEnergy::emS9
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:28
TransientTrackBuilder.h
edm::ParameterSet
Definition: ParameterSet.h:36
reco::TransientTrack::impactPointState
TrajectoryStateOnSurface impactPointState() const
Definition: TransientTrack.h:98
reco::MuonEnergy::hoS9
float hoS9
energy deposited in 3x3 HO tower shape around central tower
Definition: MuonEnergy.h:44
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
TransientTrackRecord.h
get
#define get
MuonEnergyDepositAnalyzer::~MuonEnergyDepositAnalyzer
~MuonEnergyDepositAnalyzer() override
Destructor.
Definition: MuonEnergyDepositAnalyzer.cc:54
std
Definition: JetResolutionObject.h:76
reco::TransientTrack
Definition: TransientTrack.h:19
dqm::implementation::IBooker
Definition: DQMStore.h:43
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
edm::Event
Definition: Event.h:73
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
reco::MuonEnergy::em
float em
Definition: MuonEnergy.h:26
MuonEnergyDepositAnalyzer.h
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
TSOS
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
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
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43