Hi @pschutze ,
I tried to make some print outs to understand the origin of the problem. I made some print statement here (where the custom field is gotten, marked with “ONEDIMENSIONAL”):
and here (where the custom field is plotted, marked with “BEFOREPLOT”):
I checked with three different electric field functions and here are the results:
1. 12500V/cm*TMath::Gaus(z,0,1):
ONEDIMENSIONAL::Value of custom field at ( -0.01462,0.01344, -0.0125 ): 12499V/cm
BEFOREPLOT::Value of field_strength at (-0.0145908,-0.0134131,0) : 12500V/cm
BEFOREPLOT::Value of field_z_strength at (-0.0145908,-0.0134131,0) : 12500V/cm
2. 12500V/cm*TMath::Gaus(y,0,1):
ONEDIMENSIONAL::Value of custom field at ( -0.01462,-0.01344, -0.0125 ): 12498.9V/cm
BEFOREPLOT::Value of field_strength at (-0.0145908,-0.0134131,0) : 11031.4V/cm
BEFOREPLOT::Value of field_z_strength at (-0.0145908,-0.0134131,0) : 11031.4V/cm
3. 12500V/cm*TMath::Gaus(x,0,1):
ONEDIMENSIONAL::Value of custom field at ( -0.01462,-0.01344, -0.0125 ): 12498.7V/cm
BEFOREPLOT::Value of field_strength at (-0.0145908,-0.0134131,0) : 11031.4V/cm
BEFOREPLOT::Value of field_z_strength at (-0.0145908,-0.0134131,0) : 11031.4V/cm
I checked the electric field values using a separate TF3 code. I see that for all three cases the custom electric field is read correctly (in ONEDIMENSIONAL results). But apart from the
TMath::Gaus(z,0,1)
case, for other two equations, the electric field is not plotted correctly. I think that this behaviour is not expected. Can you help me how this function:
void ElectricFieldReaderModule::create_output_plots()
[src/modules/ElectricFieldReader/ElectricFieldReaderModule.cpp · master · Allpix Squared / Allpix Squared · GitLab]
and this function:
FieldFunction<ROOT::Math::XYZVector> ElectricFieldReaderModule::get_custom_field_function(std::pair<double, double> thickness_domain)
[src/modules/ElectricFieldReader/ElectricFieldReaderModule.cpp · master · Allpix Squared / Allpix Squared · GitLab]
talk to each other?
I see this line which sets the electric field:
detector_->setElectricFieldFunction(
get_custom_field_function(thickness_domain), thickness_domain, FieldType::CUSTOM);
[src/modules/ElectricFieldReader/ElectricFieldReaderModule.cpp · master · Allpix Squared / Allpix Squared · GitLab]
and this line which gets the electric field
auto field = detector_->getElectricField(ROOT::Math::XYZPoint(x, y, z));
[src/modules/ElectricFieldReader/ElectricFieldReaderModule.cpp · master · Allpix Squared / Allpix Squared · GitLab]
but could not figure out what is going on between them. Pardon my limited expertise in c++.
Many Thanks,
Arka