From 7a21cf138ed408b723395895b7ef866950b20205 Mon Sep 17 00:00:00 2001 From: ehrlich-uva Date: Sat, 16 May 2026 08:02:15 -0500 Subject: [PATCH] added more variables to the CRV part --- inc/CrvHitInfoReco.hh | 8 +++++++- inc/CrvPulseInfoReco.hh | 2 +- src/CrvHitInfoReco.cc | 9 +++++++-- src/CrvInfoHelper.cc | 26 ++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/inc/CrvHitInfoReco.hh b/inc/CrvHitInfoReco.hh index ed8dae25..0f0efc9b 100644 --- a/inc/CrvHitInfoReco.hh +++ b/inc/CrvHitInfoReco.hh @@ -3,6 +3,7 @@ // CrvHitInfoReco: information about a cluster of CRV coincidence triplets +#include "EventNtuple/inc/CrvPulseInfoReco.hh" #include "EventNtuple/inc/RootVectors.hh" #include "Offline/DataProducts/inc/CRVId.hh" namespace CLHEP {class Hep3Vector; } @@ -15,6 +16,7 @@ namespace mu2e struct CrvHitInfoReco { int sectorType =-1; //CRV sector type + bool hitPosAndTimeCalculated = false; //indicates if pos and time was calculated, or if it was assumed that longitudinal pos was at the center of the counters XYZVectorF pos; //average position of counters float timeStart = -1; //first hit time float timeEnd = -1; //last hit time @@ -22,12 +24,16 @@ namespace mu2e float PEs = -1; //total number of PEs for this cluster std::array PEsPerLayer = {-1}; // PEs per layer for this cluster std::array sidePEsPerLayer = {-1};// PEs per layer per side for this cluster + std::array sidePulses = {0};// number of reco pulses per side for this cluster + std::array sidePEs = {-1};// PEs per side for this cluster + std::array sideTimes = {-1};// avg time per side for this cluster int nHits = -1; //number of coincidence hits in this cluster int nLayers = -1; //number of coincidence layers in this cluster float angle = -999; //coincidence direction + std::vector crvPulses; CrvHitInfoReco(){} - CrvHitInfoReco(int sectorType, CLHEP::Hep3Vector hpos, float timeWindowStart, float timeWindowEnd, float timeAvg, float PEs, std::array PEsPerLayer, std::array sidePEsPerLayer, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle); + CrvHitInfoReco(int sectorType, bool hitPosAndTimeCalculated, CLHEP::Hep3Vector hpos, float timeWindowStart, float timeWindowEnd, float timeAvg, float PEs, std::array PEsPerLayer, std::array sidePEsPerLayer, std::array sidePulses, std::array sidePEs, std::array sideTimes, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle, std::vector crvPulses); }; typedef std::vector CrvHitInfoRecoCollection; //this is the reco vector which will be stored in the main TTree } diff --git a/inc/CrvPulseInfoReco.hh b/inc/CrvPulseInfoReco.hh index 6da5ab04..945de3f6 100644 --- a/inc/CrvPulseInfoReco.hh +++ b/inc/CrvPulseInfoReco.hh @@ -14,7 +14,7 @@ namespace mu2e XYZVectorF pos; //average position of counters int barId = -1; //CRV counter ID int sectorId = -1; //CRV sector ID - int SiPMId = -1; //SiPMId number + int SiPMId = -1; //SiPMId number //uses actual SiPM numbers for reco pulses of coincidence clusters - otherwise sequential SiPMIs generated by a SiPM map int PEs = -1; //PEs using pulse integral int PEsPulseHeight = -1; //PEs using pulse height float pulseHeight = -1; //Pulse height diff --git a/src/CrvHitInfoReco.cc b/src/CrvHitInfoReco.cc index 1227fd3a..f7cfb581 100644 --- a/src/CrvHitInfoReco.cc +++ b/src/CrvHitInfoReco.cc @@ -1,8 +1,9 @@ #include "EventNtuple/inc/CrvHitInfoReco.hh" #include "CLHEP/Vector/ThreeVector.h" namespace mu2e { - CrvHitInfoReco::CrvHitInfoReco(int sectorType, CLHEP::Hep3Vector hpos, float timeWindowStart, float timeWindowEnd, float timeAvg, float PEs, std::array PEsPerLayer, std::array sidePEsPerLayer, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle) : + CrvHitInfoReco::CrvHitInfoReco(int sectorType, bool hitPosAndTimeCalculated, CLHEP::Hep3Vector hpos, float timeWindowStart, float timeWindowEnd, float timeAvg, float PEs, std::array PEsPerLayer, std::array sidePEsPerLayer, std::array sidePulses, std::array sidePEs, std::array sideTimes, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle, CrvPulseInfoRecoCollection crvPulses) : sectorType(sectorType), + hitPosAndTimeCalculated(hitPosAndTimeCalculated), pos(hpos), timeStart(timeWindowStart), timeEnd(timeWindowEnd), @@ -10,8 +11,12 @@ namespace mu2e { PEs(PEs), PEsPerLayer(PEsPerLayer), sidePEsPerLayer(sidePEsPerLayer), + sidePulses(sidePulses), + sidePEs(sidePEs), + sideTimes(sideTimes), nHits(nCoincidenceHits), nLayers(nCoincidenceLayers), - angle(coincidenceAngle) + angle(coincidenceAngle), + crvPulses(crvPulses) {} } diff --git a/src/CrvInfoHelper.cc b/src/CrvInfoHelper.cc index fb2b5cee..1f2a90eb 100644 --- a/src/CrvInfoHelper.cc +++ b/src/CrvInfoHelper.cc @@ -44,15 +44,21 @@ namespace mu2e std::array PEsPerLayer_ = {0.}; // Initialize PEs per layer per side std::array sidePEsPerLayer_ = {0.}; + // Convert doubles to floats in side times + std::array sideTimes_ = {static_cast(cluster.GetSideTimes()[0]), static_cast(cluster.GetSideTimes()[1])}; + // Initiatlize RecoPulse vector + CrvPulseInfoRecoCollection recoPulses; //this is the reco vector which will be stored in the main TTree for(size_t j=0; jGetPEs(); // Get layer number from the bar index associated with this reco pulse const CRSScintillatorBarIndex &crvBarIndex = coincRecoPulses_.at(j)->GetScintillatorBarIndex(); - const CRSScintillatorBar &crvCounter = CRS->getBar(crvBarIndex); - const CRSScintillatorBarId &crvCounterId = crvCounter.id(); - int layerNumber = crvCounterId.getLayerNumber(); + int sectorNumber = -1; + int moduleNumber = -1; + int layerNumber = -1; + int counterNumber = -1; + CrvHelper::GetCrvCounterInfo(CRS, crvBarIndex, sectorNumber, moduleNumber, layerNumber, counterNumber); // Get the side number // The negative side has SiPM indices 0 and 2, the postive side has indices 1 and 3. // zero/one index indicates negative/positive; negative/positive indicates direction wrt the axis in the coordinate system. @@ -62,19 +68,31 @@ namespace mu2e // Sum PEs for this coincidence, indexed by layer number and side number int layerSideIndex = layerNumber * CRVId::nSidesPerBar + side; // Indices for a flattened 2D matrix: layers (rows), sides (columns) sidePEsPerLayer_[layerSideIndex] += PEs; + + // Fill recoPulses + const auto &recoPulse = coincRecoPulses_.at(j); + CLHEP::Hep3Vector hitPos = CrvHelper::GetCrvCounterPos(CRS, crvBarIndex); + recoPulses.emplace_back(tdet->toDetector(hitPos), crvBarIndex.asInt(), sectorNumber, recoPulse->GetSiPMNumber(), + recoPulse->GetPEs(), recoPulse->GetPEsPulseHeight(), recoPulse->GetPulseHeight(), + recoPulse->GetPulseBeta(), recoPulse->GetPulseFitChi2(), recoPulse->GetPulseTime()); } //fill the Reco collection recoInfo.emplace_back( cluster.GetCrvSectorType(), + cluster.HitPosAndTimeCalculated(), tdet->toDetector(cluster.GetAvgHitPos()), cluster.GetStartTime(), cluster.GetEndTime(), cluster.GetAvgHitTime(), cluster.GetPEs(), PEsPerLayer_, // PEsPerLayer array is not a member of the mu2e::CrvCoincidenceCluster class sidePEsPerLayer_, // "" + cluster.GetSideHits(), + cluster.GetSidePEs(), + sideTimes_, cluster.GetCrvRecoPulses().size(), cluster.GetLayers().size(), - cluster.GetSlope()); + cluster.GetSlope(), + recoPulses); } if(!crvRecoPulses.isValid()) return;