NtpCluster3DModule Class Reference

#include <NtpCluster3DModule.h>

Inheritance diagram for NtpCluster3DModule:
JobCModule

List of all members.

Public Member Functions

 NtpCluster3DModule ()
 ~NtpCluster3DModule ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
JobCResult Reco (MomNavigator *mom)

Private Member Functions

void FillNtpStrip (NtpCluster3DRecord *ntprec, const CandRecord *cndrec)
void FillNtpCluster (NtpCluster3DRecord *ntprec, const CandRecord *cndrec)
void FillNtpClusterSummary (NtpCluster3DRecord *ntprec, const CandRecord *cndrec)

Private Attributes

std::map< int, int > fStripUidMap
std::map< int, int > fClusterUidMap

Static Private Attributes

static const Double_t kCos45 = 0.70710678

Detailed Description

Definition at line 19 of file NtpCluster3DModule.h.


Constructor & Destructor Documentation

NtpCluster3DModule::NtpCluster3DModule (  )  [inline]

Definition at line 22 of file NtpCluster3DModule.h.

00022 {}

NtpCluster3DModule::~NtpCluster3DModule (  )  [inline]

Definition at line 23 of file NtpCluster3DModule.h.

00023 {}


Member Function Documentation

void NtpCluster3DModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 79 of file NtpCluster3DModule.cxx.

References Msg::kDebug, and MSG.

00079                                                        {
00080   //
00081   // Purpose: Configure the module given a registry.
00082   //
00083   // Arguments: Registry to use to configure the module.
00084   //
00085   // Return: none.
00086   //
00087 
00088   MSG("NtpSR",Msg::kDebug) << "NtpCluster3DModule::Config" << endl;
00089 
00090   /*  
00091   Int_t tmpi;
00092   Double_t tmpd;
00093   //const Char_t* tmps;
00094 
00095   if ( r.Get("PostTrigger",tmpi)) {
00096     fPostTrigger = fabs((Double_t)(tmpi)*1.e-9);
00097   }
00098   if ( r.Get("PostTrigger",tmpd)) {
00099     fPostTrigger = fabs(tmpd*1.e-9);
00100   }
00101 
00102   */
00103 }

const Registry & NtpCluster3DModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 52 of file NtpCluster3DModule.cxx.

References JobCModule::GetName(), Msg::kDebug, and MSG.

00052                                                         {
00053   //
00054   // Purpose: Method to return default configuration.
00055   // 
00056   // Arguments: none.
00057   //
00058   // Return: Registry containing default configuration
00059   //
00060 
00061   MSG("NtpSR",Msg::kDebug) << 
00062     "NtpCluster3DModule::DefaultConfig" << endl;
00063 
00064   static Registry r; 
00065   std::string name = this->JobCModule::GetName();
00066   name += ".config.default";
00067   r.SetName(name.c_str());
00068 
00069   /*
00070   r.UnLockValues();
00071   r.LockValues();
00072   */
00073 
00074   return r;
00075 }

void NtpCluster3DModule::FillNtpCluster ( NtpCluster3DRecord ntprec,
const CandRecord cndrec 
) [private]

Definition at line 197 of file NtpCluster3DModule.cxx.

References NtpCluster3D::AddStripAt(), NtpCluster3DRecord::clu3D, fClusterUidMap, fStripUidMap, CandRecoHandle::GetCharge(), CandHandle::GetDaughterIterator(), CandRecoHandle::GetNStrip(), CandHandle::GetUidInt(), NtpCluster3D::index, CalStripType::kNone, CalStripType::kPE, CalStripType::kSigCorr, CalStripType::kSigLin, Msg::kVerbose, MSG, NtpCluster3DPulseHeight::pe, NtpCluster3D::ph, NtpCluster3DPulseHeight::raw, NtpCluster3DPulseHeight::sigcor, and NtpCluster3DPulseHeight::siglin.

Referenced by Reco().

