CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Static Private Attributes

DTNoDriftAlgo Class Reference

#include <DTNoDriftAlgo.h>

Inheritance diagram for DTNoDriftAlgo:
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, const GlobalPoint &globPos, DTRecHit1D &newHit1D) const
virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, DTRecHit1D &newHit1D) const
 DTNoDriftAlgo (const edm::ParameterSet &config)
 Constructor.
virtual edm::OwnVector
< DTRecHit1DPair
reconstruct (const DTLayer *layer, const DTLayerId &layerId, const DTDigiCollection::Range &digiRange)
virtual void setES (const edm::EventSetup &setup)
 Pass the Event Setup to the algo at each event.
virtual ~DTNoDriftAlgo ()
 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

Static Private Attributes

static bool debug
static float fixedDrift
static float hitResolution
static float maxTime
static float minTime

Detailed Description

Concrete implementation of DTRecHitBaseAlgo. Create pair of RecHits at fixed distance from the wire.

Date:
2007/04/19 11:08:17
Revision:
1.1
Author:
Martijn Mulders - CERN (martijn.mulders@cern.ch) based on DTLinearDriftAlgo

Definition at line 19 of file DTNoDriftAlgo.h.


Constructor & Destructor Documentation

DTNoDriftAlgo::DTNoDriftAlgo ( const edm::ParameterSet config)

Constructor.

Definition at line 20 of file DTNoDriftAlgo.cc.

References debug, fixedDrift, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitResolution, maxTime, and minTime.

                                                       :
  DTRecHitBaseAlgo(config) {

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

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

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

    hitResolution = config.getParameter<double>("hitResolution"); // Set to size of (half)cell 
    // Set verbose output
    debug = config.getUntrackedParameter<bool>("debug");
    
  }
DTNoDriftAlgo::~DTNoDriftAlgo ( ) [virtual]

Destructor.

Definition at line 37 of file DTNoDriftAlgo.cc.

{}

Member Function Documentation

bool DTNoDriftAlgo::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 98 of file DTNoDriftAlgo.cc.

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

Referenced by compute(), and reconstruct().

                                                         {
  // 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 DTNoDriftAlgo::compute ( const DTLayer layer,
const DTWireId wireId,
const float  digiTime,
const GlobalPoint globPos,
DTRecHit1D newHit1D,
int  step 
) const [private, virtual]

Definition at line 203 of file DTNoDriftAlgo.cc.

References compute(), error, Exception, DTEnums::Left, DTRecHit1D::lrSide(), DTEnums::Right, and DTRecHit1D::setPositionAndError().

                                                {
  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:
      newHit1D.setPositionAndError(leftPoint, error);
      break;
        
    case DTEnums::Right:
      newHit1D.setPositionAndError(rightPoint, error);
      break;
        
    default:
      throw cms::Exception("InvalidDTCellSide") << "[DTNoDriftAlgo] Compute at Step "
                                                << step << ", Hit side "
                                                << newHit1D.lrSide()
                                                << " is invalid!" << endl;
      return false;
    }
      
    return true;
  }else {
    return false;
  }
}
bool DTNoDriftAlgo::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 118 of file DTNoDriftAlgo.cc.

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

                                                            {
  newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
  return true;
}
bool DTNoDriftAlgo::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 129 of file DTNoDriftAlgo.cc.

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

                                                            {
  return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
}
bool DTNoDriftAlgo::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 140 of file DTNoDriftAlgo.cc.

References gather_cfg::cout, debug, shallow::drift(), fixedDrift, hitResolution, DTTopology::isWireValid(), maxTime, DTLayer::specificTopology(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                {
  //}

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


  // check for out-of-time
  if (digiTime < minTime || digiTime > maxTime) {
    if (debug) cout << "[DTNoDriftAlgo]*** Drift time out of window for in-time hits "
                              << digiTime << 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;
    }
  }


  // Compute the drift distance
  float drift = fixedDrift;

  // 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 << "[DTNoDriftAlgo] Compute drift distance, for digi at wire: " << wireId << endl
         << "       Step:           " << step << endl
         << "       Digi time:      " << digiTime << endl
      //         << "       Drift time:     " << driftTime << endl
         << "       Fixed Drift distance: " << drift << endl
         << "       Hit Resolution: " << hitResolution << endl
         << "       Left point:     " << leftPoint << endl
         << "       Right point:    " << rightPoint << endl
         << "       Error:          " << error << endl;
  }



  return true;
  
}
OwnVector< DTRecHit1DPair > DTNoDriftAlgo::reconstruct ( const DTLayer layer,
const DTLayerId layerId,
const DTDigiCollection::Range digiRange 
) [virtual]

MM: Override virtual function from DTRecHitBaseAlgo--> for the NoDrift algorithm only a maximum of one hit per wire is allowed! Build all hits in the range associated to the layerId, at the 1st step.

Reimplemented from DTRecHitBaseAlgo.

Definition at line 49 of file DTNoDriftAlgo.cc.

References edm::OwnVector< T, P >::begin(), compute(), edm::OwnVector< T, P >::end(), DTEnums::Left, edm::OwnVector< T, P >::push_back(), query::result, DTEnums::Right, and DTRecHit1DPair::setPositionAndError().

                                                                                                {
  OwnVector<DTRecHit1DPair> result; 

  // Loop over all digis in the given range
  for (DTDigiCollection::const_iterator digi = digiRange.first;
       digi != digiRange.second;
       digi++) {
    // Get the wireId
    DTWireId wireId(layerId, (*digi).wire());

    bool isDouble = false;
    for (OwnVector<DTRecHit1DPair>::const_iterator doubleWireCheck =  result.begin();
         doubleWireCheck != result.end();
         doubleWireCheck++) {
      if( wireId == (*doubleWireCheck).wireId()) {
        isDouble = true;
        //      std::cout << " Reject this hit with time " << (*digi).time() << std::endl; 
        break;
      }
    }
    
    if (isDouble) continue;

    LocalError tmpErr;
    LocalPoint lpoint, rpoint;
    // Call the compute method
    bool OK = compute(layer, *digi, lpoint, rpoint, tmpErr);

    if (!OK) continue;

    // Build a new pair of 1D rechit    
    DTRecHit1DPair*  recHitPair = new DTRecHit1DPair(wireId, *digi);

    // Set the position and the error of the 1D rechits
    recHitPair->setPositionAndError(DTEnums::Left, lpoint, tmpErr);
    recHitPair->setPositionAndError(DTEnums::Right, rpoint, tmpErr);        

    result.push_back(recHitPair);
  }
  return result;
}
void DTNoDriftAlgo::setES ( const edm::EventSetup setup) [virtual]

Pass the Event Setup to the algo at each event.

Implements DTRecHitBaseAlgo.

Definition at line 41 of file DTNoDriftAlgo.cc.

                                                 {
  //  theSync->setES(setup);
}

Member Data Documentation

bool DTNoDriftAlgo::debug [static, private]

Definition at line 107 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::fixedDrift [static, private]

Definition at line 95 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::hitResolution [static, private]

Definition at line 98 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::maxTime [static, private]

Definition at line 104 of file DTNoDriftAlgo.h.

Referenced by compute(), and DTNoDriftAlgo().

float DTNoDriftAlgo::minTime [static, private]

Definition at line 101 of file DTNoDriftAlgo.h.

Referenced by DTNoDriftAlgo().