CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TrackMergeremb< T1 > Class Template Reference

#include <TrackMergeremb.h>

Inheritance diagram for TrackMergeremb< T1 >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackMergeremb (const edm::ParameterSet &)
 
 ~TrackMergeremb ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef T1 TrackCollectionemb
 
typedef edm::ValueMap< reco::TrackRefVectorTrackToTrackMapnew
 

Private Member Functions

void merg_and_put (edm::Event &, std::string, std::vector< edm::EDGetTokenT< TrackCollectionemb > > &)
 
template<>
void merg_and_put (edm::Event &iEvent, std::string instance, std::vector< edm::EDGetTokenT< reco::TrackCollection > > &to_merge)
 
template<>
void merg_and_put (edm::Event &iEvent, std::string instance, std::vector< edm::EDGetTokenT< reco::GsfTrackCollection > > &to_merge)
 
template<>
void merg_and_put (edm::Event &iEvent, std::string instance, std::vector< edm::EDGetTokenT< reco::MuonCollection > > &to_merge)
 
template<>
void merg_and_put (edm::Event &iEvent, std::string instance, std::vector< edm::EDGetTokenT< reco::PFCandidateCollection > > &to_merge)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
void willconsume (const edm::ParameterSet &iConfig)
 
template<>
void willconsume (const edm::ParameterSet &iConfig)
 
template<>
void willconsume (const edm::ParameterSet &iConfig)
 
void willproduce (std::string instance, std::string alias)
 
template<>
void willproduce (std::string instance, std::string alias)
 
template<>
void willproduce (std::string instance, std::string alias)
 
template<>
void willproduce (std::string instance, std::string alias)
 
template<>
void willproduce (std::string instance, std::string alias)
 

Private Attributes

std::map< std::string, std::vector< edm::EDGetTokenT< TrackCollectionemb > > > inputs_
 
edm::EDGetTokenT< reco::MuonCollectioninputs_fixmucol_
 
edm::EDGetTokenT< reco::MuonToMuonMapinputs_fixmurefs_
 
edm::EDGetTokenT< reco::TrackCollectioninputs_fixtrackcol_
 
edm::EDGetTokenT< TrackToTrackMapnewinputs_fixtrackrefs_
 
std::map< std::string, std::vector< edm::EDGetTokenT< edm::ValueMap< reco::MuonQuality > > > > inputs_qual_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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

template<typename T1>
class TrackMergeremb< T1 >

Author
Stefan Wayand; Christian Veelken, LLR

Definition at line 38 of file TrackMergeremb.h.

Member Typedef Documentation

template<typename T1 >
typedef T1 TrackMergeremb< T1 >::TrackCollectionemb
private

Definition at line 47 of file TrackMergeremb.h.

template<typename T1 >
typedef edm::ValueMap<reco::TrackRefVector> TrackMergeremb< T1 >::TrackToTrackMapnew
private

Definition at line 58 of file TrackMergeremb.h.

Constructor & Destructor Documentation

template<typename T1 >
TrackMergeremb< T1 >::TrackMergeremb ( const edm::ParameterSet iConfig)
explicit

Definition at line 71 of file TrackMergeremb.h.

References egammaCTFFinalFitWithMaterial_cff::alias, edm::ParameterSet::getParameter(), TrackMergeremb< T1 >::inputs_, AlCaHLTBitMon_QueryRunRegistry::string, TrackMergeremb< T1 >::willconsume(), and TrackMergeremb< T1 >::willproduce().

72 {
73  std::string alias( iConfig.getParameter<std::string>( "@module_label" ) );
74  std::vector<edm::InputTag> inCollections = iConfig.getParameter<std::vector<edm::InputTag> >("mergCollections");
75  for (auto inCollection : inCollections){
76  inputs_[inCollection.instance()].push_back(consumes<TrackCollectionemb >(inCollection) );
77  }
78  willconsume(iConfig);
79  for (auto toproduce : inputs_){
80  willproduce(toproduce.first,alias);
81  }
82 }
T getParameter(std::string const &) const
void willconsume(const edm::ParameterSet &iConfig)
void willproduce(std::string instance, std::string alias)
std::map< std::string, std::vector< edm::EDGetTokenT< TrackCollectionemb > > > inputs_
template<typename T1 >
TrackMergeremb< T1 >::~TrackMergeremb ( )

Definition at line 85 of file TrackMergeremb.h.

86 {
87 // nothing to be done yet...
88 }

