Skip to content

Commit 647b39d

Browse files
Merge pull request #367 from ehrlich-uva/main
added more variables to the CRV part
2 parents 08545e9 + 7a21cf1 commit 647b39d

4 files changed

Lines changed: 37 additions & 8 deletions

File tree

inc/CrvHitInfoReco.hh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
// CrvHitInfoReco: information about a cluster of CRV coincidence triplets
55

6+
#include "EventNtuple/inc/CrvPulseInfoReco.hh"
67
#include "EventNtuple/inc/RootVectors.hh"
78
#include "Offline/DataProducts/inc/CRVId.hh"
89
namespace CLHEP {class Hep3Vector; }
@@ -15,19 +16,24 @@ namespace mu2e
1516
struct CrvHitInfoReco
1617
{
1718
int sectorType =-1; //CRV sector type
19+
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
1820
XYZVectorF pos; //average position of counters
1921
float timeStart = -1; //first hit time
2022
float timeEnd = -1; //last hit time
2123
float time = -1; // average hit time
2224
float PEs = -1; //total number of PEs for this cluster
2325
std::array<float, CRVId::nLayers> PEsPerLayer = {-1}; // PEs per layer for this cluster
2426
std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> sidePEsPerLayer = {-1};// PEs per layer per side for this cluster
27+
std::array<size_t, CRVId::nSidesPerBar> sidePulses = {0};// number of reco pulses per side for this cluster
28+
std::array<float, CRVId::nSidesPerBar> sidePEs = {-1};// PEs per side for this cluster
29+
std::array<float, CRVId::nSidesPerBar> sideTimes = {-1};// avg time per side for this cluster
2530
int nHits = -1; //number of coincidence hits in this cluster
2631
int nLayers = -1; //number of coincidence layers in this cluster
2732
float angle = -999; //coincidence direction
33+
std::vector<CrvPulseInfoReco> crvPulses;
2834

2935
CrvHitInfoReco(){}
30-
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);
36+
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);
3137
};
3238
typedef std::vector<CrvHitInfoReco> CrvHitInfoRecoCollection; //this is the reco vector which will be stored in the main TTree
3339
}

inc/CrvPulseInfoReco.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace mu2e
1414
XYZVectorF pos; //average position of counters
1515
int barId = -1; //CRV counter ID
1616
int sectorId = -1; //CRV sector ID
17-
int SiPMId = -1; //SiPMId number
17+
int SiPMId = -1; //SiPMId number //uses actual SiPM numbers for reco pulses of coincidence clusters - otherwise sequential SiPMIs generated by a SiPM map
1818
int PEs = -1; //PEs using pulse integral
1919
int PEsPulseHeight = -1; //PEs using pulse height
2020
float pulseHeight = -1; //Pulse height

src/CrvHitInfoReco.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#include "EventNtuple/inc/CrvHitInfoReco.hh"
22
#include "CLHEP/Vector/ThreeVector.h"
33
namespace mu2e {
4-
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) :
4+
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) :
55
sectorType(sectorType),
6+
hitPosAndTimeCalculated(hitPosAndTimeCalculated),
67
pos(hpos),
78
timeStart(timeWindowStart),
89
timeEnd(timeWindowEnd),
910
time(timeAvg),
1011
PEs(PEs),
1112
PEsPerLayer(PEsPerLayer),
1213
sidePEsPerLayer(sidePEsPerLayer),
14+
sidePulses(sidePulses),
15+
sidePEs(sidePEs),
16+
sideTimes(sideTimes),
1317
nHits(nCoincidenceHits),
1418
nLayers(nCoincidenceLayers),
15-
angle(coincidenceAngle)
19+
angle(coincidenceAngle),
20+
crvPulses(crvPulses)
1621
{}
1722
}

