@@ -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- */
348336bool 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
404392bool 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
413400bool 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 }
0 commit comments