1 #ifndef CommonUsefulStuff_h
2 #define CommonUsefulStuff_h
57 const GlobalVector caloIntersectVector(caloPoint.
x(), caloPoint.
y(), caloPoint.
z());
61 const GlobalVector rechitVector(rechitPoint.
x(), rechitPoint.
y(), rechitPoint.
z());
64 double dotprod = caloIntersectUnitVector.
dot(rechitUnitVector);
65 double rechitdist = caloIntersectVector.mag() / dotprod;
67 const GlobalVector effectiveRechitVector = rechitdist * rechitUnitVector;
69 effectiveRechitVector.
x(), effectiveRechitVector.
y(), effectiveRechitVector.
z());
71 GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
74 return distance_vector.
mag();
86 const GlobalVector caloIntersectVector(caloPoint.
x(), caloPoint.
y(),
90 const GlobalVector rechitVector(rechitPoint.
x(), rechitPoint.
y(), rechitPoint.
z());
92 double dotprod_denominator = caloUnitVector.
dot(rechitUnitVector);
93 double dotprod_numerator = caloUnitVector.dot(caloIntersectVector);
94 double rechitdist = dotprod_numerator / dotprod_denominator;
95 const GlobalVector effectiveRechitVector = rechitdist * rechitUnitVector;
97 effectiveRechitVector.
x(), effectiveRechitVector.
y(), effectiveRechitVector.
z());
98 GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
99 if (dotprod_denominator > 0. && dotprod_numerator > 0.) {
100 return distance_vector.
mag();
130 const GlobalVector heightVector = trackDirection * coneHeight;
134 const GlobalVector caloIntersectVector(caloPoint.
x(), caloPoint.
y(), caloPoint.
z());
137 const GlobalVector coneBaseVector = heightVector + caloIntersectVector;
140 const GlobalPoint coneBasePoint(coneBaseVector.x(), coneBaseVector.y(), coneBaseVector.z());
143 const GlobalVector rechitVector(rechitPoint.
x(), rechitPoint.
y(), rechitPoint.
z());
162 double rechitdist = trackDirection.
dot(coneBaseVector) / trackDirection.
dot(rechitDirection);
167 const GlobalVector effectiveRechitVector = rechitdist * rechitDirection;
169 effectiveRechitVector.
x(), effectiveRechitVector.
y(), effectiveRechitVector.
z());
171 GlobalVector distance_vector = effectiveRechitPoint - coneBasePoint;
172 return distance_vector.
mag();
180 double eECALcone = 0;
181 std::vector<int> usedHitsEcal;
182 usedHitsEcal.clear();
184 for (std::vector<EcalRecHit>::const_iterator ehit = ecalCol.
begin(); ehit != ecalCol.
end(); ehit++) {
186 bool hitIsUsed =
false;
187 int hitHashedIndex = -10000;
196 for (uint32_t
i = 0;
i < usedHitsEcal.size();
i++) {
197 if (usedHitsEcal[
i] == hitHashedIndex)
202 usedHitsEcal.push_back(hitHashedIndex);
208 eECALcone += ehit->energy();
220 double eECALcone = 0;
221 std::vector<int> usedHitsEcal;
222 usedHitsEcal.clear();
223 for (std::vector<EcalRecHit>::const_iterator ehit = ecalCol.
begin(); ehit != ecalCol.
end(); ehit++) {
225 bool hitIsUsed =
false;
226 int hitHashedIndex = -10000;
235 for (uint32_t
i = 0;
i < usedHitsEcal.size();
i++) {
236 if (usedHitsEcal[
i] == hitHashedIndex)
241 usedHitsEcal.push_back(hitHashedIndex);
247 eECALcone += ehit->energy();