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 }
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
reco::MuonEnergy
Definition: MuonEnergy.h:17
Handle.h
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
MuonEnergyDepositAnalyzer::hoS9NoMax
double hoS9NoMax
Definition: MuonEnergyDepositAnalyzer.h:79
MuonEnergyDepositAnalyzer::hadS9NoMin
double hadS9NoMin
Definition: MuonEnergyDepositAnalyzer.h:70
MuonEnergyDepositAnalyzer::hadS9NoBin
int hadS9NoBin
Definition: MuonEnergyDepositAnalyzer.h:69
edm::Run
Definition: Run.h:45
MuonEnergyDepositAnalyzer::emS9NoBin
int emS9NoBin
Definition: MuonEnergyDepositAnalyzer.h:61
MuonEnergyDepositAnalyzer::hcalDepEnergyBarrel
MonitorElement * hcalDepEnergyBarrel
Definition: MuonEnergyDepositAnalyzer.h:84
edm
HLT enums.
Definition: AlignableModifier.h:19
MuonEnergyDepositAnalyzer::ecalS9PointingMuDepEnergy_Sta
MonitorElement * ecalS9PointingMuDepEnergy_Sta
Definition: MuonEnergyDepositAnalyzer.h:98
MuonEnergyDepositAnalyzer::theMuonCollectionLabel_
edm::EDGetTokenT< reco::MuonCollection > theMuonCollectionLabel_
Definition: MuonEnergyDepositAnalyzer.h:46
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
MuonEnergyDepositAnalyzer::hoS9DepEnergy
MonitorElement * hoS9DepEnergy
Definition: MuonEnergyDepositAnalyzer.h:91
MuonEnergyDepositAnalyzer::hoS9NoMin
double hoS9NoMin
Definition: MuonEnergyDepositAnalyzer.h:78
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:160
MuonEnergyDepositAnalyzer::hadS9NoMax
double hadS9NoMax
Definition: MuonEnergyDepositAnalyzer.h:71
TransientTrack.h
reco::MuonEnergy::hadS9
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
Definition: MuonEnergy.h:38
MuonEnergyDepositAnalyzer::hoNoMin
double hoNoMin
Definition: MuonEnergyDepositAnalyzer.h:74
MuonEnergyDepositAnalyzer::hcalS9PointingMuDepEnergy_Tk
MonitorElement * hcalS9PointingMuDepEnergy_Tk
Definition: MuonEnergyDepositAnalyzer.h:96
edm::Handle< reco::MuonCollection >
MuonEnergyDepositAnalyzer::hoNoMax
double hoNoMax
Definition: MuonEnergyDepositAnalyzer.h:75
MuonEnergyDepositAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: MuonEnergyDepositAnalyzer.cc:57
MuonEnergyDepositAnalyzer::emNoBin
int emNoBin
Definition: MuonEnergyDepositAnalyzer.h:57
MuonEnergyDepositAnalyzer::hoS9PointingMuDepEnergy_Glb
MonitorElement * hoS9PointingMuDepEnergy_Glb
Definition: MuonEnergyDepositAnalyzer.h:94
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
MuonEnergyDepositAnalyzer::hcalS9PointingMuDepEnergy_Glb
MonitorElement * hcalS9PointingMuDepEnergy_Glb
Definition: MuonEnergyDepositAnalyzer.h:93
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
Track.h
TrackFwd.h
MuonEnergyDepositAnalyzer::hoDepEnergy
MonitorElement * hoDepEnergy
Definition: MuonEnergyDepositAnalyzer.h:90
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
MuonEnergyDepositAnalyzer::ecalS9PointingMuDepEnergy_Glb
MonitorElement * ecalS9PointingMuDepEnergy_Glb
Definition: MuonEnergyDepositAnalyzer.h:92
MuonEnergyDepositAnalyzer::ecalS9PointingMuDepEnergy_Tk
MonitorElement * ecalS9PointingMuDepEnergy_Tk
Definition: MuonEnergyDepositAnalyzer.h:95
TransientTrackRecord
Definition: TransientTrackRecord.h:11
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
MuonEnergyDepositAnalyzer::hoS9NoBin
int hoS9NoBin
Definition: MuonEnergyDepositAnalyzer.h:77
reco::MuonEnergy::ho
float ho
energy deposited in crossed HO towers
Definition: MuonEnergy.h:42
MuonEnergyDepositAnalyzer::emNoMax
double emNoMax
Definition: MuonEnergyDepositAnalyzer.h:59
MuonEnergyDepositAnalyzer::hoNoBin
int hoNoBin
Definition: MuonEnergyDepositAnalyzer.h:73
MuonEnergyDepositAnalyzer::hcalS9DepEnergyEndcap
MonitorElement * hcalS9DepEnergyEndcap
Definition: MuonEnergyDepositAnalyzer.h:89
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:47
MuonEnergyDepositAnalyzer::ecalDepEnergyEndcap
MonitorElement * ecalDepEnergyEndcap
Definition: MuonEnergyDepositAnalyzer.h:86
MuonEnergyDepositAnalyzer::theB
edm::ESHandle< TransientTrackBuilder > theB
Definition: MuonEnergyDepositAnalyzer.h:48
reco::TransientTrack::impactPointState
TrajectoryStateOnSurface impactPointState() const
Definition: TransientTrack.h:96
MuonEnergyDepositAnalyzer::hcalS9PointingMuDepEnergy_Sta
MonitorElement * hcalS9PointingMuDepEnergy_Sta
Definition: MuonEnergyDepositAnalyzer.h:99
MuonEnergyDepositAnalyzer::hadNoMin
double hadNoMin
Definition: MuonEnergyDepositAnalyzer.h:66
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
MuonEnergyDepositAnalyzer::ecalDepEnergyBarrel
MonitorElement * ecalDepEnergyBarrel
Definition: MuonEnergyDepositAnalyzer.h:82
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
MuonEnergyDepositAnalyzer::AlgoName
std::string AlgoName
Definition: MuonEnergyDepositAnalyzer.h:54
MuonEnergyDepositAnalyzer::hadNoBin
int hadNoBin
Definition: MuonEnergyDepositAnalyzer.h:65
TransientTrackBuilder
Definition: TransientTrackBuilder.h:16
MuonEnergyDepositAnalyzer::ecalS9DepEnergyBarrel
MonitorElement * ecalS9DepEnergyBarrel
Definition: MuonEnergyDepositAnalyzer.h:83
edm::EventSetup
Definition: EventSetup.h:58
TransientTrackRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonEnergyDepositAnalyzer::emNoMin
double emNoMin
Definition: MuonEnergyDepositAnalyzer.h:58
MuonEnergyDepositAnalyzer::~MuonEnergyDepositAnalyzer
~MuonEnergyDepositAnalyzer() override
Destructor.
Definition: MuonEnergyDepositAnalyzer.cc:56
std
Definition: JetResolutionObject.h:76
reco::TransientTrack
Definition: TransientTrack.h:19
MuonEnergyDepositAnalyzer::emS9NoMin
double emS9NoMin
Definition: MuonEnergyDepositAnalyzer.h:62
MuonEnergyDepositAnalyzer::hcalDepEnergyEndcap
MonitorElement * hcalDepEnergyEndcap
Definition: MuonEnergyDepositAnalyzer.h:88
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
MuonEnergyDepositAnalyzer::trasientTrackToken_
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > trasientTrackToken_
Definition: MuonEnergyDepositAnalyzer.h:50
MuonEnergyDepositAnalyzer::hoS9PointingMuDepEnergy_Sta
MonitorElement * hoS9PointingMuDepEnergy_Sta
Definition: MuonEnergyDepositAnalyzer.h:100
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
MuonEnergyDepositAnalyzer::ecalS9DepEnergyEndcap
MonitorElement * ecalS9DepEnergyEndcap
Definition: MuonEnergyDepositAnalyzer.h:87
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
MuonEnergyDepositAnalyzer::parameters
edm::ParameterSet parameters
Definition: MuonEnergyDepositAnalyzer.h:45
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
MuonEnergyDepositAnalyzer::emS9NoMax
double emS9NoMax
Definition: MuonEnergyDepositAnalyzer.h:63
edm::Event
Definition: Event.h:73
MuonEnergyDepositAnalyzer::hcalS9DepEnergyBarrel
MonitorElement * hcalS9DepEnergyBarrel
Definition: MuonEnergyDepositAnalyzer.h:85
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:791
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
MuonEnergyDepositAnalyzer::metname
std::string metname
Definition: MuonEnergyDepositAnalyzer.h:53
MuonEnergyDepositAnalyzer::hadNoMax
double hadNoMax
Definition: MuonEnergyDepositAnalyzer.h:67
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
MuonEnergyDepositAnalyzer::hoS9PointingMuDepEnergy_Tk
MonitorElement * hoS9PointingMuDepEnergy_Tk
Definition: MuonEnergyDepositAnalyzer.h:97