6 const auto& strip_pset =
pset.getParameterSet(
"gemStripDigi");
7 const auto& strip_tag = strip_pset.getParameter<
edm::InputTag>(
"inputTag");
10 const auto& simhit_pset =
pset.getParameterSet(
"gemSimHit");
11 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()) {
37 for (
const auto&
region :
gem->regions()) {
42 Int_t region_id =
region->region();
48 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;
63 Int_t layer_id =
chamber->id().layer();
64 ME3IdsKey key3(region_id, station_id, layer_id);
67 bookHist1D(booker, key3,
"bx",
"Strip Digi Bunch Crossing", 5, -2.5, 2.5,
"Bunch crossing");
76 booker.
book1D(
"total_strips_per_event",
"Number of strip digi per event", 50, -0.5, 395.5);
78 for (
const auto&
region :
gem->regions()) {
79 Int_t region_id =
region->region();
85 Int_t station_id =
station->station();
92 bookHist1D(booker, key2,
"total_strips_per_event",
"Number of strip digs per event", 50, -0.5, 99.5);
100 const auto& superChamberVec =
station->superChambers();
101 if (superChamberVec.empty() || superChamberVec[0] ==
nullptr) {
103 <<
" and station = " << station_id;
105 for (
const auto& etaPart : superChamberVec[0]->
chambers()[0]->etaPartitions()) {
106 Int_t
ieta = etaPart->id().ieta();
113 << station_id <<
", " << superChamberVec[0]->id() <<
")";
116 Int_t layer_id =
chamber->id().layer();
117 ME3IdsKey key3{region_id, station_id, layer_id};
119 const auto& etaPartitionsVec =
chamber->etaPartitions();
120 if (etaPartitionsVec.empty() || etaPartitionsVec.front() ==
nullptr) {
122 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", " 123 << station_id <<
", " << superChamberVec[0]->id() <<
", " <<
chamber->id() <<
")";
128 Int_t num_strips = etaPartitionsVec.front()->nstrips();
132 "sim_matched_occ_eta",
133 "Matched Strip Eta Occupancy",
140 booker, key3,
"sim_matched_occ_phi",
"Matched Strip Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
147 "Strip Digi Occupancy per strip number",
163 if (!gemH.isValid()) {
171 if (not digiSimLink.
isValid()) {
178 if (not simhit_container.
isValid()) {
185 if (not digi_collection.
isValid()) {
191 Int_t total_strip = 0;
192 std::map<ME2IdsKey, Int_t> total_strip_2IdsMap;
193 for (
const auto digi_pair : *digi_collection) {
195 if (
gem->idToDet(
id) ==
nullptr) {
197 <<
"from unmatched geometry." << std::endl;
201 Int_t region_id =
id.region();
202 Int_t layer_id =
id.layer();
203 Int_t station_id =
id.station();
204 Int_t chamber_id =
id.chamber();
205 Int_t
ieta =
id.ieta();
206 Int_t num_layers =
id.nlayers();
209 ME3IdsKey key3{region_id, station_id, layer_id};
210 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
216 auto links = digiSimLink->find(
id);
217 if (
links == digiSimLink->end())
220 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
222 total_strip_2IdsMap[key2]++;
223 Int_t
strip = digi->strip();
224 Int_t
bx = digi->bx();
230 Float_t digi_g_x = strip_global_pos.
x();
231 Float_t digi_g_y = strip_global_pos.
y();
232 Float_t digi_g_r = strip_global_pos.
perp();
233 Float_t digi_g_abs_z =
std::abs(strip_global_pos.
z());
248 for (
const auto&
region :
gem->regions()) {
249 Int_t region_id =
region->region();
251 Int_t station_id =
station->station();
259 for (
const auto& simhit : *simhit_container.
product()) {
260 if (
gem->idToDet(simhit.detUnitId()) ==
nullptr) {
265 GEMDetId simhit_gemid(simhit.detUnitId());
267 Int_t region_id = simhit_gemid.
region();
268 Int_t station_id = simhit_gemid.station();
269 Int_t layer_id = simhit_gemid.layer();
270 Int_t chamber_id = simhit_gemid.chamber();
271 Int_t
ieta = simhit_gemid.ieta();
272 Int_t num_layers = simhit_gemid.nlayers();
276 ME3IdsKey key3{region_id, station_id, layer_id};
280 const auto& simhit_local_pos = simhit.localPosition();
281 const auto& simhit_global_pos = roll->
surface().
toGlobal(simhit_local_pos);
283 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
284 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
286 auto simhit_trackId = simhit.trackId();
288 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
290 auto links = digiSimLink->find(simhit_gemid);
291 if (
links == digiSimLink->end())
295 if (simhit_trackId ==
link.getTrackId()) {
296 Int_t pid = simhit.particleType();
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 region() const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * me_detail_bx_
Bool_t isMuonSimHit(const PSimHit &)
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
T const * product() const
MonitorElement * me_detail_total_strip_all_
GEMStripDigiValidation(const edm::ParameterSet &)
Log< level::Error, false > LogError
dqm::impl::MonitorElement * bookZROccupancy(DQMStore::IBooker &booker, Int_t region_id, const char *name_prfix, const char *title_prefix)
MEMap3Ids me_detail_strip_occ_phi_
MEMap1Ids me_detail_occ_zr_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
MEMap3Ids me_detail_occ_strip_
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
MEMap3Ids me_detail_occ_xy_
MEMap2Ids me_detail_occ_det_
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > digisimlink_token_
void analyze(const edm::Event &, const edm::EventSetup &) override
Int_t getPidIdx(Int_t pid)
MEMap3Ids me_occ_pid_eta_
Abs< T >::type abs(const T &t)
std::vector< Double_t > eta_range_
MEMap3Ids me_detail_strip_occ_eta_
edm::EDGetTokenT< GEMDigiCollection > strip_token_
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
const Plane & surface() const
The nominal surface of the GeomDet.
std::pair< const_iterator, const_iterator > Range
edm::EDGetTokenT< edm::PSimHitContainer > simhit_token_
MEMap3Ids me_detail_bx_layer_
~GEMStripDigiValidation() override
std::tuple< Int_t, Int_t > ME2IdsKey
Float_t toDegree(Float_t radian)
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
MEMap2Ids me_detail_strip_occ_det_
MEMap2Ids me_detail_total_strip_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static char chambers[264][20]
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
dqm::impl::MonitorElement * bookPIDHist(DQMStore::IBooker &booker, const T &key, const char *name, const char *title)
const std::string kLogCategory_
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)