AlgShieldPlankList Class Reference

#include <AlgShieldPlankList.h>

Inheritance diagram for AlgShieldPlankList:
AlgBase

List of all members.

Public Member Functions

 AlgShieldPlankList ()
virtual ~AlgShieldPlankList ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const

Detailed Description

Definition at line 24 of file AlgShieldPlankList.h.


Constructor & Destructor Documentation

AlgShieldPlankList::AlgShieldPlankList (  ) 

Definition at line 47 of file AlgShieldPlankList.cxx.

00048 {
00049 }

AlgShieldPlankList::~AlgShieldPlankList (  )  [virtual]

Definition at line 52 of file AlgShieldPlankList.cxx.

00053 {
00054 }


Member Function Documentation

void AlgShieldPlankList::RunAlg ( AlgConfig ac,
CandHandle ch,
CandContext cx 
) [virtual]

Implements AlgBase.

Definition at line 57 of file AlgShieldPlankList.cxx.

References CandHandle::AddDaughterLink(), CandDigitListHandle::GetAbsTime(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), AlgFactory::GetInstance(), CandContext::GetMom(), CandHandle::GetNDaughters(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), PlexSEIdAltL::GetSize(), RecMinos::GetVldContext(), PlexSEIdAltL::IsVetoShield(), Msg::kDebug, Msg::kError, CandShieldPlank::MakeCandidate(), MSG, CandShieldPlankListHandle::SetAbsTime(), and StripSRKeyFromPSEId().

00059 {
00060 
00061   MSG("ShieldPlank",Msg::kDebug) << "Start ALGSHIELDSTRIPLIST"<<endl;
00062   assert(cx.GetDataIn());
00063 
00064   if (!(cx.GetDataIn()->InheritsFrom("CandDigitListHandle"))) {
00065     MSG("ShieldPlank",Msg::kError) << "AlgShieldPlankList wasnt passed a CandDigitList"<<endl;
00066     return;
00067   }
00068 
00069   //======================================================
00070   //Set up all pointer junk
00071   //
00072   CandShieldPlankListHandle& csslh = (CandShieldPlankListHandle&) ch;
00073   CandRecord *candrec = cx.GetCandRecord();
00074   assert(candrec);
00075   const VldContext *vldcptr = candrec->GetVldContext();
00076   assert(vldcptr);
00077   VldContext vldc = *vldcptr;
00078   
00079 
00080   CandContext cxx(this,cx.GetMom());
00081   cxx.SetCandRecord(candrec);
00082 
00083   AlgFactory &af = AlgFactory::GetInstance();
00084   AlgHandle ah = af.GetAlgHandle("AlgShieldPlank","default");
00085   
00086   
00087   const CandDigitListHandle *cdlh =
00088     dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00089      
00090 
00091 
00092   //=====================================================
00093   // Sort by Plane and Strip
00094   //
00095   MSG("ShieldPlank",Msg::kDebug) << "Sort by strip and plane:"<<cdlh->GetNDaughters()<<endl;
00096   CandDigitHandleItr cdhItr(cdlh->GetDaughterIterator());
00097   CandDigitHandleKeyFunc *cdhKf = cdhItr.CreateKeyFunc();
00098   cdhKf->SetFun(StripSRKeyFromPSEId);
00099   cdhItr.GetSet()->AdoptSortKeyFunc(cdhKf);
00100   cdhKf = 0;
00101   MSG("ShieldPlank",Msg::kDebug) << "Done sort"<<endl;
00102   
00103   
00104   //=====================================================
00105   //
00106   //
00107   CandDigitHandle *prev = 0;
00108   CandDigitHandle *first = 0;
00109   TObjArray cdhAr;
00110   cdhAr.Clear();
00111   while (CandDigitHandle *curr = cdhItr()) {
00112     PlexSEIdAltL pseid = curr->GetPlexSEIdAltL();
00113 
00114     if(!pseid.IsVetoShield())continue;
00115     MSG("ShieldPlank",Msg::kDebug) << "considering digit, plane " << pseid.GetPlane() << " plexsize " << pseid.GetSize() << endl;
00116     if (prev) {
00117       bool issameplank = 0;
00118       const PlexSEIdAltL& pSEIdAltL = prev->GetPlexSEIdAltL();
00119       const PlexSEIdAltL& cSEIdAltL = curr->GetPlexSEIdAltL();
00120       for(PlexSEIdAltL::const_iterator iterp = pSEIdAltL.begin();
00121           iterp!=pSEIdAltL.end(); ++iterp)
00122         {
00123            for(PlexSEIdAltL::const_iterator iterc = cSEIdAltL.begin();
00124                iterc!=cSEIdAltL.end(); ++iterc)
00125              {
00126                if((*iterp).GetSEId().IsSameStrip( (*iterc).GetSEId() ))
00127                  {
00128                    //found match
00129                    MSG("ShieldPlank",Msg::kDebug) << "MATCH " <<(*iterp).GetSEId().GetPlane() << "=="<<(*iterc).GetSEId().GetPlane()<< " Strip:"<<  (*iterp).GetSEId().GetStrip()<<" == "<<(*iterc).GetSEId().GetStrip()<<endl;            
00130                    issameplank = 1;
00131                    break;
00132                  }
00133              }
00134            if(issameplank) break;
00135         }
00136 
00137       
00138       if (issameplank) {
00139         cdhAr.Add(curr);
00140       } else {
00141         MSG("ShieldPlank",Msg::kDebug) << "Making shield strip from "<< cdhAr.GetLast()<<" digits"<<endl; 
00142         cxx.SetDataIn(&cdhAr);
00143 
00144         CandShieldPlankHandle csh = CandShieldPlank::MakeCandidate(ah,cxx);
00145         csslh.AddDaughterLink(csh);
00146         cdhAr.Clear();
00147         cdhAr.Add(curr);
00148         first = curr;
00149       }
00150     } else {
00151       cdhAr.Add(curr);
00152       first = curr;
00153     }
00154     prev = curr;
00155   }
00156   
00157   if (prev) {
00158     cxx.SetDataIn(&cdhAr);
00159     MSG("ShieldPlank",Msg::kDebug) << "Making shield strip from "<< cdhAr.GetLast()<<" digits"<<endl; 
00160     CandShieldPlankHandle csh = CandShieldPlank::MakeCandidate(ah,cxx);
00161     csslh.AddDaughterLink(csh);
00162   }
00163 
00164   //
00165   //Set the Abs time of shield plank list to the abs time of the digit list
00166   //
00167   double abstime(cdlh->GetAbsTime());
00168   if(!finite(abstime)) abstime = -99e99;
00169   csslh.SetAbsTime(abstime);
00170   
00171 }

void AlgShieldPlankList::Trace ( const char *  c  )  const [virtual]

Reimplemented from AlgBase.

Definition at line 180 of file AlgShieldPlankList.cxx.

00181 {
00182   //I have no idea what this does! more pointless code?
00183 }


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1