#ifndef HPIDCANDIDATE_H
#define HPIDCANDIDATE_H
#include "TObject.h"
#include "piddef.h"
#include "hpidtrackcand.h"
#include "TArrayF.h"
#include "TArrayI.h"
#include "TArrayS.h"
class HCategory;
class HPidCandidate : public TObject
{
public:
HPidCandidate(void);
HPidCandidate(Short_t numpart, Int_t numalgs, Int_t candIndex, Int_t momAlgIndex);
~HPidCandidate(void);
void setFlagBit (HPidTrackCand::EflagBits bit) { flags |= ( 0x01 << bit ); }
void unsetFlagBit (HPidTrackCand::EflagBits bit) { flags &= ~( 0x01 << bit ); }
Bool_t isFlagBit (HPidTrackCand::EflagBits bit) { return (flags >> bit ) & 0x01 ; }
void setFlagBit (Int_t bit);
void unsetFlagBit (Int_t bit);
Bool_t isFlagBit (Int_t bit);
void setFlagBitByValue(HPidTrackCand::EflagBits bit, Bool_t val) { val ? setFlagBit(bit) : unsetFlagBit(bit); }
void setFlagBitByValue(Int_t bit, Bool_t val) { val ? setFlagBit(bit) : unsetFlagBit(bit); }
Bool_t isFlagDoubleHit () { return (flags & 0xF) == 0x0 ? kFALSE : kTRUE; }
Bool_t isFlagAllBestHit() { return ((flags >> 4 ) & 0xF) == 0xF ? kTRUE : kFALSE; }
Bool_t isFlagNoBestHit () { return ((flags >> 4 ) & 0xF) == 0x0 ? kTRUE : kFALSE; }
Int_t getFlagField() { return flags; }
void setFlagField(Int_t field) { flags = field; }
Bool_t isFlagAND(Int_t num, ...);
Bool_t isFlagOR (Int_t num, ...);
Int_t getDoubleHitsLeptons(){ return (flags & 0xF);}
Int_t getDoubleHitsHadrons(){ return ((flags >> 1) & 0x7);}
void printFlags(TString comment="");
Bool_t select(Bool_t (*function)(HPidCandidate* )) { return (*function)(this); }
virtual void Clear(Option_t * = "");
void Reset(void);
virtual void Print(Option_t* option = "") const { print(); }
Int_t print(void) const;
UInt_t getNParticles(void) const { return NUM_PARTICLES;}
UInt_t getNAlgorithms(void) const { return NUM_ALGORITHMS;}
UInt_t getNValues(void) const { return NUM_VALUES;}
void setTrackCandIndex(Short_t nId) { iTrackCandIndex = nId;}
Short_t getTrackCandIndex(void) const { return iTrackCandIndex;}
HPidTrackCand* getTrackCandidate(HCategory *pCat = NULL) const;
void setAlgorithmIdByIndex(UInt_t uiPosIndex, Short_t iAlgId);
void setAlgorithmIds(Short_t aiAlgIds[]);
Int_t getAlgorithmIdByIndex(UInt_t uiPosIndex) const;
Int_t getAlgorithmIndexById(Int_t eAlgId) const;
void setParticleIdByIndex(UInt_t uiPosIndex, Short_t nPartIndex);
void setParticleIds(Short_t anPart[], Int_t nrOfParticles );
Short_t getParticleIdByIndex(UInt_t uiPosIndex) const;
Int_t getParticleIndexById(Short_t nPartId) const;
void setValueById(Int_t eAlgId, Short_t nPartId, Float_t fVal);
void setValueByIndex(UInt_t uiAlgIndex, UInt_t uiPartIndex, Float_t fVal);
Float_t getValueById(Int_t eAlgId, Short_t nPartId) const;
Float_t getValueByIndex(UInt_t uiAlgIndex, UInt_t uiPartIndex) const;
Float_t* getValuesVectorByIndex(UInt_t uiAlgIndex);
Int_t getValuePositionByIndex(UInt_t uiAlgIndex, UInt_t uiPartIndex) const;
Int_t getValuePositionById(UInt_t uiAlgID, UInt_t uiPartID) const;
const TArrayS* getAlgorithmIds(void) {return &aAlgorithms;}
const TArrayS* getParticleIds(void) {return &aParticles;}
const TArrayF* getValues(void) {return &aValues;}
Int_t getMomAlg(void) const { return nMomAlgIndex; }
static HCategory* buildPidCandidateCategory();
Int_t calcBayesVector(Float_t fOut[],
const Int_t aAlgs[]=0, Int_t iAlgs=0);
Int_t calcBayesVectorFromAlgSelection(Float_t fOut[], Int_t iAlg0 = 0,
Int_t iAlg1 = 0, Int_t iAlg2 = 0, Int_t iAlg3 = 0,
Int_t iAlg4 = 0, Int_t iAlg5 = 0, Int_t iAlg6 = 0,
Int_t iAlg7 = 0, Int_t iAlg8 = 0, Int_t iAlg9 = 0);
Float_t getBayesValue(Short_t nType, const Int_t aAlgs[], Int_t iAlgs);
Float_t getBayesValueFromAlgSelection(Short_t nType, Int_t iAlg0 = 0,
Int_t iAlg1 = 0, Int_t iAlg2 = 0, Int_t iAlg3 = 0,
Int_t iAlg4 = 0, Int_t iAlg5 = 0, Int_t iAlg6 = 0,
Int_t iAlg7 = 0, Int_t iAlg8 = 0, Int_t iAlg9 = 0);
Int_t calcMergedPDFVector(Float_t fOut[], const Int_t aAlgs[], Int_t iAlgs) const;
Int_t calcMergedPDFVectorFromAlgSelection(Float_t fOut[], Int_t iAlg0 = 0,
Int_t iAlg1 = 0, Int_t iAlg2 = 0, Int_t iAlg3 = 0,
Int_t iAlg4 = 0, Int_t iAlg5 = 0, Int_t iAlg6 = 0,
Int_t iAlg7 = 0, Int_t iAlg8 = 0, Int_t iAlg9 = 0) const;
Float_t getMergedPDFValue(Short_t nPID, const Int_t aAlgs[], Int_t iAlgs) const;
Float_t getMergedPDFValueFromAlgSelection(Short_t nPID, Int_t iAlg0 = 0,
Int_t iAlg1 = 0, Int_t iAlg2 = 0, Int_t iAlg3 = 0,
Int_t iAlg4 = 0, Int_t iAlg5 = 0, Int_t iAlg6 = 0,
Int_t iAlg7 = 0, Int_t iAlg8 = 0, Int_t iAlg9 = 0) const;
protected:
Short_t iTrackCandIndex;
UInt_t NUM_ALGORITHMS;
UInt_t NUM_PARTICLES;
UInt_t NUM_VALUES;
TArrayS aAlgorithms;
TArrayS aParticles;
TArrayF aValues;
Int_t nMomAlgIndex;
Int_t flags;
ClassDef(HPidCandidate, 2)
};
inline Int_t HPidCandidate::getValuePositionByIndex(UInt_t uiAlgIndex, UInt_t uiPartIndex) const
{
if((uiAlgIndex >= getNAlgorithms()) || (uiPartIndex >= getNParticles()))
{
Error("getValuePositionByIndex", "Out of bounds (%d / %d) (%d / %d)",
uiAlgIndex, getNAlgorithms(), uiPartIndex, getNParticles());
return -1;
}
if(uiAlgIndex* getNParticles() + uiPartIndex >= getNValues())
{
Error("HPidCandidate::getValuePositionByIndex","Mismatch in value array size!");
return -1;
}
return uiAlgIndex * getNParticles() + uiPartIndex;
}
inline Float_t* HPidCandidate::getValuesVectorByIndex(UInt_t uiAlgIndex)
{
if(uiAlgIndex >= getNAlgorithms())
{
Error("getValuesVectorByIndex", "Out of bounds (%d / %d)",
uiAlgIndex, getNAlgorithms());
return NULL;
}
return aValues.GetArray() + uiAlgIndex * getNParticles();
}
inline Int_t HPidCandidate::getValuePositionById(UInt_t uiAlgID, UInt_t uiPartID) const
{
UInt_t algoIndex = getAlgorithmIndexById(uiAlgID);
UInt_t particleIndex = getParticleIndexById(uiPartID);
if(particleIndex<0 || algoIndex<0)
{
Error("getValuePositionById", "No algorithm found for algorithm/particle: %d/%d",uiAlgID, uiPartID);
return -1;
}
return algoIndex * getNParticles() + particleIndex;
}
#endif //HPIDCANDIDATE_H
Last change: Sat May 22 13:06:59 2010
Last generated: 2010-05-22 13:06
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.