Public Member Functions | Private Attributes | List of all members
beamlinegeo::BeamlineGeometry Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-02-25/BeamlineUtils/BeamlineGeometry.h"

Public Member Functions

 BeamlineGeometry (const fhicl::ParameterSet &pset)
 Implementation of beamline geometry service. More...
 
 BeamlineGeometry (const fhicl::ParameterSet &pset, art::ActivityRegistry &)
 
void MakeObjects ()
 
void ConfigureGeometry (const fhicl::ParameterSet &pset)
 
unsigned int NumToFs () const
 Number of ToF counters in beamline. More...
 
unsigned int NumWCs () const
 Number of WCs in beamline. More...
 
unsigned int NumCherenkov () const
 Number of Cherenkov detectors in beamline. More...
 
unsigned int NumToFCounters (DetectorID tof) const
 Number of counter of this ToF. More...
 
unsigned int NumWCChannels (DetectorID wc) const
 Number of channels on this WC. More...
 
BeamlineObject GetBeamlineObject (BeamlineComponent component) const
 Return beamline object for a BeamlineComponent. More...
 
BeamlineObject GetBeamlineObject (ChannelID channel) const
 Return beamline object for a ChannelID. More...
 
BeamlineObject GetBeamlineObject (DetectorID detector) const
 Return beamline object for a DetectorID. More...
 
DetectorID GetDetectorID (BeamlineObject object) const
 Return DetectorID for a beamline object. More...
 
DetectorID GetDetectorID (BeamlineComponent component) const
 Return DetectorID for a BeamlineComponent. More...
 
float MagnetAngle () const
 Magnet angle. More...
 
float MagnetEffectiveLength () const
 Effective length of the magnet. More...
 
float MagnetMidplaneIntercept () const
 Intercept of the magnet midplane? More...
 
unsigned int NumWCPlaneWires () const
 Number of wires on each WC plane. More...
 
float WCWirePitch () const
 Wire chamber wire pitch. More...
 
float WCAngle (unsigned int wc) const
 WC angle. More...
 
float ToFPathLength () const
 ToF path length measured between the two PMT modules, the shorter length. More...
 
float ToFPathLengthSiPM () const
 ToF path length measured between the two SiPM modules, the longer length. More...
 
TVector3 BeamlineToNOvADetectorCoords (TVector3 vec) const
 
TVector3 NOvADetectorToBeamlineCoords (TVector3 vec) const
 
TVector3 BeamlineComponentPos (BeamlineComponent component, BeamlineCoordSystem system) const
 
std::vector< SystemIDSystemIDs () const
 SystemIDs. More...
 
std::vector< DetectorIDDetectorIDs () const
 DetectorIDs. More...
 
std::vector< ChannelIDChannelIDs () const
 ChannelIDs. More...
 

Private Attributes

unsigned int fNumToFs
 
unsigned int fNumWCs
 
unsigned int fNumCherenkov
 
std::vector< unsigned intfNumToFCounters
 
float fMagnetAngle
 
float fMagnetEffectiveLength
 
float fMagnetMidplaneIntercept
 
unsigned int fNumWCPlaneWires
 
float fWCWirePitch
 
std::vector< float > fWCAngles
 
float fToFPathLength
 
float fToFPathLengthSiPM
 
std::map< BeamlineComponent, BeamlineObjectfBeamlineObjects
 
TVector3 fNOvACoordOrigin
 

Detailed Description

Definition at line 194 of file BeamlineGeometry.h.

Constructor & Destructor Documentation

beamlinegeo::BeamlineGeometry::BeamlineGeometry ( const fhicl::ParameterSet pset)

Implementation of beamline geometry service.

BeamlineGeometry.h

Author
Mike Wallbank (University of Cincinnati) wallb.nosp@m.ank@.nosp@m.fnal..nosp@m.gov
Date
August 2019

Definition at line 11 of file BeamlineGeometry_service.cc.

References ConfigureGeometry(), and MakeObjects().

11  {
12  this->MakeObjects();
13  this->ConfigureGeometry(pset);
14 }
void ConfigureGeometry(const fhicl::ParameterSet &pset)
beamlinegeo::BeamlineGeometry::BeamlineGeometry ( const fhicl::ParameterSet pset,
art::ActivityRegistry  
)

Definition at line 17 of file BeamlineGeometry_service.cc.

18  : BeamlineGeometry(pset) {
19 }
BeamlineGeometry(const fhicl::ParameterSet &pset)
Implementation of beamline geometry service.

