CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1TkCluster< T > Class Template Reference

#include <L1TkCluster.h>

List of all members.

Public Member Functions

void addSimTrack (const edm::Ptr< SimTrack > &trk)
MeasurementPoint findAverageLocalCoordinates () const
 Average cluster coordinates and position.
template<>
MeasurementPoint findAverageLocalCoordinates () const
template<>
MeasurementPoint findAverageLocalCoordinates () const
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
 Single hit coordinates and position.
template<>
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
template<>
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
unsigned int findSimTrackId () const
int findType () const
unsigned int findWidth () const
 Cluster width.
template<>
unsigned int findWidth () const
template<>
unsigned int findWidth () const
DetId getDetId () const
 Detector element.
std::vector< TgetHits () const
 Hits in the Cluster.
std::vector< edm::Ptr< SimTrack > > getSimTrackPtrs () const
 MC Truth.
unsigned int getStackMember () const
bool isCombinatoric () const
bool isGenuine () const
bool isUnknown () const
 L1TkCluster (std::vector< T > aHits, DetId aDetId, unsigned int aStackMember)
 Another Constructor.
 L1TkCluster ()
 Constructors.
std::string print (unsigned int i=0) const
 Information.
void setDetId (DetId aDetId)
void setHits (std::vector< T > aHits)
void setStackMember (unsigned int aStackMember)
 ~L1TkCluster ()
 Destructor.

Private Attributes

DetId theDetId
std::vector< TtheHits
 Data members.
std::vector< edm::Ptr< SimTrack > > theSimTracks
unsigned int theStackMember

Detailed Description

template<typename T>
class L1TkCluster< T >

//////////////////////////////////////// Stacked Tracker Simulations /// / Nicola Pozzobon, UNIPD /// Emmanuele Salvati, Cornell /// / 2011, June /// 2011, October /// 2012, August /// 2013, January /// ////////////////////////////////////// ************************ DECLARATION OF CLASS ************************

Definition at line 38 of file L1TkCluster.h.


Constructor & Destructor Documentation

template<typename T >
L1TkCluster< T >::L1TkCluster ( )

Constructors.

Close class.

***************************** IMPLEMENTATION OF METHODS ***************************** Default Constructor NOTE: to be used with setSomething(...) methods

Set default data members

Definition at line 100 of file L1TkCluster.h.

  {
    theHits.clear();
    theDetId = 0;
    theStackMember = 0;
    theSimTracks.clear();
  }
template<typename T >
L1TkCluster< T >::L1TkCluster ( std::vector< T aHits,
DetId  aDetId,
unsigned int  aStackMember 
)

Another Constructor.

Set default data members

Definition at line 111 of file L1TkCluster.h.

References j.

  {
    theHits.clear();
    for ( unsigned int j = 0; j < aHits.size(); j++ )
      theHits.push_back( aHits.at(j) );
    theDetId = aDetId;
    theStackMember = aStackMember;
    theSimTracks.clear();
  }
template<typename T >
L1TkCluster< T >::~L1TkCluster ( )

Destructor.

Definition at line 124 of file L1TkCluster.h.

{}

Member Function Documentation

template<typename T>
void L1TkCluster< T >::addSimTrack ( const edm::Ptr< SimTrack > &  trk) [inline]

Definition at line 63 of file L1TkCluster.h.

References L1TkCluster< T >::theSimTracks.

Referenced by StackedTrackerGeometry::checkSimTrack().

{ theSimTracks.push_back(trk);}
template<typename T >
MeasurementPoint L1TkCluster< T >::findAverageLocalCoordinates ( ) const

Average cluster coordinates and position.

Unweighted average local cluster coordinates Default template for PixelDigis

Loop over the hits and calculate the average coordinates

Definition at line 313 of file L1TkCluster.h.

  {
    double averageCol = 0.0;
    double averageRow = 0.0;

    if ( theHits.size() != 0 )
    {
      typename std::vector< T >::const_iterator hitIter;
      for ( hitIter = theHits.begin();
            hitIter != theHits.end();
            hitIter++ )
      {
        averageCol += (*hitIter)->column();
        averageRow += (*hitIter)->row();
      }
      averageCol /= theHits.size();
      averageRow /= theHits.size();
    }
    return MeasurementPoint( averageRow, averageCol );
  }
template<>
MeasurementPoint L1TkCluster< edm::Ref< edm::PSimHitContainer > >::findAverageLocalCoordinates ( ) const

Unweighted average local cluster coordinates Specialize the template for PSimHits in *cc

template<>
MeasurementPoint L1TkCluster< edm::Ref< edm::PSimHitContainer > >::findAverageLocalCoordinates ( ) const

Unweighted average local cluster coordinates Default template for PixelDigis in *.h Specialize the template for PSimHits

Dummy values

