1 // Macro to run TPC MC performance
3 // The basic tracking functionality is tested
4 // by using MC track references (exact points).
6 // Track references are propagate in B-field and
9 // AliTracker::PropagateTrackToBxByBz()
10 // AliExternalTrackParam::PropagateToBxByBz()
13 // Available test components:
15 // AliPerformanceRes (propagation TPCin(ref) -> DCA(particle) by using AliTracker::PropagateTrackToBxByBz() and comparison at DCA)
16 // AliPerformanceResTCPInner (propagation TPCout(ref) -> TPCin(ref) and comparison at TPCin)
17 // AliPerformanceResTPCOuter (propagation TPCin(ref) -> TPCout(ref) by using AliExternalTrackParam::PropagateToBxByBz() and comparison at TPCout)
23 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/LoadMyLibs.C");
25 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
26 TChain* chain = CreateESDChain("list_flatP_JB.txt", 500, 0);
29 // Geometry (need for the track propagation through material)
30 //AliGeomManager::LoadGeometry("/lustre/alice/jacek/sim/HEADJB/flatPt_uniB/0/geometry.root");
33 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
35 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/RunPerformanceTaskMC.C");
36 RunPerformanceTaskMC(chain, kTRUE, kFALSE, kFALSE, 0);
38 //2. Run on PROOF Lite e.g.
42 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/ProofEnableAliRoot.C");
43 ProofEnableAliRoot("/d/alice11/jacek/alice/x86_64/AliRoot/trunkJB");
45 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
46 TChain* chain = CreateESDChain("list_flatP_JB.txt", 400, 0);
50 // the best is to create macro MagField.C with the line:
51 // TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
52 gProof->Exec("gROOT->Macro(\"MagField.C\")");
54 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/RunPerformanceTaskMC.C");
55 RunPerformanceTaskMC(chain, kTRUE, kTRUE, kTRUE,0);
57 //3. Run only on static PROOF at GSI e.g.
59 TProof::Reset("jacek@lxgrid5.gsi.de");
60 TProofMgr * proofmgr = TProof::Mgr("jacek@lxgrid5.gsi.de");
61 //proofmgr->SetROOTVersion("523-04");
62 TProof * proof = proofmgr->CreateSession();
63 proof->SetParameter("PROOF_MaxSlavesPerNode", (Long_t)10000);
65 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/ProofEnableAliRoot.C");
66 ProofEnableAliRoot("/u/jacek/alice/AliRoot/HEADJB/");
68 gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
69 TChain* chain = CreateESDChain("flat_JB.txt", 50, 0);
72 // Geometry (need for the track propagation through material)
73 //AliGeomManager::LoadGeometry("/lustre/alice/local/TRDdata/SIM/P-Flat/TRUNK/test/RUN0/geometry.root");
76 gProof->Exec("gROOT->ProcessLine(\"TGeoGlobalMagField::Instance()->SetField(new AliMagF(\"Maps\",\"Maps\", 1., 1., AliMagF::k5kG))\")");
78 gROOT->LoadMacro("$ALICE_ROOT/PWG1/macros/RunPerformanceTaskMC.C");
79 RunPerformanceTaskMC(chain, kTRUE, kTRUE, kTRUE);
81 //4. Make final spectra and store them in the
82 // output folder and generate control pictures e.g.
84 TFile f("TPC.Performance.root");
85 AliPerformanceRes * compObjRes = (AliPerformanceRes*)coutput->FindObject("AliPerformanceResTPCInner");
86 compObjRes->Analyse();
87 compObjRes->GetAnalysisFolder()->ls("*");
88 compObjRes->PrintHisto(kTRUE,"PerformanceResTPCInnerQA.ps");
89 TFile fout("AnalysedResTPCInner.root","recreate");
90 compObjRes->GetAnalysisFolder()->Write();
97 //_____________________________________________________________________________
98 void RunPerformanceTaskMC(TChain *chain, Bool_t bUseMCInfo=kTRUE, Bool_t bUseESDfriend=kTRUE, Bool_t bProof=kTRUE, Int_t debugStreamLevel=0)
102 AliDebug(AliLog::kError, "ERROR: No input chain available");
107 // Create global cuts objects
110 // Create ESD track reconstruction cuts
111 AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts();
113 pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
114 pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
115 pRecInfoCuts->SetMinNClustersTPC(50);
116 pRecInfoCuts->SetMinNClustersITS(2);
117 pRecInfoCuts->SetPtRange(0.15,1.e10);
118 pRecInfoCuts->SetHistogramsOn(kFALSE);
120 AliDebug(AliLog::kError, "ERROR: Cannot create AliRecInfoCuts object");
123 // Create MC track reconstruction cuts
124 AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts();
126 pMCInfoCuts->SetMinTrackLength(70);
128 AliDebug(AliLog::kError, "ERROR: Cannot AliMCInfoCuts object");
132 // Create performance objects and set cuts
134 const Int_t kTPC = 0; const Int_t kTPCITS = 1; const Int_t kConstrained = 2; const Int_t kTPCInner = 3; const Int_t kTPCOuter = 4;
139 AliPerformanceMC *pCompMC0 = new AliPerformanceMC("AliPerformanceMC","AliPerformanceMC",kTPC,kFALSE);
141 AliDebug(AliLog::kError, "ERROR: Cannot create AliPerformanceMC object");
143 pCompMC0->SetAliRecInfoCuts(pRecInfoCuts);
144 pCompMC0->SetAliMCInfoCuts(pMCInfoCuts);
145 //pCompMC0->SetStreamLevel(debugStreamLevel);
147 AliPerformanceMC *pCompMC3 = new AliPerformanceMC("AliPerformanceMCTPCInner","AliPerformanceMCTPCInner",kTPCInner,kFALSE);
149 AliDebug(AliLog::kError, "ERROR: Cannot create AliPerformanceMCInnerTPC object");
151 pCompMC3->SetAliRecInfoCuts(pRecInfoCuts);
152 pCompMC3->SetAliMCInfoCuts(pMCInfoCuts);
153 //pCompMC3->SetStreamLevel(debugStreamLevel);
155 AliPerformanceMC *pCompMC4 = new AliPerformanceMC("AliPerformanceMCTPCOuter","AliPerformanceMCTPCOuter",kTPCOuter,kFALSE);
157 AliDebug(AliLog::kError, "ERROR: Cannot create AliPerformanceMCTPCOuter object");
159 pCompMC4->SetAliRecInfoCuts(pRecInfoCuts);
160 pCompMC4->SetAliMCInfoCuts(pMCInfoCuts);
161 //pCompMC4->SetStreamLevel(debugStreamLevel);
164 // Swtich off all AliInfo (too much output!!!)
165 AliLog::SetGlobalLogLevel(AliLog::kError);
167 // Create the analysis manager
168 AliAnalysisManager *mgr = new AliAnalysisManager;
171 AliPerformanceTask *task = new AliPerformanceTask("PerformanceMC","TPC Performance");
172 task->SetUseMCInfo(bUseMCInfo);
173 task->SetUseESDfriend(bUseESDfriend);
174 task->AddPerformanceObject( pCompMC0 );
175 task->AddPerformanceObject( pCompMC3 );
176 task->AddPerformanceObject( pCompMC4 );
182 AliESDInputHandler* esdH = new AliESDInputHandler;
183 if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
184 mgr->SetInputEventHandler(esdH);
187 // Enable MC event handler
188 AliMCEventHandler* handler = new AliMCEventHandler;
189 handler->SetReadTR(kTRUE);
190 mgr->SetMCtruthEventHandler(handler);
193 // Create containers for input
194 //AliAnalysisDataContainer *cinput = mgr->CreateContainer("cchain", TChain::Class(), AliAnalysisManager::kInputContainer);
195 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
196 mgr->ConnectInput(task, 0, cinput);
198 // Create containers for output
199 AliAnalysisDataContainer *coutput = mgr->CreateContainer("coutput", TList::Class(), AliAnalysisManager::kOutputContainer, Form("TPC.%s.root", task->GetName()));
200 mgr->ConnectOutput(task, 0, coutput);
202 // Enable debug printouts
203 mgr->SetDebugLevel(0);
205 if (!mgr->InitAnalysis())
210 if(bProof) mgr->StartAnalysis("proof",chain);
211 else mgr->StartAnalysis("local",chain);