#ifndef _sdet_Station_h_ #define _sdet_Station_h_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace sevt { class PMT; } namespace sdet { class PMT; /** \class Station Station.h sdet/Station.h \brief Detector description interface for Station-related data \author T. Paul \version $Id: Station.h 22125 2012-10-30 00:17:39Z darko $ \ingroup sdet */ class Station { private: typedef std::vector InternalPMTVector; typedef InternalPMTVector::const_iterator InternalPMTIterator; struct InternalPartnerStationFunctor { const sdet::Station& operator()(const int stationId) const; }; // These constants are to be read from external file .... // all code that uses them must be changed accordingly // static const unsigned int kFirstPMTId = 1; static const unsigned int kLastPMTId = 3; static const unsigned int kNPMTs = 3; static const unsigned int kFADCTraceLength = 768; static const double kFADCBinSize; public: /// Id of first pmt in station static unsigned int GetFirstPMTId() { return kFirstPMTId; } /// Id Of last PMT in station static unsigned int GetLastPMTId() { return kLastPMTId; } /// Number of pmts in station static unsigned int GetNPMTs() { return kNPMTs; } /// Length of FADC trace static unsigned int GetFADCTraceLength() { return kFADCTraceLength; } /// size of FADC bin in ns static double GetFADCBinSize() { return kFADCBinSize; } template static const std::vector& GetMuonPeakHistogramBinning(); template static const std::vector& GetMuonChargeHistogramBinning(); template static const std::vector& GetBaselineHistogramBinning(); static const std::vector& GetMuonShapeHistogramBinning(const int calibrationVersion); /// Station name const std::string& GetName() const; /// Station ID int GetId() const { return fId; } /// PMTIterator returns a pointer to a PMT typedef boost::indirect_iterator PMTIterator; /// Beginning of the collection of pointers to PMTs PMTIterator PMTsBegin() const { return PMTIterator(fPMTVector.begin()); } /// End of the collection of pointers to PMTs PMTIterator PMTsEnd() const { return PMTIterator(fPMTVector.end()); } /// PartnerIterator returns a pointer to a station typedef boost::transform_iterator::const_iterator, const sdet::Station&> PartnerIterator; /// Beginning of the collection of Partners in multiplet PartnerIterator PartnersBegin() const { return PartnerIterator(SetPartnerIds().begin()); } /// End of the collection of Partners in multiplet PartnerIterator PartnersEnd() const { return PartnerIterator(SetPartnerIds().end()); } /// Number of partners the station has int GetNumberOfPartners() const; /// returns vector of partner station ids const std::vector& GetPartnerIds() const { return SetPartnerIds(); } /// returns unique identifier of a group of stations or zero (if single) int GetGroupId() const; /// Station commission time const utl::TimeStamp& GetCommissionTime() const { return GetCommissionTimeRange().GetStartTime(); } /// Station decommission time const utl::TimeStamp& GetDecommissionTime() const { return GetCommissionTimeRange().GetStopTime(); } /// Station commission time range const utl::TimeRange& GetCommissionTimeRange() const; typedef std::vector StationIdCollection; /// Returns a list of station id's in the crown. If the argument is 0, it returns the station id. const StationIdCollection& GetCrown(const int level) const; /// Radius of the tank (water only) /*! Simulations use this to set the radius of the cylinder of water used. The thickness of the tank resin is not included in this number, and should be taken from Station::GetThickness() */ double GetRadius() const; /// Height of the tank (water only) /*! Simulations use this to set the height of the cylinder of water used. The thickness of the tank resin is not included in this number, and should be taken from Station::GetThickness() */ double GetHeight() const; /// Thickness of the tank walls double GetThickness() const; /// Tank position in Site Cartesian Coordinates //const utl::Point& GetPosition() const; // temporary solution for detector creeping (bug #307) utl::Point GetPosition() const; /// Get the Auger reference system centered on the tank utl::CoordinateSystemPtr GetLocalCoordinateSystem() const; /// Water absorption length as a function of photon energy const utl::TabulatedFunction& GetWaterAbsorptionLength() const; /// Water refraction index as a function of photon energy const utl::TabulatedFunction& GetWaterRefractionIndex() const; /// Tyvek liner reflectivity as a function of photon energy const utl::TabulatedFunction& GetLinerReflectivity() const; /// Tyvek liner sigma_alpha roughness parameter /*! This parameter is the width of the distribution of the angles between microfacet normals and the average surface normal. This characterizes the average roughness of the tyvek and can be used as an input to optical models that describe the amount of specular reflection */ double GetLinerSigmaAlpha() const; /// Tyvek liner specular lobe constant as a function of photon energy const utl::TabulatedFunction& GetLinerSpecularLobe() const; /// Tyvek liner specular spike constant as a function of photon energy const utl::TabulatedFunction& GetLinerSpecularSpike() const; /// Tells whether the station is in the regular triangular grid. bool IsInGrid(const SDetectorConstants::GridIndex index = SDetectorConstants::eStandard) const; /// Tells whether the station belongs to set of hypothetical "dense" stations /*! So-called "dense" stations can be placed in different locations for each event in order to, for example, sample the shower at 1000 m from the core in the shower coordinate system */ bool IsDense() const { return fDense; } bool IsInEngineeringArray() const { return fId < 71; } const std::vector& GetAxes() const; bool IsHit(const utl::Point& from, const utl::Vector& direction, utl::Point& where) const; bool IsInsideStation(const utl::Point& pos) const; // ------------------ // Dynamic quantities // ------------------ /// Station in data acquisition bool IsInAcquisition() const; /*/// Station livetime double GetLiveTime() const; /// Signal decay time for the station double GetSignalDecayTime() const; /// Error on signal decay time double GetSignalDecayTimeError() const; /// average T1 rate double GetT1Rate() const; /// average T2 rate double GetT2Rate() const; /// average TOT rate double GetTOTRate() const;*/ // --------------------- // Station subcomponents // --------------------- /// Get specified PMT by id const PMT& GetPMT(const int id) const; /// Get sdet::PMT from an sevt::PMT const PMT& GetPMT(const sevt::PMT& pmt) const; private: typedef std::map InternalCrownCollection; Station(const int id); ~Station(); Station(const Station&); Station operator=(const Station&); void Update() const; const std::vector& SetPartnerIds() const; /** Helper method to do the redundant work of preparing requests for station data, sending it to the manager and reporting any errors. The errorMsg argument is used to construct some hopefully meaningful error message if the requested component is not found. It should have a description in some human language of what was not located. */ template det::VManager::Status GetStationData(T& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg, const bool throwOnFailure = true) const { det::VManager::IndexMap indexMap; indexMap["stationId"] = fStationIdString; const det::VManager& manager = det::Detector::GetInstance().GetSManagerRegister(); const det::VManager::Status status = manager.GetData(requestedData, property, component, indexMap); if (throwOnFailure && status == det::VManager::eNotFound) NotFoundAndThrow(errorMsg); return status; } void NotFoundAndThrow(const std::string& msg) const; // int fId; // station id held as a string as that is what is passed through the // detector manager interface std::string fStationIdString; InternalPMTVector fPMTVector; mutable utl::Validated > fPartnerIds; mutable utl::Validated > fAxes; // Quantities filled by lazy evaluation // ------------------------------------ mutable utl::Validated fName; typedef std::bitset InGridType; mutable utl::Validated< InGridType > fInGrid; mutable utl::Validated fRadius; mutable utl::Validated fHeight; mutable utl::Validated fThickness; mutable InternalCrownCollection fCrowns; protected: mutable utl::CoordinateSystemPtr fReferenceSystem; mutable utl::Validated fPosition; private: // used in UTM conversions mutable utl::ReferenceEllipsoid::EllipsoidID fEllipsoid; mutable utl::ShadowPtr fWaterAbsLength; mutable utl::ShadowPtr fWaterRefractionIndex; mutable utl::ShadowPtr fLinerReflectivity; mutable utl::Validated fLinerSigmaAlpha; mutable utl::ShadowPtr fLinerSpecularLobe; mutable utl::ShadowPtr fLinerSpecularSpike; mutable utl::Validated fIsInAcquisition; /*mutable utl::Validated fLiveTime; mutable utl::Validated fSignalDecayTime; mutable utl::Validated fT1Rate; mutable utl::Validated fT2Rate; mutable utl::Validated fTOTRate; */ mutable utl::Validated fGroupId; mutable utl::Validated fCommissionTimeRange; bool fDense; friend class SDetector; }; template const std::vector& Station::GetMuonPeakHistogramBinning() { static std::vector muPeak; if (muPeak.empty()) { muPeak.reserve(150+1); for (short i = 0; i < 100; ++i) muPeak.push_back(i); for (short i = 0; i <= 50; ++i) muPeak.push_back(100 + 3*i); } return muPeak; } template const std::vector& Station::GetMuonChargeHistogramBinning() { static std::vector muCharge; if (muCharge.empty()) { muCharge.reserve(600+1); for (short i = 0; i < 400; ++i) muCharge.push_back(i); for (short i = 0; i <= 200; ++i) muCharge.push_back(400 + 3*i); } return muCharge; } template const std::vector& Station::GetBaselineHistogramBinning() { static std::vector baseHisto; if (baseHisto.empty()) { baseHisto.reserve(20+1); for (short i = 0; i <= 20; ++i) baseHisto.push_back(i); } return baseHisto; } } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // End: