1 #ifndef Calibration_HcalCalibALgos_CommonUsefulStuff_h
2 #define Calibration_HcalCalibALgos_CommonUsefulStuff_h
56 const GlobalVector caloIntersectVector(caloPoint.
x(), caloPoint.
y(), caloPoint.
z());
60 const GlobalVector rechitVector(rechitPoint.
x(), rechitPoint.
y(), rechitPoint.
z());
63 double dotprod = caloIntersectUnitVector.
dot(rechitUnitVector);
64 double rechitdist = caloIntersectVector.mag() / dotprod;
66 const GlobalVector effectiveRechitVector = rechitdist * rechitUnitVector;
68 effectiveRechitVector.
x(), effectiveRechitVector.
y(), effectiveRechitVector.
z());
70 GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
73 return distance_vector.
mag();
85 const GlobalVector caloIntersectVector(caloPoint.
x(), caloPoint.
y(),
89 const GlobalVector rechitVector(rechitPoint.
x(), rechitPoint.
y(), rechitPoint.
z());
91 double dotprod_denominator = caloUnitVector.
dot(rechitUnitVector);
92 double dotprod_numerator = caloUnitVector.dot(caloIntersectVector);
93 double rechitdist = dotprod_numerator / dotprod_denominator;
94 const GlobalVector effectiveRechitVector = rechitdist * rechitUnitVector;
96 effectiveRechitVector.
x(), effectiveRechitVector.
y(), effectiveRechitVector.
z());
97 GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
98 if (dotprod_denominator > 0. && dotprod_numerator > 0.) {
99 return distance_vector.
mag();
129 const GlobalVector heightVector = trackDirection * coneHeight;
133 const GlobalVector caloIntersectVector(caloPoint.
x(), caloPoint.
y(), caloPoint.
z());
136 const GlobalVector coneBaseVector = heightVector + caloIntersectVector;
139 const GlobalPoint coneBasePoint(coneBaseVector.x(), coneBaseVector.y(), coneBaseVector.z());
142 const GlobalVector rechitVector(rechitPoint.
x(), rechitPoint.
y(), rechitPoint.
z());
161 double rechitdist = trackDirection.
dot(coneBaseVector) / trackDirection.
dot(rechitDirection);
166 const GlobalVector effectiveRechitVector = rechitdist * rechitDirection;
168 effectiveRechitVector.
x(), effectiveRechitVector.
y(), effectiveRechitVector.
z());
170 GlobalVector distance_vector = effectiveRechitPoint - coneBasePoint;
171 return distance_vector.
mag();
179 double eECALcone = 0;
180 std::vector<int> usedHitsEcal;
181 usedHitsEcal.clear();
183 for (std::vector<EcalRecHit>::const_iterator ehit = ecalCol.
begin(); ehit != ecalCol.
end(); ehit++) {
185 bool hitIsUsed =
false;
186 int hitHashedIndex = -10000;
195 for (uint32_t
i = 0;
i < usedHitsEcal.size();
i++) {
196 if (usedHitsEcal[
i] == hitHashedIndex)
201 usedHitsEcal.push_back(hitHashedIndex);
207 eECALcone += ehit->energy();
219 double eECALcone = 0;
220 std::vector<int> usedHitsEcal;
221 usedHitsEcal.clear();
222 for (std::vector<EcalRecHit>::const_iterator ehit = ecalCol.
begin(); ehit != ecalCol.
end(); ehit++) {
224 bool hitIsUsed =
false;
225 int hitHashedIndex = -10000;
234 for (uint32_t
i = 0;
i < usedHitsEcal.size();
i++) {
235 if (usedHitsEcal[
i] == hitHashedIndex)
240 usedHitsEcal.push_back(hitHashedIndex);
246 eECALcone += ehit->energy();