1 |
querten |
1.1 |
// Geometry.cpp: implementation of the Geometry class.
|
2 |
|
|
//
|
3 |
|
|
//////////////////////////////////////////////////////////////////////
|
4 |
|
|
|
5 |
|
|
#include "../interface/Geometry.h"
|
6 |
roberfro |
1.8 |
#include <algorithm>
|
7 |
querten |
1.1 |
|
8 |
|
|
Geometry::Geometry(void)
|
9 |
|
|
{
|
10 |
|
|
}
|
11 |
|
|
|
12 |
|
|
Geometry::~Geometry(void)
|
13 |
|
|
{
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
void Geometry::Load (char* path)
|
17 |
|
|
{
|
18 |
|
|
FILE* pFile = fopen(path,"rb" );
|
19 |
querten |
1.6 |
if(pFile==NULL){
|
20 |
|
|
printf("The file %s can not be open !\n",path);
|
21 |
|
|
return;
|
22 |
|
|
}
|
23 |
querten |
1.1 |
|
24 |
|
|
stChunk* PrimaryChunk = new stChunk;
|
25 |
|
|
|
26 |
|
|
PrimaryChunk->read =fread(&PrimaryChunk->type,1,2,pFile);
|
27 |
|
|
PrimaryChunk->read +=fread(&PrimaryChunk->size,1,4,pFile);
|
28 |
|
|
|
29 |
|
|
if(PrimaryChunk->type!=C_PRIMARY){
|
30 |
|
|
printf("PrimaryChunk has not a good Id (%i!=%i)\n",PrimaryChunk->type,C_PRIMARY);
|
31 |
|
|
printf("Exiting...\n");
|
32 |
|
|
exit(0);
|
33 |
|
|
}
|
34 |
|
|
|
35 |
querten |
1.13 |
Read(pFile,PrimaryChunk);
|
36 |
querten |
1.9 |
fclose(pFile);
|
37 |
querten |
1.1 |
}
|
38 |
|
|
|
39 |
|
|
void Geometry::Read (FILE* pFile, stChunk* ParentChunk)
|
40 |
|
|
{
|
41 |
querten |
1.3 |
// unsigned short temp;
|
42 |
|
|
// fread(&temp,1,2,pFile);
|
43 |
|
|
// fseek(pFile,-2,SEEK_CUR);
|
44 |
|
|
// printf("Parent = %i --> Current ChunkId = %i to read = %i\n",ParentChunk->type,temp,0);
|
45 |
querten |
1.1 |
|
46 |
|
|
stChunk* CurrentChunk = new stChunk;
|
47 |
|
|
ReadChunk(pFile, CurrentChunk);
|
48 |
|
|
|
49 |
|
|
switch(CurrentChunk->type)
|
50 |
|
|
{
|
51 |
|
|
case C_GEOMETRY: // Geometry
|
52 |
querten |
1.13 |
while(CurrentChunk->read<CurrentChunk->size){
|
53 |
|
|
Read(pFile,CurrentChunk);
|
54 |
|
|
}
|
55 |
querten |
1.1 |
break;
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
////////////////////////TRACKER DATA//////////////////////////
|
59 |
|
|
case C_TRACKER: // TRACKER
|
60 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
61 |
|
|
Read(pFile,CurrentChunk);
|
62 |
|
|
}
|
63 |
|
|
break;
|
64 |
|
|
|
65 |
querten |
1.13 |
case C_TRACKER_MOD:{ // Module
|
66 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
67 |
|
|
TrackerDet* Temp = new TrackerDet;
|
68 |
|
|
CurrentChunk->read += fread(Temp,sizeof(TrackerDet),1,pFile) * sizeof(TrackerDet);
|
69 |
|
|
Det_Tracker_ALL[Temp->DetId] = Temp;
|
70 |
|
|
}
|
71 |
querten |
1.1 |
}break;
|
72 |
|
|
|
73 |
querten |
1.5 |
////////////////////////ECAL DATA//////////////////////////
|
74 |
|
|
case C_ECAL: // ECAL
|
75 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
76 |
|
|
Read(pFile,CurrentChunk);
|
77 |
|
|
}
|
78 |
|
|
break;
|
79 |
|
|
|
80 |
querten |
1.6 |
|
81 |
querten |
1.13 |
case C_ECAL_MOD:{ // Module
|
82 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
83 |
|
|
CaloDet* Temp = new CaloDet;
|
84 |
|
|
CurrentChunk->read += fread(Temp,sizeof(CaloDet),1,pFile) * sizeof(CaloDet);
|
85 |
|
|
Det_ECAL_ALL[Temp->DetId] = Temp;
|
86 |
|
|
}
|
87 |
|
|
}break;
|
88 |
querten |
1.6 |
|
89 |
|
|
////////////////////////HCAL DATA//////////////////////////
|
90 |
|
|
case C_HCAL: // HCAL
|
91 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
92 |
|
|
Read(pFile,CurrentChunk);
|
93 |
|
|
}
|
94 |
|
|
break;
|
95 |
|
|
|
96 |
querten |
1.13 |
case C_HCAL_MOD:{ // Module
|
97 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
98 |
|
|
CaloDet* Temp = new CaloDet;
|
99 |
|
|
CurrentChunk->read += fread(Temp,sizeof(CaloDet),1,pFile) * sizeof(CaloDet);
|
100 |
|
|
Det_HCAL_ALL[Temp->DetId] = Temp;
|
101 |
|
|
}
|
102 |
|
|
}break;
|
103 |
|
|
|
104 |
querten |
1.10 |
////////////////////////MUON DATA//////////////////////////
|
105 |
|
|
case C_MUON: // MUON
|
106 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
107 |
|
|
Read(pFile,CurrentChunk);
|
108 |
querten |
1.13 |
}
|
109 |
querten |
1.10 |
break;
|
110 |
|
|
|
111 |
querten |
1.13 |
case C_MUON_MOD:{ // Module
|
112 |
|
|
while(CurrentChunk->read<CurrentChunk->size){
|
113 |
|
|
TrackerDet* Temp = new TrackerDet;
|
114 |
|
|
CurrentChunk->read += fread(Temp,sizeof(TrackerDet),1,pFile) * sizeof(TrackerDet);
|
115 |
|
|
Det_Muon_ALL[Temp->DetId] = Temp;
|
116 |
|
|
}
|
117 |
querten |
1.10 |
}break;
|
118 |
querten |
1.5 |
|
119 |
querten |
1.1 |
////////////////////////UNKOWN CHUNK ////////////////////////
|
120 |
|
|
default:
|
121 |
|
|
printf("Unknown ChunkID (%i)\n",CurrentChunk->type);
|
122 |
|
|
printf("Chunk will be skipped\n");
|
123 |
|
|
printf("The program can not run properly\n");
|
124 |
|
|
fseek (pFile,CurrentChunk->size-CurrentChunk->read,SEEK_CUR);
|
125 |
|
|
CurrentChunk->read += CurrentChunk->size-CurrentChunk->read;
|
126 |
|
|
break;
|
127 |
querten |
1.13 |
}
|
128 |
querten |
1.1 |
ParentChunk->read += CurrentChunk->read;
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
void Geometry::Save (char* path)
|
132 |
|
|
{
|
133 |
|
|
stChunkToSave* Primary_chunk = new stChunkToSave;
|
134 |
|
|
|
135 |
|
|
Primary_chunk->type = C_PRIMARY;
|
136 |
|
|
Primary_chunk->size = 6;
|
137 |
|
|
|
138 |
|
|
Write(Primary_chunk);
|
139 |
querten |
1.5 |
/*
|
140 |
querten |
1.1 |
printf("%i (%i)\n",Primary_chunk->type,Primary_chunk->size);
|
141 |
|
|
for(unsigned int i=0;i<Primary_chunk->daughters.size();i++){
|
142 |
|
|
stChunkToSave* tmp = Primary_chunk->daughters[i];
|
143 |
|
|
printf(" %i (%i)\n",tmp->type,tmp->size);
|
144 |
|
|
for(unsigned int j=0;j<tmp->daughters.size();j++){
|
145 |
|
|
stChunkToSave* Tmp = tmp->daughters[j];
|
146 |
|
|
printf(" %i (%i)\n",Tmp->type,Tmp->size);
|
147 |
|
|
for(unsigned int k=0;k<Tmp->daughters.size();k++){
|
148 |
|
|
stChunkToSave* TMp = Tmp->daughters[k];
|
149 |
|
|
printf(" %i (%i)\n",TMp->type,TMp->size);
|
150 |
|
|
for(unsigned int l=0;l<TMp->daughters.size();l++){
|
151 |
|
|
stChunkToSave* TMP = TMp->daughters[l];
|
152 |
|
|
printf(" %i (%i)\n",TMP->type,TMP->size);
|
153 |
|
|
}
|
154 |
|
|
}
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
querten |
1.5 |
*/
|
158 |
querten |
1.1 |
|
159 |
|
|
FILE* pFile = fopen(path,"wb" );
|
160 |
|
|
WriteChunk(pFile, Primary_chunk);
|
161 |
|
|
fclose(pFile);
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
void Geometry::Write(stChunkToSave* ParentChunk)
|
165 |
|
|
{
|
166 |
|
|
unsigned int i;
|
167 |
querten |
1.13 |
std::map<unsigned int,TrackerDet*, std::less<unsigned int> >::iterator it;
|
168 |
|
|
std::map<unsigned int,CaloDet* , std::less<unsigned int> >::iterator it2;
|
169 |
querten |
1.1 |
stChunkToSave* CurrentChunk;
|
170 |
querten |
1.13 |
void* data_buffer;
|
171 |
querten |
1.1 |
|
172 |
|
|
switch(ParentChunk->type)
|
173 |
|
|
{
|
174 |
|
|
case C_PRIMARY: // PrimaryChunk
|
175 |
|
|
CurrentChunk = new stChunkToSave;
|
176 |
|
|
CurrentChunk->type = C_GEOMETRY;
|
177 |
|
|
CurrentChunk->size = 6;
|
178 |
|
|
ParentChunk->daughters.push_back(CurrentChunk);
|
179 |
|
|
break;
|
180 |
|
|
|
181 |
|
|
case C_GEOMETRY: // Geometry
|
182 |
querten |
1.13 |
if(Det_Tracker_ALL.size()>0){
|
183 |
querten |
1.1 |
CurrentChunk = new stChunkToSave;
|
184 |
querten |
1.13 |
CurrentChunk->type = C_TRACKER;
|
185 |
|
|
CurrentChunk->size = 6;
|
186 |
querten |
1.1 |
ParentChunk->daughters.push_back(CurrentChunk);
|
187 |
|
|
}
|
188 |
querten |
1.13 |
|
189 |
|
|
if(Det_ECAL_ALL.size()>0){
|
190 |
querten |
1.1 |
CurrentChunk = new stChunkToSave;
|
191 |
querten |
1.13 |
CurrentChunk->type = C_ECAL;
|
192 |
|
|
CurrentChunk->size = 6;
|
193 |
querten |
1.1 |
ParentChunk->daughters.push_back(CurrentChunk);
|
194 |
|
|
}
|
195 |
querten |
1.13 |
|
196 |
|
|
if(Det_HCAL_ALL.size()>0){
|
197 |
querten |
1.1 |
CurrentChunk = new stChunkToSave;
|
198 |
querten |
1.13 |
CurrentChunk->type = C_HCAL;
|
199 |
|
|
CurrentChunk->size = 6;
|
200 |
querten |
1.1 |
ParentChunk->daughters.push_back(CurrentChunk);
|
201 |
|
|
}
|
202 |
querten |
1.13 |
|
203 |
|
|
if(Det_Muon_ALL.size()>0){
|
204 |
querten |
1.1 |
CurrentChunk = new stChunkToSave;
|
205 |
querten |
1.13 |
CurrentChunk->type = C_MUON;
|
206 |
|
|
CurrentChunk->size = 6;
|
207 |
querten |
1.1 |
ParentChunk->daughters.push_back(CurrentChunk);
|
208 |
|
|
}
|
209 |
querten |
1.13 |
break;
|
210 |
|
|
|
211 |
|
|
case C_TRACKER: // Tracker
|
212 |
|
|
CurrentChunk = new stChunkToSave;
|
213 |
|
|
CurrentChunk->type = C_TRACKER_MOD;
|
214 |
|
|
CurrentChunk->size = 6 + sizeof(TrackerDet)*Det_Tracker_ALL.size();
|
215 |
|
|
data_buffer = new void*[CurrentChunk->size-6];
|
216 |
|
|
CurrentChunk->data = data_buffer;
|
217 |
|
|
for(it=Det_Tracker_ALL.begin();it!=Det_Tracker_ALL.end();it++){
|
218 |
|
|
memcpy( data_buffer, it->second, sizeof(TrackerDet) );
|
219 |
|
|
data_buffer = (void*)((unsigned int)data_buffer + sizeof(TrackerDet));
|
220 |
|
|
}
|
221 |
|
|
ParentChunk->daughters.push_back(CurrentChunk);
|
222 |
|
|
break;
|
223 |
|
|
|
224 |
|
|
/* case C_ECAL: // ECAL
|
225 |
|
|
for(i=0;i<Det_ECAL_ALL.size();i++){
|
226 |
querten |
1.1 |
CurrentChunk = new stChunkToSave;
|
227 |
querten |
1.13 |
CurrentChunk->type = C_ECAL_MOD;
|
228 |
|
|
CurrentChunk->size = 6 + sizeof(CaloDet);
|
229 |
|
|
CurrentChunk->data = Det_ECAL_ALL[i];
|
230 |
querten |
1.1 |
ParentChunk->daughters.push_back(CurrentChunk);
|
231 |
|
|
}
|
232 |
|
|
break;
|
233 |
querten |
1.13 |
*/
|
234 |
querten |
1.1 |
|
235 |
querten |
1.5 |
case C_ECAL: // ECAL
|
236 |
querten |
1.13 |
CurrentChunk = new stChunkToSave;
|
237 |
|
|
CurrentChunk->type = C_ECAL_MOD;
|
238 |
|
|
CurrentChunk->size = 6 + sizeof(CaloDet)*Det_ECAL_ALL.size();
|
239 |
|
|
data_buffer = new void*[CurrentChunk->size-6];
|
240 |
|
|
CurrentChunk->data = data_buffer;
|
241 |
|
|
for(it2=Det_ECAL_ALL.begin();it2!=Det_ECAL_ALL.end();it2++){
|
242 |
|
|
memcpy( data_buffer, it2->second, sizeof(CaloDet) );
|
243 |
|
|
data_buffer = (void*)((unsigned int)data_buffer + sizeof(CaloDet));
|
244 |
querten |
1.5 |
}
|
245 |
querten |
1.13 |
ParentChunk->daughters.push_back(CurrentChunk);
|
246 |
|
|
break;
|
247 |
|
|
|
248 |
|
|
/*
|
249 |
|
|
case C_HCAL: // HCAL
|
250 |
|
|
for(i=0;i<Det_HCAL_ALL.size();i++){
|
251 |
querten |
1.6 |
CurrentChunk = new stChunkToSave;
|
252 |
querten |
1.13 |
CurrentChunk->type = C_HCAL_MOD;
|
253 |
querten |
1.6 |
CurrentChunk->size = 6 + sizeof(CaloDet);
|
254 |
querten |
1.13 |
CurrentChunk->data = Det_HCAL_ALL[i];
|
255 |
querten |
1.6 |
ParentChunk->daughters.push_back(CurrentChunk);
|
256 |
|
|
}
|
257 |
querten |
1.5 |
break;
|
258 |
querten |
1.13 |
*/
|
259 |
querten |
1.6 |
|
260 |
|
|
case C_HCAL: // HCAL
|
261 |
querten |
1.13 |
CurrentChunk = new stChunkToSave;
|
262 |
|
|
CurrentChunk->type = C_HCAL_MOD;
|
263 |
|
|
CurrentChunk->size = 6 + sizeof(CaloDet)*Det_HCAL_ALL.size();
|
264 |
|
|
data_buffer = new void*[CurrentChunk->size-6];
|
265 |
|
|
CurrentChunk->data = data_buffer;
|
266 |
|
|
for(it2=Det_HCAL_ALL.begin();it2!=Det_HCAL_ALL.end();it2++){
|
267 |
|
|
memcpy( data_buffer, it2->second, sizeof(CaloDet) );
|
268 |
|
|
data_buffer = (void*)((unsigned int)data_buffer + sizeof(CaloDet));
|
269 |
querten |
1.6 |
}
|
270 |
querten |
1.13 |
ParentChunk->daughters.push_back(CurrentChunk);
|
271 |
querten |
1.6 |
break;
|
272 |
querten |
1.13 |
/*
|
273 |
querten |
1.10 |
case C_MUON: // MUON
|
274 |
querten |
1.13 |
for(i=0;i<Det_Muon_ALL.size();i++){
|
275 |
querten |
1.10 |
CurrentChunk = new stChunkToSave;
|
276 |
querten |
1.13 |
CurrentChunk->type = C_MUON_MOD;
|
277 |
querten |
1.10 |
CurrentChunk->size = 6 + sizeof(TrackerDet);
|
278 |
querten |
1.13 |
CurrentChunk->data = Det_Muon_ALL[i];
|
279 |
querten |
1.10 |
ParentChunk->daughters.push_back(CurrentChunk);
|
280 |
querten |
1.13 |
}
|
281 |
|
|
*/
|
282 |
|
|
|
283 |
|
|
case C_MUON: // Tracker
|
284 |
|
|
CurrentChunk = new stChunkToSave;
|
285 |
|
|
CurrentChunk->type = C_MUON_MOD;
|
286 |
|
|
CurrentChunk->size = 6 + sizeof(TrackerDet)*Det_Muon_ALL.size();
|
287 |
|
|
data_buffer = new void*[CurrentChunk->size-6];
|
288 |
|
|
CurrentChunk->data = data_buffer;
|
289 |
|
|
for(it=Det_Muon_ALL.begin();it!=Det_Muon_ALL.end();it++){
|
290 |
|
|
memcpy( data_buffer, it->second, sizeof(TrackerDet) );
|
291 |
|
|
data_buffer = (void*)((unsigned int)data_buffer + sizeof(TrackerDet));
|
292 |
|
|
}
|
293 |
|
|
ParentChunk->daughters.push_back(CurrentChunk);
|
294 |
querten |
1.10 |
break;
|
295 |
querten |
1.1 |
default:
|
296 |
|
|
break;
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
for(i=0; i<ParentChunk->daughters.size();i++)
|
301 |
|
|
{
|
302 |
|
|
// if( !(ParentChunk->type == C_PRIMARY && i!=ParentChunk->daughters.size()-1))
|
303 |
|
|
Write(ParentChunk->daughters[i]);
|
304 |
|
|
ParentChunk->size += ParentChunk->daughters[i]->size;
|
305 |
|
|
}
|
306 |
|
|
}
|
307 |
|
|
|
308 |
querten |
1.4 |
void Geometry::Add_TrackerDet(unsigned int DetId, float TrapezoidalParam,
|
309 |
querten |
1.2 |
float PosX, float PosY, float PosZ,
|
310 |
|
|
float WidthX, float WidthY, float WidthZ,
|
311 |
|
|
float LengthX, float LengthY, float LengthZ,
|
312 |
|
|
float ThickX, float ThickY, float ThickZ){
|
313 |
|
|
|
314 |
querten |
1.10 |
int Det = (DetId>>28)&0xF;
|
315 |
querten |
1.13 |
//int SubDet = (DetId>>25)&0x7;
|
316 |
querten |
1.1 |
|
317 |
|
|
TrackerDet* temp = new TrackerDet();
|
318 |
|
|
temp->DetId = DetId;
|
319 |
querten |
1.2 |
temp->PosX = PosX;
|
320 |
|
|
temp->PosY = PosY;
|
321 |
|
|
temp->PosZ = PosZ;
|
322 |
|
|
temp->WidthX = WidthX;
|
323 |
|
|
temp->WidthY = WidthY;
|
324 |
|
|
temp->WidthZ = WidthZ;
|
325 |
|
|
temp->LengthX = LengthX;
|
326 |
|
|
temp->LengthY = LengthY;
|
327 |
|
|
temp->LengthZ = LengthZ;
|
328 |
|
|
temp->ThickX = ThickX;
|
329 |
|
|
temp->ThickY = ThickY;
|
330 |
|
|
temp->ThickZ = ThickZ;
|
331 |
querten |
1.4 |
temp->TrapezoidalParam = TrapezoidalParam;
|
332 |
querten |
1.10 |
|
333 |
querten |
1.13 |
if(Det==1){ Det_Tracker_ALL[temp->DetId] = temp; return;}
|
334 |
|
|
if(Det==2){ Det_Muon_ALL [temp->DetId] = temp; return;}
|
335 |
|
|
|
336 |
|
|
printf("Unknown Det %i\n",Det);
|
337 |
|
|
delete temp;
|
338 |
|
|
return;
|
339 |
querten |
1.1 |
}
|
340 |
|
|
|
341 |
querten |
1.5 |
void Geometry::Add_CaloDet(unsigned int DetId,
|
342 |
|
|
float PosX, float PosY, float PosZ,
|
343 |
|
|
float C1X, float C1Y, float C1Z,
|
344 |
|
|
float C2X, float C2Y, float C2Z,
|
345 |
|
|
float C3X, float C3Y, float C3Z,
|
346 |
|
|
float C4X, float C4Y, float C4Z,
|
347 |
|
|
float C5X, float C5Y, float C5Z,
|
348 |
|
|
float C6X, float C6Y, float C6Z,
|
349 |
|
|
float C7X, float C7Y, float C7Z,
|
350 |
|
|
float C8X, float C8Y, float C8Z){
|
351 |
|
|
|
352 |
|
|
CaloDet* temp = new CaloDet();
|
353 |
|
|
temp->DetId = DetId;
|
354 |
|
|
temp->PosX = PosX;
|
355 |
|
|
temp->PosY = PosY;
|
356 |
|
|
temp->PosZ = PosZ;
|
357 |
|
|
temp->C1X = C1X; temp->C1Y = C1Y; temp->C1Z = C1Z;
|
358 |
|
|
temp->C2X = C2X; temp->C2Y = C2Y; temp->C2Z = C2Z;
|
359 |
|
|
temp->C3X = C3X; temp->C3Y = C3Y; temp->C3Z = C3Z;
|
360 |
|
|
temp->C4X = C4X; temp->C4Y = C4Y; temp->C4Z = C4Z;
|
361 |
|
|
temp->C5X = C5X; temp->C5Y = C5Y; temp->C5Z = C5Z;
|
362 |
|
|
temp->C6X = C6X; temp->C6Y = C6Y; temp->C6Z = C6Z;
|
363 |
|
|
temp->C7X = C7X; temp->C7Y = C7Y; temp->C7Z = C7Z;
|
364 |
|
|
temp->C8X = C8X; temp->C8Y = C8Y; temp->C8Z = C8Z;
|
365 |
querten |
1.6 |
|
366 |
|
|
|
367 |
|
|
int Det = (DetId>>28)&0xF;
|
368 |
querten |
1.13 |
//int SubDet = (DetId>>25)&0x7;
|
369 |
|
|
//DET1 --> SubDet 1=EB 2=EE 3=PS 4=EcalTriggerTower 5=EcalLaserPnDiode
|
370 |
|
|
//DET2 --> SubDet 1=HB 2=HE 3=HO 4=HF 5=HcalTriggerTower 6=HcalOther (HcalOtherEmpty or HcalCalibration)
|
371 |
|
|
|
372 |
|
|
if(Det==3){ Det_ECAL_ALL[temp->DetId] = temp; return;}
|
373 |
|
|
if(Det==4){ Det_HCAL_ALL[temp->DetId] = temp; return;}
|
374 |
|
|
|
375 |
|
|
printf("Unknown Det %i\n",Det);
|
376 |
|
|
delete temp;
|
377 |
|
|
return;
|
378 |
querten |
1.5 |
}
|
379 |
|
|
|
380 |
querten |
1.11 |
|
381 |
|
|
TrackerDet* Geometry::Find_TrackerDet (unsigned int DetId){
|
382 |
|
|
int Det = (DetId>>28)&0xF;
|
383 |
querten |
1.13 |
//int SubDet = (DetId>>25)&0x7;
|
384 |
|
|
std::map<unsigned int,TrackerDet*, std::less<unsigned int> >::iterator det;
|
385 |
querten |
1.12 |
|
386 |
querten |
1.13 |
if(Det==1){ // Tracker
|
387 |
|
|
det = Det_Tracker_ALL.find(DetId);
|
388 |
|
|
if(det!=Det_Tracker_ALL.end())return det->second;
|
389 |
querten |
1.11 |
}else if(Det==2){ // MUON
|
390 |
querten |
1.13 |
det = Det_Muon_ALL.find(DetId);
|
391 |
|
|
if(det!=Det_Muon_ALL.end())return det->second;
|
392 |
|
|
}
|
393 |
querten |
1.1 |
return NULL;
|
394 |
querten |
1.2 |
}
|
395 |
|
|
|
396 |
querten |
1.7 |
CaloDet* Geometry::Find_CaloDet (unsigned int DetId){
|
397 |
querten |
1.2 |
|
398 |
querten |
1.7 |
int Det = (DetId>>28)&0xF;
|
399 |
querten |
1.13 |
//int SubDet = (DetId>>25)&0x7;
|
400 |
|
|
std::map<unsigned int,CaloDet*, std::less<unsigned int> >::iterator det;
|
401 |
|
|
|
402 |
|
|
if(Det==3){ //ECAL
|
403 |
|
|
det = Det_ECAL_ALL.find(DetId);
|
404 |
|
|
if(det!=Det_ECAL_ALL.end())return det->second;
|
405 |
querten |
1.7 |
}else if(Det==4){ //HCAL
|
406 |
querten |
1.13 |
det = Det_HCAL_ALL.find(DetId);
|
407 |
|
|
if(det!=Det_HCAL_ALL.end())return det->second;
|
408 |
querten |
1.7 |
}
|
409 |
|
|
return NULL;
|
410 |
|
|
}
|