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.utils;
002 
003 import java.util.ArrayList;
004 
005 /**
006  * This class contains methods for extracting various properties from the 32 bit
007  * identifiers used for hits. It works very similarly to the IdHelpers in Athena,
008  * hence its name.
009  *
010  * @author Eric Jansen
011  */
012 public class AIdHelper {
013 
014     // These and all the other numbers in this class have been taken from Athena.
015     private static final int MAX_BIT = 0x80000000;
016     private static final int PIXEL_MASK = 0x000000FF;
017     private static final int[] SUBDETECTOR = {2, 4, 5, 7, 10};
018     private static final int[] LAR_PART = {-3, -2, -1, 1, 2, 3, 4, 5};
019     private static final int[] LAR_BARREL_ENDCAP = {-3, -2, -1, 1, 2, 3};
020     private static final int[] LAR_POS_NEG = {-2, 2};
021     private static final String[] STATION_NAME = {"BIL", "BIS", "BML", "BMS", "BOL", "BOS", "BEE", "BIR",
022                                                   "BMF", "BOF", "BOG", "EIL", "EEL", "EES", "EML", "EMS",
023                                                   "EOL", "EOS", "T1F", "T1E", "T2F", "T2E", "T3F", "T3E",
024                                                   "T4F", "T4E", "EIS", "CSS", "CSL", "BIM"};
025     private static final int[] CSC_ETA = {-1, 1};
026     private static final int[] TGC_ETA = {-5, -4, -3, -2, -1, 1, 2, 3, 4, 5};
027     private static final int[] SCT_BARREL_ENDCAP = {-2, 0, 2};
028     private static final int[] TRT_BARREL_ENDCAP = {-2, -1, 1, 2};
029     
030     
031     
032 
033     /**
034      * Returns the decoded athena identifier (id) as a string, resp. an
035      * array of strings: first item is the full id expanded (decoded) and
036      * particular subparts are separated by "/" in one sting, further
037      * interesting subparts of the decoded id are provided in the following
038      * items of the array with an explanation given.
039      * So far (2009-01-20), this is implemented only for LAr and Tile, for
040      * other subsystems only first array item is returned with the expanded
041      * id.
042      * @param id int compact identifier
043      * @return String decoded identifier
044      */
045     public static final String[] getFullIdentifier(int id)
046     {
047         // more than 10 items should not be necessary
048         ArrayList<String> r = new ArrayList<String>(10);
049         String s = null;
050 
051         try 
052         {
053             switch (subDetector(id))
054             {
055                 case 2:
056                     switch (indetPart(id))
057                     {
058                         case 1:
059                             // Pixel identifiers are complicated and we don't use them anyway.
060                             throw new AAtlantisException("Pixel identifiers not implemented: " + id);
061                         case 2:
062                             s = "2/2/" + sctBarrelEndcap(id) + "/" +
063                                 sctLayerDisk(id) + "/" + sctPhiModule(id) + "/" +
064                                 sctEtaModule(id) + "/" + sctPhiIndex(id) + "/" +
065                                 sctEtaIndex(id); 
066                             r.add(s);
067                             return r.toArray(new String[r.size()]);
068                         case 3:
069                             
070                             int part = 3;
071                             int barrelEndcap = trtBarrelEndcap(id);
072                             int layerWheel = trtLayerWheel(id);
073                             int phiModule = trtPhiModule(id);
074                             int strawLayer = trtStrawLayer(id);
075                             int straw = trtStraw(id);
076                                    
077                             s = "2" + "/" + part + "/" + barrelEndcap + "/" +
078                                 layerWheel + "/" + phiModule + "/" + strawLayer +
079                                 "/" + straw;
080                             r.add(s);
081                             r.add("barrel-endcap: " + barrelEndcap);
082                             r.add("layer wheel: " + layerWheel);
083                             r.add("phi module: " + phiModule);
084                             r.add("straw layer: " + strawLayer);
085                             r.add("straw: " + straw);
086                             return r.toArray(new String[r.size()]);
087                             
088                         default:
089                             throw new AAtlantisException("Invalid identifier: " + id);
090                     }
091                 case 4:
092                     int part = larPart(id);
093                     int sampling = larSampling(id);
094                     int eta = larEta(id);
095                     int phi = larPhi(id);
096                     
097                     if(part == 1) // LAr barrel, LAr endcap
098                     {
099                         int barrelEndcap = larBarrelEndcap(id);
100                         int region = larRegion(id);
101                         s = "4/" + part + "/" + barrelEndcap + "/" +
102                             sampling + "/" + region + "/" + eta + "/" + phi;
103                         r.add(s);
104                         if(barrelEndcap == 1)
105                         {
106                             r.add("barrel A");
107                         }
108                         else if(barrelEndcap == -1)
109                         {
110                             r.add("barrel C");
111                         }
112                         else if(barrelEndcap == 2 || barrelEndcap == 3)
113                         {
114                             r.add("endcap A");
115                         }
116                         else if(barrelEndcap == -2 || barrelEndcap == -3)
117                         {
118                             r.add("endcap C");
119                         }
120                     }
121                     else if(part == 2) // HEC
122                     {
123                         int posNeg = larPosNeg(id);
124                         int region = larRegion(id);
125                         s = "4/" + part + "/" + posNeg + "/" + sampling + "/" +
126                             region + "/" + eta + "/" + phi;
127                         r.add(s);
128                         if(posNeg == 2)
129                         {
130                             r.add("endcap A");
131                         }
132                         else if(posNeg == -2)
133                         {
134                             r.add("endcap C");
135                         }
136                     }
137                     else if(part == 3) // FCAL
138                     {
139                         int posNeg = larPosNeg(id);
140                         s = "4/" + part + "/" + posNeg + "/" + sampling + "/" +
141                             eta + "/" + phi;
142                         r.add(s);
143                         if(posNeg == 2)
144                         {
145                             r.add("endcap A");
146                         }
147                         else if(posNeg == -2)
148                         {
149                             r.add("endcap C");
150                         }                        
151                     }
152                     else
153                     {
154                         throw new AAtlantisException("Invalid identifier: " + id);
155                     }
156                     
157                     r.add("sampling: " + sampling); // sampling remains          
158                     
159                     return r.toArray(new String[r.size()]);
160                     
161                 case 5:
162                     // tile calorimeter (first number of full id is 5)
163                     int section = tileSection(id);
164                     int side = tileSide(id);
165                     int module = tileSide(id);
166                     int tower = tileTower(id);
167                     sampling = tileSampling(id);
168                     int pmt = tilePmt(id);
169                     int adc = tileAdc(id);
170                     
171                     s = "5/" + section + "/" + side + "/" + module + "/" + 
172                         tower + "/" + sampling + "/" + pmt + "/" + adc;
173                     r.add(s);
174                     
175                     r.add("section: " + section);
176                     r.add("side: " + side);
177                     r.add("module: " + module);
178                     r.add("tower: " + tower);
179                     r.add("sampling: " + sampling);
180                     r.add("PMT: " + pmt);
181                     r.add("ADC: " + adc);
182                     
183                     return r.toArray(new String[r.size()]);
184                     
185                 case 7:
186                     String technology = technology(id);
187                     if (technology == "MDT") 
188                     {
189                         s = "7/" + stationName(id) + "/" + stationEta(id) +
190                             "/" + stationPhi(id) + "/" + "MDT/" +
191                             mdtMultiLayer(id) + "/" + mdtTubeLayer(id) + "/" +
192                             mdtTube(id);
193                         r.add(s);
194                         return r.toArray(new String[r.size()]);
195                     }
196                     else if (technology == "RPC")
197                     {
198                         s = "7/" + stationName(id) + "/" + stationEta(id) + "/" +
199                             stationPhi(id) + "/" + "RPC/" + rpcDoubletR(id) + "/" +
200                             rpcDoubletZ(id) + "/" + rpcDoubletPhi(id) + "/" +
201                             rpcGasGap(id) + "/" + rpcMeasuresPhi(id) + "/" +
202                             rpcStrip(id);
203                         r.add(s);
204                         return r.toArray(new String[r.size()]);
205                     }
206                     else if (technology == "TGC")
207                     {
208                         s = "7/" + stationName(id) + "/" + stationEta(id) +
209                             "/" + stationPhi(id) + "/" + "TGC/" + tgcGasGap(id) +
210                             "/" + tgcIsStrip(id) + "/" + tgcChannel(id);
211                         r.add(s);
212                         return r.toArray(new String[r.size()]);                        
213                     }
214                     else if (technology == "CSC")
215                     {
216                         s = "7/" + stationName(id) + "/" + stationEta(id) + "/" +
217                             stationPhi(id) + "/" + "CSC/" + cscChamberLayer(id) +
218                             "/" + cscWireLayer(id) + "/" + cscMeasuresPhi(id) +
219                             "/" + cscStrip(id);
220                         r.add(s);
221                         return r.toArray(new String[r.size()]);                                                
222                     }
223                     else
224                     {
225                         throw new AAtlantisException("Invalid identifier: " + id);
226                     }
227                 default:
228                     throw new AAtlantisException("Not yet implemented for identifier: " + id);
229             }
230         } 
231         catch (AAtlantisException e) 
232         {
233             s = id + " (unable to decode: " + e.getMessage() + ")";
234             r.add(s);
235             return r.toArray(new String[r.size()]);                                                
236         }
237         
238     } // getFullIdentifier() ------------------------------------------------
239 
240     
241     
242     /**
243      * Extracts the subdetector field.
244      * @param id int compact identifier
245      * @return int subdetector identifier
246      * @throws AAtlantisException
247      */
248     public static final int subDetector(int id) throws AAtlantisException {
249         int subDetectorIndex = id >> 29 & 7;
250         if (subDetectorIndex >= SUBDETECTOR.length) {
251             throw new AAtlantisException("Invalid subdetector field in identifier: " + id);
252         }
253         return SUBDETECTOR[subDetectorIndex];
254     }
255 
256     public static final int indetPart(int id) throws AAtlantisException {
257         if (subDetector(id) != 2) {
258             throw new AAtlantisException("Not an InDet identifier: " + id);
259         }
260         if ((id & MAX_BIT) == MAX_BIT && (id & PIXEL_MASK) > 0) {
261             return 1;
262         } else {
263             return (id >> 27 & 3) + 1;
264         }
265     }
266 
267     public static final int trtBarrelEndcap(int id) throws AAtlantisException {
268         if (indetPart(id) != 3) {
269             throw new AAtlantisException("Not a TRT identifier: " + id);
270         }
271         int trtBarrelEndcapIndex = id >> 25 & 3;
272         if (trtBarrelEndcapIndex >= TRT_BARREL_ENDCAP.length) {
273             throw new AAtlantisException("Invalid barrelEndcap field in identifier: " + id);
274         }
275         return TRT_BARREL_ENDCAP[trtBarrelEndcapIndex];
276     }
277 
278 
279     public static final int trtLayerWheel(int id) throws AAtlantisException {
280         if (indetPart(id) != 3) {
281             throw new AAtlantisException("Not a TRT identifier: " + id);
282         }
283         return id >> 15 & 31;
284     }
285 
286     public static final int trtPhiModule(int id) throws AAtlantisException {
287         if (indetPart(id) != 3) {
288             throw new AAtlantisException("Not a TRT identifier: " + id);
289         }
290         return id >> 20 & 31;
291     }
292 
293     public static final int trtStrawLayer(int id) throws AAtlantisException {
294         if (indetPart(id) != 3) {
295             throw new AAtlantisException("Not a TRT identifier: " + id);
296         }
297         return id >> 10 & 31;
298     }
299 
300     public static final int trtStraw(int id) throws AAtlantisException {
301         if (indetPart(id) != 3) {
302             throw new AAtlantisException("Not a TRT identifier: " + id);
303         }
304         return id >> 5 & 31;
305     }
306 
307     public static final int sctBarrelEndcap(int id) throws AAtlantisException {
308          if (indetPart(id) != 2) {
309              throw new AAtlantisException("Not an SCT identifier: " + id);
310          }
311          int sctBarrelEndcapIndex = id >> 25 & 3;
312          if (sctBarrelEndcapIndex >= SCT_BARREL_ENDCAP.length) {
313              throw new AAtlantisException("Invalid barrelEndcap field in identifier: " + id);
314          }
315          return SCT_BARREL_ENDCAP[sctBarrelEndcapIndex];
316     }
317 
318     public static final int sctLayerDisk(int id) throws AAtlantisException {
319         if (indetPart(id) != 2) {
320             throw new AAtlantisException("Not an SCT identifier: " + id);
321         }
322         return id >> 21 & 15;
323     }
324 
325     public static final int sctPhiModule(int id) throws AAtlantisException {
326         if (indetPart(id) != 2) {
327             throw new AAtlantisException("Not an SCT identifier: " + id);
328         }
329         return id >> 15 & 63;
330     }
331 
332     public static final int sctEtaModule(int id) throws AAtlantisException {
333         if (indetPart(id) != 2) {
334             throw new AAtlantisException("Not an SCT identifier: " + id);
335         }
336         return (id >> 11 & 15) - 6;
337     }
338 
339     public static final int sctPhiIndex(int id) throws AAtlantisException {
340         if (indetPart(id) != 2) {
341             throw new AAtlantisException("Not an SCT identifier: " + id);
342         }
343         return id >> 10 & 1;
344     }
345 
346     public static final int sctEtaIndex(int id) throws AAtlantisException {
347         if (indetPart(id) != 2) {
348             throw new AAtlantisException("Not an SCT identifier: " + id);
349         }
350         return id & 1023;
351     }
352 
353     public static final int larPart(int id) throws AAtlantisException {
354         if (subDetector(id) != 4) {
355             throw new AAtlantisException("Not a LAr identifier: " + id);
356         }
357         int larPartIndex = id >> 26 & 7;
358         if(larPartIndex >= LAR_PART.length) {
359             throw new AAtlantisException("Invalid part field in identifier: " + id);
360         }
361         return LAR_PART[larPartIndex];
362     }
363 
364     public static final int larBarrelEndcap(int id) throws AAtlantisException {
365         if (subDetector(id) != 4) {
366             throw new AAtlantisException("Not a LAr identifier: " + id);
367         }
368         int larBarrelEndcapIndex = id >> 23 & 7;
369         if(larBarrelEndcapIndex >= LAR_BARREL_ENDCAP.length) {
370             throw new AAtlantisException("Invalid barrel-endcap field in identifier: " + id);
371         }
372         return LAR_BARREL_ENDCAP[larBarrelEndcapIndex];
373     }
374 
375     public static final int larPosNeg(int id) throws AAtlantisException {
376         if (larPart(id) < 2) {
377             throw new AAtlantisException("Not a LAr HEC/FCAL identifier: " + id);
378         }
379         int larPosNegIndex = id >> 25 & 1;
380         if(larPosNegIndex >= LAR_POS_NEG.length) {
381             throw new AAtlantisException("Invalid pos-neg field in identifier: " + id);
382         }
383         return LAR_POS_NEG[larPosNegIndex];
384     }
385 
386     public static final int larSampling(int id) throws AAtlantisException {
387         switch (larPart(id)) {
388             case 1:
389                 return id >> 21 & 3;
390             case 2:
391             case 3:
392                 return id >> 23 & 3;
393             default:
394                 throw new AAtlantisException("Not a LAr EM/HEC identifier: " + id);
395         }
396     }
397 
398     public static final int larRegion(int id) throws AAtlantisException {
399         switch (larPart(id)) {
400             case 1:
401                 return id >> 18 & 7;
402             case 2:
403                 return id >> 22 & 1;
404             default:
405                 throw new AAtlantisException("Not a LAr EM/HEC identifier: " + id);
406         }
407     }
408 
409     public static final int larEta(int id) throws AAtlantisException {
410         switch (larPart(id)) {
411             case 1:
412                 return id >> 9 & 511;
413             case 2:
414                 return id >> 18 & 15;
415             case 3:
416                 return id >> 17 & 63;
417             default:
418                 throw new AAtlantisException("Not a LAr EM/HEC/FCAL identifier: " + id);
419         }
420     }
421 
422     public static final int larPhi(int id) throws AAtlantisException {
423         switch (larPart(id)) {
424             case 1:
425                 return id >> 1 & 255;
426             case 2:
427                 return id >> 12 & 63;
428             case 3:
429                 return id >> 13 & 15;
430             default:
431                 throw new AAtlantisException("Not a LAr EM/HEC/FCAL identifier: " + id);
432         }
433     }
434 
435     public static final int larModule(int id) throws AAtlantisException {
436         if (larPart(id) != 3) {
437             throw new AAtlantisException("Not an FCAL identifier: " + id);
438         }
439         return id >> 21 & 3;
440     }
441 
442 
443     public static final boolean larIsBarrel(int id) throws AAtlantisException
444     {
445         switch(Math.abs(larBarrelEndcap(id)))
446         {
447             case 1:
448                 return true;  // yes, it's barrel
449             case 2:
450                 return false; // is endcap
451             case 3:
452                 return false; // is endcap
453             default:
454                 throw new AAtlantisException("Not a LAr identifier: " + id);
455         }
456     }
457 
458 
459     public static final int tileSection(int id) throws AAtlantisException {
460         if (subDetector(id) != 5) {
461             throw new AAtlantisException("Not a TILE identifier: " + id);
462         }
463         return id >> 26 & 7;
464     }
465 
466     public static final int tileSide(int id) throws AAtlantisException {
467         if (subDetector(id) != 5) {
468             throw new AAtlantisException("Not a TILE identifier: " + id);
469         }
470         return (id >> 22 & 15) - 1;
471     }
472 
473     public static final int tileModule(int id) throws AAtlantisException {
474         if (subDetector(id) != 5) {
475             throw new AAtlantisException("Not a TILE identifier: " + id);
476         }
477         return id >> 14 & 255;
478     }
479 
480     public static final int tileTower(int id) throws AAtlantisException {
481         if (subDetector(id) != 5) {
482             throw new AAtlantisException("Not a TILE identifier: " + id);
483         }
484         return id >> 8 & 63;
485     }
486 
487     public static final int tileSampling(int id) throws AAtlantisException {
488         if (subDetector(id) != 5) {
489             throw new AAtlantisException("Not a TILE identifier: " + id);
490         }
491         return id >> 4 & 15;
492     }
493 
494     public static final int tilePmt(int id) throws AAtlantisException {
495         if (subDetector(id) != 5) {
496             throw new AAtlantisException("Not a TILE identifier: " + id);
497         }
498         return id >> 2 & 3;
499     }
500 
501     public static final int tileAdc(int id) throws AAtlantisException {
502         if (subDetector(id) != 5) {
503             throw new AAtlantisException("Not a TILE identifier: " + id);
504         }
505         return id & 3;
506     }
507 
508 
509     /**
510      * Decodes Athena 32-bit ID to following form (5 is Tile):
511      * 5/section/side/module/tower/sampling/pmt/adc - official identifier
512      *
513      * Identifier used by TileCal collaboration, conversion is clear from the
514      * code and is explained in Sasha Solodkov's email on 2006-09-18
515      *
516      * @param id int
517      * @return String
518      */
519     public static final String getDecodedTileIndentifier(int id)
520     {
521         try
522         {
523             int sec = tileSection(id);
524             int side = tileSide(id);
525             int mod = tileModule(id);
526             int tow = tileTower(id);
527             int samp = tileSampling(id);
528 
529             // section/side/module into decoded form
530             String secSideMod = "\n[could not work out section/side]";
531             mod++;
532             if(sec == 1 && side == 1)  secSideMod = "LBA" + mod;
533             if(sec == 1 && side == -1) secSideMod = "LBC" + mod;
534             if(sec == 2 && side == 1)  secSideMod = "EBA" + mod;
535             if(sec == 3 && side == 1)  secSideMod = "EBA" + mod;
536             if(sec == 2 && side == -1) secSideMod = "EBC" + mod;
537             if(sec == 3 && side == -1) secSideMod = "EBC" + mod;
538 
539             // sampling/tower into decoded form
540             String sampTow = "\n[could not work out sampling/tower]";
541             if(samp == 0) sampTow = "A" + (int)(tow + 1);
542             if(samp == 1) sampTow = "B" + (int)(tow + 1);
543             if(samp == 2) sampTow = "D" + (int)(tow/2);
544             if(samp == 3)
545             {
546                 if(tow == 10) sampTow = "E1";
547                 if(tow == 11) sampTow = "E2";
548                 if(tow == 13) sampTow = "E3";
549                 if(tow == 15) sampTow = "E4";
550             }
551 
552             return secSideMod + " " + sampTow;
553         }
554         catch (AAtlantisException e)
555         {
556             return id + " (unable to decode: " + e.getMessage() + ")";
557         }
558     }
559 
560 
561     /**
562      * Extracts the station name for a muon station.
563      * @param id int compact identifier
564      * @return String station name
565      * @throws AAtlantisException
566      */
567     public static final String stationName(int id) throws AAtlantisException {
568         if (subDetector(id) != 7) {
569             throw new AAtlantisException("Invalid subdetector field in identifier: " + id);
570         }
571         int stationNameIndex = id >> 24 & 31;
572         if (stationNameIndex >= STATION_NAME.length) {
573             throw new AAtlantisException("Invalid stationName field in identifier: " + id);
574         }
575         return STATION_NAME[stationNameIndex];
576     }
577 
578     /**
579      * Extracts the technology (MDT, RPC, TGC, CSC) for a muon station.
580      * @param id int compact identifier
581      * @return String technology
582      * @throws AAtlantisException
583      */
584     public static final String technology(int id) throws AAtlantisException {
585         String stationName = stationName(id);
586         switch (stationName.charAt(0)) {
587             case 'T':
588                 return "TGC";
589             case 'C':
590                 return "CSC";
591             default:
592                 int technologyIndex = id >> 15 & 1;
593                 switch (technologyIndex) {
594                     case 0:
595                         return "MDT";
596                     case 1:
597                         return "RPC";
598                     default:
599                         throw new AAtlantisException("Invalid technology field in identifier: " + id);
600                 }
601         }
602     }
603 
604     /**
605      * Extracts the eta index for a muon station.
606      * @param id int compact identifier
607      * @return int eta index
608      * @throws AAtlantisException
609      */
610     public static final int stationEta(int id) throws AAtlantisException {
611         int etaIndex;
612         String technology = technology(id);
613 
614         if (technology.equals("MDT") || technology.equals("RPC")) {
615             return (id >> 19 & 31) - 8;
616         } else if (technology.equals("TGC")) {
617             etaIndex = id >> 20 & 15;
618             if (etaIndex >= TGC_ETA.length) {
619                 return 0;
620             } else {
621                 return TGC_ETA[etaIndex];
622             }
623         } else if (technology.equals("CSC")) {
624             etaIndex = id >> 23 & 1;
625             if (etaIndex >= CSC_ETA.length) {
626                 return 0;
627             } else {
628                 return CSC_ETA[etaIndex];
629             }
630         } else {
631             throw new AAtlantisException("Invalid stationEta field in identifier: " + id);
632         }
633     }
634 
635     /**
636      * Extracts the phi index for a muon station.
637      * @param id int compact identifier
638      * @return int phi index
639      * @throws AAtlantisException
640      */
641     public static final int stationPhi(int id) throws AAtlantisException {
642         String technology = technology(id);
643         if (technology.equals("MDT") || technology.equals("RPC")) {
644             return (id >> 16 & 7) + 1;
645         } else if (technology.equals("TGC")) {
646             return (id >> 14 & 63) + 1;
647         } else if (technology.equals("CSC")) {
648             return (id >> 20 & 7) + 1;
649         } else {
650             throw new AAtlantisException("Invalid technology field in identifier: " + id);
651         }
652     }
653 
654     /**
655      * Extracts the MDT multilayer index from an MDT identifier.
656      * @param id int compact identifier
657      * @return int multilayer index
658      * @throws AAtlantisException
659      */
660     public static final int mdtMultiLayer(int id) throws AAtlantisException {
661         if (!technology(id).equals("MDT")) {
662             throw new AAtlantisException("Not an MDT identifier: " + id);
663         }
664         return (id >> 14 & 1) + 1;
665     }
666 
667     /**
668      * Extracts the MDT tubelayer index from an MDT identifier.
669      * @param id int compact identifier
670      * @return int tubelayer index
671      * @throws AAtlantisException
672      */
673     public static final int mdtTubeLayer(int id) throws AAtlantisException {
674         if (!technology(id).equals("MDT")) {
675             throw new AAtlantisException("Not an MDT identifier: " + id);
676         }
677         return (id >> 12 & 3) + 1;
678     }
679 
680     /**
681      * Extracts the tube number from an MDT identifier.
682      * @param id int compact identifier
683      * @return int tube number
684      * @throws AAtlantisException
685      */
686     public static final int mdtTube(int id) throws AAtlantisException {
687         if (!technology(id).equals("MDT")) {
688             throw new AAtlantisException("Not an MDT identifier: " + id);
689         }
690         return (id >> 5 & 127) + 1;
691     }
692 
693     /**
694      * Extracts the RPC doublet index in r.
695      * @param id int compact identifier
696      * @return int RPC r doublet index
697      * @throws AAtlantisException
698      */
699     public static final int rpcDoubletR(int id) throws AAtlantisException {
700         if (!technology(id).equals("RPC")) {
701             throw new AAtlantisException("Not an RPC identifier: " + id);
702         }
703         return (id >> 14 & 1) + 1;
704     }
705 
706     /**
707      * Extracts the RPC doublet index in z.
708      * @param id int compact identifier
709      * @return int RPC z doublet index
710      * @throws AAtlantisException
711      */
712     public static final int rpcDoubletZ(int id) throws AAtlantisException {
713         if (!technology(id).equals("RPC")) {
714             throw new AAtlantisException("Not an RPC identifier: " + id);
715         }
716         return (id >> 12 & 3) + 1;
717     }
718 
719     /**
720      * Extracts the RPC doublet index in phi.
721      * @param id int
722      * @return int
723      * @throws AAtlantisException
724      */
725     public static final int rpcDoubletPhi(int id) throws AAtlantisException {
726         if (!technology(id).equals("RPC")) {
727             throw new AAtlantisException("Not an RPC identifier: " + id);
728         }
729         return (id >> 11 & 1) + 1;
730     }
731 
732     /**
733      * Extract the RPC gas gap index.
734      * @param id int compact identifier
735      * @return int gas gap index
736      * @throws AAtlantisException
737      */
738     public static final int rpcGasGap(int id) throws AAtlantisException {
739         if (!technology(id).equals("RPC")) {
740             throw new AAtlantisException("Not an RPC identifier: " + id);
741         }
742         return (id >> 10 & 1) + 1;
743     }
744 
745     /**
746      * Extracts if this elment measures phi or not.
747      * @param id int compact identifier
748      * @return int true (1) or false (0)
749      * @throws AAtlantisException
750      */
751     public static final int rpcMeasuresPhi(int id) throws AAtlantisException {
752         if (!technology(id).equals("RPC")) {
753             throw new AAtlantisException("Not an RPC identifier: " + id);
754         }
755         return id >> 9 & 1;
756     }
757 
758     /**
759      * Extracts the RPC strip number.
760      * @param id int compact identifier
761      * @return int strip number
762      * @throws AAtlantisException
763      */
764     public static final int rpcStrip(int id) throws AAtlantisException {
765         if (!technology(id).equals("RPC")) {
766             throw new AAtlantisException("Not an RPC identifier: " + id);
767         }
768         return (id >> 2 & 127) + 1;
769     }
770 
771     /**
772      * Extracts the RGC gas gap index
773      * @param id int compact identifier
774      * @return int gas gap index
775      * @throws AAtlantisException
776      */
777     public static final int tgcGasGap(int id) throws AAtlantisException {
778         if (!technology(id).equals("TGC")) {
779             throw new AAtlantisException("Not a TGC identifier: " + id);
780         }
781         return (id >> 11 & 3) + 1;
782     }
783 
784     /**
785      * Extract if this element is a strip or not.
786      * @param id int compact identifier
787      * @return int true (1) or false (0)
788      * @throws AAtlantisException
789      */
790     public static final int tgcIsStrip(int id) throws AAtlantisException {
791         if (!technology(id).equals("TGC")) {
792             throw new AAtlantisException("Not a TGC identifier: " + id);
793         }
794         return id >> 10 & 1;
795     }
796 
797     /**
798      * Extracts the TGC channel number.
799      * @param id int compact identifier
800      * @return int channel number
801      * @throws AAtlantisException
802      */
803     public static final int tgcChannel(int id) throws AAtlantisException {
804         if (!technology(id).equals("TGC")) {
805             throw new AAtlantisException("Not a TGC identifier: " + id);
806         }
807         return (id >> 3 & 127) + 1;
808     }
809 
810     /**
811      * Extracts the chamber layer for a CSC.
812      * @param id int compact identifier
813      * @return int chamber layer
814      * @throws AAtlantisException
815      */
816     public static final int cscChamberLayer(int id) throws AAtlantisException {
817         if (!technology(id).equals("CSC")) {
818             throw new AAtlantisException("Not a CSC identifier: " + id);
819         }
820         return (id >> 18 & 1) + 1;
821     }
822 
823     /**
824      * Extracts the wire layer for a CSC
825      * @param id int compact identifier
826      * @return int wire layer
827      * @throws AAtlantisException
828      */
829     public static final int cscWireLayer(int id) throws AAtlantisException {
830         if (!technology(id).equals("CSC")) {
831             throw new AAtlantisException("Not a CSC identifier: " + id);
832         }
833         return (id >> 16 & 3) + 1;
834     }
835 
836     /**
837      * Extracts if this CSC element measures phi or not.
838      * @param id int compact identifier
839      * @return int true (1) or false (0)
840      * @throws AAtlantisException
841      */
842     public static final int cscMeasuresPhi(int id) throws AAtlantisException {
843         if (!technology(id).equals("CSC")) {
844             throw new AAtlantisException("Not a CSC identifier: " + id);
845         }
846         return id >> 15 & 1;
847     }
848 
849     /**
850      * Extracts the CSC strip number.
851      * @param id int compact identifier
852      * @return int strip number
853      * @throws AAtlantisException
854      */
855     public static final int cscStrip(int id) throws AAtlantisException {
856         if (!technology(id).equals("CSC")) {
857             throw new AAtlantisException("Not a CSC identifier: " + id);
858         }
859         return (id >> 7 & 255) + 1;
860     }
861 }

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!