00001 #include "Event/TrackStreamer.h"
00002
00003 std::ostream& str::track(const Track& track, std::ostream& os) {
00004
00005 os << str::trackHeader(track,os) << std::endl;
00006 os << str::trackFields(track,os) << std::endl;
00007 os << str::states(track.states(),os) << std::endl;
00008 os << str::lhcbIDs(track.lhcbIDs(),os);
00009 return os;
00010 }
00011
00012 std::ostream& str::trackHeader(const Track& track, std::ostream& os) {
00013
00014 os << " chi2 \t" << track.chi2() << std::endl;
00015 os << " ndof \t" << track.nDoF() << std::endl;
00016 os << " physics state \t"
00017 << str::state(track.physicsState(),os)
00018 << std::endl;
00019 os << " flags \t " << track.flags() << std::endl;
00020 os << " nstates \t " << track.states().size() << std::endl;
00021 os << " nIDs \t " << track.lhcbIDs().size();
00022 return os;
00023 }
00024
00025
00026 std::ostream& str::states(const std::vector<State*>& states,
00027 std::ostream& os) {
00028 for (std::vector<State*>::const_iterator it = states.begin();
00029 it != states.end(); it++) {
00030 const State& state = *(*it);
00031 os << str::state(state,os) << std::endl;
00032 }
00033 return os;
00034 }
00035
00036
00037 std::ostream& str::state(const State& state, std::ostream& os) {
00038 os << " flags " << state.flags() << std::endl;
00039 os << str::stateFields(state,os) << std::endl;
00040 os << " z " << state.z() << std::endl;
00041 os << " state " << state.state();
00042
00043 return os;
00044 }
00045
00046 std::ostream& str::lhcbIDs(const std::vector<LHCbID>& ids, std::ostream& os) {
00047 for (std::vector<LHCbID>::const_iterator it = ids.begin();
00048 it != ids.end(); it++)
00049 os << str::lhcbID(*it,os) << std::endl;
00050 return os;
00051 }
00052
00053 std::ostream& str::lhcbID(const LHCbID& id, std::ostream& os) {
00054 os << " ID detector " << id.detectorType()
00055 << " channel " << id.channelID()
00056 << " size " << id.spareBits();
00057 return os;
00058 }
00059
00060
00061 std::ostream& str::trackFields(const Track& track, std::ostream& os) {
00062
00063 if (track.checkType(Track::Velo)) os << "T:Velo, ";
00064 if (track.checkType(Track::VeloR)) os << "T:VeloR, ";
00065 if (track.checkType(Track::Backward)) os << "T:Backward, ";
00066 if (track.checkType(Track::Long)) os << "T:Long, ";
00067 if (track.checkType(Track::Upstream)) os << "T:Upstream, ";
00068 if (track.checkType(Track::Downstream)) os <<"T:Downstream, ";
00069 if (track.checkType(Track::Ttrack)) os << "T:Ttrack, ";
00070
00071 if (track.producedByAlgo(Track::LongTrack)) os << "H:LongTrack, ";
00072 if (track.producedByAlgo(Track::Seeding)) os <<"H:Seeding , ";
00073 if (track.producedByAlgo(Track::TrKshort)) os <<"H::TrKshort, ";
00074 if (track.producedByAlgo(Track::TrMatching)) os <<"H::TrMatching, ";
00075 if (track.producedByAlgo(Track::VeloTrack)) os <<"H:VeloTrack, ";
00076 if (track.producedByAlgo(Track::VeloTT)) os <<"H:VeloTT, ";
00077 if (track.producedByAlgo(Track::TrgForward)) os <<"H:TrgForward, ";
00078 if (track.producedByAlgo(Track::TrgVelo)) os <<"H:TrgVelo, ";
00079 if (track.producedByAlgo(Track::TrgVeloTT)) os <<"H:TrgVeloTT, ";
00080
00081 if (track.checkFlag(Track::Valid)) os <<"F:Valid, ";
00082 if (track.checkFlag(Track::Unique)) os <<"F:Unique, ";
00083 if (track.checkFlag(Track::IPSelected)) os <<"F:IPSelected, ";
00084 if (track.checkFlag(Track::MuSelected)) os <<"F:MuSelected, ";
00085
00086 return os;
00087 }
00088
00089 std::ostream& str::stateFields(const State& state, std::ostream& os) {
00090
00091 if (state.checkType(State::HasMomentum)) os <<"T:HasMomentum, ";
00092 if (state.checkType(State::StraightLine)) os <<"T:StraightLine, ";
00093
00094 if (state.checkLocation(State::Unknown)) os <<"L:Unknown, ";
00095 if (state.checkLocation(State::ClosestToBeam))
00096 os <<"L:ClosestToBeam, ";
00097 if (state.checkLocation(State::FirstMeasurement))
00098 os <<"L:FirstMeasurement, ";
00099 if (state.checkLocation(State::EndVelo)) os <<"L:EndVelo, ";
00100 if (state.checkLocation(State::AtTT)) os <<"L:AtTT, ";
00101 if (state.checkLocation(State::AtT)) os <<"L:AtT, ";
00102 if (state.checkLocation(State::BegRich1)) os <<"L:BegRich1, ";
00103 if (state.checkLocation(State::EndRich1)) os <<"L:EndRich1, ";
00104 if (state.checkLocation(State::BegRich2)) os <<"L:BegRich2, ";
00105 if (state.checkLocation(State::EndRich2)) os <<"L:EndRich2, ";
00106 if (state.checkLocation(State::Calo)) os <<"L:Calo, ";
00107 if (state.checkLocation(State::Muon)) os <<"L:Muon, ";
00108
00109 return os;
00110 }
00111