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)) {
43 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Constructor called.";
46 rootFile_ =
new TFile(rootFileName.c_str(),
"RECREATE");
56 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Destructor called.";
63 TH1::SetDefaultSumw2(
true);
77 for (
auto sl_it : ch_it->superLayers()) {
81 for (
auto layer_it : (sl_it)->
layers()) {
102 for(chamberIdIt = segments4D->id_begin(); chamberIdIt != segments4D->id_end(); ++chamberIdIt){
110 segment != range.second; ++segment){
112 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
113 <<
"\nSegment global pos: " << chamber->
toGlobal((*segment).localPosition());
119 std::vector<DTRecHit1D> recHits1D_S3;
121 if( (*segment).hasPhi() ){
124 std::copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
127 if( (*segment).hasZed() ){
130 std::copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
134 for(std::vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
135 recHit1D != recHits1D_S3.end(); ++recHit1D) {
136 const DTWireId wireId = recHit1D->wireId();
139 if(segmDistance > 2.1)
LogTrace(
"Calibration") <<
"WARNING: segment-wire distance: " << segmDistance;
140 else LogTrace(
"Calibration") <<
"segment-wire distance: " << segmDistance;
143 LogTrace(
"Calibration") <<
"Wire Id " << wireId <<
" residual on distance: " << residualOnDistance;
172 float segmDistance = -1;
173 if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
174 else if(sl == 2) segmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
181 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Writing histos to file.";
204 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Booking histos for SL: " << slId;
215 "_STEP" + std::to_string(step) +
222 TDirectory* baseDir =
rootFile_->GetDirectory(rootBaseDir_.c_str());
223 if(!baseDir) baseDir =
rootFile_->mkdir(rootBaseDir_.c_str());
224 LogDebug(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr);
225 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr).c_str());
226 if(!wheelDir) wheelDir = baseDir->mkdir((
"Wheel" + wheelStr).c_str());
227 LogDebug(
"Calibration") <<
"Accessing " << (
"Station" + stationStr);
228 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr).c_str());
229 if(!stationDir) stationDir = wheelDir->mkdir((
"Station" + stationStr).c_str());
230 LogDebug(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr);
231 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr).c_str());
232 if(!sectorDir) sectorDir = stationDir->mkdir((
"Sector" + sectorStr).c_str());
237 TH1F* histosTH1F =
new TH1F((
"hResDist"+slHistoName).c_str(),
238 "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)",
251 LogDebug(
"Calibration") <<
"[DTResidualCalibration] Booking histos for layer: " << layerId;
263 "_STEP" + std::to_string(step) +
267 "_SL" + superLayerStr +
273 LogDebug(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr);
274 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr).c_str());
275 if(!wheelDir) wheelDir = baseDir->mkdir((
"Wheel" + wheelStr).c_str());
276 LogDebug(
"Calibration") <<
"Accessing " << (
"Station" + stationStr);
277 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr).c_str());
278 if(!stationDir) stationDir = wheelDir->mkdir((
"Station" + stationStr).c_str());
279 LogDebug(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr);
280 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr).c_str());
281 if(!sectorDir) sectorDir = stationDir->mkdir((
"Sector" + sectorStr).c_str());
282 LogDebug(
"Calibration") <<
"Accessing " << (
"SL" + superLayerStr);
283 TDirectory* superLayerDir = sectorDir->GetDirectory((
"SL" + superLayerStr).c_str());
284 if(!superLayerDir) superLayerDir = sectorDir->mkdir((
"SL" + superLayerStr).c_str());
288 TH1F* histosTH1F =
new TH1F((
"hResDist"+layerHistoName).c_str(),
289 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
291 TH2F* histosTH2F =
new TH2F((
"hResDistVsDist"+layerHistoName).c_str(),
292 "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
301 float residualOnDistance) {
309 float residualOnDistance) {
std::map< DTSuperLayerId, TH1F * > histoMapTH1F_
LocalPoint localPosition() const override
Return the 3-dimensional local position.
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.
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
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
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.
def setup(process, global_tag, zero_tesla=False)
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.
std::map< DTLayerId, TH1F * > histoMapPerLayerTH1F_
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)
std::map< DTSuperLayerId, TH2F * > histoMapTH2F_
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.
std::map< DTLayerId, TH2F * > histoMapPerLayerTH2F_
~DTResidualCalibration() override
Destructor.
int wire() const
Return the wire number.
int superlayer() const
Return the superlayer number (deprecated method name)
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)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
T const * product() const
DTWireId wireId() const
Return the wireId.