]>
Commit | Line | Data |
---|---|---|
c1076715 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
b251a2b5 | 18 | Revision 1.10 2001/02/13 20:39:06 jbarbosa |
19 | Changes to make it work with new IO. | |
20 | ||
a5886574 | 21 | Revision 1.9 2001/01/22 21:39:11 jbarbosa |
22 | Several tune-ups | |
23 | ||
eb1ee126 | 24 | Revision 1.8 2000/11/15 15:52:53 jbarbosa |
25 | Turned on spot algorithm. | |
26 | ||
ceccff49 | 27 | Revision 1.7 2000/11/01 15:37:05 jbarbosa |
28 | Updated to use its own rec. point object. | |
29 | ||
4a5c8776 | 30 | Revision 1.6 2000/10/02 21:28:12 fca |
31 | Removal of useless dependecies via forward declarations | |
32 | ||
94de3818 | 33 | Revision 1.5 2000/06/30 16:30:28 dibari |
34 | Disabled writing to rechits. | |
35 | ||
a366fdbe | 36 | Revision 1.4 2000/06/15 15:46:59 jbarbosa |
37 | Corrected compilation errors on HP-UX (replaced pow with TMath::Power) | |
38 | ||
00df6e79 | 39 | Revision 1.3 2000/06/13 13:15:41 jbarbosa |
40 | Still some code cleanup done (variable names) | |
41 | ||
3a3df9e3 | 42 | Revision 1.2 2000/06/12 15:19:30 jbarbosa |
43 | Cleaned up version. | |
44 | ||
237c933d | 45 | Revision 1.1 2000/04/19 13:05:14 morsch |
46 | J. Barbosa's spot reconstruction algorithm. | |
47 | ||
c1076715 | 48 | */ |
49 | ||
50 | ||
51 | #include "AliRICH.h" | |
52 | #include "AliRICHPoints.h" | |
53 | #include "AliRICHDetect.h" | |
237c933d | 54 | #include "AliRICHHit.h" |
55 | #include "AliRICHDigit.h" | |
c1076715 | 56 | #include "AliRun.h" |
57 | #include "TParticle.h" | |
94de3818 | 58 | #include "TTree.h" |
c1076715 | 59 | #include "TMath.h" |
60 | #include "TRandom.h" | |
61 | ||
62 | ||
63 | ||
64 | ClassImp(AliRICHDetect) | |
65 | //___________________________________________ | |
66 | AliRICHDetect::AliRICHDetect() : TObject() | |
67 | { | |
237c933d | 68 | |
69 | // Default constructor | |
70 | ||
c1076715 | 71 | //fChambers = 0; |
72 | } | |
73 | ||
74 | //___________________________________________ | |
75 | AliRICHDetect::AliRICHDetect(const char *name, const char *title) | |
76 | : TObject() | |
77 | { | |
78 | ||
237c933d | 79 | // Constructor |
80 | ||
c1076715 | 81 | /*fChambers = new TObjArray(7); |
82 | for (Int_t i=0; i<7; i++) { | |
83 | ||
84 | (*fChambers)[i] = new AliRICHchamber(); | |
85 | ||
86 | } */ | |
87 | } | |
88 | ||
89 | ||
90 | void AliRICHDetect::Detect() | |
91 | { | |
92 | ||
237c933d | 93 | // |
94 | // Detection algorithm | |
95 | ||
96 | ||
c1076715 | 97 | //printf("Detection started!\n"); |
3a3df9e3 | 98 | Float_t omega,steptheta,stepphi,x,y,cx,cy,l,aux1,aux2,aux3,maxi,maxj,maxk,max; |
c1076715 | 99 | //Float_t theta,phi,realomega,realtheta; |
100 | Int_t i,j,k; | |
ceccff49 | 101 | |
c1076715 | 102 | |
eb1ee126 | 103 | //const Float_t Noise_Level=0; //Noise Level in percentage of mesh points |
c1076715 | 104 | //const Float_t t=0.6; //Softening of Noise Correction (factor) |
105 | ||
3a3df9e3 | 106 | const Float_t kPi=3.1415927; |
c1076715 | 107 | |
eb1ee126 | 108 | const Float_t kHeight=10; //Distance from Radiator to Pads in pads |
ceccff49 | 109 | |
eb1ee126 | 110 | const Int_t kSpot=0; //number of passes with spot algorithm |
c1076715 | 111 | |
ceccff49 | 112 | const Int_t kDimensionTheta=50; //Matrix dimension for angle Detection |
113 | const Int_t kDimensionPhi=50; | |
114 | const Int_t kDimensionOmega=50; | |
c1076715 | 115 | |
eb1ee126 | 116 | const Float_t SPOTp=.2; //Percentage of spot action |
117 | //const Int_t np=500; //Number of points to reconstruct elipse | |
118 | const Float_t kMinOmega=30*kPi/180; | |
3a3df9e3 | 119 | const Float_t kMaxOmega=65*kPi/180; //Maximum Cherenkov angle to identify |
eb1ee126 | 120 | |
121 | const Float_t kCorr=.5; //Correction factor, accounting for aberration, refractive index, etc. | |
122 | ||
3a3df9e3 | 123 | Int_t point[kDimensionTheta][kDimensionPhi][kDimensionOmega]; |
ceccff49 | 124 | Int_t point1[kDimensionTheta][kDimensionPhi][kDimensionOmega]; |
c1076715 | 125 | |
3a3df9e3 | 126 | steptheta=kPi/kDimensionTheta; |
127 | stepphi=kPi/kDimensionPhi; | |
c1076715 | 128 | |
129 | AliRICHChamber* iChamber; | |
130 | ||
3a3df9e3 | 131 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
c1076715 | 132 | Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries(); |
133 | //Int_t ntrks = gAlice->GetNtrack(); | |
134 | ||
135 | Float_t trackglob[3]; | |
136 | Float_t trackloc[3]; | |
137 | ||
138 | //printf("Got ntracks:%d\n",ntracks); | |
139 | /*TVector *xp = new TVector(1000); | |
140 | TVector *yp = new TVector(1000); | |
141 | TVector *zp = new TVector(1000); | |
142 | TVector *ptrk = new TVector(1000); | |
143 | TVector *phit = new TVector(1000);*/ | |
144 | ||
145 | //printf("Area de uma elipse com teta 0 e Omega 45:%f",Area(0,45)); | |
146 | ||
4a5c8776 | 147 | Int_t track; |
c1076715 | 148 | |
4a5c8776 | 149 | for (track=0; track<ntracks;track++) { |
c1076715 | 150 | gAlice->ResetHits(); |
151 | gAlice->TreeH()->GetEvent(track); | |
3a3df9e3 | 152 | TClonesArray *pHits = pRICH->Hits(); |
153 | if (pHits == 0) return; | |
154 | Int_t nhits = pHits->GetEntriesFast(); | |
c1076715 | 155 | if (nhits == 0) continue; |
156 | Int_t nent=(Int_t)gAlice->TreeD()->GetEntries(); | |
b251a2b5 | 157 | gAlice->TreeD()->GetEvent(1); |
c1076715 | 158 | AliRICHHit *mHit = 0; |
159 | AliRICHDigit *points = 0; | |
160 | //Int_t npoints=0; | |
161 | ||
162 | Int_t counter=0; | |
163 | //Initialization | |
3a3df9e3 | 164 | for(i=0;i<kDimensionTheta;i++) |
c1076715 | 165 | { |
3a3df9e3 | 166 | for(j=0;j<kDimensionPhi;j++) |
c1076715 | 167 | { |
3a3df9e3 | 168 | for(k=0;k<kDimensionOmega;k++) |
c1076715 | 169 | { |
170 | counter++; | |
3a3df9e3 | 171 | point[i][j][k]=0; |
172 | //printf("Dimensions theta:%d, phi:%d, omega:%d",kDimensionTheta,kDimensionPhi,kDimensionOmega); | |
c1076715 | 173 | //printf("Resetting %d %d %d, time %d\n",i,j,k,counter); |
3a3df9e3 | 174 | //-Noise_Level*(Area(i*kPi/(18*dimension),k*kMaxOmega/dimension)-Area((i-1)*kPi/(18*dimension),(k-1)*kMaxOmega/dimension)); |
175 | //printf("n-%f",-Noise_Level*(Area(i*kPi/(18*dimension),k*kMaxOmega/dimension)-Area((i-1)*kPi/(18*dimension),(k-1)*kMaxOmega/dimension))); | |
c1076715 | 176 | } |
177 | } | |
178 | } | |
3a3df9e3 | 179 | mHit = (AliRICHHit*) pHits->UncheckedAt(0); |
c1076715 | 180 | //printf("Aqui vou eu\n"); |
181 | Int_t nch = mHit->fChamber; | |
182 | //printf("Aqui fui eu\n"); | |
94de3818 | 183 | trackglob[0] = mHit->X(); |
184 | trackglob[1] = mHit->Y(); | |
185 | trackglob[2] = mHit->Z(); | |
c1076715 | 186 | |
187 | cx=trackglob[0]; | |
188 | cy=trackglob[2]; | |
189 | ||
190 | ||
191 | //printf("Chamber processed:%d\n",nch); | |
ceccff49 | 192 | |
193 | printf("\nChamber %d, particle at: %3.1f %3.1f,\n",nch,trackglob[0],trackglob[2]); | |
c1076715 | 194 | |
3a3df9e3 | 195 | iChamber = &(pRICH->Chamber(nch-1)); |
c1076715 | 196 | |
197 | //printf("Nch:%d\n",nch); | |
198 | ||
199 | iChamber->GlobaltoLocal(trackglob,trackloc); | |
200 | ||
3a3df9e3 | 201 | //printf("Transformation 1: %3.1f %3.1f %3.1f\n",trackloc[0],trackloc[1],trackloc[2]); |
c1076715 | 202 | |
203 | ||
204 | iChamber->LocaltoGlobal(trackloc,trackglob); | |
205 | ||
3a3df9e3 | 206 | //printf("Transformation 2: %3.1f %3.1f %3.1f\n",trackglob[0],trackglob[1],trackglob[2]); |
c1076715 | 207 | |
208 | ||
209 | ||
210 | ||
3a3df9e3 | 211 | TClonesArray *pDigits = pRICH->DigitsAddress(nch-1); |
212 | Int_t ndigits = pDigits->GetEntriesFast(); | |
c1076715 | 213 | |
214 | //printf("Got %d digits\n",ndigits); | |
215 | ||
216 | //printf("Starting calculations\n"); | |
217 | ||
3a3df9e3 | 218 | for(Float_t theta=0;theta<kPi/18;theta+=steptheta) |
c1076715 | 219 | { |
3a3df9e3 | 220 | for(Float_t phi=0;phi<=kPi/3;phi+=stepphi) |
c1076715 | 221 | { |
222 | for (Int_t dig=0;dig<ndigits;dig++) | |
223 | { | |
3a3df9e3 | 224 | points=(AliRICHDigit*) pDigits->UncheckedAt(dig); |
c1076715 | 225 | |
226 | x=points->fPadX-cx; | |
227 | y=points->fPadY-cy; | |
228 | //printf("Loaded digit %d with coordinates x:%f, y%f\n",dig,x,y); | |
229 | //cout<<"x="<<x<<" y="<<y<<endl; | |
eb1ee126 | 230 | |
00df6e79 | 231 | if (sqrt(TMath::Power(x,2)+TMath::Power(y,2))<kHeight*tan(theta+kMaxOmega)*3/4) |
c1076715 | 232 | { |
233 | ||
eb1ee126 | 234 | |
3a3df9e3 | 235 | l=kHeight/cos(theta); |
c1076715 | 236 | |
237 | aux1=-y*sin(phi)+x*cos(phi); | |
238 | aux2=y*cos(phi)+x*sin(phi); | |
00df6e79 | 239 | aux3=( TMath::Power(aux1,2)+TMath::Power(cos(theta)*aux2 ,2))/TMath::Power(sin(theta)*aux2+l,2); |
eb1ee126 | 240 | //cout<<"aux1="<<aux1<<" aux2="<<aux2<<" aux3="<<aux3; |
241 | ||
3a3df9e3 | 242 | omega=atan(sqrt(aux3)); |
243 | //printf("Omega: %f\n",omega); | |
c1076715 | 244 | |
3a3df9e3 | 245 | //cout<<"\ni="<<i<<" theta="<<Int_t(2*theta*dimension/kPi)<<" phi="<<Int_t(2*phi*dimension/kPi)<<" omega="<<Int_t(2*omega*dimension/kPi)<<endl<<endl; |
c1076715 | 246 | //{Int_t lixo;cin>>lixo;} |
eb1ee126 | 247 | if(omega<kMaxOmega && omega>kMinOmega) |
248 | { | |
249 | omega=omega-kMinOmega; | |
250 | //point[Int_t(2*theta*kDimensionTheta/kPi)][Int_t(2*phi*kDimensionPhi/kPi)][Int_t(kCorr*2*omega*kDimensionOmega/kMaxOmega)]+=1; | |
251 | point[Int_t(2*theta*kDimensionTheta/kPi)][Int_t(2*phi*kDimensionPhi/kPi)][Int_t(kCorr*(omega/(kMaxOmega-kMinOmega)*kDimensionOmega))]+=1; | |
252 | } | |
3a3df9e3 | 253 | //if(omega<kMaxOmega)point[Int_t(theta)][Int_t(phi)][Int_t(omega)]+=1; |
c1076715 | 254 | } |
255 | } | |
256 | } | |
257 | } | |
258 | ||
259 | ||
c1076715 | 260 | //SPOT execute twice |
ceccff49 | 261 | for(Int_t s=0;s<kSpot;s++) |
c1076715 | 262 | { |
ceccff49 | 263 | printf(" Applying Spot algorithm, pass %d\n", s); |
264 | ||
c1076715 | 265 | //buffer copy |
3a3df9e3 | 266 | for(i=0;i<=kDimensionTheta;i++) |
ceccff49 | 267 | { |
268 | for(j=0;j<=kDimensionPhi;j++) | |
269 | { | |
270 | for(k=0;k<=kDimensionOmega;k++) | |
271 | { | |
272 | point1[i][j][k]=point[i][j][k]; | |
273 | } | |
274 | } | |
275 | } | |
276 | ||
c1076715 | 277 | //SPOT algorithm |
3a3df9e3 | 278 | for(i=1;i<kDimensionTheta;i++) |
ceccff49 | 279 | { |
280 | for(j=1;j<kDimensionPhi;j++) | |
c1076715 | 281 | { |
ceccff49 | 282 | for(k=1;k<kDimensionOmega;k++) |
c1076715 | 283 | { |
ceccff49 | 284 | if((point[i][k][j]>point[i-1][k][j])&&(point[i][k][j]>point[i+1][k][j])&& |
285 | (point[i][k][j]>point[i][k-1][j])&&(point[i][k][j]>point[i][k+1][j])&& | |
286 | (point[i][k][j]>point[i][k][j-1])&&(point[i][k][j]>point[i][k][j+1])) | |
287 | { | |
288 | //cout<<"SPOT"<<endl; | |
289 | //Execute SPOT on point | |
290 | point1[i][j][k]+=Int_t(SPOTp*(point[i-1][k][j]+point[i+1][k][j]+point[i][k-1][j]+point[i][k+1][j]+point[i][k][j-1]+point[i][k][j+1])); | |
291 | point1[i-1][k][j]=Int_t(SPOTp*point[i-1][k][j]); | |
292 | point1[i+1][k][j]=Int_t(SPOTp*point[i+1][k][j]); | |
293 | point1[i][k-1][j]=Int_t(SPOTp*point[i][k-1][j]); | |
294 | point1[i][k+1][j]=Int_t(SPOTp*point[i][k+1][j]); | |
295 | point1[i][k][j-1]=Int_t(SPOTp*point[i][k][j-1]); | |
296 | point1[i][k][j+1]=Int_t(SPOTp*point[i][k][j+1]); | |
297 | } | |
c1076715 | 298 | } |
299 | } | |
ceccff49 | 300 | } |
301 | ||
c1076715 | 302 | //copy from buffer copy |
3a3df9e3 | 303 | for(i=1;i<kDimensionTheta;i++) |
ceccff49 | 304 | { |
305 | for(j=1;j<kDimensionPhi;j++) | |
306 | { | |
307 | for(k=1;k<kDimensionOmega;k++) | |
308 | { | |
309 | point[i][j][k]=point1[i][j][k]; | |
310 | //if(point1[i][j][k] != 0) | |
311 | //printf("Last transfer point: %d, point1, %d\n",point[i][j][k],point1[i][j][k]); | |
312 | } | |
313 | } | |
314 | } | |
315 | } | |
c1076715 | 316 | |
317 | ||
318 | //Identification is equivalent to maximum determination | |
319 | max=0;maxi=0;maxj=0;maxk=0; | |
320 | ||
ceccff49 | 321 | printf(" Proceeding to identification"); |
c1076715 | 322 | |
3a3df9e3 | 323 | for(i=1;i<kDimensionTheta-3;i++) |
324 | for(j=1;j<=kDimensionPhi-3;j++) | |
325 | for(k=0;k<=kDimensionOmega;k++) | |
ceccff49 | 326 | if(point[i][j][k]>max) |
327 | { | |
328 | //cout<<"maxi="<<i*90/dimension<<" maxj="<<j*90/dimension<<" maxk="<<k*kMaxOmega/dimension*180/kPi<<" max="<<max<<endl; | |
329 | maxi=i;maxj=j;maxk=k; | |
330 | max=point[i][j][k]; | |
331 | printf("."); | |
332 | //printf("Max Omega %f, Max Theta %f, Max Phi %f\n",maxk,maxi,maxj); | |
333 | } | |
334 | printf("\n"); | |
c1076715 | 335 | |
eb1ee126 | 336 | maxk=maxk*(kMaxOmega-kMinOmega)/kDimensionOmega + kMinOmega; |
337 | ||
338 | ||
3a3df9e3 | 339 | //printf("Detected angle for height %3.1f and for center %3.1f %3.1f:%f\n",h,cx,cy,maxk*kPi/(kDimensionTheta*4)); |
eb1ee126 | 340 | printf(" Indentified cerenkov angle: %f\n", maxk); |
3a3df9e3 | 341 | //printf("Detected angle for height %3.1f and for center %3.1f %3.1f:%f\n",kHeight,cx,cy,maxk); |
c1076715 | 342 | |
343 | ||
344 | //fscanf(omegas,"%f",&realomega); | |
345 | //fscanf(thetas,"%f",&realtheta); | |
346 | //printf("Real Omega: %f",realomega); | |
3a3df9e3 | 347 | //cout<<"Detected:theta="<<maxi*90/kDimensionTheta<<"phi="<<maxj*90/kDimensionPhi<<"omega="<<maxk*kMaxOmega/kDimensionOmega*180/kPi<<" OmegaError="<<fabs(maxk*kMaxOmega/kDimensionOmega*180/kPi-realomega)<<" ThetaError="<<fabs(maxi*90/kDimensionTheta-realtheta)<<endl<<endl; |
c1076715 | 348 | |
3a3df9e3 | 349 | //fprintf(results,"Center Coordinates, cx=%6.2f cy=%6.2f, Real Omega=%6.2f, Detected Omega=%6.2f, Omega Error=%6.2f Theta Error=%6.2f\n",cx,cy,realomega,maxk*kMaxOmega/kDimensionOmega*180/kPi,fabs(maxk*kMaxOmega/kDimensionOmega*180/kPi-realomega),fabs(maxi*90/kDimensionTheta-realtheta)); |
c1076715 | 350 | |
351 | /*for(j=0;j<np;j++) | |
3a3df9e3 | 352 | pointpp(maxj*90/kDimensionTheta,maxi*90/kDimensionPhi,maxk*kMaxOmega/kDimensionOmega*180/kPi,cx,cy);//Generates a point on the elipse*/ |
c1076715 | 353 | |
354 | ||
355 | //Start filling rec. hits | |
356 | ||
a366fdbe | 357 | Float_t rechit[6]; |
c1076715 | 358 | |
3a3df9e3 | 359 | rechit[0] = (Float_t)( maxi*kPi/(kDimensionTheta*4)); |
360 | rechit[1] = (Float_t)( maxj*kPi/(kDimensionPhi*4)); | |
eb1ee126 | 361 | rechit[2] = (Float_t)( maxk); |
c1076715 | 362 | //rechit[0] = (Float_t)( maxi); |
363 | //rechit[1] = (Float_t)( maxj); | |
364 | //rechit[2] = (Float_t)( maxk); | |
365 | rechit[3] = cx; | |
366 | rechit[4] = cy; | |
a366fdbe | 367 | rechit[5] = 0.5; |
c1076715 | 368 | |
369 | //printf ("track %d, theta %f, phi %f, omega %f\n\n\n",track,rechit[0],rechit[1],rechit[2]); | |
370 | ||
371 | // fill rechits | |
4a5c8776 | 372 | pRICH->AddRecHit3D(nch-1,rechit); |
ceccff49 | 373 | //printf("Chamber:%d",nch); |
c1076715 | 374 | } |
375 | //printf("\n\n\n\n"); | |
376 | gAlice->TreeR()->Fill(); | |
377 | //TTree *TR=gAlice->TreeR(); | |
378 | //Stat_t ndig=TR->GetEntries(); | |
379 | TClonesArray *fRec; | |
237c933d | 380 | for (i=0;i<kNCH;i++) { |
4a5c8776 | 381 | fRec=pRICH->RecHitsAddress3D(i); |
c1076715 | 382 | int ndig=fRec->GetEntriesFast(); |
383 | printf ("Chamber %d, rings %d\n",i,ndig); | |
384 | } | |
385 | //printf("Number of rec. hits: %d",ndig); | |
4a5c8776 | 386 | pRICH->ResetRecHits3D(); |
c1076715 | 387 | //char hname[30]; |
388 | //sprintf(hname,"TreeR%d",track); | |
389 | //gAlice->TreeR()->Write(hname); | |
390 | ||
391 | } | |
392 | ||
3a3df9e3 | 393 | Float_t AliRICHDetect:: Area(Float_t theta,Float_t omega) |
c1076715 | 394 | { |
237c933d | 395 | |
396 | // | |
397 | // Calculates area of an ellipse for given incidence angles | |
398 | ||
399 | ||
c1076715 | 400 | Float_t area; |
3a3df9e3 | 401 | const Float_t kHeight=9.25; //Distance from Radiator to Pads in pads |
c1076715 | 402 | |
00df6e79 | 403 | area=TMath::Pi()*TMath::Power(kHeight*tan(omega),2)/TMath::Power(TMath::Power(cos(theta),2)-TMath::Power(tan(omega)*sin(theta),2),3/2); |
c1076715 | 404 | |
405 | return (area); | |
406 | } | |
407 | ||
408 | /*Int_t ***AliRICHDetect::i3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh) | |
409 | // allocate a Float_t 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] | |
410 | { | |
411 | long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1; | |
412 | Int_t ***t; | |
413 | ||
414 | // allocate pointers to pointers to rows | |
415 | t=(Int_t ***) malloc((size_t)((nrow+NR_END)*sizeof(Int_t**))); | |
416 | if (!t) printf("allocation failure 1 in f3tensor()"); | |
417 | t += NR_END; | |
418 | t -= nrl; | |
419 | ||
420 | // allocate pointers to rows and set pointers to them | |
421 | t[nrl]=(Int_t **) malloc((size_t)((nrow*ncol+NR_END)*sizeof(Int_t*))); | |
422 | if (!t[nrl]) printf("allocation failure 2 in f3tensor()"); | |
423 | t[nrl] += NR_END; | |
424 | t[nrl] -= ncl; | |
425 | ||
426 | // allocate rows and set pointers to them | |
427 | t[nrl][ncl]=(Int_t *) malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(Int_t))); | |
428 | if (!t[nrl][ncl]) printf("allocation failure 3 in f3tensor()"); | |
429 | t[nrl][ncl] += NR_END; | |
430 | t[nrl][ncl] -= ndl; | |
431 | ||
432 | for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep; | |
433 | for(i=nrl+1;i<=nrh;i++) { | |
434 | t[i]=t[i-1]+ncol; | |
435 | t[i][ncl]=t[i-1][ncl]+ncol*ndep; | |
436 | for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep; | |
437 | } | |
438 | ||
439 | // return pointer to array of pointers to rows | |
440 | return t; | |
441 | }*/ | |
442 | ||
3a3df9e3 | 443 | /*void pointpp(Float_t alfa,Float_t theta,Float_t omega,Float_t cx,Float_t cy) |
c1076715 | 444 | { |
445 | Int_t s; | |
3a3df9e3 | 446 | Float_t fiducial=h*tan((omega+theta)*kPi/180),l=h/cos(theta*kPi/180),xtrial,y,c0,c1,c2; |
c1076715 | 447 | |
448 | //cout<<"fiducial="<<fiducial<<endl; | |
449 | ||
450 | c0=0;c1=0;c2=0; | |
451 | while((c1*c1-4*c2*c0)<=0) | |
452 | { | |
453 | //Choose which side to go... | |
454 | if(aleat(1)>.5) s=1; else s=-1; | |
455 | //Trial a y | |
456 | y=s*aleat(fiducial); | |
3a3df9e3 | 457 | Float_t alfa1=alfa*kPi/180; |
458 | Float_t theta1=theta*kPi/180; | |
459 | Float_t omega1=omega*kPi/180; | |
c1076715 | 460 | //Solve the eq for a trial x |
00df6e79 | 461 | c0=-TMath::Power(y*cos(alfa1)*cos(theta1),2)-TMath::Power(y*sin(alfa1),2)+TMath::Power(l*tan(omega1),2)+2*l*y*cos(alfa1)*sin(theta1)*TMath::Power(tan(omega1),2)+TMath::Power(y*cos(alfa1)*sin(theta1)*tan(omega1),2); |
462 | c1=2*y*cos(alfa1)*sin(alfa1)-2*y*cos(alfa1)*TMath::Power(cos(theta1),2)*sin(alfa1)+2*l*sin(alfa1)*sin(theta1)*TMath::Power(tan(omega1),2)+2*y*cos(alfa1)*sin(alfa1)*TMath::Power(sin(theta1),2)*TMath::Power(tan(omega1),2); | |
463 | c2=-TMath::Power(cos(alfa1),2)-TMath::Power(cos(theta1)*sin(alfa1),2)+TMath::Power(sin(alfa1)*sin(theta1)*tan(omega1),2); | |
c1076715 | 464 | //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl; |
465 | } | |
466 | //Choose which side to go... | |
467 | if(aleat(1)>.5) s=1; else s=-1; | |
468 | xtrial=cx+(-c1+s*sqrt(c1*c1-4*c2*c0))/(2*c2); | |
469 | //cout<<"x="<<xtrial<<" y="<<cy+y<<endl; | |
470 | fprintf(final,"%f %f\n",xtrial,cy+y); | |
471 | }*/ | |
472 | ||
473 | ||
474 | ||
475 | ||
476 | ||
477 |