6 const auto& pad_cluster_pset =
pset.getParameterSet(
"gemPadCluster");
7 const auto& pad_cluster_tag = pad_cluster_pset.getParameter<
edm::InputTag>(
"inputTag");
9 const auto& simhit_pset =
pset.getParameterSet(
"gemSimHit");
10 const auto& simhit_tag = simhit_pset.getParameter<
edm::InputTag>(
"inputTag");
17 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
18 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
25 if (!gemH.isValid()) {
33 TString cls_title =
"Cluster Size Distribution";
34 TString cls_x_title =
"Cluster size";
36 me_cls_ = booker.
book1D(
"cls", cls_title +
";" + cls_x_title +
";" +
"Entries", 10, 0, 10);
39 for (
const auto&
region :
gem->regions()) {
40 Int_t region_id =
region->region();
46 Int_t station_id =
station->station();
55 const auto& superChamberVec =
station->superChambers();
56 if (superChamberVec.empty()) {
58 <<
" and station = " << station_id;
62 if (super_chamber ==
nullptr) {
64 <<
" and station = " << station_id;
68 Int_t layer_id =
chamber->id().layer();
69 ME3IdsKey key3{region_id, station_id, layer_id};
71 const auto& etaPartitionVec =
chamber->etaPartitions();
72 if (etaPartitionVec.empty() || etaPartitionVec.front() ==
nullptr) {
74 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", " 75 << station_id <<
", " << super_chamber->
id() <<
", " <<
chamber->id() <<
")";
78 Int_t num_pads = etaPartitionVec.front()->npads();
81 bookHist1D(booker, key3,
"total_pad_cluster",
"Number of pad digi cluster per event", 20, 0, 20);
85 "sim_matched_occ_eta",
86 "Matched Pad Cluster Eta Occupancy",
93 booker, key3,
"sim_matched_occ_phi",
"Matched Pad Cluster Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
101 "Pad Cluster Occupancy",
112 bookHist1D(booker, key3,
"occ_pad",
"Pad Cluster Occupancy", num_pads, 0, num_pads,
"Pad number");
120 for (
const auto&
region :
gem->regions()) {
121 Int_t region_id =
region->region();
123 Int_t station_id =
station->station();
125 const auto& superChamberVec =
station->superChambers();
126 if (superChamberVec.empty()) {
128 <<
" and station = " << station_id;
132 if (super_chamber ==
nullptr) {
134 <<
" and station = " << station_id;
138 Int_t layer_id =
chamber->id().layer();
139 ME3IdsKey key3(region_id, station_id, layer_id);
141 bookHist1D(booker, key3,
"bx",
"Pad Cluster Bunch Crossing", 5, -2, 3,
"Bunch crossing");
152 for (
auto pad : cluster->pads()) {
153 if (pad == simhit_pad) {
162 if (!gemH.isValid()) {
177 if (not digiSimLink.
isValid()) {
184 if (not simhit_container.
isValid()) {
189 std::map<ME3IdsKey, Int_t> total_cluster;
191 GEMDetId gemid = (*range_iter).first;
192 const auto&
range = (*range_iter).second;
194 if (
gem->idToDet(gemid) ==
nullptr) {
196 <<
"Maybe it comes from unmatched geometry." << std::endl;
203 Int_t region_id = gemid.
region();
204 Int_t station_id = gemid.
station();
205 Int_t layer_id = gemid.
layer();
206 Int_t chamber_id = gemid.
chamber();
208 Int_t num_layers = gemid.
nlayers();
211 ME3IdsKey key3(region_id, station_id, layer_id);
213 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
214 const auto& padsVec = digi->pads();
215 if (padsVec.empty()) {
219 Int_t pad = padsVec[0];
221 total_cluster[key3]++;
224 Int_t
bx = digi->bx();
225 Int_t cls = digi->pads().size();
228 const GlobalPoint& global_pos = surface.toGlobal(local_pos);
230 Float_t g_r = global_pos.
perp();
231 Float_t g_phi = global_pos.
phi();
232 Float_t g_x = global_pos.
x();
233 Float_t g_y = global_pos.
y();
234 Float_t g_abs_z = std::fabs(global_pos.
z());
236 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
250 for (
const auto&
region :
gem->regions()) {
251 Int_t region_id =
region->region();
253 Int_t station_id =
station->station();
254 const auto& superChamberVec =
station->superChambers();
255 if (superChamberVec.empty()) {
257 <<
" and station = " << station_id;
261 if (super_chamber ==
nullptr) {
263 <<
" and station = " << station_id;
267 Int_t layer_id =
chamber->id().layer();
268 ME3IdsKey key3{region_id, station_id, layer_id};
275 for (
const auto& simhit : *simhit_container.
product()) {
278 if (
gem->idToDet(simhit.detUnitId()) ==
nullptr) {
283 GEMDetId simhit_gemid(simhit.detUnitId());
285 Int_t region_id = simhit_gemid.
region();
286 Int_t station_id = simhit_gemid.station();
287 Int_t layer_id = simhit_gemid.layer();
288 Int_t chamber_id = simhit_gemid.chamber();
289 Int_t
ieta = simhit_gemid.ieta();
290 Int_t num_layers = simhit_gemid.nlayers();
293 ME3IdsKey key3{region_id, station_id, layer_id};
297 const auto& simhit_local_pos = simhit.localPosition();
298 const auto& simhit_global_pos = roll->
surface().
toGlobal(simhit_local_pos);
300 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
301 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
303 auto simhit_trackId = simhit.trackId();
305 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
307 auto links = digiSimLink->find(simhit_gemid);
308 if (
links == digiSimLink->end())
311 Int_t simhit_strip = -1;
313 if (simhit_trackId ==
link.getTrackId()) {
314 simhit_strip =
link.getStrip();
318 Int_t simhit_pad = roll->
padOfStrip(simhit_strip);
320 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")
constexpr int station() const
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > digisimlink_token_
constexpr int region() const
MEMap3Ids me_total_cluster_
Bool_t matchClusterAgainstSimHit(GEMPadDigiClusterCollection::const_iterator, Int_t)
virtual void setCurrentFolder(std::string const &fullpath)
MEMap1Ids me_detail_occ_zr_
Geom::Phi< T > phi() const
Bool_t isMuonSimHit(const PSimHit &)
T const * product() 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)
constexpr int layer() const
constexpr int chamber() const
~GEMPadDigiClusterValidation() override
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
edm::EDGetTokenT< edm::PSimHitContainer > simhit_token_
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="")
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
constexpr int ieta() const
GEMDetId id() const
Return the GEMDetId of this super chamber.
const Plane & surface() const
The nominal surface of the GeomDet.
void analyze(const edm::Event &, const edm::EventSetup &) override
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_
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_
constexpr int nlayers() const
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
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)