PlotMan Class Reference

#include <PlotMan.h>

List of all members.

Public Member Functions

 PlotMan (bool interactive=false)
 ~PlotMan ()
void AddCamAna (CamAna *camana, bool dohist=true, bool docanv=true)
CamAnaGetCamAna (std::string caname)
CamAnaGetCamAna (unsigned int canum)
void AllFiltersOn (bool filt)
void FilterOn (bool filt, std::string caname)
void FilterOn (bool filt, unsigned int canum)
void FOn (unsigned int canum, bool on=true)
void FOn (std::string caname, bool on=true)
void FOff (unsigned int canum)
void AllFiltersRev (bool filt)
void FilterRev (bool filt, std::string caname)
void FilterRev (bool filt, unsigned int canum)
void AddFile (std::string fname)
void AddFileChecked (std::string fname)
void AddList (std::string lname)
void AddDirectory (std::string dname)
void FileSuffix (std::string fsuf)
std::string FileSuffix ()
void BuildChain (bool checked=false)
void ChainReport ()
void ReadNEntries (bool b)
bool ReadNEntries ()
void SetBranchStatus (const char *branch, int status)
void UpdateCanvases (TFolder *tfol=0)
void WriteOut (std::string fn="PlotMan.root")
void CloseWindow ()
void SpinChain (int nevents=0)
void StopSpinning ()
void DoFinish (bool dofinish=true)
void FinishSpin ()
void SetEntries (int entries)
void SetUpdateInterval (int interval)
void SetUpdateFraction (int frac)
void SetUpdateSleep (int sleep)
void ManUpdateSleep ()
void Next ()
void Prev ()
void ReDraw ()
void StepEvent (int nevents=1)
void StepPassEvent (int nevents=1)
void JumpToEvent (int event)
void JumpToRun (int run)
void ManRunJump ()
void JumpToSnarl (int snarl)
void ManSnarlJump ()
void Reset ()
void SetLoud (int loud=0, std::string lstream="PlotMan")
int GetLoud (std::string lstream="PlotMan")

Private Member Functions

void ControlWindow (const TGWindow *p=0, UInt_t w=100, UInt_t h=100)
bool FillCamEvent (const AtmosEvent *event)

Private Attributes

std::vector< std::string > fRootFiles
std::string fRootFilesSuf
bool fChainBuilt
bool fChainCurrent
std::vector< CamAna * > fCamAnas
std::vector< int > fEventsRun
std::vector< int > fEventsPassed
std::vector< bool > fFilterOn
std::vector< bool > fFilterRev
int fEvent
int fEntries
bool fReadNEntries
bool fStopSpinning
bool fSpinning
int fUpdateInterval
int fUpdateFraction
int fUpdateSleep
bool fDoFinish
TGMainFrame * cgMain
TGHProgressBar * fProgress
TGNumberEntry * cgRun
TGNumberEntry * cgSubRun
TGNumberEntry * cgSnarl
TGNumberEntry * cgSleep

Detailed Description

Definition at line 26 of file PlotMan.h.


Constructor & Destructor Documentation

PlotMan::PlotMan ( bool  interactive = false  ) 

Definition at line 33 of file PlotMan.cxx.

References cgMain, cgSleep, ControlWindow(), fChain, fChainBuilt, fChainCurrent, fDoFinish, fEntries, fEvent, fProgress, fReadNEntries, fRootFilesSuf, fSpinning, fStopSpinning, fUpdateFraction, fUpdateInterval, and fUpdateSleep.

00034 {
00035   fSpinning = false;
00036   fStopSpinning = false;
00037   fDoFinish = true;
00038   fChain = new TChain("ntp");
00039   fRootFilesSuf = ".root";
00040   fChainBuilt = false;
00041   fChainCurrent = false;
00042 
00043   fEvent = -1;
00044   fEntries = 0;
00045   fReadNEntries = false;
00046   fUpdateInterval = 0;
00047   fUpdateFraction = 0;
00048   fUpdateSleep = 0;
00049 
00050   fProgress = 0;
00051   cgSleep = 0;
00052   cgMain = 0;
00053 
00054   if(interactive && gApplication) this->ControlWindow(0,1,1);
00055 }

PlotMan::~PlotMan (  ) 

Definition at line 57 of file PlotMan.cxx.

00058 {
00059 }


Member Function Documentation

void PlotMan::AddCamAna ( CamAna camana,
bool  dohist = true,
bool  docanv = true 
)

Definition at line 61 of file PlotMan.cxx.

References cgMain, fCamAnas, fEventsPassed, fEventsRun, fFilterOn, fFilterRev, Form(), Msg::kSynopsis, CamAna::MakeCanvases(), CamAna::MakeHistos(), and MSG.

00062 {
00063   MSG("PlotMan", Msg::kSynopsis) << "Adding CamAna: " << camana->GetName()
00064                                  << endl;
00065   fCamAnas.push_back(camana);
00066   if(dohist) camana->MakeHistos();
00067   if(docanv) camana->MakeCanvases();
00068 
00069   fEventsRun.push_back(0);
00070   fEventsPassed.push_back(0);
00071   fFilterOn.push_back(false);
00072   fFilterRev.push_back(false);
00073 
00074   if (cgMain) {
00075     MSG("PlotMan",Msg::kSynopsis) << " CamAna filters" << endl;
00076     TGCompositeFrame *cgH1 = new TGHorizontalFrame(cgMain);
00077 
00078     int lastana = fCamAnas.size() - 1;
00079     TGLabel *cgLabel = new TGLabel(cgH1,
00080         Form("%d)%s",lastana,camana->GetName()));
00081     cgH1->AddFrame(cgLabel, new TGLayoutHints(kLHintsLeft));
00082 
00083     TGCheckButton *cgCheck = new TGCheckButton(cgH1, "Filt", 2);
00084     cgCheck->Connect("Pressed()", "PlotMan", this,
00085       Form("FilterOn(=true, %d)",lastana));
00086     cgCheck->Connect("Released()", "PlotMan", this,
00087       Form("FilterOn(=false, %d)",lastana));
00088     cgH1->AddFrame(cgCheck, new TGLayoutHints(kLHintsRight));
00089 
00090     MSG("PlotMan",Msg::kSynopsis) << " CamAna filters" << endl;
00091     cgCheck = new TGCheckButton(cgH1, "Rev", 2);
00092     cgCheck->Connect("Pressed()", "PlotMan", this,
00093       Form("FilterRev(=true, %d)",lastana));
00094     cgCheck->Connect("Released()", "PlotMan", this,
00095       Form("FilterRev(=false, %d)",lastana));
00096     cgH1->AddFrame(cgCheck, new TGLayoutHints(kLHintsRight));
00097 
00098     cgMain->AddFrame(cgH1, new TGLayoutHints(kLHintsExpandX));
00099 
00100     cgMain->Resize();
00101     cgMain->MapSubwindows();
00102     cgMain->Layout();
00103     cgMain->MapWindow();
00104   }
00105 }

