CMS 3D CMS Logo

GEMRecHitSource.cc
Go to the documentation of this file.
2 
6 
7 #include <string>
8 
9 //----------------------------------------------------------------------------------------------------
10 
11 class GEMRecHitSource : public GEMDQMBase {
12 public:
13  explicit GEMRecHitSource(const edm::ParameterSet& cfg);
14  ~GEMRecHitSource() override{};
15  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
16 
17 protected:
18  void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override{};
19  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
20  void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
21 
22 private:
23  int ProcessWithMEMap3(BookingHelper& bh, ME3IdsKey key) override;
24  int ProcessWithMEMap4(BookingHelper& bh, ME4IdsKey key) override;
25  int ProcessWithMEMap3WithChamber(BookingHelper& bh, ME4IdsKey key) override;
26 
28 
31 
34 
41 
43 
44  Int_t nCLSMax_;
45  Float_t fRadiusMin_;
46  Float_t fRadiusMax_;
47 
48  std::unordered_map<UInt_t, MonitorElement*> recHitME_;
49  std::unordered_map<UInt_t, MonitorElement*> VFAT_vs_ClusterSize_;
50  std::unordered_map<UInt_t, MonitorElement*> StripsFired_vs_eta_;
51  std::unordered_map<UInt_t, MonitorElement*> rh_vs_eta_;
52  std::unordered_map<UInt_t, MonitorElement*> recGlobalPos;
53 };
54 
55 using namespace std;
56 using namespace edm;
57 
59  tagRecHit_ = consumes<GEMRecHitCollection>(cfg.getParameter<edm::InputTag>("recHitsInputLabel"));
60 
61  nIdxFirstStrip_ = cfg.getParameter<int>("idxFirstStrip");
62  nClusterSizeBinNum_ = cfg.getParameter<int>("ClusterSizeBinNum");
63 
64  fGlobXMin_ = cfg.getParameter<double>("global_x_bound_min");
65  fGlobXMax_ = cfg.getParameter<double>("global_x_bound_max");
66  fGlobYMin_ = cfg.getParameter<double>("global_y_bound_min");
67  fGlobYMax_ = cfg.getParameter<double>("global_y_bound_max");
68 }
69 
72  desc.add<edm::InputTag>("recHitsInputLabel", edm::InputTag("gemRecHits", ""));
73 
74  desc.add<int>("idxFirstStrip", 0);
75  desc.add<int>("ClusterSizeBinNum", 9);
76 
77  desc.add<double>("global_x_bound_min", -350);
78  desc.add<double>("global_x_bound_max", 350);
79  desc.add<double>("global_y_bound_min", -260);
80  desc.add<double>("global_y_bound_max", 260);
81 
82  desc.addUntracked<std::string>("logCategory", "GEMRecHitSource");
83 
84  descriptions.add("GEMRecHitSource", desc);
85 }
86 
88  std::vector<GEMDetId> listLayerOcc;
89 
90  initGeometry(iSetup);
91  if (GEMGeometry_ == nullptr)
92  return;
93  loadChambers();
94 
95  ibooker.cd();
96  ibooker.setCurrentFolder("GEM/recHit");
97 
98  nCLSMax_ = 10;
99  fRadiusMin_ = 120.0;
100  fRadiusMax_ = 250.0;
101  float radS = -5.0 / 180 * 3.141592;
102  float radL = 355.0 / 180 * 3.141592;
103 
105  MEMap3Inf(this, "rechit_det", "Rec. Hit Occupancy", 36, 0.5, 36.5, 8, 0.5, 8.5, "Chamber", "iEta");
107  MEMap3Inf(this, "rechit_wheel", "Rec. Hit Wheel Occupancy", 108, radS, radL, 8, fRadiusMin_, fRadiusMax_, "", "");
109  this, "rechit_ieta_occ", "RecHit Digi Occupancy per eta partition", 8, 0.5, 8.5, "iEta", "Number of recHits");
111  this, "rechit_phi_occ", "RecHit Digi Phi (degree) Occupancy ", 108, -5, 355, "#phi (degree)", "Number of recHits");
113  "total_rechit_per_event",
114  "Total number of rec. hits per event for each layers ",
115  50,
116  -0.5,
117  99.5,
118  "Number of recHits",
119  "Events");
121  this, "cls", "Cluster size of rec. hits", nCLSMax_, 0.5, nCLSMax_ + 0.5, "Cluster size", "Number of recHits");
122 
124  this, "cls", "Cluster size of rec. hits", nCLSMax_, 0.5, nCLSMax_ + 0.5, 1, 0.5, 1.5, "Cluster size", "iEta");
125 
126  GenerateMEPerChamber(ibooker);
127 }
128 
130  MEStationInfo& stationInfo = mapStationInfo_[key];
131 
132  Int_t nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
133 
138  mapTotalRecHit_layer_.SetLabelForChambers(key, 2); // No worries, it's same as the eta partition labelling
139 
140  mapRecHitWheel_layer_.SetBinLowEdgeX(-0.088344); // FIXME: It could be different for other stations...
141  mapRecHitWheel_layer_.SetBinHighEdgeX(-0.088344 + 2 * 3.141592);
142  mapRecHitWheel_layer_.SetNbinsX(nNumVFATPerEta * stationInfo.nNumChambers_);
145 
148 
151 
152  return 0;
153 }
154 
157 
158  return 0;
159 }
160 
162  ME3IdsKey key3 = key4Tokey3(key);
163  MEStationInfo& stationInfo = mapStationInfo_[key3];
164 
166  mapCLSPerCh_.bookND(bh, key);
167  mapCLSPerCh_.SetLabelForChambers(key, 2); // For eta partitions
168 
169  return 0;
170 }
171 
172 void GEMRecHitSource::analyze(edm::Event const& event, edm::EventSetup const& eventSetup) {
174  event.getByToken(this->tagRecHit_, gemRecHits);
175  if (!gemRecHits.isValid()) {
176  edm::LogError(log_category_) << "GEM recHit is not valid.\n";
177  return;
178  }
179  std::map<ME3IdsKey, Int_t> total_rechit_layer;
180  for (const auto& ch : gemChambers_) {
181  GEMDetId gid = ch.id();
182  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
183  ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
184  MEStationInfo& stationInfo = mapStationInfo_[key3];
185  for (auto ieta : ch.etaPartitions()) {
186  GEMDetId rId = ieta->id();
187  ME4IdsKey key4iEta{gid.region(), gid.station(), gid.layer(), rId.ieta()};
188  if (total_rechit_layer.find(key3) == total_rechit_layer.end())
189  total_rechit_layer[key3] = 0;
190  const auto& recHitsRange = gemRecHits->get(rId);
191  auto gemRecHit = recHitsRange.first;
192  for (auto hit = gemRecHit; hit != recHitsRange.second; ++hit) {
193  GlobalPoint recHitGP = GEMGeometry_->idToDet(hit->gemId())->surface().toGlobal(hit->localPosition());
194  Float_t fPhi = recHitGP.phi();
195  if (fPhi < -5.0 / 180.0 * 3.141592)
196  fPhi += 2 * 3.141592;
197 
198  // Filling of digi occupancy
199  mapTotalRecHit_layer_.Fill(key3, gid.chamber(), rId.ieta());
200 
201  // Filling of wheel occupancy
202  Float_t fR = fRadiusMin_ + (fRadiusMax_ - fRadiusMin_) * (rId.ieta() - 0.5) / stationInfo.nNumEtaPartitions_;
203  if (!(fRadiusMin_ <= fR && fR <= fRadiusMax_ && -0.08726 <= fPhi && fPhi <= 6.196))
204  std::cout << fR << ", " << fPhi << std::endl;
205  mapRecHitWheel_layer_.Fill(key3, fPhi, fR);
206 
207  // Filling of strip (iEta)
208  mapRecHitOcc_ieta_.Fill(key3, rId.ieta());
209 
210  // Filling of strip (phi)
211  Float_t fPhiDeg = fPhi * 180.0 / 3.141592;
212  mapRecHitOcc_phi_.Fill(key3, fPhiDeg);
213 
214  // For total recHits
215  total_rechit_layer[key3]++;
216 
217  // Filling of cluster size (CLS)
218  Int_t nCLS = std::min(hit->clusterSize(), nCLSMax_); // For overflow
219  mapCLSRecHit_ieta_.Fill(key4iEta, nCLS);
220  mapCLSPerCh_.Fill(key4Ch, rId.ieta(), nCLS);
221  }
222  }
223  }
224  for (auto [key, num_total_rechit] : total_rechit_layer)
225  mapTotalRecHitPerEvt_.Fill(key, num_total_rechit);
226 }
227 
GEMDQMBase::MEMapInfT::SetBinConfX
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:204
GEMRecHitSource::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMRecHitSource.cc:87
GEMDQMBase::gemChambers_
std::vector< GEMChamber > gemChambers_
Definition: GEMDQMBase.h:423
muonGEMRecHitPSet.gemRecHit
gemRecHit
Definition: muonGEMRecHitPSet.py:3
GEMRecHitSource::ProcessWithMEMap3WithChamber
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
Definition: GEMRecHitSource.cc:161
GEMRecHit.h
GEMRecHitSource::recHitME_
std::unordered_map< UInt_t, MonitorElement * > recHitME_
Definition: GEMRecHitSource.cc:48
GEMRecHitSource::nIdxFirstStrip_
int nIdxFirstStrip_
Definition: GEMRecHitSource.cc:32
GEMRecHitSource::mapTotalRecHit_layer_
MEMap3Inf mapTotalRecHit_layer_
Definition: GEMRecHitSource.cc:35
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:190
GEMDQMBase::MEStationInfo
Definition: GEMDQMBase.h:340
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:421
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.cc:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GEMRecHitSource::mapRecHitOcc_ieta_
MEMap3Inf mapRecHitOcc_ieta_
Definition: GEMRecHitSource.cc:37
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:58
GEMDQMBase::MEMapInfT::Fill
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:283
GEMRecHitSource::mapCLSRecHit_ieta_
MEMap4Inf mapCLSRecHit_ieta_
Definition: GEMRecHitSource.cc:40
GEMRecHitSource::nClusterSizeBinNum_
int nClusterSizeBinNum_
Definition: GEMRecHitSource.cc:33
edm::Handle< GEMRecHitCollection >
GEMDQMBase::key4Tokey3
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:399
GEMRecHitSource::fGlobXMin_
float fGlobXMin_
Definition: GEMRecHitSource.cc:29
GEMRecHitSource::VFAT_vs_ClusterSize_
std::unordered_map< UInt_t, MonitorElement * > VFAT_vs_ClusterSize_
Definition: GEMRecHitSource.cc:49
GEMRecHitSource::tagRecHit_
edm::EDGetToken tagRecHit_
Definition: GEMRecHitSource.cc:27
GEMRecHitSource::fGlobXMax_
float fGlobXMax_
Definition: GEMRecHitSource.cc:29
GEMDQMBase::MEMapInfT::SetLabelForChambers
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:246
GEMDQMBase::BookingHelper
Definition: GEMDQMBase.h:32
GEMRecHitSource::~GEMRecHitSource
~GEMRecHitSource() override
Definition: GEMRecHitSource.cc:14
GEMRecHitSource::ProcessWithMEMap4
int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key) override
Definition: GEMRecHitSource.cc:155
GEMDQMBase.h
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
GEMRecHitSource::mapTotalRecHitPerEvt_
MEMap3Inf mapTotalRecHitPerEvt_
Definition: GEMRecHitSource.cc:39
GEMDQMBase::MEMapInfT::SetBinLowEdgeX
void SetBinLowEdgeX(Double_t dXL)
Definition: GEMDQMBase.h:192
GEMDQMBase::MEMapInfT::SetNbinsY
void SetNbinsY(Int_t nBinsY)
Definition: GEMDQMBase.h:198
GEMDQMBase::MEStationInfo::nNumEtaPartitions_
Int_t nNumEtaPartitions_
Definition: GEMDQMBase.h:368
GEMDQMBase::MEMapInfT::SetBinHighEdgeX
void SetBinHighEdgeX(Double_t dXH)
Definition: GEMDQMBase.h:194
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
Point3DBase< float, GlobalTag >
GEMRecHitSource::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMRecHitSource.cc:70
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMDQMBase::MEStationInfo::nMaxVFAT_
Int_t nMaxVFAT_
Definition: GEMDQMBase.h:369
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
GEMDQMBase::initGeometry
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:15
GEMRecHitSource::mapRecHitOcc_phi_
MEMap3Inf mapRecHitOcc_phi_
Definition: GEMRecHitSource.cc:38
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDQMBase::MEMap4Inf
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:338
GEMDQMBase::MEStationInfo::nNumChambers_
Int_t nNumChambers_
Definition: GEMDQMBase.h:367
GEMDetId
Definition: GEMDetId.h:18
GEMRecHitSource::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: GEMRecHitSource.cc:172
GEMRecHitSource::StripsFired_vs_eta_
std::unordered_map< UInt_t, MonitorElement * > StripsFired_vs_eta_
Definition: GEMRecHitSource.cc:50
GEMRecHitCollection.h
GEMRecHitSource::fGlobYMin_
float fGlobYMin_
Definition: GEMRecHitSource.cc:30
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EDGetToken
Definition: EDGetToken.h:35
GEMDQMBase::MEMapInfT
Definition: GEMDQMBase.h:84
looper.cfg
cfg
Definition: looper.py:297
GEMDQMBase::loadChambers
int loadChambers()
Definition: GEMDQMBase.cc:46
GEMDQMBase::MEMap3Inf
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:337
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
GEMDQMBase::log_category_
std::string log_category_
Definition: GEMDQMBase.h:419
GEMRecHitSource::ProcessWithMEMap3
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMRecHitSource.cc:129
GEMRecHitSource::fRadiusMin_
Float_t fRadiusMin_
Definition: GEMRecHitSource.cc:45
GEMDQMBase::mapStationInfo_
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:432
GEMDQMBase::MEMapInfT::SetBinConfY
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:212
GEMRecHitSource::fRadiusMax_
Float_t fRadiusMax_
Definition: GEMRecHitSource.cc:46
GEMRecHitSource
Definition: GEMRecHitSource.cc:11
GEMRecHitSource::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: GEMRecHitSource.cc:18
ME3IdsKey
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
Definition: GEMValidationUtils.h:19
GEMDQMBase
Definition: GEMDQMBase.h:29
GEMDigiCollection.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
GEMRecHitSource::recGlobalPos
std::unordered_map< UInt_t, MonitorElement * > recGlobalPos
Definition: GEMRecHitSource.cc:52
GEMDQMBase::MEMapInfT::SetNbinsX
void SetNbinsX(Int_t nBinsX)
Definition: GEMDQMBase.h:190
gemRecHits_cfi.gemRecHits
gemRecHits
Definition: gemRecHits_cfi.py:7
GEMRecHitSource::nCLSMax_
Int_t nCLSMax_
Definition: GEMRecHitSource.cc:44
GEMRecHitSource::fGlobYMax_
float fGlobYMax_
Definition: GEMRecHitSource.cc:30
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.cc:42
GEMDQMBase::MEMapInfT::bookND
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:221
edm::InputTag
Definition: InputTag.h:15
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GEMRecHitSource::rh_vs_eta_
std::unordered_map< UInt_t, MonitorElement * > rh_vs_eta_
Definition: GEMRecHitSource.cc:51
hit
Definition: SiStripHitEffFromCalibTree.cc:88
GEMDQMBase::GenerateMEPerChamber
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:150
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37