//#include //#include //#include //#include //#include #include "TEveManager.h" #include "TGeoManager.h" #include "TEveGeoNode.h" #include "TEvePointSet.h" #include "TEveBoxSet.h" #include "TEveLine.h" #include "TEveScene.h" #include "TEveEventManager.h" #include "TGeoManager.h" #include "TGeoMaterial.h" #include "TGeoMedium.h" #include "TGeoVolume.h" #include "TGeoTrack.h" #include "TParticle.h" #include "TRandom.h" #include "TTimer.h" #include "TPad.h" #include "TROOT.h" #include "RtypesCore.h" //============================================================================== // Constants. //------------------------------------------------------------------------------ const Double_t kX_max = 300; // Top Volume Box dimensions const Double_t kY_max = 300; const Double_t kZ_max = 300; const Double_t kR_min = 240; // child Tube dimensions const Double_t kR_max = 250; const Double_t kZ_d = 300; const TLorentzVector vrtxo = TLorentzVector(0., 0., 0., 0.); // collision point const TEveVectorD origin = TEveVectorD(0., 0., 0.); //------------------------------------------------------------------------------ void pbr_create_geo() { // define a new geometry object "EZB_sim_geo" if (gGeoManager) { delete gGeoManager; } // new call below initializes gGeoManager global pointer new TGeoManager("EZB_sim_geo", "simple detector geometry-cube enclosure+cylinder"); //-- materials definitions TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0); TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); //-- media definitions TGeoMedium *Vacuum = new TGeoMedium("Vacuum",1, matVacuum); TGeoMedium *Al = new TGeoMedium("Root Material",2, matAl); matVacuum->SetTransparency(50); // [0] this is the top volume cube TGeoVolume *top = gGeoManager->MakeBox("TOP",Vacuum,kX_max,kY_max,kZ_max); gGeoManager->SetTopVisible(); gGeoManager->SetTopVolume(top); top->SetFillColor(3); // [1] this is the cylinder TGeoVolume *vcylinder= gGeoManager->MakeTube("Cylinder",Al, kR_min, kR_max, kZ_d); // Al <-> nullptr <- placeholder for TGeoMedium* vcylinder->SetLineColor(kGreen); TGeoShape *scylinder= vcylinder->GetShape(); top->AddNode(vcylinder,1); gGeoManager->CloseGeometry(); } void qpbr_tracks() { Double_t t_coll = 1.; // collision time (calc. below?) Double_t rfP0 = 1.0; // set incoming beam particle momentum Double_t rfE0 = 10.0; // set incoming beam particle energy //_ geometry rendering pbr_create_geo(); TEveManager::Create(); // this initializes gEve global pointer TEveGeoTopNode* top = new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode()); // "/TOP_1/Cylinder_1" top->SetVisOption(0); top->SetVisLevel(6); gEve->AddGlobalElement(top); //_ end geometry rendering //_ track generation auto propag = new TEveTrackPropagator(); propag->SetStepper(TEveTrackPropagator::kRungeKutta); //propag->SetRnrDecay(kFALSE); auto tracks = new TEveElementList("Tracks"); auto pmc = new TEvePathMarkD(TEvePathMarkD::kDecay, origin, t_coll); // collision vertex mark // at the origin // 2x primary particle beams Int_t Nptracks = 2; auto p1 = new TParticle(); auto p2 = new TParticle(); // primary vertex p1->SetProductionVertex(0.,0., kZ_max ,0.); p2->SetProductionVertex(0.,0.,-kZ_max ,0.); p1->SetMomentum(0.,0.,-rfP0,rfE0); p2->SetMomentum(0.,0.,+rfP0,rfE0); auto track = new TEveTrack(p1,0,propag); track->AddPathMark(*pmc); track->MakeTrack(); track->SetMainColor(kYellow); tracks->AddElement(track); track = new TEveTrack(p2,1,propag); track->AddPathMark(*pmc); track->MakeTrack(); track->SetMainColor(kYellow); tracks->AddElement(track); // 4x secondary particle products (arbitrary Energy+Momentum) auto rnd = gRandom; Double_t rfE; Int_t Nstracks = 4; for (Int_t i =Nptracks; i<(Nstracks+Nptracks); i++) { auto p = new TParticle(); rfE = rnd->Uniform(rfE0); p->SetProductionVertex(vrtxo); p->SetMomentum(3.*pow(-1,i),0.,(1.+i)*pow(-1,i),rfE); auto track = new TEveTrack(p,i,propag); track->MakeTrack(); track->SetMainColor(kBlue); track->SetName(Form("track %d",i+1)); track->SetLineColor((pow(-1,i) > 0 ? kBlue : kRed)); track->SetRnrPoints(kTRUE); track->SetMarkerStyle(4); track->PrintPathMarks(); tracks->AddElement(track); } gEve->GetEventScene()->AddElement(tracks); //_ end track generation gEve->FullRedraw3D(kTRUE); }