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)
void propagate(TLorentzVector &l, TVector3 &p, float charge, TH2F *hpro=0)