7 pad_token_ = consumes<GEMPadDigiCollection>(pad_tag);
16 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
17 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
29 Int_t region_id =
region->region();
35 Int_t station_id =
station->station();
43 const auto& superChamberVec =
station->superChambers();
44 if (superChamberVec.empty()) {
46 <<
" and station = " << station_id;
50 if (super_chamber ==
nullptr) {
52 <<
" and station = " << station_id;
55 for (
const auto& chamber : super_chamber->
chambers()) {
56 Int_t layer_id = chamber->id().layer();
57 ME3IdsKey key3(region_id, station_id, layer_id);
59 const auto& etaPartitionVec = chamber->etaPartitions();
60 if (etaPartitionVec.empty() || etaPartitionVec.front() ==
nullptr) {
62 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", "
63 << station_id <<
", " << super_chamber->
id() <<
", " << chamber->id() <<
")";
66 Int_t num_pads = etaPartitionVec.front()->npads();
69 bookHist1D(booker, key3,
"total_pads_per_event",
"Number of pad digis per event", 50, 0, 50);
73 "sim_matched_occ_eta",
74 "Matched Pad Eta Occupancy",
81 bookHist1D(booker, key3,
"sim_matched_occ_phi",
"Matched Pad Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
100 bookHist1D(booker, key3,
"occ_pad",
"Pad Occupancy", num_pads, 0, num_pads,
"Pad number");
109 Int_t region_id =
region->region();
111 Int_t station_id =
station->station();
113 const auto& superChamberVec =
station->superChambers();
114 if (superChamberVec.empty()) {
116 <<
" and station = " << station_id;
120 if (super_chamber ==
nullptr) {
122 <<
" and station = " << station_id;
125 for (
const auto& chamber : super_chamber->
chambers()) {
126 Int_t layer_id = chamber->id().layer();
127 ME3IdsKey key3(region_id, station_id, layer_id);
143 if (not collection.
isValid()) {
150 if (not digiSimLink.
isValid()) {
157 if (not simhit_container.
isValid()) {
162 std::map<ME3IdsKey, Int_t> total_pad;
163 for (
const auto& pad_pair : *collection) {
165 const auto&
range = pad_pair.second;
167 if (gem->
idToDet(gemid) ==
nullptr) {
169 <<
"Maybe it comes from unmatched geometry." << std::endl;
176 Int_t region_id = gemid.
region();
177 Int_t station_id = gemid.
station();
178 Int_t layer_id = gemid.
layer();
179 Int_t chamber_id = gemid.
chamber();
180 Int_t ieta = gemid.
ieta();
181 Int_t num_layers = gemid.
nlayers();
184 ME3IdsKey key3(region_id, station_id, layer_id);
186 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
189 Int_t pad = digi->pad();
190 Int_t
bx = digi->bx();
193 const GlobalPoint& global_pos = surface.toGlobal(local_pos);
195 Float_t g_r = global_pos.
perp();
196 Float_t g_phi = global_pos.
phi();
197 Float_t g_x = global_pos.
x();
198 Float_t g_y = global_pos.
y();
199 Float_t g_abs_z = std::fabs(global_pos.
z());
201 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
215 Int_t region_id =
region->region();
217 Int_t station_id =
station->station();
218 const auto& superChamberVec =
station->superChambers();
219 if (superChamberVec.empty()) {
221 <<
" and station = " << station_id;
225 if (super_chamber ==
nullptr) {
227 <<
" and station = " << station_id;
230 for (
const auto& chamber : super_chamber->
chambers()) {
231 Int_t layer_id = chamber->id().layer();
232 ME3IdsKey key3{region_id, station_id, layer_id};
239 for (
const auto& simhit : *simhit_container.
product()) {
242 if (gem->
idToDet(simhit.detUnitId()) ==
nullptr) {
247 GEMDetId simhit_gemid(simhit.detUnitId());
249 Int_t region_id = simhit_gemid.
region();
250 Int_t station_id = simhit_gemid.station();
251 Int_t layer_id = simhit_gemid.layer();
252 Int_t chamber_id = simhit_gemid.chamber();
253 Int_t ieta = simhit_gemid.ieta();
254 Int_t num_layers = simhit_gemid.nlayers();
257 ME3IdsKey key3{region_id, station_id, layer_id};
261 const auto& simhit_local_pos = simhit.localPosition();
262 const auto& simhit_global_pos = roll->
surface().
toGlobal(simhit_local_pos);
264 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
265 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
267 auto simhit_trackId = simhit.trackId();
269 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
271 auto links = digiSimLink->find(simhit_gemid);
272 if (
links == digiSimLink->end())
275 Int_t simhit_strip = -1;
277 if (simhit_trackId ==
link.getTrackId()) {
278 simhit_strip =
link.getStrip();
282 Int_t simhit_pad = roll->
padOfStrip(simhit_strip);
283 auto range = collection->get(simhit_gemid);
284 for (
auto pad =
range.first; pad !=
range.second; ++pad) {
285 if (pad->pad() == simhit_pad) {
dqm::impl::MonitorElement * bookHist1D(DQMStore::IBooker &booker, const T &key, const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, const char *x_title="", const char *y_title="Entries")
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
virtual void setCurrentFolder(std::string const &fullpath)
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
edm::EDGetTokenT< edm::PSimHitContainer > simhit_token_
void analyze(const edm::Event &, const edm::EventSetup &) override
Bool_t isMuonSimHit(const PSimHit &)
const GeomDet * idToDet(DetId) const override
Geom::Phi< T > phi() const
MEMap3Ids me_detail_occ_phi_pad_
MEMap3Ids me_occ_total_pad_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
Log< level::Error, false > LogError
dqm::impl::MonitorElement * bookZROccupancy(DQMStore::IBooker &booker, Int_t region_id, const char *name_prfix, const char *title_prefix)
const Plane & surface() const
The nominal surface of the GeomDet.
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
constexpr int ieta() const
const uint16_t range(const Frame &aFrame)
bool getData(T &iHolder) const
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
MEMap1Ids me_detail_occ_zr_
constexpr int nlayers() const
GEMPadDigiValidation(const edm::ParameterSet &)
constexpr int region() const
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
MEMap3Ids me_detail_occ_pad_
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > digisimlink_token_
Abs< T >::type abs(const T &t)
std::vector< Double_t > eta_range_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
MEMap2Ids me_detail_occ_det_
dqm::impl::MonitorElement * bookHist2D(DQMStore::IBooker &booker, const T &key, const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup, const char *x_title="", const char *y_title="")
~GEMPadDigiValidation() override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEMap2Ids me_detail_pad_occ_det_
MEMap3Ids me_pad_occ_eta_
T const * product() const
ParameterSet const & getParameterSet(std::string const &) const
constexpr int chamber() const
constexpr int layer() const
GEMDetId id() const
Return the GEMDetId of this super chamber.
T getParameter(std::string const &) const
MEMap3Ids me_pad_occ_phi_
constexpr int station() const
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
std::tuple< Int_t, Int_t > ME2IdsKey
Float_t toDegree(Float_t radian)
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
MEMap3Ids me_detail_occ_xy_
const std::string kLogCategory_
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)