Introducing a new AOD class: AliAODcascade (A.Maire)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / AliKStarAnalysis.C
CommitLineData
ec908cae 1void AliKStarAnalysis
2(
3 const char *path = "/home/pulvir/resonances/aliroot-v4-04-Rev-08/pythia/selections",
4 Double_t ptMin = 0.0,
5 Double_t ptMax = 0.0
6)
7{
8 gSystem->Load("libPWG2.so");
9
10 TChain *tree = new TChain("selection");
11
12 // Open the working directory
13 void *dirp = gSystem->OpenDirectory(path);
14 const char *name = 0x0;
15
16 // Add all files matching *pattern* to the chain
17 while((name = gSystem->GetDirEntry(dirp))) {
18 if (strstr(name, ".root")) {
19 cout << "Adding " << name << endl;
20 tree->Add(Form("%s/%s", path, name));
21 }
22 }
23 gSystem->FreeDirectory(dirp);
24
25 // assign working parameters
26 AliRsnAnalysis *analysis = new AliRsnAnalysis;
27 analysis->SetEventsTree(tree);
28 if (ptMin < ptMax && ptMax != 0.0) {
29 analysis->SetPtBin(ptMin, ptMax);
30 }
31
32 // set histogram bins
33 analysis->SetBins(300, 0.5, 2.0); // 300 bins of 5 MeV each
34 analysis->SetTrueMotherPDG(313); // PDG code of K*
35
36 // import all useful combinations
37 analysis->AddPairDef(AliPID::kPion, '+', AliPID::kKaon, '-');
38 analysis->AddPairDef(AliPID::kPion, '-', AliPID::kKaon, '+');
39 analysis->AddPairDef(AliPID::kPion, '+', AliPID::kKaon, '-', kTRUE);
40 analysis->AddPairDef(AliPID::kPion, '-', AliPID::kKaon, '+', kTRUE);
41
42 analysis->AddMixPairDef(AliPID::kPion, '+', AliPID::kKaon, '-');
43 analysis->AddMixPairDef(AliPID::kPion, '-', AliPID::kKaon, '+');
44 analysis->AddMixPairDef(AliPID::kKaon, '-', AliPID::kPion, '+');
45 analysis->AddMixPairDef(AliPID::kKaon, '+', AliPID::kPion, '-');
46
47 // process data for signal event in same event
48 analysis->Process();
49 analysis->EventMix(5, 5, 0.02, kFALSE);
50
51 // open output file
52 TFile *outFile = 0;
53 if (ptMin == ptMax && ptMin == 0.) {
54 outFile = TFile::Open("kstar.invmass.root", "RECREATE");
55 }
56 else {
57 outFile = TFile::Open(Form("kstar.invmass.pt%3.1f-%3.1f.root", ptMin, ptMax), "RECREATE");
58 }
59
60 // write histograms
61 analysis->WriteHistograms();
62
63 outFile->Close();
64}