StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AliHLTTPCCAStartHitId.h
1 /*
2  Copyright (C) 2009 Matthias Kretz <kretz@kde.org>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) version 3.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 
19 */
20 
21 #ifndef ALIHLTTPCCASTARTHITID_H
22 #define ALIHLTTPCCASTARTHITID_H
23 
24 #include "AliHLTTPCCAHitId.h"
25 #include "AliHLTTPCCADef.h"
26 
28 {
29  public:
30  inline void Set( unsigned short row, unsigned short hit, unsigned short length ) { fRow = row; fHit = hit; fLength = length; }
31  inline short RowIndex() const { return fRow; }
32  inline unsigned short HitIndex() const { return fHit; }
33  inline unsigned short Length() const { return fLength; }
34 
35  inline bool operator<( const AliHLTTPCCAStartHitId &rhs ) const {
36  const int rowStep = AliHLTTPCCAParameters::RowStep;
37  assert( rowStep <= 2 );
38  const bool lL = fLength < rhs.fLength;
39  // const bool eL = fLength == rhs.fLength;
40  bool lR, eR;
41  if (rowStep == 2){
42  lR = ( fRow & 1 ) < ( rhs.fRow & 1 )
43  || ( ( fRow & 1 ) == ( rhs.fRow & 1 ) && fRow < rhs.fRow );
44  eR = fRow == rhs.fRow;
45  }
46  else{
47  lR = fRow < rhs.fRow;
48  eR = fRow == rhs.fRow;
49  }
50  // return lL || (eL && lR); // todo: why lose efficiency with diff sort
51  return lR || (eR && lL);
52  }
53 
54  unsigned short fLength; // length of chain
55 };
56 
57 #endif // ALIHLTTPCCASTARTHITID_H