Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
calib::PCHitTransposer Class Reference
Inheritance diagram for calib::PCHitTransposer:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::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)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

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

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

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

Definition at line 35 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().

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
void reconfigure(const fhicl::ParameterSet &pset)
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
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 = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDProducer::currentContext ( ) const
protectedinherited
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
PCHitTransposer& calib::PCHitTransposer::operator= ( PCHitTransposer const &  )
delete
PCHitTransposer& calib::PCHitTransposer::operator= ( PCHitTransposer &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
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, getGoodRuns4SAM::n, caldp::PCHit::Plane(), push_back(), art::Event::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
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
base_types push_back(int_type())
int Plane() const
Return plane value.
Definition: PCHit.h:24
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
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::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

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: