Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ] 

001 package atlantis.event;
002 
003 import atlantis.graphics.ACoord;
004 import atlantis.parameters.APar;
005 import atlantis.parameters.AParameter;
006 import atlantis.utils.AHashMap;
007 import atlantis.utils.AMath;
008 
009 
010 /*
011  * The input array clusters is being used to contain two types of information
012  * for pixel clusters
013  *      clusters[i][0] = identifier
014  *      clusters[i][1] = -1
015  * for space points from 2 strip clusters it contains the identifiers of the
016  * individual strips
017  *      clusters[i][0] = identifier of first strip
018  *      clusters[i][1] = identifier of second strip
019  */
020 public class AS3DData extends A3DPointData
021 {
022     private int[][] clusters = null;
023     // read from the event file
024     protected int[] layer = null;
025     private int[] etaModule = null;
026     private int[] phiModule = null;
027 
028     // for use by the filter loop, group[] is filled in by hit filter, other
029     // classes contain group functionality as well but currently (2006/08)
030     // hit filter takes into account only S3D (SiSpacePoint) data
031     protected int[] group = null;
032     private double[] eta = null;
033 
034     private boolean[] pixel = null;
035     public static final int PIXEL = -1;
036     public static final int CUT_INDET_SCT_ALL = -1;
037     public static final int CUT_INDET_SCT_EC_NEG = 0;
038     public static final int CUT_INDET_SCT_BARREL = 1;
039     public static final int CUT_INDET_SCT_EC_POS = 2;
040 
041 
042 
043     public String getParameterGroup()
044     {
045         return "S3D";
046     }
047 
048 
049     public String getName()
050     {
051         return "S3D";
052     }
053 
054 
055     public String getNameScreenName()
056     {
057         return "SpacePoint";
058     }
059 
060 
061     public String getHitInfo(int index)
062     {
063         String clId = clusters[index][0] + ", " + clusters[index][1];
064         String type = pixel[index]  ? " (Pixel hit)" : " (SCT hit)";
065 
066         String temp = getNameScreenName() + " (id: " + id[index] + " index: " + index + ")" +
067                       type +
068                       "\n cluster identifiers: " + clId +
069                       "\n x = " + AMath.d2s(x[index], 3) + " cm" +
070                       "\n y = " + AMath.d2s(y[index], 3) + " cm" +
071                       "\n z = " + AMath.d2s(z[index], 3) + " cm" +
072                       "\n " + AMath.RHO + " = " + AMath.d2s(rho[index], 3) +
073                       " cm" +
074                       "\n " + AMath.PHI + " = " +
075                       AMath.d2s(phi[index] * AMath.RADIANS_TO_DEGREES, 3) +
076                       AMath.DEGREES + "  (" + AMath.d2s(phi[index], 3) + " rad)" +
077                       "\n z = " + AMath.d2s(z[index], 3) + " cm" +
078                       "\n group = " + group[index];
079         temp += "\n " + AMath.ETA + " module = ";
080         temp += (etaModule != null) ? Integer.toString(etaModule[index]) : "n/a";
081         temp += "\n " + AMath.PHI + " module = ";
082         temp += (phiModule != null) ? Integer.toString(phiModule[index]) : "n/a";
083         temp += super.getHitInfo(index); // finds barcode information
084 
085         return temp;
086 
087     } // getHitInfo() ---------------------------------------------------------
088 
089 
090 
091     public AS3DData(AHashMap p, AEvent e)
092     {
093         super(p,e);
094 
095         etaModule = (p.get("etaModule") != null) ? p.getIntArray("etaModule") : null;
096         phiModule = (p.get("phiModule") != null) ? p.getIntArray("phiModule") : null;
097 
098         // use this for now as pixel id have bug i.e. sometimes > 0
099         layer = p.getUnknownIntArray("layer");
100         if(p.get("layer") == null || p.get("sub") == null)
101         {
102             calculateLayerSubdetector();
103         }
104         group = new int[numData];
105         eta = new double[numData];
106 
107         if(p.get("clusters") != null)
108         {
109             // can only distinguish between SCT and Pixel hits if clusters
110             // subtag is available
111             pixel = new boolean[numData];
112             // save IDs from event file to be availeble with pick info
113             clusters = new int[numData][];
114             int[][] assocClusters = new int[numData][];
115             int[] temp = p.getIntArray("clusters");
116             for(int i = 0; i < numData; i++)
117             {
118                 // save all clusters IDs
119                 clusters[i] = new int[] { temp[2 * i], temp[2 * i + 1] };
120 
121                 // check if the second number, PIXEL (-1) designates pixel hit
122                 if(temp[2 * i + 1] != PIXEL)
123                 {
124                     // this is SCT spacepoint - has got two clusters
125                     assocClusters[i] = new int[] { temp[2 * i], temp[2 * i + 1] };
126                 }
127                 else
128                 {
129                     // this is a pixel spacepoint (second cluster number is -1)
130                     pixel[i] = true;
131 
132                     // to ignore associtiation between pixel clusters and spacepoints:
133                     // assocClusters[i] = null;
134 
135                     // taking pixel cluster into account (pixel spacepoint has got
136                     // only one cluster) (where as SCT spacepoint has got two clusters)
137                     assocClusters[i] = new int[] { temp[2 * i] };
138                 }
139             }
140             AAssociationManager.add(new AAssociation(getName(), "SiCluster",
141                 assocClusters,event));
142         }
143     }
144 
145 
146 
147    protected void finalizeConstruction()
148    {
149        super.finalizeConstruction();
150        super.calculateAssociationViaClusters();
151 
152    } // finalizeConstruction() ----------------------------------------------
153 
154 
155 
156     protected int internalColor()
157     {
158         int numColorTypes = super.internalColor();
159         int colorFunction = APar.get(PARAMETER_GROUP, "ColorFunction").getI();
160         if(colorFunction == numColorTypes + 1)
161         {
162             colorByGroup();
163         }
164         else if(colorFunction == numColorTypes + 2)
165         {
166             colorBy(layer);
167         }
168         return numColorTypes + 2;
169 
170     } // internalColor() ----------------------------------------------------
171 
172 
173     protected void colorByGroup()
174     {
175         byte ungroupedColor;
176         if(APar.get(PARAMETER_GROUP, "Ungrouped").getStatus())
177             ungroupedColor = (byte) APar.get(PARAMETER_GROUP, "Ungrouped").getI();
178         else
179             ungroupedColor = (byte) APar.get(PARAMETER_GROUP, "Unconnected").
180                              getI();
181         int numColors = (byte) APar.get("HitColors", "Number").getI();
182         numColors = Math.min(7, numColors);
183         int[] col = APar.getArray("HitColors", "C1", numColors);
184         for(int i = 0; i < numData; i++)
185         {
186             if(group[i] == 0)
187                 color[i] = ungroupedColor;
188             else
189                 color[i] = (byte) col[(group[i] - 1) % numColors];
190         }
191     }
192 
193 
194 
195     /**
196      * define noise and good hits type = 0 means noise
197      * noise hits - hits associated neither with Track not STr
198      * good hits - hits associated either with Track or with STr plus
199      *   group information - set by the AFilter (hit filter)
200      */
201     protected void setType()
202     {
203         int[][] assocSTr = AAssociationManager.get(getName(), "STr");
204         int[][] assocRTr = AAssociationManager.get(getName(), getReconstructedTracks());
205         for(int i = 0; i < numData; i++)
206         {
207             if((assocSTr != null && assocSTr[i] != null) ||
208                (assocRTr != null && assocRTr[i] != null) || group[i] > 0)
209             {
210                 type[i] = 1;
211             }
212             else
213             {
214                 type[i] = 0;
215             }
216         }
217 
218     } // setType() ----------------------------------------------------------
219 
220 
221 
222     protected void applyCuts()
223     {
224         AData.printCut("S3D", numDraw);
225         cutIndex();
226         cutSubdetector();
227         cut("CutsInDet", "Layer", " Layer", layer);
228         cutPhi(phi);
229         cutEta(rho, z);
230         cutSimulatedTracks();
231         cutReconstructedTracks();
232         cut("CutsInDet", "Group", " Group", group);
233         if(etaModule != null)
234         {
235             cut("CutsInDet", "EtaModule", " EtaModule", etaModule);
236         }
237         if(phiModule != null)
238         {
239             cut("CutsInDet", "PhiModule", " PhiModule", phiModule);
240         }
241     }
242 
243 
244     private void cutSubdetector()
245     {
246         AParameter subPar = APar.get("CutsInDet", "SCT");
247         if(subPar.getI() != -1)
248             cutArray(sub, subPar.getI(), "Barrel/Endcap");
249     }
250 
251 
252     public int getLayer(int id)
253     {
254         int layer;
255         if(id > -1)
256             layer = (id >> 21) & 0xF;
257         else
258             layer = (id >> 27) & 0x3;
259         int sub = getSub(id);
260         if(id > -1)
261         {
262             // strips
263             if(sub == ASiClusterData.BARREL)
264                 layer += 3;
265             else
266                 layer += 11;
267         }
268         else
269         {
270             // pixels
271             if(sub != ASiClusterData.BARREL)
272                 layer += 7;
273         }
274         return layer;
275     }
276 
277 
278     public int getSub(int id)
279     {
280         if(id > -1)
281             return(id >> 25) & 0x3;
282         else
283             return(id >> 29) & 0x3;
284     }
285 
286 
287     private void calculateLayerSubdetector()
288     {
289         final double rhoPixelMax = 24.;
290         final double zBarrelPixelMax = 41.;
291         final double zBarrelStripsMax = 78.;
292         final double[] zEndcapPixel =
293                                       {51., 64., 90.};
294         final double[] zEndcapStrips =
295                                        {88., 98., 116., 134., 156., 190., 233.,
296                                        263.};
297         final double[] rhoBarrel =
298                                    {6.74, 11.5, 23., 34., 40., 48.};
299         for(int i = 0; i < numData; i++)
300         {
301             double z = Math.abs(this.z[i]);
302             double r = rho[i];
303             if(r < rhoPixelMax)
304             {
305                 // .............................................. pixels
306                 if(z < zBarrelPixelMax)
307                 {
308                     // ............................................ barrel
309                     sub[i] = 1;
310                     for(int l = 0; l < rhoBarrel.length; l++)
311                         if(r < rhoBarrel[l])
312                         {
313                             layer[i] = l;
314                             break;
315                         }
316                 }
317                 else
318                 {
319                     // ............................................ end cap
320                     layer[i] = 10;
321                     for(int l = 0; l < zEndcapPixel.length; l++)
322                     {
323                         if(z < zEndcapPixel[l])
324                         {
325                             layer[i] = 7 + l;
326                             break;
327                         }
328                     }
329                     if(this.z[i] < 0)
330                         sub[i] = 0;
331                     else
332                         sub[i] = 2;
333                 }
334             }
335             else
336             {
337                 // .............................................. strips
338 
339                 if(z < zBarrelStripsMax)
340                 {
341                     // ............................................ BARREL
342                     sub[i] = 1;
343                     layer[i] = 6;
344                     for(int l = 0; l < rhoBarrel.length; l++)
345                         if(r < rhoBarrel[l])
346                         {
347                             layer[i] = l;
348                             break;
349                         }
350                 }
351                 else
352                 {
353                     // ............................................ end cap
354                     layer[i] = 19;
355                     for(int l = 0; l < zEndcapStrips.length; l++)
356                     {
357                         if(z < zEndcapStrips[l])
358                         {
359                             layer[i] = 11 + l;
360                             break;
361                         }
362                     }
363                     if(this.z[i] < 0)
364                         sub[i] = 0;
365                     else
366                         sub[i] = 2;
367                 }
368             }
369         }
370     }
371 
372 
373     // drawlist to be used as input to the filter
374     public int makeFilterDrawList(double etaRange)
375     {
376         calculateRhoPhi();
377 
378         // overwrite the input array to improve speed
379         numDraw = 0;
380         for(int i = 0; i < numData; i++)
381         {
382             double eta = AMath.eta(z[i], rho[i]);
383             this.eta[i] = eta;
384             if(eta > -etaRange && eta < etaRange)
385             {
386                 listdl[numDraw++] = i;
387             }
388         }
389 
390         return numDraw;
391     }
392 
393 
394     public int[] getIntegerEta(int numBins, double etaRange, int[] integerEta)
395     {
396         // overwrite the input array to improve speed
397         double binWidth = 2 * etaRange / numBins;
398         double etaRangeOptimised = etaRange + binWidth;
399         for(int i = 0; i < numDraw; i++)
400             // implicit (int) conversion only does correct thing if positive
401             integerEta[i] = (int) ((eta[listdl[i]] + etaRangeOptimised) /
402                                    binWidth);
403         return integerEta;
404     }
405 
406 
407     public int[] getIntegerPhi(int numBins, double skew, int[] integerPhi)
408     {
409         calculateRhoPhi();
410         // overwrite the input array to improve speed
411         double binWidth = 2 * Math.PI / numBins;
412         for(int i = 0; i < numDraw; i++)
413         {
414             // can only be positive
415             // add one to treat wraparound efficiently
416             double p = phi[listdl[i]] - skew * rho[listdl[i]];
417             if(p < 0.)
418                 p += 2 * Math.PI;
419             else if(p > 2 * Math.PI)
420                 p -= 2 * Math.PI;
421             integerPhi[i] = (int) (p / binWidth) + 1;
422         }
423         return integerPhi;
424     }
425 
426 
427     public int[] getLayer(int[] layer)
428     {
429         for(int i = 0; i < numDraw; i++)
430             layer[i] = this.layer[listdl[i]];
431         return layer;
432     }
433 
434 
435     public void setGroup(int[] group)
436     {
437         for(int i = 0; i < numData; i++)
438             this.group[i] = 0;
439         for(int i = 0; i < numDraw; i++)
440             this.group[listdl[i]] = group[i];
441     }
442 
443 
444     protected ACoord getFRUser()
445     {
446         if(!APar.get("SiCluster", "Stereo").getStatus())return super.getFRUser();
447         makeDrawList();
448         double[] h = new double[numDraw];
449         double[] v = new double[numDraw];
450         int[] index = new int[numDraw];
451         for(int i = 0; i < numDraw; i++)
452         {
453             int list = listdl[i];
454             h[i] = rho[list];
455             v[i] = AMath.getPhiStereo(rho[list], phi[list], z[list]) *
456                    AMath.RADIANS_TO_DEGREES;
457             index[i] = list;
458         }
459         return new ACoord(h, v, index, this).includePhiWrapAround("FR");
460     }
461 
462 
463     protected ACoord getFZUser()
464     {
465         if(!APar.get("SiCluster", "Stereo").getStatus())return super.getFZUser();
466         makeDrawList();
467         double[] h = new double[numDraw];
468         double[] v = new double[numDraw];
469         int[] index = new int[numDraw];
470         for(int i = 0; i < numDraw; i++)
471         {
472             int list = listdl[i];
473             h[i] = z[list];
474             v[i] = AMath.getPhiStereo(rho[list], phi[list], z[list]) *
475                    AMath.RADIANS_TO_DEGREES;
476             index[i] = list;
477         }
478         return new ACoord(h, v, index, this).includePhiWrapAround("FZ");
479     }
480 
481 } // class AS3DData =========================================================
482 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!