]>
Commit | Line | Data |
---|---|---|
39d4ae58 | 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 | ||
16 | //------------------------------------------------------------------------- | |
17 | // Class AliCluster3D | |
18 | // This is an extension of the AliCluster class for the case when | |
19 | // the sensitive plane this cluster belongs to is arbitrarily oriented | |
20 | // in space. This class can serve as the base for the TOF and HMPID | |
21 | // clusters. | |
22 | // | |
23 | // cvetan.cheshkov@cern.ch & jouri.belikov@cern.ch 5/3/2007 | |
24 | //------------------------------------------------------------------------- | |
25 | #include <TGeoManager.h> | |
26 | #include <TGeoMatrix.h> | |
27 | ||
28 | #include "AliCluster3D.h" | |
29 | #include "AliLog.h" | |
30 | ||
31 | ClassImp(AliCluster3D) | |
32 | ||
33 | //______________________________________________________________________________ | |
34 | AliCluster3D::AliCluster3D(): | |
35 | AliCluster(), | |
36 | fSigmaX2(0), | |
37 | fSigmaXY(0), | |
38 | fSigmaXZ(0) | |
39 | { | |
40 | // Default constructor | |
41 | } | |
42 | ||
43 | //______________________________________________________________________________ | |
44 | AliCluster3D::AliCluster3D(UShort_t volId, | |
45 | Float_t x, Float_t y, Float_t z, | |
46 | Float_t sx2, Float_t sxy, Float_t sxz, | |
47 | Float_t sy2, Float_t syz, | |
48 | Float_t sz2, const Int_t *lab): | |
49 | AliCluster(volId,x,y,z,sy2,sz2,syz,lab), | |
50 | fSigmaX2(sx2), | |
51 | fSigmaXY(sxy), | |
52 | fSigmaXZ(sxz) | |
53 | { | |
54 | //------------------------------------------------------------------------- | |
55 | // The main constructor | |
56 | //------------------------------------------------------------------------- | |
57 | } | |
58 | ||
59 | //______________________________________________________________________________ | |
60 | AliCluster3D::AliCluster3D(const AliCluster3D& cluster): | |
61 | AliCluster(cluster), | |
62 | fSigmaX2(cluster.fSigmaX2), | |
63 | fSigmaXY(cluster.fSigmaXY), | |
64 | fSigmaXZ(cluster.fSigmaXZ) | |
65 | { | |
66 | // Copy constructor | |
67 | } | |
68 | ||
69 | //______________________________________________________________________________ | |
70 | Bool_t AliCluster3D::GetGlobalCov(Float_t cov[6]) const | |
71 | { | |
72 | ||
73 | // Get the covariance matrix in the global coordinate system. | |
74 | // All the needed information is taken only | |
75 | // from TGeo. | |
76 | ||
77 | if (!gGeoManager || !gGeoManager->IsClosed()) { | |
78 | AliError("gGeoManager doesn't exist or it is still opened !"); | |
79 | return kFALSE; | |
80 | } | |
81 | ||
82 | const TGeoHMatrix *mt = GetTracking2LocalMatrix(); | |
83 | if (!mt) return kFALSE; | |
84 | ||
85 | TGeoHMatrix *ml = GetMatrix(); | |
86 | if (!ml) return kFALSE; | |
87 | ||
88 | TGeoHMatrix m; | |
89 | Double_t tcov[9] = { fSigmaX2, fSigmaXY, fSigmaXZ, | |
90 | fSigmaXY, GetSigmaY2(), GetSigmaYZ(), | |
91 | fSigmaXZ, GetSigmaYZ(), GetSigmaZ2()}; | |
92 | m.SetRotation(tcov); | |
93 | m.Multiply(&mt->Inverse()); | |
94 | m.Multiply(&ml->Inverse()); | |
95 | m.MultiplyLeft(mt); | |
96 | m.MultiplyLeft(ml); | |
97 | Double_t *ncov = m.GetRotationMatrix(); | |
98 | cov[0] = ncov[0]; cov[1] = ncov[1]; cov[2] = ncov[2]; | |
99 | cov[3] = ncov[4]; cov[4] = ncov[5]; | |
100 | cov[5] = ncov[8]; | |
101 | ||
102 | return kTRUE; | |
103 | } |