Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding method to apply a calibration with gain correction. #484

Merged
merged 22 commits into from
Nov 16, 2023

Conversation

AlvaroEzq
Copy link
Contributor

@AlvaroEzq AlvaroEzq commented Sep 26, 2023

AlvaroEzq Large: 1455 Powered by Pull Request Badge

New method TRestDataSetGainMap calculates and stores the calibration parameters for a given detector with multiple (or just one) modules. These modules are defined in the Module class. It performs a gain correction based on a spatial segmentation of the detector module. This is useful for big modules such as the ones used in TREX-DM experiment. The input data files for this methods are TRestDataSet for both calculating the calibration parameters and performing the calibration of the desired events.

To correct the gain inhomogeneities, the module is divided in fNumberOfSegmentsX*fNumberOfSegmentsY segments. The energy peaks provided are fitted in each segment. The events are associated to each segment based on the observables fSpatialObservableX and fSpatialObservablesY. This results in the following plot that can be obtain with the function TRestDataSetGainMap::Module::DrawSpectrum()
imagen
Also, the peak position provides a gain map that can be plotted with the function TRestDataSetGainMap::Module::DrawGainMap(peakNumber)
imagen
The result is a better energy resolution with the gain corrected calibration (red) than the plain calibration (blue)
imagen

@AlvaroEzq AlvaroEzq requested review from jgalan, lobis, juanangp and a team September 26, 2023 09:30
#include <TH1.h>
#include <TH2.h>
#include <TRestStringOutput.h>
#include <TSpectrum.h>
Copy link
Member

@lobis lobis Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's a good idea to use this one (TSpectrum) since it's deprecated (I think). It may not work as intended or stop to work at any future version of root.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I need to search for peaks in a histogram and that is the only and simple way to do it (at least that i know of).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the documentation they propose to use RooFit, but don't know about the effort required to migrate towards it. They say it is yet fine if you plan to use TSpectrum.

@AlvaroEzq AlvaroEzq marked this pull request as ready for review September 26, 2023 15:12
@jgalan
Copy link
Member

jgalan commented Sep 27, 2023

I suggest another name for the class, it could be TRestDatasetObservableCalibration, or TRestDatasetGainMapCorrection.

Ot even just TRestDataSetGainMap could be a good name too.

Although the name gain map is specific, bear in mind that the class could allow to chose any observable for segmentation and any observable for calibration. Perhaps there could be other use cases? In any case, it is clear that other users will have it easier to identify or guess the role of this class if named TRestDataSetGainMap.

@jgalan
Copy link
Member

jgalan commented Sep 27, 2023

There should be an example, and detailed description on how to use, e.g. RML?

EDIT: I see it is on the documentation, probably no need to add the RML, though there is an example folder where it could be placed.

@jgalan
Copy link
Member

jgalan commented Sep 27, 2023

I think it would be interesting also to add the images that you are attaching at this PR inside the documentation.

You must upload/push those images to the following directory:

https://github.com/rest-for-physics/framework/tree/master/doc/doxygen/images

See for example how combinedmask.png is added in the following class documentation.

https://github.com/rest-for-physics/framework/blob/master/source/framework/masks/src/TRestCombinedMask.cxx

@lobis
Copy link
Member

lobis commented Oct 6, 2023

I think it would be interesting also to add the images that you are attaching at this PR inside the documentation.

You must upload/push those images to the following directory:

https://github.com/rest-for-physics/framework/tree/master/doc/doxygen/images

See for example how combinedmask.png is added in the following class documentation.

https://github.com/rest-for-physics/framework/blob/master/source/framework/masks/src/TRestCombinedMask.cxx

I don't think there is a need to upload the files anyway, they already live in the GitHub servers, you can just use a link to the image in this PR (such as https://user-images.githubusercontent.com/110617994/270608238-ae66e659-cfe4-4f0b-9cb6-2b649138d1f0.png). This avoids having to host images on the repo itself.

@AlvaroEzq AlvaroEzq merged commit 7434500 into master Nov 16, 2023
63 checks passed
@AlvaroEzq AlvaroEzq deleted the alvaroez_CalCorr branch November 16, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants