CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TTClusterAssociationMap< T > Class Template Reference

NOTE: this is needed even if it seems not. More...

#include <TTClusterAssociationMap.h>

Public Member Functions

edm::Ptr< TrackingParticlefindTrackingParticlePtr (edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
 
std::vector< edm::Ptr< TrackingParticle > > findTrackingParticlePtrs (edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
 Operations. More...
 
std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > findTTClusterRefs (edm::Ptr< TrackingParticle > aTrackingParticle) const
 Operations. More...
 
std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > > getTrackingParticleToTTClustersMap () const
 
std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > getTTClusterToTrackingParticlesMap () const
 Maps. More...
 
bool isCombinatoric (edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
 
bool isGenuine (edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
 MC Truth methods. More...
 
bool isUnknown (edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
 
void setTrackingParticleToTTClustersMap (std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > > aMap)
 
void setTTClusterToTrackingParticlesMap (std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > aMap)
 
 TTClusterAssociationMap ()
 Constructors. More...
 
 ~TTClusterAssociationMap ()
 Destructor. More...
 

Private Attributes

std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > clusterToTrackingParticleVectorMap
 Data members. More...
 
int nclus
 
std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > > trackingParticleToClusterVectorMap
 

Detailed Description

template<typename T>
class TTClusterAssociationMap< T >

NOTE: this is needed even if it seems not.

Class to store the MC truth of L1 Track Trigger clusters.

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
Date
2013, Jul 19

Definition at line 33 of file TTClusterAssociationMap.h.

Constructor & Destructor Documentation

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

Constructors.

Close class.

Implementation of methods

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

Set default data members

Definition at line 98 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::clusterToTrackingParticleVectorMap, TTClusterAssociationMap< T >::nclus, and TTClusterAssociationMap< T >::trackingParticleToClusterVectorMap.

98  {
102  nclus = 0;
103 }
std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > clusterToTrackingParticleVectorMap
Data members.
std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > > trackingParticleToClusterVectorMap
template<typename T >
TTClusterAssociationMap< T >::~TTClusterAssociationMap ( )

Destructor.

Definition at line 107 of file TTClusterAssociationMap.h.

107 {}

Member Function Documentation

template<typename T >
edm::Ptr< TrackingParticle > TTClusterAssociationMap< T >::findTrackingParticlePtr ( edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >  aCluster) const

Definition at line 299 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::findTrackingParticlePtrs(), TTClusterAssociationMap< T >::isGenuine(), and groupFilesInBlocks::temp.

Referenced by TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap().

300  {
301  if (this->isGenuine(aCluster)) {
302  return this->findTrackingParticlePtrs(aCluster).at(0);
303  }
304 
306  return *temp;
307 }
bool isGenuine(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
MC Truth methods.
std::vector< edm::Ptr< TrackingParticle > > findTrackingParticlePtrs(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
Operations.
template<typename T >
std::vector< edm::Ptr< TrackingParticle > > TTClusterAssociationMap< T >::findTrackingParticlePtrs ( edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >  aCluster) const

Operations.

Definition at line 123 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::clusterToTrackingParticleVectorMap.

Referenced by TTClusterAssociationMap< T >::findTrackingParticlePtr(), TTClusterAssociationMap< T >::isCombinatoric(), TTClusterAssociationMap< T >::isGenuine(), TTClusterAssociationMap< T >::isUnknown(), and TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap().

124  {
126  return clusterToTrackingParticleVectorMap.find(aCluster)->second;
127  }
128 
129  std::vector<edm::Ptr<TrackingParticle> > tempVector;
130  tempVector.clear();
131  return tempVector;
132 }
std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > clusterToTrackingParticleVectorMap
Data members.
template<typename T >
std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > TTClusterAssociationMap< T >::findTTClusterRefs ( edm::Ptr< TrackingParticle aTrackingParticle) const

Operations.

Definition at line 112 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::trackingParticleToClusterVectorMap.

Referenced by TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap().

112  {
113  if (trackingParticleToClusterVectorMap.find(aTrackingParticle) != trackingParticleToClusterVectorMap.end()) {
114  return trackingParticleToClusterVectorMap.find(aTrackingParticle)->second;
115  }
116 
117  std::vector<edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > > tempVector;
118  tempVector.clear();
119  return tempVector;
120 }
std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > > trackingParticleToClusterVectorMap
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
template<typename T>
std::map<edm::Ptr<TrackingParticle>, std::vector<edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > > > TTClusterAssociationMap< T >::getTrackingParticleToTTClustersMap ( ) const
inline

Definition at line 50 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::trackingParticleToClusterVectorMap.

50  {
52  }
std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > > trackingParticleToClusterVectorMap
template<typename T>
std::map<edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >, std::vector<edm::Ptr<TrackingParticle> > > TTClusterAssociationMap< T >::getTTClusterToTrackingParticlesMap ( ) const
inline

Maps.

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

Definition at line 46 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::clusterToTrackingParticleVectorMap.

46  {
48  }
std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > clusterToTrackingParticleVectorMap
Data members.
template<typename T >
bool TTClusterAssociationMap< T >::isCombinatoric ( edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >  aCluster) const

Get the TrackingParticles

If the vector is empty, then the cluster is UNKNOWN

If we are here, it means there are some TrackingParticles

Loop over the TrackingParticles

Get the TrackingParticle

Count the NULL TrackingParticles

Store the pointers (addresses) of the TrackingParticle to be able to count how many different there are

Count how many different TrackingParticle there are

COMBINATORIC means no NULLs and more than one good TP OR, in alternative, only one good TP but non-zero NULLS

Definition at line 250 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::findTrackingParticlePtrs(), edm::Ptr< T >::get(), TTClusterAssociationMap< T >::isGenuine(), edm::Ptr< T >::isNull(), TTClusterAssociationMap< T >::isUnknown(), and tier0::unique().

Referenced by TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap().

251  {
253  std::vector<edm::Ptr<TrackingParticle> > theseTrackingParticles = this->findTrackingParticlePtrs(aCluster);
254 
256  if (theseTrackingParticles.empty())
257  return false;
258 
259  bool genuineClu = this->isGenuine(aCluster);
260  bool unknownClu = this->isUnknown(aCluster);
261 
262  if (genuineClu || unknownClu)
263  return false;
264 
265  return true;
266 
268  unsigned int nullTPs = 0;
269  unsigned int goodDifferentTPs = 0;
270  std::vector<const TrackingParticle*> tpAddressVector;
271 
273  for (unsigned int itp = 0; itp < theseTrackingParticles.size(); itp++) {
275  edm::Ptr<TrackingParticle> curTP = theseTrackingParticles.at(itp);
276 
278  if (curTP.isNull()) {
279  nullTPs++;
280  } else {
283  tpAddressVector.push_back(curTP.get());
284  }
285  }
286 
288  std::sort(tpAddressVector.begin(), tpAddressVector.end());
289  tpAddressVector.erase(std::unique(tpAddressVector.begin(), tpAddressVector.end()), tpAddressVector.end());
290  goodDifferentTPs = tpAddressVector.size();
291 
294  //return ( ( nullTPs == 0 && goodDifferentTPs > 1 ) || ( nullTPs > 0 && goodDifferentTPs > 0 ) );
295  return (goodDifferentTPs > 1);
296 }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
bool isGenuine(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
MC Truth methods.
std::vector< edm::Ptr< TrackingParticle > > findTrackingParticlePtrs(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
Operations.
def unique(seq, keepstr=True)
Definition: tier0.py:24
bool isNull() const
Checks for null.
Definition: Ptr.h:142
bool isUnknown(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
template<typename T >
bool TTClusterAssociationMap< T >::isGenuine ( edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >  aCluster) const

MC Truth methods.

MC truth Table to define Genuine, Combinatoric and Unknown

N = number of NULL TP pointers D = number of GOOD TP pointers different from each other

N / D–> | 0 | 1 | >1

0 | U | G | C

>0 | U | C | CNEW SV 060617

N / D–> | 0 | 1 | >1 (with 1 TP getting >99 of the total pT) | >1

0 | U | G | G | C

>0 | U | G | G | C

Get the TrackingParticles

If the vector is empty, then the cluster is UNKNOWN

If we are here, it means there are some TrackingParticles

Loop over the TrackingParticles

Get the TrackingParticle

Count the NULL TrackingParticles

Get the TrackingParticle

Count the NULL TrackingParticles

Store the pointers (addresses) of the TrackingParticle to be able to count how many different there are

Count how many different TrackingParticle there are

Definition at line 157 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::findTrackingParticlePtrs(), edm::Ptr< T >::get(), edm::Ptr< T >::isNull(), TrackingParticle::p4(), and tier0::unique().

Referenced by TTClusterAssociationMap< T >::findTrackingParticlePtr(), TTClusterAssociationMap< T >::isCombinatoric(), and TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap().

157  {
159  std::vector<edm::Ptr<TrackingParticle> > theseTrackingParticles = this->findTrackingParticlePtrs(aCluster);
160 
162  if (theseTrackingParticles.empty())
163  return false;
164 
166  unsigned int nullTPs = 0;
167  unsigned int goodDifferentTPs = 0;
168  std::vector<const TrackingParticle*> tpAddressVector;
169 
170  std::vector<float> tp_mom;
171 
172  float tp_tot = 0;
173 
175  for (const auto& tp : theseTrackingParticles) {
177  const edm::Ptr<TrackingParticle>& curTP = tp;
178 
180  if (curTP.isNull()) {
181  // nullTPs++;
182  tp_mom.push_back(0);
183  } else {
184  tp_mom.push_back(curTP.get()->p4().pt());
185  tp_tot += curTP.get()->p4().pt();
186  }
187  }
188 
189  if (tp_tot == 0)
190  return false;
191 
192  for (unsigned int itp = 0; itp < theseTrackingParticles.size(); itp++) {
194  edm::Ptr<TrackingParticle> curTP = theseTrackingParticles.at(itp);
195 
197  if (tp_mom.at(itp) <= 0.01 * tp_tot) {
198  nullTPs++;
199  } else {
202  tpAddressVector.push_back(curTP.get());
203  }
204  }
205 
207  std::sort(tpAddressVector.begin(), tpAddressVector.end());
208  tpAddressVector.erase(std::unique(tpAddressVector.begin(), tpAddressVector.end()), tpAddressVector.end());
209  goodDifferentTPs = tpAddressVector.size();
210 
211  return (goodDifferentTPs == 1);
212 }
const LorentzVector & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
std::vector< edm::Ptr< TrackingParticle > > findTrackingParticlePtrs(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
Operations.
def unique(seq, keepstr=True)
Definition: tier0.py:24
bool isNull() const
Checks for null.
Definition: Ptr.h:142
template<typename T >
bool TTClusterAssociationMap< T >::isUnknown ( edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >  aCluster) const

Get the TrackingParticles

If the vector is empty, then the cluster is UNKNOWN

If we are here, it means there are some TrackingParticles

Loop over the TrackingParticles

Get the TrackingParticle

Count the non-NULL TrackingParticles

Store the pointers (addresses) of the TrackingParticle to be able to count how many different there are

Count how many different TrackingParticle there are

UNKNOWN means no good TP is found

Definition at line 215 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::findTrackingParticlePtrs(), edm::Ptr< T >::get(), edm::Ptr< T >::isNull(), and tier0::unique().

Referenced by TTClusterAssociationMap< T >::isCombinatoric(), TTStubAssociationMap< T >::isUnknown(), and TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap().

215  {
217  std::vector<edm::Ptr<TrackingParticle> > theseTrackingParticles = this->findTrackingParticlePtrs(aCluster);
218 
220  if (theseTrackingParticles.empty())
221  return true;
222 
224  unsigned int goodDifferentTPs = 0;
225  std::vector<const TrackingParticle*> tpAddressVector;
226 
228  for (unsigned int itp = 0; itp < theseTrackingParticles.size(); itp++) {
230  edm::Ptr<TrackingParticle> curTP = theseTrackingParticles.at(itp);
231 
233  if (!curTP.isNull()) {
236  tpAddressVector.push_back(curTP.get());
237  }
238  }
239 
241  std::sort(tpAddressVector.begin(), tpAddressVector.end());
242  tpAddressVector.erase(std::unique(tpAddressVector.begin(), tpAddressVector.end()), tpAddressVector.end());
243  goodDifferentTPs = tpAddressVector.size();
244 
246  return (goodDifferentTPs == 0);
247 }
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
std::vector< edm::Ptr< TrackingParticle > > findTrackingParticlePtrs(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aCluster) const
Operations.
def unique(seq, keepstr=True)
Definition: tier0.py:24
bool isNull() const
Checks for null.
Definition: Ptr.h:142
template<typename T>
void TTClusterAssociationMap< T >::setTrackingParticleToTTClustersMap ( std::map< edm::Ptr< TrackingParticle >, std::vector< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > > >  aMap)
inline
template<typename T>
void TTClusterAssociationMap< T >::setTTClusterToTrackingParticlesMap ( std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > >  aMap)
inline

Definition at line 54 of file TTClusterAssociationMap.h.

References TTClusterAssociationMap< T >::clusterToTrackingParticleVectorMap.

55  {
57  }
std::map< edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >, std::vector< edm::Ptr< TrackingParticle > > > clusterToTrackingParticleVectorMap
Data members.

Member Data Documentation

template<typename T>
std::map<edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >, std::vector<edm::Ptr<TrackingParticle> > > TTClusterAssociationMap< T >::clusterToTrackingParticleVectorMap
private
template<typename T>
int TTClusterAssociationMap< T >::nclus
private
template<typename T>
std::map<edm::Ptr<TrackingParticle>, std::vector<edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > > > TTClusterAssociationMap< T >::trackingParticleToClusterVectorMap
private