Definition at line 43 of file L1TkCluster.cc.

  {
    MeasurementPoint mp( 0, 0 ); 
    return mp;
  }
template<>
MeasurementPoint L1TkCluster< edm::Ref< edm::PSimHitContainer > >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Get hit local coordinates Specialize the template for PSimHits in *cc

template<>
MeasurementPoint L1TkCluster< edm::Ref< edm::PSimHitContainer > >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Get hit local coordinates Default template for PixelDigis in *.h Specialize the template for PSimHits

Dummy values

Definition at line 33 of file L1TkCluster.cc.

  {
    MeasurementPoint mp( 0, 0 ); 
    return mp;
  }
template<typename T >
MeasurementPoint L1TkCluster< T >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Single hit coordinates and position.

Get hit local coordinates Default template for PixelDigis

NOTE in this case, DO NOT add 0.5 to get the center of the pixel

Definition at line 296 of file L1TkCluster.h.

  {
    MeasurementPoint mp( theHits.at(hitIdx)->row(), theHits.at(hitIdx)->column() );
    return mp;
  }
template<typename T >
unsigned int L1TkCluster< T >::findSimTrackId ( ) const

Definition at line 257 of file L1TkCluster.h.

  {
    if ( this->isGenuine() && theSimTracks.size()>0 )
      return theSimTracks.at(0)->trackId();
    return 0;
  }
template<typename T >
int L1TkCluster< T >::findType ( ) const

Definition at line 249 of file L1TkCluster.h.

  {
    if ( this->isGenuine() && theSimTracks.size()>0 )
      return theSimTracks.at(0)->type();
    return 999999999;
  }
template<>
unsigned int L1TkCluster< edm::Ref< edm::PSimHitContainer > >::findWidth ( ) const

Cluster width Specialize the template for PSimHits in *cc

template<>
unsigned int L1TkCluster< edm::Ref< edm::PSimHitContainer > >::findWidth ( ) const

//////////////////////////////////////// Stacked Tracker Simulations /// / Nicola Pozzobon, UNIPD /// Emmanuele Salvati, Cornell /// / 2011, June /// 2011, October /// 2013, January /// ////////////////////////////////////// ***************************** IMPLEMENTATION OF METHODS ***************************** Get cluster width Default template for PixelDigis in *.h Specialize the template for PSimHits

Definition at line 24 of file L1TkCluster.cc.

  {
    return theHits.size();
  }
template<typename T >
unsigned int L1TkCluster< T >::findWidth ( ) const

Cluster width.

Cluster width Default template for PixelDigis

For broadside Clusters this is equivalent to theHits.size() but for 2d or neighbor Clusters this is only the actual size in RPhi

This takes care of 1-Pixel clusters

Definition at line 272 of file L1TkCluster.h.

References abs, and i.

  {
    int rowMin = 99999999;
    int rowMax = 0;
    for ( unsigned int i=0; i<theHits.size(); i++ )
    {
      if ( theHits.at(i)->row() < rowMin )
        rowMin = theHits.at(i)->row();
      if ( theHits.at(i)->row() > rowMax )
        rowMax = theHits.at(i)->row();
    }
    return abs( rowMax - rowMin + 1 ); 
  }
template<typename T >
DetId L1TkCluster< T >::getDetId ( void  ) const

Detector element.

Detector element information.

Definition at line 139 of file L1TkCluster.h.

Referenced by StackedTrackerGeometry::checkSimTrack(), StackedTrackerGeometry::findHitGlobalPosition(), and StackedTrackerGeometry::findHitLocalPosition().

{ return theDetId; }
template<typename T >
std::vector< T > L1TkCluster< T >::getHits ( ) const

Hits in the Cluster.

Hits composing the cluster.

Data members: getABC( ... ) Helper methods: findABC( ... )

Definition at line 128 of file L1TkCluster.h.

Referenced by StackedTrackerGeometry::checkSimTrack(), StackedTrackerGeometry::findAverageGlobalPosition(), StackedTrackerGeometry::findAverageLocalPosition(), StackedTrackerGeometry::findHitGlobalPosition(), and StackedTrackerGeometry::findHitLocalPosition().

{ return theHits; }
template<typename T >
std::vector< edm::Ptr< SimTrack > > L1TkCluster< T >::getSimTrackPtrs ( ) const

MC Truth.

MC truth information.

Definition at line 152 of file L1TkCluster.h.

{ return theSimTracks; }
template<typename T >
unsigned int L1TkCluster< T >::getStackMember ( ) const
template<typename T >
bool L1TkCluster< T >::isCombinatoric ( ) const

COMBINATORIC means that different SimTracks contribute to the cluster, which means that both a mixture of NULL pointers and good ones are present, or that all are good but there are more SimTracks associated to the cluster

Mixture of known and unknown SimTracks means true

Two different known SimTracks means true

Only unknown SimTracks means unknown, hence false

If not true, then it is false

