56 std::auto_ptr<std::vector<PileupSummaryInfo> > PSIVector(
new std::vector<PileupSummaryInfo>);
61 std::vector<int> BunchCrossings;
62 std::vector<int> Interactions_Xing;
63 std::vector<float> TrueInteractions_Xing;
74 for(
int ib=0; ib<(int)bunchCrossing.size(); ++ib){
76 BunchCrossings.push_back(bunchCrossing[ib]);
77 Interactions_Xing.push_back(interactions[ib]);
78 TrueInteractions_Xing.push_back(TrueInteractions[ib]);
95 unsigned int oldVertexId = 0;
99 std::vector<int> BunchCrossings2;
100 std::list<int> Interactions_Xing2;
107 if (!index || iterator->eventId() != oldEventId)
109 if(iterator->eventId().bunchCrossing()==0 && iterator->eventId().event()==0){
112 if(iterator->eventId().bunchCrossing() != oldBX) {
113 BunchCrossings2.push_back(iterator->eventId().bunchCrossing());
114 Interactions_Xing2.push_back(iterator->eventId().event());
116 oldEvent = iterator->eventId().event();
118 else { Interactions_Xing2.pop_back();
119 Interactions_Xing2.push_back(iterator->eventId().event());
120 oldEvent = iterator->eventId().event();
124 oldEventId = iterator->eventId();
125 oldVertexId = iterator->vertexId();
131 std::vector<int>::iterator viter;
132 std::list<int>::iterator liter = Interactions_Xing2.begin();
134 for(viter = BunchCrossings2.begin(); viter != BunchCrossings2.end(); ++viter, ++liter){
136 BunchCrossings.push_back((*viter));
137 Interactions_Xing.push_back((*liter));
138 TrueInteractions_Xing.push_back(-1.);
157 int lastBunchCrossing = 0;
162 bool HaveTrackingParticles =
false;
164 TrackingVertexCollection::const_iterator iVtx;
165 TrackingVertexCollection::const_iterator iVtxTest;
166 TrackingParticleCollection::const_iterator iTrackTest;
171 HaveTrackingParticles =
true;
173 iVtxTest = mergedVH->begin();
174 iTrackTest = mergedPH->begin();
181 std::vector<int>::iterator BXIter;
182 std::vector<int>::iterator InteractionsIter = Interactions_Xing.begin();
183 std::vector<float>::iterator TInteractionsIter = TrueInteractions_Xing.begin();
187 for( BXIter = BunchCrossings.begin(); BXIter != BunchCrossings.end(); ++BXIter, ++InteractionsIter, ++TInteractionsIter) {
191 if(HaveTrackingParticles) {
193 for (iVtx = iVtxTest; iVtx != mergedVH->end(); ++iVtx) {
195 if(iVtx->eventId().bunchCrossing() == (*BXIter) ) {
197 if(iVtx->eventId().event() != lastEvent) {
202 zpos = iVtx->position().z();
209 lastEvent = iVtx->eventId().event();
225 for (TrackingParticleCollection::const_iterator iTrack = iTrackTest; iTrack != mergedPH->end(); ++iTrack)
227 bool FoundTrk =
false;
231 if(iTrack->eventId().bunchCrossing() == (*BXIter) && iTrack->eventId().event() > 0 )
234 int correct_index =
event_index_[iTrack->eventId().event()];
239 if(iTrack->matchedHit()>0) {
240 if(fabs(iTrack->parentVertex()->position().z()-zpos)<0.1) {
242 float Tpx = iTrack->p4().px();
243 float Tpy = iTrack->p4().py();
244 float TpT =
sqrt(Tpx*Tpx + Tpy*Tpy);
259 iTrackTest = --iTrack;
276 if(!HaveTrackingParticles) {
309 PSIVector->push_back(PSI_bunch);
311 if(HaveTrackingParticles) lastBunchCrossing = iVtx->eventId().bunchCrossing();
327 event.put(PSIVector);
const std::vector< float > & getMix_TrueInteractions() const
const std::vector< int > & getMix_bunchCrossing() const
const std::vector< int > & getMix_Ninteractions() const
int bunchCrossing() const
get the detector field from this detid
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
T const * product() const