CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GEMPadDigiValidation Class Reference

#include <GEMPadDigiValidation.h>

Inheritance diagram for GEMPadDigiValidation:
GEMBaseValidation one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 GEMPadDigiValidation (const edm::ParameterSet &)
 
 ~GEMPadDigiValidation () override
 
- Public Member Functions inherited from GEMBaseValidation
MonitorElementBookHistXY (DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
 
MonitorElementBookHistZR (DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
 
 GEMBaseValidation (const edm::ParameterSet &ps)
 
MonitorElementgetDCEta (DQMStore::IBooker &, const GEMStation *, TString, TString)
 
MonitorElementgetSimpleZR (DQMStore::IBooker &, TString, TString)
 
std::string getStationLabel (int i)
 
std::string getSuffixName (int region, int station, int layer)
 
std::string getSuffixName (int region, int station)
 
std::string getSuffixName (int region)
 
std::string getSuffixTitle (int region, int station, int layer)
 
std::string getSuffixTitle (int region, int station)
 
std::string getSuffixTitle (int region)
 
const GEMGeometryinitGeometry (const edm::EventSetup &)
 
unsigned int nPart ()
 
unsigned int nRegion ()
 
unsigned int nStation ()
 
unsigned int nStationForLabel ()
 
void setNStationForLabel (unsigned int number)
 
 ~GEMBaseValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Attributes

bool detailPlot_
 
edm::EDGetToken InputTagToken_
 
int nBinXY_
 
MonitorElementtheCSCPad [2][3][2]
 
MonitorElementtheCSCPad_bx [2][3][2]
 
MonitorElementtheCSCPad_phipad [2][3][2]
 
MonitorElementtheCSCPad_xy [2][3][2]
 
std::unordered_map< UInt_t, MonitorElement * > theCSCPad_xy_ch
 
MonitorElementtheCSCPad_zr [2][3][2]
 
std::unordered_map< UInt_t, MonitorElement * > thePad_dcEta
 
std::unordered_map< UInt_t, MonitorElement * > thePad_simple_zr
 

Additional Inherited Members

- Protected Attributes inherited from GEMBaseValidation
int nBinXY_
 
std::vector< double > nBinZR_
 
std::vector< double > RangeZR_
 

Detailed Description

Definition at line 8 of file GEMPadDigiValidation.h.

Constructor & Destructor Documentation

GEMPadDigiValidation::GEMPadDigiValidation ( const edm::ParameterSet cfg)
explicit

Definition at line 4 of file GEMPadDigiValidation.cc.

References detailPlot_, edm::ParameterSet::getParameter(), and InputTagToken_.

4  : GEMBaseValidation(cfg) {
5  InputTagToken_ = consumes<GEMPadDigiCollection>(cfg.getParameter<edm::InputTag>("PadLabel"));
6  detailPlot_ = cfg.getParameter<bool>("detailPlot");
7 }
T getParameter(std::string const &) const
edm::EDGetToken InputTagToken_
GEMBaseValidation(const edm::ParameterSet &ps)
GEMPadDigiValidation::~GEMPadDigiValidation ( )
override

Definition at line 110 of file GEMPadDigiValidation.cc.

110 {}

Member Function Documentation

void GEMPadDigiValidation::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements GEMBaseValidation.

Definition at line 112 of file GEMPadDigiValidation.cc.

References GEMEtaPartition::centreOfPad(), relativeConstraints::chamber, gather_cfg::cout, detailPlot_, GEMGeometry::etaPartition(), MonitorElement::Fill(), edm::EventSetup::get(), GEMBaseValidation::getSuffixName(), runTauDisplay::gp, GEMGeometry::idToDet(), InputTagToken_, edm::HandleBase::isValid(), GEMEtaPartition::pad(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDet::surface(), theCSCPad, theCSCPad_bx, theCSCPad_phipad, theCSCPad_xy, theCSCPad_xy_ch, theCSCPad_zr, thePad_dcEta, thePad_simple_zr, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

112  {
113  const GEMGeometry *GEMGeometry_;
114  try {
116  iSetup.get<MuonGeometryRecord>().get(hGeom);
117  GEMGeometry_ = &*hGeom;
119  edm::LogError("GEMPadDigiValidation") << "+++ Error : GEM geometry is unavailable on event loop. +++\n";
120  return;
121  }
123  e.getByToken(InputTagToken_, gem_digis);
124  if (!gem_digis.isValid()) {
125  edm::LogError("GEMPadDigiValidation") << "Cannot get pads by label GEMPadToken.";
126  }
127 
128  for (GEMPadDigiCollection::DigiRangeIterator cItr = gem_digis->begin(); cItr != gem_digis->end(); cItr++) {
129  GEMDetId id = (*cItr).first;
130 
131  const GeomDet *gdet = GEMGeometry_->idToDet(id);
132  if (gdet == nullptr) {
133  std::cout << "Getting DetId failed. Discard this gem pad hit.Maybe it "
134  "comes from unmatched geometry."
135  << std::endl;
136  continue;
137  }
138  const BoundPlane &surface = gdet->surface();
139  const GEMEtaPartition *roll = GEMGeometry_->etaPartition(id);
140 
141  int re = id.region();
142  int la = id.layer();
143  int st = id.station();
144  Short_t chamber = (Short_t)id.chamber();
145  Short_t nroll = (Short_t)id.roll();
147 
148  // loop over digis of given roll
149  //
150  for (digiItr = (*cItr).second.first; digiItr != (*cItr).second.second; ++digiItr) {
151  Short_t pad = (Short_t)digiItr->pad();
152  Short_t bx = (Short_t)digiItr->bx();
153 
154  LocalPoint lp = roll->centreOfPad(digiItr->pad());
155 
156  GlobalPoint gp = surface.toGlobal(lp);
157  Float_t g_r = (Float_t)gp.perp();
158  Float_t g_phi = (Float_t)gp.phi();
159  Float_t g_x = (Float_t)gp.x();
160  Float_t g_y = (Float_t)gp.y();
161  Float_t g_z = (Float_t)gp.z();
162  edm::LogInfo("GEMPadDIGIValidation") << "Global x " << g_x << "Global y " << g_y << "\n";
163  edm::LogInfo("GEMPadDIGIValidation") << "Global pad " << pad << "Global phi " << g_phi << std::endl;
164  edm::LogInfo("GEMPadDIGIValidation") << "Global bx " << bx << std::endl;
165 
166  int region_num = (re + 1) / 2;
167  int station_num = st - 1;
168  int layer_num = la - 1;
169  int binX = (chamber - 1) * 2 + layer_num;
170  int binY = nroll;
171 
172  // Fill normal plots.
173  TString histname_suffix = getSuffixName(re);
174  TString simple_zr_histname = TString::Format("pad_simple_zr%s", histname_suffix.Data());
175  thePad_simple_zr[simple_zr_histname.Hash()]->Fill(fabs(g_z), g_r);
176 
177  histname_suffix = getSuffixName(re, st);
178  TString dcEta_histname = TString::Format("pad_dcEta%s", histname_suffix.Data());
179  thePad_dcEta[dcEta_histname.Hash()]->Fill(binX, binY);
180 
181  if (detailPlot_) {
182  theCSCPad_xy[region_num][station_num][layer_num]->Fill(g_x, g_y);
183  theCSCPad_phipad[region_num][station_num][layer_num]->Fill(g_phi, pad);
184  theCSCPad[region_num][station_num][layer_num]->Fill(pad);
185  theCSCPad_bx[region_num][station_num][layer_num]->Fill(bx);
186  theCSCPad_zr[region_num][station_num][layer_num]->Fill(g_z, g_r);
187  std::string name_prefix = getSuffixName(re, st, la);
188  TString hname;
189  if (chamber % 2 == 0) {
190  hname = TString::Format("pad_dg_xy%s_even", name_prefix.c_str());
191  } else {
192  hname = TString::Format("pad_dg_xy%s_odd", name_prefix.c_str());
193  }
194  theCSCPad_xy_ch[hname.Hash()]->Fill(g_x, g_y);
195  }
196  }
197  }
198 }
MonitorElement * theCSCPad_zr[2][3][2]
T perp() const
Definition: PV3DBase.h:72
MonitorElement * theCSCPad[2][3][2]
MonitorElement * theCSCPad_xy[2][3][2]
edm::EDGetToken InputTagToken_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
std::unordered_map< UInt_t, MonitorElement * > thePad_dcEta
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:99
void Fill(long long x)
std::string getSuffixName(int region, int station, int layer)
std::unordered_map< UInt_t, MonitorElement * > thePad_simple_zr
std::unordered_map< UInt_t, MonitorElement * > theCSCPad_xy_ch
T z() const
Definition: PV3DBase.h:64
float pad(const LocalPoint &lp) const
returns FRACTIONAL pad number [0.,npads) for a point
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * theCSCPad_bx[2][3][2]
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:38
std::vector< DigiType >::const_iterator const_iterator
LocalPoint centreOfPad(int pad) const
T get() const
Definition: EventSetup.h:71
MonitorElement * theCSCPad_phipad[2][3][2]
T x() const
Definition: PV3DBase.h:62
void GEMPadDigiValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  Run,
edm::EventSetup const &  iSetup 
)
override

Definition at line 8 of file GEMPadDigiValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), GEMBaseValidation::BookHistXY(), GEMBaseValidation::BookHistZR(), detailPlot_, GEMBaseValidation::getDCEta(), GEMBaseValidation::getSimpleZR(), GEMBaseValidation::getSuffixName(), GEMBaseValidation::getSuffixTitle(), GEMBaseValidation::initGeometry(), LogDebug, Pi, GEMGeometry::regions(), DQMStore::IBooker::setCurrentFolder(), relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, theCSCPad, theCSCPad_bx, theCSCPad_phipad, theCSCPad_xy, theCSCPad_xy_ch, theCSCPad_zr, thePad_dcEta, and thePad_simple_zr.

10  {
11  const GEMGeometry *GEMGeometry_ = initGeometry(iSetup);
12  if (GEMGeometry_ == nullptr)
13  return;
14  LogDebug("GEMPadDigiValidation") << "Geometry is acquired from MuonGeometryRecord\n";
15  ibooker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask");
16  LogDebug("GEMPadDigiValidation") << "ibooker set current folder\n";
17 
18  if (GEMGeometry_ == nullptr)
19  return;
20  int npadsGE11 =
21  GEMGeometry_->regions()[0]->stations()[0]->superChambers()[0]->chambers()[0]->etaPartitions()[0]->npads();
22  int npadsGE21 = 0;
23  int nPads = 0;
24 
25  if (GEMGeometry_->regions()[0]->stations().size() > 1 &&
26  !GEMGeometry_->regions()[0]->stations()[1]->superChambers().empty()) {
27  npadsGE21 =
28  GEMGeometry_->regions()[0]->stations()[1]->superChambers()[0]->chambers()[0]->etaPartitions()[0]->npads();
29  }
30 
31  for (auto &region : GEMGeometry_->regions()) {
32  int re = region->region();
33  TString title_suffix = getSuffixTitle(re);
34  TString histname_suffix = getSuffixName(re);
35  TString simpleZR_title = TString::Format("ZR Occupancy%s; |Z|(cm) ; R(cm)", title_suffix.Data());
36  TString simpleZR_histname = TString::Format("pad_simple_zr%s", histname_suffix.Data());
37 
38  auto *simpleZR = getSimpleZR(ibooker, simpleZR_title, simpleZR_histname);
39  if (simpleZR != nullptr) {
40  thePad_simple_zr[simpleZR_histname.Hash()] = simpleZR;
41  }
42  for (auto &station : region->stations()) {
43  int st = station->station();
44  TString title_suffix2 = getSuffixTitle(re, st);
45  TString histname_suffix2 = getSuffixName(re, st);
46 
47  TString dcEta_title =
48  TString::Format("Occupancy for detector component %s;;#eta-partition", title_suffix2.Data());
49  TString dcEta_histname = TString::Format("pad_dcEta%s", histname_suffix2.Data());
50 
51  auto *dcEta = getDCEta(ibooker, station, dcEta_title, dcEta_histname);
52  if (dcEta != nullptr) {
53  thePad_dcEta[dcEta_histname.Hash()] = dcEta;
54  }
55  }
56  }
57 
58  if (detailPlot_) {
59  for (auto &region : GEMGeometry_->regions()) {
60  int re = region->region();
61  int region_num = (re + 1) / 2;
62  for (auto &station : region->stations()) {
63  int st = station->station();
64  int station_num = st - 1;
65  if (station_num == 0)
66  nPads = npadsGE11;
67  else
68  nPads = npadsGE21;
69  for (int la = 1; la <= 2; la++) {
70  int layer_num = la - 1;
71  std::string name_prefix = getSuffixName(re, st, la);
72  std::string label_prefix = getSuffixTitle(re, st, la);
73  theCSCPad_phipad[region_num][station_num][layer_num] =
74  ibooker.book2D(("pad_dg_phipad" + name_prefix).c_str(),
75  ("Digi occupancy: " + label_prefix + "; phi [rad]; Pad number").c_str(),
76  280,
77  -TMath::Pi(),
78  TMath::Pi(),
79  nPads / 2,
80  0,
81  nPads);
82  theCSCPad[region_num][station_num][layer_num] =
83  ibooker.book1D(("pad_dg" + name_prefix).c_str(),
84  ("Digi occupancy per pad number: " + label_prefix + ";Pad number; entries").c_str(),
85  nPads,
86  0.5,
87  nPads + 0.5);
88  theCSCPad_bx[region_num][station_num][layer_num] =
89  ibooker.book1D(("pad_dg_bx" + name_prefix).c_str(),
90  ("Bunch crossing: " + label_prefix + "; bunch crossing ; entries").c_str(),
91  11,
92  -5.5,
93  5.5);
94  theCSCPad_zr[region_num][station_num][layer_num] =
95  BookHistZR(ibooker, "pad_dg", "Pad Digi", region_num, station_num, layer_num);
96  theCSCPad_xy[region_num][station_num][layer_num] =
97  BookHistXY(ibooker, "pad_dg", "Pad Digi", region_num, station_num, layer_num);
98  TString xy_name = TString::Format("pad_dg_xy%s_odd", name_prefix.c_str());
99  TString xy_title = TString::Format("Digi XY occupancy %s at odd chambers", label_prefix.c_str());
100  theCSCPad_xy_ch[xy_name.Hash()] = ibooker.book2D(xy_name, xy_title, 360, -360, 360, 360, -360, 360);
101  xy_name = TString::Format("pad_dg_xy%s_even", name_prefix.c_str());
102  xy_title = TString::Format("Digi XY occupancy %s at even chambers", label_prefix.c_str());
103  theCSCPad_xy_ch[xy_name.Hash()] = ibooker.book2D(xy_name, xy_title, 360, -360, 360, 360, -360, 360);
104  }
105  }
106  }
107  }
108 }
#define LogDebug(id)
MonitorElement * theCSCPad_zr[2][3][2]
const double Pi
MonitorElement * theCSCPad[2][3][2]
MonitorElement * theCSCPad_xy[2][3][2]
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
MonitorElement * getSimpleZR(DQMStore::IBooker &, TString, TString)
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
std::string getSuffixTitle(int region, int station, int layer)
std::unordered_map< UInt_t, MonitorElement * > thePad_dcEta
const GEMGeometry * initGeometry(const edm::EventSetup &)
std::string getSuffixName(int region, int station, int layer)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::unordered_map< UInt_t, MonitorElement * > thePad_simple_zr
std::unordered_map< UInt_t, MonitorElement * > theCSCPad_xy_ch
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Definition: GEMGeometry.cc:43
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * theCSCPad_bx[2][3][2]
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * getDCEta(DQMStore::IBooker &, const GEMStation *, TString, TString)
MonitorElement * theCSCPad_phipad[2][3][2]

Member Data Documentation

bool GEMPadDigiValidation::detailPlot_
private

Definition at line 30 of file GEMPadDigiValidation.h.

Referenced by analyze(), bookHistograms(), and GEMPadDigiValidation().

edm::EDGetToken GEMPadDigiValidation::InputTagToken_
private

Definition at line 28 of file GEMPadDigiValidation.h.

Referenced by analyze(), and GEMPadDigiValidation().

int GEMPadDigiValidation::nBinXY_
private

Definition at line 29 of file GEMPadDigiValidation.h.

MonitorElement* GEMPadDigiValidation::theCSCPad[2][3][2]
private

Definition at line 19 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMPadDigiValidation::theCSCPad_bx[2][3][2]
private

Definition at line 20 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMPadDigiValidation::theCSCPad_phipad[2][3][2]
private

Definition at line 18 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMPadDigiValidation::theCSCPad_xy[2][3][2]
private

Definition at line 17 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

std::unordered_map<UInt_t, MonitorElement *> GEMPadDigiValidation::theCSCPad_xy_ch
private

Definition at line 22 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMPadDigiValidation::theCSCPad_zr[2][3][2]
private

Definition at line 21 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

std::unordered_map<UInt_t, MonitorElement *> GEMPadDigiValidation::thePad_dcEta
private

Definition at line 25 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().

std::unordered_map<UInt_t, MonitorElement *> GEMPadDigiValidation::thePad_simple_zr
private

Definition at line 26 of file GEMPadDigiValidation.h.

Referenced by analyze(), and bookHistograms().