Skip to content

Commit c2a1ff8

Browse files
committed
Change from ints to doubles everywhere
1 parent d63d8c1 commit c2a1ff8

8 files changed

Lines changed: 49 additions & 45 deletions

File tree

sbndcode/CRT/CRTAna/CRTAnalysis_module.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
159159
//strip hit to select the strip which has ADC above threshold
160160
std::vector<uint32_t> _sh_channel;
161161
std::vector<int16_t> _sh_tagger;
162-
std::vector<int64_t> _sh_ts0;
163-
std::vector<int64_t> _sh_ts1;
162+
std::vector<double> _sh_ts0;
163+
std::vector<double> _sh_ts1;
164164
std::vector<uint32_t> _sh_unixs;
165165
std::vector<double> _sh_pos;
166166
std::vector<double> _sh_err;
@@ -176,16 +176,16 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
176176
std::vector<double> _sh_truth_time;
177177

178178
//cluster from x-y coincidence for CRTSpacePoint , this is what we normally call a CRT hit
179-
std::vector<int64_t> _cl_ts0;
180-
std::vector<int64_t> _cl_ts1;
179+
std::vector<double> _cl_ts0;
180+
std::vector<double> _cl_ts1;
181181
std::vector<uint32_t> _cl_unixs;
182182
std::vector<uint16_t> _cl_nhits;
183183
std::vector<int16_t> _cl_tagger;
184184
std::vector<uint8_t> _cl_composition;
185185
std::vector<std::vector<uint32_t>> _cl_channel_set;
186186
std::vector<std::vector<uint16_t>> _cl_adc_set;
187-
std::vector<std::vector<uint32_t>> _cl_sh_ts0_set; //! To store t0 from x-y coincidences
188-
std::vector<std::vector<uint32_t>> _cl_sh_ts1_set; //! To store t1 from x-y coincidences
187+
std::vector<std::vector<double>> _cl_sh_ts0_set; //! To store t0 from x-y coincidences
188+
std::vector<std::vector<double>> _cl_sh_ts1_set; //! To store t1 from x-y coincidences
189189
std::vector<std::vector<uint16_t>> _cl_sh_feb_mac5_set; //! MAC5 addresses of StripHit FEBs
190190
std::vector<std::vector<double>> _cl_sh_time_walk_set; //! Time walk correction
191191
std::vector<std::vector<double>> _cl_sh_prop_delay_set; //! Light propagation correction
@@ -413,8 +413,8 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
413413

414414
fTree->Branch("sh_channel", "std::vector<uint32_t>", &_sh_channel);
415415
fTree->Branch("sh_tagger", "std::vector<int16_t>", &_sh_tagger);
416-
fTree->Branch("sh_ts0", "std::vector<int64_t>", &_sh_ts0);
417-
fTree->Branch("sh_ts1", "std::vector<int64_t>", &_sh_ts1);
416+
fTree->Branch("sh_ts0", "std::vector<double>", &_sh_ts0);
417+
fTree->Branch("sh_ts1", "std::vector<double>", &_sh_ts1);
418418
fTree->Branch("sh_unixs", "std::vector<uint32_t>", &_sh_unixs);
419419
fTree->Branch("sh_pos", "std::vector<double>", &_sh_pos);
420420
fTree->Branch("sh_err", "std::vector<double>", &_sh_err);
@@ -432,16 +432,16 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
432432
fTree->Branch("sh_truth_time", "std::vector<double>", &_sh_truth_time);
433433
}
434434

435-
fTree->Branch("cl_ts0", "std::vector<int64_t>", &_cl_ts0);
436-
fTree->Branch("cl_ts1", "std::vector<int64_t>", &_cl_ts1);
435+
fTree->Branch("cl_ts0", "std::vector<double>", &_cl_ts0);
436+
fTree->Branch("cl_ts1", "std::vector<double>", &_cl_ts1);
437437
fTree->Branch("cl_unixs", "std::vector<uint32_t>", &_cl_unixs);
438438
fTree->Branch("cl_nhits", "std::vector<uint16_t>", &_cl_nhits);
439439
fTree->Branch("cl_tagger", "std::vector<int16_t>", &_cl_tagger);
440440
fTree->Branch("cl_composition", "std::vector<uint8_t>", &_cl_composition);
441441
fTree->Branch("cl_channel_set", "std::vector<std::vector<uint32_t>>", &_cl_channel_set);
442442
fTree->Branch("cl_adc_set", "std::vector<std::vector<uint16_t>>", &_cl_adc_set);
443-
fTree->Branch("cl_sh_ts0_set", "std::vector<std::vector<uint32_t>>", &_cl_sh_ts0_set);
444-
fTree->Branch("cl_sh_ts1_set", "std::vector<std::vector<uint32_t>>", &_cl_sh_ts1_set);
443+
fTree->Branch("cl_sh_ts0_set", "std::vector<std::vector<double>>", &_cl_sh_ts0_set);
444+
fTree->Branch("cl_sh_ts1_set", "std::vector<std::vector<double>>", &_cl_sh_ts1_set);
445445
fTree->Branch("cl_sh_feb_mac5_set", "std::vector<std::vector<uint16_t>>", &_cl_sh_feb_mac5_set);
446446
fTree->Branch("cl_sh_time_walk_set", "std::vector<std::vector<double>>", &_cl_sh_time_walk_set);
447447
fTree->Branch("cl_sh_prop_delay_set", "std::vector<std::vector<double>>", &_cl_sh_prop_delay_set);

