void myD3D11DeviceContext::Draw(UINT  VertexCount, UINT  StartVertexLocation)
{
    if (g_logger->logInterfaceCalls) g_logger->log("Draw");
    if (g_logger->logDrawCalls) g_logger->logDrawFile << "Draw vertexCount=" << VertexCount << ", StartVertexLocation=" << StartVertexLocation << endl;

    base->Draw(VertexCount, StartVertexLocation);

    if (g_logger->capturingFrame)
    {
        g_logger->logFrameCaptureFile << "Draw vertexCount=" << VertexCount << ", StartVertexLocation=" << StartVertexLocation << endl;
        g_logger->recordDrawEvent(*assets, DrawParameters(VertexCount, StartVertexLocation, -1));
    }
}
Ejemplo n.º 2
0
void ExportThread::setup( void )
{
    UserThread::setup();
    m_format = 0;
    m_directory = QString();
    m_exportMode = EXPORT_NONE;
    m_items.clear();
    m_outfits.clear();
    m_effects.clear();
    m_projectiles.clear();
    m_sprites.clear();
    m_pictures.clear();
    m_dParams = DrawParameters();
}
int main(int argc, char * argv[]){

        cout<<"****************************** FILES OPENING ***************************************"<<endl;

        string INPUT(argv[1]);
        string OUTPUT(argv[2]);

        FileSaver finalHistos;
        FileSaver Plots;

        finalHistos.setName(INPUT.c_str());
        Plots.setName(OUTPUT.c_str());


        bool checkfile = finalHistos.CheckFile();


        cout<<"****************************** BINS ***************************************"<<endl;

        SetBins();

	PRB.Print();

        cout<<"**TOF**"<<endl;
        ToFDB.Print();

        cout<<"**NaF**"<<endl;
        NaFDB.Print();

        cout<<"**Agl**"<<endl;
        AglDB.Print();

        ToFDB.UseBetaEdges();
        NaFDB.UseBetaEdges();
        AglDB.UseBetaEdges();

        PRB.UseREdges();


        cout<<endl;

        cout<<"****************************** PLOTTING FITS ***************************************"<<endl;

	TemplateFIT * ToFfits= new TemplateFIT(finalHistos,"TOFfits",ToFDB);
	TemplateFIT * NaFfits= new TemplateFIT(finalHistos,"NaFfits",NaFDB);
	TemplateFIT * Aglfits= new TemplateFIT(finalHistos,"Aglfits",AglDB);

	DrawFits(ToFfits,finalHistos,Plots);
	DrawFits(NaFfits,finalHistos,Plots);
	DrawFits(Aglfits,finalHistos,Plots);



	cout<<"****************************** RESULTS ***************************************"<<endl;

	TCanvas * c4 = new TCanvas("Deuteron Counts");
	c4->SetCanvasSize(2000,1500);

	std::string pathresTOF   = (ToFfits->GetName() + "/Fit Results/");
	std::string pathresNaF   = (NaFfits->GetName() + "/Fit Results/");
	std::string pathresAgl   = (Aglfits->GetName() + "/Fit Results/");
		
	TH1F * DCountsTOF = (TH1F*) finalHistos.Get((pathresTOF+"Deuteron Counts").c_str());
	TH1F * DCountsNaF = (TH1F*) finalHistos.Get((pathresNaF+"Deuteron Counts").c_str());
	TH1F * DCountsAgl = (TH1F*) finalHistos.Get((pathresAgl+"Deuteron Counts").c_str());
	TH1F * PCountsTOF = (TH1F*) finalHistos.Get((pathresTOF+"Proton Counts").c_str());
	TH1F * PCountsNaF = (TH1F*) finalHistos.Get((pathresNaF+"Proton Counts").c_str());
	TH1F * PCountsAgl = (TH1F*) finalHistos.Get((pathresAgl+"Proton Counts").c_str());
	
	TH1F * DCountsPrimTOF = (TH1F*) finalHistos.Get((pathresTOF+"Primary Deuteron Counts").c_str());
	TH1F * DCountsPrimNaF = (TH1F*) finalHistos.Get((pathresNaF+"Primary Deuteron Counts").c_str());
	TH1F * DCountsPrimAgl = (TH1F*) finalHistos.Get((pathresAgl+"Primary Deuteron Counts").c_str());
	
	PlotTH1FintoGraph(gPad,ToFDB, DCountsTOF,"Kinetic Energy [GeV/nucl.]", "Counts",4,true,"Psame",0.1,10,10,7e4,"Deuteron Counts (TOF)",8);
	PlotTH1FintoGraph(gPad,NaFDB, DCountsNaF,"Kinetic Energy [GeV/nucl.]", "Counts",4,true,"Psame",0.1,10,10,7e4,"Deuteron Counts (NaF)",22);
	PlotTH1FintoGraph(gPad,AglDB, DCountsAgl,"Kinetic Energy [GeV/nucl.]", "Counts",4,true,"Psame",0.1,10,10,7e4,"Deuteron Counts (Agl)",29);

	PlotTH1FintoGraph(gPad,ToFDB, DCountsPrimTOF,"Kinetic Energy [GeV/nucl.]", "Counts",4,true,"Psame",0.1,10,10,7e4,"Primary Counts (TOF)",4);
	PlotTH1FintoGraph(gPad,NaFDB, DCountsPrimNaF,"Kinetic Energy [GeV/nucl.]", "Counts",4,true,"Psame",0.1,10,10,7e4,"Primary Counts (NaF)",26);
	PlotTH1FintoGraph(gPad,AglDB, DCountsPrimAgl,"Kinetic Energy [GeV/nucl.]", "Counts",4,true,"Psame",0.1,10,10,7e4,"Primary Counts (Agl)",30);


	Plots.Add(c4);
	Plots.writeObjsInFolder("Results");


	TCanvas * c5 = new TCanvas("D/P Raw Counts ratio");
        c5->SetCanvasSize(2000,1500);
	
	TH1F * RatioTOF = (TH1F*)DCountsTOF->Clone();
	RatioTOF->Divide(PCountsTOF);
	TH1F * RatioNaF = (TH1F*)DCountsNaF->Clone();
	RatioNaF->Divide(PCountsNaF);
	TH1F * RatioAgl = (TH1F*)DCountsAgl->Clone();
	RatioAgl->Divide(PCountsAgl);

	PlotTH1FintoGraph(gPad,ToFDB, RatioTOF,"Kinetic Energy [GeV/nucl.]", "Counts ratio",2,true,"Psame",0.1,10,1e-3,1e-1,"d/P Counts ratio (TOF)",8);
	PlotTH1FintoGraph(gPad,NaFDB, RatioNaF,"Kinetic Energy [GeV/nucl.]", "Counts ratio",2,true,"Psame",0.1,10,1e-3,1e-1,"d/P Counts ratio (NaF)",22);
	PlotTH1FintoGraph(gPad,AglDB, RatioAgl,"Kinetic Energy [GeV/nucl.]", "Counts ratio",2,true,"Psame",0.1,10,1e-3,1e-1,"d/P Counts ratio (Agl)",29);


	Plots.Add(c5);
	Plots.writeObjsInFolder("Results");

	
	TCanvas * c6 = new TCanvas("Uncertainty Break-down");
        c6->SetCanvasSize(5000,1000);
	c6->Divide(3,1);

	TH1F * StatErrTOF = (TH1F*) finalHistos.Get((pathresTOF+"StatError").c_str());
        TH1F * SystErrTOF = (TH1F*) finalHistos.Get((pathresTOF+"SystError").c_str());
	TH1F * HeCoErrTOF = (TH1F*) finalHistos.Get((pathresTOF+"HeContTOF_Eff").c_str());
	TH1F * StatErrNaF = (TH1F*) finalHistos.Get((pathresNaF+"StatError").c_str());
        TH1F * SystErrNaF = (TH1F*) finalHistos.Get((pathresNaF+"SystError").c_str());
	TH1F * HeCoErrNaF = (TH1F*) finalHistos.Get((pathresNaF+"HeContNaF_Eff").c_str());
	TH1F * StatErrAgl = (TH1F*) finalHistos.Get((pathresAgl+"StatError").c_str());
        TH1F * SystErrAgl = (TH1F*) finalHistos.Get((pathresAgl+"SystError").c_str());
	TH1F * HeCoErrAgl = (TH1F*) finalHistos.Get((pathresAgl+"HeContAgl_Eff").c_str());
	
	TH1F * TotErrTOF  = (TH1F *)StatErrTOF->Clone();
	TH1F * TotErrNaF  = (TH1F *)StatErrNaF->Clone();
	TH1F * TotErrAgl  = (TH1F *)StatErrAgl->Clone();
	
	for(int bin=0;bin<DCountsTOF->GetNbinsX();bin++) {
		if(DCountsTOF->GetBinContent(bin+1)>0){
			TotErrTOF->SetBinContent(bin+1,DCountsTOF->GetBinError(bin+1)/DCountsTOF->GetBinContent(bin+1));
			TotErrTOF->SetBinError(bin+1,0);
		}
		if(DCountsNaF->GetBinContent(bin+1)>0){	
			TotErrNaF->SetBinContent(bin+1,DCountsNaF->GetBinError(bin+1)/DCountsNaF->GetBinContent(bin+1));
			TotErrNaF->SetBinError(bin+1,0);
		}
		if(DCountsAgl->GetBinContent(bin+1)>0){	
			TotErrAgl->SetBinContent(bin+1,DCountsAgl->GetBinError(bin+1)/DCountsAgl->GetBinContent(bin+1));
			TotErrAgl->SetBinError(bin+1,0);
		}	

	}	


	c6->cd(1);
	PlotDistribution(gPad,TotErrTOF ,"TOF Range Bin","Relative error",2,"same",1e-4,1.1,10,"T. Fit Total Error");
	PlotDistribution(gPad,SystErrTOF,"TOF Range Bin","Relative error",4,"same",1e-4,1.1,4,"T. Fit Systematic Error");
	PlotDistribution(gPad,StatErrTOF,"TOF Range Bin","Relative error",1,"same",1e-4,1.1,4,"T. Fit Statistical Error");
	PlotDistribution(gPad,HeCoErrTOF,"TOF Range Bin","Relative error",3,"same",1e-4,1.1,4,"Helium Fragm. Error");
	c6->cd(2);
	PlotDistribution(gPad,TotErrNaF ,"NaF Range Bin","Relative error",2,"same",1e-4,1.1,10,"T. Fit Total Error");
	PlotDistribution(gPad,SystErrNaF,"NaF Range Bin","Relative error",4,"same",1e-4,1.1,4,"T. Fit Systematic Error");
	PlotDistribution(gPad,StatErrNaF,"NaF Range Bin","Relative error",1,"same",1e-4,1.1,4,"T. Fit Statistical Error");
	PlotDistribution(gPad,HeCoErrNaF,"NaF Range Bin","Relative error",3,"same",1e-4,1.1,4,"Helium Fragm. Error");
	c6->cd(3);
	PlotDistribution(gPad,TotErrAgl ,"Agl Range Bin","Relative error",2,"same",1e-4,1.1,10,"T. Fit Total Error");
	PlotDistribution(gPad,SystErrAgl,"Agl Range Bin","Relative error",4,"same",1e-4,1.1,4,"T. Fit Systematic Error");
	PlotDistribution(gPad,StatErrAgl,"Agl Range Bin","Relative error",1,"same",1e-4,1.1,4,"T. Fit Statistical Error");
	PlotDistribution(gPad,HeCoErrAgl,"Agl Range Bin","Relative error",3,"same",1e-4,1.1,4,"Helium Fragm. Error");

	Plots.Add(c6);
	Plots.writeObjsInFolder("Results");


	
	
	TCanvas * c7 = new TCanvas("Chi Square");
        c7->SetCanvasSize(5000,1000);
	c7->Divide(3,1);

	TH1F * BestChiSquareTOF         = (TH1F*) finalHistos.Get((pathresTOF+"Best ChiSquare").c_str());
        TH1F * OriginalChiSquareTOF     = (TH1F*) finalHistos.Get((pathresTOF+"Original ChiSquare").c_str());
        TH1F * BestChiSquareNaF         = (TH1F*) finalHistos.Get((pathresNaF+"Best ChiSquare").c_str());
        TH1F * OriginalChiSquareNaF     = (TH1F*) finalHistos.Get((pathresNaF+"Original ChiSquare").c_str());
        TH1F * BestChiSquareAgl         = (TH1F*) finalHistos.Get((pathresAgl+"Best ChiSquare").c_str());
        TH1F * OriginalChiSquareAgl     = (TH1F*) finalHistos.Get((pathresAgl+"Original ChiSquare").c_str());

	c7->cd(1);
	PlotDistribution(gPad,BestChiSquareTOF ,"TOF Range Bin","#chi^2 of T. Fit",2,"Psame",1e-1,30,3,"Best #chi^{2} mod. Template");
	PlotDistribution(gPad,OriginalChiSquareTOF,"TOF Range Bin","#chi^2 of T. Fit",4,"Psame",1e-1,30,3,"Original MC Templates");
	
	c7->cd(2);
	PlotDistribution(gPad,BestChiSquareNaF ,"NaF Range Bin","#chi^2 of T. Fit",2,"Psame",1e-1,35,3,"Best #chi^{2} mod. Template");
	PlotDistribution(gPad,OriginalChiSquareNaF,"NaF Range Bin","#chi^2 of T. Fit",4,"Psame",1e-1,35,3,"Original MC Templates");

	c7->cd(3);
	PlotDistribution(gPad,BestChiSquareAgl ,"Agl Range Bin","#chi^2 of T. Fit",2,"Psame",1e-1,35,3,"Best #chi^{2} mod. Template");
	PlotDistribution(gPad,OriginalChiSquareAgl,"Agl Range Bin","#chi^2 of T. Fit",4,"Psame",1e-1,35,3,"Original MC Templates");
	
	Plots.Add(c7);
	Plots.writeObjsInFolder("Results");



	
	DrawParameters(finalHistos,Plots,pathresTOF,ToFDB,"Parameters TOF","[ps]",0.45,0.9,-100,100,-40,180);
	DrawParameters(finalHistos,Plots,pathresNaF,NaFDB,"Parameters NaF","[rad/10^{4}]",0.7,0.98,-1000,1000,-1000,2000);
	DrawParameters(finalHistos,Plots,pathresAgl,AglDB,"Parameters Agl","[rad/10^{4}]",0.95,1.005,-230,230,-150,400);



	return 0;
}