12 #include "ui_simhitcontrollerform.h"
27 #include "CaloDetDescr/CaloDetDescrElement.h"
51 #include <Inventor/C/errors/debugerror.h>
52 #include <Inventor/nodes/SoDrawStyle.h>
53 #include <Inventor/nodes/SoMaterial.h>
54 #include <Inventor/nodes/SoSeparator.h>
55 #include <Inventor/nodes/SoSwitch.h>
56 #include <Inventor/nodes/SoVertexProperty.h>
57 #include <Inventor/nodes/SoPointSet.h>
58 #include <Inventor/SbColor.h>
84 :
IVP13DSystemSimple(
"Sim Hits",
"Display simulation hits from trackers and calorimeters",
"Vakho Tsulaia <Vakhtang.Tsulaia@cern.ch>, Riccardo Maria Bianchi <Riccardo.Maria.Bianchi@cern.ch>"),
97 QWidget* controller =
new QWidget(0);
98 Ui::SimHitControllerForm ui;
99 ui.setupUi(controller);
175 SoDrawStyle*
ds =
new SoDrawStyle();
176 ds->style.setValue(SoDrawStyle::POINTS);
189 message(
"0 pointer to the Store Gate!");
196 SoSwitch* sw =
new SoSwitch();
197 sw->whichChild = SO_SWITCH_NONE;
206 sw->whichChild = SO_SWITCH_ALL;
215 QCheckBox* cb =
dynamic_cast<QCheckBox*
>(sender());
228 sw->whichChild = SO_SWITCH_ALL;
231 sw->whichChild = SO_SWITCH_NONE;
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();
267 sw->addChild(material);
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");
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");
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");
337 std::string collName{
"LArHit"};
338 std::string
suff{
""};
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) );
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");
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");
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");
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");
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");
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");
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");
508 message(
"Trying for Generic Muon (as many collections as can be found)");
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);
566 float x = hitElement->
x();
567 float y = hitElement->
y();
568 double z = hitElement->
z();
569 hitVtxProperty->vertex.set1Value(hitCount++,
x,
y,
z);