AlgFitShowerEM Class Reference

#include <AlgFitShowerEM.h>

Inheritance diagram for AlgFitShowerEM:
AlgBase AlgReco

List of all members.

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 VldContextfVldContext
Detector::Detector_t fDetector

Detailed Description

Definition at line 23 of file AlgFitShowerEM.h.


Constructor & Destructor Documentation

AlgFitShowerEM::AlgFitShowerEM (  ) 

Definition at line 41 of file AlgFitShowerEM.cxx.

00042 {
00043 }

AlgFitShowerEM::~AlgFitShowerEM (  )  [virtual]

Definition at line 46 of file AlgFitShowerEM.cxx.

References Msg::kDebug, and MSG.

00047 {
00048   MSG("FitShowerEM",Msg::kDebug) << "Deleting AlgFitShowerEM" << endl;
00049 }


Member Function Documentation

void AlgFitShowerEM::CopyFromShowerEM ( const CandShowerEMHandle shower0,
CandFitShowerEMHandle cfsemh 
) [private]

Definition at line 159 of file AlgFitShowerEM.cxx.

References CandHandle::AddDaughterLink(), CandShowerEMHandle::GetAvgDev(), CandHandle::GetDaughterIterator(), CandRecoHandle::GetDirCosU(), CandRecoHandle::GetDirCosV(), CandRecoHandle::GetDirCosZ(), CandShowerEMHandle::GetEigenValues(), CandShowerEMHandle::GetEigenVectors(), CandShowerHandle::GetEnergy(), CandShowerEMHandle::GetOutPH(), CandShowerEMHandle::GetShwStatus(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxT(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), CandShowerEMHandle::SetAvgDev(), CandRecoHandle::SetDirCosU(), CandRecoHandle::SetDirCosV(), CandRecoHandle::SetDirCosZ(), CandShowerEMHandle::SetEigenValues(), CandShowerEMHandle::SetEigenVectors(), CandShowerHandle::SetEnergy(), CandShowerEMHandle::SetOutPH(), CandShowerEMHandle::SetShwStatus(), CandRecoHandle::SetVtxPlane(), CandRecoHandle::SetVtxT(), CandRecoHandle::SetVtxU(), CandRecoHandle::SetVtxV(), and CandRecoHandle::SetVtxZ().

Referenced by RunAlg().

00160                                                                     {
00161   
00162   cfsemh.SetVtxPlane(shower0->GetVtxPlane());
00163   cfsemh.SetVtxZ(shower0->GetVtxZ());
00164   cfsemh.SetVtxU(shower0->GetVtxU());
00165   cfsemh.SetVtxV(shower0->GetVtxV());
00166   cfsemh.SetVtxT(shower0->GetVtxT());
00167   cfsemh.SetDirCosU(shower0->GetDirCosU());
00168   cfsemh.SetDirCosV(shower0->GetDirCosV());
00169   cfsemh.SetDirCosZ(shower0->GetDirCosZ());
00170   
00171   cfsemh.SetEigenVectors(shower0->GetEigenVectors());
00172   cfsemh.SetEigenValues(shower0->GetEigenValues());
00173   cfsemh.SetAvgDev(shower0->GetAvgDev());
00174   cfsemh.SetOutPH(shower0->GetOutPH());
00175   cfsemh.SetShwStatus(shower0->GetShwStatus());
00176   cfsemh.SetEnergy(shower0->GetEnergy());
00177 
00178   CandStripHandleItr stripItr(shower0->GetDaughterIterator());
00179   while (CandStripHandle *strip = stripItr()) {
00180     cfsemh.AddDaughterLink(*strip);
00181   }
00182 
00183   //Calibrate(&cfsemh);
00184 
00185 }

void AlgFitShowerEM::RunAlg ( AlgConfig ac,
CandHandle ch,
CandContext cx 
) [virtual]

Implements AlgBase.

Definition at line 52 of file AlgFitShowerEM.cxx.

References CopyFromShowerEM(), fDetector, fVldContext, CandContext::GetDataIn(), VldContext::GetDetector(), Registry::GetDouble(), Registry::GetInt(), Msg::kDebug, and MSG.

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 }


Member Data Documentation

Definition at line 34 of file AlgFitShowerEM.h.

Referenced by RunAlg().

Definition at line 33 of file AlgFitShowerEM.h.

Referenced by RunAlg().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1