# ==========================================================================
#############################################################################
# ==========================================================================
#                              General
# ==========================================================================
#############################################################################
# ==========================================================================

# -------------------------------------------------------------------------
# Use this if you want to setup the logging stream for the jobs
# (overwrites command line options)
# -------------------------------------------------------------------------
#MLog.VerbosityLevel: 2
#MLog.DebugLevel:     1
#MLog.NoColors:       yes

# ==========================================================================
#############################################################################
# ==========================================================================
#                             Calibration
# ==========================================================================
#############################################################################
# ==========================================================================

# -------------------------------------------------------------------------
# Use this if you want to write the MJPedestal output somewhere
# If you don't want it, it is written to the calibration output anyhow.
# -------------------------------------------------------------------------
#MJPedestalC1.PathOut: .
#MJPedestalC2.PathOut: .

# -------------------------------------------------------------------------
# Use this to define where the calibration output is stored. The filename
# is created from the sequence number. If nothing is specified '.' is
# assumed. (overwrites command line options)
# -------------------------------------------------------------------------
#MJCalibration.PathOut: calped

# -------------------------------------------------------------------------
# Use this to define where the program should search for the pedestal
# and calibration files defined in the sequence. To use the local
# directory use '.' If nothing is specified the default path in the
# datacenter is used. (overwrites command line options)
# -------------------------------------------------------------------------
#MJPedestalC1.PathData:   /data/MAGIC/Period016/
#MJPedestalC2.PathData:   /data/MAGIC/Period016/
#MJCalibration.PathData:  /data/MAGIC/Period016/

# -------------------------------------------------------------------------
# Define here which signal extractor you are going to use for the
# whole calibration chain
# -------------------------------------------------------------------------
MJPedestalC1.ExtractSignal: MExtractTimeAndChargeDigitalFilter

# -------------------------------------------------------------------------
# In the case of the Digital filter you have to overwrite the default
# weights file depending on what you are extracting
# -------------------------------------------------------------------------
MJPedetslaC2.ExtractSignal.WeightsFile:      msignal/calibration_weights_UV.dat
MJPedetslaY2.ExtractSignal.WeightsFile:      msignal/calibration_weights_UV.dat
MJCalibration.ExtractSignal.WeightsFile:     msignal/calibration_weights_UV.dat
MJCalibrateSignal.ExtractSignal.WeightsFile: msignal/cosmics_weights.dat


# -------------------------------------------------------------------------
# Configure MJCalibration
# -------------------------------------------------------------------------
# Switch on relative time calibration
#MJCalibration.RelTimeCalibration: Yes
# Switch on intensity calibration
#MJCalibration.IntensityCalibration: Yes
# Set color to be used
#MJCalibration.Color:
# Type of displayed plots
#MJCalibration.Display: Full,DataCheck,Normal
# Used for data-check (eg. raw files are read)
#MJCalibration.Datacheck: No
# Write additinal debug output
#MJCalibration.Debug: No
# Use blind pixel
#MJCalibration.UseBlindPixel: No
# Use pin diode
#MJCalibration.UsePINDiode: No

# -------------------------------------------------------------------------
# You can choose the pedestal extraction algorithm/task. To use
# MPedCalcPedRun use the lines below. Be carefull, a pedestal file
# could be (if no pedestal file available) a data-file, too.
# -------------------------------------------------------------------------
#MJPedestalC1.ExtractPedestal: MPedCalcFromPedRun
#MJPedestalC1.ExtractPedestal.ExtractWinFirst:    0
#MJPedestalC1.ExtractPedestal.ExtractWinSize:     6
#MJPedestalC1.ExtractPedestal.PedestalUpdate:    no
#MJPedestalC1.ExtractPedestal.CheckWinFirst:     0
#MJPedestalC1.ExtractPedestal.CheckWinSize:     29

#MJPedestalC2.ExtractPedestal: MPedCalcFromPedRun
#MJPedestalC2.ExtractPedestal.ExtractWinFirst:    0
#MJPedestalC2.ExtractPedestal.ExtractWinSize:     6
#MJPedestalC2.ExtractPedestal.PedestalUpdate:    no
#MJPedestalC2.ExtractPedestal.CheckWinFirst:     0
#MJPedestalC2.ExtractPedestal.CheckWinSize:     29

