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;
95 wheel << chId.
wheel();
101 string HistoName =
"_W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str();
103 ibooker.
setCurrentFolder(
"DT/01-DTChamberEfficiency/Task/Wheel" + wheel.str() +
"/Sector" + sector.str() +
104 "/Station" + station.str());
107 vector<MonitorElement*>
histos;
118 histos.push_back(ibooker.
book2D(
119 "hEffGoodSegVsPosDen" + HistoName,
"Eff vs local position (good) ", 25, -250., 250., 25, -250., 250.));
121 histos.push_back(ibooker.
book2D(
"hEffGoodCloseSegVsPosNum" + HistoName,
122 "Eff vs local position (good and close segs) ",
131 ibooker.
book1D(
"hDistSegFromExtrap" + HistoName,
"Distance segments from extrap position ", 200, 0., 200.));
133 histos.push_back(ibooker.
book1D(
"hNaiveEffSeg" + HistoName,
"Naive eff ", 10, 0., 10.));
135 histos.push_back(ibooker.
book2D(
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.));
141 histos.push_back(ibooker.
book2D(
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;
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());
280 histos[2]->Fill(dist);
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) {
322 if (nHits1 == nHits2) {
327 }
else if (nHits1 > nHits2)
371 return (nHits >= theMinHitsSegment && seg.
chi2() / seg.
degreesOfFreedom() < theMinChi2NormSegment);
LuminosityBlockID id() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getUntrackedParameter(std::string const &, T const &) const
LocalPoint localPosition() const override
Local position in Chamber frame.
std::pair< const_iterator, const_iterator > range
iterator range
Point3DBase< Scalar, LocalTag > LocalPoint
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void setCurrentFolder(std::string const &fullpath)
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
double chi2() const override
Chi2 of the segment fit.
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &setup) override
BeginRun.
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
~DTChamberEfficiencyTask() override
Destructor.
C::const_iterator const_iterator
constant access iterator type
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) override
To reset the MEs.
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
LocalPoint interpolate(const DTRecSegment4D &seg1, const DTRecSegment4D &seg3, const DTChamberId &MB2) const
bool hasPhi() const
Does it have the Phi projection?
DTChamberEfficiencyTask(const edm::ParameterSet &pset)
Constructor.
bool hasZed() const
Does it have the Z projection?
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
bool isGoodSegment(const DTRecSegment4D &seg) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
LuminosityBlockNumber_t luminosityBlock() const
const DTRecSegment4D & getBestSegment(const DTRecSegment4DCollection::range &segs) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
void bookHistos(DQMStore::IBooker &ibooker, DTChamberId chId)
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Basic3DVector unit() const