67 std::unique_ptr<std::vector<PileupSummaryInfo> > PSIVector(
new std::vector<PileupSummaryInfo>);
73 std::vector<PileupSummaryInfo>::const_iterator PSiter;
75 for (PSiter = psiInput.
product()->begin(); PSiter != psiInput.
product()->end(); PSiter++) {
76 PSIVector->push_back(*PSiter);
81 int bunchSpacing = *(bsInput.
product());
86 std::unique_ptr<int> bunchSpacingP(
new int(bunchSpacing));
87 event.put(
std::move(bunchSpacingP),
"bunchSpacing");
95 std::vector<int> BunchCrossings;
96 std::vector<int> Interactions_Xing;
97 std::vector<float> TrueInteractions_Xing;
98 std::vector<std::vector<edm::EventID> > eventInfoList_Xing;
107 const std::vector<edm::EventID> eventInfoList = MixInfo->
getMix_eventInfo();
110 unsigned int totalIntPU = 0;
112 for (
int ib = 0;
ib < (
int)bunchCrossing.size(); ++
ib) {
114 BunchCrossings.push_back(bunchCrossing[
ib]);
115 Interactions_Xing.push_back(interactions[ib]);
116 TrueInteractions_Xing.push_back(TrueInteractions[ib]);
118 std::vector<edm::EventID> eventInfos;
119 eventInfos.reserve(interactions[ib]);
120 for (
int pu = 0;
pu < interactions[
ib];
pu++) {
121 eventInfos.push_back(eventInfoList[totalIntPU +
pu]);
123 totalIntPU += (interactions[
ib]);
124 eventInfoList_Xing.push_back(eventInfos);
128 std::vector<std::vector<float> > ptHatList_Xing;
129 std::vector<std::vector<float> > zPosList_Xing;
130 std::vector<std::vector<float> > tPosList_Xing;
132 bool Have_pThats =
false;
143 const std::vector<float>& PtHatInput = MixVtxInfo->
getMix_pT_hats();
144 const std::vector<float>& ZposInput = MixVtxInfo->
getMix_z_Vtxs();
145 const std::vector<float>& TposInput = MixVtxInfo->
getMix_t_Vtxs();
149 unsigned int totalIntPU = 0;
151 for (
int ib = 0; ib < (
int)bunchCrossing.size(); ++
ib) {
154 std::vector<float> zposBX, tposBX;
155 std::vector<float> pthatBX;
156 zposBX.reserve(interactions[ib]);
158 tposBX.reserve(interactions[ib]);
159 pthatBX.reserve(interactions[ib]);
160 for (
int pu = 0;
pu < interactions[
ib];
pu++) {
161 zposBX.push_back(ZposInput[totalIntPU +
pu]);
163 tposBX.push_back(TposInput[totalIntPU +
pu]);
164 pthatBX.push_back(PtHatInput[totalIntPU +
pu]);
166 totalIntPU += (interactions[
ib]);
167 zPosList_Xing.push_back(zposBX);
168 tPosList_Xing.push_back(tposBX);
169 ptHatList_Xing.push_back(pthatBX);
186 bool HaveTrackingParticles =
false;
191 TrackingVertexCollection::const_iterator iVtx;
192 TrackingVertexCollection::const_iterator iVtxTest;
193 TrackingParticleCollection::const_iterator iTrackTest;
197 HaveTrackingParticles =
true;
199 iVtxTest = mergedVH->begin();
200 iTrackTest = mergedPH->begin();
208 std::vector<int>::iterator BXIter;
209 std::vector<int>::iterator InteractionsIter = Interactions_Xing.begin();
210 std::vector<float>::iterator TInteractionsIter = TrueInteractions_Xing.begin();
211 std::vector<std::vector<edm::EventID> >::iterator TEventInfoIter = eventInfoList_Xing.begin();
213 std::vector<std::vector<float> >::iterator zPosIter;
214 std::vector<std::vector<float> >::iterator tPosIter;
215 std::vector<std::vector<float> >::iterator pThatIter;
218 zPosIter = zPosList_Xing.begin();
219 tPosIter = tPosList_Xing.begin();
220 pThatIter = ptHatList_Xing.begin();
225 for (BXIter = BunchCrossings.begin(); BXIter != BunchCrossings.end();
226 ++BXIter, ++InteractionsIter, ++TInteractionsIter, ++TEventInfoIter) {
229 if (HaveTrackingParticles) {
231 for (iVtx = iVtxTest; iVtx != mergedVH->end(); ++iVtx) {
232 if (iVtx->eventId().bunchCrossing() == (*BXIter)) {
234 if (iVtx->eventId().event() != lastEvent) {
238 zpos = iVtx->position().z();
245 lastEvent = iVtx->eventId().event();
261 for (TrackingParticleCollection::const_iterator iTrack = iTrackTest; iTrack != mergedPH->end(); ++iTrack) {
262 bool FoundTrk =
false;
266 if (iTrack->eventId().bunchCrossing() == (*BXIter) && iTrack->eventId().event() > 0) {
268 int correct_index =
event_index_[iTrack->eventId().event()];
273 if (iTrack->matchedHit() > 0) {
274 if (fabs(iTrack->parentVertex()->position().z() - zpos) <
277 float Tpx = iTrack->p4().px();
278 float Tpy = iTrack->p4().py();
279 float TpT =
sqrt(Tpx * Tpx + Tpy * Tpy);
292 iTrackTest = --iTrack;
307 if (!HaveTrackingParticles) {
327 (*TInteractionsIter),
329 PSIVector->push_back(PSI_bunch);
335 std::vector<float> zposZeros((*TEventInfoIter).size(), 0);
336 std::vector<float> tposZeros((*TEventInfoIter).size(), 0);
337 std::vector<float> pThatZeros((*TEventInfoIter).size(), 0);
349 (*TInteractionsIter),
352 PSIVector->push_back(PSI_bunch);
385 std::unique_ptr<int> bunchSpacingP(
new int(bunchSpacing));
386 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