Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 66 additions & 63 deletions DataFormats/RPCRecHit/interface/RPCRecHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,89 +11,92 @@
#include "DataFormats/TrackingRecHit/interface/RecHit2DLocalPos.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"

class RPCRecHit : public RecHit2DLocalPos {
public:
RPCRecHit(const RPCDetId& rpcId, int bx);
namespace io_v1 {
class RPCRecHit : public RecHit2DLocalPos {
public:
RPCRecHit(const RPCDetId& rpcId, int bx);

/// Default constructor
RPCRecHit();
/// Default constructor
RPCRecHit();

/// Constructor from a local position, rpcId and digi time.
/// The 3-dimensional local error is defined as
/// resolution (the cell resolution) for the coordinate being measured
/// and 0 for the two other coordinates
RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos);
/// Constructor from a local position, rpcId and digi time.
/// The 3-dimensional local error is defined as
/// resolution (the cell resolution) for the coordinate being measured
/// and 0 for the two other coordinates
RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos);

/// Constructor from a local position and error, rpcId and bx.
RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err);
/// Constructor from a local position and error, rpcId and bx.
RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err);

/// Constructor from a local position and error, rpcId, bx, frist strip of cluster and cluster size.
RPCRecHit(const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err);
/// Constructor from a local position and error, rpcId, bx, frist strip of cluster and cluster size.
RPCRecHit(
const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err);

/// Destructor
~RPCRecHit() override;
/// Destructor
~RPCRecHit() override;

/// Return the 3-dimensional local position
LocalPoint localPosition() const override { return theLocalPosition; }
/// Return the 3-dimensional local position
LocalPoint localPosition() const override { return theLocalPosition; }

/// Return the 3-dimensional error on the local position
LocalError localPositionError() const override { return theLocalError; }
/// Return the 3-dimensional error on the local position
LocalError localPositionError() const override { return theLocalError; }

RPCRecHit* clone() const override;
RPCRecHit* clone() const override;

/// Access to component RecHits.
/// No components rechits: it returns a null vector
std::vector<const TrackingRecHit*> recHits() const override;
/// Access to component RecHits.
/// No components rechits: it returns a null vector
std::vector<const TrackingRecHit*> recHits() const override;

/// Non-const access to component RecHits.
/// No components rechits: it returns a null vector
std::vector<TrackingRecHit*> recHits() override;
/// Non-const access to component RecHits.
/// No components rechits: it returns a null vector
std::vector<TrackingRecHit*> recHits() override;

/// Set local position
void setPosition(LocalPoint pos) { theLocalPosition = pos; }
/// Set local position
void setPosition(LocalPoint pos) { theLocalPosition = pos; }

/// Set local position error
void setError(LocalError err) { theLocalError = err; }
/// Set local position error
void setError(LocalError err) { theLocalError = err; }

/// Set the local position and its error
void setPositionAndError(LocalPoint pos, LocalError err) {
theLocalPosition = pos;
theLocalError = err;
}
/// Set the local position and its error
void setPositionAndError(LocalPoint pos, LocalError err) {
theLocalPosition = pos;
theLocalError = err;
}

/// Set the time and its error
void setTimeAndError(float time, float err) {
theTime = time;
theTimeError = err;
}
/// Set the time and its error
void setTimeAndError(float time, float err) {
theTime = time;
theTimeError = err;
}

/// Return the rpcId
RPCDetId rpcId() const { return theRPCId; }
/// Return the rpcId
RPCDetId rpcId() const { return theRPCId; }

int BunchX() const { return theBx; }
int BunchX() const { return theBx; }

int firstClusterStrip() const { return theFirstStrip; }
int firstClusterStrip() const { return theFirstStrip; }

int clusterSize() const { return theClusterSize; }
int clusterSize() const { return theClusterSize; }

float time() const { return theTime; }
float time() const { return theTime; }

float timeError() const { return theTimeError; }
float timeError() const { return theTimeError; }

/// Comparison operator, based on the rpcId and the digi time
bool operator==(const RPCRecHit& hit) const;
/// Comparison operator, based on the rpcId and the digi time
bool operator==(const RPCRecHit& hit) const;

