35 : histRange_(pset.getParameter<double>(
"histogramRange")),
36 segment4DLabel_(pset.getParameter<
edm::
InputTag>(
"segment4DLabel")),
37 rootBaseDir_(pset.getUntrackedParameter<
std::
string>(
"rootBaseDir",
"DT/Residuals")),
38 detailedAnalysis_(pset.getUntrackedParameter<
bool>(
"detailedAnalysis",
false)) {
42 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Constructor called.";
45 rootFile_ =
new TFile(rootFileName.c_str(),
"RECREATE");
55 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Destructor called.";
73 for (
auto sl_it : ch_it->superLayers()) {
77 for (
auto layer_it : (sl_it)->
layers()) {
97 for (chamberIdIt = segments4D->id_begin(); chamberIdIt != segments4D->id_end(); ++chamberIdIt) {
104 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
105 <<
"\nSegment global pos: " << chamber->
toGlobal((*segment).localPosition());
114 std::vector<DTRecHit1D> recHits1D_S3;
116 if ((*segment).hasPhi()) {
119 std::copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
122 if ((*segment).hasZed()) {
125 std::copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
129 for (std::vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end();
131 const DTWireId wireId = recHit1D->wireId();
134 if (segmDistance > 2.1)
135 LogTrace(
"Calibration") <<
"WARNING: segment-wire distance: " << segmDistance;
137 LogTrace(
"Calibration") <<
"segment-wire distance: " << segmDistance;
140 LogTrace(
"Calibration") <<
"Wire Id " << wireId <<
" residual on distance: " << residualOnDistance;
170 float segmDistance = -1;
171 if (sl == 1 || sl == 3)
172 segmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
174 segmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
180 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Writing histos to file.";
202 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Booking histos for SL: " << slId;
212 std::string slHistoName =
"_STEP" + std::to_string(step) +
"_W" + wheelStr +
"_St" + stationStr +
"_Sec" + sectorStr +
218 baseDir =
rootFile_->mkdir(rootBaseDir_.c_str());
219 LogDebug(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr);
220 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr).c_str());
222 wheelDir = baseDir->mkdir((
"Wheel" + wheelStr).c_str());
223 LogDebug(
"Calibration") <<
"Accessing " << (
"Station" + stationStr);
224 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr).c_str());
226 stationDir = wheelDir->mkdir((
"Station" + stationStr).c_str());
227 LogDebug(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr);
228 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr).c_str());
230 sectorDir = stationDir->mkdir((
"Sector" + sectorStr).c_str());
235 TH1F* histosTH1F =
new TH1F((
"hResDist" + slHistoName).c_str(),
236 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
240 TH2F* histosTH2F =
new TH2F((
"hResDistVsDist" + slHistoName).c_str(),
241 "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
256 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Booking histos for layer: " << layerId;
267 std::string layerHistoName =
"_STEP" + std::to_string(step) +
"_W" + wheelStr +
"_St" + stationStr +
"_Sec" +
268 sectorStr +
"_SL" + superLayerStr +
"_Layer" + layerStr;
274 LogDebug(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr);
275 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr).c_str());
277 wheelDir = baseDir->mkdir((
"Wheel" + wheelStr).c_str());
278 LogDebug(
"Calibration") <<
"Accessing " << (
"Station" + stationStr);
279 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr).c_str());
281 stationDir = wheelDir->mkdir((
"Station" + stationStr).c_str());
282 LogDebug(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr);
283 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr).c_str());
285 sectorDir = stationDir->mkdir((
"Sector" + sectorStr).c_str());
286 LogDebug(
"Calibration") <<
"Accessing " << (
"SL" + superLayerStr);
287 TDirectory* superLayerDir = sectorDir->GetDirectory((
"SL" + superLayerStr).c_str());
289 superLayerDir = sectorDir->mkdir((
"SL" + superLayerStr).c_str());
293 TH1F* histosTH1F =
new TH1F((
"hResDist" + layerHistoName).c_str(),
294 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
298 TH2F* histosTH2F =
new TH2F((
"hResDistVsDist" + layerHistoName).c_str(),
299 "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
LocalPoint localPosition() const override
Return the 3-dimensional local position.
std::map< DTSuperLayerId, TH1F * > histoMapTH1F_
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::map< DTLayerId, TH2F * > histoMapPerLayerTH2F_
DTSegmentSelector * select_
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
LocalPoint localPosition() const override
Local position in Chamber frame.
std::pair< const_iterator, const_iterator > range
iterator range
edm::InputTag segment4DLabel_
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance)
void bookHistos(DTSuperLayerId slId)
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
LocalVector localDirection() const override
Local direction in Chamber frame.
DTResidualCalibration(const edm::ParameterSet &pset)
Constructor.
DTChamberId chamberId() const
Return the corresponding ChamberId.
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.
int layer() const
Return the layer number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Geom::Theta< T > theta() const
C::const_iterator const_iterator
constant access iterator type
const DTTopology & specificTopology() const
void beginRun(const edm::Run &, const edm::EventSetup &) override
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Cos< T >::type cos(const T &t)
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.
~DTResidualCalibration() override
Destructor.
int wire() const
Return the wire number.
int superlayer() const
Return the superlayer number (deprecated method name)
std::map< DTSuperLayerId, TH2F * > histoMapTH2F_
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
float compute(const DTGeometry *, const DTRecHit1D &, const DTRecSegment4D &)
const DTGeometry * dtGeom_
DTLayerId layerId() const
Return the corresponding LayerId.
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
float segmentToWireDistance(const DTRecHit1D &recHit1D, const DTRecSegment4D &segment)
std::map< DTLayerId, TH1F * > histoMapPerLayerTH1F_
int station() const
Return the station number.
int wheel() const
Return the wheel number.
T const * product() const
DTWireId wireId() const
Return the wireId.