Index: trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1418)
+++ trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1419)
@@ -21,7 +21,7 @@
 //
 // $RCSfile: camera.cxx,v $
-// $Revision: 1.39 $
+// $Revision: 1.40 $
 // $Author: blanch $ 
-// $Date: 2002-04-27 10:48:39 $
+// $Date: 2002-07-16 16:15:22 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -367,6 +367,8 @@
 
 extern char FileName[];
-
-
+// switch on  starfield rotation
+static int Starfield_rotate = TRUE;
+static float zenith = 0.0;//zenith angle for starfield rotation
+static float azimutal = 90.0;//azimuth angle for starfield rotation
 //=-----------------------------------------------------------
 // @subsection Main program.
@@ -622,5 +624,16 @@
   
   Select_Energy = get_select_energy( &Select_Energy_le, &Select_Energy_ue);
-  
+ 
+  //parameters for starfield rotation
+    get_teles_axis(&zenith, &azimutal); 
+    Starfield_rotate = get_starfield_rotate();
+    log(SIGNATURE,
+   	"%s:\n\t%20s:  %s\n\t%20s: %f\n\t%20s: %f \n",
+    	"Starfield Rotate",
+        "Rotate Starfield",  ONoff(Starfield_rotate), 
+    	"Zenith Angle",zenith,
+    	"Azimutal Angle",azimutal
+    	  );
+ 
   // log filenames information
 
@@ -1323,6 +1336,6 @@
 			  &ncph,    // will be changed by the function!
 			  &arrtmin_ns, // will be changed by the function!
-			  &arrtmax_ns // will be changed by the function!
-			  );
+			  &arrtmax_ns, // will be changed by the function!
+			  -1 ); // photons from the shower
 
 	if( k != 0 ){ // non-zero returnvalue means error
@@ -2913,6 +2926,7 @@
 		  int *incph,    // total number of cph read
 		  float *tmin_ns,   // minimum arrival time of all phes
-		  float *tmax_ns    // maximum arrival time of all phes
-		  ){
+		  float *tmax_ns,    // maximum arrival time of all phes
+		  int star          // star=0 starfield rotation star=-1 not rotation
+                   ){
 
   static int i, k, ipixnum;
@@ -2922,5 +2936,6 @@
   static char flag[SIZE_OF_FLAGS + 1];
   static float radius;
-
+  static float SFR  , C3 , C2 , C1; 
+  const double pi = 3.14159;
 
   // reset variables
@@ -2976,7 +2991,47 @@
     // Pixelization
     //
-	    
-    cx = photon.get_x();
-    cy = photon.get_y(); 
+	
+   // Where the photon provide(0 from starfield, -1 from Mmcs ???
+    
+       if ( star == 0   && Starfield_rotate == TRUE )
+
+       {
+       get_teles_axis(&zenith, &azimutal); 
+	 // Introduction SFR angle
+       
+        zenith = (pi/180) * zenith;
+
+        azimutal =( pi/180) * azimutal;
+
+        C1 = 0.48 * sin(zenith) - 0.87 * cos(zenith) * cos(azimutal);
+   
+        C3 = (0.87 * cos(zenith) - 0.48 * sin(zenith) * cos(azimutal));
+    
+        C2 = sqrt( sin(zenith) * sin(zenith) * sin(azimutal) * sin(azimutal) + C3 * C3 );
+
+        SFR = acos( C1/C2 );
+
+     if ( sin(azimutal) < 0)
+            {
+               SFR = 2 * pi - SFR;
+	    }   
+	 else
+	    {
+	       SFR = SFR;
+	    }
+   
+//final of introduction SFR angle//
+
+       cx = photon.get_x() * cos(SFR) - photon.get_y() * sin(SFR);
+       cy = photon.get_y() * cos(SFR) + photon.get_x() * sin(SFR); 
+
+              }
+        else
+     { 
+         cx = photon.get_x();
+         cy = photon.get_y(); 
+
+     }
+ 
   
     // get wavelength
@@ -3185,5 +3240,6 @@
 			      &incph,
 			      &tmin_ns,
-			      &tmax_ns );
+			      &tmax_ns,
+                              0 ); // photons from starfield
 
 	    if( k != 0 ){ // non-zero returnvalue means error
@@ -3353,4 +3409,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.39  2002/04/27 10:48:39  blanch
+// Some unused varibles have been removed.
+//
 // Revision 1.38  2002/03/18 18:44:29  blanch
 // Small modificatin to set the electronic Noise in the MMcTrigHeader class.
@@ -3469,4 +3528,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.39  2002/04/27 10:48:39  blanch
+// Some unused varibles have been removed.
+//
 // Revision 1.38  2002/03/18 18:44:29  blanch
 // Small modificatin to set the electronic Noise in the MMcTrigHeader class.
