CMS 3D CMS Logo

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