PedStudy Class Reference

#include <PedStudy.h>

List of all members.

Classes

struct  Hists

Public Types

typedef std::map< std::string,
Hists
HistMap

Public Member Functions

void GetFiles (const char *directories[])
void Book ()
void Fill ()
void OneFile (int count, std::string file, std::string dir)
void OneRecord (int count, const RawBeamMonBlock &block)
 PedStudy (const char *directories[])
 ~PedStudy ()
PedViewerView ()
 View the plots.
void WriteOut (const char *filename)
 Write out the histograms to soem root file.

Public Attributes

HistMap fHist
std::map< std::string,
std::string > 
fFileMap

Detailed Description

Definition at line 15 of file PedStudy.h.


Member Typedef Documentation

typedef std::map<std::string,Hists> PedStudy::HistMap

Definition at line 22 of file PedStudy.h.


Constructor & Destructor Documentation

PedStudy::PedStudy ( const char *  directories[]  ) 

Create a PedStudy with list of directories holding B*_*.mbeam.root files to use as input.

Definition at line 25 of file PedStudy.cxx.

References Book(), Fill(), and GetFiles().

00026 {
00027     cerr << "PedStudy\n";
00028 
00029     this->GetFiles(directories);
00030     this->Book();
00031     this->Fill();
00032 }

PedStudy::~PedStudy (  )  [inline]

Definition at line 37 of file PedStudy.h.

00037 {}


Member Function Documentation

void PedStudy::Book (  ) 

Definition at line 53 of file PedStudy.cxx.

References HistMan::Book(), fFileMap, fHist, BDDevices::SwicDevices(), and swics.

Referenced by PedStudy().

00054 {
00055     int nfiles = fFileMap.size();
00056     HistMan hm("pedstudy");
00057     vector<string> swics = BDDevices::SwicDevices();
00058     for (size_t ind=0; ind<swics.size(); ++ind) {
00059         fHist[swics[ind]].all =
00060             hm.Book<TH2I>(swics[ind].substr(2).c_str(),
00061                           swics[ind].c_str(),
00062                           nfiles,0,nfiles,
00063                           96,0,96,"all");
00064     }
00065 }

void PedStudy::Fill (  ) 

Definition at line 67 of file PedStudy.cxx.

References count, done(), fFileMap, files, it, Msg::kInfo, MSG, and OneFile().

Referenced by PedStudy().

00068 {
00069     map<string,string>::iterator it, done = fFileMap.end();
00070     list<string> files;
00071     for (it=fFileMap.begin(); it != done; ++it) files.push_back(it->first);
00072     files.sort();
00073     list<string>::iterator lit, ldone = files.end();
00074 
00075     int count = 0;
00076     for (lit = files.begin(); lit != ldone; ++lit) {
00077         string file = *lit;
00078         string dir = fFileMap[file];
00079 
00080         MSG("BD",Msg::kInfo) << dir << "/" << file << endl;
00081         this->OneFile(count,file,dir);
00082         ++count;
00083     }
00084 }

void PedStudy::GetFiles ( const char *  directories[]  ) 

Definition at line 34 of file PedStudy.cxx.

References fFileMap, gSystem(), Msg::kWarning, and MSG.

Referenced by PedStudy().

00035 {
00036     for (int ind=0; directories[ind]; ++ind) {
00037         void* dir = gSystem->OpenDirectory(directories[ind]);
00038         if (!dir) {
00039             MSG("BD",Msg::kWarning)
00040                 << "Skipping empty directory: " << directories[ind] << endl;
00041             continue;
00042         }
00043 
00044         const char* cptr=0;
00045         while ( (cptr = gSystem->GetDirEntry(dir)) ) {
00046             string file = cptr;
00047             if (string::npos == file.find(".mbeam.root")) continue;
00048             fFileMap[file] = directories[ind];
00049         }
00050     }
00051 }

void PedStudy::OneFile ( int  count,
std::string  file,
std::string  dir 
)

Referenced by Fill().

void PedStudy::OneRecord ( int  count,
const RawBeamMonBlock block 
)

Definition at line 130 of file PedStudy.cxx.

References fHist, RawBeamSwicData::SetData(), and RawBeamSwicData::UnscaledWireData().

00131 {
00132     map<string,Hists>::iterator it, done = fHist.end();
00133     RawBeamSwicData swic;
00134     for (it = fHist.begin(); it != done; ++it) {
00135         const RawBeamData* rbd = block[it->first];
00136         if (!rbd) continue;
00137         swic.SetData(*rbd);
00138 
00139         vector<int> wire;
00140         swic.UnscaledWireData(wire);
00141         for (size_t ind=0; ind<wire.size(); ++ind) {
00142             it->second.all->Fill(count,ind,wire[ind]);
00143             it->second.perfile.back()->Fill(ind,wire[ind]);
00144 
00145         }
00146     }
00147 }

PedViewer * PedStudy::View (  ) 

View the plots.

Definition at line 157 of file PedStudy.cxx.

00158 {
00159     return new PedViewer(*this);
00160 }

void PedStudy::WriteOut ( const char *  filename  ) 

Write out the histograms to soem root file.

Definition at line 151 of file PedStudy.cxx.

References HistMan::WriteOut().

00152 {
00153     HistMan hm("");
00154     hm.WriteOut(filename);
00155 }


Member Data Documentation

std::map<std::string,std::string> PedStudy::fFileMap

Definition at line 25 of file PedStudy.h.

Referenced by Book(), Fill(), and GetFiles().

Definition at line 24 of file PedStudy.h.

Referenced by Book(), PedViewer::Next(), OneRecord(), PedViewer::PedViewer(), and PedViewer::Prev().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1