CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
PileUpEventPrincipal Class Reference

#include <PileUpEventPrincipal.h>

Public Member Functions

bool addLabel (edm::TypeID const &type, std::string const &label) const
 
template<>
void adjust (SimTrack &item) const
 
template<>
void adjust (SimVertex &item) const
 
template<>
void adjust (PSimHit &item) const
 
template<>
void adjust (PCaloHit &item) const
 
template<typename T >
void adjust (T &item) const
 
template<>
void adjust (PCaloHit &item) const
 
template<>
void adjust (PSimHit &item) const
 
template<>
void adjust (SimTrack &item) const
 
template<>
void adjust (SimVertex &item) const
 
int bunchCrossing () const
 
template<typename T >
bool getByLabel (edm::InputTag const &tag, edm::Handle< T > &result) const
 
 PileUpEventPrincipal (edm::EventPrincipal const &ep, int bcr, int bsp, int eventId, int vtxOffset)
 
edm::EventPrincipal const & principal ()
 
edm::EventPrincipal const & principal () const
 

Private Attributes

int bunchCrossing_
 
int bunchCrossingXbunchSpace_
 
EncodedEventId id_
 
std::set< std::pair
< edm::TypeID, std::string > > 
labels_
 
edm::EventPrincipal const & principal_
 
int vertexOffset_
 

Detailed Description

Definition at line 19 of file PileUpEventPrincipal.h.

Constructor & Destructor Documentation

PileUpEventPrincipal::PileUpEventPrincipal ( edm::EventPrincipal const &  ep,
int  bcr,
int  bsp,
int  eventId,
int  vtxOffset 
)
inline

Definition at line 22 of file PileUpEventPrincipal.h.

22  :
23  principal_(ep), bunchCrossing_(bcr), bunchCrossingXbunchSpace_(bcr*bsp), id_(bcr, eventId), vertexOffset_(vtxOffset), labels_() {}
std::set< std::pair< edm::TypeID, std::string > > labels_
edm::EventPrincipal const & principal_

Member Function Documentation

bool PileUpEventPrincipal::addLabel ( edm::TypeID const &  type,
std::string const &  label 
) const
inline

Definition at line 26 of file PileUpEventPrincipal.h.

Referenced by getByLabel().

26  {
27  return true;
28  //return labels_.insert(std::make_pair(type, label)).second;
29  }
template<>
void PileUpEventPrincipal::adjust ( SimTrack item) const

Definition at line 9 of file PileUpEventPrincipal.cc.

9  {
10  item.setEventId(id_);
11  if(!item.noVertex()) {
12  item.setVertexIndex(item.vertIndex() + vertexOffset_);
13  }
14 }
void setEventId(EncodedEventId e)
Definition: CoreSimTrack.h:45
bool noVertex() const
Definition: SimTrack.h:30
void setVertexIndex(const int v)
Definition: SimTrack.h:44
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:29
template<>
void PileUpEventPrincipal::adjust ( SimVertex item) const

Definition at line 17 of file PileUpEventPrincipal.cc.

17  {
18  item.setEventId(id_);
19  item.setTof(item.position().t() + bunchCrossingXbunchSpace_);
20 }
const math::XYZTLorentzVectorD & position() const
Definition: CoreSimVertex.h:26
void setEventId(EncodedEventId e)
Definition: CoreSimVertex.h:28
void setTof(float tof)
Definition: CoreSimVertex.h:32
template<>
void PileUpEventPrincipal::adjust ( PSimHit item) const

Definition at line 23 of file PileUpEventPrincipal.cc.

23  {
24  item.setEventId(id_);
26 }
float timeOfFlight() const
Definition: PSimHit.h:69
void setTof(float tof)
Definition: PSimHit.h:121
void setEventId(EncodedEventId e)
Definition: PSimHit.h:108
template<>
void PileUpEventPrincipal::adjust ( PCaloHit item) const

Definition at line 29 of file PileUpEventPrincipal.cc.

29  {
30  item.setEventId(id_);
31  item.setTime(item.time() + bunchCrossingXbunchSpace_);
32 }
double time() const
Definition: PCaloHit.h:34
void setEventId(EncodedEventId e)
Definition: PCaloHit.h:51
void setTime(float t)
Definition: PCaloHit.h:55
template<typename T >
void PileUpEventPrincipal::adjust ( T item) const
inline

Definition at line 45 of file PileUpEventPrincipal.h.

45  {
46  }
template<>
void PileUpEventPrincipal::adjust ( PCaloHit item) const
template<>
void PileUpEventPrincipal::adjust ( PSimHit item) const
template<>
void PileUpEventPrincipal::adjust ( SimTrack item) const
template<>
void PileUpEventPrincipal::adjust ( SimVertex item) const
int PileUpEventPrincipal::bunchCrossing ( ) const
inline
template<typename T >
bool PileUpEventPrincipal::getByLabel ( edm::InputTag const &  tag,
edm::Handle< T > &  result 
) const
inline

Definition at line 50 of file PileUpEventPrincipal.h.

References addLabel(), edm::convert_handle(), edm::Principal::getByLabel(), i, edm::HandleBase::isValid(), edm::InputTag::label(), principal_, edm::Handle< T >::product(), and edm::PRODUCT_TYPE.

Referenced by HcalTBDigiProducer::accumulate(), CastorDigiProducer::accumulate(), HcalDigitizer::accumulate(), RecoTrackAccumulator::accumulate(), SiStripDigitizer::accumulate(), cms::SiPixelDigitizer::accumulate(), and EcalDigiProducer::accumulate().

50  {
51  typedef typename T::value_type ItemType;
52  typedef typename T::iterator iterator;
54  convert_handle(bh, result);
55  if(result.isValid() && addLabel(edm::TypeID(typeid(T)), tag.label())) {
56  T& product = const_cast<T&>(*result.product());
57  for(iterator i = product.begin(), iEnd = product.end(); i != iEnd; ++i) {
58  adjust<ItemType>(*i);
59  }
60  }
61  return result.isValid();
62  }
int i
Definition: DBlmapReader.cc:9
bool addLabel(edm::TypeID const &type, std::string const &label) const
edm::EventPrincipal const & principal_
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag) const
Definition: Principal.cc:421
bool isValid() const
Definition: HandleBase.h:76
Container::value_type value_type
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
T const * product() const
Definition: Handle.h:74
long double T
edm::EventPrincipal const& PileUpEventPrincipal::principal ( )
inline

Definition at line 31 of file PileUpEventPrincipal.h.

References principal_.

31  {
32  return principal_;
33  }
edm::EventPrincipal const & principal_
edm::EventPrincipal const& PileUpEventPrincipal::principal ( ) const
inline

Definition at line 35 of file PileUpEventPrincipal.h.

References principal_.

35  {
36  return principal_;
37  }
edm::EventPrincipal const & principal_

Member Data Documentation

int PileUpEventPrincipal::bunchCrossing_
private

Definition at line 66 of file PileUpEventPrincipal.h.

Referenced by bunchCrossing().

int PileUpEventPrincipal::bunchCrossingXbunchSpace_
private

Definition at line 67 of file PileUpEventPrincipal.h.

EncodedEventId PileUpEventPrincipal::id_
private

Definition at line 68 of file PileUpEventPrincipal.h.

std::set<std::pair<edm::TypeID, std::string> > PileUpEventPrincipal::labels_
mutableprivate

Definition at line 70 of file PileUpEventPrincipal.h.

edm::EventPrincipal const& PileUpEventPrincipal::principal_
private

Definition at line 65 of file PileUpEventPrincipal.h.

Referenced by getByLabel(), and principal().

int PileUpEventPrincipal::vertexOffset_
private

Definition at line 69 of file PileUpEventPrincipal.h.