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  nBXMin_ = cfg.getParameter<int>("bxMin");
11  nBXMax_ = cfg.getParameter<int>("bxMax");
12 }
13 
16  desc.add<edm::InputTag>("digisInputLabel", edm::InputTag("muonGEMDigis", ""));
17  desc.addUntracked<std::string>("runType", "online");
18  desc.addUntracked<std::string>("logCategory", "GEMDigiSource");
19  desc.add<int>("bxMin", -10);
20  desc.add<int>("bxMax", 10);
21  descriptions.add("GEMDigiSource", desc);
22 }
23 
25  initGeometry(iSetup);
26  if (GEMGeometry_ == nullptr)
27  return;
28  loadChambers();
29 
30  strFolderMain_ = "GEM/Digis";
31 
32  fRadiusMin_ = 120.0;
33  fRadiusMax_ = 250.0;
34  float radS = -5.0 / 180 * M_PI;
35  float radL = 355.0 / 180 * M_PI;
36 
37  mapTotalDigi_layer_ = MEMap3Inf(this, "occ", "Digi Occupancy", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5, "Chamber", "VFAT");
39  this, "occ_rphi", "Digi R-Phi Occupancy", 360, radS, radL, 8, fRadiusMin_, fRadiusMax_, "#phi (rad)", "R [cm]");
40  mapDigiOcc_ieta_ = MEMap3Inf(this, "occ_ieta", "Digi iEta Occupancy", 8, 0.5, 8.5, "iEta", "Number of fired digis");
42  MEMap3Inf(this, "occ_phi", "Digi Phi Occupancy", 72, -5, 355, "#phi (degree)", "Number of fired digis");
44  "digis_per_layer",
45  "Total number of digis per event for each layers",
46  50,
47  -0.5,
48  99.5,
49  "Number of fired digis",
50  "Events");
53  "digis_per_ieta",
54  "Total number of digis per event for each eta partitions",
55  50,
56  -0.5,
57  99.5,
58  "Number of fired digis",
59  "Events");
61 
62  mapBX_ = MEMap2Inf(this, "bx", "Digi Bunch Crossing", 21, nBXMin_ - 0.5, nBXMax_ + 0.5, "Bunch crossing");
63 
64  mapDigiOccPerCh_ = MEMap4Inf(this, "occ", "Digi Occupancy", 1, -0.5, 1.5, 1, 0.5, 1.5, "Digi", "iEta");
65 
68  mapBX_.TurnOff();
69  }
70 
75  }
76 
80  }
81 
85  }
86 
87  ibooker.cd();
89  GenerateMEPerChamber(ibooker);
90 }
91 
93  mapBX_.bookND(bh, key);
94 
95  return 0;
96 }
97 
100 
101  return 0;
102 }
103 
105  MEStationInfo& stationInfo = mapStationInfo_[key];
106 
107  int nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
108 
110  mapTotalDigi_layer_.SetBinConfY(stationInfo.nMaxVFAT_, -0.5);
114 
117  mapDigiWheel_layer_.SetNbinsX(nNumVFATPerEta * stationInfo.nNumChambers_);
120 
124 
125  mapDigiOcc_phi_.SetBinLowEdgeX(stationInfo.fMinPhi_ * 180 / M_PI);
126  mapDigiOcc_phi_.SetBinHighEdgeX(stationInfo.fMinPhi_ * 180 / M_PI + 360);
129 
130  return 0;
131 }
132 
134  ME3IdsKey key3 = key4Tokey3(key);
135  MEStationInfo& stationInfo = mapStationInfo_[key3];
136 
137  bh.getBooker()->setCurrentFolder(strFolderMain_ + "/occupancy_" + getNameDirLayer(key3));
138 
139  int nNumVFATPerEta = stationInfo.nMaxVFAT_ / stationInfo.nNumEtaPartitions_;
140  int nNumCh = stationInfo.nNumDigi_;
141 
142  mapDigiOccPerCh_.SetBinConfX(nNumCh * nNumVFATPerEta, -0.5);
146 
148 
149  return 0;
150 }
151 
154  event.getByToken(this->tagDigi_, gemDigis);
156  event.getByToken(lumiScalers_, lumiScalers);
157 
158  std::map<ME3IdsKey, Int_t> total_digi_layer;
159  std::map<ME3IdsKey, Int_t> total_digi_eta;
160  for (auto gid : listChamberId_) {
161  ME2IdsKey key2{gid.region(), gid.station()};
162  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
163  ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
164  std::map<Int_t, bool> bTagVFAT;
165  bTagVFAT.clear();
166  MEStationInfo& stationInfo = mapStationInfo_[key3];
167  const BoundPlane& surface = GEMGeometry_->idToDet(gid)->surface();
168  if (total_digi_layer.find(key3) == total_digi_layer.end())
169  total_digi_layer[key3] = 0;
170  for (auto iEta : mapEtaPartition_[gid]) {
171  GEMDetId eId = iEta->id();
172  ME3IdsKey key3IEta{gid.region(), gid.station(), eId.ieta()};
173  if (total_digi_eta.find(key3IEta) == total_digi_eta.end())
174  total_digi_eta[key3IEta] = 0;
175  const auto& digis_in_det = gemDigis->get(eId);
176  for (auto d = digis_in_det.first; d != digis_in_det.second; ++d) {
177  // Filling of digi occupancy
178  Int_t nIdxVFAT = getVFATNumberByDigi(gid.station(), eId.ieta(), d->strip());
179  mapTotalDigi_layer_.Fill(key3, gid.chamber(), nIdxVFAT);
180 
181  // Filling of digi
182  mapDigiOcc_ieta_.Fill(key3, eId.ieta()); // Eta (partition)
183 
184  GlobalPoint digi_global_pos = surface.toGlobal(iEta->centreOfStrip(d->strip()));
185  Float_t fPhi = (Float_t)digi_global_pos.phi();
186  Float_t fPhiShift = restrictAngle(fPhi, stationInfo.fMinPhi_);
187  Float_t fPhiDeg = fPhiShift * 180.0 / M_PI;
188  mapDigiOcc_phi_.Fill(key3, fPhiDeg); // Phi
189 
190  // Filling of R-Phi occupancy
191  Float_t fR = fRadiusMin_ + (fRadiusMax_ - fRadiusMin_) * (eId.ieta() - 0.5) / stationInfo.nNumEtaPartitions_;
192  mapDigiWheel_layer_.Fill(key3, fPhiShift, fR);
193 
194  mapDigiOccPerCh_.Fill(key4Ch, d->strip(), eId.ieta()); // Per chamber
195 
196  // For total digis
197  total_digi_layer[key3]++;
198  total_digi_eta[key3IEta]++;
199 
200  // Filling of bx
201  Int_t nBX = std::min(std::max((Int_t)d->bx(), nBXMin_), nBXMax_); // For under/overflow
202  if (bTagVFAT.find(nIdxVFAT) == bTagVFAT.end()) {
203  mapBX_.Fill(key2, nBX);
204  }
205 
206  bTagVFAT[nIdxVFAT] = true;
207  }
208  }
209  }
210  for (auto [key, num_total_digi] : total_digi_layer)
211  mapTotalDigiPerEvtLayer_.Fill(key, num_total_digi);
212  for (auto [key, num_total_digi] : total_digi_eta)
213  mapTotalDigiPerEvtIEta_.Fill(key, num_total_digi);
214 }
215 
int ProcessWithMEMap2WithEta(BookingHelper &bh, ME3IdsKey key) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:460
Int_t nRunType_
Definition: GEMDQMBase.h:518
MEMap3Inf mapTotalDigiPerEvtLayer_
Definition: GEMDigiSource.h:57
std::vector< GEMDetId > listChamberId_
Definition: GEMDQMBase.h:578
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1, Int_t nIdxStart=1)
Definition: GEMDQMBase.h:337
int getVFATNumberByDigi(const int, const int, const int)
Definition: GEMDQMBase.h:625
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
Definition: GEMDQMBase.h:459
int ProcessWithMEMap2(BookingHelper &bh, ME2IdsKey key) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:27
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:67
MEMap3Inf mapDigiOcc_ieta_
Definition: GEMDigiSource.h:55
MEMap4Inf mapDigiOccPerCh_
Definition: GEMDigiSource.h:61
MEMap3Inf mapDigiOcc_phi_
Definition: GEMDigiSource.h:56
int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:359
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:590
int loadChambers()
Definition: GEMDQMBase.cc:56
edm::EDGetTokenT< LumiScalersCollection > lumiScalers_
Definition: GEMDigiSource.h:51
void SetBinHighEdgeX(Double_t dXH)
Definition: GEMDQMBase.h:266
std::string strFolderMain_
Definition: GEMDigiSource.h:63
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:380
edm::EDGetToken tagDigi_
Definition: GEMDigiSource.h:49
MEMap3Inf mapTotalDigiPerEvtIEta_
Definition: GEMDigiSource.h:58
MEMap3Inf mapTotalDigi_layer_
Definition: GEMDigiSource.h:53
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEMap2Inf mapBX_
Definition: GEMDigiSource.h:59
void SetBinLowEdgeX(Double_t dXL)
Definition: GEMDQMBase.h:264
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:171
Float_t restrictAngle(const Float_t fTheta, const Float_t fStart)
Definition: GEMDQMBase.h:656
MEMapInfT< MEMap2Ids, ME2IdsKey > MEMap2Inf
Definition: GEMDQMBase.h:458
void SetNbinsY(Int_t nBinsY)
Definition: GEMDQMBase.h:270
GEMDigiSource(const edm::ParameterSet &cfg)
Definition: GEMDigiSource.cc:6
d
Definition: ztail.py:151
#define M_PI
constexpr int ieta() const
Definition: GEMDetId.h:199
const GEMGeometry * GEMGeometry_
Definition: GEMDQMBase.h:575
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void SetNoUnderOverflowBin()
Definition: GEMDQMBase.h:247
int SetLabelForIEta(K key, Int_t nAxis, Int_t nNumBin=-1)
Definition: GEMDQMBase.h:357
void add(std::string const &label, ParameterSetDescription const &psetDescription)
DQMStore::IBooker * getBooker()
Definition: GEMDQMBase.h:94
std::string getNameDirLayer(ME3IdsKey key3)
Definition: GEMDQMBase.h:662
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:307
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:551
std::map< GEMDetId, std::vector< const GEMEtaPartition * > > mapEtaPartition_
Definition: GEMDQMBase.h:579
HLT enums.
void SetNbinsX(Int_t nBinsX)
Definition: GEMDQMBase.h:262
std::tuple< Int_t, Int_t > ME2IdsKey
Float_t fRadiusMin_
Definition: GEMDigiSource.h:66
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:281
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:289
Definition: event.py:1
Definition: Run.h:45
MEMap3Inf mapDigiWheel_layer_
Definition: GEMDigiSource.h:54
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override