38 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Constructor called!";
43 theDbe->setCurrentFolder(
"DT/DTChamberEfficiencyTask");
52 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Destructor called!";
59 recHits4DToken_ = consumes<DTRecSegment4DCollection>(
63 theMinHitsSegment =
static_cast<unsigned int>(
parameters.getParameter<
int>(
"minHitsSegment"));
64 theMinChi2NormSegment =
parameters.getParameter<
double>(
"minChi2NormSegment");
66 theMinCloseDist =
parameters.getParameter<
double>(
"minCloseDist");
69 onlineMonitor =
parameters.getUntrackedParameter<
bool>(
"onlineMonitor");
72 detailedAnalysis =
parameters.getUntrackedParameter<
bool>(
"detailedAnalysis");
79 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask")<<
"[DTChamberEfficiencyTask]: Begin of LS transition";
82 for(
map<
DTChamberId, vector<MonitorElement*> > ::const_iterator
histo = histosPerCh.begin();
83 histo != histosPerCh.end();
85 int size = (*histo).second.size();
87 (*histo).second[
i]->Reset();
101 vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
102 vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
103 for (; ch_it != ch_end; ++ch_it) {
114 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask")<<
"[DTChamberEfficiencyTask] endjob called!";
122 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
" Booking histos for CH : " << chId;
125 stringstream wheel; wheel << chId.
wheel();
127 stringstream sector; sector << chId.
sector();
131 "_St" + station.str() +
132 "_Sec" + sector.str();
134 theDbe->setCurrentFolder(
"DT/01-DTChamberEfficiency/Task/Wheel" + wheel.str() +
135 "/Sector" + sector.str() +
136 "/Station" + station.str());
139 vector<MonitorElement *>
histos;
151 histos.push_back(theDbe->book2D(
"hEffGoodSegVsPosDen"+HistoName,
"Eff vs local position (good) ",25,-250.,250., 25,-250.,250.));
153 histos.push_back(theDbe->book2D(
"hEffGoodCloseSegVsPosNum"+HistoName,
"Eff vs local position (good and close segs) ", 25,-250.,250., 25,-250.,250.));
154 if(detailedAnalysis){
155 histos.push_back(theDbe->book1D(
"hDistSegFromExtrap"+HistoName,
"Distance segments from extrap position ",200,0.,200.));
157 histos.push_back(theDbe->book1D(
"hNaiveEffSeg"+HistoName,
"Naive eff ",10,0.,10.));
159 histos.push_back(theDbe->book2D(
"hEffSegVsPosDen"+HistoName,
"Eff vs local position (all) ",25,-250.,250., 25,-250.,250.));
161 histos.push_back(theDbe->book2D(
"hEffSegVsPosNum"+HistoName,
"Eff vs local position ",25,-250.,250., 25,-250.,250.));
163 histos.push_back(theDbe->book2D(
"hEffGoodSegVsPosNum"+HistoName,
"Eff vs local position (good segs) ", 25,-250.,250., 25,-250.,250.));
165 histosPerCh[chId] =
histos;
171 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTChamberEfficiencyTask") <<
"[DTChamberEfficiencyTask] Analyze #Run: " <<
event.id().run()
172 <<
" #Event: " <<
event.id().event();
175 event.getByToken(recHits4DToken_, segs);
181 vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
182 vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
183 for (; ch_it != ch_end; ++ch_it) {
186 int wheel = ch.
wheel();
223 int nSegsBot=segsBot.second-segsBot.first;
225 if (nSegsBot==0)
continue;
227 vector<MonitorElement *>
histos = histosPerCh[MidId];
231 int nSegsTop=segsTop.second-segsTop.first;
239 pBestTopSeg =
const_cast<DTRecSegment4D*
>(&getBestSegment(segsTop));
244 int nSegsTop14=segsTop14.second-segsTop14.first;
245 nSegsTop+=nSegsTop14;
249 pBestTopSeg =
const_cast<DTRecSegment4D*
>(getBestSegment(pBestTopSeg, pBestTopSeg14));
252 if (!pBestTopSeg)
continue;
256 int nSegsMid=segsMid.second-segsMid.first;
258 if(detailedAnalysis){
261 if (nSegsMid>0) histos[3]->Fill(1);
266 LocalPoint posAtMid = interpolate(bestBotSeg, bestTopSeg, MidId);
269 if (isGoodSegment(bestBotSeg) && isGoodSegment(bestTopSeg)) {
271 histos[4]->Fill(posAtMid.
x(),posAtMid.
y());
273 if ((dtGeom->chamber(MidId))->surface().bounds().inside(posAtMid)) {
274 histos[0]->Fill(posAtMid.
x(),posAtMid.
y());
277 if(detailedAnalysis){
279 histos[5]->Fill(posAtMid.
x(),posAtMid.
y());
284 if (isGoodSegment(bestMidSeg)) {
287 histos[6]->Fill(posAtMid.
x(),posAtMid.
y());
292 if (bestMidSeg.
hasPhi()) {
294 dist = (midSegPos-posAtMid).
mag();
296 dist = fabs((midSegPos-posAtMid).
x());
299 dist = fabs((midSegPos-posAtMid).
y());
301 if (dist < theMinCloseDist ) {
302 histos[1]->Fill(posAtMid.
x(),posAtMid.
y());
305 histos[2]->Fill(dist);
320 unsigned int nHitBest=0;
321 double chi2Best=99999.;
323 seg!=segs.second ; ++seg ) {
324 unsigned int nHits= ((*seg).hasPhi() ? (*seg).phiSegment()->recHits().size() : 0 ) ;
325 nHits+= ((*seg).hasZed() ? (*seg).zSegment()->recHits().size() : 0 );
327 if (nHits==nHitBest) {
328 if ((*seg).chi2()/(*seg).degreesOfFreedom() < chi2Best ) {
329 chi2Best=(*seg).chi2()/(*seg).degreesOfFreedom();
333 else if (nHits>nHitBest) {
352 if (nHits1==nHits2) {
358 else if (nHits1>nHits2)
return s1;
398 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.
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)
void bookHistos(DTChamberId chId)
void analyze(const edm::Event &event, const edm::EventSetup &setup)
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
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.
bool isGoodSegment(const DTRecSegment4D &seg) const
LuminosityBlockNumber_t luminosityBlock() const
const DTRecSegment4D & getBestSegment(const DTRecSegment4DCollection::range &segs) const
void beginRun(const edm::Run &run, const edm::EventSetup &setup)
BeginRun.
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 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.