21 m_pContainerXmlNode(nullptr),
22 m_pCurrentXmlElement(nullptr),
30 std::cout <<
"XmlFileReader - Invalid xml file." << std::endl;
51 return STATUS_CODE_FAILURE;
53 return STATUS_CODE_SUCCESS;
77 return STATUS_CODE_SUCCESS;
86 if (std::string(
"Event") == containerId)
90 else if (std::string(
"Geometry") == containerId)
104 int nGeometriesRead(0);
112 while (nGeometriesRead <
static_cast<int>(geometryNumber))
118 return STATUS_CODE_SUCCESS;
133 while (nEventsRead <
static_cast<int>(eventNumber))
139 return STATUS_CODE_SUCCESS;
159 return STATUS_CODE_NOT_FOUND;
164 if (std::string(
"SubDetector") == componentName)
168 if (std::string(
"LArTPC") == componentName)
172 if (std::string(
"LineGap") == componentName)
176 else if (std::string(
"BoxGap") == componentName)
180 else if (std::string(
"ConcentricGap") == componentName)
186 return STATUS_CODE_FAILURE;
207 return STATUS_CODE_NOT_FOUND;
212 if (std::string(
"CaloHit") == componentName)
216 else if (std::string(
"Track") == componentName)
220 else if (std::string(
"MCParticle") == componentName)
224 else if (std::string(
"Relationship") == componentName)
230 return STATUS_CODE_FAILURE;
239 return STATUS_CODE_FAILURE;
247 std::string subDetectorName;
249 unsigned int subDetectorTypeInput(0);
252 float innerRCoordinate(0.f);
254 float innerZCoordinate(0.f);
256 float innerPhiCoordinate(0.f);
258 unsigned int innerSymmetryOrder(0);
260 float outerRCoordinate(0.f);
262 float outerZCoordinate(0.f);
264 float outerPhiCoordinate(0.f);
266 unsigned int outerSymmetryOrder(0);
268 bool isMirroredInZ(
false);
270 unsigned int nLayers(0);
273 pParameters->m_subDetectorName = subDetectorName;
274 pParameters->m_subDetectorType = subDetectorType;
275 pParameters->m_innerRCoordinate = innerRCoordinate;
276 pParameters->m_innerZCoordinate = innerZCoordinate;
277 pParameters->m_innerPhiCoordinate = innerPhiCoordinate;
278 pParameters->m_innerSymmetryOrder = innerSymmetryOrder;
279 pParameters->m_outerRCoordinate = outerRCoordinate;
280 pParameters->m_outerZCoordinate = outerZCoordinate;
281 pParameters->m_outerPhiCoordinate = outerPhiCoordinate;
282 pParameters->m_outerSymmetryOrder = outerSymmetryOrder;
283 pParameters->m_isMirroredInZ = isMirroredInZ;
284 pParameters->m_nLayers = nLayers;
288 FloatVector closestDistanceToIp, nRadiationLengths, nInteractionLengths;
293 if ((closestDistanceToIp.size() != nLayers) || (nRadiationLengths.size() != nLayers) || (nInteractionLengths.size() != nLayers))
296 for (
unsigned int iLayer = 0; iLayer < nLayers; ++iLayer)
302 pParameters->m_layerParametersVector.push_back(layerParameters);
315 return STATUS_CODE_SUCCESS;
323 return STATUS_CODE_FAILURE;
331 unsigned int larTPCVolumeId;
345 float wirePitchU(0.f);
347 float wirePitchV(0.f);
349 float wirePitchW(0.f);
351 float wireAngleU(0.f);
353 float wireAngleV(0.f);
355 float wireAngleW(0.f);
359 bool isDriftInPositiveX(
false);
362 pParameters->m_larTPCVolumeId = larTPCVolumeId;
363 pParameters->m_centerX = centerX;
364 pParameters->m_centerY = centerY;
365 pParameters->m_centerZ = centerZ;
366 pParameters->m_widthX = widthX;
367 pParameters->m_widthY = widthY;
368 pParameters->m_widthZ = widthZ;
369 pParameters->m_wirePitchU = wirePitchU;
370 pParameters->m_wirePitchV = wirePitchV;
371 pParameters->m_wirePitchW = wirePitchW;
372 pParameters->m_wireAngleU = wireAngleU;
373 pParameters->m_wireAngleV = wireAngleV;
374 pParameters->m_wireAngleW = wireAngleW;
375 pParameters->m_sigmaUVW = sigmaUVW;
376 pParameters->m_isDriftInPositiveX = isDriftInPositiveX;
387 return STATUS_CODE_SUCCESS;
395 return STATUS_CODE_FAILURE;
403 unsigned int lineGapTypeInput(0);
406 float lineStartX(0.f);
410 float lineStartZ(0.f);
415 pParameters->m_lineGapType = lineGapType;
416 pParameters->m_lineStartX = lineStartX;
417 pParameters->m_lineEndX = lineEndX;
418 pParameters->m_lineStartZ = lineStartZ;
419 pParameters->m_lineEndZ = lineEndZ;
429 return STATUS_CODE_SUCCESS;
437 return STATUS_CODE_FAILURE;
454 pParameters->m_vertex = vertex;
455 pParameters->m_side1 = side1;
456 pParameters->m_side2 = side2;
457 pParameters->m_side3 = side3;
467 return STATUS_CODE_SUCCESS;
475 return STATUS_CODE_FAILURE;
483 float minZCoordinate(0.f);
485 float maxZCoordinate(0.f);
487 float innerRCoordinate(0.f);
489 float innerPhiCoordinate(0.f);
491 unsigned int innerSymmetryOrder(0);
493 float outerRCoordinate(0.f);
495 float outerPhiCoordinate(0.f);
497 unsigned int outerSymmetryOrder(0);
500 pParameters->m_minZCoordinate = minZCoordinate;
501 pParameters->m_maxZCoordinate = maxZCoordinate;
502 pParameters->m_innerRCoordinate = innerRCoordinate;
503 pParameters->m_innerPhiCoordinate = innerPhiCoordinate;
504 pParameters->m_innerSymmetryOrder = innerSymmetryOrder;
505 pParameters->m_outerRCoordinate = outerRCoordinate;
506 pParameters->m_outerPhiCoordinate = outerPhiCoordinate;
507 pParameters->m_outerSymmetryOrder = outerSymmetryOrder;
517 return STATUS_CODE_SUCCESS;
525 return STATUS_CODE_FAILURE;
533 unsigned int cellGeometryInput(0);
542 float cellThickness(0.f);
544 float nCellRadiationLengths(0.f);
546 float nCellInteractionLengths(0.f);
550 float inputEnergy(0.f);
552 float mipEquivalentEnergy(0.f);
554 float electromagneticEnergy(0.f);
556 float hadronicEnergy(0.f);
558 bool isDigital(
false);
560 unsigned int hitTypeInput(0);
563 unsigned int hitRegionInput(0);
566 unsigned int layer(0);
568 bool isInOuterSamplingLayer(
false);
570 const void *pParentAddress(
nullptr);
572 float cellSize0(0.f);
574 float cellSize1(0.f);
577 pParameters->m_positionVector = positionVector;
578 pParameters->m_expectedDirection = expectedDirection;
579 pParameters->m_cellNormalVector = cellNormalVector;
580 pParameters->m_cellGeometry = cellGeometry;
581 pParameters->m_cellSize0 = cellSize0;
582 pParameters->m_cellSize1 = cellSize1;
583 pParameters->m_cellThickness = cellThickness;
584 pParameters->m_nCellRadiationLengths = nCellRadiationLengths;
585 pParameters->m_nCellInteractionLengths = nCellInteractionLengths;
586 pParameters->m_time = time;
587 pParameters->m_inputEnergy = inputEnergy;
588 pParameters->m_mipEquivalentEnergy = mipEquivalentEnergy;
589 pParameters->m_electromagneticEnergy = electromagneticEnergy;
590 pParameters->m_hadronicEnergy = hadronicEnergy;
591 pParameters->m_isDigital = isDigital;
592 pParameters->m_hitType = hitType;
593 pParameters->m_hitRegion = hitRegion;
594 pParameters->m_layer = layer;
595 pParameters->m_isInOuterSamplingLayer = isInOuterSamplingLayer;
596 pParameters->m_pParentAddress = pParentAddress;
606 return STATUS_CODE_SUCCESS;
614 return STATUS_CODE_FAILURE;
634 TrackState trackStateAtStart(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
636 TrackState trackStateAtEnd(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
638 TrackState trackStateAtCalorimeter(0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
640 float timeAtCalorimeter(0.f);
642 bool reachesCalorimeter(
false);
644 bool isProjectedToEndCap(
false);
646 bool canFormPfo(
false);
648 bool canFormClusterlessPfo(
false);
650 const void *pParentAddress(
nullptr);
653 pParameters->m_d0 = d0;
654 pParameters->m_z0 = z0;
655 pParameters->m_particleId = particleId;
656 pParameters->m_charge = charge;
657 pParameters->m_mass = mass;
658 pParameters->m_momentumAtDca = momentumAtDca;
659 pParameters->m_trackStateAtStart = trackStateAtStart;
660 pParameters->m_trackStateAtEnd = trackStateAtEnd;
661 pParameters->m_trackStateAtCalorimeter = trackStateAtCalorimeter;
662 pParameters->m_timeAtCalorimeter = timeAtCalorimeter;
663 pParameters->m_reachesCalorimeter = reachesCalorimeter;
664 pParameters->m_isProjectedToEndCap = isProjectedToEndCap;
665 pParameters->m_canFormPfo = canFormPfo;
666 pParameters->m_canFormClusterlessPfo = canFormClusterlessPfo;
667 pParameters->m_pParentAddress = pParentAddress;
677 return STATUS_CODE_SUCCESS;
685 return STATUS_CODE_FAILURE;
701 int particleId(-std::numeric_limits<int>::max());
703 unsigned int mcParticleTypeInput(0);
706 const void *pParentAddress(
nullptr);
709 pParameters->m_energy = energy;
710 pParameters->m_momentum = momentum;
711 pParameters->m_vertex = vertex;
712 pParameters->m_endpoint = endpoint;
713 pParameters->m_particleId = particleId;
714 pParameters->m_mcParticleType = mcParticleType;
715 pParameters->m_pParentAddress = pParentAddress;
725 return STATUS_CODE_SUCCESS;
733 return STATUS_CODE_FAILURE;
735 unsigned int relationshipIdInput(0);
738 const void *address1(
nullptr);
740 const void *address2(
nullptr);
745 switch (relationshipId)
758 return STATUS_CODE_FAILURE;
761 return STATUS_CODE_SUCCESS;
Header file for the calo hit class.
Header file for the pandora api class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Header file for the track class.
Header file for the xml file reader class.
static pandora::StatusCode SetTrackToMCParticleRelationship(const pandora::Pandora &pandora, const void *const pTrackParentAddress, const void *const pMCParticleParentAddress, const float mcParticleWeight=1)
Set track to mc particle relationship.
static pandora::StatusCode SetMCParentDaughterRelationship(const pandora::Pandora &pandora, const void *const pParentAddress, const void *const pDaughterAddress)
Set parent-daughter mc particle relationship.
static pandora::StatusCode SetCaloHitToMCParticleRelationship(const pandora::Pandora &pandora, const void *const pCaloHitParentAddress, const void *const pMCParticleParentAddress, const float mcParticleWeight=1)
Set calo hit to mc particle relationship.
static pandora::StatusCode SetTrackSiblingRelationship(const pandora::Pandora &pandora, const void *const pFirstSiblingAddress, const void *const pSecondSiblingAddress)
Set sibling track relationship.
static pandora::StatusCode SetTrackParentDaughterRelationship(const pandora::Pandora &pandora, const void *const pParentAddress, const void *const pDaughterAddress)
Set parent-daughter track relationship.
pandora::InputFloat m_closestDistanceToIp
Closest distance of the layer from the interaction point, units mm.
pandora::InputFloat m_nRadiationLengths
Absorber material in front of layer, units radiation lengths.
pandora::InputFloat m_nInteractionLengths
Absorber material in front of layer, units interaction lengths.
static pandora::StatusCode Create(const pandora::Pandora &pandora, const Parameters ¶meters, const pandora::ObjectFactory< Parameters, Object > &factory=pandora::PandoraObjectFactory< Parameters, Object >())
Create a new object from a user factory.
StatusCode GoToNextGeometry()
Skip to next geometry container in the file.
StatusCode GoToNextEvent()
Skip to next event container in the file.
virtual Parameters * NewParameters() const =0
Create new parameters instance on the heap (memory-management to be controlled by user)
virtual StatusCode Read(Parameters ¶meters, FileReader &fileReader) const =0
Read any additional (derived class only) object parameters from file using the specified file reader.
ObjectFactory< object_creation::Geometry::BoxGap::Parameters, object_creation::Geometry::BoxGap::Object > * m_pBoxGapFactory
Address of the box gap factory.
ContainerId m_containerId
The type of container currently being written to file.
const Pandora *const m_pPandora
Address of pandora instance to be used alongside the file writer.
ObjectFactory< object_creation::MCParticle::Parameters, object_creation::MCParticle::Object > * m_pMCParticleFactory
Address of the mc particle factory.
ObjectFactory< object_creation::Geometry::LArTPC::Parameters, object_creation::Geometry::LArTPC::Object > * m_pLArTPCFactory
Address of the lar tpc factory.
ObjectFactory< object_creation::Track::Parameters, object_creation::Track::Object > * m_pTrackFactory
Address of the track factory.
ObjectFactory< object_creation::CaloHit::Parameters, object_creation::CaloHit::Object > * m_pCaloHitFactory
Address of the calo hit factory.
ObjectFactory< object_creation::Geometry::LineGap::Parameters, object_creation::Geometry::LineGap::Object > * m_pLineGapFactory
Address of the line gap factory.
ObjectFactory< object_creation::Geometry::ConcentricGap::Parameters, object_creation::Geometry::ConcentricGap::Object > * m_pConcentricGapFactory
Address of the concentric gap factory.
ObjectFactory< object_creation::Geometry::SubDetector::Parameters, object_creation::Geometry::SubDetector::Object > * m_pSubDetectorFactory
Address of the sub detector factory.
FileType m_fileType
The file type.
StatusCodeException class.
StatusCode GetStatusCode() const
Get status code.
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
TiXmlHandle FirstChildElement() const
Return a handle to the first child element.
TiXmlElement * Element() const
TiXmlHandle FirstChild() const
Return a handle to the first child node.
const std::string & ValueStr() const
const TiXmlElement * NextSiblingElement() const
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
StatusCode ReadCaloHit()
Read a calo hit from the current position in the file, recreating the stored object.
StatusCode ReadNextGeometryComponent()
Read the next pandora geometry component from the current position in the file, recreating the stored...
StatusCode ReadRelationship()
Read a relationship from the current position in the file, recreating the stored relationship.
~XmlFileReader()
Destructor.
StatusCode ReadBoxGap()
Read a box gap from the current position in the file.
StatusCode GoToEvent(const unsigned int eventNumber)
Skip to a specified event number in the file.
StatusCode GoToGeometry(const unsigned int geometryNumber)
Skip to a specified geometry number in the file.
TiXmlNode * m_pContainerXmlNode
The document xml node.
StatusCode ReadLineGap()
Read a line gap from the current position in the file.
StatusCode ReadConcentricGap()
Read a concentric gap from the current position in the file.
XmlFileReader(const pandora::Pandora &pandora, const std::string &fileName)
Constructor.
StatusCode ReadVariable(const std::string &xmlKey, T &t)
Read a variable from the file.
StatusCode ReadNextEventComponent()
Read the next pandora event component from the current position in the file, recreating the stored co...
TiXmlDocument * m_pXmlDocument
The xml document.
StatusCode ReadLArTPC()
Read a lar tpc from the current position in the file.
StatusCode ReadMCParticle()
Read a mc particle from the current position in the file, recreating the stored object.
StatusCode GoToNextContainer()
Skip to next container in the file.
StatusCode ReadSubDetector()
Read a sub detector from the current position in the file.
bool m_isAtFileStart
Whether reader is at file start.
StatusCode ReadHeader()
Read the container header from the current position in the file, checking for properly written contai...
StatusCode ReadTrack()
Read a track from the current position in the file, recreating the stored object.
ContainerId GetNextContainerId()
Get the id of the next container in the file without changing the current position in the file.
TiXmlElement * m_pCurrentXmlElement
The current xml element.
HitType
Calorimeter hit type enum.
HitRegion
Calorimeter hit region enum.
RelationshipId
The relationship identification enum.
@ TRACK_TO_MC_RELATIONSHIP
@ CALO_HIT_TO_MC_RELATIONSHIP
@ TRACK_SIBLING_RELATIONSHIP
@ TRACK_PARENT_DAUGHTER_RELATIONSHIP
@ MC_PARENT_DAUGHTER_RELATIONSHIP
CellGeometry
Cell geometry enum.
ContainerId
The container identification enum.
std::vector< float > FloatVector
MCParticleType
MC particle type enum.
StatusCode
The StatusCode enum.
SubDetectorType
Subdetector type enum.
LineGapType
Line gap type.