Fork me on GitHub

Changeset 264 in svn for trunk/Utilities/ExRootAnalysis


Ignore:
Timestamp:
Feb 11, 2009, 10:22:30 AM (16 years ago)
Author:
Xavier Rouby
Message:

first test 2.0

Location:
trunk/Utilities/ExRootAnalysis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h

    r220 r264  
    1313 *  present in the data members of the Block TRoot class.
    1414 *
    15  *  $Date: 2009-02-02 11:32:12 $
    16  *  $Revision: 1.11 $
     15 *  $Date: 2009-02-11 09:19:14 $
     16 *  $Revision: 1.12 $
    1717 *
    1818 * 
     
    2424#include "TObject.h"
    2525#include "BlockCompare.h"
     26#include "interface/D_Constants.h"
     27#include "interface/CaloUtil.h"
    2628
    2729class TSortableObject: public TObject
     
    147149  float Pz; // particle momentum vector (z component) in GeV
    148150
    149   float PT; // particle transverse momentum in GeV
    150151  float Eta; // particle pseudorapidity 
    151152  float Phi; // particle azimuthal angle in rad
    152153
     154  float EtaCalo; // particle pseudorapidity when entering the calo,
     155  float PhiCalo; // particle azimuthal angle in rad when entering the calo
     156
    153157  void Set(const TLorentzVector& momentum);
    154158  void Set(const float px, const float py, const float pz, const float e);
    155   static TCompare *fgCompare; //!
    156   const TCompare *GetCompare() const { return fgCompare; }
     159  void SetEtaPhi(const float eta, const float phi) {Eta=eta; Phi=phi;};
     160  void SetEtaPhiCalo(const float eta, const float phi) {EtaCalo=eta; PhiCalo=phi;};
     161  void SetEtaPhiEET(const float eta, const float phi, const float e, const float et);
     162  static TCompare *fgCompare; //!
     163  const TCompare *GetCompare() const { return fgCompare; }
     164  //void SetEem_Ehad(const float sE_em, const float sE_had) {} ; // sets E_em and E_had, computes E and ET
     165  float PT; // particle transverse momentum in GeV
     166  //const float getEtaGen() const {return _EtaGen;}
     167  //const float getPhiGen() const {return _PhiGen;}
     168
     169
     170//protected:
     171  //float EGen, _EtaGen, _PhiGen; // from the generator: energy, eta, phi
    157172
    158173  ClassDef(TRootParticle, 1)
     
    165180
    166181public:
    167   TRootGenParticle() {};
     182  TRootGenParticle() {_initialised=false;}
    168183  int PID; // particle HEP ID number [RawHepEventParticle::pid()]
    169184  int Status; // particle status [RawHepEventParticle::status()]
     
    172187  int D1; // particle 1st daughter [RawHepEventParticle::daughter1() - 1]
    173188  int D2; // particle 2nd daughter [RawHepEventParticle::daughter2() - 1]
    174   float Charge; // electrical charge
    175189
    176190  float T; // particle vertex position (t component) [RawHepEventParticle::t()]
     
    179193  float Z; // particle vertex position (z component) [RawHepEventParticle::z()]
    180194  float M;
    181   static TCompare *fgCompare; //!
    182 
     195  void setFractions();
     196  const float getCharge() const {return Charge;};
     197  const float getFem()  {if(!_initialised) setFractions(); return _Fem;}
     198  const float getFhad() {if(!_initialised) setFractions(); return _Fhad;}
     199
     200  float Charge;      // electrical charge
     201
     202  static TCompare *fgCompare; //!
     203 protected:
     204  float _Fem, _Fhad; // fractions of energy deposit
     205  bool _initialised;
    183206  ClassDef(TRootGenParticle, 1)
    184207};
     208
    185209
    186210//------------------------------------------------------------------------------
     
    225249//---------------------------------------------------------------------------
    226250
    227 class TRootTracks: public TRootParticle
    228 {
    229 public:
    230   TRootTracks() : Etaout(0), Phiout(0) {};
    231   static TCompare *fgCompare; //!
    232  
     251class D_Track : public TSortableObject {
     252//class D_Track : public TRootParticle {
     253 public:
     254    D_Track(); // needed for storage in ExRootAnalysis
     255    D_Track(const D_Track& track);
     256    D_Track(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt);
     257    D_Track& operator=(const D_Track& track);
     258    void Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt);
     259    const TLorentzVector GetFourVector() const;
     260    const float getEta() const {return Eta;}
     261    const float getPhi() const {return Phi;}
     262    const float getEtaOuter() const {return EtaOuter;}
     263    const float getPhiOuter() const {return PhiOuter;}
     264    const float getE() const {return E;}
     265    const float getPx() const {return Px;}
     266    const float getPy() const {return Py;}
     267    const float getPz() const {return Pz;}
     268    const float getPT() const {return PT;}
     269
     270  static TCompare *fgCompare; //!
     271  const TCompare *GetCompare() const { return fgCompare; }
     272 protected:
     273    float Eta, Phi; // (eta,phi) at the beginning of the track
     274    float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
     275    float PT, E, Px, Py, Pz;  // transverse momentum
     276 ClassDef(D_Track, 1)
     277};
     278
     279
     280class TRootTracks: public TRootParticle  {
     281public:
     282  TRootTracks() {} // : Etaout(0), Phiout(0) {};
     283  static TCompare *fgCompare; //!
     284  TRootTracks(const D_Track& track);
     285  float E;  // particle energy in GeV
     286  float Px; // particle momentum vector (x component) in GeV
     287  float Py; // particle momentum vector (y component) in GeV
     288  float Pz; // particle momentum vector (z component) in GeV
     289
     290  float Eta; // particle pseudorapidity
     291  float Phi; // particle azimuthal angle in rad
     292
     293  float EtaCalo; // particle pseudorapidity when entering the calo,
     294  float PhiCalo; // particle azimuthal angle in rad when entering the calo
    233295//  float X, Y, Z; // coordinates of the beginning of the track
    234296//  float Xout, Yout, Zout; // coordinates of the end of the track
    235   float Etaout, Phiout; // coordinates of the end of the track
     297  //float Etaout, Phiout; // coordinates of the end of the track
    236298//  void SetPosition(const float x, const float y, const float z) {X=x; Y=y; Z=z;}
    237299//  void SetPositionOut(const float x, const float y, const float z) {Xout=x; Yout=y; Zout=z;}
     
    241303//---------------------------------------------------------------------------
    242304
    243 class TRootCalo: public TRootParticle
    244 {
     305/*class TRootCalo: public TRootParticle
    245306public:
    246307  TRootCalo() {};
     
    248309
    249310  ClassDef(TRootCalo, 1)
     311};
     312*/
     313
     314//class TRootCalo: public TSortableObject {
     315class TRootCalo: public TRootParticle {
     316 public:
     317   TRootCalo() ;
     318   TRootCalo(const TRootCalo& cal);
     319   TRootCalo& operator=(const TRootCalo& cal);
     320   void set(const D_CaloTower&  cal);
     321   static TCompare *fgCompare; //!
     322 //  const TCompare *GetCompare() const { return fgCompare; }
     323   const float getET() const {return ET;}
     324 
     325 protected:
     326    //float Eta, Phi;    // segmented eta, phi
     327    float E_em, E_had; // electromagnetic and hadronic components of the tower energy
     328    //float E;
     329    float ET;       // total energy and transverse energy   
     330   ClassDef(TRootCalo, 1)
    250331};
    251332
     
    340421};
    341422
    342 //---------------------------------------------------------------------------
    343 
    344423#endif // BLOCKCLASSES_H
    345424
  • trunk/Utilities/ExRootAnalysis/src/BlockClasses.cc

    r220 r264  
    1111 *  to preserve mother-dautherlinks between particles.
    1212 *
    13  *  $Date: 2009-02-02 11:32:01 $
    14  *  $Revision: 1.7 $
     13 *  $Date: 2009-02-11 09:19:14 $
     14 *  $Revision: 1.8 $
    1515 *
    1616 * 
     
    2222#include "BlockCompare.h"
    2323#include "TLorentzVector.h"
     24#include <cmath>
    2425
    2526TCompare *TRootGenParticle::fgCompare = 0;
     
    3839TCompare *TRootRomanPotHits::fgCompare =0;
    3940TCompare *TRootTrigger::fgCompare =0;
     41//TCompare *D_CaloTower::fgCompare=0;
     42TCompare *D_Track::fgCompare=0;
    4043
    4144void TRootParticle::Set(const TLorentzVector& momentum) {
     
    6164}
    6265
     66void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
     67   Eta = eta; Phi = phi; E = e; PT = et;
     68   //float theta = 2* atan(exp(-Eta);
     69   Px = PT*cos(Phi);
     70   Py = PT*sin(Phi);
     71}
    6372
     73
     74void TRootGenParticle::setFractions() {
     75  switch(abs(PID)) {
     76    default:  _Fem = 0; _Fhad=1; break;
     77    case(pE):
     78    case(pGAMMA):
     79    case(pPI0):
     80        _Fem = 1; _Fhad=0; break;
     81    case(pNU1):
     82    case(pNU2):
     83    case(pNU3):
     84    case(pMU):
     85        _Fem =0; _Fhad=0; break;
     86    case(pK0S):
     87    case(pLAMBDA):
     88        _Fem=0.3; _Fhad=0.7; break;
     89  }
     90  _initialised=true;
     91}
     92
     93    float Eta, Phi; // (eta,phi) at the beginning of the track
     94    float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
     95    float PT, E, Px, Py, Pz;
     96
     97D_Track::D_Track() :
     98        Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
     99        PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED) {}
     100
     101D_Track::D_Track(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
     102        Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
     103        PT(pt) {
     104        TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
     105        Px = p.Px(); Py = p.Py(); Pz = p.Pz();  E=p.E();
     106}
     107
     108D_Track::D_Track(const D_Track& track) :
     109        Eta(track.Eta), Phi(track.Phi),
     110        EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
     111        PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz) {}
     112
     113D_Track& D_Track::operator=(const D_Track& track) {
     114  if(this == &track) return *this;
     115        Eta = track.Eta;             Phi = track.Phi;
     116        EtaOuter = track.EtaOuter;   PhiOuter = track.PhiOuter;
     117        PT = track.PT; E = track.E;  Px = track.Px;  Py= track.Py; Pz =track.Pz;
     118  return *this;
     119}
     120
     121void D_Track::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) {
     122        Eta= inEta; Phi=inPhi;  EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
     123        TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
     124        Px = p.Px(); Py = p.Py(); Pz = p.Pz();  E=p.E();
     125}
     126
     127const TLorentzVector D_Track::GetFourVector() const {
     128        TLorentzVector v;
     129        v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
     130        return TLorentzVector(v);
     131}
     132
     133TRootCalo::TRootCalo() :
     134        E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
     135        //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
     136
     137TRootCalo::TRootCalo(const TRootCalo& cal) {
     138        E_em=cal.E_em; E_had=cal.E_had;  ET=cal.ET;
     139        //Eta =cal.Eta;  Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had;  E=cal.E;   ET=cal.ET;
     140}
     141
     142TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
     143   if(this==&cal) return *this;
     144        Eta =cal.Eta;  Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had;  E=cal.E;   ET=cal.ET;
     145   return *this;
     146}
     147
     148void TRootCalo::set(const D_CaloTower& cal) {
     149        Eta =cal.getEta(); Phi=cal.getPhi();
     150        E_em=cal.getEem(); E_had=cal.getEhad();
     151        E   =cal.getE();   ET   =cal.getET();
     152        EtaCalo = cal.getEta();
     153        PhiCalo = cal.getPhi();
     154}
     155
     156
     157TRootTracks::TRootTracks(const D_Track& track) :
     158   E(track.getE()), Px(track.getPx()), Py(track.getPy()), Pz(track.getPz()),
     159   Eta(track.getEta()), Phi(track.getPhi()),
     160   /*Etaout(track.getEtaOuter()),*/ EtaCalo(track.getEtaOuter()), /*Phiout(track.getPhiOuter()),*/ PhiCalo(track.getPhiOuter()) {}
     161
  • trunk/Utilities/ExRootAnalysis/src/BlockClassesLinkDef.h

    r67 r264  
    44 *  Lists classes to be included in cint dicitonary
    55 *
    6  *  $Date: 2008-12-02 11:14:45 $
    7  *  $Revision: 1.2 $
     6 *  $Date: 2009-02-11 09:19:14 $
     7 *  $Revision: 1.3 $
    88 *
    99 * 
     
    1313
    1414#include "Utilities/ExRootAnalysis/interface/BlockClasses.h"
     15#include "interface/D_Constants.h"
    1516
    1617#ifdef __CINT__
     
    3940#pragma link C++ class TRootLHEFEvent+;
    4041#pragma link C++ class TRootLHEFParticle+;
     42#pragma link C++ class D_Track+;
     43//#pragma link C++ class D_CaloTower+;
    4144
    4245
Note: See TracChangeset for help on using the changeset viewer.