CMS 3D CMS Logo

GEMRecHitSource.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace edm;
5 
7  tagRecHit_ = consumes<GEMRecHitCollection>(cfg.getParameter<edm::InputTag>("recHitsInputLabel"));
8 
9  nIdxFirstDigi_ = cfg.getParameter<int>("idxFirstDigi");
10  nClusterSizeBinNum_ = cfg.getParameter<int>("ClusterSizeBinNum");
11  bModeRelVal_ = cfg.getParameter<bool>("modeRelVal");
12 }
13 
16  desc.add<edm::InputTag>("recHitsInputLabel", edm::InputTag("gemRecHits", ""));
17 
18  desc.add<int>("idxFirstDigi", 0);
19  desc.add<int>("ClusterSizeBinNum", 9);
20  desc.add<bool>("modeRelVal", false);
21 
22  desc.addUntracked<std::string>("logCategory", "GEMRecHitSource");
23 
24  descriptions.add("GEMRecHitSource", desc);
25 }
26 
28  std::vector<GEMDetId> listLayerOcc;
29 
30  initGeometry(iSetup);
31  if (GEMGeometry_ == nullptr)
32  return;
33  loadChambers();
34 
35  ibooker.cd();
36  ibooker.setCurrentFolder("GEM/RecHits");
37 
38  nCLSMax_ = 10;
39  fRadiusMin_ = 120.0;
40  fRadiusMax_ = 250.0;
41  float radS = -5.0 / 180 * 3.141592;
42  float radL = 355.0 / 180 * 3.141592;
43 
44  mapTotalRecHit_layer_ = MEMap3Inf(this, "det", "RecHit Occupancy", 36, 0.5, 36.5, 8, 0.5, 8.5, "Chamber", "iEta");
46  this, "rphi_occ", "RecHit R-Phi Occupancy", 108, radS, radL, 8, fRadiusMin_, fRadiusMax_, "#phi (rad)", "R [cm]");
47  mapRecHitOcc_ieta_ = MEMap3Inf(this, "occ_ieta", "RecHit iEta Occupancy", 8, 0.5, 8.5, "iEta", "Number of RecHits");
49  MEMap3Inf(this, "occ_phi", "RecHit Phi Occupancy", 108, -5, 355, "#phi (degree)", "Number of RecHits");
51  "rechits_per_layer",
52  "Total number of RecHits per event for each layers",
53  50,
54  -0.5,
55  99.5,
56  "Number of RecHits",
57  "Events");
59  "rechits_per_ieta",
60  "Total number of RecHits per event for each eta partitions",
61  50,
62  -0.5,
63  99.5,
64  "Number of RecHits",
65  "Events");
67  this, "cls", "Cluster size of RecHits", nCLSMax_, 0.5, nCLSMax_ + 0.5, "Cluster size", "Number of RecHits");
68  mapCLSAverage_ = MEMap3Inf(this, // TProfile2D
69  "rechit_average",
70  "Average of Cluster Sizes",
71  36,
72  0.5,
73  36.5,
74  8,
75  0.5,
76  8.5,
77  0,
78  400, // For satefy, larger than 384
79  "Chamber",
80  "iEta");
82  this, "largeCls_occ", "Occupancy of Large Clusters (>5)", 36, 0.5, 36.5, 8, 0.5, 8.5, "Chamber", "iEta");
83 
85  this, "cls", "Cluster size of RecHits", nCLSMax_, 0.5, nCLSMax_ + 0.5, 1, 0.5, 1.5, "Cluster size", "iEta");
86 
87  if (bModeRelVal_) {
93  }
94 
95  GenerateMEPerChamber(ibooker);
96 }
97 
100 
101  return 0;
102 }
103 
106 
107  return 0;
108 }
109 
111  MEStationInfo& stationInfo = mapStationInfo_[key];
112 
113  Int_t nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
114 
120 
121  mapRecHitWheel_layer_.SetBinLowEdgeX(-0.088344); // FIXME: It could be different for other stations...
122  mapRecHitWheel_layer_.SetBinHighEdgeX(-0.088344 + 2 * 3.141592);
123  mapRecHitWheel_layer_.SetNbinsX(nNumVFATPerEta * stationInfo.nNumChambers_);
126 
130 
133 
135  mapCLSOver5_.bookND(bh, key);
140 
141  return 0;
142 }
143 
145  ME3IdsKey key3 = key4Tokey3(key);
146  MEStationInfo& stationInfo = mapStationInfo_[key3];
147 
149  mapCLSPerCh_.bookND(bh, key);
151 
152  return 0;
153 }
154 
155 void GEMRecHitSource::analyze(edm::Event const& event, edm::EventSetup const& eventSetup) {
157  event.getByToken(this->tagRecHit_, gemRecHits);
158  if (!gemRecHits.isValid()) {
159  edm::LogError(log_category_) << "GEM RecHit is not valid.\n";
160  return;
161  }
162 
163  std::map<ME3IdsKey, Int_t> total_rechit_layer;
164  std::map<ME3IdsKey, Int_t> total_rechit_iEta;
165  std::map<ME4IdsKey, std::map<Int_t, Bool_t>> mapCLSOver5;
166 
167  for (const auto& ch : gemChambers_) {
168  GEMDetId gid = ch.id();
169  auto chamber = gid.chamber();
170  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
171  ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
172  MEStationInfo& stationInfo = mapStationInfo_[key3];
173  for (auto ieta : ch.etaPartitions()) {
174  GEMDetId eId = ieta->id();
175  ME3IdsKey key3IEta{gid.region(), gid.station(), eId.ieta()};
176  ME3IdsKey key3AbsReIEta{std::abs(gid.region()), gid.station(), eId.ieta()};
177  ME4IdsKey key4IEta{gid.region(), gid.station(), gid.layer(), eId.ieta()};
178 
179  if (total_rechit_layer.find(key3) == total_rechit_layer.end())
180  total_rechit_layer[key3] = 0;
181 
182  const auto& recHitsRange = gemRecHits->get(eId);
183  auto gemRecHit = recHitsRange.first;
184  for (auto hit = gemRecHit; hit != recHitsRange.second; ++hit) {
185  GlobalPoint recHitGP = GEMGeometry_->idToDet(hit->gemId())->surface().toGlobal(hit->localPosition());
186  Float_t fPhi = recHitGP.phi();
187  if (fPhi < -5.0 / 180.0 * 3.141592)
188  fPhi += 2 * 3.141592;
189 
190  // Filling of RecHit occupancy
191  mapTotalRecHit_layer_.Fill(key3, chamber, eId.ieta());
192 
193  // Filling of R-Phi occupancy
194  Float_t fR = fRadiusMin_ + (fRadiusMax_ - fRadiusMin_) * (eId.ieta() - 0.5) / stationInfo.nNumEtaPartitions_;
195  mapRecHitWheel_layer_.Fill(key3, fPhi, fR);
196 
197  // Filling of RecHit (iEta)
198  mapRecHitOcc_ieta_.Fill(key3, eId.ieta());
199 
200  // Filling of RecHit (phi)
201  Float_t fPhiDeg = fPhi * 180.0 / 3.141592;
202  mapRecHitOcc_phi_.Fill(key3, fPhiDeg);
203 
204  // For total RecHits
205  total_rechit_layer[key3]++;
206  total_rechit_iEta[key3IEta]++;
207 
208  // Filling of cluster size (CLS)
209  Int_t nCLS = hit->clusterSize();
210  Int_t nCLSCutOff = std::min(nCLS, nCLSMax_); // For overflow
211  mapCLSRecHit_ieta_.Fill(key3AbsReIEta, nCLSCutOff);
212  mapCLSPerCh_.Fill(key4Ch, nCLSCutOff, eId.ieta());
213  mapCLSAverage_.Fill(key3, (Double_t)chamber, (Double_t)eId.ieta(), nCLS);
214  if (nCLS > 5)
215  mapCLSOver5[key4IEta][chamber] = true;
216  }
217  }
218  }
219  for (auto [key, num_total_rechit] : total_rechit_layer) {
220  mapTotalRecHitPerEvtLayer_.Fill(key, num_total_rechit);
221  }
222  for (auto [key, num_total_rechit] : total_rechit_iEta) {
223  mapTotalRecHitPerEvtIEta_.Fill(key, num_total_rechit);
224  }
225  for (auto [key, mapSub] : mapCLSOver5) {
226  for (auto [chamber, b] : mapSub) {
228  }
229  }
230 }
231 
GEMDQMBase::MEMapInfT::SetBinConfX
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:273
GEMRecHitSource::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMRecHitSource.cc:27
GEMDQMBase::gemChambers_
std::vector< GEMChamber > gemChambers_
Definition: GEMDQMBase.h:513
GEMRecHitSource::mapTotalRecHitPerEvtLayer_
MEMap3Inf mapTotalRecHitPerEvtLayer_
Definition: GEMRecHitSource.h:40
muonGEMRecHitPSet.gemRecHit
gemRecHit
Definition: muonGEMRecHitPSet.py:3
GEMRecHitSource::mapCLSRecHit_ieta_
MEMap3Inf mapCLSRecHit_ieta_
Definition: GEMRecHitSource.h:42
GEMRecHitSource.h
GEMRecHitSource::ProcessWithMEMap3WithChamber
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
Definition: GEMRecHitSource.cc:144
GEMRecHitSource::mapTotalRecHit_layer_
MEMap3Inf mapTotalRecHit_layer_
Definition: GEMRecHitSource.h:36
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:190
GEMDQMBase::MEStationInfo
Definition: GEMDQMBase.h:422
edm::Run
Definition: Run.h:45
min
T min(T a, T b)
Definition: MathUtil.h:58
GEMGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:25
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:171
GEMDQMBase::GEMGeometry_
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:511
edm
HLT enums.
Definition: AlignableModifier.h:19
ME4IdsKey
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
Definition: GEMValidationUtils.h:20
GEMRecHitSource::mapRecHitWheel_layer_
MEMap3Inf mapRecHitWheel_layer_
Definition: GEMRecHitSource.h:37
GEMRecHitSource::mapRecHitOcc_ieta_
MEMap3Inf mapRecHitOcc_ieta_
Definition: GEMRecHitSource.h:38
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
hydjet2DefaultParameters_cff.fR
fR
Definition: hydjet2DefaultParameters_cff.py:14
GEMRecHitSource::GEMRecHitSource
GEMRecHitSource(const edm::ParameterSet &cfg)
Definition: GEMRecHitSource.cc:6
GEMDQMBase::MEMapInfT::Fill
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:361
GEMRecHitSource::nClusterSizeBinNum_
int nClusterSizeBinNum_
Definition: GEMRecHitSource.h:34
edm::Handle< GEMRecHitCollection >
GEMDQMBase::key4Tokey3
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:491
GEMRecHitSource::tagRecHit_
edm::EDGetToken tagRecHit_
Definition: GEMRecHitSource.h:31
GEMDQMBase::MEMapInfT::SetLabelForChambers
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:318
GEMDQMBase::BookingHelper
Definition: GEMDQMBase.h:32
GEMDQMBase::keyToIEta
int keyToIEta(ME3IdsKey key)
Definition: GEMDQMBase.h:483
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
GEMDQMBase::MEMapInfT::SetBinLowEdgeX
void SetBinLowEdgeX(Double_t dXL)
Definition: GEMDQMBase.h:256
GEMDQMBase::MEMapInfT::SetNbinsY
void SetNbinsY(Int_t nBinsY)
Definition: GEMDQMBase.h:262
GEMDQMBase::MEStationInfo::nNumEtaPartitions_
Int_t nNumEtaPartitions_
Definition: GEMDQMBase.h:450
GEMDQMBase::MEMapInfT::SetBinHighEdgeX
void SetBinHighEdgeX(Double_t dXH)
Definition: GEMDQMBase.h:258
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
GEMRecHitSource::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMRecHitSource.cc:14
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMDQMBase::MEStationInfo::nMaxVFAT_
Int_t nMaxVFAT_
Definition: GEMDQMBase.h:451
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
GEMRecHitSource::mapRecHitOcc_phi_
MEMap3Inf mapRecHitOcc_phi_
Definition: GEMRecHitSource.h:39
GEMDQMBase::initGeometry
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:15
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDQMBase::MEMap4Inf
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:420
GEMDQMBase::MEStationInfo::nNumChambers_
Int_t nNumChambers_
Definition: GEMDQMBase.h:449
GEMDetId
Definition: GEMDetId.h:18
GEMRecHitSource::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: GEMRecHitSource.cc:155
GEMRecHitSource::nIdxFirstDigi_
int nIdxFirstDigi_
Definition: GEMRecHitSource.h:33
GEMRecHitSource::mapTotalRecHitPerEvtIEta_
MEMap3Inf mapTotalRecHitPerEvtIEta_
Definition: GEMRecHitSource.h:41
edm::EventSetup
Definition: EventSetup.h:58
GEMDQMBase::MEMapInfT::SetLabelForIEta
int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:338
GEMDQMBase::MEMapInfT::TurnOff
void TurnOff()
Definition: GEMDQMBase.h:239
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GEMRecHitSource::mapCLSOver5_
MEMap3Inf mapCLSOver5_
Definition: GEMRecHitSource.h:44
looper.cfg
cfg
Definition: looper.py:297
GEMDQMBase::loadChambers
int loadChambers()
Definition: GEMDQMBase.cc:46
GEMDQMBase::MEMap3Inf
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:419
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
GEMDQMBase::log_category_
std::string log_category_
Definition: GEMDQMBase.h:457
GEMRecHitSource::ProcessWithMEMap3
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMRecHitSource.cc:110
GEMRecHitSource::fRadiusMin_
Float_t fRadiusMin_
Definition: GEMRecHitSource.h:49
GEMDQMBase::mapStationInfo_
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:524
GEMDQMBase::MEMapInfT::SetBinConfY
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:281
GEMRecHitSource::bModeRelVal_
Bool_t bModeRelVal_
Definition: GEMRecHitSource.h:58
GEMRecHitSource::fRadiusMax_
Float_t fRadiusMax_
Definition: GEMRecHitSource.h:50
GEMRecHitSource
Definition: GEMRecHitSource.h:14
GEMRecHitSource::ProcessWithMEMap2AbsReWithEta
int ProcessWithMEMap2AbsReWithEta(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMRecHitSource.cc:104
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
ME3IdsKey
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
Definition: GEMValidationUtils.h:19
GEMDQMBase
Definition: GEMDQMBase.h:29
dqm::implementation::IBooker
Definition: DQMStore.h:43
GEMRecHitSource::ProcessWithMEMap2WithEta
int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMRecHitSource.cc:98
GEMRecHitSource::mapCLSAverage_
MEMap3Inf mapCLSAverage_
Definition: GEMRecHitSource.h:43
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
GEMDQMBase::MEMapInfT::SetNbinsX
void SetNbinsX(Int_t nBinsX)
Definition: GEMDQMBase.h:254
gemRecHits_cfi.gemRecHits
gemRecHits
Definition: gemRecHits_cfi.py:7
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GEMRecHitSource::nCLSMax_
Int_t nCLSMax_
Definition: GEMRecHitSource.h:48
GEMDetId::ieta
constexpr int ieta() const
Definition: GEMDetId.h:199
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
crabWrapper.key
key
Definition: crabWrapper.py:19
GEMRecHitSource::mapCLSPerCh_
MEMap4Inf mapCLSPerCh_
Definition: GEMRecHitSource.h:46
GEMDQMBase::MEMapInfT::bookND
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:290
edm::InputTag
Definition: InputTag.h:15
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
hit
Definition: SiStripHitEffFromCalibTree.cc:88
GEMDQMBase::GenerateMEPerChamber
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:158