GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Analysis » analysis of multiple files
analysis of multiple files [message #13578] Wed, 06 June 2012 16:02 Go to next message
Dmitry Khaneft is currently offline  Dmitry Khaneft
Messages: 75
Registered: January 2009
continuous participant
From: *kph.uni-mainz.de
Dear all,

I want to perform mixed analysis of my signal and background files. I have 2 sets of sim/digi/reco/pid/par files. I looked into the FairRunAna code and as I understood I should use following functions

  // *** the files coming from the simulation
  TString inSimFile  = "./data/epem_mom3.3_gegm0.0_seed1001sim.root"; // this file contains the MC truth
  TString inRecoFile = "./data/epem_mom3.3_gegm0.0_seed1001reco.root";
  TString inPidFile  = "./data/epem_mom3.3_gegm0.0_seed1001pid.root"; // this file contains the PndPidCandidates
  //TString inParFile  = "./data/epem_mom3.3_gegm0.0_seed1001params.root";

  TString inSimFile_bg  = "./data/pipi_mom3.3_costheta0.9_seed10000sim.root"; // this file contains the MC truth
  TString inRecoFile_bg = "./data/pipi_mom3.3_costheta0.9_seed10000reco.root";
  TString inPidFile_bg  = "./data/pipi_mom3.3_costheta0.9_seed10000pid.root"; // this file contains the PndPidCandidates
  //TString inParFile_bg  = "./data/pipi_mom3.3_costheta0.9_seed10000params.root";

  // *** initialization
  FairRunAna* fRun = new FairRunAna();
  FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
  // *** add signal files
  fRun->SetInputFile(inSimFile);
  fRun->AddFriend(inPidFile);
  fRun->AddFriend(inRecoFile);
  // *** add background files
  fRun->SetBackgroundFile(inSimFile_bg);
  fRun->AddBackgroundFile(inPidFile_bg);
  fRun->AddBackgroundFile(inRecoFile_bg);


and for parameter files I did following

  TFile *file_sig = new TFile("./data/epem_mom3.3_gegm0.0_seed1001params.root","READ");
  TFile *file_bg = new TFile("./data/pipi_mom3.3_costheta0.9_seed10000params.root","READ");

  TList *list = new TList();
  list->Add(file_sig);
  list->Add(file_bg);

  FairParRootFileIo* parIO = new FairParRootFileIo();
  parIO->open(list);
  rtdb->setFirstInput(parIO);


the problem is that I have no entries in the analysis loop after this.

What is wrong in my code?

Also, what should I do if I have multiple signal and background events?

Thanks in advance,
Dmitry
Re: analysis of multiple files [message #13580 is a reply to message #13578] Wed, 06 June 2012 20:53 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *teletektelekom.com
Hi,
I am not expert on such code, Mohammad could comment, but if I remember well you should first launch your simulation for signal and background separately, and after at the digitization level you merge signal and background. At the digi level, not after pid.
Maybe this is your problem. Just try with a small bunch of event.
Re: analysis of multiple files [message #13582 is a reply to message #13578] Fri, 08 June 2012 10:52 Go to previous messageGo to next message
Dmitry Khaneft is currently offline  Dmitry Khaneft
Messages: 75
Registered: January 2009
continuous participant
From: *kph.uni-mainz.de
Ok. I think I will be happy if someone could help me with the second question.

What should I do if I have multiple sim/reco/pid/par files? Before I used TChain to process multiple files as one but FairRunAna class needs TString.
Re: analysis of multiple files [message #13587 is a reply to message #13582] Fri, 08 June 2012 20:07 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hi,

The signal and background are mixed at digitization level, and when you do that you have to use:

FairRunAna::SetSignalFile(TString name, UInt_t identifier )


you can add as many signals as you like as long as they have different identifiers, if you add two different files with the same identifier it will be simply chained.


FairRunAna::SetBackgroundFile(TString name)
FairRunAna::AddBackgroundFile(TString name)


This will set the background file and chain the added files.


In fact your code should exit immediately when you call "fRun->SetBackgroundFile(inSimFile_bg);" but it is a bug which we should correct!

regards,

Mohammad
Re: analysis of multiple files [message #13591 is a reply to message #13587] Mon, 11 June 2012 14:42 Go to previous messageGo to next message
Dmitry Khaneft is currently offline  Dmitry Khaneft
Messages: 75
Registered: January 2009
continuous participant
From: *kph.uni-mainz.de
Mohammad Al-Turany wrote on Fri, 08 June 2012 20:07

Hi,

The signal and background are mixed at digitization level, and when you do that you have to use:

FairRunAna::SetSignalFile(TString name, UInt_t identifier )


you can add as many signals as you like as long as they have different identifiers, if you add two different files with the same identifier it will be simply chained.

regards,

Mohammad


Thanks for the answer but it works only if mixed mode was used. Can I chain normal files without mixing?

cheers,
Dmitry
Re: analysis of multiple files [message #13593 is a reply to message #13591] Mon, 11 June 2012 20:07 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *dip.t-dialin.net
Hi,

Yes, you need to use:

Set the input file by name

   void        FairRunAna::SetInputFile(TString fname);


Add a file to input chain

void        FairRunAna::AddFile(TString name);



Cheers,

Mohammad

Re: analysis of multiple files [message #13594 is a reply to message #13578] Tue, 12 June 2012 10:56 Go to previous messageGo to next message
Dmitry Khaneft is currently offline  Dmitry Khaneft
Messages: 75
Registered: January 2009
continuous participant
From: *kph.uni-mainz.de
Thanks it works.
Re: analysis of multiple files [message #14771 is a reply to message #13578] Thu, 23 May 2013 13:41 Go to previous messageGo to next message
Simon Reiter is currently offline  Simon Reiter
Messages: 44
Registered: May 2013
continuous participant
From: *zeu.uni-giessen.de
Hi,

I simulated my background with 2000 events and 100 times till now. Now I want to merge them into one histogram. Do I really need to add all 400 files (sim, simparams, reco and pid) into the analysis code? Because the sim-file is about 2GB.

The second question is: Do I only need the mixing mode for simulating the dead time of the detectors or are there other benefits?

Thanks so far for the tutorial Wink
Re: analysis of multiple files [message #14772 is a reply to message #14771] Thu, 23 May 2013 13:54 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 37.101.24*
Hi,
The best way to analyze multiple files is to run analysis on each file, and at the end to merge the final histograms/ntuples with hadd command.

About the second question, I admit I have not understood it very well. Could you please be more explicit?
Re: analysis of multiple files [message #14773 is a reply to message #13578] Thu, 23 May 2013 14:52 Go to previous messageGo to next message
Simon Reiter is currently offline  Simon Reiter
Messages: 44
Registered: May 2013
continuous participant
From: *zeu.uni-giessen.de
I just want to know what the advantage of the mixing method over the hadd methode is.
The only thing I noticed was the dead time of the detector if multiple particles hit the same part of the detector.
Re: analysis of multiple files [message #14774 is a reply to message #14773] Thu, 23 May 2013 14:54 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
What do you call "the mixing method"?
Re: analysis of multiple files [message #14775 is a reply to message #13578] Thu, 23 May 2013 14:56 Go to previous messageGo to next message
Simon Reiter is currently offline  Simon Reiter
Messages: 44
Registered: May 2013
continuous participant
From: *zeu.uni-giessen.de
Oh sry, I'm talking about mixing/merging the signal simulation and background simulation.
Re: analysis of multiple files [message #14778 is a reply to message #14775] Thu, 23 May 2013 15:16 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
How do you do such merging? We have several ways implemented.
There is the tracking mixing, provided by Gianluigi' code. There is the event mixing from the run, Mohammad can tell you more. You could add two different generators, which is messy. You could add only the final histograms, assuming that signal events and background events are well separated.
Can you please describe what exactly you are doing, and for which purpose?
Re: analysis of multiple files [message #14780 is a reply to message #13578] Thu, 23 May 2013 15:24 Go to previous messageGo to next message
Simon Reiter is currently offline  Simon Reiter
Messages: 44
Registered: May 2013
continuous participant
From: *zeu.uni-giessen.de
I'm just talking about the mixed analysis in the first post!
And I only want to know what the advantage over merging the histograms is.

Sry for confusing..
Re: analysis of multiple files [message #14783 is a reply to message #14780] Thu, 23 May 2013 15:43 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *unito.it
Sorry but I have never used it. Most probably Mohammad coud tell you something about.
But I believe that it embeds signal events inside the bg events. This means that the same event has both signal hits and bg hits, then tracking is more difficult and combinatorial could be higher. If you add the histograms at the end you assume that signal and bg are well separated, which is a bit less realistic.
I suggest to send a mail to Mohammad.
Re: analysis of multiple files [message #14784 is a reply to message #13578] Thu, 23 May 2013 15:47 Go to previous message
Simon Reiter is currently offline  Simon Reiter
Messages: 44
Registered: May 2013
continuous participant
From: *zeu.uni-giessen.de
I expected the same, but for my first runs, adding the histograms should do it. Thanks
Previous Topic: Problem with 4C-fit
Next Topic: Small positive chi2 values in PndKinFitter
Goto Forum:
  


Current Time: Thu Mar 28 13:49:31 CET 2024

Total time taken to generate the page: 0.01327 seconds