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