//*************************************************** // Event Display implementation: 3D View // For the GEM-TPC decoding/monitoring software // // based on the genfit Display written by Karl Bicker // // author: Johannes Rauch // E18, Technische Universitaet Muenchen // //*************************************************** #include "PndTpcClustVis.h" #include "PndTpcAbsClusterFinder.h" #include "PndTpcClusterFinder.h" #include "PndTpcClusterFinderSimple.h" #include "PndTpcSPHit.h" #include "PndMultiField.h" #include "TGeoManager.h" #include "TStopwatch.h" #include "FairRootManager.h" #include "TDatabasePDG.h" #include "GFAbsTrackRep.h" #include "GFAbsRecoHit.h" #include "GFDetPlane.h" #include "GFException.h" #include "GFKalman.h" #include "GFTools.h" #include "GFTrack.h" #include "GFTrackCand.h" #include "FairGeane.h" #include "FairGeanePro.h" #include "GeaneTrackRep.h" #include "GeaneTrackRep2.h" #include "RKTrackRep.h" #include "DebugLogger.h" #include "PndDetectorList.h" #define DEBUG 0 PndTpcClustVis* PndTpcClustVis::eventDisplay = NULL; PndTpcClustVis::PndTpcClustVis(): tree(NULL), digisBranch(NULL), clustersBranch(NULL), preFitBranch(NULL), postFitBranch(NULL), NsectorsToProcess(1), fpurityCut(1.), fpurityLoCut(0.), guiEvent(0), fEventId(0), ClHasChanged(true), doClustering(false), ClMode(2), ClTimeslice(3),ClTimecut(2), ClSingleDigiClAmpCut(15), ClClAmpCut(9), ClElPerADC(600.), ClErrorNorm(300.), ClSimpleCl(true), ClSimpleTimeslice(4), ClSimpleMaxClusterSlice(3000), instantRedraw(true), drawTpc(false), TpcTransp(80), drawRawDigis(false), drawDigis(false), drawClusters(false), drawClusterErrors(false), drawRiemannTracks(true), drawPOCA(false), drawFitMarkers(false), doPR(true), clearUnfitted(true), doMerge(true), doGlobMerge(true), doClean(false), _sorting(3), _interactionZ(0), _sortingMode(true), PRNHits(999999999), PRStage(5), _minpoints(4), _planecut(0.04), _riproxcut(0.1), _szcut(0.2), _proxcut(1.9), _proxZstretch(1.6), _helixcut(0.2), _TTproxcut(7.0), _TTplanecut(0.015), _TTszcut(0.33), _TTdipcut(0.1), _TThelixcut(0.3), PRHasChanged(true), fRiemannScale(8.6), initDip(4.), doFit(false), invertCharge(false), useGeane(false), numIts(0), smooth(false), Bz(0) { if(!gApplication) { std::cout << "In PndTpcClustVis ctor: gApplication not found, creating..." << std::flush; TApplication* rootApp = new TApplication("ROOT_application", 0, 0); std::cout << "done!" << std::endl; } if(!gEve) { std::cout << "In PndTpcClustVis ctor: gEve not found, creating..." << std::flush; TEveManager::Create(); std::cout << "done!" << std::endl; } //init colors //colors.push_back(kRed); colors.push_back(kGreen); colors.push_back(kBlue); colors.push_back(kCyan+1); colors.push_back(kMagenta); colors.push_back(kYellow+1); colors.push_back(kRed-7); colors.push_back(kSpring+5); colors.push_back(kCyan-3); colors.push_back(kOrange+1); // Build hit factory ----------------------------- clusterArray = new TClonesArray("PndTpcCluster"); _theRecoHitFactory = new GFRecoHitFactory(); _theRecoHitFactory->addProducer(kTpcCluster,new GFRecoHitProducer(clusterArray)); } void PndTpcClustVis::initDigimapper(double drifField, double gain, double spread, double zGem, double samplingFreq, double wallclock, std::string gasfile, std::string padplanefile, std::string padshapefile){ fgain=gain; // init Digimapper std::cout<<"init DigiMapper with \n" <<" Drift Field : "<init(fpadplane,fgem,fgas,fpadShapes,fzGem,t0,sf); // build a clusterbuffer for each sector; fnsectors=PndTpcDigiMapper::getInstance()->getPadPlane()->GetNSectors(); std::cerr << "Found " << fnsectors << " sectors in padplane" << std::endl; for(unsigned int isect=0;isect; } // init geane stuff //fRun = new FairRunAna(); //GeanePro = new FairGeanePro(); // todo: crashes //fRun->SetBeamMom(15); //PndMultiField *fField= new PndMultiField("FULL"); //fRun->SetField(fField); } PndTpcClustVis* PndTpcClustVis::getInstance() { if(eventDisplay == NULL) { eventDisplay = new PndTpcClustVis(); } return eventDisplay; } PndTpcClustVis::~PndTpcClustVis() { reset(); } void PndTpcClustVis::reset() {} void PndTpcClustVis::setTree(TTree* treeIn) { tree = treeIn; if(tree==NULL) { std::cerr<<"WARNING: Tree not found!"<Print(); tree->SetBranchAddress("PndTpcDigi", &digisBranch); if(digisBranch==NULL) std::cerr<<"WARNING: No Digi Branch found!"<Print(); tree->SetBranchAddress("PndTpcCluster", &clustersBranch); if(clustersBranch==NULL) std::cerr<<"WARNING: No Cluster Branch found!"<Print(); if (digisBranch==NULL && clustersBranch==NULL) exit(1); //tree->SetBranchAddress("TrackPreFit", &preFitBranch); } void PndTpcClustVis::next(unsigned int stp) { gotoEvent(fEventId+stp);} void PndTpcClustVis::prev(unsigned int stp) { gotoEvent(fEventId-stp);} int PndTpcClustVis::getNEvents() { return tree->GetEntries(); } void PndTpcClustVis::gotoEvent(int id) { if(id < 0) id = 0; else if(id >= tree->GetEntries()) id = tree->GetEntries() - 1; bool resetCam = kFALSE; if(id!=fEventId){ resetCam = kTRUE; ClHasChanged=true; PRHasChanged=true; } fEventId = id; if(gEve->GetCurrentEvent()!=NULL) gEve->GetCurrentEvent()->DestroyElements(); std::cout << "\nAt event " << fEventId << std::endl; drawEvent(fEventId, resetCam); } void PndTpcClustVis::open() { if(getNEvents() > 0) drawEvent(0); makeGui(); gApplication->Run(kTRUE); } void PndTpcClustVis::drawEvent(unsigned int id, bool resetCam) { if (NsectorsToProcess>fnsectors) NsectorsToProcess=fnsectors; // Draw tpc double tpcLength(72.5); double tpcOffset(-62); bool panda = false; if(fRiemannScale >10) panda = true; if (panda) { tpcLength = 150; tpcOffset = -39.5; } if(drawTpc){ std::cerr<<"drawTpc..."<SetShape(new TGeoTube(15.,42., 0.5*tpcLength)); else tpc_shape->SetShape(new TGeoTube(5.,15., 0.5*tpcLength)); tpc_shape->SetTransMatrix(*tpc_trans); tpc_shape->SetMainColor(kBlue); tpc_shape->SetMainTransparency(char(TpcTransp)); gEve->AddElement(tpc_shape); } //std::cerr<<"tree->GetEntry("<GetEntry(id); //std::cerr<<"done"<clearBufferMap(); fcluster_buffer=fbuffermap[0]; PndTpcAbsClusterFinder* ffinder = 0; if(!ClSimpleCl){ ffinder=new PndTpcClusterFinder(PndTpcDigiMapper::getInstance()->getPadPlane(), fcluster_buffer, ClTimeslice, ClMode, -1,true,1.,ClTimecut,fgain/ClElPerADC,ClErrorNorm); ffinder->checkConsistency(); } else{ ffinder=new PndTpcClusterFinderSimple(PndTpcDigiMapper::getInstance()->getPadPlane(), fcluster_buffer, ClSimpleTimeslice,fgain/ClElPerADC,ClErrorNorm); ((PndTpcClusterFinderSimple*)(ffinder))->setNoXclust(false); ((PndTpcClusterFinderSimple*)(ffinder))->setMaxClusterSlice(ClSimpleMaxClusterSlice); } ffinder->setTrivialClustering(false); ffinder->saveRaw(); ffinder->reset(); //process digis int ndigis = digisBranch->GetEntriesFast(); std::vector digis(ndigis); for(int k=0; kAt(k); digis[k]=digi; } std::cout<<"number of digis: "<process(digis); } catch (std::exception& e) { std::cout << e.what() << std::endl; } catch (...) { std::cout << "unknown exception..." << std::endl; } timer.Stop(); Double_t ctime = timer.CpuTime(); std::cerr<<"cpu time for clustering: "<size()){ if( ((*fcluster_buffer)[i])->amp() <= ClClAmpCut * ((*fcluster_buffer)[i])->size() || (((*fcluster_buffer)[i])->size()==1 && ((*fcluster_buffer)[i])->amp()<=ClSingleDigiClAmpCut)){ delete (*fcluster_buffer)[i]; (*fcluster_buffer).erase( (*fcluster_buffer).begin()+i ); } else ++i; } // distribute to sectors i=0; while(isize()){ if( ((*fcluster_buffer)[i])->sector() != 0){ fbuffermap[((*fcluster_buffer)[i])->sector()]->push_back(((*fcluster_buffer)[i])); (*fcluster_buffer).erase( (*fcluster_buffer).begin()+i ); } else ++i; } } else if(!doClustering && clustersBranch!=NULL && ClHasChanged){ // fill clusters in cluster_buffer (and use fbuffermap) this->clearBufferMap(); std::cerr<<"Fetching clusters from cluster branch..."<GetEntriesFast(); for(unsigned int isect=0;isectreserve(ncl/fnsectors+10); unsigned int createdClusters(0); for(unsigned int i=0; iAt(i); // omit clusters outside chamber if (true && (cluster->pos().Z()pos().Z()>tpcLength+tpcOffset)) continue; // TODO: make configurable!!!! fbuffermap[cluster->sector()]->push_back(cluster); ++createdClusters; } std::cout << "number of clusters: " << createdClusters << std::endl; } // end else (read clusters from file) else{ std::cerr<<"Warning: no clusters were created"<size(); ++i){ PndTpcCluster* cl = (*(fbuffermap[isect]))[i]; cl->SetIndex(icl); new ((*clusterArray)[icl]) PndTpcCluster(*cl); ++icl; } } } // // DRAW // if(drawRawDigis && digisBranch!=NULL){ // draw raw digis std::cerr<<"draw raw digis..."<GetEntriesFast(); std::cout<<"number of digis: "<At(j); this->drawDigi(digi); } // end loop over digis }// end draw raw digis // draw clusters and digis if(drawDigis || drawClusters){ std::cerr<<"draw digis and/or clusters..."<size(); std::cerr << "number of clusters: " << ncl << " in sector " << isect << std::endl; unsigned int tenpercent=(unsigned int)(ncl*0.1); for(unsigned int i=0; inDigi(); for(unsigned int j=0; jgetDigi(j); this->drawDigi(digi, false, colors[colour]); } // end loop over digis } // end draw digis if(drawClusters && !doPR) this->drawCluster(cluster, colors[colour]); }// end loop over clusters }// end loop over sectors; std::cout << std::endl; } // end DRAW // // Pattern Reco // if(doPR && (PRHasChanged || ClHasChanged)){ std::cerr << "Starting Pattern Reco..." << std::endl; PRHasChanged=false; // clean up friemannlist! for(int i=0; isetSorting(_sorting); _trackfinder->setInteractionZ(_interactionZ); _trackfinder->setSortingMode(_sortingMode); _trackfinder->setMinHitsForFit(_minpoints); _trackfinder->setScale(fRiemannScale); _trackfinder->setMaxNumHitsForPR(PRNHits); _trackfinder->setProxcut(_proxcut); _trackfinder->setTTProxcut(_TTproxcut); // Hit-Track Correlators _trackfinder->addCorrelator(new PndTpcProximityHTCorrelator(_proxcut, _proxZstretch)); _trackfinder->addCorrelator(new PndTpcHelixHTCorrelator(_helixcut)); // Track-Track Correlators _trackfinder->addTTCorrelator(new PndTpcProximityTTCorrelator(_TTproxcut)); _trackfinder->addTTCorrelator(new PndTpcDipTTCorrelator(_TTdipcut, _TThelixcut)); _trackfinder->addTTCorrelator(new PndTpcRiemannTTCorrelator(_TTplanecut, _minpoints)); /// PLAN: /// 1) build several cluster buffer, sectorwise /// 2) run trackfinder over each clusterbuffer independently /// 3) put all found tracklets into one list /// 4) then do start merging //---------------------------------------------------------------------------------------------------- double _maxRadius(42); unsigned int _minHitsZ(15); unsigned int _minHitsR(20); unsigned int _minHitsPhi(10); if(!panda){ _maxRadius=15; } unsigned int size(0); // size of biggest sector unsigned int nTotCl(0); // number of total clusters unsigned int bufferSize; for(unsigned int isect=0;isectsize(); nTotCl += bufferSize; if(bufferSize > size) size = bufferSize; } ++size; std::vector riemannTempSec; // temporary storage, reused for every sector std::vector riemannTempCirc; // temporary global storage for circle tracks std::vector riemannTemp; // temporary global storage for arbitrary tracks TStopwatch timer; timer.Start(); // loop over sectors, find specific track topologies for(unsigned int isect=0;isectsize() << " clusters" << std::endl; fcluster_buffer=fbuffermap[isect]; // copying needed for display in order not to have to rebuild the fbuffermap // because the clusterbuffer ist altered by the PR std::vector cluster_buffer = *(fbuffermap[isect]); unsigned int nErasedCl(0); if(PRStage==1) _trackfinder->setMaxNumHitsForPR(PRNHits); else _trackfinder->setMaxNumHitsForPR(size); // find steep tracks _trackfinder->setSorting(2); _trackfinder->setMinHits(_minHitsZ); _trackfinder->SkipCrossingAreas(true); _trackfinder->SetSkipAndDelete(true); _trackfinder->buildTracks(cluster_buffer,riemannTempSec); // put found goodtracks into friemannlist and delete clusters from buffer unsigned int nGoodSteepTrks(0); for(unsigned int i=0; igetNumHits() > _minHitsZ && fabs(riemannTempSec[i]->dip()-TMath::PiOver2())> 0.2){ if ((PRStage==1 || PRStage>4)) friemannlist.push_back(riemannTempSec[i]); // clear clusters for(unsigned int iCl=0; iCl < riemannTempSec[i]->getNumHits(); ++iCl){ cluster_buffer.erase( remove(cluster_buffer.begin(), cluster_buffer.end(), riemannTempSec[i]->getHit(iCl)->cluster()), cluster_buffer.end() ); ++nErasedCl; } ++nGoodSteepTrks; } else{ // delete bad tracklets riemannTempSec[i]->deleteHits(); delete riemannTempSec[i]; } } // clear riemannTempSec riemannTempSec.clear(); std::cerr << " found steep tracks: " << nGoodSteepTrks << std::endl; // end find steep tracks if(PRStage==2) _trackfinder->setMaxNumHitsForPR(PRNHits); else if(PRStage<2) _trackfinder->setMaxNumHitsForPR(0); else if(PRStage>2) _trackfinder->setMaxNumHitsForPR(size); // find circle tracks _trackfinder->setSorting(5); _trackfinder->setMinHits(_minHitsPhi); _trackfinder->SkipCrossingAreas(true); _trackfinder->initTracks(false, 0, 0); _trackfinder->SetSkipAndDelete(true); _trackfinder->buildTracks(cluster_buffer,riemannTempSec); // put found goodtracks into friemannlist and delete clusters from buffer unsigned int nGoodCirlceTrks(0); for(unsigned int i=0; igetNumHits() > _minHitsPhi) { if (PRStage==2 || PRStage>4) riemannTempCirc.push_back(riemannTempSec[i]); // clear clusters for(unsigned int iCl=0; iCl < riemannTempSec[i]->getNumHits(); ++iCl){ cluster_buffer.erase( remove(cluster_buffer.begin(), cluster_buffer.end(), riemannTempSec[i]->getHit(iCl)->cluster()), cluster_buffer.end() ); ++nErasedCl; } ++nGoodCirlceTrks; } else{ // delete bad tracklets riemannTempSec[i]->deleteHits(); delete riemannTempSec[i]; } } // clear riemannTempSec riemannTempSec.clear(); std::cerr << " found circle tracks: " << nGoodCirlceTrks << std::endl; // end find circle tracks if(PRStage==3) _trackfinder->setMaxNumHitsForPR(PRNHits); else if(PRStage<3) _trackfinder->setMaxNumHitsForPR(0); else if(PRStage>3) _trackfinder->setMaxNumHitsForPR(size); // find circle tracks _trackfinder->setSorting(-5); _trackfinder->setMinHits(_minHitsPhi); _trackfinder->SkipCrossingAreas(true); _trackfinder->initTracks(false, 0, 0); _trackfinder->SetSkipAndDelete(true); _trackfinder->buildTracks(cluster_buffer,riemannTempSec); // put found goodtracks into friemannlist and delete clusters from buffer unsigned int nGoodCirlceTrks2(0); for(unsigned int i=0; igetNumHits() > _minHitsPhi) { if (PRStage==3 || PRStage>4) riemannTempCirc.push_back(riemannTempSec[i]); // clear clusters for(unsigned int iCl=0; iCl < riemannTempSec[i]->getNumHits(); ++iCl){ cluster_buffer.erase( remove(cluster_buffer.begin(), cluster_buffer.end(), riemannTempSec[i]->getHit(iCl)->cluster()), cluster_buffer.end() ); ++nErasedCl; } ++nGoodCirlceTrks2; } else{ // delete bad tracklets riemannTempSec[i]->deleteHits(); delete riemannTempSec[i]; } } // clear riemannTempSec riemannTempSec.clear(); std::cerr << " found circle tracks: " << nGoodCirlceTrks2 << std::endl; // end find circle tracks std::cerr << "\n this reduced the number of clusters by " << nErasedCl << std::endl; if(PRStage==4) _trackfinder->setMaxNumHitsForPR(PRNHits); else if(PRStage<4) _trackfinder->setMaxNumHitsForPR(0); else if(PRStage>4) _trackfinder->setMaxNumHitsForPR(size); // build rest of the tracks _trackfinder->initTracks(false); _trackfinder->SkipCrossingAreas(true); _trackfinder->SetSkipAndDelete(false); _trackfinder->setSorting(3); _trackfinder->buildTracks(cluster_buffer,riemannTempSec); // end build rest of the tracks if(doMerge) { std::cerr << " merge " << riemannTempSec.size() << " tracks in sector " << isect; _trackfinder->mergeTracks(riemannTempSec); std::cerr << " ... done - created " << riemannTempSec.size() << " merged tracks" <getNumHits() < _minpoints){ riemannTemp[i]->deleteHits(); delete riemannTemp[i]; riemannTemp.erase(riemannTemp.begin() + i); --i; } } } if(doGlobMerge && fnsectors>1) { std::cerr << "merge " << riemannTempCirc.size() << " circular tracks ... "; _trackfinder->mergeTracks(riemannTempCirc); std::cerr << " done - created " << riemannTempCirc.size() << " merged tracks" <mergeTracks(riemannTemp); std::cerr << " done - created " << riemannTemp.size() << " merged tracks" <getNumHits() <= _minpoints+1 || (friemannlist[i]->getFirstHit()->cluster()->pos() - friemannlist[i]->getLastHit()->cluster()->pos()).Mag() < 4.){ friemannlist[i]->deleteHits(); delete friemannlist[i]; friemannlist.erase(friemannlist.begin() + i); --i; } } } if(doGlobMerge && fnsectors>1) { std::cerr << "\nfinal merge of friemannlist: merge " << friemannlist.size() << " tracks ... "; _trackfinder->mergeTracks(friemannlist); std::cerr << " done - created " << friemannlist.size() << " merged tracks" <getNumHits(); } std::cerr << "Pattern Reco finished, found tracks: " << friemannlist.size() << "\n"; std::cerr << "used " << nUsedCl << " of " << nTotCl << " Clusters \n"; printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime); //---------------------------------------------------------------------------------------------------- } // end PR ClHasChanged=false; // draw PR results unsigned int counter=0; if(doPR && (drawClusters || drawRiemannTracks)){ std::cerr<<"draw PR results..."< draw only bad tracks if((trkcand->mcid().MaxRelWeight()mcid().MaxRelWeight()>fpurityCut) && (fpurityLoCut>0. || fpurityCut<1.)){ //std::cerr << "Skippping good track" << std::endl; continue; } unsigned int nhits=trkcand->getNumHits(); int colour = ir%colors.size(); TVector3 old_track_pos, pos; TEveStraightLineSet* track_lines = NULL; if(drawPOCA) old_track_pos = friemannlist[ir]->pocaToZ(); for(unsigned int ih=0;ihgetHit(ih)->cluster(); if(drawClusters) this->drawCluster(cluster, colors[colour]); // connect clusters if(drawRiemannTracks){ pos = cluster->pos(); if(track_lines==NULL) track_lines = new TEveStraightLineSet; if(ih > 0 || (ih==0 && drawPOCA && friemannlist[ir]->isFitted()) ) { track_lines->AddLine(old_track_pos(0), old_track_pos(1), old_track_pos(2), pos(0), pos(1), pos(2)); track_lines->SetMainColor(colors[colour]); track_lines->SetLineWidth(1); } old_track_pos = pos; } } // end loop over clusters if(track_lines != NULL) gEve->AddElement(track_lines); } // end loop over trackcands std::cerr<<" done"<init(new GFConstField(0.,0.,Bz)); int minhits = 3; // minimum hits needed to build pndtrackcands and GFTrackCands if(minhits<_minpoints) minhits=_minpoints; double pbackup = 2.; // momentum value that is set when other initialisations fail // loop over riemann tracks for(unsigned int itrk=0; itrkgetNumHits(); if (DEBUG) std::cout<<"Tracklet "<isFitted() && !trk->isInitialized() || trk->isInitialized()){ std::cout<<" - skipping, riemann track not fitted"<sinDip(); if (TMath::Abs(trackSinDip)<0.01) { if (DEBUG) std::cout<<" - skipping, sin(dip) too small: "<getMom(Bz); if (Bz==0) p=pbackup; if(p<1E-4) { if (DEBUG) std::cout<<" - skipping, momentum too small: "<mcid().DominantID().mctrackID()); // check pdg int pdg(211); //if(1) pdg=((PndMCTrack*)(_mcTrackArray->At(trackId)))->GetPdgCode(); double pdgCharge(TDatabasePDG::Instance()->GetParticle(pdg)->Charge()/3.); int winding(trk->winding()); // we look in z direction! if (pdgCharge < 0) { pdg *= -1; pdgCharge *= -1.; } if (winding > 0) { pdg *= -1; pdgCharge *= -1.; } if (Bz < 0) { pdg *= -1; pdgCharge *= -1.; } // check sorting bool invertTrack(true); TVector3 ps1=trk->getFirstHit()->cluster()->pos(); TVector3 ps2=trk->getLastHit()->cluster()->pos(); if(ps1.Z() < ps2.Z()-7) invertTrack = false; else if(ps1.Z() > ps2.Z()+7) invertTrack = true; else if (ps1.Perp()>ps2.Perp()+5) invertTrack = true; else if (ps1.Perp()GetParticle(pdg); if(part == 0){ if (DEBUG) std::cout << " - skipping, unknown PDG id: " << pdg; continue; } if (DEBUG) std::cout<addHit(21,trk->getHit(ih)->cluster()->index()); } trk->getPosDirOnHelix(0, pos1, direction); } else { // invert track for(unsigned int ih=nhits; ih>0; --ih){ cand->addHit(21,trk->getHit(ih-1)->cluster()->index()); } trk->getPosDirOnHelix(trk->getNumHits()-1, pos1, direction); direction *= -1.; }// finished filling hits TVector3 poserr(1,1,1); poserr*=trk->resolution(); TVector3 mom(p * direction); TVector3 momerr(fabs(mom.X()),fabs(mom.Y()),fabs(mom.Z())); momerr *= trk->resolution(); double trackR = trk->r(); if (DEBUG) { double trackDip = trk->dip(); std::cout<<" center of track "; trk->center().Print(); std::cout<<" Radius of track [cm]: " << trackR; std::cout<<"\n Dip of track [deg]: " << trackDip/TMath::Pi()*180; std::cout<<"\n seed values: "; std::cout<<"\n start position: "; pos1.Print(); std::cout<<" momentum [GeV]: "<setCurv(1./trackR); cand->setDip(trk->dip()); cand->setComplTrackSeed(pos1, mom, pdg, poserr, momerr*(1./p)); cand->setMcTrackId(trackId); //RK TRACKREP RKTrackRep* rep = new RKTrackRep(pos1, mom, poserr, momerr, pdg); // store GFTracks in output array GFTrack* track=new GFTrack(rep); track->setCandidate(*cand); delete cand; //SMOOTHING if(smooth) track->setSmoothing(true); // // run Kalman // GFKalman fitter; fitter.setNumIterations(numIts); // Load RecoHits try { track->addHitVector(_theRecoHitFactory->createMany(track->getCand())); } catch(GFException& e) { std::cout << e.what() << std::endl; e.info(); throw e; } if(numIts>0){ try{ std::cerr << "Calling processTrack ... "; fitter.processTrack(track); std::cerr << "finished\n" << std::endl; } catch (GFException& e){ std::cout<getCharge(); if(rep->getStatusFlag()) { std::cout << "Warning: Trying to display a track with status flag != 0..."; if(smooth) { std::cout << "trying without smoothing!"; smooth = false; } std::cout << std::endl; } TVector3 track_pos; TVector3 old_track_pos; TEveStraightLineSet* track_lines = NULL; for(int j = 0; j < nhits; j++) { // loop over all hits in the track GFAbsRecoHit* hit = track->getHit(j); GFDetPlane plane; // get the hit infos ------------------------------------------------------------------ TMatrixT state; if(smooth && numIts>0) { TMatrixT cov; TMatrixT auxInfo; GFTools::getSmoothedData(track, 0, j, state, cov, plane, auxInfo); rep->setData(state, plane, &cov, &auxInfo); } else { try{ plane = hit->getDetPlane(rep); rep->extrapolate(plane, state); } catch(GFException& e) { std::cerr << "Error: Exception caught (getDetPlane): Hit " << j << " in Track " << itrk << " skipped!" << std::endl; std::cerr << e.what(); break; /*if (e.isFatal()) { std::cerr<<"Fatal exception, skipping track"<getPos(plane); // finished getting the hit infos ----------------------------------------------------- // sort hit infos into variables ------------------------------------------------------ TVector3 o = plane.getO(); TVector3 u = plane.getU(); TVector3 v = plane.getV(); std::string hit_type = hit->getPolicyName(); bool planar_hit = false; bool planar_pixel_hit = false; bool space_hit = false; bool wire_hit = false; double_t hit_u = 0; double_t hit_v = 0; double_t plane_size = 4; double_t hit_res_u = 0.5; double_t hit_res_v = 0.5; double_t hit_res_z = 0.5; TMatrixT hit_coords(hit->getHitCoord(plane)); TMatrixT hit_cov(hit->getHitCov(plane)); int hit_coords_dim = hit_coords.GetNrows(); if(hit_type == "GFPlanarHitPolicy") { planar_hit = true; if(hit_coords_dim == 1) { hit_u = hit_coords(0,0); hit_res_u = hit_cov(0,0); } else if(hit_coords_dim == 2) { planar_pixel_hit = true; hit_u = hit_coords(0,0); hit_v = hit_coords(1,0); hit_res_u = hit_cov(0,0); hit_res_v = hit_cov(1,1); } } else if (hit_type == "GFSpacepointHitPolicy") { space_hit = true; plane_size = 4; } else if (hit_type == "GFWireHitPolicy") { wire_hit = true; hit_u = hit_coords(0,0); plane_size = 4; } else { std::cout << "Track " << itrk << ", Hit " << j << ": Unknown policy name: skipping hit!" << std::endl; break; } if(plane_size < 4) plane_size = 4; // finished setting variables --------------------------------------------------------- // draw track if corresponding option is set ------------------------------------------ if(true) { if(track_lines == NULL) track_lines = new TEveStraightLineSet; if(j > 0) track_lines->AddLine(old_track_pos(0), old_track_pos(1), old_track_pos(2), track_pos(0), track_pos(1), track_pos(2)); old_track_pos = track_pos; if(charge > 0) track_lines->SetLineColor(kRed); else track_lines->SetLineColor(kAzure); track_lines->SetLineWidth(2); if(drawFitMarkers) track_lines->AddMarker(track_pos(0), track_pos(1), track_pos(2)); } // finished drawing track ------------------------------------------------------------- } // end loop over all hits in the track if(track_lines != NULL) gEve->AddElement(track_lines); delete track; } } if(resetCam) gEve->Redraw3D(kTRUE); else gEve->Redraw3D(kFALSE); } void PndTpcClustVis::clearBufferMap(){ for(unsigned int isect=0;isectsize(); ++icl){ delete (*(fbuffermap[isect]))[icl]; } }*/ fbuffermap[isect]->clear(); } clusterArray->Delete(); } void PndTpcClustVis::drawDigi(const PndTpcDigi* digi, bool raw, Color_t color){ // map digi TVector3 pos; if(digi->padId()<0) return; PndTpcDigiMapper::getInstance()->map(digi,pos); TGeoMatrix* det_trans = new TGeoGenTrans(pos.X(), pos.Y(), pos.Z(), 1,1,1, 0); TEveGeoShape* digi_shape = new TEveGeoShape("digi_shape"); // calculate and norm amp double amp = digi->amp(); // should be ~ 6 .. 2000 if(amp<1) return; amp = TMath::Log(amp); // ~ 0.8 .. 3.3 amp *= 0.02; if(raw) amp -= 0.001; digi_shape->SetShape(new TGeoTube(0.,amp, 0.05 ) ); digi_shape->SetTransMatrix(*det_trans); if(!raw) digi_shape->SetMainColor(color); else digi_shape->SetMainColor(kGray); if(!raw) digi_shape->SetMainTransparency(45); else digi_shape->SetMainTransparency(50); gEve->AddElement(digi_shape); } void PndTpcClustVis::drawCluster(const PndTpcCluster* cluster, Color_t color){ TVector3 pos; TVector3 err; pos = cluster->pos(); TGeoMatrix* det_trans = new TGeoGenTrans(pos.X(), pos.Y(), pos.Z(), 1., 1., 1., 0); TEveGeoShape* cluster_shape = new TEveGeoShape("cluster_shape"); if(drawClusterErrors){ err = cluster->sig(); cluster_shape->SetShape(new TGeoBBox(err.X(), err.Y(), err.Z()) ); } //else cluster_shape->SetShape(new TGeoSphere(0., 0.25) ); else cluster_shape->SetShape(new TGeoBBox(0.1,0.1,0.1) ); cluster_shape->SetTransMatrix(*det_trans); cluster_shape->SetMainColor(color); cluster_shape->SetMainTransparency(40); gEve->AddElement(cluster_shape); } void PndTpcClustVis::makeGui() { TEveBrowser* browser = gEve->GetBrowser(); browser->StartEmbedding(TRootBrowser::kLeft); TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1200, 800); frmMain->SetWindowName("Pandoras Playground"); frmMain->SetCleanup(kDeepCleanup); TGTextButton* tb = 0; TGLabel* lbl = 0; PndTpcClustVis* fh = PndTpcClustVis::getInstance(); TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain); { // evt number entry lbl = new TGLabel(hf, "Go to event: "); hf->AddFrame(lbl); guiEvent = new TGNumberEntry(hf, 0, 9,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99999); hf->AddFrame(guiEvent); guiEvent->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiGoto()"); // redraw button tb = new TGTextButton(hf, "Redraw Event"); hf->AddFrame(tb); tb->Connect("Clicked()", "PndTpcClustVis", fh, "guiGoto()"); } frmMain->AddFrame(hf); // draw options hf = new TGHorizontalFrame(frmMain); { lbl = new TGLabel(hf, "\n Draw Options"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiInstantRedraw = new TGCheckButton(hf, "Instant redraw after changing parameters"); if(instantRedraw) guiInstantRedraw->Toggle(); hf->AddFrame(guiInstantRedraw); guiInstantRedraw->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawTpc = new TGCheckButton(hf, "Draw TPC"); if(drawTpc) guiDrawTpc->Toggle(); hf->AddFrame(guiDrawTpc); guiDrawTpc->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiTpcTransp = new TGNumberEntry(hf, TpcTransp, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 100); hf->AddFrame(guiTpcTransp); guiTpcTransp->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); lbl = new TGLabel(hf, "TPC Transparency"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawRawDigis = new TGCheckButton(hf, "Draw Digis from DigiBranch"); if(drawRawDigis) guiDrawRawDigis->Toggle(); hf->AddFrame(guiDrawRawDigis); guiDrawRawDigis->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawDigis = new TGCheckButton(hf, "Draw Digis from Clusters"); if(drawDigis) guiDrawDigis->Toggle(); hf->AddFrame(guiDrawDigis); guiDrawDigis->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawClusters = new TGCheckButton(hf, "Draw Clusters"); if(drawClusters) guiDrawClusters->Toggle(); hf->AddFrame(guiDrawClusters); guiDrawClusters->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawClustersErrors = new TGCheckButton(hf, "Draw Cluster Errors"); if(drawClusterErrors) guiDrawClustersErrors->Toggle(); hf->AddFrame(guiDrawClustersErrors); guiDrawClustersErrors->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawRiemannTracks = new TGCheckButton(hf, "Draw Riemann Tracks"); if(drawRiemannTracks) guiDrawRiemannTracks->Toggle(); hf->AddFrame(guiDrawRiemannTracks); guiDrawRiemannTracks->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawPOCA = new TGCheckButton(hf, "Draw POCAs to z-axis"); if(drawPOCA) guiDrawPOCA->Toggle(); hf->AddFrame(guiDrawPOCA); guiDrawPOCA->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDrawFitMarkers = new TGCheckButton(hf, "Draw Fit-Markers"); if(drawFitMarkers) guiDrawFitMarkers->Toggle(); hf->AddFrame(guiDrawFitMarkers); guiDrawFitMarkers->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain->AddFrame(hf); // event mix options hf = new TGHorizontalFrame(frmMain); { lbl = new TGLabel(hf, "\n Event Mix Options"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiNsectorsToProcess = new TGNumberEntry(hf, NsectorsToProcess, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 80); hf->AddFrame(guiNsectorsToProcess); guiNsectorsToProcess->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); lbl = new TGLabel(hf, "Number of sectors to process"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guifpurityLoCut = new TGNumberEntry(hf, fpurityLoCut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 1); hf->AddFrame(guifpurityLoCut); guifpurityLoCut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); lbl = new TGLabel(hf, "Draw only tracks with purity more than x"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guifpurityCut = new TGNumberEntry(hf, fpurityCut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 1); hf->AddFrame(guifpurityCut); guifpurityCut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); lbl = new TGLabel(hf, "Draw only tracks with purity less than x"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { tb = new TGTextButton(hf, "Write DebugLogger files"); hf->AddFrame(tb); tb->Connect("Clicked()", "PndTpcClustVis", fh, "writeDebugLogger()"); } frmMain->AddFrame(hf); // Clusterfinder Params hf = new TGHorizontalFrame(frmMain); { lbl = new TGLabel(hf, "\n Clustering"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiDoClustering = new TGCheckButton(hf, "Run Clustering"); if(doClustering) guiDoClustering->Toggle(); hf->AddFrame(guiDoClustering); guiDoClustering->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiMode = new TGNumberEntry(hf, ClMode, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2); hf->AddFrame(guiMode); guiMode->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Mode"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { giuTimeslice = new TGNumberEntry(hf, ClTimeslice, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 100); hf->AddFrame(giuTimeslice); giuTimeslice->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Timeslice"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { giuTimecut = new TGNumberEntry(hf, ClTimecut, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 100); hf->AddFrame(giuTimecut); giuTimecut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Timecut"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiSingleDigiClAmpCut = new TGNumberEntry(hf, ClSingleDigiClAmpCut, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2000); hf->AddFrame(guiSingleDigiClAmpCut); guiSingleDigiClAmpCut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Single Digi-Cluster Amp cut"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiClAmpCut = new TGNumberEntry(hf, ClClAmpCut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2000); hf->AddFrame(guiClAmpCut); guiClAmpCut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Cluster Amp cut"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiElPerADC = new TGNumberEntry(hf, ClElPerADC, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2000); hf->AddFrame(guiElPerADC); guiElPerADC->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Electrons per ADC count"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiErrorNorm = new TGNumberEntry(hf, ClErrorNorm, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2000); hf->AddFrame(guiErrorNorm); guiErrorNorm->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Error Normalization Constant"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { guiSimpleCl = new TGCheckButton(hf, "Use Simple Clustering"); if(ClSimpleCl) guiSimpleCl->Toggle(); hf->AddFrame(guiSimpleCl); guiSimpleCl->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { giuSimpleTimeslice = new TGNumberEntry(hf, ClSimpleTimeslice, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 100); hf->AddFrame(giuSimpleTimeslice); giuSimpleTimeslice->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Timeslice for Simple Clustering"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); hf = new TGHorizontalFrame(frmMain); { giuSimpleMaxClusterSlice = new TGNumberEntry(hf, ClSimpleMaxClusterSlice, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive, TGNumberFormat::kNELLimitMinMax, 0, 1000000); hf->AddFrame(giuSimpleMaxClusterSlice); giuSimpleMaxClusterSlice->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetClusterfinderParams()"); lbl = new TGLabel(hf, "Clusterslice for Simple Clustering z sectoring"); hf->AddFrame(lbl); } frmMain->AddFrame(hf); frmMain->MapSubwindows(); frmMain->Resize(); frmMain->MapWindow(); browser->StopEmbedding(); browser->SetTabTitle("Options & Clustering", 0); browser->StartEmbedding(TRootBrowser::kLeft); TGMainFrame* frmMain2 = new TGMainFrame(gClient->GetRoot(), 1200, 800); frmMain2->SetWindowName("Pandoras Playground"); frmMain2->SetCleanup(kDeepCleanup); hf = new TGHorizontalFrame(frmMain2); { lbl = new TGLabel(hf, "\n Pattern Recognition"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiDoPR = new TGCheckButton(hf, "Run Pattern Recognition"); if(doPR) guiDoPR->Toggle(); hf->AddFrame(guiDoPR); guiDoPR->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetDrawParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { // evt number entry lbl = new TGLabel(hf, "Do PR up to Hit: "); hf->AddFrame(lbl); guiPRNHits = new TGNumberEntry(hf, PRNHits, 9,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99999); hf->AddFrame(guiPRNHits); guiPRNHits->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); // redraw button tb = new TGTextButton(hf, "Redraw Event"); hf->AddFrame(tb); tb->Connect("Clicked()", "PndTpcClustVis", fh, "guiGoto()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { // evt number entry lbl = new TGLabel(hf, "Do PR stage (5=all): "); hf->AddFrame(lbl); guiPRStage = new TGNumberEntry(hf, PRStage, 9,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 10); hf->AddFrame(guiPRStage); guiPRStage->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); } frmMain2->AddFrame(hf); // sorting parameters hf = new TGHorizontalFrame(frmMain2); { guisorting = new TGNumberEntry(hf, _sorting, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 4); hf->AddFrame(guisorting); guisorting->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Sorting Mode"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiinteractionZ = new TGNumberEntry(hf, _interactionZ, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, -80, 100); hf->AddFrame(guiinteractionZ); guiinteractionZ->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Z-position of interaction point (for sorting Mode 4)"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guisortingMode = new TGCheckButton(hf, "Use sorting of riemann tracker"); if(_sortingMode) guisortingMode->Toggle(); hf->AddFrame(guisortingMode); guisortingMode->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); } frmMain2->AddFrame(hf); // Trackfinder Parameters hf = new TGHorizontalFrame(frmMain2); { guiminpoints = new TGNumberEntry(hf, _minpoints, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 200); hf->AddFrame(guiminpoints); guiminpoints->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "min points for helix-fit"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiplanecut = new TGNumberEntry(hf, _planecut, 6,999, TGNumberFormat::kNESRealFour, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2); hf->AddFrame(guiplanecut); guiplanecut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Planecut"); hf->AddFrame(lbl); } //frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiriproxcut = new TGNumberEntry(hf, _riproxcut, 6, 999, TGNumberFormat::kNESRealFour, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 2); hf->AddFrame(guiriproxcut); guiriproxcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Riemann proximity cut"); hf->AddFrame(lbl); } //frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiszcut = new TGNumberEntry(hf, _szcut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiszcut); guiszcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "sz cut"); hf->AddFrame(lbl); } //frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiproxcut = new TGNumberEntry(hf, _proxcut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiproxcut); guiproxcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Proximity cut"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiproxZstretch = new TGNumberEntry(hf, _proxZstretch, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEAPositive, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiproxZstretch); guiproxZstretch->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Proximity cut z stretch"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guihelixcut = new TGNumberEntry(hf, _helixcut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guihelixcut); guihelixcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Helix cut"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); // Trackmerger Parameters hf = new TGHorizontalFrame(frmMain2); { guiClearUnfitted = new TGCheckButton(hf, "Delete unfitted tracklets before merging"); if(clearUnfitted) guiClearUnfitted->Toggle(); hf->AddFrame(guiClearUnfitted); guiClearUnfitted->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiDoMerge = new TGCheckButton(hf, "Do TrackMerging in sectors"); if(doMerge) guiDoMerge->Toggle(); hf->AddFrame(guiDoMerge); guiDoMerge->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiDoGlobMerge = new TGCheckButton(hf, "Do global TrackMerging"); if(doGlobMerge) guiDoGlobMerge->Toggle(); hf->AddFrame(guiDoGlobMerge); guiDoGlobMerge->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiTTproxcut = new TGNumberEntry(hf, _TTproxcut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiTTproxcut); guiTTproxcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "TT Proximity cut"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiTTplanecut = new TGNumberEntry(hf, _TTplanecut, 6,999, TGNumberFormat::kNESRealFour, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 0.99); hf->AddFrame(guiTTplanecut); guiTTplanecut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "TT plane cut"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiTTdipcut = new TGNumberEntry(hf, _TTdipcut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiTTdipcut); guiTTdipcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "TT dip cut"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiTThelixcut = new TGNumberEntry(hf, _TThelixcut, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiTThelixcut); guiTThelixcut->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "TT helix cut"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiDoClean = new TGCheckButton(hf, "Find only target tracks"); if(doClean) guiDoClean->Toggle(); hf->AddFrame(guiDoClean); guiDoClean->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); } //frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiTTscale = new TGNumberEntry(hf, fRiemannScale, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 99); hf->AddFrame(guiTTscale); guiTTscale->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "RiemannScale"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiInitDip = new TGNumberEntry(hf, initDip, 6,999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, -1000, 1000); hf->AddFrame(guiInitDip); guiInitDip->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetTrackingParams()"); lbl = new TGLabel(hf, "Init Dip"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); // Fitting Parameters hf = new TGHorizontalFrame(frmMain2); { lbl = new TGLabel(hf, "\n Fitting"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiDoFit = new TGCheckButton(hf, "Run Kalman"); if(doFit) guiDoFit->Toggle(); hf->AddFrame(guiDoFit); guiDoFit->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetFittingParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiInvertCharge = new TGCheckButton(hf, "Invert Charge"); if(invertCharge) guiInvertCharge->Toggle(); hf->AddFrame(guiInvertCharge); guiInvertCharge->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetFittingParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiUseGeane = new TGCheckButton(hf, "Use Geane"); if(useGeane) guiUseGeane->Toggle(); hf->AddFrame(guiUseGeane); guiUseGeane->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetFittingParams()"); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiNumIts = new TGNumberEntry(hf, numIts, 6,999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 20); hf->AddFrame(guiNumIts); guiNumIts->Connect("ValueSet(Long_t)", "PndTpcClustVis", fh, "guiSetFittingParams()"); lbl = new TGLabel(hf, "Number of iterations for the Kalman Filter"); hf->AddFrame(lbl); } frmMain2->AddFrame(hf); hf = new TGHorizontalFrame(frmMain2); { guiSmooth = new TGCheckButton(hf, "Use smoothing"); if(smooth) guiDoFit->Toggle(); hf->AddFrame(guiSmooth); guiSmooth->Connect("Toggled(Bool_t)", "PndTpcClustVis", fh, "guiSetFittingParams()"); } frmMain2->AddFrame(hf); frmMain2->MapSubwindows(); frmMain2->Resize(); frmMain2->MapWindow(); browser->StopEmbedding(); browser->SetTabTitle("PR & Fitting", 0); } void PndTpcClustVis::guiGoto(){ PndTpcClustVis* fh = PndTpcClustVis::getInstance(); Long_t n = guiEvent->GetNumberEntry()->GetIntNumber(); fh->gotoEvent(n); } void PndTpcClustVis::guiSetDrawParams(){ instantRedraw=(guiInstantRedraw->IsOn()); drawTpc=(guiDrawTpc->IsOn()); TpcTransp=guiTpcTransp->GetNumberEntry()->GetIntNumber(); drawRawDigis=(guiDrawRawDigis->IsOn()); drawDigis=(guiDrawDigis->IsOn()); drawClusters=(guiDrawClusters->IsOn()); drawClusterErrors=(guiDrawClustersErrors->IsOn()); doPR=(guiDoPR->IsOn()); drawRiemannTracks=(guiDrawRiemannTracks->IsOn()); NsectorsToProcess = guiNsectorsToProcess->GetNumberEntry()->GetNumber(); fpurityLoCut = guifpurityLoCut->GetNumberEntry()->GetNumber(); fpurityCut = guifpurityCut->GetNumberEntry()->GetNumber(); drawPOCA=(guiDrawPOCA->IsOn()); drawFitMarkers=(guiDrawFitMarkers->IsOn()); PndTpcClustVis* fh = PndTpcClustVis::getInstance(); if(instantRedraw) fh->gotoEvent(fEventId); } void PndTpcClustVis::guiSetClusterfinderParams(){ ClHasChanged=true; doClustering=(guiDoClustering->IsOn()); ClMode = guiMode->GetNumberEntry()->GetIntNumber(); ClTimeslice = giuTimeslice->GetNumberEntry()->GetIntNumber(); ClTimecut = giuTimecut->GetNumberEntry()->GetIntNumber(); ClSingleDigiClAmpCut = guiSingleDigiClAmpCut->GetNumberEntry()->GetIntNumber(); ClClAmpCut = guiClAmpCut->GetNumberEntry()->GetNumber(); ClElPerADC = guiElPerADC->GetNumberEntry()->GetNumber(); ClErrorNorm = guiErrorNorm->GetNumberEntry()->GetNumber(); ClSimpleCl=(guiSimpleCl->IsOn()); ClSimpleTimeslice = giuSimpleTimeslice->GetNumberEntry()->GetIntNumber(); ClSimpleMaxClusterSlice = giuSimpleMaxClusterSlice->GetNumberEntry()->GetIntNumber(); PndTpcClustVis* fh = PndTpcClustVis::getInstance(); if(instantRedraw) fh->gotoEvent(fEventId); } void PndTpcClustVis::guiSetTrackingParams(){ PRHasChanged=true; PRNHits = guiPRNHits->GetNumberEntry()->GetIntNumber(); PRStage = guiPRStage->GetNumberEntry()->GetIntNumber(); _sorting = guisorting->GetNumberEntry()->GetIntNumber(); _interactionZ = guiinteractionZ->GetNumberEntry()->GetNumber(); _sortingMode=(guisortingMode->IsOn()); _minpoints = guiminpoints->GetNumberEntry()->GetIntNumber(); _planecut = guiplanecut->GetNumberEntry()->GetNumber(); _riproxcut = guiriproxcut->GetNumberEntry()->GetNumber(); _szcut = guiszcut->GetNumberEntry()->GetNumber(); _proxcut = guiproxcut->GetNumberEntry()->GetNumber(); _proxZstretch = guiproxZstretch->GetNumberEntry()->GetNumber(); _helixcut = guihelixcut->GetNumberEntry()->GetNumber(); _TTproxcut = guiTTproxcut->GetNumberEntry()->GetNumber(); _TTplanecut = guiTTplanecut->GetNumberEntry()->GetNumber(); //_TTszcut = guiTTszcut->GetNumberEntry()->GetNumber(); _TTdipcut = guiTTdipcut->GetNumberEntry()->GetNumber(); _TThelixcut = guiTThelixcut->GetNumberEntry()->GetNumber(); fRiemannScale=guiTTscale->GetNumberEntry()->GetNumber(); initDip=guiInitDip->GetNumberEntry()->GetNumber(); clearUnfitted=(guiClearUnfitted->IsOn()); doMerge=(guiDoMerge->IsOn()); doGlobMerge=(guiDoGlobMerge->IsOn()); doClean=(guiDoClean->IsOn()); PndTpcClustVis* fh = PndTpcClustVis::getInstance(); if(instantRedraw) fh->gotoEvent(fEventId); } void PndTpcClustVis::guiSetFittingParams(){ doFit=(guiDoFit->IsOn()); invertCharge=(guiInvertCharge->IsOn()); useGeane=(guiUseGeane->IsOn()); numIts=guiNumIts->GetNumberEntry()->GetNumber(); smooth=(guiSmooth->IsOn()); PndTpcClustVis* fh = PndTpcClustVis::getInstance(); if(instantRedraw) fh->gotoEvent(fEventId); } void PndTpcClustVis::writeDebugLogger(){ DebugLogger::Instance()->WriteFiles(); } ClassImp(PndTpcClustVis)