15 using namespace reco ;
17 namespace EgAmbiguityTools
26 int gsfHitCounter1 = 0 ;
28 for(elHitsIt1 = e1->
gsfTrack()->recHitsBegin();
29 elHitsIt1 != e1->
gsfTrack()->recHitsEnd();
30 elHitsIt1++, gsfHitCounter1++)
32 if ((**elHitsIt1).isValid()){
37 int gsfHitCounter2 = 0 ;
39 for(elHitsIt2 = e2->
gsfTrack()->recHitsBegin();
40 elHitsIt2 != e2->
gsfTrack()->recHitsEnd();
41 elHitsIt2++, gsfHitCounter2++ )
43 if ((**elHitsIt2).isValid()){
48 uint32_t gsfHit1 = e1->
gsfTrack()->hitPattern().getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1);
49 uint32_t gsfHit2 = e2->
gsfTrack()->hitPattern().getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter2);
51 if (HitPattern::getSubStructure(gsfHit1) != HitPattern::getSubStructure(gsfHit2)){
52 return (HitPattern::getSubStructure(gsfHit1) < HitPattern::getSubStructure(gsfHit2));
53 }
else if (HitPattern::getLayer(gsfHit1) != HitPattern::getLayer(gsfHit2)){
54 return (HitPattern::getLayer(gsfHit1) < HitPattern::getLayer(gsfHit2));
63 const HitPattern &gsfHitPattern1 = gsfTrackRef1->hitPattern();
64 const HitPattern &gsfHitPattern2 = gsfTrackRef2->hitPattern();
66 unsigned int shared = 0;
68 int gsfHitCounter1 = 0;
70 elHitsIt1 != gsfTrackRef1->recHitsEnd(); elHitsIt1++, gsfHitCounter1++) {
71 if(!(**elHitsIt1).isValid()){
76 uint32_t gsfHit = gsfHitPattern1.
getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1);
77 if(!(HitPattern::pixelHitFilter(gsfHit)
78 || HitPattern::stripTIBHitFilter(gsfHit)
79 || HitPattern::stripTOBHitFilter(gsfHit)
80 || HitPattern::stripTECHitFilter(gsfHit)
81 || HitPattern::stripTIDHitFilter(gsfHit))){
85 int gsfHitsCounter2 = 0;
87 gsfHitsIt2 != gsfTrackRef2->recHitsEnd(); gsfHitsIt2++, gsfHitsCounter2++) {
88 if(!(**gsfHitsIt2).isValid()){
92 uint32_t gsfHit2 = gsfHitPattern2.
getHitPattern(HitPattern::TRACK_HITS, gsfHitsCounter2);
93 if(!(HitPattern::pixelHitFilter(gsfHit2)
94 || HitPattern::stripTIBHitFilter(gsfHit2)
95 || HitPattern::stripTOBHitFilter(gsfHit2)
96 || HitPattern::stripTECHitFilter(gsfHit2)
97 || HitPattern::stripTIDHitFilter(gsfHit2))){
115 const HitPattern &gsfHitPattern1 = gsfTrackRef1->hitPattern();
116 const HitPattern &gsfHitPattern2 = gsfTrackRef2->hitPattern();
118 unsigned int shared = 0;
120 int gsfHitCounter1 = 0;
122 elHitsIt1 != gsfTrackRef1->recHitsEnd(); elHitsIt1++, gsfHitCounter1++) {
123 if(!((**elHitsIt1).isValid())){
128 uint32_t gsfHit = gsfHitPattern1.
getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1);
129 if(!(HitPattern::pixelHitFilter(gsfHit)
130 || HitPattern::stripTIBHitFilter(gsfHit)
131 || HitPattern::stripTOBHitFilter(gsfHit)
132 || HitPattern::stripTECHitFilter(gsfHit)
133 || HitPattern::stripTIDHitFilter(gsfHit)))
138 int gsfHitsCounter2 = 0;
140 gsfHitsIt2 != gsfTrackRef2->recHitsEnd(); gsfHitsIt2++, gsfHitsCounter2++) {
141 if(!((**gsfHitsIt2).isValid())){
146 uint32_t gsfHit2 = gsfHitPattern2.
getHitPattern(HitPattern::TRACK_HITS, gsfHitsCounter2);
147 if(!(HitPattern::pixelHitFilter(gsfHit2)
148 || HitPattern::stripTIBHitFilter(gsfHit2)
149 || HitPattern::stripTOBHitFilter(gsfHit2)
150 || HitPattern::stripTECHitFilter(gsfHit2)
151 || HitPattern::stripTIDHitFilter(gsfHit2) )
153 if ((**elHitsIt1).geographicalId() == (**gsfHitsIt2).geographicalId()) shared++;
167 double fractionShared = 0;
171 std::vector< std::pair<DetId, float> >::iterator ih1;
172 std::vector< std::pair<DetId, float> >::iterator ih2;
174 for(ih1 = v_id1.begin();ih1 != v_id1.end(); ih1++) {
176 for(ih2 = v_id2.begin();ih2 != v_id2.end(); ih2++) {
178 if ( (*ih1).first != (*ih2).first )
continue;
183 if ((itt=barrelRecHits->find((*ih1).first))!=barrelRecHits->end())
184 fractionShared += itt->energy();
185 }
else if ((*ih1).first.subdetId() ==
EcalEndcap) {
186 if ((itt=endcapRecHits->find((*ih1).first))!=endcapRecHits->end())
187 fractionShared += itt->energy();
194 return fractionShared;
202 double energyShared = 0;
205 energyShared +=
sharedEnergy(&(**icl1),&(**icl2),barrelRecHits,endcapRecHits );
float eSuperClusterOverP() const
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Abs< T >::type abs(const T &t)
uint16_t getHitPattern(HitCategory category, int position) const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack