4 #include "EVENT/LCIO.h"
10 #include <sio/io_device.h>
11 #include <sio/version.h>
27 if( vers > SIO_VERSION_ENCODE( 1, 2 ) ) {
29 SIO_DATA( device , &(recP->_type) , 1 ) ;
32 SIO_DATA( device , momentum , 3 ) ;
33 recP->setMomentum( momentum ) ;
36 SIO_DATA( device , &energy , 1 ) ;
37 recP->setEnergy( energy ) ;
41 recP->setCovMatrix( errpos ) ;
44 SIO_DATA( device , &mass , 1 ) ;
45 recP->setMass( mass ) ;
47 SIO_DATA( device , &(recP->_charge) , 1 ) ;
49 SIO_DATA( device , recP->_reference , 3 ) ;
52 SIO_DATA( device , &nPid , 1 ) ;
53 for(
int i=0 ; i<nPid ; i++ ) {
56 SIO_DATA( device , &(pid->_likelihood) , 1 ) ;
57 SIO_DATA( device , &(pid->_type) , 1 ) ;
58 SIO_DATA( device , &(pid->_pdg) , 1 ) ;
59 SIO_DATA( device , &(pid->_algorithmType) , 1 ) ;
61 SIO_DATA( device , &nPara , 1 ) ;
63 for(
int j=0;j<nPara;j++) {
64 SIO_DATA( device , &aParameter , 1 ) ;
65 pid->addParameter( aParameter ) ;
67 SIO_PTAG( device , pid ) ;
68 recP->addParticleID( pid) ;
70 SIO_PNTR( device , &(recP->_pidUsed) ) ;
71 SIO_DATA( device , &(recP->_goodnessOfPID) , 1 ) ;
74 SIO_DATA( device, &nRecP , 1 ) ;
75 recP->_particles.resize( nRecP ) ;
76 for(
int i=0 ; i<
nRecP ; i++ ) {
77 SIO_PNTR( device , &(recP->_particles[i] ) ) ;
81 SIO_DATA( device, &nTrk , 1 ) ;
82 recP->_tracks.resize( nTrk ) ;
83 for(
int i=0 ; i<nTrk ; i++ ) {
84 SIO_PNTR( device , &(recP->_tracks[i] ) ) ;
88 SIO_DATA( device, &nClu , 1 ) ;
89 recP->_clusters.resize( nClu ) ;
90 for(
int i=0 ; i<nClu ; i++ ) {
91 SIO_PNTR( device , &(recP->_clusters[i] ) ) ;
93 if( vers > SIO_VERSION_ENCODE( 1,7 ) ) {
95 SIO_PNTR( device , &(recP->_sv) ) ;
100 SIO_DATA( device , &typeFlag , 1 ) ;
101 recP->setType( 0x0000ffff & typeFlag ) ;
102 SIO_DATA( device , recP->_momentum , 3 ) ;
103 SIO_DATA( device , &(recP->_energy) , 1 ) ;
106 recP->setCovMatrix( errpos ) ;
107 SIO_DATA( device , &(recP->_mass) , 1 ) ;
108 SIO_DATA( device , &(recP->_charge) , 1 ) ;
109 SIO_DATA( device , recP->_reference , 3 ) ;
112 SIO_DATA( device , &nPid , 1 ) ;
113 for(
int i=0 ; i<nPid ; i++ ) {
116 SIO_DATA( device , &(pid->_likelihood) , 1 ) ;
117 SIO_DATA( device , &(pid->_type) , 1 ) ;
118 SIO_DATA( device , &(pid->_algorithmType) , 1 ) ;
120 SIO_DATA( device , &nPara , 1 ) ;
122 for(
int j=0;j<nPara;j++){
123 SIO_DATA( device , &aParameter , 1 ) ;
124 pid->addParameter( aParameter ) ;
126 recP->addParticleID( pid) ;
131 SIO_DATA( device, &nRecP , 1 ) ;
132 for(
int i=0 ; i<
nRecP ; i++ ) {
133 recP->_particles.push_back( 0 ) ;
136 for(
int i=0 ; i<
nRecP ; i++ ) {
137 SIO_PNTR( device , &(recP->_particles[i] ) ) ;
138 SIO_DATA( device , &dummyWeights , 1 ) ;
142 SIO_DATA( device, &nTrk , 1 ) ;
143 for(
int i=0 ; i<nTrk ; i++ ) {
144 recP->_tracks.push_back( 0 ) ;
146 for(
int i=0 ; i<nTrk ; i++ ) {
147 SIO_PNTR( device , &(recP->_tracks[i] ) ) ;
148 SIO_DATA( device , &dummyWeights , 1 ) ;
152 SIO_DATA( device, &nClu , 1 ) ;
153 for(
int i=0 ; i<nClu ; i++ ) {
154 recP->_clusters.push_back( 0 ) ;
156 for(
int i=0 ; i<nClu ; i++ ) {
157 SIO_PNTR( device , &(recP->_clusters[i] ) ) ;
158 SIO_DATA( device , &dummyWeights , 1 ) ;
162 SIO_DATA( device, &nMCP , 1 ) ;
163 SIO_DATA( device , &dummyWeights , nMCP ) ;
164 SIO_DATA( device , &dummyWeights , nMCP ) ;
167 SIO_PTAG( device , dynamic_cast<const EVENT::ReconstructedParticle*>(recP) ) ;
174 SIO_SDATA( device, recP->getType() ) ;
175 SIO_SDATA( device, (
float) recP->getMomentum()[0] ) ;
176 SIO_SDATA( device, (
float) recP->getMomentum()[1] ) ;
177 SIO_SDATA( device, (
float) recP->getMomentum()[2] ) ;
178 SIO_SDATA( device, (
float) recP->getEnergy() ) ;
180 for(
unsigned int i=0 ; i<cov.size() ; i++ ) {
181 SIO_SDATA( device, cov[i] ) ;
183 SIO_SDATA( device, (
float) recP->getMass() ) ;
184 SIO_SDATA( device, recP->getCharge() ) ;
185 SIO_DATA( device, recP->getReferencePoint() , 3 ) ;
187 int nPid = recP->getParticleIDs().size() ;
188 SIO_DATA( device , &nPid , 1 ) ;
190 for(
int i=0 ; i<nPid ; i++ ) {
191 auto pid = recP->getParticleIDs()[i] ;
192 SIO_SDATA( device, pid->getLikelihood() ) ;
193 SIO_SDATA( device, pid->getType() ) ;
194 SIO_SDATA( device, pid->getPDG() ) ;
195 SIO_SDATA( device, pid->getAlgorithmType() ) ;
196 int nPara = pid->getParameters().size() ;
197 SIO_DATA( device , &nPara , 1 ) ;
198 for(
int j=0;j<nPara;j++){
199 SIO_SDATA( device, pid->getParameters()[j] ) ;
201 SIO_PTAG( device , pid ) ;
203 auto pidUsed = recP->getParticleIDUsed() ;
204 SIO_PNTR( device , &pidUsed ) ;
205 SIO_SDATA( device, recP->getGoodnessOfPID() ) ;
207 int nReconstructedParticles = recP->getParticles().size() ;
208 SIO_DATA( device, &nReconstructedParticles , 1 ) ;
209 for(
int i=0 ; i<nReconstructedParticles ; i++ ) {
210 SIO_PNTR( device , &(recP->getParticles()[i]) ) ;
213 int nTrk = recP->getTracks().size() ;
214 SIO_DATA( device, &nTrk , 1 ) ;
215 for(
int i=0 ; i<nTrk ; i++ ) {
216 SIO_PNTR( device , &(recP->getTracks()[i]) ) ;
219 int nClu = recP->getClusters().size() ;
220 SIO_DATA( device, &nClu , 1 ) ;
221 for(
int i=0 ; i<nClu ; i++ ) {
222 SIO_PNTR( device , &(recP->getClusters()[i]) ) ;
225 auto sv = recP->getStartVertex() ;
226 SIO_PNTR( device , &sv ) ;
228 SIO_PTAG( device , recP ) ;
The generic object that is held in an LCCollection.
void read(sio::read_device &device, EVENT::LCObject *objP, sio::version_type vers) override
Reads lcio objects from an SIO stream.
EVENT::LCObject * create() const override
Factory method to create an object of the type of the collection.
Adding stuff needed for io (friend declarations, etc.)
Interface for all lcio object SIO-handlers, has to be implemented for all event entities (hits...
void write(sio::write_device &device, const EVENT::LCObject *obj) override
Writes lcio objects to an SIO stream.
virtual const FloatVec & getCovMatrix() const =0
Covariance matrix of the reconstructed particle's 4vector (10 parameters).
Adding stuff needed for io (friend declarations, etc.)
The LCIO reconstructedParticle.
SIOReconstructedParticleHandler()
Constructor.