240{
242 if(
m_clockwork->hitsThisEvent.contains(detector)) {
244 }
247 }
250 }
251
252
255 unsigned int hitCount = 0;
256
257 SoVertexProperty* hitVtxProperty = new SoVertexProperty();
258 SoPointSet* hitPointSet = new SoPointSet();
259
260 hitVtxProperty->enableNotify(FALSE);
261 hitPointSet->enableNotify(FALSE);
262
263
264 SoMaterial* material = new SoMaterial();
265 material->diffuseColor.setValue(
m_clockwork->colorMap[detector]);
266
267 sw->addChild(material);
268
269
270 if(detector=="Pixel")
271 {
272
273
274
276 if(sg->
retrieve(p_collection,
"PixelHits")==StatusCode::SUCCESS)
277 {
278 for (const SiHit& hit : *p_collection)
279 {
280 GeoSiHit ghit(hit);
281 if(!ghit) continue;
282 HepGeom::Point3D<double>
u = ghit.getGlobalPosition();
283 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
284 }
285 }
286 else
287 message(
"Unable to retrieve Pixel Hits");
288 }
289 else if(detector=="SCT")
290 {
291
292
293
295 if(sg->
retrieve(s_collection,
"SCT_Hits")==StatusCode::SUCCESS)
296 {
297 for (const SiHit& hit : *s_collection)
298 {
299 GeoSiHit ghit(hit);
300 if (!ghit) continue;
301 HepGeom::Point3D<double>
u = ghit.getGlobalPosition();
302 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
303 }
304 }
305 else
306 message(
"Unable to retrieve SCT Hits");
307 }
308 else if(detector=="TRT")
309 {
310
311
312
314 if(sg->
retrieve(t_collection,
"TRTUncompressedHits")==StatusCode::SUCCESS)
315 {
316 for (const TRTUncompressedHit& hit : *t_collection)
317 {
318 GeoTRTUncompressedHit ghit(hit);
319 if(!ghit) continue;
321 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z() );
322 }
323 }
324 else
325 message(
"Unable to retrieve TRT Hits");
326 }
327 else if(detector=="LArEMB" || detector=="LArEMEC" || detector=="LArFCAL" || detector=="LArHEC" )
328 {
329
330
331
332
333
334
336
337 std::string collName{"LArHit"};
338 std::string
suff{
""};
339
340 if (detector=="LArEMB")
342 else if (detector=="LArEMEC")
344 else if (detector=="LArFCAL")
346 else if (detector=="LArHEC")
349
350 if(sg->
retrieve(lar_collection, collName)==StatusCode::SUCCESS)
351 {
352 for (auto hi : *lar_collection ) {
353
354 const LArHit* larHit = hi;
355 const CaloDetDescrElement* ddElement =
m_clockwork->lar_dd_man->get_element(larHit->
cellID());
356 if (ddElement)
358 else
359 message(
"Unable to retrieve the CaloDetDescrElement!");
360 }
361 }
362 else
363 message(
"Unable to retrieve " + QString::fromStdString(collName) );
364 }
365 else if(detector=="Tile")
366 {
367
368
369
370
371
372
374
375 if(sg->
retrieve(t_collection,
"TileHitVec")==StatusCode::SUCCESS)
376 {
377 for (const TileHit& hit : *t_collection) {
378 Identifier pmt_id = hit.identify();
379 Identifier cell_id =
m_clockwork->tile_id->cell_id(pmt_id);
380 const CaloDetDescrElement* ddElement = (
m_clockwork->tile_id->is_tile_aux(cell_id)) ? 0 :
m_clockwork->tile_dd_man->get_cell_element(cell_id);
381 if (ddElement)
383 else
384 message(
"Unable to retrieve the CaloDetDescrElement!");
385 }
386 }
387 else
388 message(
"Unable to retrieve Tile Hits");
389 }
390 else if(detector=="MDT")
391 {
392
393
394
396 if(sg->
retrieve(mdt_collection)==StatusCode::SUCCESS)
397 {
398 for (const MDTSimHit& hit : *mdt_collection)
399 {
400 GeoMDTHit ghit(hit);
401 if(!ghit) continue;
403 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
404 }
405 }
406 else
407 message(
"Unable to retrieve MDT Hits");
408 }
409 else if(detector=="RPC")
410 {
411
412
413
415 if(sg->
retrieve(rpc_collection)==StatusCode::SUCCESS) {
416 for (const RPCSimHit& hit : *rpc_collection)
417 {
418 GeoRPCHit ghit(hit);
419 if(!ghit) continue;
421 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
422 }
423 }
424 else
425 message(
"Unable to retrieve RPC Hits");
426 }
427 else if(detector=="TGC")
428 {
429
430
431
433 if (sg->
retrieve(tgc_collection)==StatusCode::SUCCESS)
434 {
435 for (const TGCSimHit& hit : *tgc_collection)
436 {
437 GeoTGCHit ghit(hit);
438 if(!ghit) continue;
440 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
441 }
442 }
443 else
444 message(
"Unable to retrieve TGC Hits");
445 }
446 else if(detector=="CSC")
447 {
448
449
450
452 if(sg->
retrieve(csc_collection)==StatusCode::SUCCESS)
453 {
454 for (const CSCSimHit& hit : *csc_collection)
455 {
456 GeoCSCHit ghit(hit);
457 if (!ghit) continue;
459 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
460 }
461 }
462 else
463 message(
"Unable to retrieve CSC Hits");
464 }
465 else if(detector=="MM")
466 {
467
468
469
471 if(sg->
retrieve(mm_collection)==StatusCode::SUCCESS)
472 {
473 for( const MMSimHit& hit : *mm_collection )
474 {
475 GeoMMHit ghit(hit);
476 if(!ghit) continue;
478 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
479 }
480 }
481 else
482 message(
"Unable to retrieve MM Hits");
483 }
484 else if(detector=="sTGC")
485 {
486
487
488
490 if(sg->
retrieve(stgc_collection)==StatusCode::SUCCESS)
491 {
492 for( const sTGCSimHit& hit : *stgc_collection )
493 {
494 GeosTGCHit ghit(hit);
495 if(!ghit) continue;
497 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
498 }
499 }
500 else
501 message(
"Unable to retrieve sTGC Hits");
502 }
503 else if(detector=="Generic Muon")
504 {
505
506
507
508 message(
"Trying for Generic Muon (as many collections as can be found)");
509 for(const QString& key : VP1SGContentsHelper(this).getKeys<GenericMuonSimHitCollection>()) {
511 if(sg->
retrieve( generic_collection,
key.toStdString().c_str() )==StatusCode::SUCCESS)
512 {
514 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
515
516
517 for (const GenericMuonSimHit& hit : *generic_collection)
518 {
519
520 const GenericMuonSimHit ghit(hit);
522 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
523 }
524 }
525 else
526 message(
"Unable to retrieve Generic Muon Hits from "+key);
527 }
528 } else if(detector=="Forward Region")
529 {
530
531
532
533 message(
"Trying for ForwardRegion (as many collections as can be found)");
534 for(const QString& key : VP1SGContentsHelper(this).getKeys<SimulationHitCollection>()) {
536 if(sg->
retrieve( generic_collection,
key.toStdString().c_str() )==StatusCode::SUCCESS)
537 {
539 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
540
541
542 for (const SimulationHit& hit : *generic_collection)
543 {
544
545 const SimulationHit ghit(hit);
547 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
548 }
549 }
550 else
551 message(
"Unable to retrieve Simulation Hits from "+key);
552 }
553 }
554
555
556 hitPointSet->numPoints=hitCount;
557 hitPointSet->vertexProperty.setValue(hitVtxProperty);
558 sw->addChild(hitPointSet);
559 hitPointSet->enableNotify(TRUE);
560 hitVtxProperty->enableNotify(TRUE);
561}
AtlasHitsVector< CSCSimHit > CSCSimHitCollection
AtlasHitsVector< GenericMuonSimHit > GenericMuonSimHitCollection
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
AtlasHitsVector< MMSimHit > MMSimHitCollection
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
AtlasHitsVector< SiHit > SiHitCollection
AtlasHitsVector< SimulationHit > SimulationHitCollection
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
AtlasHitsVector< TRTUncompressedHit > TRTUncompressedHitCollection
AtlasHitsVector< TileHit > TileHitVector
void messageVerbose(const QString &) const
Identifier cellID() const
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
void handleDetDescrElementHit(const CaloDetDescrElement *hitElement, SoVertexProperty *hitVtxProperty, unsigned int &hitCount)
static QString str(const QString &s)
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Eigen::Matrix< double, 3, 1 > Vector3D
@ u
Enums for curvilinear frames.
AtlasHitsVector< sTGCSimHit > sTGCSimHitCollection