All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Util.cc
Go to the documentation of this file.
1 #include "Util.h"
2 
3 namespace ana {
4 
5 // =============================== UTILITY FUNCTIONS ==============================
6 
7  // Determine if there is a PDS flash in time with the neutrino beam
8  bool CosmicIdUtils::BeamFlash(std::vector<double> flashes, double beamTimeMin, double beamTimeMax){
9  //
10  bool beamFlash = false;
11  std::sort(flashes.begin(), flashes.end());
12  // Loop over flashes in tpc 0
13  for(size_t i = 0; i < flashes.size(); i++){
14  double time = flashes[i];
15  if(time > beamTimeMin && time < beamTimeMax) beamFlash = true;
16  }
17 
18  return beamFlash;
19  }
20 
21  std::set<geo::TPCID> CosmicIdUtils::DetectedInTPCS(const std::vector<art::Ptr<recob::Hit>> &hits) {
22  std::set<geo::TPCID> ret;
23  for (const art::Ptr<recob::Hit> hit: hits) {
24  ret.insert(hit->WireID().asTPCID());
25  }
26  return ret;
27  }
28 
29 
30  geo::TPCID CosmicIdUtils::DetectedInTPC(const std::vector<art::Ptr<recob::Hit>> &hits) {
31  geo::TPCID ret; // constructor defaults to invalid
32  for (const art::Ptr<recob::Hit> hit: hits) {
33  if (!ret) ret = hit->WireID().asTPCID();
34  else if (ret != hit->WireID().asTPCID()) {
35  geo::TPCID invalid;
36  return invalid;
37  }
38  }
39  return ret;
40  }
41 
42 }
geo::TPCID DetectedInTPC(const std::vector< art::Ptr< recob::Hit >> &hits)
Definition: Util.cc:30
process_name hit
Definition: cheaterreco.fcl:51
process_name opflashCryoW ana
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::set< geo::TPCID > DetectedInTPCS(const std::vector< art::Ptr< recob::Hit >> &hits)
Definition: Util.cc:21
bool BeamFlash(std::vector< double > flashes, double beamTimeMin, double beamTimeMax)
Definition: Util.cc:8
The data type to uniquely identify a TPC.
Definition: geo_types.h:386