102 if (gMC->IsTrackEntering()) {
104 fTime = gMC->TrackTime() * 1.0e09;
105 fLength = gMC->TrackLength();
107 TLorentzVector PosIn;
108 gMC->TrackPosition(PosIn);
109 fPosIn.SetXYZ(PosIn.X(), PosIn.Y(), PosIn.Z());
111 TLorentzVector MomIn;
112 gMC->TrackMomentum(MomIn);
113 fMomIn.SetXYZ(MomIn.X(), MomIn.Y(), MomIn.Z());
117 fELoss += gMC->Edep();
120 if (gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()) {
122 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
123 fDetectorId = vol->getMCid();
125 TLorentzVector PosOut;
126 gMC->TrackPosition(PosOut);
127 fPosOut.SetXYZ(PosOut.X(), PosOut.Y(), PosOut.Z());
129 TLorentzVector MomOut;
130 gMC->TrackMomentum(MomOut);
131 fMomOut.SetXYZ(MomOut.X(), MomOut.Y(), MomOut.Z());
137 TVector3 diff_pos = fPosIn - fPosOut;
139 if (diff_pos.Mag() < 0.001)
141 if (fMomOut.Mag() == 0)
144 TVector3 corr_step = fMomOut;
145 corr_step.SetMag(0.001);
146 TVector3 pos = fPosOut;
147 fPosOut = pos - corr_step;
148 gGeoManager->FindNode(fPosOut[0], fPosOut[1], fPosOut[2]);
151 Int_t stationNum = -1;
152 Int_t moduleNum = -1;
154 TGeoVolume* currentVolume = gGeoManager->GetCurrentVolume();
155 TString currentVolumeName = currentVolume->GetName();
157 TRegexp expr =
"^Sensor_module[0-9]+_station[0-9]+_GEM$";
158 if (currentVolumeName.Contains(expr)) {
159 TRegexp mod_expr =
"module[0-9]+";
160 TRegexp stat_expr =
"station[0-9]+";
162 moduleNum = TString(TString(currentVolumeName(mod_expr))(TRegexp(
"[0-9]+"))).Atoi();
163 stationNum = TString(TString(currentVolumeName(stat_expr))(TRegexp(
"[0-9]+"))).Atoi();
170 if (stationNum == -1 || moduleNum == -1)
174 AddHit(fTrackID, fDetectorId, fPosIn, fPosOut, fMomIn, fMomOut, fTime, fLength, fELoss, stationNum, moduleNum);
238 Int_t nEntries = cl1->GetEntriesFast();
239 cout <<
"-I- CbmSts: " << nEntries <<
" entries to add." << endl;
240 TClonesArray& clref = *cl2;
242 for (Int_t
i = 0;
i < nEntries;
i++) {
244 Int_t index = oldpoint->GetTrackID() + offset;
249 cout <<
" -I- CbmSts: " << cl2->GetEntriesFast() <<
" merged entries." << endl;
275 FairGeoLoader* geoLoad = FairGeoLoader::Instance();
276 FairGeoInterface* geoFace = geoLoad->getGeoInterface();
278 stsGeo->setGeomFile(GetGeometryFileName());
279 geoFace->addGeoModule(stsGeo);
281 Bool_t rc = geoFace->readSet(stsGeo);
283 stsGeo->create(geoLoad->getGeoBuilder());
284 TList* volList = stsGeo->getListOfVolumes();
286 FairRun* fRun = FairRun::Instance();
287 FairRuntimeDb* rtdb = FairRun::Instance()->GetRuntimeDb();
292 TListIter iter(volList);
293 FairGeoNode* node = NULL;
294 FairGeoVolume* aVol = NULL;
296 while ((node = (FairGeoNode*)iter.Next())) {
297 aVol =
dynamic_cast<FairGeoVolume*
>(node);
298 if (node->isSensitive()) {
299 fSensNodes->AddLast(aVol);
301 fPassNodes->AddLast(aVol);
305 par->setInputVersion(fRun->GetRunId(), 1);
306 ProcessNodes(volList);
314 TGeoVolume* v1 = parser.GDMLReadFile(GetGeometryFileName());
318 <<
"\033[5m\033[31mFairModule::ConstructGDMLGeometry(): could construct geometry from GDML File!! \033[0m"
319 << GetGeometryFileName().Data();
321 TGeoNode* n = v1->GetNode(0);
326 gGeoManager->AddVolume(v1);
329 TGeoVoxelFinder* voxels = v1->GetVoxels();
331 voxels->SetNeedRebuild();
336 TGeoMatrix* M = n->GetMatrix();
340 gGeoManager->GetListOfMatrices()->Remove(M);
341 TGeoHMatrix* global = gGeoManager->GetHMatrix();
342 gGeoManager->GetListOfMatrices()->Remove(global);
345 TGeoVolume* Cave = gGeoManager->GetTopVolume();
346 Cave->AddNode(v1, 0, 0);
398 TFile* outfile =
new TFile(
"sts.root",
"RECREATE");
437 new (clref[size])
CbmStsPoint(trackID, detID, posIn, posOut, momIn, momOut, time, length, eLoss);