Skip to content

Commit

Permalink
Merge pull request #1492 from davidlange6/pr1264plusFixes
Browse files Browse the repository at this point in the history
Pr1264plus fixes
  • Loading branch information
nclopezo committed Nov 18, 2013
2 parents 1430ae3 + be91428 commit 611d9f9
Show file tree
Hide file tree
Showing 127 changed files with 16,832 additions and 367 deletions.
13 changes: 13 additions & 0 deletions DataFormats/L1TrackTrigger/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<flags GENREFLEX_ARGS="--"/>
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/Math"/>
<use name="DataFormats/SiPixelDetId"/>
<use name="boost"/>
<use name="rootrflx"/>
<use name="clhep"/>
<export>
<lib name="1"/>
</export>

142 changes: 142 additions & 0 deletions DataFormats/L1TrackTrigger/interface/TTCluster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*! \class TTCluster
* \brief Class to store the L1 Track Trigger clusters
* \details After moving from SimDataFormats to DataFormats,
* the template structure of the class was maintained
* in order to accomodate any types other than PixelDigis
* in case there is such a need in the future.
*
* \author Nicola Pozzobon
* \author Emmanuele Salvati
* \date 2013, Jul 12
*
*/

#ifndef L1_TRACK_TRIGGER_CLUSTER_FORMAT_H
#define L1_TRACK_TRIGGER_CLUSTER_FORMAT_H

#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/Common/interface/Ptr.h"
#include "DataFormats/Common/interface/DetSet.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h" /// NOTE: this is needed even if it seems not

template< typename T >
class TTCluster
{
public:
/// Constructors
TTCluster();
TTCluster( std::vector< T > aHits,
DetId aDetId,
unsigned int aStackMember );

/// Destructor
~TTCluster();

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

/// Hits in the Cluster
std::vector< T > getHits() const { return theHits; }
void setHits( std::vector< T > aHits ) { theHits = aHits; }

/// Detector element
DetId getDetId() const { return theDetId; }
void setDetId( DetId aDetId ) { theDetId = aDetId; }
unsigned int getStackMember() const { return theStackMember; }
void setStackMember( unsigned int aStackMember ) { theStackMember = aStackMember; }

/// Cluster width
unsigned int findWidth() const;

/// Single hit coordinates
/// Average cluster coordinates
MeasurementPoint findHitLocalCoordinates( unsigned int hitIdx ) const;
MeasurementPoint findAverageLocalCoordinates() const;

/// Information
std::string print( unsigned int i = 0 ) const;

private:
/// Data members
std::vector< T > theHits;
DetId theDetId;
unsigned int theStackMember;

}; /// Close class

/*! \brief Implementation of methods
* \details Here, in the header file, the methods which do not depend
* on the specific type <T> that can fit the template.
* Other methods, with type-specific features, are implemented
* in the source file.
*/

/// Default Constructor
/// NOTE: to be used with setSomething(...) methods
template< typename T >
TTCluster< T >::TTCluster()
{
/// Set default data members
theHits.clear();
theDetId = 0;
theStackMember = 0;
}

/// Another Constructor
template< typename T >
TTCluster< T >::TTCluster( std::vector< T > aHits,
DetId aDetId,
unsigned int aStackMember )
{
/// Set data members
this->setHits( aHits );
this->setDetId( aDetId );
this->setStackMember( aStackMember );
}

/// Destructor
template< typename T >
TTCluster< T >::~TTCluster(){}

/// Cluster width
template< >
unsigned int TTCluster< edm::Ref< edm::DetSetVector<PixelDigi> , PixelDigi > >::findWidth() const;

/// Single hit coordinates
/// Average cluster coordinates
template< >
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector<PixelDigi> , PixelDigi > >::findHitLocalCoordinates( unsigned int hitIdx ) const;

template< >
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector<PixelDigi> , PixelDigi > >::findAverageLocalCoordinates() const;

/// Information
template< typename T >
std::string TTCluster< T >::print( unsigned int i ) const
{
std::string padding("");
for ( unsigned int j = 0; j != i; ++j )
{
padding+="\t";
}

std::stringstream output;
output<<padding<<"TTCluster:\n";
padding+='\t';
output << padding << "DetId: " << theDetId.rawId() << '\n';
output << padding << "member: " << theStackMember << ", cluster size: " << theHits.size() << '\n';
return output.str();
}

template< typename T >
std::ostream& operator << ( std::ostream& os, const TTCluster< T >& aTTCluster )
{
return ( os << aTTCluster.print() );
}

#endif

178 changes: 178 additions & 0 deletions DataFormats/L1TrackTrigger/interface/TTStub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/*! \class TTStub
* \brief Class to store the L1 Track Trigger stubs
* \details After moving from SimDataFormats to DataFormats,
* the template structure of the class was maintained
* in order to accomodate any types other than PixelDigis
* in case there is such a need in the future.
*
* \author Andrew W. Rose
* \author Nicola Pozzobon
* \date 2013, Jul 12
*
*/

