CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfElectronCoreProducer.cc
Go to the documentation of this file.
1 
3 
7 
16 
17 #include <map>
18 
19 using namespace reco ;
20 
21 // void GsfElectronCoreProducer::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
22 // {
23 // edm::ParameterSetDescription desc ;
24 // GsfElectronCoreBaseProducer::fillDescriptions(desc) ;
25 // desc.add<edm::InputTag>("ecalDrivenGsfElectronCoresTag",edm::InputTag("ecalDrivenGsfElectronCores")) ;
26 // desc.add<edm::InputTag>("pflowDrivenGsfElectronCoresTag",edm::InputTag("pflowGsfElectronCores")) ;
27 // desc.add<edm::InputTag>("pfSuperClusters",edm::InputTag("pfElectronTranslator:pf")) ;
28 // desc.add<edm::InputTag>("pfSuperClusterTrackMap",edm::InputTag("pfElectronTranslator:pf")) ;
29 // descriptions.add("produceGsfElectronCores",desc) ;
30 // }
31 
34  {
35  edCoresTag_ = config.getParameter<edm::InputTag>("ecalDrivenGsfElectronCoresTag") ;
36  pfCoresTag_ = config.getParameter<edm::InputTag>("pflowGsfElectronCoresTag") ;
37 // pfSuperClustersTag_ = config.getParameter<edm::InputTag>("pfSuperClusters") ;
38 // pfSuperClusterTrackMapTag_ = config.getParameter<edm::InputTag>("pfSuperClusterTrackMap") ;
39  }
40 
42  {
43  // base input
45 
46  // transient output
47  std::list<GsfElectronCore *> electrons ;
48 
49  // event input
50  event.getByLabel(edCoresTag_,edCoresH_) ;
51  event.getByLabel(pfCoresTag_,pfCoresH_) ;
52 // event.getByLabel(pfSuperClustersTag_,pfClustersH_) ;
53 // event.getByLabel(pfSuperClusterTrackMapTag_,pfClusterTracksH_) ;
54 
55  // loop on pure tracker driven tracks
57  {
58  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = gsfPfRecTracksH_.product() ;
59  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
60  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
61  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
62  ++gsfPfRecTrack )
63  {
64  const GsfTrackRef gsfTrackRef = gsfPfRecTrack->gsfTrackRef() ;
65  produceTrackerDrivenCore(gsfTrackRef,electrons) ;
66  }
67  }
68  else
69  {
70  const GsfTrackCollection * gsfTrackCollection = gsfTracksH_.product() ;
71  for ( unsigned int i=0 ; i<gsfTrackCollection->size() ; ++i )
72  {
74  produceTrackerDrivenCore(gsfTrackRef,electrons) ;
75  }
76  }
77 
78  // clone ecal driven electrons
79  const GsfElectronCoreCollection * edCoresCollection = edCoresH_.product() ;
80  GsfElectronCoreCollection::const_iterator edCoreIter ;
81  for
82  ( edCoreIter = edCoresCollection->begin() ;
83  edCoreIter != edCoresCollection->end() ;
84  edCoreIter++ )
85  { electrons.push_back(edCoreIter->clone()) ; }
86 
87  // add pflow info
88  const GsfElectronCoreCollection * pfCoresCollection = pfCoresH_.product() ;
89  GsfElectronCoreCollection::const_iterator pfCoreIter ;
90  std::list<GsfElectronCore *>::iterator eleCore ;
91  bool found ;
92  for ( eleCore = electrons.begin() ; eleCore != electrons.end() ; eleCore++ )
93  {
94 // (*eleCore)->setPflowSuperCluster((*pfClusterTracksH_)[(*eleCore)->gsfTrack()]) ;
95  found = false ;
96  for
97  ( pfCoreIter = pfCoresCollection->begin() ;
98  pfCoreIter != pfCoresCollection->end() ;
99  pfCoreIter++ )
100  {
101  if (pfCoreIter->gsfTrack()==(*eleCore)->gsfTrack())
102  {
103  if (found)
104  {
105  edm::LogWarning("GsfElectronCoreProducer")<<"associated pfGsfElectronCore already found" ;
106  }
107  else
108  {
109  found = true ;
110  (*eleCore)->setPflowSuperCluster(pfCoreIter->pflowSuperCluster()) ;
111  }
112  }
113  }
114  }
115 
116  // store
117  std::auto_ptr<GsfElectronCoreCollection> collection(new GsfElectronCoreCollection) ;
118  for ( eleCore = electrons.begin() ; eleCore != electrons.end() ; eleCore++ )
119  {
120  if ((*eleCore)->superCluster().isNull())
121  { LogDebug("GsfElectronCoreProducer")<<"GsfTrack with no associated SuperCluster at all." ; }
122  else
123  { collection->push_back(**eleCore) ; }
124  delete (*eleCore) ;
125  }
126  event.put(collection) ;
127  }
128 
129 void GsfElectronCoreProducer::produceTrackerDrivenCore( const GsfTrackRef & gsfTrackRef, std::list<GsfElectronCore *> & electrons )
130  {
131  GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;
132  if (eleCore->ecalDrivenSeed())
133  { delete eleCore ; return ; }
135  electrons.push_back(eleCore) ;
136  }
137 
139  {}
140 
#define LogDebug(id)
void initEvent(edm::Event &event, const edm::EventSetup &setup)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
bool ecalDrivenSeed() const
edm::Handle< reco::GsfElectronCoreCollection > edCoresH_
void produceTrackerDrivenCore(const reco::GsfTrackRef &gsfTrackRef, std::list< reco::GsfElectronCore * > &electrons)
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::Handle< reco::GsfTrackCollection > gsfTracksH_
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
std::vector< GsfElectronCore > GsfElectronCoreCollection
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
GsfElectronCoreProducer(const edm::ParameterSet &)
T const * product() const
Definition: Handle.h:74
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracksH_
edm::Handle< reco::GsfElectronCoreCollection > pfCoresH_
void fillElectronCore(reco::GsfElectronCore *)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")