16#include <TDirectory.h>
18#include <TGeoManager.h>
22#include <TObjString.h>
31using std::setprecision;
121 ,
fMom(-1., -1., -1.)
135 LOG(info) <<
" -I DELETING fSpectrum ";
158 size_t buf_size = 50;
159 Char_t name[buf_size];
168 fDetSpectrum =
new TH1D(
"fDetSpectrum",
"TR spectrum escaped from detector",
fSpNBins, SpLower, SpUpper);
171 fDetSpectrumA =
new TH1D(
"fDetSpectrumA",
"TR spectrum absorbed in detector",
fSpNBins, SpLower, SpUpper);
174 snprintf(name, buf_size - 1,
"fFinal%d", i + 1);
185 LOG(info) <<
"================CbmTrdRadiator===============";
215 else if (
fRadType ==
"tdr18_25cm") {
224 LOG(warn) <<
"CbmTrdRadiator::Init : *********** Radiator prototype not known ***********";
225 LOG(warn) <<
"CbmTrdRadiator::Init : switch to default parameters ";
268 LOG(warn) <<
"CbmTrdRadiator::Init : *********** Radiator material not known ***********";
269 LOG(warn) <<
"CbmTrdRadiator::Init : switch to default material ";
289 LOG(info) <<
"CbmTrdRadiator::Init : Window type : " <<
fWindowFoil;
290 LOG(info) <<
"CbmTrdRadiator::Init : Window density : " <<
fWinDens <<
" g/cm^3";
291 LOG(info) <<
"CbmTrdRadiator::Init : Window thickness : " <<
fWinThick <<
" cm";
295 LOG(info) <<
"CbmTrdRadiator::Init : Prototype : " <<
fRadType;
296 LOG(info) <<
"CbmTrdRadiator::Init : Scaling factor : " <<
fnPhotonCorr;
297 LOG(info) <<
"CbmTrdRadiator::Init : Foil material : " <<
fFoilMaterial;
298 LOG(info) <<
"CbmTrdRadiator::Init : Nr. of foils : " <<
fNFoils;
299 LOG(info) <<
"CbmTrdRadiator::Init : Foil thickness : " << setprecision(4) <<
fFoilThick <<
" cm";
300 LOG(info) <<
"CbmTrdRadiator::Init : Gap thickness : " <<
fGapThick <<
" cm";
301 LOG(info) <<
"CbmTrdRadiator::Init : Simple TR production: " << setprecision(2) <<
fSimpleTR;
302 LOG(info) <<
"CbmTrdRadiator::Init : Foil plasm. frequ. : " <<
fFoilOmega <<
" keV";
303 LOG(info) <<
"CbmTrdRadiator::Init : Gap plasm. frequ. : " <<
fGapOmega <<
" keV";
318 LOG(info) <<
"CbmTrdRadiator::Init : Detector noble gas : " << fTrdGas->
GetNobleGas();
319 LOG(info) <<
"CbmTrdRadiator::Init : Detector quenching gas: " << fTrdGas->
GetCO2();
320 LOG(info) <<
"CbmTrdRadiator::Init : Detector type : " << fTrdGas->
GetDetType();
321 LOG(info) <<
"CbmTrdRadiator::Init : Detector gas thick. : " << fTrdGas->
GetGasThick() <<
" cm";
332 TFile* oldFile = gFile;
333 TDirectory* oldDir = gDirectory;
335 TFile* f1 =
new TFile(
"TRhistos.root",
"recreate");
360 TObjArray* mats = def.Tokenize(
";");
361 for (
fN = 0;
fN < mats->GetEntriesFast();
fN++) {
362 TObjString* mat = (TObjString*) (*mats)[
fN];
363 TString mname = mat->String();
364 if (mname.CompareTo(
"Al") == 0) {
369 else if (mname.CompareTo(
"C") == 0) {
374 else if (mname.CompareTo(
"HC") == 0) {
379 else if (mname.CompareTo(
"Po") == 0) {
384 else if (mname.CompareTo(
"Pok") == 0) {
389 else if (mname.CompareTo(
"Ka") == 0) {
394 else if (mname.CompareTo(
"Air") == 0) {
399 else if (mname.CompareTo(
"Xe") == 0) {
404 else if (mname.CompareTo(
"CO2") == 0) {
409 else if (mname.CompareTo(
"My") == 0) {
415 LOG(warn) <<
"CbmTrdEntranceWindow::Init : material " << mname.Data() <<
" not in the DB. Can't create "
416 << def.Data() <<
" entrance window structure. Default to Mylar.";
420 LOG(info) <<
"CbmTrdEntranceWindow::Init : C" <<
fN <<
" type : " <<
fMat[
fN];
421 LOG(info) <<
"CbmTrdEntranceWindow::Init : density : " <<
fDens[
fN] <<
" g/cm^3";
422 LOG(info) <<
"CbmTrdEntranceWindow::Init : thickness : " <<
fThick[
fN] <<
" cm";
433 LOG(warn) <<
"CbmTrdEntranceWindow : can support only up to " <<
NCOMPONENTS
434 <<
" plane-parallel elements. Please check your simulations";
444 Double_t point_in[3];
445 Double_t point_out[3];
446 if (
nullptr != point) {
447 point_in[0] = point->
GetXIn();
448 point_in[1] = point->
GetYIn();
449 point_in[2] = point->
GetZIn();
451 point_out[0] = point->
GetXOut();
452 point_out[1] = point->
GetYOut();
453 point_out[2] = point->
GetZOut();
454 Double_t back_direction[3] = {(point_in[0] - point_out[0]), (point_in[1] - point_out[1]),
455 (point_in[2] - point_out[2])};
456 if (back_direction[2] > 0) {
457 LOG(debug2) <<
"CbmTrdRadiator::LatticeHit: MC-track points towards target!";
462 Double_t trackLength = TMath::Sqrt(back_direction[0] * back_direction[0] + back_direction[1] * back_direction[1]
463 + back_direction[2] * back_direction[2]);
467 gGeoManager->FindNode((point_out[0] + point_in[0]) / 2, (point_out[1] + point_in[1]) / 2,
468 (point_out[2] + point_in[2]) / 2);
470 Double_t
pos[3] = {point_in[0], point_in[1], point_in[2]};
472 for (
Int_t i = 0; i < 3; i++) {
473 back_direction[i] /= trackLength;
476 if (TString(gGeoManager->GetPath()).Contains(
"gas")) {
480 pos[2] >= point_in[2] - 5 && stepCount < 50) {
483 for (
Int_t i = 0; i < 3; i++) {
484 pos[i] += back_direction[i];
488 gGeoManager->FindNode(
pos[0],
pos[1],
pos[2]);
489 if (TString(gGeoManager->GetPath()).Contains(
"radiator")) {
493 else if (TString(gGeoManager->GetPath()).Contains(
"lattice")) {
497 else if (TString(gGeoManager->GetPath()).Contains(
"frame")) {
507 LOG(error) <<
"CbmTrdRadiator::LatticeHit: MC-track not in TRD! Node:" << TString(gGeoManager->GetPath()).Data()
508 <<
" gGeoManager->MasterToLocal() failed!";
513 LOG(error) <<
"CbmTrdRadiator::LatticeHit: CbmTrdPoint == nullptr!";
525 Double_t trackMomentum[
fNMom] = {0.1, 0.25, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
544 fFinal[i]->SetBinContent(j + 1, tmp);
644 Int_t maxPhoton = 50;
645 Double32_t eLoss = 0;
650 LOG(error) <<
" -Err :: No input spectra ";
655 if (nPhoton > maxPhoton) nPhoton = maxPhoton;
656 for (
Int_t i = 0; i < nPhoton; i++) {
664 LOG(error) <<
" -Err :: No input spectra ";
669 if (nPhoton > maxPhoton) nPhoton = maxPhoton;
670 for (
Int_t i = 0; i < nPhoton; i++) {
672 eTR =
fFinal[index]->GetRandom();
678 fELoss = eLoss / 1000000.0;
696 const Float_t kAlpha = 0.0072973;
697 const Int_t kSumMax = 30;
727 for (
Int_t iSum = 0; iSum < kSumMax; iSum++) {
728 Float_t tetan = (TMath::Pi() * 2.0 * (iSum + 1) - (rho1 + kappa * rho2)) / (kappa + 1.0);
729 if (tetan < 0.0) { tetan = 0.0; }
730 Float_t aux = 1.0 / (rho1 + tetan) - 1.0 / (rho2 + tetan);
731 sum += tetan * (aux * aux) * (1.0 - TMath::Cos(rho1 + tetan));
736 Float_t energykeV = energyeV * 0.001;
739 Float_t wn = kAlpha * 4.0 / (
fSigma[iBin] * (kappa + 1.0)) * conv * sum / energykeV;
851 Float_t result = TMath::Sqrt(p2 + massE * massE) / massE;
902 Float_t energyMeV = energykeV * 0.001;
915 LOG(error) <<
"ERROR:: unknown radiator material";
918 if (energyMeV >= 0.001) {
936 Float_t energyMeV = energykeV * 0.001;
937 if (energyMeV >= 0.001) {
962 Float_t energyMeV = energykeV * 0.001;
964 if (energyMeV >= 0.001) {
1077 Int_t istat =
Locate(en, n, energyMeV, index, de);
1083 (TMath::Log(mu[index]) - de * (TMath::Log(mu[index]) - TMath::Log(mu[index + 1])) / (en[index + 1] - en[index]));
1084 return TMath::Exp(result);
1099 if (xval >= xv[n - 1])
return 1;
1100 if (xval < xv[0])
return -1;
1106 while (kh - kl > 1) {
1107 if (xval < xv[km = (kl + kh) / 2]) kh = km;
1111 if (xval < xv[kl] || xval > xv[kl + 1] || kl >= n - 1) {
1112 printf(
"Locate failed xv[%d] %f xval %f xv[%d] %f!!!\n", kl, xv[kl], xval, kl + 1, xv[kl + 1]);
1117 if (xval == 0.001) LOG(info) <<
"Locat = 0";
ClassImp(CbmConverterManager)
Container for gas properties of TRD.
Float_t(* GetMuPtr)(Float_t)
Double_t GetNobleGas() const
Double_t GetGasThick() const
static CbmTrdGas * Instance()
static constexpr Float_t fMu_c[46]
static const Int_t fKN_xe
static constexpr Float_t fMu_ka[46]
static constexpr Float_t fEn_co2[36]
static Int_t Locate(const Float_t *xv, Int_t n, Float_t xval, Int_t &kl, Float_t &dx)
Bool_t LatticeHit(const CbmTrdPoint *point)
Float_t SigmaDet(Float_t energykeV)
static const Int_t fNMom
TR passed through Detector.
static Float_t GetMuKa(Float_t energyMeV)
CbmTrdRadiator(Bool_t SimpleTR=true, Int_t Nfoils=337, Float_t FoilThick=0.0012, Float_t GapThick=0.09, TString material="pefoam20", TString window="Kapton")
Float_t Sigma(Float_t energykeV)
static constexpr Float_t fEn_c[46]
static Float_t GetMuC(Float_t energyMeV)
static Float_t GetMuPo(Float_t energyMeV)
void SetSigma(Int_t SigmaT)
static constexpr Float_t fEn_my[36]
Float_t fnTRabs[fNMom]
Absorption spectra for different momenta.
Float_t * fSigmaDet
[fSpNBins] Array of sigma values for the entrance window of detector
static const Int_t fKN_pok
static Float_t GetMuXe(Float_t energyMeV)
static const Int_t fKN_co2
static Float_t GetMuAir(Float_t energyMeV)
static constexpr Float_t fMu_my[36]
static constexpr Float_t fEn_pok[46]
CbmTrdEntranceWindow WINDOW
Float_t * fSigmaWin
[fSpNBins] Array of sigma values for the foil of the radiator
static const Int_t fKN_po
static constexpr Float_t fMu_al[48]
static constexpr Float_t fMu_pok[46]
static Float_t Interpolate(Float_t energyMeV, const Float_t *en, const Float_t *mu, Int_t n)
Float_t SigmaWin(Float_t energykeV)
static constexpr Float_t fMu_co2[36]
TH1D * fDetSpectrumA
TR spectra in gas-window foil.
TH1D * fDetSpectrum
TR absorbed in Detector.
static const Int_t fKN_ka
Float_t GetTR(TVector3 mom)
Double_t * fTrackMomentum
static constexpr Float_t fEn_ka[46]
static const Int_t fSpNBins
TH1D * fSpectrum
[fSpNBins] Array of sigma values for the active gas
TH1D * fWinSpectrum
TR photon energy spectrum.
static constexpr Float_t fMu_po[36]
static constexpr Float_t fMu_air[38]
void SetEWwidths(Int_t n, Float_t *w)
static const Int_t fSpRange
static Float_t GetMuAl(Float_t energyMeV)
static constexpr Float_t fEn_al[48]
static constexpr Float_t fEn_po[36]
static constexpr Float_t fMu_xe[48]
static const Int_t fKN_air
static Float_t GetMuMy(Float_t energyMeV)
virtual ~CbmTrdRadiator()
static constexpr Float_t fEn_xe[48]
static Float_t GetMuCO2(Float_t energyMeV)
static Float_t GetMuPok(Float_t energyMeV)
static const Int_t fKN_al
static constexpr Float_t fEn_air[38]
static const Int_t fKN_my
TH1D * fFinal[fNMom]
[fNMom] Track momenta for which spectra
GetMuPtr GetMu[NCOMPONENTS]
Float_t fThick[NCOMPONENTS]
TString fMat[NCOMPONENTS]
Float_t fDens[NCOMPONENTS]
CbmTrdEntranceWindow(TString def="")