121 |
|
Geometry* Geom_ECAL; |
122 |
|
Geometry* Geom_HCAL; |
123 |
|
Geometry* Geom_Muon; |
124 |
+ |
Geometry* Geom_Fwd; |
125 |
|
|
126 |
|
|
127 |
|
std::string OutputFile; |
187 |
|
Geom_ECAL = new Geometry(); |
188 |
|
Geom_HCAL = new Geometry(); |
189 |
|
Geom_Muon = new Geometry(); |
190 |
+ |
Geom_Fwd = new Geometry(); |
191 |
+ |
|
192 |
|
|
193 |
|
|
194 |
|
// ### TRACKER GEOMETRY ### |
268 |
|
printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n"); |
269 |
|
continue; |
270 |
|
} |
271 |
< |
}else{ |
272 |
< |
continue; |
271 |
> |
}else if(Detid.det() == DetId::Calo){ |
272 |
> |
Geom_temp = NULL; |
273 |
> |
|
274 |
> |
// Calo Tower Geometry (SudDet=1) |
275 |
> |
// if(SubDet==1) |
276 |
> |
// //printf("Don't Save CaloTowers\n"); |
277 |
> |
// continue; |
278 |
> |
|
279 |
> |
// Forward Calo Geometry --> Castor (SudDet=3) and ZDS (SubDet=2) |
280 |
> |
if(SubDet==HcalCastorDetId::SubdetectorId || SubDet==HcalZDCDetId::SubdetectorId) |
281 |
> |
Geom_temp = Geom_Fwd; |
282 |
> |
// printf("Save FWD CaloTowers\n"); |
283 |
|
} |
284 |
|
|
285 |
|
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid); |
286 |
|
GlobalPoint CellPos = CellGeom->getPosition(); |
287 |
|
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners(); |
288 |
|
|
289 |
< |
float cX = (CellCorners[0].x() + CellCorners[2].x())/2; |
290 |
< |
float cY = (CellCorners[0].y() + CellCorners[2].y())/2; |
291 |
< |
float cZ = (CellCorners[0].z() + CellCorners[2].z())/2; |
292 |
< |
|
293 |
< |
float wX = (CellCorners[1].x() - CellCorners[0].x())/2; |
294 |
< |
float wY = (CellCorners[1].y() - CellCorners[0].y())/2; |
295 |
< |
float wZ = (CellCorners[1].z() - CellCorners[0].z())/2; |
296 |
< |
|
297 |
< |
float hX = (CellCorners[3].x() - CellCorners[0].x())/2; |
298 |
< |
float hY = (CellCorners[3].y() - CellCorners[0].y())/2; |
299 |
< |
float hZ = (CellCorners[3].z() - CellCorners[0].z())/2; |
300 |
< |
|
301 |
< |
float F = sqrt( pow(CellCorners[4].x()+CellCorners[6].x(),2) + pow(CellCorners[4].y()+CellCorners[6].y(),2) + pow(CellCorners[4].z()+CellCorners[6].z(),2) ); |
302 |
< |
F /= sqrt( pow(CellCorners[0].x()+CellCorners[2].x(),2) + pow(CellCorners[0].y()+CellCorners[2].y(),2) + pow(CellCorners[0].z()+CellCorners[2].z(),2) ); |
303 |
< |
|
304 |
< |
Geom_temp->Add_CaloDet(Detid.rawId(), |
305 |
< |
cX , cY , cZ , |
306 |
< |
wX , wY , wZ , |
307 |
< |
hX , hY , hZ , F ); |
289 |
> |
if(Geom_temp == Geom_ECAL || Geom_temp == Geom_HCAL){ |
290 |
> |
float cX = (CellCorners[0].x() + CellCorners[2].x())/2; |
291 |
> |
float cY = (CellCorners[0].y() + CellCorners[2].y())/2; |
292 |
> |
float cZ = (CellCorners[0].z() + CellCorners[2].z())/2; |
293 |
> |
|
294 |
> |
float wX = (CellCorners[1].x() - CellCorners[0].x())/2; |
295 |
> |
float wY = (CellCorners[1].y() - CellCorners[0].y())/2; |
296 |
> |
float wZ = (CellCorners[1].z() - CellCorners[0].z())/2; |
297 |
> |
|
298 |
> |
float hX = (CellCorners[3].x() - CellCorners[0].x())/2; |
299 |
> |
float hY = (CellCorners[3].y() - CellCorners[0].y())/2; |
300 |
> |
float hZ = (CellCorners[3].z() - CellCorners[0].z())/2; |
301 |
> |
|
302 |
> |
float F = sqrt( pow(CellCorners[4].x()+CellCorners[6].x(),2) + pow(CellCorners[4].y()+CellCorners[6].y(),2) + pow(CellCorners[4].z()+CellCorners[6].z(),2) ); |
303 |
> |
F /= sqrt( pow(CellCorners[0].x()+CellCorners[2].x(),2) + pow(CellCorners[0].y()+CellCorners[2].y(),2) + pow(CellCorners[0].z()+CellCorners[2].z(),2) ); |
304 |
> |
|
305 |
> |
Geom_temp->Add_CaloDet(Detid.rawId(), |
306 |
> |
cX , cY , cZ , |
307 |
> |
wX , wY , wZ , |
308 |
> |
hX , hY , hZ , F ); |
309 |
> |
}else if(Geom_temp == Geom_Fwd){ |
310 |
> |
/* |
311 |
> |
Geom_temp->Add_FwdDet(Detid.rawId(), |
312 |
> |
CellCorners[0].x(), CellCorners[0].y(), CellCorners[0].z(), |
313 |
> |
CellCorners[1].x(), CellCorners[1].y(), CellCorners[1].z(), |
314 |
> |
CellCorners[2].x(), CellCorners[2].y(), CellCorners[2].z(), |
315 |
> |
CellCorners[3].x(), CellCorners[3].y(), CellCorners[3].z(), |
316 |
> |
CellCorners[4].x(), CellCorners[4].y(), CellCorners[4].z(), |
317 |
> |
CellCorners[5].x(), CellCorners[5].y(), CellCorners[5].z(), |
318 |
> |
CellCorners[6].x(), CellCorners[6].y(), CellCorners[6].z(), |
319 |
> |
CellCorners[7].x(), CellCorners[7].y(), CellCorners[7].z()); |
320 |
> |
printf("SubDet = %i : (%6.2f,%6.2f,%6.2f) --> 7 (%6.2f,%6.2f,%6.2f) \n", SubDet,CellCorners[0].x(), CellCorners[0].y(), CellCorners[0].z(),CellCorners[6].x(), CellCorners[6].y(), CellCorners[6].z()); |
321 |
> |
*/ |
322 |
> |
} |
323 |
|
} |
324 |
+ |
|
325 |
|
|
326 |
|
// ### MUON GEOMETRY ### |
327 |
|
|
386 |
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z()); |
387 |
|
} |
388 |
|
|
389 |
+ |
// ### FORWARD GEOMETRY ### |
390 |
+ |
// edm::ESHandle<CaloGeometry> ForwardGeom; |
391 |
+ |
// iSetup.get<IdealGeometryRecord>().get( ForwardGeom ); |
392 |
+ |
// const vector<DetId> FwdDets = ForwardGeom->getValidDetIds(DetId::Calo, HcalCastorDetId::SubdetectorId); |
393 |
+ |
// printf("FwdDetsSize = %i\n",FwdDets.size()); |
394 |
|
|
395 |
|
// ### Save .geom ### |
396 |
|
|
397 |
+ |
printf("FWD Size = %i\n", Geom_Fwd->Det_ECAL_ALL.size()); |
398 |
+ |
printf("FWD Size = %i\n", Geom_Fwd->Det_HCAL_ALL.size()); |
399 |
+ |
printf("FWD Size = %i\n", Geom_Fwd->Det_FWD_ALL.size()); |
400 |
+ |
|
401 |
+ |
|
402 |
+ |
|
403 |
|
Geom_Tracker->Save("Tracker.geom"); |
404 |
|
Geom_ECAL ->Save("Ecal.geom"); |
405 |
|
Geom_HCAL ->Save("Hcal.geom"); |
406 |
|
Geom_Muon ->Save("Muon.geom"); |
407 |
+ |
// Geom_Fwd ->Save("Fwd.geom"); |
408 |
+ |
|
409 |
+ |
|
410 |
|
|
411 |
|
} |
412 |
|
|