FairRoot/PandaRoot
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PndMdtParamDigi Class Reference

#include <PndMdtParamDigi.h>

Inheritance diagram for PndMdtParamDigi:

Classes

struct  AvaBinType
 
struct  ClusInfo
 

Public Member Functions

 PndMdtParamDigi ()
 
 ~PndMdtParamDigi ()
 
void SetVerbose (Int_t v)
 
Bool_t Init ()
 
PndMdtParamDigiSetParams (Int_t ptlType, TVector3 iniP, TVector3 iniPos, TVector3 finalPos, Double_t stripLen=100.)
 
void UseNoise (Bool_t swith)
 
void UseDetailedSim (Bool_t swith=kTRUE)
 
void UsePlot (Bool_t swith=kTRUE)
 
void UseGaussianAmp (Bool_t swith)
 
void SetOptimization (Int_t val)
 
void SetNoiseWidth (Double_t anode, Double_t strip)
 
std::vector< std::pair< Int_t,
Double_t > > 
GetFiredInfo ()
 
void Compute (Bool_t useConvolution=kTRUE)
 
const std::vector< Double_t > & GetWireSignal () const
 
const std::map< Int_t,
std::vector< Double_t > > & 
GetStripSignals () const
 
void Draw ()
 

Private Member Functions

void GetSignal (Bool_t useConvolution=kTRUE)
 
Bool_t Digitize (Double_t &time, Double_t &amp)
 
Bool_t Digitize (Int_t stripNo, Double_t &time, Double_t &amp)
 
void GetRawSignalbySimAvalanche (Double_t fNoiseLevel=1.)
 
void GetRawSignalbyWeightingAvalanche (Double_t fNoiseLevel=1.)
 
void AddNoise (Double_t fNoiseLevel=1., Int_t isAnode=1)
 
void ApplyTransferFunction (Double_t *fSignalData, Int_t nSize=fSamplingSize)
 
Double_t GetElectronDriftTime (TVector2 iniPos)
 
Double_t GetShiftTime (TVector2 fWireSurfacePos, TVector2 fProductionPos)
 
void GetMPVofPrimaryIonization (Int_t particleType, const TVector3 &momentum, ValueErrorType &val) const
 
Int_t GetAmplicationFactor (Int_t particleType, Double_t momentum) const
 
void SamplingPosition (TVector2 fDirection, TVector2 &fIonProductionPos)
 
Double_t GetMeanFreePath (Int_t ptlType, Double_t mom) const
 
 ClassDef (PndMdtParamDigi, 1)
 

Private Attributes

Int_t fSamplingRate
 
Int_t fSamplingInterval
 
std::vector< Double_tfSignalDataAnode
 
std::map< Int_t, std::vector
< Double_t > > 
fSignalDataStripM
 
TF1 * fTrF
 
Bool_t fUseNoise
 
Bool_t fGaussianAmp
 
Double_t fNoiseSigmaAnode
 
Double_t fNoiseSigmaStrip
 
Int_t fNumofTruncation
 
Int_t fParticleType
 
TVector3 fParticleMomentum
 
TVector3 fInitPostion
 
TVector3 fExitPosition
 
Bool_t fParamsChanged
 
Double_t fStripLength
 
Double_t fRestMass [5]
 
Bool_t fDetailedSim
 
TGraphErrors * gFreePath [5]
 
Bool_t fUseAvaHist
 
TH1F * hAvaSize
 
Double_t cWIRERADIUS
 
Double_t cCELLSIZE
 
Double_t cSTRIPWIDTH
 
Double_t cMAXRADIUS
 
Double_t cMAPFACTOR
 
Double_t cUNITLOGDR
 
Double_t cUNITPHI
 
TH1F * hAnodeI1d [NRAD]
 
TH1F * hCathodeI2d [NRAD][NPHI]
 
Int_t fNr [NRAD]
 
Int_t fNrNphi [NRAD *NPHI]
 
Bool_t fUsePlot
 
TH1F * hIndex
 
TH2F * h2dIndex
 
TH2F * hTrack
 
TH1F * hIonNum
 
TH2F * hAvaPos
 
TH1F * hAvaNum
 
TH1F * hAva1D
 
TH2F * hAva2D
 
TH1F * hExp1
 
TH1F * hExp2
 
TH1F * hGen
 
TH1F * hLan
 
Int_t fVerbose
 
std::vector< AvaBinTypefProbFunc1D
 
std::vector< AvaBinTypefProbFunc2D
 
Double_t SPEEDOFLIGHT
 
CLHEP::RandGeneral * fRandAva
 

Static Private Attributes

static const Int_t fSamplingSize = 20
 
static const Int_t NRAD = 100
 
static const Int_t NPHI = 100
 

Detailed Description

Definition at line 27 of file PndMdtParamDigi.h.

Constructor & Destructor Documentation

PndMdtParamDigi::PndMdtParamDigi ( )

Default constructor

Definition at line 30 of file PndMdtParamDigi.cxx.

References cCELLSIZE, cMAPFACTOR, cMAXRADIUS, cSTRIPWIDTH, cUNITLOGDR, cUNITPHI, cWIRERADIUS, fRestMass, fSamplingInterval, fSamplingRate, CAMath::Log(), NPHI, NRAD, Pi, and SPEEDOFLIGHT.

31  : TNamed("PndMdtParamDigi", "parameterized simulation of MDT")
32  , fSamplingRate(1e8)
33  , fTrF(0)
34  , fUseNoise(kTRUE)
35  , fGaussianAmp(kTRUE)
36  , fNoiseSigmaAnode(1e-3)
37  , fNoiseSigmaStrip(1e-5)
38  , fNumofTruncation(1.)
39  , fParamsChanged(kTRUE)
40  , fDetailedSim(kFALSE)
41  , fUseAvaHist(kFALSE)
42  , fUsePlot(kTRUE)
43  , fVerbose(0)
44 {
45  cWIRERADIUS = 0.0025001;//unit: cm
46  cCELLSIZE = 0.5;//unit: cm
47  cSTRIPWIDTH = 1.0;//unit: cm
48  cMAXRADIUS = 0.00525;//not changeable
49  cMAPFACTOR = 1000.;//not changeable
50 
52  cUNITPHI = TMath::Pi()*2./NPHI;
54  fRestMass[0] = 0.00510998928;
55  fRestMass[1] = 0.1056583715;
56  fRestMass[2] = 0.13957018;
57  fRestMass[3] = 0.493667;
58  fRestMass[4] = 0.938272046;// GeV
59 
60  SPEEDOFLIGHT = 299792458;//m/s
61 }
static const Int_t NRAD
Double_t fRestMass[5]
Double_t fNoiseSigmaStrip
Double_t fNoiseSigmaAnode
static const Int_t NPHI
static T Log(const T &x)
Definition: PndCAMath.h:40
Double_t Pi
PndMdtParamDigi::~PndMdtParamDigi ( )

Destructor

Definition at line 158 of file PndMdtParamDigi.cxx.

158 { }

Member Function Documentation

void PndMdtParamDigi::AddNoise ( Double_t  fNoiseLevel = 1.,
Int_t  isAnode = 1 
)
private

Definition at line 621 of file PndMdtParamDigi.cxx.

References Double_t, fNoiseSigmaAnode, fNoiseSigmaStrip, fSamplingSize, fSignalDataAnode, fSignalDataStripM, and i.

Referenced by GetRawSignalbySimAvalanche(), and GetRawSignalbyWeightingAvalanche().

