CMS 3D CMS Logo

Public Member Functions | Public Attributes

pftools::Calibratable Class Reference

Wraps essential single particle calibration data ready for export to a Root file. More...

#include <Calibratable.h>

List of all members.

Public Member Functions

 Calibratable ()
virtual CalibratableElement computeMean (const std::vector< CalibratableElement > &diets)
virtual CandidateWrapper computeMean (const std::vector< CandidateWrapper > &wrappers)
virtual void fillCaloWindow (const std::vector< CalibratableElement > &source, CaloWindow &destination) const
virtual void recompute ()
virtual void reset ()
virtual ~Calibratable ()

Public Attributes

std::vector
< CalibrationResultWrapper
calibrations_
CaloWindow calowindow_ecal_
CaloWindow calowindow_hcal_
double cand_energyEcal_
double cand_energyEvent_
double cand_energyHcal_
double cand_energyNeutralEM_
double cand_energyNeutralHad_
double cand_eta_
double cand_phi_
int cand_type_
std::vector< CandidateWrappercands_
CandidateWrapper cands_mean_
int cands_num_
std::vector< CalibratableElementcluster_ecal_
double cluster_energyEcal_
double cluster_energyEvent_
double cluster_energyHcal_
std::vector< CalibratableElementcluster_hcal_
CalibratableElement cluster_meanEcal_
CalibratableElement cluster_meanHcal_
int cluster_numEcal_
int cluster_numHcal_
std::vector< CalibratableElementrechits_ecal_
double rechits_energyEcal_
double rechits_energyEvent_
double rechits_energyHcal_
std::vector< CalibratableElementrechits_hcal_
CalibratableElement rechits_meanEcal_
CalibratableElement rechits_meanHcal_
int rechits_numEcal_
int rechits_numHcal_
double recotrk_charge_
double recotrk_deltaRWithSim_
double recotrk_etaEcal_
math::XYZTLorentzVector recotrk_momentum_
double recotrk_numHits_
double recotrk_phiEcal_
double recotrk_quality_
double sim_energyEcal_
double sim_energyEvent_
double sim_energyHcal_
double sim_eta_
double sim_etaEcal_
double sim_etaHcal_
bool sim_isMC_
int sim_numEvent_
double sim_phi_
double sim_phiEcal_
double sim_phiHcal_
double tb_ck2_
double tb_ck3_
std::vector< CalibratableElementtb_ecal_
double tb_energyEcal_
double tb_energyEvent_
double tb_energyHcal_
double tb_eta_
std::vector< CalibratableElementtb_hcal_
bool tb_isTB_
CalibratableElement tb_meanEcal_
CalibratableElement tb_meanHcal_
int tb_numEcal_
int tb_numHcal_
int tb_pdg_
double tb_phi_
int tb_run_
double tb_tof_
char tb_vetosPassed_

Detailed Description

Wraps essential single particle calibration data ready for export to a Root file.

Note that a Reflex dictionary must be produced for this class, for the Root branching mechanisms to work.

Author:
Jamie Ballin
Date:
May 2008

Definition at line 122 of file Calibratable.h.


Constructor & Destructor Documentation

pftools::Calibratable::Calibratable ( ) [inline]

Definition at line 125 of file Calibratable.h.

References reset().

                       {
                reset();
        }
virtual pftools::Calibratable::~Calibratable ( ) [inline, virtual]

Definition at line 129 of file Calibratable.h.

                                {
        }

Member Function Documentation

CalibratableElement Calibratable::computeMean ( const std::vector< CalibratableElement > &  diets) [virtual]

Compute the mean of a vector of CalibratableElements

Parameters:
diets
Returns:

Definition at line 138 of file Calibratable.cc.

References pftools::CalibratableElement::energy_, pftools::CalibratableElement::eta_, pftools::CalibratableElement::extent_, pftools::CalibratableElement::phi_, and pftools::CalibratableElement::time_.