# -------------------------------------------------------------------------
# You can choose the pedestal extraction algorithm/task. To use
# MPedCalcFromLoGain use the lines below. Be carefull, a pedestal file
# could be (if no pedestal file available) a data-file, too.
# -------------------------------------------------------------------------
#MJPedestalC1.ExtractPedestal: MPedCalcFromLoGain
#MJPedestalC1.ExtractPedestal.ExtractWinFirst:    0
#MJPedestalC1.ExtractPedestal.ExtractWinSize:     6
#MJPedestalC1.ExtractPedestal.PedestalUpdate:    no
#MJPedestalC1.ExtractPedestal.CheckWinFirst:     0
#MJPedestalC1.ExtractPedestal.CheckWinSize:     29
#MJPedestalC1.ExtractPedestal.MaxHiGainVar:     40

#MJPedestalC2.ExtractPedestal: MPedCalcFromLoGain
#MJPedestalC2.ExtractPedestal.ExtractWinFirst:    0
#MJPedestalC2.ExtractPedestal.ExtractWinSize:     6
#MJPedestalC2.ExtractPedestal.PedestalUpdate:    no
#MJPedestalC2.ExtractPedestal.CheckWinFirst:     0
#MJPedestalC2.ExtractPedestal.CheckWinSize:     29
#MJPedestalC2.ExtractPedestal.MaxHiGainVar:     40

# -------------------------------------------------------------------------
# Configure MJPedestalC1 and MJPedestalC2
# -------------------------------------------------------------------------
# Maximum number of event processed in the loop
#MJPedestalC1.MaxEvents: 1000
#MJPedestalC2.MaxEvents: 1000
# Allow to overwrite existing files with the output file
#MJPedestalC1.AllowOverwrite: No
#MJPedestalC2.AllowOverwrite: No
# Use data runs from the sequence instead of calibration runs
#MJPedestalC1.UseData: No
#MJPedestalC2.UseData: No


# -------------------------------------------------------------------------
# Use this if you want to change the signal extractor for the calibration
# and automatically the data extraction
# -------------------------------------------------------------------------
#MJCalibration.ExtractSignal: MExtractFixedWindow
#MJCalibration.ExtractSignal.HiGainFirst:       3
#MJCalibration.ExtractSignal.HiGainLast:       14
#MJCalibration.ExtractSignal.LoGainFirst:       4
#MJCalibration.ExtractSignal.LoGainLast:       13
#MJCalibration.ExtractSignal.HiGainWindowSize:  6
#MJCalibration.ExtractSignal.LoGainWindowSize:  6
#MJCalibration.ExtractSignal.PeakSearchWindow:  4
#MJCalibration.ExtractSignal.OffsetFromWindow:  1
#MJCalibration.ExtractSignal.LoGainPeakShift:   0

# -------------------------------------------------------------------------
# Use this if you want to change the time extractor for the calibration
# and automatically the data extraction
# -------------------------------------------------------------------------
#MJCalibration.ExtractTime: <dummy>
#MJCalibration.ExtractTime: MExtractTimeFastSpline
#MJCalibration.ExtractTime.HiGainFirst:       0
#MJCalibration.ExtractTime.HiGainLast:        7
#MJCalibration.ExtractTime.LoGainFirst:       3
#MJCalibration.ExtractTime.LoGainLast:        8
#MJCalibration.ExtractTime.WindowSizeHiGain:  6
#MJCalibration.ExtractTime.WindowSizeLoGain:  6
#MJCalibration.ExtractTime.OffsetLoGain:    1.51

# -------------------------------------------------------------------------
# Use this to change the behaviour of the calibration
# -------------------------------------------------------------------------
#MJCalibration.MCalibrationChargeCalc.ChargeLimit:        2.5
#MJCalibration.MCalibrationChargeCalc.ChargeErrLimit:     0
#MJCalibration.MCalibrationChargeCalc.ChargeRelErrLimit:  1
#MJCalibration.MCalibrationChargeCalc.Debug:              no