622 {
623  Double_t fSigmaAnode = fNoiseLevel*fNoiseSigmaAnode;//micro ampere
624  Double_t fSigmaStrip = fNoiseLevel*fNoiseSigmaStrip;//micro ampere
625 
626  std::map<Int_t, std::vector<Double_t> >::iterator it = fSignalDataStripM.begin();
627  std::map<Int_t, std::vector<Double_t> >::iterator end = fSignalDataStripM.end();
628  while( it != end){
629  std::vector<Double_t>& fSignalDataStrip = it->second;
630  for(Int_t i=0; i< fSamplingSize; ++i){
631  fSignalDataStrip[i] += gRandom->Gaus(0, fSigmaStrip);
632  }
633  ++ it;
634  }
635  for(Int_t i=0; i< fSamplingSize; ++i){
636  fSignalDataAnode[i] += gRandom->Gaus(0, fSigmaAnode);
637  }
638 }
Double_t fNoiseSigmaStrip
Int_t i
Definition: run_full.C:25
static const Int_t fSamplingSize
Double_t fNoiseSigmaAnode
Double_t
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
std::vector< Double_t > fSignalDataAnode
void PndMdtParamDigi::ApplyTransferFunction ( Double_t fSignalData,
Int_t  nSize = fSamplingSize 
)
private

Definition at line 590 of file PndMdtParamDigi.cxx.

References Double_t, fSamplingSize, fTrF, i, and t.

Referenced by GetSignal().

591 {
592  Double_t dt=0.01;//microsecond
593  Double_t t(0.);
594  Double_t fIntegral(0.);
595  Double_t dtau(0.);
596  Double_t fF(0.);
597  Double_t fG(0.);
598  Double_t tprime(0.);
599  Int_t iBin(1);
600  dtau = (fTrF->GetXmax() - fTrF->GetXmin())/1.e3;
601  Double_t fSigCopy[fSamplingSize];
602  if(fTrF){
603  memcpy(fSigCopy, fSignalData, fSamplingSize*sizeof(Double_t));
604  //std::vector<Double_t> fSigCopy(fSignalData.begin(),fSignalData.end());
605  for(Int_t i=0; i< fSamplingSize; ++i){
606  t = i*dt;//microsecond
607  fIntegral = 0.;
608  tprime = fTrF->GetXmin();
609  while( tprime < fTrF->GetXmax()){
610  iBin = (Int_t)(tprime/dt);
611  fF = (iBin <0 || iBin > fSamplingSize) ? 0 : fSigCopy[iBin];
612  fG = (t-tprime < fTrF->GetXmin()) || (t-tprime > fTrF->GetXmax()) ? 0 :fTrF->Eval((t-tprime));//convent to microsecond
613  fIntegral += fF*fG*dtau;
614  tprime += dtau;
615  }
616  fSignalData[i] = fIntegral;
617  }
618  }
619 }
Int_t i
Definition: run_full.C:25
static const Int_t fSamplingSize
Double_t
TTree * t
Definition: bump_analys.C:13
PndMdtParamDigi::ClassDef ( PndMdtParamDigi  ,
 
)
private
void PndMdtParamDigi::Compute ( Bool_t  useConvolution = kTRUE)

Definition at line 242 of file PndMdtParamDigi.cxx.

References GetSignal().

Referenced by PndMdtPointsToWaveform::exec_e(), and PndMdtPointsToWaveform::exec_t().

243 {
244  GetSignal(useConvolution);
245 }
void GetSignal(Bool_t useConvolution=kTRUE)
Bool_t PndMdtParamDigi::Digitize ( Double_t time,
Double_t amp 
)
private

Definition at line 640 of file PndMdtParamDigi.cxx.

References CAMath::Abs(), Bool_t, Double_t, fNoiseSigmaAnode, fSamplingInterval, fSamplingSize, fSignalDataAnode, and is.

Referenced by GetFiredInfo().

641 {
642  time = -1;
643  amp = -9999;
644  Double_t fPeak = 0.;
645  Bool_t NotFound = kTRUE;
646  for(size_t is=0; is < fSamplingSize; ++ is){
648  if(TMath::Abs(fSignalDataAnode[is]) > 5*fNoiseSigmaAnode && NotFound) {
649  time = is*fSamplingInterval;//nano seconds
650  NotFound = kFALSE;
651  }
652  }
653  amp = fPeak;
654  return time > 0;
655 }
static const Int_t fSamplingSize
static T Abs(const T &x)
Definition: PndCAMath.h:39
Double_t fNoiseSigmaAnode
Double_t
static int is
Definition: ranlxd.cxx:374
std::vector< Double_t > fSignalDataAnode
Bool_t PndMdtParamDigi::Digitize ( Int_t  stripNo,
Double_t time,
Double_t amp 
)
private

Definition at line 656 of file PndMdtParamDigi.cxx.

References CAMath::Abs(), Bool_t, Double_t, fNoiseSigmaStrip, fSamplingInterval, fSamplingSize, fSignalDataStripM, and is.

657 {
658  time = -1;
659  amp = -9999;
660  Double_t fPeak = 0.;
661  Bool_t NotFound = kTRUE;
662  std::vector<Double_t>& fSignalDataStrip = fSignalDataStripM[id];
663  for(size_t is=0; is < fSamplingSize; ++ is){
664  if(TMath::Abs(fSignalDataStrip[is]) > TMath::Abs(fPeak)) fPeak = fSignalDataStrip[is];
665  if(TMath::Abs(fSignalDataStrip[is]) > 5*fNoiseSigmaStrip && NotFound) {
666  time = is*fSamplingInterval;//nano seconds
667  NotFound = kFALSE;
668  }
669  }
670  amp = fPeak;
671  return time > 0;
672 }
Double_t fNoiseSigmaStrip
static const Int_t fSamplingSize
static T Abs(const T &x)
Definition: PndCAMath.h:39
Double_t
static int is
Definition: ranlxd.cxx:374
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
void PndMdtParamDigi::Draw ( )

Definition at line 182 of file PndMdtParamDigi.cxx.

References c, c1, c2, fSamplingInterval, fSamplingSize, fSignalDataAnode, fSignalDataStripM, fUsePlot, h2dIndex, hAva1D, hAva2D, hAvaPos, hExp1, hGen, hIndex, hIonNum, hLan, hTrack, i, name, and TString.

183 {
184  if(fUsePlot)
185  {
186  TCanvas* c = new TCanvas("cPndMdtParamDigi", "PndMdtParamDigi", 800, 600);
187  c->Divide(2,3);
188  c->cd(1);
189  hTrack->Draw("colz");
190  c->cd(2);
191  //hAva2D->Draw("colz");
192  hIonNum->Draw();
193  c->cd(3);
194  hAvaPos->Draw("colz");
195  c->cd(5);
196  hIndex->DrawNormalized();
197  c->cd(5);
198  hAva1D->SetLineColor(kRed);
199  hAva1D->SetLineWidth(2);
200  hAva1D->Draw("same");
201  c->cd(6);
202  hAva2D->Draw("colz");
203  c->cd(4);
204  h2dIndex->Draw("colz");
205  TCanvas* c2 = new TCanvas("dist", "PndMdtParamDigi", 800, 600);
206  c2->Divide(2,2);
207  c2->cd(1);
208  hExp1->Draw();
209  c2->cd(2);
210  c2->cd(3);
211  hGen->Draw();
212  c2->cd(4);
213  hLan->Draw();
214  }
215  TCanvas* c1 = new TCanvas("cSignal", "Signals", 900, 900);
216  c1->Divide(3, (fSignalDataStripM.size() + 1)/3);
217  c1->cd(1);
218  TH1F* hAI = new TH1F("hAI","induced current @anode", fSamplingSize, 0, fSamplingSize*fSamplingInterval/1.e3);
219  hAI->GetYaxis()->SetTitle("I(#muA)");
220  for(Int_t i=0; i < fSamplingSize; ++i){
221  hAI->SetBinContent(i+1, fSignalDataAnode[i]);
222  }
223  hAI->Draw();
224  std::map<Int_t, std::vector<Double_t> >::iterator it = fSignalDataStripM.begin();
225  std::map<Int_t, std::vector<Double_t> >::iterator end = fSignalDataStripM.end();
226  Int_t ipad=1;
227  for(; it != end; ++it, ++ipad){
228  c1->cd(1+ipad);
229  TString name="hCI";
230  name += it->first;
231  TString title="induced current @strip ";
232  title += it->first;
233  TH1F* hCI = new TH1F(name, title, fSamplingSize, 0, fSamplingSize*fSamplingInterval/1.e3);
234  hCI->GetYaxis()->SetTitle("I(#muA)");
235  std::vector<Double_t>& fSignalDataStrip = it->second;
236  for(Int_t i=0; i < fSamplingSize; ++i){
237  hCI->SetBinContent(i+1, fSignalDataStrip[i]);
238  }
239  hCI->Draw();
240  }
241 }
Int_t i
Definition: run_full.C:25
c2
Definition: plot_dirc.C:39
static const Int_t fSamplingSize
c1
Definition: plot_dirc.C:35
TString name
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
std::vector< Double_t > fSignalDataAnode
Int_t PndMdtParamDigi::GetAmplicationFactor ( Int_t  particleType,
Double_t  momentum 
) const
private

