001 #include "JetTagTools/GradedTrack.h"
002 #include "JetTagInfo/TrackGrade.h"
003 #include "GaudiKernel/MsgStream.h"
004 #include <iostream>
005 #include <sys/types.h>
006
007 #include "JetTagTools/ITrackGradeFactory.h"
008 #include "JetTagInfo/TrackGradesDefinition.h"
009
010 namespace Analysis {
011
012 GradedTrack::GradedTrack(const Rec::TrackParticle* trk, TrackGrade grd) {
013 this->track = trk;
014 this->grade = grd;
015 }
016
017 TrackGradePartition::TrackGradePartition() {
018 }
019
020 TrackGradePartition::TrackGradePartition(const std::string& definition,
021 const ITrackGradeFactory& trackGradeFactory) {
022
023 const TrackGradesDefinition & myTrackGradesDefinition = trackGradeFactory.getTrackGradesDefinition();
024
025
026 const std::string delim("+");
027 std::string::size_type sPos, sEnd, sLen;
028 sPos = definition.find_first_not_of(delim);
029 while ( sPos != std::string::npos ) {
030 sEnd = definition.find_first_of(delim, sPos);
031 if(sEnd==std::string::npos) sEnd = definition.length();
032 sLen = sEnd - sPos;
033 std::string grade = definition.substr(sPos,sLen);
034
035 const TrackGrade* tgrade(myTrackGradesDefinition.getGrade(grade));
036 if (tgrade==0)
037 {
038 throw std::string("#BTAG# Error: the following grade ") + grade + std::string(" could not be found in the list from TrackGradeFactory ");
039 }
040 m_grades.push_back(TrackGrade(*tgrade));
041 sPos = definition.find_first_not_of(delim, sEnd);
042 }
043 }
044
045 TrackGradePartition::~TrackGradePartition() {
046 }
047
048 void TrackGradePartition::add(const TrackGrade& grade) {
049 m_grades.push_back(grade);
050 }
051
052 const std::vector<TrackGrade>& TrackGradePartition::grades() const {
053 return m_grades;
054 }
055
056 const std::string TrackGradePartition::suffix() const {
057 std::string suf("");
058 for(uint i=0;i<m_grades.size();i++) {
059 if(0==i) {
060 suf += (std::string)m_grades[i];
061 } else {
062 suf += ("_" + (std::string)m_grades[i]);
063 }
064 }
065 return suf;
066 }
067
068 int TrackGradePartition::size() const {
069 return m_grades.size();
070 }
071
072 MsgStream& operator<<( MsgStream& out, const TrackGradePartition& part) {
073 out << "#BTAG# GradePartition: [ ";
074 for(int i=0;i<part.size();i++) out<<" "<<(std::string)part.grades()[i];
075 out << " ]";
076 return out;
077 }
078 std::ostream& operator<<( std::ostream& out, const TrackGradePartition& part) {
079 out << "#BTAG# GradePartition: [ ";
080 for(int i=0;i<part.size();i++) out<<" "<<(std::string)part.grades()[i];
081 out << " ]";
082 return out;
083 }
084 }
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|