9 #define LAR_CALO_HIT_H 1 11 #include "Objects/CaloHit.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" 38 class LArCaloHit :
public object_creation::CaloHit::Object
53 unsigned int GetLArTPCVolumeId()
const;
64 class LArCaloHitFactory :
public pandora::ObjectFactory<object_creation::CaloHit::Parameters, object_creation::CaloHit::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::CaloHit::Object(parameters),
127 const LArCaloHitParameters &larCaloHitParameters(dynamic_cast<const LArCaloHitParameters&>(parameters));
128 pObject =
new LArCaloHit(larCaloHitParameters);
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(larTPCVolumeId));
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(
"LArTPCVolumeId", larTPCVolumeId));
152 return pandora::STATUS_CODE_INVALID_PARAMETER;
158 return pandora::STATUS_CODE_SUCCESS;
166 const LArCaloHit *
const pLArCaloHit(dynamic_cast<const LArCaloHit*>(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(pLArCaloHit->
GetLArTPCVolumeId()));
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(
"LArTPCVolumeId", pLArCaloHit->
GetLArTPCVolumeId()));
183 return pandora::STATUS_CODE_INVALID_PARAMETER;
186 return pandora::STATUS_CODE_SUCCESS;
191 #endif // #ifndef LAR_CALO_HIT_H
Parameters * NewParameters() const
Create new parameters instance on the heap (memory-management to be controlled by user) ...
pandora::StatusCode Read(Parameters ¶meters, pandora::FileReader &fileReader) const
Read any additional (derived class only) object parameters from file using the specified file reader...
pandora::InputUInt m_larTPCVolumeId
The lar tpc volume id.
unsigned int GetLArTPCVolumeId() const
Get the lar tpc volume id.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
unsigned int m_larTPCVolumeId
The lar tpc volume id.
pandora::StatusCode Write(const Object *const pObject, pandora::FileWriter &fileWriter) const
Persist any additional (derived class only) object parameters using the specified file writer...
pandora::StatusCode Create(const Parameters ¶meters, const Object *&pObject) const
Create an object with the given parameters.
LArCaloHitFactory responsible for object creation.
LArCaloHit(const LArCaloHitParameters ¶meters)
Constructor.