10 using namespace EVENT;
23 _cpm(
"PIDAlgorithmTypeName",
"PIDAlgorithmTypeID" , col ),
33 _cpm(
"PIDAlgorithmTypeName",
"PIDAlgorithmTypeID" , col ),
63 sstr <<
" PIDHandler::PIDHandler() - duplicate algorithm type IDs: "
64 << aName <<
" [" <<
id <<
"] " ;
92 if( colType == LCIO::RECONSTRUCTEDPARTICLE ) {
96 }
else if( colType == LCIO::CLUSTER ){
102 throw Exception(
"PIDHandler::PIDHandler() "
103 " collection type is neither Cluster nor ReconstructedParticle ") ;
118 int id = pnm->first ;
131 CPM::map_type::iterator it = map.
find( algoName ) ;
133 if( it != map.
end() ){
137 sstr <<
" PIDHandler::addAlgorithm() - duplicate algorithm name: "
160 CPM::map_type::iterator it =
_cpm.
map().
find( algoName ) ;
199 unsigned n = names.
size() ;
201 for(
unsigned i=0 ; i<n ; ++i){
203 if( names[i] == name )
257 unsigned nPid = pidV.
size() ;
259 for(
unsigned i=0; i<nPid; ++i ) {
261 if( pidV[i]->getAlgorithmType() ==
id ) {
271 err <<
"pid object not found in particle for algorithmId: "<< id ;
303 throw Exception(
"PIDHandler::getParticleID LCObject is neither ReconstructedParticleImpl nor ClusterImpl !") ;
310 unsigned nPid = pidV.
size() ;
312 for(
unsigned i=0; i<nPid; ++i ) {
314 if( pidV[i]->getAlgorithmType() ==
id )
346 throw Exception(
"PIDHandler::getParticleID LCObject is neither ReconstructedParticleImpl nor ClusterImpl !") ;
351 unsigned nPid = pidV.
size() ;
353 for(
unsigned i=0; i<nPid; ++i ) {
355 if( pidV[i]->getAlgorithmType() ==
id )
385 unsigned nParam = params.
size() ;
387 if( nParam !=
_pNames[
id ].size() ) {
391 sstr <<
" PIDHandler::setParticleID() - wrong parmeter size specified: "
392 << nParam <<
" - expected " <<
_pNames[ id ].
size() ;
412 throw Exception(
"PIDHandler::setParticleID LCObject is neither ReconstructedParticleImpl nor ClusterImpl !") ;
417 unsigned nPid = pidV.
size() ;
419 for(
unsigned i=0; i<nPid; ++i ) {
421 if( pidV[i]->getAlgorithmType() ==
id ) {
431 bool isNewPID = false ;
455 for(
unsigned k=0; k< nParam ; k++){
457 ps[ k ] = params[ k ] ;
471 static_cast< ClusterImpl*
>(p)->addParticleID( pid ) ;
The generic object that is held in an LCCollection.
Base exception class for LCIO - all other exceptions extend this.
void setAlgorithmType(int algorithmType)
int getParameterIndex(int algorithmID, const std::string &pName)
The index of parameter pName for the algorithm with algorithmID - throws UnknownAlgoritm.
void init(const EVENT::LCCollection *col)
Exception for unknown algorithms.
void setParticleIDUsed(IMPL::ReconstructedParticleImpl *particle, int algorithmID)
Set the particleID algorithm that is used for this particle's kinematic variables.
Implementation of ParticleID.
const EVENT::StringVec & getParameterNames(int algorithmID)
The names of parameters for the algorithm with algorithmID - throws UnknownAlgoritm.
const std::string & getAlgorithmName(int algoID)
Return the name of the algorithm with id - throws UnknownAlgorithm.
const EVENT::IntVec & getAlgorithmIDs()
Return the IDs of all known Algorithms.
virtual LCParameters & parameters()=0
Parameters defined for this collection.
int addAlgorithm(const std::string &algoName, const EVENT::StringVec ¶meterNames)
Add a new algorithm and return the corresponding algorithm id.
virtual void setValues(const std::string &key, const IntVec &values)=0
Set integer values for the given key.
virtual const std::string & getTypeName() const =0
Returns the type name of the collection - valid names are defined in LCIO.
map_type & map()
The std::map< std::string, int >.
The LCIO reconstructedParticle.
Persistent interface for LCIO ParticleIDs.
int getAlgorithmID(const std::string &algoName)
Return the typeID of algorithm algoName - throws UnknownAlgorithm.
virtual StringVec & getStringVals(const std::string &key, StringVec &values) const =0
Adds all string values for the given key to values.
void setParticleID(EVENT::LCObject *p, int userType, int PDG, float likelihood, int algorithmID, const EVENT::FloatVec ¶ms)
Set the particleID information for this particle (or cluster) - throws UnknownAlgorithm.
EVENT::ParticleIDVec getParticleIDs(EVENT::LCObject *p, int id)
Return all PID objects for a given algorithm - ordered with decreasing likelihood - throws UnknownAlg...
EVENT::LCCollection * _col
The generic collection used in LCIO.
void setLikelihood(float logL)
virtual const EVENT::ParticleIDVec & getParticleIDs() const
The particle Id's sorted by their likelihood.
const EVENT::ParticleID & getParticleID(EVENT::LCObject *particle, int algorithmID)
Return the (first) ParticleID object for the given algorithm and particle (or cluster) - throws Unkno...
void setParticleIDUsed(EVENT::ParticleID *pid)
virtual const LCParameters & getParameters() const =0
Parameters defined for this collection.
~PIDHandler()
Update the collection parameter when going out of scope.
virtual EVENT::FloatVec & parameters()
Access to parameters associated with this hypothesis.
Implementation of Cluster.
Implementation of ReconstructedParticle.