CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SimPFProducer Class Reference
Inheritance diagram for SimPFProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 SimPFProducer (const edm::ParameterSet &)
 
 ~SimPFProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associators_
 
const edm::EDGetTokenT< CaloParticleCollectioncaloParticles_
 
const edm::EDGetTokenT< edm::View< reco::Track > > gsfTracks_
 
const edm::EDGetTokenT< reco::MuonCollectionmuons_
 
const double neutralEMThreshold_
 
const double neutralHADThreshold_
 
const edm::EDGetTokenT< edm::View< reco::PFRecTrack > > pfRecTracks_
 
const edm::EDGetTokenT< std::vector< reco::PFCluster > > simClusters_
 
const edm::EDGetTokenT< SimClusterCollectionsimClustersTruth_
 
const edm::EDGetTokenT< edm::ValueMap< float > > srcGsfTrackTime_
 
const edm::EDGetTokenT< edm::ValueMap< float > > srcGsfTrackTimeError_
 
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTime_
 
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeError_
 
const double superClusterThreshold_
 
const edm::EDGetTokenT< TrackingParticleCollectiontrackingParticles_
 
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_
 
const bool useTiming_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 58 of file SimPFProducer.cc.

Constructor & Destructor Documentation

SimPFProducer::SimPFProducer ( const edm::ParameterSet conf)

Definition at line 97 of file SimPFProducer.cc.

References GlobalPosition_Frontier_DevDB_cff::tag.

