Print centrality estimator when providing centrality info (Diego)
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackletWord.cxx
CommitLineData
52c19022 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/* $Id: AliTRDtrackletWord.cxx 28397 2008-09-02 09:33:00Z cblume $ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// A tracklet word as from FEE //
21// //
22// Author: J. Klein (Jochen.Klein@cern.ch) //
23// //
24////////////////////////////////////////////////////////////////////////////
25
26#include "AliTRDtrackletWord.h"
85c32c86 27#include "AliTRDgeometry.h"
f061fb9d 28#include "AliTRDpadPlane.h"
52c19022 29#include "AliLog.h"
30
31ClassImp(AliTRDtrackletWord)
32
6170d369 33AliTRDgeometry* AliTRDtrackletWord::fgGeo = 0x0;
85c32c86 34
52c19022 35AliTRDtrackletWord::AliTRDtrackletWord(UInt_t trackletWord) :
36 AliTRDtrackletBase(),
37 fHCId(-1),
38 fTrackletWord(trackletWord)
5f006bd7 39{
6170d369 40 if (!fgGeo)
41 fgGeo = new AliTRDgeometry;
52c19022 42}
43
44AliTRDtrackletWord::AliTRDtrackletWord(UInt_t trackletWord, Int_t hcid) :
45 AliTRDtrackletBase(),
46 fHCId(hcid),
47 fTrackletWord(trackletWord)
5f006bd7 48{
6170d369 49 if (!fgGeo)
50 fgGeo = new AliTRDgeometry;
52c19022 51}
52
53AliTRDtrackletWord::AliTRDtrackletWord(const AliTRDtrackletWord &rhs) :
54 AliTRDtrackletBase(rhs),
55 fHCId(rhs.fHCId),
56 fTrackletWord(rhs.fTrackletWord)
57{
58
6170d369 59 if (!fgGeo)
60 fgGeo = new AliTRDgeometry;
52c19022 61}
62
5f006bd7 63AliTRDtrackletWord::~AliTRDtrackletWord()
52c19022 64{
65
66}
67
68Int_t AliTRDtrackletWord::GetYbin() const {
69 // returns (signed) value of Y
70 if (fTrackletWord & 0x1000) {
71 return -((~(fTrackletWord-1)) & 0x1fff);
72 }
73 else {
74 return (fTrackletWord & 0x1fff);
75 }
76}
77
5f006bd7 78Int_t AliTRDtrackletWord::GetdY() const
52c19022 79{
80 // returns (signed) value of the deflection length
81 if (fTrackletWord & (1 << 19)) {
82 return -((~((fTrackletWord >> 13) - 1)) & 0x7f);
83 }
84 else {
85 return ((fTrackletWord >> 13) & 0x7f);
86 }
87}
f061fb9d 88
89Int_t AliTRDtrackletWord::GetROB() const
90{
91 return 2 * (GetZbin() / 4) + (GetY() > 0 ? 1 : 0);
92}
93
94Int_t AliTRDtrackletWord::GetMCM() const
95{
96 AliTRDpadPlane *pp = fgGeo->GetPadPlane(GetDetector());
97 return (((Int_t) ((GetY()) / pp->GetWidthIPad()) + 72) / 18) % 4
98 + 4 * (GetZbin() % 4);
99}
100