CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1TkStub< T > Class Template Reference

#include <L1TkStub.h>

List of all members.

Public Member Functions

void addClusterPtr (edm::Ptr< L1TkCluster< T > > aL1TkCluster)
 Add the Clusters to the candidate Stub.
void checkSimTrack ()
 Collect MC truth.
unsigned int findSimTrackId () const
int findType () const
const edm::Ptr< L1TkCluster< T > > & getClusterPtr (unsigned int hitIdentifier) const
 Get the Pointer to a Cluster.
std::vector< edm::Ptr
< L1TkCluster< T > > > 
getClusterPtrs () const
 Clusters composing the Stub.
DetId getDetId () const
 Detector element.
edm::Ptr< SimTrackgetSimTrackPtr () const
 In HALF-STRIP units!
double getTriggerDisplacement () const
 Trigger information.
double getTriggerOffset () const
 In HALF-STRIP units!
bool isCombinatoric () const
bool isGenuine () const
bool isUnknown () const
 L1TkStub (DetId aDetId)
 Another Constructor.
 L1TkStub ()
 Constructors.
std::string print (unsigned int i=0) const
 Information.
void setDetId (DetId aDetId)
void setTriggerDisplacement (int aDisplacement)
 In FULL-STRIP units!
void setTriggerOffset (int anOffset)
 In FULL-STRIP units!
 ~L1TkStub ()
 Destructor.

Private Attributes

std::vector< edm::Ptr
< L1TkCluster< T > > > 
theClusters
DetId theDetId
 Data members.
int theDisplacement
int theOffset
edm::Ptr< SimTracktheSimTrack

Detailed Description

template<typename T>
class L1TkStub< T >

//////////////////////////////////////// Stacked Tracker Simulations /// / Andrew W. Rose, IC /// Nicola Pozzobon, UNIPD /// UNIPD /// / 2008 /// 2010, June /// 2011, June /// 2012, October /// 2013, January /// ////////////////////////////////////// ************************ DECLARATION OF CLASS ************************

Definition at line 38 of file L1TkStub.h.


Constructor & Destructor Documentation

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

Constructors.

Close class.

***************************** IMPLEMENTATION OF METHODS ***************************** Default Constructor

Set default data members

Definition at line 102 of file L1TkStub.h.

  {
    theDetId = 0;
    theClusters.clear();
    theDisplacement = 999999;
    theOffset = 0;
  }
template<typename T >
L1TkStub< T >::L1TkStub ( DetId  aDetId)

Another Constructor.

Set default data members

Definition at line 113 of file L1TkStub.h.

  {
    theDetId = aDetId;
    theClusters.clear();
    theDisplacement = 999999;
    theOffset = 0;
  }
template<typename T >
L1TkStub< T >::~L1TkStub ( )

Destructor.

Definition at line 124 of file L1TkStub.h.

{}

Member Function Documentation

template<typename T >
void L1TkStub< T >::addClusterPtr ( edm::Ptr< L1TkCluster< T > >  aL1TkCluster)

Add the Clusters to the candidate Stub.

NOTE: this must be used ONLY as it is used within the L1TkStubBuilder! So, pushing back in the right order!!

Definition at line 151 of file L1TkStub.h.

Referenced by L1TkStubBuilder< T >::produce().

  {
    theClusters.push_back( aL1TkCluster );
  }
template<typename T >
void L1TkStub< T >::checkSimTrack ( )

Collect MC truth.

This method is based on the early version of isGenuine >>> same approach to store the SimTrack

GENUINE for clusters means not combinatoric and not unknown: same MC truth content MUST be found in both clusters composing the stub

If at least one cluster is unknown, it means either unknown, either combinatoric Do nothing, leave the default NULL

Here both are clusters are genuine/combinatoric If both clusters have some known SimTrack content they must be compared to each other

Two genuine clusters with same SimTrack content mean genuine

Here, at least one cluster is combinatoric

Skip NULL pointers

Skip NULL pointers

Same SimTrack is present in both clusters

If two different SimTracks are found in both clusters, then the stub is for sure combinatoric

No SimTracks were found to be in both clusters

Only one SimTrack was found to be present in both clusters even if one of the clusters (or both) are combinatoric: this means there is only one track that participates in both clusters, hence the stub is genuine

Definition at line 364 of file L1TkStub.h.

References funct::false, i, j, and gen::k.