98  : superClusterThreshold_(conf.getParameter<double>("superClusterThreshold")),
99  neutralEMThreshold_(conf.getParameter<double>("neutralEMThreshold")),
100  neutralHADThreshold_(conf.getParameter<double>("neutralHADThreshold")),
101  useTiming_(conf.existsAs<edm::InputTag>("trackTimeValueMap")),
105  muons_(consumes<reco::MuonCollection>(conf.getParameter<edm::InputTag>("muonSrc"))),
109  ? consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("trackTimeErrorMap"))
112  ? consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("gsfTrackTimeValueMap"))
115  useTiming_ ? consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("gsfTrackTimeErrorMap"))
117  trackingParticles_(consumes<TrackingParticleCollection>(conf.getParameter<edm::InputTag>("trackingParticleSrc"))),
118  simClustersTruth_(consumes<SimClusterCollection>(conf.getParameter<edm::InputTag>("simClusterTruthSrc"))),
119  caloParticles_(consumes<CaloParticleCollection>(conf.getParameter<edm::InputTag>("caloParticlesSrc"))),
120  simClusters_(consumes<std::vector<reco::PFCluster>>(conf.getParameter<edm::InputTag>("simClustersSrc"))),
122  conf.getParameter<std::vector<edm::InputTag>>("associators"),
123  [this](const edm::InputTag& tag) { return this->consumes<reco::TrackToTrackingParticleAssociator>(tag); })) {
124  produces<reco::PFBlockCollection>();
125  produces<reco::SuperClusterCollection>("perfect");
126  produces<reco::PFCandidateCollection>();
127 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeError_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
const double neutralHADThreshold_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< CaloParticleCollection > caloParticles_
const std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associators_
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_
const edm::EDGetTokenT< edm::ValueMap< float > > srcGsfTrackTime_
const edm::EDGetTokenT< edm::View< reco::PFRecTrack > > pfRecTracks_
const edm::EDGetTokenT< SimClusterCollection > simClustersTruth_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticles_
const double superClusterThreshold_
const edm::EDGetTokenT< reco::MuonCollection > muons_
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTime_
const edm::EDGetTokenT< edm::ValueMap< float > > srcGsfTrackTimeError_
const bool useTiming_
const double neutralEMThreshold_
const edm::EDGetTokenT< std::vector< reco::PFCluster > > simClusters_
const edm::EDGetTokenT< edm::View< reco::Track > > gsfTracks_
SimPFProducer::~SimPFProducer ( )
inlineoverride

Definition at line 61 of file SimPFProducer.cc.

References produce().

61 {}

Member Function Documentation

void SimPFProducer::produce ( edm::StreamID  ,
edm::Event evt,
const edm::EventSetup es 
) const
override

Definition at line 129 of file SimPFProducer.cc.

References funct::abs(), TrackValidation_cff::association, ctfWithMaterialTrackMCMatch_cfi::associator, simPFProducer_cfi::associators, associators_, groupFilesInBlocks::block, gather_cfg::blocks, caloParticles_, HLT_2018_cff::candidates, ALCARECOTkAlJpsiMuMu_cff::charge, bsc_activity_cfg::clusters, edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >::const_iterator, constexpr, reco::PFCandidate::e, HTMLExport::elem(), bookConverter::elements, HCALHighEnergyHPDFilter_cfi::energy, reco::PFCluster::energy(), dqmdumpme::first, reco::PFCandidate::gamma, edm::Event::getByToken(), reco::PFCandidate::h, reco::PFCandidate::h0, cond::hash, reco::PFBlockElement::HGCAL, mps_fire::i, training_settings::idx, edm::Ref< C, T, F >::isNonnull(), edm::Ptr< T >::isNull(), crabWrapper::key, edm::Ref< C, T, F >::key(), match(), patCandidatesForDimuonsSequences_cff::matches, eostools::move(), amptDefaultParameters_cff::mu, reco::PFCandidate::mu, PDWG_BPHSkim_cff::muons, muons_, neutralEMThreshold_, neutralHADThreshold_, EgammaValidation_cff::pdgId, pfRecTracks_, reco::CaloCluster::position(), edm::Handle< T >::product(), edm::View< T >::ptrAt(), edm::PtrVector< T >::push_back(), edm::Event::put(), FastTimerService_cff::range, edm::View< T >::refAt(), SurveyInfoScenario_cff::seed, simClusters_, simClustersTruth_, edm::View< T >::size(), mathSSE::sqrt(), srcGsfTrackTime_, srcGsfTrackTimeError_, srcTrackTime_, srcTrackTimeError_, superClusterThreshold_, unpackBuffers-CaloStage2::token, trackingParticles_, tracks_, unit(), and useTiming_.

Referenced by ~SimPFProducer().

129  {
130  //get associators
131  std::vector<edm::Handle<reco::TrackToTrackingParticleAssociator>> associators;
132  for (const auto& token : associators_) {
133  associators.emplace_back();
134  auto& back = associators.back();
135  evt.getByToken(token, back);
136  }
137 
138  //get PFRecTrack
139  edm::Handle<edm::View<reco::PFRecTrack>> PFTrackCollectionH;
140  evt.getByToken(pfRecTracks_, PFTrackCollectionH);
141  const edm::View<reco::PFRecTrack> PFTrackCollection = *PFTrackCollectionH;
142  std::unordered_set<unsigned> PFTrackToGeneralTrack;
143  for (unsigned i = 0; i < PFTrackCollection.size(); ++i) {
144  const auto ptr = PFTrackCollection.ptrAt(i);
145  PFTrackToGeneralTrack.insert(ptr->trackRef().key());
146  }
147 
148  //get track collections
149  edm::Handle<edm::View<reco::Track>> TrackCollectionH;
150  evt.getByToken(tracks_, TrackCollectionH);
151  const edm::View<reco::Track>& TrackCollection = *TrackCollectionH;
152 
154  evt.getByToken(muons_, muons);
155  std::unordered_set<unsigned> MuonTrackToGeneralTrack;
156  for (auto const& mu : *muons.product()) {
157  reco::TrackRef muTrkRef = mu.track();
158  if (muTrkRef.isNonnull())
159  MuonTrackToGeneralTrack.insert(muTrkRef.key());
160  }
161 
162  // get timing, if enabled
163  edm::Handle<edm::ValueMap<float>> trackTimeH, trackTimeErrH, gsfTrackTimeH, gsfTrackTimeErrH;
164  if (useTiming_) {
165  evt.getByToken(srcTrackTime_, trackTimeH);
166  evt.getByToken(srcTrackTimeError_, trackTimeErrH);
167  evt.getByToken(srcGsfTrackTime_, gsfTrackTimeH);
168  evt.getByToken(srcGsfTrackTimeError_, gsfTrackTimeErrH);
169  }
170 
171  //get tracking particle collections
173  evt.getByToken(trackingParticles_, TPCollectionH);
174  //const TrackingParticleCollection& TPCollection = *TPCollectionH;
175 
176  // grab phony clustering information
177  edm::Handle<SimClusterCollection> SimClustersTruthH;
178  evt.getByToken(simClustersTruth_, SimClustersTruthH);
179  const SimClusterCollection& SimClustersTruth = *SimClustersTruthH;
180 
182  evt.getByToken(caloParticles_, CaloParticlesH);
183  const CaloParticleCollection& CaloParticles = *CaloParticlesH;
184 
186  evt.getByToken(simClusters_, SimClustersH);
187  const std::vector<reco::PFCluster>& SimClusters = *SimClustersH;
188 
189  std::unordered_map<uint64_t, size_t> hashToSimCluster;
190 
191  for (unsigned i = 0; i < SimClustersTruth.size(); ++i) {
192  const auto& simTruth = SimClustersTruth[i];
193  hashToSimCluster[hashSimInfo(simTruth)] = i;
194  }
195 
196  // associate the reco tracks / gsf Tracks
197  std::vector<reco::RecoToSimCollection> associatedTracks, associatedTracksGsf;
198  for (auto associator : associators) {
199  associatedTracks.emplace_back(associator->associateRecoToSim(TrackCollectionH, TPCollectionH));
200  //associatedTracksGsf.emplace_back(associator->associateRecoToSim(GsfTrackCollectionH, TPCollectionH));
201  }
202 
203  // make blocks out of calo particles so we can have cluster references
204  // likewise fill out superclusters
205  auto superclusters = std::make_unique<reco::SuperClusterCollection>();
206  auto blocks = std::make_unique<reco::PFBlockCollection>();
207  std::unordered_map<size_t, size_t> simCluster2Block;
208  std::unordered_map<size_t, size_t> simCluster2BlockIndex;
209  std::unordered_multimap<size_t, size_t> caloParticle2SimCluster;
210  std::vector<int> caloParticle2SuperCluster;
211  for (unsigned icp = 0; icp < CaloParticles.size(); ++icp) {
212  blocks->emplace_back();
213  auto& block = blocks->back();
214  const auto& simclusters = CaloParticles[icp].simClusters();
215  double pttot = 0.0;
216  double etot = 0.0;
217  std::vector<size_t> good_simclusters;
218  for (unsigned isc = 0; isc < simclusters.size(); ++isc) {
219  auto simc = simclusters[isc];
220  auto pdgId = std::abs(simc->pdgId());
221  edm::Ref<std::vector<reco::PFCluster>> clusterRef(SimClustersH, simc.key());
222  if (((pdgId == 22 || pdgId == 11) && clusterRef->energy() > neutralEMThreshold_) ||
223  clusterRef->energy() > neutralHADThreshold_) {
224  good_simclusters.push_back(isc);
225  etot += clusterRef->energy();
226  pttot += clusterRef->pt();
227  auto bec = std::make_unique<reco::PFBlockElementCluster>(clusterRef, reco::PFBlockElement::HGCAL);
228  block.addElement(bec.get());
229  simCluster2Block[simc.key()] = icp;
230  simCluster2BlockIndex[simc.key()] = bec->index();
231  caloParticle2SimCluster.emplace(CaloParticles[icp].g4Tracks()[0].trackId(), simc.key());
232  }
233  }
234 
235  auto pdgId = std::abs(CaloParticles[icp].pdgId());
236 
237  caloParticle2SuperCluster.push_back(-1);
238  if ((pdgId == 22 || pdgId == 11) && pttot > superClusterThreshold_) {
239  caloParticle2SuperCluster[icp] = superclusters->size();
240 
241  math::XYZPoint seedpos; // take seed pos as supercluster point
244  for (auto idx : good_simclusters) {
245  edm::Ptr<reco::PFCluster> ptr(SimClustersH, simclusters[idx].key());
246  clusters.push_back(ptr);
247  if (seed.isNull() || seed->energy() < ptr->energy()) {
248  seed = ptr;
249  seedpos = ptr->position();
250  }
251  }
252  superclusters->emplace_back(etot, seedpos, seed, clusters);
253  }
254  }
255 
256  auto blocksHandle = evt.put(std::move(blocks));
257  auto superClustersHandle = evt.put(std::move(superclusters), "perfect");
258 
259  // list tracks so we can mark them as used and/or fight over them
260  std::vector<bool> usedTrack(TrackCollection.size(), false),
261  //usedGsfTrack(GsfTrackCollection.size(),false),
262  usedSimCluster(SimClusters.size(), false);
263 
264  auto candidates = std::make_unique<reco::PFCandidateCollection>();
265  // in good particle flow fashion, start from the tracks and go out
266  for (unsigned itk = 0; itk < TrackCollection.size(); ++itk) {
267  auto tkRef = TrackCollection.refAt(itk);
268  // skip tracks not selected by PF
269  if (PFTrackToGeneralTrack.count(itk) == 0)
270  continue;
271  reco::RecoToSimCollection::const_iterator assoc_tps = associatedTracks.back().end();
272  for (const auto& association : associatedTracks) {
273  assoc_tps = association.find(tkRef);
274  if (assoc_tps != association.end())
275  break;
276  }
277  if (assoc_tps == associatedTracks.back().end())
278  continue;
279  // assured now that we are matched to a set of tracks
280  const auto& matches = assoc_tps->val;
281 
282  const auto absPdgId = std::abs(matches[0].first->pdgId());
283  const auto charge = tkRef->charge();
284  const auto three_mom = tkRef->momentum();
285  constexpr double mpion2 = 0.13957 * 0.13957;
286  double energy = std::sqrt(three_mom.mag2() + mpion2);
287  math::XYZTLorentzVector trk_p4(three_mom.x(), three_mom.y(), three_mom.z(), energy);
288 
290 
291  switch (absPdgId) {
292  case 11:
293  part_type = reco::PFCandidate::e;
294  break;
295  case 13:
296  part_type = reco::PFCandidate::mu;
297  break;
298  default:
299  part_type = reco::PFCandidate::h;
300  }
301 
302  candidates->emplace_back(charge, trk_p4, part_type);
303  auto& candidate = candidates->back();
304 
305  candidate.setTrackRef(tkRef.castTo<reco::TrackRef>());
306 
307  if (useTiming_)
308  candidate.setTime((*trackTimeH)[tkRef], (*trackTimeErrH)[tkRef]);
309 
310  // bind to cluster if there is one and try to gather conversions, etc
311  for (const auto& match : matches) {
312  uint64_t hash = hashSimInfo(*(match.first));
313  if (hashToSimCluster.count(hash)) {
314  auto simcHash = hashToSimCluster[hash];
315 
316  if (!usedSimCluster[simcHash]) {
317  if (simCluster2Block.count(simcHash) && simCluster2BlockIndex.count(simcHash)) {
318  size_t block = simCluster2Block.find(simcHash)->second;
319  size_t blockIdx = simCluster2BlockIndex.find(simcHash)->second;
320  edm::Ref<reco::PFBlockCollection> blockRef(blocksHandle, block);
321  candidate.addElementInBlock(blockRef, blockIdx);
322  usedSimCluster[simcHash] = true;
323  }
324  }
325  if (absPdgId == 11) { // collect brems/conv. brems
326  if (simCluster2Block.count(simcHash)) {
327  auto block_index = simCluster2Block.find(simcHash)->second;
328  auto supercluster_index = caloParticle2SuperCluster[block_index];
329  if (supercluster_index != -1) {
330  edm::Ref<reco::PFBlockCollection> blockRef(blocksHandle, block_index);
331  for (const auto& elem : blockRef->elements()) {
332  const auto& ref = elem.clusterRef();
333  if (!usedSimCluster[ref.key()]) {
334  candidate.addElementInBlock(blockRef, elem.index());
335  usedSimCluster[ref.key()] = true;
336  }
337  }
338 
339  //*TODO* cluster time is not reliable at the moment, so just keep time from the track if available
340  }
341  }
342  }
343  }
344  // Now try to include also electrons that have been reconstructed using
345  // the GraphCaloParticles. In particular, recover the cases in which the
346  // tracking particle associated to the CaloParticle has not left any hits
347  // in the calorimeters or, if it had, the cluster has been skipped due to
348  // threshold requirements.
349  if (caloParticle2SimCluster.count(match.first->g4Tracks()[0].trackId())) {
350  auto range = caloParticle2SimCluster.equal_range(match.first->g4Tracks()[0].trackId());
351  for (auto it = range.first; it != range.second; ++it) {
352  if (!usedSimCluster[it->second]) {
353  usedSimCluster[it->second] = true;
354  if (simCluster2Block.find(it->second) != simCluster2Block.end()) {
355  size_t block = simCluster2Block.find(it->second)->second;
356  size_t blockIdx = simCluster2BlockIndex.find(it->second)->second;
357  edm::Ref<reco::PFBlockCollection> blockRef(blocksHandle, block);
358  candidate.addElementInBlock(blockRef, blockIdx);
359  }
360  }
361  }
362  }
363  }
364  usedTrack[tkRef.key()] = true;
365  // remove tracks already used by muons
366  if (MuonTrackToGeneralTrack.count(itk) || absPdgId == 13)
367  candidates->pop_back();
368  }
369 
370  // now loop over the non-collected clusters in blocks
371  // and turn them into neutral hadrons or photons
372  const auto& theblocks = *blocksHandle;
373  for (unsigned ibl = 0; ibl < theblocks.size(); ++ibl) {
374  reco::PFBlockRef blref(blocksHandle, ibl);
375  const auto& elements = theblocks[ibl].elements();
376  for (const auto& elem : elements) {
377  const auto& ref = elem.clusterRef();
378  const auto& simtruth = SimClustersTruth[ref.key()];
380  if (!usedSimCluster[ref.key()]) {
381  auto absPdgId = std::abs(simtruth.pdgId());
382  switch (absPdgId) {
383  case 11:
384  case 22:
385  part_type = reco::PFCandidate::gamma;
386  break;
387  default:
388  part_type = reco::PFCandidate::h0;
389  }
390  const auto three_mom = (ref->position() - math::XYZPoint(0, 0, 0)).unit() * ref->correctedEnergy();
391  math::XYZTLorentzVector clu_p4(three_mom.x(), three_mom.y(), three_mom.z(), ref->correctedEnergy());
392  candidates->emplace_back(0, clu_p4, part_type);
393  auto& candidate = candidates->back();
394  candidate.addElementInBlock(blref, elem.index());
395  candidate.setTime(ref->time(), ref->timeError());
396  }
397  }
398  }
399 
400  evt.put(std::move(candidates));
401 }
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTimeError_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
ParticleType
particle types
Definition: PFCandidate.h:43
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Ptr< value_type > ptrAt(size_type i) const
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
size_type size() const
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const double neutralHADThreshold_
RefToBase< value_type > refAt(size_type i) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
const edm::EDGetTokenT< CaloParticleCollection > caloParticles_
const std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associators_
T sqrt(T t)
Definition: SSEVec.h:19
bool isNull() const
Checks for null.
Definition: Ptr.h:142
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_
const edm::EDGetTokenT< edm::ValueMap< float > > srcGsfTrackTime_
const edm::EDGetTokenT< edm::View< reco::PFRecTrack > > pfRecTracks_
const edm::EDGetTokenT< SimClusterCollection > simClustersTruth_
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticles_
T const * product() const
Definition: Handle.h:69
unsigned long long uint64_t
Definition: Time.h:13
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const double superClusterThreshold_
const edm::EDGetTokenT< reco::MuonCollection > muons_
const edm::EDGetTokenT< edm::ValueMap< float > > srcTrackTime_
std::vector< CaloParticle > CaloParticleCollection
const edm::EDGetTokenT< edm::ValueMap< float > > srcGsfTrackTimeError_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
const bool useTiming_
const double neutralEMThreshold_
std::vector< SimCluster > SimClusterCollection
Definition: SimClusterFwd.h:8
const edm::EDGetTokenT< std::vector< reco::PFCluster > > simClusters_
def move(src, dest)
Definition: eostools.py:511
#define constexpr
Basic3DVector unit() const

Member Data Documentation

const std::vector<edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> > SimPFProducer::associators_
private

Definition at line 82 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<CaloParticleCollection> SimPFProducer::caloParticles_
private

Definition at line 79 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Track> > SimPFProducer::gsfTracks_
private

Definition at line 73 of file SimPFProducer.cc.

const edm::EDGetTokenT<reco::MuonCollection> SimPFProducer::muons_
private

Definition at line 74 of file SimPFProducer.cc.

Referenced by produce().

const double SimPFProducer::neutralEMThreshold_
private

Definition at line 67 of file SimPFProducer.cc.

Referenced by produce().

const double SimPFProducer::neutralHADThreshold_
private

Definition at line 67 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::PFRecTrack> > SimPFProducer::pfRecTracks_
private

Definition at line 71 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<reco::PFCluster> > SimPFProducer::simClusters_
private

Definition at line 80 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<SimClusterCollection> SimPFProducer::simClustersTruth_
private

Definition at line 78 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<float> > SimPFProducer::srcGsfTrackTime_
private

Definition at line 76 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<float> > SimPFProducer::srcGsfTrackTimeError_
private

Definition at line 76 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<float> > SimPFProducer::srcTrackTime_
private

Definition at line 75 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<float> > SimPFProducer::srcTrackTimeError_
private

Definition at line 75 of file SimPFProducer.cc.

Referenced by produce().

const double SimPFProducer::superClusterThreshold_
private

Definition at line 67 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<TrackingParticleCollection> SimPFProducer::trackingParticles_
private

Definition at line 77 of file SimPFProducer.cc.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Track> > SimPFProducer::tracks_
private

Definition at line 72 of file SimPFProducer.cc.

Referenced by produce().

const bool SimPFProducer::useTiming_
private

Definition at line 68 of file SimPFProducer.cc.

Referenced by produce().