CMS 3D CMS Logo

Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Private Attributes

PixelCPEBase Class Reference

#include <PixelCPEBase.h>

Inheritance diagram for PixelCPEBase:
PixelClusterParameterEstimator ClusterParameterEstimator< SiPixelCluster > PixelCPEGeneric PixelCPETemplateReco

List of all members.

Classes

struct  Param

Public Member Functions

unsigned int clusterProbComputationFlag () const
bool hasBadPixels () const
bool hasFilledProb () const
bool isOnEdge () const
virtual LocalError localError (const SiPixelCluster &cl, const GeomDetUnit &det) const =0
LocalValues localParameters (const SiPixelCluster &cl, const GeomDetUnit &det, float alpha, float beta) const
LocalValues localParameters (const SiPixelCluster &cl, const GeomDetUnit &det) const
LocalValues localParameters (const SiPixelCluster &cl, const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const
virtual LocalPoint localPosition (const SiPixelCluster &cl, const GeomDetUnit &det) const
 PixelCPEBase (edm::ParameterSet const &conf, const MagneticField *mag=0, const SiPixelLorentzAngle *lorentzAngle=0, const SiPixelCPEGenericErrorParm *genErrorParm=0, const SiPixelTemplateDBObject *templateDBobject=0)
float probabilityQ () const
float probabilityX () const
float probabilityXY () const
float probabilityY () const
float qBin () const
SiPixelRecHitQuality::QualWordType rawQualityWord () const
void setMagField (const MagneticField *mag) const
bool spansTwoRocks () const

Protected Types

typedef GloballyPositioned
< double > 
Frame

Protected Member Functions

void computeAnglesFromDetPosition (const SiPixelCluster &cl, const GeomDetUnit &det) const
void computeAnglesFromTrajectory (const SiPixelCluster &cl, const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const
void computeLorentzShifts () const
LocalVector driftDirection (GlobalVector bfield) const
LocalVector driftDirectionCorrect (GlobalVector bfield) const
bool isFlipped () const
virtual float lorentzShiftX () const
virtual float lorentzShiftY () const
MeasurementError measurementError (const SiPixelCluster &, const GeomDetUnit &det) const
MeasurementPoint measurementPosition (const SiPixelCluster &, const GeomDetUnit &det) const
void setTheDet (const GeomDetUnit &det, const SiPixelCluster &cluster) const
void xCharge (const std::vector< SiPixelCluster::Pixel > &, const int &, const int &, float &q1, float &q2) const
virtual float xpos (const SiPixelCluster &) const =0
void yCharge (const std::vector< SiPixelCluster::Pixel > &, const int &, const int &, float &q1, float &q2) const
virtual float ypos (const SiPixelCluster &) const =0

Protected Attributes

bool alpha2Order
float alpha_
float beta_
unsigned int clusterProbComputationFlag_
float cotalpha_
float cotbeta_
LocalVector driftDirection_
const SiPixelCPEGenericErrorParmgenErrorParm_
bool hasBadPixels_
bool hasFilledProb_
bool isOnEdge_
LocalTrajectoryParameters loc_traj_param_
Topology::LocalTrackPred loc_trk_pred_
const SiPixelLorentzAnglelorentzAngle_
double lorentzShiftInCmX_
double lorentzShiftInCmY_
double lorentzShiftX_
double lorentzShiftY_
const MagneticFieldmagfield_
int nRecHitsTotal_
int nRecHitsUsedEdge_
float probabilityQ_
float probabilityX_
float probabilityY_
float qBin_
bool spansTwoROCs_
const SiPixelTemplateDBObjecttemplateDBobject_
const PixelGeomDetUnittheDet
float theDetR
float theDetZ
float theLShiftX
float theLShiftY
float theNumOfCol
float theNumOfRow
GeomDetType::SubDetector thePart
float thePitchX
float thePitchY
float theSign
float theThickness
const PixelTopologytheTopol
int theVerboseLevel
float trk_lp_x
float trk_lp_y
bool with_track_angle

Private Types

typedef __gnu_cxx::hash_map
< unsigned int, Param
Params

Private Attributes

Params m_Params

Detailed Description

Definition at line 53 of file PixelCPEBase.h.


Member Typedef Documentation

typedef GloballyPositioned<double> PixelCPEBase::Frame [protected]

Definition at line 175 of file PixelCPEBase.h.

typedef __gnu_cxx::hash_map< unsigned int, Param> PixelCPEBase::Params [private]

Definition at line 353 of file PixelCPEBase.h.


Constructor & Destructor Documentation

PixelCPEBase::PixelCPEBase ( edm::ParameterSet const &  conf,
const MagneticField mag = 0,
const SiPixelLorentzAngle lorentzAngle = 0,
const SiPixelCPEGenericErrorParm genErrorParm = 0,
const SiPixelTemplateDBObject templateDBobject = 0 
)

Definition at line 44 of file PixelCPEBase.cc.

References alpha2Order, clusterProbComputationFlag_, genErrorParm_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), lorentzAngle_, mag(), magfield_, templateDBobject_, and theVerboseLevel.

  : theDet(0), nRecHitsTotal_(0), nRecHitsUsedEdge_(0),
    probabilityX_(0.0), probabilityY_(0.0),
    probabilityQ_(0.0), qBin_(0),
    isOnEdge_(0), hasBadPixels_(0),
    spansTwoROCs_(0),
    hasFilledProb_(0),
    loc_trk_pred_(0.0, 0.0, 0.0, 0.0)
{
  //--- Lorentz angle tangent per Tesla
  //   theTanLorentzAnglePerTesla =

  //     conf.getParameter<double>("TanLorentzAnglePerTesla");
  lorentzAngle_ = lorentzAngle;
  /*    if(!lorentzAngle_)
    theTanLorentzAnglePerTesla =
    conf.getParameter<double>("TanLorentzAnglePerTesla");
  */
  
  //--- Algorithm's verbosity
  theVerboseLevel = 
    conf.getUntrackedParameter<int>("VerboseLevel",0);
  
  //-- Magnetic Field
  magfield_ = mag;
  
  //-- Error Parametriaztion from DB for CPE Generic
  genErrorParm_ = genErrorParm;
  
  //-- Template Calibration Object from DB
  templateDBobject_ = templateDBobject;
  
  //-- Switch on/off E.B 
  alpha2Order = conf.getParameter<bool>("Alpha2Order");
  
  //--- A flag that could be used to change the behavior of
  //--- clusterProbability() in TSiPixelRecHit (the *transient* one).  
  //--- The problem is that the transient hits are made after the CPE runs
  //--- and they don't get the access to the PSet, so we pass it via the
  //--- CPE itself...
  //
  clusterProbComputationFlag_ 
    = (unsigned int) conf.getParameter<int>("ClusterProbComputationFlag");
  
}

Member Function Documentation

unsigned int PixelCPEBase::clusterProbComputationFlag ( ) const [inline]

Reimplemented from PixelClusterParameterEstimator.

Definition at line 156 of file PixelCPEBase.h.

References clusterProbComputationFlag_.

void PixelCPEBase::computeAnglesFromDetPosition ( const SiPixelCluster cl,
const GeomDetUnit det 
) const [protected]

Definition at line 223 of file PixelCPEBase.cc.

References alpha_, beta_, cotalpha_, cotbeta_, Exception, Topology::localPosition(), mathSSE::sqrt(), GeomDet::surface(), theDet, theTopol, Surface::toGlobal(), with_track_angle, SiPixelCluster::x(), PV3DBase< T, PVType, FrameType >::x(), SiPixelCluster::y(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by localParameters().

{
  //--- This is a new det unit, so cache it
  theDet = dynamic_cast<const PixelGeomDetUnit*>( &det );
  if ( ! theDet ) 
    {
      throw cms::Exception("PixelCPEBase::computeAngleFromDetPosition")
        << " Wrong pointer to pixel detector !!!" << endl;
    
    }

  // get cluster center of gravity (of charge)
  float xcenter = cl.x();
  float ycenter = cl.y();
  
  // get the cluster position in local coordinates (cm)

  // ggiurgiu@jhu.edu 12/09/2010 : This function is called without track info, therefore there are no track 
  // angles to provide here. Call the default localPosition (without track info)
  LocalPoint lp = theTopol->localPosition( MeasurementPoint(xcenter, ycenter) );

  // get the cluster position in global coordinates (cm)
  GlobalPoint gp = theDet->surface().toGlobal( lp );
  float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() );

  // normalize
  float gpx = gp.x()/gp_mod;
  float gpy = gp.y()/gp_mod;
  float gpz = gp.z()/gp_mod;

  // make a global vector out of the global point; this vector will point from the 
  // origin of the detector to the cluster
  GlobalVector gv(gpx, gpy, gpz);

  // make local unit vector along local X axis
  const Local3DVector lvx(1.0, 0.0, 0.0);

  // get the unit X vector in global coordinates/
  GlobalVector gvx = theDet->surface().toGlobal( lvx );

  // make local unit vector along local Y axis
  const Local3DVector lvy(0.0, 1.0, 0.0);

  // get the unit Y vector in global coordinates
  GlobalVector gvy = theDet->surface().toGlobal( lvy );
   
  // make local unit vector along local Z axis
  const Local3DVector lvz(0.0, 0.0, 1.0);

  // get the unit Z vector in global coordinates
  GlobalVector gvz = theDet->surface().toGlobal( lvz );
    
  // calculate the components of gv (the unit vector pointing to the cluster) 
  // in the local coordinate system given by the basis {gvx, gvy, gvz}
  // note that both gv and the basis {gvx, gvy, gvz} are given in global coordinates
  float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z();
  float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z();
  float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z();

  // calculate angles
  alpha_ = atan2( gv_dot_gvz, gv_dot_gvx );
  beta_  = atan2( gv_dot_gvz, gv_dot_gvy );

  cotalpha_ = gv_dot_gvx / gv_dot_gvz;
  cotbeta_  = gv_dot_gvy / gv_dot_gvz;

  with_track_angle = false;
}
void PixelCPEBase::computeAnglesFromTrajectory ( const SiPixelCluster cl,
const GeomDetUnit det,
const LocalTrajectoryParameters ltp 
) const [protected]

Definition at line 298 of file PixelCPEBase.cc.

References alpha_, beta_, cotalpha_, cotbeta_, loc_traj_param_, loc_trk_pred_, PV3DBase< T, PVType, FrameType >::mag(), LocalTrajectoryParameters::mixedFormatVector(), LocalTrajectoryParameters::momentum(), LocalTrajectoryParameters::position(), trk_lp_x, trk_lp_y, with_track_angle, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by localParameters().

{
  loc_traj_param_ = ltp;

  LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
  
  // &&& Or, maybe we need to move to the local frame ???
  //  LocalVector localDir( theDet->toLocal(theState.globalDirection()));
  //thePart = theDet->type().part();
  
  float locx = localDir.x();
  float locy = localDir.y();
  float locz = localDir.z();

  /*
    // Danek's definition 
    alpha_ = acos(locx/sqrt(locx*locx+locz*locz));
    if ( isFlipped() )                    // &&& check for FPIX !!!
    alpha_ = PI - alpha_ ;
    beta_ = acos(locy/sqrt(locy*locy+locz*locz));
  */

  // &&& In the above, why not use atan2() ?
  // ggiurgiu@fnal.gov, 01/24/09 :  Use it now.
  alpha_ = atan2( locz, locx );
  beta_  = atan2( locz, locy );

  cotalpha_ = locx/locz;
  cotbeta_  = locy/locz;

  LocalPoint trk_lp = ltp.position();
  trk_lp_x = trk_lp.x();
  trk_lp_y = trk_lp.y();
  
  with_track_angle = true;


  // ggiurgiu@jhu.edu 12/09/2010 : needed to correct for bows/kinks
  AlgebraicVector5 vec_trk_parameters = ltp.mixedFormatVector();
  //loc_trk_pred = &Topology::LocalTrackPred( vec_trk_parameters );
  loc_trk_pred_ = Topology::LocalTrackPred( vec_trk_parameters );
  
}
void PixelCPEBase::computeLorentzShifts ( ) const [protected]

Definition at line 609 of file PixelCPEBase.cc.

References alpha2Order, driftDirection_, Exception, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), MagneticField::inTesla(), LogDebug, lorentzAngle_, lorentzShiftInCmX_, lorentzShiftInCmY_, lorentzShiftX_, lorentzShiftY_, magfield_, GloballyPositioned< T >::position(), DetId::rawId(), GloballyPositioned< T >::rotation(), pileupReCalc_HLTpaths::scale, GeomDet::surface(), theDet, thePitchX, thePitchY, theThickness, theVerboseLevel, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by PixelCPEGeneric::localPosition().

