CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

CaloTower Class Reference

#include <CaloTower.h>

Inheritance diagram for CaloTower:
reco::LeafCandidate reco::Candidate

List of all members.

Public Types

typedef CaloTowerDetId key_type

Public Member Functions

void addConstituent (DetId id)
void addConstituents (const std::vector< DetId > &ids)
 CaloTower (const CaloTowerDetId &id, double emE, double hadE, double outerE, int ecal_tp, int hcal_tp, const PolarLorentzVector p4, GlobalPoint emPosition, GlobalPoint hadPosition)
 CaloTower ()
 CaloTower (const CaloTowerDetId &id, double emE, double hadE, double outerE, int ecal_tp, int hcal_tp, const LorentzVector p4, GlobalPoint emPosition, GlobalPoint hadPosition)
DetId constituent (size_t i) const
const std::vector< DetId > & constituents () const
size_t constituentsSize () const
float ecalTime () const
double emEnergy () const
double emEt () const
double emEt (double vtxZ) const
double emEt (Point v) const
int emLvl1 () const
const GlobalPointemPosition () const
double energyInHB () const
double energyInHE () const
double energyInHF () const
double energyInHO () const
double et (double vtxZ) const
double et (Point v) const
double hadEnergy () const
double hadEnergyHeInnerLayer () const
double hadEnergyHeOuterLayer () const
double hadEt () const
double hadEt (double vtxZ) const
double hadEt (Point v) const
int hadLv11 () const
const GlobalPointhadPosition () const
float hcalTime () const
double hottestCellE () const
CaloTowerDetId id () const
int ieta () const
int ietaAbs () const
int iphi () const
unsigned int numBadEcalCells () const
unsigned int numBadHcalCells () const
int numCrystals () const
unsigned int numProblematicEcalCells () const
unsigned int numProblematicHcalCells () const
unsigned int numRecoveredEcalCells () const
unsigned int numRecoveredHcalCells () const
double outerEnergy () const
double outerEt (Point v) const
double outerEt (double vtxZ) const
double outerEt () const
double p (Point v) const
double p (double vtxZ) const
math::PtEtaPhiMLorentzVector p4 (double vtxZ) const
math::PtEtaPhiMLorentzVector p4 (Point v) const
math::PtEtaPhiMLorentzVector p4_HO (double vtxZ) const
math::PtEtaPhiMLorentzVector p4_HO () const
math::PtEtaPhiMLorentzVector p4_HO (Point v) const
void setCaloTowerStatus (uint32_t s)
void setCaloTowerStatus (unsigned int numBadHcalChan, unsigned int numBadEcalChan, unsigned int numRecHcalChan, unsigned int numRecEcalChan, unsigned int numProbHcalChan, unsigned int numProbEcalChan)
void setEcalTime (int t)
void setHcalTime (int t)
void setHottestCellE (double e)
uint32_t towerStatusWord () const
int zside () const

Private Member Functions

math::PtEtaPhiMLorentzVector emP4 (Point v) const
math::PtEtaPhiMLorentzVector emP4 (double vtxZ) const
math::PtEtaPhiMLorentzVector hadP4 (double vtxZ) const
math::PtEtaPhiMLorentzVector hadP4 (Point v) const

Private Attributes

std::vector< DetIdconstituents_
int ecalTime_
float emE_
int emLvl1_
GlobalPoint emPosition_
float hadE_
int hadLvl1_
GlobalPoint hadPosition_
int hcalTime_
float hottestCellE_
CaloTowerDetId id_
float outerE_
uint32_t twrStatusWord_

Detailed Description

Date:
2011/02/25 22:03:20
Revision:
1.18
Author:
J. Mans - Minnesota

Definition at line 28 of file CaloTower.h.


Member Typedef Documentation

Definition at line 30 of file CaloTower.h.


Constructor & Destructor Documentation

CaloTower::CaloTower ( )

Definition at line 4 of file CaloTower.cc.

References emE_, emLvl1_, hadE_, hadLvl1_, and outerE_.

                     {
  emE_=0;
  hadE_=0;
  outerE_=0;
  emLvl1_=0;
  hadLvl1_=0;
}
CaloTower::CaloTower ( const CaloTowerDetId id,
double  emE,
double  hadE,
double  outerE,
int  ecal_tp,
int  hcal_tp,
const PolarLorentzVector  p4,
GlobalPoint  emPosition,
GlobalPoint  hadPosition 
)

Definition at line 12 of file CaloTower.cc.

                                                            : 
  LeafCandidate(0, p4, Point(0,0,0)),  
  id_(id),
  emPosition_(emPos), hadPosition_(hadPos), 
  emE_(emE), hadE_(hadE), outerE_(outerE),
  emLvl1_(ecal_tp), hadLvl1_(hcal_tp) {}
CaloTower::CaloTower ( const CaloTowerDetId id,
double  emE,
double  hadE,
double  outerE,
int  ecal_tp,
int  hcal_tp,
const LorentzVector  p4,
GlobalPoint  emPosition,
GlobalPoint  hadPosition 
)

Definition at line 24 of file CaloTower.cc.

                                                            : 
  LeafCandidate(0, p4, Point(0,0,0)),  
  id_(id),
  emPosition_(emPos), hadPosition_(hadPos),
  emE_(emE), hadE_(hadE), outerE_(outerE),
  emLvl1_(ecal_tp), hadLvl1_(hcal_tp) {}

Member Function Documentation

void CaloTower::addConstituent ( DetId  id) [inline]

Definition at line 51 of file CaloTower.h.

References constituents_.

{ constituents_.push_back( id ); }
void CaloTower::addConstituents ( const std::vector< DetId > &  ids)

Definition at line 153 of file CaloTower.cc.

References constituents_.

Referenced by CaloTowersCreationAlgo::convert(), CaloTowersMerger::mergedTower(), and CaloTowersCreationAlgo::rescaleTowers().

                                                             {
  constituents_.reserve(constituents_.size()+ids.size());
  constituents_.insert(constituents_.end(),ids.begin(),ids.end());
}
DetId CaloTower::constituent ( size_t  i) const [inline]
const std::vector<DetId>& CaloTower::constituents ( ) const [inline]
size_t CaloTower::constituentsSize ( ) const [inline]
float CaloTower::ecalTime ( ) const [inline]

Definition at line 150 of file CaloTower.h.

References ecalTime_.

Referenced by CaloTowersMerger::mergedTower(), and CaloTowersCreationAlgo::rescale().

{ return float(ecalTime_) * 0.01; }
double CaloTower::emEnergy ( ) const [inline]
double CaloTower::emEt ( double  vtxZ) const [inline]

Definition at line 103 of file CaloTower.h.

References emE_, reco::LeafCandidate::p4(), funct::sin(), and reco::LeafCandidate::theta().

{ return  emE_ * sin(p4(vtxZ).theta()); }
double CaloTower::emEt ( Point  v) const [inline]

Definition at line 113 of file CaloTower.h.

References emE_, reco::LeafCandidate::p4(), funct::sin(), and reco::LeafCandidate::theta().

{ return  emE_ * sin(p4(v).theta()); }
double CaloTower::emEt ( ) const [inline]
int CaloTower::emLvl1 ( ) const [inline]

Definition at line 132 of file CaloTower.h.

References emLvl1_.

{ return emLvl1_; }
math::PtEtaPhiMLorentzVector CaloTower::emP4 ( Point  v) const [private]

Definition at line 93 of file CaloTower.cc.

References dir, emE_, emPosition_, reco::LeafCandidate::p(), and funct::sin().

Referenced by p4().

                                                        {

  if (emE_>0) {
    GlobalPoint p(v.x(), v.y(), v.z());
    math::XYZVector dir = math::XYZVector(emPosition_ - p);
    return math::PtEtaPhiMLorentzVector(emE_ * sin(dir.theta()), dir.eta(), dir.phi(), 0.0);   
  }
  
  return   math::PtEtaPhiMLorentzVector(0,0,0,0);
}
math::PtEtaPhiMLorentzVector CaloTower::emP4 ( double  vtxZ) const [private]

Definition at line 59 of file CaloTower.cc.