Referenced by recompute().

                                             {
        CalibratableElement dmean;
        if (diets.size() == 0)
                return dmean;
        for (std::vector<CalibratableElement>::const_iterator cit = diets.begin(); cit
                        != diets.end(); ++cit) {
                CalibratableElement d = *cit;
                dmean.energy_ += d.energy_;
                dmean.eta_ += d.eta_;
                dmean.phi_ += d.phi_;
                dmean.extent_ += d.extent_;
                dmean.time_ += d.time_;
        }
        dmean.energy_ /= diets.size();
        dmean.eta_ /= diets.size();
        dmean.phi_ /= diets.size();
        dmean.extent_ /= diets.size();
        dmean.time_ /= diets.size();
        return dmean;
}
CandidateWrapper Calibratable::computeMean ( const std::vector< CandidateWrapper > &  wrappers) [virtual]

Compute the mean of a vector of CandidateWrappers

Parameters:
wrappers
Returns:

Definition at line 111 of file Calibratable.cc.

References trackerHits::c, pftools::CandidateWrapper::energy_, pftools::CandidateWrapper::energyEcal_, pftools::CandidateWrapper::energyHcal_, pftools::CandidateWrapper::eta_, pftools::CandidateWrapper::phi_, and pftools::CandidateWrapper::type_.

                                                             {
        CandidateWrapper cw;

        if (wrappers.size() == 0)
                return cw;
        for (std::vector<CandidateWrapper>::const_iterator it = wrappers.begin(); it
                        != wrappers.end(); ++it) {
                const CandidateWrapper& c = *it;
                cw.energy_ += c.energy_;
                cw.phi_ += c.phi_;
                cw.eta_ += c.eta_;
                cw.energyEcal_ += c.energyEcal_;
                cw.energyHcal_ += c.energyHcal_;
                cw.type_ += c.type_;
        }

        cw.energy_ /= wrappers.size();
        cw.phi_ /= wrappers.size();
        cw.eta_ /= wrappers.size();
        cw.energyEcal_ /= wrappers.size();
        cw.energyHcal_ /= wrappers.size();
        cw.type_ /= wrappers.size();

        return cw;
}
void Calibratable::fillCaloWindow ( const std::vector< CalibratableElement > &  source,
CaloWindow destination 
) const [virtual]

Helper method to fill a CaloWindow with CalibratableElement objects You should initialise the CaloWindow first!

Parameters:
source
destination

Definition at line 160 of file Calibratable.cc.

References pftools::CaloWindow::addHit(), gather_cfg::cout, pftools::CalibratableElement::energy_, pftools::CalibratableElement::eta_, convertSQLiteXML::ok, and pftools::CalibratableElement::phi_.

                                                                                             {
        std::vector<CalibratableElement>::const_iterator cit = source.begin();
        for (; cit != source.end(); ++cit) {
                const CalibratableElement& ce = *cit;
                bool ok = destination.addHit(ce.eta_, ce.phi_, ce.energy_);
                if (!ok)
                        std::cout << __PRETTY_FUNCTION__
                                        << ": couldn't fill CaloWindow with " << ce << "\n";
        }
}
void Calibratable::recompute ( ) [virtual]

Definition at line 45 of file Calibratable.cc.

References trackerHits::c, cand_energyEcal_, cand_energyEvent_, cand_energyHcal_, cand_energyNeutralEM_, cand_energyNeutralHad_, cand_eta_, cand_phi_, cand_type_, cands_, cands_mean_, cands_num_, cluster_ecal_, cluster_energyEcal_, cluster_energyEvent_, cluster_energyHcal_, cluster_hcal_, cluster_meanEcal_, cluster_meanHcal_, cluster_numEcal_, cluster_numHcal_, computeMean(), pftools::CandidateWrapper::energy_, pftools::CalibratableElement::energy_, pftools::CandidateWrapper::energyEcal_, pftools::CandidateWrapper::energyHcal_, pftools::CandidateWrapper::eta_, pftools::CandidateWrapper::phi_, rechits_ecal_, rechits_energyEcal_, rechits_energyEvent_, rechits_energyHcal_, rechits_hcal_, rechits_meanEcal_, rechits_meanHcal_, rechits_numEcal_, rechits_numHcal_, pftools::CandidateWrapper::recompute(), python::multivaluedict::sort(), tb_ecal_, tb_energyEcal_, tb_energyEvent_, tb_energyHcal_, tb_hcal_, tb_meanEcal_, tb_meanHcal_, tb_numEcal_, tb_numHcal_, and pftools::CandidateWrapper::type_.

