32 m_fileStream.open(fileName.c_str(), std::ios::out | std::ios::in | std::ios::binary | std::ios::ate);
36 m_fileStream.open(fileName.c_str(), std::ios::out | std::ios::binary);
41 m_fileStream.open(fileName.c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
69 const std::ofstream::pos_type dummyContainerSize(0);
74 return STATUS_CODE_SUCCESS;
82 return STATUS_CODE_FAILURE;
91 return STATUS_CODE_FAILURE;
97 return STATUS_CODE_FAILURE;
101 return STATUS_CODE_SUCCESS;
109 return STATUS_CODE_FAILURE;
126 const unsigned int nLayers(pSubDetector->
GetNLayers());
129 if (subDetectorLayerVector.size() != nLayers)
130 return STATUS_CODE_FAILURE;
134 for (
unsigned int iLayer = 0; iLayer < nLayers; ++iLayer)
141 return STATUS_CODE_SUCCESS;
149 return STATUS_CODE_FAILURE;
170 return STATUS_CODE_SUCCESS;
178 return STATUS_CODE_FAILURE;
180 const LineGap *pLineGap(
nullptr);
181 pLineGap =
dynamic_cast<const LineGap *
>(pDetectorGap);
183 const BoxGap *pBoxGap(
nullptr);
184 pBoxGap =
dynamic_cast<const BoxGap *
>(pDetectorGap);
187 pConcentricGap =
dynamic_cast<const ConcentricGap *
>(pDetectorGap);
189 if (
nullptr != pLineGap)
200 else if (
nullptr != pBoxGap)
210 else if (
nullptr != pConcentricGap)
226 return STATUS_CODE_FAILURE;
229 return STATUS_CODE_SUCCESS;
237 return STATUS_CODE_FAILURE;
264 return STATUS_CODE_SUCCESS;
272 return STATUS_CODE_FAILURE;
293 return STATUS_CODE_SUCCESS;
301 return STATUS_CODE_FAILURE;
314 return STATUS_CODE_SUCCESS;
322 return STATUS_CODE_FAILURE;
330 return STATUS_CODE_SUCCESS;
Header file for the binary file writer class.
Header file for the calo hit class.
Header file for the detector gap class.
Header file for the lar tpc class.
Header file for the mc particle class.
Header file for the pandora content api class.
Header file for the pandora content api implementation class.
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Header file for the sub detector class.
Header file for the track class.
StatusCode WriteSubDetector(const SubDetector *const pSubDetector)
Write a sub detector to the file.
std::ofstream::pos_type m_containerPosition
Position of start of the current event/geometry container object in file.
StatusCode WriteDetectorGap(const DetectorGap *const pDetectorGap)
Write the detector gap parameters to the file.
StatusCode WriteTrack(const Track *const pTrack)
Write a track to the current position in the file.
StatusCode WriteLArTPC(const LArTPC *const pLArTPC)
Write a lar tpc to the file.
BinaryFileWriter(const pandora::Pandora &pandora, const std::string &fileName, const FileMode fileMode=APPEND)
Constructor.
StatusCode WriteHeader(const ContainerId containerId)
Write the container header to the file.
StatusCode WriteCaloHit(const CaloHit *const pCaloHit)
Write a calo hit to the current position in the file.
StatusCode WriteMCParticle(const MCParticle *const pMCParticle)
Write a mc particle to the current position in the file.
std::ofstream m_fileStream
The stream class to write to the file.
StatusCode WriteRelationship(const RelationshipId relationshipId, const void *address1, const void *address2, const float weight)
Write a relationship between two objects with specified addresses.
~BinaryFileWriter()
Destructor.
StatusCode WriteFooter()
Write the container footer to the file.
StatusCode WriteVariable(const T &t)
Write a variable to the file.
BoxGap class, associated with all 3D hit types.
const CartesianVector & GetSide1() const
Get the vector describing first side meeting vertex.
const CartesianVector & GetSide2() const
Get the vector describing second side meeting vertex.
const CartesianVector & GetSide3() const
Get the vector describing third side meeting vertex.
const CartesianVector & GetVertex() const
Get the gap vertex.
float GetElectromagneticEnergy() const
Get the calibrated electromagnetic energy measure.
HitType GetHitType() const
Get the calorimeter hit type.
CellGeometry GetCellGeometry() const
Get the cell geometry.
bool IsInOuterSamplingLayer() const
Whether cell is in one of the outermost detector sampling layers.
HitRegion GetHitRegion() const
Get the region of the detector in which the calo hit is located.
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
unsigned int GetLayer() const
Get the subdetector readout layer number.
float GetMipEquivalentEnergy() const
Get the calibrated mip equivalent energy.
float GetNCellRadiationLengths() const
Get the absorber material in front of cell, units radiation lengths.
float GetNCellInteractionLengths() const
Get the absorber material in front of cell, units interaction lengths.
float GetCellThickness() const
Get the thickness of cell, units mm.
float GetCellSize1() const
Get the cell size 1 [pointing: phi, rectangular: perpendicular to size 0 and thickness,...
bool IsDigital() const
Whether cell should be treated as digital.
float GetCellSize0() const
Get the cell size 0 [pointing: eta, rectangular: up in ENDCAP, along beam in BARREL,...
const CartesianVector & GetCellNormalVector() const
Get the unit vector normal to the sampling layer, pointing outwards from the origin.
float GetHadronicEnergy() const
Get the calibrated hadronic energy measure.
float GetInputEnergy() const
Get the corrected energy of the calorimeter cell, units GeV, as supplied by the user.
float GetTime() const
Get the time of (earliest) energy deposition in this cell, units ns.
const void * GetParentAddress() const
Get the address of the parent calo hit in the user framework.
const CartesianVector & GetExpectedDirection() const
Get the unit vector in direction of expected hit propagation.
ConcentricGap class, associated with all 3D hit types.
float GetInnerRCoordinate() const
Get the inner cylindrical polar r coordinate, origin interaction point.
float GetMaxZCoordinate() const
Get the max cylindrical polar z coordinate, origin interaction point.
float GetOuterPhiCoordinate() const
Get the outer cylindrical polar phi coordinate.
unsigned int GetOuterSymmetryOrder() const
Get the order of symmetry of the outermost edge of gap.
float GetInnerPhiCoordinate() const
Get the inner cylindrical polar phi coordinate.
unsigned int GetInnerSymmetryOrder() const
Get the order of symmetry of the innermost edge of gap.
float GetOuterRCoordinate() const
Get the outer cylindrical polar r coordinate, origin interaction point.
float GetMinZCoordinate() const
Get the min cylindrical polar z coordinate, origin interaction point.
float GetWireAngleV() const
Get the v wire angle to the vertical, units radians.
float GetWirePitchU() const
Get the u wire pitch, units mm.
float GetCenterY() const
Get center in y, units mm.
float GetWidthZ() const
Get the width in z, units mm.
float GetWireAngleW() const
Get the w wire angle to the vertical, units radians.
float GetCenterZ() const
Get center in z, units mm.
bool IsDriftInPositiveX() const
Whether the electron drift is in the positive x direction.
float GetCenterX() const
Get center in x, units mm.
float GetWirePitchV() const
Get the v wire pitch, units mm.
float GetWidthX() const
Get the width in x, units mm.
float GetWidthY() const
Get the width in y, units mm.
float GetWireAngleU() const
Get the u wire angle to the vertical, units radians.
float GetWirePitchW() const
Get the w wire pitch, units mm.
unsigned int GetLArTPCVolumeId() const
Get the lar volume id, uniquely specifying the lar tpc.
float GetSigmaUVW() const
Get the u, v, w resolution, units mm.
LineGap class, associated only with 2D TPC hit types and applied only to the z coordinate when sampli...
float GetLineEndZ() const
Get the line end z coordinate.
LineGapType GetLineGapType() const
Get the line gap type.
float GetLineStartX() const
Get the line start x coordinate.
float GetLineStartZ() const
Get the line start z coordinate.
float GetLineEndX() const
Get the line end x coordinate.
MCParticleType GetMCParticleType() const
Get the type of the mc particle, e.g. vertex, 2D-projection, etc.
Uid GetUid() const
Get the mc particle unique identifier.
float GetEnergy() const
Get energy of mc particle, units GeV.
const CartesianVector & GetMomentum() const
Get momentum of mc particle, units GeV.
const CartesianVector & GetEndpoint() const
Get the endpoint of the mc particle, units mm.
const CartesianVector & GetVertex() const
Get the production vertex of the mc particle, units mm.
int GetParticleId() const
Get the PDG code of the mc particle.
virtual StatusCode Write(const Object *const pObject, FileWriter &fileWriter) const =0
Persist any additional (derived class only) object parameters using the specified file writer.
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.
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.
const std::string & GetSubDetectorName() const
Get the sub detector name, uniquely specifying the sub detector.
float GetOuterPhiCoordinate() const
Get the outer cylindrical polar phi coordinate (angle wrt cartesian x axis)
float GetInnerRCoordinate() const
Get the inner cylindrical polar r coordinate, origin interaction point, units mm.
unsigned int GetOuterSymmetryOrder() const
Get the order of symmetry of the outermost edge of sub detector.
float GetInnerPhiCoordinate() const
Get the inner cylindrical polar phi coordinate (angle wrt cartesian x axis)
SubDetectorType GetSubDetectorType() const
Get the sub detector type, e.g. ECAL_BARREL, HCAL_ENDCAP, TPC, etc.
float GetOuterRCoordinate() const
Get the outer cylindrical polar r coordinate, origin interaction point, units mm.
unsigned int GetInnerSymmetryOrder() const
Get the order of symmetry of the innermost edge of subdetector.
float GetOuterZCoordinate() const
Get the outer cylindrical polar z coordinate, origin interaction point, units mm.
unsigned int GetNLayers() const
Get the number of layers in the sub detector.
std::vector< SubDetectorLayer > SubDetectorLayerVector
bool IsMirroredInZ() const
Whether a second sub detector exists, equivalent to a reflection in z=0 plane.
const SubDetectorLayerVector & GetSubDetectorLayerVector() const
Get the vector of layer parameters for the sub detector.
float GetInnerZCoordinate() const
Get the inner cylindrical polar z coordinate, origin interaction point, units mm.
bool CanFormClusterlessPfo() const
Whether track should form a pfo, even if it has no associated cluster.
float GetZ0() const
Get the z coordinate at the 2D distance of closest approach.
const TrackState & GetTrackStateAtStart() const
Get the track state at the start of the track.
bool ReachesCalorimeter() const
Whether the track reaches the calorimeter.
bool IsProjectedToEndCap() const
Whether the calorimeter projection is to an endcap.
const CartesianVector & GetMomentumAtDca() const
Get the track momentum at the 2D distance of closest approach.
int GetParticleId() const
Get the PDG code of the tracked particle.
const TrackState & GetTrackStateAtEnd() const
Get the track state at the end of the track.
float GetTimeAtCalorimeter() const
Get the (sometimes projected) time at the calorimeter.
bool CanFormPfo() const
Whether track should form a pfo, if it has an associated cluster.
int GetCharge() const
Get the charge of the tracked particle.
float GetD0() const
Get the 2D impact parameter wrt (0,0)
const TrackState & GetTrackStateAtCalorimeter() const
Get the (sometimes projected) track state at the calorimeter.
float GetMass() const
Get the mass of the tracked particle, units GeV.
const void * GetParentAddress() const
Get the address of the parent track in the user framework.
@ CONCENTRIC_GAP_COMPONENT
FileMode
The file mode enum.
RelationshipId
The relationship identification enum.
CellGeometry
Cell geometry enum.
ContainerId
The container identification enum.
StatusCode
The StatusCode enum.
const std::string PANDORA_FILE_HASH("pandora")
Look for hash each event to check integrity.