CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
EgAmbiguityTools Namespace Reference

Classes

struct  isInnerMost
 

Functions

bool isBetter (const reco::GsfElectron *, const reco::GsfElectron *)
 
int sharedDets (const reco::GsfTrackRef &, const reco::GsfTrackRef &)
 
float sharedEnergy (const reco::CaloCluster *, const reco::CaloCluster *, edm::Handle< EcalRecHitCollection > &barrelRecHits, edm::Handle< EcalRecHitCollection > &endcapRecHits)
 
float sharedEnergy (const reco::SuperClusterRef &, const reco::SuperClusterRef &, edm::Handle< EcalRecHitCollection > &barrelRecHits, edm::Handle< EcalRecHitCollection > &endcapRecHits)
 
int sharedHits (const reco::GsfTrackRef &, const reco::GsfTrackRef &)
 

Function Documentation

bool EgAmbiguityTools::isBetter ( const reco::GsfElectron e1,
const reco::GsfElectron e2 
)

Definition at line 30 of file EgAmbiguityTools.cc.

References funct::abs(), and reco::GsfElectron::eSuperClusterOverP().

Referenced by EgAmbiguityTools::isInnerMost::operator()(), and GsfElectronAlgo::setAmbiguityData().

31  { return (std::abs(e1->eSuperClusterOverP()-1)<std::abs(e2->eSuperClusterOverP()-1)) ; }
float eSuperClusterOverP() const
Definition: GsfElectron.h:230
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int EgAmbiguityTools::sharedDets ( const reco::GsfTrackRef gsfTrackRef1,
const reco::GsfTrackRef gsfTrackRef2 
)

Definition at line 113 of file EgAmbiguityTools.cc.

References reco::HitPattern::getHitPattern(), reco::HitPattern::pixelHitFilter(), reco::HitPattern::stripTECHitFilter(), reco::HitPattern::stripTIBHitFilter(), reco::HitPattern::stripTIDHitFilter(), and reco::HitPattern::stripTOBHitFilter().

114  {
115 
116  //get the Hit Pattern for the gsfTracks
117  const HitPattern& gsfHitPattern1 = gsfTrackRef1->hitPattern();
118  const HitPattern& gsfHitPattern2 = gsfTrackRef2->hitPattern();
119 
120  unsigned int shared = 0;
121 
122  int gsfHitCounter1 = 0;
123  for(trackingRecHit_iterator elHitsIt1 = gsfTrackRef1->recHitsBegin();
124  elHitsIt1 != gsfTrackRef1->recHitsEnd(); elHitsIt1++, gsfHitCounter1++) {
125  if(!((**elHitsIt1).isValid())) //count only valid Hits
126  continue;
127  //if (gsfHitCounter1>1) continue; // to test only the first hit of the track 1
128  uint32_t gsfHit = gsfHitPattern1.getHitPattern(gsfHitCounter1);
129  if(!(gsfHitPattern1.pixelHitFilter(gsfHit)
130  || gsfHitPattern1.stripTIBHitFilter(gsfHit)
131  || gsfHitPattern1.stripTOBHitFilter(gsfHit)
132  || gsfHitPattern1.stripTECHitFilter(gsfHit)
133  || gsfHitPattern1.stripTIDHitFilter(gsfHit) )
134  ) continue;
135  int gsfHitsCounter2 = 0;
136  for(trackingRecHit_iterator gsfHitsIt2 = gsfTrackRef2->recHitsBegin();
137  gsfHitsIt2 != gsfTrackRef2->recHitsEnd(); gsfHitsIt2++, gsfHitsCounter2++) {
138  if(!((**gsfHitsIt2).isValid())) //count only valid Hits!
139  continue;
140 
141  uint32_t gsfHit2 = gsfHitPattern2.getHitPattern(gsfHitsCounter2);
142  if(!(gsfHitPattern2.pixelHitFilter(gsfHit2)
143  || gsfHitPattern2.stripTIBHitFilter(gsfHit2)
144  || gsfHitPattern1.stripTOBHitFilter(gsfHit2)
145  || gsfHitPattern2.stripTECHitFilter(gsfHit2)
146  || gsfHitPattern2.stripTIDHitFilter(gsfHit2) )
147  ) continue;
148  if ((**elHitsIt1).geographicalId() == (**gsfHitsIt2).geographicalId()) shared++;
149  }//gsfHits2 iterator
150  }//gsfHits1 iterator
151 
152  //std::cout << "[sharedHits] number of shared dets " << shared << std::endl;
153  //return shared/min(gsfTrackRef1->numberOfValidHits(),gsfTrackRef2->numberOfValidHits());
154  return shared;
155 
156 }
static bool stripTECHitFilter(uint32_t pattern)
Definition: HitPattern.h:472
static bool stripTIDHitFilter(uint32_t pattern)
Definition: HitPattern.h:458
static bool pixelHitFilter(uint32_t pattern)
Definition: HitPattern.h:419
static bool stripTOBHitFilter(uint32_t pattern)
Definition: HitPattern.h:465
uint32_t getHitPattern(int position) const
Definition: HitPattern.cc:142
static bool stripTIBHitFilter(uint32_t pattern)
Definition: HitPattern.h:451
float EgAmbiguityTools::sharedEnergy ( const reco::CaloCluster clu1,
const reco::CaloCluster clu2,
edm::Handle< EcalRecHitCollection > &  barrelRecHits,
edm::Handle< EcalRecHitCollection > &  endcapRecHits 
)

