CMS 3D CMS Logo

GEMCheckGeometry.cc
Go to the documentation of this file.
6 
7 #include <iomanip>
8 
10  GE11PhiBegin_ = gc.getUntrackedParameter<double>("GE11PhiBegin", -5.);
11  GE11PhiStep_ = gc.getUntrackedParameter<double>("GE11PhiStep", 10);
12  minPhi_ = gc.getUntrackedParameter<double>("minPhi", -180.);
13  maxPhi_ = gc.getUntrackedParameter<double>("maxPhi", +180.);
14  detailPlot_ = gc.getParameter<bool>("detailPlot");
15  geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
16 }
17 
19  if (!detailPlot_)
20  return;
21 
22  const auto gemH = iSetup.getHandle(geomToken_);
23  if (!gemH.isValid()) {
24  edm::LogError("GEMCheckGeometry") << "Failed to initialize GEM geometry.";
25  return;
26  }
27  const GEMGeometry *geometry = gemH.product();
28 
29  ibooker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask");
30  LogDebug("GEMCheckGeometry") << "ibooker set current folder\n";
31 
32  for (auto region : geometry->regions()) {
33  TString title = TString::Format("Geometry's phi distribution on Region %d ; #phi(degree); ;", region->region());
34  TString name = TString::Format("geo_phi_r%d", region->region());
35  auto temp_me = ibooker.book2D(name.Data(), title.Data(), 360000, -180., 180, 12, 1, 13);
36  temp_me->setBinLabel(1, "St1,La1_even", 2);
37  temp_me->setBinLabel(2, "St1,La1_odd", 2);
38  temp_me->setBinLabel(3, "St1,La2_even", 2);
39  temp_me->setBinLabel(4, "St1,La2_odd", 2);
40  temp_me->setBinLabel(5, "St2,La1_even", 2);
41  temp_me->setBinLabel(6, "St2,La1_odd", 2);
42  temp_me->setBinLabel(7, "St2,La2_even", 2);
43  temp_me->setBinLabel(8, "St2,La2_odd", 2);
45  }
46 
47  for (auto region : geometry->regions()) {
48  for (auto station : region->stations()) {
49  for (auto ring : station->rings()) {
50  for (auto sch : ring->superChambers()) {
51  for (auto ch : sch->chambers()) {
52  for (auto roll : ch->etaPartitions()) {
53  const StripTopology *topology(&(roll->specificTopology()));
54  auto parameters(roll->specs()->parameters());
55  float nStrips(parameters[3]);
56  for (int strip = 0; strip <= nStrips; strip++) {
57  LocalPoint lEdge(topology->localPosition(strip));
58 
59  double phi = roll->toGlobal(lEdge).phi().degrees();
60 
61  GEMDetId id(roll->id());
62  int region_idx = id.region();
63  int station_idx = id.station();
64  int chamber_idx = id.chamber();
65  int layer_idx = id.layer();
66  int value = (station_idx - 1) * 4 + (layer_idx - 1) * 2 + (chamber_idx % 2) + 1;
67 
68  if (region_idx == 1) {
69  UInt_t hash = TString("geo_phi_r1").Hash();
70  theStdPlots[hash]->Fill(phi, value);
71  } else {
72  UInt_t hash = TString("geo_phi_r-1").Hash();
73  theStdPlots[hash]->Fill(phi, value);
74  }
75  }
76  }
77  }
78  }
79  }
80  }
81  }
82 }
83 
85 
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< UInt_t, MonitorElement * > theStdPlots
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
~GEMCheckGeometry() override
void analyze(const edm::Event &e, const edm::EventSetup &) override
Log< level::Error, false > LogError
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
T getUntrackedParameter(std::string const &, T const &) const
GEMCheckGeometry(const edm::ParameterSet &gc)
Definition: value.py:1
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
virtual LocalPoint localPosition(float strip) const =0
Definition: Run.h:45
#define LogDebug(id)