Skip to content

Commit a6615a7

Browse files
authored
Merge branch 'main' into main
2 parents 8059528 + 6264a51 commit a6615a7

12 files changed

Lines changed: 208 additions & 140 deletions

fcl/prolog.fcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ EventNtupleMaker : {
286286
FillTimeClusterInfo : false
287287
CaloClustersTag : "CaloClusterMaker"
288288
CaloHitsTag : "CaloHitMaker"
289-
CaloRecoDigisTag : ""
289+
CaloRecoDigisTag : "CaloRecoDigiMaker"
290290
CaloDigisTag : "SelectReco"
291291
FillCaloClusters : true
292292
FillCaloHits : true
@@ -315,6 +315,7 @@ EventNtupleMaker : {
315315
PrimaryParticleTag : "compressRecoMCs"
316316
KalSeedMCAssns : "SelectReco"
317317
CaloClusterMCTag : "compressRecoMCs"
318+
CaloHitMCTag : "compressRecoMCs"
318319
InfoMCStructHelper : {
319320
SimParticleCollectionTag : "compressRecoMCs"
320321
MinGoodMomFraction : 0.9

helper/ntuplehelper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,11 @@ def list_all_branches(self, export_to_md=False):
246246
else:
247247
print("## Calorimeter Branches\n")
248248
print("These branches are vectors of calorimeter clusters/hits/recodigis/digis that happened during the event.")
249-
print("The branch is empty if there are no calo cluster during the event.\n")
250249
print("While each branch can be read independently, i.e. all the hits of the event, each element contains indexes to the other branches for parentage link.")
251250
print("The cluster element contains the vector \'hits_\' containing the indexes of the hits branch belonging to this cluster.")
252251
print("Similarly, each hit contains the indexes of its two recodigis (left and right channels) and the index of its parent cluster.")
253252
print("Example: cluster 3 has hits_ = {12, 13, 14, 15}. Each of those hits will have \'clusterIdx_\' = 3.")
254-
print("Calo hits have the crystal (x,y,z) position saved. Frame origin is center of tracker.")
253+
print("Calo digis and hits have the crystal (x,y,z) position saved. Frame origin is center of tracker.")
255254
print("| branch | structure | explanation | leaf information |")
256255
print("|--------|-----------|-------------|------------------|")
257256
for branch in self.calo_branches:

inc/CaloClusterInfoMC.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace mu2e
88
{
99
struct CaloClusterInfoMC {
10+
int nhits; // number of hitmc associated with this cluster
1011
int nsim; // # of sim particles associated with this cluster
1112
float etot; // total true energy from all particles in this cluster
1213
float tavg; // average time over all particles

inc/CaloDigiInfo.hh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,32 @@
55
#define CaloDigiInfo_HH
66

77
#include <vector>
8+
#include "Offline/RecoDataProducts/inc/CaloDigi.hh"
89

910
namespace mu2e
1011
{
1112
struct CaloDigiInfo {
1213

1314
int SiPMID_; // Offline SiPM ID number
14-
int diskID_; // Offline disk ID number
1515
int t0_; // Time of first waveform sample
1616
std::vector<int> waveform_; // Waveform
1717
int peakpos_; // Waveform index of peak
18+
19+
// not in dataproduct
20+
int diskID_; // Offline disk ID number
1821
int caloRecoDigiIdx_; // RecoDigi index
19-
float posX_; // Crystal x position in detector frame
20-
float posY_; // Crystal y position in detector frame
22+
int peakval_; // Waveform value at peak
23+
XYZVectorF crystalPos_; // Crystal position
2124

22-
CaloDigiInfo() : SiPMID_(-1), t0_(0), waveform_(), peakpos_(0), caloRecoDigiIdx_(-1), posX_(0.0), posY_(0.0) {}
25+
CaloDigiInfo() : SiPMID_(-1), t0_(0), waveform_(), peakpos_(0), diskID_(-1), caloRecoDigiIdx_(-1), peakval_(0), crystalPos_() {}
2326
void reset() { *this = CaloDigiInfo(); }
27+
28+
bool operator== (const CaloDigi& other) const {
29+
return SiPMID_ == other.SiPMID() &&
30+
t0_ == other.t0() &&
31+
peakpos_ == other.peakpos() &&
32+
waveform_.size() == other.waveform().size(); //no need to check the entire waveform
33+
}
2434
};
2535
}
2636
#endif

inc/CaloHitInfo.hh

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

77
#include <vector>
88
#include "EventNtuple/inc/RootVectors.hh"
9+
#include "Offline/RecoDataProducts/inc/CaloHit.hh"
910

1011
namespace mu2e
1112
{
@@ -18,12 +19,23 @@ namespace mu2e
1819
float eDep_; // Hit energy
1920
float eDepErr_; // Hit energy error
2021
std::vector<int> recoDigis_; // vector of branch indices of reco digis
21-
int clusterIdx_; // Cluster index
2222

23+
// not in dataproduct
24+
int clusterIdx_; // Cluster index
2325
XYZVectorF crystalPos_; // Crystal position
2426

2527
CaloHitInfo() : crystalId_(0), nSiPMs_(0), time_(0.0), timeErr_(0.0), eDep_(0.0), eDepErr_(0.0), recoDigis_(), clusterIdx_(-1), crystalPos_() {}
2628
void reset() { *this = CaloHitInfo(); }
29+
30+
bool operator== (const CaloHit& other) const {
31+
const double eps = 1e-9;
32+
return crystalId_ == other.crystalID() &&
33+
nSiPMs_ == other.nSiPMs() &&
34+
std::abs(time_ - other.time()) < eps &&
35+
std::abs(timeErr_ - other.timeErr()) < eps &&
36+
std::abs(eDep_ - other.energyDep()) < eps &&
37+
std::abs(eDepErr_ - other.energyDepErr()) < eps;
38+
}
2739
};
2840
}
2941
#endif

inc/CaloHitInfoMC.hh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
#ifndef CaloHitInfoMC_HH
55
#define CaloHitInfoMC_HH
66
#include "Offline/MCDataProducts/inc/MCRelationship.hh"
7+
#include "Offline/MCDataProducts/inc/CaloHitMC.hh"
8+
79
namespace mu2e
810
{
911
struct CaloHitInfoMC {
1012

13+
int crystalID_; // Crystal ID of the hit
1114
int nsim; // # of sim particles associated with this hit
1215
float eDep; // total (corrected) deposited energy in the hit
1316
float eDepG4; // total G4 deposited energy in the hit
@@ -20,9 +23,25 @@ namespace mu2e
2023
std::vector<MCRelationship> simRels; // relationship to the particle that deposited the most energy in the calo Hit
2124
int clusterIdx_; // Cluster index
2225

23-
CaloHitInfoMC() : nsim(0), eDep(0.0), eDepG4(0.0), eprimary(0.0), tprimary(0.0), clusterIdx_(-1){}
26+
CaloHitInfoMC() : crystalID_(0), nsim(0), eDep(0.0), eDepG4(0.0), eprimary(0.0), tprimary(0.0), clusterIdx_(-1){}
2427

2528
void reset() { *this = CaloHitInfoMC(); }
29+
30+
bool operator== (const CaloHitMC& other) const {
31+
const double eps = 1e-9;
32+
auto const& edeps = other.energyDeposits();
33+
bool same1 = crystalID_ == other.crystalID() &&
34+
nsim == int(edeps.size()) &&
35+
std::abs(eDep - other.totalEnergyDep()) < eps &&
36+
std::abs(eDepG4 - other.totalEnergyDepG4()) < eps;
37+
if (nsim > 0){ //Only compare first edep if exists
38+
return same1 &&
39+
std::abs(eprimary - edeps.front().energyDep()) < eps &&
40+
std::abs(tprimary - edeps.front().time()) < eps;
41+
} else {
42+
return same1;
43+
}
44+
}
2645
};
2746
}
2847
#endif

inc/CaloRecoDigiInfo.hh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "CLHEP/Vector/ThreeVector.h"
88
#include "CLHEP/Units/PhysicalConstants.h"
99
#include <vector>
10+
#include "Offline/RecoDataProducts/inc/CaloRecoDigi.hh"
1011

1112
namespace mu2e
1213
{
@@ -20,10 +21,24 @@ namespace mu2e
2021
unsigned ndf_; // Fit NDF
2122
bool pileUp_; // Flag indicating if the hit is affected by pile-up
2223
int caloDigiIdx_; // Index to the associated CaloDigi
24+
25+
// not in dataproduct
2326
int caloHitIdx_; // Hit index
27+
int SiPMID_; // Offline SiPM ID number
2428

25-
CaloRecoDigiInfo() : eDep_(0.0), eDepErr_(0.0), time_(0.0), timeErr_(0.0), chi2_(0.0), ndf_(0), pileUp_(false), caloDigiIdx_(-1), caloHitIdx_(-1) {}
29+
CaloRecoDigiInfo() : eDep_(0.0), eDepErr_(0.0), time_(0.0), timeErr_(0.0), chi2_(0.0), ndf_(0), pileUp_(false), caloDigiIdx_(-1), caloHitIdx_(-1), SiPMID_(0) {}
2630
void reset() { *this = CaloRecoDigiInfo(); }
31+
32+
bool operator== (const CaloRecoDigi& other) const {
33+
const double eps = 1e-9;
34+
return std::abs(eDep_ - other.energyDep()) < eps &&
35+
std::abs(eDepErr_ - other.energyDepErr()) < eps &&
36+
std::abs(time_ - other.time()) < eps &&
37+
std::abs(timeErr_ - other.timeErr()) < eps &&
38+
std::abs(chi2_ - other.chi2()) < eps &&
39+
ndf_ == other.ndf() &&
40+
pileUp_ == other.pileUp();
41+
}
2742
};
2843
}
2944
#endif

inc/InfoMCStructHelper.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace mu2e {
7575
void fillVDInfo(KalSeed const& kseed, const KalSeedMC& kseedmc, std::vector<std::vector<MCStepInfo>>& all_vdinfos);
7676
void fillHitInfoMCs(const KalSeed& kseed, const KalSeedMC& kseedmc, std::vector<std::vector<TrkStrawHitInfoMC>>& all_tshinfomcs);
7777
void fillCaloClusterInfoMC(CaloClusterMC const& ccmc, std::vector<CaloClusterInfoMC>& ccimc);
78-
void fillCaloHitInfoMC(CaloHitMC const& chmc, std::vector<CaloHitInfoMC>& chimc, int clusterIdx);
78+
void fillCaloHitInfoMC(CaloHitMC const& chmc, std::vector<CaloHitInfoMC>& chimc, int clusterIdx = -1);
7979
void fillCaloDigiMCInfo(CaloShowerSim const& shower, std::vector<CaloDigiMCInfo>& calodigimc);
8080
void fillCaloDigiSimInfos(CaloShowerSim const& shower, std::vector<SimInfo>& cdsis);
8181
void fillCaloSimInfos(CaloClusterMC const& ccmc, std::vector<SimInfo>& csis);

0 commit comments

Comments
 (0)