Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:09

0001 //--------------------------------------------------------------------------
0002 #ifndef HEPMC_HEAVY_ION_H
0003 #define HEPMC_HEAVY_ION_H
0004 
0005 //////////////////////////////////////////////////////////////////////////
0006 // garren@fnal.gov, February 2006
0007 //
0008 // Additional information storage for Heavy Ion generators
0009 //////////////////////////////////////////////////////////////////////////
0010 //
0011 //      int   Ncoll_hard          // Number of hard scatterings
0012 //      int   Npart_proj          // Number of projectile participants
0013 //      int   Npart_targ          // Number of target participants
0014 //      int   Ncoll               // Number of NN (nucleon-nucleon) collisions
0015 //      int   N_Nwounded_collisions        // Number of N-Nwounded collisions
0016 //      int   Nwounded_N_collisions        // Number of Nwounded-N collisons
0017 //      int   Nwounded_Nwounded_collisions // Number of Nwounded-Nwounded collisions
0018 //      int   spectator_neutrons           // Number of spectator neutrons
0019 //      int   spectator_protons            // Number of spectator protons
0020 //      float impact_parameter        // Impact Parameter(fm) of collision
0021 //      float event_plane_angle       // Azimuthal angle of event plane
0022 //      float eccentricity            // eccentricity of participating nucleons
0023 //                                        in the transverse plane
0024 //                                        (as in phobos nucl-ex/0510031)
0025 //      float sigma_inel_NN           // nucleon-nucleon inelastic
0026 //                                        (including diffractive) cross-section
0027 //      float centrality              // centrality (prcentile of geometric cross section)
0028 //
0029 //////////////////////////////////////////////////////////////////////////
0030 // Mar. 25, 2013: add centrality by request from Korinna Zapp
0031 // Feb. 17, 2006: adjust names according to suggestions from Heavy Ion users
0032 // Feb.  7, 2006: first pass at making method names consistent with existing
0033 //                HepMC code
0034 //////////////////////////////////////////////////////////////////////////
0035 
0036 #include <ostream>
0037 #include <istream>
0038 #include <utility>
0039 
0040 namespace HepMC {
0041 
0042 
0043   //! The HeavyIon class stores information about heavy ions
0044 
0045   ///
0046   /// \class  HeavyIon
0047   /// HepMC::HeavyIon provides
0048   /// additional information storage for Heavy Ion generators in GenEvent.
0049   /// Creation and use of this information is optional.
0050   ///
0051   class HeavyIon {
0052   public:
0053     // ---  birth/death:
0054     //
0055     /// default constructor
0056     HeavyIon()
0057       : m_Ncoll_hard(0),
0058         m_Npart_proj(0),
0059         m_Npart_targ(0),
0060         m_Ncoll(0),
0061         m_spectator_neutrons(0),
0062         m_spectator_protons(0),
0063         m_N_Nwounded_collisions(0),
0064         m_Nwounded_N_collisions(0),
0065         m_Nwounded_Nwounded_collisions(0),
0066         m_impact_parameter(0),
0067         m_event_plane_angle(0),
0068         m_eccentricity(0),
0069         m_sigma_inel_NN(0),
0070         m_centrality(-1.0)
0071     {}
0072 
0073     /// The first 6 values must be provided.
0074     HeavyIon( int nh, int np, int nt, int nc, int ns, int nsp,
0075               int nnw=0, int nwn=0, int nwnw=0,
0076               float im=0., float pl=0., float ec=0., float s=0.,
0077               float fc=0. );
0078 
0079     ~HeavyIon() {}
0080 
0081     // ---  copying:
0082     //
0083     HeavyIon( HeavyIon const & orig );  //!< copy constructor
0084     HeavyIon &  operator = ( HeavyIon const & rhs ); //!< make a copy
0085     void swap( HeavyIon & other );  //!< swap two HeavyIon objects
0086 
0087     // ---  equivalence:
0088     //
0089     bool    operator==( const HeavyIon& ) const; //!< check for equality
0090     bool    operator!=( const HeavyIon& ) const; //!< check for inequality
0091 
0092     // ---  accessors:
0093     /// Number of hard scatterings
0094     int   Ncoll_hard()                   const { return m_Ncoll_hard; }
0095     /// Number of projectile participants
0096     int   Npart_proj()                   const { return m_Npart_proj; }
0097     /// Number of target participants
0098     int   Npart_targ()                   const { return m_Npart_targ; }
0099     /// Number of NN (nucleon-nucleon) collisions
0100     int   Ncoll()                        const { return m_Ncoll; }
0101     /// Number of spectator neutrons
0102     int   spectator_neutrons()           const { return m_spectator_neutrons; }
0103     /// Number of spectator protons
0104     int   spectator_protons()            const { return m_spectator_protons; }
0105     /// Number of N-Nwounded collisions
0106     int   N_Nwounded_collisions()        const { return m_N_Nwounded_collisions; }
0107     /// Number of Nwounded-N collisons
0108     int   Nwounded_N_collisions()        const { return m_Nwounded_N_collisions; }
0109     /// Number of Nwounded-Nwounded collisions
0110     int   Nwounded_Nwounded_collisions() const { return m_Nwounded_Nwounded_collisions; }
0111     /// Impact Parameter(in fm) of collision
0112     float impact_parameter()             const { return m_impact_parameter; }
0113     /// Azimuthal angle of event plane
0114     float event_plane_angle()            const { return m_event_plane_angle; }
0115     /// eccentricity of participating nucleons in the transverse plane 
0116     /// (as in phobos nucl-ex/0510031)
0117     float eccentricity()                 const { return m_eccentricity;  }
0118     /// nucleon-nucleon inelastic (including diffractive) cross-section
0119     float sigma_inel_NN()                const { return m_sigma_inel_NN; }
0120     /// centrality (percentile of geometric cross section. Negaitve if not set.)
0121     float centrality()                const { return m_centrality; }
0122 
0123     /// verify that the instance contains non-zero information
0124     bool  is_valid()                     const;
0125 
0126   // ---  mutators:
0127     /// set number of hard scatterings
0128     void   set_Ncoll_hard(const int &i)              { m_Ncoll_hard=i; }
0129     /// set number of projectile participants
0130     void   set_Npart_proj(const int &i)              { m_Npart_proj=i; }
0131     /// set number of target participants
0132     void   set_Npart_targ(const int &i)              { m_Npart_targ=i; }
0133     /// set number of NN (nucleon-nucleon) collisions
0134     void   set_Ncoll(const int &i)                   { m_Ncoll=i; }
0135     /// set number of spectator neutrons
0136     void   set_spectator_neutrons(const int &i)      { m_spectator_neutrons=i; }
0137     /// set number of spectator protons
0138     void   set_spectator_protons(const int &i)       { m_spectator_protons=i; }
0139     /// set number of N-Nwounded collisions
0140     void   set_N_Nwounded_collisions(const int &i)   { m_N_Nwounded_collisions=i; }
0141     /// set number of Nwounded-N collisons
0142     void   set_Nwounded_N_collisions(const int &i)   { m_Nwounded_N_collisions=i; }
0143     /// set number of Nwounded-Nwounded collisions
0144     void   set_Nwounded_Nwounded_collisions(const int &i) 
0145                                           { m_Nwounded_Nwounded_collisions=i; }
0146     /// set Impact Parameter in fm
0147     void   set_impact_parameter(const float &f)      { m_impact_parameter=f; }
0148     /// set azimuthal angle of event plane
0149     void   set_event_plane_angle(const float &f)     { m_event_plane_angle=f; }
0150     /// set eccentricity of participating nucleons in the transverse plane 
0151     void   set_eccentricity(const float &f)          { m_eccentricity=f;  }
0152     /// set nucleon-nucleon inelastic cross-section
0153     void   set_sigma_inel_NN(const float &f)         { m_sigma_inel_NN=f; }
0154     /// set centrality percentile [0:100]
0155     void   set_centrality(const float &f)         { m_centrality=f; }
0156 
0157 private: // data members
0158     int   m_Ncoll_hard; 
0159     int   m_Npart_proj; 
0160     int   m_Npart_targ;
0161     int   m_Ncoll;
0162     int   m_spectator_neutrons;
0163     int   m_spectator_protons;
0164     int   m_N_Nwounded_collisions;
0165     int   m_Nwounded_N_collisions;
0166     int   m_Nwounded_Nwounded_collisions;
0167     float m_impact_parameter;
0168     float m_event_plane_angle;
0169     float m_eccentricity; 
0170     float m_sigma_inel_NN;
0171     float m_centrality;
0172 
0173 };
0174 
0175 // Free Functions
0176 
0177 /// Write the contents of HeavyIon to an output stream.
0178 std::ostream & operator << (std::ostream &, HeavyIon const *);
0179 /// Read the contents of HeavyIon from an input stream.
0180 std::istream & operator >> (std::istream &, HeavyIon *);
0181 
0182 // inline operators
0183   /// Required members are
0184   /// the number of hard scatterings,
0185   /// the number of projectile participants.
0186   /// the number of target participants.
0187   /// the number of nucleon-nucleon collisions,
0188   /// the number of spectator neutrons, and
0189   /// the number of spectator protons.
0190   inline HeavyIon::HeavyIon( int nh, int np, int nt, int nc, int ns, int nsp,
0191                              int nnw, int nwn, int nwnw,
0192                              float im, float pl, float ec, float s, float c )
0193     : m_Ncoll_hard(nh),
0194       m_Npart_proj(np),
0195       m_Npart_targ(nt),
0196       m_Ncoll(nc),
0197       m_spectator_neutrons(ns),
0198       m_spectator_protons(nsp),
0199       m_N_Nwounded_collisions(nnw),
0200       m_Nwounded_N_collisions(nwn),
0201       m_Nwounded_Nwounded_collisions(nwnw),
0202       m_impact_parameter(im),
0203       m_event_plane_angle(pl),
0204       m_eccentricity(ec),
0205       m_sigma_inel_NN(s),
0206       m_centrality(c)
0207   {}
0208 
0209 inline HeavyIon::HeavyIon( HeavyIon const & orig )
0210     : m_Ncoll_hard(orig.m_Ncoll_hard), 
0211       m_Npart_proj(orig.m_Npart_proj),
0212       m_Npart_targ(orig.m_Npart_targ),
0213       m_Ncoll(orig.m_Ncoll),
0214       m_spectator_neutrons(orig.m_spectator_neutrons),
0215       m_spectator_protons(orig.m_spectator_protons),
0216       m_N_Nwounded_collisions(orig.m_N_Nwounded_collisions),
0217       m_Nwounded_N_collisions(orig.m_Nwounded_N_collisions),
0218       m_Nwounded_Nwounded_collisions(orig.m_Nwounded_Nwounded_collisions),
0219       m_impact_parameter(orig.m_impact_parameter),
0220       m_event_plane_angle(orig.m_event_plane_angle),
0221       m_eccentricity(orig.m_eccentricity),
0222       m_sigma_inel_NN(orig.m_sigma_inel_NN),
0223       m_centrality(orig.m_centrality)
0224   {}
0225 
0226   inline HeavyIon &  HeavyIon::operator = ( HeavyIon const & rhs )
0227   {
0228     HeavyIon temp( rhs );
0229     swap( temp );
0230     return *this;
0231   }
0232 
0233   inline void HeavyIon::swap( HeavyIon & other )
0234   {
0235     std::swap(m_Ncoll_hard, other.m_Ncoll_hard);
0236     std::swap(m_Npart_proj, other.m_Npart_proj);
0237     std::swap(m_Npart_targ, other.m_Npart_targ);
0238     std::swap(m_Ncoll, other.m_Ncoll);
0239     std::swap(m_N_Nwounded_collisions, other.m_N_Nwounded_collisions);
0240     std::swap(m_Nwounded_N_collisions, other.m_Nwounded_N_collisions);
0241     std::swap(m_Nwounded_Nwounded_collisions, other.m_Nwounded_Nwounded_collisions);
0242     std::swap(m_spectator_neutrons, other.m_spectator_neutrons);
0243     std::swap(m_spectator_protons, other.m_spectator_protons);
0244     std::swap(m_impact_parameter, other.m_impact_parameter);
0245     std::swap(m_event_plane_angle, other.m_event_plane_angle);
0246     std::swap(m_eccentricity, other.m_eccentricity);
0247     std::swap(m_sigma_inel_NN, other.m_sigma_inel_NN);
0248     std::swap(m_centrality, other.m_centrality);
0249   }
0250 
0251   inline bool    HeavyIon::operator==( const HeavyIon& a ) const {
0252     /// equality requires that each member match
0253     return ( a.Ncoll_hard() == this->Ncoll_hard()
0254              && a.Npart_proj() == this->Npart_proj()
0255              && a.Npart_targ() == this->Npart_targ()
0256              && a.Ncoll() == this->Ncoll()
0257              && a.N_Nwounded_collisions() == this->N_Nwounded_collisions()
0258              && a.Nwounded_N_collisions() == this->Nwounded_N_collisions()
0259              && a.Nwounded_Nwounded_collisions() == this->Nwounded_Nwounded_collisions()
0260              && a.spectator_neutrons() == this->spectator_neutrons()
0261              && a.spectator_protons() == this->spectator_protons()
0262              && a.impact_parameter() == this->impact_parameter()
0263              && a.event_plane_angle() == this->event_plane_angle()
0264              && a.eccentricity() == this->eccentricity()
0265              && a.sigma_inel_NN() == this->sigma_inel_NN()
0266              && a.centrality() == this->centrality() );
0267   }
0268 
0269 inline bool    HeavyIon::operator!=( const HeavyIon& a ) const
0270 {
0271     /// any nonmatching member generates inequality
0272     return !( a == *this );
0273 }
0274 
0275 inline bool  HeavyIon::is_valid() const
0276 {
0277     if( m_Ncoll_hard != 0 ) return true;
0278     if( m_Npart_proj != 0 ) return true;
0279     if( m_Npart_targ != 0 ) return true;
0280     if( m_Ncoll != 0 ) return true;
0281     if( m_spectator_neutrons != 0 ) return true;
0282     if( m_spectator_protons != 0 ) return true;
0283     if( m_N_Nwounded_collisions != 0 ) return true;
0284     if( m_Nwounded_N_collisions != 0 ) return true;
0285     if( m_Nwounded_Nwounded_collisions != 0 ) return true;
0286     if( m_impact_parameter != 0 ) return true;
0287     if( m_event_plane_angle != 0 ) return true;
0288     if( m_eccentricity != 0 ) return true;
0289     if( m_sigma_inel_NN != 0 ) return true;
0290     if( m_centrality >= 0 ) return true;
0291     return false;
0292 }
0293 
0294 } // HepMC
0295 
0296 #endif  // HEPMC_HEAVY_ION_H