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

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 PCHitTransposer (fhicl::ParameterSet const &p)
 
 PCHitTransposer (PCHitTransposer const &)=delete
 
 PCHitTransposer (PCHitTransposer &&)=delete
 
PCHitTransposeroperator= (PCHitTransposer const &)=delete
 
PCHitTransposeroperator= (PCHitTransposer &&)=delete
 
void produce (art::Event &e) override
 
void beginJob () override
 
void reconfigure (const fhicl::ParameterSet &pset)
 
std::string workerType () const
 
void doBeginJob ()
 
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)
 
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< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (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< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Attributes

std::string fInputModuleLabel
 
std::string fInputProductInstanceXY
 
std::string fInputProductInstanceTraj
 
std::string fInputProductInstanceName
 
std::string fOutputMode
 
int fMinPlane
 
int fMaxPlane
 
int fMinCell
 
int fMaxCell
 

Detailed Description

Definition at line 33 of file PCHitTransposer_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 25 of file Producer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 18 of file EDProducer.h.

Constructor & Destructor Documentation

calib::PCHitTransposer::PCHitTransposer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 74 of file PCHitTransposer_module.cc.

References plot_validation_datamc::c, fMaxCell, fMaxPlane, fMinCell, fMinPlane, fOutputMode, MECModelEnuComparisons::i, reconfigure(), string, and art::to_string().

75  : EDProducer(p)
76 // Initialize member data here.
77 {
78  // Call appropriate produces<>() functions here.
79  this->reconfigure(p);
80  std::string instancename_XY;
81  std::string instancename_Traj;
82  for(int i=fMinPlane; i<=fMaxPlane; i++){
83  if(fOutputMode=="Plane"){
84  instancename_XY = "XYpchitplane"+std::to_string(i);
85  instancename_Traj = "Trajpchitplane"+std::to_string(i);
86  produces< std::vector<caldp::PCHit> >(instancename_XY);
87  produces< std::vector<caldp::PCHit> >(instancename_Traj);
88  }
89  else if(fOutputMode=="Cell"){
90  for(int c=fMinCell; c<=fMaxCell; c++){
91  instancename_XY = "XYpchitplane"+std::to_string(i)+"cell"+std::to_string(c);
92  instancename_Traj = "Trajpchitplane"+std::to_string(i)+"cell"+std::to_string(c);
93  produces< std::vector<caldp::PCHit> >(instancename_XY);
94  produces< std::vector<caldp::PCHit> >(instancename_Traj);
95  }
96  }
97  }
98 }
const char * p
Definition: xmltok.h:285
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void reconfigure(const fhicl::ParameterSet &pset)
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
enum BeamMode string
calib::PCHitTransposer::PCHitTransposer ( PCHitTransposer const &  )
delete
calib::PCHitTransposer::PCHitTransposer ( PCHitTransposer &&  )
delete

Member Function Documentation

void calib::PCHitTransposer::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 184 of file PCHitTransposer_module.cc.

References om::cout, DEFINE_ART_MODULE(), and allTimeWatchdog::endl.

185 {
186  // Implementation of optional member function here.
187  std::cout<<"BeginJob is starting"<<std::endl;
188 
189 }
OStream cout
Definition: OStream.cxx:6
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Producer::doBeginJob ( )
inherited
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Producer::doEndJob ( )
inherited
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::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 
)
inherited
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
PCHitTransposer& calib::PCHitTransposer::operator= ( PCHitTransposer const &  )
delete
PCHitTransposer& calib::PCHitTransposer::operator= ( PCHitTransposer &&  )
delete
void calib::PCHitTransposer::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 100 of file PCHitTransposer_module.cc.

References plot_validation_datamc::c, caldp::PCHit::Cell(), fInputModuleLabel, fInputProductInstanceTraj, fInputProductInstanceXY, fMaxCell, fMaxPlane, fMinCell, fMinPlane, fOutputMode, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, caldp::PCHit::Plane(), art::DataViewImpl::put(), string, and art::to_string().

