All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FilterNeutrinosActiveVolume_module.cc
Go to the documentation of this file.
1 /**
2  * @file icaruscode/Filters/FilterNeutrinosActiveVolume_module.cc
3  * @brief Discards events with no neutrino interaction in the specified volume.
4  * @authors Christian Farnese (farnese@pd.infn.it),
5  * Gianluca Petrillo (petrillo@slac.stanford.edu)
6  * @date May 6, 2020
7  *
8  * Run
9  *
10  * lar --print-description FilterNeutrinosActiveVolume
11  *
12  * for configuration directions.
13  *
14  */
15 
16 
17 // ICARUS libraries
19 
20 // LArSoft libraries
22 #include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
23 #include "lardataalg/MCDumpers/MCDumperUtils.h" // sim::TruthXXXName()
28 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::...::makeFromCoords()
30 #include "larcorealg/CoreUtils/StdUtils.h" // util::begin(), util::end()
32 #include "larcoreobj/SimpleTypesAndConstants/geo_vectors.h" // geo::Point_t
33 
34 // nutools libraries
35 #include "nusimdata/SimulationBase/MCTruth.h"
36 #include "nusimdata/SimulationBase/MCNeutrino.h"
37 
38 // framework libraries
39 #include "art/Framework/Services/Registry/ServiceHandle.h"
40 #include "art/Framework/Core/EDFilter.h"
41 #include "art/Framework/Core/ModuleMacros.h"
42 #include "art/Framework/Principal/Event.h"
43 #include "art/Framework/Principal/Handle.h"
44 #include "canvas/Utilities/Exception.h"
45 #include "fhiclcpp/types/Sequence.h"
46 #include "fhiclcpp/types/OptionalSequence.h"
47 #include "fhiclcpp/types/Table.h"
48 #include "fhiclcpp/types/Atom.h"
49 #include "messagefacility/MessageLogger/MessageLogger.h"
50 
51 // C++ standard libraries
52 #include <regex>
53 #include <algorithm> // std::sort(), std::binary_search()
54 #include <vector>
55 #include <string>
56 #include <atomic>
57 #include <utility> // std::move()
58 #include <cmath> // std::abs()
59 
60 
61 // -----------------------------------------------------------------------------
62 namespace icarus::simfilter { class FilterNeutrinosActiveVolume; }
63 
64 
65 /**
66  * @brief Accepts only neutrino-like events with vertices in a specified volume.
67  *
68  * The module identifies a list of volumes to filter on.
69  * The filter selects "qualifying" neutrino interactions that:
70  *
71  * * have interaction vertex in one of a selected list of volumes
72  * * optionally, has a specific interaction type
73  * (like in `simb::MCNeutrino::InteractionType()`)
74  * * optionally, has a specific current type (see `simb::MCNeutrino::CCNC()`)
75  *
76  * The event is kept if there is _at least_ one qualifying interaction.
77  * In that case, the whole event is passed (including any other interaction).
78  *
79  *
80  * Input
81  * ======
82  *
83  * Truth information from all data products in the form
84  * `std::vector<simb::MCTruth>` will be evaluated.
85  * It is an error for an event to have no such data product (but they can all be
86  * empty, in which case the event does _not_ qualify).
87  *
88  *
89  * Configuration
90  * ==============
91  *
92  * Parameters
93  * -----------
94  *
95  * The module can be operated in one of two ways: active volumes or generic.
96  * In the active volume mode, all TPC active volumes are used for filtering.
97  * In the generic mode, all the specified volumes are used for filtering.
98  *
99  * * `inActive` (flag, default: `false`): if set to `true`, the "active volume
100  * mode" is activated;
101  * * `volumeBoxes` (list of coordinate sets; default: empty): a list of selected
102  * volumes is specified as a collection of box coordinates, each one in the
103  * form of a table:
104  * * `Xmin`: lower _x_ coordinate
105  * * `Xmax`: upper _x_ coordinate
106  * * `Ymin`: lower _y_ coordinate
107  * * `Ymax`: upper _y_ coordinate
108  * * `Zmin`: lower _z_ coordinate
109  * * `Zmax`: upper _z_ coordinate
110  * each coordinate is in centimeters, and in the "world" reference frame
111  * * `volumeNames` (list of strings; default: empty): a list of selected volume
112  * patterns is specified as volume names; all volumes in the detector geometry
113  * with the specified names are included in the list (for example, specifying
114  * `volCryostat` _all_ cryostats will be included); each pattern is a regular
115  * expression like parsed by `std::regex` with default flags;
116  * * `interactionTypes` (list of integers, optional): if specified, interactions
117  * only qualify if they belong to _any_ of these interaction types;
118  * see `simb::MCNeutrino::InteractionType()`, and `simb::int_type_` definition
119  * for the values and their meanings;
120  * * `weakCurrent` (`CC` or `NC`, optional): if specified, interactions
121  * qualify only if they are tagged as charged or neutral currents;
122  * see `icarus::WeakCurrentTypes::parse()`;
123  * * `logCategory` (string, default: `FilterNeutrinosActiveVolume`): name of the
124  * category this module uses to send messages to the message facility.
125  *
126  * It is required that at least one among `inActive`, `volumeNames`,
127  * `volumeBoxes`, `weakCurrent` and `interactionTypes` are specified.
128  *
129  *
130  * Filtering
131  * ----------
132  *
133  * This is a filter module: its configuration must appear in the `filters`
134  * table and to be included in a path in `trigger_path`, and the output module
135  * must be told to include that path in `SelectEvents` configuration key; e.g.:
136  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137  * physics: {
138  * filters: {
139  * eventActive: @local::icarus_FilterNeutrinoActive
140  * # ...
141  * } # filters
142  * # ...
143  *
144  * appliedFilters: [ eventActive ]
145  *
146  * trigger_paths: [ appliedFilters ]
147  *
148  * } # physics
149  *
150  *
151  * outputs: {
152  * rootoutput: {
153  * module_type: RootOutput
154  * fileName: "%ifb_%tc-%p.root"
155  * SelectEvents: [ appliedFilters ]
156  * }
157  * }
158  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159  *
160  */
162 
163  public:
164 
165  /// Configuration of box volume geometry.
166  struct BoxCoordConfig {
167  using Name = fhicl::Name;
168  using Comment = fhicl::Comment;
169 
170  fhicl::Atom<double> Xmin {
171  Name("Xmin"),
172  Comment("minimum x coordinate of the volume [cm]")
173  };
174  fhicl::Atom<double> Ymin {
175  Name("Ymin"),
176  Comment("minimum y coordinate of the volume [cm]")
177  };
178  fhicl::Atom<double> Zmin {
179  Name("Zmin"),
180  Comment("minimum z coordinate of the volume [cm]")
181  };
182  fhicl::Atom<double> Xmax {
183  Name("Xmax"),
184  Comment("maximum x coordinate of the volume [cm]")
185  };
186  fhicl::Atom<double> Ymax {
187  Name("Ymax"),
188  Comment("maximum y coordinate of the volume [cm]")
189  };
190  fhicl::Atom<double> Zmax {
191  Name("Zmax"),
192  Comment("maximum z coordinate of the volume [cm]")
193  };
194 
195  }; // struct BoxCoordConfig
196 
197 
198  /// Configuration parameter structure.
199  struct Config {
200  using Name = fhicl::Name;
201  using Comment = fhicl::Comment;
202 
203  fhicl::Atom<bool> inActive {
204  Name("inActive"),
205  Comment("selects only events with interactions in TPC active volumes"),
206  false // default
207  };
208 
209  fhicl::OptionalSequence<fhicl::Table<BoxCoordConfig>> volumeBoxes {
210  Name("volumeBoxes"),
211  Comment("interactions in box volumes by world coordinates [cm]")
212  };
213 
214  fhicl::Sequence<std::string> volumeNames {
215  Name("volumeNames"),
216  Comment("interactions in box volumes by name (std::regex pattern)"),
217  std::vector<std::string>{} // default value
218  };
219 
220  fhicl::Sequence<int> interactionTypes {
221  Name("interactionTypes"),
222  Comment(
223  "require an interaction of one of these types (`simb::MCNeutrino::InteractionType()`)"
224  ),
225  std::vector<int>{}
226  };
227 
228  fhicl::Atom<std::string> weakCurrent {
229  Name("weakCurrent"),
230  Comment(
231  "require an interaction of charged or neutral current (\"CC\", \"NC\", \"any\")"
232  ),
233  "any" // default
234  };
235 
236  fhicl::Atom<std::string> logCategory {
237  Name("logCategory"),
238  Comment("category name for message facility message stream"),
239  "FilterNeutrinosActiveVolume" // default
240  };
241 
242  }; // Config
243 
244  using Parameters = art::EDFilter::Table<Config>;
245 
246 
247  /// Constructor: reads configuration and extracts information from geometry.
248  explicit FilterNeutrinosActiveVolume(Parameters const& config);
249 
250  /// Framework hook: applies the filter.
251  virtual bool filter(art::Event& event) override;
252 
253  /// Framework hook: prints the summary of the passed events.
254  virtual void endJob() override;
255 
256  private:
257 
258  // --- BEGIN -- Configuration parameters -----------------------------------
259 
260  /// Volumes for qualifying interactions.
261  std::vector<geo::BoxBoundedGeo> fVolumes;
262 
263  /// List of qualifying interaction types.
264  std::vector<int> const fInteractions;
265 
266  icarus::WeakCurrentType const fWeakCurrentType; ///< Selected weak current.
267 
268  std::string const fLogCategory; ///< Category name for the output stream.
269 
270  // --- END -- Configuration parameters -------------------------------------
271 
272 
273  // --- BEGIN -- Counters ---------------------------------------------------
274 
275  std::atomic<unsigned int> fNObserved { 0U }; ///< Number of observed events.
276  std::atomic<unsigned int> fNPassed { 0U }; ///< Number of passed events.
277 
278  // --- END -- Counters -----------------------------------------------------
279 
280  /// Adds all active volumes of detector into the qualifying volume list.
281  void addActiveVolumes();
282 
283  /// Adds the specified volumes into the qualifying volume list.
284  void addVolumeBoxes
285  (fhicl::OptionalSequence<fhicl::Table<BoxCoordConfig>> const& boxConfig);
286 
287  /// Adds all `volName` from geometry into the qualifying volume list.
288  unsigned addVolumeByName(std::string const& volumeName);
289 
290 
291  /// Returns whether the interaction described in `truth` qualifies.
292  bool qualifying(simb::MCTruth const& truth) const;
293 
294  /// Returns whether the interaction type is qualifying.
295  bool qualifyingInteractionType(int const interactionType) const;
296 
297  /// Returns whether the weak current type is qualifying.
298  bool qualifyingWeakCurrent(int const CCNC) const;
299 
300  /// Returns whether the location is among the accepted ones.
301  bool qualifyingLocation(geo::Point_t const& location) const;
302 
303 
304  /// Returns a sorted copy of the specified collection.
305  template <typename Coll>
306  static Coll sorted(Coll const& coll);
307 
308 
309 }; // icarus::simfilter::FilterNeutrinosActiveVolume
310 
311 
312 
313 // -----------------------------------------------------------------------------
314 // --- Implementation
315 // -----------------------------------------------------------------------------
317  (Parameters const& config)
318  : art::EDFilter(config)
319  , fInteractions(sorted(config().interactionTypes()))
320  , fWeakCurrentType(config().weakCurrent())
321  , fLogCategory(config().logCategory())
322 {
323 
324  { // local scope
325  mf::LogInfo log(fLogCategory);
326 
327  log << "Filter configuration:";
328 
329  if (!fInteractions.empty()) {
330  log << "\n * required one of these " << size(fInteractions)
331  << " interaction types:";
332  for (int intType: fInteractions)
333  log << "\n - " << sim::TruthInteractionTypeName(intType);
334  } // if
335 
336  log << "\n * weak current type: " << std::string(fWeakCurrentType);
337 
338  log << "\nConfiguration of qualifying volumes:";
339 
340  }
341 
342  //
343  // load volumes from the different sources
344  //
345  if (config().inActive()) addActiveVolumes();
346 
347  addVolumeBoxes(config().volumeBoxes);
348 
349  for (std::string const& volName: config().volumeNames())
350  addVolumeByName(volName);
351 
352  //
353  // check that we are doing at least something
354  //
355  if (fVolumes.empty()
356  && fInteractions.empty()
357  && (fWeakCurrentType == icarus::AnyWeakCurrentType)
358  ) {
359 
360  throw art::Exception(art::errors::Configuration)
361  << "No filtering action specified (volume, current nor interaction type).\n"
362  ;
363 
364  } // if no filter
365 
366 } // icarus::simfilter::FilterNeutrinosActiveVolume::FilterNeutrinosActiveVolume()
367 
368 
369 // -----------------------------------------------------------------------------
371 
372  ++fNObserved;
373 
374  /*
375  * Consider all truth information available in the event.
376  * Any record of any truth data product will be enough to pass the event.
377  */
378  //std::vector<art::Handle<std::vector<simb::MCTruth>>> allTruth;
379  //event.getManyByType(allTruth);
380  auto allTruth = event.getMany<std::vector<simb::MCTruth>>();
381 
382  if (allTruth.empty()) { // is this real data?
383  throw art::Exception(art::errors::ProductNotFound)
384  << event.id() << " has no truth information!\n";
385  } // if no truth
386 
387  mf::LogDebug(fLogCategory)
388  << "Event " << event.id() << " (#" << fNObserved << ") has "
389  << allTruth.size() << " truth data products.";
390 
391  for (auto const& handle: allTruth) {
392 
393  art::InputTag const& tag [[gnu::unused]] = handle.provenance()->inputTag();
394 
395  std::vector<simb::MCTruth> const& truths = *handle;
396  if (truths.empty()) {
397  mf::LogTrace(fLogCategory)
398  << "No truth records from " << tag.encode() << ": skipped.";
399  continue;
400  } // if no truth
401 
402  for (auto const& [ iTruth, truth ]: util::enumerate(truths)) {
403 
404  mf::LogTrace(fLogCategory)
405  << "Processing record [" << (iTruth + 1U) << "/" << truths.size()
406  << "] from " << tag.encode();
407 
408  if (!qualifying(truth)) continue; // neeext!
409 
410  ++fNPassed;
411  mf::LogTrace(fLogCategory) << "Event " << event.id()
412  << " (#" << fNObserved << ") passes the filter in virtue of "
413  << tag.encode() << " record " << (iTruth + 1U)
414  << " (" << fNPassed << "/" << fNObserved << " passed so far)."
415  ;
416  return true;
417 
418  } // for truth record
419 
420  } // for truth data product
421 
422  mf::LogTrace(fLogCategory) << "Event " << event.id() << " (#" << fNObserved
423  << ") does not pass the filter (" << fNPassed << "/" << fNObserved
424  << " passed so far).";
425 
426  return false;
427 
428 } // icarus::simfilter::FilterNeutrinosActiveVolume::filter()
429 
430 
431 // -----------------------------------------------------------------------------
433 
434  mf::LogInfo log(fLogCategory);
435  log
436  << "FilterNeutrinosActiveVolume: passed " << fNPassed << " / " << fNObserved
437  << " events";
438  if (fNObserved > 0U)
439  log << " (" << (float(fNPassed) * 100. / fNObserved) << "%)";
440 
441 } // icarus::simfilter::FilterNeutrinosActiveVolume::endJob()
442 
443 
444 // -----------------------------------------------------------------------------
446 
447  geo::GeometryCore const& geom = *(lar::providerFrom<geo::Geometry>());
448 
449  for (geo::TPCGeo const& TPC: geom.IterateTPCs()) {
450 
451  geo::BoxBoundedGeo const& box = TPC.ActiveBoundingBox();
452 
453  mf::LogVerbatim(fLogCategory)
454  << "[volume #" << fVolumes.size() << "] active volume from " << TPC.ID()
455  << ": [ " << box.Min() << " -- " << box.Max() << " ]";
456 
457  fVolumes.push_back(box);
458 
459  } // for all TPCs
460 
461 } // icarus::simfilter::FilterNeutrinosActiveVolume::addActiveVolumes()
462 
463 
464 // -----------------------------------------------------------------------------
466  (fhicl::OptionalSequence<fhicl::Table<BoxCoordConfig>> const& boxConfig)
467 {
468  std::vector<BoxCoordConfig> boxParams;
469 
470  if (!boxConfig(boxParams)) return;
471 
472  for (auto const& [ iBox, boxParam ]: util::enumerate(boxParams)) {
473 
474  geo::BoxBoundedGeo box {
475  boxParam.Xmin(), boxParam.Xmax(),
476  boxParam.Ymin(), boxParam.Ymax(),
477  boxParam.Zmin(), boxParam.Zmax()
478  };
479 
480  mf::LogVerbatim(fLogCategory)
481  << "[volume #" << fVolumes.size() << "] box coordinates #" << iBox
482  << ": [ " << box.Min() << " -- " << box.Max() << " ]";
483 
484  fVolumes.push_back(std::move(box));
485 
486  } // for boxes
487 
488 } // icarus::simfilter::FilterNeutrinosActiveVolume::addVolumeBoxes()
489 
490 
491 // -----------------------------------------------------------------------------
493  (std::string const& volumePattern)
494 {
495 
496  geo::GeometryCore const& geom = *(lar::providerFrom<geo::Geometry>());
497 
498  //
499  // find the path of all volumes matching the given pattern
500  //
501  std::regex const namePattern { volumePattern };
502  std::vector<geo::GeoNodePath> volumePaths;
503  auto const matchMe = [&pattern=namePattern](std::string const& s)
504  { std::smatch match; return (std::regex_match(s, match, pattern)); };
505  auto const findVolume = [&volumePaths, &patternMatcher=matchMe](auto& path)
506  {
507  if (patternMatcher(path.current().GetVolume()->GetName()))
508  volumePaths.push_back(path);
509  return true;
510  };
511 
512  geo::ROOTGeometryNavigator navigator { *(geom.ROOTGeoManager()) };
513 
514  navigator.apply(findVolume);
515 
516  if (volumePaths.empty()) {
517  throw art::Exception(art::errors::Configuration)
518  << "No volume matching '" << volumePattern
519  << "' has been found in the detector '" << geom.DetectorName()
520  << "'.\n";
521  }
522 
523  //
524  // convert each volume into world coordinates and add it to the list
525  //
526  for (auto const& [ iVolume, path ] : util::enumerate(volumePaths)) {
527 
528  //
529  // find the coordinates of the volume in local coordinates
530  //
531  TGeoShape const* pShape = path.current().GetVolume()->GetShape();
532  auto pBox = dynamic_cast<TGeoBBox const*>(pShape);
533  if (!pBox) {
534  throw cet::exception("FilterNeutrinosActiveVolume") << "Volume '"
535  << path.current().GetName() << "' is a " << pShape->IsA()->GetName()
536  << ", not a TGeoBBox.\n";
537  }
538 
539  geo::Point_t const origin
540  = geo::vect::makeFromCoords<geo::Point_t>(pBox->GetOrigin());
541  geo::Vector_t const diag = {
542  std::abs(pBox->GetDX()), std::abs(pBox->GetDY()), std::abs(pBox->GetDZ())
543  };
544 
545  //
546  // convert to world coordinates
547  //
548 
549  auto const trans
550  = path.currentTransformation<geo::TransformationMatrix>();
551 
552  geo::Point_t min, max;
553  trans.Transform(origin - diag, min);
554  trans.Transform(origin + diag, max);
555 
556  //
557  // add to the coordinates
558  //
559  geo::BoxBoundedGeo box { min, max };
560 
561  mf::LogVerbatim(fLogCategory)
562  << " c* [volume #" << fVolumes.size() << "] volume box '"
563  << path.current().GetVolume()->GetName()
564  << "' [(" << (iVolume + 1U) << "/" << volumePaths.size()
565  << "): [ " << box.Min() << " -- " << box.Max() << " ]";
566 
567  fVolumes.push_back(std::move(box));
568 
569  } // for all volume paths
570 
571  return volumePaths.size();
572 } // icarus::simfilter::FilterNeutrinosActiveVolume::addVolumeByName()
573 
574 
575 // -----------------------------------------------------------------------------
577  (simb::MCTruth const& truth) const
578 {
579  /*
580  * Apply all the needed cuts:
581  * * interaction type
582  * * current type
583  * * location
584  *
585  */
586 
587  //
588  // only neutrino record types may qualify:
589  //
590  if (!truth.NeutrinoSet()) {
591  mf::LogTrace(fLogCategory)
592  << "Interaction does not qualify because it is not tagged as neutrino.";
593  return false;
594  }
595 
596  simb::MCNeutrino const& nuInfo = truth.GetNeutrino();
597  simb::MCParticle const& nu = nuInfo.Nu();
598 
599  //
600  // interaction type
601  //
602  if (!fInteractions.empty() && !qualifyingInteractionType(nuInfo.InteractionType()))
603  return false;
604 
605  //
606  // current type
607  //
608  if ((fWeakCurrentType != icarus::AnyWeakCurrentType) && !qualifyingWeakCurrent(nuInfo.CCNC()))
609  return false;
610 
611  //
612  // location
613  //
614  if (!fVolumes.empty() && !qualifyingLocation({ nu.Vx(), nu.Vy(), nu.Vz() }))
615  return false;
616 
617  // success, after all
618  return true;
619 
620 } // icarus::simfilter::FilterNeutrinosActiveVolume::qualifying()
621 
622 
623 // -----------------------------------------------------------------------------
625  (int const interactionType) const
626 {
627  mf::LogTrace log(fLogCategory);
628  log
629  << "Interaction type: " << sim::TruthInteractionTypeName(interactionType)
630  << " (" << interactionType << ")";
631 
632  bool const pass = std::binary_search
633  (begin(fInteractions), end(fInteractions), interactionType);
634  log << " => :-" << (pass? ')': '(');
635  return pass;
636 
637 } // icarus::simfilter::FilterNeutrinosActiveVolume::qualifyingInteractionType()
638 
639 
640 // -----------------------------------------------------------------------------
641 /// Returns whether the weak current type is qualifying.
643  (int const CCNC) const
644 {
646 
647  mf::LogTrace log(fLogCategory);
648  log << "Interaction current: " << sim::TruthCCNCname(CCNC)
649  << " (" << CCNC << ")";
650 
651  bool pass = false;
652  switch (fWeakCurrentType) {
653  case WeakCurrentType::CC: pass = (CCNC == simb::kCC); break;
654  case WeakCurrentType::NC: pass = (CCNC == simb::kNC); break;
655  case WeakCurrentType::any: pass = true; break;
656  } // switch
657 
658  log << " => :-" << (pass? ')': '(');
659  return pass;
660 
661 } // icarus::simfilter::FilterNeutrinosActiveVolume::qualifyingWeakCurrent()
662 
663 
664 // -----------------------------------------------------------------------------
666  (geo::Point_t const& location) const
667 {
668 
669  mf::LogTrace log(fLogCategory);
670  log << "Interaction location: " << location << " cm";
671 
672  for (auto const& [ iBox, box ]: util::enumerate(fVolumes)) {
673  if (!box.ContainsPosition(location)) continue;
674 
675  log << " => in volume #" << iBox
676  << " [ " << box.Min() << " -- " << box.Max() << " ] => :-)";
677 
678  return true;
679  } // for
680 
681  log << " => :-(";
682  return false;
683 
684 } // icarus::simfilter::FilterNeutrinosActiveVolume::qualifyingLocation()
685 
686 
687 // -----------------------------------------------------------------------------
688 template <typename Coll>
690 
691  // copy, sort, return
692  auto sortedColl { coll };
693  std::sort(util::begin(sortedColl), util::end(sortedColl));
694  return sortedColl;
695 
696 } // icarus::simfilter::FilterNeutrinosActiveVolume::sorted()
697 
698 
699 
700 // -----------------------------------------------------------------------------
702 
703 
704 // -----------------------------------------------------------------------------
705 
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
icarus::WeakCurrentType const fWeakCurrentType
Selected weak current.
virtual void endJob() override
Framework hook: prints the summary of the passed events.
fhicl::OptionalSequence< fhicl::Table< BoxCoordConfig > > volumeBoxes
std::string const fLogCategory
Category name for the output stream.
Utilities related to art service access.
Represents a type of weak current.
std::string TruthInteractionTypeName(int type)
bool apply(geo::GeoNodePath &path, Op &&op) const
Applies the specified operation to all nodes under the path.
bool qualifyingInteractionType(int const interactionType) const
Returns whether the interaction type is qualifying.
Executes an operation on all the nodes of the ROOT geometry.
Definition of util::enumerate().
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Class representing a path in ROOT geometry.
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
std::string TruthCCNCname(int ccnc)
std::vector< geo::BoxBoundedGeo > fVolumes
Volumes for qualifying interactions.
Class representing a path in ROOT geometry.
std::atomic< unsigned int > fNPassed
Number of passed events.
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
BEGIN_PROLOG TPC
unsigned addVolumeByName(std::string const &volumeName)
Adds all volName from geometry into the qualifying volume list.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
FilterNeutrinosActiveVolume(Parameters const &config)
Constructor: reads configuration and extracts information from geometry.
fDetProps &fDetProps fDetProps &fDetProps fLogCategory
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 caloskimCalorimetryCryoE physics caloskimCalorimetryCryoW physics path
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Access the description of detector geometry.
T abs(T value)
Charged-current interactions.
Definition: IPrediction.h:38
bool qualifyingLocation(geo::Point_t const &location) const
Returns whether the location is among the accepted ones.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Definitions of geometry vector data types.
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
void addVolumeBoxes(fhicl::OptionalSequence< fhicl::Table< BoxCoordConfig >> const &boxConfig)
Adds the specified volumes into the qualifying volume list.
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
Utilities to extend the interface of geometry vectors.
BEGIN_PROLOG vertical distance to the surface Name
geo::Point_t Min() const
Returns the corner point with the smallest coordinates.
Description of geometry of one entire detector.
std::vector< int > const fInteractions
List of qualifying interaction types.
A C++ type to describe the type of weak current.
Provides a base class aware of world box coordinates.
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
Selection of the type of transformation matrix used in geometry.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
std::atomic< unsigned int > fNObserved
Number of observed events.
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
Utility functions to print MC truth information.
bool qualifying(simb::MCTruth const &truth) const
Returns whether the interaction described in truth qualifies.
Functions pulling in STL customization if available.
Neutral-current interactions.
Definition: IPrediction.h:39
virtual bool filter(art::Event &event) override
Framework hook: applies the filter.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
bool qualifyingWeakCurrent(int const CCNC) const
Returns whether the weak current type is qualifying.
constexpr WeakCurrentType AnyWeakCurrentType
Constant value for any weak current type.
BEGIN_PROLOG SN nu
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
art framework interface to geometry description
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
static Coll sorted(Coll const &coll)
Returns a sorted copy of the specified collection.
Accepts only neutrino-like events with vertices in a specified volume.
void addActiveVolumes()
Adds all active volumes of detector into the qualifying volume list.