Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTStub revision: modernize/update #28435

Merged
merged 7 commits into from Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions DQM/SiOuterTracker/plugins/OuterTrackerMonitorTTStub.cc
Expand Up @@ -84,14 +84,14 @@ void OuterTrackerMonitorTTStub::analyze(const edm::Event &iEvent, const edm::Eve

/// Get det ID (place of the stub)
// tempStubRef->getDetId() gives the stackDetId, not rawId
DetId detIdStub = theTrackerGeometry->idToDet((tempStubRef->getClusterRef(0))->getDetId())->geographicalId();
DetId detIdStub = theTrackerGeometry->idToDet((tempStubRef->clusterRef(0))->getDetId())->geographicalId();

/// Get trigger displacement/offset
double displStub = tempStubRef->getTriggerDisplacement();
double offsetStub = tempStubRef->getTriggerOffset();
double displStub = tempStubRef->rawBend();
double offsetStub = tempStubRef->bendOffset();

/// Define position stub by position inner cluster
MeasurementPoint mp = (tempStubRef->getClusterRef(0))->findAverageLocalCoordinates();
MeasurementPoint mp = (tempStubRef->clusterRef(0))->findAverageLocalCoordinates();
const GeomDet *theGeomDet = theTrackerGeometry->idToDet(detIdStub);
Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(mp));