Member Function Documentation

TVector3 beamlinegeo::BeamlineGeometry::BeamlineComponentPos ( BeamlineComponent  component,
BeamlineCoordSystem  system 
) const

Get the position of a beamline component in the specified coordinate system

Definition at line 228 of file BeamlineGeometry_service.cc.

References BeamlineToNOvADetectorCoords(), DEFINE_ART_SERVICE, GetBeamlineObject(), beamlinegeo::NOvADetector, elec2geo::pos, and beamlinegeo::BeamlineObject::Position.

Referenced by tbana::DSToFAna::AnalyzeDSToF2Location(), testbeam::BeamlineEventDisplay::DrawCkov(), testbeam::BeamlineEventDisplay::DrawMagnet(), testbeam::BeamlineEventDisplay::DrawNOvA(), testbeam::BeamlineEventDisplay::DrawToF(), testbeam::BeamlineEventDisplay::DrawWC(), testbeam::BeamlineEventDisplay::DrawWCTrack(), beamlinereco::WCTrackAlg::findTheHitPositions(), beamlinereco::WCTrackAlg::projectToDetector(), and beamlinereco::WCTrackAlg::projectToMagnetFace().

229  {
230  BeamlineObject obj = this->GetBeamlineObject(component);
231  TVector3 pos = obj.Position;
233  pos = this->BeamlineToNOvADetectorCoords(pos);
234  return pos;
235 }
system("rm -rf microbeam.root")
TVector3 BeamlineToNOvADetectorCoords(TVector3 vec) const
BeamlineObject GetBeamlineObject(BeamlineComponent component) const
Return beamline object for a BeamlineComponent.
TVector3 beamlinegeo::BeamlineGeometry::BeamlineToNOvADetectorCoords ( TVector3  vec) const

Convert a position vector in beamline coordinates to NOvA detector coordinates

Definition at line 218 of file BeamlineGeometry_service.cc.

References fNOvACoordOrigin.

Referenced by BeamlineComponentPos().

218  {
219  return vec-fNOvACoordOrigin;
220 }
Eigen::VectorXd vec
std::vector<ChannelID> beamlinegeo::BeamlineGeometry::ChannelIDs ( ) const

ChannelIDs.

void beamlinegeo::BeamlineGeometry::ConfigureGeometry ( const fhicl::ParameterSet pset)

Definition at line 49 of file BeamlineGeometry_service.cc.

References beamlinegeo::Cherenkov, beamlinegeo::CollimatorDS, beamlinegeo::CollimatorUS, om::cout, allTimeWatchdog::endl, fBeamlineObjects, fMagnetAngle, fMagnetEffectiveLength, fMagnetMidplaneIntercept, fNOvACoordOrigin, fNumCherenkov, fNumToFCounters, fNumToFs, fNumWCPlaneWires, fNumWCs, fToFPathLength, fToFPathLengthSiPM, fWCAngles, fWCWirePitch, fhicl::ParameterSet::get(), beamlinegeo::HeliumPipe1, beamlinegeo::HeliumPipe2, beamlinegeo::HeliumPipe3, beamlinegeo::HeliumPipe4, beamlinegeo::Magnet, beamlinegeo::NOvA, DCS_db_parser::period, cet::pow(), beamlinegeo::Shielding1, beamlinegeo::Shielding2, beamlinegeo::Shielding3, std::sqrt(), beamlinegeo::Target, beamlinegeo::ToFDS, beamlinegeo::ToFDSSiPM, beamlinegeo::ToFUS, beamlinegeo::WC1, beamlinegeo::WC2, beamlinegeo::WC3, and beamlinegeo::WC4.

Referenced by BeamlineGeometry().