101 {
102  // Declarations
105  std::string instancename_XY;
106  std::string instancename_Traj;
107  std::vector< std::unique_ptr< std::vector<caldp::PCHit> > > outputvector_XY;
108  std::vector< std::unique_ptr< std::vector<caldp::PCHit> > > outputvector_Traj;
109 
110  // Create the outputvector, and fill it with unique pointers for every plane or cell
111  for(int i=fMinPlane; i<=fMaxPlane; i++){
112  if(fOutputMode=="Plane"){
113  std::unique_ptr< std::vector<caldp::PCHit> > Plane_XY (new std::vector<caldp::PCHit>);
114  std::unique_ptr< std::vector<caldp::PCHit> > Plane_Traj (new std::vector<caldp::PCHit>);
115  outputvector_XY.push_back(std::move(Plane_XY));
116  outputvector_Traj.push_back(std::move(Plane_Traj));
117  }
118  else if(fOutputMode=="Cell"){
119  for(int c=fMinCell; c<=fMaxCell; c++){
120  std::unique_ptr< std::vector<caldp::PCHit> > Cell_XY (new std::vector<caldp::PCHit>);
121  std::unique_ptr< std::vector<caldp::PCHit> > Cell_Traj (new std::vector<caldp::PCHit>);
122  outputvector_XY.push_back(std::move(Cell_XY));
123  outputvector_Traj.push_back(std::move(Cell_Traj));
124  }
125  }
126  }
127 
128  // Retrieve the PCHits from the event
131 
132  // Loop through every PCHit, sort it into the outputvector based on plane(& cell)
133  for(unsigned int n = 0; n < PCHits_XY->size(); ++n){
134  const caldp::PCHit& PCHit_XY = (*PCHits_XY)[n];
135  if(fOutputMode=="Plane"){
136  if(PCHit_XY.Plane() >= fMinPlane && PCHit_XY.Plane() <= fMaxPlane){
137  outputvector_XY[PCHit_XY.Plane()-fMinPlane]->push_back(PCHit_XY);
138  }
139  }
140  else if(fOutputMode=="Cell"){
141  if(PCHit_XY.Plane() >= fMinPlane && PCHit_XY.Plane() <= fMaxPlane){
142  if(PCHit_XY.Cell() >= fMinCell && PCHit_XY.Cell() <= fMaxCell){
143  outputvector_XY[(PCHit_XY.Plane()-fMinPlane)*(fMaxCell-fMinCell+1)+(PCHit_XY.Cell()-fMinCell)]->push_back(PCHit_XY);
144  }
145  }
146  }
147  }
148  for(unsigned int n = 0; n < PCHits_Traj->size(); ++n){
149  const caldp::PCHit& PCHit_Traj = (*PCHits_Traj)[n];
150  if(fOutputMode=="Plane"){
151  if(PCHit_Traj.Plane() >= fMinPlane && PCHit_Traj.Plane() <= fMaxPlane){
152  outputvector_Traj[PCHit_Traj.Plane()-fMinPlane]->push_back(PCHit_Traj);
153  }
154  }
155  else if(fOutputMode=="Cell"){
156  if(PCHit_Traj.Plane() >= fMinPlane && PCHit_Traj.Plane() <= fMaxPlane){
157  if(PCHit_Traj.Cell() >= fMinCell && PCHit_Traj.Cell() <= fMaxCell){
158  outputvector_Traj[(PCHit_Traj.Plane()-fMinPlane)*(fMaxCell-fMinCell+1)+(PCHit_Traj.Cell()-fMinCell)]->push_back(PCHit_Traj);
159  }
160  }
161  }
162  }
163 
164  // Store the transposed PCHits contained in the outputvector to the event
165  for(int i=fMinPlane; i<=fMaxPlane; i++){
166  if(fOutputMode=="Plane"){
167  instancename_XY = "XYpchitplane"+std::to_string(i);
168  instancename_Traj = "Trajpchitplane"+std::to_string(i);
169  e.put(std::move(outputvector_XY[i-fMinPlane]), instancename_XY);
170  e.put(std::move(outputvector_Traj[i-fMinPlane]), instancename_Traj);
171  }
172  else if(fOutputMode=="Cell"){
173  for(int c=fMinCell; c<=fMaxCell; c++){
174  instancename_XY = "XYpchitplane"+std::to_string(i)+"cell"+std::to_string(c);
175  instancename_Traj = "Trajpchitplane"+std::to_string(i)+"cell"+std::to_string(c);
176  e.put(std::move(outputvector_XY[(i-fMinPlane)*(fMaxCell-fMinCell+1)+(c-fMinCell)]), instancename_XY);
177  e.put(std::move(outputvector_Traj[(i-fMinPlane)*(fMaxCell-fMinCell+1)+(c-fMinCell)]), instancename_Traj);
178  }
179  }
180  }
181  return;
182 }
int Cell() const
Return cell value.
Definition: PCHit.h:26
"Pre-calibration hit". Common input to calibration procedures
Definition: PCHit.h:16
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
std::void_t< T > n
int Plane() const
Return plane value.
Definition: PCHit.h:24
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
enum BeamMode string
void calib::PCHitTransposer::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 62 of file PCHitTransposer_module.cc.

