StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
print_TCluster.C
1 // $Id: print_TCluster.C,v 1.1 2010/01/14 18:25:16 jcs Exp $
2 //
3 // $Log: print_TCluster.C,v $
4 // Revision 1.1 2010/01/14 18:25:16 jcs
5 // macro to print out the clusters on tracks in the FTPC root file
6 //
7 //
8 
9 // Print contents of struct TCluster - cluster on track information
10 
11 struct HIT
12 {
13  Float_t x,y,z;
14  Float_t rad,phi;
15  Float_t raderror,phierror;
16 };
17 
18 struct CLUSTER
19 {
20  Float_t timepos,padpos,timesigma,padsigma;
21  Float_t peakheight, charge;
22  Int_t timebin,pad;
23  Int_t padlength,timelength;
24  Int_t row,sec;
25  Int_t flag;
26  Int_t numpeaks;
27 };
28 
29 struct EVENT
30 {
31  Float_t run;
32  Int_t nevent;
33 };
34 
35 struct TEVENT
36 {
37  Float_t run;
38  Int_t nevent;
39 };
40 
41 
42 struct TCLUSTER
43 {
44  Int_t row,sec, padlength, timelength;
45  Float_t peakheight, charge;
46  Int_t ntracks;
47  Float_t padpos, timepos;
48  Float_t padpossigma, timepossigma;
49 };
50 
51 struct THIT
52 {
53  Float_t x,y,z;
54  Float_t ex,ey,ez;
55  Float_t globResX,globResY,globResPhi,globResR;
56  Float_t primResX,primResY,primResPhi,primResR;
57 };
58 
59 struct TREVENT
60 {
61  Float_t run;
62  Int_t nevent;
63 };
64 
65 struct TRACK
66 {
67  Float_t px,py,pz;
68  Float_t eta,p,pt;
69  Int_t npoints;
70  Int_t charge;
71  Int_t type;
72  Int_t sec;
73 };
74 
75 struct MVERTEX
76 {
77  Float_t x,y,z;
78 };
79 
80 CLUSTER cluster;
81 HIT hit;
82 TCLUSTER tcluster;
83 THIT thit;
84 TRACK track;
85 EVENT event;
86 TEVENT tevent;
87 TREVENT trevent;
88 MVERTEX mvertex;
89 
90 
91 void print_TCluster(TString eingabe)
92 {
93 
94  TBranch *bhit, *bevent, *bcluster;
95  TBranch *bthit, *btcluster, *btevent;
96  TBranch *btrevent, *btrack,*btrvertex;
97  TDirectory *histdir, *vertexdir;
98 
99  TTree *dtree;
100  TTree *dttree;
101  TTree *dtrtree;
102 
103 
104  cout<<"Clusters on Tracks Analysis started..."<<endl;
105  cout<<endl;
106 
107  TFile *f=new TFile(eingabe+".root");
108 
109 
110  // get trees in file !!!
111 
112  /*
113  dtree=(TTree*) f->Get("cl");
114  bhit=dtree->GetBranch("hit");
115  bhit->SetAddress(&hit);
116  bcluster=dtree->GetBranch("cluster");
117  bcluster->SetAddress(&cluster);
118  bevent=dtree->GetBranch("event");
119  bevent->SetAddress(&event);
120  */
121 
122  dtrtree=(TTree*) f->Get("tr");
123  btrevent=dtrtree->GetBranch("event");
124  btrevent->SetAddress(&trevent);
125  btrack=dtrtree->GetBranch("track");
126  btrack->SetAddress(&track);
127  btrvertex=dtrtree->GetBranch("vertex");
128  btrvertex->SetAddress(&mvertex);
129 
130  dttree=(TTree*) f->Get("clot");
131  btcluster=dttree->GetBranch("cluster");
132  btcluster->SetAddress(&tcluster);
133  bthit=dttree->GetBranch("hit");
134  bthit->SetAddress(&thit);
135  btevent=dttree->GetBranch("event");
136  btevent->SetAddress(&tevent);
137 
138  Int_t maxentries1 = (Int_t)btcluster->GetEntries();
139  cout<<"Process Cluster-on-Track-Tree with "<<maxentries1<<" clusters..."<<endl;
140 
141  cout<<endl;
142 
143  Int_t i=0;
144  Int_t ntracksold=0;
145  Int_t ntrack=0;
146  Int_t nevent=0;
147 
148  for (int k=0;k<=maxentries1;k++)
149  {
150  btcluster->GetEntry(k);
151  bthit->GetEntry(k);
152  btevent->GetEntry(k);
153  if (nevent==0){
154  nevent = tevent.nevent;
155  cout<<endl;
156  cout<<"Event "<<nevent<<endl;
157  }
158 
159  if (tevent.nevent != nevent)
160  {
161  if (i==0) break;
162  nevent = tevent.nevent;
163  cout<<endl;
164  cout<<"Event "<<nevent<<endl;
165  }
166  if (tevent.nevent==nevent)
167  {
168  if (tcluster.ntracks != ntracksold)
169  {
170  cout<<endl;
171  ntrack++;
172  i=0;
173  }
174  cout<<"ntrack = "<<tcluster.ntracks<<" cluster "<<i<<" padpos "<<tcluster.padpos<<" timepos "<<tcluster.timepos<<" x,y,z = "<<thit.x<<" "<<thit.y<<" "<<thit.z<<endl;
175 // cout<<"ntrack = "<<tcluster.ntracks<<" padpos "<<tcluster.padpos<<" timepos "<<tcluster.timepos<<endl;
176  i++;
177 
178  ntracksold=tcluster.ntracks;
179  }
180  }
181 
182 }
183