CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

DTLinearDriftFromDBAlgo Class Reference

#include <DTLinearDriftFromDBAlgo.h>

Inheritance diagram for DTLinearDriftFromDBAlgo:
DTRecHitBaseAlgo

List of all members.

Public Member Functions

virtual bool compute (const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, DTRecHit1D &newHit1D) const
virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, const GlobalPoint &globPos, DTRecHit1D &newHit1D) const
 DTLinearDriftFromDBAlgo (const edm::ParameterSet &config)
 Constructor.
virtual void setES (const edm::EventSetup &setup)
 Pass the Event Setup to the algo at each event.
virtual ~DTLinearDriftFromDBAlgo ()
 Destructor.

Private Member Functions

virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const GlobalPoint &globPos, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error, int step) const
virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const GlobalPoint &globPos, DTRecHit1D &newHit1D, int step) const

Private Attributes

const DTMtimemTimeMap

Static Private Attributes

static bool debug
static float maxTime
static float minTime

Detailed Description

Concrete implementation of DTRecHitBaseAlgo. Compute drift distance using constant drift velocity read from database.

Date:
2007/04/19 11:08:17
Revision:
1.1
Author:
S.Bolognesi - INFN Torino

Definition at line 18 of file DTLinearDriftFromDBAlgo.h.


Constructor & Destructor Documentation

DTLinearDriftFromDBAlgo::DTLinearDriftFromDBAlgo ( const edm::ParameterSet config)

Constructor.

Definition at line 23 of file DTLinearDriftFromDBAlgo.cc.

References gather_cfg::cout, debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxTime, and minTime.

                                                                           :
  DTRecHitBaseAlgo(config) {

    minTime = config.getParameter<double>("minTime"); 

    maxTime = config.getParameter<double>("maxTime"); 

    // Set verbose output
    debug = config.getUntrackedParameter<bool>("debug");
    if(debug)
      cout<<"[DTLinearDriftFromDBAlgo] Constructor called"<<endl;
  }
DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo ( ) [virtual]

Destructor.

Definition at line 38 of file DTLinearDriftFromDBAlgo.cc.

{}

Member Function Documentation

bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTDigi digi,
LocalPoint leftPoint,
LocalPoint rightPoint,
LocalError error 
) const [virtual]

First step in computation of Left/Right hits from a Digi. The results are the local position (in DTLayer frame) of the Left and Right hit, and the error (which is common). Returns false on failure. The hit is assumed to be at the wire center.

Implements DTRecHitBaseAlgo.

Definition at line 58 of file DTLinearDriftFromDBAlgo.cc.

References error, DTLayer::id(), DTTopology::isWireValid(), DTLayer::specificTopology(), DTDigi::time(), GeomDet::toGlobal(), DTDigi::wire(), and DTTopology::wirePosition().

Referenced by compute().

                                                         {
  // Get the wireId
  DTLayerId layerId = layer->id();
  const DTWireId wireId(layerId, digi.wire());

  // Get Wire position
  if(!layer->specificTopology().isWireValid(digi.wire())) return false;
  LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
  
  return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1); 
}
bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const GlobalPoint globPos,
DTRecHit1D newHit1D,
int  step 
) const [private, virtual]

Definition at line 170 of file DTLinearDriftFromDBAlgo.cc.

References compute(), error, Exception, DTEnums::Left, DTRecHit1D::localPosition(), DTRecHit1D::lrSide(), DTEnums::Right, DTRecHit1D::setPositionAndError(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                {
  LocalPoint leftPoint;
  LocalPoint rightPoint;
  LocalError error;

  if(compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
    // Set the position and the error of the rechit which is being updated
    switch(newHit1D.lrSide()) {
        
    case DTEnums::Left:
        {
          // Keep the original y position of newHit1D: for step==3, it's the
          // position along the wire. Needed for rotation alignment
          LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
          newHit1D.setPositionAndError(leftPoint3D, error);
          break;
        }
        
    case DTEnums::Right:
        {
          // as above: 3d position
          LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
          newHit1D.setPositionAndError(rightPoint3D, error);
          break;
        }
        
    default:
      throw cms::Exception("InvalidDTCellSide") << "[DTLinearDriftFromDBAlgo] Compute at Step "
                                                << step << ", Hit side "
                                                << newHit1D.lrSide()
                                                << " is invalid!" << endl;
      return false;
    }
      
    return true;
  }else {
    return false;
  }
}
bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const GlobalPoint globPos,
LocalPoint leftPoint,
LocalPoint rightPoint,
LocalError error,
int  step 
) const [private, virtual]

Definition at line 100 of file DTLinearDriftFromDBAlgo.cc.

References DTVelocityUnits::cm_per_ns, gather_cfg::cout, debug, shallow::drift(), DTMtime::get(), DTTopology::isWireValid(), maxTime, mTimeMap, DTTTrigBaseSync::offset(), DTLayer::specificTopology(), DTLayerId::superlayerId(), DTRecHitBaseAlgo::theSync, DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                {
  // Subtract the offset to the digi time accordingly to the DTTTrigBaseSync concrete instance
  float driftTime = digiTime - theSync->offset(layer, wireId, globPos); 
  
  // check for out-of-time
  if (driftTime < minTime || driftTime > maxTime) {
    if (debug) cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits "
                              << driftTime << endl;

    if(step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
      // Hits are interpreted as coming from out-of-time pile-up and recHit
      // is ignored.
      return false;
    }
  }

  // Small negative times interpreted as hits close to the wire.
  if (driftTime<0.) driftTime=0;

  // Read the vDrift and reso for this wire
  float vDrift = 0;
  float hitResolution = 0;//FIXME: should use this!
  // vdrift is cm/ns , resolution is cm
  mTimeMap->get(wireId.superlayerId(),
                vDrift,
                hitResolution,
                DTVelocityUnits::cm_per_ns);


  // Compute the drift distance
  float drift = driftTime * vDrift;

  // Get Wire position
  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
  //Build the two possible points and the error on the position
  leftPoint  = LocalPoint(locWirePos.x()-drift,
                            locWirePos.y(),
                            locWirePos.z());
  rightPoint = LocalPoint(locWirePos.x()+drift,
                            locWirePos.y(),
                            locWirePos.z());
  error = LocalError(hitResolution*hitResolution,0.,0.);


  if(debug) {
    cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl
         << "       Step:           " << step << endl
         << "       Digi time:      " << digiTime << endl
         << "       Drift time:     " << driftTime << endl
         << "       Drift distance: " << drift << endl
         << "       Hit Resolution: " << hitResolution << endl
         << "       Left point:     " << leftPoint << endl
         << "       Right point:    " << rightPoint << endl
         << "       Error:          " << error << endl;
   }
  
  return true;
  
}
bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTRecHit1D recHit1D,
const float &  angle,
const GlobalPoint globPos,
DTRecHit1D newHit1D 
) const [virtual]

Third (and final) step in hits position computation. Also the hit position along the wire is available and can be used to correct the drift time for particle TOF and propagation of signal along the wire. NOTE: Only position and error of the new hit are modified

Implements DTRecHitBaseAlgo.

Definition at line 89 of file DTLinearDriftFromDBAlgo.cc.

References compute(), DTRecHit1D::digiTime(), and DTRecHit1D::wireId().

                                                            {
  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
}
bool DTLinearDriftFromDBAlgo::compute ( const DTLayer layer,
const DTRecHit1D recHit1D,
const float &  angle,
DTRecHit1D newHit1D 
) const [virtual]

Second step in hit position computation. It is the same as first step since the angular information is not used NOTE: Only position and error of the new hit are modified

Implements DTRecHitBaseAlgo.

Definition at line 78 of file DTLinearDriftFromDBAlgo.cc.

References DTRecHit1D::localPosition(), DTRecHit1D::localPositionError(), and DTRecHit1D::setPositionAndError().

                                                            {
  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
  return true;
}
void DTLinearDriftFromDBAlgo::setES ( const edm::EventSetup setup) [virtual]

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 42 of file DTLinearDriftFromDBAlgo.cc.

References gather_cfg::cout, debug, edm::EventSetup::get(), mTimeMap, DTTTrigBaseSync::setES(), DTRecHitBaseAlgo::theSync, and DTMtime::version().

                                                           {
  if(debug)
    cout<<"[DTLinearDriftFromDBAlgo] setES called"<<endl;
  theSync->setES(setup);
  // Get the map of ttrig from the Setup
  ESHandle<DTMtime> mTimeHandle;
  setup.get<DTMtimeRcd>().get(mTimeHandle);
  mTimeMap = &*mTimeHandle;
  
  if(debug) 
    cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version()<<endl;
}

Member Data Documentation

bool DTLinearDriftFromDBAlgo::debug [static, private]

Definition at line 94 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), DTLinearDriftFromDBAlgo(), and setES().

float DTLinearDriftFromDBAlgo::maxTime [static, private]

Definition at line 91 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and DTLinearDriftFromDBAlgo().

float DTLinearDriftFromDBAlgo::minTime [static, private]

Definition at line 88 of file DTLinearDriftFromDBAlgo.h.

Referenced by DTLinearDriftFromDBAlgo().

Definition at line 85 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().