Bdnt Class Reference

Create an TTree with some BeamData SWIC scanner data. More...

#include <Bdnt.h>

List of all members.

Public Member Functions

 Bdnt (const char *trig_name, const char *outfile="bd.nt.root")
void AddSwic (const char *swic_name)
void AddBpm (const char *bpm_name)
void ProcessFile (const char *filename)
TTree * GetTree ()
void Write ()

Private Attributes

BdntImpfImp

Detailed Description

Create an TTree with some BeamData SWIC scanner data.

Definition at line 30 of file Bdnt.h.


Constructor & Destructor Documentation

Bdnt::Bdnt ( const char *  trig_name,
const char *  outfile = "bd.nt.root" 
)

Definition at line 164 of file Bdnt.cxx.

References BdntImp::file, fImp, Form(), BdntImp::tree, BdntImp::trig, and BdntImp::trigname.

00164                                                       : fImp(new BdntImp)
00165 {
00166     fImp->trigname = trig_name;
00167     fImp->file = new TFile(outfile,"recreate");
00168     fImp->tree = new TTree("bd", Form("Beam Data with trigger %s",trig_name));
00169     fImp->trig = new TriggerBranch;
00170     fImp->tree->Branch("trig.","TriggerBranch",&fImp->trig);
00171 }


Member Function Documentation

void Bdnt::AddBpm ( const char *  bpm_name  ) 

Definition at line 197 of file Bdnt.cxx.

References bpm_name2branch_name(), BdntImp::bpms, fImp, and BdntImp::tree.

00198 {
00199     fImp->bpms[bpmname] = new BpmBranch;
00200     string branchname = bpm_name2branch_name(bpmname);
00201     branchname += ".";
00202     fImp->tree->Branch(branchname.c_str(),"BpmBranch",
00203                        &(fImp->bpms[bpmname]));
00204 }

void Bdnt::AddSwic ( const char *  swic_name  ) 

Definition at line 189 of file Bdnt.cxx.

References fImp, swic_name2branch_name(), BdntImp::swics, and BdntImp::tree.

00190 {
00191     fImp->swics[swicname] = new SwicBranch;
00192     string branchname = swic_name2branch_name(swicname);
00193     branchname += ".";
00194     fImp->tree->Branch(branchname.c_str(),"SwicBranch",
00195                        &(fImp->swics[swicname]));
00196 }

TTree * Bdnt::GetTree (  ) 

Definition at line 249 of file Bdnt.cxx.

References fImp, and BdntImp::tree.

00249 { return fImp->tree; }

void Bdnt::ProcessFile ( const char *  filename  ) 

Definition at line 206 of file Bdnt.cxx.

References BdntImp::Fill(), fImp, RawRecord::GetRawBlockIter(), RecMinos::GetVldContext(), and BdntImp::tree.

00207 {
00208     TFile file(filename,"READ");
00209     TTree* tree = (TTree*)(file.Get("BeamMon"));
00210     RawRecord* record = 0;
00211 
00212 
00213     for ( Int_t ient = 0; ient < tree -> GetEntries(); ient++ ) {
00214         tree -> SetBranchAddress("RawRecord",&record);
00215         tree->GetEntry(ient);
00216 
00217         if (!ient) {
00218             const VldContext* vld = record->GetVldContext();
00219             cout << "Reading " << filename << ":\n"
00220                  << *vld << endl;
00221         }
00222 
00223         TIter itr = record->GetRawBlockIter();
00224         const RawDataBlock* rdb = 0;
00225 
00226         // loop over blocks in record
00227         while ((rdb = dynamic_cast<RawDataBlock*>(itr()))) {
00228             if (! rdb->InheritsFrom("RawBeamMonBlock")) {
00229                 //cerr << "Doesn't inherit from RawBeamMonBlock" << endl;
00230                 continue;
00231             }
00232             const RawBeamMonBlock* rbmb = 
00233                 dynamic_cast<const RawBeamMonBlock*>(rdb);
00234             assert(rbmb);
00235 
00236             fImp->Fill(rbmb);
00237             fImp->tree->Fill();
00238         }
00239 
00240         if (tree->GetEntries()-ient == 1) {
00241             const VldContext* vld = record->GetVldContext();
00242             cout << "finishing " << filename << ":\n"
00243                  << *vld << endl;
00244         }
00245         delete record; record = 0;
00246     }
00247     
00248 }

void Bdnt::Write (  ) 

Definition at line 251 of file Bdnt.cxx.

References BdntImp::file, fImp, and BdntImp::tree.

00252 {
00253     fImp->file->cd();
00254     fImp->tree->Write();
00255     fImp->file->Close();
00256 }


Member Data Documentation

BdntImp* Bdnt::fImp [private]

Definition at line 31 of file Bdnt.h.

Referenced by AddBpm(), AddSwic(), Bdnt(), GetTree(), ProcessFile(), and Write().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1