00197                                                                                            {
00198   //
00199   //  Purpose:  Private method used to fill cluster portion of ntuple record.
00200   //
00201   //  Arguments: pointers to NtpCluster3DRecord and CandRecord
00202   //  
00203   //  Return: status.
00204   // 
00205 
00206   MSG("NtpSR",Msg::kVerbose) << "NtpCluster3DModule::FillNtpCluster" << endl;
00207 
00208     const CandCluster3DListHandle *clusterlisthandle 
00209      = dynamic_cast <const CandCluster3DListHandle*> 
00210        (cndrec -> FindCandHandle("CandCluster3DListHandle","CandCluster3DList"));
00211 
00212   if ( !clusterlisthandle ) return; // all done
00213 
00214 
00215   Int_t ncluster = 0;
00216 
00217   CandCluster3DHandleItr clItr(clusterlisthandle->GetDaughterIterator());
00218 
00219   TClonesArray& clusterarray = *(ntprec->clu3D);
00220 
00221   while ( clItr.IsValid() ) {
00222      CandCluster3DHandle *cluster = clItr.Ptr();    
00223 
00224     Int_t uid = cluster->GetUidInt();
00225 
00226     fClusterUidMap.insert(std::make_pair(uid,ncluster));
00227     // Uses new with placement to efficiently create cluster ntp
00228     NtpCluster3D* ntpcluster 
00229          = new(clusterarray[ncluster++])NtpCluster3D(cluster->GetNStrip());
00230     // Fill indices of associated strips in cluster tree
00231     ntpcluster->index = ncluster - 1;
00232 
00233      CandStripHandleItr stpItr(cluster->GetDaughterIterator());
00234     Int_t nclusterstrip = 0;
00235      while ( stpItr.IsValid() ) {
00236       CandStripHandle *clusterstrip = stpItr.Ptr();
00237       Int_t uid = clusterstrip->GetUidInt();
00238       Int_t stripindex = fStripUidMap[uid];
00239       ntpcluster->AddStripAt(stripindex,nclusterstrip); // add index to strip
00240 
00241     // Set summed charge in cluster
00242       ntpcluster->ph.raw = cluster->GetCharge(CalStripType::kNone);
00243       ntpcluster->ph.siglin = cluster->GetCharge(CalStripType::kSigLin);
00244       ntpcluster->ph.sigcor = cluster->GetCharge(CalStripType::kSigCorr);
00245       ntpcluster->ph.pe = cluster->GetCharge(CalStripType::kPE);
00246       //ntpcluster->ph.sigmap = cluster->GetCharge(CalStripType::kSigMapped);
00247       //ntpcluster->ph.mip = cluster->GetCharge(CalStripType::kMIP);
00248       //ntpcluster->ph.gev = cluster->GetCharge(CalStripType::kGeV);
00249 
00250       nclusterstrip++;
00251       stpItr.Next();
00252      }
00253 
00254     clItr.Next();
00255   }
00256 
00257   return;
00258 }

void NtpCluster3DModule::FillNtpClusterSummary ( NtpCluster3DRecord ntprec,
const CandRecord cndrec 
) [private]

Definition at line 261 of file NtpCluster3DModule.cxx.

References fClusterUidMap, NtpCluster3DRecord::hdr3D, Msg::kVerbose, MSG, and NtpCluster3DSummary::ncluster.

Referenced by Reco().

00262                                                                             {
00263   //
00264   //  Purpose:  Private method used to fill event summary portion of ntuple 
00265   //            record.
00266   //
00267   //  Arguments: pointers to NtpCluster3DRecord and CandRecord
00268   //  
00269   //  Return: none.
00270   // 
00271 
00272 
00273   MSG("NtpSR",Msg::kVerbose) << "NtpCluster3DModule::FillNtpClusterSummary" << endl;
00274 
00275   NtpCluster3DSummary& ntpclustersummary = ntprec->hdr3D;
00276   ntpclustersummary.ncluster = fClusterUidMap.size();
00277 
00278   return;
00279 
00280 }

void NtpCluster3DModule::FillNtpStrip ( NtpCluster3DRecord ntprec,
const CandRecord cndrec 
) [private]

Definition at line 167 of file NtpCluster3DModule.cxx.

References CandRecord::FindCandHandle(), fStripUidMap, CandHandle::GetDaughterIterator(), Msg::kVerbose, and MSG.

Referenced by Reco().

00167                                                                                                {
00168   //
00169   //  Purpose:  Private method used to fill strip portion of ntuple record.
00170   //
00171   //  Arguments: NtpCluster3DRecord and CandRecord
00172   //  
00173   //  Return: status.
00174   // 
00175 
00176   MSG("NtpSR",Msg::kVerbose) << "NtpCluster3DModule::FillNtpStrip" << endl;
00177 
00178   const CandStripListHandle *striplisthandle 
00179    = dynamic_cast <const CandStripListHandle*> 
00180      (cndrec->FindCandHandle("CandStripListHandle"));
00181   if ( !striplisthandle ) return; // no strips => done
00182 
00183   Int_t nstrip = 0;
00184   TIter stripItr(striplisthandle->GetDaughterIterator());
00185   while ( CandStripHandle* strip=dynamic_cast<CandStripHandle*>(stripItr())) {
00186     Int_t uid = strip->GetUidInt();
00187     fStripUidMap.insert(std::make_pair(uid,nstrip));
00188     ++nstrip; 
00189 
00190   } // done with all strips
00191 
00192  
00193   return;
00194 
00195 }

