//Anatael Cabrera - Oxford University - 2nd/10/2003 - version 0.1
{
  gSystem->Load("libCaryatid.so");

  //Message Service threshold:
  JobC j;
  j.Msg.SetLevel("CaryatidAna", "Info");
  j.Msg.SetLevel("Caryatid", "Warning");

  CaryatidAna* myPedAna = CaryatidAna::InstantiateMe();
  
  //File input:
  myPedAna->gFileName = "./CaryatidTree_36538.root";

  //Plot them all:
  myPedAna->gPlotEachPage = false; //Plot each page in the directory "CaryatidAna/CaryatidPlots<RunNumber>/"
  
  //Truncation options:
  myPedAna->gTruncType   = 2; //1=(based on raw sigma) & 2=(studied fixed values)
  myPedAna->gTruncLimit  = 5; //Truncation level (for method 1 only)
  myPedAna->gSparsFactor = 5; //Number of sigmas for sparcification threshold
  
  //Outputs Caryatid sparcification and sedestal tables in files::
  myPedAna->gOutputPedestalTable = true;
  myPedAna->gOutputSparsTable    = true;
  myPedAna->gDebugTable = false;   //Flag each line of the files with the FEE position
  
  
  //Comparison with DAQ Tables & set tolerance thresholds:
  myPedAna->gComparePedTable  = false; //Compare Caryatid values to DAQ Pedestal Table
  myPedAna->gCompareSparTable = true; //Compare Caryatid values to DAQ Sparsification Table 
  myPedAna->gTolerancePedTable  = 1;   //Report cases with a discrepancy larger than  "gTolerancePedTable"
  myPedAna->gToleranceSparTable = 10;  //Report cases with a discrepancy larger than  "gTolerancePedTable"
  
  //Pedestal data is labeled as RawVaDigit::EVaErrorCode.kNonStdData. 
  //  Assert flags to ensure that the above is checked for.
  myPedAna->gCheckError2 = true; 
  
  //Look at the structure of the outliers in the pedestals spectra:
  myPedAna->gDoOutliersAnalysis = false;
  
  //Get plots:
  myPedAna->gPlots      = true;
  myPedAna->gQuickPlots = true;

  //Execute function to get Caryatid analysis:
  myPedAna->DoOnlineAnalysis(gFileName);
  //myPedAna->DoOfflineAnalysis();

}
