Index: /trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 885)
+++ /trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx	(revision 886)
@@ -21,7 +21,7 @@
 //
 // $RCSfile: camera.cxx,v $
-// $Revision: 1.25 $
+// $Revision: 1.26 $
 // $Author: blanch $ 
-// $Date: 2001-05-08 08:07:54 $
+// $Date: 2001-07-19 09:29:53 $
 //
 ////////////////////////////////////////////////////////////////////////
@@ -231,4 +231,7 @@
 static int Trigger_Loop = FALSE;
 
+//@: flag: TRUE: Different threshold for each pixel ; FALSE: same threshold for all pixels
+static int Individual_Thres_Pixel = FALSE;
+
 //@: Properties of the trigger
 static float Trigger_gate_length = 6.0;
@@ -242,5 +245,5 @@
 
 //@: Trigger conditions for a single trigger mode
-static float Trigger_threshold = 7.0;
+static float qThreshold[TRIGGER_PIXELS];  
 static int Trigger_multiplicity = 4;
 static int Trigger_topology = 2;
@@ -386,6 +389,4 @@
   //@'
 
-  int ioscar=0;
-
   char inname[256];           //@< input file name
   char starfieldname[256];    //@< starfield input file name
@@ -455,8 +456,7 @@
   };                          
 
-  float qThreshold;           //@< Threshold value
   float qTailCut;             //@< Tail Cut value
   int nIslandsCut;            //@< Islands Cut value
-  int countIslands;           //@< Will we count the islands?
+  int countIslands=FALSE;           //@< Will we count the islands?
   int anaPixels;
     
@@ -471,5 +471,5 @@
   UShort_t numPix;            //@< number of sets of fadc written counts
 
-  float fpixelthres[TRIGGER_PIXELS];
+  float fpixelthres[TRIGGER_PIXELS];         //@< Threshold values
 
   TArrayC *fadcValues;  //@< the analog Fadc siganl for pixels
@@ -568,4 +568,6 @@
   Trigger_Scan = get_Trigger_Scan();
 
+  Individual_Thres_Pixel = get_indi_thres_pixel();
+
   get_FADC_properties( &FADC_response_ampl, &FADC_response_fwhm);
 
@@ -579,7 +581,9 @@
 
   if (!Trigger_Loop){
-    get_Trigger_Single (&Trigger_threshold, &Trigger_multiplicity, &Trigger_topology);
+    get_Trigger_Single (qThreshold, &Trigger_multiplicity, &Trigger_topology);
     icontrigger=1;
   }
+  else
+    get_threshold(qThreshold);
 
   // get filenames
@@ -595,5 +599,4 @@
   // get different parameters of the simulation
 
-  qThreshold = get_threshold();
   qTailCut = get_tail_cut();
   simulateNSB = get_nsb( &meanNSB, &nphe2NSB );
@@ -628,13 +631,20 @@
 	rootname_loop);
   }
-  else{
+  else if (Individual_Thres_Pixel == FALSE){
     log(SIGNATURE,
    	"%s:\n\t%20s: %f\n\t%20s: %i\n\t%20s: %i\n",
     	"Single Trigger mode",
-    	"Threshold",Trigger_threshold,
+    	"Threshold",qThreshold[0],
     	"Multiplicity",Trigger_multiplicity,
     	"Topology",Trigger_topology);
   }   
- 
+  else{
+    log(SIGNATURE,
+   	"%s:\n\t%20s: %s\n\t%20s: %i\n\t%20s: %i\n",
+    	"Single Trigger mode",
+    	"Threshold","Different for each pixel",
+     	"Multiplicity",Trigger_multiplicity,
+    	"Topology",Trigger_topology);
+  }
   // log flags information
 
@@ -659,10 +669,8 @@
   
   log(SIGNATURE,
-      "%s:\n\t%20s: %f\n\t%20s: %f\n\t%20s: %f %s\n\t%20s: %f %s\n",
+      "%s:\n\t%20s: %f\n\t%20s: %f %s\n",
       "Parameters",
-      "q0 (Threshold)", qThreshold,
       "t0 (Tail-cut)", qTailCut,
-      "NSB (phes/pixel)", meanNSB, ONoff(simulateNSB),
-      "i0 (Islands-cut)", nIslandsCut, ONoff(countIslands));
+      "NSB (phes/pixel)", meanNSB, ONoff(simulateNSB));
   
   // log selections
