CMS 3D CMS Logo

RPCRecHitProbability.cc
Go to the documentation of this file.
1 #include <sstream>
2 #include <TMath.h>
4 //Geometry
7 //Tracking Tools
9 //FW Core
11 //Reco Muon
13 
15  saveRootFile = pset.getUntrackedParameter<bool>("SaveRootFile", false);
16  RootFileName = pset.getUntrackedParameter<std::string>("RootFileName", "RPCRecHitProbabilityDQM.root");
17 
18  muonLabel_ = consumes<reco::CandidateView>(pset.getParameter<edm::InputTag>("MuonLabel"));
19  muPtCut_ = pset.getUntrackedParameter<double>("MuonPtCut", 3.0);
20  muEtaCut_ = pset.getUntrackedParameter<double>("MuonEtaCut", 1.9);
21  scalersRawToDigiLabel_ = consumes<DcsStatusCollection>(pset.getParameter<edm::InputTag>("ScalersRawToDigiLabel"));
22 
23  subsystemFolder_ = pset.getUntrackedParameter<std::string>("RPCFolder", "RPC");
24  globalFolder_ = pset.getUntrackedParameter<std::string>("GlobalFolder", "SummaryHistograms");
25  muonFolder_ = pset.getUntrackedParameter<std::string>("MuonFolder", "Muon");
26 }
27 
29 
31  edm::Run const& r,
32  edm::EventSetup const& iSetup) {
33  edm::LogInfo("rpcrechitprobability") << "[RPCRecHitProbability]: Begin Run ";
34 
35  std::string currentFolder = subsystemFolder_ + "/" + muonFolder_ + "/" + globalFolder_;
36  ibooker.setCurrentFolder(currentFolder);
37 
38  int ptBins = 100 - (int)muPtCut_;
39 
40  //General part
41  NumberOfMuonEta_ = ibooker.book1D("NumberOfMuonEta", "Muons vs Eta", 20 * muEtaCut_, -muEtaCut_, muEtaCut_);
42  NumberOfMuonPt_B_ = ibooker.book1D("NumberOfMuonPt_Barrel", "Muons vs Pt - Barrel", ptBins, muPtCut_, 100);
43  NumberOfMuonPt_EP_ = ibooker.book1D("NumberOfMuonPt_EndcapP", "Muons vs Pt - Endcap+", ptBins, muPtCut_, 100);
44  NumberOfMuonPt_EM_ = ibooker.book1D("NumberOfMuonPt_EndcapM", "Muons vs Pt - Endcap-", ptBins, muPtCut_, 100);
46  ibooker.book1D("NumberOfMuonPhi_Barrel", "Muons vs Phi - Barrel", 144, -TMath::Pi(), TMath::Pi());
48  ibooker.book1D("NumberOfMuonPhi_EndcapP", "Muons vs Phi - Endcap+", 144, -TMath::Pi(), TMath::Pi());
50  ibooker.book1D("NumberOfMuonPhi_EndcapM", "Muons vs Phi - Endcap-", 144, -TMath::Pi(), TMath::Pi());
51 
52  //RPC part
53  RPCRecHitMuonEta_ = ibooker.book2D(
54  "RPCRecHitMuonEta", "Number Of RecHits per Muons vs Eta", 20 * muEtaCut_, -muEtaCut_, muEtaCut_, 7, 0.5, 7.5);
55 
56  std::stringstream name, title;
57  for (int i = 0; i < 6; i++) {
58  name.str("");
59  title.str("");
60  name << (i + 1) << "RecHitMuonEta";
61  title << "At least " << (i + 1) << " Cluster vs Eta";
62  recHitEta_[i] = ibooker.book1D(name.str(), title.str(), 20 * muEtaCut_, -muEtaCut_, muEtaCut_);
63 
64  name.str("");
65  title.str("");
66  name << (i + 1) << "RecHitMuonPhiB";
67  title << "At least " << (i + 1) << " Cluster vs Phi-Barrel";
68  recHitPhi_B_[i] = ibooker.book1D(name.str(), title.str(), 144, -TMath::Pi(), TMath::Pi());
69 
70  name.str("");
71  title.str("");
72  name << (i + 1) << "RecHitMuonPtB";
73  title << "At least " << (i + 1) << " Cluster vs Pt-Barrel";
74  recHitPt_B_[i] = ibooker.book1D(name.str(), title.str(), ptBins, muPtCut_, 100);
75 
76  name.str("");
77  title.str("");
78  name << (i + 1) << "RecHitMuonPhiEP";
79  title << "At least " << (i + 1) << " Cluster vs Phi-Endcap+";
80  recHitPhi_EP_[i] = ibooker.book1D(name.str(), title.str(), 144, -TMath::Pi(), TMath::Pi());
81 
82  name.str("");
83  title.str("");
84  name << (i + 1) << "RecHitMuonPtEP";
85  title << "At least " << (i + 1) << " Cluster vs Pt-Endcap+";
86  recHitPt_EP_[i] = ibooker.book1D(name.str(), title.str(), ptBins, muPtCut_, 100);
87 
88  name.str("");
89  title.str("");
90  name << (i + 1) << "RecHitMuonPhiEM";
91  title << "At least " << (i + 1) << " Cluster vs Phi-Endcap-";
92  recHitPhi_EM_[i] = ibooker.book1D(name.str(), title.str(), 144, -TMath::Pi(), TMath::Pi());
93 
94  name.str("");
95  title.str("");
96  name << (i + 1) << "RecHitMuonPtEM";
97  title << "At least " << (i + 1) << " Cluster vs Pt-Endcap-";
98  recHitPt_EM_[i] = ibooker.book1D(name.str(), title.str(), ptBins, muPtCut_, 100);
99  }
100 
101  dcs_ = true;
102 }
103 
105  dcs_ = true;
106  //Check HV status
107  this->makeDcsInfo(event);
108  if (!dcs_) {
109  edm::LogWarning("rpcrechitprobability") << "[RPCRecHitProbability]: DCS bit OFF";
110  return; //if RPC not ON there's no need to continue
111  }
112 
113  counter++;
114  edm::LogInfo("rpcrechitprobability") << "[RPCRecHitProbability]: Beginning analyzing event " << counter;
115 
116  //Muons
118  event.getByToken(muonLabel_, muonCands);
119  std::map<RPCDetId, std::vector<RPCRecHit> > rechitMuon;
120 
121  if (muonCands.isValid()) {
122  int nStaMuons = muonCands->size();
123 
124  for (int i = 0; i < nStaMuons; i++) {
125  const reco::Candidate& goodMuon = (*muonCands)[i];
126  const reco::Muon* muCand = dynamic_cast<const reco::Muon*>(&goodMuon);
127 
128  if (!muCand->isGlobalMuon())
129  continue;
130  float eta = muCand->eta();
131  float pt = muCand->pt();
132  if (pt < muPtCut_ || fabs(eta) > muEtaCut_)
133  continue;
134 
135  float phi = muCand->phi();
136 
138 
139  if (eta > 0.8) {
142  } else if (eta < -0.8) {
145  } else {
148  }
149 
150  reco::Track muTrack = (*(muCand->outerTrack()));
151  std::vector<TrackingRecHitRef> rpcTrackRecHits;
152 
153  //loop on mu rechits
154 
155  int recHitCounter = 0;
156  for (trackingRecHit_iterator it = muTrack.recHitsBegin(); it != muTrack.recHitsEnd(); it++) {
157  if (!(*it)->isValid())
158  continue;
159  int muSubDetId = (*it)->geographicalId().subdetId();
160  if (muSubDetId == MuonSubdetId::RPC) {
161  recHitCounter++;
162  }
163  } // end loop on mu rechits
164 
165  RPCRecHitMuonEta_->Fill(eta, recHitCounter);
166 
167  int j = 0;
168  while (recHitCounter >= j + 1 && j < 6) {
169  if (recHitEta_[j])
170  recHitEta_[j]->Fill(eta);
171  if (eta > 0.8) {
172  recHitPt_EP_[j]->Fill(pt);
173  recHitPhi_EP_[j]->Fill(phi);
174  } else if (eta < -0.8) {
175  recHitPt_EM_[j]->Fill(pt);
176  recHitPhi_EM_[j]->Fill(phi);
177  } else {
178  recHitPt_B_[j]->Fill(pt);
179  recHitPhi_B_[j]->Fill(phi);
180  }
181 
182  j++;
183  }
184  }
185  } else {
186  edm::LogError("rpcrechitprobability") << "[RPCRecHitProbability]: Muons - Product not valid for event" << counter;
187  }
188 }
189 
192 
193  if (!e.getByToken(scalersRawToDigiLabel_, dcsStatus)) {
194  dcs_ = true;
195  return;
196  }
197 
198  if (!dcsStatus.isValid()) {
199  edm::LogWarning("RPCDcsInfo") << "scalersRawToDigi not found";
200  dcs_ = true; // info not available: set to true
201  return;
202  }
203 
204  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); dcsStatusItr != dcsStatus->end();
205  ++dcsStatusItr) {
206  if (!dcsStatusItr->ready(DcsStatus::RPC))
207  dcs_ = false;
208  }
209 
210  return;
211 }
RPCRecHitProbability::globalFolder_
std::string globalFolder_
Definition: RPCRecHitProbability.h:37
counter
Definition: counter.py:1
RPCRecHitProbability::~RPCRecHitProbability
~RPCRecHitProbability() override
Definition: RPCRecHitProbability.cc:28
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
RPCRecHitProbability::NumberOfMuonPhi_EM_
MonitorElement * NumberOfMuonPhi_EM_
Definition: RPCRecHitProbability.h:48
reco::Track::recHitsBegin
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
RPCRecHitProbability::recHitPhi_EP_
MonitorElement * recHitPhi_EP_[6]
Definition: RPCRecHitProbability.h:56
RPCRecHitProbability::saveRootFile
bool saveRootFile
Definition: RPCRecHitProbability.h:40
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
RPCRecHitProbability::muonLabel_
edm::EDGetTokenT< reco::CandidateView > muonLabel_
Definition: RPCRecHitProbability.h:60
edm::Run
Definition: Run.h:45
RPCRecHitProbability::muonFolder_
std::string muonFolder_
Definition: RPCRecHitProbability.h:31
edm::LogInfo
Definition: MessageLogger.h:254
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
RPCRecHitProbability::RPCRecHitProbability
RPCRecHitProbability(const edm::ParameterSet &)
Definition: RPCRecHitProbability.cc:14
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
MuonTransientTrackingRecHit.h
TransientTrack.h
edm::Handle
Definition: AssociativeIterator.h:50
RPCRecHitProbability::recHitPt_EP_
MonitorElement * recHitPt_EP_[6]
Definition: RPCRecHitProbability.h:55
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
reco::Muon
Definition: Muon.h:27
RPCRecHitProbability::counter
int counter
Definition: RPCRecHitProbability.h:32
PVValHelper::eta
Definition: PVValidationHelpers.h:69
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
reco::Track::recHitsEnd
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
RPCRecHitProbability.h
reco::Track
Definition: Track.h:27
reco::Muon::outerTrack
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:48
RPCRecHitProbability::subsystemFolder_
std::string subsystemFolder_
Definition: RPCRecHitProbability.h:38
RPCRecHitProbability::muEtaCut_
float muEtaCut_
Definition: RPCRecHitProbability.h:35
RPCRecHitProbability::NumberOfMuonPt_EP_
MonitorElement * NumberOfMuonPt_EP_
Definition: RPCRecHitProbability.h:45
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View::size
size_type size() const
edm::LogWarning
Definition: MessageLogger.h:141
reco::Muon::isGlobalMuon
bool isGlobalMuon() const override
Definition: Muon.h:299
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
RPCRecHitProbability::RPCRecHitMuonEta_
MonitorElement * RPCRecHitMuonEta_
Definition: RPCRecHitProbability.h:50
RPCRecHitProbability::recHitEta_
MonitorElement * recHitEta_[6]
Definition: RPCRecHitProbability.h:52
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup
Definition: EventSetup.h:57
RPCRecHitProbability::recHitPhi_EM_
MonitorElement * recHitPhi_EM_[6]
Definition: RPCRecHitProbability.h:58
RPCRecHitProbability::scalersRawToDigiLabel_
edm::EDGetTokenT< DcsStatusCollection > scalersRawToDigiLabel_
Definition: RPCRecHitProbability.h:61
RPCRecHitProbability::muPtCut_
float muPtCut_
Definition: RPCRecHitProbability.h:35
reco::Candidate
Definition: Candidate.h:27
alignCSCRings.r
r
Definition: alignCSCRings.py:93
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
RPCRecHitProbability::NumberOfMuonPt_EM_
MonitorElement * NumberOfMuonPt_EM_
Definition: RPCRecHitProbability.h:47
DDAxes::phi
RPCRecHitProbability::NumberOfMuonPhi_EP_
MonitorElement * NumberOfMuonPhi_EP_
Definition: RPCRecHitProbability.h:46
RPCRecHitProbability::NumberOfMuonPt_B_
MonitorElement * NumberOfMuonPt_B_
Definition: RPCRecHitProbability.h:43
GeomDet.h
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
RPCRecHitProbability::recHitPt_B_
MonitorElement * recHitPt_B_[6]
Definition: RPCRecHitProbability.h:53
MuonSubdetId::RPC
static constexpr int RPC
Definition: MuonSubdetId.h:13
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
RPCRecHitProbability::recHitPt_EM_
MonitorElement * recHitPt_EM_[6]
Definition: RPCRecHitProbability.h:57
RPCRecHitProbability::dcs_
bool dcs_
Definition: RPCRecHitProbability.h:34
RPCRecHitProbability::NumberOfMuonPhi_B_
MonitorElement * NumberOfMuonPhi_B_
Definition: RPCRecHitProbability.h:44
RPCRecHitProbability::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: RPCRecHitProbability.cc:30
RPCRecHitProbability::NumberOfMuonEta_
MonitorElement * NumberOfMuonEta_
Definition: RPCRecHitProbability.h:49
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
RPCRecHitProbability::makeDcsInfo
void makeDcsInfo(const edm::Event &)
Definition: RPCRecHitProbability.cc:190
RPCRecHitProbability::recHitPhi_B_
MonitorElement * recHitPhi_B_[6]
Definition: RPCRecHitProbability.h:54
DcsStatus::RPC
Definition: DcsStatus.h:43
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
RPCRecHitProbability::RootFileName
std::string RootFileName
Definition: RPCRecHitProbability.h:41
RPCRecHitProbability::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: RPCRecHitProbability.cc:104
MuonGeometryRecord.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
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
L1EGammaCrystalsEmulatorProducer_cfi.ptBins
ptBins
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:9
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37