Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1684)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1685)
@@ -1,3 +1,8 @@
                                                                -*-*- END -*-*-
+ 2002/12/13: Oscar blanch
+
+    * mgeom/MGeomMirror.[h,cc]
+      - function SetMirrorDeviations added
+
  2002/12/09: Robert Wagner
 
Index: trunk/MagicSoft/Mars/mgeom/MGeomMirror.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomMirror.cc	(revision 1684)
+++ trunk/MagicSoft/Mars/mgeom/MGeomMirror.cc	(revision 1685)
@@ -76,6 +76,5 @@
                                    Float_t curv_y, Float_t lin_x, Float_t lin_y,
 				   Float_t lin_z, Float_t theta, Float_t phi,
-				   Float_t x_n, Float_t y_n, Float_t z_n,
-				   Float_t dev_x, Float_t dev_y){
+				   Float_t x_n, Float_t y_n, Float_t z_n){
     fMirrorId=mir;   // the Mirror Id
 
@@ -97,4 +96,7 @@
                      // in the center
                      // Note: fXN^2*fYN^2*fZN^2 = 1
+}
+
+void MGeomMirror::SetMirrorDeviations(Float_t dev_x, Float_t dev_y){
     fDeviationX=dev_x;  // deviation in x [cm]
     fDeviationY=dev_x;  // deviation in y [cm]
@@ -106,2 +108,6 @@
 
 
+
+
+
+
Index: trunk/MagicSoft/Mars/mgeom/MGeomMirror.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomMirror.h	(revision 1684)
+++ trunk/MagicSoft/Mars/mgeom/MGeomMirror.h	(revision 1685)
@@ -39,6 +39,6 @@
                            Float_t curv_y, Float_t lin_x, Float_t lin_y,
                            Float_t lin_z, Float_t theta, Float_t phi,
-                           Float_t x_n, Float_t y_n, Float_t z_n,
-                           Float_t dev_x, Float_t dev_y);
+                           Float_t x_n, Float_t y_n, Float_t z_n);
+    void  SetMirrorDeviations(Float_t dev_x, Float_t dev_y);
 
     ClassDef(MGeomMirror, 1)  // geometry class describing one mirror
Index: trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1684)
+++ trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 1685)
@@ -21,7 +21,7 @@
 //
 // $RCSfile: camera.cxx,v $
-// $Revision: 1.48 $
+// $Revision: 1.49 $
 // $Author: blanch $ 
-// $Date: 2002-12-12 17:40:50 $
+// $Date: 2002-12-13 10:04:07 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -2030,4 +2030,24 @@
 		    0);
 
+  //  Store qe for each PMT in output file
+  TArrayF qe_pmt;
+  TArrayF wav_pmt;
+  McConfigRunHeader->InitSizePMTs(ct_NPixels);
+  for(int i=0; i<ct_NPixels;i++){
+    McConfigRunHeader->AddPMT(i);
+    MGeomPMT &pmt  = McConfigRunHeader->GetPMT(i);
+    qe_pmt.Set(pointsQE,QE[i][1]);
+    wav_pmt.Set(pointsQE,QElambda);
+    pmt.SetArraySize(pointsQE);
+    pmt.SetPMTContent(i,wav_pmt,qe_pmt);
+  }
+
+  // Store Light Guides factors in the output file
+  TArrayF theta_lg;
+  TArrayF factor_lg;
+  theta_lg.Set(pointsWC,WC[0]);
+  factor_lg.Set(pointsWC,WC[1]);
+  McConfigRunHeader->SetLightGuides(theta_lg,factor_lg);
+
   //  Fill the Header Tree with the current leaves of each branch
   HeaderTree.Fill() ;
@@ -2605,5 +2625,5 @@
   
   if ( wcfile.bad() )
-    error( "read_WC", "Cannot open \"%s\". Exiting.\n", QE_FILE );
+    error( "read_WC", "Cannot open \"%s\". Exiting.\n", WC_FILE );
   
   // read file
@@ -2854,8 +2874,14 @@
   Float_t camwidth = -1.0;
 
+  Int_t imir;
+  Float_t f,sx,sy,x,y,z,thetan,phin,xn,yn,zn;
+  Float_t dx,dy;
+  Int_t nummir, numref;
+  Float_t wav,ref;
+
   Char_t token[40];
   Char_t line[511];
   Char_t flag;
-  cout<<"To be implemented..."<<endl;
+
   while(1){
     if((flag=fgetc(sp))==EOF)
@@ -2863,23 +2889,46 @@
     fgets(&line[1],500,sp);
     line[0]=flag;
+    if (line[0]== '#' && line[2]=='n' && line[3]=='u' && line[4]=='m' &&
+	line[5]== 'b' && line[12]=='d' && line[13]=='a' && line[14]=='t'){
+      fgets(line,500,sp);
+      sscanf(line,"%i",&numref);
+      for(int i=0; i<numref;i++){
+	fgets(line,500,sp);
+	sscanf(line,"%f %f",&wav,&ref);
+      }
+      continue;
+    }
     if (line[0]== '#')
       continue;
     if (strstr(line, "type") == line)
       continue;
-    if (strstr(line, "focal_distance") == line)
+    if (strstr(line, "focal_distance") == line){
       sscanf(line,"%s %f",token,&focal);
       continue;
-    if (strstr(line, "focal_std") == line)
+    }
+    if (strstr(line, "focal_std") == line){
+      sscanf(line,"%s %f",token,&stdfocal);
       continue;
-    if (strstr(line, "point_spread") == line)
+    }
+    if (strstr(line, "point_spread") == line){
+      sscanf(line,"%s %f",token,&point);
       continue;
-    if (strstr(line, "point_std") == line)
+    }
+    if (strstr(line, "point_std") == line){
+      sscanf(line,"%s %f",token,&stdpoint);
       continue;
-    if (strstr(line, "adjustment_dev") == line)
+    }
+    if (strstr(line, "adjustment_dev") == line){
+      sscanf(line,"%s %f",token,&adjust);
       continue;
-    if (strstr(line, "black_spot") == line)
+    }
+    if (strstr(line, "black_spot") == line){
+      sscanf(line,"%s %f",token,&spot);
       continue;
-    if (strstr(line, "camera_width") == line)
+    }
+    if (strstr(line, "camera_width") == line){
+      sscanf(line,"%s %f",token,&camwidth);
       continue;
+    }
     if (strstr(line, "n_pixels") == line)
       continue;
@@ -2890,11 +2939,38 @@
     if (strstr(line, "n_gappixels") == line)
       continue;
-    if (strstr(line, "n_mirrors") == line)
+    if (strstr(line, "n_mirrors") == line){
+      sscanf(line,"%s %i",token,&nummir);
+      config->InitSizeMirror(nummir);
       continue;
-    if (strstr(line, "r_mirror") == line)
+    }
+    if (strstr(line, "r_mirror") == line){
+      sscanf(line,"%s %f",token,&radius);
       continue;
-    if (strstr(line, "define_mirrors") == line)
-      break;
-  }
+    }
+    if (strstr(line, "define_mirrors") == line){
+      for(int i=0;i<nummir;i++){
+	fgets(line,500,sp);
+	sscanf(line,"%i %f %f %f %f %f %f %f %f %f %f %f",
+	       &imir,&f,&sx,&sy,&x,&y,&z,&thetan,&phin,&xn,&yn,&zn);
+	config->AddMirror(i);
+	MGeomMirror &mirror = config->GetMirror(i);
+  	mirror.SetMirrorContent(imir,f,sx,sy,x,y,z,thetan,phin,xn,yn,zn);
+      }
+      fgets(line,500,sp);
+      while(line[2]!='w' || line[3]!='i' || line[4]!='t' || line[5]!='h'){
+	fgets(line,500,sp);
+      }
+      fgets(line,500,sp);
+      for(int i=0;i<nummir;i++){
+      fgets(line,500,sp);
+	sscanf(line,"%f %f",&dx,&dy);
+	MGeomMirror &mirror = config->GetMirror(i);
+  	mirror.SetMirrorDeviations(dx,dy);
+      }      
+      continue;
+    }
+  }
+  config->SetMagicDef(radius, focal, stdfocal, point,
+		      stdpoint, adjust, spot, camwidth);
 }
 
@@ -3857,4 +3933,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.48  2002/12/12 17:40:50  blanch
+// *** empty log message ***
+//
 // Revision 1.47  2002/12/10 17:19:31  blanch
 // *** empty log message ***
@@ -4002,4 +4081,7 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.48  2002/12/12 17:40:50  blanch
+// *** empty log message ***
+//
 // Revision 1.47  2002/12/10 17:19:31  blanch
 // *** empty log message ***
