Main Page | Compound List | File List | Compound Members | File Members | Related Pages

McIntegratingHit Class Reference

Stores a single McIntegratingHit. This class mirrors the TDS Event::McIntegratingHit class. More...

#include <McIntegratingHit.h>

List of all members.

Public Types

enum  Particle { PRIMARY = 0, ELECTRON = 1, POSITRON = 2 }
 This enum is used to aid in the fill of the m_energyArray member. More...


Public Member Functions

 McIntegratingHit ()
virtual ~McIntegratingHit ()
void Clear (Option_t *="")
void Fake (Int_t ievent, UInt_t rank, Float_t randNum)
Bool_t CompareInRange (const McIntegratingHit &, const std::string &name="") const
void Print (Option_t *="") const
void initialize (const VolumeIdentifier &id)
const VolumeIdentifier getVolumeId () const
Double_t getTotalEnergy () const
void addEnergyItem (const Double_t &energy, McParticle *t, const TVector3 &pos)
 Add single energyInfo to McParticle*, energy map.

void setEnergyItems (const Double_t &totE, const Double_t *energyArr, const TVector3 &moment1, const TVector3 &moment2)
const McParticleitemizedEnergyNext (Double_t &energy) const
 Retrieve the next McParticle, energy pair Returns the pair corresponding to m_mapPtr If we have finished traversing the list - Next will return null (0).

void itemizedEnergyReset () const
 Set the McParticle, energy map counter to zero - the beginning.

UInt_t itemizedEnergySize () const
 Returns the size of the list of McParticle, energy pairs.

Double_t getMcParticleEnergy (Particle p) const
 RetriEve energy associated with PRIMARY, ELECTRON or POSITRON.

const TVector3 getMoment1 () const
 Retrieve the energy-weighted first moments of the position.

const TVector3 getMoment2 () const
 Retrieve the energy-weighted second moments of the position.

void * operator new (size_t size)
void * operator new (size_t size, void *vp)
McIntegratingHitoperator= (const McIntegratingHit &rhs)

Private Attributes

Double_t m_totalEnergy
 total deposited energy: set automatically when m_energyInfo is modified.

Double_t m_energyArray [3]
 Optionally store the energy associated with the primary and e-/e+.

UInt_t m_packedFlags
 Packed flags for particle property.

VolumeIdentifier m_volumeId
 identifies what volume this integrating hit occurred in

TVector3 m_moment1Seed
 Energy-weighted_first_moments_of_the_position * number_of_energy_deposition.

TVector3 m_moment2Seed
 Energy-weighted_second_moments_of_the_position * number_of_energy_deposition.

TRefArray m_mcPartArr
 Actually store McParticles as a TRefArray.

vector< Double_t > m_energyPtrArr
 Store energies from McParticle* pair in a vector.

UInt_t m_mapPtr
 transient data member to keep track of place in McParticle*, energy map


Detailed Description

Stores a single McIntegratingHit. This class mirrors the TDS Event::McIntegratingHit class.

Each McIntegratingHit is composed of:

If the map of McParticleIds and energy are available, they are stored as 2 separate arrays. One is a vector of Int_t for the ids, and the other a 3 element array of energy for the primary particle, and optionally if the primary is gamma which pair produces, an e-/e+ pair. Access is provided through methods that retrieve the appropriate McParticleId, energy pair. Use the methods itemizedEnergyIdSize(), itemizedEnergyIdReset(), and Int_t itemizedEnergyIdNext(Double_t& energy) to access the data.

If available, the map of McParticles and energies are actually stored to the ROOT file as 2 separate arrays. One TRefArray of McParticles and a vector of energies. Access is provided through methods that retrieve the appropriate McParticle*, energy pair. Use the methods itemizedEnergySize(), itemizedEnergyReset() and const* McParticle itemizedEnergyNext(Double_t& energy) to access the data.

Author:
Heather Kelly
Header
/nfs/slac/g/glast/ground/cvs/mcRootData/mcRootData/McIntegratingHit.h,v 1.19 2007/11/13 16:54:46 heather Exp

Definition at line 78 of file McIntegratingHit.h.


Member Enumeration Documentation

enum McIntegratingHit::Particle
 

This enum is used to aid in the fill of the m_energyArray member.

Enumeration values:
PRIMARY 
ELECTRON 
POSITRON 

