11 #include "TClonesArray.h"
12 #include "TLorentzVector.h"
13 #include "TParticle.h"
15 #include "TVirtualMC.h"
19 #include "TGeoManager.h"
20 #include "TLorentzVector.h"
21 #include "TParticle.h"
22 #include "TVirtualMC.h"
24 #include "TGeoSphere.h"
26 #include "TGeoCompositeShape.h"
27 #include "TGeoMatrix.h"
30 #include "FairRootManager.h"
32 #include "FairRuntimeDb.h"
33 #include "FairVolume.h"
35 #include "FairGeoInterface.h"
36 #include "FairGeoLoader.h"
37 #include "FairGeoNode.h"
38 #include "FairRootManager.h"
39 #include "FairGeoMedia.h"
40 #include "FairGeoMedium.h"
41 #include "FairGeoRootBuilder.h"
57 fStoreCerenkovs(kTRUE),
58 fStoreParticles(kTRUE),
59 fStoreTrackPoints(kFALSE),
60 fStoreFLGHits(kFALSE),
62 fMeasureTotalRefAngle(kFALSE),
77 : FairDetector(name, active),
79 fStoreCerenkovs(kTRUE),
80 fStoreParticles(kTRUE),
81 fStoreTrackPoints(kFALSE),
82 fStoreFLGHits(kFALSE),
84 fMeasureTotalRefAngle(kFALSE),
137 TFile *
f=
new TFile(name.c_str());
139 for (
int i=0;
i<5;
i++)
146 cout <<
" -W- (PndDsk::Initialize) - trapfrac_disc file "
147 <<
" doesn't exist. Using constant trapping fraction _trap="<< 0.7<<endl;
224 cout <<
"-I- PndDsk::Print() was called, but is not yet implemented." << endl;
247 cout <<
"-I- PndDsk::CopyClones() was called, but is not yet implemented." << endl;
257 TString fileName = GetGeometryFileName();
258 if (fileName.EndsWith(
"_top.root")) {
259 ConstructRootGeometry();
264 FairGeoLoader* drcgeoLoad = FairGeoLoader::Instance();
265 FairGeoInterface* drcgeoFace = drcgeoLoad->getGeoInterface();
267 FairGeoMedia *
Media = drcgeoFace->getMedia();
268 FairGeoBuilder *
geobuild = drcgeoLoad->getGeoBuilder();
271 FairGeoMedium *fusedSil = Media->getMedium(
"FusedSil");
272 geobuild->createMedium(fusedSil);
273 FairGeoMedium *nlak33a = Media->getMedium(
"NLAK33A");
274 geobuild->createMedium(nlak33a);
275 FairGeoMedium *
air = Media->getMedium(
"DIRCair");
276 geobuild->createMedium(air);
277 FairGeoMedium *airNoSens = Media->getMedium(
"DIRCairNoSens");
278 geobuild->createMedium(airNoSens);
279 FairGeoMedium *mirror = Media->getMedium(
"Mirror");
280 geobuild->createMedium(mirror);
281 FairGeoMedium *marcol82 = Media->getMedium(
"Marcol82");
282 geobuild->createMedium(marcol82);
296 new TGeoBBox(
"DW",fWindowWidthHalf,fWindowHeightHalf,thickness);
299 TGeoCone* baseVol =
new TGeoCone(
"baseVol",thickness+0.1, rmin, rmax+0.1, rmin, rmax+0.1);
300 new TGeoCone(
"logicPlate", thickness, rmin, rmax, rmin, rmax);
301 TGeoCompositeShape* logicPlate_DW =
new TGeoCompositeShape(
"logicPlate - DW");
303 TGeoVolume *dskVol =
new TGeoVolume(
"DskBase", baseVol,
gGeoManager->GetMedium(
"DIRCairNoSens"));
304 TGeoVolume *plateVol =
new TGeoVolume(
"Plate", logicPlate_DW,
gGeoManager->GetMedium(
"FusedSil"));
306 cave->AddNode(dskVol, 1,
new TGeoCombiTrans(0, 0, z_position,
new TGeoRotation(0)));
307 dskVol->AddNode(plateVol, 1,
new TGeoCombiTrans(0, 0, 0,
new TGeoRotation(0)));
308 AddSensitiveVolume(plateVol);
338 TVector3 position_store, TVector3 momentum_store,
Double_t time,
340 TVector3 Cherenkov_photon, Int_t light_guide, Int_t
pixel)
343 Int_t size = clref.GetEntriesFast();
344 return new(clref[size])
PndDskFLGHit( trackID,detectorID,position_store,momentum_store,time,
345 angIn,thetaC_store,Cherenkov_photon,light_guide,pixel);
354 Int_t motherTrackID, Int_t motherPdgCode,
TString motherPdgName)
357 Int_t size = clRef.GetEntriesFast();
360 position, momentum, time, energy, wavelength,
361 motherTrackID, motherPdgCode, motherPdgName);
370 TVector3 position, TVector3 momentum,
Double_t time,
372 Int_t motherTrackID, Int_t motherPdgCode,
TString motherPdgName,
Double_t mass,
376 Int_t size = clRef.GetEntriesFast();
379 position, momentum, time, pdgCode, pdgName, energy,
380 motherTrackID, motherPdgCode, motherPdgName, mass, angIn, thetaC, nPhot);
392 Int_t size = clRef.GetEntriesFast();
395 position, momentum, time, length, eLoss);
404 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
410 while ( searching && (pCerenkov = (
PndDskCerenkov*)iter.Next()) ) {
411 if ( pCerenkov->GetTrackID() ==
fTrackID )
425 fTime = gMC->TrackTime() * 1.e9;
440 fTime = gMC->TrackTime() * 1.e9;
447 fMotherTrackID = gMC->GetStack()->GetCurrentTrack()->GetFirstMother();
489 Int_t i_FLG = -99, i_Pixel = -99;
496 if(i_FLG != -99&&gRandom->Rndm()<effi){
497 TVector3 Cherenkov_photon(0,0,1);
498 double angIn = 0, thetaC_store = 0;
500 angIn,thetaC_store,Cherenkov_photon,i_FLG, i_Pixel);
543 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
549 while ( searching && (pCerenkov = (
PndDskCerenkov*)iter.Next()) ) {
550 if ( pCerenkov->GetTrackID() ==
fTrackID )
567 fTime = gMC->TrackTime() * 1.e9;
582 fTime = gMC->TrackTime() * 1.e9;
589 fMotherTrackID = gMC->GetStack()->GetCurrentTrack()->GetFirstMother();
636 TString volName = vol->GetName();
637 if ((gMC->IsTrackEntering()) && (volName.BeginsWith(
"radiator"))) {
666 if (volName.BeginsWith(
"mirror")) {
669 sscanf(volName.Data(),
"mirror%hu",&
fDetType);
681 fDetTime = gMC->TrackTime() * 1.0e09;
686 TVector3 tmpMom; pCerenkov->Momentum(tmpMom);
688 .Angle(TVector3(tmpMom.Px(),tmpMom.Py(),0.));
711 if ( ( (det==0) && ((wl>=400.) && (wl<=500.)) )
712 ||( (det==1) && ((wl> 500.) && (wl<=700.)) )
729 if (gMC->TrackCharge()!=0.&& gMC->IsTrackEntering() ) {
732 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
738 while ( searching && (pParticle = (
PndDskParticle *)iter.Next()) ) {
739 if ( pParticle->GetTrackID() ==
fTrackID )
755 fTime = gMC->TrackTime() * 1.e9;
762 fMotherTrackID = gMC->GetStack()->GetCurrentTrack()->GetFirstMother();
780 if (
fabs(Pz/fP) > 1. || fP == 0.){
fAngIn = -1.;
790 double lambda1 = 280e-9;
791 double lambda2 = 330e-9;
792 double alpha=7.2974e-3;
795 double effNphotons = 0.2;
798 double trapped = 0.7;
800 double nPhot,
res = 0;
810 trapped = npid<0 ? 0.0 :
trapfrac[npid]->GetBinContent(
trapfrac[npid]->FindBin(fP<6.0?fP:6.0,thtdeg));
815 nPhot = gRandom->Poisson(nPhot);
816 nPhot *= trapped*effNphotons;
817 if(nPhot <= nPhotMin){
820 if(nPhot>100) nPhot=100;
822 if(nPhot > 0)res = 0.01/
sqrt(nPhot);
857 if ( gMC->IsTrackExiting() ||
858 gMC->IsTrackStop() ||
859 gMC->IsTrackDisappeared() ) {
862 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
868 while ( searching && (pParticle = (
PndDskParticle *)iter.Next()) ) {
869 if ( pParticle->GetTrackID() ==
fTrackID )
933 ) + 1806.4 ) * 0.004;
939 if (gRandom->Uniform() > pdeValue) {
Int_t fPdgCode
Photon Detection Efficiency [0-1, 2].
friend F32vec4 acos(const F32vec4 &a)
TClonesArray * fDskTrackPointCollection
Particle collection.
Double_t fELoss
Track length since creation (without mothers) [cm].
friend F32vec4 cos(const F32vec4 &a)
void SetFinalValues(Int_t detNumber, Short_t detType, Double_t detTime, TVector3 detMomentum, Double_t length, Double_t primaryHitAngle, Double_t primaryAngleToCerenkov)
virtual void ConstructGeometry()
TClonesArray * fDskCerenkovCollection
Debug level.
TClonesArray * fDskFLGHitArray
TrackPoint collection.
friend F32vec4 sqrt(const F32vec4 &a)
Double_t fEndEnergy
Momentum when particle disappears.
virtual void Print() const
Int_t fMotherTrackID
Vacuum wavelength hc/fEnergy [nm].
virtual Bool_t ProcessHits(FairVolume *vol=0)
Int_t fTrackID
Whether to measure total reflection angle or not (default)
Double_t reflect_threshold()
virtual void Initialize()
Bool_t fCalcPWay
Whether to store FLGHits (default) or not.
void SetTrapFraction(std::string name)
TGeoManager * gGeoManager
Bool_t fStoreTrackPoints
Whether to store Particles (default) or not.
Double_t fLength
Global time (since event start) [ns].
void AddPoint(DetectorId iDet)
TClonesArray * fDskParticleCollection
Cerenkov collection.
virtual void EndOfEvent()
void Set5RefPosition(TVector3 pos)
TVector3 fEndMomentum
Time when particle disappears.
Double_t fEnergy
PDG code of current particle.
FairGeoBuilder * geobuild
Bool_t fMeasureTotalRefAngle
Whether to calc Projected Way or not (default)
Double_t fTime
Momentum [GeV].
void AddPWay(TVector3 pos)
Bool_t ProcessHitsParticle(FairVolume *vol=0)
void SetTotalRefAngle(Double_t angle)
PndDskCerenkov * AddCerenkov(Int_t trackID, Int_t detectorID, TVector3 position, TVector3 momentum, Double_t time, Double_t energy, Double_t wavelength, Int_t motherTrackID, Int_t motherPdgCode, TString motherPdgName)
PndDskParticle * AddParticle(Int_t trackID, Int_t detectorID, TVector3 position, TVector3 momentum, Double_t time, Int_t pdgCode, TString pdgName, Double_t energy, Int_t motherTrackID, Int_t motherPdgCode, TString motherPdgName, Double_t mass, Double_t angIn, Double_t thetaC, Int_t nPhot)
PndDskFLGHit * AddHit(Int_t trackID, Int_t detectorID, TVector3 position_store, TVector3 momentum_store, Double_t time, Double_t angIn, Double_t thetaC_store, TVector3 Cherenkov_photon, Int_t light_guide, Int_t pixel)
Bool_t fStoreCerenkovs
DSK hits.
void SetFinalValues(TVector3 exitPosition, TVector3 exitMomentum, Double_t exitTime, Double_t exitEnergy)
friend F32vec4 fabs(const F32vec4 &a)
virtual Bool_t CheckIfSensitive(std::string name)
TVector3 fMomentum
Position [cm].
Double_t const fWindowHeightHalf
Bool_t ProcessHitsCerenkov(FairVolume *vol=0)
Double_t GetNofReflections() const
Bool_t fStoreFLGHits
Whether to store TrackPoints or not (default)
virtual TClonesArray * GetCollection(Int_t iColl) const
Bool_t fStoreParticles
Whether to store Cerenkovs (default) or not.
Bool_t DichroicMirrorTransmitted(Double_t wavelength, Int_t detector_type)
Double_t GetWavelength() const
TString fPdgName
Angle between momentum of eachs first appearance.
Double_t fPrimaryHitAngle
Angle at the moment of first appearance.
Int_t fDetNumber
Detectortype that registered the Cerenkov.
Bool_t ProcessHitsCerenkov_FLG(FairVolume *vol=0)
Double_t fDetTime
Number of the Detector that registered the Cerenkov.
Double_t fWavelength
Energy [eV / GeV].
PndDskTrackPoint * AddTrackPoint(Int_t trackID, Int_t detectorID, TVector3 position, TVector3 momentum, Double_t time, Double_t length, Double_t eLoss)
TVector3 fEndPosition
PDG name according to fPdgCode.
void Propagate(TVector3 pos, TVector3 dir, Int_t &i_FLG, Int_t &i_Pixel)
TVector3 fDetMomentum
Global time when Cerenkov was detected [ns].
Double_t const fWindowWidthHalf
TString fMotherPdgName
PDG code of the particle that emitted this Cerenkov.
TVector3 fPosition
Detector ID (volume)
Bool_t DoNotTrackCerenkov()
Double_t fPrimaryAngleToCerenkov
Momentum when detected [eV].
Int_t fDetectorID
Index of MCTrack.
Double_t fPDE
Energy deposit [GeV].
Short_t fDetType
translation of PDG code
Double_t fEndTime
Position when particles disappears.
Double_t fAngIn
Energy when particle disappears.
TVector3 fPrimaryHitMomentum
Angle to the z-Axis at first appearance.
Int_t fMotherPdgCode
Track ID of the particle that emitted this Cerenkov.
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)