void display2(const char *filename="gilc.root", Int_t nevent=0, Int_t *tracks=0, Int_t ntracks=0) { // Dynamically link some shared libs if (gClassTable->GetID("IlcRun") < 0) { gROOT->LoadMacro("loadlibs.C"); loadlibs(); } else { // delete gIlc->GetRunLoader(); delete gIlc; gIlc = 0; } //gSystem->Load("libIlcL3Src"); gSystem->Load("libDISPLAY"); // Connect the ROOT Gilc file containing Geometry, Kine and Hits IlcRunLoader *rl = 0; TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); if(file) { Info("display2.C", "gilc.root is already open"); } rl = IlcRunLoader::Open(filename, "DISPLAYED EVENT"); if (rl == 0) { Error("display2.C", "can not get Run Loader, exiting..."); return; } // Get IlcRun object from file or create it if not on file rl->LoadgIlc(); gIlc = rl->GetIlcRun(); if (!gIlc) { Error("display2.C", "IlcRun object not found on file, exiting..."); return; } // Create Event Display object IlcDisplay2 *edisplay = new IlcDisplay2(gClient->GetRoot(), 900, 700); // if (ntracks > 0) edisplay->SetTracksToDisplay(tracks, ntracks); // Display the requested event rl->GetEvent(nevent); rl->LoadKinematics(); rl->LoadHeader(); rl->LoadHits(); //edisplay->FindModules(); edisplay->ShowNextEvent(0); }
void test(const char * sdir ="signal", const char * bdir ="backgr") { TStopwatch timer; timer.Start(); TString name; // Signal file, tree, and branch name = sdir; name += "/IlcESDs.root"; TFile * fSig = TFile::Open(name.Data()); TTree * tSig = (TTree*)fSig->Get("esdTree"); IlcESDEvent * esdSig = new IlcESDEvent();// The signal ESD object is put here esdSig->ReadFromTree(tSig); // Run loader (signal events) name = sdir; name += "/gilc.root"; IlcRunLoader* rlSig = IlcRunLoader::Open(name.Data()); // Run loader (underlying events) name = bdir; name += "/gilc.root"; IlcRunLoader* rlUnd = IlcRunLoader::Open(name.Data(),"Underlying"); // gIlc rlSig->LoadgIlc(); rlUnd->LoadgIlc(); gIlc = rlSig->GetIlcRun(); // Now load kinematics and event header rlSig->LoadKinematics(); rlSig->LoadHeader(); rlUnd->LoadKinematics(); rlUnd->LoadHeader(); // Loop on events: check that MC and data contain the same number of events Long64_t nevSig = rlSig->GetNumberOfEvents(); Long64_t nevUnd = rlUnd->GetNumberOfEvents(); Long64_t nSigPerUnd = nevSig/nevUnd; cout << nevSig << " signal events" << endl; cout << nevUnd << " underlying events" << endl; cout << nSigPerUnd << " signal events per one underlying" << endl; for (Int_t iev=0; iev<nevSig; iev++) { cout << "Signal event " << iev << endl; Int_t ievUnd = iev/nSigPerUnd; cout << "Underlying event " << ievUnd << endl; // Get signal ESD tSig->GetEntry(iev); // Get signal kinematics rlSig->GetEvent(iev); // Get underlying kinematics rlUnd->GetEvent(ievUnd); // Particle stack IlcStack * stackSig = rlSig->Stack(); Int_t nPartSig = stackSig->GetNtrack(); IlcStack * stackUnd = rlUnd->Stack(); Int_t nPartUnd = stackUnd->GetNtrack(); Int_t nrec = esdSig->GetNumberOfTracks(); cout << nrec << " reconstructed tracks" << endl; for(Int_t irec=0; irec<nrec; irec++) { IlcESDtrack * track = esdSig->GetTrack(irec); UInt_t label = TMath::Abs(track->GetTPCLabel()); if (label>=10000000) { // Underlying event. 10000000 is the // value of fkMASKSTEP in IlcRunDigitizer // cout << " Track from the underlying event" << endl; label %=10000000; if (label>=nPartUnd) continue; TParticle * part = stackUnd->Particle(label); if(part) part->Print(); } else { cout << " Track " << label << " from the signal event" << endl; if (label>=nPartSig) { cout <<"Strange, label outside the range "<< endl; continue; } TParticle * part = stackSig->Particle(label); if(part) part->Print(); } } } fSig->Close(); timer.Stop(); timer.Print(); }
Int_t IlcDCHFindClustersFast(Int_t n=0) { IlcRunLoader* rl = IlcRunLoader::Open("gilc.root"); if (rl == 0x0) { cerr<<"Can not open session"<<endl; return 1; } IlcLoader *dchl = (IlcLoader*)rl->GetLoader("DCHLoader"); if (dchl == 0x0) { cerr<<"Can not get DCH Loader"<<endl; return 1; } if (dchl->LoadHits()) { cerr<<"Error occured while loading hits"<<endl; return 1; } if (dchl->LoadRecPoints("recreate")) { cerr<<"Error occured while loading digits"<<endl; return 1; } if (rl->LoadgIlc()) { cerr<<"Error occured while l"<<endl; return 1; } rl->LoadKinematics(); rl->LoadTrackRefs(); rl->LoadHeader(); gIlc=rl->GetIlcRun(); if (!gIlc) { cerr<<"Can't get gIlc !\n"; return 1; } TDirectory *cwd = gDirectory; IlcDCH *dch = (IlcDCH*)gIlc->GetDetector("DCH"); // Int_t ver = dch->IsVersion(); // cerr<<"DCH version "<<ver<<" has been found !\n"; /*if (!gGeoManager) { TString geom = "geometry.root"; TGeoManager::Import(geom.Data()); }*/ IlcDCHParam *param=dch->GetParam(); //param->ReadGeoMatrices(); // param->SetMWPCReadout(false); rl->CdGAFile(); TStopwatch timer; // IlcDCHwireposition *wireMatr = new IlcDCHwireposition(); // IlcDCHclusterizer *clus = new IlcDCHclusterizer("clusterer", "DCH clusterizer"); // IlcDCHFast dchfast(wireMatr,clus); IlcDCHFast dchfast; //n = 30; if (n==0) n = rl->GetNumberOfEvents(); for(Int_t i=0;i<n;i++){ printf("Processing event %d\n",i); rl->GetEvent(i); // tpcfast.Hits2ExactClusters(rl); dchfast.Hits2Clusters(rl,i); } timer.Stop(); timer.Print(); //cleans everything delete rl; // delete wireMatr; // delete clus; return 0; }
Int_t IlcTARGETFindClustersV2(Int_t nev=5, Char_t SlowOrFast='s') { cerr<<"Looking for clusters...\n"; if (gIlc) { delete gIlc->GetRunLoader(); delete gIlc; gIlc=0; } IlcRunLoader *rl = IlcRunLoader::Open("gilc.root"); if (rl == 0x0) { cerr<<"IlcTARGETFindClustersV2.C : Can not open session RL=NULL"<< endl; return 1; } IlcTARGETLoader *itsl = (IlcTARGETLoader*)rl->GetLoader("TARGETLoader"); if (itsl == 0x0) { cerr<<"IlcTARGETFindClustersV2.C : can not get TARGET loader"<< endl; return 2; } rl->LoadKinematics(); Int_t retval = rl->LoadgIlc(); if (retval) { cerr<<"IlcTARGETFindClustersV2.C : LoadgIlc returned error"<< endl; delete rl; return 3; } gIlc=rl->GetIlcRun(); IlcTARGET *TARGET = (IlcTARGET*)gIlc->GetModule("TARGET"); if (!TARGET) { cerr<<"Can't find the TARGET !\n"; delete rl; return 3; } IlcTARGETgeom *geom=TARGET->GetTARGETgeom(); itsl->LoadRecPoints("recreate"); if (SlowOrFast=='s') itsl->LoadDigits("read"); else itsl->LoadHits("read"); if(SlowOrFast=='s'){ IlcTARGETclustererV2 clusterer(geom); TStopwatch timer; if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); for (Int_t i=0; i<nev; i++) { cerr<<"Processing event number: "<<i<<endl; rl->GetEvent(i); TTree *out=itsl->TreeR(); if (!out) { itsl->MakeTree("R"); out=itsl->TreeR(); } TTree *in=itsl->TreeD(); if (!in) { cerr<<"Can't get digits tree !\n"; return 4; } clusterer.Digits2Clusters(in,out); itsl->WriteRecPoints("OVERWRITE"); timer.Stop(); timer.Print(); } } else{ for(Int_t i=0;i<3;i++){ TARGET->SetSimulationModel(i,new IlcTARGETsimulationFastPoints()); } TStopwatch timer; for (Int_t i=0; i<nev; i++) { rl->GetEvent(i); if(itsl->TreeR()== 0x0) itsl->MakeTree("R"); TTree* in = (TTree*)itsl->TreeH(); TTree* out= (TTree*)itsl->TreeR(); timer.Start(); TARGET->Hits2Clusters(in,out); timer.Stop(); timer.Print(); itsl->WriteRecPoints("OVERWRITE"); } } delete rl; return 0; }
void fastGen(Int_t nev = 1, char* filename = "gilc.root") { IlcPDG::AddParticlesToPdgDataBase(); TDatabasePDG::Instance(); // Run loader IlcRunLoader* rl = IlcRunLoader::Open("gilc.root","FASTRUN","recreate"); rl->SetCompressionLevel(2); rl->SetNumberOfEventsPerFile(nev); rl->LoadKinematics("RECREATE"); rl->MakeTree("E"); gIlc->SetRunLoader(rl); // Create stack rl->MakeStack(); IlcStack* stack = rl->Stack(); // Header IlcHeader* header = rl->GetHeader(); // Create and Initialize Generator // Example of charm generation taken from Config_PythiaHeavyFlavours.C IlcGenPythia *gener = new IlcGenPythia(-1); gener->SetEnergyCMS(14000.); gener->SetMomentumRange(0,999999); gener->SetPhiRange(0., 360.); gener->SetThetaRange(0.,180.); // gener->SetProcess(kPyCharmppMNR); // Correct Pt distribution, wrong mult gener->SetProcess(kPyMb); // Correct multiplicity, wrong Pt gener->SetStrucFunc(kCTEQ4L); gener->SetPtHard(2.1,-1.0); gener->SetFeedDownHigherFamily(kFALSE); gener->SetStack(stack); gener->Init(); // Go to gilc.root rl->CdGAFile(); // Forbid some decays. Do it after gener->Init(0, because // the initialization of the generator includes reading of the decay table. IlcPythia * py= IlcPythia::Instance(); py->SetMDME(737,1,0); //forbid D*+->D+ + pi0 py->SetMDME(738,1,0);//forbid D*+->D+ + gamma // Forbid all D0 decays except D0->K- pi+ for(Int_t d=747; d<=762; d++){ py->SetMDME(d,1,0); } // decay 763 is D0->K- pi+ for(Int_t d=764; d<=807; d++){ py->SetMDME(d,1,0); } // // Event Loop // TStopwatch timer; timer.Start(); for (Int_t iev = 0; iev < nev; iev++) { cout <<"Event number "<< iev << endl; // Initialize event header->Reset(0,iev); rl->SetEventNumber(iev); stack->Reset(); rl->MakeTree("K"); // Generate event Int_t nprim = 0; Int_t ntrial = 0; Int_t ndstar = 0; //------------------------------------------------------------------------------------- while(!ndstar) { // Selection of events with D* stack->Reset(); stack->ConnectTree(rl->TreeK()); gener->Generate(); ntrial++; nprim = stack->GetNprimary(); for(Int_t ipart =0; ipart < nprim; ipart++){ TParticle * part = stack->Particle(ipart); if(part) { if (TMath::Abs(part->GetPdgCode())== 413) { TArrayI daughtersId; GetFinalDecayProducts(ipart,*stack,daughtersId); Bool_t kineOK = kTRUE; Double_t thetaMin = TMath::Pi()/4; Double_t thetaMax = 3*TMath::Pi()/4; for (Int_t id=1; id<=daughtersId[0]; id++) { TParticle * daughter = stack->Particle(daughtersId[id]); if (!daughter) { kineOK = kFALSE; break; } Double_t theta = daughter->Theta(); if (theta<thetaMin || theta>thetaMax) { kineOK = kFALSE; break; } } if (!kineOK) continue; part->Print(); ndstar++; } } } } cout << "Number of particles " << nprim << endl; cout << "Number of trials " << ntrial << endl; // Finish event header->SetNprimary(stack->GetNprimary()); header->SetNtrack(stack->GetNtrack()); // I/O stack->FinishEvent(); header->SetStack(stack); rl->TreeE()->Fill(); rl->WriteKinematics("OVERWRITE"); } // event loop timer.Stop(); timer.Print(); // Termination // Generator gener->FinishRun(); // Write file rl->WriteHeader("OVERWRITE"); gener->Write(); rl->Write(); }
void testTARGETMultReco(Char_t* dir = ".") { Char_t str[256]; // ######################################################## // defining pointers IlcRunLoader* runLoader; TFile* esdFile = 0; TTree* esdTree = 0; IlcESD* esd = 0; // ######################################################### // setup gilc and runloader if (gIlc) { delete gIlc->GetRunLoader(); delete gIlc; gIlc=0; } sprintf(str,"%s/gilc.root",dir); runLoader = IlcRunLoader::Open(str); if (runLoader == 0x0) { cout << "Can not open session"<<endl; return; } runLoader->LoadgIlc(); gIlc = runLoader->GetIlcRun(); runLoader->LoadKinematics(); runLoader->LoadHeader(); // ######################################################### // open esd file and get the tree // close it first to avoid memory leak if (esdFile) if (esdFile->IsOpen()) esdFile->Close(); sprintf(str,"%s/IlcESDs.root",dir); esdFile = TFile::Open(str); esdTree = (TTree*)esdFile->Get("esdTree"); TBranch * esdBranch = esdTree->GetBranch("ESD"); esdBranch->SetAddress(&esd); // ######################################################### // setup its stuff IlcTARGET* its=(IlcTARGET*)runLoader->GetIlcRun()->GetDetector("TARGET"); if (!its) { cout << " Can't get the TARGET!" << endl; return ; } IlcTARGETgeom* itsGeo=its->GetTARGETgeom(); if (!itsGeo) { cout << " Can't get the TARGET geometry!" << endl; return ; } IlcTARGETLoader* itsLoader = (IlcTARGETLoader*)runLoader->GetLoader("TARGETLoader"); if (!itsLoader) { cout << " Can't get the TARGET loader!" << endl; return ; } itsLoader->LoadRecPoints("read"); // ######################################################### IlcTARGETMultReconstructor* multReco = new IlcTARGETMultReconstructor(); multReco->SetGeometry(itsGeo); // ######################################################### // getting number of events Int_t nEvents = (Int_t)runLoader->GetNumberOfEvents(); Int_t nESDEvents = esdBranch->GetEntries(); if (nEvents!=nESDEvents) { cout << " Different number of events from runloader and esdtree!!!" << nEvents << " / " << nESDEvents << endl; return; } // ######################################################## // loop over number of events cout << nEvents << " event(s) found in the file set" << endl; for(Int_t i=0; i<nEvents; i++) { cout << "-------------------------" << endl << " event# " << i << endl; runLoader->GetEvent(i); esdBranch->GetEntry(i); // ######################################################## // get the EDS vertex const IlcESDVertex* vtxESD = esd->GetVertex(); Double_t vtx[3]; vtxESD->GetXYZ(vtx); Float_t esdVtx[3]; esdVtx[0] = vtx[0]; esdVtx[1] = vtx[1]; esdVtx[2] = vtx[2]; ///######################################################### // get TARGET clusters TTree* itsClusterTree = itsLoader->TreeR(); if (!itsClusterTree) { cerr<< " Can't get the TARGET cluster tree !\n"; return; } multReco->SetHistOn(kTRUE); multReco->Reconstruct(itsClusterTree, esdVtx, esdVtx); for (Int_t t=0; t<multReco->GetNTracklets(); t++) { cout << " tracklet " << t << " , theta = " << multReco->GetTracklet(t)[0] << " , phi = " << multReco->GetTracklet(t)[1] << endl; } } TFile* fout = new TFile("out.root","RECREATE"); multReco->SaveHists(); fout->Write(); fout->Close(); }
void fastGenPA(Int_t nev = 1, char* filename = "gilc.root") { // Runloader IlcRunLoader* rl = IlcRunLoader::Open("gilc.root", "FASTRUN", "recreate"); rl->SetCompressionLevel(2); rl->SetNumberOfEventsPerFile(10000); rl->LoadKinematics("RECREATE"); rl->MakeTree("E"); gIlc->SetRunLoader(rl); // Create stack rl->MakeStack(); IlcStack* stack = rl->Stack(); // Header IlcHeader* header = rl->GetHeader(); // Create and Initialize Generator IlcGenerator *gener = CreateGenerator(); gener->Init(); gener->SetStack(stack); // // Event Loop // Int_t iev; for (iev = 0; iev < nev; iev++) { printf("\n \n Event number %d \n \n", iev); // Initialize event header->Reset(0,iev); rl->SetEventNumber(iev); stack->Reset(); rl->MakeTree("K"); // Generate event gener->Generate(); // Analysis Int_t npart = stack->GetNprimary(); printf("Analyse %d Particles\n", npart); for (Int_t part=0; part<npart; part++) { TParticle *MPart = stack->Particle(part); Int_t mpart = MPart->GetPdgCode(); } // Finish event header->SetNprimary(stack->GetNprimary()); header->SetNtrack(stack->GetNtrack()); // I/O // stack->FinishEvent(); header->SetStack(stack); rl->TreeE()->Fill(); rl->WriteKinematics("OVERWRITE"); } // event loop // // Termination // Generator gener->FinishRun(); // Write file rl->WriteHeader("OVERWRITE"); gener->Write(); rl->Write(); }
void gen(Int_t nev = 1, char* filename = "gilc.root") { // Load libraries // gSystem->SetIncludePath("-I$ROOTSYS/include -I$ILC_ROOT/include -I$ILC_ROOT"); gSystem->Load("liblhapdf.so"); // Parton density functions gSystem->Load("libEGPythia6.so"); // TGenerator interface gSystem->Load("libpythia6.so"); // Pythia gSystem->Load("libIlcPythia6.so"); // ILC specific implementations IlcPDG::AddParticlesToPdgDataBase(); TDatabasePDG::Instance(); // Run loader IlcRunLoader* rl = IlcRunLoader::Open("gilc.root","FASTRUN","recreate"); rl->SetCompressionLevel(2); rl->SetNumberOfEventsPerFile(nev); rl->LoadKinematics("RECREATE"); rl->MakeTree("E"); gIlc->SetRunLoader(rl); // Create stack rl->MakeStack(); IlcStack* stack = rl->Stack(); // Header IlcHeader* header = rl->GetHeader(); // Create and Initialize Generator gROOT->LoadMacro("$ILC_ROOT/test/vmctest/ppbench/genPPbenchConfig.C"); IlcGenerator* gener = genPPbenchConfig(); // Go to gilc.root rl->CdGAFile(); // Forbid some decays. Do it after gener->Init(0, because // the initialization of the generator includes reading of the decay table. // ... // // Event Loop // TStopwatch timer; timer.Start(); for (Int_t iev = 0; iev < nev; iev++) { cout <<"Event number "<< iev << endl; // Initialize event header->Reset(0,iev); rl->SetEventNumber(iev); stack->Reset(); rl->MakeTree("K"); // Generate event stack->Reset(); stack->ConnectTree(rl->TreeK()); gener->Generate(); cout << "Number of particles " << stack->GetNprimary() << endl; // Finish event header->SetNprimary(stack->GetNprimary()); header->SetNtrack(stack->GetNtrack()); // I/O stack->FinishEvent(); header->SetStack(stack); rl->TreeE()->Fill(); rl->WriteKinematics("OVERWRITE"); } // event loop timer.Stop(); timer.Print(); // Termination // Generator gener->FinishRun(); // Write file rl->WriteHeader("OVERWRITE"); gener->Write(); rl->Write(); }
void fastGen(Int_t nev = 1, char* filename = "gilc.root") { // Run loader IlcRunLoader* rl = IlcRunLoader::Open("gilc.root","FASTRUN","recreate"); rl->SetCompressionLevel(2); rl->SetNumberOfEventsPerFile(nev); rl->LoadKinematics("RECREATE"); rl->MakeTree("E"); gIlc->SetRunLoader(rl); // Create stack rl->MakeStack(); IlcStack* stack = rl->Stack(); // Header IlcHeader* header = rl->GetHeader(); // Generator IlcGenPythia *gener = new IlcGenPythia(-1); gener->SetMomentumRange(0,999999); gener->SetProcess(kPyMb); gener->SetEnergyCMS(14000.); gener->SetThetaRange(45, 135); gener->SetPtRange(0., 1000.); gener->SetStack(stack); gener->Init(); rl->CdGAFile(); // // Event Loop // for (Int_t iev = 0; iev < nev; iev++) { // Initialize event header->Reset(0,iev); rl->SetEventNumber(iev); stack->Reset(); rl->MakeTree("K"); // Generate event Int_t nprim = 0; Int_t ntrial = 0; Int_t minmult = 1000; while(nprim<minmult) { // Selection of events with multiplicity // bigger than "minmult" stack->Reset(); gener->Generate(); ntrial++; nprim = stack->GetNprimary(); } cout << "Number of particles " << nprim << endl; cout << "Number of trials " << ntrial << endl; // Finish event header->SetNprimary(stack->GetNprimary()); header->SetNtrack(stack->GetNtrack()); // I/O stack->FinishEvent(); header->SetStack(stack); rl->TreeE()->Fill(); rl->WriteKinematics("OVERWRITE"); } // event loop // Termination // Generator gener->FinishRun(); // Stack stack->FinishRun(); // Write file rl->WriteHeader("OVERWRITE"); gener->Write(); rl->Write(); }
TEveTrackList* kine_tracks(Double_t min_pt, Double_t min_p, Bool_t pdg_col, Bool_t recurse, Bool_t use_track_refs) { IlcRunLoader* rl = IlcEveEventManager::AssertRunLoader(); rl->LoadKinematics(); IlcStack* stack = rl->Stack(); if (!stack) { Error("kine_tracks", "can not get kinematics."); return 0; } gEve->DisableRedraw(); TEveTrackList* cont = new TEveTrackList("Kine Tracks"); cont->SetMainColor(3); TEveTrackPropagator* trkProp = cont->GetPropagator(); kine_track_propagator_setup(trkProp); gEve->AddElement(cont); Int_t count = 0; Int_t Np = stack->GetNprimary(); for (Int_t i = 0; i < Np; ++i) { TParticle* p = stack->Particle(i); if (p->GetStatusCode() <= 1) { if (p->Pt() < min_pt && p->P() < min_p) continue; ++count; IlcEveTrack* track = new IlcEveTrack(p, i, trkProp); //PH The line below is replaced waiting for a fix in Root //PH which permits to use variable siza arguments in CINT //PH on some platforms (alphalinuxgcc, solariscc5, etc.) //PH track->SetName(Form("%s [%d]", p->GetName(), i)); char form[1000]; sprintf(form,"%s [%d]", p->GetName(), i); track->SetName(form); track->SetStdTitle(); Int_t ml = p->GetMother(0); if (ml != -1) { track->SetTitle(Form("%s\nMother label=%d\nMother Pdg=%d", track->GetElementTitle(), ml, stack->Particle(ml)->GetPdgCode())); } set_track_color(track, pdg_col); gEve->AddElement(track, cont); if (recurse) kine_daughters(track, stack, min_pt, min_p, pdg_col, recurse); } } // set path marks IlcEveKineTools kt; kt.SetDaughterPathMarks(cont, stack, recurse); if (use_track_refs && rl->LoadTrackRefs() == 0) { kt.SetTrackReferences(cont, rl->TreeTR(), recurse); trkProp->SetEditPathMarks(kTRUE); } kt.SortPathMarks(cont, recurse); //PH const Text_t* tooltip = Form("min pT=%.2lf, min P=%.2lf), N=%d", min_pt, min_p, count); char tooltip[1000]; sprintf(tooltip,"min pT=%.2lf, min P=%.2lf), N=%d", min_pt, min_p, count); cont->SetTitle(tooltip); // Not broadcasted automatically ... cont->MakeTracks(recurse); gEve->EnableRedraw(); gEve->Redraw3D(); return cont; }
TEveElement* kine_track(Int_t label, Bool_t import_mother, Bool_t import_daughters, Bool_t pdg_col, Bool_t recurse, TEveElement* cont) { // Create mother and daughters tracks with given label. // mother -> particle with label // daughters -> daughters of label if (label < 0) { Warning("kine_track", "label not set."); return 0; } IlcRunLoader* rl = IlcEveEventManager::AssertRunLoader(); rl->LoadKinematics(); IlcStack* stack = rl->Stack(); if (!stack) { Warning("kine_track", "can not get kinematics."); return 0; } if (label >= stack->GetNtrack()) { Warning("kine_track", "label out of range."); return 0; } TParticle* p = stack->Particle(label); if (import_mother || (import_daughters && p->GetNDaughters())) { TEveTrackPropagator* rs = 0; if (cont == 0) { TEveTrackList* tlist = new TEveTrackList (Form("Kinematics of %d %d", label, p->GetNDaughters())); cont = tlist; TEveTrackPropagator* trkProp = tlist->GetPropagator(); kine_track_propagator_setup(trkProp); char tooltip[1000]; sprintf(tooltip,"Ndaughters=%d", p->GetNDaughters()); tlist->SetTitle(tooltip); trkProp->SetMaxOrbs(2); trkProp->SetEditPathMarks(kTRUE); gEve->AddElement(cont); rs = tlist->GetPropagator(); } else { // check if container is TEveTrackList or IlcEveTrack (has rnr-style) IlcEveTrack* t = dynamic_cast<IlcEveTrack*>(cont); if (t) { rs = t->GetPropagator(); } else { TEveTrackList* l = dynamic_cast<TEveTrackList*>(cont); if (l) rs = l->GetPropagator(); else Error("kine_tracks.C", "TrackRenderStyle not set."); } } if (import_mother) { IlcEveTrack* track = new IlcEveTrack(p, label, rs); char form[1000]; sprintf(form,"%s [%d]", p->GetName(), label); track->SetName(form); track->SetStdTitle(); set_track_color(track, pdg_col); track->MakeTrack(); gEve->AddElement(track, cont); cont = track; } if (import_daughters && p->GetNDaughters()) { for (int d=p->GetFirstDaughter(); d>0 && d<=p->GetLastDaughter(); ++d) { TParticle* dp = stack->Particle(d); IlcEveTrack* track = new IlcEveTrack(dp, d, rs); char form[1000]; sprintf(form,"%s [%d]", dp->GetName(), d); track->SetName(form); track->SetStdTitle(); set_track_color(track, pdg_col); track->MakeTrack(); gEve->AddElement(track, cont); if (recurse) kine_daughters(track, stack, 0, 0, pdg_col, recurse); } } } gEve->Redraw3D(); return cont; }