#include <PedStudy.h>
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 () | |
| PedViewer * | View () |
| 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 |
|
|
Definition at line 22 of file PedStudy.h. |
|
|
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 }
|
|
|
Definition at line 37 of file PedStudy.h. 00037 {}
|
|
|
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 }
|
|
|
Definition at line 67 of file PedStudy.cxx. References count, done(), fFileMap, files, 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 }
|
|
|
Definition at line 34 of file PedStudy.cxx. References fFileMap, gSystem(), 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 }
|
|
||||||||||||||||
|
Definition at line 86 of file PedStudy.cxx. References HistMan::Book(), count, done(), fHist, RawRecord::GetRawBlockIter(), BDSwicPeds::IsPedSpill(), OneRecord(), and RawBeamMonBlock::TclkTriggerEvent(). Referenced by Fill(). 00087 {
00088 HistMan hm("pedstudy");
00089
00090 HistMap::iterator it, done=fHist.end();
00091 for (it=fHist.begin(); it != done; ++it) {
00092 string name = it->first.substr(2);
00093 string hmdir = name + "/" + filename;
00094 TProfile* hist = hm.Book<TProfile>(name.c_str(),hmdir.c_str(),
00095 96,0,96,hmdir.c_str());
00096 fHist[it->first].perfile.push_back(hist);
00097 }
00098
00099 string rootfile = dirname + "/" + filename;
00100 TFile file(rootfile.c_str(),"READ");
00101 TTree* tree = (TTree*)(file.Get("BeamMon"));
00102 RawRecord* record = 0;
00103 for ( Int_t ient = 0; ient < tree -> GetEntries(); ient++ ) {
00104 tree -> SetBranchAddress("RawRecord",&record);
00105 tree->GetEntry(ient);
00106 TIter itr = record->GetRawBlockIter();
00107
00108 const RawBeamMonBlock* rbmb = 0;;
00109 const RawBeamMonHeaderBlock* rbmhb = 0;
00110
00111 // check all blocks
00112 RawDataBlock* rdb = 0;
00113 while ((rdb = dynamic_cast<RawDataBlock*>(itr()))) {
00114 if (rdb->InheritsFrom("RawBeamMonBlock"))
00115 rbmb = dynamic_cast<const RawBeamMonBlock*>(rdb);
00116 if (rdb->InheritsFrom("RawBeamMonHeaderBlock"))
00117 rbmhb = dynamic_cast<const RawBeamMonHeaderBlock*>(rdb);
00118 }
00119
00120 if (!(rbmb && rbmhb)) continue;
00121
00122 if (rbmb->TclkTriggerEvent() != 0xa9) continue;
00123 if (! BDSwicPeds::IsPedSpill(*rbmb)) continue;
00124
00125 this->OneRecord(count,*rbmb);
00126 }
00127 delete record; record = 0;
00128 }
|
|
||||||||||||
|
Definition at line 130 of file PedStudy.cxx. References count, done(), fHist, RawBeamSwicData::SetData(), and RawBeamSwicData::UnscaledWireData(). Referenced by OneFile(). 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 }
|
|
|
View the plots.
Definition at line 157 of file PedStudy.cxx. 00158 {
00159 return new PedViewer(*this);
00160 }
|
|
|
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 }
|
|
|
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(), OneFile(), OneRecord(), PedViewer::PedViewer(), and PedViewer::Prev(). |
1.3.9.1