Line data Source code
1 : #ifndef ALIEMCALTRIGGERCHANNELPOSITION_H
2 : #define ALIEMCALTRIGGERCHANNELPOSITION_H
3 : /* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : #include <TObject.h>
7 : #include <TSortedList.h>
8 :
9 : /**
10 : * @struct AliEmcalTriggerChannelContainer
11 : * @brief Structure for position of trigger channels
12 : *
13 : * This structure is a container for trigger channels in col-row space with
14 : * a given mask. Channels can only be added to the container, or it can be
15 : * checked whether the channel is listed in the container.
16 : */
17 : class AliEMCALTriggerChannelContainer : public TObject {
18 : public:
19 : /**
20 : * @struct AliEmcalTriggerChannelPosition
21 : * @brief 2D position of a trigger channel on the EMCAL surface
22 : *
23 : * This class represents the position of a trigger channel in a 2D coordinate
24 : * system consisting of column and row.
25 : */
26 0 : class AliEMCALTriggerChannelPosition : public TObject{
27 : public:
28 : /**
29 : * Dummy (I/O) constructor, not to be used
30 : */
31 0 : AliEMCALTriggerChannelPosition(): fCol(-1), fRow(-1) { }
32 :
33 : /**
34 : * Main constuctor, setting the position in column and row
35 : * @param col Column of the trigger channel
36 : * @param row Row of the trigger channel
37 : */
38 0 : AliEMCALTriggerChannelPosition(int col, int row): fCol(col), fRow(row) { }
39 :
40 : /**
41 : * Destructor, nothing to do
42 : */
43 0 : virtual ~AliEMCALTriggerChannelPosition() {}
44 :
45 : /**
46 : * Get the column of the channel
47 : * @return The column of the channel
48 : */
49 0 : int GetCol() const { return fCol; }
50 :
51 : /**
52 : * Get the row of the channel
53 : * @return The row of the channel
54 : */
55 0 : int GetRow() const { return fRow; }
56 :
57 : /**
58 : * Set the colummn of the channel
59 : * @param col The column of the channel
60 : */
61 0 : void SetCol(int col) { fCol = col; }
62 :
63 : /**
64 : * Set the row of the channel
65 : * @param row The row of the channel
66 : */
67 0 : void SetRow(int row) { fRow = row; }
68 :
69 : /**
70 : * Check if the object is equal to object ref. Object can only be equal if ref is of
71 : * the same type (AliEmcalTrigger channel position). If this is the case, col and row
72 : * of the two objects have to match.
73 : * @param ref The object to check
74 : * @return True if objects are equal, false otherwise
75 : */
76 : virtual Bool_t IsEqual(const TObject *ref) const;
77 :
78 : /**
79 : * Compare objects. If objects differ, return always greater (+1). Otherwise compare col and
80 : * row of the object. Col has priority with respect to row.
81 : * @param ref The object ot comparte to
82 : * @return 0 if objects are equal, -1 if this object is smaller, +1 if this object is larger.
83 : */
84 : virtual Int_t Compare(const TObject *ref) const;
85 :
86 : private:
87 : Int_t fCol; ///< Column of the trigger channel
88 : Int_t fRow; ///< Row of the trigger channel
89 :
90 : /// \cond CLASSIMP
91 22 : ClassDef(AliEMCALTriggerChannelPosition, 1);
92 : /// \endcond
93 : };
94 : /**
95 : * Constructor
96 : */
97 0 : AliEMCALTriggerChannelContainer(): fChannels() {}
98 :
99 : /**
100 : * Destructor, cleans up the container
101 : */
102 0 : virtual ~AliEMCALTriggerChannelContainer(){}
103 :
104 : /**
105 : * Add a new channel with the postion in column and row to the container, In case the channel
106 : * is already listed in the trigger channel container we don't add it again.
107 : * @param col Column of the channel
108 : * @param row Row of the channel
109 : */
110 : void AddChannel(int col, int row);
111 :
112 : /**
113 : * Check whether channel with the position (col, row) is listed in the trigger channel container
114 : * @param col Column of the channel
115 : * @param row Row of the channel
116 : * @return True if the channel is listed, false otherwise
117 : */
118 : bool HasChannel(int col, int row);
119 :
120 : private:
121 : TSortedList fChannels; ///< Container for listed channels
122 :
123 : /// \cond CLASSIMP
124 22 : ClassDef(AliEMCALTriggerChannelContainer, 1);
125 : /// \endcond
126 : };
127 :
128 : #endif
|