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

Public Member Functions

 CaloStripSplitter (fhicl::ParameterSet const &p)
 
 CaloStripSplitter (CaloStripSplitter const &)=delete
 
 CaloStripSplitter (CaloStripSplitter &&)=delete
 
CaloStripSplitteroperator= (CaloStripSplitter const &)=delete
 
CaloStripSplitteroperator= (CaloStripSplitter &&)=delete
 
void produce (art::Event &e) override
 
- 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 CollectHits (const art::Event &evt, const std::string &label, const std::string &instance, std::vector< art::Ptr< gar::rec::CaloHit > > &hitVector)
 
std::array< double, 3 > CalculateStripHitPosition (float x, float y, float z, std::pair< float, float > time, raw::CellID_t cID)
 
float CorrectStripHitTime (float x, float y, float z, std::pair< float, float > hitTime, raw::CellID_t cID)
 

Private Attributes

std::string fCaloHitLabel
 label to find the right reco calo hits More...
 
std::string fInstanceName
 product instance name More...
 
bool fSaveStripEndsOnly
 
bool fSaveUnsplitHits
 
bool fSaveStripEnds
 
const detinfo::DetectorPropertiesfDetProp
 detector properties More...
 
const geo::GeometryCorefGeo
 pointer to the geometry More...
 
std::unique_ptr< rec::alg::StripSplitterAlgfSSAAlgo
 

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 38 of file CaloStripSplitter_module.cc.

Constructor & Destructor Documentation

gar::rec::CaloStripSplitter::CaloStripSplitter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 74 of file CaloStripSplitter_module.cc.

74  : EDProducer{p}
75  {
76  fCaloHitLabel = p.get<std::string>("CaloHitLabel", "calohit");
77  fInstanceName = p.get<std::string >("InstanceLabelName", "");
78 
79  fGeo = gar::providerFrom<geo::GeometryGAr>();
80  fDetProp = gar::providerFrom<detinfo::DetectorPropertiesService>();
81  fSaveStripEndsOnly = p.get<bool>("SaveStripEndsOnly", false);
82  fSaveUnsplitHits = p.get<bool>("SaveUnsplitHits", true);
83 
84  //configure the cluster algorithm
85  auto fSSAAlgoPars = p.get<fhicl::ParameterSet>("SSAAlgPars");
86  fSSAAlgo = std::make_unique<rec::alg::StripSplitterAlg>(fSSAAlgoPars);
87  fSaveStripEnds = fSSAAlgo->GetSaveStripEndsFlag();
88 
89  if(fSaveStripEnds) {
90  MF_LOG_INFO("CaloStripSplitter_module")
91  << " Saving Strip ends flag turned on! ";
92  }
93 
94  art::InputTag tag(fCaloHitLabel, fInstanceName);
95  consumes<std::vector<gar::rec::CaloHit>>(tag);
96  produces<std::vector<gar::rec::CaloHit>>(fInstanceName);
97  }
std::string fInstanceName
product instance name
const geo::GeometryCore * fGeo
pointer to the geometry
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
std::unique_ptr< rec::alg::StripSplitterAlg > fSSAAlgo
const detinfo::DetectorProperties * fDetProp
detector properties
p
Definition: test.py:223
#define MF_LOG_INFO(category)
std::string fCaloHitLabel
label to find the right reco calo hits
gar::rec::CaloStripSplitter::CaloStripSplitter ( CaloStripSplitter const &  )
delete
gar::rec::CaloStripSplitter::CaloStripSplitter ( CaloStripSplitter &&  )
delete

Member Function Documentation

std::array< double, 3 > gar::rec::CaloStripSplitter::CalculateStripHitPosition ( float  x,
float  y,
float  z,
std::pair< float, float >  time,
raw::CellID_t  cID 
)
private

Definition at line 201 of file CaloStripSplitter_module.cc.

