54 std::auto_ptr<std::vector<PileupSummaryInfo> > PSIVector(
new std::vector<PileupSummaryInfo>);
57 event.getByLabel(
"mix", MixingPileup);
60 std::vector<int> Interactions_Xing;
69 for(
int ib=0; ib<(int)bunchCrossing.size(); ++ib){
71 BunchCrossings.push_back(bunchCrossing[ib]);
72 Interactions_Xing.push_back(interactions[ib]);
89 unsigned int oldVertexId = 0;
93 std::vector<int> BunchCrossings2;
94 std::list<int> Interactions_Xing2;
101 if (!index || iterator->eventId() != oldEventId)
103 if(iterator->eventId().bunchCrossing()==0 && iterator->eventId().event()==0){
106 if(iterator->eventId().bunchCrossing() != oldBX) {
107 BunchCrossings2.push_back(iterator->eventId().bunchCrossing());
108 Interactions_Xing2.push_back(iterator->eventId().event());
110 oldEvent = iterator->eventId().event();
112 else { Interactions_Xing2.pop_back();
113 Interactions_Xing2.push_back(iterator->eventId().event());
114 oldEvent = iterator->eventId().event();
118 oldEventId = iterator->eventId();
119 oldVertexId = iterator->vertexId();
125 std::vector<int>::iterator viter;
126 std::list<int>::iterator liter = Interactions_Xing2.begin();
128 for(viter = BunchCrossings2.begin(); viter != BunchCrossings2.end(); ++viter, ++liter){
130 BunchCrossings.push_back((*viter));
131 Interactions_Xing.push_back((*liter));
154 int lastBunchCrossing = 0;
156 TrackingVertexCollection::const_iterator iVtx;
157 TrackingVertexCollection::const_iterator iVtxTest = mergedVH->begin();
158 TrackingParticleCollection::const_iterator iTrackTest = mergedPH->begin();
164 std::vector<int>::iterator BXIter;
165 std::vector<int>::iterator InteractionsIter = Interactions_Xing.begin();
169 for( BXIter = BunchCrossings.begin(); BXIter != BunchCrossings.end(); ++BXIter, ++InteractionsIter) {
173 for (iVtx = iVtxTest; iVtx != mergedVH->end(); ++iVtx) {
175 if(iVtx->eventId().bunchCrossing() == (*BXIter) ) {
177 if(iVtx->eventId().event() != lastEvent) {
182 zpos = iVtx->position().z();
189 lastEvent = iVtx->eventId().event();
205 for (TrackingParticleCollection::const_iterator iTrack = iTrackTest; iTrack != mergedPH->end(); ++iTrack)
207 bool FoundTrk =
false;
211 if(iTrack->eventId().bunchCrossing() == (*BXIter) && iTrack->eventId().event() > 0 )
214 int correct_index =
event_index_[iTrack->eventId().event()];
219 if(iTrack->matchedHit()>0) {
220 if(fabs(iTrack->parentVertex()->position().z()-zpos)<0.1) {
222 float Tpx = iTrack->p4().px();
223 float Tpy = iTrack->p4().py();
224 float TpT =
sqrt(Tpx*Tpx + Tpy*Tpy);
239 iTrackTest = --iTrack;
275 PSIVector->push_back(PSI_bunch);
277 lastBunchCrossing = iVtx->eventId().bunchCrossing();
293 event.put(PSIVector);
const std::vector< int > & getMix_bunchCrossing() const
Container::value_type value_type
const std::vector< int > & getMix_Ninteractions() const
int bunchCrossing() const
get the detector field from this detid
T const * product() const