27 debug =
pset.getUntrackedParameter<
bool>(
"debug",
false);
29 edm::LogVerbatim(
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Constructor called!";
38 theMinHitsSegment = static_cast<unsigned int>(
parameters.getParameter<
int>(
"minHitsSegment"));
39 theMinChi2NormSegment =
parameters.getParameter<
double>(
"minChi2NormSegment");
41 theMinCloseDist =
parameters.getParameter<
double>(
"minCloseDist");
51 edm::LogVerbatim(
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Destructor called!";
56 <<
"[DTChamberEfficiencyTask]: Begin of LS transition";
59 for (
map<
DTChamberId, vector<MonitorElement*> >::const_iterator
histo = histosPerCh.begin();
60 histo != histosPerCh.end();
62 int size = (*histo).second.size();
63 for (
int i = 0;
i <
size;
i++) {
64 (*histo).second[
i]->Reset();
81 vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
82 vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
83 for (; ch_it != ch_end; ++ch_it) {
91 edm::LogVerbatim(
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
" Booking histos for CH : " << chId;
103 ibooker.
setCurrentFolder(
"DT/01-DTChamberEfficiency/Task/Wheel" +
wheel.str() +
"/Sector" + sector.str() +
107 vector<MonitorElement*>
histos;
119 "hEffGoodSegVsPosDen" +
HistoName,
"Eff vs local position (good) ", 25, -250., 250., 25, -250., 250.));
122 "Eff vs local position (good and close segs) ",
131 ibooker.
book1D(
"hDistSegFromExtrap" +
HistoName,
"Distance segments from extrap position ", 200, 0., 200.));
136 "hEffSegVsPosDen" +
HistoName,
"Eff vs local position (all) ", 25, -250., 250., 25, -250., 250.));
139 ibooker.
book2D(
"hEffSegVsPosNum" +
HistoName,
"Eff vs local position ", 25, -250., 250., 25, -250., 250.));
142 "hEffGoodSegVsPosNum" +
HistoName,
"Eff vs local position (good segs) ", 25, -250., 250., 25, -250., 250.));
144 histosPerCh[chId] =
histos;
149 <<
"[DTChamberEfficiencyTask] Analyze #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event();
152 event.getByToken(recHits4DToken_, segs);
154 int bottom = 0, top = 0;
157 vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
158 vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
159 for (; ch_it != ch_end; ++ch_it) {
197 int nSegsBot = segsBot.second - segsBot.first;
202 vector<MonitorElement*>
histos = histosPerCh[MidId];
206 int nSegsTop = segsTop.second - segsTop.first;
214 pBestTopSeg = const_cast<DTRecSegment4D*>(&getBestSegment(segsTop));
219 int nSegsTop14 = segsTop14.second - segsTop14.first;
220 nSegsTop += nSegsTop14;
222 DTRecSegment4D* pBestTopSeg14 = const_cast<DTRecSegment4D*>(&getBestSegment(segsTop14));
224 pBestTopSeg = const_cast<DTRecSegment4D*>(getBestSegment(pBestTopSeg, pBestTopSeg14));
232 int nSegsMid = segsMid.second - segsMid.first;
246 if (isGoodSegment(bestBotSeg) && isGoodSegment(bestTopSeg)) {
248 histos[4]->Fill(posAtMid.
x(), posAtMid.
y());
250 if ((dtGeom->chamber(MidId))->surface().bounds().inside(posAtMid)) {
251 histos[0]->Fill(posAtMid.
x(), posAtMid.
y());
255 histos[5]->Fill(posAtMid.
x(), posAtMid.
y());
260 if (isGoodSegment(bestMidSeg)) {
262 histos[6]->Fill(posAtMid.
x(), posAtMid.
y());
267 if (bestMidSeg.
hasPhi()) {
269 dist = (midSegPos - posAtMid).
mag();
271 dist = fabs((midSegPos - posAtMid).x());
274 dist = fabs((midSegPos - posAtMid).y());
276 if (dist < theMinCloseDist) {
277 histos[1]->Fill(posAtMid.
x(), posAtMid.
y());
291 unsigned int nHitBest = 0;
292 double chi2Best = 99999.;
294 unsigned int nHits = ((*seg).hasPhi() ? (*seg).phiSegment()->recHits().size() : 0);
295 nHits += ((*seg).hasZed() ? (*seg).zSegment()->recHits().size() : 0);
297 if (nHits == nHitBest) {
298 if ((*seg).chi2() / (*seg).degreesOfFreedom() < chi2Best) {
299 chi2Best = (*seg).
chi2() / (*seg).degreesOfFreedom();
302 }
else if (nHits > nHitBest) {
319 unsigned int nHits2 = (
s2->hasPhi() ?
s2->phiSegment()->recHits().size() : 0);
320 nHits2 += (
s2->hasZed() ?
s2->zSegment()->recHits().size() : 0);
322 if (nHits1 == nHits2) {
327 }
else if (nHits1 > nHits2)
371 return (nHits >= theMinHitsSegment && seg.
chi2() / seg.
degreesOfFreedom() < theMinChi2NormSegment);