]>
Commit | Line | Data |
---|---|---|
86665942 | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: * | |
6 | * Indranil Das <indra.das@saha.ac.in> * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | /********************************************** | |
18 | Purpose: A modified macro to generate MappingTable | |
19 | in the following form | |
20 | ||
21 | detElemId+iPlane+iX+iY Ix IY X Y B/NB pcbtype | |
22 | ||
23 | for the trigger stations. | |
24 | ||
25 | Created: 13/05/2007 | |
26 | Modified: 31/08/2007 (Adopted to AliRoot v4-06-Release) | |
27 | Modified: 08/09/2007 (To produce mapping on the basis of uniqueID as detElemId+iPlane+localCard+ibitXY ) | |
28 | Author: Indranil Das, HEP, SINP, Kolkata | |
29 | Email: indra.das@saha.ac.in | indra.ehep@gmail.com | |
30 | ***********************************************/ | |
31 | ||
32 | #include <iostream> | |
33 | ||
34 | //STEER | |
35 | #include "AliCDBManager.h" | |
36 | ||
37 | //MUON | |
38 | #include "AliMUONGeometryTransformer.h" | |
39 | #include "AliMUONGeometryDetElement.h" | |
40 | #include "AliMUONCalibrationData.h" | |
41 | #include "AliMUONVCalibParam.h" | |
42 | ||
43 | //MUON/mapping | |
44 | #include "AliMpPad.h" | |
45 | #include "AliMpSegmentation.h" | |
46 | #include "AliMpDEIterator.h" | |
47 | #include "AliMpVSegmentation.h" | |
48 | #include "AliMpDEManager.h" | |
49 | ||
50 | ||
51 | using namespace std; | |
52 | ||
53 | ||
54 | Bool_t CreateTriggerRecoLookupTables(TString transformFileName = "geometry.root") | |
55 | { | |
56 | ||
57 | Char_t filename1[20], filename2[20]; | |
58 | Int_t chamberId; | |
59 | ||
60 | Int_t runNumber = 0; | |
61 | ||
62 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); | |
63 | AliMUONCalibrationData cd(runNumber); | |
64 | ||
65 | AliMpSegmentation *mpSegFactory = AliMpSegmentation::ReadData(); | |
66 | ||
67 | AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer(); | |
68 | chamberGeometryTransformer->LoadGeometryData(transformFileName); | |
69 | ||
70 | sprintf(filename1,"Lut%d.dat",2*(10+0)); | |
71 | //ofstream fout1(filename1); | |
72 | FILE *fout1 = fopen(filename1,"w"); | |
73 | ||
74 | sprintf(filename2,"Lut%d.dat",2*(10+0)+1); | |
75 | //ofstream fout2(filename2); | |
76 | FILE *fout2 = fopen(filename2,"w"); | |
77 | ||
78 | for(Int_t iCh = 0; iCh < 4; iCh++){ // max 4 | |
79 | ||
80 | chamberId = iCh + 10; | |
81 | ||
82 | cout<<"Running for Chamber : "<<chamberId<<endl; | |
83 | ||
84 | AliMpDEIterator it; | |
85 | for ( it.First(chamberId); ! it.IsDone(); it.Next() ) { | |
86 | ||
87 | Int_t detElemId = it.CurrentDEId(); | |
88 | ||
89 | Double_t globPos[3] = {0.0, 0.0, 0.0}; | |
90 | Double_t locPos[3] = {0.0, 0.0, 0.0}; | |
91 | ||
92 | chamberGeometryTransformer->GetDetElement(detElemId)->Local2Global(locPos[0],locPos[1],locPos[2],globPos[0],globPos[1],globPos[2]); | |
93 | ||
94 | for(Int_t iPlane = 0 ; iPlane <= 1 ; iPlane++){ | |
95 | ||
96 | AliMp::CathodType cath; | |
97 | ||
98 | if(iPlane == 0) | |
99 | cath = AliMp::kCath0 ; | |
100 | else | |
101 | cath = AliMp::kCath1 ; | |
102 | ||
103 | AliMpVSegmentation* seg = mpSegFactory->CreateMpSegmentation(detElemId, cath); | |
104 | ||
105 | Int_t maxIX = seg->MaxPadIndexX(); | |
106 | Int_t maxIY = seg->MaxPadIndexY(); | |
107 | Int_t idManuChannel,idetElemId; | |
108 | ||
109 | Double_t realX, realY, realZ; | |
110 | Double_t localX, localY, localZ; | |
111 | Double_t padSizeX, padSizeY; | |
112 | Int_t pcbType; | |
113 | Int_t locCard, ibitxy; | |
114 | ||
115 | //Pad Info of a segment | |
116 | for(Int_t iX = 0; iX<= maxIX ; iX++){ | |
117 | for(Int_t iY = 0; iY<= maxIY ; iY++){ | |
118 | if(seg->HasPad(AliMpIntPair(iX,iY))){ | |
119 | AliMpPad pad = seg->PadByIndices(AliMpIntPair(iX,iY),kFALSE); | |
120 | ||
121 | locCard = pad.GetLocation(0).GetFirst(); | |
122 | ibitxy = pad.GetLocation(0).GetSecond(); | |
123 | ||
124 | idetElemId = detElemId%1000; | |
125 | idetElemId &= 0x1FF ; | |
126 | iPlane &= 0x1 ; | |
127 | locCard &= 0xFF ; | |
128 | ibitxy &= 0xF ; | |
129 | ||
130 | idManuChannel &= 0x0; | |
131 | idManuChannel = (idManuChannel|idetElemId)<<1; | |
132 | idManuChannel = (idManuChannel|iPlane)<<8; | |
133 | idManuChannel = (idManuChannel|locCard)<<4 ; | |
134 | idManuChannel |= ibitxy; | |
135 | ||
136 | localX = pad.Position().X(); | |
137 | localY = pad.Position().Y(); | |
138 | localZ = 0.0; | |
139 | ||
140 | chamberGeometryTransformer->Local2Global(detElemId,localX,localY,localZ, | |
141 | realX,realY,realZ); | |
142 | padSizeX = 2.0*pad.Dimensions().X(); | |
143 | padSizeY = 2.0*pad.Dimensions().Y(); | |
144 | ||
145 | if(iPlane == 0 ){ | |
146 | if(padSizeX==17.0) | |
147 | pcbType = 0; | |
148 | else if(padSizeX==34.0) | |
149 | pcbType = 1; | |
150 | else | |
151 | pcbType = 2; | |
152 | } | |
153 | else{ | |
154 | if(padSizeY==51.0) | |
155 | pcbType = 0; | |
156 | else | |
157 | pcbType = 1; | |
158 | } | |
159 | ||
160 | idetElemId %= 100; | |
161 | ||
162 | if(idetElemId<5 || idetElemId > 13){ | |
163 | fprintf(fout1,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,iPlane); | |
164 | } | |
165 | else{ | |
166 | fprintf(fout2,"%d\t%d\t%d\t%f\t%f\t%f\t%d\t%d\n",idManuChannel,iX,iY,realX,realY,realZ,pcbType,iPlane); | |
167 | }// HasPad Condn | |
168 | ||
169 | } | |
170 | else{ | |
171 | cout<<"pad not found for iX :"<<iX<<", iY:"<<iY<<endl; | |
172 | } | |
173 | }// iY loop | |
174 | }// iX loop | |
175 | ||
176 | }// iPlane | |
177 | } // detElemId loop | |
178 | ||
179 | }// ichamber loop | |
180 | ||
181 | fclose(fout1); | |
182 | fclose(fout2); | |
183 | ||
184 | return kTRUE; | |
185 | } |