Member Function Documentation

template<typename T1 >
void TrackMergeremb< T1 >::merg_and_put ( edm::Event iEvent,
std::string  instance,
std::vector< edm::EDGetTokenT< TrackCollectionemb > > &  to_merge 
)
private

Definition at line 68 of file TrackMergeremb.cc.

References edm::Event::getByToken(), eostools::move(), and edm::Event::put().

Referenced by TrackMergeremb< T1 >::produce().

69 {
70 
71  std::unique_ptr<TrackCollectionemb> outTracks = std::unique_ptr<TrackCollectionemb>(new TrackCollectionemb);
72 
73  for (auto akt_collection : to_merge){
74  edm::Handle<TrackCollectionemb> track_col_in;
75  iEvent.getByToken(akt_collection, track_col_in);
76 
77  size_t sedref_it = 0;
78  for (typename TrackCollectionemb::const_iterator it = track_col_in->begin(); it != track_col_in->end(); ++it, ++sedref_it) {
79  outTracks->push_back( typename T1::value_type( *it ) );
80 
81  }
82 
83  }// end merge
84 
85  iEvent.put(std::move(outTracks),instance);
86 
87 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
def move(src, dest)
Definition: eostools.py:510
template<>
void TrackMergeremb< reco::TrackCollection >::merg_and_put ( edm::Event iEvent,
std::string  instance,
std::vector< edm::EDGetTokenT< reco::TrackCollection > > &  to_merge 
)
private

Definition at line 101 of file TrackMergeremb.cc.

References edm::helper::Filler< Map >::fill(), objects.autophobj::filler, edm::Event::getByToken(), edm::Event::getRefBeforePut(), edm::helper::Filler< Map >::insert(), eostools::move(), edm::RefVector< C, T, F >::push_back(), and edm::Event::put().

102 {
103 
104  std::unique_ptr<reco::TrackCollection> outTracks = std::unique_ptr<reco::TrackCollection>(new reco::TrackCollection);
105  std::unique_ptr<reco::TrackExtraCollection> outTracks_ex = std::unique_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection());
106  std::unique_ptr<TrackingRecHitCollection> outTracks_rh = std::unique_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection());
107  std::unique_ptr<TrackToTrackMapnew> outTracks_refs = std::unique_ptr<TrackToTrackMapnew>(new TrackToTrackMapnew());
108 
109  auto rTrackExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
110  // auto rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
111 
112  std::vector<reco::TrackRefVector> trackRefColl;
113  //std::vector<reco::TrackRef> trackRefColl;
114 
115  for (auto akt_collection : to_merge){
117  iEvent.getByToken(akt_collection, track_col_in);
118 
119  unsigned sedref_it = 0;
120  for (reco::TrackCollection::const_iterator it = track_col_in->begin(); it != track_col_in->end(); ++it, ++sedref_it) {
121  outTracks->push_back( reco::Track( *it ) );
122  outTracks_ex->push_back( reco::TrackExtra( *it->extra() ) );
123  outTracks->back().setExtra( reco::TrackExtraRef( rTrackExtras, outTracks_ex->size() - 1) );
124  reco::TrackRef trackRefold(track_col_in, sedref_it);
125 
126  reco::TrackRefVector trackRefColl_helpvec;
127  trackRefColl_helpvec.push_back(trackRefold);
128  trackRefColl.push_back(trackRefColl_helpvec);
129  }
130 
131  }// end merge
132 
133 
134  edm::OrphanHandle<reco::TrackCollection> trackHandle = iEvent.put(std::move(outTracks),instance);
135  iEvent.put(std::move(outTracks_ex),instance);
136 
137 
138  TrackToTrackMapnew::Filler filler(*outTracks_refs);
139  filler.insert(trackHandle, trackRefColl.begin(), trackRefColl.end() );
140  filler.fill();
141 
142  iEvent.put(std::move(outTracks_refs));
143  iEvent.put(std::move(outTracks_rh),instance); // not implemented so far
144 
145 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
helper::Filler< ValueMap< reco::TrackRefVector > > Filler
Definition: ValueMap.h:168
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:69
edm::ValueMap< reco::TrackRefVector > TrackToTrackMapnew
def move(src, dest)
Definition: eostools.py:510
template<>
void TrackMergeremb< reco::GsfTrackCollection >::merg_and_put ( edm::Event iEvent,
std::string  instance,
std::vector< edm::EDGetTokenT< reco::GsfTrackCollection > > &  to_merge 
)
private

