Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Result.h File Reference

#include <iosfwd>
#include <map>
#include "Node.h"

Go to the source code of this file.

Namespaces

namespace  Lit

Classes

class  Lit::Result

Functions

void Print (const List &klist, const Event &event, std::ostream &os)


Function Documentation

void Lit::Print const List klist,
const Event event,
std::ostream &  os
 

Definition at line 61 of file Result.cxx.

References count, VertexHelper::GetEvent(), Lit::Event::GetNVar(), Lit::Event::GetVar(), max, and min.

Referenced by MCMonitorCosmicHistograms::AllSumw2(), MCMonitorBeamHistograms::AllSumw2(), Anp::RunAlgSnarl::End(), Anp::RunAlgEvent::End(), Anp::Interface::FillSnarl(), Anp::SelectFlux::Init(), Anp::EventDisplay::Init(), Anp::FillTruth::IsConsistent(), main(), MCMonitorCosmicHistograms::NumHistograms(), MCMonitorBeamHistograms::NumHistograms(), Lit::Result::Print(), Anp::PrintRecordTruth(), Anp::PrintStrips(), Anp::EventDisplay::PrintTab(), PTGuiRollGMinos::RollMaterials(), PTGuiRollG3::RollMaterials(), PTGuiRollGMinos::RollMedia(), PTGuiRollG3::RollMedia(), MCMonitorCosmicHistograms::SetCanRebin(), MCMonitorBeamHistograms::SetCanRebin(), PTSimValidate::TestInitSnarl(), PTSimValidate::TestStack(), MCAppValidate::TestStack(), RecValidate::TestWriteRecord(), and RecValidate::TestWriteRecordOld().

00062 {
00063    os << "----------------------------------------------------------------------"<< std::endl;
00064    os << "Printing Lit::result class" << std::endl;
00065    os << event << endl;
00066 
00067    unsigned int count = 0;
00068 
00069    std::map<short, double> min, max, cmap, wmap;
00070    
00071    os << "Printing " << klist.size() << " nearest neighbors" << std::endl;
00072    for(List::const_iterator it = klist.begin(); it != klist.end(); ++it)
00073    {
00074       os << setw(3) << ++count << ": " 
00075          << setw(5) << setprecision(3) << scientific << it -> second << ": " 
00076          << fixed << it -> first -> GetEvent() << endl;
00077       
00078       const Event &event = it -> first -> GetEvent();
00079       for(unsigned short ivar = 0; ivar < event.GetNVar(); ++ivar)
00080       {  
00081          if(min.find(ivar) == min.end())
00082          {
00083             min[ivar] = event.GetVar(ivar);
00084          }
00085          else if(min[ivar] > event.GetVar(ivar))
00086          {
00087             min[ivar] = event.GetVar(ivar);
00088          }
00089          if(max.find(ivar) == max.end())
00090          {
00091             max[ivar] = event.GetVar(ivar);
00092          }
00093          else if(max[ivar] < event.GetVar(ivar))
00094          {
00095             max[ivar] = event.GetVar(ivar);
00096          }
00097       }
00098 
00099       const short etype = it -> first -> GetType();
00100 
00101       std::map<short, double>::iterator cit = cmap.find(etype);
00102       if(cit == cmap.end())
00103       {
00104          cmap[etype] = 1;
00105       }
00106       else
00107       {
00108          ++(cit -> second);
00109       }
00110 
00111       std::map<short, double>::iterator wit = wmap.find(etype);
00112       if(wit == wmap.end())
00113       {
00114          wmap[etype] = it -> first -> GetWeight();
00115       }
00116       else
00117       {
00118          wit -> second += it -> first -> GetWeight();
00119       }    
00120    }
00121    
00122    for(std::map<short, double>::iterator it = wmap.begin(); it != wmap.end(); ++it)
00123    {
00124       const short etype = it -> first;
00125 
00126       os << "Type " << it -> first << ": (count, weight) = ("
00127          << setw(3) << cmap[etype] << ", " 
00128          << setw(5) << setprecision(2) << wmap[etype] << ")" << endl;
00129    }
00130 
00131    if(min.size() == max.size())
00132    {
00133       for(std::map<short, double>::const_iterator mit = min.begin(); mit != min.end(); ++mit)
00134       {
00135          const short ivar = mit -> first;
00136          os << "variable " << ivar << " (min, max) = (" << min[ivar] << ", " << max[ivar] << ")" << std::endl;
00137       }
00138    }
00139 
00140    os << "----------------------------------------------------------------------"<< std::endl;
00141 }


Generated on Mon Feb 15 11:08:10 2010 for loon by  doxygen 1.3.9.1