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

 CosmicRayVertex (fhicl::ParameterSet const &p)
 
void reconfigure (const fhicl::ParameterSet &p)
 
virtual ~CosmicRayVertex ()
 
void beginJob ()
 
void produce (art::Event &evt)
 
void endJob ()
 
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 fSliceLabel
 Where to get slices? More...
 
std::string fTrackLabel
 Where to look for tracks? More...
 
bool fObeyPreselection
 Check rb::IsFiltered? More...
 

Detailed Description

Module for placing a vertex on a cosmic ray track

Definition at line 28 of file CosmicRayVertex_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

crvtx::CosmicRayVertex::CosmicRayVertex ( fhicl::ParameterSet const &  p)
inlineexplicit

Definition at line 37 of file CosmicRayVertex_module.cc.

References reconfigure().

37  {
38  this->reconfigure(p);
39  this->produces< std::vector<rb::Vertex> > ();
40  this->produces< art::Assns<rb::Vertex, rb::Cluster> >();
41  }
const char * p
Definition: xmltok.h:285
void reconfigure(const fhicl::ParameterSet &p)
virtual crvtx::CosmicRayVertex::~CosmicRayVertex ( )
inlinevirtual

Definition at line 53 of file CosmicRayVertex_module.cc.

53 { }

Member Function Documentation

void crvtx::CosmicRayVertex::beginJob ( )
inlinevirtual

Reimplemented from art::EDProducer.

Definition at line 56 of file CosmicRayVertex_module.cc.

56 { }
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
void crvtx::CosmicRayVertex::endJob ( )
inlinevirtual

Reimplemented from art::EDProducer.

Definition at line 157 of file CosmicRayVertex_module.cc.

References DEFINE_ART_MODULE().

157 { }
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 crvtx::CosmicRayVertex::produce ( art::Event evt)
inlinevirtual

Implements art::EDProducer.

Definition at line 59 of file CosmicRayVertex_module.cc.

References geo::ClampRayToDetectorVolume(), util::CreateAssn(), geo::GeometryBase::DEdge(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), dir, febshutoff_auto::end, geom(), art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, geo::GeometryBase::IntersectsDetector(), rb::IsFiltered(), rb::Cluster::IsNoise(), calib::j, plot_validation_datamc::p1, art::Event::put(), febshutoff_auto::start, getGoodRuns4SAM::t0, and registry_explorer::v.