Definition at line 684 of file PndMdtParamDigi.cxx.

References Double_t.

685 {
686  TGraphErrors* gAmp(0);
687  if(!gAmp){
688  gAmp= new TGraphErrors(9);
689  gAmp->SetPoint(0, 0.05, 5440.5);
690  gAmp->SetPointError(0, 0, 2402.1);
691  gAmp->SetPoint(1, 0.10, 5683.1);
692  gAmp->SetPointError(1, 0, 2661.3);
693  gAmp->SetPoint(2, 0.20, 5774.8);
694  gAmp->SetPointError(2, 0, 2803.5);
695  gAmp->SetPoint(3, 0.30, 5629.1);
696  gAmp->SetPointError(3, 0, 2590.4);
697  gAmp->SetPoint(4, 0.50, 5708.1);
698  gAmp->SetPointError(4, 0, 2734.2);
699  gAmp->SetPoint(5, 1.00, 5667.6);
700  gAmp->SetPointError(5, 0, 2755.5);
701  gAmp->SetPoint(6, 2.00, 5958.2);
702  gAmp->SetPointError(7, 0, 2712.1);
703  gAmp->SetPoint(7, 5.00, 5643.8);
704  gAmp->SetPointError(7, 0, 2389.5);
705  gAmp->SetPoint(8, 10.00, 5749.3);
706  gAmp->SetPointError(8, 0, 2552.6);
707  }
708  const Double_t fScaleFactor = 1.0;//simulation calibration to experiments
709  Double_t fMeanAmp = gAmp->Eval(momentum);
710  Double_t fAmpErr = gAmp->GetErrorY(momentum);
711  return (Int_t) fScaleFactor*gRandom->Gaus(fMeanAmp, fAmpErr);
712 }
Double_t
Double_t PndMdtParamDigi::GetElectronDriftTime ( TVector2  iniPos)
inlineprivate

Definition at line 102 of file PndMdtParamDigi.h.

References cWIRERADIUS, Double_t, log(), p1, p2, and x.

Referenced by GetRawSignalbySimAvalanche(), and GetRawSignalbyWeightingAvalanche().

103  {
104  const Double_t p0 = 5.35513e+03;
105  const Double_t p1 = 3.92749e+02;
106  const Double_t p2 = -5.41433e+03;
107  const Double_t p3 = -3.31810e+03;
108  Double_t x = iniPos.Mod() - cWIRERADIUS;
109  Double_t x1 = log(1.+x);
110  return (x*(p0 + p1*pow(x, 0.25)) + x1*(p2 + p3*x1));
111  }
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
Double_t
TPad * p2
Definition: hist-t7.C:117
Double_t x
TPad * p1
Definition: hist-t7.C:116
std::vector< std::pair< Int_t, Double_t > > PndMdtParamDigi::GetFiredInfo ( )

Definition at line 545 of file PndMdtParamDigi.cxx.

References Digitize(), Double_t, fSignalDataStripM, and GetSignal().

546 {
547  std::vector<std::pair<Int_t, Double_t> > fFiredInfo;
548  Double_t mTime;
549  Double_t mAmplitude;
550  GetSignal();
551 
552  if(Digitize(mTime, mAmplitude))
553  fFiredInfo.push_back(std::pair<Int_t, Double_t>(-1, mTime));
554 
555  std::map<Int_t, std::vector<Double_t> >::iterator it = fSignalDataStripM.begin();
556  std::map<Int_t, std::vector<Double_t> >::iterator end = fSignalDataStripM.end();
557  for(; it != end; ++it){
558  if(Digitize(it->first, mTime, mAmplitude)){
559  fFiredInfo.push_back(std::pair<Int_t, Double_t>(it->first, mTime));
560  }
561  }
562  return fFiredInfo;
563 }
Bool_t Digitize(Double_t &time, Double_t &amp)
void GetSignal(Bool_t useConvolution=kTRUE)
Double_t
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
Double_t PndMdtParamDigi::GetMeanFreePath ( Int_t  ptlType,
Double_t  mom 
) const
inlineprivate

Definition at line 143 of file PndMdtParamDigi.h.

References Double_t, fRestMass, and gFreePath.

144  {
145  Double_t mMass = fRestMass[ptlType];
146  //Double_t mEnergy = sqrt(mom*mom + mMass*mMass);
147  Double_t mBeta = mom/mMass;
148  Double_t mPath = gFreePath[ptlType]->Eval(mBeta);
149  return gRandom->Exp(mPath);
150  }
Double_t fRestMass[5]
Double_t mom
Definition: plot_dirc.C:14
Double_t
TGraphErrors * gFreePath[5]
void PndMdtParamDigi::GetMPVofPrimaryIonization ( Int_t  particleType,
const TVector3 &  momentum,
ValueErrorType val 
) const
private

Definition at line 720 of file PndMdtParamDigi.cxx.

References Double_t, exp(), fRestMass, log(), p1, and p2.

Referenced by GetRawSignalbySimAvalanche(), and GetRawSignalbyWeightingAvalanche().

721 {
722  Double_t p0 = 9.83401e-01;
723  Double_t p1 = 7.42822e-02;
724  Double_t p2 = 5.62250e-01;
725  Double_t p3 = 2.22743e-01;
726  //index: electron 0, muon 1, pion 2, kaon, 3, proton 4;
727  Double_t fMass = fRestMass[particleType];
728  Double_t betagamma = fMomentum.Mag()/fMass;
729  val.first = p0*exp(p1*log(1+betagamma)) + p2/(pow(betagamma, p3));
730  val.second = betagamma < 0.3 ? 0.234 : 0.334;
731 }
Double_t fRestMass[5]
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
Double_t
TPad * p2
Definition: hist-t7.C:117
TPad * p1
Definition: hist-t7.C:116
void PndMdtParamDigi::GetRawSignalbySimAvalanche ( Double_t  fNoiseLevel = 1.)
private

Definition at line 247 of file PndMdtParamDigi.cxx.

References AddNoise(), cMAPFACTOR, cSTRIPWIDTH, cUNITLOGDR, cUNITPHI, cWIRERADIUS, Double_t, fExitPosition, fInitPostion, fNumofTruncation, fParamsChanged, fParticleMomentum, fParticleType, fRestMass, fSamplingInterval, fSamplingSize, fSignalDataAnode, fSignalDataStripM, fUseNoise, fUsePlot, GetElectronDriftTime(), GetMPVofPrimaryIonization(), gFreePath, h2dIndex, hAnodeI1d, hAvaNum, hAvaPos, hAvaSize, hCathodeI2d, hIndex, hIonNum, hTrack, jj, CAMath::Log(), NPHI, NRAD, SamplingPosition(), and SPEEDOFLIGHT.

