Esempio n. 1
0
//Read a line and fill parameter
void ExperimentalPoint::ReadLineAndTreat(int MagnetQuadrant, TString Grid, int Location, int Level, double Bx, double By, double Bz){

	fMagnetQuadrant = MagnetQuadrant ; 
	fLocation = Location ; 
	fLevel = Level; 
  	fGrid = Grid ;
    TString key = Grid + Form("%d%d",MagnetQuadrant,Level);
    CheckList(Grid, MagnetQuadrant, Level); 
	if(fSetBackground) SubtractBackground(Grid, Location, Bx,By,Bz);
    CalculateCentralPosition() ; 

//Correct for probe rotation
    if (Grid=="B" && Location>=4 && Location<=7) {
	    // when the probe is tilted in the B grid, the sensorX receives most of the magnetic field in contrast to sensorY
	    // to keep things in order, the sensorX value could be split into (x-component an y-component) 
	    fBField.SetXYZ(Bx/10.,0,-Bz/10.); //ignore By, it will be filled by rotation
	    fBField.RotateZ(-45*TMath::DegToRad());
	    TVector3 SensorOffsetX = fSensorOffsetX; // copy the offset and rotate 45 degrees
	    SensorOffsetX.RotateZ(-45*TMath::DegToRad());
	    fSensorPositionX = fPosition + SensorOffsetX; 
	    fSensorPositionY = fPosition + SensorOffsetX; // yes it is X!
	    fSensorPositionZ = fPosition + fSensorOffsetZ;
    }
    else if (Grid=="D" && Location>=5 && Location<=7) {
			// when the probe is tilted in the D grid, the sensorY receives most of the magnetic field in contrast to sensorX
			// again, the sensorY value could be split into (x-component an y-component) 
			fBField.SetXYZ(0.,-By/10.,-Bz/10.); //ignore Bx, it will be filled by rotation
			fBField.RotateZ(-45*TMath::DegToRad());
			TVector3 SensorOffsetY = fSensorOffsetY; // copy the offset and rotate 45 degrees
			SensorOffsetY.RotateZ(-45*TMath::DegToRad());
			fSensorPositionX = fPosition + SensorOffsetY; 
			fSensorPositionY = fPosition + SensorOffsetY; // yes it is Y!
			fSensorPositionZ = fPosition + fSensorOffsetZ;
		}
		else {
			fBField.SetXYZ(Bx/10.,-By/10.,-Bz/10.); // turn to millitesla, By need to be multiplied by (-) to account for the axis change between simulation/experiment and the way the mapper is set
			fSensorPositionX = fPosition + fSensorOffsetX; 
			fSensorPositionY = fPosition + fSensorOffsetY; 
			fSensorPositionZ = fPosition + fSensorOffsetZ; 
		}

    //correct for Lens rotations 
    double angle = CalculateRotationAngle(MagnetQuadrant, Grid);
    fPosition.RotateZ(angle*TMath::DegToRad()); 
    fSensorPositionX.RotateZ(angle*TMath::DegToRad()); 
    fSensorPositionY.RotateZ(angle*TMath::DegToRad()); 
    fSensorPositionZ.RotateZ(angle*TMath::DegToRad()); 
	fBField.RotateZ(angle*TMath::DegToRad()); 
    //ShowParameters();
	//cin.get(); 
}