@@ -886,8 +894,5 @@
     HeaderTrig[0]->SetTopology((Short_t) Trigger_topology);
     HeaderTrig[0]->SetMultiplicity((Short_t) Trigger_multiplicity);
-    for(i=0;i<TRIGGER_PIXELS;i++){
-      fpixelthres[i]=(Float_t)Trigger_threshold;
-    }
-    HeaderTrig[0]->SetThreshold( fpixelthres);
+    HeaderTrig[0]->SetThreshold(qThreshold);
     HeaderTrig[0]->SetAmplitud(Trigger_response_ampl);
     HeaderTrig[0]->SetFwhm(Trigger_response_fwhm);
@@ -902,6 +907,8 @@
 	  HeaderTrig[iconcount]->SetTopology((Short_t) itopocount+Trigger_loop_ltop);
 	  HeaderTrig[iconcount]->SetMultiplicity((Short_t) imulticount+Trigger_loop_lmult);
-	  for(i=0;i<TRIGGER_PIXELS;i++){
-	    fpixelthres[i]=(Float_t)(ithrescount+Trigger_loop_lthres);
+	  for(int i=0;i<TRIGGER_PIXELS;i++){
+	    fpixelthres[i]=
+	      ((Float_t)(ithrescount+Trigger_loop_lthres)>=qThreshold[i])?
+	      (Float_t)(ithrescount+Trigger_loop_lthres):qThreshold[i];
 	  }
 	  HeaderTrig[iconcount]->SetThreshold( fpixelthres);
@@ -1359,5 +1366,7 @@
 	  for (int iconcount=0,ithrescount=Trigger_loop_lthres;ithrescount<=Trigger_loop_uthres;ithrescount++){
 	    for (i=0;i<TRIGGER_PIXELS;i++)
-	      fpixelthres[i]=(float) ithrescount;
+	      fpixelthres[i]=
+		((Float_t)(ithrescount)>=qThreshold[i])?
+		(Float_t)(ithrescount):qThreshold[i];
 	    Trigger.SetThreshold(fpixelthres);
 
@@ -1496,6 +1505,6 @@
 	  Trigger.SetMultiplicity(Trigger_multiplicity);
 	  Trigger.SetTopology(Trigger_topology);
-	  for (i=0;i<TRIGGER_PIXELS;i++)
-	    fpixelthres[i]=Trigger_threshold;
+	  for (int i=0;i<TRIGGER_PIXELS;i++)
+	    fpixelthres[i]=qThreshold[i];
 	  Trigger.SetThreshold(fpixelthres);
 				 
@@ -3238,4 +3247,11 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.25  2001/05/08 08:07:54  blanch
+// New numbering for branches from different trigger conditions has been
+// implemented. Now, they are calles: ClassName;1., ClasNema;2., ...
+// The MontaCarlo Headers (MMcTrigHeader and MMcFadcHeader) have been move to
+// the RunHeaders tree. Also the MRawRunHeader is thera with some of its
+// information already filled.
+//
 // Revision 1.24  2001/04/06 16:48:09  magicsol
 // New camera version able to read the new format of the reflector output:
@@ -3294,4 +3310,11 @@
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.25  2001/05/08 08:07:54  blanch
+// New numbering for branches from different trigger conditions has been
+// implemented. Now, they are calles: ClassName;1., ClasNema;2., ...
+// The MontaCarlo Headers (MMcTrigHeader and MMcFadcHeader) have been move to
+// the RunHeaders tree. Also the MRawRunHeader is thera with some of its
+// information already filled.
+//
 // Revision 1.24  2001/04/06 16:48:09  magicsol
 // New camera version able to read the new format of the reflector output:
