All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
cosmic::CosmicClusterTagger Class Reference
Inheritance diagram for cosmic::CosmicClusterTagger:

Public Member Functions

 CosmicClusterTagger (fhicl::ParameterSet const &p)
 
void produce (art::Event &e) override
 

Private Attributes

std::string fClusterModuleLabel
 
int fDetectorWidthTicks
 
int fTickLimit
 
int fMinTickDrift
 
int fMaxTickDrift
 

Detailed Description

Definition at line 34 of file CosmicClusterTagger_module.cc.

Constructor & Destructor Documentation

cosmic::CosmicClusterTagger::CosmicClusterTagger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 48 of file CosmicClusterTagger_module.cc.

48  : EDProducer{p}
49 {
50  auto const* geo = lar::providerFrom<geo::Geometry>();
51 
52  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
53  auto const detp =
54  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob(clock_data);
55  double const samplingRate = sampling_rate(clock_data);
56  fClusterModuleLabel = p.get<std::string>("ClusterModuleLabel", "cluster");
57  fTickLimit = p.get<int>("TickLimit", 0);
58  const double driftVelocity = detp.DriftVelocity(detp.Efield(), detp.Temperature()); // cm/us
59 
61  2 * geo->DetHalfWidth() / (driftVelocity * samplingRate / 1000); // ~3200 for uB
62  fMinTickDrift = p.get("MinTickDrift", 3200);
64 
65  produces<std::vector<anab::CosmicTag>>();
66  produces<art::Assns<recob::Cluster, anab::CosmicTag>>();
67 }
pdgs p
Definition: selectors.fcl:22
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.

Member Function Documentation

void cosmic::CosmicClusterTagger::produce ( art::Event &  e)
override

Definition at line 70 of file CosmicClusterTagger_module.cc.

71 {
72  std::unique_ptr<std::vector<anab::CosmicTag>> cosmicTagClusterVector(
73  new std::vector<anab::CosmicTag>);
74  std::unique_ptr<art::Assns<recob::Cluster, anab::CosmicTag>> assnOutCosmicTagCluster(
75  new art::Assns<recob::Cluster, anab::CosmicTag>);
76 
77  art::Handle<std::vector<recob::Cluster>> Cluster_h;
78  e.getByLabel(fClusterModuleLabel, Cluster_h);
79  std::vector<art::Ptr<recob::Cluster>> ClusterVec;
80  art::fill_ptr_vector(ClusterVec, Cluster_h);
81 
82  /////////////////////////////////
83  // LOOP OVER CLUSTERS
84  /////////////////////////////////
85 
86  for (unsigned int iCluster = 0; iCluster < Cluster_h->size(); iCluster++) {
87 
88  float cosmicScore = 0;
89  anab::CosmicTagID_t tag_id = anab::CosmicTagID_t::kUnknown;
90 
91  art::Ptr<recob::Cluster> tCluster = ClusterVec.at(iCluster);
92  // art::Ptr<recob::Track> tTrack; // unused
93 
94  std::vector<float> endPt1;
95  std::vector<float> endPt2;
96 
97  // Doing some checks on the cluster to determine if it's a cosmic
98  bool failClusterTickCheck = false;
99 
100  auto const [t0, t1] = std::minmax(tCluster->StartTick(), tCluster->EndTick());
101  if (t0 + fTickLimit < fMinTickDrift) { // This is into the pre-spill window
102  failClusterTickCheck = true;
103  }
104  if (t1 - fTickLimit > fMaxTickDrift) { // This is into the post-spill window
105  failClusterTickCheck = true;
106  }
107 
108  if (failClusterTickCheck) {
109  cosmicScore = 1.;
111  }
112 
113  if (endPt1.size() < 1) {
114  for (int s = 0; s < 3; s++) {
115  endPt1.push_back(-999);
116  endPt2.push_back(-999);
117  }
118  }
119 
120  // Making stuff to save!
121  cosmicTagClusterVector->emplace_back(endPt1, endPt2, cosmicScore, tag_id);
122 
123  util::CreateAssn(e, *cosmicTagClusterVector, tCluster, *assnOutCosmicTagCluster);
124  }
125 
126  /////////////////////////////////
127  // END OF CLUSTER LOOP
128  /////////////////////////////////
129 
130  e.put(std::move(cosmicTagClusterVector));
131  e.put(std::move(assnOutCosmicTagCluster));
132 
133 } // end of produce
std::pair< float, float > minmax(const float a, const float b)
minmax
enum anab::cosmic_tag_id CosmicTagID_t
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
do i e

Member Data Documentation

std::string cosmic::CosmicClusterTagger::fClusterModuleLabel
private

Definition at line 41 of file CosmicClusterTagger_module.cc.

int cosmic::CosmicClusterTagger::fDetectorWidthTicks
private

Definition at line 42 of file CosmicClusterTagger_module.cc.

int cosmic::CosmicClusterTagger::fMaxTickDrift
private

Definition at line 45 of file CosmicClusterTagger_module.cc.

int cosmic::CosmicClusterTagger::fMinTickDrift
private

Definition at line 44 of file CosmicClusterTagger_module.cc.

int cosmic::CosmicClusterTagger::fTickLimit
private

Definition at line 43 of file CosmicClusterTagger_module.cc.


The documentation for this class was generated from the following file: