Public Types | |
| typedef map< string, AcnetDevice * > | DeviceMap |
Public Member Functions | |
| BmntImp () | |
| ~BmntImp () | |
| bool | Start (const char *outfile) |
| void | Stop () |
| void | ProcessFile (const char *filename, bool prefill, int nentries=0) |
| bool | Fill (const RawBeamMonBlock *rbmb, bool prefill) |
Public Attributes | |
| TFile * | fFile |
| TTree * | fTree |
| DeviceMap | fDevices |
|
|
|
|
|
Definition at line 30 of file Bmnt.cxx.
|
|
|
Definition at line 31 of file Bmnt.cxx. 00031 { this->Stop(); }
|
|
||||||||||||
|
Definition at line 69 of file Bmnt.cxx. References acnet2branchname(), AcnetDevice::clear(), AcnetDevice::data, AcnetDevice::delay, done(), AcnetDevice::event, fDevices, fTree, RawBeamData::GetData(), RawBeamData::GetDataLength(), RawBeamData::GetMsecs(), RawBeamMonBlock::GetNames(), RawBeamData::GetSeconds(), AcnetDevice::msec, AcnetDevice::ndata, AcnetDevice::sec, RawBeamMonBlock::TclkTriggerDelay(), RawBeamMonBlock::TclkTriggerEvent(), and AcnetDevice::timestamp. Referenced by ProcessFile(). 00070 {
00071 DeviceMap::iterator it, done = fDevices.end();
00072 for (it=fDevices.begin(); it != done; ++it) {
00073 it->second->clear();
00074 }
00075
00076 vector<string> namelist = rbmb->GetNames();
00077
00078 //cerr << "Callback has " << namelist.size() << " devices\n";
00079 for (size_t ind=0; ind<namelist.size(); ++ ind) {
00080 string name = namelist[ind];
00081 string branchname = acnet2branchname(name);
00082
00083 AcnetDevice* dev = fDevices[branchname];
00084 if (! dev) {
00085 dev = new AcnetDevice(name.c_str());
00086 fDevices[branchname] = dev;
00087
00088 this->fTree->Branch(branchname.c_str(),"AcnetDevice",
00089 &(fDevices[branchname]));
00090
00091 //cerr << "New device: " << name
00092 // << " stored as " << branchname << endl;
00093 }
00094 dev->clear();
00095
00096 if (prefill) continue;
00097
00098 const RawBeamData* rbd = (*rbmb)[name];
00099 assert(rbd);
00100
00101 dev->event = rbmb->TclkTriggerEvent();
00102 dev->delay = rbmb->TclkTriggerDelay();
00103
00104 dev->sec = rbd->GetSeconds();
00105 dev->msec = rbd->GetMsecs();
00106 dev->timestamp = (1.0*dev->sec) + (dev->msec/1000.0);
00107
00108 dev->ndata = rbd->GetDataLength();
00109 dev->data = (double*)rbd->GetData(); // does this do bad things?
00110
00111 }
00112
00113 if (!prefill) this->fTree->Fill();
00114
00115 return true;
00116 }
|
|
||||||||||||||||
|
Definition at line 192 of file Bmnt.cxx. References Fill(), RawRecord::GetRawBlockIter(), and RecMinos::GetVldContext(). Referenced by Bmnt::ProcessDirectory(), Bmnt::ProcessFile(), and Bmnt::ProcessFiles(). 00193 {
00194 TFile file(filename,"READ");
00195 TTree* tree = (TTree*)(file.Get("BeamMon"));
00196
00197 if (!tree) {
00198 cerr << "Can not find BeamMon tree in " << filename << endl;
00199 return;
00200 }
00201
00202 RawRecord* record = 0;
00203 if (!nentries) nentries = tree->GetEntries();
00204 for ( Int_t ient = 0; ient < nentries; ient++ ) {
00205 tree -> SetBranchAddress("RawRecord",&record);
00206 tree->GetEntry(ient);
00207
00208 if (!ient) {
00209 const VldContext* vld = record->GetVldContext();
00210 cout << "Reading " << filename << ":\n"
00211 << *vld << endl;
00212 }
00213
00214 TIter itr = record->GetRawBlockIter();
00215 const RawDataBlock* rdb = 0;
00216
00217 //cerr << "Entry " << ient << endl;
00218
00219 // loop over blocks in record
00220 while ((rdb = dynamic_cast<RawDataBlock*>(itr()))) {
00221 if (! rdb->InheritsFrom("RawBeamMonBlock")) {
00222 //cerr << "Doesn't inherit from RawBeamMonBlock" << endl;
00223 continue;
00224 }
00225 const RawBeamMonBlock* rbmb =
00226 dynamic_cast<const RawBeamMonBlock*>(rdb);
00227 assert(rbmb);
00228
00229 this->Fill(rbmb,prefill);
00230 }
00231 #if 0
00232 if (tree->GetEntries()-ient == 1) {
00233 const VldContext* vld = record->GetVldContext();
00234 cout << "finishing " << filename << ":\n"
00235 << *vld << endl;
00236 }
00237 #endif
00238 delete record; record = 0;
00239 }
00240
00241 }
|
|
|
Definition at line 49 of file Bmnt.cxx. References fFile, fTree, gSystem(), outfile, and Stop(). Referenced by Bmnt::Bmnt(), and Bmnt::ProcessDirectory(). 00050 {
00051 this->Stop();
00052 if (!gSystem->AccessPathName(outfile,kReadPermission)) {
00053 cerr << "File already exists: " << outfile << endl;
00054 return false;
00055 }
00056 fFile = new TFile(outfile,"new");
00057 fTree = new TTree("bd", "Beam Monitoring Data");
00058 return true;
00059 }
|
|
|
Definition at line 60 of file Bmnt.cxx. Referenced by Bmnt::ProcessDirectory(), and Start(). 00061 {
00062 if (fFile) {
00063 fFile->Close();
00064 delete fFile;
00065 fFile = 0;
00066 fTree = 0;
00067 }
00068 }
|
|
|
Definition at line 28 of file Bmnt.cxx. Referenced by Fill(). |
|
|
Definition at line 25 of file Bmnt.cxx. Referenced by Start(), Stop(), and Bmnt::Write(). |
|
|
Definition at line 26 of file Bmnt.cxx. Referenced by Fill(), Bmnt::GetTree(), Start(), Stop(), and Bmnt::Write(). |
1.3.9.1