202  {
203  std::array<double, 3> point = {x, y, z};
204  std::array<double, 3> pointLocal;
206  fGeo->WorldToLocal(point, pointLocal, trans);
207 
208  //Calculate the position of the hit based on the corrected time along the strip
209  float c = (CLHEP::c_light * CLHEP::mm / CLHEP::ns) / CLHEP::cm; // in cm/ns
210  float xlocal = c * ( time.first - time.second ) / 2.;
211 
212  std::array<double, 3> local_back = fGeo->ReconstructStripHitPosition(point, pointLocal, xlocal, cID);
213  std::array<double, 3> world_back;
214  fGeo->LocalToWorld(local_back, world_back, trans);
215 
216  return world_back;
217  }
static constexpr double cm
Definition: Units.h:68
bool WorldToLocal(std::array< double, 3 > const &world, std::array< double, 3 > &local, gar::geo::LocalTransformation< TGeoHMatrix > &trans) const
const geo::GeometryCore * fGeo
pointer to the geometry
Class to transform between world and local coordinates.
bool LocalToWorld(std::array< double, 3 > const &local, std::array< double, 3 > &world, gar::geo::LocalTransformation< TGeoHMatrix > const &trans) const
std::array< double, 3 > ReconstructStripHitPosition(const std::array< double, 3 > &point, const std::array< double, 3 > &local, const float &xlocal, const gar::raw::CellID_t &cID) const
static constexpr double mm
Definition: Units.h:65
list x
Definition: train.py:276
QAsciiDict< Entry > ns
void gar::rec::CaloStripSplitter::CollectHits ( const art::Event evt,
const std::string label,
const std::string instance,
std::vector< art::Ptr< gar::rec::CaloHit > > &  hitVector 
)
private

Definition at line 187 of file CaloStripSplitter_module.cc.

188  {
190  auto theHits = evt.getHandle< std::vector<gar::rec::CaloHit> >(itag);
191  if (!theHits) return;
192 
193  for (unsigned int i = 0; i < theHits->size(); ++i)
194  {
195  const art::Ptr<gar::rec::CaloHit> hit(theHits, i);
196  hitVector.push_back(hit);
197  }
198  }
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
const std::string instance
Detector simulation of raw signals on wires.
float gar::rec::CaloStripSplitter::CorrectStripHitTime ( float  x,
float  y,
float  z,
std::pair< float, float >  hitTime,
raw::CellID_t  cID 
)
private

Definition at line 220 of file CaloStripSplitter_module.cc.

221  {
222  std::array<double, 3> point = {x, y, z};
223  double stripLength = fGeo->getStripLength(point, cID); // in cm
224 
225  float c = (CLHEP::c_light * CLHEP::mm / CLHEP::ns) / CLHEP::cm; // in cm/ns
226  float time = (hitTime.first + hitTime.second) / 2. - (stripLength / (2 * c));
227 
228  return time;
229  }
static constexpr double cm
Definition: Units.h:68
const geo::GeometryCore * fGeo
pointer to the geometry
double getStripLength(const std::array< double, 3 > &point, const gar::raw::CellID_t &cID) const
static constexpr double mm
Definition: Units.h:65
list x
Definition: train.py:276
QAsciiDict< Entry > ns
CaloStripSplitter& gar::rec::CaloStripSplitter::operator= ( CaloStripSplitter const &  )
delete
CaloStripSplitter& gar::rec::CaloStripSplitter::operator= ( CaloStripSplitter &&  )
delete
void gar::rec::CaloStripSplitter::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 100 of file CaloStripSplitter_module.cc.