References emE_, emPosition_, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), and PV3DBase< T, PVType, FrameType >::z().

                                                            {

  if (emE_>0) {
    double ctgTheta = (emPosition_.z() - vtxZ)/emPosition_.perp();
    double newEta = asinh(ctgTheta);  
    double pf = 1.0/cosh(newEta);
  
    return math::PtEtaPhiMLorentzVector(emE_ * pf, newEta, emPosition_.phi(), 0.0);   
  }
  
  return math::PtEtaPhiMLorentzVector(0,0,0,0);
}
const GlobalPoint& CaloTower::emPosition ( ) const [inline]

Definition at line 129 of file CaloTower.h.

References emPosition_.

Referenced by CaloTowersMerger::mergedTower().

{ return emPosition_ ; }
double CaloTower::energyInHB ( ) const

Definition at line 198 of file CaloTower.cc.

References hadE_, id_, CaloTowerDetId::ietaAbs(), and outerE_.

                                    { 
  if (id_.ietaAbs()<16) return hadE_;
  else if (id_.ietaAbs()==16) return hadE_-outerE_;
  else return 0.0;
}
double CaloTower::energyInHE ( ) const

Definition at line 204 of file CaloTower.cc.

References hadE_, id_, CaloTowerDetId::ietaAbs(), and outerE_.

                                   { 
  if (id_.ietaAbs()>16 && id_.ietaAbs()<30) return hadE_;
  else if (id_.ietaAbs()==16) return outerE_;
  else return 0.0;
}
double CaloTower::energyInHF ( ) const

Definition at line 210 of file CaloTower.cc.

References reco::LeafCandidate::energy(), id_, and CaloTowerDetId::ietaAbs().

                                   {
  if (id_.ietaAbs()>29) return energy();
  else return 0.0;
}
double CaloTower::energyInHO ( ) const

Definition at line 220 of file CaloTower.cc.

References emE_, reco::LeafCandidate::energy(), hadE_, id_, and CaloTowerDetId::ietaAbs().

                                   {
  if (id_.ietaAbs()>15) return 0.0;
  else return (energy() - hadE_ -emE_);
}
double CaloTower::et ( double  vtxZ) const [inline]
double CaloTower::et ( Point  v) const [inline]

Definition at line 111 of file CaloTower.h.

References reco::LeafCandidate::p4().

{ return p4(v).Et(); }
double CaloTower::hadEnergy ( ) const [inline]
double CaloTower::hadEnergyHeInnerLayer ( ) const [inline]

Definition at line 137 of file CaloTower.h.

References hadE_, id_, CaloTowerDetId::ietaAbs(), and outerE_.

{ return (id_.ietaAbs()<18 || id_.ietaAbs()>29)? 0 : hadE_ - outerE_; }
double CaloTower::hadEnergyHeOuterLayer ( ) const [inline]

Definition at line 136 of file CaloTower.h.

References id_, CaloTowerDetId::ietaAbs(), and outerE_.

{ return (id_.ietaAbs()<18 || id_.ietaAbs()>29)? 0 : outerE_; }
double CaloTower::hadEt ( ) const [inline]
double CaloTower::hadEt ( double  vtxZ) const [inline]

Definition at line 104 of file CaloTower.h.

References hadE_, reco::LeafCandidate::p4(), funct::sin(), and reco::LeafCandidate::theta().

{ return  hadE_ * sin(p4(vtxZ).theta()); }
double CaloTower::hadEt ( Point  v) const [inline]

Definition at line 114 of file CaloTower.h.

References hadE_, reco::LeafCandidate::p4(), funct::sin(), and reco::LeafCandidate::theta().

{ return  hadE_ * sin(p4(v).theta()); }
int CaloTower::hadLv11 ( ) const [inline]

Definition at line 133 of file CaloTower.h.

References hadLvl1_.

{ return hadLvl1_; }
math::PtEtaPhiMLorentzVector CaloTower::hadP4 ( Point  v) const [private]

Definition at line 76 of file CaloTower.cc.

References abs, dir, emE_, reco::LeafCandidate::energy(), hadE_, hadPosition_, ieta(), reco::LeafCandidate::p(), and funct::sin().

Referenced by p4().

                                                         {

  // note: for now we use the same position for HO as for the other detectors

  double hcalTot;
  if (abs(ieta())<16) hcalTot = (energy() - emE_);
  else hcalTot = hadE_;

  if (hcalTot>0) {
    GlobalPoint p(v.x(), v.y(), v.z());
    math::XYZVector dir = math::XYZVector(hadPosition_ - p);
    return math::PtEtaPhiMLorentzVector(hcalTot * sin(dir.theta()), dir.eta(), dir.phi(), 0.0);  
  }

  return   math::PtEtaPhiMLorentzVector(0,0,0,0);
}
math::PtEtaPhiMLorentzVector CaloTower::hadP4 ( double  vtxZ) const [private]

Definition at line 39 of file CaloTower.cc.

References abs, emE_, reco::LeafCandidate::energy(), hadE_, hadPosition_, ieta(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), and PV3DBase< T, PVType, FrameType >::z().

                                                             {


  // note: for now we use the same position for HO as for the other detectors

  double hcalTot;
  if (abs(ieta())<16) hcalTot = (energy() - emE_);
  else hcalTot = hadE_;

  if (hcalTot>0) {
    double ctgTheta = (hadPosition_.z() - vtxZ)/hadPosition_.perp();
    double newEta = asinh(ctgTheta);  
    double pf = 1.0/cosh(newEta);

    return PolarLorentzVector(hcalTot * pf, newEta, hadPosition_.phi(), 0.0);   
  }
  
  return math::PtEtaPhiMLorentzVector(0,0,0,0);
}
const GlobalPoint& CaloTower::hadPosition ( ) const [inline]

Definition at line 130 of file CaloTower.h.

References hadPosition_.

Referenced by CaloTowersMerger::mergedTower().

{ return hadPosition_ ; }
float CaloTower::hcalTime ( ) const [inline]

Definition at line 151 of file CaloTower.h.

References hcalTime_.

Referenced by CaloTowersMerger::mergedTower(), and CaloTowersCreationAlgo::rescale().

{ return float(hcalTime_) * 0.01; }
double CaloTower::hottestCellE ( ) const [inline]

Definition at line 117 of file CaloTower.h.

References hottestCellE_.

Referenced by CaloTowersMerger::mergedTower().

{ return hottestCellE_; }
CaloTowerDetId CaloTower::id ( void  ) const [inline]
int CaloTower::ieta ( ) const [inline]
int CaloTower::ietaAbs ( ) const [inline]
int CaloTower::iphi ( ) const [inline]
unsigned int CaloTower::numBadEcalCells ( ) const [inline]

Definition at line 165 of file CaloTower.h.

References twrStatusWord_.

Referenced by CaloTowersMerger::mergedTower(), and AnomalousTower::operator()().

{ return (twrStatusWord_ & 0x1F); }
unsigned int CaloTower::numBadHcalCells ( ) const [inline]

Definition at line 169 of file CaloTower.h.

References twrStatusWord_.

Referenced by CaloTowersMerger::mergedTower(), and AnomalousTower::operator()().

{ return ( (twrStatusWord_ >> 15)& 0x7); }
int CaloTower::numCrystals ( ) const

Definition at line 158 of file CaloTower.cc.

References constituents_, DetId::Ecal, id_, and CaloTowerDetId::ietaAbs().

                                 {
  if (id_.ietaAbs()>29) return 0;
  
  int nC = 0;
  std::vector<DetId>::const_iterator it = constituents_.begin();
  for (; it!=constituents_.end(); ++it) {
    if (it->det()==DetId::Ecal) ++nC;
  }

  return nC;
}
unsigned int CaloTower::numProblematicEcalCells ( ) const [inline]

Definition at line 167 of file CaloTower.h.

References twrStatusWord_.

Referenced by CaloTowersMerger::mergedTower(), and AnomalousTower::operator()().

{ return ((twrStatusWord_ >> 10) & 0x1F); }
unsigned int CaloTower::numProblematicHcalCells ( ) const [inline]

Definition at line 171 of file CaloTower.h.

References twrStatusWord_.

Referenced by CaloTowersMerger::mergedTower(), and AnomalousTower::operator()().

{ return ((twrStatusWord_ >> 21) & 0x7); }
unsigned int CaloTower::numRecoveredEcalCells ( ) const [inline]

Definition at line 166 of file CaloTower.h.

References twrStatusWord_.

Referenced by CaloTowersMerger::mergedTower(), and AnomalousTower::operator()().

{ return ((twrStatusWord_ >> 5) & 0x1F); }
unsigned int CaloTower::numRecoveredHcalCells ( ) const [inline]

Definition at line 170 of file CaloTower.h.

References twrStatusWord_.

Referenced by CaloTowersMerger::mergedTower(), and AnomalousTower::operator()().

{ return ((twrStatusWord_ >> 18) & 0x7); }
double CaloTower::outerEnergy ( ) const [inline]
double CaloTower::outerEt ( ) const [inline]
double CaloTower::outerEt ( Point  v) const [inline]

Definition at line 115 of file CaloTower.h.

References id_, CaloTowerDetId::ietaAbs(), outerE_, reco::LeafCandidate::p4(), and funct::sin().

{ return (id_.ietaAbs()<16)? outerE_ * sin(p4(v).theta()) : 0.0; }
double CaloTower::outerEt ( double  vtxZ) const [inline]

Definition at line 105 of file CaloTower.h.

References id_, CaloTowerDetId::ietaAbs(), outerE_, reco::LeafCandidate::p4(), and funct::sin().

{ return (id_.ietaAbs()<16)? outerE_ * sin(p4(vtxZ).theta()) : 0.0; }
double CaloTower::p ( Point  v) const [inline]

Definition at line 110 of file CaloTower.h.

References reco::LeafCandidate::p4().

{ return p4(v).P(); }
double CaloTower::p ( double  vtxZ) const [inline]

Definition at line 100 of file CaloTower.h.

References reco::LeafCandidate::p4().

{ return p4(vtxZ).P(); }
math::PtEtaPhiMLorentzVector CaloTower::p4 ( double  vtxZ) const

Definition at line 105 of file CaloTower.cc.

References abs, emP4(), emPosition_, reco::LeafCandidate::energy(), hadP4(), ieta(), reco::LeafCandidate::p4(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by VirtualJetProducer::inputTowers(), fftjetcms::FFTJetInterface::loadInputCollection(), and CaloTowersMerger::mergedTower().

                                                          {

  if (abs(ieta())<=29) {
    return (emP4(vtxZ)+hadP4(vtxZ));
  }
  // em and had energy in HF are defined in a special way
  double ctgTheta = (emPosition_.z() - vtxZ)/emPosition_.perp(); // em and had positions in HF are forced to be the same
  double newEta = asinh(ctgTheta);  
  double pf = 1.0/cosh(newEta);
  return math::PtEtaPhiMLorentzVector(p4().energy() * pf, newEta, emPosition_.phi(), 0.0);   
}
math::PtEtaPhiMLorentzVector CaloTower::p4 ( Point  v) const

Definition at line 118 of file CaloTower.cc.

References abs, dir, emP4(), emPosition_, reco::LeafCandidate::energy(), hadP4(), ieta(), reco::LeafCandidate::p(), reco::LeafCandidate::p4(), and funct::sin().

                                                      {

  if (abs(ieta())<=29) {
    return emP4(v)+hadP4(v);
  }
  // em and had energy in HF are defined in a special way
  GlobalPoint p(v.x(), v.y(), v.z());
  math::XYZVector dir = math::XYZVector(emPosition_ - p); // em and had positions in HF are forced to be the same
  return math::PtEtaPhiMLorentzVector(p4().energy() * sin(dir.theta()), dir.eta(), dir.phi(), 0.0);   
}
math::PtEtaPhiMLorentzVector CaloTower::p4_HO ( double  vtxZ) const

Definition at line 141 of file CaloTower.cc.

References reco::LeafCandidate::p(), and p4_HO().

                                                             {
    Point p(0, 0, vtxZ);
    return p4_HO(p);
}
math::PtEtaPhiMLorentzVector CaloTower::p4_HO ( ) const
math::PtEtaPhiMLorentzVector CaloTower::p4_HO ( Point  v) const

Definition at line 132 of file CaloTower.cc.

References dir, hadPosition_, ietaAbs(), outerE_, reco::LeafCandidate::p(), and funct::sin().

                                                         {

  if (ietaAbs()>15 || outerE_<0) return   math::PtEtaPhiMLorentzVector(0,0,0,0);
  
  GlobalPoint p(v.x(), v.y(), v.z());
  math::XYZVector dir = math::XYZVector(hadPosition_ - p);
  return math::PtEtaPhiMLorentzVector(outerE_ * sin(dir.theta()), dir.eta(), dir.phi(), 0.0);  
}
void CaloTower::setCaloTowerStatus ( unsigned int  numBadHcalChan,
unsigned int  numBadEcalChan,
unsigned int  numRecHcalChan,
unsigned int  numRecEcalChan,
unsigned int  numProbHcalChan,
unsigned int  numProbEcalChan 
)

Definition at line 175 of file CaloTower.cc.

References twrStatusWord_.

Referenced by CaloTowersCreationAlgo::convert(), CaloTowersMerger::mergedTower(), and CaloTowersCreationAlgo::rescaleTowers().

                                                                                              {

  twrStatusWord_ = 0x0;

  twrStatusWord_ |= (  numBadEcalChan  & 0x1F);
  twrStatusWord_ |= ( (numRecEcalChan  & 0x1F) << 5);
  twrStatusWord_ |= ( (numProbEcalChan & 0x1F) << 10); 
  twrStatusWord_ |= ( (numBadHcalChan  & 0x7)  << 15);
  twrStatusWord_ |= ( (numRecHcalChan  & 0x7)  << 18);
  twrStatusWord_ |= ( (numProbHcalChan & 0x7)  << 21);

  return;
}
void CaloTower::setCaloTowerStatus ( uint32_t  s) [inline]

Definition at line 63 of file CaloTower.h.

References alignCSCRings::s, and twrStatusWord_.

void CaloTower::setEcalTime ( int  t) [inline]
void CaloTower::setHcalTime ( int  t) [inline]
void CaloTower::setHottestCellE ( double  e) [inline]

Definition at line 66 of file CaloTower.h.

References alignCSCRings::e, and hottestCellE_.

Referenced by CaloTowersCreationAlgo::convert(), and CaloTowersMerger::mergedTower().

uint32_t CaloTower::towerStatusWord ( ) const [inline]

Definition at line 174 of file CaloTower.h.

References twrStatusWord_.

{ return twrStatusWord_; }
int CaloTower::zside ( ) const [inline]

Definition at line 157 of file CaloTower.h.

References id_, and CaloTowerDetId::zside().

{ return id_.zside(); }

Member Data Documentation

std::vector<DetId> CaloTower::constituents_ [private]
int CaloTower::ecalTime_ [private]

Definition at line 187 of file CaloTower.h.

Referenced by ecalTime(), and setEcalTime().

float CaloTower::emE_ [private]

Definition at line 190 of file CaloTower.h.

Referenced by CaloTower(), emEnergy(), emEt(), emP4(), energyInHO(), and hadP4().

int CaloTower::emLvl1_ [private]

Definition at line 194 of file CaloTower.h.

Referenced by CaloTower(), and emLvl1().

Definition at line 183 of file CaloTower.h.

Referenced by emP4(), emPosition(), and p4().

float CaloTower::hadE_ [private]
int CaloTower::hadLvl1_ [private]

Definition at line 194 of file CaloTower.h.

Referenced by CaloTower(), and hadLv11().

Definition at line 184 of file CaloTower.h.

Referenced by hadP4(), hadPosition(), and p4_HO().

int CaloTower::hcalTime_ [private]

Definition at line 188 of file CaloTower.h.

Referenced by hcalTime(), and setHcalTime().

float CaloTower::hottestCellE_ [private]

Definition at line 192 of file CaloTower.h.

Referenced by hottestCellE(), and setHottestCellE().

float CaloTower::outerE_ [private]
uint32_t CaloTower::twrStatusWord_ [private]