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

Public Member Functions | |
| AlgFitShowerEM () | |
| virtual | ~AlgFitShowerEM () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
Private Member Functions | |
| void | CopyFromShowerEM (const CandShowerEMHandle *, CandFitShowerEMHandle &) |
Private Attributes | |
| const VldContext * | fVldContext |
| Detector::Detector_t | fDetector |
|
|
Definition at line 41 of file AlgFitShowerEM.cxx. 00042 {
00043 }
|
|
|
Definition at line 46 of file AlgFitShowerEM.cxx. References MSG. 00047 {
00048 MSG("FitShowerEM",Msg::kDebug) << "Deleting AlgFitShowerEM" << endl;
00049 }
|
|
||||||||||||
|
||||||||||||||||
|
Implements AlgBase. Definition at line 52 of file AlgFitShowerEM.cxx. References CopyFromShowerEM(), FitterEM::DoFit(), fDetector, fVldContext, CandRecord::GetCandHeader(), CandHandle::GetCandRecord(), CandRecoHandle::GetCandSlice(), FitterEM::GetChi2(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), CandRecoHandle::GetDirCosU(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), Registry::GetDouble(), CandShowerHandle::GetEnergy(), FitterEM::GetFittedPars(), Registry::GetInt(), FitterEM::GetNDF(), FitterEM::GetNIterations(), CandRecoHandle::GetNStrip(), CandHeader::GetSnarl(), CandHandle::GetVldContext(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), MSG, FitterEM::Pass(), CandFitShowerEMHandle::SetChi2(), CandRecoHandle::SetDirCosU(), CandRecoHandle::SetDirCosV(), CandShowerHandle::SetEnergy(), FitterEM::SetInputParams(), CandFitShowerEMHandle::SetMomentum(), CandFitShowerEMHandle::SetNDOF(), CandFitShowerEMHandle::SetNIterate(), FitterEM::SetNSteps(), CandFitShowerEMHandle::SetPass(), FitterEM::SetStepSize(), CandRecoHandle::SetVtxU(), CandRecoHandle::SetVtxV(), and CandRecoHandle::SetVtxZ(). 00054 {
00055 MSG("Alg", Msg::kDebug) << "Starting AlgFitShowerEM::RunAlg()" << endl;
00056
00057
00058 assert(ch.InheritsFrom("CandFitShowerEMHandle"));
00059 CandFitShowerEMHandle &cfsemh = dynamic_cast<CandFitShowerEMHandle &>(ch);
00060
00061 cfsemh.SetPass(0);
00062
00063 assert(cx.GetDataIn());
00064 assert(cx.GetDataIn()->InheritsFrom("TObjArray"));
00065
00066 const CandShowerEMHandle *shower0 = 0;
00067 const TObjArray *tclist = 0;
00068 const TObjArray *cxin = dynamic_cast<const TObjArray *>(cx.GetDataIn());
00069 for (Int_t i=0; i<=cxin->GetLast(); i++) {
00070 TObject *tobj = cxin->At(i);
00071 if (tobj->InheritsFrom("CandShowerEMHandle")) {
00072 shower0 = dynamic_cast<CandShowerEMHandle*>(tobj);
00073 }
00074 if (tobj->InheritsFrom("TObjArray")) {
00075 tclist = dynamic_cast<TObjArray*>(tobj);
00076 }
00077 }
00078
00079 if(!shower0) return;
00080
00081 fVldContext = const_cast<VldContext*>(shower0->GetVldContext());
00082 assert(fVldContext);
00083 fDetector = fVldContext->GetDetector();
00084 UgliGeomHandle ugh(*fVldContext);
00085
00086 MSG("FitShowerEM", Msg::kDebug)
00087 << "event number " << shower0->GetCandSlice()->GetCandRecord()
00088 ->GetCandHeader()->GetSnarl() << endl;
00089
00090 Double_t theEnergy = shower0->GetEnergy()/2150.;
00091 Double_t vtx[3] = {0};
00092 vtx[0] = shower0->GetVtxU();
00093 vtx[1] = shower0->GetVtxV();
00094 vtx[2] = shower0->GetVtxZ();
00095 Double_t duds = shower0->GetDirCosU();
00096 Double_t dvds = shower0->GetDirCosV();
00097 Double_t dzds = shower0->GetDirCosZ();
00098
00099 Double_t stepSize[6];
00100 stepSize[0] = ac.GetDouble("EnergyStep");
00101 stepSize[1] = ac.GetDouble("UVtxStep");
00102 stepSize[2] = ac.GetDouble("VVtxStep");
00103 stepSize[3] = ac.GetDouble("ZVtxStep");
00104 stepSize[4] = ac.GetDouble("UAngStep");
00105 stepSize[5] = ac.GetDouble("VAngStep");
00106
00107 Int_t nSteps[6];
00108 nSteps[0] = ac.GetInt("EnergyNSteps");
00109 nSteps[1] = ac.GetInt("UVtxNSteps");
00110 nSteps[2] = ac.GetInt("VVtxNSteps");
00111 nSteps[3] = ac.GetInt("ZVtxNSteps");
00112 nSteps[4] = ac.GetInt("UAngNSteps");
00113 nSteps[5] = ac.GetInt("VAngNSteps");
00114
00115 CopyFromShowerEM(shower0,cfsemh);
00116
00117 int nstp = shower0->GetNStrip();
00118 CandStripHandleItr cshi(shower0->GetDaughterIterator());
00119
00120 FitterEM *ffitterEM = new FitterEM(nstp,cshi);
00121 ffitterEM->SetInputParams(theEnergy,vtx,duds/dzds,dvds/dzds);
00122 ffitterEM->SetStepSize(stepSize);
00123 ffitterEM->SetNSteps(nSteps);
00124 ffitterEM->DoFit();
00125
00126 if(ffitterEM->Pass()){
00127 MSG("FitShowerEM",Msg::kDebug) << "Passed" << endl;
00128 cfsemh.SetPass(true);
00129 cfsemh.SetChi2(ffitterEM->GetChi2());
00130 cfsemh.SetNDOF(ffitterEM->GetNDF());
00131 Double_t *fitparms = ffitterEM->GetFittedPars();
00132 cfsemh.SetMomentum(fitparms[0]);
00133 cfsemh.SetEnergy(fitparms[0]);
00134 cfsemh.SetVtxU(fitparms[1]);
00135 cfsemh.SetVtxV(fitparms[2]);
00136 cfsemh.SetVtxZ(fitparms[3]);
00137 cfsemh.SetDirCosU(fitparms[4]);
00138 cfsemh.SetDirCosV(fitparms[5]);
00139 cfsemh.SetNIterate(ffitterEM->GetNIterations());
00140 MSG("FitShowerEM",Msg::kDebug) << "with Chi2/NDOF = "
00141 << ffitterEM->GetChi2()
00142 << "/" << ffitterEM->GetNDF() << endl;
00143 MSG("FitShowerEM",Msg::kDebug) << "and after "
00144 << ffitterEM->GetNIterations()
00145 << " iterations" << endl;
00146 }
00147 else{
00148 MSG("FitShowerEM",Msg::kDebug) << "Failed" << endl;
00149 cfsemh.SetPass(false);
00150 cfsemh.SetChi2(-1);
00151 cfsemh.SetNDOF(-1);
00152 cfsemh.SetNIterate(ffitterEM->GetNIterations());
00153 }
00154 delete ffitterEM;
00155
00156 return;
00157 }
|
|
|
Definition at line 34 of file AlgFitShowerEM.h. Referenced by RunAlg(). |
|
|
Definition at line 33 of file AlgFitShowerEM.h. Referenced by RunAlg(). |
1.3.9.1