Definition at line 158 of file EgAmbiguityTools.cc.

References EcalBarrel, EcalEndcap, and reco::CaloCluster::hitsAndFractions().

Referenced by GsfElectronAlgo::setAmbiguityData(), and sharedEnergy().

160  {
161 
162  double fractionShared = 0;
163 
164  std::vector< std::pair<DetId, float> > v_id1 = clu1->hitsAndFractions();
165  std::vector< std::pair<DetId, float> > v_id2 = clu2->hitsAndFractions();
166  std::vector< std::pair<DetId, float> >::iterator ih1;
167  std::vector< std::pair<DetId, float> >::iterator ih2;
168 
169  for(ih1 = v_id1.begin();ih1 != v_id1.end(); ih1++) {
170 
171  for(ih2 = v_id2.begin();ih2 != v_id2.end(); ih2++) {
172 
173  if ( (*ih1).first != (*ih2).first ) continue;
174 
175  // here we have common Xtal id
177  if ((*ih1).first.subdetId() == EcalBarrel) {
178  if ((itt=barrelRecHits->find((*ih1).first))!=barrelRecHits->end())
179  fractionShared += itt->energy();
180  } else if ((*ih1).first.subdetId() == EcalEndcap) {
181  if ((itt=endcapRecHits->find((*ih1).first))!=endcapRecHits->end())
182  fractionShared += itt->energy();
183  }
184 
185  }
186  }
187 
188  //std::cout << "[sharedEnergy] shared energy /min(energy1,energy2) " << fractionShared << std::endl;
189  return fractionShared;
190 
191 }
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:190
float EgAmbiguityTools::sharedEnergy ( const reco::SuperClusterRef sc1,
const reco::SuperClusterRef sc2,
edm::Handle< EcalRecHitCollection > &  barrelRecHits,
edm::Handle< EcalRecHitCollection > &  endcapRecHits 
)

Definition at line 193 of file EgAmbiguityTools.cc.

References sharedEnergy().

195  {
196 
197  double energyShared = 0;
198  for(CaloCluster_iterator icl1=sc1->clustersBegin();icl1!=sc1->clustersEnd(); icl1++) {
199  for(CaloCluster_iterator icl2=sc2->clustersBegin();icl2!=sc2->clustersEnd(); icl2++) {
200  energyShared += sharedEnergy(&(**icl1),&(**icl2),barrelRecHits,endcapRecHits );
201  }
202  }
203  return energyShared;
204 
205 }
float sharedEnergy(const reco::CaloCluster *, const reco::CaloCluster *, edm::Handle< EcalRecHitCollection > &barrelRecHits, edm::Handle< EcalRecHitCollection > &endcapRecHits)
int EgAmbiguityTools::sharedHits ( const reco::GsfTrackRef gsfTrackRef1,
const reco::GsfTrackRef gsfTrackRef2 
)

Definition at line 66 of file EgAmbiguityTools.cc.

References reco::HitPattern::getHitPattern(), reco::HitPattern::pixelHitFilter(), TrackingRecHit::some, reco::HitPattern::stripTECHitFilter(), reco::HitPattern::stripTIBHitFilter(), reco::HitPattern::stripTIDHitFilter(), and reco::HitPattern::stripTOBHitFilter().

Referenced by MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(), CosmicMuonLinksProducer::mapTracks(), and QuadrupletSeedMerger::mergeTriplets().

67  {
68  //get the Hit Pattern for the gsfTracks
69  const HitPattern & gsfHitPattern1 = gsfTrackRef1->hitPattern() ;
70  const HitPattern & gsfHitPattern2 = gsfTrackRef2->hitPattern() ;
71 
72  unsigned int shared = 0;
73 
74  int gsfHitCounter1 = 0;
75  for(trackingRecHit_iterator elHitsIt1 = gsfTrackRef1->recHitsBegin();
76  elHitsIt1 != gsfTrackRef1->recHitsEnd(); elHitsIt1++, gsfHitCounter1++) {
77  if(!((**elHitsIt1).isValid())) //count only valid Hits
78  continue;
79  //if (gsfHitCounter1>1) continue; // test only the first hit of the track 1
80  uint32_t gsfHit = gsfHitPattern1.getHitPattern(gsfHitCounter1);
81  if(!(gsfHitPattern1.pixelHitFilter(gsfHit)
82  || gsfHitPattern1.stripTIBHitFilter(gsfHit)
83  || gsfHitPattern1.stripTOBHitFilter(gsfHit)
84  || gsfHitPattern1.stripTECHitFilter(gsfHit)
85  || gsfHitPattern1.stripTIDHitFilter(gsfHit) )
86  ) continue;
87  int gsfHitsCounter2 = 0;
88  for(trackingRecHit_iterator gsfHitsIt2 = gsfTrackRef2->recHitsBegin();
89  gsfHitsIt2 != gsfTrackRef2->recHitsEnd(); gsfHitsIt2++, gsfHitsCounter2++) {
90  if(!((**gsfHitsIt2).isValid())) //count only valid Hits!
91  continue;
92 
93  uint32_t gsfHit2 = gsfHitPattern2.getHitPattern(gsfHitsCounter2);
94  if(!(gsfHitPattern2.pixelHitFilter(gsfHit2)
95  || gsfHitPattern2.stripTIBHitFilter(gsfHit2)
96  || gsfHitPattern2.stripTOBHitFilter(gsfHit2)
97  || gsfHitPattern2.stripTECHitFilter(gsfHit2)
98  || gsfHitPattern2.stripTIDHitFilter(gsfHit2) )
99  ) continue;
100  if( (**elHitsIt1).sharesInput(&(**gsfHitsIt2), TrackingRecHit::some) ) {
101 // if (comp.equals(&(**elHitsIt1),&(**gsfHitsIt2))) {
102  //std::cout << "found shared hit " << gsfHit2 << std::endl;
103  shared++;
104  }
105  }//gsfHits2 iterator
106  }//gsfHits1 iterator
107 
108  //std::cout << "[sharedHits] number of shared hits " << shared << std::endl;
109  return shared;
110 
111 }
static bool stripTECHitFilter(uint32_t pattern)
Definition: HitPattern.h:472
static bool stripTIDHitFilter(uint32_t pattern)
Definition: HitPattern.h:458
static bool pixelHitFilter(uint32_t pattern)
Definition: HitPattern.h:419
static bool stripTOBHitFilter(uint32_t pattern)
Definition: HitPattern.h:465
uint32_t getHitPattern(int position) const
Definition: HitPattern.cc:142
static bool stripTIBHitFilter(uint32_t pattern)
Definition: HitPattern.h:451