void print_decay_channels(int pdgc) { ostringstream pdg_table; pdg_table << gSystem->Getenv("GENIE") << "/data/pdg/genie_pdg_table.txt"; TDatabasePDG * pdglib = TDatabasePDG::Instance(); pdglib->ReadPDGTable(pdg_table.str().c_str()); TParticlePDG * p = pdglib->GetParticle(pdgc); cout << " *** Printing-out decay channels for: " << p->GetName() << endl; double brtot=0; for(int j=0; j<p->NDecayChannels(); j++) { cout << "\t - decay channel id = " << j << ", channel = " << p->GetName() << " --> "; TDecayChannel * dch = p->DecayChannel(j); for(int k=0; k<dch->NDaughters(); k++) { cout << pdglib->GetParticle(dch->DaughterPdgCode(k))->GetName(); if(k < dch->NDaughters() - 1) cout << " + "; }//k cout << ", BR = " << dch->BranchingRatio() << endl; brtot += dch->BranchingRatio(); }//j cout << "Sum{BR} = " << brtot << endl; }
void AddRsnPairsRho(AliAnalysisTaskSE *task, Bool_t isMC, Bool_t isMixing, AliPID::EParticleType pType1, Int_t listID1, AliPID::EParticleType pType2, Int_t listID2, AliRsnCutSet *cutsEvent=0, AliRsnCutSet *cutsPair=0, TString suffix = "") { Printf("id1=%d id2=%d",listID1,listID2); // retrieve mass from PDG database Int_t pdg = 113; TDatabasePDG *db = TDatabasePDG::Instance(); TParticlePDG *part = db->GetParticle(pdg); Double_t mass = part->Mass(); Bool_t valid; Int_t isRsnMini = AliAnalysisManager::GetGlobalInt("rsnUseMiniPackage",valid); if (isRsnMini) { AddPairOutputMiniRho(task,isMC,isMixing,pType1,listID1,pType2,listID2,pdg,mass,cutsPair,suffix); } else { // this function is common and it is located in RsnConfig.C // as ouptup AddPairOutputPhi from this macro will be taken AddPair(task,isMC,isMixing,pType1,listID1,pType2,listID2,pdg,mass,cutsEvent,cutsPair,suffix); } }
void ConvertInput(Int_t event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray) { Int_t particle; Candidate *candidate; TDatabasePDG *pdg; TParticlePDG *pdgParticle; Int_t pdgCode; Int_t pid, status; Double_t px, py, pz, e, mass; Double_t x, y, z, t; pdg = TDatabasePDG::Instance(); for(particle = 0; particle < NPARTICLES; ++particle) { pid = EVENTS[event][particle][0]; status = EVENTS[event][particle][1]; px = EVENTS[event][particle][2]; py = EVENTS[event][particle][3]; pz = EVENTS[event][particle][4]; e = EVENTS[event][particle][5]; mass = EVENTS[event][particle][6]; x = EVENTS[event][particle][7]; y = EVENTS[event][particle][8]; z = EVENTS[event][particle][9]; t = EVENTS[event][particle][10]; candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x, y, z, t); allParticleOutputArray->Add(candidate); if(!pdgParticle) return; if(status == 1) { stableParticleOutputArray->Add(candidate); } else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) { partonOutputArray->Add(candidate); } } }
void CompareMasses() { TString massWidthFile = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName()); massWidthFile.ReplaceAll("CompareMasses.C","mass_width_2008.mc.txt"); FILE* file = fopen(massWidthFile.Data(),"r"); if (!file){ Printf("Could not open PDG particle file %s", massWidthFile.Data()); return; } char c[200]; char cempty; Int_t pdg[4]; Float_t mass, err1, err2, err; Int_t ndiff = 0; while (fgets(c, 200, file)) { if (c[0] != '*' && c[0] !='W') { //printf("%s",c); sscanf(&c[1], "%8d", &pdg[0]); // check emptyness pdg[1] = 0; for(int i = 0;i<8;i++){ sscanf(&c[9+i],"%c",&cempty); if(cempty != ' ')sscanf(&c[9],"%8d",&pdg[1]); } pdg[2] = 0; for(int i = 0;i<8;i++){ sscanf(&c[17+i],"%c",&cempty); if(cempty != ' ')sscanf(&c[17],"%8d",&pdg[2]); } pdg[3] = 0; for(int i = 0;i<8;i++){ sscanf(&c[25+i],"%c",&cempty); if(cempty != ' ')sscanf(&c[25],"%8d",&pdg[3]); } sscanf(&c[35],"%14f",&mass); sscanf(&c[50],"%8f",&err1); sscanf(&c[50],"%8f",&err2); err = TMath::Max((Double_t)err1,(Double_t)-1.*err2); for(int ipdg = 0;ipdg < 4;ipdg++){ if(pdg[ipdg]==0)continue; TParticlePDG *partRoot = TDatabasePDG::Instance()->GetParticle(pdg[ipdg]); if(partRoot){ Float_t massRoot = partRoot->Mass(); Float_t deltaM = TMath::Abs(massRoot - mass); // if(deltaM > err){ if (mass != 0.0 && deltaM/mass>1E-05){ ndiff++; Printf("%10s %8d pdg mass %E pdg err %E root Mass %E >> deltaM %E = %3.3f%%",partRoot->GetName(),pdg[ipdg],mass,err,massRoot,deltaM,100.*deltaM/mass); } } } } }// while fclose(file); if (ndiff == 0) Printf("Crongratulations !! All particles in ROOT and PDG have identical masses"); }
void AddPairOutputMiniRho(AliAnalysisTaskSE *task, Bool_t isMC,Bool_t isMixing, AliPID::EParticleType pType1,Int_t listID1, AliPID::EParticleType pType2,Int_t listID2, Int_t pdgMother,Double_t massMother, AliRsnCutSet *cutsPair=0,TString suffix = "") { Bool_t valid; Int_t isFullOutput = AliAnalysisManager::GetGlobalInt("rsnOutputFull",valid); Int_t useMixing = AliAnalysisManager::GetGlobalInt("rsnUseMixing",valid); Int_t isPP = AliAnalysisManager::GetGlobalInt("rsnIsPP",valid); AliRsnMiniAnalysisTask *taskRsnMini = (AliRsnMiniAnalysisTask *)task; /* invariant mass */ Int_t imID = taskRsnMini->CreateValue(AliRsnMiniValue::kInvMass, kFALSE); /* IM resolution */ Int_t resID = taskRsnMini->CreateValue(AliRsnMiniValue::kInvMassDiff, kTRUE); /* transv. momentum */ Int_t ptID = taskRsnMini->CreateValue(AliRsnMiniValue::kPt, kFALSE); /* centrality */ Int_t centID = taskRsnMini->CreateValue(AliRsnMiniValue::kMult, kFALSE); /* eta */ Int_t etaID = taskRsnMini->CreateValue(AliRsnMiniValue::kEta, kFALSE); // use an array for more compact writing, which are different on mixing and charges // [0] = unlike // [1] = mixing // [2] = like ++ // [3] = like -- Bool_t use [5] = { 1 , useMixing , 1 , 1 , isMC }; TString name [5] = {"Unlike", "Mixing", "LikePP", "LikeMM", "Trues"}; TString comp [5] = {"PAIR" , "MIX" , "PAIR" , "PAIR" , "TRUE" }; Char_t charge1 [5] = {'+' , '+' , '+' , '-' , '+' }; Char_t charge2 [5] = {'-' , '-' , '+' , '-' , '-' }; // common definitions TString outputType = "HIST"; if (isFullOutput) outputType = "SPARSE"; Int_t nIM = 1000; Double_t minIM = 0.2, maxIM = 1.2; Int_t nEta = 400; Double_t minEta = -2.0, maxEta = 2.0; // Int_t nIM = 1000; Double_t minIM = 0.9, maxIM = 1.9; Int_t nPt = 120; Double_t minPt = 0.0, maxPt = 12.0; Int_t nCent = 100; Double_t minCent = 0.0, maxCent = 100.0; Int_t nRes = 200; Double_t maxRes = 0.01; // retrieve mass from PDG database Int_t pdg = 113; TDatabasePDG *db = TDatabasePDG::Instance(); TParticlePDG *part = db->GetParticle(pdg); Printf(suffix.Data()); // create standard outputs for (Int_t i = 0; i < 5; i++) { if (!use[i]) continue; // create output AliRsnMiniOutput *out = taskRsnMini->CreateOutput(Form("%s_%s", suffix.Data(),name[i].Data() ), outputType.Data(), comp[i].Data()); // selection settings out->SetCutID(0, listID1); out->SetCutID(1, listID1); out->SetDaughter(0, AliRsnDaughter::kPion); out->SetDaughter(1, AliRsnDaughter::kPion); out->SetCharge(0, charge1[i]); out->SetCharge(1, charge2[i]); out->SetMotherPDG(pdg); out->SetMotherMass(part->Mass()); // pair cuts if (cutsPair) out->SetPairCuts(cutsPair); // axis X: invmass out->AddAxis(imID, nIM, minIM, maxIM); if (isFullOutput) { // axis Y: transverse momentum out->AddAxis(ptID, nPt, minPt, maxPt); out->AddAxis(etaID, nEta, minEta, maxEta); // axis Z: centrality if (!isPP) out->AddAxis(centID, nCent, minCent, maxCent); } } // add output for resolution if (isMC) { AliRsnMiniOutput *outRes = taskRsnMini->CreateOutput(Form("rho_Res%s", suffix.Data()), outputType.Data(), "TRUE"); // selection settings outRes->SetCutID(0, listID1); outRes->SetCutID(1, listID1); outRes->SetDaughter(0, AliRsnDaughter::kPion); outRes->SetDaughter(1, AliRsnDaughter::kPion); outRes->SetCharge(0, '+'); outRes->SetCharge(1, '-'); outRes->SetMotherPDG(pdg); outRes->SetMotherMass(part->Mass()); // pair cuts if (cutsPair) outRes->SetPairCuts(cutsPair); // axis X: resolution outRes->AddAxis(resID, nRes, -maxRes, maxRes); if (isFullOutput) { // axis Y: transverse momentum outRes->AddAxis(ptID, nPt, minPt, maxPt); outRes->AddAxis(etaID, nEta, minEta, maxEta); // axis Z: centrality if (!isPP) outRes->AddAxis(centID, nCent, minCent, maxCent); } } // // -- Create output for MC generated ------------------------------------------------------------ // if (isMC) { // create ouput AliRsnMiniOutput *outMC = taskRsnMini->CreateOutput(Form("rho_MCGen%s", suffix.Data()), outputType.Data(), "MOTHER"); // selection settings outMC->SetDaughter(0, AliRsnDaughter::kPion); outMC->SetDaughter(1, AliRsnDaughter::kPion); outMC->SetMotherPDG(pdg); outMC->SetMotherMass(part->Mass()); // pair cuts if (cutsPair) outMC->SetPairCuts(cutsPair); // axis X: invmass outMC->AddAxis(imID, nIM, minIM, maxIM); if (isFullOutput) { // axis Y: transverse momentum outMC->AddAxis(ptID, nPt, minPt, maxPt); outMC->AddAxis(etaID, nEta, minEta, maxEta); // axis Z: centrality if (!isPP) outMC->AddAxis(centID, nCent, minCent, maxCent); } } }
Bool_t ConfigPhiPP5TeV( AliRsnMiniAnalysisTask *task, Bool_t isMC, Bool_t isPP, const char *suffix, AliRsnCutSet *cutsPair, Int_t Strcut = 2011, Int_t customQualityCutsID = AliRsnCutSetDaughterParticle::kDisableCustom, AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate=AliRsnCutSetDaughterParticle::kTPCpidTOFveto3s, Float_t nsigmaK = 3.0, Bool_t enableMonitor = kTRUE ) { //These are the Default values for 2011 ESD track cuts AliPID::EParticleType type2 = AliPID::kKaon; // manage suffix if (strlen(suffix) > 0) suffix = Form("_%s", suffix); // retrieve mass from PDG database Int_t pdg = 333; TDatabasePDG *db = TDatabasePDG::Instance(); TParticlePDG *part = db->GetParticle(pdg); Double_t mass = part->Mass(); Float_t nsigmaKTPC=fmod(nsigmaK,1000.); Float_t nsigmaKTOF=(nsigmaK-fmod(nsigmaK,1000.))/1000.; if(nsigmaKTOF<1.e-10) nsigmaKTOF=-1.; // set daughter cuts AliRsnCutSetDaughterParticle* cutSetK; AliRsnCutTrackQuality* trkQualityCut= new AliRsnCutTrackQuality("myQualityCut"); if(!trkQualityCut) return kFALSE; if(SetCustomQualityCut(trkQualityCut,customQualityCutsID,Strcut)){ cutSetK=new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutKaCandidate, nsigmaK),trkQualityCut,cutKaCandidate,AliPID::kKaon,nsigmaKTPC,nsigmaKTOF); } else{ printf("Doughter Track cuts has been selected =================\n"); return kFALSE; } Int_t iCutK = task->AddTrackCuts(cutSetK); if(enableMonitor){ Printf("======== Monitoring cut AliRsnCutSetDaughterParticle enabled"); gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/RESONANCES/macros/mini/AddMonitorOutput.C"); AddMonitorOutput(isMC, cutSetK->GetMonitorOutput()); } // -- Values ------------------------------------------------------------------------------------ /* invariant mass */ Int_t imID = task->CreateValue(AliRsnMiniValue::kInvMass, kFALSE); /* IM resolution */ Int_t resID = task->CreateValue(AliRsnMiniValue::kInvMassRes, kTRUE); /* transv. momentum */ Int_t ptID = task->CreateValue(AliRsnMiniValue::kPt, kFALSE); /* centrality */ Int_t centID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE); /* pseudorapidity */ Int_t etaID = task->CreateValue(AliRsnMiniValue::kEta, kFALSE); /* rapidity */ Int_t yID = task->CreateValue(AliRsnMiniValue::kY, kFALSE); // -- Create all needed outputs ----------------------------------------------------------------- // use an array for more compact writing, which are different on mixing and charges // [0] = unlike // [1] = mixing // [2] = like ++ // [3] = like -- Bool_t use [7] = {1 ,1 ,1 ,1 ,isMC ,isMC ,isMC }; Bool_t useIM [7] = {1 ,1 ,1 ,1 ,1 ,1 ,0 }; TString name [7] = {"Unlike" ,"Mixing" ,"LikePP" ,"LikeMM" ,"MCGen" ,"Trues", ,"ResMP" }; TString comp [7] = {"PAIR" ,"MIX" ,"PAIR" ,"PAIR" ,"MOTHER" ,"TRUE" ,"TRUE" }; TString output [7] = {"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE"}; Char_t charge1 [7] = {'+' ,'+' ,'+' ,'-' ,'+' ,'+' ,'+' }; Char_t charge2 [7] = {'-' ,'-' ,'+' ,'-' ,'-' ,'-' ,'-' }; Int_t cutIDK [7] = {iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK }; Int_t PDGCode [7] = {333 ,333 ,333 ,333 ,333 ,333 ,333 }; for (Int_t i = 0; i < 7; i++) { if (!use[i]) continue; AliRsnMiniOutput *out = task->CreateOutput(Form("PHI_%s%s", name[i].Data(), suffix), output[i].Data(), comp[i].Data()); out->SetDaughter(0, AliRsnDaughter::kKaon); out->SetDaughter(1, AliRsnDaughter::kKaon); out->SetCutID(0, cutIDK[i]); out->SetCutID(1, cutIDK[i]); out->SetCharge(0, charge1[i]); out->SetCharge(1, charge2[i]); out->SetMotherPDG(PDGCode[i]); out->SetMotherMass(mass); out->SetPairCuts(cutsPair); // axis X: invmass (or resolution) if (useIM[i]) out->AddAxis(imID, 250, 0.95, 1.2); else out->AddAxis(resID, 200, -0.02, 0.02); // axis Y: transverse momentum out->AddAxis(ptID, 500, 0.0, 50.0); // axis Z: centrality-multiplicity if (!isPP) out->AddAxis(centID, 100, 0.0, 100.0); else out->AddAxis(centID, 400, 0.0, 400.0); // axis W: pseudorapidity // out->AddAxis(etaID, 20, -1.0, 1.0); // axis J: rapidity //out->AddAxis(yID, 90, -4.5, 4.5); } return kTRUE; } Bool_t SetCustomQualityCut(AliRsnCutTrackQuality * trkQualityCut, Int_t customQualityCutsID = 0,Int_t trCut = 2011) { //Sets configuration for track quality object different from std quality cuts. //Returns kTRUE if track quality cut object is successfully defined, //returns kFALSE if an invalid set of cuts (customQualityCutsID) is chosen or if the //object to be configured does not exist. if ((!trkQualityCut)){ Printf("::::: SetCustomQualityCut:: use default quality cuts specified in task configuration."); return kFALSE; } if(customQualityCutsID>=1 && customQualityCutsID<100 && customQualityCutsID!=2){ if(trCut == 2011){ trkQualityCut->SetDefaults2011(kTRUE,kTRUE); Printf(Form("::::: SetCustomQualityCut:: using standard 2011 track quality cuts")); } else if(trCut == 2015){ trkQualityCut->SetDefaults2011(kTRUE,kTRUE); trkQualityCut->GetESDtrackCuts()->SetCutGeoNcrNcl(3., 130., 1.5, 0.85, 0.7); Printf(Form("::::: SetCustomQualityCut:: using standard 2015 track quality cuts")); } if(customQualityCutsID==3){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexXYPtDep("0.015+0.05/pt^1.1");}//10Sig // D = 7*(0.0015+0.0050/pt^1.1) else if(customQualityCutsID==4){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexXYPtDep("0.006+0.02/pt^1.1");}//4Sig else if(customQualityCutsID==5){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexZ(3.);}// D = 2. else if(customQualityCutsID==6){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexZ(1.);} else if(customQualityCutsID==7){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexZ(0.2);} else if(customQualityCutsID==8){trkQualityCut->GetESDtrackCuts()->SetMaxChi2PerClusterTPC(5.);}// D = 4 else if(customQualityCutsID==9){trkQualityCut->GetESDtrackCuts()->SetMaxChi2PerClusterTPC(3);} else if(customQualityCutsID==10){trkQualityCut->GetESDtrackCuts()->SetMinNCrossedRowsTPC(60);}// D = 70 else if(customQualityCutsID==11){trkQualityCut->GetESDtrackCuts()->SetMinNCrossedRowsTPC(80);} else if(customQualityCutsID==12){trkQualityCut->GetESDtrackCuts()->SetMinNCrossedRowsTPC(100);} else if(customQualityCutsID==13){trkQualityCut->GetESDtrackCuts()->SetMinRatioCrossedRowsOverFindableClustersTPC(0.7);}// D = 8 else if(customQualityCutsID==14){trkQualityCut->GetESDtrackCuts()->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);} else if(customQualityCutsID==15){trkQualityCut->GetESDtrackCuts()->SetMaxChi2PerClusterITS(49.);}// D = 36 else if(customQualityCutsID==16){trkQualityCut->GetESDtrackCuts()->SetMaxChi2PerClusterITS(25.);} else if(customQualityCutsID==17){trkQualityCut->GetESDtrackCuts()->SetMaxChi2TPCConstrainedGlobal(49.);}// D = 36 else if(customQualityCutsID==18){trkQualityCut->GetESDtrackCuts()->SetMaxChi2TPCConstrainedGlobal(25.);} else if(customQualityCutsID==19){trkQualityCut->GetESDtrackCuts()->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff);} trkQualityCut->Print(); return kTRUE; }else if(customQualityCutsID==2 || (customQualityCutsID>=100 && customQualityCutsID<200)){ trkQualityCut->SetDefaultsTPCOnly(kTRUE); Printf(Form("::::: SetCustomQualityCut:: using TPC-only track quality cuts")); if(customQualityCutsID==103){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexXY(3.);} else if(customQualityCutsID==104){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexXY(1.);} else if(customQualityCutsID==105){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexZ(4.);} else if(customQualityCutsID==106){trkQualityCut->GetESDtrackCuts()->SetMaxDCAToVertexZ(1.);} else if(customQualityCutsID==107){trkQualityCut->GetESDtrackCuts()->SetMaxChi2PerClusterTPC(7.);} else if(customQualityCutsID==108){trkQualityCut->GetESDtrackCuts()->SetMaxChi2PerClusterTPC(2.5);} else if(customQualityCutsID==109){trkQualityCut->GetESDtrackCuts()->SetMinNClustersTPC(30);} else if(customQualityCutsID==110){trkQualityCut->GetESDtrackCuts()->SetMinNClustersTPC(85);} trkQualityCut->Print(); return kTRUE; }else{ Printf("::::: SetCustomQualityCut:: use default quality cuts specified in task configuration."); return kFALSE; } trkQualityCut->SetPtRange(0.15, 100000.0); trkQualityCut->SetEtaRange(-0.8, 0.8); Printf(Form("::::: SetCustomQualityCut:: using custom track quality cuts #%i",customQualityCutsID)); trkQualityCut->Print(); return kTRUE; }
/** @ingroup FMD_xsec_script @param scale @param filename @param var @param medName @param thick @param pdgName */ void DrawXsection(Bool_t scale=kFALSE, const char* filename="xsec.root", const char* var="LOSS", const char* medName="FMD_Si$", Double_t thick=.03, const char* pdgName="pi+") { TFile* file = TFile::Open(filename, "READ"); TTree* tree = static_cast<TTree*>(file->Get(Form("%s_%s",medName, pdgName))); TLeaf* tb = tree->GetLeaf("T"); TLeaf* vb = tree->GetLeaf(var); if (!vb) { std::cerr << "Leaf " << var << " not found" << std::endl; return; } Float_t tkine, value; tb->SetAddress(&tkine); vb->SetAddress(&value); Int_t n = tree->GetEntries(); Float_t xscale = 1; Float_t yscale = 1; if (scale) { TDatabasePDG* pdgDb = TDatabasePDG::Instance(); TParticlePDG* pdgP = pdgDb->GetParticle(pdgName); if (!pdgP) { std::cerr << "Couldn't find particle " << pdgName << std::endl; return; } Double_t m = pdgP->Mass(); Double_t q = pdgP->Charge() / 3; if (m == 0 || q == 0) { std::cerr << "Mass is 0" << std::endl; return; } xscale = 1 / m; yscale = 1 / (q * q); } TGraphErrors* graph = new TGraphErrors(n); for (Int_t i = 0; i < n; i++) { tree->GetEntry(i); Double_t x = tkine*xscale; Double_t y = value*yscale; graph->SetPoint(i, x, y); // 5 sigma graph->SetPointError(i, 0, 5 * .1 * y); } TCanvas* c = new TCanvas("c","c"); c->SetLogx(); c->SetLogy(); graph->SetLineWidth(2); graph->SetFillStyle(3001); graph->SetFillColor(6); graph->Draw("L"); graph->DrawClone("AL3"); c->Modified(); c->Update(); c->cd(); c->SaveAs("xsec.C"); }
void ConvertInput(Long64_t eventCounter, Pythia8::Pythia *pythia, ExRootTreeBranch *branch, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, TStopwatch *readStopWatch, TStopwatch *procStopWatch) { int i; HepMCEvent *element; Candidate *candidate; TDatabasePDG *pdg; TParticlePDG *pdgParticle; Int_t pdgCode; Int_t pid, status; Double_t px, py, pz, e, mass; Double_t x, y, z, t; // event information element = static_cast<HepMCEvent *>(branch->NewEntry()); element->EventNumber = eventCounter; element->ProcessID = pythia->info.code(); element->MPI = 1; element->Weight = pythia->info.weight(); element->Scale = pythia->info.QRen(); element->AlphaQED = pythia->info.alphaEM(); element->AlphaQCD = pythia->info.alphaS(); element->ID1 = pythia->info.id1(); element->ID2 = pythia->info.id2(); element->X1 = pythia->info.x1(); element->X2 = pythia->info.x2(); element->ScalePDF = pythia->info.QFac(); element->PDF1 = pythia->info.pdf1(); element->PDF2 = pythia->info.pdf2(); element->ReadTime = readStopWatch->RealTime(); element->ProcTime = procStopWatch->RealTime(); pdg = TDatabasePDG::Instance(); for(i = 0; i < pythia->event.size(); ++i) { Pythia8::Particle &particle = pythia->event[i]; pid = particle.id(); status = pythia->event.statusHepMC(i); px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.e(); mass = particle.m(); x = particle.xProd(); y = particle.yProd(); z = particle.zProd(); t = particle.tProd(); candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; candidate->M1 = particle.mother1() - 1; candidate->M2 = particle.mother2() - 1; candidate->D1 = particle.daughter1() - 1; candidate->D2 = particle.daughter2() - 1; pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x, y, z, t); allParticleOutputArray->Add(candidate); if(!pdgParticle) continue; if(status == 1) { stableParticleOutputArray->Add(candidate); } else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) { partonOutputArray->Add(candidate); } } }
Bool_t ConfigPhiMassStudy ( AliRsnMiniAnalysisTask *task, Bool_t isMC, Bool_t isPP, const char *suffix, AliRsnCutSet *cutsPair, Int_t aodFilterBit = 5, AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kFastTPCpidNsigma, Float_t nsigmaKa = 2.0, Bool_t enableTrkSyst = kFALSE, Char_t DCAxyFormula[100] = "0.0105+0.035/pt^1.01", Double_t dcazmax = 3.2, Double_t minNcls = 70, Double_t maxX2cls = 4.0, Double_t globalX2cls = 36.0, Double_t minCrossedRows = 50.0, Double_t maxClsCrossedRows = 0.8, Bool_t enableMonitor = kTRUE, Bool_t IsMcTrueOnly = kFALSE, Int_t signedPdg = 333, TString monitorOpt = "", //Flag for AddMonitorOutput.C e.g."NoSIGN" Bool_t useCrossedRows = kFALSE, const char* yaxisVar = "PtDaughter_PDaughter_cent", //yaxisVar = "PtDaughter_PDaughter_cent" Bool_t useMixLS = 0 ) { TString opt(yaxisVar); opt.ToUpper(); Bool_t isPtDaughter = opt.Contains("PTDAUGHTER") ; Bool_t isPDaughter = opt.Contains("PDAUGHTER") ; Bool_t iscent = opt.Contains("CENT") ; Bool_t iseta = opt.Contains("ETA") ; Bool_t israpidity = opt.Contains("RAPIDITY") ; // manage suffix if (strlen(suffix) > 0) suffix = Form("_%s", suffix); // set daughter cuts AliRsnCutSetDaughterParticle * cutSetQ; AliRsnCutSetDaughterParticle * cutSetK; //vary track quality cuts for systematic checks if(enableTrkSyst){ AliRsnCutTrackQuality * trkQualityCut = new AliRsnCutTrackQuality("QualityCut"); trkQualityCut->SetAODTestFilterBit(aodFilterBit);//reset the filter bit cut trkQualityCut->SetCheckOnlyFilterBit(kFALSE);//tells the cut object to check all other cuts individually, trkQualityCut->SetDCARPtFormula(DCAxyFormula); trkQualityCut->SetDCAZmax(dcazmax); if(useCrossedRows) { trkQualityCut->SetMinNCrossedRowsTPC(minCrossedRows, kTRUE); trkQualityCut->SetMinNCrossedRowsOverFindableClsTPC(maxClsCrossedRows, kTRUE); } else trkQualityCut->SetTPCminNClusters(minNcls); trkQualityCut->SetTPCmaxChi2(maxX2cls); trkQualityCut->SetITSmaxChi2(36); // In Filter bit trkQualityCut->SetMaxChi2TPCConstrainedGlobal(globalX2cls); // In the Filterbit trkQualityCut->SetPtRange(0.15, 20.0); trkQualityCut->SetEtaRange(-0.8, 0.8); trkQualityCut->Print(); if(isPP) { cutSetQ = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), trkQualityCut, AliRsnCutSetDaughterParticle::kQualityStd2010, AliPID::kPion, -1.0); cutSetK = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutKaCandidate, nsigmaKa), trkQualityCut, cutKaCandidate, AliPID::kKaon, nsigmaKa); } else { cutSetQ = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), trkQualityCut, AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0); cutSetK = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutKaCandidate, nsigmaKa), trkQualityCut, cutKaCandidate, AliPID::kKaon, nsigmaKa); cutSetK->SetUse2011StdQualityCuts(kTRUE); } } else { //default cuts 2010 for pp and 2011 for p-Pb if(isPP) { cutSetQ = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2010, AliPID::kPion, -1.0, aodFilterBit, kFALSE); cutSetK = new AliRsnCutSetDaughterParticle(Form("cutKaon_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit, kFALSE); } else { cutSetQ = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kFALSE); cutSetQ->SetUse2011StdQualityCuts(kTRUE); cutSetK = new AliRsnCutSetDaughterParticle(Form("cutKaon2011_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit, kFALSE); cutSetK->SetUse2011StdQualityCuts(kTRUE); } } Int_t iCutQ = task->AddTrackCuts(cutSetQ); Int_t iCutK = task->AddTrackCuts(cutSetK); if (enableMonitor){ Printf("======== Cut monitoring enabled"); gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/RESONANCES/macros/mini/AddMonitorOutput.C"); AddMonitorOutput(isMC, cutSetQ->GetMonitorOutput(), monitorOpt.Data()); AddMonitorOutput(isMC, cutSetK->GetMonitorOutput(), monitorOpt.Data()); } Int_t pdg = signedPdg; TDatabasePDG *db = TDatabasePDG::Instance(); TParticlePDG *part = db->GetParticle(pdg); Double_t mass = part->Mass(); // -- Values ------------------------------------------------------------------------------------ /* invariant mass */ Int_t imID = task->CreateValue(AliRsnMiniValue::kInvMass, kFALSE); /* IM resolution */ Int_t resID = task->CreateValue(AliRsnMiniValue::kInvMassRes, kTRUE); /* transv. momentum */ Int_t ptID = task->CreateValue(AliRsnMiniValue::kPt, kFALSE); /* centrality */ Int_t centID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE); /* pseudorapidity */ Int_t etaID = task->CreateValue(AliRsnMiniValue::kEta, kFALSE); /* rapidity */ Int_t yID = task->CreateValue(AliRsnMiniValue::kY, kFALSE); /* 1st daughter pt */ Int_t fdpt = task->CreateValue(AliRsnMiniValue::kFirstDaughterPt, kFALSE); /* 2nd daughter pt */ Int_t sdpt = task->CreateValue(AliRsnMiniValue::kSecondDaughterPt, kFALSE); /* 1st daughter p */ Int_t fdp = task->CreateValue(AliRsnMiniValue::kFirstDaughterP, kFALSE); /* 2nd daughter p */ Int_t sdp = task->CreateValue(AliRsnMiniValue::kSecondDaughterP, kFALSE); /* transv. momentum */ Int_t ptIDmc = task->CreateValue(AliRsnMiniValue::kPt, kTRUE); /* 1st daughter pt */ Int_t fdptmc = task->CreateValue(AliRsnMiniValue::kFirstDaughterPt, kTRUE); /* 2nd daughter pt */ Int_t sdptmc = task->CreateValue(AliRsnMiniValue::kSecondDaughterPt, kTRUE); // -- Create all needed outputs ----------------------------------------------------------------- // use an array for more compact writing, which are different on mixing and charges // [0] = unlike // [1] = mixing // [2] = like ++ // [3] = like -- Bool_t use [12] = { !IsMcTrueOnly, !IsMcTrueOnly, !IsMcTrueOnly,!IsMcTrueOnly,!IsMcTrueOnly,!IsMcTrueOnly, isMC , isMC , isMC , isMC , useMixLS , useMixLS}; Bool_t useIM [12] = { 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 }; TString name [12] = {"UnlikePM" , "UnlikeMP" , "MixingPM" , "MixingMP" , "LikePP" , "LikeMM" ,"TruesPM","TruesMP","ResPM" ,"ResMP" ,"MixingPP","MixingMM"}; TString comp [12] = {"PAIR" , "PAIR" , "MIX" , "MIX" , "PAIR" , "PAIR" , "TRUE" , "TRUE" , "TRUE" , "TRUE" , "MIX" ,"MIX" }; TString output [12] = {"SPARSE" , "SPARSE" , "SPARSE" , "SPARSE" , "SPARSE" , "SPARSE" , "SPARSE","SPARSE" ,"SPARSE","SPARSE","SPARSE" ,"SPARSE"}; Char_t charge1 [12] = {'+' , '-' , '+' , '-' , '+' , '-' , '+' , '-' , '+' , '-' , '+' , '-' }; Char_t charge2 [12] = {'-' , '+' , '-' , '+' , '+' , '-' , '-' , '+' , '-' , '+' ,'+' , '-' }; Int_t cutID1 [12] = { iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK }; Int_t cutID2 [12] = { iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK , iCutK }; //TString output [10] = {"HIST" , "HIST" , "HIST" , "HIST" , "HIST" , "HIST" , "HIST" , "HIST" , "HIST" , "HIST" }; for (Int_t i = 0; i < 12; i++) { if (!use[i]) continue; AliRsnMiniOutput *out = task->CreateOutput(Form("Phi_%s%s", name[i].Data(), suffix), output[i].Data(), comp[i].Data()); out->SetCutID(0, cutID1[i]); out->SetCutID(1, cutID2[i]); out->SetDaughter(0, AliRsnDaughter::kKaon); out->SetDaughter(1, AliRsnDaughter::kKaon); out->SetCharge(0, charge1[i]); out->SetCharge(1, charge2[i]); out->SetMotherPDG(pdg); out->SetMotherMass(mass); out->SetPairCuts(cutsPair); // axis X: invmass (or resolution) if (useIM[i]) out->AddAxis(imID, 800, 0.8, 1.6); else out->AddAxis(resID, 200, -0.02, 0.02); // axis Y: transverse momentum of pair as default - else chosen value out->AddAxis(ptID, 100, 0.0, 10.0); //default use mother pt if(isPtDaughter) { out->AddAxis(fdpt, 100, 0.0, 10.0); out->AddAxis(sdpt, 100, 0.0, 10.0); } if(isPDaughter) { out->AddAxis(fdp, 100, 0.0, 10.0); out->AddAxis(sdp, 100, 0.0, 10.0); } // axis Z: centrality-multiplicity if(iscent) { if (!isPP) out->AddAxis(centID, 100, 0.0, 100.0); else out->AddAxis(centID, 400, 0.0, 400.0); } // axis W: pseudorapidity if(iseta) out->AddAxis(etaID, 20, -1.0, 1.0); // axis J: rapidity if(israpidity) out->AddAxis(yID, 12, -0.6, 0.6); } if (isMC){ // create output AliRsnMiniOutput *outm = task->CreateOutput(Form("Phi_Mother%s", suffix), "SPARSE", "MOTHER"); outm->SetDaughter(0, AliRsnDaughter::kKaon); outm->SetDaughter(1, AliRsnDaughter::kKaon); outm->SetMotherPDG(pdg); outm->SetMotherMass(mass); // pair cuts outm->SetPairCuts(cutsPair); // binnings outm->AddAxis(imID, 800, 0.8, 1.6); // axis Y: transverse momentum of pair as default - else chosen value outm->AddAxis(ptID, 100, 0.0, 10.0); //default use mother pt if(isPtDaughter) { outm->AddAxis(fdpt, 100, 0.0, 10.0); outm->AddAxis(sdpt, 100, 0.0, 10.0); } if(isPDaughter) { outm->AddAxis(fdp, 100, 0.0, 10.0); outm->AddAxis(sdp, 100, 0.0, 10.0); } if(iscent) { if (!isPP) outm->AddAxis(centID, 100, 0.0, 100.0); else outm->AddAxis(centID, 400, 0.0, 400.0); } // axis W: pseudorapidity if(iseta) outm->AddAxis(etaID, 20, -1.0, 1.0); // axis J: rapidity if(israpidity) outm->AddAxis(yID, 12, -0.6, 0.6); //create plot for generated Pt of mother vs generated Pt of daughters AliRsnMiniOutput *outPtGen = task->CreateOutput(Form("Phi_Mother_GenPt_%s", suffix), "SPARSE", "MOTHER"); outPtGen->SetDaughter(0, AliRsnDaughter::kKaon); outPtGen->SetDaughter(1, AliRsnDaughter::kKaon); outPtGen->SetMotherPDG(pdg); outPtGen->SetMotherMass(mass); // pair cuts outPtGen->SetPairCuts(cutsPair); // binnings outPtGen->AddAxis(ptIDmc, 100, 0.0, 10.0); //mother pt - generated outPtGen->AddAxis(fdptmc, 100, 0.0, 10.0); //first daughter pt - generated outPtGen->AddAxis(sdptmc, 100, 0.0, 10.0); //second daughter pt - generated //create plot for reconstructed Pt of true mother vs generated Pt of daughters AliRsnMiniOutput *outPtTrueGen = task->CreateOutput(Form("Phi_True_GenPt_%s", suffix), "SPARSE", "TRUE"); outPtTrueGen->SetDaughter(0, AliRsnDaughter::kKaon); outPtTrueGen->SetDaughter(1, AliRsnDaughter::kKaon); outPtTrueGen->SetCutID(0, iCutK); outPtTrueGen->SetCutID(1, iCutK); outPtTrueGen->SetCharge(0, '+'); outPtTrueGen->SetCharge(1, '-'); outPtTrueGen->SetMotherPDG(pdg); outPtTrueGen->SetMotherMass(mass); // pair cuts outPtTrueGen->SetPairCuts(cutsPair); // binnings outPtTrueGen->AddAxis(ptID, 100, 0.0, 10.0); //true pt - generated outPtTrueGen->AddAxis(fdptmc, 100, 0.0, 10.0); //first daughter pt - generated outPtTrueGen->AddAxis(sdptmc, 100, 0.0, 10.0); //second daughter pt - generated //create plot for reconstructed Pt of true mother vs reconstructed Pt of daughters AliRsnMiniOutput *outPtTrueRec = task->CreateOutput(Form("Phi_True_RecPt_%s", suffix), "SPARSE", "TRUE"); outPtTrueRec->SetDaughter(0, AliRsnDaughter::kKaon); outPtTrueRec->SetDaughter(1, AliRsnDaughter::kKaon); outPtTrueRec->SetCutID(0, iCutK); outPtTrueRec->SetCutID(1, iCutK); outPtTrueRec->SetCharge(0, '+'); outPtTrueRec->SetCharge(1, '-'); outPtTrueRec->SetMotherPDG(pdg); outPtTrueRec->SetMotherMass(mass); // pair cuts outPtTrueRec->SetPairCuts(cutsPair); // binnings outPtTrueRec->AddAxis(ptID, 100, 0.0, 10.0); //mother pt - reconstructed outPtTrueRec->AddAxis(fdpt, 100, 0.0, 10.0); //first daughter pt - reconstructed outPtTrueRec->AddAxis(sdpt, 100, 0.0, 10.0); //second daughter pt - reconstructed } return kTRUE; }
void createGlauberTree(Int_t nEvents, const char *outFileName) { AliPDG::AddParticlesToPdgDataBase(); TDatabasePDG::Instance(); // Run loader TFolder *folder = new TFolder("myfolder","myfolder"); AliRunLoader* rl = new AliRunLoader(folder); rl->MakeHeader(); rl->MakeStack(); AliStack* stack = rl->Stack(); //AliHeader* rheader = rl->GetHeader(); AliGenHijing *genHi = new AliGenHijing(-1); genHi->SetStack(stack); genHi->SetEnergyCMS(2760); genHi->SetReferenceFrame("CMS"); genHi->SetProjectile("A", 208, 82); genHi->SetTarget ("A", 208, 82); genHi->SetPtHardMin (2.3); genHi->SetImpactParameterRange(0.,30); genHi->SetJetQuenching(0); // enable jet quenching genHi->SetShadowing(1); // enable shadowing genHi->SetDecaysOff(1); // neutral pion and heavy particle decays switched off genHi->Init(); MyHeader *myheader = new MyHeader; MyResponse *myresp = new MyResponse; TFile *outFile = TFile::Open(outFileName, "RECREATE"); outFile->SetCompressionLevel(5); TDirectory::TContext context(outFile); TTree *tree = new TTree("glaubertree", "Glauber tree"); tree->Branch("header",&myheader, 32*1024, 99); tree->Branch("response",&myresp, 32*1024, 99); TNtuple *ntuple = new TNtuple("gnt", "Glauber ntuple", "npart:ncoll:b"); Double_t etas[] = {-10,-5,-4,-3,-2,-1,0,1,2,3,4,5,10}; TH1D *hNEta = new TH1D("hNeta","",12,etas); TH1D *hEtEta = new TH1D("hEteta","",12,etas); // create events and fill them for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) { cout << "Event " << iEvent+1 << "/" << nEvents << endl;; stack->Reset(); hNEta->Reset(); hEtEta->Reset(); genHi->Generate(); AliStack *s = genHi->GetStack(); const TObjArray *parts = s->Particles(); Int_t nents = parts->GetEntries(); for (Int_t i = 0; i<nents; ++i) { TParticle *p = (TParticle*)parts->At(i); //p->Print(); TParticlePDG *pdg = p->GetPDG(1); Int_t c = (Int_t)(TMath::Abs(pdg->Charge())); if (c!=0) { hNEta->Fill(p->Eta()); hEtEta->Fill(p->Eta(),p->Pt()); } } AliGenHijingEventHeader *h = (AliGenHijingEventHeader*)genHi->CollisionGeometry(); myheader->fNATT = nents; myheader->fEATT = h->TotalEnergy(); myheader->fJATT = h->HardScatters(); myheader->fNT = h->TargetParticipants(); myheader->fNP = h->ProjectileParticipants(); myheader->fN00 = h->NwNw(); myheader->fN01 = h->NwN(); myheader->fN10 = h->NNw(); myheader->fN11 = h->NN(); myheader->fBB = h->ImpactParameter(); myheader->fRP = h->ReactionPlaneAngle(); myheader->fPSn = h->ProjSpectatorsn(); myheader->fPSp = h->ProjSpectatorsp(); myheader->fTSn = h->TargSpectatorsn(); myheader->fTSp = h->TargSpectatorsn(); myresp->fEtch0p = hEtEta->GetBinContent(hEtEta->FindBin(0.5)); myresp->fEtch1p = hEtEta->GetBinContent(hEtEta->FindBin(1.5)); myresp->fEtch2p = hEtEta->GetBinContent(hEtEta->FindBin(2.5)); myresp->fEtch3p = hEtEta->GetBinContent(hEtEta->FindBin(3.5)); myresp->fEtch4p = hEtEta->GetBinContent(hEtEta->FindBin(4.5)); myresp->fEtch5p = hEtEta->GetBinContent(hEtEta->FindBin(5.5)); myresp->fEtchrp = hEtEta->GetBinContent(hEtEta->FindBin(10.5)); myresp->fEtch0n = hEtEta->GetBinContent(hEtEta->FindBin(-0.5)); myresp->fEtch1n = hEtEta->GetBinContent(hEtEta->FindBin(-1.5)); myresp->fEtch2n = hEtEta->GetBinContent(hEtEta->FindBin(-2.5)); myresp->fEtch3n = hEtEta->GetBinContent(hEtEta->FindBin(-3.5)); myresp->fEtch4n = hEtEta->GetBinContent(hEtEta->FindBin(-4.5)); myresp->fEtch5n = hEtEta->GetBinContent(hEtEta->FindBin(-5.5)); myresp->fEtchrn = hEtEta->GetBinContent(hEtEta->FindBin(-10.5)); myresp->fNch0p = hNEta->GetBinContent(hNEta->FindBin(0.5)); myresp->fNch1p = hNEta->GetBinContent(hNEta->FindBin(1.5)); myresp->fNch2p = hNEta->GetBinContent(hNEta->FindBin(2.5)); myresp->fNch3p = hNEta->GetBinContent(hNEta->FindBin(3.5)); myresp->fNch4p = hNEta->GetBinContent(hNEta->FindBin(4.5)); myresp->fNch5p = hNEta->GetBinContent(hNEta->FindBin(5.5)); myresp->fNchrp = hNEta->GetBinContent(hNEta->FindBin(10.5)); myresp->fNch0n = hNEta->GetBinContent(hNEta->FindBin(-0.5)); myresp->fNch1n = hNEta->GetBinContent(hNEta->FindBin(-1.5)); myresp->fNch2n = hNEta->GetBinContent(hNEta->FindBin(-2.5)); myresp->fNch3n = hNEta->GetBinContent(hNEta->FindBin(-3.5)); myresp->fNch4n = hNEta->GetBinContent(hNEta->FindBin(-4.5)); myresp->fNch5n = hNEta->GetBinContent(hNEta->FindBin(-5.5)); myresp->fNchrn = hNEta->GetBinContent(hNEta->FindBin(-10.5)); tree->Fill(); if (ntuple) { Int_t np = h->TargetParticipants() + h->ProjectileParticipants(); Int_t nc = h->NwNw() + h->NwN() + h->NNw() + h->NN(); Double_t b = h->ImpactParameter(); ntuple->Fill(np,nc,b); } } // end of event loop tree->Write(); ntuple->Write(); outFile->Close(); }
void ConvertInput(fwlite::Event &event, Long64_t eventCounter, ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray) { fwlite::Handle< GenEventInfoProduct > handleGenEventInfo; fwlite::Handle< LHEEventProduct > handleLHEEvent; fwlite::Handle< vector< reco::GenParticle > > handleParticle; vector< reco::GenParticle >::const_iterator itParticle; vector< const reco::Candidate * > vectorCandidate; vector< const reco::Candidate * >::iterator itCandidate; handleGenEventInfo.getByLabel(event, "generator"); handleLHEEvent.getByLabel(event, "externalLHEProducer"); handleParticle.getByLabel(event, "genParticles"); HepMCEvent *element; Weight *weight; Candidate *candidate; TDatabasePDG *pdg; TParticlePDG *pdgParticle; Int_t pdgCode; Int_t pid, status; Double_t px, py, pz, e, mass; Double_t x, y, z; const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights(); vector< gen::WeightsInfo >::const_iterator itWeightsInfo; element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); element->Number = eventCounter; element->ProcessID = handleGenEventInfo->signalProcessID(); element->MPI = 1; element->Weight = handleGenEventInfo->weight(); element->Scale = handleGenEventInfo->qScale(); element->AlphaQED = handleGenEventInfo->alphaQED(); element->AlphaQCD = handleGenEventInfo->alphaQCD(); element->ID1 = 0; element->ID2 = 0; element->X1 = 0.0; element->X2 = 0.0; element->ScalePDF = 0.0; element->PDF1 = 0.0; element->PDF2 = 0.0; element->ReadTime = 0.0; element->ProcTime = 0.0; for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo) { weight = static_cast<Weight *>(branchRwgt->NewEntry()); weight->Weight = itWeightsInfo->wgt; } pdg = TDatabasePDG::Instance(); for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { vectorCandidate.push_back(&*itParticle); } for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { const reco::GenParticle &particle = *itParticle; pid = particle.pdgId(); status = particle.status(); px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); x = particle.vx(); y = particle.vy(); z = particle.vz(); candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; if(particle.mother()) { itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.mother()); if(itCandidate != vectorCandidate.end()) candidate->M1 = distance(vectorCandidate.begin(), itCandidate); } itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0)); if(itCandidate != vectorCandidate.end()) candidate->D1 = distance(vectorCandidate.begin(), itCandidate); itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(particle.numberOfDaughters() - 1)); if(itCandidate != vectorCandidate.end()) candidate->D2 = distance(vectorCandidate.begin(), itCandidate); pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0); allParticleOutputArray->Add(candidate); if(!pdgParticle) continue; if(status == 1) { stableParticleOutputArray->Add(candidate); } else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) { partonOutputArray->Add(candidate); } } }
void ConvertInput(fwlite::Event &event, Long64_t eventCounter, ExRootTreeBranch *branchEvent, ExRootTreeBranch *branchRwgt, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray, Bool_t firstEvent) { fwlite::Handle< GenEventInfoProduct > handleGenEventInfo; fwlite::Handle< LHEEventProduct > handleLHEEvent; fwlite::Handle< vector< reco::GenParticle > > handleParticle; fwlite::Handle< vector< pat::PackedGenParticle > > handlePackedParticle; vector< reco::GenParticle >::const_iterator itParticle; vector< pat::PackedGenParticle >::const_iterator itPackedParticle; vector< const reco::Candidate * > vectorCandidate; vector< const reco::Candidate * >::iterator itCandidate; handleGenEventInfo.getByLabel(event, "generator"); if (!((handleLHEEvent.getBranchNameFor(event, "source")).empty())) { handleLHEEvent.getByLabel(event, "source"); } else if (!((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty())) { handleLHEEvent.getByLabel(event, "externalLHEProducer"); } else if (firstEvent) { std::cout<<"Wrong LHEEvent Label! Please, check the input file."<<std::endl; } if (!((handleParticle.getBranchNameFor(event, "genParticles")).empty())) { handleParticle.getByLabel(event, "genParticles"); } else if (!((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && !((handleParticle.getBranchNameFor(event,"prunedGenParticles")).empty())) { handleParticle.getByLabel(event, "prunedGenParticles"); handlePackedParticle.getByLabel(event, "packedGenParticles"); } else { std::cout<<"Wrong GenParticle Label! Please, check the input file."<<std::endl; exit(-1); } Bool_t foundLHE = !((handleLHEEvent.getBranchNameFor(event, "source")).empty()) || !((handleLHEEvent.getBranchNameFor(event, "externalLHEProducer")).empty()); Bool_t isMiniAOD = !((handlePackedParticle.getBranchNameFor(event, "packedGenParticles")).empty()) && ((handleParticle.getBranchNameFor(event, "genParticles")).empty()) ; HepMCEvent *element; Weight *weight; Candidate *candidate; TDatabasePDG *pdg; TParticlePDG *pdgParticle; Int_t pdgCode; Int_t pid, status; Double_t px, py, pz, e, mass; Double_t x, y, z; element = static_cast<HepMCEvent *>(branchEvent->NewEntry()); element->Number = eventCounter; element->ProcessID = handleGenEventInfo->signalProcessID(); element->MPI = 1; element->Weight = handleGenEventInfo->weight(); element->Scale = handleGenEventInfo->qScale(); element->AlphaQED = handleGenEventInfo->alphaQED(); element->AlphaQCD = handleGenEventInfo->alphaQCD(); element->ID1 = 0; element->ID2 = 0; element->X1 = 0.0; element->X2 = 0.0; element->ScalePDF = 0.0; element->PDF1 = 0.0; element->PDF2 = 0.0; element->ReadTime = 0.0; element->ProcTime = 0.0; if(foundLHE) { const vector< gen::WeightsInfo > &vectorWeightsInfo = handleLHEEvent->weights(); vector< gen::WeightsInfo >::const_iterator itWeightsInfo; for(itWeightsInfo = vectorWeightsInfo.begin(); itWeightsInfo != vectorWeightsInfo.end(); ++itWeightsInfo) { weight = static_cast<Weight *>(branchRwgt->NewEntry()); weight->Weight = itWeightsInfo->wgt; } } pdg = TDatabasePDG::Instance(); for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { const reco::GenParticle &particle = *itParticle; if( !isMiniAOD || particle.status() != 1 ) vectorCandidate.push_back(&*itParticle); } for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { const reco::GenParticle &particle = *itParticle; pid = particle.pdgId(); status = particle.status(); if( isMiniAOD && particle.status() == 1 ) continue; px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); x = particle.vx(); y = particle.vy(); z = particle.vz(); candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; if(particle.mother()) { itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.mother()); if(itCandidate != vectorCandidate.end()) candidate->M1 = distance(vectorCandidate.begin(), itCandidate); } itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0)); if(itCandidate != vectorCandidate.end()) candidate->D1 = distance(vectorCandidate.begin(), itCandidate); itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(particle.numberOfDaughters() - 1)); if(itCandidate != vectorCandidate.end()) candidate->D2 = distance(vectorCandidate.begin(), itCandidate); pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0); allParticleOutputArray->Add(candidate); if(!pdgParticle) continue; if( status == 1) { // Prevent duplicated particle. if ( !isMiniAOD ) stableParticleOutputArray->Add(candidate); } else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) { partonOutputArray->Add(candidate); } } if ( !isMiniAOD) return ; // For MiniAOD sample, // Only status==1 particles are saved to packedGenParticles. for(itPackedParticle = handlePackedParticle->begin(); itPackedParticle != handlePackedParticle->end(); ++itPackedParticle) { vectorCandidate.push_back(&*itPackedParticle); } for(itPackedParticle = handlePackedParticle->begin(); itPackedParticle != handlePackedParticle->end(); ++itPackedParticle) { const pat::PackedGenParticle &particle = *itPackedParticle; pid = particle.pdgId(); status = particle.status(); px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); x = particle.vx(); y = particle.vy(); z = particle.vz(); candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; if(particle.mother(0)) { itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.mother(0)); if(itCandidate != vectorCandidate.end()) candidate->M1 = distance(vectorCandidate.begin(), itCandidate); } itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0)); if(itCandidate != vectorCandidate.end()) candidate->D1 = distance(vectorCandidate.begin(), itCandidate); itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(particle.numberOfDaughters() - 1)); if(itCandidate != vectorCandidate.end()) candidate->D2 = distance(vectorCandidate.begin(), itCandidate); pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x*10.0, y*10.0, z*10.0, 0.0); allParticleOutputArray->Add(candidate); if(!pdgParticle) continue; if(status == 1) { stableParticleOutputArray->Add(candidate); } } }
void ConvertInput(fwlite::Event &event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray) { fwlite::Handle< vector< reco::GenParticle > > handleParticle; vector< reco::GenParticle >::const_iterator itParticle; vector< const reco::Candidate * > vectorCandidate; vector< const reco::Candidate * >::iterator itCandidate; handleParticle.getByLabel(event, "genParticles"); Candidate *candidate; TDatabasePDG *pdg; TParticlePDG *pdgParticle; Int_t pdgCode; Int_t pid, status; Double_t px, py, pz, e, mass; Double_t x, y, z; pdg = TDatabasePDG::Instance(); for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { vectorCandidate.push_back(&*itParticle); } for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { const reco::GenParticle &particle = *itParticle; pid = particle.pdgId(); status = particle.status(); px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); x = particle.vx(); y = particle.vy(); z = particle.vz(); candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0)); if(itCandidate != vectorCandidate.end()) candidate->D1 = distance(vectorCandidate.begin(), itCandidate); itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(particle.numberOfDaughters() - 1)); if(itCandidate != vectorCandidate.end()) candidate->D2 = distance(vectorCandidate.begin(), itCandidate); pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x, y, z, 0.0); allParticleOutputArray->Add(candidate); if(!pdgParticle) continue; if(status == 1) { stableParticleOutputArray->Add(candidate); } else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) { partonOutputArray->Add(candidate); } } }
Bool_t ConfigKstarPP13TeV( AliRsnMiniAnalysisTask *task, Bool_t isMC, Bool_t isPP, const char *suffix, AliRsnCutSet *cutsPair, Float_t nsigmaPi = 3.0, Float_t nsigmaK = 3.0, Bool_t enableMonitor = kTRUE, TString optSys = "DefaultITSTPC2011" ) { //These are the Default values for 2011 ESD track cuts AliPID::EParticleType type1 = AliPID::kPion; AliPID::EParticleType type2 = AliPID::kKaon; // manage suffix if (strlen(suffix) > 0) suffix = Form("_%s", suffix); // retrieve mass from PDG database Int_t pdg = 313; TDatabasePDG *db = TDatabasePDG::Instance(); TParticlePDG *part = db->GetParticle(pdg); Double_t mass = part->Mass(); // set daughter cuts AliRsnCutSetDaughterParticle* cutSetPi; AliRsnCutSetDaughterParticle* cutSetK; /* AliRsnCutTrackQuality* trkQualityCut= new AliRsnCutTrackQuality("myQualityCut"); if(optSyt.Contains("DefaultITSTPC2011")){ trkQualityCut->SetDefaults2011(kTRUE,kTRUE); Printf(Form("::::: SetCustomQualityCut:: using standard 2011 track quality cuts")); } else if(optSyt.Contains("DefaultTPCOnly")){ trkQualityCut->SetDefaultsTPCOnly(kTRUE); Printf(Form("::::: SetCustomQualityCut:: using TPC-only track quality cuts")); } trkQualityCut->Print();*/ AliRsnCutTrackQuality *fQualityTrackCut = new AliRsnCutTrackQuality("AliRsnCutTrackQuality"); //Analysis Track cuts are implemented here AliESDtrackCuts * esdTrackCuts = MyTrackCuts(1, kTRUE,optSys.Data()); fQualityTrackCut->SetESDtrackCuts(esdTrackCuts); fQualityTrackCut->SetPtRange(0.15,30); fQualityTrackCut->SetEtaRange(-0.8,0.8); //kTPCpidTOFveto4s //kTPCpidTOFveto3s //kFastTPCpidNsigma cutSetPi=new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",AliRsnCutSetDaughterParticle::kTPCpidTOFveto3s,nsigmaPi),fQualityTrackCut,AliRsnCutSetDaughterParticle::kTPCpidTOFveto3s,AliPID::kPion,nsigmaPi); cutSetK=new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",AliRsnCutSetDaughterParticle::kTPCpidTOFveto3s, nsigmaK),fQualityTrackCut,AliRsnCutSetDaughterParticle::kTPCpidTOFveto3s,AliPID::kKaon,nsigmaK); Int_t iCutPi = task->AddTrackCuts(cutSetPi); Int_t iCutK = task->AddTrackCuts(cutSetK); if(enableMonitor){ Printf("======== Monitoring cut AliRsnCutSetDaughterParticle enabled"); gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/RESONANCES/macros/mini/AddMonitorOutput.C"); AddMonitorOutput(isMC, cutSetPi->GetMonitorOutput()); AddMonitorOutput(isMC, cutSetK->GetMonitorOutput()); } // -- Values ------------------------------------------------------------------------------------ /* invariant mass */ Int_t imID = task->CreateValue(AliRsnMiniValue::kInvMass, kFALSE); /* IM resolution */ Int_t resID = task->CreateValue(AliRsnMiniValue::kInvMassRes, kTRUE); /* transv. momentum */ Int_t ptID = task->CreateValue(AliRsnMiniValue::kPt, kFALSE); /* centrality */ Int_t centID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE); /* pseudorapidity */ Int_t etaID = task->CreateValue(AliRsnMiniValue::kEta, kFALSE); /* rapidity */ Int_t yID = task->CreateValue(AliRsnMiniValue::kY, kFALSE); // -- Create all needed outputs ----------------------------------------------------------------- // use an array for more compact writing, which are different on mixing and charges // [0] = unlike // [1] = mixing // [2] = like ++ // [3] = like -- Bool_t use [12] = {1 ,1 ,1 ,1 ,1 ,1 ,isMC ,isMC ,isMC ,isMC ,isMC ,isMC }; Bool_t useIM [12] = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 }; TString name [12] = {"UnlikePM","UnlikeMP","MixingPM","MixingMP","LikePP","LikeMM","MCGenPM","MCGenMP","TruesPM","TruesMP","ResPM" ,"ResMP" }; TString comp [12] = {"PAIR" ,"PAIR" ,"MIX" ,"MIX" ,"PAIR" ,"PAIR" ,"MOTHER" ,"MOTHER" ,"TRUE" ,"TRUE" ,"TRUE" ,"TRUE" }; TString output [12] = {"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE","SPARSE","SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE" ,"SPARSE","SPARSE"}; Char_t charge1 [12] = {'+' ,'-' ,'+' ,'-' ,'+' ,'-' ,'+' ,'-' ,'+' ,'-' ,'+' ,'-' }; Char_t charge2 [12] = {'-' ,'+' ,'-' ,'+' ,'+' ,'-' ,'-' ,'+' ,'_' ,'+' ,'-' ,'+' }; Int_t cutIDPi [12] = {iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi ,iCutPi }; Int_t cutIDK [12] = {iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK ,iCutK }; Int_t PDGCode [12] = {313 ,313 ,313 ,313 ,313 ,313 ,313 ,-313 ,313 ,313 ,313 ,-313 }; for (Int_t i = 0; i < 12; i++) { if (!use[i]) continue; AliRsnMiniOutput *out = task->CreateOutput(Form("KSTAR_%s%s", name[i].Data(), suffix), output[i].Data(), comp[i].Data()); out->SetDaughter(0, AliRsnDaughter::kKaon); out->SetDaughter(1, AliRsnDaughter::kPion); out->SetCutID(0, cutIDK[i]); out->SetCutID(1, cutIDPi[i]); out->SetCharge(0, charge1[i]); out->SetCharge(1, charge2[i]); out->SetMotherPDG(PDGCode[i]); out->SetMotherMass(mass); out->SetPairCuts(cutsPair); // axis X: invmass (or resolution) if (useIM[i]) out->AddAxis(imID, 90, 0.6, 1.5); else out->AddAxis(resID, 200, -0.02, 0.02); // axis Y: transverse momentum out->AddAxis(ptID, 200, 0.0, 20.0); // axis Z: centrality-multiplicity if (!isPP) out->AddAxis(centID, 100, 0.0, 100.0); else out->AddAxis(centID, 400, 0.0, 400.0); // axis W: pseudorapidity // out->AddAxis(etaID, 20, -1.0, 1.0); // axis J: rapidity //out->AddAxis(yID, 90, -4.5, 4.5); } return kTRUE; }
void ConvertInput(fwlite::Event &event, Long64_t eventCounter, ExRootTreeBranch *branch, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray) { LHEFEvent *lheEvt; lheEvt = static_cast<LHEFEvent *>(branch->NewEntry()); fwlite::Handle<LHEEventProduct> lheEvtInfo; lheEvtInfo.getByLabel(event, "source"); if (lheEvtInfo.isValid()) { lheEvt->Number = eventCounter; lheEvt->Weight = lheEvtInfo->originalXWGTUP(); lheEvt->ProcessID = ((lhef::HEPEUP)lheEvtInfo->hepeup()).IDPRUP; lheEvt->ScalePDF = ((lhef::HEPEUP)lheEvtInfo->hepeup()).IDPRUP; lheEvt->AlphaQED = ((lhef::HEPEUP)lheEvtInfo->hepeup()).SCALUP; lheEvt->AlphaQCD = ((lhef::HEPEUP)lheEvtInfo->hepeup()).AQCDUP; } else { lheEvt->Number = 0; lheEvt->Weight = 1; lheEvt->ProcessID = 0; lheEvt->ScalePDF = 0; lheEvt->AlphaQED = 0; lheEvt->AlphaQCD = 0; } fwlite::Handle< vector< reco::GenParticle > > handleParticle; vector< reco::GenParticle >::const_iterator itParticle; vector< const reco::Candidate * > vectorCandidate; vector< const reco::Candidate * >::iterator itCandidate; handleParticle.getByLabel(event, "genParticles"); Candidate *candidate; TDatabasePDG *pdg; TParticlePDG *pdgParticle; Int_t pdgCode; Int_t pid, status; Double_t px, py, pz, e, mass; Double_t x, y, z; pdg = TDatabasePDG::Instance(); for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { vectorCandidate.push_back(&*itParticle); } for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle) { const reco::GenParticle &particle = *itParticle; pid = particle.pdgId(); status = particle.status(); px = particle.px(); py = particle.py(); pz = particle.pz(); e = particle.energy(); mass = particle.mass(); x = particle.vx(); y = particle.vy(); z = particle.vz(); candidate = factory->NewCandidate(); candidate->PID = pid; pdgCode = TMath::Abs(candidate->PID); candidate->Status = status; //M1 if(particle.mother()){ itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.mother()); if(itCandidate != vectorCandidate.end()) candidate->M1 = distance(vectorCandidate.begin(), itCandidate); } //D1 itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0)); if(itCandidate != vectorCandidate.end()) candidate->D1 = distance(vectorCandidate.begin(), itCandidate); //D2 if(particle.numberOfDaughters() > 1) itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(1)); else itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(particle.numberOfDaughters() - 1)); if(itCandidate != vectorCandidate.end()) candidate->D2 = distance(vectorCandidate.begin(), itCandidate); pdgParticle = pdg->GetParticle(pid); candidate->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999; candidate->Mass = mass; candidate->Momentum.SetPxPyPzE(px, py, pz, e); candidate->Position.SetXYZT(x, y, z, 0.0); allParticleOutputArray->Add(candidate); if(!pdgParticle) continue; if(status == 1) { stableParticleOutputArray->Add(candidate); } else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15) { partonOutputArray->Add(candidate); } } }