#MJCalibration.MCalibrationChargeCalc.FFactorErrLimit:    4.5
#MJCalibration.MCalibrationChargeCalc.LambdaErrLimit:     0.2
#MJCalibration.MCalibrationChargeCalc.LambdaCheckLimit:   0.5
#MJCalibration.MCalibrationChargeCalc.PheErrLimit:        3.5

# -------------------------------------------------------------------------
# Use this to change the behaviour of the calibration
# -------------------------------------------------------------------------
#MJCalibration.MHCalibrationChargeCam.Debug:        no


 
# ==========================================================================
#############################################################################
# ==========================================================================
#                            Signal extraction
# ==========================================================================
#############################################################################
# ==========================================================================

# -------------------------------------------------------------------------
# Use a OutputPath if you want to write the results to a file
# -------------------------------------------------------------------------
#MJCalibrateSignal.PathOut:  .
#MJPedestalY1.PathOut:        .
#MJPedestalY2.PathOut:        .
#MJPedestalY1.PathData:      /data/MAGIC/Period016/
#MJPedestalY2.PathData:      /data/MAGIC/Period016/
#MJCalibrateSignal.PathData: /data/MAGIC/Period016/
#MJCalibrateSignal.PathIn:   .

# -------------------------------------------------------------------------
# If you want to change the behaviour of the pedestal extraction...
# -------------------------------------------------------------------------
#MJPedestalY1.UseData: Yes
#MJPedestalY2.UseData: Yes
MJPedestalY1.MaxEvents: 500
MJPedestalY2.MaxEvents: 500

#MJPedestalY.ExtractPedestal: MPedCalcFromLoGain
#MJPedestalY.ExtractPedestal.PedestalUpdate:   no

# -------------------------------------------------------------------------
# Setup pedestal extractor for running through data
# -------------------------------------------------------------------------
#MJCalibrateSignal.MPedCalcMeanFromLoGain.PedestalUpdate:   yes
#MJCalibrateSignal.MPedCalcMeanFromLoGain.NumEventsDump:   1500
#MJCalibrateSignal.MPedCalcMeanFromLoGain.ExtractWinFirst:  15
#MJCalibrateSignal.MPedCalcMeanFromLoGain.ExtractWinSize:    6
#MJCalibrateSignal.MPedCalcMeanFromLoGain.CheckWinFirst:     0
#MJCalibrateSignal.MPedCalcMeanFromLoGain.CheckWinSize:     29
#MJCalibrateSignal.MPedCalcMeanFromLoGain.MaxHiGainVar:     40

#MJCalibrateSignal.MPedCalcRmsFromLoGain.PedestalUpdate:   yes
#MJCalibrateSignal.MPedCalcRmsFromLoGain.NumEventsDump:   1500
#MJCalibrateSignal.MPedCalcRmsFromLoGain.ExtractWinFirst:  15
#MJCalibrateSignal.MPedCalcRmsFromLoGain.ExtractWinSize:    6
#MJCalibrateSignal.MPedCalcRmsFromLoGain.CheckWinFirst:     0
#MJCalibrateSignal.MPedCalcRmsFromLoGain.CheckWinSize:     29
#MJCalibrateSignal.MPedCalcRmsFromLoGain.MaxHiGainVar:     40

# -------------------------------------------------------------------------
# Setup calibration of data
# -------------------------------------------------------------------------
#MJCalibrateSignal.MCalibrateData.PedestalFlag: Event
#MJCalibrateSignal.MCalibrateData.CalibrationMode: Default

# -------------------------------------------------------------------------
# Setup level for determining of bad pixels
# -------------------------------------------------------------------------
#MJCalibrateSignal.MBadPixelsCalc.PedestalLevel:      3.0
#MJCalibrateSignal.MBadPixelsTreat.NumMinNeighbors:    2
#MJCalibrateSignal.MBadPixelsTreat.UseInterpolation:   yes
#MJCalibrateSignal.MBadPixelsTreat.ProcessPedestalEvt: yes
#MJCalibrateSignal.MBadPixelsTreat.ProcessPedestalRun: no
#MJCalibrateSignal.MBadPixelsTreat.ProcessTimes:       yes
#MJCalibrateSignal.MBadPixelsTreat.UseCentralPixel:    no
#MJCalibrateSignal.MBadPixelsTreat.HardTreatment:      no