JobCResult NtpCluster3DModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 107 of file NtpCluster3DModule.cxx.

References fClusterUidMap, FillNtpCluster(), FillNtpClusterSummary(), FillNtpStrip(), fStripUidMap, DataUtil::GetCandHeader(), RawDaqSnarlHeader::GetErrorCode(), CandHeader::GetEvent(), MomNavigator::GetFragment(), DataUtil::GetRawHeader(), RawDaqSnarlHeader::GetRemoteSpillType(), RawDaqHeader::GetRun(), RawDaqHeader::GetRunType(), RawDaqSnarlHeader::GetSnarl(), RawDaqHeader::GetSubRun(), RawDaqHeader::GetTimeFrameNum(), RawDaqSnarlHeader::GetTrigSrc(), RecMinosHdr::GetVldContext(), Msg::kDebug, JobCResult::kPassed, Msg::kWarning, MSG, JobCResult::SetFailed(), and JobCResult::SetWarning().

00107                                                      {
00108   //
00109   //  Purpose:  Create and fill ntuple record.
00110   //
00111   //  Arguments: mom.
00112   //  
00113   //  Return: status.
00114   // 
00115 
00116   JobCResult result(JobCResult::kPassed);  
00117   MSG("NtpSR",Msg::kDebug) << "NtpCluster3DModule::Reco" << endl;
00118 
00119   // Reset maps used to associate uid of reconstructed object with array index
00120   fStripUidMap.clear();
00121   //fSliceUidMap.clear();
00122   fClusterUidMap.clear();
00123   //fTrackUidMap.clear();
00124   //fEventUidMap.clear();
00125 
00126   // Check that mom exists.
00127   assert(mom);
00128 
00129   const RawRecord* rawrec = 
00130    dynamic_cast<const RawRecord*>(mom->GetFragment("RawRecord","","DaqSnarl"));
00131   if (!rawrec) {
00132     MSG("NtpSR",Msg::kWarning) << "No DaqSnarl RawRecord in Mom" << endl;
00133     result.SetWarning().SetFailed();
00134     return result;
00135   }
00136 
00137   const CandRecord* cndrec = dynamic_cast<const CandRecord*>
00138           (mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00139   if (!cndrec) {
00140     MSG("NtpSR",Msg::kWarning) << "No PrimaryCandidateRecord in Mom" << endl;
00141     result.SetWarning().SetFailed();
00142     return result;
00143   }
00144 
00145   // Extract header from CandRecord and use this to create RecCandHeader
00146   // and NtpCluster3DRecord.
00147   const CandHeader* cndhdr = cndrec -> GetCandHeader();
00148   const RawDaqSnarlHeader* rawhdr = dynamic_cast<const RawDaqSnarlHeader*>
00149                                     (rawrec -> GetRawHeader());
00150   RecCandHeader ntphdr(rawhdr->GetVldContext(),rawhdr->GetRun(),
00151          rawhdr->GetSubRun(),rawhdr->GetRunType(),rawhdr->GetErrorCode(),
00152          rawhdr->GetSnarl(),rawhdr->GetTrigSrc(),rawhdr->GetTimeFrameNum(),
00153          rawhdr->GetRemoteSpillType(),cndhdr->GetEvent());
00154   NtpCluster3DRecord* ntprec = new NtpCluster3DRecord(ntphdr);
00155   
00156   this -> FillNtpStrip(ntprec,cndrec);
00157   this -> FillNtpCluster(ntprec,cndrec);
00158   this -> FillNtpClusterSummary(ntprec,cndrec);
00159 
00160   mom -> AdoptFragment(ntprec);  // pass record to mom to own
00161 
00162   return result;
00163 
00164 }


Member Data Documentation

std::map<int,int> NtpCluster3DModule::fClusterUidMap [private]

Definition at line 39 of file NtpCluster3DModule.h.

Referenced by FillNtpCluster(), FillNtpClusterSummary(), and Reco().

std::map<int,int> NtpCluster3DModule::fStripUidMap [private]

Definition at line 38 of file NtpCluster3DModule.h.

Referenced by FillNtpCluster(), FillNtpStrip(), and Reco().

const Double_t NtpCluster3DModule::kCos45 = 0.70710678 [static, private]

Definition at line 37 of file NtpCluster3DModule.h.


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1