Anp::FillShower Class Reference

#include <FillShower.h>

Inheritance diagram for Anp::FillShower:
Anp::AlgStore Anp::Base

List of all members.

Public Member Functions

 FillShower ()
virtual ~FillShower ()
bool Run (Record &record, TObject *ptr=0)
void Config (const Registry &reg)

Private Attributes

bool fCorr
FillBasic fBasic

Detailed Description

Definition at line 18 of file FillShower.h.


Constructor & Destructor Documentation

Anp::FillShower::FillShower (  ) 

Definition at line 31 of file FillShower.cxx.

00032    :fCorr(true)
00033 {    
00034 }

Anp::FillShower::~FillShower (  )  [virtual]

Definition at line 37 of file FillShower.cxx.

00038 {
00039 }


Member Function Documentation

void Anp::FillShower::Config ( const Registry reg  )  [virtual]

Reimplemented from Anp::AlgStore.

Definition at line 155 of file FillShower.cxx.

References Anp::FillBasic::Config(), fBasic, fCorr, Registry::KeyExists(), and Anp::Read().

00156 {
00157    //
00158    // Configure self
00159    //
00160    
00161    Anp::Read(reg, "FillShowerCorr", fCorr);
00162 
00163    fBasic.Config(reg);
00164 
00165    if(reg.KeyExists("PrintConfig"))
00166    {
00167       cout << "FillShower::Config" << endl
00168            << "   Corr = " << fCorr << endl;
00169    }
00170 }

bool Anp::FillShower::Run ( Record record,
TObject *  ptr = 0 
) [virtual]

Implements Anp::AlgStore.

Definition at line 42 of file FillShower.cxx.

References Anp::Record::Add(), Anp::Shower::em, fBasic, Anp::Shower::fBasic, fCorr, Anp::FillBasic::Fill(), EnergyCorrections::FullyCorrectShowerEnergy(), Anp::Shower::fVtx, Anp::FillBasic::GetBasic(), Anp::FillBasic::GetBegVtx(), Anp::Record::GetHeader(), RecRecordImp< T >::GetVldContext(), Anp::Shower::index, Anp::Header::IsValid(), CandShowerHandle::kCC, Msg::kError, CandShowerHandle::kNC, Msg::kWarning, CandShowerHandle::kWtCC, CandShowerHandle::kWtNC, Anp::Shower::lin_cc, Anp::Shower::lin_cc_def, Anp::Shower::lin_nc, Anp::Shower::lin_nc_def, MSG, Anp::Shower::wt_cc, Anp::Shower::wt_cc_def, Anp::Shower::wt_nc, and Anp::Shower::wt_nc_def.

00043 {
00044    //
00045    // Fill reconstructed shower information for PhysicsNtuple/Shower.h
00046    //
00047 
00048    if(!record.GetHeader().IsValid())
00049    {
00050       MSG("FillAlg", Msg::kError) << "Header is not valid" << endl;
00051       return false;
00052    }
00053 
00054    NtpStRecord *ntprec = dynamic_cast<NtpStRecord *>(ptr);
00055    if(!ntprec)
00056    {
00057       const MomNavigator *mom = dynamic_cast<const MomNavigator *> (ptr);
00058       if(mom)
00059       {
00060          ntprec = dynamic_cast<NtpStRecord *>(mom -> GetFragment("NtpStRecord")); 
00061       }
00062       else
00063       {
00064          MSG("FillAlg", Msg::kError) << "Failed to find MomNavigator pointer" << endl;
00065          return false;
00066       }      
00067    }
00068 
00069    if(!ntprec)
00070    {
00071       MSG("FillAlg", Msg::kError) << "Failed to get NtpStRecord pointer" << endl;
00072       return false;
00073    }
00074 
00075    const TClonesArray *shower_array = ntprec -> shw;
00076    if(!shower_array)
00077    {
00078       MSG("FillAlg", Msg::kError) << "NtpStRecord does not have valid shower array." <<endl;
00079       return true;
00080    }
00081 
00082    const VldContext vldc = ntprec -> GetHeader().GetVldContext();
00083    const int nshowers = shower_array -> GetEntries();
00084 
00085    for(int i = 0; i < nshowers; ++i)
00086    {
00087       NtpSRShower *ntpshw  = dynamic_cast<NtpSRShower *>(shower_array -> At(i));
00088       if(!ntpshw)
00089       {
00090          MSG("FillAlg", Msg::kWarning) << "No shower at " << i << endl;
00091          continue;
00092       }
00093 
00094       if(ntpshw -> index != i)
00095       {
00096          MSG("FillAlg", Msg::kWarning) << "Mismatched shower index" << endl;
00097          continue;
00098       }
00099 
00100       if(!fBasic.Fill(*ntprec, *ntpshw))
00101       {
00102          MSG("FillAlg", Msg::kError) << "Failed to fill basic shower information" << endl;
00103          continue;
00104       }
00105 
00106       Shower shower;
00107       
00108       shower.index      = ntpshw -> index;
00109       shower.lin_cc_def = ntpshw -> shwph.linCCgev;
00110       shower.lin_nc_def = ntpshw -> shwph.linNCgev;
00111       shower.wt_cc_def  = ntpshw -> shwph.wtCCgev;
00112       shower.wt_nc_def  = ntpshw -> shwph.wtNCgev;
00113       shower.em         = ntpshw -> shwph.EMgev;
00114 
00115       if(fCorr)
00116       {
00117          shower.lin_cc = FullyCorrectShowerEnergy(ntpshw -> shwph.linCCgev,
00118                                                   CandShowerHandle::kCC,
00119                                                   vldc,
00120                                                   ntprec -> GetRelease());
00121          
00122          shower.wt_cc = FullyCorrectShowerEnergy(ntpshw -> shwph.wtCCgev,
00123                                                  CandShowerHandle::kWtCC,
00124                                                  vldc,
00125                                                  ntprec -> GetRelease());
00126          
00127          shower.lin_nc = FullyCorrectShowerEnergy(ntpshw -> shwph.linNCgev,
00128                                                   CandShowerHandle::kNC,
00129                                                   vldc,
00130                                                   ntprec -> GetRelease());
00131          
00132          shower.wt_nc = FullyCorrectShowerEnergy(ntpshw -> shwph.wtNCgev,
00133                                                  CandShowerHandle::kWtNC,
00134                                                  vldc,
00135                                                  ntprec -> GetRelease());
00136       }
00137       else
00138       {
00139          shower.lin_cc = ntpshw -> shwph.linCCgev;
00140          shower.lin_nc = ntpshw -> shwph.linNCgev;
00141          shower.wt_cc  = ntpshw -> shwph.wtCCgev;
00142          shower.wt_nc  = ntpshw -> shwph.wtNCgev;
00143       }
00144       
00145       shower.fBasic = fBasic.GetBasic();
00146       shower.fVtx   = fBasic.GetBegVtx();
00147       
00148       record.Add(shower);
00149    }
00150    
00151    return true;
00152 }


Member Data Documentation

Definition at line 33 of file FillShower.h.

Referenced by Config(), and Run().

bool Anp::FillShower::fCorr [private]

Definition at line 31 of file FillShower.h.

Referenced by Config(), and Run().


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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1