]>
Commit | Line | Data |
---|---|---|
ec2de8cc | 1 | #include "AliPhysicsSelection.h" |
2 | #include "AliAnalysisEtSelectionContainer.h" | |
3 | #include "TFile.h" | |
4 | #include "TSystem.h" | |
5 | #include <iostream> | |
6 | ||
7 | int Init() | |
8 | { | |
9 | } | |
10 | ||
11 | int CreatePhysicsSelection(Int_t runNumber, TString filename); | |
12 | AliPhysicsSelection* DefaultSelection(); | |
13 | ||
14 | ||
15 | AliPhysicsSelection* GetPhysicsSelection() | |
16 | { | |
17 | //Example of selection CMBS1* triggers (up to 137133), MANUAL SETTINGS REQUIRED | |
18 | AliPhysicsSelection * physSel = new AliPhysicsSelection(); | |
19 | physSel->AddCollisionTriggerClass("+CMBAC-B-NOPF-ALL"); | |
20 | physSel->AddCollisionTriggerClass("+CMBS1C-B-NOPF-ALL"); | |
21 | physSel->AddCollisionTriggerClass("+CMBS1A-B-NOPF-ALL"); | |
22 | // This are needed only to fill the statistics tables | |
23 | physSel->AddBGTriggerClass("+CMBAC-C-NOPF-ALL"); | |
24 | physSel->AddBGTriggerClass("+CMBS1C-C-NOPF-ALL"); | |
25 | physSel->AddBGTriggerClass("+CMBS1A-C-NOPF-ALL"); | |
26 | physSel->AddBGTriggerClass("+CMBAC-A-NOPF-ALL"); | |
27 | physSel->AddBGTriggerClass("+CMBS1C-A-NOPF-ALL"); | |
28 | physSel->AddBGTriggerClass("+CMBS1A-A-NOPF-ALL"); | |
29 | physSel->AddBGTriggerClass("+CMBAC-E-NOPF-ALL"); | |
30 | physSel->AddBGTriggerClass("+CMBS1C-E-NOPF-ALL"); | |
31 | physSel->AddBGTriggerClass("+CMBS1A-E-NOPF-ALL"); | |
32 | ||
33 | return physSel; | |
34 | ||
35 | } | |
36 | ||
37 | int UpdatePhysicsSelection(Int_t runNumber, TString filename) | |
38 | { | |
39 | ||
40 | AliPhysicsSelection *selection = GetPhysicsSelection(); | |
41 | ||
42 | TFile *file = TFile::Open(filename, "UPDATE"); | |
43 | ||
44 | AliAnalysisEtSelectionContainer *container = (dynamic_cast<AliAnalysisEtSelectionContainer*>(file->Get("physicsSelections"))); | |
45 | if(container) | |
46 | { | |
47 | container->AddDefaultSelection(DefaultSelection()); | |
48 | container->AddPhysicsSelection(selection, runNumber); | |
49 | ||
50 | container->Write(); | |
51 | file->Close(); | |
52 | } | |
53 | else | |
54 | { | |
55 | file->Close(); | |
56 | CreatePhysicsSelection(runNumber, filename); | |
57 | } | |
58 | return 0; | |
59 | } | |
60 | ||
61 | int UpdatePhysicsSelection(AliPhysicsSelection *selection, Int_t runNumber, TString filename) | |
62 | { | |
63 | ||
64 | TFile *file = TFile::Open(filename, "UPDATE"); | |
65 | ||
66 | AliAnalysisEtSelectionContainer *container = (dynamic_cast<AliAnalysisEtSelectionContainer*>(file->Get("physicsSelections"))); | |
67 | ||
68 | if(container) | |
69 | { | |
70 | container->AddDefaultSelection(DefaultSelection()); | |
71 | container->AddPhysicsSelection(selection, runNumber); | |
72 | ||
73 | container->Write(); | |
74 | file->Close(); | |
75 | } | |
76 | ||
77 | else | |
78 | { | |
79 | file->Close(); | |
80 | CreatePhysicsSelection(runNumber, filename); | |
81 | } | |
82 | ||
83 | return 0; | |
84 | } | |
85 | ||
86 | int CreatePhysicsSelection(Int_t runNumber, TString filename) | |
87 | { | |
88 | TFile *file = TFile::Open(filename, "RECREATE"); | |
89 | ||
90 | AliAnalysisEtSelectionContainer *container = new AliAnalysisEtSelectionContainer("physicsSelections"); | |
91 | container->Write(); | |
92 | file->Close(); | |
93 | ||
94 | UpdatePhysicsSelection(runNumber, filename); | |
95 | ||
96 | return 0; | |
97 | } | |
98 | ||
99 | AliPhysicsSelection* DefaultSelection() | |
100 | { | |
101 | return new AliPhysicsSelection(); | |
102 | } | |
103 | ||
104 | ||
105 | ||
106 |