CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes | Friends

pftools::ParticleDeposit Class Reference

#include <ParticleDeposit.h>

List of all members.

Public Member Functions

virtual void addRecDeposition (const Deposition &rec)
virtual void addTruthDeposition (const Deposition &truth)
virtual double getEnergyResolution () const
double getEta () const
virtual unsigned getId () const
virtual double getPhi () const
virtual const std::vector
< Deposition > & 
getRecDepositions () const
virtual double getRecEnergy (const DetectorElementPtr de) const
virtual double getRecEnergy () const
double getTargetFunctionContrib () const
virtual std::vector< DepositiongetTruthDepositions () const
virtual double getTruthEnergy (const DetectorElementPtr de) const
virtual double getTruthEnergy () const
 ParticleDeposit (double truthEnergy=-1.0, double eta=0, double phi=0)
void setEta (const double eta)
void setPhi (const double phi)
virtual void setRecEnergy (const DetectorElementPtr de, double energy)
void setTruthEnergy (const double truth)
virtual ~ParticleDeposit ()

Private Attributes

double myEta
unsigned myId
double myPhi
std::vector< DepositionmyRecDepositions
std::vector< DepositionmyTruthDepositions
double myTruthEnergy
std::vector< ParticleDeposit * > pdps_

Static Private Attributes

static unsigned count = 0

Friends

std::ostream & operator<< (std::ostream &s, const ParticleDeposit &p)

Detailed Description

Definition at line 21 of file ParticleDeposit.h.


Constructor & Destructor Documentation

ParticleDeposit::ParticleDeposit ( double  truthEnergy = -1.0,
double  eta = 0,
double  phi = 0 
)

Definition at line 10 of file ParticleDeposit.cc.

References count.

                                                                           :
        myId(count), myTruthEnergy(truthEnergy), myEta(eta), myPhi(phi) {
        ++count;
}
ParticleDeposit::~ParticleDeposit ( ) [virtual]

Definition at line 15 of file ParticleDeposit.cc.

                                  {
}

Member Function Documentation

void ParticleDeposit::addRecDeposition ( const Deposition rec) [virtual]

Definition at line 18 of file ParticleDeposit.cc.

References myRecDepositions.

                                                            {
        myRecDepositions.push_back(rec);
}
void ParticleDeposit::addTruthDeposition ( const Deposition truth) [virtual]

Definition at line 22 of file ParticleDeposit.cc.

References myTruthDepositions.

                                                                {
        myTruthDepositions.push_back(truth);
}
double ParticleDeposit::getEnergyResolution ( ) const [virtual]

Definition at line 91 of file ParticleDeposit.cc.

References getRecEnergy(), myTruthEnergy, and mathSSE::sqrt().

                                                  {
        //assert(!(getRecEnergy() / myTruthEnergy < 0.0));
        return fabs((getRecEnergy() - myTruthEnergy) / sqrt(myTruthEnergy));
}
double pftools::ParticleDeposit::getEta ( ) const [inline]

Definition at line 60 of file ParticleDeposit.h.

References myEta.

                                     {
                return myEta;
        }
virtual unsigned pftools::ParticleDeposit::getId ( ) const [inline, virtual]

Definition at line 56 of file ParticleDeposit.h.

References myId.

                                       {
                return myId;
        }
virtual double pftools::ParticleDeposit::getPhi ( ) const [inline, virtual]

Definition at line 64 of file ParticleDeposit.h.

References myPhi.

                                      {
                return myPhi;
        }
const std::vector< Deposition > & ParticleDeposit::getRecDepositions ( ) const [virtual]

Definition at line 30 of file ParticleDeposit.cc.

References myRecDepositions.

                                                                      {
        return myRecDepositions;
}
double ParticleDeposit::getRecEnergy ( const DetectorElementPtr  de) const [virtual]

Definition at line 34 of file ParticleDeposit.cc.

References relval_parameters_module::energy, pftools::Deposition::getDetectorElement(), pftools::Deposition::getEnergy(), pftools::Deposition::getEta(), pftools::Deposition::getPhi(), and myRecDepositions.

                                                                      {
        double energy(0);
        for (std::vector<Deposition>::const_iterator cit = myRecDepositions.begin(); cit
                        != myRecDepositions.end(); ++cit) {
                Deposition d = *cit;

                if (d.getDetectorElement()->getType() == de->getType()) {
                        energy += de->getCalib(d.getEta(), d.getPhi()) * d.getEnergy();
                }

        }
        return energy;
}
double ParticleDeposit::getRecEnergy ( ) const [virtual]

