CMS 3D CMS Logo

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

#include <GEMStripDigiValidation.h>

Inheritance diagram for GEMStripDigiValidation:
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
 
 GEMStripDigiValidation (const edm::ParameterSet &)
 
 ~GEMStripDigiValidation () 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_
 
MonitorElementtheStrip [2][3][2]
 
MonitorElementtheStrip_bx [2][3][2]
 
std::unordered_map< UInt_t, MonitorElement * > theStrip_dcEta
 
MonitorElementtheStrip_phistrip [2][3][2]
 
std::unordered_map< UInt_t, MonitorElement * > theStrip_simple_zr
 
MonitorElementtheStrip_xy [2][3][2]
 
std::unordered_map< UInt_t, MonitorElement * > theStrip_xy_ch
 
MonitorElementtheStrip_zr [2][3][2]
 

Additional Inherited Members

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

Detailed Description

Definition at line 9 of file GEMStripDigiValidation.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file GEMStripDigiValidation.cc.

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

6  : GEMBaseValidation(cfg) {
7  InputTagToken_ = consumes<GEMDigiCollection>(cfg.getParameter<edm::InputTag>("stripLabel"));
8  detailPlot_ = cfg.getParameter<bool>("detailPlot");
9 }
T getParameter(std::string const &) const
GEMBaseValidation(const edm::ParameterSet &ps)
GEMStripDigiValidation::~GEMStripDigiValidation ( )
override

Definition at line 113 of file GEMStripDigiValidation.cc.

113 {}

Member Function Documentation

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

Implements GEMBaseValidation.

Definition at line 115 of file GEMStripDigiValidation.cc.

References GEMEtaPartition::centreOfStrip(), relativeConstraints::chamber, gather_cfg::cout, detailPlot_, GEMGeometry::etaPartition(), MonitorElement::Fill(), edm::EventSetup::get(), GEMBaseValidation::getSuffixName(), runTauDisplay::gp, GEMGeometry::idToDet(), InputTagToken_, edm::HandleBase::isValid(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), AlCaHLTBitMon_QueryRunRegistry::string, digitizers_cfi::strip, GeomDet::surface(), theStrip, theStrip_bx, theStrip_dcEta, theStrip_phistrip, theStrip_simple_zr, theStrip_xy, theStrip_xy_ch, theStrip_zr, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

115  {
116  const GEMGeometry *GEMGeometry_;
117  try {
119  iSetup.get<MuonGeometryRecord>().get(hGeom);
120  GEMGeometry_ = &*hGeom;
122  edm::LogError("GEMStripDigiValidation") << "+++ Error : GEM geometry is unavailable on event loop. +++\n";
123  return;
124  }
125 
127  e.getByToken(this->InputTagToken_, gem_digis);
128  if (!gem_digis.isValid()) {
129  edm::LogError("GEMStripDigiValidation") << "Cannot get strips by Token stripToken.\n";
130  return;
131  }
132  for (GEMDigiCollection::DigiRangeIterator cItr = gem_digis->begin(); cItr != gem_digis->end(); cItr++) {
133  GEMDetId id = (*cItr).first;
134 
135  const GeomDet *gdet = GEMGeometry_->idToDet(id);
136  if (gdet == nullptr) {
137  std::cout << "Getting DetId failed. Discard this gem strip hit.Maybe it "
138  "comes from unmatched geometry."
139  << std::endl;
140  continue;
141  }
142  const BoundPlane &surface = gdet->surface();
143  const GEMEtaPartition *roll = GEMGeometry_->etaPartition(id);
144 
145  int re = id.region();
146  int la = id.layer();
147  int st = id.station();
148  Short_t chamber = (Short_t)id.chamber();
149  Short_t nroll = (Short_t)id.roll();
150 
152  for (digiItr = (*cItr).second.first; digiItr != (*cItr).second.second; ++digiItr) {
153  Short_t strip = (Short_t)digiItr->strip();
154  Short_t bx = (Short_t)digiItr->bx();
155 
156  LocalPoint lp = roll->centreOfStrip(digiItr->strip());
157 
158  GlobalPoint gp = surface.toGlobal(lp);
159  Float_t g_r = (Float_t)gp.perp();
160  // Float_t g_eta = (Float_t) gp.eta();
161  Float_t g_phi = (Float_t)gp.phi();
162  Float_t g_x = (Float_t)gp.x();
163  Float_t g_y = (Float_t)gp.y();
164  Float_t g_z = (Float_t)gp.z();
165 
166  int region_num = (re + 1) / 2;
167  int station_num = st - 1;
168  int layer_num = la - 1;
169 
170  int binX = (chamber - 1) * 2 + layer_num;
171  int binY = nroll;
172 
173  // Fill normal plots.
174  TString histname_suffix = getSuffixName(re);
175  TString simple_zr_histname = TString::Format("strip_simple_zr%s", histname_suffix.Data());
176  theStrip_simple_zr[simple_zr_histname.Hash()]->Fill(fabs(g_z), g_r);
177 
178  histname_suffix = getSuffixName(re, st);
179  TString dcEta_histname = TString::Format("strip_dcEta%s", histname_suffix.Data());
180  theStrip_dcEta[dcEta_histname.Hash()]->Fill(binX, binY);
181 
182  // Fill detail plots.
183  if (detailPlot_) {
184  if (theStrip_xy[region_num][station_num][layer_num] != nullptr) {
185  theStrip_xy[region_num][station_num][layer_num]->Fill(g_x, g_y);
186  theStrip_phistrip[region_num][station_num][layer_num]->Fill(g_phi, strip);
187  theStrip[region_num][station_num][layer_num]->Fill(strip);
188  theStrip_bx[region_num][station_num][layer_num]->Fill(bx);
189  theStrip_zr[region_num][station_num][layer_num]->Fill(g_z, g_r);
190 
191  std::string name_prefix = getSuffixName(re, st, la);
192  TString hname;
193  if (chamber % 2 == 0) {
194  hname = TString::Format("strip_dg_xy%s_even", name_prefix.c_str());
195  } else {
196  hname = TString::Format("strip_dg_xy%s_odd", name_prefix.c_str());
197  }
198  theStrip_xy_ch[hname.Hash()]->Fill(g_x, g_y);
199  } else {
200  std::cout << "Error is occued when histograms is called." << std::endl;
201  }
202  }
203  }
204  }
205 }
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::unordered_map< UInt_t, MonitorElement * > theStrip_dcEta
MonitorElement * theStrip_bx[2][3][2]
T y() const
Definition: PV3DBase.h:63
MonitorElement * theStrip_phistrip[2][3][2]
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
MonitorElement * theStrip[2][3][2]
LocalPoint centreOfStrip(int strip) const
void Fill(long long x)
std::string getSuffixName(int region, int station, int layer)
T z() const
Definition: PV3DBase.h:64
bool isValid() const
Definition: HandleBase.h:74
std::unordered_map< UInt_t, MonitorElement * > theStrip_xy_ch
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:38
std::vector< DigiType >::const_iterator const_iterator
MonitorElement * theStrip_zr[2][3][2]
T get() const
Definition: EventSetup.h:71
std::unordered_map< UInt_t, MonitorElement * > theStrip_simple_zr
T x() const
Definition: PV3DBase.h:62
MonitorElement * theStrip_xy[2][3][2]
void GEMStripDigiValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  Run,
edm::EventSetup const &  iSetup 
)
override

