#ifndef _rdet_Channel_h_ #define _rdet_Channel_h_ #include #include #include #include #include #include #include #include #include #include namespace rdet { /** \class Channel \brief Detector description interface for Channel-related data \author T. Paul \author J. Rautenberg \date 4 March 2003 \date June 2009 \version $Id$ \ingroup rdet */ class Channel { public: /// return ID of the Channel int GetId() const { return fChannelId; } /// Channel Ok flag (1 if the currently cached data are up to date, 0 if currently cached data are obsolete) int GetOkFlag() const; //RChannel part of RModelConfig /// Get design value of the freq-band double GetDesignLowerFreq() const; /// Get design value of the freq-band double GetDesignUpperFreq() const; /// Get zenith-direction of Antenna for this Channel double GetOrientationZenith() const; /// Get azimuth-direction of Antenna for this Channel double GetOrientationAzimuth() const; /// Get zeta-tilt of Antenna for this Channel double GetOrientationZeta() const; /// Get Position of this Antenna-Channel const utl::Point& GetPosition() const; /// Get description of Channel Type const std::string& GetChannelType() const; /* /// Get complex global response, tabulated in freq. is calculated in run-time by Module const utl::TabulatedFunctionComplexLgAmpPhase& GetGlobalResponse() const { return *fGlobalResponse; } */ /// Get description of Antenna-Type const std::string& GetAntennaTypeName() const; //RADC part of RModelConfig /// Get description of ADC-Type const std::string& GetADCType() const; /// Get number of bits of ADC int GetBitDepth() const; /// Get sampling Frequency of ADC (unit?) double GetSamplingFrequency() const; /// Get voltage corresponding to 0 counts double GetMinVoltage() const; /// Get voltage corresponding to max number of counts double GetMaxVoltage() const; /// Get DesignImpediance of Antenna-Type double GetDesignImpedance() const; /// Get IntegratedHorizontalGain of Antenna-Type double GetIntegratedHorizontalGain() const; /// Get IntegratedVerticalGain of Antenna-Type double GetIntegratedVerticalGain() const; /** Get GetElectricFieldResponse returns the response of the antenna belonging to this channel for a certain incoming direction of the wave (theta, phi) (Poynting vector) at a certain frequency f. The antenna has to be thought of to be placed in the center of the corresponding spherical coordinate system. This function will take into account the orientation of the antenna in azimuth properly. When the antenna is tilted in zenith, this is allowed as well. However, note that the gain pattern of the antenna is changing when the antenna is tilted, which cannot be taken into account properly by this function. The returned result is (H_theta,H_phi), the effective antenna height, where the response has already been transferred into the 50Ohm System. */ std::pair, std::complex > GetElectricFieldResponse(const double fTheta, const double fPhi, const double fFreq, std::string interpolationMode) const; double GetIntegratedEffectiveAntennaHeight(const double fFreq) const; /// Get the ResponseMap of the Channel const utl::ResponseMap& GetResponseMap() const; /// Get a TabulatedFunction with calibration factors for the frequency bins of the Channel, not yet implemented const utl::TabulatedFunction& GetCalibrationFunction() const; #ifdef WITH_CUDA void PatternToTexture() const; void freeTexture() const; void GetElectricFieldResponses(double zenith, double azimuth, double* freqs, int N, std::string fInterpolationMode, std::pair, std::complex > *channelResponses) const; #endif private: Channel(const int stationId, const int ChannelId); ~Channel(); // don't forget to delete all the pointer member objects in the destructor! Channel(const Channel&); // copy constructor is private so that no copy of a channel can be made (would need deep-copying) Channel& operator=(const Channel&); // assignment operator is private so that no copy of a channel can be made (would need deep-copying) void Update() const; std::string fStationIdString; std::string fChannelIdString; int fChannelId; // general Channel characteristics: mutable utl::Validated fChannelOk; // Channel OK flag mutable utl::Validated fDesignLowerFreq; // design value of the freq-band mutable utl::Validated fDesignUpperFreq; // design value of the freq-band mutable utl::Validated fOrientationZenith; // zenith-direction of Antenna for this Channel mutable utl::Validated fOrientationAzimuth; // azimuth-direction of Antenna for this Channel mutable utl::Validated fOrientationZeta; // zeta-tilt of Antenna for this Channel mutable utl::Validated fPosition; // Position of channel Ref.Point. wrt. Station Ref.Point mutable utl::Validated fChannelType; // Type of Channel // coming from the ADC: mutable utl::Validated fADCType; // description of ADC-Type mutable utl::Validated fBitDepth; // number of bits of ADC mutable utl::Validated fSamplingFrequency; // sampling Frequency of ADC mutable utl::Validated fMinVoltage; mutable utl::Validated fMaxVoltage; // coming from the Antenna_type: mutable utl::Validated fAntennaTypeName; // description of Antenna-Type mutable utl::Validated fDesignImpedance; mutable utl::Validated fIntegratedHorizontalGain; mutable utl::Validated fIntegratedVerticalGain; mutable utl::Validated fResponseMap; // table detailing the detector responses and their weights // mutable utl::TabulatedFunctionComplexLgAmpPhase* fGlobalResponse; // complex global response, tabulated in freq. // reference_phase map postponed or put into calibration // this is the antenna belonging to this channel AntennaType* fAntenna; friend class Station; // Helper method to do the redundant work of preparing requests for Channel data, // sending it to the manager and reporting any errors. template const T& GetChannelData(utl::Validated& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg) const { // std::cout << "requesting data in RDetector::RChannel for station " // << fStationIdString << " and channel " << fChannelIdString << std::endl; if (!requestedData.IsValid()) { det::VManager::IndexMap indexMap; indexMap["station"] = fStationIdString; indexMap["channel"] = fChannelIdString; const det::VManager& manager = ::det::Detector::GetInstance().GetRManagerRegister(); const det::VManager::Status foundFlag = manager.GetData(requestedData.Get(), property, component, indexMap); if (foundFlag == det::VManager::eNotFound) NotFoundAndExit(errorMsg); requestedData.SetValid(); } else { // std::cout << "RDet::Channel::GetChannelData: requested data is already valid for station " // << fStationIdString << " and channel " << fChannelIdString << std::endl; } return requestedData.Get(); } void NotFoundAndExit(const std::string& msg) const; }; } #endif //_rdet_Channel_h_