10 const auto& simhit_tag = simhit_pset.getParameter<
edm::InputTag>(
"inputTag");
17 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
18 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
28 TString cls_title =
"Cluster Size Distribution";
29 TString cls_x_title =
"Cluster size";
31 me_cls_ = booker.
book1D(
"cls", cls_title +
";" + cls_x_title +
";" +
"Entries", 10, 0, 10);
35 Int_t region_id =
region->region();
41 Int_t station_id =
station->station();
50 const auto& superChamberVec =
station->superChambers();
51 if (superChamberVec.empty()) {
53 <<
" and station = " << station_id;
57 if (super_chamber ==
nullptr) {
59 <<
" and station = " << station_id;
62 for (
const auto& chamber : super_chamber->
chambers()) {
63 Int_t layer_id = chamber->id().layer();
64 ME3IdsKey key3{region_id, station_id, layer_id};
66 const auto& etaPartitionVec = chamber->etaPartitions();
67 if (etaPartitionVec.empty() || etaPartitionVec.front() ==
nullptr) {
69 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", "
70 << station_id <<
", " << super_chamber->
id() <<
", " << chamber->id() <<
")";
73 Int_t num_pads = etaPartitionVec.front()->npads();
76 bookHist1D(booker, key3,
"total_pad_cluster",
"Number of pad digi cluster per event", 20, 0, 20);
80 "sim_matched_occ_eta",
81 "Matched Pad Cluster Eta Occupancy",
88 booker, key3,
"sim_matched_occ_phi",
"Matched Pad Cluster Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
96 "Pad Cluster Occupancy",
107 bookHist1D(booker, key3,
"occ_pad",
"Pad Cluster Occupancy", num_pads, 0, num_pads,
"Pad number");
116 Int_t region_id =
region->region();
118 Int_t station_id =
station->station();
120 const auto& superChamberVec =
station->superChambers();
121 if (superChamberVec.empty()) {
123 <<
" and station = " << station_id;
127 if (super_chamber ==
nullptr) {
129 <<
" and station = " << station_id;
132 for (
const auto& chamber : super_chamber->
chambers()) {
133 Int_t layer_id = chamber->id().layer();
134 ME3IdsKey key3(region_id, station_id, layer_id);
136 bookHist1D(booker, key3,
"bx",
"Pad Cluster Bunch Crossing", 5, -2, 3,
"Bunch crossing");
147 for (
auto pad : cluster->pads()) {
148 if (pad == simhit_pad) {
160 if (not collection.
isValid()) {
167 if (not digiSimLink.
isValid()) {
174 if (not simhit_container.
isValid()) {
179 std::map<ME3IdsKey, Int_t> total_cluster;
180 for (
auto range_iter = collection->begin(); range_iter != collection->end(); range_iter++) {
181 GEMDetId gemid = (*range_iter).first;
182 const auto&
range = (*range_iter).second;
184 if (gem->
idToDet(gemid) ==
nullptr) {
186 <<
"Maybe it comes from unmatched geometry." << std::endl;
193 Int_t region_id = gemid.
region();
194 Int_t station_id = gemid.
station();
195 Int_t layer_id = gemid.
layer();
196 Int_t chamber_id = gemid.
chamber();
197 Int_t ieta = gemid.
ieta();
198 Int_t num_layers = gemid.
nlayers();
201 ME3IdsKey key3(region_id, station_id, layer_id);
203 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
204 const auto& padsVec = digi->pads();
205 if (padsVec.empty()) {
209 Int_t pad = padsVec[0];
211 total_cluster[key3]++;
214 Int_t
bx = digi->bx();
215 Int_t cls = digi->pads().size();
218 const GlobalPoint& global_pos = surface.toGlobal(local_pos);
220 Float_t g_r = global_pos.
perp();
221 Float_t g_phi = global_pos.
phi();
222 Float_t g_x = global_pos.
x();
223 Float_t g_y = global_pos.
y();
224 Float_t g_abs_z = std::fabs(global_pos.
z());
226 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
241 Int_t region_id =
region->region();
243 Int_t station_id =
station->station();
244 const auto& superChamberVec =
station->superChambers();
245 if (superChamberVec.empty()) {
247 <<
" and station = " << station_id;
251 if (super_chamber ==
nullptr) {
253 <<
" and station = " << station_id;
256 for (
const auto& chamber : super_chamber->
chambers()) {
257 Int_t layer_id = chamber->id().layer();
258 ME3IdsKey key3{region_id, station_id, layer_id};
265 for (
const auto& simhit : *simhit_container.
product()) {
268 if (gem->
idToDet(simhit.detUnitId()) ==
nullptr) {
273 GEMDetId simhit_gemid(simhit.detUnitId());
275 Int_t region_id = simhit_gemid.
region();
276 Int_t station_id = simhit_gemid.station();
277 Int_t layer_id = simhit_gemid.layer();
278 Int_t chamber_id = simhit_gemid.chamber();
279 Int_t ieta = simhit_gemid.ieta();
280 Int_t num_layers = simhit_gemid.nlayers();
283 ME3IdsKey key3{region_id, station_id, layer_id};
287 const auto& simhit_local_pos = simhit.localPosition();
288 const auto& simhit_global_pos = roll->
surface().
toGlobal(simhit_local_pos);
290 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
291 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
293 auto simhit_trackId = simhit.trackId();
295 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
297 auto links = digiSimLink->find(simhit_gemid);
298 if (
links == digiSimLink->end())
301 Int_t simhit_strip = -1;
303 if (simhit_trackId ==
link.getTrackId()) {
304 simhit_strip =
link.getStrip();
308 Int_t simhit_pad = roll->
padOfStrip(simhit_strip);
309 auto range = collection->get(simhit_gemid);
310 for (
auto cluster =
range.first; cluster !=
range.second; ++cluster) {
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
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > digisimlink_token_
MEMap3Ids me_total_cluster_
Bool_t matchClusterAgainstSimHit(GEMPadDigiClusterCollection::const_iterator, Int_t)
virtual void setCurrentFolder(std::string const &fullpath)
MEMap1Ids me_detail_occ_zr_
Bool_t isMuonSimHit(const PSimHit &)
const GeomDet * idToDet(DetId) const override
Geom::Phi< T > phi() const
MEMap3Ids me_detail_occ_pad_
edm::EDGetTokenT< GEMPadDigiClusterCollection > pad_cluster_token_
MEMap2Ids me_detail_pad_cluster_occ_det_
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
~GEMPadDigiClusterValidation() override
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)
edm::EDGetTokenT< edm::PSimHitContainer > simhit_token_
constexpr int nlayers() const
constexpr int region() const
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Abs< T >::type abs(const T &t)
std::vector< Double_t > eta_range_
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="")
T const * product() const
ParameterSet const & getParameterSet(std::string const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
constexpr int chamber() const
constexpr int layer() const
GEMDetId id() const
Return the GEMDetId of this super chamber.
T getParameter(std::string const &) const
constexpr int station() const
std::vector< DigiType >::const_iterator const_iterator
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
MEMap3Ids me_pad_cluster_occ_phi_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEMap3Ids me_pad_cluster_occ_eta_
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)
MEMap2Ids me_detail_occ_det_
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
const std::string kLogCategory_
MEMap3Ids me_detail_occ_phi_pad_
GEMPadDigiClusterValidation(const edm::ParameterSet &)
MEMap3Ids me_detail_occ_xy_
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)