#include #include #include #include "TTree.h" #include "TFile.h" #include "TString.h" #include "TClonesArray.h" #include static constexpr Int_t kMaxEvent = 5; static constexpr Int_t kMaxParticle = 15; // 15 partons (incoming/outgoing) will be the maximum (from TPS: combining 3-dijets at NLO) static constexpr Int_t kMaxRwgt = 128; // Declaration of leaf types Int_t Event_; UInt_t Event_fUniqueID[kMaxEvent]; //[Event_] UInt_t Event_fBits[kMaxEvent]; //[Event_] Long64_t Event_Number[kMaxEvent]; //[Event_] Int_t Event_Nparticles[kMaxEvent]; //[Event_] Int_t Event_ProcessID[kMaxEvent]; //[Event_] Double_t Event_Weight[kMaxEvent]; //[Event_] Double_t Event_ScalePDF[kMaxEvent]; //[Event_] Double_t Event_CouplingQED[kMaxEvent]; //[Event_] Double_t Event_CouplingQCD[kMaxEvent]; //[Event_] Int_t Event_size; Int_t Rwgt_; UInt_t Rwgt_fUniqueID[kMaxRwgt]; //[Rwgt_] UInt_t Rwgt_fBits[kMaxRwgt]; //[Rwgt_] Double_t Rwgt_Weight[kMaxRwgt]; //[Rwgt_] Int_t Rwgt_size; Int_t Particle_; UInt_t Particle_fUniqueID[kMaxParticle]; //[Particle_] UInt_t Particle_fBits[kMaxParticle]; //[Particle_] Int_t Particle_PID[kMaxParticle]; //[Particle_] Int_t Particle_Status[kMaxParticle]; //[Particle_] Int_t Particle_Mother1[kMaxParticle]; //[Particle_] Int_t Particle_Mother2[kMaxParticle]; //[Particle_] Int_t Particle_ColorLine1[kMaxParticle]; //[Particle_] Int_t Particle_ColorLine2[kMaxParticle]; //[Particle_] Double_t Particle_Px[kMaxParticle]; //[Particle_] Double_t Particle_Py[kMaxParticle]; //[Particle_] Double_t Particle_Pz[kMaxParticle]; //[Particle_] Double_t Particle_E[kMaxParticle]; //[Particle_] Double_t Particle_M[kMaxParticle]; //[Particle_] Double_t Particle_PT[kMaxParticle]; //[Particle_] Double_t Particle_Eta[kMaxParticle]; //[Particle_] Double_t Particle_Phi[kMaxParticle]; //[Particle_] Double_t Particle_Rapidity[kMaxParticle]; //[Particle_] Double_t Particle_LifeTime[kMaxParticle]; //[Particle_] Double_t Particle_Spin[kMaxParticle]; //[Particle_] Int_t Particle_size; // List of branches TBranch *b_Event_; //! TBranch *b_Event_fUniqueID; //! TBranch *b_Event_fBits; //! TBranch *b_Event_Number; //! TBranch *b_Event_Nparticles; //! TBranch *b_Event_ProcessID; //! TBranch *b_Event_Weight; //! TBranch *b_Event_ScalePDF; //! TBranch *b_Event_CouplingQED; //! TBranch *b_Event_CouplingQCD; //! TBranch *b_Event_size; //! TBranch *b_Rwgt_; //! TBranch *b_Rwgt_fUniqueID; //! TBranch *b_Rwgt_fBits; //! TBranch *b_Rwgt_Weight; //! TBranch *b_Rwgt_size; //! TBranch *b_Particle_; //! TBranch *b_Particle_fUniqueID; //! TBranch *b_Particle_fBits; //! TBranch *b_Particle_PID; //! TBranch *b_Particle_Status; //! TBranch *b_Particle_Mother1; //! TBranch *b_Particle_Mother2; //! TBranch *b_Particle_ColorLine1; //! TBranch *b_Particle_ColorLine2; //! TBranch *b_Particle_Px; //! TBranch *b_Particle_Py; //! TBranch *b_Particle_Pz; //! TBranch *b_Particle_E; //! TBranch *b_Particle_M; //! TBranch *b_Particle_PT; //! TBranch *b_Particle_Eta; //! TBranch *b_Particle_Phi; //! TBranch *b_Particle_Rapidity; //! TBranch *b_Particle_LifeTime; //! TBranch *b_Particle_Spin; //! TBranch *b_Particle_size; //! int merge() { std::string firstfilename= "pp_2j_LO_H_T_35GeV.root"; std::string treename="LHEF"; std::unique_ptr first{TFile::Open(firstfilename.c_str())}; TTree * first_tree= (TTree*)first->Get(treename.c_str()); first_tree->SetMakeClass(1); first_tree->SetBranchAddress("Event", &Event_, &b_Event_); first_tree->SetBranchAddress("Event.fUniqueID", Event_fUniqueID, &b_Event_fUniqueID); first_tree->SetBranchAddress("Event.fBits", Event_fBits, &b_Event_fBits); first_tree->SetBranchAddress("Event.Number", Event_Number, &b_Event_Number); first_tree->SetBranchAddress("Event.Nparticles", Event_Nparticles, &b_Event_Nparticles); first_tree->SetBranchAddress("Event.ProcessID", Event_ProcessID, &b_Event_ProcessID); first_tree->SetBranchAddress("Event.Weight", Event_Weight, &b_Event_Weight); first_tree->SetBranchAddress("Event.ScalePDF", Event_ScalePDF, &b_Event_ScalePDF); first_tree->SetBranchAddress("Event.CouplingQED", Event_CouplingQED, &b_Event_CouplingQED); first_tree->SetBranchAddress("Event.CouplingQCD", Event_CouplingQCD, &b_Event_CouplingQCD); first_tree->SetBranchAddress("Event_size", &Event_size, &b_Event_size); first_tree->SetBranchAddress("Rwgt", &Rwgt_, &b_Rwgt_); first_tree->SetBranchAddress("Rwgt.fUniqueID", Rwgt_fUniqueID, &b_Rwgt_fUniqueID); first_tree->SetBranchAddress("Rwgt.fBits", Rwgt_fBits, &b_Rwgt_fBits); first_tree->SetBranchAddress("Rwgt.Weight", Rwgt_Weight, &b_Rwgt_Weight); first_tree->SetBranchAddress("Rwgt_size", &Rwgt_size, &b_Rwgt_size); first_tree->SetBranchAddress("Particle", &Particle_, &b_Particle_); first_tree->SetBranchAddress("Particle.fUniqueID", Particle_fUniqueID, &b_Particle_fUniqueID); first_tree->SetBranchAddress("Particle.fBits", Particle_fBits, &b_Particle_fBits); first_tree->SetBranchAddress("Particle.PID", Particle_PID, &b_Particle_PID); first_tree->SetBranchAddress("Particle.Status", Particle_Status, &b_Particle_Status); first_tree->SetBranchAddress("Particle.Mother1", Particle_Mother1, &b_Particle_Mother1); first_tree->SetBranchAddress("Particle.Mother2", Particle_Mother2, &b_Particle_Mother2); first_tree->SetBranchAddress("Particle.ColorLine1", Particle_ColorLine1, &b_Particle_ColorLine1); first_tree->SetBranchAddress("Particle.ColorLine2", Particle_ColorLine2, &b_Particle_ColorLine2); first_tree->SetBranchAddress("Particle.Px", Particle_Px, &b_Particle_Px); first_tree->SetBranchAddress("Particle.Py", Particle_Py, &b_Particle_Py); first_tree->SetBranchAddress("Particle.Pz", Particle_Pz, &b_Particle_Pz); first_tree->SetBranchAddress("Particle.E", Particle_E, &b_Particle_E); first_tree->SetBranchAddress("Particle.M", Particle_M, &b_Particle_M); first_tree->SetBranchAddress("Particle.PT", Particle_PT, &b_Particle_PT); first_tree->SetBranchAddress("Particle.Eta", Particle_Eta, &b_Particle_Eta); first_tree->SetBranchAddress("Particle.Phi", Particle_Phi, &b_Particle_Phi); first_tree->SetBranchAddress("Particle.Rapidity", Particle_Rapidity, &b_Particle_Rapidity); first_tree->SetBranchAddress("Particle.LifeTime", Particle_LifeTime, &b_Particle_LifeTime); first_tree->SetBranchAddress("Particle.Spin", Particle_Spin, &b_Particle_Spin); first_tree->SetBranchAddress("Particle_size", &Particle_size, &b_Particle_size); ROOT::RDataFrame df (*first_tree); df.Snapshot("LHEF","out_snapshot.root"); return 0; }