293{
295 if(
m_clockwork->hitsThisEvent.contains(detector)) {
297 }
300 }
303 }
304
305
308 unsigned int hitCount = 0;
309
310 SoVertexProperty* hitVtxProperty = new SoVertexProperty();
311 SoPointSet* hitPointSet = new SoPointSet();
312
313 hitVtxProperty->enableNotify(FALSE);
314 hitPointSet->enableNotify(FALSE);
315
316
317 SoMaterial* material = new SoMaterial();
318 material->diffuseColor.setValue(
m_clockwork->colorMap[detector]);
319
320 sw->addChild(material);
321
322
323 if(detector=="ITkPixel")
324 {
326 }
327 else if(detector=="ITkStrip")
328 {
330 }
331 else if(detector=="Pixel")
332 {
334 }
335 else if(detector=="SCT")
336 {
338 }
339 else if(detector=="TRT")
340 {
341
342
343
345 if(sg->
retrieve(t_collection,
"TRTUncompressedHits")==StatusCode::SUCCESS)
346 {
347 for (const TRTUncompressedHit& hit : *t_collection)
348 {
349 GeoTRTUncompressedHit ghit(hit);
350 if(!ghit) continue;
352 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
353 }
354 }
355 else
356 message(
"Unable to retrieve TRT Hits");
357 }
358 else if(detector=="HGTD")
359 {
360
361
362
364 if(sg->
retrieve(p_collection,
"HGTD_Hits")==StatusCode::SUCCESS)
365 {
366 for (const SiHit& hit : *p_collection)
367 {
368 GeoSiHit ghit(hit);
369 if(!ghit) continue;
370 HepGeom::Point3D<double>
u = ghit.getGlobalPosition();
371 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
372 }
373 }
374 else
375 message(
"Unable to retrieve HGTD Hits");
376 }
377 else if(detector=="LArEMB" || detector=="LArEMEC" || detector=="LArFCAL" || detector=="LArHEC" )
378 {
379
380
381
382
383
384
386
387 std::string collName{"LArHit"};
388 std::string
suff{
""};
389
390 if (detector=="LArEMB")
392 else if (detector=="LArEMEC")
394 else if (detector=="LArFCAL")
396 else if (detector=="LArHEC")
399
400 if(sg->
retrieve(lar_collection, collName)==StatusCode::SUCCESS)
401 {
402 for (auto hi : *lar_collection ) {
403
404 const LArHit* larHit = hi;
405 const CaloDetDescrElement* ddElement =
m_clockwork->lar_dd_man->get_element(larHit->
cellID());
406 if (ddElement)
408 else
409 message(
"Unable to retrieve the CaloDetDescrElement!");
410 }
411 }
412 else
413 message(
"Unable to retrieve " + QString::fromStdString(collName) );
414 }
415 else if(detector=="Tile")
416 {
417
418
419
420
421
422
424
425 if(sg->
retrieve(t_collection,
"TileHitVec")==StatusCode::SUCCESS)
426 {
427 for (const TileHit& hit : *t_collection) {
428 Identifier pmt_id = hit.identify();
429 Identifier cell_id =
m_clockwork->tile_id->cell_id(pmt_id);
430 const CaloDetDescrElement* ddElement = (
m_clockwork->tile_id->is_tile_aux(cell_id)) ? 0 :
m_clockwork->tile_dd_man->get_cell_element(cell_id);
431 if (ddElement)
433 else
434 message(
"Unable to retrieve the CaloDetDescrElement!");
435 }
436 }
437 else
438 message(
"Unable to retrieve Tile Hits");
439 }
440 else if(detector=="MDT")
441 {
442
443
444
446 if(sg->
retrieve(mdt_collection)==StatusCode::SUCCESS)
447 {
448 for (const MDTSimHit& hit : *mdt_collection)
449 {
450 GeoMDTHit ghit(hit);
451 if(!ghit) continue;
453 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
454 }
455 }
456 else
457 message(
"Unable to retrieve MDT Hits");
458 }
459 else if(detector=="RPC")
460 {
461
462
463
465 if(sg->
retrieve(rpc_collection)==StatusCode::SUCCESS) {
466 for (const RPCSimHit& hit : *rpc_collection)
467 {
468 GeoRPCHit ghit(hit);
469 if(!ghit) continue;
471 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
472 }
473 }
474 else
475 message(
"Unable to retrieve RPC Hits");
476 }
477 else if(detector=="TGC")
478 {
479
480
481
483 if (sg->
retrieve(tgc_collection)==StatusCode::SUCCESS)
484 {
485 for (const TGCSimHit& hit : *tgc_collection)
486 {
487 GeoTGCHit ghit(hit);
488 if(!ghit) continue;
490 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
491 }
492 }
493 else
494 message(
"Unable to retrieve TGC Hits");
495 }
496 else if(detector=="CSC")
497 {
498
499
500
502 if(sg->
retrieve(csc_collection)==StatusCode::SUCCESS)
503 {
504 for (const CSCSimHit& hit : *csc_collection)
505 {
506 GeoCSCHit ghit(hit);
507 if (!ghit) continue;
509 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
510 }
511 }
512 else
513 message(
"Unable to retrieve CSC Hits");
514 }
515 else if(detector=="MM")
516 {
517
518
519
521 if(sg->
retrieve(mm_collection)==StatusCode::SUCCESS)
522 {
523 for( const MMSimHit& hit : *mm_collection )
524 {
525 GeoMMHit ghit(hit);
526 if(!ghit) continue;
528 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
529 }
530 }
531 else
532 message(
"Unable to retrieve MM Hits");
533 }
534 else if(detector=="sTGC")
535 {
536
537
538
540 if(sg->
retrieve(stgc_collection)==StatusCode::SUCCESS)
541 {
542 for( const sTGCSimHit& hit : *stgc_collection )
543 {
544 GeosTGCHit ghit(hit);
545 if(!ghit) continue;
547 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
548 }
549 }
550 else
551 message(
"Unable to retrieve sTGC Hits");
552 }
553 else if(detector=="Generic Muon")
554 {
555
556
557
558 message(
"Trying for Generic Muon (as many collections as can be found)");
559 for(const QString& key : VP1SGContentsHelper(this).getKeys<GenericMuonSimHitCollection>()) {
561 if(sg->
retrieve( generic_collection,
key.toStdString().c_str() )==StatusCode::SUCCESS)
562 {
564 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
565
566
567 for (const GenericMuonSimHit& hit : *generic_collection)
568 {
569
570 const GenericMuonSimHit ghit(hit);
572 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
573 }
574 }
575 else
576 message(
"Unable to retrieve Generic Muon Hits from "+key);
577 }
578 } else if(detector=="Forward Region")
579 {
580
581
582
583 message(
"Trying for ForwardRegion (as many collections as can be found)");
584 for(const QString& key : VP1SGContentsHelper(this).getKeys<SimulationHitCollection>()) {
586 if(sg->
retrieve( generic_collection,
key.toStdString().c_str() )==StatusCode::SUCCESS)
587 {
589 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
590
591
592 for (const SimulationHit& hit : *generic_collection)
593 {
594
595 const SimulationHit ghit(hit);
597 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
598 }
599 }
600 else
601 message(
"Unable to retrieve Simulation Hits from "+key);
602 }
603 } else {
605 }
606
607
608 hitPointSet->numPoints=hitCount;
609 hitPointSet->vertexProperty.setValue(hitVtxProperty);
610 sw->addChild(hitPointSet);
611 hitPointSet->enableNotify(TRUE);
612 hitVtxProperty->enableNotify(TRUE);
613}
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*.
static void messageWarningRed(const QString &str, IVP1System *sys=0)
void handleDetDescrElementHit(const CaloDetDescrElement *hitElement, SoVertexProperty *hitVtxProperty, unsigned int &hitCount)
void fillHitPositionsFromSiHitCollection(const std::string &collName, const StoreGateSvc *sg, SoVertexProperty *hitVtxProperty, unsigned int &hitCount)
Helper function to get the global position of a SiHit item.
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