llvm::Value* Function::exceptionInfo() { if (exceptionInfo_ == nullptr) { // Allocate exception information values. TypeGenerator typeGen(module()); const auto exceptionInfoType = typeGen.getStructType(std::vector<llvm::Type*> {typeGen.getI8PtrType(), typeGen.getI32Type()}); exceptionInfo_ = getEntryBuilder().CreateAlloca(exceptionInfoType, nullptr, "exceptionInfo"); } return exceptionInfo_; }
AliAnalysisTaskJetCluster *AddTaskJetCluster(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t nSkip,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,Int_t nSkipCone,Int_t dice,Int_t smear,Bool_t useOADB,Double_t changeEfficiencyFraction) { // Creates a jet fider task, configures it and adds it to the analysis manager. kPtTrackCutCl = ptTrackCut; kTrackEtaWindowCl = etaTrackWindow; kVertexWindowCl = vertexWindow; TString outputFile(deltaFile); // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskJetCluster", "No analysis manager to connect to."); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager. //============================================================================== if (!mgr->GetInputEventHandler()) { ::Error("AddTaskJetCluster", "This task requires an input event handler"); return NULL; } TString type = mgr->GetInputEventHandler()->GetDataType(); TString typeRec(bRec); TString typeGen(bGen); if(!typeRec.Contains("AODextra") && !typeRec.Contains("AODMCextra")) { typeGen.ToUpper(); typeRec.ToUpper(); } cout << "typeRec: " << typeRec << endl; // Create the task and configure it. //=========================================================================== TString cAdd = ""; cAdd += Form("%02d_",(int)((radius+0.01)*10.)); cAdd += Form("B%d",(int)kBackgroundModeCl); cAdd += Form("_Filter%05d",filterMask); cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl)); cAdd += Form("_Skip%02d",nSkip); if(dice>0 || smear>0) cAdd += Form("Detector%d%dFr%d",dice,smear,(int)(changeEfficiencyFraction*100.)); Printf("%s %E %d %d",cAdd.Data(),kPtTrackCutCl,dice,smear); AliAnalysisTaskJetCluster* clus = new AliAnalysisTaskJetCluster(Form("JetCluster%s_%s%s",bRec,jf,cAdd.Data())); // or a config file // clus->SetAnalysisType(AliAnalysisTaskJetCluster::kAnaMC); // if(iAODanalysis)clus->SetAODInput(kTRUE); // clus->SetDebugLevel(11); clus->SetFilterMask(filterMask); // clus->SetUseGlobalSelection(kTRUE); clus->SetVtxCuts(kVertexWindowCl,1); if(type == "AOD"){ // Assume all jet are produced already clus->SetAODTrackInput(kTRUE); clus->SetAODMCInput(kTRUE); } if (typeRec.Contains("AODMCHF")){ clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCHF); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCChargedAcceptance); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMC2")){ clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCCharged); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(5); } else if (typeRec.Contains("AODMCextraonly")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCextraonly); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMCextra")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCextra); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMC")){ clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCAll); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(5); } else if (typeRec.Contains("AODextraonly")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextraonly); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODextra")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextra); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AOD")) { clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAOD); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } clus->SetRparam(radius); clus->SetGhostArea(0.005); clus->SetGhostEtamax(kTrackEtaWindowCl); switch (jf) { case "ANTIKT": clus->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh break; case "CA": clus->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh break; case "KT": clus->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh break; default: ::Error("AddTaskJetCluster", "Wrong jet finder selected\n"); return 0; } if(kWriteAOD){ if(outputFile.Length())clus->SetJetOutputFile(outputFile); clus->SetJetOutputBranch(Form("clusters%s_%s%s",bRec,jf,cAdd.Data())); clus->SetJetOutputMinPt(0); // store only jets / clusters above a certain threshold } clus->SetNSkipLeadingRan(nSkip); clus->SetNSkipLeadingCone(nSkipCone); if(iPhysicsSelectionFlag)clus->SelectCollisionCandidates(iPhysicsSelectionFlag); if(useOADB) { clus->SetUseTrResolutionFromOADB(); clus->SetUseTrEfficiencyFromOADB(); clus->SetChangeEfficiencyFraction(changeEfficiencyFraction); } mgr->AddTask(clus); // Create ONLY the output containers for the data produced by the task. // Get and connect other common input/output containers via the manager as below //============================================================================== AliAnalysisDataContainer *coutput1_clus = mgr->CreateContainer(Form("cluster_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_cluster_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data())); mgr->ConnectInput (clus, 0, mgr->GetCommonInputContainer()); mgr->ConnectOutput (clus, 0, mgr->GetCommonOutputContainer()); mgr->ConnectOutput (clus, 1, coutput1_clus ); return clus; }
llvm::Value* genTrivialPrimitiveFunctionCall(Function& function, const MethodInfo& methodInfo, PendingResultArray args, llvm::Value* const hintResultValue) { auto& module = function.module(); const auto type = methodInfo.parentType; const auto methodName = methodInfo.name; const auto functionType = methodInfo.functionType; const auto& templateArgs = methodInfo.templateArgs; ConstantGenerator constGen(module); TypeGenerator typeGen(module); switch (type->primitiveID()) { case PrimitiveVoid: return genVoidPrimitiveMethodCall(function, type, methodName, functionType, std::move(args)); case PrimitiveCompareResult: return genCompareResultPrimitiveMethodCall(function, type, methodName, functionType, std::move(args)); case PrimitiveNull: return genNullPrimitiveMethodCall(function, type, methodName, arrayRef(templateArgs), std::move(args), hintResultValue); case PrimitiveBool: return genBoolPrimitiveMethodCall(function, type, methodName, functionType, arrayRef(templateArgs), std::move(args), hintResultValue); case PrimitiveValueLval: return genValueLvalPrimitiveMethodCall(function, type, methodName, functionType, std::move(args), hintResultValue); case PrimitiveFinalLval: return genFinalLvalPrimitiveMethodCall(function, type, methodName, functionType, std::move(args), hintResultValue); case PrimitivePtrLval: return genPtrLvalPrimitiveMethodCall(function, type, methodName, functionType, std::move(args), hintResultValue); case PrimitivePtr: return genPtrPrimitiveMethodCall(function, type, methodName, functionType, std::move(args)); case PrimitiveFunctionPtr: case PrimitiveMethodFunctionPtr: case PrimitiveTemplatedFunctionPtr: case PrimitiveTemplatedMethodFunctionPtr: case PrimitiveVarArgFunctionPtr: case PrimitiveMethod: case PrimitiveTemplatedMethod: case PrimitiveInterfaceMethod: case PrimitiveStaticInterfaceMethod: return genFunctionPtrPrimitiveMethodCall(function, type, methodName, functionType, std::move(args), hintResultValue); case PrimitiveInt8: case PrimitiveInt16: case PrimitiveInt32: case PrimitiveInt64: case PrimitiveByte: case PrimitiveShort: case PrimitiveInt: case PrimitiveLong: case PrimitiveLongLong: case PrimitiveSSize: case PrimitivePtrDiff: return genSignedIntegerPrimitiveMethodCall(function, type, methodName, functionType, arrayRef(templateArgs), std::move(args), hintResultValue); case PrimitiveUInt8: case PrimitiveUInt16: case PrimitiveUInt32: case PrimitiveUInt64: case PrimitiveUByte: case PrimitiveUShort: case PrimitiveUInt: case PrimitiveULong: case PrimitiveULongLong: case PrimitiveSize: return genUnsignedIntegerPrimitiveMethodCall(function, type, methodName, functionType, arrayRef(templateArgs), std::move(args), hintResultValue); case PrimitiveFloat: case PrimitiveDouble: case PrimitiveLongDouble: return genFloatPrimitiveMethodCall(function, type, methodName, functionType, arrayRef(templateArgs), std::move(args), hintResultValue); case PrimitiveTypename: return genTypenamePrimitiveMethodCall(function, type, methodName, functionType, std::move(args)); case PrimitiveRef: return genRefPrimitiveMethodCall(function, type, methodName, functionType, std::move(args), hintResultValue); } const auto& typeName = type->getObjectType()->name().last(); printf("%s\n", typeName.c_str()); llvm_unreachable("Unknown trivial primitive function."); }
AliAnalysisTaskJetHBOM *AddTaskJetHBOM(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,TString effLoc,Int_t fNHBOM, Int_t constCone, Float_t constConePhi,Float_t constConeEta) { //if constCone is true, the random Cone positon is set to constConePhi and constConeEta. Else the cone is random set and the parameters constConePhi and constConeEta are irrelevant // Creates a jet fider task, configures it and adds it to the analysis manager. kPtTrackCutCl = ptTrackCut; kTrackEtaWindowCl = etaTrackWindow; kVertexWindowCl = vertexWindow; TString outputFile(deltaFile); // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskJetHBOM", "No analysis manager to connect to."); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager. //============================================================================== if (!mgr->GetInputEventHandler()) { ::Error("AddTaskJetHBOM", "This task requires an input event handler"); return NULL; } TString type = mgr->GetInputEventHandler()->GetDataType(); TString typeRec(bRec); TString typeGen(bGen); if(!typeRec.Contains("AODextra")) { typeGen.ToUpper(); typeRec.ToUpper(); } cout << "typeRec: " << typeRec << endl; // Create the task and configure it. //=========================================================================== TString cAdd = ""; cAdd += Form("%02d_",(int)((radius+0.01)*10.)); cAdd += Form("B%d",(int)kBackgroundModeCl); cAdd += Form("_Filter%05d",filterMask); cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl)); cAdd += Form("_hbom%02d",fNHBOM); if(constCone){ cAdd += Form("_constConePhi%02dEta%02d",constConePhi,constConeEta); } Printf("%s %E",cAdd.Data(),kPtTrackCutCl); AliAnalysisTaskJetHBOM* hbom = new AliAnalysisTaskJetHBOM(Form("JetHBOM%s_%s%s",bRec,jf,cAdd.Data())); hbom->SetFilterMask(filterMask); // hbom->SetUseGlobalSelection(kTRUE); hbom->SetVtxCuts(kVertexWindowCl,1);//sets fVtxZCut and fVtxR2Cut if(type == "AOD"){ // Assume all jet are produced already hbom->SetAODTrackInput(kTRUE); hbom->SetAODMCInput(kTRUE); } if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCChargedAcceptance); hbom->SetTrackPtCut(kPtTrackCutCl); hbom->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODMC2")){ hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCCharged); hbom->SetTrackPtCut(kPtTrackCutCl); hbom->SetTrackEtaWindow(5); } else if (typeRec.Contains("AODMC")){ hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCAll); hbom->SetTrackPtCut(kPtTrackCutCl); hbom->SetTrackEtaWindow(5); } else if (typeRec.Contains("AODextraonly")) { hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextraonly); hbom->SetTrackPtCut(kPtTrackCutCl); hbom->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AODextra")) { cout << "AliAnalysisTaskJetHBOM::kTrackAODextra: " << AliAnalysisTaskJetHBOM::kTrackAODextra << endl; hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextra); hbom->SetTrackPtCut(kPtTrackCutCl); hbom->SetTrackEtaWindow(kTrackEtaWindowCl); } else if (typeRec.Contains("AOD")) { hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAOD); hbom->SetTrackPtCut(kPtTrackCutCl); hbom->SetTrackEtaWindow(kTrackEtaWindowCl); } hbom->SetRparam(radius); hbom->SetGhostArea(0.005); hbom->SetGhostEtamax(kTrackEtaWindowCl); switch (jf) { case "ANTIKT": hbom->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh break; case "CA": hbom->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh break; case "KT": hbom->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh break; default: ::Error("AddTaskJetHBOM", "Wrong jet finder selected\n"); return 0; } //Constant Cone analysis if(constCone){ hbom->SetRandConePos(constConeEta,constConePhi); } if(kWriteAOD){ if(outputFile.Length())hbom->SetJetOutputFile(outputFile); hbom->SetJetOutputBranch(Form("hbom%s_%s%s",bRec,jf,cAdd.Data())); hbom->SetJetOutputMinPt(0); // store only jets above a certain threshold } //sets number of detector hits hbom->SetfNHBOM(fNHBOM); //physics Selection if(iPhysicsSelectionFlag)hbom->SelectCollisionCandidates(iPhysicsSelectionFlag); mgr->AddTask(hbom); // Create ONLY the output containers for the data produced by the task. // Get and connect other common input/output containers via the manager as below //============================================================================== AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer(Form("hbom_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_hbom_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data())); mgr->ConnectInput (hbom, 0, mgr->GetCommonInputContainer()); mgr->ConnectOutput (hbom, 0, mgr->GetCommonOutputContainer()); mgr->ConnectOutput (hbom, 1, coutput1_Spec ); //loads efficiencies hbom->SetEfficiencyPt(GetEfficiencyPt(effLoc)); hbom->SetEfficiencyPhi(GetEfficiencyPhi(effLoc)); return hbom; }
AliAnalysisTaskJetClusterKine *AddTaskJetClusterKine(char* bGen, Char_t *jf, Float_t radius, Int_t kWriteAOD, char *deltaFile, Float_t ptTrackCut, Float_t etaTrackWindow, Float_t vertexWindow){ // Creates a jet fider task, configures it and adds it to the analysis manager. kPtTrackCutCl = ptTrackCut; kTrackEtaWindowCl = etaTrackWindow; kVertexWindowCl = vertexWindow; TString outputFile(deltaFile); // Get the pointer to the existing analysis manager via the static access method. //============================================================================== AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if(!mgr){ ::Error("AddTaskJetClusterKine", "No analysis manager to connect to."); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager. //============================================================================== if(!mgr->GetMCtruthEventHandler()){ ::Error("AddTaskJetClusterKine", "This task requires an input MC event handler"); return NULL; } TString typeGen(bGen); typeGen.ToUpper(); // Create the task and configure it. //=========================================================================== TString cAdd = ""; cAdd += Form("%02d_",TMath::Nint(radius*10.)); cAdd += Form("Cut%05d",TMath::Nint(1000.*kPtTrackCutCl)); Printf("%s %s%s", typeGen.Data(), jf, cAdd.Data()); AliAnalysisTaskJetClusterKine* clus = new AliAnalysisTaskJetClusterKine(Form("JetCluster%s_%s%s",bGen,jf,cAdd.Data())); // or a config file clus->SetVtxCuts(kVertexWindowCl); if(typeGen.Contains("KINECHARGED")){ clus->SetTrackTypeGen(AliAnalysisTaskJetClusterKine::kTrackKineCharged); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); }else if(typeGen.Contains("KINEFULL")){ clus->SetTrackTypeGen(AliAnalysisTaskJetClusterKine::kTrackKineAll); clus->SetTrackPtCut(kPtTrackCutCl); clus->SetTrackEtaWindow(kTrackEtaWindowCl); } clus->SetRparam(radius); clus->SetGhostArea(0.005); clus->SetGhostEtamax(kTrackEtaWindowCl); clus->SetDebugLevel(0); switch (jf) { case "ANTIKT": clus->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh break; case "CA": clus->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh break; case "KT": clus->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh break; default: ::Error("AddTaskJetClusterKine", "Wrong jet finder selected\n"); return 0; } TString nameOutArray = Form("clusters%s_%s%s",bGen,jf,cAdd.Data()); //FF// if(kWriteAOD){ if(outputFile.Length())clus->SetJetOutputFile(outputFile); Printf("Output branch: %s",nameOutArray.Data());//FF// clus->SetJetOutputBranch(nameOutArray.Data());//FF// clus->SetJetOutputMinPt(0); // store only jets / clusters above a certain threshold } clus->SetJetOutputContainer(kWriteAOD); //0=no output 1=AOD 2=Exchange mgr->AddTask(clus); // Create ONLY the output containers for the data produced by the task. // Get and connect other common input/output containers via the manager as below //============================================================================== AliAnalysisDataContainer *coutput1_clus = mgr->CreateContainer(Form("cluster_%s_%s%s",bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_cluster_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bGen,jf,cAdd.Data())); mgr->ConnectInput (clus, 0, mgr->GetCommonInputContainer()); if(kWriteAOD==1){//FF// mgr->ConnectOutput (clus, 0, mgr->GetCommonOutputContainer()); } mgr->ConnectOutput (clus, 1, coutput1_clus ); if(kWriteAOD==2){//FF// AliAnalysisDataContainer *coutput2_clus = mgr->CreateContainer( nameOutArray.Data(), //?? TClonesArray::Class(), AliAnalysisManager::kExchangeContainer); mgr->ConnectOutput (clus, 2, coutput2_clus); //FF// } return clus; }