13 #include <fmt/format.h> 24 simHitToken_ = consumes<PSimHitContainer>(
26 rpcDigiToken_ = consumes<RPCDigiCollection>(
36 auto rpcGeom =
eventSetup.getHandle(rpcGeomToken_);
40 event.getByToken(simHitToken_, simHitHandle);
41 event.getByToken(rpcDigiToken_, rpcDigisHandle);
44 std::map<const RPCRoll *, std::vector<double>> detToSimHitXsMap;
45 for (
auto simIt = simHitHandle->begin(); simIt != simHitHandle->end(); ++simIt) {
46 const RPCDetId rsid = simIt->detUnitId();
51 if (detToSimHitXsMap.find(
roll) == detToSimHitXsMap.end())
52 detToSimHitXsMap[
roll] = std::vector<double>();
53 detToSimHitXsMap[
roll].push_back(simIt->localPosition().x());
58 hRZ_->Fill(gp.z(), gp.perp());
62 hXY_Barrel_->Fill(gp.x(), gp.y());
65 const int layer = rsid.
layer();
68 auto match = hZPhi_.find(stla);
69 if (match != hZPhi_.end()) {
70 const double phiInDeg = 180. * gp.barePhi() /
TMath::Pi();
71 match->second->Fill(gp.z(), phiInDeg);
76 auto match = hXY_Endcap_.find(disk);
77 if (match != hXY_Endcap_.end())
78 match->second->Fill(gp.x(), gp.y());
81 for (
auto detToSimHitXs : detToSimHitXsMap) {
82 hNSimHitPerRoll_->Fill(detToSimHitXs.second.size());
86 std::map<const RPCRoll *, std::vector<double>> detToDigiXsMap;
87 for (
auto detUnitIt = rpcDigisHandle->begin(); detUnitIt != rpcDigisHandle->end(); ++detUnitIt) {
88 const RPCDetId rsid = (*detUnitIt).first;
96 for (
auto digiIt =
range.first; digiIt !=
range.second; ++digiIt) {
98 const int strip = digiIt->strip();
99 hStripProf_->Fill(
strip);
104 hStripProf_RB12_->Fill(
strip);
106 hStripProf_RB34_->Fill(
strip);
109 hStripProf_IRPC_->Fill(
strip);
111 hStripProf_Endcap_->Fill(
strip);
115 const int bx = digiIt->bx();
120 hBxDisc_4Plus_->Fill(
bx);
121 }
else if (
region == -1) {
122 hBxDisc_4Min_->Fill(
bx);
127 if (isDigiTimeAvailable_) {
128 const double digiTime = digiIt->hasTime() ? digiIt->time() : digiIt->bx() * 25;
130 if (digiIt->hasTime()) {
140 const double digiX =
roll->centreOfStrip(digiIt->strip()).
x();
141 if (detToDigiXsMap.find(
roll) == detToDigiXsMap.end())
142 detToDigiXsMap[
roll] = std::vector<double>();
143 detToDigiXsMap[
roll].push_back(digiX);
146 for (
auto detToDigiXs : detToDigiXsMap) {
147 const auto digiXs = detToDigiXs.second;
148 const int nDigi = digiXs.size();
149 hNDigiPerRoll_->Fill(nDigi);
152 const auto roll = detToDigiXs.first;
156 if (detToSimHitXsMap.find(
roll) == detToSimHitXsMap.end())
159 const auto simHitXs = detToSimHitXsMap[
roll];
160 const int nSimHit = simHitXs.size();
164 const double dx = digiXs[0] - simHitXs[0];
166 if (
roll->isBarrel()) {
169 const int layer =
detId.layer();
172 auto matchLayer = hResBarrelLayers_.find(stla);
173 if (matchLayer != hResBarrelLayers_.end())
174 matchLayer->second->Fill(
dx);
176 auto matchWheel = hResBarrelWheels_.find(
wheel);
177 if (matchWheel != hResBarrelWheels_.end())
178 matchWheel->second->Fill(
dx);
180 const int disk =
detId.region() *
detId.station();
181 auto matchDisk = hResEndcapDisks_.find(disk);
182 if (matchDisk != hResEndcapDisks_.end())
183 matchDisk->second->Fill(
dx);
185 auto matchRing = hResEndcapRings_.find(
detId.ring());
186 if (matchRing != hResEndcapRings_.end())
187 matchRing->second->Fill(
dx);
196 const double maxZ = 1100;
197 const int nbinsZ = 220;
198 const double maxXY = 800;
199 const int nbinsXY = 160;
200 const double minR = 100, maxR = 800;
201 const int nbinsR = 70;
203 const double maxBarrelZ = 700;
204 const int nbinsBarrelZ = 140;
207 hRZ_ = booker.
book2D(
"RZ",
"R-Z view;Z (cm);R (cm)", nbinsZ, -
maxZ,
maxZ, nbinsR, minR, maxR);
211 hXY_Barrel_ = booker.
book2D(
"XY_Barrel",
"X-Y view of Barrel", nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY);
213 for (
int disk = 1; disk <= 4; ++disk) {
218 hXY_Endcap_[disk] = booker.
book2D(meNameP, meTitleP, nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY);
219 hXY_Endcap_[-disk] = booker.
book2D(meNameN, meTitleN, nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY);
221 hXY_Endcap_[-disk]->setOption(
"colz");
225 for (
int layer = 1; layer <= 6; ++layer) {
228 hZPhi_[layer] = booker.
book2D(meName, meTitle, nbinsBarrelZ, -maxBarrelZ, maxBarrelZ,
nbinsPhi, -180, 180);
233 hStripProf_ = booker.
book1D(
"Strip_Profile",
"Strip_Profile;Strip Number", 100, 0, 100);
234 hStripProf_RB12_ = booker.
book1D(
"Strip_Profile_RB12",
"Strip Profile RB1 and RB2;Strip Number", 92, 0, 92);
235 hStripProf_RB34_ = booker.
book1D(
"Strip_Profile_RB34",
"Strip Profile RB3 and RB4;Strip Number", 62, 0, 62);
236 hStripProf_Endcap_ = booker.
book1D(
"Strip_Profile_Endcap",
"Strip Profile Endcap;Strip Number", 40, 0, 40);
237 hStripProf_IRPC_ = booker.
book1D(
"Strip_Profile_IRPC",
"Strip Profile IRPC;Strip Number", 100, 0, 100);
240 hBxDist_ = booker.
book1D(
"Bunch_Crossing",
"Bunch Crossing;Bunch crossing", 20, -10., 10.);
241 hBxDisc_4Plus_ = booker.
book1D(
"BxDisc_4Plus",
"BxDisc_4Plus", 20, -10., 10.);
242 hBxDisc_4Min_ = booker.
book1D(
"BxDisc_4Min",
"BxDisc_4Min", 20, -10., 10.);
245 if (isDigiTimeAvailable_) {
247 booker.
book1D(
"DigiTimeAll",
"Digi time including present electronics;Digi time (ns)", 100, -12.5, 12.5);
248 hDigiTime_ = booker.
book1D(
"DigiTime",
"Digi time only with timing information;Digi time (ns)", 100, -12.5, 12.5);
249 hDigiTimeIRPC_ = booker.
book1D(
"DigiTimeIRPC",
"IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5);
250 hDigiTimeNoIRPC_ = booker.
book1D(
"DigiTimeNoIRPC",
"non-IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5);
254 hNSimHitPerRoll_ = booker.
book1D(
"NSimHitPerRoll",
"SimHit multiplicity per Roll;Multiplicity", 10, 0, 10);
255 hNDigiPerRoll_ = booker.
book1D(
"NDigiPerRoll",
"Digi multiplicity per Roll;Multiplicity", 10, 0, 10);
258 hRes_ = booker.
book1D(
"Digi_SimHit_Difference",
"Digi-SimHit difference;dx (cm)", 100, -8, 8);
260 for (
int layer = 1; layer <= 6; ++layer) {
263 hResBarrelLayers_[layer] = booker.
book1D(meName, meTitle, 100, -8, 8);
266 hResBarrelWheels_[-2] = booker.
book1D(
"Residual_Barrel_Wheel_m2",
"Residual of Barrel Wheel-2;dx (cm)", 100, -8, 8);
267 hResBarrelWheels_[-1] = booker.
book1D(
"Residual_Barrel_Wheel_m1",
"Residual of Barrel Wheel-1;dx (cm)", 100, -8, 8);
268 hResBarrelWheels_[+0] = booker.
book1D(
"Residual_Barrel_Wheel_00",
"Residual of Barrel Wheel 0;dx (cm)", 100, -8, 8);
269 hResBarrelWheels_[+1] = booker.
book1D(
"Residual_Barrel_Wheel_p1",
"Residual of Barrel Wheel+1;dx (cm)", 100, -8, 8);
270 hResBarrelWheels_[+2] = booker.
book1D(
"Residual_Barrel_Wheel_p2",
"Residual of Barrel Wheel+2;dx (cm)", 100, -8, 8);
272 for (
int disk = 1; disk <= 4; ++disk) {
277 hResEndcapDisks_[+disk] = booker.
book1D(meNameP, meTitleP, 100, -8, 8);
278 hResEndcapDisks_[-disk] = booker.
book1D(meNameN, meTitleN, 100, -8, 8);
281 hResEndcapRings_[1] = booker.
book1D(
"Residual_Endcap_Ring1",
"Residual of Endcap Ring1;dx (cm)", 100, -12, 12);
282 hResEndcapRings_[2] = booker.
book1D(
"Residual_Endcap_Ring2",
"Residual of Endcap Ring2;dx (cm)", 100, -8, 8);
283 hResEndcapRings_[3] = booker.
book1D(
"Residual_Endcap_Ring3",
"Residual of Endcap Ring3;dx (cm)", 100, -8, 8);
virtual void setCurrentFolder(std::string const &fullpath)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual void setOption(const char *option)
RPCDigiValid(const edm::ParameterSet &ps)
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::pair< const_iterator, const_iterator > Range
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())