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

Public Member Functions

 GraphCluster (fhicl::ParameterSet const &)
 
void produce (art::Event &evt)
 
- 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 GetStartEndHits (unsigned int plane, recob::Hit *starthit, recob::Hit *endhit)
 
void GetStartEndHits (unsigned int plane)
 
void GetHitList (unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist)
 
std::vector< util::PxLineGetSeedLines ()
 

Private Attributes

GraphClusterAlg fGClAlg
 
unsigned int fNPlanes
 
int TestFlag
 
int fRun
 
int fSubRun
 
int fEvent
 
std::vector< recob::Hit * > starthit
 
std::vector< recob::Hit * > endhit
 
std::vector< util::PxLinestartendpoints
 

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 83 of file GraphCluster_module.cc.

Constructor & Destructor Documentation

evd::GraphCluster::GraphCluster ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 138 of file GraphCluster_module.cc.

138  :
139  EDProducer{pset},
140  fGClAlg(pset.get< fhicl::ParameterSet >("GraphClusterAlg"))
141  {
143 
144 
145  produces< std::vector<recob::Cluster> >();
146  produces< art::Assns<recob::Cluster, recob::Hit> >();
147  produces< std::vector < art::PtrVector <recob::Cluster> > >();
148 
149 
150  fNPlanes = geo->Nplanes();
151  starthit.resize(fNPlanes);
152  endhit.resize(fNPlanes);
153 
154 
155  startendpoints.resize(fNPlanes);
156 // swire.resize(fNPlanes);
157 // ewire.resize(fNPlanes);
158 // stime.resize(fNPlanes);
159 // etime.resize(fNPlanes);
160  }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
GraphClusterAlg fGClAlg
std::vector< recob::Hit * > starthit
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
std::vector< util::PxLine > startendpoints
std::vector< recob::Hit * > endhit
LArSoft geometry interface.
Definition: ChannelGeo.h:16

Member Function Documentation

void evd::GraphCluster::GetHitList ( unsigned int  plane,
art::PtrVector< recob::Hit > &  ptrhitlist 
)
private
std::vector< util::PxLine > evd::GraphCluster::GetSeedLines ( )
private
void evd::GraphCluster::GetStartEndHits ( unsigned int  plane,
recob::Hit starthit,
recob::Hit endhit 
)
private
void evd::GraphCluster::GetStartEndHits ( unsigned int  plane)
private
void evd::GraphCluster::produce ( art::Event evt)
virtual
Todo:

This method appears to produce a recob::Cluster really as it is

a collection of 2D clusters from single planes

Implements art::EDProducer.

Definition at line 167 of file GraphCluster_module.cc.

