Newer
Older
TestStandRepository / Software / LaserDelayScan / LaserDelayScan.C
@Federica Lionetto Federica Lionetto on 19 Nov 2014 2 KB Added other scripts
//************************************************
// Author: Federica Lionetto
// Created on: 19/11/2014
//************************************************

/*
LaserDelayScan reads a text file (containing the laser delay in ns and the average ADC signal in ADC counts) and creates a ROOT file with the following information:
- average ADC signal as a function of the laser delay, fit with a Gaussian function.

Compile with:

make

Run with:

./LaserDelayScan [input text file] [additional folder]

where

- [input text file] is the complete path, including the folder and the filename, of the text file one wants to process;
- [additional folder] is the optional additional folder where the output will be saved.
*/

#include "../Tools/Lib.C"
#include "../Tools/lhcbStyle.C"
#include "../Tools/Style.C"
#include "../Tools/Useful.C"

#include "../Tools/Par.C"

void LaserDelayScan(char *filename, char *externalPath=0);

int main(int argc, char *argv[])
{
  getLHCbStyle();
  PersonalStyle();

  if ((argc ==2) && (string(argv[1]) == "--info"))
  {
    cout << "**************************************************" << endl;

    cout << "Some comments." << endl;
    
    cout << "**************************************************" << endl;

    return 0;
  }
  else if (argc < 2)
  {
    cout << "**************************************************" << endl;
    
    cout << "Error! Input file missing..." << endl;
    cout << "Please use the following format:" << endl;
    cout << "./LaserDelayScan [1] [2]" << endl;
    cout << "with:" << endl;
    cout << "[1] = Input text file, complete path;" << endl;
    cout << "[2] = Additional folder, optional." << endl;
    cout << "Type ./LaserDelayScan --info for more information." << endl;

    cout << "**************************************************" << endl;

    return 0;  
  }
  else
  {
    cout << "File to process: " << argv[1] << endl;
    if (argc == 2)
      LaserDelayScan(argv[1]);
    else if (argc == 3)
      LaserDelayScan(argv[1],argv[2]);
    else
    {
      cout << "Error! Too many arguments given..." << endl;
      
      return 0;
    }
    
    return 0;  
  }  
}

void LaserDelayScan(char *filename, char *externalPath)
{
  cout << "**************************************************" << endl;
  cout << "Working on the laser delay scan..." << endl;
  cout << "**************************************************" << endl;

  // Do not comment this line.
  gROOT->ProcessLine("#include <vector>");

  // Do some fanciness to get the directory right.
  




 




  return;
}