248 {
249 
250  if(!fParamsChanged) return;
251 
252  fParamsChanged = kFALSE;
253  memset(&fSignalDataAnode[0], 0, fSamplingSize*sizeof(Double_t));
254  //memset(&fSignalDataStrip[0], 0, fSamplingSize*sizeof(Double_t));
255  fSignalDataStripM.clear();
256 
257  TVector3 fUnitMotion = (fExitPosition-fInitPostion).Unit();
258  Double_t fMaxPath = (fExitPosition-fInitPostion).Mag();
260  if(fParticleType == 4 && mBeta < 0.2) return;
261  Double_t mPath = gFreePath[fParticleType]->Eval(mBeta);
262  if(mPath < 0.) return;
263  const Double_t fScaleFactor = 40.;
264 
265  Int_t jj;
266  Int_t ii;
267 
268  ValueErrorType NumofPrimaryIonizaionMpv;
269  GetMPVofPrimaryIonization(fParticleType, fParticleMomentum, NumofPrimaryIonizaionMpv);
270 
271 
272  TVector3 fCurrentPosofCluster = fInitPostion;
273  Int_t fNumofCluster(0);
274  Int_t fNumofSingleIonization =0;
275  Int_t fNumofTotalIonizaion = 0;
276  Int_t fNumofIonsofThisCluster = 0;
277  Int_t fNumofTotalIons = 0;
278  TVector2 fIonProductionPos;
279  Double_t fStepLen = 0.;
280  Double_t fTrackLen = 0.;
281  Double_t fTime = 0.;
282 
283  TStopwatch sw;
284  sw.Start();
285  do
286  {
287  fStepLen = gRandom->Exp(mPath);
288  fTime += fStepLen/(mBeta*SPEEDOFLIGHT*1.e7);//nano second
289  fTrackLen += fStepLen;
290  fCurrentPosofCluster += fStepLen*fUnitMotion;
291 
292  if(fCurrentPosofCluster.XYvector().Mod() <= cWIRERADIUS)
293  continue;
294 
295  fNumofSingleIonization = gRandom->Landau(NumofPrimaryIonizaionMpv.first, NumofPrimaryIonizaionMpv.second);
296  fNumofTotalIonizaion += fNumofSingleIonization;
297 
298  if(fUsePlot){
299  hIonNum->Fill(fNumofSingleIonization);
300  hTrack->Fill(fCurrentPosofCluster.X(), fCurrentPosofCluster.Y());
301  }
302 
303  Int_t iSign = fCurrentPosofCluster.Z() >= 0 ? 1 : -1;
304  Int_t zIndex = Int_t(fCurrentPosofCluster.Z()/cSTRIPWIDTH + iSign*0.5);
305  zIndex = zIndex >= 0 ? zIndex*2 : -2*zIndex -1;
306 
307 
308  //cout<<"fSignalDataStrip.size()#"<<fSignalDataStrip.size()<<endl;
309  std::vector<Double_t>& fSignalDataStrip = fSignalDataStripM[zIndex];
310  if(fSignalDataStrip.size() != fSamplingSize)
311  fSignalDataStrip.resize(fSamplingSize);
312 
313  if(fNumofSingleIonization > 0)
314  {
315  fNumofIonsofThisCluster = hAvaSize->GetRandom();
316  fNumofTotalIons += fNumofIonsofThisCluster;
317  if(fUsePlot)
318  hAvaNum->Fill(fNumofIonsofThisCluster);
319 
320  if( fNumofIonsofThisCluster > 10 )
321  {
322  //Double_t lx = fCurrentPosofCluster.XYvector().Mod() - cWIRERADIUS;
323  //Double_t lx1 = log(1.+lx);
324  //clusInfo.fStartTime = fTime + (lx*(p0 + p1*pow(lx, 0.25)) + lx1*(p2 + p3*lx1));
325 
326  Double_t fStartTime = fTime + GetElectronDriftTime(fCurrentPosofCluster.XYvector());//micro second
327  Int_t tShift = Int_t(fStartTime/fSamplingInterval);
328  if(tShift >= fSamplingSize) tShift = fSamplingSize-1;
329  //Int_t refPhiIndex = Int_t(fCurrentPosofCluster.Phi()/cUNITPHI); //[R.K. 01/2017] unused variable?
330  //if(refPhiIndex>=100) refPhiIndex = 99;
331 
332  TVector2 unitV = fCurrentPosofCluster.XYvector().Unit();
333  std::map<Int_t, Int_t> fAnodeIndex;//fired region
334  std::map<Int_t, Int_t> fStripIndex;//fired region
335 
336  for(ii = 0; ii < fNumofIonsofThisCluster; ++ii)
337  {//avalanche profile
338  //get position of this ion
339  SamplingPosition(unitV, fIonProductionPos);
340  //cout<<"sampling done, r = "<<fIonProductionPos.Mod()<<endl;
341  Int_t rIndex = Int_t(TMath::Log(1. + cMAPFACTOR*(fIonProductionPos.Mod() - cWIRERADIUS))/cUNITLOGDR);
342  Int_t phiIndex = Int_t(fIonProductionPos.Phi()/cUNITPHI);
343  if(fUsePlot){
344  hIndex->Fill(rIndex);
345  //h2dIndex->Fill(rIndex, phiIndex-refPhiIndex < 0 ? 100 + phiIndex-refPhiIndex : phiIndex-refPhiIndex);
346  h2dIndex->Fill(rIndex, phiIndex);
347  hAvaPos->Fill(fIonProductionPos.X(), fIonProductionPos.Y());
348  }
349  //cout<<"plot done"<<endl;
350  //if(rIndex>=NRAD) rIndex = NRAD-1;
351  //if(phiIndex >= NPHI) phiIndex = NPHI -1;
352  if(rIndex>=NRAD) continue;
353  if(phiIndex >= NPHI) continue;
354  //cout<<"rIndex = "<<rIndex<<", phiIndex = "<<phiIndex<<endl;
355  ++ fAnodeIndex[rIndex];
356  ++ fStripIndex[rIndex + phiIndex*NRAD];
357  }
358  std::map<Int_t, Int_t>::const_iterator mit = fAnodeIndex.begin();
359  std::map<Int_t, Int_t>::const_iterator mend = fAnodeIndex.end();
360  for(; mit != mend; ++mit){
361  if(mit->second > fNumofTruncation){
362  for(ii = tShift, jj=1; ii < fSamplingSize; ++ii, ++jj){
363  fSignalDataAnode[ii] += mit->second * hAnodeI1d[mit->first]->GetBinContent(jj);
364  }
365  }
366  }
367  mit = fStripIndex.begin();
368  mend = fStripIndex.end();
369  for(; mit != mend; ++mit){
370  Double_t fN = mit->second;
371  if(fN > fNumofTruncation)
372  {
373  Int_t rIdx = mit->first%NRAD;
374  Int_t phiIdx = mit->first/NRAD;
375  //cout<<"Index ("<<rIdx<<", "<<phiIdx<<") = "<<fN<<endl;
376  for(ii = tShift, jj=1; ii < fSamplingSize; ++ii, ++jj){
377  fSignalDataStrip[ii] += fScaleFactor* mit->second * hCathodeI2d[rIdx][phiIdx]->GetBinContent(jj);
378  }
379  }
380  }
381  }
382  }
383  ++ fNumofCluster;
384  }while(fTrackLen < fMaxPath);
385 
386  if(fUseNoise){
387  AddNoise(fNoiseLevel);
388  }
389  sw.Stop();
390  cout<<"PndMdtParamDigi::GetRawSignal, cost "<<sw.CpuTime()<<" s"
391  <<" clusters#"<<fNumofCluster
392  <<" primary ionization#"<<fNumofTotalIonizaion
393  <<" total ions#"<<fNumofTotalIons<<endl;
394 }
std::pair< Double_t, Double_t > ValueErrorType
static const Int_t NRAD
Double_t fRestMass[5]
TH1F * hAnodeI1d[NRAD]
void AddNoise(Double_t fNoiseLevel=1., Int_t isAnode=1)
static const Int_t fSamplingSize
Double_t
static const Int_t NPHI
void GetMPVofPrimaryIonization(Int_t particleType, const TVector3 &momentum, ValueErrorType &val) const
TVector3 fParticleMomentum
static T Log(const T &x)
Definition: PndCAMath.h:40
Double_t GetElectronDriftTime(TVector2 iniPos)
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
void SamplingPosition(TVector2 fDirection, TVector2 &fIonProductionPos)
std::vector< Double_t > fSignalDataAnode
TGraphErrors * gFreePath[5]
TVector3 fExitPosition
TH1F * hCathodeI2d[NRAD][NPHI]
void PndMdtParamDigi::GetRawSignalbyWeightingAvalanche ( Double_t  fNoiseLevel = 1.)
private

