CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiTrackerMultiRecHit Class Reference

#include <SiTrackerMultiRecHit.h>

Inheritance diagram for SiTrackerMultiRecHit:
BaseSiTrackerRecHit2DLocalPos RecHit2DLocalPos TrackingRecHit

List of all members.

Public Member Functions

virtual SiTrackerMultiRecHitclone () const
virtual std::vector< const
TrackingRecHit * > 
recHits () const
 Access to component RecHits (if any)
virtual std::vector
< TrackingRecHit * > 
recHits ()
 Non-const access to component RecHits (if any)
bool sharesInput (const TrackingRecHit *other, SharedInputType what) const
 SiTrackerMultiRecHit (const LocalPoint &, const LocalError &, const DetId &, const std::vector< std::pair< const TrackingRecHit *, float > > &)
 SiTrackerMultiRecHit ()
float weight (unsigned int i) const
std::vector< float > weights () const
virtual ~SiTrackerMultiRecHit ()

Private Attributes

edm::OwnVector< TrackingRecHittheHits
std::vector< float > theWeights

Detailed Description

Definition at line 13 of file SiTrackerMultiRecHit.h.


Constructor & Destructor Documentation

SiTrackerMultiRecHit::SiTrackerMultiRecHit ( ) [inline]

Definition at line 16 of file SiTrackerMultiRecHit.h.

Referenced by clone().

SiTrackerMultiRecHit::SiTrackerMultiRecHit ( const LocalPoint pos,
const LocalError err,
const DetId id,
const std::vector< std::pair< const TrackingRecHit *, float > > &  aHitMap 
)

Definition at line 7 of file SiTrackerMultiRecHit.cc.

References edm::OwnVector< T, P >::push_back(), theHits, and theWeights.

                                                                                                                                                                          :
        BaseSiTrackerRecHit2DLocalPos(pos,err,id)       
{
        for(std::vector<std::pair<const TrackingRecHit*, float> >::const_iterator ihit = aHitMap.begin(); ihit != aHitMap.end(); ihit++){
                theHits.push_back(ihit->first->clone());
                theWeights.push_back(ihit->second);
        }
}
virtual SiTrackerMultiRecHit::~SiTrackerMultiRecHit ( ) [inline, virtual]

Definition at line 23 of file SiTrackerMultiRecHit.h.

{};             

Member Function Documentation

virtual SiTrackerMultiRecHit* SiTrackerMultiRecHit::clone ( void  ) const [inline, virtual]

Implements RecHit2DLocalPos.

Definition at line 21 of file SiTrackerMultiRecHit.h.

References SiTrackerMultiRecHit().

{return new SiTrackerMultiRecHit(*this);};
vector< const TrackingRecHit * > SiTrackerMultiRecHit::recHits ( ) const [virtual]

Access to component RecHits (if any)

Reimplemented from RecHit2DLocalPos.

Definition at line 60 of file SiTrackerMultiRecHit.cc.

References edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::end(), and theHits.

Referenced by TrackerHitAssociator::associateMultiRecHit(), TrackerHitAssociator::associateMultiRecHitId(), TrackerDpgAnalysis::insertMeasurement(), and TSiTrackerMultiRecHit::recHits().

                                                                 {
         vector<const TrackingRecHit*> myhits;
         for(edm::OwnVector<TrackingRecHit>::const_iterator ihit = theHits.begin(); ihit != theHits.end(); ihit++) {
                 myhits.push_back(&*ihit);
         }
  return myhits;
}
vector< TrackingRecHit * > SiTrackerMultiRecHit::recHits ( ) [virtual]

Non-const access to component RecHits (if any)

Reimplemented from RecHit2DLocalPos.

Definition at line 68 of file SiTrackerMultiRecHit.cc.

References edm::OwnVector< T, P >::data(), and theHits.

                                                      {
  //        vector<TrackingRecHit*> myhits;
//         for(edm::OwnVector<TrackingRecHit>::const_iterator ihit = theHits.begin(); ihit != theHits.end(); ihit++) {
//                 const TrackingRecHit* ahit = &(*ihit);
//                 myhits.push_back(const_cast<TrackingRecHit*>(ahit));
//         }
        return theHits.data();
}
bool SiTrackerMultiRecHit::sharesInput ( const TrackingRecHit other,
SharedInputType  what 
) const [virtual]

Returns true if the two TrackingRecHits are using the same input information (like Digis, Clusters, etc), false otherwise. The second argument specifies how much sharing is needed in order to return true: the value "all" means that all inputs of the two hits must be identical; the value "some" means that at least one of the inputs is in common.

Reimplemented from TrackingRecHit.

Definition at line 23 of file SiTrackerMultiRecHit.cc.

References TrackingRecHit::all, edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::end(), newFWLiteAna::found, TrackingRecHit::geographicalId(), TrackingRecHit::recHits(), edm::OwnVector< T, P >::size(), TrackingRecHit::some, and theHits.

{
  if(geographicalId() != other->geographicalId()&& what==all ) return false;
  vector<const TrackingRecHit*> otherhits=other->recHits();
  if(what==all){
    if(theHits.size()!=other->recHits().size())return false;
    for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
      bool found=false;
      for(OwnVector<TrackingRecHit>::const_iterator hit=theHits.begin();hit!=theHits.end();++hit){
        if((hit)->sharesInput(*otherhit,all)){
          found=true;
          break;
        }
      }
      if(found==false){
        return false;
      }
    }
    return true;
  }
  else{
    for(OwnVector<TrackingRecHit>::const_iterator hit=theHits.begin();hit!=theHits.end();++hit){
      if(otherhits.size()!=0){ 
        for(vector<const TrackingRecHit*>::iterator otherhit=otherhits.begin();otherhit!=otherhits.end();++otherhit){
          if((hit)->sharesInput(*otherhit,some))return true;
        }
      }
      else{//otherwise it should be a simple rechit
        if((hit)->sharesInput(other,some))return true;
      } 
    }
    return false;
  }
}
float SiTrackerMultiRecHit::weight ( unsigned int  i) const

Definition at line 16 of file SiTrackerMultiRecHit.cc.

References theWeights.

Referenced by TrackerHitAssociator::associateMultiRecHit(), and TrackerHitAssociator::associateMultiRecHitId().

                                                       {
        if (i < theWeights.size()) return theWeights[i];
        edm::LogError("SiTrackerMultiRecHit") << "You are requesting a the weight for a hit out of range, returning 0";
        return 0; 
}
std::vector<float> SiTrackerMultiRecHit::weights ( ) const [inline]

Member Data Documentation

Definition at line 40 of file SiTrackerMultiRecHit.h.

Referenced by recHits(), sharesInput(), and SiTrackerMultiRecHit().

std::vector<float> SiTrackerMultiRecHit::theWeights [private]

Definition at line 41 of file SiTrackerMultiRecHit.h.

Referenced by SiTrackerMultiRecHit(), weight(), and weights().