ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * 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.                  *
 **************************************************************************/
/* $Id$ */

/* History of cvs commits:
 *
 * $Log$
 * Revision 1.1  2007/07/10 12:41:38  kharlov
 * Added a new class AliPHOSSurvet1 which read survey data from EDMS files
 *
 */

// AliPHOSSurvey1 class is survey "reader" class, based on AliSurveyObj class.
// The first ctor parameter is a survey file's name.
// Now it's a "local" file, later, when AliSurveyObj will be modified,
// survey files can be somewhere else.
// The second parameter is a prefix, for example "T1_" or "T2_", it's used to select
// survey (T1_ == data from 08.09.2006 and T2_ == data from 11.09.2006).
// The survey data is available from http://dcdb.cern.ch/surveydepot-production/
//!
// Author: Timur Pocheptsov

#include "AliSurveyPoint.h"
#include "AliSurveyObj.h"

#include "AliPHOSEMCAGeometry.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSSurvey1.h"
#include "AliLog.h"

ClassImp(AliPHOSSurvey1)

//____________________________________________________________________________
AliPHOSSurvey1::AliPHOSSurvey1(const TString &fileName, const TString &namePrefix)
{
  // AliPHOSSurvey1 ctor. Creates AliSurveyObj, which reads data from EDMS,
  // convert this data (a set of AliSurveyPoint objects) into translations
  // and rotations from strips.

  const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
  if (!phosGeom) {
    AliError("Cannot obtain AliPHOSGeometry instance.");
    return;
  }

  AliSurveyObj survey;
  survey.FillFromLocalFile(fileName);

  AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
  fStrNum = emcaGeom->GetNStripX() * emcaGeom->GetNStripZ();

  TObjArray *points = survey.GetData();
  Int_t goodPoints = 0;
  Int_t start = -1;
  for (Int_t i = 0, e = points->GetEntries(); i < e; ++i) {
    AliSurveyPoint *stripPoint = static_cast<AliSurveyPoint *>(points->At(i));
    if (stripPoint->GetPointName().BeginsWith(namePrefix)) {
      ++goodPoints;
      if (start == -1)
        start = i;
    }
  }

  if (goodPoints != kNumberOfPoints) {
    AliError("Wrong number of points with prefix" + namePrefix);
    return;
  }

  Double_t *xReal = new Double_t[fStrNum * 2];//1
  Double_t *zReal = new Double_t[fStrNum * 2];//2

  for (Int_t i = 0; i < fStrNum * 2; ++i) {
    AliSurveyPoint *stripPoint = static_cast<AliSurveyPoint *>(points->At(start + kStartingPoint + i));
    xReal[i] = stripPoint->GetX() * 0.1;
    zReal[i] = stripPoint->GetZ() * 0.1;
  }

  InitStripData(xReal, zReal);

  delete [] zReal;//2
  delete [] xReal;//1
}

//____________________________________________________________________________
AliPHOSSurvey1::~AliPHOSSurvey1()
{
}
 AliPHOSSurvey1.cxx:1
 AliPHOSSurvey1.cxx:2
 AliPHOSSurvey1.cxx:3
 AliPHOSSurvey1.cxx:4
 AliPHOSSurvey1.cxx:5
 AliPHOSSurvey1.cxx:6
 AliPHOSSurvey1.cxx:7
 AliPHOSSurvey1.cxx:8
 AliPHOSSurvey1.cxx:9
 AliPHOSSurvey1.cxx:10
 AliPHOSSurvey1.cxx:11
 AliPHOSSurvey1.cxx:12
 AliPHOSSurvey1.cxx:13
 AliPHOSSurvey1.cxx:14
 AliPHOSSurvey1.cxx:15
 AliPHOSSurvey1.cxx:16
 AliPHOSSurvey1.cxx:17
 AliPHOSSurvey1.cxx:18
 AliPHOSSurvey1.cxx:19
 AliPHOSSurvey1.cxx:20
 AliPHOSSurvey1.cxx:21
 AliPHOSSurvey1.cxx:22
 AliPHOSSurvey1.cxx:23
 AliPHOSSurvey1.cxx:24
 AliPHOSSurvey1.cxx:25
 AliPHOSSurvey1.cxx:26
 AliPHOSSurvey1.cxx:27
 AliPHOSSurvey1.cxx:28
 AliPHOSSurvey1.cxx:29
 AliPHOSSurvey1.cxx:30
 AliPHOSSurvey1.cxx:31
 AliPHOSSurvey1.cxx:32
 AliPHOSSurvey1.cxx:33
 AliPHOSSurvey1.cxx:34
 AliPHOSSurvey1.cxx:35
 AliPHOSSurvey1.cxx:36
 AliPHOSSurvey1.cxx:37
 AliPHOSSurvey1.cxx:38
 AliPHOSSurvey1.cxx:39
 AliPHOSSurvey1.cxx:40
 AliPHOSSurvey1.cxx:41
 AliPHOSSurvey1.cxx:42
 AliPHOSSurvey1.cxx:43
 AliPHOSSurvey1.cxx:44
 AliPHOSSurvey1.cxx:45
 AliPHOSSurvey1.cxx:46
 AliPHOSSurvey1.cxx:47
 AliPHOSSurvey1.cxx:48
 AliPHOSSurvey1.cxx:49
 AliPHOSSurvey1.cxx:50
 AliPHOSSurvey1.cxx:51
 AliPHOSSurvey1.cxx:52
 AliPHOSSurvey1.cxx:53
 AliPHOSSurvey1.cxx:54
 AliPHOSSurvey1.cxx:55
 AliPHOSSurvey1.cxx:56
 AliPHOSSurvey1.cxx:57
 AliPHOSSurvey1.cxx:58
 AliPHOSSurvey1.cxx:59
 AliPHOSSurvey1.cxx:60
 AliPHOSSurvey1.cxx:61
 AliPHOSSurvey1.cxx:62
 AliPHOSSurvey1.cxx:63
 AliPHOSSurvey1.cxx:64
 AliPHOSSurvey1.cxx:65
 AliPHOSSurvey1.cxx:66
 AliPHOSSurvey1.cxx:67
 AliPHOSSurvey1.cxx:68
 AliPHOSSurvey1.cxx:69
 AliPHOSSurvey1.cxx:70
 AliPHOSSurvey1.cxx:71
 AliPHOSSurvey1.cxx:72
 AliPHOSSurvey1.cxx:73
 AliPHOSSurvey1.cxx:74
 AliPHOSSurvey1.cxx:75
 AliPHOSSurvey1.cxx:76
 AliPHOSSurvey1.cxx:77
 AliPHOSSurvey1.cxx:78
 AliPHOSSurvey1.cxx:79
 AliPHOSSurvey1.cxx:80
 AliPHOSSurvey1.cxx:81
 AliPHOSSurvey1.cxx:82
 AliPHOSSurvey1.cxx:83
 AliPHOSSurvey1.cxx:84
 AliPHOSSurvey1.cxx:85
 AliPHOSSurvey1.cxx:86
 AliPHOSSurvey1.cxx:87
 AliPHOSSurvey1.cxx:88
 AliPHOSSurvey1.cxx:89
 AliPHOSSurvey1.cxx:90
 AliPHOSSurvey1.cxx:91
 AliPHOSSurvey1.cxx:92
 AliPHOSSurvey1.cxx:93
 AliPHOSSurvey1.cxx:94
 AliPHOSSurvey1.cxx:95
 AliPHOSSurvey1.cxx:96
 AliPHOSSurvey1.cxx:97
 AliPHOSSurvey1.cxx:98
 AliPHOSSurvey1.cxx:99