Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:46

0001 // @(#)root/foam:$Id$
0002 // Author: S. Jadach <mailto:Stanislaw.jadach@ifj.edu.pl>, P.Sawicki <mailto:Pawel.Sawicki@ifj.edu.pl>
0003 
0004 #ifndef ROOT_TFoamCell
0005 #define ROOT_TFoamCell
0006 
0007 #include "TRef.h"
0008 
0009 class TFoamVect;
0010 
0011 
0012 class TFoamCell : public TObject {
0013    //   static, the same for all cells!
0014 private:
0015    Short_t  fDim;                   ///< Dimension of the vector space
0016    //   MEMBERS
0017 private:
0018    //--- linked tree organization ---
0019    Int_t    fSerial;                ///< Serial number
0020    Int_t    fStatus;                ///< Status (active, inactive)
0021 
0022    // For backwards compatibility. The TFoam v1 and v2 classes use these
0023    // members. Getting rid of them and doing a schema evolution rule for
0024    // TFoamCell doesn't seem to work, because the TRefs can't be dereferenced
0025    // at that point yet.
0026    TRef fParent;    ///< Pointer to parent cell
0027    TRef fDaught0;   ///< Pointer to daughter 1
0028    TRef fDaught1;   ///< Pointer to daughter 2
0029 
0030    Int_t fParentIdx = -1;    ///< Serial number of parent cell
0031    Int_t fDaught0Idx = -1;   ///< Serial number of daughter 1
0032    Int_t fDaught1Idx = -1;   ///< Serial number of daughter 2
0033 
0034    // Note: the fCells member doesn't take part in IO because it will be filled by the TFoam object.
0035    TFoamCell** fCells = nullptr;    ///<! Array of ALL cells, owned by the TFoam object
0036    //--- M.C. sampling and choice of the best edge ---
0037 private:
0038    Double_t fXdiv;                  ///< Factor for division
0039    Int_t    fBest;                  ///< Best Edge for division
0040    //--- Integrals of all kinds ---
0041    Double_t fVolume;                ///< Cartesian Volume of cell
0042    Double_t fIntegral;              ///< Integral over cell (estimate from exploration)
0043    Double_t fDrive;                 ///< Driver  integral, only for cell build-up
0044    Double_t fPrimary;               ///< Primary integral, only for MC generation
0045 
0046 public:
0047    TFoamCell();                          // Default Constructor for ROOT streamers
0048    TFoamCell(Int_t);                     // User Constructor
0049    TFoamCell(TFoamCell const&) = delete;      // Copy Constructor
0050    TFoamCell(TFoamCell &&) = delete;
0051    ~TFoamCell() override;                // Destructor
0052    void  Fill(Int_t, TFoamCell*, TFoamCell*, TFoamCell*);    // Assigns values of attributes
0053    TFoamCell&  operator=(const TFoamCell&) = delete;   // Substitution operator (never used)
0054    TFoamCell&  operator=(TFoamCell &&) = delete;
0055    //--------------- Geometry ----------------------------------
0056    Double_t  GetXdiv() const { return fXdiv;}          // Pointer to Xdiv
0057    Int_t     GetBest() const { return fBest;}          // Pointer to Best
0058    void      SetBest(Int_t    Best){ fBest =Best;}     // Set Best edge candidate
0059    void      SetXdiv(Double_t Xdiv){ fXdiv =Xdiv;}     // Set x-division for best edge cand.
0060    void      GetHcub(  TFoamVect&, TFoamVect&) const;  // Get position and size vectors (h-cubical subspace)
0061    void      GetHSize( TFoamVect& ) const;             // Get size only of cell vector  (h-cubical subspace)
0062    //--------------- Integrals/Volumes -------------------------
0063    void      CalcVolume();                             // Calculates volume of cell
0064    Double_t  GetVolume() const { return fVolume;}      // Volume of cell
0065    Double_t  GetIntg() const { return fIntegral;}      // Get Integral
0066    Double_t  GetDriv() const { return fDrive;}         // Get Drive
0067    Double_t  GetPrim() const { return fPrimary;}       // Get Primary
0068    void      SetIntg(Double_t Intg){ fIntegral=Intg;}  // Set true integral
0069    void      SetDriv(Double_t Driv){ fDrive   =Driv;}  // Set driver integral
0070    void      SetPrim(Double_t Prim){ fPrimary =Prim;}  // Set primary integral
0071    //--------------- linked tree organization ------------------
0072    Int_t     GetStat() const { return fStatus;}        // Get Status
0073    void      SetStat(Int_t Stat){ fStatus=Stat;}       // Set Status
0074 
0075    // For backwards compatibility, fall back to the TRefs if the index is not set.
0076    TFoamCell* GetPare() const { return fParentIdx >= 0 ? fCells[fParentIdx] : (TFoamCell*) fParent.GetObject(); }    // Get Pointer to parent cell
0077    TFoamCell* GetDau0() const { return fDaught0Idx >= 0 ? fCells[fDaught0Idx] : (TFoamCell*) fDaught0.GetObject(); } // Get Pointer to 1-st daughter vertex
0078    TFoamCell* GetDau1() const { return fDaught1Idx >= 0 ? fCells[fDaught1Idx] : (TFoamCell*) fDaught1.GetObject(); } // Get Pointer to 2-nd daughter vertex
0079 
0080    void      SetDau0(TFoamCell* Daug){ fDaught0Idx = Daug ? Daug->fSerial : -1;}  // Set pointer to 1-st daughter
0081    void      SetDau1(TFoamCell* Daug){ fDaught1Idx = Daug ? Daug->fSerial : -1;}  // Set pointer to 2-nd daughter
0082    void      SetSerial(Int_t Serial){ fSerial=Serial;}    // Set serial number
0083    Int_t     GetSerial() const { return fSerial;}         // Get serial number
0084    void      SetCells(TFoamCell** cells) { fCells = cells;} // Set the pointer to the cells array
0085    TFoamCell** GetCells() const { return fCells;}           // Return the pointer to the cells array
0086    //--- other ---
0087    void Print(Option_t *option) const override ;                   // Prints cell content
0088 
0089    ClassDefOverride(TFoamCell,2)  //Single cell of FOAM
0090 };
0091 #endif