CMS 3D CMS Logo

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

TrackDetMatchInfo Class Reference

#include <TrackDetMatchInfo.h>

List of all members.

Public Types

enum  EnergyType {
  EcalRecHits, HcalRecHits, HORecHits, TowerTotal,
  TowerEcal, TowerHcal, TowerHO
}

Public Member Functions

double coneEnergy (double dR, EnergyType)
double crossedEnergy (EnergyType)
 energy in detector elements crossed by the track by types
std::string dumpGeometry (const DetId &)
double ecalConeEnergy ()
double ecalCrossedEnergy ()
double ecalEnergy ()
double ecalTowerConeEnergy ()
double ecalTowerEnergy ()
DetId findMaxDeposition (const DetId &, EnergyType, int gridSize)
DetId findMaxDeposition (EnergyType)
 Find detector elements with highest energy deposition.
DetId findMaxDeposition (EnergyType, int gridSize)
GlobalPoint getPosition (const DetId &)
double hcalConeEnergy ()
double hcalCrossedEnergy ()
double hcalEnergy ()
double hcalTowerConeEnergy ()
double hcalTowerEnergy ()
double hoConeEnergy ()
double hoCrossedEnergy ()
double hoEnergy ()
double hoTowerConeEnergy ()
double hoTowerEnergy ()
int numberOfSegments () const
int numberOfSegmentsInDetector (int detector) const
int numberOfSegmentsInStation (int station, int detector) const
int numberOfSegmentsInStation (int station) const
double nXnEnergy (EnergyType, int gridSize=1)
 get energy of the NxN shape (N = 2*gridSize + 1) around track projection
double nXnEnergy (const DetId &, EnergyType, int gridSize=1)
 get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
void setCaloGeometry (edm::ESHandle< CaloGeometry > geometry)
 TrackDetMatchInfo ()

Public Attributes

std::vector< TAMuonChamberMatchchambers
std::vector< DetIdcrossedEcalIds
std::vector< const EcalRecHit * > crossedEcalRecHits
 hits in detector elements crossed by a track
std::vector< DetIdcrossedHcalIds
std::vector< const HBHERecHit * > crossedHcalRecHits
std::vector< DetIdcrossedHOIds
std::vector< const HORecHit * > crossedHORecHits
std::vector< DetIdcrossedPreshowerIds
std::vector< DetIdcrossedTowerIds
std::vector< const CaloTower * > crossedTowers
std::vector< const EcalRecHit * > ecalRecHits
 hits in the cone
double ecalTrueEnergy
std::vector< const HBHERecHit * > hcalRecHits
double hcalTrueEnergy
double hcalTrueEnergyCorrected
std::vector< const HORecHit * > hoRecHits
bool isGoodCalo
bool isGoodEcal
bool isGoodHcal
bool isGoodHO
bool isGoodMuon
const SimTracksimTrack
 MC truth info.
SimTrackRef simTrackRef_
FreeTrajectoryState stateAtIP
 track info
std::vector< const CaloTower * > towers
reco::TrackRef trackRef_
math::XYZPoint trkGlobPosAtEcal
 Track position at different parts of the calorimeter.
math::XYZPoint trkGlobPosAtHcal
math::XYZPoint trkGlobPosAtHO
GlobalVector trkMomAtEcal
GlobalVector trkMomAtHcal
GlobalVector trkMomAtHO

Private Member Functions

bool insideCone (const DetId &, const double)

Private Attributes

edm::ESHandle< CaloGeometrycaloGeometry

Detailed Description

Definition at line 14 of file TrackDetMatchInfo.h.


Member Enumeration Documentation

Enumerator:
EcalRecHits 
HcalRecHits 
HORecHits 
TowerTotal 
TowerEcal 
TowerHcal 
TowerHO 

Definition at line 16 of file TrackDetMatchInfo.h.


Constructor & Destructor Documentation

TrackDetMatchInfo::TrackDetMatchInfo ( )

Definition at line 314 of file TrackDetMatchInfo.cc.

                                    :
       trkGlobPosAtEcal(0,0,0)
     , trkGlobPosAtHcal(0,0,0)
     , trkGlobPosAtHO(0,0,0)
     , trkMomAtEcal(0,0,0)
     , trkMomAtHcal(0,0,0)
     , trkMomAtHO(0,0,0)
     , isGoodEcal(false)
     , isGoodHcal(false)
     , isGoodCalo(false)
     , isGoodHO(false)
     , isGoodMuon(false)
     , simTrack(0)
     , ecalTrueEnergy(-999)
     , hcalTrueEnergy(-999)
{
}

Member Function Documentation

double TrackDetMatchInfo::coneEnergy ( double  dR,
EnergyType  type 
)

cone energy around the track direction at the origin (0,0,0) ( not well defined for tracks originating away from IP)

Definition at line 108 of file TrackDetMatchInfo.cc.

References crossedTowers, ecalRecHits, EcalRecHits, relval_parameters_module::energy, Exception, HcalRecHits, hcalRecHits, hoRecHits, HORecHits, insideCone(), TowerEcal, TowerHcal, TowerHO, and TowerTotal.

Referenced by ecalConeEnergy(), ecalTowerConeEnergy(), hcalConeEnergy(), hcalTowerConeEnergy(), hoConeEnergy(), hoTowerConeEnergy(), and ProduceIsolationMap::produce().

{
   double energy(0);
   switch (type) {
    case EcalRecHits:
        {
           for(std::vector<const EcalRecHit*>::const_iterator hit=ecalRecHits.begin(); hit!=ecalRecHits.end(); hit++)
             if (insideCone((*hit)->detid(),dR)) energy += (*hit)->energy();
        }
      break;
    case HcalRecHits:
        {
           for(std::vector<const HBHERecHit*>::const_iterator hit = hcalRecHits.begin(); hit != hcalRecHits.end(); hit++)
             if (insideCone((*hit)->detid(),dR)) energy += (*hit)->energy();
        }
      break;
    case HORecHits:
        {
           for(std::vector<const HORecHit*>::const_iterator hit = hoRecHits.begin(); hit != hoRecHits.end(); hit++)
             if (insideCone((*hit)->detid(),dR)) energy += (*hit)->energy();
        }
      break;
    case TowerTotal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             if (insideCone((*hit)->id(),dR)) energy += (*hit)->energy();
        }
      break;
    case TowerEcal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             if (insideCone((*hit)->id(),dR)) energy += (*hit)->emEnergy();
        }
      break;
    case TowerHcal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             if (insideCone((*hit)->id(),dR)) energy += (*hit)->hadEnergy();
        }
      break;
    case TowerHO:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             if (insideCone((*hit)->id(),dR)) energy += (*hit)->outerEnergy();
        }
      break;
    default:
      throw cms::Exception("FatalError") << "Unknown calo energy type: " << type;
   }
   return energy;
}
double TrackDetMatchInfo::crossedEnergy ( EnergyType  type)

energy in detector elements crossed by the track by types

Definition at line 47 of file TrackDetMatchInfo.cc.

References crossedEcalRecHits, crossedHcalRecHits, crossedHORecHits, crossedTowers, EcalRecHits, relval_parameters_module::energy, Exception, HcalRecHits, HORecHits, TowerEcal, TowerHcal, TowerHO, and TowerTotal.

Referenced by BetaCalculatorECAL::addInfoToCandidate(), ecalCrossedEnergy(), ecalTowerEnergy(), MuonIdProducer::fillMuonId(), hcalCrossedEnergy(), hcalTowerEnergy(), hoCrossedEnergy(), and hoTowerEnergy().

{
   double energy(0);
   switch (type) {
    case EcalRecHits:
        {
           for(std::vector<const EcalRecHit*>::const_iterator hit=crossedEcalRecHits.begin(); hit!=crossedEcalRecHits.end(); hit++)
             energy += (*hit)->energy();
        }
      break;
    case HcalRecHits:
        {
           for(std::vector<const HBHERecHit*>::const_iterator hit = crossedHcalRecHits.begin(); hit != crossedHcalRecHits.end(); hit++)
             energy += (*hit)->energy();
        }
      break;
    case HORecHits:
        {
           for(std::vector<const HORecHit*>::const_iterator hit = crossedHORecHits.begin(); hit != crossedHORecHits.end(); hit++)
             energy += (*hit)->energy();
        }
      break;
    case TowerTotal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             energy += (*hit)->energy();
        }
      break;
    case TowerEcal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             energy += (*hit)->emEnergy();
        }
      break;
    case TowerHcal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             energy += (*hit)->hadEnergy();
        }
      break;
    case TowerHO:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=crossedTowers.begin(); hit!=crossedTowers.end(); hit++)
             energy += (*hit)->outerEnergy();
        }
      break;
    default:
      throw cms::Exception("FatalError") << "Unknown calo energy type: " << type;
   }
   return energy;
}
std::string TrackDetMatchInfo::dumpGeometry ( const DetId id)

Definition at line 17 of file TrackDetMatchInfo.cc.

References EZArrayFL< T >::begin(), caloGeometry, EZArrayFL< T >::end(), Exception, edm::ESHandleBase::isValid(), and point.

{
   if ( ! caloGeometry.isValid() || 
        ! caloGeometry->getSubdetectorGeometry(id) ||
        ! caloGeometry->getSubdetectorGeometry(id)->getGeometry(id) ) {
      throw cms::Exception("FatalError")  << "Failed to access geometry for DetId: " << id.rawId();
   }
   std::ostringstream oss;

   const CaloCellGeometry::CornersVec& points = caloGeometry->getSubdetectorGeometry(id)->getGeometry(id)->getCorners();
   for( CaloCellGeometry::CornersVec::const_iterator point = points.begin();
       point != points.end(); ++point)
     oss << "(" << point->z() << ", " << point->perp() << ", " << point->eta() << ", " << point->phi() << "), \t";
   return oss.str();
}
double TrackDetMatchInfo::ecalConeEnergy ( )

Definition at line 581 of file TrackDetMatchInfo.cc.

References coneEnergy(), and EcalRecHits.

{
   return coneEnergy (999, EcalRecHits );
}
double TrackDetMatchInfo::ecalCrossedEnergy ( )

Definition at line 596 of file TrackDetMatchInfo.cc.

References crossedEnergy(), and EcalRecHits.

Referenced by ecalEnergy().

{
   return crossedEnergy( EcalRecHits );
}
double TrackDetMatchInfo::ecalEnergy ( ) [inline]

Definition at line 103 of file TrackDetMatchInfo.h.

References ecalCrossedEnergy().

{ return ecalCrossedEnergy(); }
double TrackDetMatchInfo::ecalTowerConeEnergy ( ) [inline]

Definition at line 97 of file TrackDetMatchInfo.h.

References coneEnergy(), and TowerEcal.

{ return coneEnergy(999,TowerEcal); }
double TrackDetMatchInfo::ecalTowerEnergy ( ) [inline]

Definition at line 96 of file TrackDetMatchInfo.h.

References crossedEnergy(), and TowerEcal.

{ return crossedEnergy(TowerEcal); }
DetId TrackDetMatchInfo::findMaxDeposition ( EnergyType  type)

Find detector elements with highest energy deposition.

Definition at line 332 of file TrackDetMatchInfo.cc.

References ecalRecHits, EcalRecHits, relval_parameters_module::energy, Exception, HcalRecHits, hcalRecHits, hoRecHits, HORecHits, TowerEcal, TowerHcal, TowerHO, towers, and TowerTotal.

Referenced by MuonIdProducer::fillMuonId(), findMaxDeposition(), and InterestingTrackEcalDetIdProducer::produce().

{
   DetId id;
   float maxEnergy = -9999;
   switch (type) {
    case EcalRecHits:
        {
           for(std::vector<const EcalRecHit*>::const_iterator hit=ecalRecHits.begin(); hit!=ecalRecHits.end(); hit++)
             if ( (*hit)->energy() > maxEnergy ) {
                maxEnergy = (*hit)->energy();
                id = (*hit)->detid();
             }
        }
      break;
    case HcalRecHits:
        {
           for(std::vector<const HBHERecHit*>::const_iterator hit=hcalRecHits.begin(); hit!=hcalRecHits.end(); hit++)
             if ( (*hit)->energy() > maxEnergy ) {
                maxEnergy = (*hit)->energy();
                id = (*hit)->detid();
             }
        }
      break;
    case HORecHits:
        {
           for(std::vector<const HORecHit*>::const_iterator hit=hoRecHits.begin(); hit!=hoRecHits.end(); hit++)
             if ( (*hit)->energy() > maxEnergy ) {
                maxEnergy = (*hit)->energy();
                id = (*hit)->detid();
             }
        }
      break;
    case TowerTotal:
    case TowerEcal:
    case TowerHcal:
        {
           for(std::vector<const CaloTower*>::const_iterator hit=towers.begin(); hit!=towers.end(); hit++)
             {
                double energy = 0;
                switch (type) {
                 case TowerTotal:
                   energy = (*hit)->energy();
                   break;
                 case TowerEcal:
                   energy = (*hit)->emEnergy();
                   break;
                 case TowerHcal:
                   energy = (*hit)->hadEnergy();
                   break;
                 case TowerHO:
                   energy = (*hit)->energy();
                   break;
                 default:
                   throw cms::Exception("FatalError") << "Unknown calo tower energy type: " << type;
                }
                if ( energy > maxEnergy ) {
                   maxEnergy = energy;
                   id = (*hit)->id();
                }
             }
        }
    default:
      throw cms::Exception("FatalError") << "Maximal energy deposition: unkown or not implemented energy type requested, type:" << type;
   }
   return id;
}
DetId TrackDetMatchInfo::findMaxDeposition ( const DetId id,
EnergyType  type,
int  gridSize 
)

Definition at line 399 of file TrackDetMatchInfo.cc.

References abs, DetId::Calo, dPhi(), DetId::Ecal, EcalBarrel, EcalEndcap, ecalRecHits, EcalRecHits, Exception, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, HcalRecHits, hcalRecHits, hoRecHits, HORecHits, EBDetId::ieta(), CaloTowerDetId::ieta(), HcalDetId::ieta(), info, HcalDetId::iphi(), EBDetId::iphi(), CaloTowerDetId::iphi(), EEDetId::ix(), EEDetId::iy(), TowerEcal, TowerHcal, TowerHO, towers, TowerTotal, and EEDetId::zside().

{
   double energy_max(0);
   DetId id_max;
   if ( id.rawId() == 0 ) return id_max;
   switch (type)  {
    case TowerTotal:
    case TowerHcal:
    case TowerEcal:
    case TowerHO:
        {
           if ( id.det() != DetId::Calo ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected CaloTower, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           CaloTowerDetId centerId(id);
           for(std::vector<const CaloTower*>::const_iterator hit=towers.begin(); hit!=towers.end(); hit++) {
              CaloTowerDetId neighborId((*hit)->id());
              int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                              -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
              int dPhi = abs( centerId.iphi()-neighborId.iphi() );
              if ( abs(72-dPhi) < dPhi ) dPhi = 72-dPhi;
              if(  dEta <= gridSize && dPhi <= gridSize ) {
                 switch (type) {
                  case TowerTotal:
                    if ( energy_max < (*hit)->energy() ){
                       energy_max = (*hit)->energy();
                       id_max = (*hit)->id();
                    }
                    break;
                  case TowerEcal:
                    if ( energy_max < (*hit)->emEnergy() ){
                       energy_max = (*hit)->emEnergy();
                       id_max = (*hit)->id();
                    }
                    break;
                  case TowerHcal:
                    if ( energy_max < (*hit)->hadEnergy() ){
                       energy_max = (*hit)->hadEnergy();
                       id_max = (*hit)->id();
                    }
                    break;
                  case TowerHO:
                    if ( energy_max < (*hit)->outerEnergy() ){
                       energy_max = (*hit)->outerEnergy();
                       id_max = (*hit)->id();
                    }
                    break;
                  default:
                    throw cms::Exception("FatalError") << "Unknown calo tower energy type: " << type;
                 }
              }
           }
        }
      break;
    case EcalRecHits:
        {
           if( id.det() != DetId::Ecal || (id.subdetId() != EcalBarrel && id.subdetId() != EcalEndcap) ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected EcalBarrel or EcalEndcap, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           // Since the ECAL granularity is small and the gap between EE and EB is significant,
           // energy is computed only within the system that contains the central element
           if( id.subdetId() == EcalBarrel ) {
              EBDetId centerId(id);
              for(std::vector<const EcalRecHit*>::const_iterator hit=ecalRecHits.begin(); hit!=ecalRecHits.end(); hit++) {
                 if ((*hit)->id().subdetId() != EcalBarrel) continue;
                 EBDetId neighborId((*hit)->id());
                 int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                                 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
                 int dPhi = abs( centerId.iphi()-neighborId.iphi() );
                 if ( abs(360-dPhi) < dPhi ) dPhi = 360-dPhi;
                 if(  dEta <= gridSize && dPhi <= gridSize ) {
                    if ( energy_max < (*hit)->energy() ){
                       energy_max = (*hit)->energy();
                       id_max = (*hit)->id();
                    }
                 }
              }
           } else {
              // Endcap
              EEDetId centerId(id);
              for(std::vector<const EcalRecHit*>::const_iterator hit=ecalRecHits.begin(); hit!=ecalRecHits.end(); hit++) {
                 if ((*hit)->id().subdetId() != EcalEndcap) continue;
                 EEDetId neighborId((*hit)->id());
                 if(  centerId.zside() == neighborId.zside() && 
                      abs(centerId.ix()-neighborId.ix()) <= gridSize && 
                      abs(centerId.iy()-neighborId.iy()) <= gridSize ) {
                    if ( energy_max < (*hit)->energy() ){
                       energy_max = (*hit)->energy();
                       id_max = (*hit)->id();
                    }
                 }
              }
           }
        }
      break;
    case HcalRecHits:
        {
           if( id.det() != DetId::Hcal || (id.subdetId() != HcalBarrel && id.subdetId() != HcalEndcap) ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected HE or HB, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           HcalDetId centerId(id);
           for(std::vector<const HBHERecHit*>::const_iterator hit=hcalRecHits.begin(); hit!=hcalRecHits.end(); hit++) {
              HcalDetId neighborId((*hit)->id());
              int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                              -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
              int dPhi = abs( centerId.iphi()-neighborId.iphi() );
              if ( abs(72-dPhi) < dPhi ) dPhi = 72-dPhi;
              if(  dEta <= gridSize && dPhi <= gridSize ){
                 if ( energy_max < (*hit)->energy() ){
                    energy_max = (*hit)->energy();
                    id_max = (*hit)->id();
                 }
              }
           }
        }
      break;
    case HORecHits:
        {
           if( id.det() != DetId::Hcal || (id.subdetId() != HcalOuter) ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected HO, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           HcalDetId centerId(id);
           for(std::vector<const HORecHit*>::const_iterator hit=hoRecHits.begin(); hit!=hoRecHits.end(); hit++) {
              HcalDetId neighborId((*hit)->id());
              int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                              -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
              int dPhi = abs( centerId.iphi()-neighborId.iphi() );
              if ( abs(72-dPhi) < dPhi ) dPhi = 72-dPhi;
              if(  dEta <= gridSize && dPhi <= gridSize ) {
                 if ( energy_max < (*hit)->energy() ){
                    energy_max = (*hit)->energy();
                    id_max = (*hit)->id();
                 }
              }
           }
        }
      break;
    default:
      throw cms::Exception("FatalError") << "Unkown or not implemented energy type requested, type:" << type;
   }
   return id_max;
}
DetId TrackDetMatchInfo::findMaxDeposition ( EnergyType  type,
int  gridSize 
)

Definition at line 546 of file TrackDetMatchInfo.cc.

References crossedEcalIds, crossedHcalIds, crossedHOIds, crossedTowerIds, EcalRecHits, Exception, findMaxDeposition(), HcalRecHits, HORecHits, TowerEcal, TowerHcal, TowerHO, and TowerTotal.

{
   DetId id_max;
   switch (type)  {
    case TowerTotal:
    case TowerHcal:
    case TowerEcal:
    case TowerHO:
      if( crossedTowerIds.empty() ) return id_max;
      return findMaxDeposition(crossedTowerIds.front(), type, gridSize);
      break;
    case EcalRecHits:
      if( crossedEcalIds.empty() ) return id_max;
      return findMaxDeposition(crossedEcalIds.front(), type, gridSize);
      break;
    case HcalRecHits:
      if( crossedHcalIds.empty() ) return id_max;
      return findMaxDeposition(crossedHcalIds.front(), type, gridSize);
      break;
    case HORecHits:
      if( crossedHOIds.empty() ) return id_max;
      return findMaxDeposition(crossedHOIds.front(), type, gridSize);
      break;
    default:
      throw cms::Exception("FatalError") << "Unkown or not implemented energy type requested, type:" << type;
   }
   return id_max;
}
GlobalPoint TrackDetMatchInfo::getPosition ( const DetId id)

Definition at line 34 of file TrackDetMatchInfo.cc.

References caloGeometry, Exception, and edm::ESHandleBase::isValid().

Referenced by BetaCalculatorECAL::addInfoToCandidate(), and insideCone().

{
   // this part might be slow
   if ( ! caloGeometry.isValid() || 
        ! caloGeometry->getSubdetectorGeometry(id) ||
        ! caloGeometry->getSubdetectorGeometry(id)->getGeometry(id) ) {
      throw cms::Exception("FatalError") << "Failed to access geometry for DetId: " << id.rawId();
      return GlobalPoint(0,0,0);
   }
   return caloGeometry->getSubdetectorGeometry(id)->getGeometry(id)->getPosition();
}
double TrackDetMatchInfo::hcalConeEnergy ( )

Definition at line 586 of file TrackDetMatchInfo.cc.

References coneEnergy(), and HcalRecHits.

{
   return coneEnergy (999, HcalRecHits );
}
double TrackDetMatchInfo::hcalCrossedEnergy ( )

Definition at line 601 of file TrackDetMatchInfo.cc.

References crossedEnergy(), and HcalRecHits.

Referenced by hcalEnergy().

{
   return crossedEnergy( HcalRecHits );
}
double TrackDetMatchInfo::hcalEnergy ( ) [inline]

Definition at line 104 of file TrackDetMatchInfo.h.

References hcalCrossedEnergy().

{ return hcalCrossedEnergy(); }
double TrackDetMatchInfo::hcalTowerConeEnergy ( ) [inline]

Definition at line 99 of file TrackDetMatchInfo.h.

References coneEnergy(), and TowerHcal.

{ return coneEnergy(999, TowerHcal); }
double TrackDetMatchInfo::hcalTowerEnergy ( ) [inline]

Definition at line 98 of file TrackDetMatchInfo.h.

References crossedEnergy(), and TowerHcal.

{ return crossedEnergy(TowerHcal); }
double TrackDetMatchInfo::hoConeEnergy ( )

Definition at line 591 of file TrackDetMatchInfo.cc.

References coneEnergy(), and HcalRecHits.

{
   return coneEnergy (999, HcalRecHits );
}
double TrackDetMatchInfo::hoCrossedEnergy ( )

Definition at line 606 of file TrackDetMatchInfo.cc.

References crossedEnergy(), and HORecHits.

Referenced by hoEnergy().

{
   return crossedEnergy( HORecHits );
}
double TrackDetMatchInfo::hoEnergy ( ) [inline]

Definition at line 105 of file TrackDetMatchInfo.h.

References hoCrossedEnergy().

{ return hoCrossedEnergy(); }
double TrackDetMatchInfo::hoTowerConeEnergy ( ) [inline]

Definition at line 101 of file TrackDetMatchInfo.h.

References coneEnergy(), and TowerHO.

{ return coneEnergy(999, TowerHO); }
double TrackDetMatchInfo::hoTowerEnergy ( ) [inline]

Definition at line 100 of file TrackDetMatchInfo.h.

References crossedEnergy(), and TowerHO.

{ return crossedEnergy(TowerHO); }
bool TrackDetMatchInfo::insideCone ( const DetId id,
const double  dR 
) [private]

Definition at line 99 of file TrackDetMatchInfo.cc.

References getPosition(), PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), stateAtIP, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by coneEnergy().

                                                                   {
   GlobalPoint idPosition = getPosition(id);
   if (idPosition.mag()<0.01) return false;
   
   math::XYZVector idPositionRoot( idPosition.x(), idPosition.y(), idPosition.z() );
   math::XYZVector trackP3( stateAtIP.momentum().x(), stateAtIP.momentum().y(), stateAtIP.momentum().z() );
   return ROOT::Math::VectorUtil::DeltaR(trackP3, idPositionRoot) < 0.5;
}
int TrackDetMatchInfo::numberOfSegments ( ) const

Definition at line 612 of file TrackDetMatchInfo.cc.

References chambers.

                                              {
   int numSegments = 0;
   for(std::vector<TAMuonChamberMatch>::const_iterator chamber=chambers.begin(); chamber!=chambers.end(); chamber++)
     numSegments += chamber->segments.size();
   return numSegments;
}
int TrackDetMatchInfo::numberOfSegmentsInDetector ( int  detector) const

Definition at line 633 of file TrackDetMatchInfo.cc.

References chambers.

                                                                    {
   int numSegments = 0;
   for(std::vector<TAMuonChamberMatch>::const_iterator chamber=chambers.begin(); chamber!=chambers.end(); chamber++)
     if(chamber->detector()==detector) numSegments += chamber->segments.size();
   return numSegments;
}
int TrackDetMatchInfo::numberOfSegmentsInStation ( int  station) const

Definition at line 619 of file TrackDetMatchInfo.cc.

References chambers, and relativeConstraints::station.

                                                                  {
   int numSegments = 0;
   for(std::vector<TAMuonChamberMatch>::const_iterator chamber=chambers.begin(); chamber!=chambers.end(); chamber++)
     if(chamber->station()==station) numSegments += chamber->segments.size();
   return numSegments;
}
int TrackDetMatchInfo::numberOfSegmentsInStation ( int  station,
int  detector 
) const

Definition at line 626 of file TrackDetMatchInfo.cc.

References chambers.

                                                                                {
   int numSegments = 0;
   for(std::vector<TAMuonChamberMatch>::const_iterator chamber=chambers.begin(); chamber!=chambers.end(); chamber++)
     if(chamber->station()==station&&chamber->detector()==detector) numSegments += chamber->segments.size();
   return numSegments;
}
double TrackDetMatchInfo::nXnEnergy ( EnergyType  type,
int  gridSize = 1 
)

get energy of the NxN shape (N = 2*gridSize + 1) around track projection

Definition at line 285 of file TrackDetMatchInfo.cc.

References crossedEcalIds, crossedHcalIds, crossedHOIds, crossedTowerIds, EcalRecHits, Exception, HcalRecHits, HORecHits, nXnEnergy(), TowerEcal, TowerHcal, TowerHO, and TowerTotal.

{
   switch (type)  {
    case TowerTotal:
    case TowerHcal:
    case TowerEcal:
    case TowerHO:
      if( crossedTowerIds.empty() ) return 0;
      return nXnEnergy(crossedTowerIds.front(), type, gridSize);
      break;
    case EcalRecHits:
      if( crossedEcalIds.empty() ) return 0;
      return nXnEnergy(crossedEcalIds.front(), type, gridSize);
      break;
    case HcalRecHits:
      if( crossedHcalIds.empty() ) return 0;
      return nXnEnergy(crossedHcalIds.front(), type, gridSize);
      break;
    case HORecHits:
      if( crossedHOIds.empty() ) return 0;
      return nXnEnergy(crossedHOIds.front(), type, gridSize);
      break;
    default:
      throw cms::Exception("FatalError") << "Unkown or not implemented energy type requested, type:" << type;
   }
   return -999;
}
double TrackDetMatchInfo::nXnEnergy ( const DetId id,
EnergyType  type,
int  gridSize = 1 
)

get energy of the NxN shape (N = 2*gridSize + 1) around given detector element

Definition at line 163 of file TrackDetMatchInfo.cc.

References abs, DetId::Calo, dPhi(), DetId::Ecal, EcalBarrel, EcalEndcap, ecalRecHits, EcalRecHits, relval_parameters_module::energy, Exception, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, HcalRecHits, hcalRecHits, hoRecHits, HORecHits, EBDetId::ieta(), CaloTowerDetId::ieta(), HcalDetId::ieta(), info, HcalDetId::iphi(), EBDetId::iphi(), CaloTowerDetId::iphi(), EEDetId::ix(), EEDetId::iy(), TowerEcal, TowerHcal, TowerHO, towers, TowerTotal, and EEDetId::zside().

Referenced by BetaCalculatorECAL::addInfoToCandidate(), MuonIdProducer::fillMuonId(), and nXnEnergy().

{
   double energy(0);
   if ( id.rawId() == 0 ) return 0.;
   switch (type)  {
    case TowerTotal:
    case TowerHcal:
    case TowerEcal:
    case TowerHO:
        {
           if ( id.det() != DetId::Calo ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected CaloTower, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           CaloTowerDetId centerId(id);
           for(std::vector<const CaloTower*>::const_iterator hit=towers.begin(); hit!=towers.end(); hit++) {
              CaloTowerDetId neighborId((*hit)->id());
              int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                              -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
              int dPhi = abs( centerId.iphi()-neighborId.iphi() );
              if ( abs(72-dPhi) < dPhi ) dPhi = 72-dPhi;
              if(  dEta <= gridSize && dPhi <= gridSize ) {
                 switch (type) {
                  case TowerTotal:
                    energy += (*hit)->energy();
                    break;
                  case TowerEcal:
                    energy += (*hit)->emEnergy();
                    break;
                  case TowerHcal:
                    energy += (*hit)->hadEnergy();
                    break;
                  case TowerHO:
                    energy += (*hit)->outerEnergy();
                    break;
                  default:
                    throw cms::Exception("FatalError") << "Unknown calo tower energy type: " << type;
                 }
              }
           }
        }
      break;
    case EcalRecHits:
        {
           if( id.det() != DetId::Ecal || (id.subdetId() != EcalBarrel && id.subdetId() != EcalEndcap) ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected EcalBarrel or EcalEndcap, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           // Since the ECAL granularity is small and the gap between EE and EB is significant,
           // energy is computed only within the system that contains the central element
           if( id.subdetId() == EcalBarrel ) {
              EBDetId centerId(id);
              for(std::vector<const EcalRecHit*>::const_iterator hit=ecalRecHits.begin(); hit!=ecalRecHits.end(); hit++) {
                 if ((*hit)->id().subdetId() != EcalBarrel) continue;
                 EBDetId neighborId((*hit)->id());
                 int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                                 -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
                 int dPhi = abs( centerId.iphi()-neighborId.iphi() );
                 if ( abs(360-dPhi) < dPhi ) dPhi = 360-dPhi;
                 if(  dEta <= gridSize && dPhi <= gridSize ) {
                    energy += (*hit)->energy();
                 }
              }
           } else {
              // Endcap
              EEDetId centerId(id);
              for(std::vector<const EcalRecHit*>::const_iterator hit=ecalRecHits.begin(); hit!=ecalRecHits.end(); hit++) {
                 if ((*hit)->id().subdetId() != EcalEndcap) continue;
                 EEDetId neighborId((*hit)->id());
                 if(  centerId.zside() == neighborId.zside() && 
                      abs(centerId.ix()-neighborId.ix()) <= gridSize && 
                      abs(centerId.iy()-neighborId.iy()) <= gridSize ) {
                    energy += (*hit)->energy();
                 }
              }
           }
        }
      break;
    case HcalRecHits:
        {
           if( id.det() != DetId::Hcal || (id.subdetId() != HcalBarrel && id.subdetId() != HcalEndcap) ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected HE or HB, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           HcalDetId centerId(id);
           for(std::vector<const HBHERecHit*>::const_iterator hit=hcalRecHits.begin(); hit!=hcalRecHits.end(); hit++) {
              HcalDetId neighborId((*hit)->id());
              int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                              -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
              int dPhi = abs( centerId.iphi()-neighborId.iphi() );
              if ( abs(72-dPhi) < dPhi ) dPhi = 72-dPhi;
              if(  dEta <= gridSize && dPhi <= gridSize ){
                 energy += (*hit)->energy();
              }
           }
        }
      break;
    case HORecHits:
        {
           if( id.det() != DetId::Hcal || (id.subdetId() != HcalOuter) ) {
              throw cms::Exception("FatalError") << "Wrong DetId. Expected HO, but found:\n" <<
                DetIdInfo::info(id)<<"\n";
           }
           HcalDetId centerId(id);
           for(std::vector<const HORecHit*>::const_iterator hit=hoRecHits.begin(); hit!=hoRecHits.end(); hit++) {
              HcalDetId neighborId((*hit)->id());
              int dEta = abs( (centerId.ieta()<0?centerId.ieta()+1:centerId.ieta() )
                              -(neighborId.ieta()<0?neighborId.ieta()+1:neighborId.ieta() ) ) ;
              int dPhi = abs( centerId.iphi()-neighborId.iphi() );
              if ( abs(72-dPhi) < dPhi ) dPhi = 72-dPhi;
              if(  dEta <= gridSize && dPhi <= gridSize ) {
                 energy += (*hit)->energy();
              }
           }
        }
      break;
    default:
      throw cms::Exception("FatalError") << "Unkown or not implemented energy type requested, type:" << type;
   }
   return energy;
}
void TrackDetMatchInfo::setCaloGeometry ( edm::ESHandle< CaloGeometry geometry) [inline]

Definition at line 112 of file TrackDetMatchInfo.h.

References caloGeometry, and geometry.

Referenced by TrackDetectorAssociator::associate().


Member Data Documentation

Definition at line 117 of file TrackDetMatchInfo.h.

Referenced by dumpGeometry(), getPosition(), and setCaloGeometry().

hits in detector elements crossed by a track

Definition at line 60 of file TrackDetMatchInfo.h.

Referenced by crossedEnergy(), TrackDetectorAssociator::fillEcal(), and AlCaIsoTracksProducer::produce().

Definition at line 62 of file TrackDetMatchInfo.h.

Referenced by crossedEnergy(), and TrackDetectorAssociator::fillHO().

Definition at line 71 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillPreshower().

Definition at line 80 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillCaloTruth().

Definition at line 81 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillCaloTruth().

Definition at line 82 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillCaloTruth().

Definition at line 49 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillCaloTowers().

Definition at line 50 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillHO().

Definition at line 51 of file TrackDetMatchInfo.h.

MC truth info.

Definition at line 79 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::fillCaloTruth().

Definition at line 87 of file TrackDetMatchInfo.h.

std::vector<const CaloTower*> TrackDetMatchInfo::towers

Obsolete methods and data members for backward compatibility. Will be removed in future releases.

Definition at line 86 of file TrackDetMatchInfo.h.

Definition at line 45 of file TrackDetMatchInfo.h.

Referenced by TrackDetectorAssociator::associate().