src/CrvInfoHelper.cc

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,21 @@ namespace mu2e
4444
std::array<float, CRVId::nLayers> PEsPerLayer_ = {0.};
4545
// Initialize PEs per layer per side
4646
std::array<float, CRVId::nLayers * CRVId::nSidesPerBar> sidePEsPerLayer_ = {0.};
47+
// Convert doubles to floats in side times
48+
std::array<float,CRVId::nSidesPerBar> sideTimes_ = {static_cast<float>(cluster.GetSideTimes()[0]), static_cast<float>(cluster.GetSideTimes()[1])};
49+
// Initiatlize RecoPulse vector
50+
CrvPulseInfoRecoCollection recoPulses; //this is the reco vector which will be stored in the main TTree
4751
for(size_t j=0; j<coincRecoPulses_.size(); j++) // Loop through the pulses
4852
{
4953
// Get PEs associated with this reco pulse
5054
float PEs = coincRecoPulses_.at(j)->GetPEs();
5155
// Get layer number from the bar index associated with this reco pulse
5256
const CRSScintillatorBarIndex &crvBarIndex = coincRecoPulses_.at(j)->GetScintillatorBarIndex();
53-
const CRSScintillatorBar &crvCounter = CRS->getBar(crvBarIndex);
54-
const CRSScintillatorBarId &crvCounterId = crvCounter.id();
55-
int layerNumber = crvCounterId.getLayerNumber();
57+
int sectorNumber = -1;
58+
int moduleNumber = -1;
59+
int layerNumber = -1;
60+
int counterNumber = -1;
61+
CrvHelper::GetCrvCounterInfo(CRS, crvBarIndex, sectorNumber, moduleNumber, layerNumber, counterNumber);
5662
// Get the side number
5763
// The negative side has SiPM indices 0 and 2, the postive side has indices 1 and 3.
5864
// zero/one index indicates negative/positive; negative/positive indicates direction wrt the axis in the coordinate system.
@@ -62,19 +68,31 @@ namespace mu2e
6268
// Sum PEs for this coincidence, indexed by layer number and side number
6369
int layerSideIndex = layerNumber * CRVId::nSidesPerBar + side; // Indices for a flattened 2D matrix: layers (rows), sides (columns)
6470
sidePEsPerLayer_[layerSideIndex] += PEs;
71+
72+
// Fill recoPulses
73+
const auto &recoPulse = coincRecoPulses_.at(j);
74+
CLHEP::Hep3Vector hitPos = CrvHelper::GetCrvCounterPos(CRS, crvBarIndex);
75+
recoPulses.emplace_back(tdet->toDetector(hitPos), crvBarIndex.asInt(), sectorNumber, recoPulse->GetSiPMNumber(),
76+
recoPulse->GetPEs(), recoPulse->GetPEsPulseHeight(), recoPulse->GetPulseHeight(),
77+
recoPulse->GetPulseBeta(), recoPulse->GetPulseFitChi2(), recoPulse->GetPulseTime());
6578
}
6679

6780
//fill the Reco collection
6881
recoInfo.emplace_back(
6982
cluster.GetCrvSectorType(),
83+
cluster.HitPosAndTimeCalculated(),
7084
tdet->toDetector(cluster.GetAvgHitPos()),
7185
cluster.GetStartTime(), cluster.GetEndTime(), cluster.GetAvgHitTime(),
7286
cluster.GetPEs(),
7387
PEsPerLayer_, // PEsPerLayer array is not a member of the mu2e::CrvCoincidenceCluster class
7488
sidePEsPerLayer_, // ""
89+
cluster.GetSideHits(),
90+
cluster.GetSidePEs(),
91+
sideTimes_,
7592
cluster.GetCrvRecoPulses().size(),
7693
cluster.GetLayers().size(),
77-
cluster.GetSlope());
94+
cluster.GetSlope(),
95+
recoPulses);
7896
}
7997

8098
if(!crvRecoPulses.isValid()) return;

0 commit comments

Comments
 (0)