Fork me on GitHub

Ignore:
Timestamp:
Oct 18, 2014, 12:27:15 PM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
5fbcfe8
Parents:
400597a
Message:

Code reorganization

Moved the methods that read branches to the correponding BranchElements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesBranchElement.h

    r400597a r4fd37d4  
    2222#include "TColor.h"
    2323#include "TString.h"
     24#include "TClonesArray.h"
     25#include "TClass.h"
    2426#include <exception>
     27#include <iostream>
    2528#include "display/DelphesCaloData.h"
    2629#include "TEveElement.h"
     
    3134{
    3235  public:
    33     DelphesBranchBase(const char* name="", const char*type="", const enum EColor color=kBlack):name_(name),type_(type),color_(color) {}
    34     virtual ~DelphesBranchBase() {};
     36    DelphesBranchBase(const char* name="", TClonesArray* branch=NULL, const enum EColor color=kBlack):name_(name),branch_(branch),color_(color) {}
     37    virtual ~DelphesBranchBase() {}
    3538    const char* GetName() const { return (const char*)name_; }
    36     const char* GetType() const { return (const char*)type_; }
     39    const char* GetType() const { return branch_ ? branch_->GetClass()->GetName() : "None"; }
     40    virtual const char* GetClassName() = 0;
    3741    enum EColor GetColor() const { return color_; }
    38     virtual const char* GetClassName() = 0;
    3942    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;
    4045
    4146  protected:
    4247    TString name_;
    43     TString type_; // needed for parsing the branch later on
     48    TClonesArray* branch_;
    4449    const enum EColor color_;
     50    Float_t tkRadius_,tkHalfLength_, tk_Bz_;
    4551};
    4652
     
    5056  public:
    5157    // constructor
    52     DelphesBranchElement(const char* name="", const char*type="", const enum EColor color=kBlack):DelphesBranchBase(name, type, color) {
     58    DelphesBranchElement(const char* name="", TClonesArray* branch=NULL, const enum EColor color=kBlack):DelphesBranchBase(name, branch, color) {
    5359      throw std::exception();
    5460    }
     
    6066    EveContainer* GetContainer() { return data_; }
    6167
     68    // tracking volume
     69    virtual void SetTrackingVolume(Float_t r, Float_t l, Float_t Bz=0.) { tkRadius_ = r; tkHalfLength_ = l; tk_Bz_ = Bz; }
     70
    6271    // resets the collection (before moving to the next event)
    6372    virtual void Reset() {};
     
    6574    // template class name
    6675    virtual const char* GetClassName() { return data_->ClassName(); }
     76
     77    // read the branch and fill elements for display
     78    virtual void ReadBranch() {}
    6779
    6880  private:
     
    7385
    7486// special case for calo towers
    75 template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, const char*type, const enum EColor color);
     87template<> DelphesBranchElement<DelphesCaloData>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color);
    7688template<> void DelphesBranchElement<DelphesCaloData>::Reset();
     89template<> void DelphesBranchElement<DelphesCaloData>::ReadBranch();
    7790
    7891// special case for element lists
    79 template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color);
     92template<> DelphesBranchElement<TEveElementList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color);
    8093template<> void DelphesBranchElement<TEveElementList>::Reset();
     94template<> void DelphesBranchElement<TEveElementList>::ReadBranch();
    8195
    8296// special case for track lists
    83 template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, const char*type, const enum EColor color);
     97template<> DelphesBranchElement<TEveTrackList>::DelphesBranchElement(const char* name, TClonesArray* branch, const enum EColor color);
     98template<> void DelphesBranchElement<TEveTrackList>::SetTrackingVolume(Float_t r, Float_t l, Float_t Bz);
    8499template<> void DelphesBranchElement<TEveTrackList>::Reset();
     100template<> void DelphesBranchElement<TEveTrackList>::ReadBranch();
    85101
    86102#endif // CINT, CLING
Note: See TracChangeset for help on using the changeset viewer.