//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Context-aware storage of PID probabilities from // one momentum slice and one fopi detector // Input is created in analysis macros // // // // Environment: // Software developed for GEM-TPC detector in FOPI. // // Author List: // Felix Boehmer TUM (original author) // // //----------------------------------------------------------- #include "FopiPidProbSet.h" #include #include ClassImp(FopiPidProbSet) FopiPidProbSet::FopiPidProbSet() : fLow(0.), fHigh(0.), fRangeLow(0.), fRangeHigh(0.), fDetType(TString("")) {;} FopiPidProbSet::FopiPidProbSet(const TString& det, double min, double max, double valRangeLow, double valRangeHigh) : fLow(min), fHigh(max), fRangeLow(valRangeLow), fRangeHigh(valRangeHigh), fDetType(det) {;} int FopiPidProbSet::addProb(const FopiPidProb& prob, double fraction, double err) { double pMin, pMax; prob.getMomRange(pMin, pMax); double diffL = std::fabs(pMin-fLow); double diffH = std::fabs(pMax-fHigh); //consistency check if(diffL+diffH > 1.e-5) { std::cerr<<"FopiPidProbSet::addProb() Conflict in momentum range; not adding anything!" < dP(prob.getPartType(),prob); std::pair dF(prob.getPartType(),fraction); std::pair dFErr(prob.getPartType(),err); std::pair::iterator,bool> insP = fProbMap.insert(dP); std::pair::iterator,bool> insF = fFracMap.insert(dF); std::pair::iterator,bool> insFErr = fFracErrMap.insert(dFErr); if(insP.second==false || insF.second==false || insFErr.second==false ) { std::cerr<<"FopiPidProbSet::addProb() Already had an entry for this PDF; not adding anything!" <::const_iterator it = fFracMap.find(part); if(it!=fFracMap.end()) return it->second; else { std::cout<<"FopiPidProbSet::getFraction() Lookup for particle "<::const_iterator it = fFracErrMap.find(part); if(it!=fFracErrMap.end()) return it->second; else return -1.; } const FopiPidProb* FopiPidProbSet::getProb(const TString& part) const { std::map::const_iterator it = fProbMap.find(part); if(it!=fProbMap.end()) return &(it->second); else return NULL; } void FopiPidProbSet::clear() { fProbMap.clear(); fFracMap.clear(); }