Definition at line 74 of file ParticleDeposit.cc.

References relval_parameters_module::energy, pftools::Deposition::getDetectorElement(), pftools::Deposition::getEnergy(), pftools::Deposition::getEta(), pftools::Deposition::getPhi(), and myRecDepositions.

Referenced by getEnergyResolution(), and getTargetFunctionContrib().

                                           {
        double energy(0);
        for (std::vector<Deposition>::const_iterator cit = myRecDepositions.begin(); cit
                        != myRecDepositions.end(); ++cit) {
                Deposition d = *cit;
//              if (d.getDetectorElement()->getType() == OFFSET && d.getDetectorElement()->getCalib() == 1.0) {
//                      //don't add a tiny amount!
//              } else {
                        energy += d.getDetectorElement()->getCalib(d.getEta(), d.getPhi()) * d.getEnergy();
//              }
        }

        //assert(!(energy < 0));
        return energy;

}
double ParticleDeposit::getTargetFunctionContrib ( ) const

Definition at line 96 of file ParticleDeposit.cc.

References getRecEnergy(), myTruthEnergy, and funct::pow().

                                                       {
        //assert(!(getRecEnergy() / myTruthEnergy < 0.0));
        return pow((getRecEnergy() - myTruthEnergy), 2);
}
std::vector< Deposition > ParticleDeposit::getTruthDepositions ( ) const [virtual]

Definition at line 26 of file ParticleDeposit.cc.

References myTruthDepositions.

                                                                 {
        return myTruthDepositions;
}
double ParticleDeposit::getTruthEnergy ( const DetectorElementPtr  de) const [virtual]

Definition at line 60 of file ParticleDeposit.cc.

References relval_parameters_module::energy, pftools::Deposition::getDetectorElement(), pftools::Deposition::getEnergy(), and myTruthDepositions.

                                                                        {
        double energy(0);
        for (std::vector<Deposition>::const_iterator
                        cit = myTruthDepositions.begin(); cit!= myTruthDepositions.end(); ++cit) {
                Deposition d = *cit;
                if (d.getDetectorElement() == de) {
                        energy += d.getEnergy();
                }
        }
        assert(!(energy > 0));
        return energy;

}
virtual double pftools::ParticleDeposit::getTruthEnergy ( ) const [inline, virtual]

Definition at line 36 of file ParticleDeposit.h.

References myTruthEnergy.

                                              {
                return myTruthEnergy;
        }
void pftools::ParticleDeposit::setEta ( const double  eta) [inline]

Definition at line 76 of file ParticleDeposit.h.

References eta(), and myEta.

                                      {
                myEta = eta;
        }
void pftools::ParticleDeposit::setPhi ( const double  phi) [inline]

Definition at line 72 of file ParticleDeposit.h.

References myPhi, and phi.

                                      {
                myPhi = phi;
        }
void ParticleDeposit::setRecEnergy ( const DetectorElementPtr  de,
double  energy 
) [virtual]

Definition at line 48 of file ParticleDeposit.cc.

References pftools::Deposition::getDetectorElement(), myRecDepositions, and pftools::Deposition::setEnergy().

                                                                             {
        for (std::vector<Deposition>::const_iterator cit = myRecDepositions.begin(); cit
                        != myRecDepositions.end(); ++cit) {
                Deposition d = *cit;

                if (d.getDetectorElement()->getType() == de->getType()) {
                        d.setEnergy(energy);
                }

        }
}
void pftools::ParticleDeposit::setTruthEnergy ( const double  truth) [inline]

Definition at line 68 of file ParticleDeposit.h.

References myTruthEnergy.

                                                {
                myTruthEnergy = truth;
        }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const ParticleDeposit p 
) [friend]

Member Data Documentation

unsigned ParticleDeposit::count = 0 [static, private]

Definition at line 85 of file ParticleDeposit.h.

Referenced by ParticleDeposit().

Definition at line 92 of file ParticleDeposit.h.

Referenced by getEta(), and setEta().

unsigned pftools::ParticleDeposit::myId [private]

Definition at line 89 of file ParticleDeposit.h.

Referenced by getId().

Definition at line 93 of file ParticleDeposit.h.

Referenced by getPhi(), and setPhi().

Definition at line 87 of file ParticleDeposit.h.

Referenced by addRecDeposition(), getRecDepositions(), getRecEnergy(), and setRecEnergy().

Definition at line 88 of file ParticleDeposit.h.

Referenced by addTruthDeposition(), getTruthDepositions(), and getTruthEnergy().

Definition at line 98 of file ParticleDeposit.h.