49  {
50 
51  fhicl::ParameterSet geometry = pset.get<fhicl::ParameterSet>("Geometry");
52 
53  unsigned int period = geometry.get<unsigned int>("DataTakingPeriod");
54  if (period < 1 or period > 3)
55  throw cet::exception("BeamlineGeometry")
56  << "Data-Taking Period " << period << " unknown. Valid options are 1,2,3.";
57 
58  fNumToFs = geometry.get<unsigned int>("NumToFs");
59  fNumWCs = geometry.get<unsigned int>("NumWCs");
60  fNumCherenkov = geometry.get<unsigned int>("NumCherenkov");
61 
62  fNumToFCounters = geometry.get<std::vector<unsigned int> >("NumToFCounters");
63 
64  fMagnetAngle = geometry.get<float>("MagnetAngle");
65  fMagnetEffectiveLength = geometry.get<float>("MagnetEffectiveLength");
66  fMagnetMidplaneIntercept = geometry.get<float>("MagnetMidplaneIntercept");
67 
68  fNumWCPlaneWires = geometry.get<unsigned int> ("NumWCPlaneWires");
69  fWCWirePitch = geometry.get<float> ("WCWirePitch");
70  fWCAngles = geometry.get<std::vector<float> >("WCAngles");
71 
72  fhicl::ParameterSet positions = geometry.get<fhicl::ParameterSet>(Form("Positions_Period%d", period));
74  = TVector3(&positions.get<std::vector<float> >("Target")[0]);
76  = TVector3(&positions.get<std::vector<float> >("ToFUS")[0]);
78  = TVector3(&positions.get<std::vector<float> >("ToFDS")[0]);
80  = TVector3(&positions.get<std::vector<float> >("ToFDSSiPM")[0]);
82  = TVector3(&positions.get<std::vector<float> >("WC1")[0]);
84  = TVector3(&positions.get<std::vector<float> >("WC2")[0]);
86  = TVector3(&positions.get<std::vector<float> >("WC3")[0]);
88  = TVector3(&positions.get<std::vector<float> >("WC4")[0]);
90  = TVector3(&positions.get<std::vector<float> >("Cherenkov")[0]);
92  = TVector3(&positions.get<std::vector<float> >("NOvA")[0]);
94  = TVector3(&positions.get<std::vector<float> >("Magnet")[0]);
96  = TVector3(&positions.get<std::vector<float> >("CollimatorUS")[0]);
98  = TVector3(&positions.get<std::vector<float> >("CollimatorDS")[0]);
100  = TVector3(&positions.get<std::vector<float> >("Shielding1")[0]);
102  = TVector3(&positions.get<std::vector<float> >("Shielding2")[0]);
104  = TVector3(&positions.get<std::vector<float> >("Shielding3")[0]);
106  = TVector3(&positions.get<std::vector<float> >("HeliumPipe1")[0]);
108  = TVector3(&positions.get<std::vector<float> >("HeliumPipe2")[0]);
110  = TVector3(&positions.get<std::vector<float> >("HeliumPipe3")[0]);
112  = TVector3(&positions.get<std::vector<float> >("HeliumPipe4")[0]);
113 
115 
116  // Calculate ToF path length
117  TVector3 uspos = fBeamlineObjects[BeamlineComponent::ToFUS].Position,
118  dspos = fBeamlineObjects[BeamlineComponent::ToFDS].Position,
119  dssipmpos = fBeamlineObjects[BeamlineComponent::ToFDSSiPM].Position,
120  magpos = fBeamlineObjects[BeamlineComponent::Magnet].Position;
121  float ustomag = sqrt(pow((magpos.X() - uspos.X()), 2) + pow((magpos.Z() - uspos.Z()), 2));
122  float magtods = sqrt(pow((dspos.X() - magpos.X()), 2) + pow((dspos.Z() - magpos.Z()), 2));
123  float magtodssipm = sqrt(pow((dssipmpos.X() - magpos.X()), 2) + pow((dssipmpos.Z() - magpos.Z()), 2));
124  fToFPathLength = ustomag + magtods;
125  fToFPathLengthSiPM = ustomag + magtodssipm;
126  std::cout << "ToF paths " << fToFPathLength << ", " << fToFPathLengthSiPM << std::endl;
127 
128  return;
129 
130 }
T sqrt(T number)
Definition: d0nt_math.hpp:156
constexpr T pow(T x)
Definition: pow.h:75
std::vector< unsigned int > fNumToFCounters
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
T get(std::string const &key) const
Definition: ParameterSet.h:231
OStream cout
Definition: OStream.cxx:6
std::vector< float > fWCAngles
std::map< BeamlineComponent, BeamlineObject > fBeamlineObjects
std::vector<DetectorID> beamlinegeo::BeamlineGeometry::DetectorIDs ( ) const

DetectorIDs.

beamlinegeo::BeamlineObject beamlinegeo::BeamlineGeometry::GetBeamlineObject ( BeamlineComponent  component) const

Return beamline object for a BeamlineComponent.

Definition at line 163 of file BeamlineGeometry_service.cc.

References test_component::component, om::cout, allTimeWatchdog::endl, and fBeamlineObjects.

Referenced by BeamlineComponentPos().

