14 #include "TClonesArray.h" 
   15 #include "TGeoManager.h" 
   16 #include "TLorentzVector.h" 
   17 #include "TParticle.h" 
   19 #include "TVirtualMC.h" 
   21 #include "FairGeoTransform.h" 
   24 #include "FairGeoInterface.h" 
   25 #include "FairGeoLoader.h" 
   26 #include "TGeoMCGeometry.h" 
   27 #include "FairGeoNode.h" 
   28 #include "FairGeoMedium.h" 
   29 #include "FairGeoMedia.h" 
   31 #include "FairGeoRootBuilder.h" 
   32 #include "TGeoVoxelFinder.h" 
   37 #include "FairRootManager.h" 
   38 #include "FairVolume.h" 
   41 #include "FairRuntimeDb.h" 
   42 #include "TObjArray.h" 
   44 #include "FairRunSim.h" 
   51 #include "TMCProcess.h" 
   55 #include "TGenPhaseSpace.h" 
   61 using std::ostringstream;
 
   66   fcount(0),fUseFileOption(false),fUseRAZHOption(false),fUseGamOption(false),fMatBud(false){
 
  107   : FairDetector(name, active),fcount(0),fUseFileOption(false),fUseRAZHOption(false),fUseGamOption(false),fMatBud(false){
 
  193     std::cout<<
" -E- No gGeoManager in PndHyp Detector::Initialize()!"<<std::endl;
 
  205     fEvt = 
new TClonesArray(
"THParticle",50);
 
  206      ft     = 
new TTree(
"data",
"hypernuclei");
 
  213     ft->Branch(
"Weigth",&
weight,
"Weight/D");
 
  214     ft->Branch(
"Seed",&
seed,
"Seed/D");
 
  215     ft->Branch(
"Particles",&
fEvt,32000);
 
  222   TGeoMedium *Si= 
gGeoManager->GetMedium(
"HYPsilicon");
 
  223   if(Si)
SiId=  Si->GetId();
 
  227   if(
fVers.Contains(
"standard")){
 
  239   }
else if(
fVers.Contains(
"List")){
 
  285   Int_t nSiL = -1,nAbL = -1;
 
  286   ostringstream FullName,matName;
 
  288   Int_t medId =  gMC->CurrentMedium();
 
  300    TString nam2 = gMC->CurrentVolName();   
 
  312        if ( gMC->IsTrackEntering() ) 
 
  315            fTime   = gMC->TrackTime() * 1.0e09;
 
  317            fmass   = gMC->TrackMass();   
 
  323              }
else fEventID = gMC->CurrentEvent();
 
  325            gMC->TrackPosition(
fPosIn);
 
  326            gMC->TrackMomentum(
fMomIn);
 
  338        gMC->TrackMomentum(PL);
 
  340        if ( (gMC->IsTrackExiting()    ||
 
  341              gMC->IsTrackStop()       ||
 
  342              gMC->IsTrackDisappeared() )&& gMC->TrackCharge()  ) 
 
  344            fTrackID  = gMC->GetStack()->GetCurrentTrackNumber();
 
  352              if ((nam2.Contains(
"Sensor"))) {
 
  353                sscanf(nam2,
"Sensor%d", &nSiL);
 
  379            FullName <<gMC->CurrentVolPath();
 
  382              std::cout<<
" -E- No PndHypGeoHandling loaded."<<std::endl;
 
  390            if (
fELoss == 0. ) 
return kFALSE;
 
  426     else if(
fMatBud && (!nam2.Contains(
"Absorber"))&&(!nam2.Contains(
"Sensor")))
 
  431          if ( gMC->IsTrackEntering() ) 
 
  434                fTime   = gMC->TrackTime() * 1.0e09;
 
  436                fmass   = gMC->TrackMass();   
 
  442                  }
else fEventID = gMC->CurrentEvent();
 
  444                gMC->TrackPosition(
fPosIn);
 
  445                gMC->TrackMomentum(
fMomIn);
 
  458            if ( (gMC->IsTrackExiting()    ||
 
  459                  gMC->IsTrackStop()       ||
 
  460                  gMC->IsTrackDisappeared() )&& gMC->TrackCharge()  ) 
 
  462                fTrackID  = gMC->GetStack()->GetCurrentTrackNumber();
 
  471                if (
fELoss == 0. ) 
return kFALSE;
 
  502    else if ((
fpdgCode==3312)&&(nam2.Contains(
"Ab")))
 
  505        if ( gMC->IsTrackEntering() ) 
 
  508            fTime   = gMC->TrackTime() * 1.0e09;
 
  510            fmass   = gMC->TrackMass();   
 
  517              }
else fEventID = gMC->CurrentEvent();
 
  520            gMC->TrackPosition(
fPosIn);
 
  521            gMC->TrackMomentum(
fMomIn);
 
  530        gMC->TrackMomentum(PL);
 
  536            fTrackID  = gMC->GetStack()->GetCurrentTrackNumber();
 
  540              if ((nam2.Contains(
"Absorber"))) {
 
  541                sscanf(nam2,
"Absorber%d", &nAbL);
 
  542                cout << 
"hyp::ProcessHits> : " << nam2 <<
" # " 
  543                     <<nAbL<<
" "<<
"Hit in "<< 
gGeoManager->GetPath()<<endl;
 
  552            TString mat[4]={
"CAbs",
"Si",
"Be",
"Al"};
 
  553            if (medId==
CId) matName<<
"CAbs";
 
  554            if (medId==
SiId) matName<<
"Si";
 
  556            if (
fELoss == 0. ) 
return kFALSE;
 
  605   if (fVerboseLevel)  
Print();
 
  612   FairRootManager::Instance()->Register(
"HypPoint",
"Hyp", 
fHypCollection, kTRUE);
 
  613   FairRootManager::Instance()->Register(
"HypSegTarPoint",
"HypSecTarg", 
 
  615   FairRootManager::Instance()->Register(
"HypSTMatBudPoint",
"HypMatBud", 
 
  634     cout << 
"-I- PndHyp: " << nHits << 
" points registered in this event." 
  658   Int_t nEntries = cl1->GetEntriesFast();
 
  660   TClonesArray& clref = *cl2;
 
  662   for (Int_t 
i=0; 
i<nEntries; 
i++) {
 
  664     Int_t index = oldpoint->GetTrackID() + 
offset;
 
  665     oldpoint->SetTrackID(index);
 
  669   cout << 
" -I- PndHyp: " << cl2->GetEntriesFast() << 
" merged entries." 
  676 TString fileName=GetGeometryFileName();
 
  678  if(fileName.EndsWith(
".geo")){
 
  679    std::cout<< 
"Geometry format not supported " <<std::endl;
 
  682  }
else if (fileName.EndsWith(
".root")){
 
  685   ConstructRootGeometry();
 
  687   std::cout<< 
"Geometry format not supported " <<std::endl;
 
  713       cout<<
" -I PndHyp::FinishRun():closing and deleting fFile fEvt "<<endl;
 
  732     cout<<
" increment count "<<
fcount<<endl;
 
  740       TLorentzVector PG(0.,0.,0., 1.);
 
  748       std::cout<<VG.X()<<
" "<<VG.Y()<<
" "<<VG.Z()<<std::endl;
 
  761         TLorentzVector target4(0.0, 0.0, 0., 5.95137);
 
  762         TLorentzVector target5(0.0, 0.0, 0., 5.7789);
 
  764         TLorentzVector target6(0.,0.,0., 10.60335);
 
  765         TLorentzVector target7(0.,0.,0., 10.41176);
 
  767         TLorentzVector W6 = target6;
 
  768         TLorentzVector W7 = target7;
 
  770         Double_t mass4[2] = { 10.41176, 0.139};
 
  771         Double_t mass5[2] = { 10.25409, 0.139};
 
  774         ev6.SetDecay(W6, 2, mass4);
 
  776         ev7.SetDecay(W7, 2, mass5);
 
  779         TLorentzVector *pPi6    = ev6.GetDecay(1);
 
  781         TLorentzVector *pPi7    = ev7.GetDecay(1);
 
  786         std::cout<<V.X()<<
" "<<V.Y()<<
" "<<V.Z()<<std::endl;
 
  788           THParticle  fpion_H(-211,1,0,0,0,0,0,0,*pPi6,V);
 
  792           THParticle  fpion_L(-211,1,0,0,0,0,0,0,*pPi7,V);
 
  814                             TVector3 
pos, TVector3 
mom,
 
  825   Int_t size = clref.GetEntriesFast();
 
  826   return new(clref[size]) 
PndHypPoint(trackID,  evtID,detID, detName,pos, mom, 
 
  828                                       time, length, eLoss,charge, 
 
  841                                   TVector3 
pos, TVector3 
mom,  
 
  851   Int_t size = clref.GetEntriesFast();
 
  852   return new(clref[size]) 
PndHypPoint(trackID,  evtID,detID, detName, pos, 
 
  854                                       time, length, eLoss,charge, mass, pdgCode,
 
  866                                   TVector3 
pos, TVector3 
mom,  
 
  876   Int_t size = clref.GetEntriesFast();
 
  877   return new(clref[size]) 
PndHypPoint(trackID,  evtID,detID, detName, pos, 
 
  879                                       time, length, eLoss,charge, mass, pdgCode,
 
TClonesArray * fHypSecTarCollection
Hit collection. 
virtual void Initialize()
virtual void SetSpecialPhysicsCuts()
PndHypPoint * AddHit(Int_t trackID, Int_t evtID, Int_t detID, TString detName, TVector3 posin, TVector3 momin, TVector3 posout, TVector3 momout, Double_t tof, Double_t length, Double_t eLoss, Double_t charge, Double_t mass, Int_t pdgCode, Double_t dist, Double_t PLin, Double_t PLout)
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
virtual void EndOfEvent()
Class to access the naming information of the MVD. 
TGeoManager * gGeoManager
PndHypGeoHandling * fGeoH
Input file name. 
virtual Bool_t ProcessHits(FairVolume *vol=0)
PndHypPoint * AddSecTarHit(Int_t trackID, Int_t evtID, Int_t detID, TString detName, TVector3 posin, TVector3 momin, TVector3 posout, TVector3 momout, Double_t tof, Double_t length, Double_t eLoss, Double_t charge, Double_t mass, Int_t pdgCode, Double_t dist, Double_t PLin, Double_t PLout)
virtual TClonesArray * GetCollection(Int_t iColl) const 
virtual void Print() const 
virtual void ConstructGeometry()
PndHypPoint * AddSTMatBudHit(Int_t trackID, Int_t evtID, Int_t detID, TString detName, TVector3 posin, TVector3 momin, TVector3 posout, TVector3 momout, Double_t tof, Double_t length, Double_t eLoss, Double_t charge, Double_t mass, Int_t pdgCode, Double_t dist, Double_t PLin, Double_t PLout)
std::vector< std::string > fListOfSensitives
TClonesArray * fHypSTMatBudCollection
TString GetID(TString path)
for a given TGeoManager-path the ID is returned 
void SetHypStatDecay(bool cal, bool active)
virtual void BeginEvent()
bool CheckIfSensitive(std::string name)
std::vector< TString > fListOfMaterials
TClonesArray * fHypCollection
Gives Access to the Path info of a hit.