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]);
97 std::vector<int> BunchCrossings2;
98 std::list<int> Interactions_Xing2;
105 if (!index || iterator->eventId() != oldEventId)
107 if(iterator->eventId().bunchCrossing()==0 && iterator->eventId().event()==0){
110 if(iterator->eventId().bunchCrossing() != oldBX) {
111 BunchCrossings2.push_back(iterator->eventId().bunchCrossing());
112 Interactions_Xing2.push_back(iterator->eventId().event());
115 else { Interactions_Xing2.pop_back();
116 Interactions_Xing2.push_back(iterator->eventId().event());
120 oldEventId = iterator->eventId();
126 std::vector<int>::iterator viter;
127 std::list<int>::iterator liter = Interactions_Xing2.begin();
129 for(viter = BunchCrossings2.begin(); viter != BunchCrossings2.end(); ++viter, ++liter){
131 BunchCrossings.push_back((*viter));
132 Interactions_Xing.push_back((*liter));
133 TrueInteractions_Xing.push_back(-1.);
157 bool HaveTrackingParticles =
false;
159 TrackingVertexCollection::const_iterator iVtx;
160 TrackingVertexCollection::const_iterator iVtxTest;
161 TrackingParticleCollection::const_iterator iTrackTest;
166 HaveTrackingParticles =
true;
168 iVtxTest = mergedVH->begin();
169 iTrackTest = mergedPH->begin();
176 std::vector<int>::iterator BXIter;
177 std::vector<int>::iterator InteractionsIter = Interactions_Xing.begin();
178 std::vector<float>::iterator TInteractionsIter = TrueInteractions_Xing.begin();
182 for( BXIter = BunchCrossings.begin(); BXIter != BunchCrossings.end(); ++BXIter, ++InteractionsIter, ++TInteractionsIter) {
186 if(HaveTrackingParticles) {
188 for (iVtx = iVtxTest; iVtx != mergedVH->end(); ++iVtx) {
190 if(iVtx->eventId().bunchCrossing() == (*BXIter) ) {
192 if(iVtx->eventId().event() != lastEvent) {
197 zpos = iVtx->position().z();
204 lastEvent = iVtx->eventId().event();
220 for (TrackingParticleCollection::const_iterator iTrack = iTrackTest; iTrack != mergedPH->end(); ++iTrack)
222 bool FoundTrk =
false;
226 if(iTrack->eventId().bunchCrossing() == (*BXIter) && iTrack->eventId().event() > 0 )
229 int correct_index =
event_index_[iTrack->eventId().event()];
234 if(iTrack->matchedHit()>0) {
235 if(fabs(iTrack->parentVertex()->position().z()-zpos)<0.1) {
237 float Tpx = iTrack->p4().px();
238 float Tpy = iTrack->p4().py();
239 float TpT =
sqrt(Tpx*Tpx + Tpy*Tpy);
254 iTrackTest = --iTrack;
271 if(!HaveTrackingParticles) {
304 PSIVector->push_back(PSI_bunch);
322 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