CMS 3D CMS Logo

GEMOfflineMonitor.cc
Go to the documentation of this file.
6 
9  digi_token_ = consumes<GEMDigiCollection>(pset.getParameter<edm::InputTag>("digiTag"));
10  rechit_token_ = consumes<GEMRecHitCollection>(pset.getParameter<edm::InputTag>("recHitTag"));
11  do_digi_occupancy_ = pset.getUntrackedParameter<bool>("doDigiOccupancy");
12  do_hit_occupancy_ = pset.getUntrackedParameter<bool>("doHitOccupancy");
13  log_category_ = pset.getUntrackedParameter<std::string>("logCategory");
14 }
15 
17 
20  desc.add<edm::InputTag>("digiTag", edm::InputTag("muonGEMDigis"));
21  desc.add<edm::InputTag>("recHitTag", edm::InputTag("gemRecHits"));
22  desc.addUntracked<std::string>("logCategory", "GEMOfflineMonitor");
23  desc.addUntracked<bool>("doDigiOccupancy", true);
24  desc.addUntracked<bool>("doHitOccupancy", true);
25  descriptions.add("gemOfflineMonitorDefault", desc);
26 }
27 
30  gem = setup.getHandle(gemToken_);
31 
32  if (not gem.isValid()) {
33  edm::LogError(log_category_) << "GEMGeometry is invalid" << std::endl;
34  return;
35  }
36 
38  bookDigiOccupancy(ibooker, gem);
39 
41  bookHitOccupancy(ibooker, gem);
42 }
43 
45  ibooker.setCurrentFolder("GEM/GEMOfflineMonitor/DigiOccupancy");
46 
47  for (const GEMStation* station : gem->stations()) {
48  const int region_id = station->region();
49  const int station_id = station->station();
50  const GEMDetId&& key = getReStKey(region_id, station_id);
51  const auto&& name_suffix = GEMUtils::getSuffixName(region_id, station_id);
52  const auto&& title_suffix = GEMUtils::getSuffixTitle(region_id, station_id);
53 
54  const auto&& superchambers = station->superChambers();
55  if (not checkRefs(superchambers)) {
56  edm::LogError(log_category_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
57  return;
58  }
59 
60  // per station
61  const int num_superchambers = superchambers.size();
62  const int num_chambers = num_superchambers * superchambers.front()->nChambers();
63  // the numer of VFATs per GEMEtaPartition
64  const int max_vfat = getMaxVFAT(station->station());
65  // the number of eta partitions per GEMChamber
66  const int num_etas = getNumEtaPartitions(station);
67  // the number of VFATs per GEMChamber
68  const int num_vfat = num_etas * max_vfat;
69 
70  me_digi_det_[key] = ibooker.book2D("digi_det" + name_suffix,
71  "Digi Occupancy" + title_suffix,
72  num_chambers,
73  0.5,
74  num_chambers + 0.5,
75  num_vfat,
76  0.5,
77  num_vfat + 0.5);
79  } // station
80 }
81 
83  ibooker.setCurrentFolder("GEM/GEMOfflineMonitor/HitOccupancy");
84 
85  for (const GEMStation* station : gem->stations()) {
86  const int region_id = station->region();
87  const int station_id = station->station();
88 
89  const GEMDetId&& key = getReStKey(region_id, station_id);
90  const auto&& name_suffix = GEMUtils::getSuffixName(region_id, station_id);
91  const auto&& title_suffix = GEMUtils::getSuffixTitle(region_id, station_id);
92 
93  const auto&& superchambers = station->superChambers();
94  if (not checkRefs(superchambers)) {
95  edm::LogError(log_category_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
96  return;
97  }
98 
99  // per station
100  const int num_superchambers = superchambers.size();
101  const int num_chambers = num_superchambers * superchambers.front()->nChambers();
102  // the number of eta partitions per GEMChamber
103  const int num_etas = getNumEtaPartitions(station);
104 
105  me_hit_det_[key] = ibooker.book2D("hit_det" + name_suffix,
106  "Hit Occupancy" + title_suffix,
107  num_chambers,
108  0.5,
109  num_chambers + 0.5,
110  num_etas,
111  0.5,
112  num_etas + 0.5);
114  } // station
115 }
116 
118  edm::Handle<GEMDigiCollection> digi_collection;
119  if (do_digi_occupancy_) {
120  event.getByToken(digi_token_, digi_collection);
121  if (not digi_collection.isValid()) {
122  edm::LogError(log_category_) << "GEMDigiCollection is invalid!" << std::endl;
123  return;
124  }
125  }
126 
127  edm::Handle<GEMRecHitCollection> rechit_collection;
128  if (do_hit_occupancy_) {
129  event.getByToken(rechit_token_, rechit_collection);
130  if (not rechit_collection.isValid()) {
131  edm::LogError(log_category_) << "GEMRecHitCollection is invalid" << std::endl;
132  return;
133  }
134  }
135 
137  gem = setup.getHandle(gemToken_);
138 
139  if (not gem.isValid()) {
140  edm::LogError(log_category_) << "GEMGeometry is invalid" << std::endl;
141  return;
142  }
143 
144  if (do_digi_occupancy_)
145  doDigiOccupancy(gem, digi_collection);
146 
147  if (do_hit_occupancy_)
148  doHitOccupancy(gem, rechit_collection);
149 }
150 
152  const edm::Handle<GEMDigiCollection>& digi_collection) {
153  for (auto range_iter = digi_collection->begin(); range_iter != digi_collection->end(); range_iter++) {
154  const GEMDetId& gem_id = (*range_iter).first;
155  const GEMDigiCollection::Range& range = (*range_iter).second;
156 
157  const GEMDetId&& rs_key = getReStKey(gem_id);
158  for (auto digi = range.first; digi != range.second; ++digi) {
159  const int chamber_bin = getDetOccXBin(gem_id, gem);
160  const int vfat_number = getVFATNumberByStrip(gem_id.station(), gem_id.roll(), digi->strip());
161 
162  fillME(me_digi_det_, rs_key, chamber_bin, vfat_number);
163  } // digi
164  } // range
165 }
166 
168  const edm::Handle<GEMRecHitCollection>& rechit_collection) {
169  for (auto hit = rechit_collection->begin(); hit != rechit_collection->end(); hit++) {
170  const GEMDetId&& gem_id = hit->gemId();
171  const GEMDetId&& rs_key = getReStKey(gem_id);
172  const int chamber_bin = getDetOccXBin(gem_id, gem);
173  fillME(me_hit_det_, rs_key, chamber_bin, gem_id.roll());
174  }
175 }
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
GEMOfflineMonitor::me_digi_det_
MEMap me_digi_det_
Definition: GEMOfflineMonitor.h:38
GEMOfflineMonitor::do_hit_occupancy_
bool do_hit_occupancy_
Definition: GEMOfflineMonitor.h:36
edm::Run
Definition: Run.h:45
relativeConstraints.station
station
Definition: relativeConstraints.py:67
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
GEMOfflineDQMBase
Definition: GEMOfflineDQMBase.h:11
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMOfflineMonitor::do_digi_occupancy_
bool do_digi_occupancy_
Definition: GEMOfflineMonitor.h:35
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
GEMOfflineMonitor::doDigiOccupancy
void doDigiOccupancy(const edm::ESHandle< GEMGeometry > &, const edm::Handle< GEMDigiCollection > &)
Definition: GEMOfflineMonitor.cc:151
GEMOfflineDQMBase::getVFATNumberByStrip
int getVFATNumberByStrip(const int, const int, const int)
Definition: GEMOfflineDQMBase.h:60
StripTopology.h
edm::Handle< GEMDigiCollection >
GEMOfflineDQMBase::getMaxVFAT
int getMaxVFAT(const int)
Definition: GEMOfflineDQMBase.h:44
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
GEMUtils::getSuffixName
TString getSuffixName(Int_t region_id)
Definition: GEMValidationUtils.cc:5
GEMValidationUtils.h
GEMOfflineDQMBase::log_category_
std::string log_category_
Definition: GEMOfflineDQMBase.h:41
GEMOfflineDQMBase::setDetLabelsEta
void setDetLabelsEta(MonitorElement *, const GEMStation *)
Definition: GEMOfflineDQMBase.cc:49
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
GEMOfflineDQMBase::getNumEtaPartitions
int getNumEtaPartitions(const GEMStation *)
Definition: GEMOfflineDQMBase.cc:70
GEMOfflineMonitor::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMOfflineMonitor.cc:28
GEMStation
Definition: GEMStation.h:19
GEMOfflineMonitor::GEMOfflineMonitor
GEMOfflineMonitor(const edm::ParameterSet &)
Definition: GEMOfflineMonitor.cc:7
edm::ESHandle< GEMGeometry >
ParameterSetDescription.h
GEMOfflineMonitor::gemToken_
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken_
Definition: GEMOfflineMonitor.h:33
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
GEMOfflineDQMBase::checkRefs
bool checkRefs(const std::vector< T * > &)
Definition: GEMOfflineDQMBase.h:70
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:194
GEMDetId
Definition: GEMDetId.h:18
GEMOfflineDQMBase::setDetLabelsVFAT
void setDetLabelsVFAT(MonitorElement *, const GEMStation *)
Definition: GEMOfflineDQMBase.cc:14
GEMOfflineMonitor.h
GEMOfflineMonitor::rechit_token_
edm::EDGetTokenT< GEMRecHitCollection > rechit_token_
Definition: GEMOfflineMonitor.h:31
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
gem
Definition: AMC13Event.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMOfflineMonitor::digi_token_
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Definition: GEMOfflineMonitor.h:30
GEMOfflineMonitor::bookHitOccupancy
void bookHitOccupancy(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
Definition: GEMOfflineMonitor.cc:82
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
writedatasetfile.run
run
Definition: writedatasetfile.py:27
GEMOfflineDQMBase::getReStKey
GEMDetId getReStKey(const int, const int)
Definition: GEMOfflineDQMBase.h:78
GEMOfflineDQMBase::fillME
void fillME(MEMap &me_map, const GEMDetId &key, const float x)
Definition: GEMOfflineDQMBase.cc:86
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
GEMUtils::getSuffixTitle
TString getSuffixTitle(Int_t region_id)
Definition: GEMValidationUtils.cc:34
GEMOfflineMonitor::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: GEMOfflineMonitor.cc:18
chamber_bin
int chamber_bin(int station, int ring, int chamber)
Definition: L1TStage2EMTF.cc:468
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
GEMOfflineMonitor::bookDigiOccupancy
void bookDigiOccupancy(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
Definition: GEMOfflineMonitor.cc:44
dqm::implementation::IBooker
Definition: DQMStore.h:43
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
GEMGeometry
Definition: GEMGeometry.h:24
mixOne_premix_on_sim_cfi.gem
gem
Definition: mixOne_premix_on_sim_cfi.py:194
MuonGeometryRecord.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
GEMOfflineMonitor::analyze
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
Definition: GEMOfflineMonitor.cc:117
edm::Event
Definition: Event.h:73
crabWrapper.key
key
Definition: crabWrapper.py:19
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
GEMOfflineMonitor::~GEMOfflineMonitor
~GEMOfflineMonitor() override
Definition: GEMOfflineMonitor.cc:16
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
GEMOfflineMonitor::me_hit_det_
MEMap me_hit_det_
Definition: GEMOfflineMonitor.h:39
GEMOfflineMonitor::doHitOccupancy
void doHitOccupancy(const edm::ESHandle< GEMGeometry > &, const edm::Handle< GEMRecHitCollection > &)
Definition: GEMOfflineMonitor.cc:167
GEMOfflineDQMBase::getDetOccXBin
int getDetOccXBin(const int, const int, const int)
Definition: GEMOfflineDQMBase.h:65