17 Float_t raderror,phierror;
22 Float_t timepos,padpos,timesigma,padsigma;
23 Float_t peakheight, charge;
25 Int_t padlength,timelength;
46 Int_t row,sec, padlength, timelength;
47 Float_t peakheight, charge;
49 Float_t padpos, timepos;
50 Float_t padpossigma, timepossigma;
57 Float_t globResX,globResY,globResPhi,globResR;
58 Float_t primResX,primResY,primResPhi,primResR;
93 void vertex(TString eingabe,
int evt)
96 TBranch *bhit, *bevent, *bcluster;
97 TBranch *bthit, *btcluster, *btevent;
98 TBranch *btrevent, *btrack,*btrvertex;
99 TDirectory *histdir, *vertexdir;
105 TStyle *plain =
new TStyle(
"Plain",
"Plain Style (no colors/fill areas)");
106 plain->SetTitleOffset(1.25);
107 plain->SetCanvasBorderMode(0);
108 plain->SetPadBorderMode(0);
109 plain->SetPadColor(10);
110 plain->SetCanvasColor(10);
111 plain->SetTitleColor(0);
112 plain->SetStatColor(0);
113 plain->SetPalette(1);
114 plain->SetOptStat(11);
119 cout<<
"Vertex Analysis started..."<<endl;
122 TFile *f=
new TFile(eingabe+
".root");
125 TPostScript *fps=
new TPostScript(eingabe+
".ps",112);
139 dtrtree=(TTree*) f->Get(
"tr");
140 btrevent=dtrtree->GetBranch(
"event");
141 btrevent->SetAddress(&trevent);
142 btrack=dtrtree->GetBranch(
"track");
143 btrack->SetAddress(&track);
144 btrvertex=dtrtree->GetBranch(
"vertex");
145 btrvertex->SetAddress(&mvertex);
147 dttree=(TTree*) f->Get(
"clot");
148 btcluster=dttree->GetBranch(
"cluster");
149 btcluster->SetAddress(&tcluster);
150 bthit=dttree->GetBranch(
"hit");
151 bthit->SetAddress(&thit);
152 btevent=dttree->GetBranch(
"event");
153 btevent->SetAddress(&tevent);
155 TCanvas *c1 =
new TCanvas(
"vertex",
"vertex",100,10,800,600);
156 TH2F *hr =
new TH2F(
"hr",
"",100,-275,275,100,0,30);
157 hr->SetTitle(
"Vertex Extrapolation (linear)");
158 hr->GetYaxis()->SetTitleOffset(1.1);
159 hr->GetYaxis()->SetTitle(
"rad");
160 hr->GetXaxis()->SetTitle(
"z");
163 TH1F *hvertex=
new TH1F(
"hvertex",
"z-position of used vertex",201,-100,100);
164 TH1F *vertexeast=
new TH1F(
"vertexeast",
"z-position of extrapolated vertex east",101,-50,50);
165 TH1F *vertexwest=
new TH1F(
"vertexwest",
"z-position of extrapolated vertex west",101,-50,50);
166 TH1F *vertexall=
new TH1F(
"vertexall",
"z-position of extrapolated vertex",101,-50,50);
168 Int_t maxentries1 = (Int_t)btcluster->GetEntries();
169 cout<<
"Process Cluster-on-Track-Tree with "<<maxentries1<<
" clusters..."<<endl;
172 cout<<
"Investigate Event "<<evt<<
"..."<<endl;
173 Float_t mean_vertex=0;
174 Float_t mean_vertex_west=0;
175 Float_t mean_vertex_east=0;
177 Float_t radius[11],z[11];
179 Bool_t EndOfEvent=kFALSE;
186 TF1 *linfit=
new TF1(
"linfit",
"[0]*x+[1]",-275,275);
187 linfit->SetParameters(1,10);
188 linfit->SetLineWidth(0.5);
190 for (
int k=0;k<=maxentries1;k++)
192 btcluster->GetEntry(k);
194 btevent->GetEntry(k);
196 if (EndOfEvent)
break;
197 if (tevent.nevent > evt)
203 if (tevent.nevent==evt)
205 if (tcluster.ntracks != ntracksold)
208 TGraph *ver=
new TGraph(i,z,radius);
209 ver->SetMarkerStyle(22);
210 ver->SetMarkerSize(0.75);
216 ver->SetMarkerColor(2);
217 linfit->SetLineColor(2);
222 ver->SetMarkerColor(3);
223 linfit->SetLineColor(3);
226 ver->Fit(linfit,
"QR+");
228 cout<<
"Event "<<tevent.nevent<<
" Track "<<ntrack<<
" Vertex = "<<-linfit->GetParameter(1)/linfit->GetParameter(0)<<endl;
230 mean_vertex=(mean_vertex+(-linfit->GetParameter(1)/linfit->GetParameter(0)));
231 vertexall->Fill(-linfit->GetParameter(1)/linfit->GetParameter(0));
234 mean_vertex_east=mean_vertex_east+-linfit->GetParameter(1)/linfit->GetParameter(0);
235 vertexeast->Fill(-linfit->GetParameter(1)/linfit->GetParameter(0));
239 mean_vertex_west=mean_vertex_west+-linfit->GetParameter(1)/linfit->GetParameter(0);
240 vertexwest->Fill(-linfit->GetParameter(1)/linfit->GetParameter(0));
245 radius[i]=sqrt(thit.x*thit.x+thit.y*thit.y);
247 cout<<
"DEBUG: ntrack = "<<tcluster.ntracks<<
" cluster "<<i<<
" x,y,z = "<<thit.x<<
" "<<thit.y<<
" "<<thit.z<<
" radius = "<<radius[i]<<endl;
250 ntracksold=tcluster.ntracks;
253 cout<<
"---------------------------"<<endl;
254 cout<<
"Mean_vertex = "<<mean_vertex/ntrack<<endl;
255 cout<<
"Mean_vertex_east = "<<mean_vertex_east/ntrackeast<<endl;
256 cout<<
"Mean_vertex_west = "<<mean_vertex_west/ntrackwest<<endl;
257 cout<<
"---------------------------"<<endl;
259 TCanvas *c2 =
new TCanvas(
"vertex2",
"vertex2",150,60,850,650);
261 vertexall->DrawCopy();
262 vertexwest->SetLineColor(3);vertexwest->DrawCopy(
"same");
263 vertexeast->SetLineColor(2);vertexeast->DrawCopy(
"same");
264 TLegend *leg =
new TLegend(0.7,0.6,0.95,0.8);
265 leg->SetFillColor(10);
266 leg->SetTextSize(0.03);
267 leg->AddEntry(vertexall,
"vertex East&West",
"L");
268 leg->AddEntry(vertexeast,
"vertex East",
"L");
269 leg->AddEntry(vertexwest,
"vertex West",
"L");
272 Int_t maxentries2 = (Int_t)btrack->GetEntries();
274 cout<<
"Process Track-Tree with "<<maxentries2<<
" Tracks..."<<endl;
277 for (
int k=0;k<=maxentries2;k++)
281 btrvertex->GetEntry(k);
282 btrevent->GetEntry(k);
283 if (trevent.nevent!=oldevent)
285 hvertex->Fill(mvertex.z);
286 if (trevent.nevent==evt)
288 cout<<
"---------------------------"<<endl;
289 cout<<
"Used Vertex (Event "<<evt<<
") x = "<<mvertex.x<<
" y = "<<mvertex.y<<
" z = "<<mvertex.z<<endl;
290 cout<<
"---------------------------"<<endl;
293 oldevent=trevent.nevent;
298 cout<<
"Histograms in ROOT-file : "<<eingabe+
".root"<<endl;