CMS 3D CMS Logo

Public Member Functions | Private Attributes

PileUpEventPrincipal Class Reference

#include <PileUpEventPrincipal.h>

List of all members.

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_

Detailed Description

Definition at line 18 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 21 of file PileUpEventPrincipal.h.

                                                                                                  :
    principal_(ep), bunchCrossing_(bcr), bunchCrossingXbunchSpace_(bcr*bsp), id_(bcr, eventId), vertexOffset_(vtxOffset), labels_() {}

Member Function Documentation

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;
  }
template<typename T >
void PileUpEventPrincipal::adjust ( T item) const [inline]

Definition at line 44 of file PileUpEventPrincipal.h.

                        {
  }
template<>
void PileUpEventPrincipal::adjust ( PSimHit item) const

Definition at line 23 of file PileUpEventPrincipal.cc.

template<>
void PileUpEventPrincipal::adjust ( PSimHit item) const
template<>
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_);
  }
}
template<>
void PileUpEventPrincipal::adjust ( SimTrack item) const
template<>
void PileUpEventPrincipal::adjust ( SimVertex item) const
template<>
void PileUpEventPrincipal::adjust ( PCaloHit item) const
template<>
void PileUpEventPrincipal::adjust ( PCaloHit item) const

Definition at line 29 of file PileUpEventPrincipal.cc.

                                                                {
  item.setEventId(id_);
  item.setTime(item.time() + bunchCrossingXbunchSpace_);
}
template<>
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]
template<typename T >
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]

Definition at line 30 of file PileUpEventPrincipal.h.

References principal_.

                                       {
    return principal_;
  }
edm::EventPrincipal const& PileUpEventPrincipal::principal ( ) const [inline]

Definition at line 34 of file PileUpEventPrincipal.h.

References principal_.

                                             {
    return principal_;
  }

Member Data Documentation

Definition at line 65 of file PileUpEventPrincipal.h.

Referenced by bunchCrossing().

Definition at line 66 of file PileUpEventPrincipal.h.

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.

Definition at line 64 of file PileUpEventPrincipal.h.

Referenced by getByLabel(), and principal().

Definition at line 68 of file PileUpEventPrincipal.h.