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  : trasientTrackToken_(
26  esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"))) {
27  parameters = pSet;
28 
29  theMuonCollectionLabel_ = consumes<reco::MuonCollection>(parameters.getParameter<InputTag>("MuonCollection"));
30 
32  emNoBin = parameters.getParameter<int>("emSizeBin");
33  emNoMin = parameters.getParameter<double>("emSizeMin");
34  emNoMax = parameters.getParameter<double>("emSizeMax");
35 
36  hadNoBin = parameters.getParameter<int>("hadSizeBin");
37  hadNoMin = parameters.getParameter<double>("hadSizeMin");
38  hadNoMax = parameters.getParameter<double>("hadSizeMax");
39 
40  emS9NoBin = parameters.getParameter<int>("emS9SizeBin");
41  emS9NoMin = parameters.getParameter<double>("emS9SizeMin");
42  emS9NoMax = parameters.getParameter<double>("emS9SizeMax");
43 
44  hadS9NoBin = parameters.getParameter<int>("hadS9SizeBin");
45  hadS9NoMin = parameters.getParameter<double>("hadS9SizeMin");
46  hadS9NoMax = parameters.getParameter<double>("hadS9SizeMax");
47 
48  hoNoBin = parameters.getParameter<int>("hoSizeBin");
49  hoNoMin = parameters.getParameter<double>("hoSizeMin");
50  hoNoMax = parameters.getParameter<double>("hoSizeMax");
51 
52  hoS9NoBin = parameters.getParameter<int>("hoS9SizeBin");
53  hoS9NoMin = parameters.getParameter<double>("hoS9SizeMin");
54  hoS9NoMax = parameters.getParameter<double>("hoS9SizeMax");
55 }
58  edm::Run const& /*iRun*/,
59  edm::EventSetup const& /* iSetup */) {
60  ibooker.cd();
61  ibooker.setCurrentFolder("Muons/MuonEnergyDepositAnalyzer");
62 
63  std::string histname = "ecalDepositedEnergyBarrel_";
65  ibooker.book1D(histname + AlgoName, "Energy deposited in the ECAL barrel cells", emNoBin, emNoMin, emNoMax);
67 
68  histname = "ecalDepositedEnergyEndcap_";
70  ibooker.book1D(histname + AlgoName, "Energy deposited in the ECAL endcap cells", emNoBin, emNoMin, emNoMax);
72 
73  histname = "ecalS9DepositedEnergyBarrel_";
74  ecalS9DepEnergyBarrel = ibooker.book1D(
75  histname + AlgoName, "Energy deposited in the ECAL barrel 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
77  histname = "ecalS9DepositedEnergyEndcap_";
78  ecalS9DepEnergyEndcap = ibooker.book1D(
79  histname + AlgoName, "Energy deposited in the ECAL endcap 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
81  histname = "ecalS9PointingMuDepositedEnergy_Glb_";
82  ecalS9PointingMuDepEnergy_Glb = ibooker.book1D(histname + AlgoName,
83  "Pointing glb muons energy deposited in the ECAL 3*3 towers",
84  emS9NoBin,
85  emS9NoMin,
86  emS9NoMax);
88  histname = "ecalS9PointingMuDepositedEnergy_Tk_";
90  histname + AlgoName, "Pointing tk muons energy deposited in the ECAL 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
92  histname = "ecalS9PointingMuDepositedEnergy_Sta_";
93  ecalS9PointingMuDepEnergy_Sta = ibooker.book1D(histname + AlgoName,
94  "Pointing sta muons energy deposited in the ECAL 3*3 towers",
95  emS9NoBin,
96  emS9NoMin,
97  emS9NoMax);
99 
100  histname = "hadDepositedEnergyBarrel_";
102  ibooker.book1D(histname + AlgoName, "Energy deposited in the HCAL barrel cells", hadNoBin, hadNoMin, hadNoMax);
104  histname = "hadDepositedEnergyEndcap_";
106  ibooker.book1D(histname + AlgoName, "Energy deposited in the HCAL endcap cells", hadNoBin, hadNoMin, hadNoMax);
108 
109  histname = "hadS9DepositedEnergyBarrel_";
110  hcalS9DepEnergyBarrel = ibooker.book1D(
111  histname + AlgoName, "Energy deposited in the HCAL barrel 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
113  histname = "hadS9DepositedEnergyEndcap_";
114  hcalS9DepEnergyEndcap = ibooker.book1D(
115  histname + AlgoName, "Energy deposited in the HCAL endcap 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
117  histname = "hadS9PointingMuDepositedEnergy_Glb_";
118  hcalS9PointingMuDepEnergy_Glb = ibooker.book1D(histname + AlgoName,
119  "Pointing glb muons energy deposited in the HCAL endcap 3*3 towers",
120  hadS9NoBin,
121  hadS9NoMin,
122  hadS9NoMax);
124  histname = "hadS9PointingMuDepositedEnergy_Tk_";
125  hcalS9PointingMuDepEnergy_Tk = ibooker.book1D(histname + AlgoName,
126  "Pointing tk muons energy deposited in the HCAL endcap 3*3 towers",
127  hadS9NoBin,
128  hadS9NoMin,
129  hadS9NoMax);
131  histname = "hadS9PointingMuDepositedEnergy_Sta_";
132  hcalS9PointingMuDepEnergy_Sta = ibooker.book1D(histname + AlgoName,
133  "Pointing sta muons energy deposited in the HCAL endcap 3*3 towers",
134  hadS9NoBin,
135  hadS9NoMin,
136  hadS9NoMax);
138 
139  histname = "hoDepositedEnergy_";
140  hoDepEnergy = ibooker.book1D(histname + AlgoName, "Energy deposited in the HO cells", hoNoBin, hoNoMin, hoNoMax);
141  hoDepEnergy->setAxisTitle("GeV");
142 
143  histname = "hoS9DepositedEnergy_";
144  hoS9DepEnergy =
145  ibooker.book1D(histname + AlgoName, "Energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
146  hoS9DepEnergy->setAxisTitle("GeV");
147  histname = "hoS9PointingMuDepositedEnergy_Glb_";
149  histname + AlgoName, "Pointing glb muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
151  histname = "hoS9PointingMuDepositedEnergy_Tk_";
153  histname + AlgoName, "Pointing tk muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
155  histname = "hoS9PointingMuDepositedEnergy_Sta_";
157  histname + AlgoName, "Pointing sta muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
159 }
161  LogTrace(metname) << "[MuonEnergyDepositAnalyzer] Filling the histos";
162 
163  // Take the muon container
165  iEvent.getByToken(theMuonCollectionLabel_, muons);
166 
167  if (!muons.isValid())
168  return;
169 
170  for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu != muons->end(); ++recoMu) {
171  // get all the mu energy deposits
172  reco::MuonEnergy muEnergy = recoMu->calEnergy();
173 
174  // energy deposited in ECAL
175  LogTrace(metname) << "Energy deposited in ECAL: " << muEnergy.em;
176  if (fabs(recoMu->eta()) > 1.479)
177  ecalDepEnergyEndcap->Fill(muEnergy.em);
178  else
179  ecalDepEnergyBarrel->Fill(muEnergy.em);
180 
181  // energy deposited in HCAL
182  LogTrace(metname) << "Energy deposited in HCAL: " << muEnergy.had;
183  if (fabs(recoMu->eta()) > 1.4)
184  hcalDepEnergyEndcap->Fill(muEnergy.had);
185  else
186  hcalDepEnergyBarrel->Fill(muEnergy.had);
187 
188  // energy deposited in HO
189  LogTrace(metname) << "Energy deposited in HO: " << muEnergy.ho;
190  if (fabs(recoMu->eta()) < 1.26)
191  hoDepEnergy->Fill(muEnergy.ho);
192 
193  // energy deposited in ECAL in 3*3 towers
194  LogTrace(metname) << "Energy deposited in ECAL: " << muEnergy.emS9;
195  if (fabs(recoMu->eta()) > 1.479)
196  ecalS9DepEnergyEndcap->Fill(muEnergy.emS9);
197  else
198  ecalS9DepEnergyBarrel->Fill(muEnergy.emS9);
199 
200  // energy deposited in HCAL in 3*3 crystals
201  LogTrace(metname) << "Energy deposited in HCAL: " << muEnergy.hadS9;
202  if (fabs(recoMu->eta()) > 1.4)
203  hcalS9DepEnergyEndcap->Fill(muEnergy.hadS9);
204  else
205  hcalS9DepEnergyBarrel->Fill(muEnergy.hadS9);
206 
207  // energy deposited in HO in 3*3 crystals
208  LogTrace(metname) << "Energy deposited in HO: " << muEnergy.hoS9;
209  if (fabs(recoMu->eta()) < 1.26)
210  hoS9DepEnergy->Fill(muEnergy.hoS9);
211 
212  // plot for energy tests
213 
215 
216  reco::TransientTrack TransTrack;
217 
218  if (recoMu->isGlobalMuon())
219  TransTrack = theB->build(recoMu->globalTrack());
220  else if ((recoMu->isTrackerMuon() || recoMu->isRPCMuon()))
221  TransTrack = theB->build(recoMu->innerTrack());
222  else if (recoMu->isStandAloneMuon())
223  TransTrack = theB->build(recoMu->outerTrack());
224  else
225  continue;
226 
228  TSOS = TransTrack.impactPointState();
229  // section for vertex pointing muon
230  if ((abs(TSOS.globalPosition().z()) < 30) && (abs(TSOS.globalPosition().perp()) < 20)) {
231  // GLB muon
232  if (recoMu->isGlobalMuon()) {
236  }
237  // TK muon
238  else if (recoMu->isTrackerMuon()) {
242  }
243  // STA muon
244  else if (recoMu->isStandAloneMuon()) {
248  }
249  }
250  }
251 }
MuonEnergyDepositAnalyzer(const edm::ParameterSet &)
Constructor.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T perp() const
Definition: PV3DBase.h:69
edm::ESHandle< TransientTrackBuilder > theB
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
T z() const
Definition: PV3DBase.h:61
~MuonEnergyDepositAnalyzer() override
Destructor.
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:28
#define LogTrace(id)
float ho
energy deposited in crossed HO towers
Definition: MuonEnergy.h:42
reco::TransientTrack build(const reco::Track *p) const
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
GlobalPoint globalPosition() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > trasientTrackToken_
float hoS9
energy deposited in 3x3 HO tower shape around central tower
Definition: MuonEnergy.h:44
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
MonitorElement * ecalS9PointingMuDepEnergy_Sta
edm::EDGetTokenT< reco::MuonCollection > theMuonCollectionLabel_
MonitorElement * ecalS9PointingMuDepEnergy_Tk
MonitorElement * hcalS9PointingMuDepEnergy_Tk
HLT enums.
MonitorElement * hoS9PointingMuDepEnergy_Glb
MonitorElement * hcalS9PointingMuDepEnergy_Glb
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * ecalS9PointingMuDepEnergy_Glb
MonitorElement * hcalS9PointingMuDepEnergy_Sta
void analyze(const edm::Event &, const edm::EventSetup &) override
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
Definition: MuonEnergy.h:38
TrajectoryStateOnSurface impactPointState() const
Definition: Run.h:45
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)