Skip to content

Commit 7c0707e

Browse files
committed
Made small cosmetic changes. Changed BNBLight window values to better ones based on a tophat study. Added producer to the reco2 workflow
1 parent ef80c75 commit 7c0707e

5 files changed

Lines changed: 51 additions & 63 deletions

File tree

sbndcode/CRT/CRTVeto/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
art_make_library(
42
LIBRARIES
53
sbnobj::SBND_CRT

sbndcode/CRT/CRTVeto/CRTVetoProducer_module.cc

Lines changed: 41 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class sbnd::crt::CRTVetoProducer : public art::EDProducer {
5959
CRTVetoProducer& operator=(CRTVetoProducer&&) = delete;
6060

6161
void produce(art::Event& e) override;
62-
//void beginJob() override;
62+
6363
bool SPECTDCReference(art::Event& e, const uint64_t &raw_ts, uint64_t &ref_time, const uint32_t channel);
6464

6565
// Functions to check if a point is in a specific Tagger
@@ -80,23 +80,19 @@ class sbnd::crt::CRTVetoProducer : public art::EDProducer {
8080
std::string fCRTTimingReferenceInfoLabel;
8181
std::string fSPECTDCModuleLabel;
8282
bool fIsData;
83-
83+
bool fDebug;
84+
8485
// raw timestamp correction variables
8586
std::string fDAQHeaderModuleLabel;
8687
std::string fDAQHeaderInstanceLabel;
8788
uint32_t fRawTSCorrection;
8889
uint32_t fMaxAllowedRefTimeDiff;
8990

90-
std::vector<int> fVetoSpacePointIndices;
9191
std::vector<art::Ptr<CRTSpacePoint>> fVetoSpacePoints;
9292

93-
std::vector<double> fVetoSouthTimes;
94-
95-
// store South Wall Top Hat for debugging
9693
unsigned int fEventID;
9794
unsigned int fRun;
9895
unsigned int fSubRun;
99-
//TNtuple *fSouth_tree;
10096

10197
};
10298

@@ -111,6 +107,7 @@ sbnd::crt::CRTVetoProducer::CRTVetoProducer(fhicl::ParameterSet const& p)
111107
, fCRTTimingReferenceInfoLabel(p.get<std::string>("CRTTimingReferenceInfoLabel"))
112108
, fSPECTDCModuleLabel(p.get<std::string>("SPECTDCModuleLabel", ""))
113109
, fIsData(p.get<bool>("IsData"))
110+
, fDebug(p.get<bool>("Debug", false))
114111
, fDAQHeaderModuleLabel(p.get<std::string>("DAQHeaderModuleLabel", ""))
115112
, fDAQHeaderInstanceLabel(p.get<std::string>("DAQHeaderInstanceLabel", ""))
116113
, fRawTSCorrection(p.get<uint32_t>("RawTSCorrection", 0))
@@ -124,19 +121,17 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
124121
{
125122

126123
fVetoSpacePoints.clear();
127-
fVetoSpacePointIndices.clear();
128124

129-
fVetoSouthTimes.clear();
130-
131125
fEventID = e.id().event();
132126
fRun = e.run();
133127
fSubRun = e.subRun();
134128

135-
std::cout << std::endl;
136-
std::cout << "Filling CRTVeto for Run " << fRun << " SubRun " << fSubRun << " Event " << fEventID << std::endl;
137-
std::cout << std::endl;
129+
if (fDebug) {
130+
std::cout << std::endl;
131+
std::cout << "Filling CRTVeto for Run " << fRun << " SubRun " << fSubRun << " Event " << fEventID << std::endl;
132+
std::cout << std::endl;
133+
}
138134

139-
// May only be needed for BNB+Light Data --> TODO
140135
uint64_t raw_ts = 0;
141136
int64_t ref_time = 0;
142137
int64_t ref_time_ns = 0;
@@ -151,7 +146,8 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
151146

152147
if(DAQHeaderHandle.isValid())
153148
{
154-
std::cout << "DAQHeader is valid --> Calculate raw ts" << std::endl;
149+
if (fDebug)
150+
std::cout << "DAQHeader is valid --> Calculate raw ts" << std::endl;
155151
artdaq::RawEvent rawHeaderEvent = artdaq::RawEvent(*DAQHeaderHandle);
156152
raw_ts = rawHeaderEvent.timestamp() - fRawTSCorrection;
157153
}
@@ -167,10 +163,12 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
167163
// If we don't find this --> return false
168164
if (TType != 0 || TChannel != 4) {
169165

170-
std::cout << std::endl;
171-
std::cout << "ETrig was not referenced for this event --> Don't Flag Event!" << std::endl;
172-
std::cout << std::endl;
173-
auto crtveto = std::make_unique<CRTVeto>(false, false, false, false, false, fVetoSouthTimes);
166+
if (fDebug) {
167+
std::cout << std::endl;
168+
std::cout << "ETrig was not referenced for this event --> Don't Flag Event!" << std::endl;
169+
std::cout << std::endl;
170+
}
171+
auto crtveto = std::make_unique<CRTVeto>(false, false, false, false, false);
174172
auto vetoVec = std::make_unique<std::vector<CRTVeto>>();
175173
vetoVec->push_back(*crtveto);
176174
auto vetoSpacePointAssn = std::make_unique<art::Assns<CRTVeto, CRTSpacePoint>>();
@@ -192,11 +190,13 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
192190

193191
}
194192
else {
195-
std::cout << std::endl;
196-
std::cout << std::endl;
197-
std::cout << "Was NOT able to reference time to the RWM !!!" << std::endl;
198-
std::cout << std::endl;
199-
std::cout << std::endl;
193+
if (fDebug) {
194+
std::cout << std::endl;
195+
std::cout << std::endl;
196+
std::cout << "Was NOT able to reference time to the RWM !!!" << std::endl;
197+
std::cout << std::endl;
198+
std::cout << std::endl;
199+
}
200200
}
201201
ref_time_ns = ref_time % static_cast<int64_t>(1e9);
202202

@@ -207,7 +207,8 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
207207
art::Handle<std::vector<CRTCluster>> CRTClusterHandle;
208208
e.getByLabel(fCRTClusterModuleLabel, CRTClusterHandle);
209209
if(!CRTClusterHandle.isValid()){
210-
std::cout << "CRTCluster product " << fCRTClusterModuleLabel << " not found..." << std::endl;
210+
if (fDebug)
211+
std::cout << "CRTCluster product " << fCRTClusterModuleLabel << " not found..." << std::endl;
211212
throw std::exception();
212213
}
213214
std::vector<art::Ptr<CRTCluster>> CRTClusterVec;
@@ -226,9 +227,11 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
226227
// loop over clusters in this event
227228
// Note: there are usually more clusters than space points
228229
//
229-
std::cout << std::endl;
230-
std::cout << "Start Loop over Clusters ..." << std::endl;
231-
std::cout << std::endl;
230+
if (fDebug) {
231+
std::cout << std::endl;
232+
std::cout << "Start Loop over Clusters ..." << std::endl;
233+
std::cout << std::endl;
234+
}
232235
for(auto const &cluster : CRTClusterVec) {
233236

234237
std::vector<art::Ptr<CRTSpacePoint>> clusterSpacePoints = cluster_sps.at(cluster.key());
@@ -252,11 +255,9 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
252255
// We Found a Space Point in our Veto Window !!!
253256

254257
fVetoSpacePoints.push_back(sp);
255-
fVetoSpacePointIndices.push_back(sp.key());
258+
//fVetoSpacePointIndices.push_back(sp.key());
256259

257260
if (inSouth(tag)) {
258-
//fSouth_tree->Fill(fRun, fSubRun, fEventID, t);
259-
fVetoSouthTimes.push_back(t);
260261
S += 1;
261262
}
262263
else if (inNorth(tag)) {
@@ -275,13 +276,16 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
275276
TH += 1;
276277
}
277278
else {
278-
std::cout << "Not a valid SpacePoint --> Outside Geometry !!!" << std::endl;
279+
if (fDebug)
280+
std::cout << "Not a valid SpacePoint --> Outside Geometry !!!" << std::endl;
279281
}
280282
} // end loop over space points
281283
} // end of loop over clusters
282284

283-
std::cout << "Finished Loop over Clusters --> Produce CRTVeto products" << std::endl;
284-
std::cout << std::endl;
285+
if (fDebug) {
286+
std::cout << "Finished Loop over Clusters --> Produce CRTVeto products" << std::endl;
287+
std::cout << std::endl;
288+
}
285289

286290
int Nwalls_all = S + N + E + W;
287291
int Nwalls_noNorth = S + E + W;
@@ -309,42 +313,26 @@ void sbnd::crt::CRTVetoProducer::produce(art::Event& e)
309313
if ( (Nwalls_noNorth > 0) || ((TL > 0) && (TH > 0)) ) {
310314
v3 = true;
311315
}
316+
// V4
312317
if (S > 0) {
313318
v4 = true;
314319
}
315320

316321
// Make Products for the Event
317-
auto crtveto = std::make_unique<CRTVeto>(v0, v1, v2, v3, v4, fVetoSouthTimes);
322+
// See sbnobj/SBND/CRT/CRTVeto.hh for description of V0, V1, V2, V3, V4
323+
auto crtveto = std::make_unique<CRTVeto>(v0, v1, v2, v3, v4);
318324
auto vetoVec = std::make_unique<std::vector<CRTVeto>>();
319325
vetoVec->push_back(*crtveto);
320326

321327
auto vetoSpacePointAssn = std::make_unique<art::Assns<CRTVeto, CRTSpacePoint>>();
322328

323-
//auto const vetoPtrMaker = art::PtrMaker<CRTVeto>(e);
324-
//auto const vetoPtr = vetoPtrMaker(0);
325-
//auto const CRTSpacePointPtrMaker = art::PtrMaker<CRTSpacePoint>(e, CRTSpacePointHandle.id());
326-
327-
if (fVetoSpacePoints.size() != fVetoSpacePointIndices.size()) {
328-
std::cout << std::endl;
329-
std::cout << "Problem: Number of Space Points does not match!" << std::endl;
330-
std::cout << std::endl;
331-
}
332-
333329
util::CreateAssn(*this, e, *vetoVec, fVetoSpacePoints, *vetoSpacePointAssn);
334330

335331
e.put(std::move(vetoVec));
336332
e.put(std::move(vetoSpacePointAssn));
337333

338334
} // end of produce
339-
/*
340-
void sbnd::crt::CRTVetoProducer::beginJob()
341-
{
342-
art::ServiceHandle<art::TFileService> tfs;
343-
344-
fSouth_tree = tfs->make<TNtuple>("crtveto_south_tree", "crtveto_south_tree", "run:subrun:evt:t");
345335

346-
}
347-
*/
348336
bool sbnd::crt::CRTVetoProducer::SPECTDCReference(art::Event& e, const uint64_t &raw_ts, uint64_t &ref_time, const uint32_t channel)
349337
{
350338
bool found = false;
@@ -403,7 +391,6 @@ bool sbnd::crt::CRTVetoProducer::inNorth(const CRTTagger t)
403391

404392
bool sbnd::crt::CRTVetoProducer::inEast(const CRTTagger t)
405393
{
406-
//east_sel = "x < -380 and z < 770 and -370 < y < 400"
407394
if (t == kEastTagger) {
408395
return true;
409396
}
@@ -412,7 +399,6 @@ bool sbnd::crt::CRTVetoProducer::inEast(const CRTTagger t)
412399

413400
bool sbnd::crt::CRTVetoProducer::inWest(const CRTTagger t)
414401
{
415-
//west_sel = "x < -380 and z < 770 and -370 < y < 400"
416402
if (t == kWestTagger) {
417403
return true;
418404
}

sbndcode/CRT/CRTVeto/crtvetoproducer_sbnd.fcl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ crtvetoproducer_sbnd:
1919
crtvetoproducer_data_sbnd: @local::crtvetoproducer_sbnd
2020
crtvetoproducer_data_sbnd.CRTGeoAlg: @local::crtgeoalg_data_sbnd
2121
crtvetoproducer_data_sbnd.IsData: true
22-
#crtvetoproducer_data_sbnd.WindowStart: 0.365
23-
#crtvetoproducer_data_sbnd.WindowEnd: 2.065
2422

2523
# Values for testing
26-
crtvetoproducer_data_sbnd.WindowStart: -1.135
27-
crtvetoproducer_data_sbnd.WindowEnd: 0.565
24+
crtvetoproducer_data_sbnd.WindowStart: -1.185
25+
crtvetoproducer_data_sbnd.WindowEnd: 0.515
2826
crtvetoproducer_data_sbnd.SPECTDCModuleLabel: "tdcdecoder"
2927

3028
crtvetoproducer_data_sbnd.DAQHeaderModuleLabel: "daq"

sbndcode/JobConfigurations/standard/reco/config/workflow_reco2.fcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "calorimetry_sbnd.fcl"
55
#include "sbnd_flashfinder_deco.fcl"
66
#include "crtrecoproducers_sbnd.fcl"
7+
#include "crtvetoproducer_sbnd.fcl"
78
#include "particleid_sbnd.fcl"
89
#include "crttpcmatchingproducers_sbnd.fcl"
910

@@ -49,6 +50,9 @@ sbnd_reco2_producers:{
4950
crtspacepoints: @local::crtspacepointproducer_sbnd
5051
crttracks: @local::crttrackproducer_sbnd
5152

53+
### CRT Veto
54+
crtveto: @local::crtvetoproducer_sbnd
55+
5256
### CRT-TPC matching
5357
crtspacepointmatching: @local::crtspacepointmatchproducer_sbnd
5458
crttrackmatching: @local::crttrackmatchproducer_sbnd
@@ -85,6 +89,7 @@ sbnd_reco2_producer_sequence: [
8589
, crtclustering
8690
, crtspacepoints
8791
, crttracks
92+
, crtveto
8893
, crtspacepointmatching
8994
, crttrackmatching
9095
, fmatch

sbndcode/JobConfigurations/standard/reco/reco2_data.fcl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ physics.producers:
1616
crtclustering: @local::crtclusterproducer_data_sbnd
1717
crtspacepoints: @local::crtspacepointproducer_data_sbnd
1818
crttracks: @local::crttrackproducer_data_sbnd
19+
crtveto: @local::crtvetoproducer_data_sbnd
1920
}
2021

2122
physics.reco2: [ pandora, pandoraTrack, pandoraShower, pandoraShowerSBN, pandoraCaloData, pandoraPidData, caloskimCalorimetry,
22-
crtclustering, crtspacepoints, crttracks, cvn ]
23+
crtclustering, crtspacepoints, crttracks, crtveto, cvn ]
2324

2425
physics.analyzers.caloskim.G4producer: ""
2526
physics.analyzers.caloskim.SimChannelproducer: ""
2627
physics.caloskimana_tpconly: [ caloskim ]
27-
physics.end_paths: [stream1, caloskimana_tpconly]
28+
physics.end_paths: [stream1, caloskimana_tpconly]

0 commit comments

Comments
 (0)