void PlotMan::AddDirectory ( std::string  dname  ) 
void PlotMan::AddFile ( std::string  fname  ) 
void PlotMan::AddFileChecked ( std::string  fname  ) 

Definition at line 178 of file PlotMan.cxx.

References fChain, fEntries, fProgress, Msg::kError, Msg::kSynopsis, MSG, and nentries.

Referenced by BuildChain().

00178                                             {
00179   int nentries = 0;
00180   TFile *tf = TFile::Open(fname.c_str());
00181   if (!tf) {
00182     MSG("PlotMan",Msg::kError) << "zero TFile" << endl;
00183     return;
00184   }
00185   if (tf->IsZombie()) {
00186     MSG("PlotMan",Msg::kError) << "zombie TFile" << endl;
00187     return;
00188   }
00189   TObject *obj = tf->Get("ntp");
00190   if (!obj) {
00191     MSG("PlotMan",Msg::kError) << "zero TObject ntp" << endl;
00192     return;
00193   }
00194 
00195   //TChain in file
00196   if (obj->InheritsFrom("TChain")) {
00197     nentries = (dynamic_cast<TChain*>(obj))->GetEntries();
00198     fChain->Add(dynamic_cast<TChain*>(obj));
00199   }
00200   //TTree in file
00201   else if (obj->InheritsFrom("TTree")) {
00202     nentries = (dynamic_cast<TTree*>(obj))->GetEntries();
00203     //Include the 0 to read header from file and get nentries
00204     fChain->Add(fname.c_str(),0);
00205   }
00206   else {
00207     MSG("PlotMan",Msg::kError) << "TObject not a TChain or TTree" << endl;
00208     return;
00209   }
00210   MSG("PlotMan",Msg::kSynopsis) << "Added file " << fname << " with "
00211          << nentries << " entries" << endl;
00212   tf->Close();
00213   fEntries += nentries;
00214   if(fProgress) fProgress->SetRange(0,fEntries);
00215 }

void PlotMan::AddList ( std::string  lname  ) 
void PlotMan::AllFiltersOn ( bool  filt  ) 

Definition at line 119 of file PlotMan.cxx.

References fFilterOn.

00119                                     {
00120   for(unsigned int i=0;i<fFilterOn.size();i++) fFilterOn[i] = filt;
00121 }

void PlotMan::AllFiltersRev ( bool  filt  ) 

Definition at line 143 of file PlotMan.cxx.

References fFilterRev.

00143                                      {
00144   for(unsigned int i=0;i<fFilterRev.size();i++) fFilterRev[i] = filt;
00145 }

void PlotMan::BuildChain ( bool  checked = false  ) 

Definition at line 235 of file PlotMan.cxx.

References AddFileChecked(), fChain, fChainBuilt, fEntries, fReadNEntries, fRootFiles, Msg::kSynopsis, Msg::kVerbose, Msg::kWarning, MSG, and SetEntries().

Referenced by JumpToEvent(), JumpToRun(), JumpToSnarl(), SpinChain(), StepEvent(), and StepPassEvent().

00235                                      {
00236   MSG("PlotMan",Msg::kSynopsis) << "Building chain for " << fRootFiles.size()
00237          << " files";
00238   if(checked) MSG("PlotMan",Msg::kSynopsis) << " with checking";
00239   MSG("PlotMan",Msg::kSynopsis) << endl;
00240 
00241   sort(fRootFiles.begin(),fRootFiles.end());
00242   VS::iterator nend = unique(fRootFiles.begin(),fRootFiles.end());
00243   if (nend != fRootFiles.end()) {
00244     MSG("PlotMan",Msg::kWarning) << "Redundant items in the list of root files:"
00245                                  << endl;
00246 
00247     //This doesn't exactly work, whatever
00248     for(VS::iterator i=nend;i!=fRootFiles.end();i++)
00249       MSG("PlotMan",Msg::kWarning)<< "  " << i->c_str() << endl;
00250   }
00251   for (VS::iterator i=fRootFiles.begin();i!=nend;i++) {
00252     if(checked) AddFileChecked(*i);
00253     else fChain->Add(i->c_str());
00254     MSG("PlotMan",Msg::kVerbose) << "Added file " << *i << endl;
00255   }
00256   if(fReadNEntries) SetEntries(fChain->GetEntries());
00257   fChainBuilt = true;
00258   MSG("PlotMan",Msg::kSynopsis) << "Built chain with " << fEntries << " entries"
00259                                 << endl;
00260 }

void PlotMan::ChainReport (  ) 

Definition at line 263 of file PlotMan.cxx.

References fChain, Msg::kSynopsis, and MSG.

00263                           {
00264   MSG("PlotMan",Msg::kSynopsis) << "Chain has NTrees =  " << fChain->GetNtrees() 
00265                                 << endl;
00266 }

void PlotMan::CloseWindow (  ) 

Definition at line 835 of file PlotMan.cxx.

References fSpinning, Msg::kInfo, and MSG.