Definition at line 83 of file McIntegratingHit.h.

00083                  {
00084         PRIMARY = 0,
00085         ELECTRON = 1,
00086         POSITRON = 2
00087     };


Constructor & Destructor Documentation

McIntegratingHit::McIntegratingHit  ) 
 

McIntegratingHit::~McIntegratingHit  )  [virtual]
 

Definition at line 15 of file McIntegratingHit.cxx.

References Clear().

00015                                     {
00016     
00017     Clear();    
00018 }


Member Function Documentation

void McIntegratingHit::addEnergyItem const Double_t &  energy,
McParticle t,
const TVector3 &  pos
 

Add single energyInfo to McParticle*, energy map.

Definition at line 192 of file McIntegratingHit.cxx.

References m_energyPtrArr, m_mcPartArr, m_moment1Seed, m_moment2Seed, and m_totalEnergy.

Referenced by McEvent::CompareToFake(), and McEvent::Fake().

00194 {
00195     // Purpose and Method:  Add a new McParticle, energy pair for a certain 
00196     //    position.  Stores the McParticle* and energy in the apporpriate 
00197     //    vectors.  Updates total energy and the first and second moments.
00198     m_mcPartArr.Add(t);
00199     m_energyPtrArr.push_back(energy);
00200     TVector3 pos2 = TVector3(pos.X()*pos.X(), pos.Y()*pos.Y(), pos.Z()*pos.Z());
00201     m_totalEnergy += energy;
00202     m_moment1Seed += energy * pos;
00203     m_moment2Seed += energy * pos2;
00204 }

void McIntegratingHit::Clear Option_t *  = ""  ) 
 

Definition at line 60 of file McIntegratingHit.cxx.

References m_energyArray, m_energyPtrArr, m_mapPtr, m_mcPartArr, m_moment1Seed, m_moment2Seed, m_packedFlags, m_totalEnergy, and m_volumeId.

Referenced by ClassImp(), Fake(), and ~McIntegratingHit().

00061 {
00062     m_mcPartArr.Clear();
00063     m_energyPtrArr.clear();
00064     m_packedFlags = 0;
00065     m_totalEnergy = 0.0;
00066     m_moment1Seed = TVector3(0., 0., 0.);
00067     m_moment2Seed = TVector3(0., 0., 0.);
00068     m_volumeId.Clear();
00069     m_mapPtr = 0;
00070     m_energyArray[0] = 0.; m_energyArray[1] = 0.; m_energyArray[2] = 0.;
00071 }

Bool_t McIntegratingHit::CompareInRange const McIntegratingHit ,
const std::string &  name = ""
const
 

Definition at line 97 of file McIntegratingHit.cxx.

References COMPARE_IN_RANGE, ELECTRON, itemizedEnergyNext(), itemizedEnergyReset(), itemizedEnergySize(), POSITRON, and PRIMARY.

00097                                                                                                     {
00098 
00099     Bool_t result = true ;
00100     
00101     result = COMPARE_IN_RANGE(VolumeId()) && result ;
00102     
00103     result = COMPARE_IN_RANGE(TotalEnergy()) && result ;
00104     result = COMPARE_IN_RANGE(Moment1()) && result ;
00105     result = COMPARE_IN_RANGE(Moment2()) && result ;
00106 
00107     result = COMPARE_IN_RANGE(McParticleEnergy(McIntegratingHit::PRIMARY)) && result ;
00108     result = COMPARE_IN_RANGE(McParticleEnergy(McIntegratingHit::ELECTRON)) && result ;
00109     result = COMPARE_IN_RANGE(McParticleEnergy(McIntegratingHit::POSITRON)) && result ;
00110 
00111     itemizedEnergyReset() ;
00112     ref.itemizedEnergyReset() ;
00113     result = rootdatautil::CompareInRange(itemizedEnergySize(),ref.itemizedEnergySize(),"itemizedEnergySize") && result ;  
00114     const McParticle * myPart, * refPart ;
00115     double myEnergy, refEnergy ;
00116     int count = 0 ;
00117     while ( (myPart = itemizedEnergyNext(myEnergy)) ) {
00118       ++count ;
00119       refPart = ref.itemizedEnergyNext(refEnergy) ;
00120       result = rootdatautil::CompareInRange(*myPart,*refPart,"itemizedEnergyNext Particle") && result ;
00121       result = rootdatautil::CompareInRange(myEnergy,refEnergy,"itemizedEnergyNext Energy") && result ;
00122     }
00123     if (count==0) {
00124       std::cout
00125         <<"No Error : cannot read map which stores TRefs using " 
00126         <<" compiled code and ROOT 3.02.07 "
00127         <<std::endl ;
00128     }
00129       
00130     if (!result) {
00131         if ( name == "" ) {
00132             std::cout<<"Comparison ERROR for "<<ClassName()<<std::endl ;
00133         }
00134         else {
00135             std::cout<<"Comparison ERROR for "<<name<<std::endl ;
00136         }
00137     }
00138     return result ;
00139 
00140 }

