70 std::unique_ptr<std::vector<PileupSummaryInfo> > PSIVector(
new std::vector<PileupSummaryInfo>);
76 std::vector<PileupSummaryInfo>::const_iterator PSiter;
78 for(PSiter = psiInput.
product()->begin(); PSiter != psiInput.
product()->end(); PSiter++){
80 PSIVector->push_back(*PSiter);
86 int bunchSpacing=*(bsInput.
product());
91 std::unique_ptr<int> bunchSpacingP(
new int(bunchSpacing));
92 event.put(
std::move(bunchSpacingP),
"bunchSpacing");
100 std::vector<int> BunchCrossings;
101 std::vector<int> Interactions_Xing;
102 std::vector<float> TrueInteractions_Xing;
103 std::vector< std::vector<edm::EventID> > eventInfoList_Xing;
117 unsigned int totalIntPU=0;
119 for(
int ib=0;
ib<(
int)bunchCrossing.size(); ++
ib){
121 BunchCrossings.push_back(bunchCrossing[
ib]);
122 Interactions_Xing.push_back(interactions[ib]);
123 TrueInteractions_Xing.push_back(TrueInteractions[ib]);
125 std::vector<edm::EventID> eventInfos;
126 eventInfos.reserve( interactions[ib] );
127 for (
int pu=0;
pu< interactions[
ib];
pu++) {
128 eventInfos.push_back(eventInfoList[totalIntPU+
pu]);
130 totalIntPU+=(interactions[
ib]);
131 eventInfoList_Xing.push_back(eventInfos);
137 throw cms::Exception(
"PileupInformation") <<
" PileupMixingContent is missing from the event.\n" 138 "There must be some breakdown in the Simulation Chain.\n" 139 "You must run the MixingModule before calling this routine.";
150 std::vector< std::vector<float> > ptHatList_Xing;
151 std::vector< std::vector<float> > zPosList_Xing;
152 std::vector< std::vector<float> > tPosList_Xing;
154 bool Have_pThats =
false;
164 const std::vector<float>& PtHatInput = MixVtxInfo->
getMix_pT_hats();
165 const std::vector<float>& ZposInput = MixVtxInfo->
getMix_z_Vtxs();
166 const std::vector<float>& TposInput = MixVtxInfo->
getMix_t_Vtxs();
170 unsigned int totalIntPU=0;
172 for(
int ib=0; ib<(
int)bunchCrossing.size(); ++
ib){
175 std::vector<float> zposBX, tposBX;
176 std::vector<float> pthatBX;
177 zposBX.reserve( interactions[ib] );
179 pthatBX.reserve( interactions[ib] );
180 for (
int pu=0;
pu< interactions[
ib];
pu++) {
181 zposBX.push_back(ZposInput[totalIntPU+
pu]);
183 pthatBX.push_back(PtHatInput[totalIntPU+
pu]);
185 totalIntPU+=(interactions[
ib]);
186 zPosList_Xing.push_back(zposBX);
187 tPosList_Xing.push_back(tposBX);
188 ptHatList_Xing.push_back(pthatBX);
208 bool HaveTrackingParticles =
false;
213 TrackingVertexCollection::const_iterator iVtx;
214 TrackingVertexCollection::const_iterator iVtxTest;
215 TrackingParticleCollection::const_iterator iTrackTest;
221 HaveTrackingParticles =
true;
223 iVtxTest = mergedVH->begin();
224 iTrackTest = mergedPH->begin();
233 std::vector<int>::iterator BXIter;
234 std::vector<int>::iterator InteractionsIter = Interactions_Xing.begin();
235 std::vector<float>::iterator TInteractionsIter = TrueInteractions_Xing.begin();
236 std::vector< std::vector<edm::EventID> >::iterator TEventInfoIter = eventInfoList_Xing.begin();
238 std::vector< std::vector<float> >::iterator zPosIter;
239 std::vector< std::vector<float> >::iterator tPosIter;
240 std::vector< std::vector<float> >::iterator pThatIter;
243 zPosIter = zPosList_Xing.begin();
244 tPosIter = tPosList_Xing.begin();
245 pThatIter = ptHatList_Xing.begin();
250 for( BXIter = BunchCrossings.begin(); BXIter != BunchCrossings.end(); ++BXIter, ++InteractionsIter, ++TInteractionsIter, ++TEventInfoIter) {
254 if(HaveTrackingParticles) {
256 for (iVtx = iVtxTest; iVtx != mergedVH->end(); ++iVtx) {
258 if(iVtx->eventId().bunchCrossing() == (*BXIter) ) {
260 if(iVtx->eventId().event() != lastEvent) {
265 zpos = iVtx->position().z();
272 lastEvent = iVtx->eventId().event();
288 for (TrackingParticleCollection::const_iterator iTrack = iTrackTest; iTrack != mergedPH->end(); ++iTrack)
290 bool FoundTrk =
false;
294 if(iTrack->eventId().bunchCrossing() == (*BXIter) && iTrack->eventId().event() > 0 )
297 int correct_index =
event_index_[iTrack->eventId().event()];
302 if(iTrack->matchedHit()>0) {
303 if(fabs(iTrack->parentVertex()->position().z()-zpos)<0.1) {
305 float Tpx = iTrack->p4().px();
306 float Tpy = iTrack->p4().py();
307 float TpT =
sqrt(Tpx*Tpx + Tpy*Tpy);
322 iTrackTest = --iTrack;
339 if(!HaveTrackingParticles) {
362 (*TInteractionsIter),
365 PSIVector->push_back(PSI_bunch);
373 std::vector<float> zposZeros( (*TEventInfoIter).size(), 0);
374 std::vector<float> tposZeros( (*TEventInfoIter).size(), 0);
375 std::vector<float> pThatZeros( (*TEventInfoIter).size(), 0);
388 (*TInteractionsIter),
392 PSIVector->push_back(PSI_bunch);
428 std::unique_ptr<int> bunchSpacingP(
new int(bunchSpacing));
429 event.put(
std::move(bunchSpacingP),
"bunchSpacing");
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::vector< float > & getMix_TrueInteractions() const
const std::vector< int > & getMix_bunchCrossing() const
const std::vector< float > & getMix_pT_hats() const
Container::value_type value_type
const std::vector< int > & getMix_Ninteractions() const
const std::vector< edm::EventID > getMix_eventInfo() const
T const * product() const
const std::vector< float > & getMix_z_Vtxs() const
const std::vector< float > & getMix_t_Vtxs() const
const int & getMix_bunchSpacing() const