37 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] Constructor called!" << endl;
40 recHits4DToken_ = consumes<DTRecSegment4DCollection>(
56 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] Destructor called!" << endl;
70 vector<const DTChamber*>
chambers = dtGeom->chambers();
71 for(vector<const DTChamber*>::const_iterator chamber = chambers.begin();
72 chamber != chambers.end(); ++chamber) {
74 for(
int sl = 1; sl <= 3; ++sl) {
75 if(dtChId.
station() == 4 && sl == 2)
continue;
89 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionTask]: Begin of LS transition"<<endl;
93 histo != histosPerSL.end();
95 int size = (*histo).second.size();
97 (*histo).second[
i]->Reset();
106 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] endjob called!"<<endl;
114 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask] Analyze #Run: " <<
event.id().run()
115 <<
" #Event: " <<
event.id().event() << endl;
120 event.getByToken(recHits4DToken_, all4DSegments);
123 if(!all4DSegments.
isValid())
return;
126 DTRecSegment4DCollection::id_iterator chamberId;
127 for (chamberId = all4DSegments->id_begin();
128 chamberId != all4DSegments->id_end();
136 const DTChamber* chamber = dtGeom->chamber(*chamberId);
140 segment4D!=range.second;
146 if((*chamberId).station() != 4 && (*segment4D).dimension() != 4) {
147 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 4 but "
148 << (*segment4D).dimension() <<
"!" << endl;
150 }
else if((*chamberId).station() == 4 && (*segment4D).dimension() != 2) {
151 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
"[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 2 but "
152 << (*segment4D).dimension() <<
"!" << endl;
158 vector<DTRecHit1D> recHits1D_S3;
164 if((*segment4D).hasPhi()) {
168 if(phiRecHits.size() < thePhiHitsCut) {
173 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
178 if((*segment4D).hasZed()) {
181 if(zRecHits.size() < theZHitsCut) {
186 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
190 for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
191 recHit1D != recHits1D_S3.end();
193 const DTWireId wireId = (*recHit1D).wireId();
200 float distRecHitToWire = fabs(wireX - (*recHit1D).localPosition().x());
205 LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
210 LocalPoint segPosAtZWire = (*segment4D).localPosition()
211 + (*segment4D).localDirection()*wirePosInChamber.
z()/
cos((*segment4D).localDirection().theta());
216 double distSegmToWire = -1;
217 if(sl == 1 || sl == 3) {
219 distSegmToWire = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
222 distSegmToWire = fabs(wirePosInChamber.
y() - segPosAtZWire.
y());
225 if(distSegmToWire > 2.1)
226 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
" Warning: dist segment-wire: " << distSegmToWire << endl;
228 double residual = distRecHitToWire - distSegmToWire;
230 fillHistos(wireId.
superlayerId(), distSegmToWire, residual);
247 edm::LogVerbatim (
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
" Booking histos for SL: " << slId << endl;
250 stringstream wheel; wheel << slId.
wheel();
252 stringstream sector; sector << slId.
sector();
253 stringstream superLayer; superLayer << slId.
superlayer();
258 "_St" + station.str() +
259 "_Sec" + sector.str() +
260 "_SL" + superLayer.str();
262 theDbe->setCurrentFolder(topHistoFolder +
"/Wheel" + wheel.str() +
263 "/Sector" + sector.str() +
264 "/Station" + station.str());
266 vector<MonitorElement *>
histos;
268 histos.push_back(theDbe->book1D(
"hResDist"+slHistoName,
269 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
275 histosPerSL[slId] =
histos;
283 vector<MonitorElement *>
histos = histosPerSL[slId];
284 histos[0]->Fill(residual);
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
static char chambers[TOTALCHAMBERS][20]
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
void analyze(const edm::Event &event, const edm::EventSetup &setup)
const DTTopology & specificTopology() const
Cos< T >::type cos(const T &t)
void beginRun(const edm::Run &, const edm::EventSetup &)
BeginRun.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
To reset the MEs.
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
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)
LuminosityBlockNumber_t luminosityBlock() const
DTLayerId layerId() const
Return the corresponding LayerId.
void fillHistos(DTSuperLayerId slId, float distExtr, float residual)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
DTResolutionAnalysisTask(const edm::ParameterSet &pset)
Constructor.
void bookHistos(DTSuperLayerId slId)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual ~DTResolutionAnalysisTask()
Destructor.
tuple size
Write out results.
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return the superlayer corresponding to the given id.