18 #include "FairGeoInterface.h"
19 #include "FairGeoLoader.h"
20 #include "FairGeoRootBuilder.h"
21 #include "FairRootManager.h"
22 #include "FairVolume.h"
23 #include "FairGeoMedia.h"
25 #include "FairRuntimeDb.h"
26 #include "FairParIo.h"
29 #include "TObjArray.h"
30 #include "TClonesArray.h"
31 #include "TGeoMCGeometry.h"
32 #include "TGeoManager.h"
33 #include "TLorentzVector.h"
34 #include "TParticle.h"
35 #include "TVirtualMC.h"
37 #include "TGeoVoxelFinder.h"
38 #include "TGeoMatrix.h"
39 #include "TGeoCompositeShape.h"
41 #include "FairGeoMedium.h"
55 return (a>0 ? 1: a<0 ? -1 : 0);
60 fTrackID(0),fVolumeID(0),fEventID(-1),fPos(0,0,0,0),fMom(0,0,0,0),fTime(0),fLength(0),fELoss(0),fPosIndex(0),fEmcCollection(),
61 bIsFastFsc(kFALSE), fStoreData(kTRUE), fwendcap(kFALSE), bwendcap(kFALSE), fgeoName2(
""), fgeoName3(
""), fgeoName4(
""), MapperVersion(0)
71 FairDetector(name, active),
72 fTrackID(0),fVolumeID(0),fEventID(-1),fPos(0,0,0,0),fMom(0,0,0,0),fTime(0),fLength(0),fELoss(0),fPosIndex(0),fEmcCollection(),
73 bIsFastFsc(fast), fStoreData(storepnts), fwendcap(kFALSE), bwendcap(kFALSE), fgeoName2(
""), fgeoName3(
""), fgeoName4(
""), MapperVersion(0)
99 FairRun*
sim = FairRun::Instance();
100 FairRuntimeDb*
rtdb=sim->GetRuntimeDb();
103 par->setInputVersion(sim->GetRunId(),1);
161 if (gMC->IsNewTrack())
return kTRUE;
162 if (!gMC->IsTrackEntering() && !gMC->IsTrackExiting())
return kTRUE;
169 Int_t copyNoCrys, copyNoBox, copyNoSub, copyNoQuar, idCrys, idBox, idSub, idQuar, copyNo, id, nMod, nRow, nCrys;
170 copyNoCrys = copyNoBox = copyNoSub = copyNoQuar = idCrys = idBox = idSub = idQuar = copyNo =
id = nMod = nRow = nCrys = -1;
172 if (nam.Contains(
"Vol")){
174 TString namCrys = gMC->CurrentVolOffName(0);
175 TString namBox = gMC->CurrentVolOffName(1);
176 TString namSub = gMC->CurrentVolOffName(2);
177 TString namQuar = gMC->CurrentVolOffName(3);
179 if (namSub.Contains(
"SubunitVolFwEndCap")){
182 gMC->CurrentVolOffID(0,copyNoCrys);
183 gMC->CurrentVolOffID(1,copyNoBox);
184 gMC->CurrentVolOffID(2,copyNoSub);
186 Int_t SubunitRow = -100;
187 Int_t SubunitCol = -100;
188 Int_t CrystalCol = -100;
189 Int_t CrystalRow = -100;
190 Int_t RestOfHalfSubunitRowNo[6] = {5, 6, 7, 8, 9, 9};
191 Int_t RestOfHalfSubunitColNo[6] = {8, 7, 6, 5, 3, 2};
194 if (copyNoSub >= 1 && copyNoSub <= 10){
196 SubunitCol = (int) pow(-1.,1+(copyNoSub-1)/5)*(4+(copyNoSub-1)%5);
198 else if (copyNoSub > 11 && copyNoSub < 24){
199 SubunitRow = (int) pow(-1.,(copyNoSub-11)/7)*2;
200 SubunitCol = ((copyNoSub-11)%7)-3;
202 else if ((copyNoSub >= 25 && copyNoSub <= 27) || copyNoSub==57 || copyNoSub==58){
203 if (copyNoSub >= 25 && copyNoSub <= 27)
204 SubunitRow = copyNoSub - 25;
206 SubunitRow = copyNoSub - 59;
209 else if (copyNoSub >= 40 && copyNoSub <= 44){
210 SubunitRow = 42 - copyNoSub;
213 else if (copyNoSub == 28 || copyNoSub ==39 || copyNoSub == 45 || copyNoSub == 56) {
215 SubunitRow = RestOfHalfSubunitRowNo[0];
217 SubunitRow = -RestOfHalfSubunitRowNo[0];
218 SubunitCol = (int) pow(-1.,copyNoSub-1)*RestOfHalfSubunitColNo[0];
220 else if (copyNoSub == 29 || copyNoSub == 38 || copyNoSub == 46 || copyNoSub == 55) {
222 SubunitRow = RestOfHalfSubunitRowNo[1];
224 SubunitRow = -RestOfHalfSubunitRowNo[1];
225 SubunitCol = (int) pow(-1.,copyNoSub)*RestOfHalfSubunitColNo[1];
227 else if (copyNoSub == 30 || copyNoSub == 37 || copyNoSub == 47 || copyNoSub == 54) {
229 SubunitRow = RestOfHalfSubunitRowNo[2];
231 SubunitRow = -RestOfHalfSubunitRowNo[2];
232 SubunitCol = (int) pow(-1.,copyNoSub-1)*RestOfHalfSubunitColNo[2];
234 else if (copyNoSub == 31 || copyNoSub == 36 || copyNoSub == 48 || copyNoSub == 53) {
236 SubunitRow = RestOfHalfSubunitRowNo[3];
238 SubunitRow = -RestOfHalfSubunitRowNo[3];
239 SubunitCol = (int) pow(-1.,copyNoSub)*RestOfHalfSubunitColNo[3];
241 else if (copyNoSub == 32 || copyNoSub == 35 || copyNoSub == 49 || copyNoSub == 52) {
243 SubunitRow = RestOfHalfSubunitRowNo[4];
245 SubunitRow = -RestOfHalfSubunitRowNo[4];
246 SubunitCol = (int) pow(-1.,copyNoSub-1)*RestOfHalfSubunitColNo[4];
248 else if (copyNoSub == 33 || copyNoSub == 34 || copyNoSub == 50 || copyNoSub == 51) {
250 SubunitRow = RestOfHalfSubunitRowNo[5];
252 SubunitRow = -RestOfHalfSubunitRowNo[5];
253 SubunitCol = (int) pow(-1.,copyNoSub)*RestOfHalfSubunitColNo[5];
255 else if (copyNoSub >= 61 && copyNoSub <= 74){
256 SubunitRow = (int) pow(-1.,(copyNoSub-61)/7)*((copyNoSub - 61)%7 + 3);
259 else if (copyNoSub%100 >= 1 && copyNoSub%100 <= 5){
260 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
262 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(3 + copyNoSub%100);
266 SubunitCol = (int) pow(-1.,copyNoSub/100)*(3 + copyNoSub%100);
269 else if (copyNoSub%100 >= 6 && copyNoSub%100 <= 11){
270 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
272 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(2 + copyNoSub%100 - 5);
276 SubunitCol = (int) pow(-1.,copyNoSub/100)*(2 + copyNoSub%100 - 5);
279 else if (copyNoSub%100 >= 12 && copyNoSub%100 <= 19){
280 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
282 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(copyNoSub%100 - 11);
286 SubunitCol = (int) pow(-1.,copyNoSub/100)*(copyNoSub%100 - 11);
289 else if (copyNoSub%100 >= 20 && copyNoSub%100 <= 27){
290 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
292 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(copyNoSub%100 - 19);
296 SubunitCol = (int) pow(-1.,copyNoSub/100)*(copyNoSub%100 - 19);
299 else if (copyNoSub%100 >= 28 && copyNoSub%100 <= 34){
300 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
302 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(copyNoSub%100 - 27);
306 SubunitCol = (int) pow(-1.,copyNoSub/100)*(copyNoSub%100 - 27);
309 else if (copyNoSub%100 >= 35 && copyNoSub%100 <= 40){
310 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
312 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(copyNoSub%100 - 34);
316 SubunitCol = (int) pow(-1.,copyNoSub/100)*(copyNoSub%100 - 34);
319 else if (copyNoSub%100 >= 41 && copyNoSub%100 <= 45){
320 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
322 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(copyNoSub%100 - 40);
326 SubunitCol = (int) pow(-1.,copyNoSub/100)*(copyNoSub%100 - 40);
329 else if (copyNoSub%100 >= 46 && copyNoSub%100 <= 49){
330 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
332 SubunitCol = (int) pow(-1.,1+copyNoSub/100)*(copyNoSub%100 - 45);
336 SubunitCol = (int) pow(-1.,copyNoSub/100)*(copyNoSub%100 - 45);
339 else if (copyNoSub%100 == 50 ){
340 if (copyNoSub/100 == 1 || copyNoSub/100 == 4){
342 SubunitCol = (int) pow(-1.,1+copyNoSub/100);
346 SubunitCol = (int) pow(-1.,copyNoSub/100);
351 if (std::abs(SubunitRow)<=1 && std::abs(SubunitCol)<=3) flag=0;
352 else if (std::abs(SubunitCol)==9 && std::abs(SubunitRow)>=3) flag=0;
353 else if (std::abs(SubunitCol)==8 && std::abs(SubunitRow)>=6) flag=0;
354 else if (std::abs(SubunitCol)==7 && std::abs(SubunitRow)>=7) flag=0;
355 else if (std::abs(SubunitCol)==6 && std::abs(SubunitRow)>=8) flag=0;
356 else if (std::abs(SubunitCol)>=4 && std::abs(SubunitRow)==9) flag=0;
359 if (flag && copyNoSub >= 61){
360 if(copyNoBox==1 || copyNoBox==4){
361 if(copyNoCrys==1 || copyNoCrys==3)
362 CrystalRow = SubunitRow*4 + (3-
getsign(SubunitRow))/2;
364 CrystalRow = SubunitRow*4 + (1-
getsign(SubunitRow))/2;
366 else if(copyNoBox==2 || copyNoBox==3){
367 if(copyNoCrys==1 || copyNoCrys==3)
368 CrystalRow = SubunitRow*4 - (1+
getsign(SubunitRow))/2;
370 CrystalRow = SubunitRow*4 - (3+
getsign(SubunitRow))/2;
373 if (copyNoSub >= 61 && copyNoSub <= 74) {
374 if(copyNoBox==1 || copyNoBox==3){
375 if(copyNoCrys==1 || copyNoCrys==4)
380 else if(copyNoBox==4 || copyNoBox==2){
381 if(copyNoCrys==1 || copyNoCrys==4)
388 if(copyNoBox==1 || copyNoBox==3){
389 if(copyNoCrys==1 || copyNoCrys==4)
390 CrystalCol = SubunitCol*4 + (3+
getsign(SubunitCol))/2;
392 CrystalCol = SubunitCol*4 + (1+
getsign(SubunitCol))/2;
394 else if(copyNoBox==4 || copyNoBox==2){
395 if(copyNoCrys==1 || copyNoCrys==4)
396 CrystalCol = SubunitCol*4 - (1-
getsign(SubunitCol))/2;
398 CrystalCol = SubunitCol*4 - (3-
getsign(SubunitCol))/2;
403 else if (flag && copyNoSub <= 10) {
404 if(copyNoCrys==1 || copyNoCrys==3)
410 if(copyNoCrys==1 || copyNoCrys==4)
411 CrystalCol = SubunitCol*4 + (3+
getsign(SubunitCol))/2;
413 CrystalCol = SubunitCol*4 + (1+
getsign(SubunitCol))/2;
416 if(copyNoCrys==1 || copyNoCrys==4)
417 CrystalCol = SubunitCol*4 - (1-
getsign(SubunitCol))/2;
419 CrystalCol = SubunitCol*4 - (3-
getsign(SubunitCol))/2;
422 else if (flag && copyNoSub > 11 && copyNoSub < 24) {
423 if(copyNoCrys==1 || copyNoCrys==3)
424 CrystalRow = (1+17*
getsign(SubunitRow))/2;
426 CrystalRow = (17*
getsign(SubunitRow)-1)/2;
428 if (SubunitCol == 0 && copyNoBox==1) {
429 if(copyNoCrys==1 || copyNoCrys==4)
434 else if (SubunitCol == 0) {
435 if (copyNoCrys==1 || copyNoCrys==4)
440 else if(copyNoBox==1){
441 if(copyNoCrys==1 || copyNoCrys==4)
442 CrystalCol = SubunitCol*4 + (3+
getsign(SubunitCol))/2;
444 CrystalCol = SubunitCol*4 + (1+
getsign(SubunitCol))/2;
447 if(copyNoCrys==1 || copyNoCrys==4)
448 CrystalCol = SubunitCol*4 - (1-
getsign(SubunitCol))/2;
450 CrystalCol = SubunitCol*4 - (3-
getsign(SubunitCol))/2;
453 else if (flag && ((copyNoSub >= 25 && copyNoSub <= 27) || copyNoSub == 57 || copyNoSub == 58 || (copyNoSub >= 40 && copyNoSub <= 44))) {
454 if(copyNoBox==1 && (copyNoCrys==1 || copyNoCrys==4))
455 if (copyNoSub == 25 || copyNoSub == 42)
458 CrystalRow = SubunitRow*4 + (3+
getsign(SubunitRow))/2;
459 else if (copyNoBox==1)
460 if (copyNoSub == 25 || copyNoSub == 42)
463 CrystalRow = SubunitRow*4 + (1+
getsign(SubunitRow))/2;
465 else if (copyNoBox==2 && (copyNoCrys==1 || copyNoCrys==4))
466 if (copyNoSub == 25 || copyNoSub == 42)
469 CrystalRow = SubunitRow*4 - (1-
getsign(SubunitRow))/2;
470 else if (copyNoBox==2)
471 if (copyNoSub == 25 || copyNoSub == 42)
474 CrystalRow = SubunitRow*4 - (3-
getsign(SubunitRow))/2;
476 if (copyNoCrys==1 || copyNoCrys==3)
477 if (!(copyNoSub >= 40 && copyNoSub <= 44))
482 if (!(copyNoSub >= 40 && copyNoSub <= 44))
487 else if (flag && (copyNoSub == 28 || copyNoSub ==29 || copyNoSub == 38 || copyNoSub == 39 || copyNoSub == 45 || copyNoSub == 46 || copyNoSub == 55 || copyNoSub == 56)) {
488 if (copyNoBox==1 && (copyNoCrys==1 || copyNoCrys==4))
489 CrystalRow = SubunitRow*4 + (3-
getsign(SubunitRow))/2;
490 else if (copyNoBox==1)
491 CrystalRow = SubunitRow*4 + (1-
getsign(SubunitRow))/2;
492 else if(copyNoCrys==1 || copyNoCrys==4)
493 CrystalRow = SubunitRow*4 - (1+
getsign(SubunitRow))/2;
495 CrystalRow = SubunitRow*4 - (3+
getsign(SubunitRow))/2;
497 if (copyNoCrys==4 || copyNoCrys==2)
498 CrystalCol = SubunitCol*4 + (1-
getsign(SubunitCol))/2;
500 CrystalCol = SubunitCol*4 - (1+
getsign(SubunitCol))/2;
502 else if (flag && ((copyNoSub >= 30 && copyNoSub <= 37) || (copyNoSub >=47 && copyNoSub <= 54))) {
503 if (copyNoCrys==1 || copyNoCrys==3)
504 CrystalRow = SubunitRow*4 + (1-3*
getsign(SubunitRow))/2;
506 CrystalRow = SubunitRow*4 - (1+3*
getsign(SubunitRow))/2;
508 if (copyNoBox==1 && (copyNoCrys==1 || copyNoCrys==4))
509 CrystalCol = SubunitCol*4 + (3+
getsign(SubunitCol))/2;
510 else if (copyNoBox==1)
511 CrystalCol = SubunitCol*4 + (1+
getsign(SubunitCol))/2;
512 else if (copyNoCrys==1 || copyNoCrys==4)
513 CrystalCol = SubunitCol*4 - (1-
getsign(SubunitCol))/2;
515 CrystalCol = SubunitCol*4 - (3-
getsign(SubunitCol))/2;
518 if (CrystalRow == -100 || CrystalCol == -100)
519 std::cout <<
"No assignment for CrystalRow and CrystalCol\n";
523 nRow = CrystalRow + 37;
524 nCrys = CrystalCol + 36;
544 else if (namQuar.Contains(
"Quarter4Vol")){
549 idCrys = gMC->CurrentVolOffID(0,copyNoCrys);
550 idBox = gMC->CurrentVolOffID(1,copyNoBox);
551 idSub = gMC->CurrentVolOffID(2,copyNoSub)-1;
552 idQuar = gMC->CurrentVolOffID(3,copyNoQuar);
562 if((copyNoSub >= 0) && (copyNoSub <= 3)){
565 }
else if((copyNoSub >= 4) && (copyNoSub <= 7)){
566 next = (copyNoSub-4);
568 }
else if((copyNoSub >= 8) && (copyNoSub <= 10)){
569 next = (copyNoSub-8);
571 }
else if((copyNoSub >= 11) && (copyNoSub <= 12)){
572 next = (copyNoSub-11);
580 if (next>1 && col>2) flag4=0;
581 if (next>2 && col>1) flag4=0;
584 if ( (copyNoBox == 0) || (copyNoBox == 3) ){
585 if(copyNoCrys == 1 || copyNoCrys == 3){
587 }
else if (copyNoCrys == 0 || copyNoCrys == 2){
590 }
else if ( (copyNoBox == 1) || (copyNoBox == 2) ){
591 if(copyNoCrys == 0 || copyNoCrys == 2){
593 }
else if (copyNoCrys == 1 || copyNoCrys == 3){
597 if ( (copyNoBox == 0) || (copyNoBox == 2) ){
598 if(copyNoCrys == 0 || copyNoCrys == 3){
599 nRow = subrow*col + 4;
600 }
else if (copyNoCrys == 1 || copyNoCrys == 2){
601 nRow = subrow*col + 3;
603 }
else if ( (copyNoBox == 1) || (copyNoBox == 3) ){
604 if(copyNoCrys == 0 || copyNoCrys == 3){
605 nRow = subrow*col + 2;
606 }
else if (copyNoCrys == 1 || copyNoCrys == 2){
607 nRow = subrow*col + 1;
614 else if (namQuar.Contains(
"QuarterNewVol")){
621 idCrys = gMC->CurrentVolOffID(0,copyNoCrys);
622 idBox = gMC->CurrentVolOffID(1,copyNoBox);
623 idSub = gMC->CurrentVolOffID(2,copyNoSub)-1;
624 idQuar = gMC->CurrentVolOffID(3,copyNoQuar);
633 if((copyNoSub >= 0) && (copyNoSub <= 2)){
636 }
else if((copyNoSub >= 3) && (copyNoSub <= 6)){
637 next = (copyNoSub-3);
639 }
else if((copyNoSub >= 7) && (copyNoSub <= 10)){
640 next = (copyNoSub-7);
642 }
else if((copyNoSub >= 11) && (copyNoSub <= 13)){
643 next = (copyNoSub-11);
651 if (next==3 && col==3) flag4=0;
652 if (next==0 && col==0) flag4=0;
655 if ( (copyNoBox == 0) || (copyNoBox == 3) ){
656 if(copyNoCrys == 1 || copyNoCrys == 3){
658 }
else if (copyNoCrys == 0 || copyNoCrys == 2){
661 }
else if ( (copyNoBox == 1) || (copyNoBox == 2) ){
662 if(copyNoCrys == 0 || copyNoCrys == 2){
664 }
else if (copyNoCrys == 1 || copyNoCrys == 3){
668 if ( (copyNoBox == 0) || (copyNoBox == 2) ){
669 if(copyNoCrys == 0 || copyNoCrys == 3){
671 }
else if (copyNoCrys == 1 || copyNoCrys == 2){
674 }
else if ( (copyNoBox == 1) || (copyNoBox == 3) ){
675 if(copyNoCrys == 0 || copyNoCrys == 3){
677 }
else if (copyNoCrys == 1 || copyNoCrys == 2){
690 if (nam.Contains(
"PWOCrystal") &&
691 TString(gMC->CurrentVolOffName(2)).Contains(
"BWECquarter") ){
693 idCrys = gMC->CurrentVolOffID(0,nCrys);
694 idSub = gMC->CurrentVolOffID(1,nRow);
695 idQuar = gMC->CurrentVolOffID(2,copyNo);
704 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
708 fTime = gMC->TrackTime();
709 gMC->TrackPosition(
fPos);
710 gMC->TrackMomentum(
fMom);
712 if(nam.Contains(
"CrystalType6")){
715 TString namCrystal = gMC->CurrentVolOffName(1);
724 gMC->CurrentVolOffID(1,nCrys);
726 nCrys = (nCrys-1) % 5;
728 if(namCrystal.Contains(
"CrystalType6a")){
730 }
else if(namCrystal.Contains(
"CrystalType6b")){
737 if (nam.BeginsWith(
"Crystal-")) {
738 int iAlveole, iCrystal;
740 sscanf(nam,
"Crystal-%d%c-%c%d", &iAlveole, &sign, &type, &iCrystal);
743 if (sign ==
'p') nMod = 1;
744 else if (sign ==
'm') nMod = 2;
745 else std::cout <<
"Error!!!" << std::endl;
748 nRow = (iAlveole - 1) * 4 + iCrystal;
751 gMC->CurrentVolOffID(3, copyNo);
755 gMC->CurrentVolOffID(0, iPhi);
757 if (type ==
'L') nCrys = (iPhi - 1) * 2 + 1;
758 if (type ==
'R') nCrys = (iPhi - 1) * 2 + 2;
760 else if (nMod == 2) {
761 if (type ==
'R') nCrys = (iPhi - 1) * 2 + 1;
762 if (type ==
'L') nCrys = (iPhi - 1) * 2 + 2;
765 std::cout <<
"Error!!!" << std::endl;
769 if (nam.BeginsWith(
"emc"))
772 sscanf(nam,
"emc%dr%dc%d", &nMod, &nRow, &nCrys);
775 if ((nMod==1) || (nMod==2))
776 id = gMC->CurrentVolOffID(2,copyNo);
777 if ((nMod==3) || (nMod==4)|| (nMod==6))
778 id = gMC->CurrentVolOffID(1,copyNo);
786 nRow = abs((Int_t)(
fPos.X()/11.))+1;
787 nCrys = abs((Int_t)(
fPos.Y()/11.))+1;
788 if ((
fPos.X()<0.) && (
fPos.Y()>0.)) copyNo = 1;
789 if ((
fPos.X()<0.) && (
fPos.Y()<0.)) copyNo = 2;
790 if ((
fPos.X()>0.) && (
fPos.Y()<0.)) copyNo = 3;
791 if ((
fPos.X()>0.) && (
fPos.Y()>0.)) copyNo = 4;
803 if (nam.Contains(
"FscSciVolume")){
804 gMC->CurrentVolOffID(4,SupModCopy);
806 nSupCol = SupModCopy/100;
807 nSupRow = SupModCopy%100;
809 gMC->CurrentVolOffID(2,LocCopy);
813 nCrys = (nSupCol - 1)*2 + nModCol + 1;
814 nRow = (nSupRow - 1)*2 + nModRow + 1;
826 else if (nam.Contains(
"FscFiberVolume")){
828 gMC->CurrentVolOffID(4,SupModCopy);
830 nSupCol = SupModCopy/100;
831 nSupRow = SupModCopy%100;
833 gMC->CurrentVolOffID(2,LocCopy);
837 nCrys = (nSupCol - 1)*2 + nModCol + 1;
838 nRow = (nSupRow - 1)*2 + nModRow + 1;
841 gMC->CurrentVolOffID(1,copyNo);
849 nam = gMC->CurrentVolOffName(2);
850 sscanf(nam,
"emc%dr%dc%d", &nMod, &nRow, &nCrys);
852 id = gMC->CurrentVolOffID(3,copyNo);
856 fVolumeID = nMod*100000000 + nRow*1000000 + copyNo*10000 + nCrys;
860 std::cout<<
"Negative element index in EMC, name="<<nam<<std::endl;
869 fTime,
fLength,
fELoss, nMod, nRow, nCrys, copyNo, gMC->IsTrackEntering() && !gMC->IsNewTrack(), gMC->IsTrackExiting());
896 if (fVerboseLevel)
Print();
951 Int_t nEntries = cl1->GetEntriesFast();
953 TClonesArray& clref = *cl2;
955 for (Int_t
i=0;
i<nEntries;
i++) {
957 Int_t index = oldpoint->GetTrackID() +
offset;
1069 SetGeometryFileNameQuadruple(
"emc_module12.dat",
"emc_module3_2012_new.root",
"emc_module4_StraightGeo24.4.root",
"emc_mechanics_and_module5_fsc.root");
1085 FairRun *
fRun = FairRun::Instance();
1086 FairRuntimeDb *
rtdb= fRun->GetRuntimeDb();
1102 TString work = getenv(
"VMCWORKDIR");
1104 if (fwbwchoice==0) {
1108 cout <<
"---> _new_ Forward End-Cap has been used: "<<
fgeoName2<< endl;
1113 cout <<
"---> _new_ Backward End-Cap has been used: "<<
fgeoName3<< endl;
1126 TString work = getenv(
"VMCWORKDIR");
1147 TString work = getenv(
"VMCWORKDIR");
1165 TString fileName=GetGeometryFileName();
1171 if (fileName.EndsWith(
".dat")) {
1172 std::cout<<
" " <<std::endl;
1173 std::cout<<
" ====== EMC:: ConstructASCIIGeometry() ====== " <<std::endl;
1174 std::cout<<
" ============================================= " <<std::endl;
1176 }
else if(fileName.EndsWith(
"new.root") || fileName.EndsWith(
"proto60.root") || fileName.EndsWith(
"proto192.root")) {
1177 std::cout<<
" " <<std::endl;
1178 std::cout<<
" ====== EMC:: ConstructROOTGeometry() m3 === " <<std::endl;
1179 std::cout<<
" ============================================ " <<std::endl;
1181 }
else if(fileName.EndsWith(
"4_FwEndCapGeo.root") || fileName.EndsWith(
"4_StraightGeo26.root") || fgeoName.EndsWith(
"4_StraightGeo26_Al.root") || fileName.EndsWith(
"4_StraightGeo24.4.root") || fileName.EndsWith(
"4_StraightGeo24.4_Al2.root") || fileName.EndsWith(
"4_2017.root")) {
1182 std::cout<<
" " <<std::endl;
1183 std::cout<<
" ====== EMC:: ConstructROOTGeometry() m4 === " <<std::endl;
1184 std::cout<<
" ============================================ " <<std::endl;
1186 }
else if(fileName.EndsWith(
"5_fsc.root")) {
1187 std::cout<<
" " <<std::endl;
1188 std::cout<<
" ====== EMC:: ConstructROOTGeometry() m5 === " <<std::endl;
1189 std::cout<<
" ============================================ " <<std::endl;
1192 std::cout<<
"Geometry format not supported " <<std::endl;
1195 if (fileName.EndsWith(
".dat")) {
1196 std::cout<<
" " <<std::endl;
1197 std::cout<<
" ====== EMC 2):: ConstructASCIIGeometry() === " <<std::endl;
1198 std::cout<<
" ============================================= " <<std::endl;
1200 }
else if(fileName.EndsWith(
"2018v1.root")) {
1201 std::cout<<
" " <<std::endl;
1202 std::cout<<
" ====== EMC 2):: ConstructROOTGeometry() === " <<std::endl;
1203 std::cout<<
" ============================================= " <<std::endl;
1207 std::cout<<
"You do not provide an ASCII file " <<std::endl;
1210 Bool_t bEmc3=kFALSE, bEmc4=kFALSE, bEmc5=kFALSE;
1212 std::cout<<
" " <<std::endl;
1213 std::cout<<
" ====== EMC:: ConstructRootGeometry() m3a === " <<std::endl;
1214 std::cout<<
" ============================================= " <<std::endl;
1218 if(
fgeoName3.EndsWith(
"4_FwEndCapGeo.root") ||
fgeoName3.EndsWith(
"4_StraightGeo26.root") ||
fgeoName3.EndsWith(
"4_StraightGeo26_Al.root") ||
fgeoName3.EndsWith(
"4_StraightGeo24.4.root") ||
fgeoName3.EndsWith(
"4_StraightGeo24.4_Al2.root") ||
fgeoName3.EndsWith(
"4_2017.root") ) {
1219 std::cout<<
" " <<std::endl;
1220 std::cout<<
" ====== EMC:: ConstructRootGeometry() m4a === " <<std::endl;
1221 std::cout<<
" ============================================= " <<std::endl;
1222 std::cout<<
"fgeoName3:: "<<
fgeoName3 <<std::endl;
1227 std::cout<<
" " <<std::endl;
1228 std::cout<<
" ====== EMC:: ConstructRootGeometry() m5a === " <<std::endl;
1229 std::cout<<
" ============================================= " <<std::endl;
1230 std::cout<<
"fgeoName4:: "<<
fgeoName4 <<std::endl;
1234 if(!bEmc3 && !bEmc4 && !bEmc5 ) {
1235 std::cout<<
"You do not provide a ROOT file " <<std::endl;
1245 std::cout<<
"File name = " << GetGeometryFileName().Data() << std::endl;
1246 filename = GetGeometryFileName();
1248 std::cout<<
"File name = " <<
fgeoName2 << std::endl;
1251 f =
new TFile(filename);
1254 TGeoCombiTrans *TransRotMatrix;
1255 if(filename.EndsWith(
"proto60.root")){
1257 f->GetObject(
"Proto60",Volume);
1258 TransRotMatrix =
new TGeoCombiTrans(0.,0.,0.,
new TGeoRotation());
1260 Volume=(TGeoVolume *)f->Get(
"Emc3");
1261 TGeoRotation rotVolume;
1262 rotVolume.RotateY(180.);
1263 if(filename.Contains(
"proto")){
1264 rotVolume.RotateY(-6.51324892093148211e0);
1265 rotVolume.RotateX(5.15340666154607074e0);
1266 TransRotMatrix =
new TGeoCombiTrans(-3.66092554252584108e+01, -2.84174235113817986e+01, 1.02907349180644744e+02,
new TGeoRotation(rotVolume));
1270 TransRotMatrix =
new TGeoCombiTrans(0., 0., 213.9,
new TGeoRotation(rotVolume));
1274 printf(
"Could not get geometry from file %s!.\nIs this the right file?\n",filename.Data());
1278 TGeoNode *
n=Volume->GetNode(0);
1281 TGeoVoxelFinder *voxels = Volume->GetVoxels();
1282 if (voxels) voxels->SetNeedRebuild();
1283 TGeoMatrix *M = n->GetMatrix();
1284 M->SetDefaultName();
1290 Cave->AddNode(Volume,0, TransRotMatrix);
1298 TFile *
f =
new TFile(GetGeometryFileName());
1299 std::cout<<
"File name = " << GetGeometryFileName().Data() << std::endl;
1301 Volume=(TGeoVolume *)f->Get(
"BarrelEMC");
1303 TGeoVoxelFinder *voxels = Volume->GetVoxels();
1304 if (voxels) voxels->SetNeedRebuild();
1308 TGeoNode *
n=Volume->GetNode(0);
1309 TGeoMatrix *M = n->GetMatrix();
1310 M->SetDefaultName();
1316 TGeoCombiTrans* TransRotMatrix =
new TGeoCombiTrans(0.,0.,0.,
new TGeoRotation());
1317 Cave->AddNode(Volume,0, TransRotMatrix);
1326 std::cout<<
"File name Bw = " << GetGeometryFileName().Data() << std::endl;
1327 fb=
new TFile(GetGeometryFileName().Data());
1329 std::cout<<
"File name Bw1= " <<
fgeoName3 << std::endl;
1333 TGeoVolume *BwEmc=(TGeoVolume *)fb->Get(
"Emc4");
1335 TGeoNode *
n=BwEmc->GetNode(0);
1340 TGeoVoxelFinder *voxels = BwEmc->GetVoxels();
1341 if (voxels) voxels->SetNeedRebuild();
1342 TGeoMatrix *M = n->GetMatrix();
1343 M->SetDefaultName();
1348 TGeoRotation rotBwEmc;
1349 rotBwEmc.RotateY(0.);
1361 static const Double_t distTargetBWEC = 56.0;
1363 TGeoNode *outerVol=BwEmc->FindNode(
"BWECouterVol_0");
1364 if(outerVol != NULL){
1366 TGeoCompositeShape*
shape=(TGeoCompositeShape*)outerVol->GetVolume()->GetShape();
1367 Double_t origin[3]={0,0,0}, zdir[3]={0,0,1};
1368 Double_t halfLength = shape->DistFromInside(origin,zdir);
1369 Double_t bwEmcZpos = - (distTargetBWEC + halfLength);
1370 printf(
"PndEmc::ConstructRootGeomMod4: halfLength = %e, fullLength = %e, z-pos = %e, distTargetBWEC = %e\n",
1371 halfLength,2.*halfLength,bwEmcZpos,distTargetBWEC);
1372 Cave->AddNode(BwEmc,0,
new TGeoCombiTrans(0., 0., bwEmcZpos,
new TGeoRotation(rotBwEmc)));
1375 Cave->AddNode(BwEmc,0,
new TGeoCombiTrans(0., 0., -69.4,
new TGeoRotation(rotBwEmc)));
1386 if(FileName.EndsWith(
"5_fsc.root"))
1387 fb=
new TFile(FileName);
1388 else if(
fgeoName4.EndsWith(
"5_fsc.root")){
1393 std::cout<<
"File name Fsc= " << FileName << std::endl;
1398 TGeoVolume *Fsc=(TGeoVolume *)fb->Get(
"Emc5");
1400 TGeoNode *
n=Fsc->GetNode(0);
1401 if(fVerboseLevel>2) cout <<
"=====PndEmc::ConstructRootGeomMod5()====="<<endl;
1402 if(fVerboseLevel>2)Cave->Print();
1403 if(fVerboseLevel>2)Cave->PrintNodes();
1405 if(fVerboseLevel>2)Fsc->Print();
1406 if(fVerboseLevel>2)Fsc->PrintNodes();
1409 TGeoVoxelFinder *voxels = Fsc->GetVoxels();
1410 if (voxels) voxels->SetNeedRebuild();
1411 TGeoMatrix *M = n->GetMatrix();
1412 M->SetDefaultName();
1417 TGeoRotation rotFsc;
1418 Cave->AddNode(Fsc,0,
new TGeoCombiTrans(0., 0., 818.775,
new TGeoRotation(rotFsc)));
1426 FairGeoLoader*
geoLoad = FairGeoLoader::Instance();
1427 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
1428 FairGeoMedia *
Media = geoFace->getMedia();
1429 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
1431 TObjArray *nodeList=fVol->GetNodes();
1432 Int_t nodes = nodeList->GetEntries();
1434 for (Int_t nod=0; nod < nodes; nod++){
1436 TGeoNode *fNode =(TGeoNode *)nodeList->At(nod);
1437 TGeoVolume *
v= fNode->GetVolume();
1439 if(fNode->GetNdaughters()>0)
1442 TGeoMedium* med1=v->GetMedium();
1446 TGeoMaterial*mat1=v->GetMaterial();
1447 TGeoMaterial *newMat =
gGeoManager->GetMaterial(mat1->GetName());
1450 FairGeoMedium *CbmMedium=Media->getMedium(mat1->GetName());
1453 CbmMedium=
new FairGeoMedium(mat1->GetName());
1454 Media->addMedium(CbmMedium);
1457 Int_t
nmed=geobuild->createMedium(CbmMedium);
1463 TGeoMedium *med2=
gGeoManager->GetMedium(mat1->GetName());
1471 v->RegisterYourself();
1472 if(fVerboseLevel>2) std::cout<<
"Volume -> " <<v->GetName()<<
" --> Registered to gGeoManager" << endl;
1473 if (name.Contains(
"Crystal") || name.Contains(
"FscSci") || name.Contains(
"FscFiber")){
1474 AddSensitiveVolume(v);
1475 if(fVerboseLevel>2) std::cout<<
"Volume " <<v->GetName()<<
" is added to sensitives "<<endl;
1484 FairGeoLoader*
geoLoad = FairGeoLoader::Instance();
1485 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
1486 FairGeoMedia *
Media = geoFace->getMedia();
1487 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
1489 FairGeoMedium *CbmMediumPb = Media->getMedium(
"lead");
1491 FairGeoMedium *CbmMediumFsc = Media->getMedium(
"FscScint");
1494 geobuild->createMedium(CbmMediumPb);
1496 geobuild->createMedium(CbmMediumPWO);
1498 geobuild->createMedium(CbmMediumFsc);
1500 TGeoVolume *flayer1 =
new TGeoVolumeAssembly(
"EmcLayer1");
1501 TGeoVolume *flayer2 =
new TGeoVolumeAssembly(
"EmcLayer2");
1502 TGeoVolume *flayer2Hole =
new TGeoVolumeAssembly(
"EmcLayer2Hole");
1503 TGeoVolume *flayer3 =
new TGeoVolumeAssembly(
"Emc3");
1504 TGeoVolume *flayer4 =
new TGeoVolumeAssembly(
"Emc4");
1505 TGeoVolume *flayer5 =
new TGeoVolumeAssembly(
"Fsc");
1506 TGeoVolume *flayer6 =
new TGeoVolumeAssembly(
"EmcTest");
1508 Bool_t bIsModuleOn[6] = {kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,kFALSE};
1513 cout <<
"Emc module = " << module;
1515 cout <<
"\t FAST" << endl <<
"******** " << endl;
1518 cout << endl <<
"******** " << endl;
1524 sprintf(buffer,
"emc0%dr%dc%d",module,
row, crystal);
1527 if (data.
module==-1)
continue;
1529 if ((module<5) || (module==6) )
1531 TGeoTrap *trap =
new TGeoTrap(data.
pDz/10., data.
pTheta, data.
pPhi,
1535 volume =
new TGeoVolume(buffer, trap,
gGeoManager->GetMedium(
"PWO"));
1537 volume->SetLineColor(5);
1539 rot.RotateZ(data.
tau);
1540 rot.RotateY(data.
theta);
1541 rot.RotateZ(data.
phi);
1543 if(module ==1) flayer1->AddNode(volume,0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.+3.7,
new TGeoRotation (rot)));
1544 if(module ==2) flayer2->AddNode(volume,0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.+3.7,
new TGeoRotation (rot)));
1546 !((crystal>=4 && crystal<=6) && (
row<=3))
1548 flayer2Hole->AddNode(volume,0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.+3.7,
new TGeoRotation (rot)));
1549 if(module ==3) flayer3->AddNode(volume,0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.,
new TGeoRotation (rot)));
1550 if(module ==4) flayer4->AddNode(volume,0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.,
new TGeoRotation (rot)));
1551 if(module ==6) flayer6->AddNode(volume,0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.,
new TGeoRotation (rot)));
1552 bIsModuleOn[module-1] = kTRUE;
1553 AddSensitiveVolume(volume);
1564 TGeoVolume *volAbs, *volSci, *volCrystal;
1568 TGeoBBox *volume =
new TGeoBBox(data.
pDx1/10., data.
pDy1/10., BoxZ );
1569 volCrystal =
new TGeoVolume(buffer, volume,
gGeoManager->GetMedium(
"air"));
1570 volCrystal->SetLineColor(3);
1573 TGeoBBox *absorber =
new TGeoBBox(data.
pDx1/10., data.
pDy1/10., data.
pAlp1/10.);
1574 TGeoBBox *scintillator =
new TGeoBBox(data.
pDx2/10., data.
pDy2/10., data.
pAlp2/10.);
1575 volAbs =
new TGeoVolume(
"FscAbsorber", absorber,
gGeoManager->GetMedium(
"lead"));
1576 volSci =
new TGeoVolume(
"FscScintillator", scintillator,
gGeoManager->GetMedium(
"FscScint"));
1577 volSci->SetLineColor(6);
1579 TGeoVolume *ffsclay =
new TGeoVolumeAssembly(
"FscLayer");
1580 ffsclay->AddNode(volAbs, 0,
new TGeoCombiTrans(0., 0., data.
pAlp1/10.,
new TGeoRotation (rot)));
1581 ffsclay->AddNode(volSci, 0,
new TGeoCombiTrans(0., 0., 2*data.
pAlp1/10+data.
pDz/10.+data.
pAlp2/10.,
new TGeoRotation (rot)));
1582 AddSensitiveVolume(volSci);
1584 for (Int_t ll=0; ll<data.
pDx3; ll++) {
1585 volCrystal->AddNode(ffsclay,ll,
new TGeoCombiTrans(0., 0., ll*(2.*data.
pDz+2.*data.
pAlp1+2.*data.
pAlp2)/10.-BoxZ,
new TGeoRotation (rot)));
1588 flayer5->AddNode(volCrystal, 0,
new TGeoCombiTrans(data.
posX/10., data.
posY/10., data.
posZ/10.+ BoxZ,
new TGeoRotation (rot)));
1589 bIsModuleOn[module-1] = kTRUE;
1598 TGeoVolume *volAbs1, *volSci1, *volAbs2, *volSci2, *volAbs3, *volSci3;
1600 TGeoVolume *volume =
new TGeoVolumeAssembly(
"FscBox");
1607 Float_t pDx1 = 11., pDx2 = 11., pDy1 = 11., pDy2 = 11., pAlp1 = 0.0275, pAlp2 = 0.15, pDz = 0.00375, posZ = 760.;
1609 TGeoBBox *absorber1 =
new TGeoBBox(pDx1*padX/2. , pDy1*(padY-holeY)/4., pAlp1/2.);
1610 TGeoBBox *scintillator1 =
new TGeoBBox(pDx2*padX/2. , pDy2*(padY-holeY)/4., pAlp2/2.);
1611 TGeoBBox *absorber2 =
new TGeoBBox(pDx1*padX1/2., pDy1*holeY/4. , pAlp1/2.);
1612 TGeoBBox *scintillator2 =
new TGeoBBox(pDx2*padX1/2., pDy2*holeY/4. , pAlp2/2.);
1613 TGeoBBox *absorber3 =
new TGeoBBox(pDx1*padX2/2., pDy1*holeY/4. , pAlp1/2.);
1614 TGeoBBox *scintillator3 =
new TGeoBBox(pDx2*padX2/2., pDy2*holeY/4. , pAlp2/2.);
1616 volAbs1 =
new TGeoVolume(
"FscAbsorber1", absorber1,
gGeoManager->GetMedium(
"lead"));
1617 volSci1 =
new TGeoVolume(
"FscScintillator1", scintillator1,
gGeoManager->GetMedium(
"FscScint"));
1618 volAbs2 =
new TGeoVolume(
"FscAbsorber2", absorber2,
gGeoManager->GetMedium(
"lead"));
1619 volSci2 =
new TGeoVolume(
"FscScintillator2", scintillator2,
gGeoManager->GetMedium(
"FscScint"));
1620 volAbs3 =
new TGeoVolume(
"FscAbsorber3", absorber3,
gGeoManager->GetMedium(
"lead"));
1621 volSci3 =
new TGeoVolume(
"FscScintillator3", scintillator3,
gGeoManager->GetMedium(
"FscScint"));
1624 gGeoManager->Division(
"FscScintillator1X" ,
"FscScintillator1" , 1, padX , -pDx2*padX/2. , pDx2);
1625 TGeoVolume *volSci1XY =
gGeoManager->Division(
"FscScintillator1XY",
"FscScintillator1X", 2, (padY-holeY)/2, -pDy2*(padY-holeY)/4., pDy2);
1627 gGeoManager->Division(
"FscScintillator2X" ,
"FscScintillator2" , 1, padX1 , -pDx2*padX1/2. , pDx2);
1628 TGeoVolume *volSci2XY =
gGeoManager->Division(
"FscScintillator2XY",
"FscScintillator2X", 2, holeY/2 , -pDy2*holeY/4. , pDy2);
1630 gGeoManager->Division(
"FscScintillator3X" ,
"FscScintillator3" , 1, padX2 , -pDx2*padX2/2. , pDx2);
1631 TGeoVolume *volSci3XY =
gGeoManager->Division(
"FscScintillator3XY",
"FscScintillator3X", 2, holeY/2 , -pDy2*holeY/4. , pDy2);
1633 TGeoVolume *ffsclay =
new TGeoVolumeAssembly(
"FscLayer");
1634 ffsclay->AddNode(volAbs1, 0,
new TGeoCombiTrans(0. , pDy1*(padY+holeY)/4., pAlp1/2. ,
new TGeoRotation (rot)));
1635 ffsclay->AddNode(volSci1, 0,
new TGeoCombiTrans(0. , pDy2*(padY+holeY)/4., pAlp1+pDz+pAlp2/2.,
new TGeoRotation (rot)));
1636 ffsclay->AddNode(volAbs2, 0,
new TGeoCombiTrans(pDx1*(-padX+padX1)/2., pDy1*holeY/4. , pAlp1/2. ,
new TGeoRotation (rot)));
1637 ffsclay->AddNode(volSci2, 0,
new TGeoCombiTrans(pDx2*(-padX+padX1)/2., pDy2*holeY/4 , pAlp1+pDz+pAlp2/2.,
new TGeoRotation (rot)));
1638 ffsclay->AddNode(volAbs3, 0,
new TGeoCombiTrans(pDx1*(padX-padX2)/2. , pDy1*holeY/4. , pAlp1/2. ,
new TGeoRotation (rot)));
1639 ffsclay->AddNode(volSci3, 0,
new TGeoCombiTrans(pDx2*(padX-padX2)/2. , pDy2*holeY/4. , pAlp1+pDz+pAlp2/2.,
new TGeoRotation (rot)));
1642 AddSensitiveVolume(volSci1XY);
1643 AddSensitiveVolume(volSci2XY);
1644 AddSensitiveVolume(volSci3XY);
1646 for (Int_t ll=1; ll<=300; ll++) {
1647 volume->AddNode(ffsclay,ll,
new TGeoCombiTrans(0., 0., ll*(2.*pDz+pAlp1+pAlp2),
new TGeoRotation (rot)));
1650 flayer5->AddNode(volume, 0,
new TGeoCombiTrans(0., 0., posZ,
new TGeoRotation (rot)));
1651 bIsModuleOn[4] = kTRUE;
1655 TGeoVolume *flayer12 =
new TGeoVolumeAssembly(
"Emc12");
1656 TGeoVolume *flayer12Hole =
new TGeoVolumeAssembly(
"Emc12Hole");
1657 if (bIsModuleOn[0]) flayer12->AddNode(flayer1,0,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation(0)));
1658 if (bIsModuleOn[1]) flayer12->AddNode(flayer2,0,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation(0)));
1659 if (bIsModuleOn[0]) flayer12Hole->AddNode(flayer1,0,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation(0)));
1660 if (bIsModuleOn[1]) flayer12Hole->AddNode(flayer2Hole,0,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation(0)));
1663 vname = vname.Strip();
1664 TGeoVolume* vcave =
gGeoManager->FindVolumeFast(vname.Data());
1666 if (bIsModuleOn[2]) vcave->AddNode(flayer3, 1);
1667 if (bIsModuleOn[3]) vcave->AddNode(flayer4, 1);
1668 if (bIsModuleOn[4]) vcave->AddNode(flayer5, 1);
1669 if (bIsModuleOn[5]) vcave->AddNode(flayer6, 1);
1672 if (bIsModuleOn[0] || bIsModuleOn[1])
1673 for (Int_t
n=0;
n<=15;
n++){
1675 rot1.RotateZ(22.5*
n);
1676 if (
n==0 ||
n==8) vcave->AddNode(flayer12Hole,
n+1,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation (rot1)) );
1677 else vcave->AddNode(flayer12,
n+1,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation (rot1)) );
1682 for (Int_t
n=1;
n<=3;
n++){
1684 if (
n==1) reflection.ReflectY(1);
1685 if (
n==2) {reflection.ReflectY(1); reflection.ReflectX(1);}
1686 if (
n==3) reflection.ReflectX(1);
1687 vcave->AddNode(flayer3,
n+1,
new TGeoCombiTrans(reflection));
1692 for (Int_t
n=1;
n<=3;
n++){
1694 if (
n==1) reflection.ReflectY(1);
1695 if (
n==2) {reflection.ReflectY(1); reflection.ReflectX(1);}
1696 if (
n==3) reflection.ReflectX(1);
1697 vcave->AddNode(flayer4,
n+1,
new TGeoCombiTrans(reflection));
1706 reflection.ReflectY(1);
1707 vcave->AddNode(flayer5, 2,
new TGeoCombiTrans(reflection));
1710 for (Int_t
n=1;
n<=3;
n++){
1712 if (
n==1) reflection.ReflectY(1);
1713 if (
n==2) {reflection.ReflectY(1); reflection.ReflectX(1);}
1714 if (
n==3) reflection.ReflectX(1);
1715 vcave->AddNode(flayer5,
n+1,
new TGeoCombiTrans(reflection));
1721 PndEmcPoint*
PndEmc::AddHit(Int_t trackID, Int_t detID, Int_t evtID, TVector3
pos, TVector3
mom,
Double_t time,
Double_t length,
Double_t eLoss, Short_t mod, Short_t
row, Short_t crys, Short_t copy,
Bool_t entering,
Bool_t exiting) {
1723 Int_t size = clref.GetEntriesFast();
1724 if (fVerboseLevel>1)
1725 cout <<
"-I- PndEmc: Adding Point at IN (" << pos.X() <<
", " << pos.Y()
1726 <<
", " << pos.Z() <<
") cm, detector " << detID <<
", evt " << evtID <<
", track "
1727 << trackID <<
", energy loss " << eLoss*1e06 <<
" keV, module " << mod <<
" row " << row <<
" crystal " << crys <<
" copy " << copy
1728 <<
", entering " << entering <<
", exiting " << exiting << endl;
1730 PndEmcPoint* myPoint =
new(clref[size])
PndEmcPoint(trackID, detID, evtID, pos, mom, time, length, eLoss, mod, row, crys, copy, entering, exiting);
1731 myPoint->SetLink(FairLink(-1, FairRootManager::Instance()->GetEntryNr(),
"MCTrack", trackID));
1739 fPos.SetXYZT(0., 0., 0., 0.);
1740 fMom.SetXYZT(0., 0., 0., 0.) ;
1747 FairRun*
fRun = FairRun::Instance();
1750 if (strcmp(fRun->GetName(),
"TGeant3") == 0) {
1754 std::string sMedium[3] = {
"FscScint",
"FscFiber",
"lead"};
1756 for(Int_t
i = 0;
i < 3;
i++) {
1758 if (medium==0)
continue;
1759 matIdVMC = medium->GetId();
1760 double cut_el = 1.0E-4;
1761 double cut_had = 1.0E-4;
1780 gMC->Gstpar(matIdVMC,
"CUTGAM",cut_el);
1781 gMC->Gstpar(matIdVMC,
"CUTELE",cut_el);
1782 gMC->Gstpar(matIdVMC,
"CUTNEU",cut_had);
1783 gMC->Gstpar(matIdVMC,
"CUTHAD",cut_had);
1784 gMC->Gstpar(matIdVMC,
"CUTMUO",cut_el);
1785 gMC->Gstpar(matIdVMC,
"BCUTE",cut_el);
1786 gMC->Gstpar(matIdVMC,
"BCUTM",cut_el);
1787 gMC->Gstpar(matIdVMC,
"DCUTE",cut_el);
1788 gMC->Gstpar(matIdVMC,
"DCUTM",cut_el);
1789 gMC->Gstpar(matIdVMC,
"PPCUTM",cut_el);
1791 gMC->SetMaxNStep((
int)1E6);
1793 std::cout<<
"\n************************************************************\n"
1794 <<
"PndEmc::SetSpecialPhysicsCuts():\n"
1795 <<
" using special physics cuts ...\n";
1796 std::cout<<
"************************************************************"
represents a mc hit in an emc crystal
int GetMinRows(int module)
Bool_t bwendcap
Flag for the new FwEndCap geometry.
void ConstructRootGeomMod4()
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
sim(Int_t nEvents=1, TString SimEngine="TGeant4", Float_t mom=6.231552)
void SetGeometryVersion(Int_t geometryVersion)
Int_t fVolumeID
track index
Double_t val[nBoxes][nFEBox]
void ConstructRootGeometry()
virtual TClonesArray * GetCollection(Int_t iColl) const
virtual void ConstructGeometry()
int GetMaxCrystals(int module, int row)
void SetMapperVersion(Int_t mapperVersion)
void SetStorageOfData(Bool_t val)
virtual void SetGeometryFileNameQuadruple(TString fname, TString fname2, TString fname3, TString fname4, TString geoVer="0")
TGeoManager * gGeoManager
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
void AddPoint(DetectorId iDet)
virtual void EndOfEvent()
void ConstructRootGeomMod5()
DataG4 GetData(int module, int row, int crystal)
Int_t fPosIndex
energy loss
Bool_t bIsFastFsc
Hit collection.
FairGeoBuilder * geobuild
void ExpandNode(TGeoVolume *fVol, TGeoVolume *Cave)
Cave SetGeometryFileName("pndcave.geo")
int GetMinCrystals(int module, int row)
int GetMaxRows(int module)
TGeoCombiTrans reflection
TLorentzVector fMom
position
virtual void SetGeometryVersion(const Int_t GeoNumber)
virtual void Initialize()
TString fgeoName2
Flag for the new BwEndCap geometry.
virtual void SetTrackID(Int_t trackId)
virtual void SetGeometryFileNameTriple(TString fname, TString fname2, TString fname3, TString geoVer="0")
virtual void Print() const
TLorentzVector fPos
event id
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual void BeginEvent()
void ConstructRootGeomMod12()
void ConstructASCIIGeometry()
virtual void SetGeometryFileNameDouble(TString fname, TString fname2, Int_t fwbwchoice=0, TString geoVer="0")
FairGeoMedium * CbmMediumPWO
FairGeoInterface * geoFace
virtual void SetSpecialPhysicsCuts()
PndEmcPoint * AddHit(Int_t trackID, Int_t detID, Int_t evtID, TVector3 pos, TVector3 mom, Double_t tof, Double_t length, Double_t eLoss, Short_t mod, Short_t row, Short_t crys, Short_t copy, Bool_t enterning, Bool_t exiting)
TClonesArray * fEmcCollection
Bool_t fStoreData
Flag for fast fsc geometry.