Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesBranchElement.h

    r341014c r7066f9c  
    2020#define DelphesBranchElement_h
    2121
     22#include "TColor.h"
     23#include "TString.h"
     24#include "TClonesArray.h"
    2225#include "TClass.h"
    23 #include "TClonesArray.h"
    24 #include "TColor.h"
     26#include <exception>
     27#include <iostream>
     28#include "display/DelphesCaloData.h"
    2529#include "TEveElement.h"
    2630#include "TEveTrack.h"
    27 #include "TString.h"
    28 #include "display/DelphesCaloData.h"
    29 #include <exception>
    30 #include <iostream>
    3131
    3232// virtual class to represent objects from a Delphes-tree branch
    3333class DelphesBranchBase
    3434{
    35 public:
    36   DelphesBranchBase(const char *name = "", TClonesArray *branch = NULL, const enum EColor color = kBlack, Float_t maxPt = 50.) :
    37     name_(name), maxPt_(maxPt), branch_(branch), color_(color) {}
    38   virtual ~DelphesBranchBase() {}
    39   const char *GetName() const { return (const char *)name_; }
    40   const char *GetType() const { return branch_ ? branch_->GetClass()->GetName() : "None"; }
    41   virtual const char *GetClassName() = 0;
    42   enum EColor GetColor() const { return color_; }
    43   virtual void Reset() = 0;
    44   virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz = 0.)
    45   {
    46     tkRadius_ = r;
    47     tkHalfLength_ = l;
    48     tk_Bz_ = Bz;
    49   }
    50   virtual void ReadBranch() = 0;
    51   virtual std::vector<TLorentzVector> GetVectors() = 0;
     35  public:
     36    DelphesBranchBase(const char* name="", TClonesArray* branch=NULL, const enum EColor color=kBlack, Float_t maxPt=50.):name_(name),maxPt_(maxPt),branch_(branch),color_(color) {}
     37    virtual ~DelphesBranchBase() {}
     38    const char* GetName() const { return (const char*)name_; }
     39    const char* GetType() const { return branch_ ? branch_->GetClass()->GetName() : "None"; }
     40    virtual const char* GetClassName() = 0;
     41    enum EColor GetColor() const { return color_; }
     42    virtual void Reset() = 0;
     43    virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; }
     44    virtual void ReadBranch() = 0;
     45    virtual std::vector<TLorentzVector> GetVectors() = 0;
    5246
    53 protected:
    54   TString name_;
    55   Float_t maxPt_;
    56   TClonesArray *branch_;
    57   const enum EColor color_;
    58   Float_t tkRadius_, tkHalfLength_, tk_Bz_;
     47  protected:
     48    TString name_;
     49    Float_t maxPt_;
     50    TClonesArray* branch_;
     51    const enum EColor color_;
     52    Float_t tkRadius_,tkHalfLength_, tk_Bz_;
    5953};
    6054
    6155// concrete implementations. EveContainer can be a TrackList, ElementList or CaloData.
    62 template <typename EveContainer>
    63 class DelphesBranchElement: public DelphesBranchBase
     56template<typename EveContainer> class DelphesBranchElement: public DelphesBranchBase
    6457{
    65 public:
    66   // constructor
    67   DelphesBranchElement(const char *name = "", TClonesArray *branch = NULL, const enum EColor color = kBlack, Float_t maxPt = 50.) :
    68     DelphesBranchBase(name, branch, color, maxPt)
    69   {
    70     throw std::exception();
    71   }
     58  public:
     59    // constructor
     60    DelphesBranchElement(const char* name="", TClonesArray* branch=NULL, const enum EColor color=kBlack, Float_t maxPt=50.):DelphesBranchBase(name, branch, color, maxPt) {
     61      throw std::exception();
     62    }
    7263
    73   // destructor
    74   virtual ~DelphesBranchElement() { delete data_; }
     64    // destructor
     65    virtual ~DelphesBranchElement() { delete data_; }
    7566
    76   // get the container (ElementList, TrackList, or CaloData)
    77   EveContainer *GetContainer() { return data_; }
     67    // get the container (ElementList, TrackList, or CaloData)
     68    EveContainer* GetContainer() { return data_; }
    7869
    79   // tracking volume
    80   virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz = 0.)
    81   {
    82     tkRadius_ = r;
    83     tkHalfLength_ = l;
    84     tk_Bz_ = Bz;
    85   }
     70    // tracking volume
     71    virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; }
    8672
    87   // resets the collection (before moving to the next event)
    88   virtual void Reset(){};
     73    // resets the collection (before moving to the next event)
     74    virtual void Reset() {};
    8975
    90   // template class name
    91   virtual const char *GetClassName() { return data_->ClassName(); }
     76    // template class name
     77    virtual const char* GetClassName() { return data_->ClassName(); }
    9278
    93   // read the branch and fill elements for display
    94   virtual void ReadBranch() {}
     79    // read the branch and fill elements for display
     80    virtual void ReadBranch() {}
    9581
    96   // return the vector for all elements
    97   virtual std::vector<TLorentzVector> GetVectors()
    98   {
    99     std::vector<TLorentzVector> v;
    100     return v;
    101   }
     82    // return the vector for all elements
     83    virtual std::vector<TLorentzVector> GetVectors() { std::vector<TLorentzVector> v; return v; }
    10284
    103 private:
    104   EveContainer *data_;
     85  private:
     86    EveContainer* data_;
    10587};
    10688
     
    10890
    10991// special case for calo towers
    110 template <>
    111 DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt);
    112 template <>
    113 void DelphesBranchElement<DelphesCaloData>::Reset();
    114 template <>
    115 void DelphesBranchElement<DelphesCaloData>::ReadBranch();
    116 template <>
    117 std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors();
     92template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt);
     93template<> void DelphesBranchElement<DelphesCaloData>::Reset();
     94template<> void DelphesBranchElement<DelphesCaloData>::ReadBranch();
     95template<> std::vector<TLorentzVector> DelphesBranchElement<DelphesCaloData>::GetVectors();
    11896
    11997// special case for element lists
    120 template <>
    121 DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt);
    122 template <>
    123 void DelphesBranchElement<TEveElementList>::Reset();
    124 template <>
    125 void DelphesBranchElement<TEveElementList>::ReadBranch();
    126 template <>
    127 std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors();
     98template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt);
     99template<> void DelphesBranchElement<TEveElementList>::Reset();
     100template<> void DelphesBranchElement<TEveElementList>::ReadBranch();
     101template<> std::vector<TLorentzVector> DelphesBranchElement<TEveElementList>::GetVectors();
    128102
    129103// special case for track lists
    130 template <>
    131 DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char *name, TClonesArray *branch, const enum EColor color, Float_t maxPt);
    132 template <>
    133 void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz);
    134 template <>
    135 void DelphesBranchElement<TEveTrackList>::Reset();
    136 template <>
    137 void DelphesBranchElement<TEveTrackList>::ReadBranch();
    138 template <>
    139 std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors();
     104template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color, Float_t maxPt);
     105template<> void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz);
     106template<> void DelphesBranchElement<TEveTrackList>::Reset();
     107template<> void DelphesBranchElement<TEveTrackList>::ReadBranch();
     108template<> std::vector<TLorentzVector> DelphesBranchElement<TEveTrackList>::GetVectors();
    140109
    141110#endif // CINT, CLING
Note: See TracChangeset for help on using the changeset viewer.