{
  Frame detFrame(theDet->surface().position(), theDet->surface().rotation());
  GlobalVector global_Bfield = magfield_->inTesla( theDet->surface().position() );
  LocalVector  Bfield        = detFrame.toLocal(global_Bfield);
  if(lorentzAngle_ == 0){
        throw cms::Exception("invalidPointer") << "[PixelCPEBase::computeLorentzShifts] zero pointer to lorentz angle record ";
        }
  double langle = lorentzAngle_->getLorentzAngle(theDet->geographicalId().rawId());
  double alpha2;
  if ( alpha2Order) {
    alpha2 = langle * langle;
  }
  else  {
    alpha2 = 0.0;
  }

  // **********************************************************************
  // Our convention is the following:
  // +x is defined by the direction of the Lorentz drift!
  // +z is defined by the direction of E field (so electrons always go into -z!)
  // +y is defined by +x and +z, and it turns out to be always opposite to the +B field.
  // **********************************************************************
      
  // Note correct signs for dir_x and dir_y!
  double dir_x = -( langle * Bfield.y() + alpha2* Bfield.z()* Bfield.x() );
  double dir_y =  ( langle * Bfield.x() - alpha2* Bfield.z()* Bfield.y() );
  double dir_z = -( 1                                       + alpha2* Bfield.z()* Bfield.z() );

  // &&& Why do we need to scale???
  //double scale = (1 + alpha2* Bfield.z()*Bfield.z() );
  double scale = fabs( dir_z );  // same as 1 + alpha2*Bfield.z()*Bfield.z()
  driftDirection_ = LocalVector(dir_x/scale, dir_y/scale, dir_z/scale );  // last is -1 !

  // Max shift (at the other side of the sensor) in cm 
  lorentzShiftInCmX_ = driftDirection_.x()/driftDirection_.z() * theThickness;  // &&& redundant
  // Express the shift in units of pitch, 
  lorentzShiftX_ = lorentzShiftInCmX_ / thePitchX ; 
   
  // Max shift (at the other side of the sensor) in cm 
  lorentzShiftInCmY_ = driftDirection_.y()/driftDirection_.z() * theThickness;  // &&& redundant
  // Express the shift in units of pitch, 
  lorentzShiftY_ = lorentzShiftInCmY_ / thePitchY;


  if ( theVerboseLevel > 9 ) {
    LogDebug("PixelCPEBase") << " The drift direction in local coordinate is " 
                             << driftDirection_    ;
    
//     cout << "Lorentz Drift (in cm) along X = " << lorentzShiftInCmX_ << endl;
//     cout << "Lorentz Drift (in cm) along Y = " << lorentzShiftInCmY_ << endl;
  }
}
LocalVector PixelCPEBase::driftDirection ( GlobalVector  bfield) const [protected]

