8 #ifndef LAR_MC_PARTICLE_H 9 #define LAR_MC_PARTICLE_H 1 11 #include "Objects/MCParticle.h" 13 #include "Pandora/ObjectCreation.h" 14 #include "Pandora/PandoraObjectFactories.h" 16 #include "Persistency/BinaryFileReader.h" 17 #include "Persistency/BinaryFileWriter.h" 18 #include "Persistency/XmlFileReader.h" 19 #include "Persistency/XmlFileWriter.h" 53 int GetNuanceCode()
const;
64 class LArMCParticleFactory :
public pandora::ObjectFactory<object_creation::MCParticle::Parameters, object_creation::MCParticle::Object>
72 Parameters *NewParameters()
const;
80 pandora::StatusCode Read(Parameters ¶meters, pandora::FileReader &fileReader)
const;
88 pandora::StatusCode Write(
const Object *
const pObject, pandora::FileWriter &fileWriter)
const;
96 pandora::StatusCode Create(
const Parameters ¶meters,
const Object *&pObject)
const;
103 object_creation::MCParticle::Object(parameters),
127 const LArMCParticleParameters &larMCParticleParameters(dynamic_cast<const LArMCParticleParameters&>(parameters));
130 return pandora::STATUS_CODE_SUCCESS;
140 if (pandora::BINARY == fileReader.GetFileType())
142 pandora::BinaryFileReader &binaryFileReader(dynamic_cast<pandora::BinaryFileReader&>(fileReader));
143 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileReader.ReadVariable(nuanceCode));
145 else if (pandora::XML == fileReader.GetFileType())
147 pandora::XmlFileReader &xmlFileReader(dynamic_cast<pandora::XmlFileReader&>(fileReader));
148 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileReader.ReadVariable(
"NuanceCode", nuanceCode));
152 return pandora::STATUS_CODE_INVALID_PARAMETER;
158 return pandora::STATUS_CODE_SUCCESS;
166 const LArMCParticle *
const pLArMCParticle(dynamic_cast<const LArMCParticle*>(pObject));
169 return pandora::STATUS_CODE_INVALID_PARAMETER;
171 if (pandora::BINARY == fileWriter.GetFileType())
173 pandora::BinaryFileWriter &binaryFileWriter(dynamic_cast<pandora::BinaryFileWriter&>(fileWriter));
174 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, binaryFileWriter.WriteVariable(pLArMCParticle->
GetNuanceCode()));
176 else if (pandora::XML == fileWriter.GetFileType())
178 pandora::XmlFileWriter &xmlFileWriter(dynamic_cast<pandora::XmlFileWriter&>(fileWriter));
179 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, xmlFileWriter.WriteVariable(
"NuanceCode", pLArMCParticle->
GetNuanceCode()));
183 return pandora::STATUS_CODE_INVALID_PARAMETER;
186 return pandora::STATUS_CODE_SUCCESS;
191 #endif // #ifndef LAR_MC_PARTICLE_H
int GetNuanceCode() const
Get the nuance code.
int m_nuanceCode
The nuance code.
pandora::StatusCode Write(const Object *const pObject, pandora::FileWriter &fileWriter) const
Persist any additional (derived class only) object parameters using the specified file writer...
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
pandora::StatusCode Create(const Parameters ¶meters, const Object *&pObject) const
Create an object with the given parameters.
pandora::StatusCode Read(Parameters ¶meters, pandora::FileReader &fileReader) const
Read any additional (derived class only) object parameters from file using the specified file reader...
LArMCParticleFactory responsible for object creation.
LAr mc particle parameters.
pandora::InputInt m_nuanceCode
The nuance code.
LArMCParticle(const LArMCParticleParameters ¶meters)
Constructor.
Parameters * NewParameters() const
Create new parameters instance on the heap (memory-management to be controlled by user) ...