#include <PileUpEventPrincipal.h>
Public Member Functions | |
bool | addLabel (edm::TypeID const &type, std::string const &label) const |
template<> | |
void | adjust (PCaloHit &item) const |
template<> | |
void | adjust (PCaloHit &item) const |
template<> | |
void | adjust (SimVertex &item) const |
template<> | |
void | adjust (PSimHit &item) const |
template<> | |
void | adjust (SimTrack &item) const |
template<> | |
void | adjust (SimVertex &item) const |
template<typename T > | |
void | adjust (T &item) const |
template<> | |
void | adjust (SimTrack &item) const |
template<> | |
void | adjust (PSimHit &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 () const |
edm::EventPrincipal const & | principal () |
Private Attributes | |
int | bunchCrossing_ |
int | bunchCrossingXbunchSpace_ |
EncodedEventId | id_ |
std::set< std::pair < edm::TypeID, std::string > > | labels_ |
edm::EventPrincipal const & | principal_ |
int | vertexOffset_ |
Definition at line 18 of file PileUpEventPrincipal.h.
PileUpEventPrincipal::PileUpEventPrincipal | ( | edm::EventPrincipal const & | ep, |
int | bcr, | ||
int | bsp, | ||
int | eventId, | ||
int | vtxOffset | ||
) | [inline] |
Definition at line 21 of file PileUpEventPrincipal.h.
: principal_(ep), bunchCrossing_(bcr), bunchCrossingXbunchSpace_(bcr*bsp), id_(bcr, eventId), vertexOffset_(vtxOffset), labels_() {}
bool PileUpEventPrincipal::addLabel | ( | edm::TypeID const & | type, |
std::string const & | label | ||
) | const [inline] |
Definition at line 25 of file PileUpEventPrincipal.h.
Referenced by getByLabel().
{ return true; //return labels_.insert(std::make_pair(type, label)).second; }
void PileUpEventPrincipal::adjust | ( | T & | item | ) | const [inline] |
Definition at line 44 of file PileUpEventPrincipal.h.
{ }
void PileUpEventPrincipal::adjust | ( | PSimHit & | item | ) | const |
Definition at line 23 of file PileUpEventPrincipal.cc.
{ item.setEventId(id_); item.setTof(item.timeOfFlight() + bunchCrossingXbunchSpace_); }
void PileUpEventPrincipal::adjust | ( | PSimHit & | item | ) | const |
void PileUpEventPrincipal::adjust | ( | SimTrack & | item | ) | const |
Definition at line 9 of file PileUpEventPrincipal.cc.
{ item.setEventId(id_); if(!item.noVertex()) { item.setVertexIndex(item.vertIndex() + vertexOffset_); } }
void PileUpEventPrincipal::adjust | ( | SimTrack & | item | ) | const |
void PileUpEventPrincipal::adjust | ( | SimVertex & | item | ) | const |
void PileUpEventPrincipal::adjust | ( | PCaloHit & | item | ) | const |
void PileUpEventPrincipal::adjust | ( | PCaloHit & | item | ) | const |
Definition at line 29 of file PileUpEventPrincipal.cc.
{ item.setEventId(id_); item.setTime(item.time() + bunchCrossingXbunchSpace_); }
void PileUpEventPrincipal::adjust | ( | SimVertex & | item | ) | const |
Definition at line 17 of file PileUpEventPrincipal.cc.
{ item.setEventId(id_); item.setTof(item.position().t() + bunchCrossingXbunchSpace_); }
int PileUpEventPrincipal::bunchCrossing | ( | ) | const [inline] |
Definition at line 38 of file PileUpEventPrincipal.h.
References bunchCrossing_.
Referenced by HcalDigitizer::accumulate(), EcalDigiProducer::accumulate(), HcalTBDigiProducer::accumulate(), and CastorDigiProducer::accumulate().
{ return bunchCrossing_; }
bool PileUpEventPrincipal::getByLabel | ( | edm::InputTag const & | tag, |
edm::Handle< T > & | result | ||
) | const [inline] |
Definition at line 49 of file PileUpEventPrincipal.h.
References addLabel(), edm::InputTag::cachedOffset(), edm::convert_handle(), edm::InputTag::fillCount(), edm::Principal::getByLabel(), i, edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), principal_, edm::InputTag::process(), and edm::Handle< T >::product().
Referenced by cms::SiPixelDigitizer::accumulate(), HcalDigitizer::accumulate(), EcalDigiProducer::accumulate(), CastorDigiProducer::accumulate(), HcalTBDigiProducer::accumulate(), and SiStripDigitizer::accumulate().
{ typedef typename T::value_type ItemType; typedef typename T::iterator iterator; edm::BasicHandle bh = principal_.getByLabel(edm::TypeID(typeid(T)), tag.label(), tag.instance(), tag.process(), tag.cachedOffset(), tag.fillCount()); convert_handle(bh, result); if(result.isValid() && addLabel(edm::TypeID(typeid(T)), tag.label())) { T& product = const_cast<T&>(*result.product()); for(iterator i = product.begin(), iEnd = product.end(); i != iEnd; ++i) { adjust<ItemType>(*i); } } return result.isValid(); }
edm::EventPrincipal const& PileUpEventPrincipal::principal | ( | ) | [inline] |
edm::EventPrincipal const& PileUpEventPrincipal::principal | ( | ) | const [inline] |
int PileUpEventPrincipal::bunchCrossing_ [private] |
Definition at line 65 of file PileUpEventPrincipal.h.
Referenced by bunchCrossing().
int PileUpEventPrincipal::bunchCrossingXbunchSpace_ [private] |
Definition at line 66 of file PileUpEventPrincipal.h.
EncodedEventId PileUpEventPrincipal::id_ [private] |
Definition at line 67 of file PileUpEventPrincipal.h.
std::set<std::pair<edm::TypeID, std::string> > PileUpEventPrincipal::labels_ [mutable, private] |
Definition at line 69 of file PileUpEventPrincipal.h.
edm::EventPrincipal const& PileUpEventPrincipal::principal_ [private] |
Definition at line 64 of file PileUpEventPrincipal.h.
Referenced by getByLabel(), and principal().
int PileUpEventPrincipal::vertexOffset_ [private] |
Definition at line 68 of file PileUpEventPrincipal.h.