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

Public Member Functions | |
| AlgThruMuon () | |
| virtual | ~AlgThruMuon () |
| virtual void | Trace (const char *c) const |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
|
|
Definition at line 41 of file AlgThruMuon.cxx. 00042 {
00043 //
00044 // Purpose: Default constructor.
00045 //
00046 // Arguments: n/a
00047 //
00048 // Return: n/a
00049 //
00050 }
|
|
|
Definition at line 54 of file AlgThruMuon.cxx. 00055 {
00056 //
00057 // Purpose: Default destructor.
00058 //
00059 // Arguments: n/a
00060 //
00061 // Return: n/a
00062 //
00063 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 67 of file AlgThruMuon.cxx. References CandHandle::AddDaughterLink(), AlgReco::Calibrate(), AlgFactory::GetAlgHandle(), CandRecoHandle::GetBegPlane(), CandContext::GetCandRecord(), CandContext::GetDataIn(), CandRecoHandle::GetEndPlane(), CandStraightClusterHandle::GetFitMode(), CandStraightClusterHandle::GetFitSlope(), CandStraightClusterHandle::GetFitTPos(), AlgFactory::GetInstance(), CandContext::GetMom(), CandTrackHandle::GetT(), DataUtil::GetVldContext(), CandRecoHandle::GetVtxPlane(), CandMSTClusterHandle::GetZBeg(), CandMSTClusterHandle::GetZEnd(), CandStraightCluster::MakeCandidate(), MSG, CandHandle::SetCandRecord(), CandRecoHandle::SetCandSlice(), CandThruMuonHandle::SetClusterU(), CandThruMuonHandle::SetClusterV(), CandRecoHandle::SetDirCosU(), CandRecoHandle::SetDirCosV(), CandRecoHandle::SetDirCosZ(), AlgTrack::SetUVZT(), CandRecoHandle::SetVtxPlane(), CandRecoHandle::SetVtxT(), CandRecoHandle::SetVtxU(), CandRecoHandle::SetVtxV(), CandRecoHandle::SetVtxZ(), and UgliGeomHandle::uv2xy(). 00068 {
00069 //
00070 // Purpose: Fills the CandThruMuon with the two matched
00071 // CandStraightClusters and fits a straight line to the digit
00072 // pairs.
00073 //
00074 // Argument:
00075 // ac in AlgConfig (not used).
00076 // ch in Handle to the CandThruMuon to fill.
00077 // cx in CandContext containing a TObjArray containing the
00078 // matched pair of CandStraightClusterHandles.
00079 //
00080 // Return: n/a
00081 //
00082
00083 MSG("BubAlg", Msg::kVerbose)
00084 << "Starting AlgThruMuon::RunAlg()" << endl;
00085
00086 assert(ch.InheritsFrom("CandThruMuonHandle"));
00087 CandThruMuonHandle &cmh = dynamic_cast<CandThruMuonHandle &>(ch);
00088
00089 // Check for TObjArray input.
00090 assert(cx.GetDataIn());
00091 assert(cx.GetDataIn()->InheritsFrom("TObjArray"));
00092 const TObjArray *mpair =
00093 dynamic_cast<const TObjArray *>(cx.GetDataIn());
00094
00095 // Loop over elements of pair to retrieve/create U- and V-clusters.
00096 CandStraightClusterHandle cch[2]; // 0=U, 1=V
00097 for (Int_t i=0; i<2; i++) {
00098
00099 // Check whether already have CandStraightCluster.
00100 TObject *tobj = mpair->At(i);
00101 if (tobj->InheritsFrom("CandStraightClusterHandle")) {
00102 MSG("BubAlg", Msg::kVerbose)
00103 << "Adding StraightCluster." << endl;
00104 cch[i] = *(dynamic_cast<CandStraightClusterHandle *>(tobj));
00105 }
00106
00107 // Have to create CandStraightCluster.
00108 else if (tobj->InheritsFrom("CandMSTClusterHandle")
00109 || tobj->InheritsFrom("TObjArray")) {
00110 MSG("BubAlg", Msg::kVerbose)
00111 << "Creating StraightCluster." << endl;
00112 AlgFactory &af = AlgFactory::GetInstance();
00113 AlgHandle ach =af.GetAlgHandle("AlgStraightCluster","default");
00114 CandContext cxx(this, cx.GetMom());
00115 cxx.SetDataIn(tobj);
00116 cxx.SetCandRecord(cx.GetCandRecord());
00117
00118 cch[i] = CandStraightCluster::MakeCandidate(ach, cxx);
00119 }
00120
00121 // Wrong input.
00122 else assert(0);
00123 }
00124 MSG("BubAlg", Msg::kVerbose)
00125 << "Created all StraightClusters" << endl;
00126
00127 // Set U- and V-clusters.
00128 MSG("BubAlg", Msg::kVerbose) << "Saving StraightClusters." << endl;
00129 cch[0].SetCandRecord(cx.GetCandRecord());
00130 cmh.SetClusterU(cch[0]);
00131 cch[1].SetCandRecord(cx.GetCandRecord());
00132 cmh.SetClusterV(cch[1]);
00133
00134 // Save digits in each cluster.
00135 MSG("BubAlg", Msg::kVerbose) << "Saving DigiPairs." << endl;
00136 for (int i=0; i<2; i++) {
00137 TIter chhItr(cch[i].GetDaughterIterator());
00138 while (CandDigiPairHandle *chh =
00139 dynamic_cast<CandDigiPairHandle *>(chhItr())) {
00140 cmh.AddDaughterLink(*chh);
00141 }
00142 }
00143 MSG("BubAlg", Msg::kVerbose)
00144 << "Saved clusters and digits in CandTrack" << endl;
00145
00146 // Select vertex point to be highest point.
00147 assert(cch[0].GetVldContext());
00148 UgliGeomHandle ugh(*cch[0].GetVldContext());
00149
00150 // Set begin point.
00151 MSG("BubAlg", Msg::kVerbose) << "Setting begin point" << endl;
00152 Float_t uval = cch[0].GetZBeg();
00153 Float_t vval = cch[1].GetZBeg();
00154 Float_t zbeg = (uval < vval ? uval : vval);
00155 Float_t ubeg = cch[0].GetFitTPos(zbeg);
00156 Float_t vbeg = cch[1].GetFitTPos(zbeg);
00157 Float_t xbeg, ybeg;
00158 ugh.uv2xy(ubeg, vbeg, xbeg, ybeg);
00159 MSG("BubAlg", Msg::kVerbose) << "Set begin point" << endl;
00160
00161 // Set end point.
00162 MSG("BubAlg", Msg::kVerbose) << "Setting end point" << endl;
00163 uval = cch[0].GetZEnd();
00164 vval = cch[1].GetZEnd();
00165 Float_t zend = (uval > vval ? uval : vval);
00166 Float_t uend = cch[0].GetFitTPos(zend);
00167 Float_t vend = cch[1].GetFitTPos(zend);
00168 Float_t xend, yend;
00169 ugh.uv2xy(uend, vend, xend, yend);
00170 MSG("BubAlg", Msg::kVerbose) << "Set end point" << endl;
00171
00172 // Assume muon is down-going.
00173 Float_t dirf;
00174 if ((ybeg > yend) || (cmh.GetBegPlane() <= 2)) {
00175 cmh.SetVtxU(ubeg);
00176 cmh.SetVtxV(vbeg);
00177 cmh.SetVtxZ(zbeg);
00178 dirf = 1;
00179 }
00180 else {
00181 cmh.SetVtxU(uend);
00182 cmh.SetVtxV(vend);
00183 cmh.SetVtxZ(zend);
00184 dirf = -1;
00185 }
00186
00187 // Set vertex plane.
00188 cmh.SetVtxPlane(dirf > 0 ? cmh.GetBegPlane() : cmh.GetEndPlane());
00189
00190 // Set vertex time.
00191 cmh.SetVtxT(cmh.GetT(cmh.GetVtxPlane()));
00192 MSG("BubAlg", Msg::kVerbose) << "Set vertex info" << endl;
00193
00194 // Set direction cosines.
00195 Float_t du = dirf;
00196 Float_t uslope = cch[0].GetFitSlope();
00197 if (cch[0].GetFitMode()) du /= (uslope!=0. ? uslope : 1e-12);
00198 else du *= uslope;
00199 Float_t dv = dirf;
00200 Float_t vslope = cch[1].GetFitSlope();
00201 if (cch[1].GetFitMode()) dv /= (vslope!=0. ? vslope : 1e-12);
00202 else dv *= vslope;
00203 Float_t dz = dirf;
00204 Float_t ds = TMath::Sqrt(du*du + dv*dv + dz*dz);
00205 cmh.SetDirCosU(du/ds);
00206 cmh.SetDirCosV(dv/ds);
00207 cmh.SetDirCosZ(dz/ds);
00208 MSG("BubAlg", Msg::kVerbose) << "Set direction info" << endl;
00209
00210 // Retrieve cosmic counts, if any.
00211 TObject *tobj = mpair->At(2);
00212 if (tobj && tobj->InheritsFrom("TObjArray")) {
00213 TIter chhItr(dynamic_cast<TObjArray *>(tobj));
00214 while (CandDigiPairHandle *chh =
00215 dynamic_cast<CandDigiPairHandle *>(chhItr())) {
00216 cmh.AddDaughterLink(*chh);
00217 }
00218 }
00219
00220 // Set CandSlice.
00221 cmh.SetCandSlice(cch[0].GetCandSlice());
00222
00223 // Set u-, v-, z-coordinates for each plane.
00224 this->SetUVZT(&cmh);
00225
00226 // Calibrate.
00227 this->Calibrate(&cmh);
00228
00229 MSG("BubAlg", Msg::kVerbose)
00230 << "Completed AlgThruMuon::RunAlg()" << endl;
00231 }
|
|
|
Reimplemented from AlgBase. Definition at line 235 of file AlgThruMuon.cxx. References MSG. 00236 {
00237 //
00238 // Purpose: Trace the AlgThruMuon.
00239 //
00240 // Arguments:
00241 // c in String tag for the trace.
00242 //
00243 // Return: n/a
00244 //
00245
00246 MSG("BubCand", Msg::kDebug)
00247 << "**********Begin AlgThruMuon::Trace(\"" << c << "\")" << endl
00248 << "**********End AlgThruMuon::Trace(\"" << c << "\")" << endl;
00249 }
|
1.3.9.1