Definition at line 188 of file L1TkCluster.h.

References funct::false, edm::Ptr< T >::isNull(), and gen::k.

  {
    int prevTrack = -99999; // SimTrackId storage
    unsigned int numberNulls = 0; // Number of non-found SimTracks
    unsigned int numberGoods = 0; // Number of found SimTracks
    for ( unsigned int k = 0; k < theSimTracks.size(); k++ )
    {
      edm::Ptr< SimTrack > curSimTrackPtr = theSimTracks.at(k);
      if ( curSimTrackPtr.isNull() )
        numberNulls++;
      else
        numberGoods++;

      if ( numberNulls > 0 && numberGoods > 0 )
        return true;

      if ( curSimTrackPtr.isNull() == false )
      {
        if ( theSimTracks.size() > 1 )
        {
          if ( prevTrack < 0 )
            prevTrack = curSimTrackPtr->trackId();

          if ( prevTrack != (int)curSimTrackPtr->trackId() )
            return true;

          prevTrack = curSimTrackPtr->trackId();
        }
      }
    }

    if ( numberNulls > 0 && numberGoods == 0 )
      return false;

    return false;
  }
template<typename T >
bool L1TkCluster< T >::isGenuine ( ) const

GENUINE means that ALL hits could be associated to a SimTrack stored in the corresponding collection, AND all of these SimTracks are actually the same

Unknown SimTrack means false

Two different known SimTracks means false

If not false, then it is true

Definition at line 155 of file L1TkCluster.h.

References edm::Ptr< T >::isNull(), and gen::k.

  {
    int prevTrack = -99999; // SimTrackId storage
    if ( theSimTracks.size() == 0 ) return false;
    for ( unsigned int k = 0; k < theSimTracks.size(); k++ )
    {
      edm::Ptr< SimTrack > curSimTrackPtr = theSimTracks.at(k);
      if ( curSimTrackPtr.isNull() )
        return false;
      else
      {
        if ( theSimTracks.size() > 1 )
        {
          if ( prevTrack < 0 )
            prevTrack = curSimTrackPtr->trackId();

          if ( prevTrack != (int)curSimTrackPtr->trackId() )
            return false;
 
          prevTrack = curSimTrackPtr->trackId();
        }
      }
    }
    return true;
  }
template<typename T >
bool L1TkCluster< T >::isUnknown ( ) const

UNKNOWN means that all SimTracks pointers are NULL

A known SimTrack means false

If not false, then it is true

Definition at line 234 of file L1TkCluster.h.

References funct::false, edm::Ptr< T >::isNull(), and gen::k.

  {
    for ( unsigned int k = 0; k < theSimTracks.size(); k++ )
    {
      edm::Ptr< SimTrack > curSimTrackPtr = theSimTracks.at(k);
      if ( curSimTrackPtr.isNull() == false )
        return false;
    }
    return true;
  }
template<typename T >
std::string L1TkCluster< T >::print ( unsigned int  i = 0) const

Information.

Definition at line 338 of file L1TkCluster.h.

References i, j, convertSQLitetoXML_cfg::output, and AlCaHLTBitMon_QueryRunRegistry::string.

  {
    std::string padding("");
    for ( unsigned int j=0; j!=i; ++j )
      padding+="\t";
    std::stringstream output;
    output<<padding<<"L1TkCluster:\n";
    padding+='\t';
    output << padding << "DetId: " << theDetId.rawId() << '\n';
    output << padding << "member: " << theStackMember << ", cluster size: " << theHits.size() << '\n';
    return output.str();
  }
template<typename T >
void L1TkCluster< T >::setDetId ( DetId  aDetId)

Definition at line 142 of file L1TkCluster.h.

{ theDetId = aDetId; }
template<typename T >
void L1TkCluster< T >::setHits ( std::vector< T aHits)

Definition at line 131 of file L1TkCluster.h.

References j.

  {
    for ( unsigned int j=0; j<aHits.size(); j++ )
      theHits.push_back( aHits.at(j) );
  }
template<typename T >
void L1TkCluster< T >::setStackMember ( unsigned int  aStackMember)

Definition at line 148 of file L1TkCluster.h.

{ theStackMember = aStackMember; }

Member Data Documentation

template<typename T>
DetId L1TkCluster< T >::theDetId [private]

Definition at line 85 of file L1TkCluster.h.

template<typename T>
std::vector< T > L1TkCluster< T >::theHits [private]

Data members.

Definition at line 84 of file L1TkCluster.h.

template<typename T>
std::vector< edm::Ptr< SimTrack > > L1TkCluster< T >::theSimTracks [private]

Definition at line 87 of file L1TkCluster.h.

Referenced by L1TkCluster< T >::addSimTrack().

template<typename T>
unsigned int L1TkCluster< T >::theStackMember [private]

Definition at line 86 of file L1TkCluster.h.