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

AlgShowerEMList.cxx

Go to the documentation of this file.
00001 
00002 // $Id: AlgShowerEMList.cxx,v 1.4 2004/09/28 23:47:27 cbs Exp $
00003 //
00004 // AlgShowerEMList.cxx
00005 //
00006 // AlgShowerEMList is a concrete ShowerEMList Algorithm class.
00008 
00009 #include <cassert>
00010 
00011 #include "Algorithm/AlgFactory.h"
00012 #include "Algorithm/AlgHandle.h"
00013 #include "Algorithm/AlgConfig.h"
00014 #include "Candidate/CandContext.h"
00015 #include "CandShowerEM/AlgShowerEMList.h"
00016 #include "CandShowerEM/CandShowerEM.h"
00017 #include "CandShowerEM/CandShowerEM.h"
00018 #include "CandShowerEM/CandShowerEMHandle.h"
00019 #include "CandShowerEM/CandShowerEMList.h"
00020 #include "CandShowerEM/CandShowerEMListHandle.h"
00021 #include "Conventions/PlaneView.h"
00022 #include "MessageService/MsgService.h"
00023 #include "MinosObjectMap/MomNavigator.h"
00024 #include "Navigation/NavKey.h"
00025 #include "Navigation/NavSet.h"
00026 #include "RecoBase/CandClusterHandle.h"
00027 #include "RecoBase/CandClusterListHandle.h"
00028 #include "RecoBase/CandShowerHandle.h"
00029 #include "RecoBase/CandSliceHandle.h"
00030 #include "RecoBase/CandSliceListHandle.h"
00031 #include "UgliGeometry/UgliGeomHandle.h"
00032 #include "Validity/VldContext.h"
00033 
00034 ClassImp(AlgShowerEMList)
00035 
00036 //______________________________________________________________________
00037 CVSID("$Id: AlgShowerEMList.cxx,v 1.4 2004/09/28 23:47:27 cbs Exp $");
00038 
00039 //______________________________________________________________________
00040 AlgShowerEMList::AlgShowerEMList()
00041 {
00042 }
00043 
00044 //______________________________________________________________________
00045 AlgShowerEMList::~AlgShowerEMList()
00046 {
00047 }
00048 
00049 //______________________________________________________________________
00050 void AlgShowerEMList::RunAlg(AlgConfig &ac, CandHandle &ch,CandContext &cx)
00051 {
00052   MSG("Alg", Msg::kDebug) << "Starting AlgShowerEMList::RunAlg()" << endl;
00053 
00054   assert(cx.GetDataIn());
00055   if (!(cx.GetDataIn()->InheritsFrom("TObjArray"))) {
00056     return;
00057   }
00058 
00059   const CandSliceListHandle *slicelist = 0;
00060   const CandClusterListHandle *clusterlist = 0;
00061   const TObjArray *cxin = dynamic_cast<const TObjArray *>(cx.GetDataIn());
00062   for (Int_t i=0; i<=cxin->GetLast(); i++) {
00063     TObject *tobj = cxin->At(i);
00064     if (tobj->InheritsFrom("CandSliceListHandle")) {
00065       slicelist = dynamic_cast<CandSliceListHandle*>(tobj);
00066     }
00067     if (tobj->InheritsFrom("CandClusterListHandle")) {
00068       clusterlist = dynamic_cast<CandClusterListHandle*>(tobj);
00069     }
00070   }
00071   if (!slicelist || !clusterlist) {
00072     MSG("error",Msg::kError) <<
00073       "CandSliceListHandle or CandClusterListHandle missing\n";
00074   }
00075 
00076   // Create Candcontext
00077   CandContext cxx(this,cx.GetMom());
00078 
00079   //get config for AlgShowerEM
00080   const char *charShowerEMAlgConfig = 0;
00081   ac.Get("ShowerEMAlgConfig",charShowerEMAlgConfig);
00082 
00083   // Get singleton instance of AlgFactory
00084   AlgFactory &af = AlgFactory::GetInstance();  
00085   AlgHandle ah = af.GetAlgHandle("AlgShowerEM",charShowerEMAlgConfig);
00086 
00087   const CandRecord *candrec = cx.GetCandRecord();
00088   assert(candrec);
00089   const VldContext *vldcptr = candrec->GetVldContext();
00090   assert(vldcptr);
00091   VldContext vldc = *vldcptr;
00092 
00093   UgliGeomHandle ugh(vldc);
00094   
00095   CandSliceHandleItr sliceItr(slicelist->GetDaughterIterator());
00096   while (CandSliceHandle *slice = sliceItr()) {
00097     CandClusterHandleItr clusterItr(clusterlist->GetDaughterIterator());
00098     TObjArray newshower;
00099     while (CandClusterHandle *cluster = clusterItr()){
00100       if (*cluster->GetCandSlice()==*slice) {
00101         newshower.Add(cluster);
00102       }
00103     }
00104     cxx.SetDataIn(&newshower);
00105     MSG("ShowerEM",Msg::kDebug) << "forming shower\n";
00106     CandShowerEMHandle showerhandle = CandShowerEM::MakeCandidate(ah,cxx);
00107     if(showerhandle.GetNStrip()!=0) {
00108       showerhandle.SetCandSlice(slice);
00109       ch.AddDaughterLink(showerhandle);    
00110     }
00111     else MSG("ShowerEM",Msg::kWarning) << "Removing empty shower\n";
00112   }
00113 }
00114 
00115 //______________________________________________________________________
00116 void AlgShowerEMList::Trace(const char * /* c */) const
00117 {
00118 }
00119 

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