Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:37

0001 #ifndef MuScleFitMuon_h
0002 #define MuScleFitMuon_h
0003 
0004 #include "TObject.h"
0005 #include "DataFormats/Candidate/interface/Particle.h"
0006 #include "TLorentzVector.h"
0007 
0008 #include <iostream>
0009 
0010 //Adding a stupid comment
0011 // Another one
0012 typedef reco::Particle::LorentzVector lorentzVector;
0013 
0014 class MuScleFitMuon : public TObject {
0015 public:
0016   MuScleFitMuon()
0017       : fP4(lorentzVector(0., 0., 0., 0.)),
0018         fCharge(0),  //+1 or -1
0019         fPtError(0.),
0020         fHitsMuon(0),
0021         fHitsTk(0) {}
0022 
0023   MuScleFitMuon(const lorentzVector& initP4,
0024                 const int initCharge = -1,
0025                 const double initPtError = 0,
0026                 const unsigned int initHitsTk = 0,
0027                 const unsigned int initHitsMuon = 0)
0028       : fP4(initP4), fCharge(initCharge), fPtError(initPtError), fHitsMuon(initHitsMuon), fHitsTk(initHitsTk) {}
0029 
0030   /// Used to copy the content of another MuScleFitMuon
0031   void copy(const MuScleFitMuon& copyMuon) {
0032     fP4 = copyMuon.p4();
0033     fPtError = copyMuon.ptError();
0034     fCharge = copyMuon.charge();
0035     fHitsMuon = copyMuon.hitsMuon();
0036     fHitsTk = copyMuon.hitsTk();
0037   }
0038 
0039   // Getters
0040   lorentzVector p4() const { return fP4; }
0041   Int_t charge() const { return fCharge; }
0042   Double_t ptError() const { return fPtError; }
0043   UInt_t hitsMuon() const { return fHitsMuon; }
0044   UInt_t hitsTk() const { return fHitsTk; }
0045 
0046   // Dummy functions to create compatibility with calls to lorentzVector
0047   Float_t x() const { return fP4.x(); }
0048   Float_t y() const { return fP4.y(); }
0049   Float_t z() const { return fP4.z(); }
0050   Float_t t() const { return fP4.t(); }
0051   Float_t e() const { return fP4.e(); }
0052 
0053   Float_t E() const { return fP4.E(); }
0054   Float_t energy() const { return fP4.energy(); }
0055   Float_t Pt() const { return fP4.Pt(); }
0056   Float_t Eta() const { return fP4.Eta(); }
0057   Float_t Phi() const { return fP4.Phi(); }
0058 
0059   Float_t pt() const { return fP4.pt(); }
0060   Float_t eta() const { return fP4.eta(); }
0061   Float_t phi() const { return fP4.phi(); }
0062 
0063   friend std::ostream& operator<<(std::ostream& stream, const MuScleFitMuon& mu) {
0064     stream << "p4 = " << mu.p4() << ", q = " << mu.charge() << ", ptError = " << mu.ptError()
0065            << ", hitsTk = " << mu.hitsTk() << ", hitsMuon = " << mu.hitsMuon();
0066     return stream;
0067   }
0068 
0069   lorentzVector fP4;
0070   Int_t fCharge;
0071   Double_t fPtError;
0072   UInt_t fHitsMuon;
0073   UInt_t fHitsTk;
0074 
0075   ClassDef(MuScleFitMuon, 2)
0076 };
0077 ClassImp(MuScleFitMuon);
0078 
0079 #endif