97 QWidget* controller =
new QWidget(0);
98 Ui::SimHitControllerForm ui;
99 ui.setupUi(controller);
102 m_clockwork->checkBoxNamesMap.insert(ui.chbxPixelHits,
"Pixel");
103 m_clockwork->checkBoxNamesMap.insert(ui.chbxSCTHits,
"SCT");
104 m_clockwork->checkBoxNamesMap.insert(ui.chbxTRTHits,
"TRT");
105 m_clockwork->checkBoxNamesMap.insert(ui.chbxMDTHits,
"MDT");
106 m_clockwork->checkBoxNamesMap.insert(ui.chbxRPCHits,
"RPC");
107 m_clockwork->checkBoxNamesMap.insert(ui.chbxTGCHits,
"TGC");
108 m_clockwork->checkBoxNamesMap.insert(ui.chbxCSCHits,
"CSC");
109 m_clockwork->checkBoxNamesMap.insert(ui.chbxMMHits,
"MM");
110 m_clockwork->checkBoxNamesMap.insert(ui.chbxsTGCHits,
"sTGC");
111 m_clockwork->checkBoxNamesMap.insert(ui.chbxLArEMBHits,
"LArEMB");
112 m_clockwork->checkBoxNamesMap.insert(ui.chbxLArEMECHits,
"LArEMEC");
113 m_clockwork->checkBoxNamesMap.insert(ui.chbxLArFCALHits,
"LArFCAL");
114 m_clockwork->checkBoxNamesMap.insert(ui.chbxLArHECHits,
"LArHEC");
115 m_clockwork->checkBoxNamesMap.insert(ui.chbxTileHits,
"Tile");
116 m_clockwork->checkBoxNamesMap.insert(ui.chbxGenericMuonHits,
"Generic Muon");
117 m_clockwork->checkBoxNamesMap.insert(ui.chbxForwardRegionHits,
"Forward Region");
120 for(QCheckBox* cb :
m_clockwork->checkBoxNamesMap.keys())
242 if(
m_clockwork->hitsThisEvent.contains(detector)) {
255 unsigned int hitCount = 0;
257 SoVertexProperty* hitVtxProperty =
new SoVertexProperty();
258 SoPointSet* hitPointSet =
new SoPointSet();
260 hitVtxProperty->enableNotify(FALSE);
261 hitPointSet->enableNotify(FALSE);
264 SoMaterial* material =
new SoMaterial();
265 material->diffuseColor.setValue(
m_clockwork->colorMap[detector]);
267 sw->addChild(material);
270 if(detector==
"Pixel")
276 if(sg->
retrieve(p_collection,
"PixelHits")==StatusCode::SUCCESS)
278 for (
const SiHit& hit : *p_collection)
283 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
287 message(
"Unable to retrieve Pixel Hits");
289 else if(detector==
"SCT")
295 if(sg->
retrieve(s_collection,
"SCT_Hits")==StatusCode::SUCCESS)
297 for (
const SiHit& hit : *s_collection)
302 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
306 message(
"Unable to retrieve SCT Hits");
308 else if(detector==
"TRT")
314 if(sg->
retrieve(t_collection,
"TRTUncompressedHits")==StatusCode::SUCCESS)
321 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(), u.z() );
325 message(
"Unable to retrieve TRT Hits");
327 else if(detector==
"LArEMB" || detector==
"LArEMEC" || detector==
"LArFCAL" || detector==
"LArHEC" )
337 std::string collName{
"LArHit"};
338 std::string suff{
""};
340 if (detector==
"LArEMB")
342 else if (detector==
"LArEMEC")
344 else if (detector==
"LArFCAL")
346 else if (detector==
"LArHEC")
350 if(sg->
retrieve(lar_collection, collName)==StatusCode::SUCCESS)
352 for (
auto hi : *lar_collection ) {
354 const LArHit* larHit = hi;
359 message(
"Unable to retrieve the CaloDetDescrElement!");
363 message(
"Unable to retrieve " + QString::fromStdString(collName) );
365 else if(detector==
"Tile")
375 if(sg->
retrieve(t_collection,
"TileHitVec")==StatusCode::SUCCESS)
377 for (
const TileHit& hit : *t_collection) {
384 message(
"Unable to retrieve the CaloDetDescrElement!");
388 message(
"Unable to retrieve Tile Hits");
390 else if(detector==
"MDT")
396 if(sg->
retrieve(mdt_collection)==StatusCode::SUCCESS)
398 for (
const MDTSimHit& hit : *mdt_collection)
403 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
407 message(
"Unable to retrieve MDT Hits");
409 else if(detector==
"RPC")
415 if(sg->
retrieve(rpc_collection)==StatusCode::SUCCESS) {
416 for (
const RPCSimHit& hit : *rpc_collection)
421 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
425 message(
"Unable to retrieve RPC Hits");
427 else if(detector==
"TGC")
433 if (sg->
retrieve(tgc_collection)==StatusCode::SUCCESS)
435 for (
const TGCSimHit& hit : *tgc_collection)
440 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
444 message(
"Unable to retrieve TGC Hits");
446 else if(detector==
"CSC")
452 if(sg->
retrieve(csc_collection)==StatusCode::SUCCESS)
454 for (
const CSCSimHit& hit : *csc_collection)
459 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
463 message(
"Unable to retrieve CSC Hits");
465 else if(detector==
"MM")
471 if(sg->
retrieve(mm_collection)==StatusCode::SUCCESS)
473 for(
const MMSimHit& hit : *mm_collection )
478 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
482 message(
"Unable to retrieve MM Hits");
484 else if(detector==
"sTGC")
490 if(sg->
retrieve(stgc_collection)==StatusCode::SUCCESS)
492 for(
const sTGCSimHit& hit : *stgc_collection )
497 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
501 message(
"Unable to retrieve sTGC Hits");
503 else if(detector==
"Generic Muon")
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)
514 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
522 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
526 message(
"Unable to retrieve Generic Muon Hits from "+key);
528 }
else if(detector==
"Forward Region")
533 message(
"Trying for ForwardRegion (as many collections as can be found)");
536 if(sg->
retrieve( generic_collection,key.toStdString().c_str() )==StatusCode::SUCCESS)
539 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
547 hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z());
551 message(
"Unable to retrieve Simulation Hits from "+key);
556 hitPointSet->numPoints=hitCount;
557 hitPointSet->vertexProperty.setValue(hitVtxProperty);
558 sw->addChild(hitPointSet);
559 hitPointSet->enableNotify(TRUE);
560 hitVtxProperty->enableNotify(TRUE);