3 #include "FairGeoInterface.h"
4 #include "FairGeoLoader.h"
5 #include "FairGeoNode.h"
6 #include "FairGeoRootBuilder.h"
7 #include "FairRootManager.h"
8 #include "FairRuntimeDb.h"
10 #include "FairGeoMedia.h"
11 #include "FairGeoVolume.h"
12 #include "FairRunSim.h"
13 #include "FairVolume.h"
14 #include "FairMCEventHeader.h"
16 #include "TClonesArray.h"
17 #include "TLorentzVector.h"
18 #include "TParticle.h"
19 #include "TVirtualMC.h"
20 #include "TObjArray.h"
23 #include "TGeoManager.h"
24 #include "TGeoVoxelFinder.h"
25 #include "TGeoMatrix.h"
54 fPndSdsCollection(NULL),
55 fUseRadDamOption(false),
69 : FairDetector(name, active),
82 fPndSdsCollection(NULL),
83 fUseRadDamOption(false),
108 std::cout<<
" -I- Initializing PndSdsDetector()"<<std::endl;
113 std::cout<<
" -E- No gGeoManager in PndSdsDetector::Initialize()!"<<std::endl;
179 if ( gMC->IsTrackEntering() )
183 fTime = gMC->TrackTime() * 1.0e09;
185 gMC->TrackPosition(
fPosIn);
186 gMC->TrackMomentum(
fMomIn);
195 if ( gMC->IsTrackExiting() ||
196 gMC->IsTrackStop() ||
197 gMC->IsTrackDisappeared() ) {
199 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
202 std::cout<<
" -E- No PndGeoHandling loaded."<<std::endl;
205 if (fVerboseLevel > 2){
206 std::cout <<
"******* Info from gMC *************" << std::endl;
207 std::cout <<
"Hit in " << gMC->CurrentVolPath() <<
" with MCiD: " << vol->getMCid() <<
" PixelDetectorID: " <<
fVolumeID << std::endl;
208 std::cout<<
"VolumeID: "<<
fGeoH->
GetShortID(gMC->CurrentVolPath())<<std::endl;
216 if (
fELoss == 0.)
return kFALSE;
219 TString detPath = gMC->CurrentVolPath();
227 if(fVerboseLevel>2) std::cout << myPoint << std::endl;
250 if (fVerboseLevel > 1) {
251 std::cout <<
"-W- PndSdsDetector::EndOfEvent: no fPndSdsCollection pointer!" << std::endl;
268 std::cout <<
"-W- PndSdsDetector: New branch " <<
fOutBranchName <<
" created!" << std::endl;
295 std::cout <<
"-I- PndSdsDetector: " << nHits <<
" points registered in this event." << std::endl;
319 nEntries = cl1->GetEntriesFast();
321 std::cout <<
"-I- PndSdsDetector: " << nEntries <<
" entries to add." << std::endl;
323 TClonesArray& clref = *cl2;
327 for (Int_t
i=0;
i<nEntries;
i++)
332 index = oldpoint->GetTrackID() +
offset;
338 std::cout <<
"-I- PndSdsDetector: " << cl2->GetEntriesFast() <<
" merged entries."
347 TString fileName=GetGeometryFileName();
348 if(fileName.EndsWith(
".geo")){
350 }
else if(fileName.EndsWith(
".root")){
351 ConstructRootGeometry();
353 std::cout<<
"Geometry format not supported " <<std::endl;
376 FairGeoLoader *
geoLoad = FairGeoLoader::Instance();
377 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
380 thePndSdsGeo->setGeomFile(GetGeometryFileName());
381 geoFace->addGeoModule(thePndSdsGeo);
383 Bool_t rc = geoFace->readSet(thePndSdsGeo);
386 thePndSdsGeo->create(geoLoad->getGeoBuilder());
388 TList* volList = thePndSdsGeo->getListOfVolumes();
391 FairRun *
fRun = FairRun::Instance();
393 FairRuntimeDb *
rtdb= FairRun::Instance()->GetRuntimeDb();
401 TListIter iter(volList);
403 FairGeoNode *node = NULL;
404 FairGeoVolume *aVol = NULL;
406 while( (node = (FairGeoNode*)iter.Next()) ) {
407 aVol =
dynamic_cast<FairGeoVolume*
> ( node );
408 if ( node->isSensitive() ) {
409 fSensNodes->AddLast( aVol );
411 fPassNodes->AddLast( aVol );
416 par->setInputVersion(fRun->GetRunId(),1);
418 ProcessNodes ( volList );
428 std::cout<<
"-I- PndSdsDetector: Only active sensor type is set to \""<<sens.Data()<<
"\","<<std::endl;
429 std::cout<<
" this is not a default setting."<<std::endl;
447 if (fVerboseLevel >= 2)
448 std::cout <<
"-I- PndSdsDetector: Adding Point at (" << posIn.X() <<
", " << posIn.Y()
449 <<
", " << posIn.Z() <<
") cm, (" << posOut.X() <<
", " << posOut.Y()
450 <<
", " << posOut.Z() <<
") cm, detector " <<
fGeoH->
GetPath(sensorID) <<
" " << detID <<
", track "
451 << trackID <<
", energy loss " << eLoss*1e06 <<
" keV" << std::endl;
454 momIn, momOut, time, length, eLoss);
virtual void SetBranchNames()=0
virtual void SetTrackID(Int_t id)
TClonesArray * fPndSdsCollection
TLorentzVector fPosOut
entry position in global frame
Int_t fVolumeID
track index
void SetExclusiveSensorType(const TString sens)
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
TLorentzVector fMomOut
momentum
TLorentzVector fPosIn
Det id.
void CreateUniqueSensorId(TString startName, std::vector< std::string > listOfSensitives)
Has to be called during simulation to create unique sensor id.
Int_t fPosIndex
Gives Access to the Path info of a hit.
std::vector< std::string > fListOfSensitives
To be set by daughter classes.
TGeoManager * gGeoManager
TString GetPath(Int_t shortID)
for a given shortID the path is returned
void AddPoint(DetectorId iDet)
virtual void ConstructGeometry()
Class to access the naming information of the MVD.
Int_t GetShortID(TString path)
for a given path the (unique) position of the sensor path in the fSensorNamePar-List is given...
PndGeoHandling * fGeoH
energy loss
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual void SetSpecialPhysicsCuts()
virtual ~PndSdsDetector()
virtual void SetDefaultSensorNames()=0
virtual void Print() const
TObjArray * GetGeoPassiveNodes()
virtual void EndOfEvent()
TObjArray * GetGeoSensitiveNodes()
TString fOutBranchName
enables the detection of neutral particles
virtual void ConstructASCIIGeometry()
FairGeoInterface * geoFace
TLorentzVector fMomIn
exit position in global frame
bool CheckIfSensitive(std::string name)
PndSdsMCPoint * AddHit(Int_t trackID, Int_t detID, Int_t sensorID, TVector3 posIn, TVector3 posOut, TVector3 momIn, TVector3 momOut, Double_t time, Double_t length, Double_t eLoss)
TString fFolderName
To be set by daughter classes.
DetectorId fDetectorID
To be set by daughter classes.
bool fUseRadDamOption
Hit collection.
virtual TClonesArray * GetCollection(Int_t iColl) const
virtual void Initialize()