@@ -117,3 +117,78 @@ void Geometry::setCsideModules()
117117 mMCP [i + NCellsA].SetXYZ (xc2[i], yc2[i], zc2[i]);
118118 }
119119}
120+ void Geometry::calculateChannelCenter ()
121+ {
122+ // This method calculates the position of each channel center composing both FT0-A
123+ // and FT0-C, based on the position of their corresponding modules given by
124+ // "Geometry::setAsideModules()" and "Geometry::setCsideModules()".
125+
126+ // Ensure the positions of the modules are well defined.
127+ setAsideModules ();
128+ setCsideModules ();
129+
130+ // Calculate first the positions for the channels for FT0-A. These correspond to the
131+ // channels 0-95 in the modules mMCP[0-23].
132+ Double_t delta = 5.3 /4 .; // Half-channel width (TODO: ask if it actually corresponds to ChannelWidth)
133+ Double_t xLocalChannels[Nchannels]; // x-positions of all channels ordered according to xi and internal numbering.
134+ Double_t yLocalChannels[Nchannels]; // y-positions of all channels ordered according to yi and internal numbering.
135+ Double_t zLocalChannels[Nchannels]; // z-positions of all channels ordered according to zi and internal numbering.
136+ // INFO: We assume here the modules are perpendicular to z, so z(channel) = z(module).
137+
138+ for (int iModA = 0 ; iModA < NCellsA; iModA++) {
139+ xLocalChannels[4 *iModA+0 ] = mMCP [iModA].X () - delta;
140+ xLocalChannels[4 *iModA+1 ] = mMCP [iModA].X () + delta;
141+ xLocalChannels[4 *iModA+2 ] = mMCP [iModA].X () - delta;
142+ xLocalChannels[4 *iModA+3 ] = mMCP [iModA].X () + delta;
143+
144+ yLocalChannels[4 *iModA+0 ] = mMCP [iModA].Y () + delta;
145+ yLocalChannels[4 *iModA+1 ] = mMCP [iModA].Y () + delta;
146+ yLocalChannels[4 *iModA+2 ] = mMCP [iModA].Y () - delta;
147+ yLocalChannels[4 *iModA+3 ] = mMCP [iModA].Y () - delta;
148+
149+ zLocalChannels[4 *iModA+0 ] = mMCP [iModA].Z ();
150+ zLocalChannels[4 *iModA+1 ] = mMCP [iModA].Z ();
151+ zLocalChannels[4 *iModA+2 ] = mMCP [iModA].Z ();
152+ zLocalChannels[4 *iModA+3 ] = mMCP [iModA].Z ();
153+ }
154+
155+ // Calculate then the positions for the channels for FT0-C, corresponding to the
156+ // channels 96-207 in the modules mMCP[24-51].
157+ for (int iModC = 0 ; iModC < NCellsC; iModC++) {
158+ xLocalChannels[4 *(iModC+NCellsA)+0 ] = mMCP [iModC+NCellsA].X () - delta;
159+ xLocalChannels[4 *(iModC+NCellsA)+1 ] = mMCP [iModC+NCellsA].X () + delta;
160+ xLocalChannels[4 *(iModC+NCellsA)+2 ] = mMCP [iModC+NCellsA].X () - delta;
161+ xLocalChannels[4 *(iModC+NCellsA)+3 ] = mMCP [iModC+NCellsA].X () + delta;
162+
163+ yLocalChannels[4 *(iModC+NCellsA)+0 ] = mMCP [iModC+NCellsA].Y () + delta;
164+ yLocalChannels[4 *(iModC+NCellsA)+1 ] = mMCP [iModC+NCellsA].Y () + delta;
165+ yLocalChannels[4 *(iModC+NCellsA)+2 ] = mMCP [iModC+NCellsA].Y () - delta;
166+ yLocalChannels[4 *(iModC+NCellsA)+3 ] = mMCP [iModC+NCellsA].Y () - delta;
167+
168+ zLocalChannels[4 *(iModC+NCellsA)+0 ] = mMCP [iModC+NCellsA].Z ();
169+ zLocalChannels[4 *(iModC+NCellsA)+1 ] = mMCP [iModC+NCellsA].Z ();
170+ zLocalChannels[4 *(iModC+NCellsA)+2 ] = mMCP [iModC+NCellsA].Z ();
171+ zLocalChannels[4 *(iModC+NCellsA)+3 ] = mMCP [iModC+NCellsA].Z ();
172+ }
173+
174+ // Convert the local ordering of the channels to the official one and apply it to the channel map.
175+ // localChannelOrder[local channel index] = official channel.
176+ Int_t localChannelOrder[Nchannels] = {
177+ 58 , 56 , 59 , 57 , 54 , 52 , 55 , 53 , 50 , 49 , 51 , 48 , 47 , 45 , 46 , 44 , 43 , 42 , 41 , 40 ,
178+ 61 , 60 , 63 , 62 , 14 , 12 , 15 , 13 , 10 , 9 , 11 , 8 , 7 , 6 , 5 , 4 , 39 , 38 , 37 , 36 ,
179+ 65 , 64 , 66 , 67 , 17 , 16 , 18 , 19 , 3 , 2 , 0 , 1 , 35 , 34 , 32 , 33 ,
180+ 68 , 69 , 70 , 71 , 20 , 21 , 22 , 23 , 24 , 27 , 25 , 26 , 29 , 31 , 28 , 30 , 94 , 95 , 92 , 93 ,
181+ 72 , 73 , 74 , 75 , 76 , 78 , 77 , 79 , 80 , 83 , 81 , 82 , 85 , 87 , 84 , 86 , 89 , 91 , 88 , 90 ,
182+ 173 , 172 , 175 , 174 , 206 , 207 , 204 , 205 , 169 , 168 , 171 , 170 , 202 , 203 , 200 , 201 ,
183+ 117 , 116 , 119 , 118 , 142 , 143 , 140 , 141 , 114 , 112 , 115 , 113 , 137 , 139 , 136 , 138 ,
184+ 166 , 164 , 167 , 165 , 197 , 199 , 196 , 198 , 110 , 108 , 111 , 109 , 133 , 135 , 132 , 134 ,
185+ 162 , 160 , 163 , 161 , 193 , 195 , 192 , 194 , 107 , 105 , 106 , 104 , 128 , 130 , 129 , 131 ,
186+ 159 , 157 , 158 , 156 , 188 , 190 , 189 , 191 , 99 , 98 , 97 , 96 , 120 , 121 , 122 , 123 ,
187+ 103 , 102 , 101 , 100 , 124 , 125 , 126 , 127 , 155 , 153 , 154 , 152 , 184 , 186 , 185 , 187 ,
188+ 147 , 146 , 145 , 144 , 176 , 177 , 178 , 179 , 151 , 150 , 149 , 148 , 180 , 181 , 182 , 183
189+ };
190+ for (int iChannel = 0 ; iChannel < Nchannels; iChannel++) {
191+ mChannelCenter [localChannelOrder[iChannel]].SetXYZ (xLocalChannels[iChannel], yLocalChannels[iChannel], zLocalChannels[iChannel]);
192+ }
193+
194+ }
0 commit comments