Expand Down
144 changes: 92 additions & 52 deletions DataFormats/L1TrackTrigger/interface/TTStub.h
Expand Up @@ -28,34 +28,80 @@ class TTStub {
/// Destructor
~TTStub();

/// Data members: getABC( ... )
/// Data members: ABC( ... )
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved
/// Helper methods: findABC( ... )

/// Clusters composing the Stub
const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& getClusterRef(unsigned int hitIdentifier) const;
/// Clusters composing the Stub -- see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#TTCluster

/// Returns the permanent references of the cluster in the sensor stack identified by hitStackMember
/// which should be either 0 or 1 for the innermost and outermost sensor, respectively
const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& clusterRef(unsigned int hitStackMember) const;

/// Add a cluster reference, depending on which stack member it is on (inner = 0, outer = 1)
void addClusterRef(edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > aTTCluster);

/// Detector element
DetId getDetId() const { return theDetId; }
void setDetId(DetId aDetId) { theDetId = aDetId; }

/// Trigger information
double getTriggerDisplacement() const; /// In FULL-STRIP units! (hence, not implemented herein)
void setTriggerDisplacement(int aDisplacement); /// In HALF-STRIP units!
double getTriggerOffset() const; /// In FULL-STRIP units! (hence, not implemented herein)
void setTriggerOffset(int anOffset); /// In HALF-STRIP units!
double getRealTriggerOffset() const; /// In FULL-STRIP units! (hence, not implemented herein)
void setRealTriggerOffset(float anOffset); /// In HALF-STRIP units!
/// Trigger information; see, e.g., TTStubAlgorithm_official::PatternHitCorrelation for definitions
/// Values are passed back from there via the TTStubBuilder, be careful to choose the right one.
/// In particular note the difference between values passed as "full" strip units (i.e. the strip
/// number or difference between strip numbers) and "half" strip units, which have a 2X finer granularity.

/// RawBend() [rename of getTriggerDisplacement()]: In FULL strip units!
/// Returns the relative displacement between the two cluster centroids, i.e.
/// the difference between average row coordinates in inner and outer stack member,
/// in terms of outer member pitch (if both pitches are the same, this is just the coordinate difference).
/// Flag for rejected stubs: +500 if rejected by FE, +1000 if rejected by CIC chip.
double rawBend() const;

/// setRawBend [rename of setTriggerDisplacement()]: In HALF strip units!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this "get full units, set half units" convention seems confusing and possibly error-prone: what is the motivation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...agreed...

Copy link
Contributor

@fwyzard fwyzard Dec 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, since the granularity is multiples of 0.5, why does it need to be a double and not a float ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix in later revision. Changing this here now breaks lots of downstream code.

/// Sets relative displacement between the two cluster centroids, as above.
/// Flag for rejected stubs: +500 if rejected by FE, +1000 if rejected by CIC chip.
/// NB: Should probably only be used in TTStubBuilder or very similar.
void setRawBend(int aDisplacement);

/// BendOffset() [rename of getTriggerOffset()]: In FULL strip units!
/// Returns the correction offset calculated while accepting/rejecting the stub
/// Offset is the projection of a straight line from the beam-spot through the innermost hit
/// to the outermost stack member, again in terms of outer member pitch. It is calculated
/// taking the centre of the module at (NROWS/2)-0.5.

double bendOffset() const;

/// setBendOffset() [rename of setTriggerOffset()]: In HALF strip units!
/// Again restricted to builder code.
void setBendOffset(int anOffset);

/// getRealTriggerOffset(): In FULL strip units!
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved
/// setRealTriggerOffset(): In HALF strip units!
/// Removed as obsolete. Ivan Reid 10/2019

/// set whether this is a PS module or not;
void setModuleType(bool isPSModule);

/// check if a PS module
bool moduleType() const;
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved

/// CBC3-style trigger information
/// for sake of simplicity, these methods are
/// slightly out of the getABC(...)/findABC(...) rule
double getTriggerPosition() const; /// In FULL-STRIP units!
double getTriggerBend() const; /// In FULL-STRIP units!
double getHardwareBend() const; /// In FULL-STRIP units!
void setHardwareBend(float aBend); /// In HALF-STRIP units!
/// slightly out of the ABC(...)/findABC(...) rule

/// InnerClusterPosition() [rename of getTriggerPosition()]: In FULL strip units!
/// Returns the average local x coordinate of hits in the inner stack member
double innerClusterPosition() const;

/// BendFE(): In FULL-STRIP units from FE! Rename of getTriggerBend()
double bendFE() const;

/// BendBE(): In FULL-STRIP units! Reduced resolution from BE boards. Rename of getHardwareBend()
double bendBE() const;

/// setBendBE(): In HALF-STRIP units! Reduced resolution in BE boards. Rename of setHardwareBend()
void setBendBE(float aBend);

/// Information
/// Print Stub information for debugging purposes
std::string print(unsigned int i = 0) const;

private:
Expand All @@ -65,8 +111,8 @@ class TTStub {
edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > theClusterRef1;
int theDisplacement;
int theOffset;
float theRealOffset;
float theHardwareBend;
float theBendBE;
bool thePSModule;

static constexpr float dummyBend = 999999; // Dumy value should be away from potential bends
}; /// Close class
Expand All @@ -85,11 +131,10 @@ TTStub<T>::TTStub() {
theDetId = 0;
theDisplacement = dummyBend;
theOffset = 0;
theRealOffset = 0;
theHardwareBend = dummyBend;
theBendBE = dummyBend;
}

/// Another Constructor
/// Another Constructor using a given DetId
template <typename T>
TTStub<T>::TTStub(DetId aDetId) {
/// Set data members
Expand All @@ -98,19 +143,17 @@ TTStub<T>::TTStub(DetId aDetId) {
/// Set default data members
theDisplacement = dummyBend;
theOffset = 0;
theRealOffset = 0;
theHardwareBend = dummyBend;
theBendBE = dummyBend;
}

/// Destructor
template <typename T>
TTStub<T>::~TTStub() {}

/// Get the Reference to a Cluster
template <typename T>
const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& TTStub<T>::getClusterRef(
unsigned int hitIdentifier) const {
return hitIdentifier == 0 ? theClusterRef0 : theClusterRef1;
const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& TTStub<T>::clusterRef(
unsigned int hitStackMember) const {
return (hitStackMember == 0) ? theClusterRef0 : theClusterRef1;
}

template <typename T>
Expand All @@ -123,60 +166,57 @@ void TTStub<T>::addClusterRef(edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCl

/// Trigger info
template <typename T>
double TTStub<T>::getTriggerDisplacement() const {
double TTStub<T>::rawBend() const {
return 0.5 * theDisplacement;
}

template <typename T>
void TTStub<T>::setTriggerDisplacement(int aDisplacement) {
void TTStub<T>::setRawBend(int aDisplacement) {
theDisplacement = aDisplacement;
}

template <typename T>
double TTStub<T>::getTriggerOffset() const {
double TTStub<T>::bendOffset() const {
return 0.5 * theOffset;
}

template <typename T>
void TTStub<T>::setTriggerOffset(int anOffset) {
void TTStub<T>::setBendOffset(int anOffset) {
theOffset = anOffset;
}

template <typename T>
double TTStub<T>::getRealTriggerOffset() const {
return 0.5 * theRealOffset;
void TTStub<T>::setBendBE(float aBend) {
theBendBE = aBend;
}

template <typename T>
void TTStub<T>::setRealTriggerOffset(float anOffset) {
theRealOffset = anOffset;
}

void TTStub<T>::setModuleType(bool isPSModule) {
thePSModule = isPSModule;
} // set whether this is a PS module or not;
template <typename T>
void TTStub<T>::setHardwareBend(float aBend) {
theHardwareBend = aBend;
}

/// CBC3-style trigger info
bool TTStub<T>::moduleType() const {
return thePSModule;
} // check if a PS module
template <typename T>
double TTStub<T>::getTriggerPosition() const {
return this->getClusterRef(0)->findAverageLocalCoordinates().x();
double TTStub<T>::innerClusterPosition() const {
return this->clusterRef(0)->findAverageLocalCoordinates().x(); //CBC3-style trigger info
}

template <typename T>
double TTStub<T>::getTriggerBend() const {
double TTStub<T>::bendFE() const {
if (theDisplacement == dummyBend)
return theDisplacement;

return 0.5 * (theDisplacement - theOffset);
}

template <typename T>
double TTStub<T>::getHardwareBend() const {
if (theHardwareBend == dummyBend)
return this->getTriggerBend(); // If not set make it transparent
double TTStub<T>::bendBE() const {
if (theBendBE == dummyBend)
return this->bendFE(); // If not set make it transparent

return theHardwareBend;
return theBendBE;
}

/// Information
Expand All @@ -190,9 +230,9 @@ std::string TTStub<T>::print(unsigned int i) const {
std::stringstream output;
output << padding << "TTStub:\n";
padding += '\t';
output << padding << "DetId: " << theDetId.rawId() << ", position: " << this->getTriggerPosition();
output << ", bend: " << this->getTriggerBend() << '\n';
output << ", hardware bend: " << this->getHardwareBend() << '\n';
output << padding << "DetId: " << theDetId.rawId() << ", position: " << this->InnerClusterPosition();
output << ", bend: " << this->BendFE() << '\n';
output << ", hardware bend: " << this->BendBE() << '\n';
output << padding << "cluster 0: address: " << theClusterRef0.get();
output << ", cluster size: " << theClusterRef0->getHits().size() << '\n';
output << padding << "cluster 1: address: " << theClusterRef1.get();
Expand Down
4 changes: 2 additions & 2 deletions Geometry/TrackerGeometryBuilder/src/TrackerGeometry.cc
Expand Up @@ -247,9 +247,9 @@ void TrackerGeometry::fillTestMap(const GeometricDet* gd) {
TrackerGeometry::ModuleType TrackerGeometry::getDetectorType(DetId detid) const {
for (auto iVal : theDetTypetList) {
DetId detid_max = std::get<0>(iVal);
TrackerGeometry::ModuleType mtype = std::get<1>(iVal);
if (detid.rawId() <= detid_max.rawId())
return mtype;
return std::get<1>(iVal);
// don't get unless necessary... idr 12/6/19
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved
}
return TrackerGeometry::ModuleType::UNKNOWN;
}
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc
Expand Up @@ -12,10 +12,10 @@ namespace {
TTTriggerPrimitive::TTTriggerPrimitive(const TTDetId& detid, const TTDigi& digi) : _id(detid), _subsystem(kTT) {
calculateTTGlobalSector(detid, _globalsector, _subsector);

const MeasurementPoint& mp = digi.getClusterRef(0)->findAverageLocalCoordinatesCentered();
const MeasurementPoint& mp = digi.clusterRef(0)->findAverageLocalCoordinatesCentered();
_data.row_f = mp.x();
_data.col_f = mp.y();
_data.bend = digi.getTriggerBend();
_data.bend = digi.bendFE();
_data.bx = 0;
}

Expand Down
9 changes: 3 additions & 6 deletions L1Trigger/TrackTrigger/interface/TTStubAlgorithm.h
Expand Up @@ -46,12 +46,9 @@ class TTStubAlgorithm {
virtual ~TTStubAlgorithm() {}

/// Matching operations
virtual void PatternHitCorrelation(bool &aConfirmation,
int &aDisplacement,
int &anOffset,
float &anROffset,
float &anHardBend,
const TTStub<T> &aTTStub) const {}
virtual void PatternHitCorrelation(
bool &aConfirmation, int &aDisplacement, int &anOffset, float &anHardBend, const TTStub<T> &aTTStub) const {}
// Removed real offset. Ivan Reid 10/2019
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved

/// Algorithm name
virtual std::string AlgorithmName() const { return className_; }
Expand Down
3 changes: 1 addition & 2 deletions L1Trigger/TrackTrigger/interface/TTStubAlgorithm_cbc3.h
Expand Up @@ -49,9 +49,9 @@ class TTStubAlgorithm_cbc3 : public TTStubAlgorithm<T> {
void PatternHitCorrelation(bool &aConfirmation,
int &aDisplacement,
int &anOffset,
float &anROffset,
float &anHardBend,
const TTStub<T> &aTTStub) const override;
// Removed real offset. Ivan Reid 10/2019
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved

}; /// Close class

Expand All @@ -68,7 +68,6 @@ void TTStubAlgorithm_cbc3<Ref_Phase2TrackerDigi_>::PatternHitCorrelation(
bool &aConfirmation,
int &aDisplacement,
int &anOffset,
float &anROffset,
float &anHardBend,
const TTStub<Ref_Phase2TrackerDigi_> &aTTStub) const;

Expand Down
3 changes: 1 addition & 2 deletions L1Trigger/TrackTrigger/interface/TTStubAlgorithm_official.h
Expand Up @@ -73,9 +73,9 @@ class TTStubAlgorithm_official : public TTStubAlgorithm<T> {
void PatternHitCorrelation(bool &aConfirmation,
int &aDisplacement,
int &anOffset,
float &anROffset,
float &anHardBend,
const TTStub<T> &aTTStub) const override;
// Removed real offset. Ivan Reid 10.2019
mdhildreth marked this conversation as resolved.
Show resolved Hide resolved

float degradeBend(bool psModule, int window, int bend) const;

Expand All @@ -94,7 +94,6 @@ void TTStubAlgorithm_official<Ref_Phase2TrackerDigi_>::PatternHitCorrelation(
bool &aConfirmation,
int &aDisplacement,
int &anOffset,
float &anROffset,
float &anHardBend,
const TTStub<Ref_Phase2TrackerDigi_> &aTTStub) const;

Expand Down