Dear experts,
I am working on the simulation for a MDT tube.And I useTrackHeed' and 'DriftLineRKF
module. I expext the shape of the signal (without convolution) should have a rising edge sharper than falling edge but actually not. Could you help me to figure it out?
// Make a sensor.
Sensor sensor;
// sensor.EnableDebugging();
sensor.AddComponent(&fm);
sensor.AddElectrode(&fm,"s");
sensor.SetArea(
-1, -1, 0,
1, 1, 30
);
const double tmax = 2000;
const double tmin = 200;
const unsigned int nbins = 80000;
const double tstep = (tmax-tmin)/nbins;
sensor.SetTimeWindow(tmin, tstep, nbins);
// Set the delta reponse function.
if (!readTransferFunction(sensor)) return 0;
sensor.ClearSignal();
TrackHeed track;
track.SetParticle("muon");
track.SetEnergy(0.5e9);
track.SetSensor(&sensor);
// // RKF integration.
DriftLineRKF drift(&sensor);
drift.SetGainFluctuationsPolya(0., 20000.);
drift.EnableIonTail();
TCanvas* cD = nullptr;
ViewDrift driftView;
constexpr bool plotDrift = true;
if (plotDrift) {
cD = new TCanvas("cD", "", 600, 600);
driftView.SetCanvas(cD);
drift.EnablePlotting(&driftView);
track.EnablePlotting(&driftView);
// cD->SaveAs("tubedrift.png")
}
TCanvas* cS = nullptr;
TCanvas* cS1 = nullptr;
constexpr bool plotSignal = true;
if (plotSignal) {
cS = new TCanvas("cS", "", 3200, 2400);
cS1 = new TCanvas("cS1", "", 3200, 2400);
}
const double x0 = rTrack;
const double y0 = -sqrt(rTube * rTube - rTrack * rTrack);
const unsigned int nTracks = 5;
for (unsigned int j = 0; j < nTracks; ++j) {
std::ofstream outfile_cluster_time;
TString cluster_time_filename;
cluster_time_filename.Form("cluster_time_%d.txt",j);
outfile_cluster_time.open(data_path+cluster_time_filename, std::ios::out);
sensor.ClearSignal();
track.NewTrack(x0, y0, 15, 0, 0, 1, 0);
for (const auto& cluster : track.GetClusters()) {
double tmin = std::numeric_limits<double>::max();
for (const auto& electron : cluster.electrons) {
drift.DriftElectron(electron.x, electron.y, electron.z, electron.t);
double xf = 0., yf = 0., zf = 0., tf = 0.;
int stat = 0;
drift.GetEndPoint(xf, yf, zf, tf, stat);
tmin = std::min(tmin, tf);
drift.DriftIon(electron.x, electron.y, electron.z, electron.t);
// std::cout<<electron.e<<std::endl;
}
outfile_cluster_time << tmin << "\n";
}
if (plotDrift) {
cD->Clear();
// cmp.PlotCell(cD);
ViewFEMesh* meshView = new ViewFEMesh(&fm);
meshView->SetArea(-1,-1,0,1,1,30);
meshView->SetCanvas(cD);
// x-z projection.
meshView->SetPlane(0, 0, 1, 0, 0, 0);
meshView->SetFillMesh(true);
// Set the color of the kapton and the metal.
meshView->SetColor(1, kYellow + 3);
meshView->SetColor(2, kGray);
meshView->EnableAxes();
meshView->Plot();
// cd->SaveAs("Mesh.png");
constexpr bool twod = true;
constexpr bool drawaxis = false;
driftView.Plot(twod, drawaxis);
cD->SaveAs("tubedrift.png");
}
// sensor.ConvoluteSignals();
int nt = 0;
if (!sensor.ComputeThresholdCrossings(-0.5, "s", nt)) continue;
if (plotSignal){
std::cout<<"print signal"<<std::endl;
ViewSignal signalView;
signalView.SetCanvas(cS);
// signalView.EnableLegend();
signalView.SetSensor(&sensor);
signalView.PlotSignal("s","tei");
sensor.PlotSignal("s", cS1,"t");
TString fig1_name;
fig1_name.Form("te_noCon_thr0_%d.png",j);
TString fig2_name;
fig2_name.Form("t_noCon_thr0_%d.png",j);
cS->SaveAs(data_path+fig1_name);
cS1->SaveAs(data_path+fig2_name);
}