Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
nussand::FillNusSandbox Class Reference
Inheritance diagram for nussand::FillNusSandbox:
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

 FillNusSandbox (fhicl::ParameterSet const &pset)
 
virtual ~FillNusSandbox ()
 
void produce (art::Event &evt)
 
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 fSlicerLabel
 
std::string fVertexLabel
 
std::string fTrackLabel
 

Detailed Description

Definition at line 36 of file FillNusSandbox_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

nussand::FillNusSandbox::FillNusSandbox ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 57 of file FillNusSandbox_module.cc.

57  :
58  fSlicerLabel (pset.get< std::string >("SlicerLabel")),
59  fVertexLabel (pset.get< std::string >("VertexLabel")),
60  fTrackLabel (pset.get< std::string >("TrackLabel"))
61  {
62  produces< std::vector<nussand::NusSandObj> >();
63  produces< art::Assns<nussand::NusSandObj, rb::Cluster> >();
64  }
enum BeamMode string
nussand::FillNusSandbox::~FillNusSandbox ( )
virtual

Definition at line 68 of file FillNusSandbox_module.cc.

69  {
70  }

Member Function Documentation

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
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void nussand::FillNusSandbox::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 73 of file FillNusSandbox_module.cc.

References std::acos(), util::CreateAssn(), DEFINE_ART_MODULE(), rb::Prong::Dir(), stan::math::fabs(), fSlicerLabel, fTrackLabel, fVertexLabel, geom(), art::DataViewImpl::getByLabel(), rb::RecoHit::GeV(), rb::RecoHit::IsCalibrated(), rb::Cluster::IsNoise(), geo::kX, geo::kY, LOG_INFO, LOG_WARNING, geo::GeometryBase::NuMIBeamDirection(), rb::Cluster::NXCell(), rb::Cluster::NYCell(), art::Event::put(), util::pythag(), rb::Cluster::RecoHit(), nussand::NusSandObj::SetAngEWSumTX(), nussand::NusSandObj::SetAngEWSumTY(), nussand::NusSandObj::SetAngSumTX(), nussand::NusSandObj::SetAngSumTY(), nussand::NusSandObj::SetCosEWSumTX(), nussand::NusSandObj::SetCosEWSumTY(), nussand::NusSandObj::SetCosSumTX(), nussand::NusSandObj::SetCosSumTY(), nussand::NusSandObj::SetEWSumTX(), nussand::NusSandObj::SetEWSumTY(), nussand::NusSandObj::SetSumTX(), nussand::NusSandObj::SetSumTY(), registry_explorer::v, rb::Cluster::View(), rb::Cluster::Weight(), rb::Cluster::XCell(), and rb::Cluster::YCell().

