]>
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 macro to generate LookupTable | |
19 | in the following form | |
20 | detElemId+manuid+channelId buspatchId Ix IY X Y B/NB | |
21 | ||
22 | Created: 7/10/2005 | |
23 | Modified: 22/12/2005 | |
24 | Modified: 09/02/2006 | |
25 | Modified: 09/04/2007 | |
26 | Modified: 24/08/2007 (To adopt to AliRoot v4-06-Release) | |
27 | ||
28 | Run Info: To run this code copy "rootlogon.C" | |
29 | in the current directory from $ALICE_ROOT/MUON | |
30 | and specify the | |
31 | transformFileName as "geometry.root" of the | |
32 | simulation directory.Then compile and run using | |
33 | .L generateLookupTable.C++ | |
34 | ||
35 | Author: Indranil Das, HEP, SINP, Kolkata | |
36 | Email: indra.das@saha.ac.in | |
37 | ***********************************************/ | |
38 | ||
39 | #include <iostream> | |
40 | ||
41 | //STEER | |
42 | #include "AliCDBManager.h" | |
e4753737 | 43 | #include "AliGeomManager.h" |
86665942 | 44 | //MUON |
45 | #include "AliMUONGeometryTransformer.h" | |
46 | ||
47 | //MUON/mapping | |
e4753737 | 48 | #include "AliMpCDB.h" |
86665942 | 49 | #include "AliMpPad.h" |
50 | #include "AliMpSegmentation.h" | |
51 | #include "AliMpDDLStore.h" | |
52 | #include "AliMpDEIterator.h" | |
53 | #include "AliMpVSegmentation.h" | |
54 | #include "AliMpDEManager.h" | |
55 | ||
56 | class AliMpDDLStore ; | |
57 | ||
58 | using namespace std; | |
59 | ||
e4753737 | 60 | Bool_t CreateHitRecoLookupTables(TString CDBPath = "local://$ALICE_ROOT", Int_t run = 0, Bool_t warn = kTRUE) |
86665942 | 61 | { |
62 | Char_t filename1[20], filename2[20]; | |
63 | Int_t chamberId; | |
64 | ||
e4753737 | 65 | AliCDBManager* cdbManager = AliCDBManager::Instance(); |
66 | cdbManager->SetDefaultStorage(CDBPath.Data()); | |
67 | cdbManager->SetRun(run); | |
86665942 | 68 | |
e4753737 | 69 | if (! AliMpCDB::LoadDDLStore(warn)){ |
70 | cerr<<__FILE__<<": Failed to Load DDLStore specified for CDBPath "<<CDBPath<<", and Run : "<<run<<endl; | |
71 | return kFALSE; | |
72 | } | |
73 | ||
74 | AliMpSegmentation *mpSegFactory = AliMpSegmentation::Instance(); | |
75 | AliGeomManager::LoadGeometry(); | |
86665942 | 76 | AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer(); |
e4753737 | 77 | if(! chamberGeometryTransformer->LoadGeometryData()){ |
78 | cerr<<__FILE__<<": Failed to Load Geomerty Data "<<endl; | |
79 | return kFALSE; | |
80 | } | |
81 | ||
82 | // AliMpSegmentation *mpSegFactory = AliMpSegmentation::ReadData(); | |
83 | ||
84 | // AliMpDDLStore* fDDLStore = AliMpDDLStore::ReadData(); | |
85 | ||
86 | // AliMUONGeometryTransformer* chamberGeometryTransformer = new AliMUONGeometryTransformer(); | |
87 | // chamberGeometryTransformer->LoadGeometryData(transformFileName); | |
86665942 | 88 | |
89 | for(Int_t iCh = 0; iCh < 4; iCh++){ // max 4 | |
90 | ||
b8d467da | 91 | sprintf(filename1,"Lut%d.dat",2*(6+iCh)+1); |
86665942 | 92 | FILE *fout1 = fopen(filename1,"w"); |
93 | ||
b8d467da | 94 | sprintf(filename2,"Lut%d.dat",2*(6+iCh)+2); |
86665942 | 95 | FILE *fout2 = fopen(filename2,"w"); |
96 | ||
97 | chamberId = iCh + 6; | |
98 | ||
99 | AliMpDEIterator it; | |
100 | for ( it.First(chamberId); ! it.IsDone(); it.Next() ) { | |
101 | ||
102 | Int_t detElemId = it.CurrentDEId(); | |
103 | ||
104 | cout<<"Running for detElemId :"<<detElemId<<endl; | |
105 | ||
e4753737 | 106 | for(Int_t iCath = 0 ; iCath <= 1 ; iCath++){ |
86665942 | 107 | |
108 | AliMp::CathodType cath; | |
109 | ||
e4753737 | 110 | if(iCath == 0) |
86665942 | 111 | cath = AliMp::kCath0 ; |
112 | else | |
113 | cath = AliMp::kCath1 ; | |
114 | ||
e4753737 | 115 | const AliMpVSegmentation* seg = mpSegFactory->CreateMpSegmentation(detElemId, cath); |
116 | AliMp::PlaneType plane = seg->PlaneType(); | |
86665942 | 117 | Int_t maxIX = seg->MaxPadIndexX(); |
118 | Int_t maxIY = seg->MaxPadIndexY(); | |
119 | Int_t idManuChannel, manuId, channelId,idetElemId; | |
86665942 | 120 | Double_t realX, realY, realZ; |
121 | Double_t localX, localY, localZ; | |
122 | Double_t padSizeX, padSizeY; | |
123 | Int_t pcbType; | |
124 | ||
125 | //Pad Info of a segment | |
126 | for(Int_t iX = 0; iX<= maxIX ; iX++){ | |
127 | for(Int_t iY = 0; iY<= maxIY ; iY++){ | |
128 | if(seg->HasPad(AliMpIntPair(iX,iY))){ | |
129 | AliMpPad pad = seg->PadByIndices(AliMpIntPair(iX,iY),kFALSE); | |
130 | ||
131 | // Getting Manu id | |
132 | manuId = pad.GetLocation().GetFirst(); | |
133 | manuId &= 0x7FF; // 11 bits | |
134 | ||
86665942 | 135 | // Getting channel id |
136 | channelId = pad.GetLocation().GetSecond(); | |
137 | channelId &= 0x3F; // 6 bits | |
138 | ||
139 | idetElemId = detElemId%100; | |
140 | ||
141 | idManuChannel &= 0x0; | |
142 | idManuChannel = (idManuChannel|idetElemId)<<11; | |
143 | idManuChannel = (idManuChannel|manuId)<<6 ; | |
144 | idManuChannel |= channelId ; | |
145 | ||
146 | localX = pad.Position().X(); | |
147 | localY = pad.Position().Y(); | |
148 | localZ = 0.0; | |
149 | ||
150 | chamberGeometryTransformer->Local2Global(detElemId,localX,localY,localZ, | |
151 | realX,realY,realZ); | |
152 | ||
153 | padSizeX = 2.0*pad.Dimensions().X(); | |
154 | padSizeY = 2.0*pad.Dimensions().Y(); | |
155 | ||
e4753737 | 156 | if(plane == 0 ){ |
86665942 | 157 | if(padSizeX==2.5) |
158 | pcbType = 0; | |
159 | else if(padSizeX==5.0) | |
160 | pcbType = 1; | |
161 | else | |
162 | pcbType = 2; | |
163 | } | |
164 | else{ | |
165 | if(padSizeY==2.5) | |
166 | pcbType = 0; | |
167 | else if(padSizeY==5.0) | |
168 | pcbType = 1; | |
169 | else | |
170 | pcbType = 2; | |
171 | } | |
172 | ||
173 | if(idetElemId<7 || idetElemId > 19){ | |
e4753737 | 174 | 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,plane); |
86665942 | 175 | } |
176 | else{ | |
e4753737 | 177 | 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,plane); |
86665942 | 178 | }// HasPad Condn |
179 | ||
180 | } | |
86665942 | 181 | }// iY loop |
182 | }// iX loop | |
183 | ||
184 | }// iPlane | |
185 | ||
186 | } // detElemId loop | |
187 | ||
188 | fclose(fout1); | |
189 | fclose(fout2); | |
190 | }// ichamber loop | |
191 | ||
192 | return kTRUE; | |
193 | } |