00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 struct HIT
00012 {
00013 Float_t x,y,z;
00014 Float_t rad,phi;
00015 Float_t raderror,phierror;
00016 };
00017
00018 struct CLUSTER
00019 {
00020 Float_t timepos,padpos,timesigma,padsigma;
00021 Float_t peakheight, charge;
00022 Int_t timebin,pad;
00023 Int_t padlength,timelength;
00024 Int_t row,sec;
00025 Int_t flag;
00026 Int_t numpeaks;
00027 };
00028
00029 struct EVENT
00030 {
00031 Float_t run;
00032 Int_t nevent;
00033 };
00034
00035
00036 void hits2cluster_all(TString eingabe,int evt)
00037 {
00038
00039 CLUSTER cluster;
00040 HIT hit;
00041 EVENT event;
00042
00043
00044 gROOT->Reset();
00045 gStyle->SetTitleOffset(1.25);
00046 gStyle->SetCanvasBorderMode(0);
00047 gStyle->SetPadBorderMode(0);
00048 gStyle->SetPadColor(0);
00049 gStyle->SetCanvasColor(0);
00050 gStyle->SetTitleColor(0);
00051 gStyle->SetStatColor(0);
00052 gStyle->SetPalette(1);
00053 gStyle->SetOptStat(11);
00054 gStyle->SetOptFit();
00055
00056 Float_t fpad,ftime,fflag,frow, fsec;
00057 Int_t maxentries;
00058
00059 TString histoname;
00060
00061 TCanvas *c1 = new TCanvas("c1","ps",200,10,700,500);
00062 c1->Divide(2,1);
00063
00064 cout<<"Macro cluster_hits..."<<endl;
00065 TFile *f = new TFile(eingabe+".root");
00066 eingabe +="_evt_";
00067 eingabe +=evt;
00068
00069 eingabe +="-h2cl.ps";
00070 TPostScript *fps=new TPostScript(eingabe,112);
00071
00072
00073
00074 dtree=(TTree*) f->Get("cl");
00075 bhit=dtree->GetBranch("hit");
00076 bhit->SetAddress(&hit);
00077 bcluster=dtree->GetBranch("cluster");
00078 bcluster->SetAddress(&cluster);
00079 bevent=dtree->GetBranch("event");
00080 bevent->SetAddress(&event);
00081
00082 topdir=(TDirectory*) f->Get("histograms");
00083
00084 TString dirname="evt_";
00085 dirname +=evt;
00086 dirname +="_gain";
00087
00088
00089
00090 histdir=(TDirectory*) topdir->Get(dirname);
00091
00092
00093
00094
00095 int maxentries = (int)bcluster->GetEntries();
00096
00097 TIter nextkey(histdir->GetListOfKeys());
00098 TKey *key;
00099 int i=1;
00100
00101 char *oldname;
00102
00103 while (key = (TKey*) nextkey())
00104 {
00105 if (key->GetName()!=oldname)
00106 {
00107 oldname=key->GetName();
00108 if (i==1) fps->NewPage();
00109 c1->cd(i);
00110 TH2F *hist=(TH2F*) histdir->Get(key->GetName());
00111 hist->DrawCopy("colz");
00112
00113 TH2F *flag0=new TH2F("flag0","flag0",160,0,160,255,0,255);
00114 flag0->SetMarkerStyle(20);flag0->SetMarkerSize(0.5);flag0->SetMarkerColor(1);
00115 TH2F *flag1=new TH2F("flag1","flag1",160,0,160,255,0,255);
00116 flag1->SetMarkerStyle(29);flag1->SetMarkerSize(0.5);flag1->SetMarkerColor(7);
00117 TH2F *flag2=new TH2F("flag2","flag2",160,0,160,255,0,255);
00118 flag2->SetMarkerStyle(21);flag2->SetMarkerSize(0.5);flag2->SetMarkerColor(3);
00119 TH2F *flag3=new TH2F("flag3","flag3",160,0,160,255,0,255);
00120 flag3->SetMarkerStyle(23);flag3->SetMarkerSize(0.5);flag3->SetMarkerColor(5);
00121 TH2F *flag4=new TH2F("flag4","flag4",160,0,160,255,0,255);
00122 flag4->SetMarkerStyle(29);flag4->SetMarkerSize(0.5);flag4->SetMarkerColor(3);
00123 TH2F *flag5=new TH2F("flag5","flag5",160,0,160,255,0,255);
00124 flag5->SetMarkerStyle(22);flag5->SetMarkerSize(0.5);flag5->SetMarkerColor(6);
00125 TH2F *flag10=new TH2F("flag10","flag10",160,0,160,255,0,255);
00126 flag10->SetMarkerStyle(20);flag10->SetMarkerSize(0.5);flag10->SetMarkerColor(2);
00127 TH2F *flag11=new TH2F("flag11","flag11",160,0,160,255,0,255);
00128 flag11->SetMarkerStyle(29);flag11->SetMarkerSize(0.5);flag11->SetMarkerColor(7);
00129 TH2F *flag12=new TH2F("flag12","flag12",160,0,160,255,0,255);
00130 flag12->SetMarkerStyle(29);flag12->SetMarkerSize(0.5);flag12->SetMarkerColor(3);
00131 TH2F *flag13=new TH2F("flag13","flag13",160,0,160,255,0,255);
00132 flag13->SetMarkerStyle(23);flag13->SetMarkerSize(0.5);flag13->SetMarkerColor(5);
00133 TH2F *flag14=new TH2F("flag14","flag14",160,0,160,255,0,255);
00134 flag14->SetMarkerStyle(29);flag14->SetMarkerSize(0.5);flag14->SetMarkerColor(3);
00135 TH2F *flag15=new TH2F("flag15","flag15",160,0,160,255,0,255);
00136 flag15->SetMarkerStyle(22);flag15->SetMarkerSize(0.5);flag15->SetMarkerColor(6);
00137 TH2F *flag16=new TH2F("flag16","flag16",160,0,160,255,0,255);
00138 flag16->SetMarkerStyle(28);flag16->SetMarkerSize(0.5);flag16->SetMarkerColor(8);
00139
00140
00141
00142 char *name;
00143 name=key->GetName();
00144
00145 for (int k=0;k<=maxentries;k++)
00146 {
00147 bevent->GetEntry(k);
00148 bcluster->GetEntry(k);
00149
00150 if (event.nevent==evt)
00151 {
00152
00153
00154 if (cluster.sec==atoi(strchr(name, 'c')+1) && cluster.row==atoi(strchr(name, 'w')+1))
00155 {
00156
00157
00158
00159
00160 if (cluster.flag==0) {flag0->Fill(cluster.padpos,cluster.timepos);}
00161
00162 if (cluster.flag==1) {flag1->Fill(cluster.padpos,cluster.timepos);}
00163
00164 if (cluster.flag==2) {flag2->Fill(cluster.padpos,cluster.timepos);}
00165
00166 if (cluster.flag==3) {flag3->Fill(cluster.padpos,cluster.timepos);}
00167
00168 if (cluster.flag==4) {flag4->Fill(cluster.padpos,cluster.timepos);}
00169
00170 if (cluster.flag==5) {flag5->Fill(cluster.padpos,cluster.timepos);}
00171
00172 if (cluster.flag==10) {flag10->Fill(cluster.padpos,cluster.timepos);}
00173
00174 if (cluster.flag==11) {flag11->Fill(cluster.padpos,cluster.timepos);}
00175
00176 if (cluster.flag==12) {flag12->Fill(cluster.padpos,cluster.timepos);}
00177
00178 if (cluster.flag==13) {flag13->Fill(cluster.padpos,cluster.timepos);}
00179
00180 if (cluster.flag==14) {flag14->Fill(cluster.padpos,cluster.timepos);}
00181
00182 if (cluster.flag==15) {flag15->Fill(cluster.padpos,cluster.timepos);}
00183
00184 if (cluster.flag>=16) {flag16->Fill(cluster.padpos,cluster.timepos);}
00185
00186
00187 }
00188 }
00189 }
00190
00191 flag0->DrawCopy("same");
00192 flag1->DrawCopy("same");
00193 flag2->DrawCopy("same");
00194 flag3->DrawCopy("same");
00195 flag4->DrawCopy("same");
00196 flag5->DrawCopy("same");
00197
00198 flag10->DrawCopy("same");
00199 flag11->DrawCopy("same");
00200 flag12->DrawCopy("same");
00201 flag13->DrawCopy("same");
00202 flag14->DrawCopy("same");
00203 flag15->DrawCopy("same");
00204 flag16->DrawCopy("same");
00205 TLegend *leg = new TLegend(0.46,0.72,0.80,0.86);
00206 leg->SetFillColor(10);
00207 leg->SetTextSize(0.03);
00208 leg->AddEntry(flag0,"flag=0","P");
00209 leg->AddEntry(flag10,"flag=10","P");
00210 leg->AddEntry(flag11,"flag=1 & flag=11","P");
00211 leg->AddEntry(flag2,"flag=2 & flag=12","P");
00212 leg->AddEntry(flag3,"flag=3 & flag=13","P");
00213 leg->AddEntry(flag4,"flag=4 & flag=14","P");
00214 leg->AddEntry(flag15,"flag=5 & flag=15","P");
00215 leg->AddEntry(flag16,"flag=6 & flag=16","P");
00216
00217
00218
00219
00220 leg->Draw();
00221 c1->Update();
00222 flag0->Delete();
00223 flag1->Delete();
00224 flag2->Delete();
00225 flag3->Delete();
00226 flag4->Delete();
00227 flag5->Delete();
00228
00229 flag10->Delete();
00230 flag11->Delete();
00231 flag12->Delete();
00232 flag13->Delete();
00233 flag14->Delete();
00234 flag15->Delete();
00235 flag16->Delete();
00236
00237 c1->Update();
00238 i++;
00239 if (i>2) i=1;
00240 }
00241 }
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 cout<<"Ps-file created !"<<endl;
00263 fps->Close();
00264
00265
00266 f->Close();
00267
00268 c1->Delete();
00269 }
00270