Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#include "Geometry/RPCGeometry/interface/RPCRollSpecs.h"
#include "Geometry/CommonTopologies/interface/RectangularStripTopology.h"
#include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h"

using namespace GeomDetEnumerators;

RPCRollSpecs::RPCRollSpecs(SubDetector rss, const std::string& name, const RPCSpecs& pars)
    : GeomDetType(name, rss), _p(pars), _n(name) {
  if (rss == RPCBarrel) {
    int nstrip = static_cast<int>(_p[2]);
    float pitch = _p[0] * 2 / _p[2];
    float striplength = _p[1] * 2;
    _top = new RectangularStripTopology(nstrip, pitch, striplength);
  } else if (rss == RPCEndcap) {
    float b = _p[0];
    float B = _p[1];
    float h = _p[2];
    float r0 = h * (B + b) / (B - b);
    float striplength = h * 2;
    float strips = _p[3];
    float pitch = (b + B) / strips;
    int nstrip = static_cast<int>(strips);

    _top = new TrapezoidalStripTopology(nstrip, pitch, striplength, r0);
  } else {
    _top = nullptr;
  }
}

RPCRollSpecs::~RPCRollSpecs() {
  if (_top)
    delete _top;
  _top = nullptr;
}

const Topology& RPCRollSpecs::topology() const { return *(_top); }

const StripTopology& RPCRollSpecs::specificTopology() const { return *(_top); }

const std::string& RPCRollSpecs::detName() const { return _n; }