CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
DTResidualCalibration Class Reference

#include <DTResidualCalibration.h>

Inheritance diagram for DTResidualCalibration:
edm::EDAnalyzer edm::EDConsumerBase

Classes

class  DTResidualCalibration
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
void beginJob ()
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
 DTResidualCalibration (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
virtual ~DTResidualCalibration ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void bookHistos (DTSuperLayerId slId)
 
void bookHistos (DTLayerId slId)
 
void fillHistos (DTSuperLayerId slId, float distance, float residualOnDistance)
 
void fillHistos (DTLayerId slId, float distance, float residualOnDistance)
 
float segmentToWireDistance (const DTRecHit1D &recHit1D, const DTRecSegment4D &segment)
 

Private Attributes

bool detailedAnalysis_
 
const DTGeometrydtGeom_
 
std::map< DTLayerId,
std::vector< TH1F * > > 
histoMapPerLayerTH1F_
 
std::map< DTLayerId,
std::vector< TH2F * > > 
histoMapPerLayerTH2F_
 
std::map< DTSuperLayerId,
std::vector< TH1F * > > 
histoMapTH1F_
 
std::map< DTSuperLayerId,
std::vector< TH2F * > > 
histoMapTH2F_
 
std::string rootBaseDir_
 
TFile * rootFile_
 
edm::InputTag segment4DLabel_
 
DTSegmentSelector select_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Extracts DT segment residuals

Date:
2012/02/01 17:25:58
Revision:
1.2

Definition at line 30 of file DTResidualCalibration.h.

Constructor & Destructor Documentation

Constructor.

Definition at line 36 of file DTResidualCalibration.cc.

References edm::ParameterSet::getUntrackedParameter(), rootFile_, dtT0Analyzer_cfg::rootFileName, and AlCaHLTBitMon_QueryRunRegistry::string.

36  :
37  select_(pset),
38  segment4DLabel_(pset.getParameter<edm::InputTag>("segment4DLabel")),
39  rootBaseDir_(pset.getUntrackedParameter<std::string>("rootBaseDir","DT/Residuals")),
40  detailedAnalysis_(pset.getUntrackedParameter<bool>("detailedAnalysis",false)) {
41 
42  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Constructor called.";
43 
44  std::string rootFileName = pset.getUntrackedParameter<std::string>("rootFileName","residuals.root");
45  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
46  rootFile_->cd();
47 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTResidualCalibration::~DTResidualCalibration ( )
virtual

Destructor.

Definition at line 49 of file DTResidualCalibration.cc.

49  {
50  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Destructor called.";
51 }

Member Function Documentation

void DTResidualCalibration::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 88 of file DTResidualCalibration.cc.

References DTGeometry::chamber(), DTRecHitSegmentResidual::compute(), filterCSVwithJSON::copy, detailedAnalysis_, dtGeom_, fillHistos(), DTWireId::layerId(), LogTrace, rootFile_, segment4DLabel_, segmentToWireDistance(), select_, DTRecSegment2D::specificRecHits(), DTLayerId::superlayerId(), and GeomDet::toGlobal().

88  {
89  rootFile_->cd();
90 
91  // Get the 4D rechits from the event
93  event.getByLabel(segment4DLabel_, segment4Ds);
94 
95  // Loop over segments by chamber
97  for(chamberIdIt = segment4Ds->id_begin(); chamberIdIt != segment4Ds->id_end(); ++chamberIdIt){
98 
99  const DTChamber* chamber = dtGeom_->chamber(*chamberIdIt);
100 
101  // Get the range for the corresponding ChamberId
102  DTRecSegment4DCollection::range range = segment4Ds->get((*chamberIdIt));
103  // Loop over the rechits of this DetUnit
104  for(DTRecSegment4DCollection::const_iterator segment = range.first;
105  segment != range.second; ++segment){
106 
107  LogTrace("Calibration") << "Segment local pos (in chamber RF): " << (*segment).localPosition()
108  << "\nSegment global pos: " << chamber->toGlobal((*segment).localPosition());
109 
110  if( !select_(*segment, event, setup) ) continue;
111 
112  // Get all 1D RecHits at step 3 within the 4D segment
113  std::vector<DTRecHit1D> recHits1D_S3;
114 
115  if( (*segment).hasPhi() ){
116  const DTChamberRecSegment2D* phiSeg = (*segment).phiSegment();
117  const std::vector<DTRecHit1D>& phiRecHits = phiSeg->specificRecHits();
118  std::copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
119  }
120 
121  if( (*segment).hasZed() ){
122  const DTSLRecSegment2D* zSeg = (*segment).zSegment();
123  const std::vector<DTRecHit1D>& zRecHits = zSeg->specificRecHits();
124  std::copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
125  }
126 
127  // Loop over 1D RecHit inside 4D segment
128  for(std::vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
129  recHit1D != recHits1D_S3.end(); ++recHit1D) {
130  const DTWireId wireId = recHit1D->wireId();
131 
132  float segmDistance = segmentToWireDistance(*recHit1D,*segment);
133  if(segmDistance > 2.1) LogTrace("Calibration") << "WARNING: segment-wire distance: " << segmDistance;
134  else LogTrace("Calibration") << "segment-wire distance: " << segmDistance;
135 
136  float residualOnDistance = DTRecHitSegmentResidual().compute(dtGeom_,*recHit1D,*segment);
137  LogTrace("Calibration") << "Wire Id " << wireId << " residual on distance: " << residualOnDistance;
138 
139  fillHistos(wireId.superlayerId(), segmDistance, residualOnDistance);
140  if(detailedAnalysis_) fillHistos(wireId.layerId(), segmDistance, residualOnDistance);
141  }
142  }
143  }
144 
145 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:52
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
identifier iterator
Definition: RangeMap.h:138
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
#define LogTrace(id)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
float compute(const DTGeometry *, const DTRecHit1D &, const DTRecSegment4D &)
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:102
const DTGeometry * dtGeom_
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
float segmentToWireDistance(const DTRecHit1D &recHit1D, const DTRecSegment4D &segment)
void DTResidualCalibration::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file DTResidualCalibration.cc.

53  {
54  TH1::SetDefaultSumw2(true);
55 }
void DTResidualCalibration::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file DTResidualCalibration.cc.

References bookHistos(), DTGeometry::chambers(), detailedAnalysis_, dtGeom_, edm::EventSetup::get(), histoMapTH1F_, and edm::ESHandle< class >::product().

57  {
58 
59  // get the geometry
61  setup.get<MuonGeometryRecord>().get(dtGeomH);
62  dtGeom_ = dtGeomH.product();
63 
64  // Loop over all the chambers
65  if(histoMapTH1F_.size() == 0) {
66  std::vector<DTChamber*>::const_iterator ch_it = dtGeom_->chambers().begin();
67  std::vector<DTChamber*>::const_iterator ch_end = dtGeom_->chambers().end();
68  for (; ch_it != ch_end; ++ch_it) {
69  std::vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
70  std::vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
71  // Loop over the SLs
72  for(; sl_it != sl_end; ++sl_it) {
73  DTSuperLayerId slId = (*sl_it)->id();
74  bookHistos(slId);
75  if(detailedAnalysis_) {
76  std::vector<const DTLayer*>::const_iterator layer_it = (*sl_it)->layers().begin();
77  std::vector<const DTLayer*>::const_iterator layer_end = (*sl_it)->layers().end();
78  for(; layer_it != layer_end; ++layer_it) {
79  DTLayerId layerId = (*layer_it)->id();
80  bookHistos(layerId);
81  }
82  }
83  }
84  }
85  }
86 }
void bookHistos(DTSuperLayerId slId)
std::map< DTSuperLayerId, std::vector< TH1F * > > histoMapTH1F_
const std::vector< DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:87
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
const DTGeometry * dtGeom_
void DTResidualCalibration::bookHistos ( DTSuperLayerId  slId)
private

Definition at line 195 of file DTResidualCalibration.cc.

References histoMapTH1F_, histoMapTH2F_, rootBaseDir_, rootFile_, DTChamberId::sector(), mergeVDriftHistosByStation::sectorStr, DTChamberId::station(), mergeVDriftHistosByStation::stationStr, relval_parameters_module::step, AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), DTChamberId::wheel(), and mergeVDriftHistosByStation::wheelStr.

Referenced by beginRun().

195  {
196  TH1AddDirectorySentry addDir;
197  rootFile_->cd();
198 
199  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Booking histos for SL: " << slId;
200 
201  // Compose the chamber name
202  std::stringstream wheelStr; wheelStr << slId.wheel();
203  std::stringstream stationStr; stationStr << slId.station();
204  std::stringstream sectorStr; sectorStr << slId.sector();
205  std::stringstream superLayerStr; superLayerStr << slId.superlayer();
206  // Define the step
207  int step = 3;
208  std::stringstream stepStr; stepStr << step;
209 
210  std::string slHistoName =
211  "_STEP" + stepStr.str() +
212  "_W" + wheelStr.str() +
213  "_St" + stationStr.str() +
214  "_Sec" + sectorStr.str() +
215  "_SL" + superLayerStr.str();
216 
217  edm::LogVerbatim("Calibration") << "Accessing " << rootBaseDir_;
218  TDirectory* baseDir = rootFile_->GetDirectory(rootBaseDir_.c_str());
219  if(!baseDir) baseDir = rootFile_->mkdir(rootBaseDir_.c_str());
220  edm::LogVerbatim("Calibration") << "Accessing " << ("Wheel" + wheelStr.str());
221  TDirectory* wheelDir = baseDir->GetDirectory(("Wheel" + wheelStr.str()).c_str());
222  if(!wheelDir) wheelDir = baseDir->mkdir(("Wheel" + wheelStr.str()).c_str());
223  edm::LogVerbatim("Calibration") << "Accessing " << ("Station" + stationStr.str());
224  TDirectory* stationDir = wheelDir->GetDirectory(("Station" + stationStr.str()).c_str());
225  if(!stationDir) stationDir = wheelDir->mkdir(("Station" + stationStr.str()).c_str());
226  edm::LogVerbatim("Calibration") << "Accessing " << ("Sector" + sectorStr.str());
227  TDirectory* sectorDir = stationDir->GetDirectory(("Sector" + sectorStr.str()).c_str());
228  if(!sectorDir) sectorDir = stationDir->mkdir(("Sector" + sectorStr.str()).c_str());
229 
230  /*std::string dirName = rootBaseDir_ + "/Wheel" + wheelStr.str() +
231  "/Station" + stationStr.str() +
232  "/Sector" + sectorStr.str();
233 
234  TDirectory* dir = rootFile_->GetDirectory(dirName.c_str());
235  if(!dir) dir = rootFile_->mkdir(dirName.c_str());
236  dir->cd();*/
237  sectorDir->cd();
238  // Create the monitor elements
239  std::vector<TH1F*> histosTH1F;
240  histosTH1F.push_back(new TH1F(("hResDist"+slHistoName).c_str(),
241  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
242  200, -0.4, 0.4));
243  std::vector<TH2F*> histosTH2F;
244  histosTH2F.push_back(new TH2F(("hResDistVsDist"+slHistoName).c_str(),
245  "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
246  100, 0, 2.5, 200, -0.4, 0.4));
247  histoMapTH1F_[slId] = histosTH1F;
248  histoMapTH2F_[slId] = histosTH2F;
249 }
std::map< DTSuperLayerId, std::vector< TH1F * > > histoMapTH1F_
std::map< DTSuperLayerId, std::vector< TH2F * > > histoMapTH2F_
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
void DTResidualCalibration::bookHistos ( DTLayerId  slId)
private

Definition at line 251 of file DTResidualCalibration.cc.

References histoMapPerLayerTH1F_, histoMapPerLayerTH2F_, DTLayerId::layer(), rootBaseDir_, rootFile_, DTChamberId::sector(), mergeVDriftHistosByStation::sectorStr, DTChamberId::station(), mergeVDriftHistosByStation::stationStr, relval_parameters_module::step, AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), DTChamberId::wheel(), and mergeVDriftHistosByStation::wheelStr.

251  {
252  TH1AddDirectorySentry addDir;
253  rootFile_->cd();
254 
255  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Booking histos for layer: " << layerId;
256 
257  // Compose the chamber name
258  std::stringstream wheelStr; wheelStr << layerId.wheel();
259  std::stringstream stationStr; stationStr << layerId.station();
260  std::stringstream sectorStr; sectorStr << layerId.sector();
261  std::stringstream superLayerStr; superLayerStr << layerId.superlayer();
262  std::stringstream layerStr; layerStr << layerId.layer();
263  // Define the step
264  int step = 3;
265  std::stringstream stepStr; stepStr << step;
266 
267  std::string layerHistoName =
268  "_STEP" + stepStr.str() +
269  "_W" + wheelStr.str() +
270  "_St" + stationStr.str() +
271  "_Sec" + sectorStr.str() +
272  "_SL" + superLayerStr.str() +
273  "_Layer" + layerStr.str();
274 
275  edm::LogVerbatim("Calibration") << "Accessing " << rootBaseDir_;
276  TDirectory* baseDir = rootFile_->GetDirectory(rootBaseDir_.c_str());
277  if(!baseDir) baseDir = rootFile_->mkdir(rootBaseDir_.c_str());
278  edm::LogVerbatim("Calibration") << "Accessing " << ("Wheel" + wheelStr.str());
279  TDirectory* wheelDir = baseDir->GetDirectory(("Wheel" + wheelStr.str()).c_str());
280  if(!wheelDir) wheelDir = baseDir->mkdir(("Wheel" + wheelStr.str()).c_str());
281  edm::LogVerbatim("Calibration") << "Accessing " << ("Station" + stationStr.str());
282  TDirectory* stationDir = wheelDir->GetDirectory(("Station" + stationStr.str()).c_str());
283  if(!stationDir) stationDir = wheelDir->mkdir(("Station" + stationStr.str()).c_str());
284  edm::LogVerbatim("Calibration") << "Accessing " << ("Sector" + sectorStr.str());
285  TDirectory* sectorDir = stationDir->GetDirectory(("Sector" + sectorStr.str()).c_str());
286  if(!sectorDir) sectorDir = stationDir->mkdir(("Sector" + sectorStr.str()).c_str());
287  edm::LogVerbatim("Calibration") << "Accessing " << ("SL" + superLayerStr.str());
288  TDirectory* superLayerDir = sectorDir->GetDirectory(("SL" + superLayerStr.str()).c_str());
289  if(!superLayerDir) superLayerDir = sectorDir->mkdir(("SL" + superLayerStr.str()).c_str());
290 
291  superLayerDir->cd();
292  // Create histograms
293  std::vector<TH1F*> histosTH1F;
294  histosTH1F.push_back(new TH1F(("hResDist"+layerHistoName).c_str(),
295  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
296  200, -0.4, 0.4));
297  std::vector<TH2F*> histosTH2F;
298  histosTH2F.push_back(new TH2F(("hResDistVsDist"+layerHistoName).c_str(),
299  "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
300  100, 0, 2.5, 200, -0.4, 0.4));
301  histoMapPerLayerTH1F_[layerId] = histosTH1F;
302  histoMapPerLayerTH2F_[layerId] = histosTH2F;
303 }
std::map< DTLayerId, std::vector< TH1F * > > histoMapPerLayerTH1F_
std::map< DTLayerId, std::vector< TH2F * > > histoMapPerLayerTH2F_
void DTResidualCalibration::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 174 of file DTResidualCalibration.cc.

References rootFile_.

174  {
175 
176  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Writing histos to file.";
177  rootFile_->cd();
178  rootFile_->Write();
179  rootFile_->Close();
180 
181  /*std::map<DTSuperLayerId, std::vector<TH1F*> >::const_iterator itSlHistos = histoMapTH1F_.begin();
182  std::map<DTSuperLayerId, std::vector<TH1F*> >::const_iterator itSlHistos_end = histoMapTH1F_.end();
183  for(; itSlHistos != itSlHistos_end; ++itSlHistos){
184  std::vector<TH1F*>::const_iterator itHistTH1F = (*itSlHistos).second.begin();
185  std::vector<TH1F*>::const_iterator itHistTH1F_end = (*itSlHistos).second.end();
186  for(; itHistTH1F != itHistTH1F_end; ++itHistTH1F) (*itHistTH1F)->Write();
187 
188  std::vector<TH2F*>::const_iterator itHistTH2F = histoMapTH2F_[(*itSlHistos).first].begin();
189  std::vector<TH2F*>::const_iterator itHistTH2F_end = histoMapTH2F_[(*itSlHistos).first].end();
190  for(; itHistTH2F != itHistTH2F_end; ++itHistTH2F) (*itHistTH2F)->Write();
191  }*/
192 
193 }
void DTResidualCalibration::fillHistos ( DTSuperLayerId  slId,
float  distance,
float  residualOnDistance 
)
private

Definition at line 306 of file DTResidualCalibration.cc.

References histoMapTH1F_, and histoMapTH2F_.

Referenced by analyze().

308  {
309  std::vector<TH1F*> const& histosTH1F = histoMapTH1F_[slId];
310  std::vector<TH2F*> const& histosTH2F = histoMapTH2F_[slId];
311  histosTH1F[0]->Fill(residualOnDistance);
312  histosTH2F[0]->Fill(distance, residualOnDistance);
313 }
std::map< DTSuperLayerId, std::vector< TH1F * > > histoMapTH1F_
std::map< DTSuperLayerId, std::vector< TH2F * > > histoMapTH2F_
void DTResidualCalibration::fillHistos ( DTLayerId  slId,
float  distance,
float  residualOnDistance 
)
private

Definition at line 316 of file DTResidualCalibration.cc.

References histoMapPerLayerTH1F_, and histoMapPerLayerTH2F_.

318  {
319  std::vector<TH1F*> const& histosTH1F = histoMapPerLayerTH1F_[layerId];
320  std::vector<TH2F*> const& histosTH2F = histoMapPerLayerTH2F_[layerId];
321  histosTH1F[0]->Fill(residualOnDistance);
322  histosTH2F[0]->Fill(distance, residualOnDistance);
323 }
std::map< DTLayerId, std::vector< TH1F * > > histoMapPerLayerTH1F_
std::map< DTLayerId, std::vector< TH2F * > > histoMapPerLayerTH2F_
float DTResidualCalibration::segmentToWireDistance ( const DTRecHit1D recHit1D,
const DTRecSegment4D segment 
)
private

Definition at line 147 of file DTResidualCalibration.cc.

References DTGeometry::chamber(), DTSuperLayerId::chamberId(), funct::cos(), dtGeom_, DTGeometry::layer(), DTWireId::layerId(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), DTRecHit1D::localPosition(), DTLayer::specificTopology(), DTSuperLayerId::superlayer(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTRecHit1D::wireId(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

147  {
148 
149  // Get the layer and the wire position
150  const DTWireId wireId = recHit1D.wireId();
151  const DTLayer* layer = dtGeom_->layer(wireId);
152  float wireX = layer->specificTopology().wirePosition(wireId.wire());
153 
154  // Extrapolate the segment to the z of the wire
155  // Get wire position in chamber RF
156  // (y and z must be those of the hit to be coherent in the transf. of RF in case of rotations of the layer alignment)
157  LocalPoint wirePosInLay(wireX,recHit1D.localPosition().y(),recHit1D.localPosition().z());
158  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
159  const DTChamber* chamber = dtGeom_->chamber(wireId.layerId().chamberId());
160  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
161 
162  // Segment position at Wire z in chamber local frame
163  LocalPoint segPosAtZWire = segment.localPosition() + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
164 
165  // Compute the distance of the segment from the wire
166  int sl = wireId.superlayer();
167  float segmDistance = -1;
168  if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
169  else if(sl == 2) segmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
170 
171  return segmDistance;
172 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
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.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:112
virtual LocalVector localDirection() const
Local direction in Chamber frame.
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual LocalPoint localPosition() const
Local position in Chamber frame.
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
int wire() const
Return the wire number.
Definition: DTWireId.h:58
int superlayer() const
Return the superlayer number (deprecated method name)
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:102
const DTGeometry * dtGeom_
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
T x() const
Definition: PV3DBase.h:62
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109

Member Data Documentation

bool DTResidualCalibration::detailedAnalysis_
private

Definition at line 57 of file DTResidualCalibration.h.

Referenced by analyze(), and beginRun().

const DTGeometry* DTResidualCalibration::dtGeom_
private

Definition at line 60 of file DTResidualCalibration.h.

Referenced by analyze(), beginRun(), and segmentToWireDistance().

std::map<DTLayerId, std::vector<TH1F*> > DTResidualCalibration::histoMapPerLayerTH1F_
private

Definition at line 65 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

std::map<DTLayerId, std::vector<TH2F*> > DTResidualCalibration::histoMapPerLayerTH2F_
private

Definition at line 66 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

std::map<DTSuperLayerId, std::vector<TH1F*> > DTResidualCalibration::histoMapTH1F_
private

Definition at line 62 of file DTResidualCalibration.h.

Referenced by beginRun(), bookHistos(), and fillHistos().

std::map<DTSuperLayerId, std::vector<TH2F*> > DTResidualCalibration::histoMapTH2F_
private

Definition at line 63 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

std::string DTResidualCalibration::rootBaseDir_
private

Definition at line 55 of file DTResidualCalibration.h.

Referenced by bookHistos().

TFile* DTResidualCalibration::rootFile_
private

Definition at line 58 of file DTResidualCalibration.h.

Referenced by analyze(), bookHistos(), DTResidualCalibration(), and endJob().

edm::InputTag DTResidualCalibration::segment4DLabel_
private

Definition at line 54 of file DTResidualCalibration.h.

Referenced by analyze().

DTSegmentSelector DTResidualCalibration::select_
private

Definition at line 53 of file DTResidualCalibration.h.

Referenced by analyze().