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

Protected Member Functions | |
| void | Calibrate (CandRecoHandle *) |
|
|
Definition at line 37 of file AlgReco.cxx. References FloatErr, Calibrator::GetAttenCorrectedTpos(), CandStripHandle::GetCharge(), CandHandle::GetDaughterIterator(), PlexStripEndId::GetEncoded(), CandEventHandle::GetLastShower(), CandEventHandle::GetLastTrack(), Calibrator::GetMIP(), CandStripHandle::GetNDigit(), CandStripHandle::GetPlane(), CandStripHandle::GetPlaneView(), CandEventHandle::GetShower(), CandStripHandle::GetStripEndId(), CandEventHandle::GetTrack(), CandTrackHandle::GetTrackPointError(), CandTrackHandle::GetU(), CandShowerHandle::GetU(), CandTrackHandle::GetV(), CandShowerHandle::GetV(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), Calibrator::Instance(), MSG, and ValueErr< T >::SetError(). Referenced by AlgFitTrackMS::InitFitHandle(), AlgTrackSR::RunAlg(), AlgThruMuon::RunAlg(), AlgShowerSS::RunAlg(), AlgShowerSR::RunAlg(), AlgShowerEM::RunAlg(), AlgFitTrackSR::RunAlg(), and AlgEventSR::RunAlg(). 00038 {
00039 Calibrator& cal = Calibrator::Instance();
00040
00041 Bool_t isEvent = candreco->InheritsFrom("CandEventHandle");
00042 const CandEventHandle *candevent = 0;
00043 if (isEvent) {
00044 candevent = dynamic_cast<const CandEventHandle*>(candreco);
00045 for(Int_t i=0;i<candevent->GetLastShower();i++){
00046 const CandShowerHandle *candshower = candevent->GetShower(i);
00047 TIter stripItr(candshower->GetDaughterIterator());
00048 while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00049 FloatErr tpos=0.;
00050 int plane = strip->GetPlane();
00051 switch (strip->GetPlaneView()) {
00052 case PlaneView::kX: case PlaneView::kU:
00053 tpos = candshower->GetV(plane);
00054 tpos.SetError(1.0 * Munits::meter); // Since this next call doesn't work:
00055 //tpos.SetError( 0.5 * (candshower->GetMaxV(plane) - candshower->GetMinV(plane)) );
00056 break;
00057 case PlaneView::kY: case PlaneView::kV:
00058 tpos = candshower->GetU(plane);
00059 tpos.SetError(1.0 * Munits::meter); // Since this next call doesn't work:
00060 //tpos.SetError( 0.5 * (candshower->GetMaxU(plane) - candshower->GetMinU(plane)) );
00061 break;
00062 default:
00063 continue;
00064 }
00065
00066 if (fabs(tpos)>4.) {
00067 MSG("RecoBase",Msg::kDebug) << "tpos = " << tpos << " outside detector" << endl;
00068 if (tpos>0.) {
00069 tpos = 4.;
00070 } else {
00071 tpos = -4.;
00072 }
00073 }
00074
00075 FloatErr sigcorr;
00076 FloatErr sigmap, sigmip;
00077 PlexStripEndId seid;
00078 if (strip->GetNDigit(StripEnd::kNegative)>0) {
00079 seid = strip->GetStripEndId(StripEnd::kNegative);
00080 sigcorr = strip->GetCharge(StripEnd::kNegative,CalDigitType::kSigCorr);
00081 sigmap = cal.GetAttenCorrectedTpos(sigcorr, tpos, seid);
00082 sigmip = cal.GetMIP (sigmap, seid);
00083
00084 candreco->CalibrateSigMapped(seid.GetEncoded(),sigmap);
00085 candreco->CalibrateMIP (seid.GetEncoded(),sigmip);
00086 }
00087 if (strip->GetNDigit(StripEnd::kPositive)>0) {
00088 seid = strip->GetStripEndId(StripEnd::kPositive);
00089 sigcorr = strip->GetCharge(StripEnd::kPositive,CalDigitType::kSigCorr);
00090 sigmap = cal.GetAttenCorrectedTpos(sigcorr, tpos, seid);
00091 sigmip = cal.GetMIP (sigmap, seid);
00092
00093 candreco->CalibrateSigMapped(seid.GetEncoded(),sigmap);
00094 candreco->CalibrateMIP (seid.GetEncoded(),sigmip);
00095 }
00096 }
00097 }
00098 for(Int_t i=0;i<candevent->GetLastTrack();i++){
00099 const CandTrackHandle *candtrack = candevent->GetTrack(i);
00100 TIter stripItr(candtrack->GetDaughterIterator());
00101 while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00102 FloatErr tpos=0.;
00103 switch (strip->GetPlaneView()) {
00104 case PlaneView::kX: case PlaneView::kU:
00105 tpos = candtrack->GetV(strip->GetPlane());
00106 tpos.SetError(candtrack->GetTrackPointError(strip->GetPlane())); // Set error on tpos.
00107 break;
00108 case PlaneView::kY: case PlaneView::kV:
00109 tpos = candtrack->GetU(strip->GetPlane());
00110 tpos.SetError(candtrack->GetTrackPointError(strip->GetPlane())); // Set error on tpos.
00111 break;
00112 default:
00113 continue;
00114 }
00115
00116 if (fabs(tpos)>4.) {
00117 MSG("RecoBase",Msg::kDebug) << "tpos = " << tpos << " outside detector" << endl;
00118 if (tpos>0.) {
00119 tpos = 4.;
00120 } else {
00121 tpos = -4.;
00122 }
00123 }
00124
00125 FloatErr sigcorr;
00126 FloatErr sigmap, sigmip;
00127 PlexStripEndId seid;
00128 if (strip->GetNDigit(StripEnd::kNegative)>0) {
00129 seid = strip->GetStripEndId(StripEnd::kNegative);
00130 sigcorr = strip->GetCharge(StripEnd::kNegative,CalDigitType::kSigCorr);
00131 sigmap = cal.GetAttenCorrectedTpos(sigcorr, tpos, seid);
00132 sigmip = cal.GetMIP( sigmap, seid);
00133
00134 candreco->CalibrateSigMapped(seid.GetEncoded(),sigmap);
00135 candreco->CalibrateMIP (seid.GetEncoded(),sigmip);
00136
00137 }
00138 if (strip->GetNDigit(StripEnd::kPositive)>0) {
00139 seid = strip->GetStripEndId(StripEnd::kPositive);
00140 sigcorr = strip->GetCharge(StripEnd::kPositive,CalDigitType::kSigCorr);
00141 sigmap = cal.GetAttenCorrectedTpos(sigcorr, tpos, seid);
00142 sigmip = cal.GetMIP (sigmap, seid);
00143
00144 candreco->CalibrateSigMapped(seid.GetEncoded(),sigmap);
00145 candreco->CalibrateMIP (seid.GetEncoded(),sigmip);
00146 }
00147 }
00148 }
00149 }
00150
00151 else{
00152 TIter stripItr(candreco->GetDaughterIterator());
00153 Bool_t isTrack = candreco->InheritsFrom("CandTrackHandle");
00154 const CandTrackHandle *candtrack = 0;
00155 if (isTrack) {
00156 candtrack = dynamic_cast<const CandTrackHandle*>(candreco);
00157 }
00158 Bool_t isShower = candreco->InheritsFrom("CandShowerHandle");
00159 const CandShowerHandle *candshower = 0;
00160 if (isShower) {
00161 candshower = dynamic_cast<const CandShowerHandle*>(candreco);
00162 }
00163 Double_t vtxuvpos[2] = {candreco->GetVtxU(),candreco->GetVtxV()};
00164 while (CandStripHandle *strip = dynamic_cast<CandStripHandle*>(stripItr())) {
00165 Int_t iview=-1;
00166 switch (strip->GetPlaneView()) {
00167 case PlaneView::kX: case PlaneView::kU:
00168 iview = 1;
00169 break;
00170 case PlaneView::kY: case PlaneView::kV:
00171 iview = 0;
00172 break;
00173 default:
00174 continue;
00175 }
00176 FloatErr tpos = 0.;
00177 int plane = strip->GetPlane();
00178 // get position of hit along strip from orthogonal view info.
00179 if(candtrack){
00180 if (!iview) {
00181 tpos = candtrack->GetU(plane);
00182 tpos.SetError(candtrack->GetTrackPointError(plane)); // Set error on tpos.
00183 }
00184 else {
00185 tpos = candtrack->GetV(plane);
00186 tpos.SetError(candtrack->GetTrackPointError(plane)); // Set error on tpos.
00187 }
00188 }
00189 else if (candshower){
00190 if (!iview) {
00191 tpos = candshower->GetU(plane);
00192 tpos.SetError(1.0*Munits::meter); // Since this other call doesn't work:
00193 //tpos.SetError( 0.5 * (candshower->GetMaxU(plane) - candshower->GetMinU(plane)) );
00194 }
00195 else {
00196 tpos = candshower->GetV(plane);
00197 tpos.SetError(1.0*Munits::meter); // Since this other call doesn't work:
00198 //tpos.SetError( 0.5 * (candshower->GetMaxV(plane) - candshower->GetMinV(plane)) );
00199 }
00200 }
00201 else {
00202 tpos = vtxuvpos[iview];
00203 }
00204
00205 if (fabs(tpos)>4.) {
00206 MSG("RecoBase",Msg::kDebug) << "tpos = " << tpos << " outside detector" << endl;
00207 if (tpos>0.) {
00208 tpos = 4.;
00209 } else {
00210 tpos = -4.;
00211 }
00212 }
00213
00214
00215 FloatErr sigcorr;
00216 FloatErr sigmap, sigmip;
00217 PlexStripEndId seid;
00218 if (strip->GetNDigit(StripEnd::kNegative)>0) {
00219 seid = strip->GetStripEndId(StripEnd::kNegative);
00220 sigcorr = strip->GetCharge(StripEnd::kNegative,CalDigitType::kSigCorr);
00221 sigmap = cal.GetAttenCorrectedTpos(sigcorr, tpos, seid);
00222 sigmip = cal.GetMIP( sigmap, seid);
00223
00224 candreco->CalibrateSigMapped(seid.GetEncoded(),sigmap);
00225 candreco->CalibrateMIP (seid.GetEncoded(),sigmip);
00226 }
00227 if (strip->GetNDigit(StripEnd::kPositive)>0) {
00228 seid = strip->GetStripEndId(StripEnd::kPositive);
00229 sigcorr = strip->GetCharge(StripEnd::kPositive,CalDigitType::kSigCorr);
00230 sigmap = cal.GetAttenCorrectedTpos(sigcorr, tpos, seid);
00231 sigmip = cal.GetMIP (sigmap, seid);
00232
00233 candreco->CalibrateSigMapped(seid.GetEncoded(),sigmap);
00234 candreco->CalibrateMIP (seid.GetEncoded(),sigmip);
00235 }
00236 }
00237 }
00238 }
|
1.3.9.1