How to deal with huge model in garfieldpp

Dear all,
I have built a huge model of TPC with 225 m, but the anode is consists of 10 k pixels with radius 0.5 mm. So if the distance step was set to 1e-6, it’s too slow. I have tried that

                std::vector<double> path_tot_x, path_tot_y, path_tot_z,path_tot_t;
                std::vector<double> sig;
                drift.SetDistanceSteps(0.01);
                drift.DriftNegativeIon((*x_s)[i]/10,(*y_s)[i]/10,(*z_s)[i]/10+250,0);



                const auto& ions1 = drift.GetNegativeIons();
                if (ions1.empty()) continue;
                const auto& path1 = ions1[0].path;
                if (path1.size() == 0) continue;


                int switch_idx = -1;

                //for (int j = 0; j<path1.size();j++){
                for (const auto& pt : path1) {
                        if (pt.z>5){
                                path_tot_x.push_back(pt.x);
                                path_tot_y.push_back(pt.y);
                                path_tot_z.push_back(pt.z);
                                path_tot_t.push_back(pt.t);
                                sig.push_back(nElectrons*sensor.GetElectronSignal("anode", i));
                        }
                }

                if (switch_idx == -1) continue;

                sensor.ClearSignal();
                drift.SetDistanceSteps(1e-6);

                drift.DriftNegativeIon(path1.back().x,path1.back().y,path1.back().z,path1.back().t);

                const auto& ions2 = drift.GetNegativeIons();
                if (ions2.empty()) continue;
                const auto& path2 = ions2[0].path;
                if (path2.size() == 0) continue;
                for (const auto& pt2 : path2){
                        path_tot_x.push_back(pt2.x);
                        path_tot_y.push_back(pt2.y);
                        path_tot_z.push_back(pt2.z);
                        path_tot_t.push_back(pt2.t);
                        sig.push_back(nElectrons*sensor.GetElectronSignal("anode", i));
                }



                //const auto& endp = ions[0].path.back();

                x_end = path_tot_x.back();
                y_end = path_tot_y.back();
                t_end = path_tot_t.back();

to divide 2 area. When ions in drift area, the step was set to 0.01, and near anode, the step was set to 1e-6. But I don’t know how to save the message in the same sensor because I also want to convolve the signal in later process. Or any other method could I have a try?

Hi @dm-leo,
I think @hschindl can help you.

Hi,
you can set a location-dependent step size using something like this

// Step size as function of position.
auto step = [](double x, double y, double z) {
  // If (x, y, z) near anode return 1.e-6;
  // else
  return 0.1;
};
drift.SetStepDistanceFunction(step);
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.