Definition at line 395 of file PndMdtParamDigi.cxx.

References AddNoise(), cMAPFACTOR, CAMath::Cos(), cSTRIPWIDTH, cUNITLOGDR, cUNITPHI, cWIRERADIUS, Double_t, exp(), fExitPosition, fInitPostion, fNumofTruncation, fParamsChanged, fParticleMomentum, fParticleType, fProbFunc1D, fProbFunc2D, fRestMass, fSamplingInterval, fSamplingSize, fSignalDataAnode, fSignalDataStripM, fUseNoise, fUsePlot, GetElectronDriftTime(), GetMPVofPrimaryIonization(), gFreePath, h2dIndex, hAnodeI1d, hAvaNum, hAvaPos, hAvaSize, hCathodeI2d, hIndex, hIonNum, hTrack, PndMdtParamDigi::AvaBinType::Index, jj, NPHI, NRAD, PndMdtParamDigi::AvaBinType::Probabilty, CAMath::Sin(), SPEEDOFLIGHT, x, and y.

Referenced by GetSignal().

396 {
397  static Double_t fScaleFactor = 40.;
398 
399  if(!fParamsChanged) return;
400 
401  fParamsChanged = kFALSE;
402  memset(&fSignalDataAnode[0], 0, fSamplingSize*sizeof(Double_t));
403  //memset(&fSignalDataStrip[0], 0, fSamplingSize*sizeof(Double_t));
404  fSignalDataStripM.clear();
405 
406  TVector3 fUnitMotion = (fExitPosition-fInitPostion).Unit();
407  Double_t fMaxPath = (fExitPosition-fInitPostion).Mag();
409  Double_t mPath = gFreePath[fParticleType]->Eval(mBeta);
410  if(mPath < 0.) return;
411 
412  Int_t jj;
413  Int_t ii;
414 
415  ValueErrorType NumofPrimaryIonizaionMpv;
416  GetMPVofPrimaryIonization(fParticleType, fParticleMomentum, NumofPrimaryIonizaionMpv);
417 
418 
419  TVector3 fCurrentPosofCluster = fInitPostion;
420  Int_t fNumofCluster(0);
421  Int_t fNumofSingleIonization =0;
422  Int_t fNumofTotalIonizaion = 0;
423  Int_t fNumofIonsofThisCluster = 0;
424  Int_t fNumofTotalIons = 0;
425  Double_t fStepLen = 0.;
426  Double_t fTrackLen = 0.;
427  Double_t fTime = 0.;
428 
429  //TStopwatch sw;
430  //sw.Start();
431  do
432  {
433  fStepLen = gRandom->Exp(mPath);
434  fTime += fStepLen/(mBeta*SPEEDOFLIGHT*1.e7);//nano second
435  fTrackLen += fStepLen;
436  fCurrentPosofCluster += fStepLen*fUnitMotion;
437 
438  if(fCurrentPosofCluster.XYvector().Mod() <= cWIRERADIUS)
439  continue;
440 
441  fNumofSingleIonization = gRandom->Landau(NumofPrimaryIonizaionMpv.first, NumofPrimaryIonizaionMpv.second);
442  fNumofTotalIonizaion += fNumofSingleIonization;
443 
444  if(fUsePlot){
445  hIonNum->Fill(fNumofSingleIonization);
446  hTrack->Fill(fCurrentPosofCluster.X(), fCurrentPosofCluster.Y());
447  }
448 
449  Int_t iSign = fCurrentPosofCluster.Z() >= 0 ? 1 : -1;
450  Int_t zIndex = Int_t(fCurrentPosofCluster.Z()/cSTRIPWIDTH + iSign*0.5);
451  zIndex = zIndex >= 0 ? zIndex*2 : -2*zIndex -1;
452 
453 
454  //cout<<"fSignalDataStrip.size()#"<<fSignalDataStrip.size()<<endl;
455  std::vector<Double_t>& fSignalDataStrip = fSignalDataStripM[zIndex];
456  if(fSignalDataStrip.size() != fSamplingSize)
457  fSignalDataStrip.resize(fSamplingSize);
458 
459  if(fNumofSingleIonization > 0)
460  {
461  fNumofIonsofThisCluster = hAvaSize->GetRandom();
462  fNumofTotalIons += fNumofIonsofThisCluster;
463  if(fUsePlot)
464  hAvaNum->Fill(fNumofIonsofThisCluster);
465 
466  if( fNumofIonsofThisCluster > 1 )
467  {
468  //Double_t lx = fCurrentPosofCluster.XYvector().Mod() - cWIRERADIUS;
469  //Double_t lx1 = log(1.+lx);
470  //clusInfo.fStartTime = fTime + (lx*(p0 + p1*pow(lx, 0.25)) + lx1*(p2 + p3*lx1));
471 
472  Double_t fStartTime = fTime + GetElectronDriftTime(fCurrentPosofCluster.XYvector());//micro second
473  Int_t tShift = Int_t(fStartTime/fSamplingInterval);
474  if(tShift >= fSamplingSize) tShift = fSamplingSize-1;
475  Int_t refPhiIndex = Int_t(fCurrentPosofCluster.Phi()/cUNITPHI);
476  //wire signal
477  //cout<<"1D, number of fired bins #"<<fProbFunc1D.size()<<endl;
478  std::vector<AvaBinType>::const_iterator vit = fProbFunc1D.begin();
479  std::vector<AvaBinType>::const_iterator end = fProbFunc1D.end();
480  for(; vit != end; ++ vit)
481  {
482  const AvaBinType& bin = *vit;
483  Double_t fN = fNumofIonsofThisCluster* bin.Probabilty;
484  if(fN > fNumofTruncation){
485  for(ii = tShift, jj=1; ii < fSamplingSize; ++ ii, ++jj){
486  fSignalDataAnode[ii] += fN*hAnodeI1d[bin.Index]->GetBinContent(jj);
487  }
488  }
489  if(fUsePlot){
490  hIndex->SetBinContent(bin.Index+1, hIndex->GetBinContent(bin.Index+1) + fN);
491  }
492  }
493  //cout<<"wire signal done"<<endl;
494  //strip signal
495  //cout<<"2D, number of fired bins #"<<fProbFunc2D.size()<<endl;
496  vit = fProbFunc2D.begin();
497  end = fProbFunc2D.end();
498  std::map<Int_t, Double_t> fInfo;
499  for(; vit != end; ++ vit)
500  {
501  const AvaBinType& bin = *vit;
502  Int_t fN = fNumofIonsofThisCluster* bin.Probabilty;
503  if(fN > fNumofTruncation){
504  //retrieve the rIndex, phiIndex;
505  Int_t rIdx = bin.Index%NRAD;
506  Int_t phiIdx = bin.Index/NRAD;
507  phiIdx += refPhiIndex;
508  phiIdx %= NPHI;
509  fInfo[rIdx + phiIdx*NRAD] = fN;
510  for(ii = tShift, jj=1; ii < fSamplingSize; ++ ii, ++jj){
511  fSignalDataStrip[ii] += fScaleFactor* fN *hCathodeI2d[rIdx][phiIdx]->GetBinContent(jj);
512  }
513  if(fUsePlot){
514  Int_t irr = rIdx;
515  Int_t ipp = phiIdx;
516  h2dIndex->SetBinContent(irr+1, ipp+1, h2dIndex->GetBinContent(irr+1, ipp+1) + fN);
517  //Int_t rIndex = Int_t(TMath::Log(1. + cMAPFACTOR*(fIonProductionPos.Mod() - cWIRERADIUS))/cUNITLOGDR);
518  //Int_t phiIndex = Int_t(fIonProductionPos.Phi()/cUNITPHI);
519  Double_t PHI = (ipp+1)*cUNITPHI;
520  Double_t RADIUS = (exp(irr+1) - 1.)*cUNITLOGDR/cMAPFACTOR + cWIRERADIUS;
521  Double_t x = RADIUS*TMath::Cos(PHI);
522  Double_t y = RADIUS*TMath::Sin(PHI);
523  //Int_t ix = (x + 0.01)/0.0002;
524  //Int_t iy = (y + 0.01)/0.0002;
525  for(Int_t iv = 0; iv < fN; ++ iv)
526  hAvaPos->Fill(x,y);
527  //hAvaPos->SetBinContent(ix, iy, hAvaPos->GetBinContent(ix, iy) + fNrNphi[ir][ipp]);
528  }
529  }
530  }
531  }
532  }
533  ++ fNumofCluster;
534  }while(fTrackLen < fMaxPath);
535 
536  if(fUseNoise){
537  AddNoise(fNoiseLevel);
538  }
539  //sw.Stop();
540  //cout<<"PndMdtParamDigi::GetRawSignal, cost "<<sw.CpuTime()<<" s"
541  // <<" clusters#"<<fNumofCluster
542  // <<" primary ionization#"<<fNumofTotalIonizaion
543  // <<" total ions#"<<fNumofTotalIons<<endl;
544 }
std::pair< Double_t, Double_t > ValueErrorType
static const Int_t NRAD
Double_t fRestMass[5]
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
static T Sin(const T &x)
Definition: PndCAMath.h:42
static T Cos(const T &x)
Definition: PndCAMath.h:43
TH1F * hAnodeI1d[NRAD]
void AddNoise(Double_t fNoiseLevel=1., Int_t isAnode=1)
static const Int_t fSamplingSize
Double_t
static const Int_t NPHI
void GetMPVofPrimaryIonization(Int_t particleType, const TVector3 &momentum, ValueErrorType &val) const
TVector3 fParticleMomentum
Double_t x
Double_t GetElectronDriftTime(TVector2 iniPos)
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
std::vector< AvaBinType > fProbFunc2D
Double_t y
std::vector< Double_t > fSignalDataAnode
TGraphErrors * gFreePath[5]
TVector3 fExitPosition
TH1F * hCathodeI2d[NRAD][NPHI]
std::vector< AvaBinType > fProbFunc1D
Double_t PndMdtParamDigi::GetShiftTime ( TVector2  fWireSurfacePos,
TVector2  fProductionPos 
)
inlineprivate

