4 #include <boost/lexical_cast.hpp>
6 #include <sdet/Station.h>
7 #include <sdet/Scintillator.h>
8 #include <det/Detector.h>
9 #include <sdet/SDetector.h>
10 #include <utl/ErrorLogger.h>
12 #include <utl/Point.h>
14 #include <utl/GeometryUtilities.h>
15 #include <utl/UTMPoint.h>
16 #include <utl/Reader.h>
17 #include <utl/CoordinateSystem.h>
18 #include <utl/AugerCoordinateSystem.h>
19 #include <fwk/LocalCoordinateSystem.h>
30 if (!fBarLength.IsValid()) {
31 GetScintillatorData(fBarLength.Get(),
"barLength",
"scintillator",
"scintillator bar length");
32 fBarLength.SetValid();
34 return fBarLength.Get();
42 if (!fBarWidth.IsValid()) {
43 GetScintillatorData(fBarWidth.Get(),
"barWidth",
"scintillator",
"scintillator bar width");
46 return fBarWidth.Get();
54 if (!fBarThickness.IsValid()) {
55 GetScintillatorData(fBarThickness.Get(),
"barThickness",
"scintillator",
"scintillator bar thickness");
56 fBarThickness.SetValid();
58 return fBarThickness.Get();
66 if (!fNBars.IsValid()) {
68 m.
GetDataOrThrow(fNBars.Get(),
"scintillator",
"barCount", indexMap);
79 if (!fGap.IsValid()) {
80 GetScintillatorData(fGap.Get(),
"gap",
"scintillator",
"gap between sides of scintillator");
91 if (!fFiberLength.IsValid()) {
92 GetScintillatorData(fFiberLength.Get(),
"fiberLength",
"scintillator",
93 "length of on fiber routed through two scintillator bars");
94 fFiberLength.SetValid();
96 return fFiberLength.Get();
104 if (!fFiberUTurnDiameter.IsValid()) {
105 GetScintillatorData(fFiberUTurnDiameter.Get(),
"fiberUTurnDiameter",
"scintillator",
106 "diameter of the u-turn fibers make in their connections from one bar to the next");
107 fFiberUTurnDiameter.SetValid();
109 return fFiberUTurnDiameter.Get();
117 if (!fHousingLength.IsValid()) {
118 GetScintillatorData(fHousingLength.Get(),
"housingLength",
"scintillator",
"length of scintillator polystyrene housing");
119 fHousingLength.SetValid();
121 return fHousingLength.Get();
129 if (!fHousingWidth.IsValid()) {
130 GetScintillatorData(fHousingWidth.Get(),
"housingWidth",
"scintillator",
"width of scintillator polystyrene housing");
131 fHousingWidth.SetValid();
133 return fHousingWidth.Get();
141 if (!fHousingThickness.IsValid()) {
142 GetScintillatorData(fHousingThickness.Get(),
"housingThickness",
"scintillator",
"thickness of scintillator polystyrene housing");
143 fHousingThickness.SetValid();
145 return fHousingThickness.Get();
153 if (!fCasingThickness.IsValid()) {
154 GetScintillatorData(fCasingThickness.Get(),
"casingThickness",
"scintillator",
"thickness of scintillator aluminum casing");
155 fCasingThickness.SetValid();
157 return fCasingThickness.Get();
165 if (!fSandwichPanelThickness.IsValid()) {
166 GetScintillatorData(fSandwichPanelThickness.Get(),
"sandwichPanelThickness",
"scintillator",
"thickness of the foam portion of the sandwich board of the scintillator");
167 fSandwichPanelThickness.SetValid();
169 return fSandwichPanelThickness.Get();
177 if (!fRoofOffset.IsValid()) {
178 GetScintillatorData(fRoofOffset.Get(),
"roofOffset",
"scintillator",
"offset of the bottom of the roof from the top of the top aluminum sheet of the scintillator");
179 fRoofOffset.SetValid();
181 return fRoofOffset.Get();
189 if (!fRoofThickness.IsValid()) {
190 GetScintillatorData(fRoofThickness.Get(),
"roofThickness",
"scintillator",
"thickness of the scintillator roof");
191 fRoofThickness.SetValid();
193 return fRoofThickness.Get();
201 if (!fPosition.IsValid()) {
203 vector<double> coords;
204 GetScintillatorData(coords,
"position",
"scintillator",
"scintillator position");
210 det::Detector::GetInstance().GetSDetector().GetStation(fStationId).GetLocalCoordinateSystem();
212 fPosition =
utl::Point(coords[0], coords[1], coords[2], tCS);
215 return fPosition.Get();
223 if (!fFiberExpDecayConstant.IsValid()) {
224 GetScintillatorData(fFiberExpDecayConstant.Get(),
"fiberExpDecayConst",
"scintillator",
"fiber exponential decay constant");
225 fFiberExpDecayConstant.SetValid();
227 return fFiberExpDecayConstant.Get();
235 if (!fBarExpDecayConstant.IsValid()) {
236 GetScintillatorData(fBarExpDecayConstant.Get(),
"barExpDecayConst",
"scintillator",
"scintillator bar exponential decay constant");
237 fBarExpDecayConstant.SetValid();
239 return fBarExpDecayConstant.Get();
247 if (!fAttenuationLength.IsValid()) {
248 GetScintillatorData(fAttenuationLength.Get(),
"attenuationLength",
"scintillator",
"attenuation length");
249 fAttenuationLength.SetValid();
251 return fAttenuationLength.Get();
259 if (!fBarLeakageExpCoefficient.IsValid()) {
260 GetScintillatorData(fBarLeakageExpCoefficient.Get(),
"barLeakageExpCoefficient",
261 "scintillator",
"exponential coefficient describing photon leakage at ends of bar");
262 fBarLeakageExpCoefficient.SetValid();
264 return fBarLeakageExpCoefficient.Get();
272 if (!fBarLeakageMaxRatio.IsValid()) {
273 GetScintillatorData(fBarLeakageMaxRatio.Get(),
"barLeakageMaxRatio",
"scintillator",
274 "maximum ratio of photon leakage at ends of bar");
275 fBarLeakageMaxRatio.SetValid();
277 return fBarLeakageMaxRatio.Get();
285 if (!fEffectiveRefractiveIndex.IsValid()) {
286 GetScintillatorData(fEffectiveRefractiveIndex.Get(),
"effectiveRefractiveIndex",
"scintillator",
"effective refractive index");
287 fEffectiveRefractiveIndex.SetValid();
289 return fEffectiveRefractiveIndex.Get();
297 if (!fReferencePENumber.IsValid()) {
298 GetScintillatorData(fReferencePENumber.Get(),
"referencePENumber",
"scintillator",
"non attenuated average number of PEs per VMIP");
299 fReferencePENumber.SetValid();
301 return fReferencePENumber.Get();
309 if (!fSigmaBarToBar.IsValid()) {
310 GetScintillatorData(fSigmaBarToBar.Get(),
"sigmaBarToBar",
"scintillator",
"standard deviation of bar-to-bar response");
311 fSigmaBarToBar.SetValid();
313 return fSigmaBarToBar.Get();
321 if (!fReferenceEnergy.IsValid()) {
322 GetScintillatorData(fReferenceEnergy.Get(),
"referenceEnergy",
"scintillator",
"average energy deposit per VMIP");
323 fReferenceEnergy.SetValid();
325 return fReferenceEnergy.Get();
334 err <<
"Did not find requested component: '" << msg
335 <<
"' for station = " << indexMap[
"stationId"];
341 fStationId(stationId)
348 indexMap[
"stationId"] = boost::lexical_cast<
string>(stationId);
349 indexMap[
"isUUB"] = boost::lexical_cast<
string>(isUUB);
358 det::Detector::GetInstance().GetSDetector().GetStation(
fStationId).GetLocalCoordinateSystem();
368 err <<
"Point is not within the active area (bars) of the scintillator.";
371 const double longLeg =
384 det::Detector::GetInstance().GetSDetector().GetStation(
fStationId).GetLocalCoordinateSystem();
394 err <<
"Point is not within the active area (bars) of the scintillator.";
407 const Line particleLine(particlePoint, particleDirection);
409 det::Detector::GetInstance().GetSDetector().GetStation(
fStationId).GetLocalCoordinateSystem();
416 const double gapLength =
GetGap();
420 const double width = 0.5*barCount * barWidth;
422 const double scintillatorPosition_X = position.
GetX(cs);
423 const double scintillatorPosition_Y = position.
GetY(cs);
426 const double limitX1_r = scintillatorPosition_X + 0.5*gapLength - halo;
427 const double limitX2_r = scintillatorPosition_X + 0.5*gapLength + barLength + halo;
428 const double limitX1_l = scintillatorPosition_X - 0.5*gapLength + halo;
429 const double limitX2_l = scintillatorPosition_X - 0.5*gapLength - barLength - halo;
431 const double limitY1 = scintillatorPosition_Y - 0.5*width - halo;
432 const double limitY2 = scintillatorPosition_Y + 0.5*width + halo;
434 const double x = where.GetX(cs);
435 const double y = where.GetY(cs);
436 if (limitX1_r < x && x < limitX2_r && limitY1 < y && y < limitY2)
438 if (limitX2_l < x && x < limitX1_l && limitY1 < y && y < limitY2)
450 det::Detector::GetInstance().GetSDetector().GetStation(
fStationId).GetLocalCoordinateSystem();
473 return hypot(maxX, maxY);
double GetBarLeakageExpCoefficient() const
utl::Validated< utl::Point > fPosition
bool IsHit(const utl::Point &from, const utl::Vector &direction, const double halo=0) const
CoordinateSystemPtr GetCoordinateSystem() const
Get the coordinate system of the current internal representation.
Status GetDataOrThrow(T &returnData, const std::string &component, const std::string &property, const IndexMap &index=IndexMap()) const
double GetBarExpDecayConstant() const
double GetReferenceEnergy() const
double GetHousingWidth() const
double GetRoofOffset() const
double GetAttenuationLength() const
Base class for exceptions trying to access non-existing components.
double GetFiberLength() const
double GetSandwichPanelThickness() const
Line Intersection(const Plane &p1, const Plane &p2)
Exception for reporting variable out of valid range.
std::vector< double > GetDistancesToPMT(const utl::Point &p) const
unsigned int GetNBars() const
double GetFiberUTurnDiameter() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class describing a Plane object.
double GetHousingThickness() const
std::pair< double, double > GetDistancesToBarEnds(const utl::Point &p) const
double GetX(const CoordinateSystemPtr &coordinateSystem) const
double abs(const SVector< n, T > &v)
double GetBarLength() const
double GetMaxRadius() const
double GetBarLeakageMaxRatio() const
void NotFoundAndThrow(const std::string &msg) const
double GetFiberExpDecayConstant() const
det::VManager::IndexMap indexMap
double GetY(const CoordinateSystemPtr &coordinateSystem) const
double GetCasingThickness() const
double GetReferencePENumber() const
double GetBarWidth() const
utl::Point GetPosition() const
Register for detector description managers.
double GetBarThickness() const
double GetHousingLength() const
double GetRoofThickness() const
void SetValid(const bool valid=true)
Scintillator(const int stationId, const unsigned int isUUB)
double GetSigmaBarToBar() const
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
double GetEffectiveRefractiveIndex() const
double GetMaxHeight() const
bool IsInsideBar(const utl::Point &p, const double halo=0) const