void propagate(TLorentzVector &l, TVector3 &p, float charge, TH2F* hpro=0) { double x0=p.X()/100; double y0=p.Y()/100; double z0=p.Z()/100; double px0=l.Px(); double py0=l.Py(); double pz0=l.Pz(); double B=2; double pt=sqrt(px0*px0+py0*py0); double lambda=pz0/pt; double s_t=z0/lambda; double a=-0.2998*B*charge/3; double rho=a/pt; //cout <Fill(xt,yt); } } //cout <<"lam="<LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); basiclibs(); // **** the library is needed in order to use the TCandidate and TCandList etc gSystem->Load("libRho"); TCanvas *c1=new TCanvas("c1","c1",800,800); c1->Divide(2,2); // **** access the datastructure holding the particle lists // TFile* f = new TFile(fname.Data()); TTree *t=f->Get("cbmsim") ; // **** for every event, a TCLonesArray with the candidates is stored in cbmsim // TClonesArray *fChrgCands=new TClonesArray("TCandidate"); //TClonesArray *fNeutCands=new TClonesArray("TCandidate"); //TClonesArray *fMcCands=new TClonesArray("TCandidate"); t->SetBranchAddress("PndChargedCandidates",&fChrgCands); //t->SetBranchAddress("PndNeutralCandidates",&fNeutCands); //t->SetBranchAddress("PndMcTracks",&fMcCands); TCandidate *tc; // **** create and setup some histos for QA plots // TH1F *ppimass = new TH1F("ppimass","p pi cands",100,1.05,1.2); TH1F *ppi2mass = new TH1F("ppi2mass","p pi cands",100,1.05,1.2); ppi2mass->SetFillColor(2); ppi2mass->SetLineColor(2); ppi2mass->SetLineWidth(1); TH2F *hvtx=new TH2F("hvtx","vertex positions (x,y)",100,-10,10,100,-10,10); TH2F *hvtx2=new TH2F("hvtx2","vertex positions (x,z)",100,-10,10,100,-10,10); TH1F *hdist=new TH1F("hdist","vtx distance to (0,0,0)",100,0,15); ppimass->SetMinimum(0); if (num==0) num= t->GetEntriesFast(); cout <<"\n####### Processing "<SetCriterion("veryLoose"); TPidSimpleProtonSelector *pSel = new TPidSimpleProtonSelector(); pSel->SetCriterion("veryLoose"); int i1,i2; // **** loop over all _events_ // for (Int_t j=0; j< num;j++) { TFactory::Instance()->Reset(); chargedCands.Cleanup(); ppiCands.Cleanup(); t->GetEntry(j); if ((j%100)==0) { cout <<"evt "<cd(1); if (ppi2mass->GetMaximum()GetMaximum()) ppi2mass->SetMaximum(ppimass->GetMaximum()*1.05); ppi2mass->Draw(); ppimass->Draw("same"); c1->cd(2); hdist->Draw(); c1->cd(3); hvtx->Draw(""); c1->cd(4); hvtx2->Draw(""); c1->Update(); } // **** loop over all Candidates and add them to the list allCands // for (i1=0; i1GetEntriesFast(); i1++){ tc = (TCandidate *)fChrgCands->At(i1); //TMatrixD cov=tc->Cov7(); //cov.Print(); TLorentzVector l=tc->P4(); TVector3 p=tc->Pos(); propagate(l,p,tc->GetCharge()); tc->SetP4(l); tc->SetPos(p); //TMatrixD cov=tc->Cov7(); //cov.Print(); chargedCands.Add(*tc); //TMatrixD cov2=chargedCands[chargedCands.GetLength()-1].Cov7(); //cov2.Print(); } plusCands.Select(chargedCands, plusSel); minusCands.Select(chargedCands, minusSel); pplusCands.Select(plusCands,pSel); pminusCands.Select(minusCands,pSel); piplusCands.Select(plusCands,piSel); piminusCands.Select(minusCands,piSel); cout <Fill(tc->Mass()); PndVtxFitter vtxf(*tc); vtxf.Fit(); TCandidate *fitted=vtxf.FittedCand(*tc); cout <<"unfitted="<<(*tc)<Pos().Mag(); //if (d==0) continue; cout <<"fitted = "<<(*fitted)<Fill(fitted->Mass()); hvtx->Fill(fitted->Pos().X(),fitted->Pos().Y()); hvtx2->Fill(fitted->Pos().X(),fitted->Pos().Z()); hdist->Fill(fitted->Pos().Mag()); } } /* int ii,jj; int npi=piminusCands.GetLength(); int np=pplusCands.GetLength(); for (ii=0;iiFill(compo->Mass()); PndVtxFitter vtxf(*compo); vtxf.Fit(); TCandidate *fitted=vtxf.FittedCand(*compo); cout <<"unfitted="<<(*compo)<Pos().Mag(); if (d==0) continue; cout <<"fitted = "<<(*fitted)<Fill(fitted->Mass()); hvtx->Fill(fitted->Pos().X(),fitted->Pos().Y()); hvtx2->Fill(fitted->Pos().X(),fitted->Pos().Z()); hdist->Fill(fitted->Pos().Mag()); } // cout <<"Proton:" <cd(1); if (ppi2mass->GetMaximum()GetMaximum()) ppi2mass->SetMaximum(ppimass->GetMaximum()*1.05); ppi2mass->Draw(); ppimass->Draw("same"); c1->cd(2); hdist->Draw(); c1->cd(3); hvtx->Draw(""); c1->cd(4); hvtx2->Draw(""); c1->Update(); timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime); return 0; } /*void printTree(TCandidate *tc, int level=0) { int i=0; int nd=tc->NDaughters(); if (nd==0) return; cout <Uid()<<"("< "; for (i=0;iDaughter(i)->Uid()<<" "; cout <Daughter(i),level+1); if (level==0) cout <