Definition at line 113 of file PndMdtParamDigi.h.

References Double_t, p1, and p2.

114  {
115  const Double_t p0 = 1.81940e-8;//unit: micro sencond
116  const Double_t p1 = 1.80248;
117  const Double_t p2 = 3.68652e+2;
118  const Double_t p3 = 1.67353e+3;
119  //const Double_t mean = 0; //[R.K. 01/2017] unused variable?
120  //const Double_t sigma = 2.73477e-3;//micro second //[R.K. 01/2017] unused variable?
121  Double_t dr = (fProductionPos-fWireSurfacePos).Mod();
122  return (((p3*dr+p2)*dr+p1)*dr+p0 /*+ gRandom->Gaus(mean, sigma)*/)*1.e3;//nano sencod
123  }
Double_t
TPad * p2
Definition: hist-t7.C:117
TPad * p1
Definition: hist-t7.C:116
void PndMdtParamDigi::GetSignal ( Bool_t  useConvolution = kTRUE)
private

Definition at line 570 of file PndMdtParamDigi.cxx.

References ApplyTransferFunction(), fSignalDataAnode, fSignalDataStripM, and GetRawSignalbyWeightingAvalanche().

Referenced by Compute(), and GetFiredInfo().

571 {
572 
574  //GetRawSignalbySimAvalanche(1.);
575  //convolution with readout circuit
576  if(useConvolution){
578  //for_each(fSignalDataAnode.begin(), fSignalDataAnode.end(), print());
579  //cout<<endl;
580 
581  std::map<Int_t, std::vector<Double_t> >::iterator it = fSignalDataStripM.begin();
582  std::map<Int_t, std::vector<Double_t> >::iterator end = fSignalDataStripM.end();
583  while( it != end){
584  std::vector<Double_t>& fSignalDataStrip = it->second;
585  ApplyTransferFunction(&fSignalDataStrip[0]);
586  ++ it;
587  }
588  }
589 }
void ApplyTransferFunction(Double_t *fSignalData, Int_t nSize=fSamplingSize)
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
void GetRawSignalbyWeightingAvalanche(Double_t fNoiseLevel=1.)
std::vector< Double_t > fSignalDataAnode
const std::map<Int_t, std::vector<Double_t> >& PndMdtParamDigi::GetStripSignals ( ) const
inline

Definition at line 66 of file PndMdtParamDigi.h.

References fSignalDataStripM.

Referenced by PndMdtPointsToWaveform::exec_e(), and PndMdtPointsToWaveform::exec_t().

66 { return fSignalDataStripM; }
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
const std::vector<Double_t>& PndMdtParamDigi::GetWireSignal ( ) const
inline

Definition at line 65 of file PndMdtParamDigi.h.

References fSignalDataAnode.

Referenced by PndMdtPointsToWaveform::exec_e(), and PndMdtPointsToWaveform::exec_t().

65 { return fSignalDataAnode; }
std::vector< Double_t > fSignalDataAnode
Bool_t PndMdtParamDigi::Init ( )

Definition at line 62 of file PndMdtParamDigi.cxx.

References file, fProbFunc1D, fProbFunc2D, fSamplingSize, fSignalDataAnode, fTrF, fUseAvaHist, fUsePlot, gFreePath, h2dIndex, hAnodeI1d, hAva1D, hAva2D, hAvaNum, hAvaPos, hAvaSize, hCathodeI2d, hExp1, hGen, hIndex, hIonNum, hLan, hTrack, ir, NPHI, NRAD, and TString.

Referenced by PndMdtPointsToWaveform::Init().

