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

CandSubShowerSRHandle.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandSubShowerSRHandle.cxx,v 1.8 2008/11/05 17:24:46 rodriges Exp $
00003 //
00004 // CandSubShowerSRHandle
00005 //
00006 // CandSubShowerSRHandle is the specialized access handle to CandSubShowerSR.
00007 //
00008 // Each concrete CandHandle must define a DupHandle function.
00009 //
00010 // Author:  R. Lee 2001.02.21
00012 
00013 #include <cassert>
00014 #include <iostream>
00015 
00016 #include "CandSubShowerSR/CandSubShowerSRHandle.h"
00017 #include "CandSubShowerSR/CandSubShowerSR.h"
00018 #include "RecoBase/CandSliceHandle.h"
00019 #include "MessageService/MsgService.h"
00020 #include "Validity/VldContext.h"
00021 
00022 ClassImp(CandSubShowerSRHandle)
00023 
00024 //______________________________________________________________________
00025 CVSID("$Id: CandSubShowerSRHandle.cxx,v 1.8 2008/11/05 17:24:46 rodriges Exp $");
00026 
00027 //______________________________________________________________________
00028 CandSubShowerSRHandle::CandSubShowerSRHandle()
00029 {
00030 }
00031 
00032 //______________________________________________________________________
00033 CandSubShowerSRHandle::CandSubShowerSRHandle(const CandSubShowerSRHandle &cdh) :
00034   CandRecoHandle(cdh)
00035 {
00036 }
00037 
00038 //______________________________________________________________________
00039 CandSubShowerSRHandle::CandSubShowerSRHandle(CandSubShowerSR *cd) :
00040   CandRecoHandle(cd)
00041 {
00042 }
00043 
00044 //______________________________________________________________________
00045 CandSubShowerSRHandle::~CandSubShowerSRHandle()
00046 {
00047 }
00048 
00049 //______________________________________________________________________
00050 CandSubShowerSRHandle *CandSubShowerSRHandle::DupHandle() const
00051 {
00052    return (new CandSubShowerSRHandle(*this));
00053 }
00054 
00055 //______________________________________________________________________
00056 Double_t CandSubShowerSRHandle::GetEnergy() const
00057 {
00058   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->Energy;
00059 }
00060 
00061 //______________________________________________________________________
00062 void CandSubShowerSRHandle::SetEnergy(Double_t en)
00063 {
00064   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->Energy = en;
00065 }
00066 
00067 //______________________________________________________________________
00068 PlaneView::PlaneView_t CandSubShowerSRHandle::GetPlaneView() const
00069 {
00070   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->planeView;
00071 }
00072 
00073 //______________________________________________________________________
00074 void CandSubShowerSRHandle::SetPlaneView(PlaneView::PlaneView_t pv)
00075 {
00076   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->planeView = pv;
00077 }
00078 
00079 //______________________________________________________________________
00080 Float_t CandSubShowerSRHandle::GetSlope() const
00081 {
00082   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->Slope;
00083 }
00084 
00085 //______________________________________________________________________
00086 void CandSubShowerSRHandle::SetSlope(Float_t slope)
00087 {
00088   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->Slope=slope;
00089 }
00090 
00091 //______________________________________________________________________
00092 Float_t CandSubShowerSRHandle::GetAvgDev() const
00093 {
00094   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->AvgDev;
00095 }
00096 
00097 //______________________________________________________________________
00098 void CandSubShowerSRHandle::SetAvgDev(Float_t avgdev)
00099 {
00100   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->AvgDev=avgdev;
00101 }
00102 
00103 //______________________________________________________________________
00104 ClusterType::ClusterType_t CandSubShowerSRHandle::GetClusterID() const
00105 {
00106   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->ClusterID;
00107 }
00108 
00109 //______________________________________________________________________
00110 void CandSubShowerSRHandle::SetClusterID(ClusterType::ClusterType_t ss)
00111 {
00112   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->ClusterID = ss;
00113 }
00114 
00115 //______________________________________________________________________
00116 Float_t CandSubShowerSRHandle::GetProbEM() const
00117 {
00118   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->ProbEM;
00119 }
00120 
00121 //______________________________________________________________________
00122 void CandSubShowerSRHandle::SetProbEM(Float_t probem)
00123 {
00124   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->ProbEM = probem;
00125 }
00126 
00127 //______________________________________________________________________
00128 Double_t CandSubShowerSRHandle::GetMinStripPE() const
00129 {
00130   return dynamic_cast<const CandSubShowerSR *>(GetCandBase())->MinStripPE;
00131 }
00132 
00133 //______________________________________________________________________
00134 void CandSubShowerSRHandle::SetMinStripPE(Double_t minstrippe)
00135 {
00136   dynamic_cast<CandSubShowerSR *>(GetOwnedCandBase())->MinStripPE = minstrippe;
00137 }
00138 
00139 //______________________________________________________________________
00140 void CandSubShowerSRHandle::Trace(const char *c) const
00141 {
00142   MSG("Cand", Msg::kDebug)
00143     << "*******Begin CandSubShowerSRHandle::Trace(\"" << c << "\")" << endl
00144     << "Information from CandSubShowerSRHandle's CandHandle: " << endl;
00145   CandHandle::Trace(c);
00146   MSG("Cand", Msg::kDebug)
00147     << "*******End CandSubShowerSRHandle::Trace(\"" << c << "\")" << endl;
00148 }
00149 
00150 //______________________________________________________________________
00151 
00152 Float_t CandSubShowerSRHandle::GetMinU(Int_t iplane) const{
00153   if(this->GetPlaneView()!=PlaneView::kU) return 999;
00154   CandStripHandleItr sItr(GetDaughterIterator());
00155   CandStripHandle * begstrip = sItr();
00156   if(!begstrip) return 999;
00157   const VldContext * vld = begstrip->GetVldContext();
00158   if(!vld) return 999;
00159   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00160   if(plnid.GetPlaneView()!=PlaneView::kU) return 999.;
00161   if(iplane<GetBegPlane() || iplane>GetEndPlane()) return 999;
00162 
00163   CandStripHandleItr stripItr(GetDaughterIterator());
00164   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00165   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00166   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00167   stripKf = 0;
00168   stripItr.GetSet()->Slice(iplane);
00169 
00170   Float_t minU=999.;
00171   while (const CandStripHandle *strip =
00172          dynamic_cast<const CandStripHandle*>(stripItr())) {
00173    if(strip->GetTPos()<minU) minU = strip->GetTPos();
00174   }
00175   return minU;
00176 }
00177 //_____________________________________________________________________
00178 
00179 Float_t CandSubShowerSRHandle::GetMinV(Int_t iplane) const{
00180   if(this->GetPlaneView()!=PlaneView::kV) return 999;
00181   CandStripHandleItr sItr(GetDaughterIterator());
00182   CandStripHandle * begstrip = sItr();
00183   if(!begstrip) return 999;
00184   const VldContext * vld = begstrip->GetVldContext();
00185   if(!vld) return 999;
00186   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00187   if(plnid.GetPlaneView()!=PlaneView::kV) return 999;
00188   if(iplane<GetBegPlane() || iplane>GetEndPlane()) return 999;
00189 
00190   CandStripHandleItr stripItr(GetDaughterIterator());
00191   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00192   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00193   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00194   stripKf = 0;
00195   stripItr.GetSet()->Slice(iplane);
00196  
00197   Float_t minV=999.;
00198   while (const CandStripHandle *strip =
00199          dynamic_cast<const CandStripHandle*>(stripItr())) {
00200     if(strip->GetTPos()<minV) minV = strip->GetTPos();
00201   }
00202   return minV;
00203 }
00204 
00205 //_____________________________________________________________________
00206 
00207 Float_t CandSubShowerSRHandle::GetMaxU(Int_t iplane) const{
00208   if(this->GetPlaneView()!=PlaneView::kU) return -999;
00209   CandStripHandleItr sItr(GetDaughterIterator());
00210   CandStripHandle * begstrip = sItr();
00211   if(!begstrip) return -999;
00212   const VldContext * vld = begstrip->GetVldContext();
00213   if(!vld) return -999;
00214   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00215   if(plnid.GetPlaneView()!=PlaneView::kU) return -999;
00216   if(iplane<GetBegPlane() || iplane>GetEndPlane()) return -999;
00217 
00218   CandStripHandleItr stripItr(GetDaughterIterator());
00219   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00220   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00221   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00222   stripKf = 0;
00223   stripItr.GetSet()->Slice(iplane);
00224  
00225   Float_t maxU=-999;
00226   while (const CandStripHandle *strip =
00227          dynamic_cast<const CandStripHandle*>(stripItr())) {
00228     if(strip->GetTPos()>maxU) maxU = strip->GetTPos();
00229   }
00230   return maxU;
00231 }
00232 
00233 //_____________________________________________________________________
00234 
00235 Float_t CandSubShowerSRHandle::GetMaxV(Int_t iplane) const {
00236   if(this->GetPlaneView()!=PlaneView::kV) return -999;
00237   CandStripHandleItr sItr(GetDaughterIterator());
00238   CandStripHandle * begstrip = sItr();
00239   if(!begstrip)return -999;
00240   const VldContext * vld = begstrip->GetVldContext();
00241   if(!vld)return -999;
00242   PlexPlaneId plnid(vld->GetDetector(),iplane,false);
00243   if(plnid.GetPlaneView()!=PlaneView::kV)return -999.;
00244   if(iplane<GetBegPlane() || iplane>GetEndPlane()) return -999;
00245 
00246   CandStripHandleItr stripItr(GetDaughterIterator());
00247   CandStripHandleKeyFunc *stripKf = stripItr.CreateKeyFunc();
00248   stripKf->SetFun(CandStripHandle::KeyFromPlane);
00249   stripItr.GetSet()->AdoptSortKeyFunc(stripKf);
00250   stripKf = 0;
00251   stripItr.GetSet()->Slice(iplane);
00252 
00253   Float_t maxV=-999.;
00254   while (const CandStripHandle *strip =
00255          dynamic_cast<const CandStripHandle*>(stripItr())) {
00256     if(strip->GetTPos()>maxV) maxV=strip->GetTPos();
00257   }
00258   return maxV;
00259 }
00260 //_____________________________________________________________________
00261 
00262 Int_t CandSubShowerSRHandle::GetNStrips(Int_t iplane) const{
00263   Int_t nstrips=0;
00264   CandStripHandleItr stripItr(GetDaughterIterator());
00265   while (const CandStripHandle *strip =
00266          dynamic_cast<const CandStripHandle*>(stripItr())) {
00267     if(strip->GetPlane()==iplane)nstrips++;
00268   }
00269   return nstrips;
00270 }
00271 //_____________________________________________________________________
00272 
00273 Double_t CandSubShowerSRHandle::GetAveTime()
00274 {
00275   Double_t AveTime = 0.;  
00276   Double_t Tot = 0.;
00277   TIter stripItr(GetDaughterIterator());
00278   while (CandStripHandle *strip = 
00279          dynamic_cast<CandStripHandle*>(stripItr())) {  
00280     Tot += 1.;
00281     AveTime += strip->GetTime();
00282   }
00283   if(Tot<=0) return 0;
00284   return AveTime/Tot;
00285 }
00286 
00287 //_____________________________________________________________________
00288  
00289 Double_t CandSubShowerSRHandle::GetMinStpTime()
00290 {
00291   Double_t minTime = -1;
00292   TIter stripItr(GetDaughterIterator());
00293   while (CandStripHandle *strip =
00294          dynamic_cast<CandStripHandle*>(stripItr())) {
00295     if(minTime<0) minTime = strip->GetTime();
00296     else if(strip->GetTime()<minTime) minTime = strip->GetTime();
00297   }
00298   return minTime;
00299 }
00300  
00301 //_____________________________________________________________________
00302  
00303 Double_t CandSubShowerSRHandle::GetMaxStpTime()
00304 {
00305   Double_t maxTime = 0;
00306   TIter stripItr(GetDaughterIterator());
00307   while (CandStripHandle *strip =
00308          dynamic_cast<CandStripHandle*>(stripItr())) {
00309     if(strip->GetTime()>maxTime) maxTime = strip->GetTime();
00310   }
00311   return maxTime;
00312 }
00313 
00314 //______________________________________________________________________
00315 //  Navigation Helpers
00316 //______________________________________________________________________
00317 
00318 NavKey CandSubShowerSRHandle::KeyFromSlice(const CandSubShowerSRHandle *subshower)
00319 {
00320   if (subshower->GetCandSlice()) {
00321     return static_cast<Int_t>(subshower->GetCandSlice()->GetUidInt());
00322   }
00323   return 0;
00324 }
00325 
00326 NavKey CandSubShowerSRHandle::KeyFromViewEnergy(const CandSubShowerSRHandle *subshower)
00327 {
00328   PlaneView::PlaneView_t view = subshower->GetPlaneView();
00329   Double_t eng = subshower->GetEnergy();
00330   if (view==PlaneView::kU||view==PlaneView::kX) return ((view+1)*2000+eng)*(-1.);
00331   if (view==PlaneView::kV||view==PlaneView::kY) return (view*1000+eng)*(-1.);
00332   else return (view*100+eng)*(-1.);  
00333 }
00334 
00335 NavKey CandSubShowerSRHandle::KeyFromReverseViewEnergy(const CandSubShowerSRHandle *subshower)
00336 {
00337   PlaneView::PlaneView_t view = subshower->GetPlaneView();
00338   Double_t eng = subshower->GetEnergy();
00339   if (view==PlaneView::kU||view==PlaneView::kX) return ((view+1)*2000+eng);
00340   if (view==PlaneView::kV||view==PlaneView::kY) return (view*1000+eng);
00341   else return (view*100+eng);  
00342 }
00343 
00344 XXXITRIMP(CandSubShowerSRHandle)

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