#ifndef _sevt_StationSimData_h_ #define _sevt_StationSimData_h_ #include #include #include #include //#include #include #include #include #include static const char CvsId_sevt_StationSimData[] = "$Id$"; namespace sevt { class StationGPSData; class StationTriggerData; /*! \class StationSimData StationSimData.h "sevt/StationSimData.h" \brief %Station Level Simulated Data \author Stefano Argiro' \author Darko Veberic \date 28 january 2003 \version $Id$ \ingroup sevt */ class StationSimData { private: typedef std::pair, utl::ShadowPtr > TriggerGPSPair; typedef std::map TriggerGPSMap; typedef TriggerGPSMap::iterator TriggerGPSMapIterator; typedef TriggerGPSMap::const_iterator ConstTriggerGPSMapIterator; public: typedef std::vector ParticleVector; typedef ParticleVector::iterator ParticleIterator; typedef ParticleVector::const_iterator ConstParticleIterator; /// Beginning of simulated particles entering the station ParticleIterator ParticlesBegin() { return fParticles.begin(); } ConstParticleIterator ParticlesBegin() const { return fParticles.begin(); } /// End of simulated particles entering the station ParticleIterator ParticlesEnd() { return fParticles.end(); } ConstParticleIterator ParticlesEnd() const { return fParticles.end(); } unsigned int GetNParticles() const { return fParticles.size(); } /// Add a simulated particle to the station void AddParticle(const utl::Particle& particle) { ++fTotalParticleCount; CountMuons(particle); // keep this decision inline if (fThinning == 1) AlwaysInsertParticle(particle); else SometimesInsertParticle(particle); if (fParticles.size() >= fMaxNParticles) Shrink(); } /// Clear the station particle list void ClearParticleList(); /// Get the number of muons that entered the station unsigned int GetNumberOfMuons() const { return fNumberOfMuons; } void SetNumberOfMuons(const unsigned int n) { fNumberOfMuons = n; } /// Get the total number of particles that entered the station unsigned int GetTotalParticleCount() const { return fTotalParticleCount; } void SetTotalParticleCount(const unsigned int n) { fTotalParticleCount = n; } unsigned int GetMaxNParticles() const { return fMaxNParticles; } void SetMaxNParticles(const unsigned int max) { fMaxNParticles = max; } double GetThinning() const { return fThinning; } void SetThinning(const double th) { fThinning = th; } double GetUsedWeight() const { return fUsedWeight; } void SetUsedWeight(const double w) { fUsedWeight = w; } /// Get Shower front plane arrival time const utl::TimeStamp& GetPlaneFrontTime() const { return fTime; } /// Set shower front plane arrival time void SetPlaneFrontTime(const utl::TimeStamp& time) { fTime = time; } /// Set name of the tank simulator module used to simulate this station /*! The Simulator signature must be set by the tank simulator. If it is not, the SdSimCalibrationFiller will fail */ void SetSimulatorSignature(const std::string& name) { fSimulatorSignature = name; } /// Get name of the tank simulator module used to simulate this station const std::string& GetSimulatorSignature() const; /// Check whether the station is in the shower hole. /*! For some air shower simulations there is a cut on the minimum distance from the core for which shower particles are simulated. This flag indicates if a station falls in this region. See also evt::ShowerSimData::GetMinRadiusCut() */ bool IsInsideMinRadius() const { return fHoleStation; } /// Set flag indicating whether station is in the shower hole /*! see also IsInsideMinRadius() */ void SetIsInsideMinRadius(const bool isIn = true) { fHoleStation = isIn; } typedef utl::MapKeyIterator TriggerTimeIterator; typedef TriggerTimeIterator ConstTriggerTimeIterator; // for backwards compatibility /// Beginning of simulated local trigger times list TriggerTimeIterator TriggerTimesBegin() const { return fTriggerAndGPSData.begin(); } /// End of simulated local trigger times list TriggerTimeIterator TriggerTimesEnd() const { return fTriggerAndGPSData.end(); } /// Check whether there is trigger data at the given time bool HasTriggerData(const utl::TimeStamp& time) const { return HasGPSData(time); } /// Check whether there is a GPS data at the given time bool HasGPSData(const utl::TimeStamp& time) const; /// Get simulated GPSData StationGPSData& GetGPSData(const utl::TimeStamp& time); const StationGPSData& GetGPSData(const utl::TimeStamp& time) const; /// Creates the trigger data at the given time and also the GPS data to guarantee they are both created void MakeTriggerAndGPSData(const utl::TimeStamp& time); /// Get simulated TriggerData StationTriggerData& GetTriggerData(const utl::TimeStamp& time); const StationTriggerData& GetTriggerData(const utl::TimeStamp& time) const; private: StationSimData(); ~StationSimData() { } void AlwaysInsertParticle(const utl::Particle& particle) { fParticles.push_back(particle); } void SometimesInsertParticle(const utl::Particle& particle); void CountMuons(const utl::Particle& particle) { if (particle.GetType() == utl::Particle::eMuon || particle.GetType() == utl::Particle::eAntiMuon) ++fNumberOfMuons; } void Shrink(); utl::TimeStamp fTime; bool fHoleStation; std::string fSimulatorSignature; ParticleVector fParticles; //TriggerTimeVector fTriggerTimes; TriggerGPSMap fTriggerAndGPSData; unsigned int fNumberOfMuons; unsigned int fTotalParticleCount; unsigned int fMaxNParticles; double fThinning; double fUsedWeight; friend class Station; friend class utl::ShadowPtr; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: