PandaRoot
PndEmcTwoCoordIndex.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 //======================================================================
14 // Class PndEmcTwoCoordIndex
15 //
16 // Software developed for the BaBar Detector at the SLAC B-Factory.
17 // Adapted for the PANDA experiment at GSI
18 //
19 // Class to hold coordinate and index information
20 // for system in which two co-ordinates specifies a channel uniquely.
21 // (Simplified version of class taken from BABAR framework)
22 // It is convenient to use 2-coordinate index to describe barel part of EMC
23 // to search for neigbour crystals in clustering algorithms
24 //
25 //
26 // Author List:
27 //
28 // Phil Strother Imperial College
29 // Stephen J. Gowdy University of Edinburgh
30 // Dima Melnichuk - adaption for PANDA
31 //
32 //======================================================================
33 //#pragma once
34 #ifndef PNDEMCTWOCOORDINDEX_H
35 #define PNDEMCTWOCOORDINDEX_H
36 
37 //---------------
38 // C++ Headers --
39 //---------------
40 #include "iostream"
41 #include "stdlib.h"
42 //#include <vector>
43 #include "TObject.h"
44 #include "PndEmcDataTypes.h"
45 
46 using std::cout;
47 using std::endl;
48 
53 class PndEmcTwoCoordIndex : public TObject {
54  public:
55  // Constructors
57  PndEmcTwoCoordIndex(long theXcoord, long theYcoord, long theIndex);
58 
59  // Destructors
60 
61  // destructor in base class
62  virtual ~PndEmcTwoCoordIndex();
63 
64  // Operators
65  bool operator==(const PndEmcTwoCoordIndex &c) const { return fIndex == c.fIndex; }
66  bool operator!=(const PndEmcTwoCoordIndex &c) const { return fIndex != c.fIndex; }
67 
68  bool operator<(const PndEmcTwoCoordIndex &) const;
69 
70  virtual const PndEmcCoordIndexSet GetNeighbours() const;
71 
72  long XCoord() const { return fCoords[0]; }
73  long YCoord() const { return fCoords[1]; }
74  long Index() const { return fIndex; }
75 
77 
78  // check if 2 tci are neigbour or not
79  bool IsNeighbour(PndEmcTwoCoordIndex *_tci);
80 
81  protected:
82  long fCoords[2];
83  long fIndex;
85 
86  private:
87  ClassDef(PndEmcTwoCoordIndex, 1)
88 };
89 
90 #endif // PNDEMCTWOCOORDINDEX_HH
stores crystal index coordinates (x,y) or (theta,phi)
bool operator!=(const PndEmcTwoCoordIndex &c) const
bool operator<(const PndEmcTwoCoordIndex &) const
virtual void AddToNeighbourList(PndEmcTwoCoordIndex *)
virtual const PndEmcCoordIndexSet GetNeighbours() const
std::set< PndEmcTwoCoordIndex * > PndEmcCoordIndexSet
bool IsNeighbour(PndEmcTwoCoordIndex *_tci)
bool operator==(const PndEmcTwoCoordIndex &c) const
PndEmcCoordIndexSet fNeighbours
virtual ~PndEmcTwoCoordIndex()