Referenced by pftools::TreeUtility::dumpCaloDataToCSV(), pftools::CalibCompare::evaluateCalibrations(), and CalibratableTest::fillTreeAndReset().

                             {

        cluster_meanEcal_ = computeMean(cluster_ecal_);
        cluster_meanHcal_ = computeMean(cluster_hcal_);
        rechits_meanEcal_ = computeMean(rechits_ecal_);
        rechits_meanHcal_ = computeMean(rechits_hcal_);
        tb_meanEcal_ = computeMean(tb_ecal_);
        tb_meanHcal_ = computeMean(tb_hcal_);

        cluster_numEcal_ = cluster_ecal_.size();
        cluster_numHcal_ = cluster_hcal_.size();
        rechits_numEcal_ = rechits_ecal_.size();
        rechits_numHcal_ = rechits_hcal_.size();
        tb_numEcal_ = tb_ecal_.size();
        tb_numHcal_ = tb_hcal_.size();

        cluster_energyEvent_ = cluster_meanEcal_.energy_ * cluster_ecal_.size()
                        + cluster_meanHcal_.energy_ * cluster_hcal_.size();
        cluster_energyEcal_ = cluster_meanEcal_.energy_ * cluster_ecal_.size();
        cluster_energyHcal_ = cluster_meanHcal_.energy_ * cluster_hcal_.size();

        rechits_energyEvent_ = rechits_meanEcal_.energy_ * rechits_ecal_.size()
                        + rechits_meanHcal_.energy_ * rechits_hcal_.size();
        rechits_energyEcal_ = rechits_meanEcal_.energy_ * rechits_ecal_.size();
        rechits_energyHcal_ = rechits_meanHcal_.energy_ * rechits_hcal_.size();

        tb_energyEvent_ = tb_meanEcal_.energy_ * tb_ecal_.size()
                        + tb_meanHcal_.energy_ * tb_hcal_.size();
        tb_energyEcal_ = tb_meanEcal_.energy_ * tb_ecal_.size();
        tb_energyHcal_ = tb_meanHcal_.energy_ * tb_hcal_.size();

        cands_num_ = cands_.size();
        cands_mean_ = computeMean(cands_);

        cand_energyEvent_ = 0;
        cand_energyEcal_ = 0;
        cand_energyHcal_ = 0;
        cand_energyNeutralEM_ = 0;
        cand_energyNeutralHad_ = 0;
        cand_type_ = 0;
        cand_eta_ = cands_mean_.eta_;
        cand_phi_ = cands_mean_.phi_;

        for (std::vector<CandidateWrapper>::iterator it = cands_.begin(); it
                        != cands_.end(); ++it) {
                CandidateWrapper& c = *it;
                if (c.type_ == 4)
                        cand_energyNeutralEM_ += c.energy_;
                if (c.type_ == 5)
                        cand_energyNeutralHad_ += c.energy_;
                cand_energyEvent_ += c.energy_;
                cand_energyEcal_ += c.energyEcal_;
                cand_energyHcal_ += c.energyHcal_;
                cand_type_ += c.type_;
                c.recompute();
        }

        std::sort(tb_ecal_.begin(), tb_ecal_.end());
        std::sort(tb_hcal_.begin(), tb_hcal_.end());
        std::sort(rechits_ecal_.begin(), rechits_ecal_.end());
        std::sort(rechits_hcal_.begin(), rechits_hcal_.end());
        std::sort(cluster_ecal_.begin(), cluster_ecal_.end());
        std::sort(cluster_hcal_.begin(), cluster_hcal_.end());

}
void Calibratable::reset ( void  ) [virtual]

Call to reset() (useful for TTree users)

Definition at line 172 of file Calibratable.cc.

References calibrations_, calowindow_ecal_, calowindow_hcal_, cand_energyEcal_, cand_energyEvent_, cand_energyHcal_, cand_energyNeutralEM_, cand_energyNeutralHad_, cand_eta_, cand_phi_, cand_type_, cands_, cands_mean_, cands_num_, cluster_ecal_, cluster_energyEcal_, cluster_energyEvent_, cluster_energyHcal_, cluster_hcal_, cluster_meanEcal_, cluster_meanHcal_, cluster_numEcal_, cluster_numHcal_, rechits_ecal_, rechits_energyEcal_, rechits_energyEvent_, rechits_energyHcal_, rechits_hcal_, rechits_meanEcal_, rechits_meanHcal_, rechits_numEcal_, rechits_numHcal_, recotrk_charge_, recotrk_deltaRWithSim_, recotrk_etaEcal_, recotrk_momentum_, recotrk_numHits_, recotrk_phiEcal_, recotrk_quality_, pftools::CaloWindow::reset(), pftools::CalibratableElement::reset(), pftools::CandidateWrapper::reset(), sim_energyEcal_, sim_energyEvent_, sim_energyHcal_, sim_eta_, sim_etaEcal_, sim_etaHcal_, sim_isMC_, sim_numEvent_, sim_phi_, sim_phiEcal_, sim_phiHcal_, tb_ck2_, tb_ck3_, tb_ecal_, tb_energyEcal_, tb_energyEvent_, tb_energyHcal_, tb_eta_, tb_hcal_, tb_isTB_, tb_meanEcal_, tb_meanHcal_, tb_numEcal_, tb_numHcal_, tb_pdg_, tb_phi_, tb_run_, tb_tof_, and tb_vetosPassed_.

Referenced by CalibratableTest::analyze(), Calibratable(), pftools::CalibCompare::evaluateCalibrations(), pftools::Exercises3::evaluateCalibrator(), and CalibratableTest::fillTreeAndReset().


Member Data Documentation

Definition at line 178 of file Calibratable.h.

Referenced by reset().

Definition at line 179 of file Calibratable.h.

Referenced by reset().

Definition at line 201 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 203 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 203 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 204 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 197 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 183 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 185 of file Calibratable.h.

Referenced by pftools::CalibCompare::evaluateCalibrations(), recompute(), and reset().

Definition at line 185 of file Calibratable.h.

Referenced by pftools::CalibCompare::evaluateCalibrations(), recompute(), and reset().

Definition at line 190 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 190 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 190 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 192 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 192 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 171 of file Calibratable.h.

Referenced by reset().

Definition at line 174 of file Calibratable.h.

Referenced by reset().

Definition at line 172 of file Calibratable.h.

Referenced by reset().

Definition at line 175 of file Calibratable.h.

Referenced by reset().

Definition at line 171 of file Calibratable.h.

Referenced by reset().

Definition at line 172 of file Calibratable.h.

Referenced by reset().

Definition at line 171 of file Calibratable.h.

Referenced by reset().

Definition at line 147 of file Calibratable.h.

Referenced by reset().

For each collection: candidates, clusters, rechits and truth overall energy, ecal, hcal, n of each, eta and phi naming scheme: collection_variable_ All _energyEcal_, _energyHcal_, _eta_ and _phi_ are mean values (i.e. value = sum of elements/number of elements) BUT _energyEvent_ fields are sums of all elements.

Definition at line 146 of file Calibratable.h.

Referenced by CalibratableTest::analyze(), pftools::TreeUtility::convertCalibratablesToParticleDeposits(), pftools::TreeUtility::dumpCaloDataToCSV(), pftools::CalibCompare::evaluateCalibrations(), pftools::Exercises3::evaluateCalibrator(), pftools::PFClusterCalibration::getCalibrationResultWrapper(), pftools::TreeUtility::getParticleDepositsDirectly(), pftools::operator<<(), and reset().

Definition at line 147 of file Calibratable.h.

Referenced by reset().

Definition at line 148 of file Calibratable.h.

Referenced by CalibratableTest::analyze(), and reset().

Definition at line 149 of file Calibratable.h.

Referenced by CalibratableTest::analyze(), and reset().

Definition at line 148 of file Calibratable.h.

Referenced by CalibratableTest::analyze(), and reset().

Definition at line 159 of file Calibratable.h.

Referenced by reset().

Definition at line 159 of file Calibratable.h.

Referenced by reset().

Definition at line 165 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 164 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 164 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 164 of file Calibratable.h.

Referenced by pftools::operator<<(), recompute(), and reset().

Definition at line 165 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 168 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 168 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 166 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 166 of file Calibratable.h.

Referenced by recompute(), and reset().

Definition at line 157 of file Calibratable.h.

Referenced by reset().

Definition at line 157 of file Calibratable.h.

Referenced by reset().

Definition at line 159 of file Calibratable.h.

Referenced by reset().

Definition at line 161 of file Calibratable.h.

Referenced by reset().