74  {
75 
77  evt.getByLabel(fSlicerLabel,slicevec);
78 
79  if(slicevec->empty()) {
80  LOG_WARNING("NusSandbox") << "No Slices in the input file";
81  return;
82  }
83 
85 
86  art::FindManyP<rb::Track> fmpTrack(slicevec, evt, fTrackLabel);
87  art::FindManyP<rb::Vertex> fmpVert(slicevec, evt, fVertexLabel);
88 
89  std::unique_ptr< std::vector<nussand::NusSandObj> > outputObjects(new std::vector<nussand::NusSandObj>);
90  std::unique_ptr< art::Assns<nussand::NusSandObj, rb::Cluster> > assoc(new art::Assns<nussand::NusSandObj, rb::Cluster>);
91 
92  const TVector3 beamdir = geom->NuMIBeamDirection();
93 
94  const double beamx = beamdir.X();
95  const double beamy = beamdir.Y();
96  const double beamz = beamdir.Z();
97 
98  const double xbeam = beamx/util::pythag(beamx, beamz);
99  const double ybeam = beamy/util::pythag(beamy, beamz);
100  const double zxbeam = beamz/util::pythag(beamx, beamz);
101  const double zybeam = beamz/util::pythag(beamy, beamz);
102 
103  for(size_t slcIdx = 0; slcIdx < slicevec->size(); ++slcIdx){
104 
105  art::Ptr<rb::Cluster> slice(slicevec,slcIdx);
106 
107  if(slice->IsNoise()) continue;
108 
109  nussand::NusSandObj sandbox;
110 
111  //Make sure there is a vertex associated with this slice
112  if(!fmpVert.isValid()) {
113  LOG_WARNING("NusSandbox") << "No " << fVertexLabel.c_str() << "Vertices!";
114  outputObjects->push_back(sandbox);
115  util::CreateAssn(*this,evt,*(outputObjects.get()),slice,*(assoc.get()));
116  continue;
117  }
118 
119  std::vector< art::Ptr<rb::Vertex> > v = fmpVert.at(slcIdx);
120  if(v.size() != 1) continue;// Continue if there is no vertex or more then 1 vertex
121 
122  if(!fmpTrack.isValid()) {
123  LOG_WARNING("NusSandbox") << "No " << fTrackLabel.c_str() << " Tracks!";
124  outputObjects->push_back(sandbox);
125  util::CreateAssn(*this,evt,*(outputObjects.get()),slice,*(assoc.get()));
126  continue;
127  }
128 
129  double xFinal = 0.;
130  double yFinal = 0.;
131  double zxFinal = 0.;
132  double zyFinal = 0.;
133  double exFinal = 0.;
134  double eyFinal = 0.;
135  double ezxFinal = 0.;
136  double ezyFinal = 0.;
137 
138  std::vector< art::Ptr<rb::Track> > tracks = fmpTrack.at(slcIdx);
139  for(size_t trkIdx = 0; trkIdx < tracks.size(); ++trkIdx){
140 
141  const art::Ptr<rb::Track> track = tracks[trkIdx];
142 
143  TVector3 tDir = track->Dir().Unit();
144 
145  double xtrkE = 0.;
146  double ytrkE = 0.;
147  // Loop over XCells
148  if(track->View() == geo::kX){
149  for(size_t hitIdx = 0; hitIdx < track->NXCell(); ++hitIdx){
150  const art::Ptr<rb::CellHit> chit = track->XCell(hitIdx);
151  const rb::RecoHit rhit = track->RecoHit(chit);
152  if(rhit.IsCalibrated()) xtrkE += rhit.GeV()*track->Weight(geo::kX, hitIdx);
153  } // loop over xhits
154 
155  TVector3 tdirx = track->Dir().Unit();
156  xFinal += fabs(tDir.X());
157  zxFinal += tDir.Z();
158  exFinal += fabs(tDir.X())*xtrkE;
159  ezxFinal += tDir.Z()*xtrkE;
160  }
161  else if(track->View() == geo::kY){
162  // Loop over YCells
163  for(size_t hitIdx = 0; hitIdx < track->NYCell(); ++hitIdx){
164  const art::Ptr<rb::CellHit> chit = track->YCell(hitIdx);
165  const rb::RecoHit rhit = track->RecoHit(chit);
166  if(rhit.IsCalibrated()) ytrkE += rhit.GeV()*track->Weight(geo::kY, hitIdx);
167  } // loop over yhits
168  yFinal += fabs(tDir.Y());
169  zyFinal += tDir.Z();
170  eyFinal += fabs(tDir.Y())*ytrkE;
171  ezyFinal += tDir.Z()*ytrkE;
172  }
173  else{
174  LOG_INFO("NusSandbox") << "Not a geo::kX or geo::kY view. Don't do anything!";
175  continue;
176  }
177 
178  } // loop over tracks
179 
180  double fTXZ = util::pythag(xFinal, zxFinal);
181  double fTYZ = util::pythag(yFinal, zyFinal);
182  double fTEXZ = util::pythag(exFinal, ezxFinal);
183  double fTEYZ = util::pythag(eyFinal, ezyFinal);
184 
185  sandbox.SetSumTX(fTXZ);
186  sandbox.SetSumTY(fTYZ);
187  sandbox.SetEWSumTX(fTEXZ);
188  sandbox.SetEWSumTY(fTEYZ);
189 
190  double beamTrkXZ = ((xFinal*xbeam + zxFinal*zxbeam)/fTXZ);
191  double beamTrkYZ = ((yFinal*ybeam + zyFinal*zybeam)/fTYZ);
192  double beamTrkEXZ = ((exFinal*xbeam + ezxFinal*zxbeam)/fTEXZ);
193  double beamTrkEYZ = ((eyFinal*ybeam + ezyFinal*zybeam)/fTEYZ);
194 
195  sandbox.SetCosSumTX(beamTrkXZ);
196  sandbox.SetCosEWSumTX(beamTrkEXZ);
197  sandbox.SetCosSumTY(beamTrkYZ);
198  sandbox.SetCosEWSumTY(beamTrkEYZ);
199 
200  sandbox.SetAngSumTX(acos(beamTrkXZ)*180.0/TMath::Pi());
201  sandbox.SetAngEWSumTX(acos(beamTrkEXZ)*180.0/TMath::Pi());
202  sandbox.SetAngSumTY(acos(beamTrkYZ)*180.0/TMath::Pi());
203  sandbox.SetAngEWSumTY(acos(beamTrkEYZ)*180.0/TMath::Pi());
204 
205  outputObjects->push_back(sandbox);
206  util::CreateAssn(*this,evt,*(outputObjects.get()),slice,*(assoc.get()));
207  } //end loop over slices
208 
209  evt.put(std::move(outputObjects));
210  evt.put(std::move(assoc));
211 
212  } //end produce
virtual geo::View_t View() const
kXorY for 3D clusters.
Definition: Cluster.h:99
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
void SetSumTY(float sumty)
sum of track direction YZ-view unit vectors
Definition: NusSandObj.cxx:34
art::Ptr< rb::CellHit > XCell(unsigned int xIdx) const
Get the ith cell in the x-view.
Definition: Cluster.cxx:157
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
void SetAngSumTY(float angsumty)
angle with respect to beam of sum of track direction XZ-view unit vectors
Definition: NusSandObj.cxx:82
void SetCosSumTY(float cossumty)
cosine angle with respect to beam of sum of track direction YZ-view unit vectors
Definition: NusSandObj.cxx:58
Vertical planes which measure X.
Definition: PlaneGeo.h:28
Definition: event.h:19
void SetCosEWSumTX(float cosewsumtx)
cosine angle with respect to beam of energy-weighted sum of track direction XZ-view unit vectors ...
Definition: NusSandObj.cxx:64
T acos(T number)
Definition: d0nt_math.hpp:54
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void SetCosEWSumTY(float cosewsumty)
cosine angle with respect to beam of energy-weighted sum of track direction YZ-view unit vectors ...
Definition: NusSandObj.cxx:70
art::Ptr< rb::CellHit > YCell(unsigned int yIdx) const
Get the ith cell in the y-view.
Definition: Cluster.cxx:165
virtual TVector3 Dir() const
Unit vector describing prong direction.
Definition: Prong.h:77
rb::RecoHit RecoHit(const art::Ptr< rb::CellHit > &chit) const
Return calibrated hit based on assumed W coordinate.
Definition: Cluster.cxx:259
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
Definition: RecoHit.cxx:35
void SetAngSumTX(float angsumtx)
angle with respect to beam of sum of track direction XZ-view unit vectors
Definition: NusSandObj.cxx:76
#define LOG_WARNING(category)
void SetAngEWSumTY(float angewsumty)
angle with respect to beam of energy-weighted sum of track direction XZ-view unit vectors ...
Definition: NusSandObj.cxx:94
void SetEWSumTY(float ewsumty)
energy-weighted sum of track direction YZ-view unit vectors
Definition: NusSandObj.cxx:46
unsigned int NYCell() const
Number of cells in the y-view.
Definition: Cluster.h:108
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
float GeV() const
Definition: RecoHit.cxx:69
void SetCosSumTX(float cossumtx)
cosine angle with respect to beam of sum of track direction XZ-view unit vectors
Definition: NusSandObj.cxx:52
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
unsigned int NXCell() const
Number of cells in the x-view.
Definition: Cluster.h:106
void geom(int which=0)
Definition: geom.C:163
void SetEWSumTX(float ewsumtx)
energy-weighted sum of track direction XZ-view unit vectors
Definition: NusSandObj.cxx:40
#define LOG_INFO(stream)
Definition: Messenger.h:144
void SetAngEWSumTX(float angewsumtx)
angle with respect to beam of energy-weighted sum of track direction XZ-view unit vectors ...
Definition: NusSandObj.cxx:88
void SetSumTX(float sumtx)
sum of track direction XZ-view unit vectors
Definition: NusSandObj.cxx:28
double Weight(unsigned int globalIdx) const
Weight assigned to the cell.
Definition: Cluster.cxx:209
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 nussand::FillNusSandbox::fSlicerLabel
private

Definition at line 45 of file FillNusSandbox_module.cc.

Referenced by produce().

std::string nussand::FillNusSandbox::fTrackLabel
private

Definition at line 47 of file FillNusSandbox_module.cc.

Referenced by produce().

std::string nussand::FillNusSandbox::fVertexLabel
private

Definition at line 46 of file FillNusSandbox_module.cc.

Referenced by produce().


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