11 #include "art/Framework/Core/EDProducer.h"
12 #include "art/Framework/Core/ModuleMacros.h"
13 #include "art/Framework/Principal/Event.h"
14 #include "art/Framework/Services/Registry/ServiceHandle.h"
31 class CosmicClusterTagger;
38 void produce(art::Event&
e)
override;
50 auto const* geo = lar::providerFrom<geo::Geometry>();
52 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
54 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob(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());
61 2 * geo->DetHalfWidth() / (driftVelocity * samplingRate / 1000);
62 fMinTickDrift =
p.get(
"MinTickDrift", 3200);
63 fMaxTickDrift = fMinTickDrift + fDetectorWidthTicks;
65 produces<std::vector<anab::CosmicTag>>();
66 produces<art::Assns<recob::Cluster, anab::CosmicTag>>();
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>);
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);
86 for (
unsigned int iCluster = 0; iCluster < Cluster_h->size(); iCluster++) {
88 float cosmicScore = 0;
91 art::Ptr<recob::Cluster> tCluster = ClusterVec.at(iCluster);
94 std::vector<float> endPt1;
95 std::vector<float> endPt2;
98 bool failClusterTickCheck =
false;
100 auto const [
t0, t1] =
std::minmax(tCluster->StartTick(), tCluster->EndTick());
101 if (
t0 + fTickLimit < fMinTickDrift) {
102 failClusterTickCheck =
true;
104 if (t1 - fTickLimit > fMaxTickDrift) {
105 failClusterTickCheck =
true;
108 if (failClusterTickCheck) {
113 if (endPt1.size() < 1) {
114 for (
int s = 0;
s < 3;
s++) {
115 endPt1.push_back(-999);
116 endPt2.push_back(-999);
121 cosmicTagClusterVector->emplace_back(endPt1, endPt2, cosmicScore, tag_id);
123 util::CreateAssn(e, *cosmicTagClusterVector, tCluster, *assnOutCosmicTagCluster);
130 e.put(std::move(cosmicTagClusterVector));
131 e.put(std::move(assnOutCosmicTagCluster));
std::string fClusterModuleLabel
Utilities related to art service access.
void produce(art::Event &e) override
std::pair< float, float > minmax(const float a, const float b)
minmax
enum anab::cosmic_tag_id CosmicTagID_t
CosmicClusterTagger(fhicl::ParameterSet const &p)
Declaration of cluster object.
Provides recob::Track data product.
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
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
art framework interface to geometry description