35 <<
"[DTResolutionAnalysisTask] Constructor called!" << endl;
39 consumes<DTRecSegment4DCollection>(
edm::InputTag(
pset.getUntrackedParameter<
string>(
"recHits4DLabel")));
44 topHistoFolder =
pset.getUntrackedParameter<
string>(
"topHistoFolder",
"DT/02-Segments");
52 <<
"[DTResolutionAnalysisTask] Destructor called!" << endl;
68 for (
int sl = 1; sl <= 3; ++sl) {
69 if (dtChId.
station() == 4 && sl == 2)
95 <<
"[DTResolutionAnalysisTask] Analyze #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event() << endl;
107 for (chamberId = all4DSegments->id_begin(); chamberId != all4DSegments->id_end(); ++chamberId) {
118 if ((*chamberId).station() != 4 && (*segment4D).dimension() != 4) {
120 <<
"[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 4 but " << (*segment4D).dimension()
123 }
else if ((*chamberId).station() == 4 && (*segment4D).dimension() != 2) {
125 <<
"[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 2 but " << (*segment4D).dimension()
131 vector<DTRecHit1D> recHits1D_S3;
136 if ((*segment4D).hasPhi()) {
143 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
147 if ((*segment4D).hasZed()) {
153 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
157 for (vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end();
159 const DTWireId wireId = (*recHit1D).wireId();
163 float wireX =
layer->specificTopology().wirePosition(wireId.
wire());
166 float distRecHitToWire = fabs(wireX - (*recHit1D).localPosition().x());
171 LocalPoint wirePosInLay(wireX, (*recHit1D).localPosition().y(), (*recHit1D).localPosition().z());
176 LocalPoint segPosAtZWire = (*segment4D).localPosition() + (*segment4D).localDirection() * wirePosInChamber.
z() /
177 cos((*segment4D).localDirection().theta());
182 double distSegmToWire = -1;
183 if (sl == 1 || sl == 3) {
185 distSegmToWire = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
186 }
else if (sl == 2) {
188 distSegmToWire = fabs(wirePosInChamber.
y() - segPosAtZWire.
y());
191 if (distSegmToWire > 2.1)
193 <<
" Warning: dist segment-wire: " << distSegmToWire << endl;
195 double residual = distRecHitToWire - distSegmToWire;
207 edm::LogVerbatim(
"DTDQM|DTMonitorModule|DTResolutionAnalysisTask") <<
" Booking histos for SL: " << slId << endl;
216 stringstream superLayer;
219 string slHistoName =
"_W" +
wheel.str() +
"_St" +
station.str() +
"_Sec" +
sector.str() +
"_SL" + superLayer.str();
224 vector<MonitorElement*>
histos;
227 "hResDist" + slHistoName,
"Residuals on the distance from wire (rec_hit - segm_extr) (cm)", 200, -0.4, 0.4));
234 histos[0]->Fill(residual);
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
std::pair< const_iterator, const_iterator > range
iterator range
int wire() const
Return the wire number.
virtual void setCurrentFolder(std::string const &fullpath)
~DTResolutionAnalysisTask() override
Destructor.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
To reset the MEs.
C::const_iterator const_iterator
constant access iterator type
std::string topHistoFolder
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< DTRecSegment4DCollection > recHits4DToken_
std::map< DTSuperLayerId, std::vector< MonitorElement * > > histosPerSL
int superlayer() const
Return the superlayer number (deprecated method name)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
BookHistograms.
int wheel() const
Return the wheel number.
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)
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
DTLayerId layerId() const
Return the corresponding LayerId.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static char chambers[264][20]
DTResolutionAnalysisTask(const edm::ParameterSet &pset)
Constructor.
const DTGeometry * dtGeom
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.