Public Member Functions | Private Attributes | List of all members
fuzz::WeightSharedHitsAlg Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-01/FuzzyKVertex/WeightSharedHitsAlg.h"

Public Member Functions

 WeightSharedHitsAlg (const WeightSharedHitsParams &params)
 
 ~WeightSharedHitsAlg ()
 
void GetWeights (std::vector< rb::WeightedProng > &prong)
 

Private Attributes

art::ServiceHandle< geo::GeometryfGeom
 

Detailed Description

Definition at line 37 of file WeightSharedHitsAlg.h.

Constructor & Destructor Documentation

fuzz::WeightSharedHitsAlg::WeightSharedHitsAlg ( const WeightSharedHitsParams params)
explicit

Definition at line 20 of file WeightSharedHitsAlg.cxx.

21  {
22  }
fuzz::WeightSharedHitsAlg::~WeightSharedHitsAlg ( )

Definition at line 24 of file WeightSharedHitsAlg.cxx.

25  {
26 
27  }

Member Function Documentation

void fuzz::WeightSharedHitsAlg::GetWeights ( std::vector< rb::WeightedProng > &  prong)

Definition at line 30 of file WeightSharedHitsAlg.cxx.

References rawdata::RawDigit::Channel().

Referenced by fuzz::FuzzyKVertex::produce().

31  {
32  const int nPro = prongs.size();
33 
34  // This map holds info about the cells that are shared by
35  // multiple prongs. The key is the channel, and the value
36  // is another map. In the inner map, the key is the index
37  // of the prong and the value is the index of the cell in
38  // that prong. Therefore, proIdx[chan][prgIdx] = [cellIdx]
39  std::map< uint32_t , std::map< int, int > > proIdx ;
40 
41  for( int iPro = 0; iPro < nPro; ++iPro){
42 
43  // loop over cells in ith prong
44  for( unsigned int iCell = 0; iCell < prongs[iPro].NCell(); ++iCell ){
45  const art::Ptr<rb::CellHit>& ihit = prongs[iPro].Cell(iCell);
46 
47  // In the following loop, we will find which other
48  // prongs the ihits[iCell] belongs to.
49 
50  for( int jPro = iPro+1; jPro < nPro; ++jPro){
51 
52  // loop over cells in jth prong
53  for( unsigned int jCell = 0 ; jCell < prongs[jPro].NCell(); ++jCell){
54  const art::Ptr<rb::CellHit>& jhit = prongs[jPro].Cell(jCell);
55 
56  if( *jhit == *ihit){
57  proIdx[ ihit->Channel() ][ iPro ] = iCell;
58  proIdx[ ihit->Channel() ][ jPro ] = jCell;
59  }
60 
61  }// end loop over jprong cells
62  }// end j loop over prongs
63  }// end loop over iprong cells
64  }// end i loop over prongs
65 
66  // We now have all the info we need to set weights:
67  // 1/N weights
68  // loop over channels
69  for( auto & cmap : proIdx){
70  // for each channel, get number of prongs that share that channel
71  int nsharedprongs = cmap.second.size();
72  // loop over the shared prongs for that channel
73  for( auto & pmap : cmap.second){
74  // doing the really naive thing which is weighting by 1/Nprongs
75  prongs[pmap.first].SetWeight(pmap.second, 1./nsharedprongs);
76  }
77  }// end loop over proIdx
78 
79  return;
80 
81  }// end of GetWeights
uint32_t Channel() const
Definition: RawDigit.h:84
cmap::CMap class source code
Definition: CMap.cxx:17

Member Data Documentation

art::ServiceHandle<geo::Geometry> fuzz::WeightSharedHitsAlg::fGeom
private

Definition at line 46 of file WeightSharedHitsAlg.h.


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