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;
109 stringstream wheel; wheel << chId.
wheel();
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) {
170 int wheel = ch.
wheel();
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);
250 LocalPoint posAtMid = interpolate(bestBotSeg, bestTopSeg, MidId);
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
std::pair< const_iterator, const_iterator > range
iterator range
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &setup)
BeginRun.
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
virtual int degreesOfFreedom() const
Degrees of freedom of the segment fit.
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
T x() const
Cartesian x coordinate.
void analyze(const edm::Event &event, const edm::EventSetup &setup)
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
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?
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual LocalPoint localPosition() const
Local position in Chamber frame.
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.
void setCurrentFolder(const std::string &fullpath)
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
virtual ~DTChamberEfficiencyTask()
Destructor.
virtual double chi2() const
Chi2 of the segment fit.
int station() const
Return the station number.
int wheel() const
Return the wheel number.
void bookHistos(DQMStore::IBooker &ibooker, DTChamberId chId)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
To reset the MEs.