#include "Analyzer.h" using namespace std; Analyzer::Analyzer() { hfile = new TFile("Analyzer.root","RECREATE","XXX"); hrating_per_day = new TH1F("rating_per_day","rating_per_day",3000 ,0.5 ,3000.5 ); hrating_per_month = new TH1F("rating_per_month","rating_per_month",100 ,0.5 ,100.5 ); hrating_all = new TH1F("rating_all","rating_all",5 ,.5 ,5.5 ); havg_rating = new TH1F("avg_rating","avg_rating",100, .5 ,100.5 ); havg_rating_d = new TH1F("avg_rating_d","avg_rating_d",100, .5 ,100.5 ); hratings_per_user = new TH1F("ratings_per_user","ratings_per_user",100 ,0. ,10000 ); htest_ratings_per_user = new TH1F("test_ratings_per_user","test_ratings_per_user",20 ,0.5 ,20.5 ); } // h = new TH1F("","", , , ); Analyzer::~Analyzer() { // Save all objects in this file hfile->Write(); } void Analyzer::a1(char* filename) { int count1=0; int count10k=0; int current_user =-1; int r_p_user=0; int r_p_0_user=0; datafile.open(filename); while ( !datafile.eof() ) { datafile.getline( &line[0], 5000000, '\n'); if (datafile.eof()) break; count1++; count10k++; if (count10k>9999){ count10k = 0; cout<Fill(lday); hrating_per_month->Fill(lmonth); hrating_all->Fill(rating); havg_rating->Fill(lmonth, rating); havg_rating_d->Fill(lmonth); if (rating !=0) r_p_user++; if (rating ==0) r_p_0_user++; if (current_user != user){ // new user if (current_user >0){ // not first one hratings_per_user->Fill(r_p_user); htest_ratings_per_user->Fill(r_p_0_user); r_p_user=0; r_p_0_user=0; } current_user = user; } //cout<>ken; } } // ------------------------------------------------------------------------------- void Analyzer::makesmall(char* filename) { int count1=0; int count10k=0; outfile.open("/tmp/user_date10k.txt"); datafile.open(filename); int current_user =-1; int user_cnt=0; int user_cnt10k=0; int output_user=0; while ( !datafile.eof() ) { datafile.getline( &line[0], 5000000, '\n'); strcpy(line1, line); if (datafile.eof()) break; count1++; count10k++; if (count10k>9999){ count10k = 0; cout<9999){ user_cnt10k=0; output_user=1; } } if (output_user) outfile<