GSI Helmholtzzentrum für Schwerionenforschung
Dear colleagues, I have commited some code related to EMC error matrix calculation and treatment. So far parametrization of error matrix was hardcoded with parameters obtained by Marc Pelizaeus in Babar framework. My modification are based on the code from Marc and include possibility to use different parameters for different EMC geometries and include macro to recalculate parameters if some modification in EMC geometry are introduced (with as the most obvious example - inclusion of dead material). I have created a PndEmcErrorMatrixPar class to store these parameters in RTDB in object PndEmcErrorMatrixParObject. PndEmcErrorMatrix perform actual calculation of error matrix for given EmcCluster using its energy in method PndEmcErrorMatrix::Get4MomentumErrorMatrix(const PndEmcCluster &cluster) PndEmcErrorMatrix needs parametrs in the object PndEmcErrorMatrixParObject, which can be obtained from RTDB or root file. Therefore there are 2 methods of its initialization PndEmcErrorMatrix::Init(PndEmcErrorMatrixParObject *par) or PndEmcErrorMatrix::InitFromFile(Int_t geomVersion) geomVersion is parameter stored in RTDB in EMC simulation and depending on EMC geometry version, error matrix is initialised from different files, which names are hardcoded in PndEmcErrorMatrix::InitFromFile(). The place where error matrix is actually calculated in the code is PndPidCorrelator::ConstructNeutralCandidate(). I have attached a modified version of PndPidCorrelator.cxx, PndPidCorrelator.h, /pid/CMakeLists.txt and I would like to ask Stefano to commit my changes there, since I do not have write permission to /pid/ directory. In addition there two files with parameters emc_error_matrix_default.root and emc_error_matrix_1.root, which should be placed to /input/ directory. There are 3 macro added to /macro/emc/dedicated/: fill_error_matrix_param.C create root file (emc_error_matrix_default.root) with parameters, taken from Babar framework. error_matrix_data_production.C(Int_t emcGeometry=17, Int_t emc_component=1, Int_t nEvents=10) which perform data production for given emc geometry version and emc component (1- barrel, 2 - forward endcap, 3 -backward endcap, 4 - shashlyk). So this macro should be run 4 times, once for each emc component. The data produced are photon with an energy and theta range dependent on emc component. error_matrix_fit.C(Int_t emcGeometry=17, TString fileVersion="1") takes 4 files produced by error_matrix_data_production.C and perform calculation of energy and position error and fit them with function shown at the attached figures. Parameters of the fit are stored in PndEmcErrorMatrixParObject in the file, which names ends with fileVersion. For the barrel the energy dependence of error of (energy, phi, z) is used, for other EMC components error of (energy, x, y). Concerning the actual parametrs, results are far from final and still should be checked. There are two figures attached for errors in barrel and forward endcap. They are close to what Marc showed 3 years ago, however fit gives slightly different parameters and there are some irregularities which still should be understood. I have produced 10k events for each emc module and may be at higher statistics results will improve. There is an obstacle for parametrisation of error matrix for shashlyk calorimeter, namely energy correction. Despite there is energy correction from babar framework and energy correction obtained by Ola Biegun in pandaroot they are not suitable for the recent version of shashlyk geometry and proper parametrisation of error matrix should wait till proper energy correction for shashlyk. So emc_error_matrix_1.root file include error matrix obtained for geometries "emc_module12.dat","emc_module3new.root","emc_module4_StraightGeo24.4.root " and paramatrization for shashlyk from the Babar framework. Quality assurance for error marix would be reconstruction of the decay pi0->gamma gamma, which I plan to do but it still need some additional work on energy-position correction. Best regards, Dima
Hi Dima! I've got the error after update: class PndEmcBump has no member named 'Get4MomentumErrorMatrix' in PndPidCorrelator.cxx line 484. Dmitry
This is known. I should update the correlator but I had no time last week.
I have committed the PndPidCorrelator and updated the code. At GSI I have the following error in compilation: [ 60%] Building CXX object emc/CMakeFiles/Emc.dir/EmcReco/PndEmcErrorMatrix.o /d/panda02/spataro/pandaroot/emc/EmcReco/PndEmcErrorMatrix.cxx: In member function 'TMatrixD PndEmcErrorMatrix::GetErrorMatrix(const PndEmcCluster&) const': /d/panda02/spataro/pandaroot/emc/EmcReco/PndEmcErrorMatrix.cxx:85: error: 'abort' was not declared in this scope make[2]: *** [emc/CMakeFiles/Emc.dir/EmcReco/PndEmcErrorMatrix.o] Error 1 make[1]: *** [emc/CMakeFiles/Emc.dir/all] Error 2 It seems abort() is not accepted by all the compilers. Would it be possible to return something else? Has someone else the same crash?
Yes, Stefano, I have the same error Dmitry
Hi Stefano, Here I have the same problem. The solution is adding #include <cstdlib> or #include <stdlib.h> to PndEmcErrorMatrix.h. Because we use C++, I would prefer the first one. But the question remains if we need to use abort(). According to the documentation: ====================== Aborts the process with an abnormal program termination. The function generates the SIGABRT signal, which by default causes the program to terminate returning an unsuccessful termination error code to the host environment. The program is terminated without executing destructors for objects of automatic or static storage duration, and without calling any atexit function. The function never returns to its caller. ====================== I have not looked into the source code yet, but in the most cases, it is not a good idea to use abort(). btw. should I add the lines to the headers and submit? /M
Hi, I have added #include <cstdlib> to PndEmcErrorMatrix.h but I cannot check by myselfe if it eliminates error, since I didn't have it. Concerning the question of using abort() at all, I do not insist on it. I put it to catch unexpected run-time behaviour and would like to avoid complicated exception handling. Suggestions about better alternatives will be accepted. In addition I have added root files with parameters input/emc_error_matrix_default.root input/emc_error_matrix_1.root Best regards, Dima
Hi Dima, I think it should be added to PndEmcErrorMatrixPar.h as well. At least this two additions solve the problem for me here. I think exit() is a better option. At least according to the documentation: ================ Terminates the process normally, performing the regular cleanup for terminating processes. First, all functions registered by calls to atexit are executed in the reverse order of their registration. Then, all streams are closed and the temporary files deleted, and finally the control is returned to the host environment. The status argument is returned to the host environment. ================= Best regards, M
Hi Mohammad, I have found the following arguments to prefer abort() over exit(), which are suitable in this case. Quote: If there is a (critical) error and you call exit(), then you won't know where the error occurred (the program will exit cleanly). If you call abort(), you'll be able to catch the error at the point where it occurs. It's a debugging aid, which is why it's normally called by assert(). And I have added #include <cstdlib> to PndEmcErrorMatrixPar.h as well. Dima
Hi Dima, Thank you!. For me the error is gone now. I will run an experimental build. M
It is gone also for me. Thanks.