CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  nBXMin_ = cfg.getParameter<int>("bxMin");
12  nBXMax_ = cfg.getParameter<int>("bxMax");
13 }
14 
17  desc.add<edm::InputTag>("digisInputLabel", edm::InputTag("muonGEMDigis", ""));
18  desc.addUntracked<std::string>("logCategory", "GEMDigiSource");
19  desc.add<bool>("modeRelVal", false);
20  desc.add<int>("bxMin", -10);
21  desc.add<int>("bxMax", 10);
22  descriptions.add("GEMDigiSource", desc);
23 }
24 
26  initGeometry(iSetup);
27  if (GEMGeometry_ == nullptr)
28  return;
29  loadChambers();
30 
31  fRadiusMin_ = 120.0;
32  fRadiusMax_ = 250.0;
33  float radS = -5.0 / 180 * M_PI;
34  float radL = 355.0 / 180 * M_PI;
35 
36  mapTotalDigi_layer_ = MEMap3Inf(this, "det", "Digi Occupancy", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5, "Chamber", "VFAT");
38  this, "rphi_occ", "Digi R-Phi Occupancy", 360, radS, radL, 8, fRadiusMin_, fRadiusMax_, "#phi (rad)", "R [cm]");
39  mapDigiOcc_ieta_ = MEMap3Inf(this, "occ_ieta", "Digi iEta Occupancy", 8, 0.5, 8.5, "iEta", "Number of fired digis");
41  MEMap3Inf(this, "occ_phi", "Digi Phi Occupancy", 108, -5, 355, "#phi (degree)", "Number of fired digis");
43  "digis_per_layer",
44  "Total number of digis per event for each layers",
45  50,
46  -0.5,
47  99.5,
48  "Number of fired digis",
49  "Events");
52  "digis_per_ieta",
53  "Total number of digis per event for each eta partitions",
54  50,
55  -0.5,
56  99.5,
57  "Number of fired digis",
58  "Events");
60 
61  mapBX_ = MEMap2Inf(this, "bx", "Digi Bunch Crossing", 21, nBXMin_ - 0.5, nBXMax_ + 0.5, "Bunch crossing");
62 
63  mapDigiOccPerCh_ = MEMap4Inf(this, "occ", "Digi Occupancy", 1, -0.5, 1.5, 1, 0.5, 1.5, "Digi", "iEta");
64 
65  if (bModeRelVal_) {
69  }
70 
71  ibooker.cd();
72  ibooker.setCurrentFolder("GEM/Digis");
73  GenerateMEPerChamber(ibooker);
74 
75  h2SummaryOcc_ = nullptr;
76  if (!bModeRelVal_) {
77  h2SummaryOcc_ = CreateSummaryHist(ibooker, "summaryOccDigi");
78  h2SummaryOcc_->setTitle("Summary of occupancy on chambers");
79  h2SummaryOcc_->setXTitle("Chamber");
80  }
81 }
82 
84  mapBX_.bookND(bh, key);
85 
86  return 0;
87 }
88 
91 
92  return 0;
93 }
94 
96  MEStationInfo& stationInfo = mapStationInfo_[key];
97 
98  int nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
99 
101  mapTotalDigi_layer_.SetBinConfY(stationInfo.nMaxVFAT_, -0.5);
102  mapTotalDigi_layer_.bookND(bh, key);
105 
108  mapDigiWheel_layer_.SetNbinsX(nNumVFATPerEta * stationInfo.nNumChambers_);
110  mapDigiWheel_layer_.bookND(bh, key);
111 
113  mapDigiOcc_ieta_.bookND(bh, key);
115 
116  mapDigiOcc_phi_.SetBinLowEdgeX(stationInfo.fMinPhi_ * 180 / M_PI);
117  mapDigiOcc_phi_.SetBinHighEdgeX(stationInfo.fMinPhi_ * 180 / M_PI + 360);
118  mapDigiOcc_phi_.bookND(bh, key);
120 
121  return 0;
122 }
123 
125  ME3IdsKey key3 = key4Tokey3(key);
126  MEStationInfo& stationInfo = mapStationInfo_[key3];
127 
128  int nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
129  int nNumCh = stationInfo.nNumDigi_;
130 
131  mapDigiOccPerCh_.SetBinConfX(nNumCh * nNumVFATPerEta, -0.5);
133  mapDigiOccPerCh_.bookND(bh, key);
135 
136  return 0;
137 }
138 
139 void GEMDigiSource::analyze(edm::Event const& event, edm::EventSetup const& eventSetup) {
141  event.getByToken(this->tagDigi_, gemDigis);
143  event.getByToken(lumiScalers_, lumiScalers);
144 
145  std::map<ME3IdsKey, Int_t> total_digi_layer;
146  std::map<ME3IdsKey, Int_t> total_digi_eta;
147  for (const auto& ch : gemChambers_) {
148  GEMDetId gid = ch.id();
149  ME2IdsKey key2{gid.region(), gid.station()};
150  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
151  ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
152  std::map<Int_t, bool> bTagVFAT;
153  bTagVFAT.clear();
154  MEStationInfo& stationInfo = mapStationInfo_[key3];
155  const BoundPlane& surface = GEMGeometry_->idToDet(gid)->surface();
156  if (total_digi_layer.find(key3) == total_digi_layer.end())
157  total_digi_layer[key3] = 0;
158  for (auto iEta : ch.etaPartitions()) {
159  GEMDetId eId = iEta->id();
160  ME3IdsKey key3IEta{gid.region(), gid.station(), eId.ieta()};
161  if (total_digi_eta.find(key3IEta) == total_digi_eta.end())
162  total_digi_eta[key3IEta] = 0;
163  const auto& digis_in_det = gemDigis->get(eId);
164  for (auto d = digis_in_det.first; d != digis_in_det.second; ++d) {
165  // Filling of digi occupancy
166  Int_t nIdxVFAT = getVFATNumberByDigi(gid.station(), eId.ieta(), d->strip());
167  mapTotalDigi_layer_.Fill(key3, gid.chamber(), nIdxVFAT);
168 
169  // Filling of digi
170  mapDigiOcc_ieta_.Fill(key3, eId.ieta()); // Eta (partition)
171 
172  GlobalPoint digi_global_pos = surface.toGlobal(iEta->centreOfStrip(d->strip()));
173  Float_t fPhi = (Float_t)digi_global_pos.phi();
174  Float_t fPhiShift = restrictAngle(fPhi, stationInfo.fMinPhi_);
175  Float_t fPhiDeg = fPhiShift * 180.0 / M_PI;
176  mapDigiOcc_phi_.Fill(key3, fPhiDeg); // Phi
177 
178  // Filling of R-Phi occupancy
179  Float_t fR = fRadiusMin_ + (fRadiusMax_ - fRadiusMin_) * (eId.ieta() - 0.5) / stationInfo.nNumEtaPartitions_;
180  mapDigiWheel_layer_.Fill(key3, fPhiShift, fR);
181 
182  mapDigiOccPerCh_.Fill(key4Ch, d->strip(), eId.ieta()); // Per chamber
183 
184  // For total digis
185  total_digi_layer[key3]++;
186  total_digi_eta[key3IEta]++;
187 
188  // Filling of bx
189  Int_t nBX = std::min(std::max((Int_t)d->bx(), nBXMin_), nBXMax_); // For under/overflow
190  if (bTagVFAT.find(nIdxVFAT) == bTagVFAT.end()) {
191  mapBX_.Fill(key2, nBX);
192  }
193 
194  // Occupancy on a chamber
195  if (h2SummaryOcc_)
197 
198  bTagVFAT[nIdxVFAT] = true;
199  }
200  }
201  }
202  for (auto [key, num_total_digi] : total_digi_layer)
203  mapTotalDigiPerEvtLayer_.Fill(key, num_total_digi);
204  for (auto [key, num_total_digi] : total_digi_eta)
205  mapTotalDigiPerEvtIEta_.Fill(key, num_total_digi);
206 }
207 
int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getUntrackedParameter(std::string const &, T const &) const
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:457
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
Definition: GEMDQMBase.cc:125
tuple cfg
Definition: looper.py:296
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
MEMap3Inf mapTotalDigiPerEvtLayer_
Definition: GEMDigiSource.h:55
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
int getVFATNumberByDigi(const int, const int, const int)
Definition: GEMDQMBase.h:601
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:456
int ProcessWithMEMap2(BookingHelper &bh, ME2IdsKey key) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:334
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:15
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:25
Float_t fRadiusMax_
Definition: GEMDigiSource.h:65
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
MEMap3Inf mapDigiOcc_ieta_
Definition: GEMDigiSource.h:53
MEMap4Inf mapDigiOccPerCh_
Definition: GEMDigiSource.h:59
MEMap3Inf mapDigiOcc_phi_
Definition: GEMDigiSource.h:54
int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:356
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:564
int loadChambers()
Definition: GEMDQMBase.cc:46
edm::EDGetTokenT< LumiScalersCollection > lumiScalers_
Definition: GEMDigiSource.h:49
void SetBinHighEdgeX(Double_t dXH)
Definition: GEMDQMBase.h:264
std::map< ME3IdsKey, int > mapStationToIdx_
Definition: GEMDQMBase.h:563
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:377
edm::EDGetToken tagDigi_
Definition: GEMDigiSource.h:47
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MEMap3Inf mapTotalDigiPerEvtIEta_
Definition: GEMDigiSource.h:56
constexpr int ieta() const
Definition: GEMDetId.h:199
MEMap3Inf mapTotalDigi_layer_
Definition: GEMDigiSource.h:51
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEMap2Inf mapBX_
Definition: GEMDigiSource.h:57
void Fill(long long x)
tuple d
Definition: ztail.py:151
virtual void setXTitle(std::string const &title)
void SetBinLowEdgeX(Double_t dXL)
Definition: GEMDQMBase.h:262
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:161
constexpr int region() const
Definition: GEMDetId.h:171
Float_t restrictAngle(const Float_t fTheta, const Float_t fStart)
Definition: GEMDQMBase.h:618
std::vector< GEMChamber > gemChambers_
Definition: GEMDQMBase.h:553
tuple key
prepare the HTCondor submission files and eventually submit them
Bool_t bModeRelVal_
Definition: GEMDigiSource.h:67
MEMapInfT< MEMap2Ids, ME2IdsKey > MEMap2Inf
Definition: GEMDQMBase.h:455
void SetNbinsY(Int_t nBinsY)
Definition: GEMDQMBase.h:268
T min(T a, T b)
Definition: MathUtil.h:58
ParameterDescriptionBase * add(U const &iLabel, T const &value)
GEMDigiSource(const edm::ParameterSet &cfg)
Definition: GEMDigiSource.cc:6
#define M_PI
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:550
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void SetNoUnderOverflowBin()
Definition: GEMDQMBase.h:245
constexpr int chamber() const
Definition: GEMDetId.h:183
constexpr int layer() const
Definition: GEMDetId.h:190
int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:354
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
constexpr int station() const
Definition: GEMDetId.h:179
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:305
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:529
void SetNbinsX(Int_t nBinsX)
Definition: GEMDQMBase.h:260
std::tuple< Int_t, Int_t > ME2IdsKey
Float_t fRadiusMin_
Definition: GEMDigiSource.h:64
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:279
MonitorElement * h2SummaryOcc_
Definition: GEMDigiSource.h:61
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:287
Definition: Run.h:45
MEMap3Inf mapDigiWheel_layer_
Definition: GEMDigiSource.h:52
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override