CMS 3D CMS Logo

GEMDigiSource.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace edm;
5 
7  tagDigi_ = consumes<GEMDigiCollection>(cfg.getParameter<edm::InputTag>("digisInputLabel"));
8  lumiScalers_ = consumes<LumiScalersCollection>(
9  cfg.getUntrackedParameter<edm::InputTag>("lumiCollection", edm::InputTag("scalersRawToDigi")));
10  bModeRelVal_ = cfg.getParameter<bool>("modeRelVal");
11 }
12 
15  desc.add<edm::InputTag>("digisInputLabel", edm::InputTag("muonGEMDigis", ""));
16  desc.addUntracked<std::string>("logCategory", "GEMDigiSource");
17  desc.add<bool>("modeRelVal", false);
18  descriptions.add("GEMDigiSource", desc);
19 }
20 
22  initGeometry(iSetup);
23  if (GEMGeometry_ == nullptr)
24  return;
25  loadChambers();
26 
27  nBXMin_ = -10;
28  nBXMax_ = 10;
29 
30  mapTotalDigi_layer_ = MEMap3Inf(this, "det", "Digi Occupancy", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5, "Chamber", "VFAT");
31  mapDigiOcc_ieta_ = MEMap3Inf(this, "occ_ieta", "Digi iEta Occupancy", 8, 0.5, 8.5, "iEta", "Number of fired digis");
33  MEMap3Inf(this, "occ_phi", "Digi Phi Occupancy", 108, -5, 355, "#phi (degree)", "Number of fired digis");
35  "digis_per_layer",
36  "Total number of digis per event for each layers",
37  50,
38  -0.5,
39  99.5,
40  "Number of fired digis",
41  "Events");
43  "digis_per_ieta",
44  "Total number of digis per event for each eta partitions",
45  50,
46  -0.5,
47  99.5,
48  "Number of fired digis",
49  "Events");
50 
51  mapBX_iEta_ = MEMap3Inf(this, "bx", "Digi Bunch Crossing", 21, nBXMin_ - 0.5, nBXMax_ + 0.5, "Bunch crossing");
52 
53  mapDigiOccPerCh_ = MEMap4Inf(this, "occ", "Digi Occupancy", 1, -0.5, 1.5, 1, 0.5, 1.5, "Digi", "iEta");
54 
55  if (bModeRelVal_) {
58  }
59 
60  ibooker.cd();
61  ibooker.setCurrentFolder("GEM/Digis");
62  GenerateMEPerChamber(ibooker);
63 
64  h2SummaryOcc_ = nullptr;
65  if (!bModeRelVal_) {
66  h2SummaryOcc_ = CreateSummaryHist(ibooker, "summaryOccDigi");
67  h2SummaryOcc_->setTitle("Summary of occupancy on chambers");
68  h2SummaryOcc_->setXTitle("Chamber");
69  }
70 }
71 
73  mapBX_iEta_.bookND(bh, key);
75 
76  return 0;
77 }
78 
80  MEStationInfo& stationInfo = mapStationInfo_[key];
81 
83  mapTotalDigi_layer_.SetBinConfY(stationInfo.nMaxVFAT_, -0.5);
87 
91 
94 
95  return 0;
96 }
97 
99  ME3IdsKey key3 = key4Tokey3(key);
100  MEStationInfo& stationInfo = mapStationInfo_[key3];
101 
102  int nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
103  int nNumCh = stationInfo.nNumDigi_;
104 
105  mapDigiOccPerCh_.SetBinConfX(nNumCh * nNumVFATPerEta, -0.5);
109 
110  return 0;
111 }
112 
113 void GEMDigiSource::analyze(edm::Event const& event, edm::EventSetup const& eventSetup) {
115  event.getByToken(this->tagDigi_, gemDigis);
117  event.getByToken(lumiScalers_, lumiScalers);
118 
119  std::map<ME3IdsKey, Int_t> total_digi_layer;
120  std::map<ME3IdsKey, Int_t> total_digi_eta;
121  for (const auto& ch : gemChambers_) {
122  GEMDetId gid = ch.id();
123  ME2IdsKey key2{gid.region(), gid.station()};
124  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
125  ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
126  std::map<Int_t, bool> bTagVFAT;
127  bTagVFAT.clear();
128  const BoundPlane& surface = GEMGeometry_->idToDet(gid)->surface();
129  if (total_digi_layer.find(key3) == total_digi_layer.end())
130  total_digi_layer[key3] = 0;
131  for (auto iEta : ch.etaPartitions()) {
132  GEMDetId eId = iEta->id();
133  ME3IdsKey key3IEta{gid.region(), gid.station(), eId.ieta()};
134  if (total_digi_eta.find(key3IEta) == total_digi_eta.end())
135  total_digi_eta[key3IEta] = 0;
136  const auto& digis_in_det = gemDigis->get(eId);
137  for (auto d = digis_in_det.first; d != digis_in_det.second; ++d) {
138  // Filling of digi occupancy
139  Int_t nIdxVFAT = getVFATNumberByDigi(gid.station(), eId.ieta(), d->strip());
140  mapTotalDigi_layer_.Fill(key3, gid.chamber(), nIdxVFAT);
141 
142  // Filling of digi
143  mapDigiOcc_ieta_.Fill(key3, eId.ieta()); // Eta (partition)
144 
145  GlobalPoint digi_global_pos = surface.toGlobal(iEta->centreOfStrip(d->strip()));
146  Float_t fPhiDeg = ((Float_t)digi_global_pos.phi()) * 180.0 / 3.141592;
147  if (fPhiDeg < -5.0)
148  fPhiDeg += 360.0;
149  mapDigiOcc_phi_.Fill(key3, fPhiDeg); // Phi
150 
151  mapDigiOccPerCh_.Fill(key4Ch, d->strip(), eId.ieta()); // Per chamber
152 
153  // For total digis
154  total_digi_layer[key3]++;
155  total_digi_eta[key3IEta]++;
156 
157  // Filling of bx
158  Int_t nBX = std::min(std::max((Int_t)d->bx(), nBXMin_), nBXMax_); // For under/overflow
159  if (bTagVFAT.find(nIdxVFAT) == bTagVFAT.end()) {
160  mapBX_iEta_.Fill(key3IEta, nBX);
161  }
162 
163  // Occupancy on a chamber
164  if (h2SummaryOcc_)
166 
167  bTagVFAT[nIdxVFAT] = true;
168  }
169  }
170  }
171  for (auto [key, num_total_digi] : total_digi_layer)
172  mapTotalDigiPerEvtLayer_.Fill(key, num_total_digi);
173  for (auto [key, num_total_digi] : total_digi_eta)
174  mapTotalDigiPerEvtIEta_.Fill(key, num_total_digi);
175 }
176 
GEMDQMBase::MEMapInfT::SetBinConfX
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:273
GEMDigiSource::mapTotalDigiPerEvtIEta_
MEMap3Inf mapTotalDigiPerEvtIEta_
Definition: GEMDigiSource.h:54
GEMDQMBase::gemChambers_
std::vector< GEMChamber > gemChambers_
Definition: GEMDQMBase.h:514
ME2IdsKey
std::tuple< Int_t, Int_t > ME2IdsKey
Definition: GEMValidationUtils.h:16
GEMDigiSource::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMDigiSource.cc:21
GEMDigiSource::mapTotalDigi_layer_
MEMap3Inf mapTotalDigi_layer_
Definition: GEMDigiSource.h:50
GEMDigiSource
Definition: GEMDigiSource.h:30
dqm::impl::MonitorElement::setTitle
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
Definition: MonitorElement.cc:809
GEMDigiSource::mapBX_iEta_
MEMap3Inf mapBX_iEta_
Definition: GEMDigiSource.h:55
GEMDigiSource::ProcessWithMEMap3
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMDigiSource.cc:79
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:190
GEMDQMBase::MEStationInfo
Definition: GEMDQMBase.h:422
edm::Run
Definition: Run.h:45
min
T min(T a, T b)
Definition: MathUtil.h:58
GEMGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:25
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:171
GEMDQMBase::GEMGeometry_
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:511
edm
HLT enums.
Definition: AlignableModifier.h:19
GEMDigiSource.h
V0Monitor_cfi.lumiScalers
lumiScalers
Definition: V0Monitor_cfi.py:9
ME4IdsKey
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
Definition: GEMValidationUtils.h:20
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMDigiSource::analyze
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
Definition: GEMDigiSource.cc:113
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
GEMDQMBase::MEMapInfT::Fill
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:361
edm::Handle< GEMDigiCollection >
GEMDQMBase::key4Tokey3
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:491
GEMDQMBase::MEMapInfT::SetLabelForVFATs
int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:340
GEMDigiSource::mapDigiOccPerCh_
MEMap4Inf mapDigiOccPerCh_
Definition: GEMDigiSource.h:57
GEMDigiSource::mapDigiOcc_ieta_
MEMap3Inf mapDigiOcc_ieta_
Definition: GEMDigiSource.h:51
GEMDQMBase::MEMapInfT::SetLabelForChambers
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:318
GEMDQMBase::BookingHelper
Definition: GEMDQMBase.h:32
GEMDigiSource::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMDigiSource.cc:13
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
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
GEMDigiSource::nBXMax_
Int_t nBXMax_
Definition: GEMDigiSource.h:61
GEMDQMBase::MEStationInfo::nNumEtaPartitions_
Int_t nNumEtaPartitions_
Definition: GEMDQMBase.h:450
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
GEMDigiSource::tagDigi_
edm::EDGetToken tagDigi_
Definition: GEMDigiSource.h:46
dqm::impl::MonitorElement::setXTitle
virtual void setXTitle(std::string const &title)
Definition: MonitorElement.cc:852
Point3DBase< float, GlobalTag >
GEMDigiSource::nBXMin_
Int_t nBXMin_
Definition: GEMDigiSource.h:61
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
GEMDQMBase::CreateSummaryHist
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
Definition: GEMDQMBase.cc:122
GEMDigiSource::ProcessWithMEMap2WithEta
int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key) override
Definition: GEMDigiSource.cc:72
GEMDQMBase::MEStationInfo::nMaxVFAT_
Int_t nMaxVFAT_
Definition: GEMDQMBase.h:451
GEMDQMBase::MEStationInfo::nNumDigi_
Int_t nNumDigi_
Definition: GEMDQMBase.h:452
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
GEMDQMBase::initGeometry
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:15
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDQMBase::MEMap4Inf
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:420
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
GEMDQMBase::getVFATNumberByDigi
int getVFATNumberByDigi(const int, const int, const int)
Definition: GEMDQMBase.h:562
GEMDQMBase::MEStationInfo::nNumChambers_
Int_t nNumChambers_
Definition: GEMDQMBase.h:449
GEMDetId
Definition: GEMDetId.h:18
GEMDigiSource::lumiScalers_
edm::EDGetTokenT< LumiScalersCollection > lumiScalers_
Definition: GEMDigiSource.h:48
GEMDigiSource::GEMDigiSource
GEMDigiSource(const edm::ParameterSet &cfg)
Definition: GEMDigiSource.cc:6
edm::EventSetup
Definition: EventSetup.h:58
GEMDigiSource::bModeRelVal_
Bool_t bModeRelVal_
Definition: GEMDigiSource.h:63
GEMDQMBase::MEMapInfT::SetLabelForIEta
int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:338
GEMDQMBase::MEMapInfT::TurnOff
void TurnOff()
Definition: GEMDQMBase.h:239
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
GEMDigiSource::mapDigiOcc_phi_
MEMap3Inf mapDigiOcc_phi_
Definition: GEMDigiSource.h:52
GEMDQMBase::loadChambers
int loadChambers()
Definition: GEMDQMBase.cc:46
GEMDigiSource::ProcessWithMEMap3WithChamber
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
Definition: GEMDigiSource.cc:98
GEMDQMBase::MEMap3Inf
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:419
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
GEMDQMBase::mapStationInfo_
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:525
GEMDigiSource::mapTotalDigiPerEvtLayer_
MEMap3Inf mapTotalDigiPerEvtLayer_
Definition: GEMDigiSource.h:53
GEMDQMBase::MEMapInfT::SetBinConfY
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:281
BoundPlane
ME3IdsKey
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
Definition: GEMValidationUtils.h:19
GEMDQMBase
Definition: GEMDQMBase.h:29
dqm::implementation::IBooker
Definition: DQMStore.h:43
GEMDQMBase::mapStationToIdx_
std::map< ME3IdsKey, int > mapStationToIdx_
Definition: GEMDQMBase.h:524
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
ztail.d
d
Definition: ztail.py:151
GEMDetId::ieta
constexpr int ieta() const
Definition: GEMDetId.h:199
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
crabWrapper.key
key
Definition: crabWrapper.py:19
GEMDQMBase::MEMapInfT::bookND
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:290
edm::InputTag
Definition: InputTag.h:15
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GEMDigiSource::h2SummaryOcc_
MonitorElement * h2SummaryOcc_
Definition: GEMDigiSource.h:59
GEMDQMBase::GenerateMEPerChamber
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:158