#ifndef STNTUPLE_TGenpBlock #define STNTUPLE_TGenpBlock //----------------------------------------------------------------------------- // definition of the STNTUPLE GENP (generator-level) particle block // Author: Pasha Murat (CDF/FNAL) // Date: Nov 25 2000 // // the implementation is a trade-off between the performance in split and // non-split modes. I'm assuming that on a long term time scale // TGenpBlock will be written in split mode, however the TClonesArray // itself may not be split // Also one wants to control the streamer of the class, having a wrapper // around TClonesArray seems to be a reasonable compromise here //----------------------------------------------------------------------------- #include "TArrayI.h" #include "TClonesArray.h" #include "Stntuple/base/TStnArrayI.hh" #include "TStnDataBlock.hh" #include "TGenParticle.hh" class TStnEvent; class TGenpBlock: public TStnDataBlock { friend Int_t StnRun1InitGenpBlock (TStnDataBlock*, TStnEvent*, int); friend Int_t StnGenInitGenpBlock (TStnDataBlock*, TStnEvent*, int); public: // struct Gen_t { // Int_t fFirst; // index of the 1st part for this int // Int_t fGenerator; // MC generator code for this int // }; protected: //----------------------------------------------------------------------------- // data members //----------------------------------------------------------------------------- Int_t fNParticles; // total # of particles Int_t fNInteractions; // # of primary interactions+1 TStnArrayI* fIntData; // indx of the 1st par TClonesArray* fList; // list of particles Double_t fEtaMin; // ! Double_t fEtaMax; // ! Double_t fPtMin; // ! TArrayI fPdgCodeList; // ! Int_t fNCodes; // ! Int_t fUseCuts; // ! 1, if used //dt Float_t fEventWeight; Float_t fPthat; Float_t fEOR; //dt //----------------------------------------------------------------------------- // functions //----------------------------------------------------------------------------- public: // ****** constructors and destructor TGenpBlock(); virtual ~TGenpBlock(); //----------------------------------------------------------------------------- // accessors //----------------------------------------------------------------------------- Int_t NParticles () { return fNParticles; } Int_t NParticles (int i) { return fIntData->At(2*i+2)-fIntData->At(2*i); } Int_t NInteractions () { return fNInteractions; } Int_t First (int i) { return fIntData->At(2*i); } Int_t Generator(int i) { return fIntData->At(2*i+1); } TClonesArray* List () { return fList; } Int_t NPdgCodes () { return fNCodes; } Int_t PdgCode(Int_t i) { return fPdgCodeList[i]; } Double_t PtMin () { return fPtMin; } Double_t EtaMin () { return fEtaMin; } Double_t EtaMax () { return fEtaMax; } Int_t UseCuts () { return fUseCuts; } //dt Float_t EventWeight () { return fEventWeight; } Float_t Pthat () { return fPthat; } //dt // `i'-th particle in the global list TGenParticle* Particle(int i) { return (TGenParticle*) fList->UncheckedAt(i); } // `i'-th particle from primary // interaction `pi' TGenParticle* Particle(int pi, int i) { return (TGenParticle*) fList->UncheckedAt(First(pi)+i); } //----------------------------------------------------------------------------- // modifiers //----------------------------------------------------------------------------- Int_t AddPrimaryVertex(); void SetEtaMin (Double_t eta) { fEtaMin = eta; } void SetEtaMax (Double_t eta) { fEtaMax = eta; } void SetPtMin (Double_t pt ) { fPtMin = pt; } void SetUseCuts(Int_t use) { fUseCuts = use; } //dt void SetEventWeight(Float_t weight) { fEventWeight = weight; } void SetPthat (Float_t pthat) { fPthat = pthat; } //dt void AddPdgCode(Int_t code); // currently: add LAST particle to the // LAST interaction TGenParticle* NewParticle(Int_t i, Int_t idhep, Int_t istdhep, Int_t m1, Int_t m2, Int_t d1, Int_t d2, Float_t px, Float_t py, Float_t pz, Float_t e, Float_t vx, Float_t vy, Float_t vz, Float_t t); TGenParticle* NewParticle(Int_t i, const TParticle* p); // ****** overloaded functions of // TObject void Clear(Option_t* opt = ""); void Print(Option_t* opt = "") const; void Print(Int_t PdgCode, Float_t PtMin, Float_t EtaMin, Float_t EtaMax) const; void PrintParticleWithDaughters(TGenParticle* P) const; //----------------------------------------------------------------------------- // other useful methods // 1. GENP-level missing Et //----------------------------------------------------------------------------- void GetMissingEt(TVector2* Met) const ; //----------------------------------------------------------------------------- // I/O and schema evolution //----------------------------------------------------------------------------- void ReadV1(TBuffer& R__b); void ReadV2(TBuffer& R__b); // version 2 (compressed) int ReadParticles (TBuffer& R__b); int WriteParticles(TBuffer& R__b); ClassDef(TGenpBlock,3) // GENP block: output of MC event generators }; #endif