1 void propagate(TLorentzVector &l, TVector3 &
p,
float charge, TH2F* hpro=0)
13 double pt=
sqrt(px0*px0+py0*py0);
16 double a=-0.2998*B*charge/3;
25 for (
int i=0;
i<steps;
i++)
28 double s_tt=(
i+1)*dz/lambda;
29 double cosrst=
cos(rho*s_tt);
30 double sinrst=
sin(rho*s_tt);
32 double px = px0*cosrst + py0*sinrst;
33 double py = py0*cosrst - px0*sinrst;
36 double xt=x0 - px/a*sinrst + py/a*(1-cosrst);
37 double yt=y0 - py/a*sinrst - px/a*(1-cosrst);
46 double cosrs=
cos(rho*s_t);
47 double sinrs=
sin(rho*s_t);
49 double px = px0*cosrs + py0*sinrs;
50 double py = py0*cosrs - px0*sinrs;
53 double x=x0 - px/a*sinrs + py/a*(1-cosrs);
54 double y=y0 - py/a*sinrs - px/a*(1-cosrs);
55 double z=z0 - lambda*s_t;
71 gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/basiclibs.C");
75 gSystem->Load(
"libRho");
77 TCanvas *
c1=
new TCanvas(
"c1",
"c1",800,800);
82 TFile*
f =
new TFile(fname.Data());
83 TTree *
t=f->Get(
"pndsim") ;
87 TClonesArray *fChrgCands=
new TClonesArray(
"TCandidate");
91 t->SetBranchAddress(
"PndChargedCandidates",&fChrgCands);
99 TH1F *ppimass =
new TH1F(
"ppimass",
"p pi cands",100,1.05,1.2);
100 TH1F *ppi2mass =
new TH1F(
"ppi2mass",
"p pi cands",100,1.05,1.2);
101 ppi2mass->SetFillColor(2);
102 ppi2mass->SetLineColor(2);
103 ppi2mass->SetLineWidth(1);
105 TH2F *hvtx=
new TH2F(
"hvtx",
"vertex positions (x,y)",100,-10,10,100,-10,10);
106 TH2F *hvtx2=
new TH2F(
"hvtx2",
"vertex positions (x,z)",100,-10,10,100,-10,10);
108 TH1F *hdist=
new TH1F(
"hdist",
"vtx distance to (0,0,0)",100,0,15);
110 ppimass->SetMinimum(0);
112 if (
num==0)
num= t->GetEntriesFast();
113 cout <<
"\n####### Processing "<<
num <<
" events...\n"<<endl;
119 TCandList allCands,chargedCands, minusCands, plusCands, pplusCands, pminusCands, piplusCands, piminusCands;
125 TPidChargedSelector *chargedSel =
new TPidChargedSelector;
126 TPidNeutralSelector *neutralSel =
new TPidNeutralSelector;
128 TPidPlusSelector *plusSel =
new TPidPlusSelector;
129 TPidMinusSelector *minusSel =
new TPidMinusSelector;
133 TPidSimplePionSelector *piSel =
new TPidSimplePionSelector();
134 piSel->SetCriterion(
"veryLoose");
135 TPidSimpleProtonSelector *pSel =
new TPidSimpleProtonSelector();
136 pSel->SetCriterion(
"veryLoose");
142 for (Int_t j=0; j<
num;j++)
145 TFactory::Instance()->Reset();
147 chargedCands.Cleanup();
152 cout <<
"evt "<<j<<endl;
154 if (ppi2mass->GetMaximum()<ppimass->GetMaximum()) ppi2mass->SetMaximum(ppimass->GetMaximum()*1.05);
157 ppimass->Draw(
"same");
171 for (i1=0; i1<fChrgCands->GetEntriesFast(); i1++){
172 tc = (TCandidate *)fChrgCands->At(i1);
177 TLorentzVector l=tc->P4();
178 TVector3
p=tc->Pos();
187 chargedCands.Add(*tc);
194 plusCands.Select(chargedCands, plusSel);
195 minusCands.Select(chargedCands, minusSel);
197 pplusCands.Select(plusCands,pSel);
198 pminusCands.Select(minusCands,pSel);
200 piplusCands.Select(plusCands,piSel);
201 piminusCands.Select(minusCands,piSel);
202 cout <<endl<<
"---------------------"<<endl;
203 cout <<
"chrg:"<<chargedCands.GetLength()<<
" ";
204 cout <<
"plus:"<<plusCands.GetLength()<<
" ";
205 cout <<
"minus:"<<minusCands.GetLength()<<
" ";
206 cout <<
"p+:"<<pplusCands.GetLength()<<
" ";
207 cout <<
"p-:"<<pminusCands.GetLength()<<
" ";
208 cout <<
"pi+:"<<piplusCands.GetLength()<<
" ";
209 cout <<
"pi-:"<<piminusCands.GetLength()<<endl;
225 int npi=piminusCands.GetLength();
226 int np=pplusCands.GetLength();
229 for (ii=0;ii<
npi;ii++)
231 for (jj=0;jj<np;jj++)
233 TCandidate pim=piminusCands[ii];
234 TCandidate pp=pplusCands[
jj];
236 if( pp.Overlaps(pim))
continue;
241 TCandidate *compo=pim.Combine(pp);
242 ppimass->Fill(compo->Mass());
243 PndVtxFitter vtxf(*compo);
245 TCandidate *fitted=vtxf.FittedCand(*compo);
246 cout <<
"unfitted="<<(*compo)<<endl;
249 double d=fitted->Pos().Mag();
251 cout <<
"fitted = "<<(*fitted)<<endl;
252 ppi2mass->Fill(fitted->Mass());
253 hvtx->Fill(fitted->Pos().X(),fitted->Pos().Y());
254 hvtx2->Fill(fitted->Pos().X(),fitted->Pos().Z());
255 hdist->Fill(fitted->Pos().Mag());
271 if (ppi2mass->GetMaximum()<ppimass->GetMaximum()) ppi2mass->SetMaximum(ppimass->GetMaximum()*1.05);
274 ppimass->Draw(
"same");
288 printf(
"RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
friend F32vec4 cos(const F32vec4 &a)
void propagate(TLorentzVector &l, TVector3 &p, float charge, TH2F *hpro=0)
Double_t lambda(Double_t x, Double_t y, Double_t z)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
TString pt(TString pts, TString exts="px py pz")
int ana_Lambda_fit(TString fname="tmp.root", int num=0)