void runTOFCalibTaskOnProof() { TStopwatch timer; timer.Start(); printf("*** Open PROOF ***"); gEnv->SetValue("XSec.GSI.DelegProxy","2"); TProof::Open("alicecaf"); gProof->UploadPackage("STEERBase.par"); gProof->EnablePackage("STEERBase"); gProof->UploadPackage("ESD.par"); gProof->EnablePackage("ESD"); gProof->UploadPackage("AOD.par"); gProof->EnablePackage("AOD"); gProof->UploadPackage("ANALYSIS.par"); gProof->EnablePackage("ANALYSIS"); gProof->UploadPackage("ANALYSISalice.par"); gProof->EnablePackage("ANALYSISalice"); gProof->Load("AliTOFArray.cxx++g"); gProof->Load("AliTOFCalibTask.cxx++g"); gROOT->LoadMacro("AddTaskTOFCalib.C"); cout << "Loaded AddTaskTOFCalib macro "<< endl; gProof->ShowEnabledPackages(); //ANALYSIS PART //____________________________________________// // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); AliESDInputHandler* esdH = new AliESDInputHandler; esdH->SetInactiveBranches("FMD CaloCluster"); mgr->SetInputEventHandler(esdH); Bool_t domc = kFALSE; if (domc) { AliMCEventHandler *mcH = new AliMCEventHandler; mgr->SetMCtruthEventHandler(mcH); } //____________________________________________// // 1st TOFCalib task AliTOFCalibTask *taskTOFCalib = AddTaskTOFCalib(); if (!mgr->InitAnalysis()) return; mgr->PrintStatus(); mgr->StartAnalysis("proof","/COMMON/COMMON/LHC08c11_10TeV_0.5T",1000); timer.Stop(); timer.Print(); }
Bool_t AddAMEventMixingTest(TString analysisSource = "proof", TString analysisMode = "test",TString input="aod",TString inputMC="", TString postfix = "",TString idStr="0") { Bool_t useEventMixingPar = 1; Int_t usePhysSel = 1; Bool_t useMC = !inputMC.CompareTo("mc"); input.ToLower(); // ALICE stuff AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { Printf("Error[AddAMEventMixingTest] mgr is null !!!"); return kFALSE; } AliAnalysisGrid *analysisPlugin = mgr->GetGridHandler(); if (!analysisPlugin) { Printf("Error[AddAMEventMixingTest] : analysisPlugin is null !!!"); return kFALSE; } TString myAdditionalLibs; if (useEventMixingPar) { AliAnalysisAlien::SetupPar("EventMixing"); myAdditionalLibs += " EventMixing.par"; } else { gSystem->Load("libEventMixing.so"); myAdditionalLibs += " libEventMixing.so"; } gROOT->LoadMacro("AliAnalysisTaskEx02.cxx++g"); analysisPlugin->SetAnalysisSource("AliAnalysisTaskEx02.cxx+"); myAdditionalLibs+=" AliAnalysisTaskEx02.h AliAnalysisTaskEx02.cxx"; analysisPlugin->SetAdditionalLibs(myAdditionalLibs.Data()); AliMultiInputEventHandler *multiInputHandler = mgr->GetInputEventHandler(); if (usePhysSel && !input.CompareTo("esd")) { gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); AddTaskPhysicsSelection(useMC); // maybe we can put it in $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C AliMultiInputEventHandler *multiIH = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler()); if (multiIH){ AliESDInputHandler *esdIH = dynamic_cast<AliESDInputHandler *>(multiIH->GetFirstInputEventHandler()); if (esdIH) esdIH->SetEventSelection(multiIH->GetEventSelection()); AliAODInputHandler *aodIH = dynamic_cast<AliAODInputHandler *>(multiIH->GetFirstInputEventHandler()); if (aodIH) aodIH->SetEventSelection(multiIH->GetEventSelection()); } } // add mixing handler (uncomment to turn on Mixnig) gROOT->LoadMacro("AddMixingHandler.C"); AddMixingHandler(multiInputHandler, input, useMC,postfix); // load and run AddTask macro gROOT->LoadMacro("AddEventMixingTestTask.C"); AddEventMixingTestTask(input, useMC, postfix); return kTRUE; }
//________________________________________________________________ Bool_t InputHandlerSetup(TString esdFName) { AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); AliAnalysisDataContainer *cin = mgr->GetCommonInputContainer(); if (cin) return; AliESDInputHandler *esdInputHandler = dynamic_cast<AliESDInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); if (!esdInputHandler) { Info("CustomAnalysisTaskInputSetup", "Creating esdInputHandler ..."); esdInputHandler = new AliESDInputHandler(); mgr->SetInputEventHandler(esdInputHandler); } esdInputHandler->SetFriendFileName(esdFName.Data()); // esdInputHandler->SetActiveBranches("ESDfriend*"); esdInputHandler->SetReadFriends(kTRUE); return kTRUE; }
//_____________________________________________________________________________ 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 run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kFALSE, Int_t runMode = 0, Bool_t isMC = 0, Int_t centrBin = 0, const char * centrEstimator = "VOM", Int_t useOtherCentralityCut = 0, Int_t trackMin=0, Int_t trackMax=10000, const char* option = "",TString customSuffix = "", Int_t workers = -1, Bool_t useSingleBin=kTRUE, const char * runList = 0) { // runMode: // // 0 local // 1 proof if (nev < 0) nev = 1234567890; InitAndLoadLibs(runMode,workers,debug); // Create the analysis manager mgr = new AliAnalysisManager; // Add ESD handler AliESDInputHandler* esdH = new AliESDInputHandler; // Do I need any of this? esdH->SetInactiveBranches("AliESDACORDE FMD ALIESDTZERO ALIESDZDC AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks AliESDTZERO ALIESDACORDE MuonTracks TrdTracks"); mgr->SetInputEventHandler(esdH); if(isMC) { AliMCEventHandler* handler = new AliMCEventHandler; handler->SetPreReadMode(AliMCEventHandler::kLmPreRead); mgr->SetMCtruthEventHandler(handler); } // Parse option strings TString optionStr(option); // remove SAVE option if set // This is copied from a macro by Jan. The reason I kept it is that I may want to pass textual options to the new task at some point Bool_t doSave = kFALSE; TString optionStr(option); if (optionStr.Contains("SAVE")) { optionStr = optionStr(0,optionStr.Index("SAVE")) + optionStr(optionStr.Index("SAVE")+4, optionStr.Length()); doSave = kTRUE; } AliESDtrackCuts * cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE); TString pathsuffix = ""; if(!useSingleBin) pathsuffix += "_AllCentr"; if (optionStr.Contains("DCA")) { delete cuts; // cuts = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(); cout << ">>>> USING DCA cut" << endl; cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); cuts->SetMaxChi2TPCConstrainedGlobal(); // remove golden cut pathsuffix+="_DCAcut"; } if (optionStr.Contains("ITSsa")) { delete cuts; cuts = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(); cout << ">>>> USING ITS sa tracks" << endl; pathsuffix+="_ITSsa"; } if (optionStr.Contains("TPC")) { delete cuts; cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); cout << ">>>> USING TPC only tracks" << endl; pathsuffix+="_TPC"; } if(optionStr.Contains("NoElectrons")) pathsuffix +="_NoElectrons"; Bool_t useMCKinematics = isMC; if (optionStr.Contains("NOMCKIN")) { cout << ">>>> Ignoring MC kinematics" << endl; useMCKinematics=kFALSE; pathsuffix+="_NOMCKIN"; } // If we are running on grid, we need the alien handler if (runMode == kMyRunModeGRID) { // Create and configure the alien handler plugin gROOT->LoadMacro("CreateAlienHandler.C"); AliAnalysisGrid *alienHandler = CreateAlienHandler(data, runList, pathsuffix.Data(), listToLoad, "full", isMC); // full if (!alienHandler) { cout << "Cannot create alien handler" << endl; exit(1); } mgr->SetGridHandler(alienHandler); } // Add tasks // physics selection gROOT->ProcessLine(".L $ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C"); physicsSelectionTask = AddTaskPhysicsSelection(isMC); //PID gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); AddTaskPIDResponse(isMC); // // PID QA: // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C"); // AddTaskPIDqa(); // Centrality gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C"); AliCentralitySelectionTask *taskCentr = AddTaskCentrality(); // OBSOLETE const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityBy1D.root"; const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityByFunction.root"; // END of OBSOLETE if(isMC) taskCentr-> SetMCInput(); taskCentr->SetPass(2); // Create my own centrality selector AliAnalysisMultPbCentralitySelector * centrSelector = new AliAnalysisMultPbCentralitySelector(); centrSelector->SetIsMC(isMC); centrSelector->SetCentrTaskFiles(file1,file2); // for bookkeping only centrSelector->SetCentralityBin(centrBin); if (!useSingleBin) centrSelector->SetCentralityBin(0); // FIXME: ok? centrSelector->SetCentralityEstimator(centrEstimator); if(useOtherCentralityCut == 1){ cout << "Setting centrality by MULT" << endl; centrSelector->SetUseMultRange(); centrSelector->SetMultRange(trackMin,trackMax); } if(useOtherCentralityCut == 2){ cout << "Setting centrality by V0" << endl; centrSelector->SetUseV0Range(); centrSelector->SetMultRange(trackMin,trackMax); } if(useOtherCentralityCut == 3){ cout << "Setting centrality by SPD outer" << endl; centrSelector->SetUseSPDOuterRange(); centrSelector->SetMultRange(trackMin,trackMax); } // load my task if (useSingleBin) { gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracks.C"); AliAnalysisTaskMultPbTracks * task = AddTaskMultPbPbTracks("multPbPbtracks.root", cuts, centrSelector); task->SetIsMC(useMCKinematics); task->SetOfflineTrigger(AliVEvent::kMB); if(optionStr.Contains("TPC")) task->SetTPCOnly(); if(optionStr.Contains("NoElectrons")) task->RejectElectrons(kTRUE); if(useMCKinematics) task->GetHistoManager()->SetSuffix("MC"); if(customSuffix!=""){ cout << "Setting custom suffix: " << customSuffix << endl; task->GetHistoManager()->SetSuffix(customSuffix); } } else { gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracksAllCentrality.C"); centrSelector->SetUseV0Range(kTRUE); Int_t ncentr = 11; const Float_t minCentr[] = {0 ,79 ,239,559 ,1165,2135,3555,5525,8213 ,12191,15079}; const Float_t maxCentr[] = {79,239,559,1165,2135,3555,5525,8213,12191,15079,21000}; AliAnalysisTaskMultPbTracks ** tasks = AddTaskMultPbPbTracksAllCentrality("multPbPbtracks.root", cuts, centrSelector, ncentr,minCentr,maxCentr); for(Int_t icentr = 0; icentr < ncentr; icentr++){ tasks[icentr]->Print(); cout << "MC KINEMATICS:" << useMCKinematics << endl; tasks[icentr]->SetIsMC(useMCKinematics); tasks[icentr]->SetOfflineTrigger(AliVEvent::kMB); if(optionStr.Contains("TPC")) tasks[icentr]->SetTPCOnly(); if(optionStr.Contains("NoElectrons")) task[icentr]->RejectElectrons(kTRUE); if(useMCKinematics) tasks[icentr]->GetHistoManager()->SetSuffix("MC"); if(customSuffix!=""){ cout << "Setting custom suffix: " << customSuffix+long(icentr) << endl; tasks[icentr]->GetHistoManager()->SetSuffix(customSuffix+long(icentr)); } } } // Init and run the analy if (!mgr->InitAnalysis()) return; mgr->PrintStatus(); if (runMode == kMyRunModeLocal ) { // If running in local mode, create chain of ESD files cout << "RUNNING LOCAL, CHAIN" << endl; TChain * chain = GetAnalysisChain(data); chain->Print(); mgr->StartAnalysis("local",chain,nev); } else if (runMode == kMyRunModeProofLite) { TChain * chain = GetAnalysisChain(data); mgr->StartAnalysis("proof",chain,nev); } else if (runMode == kMyRunModeCAF) { mgr->StartAnalysis("proof",TString(data)+"#esdTree",nev); } else if (runMode == kMyRunModeGRID) { mgr->StartAnalysis("grid"); } else { cout << "ERROR: unknown run mode" << endl; } if (!useOtherCentralityCut) { pathsuffix = pathsuffix + "_" + centrEstimator + "_bin_"+long(centrBin); } else if(useOtherCentralityCut==1){ pathsuffix = pathsuffix + "_TrackRange_" + long(trackMin) + "_" + long(trackMax); } else if(useOtherCentralityCut==2){ pathsuffix = pathsuffix + "_V0Range_" + long(trackMin) + "_" + long(trackMax); } else if(useOtherCentralityCut==3){ pathsuffix = pathsuffix + "_SPDOutRange_" + long(trackMin) + "_" + long(trackMax); } pathsuffix += customSuffix; if (doSave) MoveOutput(data, pathsuffix.Data()); }
void Embedding(const char* dataset="collection.xml") { gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); //load analysis framework gSystem->Load("libSTEERBase"); gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS"); // A task can be compiled dynamically with AClic gROOT->LoadMacro("AliPHOSEmbedding.cxx+g"); // Connect to alien TString token = gSystem->Getenv("GRID_TOKEN") ; if (1) // token == "OK" ) TGrid::Connect("alien://"); else AliInfo("You are not connected to the GRID") ; cout << "Pi0Analysis: processing collection " << dataset << endl; // Create the chain TChain* chain = new TChain("esdTree"); TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset)); TAlienResult* result = collection->GetGridResult("",0 ,0); TList* rawFileList = result->GetFileInfoList(); for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) { TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(counter)) ; const char * rawFile = fi->GetCurrentUrl()->GetUrl() ; printf("Processing %s\n", rawFile) ; chain->Add(rawFile); printf("Chain: %d entries.\n",chain->GetEntries()); } TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(0)); const char * fn = fi->GetCurrentUrl()->GetUrl() ; char runNum[7]; for(Int_t i=0;i<6;i++)runNum[i]=fn[35+i] ; runNum[6]=0 ; Int_t iRunNum=atoi(runNum) ; printf("Run number=%d \n",iRunNum) ; //Run AOD simulation int nrun = atoi(runNum); int nevent = 0; int seed = 0; char sseed[1024]; char sevent[1024]; char sprocess[1024]; char sfield[1024]; char senergy[1024]; sprintf(sevent,""); sprintf(sprocess,""); sprintf(sfield,""); sprintf(senergy,""); seed = 0; sprintf(sseed,"%d",seed); if (seed==0) { fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); fprintf(stderr,"!!!! WARNING! Seeding variable for MC is 0 !!!!\n"); fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); } else { fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); fprintf(stdout,"!!! MC Seed is %d \n",seed); fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); } // set the seed environment variable gSystem->Setenv("CONFIG_SEED",sseed); gSystem->Setenv("CONFIG_RUN_TYPE","kPythia6"); // kPythia6 or kPhojet^M gSystem->Setenv("CONFIG_FIELD","k5kG"); // kNoField or k5kG^M gSystem->Setenv("CONFIG_ENERGY","2760"); // 900 or 10000 (GeV) gSystem->Setenv("DC_RUN",runNum); //run number char nSimEvents[55] ; sprintf(nSimEvents,"%d",chain->GetEntries()); gSystem->Setenv("SIM_EVENTS",nSimEvents); gSystem->Exec("mv geometry.root geometry_PHOS.root") ; gSystem->Exec("aliroot -b -q simrun.C > simrun.log 2>&1"); gSystem->Exec("mv geometry_PHOS.root geometry.root") ; // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("Pi0EmbeddingManager"); // ESD input handler AliESDInputHandler* esdH = new AliESDInputHandler(); esdH->SetReadFriends(kFALSE); mgr->SetInputEventHandler(esdH); // Output AliAODHandler* aodHandler = new AliAODHandler(); aodHandler->SetOutputFileName("AliAODout.root"); mgr->SetOutputEventHandler(aodHandler); // Debug level mgr->SetDebugLevel(0); // Add physics selection gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C"); AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE); gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C"); AliCentralitySelectionTask *taskCentrality = AddTaskCentrality() ; gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C"); AliEPSelectionTask *taskEP = AddTaskEventplane() ; // Add my task AliPHOSEmbedding *task1 = new AliPHOSEmbedding("Embedding"); TChain* chainAOD = new TChain("aodTree"); chainAOD->AddFile("AliAOD.root") ; task1->SetSignalChain(chainAOD) ; task1->SelectCollisionCandidates(); TFile *fOldCalib = TFile::Open("OldCalibration.root"); if(fOldCalib->IsOpen()){ printf("\n\n...Adding PHOS calibration used in ESD production \n") ; char key[55] ; TH2F * hCalib[5] ; for(Int_t mod=0;mod<5; mod++){ sprintf(key,"calibrationMod%d",mod) ; hCalib[mod] = (TH2F*)fOldCalib->Get(key) ; } task1->SetOldCalibration(hCalib) ; fOldCalib->Close() ; } mgr->AddTask(task1); // Create containers for input/output AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("output0", TTree::Class(), AliAnalysisManager::kOutputContainer); // Connect input/output mgr->ConnectInput(task1 , 0, cinput); mgr->ConnectOutput(task1, 0,coutput1); AliLog::SetClassDebugLevel("AliGeomManager", 10) ; AliCDBManager::Instance()->SetRun(iRunNum) ; // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB") ; // AliCDBManager::Instance()->SetDefaultStorage("raw://") ; AliCDBManager::Instance()->SetDefaultStorage("alien://folder=/alice/data/2010/OCDB") ; AliCDBManager::Instance()->SetSpecificStorage("PHOS/*/*", "local://OCDB"); printf("RunNunm===%d \n",iRunNum) ; if (mgr->InitAnalysis()) { mgr->PrintStatus(); mgr->StartAnalysis("local", chain); } if(iRunNum<=137848){ //period 1 gSystem->Exec("mv BadMap_LHC10h_period1.root BadMap_LHC10h.root") ; } else{ gSystem->Exec("mv BadMap_LHC10h_period234.root BadMap_LHC10h.root") ; } gSystem->Exec("aliroot -b -q AnalyzeDiff.C> analyze3.log 2>&1"); }
void AnalysisTrainMuonCAF(char* fileout = "AliAOD.root", char *datasetname = "myDataSet", Int_t nev=1234567890) { // Macro to produce a generic AOD starting from an ESD file. // The AOD is filled with two tasks: // 1- with the first one (AliAnalysisTaskESDfilter), // all the branches of the AOD are filled apart from the muons. // 2- with the second task (AliAnalysisTaskESDMuonFilter) // muons tracks are added to the tracks branch // This macro works on the CAF // R. Arnaldi 4/5/08 gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); // Reset user processes if CAF if not responding anymore // TProof::Reset("lxb6046"); // Connect to proof TProof::Open("lxb6046"); // may be username@lxb6046 if user not the same as on local // Clear packages if changing ROOT version on CAF or local // gProof->ClearPackages(); // Enable proof debugging if needed // gProof->SetLogLevel(5); // Common packages gProof->UploadPackage("STEERBase.par"); gProof->EnablePackage("STEERBase"); gProof->UploadPackage("ESD.par"); gProof->EnablePackage("ESD"); gProof->UploadPackage("AOD.par"); gProof->EnablePackage("AOD"); gProof->UploadPackage("ANALYSIS.par"); gProof->EnablePackage("ANALYSIS"); gProof->UploadPackage("ANALYSISalice.par"); gProof->EnablePackage("ANALYSISalice"); // Analysis-specific // --- Enable the PWG3base Package gProof->UploadPackage("PWG3muon.par"); gProof->EnablePackage("PWG3muon"); // Chain from files staged on CAF // gROOT->LoadMacro("CreateESDChain.C"); // TChain* chain = CreateESDChain("ESD1503X_v1.txt",3); // TChain* chain = CreateESDChain("ESD82XX_30Kshort.txt", 10); // Chain from datasets gROOT->LoadMacro("CreateChainFromDataSet.C"); ds = gProof->GetDataSet(datasetname)->GetStagedSubset(); chain = CreateChainFromDataSet(ds, "esdTree"); // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "Analysis train"); // ESD input handler AliESDInputHandler *esdHandler = new AliESDInputHandler(); esdHandler->SetInactiveBranches("FMD CaloCluster"); // AOD output handler AliAODHandler* aodHandler = new AliAODHandler(); aodHandler->SetOutputFileName(fileout); //aodHandler->SetOutputFileName("AOD.root"); mgr->SetInputEventHandler(esdHandler); mgr->SetOutputEventHandler(aodHandler); // Set of cuts plugged into the ESD filter // // standard AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose"); esdTrackCutsL->SetMinNClustersTPC(50); esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5); esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2); esdTrackCutsL->SetRequireTPCRefit(kTRUE); esdTrackCutsL->SetMinNsigmaToVertex(3); esdTrackCutsL->SetRequireSigmaToVertex(kTRUE); esdTrackCutsL->SetAcceptKingDaughters(kFALSE); // // hard cuts AliESDtrackCuts* esdTrackCutsH = new AliESDtrackCuts("AliESDtrackCuts", "Hard"); esdTrackCutsH->SetMinNClustersTPC(100); esdTrackCutsH->SetMaxChi2PerClusterTPC(2.0); esdTrackCutsH->SetMaxCovDiagonalElements(2,2,0.5,0.5,2); esdTrackCutsH->SetRequireTPCRefit(kTRUE); esdTrackCutsH->SetMinNsigmaToVertex(2); esdTrackCutsH->SetRequireSigmaToVertex(kTRUE); esdTrackCutsH->SetAcceptKingDaughters(kFALSE); esdTrackCutsH->SetPRange(0.,2.); // // muon cuts AliESDMuonTrackCuts* esdMuonTrackCuts = new AliESDMuonTrackCuts("AliESDMuonTrackCuts", "test"); esdMuonTrackCuts->SetPRange(0.,20.); //esdMuonTrackCuts->SetPtRange(0.,0.5); // example of kinematic cuts that can be applied // track filter (to reject tracks not surviving the cuts - refers to all particles apart from muons) AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); trackFilter->AddCuts(esdTrackCutsH); // muon track filter (to reject muon tracks not surviving the cuts) AliAnalysisFilter* trackMuonFilter = new AliAnalysisFilter("trackMuonFilter"); trackMuonFilter->AddCuts(esdMuonTrackCuts); // ESD filter task putting standard info to output generic AOD AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter"); //esdfilter->SetTrackFilter(trackFilter); esdfilter->SetDebugLevel(10); mgr->AddTask(esdfilter); // ESD filter task putting muon info to output generic AOD AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter"); esdmuonfilter->SetTrackFilter(trackMuonFilter); mgr->AddTask(esdmuonfilter); // Containers for input/output AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer(); // Output AOD container. AliAnalysisDataContainer *cout_aod = mgr->GetCommonOutputContainer(); // Connect containers to tasks slots mgr->ConnectInput (esdfilter, 0, cin_esd ); mgr->ConnectOutput (esdfilter, 0, cout_aod ); mgr->ConnectInput (esdmuonfilter, 0, cin_esd); mgr->ConnectOutput (esdmuonfilter, 0, cout_aod ); // // Run the analysis // if (mgr->InitAnalysis()) { mgr->PrintStatus(); mgr->StartAnalysis("proof",chain,nev); } }
void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, Int_t requiredData = 1, const char* option = "") { // runWhat options: 0 = AlidNdEtaTask // 1 = AlidNdEtaCorrectionTask // 2 = both // // aProof option: 0 no proof // 1 proof with chain // 2 proof with dataset // // requiredData option: 0 = only ESD // 1 = ESD+MC // 2 = RAW (ESD+check on event type) // // option is passed to the task(s) // option SAVE is removed and results in moving the output files to maps/<ds name>/<trigger>/<det> // TString taskName; if (runWhat == 0 || runWhat == 2) { Printf("Running AlidNdEtaTask"); } if (runWhat == 1 || runWhat == 2) { Printf("Running AlidNdEtaCorrectionTask"); if (requiredData != 1) { Printf("AlidNdEtaCorrectionTask needs MC. Exiting..."); return; } } if (nRuns < 0) nRuns = 1234567890; if (aProof) { TProof::Open("alice-caf"); Bool_t fullAliroot = kFALSE; // Enable the needed package if (1) { gProof->UploadPackage("$ALICE_ROOT/STEERBase"); gProof->EnablePackage("$ALICE_ROOT/STEERBase"); gProof->UploadPackage("$ALICE_ROOT/ESD"); gProof->EnablePackage("$ALICE_ROOT/ESD"); gProof->UploadPackage("$ALICE_ROOT/AOD"); gProof->EnablePackage("$ALICE_ROOT/AOD"); gProof->UploadPackage("$ALICE_ROOT/ANALYSIS"); gProof->EnablePackage("$ALICE_ROOT/ANALYSIS"); gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice"); gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice"); } else if (!fullAliroot) { gProof->UploadPackage("$ALICE_ROOT/AF-v4-18-12-AN.par"); gProof->EnablePackage("AF-v4-18-12-AN"); } else { // needed if ITS recpoints are accessed, see AlidNdEtaTask, FULLALIROOT define statement gProof->UploadPackage("$ALICE_ROOT/v4-18-15-AN-all.par"); gProof->EnablePackage("v4-18-15-AN-all"); gProof->Exec("TGrid::Connect(\"alien://\")", kTRUE); // TODO add this to loadlibs.C gProof->Exec("gSystem->Load(\"libXMLParser\")", kTRUE); } gProof->UploadPackage("$ALICE_ROOT/PWG0base"); gProof->EnablePackage("$ALICE_ROOT/PWG0base"); } else { gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/"); gSystem->Load("libVMC"); gSystem->Load("libTree"); gSystem->Load("libProof"); gSystem->Load("libSTEERBase"); gSystem->Load("libESD"); gSystem->Load("libAOD"); gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); gSystem->Load("libPWG0base"); } // Create the analysis manager mgr = new AliAnalysisManager; // Add ESD handler if (fullAliroot) AliESDInputHandler* esdH = new AliESDInputHandlerRP; // for RecPoints else AliESDInputHandler* esdH = new AliESDInputHandler; esdH->SetInactiveBranches("FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks MuonTracks TrdTracks"); mgr->SetInputEventHandler(esdH); AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD | AliPWG0Helper::kFieldOn; //AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD | AliPWG0Helper::kFieldOn | AliPWG0Helper::kSPDOnlyL0; //AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kTPCITS | AliPWG0Helper::kFieldOn; AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kAcceptAll | AliTriggerAnalysis::kOfflineFlag; //AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kAcceptAll | AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kOneParticle; //AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kSPDGFOBits | AliTriggerAnalysis::kOfflineFlag; //AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kSPDGFOBits | AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kOneParticle; //AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kV0AND | AliTriggerAnalysis::kOfflineFlag; //AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kV0OR | AliTriggerAnalysis::kOfflineFlag; //AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kV0OR | AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kOneParticle; AliPWG0Helper::DiffTreatment diffTreatment = AliPWG0Helper::kMCFlags; //AliPWG0Helper::DiffTreatment diffTreatment = AliPWG0Helper::kE710Cuts; AliPWG0Helper::PrintConf(analysisMode, trigger, diffTreatment); AliESDtrackCuts* esdTrackCuts = 0; if (!(analysisMode & AliPWG0Helper::kSPD)) { // selection of esd tracks gROOT->ProcessLine(".L ../CreateStandardCuts.C"); esdTrackCuts = CreateTrackCuts(analysisMode); if (!esdTrackCuts) { printf("ERROR: esdTrackCuts could not be created\n"); return; } esdTrackCuts->SetHistogramsOn(kTRUE); } cInput = mgr->GetCommonInputContainer(); // remove SAVE option if set Bool_t save = kFALSE; TString optStr(option); if (optStr.Contains("SAVE")) { optStr = optStr(0,optStr.Index("SAVE")) + optStr(optStr.Index("SAVE")+4, optStr.Length()); save = kTRUE; } // physics selection gROOT->ProcessLine(".L $ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C"); physicsSelectionTask = AddTaskPhysicsSelection((requiredData == 2) ? kFALSE : kTRUE); // 900 GeV if (0 && requiredData == 2) { physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #769 #3119"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL #446 #2554"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1C-ABCE-NOPF-ALL #1334 #2228"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1-E-NOPF-ALL #790"); } // 7 TeV, run 114783 if (0 && requiredData == 2) { physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #345"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL #2130"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1C-ABCE-NOPF-ALL #3018"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1-E-NOPF-ALL #1238"); } // 7 TeV, run 114786,98 if (0 && requiredData == 2) { physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #346"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL #2131"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1C-ABCE-NOPF-ALL #3019"); physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1-E-NOPF-ALL #1238"); //physicsSelectionTask->GetPhysicsSelection()->Initialize(114786); } // FO efficiency (for MC) if (0 && requiredData != 2) { //const char* fastORFile = "spdFOEff_run104824_52.root"; //const char* fastORFile = "spdFOEff_run104867_92.root"; //const char* fastORFile = "spdFOEff_run105054_7.root"; const char* fastORFile = "spdFOEff_run114931.root"; Printf("NOTE: Simulating FAST-OR efficiency on the analysis level using file %s", fastORFile); TFile::Open(fastORFile); spdFOEff = (TH1F*) gFile->Get("spdFOEff"); physicsSelectionTask->GetPhysicsSelection()->Initialize(114931); physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis()->SetSPDGFOEfficiency(spdFOEff); } // V0 syst. study if (0) { Printf("NOTE: Systematic study for VZERO enabled!"); physicsSelectionTask->GetPhysicsSelection()->Initialize(104867); for (Int_t i=0; i<1; i++) { // for MC and data //physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0HwPars(15, 61.5, 86.5); physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0AdcThr(6); // only for MC //physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0HwPars(0, 0, 125); //physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0AdcThr(0); } } // BG study //physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1A-ABCE-NOPF-ALL"); //physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1C-ABCE-NOPF-ALL"); // Create, add task if (runWhat == 0 || runWhat == 2) { Load("AlidNdEtaTask", aDebug); task = new AlidNdEtaTask(optStr); if (requiredData == 1) task->SetReadMC(); //physicsSelectionTask->GetPhysicsSelection()->SetBin0Callback("AlidNdEtaTask"); // syst. error flags //task->SetUseMCVertex(); //task->SetUseMCKine(); //task->SetOnlyPrimaries(); //task->SetFillPhi(); //task->SetSymmetrize(); // INEL>0 definition if (trigger & AliTriggerAnalysis::kOneParticle) task->SetMultAxisEta1(); task->SetTrigger(trigger); task->SetAnalysisMode(analysisMode); task->SetTrackCuts(esdTrackCuts); //task->SetDeltaPhiCut(0.064); task->SetDiffTreatment(diffTreatment); mgr->AddTask(task); // Attach input mgr->ConnectInput(task, 0, cInput); // Attach output cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer); mgr->ConnectOutput(task, 1, cOutput); } if (runWhat == 1 || runWhat == 2) { Load("AlidNdEtaCorrectionTask", aDebug); task2 = new AlidNdEtaCorrectionTask(optStr); // syst. error flags //task2->SetFillPhi(); //task2->SetOnlyPrimaries(); //task2->SetSymmetrize(); // to account for gaps in real life SPD geometry task2->SetSkipParticles(); // INEL>0 definition if (trigger & AliTriggerAnalysis::kOneParticle) task2->SetMultAxisEta1(); task2->SetTrigger(trigger); task2->SetAnalysisMode(analysisMode); task2->SetTrackCuts(esdTrackCuts); //task2->SetDeltaPhiCut(0.064); task2->SetDiffTreatment(diffTreatment); mgr->AddTask(task2); // Attach input mgr->ConnectInput(task2, 0, cInput); // Attach output cOutput = mgr->CreateContainer("cOutput2", TList::Class(), AliAnalysisManager::kOutputContainer); mgr->ConnectOutput(task2, 0, cOutput); } if (requiredData == 1) { // Enable MC event handler AliMCEventHandler* handler = new AliMCEventHandler; handler->SetReadTR(kFALSE); mgr->SetMCtruthEventHandler(handler); } // Enable debug printouts if (aDebug) mgr->SetDebugLevel(2); // Run analysis mgr->InitAnalysis(); mgr->PrintStatus(); if (aProof == 2) { // process dataset mgr->StartAnalysis("proof", data, nRuns, offset); if (save) { TString path("maps/"); path += TString(data).Tokenize("/")->Last()->GetName(); UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) AliTriggerAnalysis::kStartOfFlags; switch (triggerNoFlags) { case AliTriggerAnalysis::kMB1: path += "/mb1"; break; case AliTriggerAnalysis::kMB2: path += "/mb2"; break; case AliTriggerAnalysis::kMB3: path += "/mb3"; break; case AliTriggerAnalysis::kSPDGFO: path += "/spdgfo"; break; case AliTriggerAnalysis::kSPDGFOBits: path += "/spdgfobits"; break; case AliTriggerAnalysis::kAcceptAll: path += "/all"; break; case AliTriggerAnalysis::kV0AND: path += "/v0and"; break; case AliTriggerAnalysis::kV0OR: path += "/v0or"; break; case AliTriggerAnalysis::kNSD1: path += "/nsd1"; break; case AliTriggerAnalysis::kMB1Prime: path += "/mb1prime"; break; default: Printf("ERROR: Trigger undefined for path to files"); return; } if (trigger & AliTriggerAnalysis::kOneParticle) path += "-onepart"; if (strlen(requireClass) > 0 && strlen(rejectClass) == 0) { path += Form("/%s", requireClass); } else if (strlen(rejectClass) > 0) path += Form("/%s--%s", requireClass, rejectClass); if (analysisMode & AliPWG0Helper::kSPD) path += "/spd"; if (analysisMode & AliPWG0Helper::kSPDOnlyL0) path += "onlyL0"; if (analysisMode & AliPWG0Helper::kTPC) path += "/tpc"; if (analysisMode & AliPWG0Helper::kTPCITS) path += "/tpcits"; gSystem->mkdir(path, kTRUE); if (runWhat == 0 || runWhat == 2) { gSystem->Rename("analysis_esd_raw.root", path + "/analysis_esd_raw.root"); if (requiredData == 1) gSystem->Rename("analysis_mc.root", path + "/analysis_mc.root"); } if (runWhat == 1 || runWhat == 2) { if (optStr.Contains("process-types")) gSystem->Rename("correction_mapprocess-types.root", path + "/correction_mapprocess-types.root"); else gSystem->Rename("correction_map.root", path + "/correction_map.root"); } gSystem->Rename("event_stat.root", path + "/event_stat.root"); Printf(">>>>> Moved files to %s", path.Data()); } } else if (aProof == 3) { gROOT->ProcessLine(".L CreateChainFromDataSet.C"); ds = gProof->GetDataSet(data)->GetStagedSubset(); chain = CreateChainFromDataSet(ds, "esdTree", nRuns); mgr->StartAnalysis("local", chain, 1234567890, offset); } else { // Create chain of input files gROOT->LoadMacro("../CreateESDChain.C"); chain = CreateESDChain(data, nRuns, offset); //chain = CreateChain("TE", data, nRuns, offset); mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain); } }
void runLocal(const char *chainlistfile, int dataFromAlien=0) { TStopwatch timer; timer.Start(); printf("*** Connect to AliEn ***\n"); if (dataFromAlien) TGrid::Connect("alien://"); gSystem->Load("libProofPlayer"); //____________________________________________________// //_____________Setting up STEERBase.par_______________// //____________________________________________________// setupPar("STEERBase"); gSystem->Load("libSTEERBase"); //____________________________________________________// //_____________Setting up ESD.par_____________________// //____________________________________________________// setupPar("ESD"); gSystem->Load("libVMC"); gSystem->Load("libESD"); //____________________________________________________// //_____________Setting up AOD.par_____________________// //____________________________________________________// setupPar("AOD"); gSystem->Load("libAOD"); //_________________________________________________________// //_____________Setting up ANALYSIS.par_____________________// //_________________________________________________________// setupPar("ANALYSIS"); gSystem->Load("libANALYSIS"); //_________________________________________________________// //_____________Setting up ANALYSISalice.par________________// //_________________________________________________________// setupPar("ANALYSISalice"); gSystem->Load("libANALYSISalice"); //____________________________________________________// //_____________Setting up PWG2AOD.par_________________// //____________________________________________________// setupPar("PWG2AOD"); gSystem->Load("libPWG2AOD"); //____________________________________________________// //_____________Setting up PWG2femtoscopy.par__________// //____________________________________________________// setupPar("PWG2femtoscopy"); gSystem->Load("libPWG2femtoscopy"); //____________________________________________________// //_____________Setting up PWG2femtoscopyUser.par______// //____________________________________________________// setupPar("PWG2femtoscopyUser"); gSystem->Load("libPWG2femtoscopyUser"); //ANALYSIS PART gSystem->SetIncludePath("-I$ROOTSYS/include -I\"/usr/local/CERN/root/include\" -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I./ESD -I./AOD -I./ANALYSIS -I./PWG2AOD/AOD"); gROOT->LoadMacro("ConfigFemtoAnalysis.C++"); //____________________________________________// //Usage of event tags AliTagAnalysis *analysis = new AliTagAnalysis(); TChain *chain = 0x0; // chain = analysis->GetChainFromCollection(collectionfile,"esdTree"); if (dataFromAlien) { AliTagAnalysis *analysis = new AliTagAnalysis(); chain = analysis->GetChainFromCollection(chainlistfile,"esdTree"); } else { gROOT->LoadMacro("CreateESDChain.C"); chain = CreateESDChain(chainlistfile,500); } //____________________________________________// // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); AliESDInputHandler* esdH = new AliESDInputHandler; AliMCEventHandler *mcH = new AliMCEventHandler; esdH->SetInactiveBranches("FMD CaloCluster"); mgr->SetInputEventHandler(esdH); mgr->SetMCtruthEventHandler(mcH); //____________________________________________// // 1st Pt task AliAnalysisTaskFemto *task1 = new AliAnalysisTaskFemto("TaskFemto"); mgr->AddTask(task1); // Create containers for input/output // AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("input0", TTree::Class(), AliAnalysisManager::kInputContainer); AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"Femto.ESD.root"); //____________________________________________// cinput1->SetData(chain); mgr->ConnectInput(task1,0,cinput1); mgr->ConnectOutput(task1,0,coutput1); if (!mgr->InitAnalysis()) return; mgr->PrintStatus(); mgr->StartAnalysis("local",chain); timer.Stop(); timer.Print(); }
//____________________________________________ AliPerformanceTask* AddTaskPerformanceTPCdEdxQA(Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t highMult = kFALSE, const char *triggerClass=0, Bool_t bUseHLT = kFALSE, Bool_t bUseTOF = kFALSE, Bool_t bTPCTrackingOnly = kFALSE, Bool_t bDoEffTpcSec = kFALSE) { const TString taskName[] = {"TPC", "HLT"}; const TString taskName2[] = {"", "_Tracking"}; Int_t idx = 0, idx2 = 0; if (bUseHLT) idx = 1; if (bTPCTrackingOnly) idx2 = 1; // // Add AliPerformanceTask with TPC performance components // AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if(!mgr) { Error("AddTaskPerformanceTPCdEdxQA","AliAnalysisManager not set!"); return NULL; } TString type = mgr->GetInputEventHandler()->GetDataType(); if (!type.Contains("ESD")) { Error("AddTaskPerformanceTPCdEdxQA", "ESD input handler needed!"); return NULL; } AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler(); if (!mcH && bUseMCInfo) { Error("AddTaskPerformanceTPCdEdxQA", "MC input handler needed!"); return NULL; } // // Add HLT Event // if (bUseHLT) { AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler()); esdH->SetReadHLT(); } // // Create task // AliPerformanceTask *task = new AliPerformanceTask("PerformanceQA",Form("%s%s Performance",taskName[idx].Data(), taskName2[idx2].Data())); if (!task) { Error("AddTaskPerformanceTPCdEdxQA", "%s", Form("%s%s performance task cannot be created!",taskName[idx].Data(), taskName2[idx2].Data())); return NULL; } task->SetUseMCInfo(bUseMCInfo); task->SetUseESDfriend(bUseESDfriend); // task->SetUseTerminate(kFALSE); task->SetUseHLT(bUseHLT); // // 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(3.0); pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE); pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE); pRecInfoCutsTPC->SetAcceptKinkDaughters(kFALSE); pRecInfoCutsTPC->SetMinNClustersTPC(70); pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(4.); pRecInfoCutsTPC->SetDCAToVertex2D(kTRUE); pRecInfoCutsTPC->SetHistogramsOn(kFALSE); } else { Error("AddTaskPerformanceTPCdEdxQA", "AliRecInfoCutsTPC cannot be created!"); return NULL; } // // Create TPC-MC track reconstruction cuts // AliMCInfoCuts *pMCInfoCuts = new AliMCInfoCuts("pMCInfoCuts"); if(pMCInfoCuts) { pMCInfoCuts->SetMinTrackLength(70); } else { Error("AddTaskPerformanceTPCdEdxQA", "AliMCInfoCuts cannot be created!"); return NULL; } // // Create performance objects for TPC and set cuts // enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec }; AliPerformanceTPC *pCompTPC0; AliPerformanceMatch *pCompMatch1; AliPerformanceMatch *pCompMatch2; AliPerformanceDEdx *pCompDEdx3; if (bTPCTrackingOnly == kFALSE) { // // TPC performance // pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE,-1,highMult); if(!pCompTPC0) { Error("AddTaskPerformanceTPCdEdxQA", "Cannot create AliPerformanceTPC"); } pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts); // pCompTPC0->SetUseTrackVertex(kFALSE); pCompTPC0->SetUseTrackVertex(kTRUE); pCompTPC0->SetUseHLT(bUseHLT); pCompTPC0->SetUseTOFBunchCrossing(bUseTOF); // // TPC ITS match // pCompMatch1 = new AliPerformanceMatch("AliPerformanceMatchTPCITS","AliPerformanceMatchTPCITS",0,kFALSE); if(!pCompMatch1) { Error("AddTaskPerformanceTPCdEdxQA", "Cannot create AliPerformanceMatchTPCITS"); } pCompMatch1->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompMatch1->SetAliMCInfoCuts(pMCInfoCuts); pCompMatch1->SetUseTOFBunchCrossing(bUseTOF); // // ITS TPC match // pCompMatch2 = new AliPerformanceMatch("AliPerformanceMatchITSTPC","AliPerformanceMatchITSTPC",1,kFALSE); if(!pCompMatch2) { Error("AddTaskPerformanceTPCdEdxQA", "Cannot create AliPerformanceMatchITSTPC"); } pCompMatch2->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompMatch2->SetAliMCInfoCuts(pMCInfoCuts); pCompMatch2->SetUseTOFBunchCrossing(bUseTOF); // // dEdx // pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE); if(!pCompDEdx3) { Error("AddTaskPerformanceTPCdEdxQA", "Cannot create AliPerformanceDEdxTPCInner"); } pCompDEdx3->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts); //pCompDEdx3->SetUseTrackVertex(kFALSE); pCompDEdx3->SetUseTrackVertex(kTRUE); } //end bTPCTrackingOnly == kFALSE // // Resolution ------------------------------------------------------------------------------------ // AliPerformanceRes *pCompRes4 = new AliPerformanceRes(bTPCTrackingOnly ? "AliPerformanceResTPC" : "AliPerformanceRes", "AliPerformanceRes", bTPCTrackingOnly == kTRUE ? kTPCInner : kTPC,kFALSE); if(!pCompRes4) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceRes"); } pCompRes4->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompRes4->SetAliMCInfoCuts(pMCInfoCuts); pCompRes4->SetUseTrackVertex(bTPCTrackingOnly == kTRUE ? kFALSE : kTRUE); // // Efficiency ------------------------------------------------------------------------------------ // AliPerformanceEff *pCompEff5 = new AliPerformanceEff(bTPCTrackingOnly ? "AliPerformanceEffTPC" : "AliPerformanceEff", "AliPerformanceEff",kTPC,kFALSE); if(!pCompEff5) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff"); } AliRecInfoCuts *pRecInfoCutsTPC2 = NULL; if (bTPCTrackingOnly) { //For low pt tracks, HLT finds only short track segments. //Hence, for the tpc-tracking only tracking-efficiency, we lower the minimum number of hits per reconstructed TPC track pRecInfoCutsTPC2 = new AliRecInfoCuts(*pRecInfoCutsTPC); pRecInfoCutsTPC2->SetMinNClustersTPC(20); pCompEff5->SetAliRecInfoCuts(pRecInfoCutsTPC2); } else { pCompEff5->SetAliRecInfoCuts(pRecInfoCutsTPC); } pCompEff5->SetAliMCInfoCuts(pMCInfoCuts); pCompEff5->SetUseTrackVertex(bTPCTrackingOnly == kTRUE ? kFALSE : kTRUE); AliPerformanceEff *pCompEff5Sec; if (bDoEffTpcSec) { pCompEff5Sec = new AliPerformanceEff(bTPCTrackingOnly ? "AliPerformanceEffSecTPC" : "AliPerformanceEffSec", "AliPerformanceEffSec",kTPCSec,kFALSE); if(!pCompEff5Sec) { Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff"); } pCompEff5Sec->SetAliRecInfoCuts(bTPCTrackingOnly ? pRecInfoCutsTPC2 : pRecInfoCutsTPC); pCompEff5Sec->SetAliMCInfoCuts(pMCInfoCuts); pCompEff5Sec->SetUseTrackVertex(bTPCTrackingOnly == kTRUE ? kFALSE : kTRUE); } // // TPC Constrain to vertex // AliPerformanceMatch *pCompConstrain6; if (bTPCTrackingOnly == kFALSE) { pCompConstrain6 = new AliPerformanceMatch("AliPerformanceMatchTPCConstrain","AliPerformanceMatchTPCConstrain",2,kFALSE); if(!pCompConstrain6) { Error("AddTaskPerformanceTPCdEdxQA", "Cannot create AliPerformanceMatchTPCConstrain"); } pCompConstrain6->SetAliRecInfoCuts(pRecInfoCutsTPC); pCompConstrain6->SetAliMCInfoCuts(pMCInfoCuts); pCompConstrain6->SetUseTOFBunchCrossing(bUseTOF); } //end bTPCTrackingOnly == kFALSE // // Add components to the performance task // if (bTPCTrackingOnly == kFALSE) { if(!bUseMCInfo) { pCompTPC0->SetTriggerClass(triggerClass); pCompMatch1->SetTriggerClass(triggerClass); pCompMatch2->SetTriggerClass(triggerClass); pCompDEdx3->SetTriggerClass(triggerClass); pCompConstrain6->SetTriggerClass(triggerClass); } task->AddPerformanceObject( pCompTPC0 ); task->AddPerformanceObject( pCompMatch1 ); task->AddPerformanceObject( pCompMatch2 ); task->AddPerformanceObject( pCompDEdx3 ); task->AddPerformanceObject( pCompConstrain6 ); } //end bTPCTrackingOnly == kFALSE if(bUseMCInfo) { task->AddPerformanceObject( pCompRes4 ); task->AddPerformanceObject( pCompEff5 ); if (bDoEffTpcSec) task->AddPerformanceObject( pCompEff5Sec ); } // // Create containers for input // mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); // // Create containers for output // AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("%s%sQA", taskName[idx].Data(), taskName2[idx2].Data()), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:%s_%s", mgr->GetCommonFileName(), taskName[idx].Data(),task->GetName())); AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("%s%sQASummary", taskName[idx].Data(), taskName2[idx2].Data()), TTree::Class(), AliAnalysisManager::kParamContainer, Form("trending.root:Summary%sQA", taskName[idx].Data())); mgr->ConnectOutput(task, 1, coutput); mgr->ConnectOutput(task, 0, coutput2); return task; }
//_____________________________________________________________________________ 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); }
void runNorm(TString inputFileName = "AliAOD.root", Int_t nEvents = 1e6, TString beamConf = "p-Pb", Bool_t isESD = kFALSE, Bool_t isMC = kFALSE, Int_t debugLevel = 0) { TStopwatch timer; timer.Start(); // Check runing mode Int_t mode = GetMode(inputFileName); if(mode < 0){ Error("runAnalysis","Please provide either an ESD/AOD root file or a collection of ESDs/AODs."); return; } // Load common libraries gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); gSystem->Load("libSTEERBase"); // gSystem->Load("libSTEER"); gSystem->Load("libESD"); gSystem->Load("libAOD"); gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); gSystem->Load("libEventMixing"); gSystem->Load("libCORRFW"); gSystem->Load("libPWGmuon"); gSystem->Load("libPWGmuondep"); gSystem->AddIncludePath(Form("-I\"%s/include\" -I\"%s/include\"", gSystem->ExpandPathName("$ALICE_ROOT"),gSystem->ExpandPathName("$ALICE_PHYSICS"))); gROOT->ProcessLine(Form(".include %s/include %s/include", gSystem->ExpandPathName("$ALICE_ROOT"), gSystem->ExpandPathName("$ALICE_PHYSICS"))); // Create input chain TChain* chain = CreateChain(inputFileName,isESD); if (!chain) return; // Create the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("MuonTask"); if ( isESD) { // ESD input handler AliESDInputHandler* esdH = new AliESDInputHandler(); esdH->SetReadFriends(kFALSE); mgr->SetInputEventHandler(esdH); } else { // AOD input handler AliAODInputHandler* aodH = new AliAODInputHandler(); mgr->SetInputEventHandler(aodH); } TString dataType = mgr->GetInputEventHandler()->GetDataType(); Info("runLocal",Form("Manager with %s",dataType.Data())); // Enable MC event handler for ESDs if ( isMC && isESD ){ AliVEventHandler* handler = new AliMCEventHandler; mgr->SetMCtruthEventHandler(handler); } // event selection and centrality framework if ( isESD ){ gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C"); AliPhysicsSelectionTask* physicsSelection = AddTaskPhysicsSelection(isMC); if ( !physicsSelection ) { Error("runLocal","AliPhysicsSelectionTask not created!"); return; } } if ( isESD ){ // event centrality gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C"); AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); if ( !taskCentrality ) { Error("runLocal on ESD","AliCentralitySelectionTask not created!"); return; } if ( isMC ) taskCentrality->SetMCInput(); //taskCentrality->SetPass(1); // remember to set the pass you are processing!!! } /*else { //Only on full AOD, it is possible to reprocess the centrality framework gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C"); AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(kTRUE,kTRUE); if ( !taskCentrality ) { Error("runLocal on AOD","AliCentralitySelectionTask not created!"); return; } if ( isMC ) taskCentrality->SetMCInput(); }*/ // Example analysis // Create task //Analysis task is on working directory // gROOT->LoadMacro("AliAnalysisTaskNorm.cxx+g"); // gROOT->LoadMacro("AddTaskNorm.C"); gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWG/muon/AliAnalysisTaskNorm.cxx+g"); gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWG/muon/AddTaskNorm.C"); AliAnalysisTaskNorm* task = AddTaskNorm(isESD,isMC,beamConf); if (!task) { Error("runAnalysis","AliAnalysisTaskNorm not created!"); return; } task->SetDebugLevel(debugLevel); // Enable debug printouts mgr->SetDebugLevel(debugLevel); // start local analysis if (mgr->InitAnalysis()) { mgr->PrintStatus(); if(debugLevel>=2) mgr->SetNSysInfo(100); mgr->StartAnalysis("local", chain, nEvents); } if(debugLevel>=2){ mgr->ProfileTask("Task"); } timer.Stop(); timer.Print(); }
void anaCaloFilter(Int_t mode=mLocal) { // Main char cmd[200] ; sprintf(cmd, ".! rm -rf AliAOD.root") ; gROOT->ProcessLine(cmd) ; //-------------------------------------------------------------------- // Load analysis libraries // Look at the method below, // change whatever you need for your analysis case // ------------------------------------------------------------------ LoadLibraries(mode) ; //------------------------------------------------------------------------------------------------- //Create chain from ESD and from cross sections files, look below for options. //------------------------------------------------------------------------------------------------- if(kInputData == "ESD") kTreeName = "esdTree" ; else if(kInputData == "AOD") kTreeName = "aodTree" ; else { cout<<"Wrong data type "<<kInputData<<endl; break; } TChain *chain = new TChain(kTreeName) ; CreateChain(mode, chain); if(chain){ AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen //-------------------------------------- // Make the analysis manager //------------------------------------- AliAnalysisManager *mgr = new AliAnalysisManager("Manager", "Manager"); // AOD output handler AliAODHandler* aodoutHandler = new AliAODHandler(); aodoutHandler->SetOutputFileName("AliAOD.root"); ////aodoutHandler->SetCreateNonStandardAOD(); mgr->SetOutputEventHandler(aodoutHandler); //input if(kInputData == "ESD") { // ESD handler AliESDInputHandler *esdHandler = new AliESDInputHandler(); mgr->SetInputEventHandler(esdHandler); esdHandler->SetReadFriends(kFALSE); cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl; } if(kInputData == "AOD") { // AOD handler AliAODInputHandler *aodHandler = new AliAODInputHandler(); mgr->SetInputEventHandler(aodHandler); cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl; } // mgr->SetDebugLevel(1); //------------------------------------------------------------------------- //Define task, put here any other task that you want to use. //------------------------------------------------------------------------- // ESD physics selection task if(kInputData == "ESD" && kUsePhysSel) { gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C"); AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(); } gROOT->LoadMacro("AddTaskCaloFilter.C"); AliAnalysisTaskCaloFilter* filter = AddTaskCaloFilter(); //AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter(); //filter->SetConfigFileName("ConfigCaloFilter.C"); //mgr->AddTask(filter); // Create containers for input/output AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer(); AliAnalysisDataContainer *coutntuple = mgr->CreateContainer("EventNtuple", TNtuple::Class(), AliAnalysisManager::kOutputContainer, "eventselection.root"); mgr->ConnectInput (filter, 0, cinput1); mgr->ConnectOutput (filter, 0, coutput1 ); mgr->ConnectOutput (filter, 1, coutntuple ); //----------------------- // Run the analysis //----------------------- TString smode = ""; if (mode==mLocal || mode == mLocalCAF) smode = "local"; else if (mode==mPROOF) smode = "proof"; else if (mode==mGRID) smode = "local"; mgr->InitAnalysis(); mgr->PrintStatus(); mgr->StartAnalysis(smode.Data(),chain); cout <<" Analysis ended sucessfully "<< endl ; } else cout << "Chain was not produced ! "<<endl; //sprintf(cmd, ".! rm -rf CorrectionFiles") ; }
void CPVanalysis(const TString dataset="") { gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); //load analysis framework gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS"); // A task can be compiled dynamically with AClic gROOT->LoadMacro("AliAnalysisTaskCPV.cxx+g"); // Connect to alien TString token = gSystem->Getenv("GRID_TOKEN") ; token="OK"; if ( token == "OK" ) TGrid::Connect("alien://"); else Printf("You are not connected to the GRID") ; // AliInfo("You are not connected to the GRID") ; cout << "CPVanalysis: processing collection " << dataset << endl; // Create the chain TChain* chain; if (dataset.Contains(".txt")) { gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/CreateESDChain.C"); chain = CreateESDChain(dataset.Data(), 1000); } else if (dataset.Contains(".xml")) { chain = new TChain("esdTree"); TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset)); TAlienResult* result = collection->GetGridResult("",0 ,0); TList* rawFileList = result->GetFileInfoList(); for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) { TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(counter)) ; const char * rawFile = fi->GetCurrentUrl()->GetUrl() ; printf("Processing %s\n", rawFile) ; chain->Add(rawFile); printf("Chain: %d entries.\n",chain->GetEntries()); } } // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("CPVanalysis"); // ESD input handler AliESDInputHandler* esdH = new AliESDInputHandler(); esdH->SetReadFriends(kFALSE); mgr->SetInputEventHandler(esdH); // Debug level mgr->SetDebugLevel(0); //PID task gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); AliAnalysisTask *taskPID = AddTaskPIDResponse(/*Bool_t isMC=*/ kFALSE, /*Bool_t autoMCesd=*/kTRUE, /*Bool_t tuneOnData=*/kTRUE); // // Add physics selection gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C"); AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(); physSelTask->GetPhysicsSelection()->SetUseBXNumbers(kFALSE);// ---> ??? // Add my task AliAnalysisTaskCPV *task1 = new AliAnalysisTaskCPV("CPVanalysis"); // task1->SelectCollisionCandidates(AliVEvent::kMB); mgr->AddTask(task1); // Create containers for input/output AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histCPV1",TList::Class(),AliAnalysisManager::kOutputContainer,"CPVanalysis.root"); AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histCPV2",TList::Class(),AliAnalysisManager::kOutputContainer,"CPVanalysis.root"); ((AliInputEventHandler*)mgr->GetInputEventHandler())->SetNeedField(1); // Connect input/output mgr->ConnectInput(task1 , 0, cinput); mgr->ConnectOutput(task1, 1, coutput1); mgr->ConnectOutput(task1, 2, coutput2); if (mgr->InitAnalysis()) { mgr->PrintStatus(); mgr->StartAnalysis("local", chain); } }
void AliAnalysisTaskFilteredTest(const char *esdList, Int_t run = 0, Float_t scalingTracks = 1, Float_t scalingV0 = 1, Float_t scalingFriend = 1, const char *ocdb = "cvmfs://", Int_t nFiles = 100000, Int_t firstFile = 0, Int_t nEvents = 1000000000, Int_t firstEvent = 0, Bool_t mc = kFALSE) { TStopwatch timer; timer.Start(); printf("\n\n\n"); printf("scalingTracks=%d\n",scalingTracks); printf("scalingV0=%d\n",scalingV0); printf("nFiles=%d\n",nFiles); gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD"); //____________________________________________// // Make the analysis manager AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); mgr->SetDebugLevel(0); AliESDInputHandler* esdH = new AliESDInputHandler(); //esdH->SetReadFriends(1); esdH->SetReadFriends(1); mgr->SetInputEventHandler(esdH); // Enable MC event handler AliMCEventHandler* handlerMC = new AliMCEventHandler; //handler->SetReadTR(kFALSE); if (mc) mgr->SetMCtruthEventHandler(handlerMC); gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C"); AddTaskCDBconnect(ocdb,run); if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) { gROOT->LoadMacro("localOCDBaccessConfig.C"); localOCDBaccessConfig(); } // Create input chain TChain* chain = AliXRDPROOFtoolkit::MakeChain(esdList, "esdTree",0,nFiles,firstFile); if(!chain) { printf("ERROR: chain cannot be created\n"); return; } chain->Lookup(); gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); Bool_t isMC=kFALSE; // kTRUE in case of MC AddTaskPIDResponse(isMC); // // Wagons to run // gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskFilteredTree.C"); AliAnalysisTaskFilteredTree* task = (AliAnalysisTaskFilteredTree*)AddTaskFilteredTree("Filtered.root"); task->SetLowPtTrackDownscaligF(scalingTracks); task->SetLowPtV0DownscaligF(scalingV0); task->SetFriendDownscaling(scalingFriend); task->SetUseESDfriends(kTRUE); task->Dump(); // Init if (!mgr->InitAnalysis()) mgr->PrintStatus(); // // Run on dataset mgr->StartAnalysis("local",chain,nEvents, firstEvent); timer.Stop(); timer.Print(); delete mgr; CheckOutput(); }