Anp::PlotShort Class Reference

#include <PlotShort.h>

Inheritance diagram for Anp::PlotShort:
Anp::AlgSnarl Anp::Base

List of all members.

Public Member Functions

 PlotShort ()
virtual ~PlotShort ()
bool Run (Record &record)
void Set (TDirectory *dir)
void Config (const Registry &reg)
bool Init (const Header &header)
void End (const DataBlock &)

Private Types

typedef std::map< std::string,
TH1 * > 
MapTH1
typedef std::map< std::string,
TH2 * > 
MapTH2
typedef std::map< std::string,
TTree * > 
MapTree
typedef std::map< int, float > BMap

Private Member Functions

void Plot (const Event &event, const Record &record)
void Plot (const Track &track, const Record &record)
void PlotStandard (const Event &event, const Record &record)
void PlotStandard (const Track &track, const Record &record)
void FillStandard (TDirectory *ptype, const Event &event, const Record &record)
void FillStandard (TDirectory *ptype, const Track &track, const Record &record)
TH1 * GetTH1 (const std::string &key, const std::string &name="")
TH2 * GetTH2 (const std::string &name="", TDirectory *dir=0, const std::string &plottype="unknown")
Particle::Particle_t Particle (const Track &track, const Record &record, int booltype) const

Private Attributes

std::string fDirName
TDirectory * fDir
TFile * fFile
TTree * fTree
std::string fPlotKey
bool fTrack
bool fEvent
bool fPlotTree
std::string fTreeName
bool fPlot
bool fPlotStandard
bool fSVMPrint
int fPassKey
bool fDebug
int fNMiss
bool fIsData
std::vector< int > fKeys
std::vector< int > fEKeys
std::vector< int > fTKeys
std::vector< int > fKNNKeys
std::map< std::string, TH1 * > fMapTH1
std::map< std::string, TH2 * > fMapTH2
std::map< std::string, TH2 * > fMapMu
std::map< std::string, TH2 * > fMapPi
std::map< std::string, TH2 * > fMapPr
std::map< std::string, TH2 * > fMapNC
std::map< std::string, TH2 * > fMapCC
std::map< std::string, TTree * > fMapTree
std::map< int, float > fTreeValues
float energy
int ptype
int ntrack
int nplane
int ntrackplane
float comp
float pur
float tpur
float tcompall
float tcompslc
int ttype
int nevent

Detailed Description

Definition at line 25 of file PlotShort.h.


Member Typedef Documentation

typedef std::map<int,float> Anp::PlotShort::BMap [private]

Definition at line 59 of file PlotShort.h.

typedef std::map<std::string, TH1 *> Anp::PlotShort::MapTH1 [private]

Definition at line 56 of file PlotShort.h.

typedef std::map<std::string, TH2 *> Anp::PlotShort::MapTH2 [private]

Definition at line 57 of file PlotShort.h.

typedef std::map<std::string, TTree *> Anp::PlotShort::MapTree [private]

Definition at line 58 of file PlotShort.h.


Constructor & Destructor Documentation

Anp::PlotShort::PlotShort (  ) 

Definition at line 31 of file PlotShort.cxx.

00032   :fDirName("2D_histos"),
00033    fDir(0),
00034    fPlotKey("knnvars"),
00035    fTrack(true),
00036    fEvent(true),
00037    fPlotTree(false),
00038    fTreeName("treefile.root"),
00039    fPlot(true),
00040    fPlotStandard(true),
00041    fSVMPrint(false),
00042    fPassKey(-1),
00043    fDebug(true),
00044    fNMiss(0)
00045 {
00046 }

Anp::PlotShort::~PlotShort (  )  [virtual]

Definition at line 49 of file PlotShort.cxx.

00050 {
00051 }


Member Function Documentation

