Public Member Functions | Private Member Functions | Private Attributes | List of all members
cluster::DBcluster Class Reference
Inheritance diagram for cluster::DBcluster:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 DBcluster (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void produce (art::Event &evt)
 
void beginJob ()
 

Private Attributes

TH1F * fhitwidth
 
TH1F * fhitwidth_ind_test
 
TH1F * fhitwidth_coll_test
 
std::string fhitsModuleLabel
 
DBScanAlg fDBScan
 object that implements the DB scan algorithm More...
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 43 of file DBcluster_module.cc.

Constructor & Destructor Documentation

cluster::DBcluster::DBcluster ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 65 of file DBcluster_module.cc.

66  : EDProducer{pset}, fDBScan(pset.get<fhicl::ParameterSet>("DBScanAlg"))
67  {
68  fhitsModuleLabel = pset.get<std::string>("HitsModuleLabel");
69 
70  produces<std::vector<recob::Cluster>>();
71  produces<art::Assns<recob::Cluster, recob::Hit>>();
72  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
DBScanAlg fDBScan
object that implements the DB scan algorithm
std::string fhitsModuleLabel

Member Function Documentation

void cluster::DBcluster::beginJob ( )
privatevirtual

Reimplemented from art::EDProducer.

Definition at line 76 of file DBcluster_module.cc.

77  {
78  // get access to the TFile service
80 
81  fhitwidth = tfs->make<TH1F>(" fhitwidth", "width of hits in cm", 50000, 0, 5);
82  fhitwidth_ind_test = tfs->make<TH1F>("fhitwidth_ind_test", "width of hits in cm", 50000, 0, 5);
84  tfs->make<TH1F>("fhitwidth_coll_test", "width of hits in cm", 50000, 0, 5);
85  }
void cluster::DBcluster::produce ( art::Event evt)
privatevirtual
Todo:
: need to define start and end positions for this cluster and slopes for dTdW, dQdW

Implements art::EDProducer.

Definition at line 89 of file DBcluster_module.cc.

90  {
91 
92  //get a collection of clusters
93  std::unique_ptr<std::vector<recob::Cluster>> ccol(new std::vector<recob::Cluster>);
94  std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> assn(
96 
97  // prepare the algorithm to compute the cluster characteristics;
98  // we use the "standard" one here; configuration would happen here,
99  // but we are using the default configuration for that algorithm
100  ClusterParamsImportWrapper<StandardClusterParamsAlg> ClusterParamAlgo;
101 
103 
105  evt.getByLabel(fhitsModuleLabel, hitcol);
106 
107  // loop over all hits in the event and look for clusters (for each plane)
108  std::vector<art::Ptr<recob::Hit>> allhits;
109 
110  // get channel quality service:
111  lariov::ChannelStatusProvider const& channelStatus =
113 
114  lariov::ChannelStatusProvider::ChannelSet_t const BadChannels = channelStatus.BadChannels();
115 
116  // make a map of the geo::PlaneID to vectors of art::Ptr<recob::Hit>
117  std::map<geo::PlaneID, std::vector<art::Ptr<recob::Hit>>> planeIDToHits;
118  for (size_t i = 0; i < hitcol->size(); ++i)
119  planeIDToHits[hitcol->at(i).WireID().planeID()].push_back(art::Ptr<recob::Hit>(hitcol, i));
120 
121  auto const clock_data =
123  auto const det_prop =
125  util::GeometryUtilities const gser{*geom, clock_data, det_prop};
126  for (auto& itr : planeIDToHits) {
127 
128  geo::SigType_t sigType = geom->SignalType(itr.first);
129  allhits.resize(itr.second.size());
130  allhits.swap(itr.second);
131 
132  fDBScan.InitScan(clock_data, det_prop, allhits, BadChannels);
133 
134  //----------------------------------------------------------------
135  for (unsigned int j = 0; j < fDBScan.fps.size(); ++j) {
136 
137  if (allhits.size() != fDBScan.fps.size()) break;
138 
139  fhitwidth->Fill(fDBScan.fps[j][2]);
140 
141  if (sigType == geo::kInduction) fhitwidth_ind_test->Fill(fDBScan.fps[j][2]);
142  if (sigType == geo::kCollection) fhitwidth_coll_test->Fill(fDBScan.fps[j][2]);
143  }
144 
145  //*******************************************************************
147 
148  for (size_t i = 0; i < fDBScan.fclusters.size(); ++i) {
149  art::PtrVector<recob::Hit> clusterHits;
150  double totalQ = 0.;
151 
152  for (size_t j = 0; j < fDBScan.fpointId_to_clusterId.size(); ++j) {
153  if (fDBScan.fpointId_to_clusterId[j] == i) {
154  clusterHits.push_back(allhits[j]);
155  totalQ += clusterHits.back()->Integral();
156  }
157  }
158 
159  if (clusterHits.empty()) continue;
160 
161  /// \todo: need to define start and end positions for this cluster and slopes for dTdW, dQdW
162  const geo::WireID& wireID = clusterHits.front()->WireID();
163  unsigned int sw = wireID.Wire;
164  unsigned int ew = clusterHits.back()->WireID().Wire;
165 
166  // feed the algorithm with all the cluster hits
167  ClusterParamAlgo.ImportHits(gser, clusterHits);
168 
169  // create the recob::Cluster directly in the vector
170  ClusterCreator cluster(gser,
171  ClusterParamAlgo, // algo
172  float(sw), // start_wire
173  0., // sigma_start_wire
174  clusterHits.front()->PeakTime(), // start_tick
175  clusterHits.front()->SigmaPeakTime(), // sigma_start_tick
176  float(ew), // end_wire
177  0., // sigma_end_wire,
178  clusterHits.back()->PeakTime(), // end_tick
179  clusterHits.back()->SigmaPeakTime(), // sigma_end_tick
180  ccol->size(), // ID
181  clusterHits.front()->View(), // view
182  wireID.planeID(), // plane
183  recob::Cluster::Sentry // sentry
184  );
185 
186  ccol->emplace_back(cluster.move());
187 
188  // associate the hits to this cluster
189  util::CreateAssn(evt, *ccol, clusterHits, *assn);
190 
191  } //end loop over fclusters
192 
193  allhits.clear();
194  } // end loop over PlaneID map
195 
196  mf::LogVerbatim("Summary") << std::setfill('-') << std::setw(175) << "-" << std::setfill(' ');
197  mf::LogVerbatim("Summary") << "DBcluster Summary:";
198  for (unsigned int i = 0; i < ccol->size(); ++i)
199  mf::LogVerbatim("Summary") << ccol->at(i);
200 
201  evt.put(std::move(ccol));
202  evt.put(std::move(assn));
203 
204  return;
205  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
virtual ChannelSet_t BadChannels() const =0
Returns a copy of set of bad channel IDs for the current run.
std::set< raw::ChannelID_t > ChannelSet_t
Type of set of channel IDs.
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
std::vector< std::vector< double > > fps
the collection of points we are working on
Definition: DBScanAlg.h:72
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
Cluster finding and building.
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:182
DBScanAlg fDBScan
object that implements the DB scan algorithm
reference back()
Definition: PtrVector.h:387
std::vector< unsigned int > fpointId_to_clusterId
mapping point_id -> clusterId
Definition: DBScanAlg.h:73
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
Signal from induction planes.
Definition: geo_types.h:145
enum geo::_plane_sigtype SigType_t
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
Class providing information about the quality of channels.
bool empty() const
Definition: PtrVector.h:330
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
std::string fhitsModuleLabel
reference front()
Definition: PtrVector.h:373
void InitScan(const detinfo::DetectorClocksData &clockData, const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &allhits, std::set< uint32_t > badChannels, const std::vector< geo::WireID > &wireids=std::vector< geo::WireID >())
Definition: DBScanAlg.cxx:272
std::vector< std::vector< unsigned int > > fclusters
collection of something
Definition: DBScanAlg.h:71
constexpr PlaneID const & planeID() const
Definition: geo_types.h:638
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
Signal from collection planes.
Definition: geo_types.h:146

Member Data Documentation

DBScanAlg cluster::DBcluster::fDBScan
private

object that implements the DB scan algorithm

Definition at line 57 of file DBcluster_module.cc.

std::string cluster::DBcluster::fhitsModuleLabel
private

Definition at line 55 of file DBcluster_module.cc.

TH1F* cluster::DBcluster::fhitwidth
private

Definition at line 51 of file DBcluster_module.cc.

TH1F* cluster::DBcluster::fhitwidth_coll_test
private

Definition at line 53 of file DBcluster_module.cc.

TH1F* cluster::DBcluster::fhitwidth_ind_test
private

Definition at line 52 of file DBcluster_module.cc.


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