Index: /BAORadio/AmasNancay/trunk/etude_mergeAna.pic
===================================================================
--- /BAORadio/AmasNancay/trunk/etude_mergeAna.pic	(revision 576)
+++ /BAORadio/AmasNancay/trunk/etude_mergeAna.pic	(revision 577)
@@ -1,13 +1,12 @@
+defscript evolAtCalibFreq
 
-set source  $1
-set ncycles $2
 
-openppf onoffsurvey_${source}-${ncycles}Cycles.ppf
-print onoffevol
+#Follow up of the intensity arround the Calib frequency in different calibration conditions
+# NO calibration
+# Calibration coeff. mean per Run
+# Calibration coeff. per cycles
 
-set defatt "font=helvetica,bold,20 fixedfonsize"
-set axedefatt  "font=helvetica,bold,30 fixedfonsize grid"
-graphicatt "$defatt"
-setaxesatt "$axedefatt"
+set fcalib $1
+
 
 newwin 1 2
@@ -15,5 +14,5 @@
 settitle "Raw ON-OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles " ' ' $defatt
 n/pl onoffevol.onoffRaw1%cycle ! ! "red cpts notit nsta"
-setaxelabels "cycle" "I[1346MHz/6.25MHz] (a.u)" $axedefatt
+setaxelabels "cycle" "I[${fcalib}MHz/6.25MHz] Raw (a.u)" $axedefatt
 
 newwin 1 2
@@ -21,5 +20,5 @@
 settitle "Raw ON-OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles " ' ' $defatt
 n/proj hRaw1 onoffevol.onoffRaw1 ! ! ! "red cpts notit"
-
+settitle "I[${fcalib}MHz/6.25MHz] Raw (a.u)"
 
 
@@ -29,5 +28,6 @@
 settitle "ON-OFF Calib Run ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
 n/pl onoffevol.onoffRun1%cycle ! ! "red cpts notit nsta"
-setaxelabels "cycle" "I[1346MHz/6.25MHz] (a.u)" $axedefatt
+setaxelabels "cycle" "I[${fcalib}MHz/6.25MHz] Run (a.u)" $axedefatt
+
 
 newwin 1 2
@@ -35,4 +35,5 @@
 settitle "ON-OFF Calib Run ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
 n/proj hRun1 onoffevol.onoffRun1 ! ! ! "red cpts notit"
+settitle "I[${fcalib}MHz/6.25MHz] Run (a.u)"
 
 
@@ -41,5 +42,5 @@
 settitle "ON-OFF Calib Cycle ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
 n/pl onoffevol.onoffCycle1%cycle ! ! "red cpts notit nsta"
-setaxelabels "cycle" "I[1346MHz/6.25MHz] (a.u)" $axedefatt
+setaxelabels "cycle" "I[${fcalib}MHz/6.25MHz] Cycle (a.u)" $axedefatt
 
 newwin 1 2
@@ -47,4 +48,80 @@
 settitle "ON-OFF Calib Cycle ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
 n/proj hCycle1 onoffevol.onoffCycle1 ! ! ! "red cpts notit"
+settitle "I[${fcalib}MHz/6.25MHz] Cycle (a.u)"
+
+
+endscript
+###########################################
+defscript evolAt1420Freq
+
+
+#Follow up of the intensity arround the (1420.4 +/- 2) MHz frequency in different calibration conditions
+# NO calibration
+# Calibration coeff. mean per Run
+# Calibration coeff. per cycles
+
+
+graphicatt "xylimits=0,500,-0.01,0.01"
+
+newwin 1 2
+n/pl onoffevol.onoffRaw01420%cycle ! ! "blue cpts notit nsta"
+settitle "Raw ON-OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles " ' ' $defatt
+n/pl onoffevol.onoffRaw11420%cycle ! ! "red cpts notit nsta"
+setaxelabels "cycle" "I[1420.4MHz +/- 2MHz] Raw (a.u)" $axedefatt
+
+
+newwin 1 2
+n/pl onoffevol.onoffRun01420%cycle ! ! "blue cpts notit nsta"
+settitle "ON-OFF Calib Run ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
+n/pl onoffevol.onoffRun11420%cycle ! ! "red cpts notit nsta"
+setaxelabels "cycle" "I[1420.4MHz +/- 2MHz] Run (a.u)" $axedefatt
+
+
+newwin 1 2
+n/pl onoffevol.onoffCycle01420%cycle ! ! "blue cpts notit nsta"
+settitle "ON-OFF Calib Cycle ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
+n/pl onoffevol.onoffCycle11420%cycle ! ! "red cpts notit nsta"
+setaxelabels "cycle" "I[1420.4MHz +/- 2MHz] Cycle (a.u)" $axedefatt
+
+
+newh1d hSigmaRaw0 -0.02 0.02 50
+newh1d hSigmaRaw1 -0.02 0.02 50
+newh1d hSigmaRun0 -0.02 0.02 50
+newh1d hSigmaRun1 -0.02 0.02 50
+newh1d hSigmaCycl0 -0.02 0.02 50
+newh1d hSigmaCycl1 -0.02 0.02 50
+
+graphicatt ""
+
+newwin 1 1
+n/proj hSigmaRaw0 onoffevol.onoffRaw01420 ! ! ! "blue cpts notit"
+n/proj hSigmaRaw1 onoffevol.onoffRaw11420 ! ! ! "same red cpts notit"
+settitle "Raw ON-OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles " ' ' $defatt
+setaxelabels "(a.u)" "I[1420.4MHz +/- 2MHz] Raw" $axedefatt
+
+newwin 1 1
+n/proj hSigmaRun0 onoffevol.onoffRun01420 ! ! ! "blue cpts notit"
+n/proj hSigmaRun1 onoffevol.onoffRun11420 ! ! ! "same red cpts notit"
+settitle "ON-OFF Calib Run ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
+setaxelabels "(a.u)" "I[1420.4MHz +/- 2MHz] Run" $axedefatt
+
+
+newwin 1 1
+n/proj hSigmaCycl0 onoffevol.onoffCycle01420 ! ! ! "blue cpts notit"
+n/proj hSigmaCycl1 onoffevol.onoffCycle11420 ! ! ! "same red cpts notit"
+settitle "ON-OFF Calib Cycle ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
+setaxelabels "(a.u)" "I[1420.4MHz +/- 2MHz] Cycle" $axedefatt
+
+
+endscript
+##################################################
+defscript diffOnOff
+
+#
+#Display the ON-OFF over the whole freq. range in diffrent Calib. conditions
+# NO calibration
+# Calibration coeff. mean per Run
+# Calibration coeff. per cycles
+#
 
 
@@ -59,6 +136,4 @@
 settitle "Raw ON-OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
 setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
-
-
 
 del sruncal0 sruncal1
@@ -79,2 +154,34 @@
 settitle "ON-OFF Calib Cycle  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
 setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
+
+
+endscript
+
+
+
+
+#Main
+#use minuscule for source label
+
+set source  $1
+set ncycles $2
+set fcalib $3
+
+openppf onoffsurvey_${source}-${ncycles}Cycles.ppf
+print onoffevol
+
+set defatt "font=helvetica,bold,20 fixedfonsize"
+set axedefatt  "font=helvetica,bold,30 fixedfonsize grid"
+
+set defatt ""
+set axedefatt  "grid"
+
+graphicatt ""
+setaxesatt ""
+
+
+
+#diffOnOff
+
+
+evolAt1420Freq
Index: /BAORadio/AmasNancay/trunk/mergeAnaFiles.cc
===================================================================
--- /BAORadio/AmasNancay/trunk/mergeAnaFiles.cc	(revision 576)
+++ /BAORadio/AmasNancay/trunk/mergeAnaFiles.cc	(revision 577)
@@ -38,6 +38,6 @@
 //Usage
 //
-// ./Objs/mergeAnaFiles -act meanCalibBAODiffOnOff -inPath /sps/baoradio/AmasNancay/JEC/ -src Abell85 -ppfFile dataRaw -debug 1 -mxcycles 500
-//
+//./Objs/mergeAnaFiles -act meanCalibBAODiffOnOff -inPath /sps/baoradio/AmasNancay/JEC/ -src Abell85 -ppfFile dataRaw -debug 1 -mxcycles 500
+//./Objs/mergeAnaFiles -src Abell85 -act meanCalibBAODiffOnOff -mxcycles 500 -calibfreq 1410 -inPath /sps/baoradio/AmasNancay/JEC/ -ppfFile dataRaw -debug 1 >& mergeAna-500.log
 //
 //
@@ -267,16 +267,36 @@
   TMatrix<r_4> meanDiffONOFF_perRunCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);      //set to 0
   TMatrix<r_4> meanDiffONOFF_perCycleCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);    //set to 0
-  char* onffTupleName[7]={"cycle",
-			  "onoffRaw0","onoffRaw1",
-			  "onoffRun0","onoffRun1",
-			  "onoffCycle0","onoffCycle1"};
-  NTuple onoffevolution(7,onffTupleName);
-  r_4 xnt[7];
-
-  //Lower and Higher freq. bin to perform mean follow up
-  sa_size_t chLow  = freqToChan(para.rcalibFreq_ - (para.rcalibBandFreq_*0.5));
-  sa_size_t chHigh = freqToChan(para.rcalibFreq_ + (para.rcalibBandFreq_*0.5));
+  static const int NINFO=19;
+  char* onffTupleName[NINFO]={"cycle"
+			  ,"onoffRaw0","onoffRaw1"
+			  ,"onoffRun0","onoffRun1"
+			  ,"onoffCycle0","onoffCycle1"
+			  ,"onoffRaw01420","onoffRaw11420"
+			  ,"onoffRun01420","onoffRun11420"
+			  ,"onoffCycle01420","onoffCycle11420"
+			  ,"onoffRaw01420side","onoffRaw11420side"
+			  ,"onoffRun01420side","onoffRun11420side"
+			  ,"onoffCycle01420side","onoffCycle11420side"
+  };
+  NTuple onoffevolution(NINFO,onffTupleName);
+  r_4 xnt[NINFO];
+
+  //Lower and Higher freq. arround the Calibration Freq. bin to perform mean follow up
+  sa_size_t chCalibLow  = freqToChan(para.rcalibFreq_ - (para.rcalibBandFreq_*0.5));
+  sa_size_t chCalibHigh = freqToChan(para.rcalibFreq_ + (para.rcalibBandFreq_*0.5));
+  //Lower and Higher freq.  just arround 1420.4MHz Freq. bin to perform mean follow up
+  sa_size_t ch1420Low  = freqToChan(1420);
+  sa_size_t ch1420High = freqToChan(1421);
+
+  //Lower and Higher freq. on the sides of 1420.4Mhz Freq. bin to perform mean follow up
+  sa_size_t ch1420aLow  = freqToChan(1418);
+  sa_size_t ch1420aHigh = freqToChan(1419);
+  sa_size_t ch1420bLow  = freqToChan(1422);
+  sa_size_t ch1420bHigh = freqToChan(1423);
+
+
   if (para.debuglev_>90){
-    cout << "freq. band for follow up [" <<  chLow << ", "<< chHigh << "]" << endl;
+    cout << "freq. band for follow up [" <<  chCalibLow << ", "<< chCalibHigh << "]" << endl;
+    cout << "freq. band for follow up [" <<  ch1420Low << ", "<< ch1420High << "]" << endl;
   }
   
@@ -619,20 +639,68 @@
       //Fill NTuple
       xnt[0] = totalNumberCycles;
