CMS 3D CMS Logo

PileupSummaryInfoSlimmer.cc
Go to the documentation of this file.
5 
7 
8 #include <iostream>
9 
11 public:
13  : src_(consumes<std::vector<PileupSummaryInfo>>(conf.getParameter<edm::InputTag>("src"))),
14  keepDetailedInfoFor_(conf.getParameter<std::vector<int32_t>>("keepDetailedInfoFor")) {
15  produces<std::vector<PileupSummaryInfo>>();
16  }
17 
18  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const final;
19 
20 private:
22  const std::vector<int> keepDetailedInfoFor_;
23 };
24 
27  auto output = std::make_unique<std::vector<PileupSummaryInfo>>();
28 
29  evt.getByToken(src_, input);
30 
31  for (const auto& psu : *input) {
32  const int bunchCrossing = psu.getBunchCrossing();
33  const int bunchSpacing = psu.getBunchSpacing();
34  const int num_PU_vertices = psu.getPU_NumInteractions();
35  const float TrueNumInteractions = psu.getTrueNumInteractions();
36 
37  std::vector<float> zpositions;
38  std::vector<float> times;
39  std::vector<float> sumpT_lowpT;
40  std::vector<float> sumpT_highpT;
41  std::vector<int> ntrks_lowpT;
42  std::vector<int> ntrks_highpT;
43  std::vector<edm::EventID> eventInfo;
44  std::vector<float> pT_hats;
45 
46  const bool keep_details = std::find(keepDetailedInfoFor_.begin(), keepDetailedInfoFor_.end(), bunchCrossing) !=
48 
49  if (keep_details) {
50  zpositions = psu.getPU_zpositions();
51  times = psu.getPU_times();
52  sumpT_lowpT = psu.getPU_sumpT_lowpT();
53  sumpT_highpT = psu.getPU_sumpT_highpT();
54  ntrks_lowpT = psu.getPU_ntrks_lowpT();
55  ntrks_highpT = psu.getPU_ntrks_highpT();
56  eventInfo = psu.getPU_EventID();
57  pT_hats = psu.getPU_pT_hats();
58  }
59  // insert the slimmed vertex info
60  output->emplace_back(num_PU_vertices,
61  zpositions,
62  times,
63  sumpT_lowpT,
64  sumpT_highpT,
65  ntrks_lowpT,
66  ntrks_highpT,
67  eventInfo,
68  pT_hats,
69  bunchCrossing,
70  TrueNumInteractions,
71  bunchSpacing);
72  }
73 
74  evt.put(std::move(output));
75 }
76 
edm::StreamID
Definition: StreamID.h:30
PileupSummaryInfo.h
input
static const std::string input
Definition: EdmProvDump.cc:48
PileupSummaryInfoSlimmer
Definition: PileupSummaryInfoSlimmer.cc:10
PileupSummaryInfoSlimmer::keepDetailedInfoFor_
const std::vector< int > keepDetailedInfoFor_
Definition: PileupSummaryInfoSlimmer.cc:22
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
PileupSummaryInfoSlimmer::src_
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > src_
Definition: PileupSummaryInfoSlimmer.cc:21
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLTEgPhaseIITestSequence_cff.bunchSpacing
bunchSpacing
Definition: HLTEgPhaseIITestSequence_cff.py:1574
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
edm::global::EDProducer
Definition: EDProducer.h:32
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:57
PileupSummaryInfoSlimmer::produce
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const final
Definition: PileupSummaryInfoSlimmer.cc:25
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
ParameterSet.h
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
EDProducer.h
edm::Event
Definition: Event.h:73
PileupSummaryInfo
Definition: PileupSummaryInfo.h:22
PileupSummaryInfoSlimmer::PileupSummaryInfoSlimmer
PileupSummaryInfoSlimmer(const edm::ParameterSet &conf)
Definition: PileupSummaryInfoSlimmer.cc:12