/////////////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////////// #include "TFile.h" #include "TTree.h" #include "TBranch.h" #include "OfflineMon/TTapeQueue.hh" ClassImp(TTapeQueue) //_____________________________________________________________________________ TTapeQueue::TTapeQueue() { } //_____________________________________________________________________________ int TTapeQueue::UpdateNtuple() { TFile* ntuple_file = new TFile(fNtupleFileName.Data(),"recreate"); TTree* tree = new TTree("tape_queue","FCDFSGI2 Tape Queue Monitor"); TBranch* br = tree->Branch("TapeQueue","TTapeQueue", &fData); fData = new TTapeQueue::Data_t(); //----------------------------------------------------------------------------- // read the data file and fill the ntuple //----------------------------------------------------------------------------- FILE* f = fopen(fInputDirName.Data(),"r"); char c[200], cdate[50]; // char day_of_the_week[20], month[20]; // char zone[10]; char month1[20]; int day1, hour1, min1; int n = 200; time_t now; tm* x; while (fgets(c,n,f) > 0) { if (c[0] != '#') { memset(cdate,0,50); sscanf(c,"%i %28c %i %s %i %i:%i", &now, cdate, &fData->fNJobs, month1, &day1, &hour1,&min1); x = localtime(&now); fData->fCalendarTime = (Int_t) now; fData->fYear = x->tm_year; fData->fMonth = x->tm_mon; fData->fDay = x->tm_mday; fData->fHours = x->tm_hour; fData->fMinutes = x->tm_min; fData->fSeconds = x->tm_sec; tree->Fill(); } } ntuple_file->Write(); delete ntuple_file; return 0; }