#ifndef L1_TRACK_TRIGGER_STUB_FORMAT_H
#define L1_TRACK_TRIGGER_STUB_FORMAT_H

#include "DataFormats/GeometryVector/interface/GlobalVector.h"
#include "DataFormats/L1TrackTrigger/interface/TTCluster.h"

template< typename T >
class TTStub
{
public:
/// Constructors
TTStub();
TTStub( DetId aDetId );

/// Destructor
~TTStub();

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

/// Clusters composing the Stub
std::vector< edm::Ptr< TTCluster< T > > > getClusterPtrs() const { return theClusters; }
const edm::Ptr< TTCluster< T > >& getClusterPtr( unsigned int hitIdentifier ) const;
void addClusterPtr( edm::Ptr< TTCluster< T > > aTTCluster ) { theClusters.push_back( aTTCluster ); }

/// Detector element
DetId getDetId() const { return theDetId; }
void setDetId( DetId aDetId ) { theDetId = aDetId; }

/// Trigger information
double getTriggerDisplacement() const; /// In FULL-STRIP units! (hence, not implemented herein)
void setTriggerDisplacement( int aDisplacement ); /// In HALF-STRIP units!
double getTriggerOffset() const; /// In FULL-STRIP units! (hence, not implemented herein)
void setTriggerOffset( int anOffset ); /// In HALF-STRIP units!

/// CBC3-style trigger information
/// for sake of simplicity, these methods are
/// slightly out of the getABC(...)/findABC(...) rule
double getTriggerPosition() const; /// In FULL-STRIP units!
double getTriggerBend() const; /// In FULL-STRIP units!

/// Information
std::string print( unsigned int i = 0 ) const;

private:
/// Data members
DetId theDetId;
std::vector< edm::Ptr< TTCluster< T > > > theClusters;
int theDisplacement;
int theOffset;

}; /// Close class

/*! \brief Implementation of methods
* \details Here, in the header file, the methods which do not depend
* on the specific type <T> that can fit the template.
* Other methods, with type-specific features, are implemented
* in the source file.
*/

/// Default Constructor
template< typename T >
TTStub< T >::TTStub()
{
/// Set default data members
theDetId = 0;
theClusters.clear();
theDisplacement = 999999;
theOffset = 0;
}

/// Another Constructor
template< typename T >
TTStub< T >::TTStub( DetId aDetId )
{
/// Set data members
this->setDetId( aDetId );

/// Set default data members
theClusters.clear();
theDisplacement = 999999;
theOffset = 0;
}

/// Destructor
template< typename T >
TTStub< T >::~TTStub(){}

/// Get the Pointer to a Cluster
template< typename T >
const edm::Ptr< TTCluster< T > >& TTStub< T >::getClusterPtr( unsigned int hitIdentifier ) const
{
/// Look for the TTCluster with the stack member corresponding to the argument
typename std::vector< edm::Ptr< TTCluster< T > > >::const_iterator clusIter;
for ( clusIter = theClusters.begin();
clusIter != theClusters.end();
++clusIter )
{
if ( (*clusIter)->getStackMember() == hitIdentifier )
{
return *clusIter;
}
}

/// In case no TTCluster is found, return a NULL edm::Ptr
/// (hopefully code doesn't reach this point)
edm::Ptr< TTCluster< T > >* tmpCluPtr = new edm::Ptr< TTCluster< T > >();
return *tmpCluPtr;
}

/// Trigger info
template< typename T >
double TTStub< T >::getTriggerDisplacement() const { return 0.5*theDisplacement; }

template< typename T >
void TTStub< T >::setTriggerDisplacement( int aDisplacement ) { theDisplacement = aDisplacement; }

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

template< typename T >
void TTStub< T >::setTriggerOffset( int anOffset ) { theOffset = anOffset; }

/// CBC3-style trigger info
template< typename T >
double TTStub< T >::getTriggerPosition() const
{
return this->getClusterPtr(0)->findAverageLocalCoordinates().x();
}

template< typename T >
double TTStub< T >::getTriggerBend() const { return 0.5*( theDisplacement - theOffset ); }

/// Information
template< typename T >
std::string TTStub< T >::print( unsigned int i ) const
{
std::string padding("");
for ( unsigned int j = 0; j != i; ++j )
{
padding+="\t";
}

std::stringstream output;
output<<padding<<"TTStub:\n";
padding+='\t';
output << padding << "DetId: " << theDetId.rawId() << '\n';
unsigned int iClu = 0;
typename std::vector< edm::Ptr< TTCluster< T > > >::const_iterator clusIter;
for ( clusIter = theClusters.begin();
clusIter!= theClusters.end();
++clusIter )
{
output << padding << "cluster: " << iClu++ << ", member: " << (*clusIter)->getStackMember();
output << ", cluster size: " << (*clusIter)->getHits().size() << '\n';
}

return output.str();
}

template< typename T >
std::ostream& operator << ( std::ostream& os, const TTStub< T >& aTTStub ) { return ( os << aTTStub.print() ); }

#endif

Loading

0 comments on commit 611d9f9

Please sign in to comment.