311{
312
313 G4int sector=-1, cryNb=-1;
314 G4int leftFlag=0;
315 G4int downFlag=0;
316 G4int pentaFlag=0;
318 G4double A1=0,a1=0,B1=0,b1=0,C1=0,c1=0,D1=0,d1=0,E1=0,
e1=0;
319 G4int m_numPhi=0;
320 G4ThreeVector position(0,0,0);
321 G4int cryInOneSector = cryNumInOneLayer[numTheta]/16;
322 G4ThreeVector pos[8];
323
324 if(partId==2)
325 {
326 if(numPhi>=0&&numPhi<8*cryInOneSector)
327 m_numPhi=8*cryInOneSector-1-numPhi;
328 else if(numPhi>=8*cryInOneSector&&numPhi<16*cryInOneSector)
329 m_numPhi=16*cryInOneSector-1-numPhi;
330 }
331 else
332 m_numPhi=numPhi;
333
334 if(numPhi>=4*cryInOneSector&&numPhi<5*cryInOneSector)
335 {
336 leftFlag = 1;
337 m_numPhi=8*cryInOneSector-1-numPhi;
338 }
339 else if(numPhi>=11*cryInOneSector&&numPhi<12*cryInOneSector)
340 {
341 leftFlag = 1;
342 downFlag = 1;
343 m_numPhi=numPhi-8*cryInOneSector;
344 }
345 if(numPhi>=12*cryInOneSector&&numPhi<13*cryInOneSector)
346 {
347 downFlag = 1;
348 m_numPhi=16*cryInOneSector-1-numPhi;
349 }
350
351
352 G4int cryNbOffset = 0;
353 for(G4int i=0;i<numTheta;i++)
354 cryNbOffset += cryNumInOneLayer[i]/16;
355 if(cryInOneSector)
356 sector = m_numPhi/cryInOneSector;
357 cryNb = m_numPhi-cryInOneSector*sector+cryNbOffset;
358 sector += 3;
359 if(sector>15&§or<=18)
360 sector -= 16;
361
362
363 if(sector==6)
364 for(G4int i=0;i<8;i++)
365 pos[i]=fPnt1[cryNb][i];
366 else
367 for(G4int i=0;i<8;i++)
368 {
369 pos[i]=fPnt[cryNb][i];
370 pos[i].rotateZ(-67.5*deg+sector*22.5*deg);
371 }
372
373
375 G4double
A = (cryPoint[0]-cryPoint[3]).r();
376 G4double a = (cryPoint[4]-cryPoint[7]).r();
377 G4double
B = (cryPoint[1]-cryPoint[2]).r();
378 G4double
b = (cryPoint[5]-cryPoint[6]).r();
379 G4double
C = (cryPoint[0]-cryPoint[1]).r();
380 G4double c = (cryPoint[4]-cryPoint[5]).r();
381 G4double D = (cryPoint[2]-cryPoint[3]).r();
382 G4double d = (cryPoint[6]-cryPoint[7]).r();
383
384
385 for(G4int i=0;i<8;i++)
386 {
387 pos[i].setZ(pos[i].getZ()+WorldZPosition);
388 if(leftFlag==1)
389 pos[i].setX(-pos[i].getX());
390 if(downFlag==1)
391 pos[i].setY(-pos[i].getY());
392 if(partId==2)
393 {
394 pos[i].setX(-pos[i].getX());
395 pos[i].setZ(-pos[i].getZ());
396 }
397 }
398
399
400 for(G4int j=4;j<8;j++)
401 position += pos[j];
402 position /= 4;
403
404
405 for(G4int i=0;i<5;i++)
406 {
407 if(cryNb==pentaInOneSector[i])
408 {
409 pentaFlag = 1;
410 G4ThreeVector penta[8];
411
412
413 if(sector==6)
414 for(G4int j=0;j<8;j++)
415 penta[j]=fPnt1[30+i][j];
416 else
417 for(G4int j=0;j<8;j++)
418 {
419 penta[j]=fPnt[30+i][j];
420 penta[j].rotateZ(-67.5*deg+sector*22.5*deg);
421 }
422
423
425 A1 = (cryPoint[1]-cryPoint[2]).r();
426 a1 = (cryPoint[5]-cryPoint[6]).r();
427 B1 = (cryPoint[1]-cryPoint[0]).r();
428 b1 = (cryPoint[5]-cryPoint[4]).r();
429 C1 = (cryPoint[0]-cryPoint[3]).r()+
A;
430 c1 = (cryPoint[4]-cryPoint[7]).r()+a;
431 D1 = D;
432 d1 = d;
435
436
437 for(G4int j=0;j<8;j++)
438 {
439 penta[j].setZ(penta[j].getZ()+WorldZPosition);
440 if(leftFlag==1)
441 penta[j].setX(-penta[j].getX());
442 if(downFlag==1)
443 penta[j].setY(-penta[j].getY());
444 if(partId==2)
445 {
446 penta[j].setX(-penta[j].getX());
447 penta[j].setZ(-penta[j].getZ());
448 }
449 }
450
451
452 for(G4int j=4;j<8;j++)
453 {
454 if(j!=0&&j!=4)
455 position += pos[j];
456 if(j==0||j==1||j==4||j==5)
457 position += penta[j];
458 }
459 position /= 10;
460
461 flag = leftFlag+downFlag;
463 {
464 G4double temp1 = B1; B1 = D1; D1 = temp1;
465 temp1 = A1; A1 = E1; E1 = temp1;
466 temp1 = b1; b1 = d1; d1 = temp1;
467 temp1 = a1; a1 =
e1;
e1 = temp1;
468 }
469
470 break;
471 }
472 }
473
474 flag = leftFlag+downFlag+partId/2;
476 {
477 G4double temp =
C;
C = D; D = temp;
478 temp = c; c = d; d = temp;
479 }
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495 return position;
496}
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
void ModifyForCasing(G4ThreeVector pos[8], G4int CryNb)