Introducing a new AOD class: AliAODcascade (A.Maire)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / AliRsnSelect.C
1 void AliRsnSelect
2 (
3         Int_t     event            = 1,
4         Option_t *inRootPath       = "/home/pulvir/resonances/aliroot-v4-04-Rev-08/pythia/events",
5         Option_t *outRootPath      = "/home/pulvir/resonances/aliroot-v4-04-Rev-08/pythia/selections",
6         Double_t  ptLimit4PID      = 10000.0
7 )
8 {
9         // load ANALYSIS library for output objects
10         gSystem->Load("libPWG2.so");
11         
12         // instantiate reading manager
13         AliRsnReader *reader = new AliRsnReader;
14         
15         // Define prior probabilities (only for ESD PID)
16         reader->SetPriorProbability(AliPID::kElectron, 0.0339947); //0.0339947                                                                                                                  
17         reader->SetPriorProbability(AliPID::kMuon,     0.0192307); //0.0192307
18         reader->SetPriorProbability(AliPID::kPion,     0.822957);  //0.822957 
19         reader->SetPriorProbability(AliPID::kKaon,     0.0751355); //0.0751355
20         reader->SetPriorProbability(AliPID::kProton,   0.0486821); //0.0486821
21         reader->SetProbabilityThreshold(0.5);
22         
23         // Define PID method
24         reader->SetPIDMethod(AliRsnReader::kPerfectPID);
25
26         // create input/output names
27         Text_t inPath[200], outFileName[200];
28         sprintf(inPath, "%s/%d", inRootPath, event);
29         sprintf(outFileName, "%s/%d.root", outRootPath, event);
30                                 
31         // do event reading
32         cout << "Reading data in " << inPath << endl;
33         TTree *events = reader->ReadTracksAndParticles(inPath, "R");
34         if (!events) return;
35         cout << endl;
36         
37         // open output file
38         TFile *fileOut = TFile::Open(outFileName, "RECREATE");
39         cout << "Saving  data in " << outFileName << endl;
40         events->Write(events->GetName(), TObject::kOverwrite);
41         fileOut->Close();
42 }