CMS 3D CMS Logo

Public Member Functions | Private Attributes

TrajectoryAtInvalidHit Class Reference

#include <TrajectoryAtInvalidHit.h>

List of all members.

Public Member Functions

double globalX () const
double globalY () const
double globalZ () const
bool isDoubleSided (unsigned int iidd) const
double localDxDz () const
double localDyDz () const
double localErrorX () const
double localErrorY () const
double localX () const
double localY () const
double localZ () const
unsigned int monodet_id () const
 TrajectoryAtInvalidHit (const TrajectoryMeasurement &, const TrackerGeometry *tracker, const Propagator &propagator, const unsigned int mono=0)
TrajectoryStateOnSurface tsos () const
bool validHit () const
bool withinAcceptance () const

Private Attributes

bool acceptance
float globX
float globY
float globZ
bool hasValidHit
unsigned int iidd
float locDxDz
float locDyDz
float locX
float locXError
float locY
float locYError
float locZ
TrajectoryStateOnSurface theCombinedPredictedState
ConstReferenceCountingPointer
< TransientTrackingRecHit
theHit

Detailed Description

Definition at line 19 of file TrajectoryAtInvalidHit.h.


Constructor & Destructor Documentation

TrajectoryAtInvalidHit::TrajectoryAtInvalidHit ( const TrajectoryMeasurement tm,
const TrackerGeometry tracker,
const Propagator propagator,
const unsigned int  mono = 0 
)

Definition at line 21 of file TrajectoryAtInvalidHit.cc.

References abs, TrajectoryMeasurement::backwardPredictedState(), BoundSurface::bounds(), TrajectoryStateCombiner::combine(), gather_cfg::cout, TrajectoryMeasurement::forwardPredictedState(), GeomDet::geographicalId(), TrackerGeometry::idToDet(), Bounds::inside(), TrajectoryStateOnSurface::isValid(), max(), min, GluedGeomDet::monoDet(), Propagator::propagate(), DetId::rawId(), TrajectoryMeasurement::recHit(), mathSSE::sqrt(), GluedGeomDet::stereoDet(), strip(), DetId::subdetId(), GeomDet::surface(), and StripSubdetector::TOB.

{
  if ( tm.backwardPredictedState().isValid() ) 
    theCombinedPredictedState = TrajectoryStateCombiner().combine( tm.forwardPredictedState(),
                                                                   tm.backwardPredictedState());
  else 
    theCombinedPredictedState = tm.forwardPredictedState();
  
  if (!theCombinedPredictedState.isValid()) {
    return;
  }
  theHit = tm.recHit();  
  iidd = theHit->geographicalId().rawId();
  StripSubdetector strip=StripSubdetector(iidd);
  unsigned int subid=strip.subdetId();
  // xB and yB are for absolute borders on the trajectories included in the study, sigmaX sigmaY are 
  // significance cuts on the distance from the detector surface
  float xB = 0.; float sigmaX = 5.0;
  float yB = 0.; float sigmaY = 5.0;
  float sigmaYBond = 0.;
  //set bounds for point to be within to be counted in the study
  if (subid ==  StripSubdetector::TOB) { 
    sigmaYBond = 5.0;
  }
  const GeomDetUnit * monodet;
  
  // if module is from a double sided layer, write out info for either the
  // rphi surface (mono = 1) or the stereo surface (mono = 2)--not the matched hit surface
  if (( mono > 0 ) && isDoubleSided(iidd) ) {
    // find matched det id, that is the matched hit surface between the two sensors
    unsigned int matched_iidd = iidd-(iidd & 0x3);
    DetId matched_id(matched_iidd);
    
    GluedGeomDet * gdet=(GluedGeomDet *)tracker->idToDet(matched_id);
    
    // get the sensor det indicated by mono
    if (mono == 1) monodet=gdet->stereoDet();
    else  monodet=gdet->monoDet(); // this should only be mono == 2

    // set theCombinedPredictedState to be on the sensor surface, not the matched surface
    DetId mono_id = monodet->geographicalId();
    const Surface &surface = tracker->idToDet(mono_id)->surface();
    theCombinedPredictedState = propagator.propagate(theCombinedPredictedState, 
                                                     surface);

    if (!theCombinedPredictedState.isValid()) {
      cout << "found invalid combinedpredictedstate after propagation"<< endl;
      return;
    }

    //check if hit on trajectory is valid for this sensor
    if ((iidd & 0x3)==0) {
      // passed id is on matched surface (ie neither rphi, nor stereo surface)
      // so the rechits on both sensors should be invalid
      hasValidHit = theHit->isValid();
      //cout << "should always be invalid = " << theHit->isValid() << endl;
    } else {
      if (iidd==mono_id) {
        //mono sensor for this TrajAtInvalidHit is same as originally passed in from trajectory
        //normally should only happen for valid hits, but sometimes is invalid
        hasValidHit = theHit->isValid();
        //cout << "check always true = " << theHit->isValid() << endl;
      } else {
        // mono sensor for this TrajAtInvalidHit is not as originally passed in from trajectory
        // so this is a partner missing from the trajectory and is thus invalid
        hasValidHit = false;
        //cout << "setting invalid by fiat" << endl;
      }
    }
    
    //set module id to be mono det
    iidd = monodet->geographicalId().rawId();
  } else {
    monodet = (GeomDetUnit*)theHit->det();
    hasValidHit = theHit->isValid();
  }
  
  locX = theCombinedPredictedState.localPosition().x();
  locY = theCombinedPredictedState.localPosition().y();
  locZ = theCombinedPredictedState.localPosition().z();
  locXError = sqrt(theCombinedPredictedState.localError().positionError().xx());
  locYError = sqrt(theCombinedPredictedState.localError().positionError().yy());
  locDxDz = theCombinedPredictedState.localParameters().vector()[1];
  locDyDz = theCombinedPredictedState.localParameters().vector()[2];
  globX = theCombinedPredictedState.globalPosition().x();
  globY = theCombinedPredictedState.globalPosition().y();
  globZ = theCombinedPredictedState.globalPosition().z();
  
  // this should never be a glued det, only rphi or stero
  //cout << "From TrajAtValidHit module " << iidd << "   matched/stereo/rphi = " << ((iidd & 0x3)==0) << "/" << ((iidd & 0x3)==1) << "/" << ((iidd & 0x3)==2) << endl;
    
  // Restrict the bound regions for better understanding of the modul assignment. 

  LocalPoint BoundedPoint;
  float xx, yy ,zz;

  // Insert the bounded values 
  if (locX < 0. ) xx = min(locX - xB,locX - sigmaX*locXError);
  else  xx = max(locX + xB, locX + sigmaX*locXError);

  if (locY < 0. ) yy = min(locY - yB,locY - sigmaY*locYError);
  else  yy = max(locY + yB, locY + sigmaY*locYError);

  zz = theCombinedPredictedState.localPosition().z();

  BoundedPoint = LocalPoint(xx,yy,zz);
  
  if ( monodet->surface().bounds().inside(BoundedPoint) && abs(locY) > sigmaYBond*locYError ){
    acceptance = true;
  }
  else {
    // hit is within xB, yB from the edge of the detector, so throw it out 
    acceptance = false;
  }
}

Member Function Documentation

double TrajectoryAtInvalidHit::globalX ( ) const

Definition at line 166 of file TrajectoryAtInvalidHit.cc.

{
  return globX;
}
double TrajectoryAtInvalidHit::globalY ( ) const

Definition at line 170 of file TrajectoryAtInvalidHit.cc.

{
  return globY;
}
double TrajectoryAtInvalidHit::globalZ ( ) const

Definition at line 174 of file TrajectoryAtInvalidHit.cc.

{
  return globZ;
}
bool TrajectoryAtInvalidHit::isDoubleSided ( unsigned int  iidd) const

Definition at line 194 of file TrajectoryAtInvalidHit.cc.

References TIBDetId::layer(), TOBDetId::layer(), TIDDetId::ring(), TECDetId::ring(), strip(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

                                                                  {
  StripSubdetector strip=StripSubdetector(iidd);
  unsigned int subid=strip.subdetId();
  unsigned int layer = 0;
  if (subid ==  StripSubdetector::TIB) { 
    TIBDetId tibid(iidd);
    layer = tibid.layer();
    if (layer == 1 || layer == 2) return true;
    else return false;
  }
  else if (subid ==  StripSubdetector::TOB) { 
    TOBDetId tobid(iidd);
    layer = tobid.layer() + 4 ; 
    if (layer == 5 || layer == 6) return true;
    else return false;
  }
  else if (subid ==  StripSubdetector::TID) { 
    TIDDetId tidid(iidd);
    layer = tidid.ring() + 10;
    if (layer == 11 || layer == 12) return true;
    else return false;
  }
  else if (subid ==  StripSubdetector::TEC) { 
    TECDetId tecid(iidd);
    layer = tecid.ring() + 13 ; 
    if (layer == 14 || layer == 15 || layer == 18) return true;
    else return false;
  }
  else
    return false;
}
double TrajectoryAtInvalidHit::localDxDz ( ) const

Definition at line 160 of file TrajectoryAtInvalidHit.cc.

                                               {
  return locDxDz;
}
double TrajectoryAtInvalidHit::localDyDz ( ) const

Definition at line 163 of file TrajectoryAtInvalidHit.cc.

                                               {
  return locDyDz;
}
double TrajectoryAtInvalidHit::localErrorX ( ) const

Definition at line 152 of file TrajectoryAtInvalidHit.cc.

{
  return locXError;
}
double TrajectoryAtInvalidHit::localErrorY ( ) const

Definition at line 156 of file TrajectoryAtInvalidHit.cc.

{
  return locYError;
}
double TrajectoryAtInvalidHit::localX ( ) const

Definition at line 140 of file TrajectoryAtInvalidHit.cc.

{
  return locX;
}
double TrajectoryAtInvalidHit::localY ( ) const

Definition at line 144 of file TrajectoryAtInvalidHit.cc.

{
  return locY;
}
double TrajectoryAtInvalidHit::localZ ( ) const

Definition at line 148 of file TrajectoryAtInvalidHit.cc.

{
  return locZ;
}
unsigned int TrajectoryAtInvalidHit::monodet_id ( ) const

Definition at line 179 of file TrajectoryAtInvalidHit.cc.

{
  return iidd;
}
TrajectoryStateOnSurface TrajectoryAtInvalidHit::tsos ( ) const

Definition at line 226 of file TrajectoryAtInvalidHit.cc.

bool TrajectoryAtInvalidHit::validHit ( ) const

Definition at line 189 of file TrajectoryAtInvalidHit.cc.

{
  return hasValidHit;
}
bool TrajectoryAtInvalidHit::withinAcceptance ( ) const

Definition at line 184 of file TrajectoryAtInvalidHit.cc.

{
  return acceptance;
}

Member Data Documentation

Definition at line 56 of file TrajectoryAtInvalidHit.h.

Definition at line 54 of file TrajectoryAtInvalidHit.h.

Definition at line 54 of file TrajectoryAtInvalidHit.h.

Definition at line 54 of file TrajectoryAtInvalidHit.h.

Definition at line 57 of file TrajectoryAtInvalidHit.h.

unsigned int TrajectoryAtInvalidHit::iidd [private]

Definition at line 55 of file TrajectoryAtInvalidHit.h.

Definition at line 53 of file TrajectoryAtInvalidHit.h.

Definition at line 53 of file TrajectoryAtInvalidHit.h.

Definition at line 51 of file TrajectoryAtInvalidHit.h.

Definition at line 52 of file TrajectoryAtInvalidHit.h.

Definition at line 51 of file TrajectoryAtInvalidHit.h.

Definition at line 52 of file TrajectoryAtInvalidHit.h.

Definition at line 51 of file TrajectoryAtInvalidHit.h.

Definition at line 50 of file TrajectoryAtInvalidHit.h.

Definition at line 59 of file TrajectoryAtInvalidHit.h.