5 const auto& copad_pset =
pset.getParameterSet(
"gemCoPadDigi");
7 const auto& copad_tag = copad_pset.getParameter<
edm::InputTag>(
"inputTag");
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");
20 if (!gemH.isValid()) {
29 for (
const auto&
region :
gem->regions()) {
30 Int_t region_id =
region->region();
36 Int_t station_id =
station->station();
37 const auto& superChamberVec =
station->superChambers();
38 if (superChamberVec.empty() || superChamberVec[0] ==
nullptr) {
40 <<
" and station = " << station_id;
43 const auto& chamberVec = superChamberVec[0]->chambers();
44 if (chamberVec.empty() || chamberVec[0] ==
nullptr) {
46 <<
", " << station_id <<
", " << superChamberVec[0]->id() <<
")";
49 const auto& etaPartitionVec = chamberVec[0]->etaPartitions();
50 if (etaPartitionVec.empty() || etaPartitionVec[0] ==
nullptr) {
52 << region_id <<
", " << station_id <<
", " << superChamberVec[0]->id() <<
", " 53 << chamberVec[0]->id() <<
")";
56 Int_t num_pads = etaPartitionVec[0]->npads();
76 booker, key2,
"copad_occ_pad",
"CoPad Ocupancy per pad number", num_pads, 0.5, num_pads + 0.5,
"Pad number");
85 for (
const auto&
region :
gem->regions()) {
86 Int_t region_id =
region->region();
88 Int_t station_id =
station->station();
92 bookHist1D(booker, key2,
"copad_bx",
"CoPad Bunch Crossing", 5, -2.5, 2.5,
"Bunch crossing");
102 if (!gemH.isValid()) {
110 if (not copad_collection.
isValid()) {
116 for (
const auto& copad_pair : *copad_collection) {
118 const auto&
range = copad_pair.second;
120 Int_t region_id = gemid.
region();
121 Int_t station_id = gemid.
station();
123 Int_t layer_id = gemid.
layer();
124 Int_t chamber_id = gemid.
chamber();
125 Int_t num_layers = gemid.
nlayers();
129 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
132 GEMDetId super_chamber_id{region_id,
ring_id, station_id, 0, chamber_id, 0};
133 Int_t roll_id = (*digi).roll();
135 const GeomDet* geom_det =
gem->idToDet(super_chamber_id);
136 if (geom_det ==
nullptr) {
138 <<
"loaded from GEMGeometry // Original" << gemid <<
" station : " << station_id
140 <<
"Getting DetId failed. Discard this gem copad hit." << std::endl;
146 if (super_chamber ==
nullptr) {
150 Int_t
pad1 = digi->pad(1);
151 Int_t
pad2 = digi->pad(2);
152 Int_t bx1 = digi->bx(1);
153 Int_t bx2 = digi->bx(2);
161 const Int_t padArray[] = {
pad1,
pad2};
164 for (; ptCounter < 2; ++ptCounter) {
168 <<
" is null for super chamber = " << super_chamber_id;
172 if (etaPartition ==
nullptr) {
174 << (ptCounter + 1) <<
", " << super_chamber_id <<
")";
177 lpArray[ptCounter] = etaPartition->
centreOfPad(padArray[ptCounter]);
183 const GlobalPoint& gp1 = surface.toGlobal(lpArray[0]);
184 const GlobalPoint& gp2 = surface.toGlobal(lpArray[1]);
186 Float_t g_r1 = gp1.
perp();
187 Float_t g_r2 = gp2.
perp();
189 Float_t g_z1 = gp1.
z();
190 Float_t g_z2 = gp2.
z();
193 Float_t
g_x = gp1.
x();
194 Float_t
g_y = gp1.
y();
198 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_
constexpr int station() const
constexpr int region() const
virtual void setCurrentFolder(std::string const &fullpath)
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)
constexpr int layer() const
MEMap2Ids me_detail_occ_phi_pad_
constexpr int chamber() 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)
~GEMCoPadDigiValidation() override
constexpr int ring() const
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="")
void analyze(const edm::Event &, const edm::EventSetup &) override
const Plane & surface() const
The nominal surface of the GeomDet.
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)
const GEMChamber * chamber(GEMDetId id) const
Return the chamber corresponding to the given id.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const std::string kLogCategory_
constexpr int nlayers() const
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_