LArCaloHitFactory responsible for object creation.
More...
#include <LArCaloHit.h>
|
| LArCaloHitFactory (const unsigned int version=1) |
| Constructor. More...
|
|
Parameters * | NewParameters () const |
| Create new parameters instance on the heap (memory-management to be controlled by user) More...
|
|
pandora::StatusCode | Read (Parameters ¶meters, 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 ¶meters, const Object *&pObject) const |
| Create an object with the given parameters. More...
|
|
LArCaloHitFactory responsible for object creation.
Definition at line 110 of file LArCaloHit.h.
lar_content::LArCaloHitFactory::LArCaloHitFactory |
( |
const unsigned int |
version = 1 | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 245 of file LArCaloHit.h.
unsigned int m_version
The LArCaloHit version.
pandora::StatusCode lar_content::LArCaloHitFactory::Create |
( |
const Parameters & |
parameters, |
|
|
const Object *& |
pObject |
|
) |
| const |
|
inline |
Create an object with the given parameters.
- Parameters
-
parameters | the parameters to pass in constructor |
pObject | to receive the address of the object created |
Definition at line 258 of file LArCaloHit.h.
260 const LArCaloHitParameters &larCaloHitParameters(dynamic_cast<const LArCaloHitParameters &>(parameters));
261 pObject =
new LArCaloHit(larCaloHitParameters);
263 return pandora::STATUS_CODE_SUCCESS;
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 251 of file LArCaloHit.h.
253 return (
new LArCaloHitParameters);
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
-
parameters | the parameters to pass in constructor |
fileReader | the file reader, used to extract any additional parameters from file |
Definition at line 268 of file LArCaloHit.h.
272 unsigned int daughterVolumeId(0);
274 if (pandora::BINARY == fileReader.GetFileType())
276 pandora::BinaryFileReader &binaryFileReader(dynamic_cast<pandora::BinaryFileReader &>(fileReader));
277 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileReader.ReadVariable(larTPCVolumeId));
279 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileReader.ReadVariable(daughterVolumeId));
281 else if (pandora::XML == fileReader.GetFileType())
283 pandora::XmlFileReader &xmlFileReader(dynamic_cast<pandora::XmlFileReader &>(fileReader));
284 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileReader.ReadVariable(
"LArTPCVolumeId", larTPCVolumeId));
286 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileReader.ReadVariable(
"DaughterVolumeId", daughterVolumeId));
290 return pandora::STATUS_CODE_INVALID_PARAMETER;
293 LArCaloHitParameters &larCaloHitParameters(dynamic_cast<LArCaloHitParameters &>(parameters));
294 larCaloHitParameters.m_larTPCVolumeId = larTPCVolumeId;
295 larCaloHitParameters.m_daughterVolumeId = daughterVolumeId;
297 return pandora::STATUS_CODE_SUCCESS;
unsigned int m_version
The LArCaloHit version.
static int max(int a, int b)
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
-
pObject | the address of the object to persist |
fileWriter | the file writer |
Definition at line 302 of file LArCaloHit.h.
305 const LArCaloHit *
const pLArCaloHit(dynamic_cast<const LArCaloHit *>(pObject));
308 return pandora::STATUS_CODE_INVALID_PARAMETER;
310 if (pandora::BINARY == fileWriter.GetFileType())
312 pandora::BinaryFileWriter &binaryFileWriter(dynamic_cast<pandora::BinaryFileWriter &>(fileWriter));
313 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileWriter.WriteVariable(pLArCaloHit->GetLArTPCVolumeId()));
315 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileWriter.WriteVariable(pLArCaloHit->GetDaughterVolumeId()));
317 else if (pandora::XML == fileWriter.GetFileType())
319 pandora::XmlFileWriter &xmlFileWriter(dynamic_cast<pandora::XmlFileWriter &>(fileWriter));
320 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileWriter.WriteVariable(
"LArTPCVolumeId", pLArCaloHit->GetLArTPCVolumeId()));
322 PANDORA_RETURN_RESULT_IF(
323 pandora::STATUS_CODE_SUCCESS, !=, xmlFileWriter.WriteVariable(
"DaughterVolumeId", pLArCaloHit->GetDaughterVolumeId()));
327 return pandora::STATUS_CODE_INVALID_PARAMETER;
330 return pandora::STATUS_CODE_SUCCESS;
unsigned int m_version
The LArCaloHit version.
unsigned int lar_content::LArCaloHitFactory::m_version |
|
private |
The documentation for this class was generated from the following file: