Make the Scan method public
[u/mrichter/AliRoot.git] / MUON / AddTaskMuonAlignment.C
CommitLineData
4d610fd5 1/// \ingroup macros
2/// \file AddTaskMuonAlignment.C
3/// \brief Macro to add an AliMUONAlignmentTask to an analysis train
4///
5/// \author Javier Castillo, CEA/Saclay - Irfu/SPhN
6
56218672 7AliMUONAlignmentTask4 *AddTaskMuonAlignment(bool readrecs, bool doalign, bool writerecs, const char *name = "AliMUONAlignmentTask", const char *newalignocdb = "local://ReAlignOCDB", const char *oldalignocdb = "alien://Folder=/alice/data/2010/OCDB", const char *defaultocdb = "alien://Folder=/alice/data/2011/OCDB", const char *geofilename = "geometry.root")
4d610fd5 8{
56218672 9/// Creates a Muon Alignment task and adds it to the analysis manager.
4d610fd5 10
56218672 11 // Get the pointer to the existing analysis manager via the static access method.
12 //==============================================================================
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr) {
15 ::Error("AddTaskMuonAlignment", "No analysis manager to connect to.");
16 return NULL;
17 }
4d610fd5 18
56218672 19 // This task requires an ESD input handler.
20 // Check this using the analysis manager.
21 //===============================================================================
22 TString type = mgr->GetInputEventHandler()->GetDataType();
23 if (readrecs) {
24 if (!type.Contains("AOD")) {
25 ::Error("AddTaskMuonAlignment", "Alignment task is asked to read records but input data type is not AOD! Game over!");
26 return NULL;
27 }
28 } else {
29 if (!type.Contains("ESD")) {
30 ::Error("AddTaskMuonAlignment", "Alignment task is not asked to read records but input data type is not ESD! Game over!");
31 return NULL;
32 }
33 }
4d610fd5 34
56218672 35 // Create the task, add it to the manager and configure it.
36 //===========================================================================
37 // Muons
38 AliMUONAlignmentTask *muonalign = new AliMUONAlignmentTask(name, newalignocdb, oldalignocdb, defaultocdb, geofilename);
39 muonalign->SetLoadOCDBOnce(true);
40 muonalign->SetReadRecords(readrecs);
41 muonalign->SetDoAlignment(doalign);
42 muonalign->SetWriteRecords(writerecs);
43 mgr->AddTask(muonalign);
44
4d610fd5 45// // Cuts on primary tracks
46// AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
47// esdTrackCutsL->SetMinNClustersTPC(50);
48
49// AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
50// trackFilter->AddCuts(esdTrackCutsL);
51
52// muonalign->SetTrackFilter(trackFilter);
53
54
56218672 55 // Create ONLY the output containers for the data produced by the task.
56 // Get and connect other common input/output containers via the manager as below
57 //==============================================================================
58 mgr->ConnectInput(muonalign, 0, mgr->GetCommonInputContainer());
59 if (doalign) {
60 AliAnalysisDataContainer *listOut = mgr->CreateContainer("output", TList::Class(), AliAnalysisManager::kOutputContainer, "measShifts.root");
61 mgr->ConnectOutput(muonalign, 1, listOut);
62 }
63 if (writerecs) {
64 mgr->ConnectOutput(muonalign, 0, mgr->GetCommonOutputContainer());
65 }
66 return muonalign;
4d610fd5 67}