Definition at line 11 of file GEMStripDigiValidation.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, theStrip, theStrip_bx, theStrip_dcEta, theStrip_phistrip, theStrip_simple_zr, theStrip_xy, theStrip_xy_ch, and theStrip_zr.

13  {
14  const GEMGeometry *GEMGeometry_ = initGeometry(iSetup);
15  if (GEMGeometry_ == nullptr)
16  return;
17  LogDebug("GEMStripDigiValidation") << "Geometry is acquired from MuonGeometryRecord\n";
18  ibooker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask");
19  LogDebug("GEMStripDigiValidation") << "ibooker set current folder\n";
20 
21  LogDebug("GEMStripDigiValidation") << "nregions set.\n";
22  LogDebug("GEMStripDigiValidation") << "nstations set.\n";
23  int nstripsGE11 = 384;
24  int nstripsGE21 = 768;
25 
26  LogDebug("GEMStripDigiValidation") << "Successfully binning set.\n";
27 
28  int nstrips = 0;
29 
30  for (auto &region : GEMGeometry_->regions()) {
31  int re = region->region();
32  TString title_suffix = getSuffixTitle(re);
33  TString histname_suffix = getSuffixName(re);
34  TString simpleZR_title = TString::Format("ZR Occupancy%s; |Z|(cm) ; R(cm)", title_suffix.Data());
35  TString simpleZR_histname = TString::Format("strip_simple_zr%s", histname_suffix.Data());
36 
37  auto *simpleZR = getSimpleZR(ibooker, simpleZR_title, simpleZR_histname);
38  if (simpleZR != nullptr) {
39  theStrip_simple_zr[simpleZR_histname.Hash()] = simpleZR;
40  }
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("strip_dcEta%s", histname_suffix2.Data());
50 
51  auto *dcEta = getDCEta(ibooker, station, dcEta_title, dcEta_histname);
52  if (dcEta != nullptr) {
53  theStrip_dcEta[dcEta_histname.Hash()] = dcEta;
54  }
55  }
56  }
57 
58  // Booking detail plot.
59  if (detailPlot_) {
60  for (auto &region : GEMGeometry_->regions()) {
61  for (auto &station : region->stations()) {
62  for (int la = 1; la <= 2; la++) {
63  int re = region->region();
64  int st = station->station();
65  int region_num = (re + 1) / 2;
66  int station_num = st - 1;
67  int layer_num = la - 1;
68 
69  if (st == 1)
70  nstrips = nstripsGE11;
71  else
72  nstrips = nstripsGE21;
73  std::string name_prefix = getSuffixName(re, st, la);
74  std::string label_prefix = getSuffixTitle(re, st, la);
75  theStrip_phistrip[region_num][station_num][layer_num] =
76  ibooker.book2D(("strip_dg_phistrip" + name_prefix).c_str(),
77  ("Digi occupancy: " + label_prefix + "; phi [rad];strip number").c_str(),
78  280,
79  -TMath::Pi(),
80  TMath::Pi(),
81  nstrips / 2,
82  0,
83  nstrips);
84  theStrip[region_num][station_num][layer_num] =
85  ibooker.book1D(("strip_dg" + name_prefix).c_str(),
86  ("Digi occupancy per stip number: " + label_prefix + ";strip number; entries").c_str(),
87  nstrips,
88  0.5,
89  nstrips + 0.5);
90  theStrip_bx[region_num][station_num][layer_num] =
91  ibooker.book1D(("strip_dg_bx" + name_prefix).c_str(),
92  ("Bunch crossing: " + label_prefix + "; bunch crossing ; entries").c_str(),
93  11,
94  -5.5,
95  5.5);
96  theStrip_zr[region_num][station_num][layer_num] =
97  BookHistZR(ibooker, "strip_dg", "Strip Digi", region_num, station_num, layer_num);
98  theStrip_xy[region_num][station_num][layer_num] =
99  BookHistXY(ibooker, "strip_dg", "Strip Digi", region_num, station_num, layer_num);
100  TString xy_name = TString::Format("strip_dg_xy%s_odd", name_prefix.c_str());
101  TString xy_title = TString::Format("Digi XY occupancy %s at odd chambers", label_prefix.c_str());
102  theStrip_xy_ch[xy_name.Hash()] = ibooker.book2D(xy_name, xy_title, 360, -360, 360, 360, -360, 360);
103  xy_name = TString::Format("strip_dg_xy%s_even", name_prefix.c_str());
104  xy_title = TString::Format("Digi XY occupancy %s at even chambers", label_prefix.c_str());
105  theStrip_xy_ch[xy_name.Hash()] = ibooker.book2D(xy_name, xy_title, 360, -360, 360, 360, -360, 360);
106  }
107  }
108  }
109  }
110  LogDebug("GEMStripDigiValidation") << "Booking End.\n";
111 }
#define LogDebug(id)
const double Pi
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
std::unordered_map< UInt_t, MonitorElement * > theStrip_dcEta
MonitorElement * theStrip_bx[2][3][2]
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)
MonitorElement * theStrip_phistrip[2][3][2]
std::string getSuffixTitle(int region, int station, int layer)
const GEMGeometry * initGeometry(const edm::EventSetup &)
MonitorElement * theStrip[2][3][2]
std::string getSuffixName(int region, int station, int layer)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
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 * book2D(Args &&...args)
Definition: DQMStore.h:109
std::unordered_map< UInt_t, MonitorElement * > theStrip_xy_ch
MonitorElement * getDCEta(DQMStore::IBooker &, const GEMStation *, TString, TString)
MonitorElement * theStrip_zr[2][3][2]
std::unordered_map< UInt_t, MonitorElement * > theStrip_simple_zr
MonitorElement * theStrip_xy[2][3][2]

