Bdtxt.h File Reference

Go to the source code of this file.

Functions

void bd_text_dump (const char *rootfile, const char *textfile, const char *pedfile, const char *swicfile)
 Dump some stuff from root file to vector text file.

Function Documentation

void bd_text_dump ( const char *  rootfile,
const char *  textfile,
const char *  pedfile,
const char *  swicfile 
)

Dump some stuff from root file to vector text file.

Definition at line 314 of file Bdtxt.cxx.

References dump_hadmu_monitor(), dump_profile_monitor(), dump_simple_data(), RawRecord::GetRawBlockIter(), RecMinos::GetVldContext(), init_hadmu_monitor(), init_profile_monitor(), init_simple_data(), and load_scale_map().

00316 {
00317     TFile file(rootfile,"READ");
00318     TTree* tree = (TTree*)(file.Get("BeamMon"));
00319     RawRecord* record = 0;
00320 
00321     ScaleMap pedmap,swicmap;
00322     load_scale_map(pedfile,pedmap,4);
00323     load_scale_map(swicfile,swicmap,10);
00324 
00325     ofstream fstr(textfile);
00326     if (!fstr) {
00327         cerr << "Can't open \"" << textfile << "\" for writing\n";
00328         return;
00329     }
00330     fstr << "# ";
00331     init_simple_data(fstr);
00332     init_profile_monitor(fstr);
00333     init_hadmu_monitor(fstr);
00334     fstr << endl;
00335 
00336     for ( Int_t ient = 0; ient < tree -> GetEntries(); ient++ ) {
00337         tree -> SetBranchAddress("RawRecord",&record);
00338         tree->GetEntry(ient);
00339 
00340         if (!ient) {
00341             const VldContext* vld = record->GetVldContext();
00342             cout << "Reading " << rootfile << ":\n"
00343                  << *vld << endl;
00344         }
00345 
00346         TIter itr = record->GetRawBlockIter();
00347         const RawDataBlock* rdb = 0;
00348 
00349         cerr << "Entry " << ient << endl;
00350 
00351         // loop over blocks in record
00352         while ((rdb = dynamic_cast<RawDataBlock*>(itr()))) {
00353             if (! rdb->InheritsFrom("RawBeamMonBlock")) {
00354                 //cerr << "Doesn't inherit from RawBeamMonBlock" << endl;
00355                 continue;
00356             }
00357             const RawBeamMonBlock* rbmb = 
00358                 dynamic_cast<const RawBeamMonBlock*>(rdb);
00359             assert(rbmb);
00360 
00361             dump_simple_data(fstr,*rbmb);
00362             dump_profile_monitor(fstr,*rbmb,swicmap);
00363             dump_hadmu_monitor(fstr,*rbmb,pedmap);
00364             fstr << endl;
00365             break;
00366         }
00367 
00368         if (tree->GetEntries()-ient == 1) {
00369             const VldContext* vld = record->GetVldContext();
00370             cout << "finishing " << rootfile << ":\n"
00371                  << *vld << endl;
00372         }
00373         delete record; record = 0;
00374     }
00375     
00376 }


Generated on 2 Nov 2017 for loon by  doxygen 1.6.1