void ClvDataAccessor::writeProjectInfo(QString product){
    QSqlQuery query;
    query.prepare(PROJECT_INSERT_TO_TABLE);
    query.bindValue(BIND_MAJOR_VERSION, AppInfo::MAJOR_VERSION);
    query.bindValue(BIND_MINOR_VERSION, AppInfo::MINOR_VERSION);
    query.bindValue(BIND_PRODUCT, product);
    query.bindValue(BIND_CREATE_DATE, getCurrentDateString());
    query.bindValue(BIND_UPDATE_DATE, getCurrentDateString());
    execSql(query);
}
Exemple #2
0
void ATCLocker_impl::generateEncryptedHeader(stringstream *dst)
{
	string date_string;
	getCurrentDateString(&date_string);

	static const char separator[] = {(char)0xef, (char)0xbb, (char)0xbf};
	string sjis_header = "Passcode:AttacheCase\n\r\nLastDateTime:" + date_string + "\n\r\n";
	string utf8_header = "Passcode:AttacheCase\n\r\nLastDateTime:" + date_string + "\n\r\n";

	int32_t count = 0;
	for (vector<ATCFileEntry>::iterator it = entries_.begin(); it != entries_.end(); ++it)
	{
		sjis_header += "Fn_" + convertToString(count) + ":";
		utf8_header += "U_"  + convertToString(count) + ":";

		sjis_header += it->name_sjis + "\t";
		utf8_header += it->name_utf8 + "\t";

		string common;
		common.reserve(128);

		if (it->size < 0) {
			common += "*\t";
		} else {
			common += convertToString(it->size) + "\t";
			total_length_ += it->size;
		}

		common += convertToString(it->attribute)   + "\t";

		int32_t change_dt, change_tm;
		int32_t create_dt, create_tm;

		// UNIX時間 から TTimeStampへ変換
		unix_to_ttime(it->change_unix_time, &change_dt, &change_tm);
		unix_to_ttime(it->create_unix_time, &create_dt, &create_tm);

		common += convertToString(change_dt) + "\t";
		common += convertToString(change_tm) + "\t";
		common += convertToString(create_dt) + "\t";
		common += convertToString(create_tm);
		common += "\r\n";

		sjis_header += common;
		utf8_header += common;

		count++;
	}

	dst->str(sjis_header + string(separator, sizeof(separator)) + utf8_header);
}
TPaveText* RDK2AnalysisPlotter::makeTitleBox(CoDet detType)
{
    TString line;
    TPaveText* titleBox = new TPaveText(.00,.0,1,1,"NDC");
    titleBox->SetFillColor(kWhite);
    titleBox->SetLineColor(kWhite);
    titleBox->SetTextAlign(11);
    titleBox->SetTextFont(102);

    //Make outline for title
//    TBox* theBox;
//    int numLines=getTitleBoxLines( detType);
//    int numLinesPerExpAnalysis;
//    int numLinesPerMCAnalysis;
//    int currentLine=0;
//    double y0, y1;
//    if(detType!=DET_EP)
//    {
//        numLinesPerExpAnalysis=4;
//        numLinesPerMCAnalysis=3;
//    }
//    else
//    {
//        numLinesPerExpAnalysis=2;
//        numLinesPerMCAnalysis=2;
//    }

//    y0=1.-1/(double)numLines;
//    y1=1;
//    theBox=titleBox->AddBox(0,y0,1.,y1);
//    theBox->SetFillStyle(0);

//    titleBox->AddText("");

    TString coTypeString;
    if(detType==DET_EP)
    {
        coTypeString="EP";
    }
    else if(detType==DET_EPG)
    {
        coTypeString="EPG (BGO)";
    }
    else if(detType==DET_EPBG)
    {
        coTypeString="EPBG (BAPD)";
    }
    double answer,error;
    titleBox->AddText("Title: "+titleString+"  Coincidence: "+coTypeString+"  Date made: "+getCurrentDateString());
    for (int i = 0;i< numExp;i++)
    {
//        y0=y0-numLinesPerExpAnalysis/(double) numLines;
//        y1=y0;
//        theBox=titleBox->AddBox(0,y0,1,y1);
//        theBox->SetFillStyle(0);

        int theColor=colorList[(i+4)%GRAPHICS_NUM_TYPES];
        line="#color["+int2str(theColor)+"]{";
        line+=TString("Exp: ") + exp[i]->GetName()+" \"" + exp[i]->GetTitle() + "\" " + exp[i]->GetPIDString()+" " + exp[i]->GetGroupString();
        line+=TString("  EP Counts: ") + int2str(exp[i]->GetEPCounts());
        line+="}";
    	titleBox->AddText(line);

    	if(detType==DET_EPG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=exp[i]->GetEPGCounts(error);
            line+=TString("     EPG Counts: ") + int2str((int) (answer+0.5))+" #pm " + int2str((int) (error+0.5));
            answer=exp[i]->GetEPGPerEP(error);
            line+=TString("  #frac{EPG}{EP}: ") + d2str(answer,2,2)+" #pm " + d2str(error,1,2) +" (#pm"+d2str(error*100./answer,1,1)+"%)";
            line +="}";
            titleBox->AddText(line);
        }
        else if(detType==DET_EPBG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=exp[i]->GetEPBGCounts(error);
            line+=TString("     EPBG Counts: ") + int2str((int) (answer+0.5))+" #pm " + int2str((int) (error+0.5));
            answer=exp[i]->GetEPBGPerEP(error);
            line+=TString("  #frac{EPBG}{EP}: ") + d2str(answer,2,2)+" #pm " + d2str(error,1,2)+" (#pm"+d2str(error*100./answer,1,1)+"%)";
            line +="}";
            titleBox->AddText(line);
        }
        //Third Line
        if(detType != DET_EP)
        {
            line="#color["+int2str(theColor)+"]{";
            line+="     Prepeak BG Window: ["+d2str(exp[i]->GetWindowVal(detType,0))+","+d2str(exp[i]->GetWindowVal(detType,1))+"]";
            line+=" Peak Window: ["+d2str(exp[i]->GetWindowVal(detType,2))+","+d2str(exp[i]->GetWindowVal(detType,3))+"] ";
            line+=" Postpeak BG Window: ["+d2str(exp[i]->GetWindowVal(detType,4))+","+d2str(exp[i]->GetWindowVal(detType,5))+"] ";
            line +="}";
            titleBox->AddText(line);
        }

        //Fourth Line
        line="#color["+int2str(theColor)+"]{";
        line+="     "+exp[i]->GetCutSet().GetDisplayString( detType);
        line +="}";
        titleBox->AddText(line);


    }

    //Plot MC
    for (int i = 0;i< numMC;i++)
    {
//        y0=y0-numLinesPerMCAnalysis/(double) numLines;
//        y1=y0;
//        theBox=titleBox->AddBox(0,y0,1,y1);
//        theBox->SetFillStyle(0);
//        currentLine+=numLinesPerMCAnalysis;

        int theColor=colorList[(i)%GRAPHICS_NUM_TYPES];
        //First MC Line
        line="#color["+int2str(theColor)+"]{";
        line+=TString("MC: ") + mc[i]->GetName()+" \"" + mc[i]->GetTitle() + "\"";
        line+=" P_{3}"+mc[i]->GetP3ID()(3,3)+" E_{3}"+mc[i]->GetE3ID()(3,3);
        if(detType==DET_EPG || detType==DET_EPBG)
        {
            line+=" P_{4}"+mc[i]->GetP4ID()(3,3)+" E_{4}"+mc[i]->GetE4ID()(3,3)+" G_{4}"+mc[i]->GetG4ID()(3,3);
        }
        answer=mc[i]->GetEPPer3Decay(error);
    	line+=TString("  EP per 3 Decay: ") + d2str(answer,5,1)+" #pm " + d2str(error,5,1);
        line +="}";
    	titleBox->AddText(line);

    	//Second MC Line

    	if(detType==DET_EPG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=mc[i]->GetEPGPer4Decay(error);
            line+=TString("    EPG per 4 Decay: ") + d2str(answer,6,1)+" #pm " + d2str(error,6,1);
            answer=mc[i]->GetEPGPerEP(error);
            line+=TString("  #frac{EPG}{EP}: ") + d2str(answer,3,2)+" #pm " + d2str(error,1,2)+" (#pm"+d2str(error*100./answer,1,1)+"%)";
            if(numExp>0)
            {
                double expAnswer,expError;
                double mcAnswer, mcError;
                expAnswer=exp[0]->GetEPGPerEP(expError); mcAnswer=mc[i]->GetEPGPerEP(mcError);
                answer=(expAnswer/mcAnswer)-1;
                error=getBasicErrorProgation(expAnswer,mcAnswer,expError,mcError,DIVISION);
                line+=TString("  #frac{Exp - MC}{MC}: ") +d2str(answer*100,1,1)+"% #pm " + d2str(error*100,1,1)+"%";
            }
            line +="}";
            titleBox->AddText(line);
        }
        else if(detType==DET_EPBG)
        {
            line="#color["+int2str(theColor)+"]{";
            answer=mc[i]->GetEPBGPer4Decay(error);
            line+=TString("    EPBG per 4 Decay: ") + d2str(answer,6,1)+" #pm " + d2str(error,6,1);
            answer=mc[i]->GetEPBGPerEP(error);
            line+=TString("  #frac{EPBG}{EP}: ") + d2str(answer,3,2)+" #pm " + d2str(error,1,2)+" (#pm"+d2str(error*100./answer,1,1)+"%)";
            if(numExp>0)
            {
                double expAnswer,expError;
                double mcAnswer, mcError;
                expAnswer=exp[0]->GetEPGPerEP(expError); mcAnswer=mc[i]->GetEPGPerEP(mcError);
                answer=(expAnswer/mcAnswer)-1;
                error=getBasicErrorProgation(expAnswer,mcAnswer,expError,mcError,DIVISION);
                line+=TString("  #frac{Exp - MC}{MC}: ") +d2str(answer*100,1,1)+"% #pm " + d2str(error*100,1,1)+"%";
            }
            line +="}";
            titleBox->AddText(line);
        }
        //Third Line
        line="#color["+int2str(theColor)+"]{";
        line+="    "+mc[i]->GetCutSet().GetDisplayString( detType);
        line +="}";
        titleBox->AddText(line);

    }



    return titleBox;
}