Definition at line 577 of file PixelCPEBase.cc.

References alpha2Order, Exception, GeomDet::geographicalId(), SiPixelLorentzAngle::getLorentzAngle(), LogDebug, lorentzAngle_, GloballyPositioned< T >::position(), DetId::rawId(), GloballyPositioned< T >::rotation(), pileupReCalc_HLTpaths::scale, GeomDet::surface(), theDet, and theVerboseLevel.

Referenced by lorentzShiftX(), and lorentzShiftY().

                                                        {

        Frame detFrame(theDet->surface().position(), theDet->surface().rotation());
        LocalVector Bfield = detFrame.toLocal(bfield);

        if(lorentzAngle_ == 0){
                throw cms::Exception("invalidPointer") << "[PixelCPEBase::driftDirection] zero pointer to lorentz angle record ";
        }
        double langle = lorentzAngle_->getLorentzAngle(theDet->geographicalId().rawId());
        float alpha2;
        if (alpha2Order) {
                alpha2 = langle*langle;
        } else {
                alpha2 = 0.0;
        }
        // &&& dir_x should have a "-" and dir_y a "+"
        float dir_x =  ( langle * Bfield.y() + alpha2* Bfield.z()* Bfield.x() );
        float dir_y = -( langle * Bfield.x() - alpha2* Bfield.z()* Bfield.y() );
        float dir_z = -( 1 + alpha2* Bfield.z()*Bfield.z() );
        float scale = (1 + alpha2* Bfield.z()*Bfield.z() );
        LocalVector theDriftDirection = LocalVector(dir_x/scale, dir_y/scale, dir_z/scale );
        if ( theVerboseLevel > 9 ) 
                LogDebug("PixelCPEBase") << " The drift direction in local coordinate is " 
                                        << theDriftDirection    ;
        
        return theDriftDirection;
}
LocalVector PixelCPEBase::driftDirectionCorrect ( GlobalVector  bfield) const [protected]
bool PixelCPEBase::hasBadPixels ( ) const [inline]