163  {
164  if (!fBeamlineObjects.count(component)) {
165  std::cout << "No beamline object " << static_cast<unsigned int>(component) << std::endl;
166  abort();
167  }
168  return fBeamlineObjects.at(component);
169 }
OStream cout
Definition: OStream.cxx:6
std::map< BeamlineComponent, BeamlineObject > fBeamlineObjects
BeamlineObject beamlinegeo::BeamlineGeometry::GetBeamlineObject ( ChannelID  channel) const

Return beamline object for a ChannelID.

BeamlineObject beamlinegeo::BeamlineGeometry::GetBeamlineObject ( DetectorID  detector) const

Return beamline object for a DetectorID.

DetectorID beamlinegeo::BeamlineGeometry::GetDetectorID ( BeamlineObject  object) const

Return DetectorID for a beamline object.

DetectorID beamlinegeo::BeamlineGeometry::GetDetectorID ( BeamlineComponent  component) const

Return DetectorID for a BeamlineComponent.

float beamlinegeo::BeamlineGeometry::MagnetAngle ( ) const
float beamlinegeo::BeamlineGeometry::MagnetEffectiveLength ( ) const

Effective length of the magnet.

Definition at line 189 of file BeamlineGeometry_service.cc.

References fMagnetEffectiveLength.

Referenced by beamlinereco::WCTrackAlg::calculateRecoP(), and beamlinereco::WCTrackAlg::projectToMagnetFace().

189  {
190  return fMagnetEffectiveLength;
191 }
float beamlinegeo::BeamlineGeometry::MagnetMidplaneIntercept ( ) const

Intercept of the magnet midplane?

Definition at line 194 of file BeamlineGeometry_service.cc.

References fMagnetMidplaneIntercept.

Referenced by beamlinereco::WCTrackAlg::calculateTrackKink_Dists().

194  {
196 }
void beamlinegeo::BeamlineGeometry::MakeObjects ( )

Definition at line 22 of file BeamlineGeometry_service.cc.

References beamlinegeo::Cherenkov, beamlinegeo::CollimatorDS, fBeamlineObjects, beamlinegeo::HeliumPipe1, beamlinegeo::HeliumPipe2, beamlinegeo::HeliumPipe3, beamlinegeo::HeliumPipe4, beamlinegeo::Magnet, beamlinegeo::NOvA, beamlinegeo::Shielding1, beamlinegeo::Shielding2, beamlinegeo::Shielding3, beamlinegeo::Target, beamlinegeo::ToFDS, beamlinegeo::ToFDSSiPM, beamlinegeo::ToFUS, beamlinegeo::WC1, beamlinegeo::WC2, beamlinegeo::WC3, and beamlinegeo::WC4.

Referenced by BeamlineGeometry().

22  {
23 
24  // Make beamline objects
45 
46 }
std::map< BeamlineComponent, BeamlineObject > fBeamlineObjects
TVector3 beamlinegeo::BeamlineGeometry::NOvADetectorToBeamlineCoords ( TVector3  vec) const

Convert a position vector in NOvA detector coordinates to beamline coordinates

Definition at line 223 of file BeamlineGeometry_service.cc.

References fNOvACoordOrigin.

Referenced by testbeam::BeamlineEventDisplay::DrawNOvATracks().

223  {
224  return vec+fNOvACoordOrigin;
225 }
Eigen::VectorXd vec
unsigned int beamlinegeo::BeamlineGeometry::NumCherenkov ( ) const

Number of Cherenkov detectors in beamline.

Definition at line 143 of file BeamlineGeometry_service.cc.

References fNumCherenkov.

143  {
144  return fNumCherenkov;
145 }
unsigned int beamlinegeo::BeamlineGeometry::NumToFCounters ( DetectorID  tof) const

Number of counter of this ToF.

Definition at line 148 of file BeamlineGeometry_service.cc.

References om::cout, beamlinegeo::DetectorID::Detector, allTimeWatchdog::endl, and fNumToFCounters.

148  {
149  if (tof.Detector >= fNumToFCounters.size()) {
150  std::cout << "ToF detector " << tof.Detector << " does not exist." << std::endl;
151  abort();
152  }
153  return fNumToFCounters.at(tof.Detector);
154 }
std::vector< unsigned int > fNumToFCounters
OStream cout
Definition: OStream.cxx:6
unsigned int beamlinegeo::BeamlineGeometry::NumToFs ( ) const

Number of ToF counters in beamline.

