예제 #1
0
bool CSVContainer::disconnect(StdString const &oFilename)
{
    UNUSED(oFilename);

    CSV &csv = getCSV();
    csv.close();
    return true;
}
예제 #2
0
void drawInput0826(){
  TFile* f = TFile::Open("signal-600to4500.root");
  c1 = new TCanvas("c1","",1360,768);
  gStyle->SetOptStat(0000000000);
  drawBase(f,1,"signal 600-4500GeV");
  f->Close();
  
  string  masspoint[13]={"600","800","1000","1200","1400","1600","1800","2000","2500","3000","3500","4000","4500"};
  for (int massP=0;massP<13;massP++){
   TFile* f = TFile::Open(Form("signal-%s.root",masspoint[massP].data()));
   drawBase(f,3,Form("signal %sGeV",masspoint[massP].data()));
   if(massP==0)drawPt2to1(f,1,Form("signal %sGeV",masspoint[massP].data()));
   else drawPt2to1(f,3,Form("signal %sGeV",masspoint[massP].data()));
   f->Close();
  }
  f = TFile::Open("DY.root");
  drawBase(f,2,"DY");
  drawPt2to1(f,3,"DY");
  drawPt2to1(f,3,"DY",1);
  drawPt2to1(f,2,"DY",2);
  
  
  TH1F * fatCSV[14], * sub1CSV [14], *sub2CSV[14];
  for (int massP=0;massP<13;massP++){
   //TFile* f = TFile::Open(Form("signal-%s.root",masspoint[massP].data()));
   //drawBase(f,3,Form("signal %sGeV",masspoint[massP].data()));
   //f->Close();
   fatCSV[massP]=getCSV(Form("signal-%s.root",masspoint[massP].data()),"fatCSV");
   sub1CSV[massP]=getCSV(Form("signal-%s.root",masspoint[massP].data()),"sub1CSV");
   sub2CSV[massP]=getCSV(Form("signal-%s.root",masspoint[massP].data()),"sub2CSV");
  }
  
  fatCSV[13]=getCSV("DY.root","fatCSV");
  sub1CSV[13]=getCSV("DY.root","sub1CSV");
  sub2CSV[13]=getCSV("DY.root","sub2CSV");
  
  c1->cd(0);
  c1->SetGrid();
  TH1F* TH1[5];
  TH1[0]=fatCSV[13];
  for(int i=0;i<5;i++)TH1[i+1]=fatCSV[i];
  drawB(TH1,"DY","600","800","1000","1200","fatCSV",1,"CSV");
  drawEE(TH1,"600","800","1000","1200","fatCSV ROC",3);
  
  TH1[1]=fatCSV[5];
  TH1[2]=fatCSV[7];
  TH1[3]=fatCSV[9];
  TH1[4]=fatCSV[12];
  
  drawB(TH1,"DY","1600","2000","3000","4500","fatCSV",3,"CSV");
  drawEE(TH1,"1600","2000","3000","4500","fatCSV ROC",3);
  
  
  //TH1F* test =drawE("signal-600.root","DY.root");
  //test->Draw();
  
  
  drawEE("600","800","1000","1200","subCSV ROC",3);
  drawEE("1600","2000","3000","4500","subCSV ROC",2);
}
예제 #3
0
bool CSVContainer::connect(StdString const &oFilename)
{
    StdString fn = oFilename;
    if(fn.length() == 0)
        fn = getConnectString();

    if(fn.length() == 0)
        return false;

    bool rc = super::connect(fn);
    if(rc == false)
        return false;

    Progress prg("Open CSV", "Opening File");
    setRownum(0);
    CSV &csv = getCSV();
    if(fn.length() > 0)
    {
        CSV::ErrorCode rc;
        disconnect();

        csv.setFilename(fn);
        CSV::Openmode md = getOpenmode();
        if((rc = csv.open(md)) != CSV::ErrorCode::CSV_OK)
        {
            ErrorMessage(spt::logging::LoggingItem::LOG_ERROR, "CSV", "Unable to open "+fn);
            csv.setFilename("");
            return false;
        }
    }
    else
        return false;

    csv.rewind();

    return true;
}
예제 #4
0
파일: Songs.cpp 프로젝트: wyattjoh/Berkley
void Songs::setData(std::string *dataInput)
{
		
	dataString = dataInput->substr(0,dataInput->length());
		
	std::string substring;
		
	substring = getParent(dataInput);
	stripString(&substring, "[],");
	
	// std::cout << "OUTPUT>"<< dataString << std::endl;
	
	std::istringstream s(substring);
		
	s >> data.id;
	
	substring = getParent(dataInput);
	stripString(&substring, "[]");
	
	data.Title = substring;
	
	substring = getParent(dataInput);
	stripString(&substring, "[]");
		
	data.Artists = substring;
	// data.Artists.append("\0");
		
	substring = getParent(dataInput);
	
	// std::cout << substring << std::endl;
	
	stripString(&substring, "[]");
	
	// std::cout << substring << std::endl;
		
	int i;
		
	std::string subSubString;
	std::string token;
	
	data.rCount = 0;
	
	for(i = 0; ((int)substring.find("("))  != -1; i++)
	{
		// std::cout << "INPUT>" << substring << std::endl;
		
		subSubString = getChild(&substring);
		
		// std::cout << "OUTPUT>"<< subSubString << std::endl;
		// std::cout << "STRLEN>" << substring.size() << std::endl;
		// std::cout << "MASTER>" << substring << std::endl;
		
		stripString(&subSubString, "()");
		
		// std::cout << "SEARCH>" << (((int)substring.find("("))  == -1) << std::endl;
		
		// std::cout << "CLEANED>" << subSubString << std::endl;
		
		//std::cout << std::count(substring.begin(), substring.end(), ')') << std::endl;
		
		//std::cout << substring << std::endl;
		
		// std::cout << subSubString << std::endl;
			
		token = getCSV(&subSubString);
		
		// std::cout << "TOKEN1>" << token << std::endl;
		// std::cout << "OUTPUT>"<< subSubString << std::endl;
		
		data.ratings[i].User = token;
		
		token = getCSV(&subSubString);
		
		// std::cout << "TOKEN2>" << token << std::endl;
		// std::cout << "OUTPUT>"<< subSubString << std::endl;
		
		std::istringstream r(token);
		
		// std::cout << "INT>" << integer << std::endl;
		
		r >> data.ratings[i].rating;
		
		data.rCount++;
	}
}
예제 #5
0
void CSVContainer::end(void)
{
    CSV &csv = getCSV();
    csv.close();
    super::end();
}
예제 #6
0
bool CSVContainer::begin(void)
{
    CSV &csv = getCSV();
    csv.rewind();
    return super::begin();
}
예제 #7
0
CSVContainer::~CSVContainer(void)
{
    getCSV().close();
}