Added a new class AliPHOSSurvet1 which read survey data from EDMS files
[u/mrichter/AliRoot.git] / PHOS / AliPHOSSurvey1.cxx
CommitLineData
42c5218a 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15/* $Id$ */
16
17/* History of cvs commits:
18 *
19 * $Log$
20 */
21
22#include "AliSurveyPoint.h"
23#include "AliSurveyObj.h"
24
25#include "AliPHOSEMCAGeometry.h"
26#include "AliPHOSGeometry.h"
27#include "AliPHOSSurvey1.h"
28#include "AliLog.h"
29
30ClassImp(AliPHOSSurvey1)
31
32//____________________________________________________________________________
33AliPHOSSurvey1::AliPHOSSurvey1(const TString &fileName, const TString &namePrefix)
34{
35 const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
36 if (!phosGeom) {
37 AliError("Cannot obtain AliPHOSGeometry instance.");
38 return;
39 }
40
41 AliSurveyObj survey;
42 survey.FillFromLocalFile(fileName);
43
44 AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
45 fStrNum = emcaGeom->GetNStripX() * emcaGeom->GetNStripZ();
46
47 TObjArray *points = survey.GetData();
48 Int_t goodPoints = 0;
49 Int_t start = -1;
50 for (Int_t i = 0, e = points->GetEntries(); i < e; ++i) {
51 AliSurveyPoint *stripPoint = static_cast<AliSurveyPoint *>(points->At(i));
52 if (stripPoint->GetPointName().BeginsWith(namePrefix)) {
53 ++goodPoints;
54 if (start == -1)
55 start = i;
56 }
57 }
58
59 if (goodPoints != kNumberOfPoints) {
60 AliError("Wrong number of points with prefix" + namePrefix);
61 return;
62 }
63
64 Double_t *xReal = new Double_t[fStrNum * 2];//1
65 Double_t *zReal = new Double_t[fStrNum * 2];//2
66
67 for (Int_t i = 0; i < fStrNum * 2; ++i) {
68 AliSurveyPoint *stripPoint = static_cast<AliSurveyPoint *>(points->At(start + kStartingPoint + i));
69 xReal[i] = stripPoint->GetX() * 0.1;
70 zReal[i] = stripPoint->GetZ() * 0.1;
71 }
72
73 InitStripData(xReal, zReal);
74
75 delete [] zReal;//2
76 delete [] xReal;//1
77}
78
79//____________________________________________________________________________
80AliPHOSSurvey1::~AliPHOSSurvey1()
81{
82}