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 
40 
42 
43  Int_t nCLSMax_;
44 
45  std::unordered_map<UInt_t, MonitorElement*> recHitME_;
46  std::unordered_map<UInt_t, MonitorElement*> VFAT_vs_ClusterSize_;
47  std::unordered_map<UInt_t, MonitorElement*> StripsFired_vs_eta_;
48  std::unordered_map<UInt_t, MonitorElement*> rh_vs_eta_;
49  std::unordered_map<UInt_t, MonitorElement*> recGlobalPos;
50 };
51 
52 using namespace std;
53 using namespace edm;
54 
56  tagRecHit_ = consumes<GEMRecHitCollection>(cfg.getParameter<edm::InputTag>("recHitsInputLabel"));
57 
58  nIdxFirstStrip_ = cfg.getParameter<int>("idxFirstStrip");
59  nClusterSizeBinNum_ = cfg.getParameter<int>("ClusterSizeBinNum");
60 
61  fGlobXMin_ = cfg.getParameter<double>("global_x_bound_min");
62  fGlobXMax_ = cfg.getParameter<double>("global_x_bound_max");
63  fGlobYMin_ = cfg.getParameter<double>("global_y_bound_min");
64  fGlobYMax_ = cfg.getParameter<double>("global_y_bound_max");
65 }
66 
69  desc.add<edm::InputTag>("recHitsInputLabel", edm::InputTag("gemRecHits", ""));
70 
71  desc.add<int>("idxFirstStrip", 0);
72  desc.add<int>("ClusterSizeBinNum", 9);
73 
74  desc.add<double>("global_x_bound_min", -350);
75  desc.add<double>("global_x_bound_max", 350);
76  desc.add<double>("global_y_bound_min", -260);
77  desc.add<double>("global_y_bound_max", 260);
78 
79  desc.addUntracked<std::string>("logCategory", "GEMRecHitSource");
80 
81  descriptions.add("GEMRecHitSource", desc);
82 }
83 
85  std::vector<GEMDetId> listLayerOcc;
86 
87  initGeometry(iSetup);
88  if (GEMGeometry_ == nullptr)
89  return;
90  loadChambers();
91 
92  ibooker.cd();
93  ibooker.setCurrentFolder("GEM/recHit");
94 
95  nCLSMax_ = 10;
96 
98  MEMap3Inf(this, "rechit_det", "Rec. Hit Occupancy", 36, 0.5, 36.5, 8, 0.5, 8.5, "Chamber", "iEta");
100  this, "rechit_ieta_occ", "RecHit Digi Occupancy per eta partition", 8, 0.5, 8.5, "iEta", "Number of recHits");
102  this, "rechit_phi_occ", "RecHit Digi Phi (degree) Occupancy ", 108, -5, 355, "#phi (degree)", "Number of recHits");
104  "total_rechit_per_event",
105  "Total number of rec. hits per event for each layers ",
106  50,
107  -0.5,
108  99.5,
109  "Number of recHits",
110  "Events");
112  this, "cls", "Cluster size of rec. hits", nCLSMax_, 0.5, nCLSMax_ + 0.5, "Cluster size", "Number of recHits");
113 
115  this, "cls", "Cluster size of rec. hits", nCLSMax_, 0.5, nCLSMax_ + 0.5, 1, 0.5, 1.5, "Cluster size", "iEta");
116 
117  GenerateMEPerChamber(ibooker);
118 }
119 
121  MEStationInfo& stationInfo = mapStationInfo_[key];
122 
127  mapTotalRecHit_layer_.SetLabelForChambers(key, 2); // No worries, it's same as the eta partition labelling
128 
131 
134 
135  return 0;
136 }
137 
140 
141  return 0;
142 }
143 
145  ME3IdsKey key3 = key4Tokey3(key);
146  MEStationInfo& stationInfo = mapStationInfo_[key3];
147 
149  mapCLSPerCh_.bookND(bh, key);
150  mapCLSPerCh_.SetLabelForChambers(key, 2); // For eta partitions
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  std::map<ME3IdsKey, Int_t> total_rechit_layer;
163  for (const auto& ch : gemChambers_) {
164  GEMDetId gid = ch.id();
165  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
166  ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
167  for (auto ieta : ch.etaPartitions()) {
168  GEMDetId rId = ieta->id();
169  ME4IdsKey key4iEta{gid.region(), gid.station(), gid.layer(), rId.roll()};
170  if (total_rechit_layer.find(key3) == total_rechit_layer.end())
171  total_rechit_layer[key3] = 0;
172  const auto& recHitsRange = gemRecHits->get(rId);
173  auto gemRecHit = recHitsRange.first;
174  for (auto hit = gemRecHit; hit != recHitsRange.second; ++hit) {
175  // Filling of digi occupancy
176  mapTotalRecHit_layer_.Fill(key3, gid.chamber(), rId.roll());
177 
178  // Filling of strip (iEta)
179  mapRecHitOcc_ieta_.Fill(key3, rId.roll());
180 
181  // Filling of strip (phi)
182  GlobalPoint recHitGP = GEMGeometry_->idToDet(hit->gemId())->surface().toGlobal(hit->localPosition());
183  Float_t fPhiDeg = ((Float_t)recHitGP.phi()) * 180.0 / 3.141592;
184  if (fPhiDeg < -5.0)
185  fPhiDeg += 360.0;
186  mapRecHitOcc_phi_.Fill(key3, fPhiDeg);
187 
188  // For total recHits
189  total_rechit_layer[key3]++;
190 
191  // Filling of cluster size (CLS)
192  Int_t nCLS = std::min(hit->clusterSize(), nCLSMax_); // For overflow
193  mapCLSRecHit_ieta_.Fill(key4iEta, nCLS);
194  mapCLSPerCh_.Fill(key4Ch, rId.roll(), nCLS);
195  }
196  }
197  }
198  for (auto [key, num_total_rechit] : total_rechit_layer)
199  mapTotalRecHitPerEvt_.Fill(key, num_total_rechit);
200 }
201 
GEMDQMBase::MEMapInfT::SetBinConfX
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:184
GEMRecHitSource::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMRecHitSource.cc:84
GEMDQMBase::gemChambers_
std::vector< GEMChamber > gemChambers_
Definition: GEMDQMBase.h:402
muonGEMRecHitPSet.gemRecHit
gemRecHit
Definition: muonGEMRecHitPSet.py:3
GEMRecHitSource::ProcessWithMEMap3WithChamber
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
Definition: GEMRecHitSource.cc:144
GEMRecHit.h
GEMRecHitSource::recHitME_
std::unordered_map< UInt_t, MonitorElement * > recHitME_
Definition: GEMRecHitSource.cc:45
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:320
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:400
edm
HLT enums.
Definition: AlignableModifier.h:19
ME4IdsKey
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
Definition: GEMValidationUtils.h:20
GEMRecHitSource::mapRecHitOcc_ieta_
MEMap3Inf mapRecHitOcc_ieta_
Definition: GEMRecHitSource.cc:36
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
GEMRecHitSource::GEMRecHitSource
GEMRecHitSource(const edm::ParameterSet &cfg)
Definition: GEMRecHitSource.cc:55
GEMDQMBase::MEMapInfT::Fill
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:263
GEMRecHitSource::mapCLSRecHit_ieta_
MEMap4Inf mapCLSRecHit_ieta_
Definition: GEMRecHitSource.cc:39
GEMRecHitSource::nClusterSizeBinNum_
int nClusterSizeBinNum_
Definition: GEMRecHitSource.cc:33
edm::Handle< GEMRecHitCollection >
GEMDQMBase::key4Tokey3
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:378
GEMRecHitSource::fGlobXMin_
float fGlobXMin_
Definition: GEMRecHitSource.cc:29
GEMRecHitSource::VFAT_vs_ClusterSize_
std::unordered_map< UInt_t, MonitorElement * > VFAT_vs_ClusterSize_
Definition: GEMRecHitSource.cc:46
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:226
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:138
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:38
GEMDQMBase::MEStationInfo::nNumEtaPartitions_
Int_t nNumEtaPartitions_
Definition: GEMDQMBase.h:348
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:67
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:14
GEMRecHitSource::mapRecHitOcc_phi_
MEMap3Inf mapRecHitOcc_phi_
Definition: GEMRecHitSource.cc:37
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDQMBase::MEMap4Inf
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:318
GEMDQMBase::MEStationInfo::nNumChambers_
Int_t nNumChambers_
Definition: GEMDQMBase.h:347
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:194
GEMDetId
Definition: GEMDetId.h:18
GEMRecHitSource::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: GEMRecHitSource.cc:155
GEMRecHitSource::StripsFired_vs_eta_
std::unordered_map< UInt_t, MonitorElement * > StripsFired_vs_eta_
Definition: GEMRecHitSource.cc:47
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:45
GEMDQMBase::MEMap3Inf
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:317
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
GEMDQMBase::log_category_
std::string log_category_
Definition: GEMDQMBase.h:398
GEMRecHitSource::ProcessWithMEMap3
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMRecHitSource.cc:120
GEMDQMBase::mapStationInfo_
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:411
GEMDQMBase::MEMapInfT::SetBinConfY
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:192
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:49
gemRecHits_cfi.gemRecHits
gemRecHits
Definition: gemRecHits_cfi.py:7
GEMRecHitSource::nCLSMax_
Int_t nCLSMax_
Definition: GEMRecHitSource.cc:43
GEMRecHitSource::fGlobYMax_
float fGlobYMax_
Definition: GEMRecHitSource.cc:30
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:41
GEMDQMBase::MEMapInfT::bookND
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:201
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:48
hit
Definition: SiStripHitEffFromCalibTree.cc:88
GEMDQMBase::GenerateMEPerChamber
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:147
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37