2 #include "marlin/Global.h"
3 #include "EVENT/LCCollection.h"
4 #include "IMPL/LCCollectionVec.h"
5 #include "UTIL/LCRelationNavigator.h"
6 #include "IMPL/ReconstructedParticleImpl.h"
12 _description =
"ReconstructedParticleImpl_CopyProcessor: Copies each entry of a LCIO collection of ReconstructedParticleImpl. Select in the optional parameters which members should not be copied." ;
14 registerInputCollection(LCIO::RECONSTRUCTEDPARTICLE,
18 std::string(
"PandoraPFOs"));
20 registerOutputCollection(LCIO::RECONSTRUCTEDPARTICLE,
24 std::string(
"NewPandoraPFOs"));
26 registerOutputCollection(LCIO::LCRELATION,
28 "Old to New Pandora PFOs Link",
30 std::string(
"Old2NewPandoraPFOsLink"));
32 registerProcessorParameter(
"copyType",
37 registerProcessorParameter(
"copyMomentum",
42 registerProcessorParameter(
"copyEnergy",
47 registerProcessorParameter(
"copyCovMatrix",
48 "Copy covariance matrix.",
52 registerProcessorParameter(
"copyMass",
57 registerProcessorParameter(
"copyCharge",
62 registerProcessorParameter(
"copyReferencePoint",
63 "Copy reference point.",
67 registerProcessorParameter(
"copyParticleIDs",
68 "Copy all particle ID entries.",
72 registerProcessorParameter(
"copyParticleIDUsed",
73 "Copy which particle ID is used.",
77 registerProcessorParameter(
"copyGoodnessOfPID",
78 "Copy the goodness of the PID.",
82 registerProcessorParameter(
"copyParticles",
83 "Copy all particles.",
87 registerProcessorParameter(
"copyClusters",
92 registerProcessorParameter(
"copyTracks",
97 registerProcessorParameter(
"copyStartVertex",
114 LCCollection *incol{}, *relcol{};
120 n_incol = incol->getNumberOfElements();
122 catch(DataNotAvailableException &
e)
124 streamlog_out(MESSAGE) <<
"Input collection not found in event " <<
_nEvt << std::endl;
128 LCRelationNavigator relnav( LCIO::RECONSTRUCTEDPARTICLE , LCIO::RECONSTRUCTEDPARTICLE );
130 for (
int i=0; i<n_incol; ++i)
132 ReconstructedParticleImpl* inpart =
dynamic_cast<ReconstructedParticleImpl*
>(incol->getElementAt(i));
133 ReconstructedParticleImpl* outpart =
new ReconstructedParticleImpl;
135 if (
_copyType) outpart->setType(inpart->getType());
136 if (
_copyMomentum) outpart->setMomentum(inpart->getMomentum());
137 if (
_copyEnergy) outpart->setEnergy(inpart->getEnergy());
138 if (
_copyCovMatrix) outpart->setCovMatrix(inpart->getCovMatrix());
139 if (
_copyMass) outpart->setMass(inpart->getMass());
140 if (
_copyCharge) outpart->setCharge(inpart->getCharge());
143 for (
unsigned int j=0; j<inpart->getParticleIDs().size(); ++j)
144 outpart->addParticleID(inpart->getParticleIDs()[j]);
148 for (
unsigned int j=0; j<inpart->getParticles().size(); ++j)
149 outpart->addParticle(inpart->getParticles()[j]);
151 for (
unsigned int j=0; j<inpart->getClusters().size(); ++j)
152 outpart->addCluster(inpart->getClusters()[j]);
154 for (
unsigned int j=0; j<inpart->getTracks().size(); ++j)
155 outpart->addTrack(inpart->getTracks()[j]);
158 outcol->addElement(outpart);
159 relnav.addRelation(inpart,outpart,1);
162 relcol = relnav.createLCCollection();
ReconstructedParticleImpl_CopyProcessor
ReconstructedParticleImpl_CopyProcessor aReconstructedParticleImpl_CopyProcessor
ReconstructedParticleImpl_CopyProcessor()
std::string _OutputColName
std::vector< LCCollection * > LCCollectionVec
std::string _RelationColName
virtual void processEvent(LCEvent *evt)
std::string _InputColName