Referenced by L1TkStubBuilder< T >::produce().

  {

    if ( theClusters.at(0)->isUnknown() || theClusters.at(1)->isUnknown() )
      return;

    else
    {
      if ( theClusters.at(0)->isGenuine() && theClusters.at(1)->isGenuine() )
      {
        if ( theClusters.at(0)->findSimTrackId() == theClusters.at(1)->findSimTrackId() )
        {
          std::vector< edm::Ptr< SimTrack > > curSimTracks = theClusters.at(0)->getSimTrackPtrs();
          for ( unsigned int k = 0; k < curSimTracks.size(); k++ )
          {
            if ( curSimTracks.at(k).isNull() == false )
            {
              theSimTrack = curSimTracks.at(k);
              return;
            }
          }
        }
        else
          return;
      }
      else
      {
        int prevTrack = -99999; // SimTrackId storage
        unsigned int whichSimTrack = 0;
        std::vector< edm::Ptr< SimTrack > > innerSimTracks = theClusters.at(0)->getSimTrackPtrs();
        std::vector< edm::Ptr< SimTrack > > outerSimTracks = theClusters.at(1)->getSimTrackPtrs();
        for ( unsigned int i = 0; i < innerSimTracks.size(); i++ )
        {
          if ( innerSimTracks.at(i).isNull() );
            continue;
          for ( unsigned int j = 0; j < outerSimTracks.size(); j++ )
          {
            if ( outerSimTracks.at(j).isNull() );
              continue;

            if ( innerSimTracks.at(i)->trackId() == outerSimTracks.at(j)->trackId() )
            {
              if ( prevTrack < 0 )
              {
                prevTrack = outerSimTracks.at(j)->trackId();
                whichSimTrack = j;
              }

              if ( prevTrack != (int)outerSimTracks.at(j)->trackId() )
                return;
            }
          }
        }
        if ( prevTrack < 0 )
          return;
        else
          theSimTrack = outerSimTracks.at(whichSimTrack);
      }
    }
  }
template<typename T >
unsigned int L1TkStub< T >::findSimTrackId ( ) const

Definition at line 355 of file L1TkStub.h.

  {
    if ( theSimTrack.isNull() )
      return 0;
    return theSimTrack->trackId();
  }
template<typename T >
int L1TkStub< T >::findType ( ) const

Definition at line 347 of file L1TkStub.h.

  {
    if ( theSimTrack.isNull() )
      return 999999999;
    return theSimTrack->type();
  }
template<typename T >
const edm::Ptr< L1TkCluster< T > > & L1TkStub< T >::getClusterPtr ( unsigned int  hitIdentifier) const
template<typename T >
std::vector< edm::Ptr< L1TkCluster< T > > > L1TkStub< T >::getClusterPtrs ( ) const

Clusters composing the Stub.

Get the Pointers to the Clusters composing the Stub.

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

Definition at line 128 of file L1TkStub.h.

{ return theClusters; }
template<typename T >
DetId L1TkStub< T >::getDetId ( void  ) const
template<typename T >
edm::Ptr< SimTrack > L1TkStub< T >::getSimTrackPtr ( ) const

In HALF-STRIP units!

MC truth.

MC truth

Definition at line 181 of file L1TkStub.h.

{ return theSimTrack; }
template<typename T >
double L1TkStub< T >::getTriggerDisplacement ( ) const

Trigger information.

Trigger info.

Definition at line 168 of file L1TkStub.h.

{ return 0.5*theDisplacement; }
template<typename T >
double L1TkStub< T >::getTriggerOffset ( ) const

In HALF-STRIP units!

Definition at line 174 of file L1TkStub.h.

{ return 0.5*theOffset; }
template<typename T >
bool L1TkStub< T >::isCombinatoric ( ) const

COMBINATORIC means that the same MC truth content cannot be found in the pair of clusters that compose the stub, and at leask one of them is not unknown

Two unknown clusters mean that the stub is unknown

One unknown and one combinatoric mean the stub is combinatoric One unknown and one genuine mean the stub is combinatoric

Here both are clusters are genuine/combinatoric If both clusters have some known SimTrack content they must be compared to each other

Two genuine clusters with same SimTrack content mean genuine

Here, at least one cluster is combinatoric

Skip NULL pointers

Skip NULL pointers

Same SimTrack is present in both clusters

If two different SimTracks are found in both clusters, then the stub is for sure combinatoric

No common SimTracks were found to be in both clusters

Only one SimTrack was found to be present in both clusters even if one of the clusters (or both) are combinatoric: this means there is only one track that participates in both clusters, hence the stub is genuine

Default Should never get here

Definition at line 262 of file L1TkStub.h.

References dtNoiseDBValidation_cfg::cerr, i, and j.

  {
    if ( this->isGenuine() )
      return false;

    if ( theClusters.at(0)->isUnknown() && theClusters.at(1)->isUnknown() )
      return false;

    else if ( theClusters.at(0)->isUnknown() || theClusters.at(1)->isUnknown() )
      return true;

    else
    {
      if ( theClusters.at(0)->isGenuine() && theClusters.at(1)->isGenuine() )
      {
        if ( theClusters.at(0)->findSimTrackId() == theClusters.at(1)->findSimTrackId() )
          return false;
        else
          return true;
      }
      else
      {
        int prevTrack = -99999; // SimTrackId storage
        std::vector< edm::Ptr< SimTrack > > innerSimTracks = theClusters.at(0)->getSimTrackPtrs();
        std::vector< edm::Ptr< SimTrack > > outerSimTracks = theClusters.at(1)->getSimTrackPtrs();
        for ( unsigned int i = 0; i < innerSimTracks.size(); i++ )
        {
          if ( innerSimTracks.at(i).isNull() );
            continue;
          for ( unsigned int j = 0; j < outerSimTracks.size(); j++ )
          {
            if ( outerSimTracks.at(j).isNull() );
              continue;

            if ( innerSimTracks.at(i)->trackId() == outerSimTracks.at(j)->trackId() )
            {
              if ( prevTrack < 0 )
                prevTrack = outerSimTracks.at(j)->trackId();

              if ( prevTrack != (int)outerSimTracks.at(j)->trackId() )
                return true;
            }
          }
        }
        if ( prevTrack < 0 )
          return true;
        else
          return false;
      }
    }
    std::cerr << "W A R N I N G! L1TkStub::isCombinatoric() \t we should never get here" << std::endl;
    return false; 
  }
