CMS 3D CMS Logo

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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

Definition at line 28 of file DTResidualCalibration.h.

Constructor & Destructor Documentation

Constructor.

Definition at line 34 of file DTResidualCalibration.cc.

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

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

Destructor.

Definition at line 47 of file DTResidualCalibration.cc.

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

Member Function Documentation

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

Definition at line 86 of file DTResidualCalibration.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file DTResidualCalibration.cc.

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

Definition at line 55 of file DTResidualCalibration.cc.

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

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

Definition at line 193 of file DTResidualCalibration.cc.

References histoMapTH1F_, histoMapTH2F_, rootBaseDir_, rootFile_, DTChamberId::sector(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

Referenced by beginRun().

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

Definition at line 249 of file DTResidualCalibration.cc.

References histoMapPerLayerTH1F_, histoMapPerLayerTH2F_, DTLayerId::layer(), rootBaseDir_, rootFile_, DTChamberId::sector(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 172 of file DTResidualCalibration.cc.

References rootFile_.

Referenced by o2olib.O2ORunMgr::executeJob().

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

Definition at line 304 of file DTResidualCalibration.cc.

References histoMapTH1F_, and histoMapTH2F_.

Referenced by analyze().

306  {
307  std::vector<TH1F*> const& histosTH1F = histoMapTH1F_[slId];
308  std::vector<TH2F*> const& histosTH2F = histoMapTH2F_[slId];
309  histosTH1F[0]->Fill(residualOnDistance);
310  histosTH2F[0]->Fill(distance, residualOnDistance);
311 }
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 314 of file DTResidualCalibration.cc.

References histoMapPerLayerTH1F_, and histoMapPerLayerTH2F_.

316  {
317  std::vector<TH1F*> const& histosTH1F = histoMapPerLayerTH1F_[layerId];
318  std::vector<TH2F*> const& histosTH2F = histoMapPerLayerTH2F_[layerId];
319  histosTH1F[0]->Fill(residualOnDistance);
320  histosTH2F[0]->Fill(distance, residualOnDistance);
321 }
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 145 of file DTResidualCalibration.cc.

References relativeConstraints::chamber, 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().

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

Member Data Documentation

bool DTResidualCalibration::detailedAnalysis_
private

Definition at line 55 of file DTResidualCalibration.h.

Referenced by analyze(), and beginRun().

const DTGeometry* DTResidualCalibration::dtGeom_
private

Definition at line 58 of file DTResidualCalibration.h.

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

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

Definition at line 63 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

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

Definition at line 64 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

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

Definition at line 60 of file DTResidualCalibration.h.

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

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

Definition at line 61 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

std::string DTResidualCalibration::rootBaseDir_
private

Definition at line 53 of file DTResidualCalibration.h.

Referenced by bookHistos().

TFile* DTResidualCalibration::rootFile_
private

Definition at line 56 of file DTResidualCalibration.h.

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

edm::InputTag DTResidualCalibration::segment4DLabel_
private

Definition at line 52 of file DTResidualCalibration.h.

Referenced by analyze().

DTSegmentSelector DTResidualCalibration::select_
private

Definition at line 51 of file DTResidualCalibration.h.

Referenced by analyze().