void setup_bind_pose_legs(float x=0,float y=0)
{
	vec3f a1( -1.023, 6.671, -0.051 );
	vec3f a2;
	vec3f a3(-0.787, 5.088, -0.081 );
	
	vec3f e1( 0.778, 6.701, 0.073);
	vec3f e2;
	vec3f e3( 0.855, 5.043, 0.272);

	vec3f b1( 0.049, 8.069+0.5, -0.172 );
	vec3f b2;
	vec3f b3( 0.137, 6.245, -0.393 );

	a2 = (a1+a3)*0.5;
	b2 = (b1+b3)*0.5;
	e2 = (e1+e3)*0.5;

	a3.x+=x/2;
	a3.z+=y;

	b3.z+=y;
	b3.x+=x*2;

	e3.x+=x/2;
	e3.z-=y;

	a3 = a2 + vec3f::normalize(a3-a2) * (a2-a1).length();
	b3 = b2 + vec3f::normalize(b3-b2) * (b2-b1).length();
	e3 = e2 + vec3f::normalize(e3-e2) * (e2-e1).length();

	spline_body.set ( b1,b2,b3,0,x*2);
	spline_arm.set  ( a1,a2,a3,0,x,spline_body.spline_xform);
	spline_elbow.set( e1,e2,e3,0,x,spline_body.spline_xform);
}
void setup_bind_pose_female(float x=0,float y=0)
{
	vec3f a1( -0.25, 6.625, -1.671-0.3 );
	vec3f a2;
	vec3f a3( -0.25, 6.625, -2.864-0.6);
	
	vec3f e1( -0.25, 6.625, -2.864-0.6);
	vec3f e2;
	vec3f e3( -0.25, 6.625, -8.562);

	vec3f b1( -0.25, 5.625, 0.09 );
	vec3f b2;
	vec3f b3( -0.25, 1.398, 0.09);

	a2 = (a1+a3)*0.5;
	b2 = (b1+b3)*0.5;
	e2 = (e1+e3)*0.5;

	//x=y=0;

	a3.y+=y*2;
	a3.x+=-0.01;
	e3.x+=-0.01;
	if(x<0)a3.x+=-x;
	if(x<0)e3.x+=-x;
	if(y<0)
	{
		e3.y+=-y*4;
		e3.z+=abs(y*4);
	}
	b1.x+=0.01;//-y*3;
	//b1.x+=y;
/*
	b3.z+=y;
	b3.x+=x*2;

	e3.x+=x/2;
	e3.z-=y;
*/
	a3 = a2 + vec3f::normalize(a3-a2) * (a2-a1).length();
	b1 = b2 + vec3f::normalize(b1-b2) * (b2-b3).length();
	e3 = e2 + vec3f::normalize(e3-e2) * (e2-e1).length();

	spline_body.set ( b3,b2,b1,0,x);
	spline_arm.set  ( a1,a2,a3,0,0,spline_body.spline_xform);
	spline_elbow.set( e1,e2,e3,0,0,spline_body.spline_xform*spline_arm.spline_xform);
}
Пример #3
0
int main(int argc, char **argv)
{
	using Calibration::HistogramF;
	using Calibration::VarProcessor;

	ROOT::Cintex::Cintex::Enable();

	if (argc != 3) {
		std::cerr << "Syntax: " << argv[0] << " <MVA File> "
		          << "<output ROOT file>" << std::endl;
		return 1;
	}

	Calibration::MVAComputer *calib =
		MVAComputer::readCalibration(argv[1]);
	if (!calib)
		return 1;

	std::map<std::string, HistogramF*> histos;

	std::vector<VarProcessor*> procs = calib->getProcessors();
	for(unsigned int z = 0; z < procs.size(); ++z) {
		VarProcessor *proc = procs[z];
		if (!proc)
			continue;

		std::ostringstream ss3;
		ss3 << (z + 1);

		Calibration::ProcLikelihood *lkh =
			dynamic_cast<Calibration::ProcLikelihood*>(proc);
		Calibration::ProcNormalize *norm =
			dynamic_cast<Calibration::ProcNormalize*>(proc);

		if (lkh) {
			for(unsigned int i = 0; i < lkh->pdfs.size(); i++) {
				std::ostringstream ss2;
				ss2 << (i + 1);
				histos["proc" + ss3.str() + "_sig" + ss2.str()] = &lkh->pdfs[i].signal;
				histos["proc" + ss3.str() + "_bkg" + ss2.str()] = &lkh->pdfs[i].background;
			}
		} else if (norm) {
			for(unsigned int i = 0; i < norm->distr.size(); i++) {
				std::ostringstream ss2;
				ss2 << (i + 1);
				histos["proc" + ss3.str() + "_norm" + ss2.str()] = &norm->distr[i];
			}
		}
	}

	TFile *f = TFile::Open(argv[2], "RECREATE");
	if (!f)
		return 2;

	for(std::map<std::string, HistogramF*>::const_iterator iter = histos.begin();
	    iter != histos.end(); ++iter) {
		std::string name = iter->first;
		HistogramF *histo = iter->second;

		unsigned int size = histo->values().size() - 2;
		std::vector<double> values(
				histo->values().begin() + 1,
				histo->values().end() - 1);
		Spline spline;
		spline.set(values.size(), &values.front());

		double min = histo->range().min;
		double max = histo->range().max;

		TH1F *h = new TH1F((name + "_histo").c_str(), (name + "_histo").c_str(),
		                   size, min - 0.5 * (max - min) / size,
		                   max + 0.5 * (max - min) / size);
		TH1F *s = new TH1F((name + "_spline").c_str(), (name + "_spline").c_str(),
		                   size * precision, min, max);

		for(unsigned int i = 0; i < size; i++) {
			h->SetBinContent(i + 1, histo->values()[i + 1]);
			for(int j = 0; j < precision; j++) {
				unsigned int k = i * precision + j;
				double x = (k + 0.5) / (size * precision);
				double v = spline.eval(x);
				s->SetBinContent(k, v);
			}
		}
	}

	f->Write();
	delete f;

	return 0;
}
void setup_bind_pose_female_legs(float x=0,float y=0)
{
	//y=y-0.5;

	vec3f a1( -0.019, 2.694, -1.179 );
	vec3f a2;
	vec3f a3( -0.019, -0.299, -1.179);
	
	vec3f e1( -0.019, -0.299, -1.179);
	vec3f e2;
	vec3f e3( -0.019, -5.028, -1.340);

	vec3f b1( -0.019, 5.336, 0.042);
	vec3f b2;
	vec3f b3( -0.019, 2.009, 0.042);

	a2 = (a1+a3)*0.5;
	b2 = (b1+b3)*0.5;
	e2 = (e1+e3)*0.5;

	x+=0.01;
	y+=0.01;
	//x=y=0.01;

	if(x<0)		a3.z+=x;
	a3.y+=-0.01;
	a3.x+=-0.01;
	e3.y+=-0.01;

	a3.x+=-(y);
	if(y<0)a3.y+=abs((y)/2);

	e3.x+=-abs(y);
	e3.y+=abs(y);

	b3.x+=-y;
	b3.z+=-x;
	b3.x+=0.01;

	if(y<0)
	{
	//	e3.y+=-y*4;
		//e3.z+=abs(y*4);
	}
	//b1.x+=0.01;//-y*3;
	//b1.x+=y;
/*
	b3.z+=y;
	b3.x+=x*2;

	e3.x+=x/2;
	e3.z-=y;
*/
	a3 = a2 + vec3f::normalize(a3-a2) * (a2-a1).length();
	b3 = b2 + vec3f::normalize(b3-b2) * (b2-b1).length();
	e3 = e2 + vec3f::normalize(e3-e2) * (e2-e1).length();

	spline_body.set ( b1,b2,b3,0,-x/2);
	spline_arm.set  ( a1,a2,a3,0,0,spline_body.spline_xform);
	spline_elbow.set( e1,e2,e3,0,0,spline_body.spline_xform*spline_arm.spline_xform);
}