]>
Commit | Line | Data |
---|---|---|
7c1a1f1d | 1 | /** |
2 | * @file | |
3 | * | |
4 | * @ingroup pwg2_forward_scripts | |
0bd4b00f | 5 | */ |
6 | /** | |
7 | * Run a pass on ESD data to produce the energ loss fits | |
8 | * | |
9 | * | |
7c1a1f1d | 10 | * @ingroup pwg2_forward_scripts |
0bd4b00f | 11 | */ |
9e59fb95 | 12 | void MakeELossFits(const char* esddir, |
0bd4b00f | 13 | Int_t nEvents=1000, |
14 | Bool_t mc=false, | |
15 | Bool_t proof=false) | |
16 | { | |
17 | // --- Libraries to load ------------------------------------------- | |
18 | gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C"); | |
19 | ||
20 | // --- Check for proof mode, and possibly upload pars -------------- | |
21 | if (proof) | |
22 | gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C"); | |
23 | ||
24 | // --- Our data chain ---------------------------------------------- | |
25 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeESDChain.C"); | |
9e59fb95 | 26 | TChain* chain = MakeESDChain(esddir, mc); |
0bd4b00f | 27 | // If 0 or less events is select, choose all |
28 | if (nEvents <= 0) nEvents = chain->GetEntries(); | |
9e59fb95 | 29 | Info("MakeELossFits", "Will analyse %d events", nEvents); |
0bd4b00f | 30 | |
31 | // --- Creating the manager and handlers --------------------------- | |
32 | AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", | |
33 | "FMD analysis train"); | |
34 | ||
35 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); | |
36 | esdHandler->SetInactiveBranches("AliESDACORDE " | |
37 | "AliRawDataErrorLogs " | |
38 | "CaloClusters " | |
39 | "Cascades " | |
40 | "EMCALCells " | |
41 | "EMCALTrigger " | |
42 | "Kinks " | |
43 | "Cascades " | |
44 | "MuonTracks " | |
45 | "TrdTracks " | |
46 | "CaloClusters " | |
47 | "HLTGlobalTrigger"); | |
48 | mgr->SetInputEventHandler(esdHandler); | |
49 | ||
50 | // AOD output handler | |
51 | AliAODHandler* aodHandler = new AliAODHandler(); | |
52 | mgr->SetOutputEventHandler(aodHandler); | |
53 | aodHandler->SetOutputFileName("AliAODs.root"); | |
54 | ||
55 | // --- Add tasks --------------------------------------------------- | |
56 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C"); | |
57 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
58 | AddTaskPhysicsSelection(mc, kTRUE, kTRUE); | |
59 | AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter"); | |
60 | mgr->AddTask(task); | |
61 | ||
62 | // --- Make the output container and connect it -------------------- | |
63 | TString outputfile = "energyFits.root"; | |
64 | AliAnalysisDataContainer* histOut = | |
65 | mgr->CreateContainer("Forward", TList::Class(), | |
66 | AliAnalysisManager::kOutputContainer,outputfile); | |
67 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
68 | mgr->ConnectOutput(task, 1, histOut); | |
69 | ||
70 | // --- Set parameters on the algorithms ---------------------------- | |
71 | // Set the number of SPD tracklets for which we consider the event a | |
72 | // low flux event | |
73 | task->GetEventInspector().SetLowFluxCut(1000); | |
74 | // Set the maximum error on v_z [cm] | |
75 | task->GetEventInspector().SetMaxVzErr(0.2); | |
76 | // Set the eta axis to use - note, this overrides whatever is used | |
77 | // by the rest of the algorithms - but only for the energy fitter | |
78 | // algorithm. | |
79 | task->GetEnergyFitter().SetEtaAxis(200, -4, 6); | |
80 | // Set maximum energy loss to consider | |
81 | task->GetEnergyFitter().SetMaxE(10); | |
82 | // Set number of energy loss bins | |
83 | task->GetEnergyFitter().SetNEbins(300); | |
84 | // Set whether to use increasing bin sizes | |
85 | task->GetEnergyFitter().SetUseIncreasingBins(true); | |
86 | // Set whether to do fit the energy distributions | |
87 | task->GetEnergyFitter().SetDoFits(kTRUE); | |
88 | // Set whether to make the correction object | |
89 | task->GetEnergyFitter().SetDoMakeObject(kTRUE); | |
90 | // Set the low cut used for energy | |
91 | task->GetEnergyFitter().SetLowCut(0.4); | |
92 | // Set the number of bins to subtract from maximum of distributions | |
93 | // to get the lower bound of the fit range | |
94 | task->GetEnergyFitter().SetFitRangeBinWidth(4); | |
95 | // Set the maximum number of landaus to try to fit (max 5) | |
96 | task->GetEnergyFitter().SetNParticles(5); | |
97 | // Set the minimum number of entries in the distribution before | |
98 | // trying to fit to the data | |
99 | task->GetEnergyFitter().SetMinEntries(1000); | |
100 | // --- Set limits on fits the energy ------------------------------- | |
101 | // Maximum relative error on parameters | |
102 | AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12; | |
103 | // Least weight to use | |
104 | AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5; | |
105 | // Maximum value of reduced chi^2 | |
106 | AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 5; | |
107 | ||
108 | // --- Run the analysis -------------------------------------------- | |
109 | TStopwatch t; | |
110 | if (!mgr->InitAnalysis()) { | |
111 | Error("RunManager", "Failed to initialize analysis train!"); | |
112 | return; | |
113 | } | |
114 | // Some informative output | |
115 | mgr->PrintStatus(); | |
116 | // mgr->SetDebugLevel(3); | |
117 | if (mgr->GetDebugLevel() < 1 && !proof) mgr->SetUseProgressBar(kTRUE); | |
118 | ||
119 | // Run the train | |
120 | t.Start(); | |
121 | Printf("=== RUNNING ANALYSIS =================================="); | |
122 | mgr->StartAnalysis(proof ? "proof" : "local", chain, nEvents); | |
123 | t.Stop(); | |
124 | t.Print(); | |
125 | } | |
126 | // | |
127 | // EOF | |
128 | // |