]>
Commit | Line | Data |
---|---|---|
916f1e76 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | ||
18 | ||
19 | ||
20 | Patch object implementation: one patch is made of subregions (Olivier's nomenclature) | |
21 | Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3 | |
22 | */ | |
23 | ||
24 | #include "AliEMCALTriggerPatch.h" | |
25 | #include "AliRunLoader.h" | |
26 | #include "AliRun.h" | |
27 | #include "AliEMCALGeometry.h" | |
28 | #include "AliEMCAL.h" | |
29 | ||
30 | #include "TArrayI.h" | |
31 | ||
32 | ClassImp(AliEMCALTriggerPatch) | |
33 | ||
34 | //____________ | |
35 | AliEMCALTriggerPatch::AliEMCALTriggerPatch() : TObject(), | |
36 | fPosition(0x0), | |
37 | fSum(0) | |
38 | { | |
39 | // Default constructor | |
40 | } | |
41 | ||
42 | //____________ | |
43 | AliEMCALTriggerPatch::AliEMCALTriggerPatch( Int_t i, Int_t j, Int_t k ) : TObject(), | |
44 | fPosition(new TVector2( i , j )), | |
45 | fSum(k) | |
46 | { | |
47 | } | |
48 | ||
49 | //____________ | |
50 | ||
51 | //____________________________________________________________________ | |
52 | AliEMCALTriggerPatch::AliEMCALTriggerPatch(const AliEMCALTriggerPatch& other) : TObject(other), | |
53 | fPosition( new TVector2(*other.fPosition) ), | |
54 | fSum( other.fSum ) | |
55 | { | |
56 | // Copy ctor | |
57 | } | |
58 | ||
59 | //____________ | |
60 | AliEMCALTriggerPatch::~AliEMCALTriggerPatch() | |
61 | { | |
62 | if (fPosition) delete fPosition; | |
63 | } | |
64 | ||
65 | //____________ | |
66 | void AliEMCALTriggerPatch::Print(const Option_t*) const | |
67 | { | |
68 | printf("]> Patch at (%2d , %2d) w/ sum %3d\n", | |
69 | (int)fPosition->X(),(int)fPosition->Y(),fSum); | |
70 | } | |
71 | ||
72 | //________________ | |
73 | void AliEMCALTriggerPatch::GetAbsCellIdsFromPatchPosition( TVector2& pSize, TVector2& sSize, TArrayI& absid ) | |
74 | { | |
75 | AliRunLoader* runLoader = AliRunLoader::Instance(); | |
76 | AliEMCALGeometry* geom = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"))->GetGeometry(); | |
77 | ||
da509d54 | 78 | Int_t nTowersinpatch = (Int_t) (pSize.X() * pSize.Y() * sSize.X() * sSize.Y() * 4); |
916f1e76 | 79 | |
80 | absid.Set( nTowersinpatch ); | |
81 | ||
82 | // fPosition: patch position in the STU region | |
da509d54 | 83 | Int_t ix = (Int_t)(( fPosition->X() + pSize.X() ) * sSize.X()); |
84 | Int_t iy = (Int_t)(( fPosition->Y() + pSize.Y() ) * sSize.Y()); | |
916f1e76 | 85 | |
86 | Int_t it = 0; | |
87 | ||
da509d54 | 88 | for (Int_t i=(Int_t) (fPosition->X() * sSize.X()); i<ix; i++) // Loop over subregions FastOR |
916f1e76 | 89 | { |
da509d54 | 90 | for (Int_t j=(Int_t) (fPosition->Y() * sSize.Y()); j<iy; j++) |
916f1e76 | 91 | { |
92 | Int_t nSupMod = int(i/24) + 2 * int(j/12); | |
93 | ||
94 | Int_t nModule = 0; | |
95 | ||
96 | if ( nSupMod<10 ) | |
97 | nModule = ( i < 24 ) ? 12 * ( 23 - i ) + 11 - j%12 : 12 * ( i%24 ) + 11 - j%12; | |
98 | else | |
99 | nModule = ( i < 24 ) ? 6 * ( 23 - i ) + 5 - j%12 : 6 * ( i%24 ) + 5 - j; | |
100 | ||
101 | // Convert (TRU,eta,phi) to Id | |
102 | for (Int_t k=0;k<2;k++) | |
103 | { | |
104 | for (Int_t l=0;l<2;l++) | |
105 | { | |
106 | Int_t iphi, ieta; | |
107 | geom->GetCellPhiEtaIndexInSModule(nSupMod, nModule, k, l, iphi, ieta); | |
108 | ||
109 | absid.SetAt( geom->GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta) , it++ ); | |
110 | } | |
111 | } | |
112 | } | |
113 | } | |
114 | } |