void McIntegratingHit::Fake Int_t  ievent,
UInt_t  rank,
Float_t  randNum
 

Definition at line 74 of file McIntegratingHit.cxx.

References Clear(), initialize(), and setEnergyItems().

Referenced by McEvent::CompareToFake(), and McEvent::Fake().

00074                                                                                     {
00075 
00076     Clear() ;
00077     
00078     VolumeIdentifier id ;
00079     id.Clear() ;
00080     id.append(0) ;
00081     initialize(id) ;
00082     
00083     //TVector3 pos = mcPart->getFinalPosition();
00084     //TVector3 pos2(1.3, 0.0, 12.0);
00085     //addEnergyItem(1.5, mcPart, pos);
00086     
00087     double totE = 5.5;
00088     double energyArr[3] = { 2.5, 3.0, 0.0 };
00089     TVector3 moment1(1.0, 2.0, 3.0);
00090     TVector3 moment2(2.0, 4.0, 6.0);
00091     setEnergyItems(totE,energyArr,moment1,moment2) ;
00092 
00093 }

Double_t McIntegratingHit::getMcParticleEnergy Particle  p  )  const
 

RetriEve energy associated with PRIMARY, ELECTRON or POSITRON.

Definition at line 188 of file McIntegratingHit.cxx.

References m_energyArray.

00188                                                                {
00189     return m_energyArray[p];
00190 }

const TVector3 McIntegratingHit::getMoment1  )  const
 

Retrieve the energy-weighted first moments of the position.

Definition at line 220 of file McIntegratingHit.cxx.

References m_moment1Seed, and m_totalEnergy.

00221 {
00222     // Purpose and Method:  Retrieve the energy-weighted first moments of the
00223     //    position.
00224     return m_moment1Seed * (1./m_totalEnergy);
00225 }

const TVector3 McIntegratingHit::getMoment2  )  const
 

Retrieve the energy-weighted second moments of the position.

Definition at line 228 of file McIntegratingHit.cxx.

References m_moment2Seed, and m_totalEnergy.

00229 {
00230     // Purpose and Method:  Retrieve the energy-weighted second moments of the
00231     //    position
00232     return m_moment2Seed * (1./m_totalEnergy);
00233 }

Double_t McIntegratingHit::getTotalEnergy  )  const [inline]
 

Definition at line 102 of file McIntegratingHit.h.

References m_totalEnergy.

00102 { return m_totalEnergy; };

const VolumeIdentifier McIntegratingHit::getVolumeId  )  const [inline]
 

Definition at line 100 of file McIntegratingHit.h.

References m_volumeId.

00100 { return m_volumeId; };

void McIntegratingHit::initialize const VolumeIdentifier &  id  ) 
 

Definition at line 21 of file McIntegratingHit.cxx.

References m_volumeId.

Referenced by Fake().

00021                                                             {
00022     m_volumeId = id;
00023 }

const McParticle * McIntegratingHit::itemizedEnergyNext Double_t &  energy  )  const
 

Retrieve the next McParticle, energy pair Returns the pair corresponding to m_mapPtr If we have finished traversing the list - Next will return null (0).

Definition at line 175 of file McIntegratingHit.cxx.

References m_energyPtrArr, m_mapPtr, and m_mcPartArr.

Referenced by CompareInRange().

00175                                                                              {
00176     // Purpose and Method:  Access the next McParticle* and energy pair
00177     //   The transient data member, m_mapEntry, is used to access a specific
00178     //   pair.  If we have reached the end of the map, then a null McParticle*
00179     //   is returned.
00180     if ( m_mapPtr < (UInt_t)m_mcPartArr.GetEntries() ) {
00181         energy = m_energyPtrArr[m_mapPtr];
00182         return (McParticle*) m_mcPartArr.At(m_mapPtr++);
00183     }
00184     energy = 0;
00185     return 0;
00186 }

void McIntegratingHit::itemizedEnergyReset  )  const [inline]
 

Set the McParticle, energy map counter to zero - the beginning.

Definition at line 115 of file McIntegratingHit.h.

References m_mapPtr.

Referenced by CompareInRange().

00115 { m_mapPtr = 0; };

UInt_t McIntegratingHit::itemizedEnergySize  )  const [inline]
 

Returns the size of the list of McParticle, energy pairs.

Definition at line 117 of file McIntegratingHit.h.

References m_mcPartArr.

Referenced by CompareInRange().

00117 { return m_mcPartArr.GetEntries(); };

void * McIntegratingHit::operator new size_t  size,
void *  vp
 

Definition at line 37 of file McIntegratingHit.cxx.

00038 {
00039     return vp;
00040 }

void * McIntegratingHit::operator new size_t  size  ) 
 

Definition at line 26 of file McIntegratingHit.cxx.

References McObjectManager::getNewMcIntegratingHit(), McObjectManager::getPointer(), m_energyPtrArr, and m_mcPartArr.

00027 {
00028     McIntegratingHit* temp = McObjectManager::getPointer()->getNewMcIntegratingHit();
00029 
00030     // Since we are re-using, make sure some of the data members which might allocate memory are cleaned up
00031     temp->m_mcPartArr.Clear();
00032     temp->m_energyPtrArr.clear();
00033 
00034     return temp;
00035 }

McIntegratingHit & McIntegratingHit::operator= const McIntegratingHit rhs  ) 
 

Definition at line 42 of file McIntegratingHit.cxx.

References m_energyArray, m_mapPtr, m_mcPartArr, m_moment1Seed, m_moment2Seed, m_packedFlags, m_totalEnergy, and m_volumeId.

00043 {
00044     m_totalEnergy    = rhs.m_totalEnergy;
00045     m_energyArray[0] = rhs.m_energyArray[0];
00046     m_energyArray[1] = rhs.m_energyArray[1];
00047     m_energyArray[2] = rhs.m_energyArray[2];
00048     m_packedFlags    = rhs.m_packedFlags;
00049     m_volumeId       = rhs.m_volumeId;
00050     m_moment1Seed    = rhs.m_moment1Seed;
00051     m_moment2Seed    = rhs.m_moment2Seed;
00052     m_mapPtr         = rhs.m_mapPtr; 
00053 
00054     for(int idx=0; idx < rhs.m_mcPartArr.GetEntries(); idx++)
00055         m_mcPartArr.Add(rhs.m_mcPartArr.At(idx));
00056 
00057     return *this;
00058 }

void McIntegratingHit::Print Option_t *  = ""  )  const
 

Definition at line 142 of file McIntegratingHit.cxx.

References McParticle::getParticleId(), m_energyArray, m_energyPtrArr, m_mcPartArr, m_moment1Seed, m_moment2Seed, m_packedFlags, m_totalEnergy, and m_volumeId.

00142                                                    {
00143     using namespace std;
00144     TObject::Print(option);
00145     UInt_t p = 2;
00146     cout.precision(p);
00147     m_volumeId.Print(option);
00148     cout << "Flags: " << m_packedFlags 
00149         << " Energy: " << m_totalEnergy << endl;
00150     cout << "Mom1: (" << m_moment1Seed.X() << "," << m_moment1Seed.Y() << ","
00151         << m_moment1Seed.Z() << ")   ";
00152     cout << "Mom2: (" << m_moment2Seed.X() << "," << m_moment2Seed.Y() << ","
00153         << m_moment2Seed.Z() << ")" << endl;
00154     if (m_energyPtrArr.size() > 0) {
00155         cout << "Energy Map:  Size of energy vector: " << m_energyPtrArr.size();
00156         cout << "    Size of McParticle array: " << m_mcPartArr.GetEntries() 
00157         << endl;
00158     } else {
00159         cout << "energies stored: " << m_energyArray[0] << " , "
00160             << m_energyArray[1] << " , " << m_energyArray[2] << endl;
00161     }
00162     TRefArrayIter mcPartIter(&m_mcPartArr);
00163     McParticle *mcPart = 0;
00164     UInt_t iEnergy = 0;
00165     cout << "Energy :" << endl;
00166     while( (mcPart = (McParticle*)mcPartIter.Next()) ) {
00167         cout << "( " << mcPart->getParticleId() << ", " << m_energyPtrArr[iEnergy]
00168             << " )    " << endl;
00169         ++iEnergy;
00170     }
00171 
00172 } 

