LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::LArCaloHitFactory Class Reference

LArCaloHitFactory responsible for object creation. More...

#include "LArCaloHit.h"

Inheritance diagram for lar_content::LArCaloHitFactory:

Public Member Functions

Parameters * NewParameters () const
 Create new parameters instance on the heap (memory-management to be controlled by user) More...
 
pandora::StatusCode Read (Parameters &parameters, pandora::FileReader &fileReader) const
 Read any additional (derived class only) object parameters from file using the specified file reader. More...
 
pandora::StatusCode Write (const Object *const pObject, pandora::FileWriter &fileWriter) const
 Persist any additional (derived class only) object parameters using the specified file writer. More...
 
pandora::StatusCode Create (const Parameters &parameters, const Object *&pObject) const
 Create an object with the given parameters. More...
 

Detailed Description

LArCaloHitFactory responsible for object creation.

Definition at line 64 of file LArCaloHit.h.

Member Function Documentation

pandora::StatusCode lar_content::LArCaloHitFactory::Create ( const Parameters &  parameters,
const Object *&  pObject 
) const
inline

Create an object with the given parameters.

Parameters
parametersthe parameters to pass in constructor
pObjectto receive the address of the object created

Definition at line 125 of file LArCaloHit.h.

References lar_content::LArCaloHit::LArCaloHit().

126 {
127  const LArCaloHitParameters &larCaloHitParameters(dynamic_cast<const LArCaloHitParameters&>(parameters));
128  pObject = new LArCaloHit(larCaloHitParameters);
129 
130  return pandora::STATUS_CODE_SUCCESS;
131 }
LArCaloHitFactory::Parameters * lar_content::LArCaloHitFactory::NewParameters ( ) const
inline

Create new parameters instance on the heap (memory-management to be controlled by user)

Returns
the address of the new parameters instance

Definition at line 118 of file LArCaloHit.h.

119 {
120  return (new LArCaloHitParameters);
121 }
pandora::StatusCode lar_content::LArCaloHitFactory::Read ( Parameters &  parameters,
pandora::FileReader &  fileReader 
) const
inline

Read any additional (derived class only) object parameters from file using the specified file reader.

Parameters
parametersthe parameters to pass in constructor
fileReaderthe file reader, used to extract any additional parameters from file

Definition at line 135 of file LArCaloHit.h.

References lar_content::LArCaloHitParameters::m_larTPCVolumeId, and max.

136 {
137  // ATTN: To receive this call-back must have already set file reader mc particle factory to this factory
138  unsigned int larTPCVolumeId(std::numeric_limits<unsigned int>::max());
139 
140  if (pandora::BINARY == fileReader.GetFileType())
141  {
142  pandora::BinaryFileReader &binaryFileReader(dynamic_cast<pandora::BinaryFileReader&>(fileReader));
143  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileReader.ReadVariable(larTPCVolumeId));
144  }
145  else if (pandora::XML == fileReader.GetFileType())
146  {
147  pandora::XmlFileReader &xmlFileReader(dynamic_cast<pandora::XmlFileReader&>(fileReader));
148  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileReader.ReadVariable("LArTPCVolumeId", larTPCVolumeId));
149  }
150  else
151  {
152  return pandora::STATUS_CODE_INVALID_PARAMETER;
153  }
154 
155  LArCaloHitParameters &larCaloHitParameters(dynamic_cast<LArCaloHitParameters&>(parameters));
156  larCaloHitParameters.m_larTPCVolumeId = larTPCVolumeId;
157 
158  return pandora::STATUS_CODE_SUCCESS;
159 }
Int_t max
Definition: plot.C:27
pandora::StatusCode lar_content::LArCaloHitFactory::Write ( const Object *const  pObject,
pandora::FileWriter &  fileWriter 
) const
inline

Persist any additional (derived class only) object parameters using the specified file writer.

Parameters
pObjectthe address of the object to persist
fileWriterthe file writer

Definition at line 163 of file LArCaloHit.h.

References lar_content::LArCaloHit::GetLArTPCVolumeId().

164 {
165  // ATTN: To receive this call-back must have already set file writer mc particle factory to this factory
166  const LArCaloHit *const pLArCaloHit(dynamic_cast<const LArCaloHit*>(pObject));
167 
168  if (!pLArCaloHit)
169  return pandora::STATUS_CODE_INVALID_PARAMETER;
170 
171  if (pandora::BINARY == fileWriter.GetFileType())
172  {
173  pandora::BinaryFileWriter &binaryFileWriter(dynamic_cast<pandora::BinaryFileWriter&>(fileWriter));
174  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileWriter.WriteVariable(pLArCaloHit->GetLArTPCVolumeId()));
175  }
176  else if (pandora::XML == fileWriter.GetFileType())
177  {
178  pandora::XmlFileWriter &xmlFileWriter(dynamic_cast<pandora::XmlFileWriter&>(fileWriter));
179  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileWriter.WriteVariable("LArTPCVolumeId", pLArCaloHit->GetLArTPCVolumeId()));
180  }
181  else
182  {
183  return pandora::STATUS_CODE_INVALID_PARAMETER;
184  }
185 
186  return pandora::STATUS_CODE_SUCCESS;
187 }

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