ROOT logo
#if !defined( __CINT__) || defined(__MAKECINT__)


#include <Riostream.h>
#include <TSystem.h>
#include "AliReconstruction.h"
#include "../TRD/AliTRDCalibra.h"
#include <TStopwatch.h>

#endif



void AliTRDReconstructandFill() 
{
  //
  // This macro fills 2d histo or vectors during the reconstruction
  // If it is vectors, it fits them directly after the reconstruction
  // and writes the result in the file coeftest.root
  //
 
  TStopwatch timer;
  timer.Start();

  ////Set the parameters of AliTRDCalibra***************
  AliTRDCalibra *calibra = AliTRDCalibra::Instance();

  ////What do you want to use?
  calibra->SetMITracking(); //Offline tracking
  //calibra->Setmcmtracking();
  
  
  ////Do you want to try the correction due to the angles of the tracks for mcm tracklets?
  calibra->SetMcmCorrectAngle();
  
  ////What do you want to fill?
  calibra->SetCH2dOn();//relative gain calibration
  calibra->SetPH2dOn();//drift velocity and time0 calibration
  calibra->SetPRF2dOn();//Pad Response Function calibration


  ////How do you want to store the infos?
  calibra->SetVector2d();//vector method
  calibra->SetHisto2d();//2Dhistograms

  ////Which mode do you want?
  calibra->SetNz(2,2);//For the PRF z direction
  calibra->SetNrphi(2,2);//For The PRF rphi direction
  calibra->SetNz(0,0);//For the gain z direction
  calibra->SetNrphi(0,0);//For the gain rphi direction
  calibra->SetNz(1,3);//For the drift velocity and time0 z direction
  calibra->SetNrphi(1,3);//For the drift velocity and time 0 rphi direction

  ////How many bins?
  calibra->SetNumberBinCharge(100);
  calibra->SetNumberBinPRF(20);
  
  
  ////Do you want to accept more tracks?
  calibra->SetProcent(1.2);//For the gain if one group has a signal above 1.2 the other group then fill
  calibra->SetDifference(10);//For the drift velocity if one group has at least 10 time bins then fill
  calibra->SetNumberClusters(18);//For mcm tracklets only fill only with tracklet with at least 18 clusters
  
  ////Do you want to take only the middle pad for gain or Vdrift?
  //calibra->SetTraMaxPad();
  
  //Do you want to apply more strict cut on the clusters for the PRF calibration?
  calibra->SetThresholdClusterPRF1(2);//The neighbors pads must have a signal smaller than 2 ADC counts
  calibra->SetThresholdClusterPRF2(10);//The 3 pads in the cluster must have a signal above 10 ADC counts
  
  
  ////What do you want to write?
  calibra->SetWrite(0);//For the gain
  calibra->SetWrite(1);//For the average pulse height
  calibra->SetWrite(2);//For the PRF
  
  
  ////If you want to change the name of the file where it is stored (not very good)
  //calibra->SetWriteName("test.root");
  
  
  //Begin the reconstruction
  AliReconstruction rec;
  rec.SetGAliceFile("galice.root"); 
  rec.SetLoadAlignFromCDB(kFALSE);
  rec.SetRunHLTTracking(kFALSE);
  rec.SetFillESD("");
  rec.SetFillTriggerESD(kFALSE);
  rec.SetRunVertexFinder(kFALSE);
  rec.Run();
  timer.Stop();
  timer.Print();
  calibra->Write2d();    


  TStopwatch timerfit;
  timerfit.Start();
  ////Fit directly after having filling****

  ////Do you want to try with less statistics?
  calibra->SetMinEntries(10);//If there is at least 10 entries in the histo, it will fit

  ////Do you want to write the result?
  calibra->SetWriteCoef(0);//gain
  calibra->SetWriteCoef(1);//time 0 and drift velocity
  calibra->SetWriteCoef(2);//PRF

  ////Do you want to change the name of the file (TRD.coefficient.root)?
  calibra->SetWriteNameCoef("coeftest.root");

  ////Do you want to see something?
  calibra->SetDebug(1);

  ////Do you want to fit?
  calibra->FitPHOnline(); 
  calibra->FitCHOnline(); 
  calibra->FitPRFOnline();  
  
  
  timerfit.Stop();
  timerfit.Print();

}
 AliTRDReconstructandFill.C:1
 AliTRDReconstructandFill.C:2
 AliTRDReconstructandFill.C:3
 AliTRDReconstructandFill.C:4
 AliTRDReconstructandFill.C:5
 AliTRDReconstructandFill.C:6
 AliTRDReconstructandFill.C:7
 AliTRDReconstructandFill.C:8
 AliTRDReconstructandFill.C:9
 AliTRDReconstructandFill.C:10
 AliTRDReconstructandFill.C:11
 AliTRDReconstructandFill.C:12
 AliTRDReconstructandFill.C:13
 AliTRDReconstructandFill.C:14
 AliTRDReconstructandFill.C:15
 AliTRDReconstructandFill.C:16
 AliTRDReconstructandFill.C:17
 AliTRDReconstructandFill.C:18
 AliTRDReconstructandFill.C:19
 AliTRDReconstructandFill.C:20
 AliTRDReconstructandFill.C:21
 AliTRDReconstructandFill.C:22
 AliTRDReconstructandFill.C:23
 AliTRDReconstructandFill.C:24
 AliTRDReconstructandFill.C:25
 AliTRDReconstructandFill.C:26
 AliTRDReconstructandFill.C:27
 AliTRDReconstructandFill.C:28
 AliTRDReconstructandFill.C:29
 AliTRDReconstructandFill.C:30
 AliTRDReconstructandFill.C:31
 AliTRDReconstructandFill.C:32
 AliTRDReconstructandFill.C:33
 AliTRDReconstructandFill.C:34
 AliTRDReconstructandFill.C:35
 AliTRDReconstructandFill.C:36
 AliTRDReconstructandFill.C:37
 AliTRDReconstructandFill.C:38
 AliTRDReconstructandFill.C:39
 AliTRDReconstructandFill.C:40
 AliTRDReconstructandFill.C:41
 AliTRDReconstructandFill.C:42
 AliTRDReconstructandFill.C:43
 AliTRDReconstructandFill.C:44
 AliTRDReconstructandFill.C:45
 AliTRDReconstructandFill.C:46
 AliTRDReconstructandFill.C:47
 AliTRDReconstructandFill.C:48
 AliTRDReconstructandFill.C:49
 AliTRDReconstructandFill.C:50
 AliTRDReconstructandFill.C:51
 AliTRDReconstructandFill.C:52
 AliTRDReconstructandFill.C:53
 AliTRDReconstructandFill.C:54
 AliTRDReconstructandFill.C:55
 AliTRDReconstructandFill.C:56
 AliTRDReconstructandFill.C:57
 AliTRDReconstructandFill.C:58
 AliTRDReconstructandFill.C:59
 AliTRDReconstructandFill.C:60
 AliTRDReconstructandFill.C:61
 AliTRDReconstructandFill.C:62
 AliTRDReconstructandFill.C:63
 AliTRDReconstructandFill.C:64
 AliTRDReconstructandFill.C:65
 AliTRDReconstructandFill.C:66
 AliTRDReconstructandFill.C:67
 AliTRDReconstructandFill.C:68
 AliTRDReconstructandFill.C:69
 AliTRDReconstructandFill.C:70
 AliTRDReconstructandFill.C:71
 AliTRDReconstructandFill.C:72
 AliTRDReconstructandFill.C:73
 AliTRDReconstructandFill.C:74
 AliTRDReconstructandFill.C:75
 AliTRDReconstructandFill.C:76
 AliTRDReconstructandFill.C:77
 AliTRDReconstructandFill.C:78
 AliTRDReconstructandFill.C:79
 AliTRDReconstructandFill.C:80
 AliTRDReconstructandFill.C:81
 AliTRDReconstructandFill.C:82
 AliTRDReconstructandFill.C:83
 AliTRDReconstructandFill.C:84
 AliTRDReconstructandFill.C:85
 AliTRDReconstructandFill.C:86
 AliTRDReconstructandFill.C:87
 AliTRDReconstructandFill.C:88
 AliTRDReconstructandFill.C:89
 AliTRDReconstructandFill.C:90
 AliTRDReconstructandFill.C:91
 AliTRDReconstructandFill.C:92
 AliTRDReconstructandFill.C:93
 AliTRDReconstructandFill.C:94
 AliTRDReconstructandFill.C:95
 AliTRDReconstructandFill.C:96
 AliTRDReconstructandFill.C:97
 AliTRDReconstructandFill.C:98
 AliTRDReconstructandFill.C:99
 AliTRDReconstructandFill.C:100
 AliTRDReconstructandFill.C:101
 AliTRDReconstructandFill.C:102
 AliTRDReconstructandFill.C:103
 AliTRDReconstructandFill.C:104
 AliTRDReconstructandFill.C:105
 AliTRDReconstructandFill.C:106
 AliTRDReconstructandFill.C:107
 AliTRDReconstructandFill.C:108
 AliTRDReconstructandFill.C:109
 AliTRDReconstructandFill.C:110
 AliTRDReconstructandFill.C:111
 AliTRDReconstructandFill.C:112
 AliTRDReconstructandFill.C:113
 AliTRDReconstructandFill.C:114
 AliTRDReconstructandFill.C:115
 AliTRDReconstructandFill.C:116
 AliTRDReconstructandFill.C:117
 AliTRDReconstructandFill.C:118
 AliTRDReconstructandFill.C:119
 AliTRDReconstructandFill.C:120
 AliTRDReconstructandFill.C:121
 AliTRDReconstructandFill.C:122
 AliTRDReconstructandFill.C:123
 AliTRDReconstructandFill.C:124