예제 #1
0
float Event::RsrMax(int iMax, Tau *t) {
    if (t == NULL) return -1;
    bool direct= t->IsTau(); // otherwise I suppose inviso
    float dphietmisstau = TMath::Pi() - fabs(GetMet().DeltaPhi( t ) );
    float rsrmax = -1;
    if (direct){
        for(int i=0 ; i< iMax; ++i)
        {
            if( GetJet(i) == NULL ) break;
            float dphietmissjet= TMath::Pi() - fabs( GetMet().DeltaPhi( GetJet(i) ) ) ;
            float myrsr = sqrt(dphietmisstau*dphietmisstau + dphietmissjet*dphietmissjet) ;

            // CHECKME, is this correct ? min ? 
            if (rsrmax<0 or myrsr<rsrmax) rsrmax = myrsr;
        }
    }else{
        for(int i=0 ; i< iMax; ++i)
        {
            if( GetJetInvIso(i) == NULL ) break;
            float dphietmissjet= TMath::Pi() - fabs( GetMet().DeltaPhi( GetJetInvIso(i) ) ) ;
            float myrsr = sqrt(dphietmisstau*dphietmisstau + dphietmissjet*dphietmissjet) ;

            // CHECKME, is this correct ? min ? 
            if (rsrmax<0 or myrsr<rsrmax) rsrmax = myrsr;
        }
    }

    return rsrmax;
}
예제 #2
0
float Event::RCollMin(int iMax,Tau *t) {
    // notice the Pi-...
    if (t == NULL) return -1;
    bool direct= t->IsTau(); // otherwise I suppose inviso
    float dphietmisstau = fabs(GetMet().DeltaPhi( t ) );
    float rcollmin = -1;
    if (direct)
    {
        for(int i=0 ; i< iMax; ++i)
        {
            if( GetJet(i) == NULL ) break;
            float dphietmissjet= TMath::Pi() - fabs( GetMet().DeltaPhi( GetJet(i) ) ) ;
            float myrcoll = sqrt(dphietmisstau*dphietmisstau + dphietmissjet*dphietmissjet) ;

            if (rcollmin<0 or myrcoll<rcollmin) rcollmin = myrcoll;
        }
    }else{
        for(int i=0 ; i< iMax; ++i)
        {
            if( GetJetInvIso(i) == NULL ) break;
            float dphietmissjet= TMath::Pi() - fabs( GetMet().DeltaPhi( GetJetInvIso(i) ) ) ;
            float myrcoll = sqrt(dphietmisstau*dphietmisstau + dphietmissjet*dphietmissjet) ;

            if (rcollmin<0 or myrcoll<rcollmin) rcollmin = myrcoll;
        }
    }

    return rcollmin;
}
예제 #3
0
CColor CVX_Sim::GetCurBondColor(int BondIndex)
{
	switch (BondArray[BondIndex].GetBondType()){
		case B_LINEAR:
			switch (CurViewCol) {
				case RVC_TYPE:
					if (BondArray[BondIndex].IsSmallAngle()) return CColor(0.3, 0.7, 0.3, 1.0);
					else return CColor(0.0, 0.0, 0.0, 1.0);
					break;
				case RVC_KINETIC_EN:
					if (SS.MaxVoxKinE == 0) return GetJet(0);
					return GetJet(BondArray[BondIndex].GetMaxVoxKinE() / SS.MaxVoxKinE);
					break;
				case RVC_DISP:
					if (SS.MaxVoxDisp == 0) return GetJet(0);
					return GetJet(BondArray[BondIndex].GetMaxVoxDisp() / SS.MaxVoxDisp);
					break;
				case RVC_STATE:
					if (BondArray[BondIndex].IsBroken()) return CColor(1.0f, 0.0f, 0.0f, 1.0f);
					else if (BondArray[BondIndex].IsYielded()) return CColor(1.0f, 1.0f, 0.0f, 1.0f);
					else return CColor(1.0f, 1.0f, 1.0f, 1.0f);
					break;
				case RVC_STRAIN_EN:
					if (SS.MaxBondStrainE == 0) return GetJet(0);
					return GetJet(BondArray[BondIndex].GetStrainEnergy() / SS.MaxBondStrainE);
					break;
				case RVC_STRAIN:
					if (SS.MaxBondStrain == 0) return GetJet(0);
					return GetJet(BondArray[BondIndex].GetEngStrain() / SS.MaxBondStrain);
					break;
				case RVC_STRESS:
					if (SS.MaxBondStress == 0) return GetJet(0);
					return GetJet(BondArray[BondIndex].GetEngStress() / SS.MaxBondStress);
					break;
	
				default:
					return CColor(0.0f,0.0f,0.0f,1.0f);
					break;
			}
			break;
		case B_LINEAR_CONTACT: {
			if (!SelfColEnabled) return CColor(0.0, 0.0, 0.0, 0.0); //Hide me
			vfloat Force = BondArray[BondIndex].GetForce1().Length(); //check which force to use!
			if (Force == 0.0) return CColor(0.3, 0.3,1.0, 1.0);
			else return CColor(1.0, 0.0, 0.0, 1.0);
			}
		break;

		case B_INPUT_LINEAR_NOROT:
			if (!Dragging) return CColor(0.0, 0.0, 0.0, 0.0); //Hide me
			return CColor(1.0, 0.0, 0.0, 1.0);
		break;
		default:
			return CColor(0.0, 0.0, 0.0, 0.0); //Hide me
			break;

	}
}
예제 #4
0
CColor CVX_Sim::GetCurVoxColor(int SIndex, int Selected)
{
	if (StoXIndexMap[SIndex] == Selected) return CColor(1.0f, 0.0f, 1.0f, 1.0f); //highlight selected voxel (takes precedence...)

	switch (CurViewCol) {
		case RVC_TYPE:
			float R, G, B, A;
			LocalVXC.GetLeafMat(VoxArray[SIndex].GetVxcIndex())->GetColorf(&R, &G, &B, &A);
			return CColor(R, G, B, A);
			break;
		case RVC_KINETIC_EN:
			if (SS.MaxVoxKinE == 0) return GetJet(0);
			return GetJet(VoxArray[SIndex].GetCurKineticE() / SS.MaxVoxKinE);
			break;
		case RVC_DISP:
			if (SS.MaxVoxDisp == 0) return GetJet(0);
			return GetJet(VoxArray[SIndex].GetCurAbsDisp() / SS.MaxVoxDisp);
			break;
		case RVC_STATE:
			if (VoxArray[SIndex].GetBroken()) return CColor(1.0f, 0.0f, 0.0f, 1.0f);
			else if (VoxArray[SIndex].GetYielded()) return CColor(1.0f, 1.0f, 0.0f, 1.0f);
			else return CColor(1.0f, 1.0f, 1.0f, 1.0f);
			break;
		case RVC_STRAIN_EN:
			if (SS.MaxBondStrainE == 0) return GetJet(0);
			return GetJet(VoxArray[SIndex].GetMaxBondStrainE() / SS.MaxBondStrainE);
			break;
		case RVC_STRAIN:
			if (SS.MaxBondStrain == 0) return GetJet(0);
			return GetJet(VoxArray[SIndex].GetMaxBondStrain() / SS.MaxBondStrain);
			break;
		case RVC_STRESS:
			if (SS.MaxBondStress == 0) return GetJet(0);
			return GetJet(VoxArray[SIndex].GetMaxBondStress() / SS.MaxBondStress);
			break;

	
		default:
			return CColor(1.0f,1.0f,1.0f, 1.0f);
			break;
	}
}
예제 #5
0
void QVX_Sim::DrawOverlay(void)
{
	if (CurViewCol == RVC_KINETIC_EN || CurViewCol == RVC_DISP || CurViewCol == RVC_STRAIN_EN || CurViewCol == RVC_STRAIN || CurViewCol == RVC_STRESS){
		CColor Tmp;
		int XOff = 10;
		int YOff = 10;
		int XWidth = 30;
		int YHeight = 200;
		int NumChunks = 4;
		int TextXOff = 10;

		glBegin(GL_QUAD_STRIP);
		
		for (int i=0; i<=NumChunks; i++){
			double Perc = ((double)i)/NumChunks;
			Tmp = GetJet(1.0-Perc);
			glColor4f(Tmp.r, Tmp.g, Tmp.b, Tmp.a);

			glVertex2f(XOff,YOff+Perc*YHeight);
			glVertex2f(XOff+XWidth,YOff+Perc*YHeight);

		}
		glEnd();

		//draw the labels...
		double MaxVal = 1.0;
		QString Units = "";
		switch(CurViewCol){
			case RVC_KINETIC_EN: MaxVal = SS.MaxVoxKinE*1000; Units = "mJ"; break;
			case RVC_DISP: MaxVal = SS.MaxVoxDisp*1000; Units = "mm"; break;
			case RVC_STRAIN_EN: MaxVal = SS.MaxBondStrainE*1000; Units = "mJ"; break;
			case RVC_STRAIN: MaxVal = SS.MaxBondStrain; break;
			case RVC_STRESS: MaxVal = SS.MaxBondStress/1000000; Units = "MPa"; break;
		}

		glColor4f(0, 0, 0, 1.0);
		QString ScaleNumber;

		for (int i=0; i<=NumChunks; i++){
			double Perc = ((double)i)/NumChunks;
			ScaleNumber = QString::number((1-Perc) * MaxVal, 'g', 3) + Units;
			pGLWin->renderText(XOff + XWidth + TextXOff, YOff + Perc*YHeight+5, ScaleNumber);
		}


		
	}


}
예제 #6
0
CColor CVXS_SimGLView::GetInternalBondColor(CVXS_BondInternal* pBond)
{
	switch (CurViewCol) {
		case RVC_TYPE:
			if (pBond->IsSmallAngle()) return CColor(0.3, 0.7, 0.3, 1.0);
			else return CColor(0.0, 0.0, 0.0, 1.0);
			break;
		case RVC_KINETIC_EN:
			if (pSim->SS.MaxVoxKinE == 0) return GetJet(0);
			return GetJet(pBond->GetMaxVoxKinE() / pSim->SS.MaxVoxKinE);
			break;
		case RVC_DISP:
			if (pSim->SS.MaxVoxDisp == 0) return GetJet(0);
			return GetJet(pBond->GetMaxVoxDisp() / pSim->SS.MaxVoxDisp);
			break;
		case RVC_STATE:
			if (pBond->IsBroken()) return CColor(1.0f, 0.0f, 0.0f, 1.0f);
			else if (pBond->IsYielded()) return CColor(1.0f, 1.0f, 0.0f, 1.0f);
			else return CColor(1.0f, 1.0f, 1.0f, 1.0f);
			break;
		case RVC_STRAIN_EN:
			if (pSim->SS.MaxBondStrainE == 0) return GetJet(0);
			return GetJet(pBond->GetStrainEnergy() / pSim->SS.MaxBondStrainE);
			break;
		case RVC_STRAIN:
			if (pSim->SS.MaxBondStrain == 0) return GetJet(0);
			return GetJet(pBond->GetEngStrain() / pSim->SS.MaxBondStrain);
			break;
		case RVC_STRESS:
			if (pSim->SS.MaxBondStress == 0) return GetJet(0);
			return GetJet(pBond->GetEngStress() / pSim->SS.MaxBondStress);
			break;
		case RVC_PRESSURE:
			return GetJet(0); //for now. Pressure of a bond doesn't really make sense
			break;
		default:
			return CColor(0.0f,0.0f,0.0f,1.0f);
			break;
	}
}
예제 #7
0
CColor CVXS_SimGLView::GetCurVoxColor(int SIndex, int Selected)
{
	if (pSim->StoXIndexMap[SIndex] == Selected) return CColor(1.0f, 0.0f, 1.0f, 1.0f); //highlight selected voxel (takes precedence...)

	switch (CurViewCol) {
		case RVC_TYPE:
			float R, G, B, A;
//			LocalVXC.GetLeafMat(VoxArray[SIndex].GetVxcIndex())->GetColorf(&R, &G, &B, &A);
			pSim->VoxArray[SIndex].GetpMaterial()->GetColorf(&R, &G, &B, &A);
			return CColor(R, G, B, A);
			break;
		case RVC_KINETIC_EN:
			if (pSim->SS.MaxVoxKinE == 0) return GetJet(0);
			return GetJet(pSim->VoxArray[SIndex].GetCurKineticE() / pSim->SS.MaxVoxKinE);
			break;
		case RVC_DISP:
			if (pSim->SS.MaxVoxDisp == 0) return GetJet(0);
			return GetJet(pSim->VoxArray[SIndex].GetCurAbsDisp() / pSim->SS.MaxVoxDisp);
			break;
		case RVC_STATE:
			if (pSim->VoxArray[SIndex].GetBroken()) return CColor(1.0f, 0.0f, 0.0f, 1.0f);
			else if (pSim->VoxArray[SIndex].GetYielded()) return CColor(1.0f, 1.0f, 0.0f, 1.0f);
			else return CColor(1.0f, 1.0f, 1.0f, 1.0f);
			break;
		case RVC_STRAIN_EN:
			if (pSim->SS.MaxBondStrainE == 0) return GetJet(0);
			return GetJet(pSim->VoxArray[SIndex].GetMaxBondStrainE() / pSim->SS.MaxBondStrainE);
			break;
		case RVC_STRAIN:
			if (pSim->SS.MaxBondStrain == 0) return GetJet(0);
			return GetJet(pSim->VoxArray[SIndex].GetMaxBondStrain() / pSim->SS.MaxBondStrain);
			break;
		case RVC_STRESS:
			if (pSim->SS.MaxBondStress == 0) return GetJet(0);
			return GetJet(pSim->VoxArray[SIndex].GetMaxBondStress() / pSim->SS.MaxBondStress);
			break;
		case RVC_PRESSURE:{
			vfloat MaxP = pSim->SS.MaxPressure, MinP = pSim->SS.MinPressure;
			if (MaxP <= MinP) return GetJet(0);

			vfloat Mag = MaxP;
			if (-MinP>Mag) Mag = -MinP;
			//vfloat ThisP = pSim->VoxArray[SIndex].GetPressure();
			return GetJet(0.5-pSim->VoxArray[SIndex].GetPressure()/(2*Mag));
			break;
						  }
		default:
			return CColor(1.0f,1.0f,1.0f, 1.0f);
			break;
	}
}