// // Description: // Fucking draw the shit. // // Environment: // Software developed for FOPI GEM-TPC // // Author List: // Felix Boehmer TUM (original author) // // //----------------------------------------------------------- #include "FopiEventDisplayTask.h" #include "GenfitDisplay.h" #include "TClonesArray.h" #include "FairRun.h" #include "FairRuntimeDb.h" #include "FairRootManager.h" #include "TGeoShape.h" #include "TGeoMatrix.h" #include "TGeoTube.h" #include "TEveGeoShape.h" #include "TEveStraightLineSet.h" #include "TpcDigiPar.h" #include "GFTrack.h" #include "CdcTrack.h" #include ClassImp(FopiEventDisplayTask) FopiEventDisplayTask::FopiEventDisplayTask() : fOptions(""), fCdcCircleBranchName("CdcTrack") {;} InitStatus FopiEventDisplayTask::Init() { //Get ROOT Manager FairRootManager* ioman= FairRootManager::Instance(); if(ioman==0) { Error("FopiEventDisplayTask::Init","RootManager not instantiated!"); return kERROR; } fGFTrackArray=(TClonesArray*) ioman->GetObject(fGFTrackBranchName); if(fGFTrackArray==0) { Error("FopiEventDisplayTask::Init","CDC GFTrack-array not found!"); return kERROR; } fCdcCircleArray=(TClonesArray*) ioman->GetObject(fCdcCircleBranchName); if(fCdcCircleArray==0) { Error("FopiEventDisplayTask::Init","CDC CdcCircle-array not found!"); return kERROR; } fDisplay = GenfitDisplay::getInstance(); fDisplay->setOptions(fOptions.Data()); return kSUCCESS; } void FopiEventDisplayTask::SetParContainers() { std::cout<<"FopiEventDisplayTask::SetParContainers"<GetRuntimeDb(); if ( ! db ) Fatal("SetParContainers", "No runtime database"); // Get Tpc digitisation parameter container fPar= (TpcDigiPar*) db->getContainer("TpcDigiPar"); if (! fPar ) Fatal("SetParContainers", "TpcDigiPar not found"); } void FopiEventDisplayTask::Exec(Option_t* opt) { std::vector tracklist; for(unsigned int it=0; itGetEntriesFast(); it++) { GFTrack* track = (GFTrack*) fGFTrackArray->At(it); tracklist.push_back(track); } fDisplay->addEvent(tracklist); std::vector shapes; std::vector lines; for(unsigned int is=0; isGetEntriesFast(); is++) { CdcTrack* track = (CdcTrack*)fCdcCircleArray->At(is); double charge = track->GetCharge(); double rad = std::fabs(track->GetRadius()); double mx = track->GetMx(); double my = track->GetMy(); double theta = 0.5*TMath::Pi()-track->GetTheta(); //radians TString name("cdc_track"); TEveStraightLineSet* lineset = new TEveStraightLineSet(name.Data()); lineset->SetLineColor(kTeal+3); lineset->SetLineWidth(2.); //vector from circle center to origin: TVector3 start(mx,my,0.); double steplength = 0.4; // double d_alpha = steplength/rad; double totrot = 0.; //pointing to the track points: TVector3 target = -1.*start; target.SetMag(rad); target.SetZ(track->GetZ0()); TVector3 target0 = target; TVector3 pos = target+start; //real position on the track while(pos.Perp() < 100 && totrot < TMath::Pi()) { //todo: check for charge -> determine rotation sense TEveVector lastPoint(pos.X(),pos.Y(),pos.Z()); //move to the next point: if(charge<0.) target.RotateZ(d_alpha); else target.RotateZ(-d_alpha); double dz = steplength * TMath::Tan(theta); target.SetZ(target.Z() + dz); pos = target + start; totrot += d_alpha; TEveVector newPoint(pos.X(),pos.Y(),pos.Z()); lineset->AddLine(lastPoint,newPoint); } std::cout<<" adding CDC track around ("<addShapes(shapes); fDisplay->addLines(lines); }