CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfElectronCoreEcalDrivenProducer.cc
Go to the documentation of this file.
1 
3 
7 
15 
16 #include <map>
17 
18 using namespace reco ;
19 
20 // void GsfElectronCoreEcalDrivenProducer::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
21 // {
22 // edm::ParameterSetDescription desc ;
23 // GsfElectronCoreBaseProducer::fillDescriptions(desc) ;
24 // descriptions.add("produceEcalDrivenGsfElectronCores",desc) ;
25 // }
26 
29  {}
30 
32  {
33  // base input
35 
36  // output
37  std::auto_ptr<GsfElectronCoreCollection> electrons(new GsfElectronCoreCollection) ;
38 
39  // loop on ecal driven tracks
41  {
42  const GsfPFRecTrackCollection * gsfPfRecTrackCollection = gsfPfRecTracksH_.product() ;
43  GsfPFRecTrackCollection::const_iterator gsfPfRecTrack ;
44  for ( gsfPfRecTrack=gsfPfRecTrackCollection->begin() ;
45  gsfPfRecTrack!=gsfPfRecTrackCollection->end() ;
46  ++gsfPfRecTrack )
47  {
48  const GsfTrackRef gsfTrackRef = gsfPfRecTrack->gsfTrackRef() ;
49  produceEcalDrivenCore(gsfTrackRef,electrons.get()) ;
50  }
51  }
52  else
53  {
54  const GsfTrackCollection * gsfTrackCollection = gsfTracksH_.product() ;
55  for ( unsigned int i=0 ; i<gsfTrackCollection->size() ; ++i )
56  {
58  produceEcalDrivenCore(gsfTrackRef,electrons.get()) ;
59  }
60  }
61 
62  event.put(electrons) ;
63  }
64 
66  {
67  GsfElectronCore * eleCore = new GsfElectronCore(gsfTrackRef) ;
68 
69  if (!eleCore->ecalDrivenSeed())
70  { delete eleCore ; return ; }
71 
73 
74  edm::RefToBase<TrajectorySeed> seed = gsfTrackRef->extra()->seedRef() ;
75  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>() ;
76  edm::RefToBase<CaloCluster> caloCluster = elseed->caloCluster() ;
77  SuperClusterRef scRef = caloCluster.castTo<SuperClusterRef>() ;
78  if (!scRef.isNull())
79  {
80  eleCore->setSuperCluster(scRef) ;
81  electrons->push_back(*eleCore) ;
82  }
83  else
84  { edm::LogWarning("GsfElectronCoreEcalDrivenProducer")<<"Seed CaloCluster is not a SuperCluster, unexpected..." ; }
85 
86  delete eleCore ;
87  }
88 
90  {}
91 
void initEvent(edm::Event &event, const edm::EventSetup &setup)
int i
Definition: DBlmapReader.cc:9
bool ecalDrivenSeed() const
return((rh^lh)&mask)
void produceEcalDrivenCore(const reco::GsfTrackRef &gsfTrackRef, reco::GsfElectronCoreCollection *electrons)
edm::Handle< reco::GsfTrackCollection > gsfTracksH_
void setSuperCluster(const SuperClusterRef &scl)
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
std::vector< GsfElectronCore > GsfElectronCoreCollection
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
virtual void produce(edm::Event &, const edm::EventSetup &)
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
bool isNull() const
Checks for null.
Definition: Ref.h:249
T const * product() const
Definition: Handle.h:81
REF castTo() const
Definition: RefToBase.h:278
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracksH_
GsfElectronCoreEcalDrivenProducer(const edm::ParameterSet &conf)
void fillElectronCore(reco::GsfElectronCore *)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")