References fInputModuleLabel, fInputProductInstanceTraj, fInputProductInstanceXY, fMaxCell, fMaxPlane, fMinCell, fMinPlane, fOutputMode, fhicl::ParameterSet::get(), and string.

Referenced by PCHitTransposer().

63 {
64  fInputModuleLabel = pset.get<std::string>("InputModuleLabel");
65  fInputProductInstanceXY = pset.get<std::string>("InputProductInstanceXY");
66  fInputProductInstanceTraj = pset.get<std::string>("InputProductInstanceTraj");
67  fOutputMode = pset.get<std::string>("OutputMode");
68  fMinPlane = pset.get<int>("MinPlane");
69  fMaxPlane = pset.get<int>("MaxPlane");
70  fMinCell = pset.get<int>("MinCell");
71  fMaxCell = pset.get<int>("MaxCell");
72 }
T get(std::string const &key) const
Definition: ParameterSet.h:231
enum BeamMode string
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDProducer::workerType ( ) const
inherited

Member Data Documentation

std::string calib::PCHitTransposer::fInputModuleLabel
private

Definition at line 51 of file PCHitTransposer_module.cc.

Referenced by produce(), and reconfigure().

std::string calib::PCHitTransposer::fInputProductInstanceName
private

Definition at line 54 of file PCHitTransposer_module.cc.

std::string calib::PCHitTransposer::fInputProductInstanceTraj
private

Definition at line 53 of file PCHitTransposer_module.cc.

Referenced by produce(), and reconfigure().

std::string calib::PCHitTransposer::fInputProductInstanceXY
private

Definition at line 52 of file PCHitTransposer_module.cc.

Referenced by produce(), and reconfigure().

int calib::PCHitTransposer::fMaxCell
private

Definition at line 59 of file PCHitTransposer_module.cc.

Referenced by PCHitTransposer(), produce(), and reconfigure().

int calib::PCHitTransposer::fMaxPlane
private

Definition at line 57 of file PCHitTransposer_module.cc.

Referenced by PCHitTransposer(), produce(), and reconfigure().

int calib::PCHitTransposer::fMinCell
private

Definition at line 58 of file PCHitTransposer_module.cc.

Referenced by PCHitTransposer(), produce(), and reconfigure().

int calib::PCHitTransposer::fMinPlane
private

Definition at line 56 of file PCHitTransposer_module.cc.

Referenced by PCHitTransposer(), produce(), and reconfigure().

std::string calib::PCHitTransposer::fOutputMode
private

Definition at line 55 of file PCHitTransposer_module.cc.

Referenced by PCHitTransposer(), produce(), and reconfigure().


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