36 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Constructor called!";
41 recHits4DToken_ = consumes<DTRecSegment4DCollection>(
45 theMinHitsSegment =
static_cast<unsigned int>(
parameters.getParameter<
int>(
"minHitsSegment"));
46 theMinChi2NormSegment =
parameters.getParameter<
double>(
"minChi2NormSegment");
48 theMinCloseDist =
parameters.getParameter<
double>(
"minCloseDist");
51 onlineMonitor =
parameters.getUntrackedParameter<
bool>(
"onlineMonitor");
54 detailedAnalysis =
parameters.getUntrackedParameter<
bool>(
"detailedAnalysis");
61 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Destructor called!";
66 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask")<<
"[DTChamberEfficiencyTask]: Begin of LS transition";
69 for(
map<
DTChamberId, vector<MonitorElement*> > ::const_iterator
histo = histosPerCh.begin();
70 histo != histosPerCh.end();
72 int size = (*histo).second.size();
74 (*histo).second[
i]->Reset();
94 vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
95 vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
96 for (; ch_it != ch_end; ++ch_it) {
106 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
" Booking histos for CH : " << chId;
111 stringstream sector; sector << chId.
sector();
115 "_St" + station.str() +
116 "_Sec" + sector.str();
118 ibooker.
setCurrentFolder(
"DT/01-DTChamberEfficiency/Task/Wheel" + wheel.str() +
119 "/Sector" + sector.str() +
120 "/Station" + station.str());
123 vector<MonitorElement *>
histos;
135 histos.push_back(ibooker.
book2D(
"hEffGoodSegVsPosDen"+HistoName,
"Eff vs local position (good) ",25,-250.,250., 25,-250.,250.));
137 histos.push_back(ibooker.
book2D(
"hEffGoodCloseSegVsPosNum"+HistoName,
"Eff vs local position (good and close segs) ", 25,-250.,250., 25,-250.,250.));
138 if(detailedAnalysis){
139 histos.push_back(ibooker.
book1D(
"hDistSegFromExtrap"+HistoName,
"Distance segments from extrap position ",200,0.,200.));
141 histos.push_back(ibooker.
book1D(
"hNaiveEffSeg"+HistoName,
"Naive eff ",10,0.,10.));
143 histos.push_back(ibooker.
book2D(
"hEffSegVsPosDen"+HistoName,
"Eff vs local position (all) ",25,-250.,250., 25,-250.,250.));
145 histos.push_back(ibooker.
book2D(
"hEffSegVsPosNum"+HistoName,
"Eff vs local position ",25,-250.,250., 25,-250.,250.));
147 histos.push_back(ibooker.
book2D(
"hEffGoodSegVsPosNum"+HistoName,
"Eff vs local position (good segs) ", 25,-250.,250., 25,-250.,250.));
149 histosPerCh[chId] =
histos;
155 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Analyze #Run: " <<
event.id().run()
156 <<
" #Event: " <<
event.id().event();
159 event.getByToken(recHits4DToken_, segs);
165 vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
166 vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
167 for (; ch_it != ch_end; ++ch_it) {
207 int nSegsBot=segsBot.second-segsBot.first;
209 if (nSegsBot==0)
continue;
211 vector<MonitorElement *>
histos = histosPerCh[MidId];
215 int nSegsTop=segsTop.second-segsTop.first;
223 pBestTopSeg =
const_cast<DTRecSegment4D*
>(&getBestSegment(segsTop));
228 int nSegsTop14=segsTop14.second-segsTop14.first;
229 nSegsTop+=nSegsTop14;
233 pBestTopSeg =
const_cast<DTRecSegment4D*
>(getBestSegment(pBestTopSeg, pBestTopSeg14));
236 if (!pBestTopSeg)
continue;
240 int nSegsMid=segsMid.second-segsMid.first;
242 if(detailedAnalysis){
245 if (nSegsMid>0) histos[3]->Fill(1);
253 if (isGoodSegment(bestBotSeg) && isGoodSegment(bestTopSeg)) {
255 histos[4]->Fill(posAtMid.
x(),posAtMid.
y());
257 if ((dtGeom->chamber(MidId))->surface().bounds().inside(posAtMid)) {
258 histos[0]->Fill(posAtMid.
x(),posAtMid.
y());
261 if(detailedAnalysis){
263 histos[5]->Fill(posAtMid.
x(),posAtMid.
y());
268 if (isGoodSegment(bestMidSeg)) {
271 histos[6]->Fill(posAtMid.
x(),posAtMid.
y());
276 if (bestMidSeg.
hasPhi()) {
278 dist = (midSegPos-posAtMid).
mag();
280 dist = fabs((midSegPos-posAtMid).x());
283 dist = fabs((midSegPos-posAtMid).y());
285 if (dist < theMinCloseDist ) {
286 histos[1]->Fill(posAtMid.
x(),posAtMid.
y());
289 histos[2]->Fill(dist);
304 unsigned int nHitBest=0;
305 double chi2Best=99999.;
307 seg!=segs.second ; ++seg ) {
308 unsigned int nHits= ((*seg).hasPhi() ? (*seg).phiSegment()->recHits().size() : 0 ) ;
309 nHits+= ((*seg).hasZed() ? (*seg).zSegment()->recHits().size() : 0 );
311 if (nHits==nHitBest) {
312 if ((*seg).chi2()/(*seg).degreesOfFreedom() < chi2Best ) {
313 chi2Best=(*seg).
chi2()/(*seg).degreesOfFreedom();
317 else if (nHits>nHitBest) {
336 if (nHits1==nHits2) {
342 else if (nHits1>nHits2)
return s1;
382 return ( nHits >= theMinHitsSegment &&
LuminosityBlockID id() const
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())
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
double chi2() const override
Chi2 of the segment fit.
def setup(process, global_tag, zero_tesla=False)
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 setCurrentFolder(std::string const &fullpath)
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
MonitorElement * book1D(Args &&...args)
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
MonitorElement * book2D(Args &&...args)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
LuminosityBlockNumber_t luminosityBlock() const
const DTRecSegment4D & getBestSegment(const DTRecSegment4DCollection::range &segs) const
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.