CMS 3D CMS Logo

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