Definition at line 159 of file TrackMergeremb.cc.

References edm::Event::getByToken(), edm::Event::getRefBeforePut(), eostools::move(), and edm::Event::put().

160 {
161  std::unique_ptr<reco::GsfTrackCollection> outTracks = std::unique_ptr<reco::GsfTrackCollection>(new reco::GsfTrackCollection);
162  std::unique_ptr<reco::TrackExtraCollection> outTracks_ex = std::unique_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection());
163  std::unique_ptr<reco::GsfTrackExtraCollection> outTracks_exgsf = std::unique_ptr<reco::GsfTrackExtraCollection>(new reco::GsfTrackExtraCollection());
164  std::unique_ptr<TrackingRecHitCollection> outTracks_rh = std::unique_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection());
165 
166 
167  auto rTrackExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
168  auto rTrackExtras_gsf = iEvent.getRefBeforePut<reco::GsfTrackExtraCollection>();
169 
170  auto rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
171 
172  for (auto akt_collection : to_merge){
174  iEvent.getByToken(akt_collection, track_col_in);
175 
176  size_t sedref_it = 0;
177  for (reco::GsfTrackCollection::const_iterator it = track_col_in->begin(); it != track_col_in->end(); ++it, ++sedref_it) {
178  outTracks->push_back( reco::GsfTrack( *it ) );
179  outTracks_ex->push_back( reco::TrackExtra( *it->extra() ) );
180  outTracks_exgsf->push_back( reco::GsfTrackExtra( *it->gsfExtra() ) );
181 
182  outTracks->back().setExtra( reco::TrackExtraRef( rTrackExtras, outTracks_ex->size() - 1) );
183  outTracks->back().setGsfExtra( reco::GsfTrackExtraRef( rTrackExtras_gsf, outTracks_exgsf->size() - 1) );
184  }
185 
186  }// end merge
187 
188 
189  iEvent.put(std::move(outTracks),instance);
190  iEvent.put(std::move(outTracks_ex),instance);
191  iEvent.put(std::move(outTracks_exgsf),instance);
192  iEvent.put(std::move(outTracks_rh),instance);
193 
194 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
def move(src, dest)
Definition: eostools.py:510
template<>
void TrackMergeremb< reco::MuonCollection >::merg_and_put ( edm::Event iEvent,
std::string  instance,
std::vector< edm::EDGetTokenT< reco::MuonCollection > > &  to_merge 
)
private

Definition at line 232 of file TrackMergeremb.cc.

References ev, objects.autophobj::filler, edm::Event::getByToken(), edm::Event::getRefBeforePut(), eostools::move(), edm::Event::put(), and AlCaHLTBitMon_QueryRunRegistry::string.

233 {
234  std::unique_ptr<reco::MuonCollection> outTracks = std::unique_ptr<reco::MuonCollection>(new reco::MuonCollection);
235  std::unique_ptr<reco::CaloMuonCollection> calomu = std::unique_ptr<reco::CaloMuonCollection>(new reco::CaloMuonCollection); //not implemented so far
236 
237  edm::Handle<TrackToTrackMapnew> track_ref_map;
238  iEvent.getByToken(inputs_fixtrackrefs_, track_ref_map);
239 
241  iEvent.getByToken(inputs_fixtrackcol_, track_new_col);
242  std::map<reco::TrackRef , reco::TrackRef > simple_track_to_track_map; //I didn't find a more elegant way, so just build a good old fassion std::map
243  for (unsigned abc =0; abc < track_new_col->size(); ++abc) {
244  reco::TrackRef trackRef(track_new_col, abc);
245  simple_track_to_track_map[((*track_ref_map)[trackRef])[0]] = trackRef;
246  }
247 
248  std::vector<reco::MuonRef> muonRefColl;
249  reco::MuonRefProd outputMuonsRefProd = iEvent.getRefBeforePut<reco::MuonCollection>();
250  unsigned new_idx=0;
251  for (auto akt_collection : to_merge){
252  edm::Handle<reco::MuonCollection> track_col_in;
253  iEvent.getByToken(akt_collection, track_col_in);
254  unsigned old_idx=0;
255  for (reco::MuonCollection::const_iterator it = track_col_in->begin(); it != track_col_in->end(); ++it, ++old_idx, ++new_idx) {
256  outTracks->push_back( reco::Muon( *it ) );
257  reco::MuonRef muRefold(track_col_in, old_idx);
258  muonRefColl.push_back(muRefold);
259  reco::MuonRef muRefnew(outputMuonsRefProd, new_idx);
260 
261  if (it->track().isNonnull()){
262  //std::cout<<"pfmerge tr: "<<it->trackRef().id()<< " "<< it->trackRef().key()<< " " << simple_track_to_track_map[it->trackRef()].id() << " " << simple_track_to_track_map[it->trackRef()].key() <<std::endl;
263  outTracks->back().setTrack( simple_track_to_track_map[it->track()] );
264  }
265  }
266 
267  }// end merge
268 
269  const int nMuons=outTracks->size();
270 
271  std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
272  std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
273  std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
274  std::vector<reco::IsoDeposit> trackDepColl(nMuons);
275  std::vector<reco::IsoDeposit> ecalDepColl(nMuons);
276  std::vector<reco::IsoDeposit> hcalDepColl(nMuons);
277  std::vector<reco::IsoDeposit> hoDepColl(nMuons);
278  std::vector<reco::IsoDeposit> jetDepColl(nMuons);
279 
280  edm::OrphanHandle<reco::MuonCollection> muonHandle = iEvent.put(std::move(outTracks));
281 
282  auto fillMap = [](auto refH, auto& vec, edm::Event& ev, const std::string& cAl = ""){
284  std::unique_ptr<MapType > oMap(new MapType());
285  {
286  typename MapType::Filler filler(*oMap);
287  filler.insert(refH, vec.begin(), vec.end());
288  vec.clear();
289  filler.fill();
290  }
291  ev.put(std::move(oMap), cAl);
292  };
293 
294  fillMap(muonHandle, combinedTimeColl, iEvent, "combined");
295  fillMap(muonHandle, dtTimeColl, iEvent, "dt");
296  fillMap(muonHandle, cscTimeColl, iEvent, "csc");
297  fillMap(muonHandle, trackDepColl, iEvent, "tracker");
298  fillMap(muonHandle, ecalDepColl, iEvent, "ecal");
299  fillMap(muonHandle, hcalDepColl, iEvent, "hcal");
300  fillMap(muonHandle, hoDepColl, iEvent, "ho");
301  fillMap(muonHandle, jetDepColl, iEvent, "jets");
302  fillMap(muonHandle, muonRefColl, iEvent);
303  iEvent.put(std::move(calomu));
304 
305 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< CaloMuon > CaloMuonCollection
collection of Muon objects
Definition: MuonFwd.h:27
bool ev
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
edm::EDGetTokenT< reco::TrackCollection > inputs_fixtrackcol_
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
edm::EDGetTokenT< TrackToTrackMapnew > inputs_fixtrackrefs_
def move(src, dest)
Definition: eostools.py:510
template<>
void TrackMergeremb< reco::PFCandidateCollection >::merg_and_put ( edm::Event iEvent,
std::string  instance,
std::vector< edm::EDGetTokenT< reco::PFCandidateCollection > > &  to_merge 
)
private

Definition at line 334 of file TrackMergeremb.cc.

References DEFINE_FWK_MODULE, edm::Event::getByToken(), eostools::move(), and edm::Event::put().

335 {
336  std::unique_ptr<reco::PFCandidateCollection> outTracks = std::unique_ptr<reco::PFCandidateCollection>(new reco::PFCandidateCollection);
337 
338  edm::Handle<TrackToTrackMapnew> track_ref_map;
339  iEvent.getByToken(inputs_fixtrackrefs_, track_ref_map);
340 
342  iEvent.getByToken(inputs_fixtrackcol_, track_new_col);
343  std::map<reco::TrackRef , reco::TrackRef > simple_track_to_track_map; //I didn't find a more elegant way, so just build a good old fassion std::map
344  for (unsigned abc =0; abc < track_new_col->size(); ++abc) {
345  reco::TrackRef trackRef(track_new_col, abc);
346  simple_track_to_track_map[((*track_ref_map)[trackRef])[0]] = trackRef;
347  }
348 
349 
351  iEvent.getByToken(inputs_fixmurefs_, muon_ref_map);
352 
354  iEvent.getByToken(inputs_fixmucol_, muon_new_col);
355  std::map<reco::MuonRef , reco::MuonRef > simple_mu_to_mu_map; //I didn't find a more elegant way, so just build a good old fassion std::map
356  for (unsigned abc =0; abc < muon_new_col->size(); ++abc) {
357  reco::MuonRef muRef(muon_new_col, abc);
358  simple_mu_to_mu_map[(*muon_ref_map)[muRef]] = muRef;
359  }
360 
361 
362 
363  for (auto akt_collection : to_merge){
365  iEvent.getByToken(akt_collection, track_col_in);
366  for (reco::PFCandidateCollection::const_iterator it = track_col_in->begin(); it != track_col_in->end(); ++it) {
367  outTracks->push_back( reco::PFCandidate( *it ) );
368  //if (fabs(it->pdgId()) == 13){
369  if (it->trackRef().isNonnull() && outTracks->back().charge()){
370  //std::cout<<"pfmerge tr: "<<it->trackRef().id()<< " "<< it->trackRef().key()<< " " << simple_track_to_track_map[it->trackRef()].id() << " " << simple_track_to_track_map[it->trackRef()].key() <<std::endl;
371  outTracks->back().setTrackRef( simple_track_to_track_map[it->trackRef()] );
372  }
373  if (it->muonRef().isNonnull()){
374  //std::cout<<"pfmerge mu: "<<it->muonRef().id()<< " "<< it->muonRef().key()<< " " << simple_mu_to_mu_map[it->muonRef()].id() << " " << simple_mu_to_mu_map[it->muonRef()].key() <<std::endl;
375  outTracks->back().setMuonRef( simple_mu_to_mu_map[it->muonRef()] );
376  }
377 
378  }
379  }// end merge
380 
381  iEvent.put(std::move(outTracks),instance);
382 
383 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< reco::MuonCollection > inputs_fixmucol_
edm::EDGetTokenT< reco::MuonToMuonMap > inputs_fixmurefs_
edm::EDGetTokenT< reco::TrackCollection > inputs_fixtrackcol_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
edm::EDGetTokenT< TrackToTrackMapnew > inputs_fixtrackrefs_
def move(src, dest)
Definition: eostools.py:510
template<typename T1 >
void TrackMergeremb< T1 >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 92 of file TrackMergeremb.h.

References TrackMergeremb< T1 >::inputs_, and TrackMergeremb< T1 >::merg_and_put().

93 {
94 
95  for (auto input_ : inputs_){
96 
97  merg_and_put(iEvent,input_.first, input_.second);
98 
99  }// end instance
100 
101 
102 }
std::map< std::string, std::vector< edm::EDGetTokenT< TrackCollectionemb > > > inputs_
void merg_and_put(edm::Event &, std::string, std::vector< edm::EDGetTokenT< TrackCollectionemb > > &)
template<typename T1 >
void TrackMergeremb< T1 >::willconsume ( const edm::ParameterSet iConfig)
private

Definition at line 62 of file TrackMergeremb.cc.

Referenced by TrackMergeremb< T1 >::TrackMergeremb().

63 {
64 
65 }
template<>
void TrackMergeremb< reco::MuonCollection >::willconsume ( const edm::ParameterSet iConfig)
private

Definition at line 220 of file TrackMergeremb.cc.

221 {
222 
223  inputs_fixtrackrefs_ = consumes<TrackToTrackMapnew >( edm::InputTag("generalTracks") );
224  inputs_fixtrackcol_ = consumes<reco::TrackCollection >( edm::InputTag("generalTracks") );
225 
226 
227 
228 }
edm::EDGetTokenT< reco::TrackCollection > inputs_fixtrackcol_
edm::EDGetTokenT< TrackToTrackMapnew > inputs_fixtrackrefs_
template<>
void TrackMergeremb< reco::PFCandidateCollection >::willconsume ( const edm::ParameterSet iConfig)
private

Definition at line 320 of file TrackMergeremb.cc.

321 {
322 
323  inputs_fixtrackrefs_ = consumes<TrackToTrackMapnew >( edm::InputTag("generalTracks") );
324  inputs_fixtrackcol_ = consumes<reco::TrackCollection >( edm::InputTag("generalTracks") );
325  inputs_fixmurefs_ = consumes<reco::MuonToMuonMap >( edm::InputTag("muons1stStep") );
326  inputs_fixmucol_ = consumes<reco::MuonCollection >( edm::InputTag("muons1stStep") );
327 
328 
329 }
edm::EDGetTokenT< reco::MuonCollection > inputs_fixmucol_
edm::EDGetTokenT< reco::MuonToMuonMap > inputs_fixmurefs_
edm::EDGetTokenT< reco::TrackCollection > inputs_fixtrackcol_
edm::EDGetTokenT< TrackToTrackMapnew > inputs_fixtrackrefs_
template<typename T1 >
void TrackMergeremb< T1 >::willproduce ( std::string  instance,
std::string  alias 
)
private

Definition at line 56 of file TrackMergeremb.cc.

References instance.

Referenced by TrackMergeremb< T1 >::TrackMergeremb().

57 {
58  produces<TrackCollectionemb>(instance);
59 }
static PFTauRenderPlugin instance
template<>
void TrackMergeremb< reco::TrackCollection >::willproduce ( std::string  instance,
std::string  alias 
)
private

Definition at line 90 of file TrackMergeremb.cc.

References instance.

91 {
92 
93  produces<reco::TrackCollection>(instance).setBranchAlias( alias + "Tracks" );
94  produces<reco::TrackExtraCollection>(instance).setBranchAlias( alias + "TrackExtras" );
95  produces<TrackingRecHitCollection>(instance).setBranchAlias( alias + "RecHits" );
96  produces<TrackToTrackMapnew>();
97 
98 }
static PFTauRenderPlugin instance
template<>
void TrackMergeremb< reco::GsfTrackCollection >::willproduce ( std::string  instance,
std::string  alias 
)
private

Definition at line 150 of file TrackMergeremb.cc.

References instance.

151 {
152  produces<reco::GsfTrackCollection>(instance).setBranchAlias( alias + "GsfTracks" );
153  produces<reco::TrackExtraCollection>(instance).setBranchAlias( alias + "TrackExtras" );
154  produces<reco::GsfTrackExtraCollection>(instance).setBranchAlias( alias + "GsfTrackExtras" );
155  produces<TrackingRecHitCollection>(instance).setBranchAlias( alias + "RecHits" );
156 }
static PFTauRenderPlugin instance
template<>
void TrackMergeremb< reco::MuonCollection >::willproduce ( std::string  instance,
std::string  alias 
)
private

Definition at line 199 of file TrackMergeremb.cc.

200 {
201  produces<reco::MuonCollection>();
202  produces<reco::CaloMuonCollection>();
203  produces<reco::MuonTimeExtraMap>("combined");
204  produces<reco::MuonTimeExtraMap>("dt");
205  produces<reco::MuonTimeExtraMap>("csc");
206 
207  // todo make this configurable (or not )
208  produces<reco::IsoDepositMap>("tracker");
209  produces<reco::IsoDepositMap>("ecal");
210  produces<reco::IsoDepositMap>("hcal");
211  produces<reco::IsoDepositMap>("ho");
212  produces<reco::IsoDepositMap>("jets");
213 
214  produces<reco::MuonToMuonMap>();
215 
216 
217 }
template<>
void TrackMergeremb< reco::PFCandidateCollection >::willproduce ( std::string  instance,
std::string  alias 
)
private

Definition at line 310 of file TrackMergeremb.cc.

References instance.

311 {
312 
313  produces<reco::PFCandidateCollection>(instance);
314  // std::cout<<"Produce PF Collection: "<<instance<<std::endl;
315 
316 }
static PFTauRenderPlugin instance

Member Data Documentation

template<typename T1 >
std::map<std::string, std::vector<edm::EDGetTokenT<TrackCollectionemb > > > TrackMergeremb< T1 >::inputs_
private
template<typename T1 >
edm::EDGetTokenT<reco::MuonCollection > TrackMergeremb< T1 >::inputs_fixmucol_
private

Definition at line 65 of file TrackMergeremb.h.

template<typename T1 >
edm::EDGetTokenT<reco::MuonToMuonMap > TrackMergeremb< T1 >::inputs_fixmurefs_
private

Definition at line 64 of file TrackMergeremb.h.

template<typename T1 >
edm::EDGetTokenT<reco::TrackCollection > TrackMergeremb< T1 >::inputs_fixtrackcol_
private

Definition at line 62 of file TrackMergeremb.h.

template<typename T1 >
edm::EDGetTokenT<TrackToTrackMapnew > TrackMergeremb< T1 >::inputs_fixtrackrefs_
private

Definition at line 61 of file TrackMergeremb.h.

template<typename T1 >
std::map<std::string, std::vector<edm::EDGetTokenT<edm::ValueMap<reco::MuonQuality> > > > TrackMergeremb< T1 >::inputs_qual_
private

Definition at line 55 of file TrackMergeremb.h.