#include <SimDataFormats/CrossingFrame/interface/CrossingFrame.h>
Public Member Functions | |
template<> | |
void | addPileups (const int bcr, const std::vector< edm::HepMCProduct > *mcps, unsigned int evtNr, int vertexoffset, bool checkTof, bool high) |
template<> | |
void | addPileups (const int bcr, const std::vector< PCaloHit > *calohits, unsigned int evtNr, int vertexoffset, bool checkTof, bool high) |
template<> | |
void | addPileups (const int bcr, const std::vector< SimVertex > *simvertices, unsigned int evtNr, int vertexoffset, bool checkTof, bool high) |
template<> | |
void | addPileups (const int bcr, const std::vector< SimTrack > *simtracks, unsigned int evtNr, int vertexoffset, bool checkTof, bool high) |
void | addPileups (const int bcr, const std::vector< T > *vec, unsigned int evtId, int vertexoffset=0, bool checkTof=false, bool high=false) |
void | addSignals (const std::vector< T > *vec, edm::EventID id) |
CrossingFrame (int minb, int maxb, int bunchsp, std::string subdet, unsigned int maxNbSources) | |
CrossingFrame () | |
int | getBunchCrossing (unsigned int ip) const |
std::pair< int, int > | getBunchRange () const |
int | getBunchSpace () const |
edm::EventID | getEventID () const |
unsigned int | getNrPileups (int bcr) const |
unsigned int | getNrPileups () const |
unsigned int | getNrSignals () const |
const T & | getObject (unsigned int ip) const |
void | getPileups (typename std::vector< T >::const_iterator &first, typename std::vector< T >::const_iterator &last) const |
void | getSignal (typename std::vector< T >::const_iterator &first, typename std::vector< T >::const_iterator &last) const |
int | getSourceType (unsigned int ip) const |
CrossingFrame & | operator= (CrossingFrame const &rhs) |
void | print (int level=0) const |
void | setBcrOffset () |
void | setSourceOffset (const unsigned int s) |
void | swap (CrossingFrame &other) |
~CrossingFrame () | |
Static Public Attributes | |
static const int | highTrackTof |
static const int | limHighLowTof |
static const int | lowTrackTof |
static const int | minLowTof |
Private Attributes | |
int | bunchSpace_ |
int | firstCrossing_ |
edm::EventID | id_ |
edm::EventID | idFirstPileup_ |
int | lastCrossing_ |
unsigned int | maxNbSources_ |
unsigned int | pileupFileNr_ |
std::vector< unsigned int > | pileupOffsetsBcr_ |
std::vector< std::vector < unsigned int > > | pileupOffsetsSource_ |
std::vector< T > | pileups_ |
std::vector< T > | signals_ |
std::string | subdet_ |
Definition at line 26 of file CrossingFrame.h.
CrossingFrame< T >::CrossingFrame | ( | ) | [inline] |
Definition at line 32 of file CrossingFrame.h.
00032 : firstCrossing_(0), lastCrossing_(0), bunchSpace_(75),subdet_(""),maxNbSources_(0) {;}
CrossingFrame< T >::CrossingFrame | ( | int | minb, | |
int | maxb, | |||
int | bunchsp, | |||
std::string | subdet, | |||
unsigned int | maxNbSources | |||
) | [inline] |
Definition at line 117 of file CrossingFrame.h.
References CrossingFrame< T >::firstCrossing_, i, CrossingFrame< T >::lastCrossing_, CrossingFrame< T >::maxNbSources_, CrossingFrame< T >::pileupOffsetsBcr_, and CrossingFrame< T >::pileupOffsetsSource_.
00117 :firstCrossing_(minb), lastCrossing_(maxb), bunchSpace_(bunchsp),subdet_(subdet),maxNbSources_(maxNbSources) { 00118 pileupOffsetsSource_.resize(maxNbSources_); 00119 for (unsigned int i=0;i<maxNbSources_;++i) 00120 pileupOffsetsSource_[i].reserve(-firstCrossing_+lastCrossing_+1); 00121 00122 //FIXME: should we force around 0 or so?? 00123 pileupOffsetsBcr_.reserve(-firstCrossing_+lastCrossing_+1); 00124 }
CrossingFrame< T >::~CrossingFrame | ( | ) | [inline] |
void CrossingFrame< edm::HepMCProduct >::addPileups | ( | const int | bcr, | |
const std::vector< edm::HepMCProduct > * | mcps, | |||
unsigned int | evtNr, | |||
int | vertexoffset, | |||
bool | checkTof, | |||
bool | high | |||
) | [inline] |
Definition at line 91 of file CrossingFrame.cc.
References i, and CrossingFrame< T >::pileups_.
00091 { 00092 for (unsigned int i=0;i<mcps->size();++i) { 00093 pileups_.push_back((*mcps)[i]); 00094 } 00095 }
void CrossingFrame< PCaloHit >::addPileups | ( | const int | bcr, | |
const std::vector< PCaloHit > * | calohits, | |||
unsigned int | evtNr, | |||
int | vertexoffset, | |||
bool | checkTof, | |||
bool | high | |||
) | [inline] |
Definition at line 80 of file CrossingFrame.cc.
References CrossingFrame< T >::bunchSpace_, i, id, CrossingFrame< T >::pileups_, and PCaloHit::setEventId().
00080 { 00081 00082 EncodedEventId id(bcr,evtNr); 00083 for (unsigned int i=0;i<calohits->size();++i) { 00084 PCaloHit hit((*calohits)[i].id(),(*calohits)[i].energyEM(),(*calohits)[i].energyHad(),(*calohits)[i].time()+bcr*bunchSpace_,(*calohits)[i].geantTrackId()); 00085 hit.setEventId(id); 00086 pileups_.push_back(hit); 00087 } 00088 }
void CrossingFrame< SimVertex >::addPileups | ( | const int | bcr, | |
const std::vector< SimVertex > * | simvertices, | |||
unsigned int | evtNr, | |||
int | vertexoffset, | |||
bool | checkTof, | |||
bool | high | |||
) | [inline] |
Definition at line 37 of file CrossingFrame.cc.
References CrossingFrame< T >::bunchSpace_, i, id, CrossingFrame< T >::pileups_, CoreSimVertex::setEventId(), t, x, y, and z.
00037 { 00038 00039 EncodedEventId id(bcr,evtNr); 00040 for (unsigned int i=0;i<simvertices->size();++i) { 00041 SimVertex vertex(math::XYZVectorD( (*simvertices)[i].position().x(), 00042 (*simvertices)[i].position().y(), 00043 (*simvertices)[i].position().z() ), 00044 ((*simvertices)[i].position()).t()+bcr*bunchSpace_, 00045 (*simvertices)[i].parentIndex()); 00046 00047 // SimVertex vertex((*simvertices)[i].position(),((*simvertices)[i].position())[3]+bcr*bunchSpace_,(*simvertices)[i].parentIndex()); 00048 vertex.setEventId(EncodedEventId(bcr,evtNr)); 00049 pileups_.push_back(vertex); 00050 } 00051 }
void CrossingFrame< SimTrack >::addPileups | ( | const int | bcr, | |
const std::vector< SimTrack > * | simtracks, | |||
unsigned int | evtNr, | |||
int | vertexoffset, | |||
bool | checkTof, | |||
bool | high | |||
) | [inline] |
Definition at line 19 of file CrossingFrame.cc.
References i, id, CrossingFrame< T >::pileups_, CoreSimTrack::setEventId(), CoreSimTrack::setTrackId(), and track.
00019 { 00020 00021 EncodedEventId id(bcr,evtNr); 00022 for (unsigned int i=0;i<simtracks->size();++i) 00023 if ((*simtracks)[i].noVertex()) { 00024 SimTrack track((*simtracks)[i]); 00025 track.setEventId(id); 00026 pileups_.push_back(track); 00027 } 00028 else { 00029 SimTrack track((*simtracks)[i].type(),(*simtracks)[i].momentum(),(*simtracks)[i].vertIndex()+vertexoffset, (*simtracks)[i].genpartIndex()); 00030 track.setEventId(id); 00031 track.setTrackId((*simtracks)[i].trackId()); 00032 pileups_.push_back(track); 00033 } 00034 }
void CrossingFrame< T >::addPileups | ( | const int | bcr, | |
const std::vector< T > * | vec, | |||
unsigned int | evtId, | |||
int | vertexoffset = 0 , |
|||
bool | checkTof = false , |
|||
bool | high = false | |||
) |
void CrossingFrame< T >::addSignals | ( | const std::vector< T > * | vec, | |
edm::EventID | id | |||
) | [inline] |
Definition at line 163 of file CrossingFrame.h.
References CrossingFrame< T >::id_, and CrossingFrame< T >::signals_.
int CrossingFrame< T >::getBunchCrossing | ( | unsigned int | ip | ) | const [inline] |
Definition at line 190 of file CrossingFrame.h.
References CrossingFrame< T >::firstCrossing_, CrossingFrame< T >::lastCrossing_, CrossingFrame< T >::pileupOffsetsBcr_, and CrossingFrame< T >::pileups_.
Referenced by CrossingFrame< T >::getSourceType().
00190 { 00191 // return the bcr for a certain position in the pileup vector 00192 for (unsigned int ii=1;ii<pileupOffsetsBcr_.size();ii++){ 00193 if (ip>=pileupOffsetsBcr_[ii-1] && ip<pileupOffsetsBcr_[ii]) return ii+firstCrossing_-1; 00194 } 00195 if (ip<pileups_.size()) return lastCrossing_; 00196 else return 999; 00197 }
std::pair<int,int> CrossingFrame< T >::getBunchRange | ( | ) | const [inline] |
Definition at line 55 of file CrossingFrame.h.
00055 {return std::pair<int,int>(firstCrossing_,lastCrossing_);}
int CrossingFrame< T >::getBunchSpace | ( | ) | const [inline] |
edm::EventID CrossingFrame< T >::getEventID | ( | ) | const [inline] |
unsigned int CrossingFrame< T >::getNrPileups | ( | int | bcr | ) | const [inline] |
Definition at line 66 of file CrossingFrame.h.
00066 { 00067 return bcr==lastCrossing_ ? pileups_.size()-pileupOffsetsBcr_[lastCrossing_-firstCrossing_] :pileupOffsetsBcr_[bcr-firstCrossing_+1]- pileupOffsetsBcr_[bcr-firstCrossing_];}
unsigned int CrossingFrame< T >::getNrPileups | ( | ) | const [inline] |
Definition at line 65 of file CrossingFrame.h.
Referenced by CrossingFrame< PSimHit >::getObject().
00065 {return pileups_.size();}
unsigned int CrossingFrame< T >::getNrSignals | ( | ) | const [inline] |
Definition at line 64 of file CrossingFrame.h.
Referenced by CrossingFrame< PSimHit >::getObject().
00064 {return signals_.size();}
const T& CrossingFrame< T >::getObject | ( | unsigned int | ip | ) | const [inline] |
Definition at line 71 of file CrossingFrame.h.
00071 { 00072 if (ip<0 || ip>getNrSignals()+getNrPileups()) throw cms::Exception("BadIndex")<<"CrossingFrame::getObject called with an invalid index!"; 00073 if (ip<getNrSignals()) { 00074 return signals_[ip]; 00075 } 00076 else { 00077 return pileups_[ip-getNrSignals()]; 00078 } 00079 }
void CrossingFrame< T >::getPileups | ( | typename std::vector< T >::const_iterator & | first, | |
typename std::vector< T >::const_iterator & | last | |||
) | const [inline] |
void CrossingFrame< T >::getSignal | ( | typename std::vector< T >::const_iterator & | first, | |
typename std::vector< T >::const_iterator & | last | |||
) | const [inline] |
int CrossingFrame< T >::getSourceType | ( | unsigned int | ip | ) | const [inline] |
Definition at line 179 of file CrossingFrame.h.
References CrossingFrame< T >::firstCrossing_, CrossingFrame< T >::getBunchCrossing(), i, and CrossingFrame< T >::pileupOffsetsSource_.
00179 { 00180 // decide to which source belongs object with index ip in the pileup vector 00181 // pileup=0, cosmics=1, beam halo+ =2, beam halo- =3 forward =4 00182 unsigned int bcr= getBunchCrossing(ip)-firstCrossing_; //starts at 0 00183 for (unsigned int i=0;i<pileupOffsetsSource_.size()-1;++i) { 00184 if (ip>=(pileupOffsetsSource_[i])[bcr] && ip <(pileupOffsetsSource_[i+1])[bcr]) return i; 00185 } 00186 return pileupOffsetsSource_.size()-1; 00187 }
CrossingFrame< T > & CrossingFrame< T >::operator= | ( | CrossingFrame< T > const & | rhs | ) | [inline] |
Definition at line 156 of file CrossingFrame.h.
References CrossingFrame< T >::swap(), and pyDBSRunClass::temp.
00156 { 00157 CrossingFrame<T> temp(rhs); 00158 this->swap(temp); 00159 return *this; 00160 }
void CrossingFrame< T >::print | ( | int | level = 0 |
) | const [inline] |
void CrossingFrame< T >::setBcrOffset | ( | ) | [inline] |
Definition at line 46 of file CrossingFrame.h.
00046 { 00047 pileupOffsetsBcr_.push_back(pileups_.size()); 00048 }
void CrossingFrame< T >::setSourceOffset | ( | const unsigned int | s | ) | [inline] |
Definition at line 49 of file CrossingFrame.h.
00049 { 00050 pileupOffsetsSource_[s].push_back(pileups_.size()); 00051 }
void CrossingFrame< T >::swap | ( | CrossingFrame< T > & | other | ) | [inline] |
Definition at line 129 of file CrossingFrame.h.
References CrossingFrame< T >::bunchSpace_, CrossingFrame< T >::firstCrossing_, i, CrossingFrame< T >::id_, CrossingFrame< T >::idFirstPileup_, CrossingFrame< T >::lastCrossing_, CrossingFrame< T >::maxNbSources_, CrossingFrame< T >::pileupFileNr_, CrossingFrame< T >::pileupOffsetsBcr_, CrossingFrame< T >::pileupOffsetsSource_, CrossingFrame< T >::pileups_, CrossingFrame< T >::signals_, CrossingFrame< T >::subdet_, and std::swap().
Referenced by CrossingFrame< T >::operator=(), and swap().
00129 { 00130 std::swap(firstCrossing_, other.firstCrossing_); 00131 std::swap(lastCrossing_, other.lastCrossing_); 00132 std::swap(bunchSpace_, other.bunchSpace_); 00133 subdet_.swap(other.subdet_); 00134 std::swap(id_, other.id_); 00135 std::swap(idFirstPileup_, other.idFirstPileup_); 00136 std::swap(pileupFileNr_, other.pileupFileNr_); 00137 std::swap(maxNbSources_, other.maxNbSources_); 00138 signals_.swap(other.signals_); 00139 pileups_.swap(other.pileups_); 00140 pileupOffsetsBcr_.swap(other.pileupOffsetsBcr_); 00141 /* for (std::vector<unsigned int> *p = pileupOffsetsSource_, */ 00142 /* *po = other.pileupOffsetsSource_; */ 00143 /* p < pileupOffsetsSource_ + maxNbSources_; */ 00144 /* ++p, ++po) { */ 00145 /* p->swap(*po); */ 00146 /* } */ 00147 pileupOffsetsSource_.resize(maxNbSources_); 00148 for (unsigned int i=0;i<pileupOffsetsSource_.size();++i) { 00149 pileupOffsetsSource_[i].swap(other.pileupOffsetsSource_[i]); 00150 } 00151 }
int CrossingFrame< T >::bunchSpace_ [private] |
Definition at line 93 of file CrossingFrame.h.
Referenced by CrossingFrame< PSimHit >::addPileups(), CrossingFrame< T >::addPileups(), CrossingFrame< PSimHit >::getBunchSpace(), and CrossingFrame< T >::swap().
int CrossingFrame< T >::firstCrossing_ [private] |
Definition at line 91 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::CrossingFrame(), CrossingFrame< T >::getBunchCrossing(), CrossingFrame< PSimHit >::getBunchRange(), CrossingFrame< PSimHit >::getNrPileups(), CrossingFrame< T >::getSourceType(), and CrossingFrame< T >::swap().
const int CrossingFrame< T >::highTrackTof [static] |
Definition at line 84 of file CrossingFrame.h.
edm::EventID CrossingFrame< T >::id_ [private] |
Definition at line 95 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::addSignals(), CrossingFrame< PSimHit >::getEventID(), and CrossingFrame< T >::swap().
edm::EventID CrossingFrame< T >::idFirstPileup_ [private] |
int CrossingFrame< T >::lastCrossing_ [private] |
Definition at line 92 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::CrossingFrame(), CrossingFrame< T >::getBunchCrossing(), CrossingFrame< PSimHit >::getBunchRange(), CrossingFrame< PSimHit >::getNrPileups(), and CrossingFrame< T >::swap().
const int CrossingFrame< T >::limHighLowTof [static] |
Definition at line 86 of file CrossingFrame.h.
Referenced by CrossingFrame< PSimHit >::addPileups().
const int CrossingFrame< T >::lowTrackTof [static] |
Definition at line 83 of file CrossingFrame.h.
unsigned int CrossingFrame< T >::maxNbSources_ [private] |
Definition at line 101 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::CrossingFrame(), and CrossingFrame< T >::swap().
const int CrossingFrame< T >::minLowTof [static] |
Definition at line 85 of file CrossingFrame.h.
unsigned int CrossingFrame< T >::pileupFileNr_ [private] |
std::vector<unsigned int> CrossingFrame< T >::pileupOffsetsBcr_ [private] |
Definition at line 108 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::CrossingFrame(), CrossingFrame< T >::getBunchCrossing(), CrossingFrame< PSimHit >::getNrPileups(), CrossingFrame< PSimHit >::setBcrOffset(), and CrossingFrame< T >::swap().
std::vector< std::vector<unsigned int> > CrossingFrame< T >::pileupOffsetsSource_ [private] |
Definition at line 109 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::CrossingFrame(), CrossingFrame< T >::getSourceType(), CrossingFrame< PSimHit >::setSourceOffset(), and CrossingFrame< T >::swap().
std::vector<T> CrossingFrame< T >::pileups_ [private] |
Definition at line 107 of file CrossingFrame.h.
Referenced by CrossingFrame< PSimHit >::addPileups(), CrossingFrame< T >::addPileups(), CrossingFrame< T >::getBunchCrossing(), CrossingFrame< PSimHit >::getNrPileups(), CrossingFrame< PSimHit >::getObject(), CrossingFrame< T >::getPileups(), CrossingFrame< PSimHit >::setBcrOffset(), CrossingFrame< PSimHit >::setSourceOffset(), and CrossingFrame< T >::swap().
std::vector<T> CrossingFrame< T >::signals_ [private] |
Definition at line 104 of file CrossingFrame.h.
Referenced by CrossingFrame< T >::addSignals(), CrossingFrame< PSimHit >::getNrSignals(), CrossingFrame< PSimHit >::getObject(), CrossingFrame< PSimHit >::getSignal(), and CrossingFrame< T >::swap().
std::string CrossingFrame< T >::subdet_ [private] |