void Anp::PlotShort::Config ( const Registry reg  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 144 of file PlotShort.cxx.

References fDebug, fDirName, fEKeys, fKeys, fKNNKeys, fPassKey, fPlotKey, fPlotStandard, fPlotTree, fSVMPrint, fTKeys, fTrack, fTreeName, Registry::Get(), and Anp::Read().

00145 {
00146    //
00147    // Read string configurations
00148    //
00149    Anp::Read(reg, "PlotShortDirName",  fDirName);   
00150    Anp::Read(reg, "PlotShortTreeName", fTreeName);
00151    Anp::Read(reg, "PlotShortPlotKey",  fPlotKey);
00152    Anp::Read(reg, "PlotShortTrack",    fTrack);
00153    Anp::Read(reg, "PlotShortTree",     fPlotTree);
00154    Anp::Read(reg, "PlotShortStandard", fPlotStandard);
00155    Anp::Read(reg, "PlotShortSVM",fSVMPrint);
00156    Anp::Read(reg, "PlotShortDebug",    fDebug);
00157    reg.Get("PlotShortPassKey",fPassKey);
00158    //
00159    // Get and sortkeys to be plotted
00160    //
00161 
00162    fKeys    = Anp::ReadList<int>(reg, "PlotShortList"     , " ");
00163    fEKeys   = Anp::ReadList<int>(reg, "PlotShortListEvent", " ");
00164    fTKeys   = Anp::ReadList<int>(reg, "PlotShortListTrack", " ");
00165    fKNNKeys = Anp::ReadList<int>(reg, "PlotShortListkNN"  , " ");
00166    std::sort(fEKeys.begin(), fEKeys.end());
00167    std::sort(fTKeys.begin(), fTKeys.end());
00168    std::sort(fKNNKeys.begin(), fKNNKeys.end());
00169    cout<<" Plot Short Configuration "<<endl;
00170    cout<<" kNN keys "<<endl;
00171    for(unsigned int ii=0; ii< fKNNKeys.size(); ii++) 
00172      cout<<" KNN  key :  "<<fKNNKeys[ii]<<endl; 
00173    
00174    if(reg.KeyExists("PrintConfig"))
00175    {
00176       cout << "PlotShort::Config" << endl
00177            << "   DirName = " << fDirName << endl
00178            << "   PassKey = " << fPassKey << endl;
00179    }
00180 }

void Anp::PlotShort::End ( const DataBlock  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 187 of file PlotShort.cxx.

00188 {
00189 
00190 }

void Anp::PlotShort::FillStandard ( TDirectory *  ptype,
const Track track,
const Record record 
) [private]

Definition at line 318 of file PlotShort.cxx.

References Anp::Track::DataAt(), Anp::Track::ErrorQP(), Anp::Record::EventEnd(), Anp::Record::FindEvent(), Anp::Record::FindTruth(), fIsData, fKNNKeys, Anp::Track::GetBasic(), Anp::Track::GetBegVtx(), Anp::Event::GetRecoNu(), GetTH2(), Anp::Track::KeyExists(), Anp::Basic::MIP(), Anp::Basic::NUPlane(), Anp::Track::QP(), Anp::Vertex::R(), Anp::Track::TrackIndex(), Anp::Record::TruthEnd(), Anp::Vertex::U(), Anp::Vertex::V(), Anp::RecoNu::Y(), and Anp::Vertex::Z().

00318                                                                                           {
00319 
00320   std::string totname =ptype->GetName(); // Get the name of the store directory (particle type)
00321   //  std:: string totname = name+na;
00322 
00323   double purit =0;
00324   double complete =0;
00325   double true_enu =-1;
00326   if(!fIsData){
00327     const TruthIter truth = record.FindTruth(track);
00328     if(!(truth==record.TruthEnd())){
00329       true_enu = truth->ENeu();
00330       for(TruthRecoIter ireco=truth->RecoBeg(); ireco!=truth->RecoEnd(); ireco++)
00331         {
00332           if(ireco -> IsTrack() &&ireco->RecoIndex() == track.TrackIndex())
00333             {
00334               purit= ireco->Purity();
00335               complete= ireco->ComplAll();
00336             }
00337         }
00338     }
00339   }
00340   double mip = track.GetBasic().MIP();
00341   double ang =-1000;
00342   if(track.KeyExists(108)) ang = track.DataAt(108);
00343   for(unsigned int ii=0; ii< fKNNKeys.size(); ii++){
00344     stringstream knn;
00345     knn<<fKNNKeys[ii];
00346 
00347     double fknnval =-0.1;
00348     if(track.KeyExists(fKNNKeys[ii]) )fknnval= track.DataAt(fKNNKeys[ii]);
00349 
00350     TH2 *energy_v_kNN= PlotShort::GetTH2("mip_knn"+knn.str(), ptype,totname);
00351     if(energy_v_kNN)  energy_v_kNN->Fill(mip, fknnval);
00352     TH2 *qpe_v_kNN = PlotShort::GetTH2("qpe_knn"+knn.str(), ptype,totname);
00353     if(qpe_v_kNN) qpe_v_kNN->Fill(track.QP()/track.ErrorQP(), fknnval);
00354     TH2 *ang_v_kNN = PlotShort::GetTH2("ang_knn"+knn.str(), ptype,totname);
00355     if(ang_v_kNN&&track.KeyExists(108)) ang_v_kNN->Fill(ang,fknnval);
00356     
00357     if(!fIsData){
00358       TH2 *pur_v_kNN = PlotShort::GetTH2("pur_knn"+knn.str(), ptype,totname);
00359       if(pur_v_kNN)    pur_v_kNN->Fill(purit, fknnval);
00360       TH2 *comp_v_kNN = PlotShort::GetTH2("comp_knn"+knn.str(), ptype,totname);
00361       if(comp_v_kNN)      comp_v_kNN->Fill(complete, fknnval);
00362       TH2 *truE_v_kNN = PlotShort::GetTH2("true_knn"+knn.str(), ptype,totname);
00363       if(truE_v_kNN)      truE_v_kNN->Fill(true_enu, fknnval);
00364     }
00365   }
00366 
00367   TH2 *d835_v_d836 = PlotShort::GetTH2("d835_d836", ptype,totname);
00368   if(d835_v_d836 && track.KeyExists(14835) && track.KeyExists(14836) ) d835_v_d836->Fill(track.DataAt(14835), track.DataAt(14836));
00369   TH2 *d835_v_d001 = PlotShort::GetTH2("d835_d001", ptype,totname);
00370   if(d835_v_d001 && track.KeyExists(14835) && track.KeyExists(14001) ) d835_v_d001->Fill(track.DataAt(14835), track.DataAt(14001));
00371   TH2 *d835_v_d805 = PlotShort::GetTH2("d835_d805", ptype,totname);
00372   if(d835_v_d805 && track.KeyExists(14835) && track.KeyExists(14805) ) d835_v_d805->Fill(track.DataAt(14835), track.DataAt(14805));
00373   TH2 *d420_v_d805 = PlotShort::GetTH2("d420_d805", ptype,totname);
00374   if(d420_v_d805 && track.KeyExists(14420) && track.KeyExists(14805) ) d420_v_d805->Fill(track.DataAt(14420), track.DataAt(14805));
00375   TH2 *d420_v_d835 = PlotShort::GetTH2("d420_d835", ptype,totname);
00376   if(d420_v_d835 && track.KeyExists(14835) && track.KeyExists(14420) ) d420_v_d835->Fill(track.DataAt(14420), track.DataAt(14835));
00377   
00378   if(record.FindEvent(track)!=record.EventEnd())
00379   {
00380     Event evt=* ((EventIter)record.FindEvent(track));
00381     const RecoNu& rnu =( const RecoNu&) evt.GetRecoNu();
00382     double y= rnu.Y();
00383     TH2 *y_v_d835 = PlotShort::GetTH2("y_d835", ptype,totname);
00384     if(y_v_d835 && y>=0&& track.KeyExists(14420) ) y_v_d835->Fill(y, track.DataAt(14835));
00385   }
00386   
00387   double r = track.GetBegVtx().R();
00388   double z = track.GetBegVtx().Z();
00389   double u = track.GetBegVtx().U();
00390   double v = track.GetBegVtx().V();
00391   double ntrku = track.GetBasic().NUPlane();
00392 
00393   TH2 *r_v_d835 = PlotShort::GetTH2("r_d835", ptype,totname);
00394   if(r_v_d835 && r>0 && track.KeyExists(14835) ) r_v_d835->Fill(r, track.DataAt(14835));
00395   TH2 *z_v_d835 = PlotShort::GetTH2("z_d835", ptype,totname);
00396   if(z_v_d835 && z>=0 && track.KeyExists(14835) ) z_v_d835->Fill(z, track.DataAt(14835));  
00397   TH2 *u_v_d835 = PlotShort::GetTH2("u_d835", ptype,totname);
00398   if(u_v_d835 && u>=-10000 && track.KeyExists(14835) ) u_v_d835->Fill(u, track.DataAt(14835));
00399   TH2 *v_v_d835 = PlotShort::GetTH2("v_d835", ptype,totname);
00400   if(v_v_d835 && v>=-10000 && track.KeyExists(14835) ) v_v_d835->Fill(v, track.DataAt(14835));
00401   TH2 *trku_v_d835 = PlotShort::GetTH2("trku_d835", ptype,totname);
00402   if(trku_v_d835 && ntrku>0 && track.KeyExists(14835) ) trku_v_d835->Fill(ntrku, track.DataAt(14835));
00403   TH2 *d833_v_d834 = PlotShort::GetTH2("d833_d834", ptype,totname);
00404   if(d833_v_d834 && track.KeyExists(14833) &&track.KeyExists(14834)  ) d833_v_d834->Fill(track.DataAt(14833), track.DataAt(14834));
00405 
00406 }

void Anp::PlotShort::FillStandard ( TDirectory *  ptype,
const Event event,
const Record record 
) [private]

Definition at line 246 of file PlotShort.cxx.

References Anp::Event::DataAt(), energy, Anp::Record::FindTruth(), fIsData, fKNNKeys, GetTH2(), Anp::Event::Gev(), Anp::Event::KeyExists(), Anp::LongestTrack(), Anp::Record::TrackEnd(), and Anp::Record::TruthEnd().

Referenced by PlotStandard().

00246                                                                                           {
00247 
00248   std::string totname =ptype->GetName(); // Get the name of the store directory (particle type)    
00249   double true_enu = -1;
00250   double true_y =-1;
00251   if(!fIsData){
00252     const TruthIter truth = record.FindTruth(event);
00253     if(!(truth==record.TruthEnd())){
00254       true_enu = truth->ENeu();
00255       true_y   = truth->TrueY();
00256     }
00257   }
00258   double reco_y= 0;
00259   TH2 *a1_a2 =PlotShort::GetTH2("a1_a2",ptype,totname);
00260   TH2 *b1_b2 =PlotShort::GetTH2("b1_b2",ptype,totname);
00261   TH2 *c1_c2 =PlotShort::GetTH2("c1_c2",ptype,totname);
00262   TH2 *d1_d2 =PlotShort::GetTH2("d1_d2",ptype,totname);
00263   TH2 *e1_e2 =PlotShort::GetTH2("e1_e2",ptype,totname);
00264   TH2 *f1_f2 =PlotShort::GetTH2("f1_f2",ptype,totname);
00265 
00266   if( a1_a2 && event.KeyExists(19004) && event.KeyExists(19104))  a1_a2->Fill(event.DataAt(19004), event.DataAt(19104));
00267   if( b1_b2 && event.KeyExists(19005) && event.KeyExists(19105))  b1_b2->Fill(event.DataAt(19005), event.DataAt(19105));
00268   if( c1_c2 && event.KeyExists(19008) && event.KeyExists(19108))  c1_c2->Fill(event.DataAt(19008), event.DataAt(19108));
00269   if( d1_d2 && event.KeyExists(19208) && event.KeyExists(19204))  d1_d2->Fill(event.DataAt(19208), event.DataAt(19204));
00270   if( e1_e2 && event.KeyExists(19206) && event.KeyExists(19207))  e1_e2->Fill(event.DataAt(19206), event.DataAt(19207));
00271   if( f1_f2 && event.KeyExists(19203) && event.KeyExists(19201))  f1_f2->Fill(event.DataAt(19203), event.DataAt(19201));
00272 
00273 
00274     TH2 *recoy_truey = PlotShort::GetTH2("recoy_truey", ptype,totname);
00275     if(recoy_truey) recoy_truey->Fill(reco_y,true_y);
00276 
00277     if(!fIsData)
00278     {
00279         TH2 *truE_recoE= PlotShort::GetTH2("truE_recoE", ptype,totname);
00280         if(truE_recoE)      truE_recoE->Fill(true_enu, event.Gev());
00281     }
00282     double energy = event.Gev();
00283     TrackIter trk = Anp::LongestTrack(event,record);
00284 
00285     for(unsigned int ii=0; ii< fKNNKeys.size(); ii++){
00286       double fknnval =-0.1;
00287       if(fKNNKeys[ii]>19000 && event.KeyExists(fKNNKeys[ii])) fknnval = event.DataAt(fKNNKeys[ii]);
00288       else if(!(trk==record.TrackEnd())&&trk->KeyExists(fKNNKeys[ii]) )fknnval= trk->DataAt(fKNNKeys[ii]);
00289       
00290       stringstream knnname;
00291       knnname<<"recoE_knn"<<fKNNKeys[ii];
00292       TH2 *energy_v_kNN= PlotShort::GetTH2(knnname.str(), ptype,totname);
00293       if(energy_v_kNN)  energy_v_kNN->Fill(energy, fknnval);
00294     }
00295     if(fKNNKeys.size()>1 &&!( trk==record.TrackEnd())){
00296       double knn1 = -0.1;
00297       double knn2 = -0.1;
00298       if(fKNNKeys[0]>19000 && event.KeyExists(fKNNKeys[0])) knn1 = event.DataAt(fKNNKeys[0]);
00299       else if(trk->KeyExists(fKNNKeys[0]) )knn1= trk->DataAt(fKNNKeys[0]);
00300       if(fKNNKeys[1]>19000 && event.KeyExists(fKNNKeys[1]))  knn2 = event.DataAt(fKNNKeys[1]);
00301       else if(trk->KeyExists(fKNNKeys[1]) )knn2= trk->DataAt(fKNNKeys[1]);
00302 
00303       double knn1rad =-0.1;
00304       if(trk->KeyExists(4200)) knn1rad= trk->DataAt(4200);
00305       double knn2rad =-0.1;
00306       if(trk->KeyExists(2400)) knn2rad=trk->DataAt(2400);
00307 
00308       TH2 *kNN_v_kNN= PlotShort::GetTH2("knn_knn", ptype,totname);
00309       if(kNN_v_kNN) kNN_v_kNN->Fill(knn1,knn2);
00310       TH2 *kNN4280_v_kNN4200= PlotShort::GetTH2("knn4280_knn4200", ptype,totname);
00311       if(kNN4280_v_kNN4200) kNN4280_v_kNN4200->Fill(knn1,knn1rad);
00312       TH2 *kNN2480_v_kNN2400= PlotShort::GetTH2("knn2480_knn2400", ptype,totname);
00313       if(kNN2480_v_kNN2400) kNN2480_v_kNN2400->Fill(knn2,knn2rad);
00314 
00315     }
00316 }

TH1* Anp::PlotShort::GetTH1 ( const std::string &  key,
const std::string &  name = "" 
) [private]
TH2* Anp::PlotShort::GetTH2 ( const std::string &  name = "",
TDirectory *  dir = 0,
const std::string &  plottype = "unknown" 
) [private]

Referenced by FillStandard(), and Plot().

bool Anp::PlotShort::Init ( const Header header  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 182 of file PlotShort.cxx.

References fIsData, and Anp::Header::IsData().

00182                                            {
00183   fIsData = header.IsData();
00184   return true;
00185 }

Particle::Particle_t Anp::PlotShort::Particle ( const Track track,
const Record record,
int  booltype 
) const [private]

Definition at line 539 of file PlotShort.cxx.

References Anp::Record::FindStdHep(), Anp::Record::GetHeader(), Anp::Header::IsData(), Particle::kMuon, Particle::kMuonNeg, Particle::kMuonPos, Particle::kNotMuon, Particle::kUnknown, Anp::Record::StdHepBeg(), and Anp::Record::StdHepEnd().

Referenced by Plot(), PlotStandard(), and Run().

00540 {
00541   if(record.GetHeader().IsData())
00542     {
00543       return Particle::kUnknown;
00544     }
00545 
00546   if(record.StdHepBeg() != record.StdHepEnd())
00547     {
00548       const StdHepIter stdhep = record.FindStdHep(track);
00549       if(stdhep == record.StdHepEnd())
00550         {
00551           return Particle::kUnknown;
00552         }
00553 
00554       if(stdhep -> Particle() == Particle::kMuonPos ||
00555          stdhep -> Particle() == Particle::kMuonNeg)
00556         {
00557           return Particle::kMuon;
00558         }
00559       else if(booltype==1)
00560         {
00561           // Made to give particle type
00562           return stdhep->Particle();
00563         }
00564       else
00565         {
00566           // If you want a boolean-like answer is/not muon (default)
00567           return Particle::kNotMuon;
00568         }
00569     }
00570 
00571   return Particle::kUnknown;
00572 }

void Anp::PlotShort::Plot ( const Track track,
const Record record 
) [private]

Definition at line 407 of file PlotShort.cxx.

References Anp::Track::DataBeg(), Anp::Track::DataEnd(), fDir, Anp::Record::FindTruth(), fIsData, fKeys, fPlot, Anp::GetDir(), GetTH2(), Particle::kMuon, Particle::kPiMinus, Particle::kPiPlus, Particle::kProton, Particle(), ptype, and Anp::Record::TruthEnd().

00408  {
00409 
00410   const Particle::Particle_t particle = PlotShort::Particle(track, record,1);
00411    if(!ptype || !fPlot)
00412    {
00413       return;
00414    }
00415    
00416    float it1data=-.0099;
00417    float it2data=-.0099;
00418 
00419    for(DataIter it1 = track.DataBeg(); it1 != track.DataEnd(); ++it1)
00420    {     
00421      if(it1->Key()==fKeys[0])    it1data=it1->Data();          
00422      if(it1->Key()==fKeys[1])    it2data=it1->Data();
00423    }
00424 
00425    //
00426    // Fill the 2D histograms
00427    //
00428 
00429    stringstream name;
00430    string plotname;
00431    if(!fIsData){
00432      const TruthIter truth = record.FindTruth(track);
00433      if(truth!=record.TruthEnd()){
00434      if(truth->IsCC())
00435        {
00436          plotname = "twod_cc";  
00437        }
00438      else
00439        {
00440          plotname = "twod_nc";
00441        }
00442      }
00443      else plotname="twod";
00444    }
00445    else{
00446      plotname = "twod";
00447    }
00448      name << fKeys[0] << "_" << fKeys[1];
00449 
00450    TDirectory* dir = Anp::GetDir(plotname,fDir);
00451    TH2 *h = PlotShort::GetTH2(name.str(), dir,"knnvars");
00452    
00453    if(h&&(it1data>0||it2data>0))
00454      {
00455        h -> Fill(it1data, it2data);
00456      }
00457    
00458    stringstream name2;
00459    string  plotname2;
00460 
00461    if(particle == Particle::kMuon){
00462      plotname2 = "twod_mu";
00463    }
00464    else if(particle== Particle::kProton){    
00465      plotname2 = "twod_prot";
00466    }
00467    else if(particle== Particle::kPiPlus || particle== Particle::kPiMinus){
00468      plotname2 = "twod_pion";
00469    }
00470    else{
00471      plotname2 = "twod_oth";
00472    }
00473      name2<<fKeys[0]<<"_"<<fKeys[1];
00474    
00475    
00476    TDirectory* dir2 = Anp::GetDir(plotname2,fDir);
00477    TH2 *h2 = PlotShort::GetTH2(name2.str(), dir2,"knnvars");
00478 
00479    if(h2&&(it1data>0||it2data>0)){
00480      h2 -> Fill(it1data, it2data);
00481    }
00482  
00483 }

void Anp::PlotShort::Plot ( const Event event,
const Record record 
) [private]

Definition at line 192 of file PlotShort.cxx.

00193 {
00194 
00195 }

void Anp::PlotShort::PlotStandard ( const Track track,
const Record record 
) [private]

Definition at line 223 of file PlotShort.cxx.

References fDir, FillStandard(), fIsData, fPlot, Anp::GetDir(), Particle::kMuon, Particle::kPiMinus, Particle::kPiPlus, Particle::kProton, and Particle().

00224 { 
00225 
00226   if(!fDir || !fPlot)
00227     {
00228       return;
00229     }
00230   string dirname;
00231   if(!fIsData){
00232     const Particle::Particle_t particle = PlotShort::Particle(track, record,1);
00233     if(particle == Particle::kMuon)           dirname="mu";    
00234     else if(particle== Particle::kProton)     dirname="prot";
00235     else if(particle== Particle::kPiPlus 
00236             || particle== Particle::kPiMinus) dirname="pion";    
00237     else                                      dirname="other";    
00238   }
00239   else dirname="track_data";
00240 
00241   TDirectory* dir = Anp::GetDir(dirname,fDir);
00242   PlotShort::FillStandard(dir, track, record);
00243   
00244 }             

void Anp::PlotShort::PlotStandard ( const Event event,
const Record record 
) [private]

Definition at line 197 of file PlotShort.cxx.

References fDir, FillStandard(), Anp::Record::FindTruth(), fIsData, fPlot, Anp::GetDir(), Anp::LongestTrack(), ntrack, Anp::Record::TrackEnd(), and Anp::Record::TruthEnd().

Referenced by Run().

00198 {
00199   
00200   if(!fDir || !fPlot)  return;    
00201   string dirname;
00202   if(!fIsData){
00203     const TruthIter truth = record.FindTruth(event); 
00204     if(truth != record.TruthEnd() &&truth->IsCC())        dirname="cc";
00205     else if(truth != record.TruthEnd() && !(truth->IsCC()))  dirname="nc";
00206     else                                                  dirname="unknown";
00207   }
00208   else dirname="event_data";
00209 
00210   TDirectory* dir = Anp::GetDir(dirname,fDir);
00211 
00212   int ntrack = event.GetNTracks();
00213   PlotShort::FillStandard( dir, event,record);
00214   if(!(ntrack==0)  ){
00215     TrackIter itrack = Anp::LongestTrack(event,record);
00216     if(itrack == record.TrackEnd()) return ;
00217     PlotShort::FillStandard( dir, (*itrack), record);    
00218   }
00219 
00220   
00221 }

bool Anp::PlotShort::Run ( Record record  )  [virtual]

Implements Anp::AlgSnarl.

Definition at line 54 of file PlotShort.cxx.

References Anp::Record::EventBegIterator(), Anp::Record::EventEnd(), fEvent, Anp::Record::FindEvent(), Anp::Record::FindTruth(), fPassKey, fPlotStandard, fSVMPrint, fTrack, Particle::kMuon, Particle(), PlotStandard(), Anp::Record::TrackBegIterator(), and Anp::Record::TrackEndIterator().

00055 { 
00056 
00057   if(fTrack){      
00058     for(TrackIterator itrack = record.TrackBegIterator(); itrack != record.TrackEndIterator(); ++itrack)
00059       { 
00060         if(fPassKey>0)
00061           {
00062             if(!itrack->KeyExists(fPassKey)) continue;
00063             else if(itrack->DataAt(fPassKey)<=0) continue;
00064           }
00065           if(fPlotStandard) PlotShort::PlotStandard(*itrack,record);
00066           if(fSVMPrint) 
00067             {
00068               //unused// int count =0;
00069               string cc=0;                                                             
00070               const Particle::Particle_t particle = PlotShort::Particle(*itrack, record,0);      
00071               EventIter ievent = record.FindEvent(*itrack);
00072               TruthIter truth = record.FindTruth(*ievent);
00073               if(particle==Particle::kMuon && truth->IsCC()) cc="+1";                                 
00074               else cc="-1";
00075               cout<<cc;
00076               if(itrack->KeyExists(13001)) cout<<" 1:"<< itrack->DataAt(13001);
00077               else cout<<" 1:0";
00078               if(itrack->KeyExists(14410)) cout<<" 2:"<< itrack->DataAt(14410);
00079               else cout<<" 2:0";
00080               if(itrack->KeyExists(14420)) cout<<" 3:"<< itrack->DataAt(14420);
00081               else cout<<" 3:0";
00082               if(itrack->KeyExists(14430)) cout<<" 4:"<< itrack->DataAt(14430);
00083               else cout<<" 4:0";
00084               if(itrack->KeyExists(14440)) cout<<" 5:"<< itrack->DataAt(14440);
00085               else cout<<" 5:0";
00086               if(itrack->KeyExists(14905)) cout<<" 6:"<< itrack->DataAt(14905);
00087               else cout<<" 6:0";
00088               if(itrack->KeyExists(14923)) cout<<" 7:"<< itrack->DataAt(14923);
00089               else cout<<" 7:0";
00090               if(itrack->KeyExists(14924)) cout<<" 8:"<< itrack->DataAt(14924);
00091               else cout<<" 8:0";
00092               if(itrack->KeyExists(14933)) cout<<" 9:"<< itrack->DataAt(14933);
00093               else cout<<" 9:0";
00094               if(itrack->KeyExists(14934)) cout<<" 10:"<< itrack->DataAt(14934);
00095               else cout<<" 10:0";
00096               if(itrack->KeyExists(4280))  cout<<" #"<< itrack->DataAt(4280);
00097               else cout<<" #0.0";
00098               if(itrack->KeyExists(2480))  cout<<" #"<< itrack->DataAt(2480);
00099               else cout<<" #0.0";
00100               cout<<" # SVM"<<endl;
00101             }
00102           //    else PlotShort::Plot(*itrack, record);
00103 
00104       }
00105   }
00106   if(fEvent){
00107     for(EventIter ievent = record.EventBegIterator(); ievent != record.EventEnd(); ++ievent)
00108       {
00109         if(fPassKey>0 )
00110           {
00111             if(!ievent->KeyExists(fPassKey)) continue;
00112             else if(ievent->DataAt(fPassKey)<=0) continue;
00113           }
00114           
00115         if(fPlotStandard) PlotShort::PlotStandard(*ievent,record);
00116         //        else PlotShort::Plot(*ievent, record);      
00117       }
00118   }
00119 
00120    return true;
00121 }

void Anp::PlotShort::Set ( TDirectory *  dir  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 124 of file PlotShort.cxx.

References fDir, fDirName, fNMiss, fPlot, and Anp::GetDir().

00125 {
00126    if(!dir)
00127    {
00128       return;
00129    }
00130    
00131    fDir = Anp::GetDir(fDirName, dir);
00132 
00133    if(fNMiss == 0)
00134    {
00135       fPlot = true;
00136    }
00137    else
00138    {
00139       cerr << "PlotShort::Set - missed " << fNMiss << " histograms" << endl;
00140    }
00141 }


Member Data Documentation

float Anp::PlotShort::comp [private]

Definition at line 100 of file PlotShort.h.

float Anp::PlotShort::energy [private]

Definition at line 95 of file PlotShort.h.

Referenced by FillStandard().

bool Anp::PlotShort::fDebug [private]

Definition at line 76 of file PlotShort.h.

Referenced by Config().

TDirectory* Anp::PlotShort::fDir [private]

Definition at line 64 of file PlotShort.h.

Referenced by Plot(), PlotStandard(), and Set().

std::string Anp::PlotShort::fDirName [private]

Definition at line 62 of file PlotShort.h.

Referenced by Config(), and Set().

std::vector<int> Anp::PlotShort::fEKeys [private]

Definition at line 82 of file PlotShort.h.

Referenced by Config().

bool Anp::PlotShort::fEvent [private]

Definition at line 69 of file PlotShort.h.

Referenced by Run().

TFile* Anp::PlotShort::fFile [private]

Definition at line 65 of file PlotShort.h.

bool Anp::PlotShort::fIsData [private]

Definition at line 79 of file PlotShort.h.

Referenced by FillStandard(), Init(), Plot(), and PlotStandard().

std::vector<int> Anp::PlotShort::fKeys [private]

Definition at line 81 of file PlotShort.h.

Referenced by Config(), and Plot().

std::vector<int> Anp::PlotShort::fKNNKeys [private]

Definition at line 84 of file PlotShort.h.

Referenced by Config(), and FillStandard().

std::map<std::string, TH2 *> Anp::PlotShort::fMapCC [private]

Definition at line 91 of file PlotShort.h.

std::map<std::string, TH2 *> Anp::PlotShort::fMapMu [private]

Definition at line 87 of file PlotShort.h.

std::map<std::string, TH2 *> Anp::PlotShort::fMapNC [private]

Definition at line 90 of file PlotShort.h.

std::map<std::string, TH2 *> Anp::PlotShort::fMapPi [private]

Definition at line 88 of file PlotShort.h.

std::map<std::string, TH2 *> Anp::PlotShort::fMapPr [private]

Definition at line 89 of file PlotShort.h.

std::map<std::string, TH1 *> Anp::PlotShort::fMapTH1 [private]

Definition at line 85 of file PlotShort.h.

std::map<std::string, TH2 *> Anp::PlotShort::fMapTH2 [private]

Definition at line 86 of file PlotShort.h.

std::map<std::string, TTree *> Anp::PlotShort::fMapTree [private]

Definition at line 93 of file PlotShort.h.

int Anp::PlotShort::fNMiss [private]

Definition at line 77 of file PlotShort.h.

Referenced by Set().

int Anp::PlotShort::fPassKey [private]

Definition at line 75 of file PlotShort.h.

Referenced by Config(), and Run().

bool Anp::PlotShort::fPlot [private]

Definition at line 72 of file PlotShort.h.

Referenced by Plot(), PlotStandard(), and Set().

std::string Anp::PlotShort::fPlotKey [private]

Definition at line 67 of file PlotShort.h.

Referenced by Config().

Definition at line 73 of file PlotShort.h.

Referenced by Config(), and Run().

bool Anp::PlotShort::fPlotTree [private]

Definition at line 70 of file PlotShort.h.

Referenced by Config().

bool Anp::PlotShort::fSVMPrint [private]

Definition at line 74 of file PlotShort.h.

Referenced by Config(), and Run().

std::vector<int> Anp::PlotShort::fTKeys [private]

Definition at line 83 of file PlotShort.h.

Referenced by Config().

bool Anp::PlotShort::fTrack [private]

Definition at line 68 of file PlotShort.h.

Referenced by Config(), and Run().

TTree* Anp::PlotShort::fTree [private]

Definition at line 66 of file PlotShort.h.

std::string Anp::PlotShort::fTreeName [private]

Definition at line 71 of file PlotShort.h.

Referenced by Config().

std::map<int, float> Anp::PlotShort::fTreeValues [private]

Definition at line 94 of file PlotShort.h.

int Anp::PlotShort::nevent [private]

Definition at line 106 of file PlotShort.h.

int Anp::PlotShort::nplane [private]

Definition at line 98 of file PlotShort.h.

int Anp::PlotShort::ntrack [private]

Definition at line 97 of file PlotShort.h.

Referenced by PlotStandard().

Definition at line 99 of file PlotShort.h.

int Anp::PlotShort::ptype [private]

Definition at line 96 of file PlotShort.h.

Referenced by Plot().

float Anp::PlotShort::pur [private]

Definition at line 101 of file PlotShort.h.

float Anp::PlotShort::tcompall [private]

Definition at line 103 of file PlotShort.h.

float Anp::PlotShort::tcompslc [private]

Definition at line 104 of file PlotShort.h.

float Anp::PlotShort::tpur [private]

Definition at line 102 of file PlotShort.h.

int Anp::PlotShort::ttype [private]

Definition at line 105 of file PlotShort.h.


The documentation for this class was generated from the following files:

Generated on 18 Oct 2018 for loon by  doxygen 1.6.1