/////////////////////////////////////////////////////////////////////////////// // quick instructions: // ------------------- // 1. use cdfopr/OfflineMon/scripts/parse_farm_encp_log.rb to parse encp log file // 2. do // // root // .L shlib/$BFARCH/libOfflineMon.so // m = new TEncpMon() // m->UpdateNtuple (input_file,output_ntuple) // // 3. now you're ready to run this script on produced ntuple /////////////////////////////////////////////////////////////////////////////// #include "OfflineMon/encp.hh" #include #include #include ClassImp(encp) //_____________________________________________________________________________ void encp::Loop() { // In a ROOT session, you can do: // Root > .L encp.C // Root > encp t // Root > t.GetEntry(12); // Fill t data members with entry number 12 // Root > t.Show(); // Show values of entry 12 // Root > t.Show(16); // Read and show values of entry 16 // Root > t.Loop(); // Loop on all entries // // This is the loop skeleton where: // jentry is the global entry number in the chain // ientry is the entry number in the current Tree // Note that the argument to GetEntry must be: // jentry for TChain::GetEntry // ientry for TTree::GetEntry and TBranch::GetEntry // // To read only selected branches, Insert statements like: // METHOD1: // fChain->SetBranchStatus("*",0); // disable all branches // fChain->SetBranchStatus("branchname",1); // activate branchname // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch if (fChain == 0) return; h_or_vs_s = new TH2F("h_or_vs_stream","overall rate vs stream",20,0,20,100,0,50); Int_t nentries = Int_t(fChain->GetEntriesFast()); Int_t nbytes = 0, nb = 0; for (Int_t jentry=0; jentryGetEntry(jentry); nbytes += nb; int stream = int(fFileName[0])-96; h_or_vs_s->Fill(stream,fOverallRate); // if (Cut(ientry) < 0) continue; } } //_____________________________________________________________________________ encp::encp(TTree *tree) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. if (tree == 0) { TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("encp.root"); if (!f) { f = new TFile("encp.root"); } tree = (TTree*)gDirectory->Get("encp"); } Init(tree); } //_____________________________________________________________________________ encp::~encp() { if (!fChain) return; delete fChain->GetCurrentFile(); } //_____________________________________________________________________________ Int_t encp::GetEntry(Int_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Int_t encp::LoadTree(Int_t entry) { // Set the environment to read one entry if (!fChain) return -5; Int_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->IsA() != TChain::Class()) return centry; TChain *chain = (TChain*)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } void encp::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses of the tree // will be set. It is normaly not necessary to make changes to the // generated code, but the routine can be extended by the user if needed. // Init() will be called many times when running with PROOF. // Set branch addresses if (tree == 0) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("fUniqueID",&fUniqueID); fChain->SetBranchAddress("fBits",&fBits); fChain->SetBranchAddress("fDate.fDatime",&fDate_fDatime); fChain->SetBranchAddress("fServer",&fServer); fChain->SetBranchAddress("fUser",&fUser); fChain->SetBranchAddress("fFileName",&fFileName); fChain->SetBranchAddress("fMover",&fMover); fChain->SetBranchAddress("fFileSize",&fFileSize); fChain->SetBranchAddress("fFileNumber",&fFileNumber); fChain->SetBranchAddress("fQWaitTime",&fQWaitTime); fChain->SetBranchAddress("fTransferTime",&fTransferTime); fChain->SetBranchAddress("fSeekTime",&fSeekTime); fChain->SetBranchAddress("fTimeToNow",&fTimeToNow); fChain->SetBranchAddress("fRc",&fRc); fChain->SetBranchAddress("fRW",&fRW); fChain->SetBranchAddress("fTapeLabel",&fTapeLabel); fChain->SetBranchAddress("fDiskRate",&fDiskRate); fChain->SetBranchAddress("fDriveRate",&fDriveRate); fChain->SetBranchAddress("fNetworkRate",&fNetworkRate); fChain->SetBranchAddress("fTransferRate",&fTransferRate); fChain->SetBranchAddress("fOverallRate",&fOverallRate); Notify(); } Bool_t encp::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. Typically here the branch pointers // will be retrieved. It is normaly not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. // Get branch pointers b_encp_fUniqueID = fChain->GetBranch("fUniqueID"); b_encp_fBits = fChain->GetBranch("fBits"); b_encp_fDate_fDatime = fChain->GetBranch("fDate.fDatime"); b_encp_fServer = fChain->GetBranch("fServer"); b_encp_fUser = fChain->GetBranch("fUser"); b_encp_fFileName = fChain->GetBranch("fFileName"); b_encp_fMover = fChain->GetBranch("fMover"); b_encp_fFileSize = fChain->GetBranch("fFileSize"); b_encp_fFileNumber = fChain->GetBranch("fFileNumber"); b_encp_fQWaitTime = fChain->GetBranch("fQWaitTime"); b_encp_fTransferTime = fChain->GetBranch("fTransferTime"); b_encp_fSeekTime = fChain->GetBranch("fSeekTime"); b_encp_fTimeToNow = fChain->GetBranch("fTimeToNow"); b_encp_fRc = fChain->GetBranch("fRc"); b_encp_fRW = fChain->GetBranch("fRW"); b_encp_fTapeLabel = fChain->GetBranch("fTapeLabel"); b_encp_fDiskRate = fChain->GetBranch("fDiskRate"); b_encp_fDriveRate = fChain->GetBranch("fDriveRate"); b_encp_fNetworkRate = fChain->GetBranch("fNetworkRate"); b_encp_fTransferRate = fChain->GetBranch("fTransferRate"); b_encp_fOverallRate = fChain->GetBranch("fOverallRate"); return kTRUE; } void encp::Show(Int_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t encp::Cut(Int_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; }