00001 #include "Event/TrackStreamer.h"
00002 #include "Event/TrackKeys.h"
00003 #include "Event/StateKeys.h"
00004
00005 std::ostream& str::track(const Track& track, std::ostream& os) {
00006
00007 os << str::trackHeader(track,os) << std::endl;
00008 os << str::trackFields(track,os) << std::endl;
00009 os << str::states(track.states(),os) << std::endl;
00010 os << str::lhcbIDs(track.lhcbIDs(),os);
00011 return os;
00012 }
00013
00014 std::ostream& str::trackHeader(const Track& track, std::ostream& os) {
00015
00016 os << " chi2 \t" << track.chi2() << std::endl;
00017 os << " ndof \t" << track.nDoF() << std::endl;
00018 os << 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 str::state(state,os); os << std::endl;
00032 }
00033 return os;
00034 }
00035
00036
00037 std::ostream& str::state(const State& state, std::ostream& os) {
00038 os << " flags \t" << state.flags() << std::endl;
00039 str::stateFields(state,os); os << std::endl;
00040 os << " z \t" << state.z() << std::endl;
00041 os << " state \t" << 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 str::lhcbID(*it,os); 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 " << (int) id.spareBits();
00057 os << std::endl;
00058 return os;
00059 }
00060
00061
00062 std::ostream& str::trackFields(const Track& track, std::ostream& os) {
00063
00064 os << " type : \t" << track.type() << std::endl;
00065 os << " status: \t" <<track.status() << std::endl;
00066 os << " history: \t" << track.history() << std::endl;
00067 os << " history Fit: \t" << track.historyFit() << std::endl;
00068
00069 os << std::endl;
00070 return os;
00071 }
00072
00073 std::ostream& str::stateFields(const State& state, std::ostream& os) {
00074
00075 if (state.checkType(StateKeys::HasMomentum)) os <<"T:HasMomentum, ";
00076 if (state.checkType(StateKeys::StraightLine)) os <<"T:StraightLine, ";
00077
00078 if (state.checkLocation(StateKeys::LocationUnknown)) os <<"L:Unknown, ";
00079 if (state.checkLocation(StateKeys::ClosestToBeam))
00080 os <<"L:ClosestToBeam, ";
00081 if (state.checkLocation(StateKeys::FirstMeasurement))
00082 os <<"L:FirstMeasurement, ";
00083 if (state.checkLocation(StateKeys::EndVelo)) os <<"L:EndVelo, ";
00084 if (state.checkLocation(StateKeys::AtTT)) os <<"L:AtTT, ";
00085 if (state.checkLocation(StateKeys::AtT)) os <<"L:AtT, ";
00086 if (state.checkLocation(StateKeys::BegRich1)) os <<"L:BegRich1, ";
00087 if (state.checkLocation(StateKeys::EndRich1)) os <<"L:EndRich1, ";
00088 if (state.checkLocation(StateKeys::BegRich2)) os <<"L:BegRich2, ";
00089 if (state.checkLocation(StateKeys::EndRich2)) os <<"L:EndRich2, ";
00090 if (state.checkLocation(StateKeys::Calo)) os <<"L:Calo, ";
00091 if (state.checkLocation(StateKeys::Muon)) os <<"L:Muon, ";
00092
00093 return os;
00094 }
00095