9{
10 char NewRootFile[255],
11 TextFile[255],
12 TextFileTop[255],
13 TextFileBot[255];
14
15
16
17 sprintf(NewRootFile,
"%s",
file);
18 sprintf(NewRootFile+strlen(
file)-5,
"%s\0",
"+seg.root");
19 cout<<strlen(NewRootFile)<<endl;
20
21
22
23 cout<<NewRootFile<<endl;
24 sprintf(TextFile,
"%s",
file);
25 sprintf(TextFile+strlen(
file)-5,
"%s\0",
".txt");
26
27 sprintf(TextFileTop,
"%s",
file);
28 sprintf(TextFileTop+strlen(
file)-5,
"%s\0",
"_top.txt");
29
30 sprintf(TextFileBot,
"%s",
file);
31 sprintf(TextFileBot+strlen(
file)-5,
"%s\0",
"_bot.txt");
32
33
34
35 cout<<TextFile<<endl;
36
37
42 FILE *
f=fopen(TextFile,
"w");
43 FILE *ftop=fopen(TextFileTop,"w");
44 FILE *fbot=fopen(TextFileBot,"w");
46 int npr = 0;
47 int nv;
48 if (pred_file) fpred = fopen(pred_file,"rt");
49 if (fpred) {
50 if (!fscanf(fpred,"%d",&npr)) npr = 0;
51 }
52 printf("npr=%d\n",npr);
54 if (npr) nv = npr*2*NumAcq;
55 else nv = nEntries;
56 if (nv>nEntries) nv = nEntries;
57 if ((NumOfViews>0)&&(NumOfViews+firstView<nv)) nv = NumOfViews+firstView;
60
62 fprintf(
f,
"view,sID,X,Y,Z,Tx,Ty,puls,side\n");
63 fprintf(ftop,"view,sID,X,Y,Z,Tx,Ty,puls,side\n");
64 fprintf(fbot,"view,sID,X,Y,Z,Tx,Ty,puls,side\n");
65 float Xpred[2], Ypred[2], tgXpr[2], tgYpr[2];
66 int cPred = -1;
67 int ner=0;
68 for (int j=firstView; j<nv; j++) {
71
72 float Sx=0.1486;
73 float Sy=0.1488;
74 int pulsthres = 10;
75 float accept = 1.;
76
77 float tgxmin = -0.050;
78 float tgxmax = 0.050;
79 float tgymin = -0.050;
80 float tgymax = 0.050;
81 float tgstep = 0.005;
82
83 float xmin = -15.;
84 float xmax = 15.;
85 float ymin = -15.;
86 float ymax = 15.;
87
88 float xpr, ypr, tgxpr, tgypr;
89 int idpr,pulspr;
90
91 if (fpred) for(;cPred<j/(2*NumAcq);cPred++) {
92 ner = 0;
93 char b[2];
94
95 fscanf(fpred,"%f %f %f %f %d %d",&xpr,&ypr,&tgxpr,&tgypr,&idpr,&pulspr);
96
97 for(int l=0;l<2;l++) {
98 if (fscanf(fpred,"%s %f %f %f %f %d %d", b,&xpr,&ypr,&tgxpr,&tgypr,&idpr,&pulspr)==7) {
99 cout<<b[0]<<" "<<xpr<<" "<<ypr<<endl;
100
101 if (toupper(b[0])=='T') {
102 Xpred[0] = xpr;
103 Ypred[0] = ypr;
104 tgXpr[0] = tgxpr;
105 tgYpr[0] = tgypr;
106 ner=1;
107 }
108 else if (toupper(b[0])=='B') {
109 Xpred[1] = xpr;
110 Ypred[1] = ypr;
111 tgXpr[1] = tgxpr;
112 tgYpr[1] = tgypr;
113 ner=1;
114 }
115 else printf("<<<<<<<<<< UNKNOWN PREDICTION FILE FORMAT! >>>>>>>>>>>>>>\n");
116 }
117 else
118 printf("<<<<<<<<<< UNKNOWN PREDICTION FILE FORMAT >>>>>>>>>>>>>>\n");
119 }
120 }
121 if (ner) {
122 float xv,yv;
124 a2v(Xpred[0],Ypred[0],mark,v,&xv,&yv);
125
126 tgxmin = tgXpr[0]-0.050;
127 tgxmax = tgXpr[0]+0.050;
128 tgymin = tgYpr[0]-0.050;
129 tgymax = tgYpr[0]+0.050;
130
131
132 xmin = xv-30.;
133 xmax = xv+30.;
134 ymin = yv-30.;
135 ymax = yv+30.;
136 }
137 else {
138 a2v(Xpred[1],Ypred[1],mark,v,&xv,&yv);
139
140 tgxmin = tgXpr[1]-0.050;
141 tgxmax = tgXpr[1]+0.050;
142 tgymin = tgYpr[1]-0.050;
143 tgymax = tgYpr[1]+0.050;
144
145
146 xmin = xv-30.;
147 xmax = xv+30.;
148 ymin = yv-30.;
149 ymax = yv+30.;
150 }
151 }
152 cout<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax<<" "<<tgxmin<<" "<<tgxmax<<" "<<tgymin<<" "<<tgymax<<endl<<endl;
153
155
158
159
160
161 EdbView* vnew =
tr->AdoptSegment(v,Sx,Sy,xmin,xmax,ymin,ymax,1.7*Sx,pulsthres,accept,1,1,1);
162
165
166 printf(
"View number=%d, nseg=%d, xView=%f, yView=%f \n",j,nseg,v->
GetXview(),v->
GetYview());
167 fprintf(
f,
"View number=%d, nseg=%d \n",j,nseg);
168 for (int i=0; i<nseg; i++) {
171 fprintf(
f,
"%d , %d , %f , %f , %f , %f , %f , %d , %d\n",j,
s->GetID(),
s->GetX0(),
s->GetY0(),
s->GetZ0(),
s->GetTx(),
s->GetTy(),
s->GetPuls(),
s->GetSide());
172 if (
even(j)) fprintf(ftop,
"%d , %d , %f , %f , %f , %f , %f , %d , %d\n",j,
s->GetID(),
s->GetX0(),
s->GetY0(),
s->GetZ0(),
s->GetTx(),
s->GetTy(),
s->GetPuls(),
s->GetSide());
173 else fprintf(fbot,
"%d , %d , %f , %f , %f , %f , %f , %d , %d\n",j,
s->GetID(),
s->GetX0(),
s->GetY0(),
s->GetZ0(),
s->GetTx(),
s->GetTy(),
s->GetPuls(),
s->GetSide());
174 int nclust =
s->GetNelements();
175 int nn=1;
176 for (int ic=0; ic<nclust; ic++) {
178
179 printf(
"<<<<<<<< %d: X=%f, Y=%f, Z=%f\n", ic+1, c->
GetX(), c->
GetY(), c->
GetZ());
180 fprintf(
f,
"<<<<<<<< %d: X=%f, Y=%f, Z=%f\n", ic+1, c->
GetX(), c->
GetY(), c->
GetZ());
181 nn++;
182
183 }
184 printf("\n");
186
187 }
188
189
190
191
195 }
201
202
203
204}
FILE * f
Definition: RecDispMC.C:150
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
Definition: EdbCluster.h:19
Float_t GetX() const
Definition: EdbCluster.h:51
Float_t GetY() const
Definition: EdbCluster.h:52
Float_t GetZ() const
Definition: EdbCluster.h:53
Definition: EdbFiducial.h:88
void Close()
Definition: EdbRun.cxx:439
int GetEntries() const
Definition: EdbRun.h:136
void Save()
Definition: EdbRun.cxx:424
EdbMarksSet * GetMarks() const
Definition: EdbRun.h:120
EdbView * GetEntry(int entry, int ih=1, int icl=0, int iseg=1, int itr=0, int ifr=0)
Definition: EdbRun.cxx:462
void AddView()
Definition: EdbRun.cxx:305
segment of the track
Definition: EdbSegment.h:63
Base scanning data object: entry into Run tree.
Definition: EdbView.h:134
Float_t GetXview() const
Definition: EdbView.h:193
EdbSegment * GetSegment(int i) const
Definition: EdbView.h:219
Int_t GetNframesTop() const
Definition: EdbView.h:207
Int_t Nsegments() const
Definition: EdbView.h:216
Float_t GetYview() const
Definition: EdbView.h:194
EdbRun * run
Definition: check_raw.C:38
s
Definition: check_shower.C:55
TFile * file
Definition: write_pvr.C:3
#define NULL
Definition: nidaqmx.h:84
void a2v(float xa, float ya, EdbMarksSet *mark, EdbView *v, float *xv, float *yv)
Definition: setSegment.C:208
int even(const int n)
Definition: setSegment.C:3