Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:02:05

0001 /**
0002  \file
0003  Declaration of class ParticleIdentifier.
0004  
0005  \author    Thomas Burton
0006  \date      2011-10-10
0007  \copyright 2011 Brookhaven National Lab
0008  */
0009 
0010 #ifndef INCLUDE_EICSMEAR_ERHIC_PARTICLEIDENTIFIER_H_
0011 #define INCLUDE_EICSMEAR_ERHIC_PARTICLEIDENTIFIER_H_
0012 
0013 #include <cmath>
0014 #include <limits>
0015 #include <vector>
0016 
0017 #include "eicsmear/erhic/BeamParticles.h"
0018 #include "eicsmear/erhic/Particle.h"
0019 #include "eicsmear/erhic/VirtualEvent.h"
0020 
0021 /**
0022  Implements methods to identify particles based on their species and status
0023  codes.
0024  */
0025 class ParticleIdentifier {
0026  public:
0027   /**
0028    Default constructor.
0029    Initialise with the PDG code of the lepton beam.
0030    The default is an invalid value.
0031    */
0032   ParticleIdentifier(const int leptonPdg = ~unsigned(0)/2);
0033 
0034   virtual ~ParticleIdentifier() { }
0035 
0036   /**
0037    Returns whether the particle is the beam lepton.
0038    */
0039   virtual bool isBeamLepton(const erhic::VirtualParticle&) const;
0040 
0041   /**
0042    Returns whether the particle is the beam hadron.
0043    */
0044   virtual bool isBeamNucleon(const erhic::VirtualParticle&) const;
0045 
0046   /**
0047    Returns whether the particle is the scattered lepton beam particle.
0048    */
0049   virtual bool isScatteredLepton(const erhic::VirtualParticle&) const;
0050 
0051   /**
0052    Returns whether the particle is a virtual photon.
0053    */
0054   virtual bool IsVirtualPhoton(const erhic::VirtualParticle&) const;
0055 
0056   /**
0057    Returns whether the particles should be skipped by the tree building code.
0058    */
0059   virtual bool SkipParticle(const erhic::VirtualParticle&) const;
0060 
0061   /**
0062    Sets the PDG code to use when identifying the lepton beam.
0063    */
0064   virtual void SetLeptonBeamPdgCode(int pdg);
0065 
0066   /**
0067    Returns the PDG code to use when identifying the lepton beam.
0068    */
0069   virtual int GetLeptonBeamPdgCode() const;
0070 
0071   /**
0072    Look for charged current events.
0073    
0074    In this case, the scattered lepton searched for will be the neutrino
0075    corresponding to the incident lepton beam type (e.g. W- for electron,
0076    W+ for proton).
0077    */
0078   virtual bool SetChargedCurrent(bool isChargedCurrent);
0079 
0080   /**
0081    Identify the beams from an event and store their properties in a
0082    BeamParticles object.
0083    See BeamParticles.h for the quantities stored.
0084    Returns true if all beams are found, false if not.
0085    Important: finding the scattered hadron beam is not implemented.
0086    */
0087   static bool IdentifyBeams(const erhic::VirtualEvent&, BeamParticles&);
0088 
0089   /**
0090    Identify the beams from an event and store their properties in a
0091    vector of pointers to the particle objects in the event.
0092    Do not delete the pointers, as they belong to the event.
0093    The returned vector has four entries, in this order: incident lepton,
0094    incident hadron, exchanged boson, scattered lepton.
0095    Any particle not found yields a NULL pointer in the vector.
0096    Returns true if all beams are found (i.e. no NULL pointers), false if not.
0097    Important: finding the scattered hadron beam is not implemented.
0098    */
0099   static bool IdentifyBeams(const erhic::VirtualEvent&,
0100                             std::vector<const erhic::VirtualParticle*>&);
0101 
0102  protected:
0103   /**
0104    Determine the scattered lepton type from an incident lepton type.
0105    
0106    For neutral current events these are equal.
0107    For charged current events the scattered lepton will be a neutrino, the
0108    type of which depends on the incident lepton type e.g.
0109    beam electron (11) --> scattered nu_e (12)
0110    beam positron (-11) --> scattered nu_e_bar (-12)
0111    Even though we would not envisage mu or tau beams (!) the algorithm is
0112    still robust for these inputs.
0113    */
0114   Int_t DetermineScatteredType(Int_t);
0115 
0116   Bool_t mChargedCurrent;
0117   Int_t mLeptonBeamPdgCode;
0118   Int_t mScatteredPdgCode;
0119 };
0120 
0121 inline int ParticleIdentifier::GetLeptonBeamPdgCode() const {
0122   return mLeptonBeamPdgCode;
0123 }
0124 
0125 #endif  // INCLUDE_EICSMEAR_ERHIC_PARTICLEIDENTIFIER_H_