Definition at line 149 of file PixelCPEBase.h.

References hasBadPixels_.

{ return hasBadPixels_ ;  }
bool PixelCPEBase::hasFilledProb ( ) const [inline]

Definition at line 151 of file PixelCPEBase.h.

References hasFilledProb_.

{ return hasFilledProb_ ; }
bool PixelCPEBase::isFlipped ( ) const [protected]

Definition at line 421 of file PixelCPEBase.cc.

References PV3DBase< T, PVType, FrameType >::perp(), GeomDet::surface(), theDet, and Surface::toGlobal().

Referenced by setTheDet().

{
  // Check the relative position of the local +/- z in global coordinates.
  float tmp1 = theDet->surface().toGlobal(Local3DPoint(0.,0.,0.)).perp();
  float tmp2 = theDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp();
  //cout << " 1: " << tmp1 << " 2: " << tmp2 << endl;
  if ( tmp2<tmp1 ) return true;
  else return false;    
}
bool PixelCPEBase::isOnEdge ( ) const [inline]

Definition at line 148 of file PixelCPEBase.h.

References isOnEdge_.

{ return isOnEdge_ ;      }
virtual LocalError PixelCPEBase::localError ( const SiPixelCluster cl,
const GeomDetUnit det 
) const [pure virtual]
LocalValues PixelCPEBase::localParameters ( const SiPixelCluster cl,
const GeomDetUnit det,
const LocalTrajectoryParameters ltp 
) const [inline, virtual]

Reimplemented from ClusterParameterEstimator< SiPixelCluster >.

Definition at line 82 of file PixelCPEBase.h.

References computeAnglesFromTrajectory(), asciidump::le, localError(), localPosition(), nRecHitsTotal_, and setTheDet().

    {
      nRecHitsTotal_++ ;
      setTheDet( det, cl );
      computeAnglesFromTrajectory(cl, det, ltp);
      
      // localPosition( cl, det ) must be called before localError( cl, det ) !!!
      LocalPoint lp = localPosition( cl, det ); 
      LocalError le = localError( cl, det );        
      
      return std::make_pair( lp, le );
    } 
LocalValues PixelCPEBase::localParameters ( const SiPixelCluster cl,
const GeomDetUnit det,
float  alpha,
float  beta 
) const [inline]

Definition at line 100 of file PixelCPEBase.h.

References alpha, alpha_, beta, beta_, cotalpha_, cotbeta_, asciidump::le, localError(), localPosition(), nRecHitsTotal_, Pi, setTheDet(), and funct::tan().

    {
      nRecHitsTotal_++ ;
      alpha_ = alpha;
      beta_  = beta;
      double HalfPi = 0.5*TMath::Pi();
      cotalpha_ = tan(HalfPi - alpha_);
      cotbeta_  = tan(HalfPi - beta_ );
      setTheDet( det, cl );
      
      // localPosition( cl, det ) must be called before localError( cl, det ) !!!
      LocalPoint lp = localPosition( cl, det ); 
      LocalError le = localError( cl, det );        
      
      return std::make_pair( lp, le );
    }
LocalValues PixelCPEBase::localParameters ( const SiPixelCluster cl,
const GeomDetUnit det 
) const [inline, virtual]

Implements ClusterParameterEstimator< SiPixelCluster >.

Definition at line 65 of file PixelCPEBase.h.

References computeAnglesFromDetPosition(), asciidump::le, localError(), localPosition(), nRecHitsTotal_, and setTheDet().

    {
      nRecHitsTotal_++ ;
      setTheDet( det, cl );
      computeAnglesFromDetPosition(cl, det);
      
      // localPosition( cl, det ) must be called before localError( cl, det ) !!!
      LocalPoint lp = localPosition( cl, det );
      LocalError le = localError( cl, det );        
      
      return std::make_pair( lp, le );
    }
LocalPoint PixelCPEBase::localPosition ( const SiPixelCluster cl,
const GeomDetUnit det 
) const [virtual]

Reimplemented in PixelCPEGeneric, and PixelCPETemplateReco.

Definition at line 360 of file PixelCPEBase.cc.

References setTheDet(), theLShiftX, theLShiftY, thePitchX, thePitchY, xpos(), and ypos().

Referenced by localParameters(), measurementError(), and measurementPosition().

                                                            {
  setTheDet( det, cluster );
  
  float lpx = xpos(cluster);
  float lpy = ypos(cluster);
  float lxshift = theLShiftX * thePitchX;  // shift in cm
  float lyshift = theLShiftY * thePitchY;
  LocalPoint cdfsfs(lpx-lxshift, lpy-lyshift);
  return cdfsfs;
}
float PixelCPEBase::lorentzShiftX ( ) const [protected, virtual]

Definition at line 436 of file PixelCPEBase.cc.

References dir, PixelCPEBase::Param::drift, driftDirection(), GeomDet::geographicalId(), MagneticField::inTesla(), m_Params, magfield_, AlCaHLTBitMon_ParallelJobs::p, GloballyPositioned< T >::position(), DetId::rawId(), PixelGeomDetUnit::specificTopology(), GeomDet::surface(), theDet, thePitchX, theThickness, PixelCPEBase::Param::topology, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by setTheDet().

{
  LocalVector dir;
  Param & p = const_cast<PixelCPEBase*>(this)->m_Params[ theDet->geographicalId().rawId() ];
  if ( p.topology ) 
    {
      //cout << "--------------- old ----------------------" << endl;
      //cout << "p.topology = " << p.topology << endl;
      dir = p.drift;
      //cout << "same direction: dir = " << dir << endl;
    }
  else 
    {
      //cout << "--------------- new ----------------------" << endl;
      //cout << "p.topology = " << p.topology << endl;
      
      // ggiurgiu@jhu.edu 12/09/2010 : no longer need to cast
      //p.topology = (RectangularPixelTopology*)( & ( theDet->specificTopology() ) );          
      p.topology = &( theDet->specificTopology() );   

      p.drift = driftDirection(magfield_->inTesla(theDet->surface().position()) );
      dir = p.drift;
      //cout << "p.topology = " << p.topology << endl;
      //cout << "new direction: dir = " << dir << endl;

    }
  //LocalVector dir = driftDirection(magfield_->inTesla(theDet->surface().position()) );
  
  // max shift in cm 
  float xdrift = dir.x()/dir.z() * theThickness;  
  // express the shift in units of pitch, 
  // divide by 2 to get the average correction
  float lshift = xdrift / thePitchX / 2.; 
  
  //cout << "Lorentz Drift = " << lshift << endl;
  //cout << "X Drift = " << dir.x() << endl;
  //cout << "Z Drift = " << dir.z() << endl;
  
  return lshift;  
  

}
float PixelCPEBase::lorentzShiftY ( ) const [protected, virtual]

Definition at line 479 of file PixelCPEBase.cc.

References dir, PixelCPEBase::Param::drift, driftDirection(), GeomDet::geographicalId(), MagneticField::inTesla(), m_Params, magfield_, AlCaHLTBitMon_ParallelJobs::p, GloballyPositioned< T >::position(), DetId::rawId(), PixelGeomDetUnit::specificTopology(), GeomDet::surface(), theDet, thePitchY, theThickness, PixelCPEBase::Param::topology, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by setTheDet().

{
  
  LocalVector dir;
  
  Param & p = const_cast<PixelCPEBase*>(this)->m_Params[ theDet->geographicalId().rawId() ];
  if ( p.topology ) 
    {
      //cout << "--------------- old y ----------------------" << endl;
      //cout << "p.topology y = " << p.topology << endl;
      dir = p.drift;
      //cout << "same direction y: dir = " << dir << endl;
    }
  else 
    {
      //cout << "--------------- new y ----------------------" << endl;
      //cout << "p.topology y = " << p.topology << endl;
      
      //p.topology = (RectangularPixelTopology*)( & ( theDet->specificTopology() ) );    
      p.topology = &( theDet->specificTopology() );

      p.drift = driftDirection(magfield_->inTesla(theDet->surface().position()) );
      dir = p.drift;
      //cout << "p.topology y = " << p.topology << endl;
      //cout << "new direction y: dir = " << dir << endl;

    }

  //LocalVector dir = driftDirection(magfield_->inTesla(theDet->surface().position()) );
  
  float ydrift = dir.y()/dir.z() * theThickness;
  float lshift = ydrift / thePitchY / 2.;
  return lshift; 
  

}
MeasurementError PixelCPEBase::measurementError ( const SiPixelCluster cluster,
const GeomDetUnit det 
) const [protected]

Definition at line 397 of file PixelCPEBase.cc.

References LocalTrajectoryParameters::dxdz(), LocalTrajectoryParameters::dydz(), asciidump::le, loc_traj_param_, localError(), localPosition(), Topology::measurementError(), theTopol, and with_track_angle.

{
  LocalPoint lp( localPosition(cluster, det) );
  LocalError le( localError(   cluster, det) );

  // ggiurgiu@jhu.edu 12/09/2010 : trk angles needed for bow/kink correction
  if ( with_track_angle )
    return theTopol->measurementError( lp, le, Topology::LocalTrackAngles( loc_traj_param_.dxdz(), loc_traj_param_.dydz() ) );
  else 
    return theTopol->measurementError( lp, le );
}
MeasurementPoint PixelCPEBase::measurementPosition ( const SiPixelCluster cluster,
const GeomDetUnit det 
) const [protected]

Reimplemented in PixelCPEGeneric, and PixelCPETemplateReco.

Definition at line 376 of file PixelCPEBase.cc.

References LocalTrajectoryParameters::dxdz(), LocalTrajectoryParameters::dydz(), loc_traj_param_, localPosition(), Topology::measurementPosition(), theTopol, and with_track_angle.

                                                                  {

  LocalPoint lp = localPosition(cluster,det);

  // ggiurgiu@jhu.edu 12/09/2010 : trk angles needed for bow/kink correction

  if ( with_track_angle )
    return theTopol->measurementPosition( lp, Topology::LocalTrackAngles( loc_traj_param_.dxdz(), loc_traj_param_.dydz() ) );
  else 
    return theTopol->measurementPosition( lp );

}
float PixelCPEBase::probabilityQ ( ) const [inline]