+ 
+      //Follow up arround the Calibration Freq.
+      TVector<r_4> meanInRange_CalibFreq_noCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_noCalib,chCalibLow,chCalibHigh,meanInRange_CalibFreq_noCalib);
+      xnt[1] = meanInRange_CalibFreq_noCalib(0);
+      xnt[2] = meanInRange_CalibFreq_noCalib(1);
+
+      TVector<r_4> meanInRange_CalibFreq_perRunCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perRunCalib,chCalibLow,chCalibHigh,meanInRange_CalibFreq_perRunCalib);
+      xnt[3] = meanInRange_CalibFreq_perRunCalib(0);
+      xnt[4] = meanInRange_CalibFreq_perRunCalib(1);
+
+      TVector<r_4> meanInRange_CalibFreq_perCycleCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perCycleCalib,chCalibLow,chCalibHigh,meanInRange_CalibFreq_perCycleCalib);
+      xnt[5] = meanInRange_CalibFreq_perCycleCalib(0);
+      xnt[6] = meanInRange_CalibFreq_perCycleCalib(1);
+
+
+      //Follow up arround the 1420.4MHz Freq.
+      TVector<r_4> meanInRange_1420Freq_noCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_noCalib,ch1420Low,ch1420High,meanInRange_1420Freq_noCalib);
+      xnt[7] = meanInRange_1420Freq_noCalib(0);
+      xnt[8] = meanInRange_1420Freq_noCalib(1);
+
+      TVector<r_4> meanInRange_1420Freq_perRunCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perRunCalib,ch1420Low,ch1420High,meanInRange_1420Freq_perRunCalib);
+      xnt[9] = meanInRange_1420Freq_perRunCalib(0);
+      xnt[10] = meanInRange_1420Freq_perRunCalib(1);
+
+      TVector<r_4> meanInRange_1420Freq_perCycleCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perCycleCalib,ch1420Low,ch1420High,meanInRange_1420Freq_perCycleCalib);
+      xnt[11] = meanInRange_1420Freq_perCycleCalib(0);
+      xnt[12] = meanInRange_1420Freq_perCycleCalib(1);
+
+
+      //Follow up below the 1420.4MHz Freq.
+      TVector<r_4> meanInRange_1420aFreq_noCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_noCalib,ch1420aLow,ch1420aHigh,meanInRange_1420aFreq_noCalib);
+      TVector<r_4> meanInRange_1420bFreq_noCalib(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_noCalib,ch1420bLow,ch1420bHigh,meanInRange_1420bFreq_noCalib);
+
+      xnt[13] = (meanInRange_1420aFreq_noCalib(0) + meanInRange_1420bFreq_noCalib(0))/2.;
+      xnt[14] = (meanInRange_1420aFreq_noCalib(1) + meanInRange_1420bFreq_noCalib(1))/2.;
+
+
+      TVector<r_4> meanInRange_1420aFreq_perRun(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perRunCalib,ch1420aLow,ch1420aHigh,meanInRange_1420aFreq_perRun);
+      TVector<r_4> meanInRange_1420bFreq_perRun(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perRunCalib,ch1420bLow,ch1420bHigh,meanInRange_1420bFreq_perRun);
+
+      xnt[15] = (meanInRange_1420aFreq_perRun(0) + meanInRange_1420bFreq_perRun(0))/2.;
+      xnt[16] = (meanInRange_1420aFreq_perRun(1) + meanInRange_1420bFreq_perRun(1))/2.;
+
+
+      TVector<r_4> meanInRange_1420aFreq_perCycle(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perCycleCalib,ch1420aLow,ch1420aHigh,meanInRange_1420aFreq_perCycle);
+      TVector<r_4> meanInRange_1420bFreq_perCycle(NUMBER_OF_CHANNELS);
+      meanInRange(diffOnOff_perCycleCalib,ch1420bLow,ch1420bHigh,meanInRange_1420bFreq_perCycle);
+
+      xnt[17] = (meanInRange_1420aFreq_perCycle(0) + meanInRange_1420bFreq_perCycle(0))/2.;
+      xnt[18] = (meanInRange_1420aFreq_perCycle(1) + meanInRange_1420bFreq_perCycle(1))/2.;
+
       
-      TVector<r_4> meanInRange_noCalib(NUMBER_OF_CHANNELS);
-      meanInRange(diffOnOff_noCalib,chLow,chHigh,meanInRange_noCalib);
-      xnt[1] = meanInRange_noCalib(0);
-      xnt[2] = meanInRange_noCalib(1);
-
-      TVector<r_4> meanInRange_perRunCalib(NUMBER_OF_CHANNELS);
-      meanInRange(diffOnOff_perRunCalib,chLow,chHigh,meanInRange_perRunCalib);
-      xnt[3] = meanInRange_perRunCalib(0);
-      xnt[4] = meanInRange_perRunCalib(1);
-
-      TVector<r_4> meanInRange_perCycleCalib(NUMBER_OF_CHANNELS);
-      meanInRange(diffOnOff_perCycleCalib,chLow,chHigh,meanInRange_perCycleCalib);
-      xnt[5] = meanInRange_perCycleCalib(0);
-      xnt[6] = meanInRange_perCycleCalib(1);
-      
+      //store infos to Ntuple
       onoffevolution.Fill(xnt);
 
@@ -952,5 +1020,6 @@
 	   << " -calibfreq <number> (cf. freq. used by calibration operation)\n"
 	   << " -calibbandfreq <number> (cf. band of freq. used by calibration operation)\n"
-	   << " -src [Abell85]\n -inPath [.]|<top_root_dir of the ppf file>\n" 
+	   << " -src [Abell85]\n" 
+	   << " -inPath [.]|<top_root_dir of the ppf file>\n" 
 	   << " (ex. /sps/baoradio/AmasNancay/JEC/\n " 
 	   << " -outPath [.]|<dir of the output> \n"
