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

AlgStripSRList Class Reference

#include <AlgStripSRList.h>

Inheritance diagram for AlgStripSRList:

AlgBase List of all members.

Public Member Functions

 AlgStripSRList ()
virtual ~AlgStripSRList ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void RunAlgNear (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void RunAlgFar (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void RunAlgMixed (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const
std::map< CandDigitHandle *,
float > 
MakeXtalkMap (const CandDigitListHandle *cdlh, Double_t timewindow)

Constructor & Destructor Documentation

AlgStripSRList::AlgStripSRList  ) 
 

Definition at line 57 of file AlgStripSRList.cxx.

00058 {
00059 }

AlgStripSRList::~AlgStripSRList  )  [virtual]
 

Definition at line 62 of file AlgStripSRList.cxx.

00063 {
00064 }


Member Function Documentation

map< CandDigitHandle *, float > AlgStripSRList::MakeXtalkMap const CandDigitListHandle cdlh,
Double_t  timewindow
 

generate map containing ratio of digitization charge to this charge + charge seen in adjacent pixels. Values near zero indicate xtalk. Diagonal pixels are not included. Charge in adjacent pixels is required to be within timewindow to be included in sum.

Definition at line 465 of file AlgStripSRList.cxx.

References abs(), NavKey::CompareValue(), PlexSEIdAltL::GetBestItem(), CandDigitHandle::GetCharge(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), PlexPixelSpotId::GetPixel(), PlexSEIdAltLItem::GetPixelSpotId(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetTime(), PlexPixelSpotId::GetUniquePmtEncodedValue(), CandHandle::GetVldContext(), and StripSRKeyFromTube().

Referenced by RunAlgFar().

00465                                                                                                              {
00466 
00467   Int_t pmtcolumnsize=4;
00468   if(cdlh->GetVldContext()->GetDetector()==DetectorType::kNear)pmtcolumnsize=8;
00469        
00470   map<CandDigitHandle*,float> xtalkmap;
00471 
00472   // For inner loop, select digitizations on same PMT
00473  
00474   CandDigitHandleItr digitItr2(cdlh->GetDaughterIterator());
00475   CandDigitHandleKeyFunc *cdhKf = digitItr2.CreateKeyFunc();
00476   cdhKf->SetFun(StripSRKeyFromTube);
00477   digitItr2.GetSet()->AdoptSortKeyFunc(cdhKf);
00478   cdhKf = 0;
00479 
00480   CandDigitHandleItr digitItr1(cdlh->GetDaughterIterator());
00481   while (CandDigitHandle *digit1 = dynamic_cast<CandDigitHandle*>(digitItr1())) {
00482     Int_t pixel1=digit1->GetPlexSEIdAltL().GetBestItem().GetPixelSpotId().GetPixel();
00483     Int_t tube1=digit1->GetPlexSEIdAltL().GetBestItem().GetPixelSpotId().GetUniquePmtEncodedValue();
00484     Int_t ix1 = (pixel1)%pmtcolumnsize;
00485     Int_t iy1 = (Int_t)((pixel1)/pmtcolumnsize+.5);
00486     float pixelcharge = digit1->GetCharge();
00487     float xcharge = 0;
00488 
00489     // set digitIt2 to iterate over digitizations on same tube as digitItr1
00490     // Note:  This technique turned out to be a net time sink
00491     //    digitItr2.GetSet()->ClearSlice();
00492     //  digitItr2.GetSet()->Slice(tube1);
00493     
00494     digitItr2.Reset();
00495     while (CandDigitHandle *digit2 = dynamic_cast<CandDigitHandle*>(digitItr2())) {
00496       if (digit1!=digit2) {
00497         Int_t pixel2=digit2->GetPlexSEIdAltL().GetBestItem().GetPixelSpotId().GetPixel();
00498         Int_t tube2=digit1->GetPlexSEIdAltL().GetBestItem().GetPixelSpotId().GetUniquePmtEncodedValue();
00499         // break out of loop when we have passed the tube match
00500         Int_t comptube = StripSRKeyFromTube(digit2).CompareValue(tube1);
00501         if(comptube<0) break;
00502         if(tube1==tube2){
00503           if (pixel1!=pixel2) {
00504             Int_t ix2 = (pixel2)%pmtcolumnsize;
00505             Int_t iy2 = (Int_t)((pixel2)/pmtcolumnsize+.5);
00506             if(abs(ix1-ix2)+abs(iy1-iy2)==1 && 
00507                fabs(digit1->GetTime()-digit2->GetTime())<timewindow){
00508               xcharge += digit2->GetCharge();
00509             }
00510           }
00511           else if((pixel1==pixel2) &&
00512                   fabs(digit1->GetTime()-digit2->GetTime())<timewindow ){
00513             pixelcharge +=digit2->GetCharge();
00514           }
00515         }
00516       }
00517     }//end inner loop over digits to find xtalk
00518     if(xcharge+pixelcharge != 0.) xtalkmap[digit1] = pixelcharge/(xcharge+pixelcharge);
00519     else xtalkmap[digit1] = 0.;
00520   }//end loop over digit
00521   return xtalkmap;
00522 }

void AlgStripSRList::RunAlg AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

driver routine - calls algorithm method for near, far, or mixed detectors based on validity context.

Implements AlgBase.

Definition at line 70 of file AlgStripSRList.cxx.

References RawDigitDataBlock::At(), RawRecord::FindRawBlock(), RawDigit::GetChannel(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), RawChannelId::GetElecType(), MomNavigator::GetFragment(), CandContext::GetMom(), CandDigitHandle::GetRawDigitIndex(), CandHandle::GetVldContext(), MSG, RunAlgFar(), RunAlgMixed(), and RunAlgNear().

00071 {
00072    assert(cx.GetDataIn());
00073 // Check for CandDigitListHandle input
00074    if (cx.GetDataIn()->InheritsFrom("CandDigitListHandle")) {
00075       const CandDigitListHandle *cdlh =
00076             dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00077       const MomNavigator *mom = cx.GetMom();
00078       RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord"));
00079       if (!rr) {
00080         MSG("AlgStripSRList", Msg::kWarning) << "No RawRecord in MOM." << endl;
00081         return;
00082       }
00083       const RawDigitDataBlock *rddb = dynamic_cast<const RawDigitDataBlock *>
00084                             (rr->FindRawBlock("RawDigitDataBlock"));
00085       if (!rddb) {
00086         MSG("AlgStripSRList", Msg::kWarning) << "No RawDigitDataBlock in RawRecord." << endl;
00087         return;
00088       }
00089       TIter digitItr(cdlh->GetDaughterIterator());
00090       Bool_t found(0);
00091       CandDigitHandle *digit = dynamic_cast<CandDigitHandle*>(digitItr());
00092       switch (cdlh->GetVldContext()->GetDetector()) {
00093       case DetectorType::kNear:
00094         RunAlgNear(ac,ch,cx);
00095         break;
00096       case DetectorType::kFar:
00097         RunAlgFar(ac,ch,cx);
00098         break;
00099       case DetectorType::kCalib:
00100          // need to check if far or near electronics
00101         while (digit && !found) {
00102           const RawDigit *rd = rddb->At(digit->GetRawDigitIndex());
00103           assert(rd);
00104           RawChannelId rawid = rd->GetChannel();
00105           if (rawid.GetElecType()==ElecType::kQIE) found=1;
00106           digit = dynamic_cast<CandDigitHandle*>(digitItr());
00107         }
00108         if (found) {
00109           RunAlgMixed(ac,ch,cx);
00110         } else {
00111           RunAlgFar(ac,ch,cx);
00112         }
00113         break;
00114       default:
00115         break;
00116       }
00117    }
00118 }

void AlgStripSRList::RunAlgFar AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

To be included in a CandStrip, the charge in a given digitization must be larger than a fixed fraction of the total charge in the 4 pixels directly adjacent to the pixel associated with this digitization. This ensures that cross talk hits are not included in CandStrips. Veto shield digitizations are rejected, as are digitizations which have a bad demux flag set. CandDigits are sorted by plane and strip, which ensures that CandDigits which will be associated into CandStrips occupy adjacent entries in this sorted list. One pass is made through the sorted list, checking for identical strip/plane values in adjacent entries. If this occurs, and the CandDigit satisfies the requirements above, the CandDigits are added to the CandStrip.

Definition at line 369 of file AlgStripSRList.cxx.

References CandHandle::AddDaughterLink(), RawRecord::FindRawBlock(), AlgFactory::GetAlgHandle(), PlexSEIdAltL::GetBestSEId(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), PlexSEIdAltL::GetDemuxVetoFlag(), Registry::GetDouble(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), Registry::GetInt(), CandContext::GetMom(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), PlexSEIdAltL::GetSize(), PlexStripEndId::IsSameStrip(), PlexSEIdAltL::IsVetoShield(), CandStrip::MakeCandidate(), MakeXtalkMap(), MSG, and StripSRKeyFromPSEId().

Referenced by RunAlg().

00370 {
00371   MSG("Alg", Msg::kDebug)
00372                           << "Starting AlgStripSRList::RunAlgFar()" << endl;
00373 
00374   const CandDigitListHandle *cdlh =
00375         dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00376 
00377   const MomNavigator *mom = cx.GetMom();
00378 
00379   RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord"));
00380   if (!rr) {
00381      MSG("StripSR", Msg::kWarning) << "No RawRecord in MOM." << endl;
00382      return;
00383   }
00384 
00385   const RawDigitDataBlock *rddb = dynamic_cast<const RawDigitDataBlock *>
00386                         (rr->FindRawBlock("RawDigitDataBlock"));
00387   if (!rddb) {                                         
00388     MSG("StripSR", Msg::kWarning) << "No RawDigitDataBlock in RawRecord." << endl;
00389     return;
00390   }
00391  
00392   Int_t begplane = ac.GetInt("BegPlane");
00393   Int_t endplane = ac.GetInt("EndPlane");
00394   Double_t maxAdjPixelChargeFraction = ac.GetDouble("AdjPixelChargeFraction");
00395   Double_t timewindow=ac.GetDouble("MaxXtalkTimeWindow");
00396 
00397   // generate map containing ratio of digitization charge to 
00398   // xtalk charge associated with each digitization.
00399   // xtalk is defined to be the charge seen in adjacent pixels.  Diagonal
00400   // pixels are not included. 
00401 
00402   map<CandDigitHandle*,float> xtalkmap = MakeXtalkMap(cdlh, timewindow);
00403 
00404   /*  CandDigits are sorted by plane and strip, which ensures that CandDigits which will be  associated into CandStrips occupy adjacent entries in this sorted list. */
00405    CandDigitHandleItr cdhItr(cdlh->GetDaughterIterator());
00406    CandDigitHandleKeyFunc *cdhKf = cdhItr.CreateKeyFunc();
00407    cdhKf->SetFun(StripSRKeyFromPSEId);
00408    cdhItr.GetSet()->AdoptSortKeyFunc(cdhKf);
00409    cdhKf = 0;
00410 
00411    AlgFactory &af = AlgFactory::GetInstance();
00412    AlgHandle ah = af.GetAlgHandle("AlgStripSR","default");
00413    CandContext cxx(this,cx.GetMom());
00414 
00415    /*
00416  One pass is made through the sorted list, checking for identical strip/plane values in adjacent entries.  If this occurs, and the CandDigit satisfies the requirements above, the CandDigits are added to the CandStrip.
00417    */
00418 
00419    CandDigitHandle *prev = 0;
00420    TObjArray cdhAr;
00421    cdhAr.Clear();
00422    while (CandDigitHandle *curr = cdhItr()) {
00423      if (curr->GetPlexSEIdAltL().GetPlane()>=begplane &&
00424          curr->GetPlexSEIdAltL().GetPlane()<=endplane &&
00425          xtalkmap[curr]>=maxAdjPixelChargeFraction &&
00426          !curr->GetPlexSEIdAltL().IsVetoShield() &&
00427          !curr->GetPlexSEIdAltL().GetDemuxVetoFlag() &&
00428          curr->GetPlexSEIdAltL().GetSize()>0) {
00429        if (prev) {
00430          PlexStripEndId pSEId = prev->GetPlexSEIdAltL().GetBestSEId();
00431          PlexStripEndId cSEId = curr->GetPlexSEIdAltL().GetBestSEId();
00432          if (pSEId.IsSameStrip(cSEId)) {
00433             cdhAr.Add(curr);
00434          } else {
00435             cxx.SetDataIn(&cdhAr);
00436             CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00437             ch.AddDaughterLink(csh);
00438             cdhAr.Clear();
00439             cdhAr.Add(curr);
00440          }
00441       } else {
00442          cdhAr.Add(curr);
00443       }
00444       prev = curr;
00445      }
00446    }
00447    if (prev) {
00448       cxx.SetDataIn(&cdhAr);
00449       CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00450       ch.AddDaughterLink(csh);
00451    }
00452 
00453 
00454 
00455 }

void AlgStripSRList::RunAlgMixed AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

CandDigits are sorted by plane, strip. Nested passes are made through the sorted list. The outer loop constructs an array of candigits until a new strip id is seen. The inner loop is then made over this list of digits, which is sorted by time. Then, as in the near detector algorithm, we check that adjacent entries are within the tolerances set by the variables MaxLocTimeSep and MaxGloTimeSep. The first variable is used to check that no large time gaps occur within a CandStrip, and the second is used to ensure that the total duration of a CandStrip is sensible. If this occurs, and the CandDigit satisfies the requirements above, the CandDigits are added to the CandStrip. When one of the time sep requirements is violated, a cand strip is constructed withthe previous digits. This continues until the the digit list has been completely examined.The outer loop then proceeds to make a digitlist for the next seid, continuing until thefull CandDigitList has been examined IMPORTANT NOTE: In mixed analysis, the xtalk removal is not currently done.

Definition at line 125 of file AlgStripSRList.cxx.

References CandHandle::AddDaughterLink(), AlgFactory::GetAlgHandle(), PlexSEIdAltL::GetBestSEId(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), Registry::GetDouble(), AlgFactory::GetInstance(), Registry::GetInt(), CandContext::GetMom(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), PlexSEIdAltL::GetSize(), CandDigitHandle::GetTime(), PlexStripEndId::IsSameStrip(), CandStrip::MakeCandidate(), StripSRKeyFromPSEId(), and StripSRKeyFromTime().

Referenced by RunAlg().

00126 {
00127 
00128    const CandDigitListHandle *cdlh =
00129          dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00130 
00131    // load parameters
00132    Double_t ldtime = ac.GetDouble("MaxLocTimeSep");
00133    Double_t gdtime = ac.GetDouble("MaxGloTimeSep");
00134    Int_t begplane = ac.GetInt("BegPlane");
00135    Int_t endplane = ac.GetInt("EndPlane");
00136    CalTimeType::CalTimeType_t caltimetype = (CalTimeType::CalTimeType_t)(ac.GetInt("CalTimeType"));
00137    
00138    /*CandDigits are sorted by plane, strip. */
00139 
00140    CandDigitHandleItr cdhItr(cdlh->GetDaughterIterator());
00141    CandDigitHandleKeyFunc *cdhKf = cdhItr.CreateKeyFunc();
00142    cdhKf->SetFun(StripSRKeyFromPSEId);
00143    cdhItr.GetSet()->AdoptSortKeyFunc(cdhKf);
00144    cdhKf = 0;
00145 
00146    AlgFactory &af = AlgFactory::GetInstance();
00147    AlgHandle ah = af.GetAlgHandle("AlgStripSR","default");
00148    CandContext cxx(this,cx.GetMom());
00149 
00150    /* Nested passes are made through the sorted list. The outer loop constructs an array of candigits  until a new strip id is seen. The inner loop is then made over this list of digits, which is sorted by time.  */
00151    CandDigitHandle *prev = 0;
00152    CandDigitHandle *first = 0;
00153    TObjArray cdhAr;
00154    cdhAr.Clear();
00155    TObjArray digitlist;
00156    digitlist.Clear();
00157    while (CandDigitHandle *curr = cdhItr()) {
00158      PlexSEIdAltL pseid = curr->GetPlexSEIdAltL();
00159      if (pseid.GetPlane()>=begplane && 
00160          pseid.GetPlane()<=endplane &&
00161          pseid.GetSize()>0) {
00162        if (prev) {
00163          PlexStripEndId pSEId = prev->GetPlexSEIdAltL().GetBestSEId();
00164          PlexStripEndId cSEId = curr->GetPlexSEIdAltL().GetBestSEId();
00165          if (pSEId.IsSameStrip(cSEId)) {
00166            digitlist.Add(curr);
00167          } else {
00168            TIter digitItr(&digitlist);
00169            CandDigitHandleItr timeItr(digitItr);
00170            CandDigitHandleKeyFunc *timeItrKf = timeItr.CreateKeyFunc();
00171            timeItrKf->SetFun(StripSRKeyFromTime);
00172            timeItr.GetSet()->AdoptSortKeyFunc(timeItrKf);
00173            timeItrKf = 0;
00174            first = 0;
00175            cdhAr.Clear();
00176            CandDigitHandle *prevdigit = 0;
00177            /* we check that adjacent entries are within the tolerances set by the variables MaxLocTimeSep and MaxGloTimeSep.  The first variable is used to check that no large time gaps occur within a CandStrip, and the second is used to ensure that the total duration of a CandStrip is sensible.*/
00178            while (CandDigitHandle *digit = timeItr()) {
00179              if (!first) {
00180                first = digit;
00181                cdhAr.Add(digit);
00182              } else if (digit->GetTime(caltimetype)-prevdigit->GetTime(caltimetype)<ldtime && 
00183                         digit->GetTime(caltimetype)-first->GetTime(caltimetype)<gdtime) {
00184                // CandDigit satisfies the requirements above, so add to the CandStrip. 
00185                cdhAr.Add(digit);
00186              } else {
00187                // else done, build this CandStrip
00188                cxx.SetDataIn(&cdhAr);
00189                CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00190                ch.AddDaughterLink(csh);
00191                cdhAr.Clear();
00192                cdhAr.Add(digit);
00193                first = digit;
00194              }
00195              prevdigit = digit;
00196            }
00197            if (cdhAr.GetSize()>=0) {
00198              cxx.SetDataIn(&cdhAr);
00199              CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00200              ch.AddDaughterLink(csh);
00201              cdhAr.Clear();
00202            }
00203            digitlist.Clear();
00204            digitlist.Add(curr);
00205          }
00206        } else {
00207          digitlist.Add(curr);
00208        }
00209        prev = curr;
00210      }
00211    }
00212  
00213    // final cleanup of digitlist to find remaining CandStrips
00214   if (digitlist.GetSize()>=0) {
00215      TIter digitItr(&digitlist);
00216      CandDigitHandleItr timeItr(digitItr);
00217      CandDigitHandleKeyFunc *timeItrKf = timeItr.CreateKeyFunc();
00218      timeItrKf->SetFun(StripSRKeyFromTime);
00219      timeItr.GetSet()->AdoptSortKeyFunc(timeItrKf);
00220      timeItrKf = 0;
00221      first = 0;
00222      cdhAr.Clear();
00223      CandDigitHandle *prevdigit = 0;
00224      while (CandDigitHandle *digit = timeItr()) {
00225        if (!first) {
00226          first = digit;
00227          cdhAr.Add(digit);
00228        } else if (digit->GetTime(caltimetype)-prevdigit->GetTime(caltimetype)<ldtime && 
00229                   digit->GetTime(caltimetype)-first->GetTime(caltimetype)<gdtime) {
00230          cdhAr.Add(digit);
00231        } else {
00232          cxx.SetDataIn(&cdhAr);
00233          CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00234          ch.AddDaughterLink(csh);
00235          cdhAr.Clear();
00236          cdhAr.Add(digit);
00237          first = digit;
00238        }
00239        prevdigit = digit;
00240      }
00241      if (cdhAr.GetSize()>=0) {
00242        cxx.SetDataIn(&cdhAr);
00243        CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00244        ch.AddDaughterLink(csh);
00245        cdhAr.Clear();
00246      }
00247      digitlist.Clear();
00248    }
00249 
00250 }

void AlgStripSRList::RunAlgNear AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

CandDigits are sorted by plane, strip, and time, which ensures that CandDigits wwhich will be associated into CandStrips occupy adjacent entries in this sorted list, and that the CandDigit with the earliest time in a given strip and plane will appear first. One pass is made through the sorted list, checking for identical strip/plane values in adjacent entries, and checking that the time is within the tolerances set by the variables MaxLocTimeSep and MaxGloTimeSep. The first variable is used to check that no large time gaps occur within a CandStrip, and the second is used to ensure that the total duration of a CandStrip is sensible. If this occurs, and the CandDigit satisfies the requirements above, the CandDigits are added to the CandStrip.

Definition at line 257 of file AlgStripSRList.cxx.

References CandHandle::AddDaughterLink(), AlgFactory::GetAlgHandle(), PlexSEIdAltL::GetBestSEId(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), Registry::GetDouble(), AlgFactory::GetInstance(), Registry::GetInt(), CandContext::GetMom(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), PlexSEIdAltL::GetSize(), CandDigitHandle::GetTime(), PlexStripEndId::IsSameStrip(), CandStrip::MakeCandidate(), StripSRKeyFromPSEId(), and StripSRKeyFromTime().

Referenced by RunAlg().

00258 {
00259 
00260   // NOTE: for the present, do not remove xtalk from ND data.
00261    // load parameters
00262    Double_t ldtime;
00263    Double_t gdtime;
00264    ldtime = ac.GetDouble("MaxLocTimeSep");
00265    gdtime = ac.GetDouble("MaxGloTimeSep");
00266    Int_t begplane = ac.GetInt("BegPlane");
00267    Int_t endplane = ac.GetInt("EndPlane");
00268    //   Double_t maxAdjPixelChargeFraction = ac.GetDouble("AdjPixelChargeFraction");
00269    // Mike Kordosky : Jan 19, 2005 ... noticed while browsing
00270    // see comment on xtalkmap below
00271    // Double_t timewindow=ac.GetDouble("MaxXtalkTimeWindow");
00272 
00273    const CandDigitListHandle *cdlh =
00274          dynamic_cast<const CandDigitListHandle*>(cx.GetDataIn());
00275 
00276    /*  CandDigits are sorted by plane, strip, and time, which ensures that CandDigits wwhich will be associated into CandStrips occupy adjacent entries in this sorted list, and that the CandDigit with the earliest time in a given strip and plane will appear first.
00277     */
00278 
00279    CandDigitHandleItr cdhItr(cdlh->GetDaughterIterator());
00280    CandDigitHandleKeyFunc *cdhKf = cdhItr.CreateKeyFunc();
00281    
00282    //Rustem Ospanov: fixing NavKey bug 2005.01.20
00283    //Create NavKey for sorting by encoded PlexStripEndId
00284    //Do not sort until time NavKey is adopted
00285    cdhKf->SetFun(StripSRKeyFromPSEId);
00286    cdhItr.GetSet()->AdoptSortKeyFunc(cdhKf, kTRUE, kFALSE);
00287 
00288    //Created NavKey for sorting by time
00289    cdhKf = cdhItr.CreateKeyFunc();
00290    cdhKf -> SetFun(StripSRKeyFromTime);
00291 
00292    //Sort CandDigits first by encoded PlexStripEndId and then by time
00293    cdhItr.GetSet()->AdoptSortKeyFunc(cdhKf, kFALSE);
00294    cdhKf = 0;
00295 
00296 
00297 // Get singleton instance of AlgFactory
00298    AlgFactory &af = AlgFactory::GetInstance();
00299 
00300 // Get an AlgHandle to AlgStripSR with default AlgConfig
00301    AlgHandle ah = af.GetAlgHandle("AlgStripSR","default");
00302 
00303 // Create Candcontext
00304    CandContext cxx(this,cx.GetMom());
00305 
00306 // Iterate over CandDigitList daughters
00307    CandDigitHandle *prev = 0;
00308    CandDigitHandle *first = 0;
00309    TObjArray cdhAr;
00310    cdhAr.Clear();
00311 
00312    CalTimeType::CalTimeType_t caltimetype = (CalTimeType::CalTimeType_t)(ac.GetInt("CalTimeType"));
00313 
00314    // generate map containing ratio of digitization charge to 
00315    // xtalk charge associated with each digitization.
00316    // xtalk is defined to be the charge seen in adjacent pixels.  Diagonal
00317    // pixels are not included. 
00318 
00319    // Mike Kordosky : Jan 19, 2005 ... noticed while browsing
00320    // Why waste time making the map below if it's never used?
00321    // map<CandDigitHandle*,float> xtalkmap = MakeXtalkMap(cdlh,timewindow);
00322 
00323 
00324    /* One pass is made through the sorted list, checking for identical strip/plane values in adjacent entries, and checking that the time is within the tolerances set by the variables MaxLocTimeSep and MaxGloTimeSep.  The first variable is used to check that no large time gaps occur within a CandStrip, and the second is used to ensure that the total duration of a CandStrip is sensible.  If this occurs, and the CandDigit satisfies the requirements above, the CandDigits are added to the CandStrip.   */
00325  
00326    while (CandDigitHandle *curr = cdhItr()) {
00327      PlexSEIdAltL pseid = curr->GetPlexSEIdAltL();
00328      if (pseid.GetPlane()>=begplane &&
00329          pseid.GetPlane()<=endplane &&
00330          //      xtalkmap[curr]>=maxAdjPixelChargeFraction &&
00331          pseid.GetSize()>0) {
00332        if (prev) {
00333          PlexStripEndId pSEId = prev->GetPlexSEIdAltL().GetBestSEId();
00334          PlexStripEndId cSEId = curr->GetPlexSEIdAltL().GetBestSEId();
00335          if (pSEId.IsSameStrip(cSEId) &&
00336              curr->GetTime(caltimetype)-prev->GetTime(caltimetype)<ldtime && 
00337              curr->GetTime(caltimetype)-first->GetTime(caltimetype)<gdtime) {
00338            cdhAr.Add(curr);
00339          } 
00340          else {
00341            cxx.SetDataIn(&cdhAr);
00342            CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00343            ch.AddDaughterLink(csh);
00344            cdhAr.Clear();
00345            cdhAr.Add(curr);
00346            first = curr;
00347          }
00348       } 
00349        else {
00350          cdhAr.Add(curr);
00351          first = curr;
00352        }
00353        prev = curr;
00354      }
00355    }
00356    if (prev) {
00357       cxx.SetDataIn(&cdhAr);
00358       CandStripHandle csh = CandStrip::MakeCandidate(ah,cxx);
00359       ch.AddDaughterLink(csh);
00360    }
00361  
00362 
00363 }

void AlgStripSRList::Trace const char *  c  )  const [virtual]
 

Reimplemented from AlgBase.

Definition at line 525 of file AlgStripSRList.cxx.

00526 {
00527 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:55:28 2007 for loon by  doxygen 1.3.9.1