Line data Source code
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 : * Revision 1.1 2007/07/10 12:41:38 kharlov
21 : * Added a new class AliPHOSSurvet1 which read survey data from EDMS files
22 : *
23 : */
24 :
25 : // AliPHOSSurvey1 class is survey "reader" class, based on AliSurveyObj class.
26 : // The first ctor parameter is a survey file's name.
27 : // Now it's a "local" file, later, when AliSurveyObj will be modified,
28 : // survey files can be somewhere else.
29 : // The second parameter is a prefix, for example "T1_" or "T2_", it's used to select
30 : // survey (T1_ == data from 08.09.2006 and T2_ == data from 11.09.2006).
31 : // The survey data is available from http://dcdb.cern.ch/surveydepot-production/
32 : //!
33 : // Author: Timur Pocheptsov
34 :
35 : #include "AliSurveyPoint.h"
36 : #include "AliSurveyObj.h"
37 :
38 : #include "AliPHOSEMCAGeometry.h"
39 : #include "AliPHOSGeometry.h"
40 : #include "AliPHOSSurvey1.h"
41 : #include "AliLog.h"
42 :
43 22 : ClassImp(AliPHOSSurvey1)
44 :
45 : //____________________________________________________________________________
46 0 : AliPHOSSurvey1::AliPHOSSurvey1(const TString &fileName, const TString &namePrefix)
47 0 : {
48 : // AliPHOSSurvey1 ctor. Creates AliSurveyObj, which reads data from EDMS,
49 : // convert this data (a set of AliSurveyPoint objects) into translations
50 : // and rotations from strips.
51 :
52 0 : const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
53 0 : if (!phosGeom) {
54 0 : AliError("Cannot obtain AliPHOSGeometry instance.");
55 0 : return;
56 : }
57 :
58 0 : AliSurveyObj survey;
59 0 : survey.FillFromLocalFile(fileName);
60 :
61 0 : AliPHOSEMCAGeometry * emcaGeom = phosGeom->GetEMCAGeometry();
62 0 : fStrNum = emcaGeom->GetNStripX() * emcaGeom->GetNStripZ();
63 :
64 0 : TObjArray *points = survey.GetData();
65 : Int_t goodPoints = 0;
66 : Int_t start = -1;
67 0 : for (Int_t i = 0, e = points->GetEntries(); i < e; ++i) {
68 0 : AliSurveyPoint *stripPoint = static_cast<AliSurveyPoint *>(points->At(i));
69 0 : if (stripPoint->GetPointName().BeginsWith(namePrefix)) {
70 0 : ++goodPoints;
71 0 : if (start == -1)
72 0 : start = i;
73 : }
74 : }
75 :
76 0 : if (goodPoints != kNumberOfPoints) {
77 0 : AliError("Wrong number of points with prefix" + namePrefix);
78 0 : return;
79 : }
80 :
81 0 : Double_t *xReal = new Double_t[fStrNum * 2];//1
82 0 : Double_t *zReal = new Double_t[fStrNum * 2];//2
83 :
84 0 : for (Int_t i = 0; i < fStrNum * 2; ++i) {
85 0 : AliSurveyPoint *stripPoint = static_cast<AliSurveyPoint *>(points->At(start + kStartingPoint + i));
86 0 : xReal[i] = stripPoint->GetX() * 0.1;
87 0 : zReal[i] = stripPoint->GetZ() * 0.1;
88 : }
89 :
90 0 : InitStripData(xReal, zReal);
91 :
92 0 : delete [] zReal;//2
93 0 : delete [] xReal;//1
94 0 : }
95 :
96 : //____________________________________________________________________________
97 : AliPHOSSurvey1::~AliPHOSSurvey1()
98 0 : {
99 0 : }
|