Your input files contain one single TKey named "histosscaled". The
corresponding record contains a TList with several histograms (TH1F and
TH2F).
When you merge the two files, the TList of each file is correctly merged
into one single TList containing the merged histograms. The output file
has one single TKey with this Tlist
TFile** mergedOutput.root
TFile* mergedOutput.root
KEY: TList histosscaled;1 Doubly linked list
If you import the TList in memory and list the contents you will see all your histograms with the correct titles, etc. Just execute the following script to see what happens.
Rene Brun
void mm()
{
TFileMerger m ;
TString outName("mergedOutput.root") ;
m.OutputFile(outName) ; m.AddFile("histosscaled1.root") ; m.AddFile("histosscaled2.root") ; m.Merge() ;
Yaxian Mao wrote:
> I am sorry. I got the same output on my screen when I excute the macro. However if
> you go to the mergeOutput.root file created by this macro,you will see the names of
> all the histograms become histosscaled 1, 2, 3 ... not like the display on the
> screen.,
> Thanks a lot!
> Cheers...Yaxian
>
> Rene Brun wrote:
>
>> As already reported to you, I cannot reproduce your problem. See my
>> previous mail
>>
>> Rene Brun
>>
>> Yaxian Mao wrote:
>>
>>> Hi Rene,
>>> I am sorry to disturb you again. But may I ask how about my problem? could you
>>> reproduce it or not? maybe this is trival for you but it is not convenient for me if a
>>> long time later I don't know exactly what I was plotted on my histogram.
>>> Thanks for your help!
>>> Regards,
>>> Yaxian
>>>
>>> Rene Brun wrote:
>>>
>>>
>>>> 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>
>>>>>>
>>>>>>
>>>>
>>> ************************************************
>>> * Yaxian Mao *
>>> * *
>>> * Address: Institute of Particle Physics, *
>>> * Huazhong Normal University *
>>> * Wuhan, 430079, P. R. China *
>>> * Tel: 0086 27 6786 7946 (lab) *
>>> * 0086 27 8785 2613 (dormitory) *
>>> * Fax: 0086 27 6786 3213 *
>>> * Email: maoyx_at_iopp.ccnu.edu.cn *
>>> * Yaxian.Mao_at_gmail.com *
>>> ************************************************
>>>
>>>
>>>
>>
>>
>
>
> ************************************************
> * Yaxian Mao *
> * *
> * Address: Institute of Particle Physics, *
> * Huazhong Normal University *
> * Wuhan, 430079, P. R. China *
> * Tel: 0086 27 6786 7946 (lab) *
> * 0086 27 8785 2613 (dormitory) *
> * Fax: 0086 27 6786 3213 *
> * Email: maoyx_at_iopp.ccnu.edu.cn *
> * Yaxian.Mao_at_gmail.com *
> ************************************************
>
>
Received on Thu Jun 12 2008 - 12:03:31 CEST
This archive was generated by hypermail 2.2.0 : Thu Jun 12 2008 - 17:50:02 CEST