All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
lar::example::details Namespace Reference

Implementation detail namespace (content is not documented) More...

Classes

struct  PointTraits_t
 
struct  PositionExtractorFromArray
 Base for PositionExtractor on random-access containers. More...
 

Typedefs

template<typename Point >
using ExtractCoordType_t = typename details::PointTraits_t< Point >::Coord_t
 type of Point coordinate More...
 

Functions

template<typename Point >
auto extractPositionX (Point const &point)
 
template<typename Point >
auto extractPositionY (Point const &point)
 
template<typename Point >
auto extractPositionZ (Point const &point)
 
template<typename Coord >
std::array< size_t, 3 > diceVolume (CoordRangeCells< Coord > const &rangeX, CoordRangeCells< Coord > const &rangeY, CoordRangeCells< Coord > const &rangeZ)
 Returns the dimensions of a grid diced with the specified size. More...
 
template<typename ROOTobj >
std::unique_ptr< ROOTobj > readROOTobject (TDirectory *sourceDir, std::string name)
 

Detailed Description

Implementation detail namespace (content is not documented)

Typedef Documentation

template<typename Point >
using lar::example::details::ExtractCoordType_t = typedef typename details::PointTraits_t<Point>::Coord_t

type of Point coordinate

Definition at line 95 of file SpacePartition.h.

Function Documentation

template<typename Coord >
std::array<size_t, 3> lar::example::details::diceVolume ( CoordRangeCells< Coord > const &  rangeX,
CoordRangeCells< Coord > const &  rangeY,
CoordRangeCells< Coord > const &  rangeZ 
)

Returns the dimensions of a grid diced with the specified size.

Definition at line 356 of file SpacePartition.h.

361  {
362  return {{
363  size_t(std::ceil(rangeX.size() / rangeX.cellSize)),
364  size_t(std::ceil(rangeY.size() / rangeY.cellSize)),
365  size_t(std::ceil(rangeZ.size() / rangeZ.cellSize))
366  }};
367  } // diceVolume()
template<typename Point >
auto lar::example::details::extractPositionX ( Point const &  point)

Definition at line 303 of file SpacePartition.h.

304  { return PositionExtractor<Point>::x(point); }
process_name opflash particleana ie x
template<typename Point >
auto lar::example::details::extractPositionY ( Point const &  point)

Definition at line 306 of file SpacePartition.h.

307  { return PositionExtractor<Point>::y(point); }
process_name opflash particleana ie ie y
template<typename Point >
auto lar::example::details::extractPositionZ ( Point const &  point)

Definition at line 309 of file SpacePartition.h.

310  { return PositionExtractor<Point>::z(point); }
process_name opflash particleana ie ie ie z
template<typename ROOTobj >
std::unique_ptr< ROOTobj > lar::example::details::readROOTobject ( TDirectory *  sourceDir,
std::string  name 
)

Reads an object from a ROOT directory, checking its type

Exceptions
cet::exceptionif no object or wrong type

Definition at line 284 of file ShowerCalibrationGaloreFromPID.h.

285 {
286  if (!sourceDir) {
287  throw cet::exception("readROOTobject")
288  << "Invalid source ROOT directory\n";
289  }
290 
291  // read the object and immediately claim its ownership
292  TObject* pObj = sourceDir->Get(name.c_str());
293  if (!pObj) {
294  throw cet::exception("readROOTobject")
295  << "No object '" << name << "' in ROOT directory '"
296  << sourceDir->GetPath() << "'\n";
297  }
298 
299  if (std::is_base_of<TH1, std::decay_t<ROOTobj>>::value)
300  static_cast<TH1*>(pObj)->SetDirectory(nullptr);
301 // if (std::is_base_of<TTree, std::decay_t<ROOTobj>>::value)
302 // static_cast<TTree*>(pObj)->SetDirectory(nullptr);
303  std::unique_ptr<TObject> obj(pObj);
304 
305  // use ROOT to investigate whether this is the right type
306  if (!obj->InheritsFrom(ROOTobj::Class())) {
307  throw cet::exception("readROOTobject")
308  << "Object '" << name << "' in ROOT directory '"
309  << sourceDir->GetPath() << "' is a " << obj->IsA()->GetName()
310  << ", not derived from " << ROOTobj::Class()->GetName() << "\n";
311  }
312 
313  // now that we are sure obj is of the right type, we transfer ownership
314  // from obj to the return value (that here is implicitly constructed)
315  return std::unique_ptr<ROOTobj>(static_cast<ROOTobj*>(obj.release()));
316 } // lar::example::details::readROOTobject()
then echo fcl name
temporary value