Re: Names of histograms reset after TFileMerger

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 10 Jun 2008 09:18:34 +0200


Yves,

When I run your script I obtain the output below and it is what I expect. What is your version of ROOT?

Rene

root [1] .x merge.C

[TFile::Cp] Total 0.02 MB       |====================| 100.00 % [47.9 MB/s]
[TFile::Cp] Total 0.02 MB       |====================| 100.00 % [54.0 MB/s]
[TFile::Cp] Total 0.02 MB       |====================| 100.00 % [55.9 MB/s]
hPtGammaScaled Number of #gamma over calorimeter
hPhiGammaScaled #phi_{#gamma}
hEtaGammaScaled #phi_{#gamma}
hConePtSumScaled #Sigma p_{T}  in cone

hPtPromptScaled Number of #gamma over calorimeter hPhiPromptScaled #phi_{#gamma}
hEtaPromptScaled #phi_{#gamma}
hPtFragmentationScaled Number of #gamma over calorimeter hPhiFragmentationScaled #phi_{#gamma}
hEtaFragmentationScaled #phi_{#gamma}
hPtPi0DecayScaled Number of #gamma over calorimeter hPhiPi0DecayScaled #phi_{#gamma}
hEtaPi0DecayScaled #phi_{#gamma}
hPtOtherDecayScaled Number of #gamma over calorimeter hPhiOtherDecayScaled #phi_{#gamma}
hEtaOtherDecayScaled #phi_{#gamma}
hPtConversionScaled Number of #gamma over calorimeter
hPhiConversionScaled #phi_{#gamma}
hEtaConversionScaled #phi_{#gamma}
hPtUnknownScaled Number of #gamma over calorimeter
hPhiUnknownScaled #phi_{#gamma}
hEtaUnknownScaled #phi_{#gamma}
TFile**         mergedOutput.root
 TFile*         mergedOutput.root

  KEY: TList histosscaled;1 Doubly linked list root [2]

Yves Schutz wrote:
> Rene,
> The wrong macro has been sent to you. What Yaxian wanted to point to
> is that the Name of the Merged histograms are not kept.
> Just run the following macro. Thanks ... Yves
> void merge()
> {
> TFileMerger m ;
> TString outName("mergedOutput.root") ;
> m.OutputFile(outName) ;
> m.AddFile("histosscaled1.root") ;
> m.AddFile("histosscaled2.root") ;
> m.Merge() ;
> TFile in("histosscaled1.root") ;
> TList * l = (TList*)in.Get("histosscaled") ;
> for (Int_t index = 0; index < l->GetEntries(); index++)
> cout << l->At(index)->GetName() << " " << l->At(index)->GetTitle()
> << endl ; ;
> TFile out(outName) ;
> out.ls() ;
> }
>
> and you get
> hPtGammaScaled Number of #gamma over calorimeter
> hPhiGammaScaled #phi_{#gamma}
> hEtaGammaScaled #phi_{#gamma}
> hConePtSumScaled #Sigma p_{T} in cone
> hPtPromptScaled Number of #gamma over calorimeter
> hPhiPromptScaled #phi_{#gamma}
> hEtaPromptScaled #phi_{#gamma}
> hPtFragmentationScaled Number of #gamma over calorimeter
> hPhiFragmentationScaled #phi_{#gamma}
> hEtaFragmentationScaled #phi_{#gamma}
> hPtPi0DecayScaled Number of #gamma over calorimeter
> hPhiPi0DecayScaled #phi_{#gamma}
> hEtaPi0DecayScaled #phi_{#gamma}
> hPtOtherDecayScaled Number of #gamma over calorimeter
> hPhiOtherDecayScaled #phi_{#gamma}
> hEtaOtherDecayScaled #phi_{#gamma}
> hPtConversionScaled Number of #gamma over calorimeter
> hPhiConversionScaled #phi_{#gamma}
> hEtaConversionScaled #phi_{#gamma}
> hPtUnknownScaled Number of #gamma over calorimeter
> hPhiUnknownScaled #phi_{#gamma}
> hEtaUnknownScaled #phi_{#gamma}
> TFile** mergedOutput.root
> TFile* mergedOutput.root
> KEY: TH2F histosscaled;22 #phi_{#gamma}
> KEY: TH2F histosscaled;21 #phi_{#gamma}
> KEY: TH1F histosscaled;20 Number of #gamma over calorimeter
> KEY: TH2F histosscaled;19 #phi_{#gamma}
> KEY: TH2F histosscaled;18 #phi_{#gamma}
> KEY: TH1F histosscaled;17 Number of #gamma over calorimeter
> KEY: TH2F histosscaled;16 #phi_{#gamma}
> KEY: TH2F histosscaled;15 #phi_{#gamma}
> KEY: TH1F histosscaled;14 Number of #gamma over calorimeter
> KEY: TH2F histosscaled;13 #phi_{#gamma}
> KEY: TH2F histosscaled;12 #phi_{#gamma}
> KEY: TH1F histosscaled;11 Number of #gamma over calorimeter
> KEY: TH2F histosscaled;10 #phi_{#gamma}
> KEY: TH2F histosscaled;9 #phi_{#gamma}
> KEY: TH1F histosscaled;8 Number of #gamma over calorimeter
> KEY: TH2F histosscaled;7 #phi_{#gamma}
> KEY: TH2F histosscaled;6 #phi_{#gamma}
> KEY: TH1F histosscaled;5 Number of #gamma over calorimeter
> KEY: TH2F histosscaled;4 #Sigma p_{T} in cone
> KEY: TH2F histosscaled;3 #phi_{#gamma}
> KEY: TH2F histosscaled;2 #phi_{#gamma}
> KEY: TH1F histosscaled;1 Number of #gamma over calorimeter
> Le 10 juin 08 à 08:40, Rene Brun a écrit :
>
>> I do not understand what you are trying to achieve. Your histograms are
>> correctly merged with the statement
>> Bool_t result = m.Merge();
>>
>> but I have no idea of what you want to do with the code following this
>> statement.
>> Your input files contain a TList of histograms, but you loop on the
>> TKeys as if each histogram was a TKey.
>>
>> Rene Brun
>>
>> Yaxian Mao wrote:
>>> Dear Rene and all,
>>> I encounterd one problem when I try to merge two different root
>>> files by TFileMerger,
>>> which never happened before. After merging, all names of histograms
>>> in the root file
>>> are reseted by itself. I can not understand why, could somebody help
>>> me to solve this
>>> problem? Thanks very much!
>>> My root version is: v5-19-04
>>> Best regards,
>>> Yaxian
>>
>
>> ============================================
>> Yves SCHUTZ (IN2P3-CNRS) collaboration ALICE
>> Office: 301 01 022 GSM: +41 76 487 4755
>> Mailbox: F02210 Tel: +41 22 76 72 131
>> CERN Fax: +41 22 76 79 480
>> CH-1211 Genève 23 mél: schutz_at_in2p3.fr <mailto:schutz_at_in2p3.fr>
>
Received on Tue Jun 10 2008 - 09:18:56 CEST

This archive was generated by hypermail 2.2.0 : Wed Jun 11 2008 - 17:50:01 CEST