#include "IECALBar.hxx" // root #include #include // oaGeomInfo #include #include // oaEvent #include COMET::IECALBar::IECALBar(COMET::IGeometryId geomId, int orientation, int nsensors, int layer_number, int bar_number) : COMET::IScintBarGeom(geomId, orientation, nsensors), fLayerNumber(layer_number), fBarNumber(bar_number) { // This is a vector indicating the direction of the 'point of the triangle' // for bars in the P0D. However, one could in principle still call // the GetPointing() method and what is returned for an ECal bar should // at least be well-defined. fPointing = TVector3(0.0,0.0,0.0); } double COMET::IECALBar::GetLength() const { TVector3 extent = COMET::IGeomInfo::Get().NodeExtent( this->GetGeomId() ); // > 'extent' is the half-dimensions of the volume. // > 'extent' is in the global co-ordinate system (we need to be careful // here because of the posiblity of rotations). // // > Because a bar's width is always 40mm, and height is 10mm: // // extent.Mag2() = length^2 + 5^2 + 20^2 // // length = sqrt( extent.Mag2() - 25 - 400 ) // // length = sqrt( extent.Mag2() - 425 ) double length = TMath::Sqrt( extent.Mag2() - 425.0 ); // Remember that the length we have calculated is half of the full length, // which is what we really want to return length *= 2.0; return length; } TVector3 COMET::IECALBar::GetEnd(const int orientation) const { TVector3 end(0.0, 0.0, 0.0); if( orientation == +1 ) { double pos_end = this->GetLength() / 2.0; end = COMET::IGeomInfo::Get().LocalToMaster(this->GetGeomId(), 0.0, 0.0, pos_end); } else if( orientation == -1 ) { double neg_end = -this->GetLength() / 2.0; end = COMET::IGeomInfo::Get().LocalToMaster(this->GetGeomId(), 0.0, 0.0, neg_end); } return end; }