28 #include "TClonesArray.h"
62 fCollectionEfficiency(1.),
68 fCrossTalkHitProb(0.02),
101 if (NULL == det) cout <<
" -I no RICH Geo Node found !!!!! " << endl;
108 fDetZ = detPosLab.
Z() + detPosCen.
Z();
109 fDetY = detPosLab.
Y() + detPosCen.
Y();
110 fDetX = detPosLab.
X() + detPosCen.
X();
115 for(Int_t i = 0; i < fdetA->GetSize(); i++) cout <<
"Array detector " << fdetA->At(i)<< endl;
119 cout <<
"Rotation matrix of photodetector " << endl;
120 for(Int_t i = 0; i < 9; i++) cout <<
"Rot(" << i <<
") = " << fdetR(i) << endl;
135 fTheta = TMath::ASin(fdetR(7));
136 fPhi = -1.*TMath::ASin(fdetR(2));
138 if (
fVerbose) cout <<
"Rich Photodetector was tilted around x by " <<
fTheta*180./TMath::Pi() <<
" degrees" << endl;
139 if (
fVerbose) cout <<
"Rich Photodetector was tilted around y by " <<
fPhi*180./TMath::Pi() <<
" degrees" << endl;
143 if (NULL == gas) cout <<
" -I no RICH Geo Node found !!!!! " << endl;
149 cerpar=
new Double_t[4];
150 if (
fVerbose) cout <<
"Number of optical parameters for Cherenkov " << npckov << endl;
162 if (
fVerbose) cout <<
" refractive index for lowest photon energies (n-1)*10000 " << (
fNRefrac-1.0)*10000.0 << endl;
165 Double_t fDetY_org, fDetX_org;
174 cout <<
"---------------------- RICH Hit Producer ---------------------------------------" << endl;
175 cout <<
" detector position in (x,y,z) [cm]: " <<
fDetX <<
" " << fDetY_org <<
" " <<
fDetZ_org << endl;
176 cout <<
" tilted detector position in (x,y,z) [cm]: " <<
fDetX <<
" " <<
fDetY <<
" " <<
fDetZ << endl;
179 cout <<
" ideal detector " << endl;
181 cout <<
" detector type: Protvino PMT with PMT radius = " <<
fPhotomulRadius <<
" cm, distance between PMTs = " <<
fPhotomulDist <<
" cm" << endl;
183 cout <<
" detector type: CSI with pad size = " <<
fPhotomulRadius <<
" cm, distance between panels = " <<
fPhotomulDist <<
" cm" << endl;
185 cout <<
" detector type: Hamamatsu H8500 with pad size = " <<
fPhotomulRadius <<
" cm, distance between elements = " <<
fPhotomulDist <<
" cm" << endl;
186 cout <<
" number of noise hits (to be reduced by geometrical efficiency) " <<
fNofNoiseHits << endl;
187 cout <<
"--------------------------------------------------------------------------------" << endl;
225 if (NULL ==
fRichPoints) { Fatal(
"CbmRichHitProducer::Init",
"No RichPoint array!"); }
230 fRichHits =
new TClonesArray(
"CbmRichHit");
257 cout <<
"-I- CbmRichHitProducer, event no " <<
fNEvents << endl;
260 Double_t lambda_min,lambda_max,lambda_step;
261 Double_t efficiency[100];
269 for(Int_t j = 0; j <
fRichPoints->GetEntries(); j++){
277 if (
fVerbose > 1) cout <<
" position in Labsystem " << posPoint.X() <<
" " << posPoint.Y() <<
" " << posPoint.Z() << endl;
278 if (
fVerbose > 1) cout <<
" tilted position in Labsystem " << detPoint.X() <<
" " << detPoint.Y() <<
" " << detPoint.Z() << endl;
283 Int_t gcode = pt->
fPDG;
286 cout <<
" z-position not at " <<
fDetZ <<
" but " << detPoint.Z() << endl;
292 Double_t sigma0 = 0.;
293 Double_t sigma = 0.19;
306 Double_t zHit =
fDetZ;
313 if (xHit != 0.0 && yHit != 0.0) {
317 cout <<
"-E- RichHitProducer: wrongly assigned Hits (distance point-hit too large)!" << endl;
322 cout <<
"-E- RichHitProducer: wrongly assigned Hits (distance point-hit too large)! " <<
323 detPoint.X() <<
" " << xHit <<
" " << detPoint.Y() <<
" " << yHit << endl;
328 cout <<
"-E- RichHitProducer: wrongly assigned Hits ? (distance point-hit too large)! " <<
329 detPoint.X() <<
" " << xHit <<
" " << detPoint.Y() <<
" " << yHit << endl;
332 if (gcode == 50000050) {
336 Double_t etot = sqrt(mom.Px()*mom.Px() + mom.Py()*mom.Py() + mom.Pz()*mom.Pz());
339 if (lambda >= lambda_min && lambda < lambda_max) {
340 Int_t ilambda=(Int_t)((lambda-lambda_min)/lambda_step);
341 Double_t
rand = gRandom->Rndm();
343 if (
fDetType == 5 && lambda < 300.) {
360 TVector3 posHit(xHit,yHit,zHit);
364 if (RichDetID == 0) RichDetID = address;
365 if (RichDetID != address)
366 cout <<
"-E- RichDetID changed from " << RichDetID <<
" to " << address << endl;
368 AddHit(posHit,posHitErr,address,pmtID,ampl,j);
375 cout <<
" iHit, Point-x, Point-y, Hit-x, Hiy-y, detected, PMT? " << j <<
" "
376 << posPoint.X() <<
" " << posPoint.Y() <<
" " << xHit <<
" "
377 << yHit <<
" " <<
fDetection <<
" " << pmtID << endl;
383 Double_t
rand = gRandom->Rndm();
385 rand = gRandom->Rndm();
386 if (rand < 0.5 ) xRand = -1.*xRand;
387 rand = gRandom->Rndm();
389 rand = gRandom->Rndm();
390 if (rand < 0.5 ) yRand = -1.*yRand;
406 if (xHit!=0.0 && yHit!=0.0) {
407 Double_t zHit =
fDetZ;
408 TVector3 posHit(xHit,yHit,zHit);
415 AddHit(posHit,posHitErr,RichDetID,pmtID,ampl,-1);
419 cout <<
"Nof hits: "<<
fRichHits->GetEntries()<< endl;
420 cout <<
"Fraction of double hits: "<<(Double_t)(
fNDoubleHits)/(Double_t)(
fNHits) << endl;
432 if (noTilting ==
false){
433 Double_t xDet,yDet,zDet;
435 if (inPos->X() > 0 && inPos->Y() > 0) {
436 xDet = inPos->X()*TMath::Cos(phi) + inPos->Z()*TMath::Sin(phi) - detZOrig*TMath::Sin(phi);
437 yDet = -inPos->X()*TMath::Sin(theta)*TMath::Sin(phi) + inPos->Y()*TMath::Cos(theta) + inPos->Z()*TMath::Sin(theta)*TMath::Cos(phi);
438 zDet = -inPos->X()*TMath::Cos(theta)*TMath::Sin(phi) - inPos->Y()*TMath::Sin(theta) + inPos->Z()*TMath::Cos(theta)*TMath::Cos(phi);
440 if (inPos->X() > 0 && inPos->Y() < 0) {
441 xDet = inPos->X()*TMath::Cos(phi) + inPos->Z()*TMath::Sin(phi) - detZOrig*TMath::Sin(phi);
442 yDet = inPos->X()*TMath::Sin(theta)*TMath::Sin(phi) + inPos->Y()*TMath::Cos(theta) - inPos->Z()*TMath::Sin(theta)*TMath::Cos(phi);
443 zDet = -inPos->X()*TMath::Cos(theta)*TMath::Sin(phi) + inPos->Y()*TMath::Sin(theta) + inPos->Z()*TMath::Cos(theta)*TMath::Cos(phi);
445 if (inPos->X() < 0 && inPos->Y() < 0) {
446 xDet = inPos->X()*TMath::Cos(phi) - inPos->Z()*TMath::Sin(phi) + detZOrig*TMath::Sin(phi);
447 yDet = -inPos->X()*TMath::Sin(theta)*TMath::Sin(phi) + inPos->Y()*TMath::Cos(theta) - inPos->Z()*TMath::Sin(theta)*TMath::Cos(phi);
448 zDet = inPos->X()*TMath::Cos(theta)*TMath::Sin(phi) + inPos->Y()*TMath::Sin(theta) + inPos->Z()*TMath::Cos(theta)*TMath::Cos(phi);
450 if (inPos->X() < 0 && inPos->Y() > 0) {
451 xDet = inPos->X()*TMath::Cos(phi) - inPos->Z()*TMath::Sin(phi) + detZOrig*TMath::Sin(phi);
452 yDet = inPos->X()*TMath::Sin(theta)*TMath::Sin(phi) + inPos->Y()*TMath::Cos(theta) + inPos->Z()*TMath::Sin(theta)*TMath::Cos(phi);
453 zDet = inPos->X()*TMath::Cos(theta)*TMath::Sin(phi) - inPos->Y()*TMath::Sin(theta) + inPos->Z()*TMath::Cos(theta)*TMath::Cos(phi);
455 outPos->SetXYZ(xDet,yDet,zDet);
457 outPos->SetXYZ(inPos->X(), inPos->Y(), inPos->Z());
472 Bool_t hitMerged = kFALSE;
475 for (Int_t iHit = 0; iHit <
fNHits; iHit++) {
510 Double_t xHit = 0.0, yHit = 0.0;
516 Double_t
rand = gRandom->Rndm();
520 rand = gRandom->Rndm();
524 rand = gRandom->Rndm();
528 rand = gRandom->Rndm();
533 rand = gRandom->Rndm();
537 rand = gRandom->Rndm();
541 rand = gRandom->Rndm();
545 rand = gRandom->Rndm();
550 if (xHit != 0.0 && yHit != 0.0) {
551 Double_t zHit =
fDetZ;
552 TVector3 posHit(xHit,yHit,zHit);
556 AddHit(posHit, posHitErr, RichDetID, pmtID, ampl, pointInd);
568 Double_t& fLambdaMin,
569 Double_t& fLambdaMax,
570 Double_t& fLambdaStep,
571 Double_t fEfficiency[])
574 if (
fVerbose > 0) cout <<
"SetPhotoDetPar routine called for PMT type " <<
fDetType << endl;
584 fEfficiency[0] = 0.216;
585 fEfficiency[1] = 0.216;
586 fEfficiency[2] = 0.216;
587 fEfficiency[3] = 0.216;
588 fEfficiency[4] = 0.216;
589 fEfficiency[5] = 0.216;
590 fEfficiency[6] = 0.216;
591 fEfficiency[7] = 0.216;
592 fEfficiency[8] = 0.216;
593 fEfficiency[9] = 0.216;
594 fEfficiency[10] = 0.216;
595 fEfficiency[11] = 0.227;
596 fEfficiency[12] = 0.23;
597 fEfficiency[13] = 0.227;
598 fEfficiency[14] = 0.216;
599 fEfficiency[15] = 0.2;
600 fEfficiency[16] = 0.176;
601 fEfficiency[17] = 0.15;
602 fEfficiency[18] = 0.138;
603 fEfficiency[19] = 0.1;
604 fEfficiency[20] = 0.082;
605 fEfficiency[21] = 0.06;
606 fEfficiency[22] = 0.044;
607 fEfficiency[23] = 0.032;
608 fEfficiency[24] = 0.022;
609 fEfficiency[25] = 0.015;
610 fEfficiency[26] = 0.01;
611 fEfficiency[27] = 0.006;
612 fEfficiency[28] = 0.004;
648 }
else if (det_type == 3){
656 fEfficiency[0] = 0.45;
657 fEfficiency[1] = 0.4;
658 fEfficiency[2] = 0.35;
659 fEfficiency[3] = 0.32;
660 fEfficiency[4] = 0.25;
661 fEfficiency[5] = 0.2;
662 fEfficiency[6] = 0.1;
663 fEfficiency[7] = 0.03;
665 }
else if (det_type == 2){
674 fEfficiency[0] = 0.06;
675 fEfficiency[1] = 0.12;
676 fEfficiency[2] = 0.2;
677 fEfficiency[3] = 0.22;
678 fEfficiency[4] = 0.22;
679 fEfficiency[5] = 0.22;
680 fEfficiency[6] = 0.21;
681 fEfficiency[7] = 0.2;
682 fEfficiency[8] = 0.18;
683 fEfficiency[9] = 0.16;
684 fEfficiency[10] = 0.14;
685 fEfficiency[11] = 0.11;
686 fEfficiency[12] = 0.1;
687 fEfficiency[13] = 0.06;
688 fEfficiency[14] = 0.047;
689 fEfficiency[15] = 0.03;
690 fEfficiency[16] = 0.021;
691 fEfficiency[17] = 0.012;
692 fEfficiency[18] = 0.006;
693 fEfficiency[19] = 0.0023;
694 fEfficiency[20] = 0.0008;
695 fEfficiency[21] = 0.00022;
696 fEfficiency[22] = 0.00007;
697 fEfficiency[23] = 0.00002;
699 }
else if (det_type == 4){
708 fEfficiency[0] = 0.095;
709 fEfficiency[1] = 0.13;
710 fEfficiency[2] = 0.16;
711 fEfficiency[3] = 0.2;
712 fEfficiency[4] = 0.23;
713 fEfficiency[5] = 0.24;
714 fEfficiency[6] = 0.25;
715 fEfficiency[7] = 0.25;
716 fEfficiency[8] = 0.24;
717 fEfficiency[9] = 0.24;
718 fEfficiency[10] = 0.23;
719 fEfficiency[11] = 0.22;
720 fEfficiency[12] = 0.2;
721 fEfficiency[13] = 0.16;
722 fEfficiency[14] = 0.14;
723 fEfficiency[15] = 0.1;
724 fEfficiency[16] = 0.065;
725 fEfficiency[17] = 0.045;
726 fEfficiency[18] = 0.02;
727 fEfficiency[19] = 0.017;
728 fEfficiency[20] = 0.007;
729 fEfficiency[21] = 0.0033;
730 }
else if (det_type == 5){
739 fEfficiency[0] = 0.1;
740 fEfficiency[1] = 0.2;
741 fEfficiency[2] = 0.2;
742 fEfficiency[3] = 0.2;
743 fEfficiency[4] = 0.2;
744 fEfficiency[5] = 0.2;
745 fEfficiency[6] = 0.23;
746 fEfficiency[7] = 0.24;
747 fEfficiency[8] = 0.25;
748 fEfficiency[9] = 0.25;
749 fEfficiency[10] = 0.24;
750 fEfficiency[11] = 0.24;
751 fEfficiency[12] = 0.23;
752 fEfficiency[13] = 0.22;
753 fEfficiency[14] = 0.2;
754 fEfficiency[15] = 0.16;
755 fEfficiency[16] = 0.14;
756 fEfficiency[17] = 0.1;
757 fEfficiency[18] = 0.065;
758 fEfficiency[19] = 0.045;
759 fEfficiency[20] = 0.02;
760 fEfficiency[21] = 0.017;
761 fEfficiency[22] = 0.007;
762 fEfficiency[23] = 0.0033;
763 }
else if (det_type == 6) {
774 fEfficiency[0] = 0.0272;
775 fEfficiency[1] = 0.0443;
776 fEfficiency[2] = 0.06;
777 fEfficiency[3] = 0.08;
778 fEfficiency[4] = 0.0945;
779 fEfficiency[5] = 0.1061;
780 fEfficiency[6] = 0.1265;
781 fEfficiency[7] = 0.1482;
782 fEfficiency[8] = 0.1668;
783 fEfficiency[9] = 0.1887;
784 fEfficiency[10] = 0.2093;
785 fEfficiency[11] = 0.2134;
786 fEfficiency[12] = 0.2303;
787 fEfficiency[13] = 0.2482;
788 fEfficiency[14] = 0.2601;
789 fEfficiency[15] = 0.2659;
790 fEfficiency[16] = 0.2702;
791 fEfficiency[17] = 0.283;
792 fEfficiency[18] = 0.2863;
793 fEfficiency[19] = 0.2863;
794 fEfficiency[20] = 0.2884;
795 fEfficiency[21] = 0.286;
796 fEfficiency[22] = 0.2811;
797 fEfficiency[23] = 0.2802;
798 fEfficiency[24] = 0.272;
799 fEfficiency[25] = 0.2638;
800 fEfficiency[26] = 0.2562;
801 fEfficiency[27] = 0.2472;
802 fEfficiency[28] = 0.2368;
803 fEfficiency[29] = 0.2218;
804 fEfficiency[30] = 0.2032;
805 fEfficiency[31] = 0.186;
806 fEfficiency[32] = 0.1735;
807 fEfficiency[33] = 0.1661;
808 fEfficiency[34] = 0.1483;
809 fEfficiency[35] = 0.121;
810 fEfficiency[36] = 0.0959;
811 fEfficiency[37] = 0.0782;
812 fEfficiency[38] = 0.0647;
813 fEfficiency[39] = 0.0538;
814 fEfficiency[40] = 0.0372;
815 fEfficiency[41] = 0.0296;
816 fEfficiency[42] = 0.0237;
817 fEfficiency[43] = 0.0176;
818 fEfficiency[44] = 0.0123;
819 fEfficiency[45] = 0.0083;
820 fEfficiency[46] = 0.005;
821 fEfficiency[47] = 0.003;
822 fEfficiency[48] = 0.0017;
823 fEfficiency[49] = 0.0008;
824 fEfficiency[50] = 0.0006;
825 fEfficiency[51] = 0.0003;
826 fEfficiency[52] = 0.0003;
827 fEfficiency[53] = 0.0002;
828 fEfficiency[54] = 0.0001;
831 }
else if (det_type == 0){
841 cout <<
"ERROR: photodetector type not specified" << endl;
870 Double_t uPoint, vPoint;
872 Double_t
alpha = TMath::Pi()/6.;
890 distance = TMath::Sqrt((uPMT-uPoint)*(uPMT-uPoint)+(vPMT-vPoint)*(vPMT-vPoint)*TMath::Cos(alpha)*TMath::Cos(alpha));
902 if (yPoint<0.) pmtID = -1*pmtID;
932 Double_t uPoint, vPoint;
933 Double_t uPMT, vPMT, uPMTs, vPMTs;
941 xPoint = xPoint + gRandom->Gaus(0,sigma);
942 yPoint = yPoint + gRandom->Gaus(0,sigma);
960 if (uPoint < uPMT) cout <<
" -E- HitProducer: calculation of MAPMT unit (u) " << uPoint <<
" " << uPMT << endl;
961 if (vPoint < vPMT) cout <<
" -E- HitProducer: calculation of MAPMT unit (v) " << vPoint <<
" " << vPMT << endl;
972 pmtID = ((Int_t)(uPoint/length)*100 + (Int_t)((uPoint-uPMT)/
fPhotomulRadius))*100000
973 + ((Int_t)(vPoint/length)*100 + (Int_t)((vPoint-vPMT)/
fPhotomulRadius));
975 if (yPoint<0.) pmtID = -1*pmtID;
979 if (
fVerbose > 3) cout <<
"FindHitPos_MAPMT: " << xPoint <<
" " << yPoint <<
" " << xHit <<
" " << yHit << endl;
1006 Double_t uPoint, vPoint;
1007 Double_t uPMT, vPMT, uPMTs, vPMTs;
1026 if (uPoint < uPMT) cout <<
" -E- HitProducer: calculation of CsI unit (u) " << uPoint <<
" " << uPMT << endl;
1027 if (vPoint < vPMT) cout <<
" -E- HitProducer: calculation of CsI unit (v) " << vPoint <<
" " << vPMT << endl;
1038 pmtID = ((Int_t)(uPoint/xlength)*1000 + (Int_t)((uPoint-uPMT)/
fPhotomulRadius))*100000
1039 + ((Int_t)(vPoint/ylength)*1000 + (Int_t)((vPoint-vPMT)/
fPhotomulRadius));
1041 if (yPoint<0.) pmtID = -1*pmtID;
1050 const Float_t
kn=1.85;
1051 const Float_t kb=1.75;
1052 return TMath::Power(x*kb/kn,kn) * TMath::Exp(-(kb*x-kn));
1060 const Double_t xMin=0;
1061 const Double_t xMax=6;