#include <AlgBandClusterList.h>
Inheritance diagram for AlgBandClusterList:

Public Member Functions | |
| AlgBandClusterList () | |
| virtual | ~AlgBandClusterList () |
| virtual void | Trace (const char *c) const |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
Private Member Functions | |
| void | RunAlgOnSlice (AlgConfig &ac, CandHandle &ch, CandContext &cx, CandSliceHandle *csh) |
|
|
Definition at line 45 of file AlgBandClusterList.cxx. 00046 {
00047 //
00048 // Purpose: Default constructor.
00049 //
00050 // Arguments: n/a
00051 //
00052 // Return: n/a
00053 //
00054 }
|
|
|
Definition at line 58 of file AlgBandClusterList.cxx. 00059 {
00060 //
00061 // Purpose: Default destructor.
00062 //
00063 // Arguments: n/a
00064 //
00065 // Return: n/a
00066 //
00067 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 71 of file AlgBandClusterList.cxx. References CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), MSG, and RunAlgOnSlice(). 00073 {
00074 //
00075 // Purpose: Group together CandDigiPairs into MSTClusters that are
00076 // stored in a new CandMSTClusterList.
00077 //
00078 // Argument:
00079 // ac in AlgConfig containing cluster parameters.
00080 // ch in Handle to the new CandMSTClusterList to fill.
00081 // cx in CandContext containing the CandDigiPairList to
00082 // cluster.
00083 //
00084 // Return: n/a
00085 //
00086
00087 MSG("BubAlg", Msg::kVerbose)
00088 << "Starting AlgBandClusterList::RunAlg()" << endl;
00089
00090 // Check for CandSliceListHandle input.
00091 assert(cx.GetDataIn());
00092 assert(cx.GetDataIn()->InheritsFrom("CandSliceListHandle"));
00093 const CandSliceListHandle *cslh =
00094 dynamic_cast<const CandSliceListHandle*>(cx.GetDataIn());
00095
00096 // Iterate over CandSlices.
00097 TIter cshItr(cslh->GetDaughterIterator());
00098 while (CandSliceHandle *csh =
00099 dynamic_cast<CandSliceHandle *>(cshItr())) {
00100 RunAlgOnSlice(ac, ch, cx, csh);
00101 }
00102 }
|
|
||||||||||||||||||||
|
Definition at line 106 of file AlgBandClusterList.cxx. References CandHandle::AddDaughterLink(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandDigiPairHandle::GetCharge(), CandHandle::GetDaughterIterator(), Registry::GetDouble(), PlexSEIdAltL::GetEnd(), UgliStripHandle::GetHalfWidth(), AlgFactory::GetInstance(), CandContext::GetMom(), CandStripHandle::GetPlaneView(), CandDigitHandle::GetPlexSEIdAltL(), CandStripHandle::GetStripEndId(), CandStripHandle::GetTPos(), CandHandle::GetVldContext(), CandStripHandle::GetZPos(), UgliStripHandle::IsValid(), PlexPlaneId::IsVetoShield(), CandMSTCluster::MakeCandidate(), MSG, and CandClusterHandle::SetCandSlice(). Referenced by RunAlg(). 00108 {
00109 //
00110 // Purpose: Group together CandDigiPairs into MSTClusters that are
00111 // stored in a new CandMSTClusterList.
00112 //
00113 // Argument:
00114 // ac in AlgConfig containing cluster parameters.
00115 // ch in Handle to the new CandMSTClusterList to fill.
00116 // cx in CandContext containing information needed for call
00117 // to AlgMSTCluster.
00118 // csh in CandSlice containing CandDigiPairs to group into a
00119 // CandMSTCluster.
00120 //
00121 // Return: n/a
00122 //
00123
00124 MSG("BubAlg", Msg::kVerbose)
00125 << "Starting AlgBandClusterList::RunAlgOnSlice()" << endl;
00126
00127 // Save config parameters.
00128 Double_t bandspan = ac.GetDouble("BandSpan");
00129
00130 // Define central track.
00131 Double_t utsum = 0;
00132 Double_t ut2sum = 0;
00133 Double_t utzsum = 0;
00134 Double_t uzsum = 0;
00135 Double_t uz2sum = 0;
00136 Double_t uwtsum = 0;
00137 Double_t vtsum = 0;
00138 Double_t vt2sum = 0;
00139 Double_t vtzsum = 0;
00140 Double_t vzsum = 0;
00141 Double_t vz2sum = 0;
00142 Double_t vwtsum = 0;
00143 TIter chhItr(csh->GetDaughterIterator());
00144 while (const CandDigiPairHandle *chh =
00145 dynamic_cast<const CandDigiPairHandle *>(chhItr())) {
00146
00147 // Select strips with double-sided readout.
00148 Bool_t east = kFALSE;
00149 Bool_t west = kFALSE;
00150 TIter cdhItr(chh->GetDaughterIterator());
00151 while (const CandDigitHandle *cdh =
00152 dynamic_cast<const CandDigitHandle *>(cdhItr())) {
00153 StripEnd::StripEnd_t ende = cdh->GetPlexSEIdAltL().GetEnd();
00154 if (ende == StripEnd::kEast) east = kTRUE;
00155 else if (ende == StripEnd::kWest) west = kTRUE;
00156
00157 // Update stats for double-sided.
00158 if (east && west) {
00159 Double_t tpos = chh->GetTPos();
00160 Double_t zpos = chh->GetZPos();
00161 Double_t wt = chh->GetCharge();
00162 switch (chh->GetPlaneView()) {
00163 case PlaneView::kU:
00164 utsum += wt * tpos;
00165 ut2sum += wt * tpos * tpos;
00166 utzsum += wt * tpos * zpos;
00167 uzsum += wt * zpos;
00168 uz2sum += wt * zpos * zpos;
00169 uwtsum += wt;
00170 break;
00171 case PlaneView::kV:
00172 vtsum += wt * tpos;
00173 vt2sum += wt * tpos * tpos;
00174 vtzsum += wt * tpos * zpos;
00175 vzsum += wt * zpos;
00176 vz2sum += wt * zpos * zpos;
00177 vwtsum += wt;
00178 break;
00179 default:
00180 break;
00181 }
00182 continue;
00183 }
00184 }
00185 }
00186
00187 // Calculate central track parameters.
00188 Double_t udet = uwtsum * uz2sum - uzsum * uzsum;
00189 Double_t uinter, uslope;
00190 if (udet != 0.) {
00191 uinter = (utsum * uz2sum - utzsum * uzsum) / udet;
00192 uslope = (uwtsum * utzsum - uzsum * utsum) / udet;
00193 }
00194 else {
00195 uinter = (uwtsum!=0. ? utsum / uwtsum : -1e12);
00196 uslope = 1e12;
00197 }
00198 Double_t uslope2_1 = uslope * uslope + 1;
00199
00200 Double_t vdet = vwtsum * vz2sum - vzsum * vzsum;
00201 Double_t vinter, vslope;
00202 if (vdet != 0.) {
00203 vinter = (vtsum * vz2sum - vtzsum * vzsum) / vdet;
00204 vslope = (vwtsum * vtzsum - vzsum * vtsum) / vdet;
00205 }
00206 else {
00207 vinter = (vwtsum!=0. ? vtsum / vwtsum : -1e12);
00208 vslope = 1e12;
00209 }
00210 Double_t vslope2_1 = vslope * vslope + 1;
00211
00212 // Find strip width using first digitized strip.
00213 Float_t cellwidth = 0;
00214 chhItr.Reset();
00215 while (const CandDigiPairHandle *chht =
00216 dynamic_cast<const CandDigiPairHandle *>(chhItr())) {
00217 UgliGeomHandle ugh(*chht->GetVldContext());
00218 UgliStripHandle ush = ugh.GetStripHandle(chht->GetStripEndId());
00219 if (ush.IsValid()) {
00220 cellwidth = ush.GetHalfWidth();
00221 cellwidth *= 2.0;
00222 break;
00223 }
00224 }
00225
00226 // Set difference check limit.
00227 Double_t d2check = bandspan * cellwidth;
00228 d2check *= d2check;
00229
00230 // Separate strips into clusters.
00231 TObjArray *mainU = 0;
00232 TObjArray *mainV = 0;
00233 TObjArray *others = 0;
00234 TObjArray *arrayA = 0;
00235 TObjArray *arrayB = 0;
00236 TObjArray *shield = 0;
00237 chhItr.Reset();
00238 while (CandDigiPairHandle *chh =
00239 dynamic_cast<CandDigiPairHandle *>(chhItr())) {
00240 Double_t xdat = chh->GetZPos();
00241 Double_t ydat = chh->GetTPos();
00242 Double_t d2diff = 0;
00243
00244 // Check for digits from veto shield.
00245 if (chh->GetStripEndId().IsVetoShield()) {
00246 if (!shield) shield = new TObjArray();
00247 shield->Add(chh);
00248 continue;
00249 }
00250
00251 // Separate by strip orientation.
00252 switch (chh->GetPlaneView()) {
00253
00254 case PlaneView::kU:
00255 d2diff = ydat - uinter - uslope * xdat;
00256 d2diff *= d2diff;
00257 d2diff /= uslope2_1;
00258 if (d2diff <= d2check) {
00259 if (!mainU) mainU = new TObjArray();
00260 mainU->Add(chh);
00261 }
00262 else {
00263 if (!others) others = new TObjArray();
00264 others->Add(chh);
00265 }
00266 break;
00267
00268 case PlaneView::kV:
00269 d2diff = ydat - vinter - vslope * xdat;
00270 d2diff *= d2diff;
00271 d2diff /= vslope2_1;
00272 if (d2diff <= d2check) {
00273 if (!mainV) mainV = new TObjArray();
00274 mainV->Add(chh);
00275 }
00276 else {
00277 if (!others) others = new TObjArray();
00278 others->Add(chh);
00279 }
00280 break;
00281
00282 case PlaneView::kA:
00283 if (!arrayA) arrayA = new TObjArray();
00284 arrayA->Add(chh);
00285 break;
00286
00287 case PlaneView::kB:
00288 if (!arrayB) arrayB = new TObjArray();
00289 arrayB->Add(chh);
00290 break;
00291
00292 default:
00293 MSG("BubAlg", Msg::kWarning)
00294 << "Invalid plane orientation." << endl;
00295 }
00296 }
00297
00298 // General setup for creating new CandMSTClusters.
00299 MSG("BubAlg", Msg::kVerbose)
00300 << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00301 AlgFactory &af = AlgFactory::GetInstance();
00302
00303 MSG("BubAlg", Msg::kVerbose)
00304 << "AlgHandle ah = af.GetAlgHandle(\"AlgMSTCluster\","
00305 << "\"default\");" << endl;
00306 AlgHandle ah = af.GetAlgHandle("AlgMSTCluster", "default");
00307
00308 MSG("BubAlg", Msg::kVerbose)
00309 << "Create CandContext instance." << endl;
00310 CandContext cxx(this, cx.GetMom());
00311 cxx.SetCandRecord(cx.GetCandRecord());
00312
00313 // Iterate over arrays to create CandMSTClusters.
00314 // Main U-view cluster.
00315 if (mainU) {
00316 cxx.SetDataIn(mainU);
00317 CandMSTClusterHandle clh = CandMSTCluster::MakeCandidate(ah, cxx);
00318 clh.SetCandSlice(csh);
00319 ch.AddDaughterLink(clh);
00320 delete mainU;
00321 mainU = 0;
00322 }
00323
00324 // Main V-view cluster.
00325 if (mainV) {
00326 cxx.SetDataIn(mainV);
00327 CandMSTClusterHandle clh = CandMSTCluster::MakeCandidate(ah, cxx);
00328 clh.SetCandSlice(csh);
00329 ch.AddDaughterLink(clh);
00330 delete mainV;
00331 mainV = 0;
00332 }
00333
00334 // Other clusters.
00335 if (others) {
00336 TIter chhItr(others);
00337 while (CandDigiPairHandle *chh =
00338 dynamic_cast<CandDigiPairHandle *>(chhItr())) {
00339 TObjArray *toay = new TObjArray();
00340 toay->Add(chh);
00341 cxx.SetDataIn(toay);
00342 CandMSTClusterHandle clh
00343 = CandMSTCluster::MakeCandidate(ah, cxx);
00344 clh.SetCandSlice(csh);
00345 ch.AddDaughterLink(clh);
00346 delete toay;
00347 toay = 0;
00348 }
00349 delete others;
00350 others = 0;
00351 }
00352
00353 // A-view clusters
00354 if (arrayA) {
00355 cxx.SetDataIn(arrayA);
00356 CandMSTClusterHandle clh = CandMSTCluster::MakeCandidate(ah, cxx);
00357 clh.SetCandSlice(csh);
00358 ch.AddDaughterLink(clh);
00359 delete arrayA;
00360 arrayA = 0;
00361 }
00362
00363 // B-view clusters
00364 if (arrayB) {
00365 cxx.SetDataIn(arrayB);
00366 CandMSTClusterHandle clh = CandMSTCluster::MakeCandidate(ah, cxx);
00367 clh.SetCandSlice(csh);
00368 ch.AddDaughterLink(clh);
00369 delete arrayB;
00370 arrayB = 0;
00371 }
00372
00373 // Veto shield clusters
00374 if (shield) {
00375 cxx.SetDataIn(shield);
00376 CandMSTClusterHandle clh = CandMSTCluster::MakeCandidate(ah, cxx);
00377 clh.SetCandSlice(csh);
00378 ch.AddDaughterLink(clh);
00379 delete shield;
00380 shield = 0;
00381 }
00382 }
|
|
|
Reimplemented from AlgBase. Definition at line 386 of file AlgBandClusterList.cxx. References MSG. 00387 {
00388 //
00389 // Purpose: Trace the AlgBandClusterList.
00390 //
00391 // Arguments:
00392 // c in String tag for the trace.
00393 //
00394 // Return: n/a
00395 //
00396
00397 MSG("BubCand", Msg::kDebug)
00398 << "**********Begin AlgBandClusterList::Trace(\"" << c << "\")"
00399 << endl
00400 << "**********End AlgBandClusterList::Trace(\"" << c << "\")"
00401 << endl;
00402 }
|
1.3.9.1