168  {
169 
170  std::unique_ptr<std::vector<recob::Cluster> > Graphcol(new std::vector<recob::Cluster>);
171  std::unique_ptr< art::Assns<recob::Cluster, recob::Hit> > hassn(new art::Assns<recob::Cluster, recob::Hit>);
172  // std::unique_ptr< art::Assns<recob::Cluster, recob::Cluster> > classn(new art::Assns<recob::Cluster, recob::Cluster>);
173  std::unique_ptr< std::vector < art::PtrVector < recob::Cluster > > > classn(new std::vector < art::PtrVector < recob::Cluster > >);
174 
175 
176 
177 
179 
180  // check if evt and run numbers check out, etc...
181  if(fGClAlg.CheckValidity( evt ) == -1)
182  {
183  return;
184  }
185 
186 
187  for(unsigned int ip=0;ip<fNPlanes;ip++) {
188  startendpoints[ip]=util::PxLine(); //assign empty PxLine
189 
190  }
191 
192  std::vector < art::PtrVector < recob::Hit > > hitlist;
193  hitlist.resize(fNPlanes);
194 
195  for(unsigned int ip=0;ip<fNPlanes;ip++) {
196 
197  fGClAlg.GetHitListAndEndPoints(ip,hitlist[ip],startendpoints[ip]);
198  // Read in the Hit List object(s).
199  //fGClAlg.GetHitList(ip,hitlist[ip]);
200 
201  if(hitlist[ip].size()==0)
202  continue;
203  //Read in the starthit:
204  // GetStartEndHits(ip, starthit[ip],endhit[ip]);
205 
206 
207 
208 
209  //fGClAlg.GetStartEndHits(&startendpoints[ip]);
210 
211  if(hitlist[ip].size()>0 && !(TestFlag==-1 ) ) //old event or transfer not ready
212  {
213  double swterror=0.,ewterror=0.;
214 
215  if(startendpoints[ip].w0==0 )
216  swterror=999;
217 
218  if(startendpoints[ip].t1==0 )
219  ewterror=999;
220 
221  std::cout << " clustering @ " <<startendpoints[ip].w0 << " +/- "<< swterror
222  <<" " << startendpoints[ip].t0<< " +/- "<< swterror
223  <<" " << startendpoints[ip].w1<< " +/- "<< ewterror
224  <<" " << startendpoints[ip].t1<< " +/- "<< ewterror << std::endl;
225 
226  // this is all we can do easily without getting the full-blown
227  // ClusterParamsAlg (that means lareventdisplay has to depend on larreco!)
229  for (art::Ptr<recob::Hit> const& hit: hitlist[ip]) {
230  integral.add(hit->Integral());
231  summedADC.add(hit->SummedADC());
232  } // for
233 
234  // get the plane ID from the first hit
235  geo::PlaneID planeID = hitlist[ip].front()->WireID().planeID();
236  Graphcol->emplace_back(
237  startendpoints[ip].w0,
238  swterror,
239  startendpoints[ip].t0,
240  swterror,
241  0., // start_charge
242  0., // start_angle
243  0., // start_opening
244  startendpoints[ip].w1,
245  ewterror,
246  startendpoints[ip].t1,
247  ewterror,
248  0., // end_charge
249  0., // end_angle
250  0., // end_opening
251  integral.Sum(), // integral
252  integral.RMS(), // integral_stddev
253  summedADC.Sum(), // summedADC
254  summedADC.RMS(), // summedADC_stddev
255  hitlist[ip].size(), // n_hits
256  0., // multiple_hit_density
257  0., // width
258  ip,
259  geo->Plane(ip,planeID.TPC,planeID.Cryostat).View(),
260  planeID,
262  );
263 
264  // associate the hits to this cluster
265  util::CreateAssn(*this, evt, *Graphcol, hitlist[ip], *hassn);
266  }
267 
268  }// end of loop on planes
269 
271  cvec.reserve(fNPlanes);
272 
273  for(unsigned int ip=0;ip<fNPlanes;ip++) {
274  art::ProductID aid = evt.getProductID< std::vector < recob::Cluster > >();
275  art::Ptr< recob::Cluster > aptr(aid, ip, evt.productGetter(aid));
276  cvec.push_back(aptr);
277  }
278 
279  classn->push_back(cvec);
280 
281  // for(unsigned int ip=0;ip<fNPlanes;ip++) {
282  // for(unsigned int jp=ip+1;jp<fNPlanes;jp++) {
283  // util::CreateSameAssn(*this, evt, *Graphcol, *Graphcol, *classn,ip,ip+1,jp );
284  // // std::cout << "associating cluster" << ip <<" with cluster " << jp << std::endl;
285  // }
286  // }
287  //
288 
289  evt.put(std::move(Graphcol));
290  evt.put(std::move(hassn));
291  evt.put(std::move(classn));
292 
293  return;
294  } // end of produce
code to link reconstructed objects back to the MC truth information
void reserve(size_type n)
Definition: PtrVector.h:337
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
ProductID getProductID(std::string const &instance_name="") const
Definition: DataViewImpl.h:338
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
GraphClusterAlg fGClAlg
struct vector vector
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
Weight_t RMS() const
Returns the root mean square.
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:182
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:184
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
Weight_t Sum() const
Returns the weighted sum of the values.
int CheckValidity(art::Event &evt)
def move(depos, offset)
Definition: depos.py:107
EDProductGetter const * productGetter(ProductID const pid) const
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.
std::vector< util::PxLine > startendpoints
Detector simulation of raw signals on wires.
void GetHitListAndEndPoints(unsigned int plane, art::PtrVector< recob::Hit > &ptrhitlist, util::PxLine &startendpoints)
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
LArSoft geometry interface.
Definition: ChannelGeo.h:16
Collects statistics on a single quantity (weighted)
QTextStream & endl(QTextStream &s)
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.

Member Data Documentation

std::vector< recob::Hit * > evd::GraphCluster::endhit
private

Definition at line 120 of file GraphCluster_module.cc.

int evd::GraphCluster::fEvent
private

Definition at line 114 of file GraphCluster_module.cc.

GraphClusterAlg evd::GraphCluster::fGClAlg
private

Definition at line 93 of file GraphCluster_module.cc.

unsigned int evd::GraphCluster::fNPlanes
private

Definition at line 109 of file GraphCluster_module.cc.

int evd::GraphCluster::fRun
private

Definition at line 112 of file GraphCluster_module.cc.

int evd::GraphCluster::fSubRun
private

Definition at line 113 of file GraphCluster_module.cc.

std::vector< util::PxLine > evd::GraphCluster::startendpoints
private

Definition at line 124 of file GraphCluster_module.cc.

std::vector< recob::Hit * > evd::GraphCluster::starthit
private

Definition at line 119 of file GraphCluster_module.cc.

int evd::GraphCluster::TestFlag
private

Definition at line 111 of file GraphCluster_module.cc.


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