void McIntegratingHit::setEnergyItems const Double_t &  totE,
const Double_t *  energyArr,
const TVector3 &  moment1,
const TVector3 &  moment2
 

Definition at line 207 of file McIntegratingHit.cxx.

References ELECTRON, m_energyArray, m_moment1Seed, m_moment2Seed, m_totalEnergy, POSITRON, and PRIMARY.

Referenced by Fake().

00208                                                                                         {
00209 
00210     // Purpose and Method:  Set all energy member variables
00211 
00212     m_totalEnergy = totE;
00213     m_energyArray[McIntegratingHit::PRIMARY] = energyArr[McIntegratingHit::PRIMARY];
00214     m_energyArray[McIntegratingHit::ELECTRON] = energyArr[McIntegratingHit::ELECTRON];
00215     m_energyArray[McIntegratingHit::POSITRON] = energyArr[McIntegratingHit::POSITRON];
00216     m_moment1Seed = moment1 * totE;
00217     m_moment2Seed = moment2 * totE;
00218 }


Member Data Documentation

Double_t McIntegratingHit::m_energyArray[3] [private]
 

Optionally store the energy associated with the primary and e-/e+.

Definition at line 137 of file McIntegratingHit.h.

Referenced by Clear(), getMcParticleEnergy(), operator=(), Print(), and setEnergyItems().

vector<Double_t> McIntegratingHit::m_energyPtrArr [private]
 

Store energies from McParticle* pair in a vector.

Definition at line 150 of file McIntegratingHit.h.

Referenced by addEnergyItem(), Clear(), itemizedEnergyNext(), operator new(), and Print().

UInt_t McIntegratingHit::m_mapPtr [mutable, private]
 

transient data member to keep track of place in McParticle*, energy map

This data member is transient - not written!

Definition at line 160 of file McIntegratingHit.h.

Referenced by Clear(), itemizedEnergyNext(), itemizedEnergyReset(), and operator=().

TRefArray McIntegratingHit::m_mcPartArr [private]
 

Actually store McParticles as a TRefArray.

Definition at line 148 of file McIntegratingHit.h.

Referenced by addEnergyItem(), Clear(), itemizedEnergyNext(), itemizedEnergySize(), operator new(), operator=(), and Print().

TVector3 McIntegratingHit::m_moment1Seed [private]
 

Energy-weighted_first_moments_of_the_position * number_of_energy_deposition.

Definition at line 143 of file McIntegratingHit.h.

Referenced by addEnergyItem(), Clear(), getMoment1(), operator=(), Print(), and setEnergyItems().

TVector3 McIntegratingHit::m_moment2Seed [private]
 

Energy-weighted_second_moments_of_the_position * number_of_energy_deposition.

Definition at line 145 of file McIntegratingHit.h.

Referenced by addEnergyItem(), Clear(), getMoment2(), operator=(), Print(), and setEnergyItems().

UInt_t McIntegratingHit::m_packedFlags [private]
 

Packed flags for particle property.

Definition at line 139 of file McIntegratingHit.h.

Referenced by Clear(), operator=(), and Print().

Double_t McIntegratingHit::m_totalEnergy [private]
 

total deposited energy: set automatically when m_energyInfo is modified.

Definition at line 135 of file McIntegratingHit.h.

Referenced by addEnergyItem(), Clear(), getMoment1(), getMoment2(), getTotalEnergy(), operator=(), Print(), and setEnergyItems().

VolumeIdentifier McIntegratingHit::m_volumeId [private]
 

identifies what volume this integrating hit occurred in

Definition at line 141 of file McIntegratingHit.h.

Referenced by Clear(), getVolumeId(), initialize(), operator=(), and Print().


The documentation for this class was generated from the following files:
Generated on Tue Dec 11 16:28:56 2007 by doxygen 1.3.3