1 //--------------------------------------------------------------------------
2 // Base macro for submitting trigger chamber efficiency determination.
4 // In case it is not run with full aliroot, it needs to have in the working directory:
12 // The macro reads ESDs and outputs file:
13 // - MUON.TriggerEfficiencyMap.root
15 // To display the trigger chamber efficiency:
17 // > AliMUONTriggerEfficiencyCells effCells("MUON.TriggerEfficiencyMap.root")
18 // > effCells.DisplayEfficiency()
19 //--------------------------------------------------------------------------
21 enum anaModes {kMlocal, kMgridLocal, kMgrid};
22 TString modeName[3] = {"local", "local", "grid"};
23 const TString kDefaultLocalInputDir="$ALICE_ROOT/MUON/test_out.100";
24 const TString kDefaultXmlFile="wn.xml";
26 void AnalysisTrigChEff(Int_t mode=kMlocal)
28 // Example of running analysis train
32 gSystem->Load("libTree.so");
33 gSystem->Load("libGeom.so");
34 gSystem->Load("libVMC.so");
35 gSystem->Load("libPhysics.so");
38 TString checkString=gSystem->Getenv("ALICE_ROOT");
39 checkString.Append("/lib/tgt_linux/libMUONbase.so");
40 TString foundLib=gSystem->GetLibraries(checkString.Data());
42 if(foundLib.Length()==0){
44 SetupPar("STEERBase");
48 SetupPar("ANALYSISalice");
52 // Analysis using standard AliRoot libraries
53 gSystem->Load("libSTEERBase.so");
54 gSystem->Load("libESD.so");
55 gSystem->Load("libAOD.so");
56 gSystem->Load("libANALYSIS.so");
57 gSystem->Load("libANALYSISalice.so");
58 gSystem->Load("libANALYSISalice.so");
59 gSystem->Load("libPWG3muon.so");
64 if(mode==kMgridLocal || mode==kMgrid)
65 TGrid::Connect("alien://");
70 TChain* chain = CreateChain(mode);
72 TString outFileName("MUON.TriggerEfficiencyMap.root");
75 // Make the analysis manager
76 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "A test setup for the analysis train");
78 AliESDInputHandler *esdHandler = new AliESDInputHandler();
79 //esdHandler->SetInactiveBranches("FMD CaloCluster");
80 // Monte Carlo handler
81 //AliMCEventHandler* mcHandler = new AliMCEventHandler();
83 mgr->SetInputEventHandler(esdHandler);
84 //mgr->SetMCtruthEventHandler(mcHandler);
86 // Trigger chamber efficiency analysis
87 AliAnalysisTaskTrigChEff* taskTrigChEff = new AliAnalysisTaskTrigChEff("TaskTrigChEff");
88 mgr->AddTask(taskTrigChEff);
90 // Create containers for input/output
91 // Top container for ESD input
92 AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
94 // Output histograms list for single muons analysis
95 AliAnalysisDataContainer *cout_trigChEff = mgr->CreateContainer("triggerChamberEff", TList::Class(),
96 AliAnalysisManager::kOutputContainer, outFileName.Data());
98 mgr->ConnectInput (taskTrigChEff, 0, cin_esd);
99 mgr->ConnectOutput (taskTrigChEff, 0, cout_trigChEff);
104 if (mgr->InitAnalysis()) {
106 mgr->StartAnalysis(modeName[mode].Data(), chain);
112 //______________________________________________________________________________
113 TChain* CreateChain(Int_t mode)
115 printf("*******************************\n");
116 printf("*** Getting the Chain ***\n");
117 printf("*******************************\n");
119 if(mode==kMgridLocal || mode==kMgrid){
120 AliTagAnalysis *analysis = new AliTagAnalysis();
121 chain = analysis->GetChainFromCollection(kDefaultXmlFile.Data(),"esdTree");
124 chain = new TChain("esdTree");
125 TString inFileName("AliESDs.root");
126 inFileName.Prepend(Form("%s/",kDefaultLocalInputDir.Data()));
127 chain->Add(inFileName.Data());
129 if (chain) chain->ls();
133 //______________________________________________________________________________
134 void SetupPar(char* pararchivename)
136 if (pararchivename) {
137 char processline[1024];
138 sprintf(processline,".! tar xvzf %s.par",pararchivename);
139 gROOT->ProcessLine(processline);
140 const char* ocwd = gSystem->WorkingDirectory();
141 gSystem->ChangeDirectory(pararchivename);
142 printf("Current directory = %s\n",gSystem->pwd());
144 // check for BUILD.sh and execute
145 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
146 printf("*******************************\n");
147 printf("*** Building PAR archive ***\n");
148 printf("*******************************\n");
150 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
151 Error("runProcess","Cannot Build the PAR Archive! - Abort!");
155 // check for SETUP.C and execute
156 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
157 printf("*******************************\n");
158 printf("*** Setup PAR archive ***\n");
159 printf("*******************************\n");
160 gROOT->Macro("PROOF-INF/SETUP.C");
163 gSystem->ChangeDirectory("../");