template<typename T >
bool L1TkStub< T >::isGenuine ( ) const

Definition at line 184 of file L1TkStub.h.

  {
    /*
    if ( theClusters.at(0)->isUnknown() || theClusters.at(1)->isUnknown() )
      return false;

    else
    {
      if ( theClusters.at(0)->isGenuine() && theClusters.at(1)->isGenuine() )
      {
        if ( theClusters.at(0)->findSimTrackId() == theClusters.at(1)->findSimTrackId() )
          return true;
        else
          return false;
      }
      else
      {
        int prevTrack = -99999; // SimTrackId storage
        std::vector< edm::Ptr< SimTrack > > innerSimTracks = theClusters.at(0)->getSimTrackPtrs();
        std::vector< edm::Ptr< SimTrack > > outerSimTracks = theClusters.at(1)->getSimTrackPtrs();
        for ( unsigned int i = 0; i < innerSimTracks.size(); i++ )
        {
          if ( innerSimTracks.at(i).isNull() );
            continue;
          for ( unsigned int j = 0; j < outerSimTracks.size(); j++ )
          {
            if ( outerSimTracks.at(j).isNull() );
              continue;

            if ( innerSimTracks.at(i)->trackId() == outerSimTracks.at(j)->trackId() )
            {
              if ( prevTrack < 0 )
                prevTrack = outerSimTracks.at(j)->trackId();

              if ( prevTrack != (int)outerSimTracks.at(j)->trackId() )
                return false;
            }
          }
        }
        if ( prevTrack < 0 )
          return false;
        else
          return true;
      }
    }
    std::cerr << "W A R N I N G! L1TkStub::isGenuine() \t we should never get here" << std::endl;
    return true;
    */

    if ( theSimTrack.isNull() )
      return false;

    return true;
  }
template<typename T >
bool L1TkStub< T >::isUnknown ( ) const

UNKNOWN means that both clusters are unknown

Definition at line 340 of file L1TkStub.h.

  {
    return ( theClusters.at(0)->isUnknown() && theClusters.at(1)->isUnknown() );
  }
template<typename T >
std::string L1TkStub< T >::print ( unsigned int  i = 0) const

Information.

Definition at line 451 of file L1TkStub.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<<"L1TkStub:\n";
    padding+='\t';
    output << padding << "DetId: " << theDetId.rawId() << '\n';
    unsigned int iClu = 0;
    typename std::vector< edm::Ptr< L1TkCluster< T > > >::const_iterator clusIter;
    for ( clusIter = theClusters.begin(); clusIter!= theClusters.end(); ++clusIter )
      output << padding << "cluster: " << iClu++ << ", member: " << (*clusIter)->getStackMember() << ", cluster size: " << (*clusIter)->getHits().size() << '\n';
    return output.str();
  }
template<typename T >
void L1TkStub< T >::setDetId ( DetId  aDetId)

Definition at line 164 of file L1TkStub.h.

{ theDetId = aDetId; }
template<typename T >
void L1TkStub< T >::setTriggerDisplacement ( int  aDisplacement)

In FULL-STRIP units!

Definition at line 171 of file L1TkStub.h.

Referenced by L1TkStubBuilder< T >::produce().

{ theDisplacement = aDisplacement; }
template<typename T >
void L1TkStub< T >::setTriggerOffset ( int  anOffset)

In FULL-STRIP units!

Definition at line 177 of file L1TkStub.h.

Referenced by L1TkStubBuilder< T >::produce().

{ theOffset = anOffset; }

Member Data Documentation

template<typename T>
std::vector< edm::Ptr< L1TkCluster< T > > > L1TkStub< T >::theClusters [private]

Definition at line 87 of file L1TkStub.h.

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

Data members.

Definition at line 86 of file L1TkStub.h.

template<typename T>
int L1TkStub< T >::theDisplacement [private]

Definition at line 89 of file L1TkStub.h.

template<typename T>
int L1TkStub< T >::theOffset [private]

Definition at line 90 of file L1TkStub.h.

template<typename T>
edm::Ptr< SimTrack > L1TkStub< T >::theSimTrack [private]

Definition at line 88 of file L1TkStub.h.