8 copad_token_ = consumes<GEMCoPadDigiCollection>(copad_tag);
9 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
10 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
12 gem_bx_min_ = copad_pset.getParameter<
int>(
"minBX");
13 gem_bx_max_ = copad_pset.getParameter<
int>(
"maxBX");
25 Int_t region_id =
region->region();
31 Int_t station_id =
station->station();
32 const auto& superChamberVec =
station->superChambers();
33 if (superChamberVec.empty() || superChamberVec[0] ==
nullptr) {
35 <<
" and station = " << station_id;
38 const auto& chamberVec = superChamberVec[0]->chambers();
39 if (chamberVec.empty() || chamberVec[0] ==
nullptr) {
41 <<
", " << station_id <<
", " << superChamberVec[0]->id() <<
")";
44 const auto& etaPartitionVec = chamberVec[0]->etaPartitions();
45 if (etaPartitionVec.empty() || etaPartitionVec[0] ==
nullptr) {
47 << region_id <<
", " << station_id <<
", " << superChamberVec[0]->id() <<
", "
48 << chamberVec[0]->id() <<
")";
51 Int_t num_pads = etaPartitionVec[0]->npads();
71 booker, key2,
"copad_occ_pad",
"CoPad Ocupancy per pad number", num_pads, 0.5, num_pads + 0.5,
"Pad number");
81 Int_t region_id =
region->region();
83 Int_t station_id =
station->station();
87 bookHist1D(booker, key2,
"copad_bx",
"CoPad Bunch Crossing", 5, -2.5, 2.5,
"Bunch crossing");
100 if (not copad_collection.
isValid()) {
106 for (
const auto& copad_pair : *copad_collection) {
108 const auto&
range = copad_pair.second;
110 Int_t region_id = gemid.
region();
111 Int_t station_id = gemid.
station();
113 Int_t layer_id = gemid.
layer();
114 Int_t chamber_id = gemid.
chamber();
115 Int_t num_layers = gemid.
nlayers();
119 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
122 GEMDetId super_chamber_id{region_id,
ring_id, station_id, 0, chamber_id, 0};
123 Int_t roll_id = (*digi).roll();
126 if (geom_det ==
nullptr) {
128 <<
"loaded from GEMGeometry // Original" << gemid <<
" station : " << station_id
130 <<
"Getting DetId failed. Discard this gem copad hit." << std::endl;
136 if (super_chamber ==
nullptr) {
140 Int_t pad1 = digi->pad(1);
141 Int_t pad2 = digi->pad(2);
142 Int_t bx1 = digi->bx(1);
143 Int_t bx2 = digi->bx(2);
148 if (bx2 < gem_bx_min_ or bx2 > gem_bx_max_)
151 const Int_t padArray[] = {pad1, pad2};
154 for (; ptCounter < 2; ++ptCounter) {
156 if (chamber ==
nullptr) {
158 <<
" is null for super chamber = " << super_chamber_id;
162 if (etaPartition ==
nullptr) {
164 << (ptCounter + 1) <<
", " << super_chamber_id <<
")";
167 lpArray[ptCounter] = etaPartition->
centreOfPad(padArray[ptCounter]);
173 const GlobalPoint& gp1 = surface.toGlobal(lpArray[0]);
174 const GlobalPoint& gp2 = surface.toGlobal(lpArray[1]);
176 Float_t g_r1 = gp1.
perp();
177 Float_t g_r2 = gp2.
perp();
179 Float_t g_z1 = gp1.
z();
180 Float_t g_z2 = gp2.
z();
182 Float_t g_phi = gp1.
phi();
183 Float_t g_x = gp1.
x();
184 Float_t g_y = gp1.
y();
188 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
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")
edm::EDGetTokenT< GEMCoPadDigiCollection > copad_token_
const GEMChamber * chamber(GEMDetId id) const
Return the chamber corresponding to the given id.
virtual void setCurrentFolder(std::string const &fullpath)
const GeomDet * idToDet(DetId) const override
Geom::Phi< T > phi() const
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.
MEMap2Ids me_detail_occ_phi_pad_
const uint16_t range(const Frame &aFrame)
bool getData(T &iHolder) const
GEMCoPadDigiValidation(const edm::ParameterSet &)
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
constexpr int nlayers() const
~GEMCoPadDigiValidation() override
constexpr int region() const
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
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="")
const GEMSuperChamber * superChamber(GEMDetId id) const
void analyze(const edm::Event &, const edm::EventSetup &) override
ParameterSet const & getParameterSet(std::string const &) const
constexpr int chamber() const
constexpr int ring() const
constexpr int layer() const
T getParameter(std::string const &) const
constexpr int station() const
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return the eta partition corresponding to the given id.
std::tuple< Int_t, Int_t > ME2IdsKey
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
MEMap2Ids me_detail_occ_pad_
MEMap2Ids me_detail_occ_det_
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const std::string kLogCategory_
MEMap2Ids 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)
MEMap1Ids me_detail_occ_zr_