Definition at line 133 of file BeamlineGeometry_service.cc.

References fNumToFs.

133  {
134  return fNumToFs;
135 }
unsigned int beamlinegeo::BeamlineGeometry::NumWCChannels ( DetectorID  wc) const

Number of channels on this WC.

Definition at line 157 of file BeamlineGeometry_service.cc.

References om::cout, and allTimeWatchdog::endl.

157  {
158  std::cout << "Warning: BeamlineGeometry::NumWCChannels not yet implemented" << std::endl;
159  return 0;
160 }
OStream cout
Definition: OStream.cxx:6
unsigned int beamlinegeo::BeamlineGeometry::NumWCPlaneWires ( ) const

Number of wires on each WC plane.

Definition at line 199 of file BeamlineGeometry_service.cc.

References fNumWCPlaneWires.

Referenced by beamlinereco::WCHitFinderAlg::createHits(), and testbeam::BeamlineEventDisplay::DrawWC().

199  {
200  return fNumWCPlaneWires;
201 }
unsigned int beamlinegeo::BeamlineGeometry::NumWCs ( ) const
std::vector<SystemID> beamlinegeo::BeamlineGeometry::SystemIDs ( ) const

SystemIDs.

float beamlinegeo::BeamlineGeometry::ToFPathLength ( ) const

ToF path length measured between the two PMT modules, the shorter length.

float beamlinegeo::BeamlineGeometry::ToFPathLengthSiPM ( ) const

ToF path length measured between the two SiPM modules, the longer length.

float beamlinegeo::BeamlineGeometry::WCAngle ( unsigned int  wc) const

WC angle.

Definition at line 209 of file BeamlineGeometry_service.cc.

References om::cout, allTimeWatchdog::endl, and fWCAngles.

Referenced by beamlinereco::WCTrackAlg::findTheHitPositions().

209  {
210  if (wc >= fWCAngles.size()) {
211  std::cout << "No WC " << wc << std::endl;
212  abort();
213  }
214  return fWCAngles.at(wc);
215 }
OStream cout
Definition: OStream.cxx:6
std::vector< float > fWCAngles
float beamlinegeo::BeamlineGeometry::WCWirePitch ( ) const

Wire chamber wire pitch.

Definition at line 204 of file BeamlineGeometry_service.cc.

References fWCWirePitch.

Referenced by testbeam::BeamlineEventDisplay::DrawWC().

204  {
205  return fWCWirePitch;
206 }

Member Data Documentation

std::map<BeamlineComponent, BeamlineObject> beamlinegeo::BeamlineGeometry::fBeamlineObjects
private

Definition at line 305 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), GetBeamlineObject(), and MakeObjects().

float beamlinegeo::BeamlineGeometry::fMagnetAngle
private

Definition at line 291 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and MagnetAngle().

float beamlinegeo::BeamlineGeometry::fMagnetEffectiveLength
private

Definition at line 292 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and MagnetEffectiveLength().

float beamlinegeo::BeamlineGeometry::fMagnetMidplaneIntercept
private

Definition at line 293 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and MagnetMidplaneIntercept().

TVector3 beamlinegeo::BeamlineGeometry::fNOvACoordOrigin
private
unsigned int beamlinegeo::BeamlineGeometry::fNumCherenkov
private

Definition at line 285 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and NumCherenkov().

std::vector<unsigned int> beamlinegeo::BeamlineGeometry::fNumToFCounters
private

Definition at line 288 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and NumToFCounters().

unsigned int beamlinegeo::BeamlineGeometry::fNumToFs
private

Definition at line 283 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and NumToFs().

unsigned int beamlinegeo::BeamlineGeometry::fNumWCPlaneWires
private

Definition at line 296 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and NumWCPlaneWires().

unsigned int beamlinegeo::BeamlineGeometry::fNumWCs
private

Definition at line 284 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and NumWCs().

float beamlinegeo::BeamlineGeometry::fToFPathLength
private

Definition at line 301 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry().

float beamlinegeo::BeamlineGeometry::fToFPathLengthSiPM
private

Definition at line 302 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry().

std::vector<float> beamlinegeo::BeamlineGeometry::fWCAngles
private

Definition at line 298 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and WCAngle().

float beamlinegeo::BeamlineGeometry::fWCWirePitch
private

Definition at line 297 of file BeamlineGeometry.h.

Referenced by ConfigureGeometry(), and WCWirePitch().


The documentation for this class was generated from the following files: