CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

BetaCalculatorECAL Class Reference

#include <BetaCalculatorECAL.h>

List of all members.

Public Member Functions

void addInfoToCandidate (HSCParticle &candidate, edm::Handle< reco::TrackCollection > &tracks, edm::Event &iEvent, const edm::EventSetup &iSetup, HSCPCaloInfo &caloInfo)
 BetaCalculatorECAL (const edm::ParameterSet &iConfig)

Private Member Functions

void addStepToXtal (std::map< int, GlobalPoint > &trackExitPositionMap, std::map< int, float > &trackCrossedXtalMap, DetId aDetId, float step, GlobalPoint point, const CaloSubdetectorGeometry *theSubdetGeometry)
std::vector
< SteppingHelixStateInfo
calcEcalDeposit (const FreeTrajectoryState *tkInnerState, const DetIdAssociator &associator)
int getDetailedTrackLengthInXtals (std::map< int, GlobalPoint > &trackExitPositionMap, std::map< int, float > &trackCrossedXtalMap, double &totalLengthCurved, GlobalPoint &internalPointCurved, GlobalPoint &externalPointCurved, const CaloGeometry *theGeometry, const CaloTopology *theTopology, const std::vector< SteppingHelixStateInfo > &neckLace)

Private Attributes

edm::ESHandle< MagneticFieldbField_
edm::InputTag EBRecHitCollection_
edm::ESHandle< DetIdAssociatorecalDetIdAssociator_
edm::InputTag EERecHitCollection_
TrackAssociatorParameters parameters_
edm::ESHandle< CaloGeometrytheCaloGeometry_
TrackDetectorAssociator trackAssociator_

Detailed Description

Definition at line 33 of file BetaCalculatorECAL.h.


Constructor & Destructor Documentation

BetaCalculatorECAL::BetaCalculatorECAL ( const edm::ParameterSet iConfig)

Member Function Documentation

void BetaCalculatorECAL::addInfoToCandidate ( HSCParticle candidate,
edm::Handle< reco::TrackCollection > &  tracks,
edm::Event iEvent,
const edm::EventSetup iSetup,
HSCPCaloInfo caloInfo 
)
void BetaCalculatorECAL::addStepToXtal ( std::map< int, GlobalPoint > &  trackExitPositionMap,
std::map< int, float > &  trackCrossedXtalMap,
DetId  aDetId,
float  step,
GlobalPoint  point,
const CaloSubdetectorGeometry theSubdetGeometry 
) [private]

Definition at line 341 of file BetaCalculatorECAL.cc.

References diffTreeTool::diff, CaloSubdetectorGeometry::getGeometry(), L1TEmulatorMonitor_cff::p, DetId::rawId(), launcher::step, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getDetailedTrackLengthInXtals().

{

  const CaloCellGeometry *cell_p = theSubdetGeometry->getGeometry(aDetId);
  GlobalPoint p = (dynamic_cast <const TruncatedPyramid *> (cell_p))->getPosition(23);
  GlobalPoint diff(point.x()-p.x(),point.y()-p.y(),point.z()-p.z());

  std::map<int,GlobalPoint>::iterator xtal = trackExitPositionMap.find(aDetId.rawId());
  if (xtal!=trackExitPositionMap.end())
    ((*xtal).second)=diff;
  else
    trackExitPositionMap.insert(std::pair<int,GlobalPoint>(aDetId.rawId(),diff));

  std::map<int,float>::iterator xtal2 = trackCrossedXtalMap.find(aDetId.rawId());
  if (xtal2!= trackCrossedXtalMap.end())
    ((*xtal2).second)+=step;
  else
    trackCrossedXtalMap.insert(std::pair<int,float>(aDetId.rawId(),step));
}
std::vector< SteppingHelixStateInfo > BetaCalculatorECAL::calcEcalDeposit ( const FreeTrajectoryState tkInnerState,
const DetIdAssociator associator 
) [private]

Definition at line 202 of file BetaCalculatorECAL.cc.

References alongMomentum, bField_, CachedTrajectory::getTrajectory(), FiducialVolume::maxR(), CosmicsPD_Skims::maxZ, FiducialVolume::maxZ(), FiducialVolume::minR(), displayMF_cfg::minZ, FiducialVolume::minZ(), CachedTrajectory::propagateAll(), CachedTrajectory::reset_trajectory(), CachedTrajectory::setMaxDetectorLength(), CachedTrajectory::setMaxDetectorRadius(), CachedTrajectory::setMinDetectorLength(), CachedTrajectory::setMinDetectorRadius(), CachedTrajectory::setPropagationStep(), CachedTrajectory::setPropagator(), CachedTrajectory::setStateAtIP(), SteppingHelixPropagator_cfi::SteppingHelixPropagator, and DetIdAssociator::volume().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{   
   // Set some parameters
   double minR = associator.volume().minR () ;
   double minZ = associator.volume().minZ () ;
   double maxR = associator.volume().maxR () ;
   double maxZ = associator.volume().maxZ () ;

   // Define the TrackOrigin (where the propagation starts)
   SteppingHelixStateInfo trackOrigin(*tkInnerState);

   // Define Propagator
   SteppingHelixPropagator* prop = new SteppingHelixPropagator (&*bField_, alongMomentum);
   prop -> setMaterialMode(false); 
   prop -> applyRadX0Correction(true);

   // Build the necklace
   CachedTrajectory neckLace;
   neckLace.setStateAtIP(trackOrigin);
   neckLace.reset_trajectory();
   neckLace.setPropagator(prop);
   neckLace.setPropagationStep(0.1);
   neckLace.setMinDetectorRadius(minR);
   neckLace.setMinDetectorLength(minZ*2.);
   neckLace.setMaxDetectorRadius(maxR);
   neckLace.setMaxDetectorLength(maxZ*2.);

   // Propagate track
   bool isPropagationSuccessful = neckLace.propagateAll(trackOrigin);

   if (!isPropagationSuccessful)
   {
     //std::cout << ">>>>>> calcEcalDeposits::propagateAll::failed " << "<<<<<<" << std::endl;
     //std::cout << "innerOrigin = " << glbTrackInnerOrigin.position() << "   innerR = " << innerR << std::endl; 
     return std::vector<SteppingHelixStateInfo> () ;
   }

   std::vector<SteppingHelixStateInfo> complicatePoints;
   neckLace.getTrajectory(complicatePoints, associator.volume(), 500);
   //std::cerr << "necklace size = " << complicatePoints.size() << std::endl;

   return complicatePoints;
}
int BetaCalculatorECAL::getDetailedTrackLengthInXtals ( std::map< int, GlobalPoint > &  trackExitPositionMap,
std::map< int, float > &  trackCrossedXtalMap,
double &  totalLengthCurved,
GlobalPoint internalPointCurved,
GlobalPoint externalPointCurved,
const CaloGeometry theGeometry,
const CaloTopology theTopology,
const std::vector< SteppingHelixStateInfo > &  neckLace 
) [private]

Definition at line 247 of file BetaCalculatorECAL.cc.

References addStepToXtal(), DetId::Ecal, CaloGeometry::getSubdetectorGeometry(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), gen::k, mag(), point, launcher::step, and funct::true.

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
   GlobalPoint origin (0., 0., 0.);
   internalPointCurved = origin ;
   externalPointCurved = origin ;

   bool firstPoint = false;
   trackCrossedXtalMap.clear();

   const CaloSubdetectorGeometry* theBarrelSubdetGeometry = theGeometry->getSubdetectorGeometry(DetId::Ecal,1);
   const CaloSubdetectorGeometry* theEndcapSubdetGeometry = theGeometry->getSubdetectorGeometry(DetId::Ecal,2);

   for(std::vector<SteppingHelixStateInfo>::const_iterator itr = (neckLace.begin() + 1); itr != neckLace.end(); ++itr)
   {
     GlobalPoint probe_gp = (*itr).position();
     GlobalVector probe_gv = (*itr).momentum();
     std::vector<DetId> surroundingMatrix;

     EBDetId closestBarrelDetIdToProbe = ((theBarrelSubdetGeometry -> getClosestCell(probe_gp)).rawId());
     EEDetId closestEndcapDetIdToProbe = ((theEndcapSubdetGeometry -> getClosestCell(probe_gp)).rawId());

     // check if the probe is inside the xtal
     if( (closestEndcapDetIdToProbe) && (theGeometry->getSubdetectorGeometry(closestEndcapDetIdToProbe)->
           getGeometry(closestEndcapDetIdToProbe)->inside(probe_gp)) )
     {
       double step = ((*itr).position() - (*(itr-1)).position()).mag();
       GlobalPoint point = itr->position();
       addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, closestEndcapDetIdToProbe, step, point, theEndcapSubdetGeometry);
       totalLengthCurved += step;

       if (firstPoint == false)
       {
         internalPointCurved = probe_gp ;
         firstPoint = true ;
       }

       externalPointCurved = probe_gp ;
     }

     if( (closestBarrelDetIdToProbe) && (theGeometry->getSubdetectorGeometry(closestBarrelDetIdToProbe)->
           getGeometry(closestBarrelDetIdToProbe)->inside(probe_gp)) )
     {
       double step = ((*itr).position() - (*(itr-1)).position()).mag();
       GlobalPoint point = itr->position();
       addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, closestBarrelDetIdToProbe, step, point, theBarrelSubdetGeometry);
       totalLengthCurved += step;

       if (firstPoint == false)
       {
         internalPointCurved = probe_gp ;
         firstPoint = true ;
       }

       externalPointCurved = probe_gp ;
     }
     else
     {
       // 3x3 matrix surrounding the probe
       surroundingMatrix = theTopology->getSubdetectorTopology(closestBarrelDetIdToProbe)->getWindow(closestBarrelDetIdToProbe,3,3);

       for( unsigned int k=0; k<surroundingMatrix.size(); ++k ) {
         if(theGeometry->getSubdetectorGeometry(surroundingMatrix.at(k))->getGeometry(surroundingMatrix.at(k))->inside(probe_gp))
         {
           double step = ((*itr).position() - (*(itr-1)).position()).mag();
           GlobalPoint point = itr->position();
           addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, surroundingMatrix[k], step,
               point, theGeometry->getSubdetectorGeometry(surroundingMatrix.at(k)));
           totalLengthCurved += step;

           if (firstPoint == false)
           {
             internalPointCurved = probe_gp ;
             firstPoint = true ;
           }

           externalPointCurved = probe_gp ;
         }
       }

       // clear neighborhood matrix
       surroundingMatrix.clear();
     }
   }

   return 0;
}

Member Data Documentation

Definition at line 64 of file BetaCalculatorECAL.h.

Referenced by BetaCalculatorTK::addInfoToCandidate(), and calcEcalDeposit().

Definition at line 60 of file BetaCalculatorECAL.h.

Referenced by BetaCalculatorTK::addInfoToCandidate().

Definition at line 63 of file BetaCalculatorECAL.h.

Referenced by BetaCalculatorTK::addInfoToCandidate().

Definition at line 61 of file BetaCalculatorECAL.h.

Referenced by BetaCalculatorTK::addInfoToCandidate().

Definition at line 65 of file BetaCalculatorECAL.h.

Referenced by BetaCalculatorTK::addInfoToCandidate().