Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion inc/CrvHitInfoReco.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -15,19 +16,24 @@ 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
float time = -1; // average hit time
float PEs = -1; //total number of PEs for this cluster
std::array<float, CRVId::nLayers> PEsPerLayer = {-1}; // PEs per layer for this cluster
std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> sidePEsPerLayer = {-1};// PEs per layer per side for this cluster
std::array<size_t, CRVId::nSidesPerBar> sidePulses = {0};// number of reco pulses per side for this cluster
std::array<float, CRVId::nSidesPerBar> sidePEs = {-1};// PEs per side for this cluster
std::array<float, CRVId::nSidesPerBar> 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<CrvPulseInfoReco> crvPulses;

CrvHitInfoReco(){}
CrvHitInfoReco(int sectorType, CLHEP::Hep3Vector hpos, float timeWindowStart, float timeWindowEnd, float timeAvg, float PEs, std::array<float, CRVId::nLayers> PEsPerLayer, std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> 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<float, CRVId::nLayers> PEsPerLayer, std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> sidePEsPerLayer, std::array<size_t, CRVId::nSidesPerBar> sidePulses, std::array<float, CRVId::nSidesPerBar> sidePEs, std::array<float, CRVId::nSidesPerBar> sideTimes, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle, std::vector<CrvPulseInfoReco> crvPulses);
};
typedef std::vector<CrvHitInfoReco> CrvHitInfoRecoCollection; //this is the reco vector which will be stored in the main TTree
}
Expand Down
2 changes: 1 addition & 1 deletion inc/CrvPulseInfoReco.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/CrvHitInfoReco.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#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<float, CRVId::nLayers> PEsPerLayer, std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> 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<float, CRVId::nLayers> PEsPerLayer, std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> sidePEsPerLayer, std::array<size_t, CRVId::nSidesPerBar> sidePulses, std::array<float, CRVId::nSidesPerBar> sidePEs, std::array<float, CRVId::nSidesPerBar> sideTimes, int nCoincidenceHits, int nCoincidenceLayers, float coincidenceAngle, CrvPulseInfoRecoCollection crvPulses) :
sectorType(sectorType),
hitPosAndTimeCalculated(hitPosAndTimeCalculated),
pos(hpos),
timeStart(timeWindowStart),
timeEnd(timeWindowEnd),
time(timeAvg),
PEs(PEs),
PEsPerLayer(PEsPerLayer),
sidePEsPerLayer(sidePEsPerLayer),
sidePulses(sidePulses),
sidePEs(sidePEs),
sideTimes(sideTimes),
nHits(nCoincidenceHits),
nLayers(nCoincidenceLayers),
angle(coincidenceAngle)
angle(coincidenceAngle),
crvPulses(crvPulses)
{}
}
26 changes: 22 additions & 4 deletions src/CrvInfoHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,21 @@ namespace mu2e
std::array<float, CRVId::nLayers> PEsPerLayer_ = {0.};
// Initialize PEs per layer per side
std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> sidePEsPerLayer_ = {0.};
// Convert doubles to floats in side times
std::array<float,CRVId::nSidesPerBar> sideTimes_ = {static_cast<float>(cluster.GetSideTimes()[0]), static_cast<float>(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; j<coincRecoPulses_.size(); j++) // Loop through the pulses
{
// Get PEs associated with this reco pulse
float PEs = coincRecoPulses_.at(j)->GetPEs();
// 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.
Expand All @@ -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;
Expand Down