Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CandReco.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandReco.cxx,v 1.19 2005/02/02 11:38:35 tagg Exp $
00003 //
00004 // CandReco.cxx
00005 //
00006 // This is an abstract Event Candidate (Reconstruction) object.
00007 // CandReco is descended from CandBase.  This class should and cannot
00008 // be instantiated.
00009 //
00010 // Each concrete CandBase must define a Dup function.
00011 // CandBase must grant friendship to class CandRefer.
00012 //
00013 // Author:  R. Lee
00015 
00016 #include "TClass.h"
00017 
00018 #include "Algorithm/AlgHandle.h"
00019 #include "MessageService/MsgService.h"
00020 #include "MessageService/MsgFormat.h"
00021 #include "RecoBase/CandReco.h"
00022 #include "RecoBase/CandSliceHandle.h"
00023 #include "RecoBase/CandStripHandle.h"
00024 #include "Conventions/Munits.h"
00025 
00026 ClassImp(CandReco)
00027 
00028 //______________________________________________________________________
00029 CVSID("$Id: CandReco.cxx,v 1.19 2005/02/02 11:38:35 tagg Exp $");
00030 
00031 #include "Candidate/CandBase.tpl"
00032 
00033 //______________________________________________________________________
00034 CandReco::CandReco() :
00035   fCandSlice(0)
00036 , fVtxDirCosU(0.)
00037 , fVtxDirCosV(0.)
00038 , fVtxDirCosZ(0.)
00039 , fEndDirCosU(0.)
00040 , fEndDirCosV(0.)
00041 , fEndDirCosZ(0.)
00042 , fTimeSlope(0.)
00043 , fTimeOffset(0.)
00044 {
00045   MSG("Cand", Msg::kDebug)
00046                           << "Begin CandReco::CandReco() ctor: " << endl
00047                                            << "UidInt = " << GetUidInt()
00048                            << ", ArchUidInt " << GetArchUidInt() << endl
00049                              << "No. of links = " << GetNLinks() << endl
00050                             << "End CandReco::CandReco() ctor." << endl;
00051 }
00052 
00053 //______________________________________________________________________
00054 CandReco::CandReco(AlgHandle &ah) :
00055   CandBase(ah)       // Should be the next class up on inheritance chain
00056 , fCandSlice(0)
00057 , fVtxDirCosU(0.)
00058 , fVtxDirCosV(0.)
00059 , fVtxDirCosZ(0.)
00060 , fEndDirCosU(0.)
00061 , fEndDirCosV(0.)
00062 , fEndDirCosZ(0.)
00063 , fTimeSlope(0.)
00064 , fTimeOffset(0.)
00065 {
00066 
00067 // The sole purpose of this constructor is to transmit the AlgHandle
00068 // up the inheritance chain to CandBase without having to invoke the
00069 // full constructor of an intermediate Candidate type which the highest
00070 // level Candidate might inherit from.  One only wants to create the
00071 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00072 }
00073 
00074 //______________________________________________________________________
00075 CandReco::CandReco(const CandReco &rhs) :
00076   CandBase(rhs)      // Should be the next class up on inheritance chain
00077 , fCandSlice(0)
00078 , fVertex(rhs.fVertex)
00079 , fVtxDirCosU(rhs.fVtxDirCosU)
00080 , fVtxDirCosV(rhs.fVtxDirCosV)
00081 , fVtxDirCosZ(rhs.fVtxDirCosZ)
00082 , fTerm(rhs.fTerm)
00083 , fEndDirCosU(rhs.fEndDirCosU)
00084 , fEndDirCosV(rhs.fEndDirCosV)
00085 , fEndDirCosZ(rhs.fEndDirCosZ)
00086 , fTimeSlope(rhs.fTimeSlope)
00087 , fTimeOffset(rhs.fTimeOffset)
00088 {
00089 
00090 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
00091   MSG("Cand", Msg::kDebug)
00092        << "Begin CandReco::CandReco(const CandReco &rhs) ctor: " << endl
00093                                            << "UidInt = " << GetUidInt()
00094                            << ", ArchUidInt " << GetArchUidInt() << endl
00095                              << "No. of links = " << GetNLinks() << endl
00096          << "Term CandReco::CandReco(const CandReco &rhs) ctor." << endl;
00097 
00098   if (rhs.fCandSlice)                       // Make an owned CandHandle*
00099     fCandSlice = (rhs.fCandSlice)->DupHandle();
00100 
00101   fSigMapped.erase(fSigMapped.begin(),fSigMapped.end());
00102   fMIP.erase(fMIP.begin(),fMIP.end());
00103   TIter stripItr(rhs.GetDaughterIterator());
00104   while (const CandStripHandle *strip =
00105                            dynamic_cast<CandStripHandle*>(stripItr())) {
00106     if (strip->GetNDigit(StripEnd::kNegative)>0) {
00107       Int_t encodedNegative =
00108                  strip->GetStripEndId(StripEnd::kNegative).GetEncoded();
00109       fSigMapped[encodedNegative] = rhs.fSigMapped[encodedNegative];
00110       fMIP[encodedNegative] = rhs.fMIP[encodedNegative];
00111     }
00112     if (strip->GetNDigit(StripEnd::kPositive)>0) {
00113       Int_t encodedPositive =
00114                  strip->GetStripEndId(StripEnd::kPositive).GetEncoded();
00115       fSigMapped[encodedPositive] = rhs.fSigMapped[encodedPositive];
00116       fMIP[encodedPositive] = rhs.fMIP[encodedPositive];
00117     }
00118   }
00119 }
00120 
00121 //______________________________________________________________________
00122 CandReco::~CandReco()
00123 {
00124   MSG("Cand", Msg::kDebug)
00125                          << "Begin CandReco::~CandReco() dtor: " << endl
00126                                            << "UidInt = " << GetUidInt()
00127                            << ", ArchUidInt " << GetArchUidInt() << endl
00128                              << "No. of links = " << GetNLinks() << endl
00129                            << "End CandReco::~CandReco() dtor." << endl;
00130 
00131 // fCandSlice is an owned CandHandle* starting at CandReco version 3
00132    delete fCandSlice;
00133 }
00134 
00135 //______________________________________________________________________
00136 Bool_t CandReco::IsEquivalent(const TObject *rhs) const
00137 {
00138   Bool_t result = true;
00139   if (!CandBase::IsEquivalent(rhs)) result = false;   // superclass test
00140   TestDisplayCandBanner("CandReco");
00141   const CandReco* rCnd = dynamic_cast<const CandReco*>(rhs);
00142   if (rCnd == NULL) return false;
00143 
00144   result = TestCandHandleDup("fCandSlice",
00145                                        this->fCandSlice,
00146                                        rCnd->fCandSlice)  && result;
00147   result = TestEquality("fVertex",     this->fVertex,
00148                                        rCnd->fVertex)     && result;
00149   result = TestEquality("fTerm",     this->fTerm,
00150                                        rCnd->fTerm)     && result;
00151   result = TestEquality("fVtxDirCosU",    this->fVtxDirCosU,
00152                                        rCnd->fVtxDirCosU)    && result;
00153   result = TestEquality("fVtxDirCosV",    this->fVtxDirCosV,
00154                                        rCnd->fVtxDirCosV)    && result;
00155   result = TestEquality("fVtxDirCosZ",    this->fVtxDirCosZ,
00156                                        rCnd->fVtxDirCosZ)    && result;
00157   result = TestEquality("fEndDirCosU",    this->fEndDirCosU,
00158                                        rCnd->fEndDirCosU)    && result;
00159   result = TestEquality("fEndDirCosV",    this->fEndDirCosV,
00160                                        rCnd->fEndDirCosV)    && result;
00161   result = TestEquality("fEndDirCosZ",    this->fEndDirCosZ,
00162                                        rCnd->fEndDirCosZ)    && result;
00163   result = TestEquality("fTimeSlope",  this->fTimeSlope,
00164                                        rCnd->fTimeSlope)  && result;
00165   result = TestEquality("fTimeOffset", this->fTimeOffset,
00166                                        rCnd->fTimeOffset) && result;
00167   result = TestEquality("fSigMapped",  this->fSigMapped,
00168                                        rCnd->fSigMapped)  && result;
00169   result = TestEquality("fMIP",        this->fMIP,
00170                                        rCnd->fMIP)        && result;
00171 
00172   return result;
00173 }
00174 
00175 //______________________________________________________________________
00176 std::ostream& CandReco::FormatToOStream(std::ostream& os,
00177                                         Option_t *option) const
00178 {
00179   CandBase::FormatToOStream(os,option);
00180 
00181   TString opt(option);
00182   if (!opt.Contains("v0")) { // v0 means suppress the data values
00183     const TString& indent = GetIndentString();
00184 
00185     static MsgFormat timefmt("f10.9");
00186     os << indent << GetDataIndent()
00187        << "Vertex " << fVertex.AsString()
00188        << endl;    os << indent << GetDataIndent()
00189        << "Term " << fTerm.AsString()
00190        << endl;
00191     os << indent << GetDataIndent()
00192        << "Vertex DirCos: U=" << fVtxDirCosU
00193        << " V=" << fVtxDirCosV
00194        << " Z=" << fVtxDirCosZ
00195        << " Term DirCos: U=" << fEndDirCosU
00196        << " V=" << fEndDirCosV
00197        << " Z=" << fEndDirCosZ
00198        << endl
00199        << indent << GetDataIndent()
00200        << "Time(ns) Slope=" << fTimeSlope/Munits::ns
00201        << " Offset=" << fTimeOffset/Munits::ns
00202        << endl;
00203   }
00204   return os;
00205   
00206 }
00207 
00208 //______________________________________________________________________
00209 void CandReco::Streamer(TBuffer &R__b)
00210 {
00211 
00212 // Stream an object of class CandReco.
00213   if (R__b.IsReading()) {
00214     UInt_t R__s, R__c;
00215     Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00216     CandReco::Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
00217     if (R__v < 3) {
00218       if (fCandSlice) fCandSlice = fCandSlice->DupHandle();
00219     }
00220   }
00221   else {
00222     CandReco::Class()->WriteBuffer(R__b, this);
00223   }
00224 }
00225 
00226 //______________________________________________________________________

Generated on Mon Feb 15 11:06:28 2010 for loon by  doxygen 1.3.9.1