BeamlineGeometry_service.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////
2 /// \File BeamlineGeometry.h
3 /// \brief Implementation of beamline geometry service.
4 /// \author Mike Wallbank (University of Cincinnati) <wallbank@fnal.gov>
5 /// \date August 2019
6 ////////////////////////////////////////////////////////////////////////////
7 
8 #include "BeamlineGeometry.h"
9 
10 // -----------------------------------------------------------------------
12  this->MakeObjects();
13  this->ConfigureGeometry(pset);
14 }
15 
16 // -----------------------------------------------------------------------
18  : BeamlineGeometry(pset) {
19 }
20 
21 // -----------------------------------------------------------------------
23 
24  // Make beamline objects
45 
46 }
47 
48 // -----------------------------------------------------------------------
50 
51  fhicl::ParameterSet geometry = pset.get<fhicl::ParameterSet>("Geometry");
52  fNumToFs = geometry.get<unsigned int>("NumToFs");
53  fNumWCs = geometry.get<unsigned int>("NumWCs");
54  fNumCherenkov = geometry.get<unsigned int>("NumCherenkov");
55 
56  fNumToFCounters = geometry.get<std::vector<unsigned int> >("NumToFCounters");
57 
58  fMagnetAngle = geometry.get<float>("MagnetAngle");
59  fMagnetEffectiveLength = geometry.get<float>("MagnetEffectiveLength");
60  fMagnetMidplaneIntercept = geometry.get<float>("MagnetMidplaneIntercept");
61 
62  fNumWCPlaneWires = geometry.get<unsigned int> ("NumWCPlaneWires");
63  fWCWirePitch = geometry.get<float> ("WCWirePitch");
64  fWCAngles = geometry.get<std::vector<float> >("WCAngles");
65 
66  fhicl::ParameterSet positions = geometry.get<fhicl::ParameterSet>("Positions");
68  = TVector3(&positions.get<std::vector<float> >("Target")[0]);
70  = TVector3(&positions.get<std::vector<float> >("ToFUS")[0]);
72  = TVector3(&positions.get<std::vector<float> >("ToFDS")[0]);
74  = TVector3(&positions.get<std::vector<float> >("ToFDSSiPM")[0]);
76  = TVector3(&positions.get<std::vector<float> >("WC1")[0]);
78  = TVector3(&positions.get<std::vector<float> >("WC2")[0]);
80  = TVector3(&positions.get<std::vector<float> >("WC3")[0]);
82  = TVector3(&positions.get<std::vector<float> >("WC4")[0]);
84  = TVector3(&positions.get<std::vector<float> >("Cherenkov")[0]);
86  = TVector3(&positions.get<std::vector<float> >("NOvA")[0]);
88  = TVector3(&positions.get<std::vector<float> >("Magnet")[0]);
90  = TVector3(&positions.get<std::vector<float> >("CollimatorUS")[0]);
92  = TVector3(&positions.get<std::vector<float> >("CollimatorDS")[0]);
94  = TVector3(&positions.get<std::vector<float> >("Shielding1")[0]);
96  = TVector3(&positions.get<std::vector<float> >("Shielding2")[0]);
98  = TVector3(&positions.get<std::vector<float> >("Shielding3")[0]);
100  = TVector3(&positions.get<std::vector<float> >("HeliumPipe1")[0]);
102  = TVector3(&positions.get<std::vector<float> >("HeliumPipe2")[0]);
104  = TVector3(&positions.get<std::vector<float> >("HeliumPipe3")[0]);
106  = TVector3(&positions.get<std::vector<float> >("HeliumPipe4")[0]);
107 
109 
110  return;
111 
112 }
113 
114 // -----------------------------------------------------------------------
116  return fNumToFs;
117 }
118 
119 // -----------------------------------------------------------------------
121  return fNumWCs;
122 }
123 
124 // -----------------------------------------------------------------------
126  return fNumCherenkov;
127 }
128 
129 // -----------------------------------------------------------------------
131  if (tof.Detector >= fNumToFCounters.size()) {
132  std::cout << "ToF detector " << tof.Detector << " does not exist." << std::endl;
133  abort();
134  }
135  return fNumToFCounters.at(tof.Detector);
136 }
137 
138 // -----------------------------------------------------------------------
140  std::cout << "Warning: BeamlineGeometry::NumWCChannels not yet implemented" << std::endl;
141  return 0;
142 }
143 
144 // -----------------------------------------------------------------------
146  if (!fBeamlineObjects.count(component)) {
147  std::cout << "No beamline object " << static_cast<unsigned int>(component) << std::endl;
148  abort();
149  }
150  return fBeamlineObjects.at(component);
151 }
152 
153 // -----------------------------------------------------------------------
154 //BeamlineObject beamlinegeo::BeamlineGeometry::GetBeamlineObject(ChannelID channel) const;
155 
156 // -----------------------------------------------------------------------
157 //BeamlineObject beamlinegeo::BeamlineGeometry::GetBeamlineObject(DetectorID detector) const;
158 
159 // -----------------------------------------------------------------------
160 //DetectorID beamlinegeo::BeamlineGeometry::GetDetectorID(BeamlineObject object) const;
161 
162 // -----------------------------------------------------------------------
163 //DetectorID beamlinegeo::BeamlineGeometry::GetDetectorID(BeamlineComponent component) const;
164 
165 // -----------------------------------------------------------------------
167  return fMagnetAngle;
168 }
169 
170 // -----------------------------------------------------------------------
172  return fMagnetEffectiveLength;
173 }
174 
175 // -----------------------------------------------------------------------
178 }
179 
180 // -----------------------------------------------------------------------
182  return fNumWCPlaneWires;
183 }
184 
185 // -----------------------------------------------------------------------
187  return fWCWirePitch;
188 }
189 
190 // -----------------------------------------------------------------------
191 float beamlinegeo::BeamlineGeometry::WCAngle(unsigned int wc) const {
192  if (wc >= fWCAngles.size()) {
193  std::cout << "No WC " << wc << std::endl;
194  abort();
195  }
196  return fWCAngles.at(wc);
197 }
198 
199 // -----------------------------------------------------------------------
201  return vec-fNOvACoordOrigin;
202 }
203 
204 // -----------------------------------------------------------------------
206  return vec+fNOvACoordOrigin;
207 }
208 
209 // -----------------------------------------------------------------------
211  BeamlineCoordSystem system) const {
212  BeamlineObject obj = this->GetBeamlineObject(component);
213  TVector3 pos = obj.Position;
214  if (system == BeamlineCoordSystem::NOvADetector)
215  pos = this->BeamlineToNOvADetectorCoords(pos);
216  return pos;
217 }
218 
float WCAngle(unsigned int wc) const
WC angle.
float MagnetMidplaneIntercept() const
Intercept of the magnet midplane?
system("rm -rf microbeam.root")
TVector3 NOvADetectorToBeamlineCoords(TVector3 vec) const
unsigned int NumToFs() const
Number of ToF counters in beamline.
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
unsigned int NumWCs() const
Number of WCs in beamline.
float MagnetEffectiveLength() const
Effective length of the magnet.
std::vector< unsigned int > fNumToFCounters
Definition of the beamline offline geometry. Also implementation of a service to obtain this informat...
TVector3 BeamlineComponentPos(BeamlineComponent component, BeamlineCoordSystem system) const
unsigned int NumToFCounters(DetectorID tof) const
Number of counter of this ToF.
TVector3 BeamlineToNOvADetectorCoords(TVector3 vec) const
T get(std::string const &key) const
Definition: ParameterSet.h:231
BeamlineObject GetBeamlineObject(BeamlineComponent component) const
Return beamline object for a BeamlineComponent.
Eigen::VectorXd vec
float MagnetAngle() const
Magnet angle.
float WCWirePitch() const
Wire chamber wire pitch.
OStream cout
Definition: OStream.cxx:6
void ConfigureGeometry(const fhicl::ParameterSet &pset)
BeamlineGeometry(const fhicl::ParameterSet &pset)
Implementation of beamline geometry service.
std::vector< float > fWCAngles
unsigned int NumWCChannels(DetectorID wc) const
Number of channels on this WC.
unsigned int NumWCPlaneWires() const
Number of wires on each WC plane.
std::map< BeamlineComponent, BeamlineObject > fBeamlineObjects
unsigned int NumCherenkov() const
Number of Cherenkov detectors in beamline.