private:
RPCDetId theRPCId;
int theBx;
int theFirstStrip;
int theClusterSize;
// Position and error in the Local Ref. Frame of the RPCLayer
LocalPoint theLocalPosition;
LocalError theLocalError;
float theTime, theTimeError;
};
private:
RPCDetId theRPCId;
int theBx;
int theFirstStrip;
int theClusterSize;
// Position and error in the Local Ref. Frame of the RPCLayer
LocalPoint theLocalPosition;
LocalError theLocalError;
float theTime, theTimeError;
};
/// The ostream operator
std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit);
} // namespace io_v1
using RPCRecHit = io_v1::RPCRecHit;
#endif

/// The ostream operator
std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit);
6 changes: 4 additions & 2 deletions DataFormats/RPCRecHit/interface/RPCRecHitFwd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef DataFormats_RPCRecHit_RPCRecHitFwd_h
#define DataFormats_RPCRecHit_RPCRecHitFwd_h

class RPCRecHit;

namespace io_v1 {
class RPCRecHit;
}
using RPCRecHit = io_v1::RPCRecHit;
#endif
160 changes: 81 additions & 79 deletions DataFormats/RPCRecHit/src/RPCRecHit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,94 @@

#include "DataFormats/RPCRecHit/interface/RPCRecHit.h"

RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(),
theLocalError(),
theTime(0),
theTimeError(-1) {}
namespace io_v1 {
RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(),
theLocalError(),
theTime(0),
theTimeError(-1) {}

RPCRecHit::RPCRecHit()
: RecHit2DLocalPos(),
theRPCId(),
theBx(99),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(),
theLocalError(),
theTime(0),
theTimeError(-1) {}
RPCRecHit::RPCRecHit()
: RecHit2DLocalPos(),
theRPCId(),
theBx(99),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(),
theLocalError(),
theTime(0),
theTimeError(-1) {}

RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(pos),
theTime(0),
theTimeError(-1) {
float stripResolution = 3.0; //cm this sould be taken from trimmed cluster size times strip size
// taken out from geometry service i.e. topology
theLocalError = LocalError(stripResolution * stripResolution, 0., 0.); //FIXME: is it really needed?
}
RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(pos),
theTime(0),
theTimeError(-1) {
float stripResolution = 3.0; //cm this sould be taken from trimmed cluster size times strip size
// taken out from geometry service i.e. topology
theLocalError = LocalError(stripResolution * stripResolution, 0., 0.); //FIXME: is it really needed?
}

// Constructor from a local position and error, wireId and digi time.
RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(pos),
theLocalError(err),
theTime(0),
theTimeError(-1) {}
// Constructor from a local position and error, wireId and digi time.
RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(99),
theClusterSize(99),
theLocalPosition(pos),
theLocalError(err),
theTime(0),
theTimeError(-1) {}

// Constructor from a local position and error, wireId, bx and cluster size.
RPCRecHit::RPCRecHit(
const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(firstStrip),
theClusterSize(clustSize),
theLocalPosition(pos),
theLocalError(err),
theTime(0),
theTimeError(-1) {}
// Constructor from a local position and error, wireId, bx and cluster size.
RPCRecHit::RPCRecHit(
const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err)
: RecHit2DLocalPos(rpcId),
theRPCId(rpcId),
theBx(bx),
theFirstStrip(firstStrip),
theClusterSize(clustSize),
theLocalPosition(pos),
theLocalError(err),
theTime(0),
theTimeError(-1) {}

// Destructor
RPCRecHit::~RPCRecHit() {}
// Destructor
RPCRecHit::~RPCRecHit() {}

RPCRecHit* RPCRecHit::clone() const { return new RPCRecHit(*this); }
RPCRecHit* RPCRecHit::clone() const { return new RPCRecHit(*this); }

// Access to component RecHits.
// No components rechits: it returns a null vector
std::vector<const TrackingRecHit*> RPCRecHit::recHits() const {
std::vector<const TrackingRecHit*> nullvector;
return nullvector;
}
// Access to component RecHits.
// No components rechits: it returns a null vector
std::vector<const TrackingRecHit*> RPCRecHit::recHits() const {
std::vector<const TrackingRecHit*> nullvector;
return nullvector;
}

// Non-const access to component RecHits.
// No components rechits: it returns a null vector
std::vector<TrackingRecHit*> RPCRecHit::recHits() {
std::vector<TrackingRecHit*> nullvector;
return nullvector;
}
// Non-const access to component RecHits.
// No components rechits: it returns a null vector
std::vector<TrackingRecHit*> RPCRecHit::recHits() {
std::vector<TrackingRecHit*> nullvector;
return nullvector;
}

// Comparison operator, based on the wireId and the digi time
bool RPCRecHit::operator==(const RPCRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); }
// Comparison operator, based on the wireId and the digi time
bool RPCRecHit::operator==(const RPCRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); }

