20 #include "TObjArray.h"
21 #include "TClonesArray.h"
22 #include "TGeoMCGeometry.h"
23 #include "TGeoManager.h"
24 #include "TLorentzVector.h"
25 #include "TParticle.h"
26 #include "TParticlePDG.h"
27 #include "TVirtualMC.h"
28 #include "TGeoMatrix.h"
34 #include "TGDMLParse.h"
50 fRichRefPlanePoints(NULL),
51 fRichMirrorPoints(NULL),
75 fRichPoints(new TClonesArray(
"CbmRichPoint")),
76 fRichRefPlanePoints(new TClonesArray(
"CbmRichPoint")),
77 fRichMirrorPoints(new TClonesArray(
"CbmRichPoint")),
79 fRotation(new TGeoRotation(
"", rx, ry, rz)),
80 fPositionRotation(new TGeoCombiTrans(px, py, pz, fRotation)),
116 TString volName =
name;
117 if ( volName.Contains(
"rich1d")){
127 Int_t pdgCode = gMC->TrackPid();
129 TString volName = TString(vol->GetName());
132 if (volName.Contains(
"rich1d") || volName.Contains(
"RICH_PMT") ){
133 if (gMC->IsTrackEntering()){
135 TParticle*
part = gMC->GetStack()->GetCurrentTrack();
136 Double_t
charge = part->GetPDG()->Charge() / 3. ;
137 Int_t trackID = gMC->GetStack()->GetCurrentTrackNumber();
138 Double_t
time = gMC->TrackTime() * 1.0e09;
139 Double_t
length = gMC->TrackLength();
140 Double_t eLoss = gMC->Edep();
141 TLorentzVector tPos, tMom;
142 gMC->TrackPosition(tPos);
143 gMC->TrackMomentum(tMom);
146 if ( pdgCode == 50000050) {
147 AddHit(trackID, pdgCode, iVol, TVector3(tPos.X(), tPos.Y(), tPos.Z()), TVector3(tMom.Px(), tMom.Py(), tMom.Pz()), time, length, eLoss);
157 AddHit(trackID, pdgCode, iVol, TVector3(tPos.X(), tPos.Y(), tPos.Z()), TVector3(tMom.Px(), tMom.Py(), tMom.Pz()), time, length, eLoss);
169 if (volName ==
"rich1gas2") {
171 if ( gMC->IsTrackEntering() ) {
172 TParticle*
part = gMC->GetStack()->GetCurrentTrack();
173 Double_t
charge = part->GetPDG()->Charge() / 3. ;
177 Int_t trackID = gMC->GetStack()->GetCurrentTrackNumber();
178 Double_t
time = gMC->TrackTime() * 1.0e09;
179 Double_t
length = gMC->TrackLength();
180 Double_t eLoss = gMC->Edep();
181 TLorentzVector tPos, tMom;
183 gMC->TrackPosition(tPos);
184 gMC->TrackMomentum(tMom);
186 AddRefPlaneHit(trackID, iVol, TVector3(tPos.X(), tPos.Y(), tPos.Z()), TVector3(tMom.Px(), tMom.Py(), tMom.Pz()), time, length, eLoss);
197 if (volName.Contains(
"rich1mgl") || volName.Contains(
"rich1mglLU") || volName.Contains(
"rich1mglRU") ) {
200 if (gMC->IsTrackEntering()) {
201 TParticle*
part = gMC->GetStack()->GetCurrentTrack();
202 Double_t
charge = part->GetPDG()->Charge() / 3.;
207 Int_t trackID = gMC->GetStack()->GetCurrentTrackNumber();
209 Double_t
time = gMC->TrackTime() * 1.0e09;
210 Double_t
length = gMC->TrackLength();
211 Double_t eLoss = gMC->Edep();
212 TLorentzVector tPos, tMom;
214 gMC->TrackPosition(tPos);
215 gMC->TrackMomentum(tMom);
222 AddMirrorHit(trackID, iVol, TVector3(tPos.X(), tPos.Y(), tPos.Z()), TVector3(tMom.Px(), tMom.Py(), tMom.Pz()), time, length, eLoss);
258 cout <<
"-I- CbmRich: " << nHits <<
" points registered in this event." << endl;
276 Int_t nEntries = cl1->GetEntriesFast();
277 cout <<
"-I- CbmRich: " << nEntries <<
" entries to add." << endl;
278 TClonesArray& clref = *cl2;
280 for (Int_t i=0; i< nEntries ; i++ ) {
287 cout <<
"-I- CbmRich: " << cl2->GetEntriesFast() <<
" merged entries." << endl;
292 cout<<
"CbmRich::ConstructOpGeometry() " <<endl;
298 if ( fileName.EndsWith(
".root") ) {
299 cout <<
"Constructing RICH geometry from ROOT file: " << fileName.Data() << endl;
301 }
else if ( fileName.EndsWith(
".geo") ) {
302 cout <<
"-I- Constructing RICH geometry from ASCII file: " << fileName.Data() << endl;
304 }
else if (fileName.EndsWith(
".gdml") ) {
305 cout <<
"-I- Constructing RICH geometry from GDML file: " << fileName.Data() << endl;
308 Fatal(
"CbmRich::ConstructGeometry",
"Geometry format of RICH geometry file is not supported");
320 Bool_t rc = geoFace->
readSet(richGeo);
331 TListIter iter(volList);
338 fSensNodes->AddLast( aVol );
340 fPassNodes->AddLast( aVol );
349 TGeoMaterial * matAl =
new TGeoMaterial(
"Al", 26.98, 13, 2.7);
350 TGeoMedium * Al =
new TGeoMedium(
"Al",1, matAl);
351 TGeoVolume *
volume = gGeoManager->MakeTube(
"grid", Al, 1.3, 1.5, 180);
353 gGeoManager->Matrix(123456, 180, 0, 90, 90 , 90 , 0);
354 gGeoManager->Matrix(123457, 90, 0, 180, 0, 90, 90);
357 for (Int_t i = 0; i< 11; i++) {
358 if (i == 5)
continue;
359 gGeoManager->Node(
"grid", 2*i+1,
"rich1gas3", 36*i - 180, 0, 40, 123457, kTRUE, buf, 0);
360 gGeoManager->Node(
"grid", 2*i+2,
"rich1gas3", 0, 36*i - 180, 48, 123456, kTRUE, buf, 0);
364 #define _RICH_GAS_VOLUME_ ("RICH_gas_1")
365 #define _AEROGEL_MEDIUM_ ("Aerogel")
372 for (
unsigned nd=0; nd<current->GetNdaughters(); nd++) {
373 TGeoNode *node = current->GetNode(nd);
374 TGeoVolume *
volume = node->GetVolume();
386 #include <TGeoBBox.h>
407 return TGDMLParse::GDMLReadFile(filename);
411 double extraScale = 0.0;
414 if (strcmp(unit,
"mm") == 0)
416 else if (strcmp(unit,
"milimeter") == 0)
418 else if (strcmp(unit,
"cm") == 0)
420 else if (strcmp(unit,
"centimeter") == 0)
422 else if (strcmp(unit,
"m") == 0)
424 else if (strcmp(unit,
"meter") == 0)
426 else if (strcmp(unit,
"km") == 0)
427 extraScale = 100000.0;
428 else if (strcmp(unit,
"kilometer") == 0)
429 extraScale = 100000.0;
433 return TString::Format(
"%f", extraScale *
mScale);
452 gGeoManager->GetTopVolume()->AddNode(gdmlTop,1,geoMatrix);
454 ExpandNodeForGdml(gGeoManager->GetTopVolume()->GetNode(gGeoManager->GetTopVolume()->GetNdaughters()-1));
462 TIter next( gGeoManager->GetListOfVolumes() );
466 while ((volume=(TGeoVolume*)next())) {
467 TString
name = volume->GetName();
469 if (name.BeginsWith(
"RICH_pipe"))
470 volume->SetVisibility(kFALSE);
471 else if (name.BeginsWith(
"RICH_gas") || name.EqualTo(
"RICH_small_frame_container"))
472 volume->SetVisibility(kFALSE);
473 else if (name.BeginsWith(
"RICH_PMT")) {
474 volume->SetLineColor(kRed);
475 volume->SetFillColor(kRed);
476 volume->SetFillStyle(4000+40);
478 else if (name.BeginsWith(
"RICH_covering")) {
479 volume->SetLineColor(kMagenta);
480 volume->SetFillColor(kMagenta);
481 volume->SetFillStyle(4000+40);
483 else if (name.BeginsWith(
"RICH_main_frame_trap_pillar")) {
484 volume->SetLineColor(kMagenta);
485 volume->SetFillColor(kMagenta);
486 volume->SetFillStyle(4000+70);
488 else if (name.BeginsWith(
"RICH_mirror_support_belt_pillar")) {
489 volume->SetLineColor(kBlack);
490 volume->SetFillColor(kBlack);
491 volume->SetFillStyle(4000+50);
493 else if (name.BeginsWith(
"RICH_mirror")) {
494 volume->SetLineColor(kGray);
495 volume->SetFillColor(kGray);
512 TGeoBBox *
aerogel =
new TGeoBBox(
"Aerogel", 10., 10., 2.5);
533 TGeoVolume *vaerogel =
new TGeoVolume(
"Aerogel", aerogel, medium);
534 gasVolume->AddNode(vaerogel, 0, 0, 0);
535 vaerogel->RegisterYourself();
541 TGeoVolume* curVol = node->GetVolume();
544 if (!curVol->IsAssembly()) {
545 TString curMedName = node->GetMedium()->GetName();
546 TGeoMedium* curMedInGeoManager = gGeoManager->GetMedium(curMedName);
547 Int_t matIndToDel = gGeoManager->GetMaterialIndex(curMedName);
549 if (curMedName.BeginsWith(
"G4_")) {
550 curMedName.Remove(0, 3);
561 if (curMedInGeoManager == 0) {
562 std::cout <<
"[ExpandNodeForGDML] New medium found in gmdl - it is not in gGeoManager list." << std::endl;
570 curMedInGeo = geoMediaBase->
getMedium(curMedName);
571 if (curMedInGeo == 0)
573 printf(
"Q: %s!\n", curMedName.Data());
574 std::cout <<
"[ExpandNodeForGDML] Media not found in Geo file." << std::endl;
583 fFixedMats[curMedName] = gGeoManager->GetListOfMedia()->GetEntries();
585 node->GetVolume()->SetMedium(gGeoManager->GetMedium(curMedName));
586 gGeoManager->SetAllIndex();
597 if (curVol->GetNdaughters() != 0)
599 TObjArray* NodeChildList = curVol->GetNodes();
600 TGeoNode* curNodeChild;
601 for (Int_t j=0; j<NodeChildList->GetEntriesFast(); j++)
603 curNodeChild = (TGeoNode*)NodeChildList->At(j);
620 Int_t size = clref.GetEntriesFast();
622 return new(clref[size])
CbmRichPoint(trackID, pdg, detID, pos, mom, time,length, eLoss);
635 Int_t tsize = clref.GetEntriesFast();
636 return new(clref[tsize])
CbmRichPoint(trackID, 0, detID, pos, mom, time,length, eLoss);
649 Int_t tsize = clref.GetEntriesFast();
650 return new(clref[tsize])
CbmRichPoint(trackID, 0, detID, pos, mom, time,length, eLoss);