[1] | 1 | |
---|
| 2 | /** |
---|
| 3 | * |
---|
| 4 | * Definition of classes to be stored in the root tree. |
---|
| 5 | * Function CompareXYZ sorts objects by the variable XYZ that MUST be |
---|
| 6 | * present in the data members of the root tree class of the branch. |
---|
| 7 | * |
---|
| 8 | * $Date: 2008-06-04 13:57:24 $ |
---|
| 9 | * $Revision: 1.1 $ |
---|
| 10 | * |
---|
| 11 | * |
---|
| 12 | * \author P. Demin - UCL, Louvain-la-Neuve |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #include "classes/DelphesClasses.h" |
---|
| 17 | |
---|
| 18 | #include "classes/DelphesFactory.h" |
---|
| 19 | #include "classes/SortableObject.h" |
---|
| 20 | |
---|
| 21 | CompBase *GenParticle::fgCompare = 0; |
---|
| 22 | CompBase *Photon::fgCompare = CompPT<Photon>::Instance(); |
---|
| 23 | CompBase *Electron::fgCompare = CompPT<Electron>::Instance(); |
---|
| 24 | CompBase *Muon::fgCompare = CompPT<Muon>::Instance(); |
---|
| 25 | CompBase *TauJet::fgCompare = CompPT<TauJet>::Instance(); |
---|
| 26 | CompBase *Jet::fgCompare = CompPT<Jet>::Instance(); |
---|
| 27 | CompBase *Track::fgCompare = CompPT<Track>::Instance(); |
---|
| 28 | CompBase *Tower::fgCompare = CompE<Tower>::Instance(); |
---|
| 29 | CompBase *Candidate::fgCompare = 0; |
---|
| 30 | |
---|
| 31 | //------------------------------------------------------------------------------ |
---|
| 32 | |
---|
| 33 | Candidate::Candidate() : |
---|
| 34 | PID(0), Status(0), M1(0), M2(0), D1(0), D2(0), |
---|
| 35 | Charge(0), Mass(0.0), BTag(0), Eem(0.0), Ehad(0.0), |
---|
| 36 | Momentum(0.0, 0.0, 0.0, 0.0), |
---|
| 37 | Position(0.0, 0.0, 0.0, 0.0), |
---|
| 38 | Mother(0), |
---|
| 39 | fFactory(0), |
---|
| 40 | fArray(0) |
---|
| 41 | { |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | //------------------------------------------------------------------------------ |
---|
| 45 | |
---|
| 46 | void Candidate::AddCandidate(Candidate *object) |
---|
| 47 | { |
---|
| 48 | if(!fArray) fArray = fFactory->NewArray(); |
---|
| 49 | fArray->Add(object); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | //------------------------------------------------------------------------------ |
---|
| 53 | |
---|
| 54 | TObject *Candidate::Clone(const char *newname) const |
---|
| 55 | { |
---|
| 56 | Candidate *object = fFactory->NewCandidate(); |
---|
| 57 | Copy(*object); |
---|
| 58 | return object; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | //------------------------------------------------------------------------------ |
---|
| 62 | |
---|
| 63 | void Candidate::Copy(TObject &obj) const |
---|
| 64 | { |
---|
| 65 | Candidate &object = static_cast<Candidate &>(obj); |
---|
| 66 | |
---|
| 67 | object.PID = PID; |
---|
| 68 | object.Status = Status; |
---|
| 69 | object.M1 = M1; |
---|
| 70 | object.M2 = M2; |
---|
| 71 | object.D1 = D1; |
---|
| 72 | object.D2 = D2; |
---|
| 73 | object.Charge = Charge; |
---|
| 74 | object.Mass = Mass; |
---|
| 75 | object.BTag = BTag; |
---|
| 76 | object.Eem = Eem; |
---|
| 77 | object.Ehad = Ehad; |
---|
| 78 | object.Momentum = Momentum; |
---|
| 79 | object.Position = Position; |
---|
| 80 | |
---|
| 81 | object.fFactory = fFactory; |
---|
| 82 | object.fArray = 0; |
---|
| 83 | |
---|
| 84 | const Candidate *candidateOld; |
---|
| 85 | Candidate *candidateNew; |
---|
| 86 | |
---|
| 87 | if(fArray && fArray->GetEntriesFast() > 0) |
---|
| 88 | { |
---|
| 89 | TIter itArray(fArray); |
---|
| 90 | object.fArray = fFactory->NewArray(); |
---|
| 91 | |
---|
| 92 | while((candidateOld = static_cast<Candidate *>(itArray.Next()))) |
---|
| 93 | { |
---|
| 94 | candidateNew = static_cast<Candidate *>(candidateOld->Clone()); |
---|
| 95 | object.fArray->Add(candidateNew); |
---|
| 96 | } |
---|
| 97 | } |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | //------------------------------------------------------------------------------ |
---|
| 101 | |
---|
| 102 | void Candidate::Clear(Option_t* option) |
---|
| 103 | { |
---|
| 104 | SetUniqueID(0); |
---|
| 105 | PID = 0; |
---|
| 106 | Status = 0; |
---|
| 107 | M1 = 0; M2 = 0; D1 = 0; D2 = 0; |
---|
| 108 | Charge = 0; |
---|
| 109 | Mass = 0.0; |
---|
| 110 | BTag = 0; |
---|
| 111 | Eem = 0.0; |
---|
| 112 | Ehad = 0.0; |
---|
| 113 | Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0); |
---|
| 114 | Position.SetXYZT(0.0, 0.0, 0.0, 0.0); |
---|
| 115 | Mother = 0; |
---|
| 116 | fArray = 0; |
---|
| 117 | } |
---|