CMS 3D CMS Logo

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