ROOT logo
// $Id$

/**************************************************************************
 * This file is property of and copyright by the ALICE HLT Project        * 
 * ALICE Experiment at CERN, All rights reserved.                         *
 *                                                                        *
 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
 *                  for The ALICE HLT Project.                            *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/** @file   testAliHLTGlobalBarrelTrack.C
    @author Matthias Richter
    @date   2010-12-17
    @brief  Test macro/program for the AliHLTGlobalBarrelTrack
 */

#ifndef __CINT__
#include <ostream>
#include <vector>
#include "AliHLTGlobalBarrelTrack.h"
#include "AliExternalTrackParam.h"
#include "TDatime.h"
#include "TRandom.h"
#endif //__CINT__

/**
 * Get a random number in the given range.
 */
int GetRandom(int min, int max)
{
  if (max-min<2) return min;
  static TRandom rand;
  static bool seedSet=false;
  if (!seedSet) {
    TDatime dt;
    rand.SetSeed(dt.Get());
    seedSet=true;
  }
  return min+rand.Integer(max-min);
}

int testAliHLTGlobalBarrelTrack()
{
  // test the AliHLTGlobalBarrelTrack class

  // 1)
  // the 5 track parameters are named in the AliHLTExternalTrackParam
  // while AliExternalTrackParam just uses an array[5]
  // the members have the same order, fY is the first one
  AliHLTExternalTrackParam hltparam;
  memset(&hltparam, 0, sizeof(AliHLTExternalTrackParam));
  hltparam.fY=GetRandom(0, 100000);
  hltparam.fZ=GetRandom(0, 100000);
  hltparam.fSinPsi=GetRandom(0, 100000);
  hltparam.fTgl=GetRandom(0, 100000);
  hltparam.fq1Pt=GetRandom(0, 100000);

  AliHLTGlobalBarrelTrack t(hltparam);
  if (TMath::Abs(hltparam.fY-t.GetY())>=1 ||
      TMath::Abs(hltparam.fZ-t.GetZ())>=1 ||
      TMath::Abs(hltparam.fSinPsi-t.GetSnp())>=1 ||
      TMath::Abs(hltparam.fTgl-t.GetTgl())>=1 ||
      TMath::Abs(hltparam.fq1Pt-t.GetSigned1Pt())) {
	cerr << "parameter sequence of AliExternalTrackParam and AliHLTExternalTrackParam does not match" << endl;
	return -1;
      }
  
  return 0;
}

int main(int /*argc*/, const char** /*argv*/)
{
  int iResult=0;
  if ((iResult=testAliHLTGlobalBarrelTrack())<0) {
  }
  return iResult;
}
 testAliHLTGlobalBarrelTrack.C:1
 testAliHLTGlobalBarrelTrack.C:2
 testAliHLTGlobalBarrelTrack.C:3
 testAliHLTGlobalBarrelTrack.C:4
 testAliHLTGlobalBarrelTrack.C:5
 testAliHLTGlobalBarrelTrack.C:6
 testAliHLTGlobalBarrelTrack.C:7
 testAliHLTGlobalBarrelTrack.C:8
 testAliHLTGlobalBarrelTrack.C:9
 testAliHLTGlobalBarrelTrack.C:10
 testAliHLTGlobalBarrelTrack.C:11
 testAliHLTGlobalBarrelTrack.C:12
 testAliHLTGlobalBarrelTrack.C:13
 testAliHLTGlobalBarrelTrack.C:14
 testAliHLTGlobalBarrelTrack.C:15
 testAliHLTGlobalBarrelTrack.C:16
 testAliHLTGlobalBarrelTrack.C:17
 testAliHLTGlobalBarrelTrack.C:18
 testAliHLTGlobalBarrelTrack.C:19
 testAliHLTGlobalBarrelTrack.C:20
 testAliHLTGlobalBarrelTrack.C:21
 testAliHLTGlobalBarrelTrack.C:22
 testAliHLTGlobalBarrelTrack.C:23
 testAliHLTGlobalBarrelTrack.C:24
 testAliHLTGlobalBarrelTrack.C:25
 testAliHLTGlobalBarrelTrack.C:26
 testAliHLTGlobalBarrelTrack.C:27
 testAliHLTGlobalBarrelTrack.C:28
 testAliHLTGlobalBarrelTrack.C:29
 testAliHLTGlobalBarrelTrack.C:30
 testAliHLTGlobalBarrelTrack.C:31
 testAliHLTGlobalBarrelTrack.C:32
 testAliHLTGlobalBarrelTrack.C:33
 testAliHLTGlobalBarrelTrack.C:34
 testAliHLTGlobalBarrelTrack.C:35
 testAliHLTGlobalBarrelTrack.C:36
 testAliHLTGlobalBarrelTrack.C:37
 testAliHLTGlobalBarrelTrack.C:38
 testAliHLTGlobalBarrelTrack.C:39
 testAliHLTGlobalBarrelTrack.C:40
 testAliHLTGlobalBarrelTrack.C:41
 testAliHLTGlobalBarrelTrack.C:42
 testAliHLTGlobalBarrelTrack.C:43
 testAliHLTGlobalBarrelTrack.C:44
 testAliHLTGlobalBarrelTrack.C:45
 testAliHLTGlobalBarrelTrack.C:46
 testAliHLTGlobalBarrelTrack.C:47
 testAliHLTGlobalBarrelTrack.C:48
 testAliHLTGlobalBarrelTrack.C:49
 testAliHLTGlobalBarrelTrack.C:50
 testAliHLTGlobalBarrelTrack.C:51
 testAliHLTGlobalBarrelTrack.C:52
 testAliHLTGlobalBarrelTrack.C:53
 testAliHLTGlobalBarrelTrack.C:54
 testAliHLTGlobalBarrelTrack.C:55
 testAliHLTGlobalBarrelTrack.C:56
 testAliHLTGlobalBarrelTrack.C:57
 testAliHLTGlobalBarrelTrack.C:58
 testAliHLTGlobalBarrelTrack.C:59
 testAliHLTGlobalBarrelTrack.C:60
 testAliHLTGlobalBarrelTrack.C:61
 testAliHLTGlobalBarrelTrack.C:62
 testAliHLTGlobalBarrelTrack.C:63
 testAliHLTGlobalBarrelTrack.C:64
 testAliHLTGlobalBarrelTrack.C:65
 testAliHLTGlobalBarrelTrack.C:66
 testAliHLTGlobalBarrelTrack.C:67
 testAliHLTGlobalBarrelTrack.C:68
 testAliHLTGlobalBarrelTrack.C:69
 testAliHLTGlobalBarrelTrack.C:70
 testAliHLTGlobalBarrelTrack.C:71
 testAliHLTGlobalBarrelTrack.C:72
 testAliHLTGlobalBarrelTrack.C:73
 testAliHLTGlobalBarrelTrack.C:74
 testAliHLTGlobalBarrelTrack.C:75
 testAliHLTGlobalBarrelTrack.C:76
 testAliHLTGlobalBarrelTrack.C:77
 testAliHLTGlobalBarrelTrack.C:78
 testAliHLTGlobalBarrelTrack.C:79
 testAliHLTGlobalBarrelTrack.C:80
 testAliHLTGlobalBarrelTrack.C:81
 testAliHLTGlobalBarrelTrack.C:82
 testAliHLTGlobalBarrelTrack.C:83
 testAliHLTGlobalBarrelTrack.C:84
 testAliHLTGlobalBarrelTrack.C:85
 testAliHLTGlobalBarrelTrack.C:86