Re: Re: Names of histograms reset after TFileMerger

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Mon, 23 Jun 2008 21:29:58 +0200


Yaxian,

I do not understand your mail.
Yves, can we discuss this offline?

Rene

Yaxian Mao wrote:
> Hi Rene and Yves,
> If as Yves told me the names of histograms would keep in the trunk of root, in this
> case we should be able to get the correct merge output with version of trunk, right?
> But why we still failed?
> So would you mind telling me what should I do to solve this problem since you catch
> the point? Many thanks!
> Regards,
> Yaxian
>
> Rene Brun wrote:
>
>> Yves,
>>
>> The result is what I expect. Your input file contains 22 keys, all named
>> "histosscaled". As a result,
>> you have only one key in output also named "histosscaled".
>>
>> Rene Brun
>>
>> Yves Schutz wrote:
>>
>>> Rene and rooters,
>>> I do not know if this problem is related to this new problem.
>>> Running the attached macro on the attached file I get the following
>>> output: only one entry in the output file after merging. I am using
>>> the trunk of root. The problem is the same with v5.19.04...
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> pb-d-128-141-48-228:ymao schutz$ root mm.C
>>> *******************************************
>>> * *
>>> * W E L C O M E to R O O T *
>>> * *
>>> * Version 5.19/05 14 May 2008 *
>>> * *
>>> * You are welcome to visit our Web site *
>>> * http://root.cern.ch *
>>> * *
>>> *******************************************
>>>
>>> ROOT 5.19/05 (trunk_at_24474, Jun 23 2008, 12:21:37 on macosx64)
>>>
>>> CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
>>> Type ? for help. Commands must be C++ statements.
>>> Enclose multiple statements between { }.
>>> root [0]
>>> Processing mm.C...
>>> [TFile::Cp] Total 0.07 MB |====================| 100.00 % [125.0 MB/s]
>>> [TFile::Cp] Total 0.09 MB |====================| 100.00 % [237.8 MB/s]
>>> [TFile::Cp] Total 0.00 MB |====================| 100.00 % [12.6 MB/s]
>>> TFile** file1.root
>>> TFile* file1.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
>>> TFile** mergedOutput.root
>>> TFile* mergedOutput.root
>>> KEY: TH2F histosscaled;1 #phi_{#gamma}
>>> root [1]
>>> Le 11 juin 08  16:33, Rene Brun a écrit :
>>>
>>>
>>>> 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 <mailto:maoyx_at_iopp.ccnu.edu.cn> *
>>>>> * Yaxian.Mao_at_gmail.com <mailto:Yaxian.Mao_at_gmail.com> *
>>>>> ************************************************
>>>>>
>>>>>
>>>>>
>>>> ============================================
>>>> 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 *
> ************************************************
>
>
Received on Mon Jun 23 2008 - 21:29:58 CEST

This archive was generated by hypermail 2.2.0 : Mon Jun 23 2008 - 23:50:02 CEST