37 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] Constructor called!" << endl;
40 recHits4DToken_ = consumes<DTRecSegment4DCollection>(
56 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] Destructor called!" << endl;
72 vector<const DTChamber*>
chambers = dtGeom->chambers();
73 for(vector<const DTChamber*>::const_iterator
chamber = chambers.begin();
76 for(
int sl = 1; sl <= 3; ++sl) {
77 if(dtChId.
station() == 4 && sl == 2)
continue;
91 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionTask]: Begin of LS transition"<<endl;
95 histo != histosPerSL.end();
97 int size = (*histo).second.size();
99 (*histo).second[
i]->Reset();
107 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] Analyze #Run: " <<
event.id().run()
108 <<
" #Event: " <<
event.id().event() << endl;
113 event.getByToken(recHits4DToken_, all4DSegments);
116 if(!all4DSegments.
isValid())
return;
120 for (chamberId = all4DSegments->id_begin();
121 chamberId != all4DSegments->id_end();
131 segment4D!=range.second;
136 if((*chamberId).station() != 4 && (*segment4D).dimension() != 4) {
137 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 4 but " 138 << (*segment4D).dimension() <<
"!" << endl;
140 }
else if((*chamberId).station() == 4 && (*segment4D).dimension() != 2) {
141 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 2 but " 142 << (*segment4D).dimension() <<
"!" << endl;
148 vector<DTRecHit1D> recHits1D_S3;
154 if((*segment4D).hasPhi()) {
158 if(phiRecHits.size() < thePhiHitsCut) {
161 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
166 if((*segment4D).hasZed()) {
169 if(zRecHits.size() < theZHitsCut) {
173 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
177 for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
178 recHit1D != recHits1D_S3.end();
180 const DTWireId wireId = (*recHit1D).wireId();
187 float distRecHitToWire = fabs(wireX - (*recHit1D).localPosition().x());
192 LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
197 LocalPoint segPosAtZWire = (*segment4D).localPosition()
198 + (*segment4D).localDirection()*wirePosInChamber.
z()/
cos((*segment4D).localDirection().theta());
203 double distSegmToWire = -1;
204 if(sl == 1 || sl == 3) {
206 distSegmToWire = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
209 distSegmToWire = fabs(wirePosInChamber.
y() - segPosAtZWire.
y());
212 if(distSegmToWire > 2.1)
213 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
" Warning: dist segment-wire: " << distSegmToWire << endl;
215 double residual = distRecHitToWire - distSegmToWire;
217 fillHistos(wireId.
superlayerId(), distSegmToWire, residual);
229 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
" Booking histos for SL: " << slId << endl;
234 stringstream sector; sector << slId.
sector();
235 stringstream superLayer; superLayer << slId.
superlayer();
240 "_St" + station.str() +
241 "_Sec" + sector.str() +
242 "_SL" + superLayer.str();
245 "/Sector" + sector.str() +
246 "/Station" + station.str());
248 vector<MonitorElement *>
histos;
250 histos.push_back(ibooker.
book1D(
"hResDist"+slHistoName,
251 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
253 histosPerSL[slId] =
histos;
261 vector<MonitorElement *>
histos = histosPerSL[slId];
262 histos[0]->Fill(residual);
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
std::pair< const_iterator, const_iterator > range
iterator range
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) override
To reset the MEs.
def setup(process, global_tag, zero_tesla=False)
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
~DTResolutionAnalysisTask() override
Destructor.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
C::const_iterator const_iterator
constant access iterator type
const DTTopology & specificTopology() const
void setCurrentFolder(std::string const &fullpath)
Cos< T >::type cos(const T &t)
MonitorElement * book1D(Args &&...args)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
int wire() const
Return the wire number.
int superlayer() const
Return the superlayer number (deprecated method name)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
BookHistograms.
LuminosityBlockNumber_t luminosityBlock() const
DTLayerId layerId() const
Return the corresponding LayerId.
void bookHistos(DQMStore::IBooker &ibooker, DTSuperLayerId slId)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
BeginRun.
void fillHistos(DTSuperLayerId slId, float distExtr, float residual)
int station() const
Return the station number.
static char chambers[264][20]
int wheel() const
Return the wheel number.
DTResolutionAnalysisTask(const edm::ParameterSet &pset)
Constructor.