// The ostream operator
std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit) {
os << "pos: " << hit.localPosition().x();
os << " +/- " << sqrt(hit.localPositionError().xx());
return os;
}
// The ostream operator
std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit) {
os << "pos: " << hit.localPosition().x();
os << " +/- " << sqrt(hit.localPositionError().xx());
return os;
}
} // namespace io_v1
18 changes: 9 additions & 9 deletions DataFormats/RPCRecHit/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<lcgdict>
<selection>
<class name="RPCRecHit" splitLevel="0" ClassVersion="3">
<version ClassVersion="3" checksum="2736272161"/>
<class name="io_v1::RPCRecHit" splitLevel="0" ClassVersion="3">
<version ClassVersion="3" checksum="3050022817"/>
</class>
<class name="std::vector<RPCRecHit>" splitLevel="0"/>
<class name="std::vector<RPCRecHit*>" splitLevel="0"/>
<class name="std::vector<io_v1::RPCRecHit>" splitLevel="0"/>
<class name="std::vector<io_v1::RPCRecHit*>" splitLevel="0"/>
<class name="std::map<RPCDetId, std::pair<unsigned int, unsigned int> >" splitLevel="0"/>
<class name="std::map<RPCDetId, std::pair<unsigned long, unsigned long> >" splitLevel="0"/>
<class name="std::pair<RPCDetId, std::pair<unsigned int, unsigned int> >" splitLevel="0"/>
<class name="std::pair<RPCDetId, std::pair<unsigned long, unsigned long> >" splitLevel="0"/>
<class name="edm::OwnVector<RPCRecHit, edm::ClonePolicy<RPCRecHit> >" splitLevel="0" rntupleStreamerMode="true"/>
<class name="edm::ClonePolicy<RPCRecHit>" /> <!-- Root6 -->
<class name="edm::RangeMap<RPCDetId, edm::OwnVector<RPCRecHit, edm::ClonePolicy<RPCRecHit> >, edm::ClonePolicy<RPCRecHit> >" splitLevel="0"/>
<class name="edm::Wrapper<edm::RangeMap<RPCDetId, edm::OwnVector<RPCRecHit, edm::ClonePolicy<RPCRecHit> >, edm::ClonePolicy<RPCRecHit> > >" splitLevel="0"/>
<class name="edm::OwnVector<io_v1::RPCRecHit, edm::ClonePolicy<io_v1::RPCRecHit> >" splitLevel="0" rntupleStreamerMode="true"/>
<class name="edm::ClonePolicy<io_v1::RPCRecHit>" /> <!-- Root6 -->
<class name="edm::RangeMap<RPCDetId, edm::OwnVector<io_v1::RPCRecHit, edm::ClonePolicy<io_v1::RPCRecHit> >, edm::ClonePolicy<io_v1::RPCRecHit> >" splitLevel="0"/>
<class name="edm::Wrapper<edm::RangeMap<RPCDetId, edm::OwnVector<io_v1::RPCRecHit, edm::ClonePolicy<io_v1::RPCRecHit> >, edm::ClonePolicy<io_v1::RPCRecHit> > >" splitLevel="0"/>
</selection>
<exclusion>
<class name="edm::OwnVector<RPCRecHit, edm::ClonePolicy<RPCRecHit> >">
<class name="edm::OwnVector<io_v1::RPCRecHit, edm::ClonePolicy<io_v1::RPCRecHit> >">
<method name="sort" splitLevel="0"/>
</class>
</exclusion>
Expand Down