63 {
64  fTrF = new TF1("fTrF", "(x*6./0.015)**6*exp(-x*6./0.015)", 0., 2.);
65  if(! fTrF) return kFALSE;
66 
67  TString dir(gSystem->Getenv("VMCWORKDIR"));
68  TString mdtParamsFile(dir + "/macro/params/MdtDigiParams.root");
69  TFile* file = TFile::Open(mdtParamsFile);
70  if( ! file->IsOpen()) return kFALSE;
71 
72  gFreePath[0] = (TGraphErrors*)file->Get("gElec");
73  gFreePath[1] = (TGraphErrors*)file->Get("gMuon");
74  gFreePath[2] = (TGraphErrors*)file->Get("gPion");
75  gFreePath[3] = (TGraphErrors*)file->Get("gKaon");
76  gFreePath[4] = (TGraphErrors*)file->Get("gProton");
77  hAvaSize = (TH1F*)file->Get("hava");
78  //hAnodeI = (TH1F*)file->Get("hAnodeI");
79  //hCathodeIx= (TH1F*)file->Get("hCathodeIx");
80  //hCathodeIy= (TH1F*)file->Get("hCathodeIy");
81  cout<<"PndMdtParamDigi::PndMdtParamDigi(), test"<<endl;
82  cout<<"mean frem path @1 GeV of electron "<<gFreePath[0]->Eval(1.)<<endl;
83  cout<<"mean frem path @1 GeV of muon "<<gFreePath[1]->Eval(1.)<<endl;
84  cout<<"mean frem path @1 GeV of pion "<<gFreePath[2]->Eval(1.)<<endl;
85  cout<<"mean frem path @1 GeV of kaon "<<gFreePath[3]->Eval(1.)<<endl;
86  cout<<"mean frem path @1 GeV of proton "<<gFreePath[4]->Eval(1.)<<endl;
87  //cout<<"avalanche size #"<<hAvaSize->GetRandom()<<endl;
88  //cout<<"induced current on anode @t = 0.05us, "<<hAnodeI->GetBinContent(5)<<endl;
89  //cout<<"induced current on cathode @t = 0.05us, theta 0, "<<hCathodeIx->GetBinContent(5)<<endl;
90  //cout<<"induced current on cathode @t = 0.05us, theta PI/2, "<<hCathodeIy->GetBinContent(5)<<endl;
91  //file->Close();
92  fUseAvaHist = kTRUE;
93  //double* lProbData = new double[hAvaSize->GetNbinsX()];
94  //for(Int_t ib=0; ib < hAvaSize->GetNbinsX(); ++ ib)
95  // lProbData[ib] = hAvaSize->GetBinContent(ib+1);
96  //fRandAva = new CLHEP::RandGeneral(lProbData, hAvaSize->GetNbinsX());
97 
98  TString mdtParamsFileI(dir + "/macro/params/MdtDigiParamsI.root");
99  TFile* file2 = TFile::Open(mdtParamsFileI);
100  if(! file2->IsOpen()) return kFALSE;
101 
102  for(Int_t ir=0; ir < NRAD; ++ ir)
103  {
104  TString hisName("Ir");
105  hisName += ir;
106  hAnodeI1d[ir] = (TH1F*)file2->Get(hisName);
107  }
108  for(Int_t ir=0; ir < NRAD; ++ ir)
109  {
110  for(Int_t ip=0; ip <NPHI; ++ ip){
111  TString hisName("Ir");
112  hisName += ir;
113  hisName += "t";
114  hisName += ip;
115  hCathodeI2d[ir][ip] = (TH1F*)file2->Get(hisName);
116  }
117  }
118  hAva1D = (TH1F*)file2->Get("hAva1D");
119  hAva2D = (TH2F*)file2->Get("hAva2D");
120  cout<<"1D avalanche PDF "<<hAva1D->GetTitle()<<endl;
121  cout<<"2D avalanche PDF "<<hAva2D->GetTitle()<<endl;
122 
123  for(Int_t ir=0; ir < hAva1D->GetNbinsX(); ++ ir)
124  if(hAva1D->GetBinContent(ir+1) > 0){
125  fProbFunc1D.push_back(AvaBinType(ir, hAva1D->GetBinContent(ir+1)));
126  }
127 
128  for(Int_t ir=0; ir < hAva2D->GetNbinsX(); ++ ir)
129  for(Int_t ip=0; ip < hAva2D->GetNbinsY(); ++ ip)
130  if(hAva2D->GetBinContent(ir+1, ip+1) > 0){
131  fProbFunc2D.push_back(AvaBinType(ir+ip*NRAD, hAva2D->GetBinContent(ir+1, ip+1)));
132  }
133 
134 
135  if(fUsePlot)
136  {
137  hIonNum = new TH1F("hIonizationNum", "number of primary ionization", 20, 0, 20);
138  hTrack = new TH2F("hTrack", "trajectory of primary track", 100, -0.5, 0.5, 100, -0.5, 0.5);
139  hAvaPos = new TH2F("hAvaPos", "avalanche profile", 100, -0.01, 0.01, 100, -0.01, 0.01);
140  hAvaNum = new TH1F("hAvaNum", "avalanche", 20000, 0, 20000);
141  hIndex = new TH1F("hIndex", "raidal avlanche structure", 100,0, 100);
142  hIndex->GetXaxis()->SetTitle("Start bin of Drift");
143  h2dIndex = new TH2F("h2dIndex", "raidal avlanche structure", 100,0, 100, 100, 0, 100);
144  h2dIndex->GetXaxis()->SetTitle("Start bin of Drift");
145 
146  hExp1 = new TH1F("expf", "exponential dis", 100,0,1);
147  //hExp2;
148  hGen = new TH1F("gen", "general dist", 100, 0, 10000);
149  hLan = new TH1F("lan", "landau dis", 20, 0, 20);
150  }
152 
153  return kTRUE;
154 }
static const Int_t NRAD
TFile * file
TH1F * hAnodeI1d[NRAD]
static const Int_t fSamplingSize
static const Int_t NPHI
std::vector< AvaBinType > fProbFunc2D
std::vector< Double_t > fSignalDataAnode
TGraphErrors * gFreePath[5]
TH1F * hCathodeI2d[NRAD][NPHI]
std::vector< AvaBinType > fProbFunc1D
static int ir
Definition: ranlxd.cxx:374
void PndMdtParamDigi::SamplingPosition ( TVector2  fDirection,
TVector2 &  fIonProductionPos 
)
private

Definition at line 732 of file PndMdtParamDigi.cxx.

References cos(), cWIRERADIUS, Double_t, and sin().

Referenced by GetRawSignalbySimAvalanche().

733 {
734  const Double_t cThetaSigma = 2.67859e-01;
735  //sampling theta
736  Double_t mTheta = gRandom->Gaus(0., cThetaSigma);
737  //sampling radial
738  const Double_t mTauR1 = 1.51900e-3;
739  const Double_t mTauR2 = 5.53950e-4;
740  const Double_t mTauR3 = 2.94876e-4;
741  Double_t mRadius(0);
742  Double_t prob = gRandom->Rndm();
743  if(prob < 2.38210768816632112e-02){
744  mRadius = gRandom->Exp(mTauR1);
745  }else if(prob < 4.34694439053706305e-01){
746  mRadius = gRandom->Exp(mTauR2);
747  } else{
748  mRadius = gRandom->Exp(mTauR3);
749  }
750  mRadius += cWIRERADIUS;
751  Double_t mX = mRadius*cos(mTheta);
752  Double_t mY = mRadius*sin(mTheta);
753  //unitV.Print();
754  TVector2 unitV = fDirection.Unit();
755 
756  fIonProductionPos.Set( unitV.X()*mX - unitV.Y()*mY, unitV.Y()*mX + unitV.X()*mY);
757  //fIonProductionPos.Print();
758 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t
void PndMdtParamDigi::SetNoiseWidth ( Double_t  anode,
Double_t  strip 
)
inline

Definition at line 56 of file PndMdtParamDigi.h.

References fNoiseSigmaAnode, fNoiseSigmaStrip, and strip.

Referenced by PndMdtPointsToWaveform::Init().

Double_t fNoiseSigmaStrip
Double_t fNoiseSigmaAnode
int strip
Definition: anaMvdDigi.C:135
void PndMdtParamDigi::SetOptimization ( Int_t  val)
inline

Definition at line 55 of file PndMdtParamDigi.h.

References fNumofTruncation, and val.

Referenced by PndMdtPointsToWaveform::Init().

55 { fNumofTruncation = val; }
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
PndMdtParamDigi & PndMdtParamDigi::SetParams ( Int_t  ptlType,
TVector3  iniP,
TVector3  iniPos,
TVector3  finalPos,
Double_t  stripLen = 100. 
)

Definition at line 160 of file PndMdtParamDigi.cxx.

References fExitPosition, fInitPostion, fParamsChanged, fParticleMomentum, fParticleType, fSignalDataStripM, fStripLength, fVerbose, and TString.

Referenced by PndMdtPointsToWaveform::exec_e(), and PndMdtPointsToWaveform::exec_t().

161 {
162  fParticleType = ptlType;
163  fParticleMomentum = iniP;
164  fInitPostion = iniPos;
165  fExitPosition = finalPos;
166  fStripLength = stripLen;
167  fParamsChanged = kTRUE;
168  fSignalDataStripM.clear();
169 
170  if(fVerbose > 1){
171  cout<<"==============================================="<<endl;
172  TString partileName[5] = {"Elec", "Muon", "Pion", "Kaon", "Proton"};
173  cout<<"PndMdtParamDigi::SetParams, "<<partileName[ptlType]<<endl
174  <<" initial momentum#"<<iniP.X()<<", "<<iniP.Y()<<", "<<iniP.Z()<<", "<<iniP.Mag()<<"GeV"<<endl
175  <<" initial position#"<<iniPos.X()<<", "<<iniPos.Y()<<", "<<iniPos.Z()<<", "<<iniPos.Mag()<<"cm"<<endl
176  <<" final position#"<<finalPos.X()<<", "<<finalPos.Y()<<", "<<finalPos.Z()<<", "<<finalPos.Mag()<<"cm"<<endl;
177  cout<<"==============================================="<<endl;
178  }
179  return *this;
180 }
TVector3 fParticleMomentum
std::map< Int_t, std::vector< Double_t > > fSignalDataStripM
TVector3 fExitPosition
void PndMdtParamDigi::SetVerbose ( Int_t  v)
inline

Definition at line 37 of file PndMdtParamDigi.h.

References fVerbose, and v.

37 { fVerbose = v; }
__m128 v
Definition: P4_F32vec4.h:4
void PndMdtParamDigi::UseDetailedSim ( Bool_t  swith = kTRUE)
inline

Definition at line 52 of file PndMdtParamDigi.h.

References fDetailedSim.

Referenced by PndMdtPointsToWaveform::Init().

52 { fDetailedSim = swith; }
void PndMdtParamDigi::UseGaussianAmp ( Bool_t  swith)
inline

Definition at line 54 of file PndMdtParamDigi.h.

References fGaussianAmp.

Referenced by PndMdtPointsToWaveform::Init().

54 { fGaussianAmp = swith; }
void PndMdtParamDigi::UseNoise ( Bool_t  swith)
inline

Definition at line 51 of file PndMdtParamDigi.h.

References fUseNoise.

Referenced by PndMdtPointsToWaveform::Init().

51 { fUseNoise = swith; }
void PndMdtParamDigi::UsePlot ( Bool_t  swith = kTRUE)
inline

Definition at line 53 of file PndMdtParamDigi.h.

References fUsePlot.

Referenced by PndMdtPointsToWaveform::Init().

53 { fUsePlot = swith; }

Member Data Documentation

Double_t PndMdtParamDigi::cCELLSIZE
private

Definition at line 164 of file PndMdtParamDigi.h.

Referenced by PndMdtParamDigi().

Double_t PndMdtParamDigi::cMAPFACTOR
private
Double_t PndMdtParamDigi::cMAXRADIUS
private

Definition at line 166 of file PndMdtParamDigi.h.

Referenced by PndMdtParamDigi().

Double_t PndMdtParamDigi::cSTRIPWIDTH
private
Double_t PndMdtParamDigi::cUNITLOGDR
private
Double_t PndMdtParamDigi::cUNITPHI
private
Double_t PndMdtParamDigi::cWIRERADIUS
private
Bool_t PndMdtParamDigi::fDetailedSim
private

Definition at line 138 of file PndMdtParamDigi.h.

Referenced by UseDetailedSim().

TVector3 PndMdtParamDigi::fExitPosition
private
Bool_t PndMdtParamDigi::fGaussianAmp
private

Definition at line 94 of file PndMdtParamDigi.h.

Referenced by UseGaussianAmp().

TVector3 PndMdtParamDigi::fInitPostion
private
Double_t PndMdtParamDigi::fNoiseSigmaAnode
private

Definition at line 95 of file PndMdtParamDigi.h.

Referenced by AddNoise(), Digitize(), and SetNoiseWidth().

Double_t PndMdtParamDigi::fNoiseSigmaStrip
private

Definition at line 96 of file PndMdtParamDigi.h.

Referenced by AddNoise(), Digitize(), and SetNoiseWidth().

Int_t PndMdtParamDigi::fNr[NRAD]
private

Definition at line 172 of file PndMdtParamDigi.h.

Int_t PndMdtParamDigi::fNrNphi[NRAD *NPHI]
private

Definition at line 173 of file PndMdtParamDigi.h.

Int_t PndMdtParamDigi::fNumofTruncation
private
Bool_t PndMdtParamDigi::fParamsChanged
private
TVector3 PndMdtParamDigi::fParticleMomentum
private
Int_t PndMdtParamDigi::fParticleType
private
std::vector<AvaBinType> PndMdtParamDigi::fProbFunc1D
private

Definition at line 210 of file PndMdtParamDigi.h.

Referenced by GetRawSignalbyWeightingAvalanche(), and Init().

std::vector<AvaBinType> PndMdtParamDigi::fProbFunc2D
private

Definition at line 211 of file PndMdtParamDigi.h.

Referenced by GetRawSignalbyWeightingAvalanche(), and Init().

CLHEP::RandGeneral* PndMdtParamDigi::fRandAva
private

Definition at line 215 of file PndMdtParamDigi.h.

Double_t PndMdtParamDigi::fRestMass[5]
private
Int_t PndMdtParamDigi::fSamplingInterval
private
Int_t PndMdtParamDigi::fSamplingRate
private

Definition at line 88 of file PndMdtParamDigi.h.

Referenced by PndMdtParamDigi().

const Int_t PndMdtParamDigi::fSamplingSize = 20
staticprivate
std::vector<Double_t> PndMdtParamDigi::fSignalDataAnode
private
std::map<Int_t, std::vector<Double_t> > PndMdtParamDigi::fSignalDataStripM
private
Double_t PndMdtParamDigi::fStripLength
private

Definition at line 131 of file PndMdtParamDigi.h.

Referenced by SetParams().

TF1* PndMdtParamDigi::fTrF
private

Definition at line 92 of file PndMdtParamDigi.h.

Referenced by ApplyTransferFunction(), and Init().

Bool_t PndMdtParamDigi::fUseAvaHist
private

Definition at line 153 of file PndMdtParamDigi.h.

Referenced by Init().

Bool_t PndMdtParamDigi::fUseNoise
private
Bool_t PndMdtParamDigi::fUsePlot
private
Int_t PndMdtParamDigi::fVerbose
private

Definition at line 201 of file PndMdtParamDigi.h.

Referenced by SetParams(), and SetVerbose().

TGraphErrors* PndMdtParamDigi::gFreePath[5]
private
TH2F* PndMdtParamDigi::h2dIndex
private
TH1F* PndMdtParamDigi::hAnodeI1d[NRAD]
private
TH1F* PndMdtParamDigi::hAva1D
private

Definition at line 194 of file PndMdtParamDigi.h.

Referenced by Draw(), and Init().

TH2F* PndMdtParamDigi::hAva2D
private

Definition at line 195 of file PndMdtParamDigi.h.

Referenced by Draw(), and Init().

TH1F* PndMdtParamDigi::hAvaNum
private
TH2F* PndMdtParamDigi::hAvaPos
private
TH1F* PndMdtParamDigi::hAvaSize
private
TH1F* PndMdtParamDigi::hCathodeI2d[NRAD][NPHI]
private
TH1F* PndMdtParamDigi::hExp1
private

Definition at line 197 of file PndMdtParamDigi.h.

Referenced by Draw(), and Init().

TH1F* PndMdtParamDigi::hExp2
private

Definition at line 198 of file PndMdtParamDigi.h.

TH1F* PndMdtParamDigi::hGen
private

Definition at line 199 of file PndMdtParamDigi.h.

Referenced by Draw(), and Init().

TH1F* PndMdtParamDigi::hIndex
private
TH1F* PndMdtParamDigi::hIonNum
private
TH1F* PndMdtParamDigi::hLan
private

Definition at line 200 of file PndMdtParamDigi.h.

Referenced by Draw(), and Init().

TH2F* PndMdtParamDigi::hTrack
private
const Int_t PndMdtParamDigi::NPHI = 100
staticprivate
const Int_t PndMdtParamDigi::NRAD = 100
staticprivate
Double_t PndMdtParamDigi::SPEEDOFLIGHT
private

The documentation for this class was generated from the following files: