Hi Karl,
I do not understand what you try to do in the loop.
Instead of:
PulseHisto[x][y][Gamma][Sid][n]->Add((TH1S*)Histo->Clone());
delete Histo;
you can do:
PulseHisto[x][y][Gamma][Sid][n]->Add(Histo);
Could you provide a short running example to illustrate the problem?
Also note that THStack has two drawing modes;
- default cumulative option
- option "nostack" is specified, histograms are all paint in the same pad
as if the option "same" had been specified.
Rene Brun
K. Hauschild wrote:
>
> Hi,
>
> I am having a general problem superimposing histograms
> and storing these multiple histogram plots in a root file.
>
> For data that passes certain selection criteria
> I would like to super-impose histograms.
>
> The data is selected by
> position x (roughly 30 positions)
> position y ( ---- " ----- )
> trigger energy
> segment muliplicity
> segment energy
>
> I then wish to save super-imposed histograms according to
>
> histo[x][y][triggerE][segment hit][n=0,2,3,4]
>
> I have been unable to get THStack to function
> as I would like.....
>
> ...code frgment after x, y, Gamma, Sid determined :
>
> //Look at Flash ADC
> for(n = 0; n < 4; n++) {
> TH1S *Histo = new TH1S("fadc","",250,-2,998);
> for( int t = 0; t < 250; t++) {
> Histo->Fill(t*4,p[n][t]);
> }
> PulseHisto[x][y][Gamma][Sid][n]->Add((TH1S*)Histo->Clone());
> delete Histo;
> }
> .....
>
> This seems to give a cummulative sum of p[n][t].
> I have also tried Histo->SetBinContent(t+1,p[n][t])
>
> Since there are 30*30*4*4*4 sets of histograms I do not
> want to have to draw individual canvases and have to save
> them by hand.
>
> I have been able to save each individual histogram by
> forcing a Histo->Write(), but the file soon becomes very,
> very, large.
>
> If anyone has some suggestions it would be greatly
> appreciated.
>
> Many thanks,
>
> Karl
>
> ==========================================================================
>
> CEA Saclay, DAPNIA/SPhN Phone : (33) 01 69 08 7553
> Bat 703 - l'Orme des Merisiers Fax : (33) 01 69 08 7584
> F-91191 Gif-sur-Yvette E-mail : khauschild@cea.fr
> France karl_hauschild@yahoo.co.uk
> WWW: http://www-dapnia.cea.fr/Sphn
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET