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

CandShowerEM.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandShowerEM.cxx,v 1.4 2005/09/26 09:24:26 cbs Exp $
00003 //
00004 // CandShowerEM
00005 //
00007 
00008 #include "TClass.h"
00009 
00010 #include "Algorithm/AlgHandle.h"
00011 #include "CandShowerEM/CandShowerEM.h"
00012 #include "CandShowerEM/CandShowerEMHandle.h"
00013 #include "MessageService/MsgService.h"
00014 
00015 ClassImp(CandShowerEM)
00016 
00017 //______________________________________________________________________
00018 CVSID("$Id: CandShowerEM.cxx,v 1.4 2005/09/26 09:24:26 cbs Exp $");
00019 
00020 //______________________________________________________________________
00021 CandShowerEM::CandShowerEM() 
00022   : ShwStatus(-1)
00023 {
00024   MSG("Cand", Msg::kDebug)
00025     << "Begin CandShowerEM::CandShowerEM() ctor: " << endl
00026     << "UidInt = " << GetUidInt()
00027     << ", ArchUidInt " << GetArchUidInt() << endl
00028     << "No. of links = " << GetNLinks() << endl
00029     << "End CandShowerEM::CandShowerEM() ctor." << endl;
00030   
00031   for(int i=0;i<8;i++) {
00032     EigenVector[i]=0;
00033     if(i<5) {
00034       OutPH[i]=0;
00035       if(i<4) {
00036         EigenValue[i]=0; 
00037         AvgDev[i]=0;
00038       }
00039     }
00040   }
00041   
00042 }
00043 
00044 //______________________________________________________________________
00045 CandShowerEM::CandShowerEM(AlgHandle &ah) :
00046   CandShower(ah)     // Should be the next class up on inheritance chain
00047   ,ShwStatus(-1)
00048 {
00049 
00050 // The sole purpose of this constructor is to transmit the AlgHandle
00051 // up the inheritance chain to CandBase without having to invoke the
00052 // full constructor of an intermediate Candidate type which the highest
00053 // level Candidate might inherit from.  One only wants to create the
00054 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00055 
00056   for(int i=0;i<8;i++) {
00057     EigenVector[i]=0;
00058     if(i<5) {
00059       OutPH[i]=0;
00060       if(i<4) {
00061         EigenValue[i]=0;
00062         AvgDev[i]=0;
00063       }
00064     }
00065   }
00066 
00067 }
00068 
00069 //______________________________________________________________________
00070 CandShowerEM::CandShowerEM(AlgHandle &ah, CandHandle &ch,
00071                            CandContext &cx) :
00072   CandShower(ah)     // Should be the next class up on inheritance chain
00073   ,ShwStatus(-1)
00074 {
00075   CreateLocalHandle();
00076   MSG("Cand", Msg::kDebug)
00077        << "Begin CandShowerEM::CandShowerEM(AlgHandle &, CandHandle &, "
00078                                       << "CandContext &) ctor: " << endl
00079                                            << "UidInt = " << GetUidInt()
00080                            << ", ArchUidInt " << GetArchUidInt() << endl
00081                              << "No. of links = " << GetNLinks() << endl
00082          << "End CandShowerEM::CandShowerEM(AlgHandle &, CandHandle &, "
00083                                       << "CandContext &) ctor." << endl;
00084 
00085   for(int i=0;i<8;i++) {
00086     EigenVector[i]=0;
00087     if(i<5) {
00088       OutPH[i]=0;
00089       if(i<4) {
00090         EigenValue[i]=0;
00091         AvgDev[i]=0;
00092       }
00093     }
00094   }
00095   
00096   // Run Algorithm to construct Candidate
00097   {                                                    // Start of scope
00098     CandShowerEMHandle csh(this);            // csh will go out of scope
00099     ch = csh;                                       // after setting ch.
00100   }                                                      // End of scope
00101   ah.RunAlg(ch, cx);
00102 
00103 }
00104 
00105 //______________________________________________________________________
00106 CandShowerEM::CandShowerEM(const CandShowerEM &rhs) :
00107   CandShower(rhs)    // Should be the next class up on inheritance chain
00108   ,ShwStatus(-1)
00109 {
00110 
00111   MSG("Cand", Msg::kDebug)
00112     << "Begin CandShowerEM::CandShowerEM(const CandShowerEM &rhs) ctor:"
00113                                    << endl << "UidInt = " << GetUidInt()
00114                            << ", ArchUidInt " << GetArchUidInt() << endl
00115                              << "No. of links = " << GetNLinks() << endl
00116       << "End CandShowerEM::CandShowerEM(const CandShowerEM &rhs) ctor."
00117                                                                 << endl;
00118 
00119   for(int i=0;i<8;i++) {
00120     EigenVector[i] = rhs.EigenVector[i];
00121     if(i<5) {
00122       OutPH[i] = rhs.OutPH[i];
00123       if(i<4){
00124         EigenValue[i] = rhs.EigenValue[i]; 
00125         AvgDev[i] = rhs.AvgDev[i]; 
00126       }
00127     }
00128   } 
00129   ShwStatus = rhs.ShwStatus;
00130 
00131 }
00132 
00133 //______________________________________________________________________
00134 CandShowerEM::~CandShowerEM()
00135 {
00136   MSG("Cand", Msg::kDebug)
00137                  << "Begin CandShowerEM::~CandShowerEM() dtor: " << endl
00138                                            << "UidInt = " << GetUidInt()
00139                            << ", ArchUidInt " << GetArchUidInt() << endl
00140                              << "No. of links = " << GetNLinks() << endl
00141                    << "End CandShowerEM::~CandShowerEM() dtor." << endl;
00142 
00143 }
00144 
00145 //______________________________________________________________________
00146 void CandShowerEM::CreateLocalHandle()
00147 {
00148   SetLocalHandle(new CandShowerEMHandle(this));
00149 }
00150 
00151 //______________________________________________________________________
00152 CandShowerEM *CandShowerEM::Dup() const
00153 {
00154 
00155 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00156 // Daughter List copy is made in the derived class Dup() function.
00157 // This is because base class copy constructor hasn't yet created
00158 // fLocalHandle with a CandHandle* of the full derived type.
00159   CandShowerEM *cb = new CandShowerEM(*this);     // Copy-ctor dups ptrs
00160   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00161   TIter iterdau = GetDaughterIterator();
00162   CandHandle *dau;
00163   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00164   return cb;
00165 }
00166 
00167 //______________________________________________________________________
00168 Bool_t CandShowerEM::IsEquivalent(const TObject *rhs) const
00169 {
00170   Bool_t result = true;
00171   if (!CandShower::IsEquivalent(rhs)) result = false; // superclass test
00172   TestDisplayCandBanner("CandShowerEM");
00173   const CandShowerEM* rCnd = dynamic_cast<const CandShowerEM*>(rhs);
00174   if (rCnd == NULL) return false;
00175   
00176   if(dynamic_cast<const CandShowerEM*>(rhs)->ShwStatus!=ShwStatus) 
00177     return false;
00178 
00179   for(int i=0;i<8;i++){
00180 
00181     if(dynamic_cast<const CandShowerEM*>(rhs)->EigenVector[i]!=EigenVector[i]) 
00182       return false;
00183 
00184     if(i<5) {
00185 
00186       if(dynamic_cast<const CandShowerEM*>(rhs)->EigenValue[i]!=EigenValue[i]) 
00187         return false;
00188 
00189       if(i<4) {
00190 
00191         if(dynamic_cast<const CandShowerEM*>(rhs)->AvgDev[i]!=AvgDev[i]) 
00192           return false;
00193         
00194         if(dynamic_cast<const CandShowerEM*>(rhs)->OutPH[i]!=OutPH[i]) 
00195           return false;      
00196 
00197       }
00198     }
00199   }
00200 
00201   return result;
00202 }
00203 
00204 //______________________________________________________________________
00205 CandShowerEMHandle CandShowerEM::MakeCandidate(AlgHandle &ah,
00206                                                         CandContext &cx)
00207 {
00208   CandShowerEMHandle csh;
00209   new CandShowerEM(ah, csh, cx);        // csh owns the new CandShowerEM
00210   return csh;
00211 }
00212 

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