CMS 3D CMS Logo

GEMDQMSourceDigi.cc
Go to the documentation of this file.
9 
14 
16 
19 
20 #include <string>
21 
22 //----------------------------------------------------------------------------------------------------
23 
25 public:
27  ~GEMDQMSourceDigi() override{};
28  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
29 
30 protected:
31  void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override{};
32  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
33  void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
34 
35 private:
37 
38  const GEMGeometry* initGeometry(edm::EventSetup const& iSetup);
39  int findVFAT(float min_, float max_, float x_, int roll_);
40 
42 
43  std::vector<GEMChamber> gemChambers_;
44 
45  std::unordered_map<UInt_t, MonitorElement*> Digi_2D_;
46  std::unordered_map<UInt_t, MonitorElement*> Digi_1D_;
47  std::unordered_map<UInt_t, MonitorElement*> BxVsVFAT;
48 };
49 
50 using namespace std;
51 using namespace edm;
52 
53 int GEMDQMSourceDigi::findVFAT(float min_, float max_, float x_, int roll_) {
54  float step = max_ / 3;
55  if (x_ < (min_ + step)) {
56  return 8 - roll_;
57  } else if (x_ < (min_ + 2 * step)) {
58  return 16 - roll_;
59  } else {
60  return 24 - roll_;
61  }
62 }
63 
65  const GEMGeometry* GEMGeometry_ = nullptr;
66  try {
68  iSetup.get<MuonGeometryRecord>().get(hGeom);
69  GEMGeometry_ = &*hGeom;
71  edm::LogError("MuonGEMBaseValidation") << "+++ Error : GEM geometry is unavailable on event loop. +++\n";
72  return nullptr;
73  }
74 
75  return GEMGeometry_;
76 }
77 
79  tagDigi_ = consumes<GEMDigiCollection>(cfg.getParameter<edm::InputTag>("digisInputLabel"));
80 }
81 
84  desc.add<edm::InputTag>("digisInputLabel", edm::InputTag("muonGEMDigis", ""));
85  descriptions.add("GEMDQMSourceDigi", desc);
86 }
87 
89  GEMGeometry_ = initGeometry(iSetup);
90  if (GEMGeometry_ == nullptr)
91  return;
92 
93  const std::vector<const GEMSuperChamber*>& superChambers_ = GEMGeometry_->superChambers();
94  for (auto sch : superChambers_) {
95  int n_lay = sch->nChambers();
96  for (int l = 0; l < n_lay; l++) {
97  Bool_t bExist = false;
98  for (const auto& ch : gemChambers_)
99  if (ch.id() == sch->chamber(l + 1)->id())
100  bExist = true;
101  if (bExist)
102  continue;
103 
104  gemChambers_.push_back(*sch->chamber(l + 1));
105  }
106  }
107  ibooker.cd();
108  ibooker.setCurrentFolder("GEM/digi");
109  for (const auto& ch : gemChambers_) {
110  GEMDetId gid = ch.id();
111 
112  std::string strIdxName = "Gemini_" + to_string(gid.chamber()) + "_GE" + (gid.region() > 0 ? "p" : "m") +
113  to_string(gid.station()) + "_" + to_string(gid.layer());
114  std::string strIdxTitle = "GEMINIm" + to_string(gid.chamber()) + " in GE" + (gid.region() > 0 ? "+" : "-") +
115  to_string(gid.station()) + "/" + to_string(gid.layer());
116 
117  string hName_digi = "Digi_Strips_" + strIdxName;
118  string hTitle_digi = "Digi Strip " + strIdxTitle;
119  string hAxis_digi = ";Strip;iEta";
120  Digi_2D_[ch.id()] = ibooker.book2D(hName_digi, hTitle_digi + hAxis_digi, 384, 1, 385, 8, 0.5, 8.5);
121  Digi_1D_[ch.id()] = ibooker.book1D(hName_digi + "_VFAT", hTitle_digi + " VFAT" + hAxis_digi, 24, 0, 24);
122 
123  string hNameBx = "bx_vs_VFAT_" + strIdxName;
124  string hTitleBx = "bx vs VFAT " + strIdxTitle;
125  hTitleBx += ";Bunch crossing;VFAT";
126  BxVsVFAT[ch.id()] = ibooker.book2D(hNameBx, hTitleBx, 10, -5, 5, 24, 0, 24);
127  }
128 }
129 
131  const GEMGeometry* GEMGeometry_ = initGeometry(eventSetup);
132  if (GEMGeometry_ == nullptr)
133  return;
134 
136  event.getByToken(this->tagDigi_, gemDigis);
137  for (const auto& ch : gemChambers_) {
138  GEMDetId cId = ch.id();
139  for (auto roll : ch.etaPartitions()) {
140  GEMDetId rId = roll->id();
141  const auto& digis_in_det = gemDigis->get(rId);
142  for (auto d = digis_in_det.first; d != digis_in_det.second; ++d) {
143  auto nVFAT = findVFAT(1, roll->nstrips(), d->strip(), rId.roll());
144  Digi_2D_[cId]->Fill(d->strip(), rId.roll());
145  Digi_1D_[cId]->Fill(nVFAT);
146  BxVsVFAT[cId]->Fill(d->bx(), nVFAT);
147  }
148  }
149  }
150 }
151 
GEMDQMSourceDigi::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMDQMSourceDigi.cc:88
MessageLogger.h
GEMDQMSourceDigi::GEMGeometry_
const GEMGeometry * GEMGeometry_
Definition: GEMDQMSourceDigi.cc:41
ESHandle.h
step
step
Definition: StallMonitor.cc:94
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:187
edm::Run
Definition: Run.h:45
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:168
edm
HLT enums.
Definition: AlignableModifier.h:19
GEMDQMSourceDigi::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: GEMDQMSourceDigi.cc:31
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
GEMDQMSourceDigi::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: GEMDQMSourceDigi.cc:130
edm::Handle< GEMDigiCollection >
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
GEMDQMSourceDigi::tagDigi_
edm::EDGetToken tagDigi_
Definition: GEMDQMSourceDigi.cc:36
GEMDQMSourceDigi::Digi_1D_
std::unordered_map< UInt_t, MonitorElement * > Digi_1D_
Definition: GEMDQMSourceDigi.cc:46
GEMDQMSourceDigi::~GEMDQMSourceDigi
~GEMDQMSourceDigi() override
Definition: GEMDQMSourceDigi.cc:27
GEMDQMSourceDigi::BxVsVFAT
std::unordered_map< UInt_t, MonitorElement * > BxVsVFAT
Definition: GEMDQMSourceDigi.cc:47
edm::ESHandle< GEMGeometry >
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
GEMDQMSourceDigi::GEMDQMSourceDigi
GEMDQMSourceDigi(const edm::ParameterSet &cfg)
Definition: GEMDQMSourceDigi.cc:78
DQMEDAnalyzer.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:180
GEMDQMSourceDigi::Digi_2D_
std::unordered_map< UInt_t, MonitorElement * > Digi_2D_
Definition: GEMDQMSourceDigi.cc:45
MonitorElement.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:191
GEMDetId
Definition: GEMDetId.h:18
ModuleDef.h
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EDGetToken
Definition: EDGetToken.h:35
get
#define get
InputTag.h
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
looper.cfg
cfg
Definition: looper.py:297
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
GEMGeometry.h
std
Definition: JetResolutionObject.h:76
dqm::implementation::IBooker::book2D
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:177
GEMDQMSourceDigi::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMDQMSourceDigi.cc:82
EventSetup.h
GEMDQMSourceDigi::initGeometry
const GEMGeometry * initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMSourceDigi.cc:64
GEMDigiCollection.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
GEMDQMSourceDigi
Definition: GEMDQMSourceDigi.cc:24
edm::eventsetup::NoProxyException
Definition: NoProxyException.h:31
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:176
GEMGeometry
Definition: GEMGeometry.h:24
ztail.d
d
Definition: ztail.py:151
ParameterSet.h
MuonGeometryRecord.h
GEMDQMSourceDigi::gemChambers_
std::vector< GEMChamber > gemChambers_
Definition: GEMDQMSourceDigi.cc:43
GEMDQMSourceDigi::findVFAT
int findVFAT(float min_, float max_, float x_, int roll_)
Definition: GEMDQMSourceDigi.cc:53
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37