00835                           {
00836   if (fSpinning)  {
00837     MSG("PlotMan",Msg::kInfo) << "Can't close window while spinning Chain" << endl;
00838     return;
00839   }
00840   if(gApplication) gApplication->Terminate();
00841 }

void PlotMan::ControlWindow ( const TGWindow *  p = 0,
UInt_t  w = 100,
UInt_t  h = 100 
) [private]

Definition at line 733 of file PlotMan.cxx.

References cgMain, cgRun, cgSleep, cgSnarl, cgSubRun, and fProgress.

Referenced by PlotMan().

00734 {
00735   TGLayoutHints *cgLayout =
00736     new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
00737 
00738   TGCompositeFrame *cgH1 = 0;
00739   TGLabel *cgLabel = 0;
00740 
00741   cgMain = new TGMainFrame(p, w, h);
00742   cgMain->SetCleanup(kDeepCleanup);
00743   cgMain->Connect("CloseWindow()","PlotMan",this,"CloseWindow()");
00744 
00745   TGTextButton *cgStart = new TGTextButton(cgMain, "Start", 1);
00746   cgStart->Connect("Clicked()","PlotMan",this,"SpinChain()");
00747   cgMain->AddFrame(cgStart, cgLayout);
00748 
00749   TGTextButton *cgStop = new TGTextButton(cgMain, "&Stop", 2);
00750   cgStop->Connect("Clicked()","PlotMan",this,"StopSpinning()");
00751   cgMain->AddFrame(cgStop, cgLayout);
00752 
00753   cgH1 = new TGHorizontalFrame(cgMain);
00754 
00755   cgLabel = new TGLabel(cgH1,"Sleep(ms):");
00756   cgH1->AddFrame(cgLabel, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
00757 
00758   cgSleep = new TGNumberEntry(cgH1, 0, 5, -1);
00759   cgSleep->Connect("ValueSet(Long_t)", "PlotMan", this, "ManUpdateSleep()");
00760   cgH1->AddFrame(cgSleep, cgLayout);
00761 
00762   cgMain->AddFrame(cgH1, cgLayout);
00763 
00764   TGTextButton *cgNextPass = new TGTextButton(cgMain, "&NextPass", 3);
00765   cgNextPass->Connect("Clicked()","PlotMan",this,"StepPassEvent(=1)");
00766   cgMain->AddFrame(cgNextPass, cgLayout);
00767 
00768   TGTextButton *cgPrevPass = new TGTextButton(cgMain, "&PrevPass", 3);
00769   cgPrevPass->Connect("Clicked()","PlotMan",this,"StepPassEvent(=-1)");
00770   cgMain->AddFrame(cgPrevPass, cgLayout);
00771 
00772   TGTextButton *cgNext = new TGTextButton(cgMain, "&Next", 3);
00773   cgNext->Connect("Clicked()","PlotMan",this,"Next()");
00774   cgMain->AddFrame(cgNext, cgLayout);
00775 
00776   TGTextButton *cgPrev = new TGTextButton(cgMain, "&Prev", 4);
00777   cgPrev->Connect("Clicked()","PlotMan",this,"Prev()");
00778   cgMain->AddFrame(cgPrev, cgLayout);
00779 
00780   //Run Number Entry
00781   cgH1 = new TGHorizontalFrame(cgMain);
00782   cgLabel = new TGLabel(cgH1, "Run:");
00783   cgH1->AddFrame(cgLabel, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
00784   cgRun = new TGNumberEntry(cgH1, 0, 5, -1);
00785   cgRun->Connect("ValueSet(Long_t)", "PlotMan", this, "ManRunJump()");
00786   cgH1->AddFrame(cgRun, cgLayout);
00787   cgMain->AddFrame(cgH1, cgLayout);
00788 
00789   //SubRun Number Entry
00790   cgH1 = new TGHorizontalFrame(cgMain);
00791   cgLabel = new TGLabel(cgH1, "SubRun:");
00792   cgH1->AddFrame(cgLabel, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
00793   cgSubRun = new TGNumberEntry(cgH1, 0, 5, -1);
00794   cgSubRun->Connect("ValueSet(Long_t)", "PlotMan", this, "ManRunJump()");
00795   cgH1->AddFrame(cgSubRun, cgLayout);
00796   cgMain->AddFrame(cgH1, cgLayout);
00797 
00798   //Snarl Number Entry
00799   cgH1 = new TGHorizontalFrame(cgMain);
00800   cgLabel = new TGLabel(cgH1, "Snarl:");
00801   cgH1->AddFrame(cgLabel, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
00802   cgSnarl = new TGNumberEntry(cgH1, 0, 5, -1);
00803   cgSnarl->Connect("ValueSet(Long_t)", "PlotMan", this, "ManSnarlJump()");
00804   cgH1->AddFrame(cgSnarl, cgLayout);
00805   cgMain->AddFrame(cgH1, cgLayout);
00806 
00807   TGTextButton *tgReDraw = new TGTextButton(cgMain, "&ReDraw", 4);
00808   tgReDraw->Connect("Clicked()","PlotMan",this,"ReDraw()");
00809   cgMain->AddFrame(tgReDraw, cgLayout);
00810 
00811   TGTextButton *cgReset = new TGTextButton(cgMain, "&Reset", 5);
00812   cgReset->Connect("Clicked()","PlotMan",this,"Reset()");
00813   cgMain->AddFrame(cgReset, cgLayout);
00814 
00815   TGTextButton *cgQuit = new TGTextButton(cgMain, "&Quit", 6);
00816   cgQuit->Connect("Clicked()","PlotMan",this,"CloseWindow()" );
00817   cgMain->AddFrame(cgQuit, cgLayout);
00818 
00819   fProgress = new TGHProgressBar(cgMain,100);
00820   fProgress->SetBarColor("lightgreen");
00821   fProgress->ShowPosition();
00822   cgMain->AddFrame(fProgress, cgLayout);
00823 
00824   cgMain->MapSubwindows();
00825   cgMain->Resize();
00826 
00827   cgMain->Layout();
00828 
00829   cgMain->SetWindowName("Ntp Control Window");
00830   cgMain->SetIconName("Ntp Control Window");
00831 
00832   cgMain->MapWindow();
00833 }

void PlotMan::DoFinish ( bool  dofinish = true  )  [inline]

Definition at line 67 of file PlotMan.h.

References fDoFinish.

00067 {fDoFinish=dofinish;}

std::string PlotMan::FileSuffix (  )  [inline]

Definition at line 55 of file PlotMan.h.

References fRootFilesSuf.

00055 {return fRootFilesSuf;}

void PlotMan::FileSuffix ( std::string  fsuf  )  [inline]

Definition at line 54 of file PlotMan.h.

References fRootFilesSuf.

00054 {fRootFilesSuf = fsuf;}

bool PlotMan::FillCamEvent ( const AtmosEvent event  )  [private]

Definition at line 594 of file PlotMan.cxx.

References fCamAnas, fEventsPassed, fEventsRun, fFilterOn, fFilterRev, Msg::kWarning, and MSG.

Referenced by JumpToEvent(), JumpToRun(), JumpToSnarl(), SpinChain(), StepEvent(), and StepPassEvent().

00594                                                   {
00595   if (!event) {
00596     MSG("PlotMan",Msg::kWarning) << "FillCamEvent has empty AtmosEvent" << endl;
00597     return false;
00598   }
00599 
00600   bool RetStatus = true;
00601   bool FillStatus = true;
00602   for (unsigned int i=0;i<fCamAnas.size();i++) {
00603     RetStatus = false;
00604     fEventsRun[i]++;
00605     FillStatus = fCamAnas[i]->FillEvent(event);
00606     if(!(FillStatus^fFilterRev[i]) && fFilterOn[i]) break;
00607     fEventsPassed[i]++;
00608     RetStatus = true;
00609   }
00610   return RetStatus;
00611 }

void PlotMan::FilterOn ( bool  filt,
unsigned int  canum 
)

Definition at line 134 of file PlotMan.cxx.

References fCamAnas, fFilterOn, Msg::kSynopsis, and MSG.

00134                                                     {
00135   if (canum<fFilterOn.size()) {
00136     fFilterOn[canum] = filt;
00137     MSG("PlotMan",Msg::kSynopsis) << "Turning the filter for " << fCamAnas[canum]->GetName();
00138     if(filt) MSG("PlotMan",Msg::kSynopsis) << " on" << endl;
00139     else MSG("PlotMan",Msg::kSynopsis) << " off" << endl;
00140   }
00141 }

void PlotMan::FilterOn ( bool  filt,
std::string  caname 
)

Referenced by FOff(), and FOn().

void PlotMan::FilterRev ( bool  filt,
unsigned int  canum 
)

Definition at line 158 of file PlotMan.cxx.

References fCamAnas, fFilterRev, Msg::kSynopsis, and MSG.

00158                                                      {
00159   if(canum<fFilterRev.size()) {
00160     fFilterRev[canum] = filt;
00161     MSG("PlotMan",Msg::kSynopsis) << "Turning the filter for "
00162                                   << fCamAnas[canum]->GetName();
00163     if(filt) MSG("PlotMan",Msg::kSynopsis) << " on" << endl;
00164     else MSG("PlotMan",Msg::kSynopsis) << " off" << endl;
00165   }
00166 }

void PlotMan::FilterRev ( bool  filt,
std::string  caname 
)
void PlotMan::FinishSpin (  ) 

Definition at line 613 of file PlotMan.cxx.

References fCamAnas, and Finish().

Referenced by SpinChain().

00614 {
00615   for(unsigned int i=0;i<fCamAnas.size();i++) fCamAnas[i]->Finish();
00616 }

void PlotMan::FOff ( unsigned int  canum  )  [inline]

Definition at line 43 of file PlotMan.h.

References FilterOn().

00043 {FilterOn(false, canum);}

void PlotMan::FOn ( std::string  caname,
bool  on = true 
) [inline]

Definition at line 42 of file PlotMan.h.

References FilterOn().

00042 {FilterOn(on, caname);}

void PlotMan::FOn ( unsigned int  canum,
bool  on = true 
) [inline]

Definition at line 41 of file PlotMan.h.

References FilterOn().

00041 {FilterOn(on, canum);}

CamAna * PlotMan::GetCamAna ( unsigned int  canum  ) 

Definition at line 114 of file PlotMan.cxx.

References fCamAnas.

00114                                              {
00115   if(canum<fCamAnas.size()) return fCamAnas[canum];
00116   return 0;
00117 }

CamAna* PlotMan::GetCamAna ( std::string  caname  ) 
int PlotMan::GetLoud ( std::string  lstream = "PlotMan"  ) 
void PlotMan::JumpToEvent ( int  event  ) 

Definition at line 456 of file PlotMan.cxx.

References BuildChain(), cgRun, cgSnarl, cgSubRun, fChain, fChainBuilt, fEntries, fEvent, FillCamEvent(), fProgress, fSpinning, fStopSpinning, Msg::kInfo, MSG, and UpdateCanvases().

00456                                     {
00457   if (fSpinning)  {
00458     MSG("PlotMan",Msg::kInfo) << "Can't step while spinning Chain" << endl;
00459     return;
00460   }
00461   if(!fChainBuilt) BuildChain();
00462 
00463   fSpinning = true;
00464   MSG("PlotMan",Msg::kInfo) << "Jumping to event " << ievent << endl;
00465   const AtmosEvent* event = 0;
00466   fChain->SetBranchAddress("evt", &event);
00467 
00468   int i = ievent;
00469 
00470   if(i<0) i = 0;
00471   if(i>=fEntries) i = fEntries - 1;
00472 
00473   if (fChain->GetEntry(i) != 0) {
00474     this->FillCamEvent(event);
00475     this->UpdateCanvases();
00476     if(fProgress) fProgress->SetPosition(i);
00477     if(cgSnarl) cgSnarl->SetNumber(event->Snarl);
00478     if(cgRun) cgRun->SetNumber(event->Run);
00479     if(cgSubRun) cgSubRun->SetNumber(event->SubRun);
00480   }
00481 
00482   fEvent = i;
00483   fSpinning = false;
00484   fStopSpinning = false;
00485   MSG("PlotMan",Msg::kInfo) << "Done stepping Chain" << endl;
00486 }

void PlotMan::JumpToRun ( int  run  ) 

Definition at line 553 of file PlotMan.cxx.

References BuildChain(), cgRun, cgSubRun, fChain, fChainBuilt, fEvent, FillCamEvent(), fProgress, fSpinning, fStopSpinning, gSystem(), Msg::kInfo, Msg::kSynopsis, MSG, and UpdateCanvases().

Referenced by ManRunJump().

00553                                {
00554   if (fSpinning)  {
00555     MSG("PlotMan",Msg::kInfo) << "Can't jump while spinning Chain" << endl;
00556     return;
00557   }
00558   if(!fChainBuilt) BuildChain();
00559 
00560   int ToRun = run;
00561 
00562   MSG("PlotMan",Msg::kInfo) << "Jumping to run " << ToRun << endl;
00563   fSpinning = true;
00564   const AtmosEvent* event = 0;
00565   fChain->SetBranchAddress("evt", &event);
00566 
00567   int i = fEvent+1;
00568 
00569   if(i<0) i = 0;
00570   //if(i>=fEntries) i = fEntries-1;
00571 
00572   MSG("PlotMan",Msg::kSynopsis) << " Starting at i = " << i << endl;
00573   MSG("PlotMan",Msg::kSynopsis) << " Chain has nentries = "
00574                                 << fChain->GetEntries() << endl;
00575   for (; fChain->GetEntry(i)>0; i++) {
00576     if(((event->Run*100)+event->SubRun) >= ToRun) break;
00577     gSystem->ProcessEvents();
00578     if(fStopSpinning) break;
00579   }
00580   MSG("PlotMan",Msg::kSynopsis) << " Ending at i = " << i << endl;
00581 
00582   FillCamEvent(event);
00583   UpdateCanvases();
00584   if(fProgress) fProgress->SetPosition(i);
00585   if(cgRun) cgRun->SetNumber(event->Run);
00586   if(cgSubRun) cgSubRun->SetNumber(event->SubRun);
00587 
00588   fEvent = i;
00589   fSpinning = false;
00590   fStopSpinning = false;
00591   MSG("PlotMan",Msg::kInfo) << "Done jumping through chain" << endl;
00592 }

void PlotMan::JumpToSnarl ( int  snarl  ) 

Definition at line 513 of file PlotMan.cxx.

References BuildChain(), cgSnarl, fChain, fChainBuilt, fEvent, FillCamEvent(), fProgress, fSpinning, fStopSpinning, gSystem(), Msg::kInfo, Msg::kSynopsis, MSG, and UpdateCanvases().

Referenced by ManSnarlJump().

00513                                    {
00514   if (fSpinning)  {
00515     MSG("PlotMan",Msg::kInfo) << "Can't jump while spinning Chain" << endl;
00516     return;
00517   }
00518   if(!fChainBuilt) BuildChain();
00519 
00520   int ToSnarl = snarl;
00521 
00522   MSG("PlotMan",Msg::kInfo) << "Jumping to snarl " << ToSnarl << endl;
00523   fSpinning = true;
00524   const AtmosEvent* event = 0;
00525   fChain->SetBranchAddress("evt", &event);
00526 
00527   int i = fEvent+1;
00528 
00529   if(i<0) i = 0;
00530   //if(i>=fEntries) i = fEntries-1;
00531 
00532   MSG("PlotMan",Msg::kSynopsis) << " Starting at i = " << i << endl;
00533   MSG("PlotMan",Msg::kSynopsis) << " Chain has nentries = "
00534                                 << fChain->GetEntries() << endl;
00535   for (; fChain->GetEntry(i)>0; i++) {
00536     if(event->Snarl >= ToSnarl) break;
00537     gSystem->ProcessEvents();
00538     if(fStopSpinning) break;
00539   }
00540   MSG("PlotMan",Msg::kSynopsis) << " Ending at i = " << i << endl;
00541 
00542   FillCamEvent(event);
00543   UpdateCanvases();
00544   if(fProgress) fProgress->SetPosition(i);
00545   if(cgSnarl) cgSnarl->SetNumber(event->Snarl);
00546 
00547   fEvent = i;
00548   fSpinning = false;
00549   fStopSpinning = false;
00550   MSG("PlotMan",Msg::kInfo) << "Done jumping through chain" << endl;
00551 }

void PlotMan::ManRunJump (  ) 

Definition at line 493 of file PlotMan.cxx.

References cgRun, cgSubRun, and JumpToRun().

00493                          {
00494   if(!cgRun || !cgSubRun) return;
00495   JumpToRun((int)cgRun->GetNumber()*100 + (int)cgSubRun->GetNumber());
00496 }

void PlotMan::ManSnarlJump (  ) 

Definition at line 488 of file PlotMan.cxx.

References cgSnarl, and JumpToSnarl().

00488                            {
00489   if(!cgSnarl) return;
00490   JumpToSnarl((int)cgSnarl->GetNumber());
00491 }

void PlotMan::ManUpdateSleep (  ) 

Definition at line 506 of file PlotMan.cxx.

References cgSleep, fUpdateSleep, Msg::kSynopsis, and MSG.

00506                              {
00507   if(!cgSleep) return;
00508   fUpdateSleep = (int)cgSleep->GetNumber();
00509   MSG("PlotMan",Msg::kSynopsis) << "Setting Update Sleep to " << fUpdateSleep
00510                                 << "ms" << endl;
00511 }

void PlotMan::Next (  )  [inline]

Definition at line 76 of file PlotMan.h.

References StepEvent().

00076 {StepEvent(1);}

void PlotMan::Prev (  )  [inline]

Definition at line 77 of file PlotMan.h.

References StepEvent().

00077 {StepEvent(-1);}

bool PlotMan::ReadNEntries (  )  [inline]

Definition at line 125 of file PlotMan.h.

References fReadNEntries.

00125 {return fReadNEntries;}

void PlotMan::ReadNEntries ( bool  b  )  [inline]

Definition at line 124 of file PlotMan.h.

References fReadNEntries.

00124 {fReadNEntries = b;}

void PlotMan::ReDraw (  )  [inline]

Definition at line 78 of file PlotMan.h.

References StepEvent().

00078 {StepEvent(0);}

void PlotMan::Reset (  ) 

Definition at line 688 of file PlotMan.cxx.

References fCamAnas, fChain, fEntries, fEvent, fProgress, fSpinning, Msg::kInfo, and MSG.

00689 {
00690   if (fSpinning)  {
00691     MSG("PlotMan",Msg::kInfo) << "Can't reset while spinning Chain" << endl;
00692     return;
00693   }
00694 
00695   fChain->Reset();
00696   fEntries = 0;
00697 
00698   MSG("PlotMan",Msg::kInfo) << "Resetting PlotMan" << endl;
00699   fEvent=0;
00700   if(fProgress) fProgress->Reset();
00701   for(unsigned int i=0;i<fCamAnas.size();i++) fCamAnas[i]->Reset();
00702 }

void PlotMan::SetBranchStatus ( const char *  branch,
int  status 
)

Definition at line 268 of file PlotMan.cxx.

References fChain.

00268                                                             {
00269   fChain->SetBranchStatus(branch, status);
00270 }

void PlotMan::SetEntries ( int  entries  ) 

Definition at line 682 of file PlotMan.cxx.

References fEntries, and fProgress.

Referenced by BuildChain().

00683 {
00684   fEntries = entries;
00685   if(fProgress) fProgress->SetRange(0,fEntries);
00686 }

void PlotMan::SetLoud ( int  loud = 0,
std::string  lstream = "PlotMan" 
)
void PlotMan::SetUpdateFraction ( int  frac  )  [inline]

Definition at line 71 of file PlotMan.h.

References fUpdateFraction.

00071 {fUpdateFraction=frac;}

void PlotMan::SetUpdateInterval ( int  interval  )  [inline]

Definition at line 70 of file PlotMan.h.

References fUpdateInterval.

00070 {fUpdateInterval=interval;}

void PlotMan::SetUpdateSleep ( int  sleep  ) 

Definition at line 498 of file PlotMan.cxx.

References cgSleep, fUpdateSleep, Msg::kSynopsis, and MSG.

00498                                       {
00499   if(sleep < 0) return;
00500   fUpdateSleep = sleep;
00501   MSG("PlotMan",Msg::kSynopsis) << "Setting Update Sleep to " << fUpdateSleep
00502                                 << "ms" << endl;
00503   if(cgSleep) cgSleep->SetNumber(sleep);
00504 }

void PlotMan::SpinChain ( int  nevents = 0  ) 

Definition at line 272 of file PlotMan.cxx.

References BuildChain(), cgRun, cgSnarl, cgSubRun, fCamAnas, fChain, fChainBuilt, fDoFinish, fEntries, fEvent, fEventsPassed, fEventsRun, FillCamEvent(), FinishSpin(), fProgress, fSpinning, fStopSpinning, fUpdateFraction, fUpdateInterval, fUpdateSleep, gSystem(), Msg::kSynopsis, MSG, and UpdateCanvases().

00272                                    {
00273   Emit("SpinChain()");
00274   if (fSpinning)  {
00275     MSG("PlotMan",Msg::kSynopsis) << "Already Spinning Chain" << endl;
00276     return;
00277   }
00278 
00279   if(!fChainBuilt) BuildChain();
00280 
00281   fSpinning = true;
00282   MSG("PlotMan",Msg::kSynopsis) << "Spinning Chain";
00283   if(fUpdateInterval>0)
00284     MSG("PlotMan",Msg::kSynopsis) << " (update interval=" << fUpdateInterval << ")";
00285   if(fUpdateFraction>0)
00286     MSG("PlotMan",Msg::kSynopsis) << " (update fraction=" << fUpdateFraction << ")";
00287   MSG("PlotMan",Msg::kSynopsis) << endl;
00288   const AtmosEvent* event = 0;
00289   fChain->SetBranchAddress("evt",&event);
00290 
00291   int ThisTreeNumber = -1;
00292   int irun = 0;
00293   int i = fEvent+1;//Start at fEvent+1 to not double count events
00294   MSG("PlotMan",Msg::kSynopsis) << "\r on entry " << i;
00295   if(fEntries>0) MSG("PlotMan",Msg::kSynopsis) << " of " << fEntries;
00296   MSG("PlotMan",Msg::kSynopsis) << flush;
00297   for (; fChain->GetEntry(i)>0; i++) {
00298     bool ThisRetStatus = this->FillCamEvent(event);
00299     if(fProgress) fProgress->Increment(1);
00300 
00301     if(fUpdateInterval>0) if (i%fUpdateInterval == 0) {
00302       MSG("PlotMan",Msg::kSynopsis) << "\r on entry " << i;
00303       if(fEntries>0) MSG("PlotMan",Msg::kSynopsis) << " of " << fEntries;
00304       MSG("PlotMan",Msg::kSynopsis) << flush;
00305       if (ThisRetStatus) {
00306         this->UpdateCanvases();
00307         if(fUpdateSleep>0) gSystem->Sleep(fUpdateSleep);
00308       }
00309 
00310       if(cgSnarl) cgSnarl->SetNumber(event->Snarl);
00311       if(cgRun) cgRun->SetNumber(event->Run);
00312       if(cgSubRun) cgSubRun->SetNumber(event->SubRun);
00313     }
00314 
00315     if (fUpdateFraction>0 && fEntries>0) {
00316       double upinter = (double)fEntries / (double)fUpdateFraction;
00317       int iinter = (int)(i/upinter);
00318       if (((double)i - iinter*upinter) < 1.) {
00319         MSG("PlotMan",Msg::kSynopsis) << "\r on entry " << i;
00320         if(fEntries>0) MSG("PlotMan",Msg::kSynopsis) << " of " << fEntries;
00321         MSG("PlotMan",Msg::kSynopsis) << flush;
00322         if (ThisRetStatus) {
00323           this->UpdateCanvases();
00324           if(fUpdateSleep>0) gSystem->Sleep(fUpdateSleep);
00325         }
00326       }
00327 
00328       if(cgSnarl) cgSnarl->SetNumber(event->Snarl);
00329       if(cgRun) cgRun->SetNumber(event->Run);
00330       if(cgSubRun) cgSubRun->SetNumber(event->SubRun);
00331     }
00332 
00333     if (fChain->GetTreeNumber() != ThisTreeNumber) {
00334       MSG("PlotMan",Msg::kSynopsis) << "\r on tree " << fChain->GetTreeNumber() + 1
00335              << " of " << fChain->GetNtrees() << flush;
00336       ThisTreeNumber = fChain->GetTreeNumber();
00337     }
00338 
00339     gSystem->ProcessEvents();
00340 
00341     irun++;
00342     if(nevents>0 && irun>=nevents) break;
00343 
00344     if(fStopSpinning) break;
00345   }
00346   MSG("PlotMan",Msg::kSynopsis) << endl;
00347   MSG("PlotMan",Msg::kSynopsis) << "Ran " << irun << " events in this spin" << endl;
00348   fEvent = i;
00349 
00350   for (unsigned int i=0;i<fCamAnas.size();i++) {
00351     MSG("PlotMan",Msg::kSynopsis) << "Ana " << fCamAnas[i]->GetName() << "\t\t"
00352            << "Passed " << fEventsPassed[i]
00353            << " of " << fEventsRun[i] << " Events" << endl;
00354   }
00355 
00356   fSpinning = false;
00357   fStopSpinning = false;
00358   if(fDoFinish) this->FinishSpin();
00359   MSG("PlotMan",Msg::kSynopsis) << "Done Spinning Chain" << endl;
00360 }

void PlotMan::StepEvent ( int  nevents = 1  ) 

Definition at line 362 of file PlotMan.cxx.

References BuildChain(), cgRun, cgSnarl, cgSubRun, fChain, fChainBuilt, fEntries, fEvent, FillCamEvent(), fProgress, fSpinning, fStopSpinning, Msg::kInfo, Msg::kSynopsis, Msg::kWarning, MSG, and UpdateCanvases().

Referenced by Next(), Prev(), and ReDraw().

00363 {
00364   if (fSpinning)  {
00365     MSG("PlotMan",Msg::kWarning)<< "Can't step while spinning Chain" << endl;
00366     return;
00367   }
00368   if(!fChainBuilt) BuildChain();
00369 
00370   fSpinning = true;
00371   MSG("PlotMan",Msg::kSynopsis) << "Stepping chain by " << nevents << " events" << endl;
00372   const AtmosEvent* event = 0;
00373   fChain->SetBranchAddress("evt",&event);
00374 
00375   int i = fEvent+nevents;
00376 
00377   if(i<0) i = 0;
00378   if(i>=fEntries) i = fEntries-1;
00379 
00380   if (fChain->GetEntry(i)) {
00381     this->FillCamEvent(event);
00382     this->UpdateCanvases();
00383     if(fProgress) fProgress->Increment(nevents);
00384     if(cgSnarl) cgSnarl->SetNumber(event->Snarl);
00385     if(cgRun) cgRun->SetNumber(event->Run);
00386     if(cgSubRun) cgSubRun->SetNumber(event->SubRun);
00387   }
00388   else {
00389     MSG("PlotMan",Msg::kWarning)<< "Chain could not get entry " << i << endl;
00390   }
00391 
00392   fEvent = i;
00393   fSpinning = false;
00394   fStopSpinning = false;
00395   MSG("PlotMan",Msg::kInfo) << "Done stepping Chain" << endl;
00396 }

void PlotMan::StepPassEvent ( int  nevents = 1  ) 

Definition at line 398 of file PlotMan.cxx.

References BuildChain(), cgRun, cgSnarl, cgSubRun, fChain, fChainBuilt, fEntries, fEvent, FillCamEvent(), fProgress, fSpinning, fStopSpinning, gSystem(), Msg::kInfo, MSG, and UpdateCanvases().

00399 {
00400   if (fSpinning)  {
00401     MSG("PlotMan",Msg::kInfo) << "Can't step while spinning Chain" << endl;
00402     return;
00403   }
00404   if(!fChainBuilt) BuildChain();
00405 
00406   fSpinning = true;
00407   MSG("PlotMan",Msg::kInfo) << "Stepping chain by " << nevents << " events"
00408                             << endl;
00409   const AtmosEvent* event = 0;
00410   fChain->SetBranchAddress("evt",&event);
00411 
00412   int i = fEvent+1;
00413   if(nevents<0) i = fEvent-1;
00414 
00415   if(i<0) i = 0;
00416   if(i>=fEntries) i = fEntries-1;
00417 
00418   if(fChain->GetEntry(i) == 0) return;
00419   int npassed = 0;
00420 
00421   while (nevents > 0 && npassed < nevents) {
00422     while (!this->FillCamEvent(event)) {
00423       i++;
00424       if(fChain->GetEntry(i) == 0) fStopSpinning = true;
00425       if(fProgress) fProgress->Increment(1);
00426       gSystem->ProcessEvents();
00427       if(fStopSpinning) break;
00428     }
00429     if(fStopSpinning) break;
00430     npassed++;
00431   }
00432 
00433   while (nevents < 0 && npassed < -nevents) {
00434     while (!this->FillCamEvent(event)) {
00435       i--;
00436       if(fChain->GetEntry(i) == 0) fStopSpinning = true;
00437       if(fProgress) fProgress->Increment(1);
00438       gSystem->ProcessEvents();
00439       if(fStopSpinning) break;
00440     }
00441     if(fStopSpinning) break;
00442     npassed++;
00443   }
00444 
00445   if(cgSnarl && event) cgSnarl->SetNumber(event->Snarl);
00446   if(cgRun && event) cgRun->SetNumber(event->Run);
00447   if(cgSubRun && event) cgSubRun->SetNumber(event->SubRun);
00448   this->UpdateCanvases();
00449 
00450   fEvent = i;
00451   fSpinning = false;
00452   fStopSpinning = false;
00453   MSG("PlotMan",Msg::kInfo) << "Done stepping Chain" << endl;
00454 }

void PlotMan::StopSpinning (  )  [inline]

Definition at line 66 of file PlotMan.h.

References fStopSpinning.

00066 {fStopSpinning=true;}

void PlotMan::UpdateCanvases ( TFolder *  tfol = 0  ) 

Definition at line 618 of file PlotMan.cxx.

References HistMan::BaseFolder(), and tc.

Referenced by JumpToEvent(), JumpToRun(), JumpToSnarl(), SpinChain(), StepEvent(), and StepPassEvent().

00619 {
00620   if(gROOT->IsBatch()) return;
00621   //For empty parameter, start at the top
00622   TFolder *tf = tfol;
00623   if (!tf) {
00624     HistMan hm("");
00625     tf = &(hm.BaseFolder());
00626   }
00627 
00628   TCollection *flist = tf->GetListOfFolders();
00629   TIter itr(flist->MakeIterator());
00630   TObject *fobj = 0;
00631   while ( (fobj=itr()) ) {
00632     if (fobj->InheritsFrom("TFolder")) {
00633       this->UpdateCanvases(dynamic_cast<TFolder*>(fobj));
00634       continue;
00635     }
00636     if (fobj->InheritsFrom("TCanvas")) {
00637       TCanvas *tc = dynamic_cast<TCanvas*>(fobj);
00638       tc->Modified();
00639       TList *tl = tc->GetListOfPrimitives();
00640       for (int j=0;j<tl->GetSize();j++) {
00641         if(! tl->At(j)->InheritsFrom("TPad")) continue;
00642         TPad *tp = dynamic_cast<TPad*>(tl->At(j));
00643         tp->Modified();
00644       }
00645       tc->Update();
00646     }
00647   }
00648 
00649   /*
00650   for (unsigned int i=0;i<fCanvases.size();i++) {
00651     fCanvases[i]->Modified();
00652     TList *tl = fCanvases[i]->GetListOfPrimitives();
00653     for (int j=0;j<tl->GetSize();j++) {
00654       if(! tl->At(j)->InheritsFrom("TPad")) continue;
00655       TPad *thispad = dynamic_cast<TPad*>(tl->At(j));
00656       thispad->Modified();
00657     }
00658     fCanvases[i]->Update();
00659   }
00660   */
00661   return;
00662 }

void PlotMan::WriteOut ( std::string  fn = "PlotMan.root"  ) 

Member Data Documentation

TGMainFrame* PlotMan::cgMain [private]

Definition at line 110 of file PlotMan.h.

Referenced by AddCamAna(), ControlWindow(), and PlotMan().

TGNumberEntry* PlotMan::cgRun [private]
TGNumberEntry* PlotMan::cgSleep [private]

Definition at line 115 of file PlotMan.h.

Referenced by ControlWindow(), ManUpdateSleep(), PlotMan(), and SetUpdateSleep().

TGNumberEntry* PlotMan::cgSnarl [private]
TGNumberEntry* PlotMan::cgSubRun [private]
std::vector<CamAna*> PlotMan::fCamAnas [private]
bool PlotMan::fChainBuilt [private]
bool PlotMan::fChainCurrent [private]

Definition at line 93 of file PlotMan.h.

Referenced by PlotMan().

bool PlotMan::fDoFinish [private]

Definition at line 107 of file PlotMan.h.

Referenced by DoFinish(), PlotMan(), and SpinChain().

int PlotMan::fEntries [private]
int PlotMan::fEvent [private]
std::vector<int> PlotMan::fEventsPassed [private]

Definition at line 97 of file PlotMan.h.

Referenced by AddCamAna(), FillCamEvent(), and SpinChain().

std::vector<int> PlotMan::fEventsRun [private]

Definition at line 96 of file PlotMan.h.

Referenced by AddCamAna(), FillCamEvent(), and SpinChain().

std::vector<bool> PlotMan::fFilterOn [private]

Definition at line 98 of file PlotMan.h.

Referenced by AddCamAna(), AllFiltersOn(), FillCamEvent(), and FilterOn().

std::vector<bool> PlotMan::fFilterRev [private]

Definition at line 99 of file PlotMan.h.

Referenced by AddCamAna(), AllFiltersRev(), FillCamEvent(), and FilterRev().

TGHProgressBar* PlotMan::fProgress [private]
bool PlotMan::fReadNEntries [private]

Definition at line 103 of file PlotMan.h.

Referenced by BuildChain(), PlotMan(), and ReadNEntries().

std::vector<std::string> PlotMan::fRootFiles [private]

Definition at line 91 of file PlotMan.h.

Referenced by BuildChain().

std::string PlotMan::fRootFilesSuf [private]

Definition at line 92 of file PlotMan.h.

Referenced by FileSuffix(), and PlotMan().

bool PlotMan::fSpinning [private]
bool PlotMan::fStopSpinning [private]
int PlotMan::fUpdateFraction [private]

Definition at line 106 of file PlotMan.h.

Referenced by PlotMan(), SetUpdateFraction(), and SpinChain().

int PlotMan::fUpdateInterval [private]

Definition at line 106 of file PlotMan.h.

Referenced by PlotMan(), SetUpdateInterval(), and SpinChain().

int PlotMan::fUpdateSleep [private]

Definition at line 106 of file PlotMan.h.

Referenced by ManUpdateSleep(), PlotMan(), SetUpdateSleep(), and SpinChain().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1