Definition at line 146 of file PixelCPEBase.h.

References probabilityQ_.

{ return probabilityQ_ ;  }
float PixelCPEBase::probabilityX ( ) const [inline]

Definition at line 135 of file PixelCPEBase.h.

References probabilityX_.

{ return probabilityX_ ;  }
float PixelCPEBase::probabilityXY ( ) const [inline]

Definition at line 137 of file PixelCPEBase.h.

References create_public_lumi_plots::log, probabilityX_, and probabilityY_.

Referenced by rawQualityWord().

                                     {
    if ( probabilityX_ !=0 && probabilityY_ !=0 ) 
      {
        return probabilityX_ * probabilityY_ * (1 - log(probabilityX_ * probabilityY_) ) ;
      }
    else 
      return 0;
  }
float PixelCPEBase::probabilityY ( ) const [inline]

Definition at line 136 of file PixelCPEBase.h.

References probabilityY_.

{ return probabilityY_ ;  }
float PixelCPEBase::qBin ( ) const [inline]

Definition at line 147 of file PixelCPEBase.h.

References qBin_.

{ return qBin_ ;          }
SiPixelRecHitQuality::QualWordType PixelCPEBase::rawQualityWord ( ) const [virtual]

A convenience method to fill a whole SiPixelRecHitQuality word in one shot. This way, we can keep the details of what is filled within the pixel code and not expose the Transient SiPixelRecHit to it as well. The name of this function is chosen to match the one in SiPixelRecHit.

Reimplemented from PixelClusterParameterEstimator.

Definition at line 670 of file PixelCPEBase.cc.

References hasBadPixels_, hasFilledProb_, isOnEdge_, probabilityQ_, probabilityXY(), qBin_, spansTwoROCs_, and SiPixelRecHitQuality::thePacking.

Referenced by cms::SiPixelRecHitConverter::run().

{
  SiPixelRecHitQuality::QualWordType qualWord(0);
  
  SiPixelRecHitQuality::thePacking.setProbabilityXY ( probabilityXY() ,
                                                      qualWord );
  
  SiPixelRecHitQuality::thePacking.setProbabilityQ  ( probabilityQ_ , 
                                                      qualWord );
  
  SiPixelRecHitQuality::thePacking.setQBin          ( (int)qBin_, 
                                                      qualWord );
  
  SiPixelRecHitQuality::thePacking.setIsOnEdge      ( isOnEdge_,
                                                      qualWord );
  
  SiPixelRecHitQuality::thePacking.setHasBadPixels  ( hasBadPixels_,
                                                      qualWord );
  
  SiPixelRecHitQuality::thePacking.setSpansTwoROCs  ( spansTwoROCs_,
                                                      qualWord );
  
  SiPixelRecHitQuality::thePacking.setHasFilledProb ( hasFilledProb_,
                                                      qualWord );
  
  return qualWord;
}
void PixelCPEBase::setMagField ( const MagneticField mag) const [inline]

Definition at line 123 of file PixelCPEBase.h.

References mag(), and magfield_.

{ magfield_ = mag; }
void PixelCPEBase::setTheDet ( const GeomDetUnit det,
const SiPixelCluster cluster 
) const [protected]

Definition at line 95 of file PixelCPEBase.cc.

References BoundSurface::bounds(), PixelTopology::containsBigPixelInX(), PixelTopology::containsBigPixelInY(), Exception, hasBadPixels_, i, isFlipped(), PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), isOnEdge_, LogDebug, lorentzShiftX(), lorentzShiftY(), SiPixelCluster::maxPixelCol(), SiPixelCluster::maxPixelRow(), SiPixelCluster::minPixelCol(), SiPixelCluster::minPixelRow(), PixelTopology::ncolumns(), PixelTopology::nrows(), PixelTopology::pitch(), SiPixelCluster::pixelADC(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GloballyPositioned< T >::position(), spansTwoROCs_, PixelGeomDetUnit::specificTopology(), GeomDetType::subDetector(), GeomDet::surface(), theDet, theDetR, theDetZ, theLShiftX, theLShiftY, theNumOfCol, theNumOfRow, thePart, thePitchX, thePitchY, theSign, theThickness, theTopol, theVerboseLevel, Bounds::thickness(), and PixelGeomDetUnit::type().

Referenced by PixelCPEGeneric::localError(), PixelCPETemplateReco::localError(), localParameters(), localPosition(), PixelCPEGeneric::localPosition(), and PixelCPETemplateReco::localPosition().

{
  if ( theDet == &det )
    return;       // we have already seen this det unit
  
  //--- This is a new det unit, so cache it
  theDet = dynamic_cast<const PixelGeomDetUnit*>( &det );

  if ( !theDet ) 
    {
      throw cms::Exception(" PixelCPEBase::setTheDet : ")
            << " Wrong pointer to PixelGeomDetUnit object !!!";
    }

  //--- theDet->type() returns a GeomDetType, which implements subDetector()
  thePart = theDet->type().subDetector();
  switch ( thePart ) 
    {
    case GeomDetEnumerators::PixelBarrel:
      // A barrel!  A barrel!
      break;
    case GeomDetEnumerators::PixelEndcap:
      // A forward!  A forward!
      break;
    default:
      throw cms::Exception("PixelCPEBase::setTheDet :")
        << "PixelCPEBase: A non-pixel detector type in here?" ;
    }

  //--- The location in of this DetUnit in a cyllindrical coord system (R,Z)
  //--- The call goes via BoundSurface, returned by theDet->surface(), but
  //--- position() is implemented in GloballyPositioned<> template
  //--- ( BoundSurface : Surface : GloballyPositioned<float> )
  theDetR = theDet->surface().position().perp();
  theDetZ = theDet->surface().position().z();
  //--- Define parameters for chargewidth calculation

  //--- bounds() is implemented in BoundSurface itself.
  theThickness = theDet->surface().bounds().thickness();

  //--- Cache the topology.
  // ggiurgiu@jhu.edu 12/09/2010 : no longer need to dynamyc cast to RectangularPixelTopology
  //theTopol
  //= dynamic_cast<const RectangularPixelTopology*>( & (theDet->specificTopology()) );

  theTopol = &(theDet->specificTopology());

  //---- The geometrical description of one module/plaquette
  theNumOfRow = theTopol->nrows();      // rows in x
  theNumOfCol = theTopol->ncolumns();   // cols in y
  std::pair<float,float> pitchxy = theTopol->pitch();
  thePitchX = pitchxy.first;            // pitch along x
  thePitchY = pitchxy.second;           // pitch along y

  //--- Find the offset
  // ggiurgiu@jhu.edu 12/09/2010 : this piece is deprecated
  //MeasurementPoint offset = 
  //theTopol->measurementPosition( LocalPoint(0.0, 0.0), 
  //                       Topology::LocalTrackAngles( LocalTrajectoryParameters::dxdz(), 
  //                                                   LocalTrajectoryParameters::dydz() ) );  
  //
  //theOffsetX = offset.x();
  //theOffsetY = offset.y();

  //--- Find if the E field is flipped: i.e. whether it points
  //--- from the beam, or towards the beam.  (The voltages are
  //--- applied backwards on every other module in barrel and
  //--- blade in forward.)
  theSign = isFlipped() ? -1 : 1;

  //--- The Lorentz shift.
  theLShiftX = lorentzShiftX();

  theLShiftY = lorentzShiftY();

  // testing 
  if(thePart == GeomDetEnumerators::PixelBarrel) {
    //cout<<" lorentz shift "<<theLShiftX<<" "<<theLShiftY<<endl;
    theLShiftY=0.;
  }

        //--- Geometric Quality Information
        int minInX,minInY,maxInX,maxInY=0;
        minInX = cluster.minPixelRow();
        minInY = cluster.minPixelCol();
        maxInX = cluster.maxPixelRow();
        maxInY = cluster.maxPixelCol();

        if(theTopol->isItEdgePixelInX(minInX) || theTopol->isItEdgePixelInX(maxInX) ||
                 theTopol->isItEdgePixelInY(minInY) || theTopol->isItEdgePixelInY(maxInY) )  {
                isOnEdge_ = true;
        }
        else isOnEdge_ = false;

        // Bad Pixels have their charge set to 0 in the clusterizer
        hasBadPixels_ = false;
        for(unsigned int i=0; i<cluster.pixelADC().size(); ++i) {
                if(cluster.pixelADC()[i] == 0) hasBadPixels_ = true;
        }

        if(theTopol->containsBigPixelInX(minInX,maxInX) ||
                 theTopol->containsBigPixelInY(minInY,maxInY) )  {
                spansTwoROCs_ = true;
        }
        else spansTwoROCs_ = false;
        

        if (theVerboseLevel > 1) 
    {
      LogDebug("PixelCPEBase") << "***** PIXEL LAYOUT *****" 
                               << " thePart = " << thePart
                               << " theThickness = " << theThickness
                               << " thePitchX  = " << thePitchX 
                               << " thePitchY  = " << thePitchY 
        // << " theOffsetX = " << theOffsetX 
        // << " theOffsetY = " << theOffsetY 
                               << " theLShiftX  = " << theLShiftX;
    }
        
}
bool PixelCPEBase::spansTwoRocks ( ) const [inline]

Definition at line 150 of file PixelCPEBase.h.

References spansTwoROCs_.

{ return spansTwoROCs_ ;  }
void PixelCPEBase::xCharge ( const std::vector< SiPixelCluster::Pixel > &  ,
const int &  ,
const int &  ,
float &  q1,
float &  q2 
) const [protected]

Definition at line 521 of file PixelCPEBase.cc.

References ecalMGPA::adc(), i, and x.

                                                       {
  //calculate charge in the first and last pixel in y
  // and the total cluster charge
  q1 = 0.0; 
  q2 = 0.0;
  float qm = 0.0;
  int isize = pixelsVec.size();
  for (int i=0;  i<isize; ++i) {
    if ( (pixelsVec[i].x) == imin )
      q1 += pixelsVec[i].adc;
    else if ( (pixelsVec[i].x) == imax) 
      q2 += float(pixelsVec[i].adc);
    else 
      qm += float(pixelsVec[i].adc);
  }
  return;
} 
virtual float PixelCPEBase::xpos ( const SiPixelCluster ) const [protected, pure virtual]

Implemented in PixelCPEGeneric, and PixelCPETemplateReco.

Referenced by localPosition().

void PixelCPEBase::yCharge ( const std::vector< SiPixelCluster::Pixel > &  ,
const int &  ,
const int &  ,
float &  q1,
float &  q2 
) const [protected]

Definition at line 545 of file PixelCPEBase.cc.

References ecalMGPA::adc(), i, and detailsBasic3DVector::y.

                                                       {
  
  //calculate charge in the first and last pixel in y
  // and the inner cluster charge
  q1 = 0;
  q2 = 0;
  float qm=0;
  int isize = pixelsVec.size();
  for (int i=0;  i<isize; ++i) {
    if ( (pixelsVec[i].y) == imin) 
      q1 += pixelsVec[i].adc;
    else if ( (pixelsVec[i].y) == imax) 
      q2 += pixelsVec[i].adc;
    //else if (pixelsVec[i].y < ymax && pixelsVec[i].y > ymin ) 
    else  
      qm += float(pixelsVec[i].adc);
  }
  return;
} 
virtual float PixelCPEBase::ypos ( const SiPixelCluster ) const [protected, pure virtual]

Implemented in PixelCPEGeneric, and PixelCPETemplateReco.

Referenced by localPosition().


Member Data Documentation

bool PixelCPEBase::alpha2Order [protected]

Definition at line 265 of file PixelCPEBase.h.

Referenced by computeLorentzShifts(), driftDirection(), and PixelCPEBase().

float PixelCPEBase::alpha_ [mutable, protected]
float PixelCPEBase::beta_ [mutable, protected]

Reimplemented from PixelClusterParameterEstimator.

Definition at line 238 of file PixelCPEBase.h.

Referenced by clusterProbComputationFlag(), and PixelCPEBase().

float PixelCPEBase::cotalpha_ [mutable, protected]
float PixelCPEBase::cotbeta_ [mutable, protected]

Definition at line 246 of file PixelCPEBase.h.

Referenced by computeLorentzShifts().

Definition at line 261 of file PixelCPEBase.h.

Referenced by PixelCPEGeneric::localError(), and PixelCPEBase().

bool PixelCPEBase::hasBadPixels_ [mutable, protected]

Definition at line 228 of file PixelCPEBase.h.

Referenced by hasBadPixels(), rawQualityWord(), and setTheDet().

bool PixelCPEBase::hasFilledProb_ [mutable, protected]
bool PixelCPEBase::isOnEdge_ [mutable, protected]

Definition at line 227 of file PixelCPEBase.h.

Referenced by isOnEdge(), rawQualityWord(), and setTheDet().

const SiPixelLorentzAngle* PixelCPEBase::lorentzAngle_ [mutable, protected]

Definition at line 259 of file PixelCPEBase.h.

Referenced by computeLorentzShifts(), driftDirection(), and PixelCPEBase().

double PixelCPEBase::lorentzShiftInCmX_ [mutable, protected]

Definition at line 249 of file PixelCPEBase.h.

Referenced by computeLorentzShifts(), and PixelCPEGeneric::localPosition().

double PixelCPEBase::lorentzShiftInCmY_ [mutable, protected]

Definition at line 250 of file PixelCPEBase.h.

Referenced by computeLorentzShifts(), and PixelCPEGeneric::localPosition().

double PixelCPEBase::lorentzShiftX_ [mutable, protected]

Definition at line 247 of file PixelCPEBase.h.

Referenced by computeLorentzShifts().

double PixelCPEBase::lorentzShiftY_ [mutable, protected]

Definition at line 248 of file PixelCPEBase.h.

Referenced by computeLorentzShifts().

Definition at line 355 of file PixelCPEBase.h.

Referenced by lorentzShiftX(), and lorentzShiftY().

const MagneticField* PixelCPEBase::magfield_ [mutable, protected]
int PixelCPEBase::nRecHitsTotal_ [mutable, protected]

Definition at line 216 of file PixelCPEBase.h.

Referenced by PixelCPEGeneric::generic_position_formula(), and localParameters().

int PixelCPEBase::nRecHitsUsedEdge_ [mutable, protected]

Definition at line 217 of file PixelCPEBase.h.

Referenced by PixelCPEGeneric::generic_position_formula().

float PixelCPEBase::probabilityQ_ [mutable, protected]
float PixelCPEBase::probabilityX_ [mutable, protected]
float PixelCPEBase::probabilityY_ [mutable, protected]
float PixelCPEBase::qBin_ [mutable, protected]
bool PixelCPEBase::spansTwoROCs_ [mutable, protected]

Definition at line 229 of file PixelCPEBase.h.

Referenced by rawQualityWord(), setTheDet(), and spansTwoRocks().

const PixelGeomDetUnit* PixelCPEBase::theDet [mutable, protected]
float PixelCPEBase::theDetR [mutable, protected]

Definition at line 198 of file PixelCPEBase.h.

Referenced by setTheDet().

float PixelCPEBase::theDetZ [mutable, protected]

Definition at line 197 of file PixelCPEBase.h.

Referenced by setTheDet().

float PixelCPEBase::theLShiftX [mutable, protected]

Definition at line 199 of file PixelCPEBase.h.

Referenced by localPosition(), and setTheDet().

float PixelCPEBase::theLShiftY [mutable, protected]

Definition at line 200 of file PixelCPEBase.h.

Referenced by localPosition(), and setTheDet().

float PixelCPEBase::theNumOfCol [mutable, protected]

Definition at line 196 of file PixelCPEBase.h.

Referenced by setTheDet().

float PixelCPEBase::theNumOfRow [mutable, protected]

Definition at line 195 of file PixelCPEBase.h.

Referenced by setTheDet().

float PixelCPEBase::thePitchX [mutable, protected]
float PixelCPEBase::thePitchY [mutable, protected]
float PixelCPEBase::theSign [mutable, protected]

Definition at line 201 of file PixelCPEBase.h.

Referenced by setTheDet().

float PixelCPEBase::theThickness [mutable, protected]
const PixelTopology* PixelCPEBase::theTopol [mutable, protected]
float PixelCPEBase::trk_lp_x [mutable, protected]
float PixelCPEBase::trk_lp_y [mutable, protected]
bool PixelCPEBase::with_track_angle [mutable, protected]