+
+ printf("New extended edge of %s 01: %.2f, %.2f, %.2f\n",substr,xval[1],yval[1],zval[1]);
+ printf("New extended edge of %s 11: %.2f, %.2f, %.2f\n",substr,xval[3],yval[3],zval[3]);
+
+ //Compute the center of the bottom of the box in x,y,z
+ Double_t realX = activeX;
+ Double_t realY = ((yval[0] + (yval[2] - yval[0])/2.)
+ +(yval[1] + (yval[3] - yval[1])/2.) ) /2.;
+ Double_t realZ = ((zval[0] + (zval[2] - zval[0])/2.)
+ +(zval[1] + (zval[3] - zval[1])/2.) ) /2.;
+
+
+ printf("Bottom Center of SM %s Box: %.2f, %.2f, %.2f\n",substr,realX,realY,realZ);
+
+ //correct the SM centers so that we have the center of the box in
+ //x,y using the phi,theta angles
+ realX += halfHeight*TMath::Cos(TMath::Pi()/2+realphi);
+ realY += halfHeight*(TMath::Sin(TMath::Pi()/2+realphi) + TMath::Sin(realtheta));
+ realZ += halfHeight*TMath::Cos(TMath::Pi()/2-realtheta);
+
+ printf("Rotation angles of SM %s (phi,psi,theta) in degrees: %.4f, %.4f, %.4f\n",substr,realphi*TMath::RadToDeg(),realpsi*TMath::RadToDeg(),realtheta*TMath::RadToDeg());
+ printf("Middle of SM %s: %.2f, %.2f, %.2f\n\n",substr,realX,realY,realZ);
+
+ smc.fX1 = realX;
+ smc.fY1 = realY;
+ smc.fZ1 = realZ;
+
+ smc.fPhi = 90. + realphi*TMath::RadToDeg();
+ smc.fTheta = 0. + realtheta*TMath::RadToDeg();
+ smc.fPsi = 0. + realpsi*TMath::RadToDeg();
+
+ }//loop over supermodules