101  {
102  //Collect the hits to be passed to the algo
103  std::vector< art::Ptr<gar::rec::CaloHit> > artHits;
104  this->CollectHits(e, fCaloHitLabel, fInstanceName, artHits);
105 
106  //Prepare the hits for SSA
107  fSSAAlgo->PrepareAlgo(artHits);
108  //Perform the SS
109  fSSAAlgo->DoStripSplitting();
110  //Get back the vector of split hits
111  std::vector<const gar::rec::CaloHit*> splitHits = fSSAAlgo->getSplitHits();
112  //Get back the vector of unsplit hits
113  std::vector<const gar::rec::CaloHit*> unsplitHits = fSSAAlgo->getUnSplitHits();
114 
115  // make an art::PtrVector of the hits
116  std::unique_ptr< std::vector<gar::rec::CaloHit> > HitCol(new std::vector<gar::rec::CaloHit>);
117 
118  if(not fSaveStripEndsOnly) {
119  //Copy the split hits to the collection
120  for(auto const &it : splitHits) {
121 
122  //Need to correct the time for the strips
123  float energy = it->Energy();
124  std::pair<float, float> time = it->Time();
125  raw::CellID_t cellID = it->CellID();
126  const float *pos = it->Position();
127  float newpos[3] = { pos[0], pos[1], pos[2] };
128  float newtime = time.first;
129  unsigned int layer = it->Layer();
130  const std::array<double, 3> point = { pos[0], pos[1], pos[2] };
131 
132  if(not fGeo->isTile(point, cellID)) {
133  newtime = this->CorrectStripHitTime(newpos[0], newpos[1], newpos[2], time, cellID);
134  }
135 
136  rec::CaloHit hit(energy, newtime, newpos, cellID, layer);
137  HitCol->emplace_back(hit);
138  }
139 
140  if( fSaveUnsplitHits ) {
141  //Copy the unsplit hits to the collection
142  for(auto const &it : unsplitHits) {
143 
144  //Need to correct the position of the un-used strips
145  float energy = it->Energy();
146  std::pair<float, float> time = it->Time();
147  raw::CellID_t cellID = it->CellID();
148  const float *pos = it->Position();
149  float newpos[3] = { pos[0], pos[1], pos[2] };
150  float newtime = time.first;
151  unsigned int layer = it->Layer();
152  const std::array<double, 3> point = { pos[0], pos[1], pos[2] };
153 
154  if(not fGeo->isTile(point, cellID)) {
155  // Need to correct for the position of these based on time information
156  std::array<double, 3> strip_pos = this->CalculateStripHitPosition(newpos[0], newpos[1], newpos[2], time, cellID);
157  newpos[0] = strip_pos[0];
158  newpos[1] = strip_pos[1];
159  newpos[2] = strip_pos[2];
160  newtime = this->CorrectStripHitTime(newpos[0], newpos[1], newpos[2], time, cellID);
161  }
162 
163  rec::CaloHit hit(energy, newtime, newpos, cellID, layer);
164 
165  HitCol->emplace_back(hit);
166  }
167  }
168  }
169 
170  //Copy the strip end hits to the collection
171  if(fSaveStripEnds) {
172  std::vector<const gar::rec::CaloHit*> stripEndsHits = fSSAAlgo->getStripEndsHits();
173  for(auto const &it : stripEndsHits)
174  HitCol->emplace_back(*it);
175 
176  std::vector<const gar::rec::CaloHit*> stripInterHits = fSSAAlgo->getIntersectionHits();
177  for(auto const &it : stripInterHits)
178  HitCol->emplace_back(*it);
179  }
180 
181  e.put(std::move(HitCol), fInstanceName);
182 
183  return;
184  }
std::array< double, 3 > CalculateStripHitPosition(float x, float y, float z, std::pair< float, float > time, raw::CellID_t cID)
std::string fInstanceName
product instance name
const geo::GeometryCore * fGeo
pointer to the geometry
std::unique_ptr< rec::alg::StripSplitterAlg > fSSAAlgo
void CollectHits(const art::Event &evt, const std::string &label, const std::string &instance, std::vector< art::Ptr< gar::rec::CaloHit > > &hitVector)
bool isTile(const std::array< double, 3 > &point, const gar::raw::CellID_t &cID) const
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
float CorrectStripHitTime(float x, float y, float z, std::pair< float, float > hitTime, raw::CellID_t cID)
long long int CellID_t
Definition: CaloRawDigit.h:24
Detector simulation of raw signals on wires.
std::string fCaloHitLabel
label to find the right reco calo hits

Member Data Documentation

std::string gar::rec::CaloStripSplitter::fCaloHitLabel
private

label to find the right reco calo hits

Definition at line 60 of file CaloStripSplitter_module.cc.

const detinfo::DetectorProperties* gar::rec::CaloStripSplitter::fDetProp
private

detector properties

Definition at line 67 of file CaloStripSplitter_module.cc.

const geo::GeometryCore* gar::rec::CaloStripSplitter::fGeo
private

pointer to the geometry

Definition at line 68 of file CaloStripSplitter_module.cc.

std::string gar::rec::CaloStripSplitter::fInstanceName
private

product instance name

Definition at line 61 of file CaloStripSplitter_module.cc.

bool gar::rec::CaloStripSplitter::fSaveStripEnds
private

Definition at line 65 of file CaloStripSplitter_module.cc.

bool gar::rec::CaloStripSplitter::fSaveStripEndsOnly
private

Definition at line 63 of file CaloStripSplitter_module.cc.

bool gar::rec::CaloStripSplitter::fSaveUnsplitHits
private

Definition at line 64 of file CaloStripSplitter_module.cc.

std::unique_ptr<rec::alg::StripSplitterAlg> gar::rec::CaloStripSplitter::fSSAAlgo
private

Definition at line 70 of file CaloStripSplitter_module.cc.


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