59  {
60  unsigned int i,j;
61  //
62  // We produce a vertex with an association to the slice clutser
63  // from which it came
64  //
65  std::unique_ptr< std::vector<rb::Vertex> >
66  vtx(new std::vector<rb::Vertex>);
67  std::unique_ptr< art::Assns<rb::Vertex, rb::Cluster> >
68  vtx_to_slice(new art::Assns<rb::Vertex, rb::Cluster>);
69 
70  //
71  // Find the slice we want to analyze and any associated tracks
72  //
74  evt.getByLabel(fSliceLabel,slice);
75 
76  art::FindMany<rb::Track> trackh(slice, evt, fTrackLabel);
77 
79 
80  //Vertex location
81  double enterp[3];
82 
83  for(i = 0; i < slice->size(); ++i) {
84  if(fObeyPreselection && rb::IsFiltered(evt, slice, i)) continue;
85  //
86  // Get a pointer to "this" slice. Skip it if its the noise slice
87  //
88  const rb::Cluster& s = (*slice)[i];
89  if (s.IsNoise()) continue;
90  //
91  // Find the tracks associated to this slice
92  //
93  std::vector<const rb::Track*> tracks = trackh.at(i);
94  //
95  // Determine the locations of the vertices for each track
96  //
97  for (j=0; j<tracks.size(); ++j) {
98  //(x,y,z) track start point
99  TVector3 st = tracks[j]->Start();
100  //track direction
101  TVector3 direct = tracks[j]->Dir();
102  //(x,y,z) track start point (double)
103  double start[3] = {st.X(),st.Y(),st.Z()};
104  //Backwards along track direction (towards edge of detector)
105  double dir[3] = {-direct.X(),-direct.Y(),-direct.Z()};
106  //
107  //Check if point in detector
108  //
109  bool is_inside = true;
110  is_inside &= (start[0]>-geom->DetHalfWidth())&&(start[0]<geom->DetHalfWidth());
111  is_inside &= (start[1]>-geom->DetHalfHeight())&&(start[1]<geom->DetHalfHeight());
112  is_inside &= (start[2]>0)&&(start[2]<geom->DetLength());
113  //If yes, vertex at extrapolated entrance point of cosmic ray
114  if (is_inside)
115  geom->DEdge(start,dir,enterp);
116  //If no, check to see if the track intercepts the detector in the opposite direction
117  else {
118  double oppDir[3] = {direct.X(), direct.Y(), direct.Z()};
119  bool intersects = geom->IntersectsDetector(start, oppDir);
120  //If it doesn't intersect, vertex at track start
121  if (!intersects) {
122  std::copy(std::begin(start), std::end(start), std::begin(enterp));
123  }
124  //If it does intersect, vertex at extrapolated entrance point of cosmic ray
125  //searched for from the outside
126  else {
127  TVector3 p1;
128  p1.SetX(st.X() + (1000*direct.X()));
129  p1.SetY(st.Y() + (1000*direct.Y()));
130  p1.SetZ(st.Z() + (1000*direct.Z()));
131  geo::ClampRayToDetectorVolume(&st, &p1, &(*geom));
132  double newStart[3] = {st.X(), st.Y(), st.Z()};
133  std::copy(std::begin(newStart), std::end(newStart), std::begin(enterp));
134  }
135  }
136  //Initial time of track
137  double t0 = tracks[j]->MinTNS();
138 
139  //
140  // Add to collection of vertices to store
141  //
142  rb::Vertex v(enterp[0],enterp[1],enterp[2],t0);
143  vtx->push_back(v);
144  //
145  // Create associations between slice and vertex
146  //
147  art::Ptr<rb::Cluster> sptr(slice, i);
148  util::CreateAssn(*this, evt, *vtx, sptr, *vtx_to_slice);
149  }
150  }
151 
152  evt.put(std::move(vtx));
153  evt.put(std::move(vtx_to_slice));
154  }
A 3D position and time representing an interaction vertex.
Definition: Vertex.h:15
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.
bool fObeyPreselection
Check rb::IsFiltered?
A collection of associated CellHits.
Definition: Cluster.h:47
double DetLength() const
bool ClampRayToDetectorVolume(TVector3 *p0, TVector3 *p1, const GeometryBase *geom)
If either endpoint is outside the detector move it to the edge.
Definition: Geo.cxx:640
std::string fTrackLabel
Where to look for tracks?
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
const XML_Char * s
Definition: expat.h:262
double DEdge(const double *x0, const double *dx, double *exitp=0) const
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Definition: FilterList.h:96
const double j
Definition: BetheBloch.cxx:29
double DetHalfHeight() const
std::string fSliceLabel
Where to get slices?
double DetHalfWidth() const
TDirectory * dir
Definition: macro.C:5
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void geom(int which=0)
Definition: geom.C:163
bool IntersectsDetector(double *xyz_cm, double *dxyz) const
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
void crvtx::CosmicRayVertex::reconfigure ( const fhicl::ParameterSet p)
inline

Definition at line 44 of file CosmicRayVertex_module.cc.

References SET.

Referenced by CosmicRayVertex().

44  {
45 # define SET(N) { f##N = p.get<__typeof__(f##N)>(#N); }
46  SET(ObeyPreselection);
47  SET(SliceLabel);
48  SET(TrackLabel);
49 # undef SET
50  }
#define SET(N)
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

bool crvtx::CosmicRayVertex::fObeyPreselection
private

Check rb::IsFiltered?

Definition at line 33 of file CosmicRayVertex_module.cc.

std::string crvtx::CosmicRayVertex::fSliceLabel
private

Where to get slices?

Definition at line 31 of file CosmicRayVertex_module.cc.

std::string crvtx::CosmicRayVertex::fTrackLabel
private

Where to look for tracks?

Definition at line 32 of file CosmicRayVertex_module.cc.


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