#ifndef _INCLUDE_CORSIKA_MPARTICLE_ #define _INCLUDE_CORSIKA_MPARTICLE_ #include #include #include #include #include #include namespace crs { /** \class MParticle \brief CORSIKA particle data One CORSIKA particle. \author Ralf Ulrich \date Thu Feb 3 13:04:50 CET 2005 \version $Id: MParticle.h 5116 2016-01-04 19:09:04Z darko $ */ class MParticle : public TParticleBlockEntry, public IParticleReadout { public: MParticle (const CREAL *data, bool thinned); MParticle (const TParticleBlockEntry &p); virtual void Dump () const; public: CREAL GetWeight () const {return (fThinned ? ValueAt (7) : 1);} virtual std::string GetParticleName () const; private: inline CREAL ValueAt (int i) const {return fData [i];} }; //std::ostream &operator<< (std::ostream &o, const TParticle &p); inline std::ostream &operator<< (std::ostream &o, const MParticle &p) { float P = p.GetPx ()*p.GetPx (); P += p.GetPy ()*p.GetPy (); P += p.GetPz ()*p.GetPz (); P = std::sqrt (P); o << " part: " << p.GetParticleId() << " \'" << p.GetParticleName () << "\'" << " obs.level: " << p.GetObservationLevel () << " gener.: " << p.GetHadronicGeneration () << " E/GeV: " << p.GetKinEnergy () << " theta/deg: " << std::acos (p.GetPz ()/P)*180./3.141 << " (x|y)/m: (" << p.GetX ()/100. << "|" << p.GetY ()/100. << ")" << " T/ns: " << p.GetTime () << " w: " << p.GetWeight (); return o; } }; #endif