Skip to content
Snippets Groups Projects
Commit 874dc765 authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Move unused members from base to derived TrigSiSpacePoint class: save factor of 2 in memory

parent 5ff6fd3a
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,10 @@ public:
const Identifier& elementId, long layer,
double r, double phi, double z,
double dr=0.0, double dphi=0.0, double dz=0.0 ) :
TrigSiSpacePointBase(layer, r, phi, z, dr, dphi, dz),
TrigSiSpacePointBase(layer, r, phi, z, dr, dz),
m_clusters(cluster1, 0),
m_dphi(dphi),
m_locT(0.), m_locL(0.),
m_elementId(elementId) {};
// Constructor from two clusters using cylindrical co-ordinates, no. errors
......@@ -29,15 +31,23 @@ public:
const Identifier& elementId, long layer,
double r, double phi, double z,
double dr=0.0, double dphi=0.0, double dz=0.0) :
TrigSiSpacePointBase(layer, r, phi, z, dr, dphi, dz),
TrigSiSpacePointBase(layer, r, phi, z, dr, dz),
m_clusters(cluster1, cluster2),
m_dphi(dphi),
m_elementId(elementId) {};
// Destructor
virtual ~TrigSiSpacePoint() {};
//Setter methods
void locT(const double locT) {m_locT = locT;}
void locL( const double locL ) {m_locL = locL; }
// Methods to return values of data members
const Identifier& identify() const {return m_elementId;}
double dphi() const {return m_dphi;}
double locT() const {return m_locT;}
double locL() const {return m_locL;}
// Methods to retrieve data members
std::pair < const InDet::SiCluster*, const InDet::SiCluster* > clusters() const {
......@@ -47,6 +57,9 @@ public:
private:
std::pair<const InDet::SiCluster*, const InDet::SiCluster*> m_clusters;
double m_dphi;
double m_locT;
double m_locL;
const Identifier m_elementId;
};
......
......@@ -5,8 +5,7 @@
#ifndef __TRIGSISPACEPOINTBASE_H__
#define __TRIGSISPACEPOINTBASE_H__
#include <math.h>
#include <cstddef>
#include <cmath>
#include "TrkSpacePoint/SpacePoint.h"
#define MAX_SILICON_LAYER_NUM 19
......@@ -28,17 +27,14 @@ public:
// using cylindrical co-ordinates, no. errors
TrigSiSpacePointBase(long layer,
double r, double phi, double z,
double dr=0.0, double dphi=0.0, double dz=0.0, const Trk::SpacePoint* offlineSpacePoint = NULL) :
double dr=0.0, double dz=0.0, const Trk::SpacePoint* offlineSpacePoint = nullptr) :
m_layer(layer),
m_r(r), m_phi(phi), m_z(z),
m_dr(dr), m_dphi(dphi), m_dz(dz), m_locT(0.), m_locL(0.),
m_original_r(r), m_original_phi(phi), m_offlineSpacePoint(offlineSpacePoint)
m_dr(dr), m_dz(dz),
m_offlineSpacePoint(offlineSpacePoint)
{
m_x = m_original_x = r * cos(phi);
m_y = m_original_y = r * sin(phi);
m_elementIndex[0]=-1;m_elementIndex[1]=-1;
m_eta = eta(0.0);
m_rotatedPhi = m_phi;
m_x = r * std::cos(phi);
m_y = r * std::sin(phi);
m_barCode=-1;
if (m_offlineSpacePoint) {
m_isPixel = (m_offlineSpacePoint->clusterList().second==nullptr);
......@@ -58,49 +54,18 @@ public:
void x( const double x ) {m_x = x; }
void y( const double y ) {m_y = y; }
void dr( const double dr ) {m_dr = dr; }
void dphi(const double dphi) {m_dphi = dphi;}
void dz( const double dz ) {m_dz = dz; }
void locT(const double locT) {m_locT = locT;}
void locL( const double locL ) {m_locL = locL; }
void elementIndex(int i, unsigned int idx) {
if((i==0) || (i==1))
m_elementIndex[i]=idx;
}
void setEta(double eta) {
m_eta=eta;
}
void usedBy(int idx) {m_usedBy=idx;}
void index(int idx) {m_index=idx;}
void rotatedPhi(double phi) {m_rotatedPhi = phi;}
void barCode(int code) {m_barCode = code;}
// Methods to return values of data members
unsigned int elementIndex(int i) const {
if((i==0) || (i==1))
return m_elementIndex[i];
else return -1;
}
double r() const {return m_r;}
double phi() const {return m_phi;}
double z() const {return m_z;}
double dr() const {return m_dr;}
double dphi() const {return m_dphi;}
double dz() const {return m_dz;}
double locT() const {return m_locT;}
double locL() const {return m_locL;}
double x() const {return m_x;}
double y() const {return m_y;}
long layer() const {return m_layer;}
double eta() const {return m_eta;}
double original_r() const {return m_original_r;}
double original_phi() const {return m_original_phi;}
double original_x() const {return m_original_x;}
double original_y() const {return m_original_y;}
bool isPixel() const {return m_isPixel;}
bool isSCT() const {return !m_isPixel;}
......@@ -109,18 +74,14 @@ public:
double eta(double z0) const {
double zr = (m_z-z0)/m_r;
return log(zr+sqrt(1.+zr*zr));
return log(zr+std::sqrt(1.+zr*zr));
}
double rotatedPhi() const {return m_rotatedPhi;}
int usedBy() const {return m_usedBy;}
int index() const {return m_index;}
int barCode() const {return m_barCode;}
const Trk::SpacePoint* offlineSpacePoint() const {return m_offlineSpacePoint;}
protected:
unsigned int m_elementIndex[2];
long m_layer;
double m_r;
......@@ -130,20 +91,8 @@ protected:
double m_phi;
double m_z;
double m_dr;
double m_dphi;
double m_dz;
double m_locT;
double m_locL;
double m_original_r;
double m_original_phi;
double m_original_x;
double m_original_y;
double m_rotatedPhi;// to be used for RoIs with [+/- pi] boundary
double m_eta; //cache for eta result;
int m_usedBy; //index of a track sp is assigned to
int m_index; //sp index in a collection
int m_barCode; //MC truth association
bool m_isPixel; //Stores whether spacepoint is Pixel or SCT
......
......@@ -72,7 +72,7 @@ namespace FTF {//FastTrackFinder
class BaseSpacePointFilter {
public:
BaseSpacePointFilter(std::vector<TrigSiSpacePointBase>& vec, LayerCalculator& lc) : m_vec(vec), m_layerCalculator(lc),
m_layerId(-1), m_dr(0.0), m_dphi(0.0), m_dz(0.0) {};
m_layerId(-1), m_dr(0.0), m_dz(0.0) {};
virtual ~BaseSpacePointFilter(){};
virtual void operator()(const Trk::SpacePoint*) = 0;
int vectorSize() {
......@@ -90,7 +90,6 @@ namespace FTF {//FastTrackFinder
void setErrors(const Identifier& id) {
if(m_layerCalculator.isPixel(id)) {
m_dphi=0.0001;
if(m_layerCalculator.isBarrel(id)) {
m_dr=0.01;
m_dz=0.13;
......@@ -101,7 +100,6 @@ namespace FTF {//FastTrackFinder
}
}
else {
m_dphi=0.00005;
if(m_layerCalculator.isBarrel(id)) {
m_dr=0.01;
m_dz=0.82;
......@@ -115,13 +113,13 @@ namespace FTF {//FastTrackFinder
void createSpacePoint(const Trk::SpacePoint* p) {
m_vec.push_back(TrigSiSpacePointBase(m_layerId, p->globalPosition().perp(), p->globalPosition().phi(), p->globalPosition().z(),
m_dr, m_dphi, m_dz, p));
m_dr, m_dz, p));
}
protected:
std::vector<TrigSiSpacePointBase>& m_vec;
LayerCalculator m_layerCalculator;
int m_layerId;
double m_dr, m_dphi, m_dz;
double m_dr, m_dz;
};
class RoI_Filter : public BaseSpacePointFilter {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment