CMS 3D CMS Logo

DTLinearDriftFromDBAlgo Class Reference

Concrete implementation of DTRecHitBaseAlgo. More...

#include <RecoLocalMuon/DTRecHit/plugins/DTLinearDriftFromDBAlgo.h>

Inheritance diagram for DTLinearDriftFromDBAlgo:

DTRecHitBaseAlgo

List of all members.

Public Member Functions

virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, const GlobalPoint &globPos, DTRecHit1D &newHit1D) const
 Third (and final) step in hits position computation.
virtual bool compute (const DTLayer *layer, const DTRecHit1D &recHit1D, const float &angle, DTRecHit1D &newHit1D) const
 Second step in hit position computation.
virtual bool compute (const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const
 First step in computation of Left/Right hits from a Digi.
 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, DTRecHit1D &newHit1D, int step) const
virtual bool compute (const DTLayer *layer, const DTWireId &wireId, const float digiTime, const GlobalPoint &globPos, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error, 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 GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxTime, and minTime.

00023                                                                            :
00024   DTRecHitBaseAlgo(config) {
00025 
00026     minTime = config.getParameter<double>("minTime"); 
00027 
00028     maxTime = config.getParameter<double>("maxTime"); 
00029 
00030     // Set verbose output
00031     debug = config.getUntrackedParameter<bool>("debug");
00032     if(debug)
00033       cout<<"[DTLinearDriftFromDBAlgo] Constructor called"<<endl;
00034   }

DTLinearDriftFromDBAlgo::~DTLinearDriftFromDBAlgo (  )  [virtual]

Destructor.

Definition at line 38 of file DTLinearDriftFromDBAlgo.cc.

00038 {}


Member Function Documentation

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 167 of file DTLinearDriftFromDBAlgo.cc.

References compute(), lat::endl(), 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().

00172                                                 {
00173   LocalPoint leftPoint;
00174   LocalPoint rightPoint;
00175   LocalError error;
00176 
00177   if(compute(layer, wireId, digiTime, globPos, leftPoint, rightPoint, error, step)) {
00178     // Set the position and the error of the rechit which is being updated
00179     switch(newHit1D.lrSide()) {
00180         
00181     case DTEnums::Left:
00182         {
00183           // Keep the original y position of newHit1D: for step==3, it's the
00184           // position along the wire. Needed for rotation alignment
00185           LocalPoint leftPoint3D(leftPoint.x(), newHit1D.localPosition().y(), leftPoint.z());
00186           newHit1D.setPositionAndError(leftPoint3D, error);
00187           break;
00188         }
00189         
00190     case DTEnums::Right:
00191         {
00192           // as above: 3d position
00193           LocalPoint rightPoint3D(rightPoint.x(), newHit1D.localPosition().y(), rightPoint.z());
00194           newHit1D.setPositionAndError(rightPoint3D, error);
00195           break;
00196         }
00197         
00198     default:
00199       throw cms::Exception("InvalidDTCellSide") << "[DTLinearDriftFromDBAlgo] Compute at Step "
00200                                                 << step << ", Hit side "
00201                                                 << newHit1D.lrSide()
00202                                                 << " is invalid!" << endl;
00203       return false;
00204     }
00205       
00206     return true;
00207   }else {
00208     return false;
00209   }
00210 }

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 99 of file DTLinearDriftFromDBAlgo.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), maxTime, mTimeMap, DTTimeUnits::ns, DTTTrigBaseSync::offset(), DTMtime::slMtime(), 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().

00106                                                 {
00107   // Subtract the offset to the digi time accordingly to the DTTTrigBaseSync concrete instance
00108   float driftTime = digiTime - theSync->offset(layer, wireId, globPos); 
00109   
00110   // check for out-of-time
00111   if (driftTime < minTime || driftTime > maxTime) {
00112     if (debug) cout << "[DTLinearDriftFromDBAlgo]*** Drift time out of window for in-time hits "
00113                               << driftTime << endl;
00114 
00115     if(step == 1) { //FIXME: protection against failure at 2nd and 3rd steps, must be checked!!!
00116       // Hits are interpreted as coming from out-of-time pile-up and recHit
00117       // is ignored.
00118       return false;
00119     }
00120   }
00121 
00122   // Small negative times interpreted as hits close to the wire.
00123   if (driftTime<0.) driftTime=0;
00124 
00125   // Read the vDrift and reso for this wire
00126   float vDrift = 0;
00127   float hitResolution = 0;//FIXME: should use this!
00128   mTimeMap->slMtime(wireId.superlayerId(),
00129                     vDrift,
00130                     hitResolution,
00131                     DTTimeUnits::ns);
00132 
00133 
00134   // Compute the drift distance
00135   float drift = driftTime * vDrift;
00136 
00137   // Get Wire position
00138   LocalPoint locWirePos(layer->specificTopology().wirePosition(wireId.wire()), 0, 0);
00139   //Build the two possible points and the error on the position
00140   leftPoint  = LocalPoint(locWirePos.x()-drift,
00141                             locWirePos.y(),
00142                             locWirePos.z());
00143   rightPoint = LocalPoint(locWirePos.x()+drift,
00144                             locWirePos.y(),
00145                             locWirePos.z());
00146   error = LocalError(hitResolution*hitResolution,0.,0.);
00147 
00148 
00149   if(debug) {
00150     cout << "[DTLinearDriftFromDBAlgo] Compute drift distance, for digi at wire: " << wireId << endl
00151          << "       Step:           " << step << endl
00152          << "       Digi time:      " << digiTime << endl
00153          << "       Drift time:     " << driftTime << endl
00154          << "       Drift distance: " << drift << endl
00155          << "       Hit Resolution: " << hitResolution << endl
00156          << "       Left point:     " << leftPoint << endl
00157          << "       Right point:    " << rightPoint << endl
00158          << "       Error:          " << error << endl;
00159    }
00160   
00161   return true;
00162   
00163 }

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 88 of file DTLinearDriftFromDBAlgo.cc.

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

00092                                                             {
00093   return compute(layer, recHit1D.wireId(), recHit1D.digiTime(), globPos, newHit1D, 3);
00094 }

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 77 of file DTLinearDriftFromDBAlgo.cc.

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

00080                                                             {
00081   newHit1D.setPositionAndError(recHit1D.localPosition(), recHit1D.localPositionError());
00082   return true;
00083 }

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 DTLayer::id(), DTLayer::specificTopology(), DTDigi::time(), GeomDet::toGlobal(), DTDigi::wire(), and DTTopology::wirePosition().

Referenced by compute().

00062                                                          {
00063   // Get the wireId
00064   DTLayerId layerId = layer->id();
00065   const DTWireId wireId(layerId, digi.wire());
00066 
00067   // Get Wire position
00068   LocalPoint locWirePos(layer->specificTopology().wirePosition(digi.wire()), 0, 0);
00069   const GlobalPoint globWirePos = layer->toGlobal(locWirePos);
00070   
00071   return compute(layer, wireId, digi.time(), globWirePos, leftPoint, rightPoint, error, 1); 
00072 }

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 GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::EventSetup::get(), mTimeMap, DTTTrigBaseSync::setES(), DTRecHitBaseAlgo::theSync, and DTMtime::version().

00042                                                            {
00043   if(debug)
00044     cout<<"[DTLinearDriftFromDBAlgo] setES called"<<endl;
00045   theSync->setES(setup);
00046   // Get the map of ttrig from the Setup
00047   ESHandle<DTMtime> mTimeHandle;
00048   setup.get<DTMtimeRcd>().get(mTimeHandle);
00049   mTimeMap = &*mTimeHandle;
00050   
00051   if(debug) 
00052     cout << "[DTLinearDriftFromDBAlgo] meanTimer version: " << mTimeMap->version()<<endl;
00053 }


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

const DTMtime* DTLinearDriftFromDBAlgo::mTimeMap [private]

Definition at line 85 of file DTLinearDriftFromDBAlgo.h.

Referenced by compute(), and setES().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:55 2009 for CMSSW by  doxygen 1.5.4