Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:08

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author M. Maggi -- INFN Bari
0005  */
0006 
0007 #include "DataFormats/RPCRecHit/interface/RPCRecHit.h"
0008 
0009 RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx)
0010     : RecHit2DLocalPos(rpcId),
0011       theRPCId(rpcId),
0012       theBx(bx),
0013       theFirstStrip(99),
0014       theClusterSize(99),
0015       theLocalPosition(),
0016       theLocalError(),
0017       theTime(0),
0018       theTimeError(-1) {}
0019 
0020 RPCRecHit::RPCRecHit()
0021     : RecHit2DLocalPos(),
0022       theRPCId(),
0023       theBx(99),
0024       theFirstStrip(99),
0025       theClusterSize(99),
0026       theLocalPosition(),
0027       theLocalError(),
0028       theTime(0),
0029       theTimeError(-1) {}
0030 
0031 RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos)
0032     : RecHit2DLocalPos(rpcId),
0033       theRPCId(rpcId),
0034       theBx(bx),
0035       theFirstStrip(99),
0036       theClusterSize(99),
0037       theLocalPosition(pos),
0038       theTime(0),
0039       theTimeError(-1) {
0040   float stripResolution = 3.0;  //cm  this sould be taken from trimmed cluster size times strip size
0041                                 //    taken out from geometry service i.e. topology
0042   theLocalError = LocalError(stripResolution * stripResolution, 0., 0.);  //FIXME: is it really needed?
0043 }
0044 
0045 // Constructor from a local position and error, wireId and digi time.
0046 RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err)
0047     : RecHit2DLocalPos(rpcId),
0048       theRPCId(rpcId),
0049       theBx(bx),
0050       theFirstStrip(99),
0051       theClusterSize(99),
0052       theLocalPosition(pos),
0053       theLocalError(err),
0054       theTime(0),
0055       theTimeError(-1) {}
0056 
0057 // Constructor from a local position and error, wireId, bx and cluster size.
0058 RPCRecHit::RPCRecHit(
0059     const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err)
0060     : RecHit2DLocalPos(rpcId),
0061       theRPCId(rpcId),
0062       theBx(bx),
0063       theFirstStrip(firstStrip),
0064       theClusterSize(clustSize),
0065       theLocalPosition(pos),
0066       theLocalError(err),
0067       theTime(0),
0068       theTimeError(-1) {}
0069 
0070 // Destructor
0071 RPCRecHit::~RPCRecHit() {}
0072 
0073 RPCRecHit* RPCRecHit::clone() const { return new RPCRecHit(*this); }
0074 
0075 // Access to component RecHits.
0076 // No components rechits: it returns a null vector
0077 std::vector<const TrackingRecHit*> RPCRecHit::recHits() const {
0078   std::vector<const TrackingRecHit*> nullvector;
0079   return nullvector;
0080 }
0081 
0082 // Non-const access to component RecHits.
0083 // No components rechits: it returns a null vector
0084 std::vector<TrackingRecHit*> RPCRecHit::recHits() {
0085   std::vector<TrackingRecHit*> nullvector;
0086   return nullvector;
0087 }
0088 
0089 // Comparison operator, based on the wireId and the digi time
0090 bool RPCRecHit::operator==(const RPCRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); }
0091 
0092 // The ostream operator
0093 std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit) {
0094   os << "pos: " << hit.localPosition().x();
0095   os << " +/- " << sqrt(hit.localPositionError().xx());
0096   return os;
0097 }