Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:26

0001 /** \file
0002  *
0003  *  \author R. Bellan  - INFN Torino
0004  */
0005 
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "Geometry/DTGeometry/interface/DTTopology.h"
0008 #include <FWCore/Utilities/interface/Exception.h>
0009 
0010 #include <iostream>
0011 //#define EDM_ML_DEBUG
0012 
0013 // FIXME now put by hand, check the number!
0014 
0015 const float DTTopology::theWidth = 4.2;   // cm
0016 const float DTTopology::theHeight = 1.3;  // cm ...
0017 
0018 const float DTTopology::IBeamWingThickness = 0.13;  // cm
0019 const float DTTopology::IBeamWingLength = 0.635;    // cm
0020 
0021 const float DTTopology::plateThickness = 0.15;  // aluminium plate:  1.5 mm
0022 const float DTTopology::IBeamThickness = 0.13;  // I-beam thickness: 1.3 mm
0023 
0024 DTTopology::DTTopology(int firstWire, int nChannels, float semilenght)
0025     : theFirstChannel(firstWire), theNChannels(nChannels), theLength(semilenght * 2) {
0026   theOffSet = Local2DPoint(-theNChannels / 2. * theWidth, -theLength / 2.);
0027 
0028 #ifdef EDM_ML_DEBUG
0029   edm::LogVerbatim("DTGeometry") << "Constructing DTTopology with:" << std::endl
0030                                  << "number of wires = " << theNChannels << ", first wire number = " << theFirstChannel
0031                                  << std::endl
0032                                  << ", width = " << theWidth << ", height = " << theHeight
0033                                  << ", length = " << theLength;
0034 #endif
0035 }
0036 
0037 float DTTopology::sensibleWidth() const { return theWidth - IBeamThickness; }
0038 
0039 float DTTopology::sensibleHeight() const { return theHeight - plateThickness; }
0040 
0041 LocalPoint DTTopology::localPosition(const MeasurementPoint& mp) const {
0042   return LocalPoint((mp.x() - theFirstChannel) * theWidth + theOffSet.x(), (1 - mp.y()) * theLength + theOffSet.y());
0043 }
0044 
0045 LocalError DTTopology::localError(const MeasurementPoint& /*mp*/, const MeasurementError& me) const {
0046   return LocalError(me.uu() * (theWidth * theWidth), 0, me.vv() * (theLength * theLength));
0047 }
0048 
0049 MeasurementPoint DTTopology::measurementPosition(const LocalPoint& lp) const {
0050   return MeasurementPoint(static_cast<int>((lp.x() - theOffSet.x()) / theWidth + theFirstChannel),
0051                           1 - (lp.y() - theOffSet.y()) / theLength);
0052 }
0053 
0054 MeasurementError DTTopology::measurementError(const LocalPoint& /*lp*/, const LocalError& le) const {
0055   return MeasurementError(le.xx() / (theWidth * theWidth), 0, le.yy() / (theLength * theLength));
0056 }
0057 
0058 int DTTopology::channel(const LocalPoint& lp) const {
0059   return static_cast<int>((lp.x() - theOffSet.x()) / theWidth + theFirstChannel);
0060 }
0061 
0062 // return the x wire position in the layer, starting from its wire number.
0063 float DTTopology::wirePosition(int wireNumber) const {
0064   if (!isWireValid(wireNumber))  //- (theFirstChannel-1) <= 0. || wireNumber > lastChannel() )
0065     throw cms::Exception("InvalidWireNumber")
0066         << "DTTopology::wirePosition:"
0067         << " Requested wire number: " << wireNumber << " ,but the first wire number is " << theFirstChannel
0068         << " and the last wire number is " << lastChannel() << std::endl;
0069   else
0070     return (wireNumber - (theFirstChannel - 1) - 0.5) * theWidth + theOffSet.x();
0071 }
0072 
0073 /*
0074 // return the x wire position in the layer r.f., starting from its wire number.
0075 float DTTopology::wirePosition(int wireNumber) const{
0076   int layerCoord = theNChannels - wireNumber + theFirstChannel;
0077   return  (layerCoord - 0.5)*theWidth + theOffSet.x();
0078 }
0079 */
0080 
0081 //New cell geometry
0082 DTTopology::Side DTTopology::onWhichBorder(float x, float /*y*/, float z) const {
0083   // epsilon = Tolerance to determine if a hit starts/ends on the cell border.
0084   // Current value comes from CMSIM, where hit position is
0085   // always ~10um far from surface. For OSCAR the discrepancy is < 1um.
0086   const float epsilon = 0.0015;  // 15 um
0087 
0088   // with new geometry the cell shape is not rectangular, but is a
0089   // rectangular with the I-beam "Wing" subtracted.
0090   // The height of the Wing is 1.0 mm and the length is 6.35 mm: these 4
0091   // volumens must be taken into account when the border is computed
0092 
0093   Side side = none;
0094 
0095   if (fabs(z) > (sensibleHeight() / 2. - epsilon) ||
0096       (fabs(x) > (sensibleWidth() / 2. - IBeamWingLength - epsilon) &&
0097        fabs(z) > (sensibleHeight() / 2. - IBeamWingThickness - epsilon))) {  //FIXME
0098 
0099     if (z > 0.)
0100       side = zMax;  // This is currently the INNER surface.
0101     else
0102       side = zMin;
0103   }
0104 
0105   else if (fabs(x) > (sensibleWidth() / 2. - epsilon)) {
0106     if (x > 0.)
0107       side = xMax;
0108     else
0109       side = xMin;
0110   }  // FIXME: else if ymax, ymin...
0111 
0112   return side;
0113 }
0114 
0115 //Old geometry of the DT
0116 DTTopology::Side DTTopology::onWhichBorder_old(float x, float /*y*/, float z) const {
0117   // epsilon = Tolerance to determine if a hit starts/ends on the cell border.
0118   // Current value comes from CMSIM, where hit position is
0119   // always ~10um far from surface. For OSCAR the discrepancy is < 1um.
0120   const float epsilon = 0.0015;  // 15 um
0121 
0122   Side side = none;
0123 
0124   if (fabs(z) > (sensibleHeight() / 2. - epsilon)) {
0125     if (z > 0.) {
0126       side = zMax;  // This is currently the INNER surface.
0127     } else {
0128       side = zMin;
0129     }
0130   } else if (fabs(x) > (sensibleWidth() / 2. - epsilon)) {
0131     if (x > 0.) {
0132       side = xMax;
0133     } else {
0134       side = xMin;
0135     }
0136   }  // FIXME: else if ymax, ymin...
0137 
0138   return side;
0139 }