/* ======================================================================== *\
!
! *
! * This file is part of MARS, the MAGIC Analysis and Reconstruction
! * Software. It is distributed to you in the hope that it can be a useful
! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
! * It is distributed WITHOUT ANY WARRANTY.
! *
! * Permission to use, copy, modify and distribute this software and its
! * documentation for any purpose is hereby granted without fee,
! * provided that the above copyright notice appear in all copies and
! * that both that copyright notice and this permission notice appear
! * in supporting documentation. It is provided "as is" without express
! * or implied warranty.
! *
!
!
!   Author(s): Markus Gaug, 2/2005 <mailto:markus@ifae.es>
!
!   Copyright: MAGIC Software Development, 2000-2005
!
!
\* ======================================================================== */

/////////////////////////////////////////////////////////////////////////////
//
//  MJCalib
//
// A base class for the calibration jobs
//
/////////////////////////////////////////////////////////////////////////////
#include "MJCalib.h"

ClassImp(MJCalib);

using namespace std;

const Int_t MJCalib::fgCheckedPixId = 100;
// --------------------------------------------------------------------------
//
// Default constructor. 
//
// Sets:
// - fDataFlag     to kIsUseRootData
// - fRuns         to NULL
// - fCheckedPixId to fgCheckedPixId
// - fPixelCheck   to kFALSE
//
MJCalib::MJCalib() : fDataFlag(kIsUseRootData), fPixelCheck(kFALSE), fRuns(NULL)
{
  SetCheckedPixId();
}

Bool_t MJCalib::CheckEnvLocal()
{

    if (HasEnv("PixelCheck"))
      SetPixelCheck();

    if (HasEnv("CheckedPixId"))
      SetCheckedPixId(GetEnv("CheckedPixId",fCheckedPixId));

    if (!HasEnv("DataType"))
        return kTRUE;

    TString dat = GetEnv("DataType", "");
    dat = dat.Strip(TString::kBoth);
    dat.ToLower();

    if (dat == (TString)"raw")
        SetUseRawData();

    if (dat == (TString)"mc" || dat == (TString)"montecarlo")
        SetUseMC();

    if (dat == (TString)"root")
        SetUseRootData();

    return kTRUE;
}