Member Data Documentation

bool GEMStripDigiValidation::detailPlot_
private

Definition at line 31 of file GEMStripDigiValidation.h.

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

edm::EDGetToken GEMStripDigiValidation::InputTagToken_
private

Definition at line 29 of file GEMStripDigiValidation.h.

Referenced by analyze(), and GEMStripDigiValidation().

int GEMStripDigiValidation::nBinXY_
private

Definition at line 30 of file GEMStripDigiValidation.h.

MonitorElement* GEMStripDigiValidation::theStrip[2][3][2]
private

Definition at line 20 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMStripDigiValidation::theStrip_bx[2][3][2]
private

Definition at line 21 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

std::unordered_map<UInt_t, MonitorElement *> GEMStripDigiValidation::theStrip_dcEta
private

Definition at line 26 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMStripDigiValidation::theStrip_phistrip[2][3][2]
private

Definition at line 19 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

std::unordered_map<UInt_t, MonitorElement *> GEMStripDigiValidation::theStrip_simple_zr
private

Definition at line 27 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMStripDigiValidation::theStrip_xy[2][3][2]
private

Definition at line 18 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

std::unordered_map<UInt_t, MonitorElement *> GEMStripDigiValidation::theStrip_xy_ch
private

Definition at line 23 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMStripDigiValidation::theStrip_zr[2][3][2]
private

Definition at line 22 of file GEMStripDigiValidation.h.

Referenced by analyze(), and bookHistograms().