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

bool doVdriftCorr
const DTMtimemTimeMap
bool stepTwoFromDigi

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:
2011/02/22 16:23:00
Revision:
1.3
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, doVdriftCorr, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxTime, minTime, and stepTwoFromDigi.

                                                                           :
  DTRecHitBaseAlgo(config) {

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

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

    doVdriftCorr = config.getParameter<bool>("doVdriftCorr");

    // Option to force going back to digi time at Step 2 
    stepTwoFromDigi = config.getParameter<bool>("stepTwoFromDigi");

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

Destructor.

Definition at line 43 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 63 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 201 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]

cf. https://arxiv.org/PS_cache/arxiv/pdf/0911/0911.4895v2.pdf

Definition at line 118 of file DTLinearDriftFromDBAlgo.cc.

References abs, DTVelocityUnits::cm_per_ns, gather_cfg::cout, debug, doVdriftCorr, shallow::drift(), DTMtime::get(), DTTopology::isWireValid(), maxTime, mTimeMap, DTTTrigBaseSync::offset(), DTLayer::specificTopology(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTLayerId::superlayerId(), DTRecHitBaseAlgo::theSync, GeomDet::toLocal(), DTChamberId::wheel(), 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);

  //only in step 3
  if(doVdriftCorr && step == 3){
    if (abs(wireId.wheel()) == 2 && 
        wireId.station() == 1 &&
        wireId.superLayer() != 2) {
      // Variation of vdrift along Y due to B field, 
      // vdrift is lower  a negative Y (lower global |Z|)
      const float k_param = 1.2e-04;
      LocalPoint local_pos = layer->toLocal(globPos);
      vDrift = vDrift*(1. - k_param*local_pos.y());
        } 
  }

  // 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 107 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 83 of file DTLinearDriftFromDBAlgo.cc.

References compute(), DTRecHit1D::digiTime(), DTTopology::isWireValid(), DTRecHit1D::localPosition(), DTRecHit1D::localPositionError(), DTRecHit1D::setPositionAndError(), DTLayer::specificTopology(), stepTwoFromDigi, GeomDet::toGlobal(), DTWireId::wire(), DTRecHit1D::wireId(), and DTTopology::wirePosition().

                                                            {

  if (!stepTwoFromDigi) {
    newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
    return true;
  }

  const DTWireId wireId = recHit1D.wireId();
  
  // Get Wire position
  if(!layer->specificTopology().isWireValid(wireId.wire())) return false;
  LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
  const GlobalPoint globWirePos = layer->toGlobal(locWirePos);

  return compute(layer, wireId, recHit1D.digiTime(), globWirePos, newHit1D, 2);

}
void DTLinearDriftFromDBAlgo::setES ( const edm::EventSetup setup) [virtual]

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 47 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 101 of file DTLinearDriftFromDBAlgo.h.

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

Definition at line 94 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and DTLinearDriftFromDBAlgo().

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().

Definition at line 98 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and DTLinearDriftFromDBAlgo().