sbndcode/CRT/CRTReco/CRTClusterCharacterisationAlg.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ namespace sbnd::crt {
6969
const double pe = ADCToPE(hit0->Channel(), hit0->ADC1(), hit0->ADC2()) + ADCToPE(hit1->Channel(), hit1->ADC1(), hit1->ADC2());
7070
const double t0 = (hit0->Ts0() + hit1->Ts0()) / 2.;
7171
const double t1 = (hit0->Ts1() + hit1->Ts1()) / 2.;
72-
const double et0 = std::abs((double)hit0->Ts0() - (double)hit1->Ts0()) / 2.;
73-
const double et1 = std::abs((double)hit0->Ts1() - (double)hit1->Ts1()) / 2.;
72+
const double et0 = std::abs(hit0->Ts0() - hit1->Ts0()) / 2.;
73+
const double et1 = std::abs(hit0->Ts1() - hit1->Ts1()) / 2.;
7474

7575
spacepoint = CRTSpacePoint(pos, err, pe, t0 + fTimeOffset, et0, t1 + fTimeOffset, et1, false);
7676
return true;
@@ -208,11 +208,11 @@ namespace sbnd::crt {
208208
const double corr0 = TimingCorrectionOffset(dist0, pe0);
209209
const double corr1 = TimingCorrectionOffset(dist1, pe1);
210210

211-
t0 = ((double)hit0->Ts0() - corr0 + (double)hit1->Ts0() - corr1) / 2.;
212-
et0 = std::abs(((double)hit0->Ts0() - corr0) - ((double)hit1->Ts0() - corr1)) / 2.;
211+
t0 = (hit0->Ts0() - corr0 + hit1->Ts0() - corr1) / 2.;
212+
et0 = std::abs((hit0->Ts0() - corr0) - (hit1->Ts0() - corr1)) / 2.;
213213

214-
t1 = ((double)hit0->Ts1() - corr0 + (double)hit1->Ts1() - corr1) / 2.;
215-
et1 = std::abs(((double)hit0->Ts1() - corr0) - ((double)hit1->Ts1() - corr1)) / 2.;
214+
t1 = (hit0->Ts1() - corr0 + hit1->Ts1() - corr1) / 2.;
215+
et1 = std::abs((hit0->Ts1() - corr0) - (hit1->Ts1() - corr1)) / 2.;
216216
}
217217

218218
double CRTClusterCharacterisationAlg::TimingCorrectionOffset(const double &dist, const double &pe)

sbndcode/CRT/CRTReco/CRTClusterProducer_module.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class sbnd::crt::CRTClusterProducer : public art::EDProducer {
5555

5656
CRTGeoAlg fCRTGeoAlg;
5757
std::string fCRTStripHitModuleLabel;
58-
uint32_t fCoincidenceTimeRequirement;
58+
double fCoincidenceTimeRequirement;
5959
double fOverlapBuffer;
6060
bool fUseTs0;
6161
};
@@ -65,7 +65,7 @@ sbnd::crt::CRTClusterProducer::CRTClusterProducer(fhicl::ParameterSet const& p)
6565
: EDProducer{p}
6666
, fCRTGeoAlg(p.get<fhicl::ParameterSet>("CRTGeoAlg"))
6767
, fCRTStripHitModuleLabel(p.get<std::string>("CRTStripHitModuleLabel"))
68-
, fCoincidenceTimeRequirement(p.get<uint32_t>("CoincidenceTimeRequirement"))
68+
, fCoincidenceTimeRequirement(p.get<double>("CoincidenceTimeRequirement"))
6969
, fOverlapBuffer(p.get<double>("OverlapBuffer"))
7070
, fUseTs0(p.get<bool>("UseTs0"))
7171
{
@@ -146,7 +146,7 @@ std::vector<std::pair<sbnd::crt::CRTCluster, std::vector<art::Ptr<sbnd::crt::CRT
146146

147147
if(!used[ii])
148148
{
149-
const uint64_t timeDiff = fUseTs0 ? stripHit->Ts0() - initialStripHit->Ts0() :
149+
const double timeDiff = fUseTs0 ? stripHit->Ts0() - initialStripHit->Ts0() :
150150
stripHit->Ts1() - initialStripHit->Ts1();
151151

152152
if(timeDiff < fCoincidenceTimeRequirement)
@@ -242,7 +242,7 @@ sbnd::crt::CRTCluster sbnd::crt::CRTClusterProducer::CharacteriseCluster(const s
242242
const CRTStripGeo strip0 = fCRTGeoAlg.GetStrip(clusteredHits.at(0)->Channel());
243243
const CRTTagger tagger = fCRTGeoAlg.ChannelToTaggerEnum(clusteredHits.at(0)->Channel());
244244

245-
int64_t ts0 = 0, ts1 = 0;
245+
double ts0 = 0, ts1 = 0;
246246
uint64_t s = 0;
247247
CoordSet composition = kUndefinedSet;
248248

sbndcode/CRT/CRTReco/CRTStripHitProducer_module.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class sbnd::crt::CRTStripHitProducer : public art::EDProducer {
6262
std::vector<double> fErrorCoeff;
6363
bool fAllowFlag1;
6464
bool fApplyTs1Window;
65-
int64_t fTs1Min;
66-
int64_t fTs1Max;
65+
double fTs1Min;
66+
double fTs1Max;
6767
bool fCorrectForDifferentSecond;
6868
bool fReferenceTs0;
6969
int fTimingType;
@@ -86,8 +86,8 @@ sbnd::crt::CRTStripHitProducer::CRTStripHitProducer(fhicl::ParameterSet const& p
8686
, fErrorCoeff(p.get<std::vector<double>>("ErrorCoeff"))
8787
, fAllowFlag1(p.get<bool>("AllowFlag1"))
8888
, fApplyTs1Window(p.get<bool>("ApplyTs1Window"))
89-
, fTs1Min(p.get<int64_t>("Ts1Min", 0))
90-
, fTs1Max(p.get<int64_t>("Ts1Max", std::numeric_limits<int64_t>::max()))
89+
, fTs1Min(p.get<double>("Ts1Min", 0))
90+
, fTs1Max(p.get<double>("Ts1Max", std::numeric_limits<double>::max()))
9191
, fCorrectForDifferentSecond(p.get<bool>("CorrectForDifferentSecond"))
9292
, fReferenceTs0(p.get<bool>("ReferenceTs0"))
9393
, fTimingType(p.get<int>("TimingType", 0))
@@ -210,8 +210,8 @@ std::vector<sbnd::crt::CRTStripHit> sbnd::crt::CRTStripHitProducer::CreateStripH
210210

211211
// Correct for FEB readout cable length
212212
// (time is FEB-by-FEB not channel-by-channel)
213-
int64_t t0 = (int)data->Ts0() + (int)module.t0CableDelayCorrection;
214-
int64_t t1 = (int)data->Ts1() + (int)module.t1CableDelayCorrection;
213+
double t0 = (int)data->Ts0() + module.t0DelayCorrection;
214+
double t1 = (int)data->Ts1() + module.t1DelayCorrection;
215215

216216
if(fCorrectForDifferentSecond)
217217
{
@@ -227,12 +227,12 @@ std::vector<sbnd::crt::CRTStripHit> sbnd::crt::CRTStripHitProducer::CreateStripH
227227

228228
if(unix_diff == 1)
229229
{
230-
t0 -= static_cast<int>(1e9);
230+
t0 -= 1e9;
231231
unixs += 1;
232232
}
233233
else if(unix_diff == -1)
234234
{
235-
t0 += static_cast<int>(1e9);
235+
t0 += 1e9;
236236
unixs -= 1;
237237
}
238238
}

sbndcode/Calibration/CRT/CalibService/CRTCalibService_service.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ SBND::CRTCalibService::CRTCalibService(fhicl::ParameterSet const& pset)
8585
{
8686
std::stringstream linestream(line);
8787

88-
unsigned int mac5, offset;
88+
unsigned int mac5;
89+
double offset;
8990
linestream
9091
>> mac5
9192
>> offset;
@@ -101,7 +102,8 @@ SBND::CRTCalibService::CRTCalibService(fhicl::ParameterSet const& pset)
101102
{
102103
std::stringstream linestream(line);
103104

104-
unsigned int mac5, offset;
105+
unsigned int mac5;
106+
double offset;
105107
linestream
106108
>> mac5
107109
>> offset;
@@ -117,7 +119,8 @@ SBND::CRTCalibService::CRTCalibService(fhicl::ParameterSet const& pset)
117119
{
118120
std::stringstream linestream(line);
119121

120-
unsigned int mac5, offset;
122+
unsigned int mac5;
123+
double offset;
121124
linestream
122125
>> mac5
123126
>> offset;
@@ -133,7 +136,8 @@ SBND::CRTCalibService::CRTCalibService(fhicl::ParameterSet const& pset)
133136
{
134137
std::stringstream linestream(line);
135138

136-
unsigned int mac5, offset;
139+
unsigned int mac5;
140+
double offset;
137141
linestream
138142
>> mac5
139143
>> offset;

sbndcode/Commissioning/HitDumper_module.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ class Hitdumper : public art::EDAnalyzer {
208208
std::vector<int> _crt_strip_hit_module; ///< CRT strip hit module
209209
std::vector<int> _crt_strip_hit_channel; ///< CRT strip hit channel
210210
std::vector<int> _crt_strip_hit_orient; ///< CRT strip hit orientation (0 for y (horizontal) and 1 for x (vertical))
211-
std::vector<uint> _crt_strip_hit_t0; ///< CRT strip hit t0
212-
std::vector<uint> _crt_strip_hit_t1; ///< CRT strip hit t1
211+
std::vector<double> _crt_strip_hit_t0; ///< CRT strip hit t0
212+
std::vector<double> _crt_strip_hit_t1; ///< CRT strip hit t1
213213
std::vector<uint> _crt_strip_hit_adc1; ///< CRT strip hit adc1
214214
std::vector<uint> _crt_strip_hit_adc2; ///< CRT strip hit adc2
215215
std::vector<double> _crt_strip_hit_pos; ///< CRT strip hit position

sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace sbnd::crt {
8080

8181
if(std::find(usedModules.begin(), usedModules.end(), moduleName) == usedModules.end())
8282
{
83-
int32_t t0DelayCorrection = 0, t1DelayCorrection = 0;
83+
double t0DelayCorrection = 0, t1DelayCorrection = 0;
8484

8585
if(!fMC)
8686
{

sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,17 @@ namespace sbnd::crt {
134134
, orientation(0)
135135
, top(false)
136136
, adID(std::numeric_limits<uint16_t>::max())
137-
, t0CableDelayCorrection(0)
138-
, t1CableDelayCorrection(0)
137+
, t0DelayCorrection(0)
138+
, t1DelayCorrection(0)
139139
, invertedOrdering(false)
140140
, minos(false)
141141
, null(false)
142142
{}
143143

144144
CRTModuleGeo(const TGeoNode *moduleNode, const geo::AuxDetGeo &auxDet,
145145
const uint16_t _adID, const std::string &_taggerName,
146-
const int32_t _t0CableDelayCorrection,
147-
const int32_t _t1CableDelayCorrection,
146+
const double _t0DelayCorrection,
147+
const double _t1DelayCorrection,
148148
const bool _invertedOrdering,
149149
const bool _minos)
150150
{
@@ -189,8 +189,8 @@ namespace sbnd::crt {
189189
minZ = std::min(limitsWorld.Z(), limitsWorld2.Z());
190190
maxZ = std::max(limitsWorld.Z(), limitsWorld2.Z());
191191

192-
t0CableDelayCorrection = _t0CableDelayCorrection;
193-
t1CableDelayCorrection = _t1CableDelayCorrection;
192+
t0DelayCorrection = _t0DelayCorrection;
193+
t1DelayCorrection = _t1DelayCorrection;
194194

195195
invertedOrdering = _invertedOrdering;
196196
adID = _adID;
@@ -209,8 +209,8 @@ namespace sbnd::crt {
209209
uint16_t orientation;
210210
bool top;
211211
uint16_t adID;
212-
int32_t t0CableDelayCorrection;
213-
int32_t t1CableDelayCorrection;
212+
double t0DelayCorrection;
213+
double t1DelayCorrection;
214214
bool invertedOrdering;
215215
bool minos;
216216
bool null;

0 commit comments

Comments
 (0)