187 double firstBin = 2.01;
209 if (nMC != 1) {
return;}
217 double minAngle = 999.;
219 for (
int is = 0; is < nShower; is++) {
225 ROOT::Math::XYZVector position;
226 VectorUtil::setMagThetaPhi(
231 ROOT::Math::XYZVector direction = ROOT::Math::XYZVector(position) - vertex;
233 double angle = ROOT::Math::VectorUtil::Angle(direction, mcp3);
234 if (angle < minAngle) {
240 if (minShower == -1) {
return;}
261 const float genEnergyMeV = 1000.*mcLabE;
262 const float tolerance = std::max(0.002 * genEnergyMeV, 1.0);
287 double e3x3 = e3x3Orig;
290 const double eHighestCorr =
m_eclShowerArray[minShower]->getEnergyHighestCrystal();
292 const double eHighestRaw = eHighestCorr / correction;
293 const double e3x3Alt = eHighestRaw /
m_eclShowerArray[minShower]->getE1oE9();
294 if (e3x3 < 0.001) {e3x3 = e3x3Alt;}
312 std::vector<double> digitEnergies;
314 unsigned int nRelatedDigits = showerDigitRelations.size();
315 for (
unsigned int ir = 0; ir < nRelatedDigits; ir++) {
316 const auto calDigit = showerDigitRelations.object(ir);
317 const auto weight = showerDigitRelations.weight(ir);
318 digitEnergies.push_back(calDigit->getEnergy() * weight);
322 std::sort(digitEnergies.begin(), digitEnergies.end());
325 double eSumOfN = 1.e-10;
326 for (
int isum = 0; isum <
t_nCrys; isum++) {
327 const int i = (int)nRelatedDigits - 1 - isum;
328 if (i >= 0) {eSumOfN += digitEnergies[i];}
341 const int iy = iEnergy + 1;
343 const int ixNom = 3 * ig + 1;
344 const int ixLowerE = ixNom + 1;
345 const int ixHigherE = ixNom + 2;
349 const double logEHigher =
m_logPeakEnergy.GetBinContent(ixHigherE, iy);
351 const double biasNom =
m_bias.GetBinContent(ixNom, iy);
352 const double biasLower =
m_bias.GetBinContent(ixLowerE, iy);
353 const double biasHigher =
m_bias.GetBinContent(ixHigherE, iy);
360 const double logESumN = log(eSumOfN);
362 double logEOther = logELower;
363 double biasOther = biasLower;
364 double peakOther = peakLower;
365 if (logESumN > logENom) {
366 logEOther = logEHigher;
367 biasOther = biasHigher;
368 peakOther = peakHigher;
372 double bias = biasNom;
373 double peak = peakNom;
374 if (std::abs(logEOther - logENom) > 0.0001) {
375 bias = biasNom + (biasOther - biasNom) * (logESumN - logENom) / (logEOther - logENom);
376 peak = peakNom + (peakOther - peakNom) * (logESumN - logENom) / (logEOther - logENom);
385 ROOT::Math::XYZVector measuredLocation;
386 VectorUtil::setMagThetaPhi(
387 measuredLocation, radius, thetaLocation, phiLocation);
388 ROOT::Math::XYZVector measuredDirection = ROOT::Math::XYZVector(measuredLocation) - vertex;
389 t_locationError = radius * ROOT::Math::VectorUtil::Angle(measuredDirection, mcp3);
396 double timing = -1000.;
397 double eMCTotal = 0.;
400 const unsigned int nRelatedClusters = showerClusterRelations.size();
401 if (nRelatedClusters > 0) {
402 const auto cluster = showerClusterRelations.object(0);
403 timing = cluster->getTime();
406 const auto clusterMCRelations = cluster->getRelationsWith<
MCParticle>();
407 for (
unsigned int ir = 0; ir < clusterMCRelations.size(); ++ir) {
408 eMCTotal += clusterMCRelations.weight(ir);
413 const double minTrueFrac = 0.15;
414 if (eMCTotal < minTrueFrac * mcLabE) {
return;}
417 const double maxClusterTiming = 200.;
418 if (abs(timing) > maxClusterTiming) {
return;}
422 const double maxOutOfTime = 900.;
423 if (OutOfTime > maxOutOfTime) {
return;}
432 B2INFO(
" e3x3Orig " << e3x3Orig <<
" e3x3Alt " << e3x3Alt <<
" Eraw " << eRaw <<
" ESum " << eSumOfN <<
" eFrac " <<
434 B2INFO(
" 3 log E " << logELower <<
" " << logENom <<
" " << logEHigher <<
" log E " << logESumN);
435 B2INFO(
" 3 biases " << biasLower <<
" " << biasNom <<
" " << biasHigher <<
" bias " << bias);
436 B2INFO(
" 3 peaks " << peakLower <<
" " << peakNom <<
" " << peakHigher <<
" peak " << peak);
A Class to store the Monte Carlo particle information.