14 #include "FairGeoInterface.h"
15 #include "FairGeoLoader.h"
16 #include "FairGeoNode.h"
17 #include "FairGeoRootBuilder.h"
18 #include "FairRootManager.h"
19 #include "FairRuntimeDb.h"
20 #include "FairVolume.h"
22 #include "TClonesArray.h"
23 #include "TLorentzVector.h"
24 #include "TParticle.h"
25 #include "TVirtualMC.h"
26 #include "TGeoMatrix.h"
27 #include "TObjArray.h"
29 #include "TGeoMedium.h"
30 #include "TGeoVolume.h"
39 #define innerStrawDiameter 1.
44 : fTrackID(0), fVolumeID(0), fPos(0,0,0,0), fPosIn(0,0,0,0), fPosOut(0,0,0,0), fPosInLocal(0,0,0,0), fPosOutLocal(0,0,0,0),
45 fMomIn(0,0,0,0), fMomOut(0,0,0,0), fTime(0), fLength(0), fELoss(0), fMass(0), fIsInitialized(kFALSE), fPosIndex(0),
46 fFtsCollection(0), fpostot(0,0,0,0), fpostotin(0,0,0,0), fpostotout(0,0,0,0), fPassNodes(new TObjArray()), valid(kFALSE), fGeoType(0)
57 : FairDetector(name, active), fTrackID(0), fVolumeID(0), fPos(0,0,0,0), fPosIn(0,0,0,0), fPosOut(0,0,0,0), fPosInLocal(0,0,0,0), fPosOutLocal(0,0,0,0),
58 fMomIn(0,0,0,0), fMomOut(0,0,0,0), fTime(0), fLength(0), fELoss(0), fMass(0), fIsInitialized(kFALSE), fPosIndex(0),
59 fFtsCollection(0), fpostot(0,0,0,0), fpostotin(0,0,0,0), fpostotout(0,0,0,0), fPassNodes(new TObjArray()), valid(kFALSE), fGeoType(0)
91 gMC->TrackPosition(entryPosition);
92 positionInMother[0] = entryPosition.X();
93 positionInMother[1] = entryPosition.Y();
94 positionInMother[2] = entryPosition.Z();
95 gMC->Gmtod(positionInMother, positionInStraw, 1);
97 return positionInStraw[0] * positionInStraw[0] +
98 positionInStraw[1] * positionInStraw[1];
108 pos = aSrc.find(aDelim);
110 aDest = aSrc.substr(0, pos);
112 if(pos != string::npos)
113 aSrc = aSrc.substr(pos + 1);
129 while(
Split(sub, aSrc, aDelim))
153 TString vol_name(gMC->CurrentVolName());
155 gMC->GetTransformation(gMC->CurrentVolPath(),M);
159 if (gMC->TrackCharge() != 0.)
162 if ( gMC->IsTrackEntering() )
168 fTime = gMC->TrackTime() * 1.0e09;
170 gMC->TrackPosition(
fPos);
171 gMC->TrackMomentum(
fMomIn);
173 Double_t globalPos[3] = {0., 0., 0.};
174 Double_t localPos[3] = {0., 0., 0.};
176 globalPos[0] =
fPos.X();
177 globalPos[1] =
fPos.Y();
178 globalPos[2] =
fPos.Z();
180 gMC->Gmtod(globalPos, localPos, 1);
181 fPosInLocal.SetXYZM(localPos[0], localPos[1], localPos[2], 0.0);
191 if ( gMC->IsTrackExiting() &&
valid==kTRUE )
195 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
199 if (fVerboseLevel>2) std::cout<<
"test Vol----------"<<vol->getMCid()<<std::endl;
200 if (fVerboseLevel>2) std::cout<<
"fTrackID-----"<<
fTrackID<<std::endl;
203 fMass = gMC->TrackMass();
207 Double_t globalPos[3] = {0., 0., 0.};
208 Double_t localPos[3] = {0., 0., 0.};
210 gMC->Gdtom(localPos, globalPos, 1);
212 fPos.SetXYZM(globalPos[0], globalPos[1], globalPos[2], 0.0);
218 gMC->Gmtod(globalPos, localPos, 1);
219 fPosOutLocal.SetXYZM(localPos[0], localPos[1], localPos[2], 0.0);
287 Int_t tubeID = 0, chamberID = 0, layerID = 0;
297 if (fVerboseLevel>2) std::cout<<
"AddHit PndFts.cxx= "<<
fTrackID<<std::endl;
333 FairRootManager::Instance()->Register(
"FTSPoint",
"Fts",
fFtsCollection, kTRUE);
357 cout <<
"-I- PndFts: " << nHits <<
" points registered in this event." << endl;
381 nEntries = cl1->GetEntriesFast();
383 cout <<
"-I- PndFts: " << nEntries <<
" entries to add." << endl;
385 TClonesArray& clref = *cl2;
389 for (Int_t
i=0;
i<nEntries;
i++)
394 index = oldpoint->GetTrackID() +
offset;
396 oldpoint->SetTrackID(index);
400 cout <<
"-I- PndFts: " << cl2->GetEntriesFast() <<
" merged entries."
406 cout <<
" -I- Initializing PndFts()" <<endl;
416 FairGeoLoader*
geoLoad = FairGeoLoader::Instance();
417 FairGeoInterface*
geoFace = geoLoad->getGeoInterface();
419 Geo->setGeomFile(GetGeometryFileName());
420 geoFace->addGeoModule(Geo);
422 Bool_t rc = geoFace->readSet(Geo);
423 if (rc) Geo->create(geoLoad->getGeoBuilder());
425 TList* volList = Geo->getListOfVolumes();
428 FairRun *
fRun = FairRun::Instance();
429 FairRuntimeDb *
rtdb= FairRun::Instance()->GetRuntimeDb();
434 TListIter iter(volList);
435 FairGeoNode* node = NULL;
436 FairGeoVolume *aVol=NULL;
439 while( (node = (FairGeoNode*)iter.Next()) ) {
440 aVol =
dynamic_cast<FairGeoVolume*
> ( node );
441 if ( node->isSensitive() ) {
442 fSensNodes->AddLast( aVol );
458 par->setInputVersion(fRun->GetRunId(),1);
459 ProcessNodes ( volList );
469 TVector3
pos, TVector3 posInLocal, TVector3 posOutLocal,
470 TVector3 momIn, TVector3 momOut,
477 size = clref.GetEntriesFast();
479 PndFtsPoint *pointnew =
new(clref[size])
PndFtsPoint(trackID, detID, tubeID, chamberID, layerID, pos, posInLocal, posOutLocal,momIn, momOut, time, length, eLoss, mass);
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
TLorentzVector fMomOut
momentum
PndFtsPoint * AddHit(Int_t trackID, Int_t detID, Int_t tubeID, Int_t chamberID, Int_t layerID, TVector3 pos, TVector3 posInLocal, TVector3 posOutLocal, TVector3 momIn, TVector3 momOut, Double_t time, Double_t length, Double_t eLoss, Double_t mass)
TLorentzVector fpostot
Hit collection.
Double_t fMass
energy loss
void SetLayerID(Int_t layerid)
void SetTubeInRad(Double_t inrad)
TLorentzVector fpostotout
float GetSquaredDistanceFromWire()
bool Split(std::string &aDest, std::string &aSrc, char aDelim)
void AddPoint(DetectorId iDet)
void SetChamberID(Int_t chamberid)
TClonesArray * fFtsCollection
void SetTubeOutRad(Double_t outrad)
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual void Print() const
TLorentzVector fPosOutLocal
entry position in straw frame
TObjArray * GetGeoPassiveNodes()
TLorentzVector fPosInLocal
exit position in global frame
TLorentzVector fPos
volume id
TLorentzVector fPosOut
entry position in global frame
void SetGeometryType(Int_t geoType)
TLorentzVector fMomIn
exit position in straw frame
virtual TClonesArray * GetCollection(Int_t iColl) const
Int_t fVolumeID
track index
FairGeoInterface * geoFace
TObjArray * GetGeoSensitiveNodes()
void SetTubeID(Int_t tubeid)
virtual void ConstructGeometry()
std::string GetStringPart(std::string &aSrc, Int_t part, char aDelim)
virtual void EndOfEvent()