//_____________________________________________________________________________ void RunPerformanceTrain(Char_t *file="esd.root", Int_t runNumber = 2, const char* triggerClass ="CINT1B-ABCE-NOPF-ALL", Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t bGrid=kFALSE) { // // Grid settings // use GSI::SE if(bGrid) { gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE"); TGrid * alien = TGrid::Connect("alien://",0,0,"t"); gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE"); } // // Train Configuration // Int_t iPWGPPperfTPC = 1; // Test TPC performance Int_t iPWGPPperfTRD = 0; // Test TRD performance Int_t iPWGPPperfITS = 0; // Test ITS performance Int_t iPWGPPperfCalo = 0; // Test Calo performance Int_t iPWGPPperfMuonTrig = 0; // Test Muon Trigger performance Int_t iPWGPPperfMuonEff = 0; // Test Muon Efficiency performance Int_t iPWGPPperfTOF = 0; // Test TOF-TPC matching performance Int_t iPWGPPperfPrimVertex = 0; // Test Primary Vertex performance Int_t iPWGPPv0QA = 0; // V0 algorithm QA task // // Load Libraries // gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); gSystem->Load("libTender"); gSystem->Load("libCORRFW"); gSystem->Load("libTPCcalib"); gSystem->Load("libPWGPP"); gSystem->Load("libPHOSUtils"); gSystem->Load("libEMCALUtils"); gSystem->Load("libPWG4PartCorrBase"); gSystem->Load("libPWG4PartCorrDep"); gSystem->Load("libPWGmuon"); // The class is here // // OCDB Configuration // AliCDBManager *cdbManager = AliCDBManager::Instance(); cdbManager->SetDefaultStorage("local:///lustre/alice/alien/alice/data/2009/OCDB"); //cdbManager->SetDefaultStorage("local://$ALICE_PHYSICS/OCDB"); //cdbManager->SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd())); cdbManager->SetRun(runNumber); //cdbManager->SetCacheFlag(kFALSE); // initialize magnetic field from the GRP manager. //if(magField==0) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 0., 0., AliMagF::k2kG)); //if(magField==1) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k2kG)); //if(magField==2) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG)); /* AliGRPManager grpMan; grpMan.ReadGRPEntry(); grpMan.SetMagField(); AliRunInfo *runInfo = grpMan.GetRunInfo(); // // Load geometry // */ AliGeomManager::LoadGeometry(); // // Swtich off all AliInfo (too much output!) // AliLog::SetGlobalLogLevel(AliLog::kError); // // Create input ESD chain // /* gROOT->LoadMacro("$ALICE_PHYSICS/PWG0/CreateESDChain.C"); TChain* chain = CreateESDChain(list,nFiles,fistFile); if(!chain) { Error("RunPerformanceTrain","ESD chain not created!"); return; } */ TChain *chain = new TChain("esdTree"); if(!chain) { Error("RunPerformanceTrain","ESD chain not created!"); return; } chain->Add(file); chain->Lookup(); // // Create analysis manager // AliAnalysisManager *mgr = new AliAnalysisManager; if(!mgr) { Error("RunPerformanceTrain","AliAnalysisManager not set!"); return; } // // Set ESD input handler // AliESDInputHandler* esdH = new AliESDInputHandler; if(!esdH) { Error("RunPerformanceTrain","AliESDInputHandler not created!"); return; } if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend"); mgr->SetInputEventHandler(esdH); /* // // Set RecPoints and ESD input handler // AliESDInputHandlerRP* rpH = new AliESDInputHandlerRP; if(!rpH) { Error("RunPerformanceTrain","AliESDInputHandlerRP not created!"); return; } if(bUseESDfriend) rpH->SetActiveBranches("ESDfriend"); mgr->SetInputEventHandler(rpH); */ // // Set MC input handler // if(bUseMCInfo) { AliMCEventHandler* mcH = new AliMCEventHandler; if(!mcH) { Error("RunPerformanceTrain","AliMCEventHandler not created!"); return; } mcH->SetReadTR(kTRUE); mgr->SetMCtruthEventHandler(mcH); } // // Add task to AliAnalysisManager // // // TPC performance // if(iPWGPPperfTPC) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceTPC.C"); AliPerformanceTask *tpcQA = AddTaskPerformanceTPC(bUseMCInfo,bUseESDfriend,triggerClass); if(!tpcQA) { Error("RunPerformanceTrain","AliPerformanceTask not created!"); return; } } else { Printf("RunPerformanceTrain: TPC Performance - EXCLUDED!"); } // // TRD perormance // if(iPWGPPperfTRD) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTrainPerformanceTRD.C"); if(!AddTrainPerformanceTRD(bUseMCInfo,bUseESDfriend)) { Error("RunPerformanceTrain","TrainPerformanceTRD not created!"); return; } } else { Printf("RunPerformanceTrain: TRD TrainPerformanceTRD - EXCLUDED!"); } // // ITS performance // if(iPWGPPperfITS) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceITS.C"); AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(bUseMCInfo); if(!itsQA) { Error("RunPerformanceTrain","AliAnalysisTaskITSTrackingCheck not created!"); return; } } else { Printf("RunPerformanceTrain: AliAnalysisTaskITSTrackingCheck - EXCLUDED!"); } // // Calorimeter Performance // if(iPWGPPperfCalo) { gROOT->LoadMacro("$ALICE_PHYSICS/PWG4/macros/AddTaskCalorimeterQA.C"); AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD",bUseMCInfo,kFALSE); if(!taskCaloQA) { Error("RunPerformanceTrain","AliAnalysisTaskParticleCorrelation not created!"); return; } mgr->AddTask(taskCaloQA); } else { Printf("RunPerformanceTrain: AliAnalysisTaskParticleCorrelation - EXCLUDED!"); } // // Muon Trigger // if(iPWGPPperfMuonTrig) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskMTRchamberEfficiency.C"); AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency(); if(!taskMuonTrig) { Error("RunPerformanceTrain","AliAnalysisTaskTrigChEff not created!"); return; } mgr->AddTask(taskMuonTrig); } else { Printf("RunPerformanceTrain: AliAnalysisTaskTrigChEff - EXCLUDED!"); } // // Muon Efficiency // if(iPWGPPperfMuonEff) { gROOT->LoadMacro("$ALICE_PHYSICS/PWG3/muondep/AddTaskMUONTrackingEfficiency.C"); AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AliAnalysisTaskMuonTrackingEff(); if(!taskMuonTrackEff) { Error("RunPerformanceTrain","AliAnalysisTaskMuonTrackingEff not created!"); return; } mgr->AddTask(taskMuonTrackEff); } else { Printf("RunPerformanceTrain: Muon Efficiency - EXCLUDED!"); } // // TOF performance // if(iPWGPPperfTOF) { // } else { Printf("RunPerformanceTrain: TOF - EXCLUDED!"); } // // PWGPP Primary Vertex // if(iPWGPPperfPrimVertex) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskVertexESD.C"); AliAnalysisTaskVertexESD *taskPrimVertex = AddTaskVertexESD(); if(!taskPrimVertex) { Error("RunPerformanceTrain","AliAnalysisTaskVertexESD not created!"); return; } } else { Printf("RunPerformanceTrain: AliAnalysisTaskVertexESD - EXCLUDED!"); } // // PWGPP V0 QA // if (iPWGPPv0QA) { gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskV0QA.C"); AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(bUseMCInfo); if(!taskv0QA) { Error("RunPerformanceTrain","AliAnalysisTaskV0QA not created!"); return; } } else { Printf("RunPerformanceTrain: AliAnalysisTaskV0QA - EXCLUDED!"); } // // Disable debug printouts // mgr->SetDebugLevel(0); if (!mgr->InitAnalysis()) return; mgr->PrintStatus(); //mgr->StartAnalysis("local",chain, nEvents, firstEvent); mgr->StartAnalysis("local",chain); }
//_____________________________________________________________________________ void RunPerformanceTaskResEffMC(TChain *chain, Bool_t bUseMCInfo=kTRUE, Bool_t bUseESDfriend=kTRUE, Bool_t bProof=kTRUE) { if(!chain) { AliDebug(AliLog::kError, "ERROR: No input chain available"); return; } // // Swtich off all AliInfo (too much output!) // AliLog::SetGlobalLogLevel(AliLog::kError); // // Create analysis manager // AliAnalysisManager *mgr = new AliAnalysisManager; if(!mgr) { Error("runTPCQA","AliAnalysisManager not set!"); return; } // // Set ESD input handler // AliESDInputHandler* esdH = new AliESDInputHandler; if(!esdH) { Error("runTPCQA","AliESDInputHandler not created!"); return; } if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend"); mgr->SetInputEventHandler(esdH); // // Set MC input handler // if(bUseMCInfo) { AliMCEventHandler* mcH = new AliMCEventHandler; if(!esdH) { Error("runTPCQA","AliMCEventHandler not created!"); return; } mcH->SetReadTR(kTRUE); mgr->SetMCtruthEventHandler(mcH); } // // Create task // AliPerformanceTask *task = new AliPerformanceTask("Performance","TPC Performance"); if (!task) { Error("AddTaskPerformanceTPC", "TPC performance task cannot be created!"); return NULL; } task->SetUseMCInfo(bUseMCInfo); task->SetUseESDfriend(bUseESDfriend); // // Add task to analysis manager // mgr->AddTask(task); // // Create TPC-ESD track reconstruction cuts // MB tracks // AliRecInfoCuts *pRecInfoCutsTPC = new AliRecInfoCuts("pRecInfoCutsTPC"); if(pRecInfoCutsTPC) { pRecInfoCutsTPC->SetMaxDCAToVertexXY(3.0); pRecInfoCutsTPC->SetMaxDCAToVertexZ(30.0); //pRecInfoCutsTPC->SetMaxDCAToVertexZ(3.0); pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE); pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE); pRecInfoCutsTPC->SetAcceptKinkDaughters(kTRUE); pRecInfoCutsTPC->SetMinNClustersTPC(50); pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(1000000.); pRecInfoCutsTPC->SetDCAToVertex2D(kFALSE); pRecInfoCutsTPC->SetHistogramsOn(kFALSE); } else { Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!"); return NULL; } // // Create TPC-ESD track reconstruction cuts // MATCH tracks // AliRecInfoCuts *pRecInfoCutsMATCH = new AliRecInfoCuts("pRecInfoCutsMATCH"); if(pRecInfoCutsMATCH) { pRecInfoCutsMATCH->SetMaxDCAToVertexXY(3.0); pRecInfoCutsMATCH->SetMaxDCAToVertexZ(3.0); pRecInfoCutsMATCH->SetRequireSigmaToVertex(kFALSE); pRecInfoCutsMATCH->SetRequireTPCRefit(kFALSE); pRecInfoCutsMATCH->SetAcceptKinkDaughters(kTRUE); pRecInfoCutsMATCH->SetMinNClustersTPC(50); pRecInfoCutsMATCH->SetMaxChi2PerClusterTPC(1000000.); pRecInfoCutsMATCH->SetDCAToVertex2D(kFALSE); pRecInfoCutsMATCH->SetTPCITSMatchingRadius(70); pRecInfoCutsMATCH->SetTPCTRDMatchingRadius(260); pRecInfoCutsMATCH->SetMinNClustersITS(3); pRecInfoCutsMATCH->SetHistogramsOn(kFALSE); } else { Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!"); return NULL; } // // Create TPC-ESD track reconstruction cuts // standard cuts AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts("pRecInfoCuts"); if(pRecInfoCuts) { pRecInfoCuts->SetMaxDCAToVertexXY(3.0); pRecInfoCuts->SetMaxDCAToVertexZ(3.0); pRecInfoCuts->SetMinNClustersTPC(50); pRecInfoCuts->SetMinNClustersITS(2); pRecInfoCuts->SetHistogramsOn(kFALSE); pRecInfoCuts->SetTPCITSMatchingRadius(70); pRecInfoCuts->SetTPCTRDMatchingRadius(260); } else { Error("AddTaskPerformanceTPC", "AliRecInfoCuts cannot be created!"); return NULL; } // // Create TPC-MC track reconstruction cuts // AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts("pMCInfoCuts"); if(pMCInfoCuts) { pMCInfoCuts->SetMinTrackLength(70); } else { Error("AddTaskPerformanceTPC", "AliMCInfoCuts cannot be created!"); return NULL; } // // Create performance objects for TPC and set cuts // enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec }; // // Resolution // AliPerformanceRes *pCompRes0 = new AliPerformanceRes("AliPerformanceRes","AliPerformanceRes",kTPC,kFALSE); if(!pCompRes0) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceRes"); } pCompRes0->SetAliRecInfoCuts(pRecInfoCuts); pCompRes0->SetAliMCInfoCuts(pMCInfoCuts); AliPerformanceRes *pCompRes3 = new AliPerformanceRes("AliPerformanceResTPCInner","AliPerformanceResTPCInner",kTPCInner,kFALSE); if(!pCompRes3) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCInner"); } pCompRes3->SetAliRecInfoCuts(pRecInfoCuts); pCompRes3->SetAliMCInfoCuts(pMCInfoCuts); AliPerformanceRes *pCompRes4 = new AliPerformanceRes("AliPerformanceResTPCOuter","AliPerformanceResTPCOuter",kTPCOuter,kFALSE); if(!pCompRes4) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCOuter"); } pCompRes4->SetAliRecInfoCuts(pRecInfoCuts); pCompRes4->SetAliMCInfoCuts(pMCInfoCuts); // // Efficiency // AliPerformanceEff *pCompEff0 = new AliPerformanceEff("AliPerformanceEff","AliPerformanceEff",kTPC,kFALSE); if(!pCompEff0) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff"); } pCompEff0->SetAliRecInfoCuts(pRecInfoCuts); pCompEff0->SetAliMCInfoCuts(pMCInfoCuts); // // dEdx // AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE); if(!pCompDEdx3) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner"); } pCompDEdx3->SetAliRecInfoCuts(pRecInfoCuts); pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts); // // DCA // AliPerformanceDCA *pCompDCA0 = new AliPerformanceDCA("AliPerformanceDCA","AliPerformanceDCA",kTPC,kFALSE); if(!pCompDCA0) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDCA"); } pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts); pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts); // // TPC performance // AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE); if(!pCompTPC0) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC"); } pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts); // // TPC+ITS matching performance // AliPerformanceMatch *pCompMatch0 = new AliPerformanceMatch("AliPerformanceMatchTPCITS","AliPerformanceMatchTPCITS",0,kFALSE); if(!pCompMatch0) { Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCITS"); } pCompMatch0->SetAliRecInfoCuts(pRecInfoCutsMATCH); pCompMatch0->SetAliMCInfoCuts(pMCInfoCuts); // // TPC+TRD matching performance // AliPerformanceMatch *pCompMatch1 = new AliPerformanceMatch("AliPerformanceMatchTPCTRD","AliPerformanceMatchTPCTRD",1,kFALSE); if(!pCompMatch1) { Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCTRD"); } pCompMatch1->SetAliRecInfoCuts(pRecInfoCutsMATCH); pCompMatch1->SetAliMCInfoCuts(pMCInfoCuts); AliPerformanceMatch *pCompMatch2 = new AliPerformanceMatch("AliPerformanceMatchTPCEFF","AliPerformanceMatchTPCEFF",2,kFALSE); if(!pCompMatch2) { Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCEFF"); } pCompMatch2->SetAliRecInfoCuts(pRecInfoCutsMATCH); pCompMatch2->SetAliMCInfoCuts(pMCInfoCuts); // // Add components to the performance task // //task->AddPerformanceObject( pCompDEdx3 ); //task->AddPerformanceObject( pCompDCA0 ); //task->AddPerformanceObject( pCompTPC0 ); //task->AddPerformanceObject( pCompMatch0 ); //task->AddPerformanceObject( pCompMatch1 ); //task->AddPerformanceObject( pCompMatch2 ); // if(bUseMCInfo) { task->AddPerformanceObject( pCompRes0 ); //task->AddPerformanceObject( pCompRes3 ); //task->AddPerformanceObject( pCompRes4 ); task->AddPerformanceObject( pCompEff0 ); } // if(!bUseMCInfo) { pCompDEdx3->SetTriggerClass(triggerClass); pCompDCA0->SetTriggerClass(triggerClass); pCompTPC0->SetTriggerClass(triggerClass); pCompMatch0->SetTriggerClass(triggerClass); pCompMatch1->SetTriggerClass(triggerClass); pCompMatch2->SetTriggerClass(triggerClass); } // // Create containers for input // mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); // // Create containers for output // AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPCMC", TList::Class(), AliAnalysisManager::kOutputContainer, Form("TPC.MC.%s.root", task->GetName())); mgr->ConnectOutput(task, 1, coutput_tpc); // Enable debug printouts mgr->SetDebugLevel(0); if (!mgr->InitAnalysis()) return; mgr->PrintStatus(); if(bProof) mgr->StartAnalysis("proof",chain); else mgr->StartAnalysis("local",chain); }