TRestAnalysisPlots not plotting the first file in a list

REST version : v2.2.8
REST commit : f715f248

I have observed a few times that if I put a list of files to be plotted inside the rml configuration file, e.g. <addFile name="/path/fileName.root"/>. I’ve tried with different RMLs amd I always get the same result. I attach one of them:
plotsFirstFile.rml (8.3 KB)

Also, if I want to compare two observables that are in different root files, but with the same run number, how can I do this? For example I have of R0001_noiseReductionON.root and R0001_noiseReductionOFF.root and I want to compare observables at track level.

You should have at least a metadata member that differentiates them. Usually it should be runTag.

You should be able befiore processing the files with different setups to define the runTag inside the TRestRun definition (inside the RML).

Then, as I see at examples/plotAnaSpectrum.rml use the runTag to draw only the corresponding entries.

<classify runTag="NLDBD"/>

Replacing NLDBD by the runTag you have chosen at each independent processing.

I dont understand, what did you observe when you put a list using <addFile? I have executed the RML you give, but not sure where it is not normal.

You may enable verboseLevel="debug" to check what it is exactly doing the Drawing methods.

I cannot find this metadata member that is different. The run tag is the same, as it is the one defined in the aqs file, which is common for both root files. The only difference is the file name itself, but I’m not sure how to use it, as I try <classify fileName="path/file.root"/> I get a seg. fault. E.g., I have these 4 files (available in Sultan: /storage/cast/SR2019/analysis/xenon/v2.3/testCommonNoiseReduction)

R10852_00000_RawToSignal_Xenon_Calibration_30min_cristina_2.3.8_commonNoiseTestOFF_highGainRun_filter1.root
R10852_00001_RawToSignal_Xenon_Calibration_30min_cristina_2.3.8_commonNoiseTestOFF_highGainRun_filter1.root
R10852_00000_RawToSignal_Xenon_Calibration_30min_cristina_2.3.8_commonNoiseTestON_highGainRun_filter1.root
R10852_00001_RawToSignal_Xenon_Calibration_30min_cristina_2.3.8_commonNoiseTestON_highGainRun_filter1.root

and I need to combine the first 2 in the list (i.e., subruns 0 and 1 with common noise reduction OFF), and compare them to the other two combined (same subruns but with noise reduction ON). The runTag in all of them is the same: Xenon_Calibration_30min. Maybe it’s straightforward, but I didn’t find the way.


Oh, sorry, theres was a sentence missing!
What I wanted to say is that if I put a file list in the RML file for plotting, the first file in the list is omitted for plotting.
For example if I try to plot R10852 and R10964, and these are the first two in the file list, I only get plots for the second one (R10964). Can be repllicated with thir RML:
FirstFileBroken.rml (11.0 KB)

image

However, if I just put these two runs later in the list, for example in 3rd and 4th position, I can see both (
FirstFileOK.rml (11.0 KB)
)
image

I think I identified the problem. I also added a validation pipeline using the couple of files you were experiencing problems with.

I simplified your RML and placed it at rest/pipeline/analysisPlot/classify.rml

Then I use it to validate it with the files I placed at Index of /rest_pipeline

@nkx Those files were written with v2.3.8. So I thought they could be used to check backward compatibility with new versions.

But it seems those basic changes break something at PandaX-III data

1 Like

The plotting seems to work fine now, but I get a lot of errors. Do you also get them?

Hi Cristina, I have also seen similar messages, but I believe those problems dissapeared when I did properly compile the latest version.

Does it happen if you load /programas/rest/latest?

Ah, right. If I load /programas/rest/latest/thisREST.sh I don’t get the errors.

1 Like

Hello,
Coming back to this post, I think that <classify runTag="myRunTag"/> is not working properly. If I try to classify based on run number I have no problem, but if I try to use the run tag, the files are simply combined.

Here is the test RML I’m using:


<TRestManager name="SpecPlot" title="Example" verboseLevel="info" >

    <TRestAnalysisPlot name="CalComp" title="Calibration runs comparison" previewPlot="true" verboseLevel="silent">

<addFile name="/storage/cast/SR2019/analysis/argon/official/trackAnalysis/R10505_00000_SignalToTrack_Calibration_15min_cristina_2.3.9.root" /> -->
<addFile name="/storage/cast/SR2019/analysis/argon/official/trackAnalysis/R10506_00000_SignalToTrack_Background_23hr_cristina_2.3.9.root" />

	<!--<parameter name="ClasifyBy" value="runNumber" /> --> <!-- options are runTag, combineAll -->

    <canvas size="(2000,1000)" divide="(2,2)" save="/storage/cast/SR2019/analysis/argon/official/plots/CalComp_Fe55Peaks_No0Hits_R5mm_test.root" />

    <plot name="Spectrum" title="Hits Analysis energy spectrum" xlabel="Hits energy [ADC]" ylabel="Counts" logscale="on" save="" legend="on" stats="on" annotation="OFF" value="ON" >
     	<histo name="HitsEnergyFe55-5.9keV" lineColor="2">
           <variable name="tckAna_MaxTrackEnergy"  range="(0,32373)" nbins="250" />
		   <classify fRunNumber="10505"/>
    	</histo>
    	<histo name="HitsEnergy_Bckg-5.9keV" lineColor="3">
           <variable name="tckAna_MaxTrackEnergy"  range="(0,32373)" nbins="250" />
			<classify fRunNumber="10506"/>
    	</histo>
    </plot>

    <plot name="Spectrum2" title="Hits Analysis energy spectrum" xlabel="Hits energy [ADC]" ylabel="Counts" logscale="on" save="" legend="on" stats="on" annotation="OFF" value="ON" >
     	<histo name="HitsEnergyFe55-5.9keV-2" lineColor="2">
           <variable name="tckAna_MaxTrackEnergy"  range="(0,32373)" nbins="250" />
		   <classify fRunTag="Calibration_15min"/>
    	</histo>
    	<histo name="HitsEnergy_Bckg-5.9keV-2" lineColor="3">
           <variable name="tckAna_MaxTrackEnergy"  range="(0,32373)" nbins="250" />
			<classify fRunTag="Background_23hr"/>
    	</histo>
    </plot>

    <plot name="SpectrumBack" title="Hits Analysis energy spectrum" xlabel="Hits energy [ADC]" ylabel="Counts" logscale="on" save="" legend="on" stats="on" annotation="OFF" value="ON" >
    	<histo name="HitsEnergy_Bckg-5.9keV-only" lineColor="3">
           <variable name="tckAna_MaxTrackEnergy"  range="(0,32373)" nbins="250" />
           <classify fRunNumber="10506"/>
    	</histo>
    </plot>

    <plot name="SpectrumCal" title="Hits Analysis energy spectrum" xlabel="Hits energy [ADC]" ylabel="Counts" logscale="on" save="" legend="on" stats="on" annotation="OFF" value="ON" >
    	<histo name="HitsEnergy_Cal-5.9keV" lineColor="2">
           <variable name="tckAna_MaxTrackEnergy"  range="(0,32373)" nbins="250" />
		   <classify fRunNumber="10505"/>
    	</histo>
    </plot>

  </TRestAnalysisPlot>

  <addTask command="CalComp->PlotCombinedCanvas()" value="ON"/>

</TRestManager>

And the outpu is below.

  • The upper left plot uses run number to classify, and it works fine as we can see two spectra.
  • The upper right plot uses run tag, but it just combines everything (red+green spectra).
  • The two lower plots are there simply to show the number of entries, so that we can see that the one usign run tag is summing everything.

I haven’t tried using any other metadata members apart from these two.

Ok, I found the problem inside TRestRun. In principle the following lines of code

             if (runTagTmp != "Null" && runTagTmp != "preserve") fRunTag = runTagTmp;
             if (runDescriptionTmp != "Null" && runDescriptionTmp != "preserve")
                 fRunDescription = runDescriptionTmp;
             if (experimentNameTmp != "Null" && experimentNameTmp != "preserve")
                 fExperimentName = experimentNameTmp;

seem to be there to keep the value we have read from the RML file. That means, we read the input file for processing, and replace the values by the ones that were initialized by InitFromCofigFile, except if the field value says preserve or Null. Then, we use the value written on the input file (for processing).

But in the case that we do not load any values from the RML, as it is the case now, then the situation changes.

So, commenting those lines the problem is solved, but we need those lines when we read from an RML file and we use “preserve” keyword inside the RML. So, I believe a solution is to add a new bool variable that determines if the class was loaded from an RML file, and introduce a condition there.

Hope I didn’t break something else. Here it is the PR