Cluster3DModule Class Reference

#include <Cluster3DModule.h>

Inheritance diagram for Cluster3DModule:
JobCModule

List of all members.

Public Member Functions

 Cluster3DModule ()
 ~Cluster3DModule ()
void BeginJob ()
void EndJob ()
void BeginFile ()
void EndFile ()
void BeginRun ()
void EndRun ()
JobCResult Ana (const MomNavigator *mom)
JobCResult Reco (MomNavigator *mom)
JobCResult Get (MomNavigator *mom)
JobCResult Put (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Help ()
void Reset ()

Detailed Description

Definition at line 23 of file Cluster3DModule.h.


Constructor & Destructor Documentation

Cluster3DModule::Cluster3DModule (  ) 

Definition at line 42 of file Cluster3DModule.cxx.

References AlgFactory::GetInstance(), Msg::kDebug, MSG, and AlgFactory::Register().

00043 {
00044 //======================================================================
00045 // Purpose: Default constructor
00046 //======================================================================
00047 
00048   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule Constructor - " << endl;
00049 
00050   AlgFactory &af = AlgFactory::GetInstance();
00051   af.Register("AlgCluster3DList","default","libCluster3D.so","AlgConfig");
00052   af.Register("AlgCluster3D","default","libCluster3D.so","AlgConfig");
00053 
00054 }

Cluster3DModule::~Cluster3DModule (  ) 

Definition at line 58 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00059 {
00060 //======================================================================
00061 // Purpose: Default destructor
00062 //======================================================================
00063 
00064   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule Destructor - " << endl;
00065 
00066 }


Member Function Documentation

JobCResult Cluster3DModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 142 of file Cluster3DModule.cxx.

References Msg::kDebug, JobCResult::kPassed, and MSG.

00143 {
00144 //======================================================================
00145 // Purpose: Analysis module 
00146 //======================================================================
00147 
00148   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Ana - " << endl;
00149 
00150   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00151 }

void Cluster3DModule::BeginFile (  )  [virtual]

Implement for notification of begin of file. See GetCurrentFile().

Reimplemented from JobCModule.

Definition at line 94 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00095 {
00096 //======================================================================
00097 // Purpose: Something that should be done at the begin of file
00098 //======================================================================
00099 
00100   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::BeginFile - " << endl;
00101 
00102 }

void Cluster3DModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 70 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00071 {
00072 //======================================================================
00073 // Purpose: Something that should be done at the begin of job
00074 //======================================================================
00075 
00076   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::BeginJob - " << endl;
00077 
00078 }

void Cluster3DModule::BeginRun (  )  [virtual]

Implement for notification of begin of run (meaningful for Daq data only). See GetCurrentRun().

Reimplemented from JobCModule.

Definition at line 118 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00119 {
00120 //======================================================================
00121 // Purpose: Something that should be done at the begin of run
00122 //======================================================================
00123 
00124   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::BeginRun - " << endl;
00125 
00126 }

void Cluster3DModule::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 335 of file Cluster3DModule.cxx.

References Registry::Get(), AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00336 {
00337 //======================================================================
00338 // Purpose: Configure the module given the Registry r
00339 //======================================================================
00340 
00341   Int_t    tmpi;
00342   Double_t tmpd;
00343   //const char* tmps;
00344 
00345   
00346   //if (r.Get("Print",tmpb)) { fPrint = tmpb; }
00347   //if (r.Get("Cdist",tmpi)) { fCdist = tmpi; }
00348   //if (r.Get("Vscint",tmpd)) { fVscint = tmpd; }
00349   //if (r.Get("UseStream",tmps)) { fName = tmps; }
00350 
00351 
00352   // Get singleton instance of AlgFactory.
00353 
00354   AlgFactory &af = AlgFactory::GetInstance();
00355 
00356   // Get algorithm handle and its config
00357    
00358   AlgHandle alglisthandle = af.GetAlgHandle("AlgCluster3DList","default");
00359   AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00360 
00361   alglistconfig.UnLockValues();
00362 
00363   /*
00364   Int_t tmpi;
00365   Double_t tmpd;
00366   const Char_t *tmpc = 0;
00367 
00368   if (r.Get("ListIn",tmpc)) fListIn  = tmpc;
00369   if (r.Get("ListOut",tmpc)) fListOut = tmpc;
00370   */
00371 
00372   if (r.Get("plnDist",tmpi)) {
00373     alglistconfig.Set("plnDist",tmpi);
00374   }
00375   if (r.Get("stpDist",tmpi)) {
00376     alglistconfig.Set("stpDist",tmpi);
00377   }
00378   if (r.Get("minClustStp",tmpi)) {
00379     alglistconfig.Set("minClustStp",tmpi);
00380   }
00381   if (r.Get("minClustAmbStp",tmpi)) {
00382     alglistconfig.Set("minClustAmbStp",tmpi);
00383   }
00384   if (r.Get("minClustPe",tmpd)) {
00385     alglistconfig.Set("minClustPe",tmpd);
00386   }
00387   if (r.Get("maxDist",tmpi)) {
00388     alglistconfig.Set("maxDist",tmpi);
00389   }
00390   if (r.Get("xTalk",tmpi)) {
00391     alglistconfig.Set("xTalk",tmpi);
00392   }
00393   if (r.Get("xTalkMode",tmpi)) {
00394     alglistconfig.Set("xTalkMode",tmpi);
00395   }
00396   if (r.Get("xTalkPeCut",tmpd)) {
00397     alglistconfig.Set("xTalkPeCut",tmpd);
00398   }
00399   if (r.Get("timeInfo",tmpi)) {
00400     alglistconfig.Set("timeInfo",tmpi);
00401   }
00402   if (r.Get("vLightInScint",tmpd)) {
00403     alglistconfig.Set("vLightInScint",tmpd);
00404   }
00405   if (r.Get("t1-t2ResolutionInNs",tmpd)) {
00406     alglistconfig.Set("t1-t2ResolutionInNs",tmpd);
00407   }
00408 
00409   alglistconfig.LockValues();
00410 
00411 }

const Registry & Cluster3DModule::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 247 of file Cluster3DModule.cxx.

References AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), JobCModule::GetName(), Registry::LockValues(), Registry::Merge(), and Registry::Set().

00248 {
00249 //======================================================================
00250 // Purpose: Supply the default configuration for the module
00251 //======================================================================
00252   static Registry r; // Create registry that keeps the default 
00253                      // configuration for module
00254 
00255   // Set name of config
00256 
00257   std::string name = this->JobCModule::GetName();
00258   name += ".config.default";
00259   r.SetName(name.c_str());
00260 
00261 
00262   // Set parameters for the algorithm
00263 
00264   // Get singleton instance of AlgFactory.
00265 
00266   AlgFactory &af = AlgFactory::GetInstance();
00267 
00268   // Get algorithm handle and its config
00269    
00270   AlgHandle alglisthandle = af.GetAlgHandle("AlgCluster3DList","default");
00271   AlgConfig &alglistconfig = alglisthandle.GetAlgConfig();
00272 
00273   //alglistconfig.UnLockValues();
00274 
00275   alglistconfig.Set("plnDist",4); // max distance between two cells in planes
00276   alglistconfig.Set("stpDist",8); // max distance between two cells in stps
00277   //
00278   // There should be enough strips OR enough energy 
00279   // (sum of pe's) to form a cluster 
00280   //
00281   alglistconfig.Set("minClustStp",4); // min number of strips to form a cluster
00282   alglistconfig.Set("minClustAmbStp",4); // min number of strips which belong
00283   // ONLY to a given cluster to treat this cluster as a real one
00284   alglistconfig.Set("minClustPe",10.); // min sum of pe's to form a cluster
00285   alglistconfig.Set("maxDist",3); // max distance between planes to form a cell
00286   //                               
00287   alglistconfig.Set("xTalk",1); // rejection of crossTalk hits:- 1=on 0=off
00288   alglistconfig.Set("xTalkMode",2); // 1 = rejection of all XTalk hits
00289                                     // 2 = rejection of the isolated XTalk hits
00290   alglistconfig.Set("xTalkPeCut",2.); // if strip has only one digit 
00291                     // and pulse height is < xTalkPeCut than it is a crosstalk
00292   alglistconfig.Set("timeInfo",0); // Timing information used:- 1=yes 0=no
00293   alglistconfig.Set("vLightInScint",2.179); // eff. velocity of light in scint
00294   alglistconfig.Set("t1-t2ResolutionInNs",3.5); // t1-t2 time resolution
00295   
00296   //alglistconfig.LockValues();
00297   // Keys = Names
00298   //alglistconfig.LockKeys();
00299 
00300   // Set general parameters for module
00301 
00302   // This bit is important if one wants to
00303   // guard against typos when configuring a module
00304   //   
00305   // a FILLED out default configuration Registry 
00306   // has to be returned
00307   
00308 
00309   static bool been_here = false;
00310   if (!been_here) {
00311       been_here = true;
00312 
00313       std::string name = this->JobCModule::GetName();
00314       name += ".config.default";
00315       r.SetName(name.c_str());
00316 
00317       /*  
00318 
00319       r.Set("ListIn","CandSliceSRList");
00320       r.Set("ListOut","CandClusterSRList");
00321 
00322       */
00323 
00324       r.Merge(alglistconfig);
00325       r.LockValues();
00326   }
00327 
00328   // returns registry with the default configuration to the JobModule 
00329 
00330   return r;
00331 }

void Cluster3DModule::EndFile (  )  [virtual]

Implement for notification of end of file. See GetLastFile().

Reimplemented from JobCModule.

Definition at line 106 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00107 {
00108 //======================================================================
00109 // Purpose: Something that should be done at the end of file
00110 //======================================================================
00111 
00112   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::EndFile - " << endl;
00113 
00114 }

void Cluster3DModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 82 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00083 {
00084 //======================================================================
00085 // Purpose: Something that should be done at the end of job
00086 //======================================================================
00087 
00088   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::EndJob - " << endl;
00089 
00090 }

void Cluster3DModule::EndRun (  )  [virtual]

Implement for notification of end of run (meaningful for Daq data only). See GetLastRun().

Reimplemented from JobCModule.

Definition at line 130 of file Cluster3DModule.cxx.

References Msg::kDebug, and MSG.

00131 {
00132 //======================================================================
00133 // Purpose: Something that should be done at the end of run
00134 //======================================================================
00135 
00136   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::EndRun - " << endl;
00137 
00138 }

JobCResult Cluster3DModule::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 449 of file Cluster3DModule.cxx.

References Msg::kDebug, JobCResult::kPassed, and MSG.

00450 {
00451 //======================================================================
00452 // FILL_IN: [Document your code!!]
00453 //======================================================================
00454 
00455   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Get - " << endl;
00456 
00457   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00458 }

void Cluster3DModule::Help (  )  [virtual]

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 415 of file Cluster3DModule.cxx.

00416 {
00417 //======================================================================
00418 // HELP
00419 // No longer needed. Use Module::Report() to see list of parameters
00420 // which can be set using Set("name=value"). You can override the 
00421 // default Report command
00422 //
00423 //======================================================================
00424 }

JobCResult Cluster3DModule::Put ( const MomNavigator mom  )  [virtual]

Implement if your module needs to write data to some external sink.

Reimplemented from JobCModule.

Definition at line 462 of file Cluster3DModule.cxx.

References Msg::kDebug, JobCResult::kPassed, and MSG.

00463 {
00464 //======================================================================
00465 // FILL_IN: [Document your code!!]
00466 //======================================================================
00467 
00468   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Put - " << endl;
00469 
00470   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00471 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 155 of file Cluster3DModule.cxx.

References CandRecord::FindCandHandle(), AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), CandHandle::GetNDaughters(), JobCResult::kAOK, Msg::kDebug, JobCResult::kFailed, JobCResult::kWarning, Msg::kWarning, CandCluster3DList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), CandHandle::SetName(), and CandHandle::SetTitle().

00156 {
00157 //======================================================================
00158 // Purpose: Reconstruction module
00159 //======================================================================
00160 
00161   MSG("Cluster3D",Msg::kDebug) << " - Cluster3DModule::Reco - " << endl;
00162 
00163 // Find Candidate Record
00164 
00165   CandRecord* candrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00166   if(candrec==0){
00167     MSG("Cluster3D",Msg::kWarning) 
00168        << "Cluster3DModule::Reco: Failed to Find CandRecord " << endl;
00169     return (JobCResult::kWarning);
00170   }
00171 
00172   //
00173   // Find number of digits for debug purposes
00174   //
00175 
00176   CandDigitListHandle *digitlist = dynamic_cast<CandDigitListHandle*>
00177     (candrec->FindCandHandle("CandDigitListHandle"));
00178 
00179   if(!digitlist){
00180     MSG("Cluster3D",Msg::kDebug)
00181        << " No CandDigitListHandle in CandRecord" << endl;
00182   }
00183   else{
00184     Int_t ndigits = digitlist->GetNDaughters();
00185     MSG("Cluster3D",Msg::kDebug)  
00186        << " Found " << ndigits << " digits" << endl;
00187   }
00188 
00189   // Find CandSliceList in the primary Candidate Record
00190 
00191   CandSliceListHandle* slclisth = dynamic_cast<CandSliceListHandle*>
00192 (candrec->FindCandHandle("CandSliceListHandle") );
00193 
00194   //There should be non-zero number of slices
00195 
00196   if(!slclisth){
00197     MSG("Cluster3D",Msg::kWarning) << "Cluster3DModule::Reco:" 
00198              << "No CandSliceListHandle in CandRecord" << endl;
00199     return JobCResult::kFailed;
00200   }
00201   else{
00202     Int_t nslice = slclisth->GetNDaughters();
00203     MSG("Cluster3D",Msg::kDebug) << " Cluster3DModule::Reco: " 
00204        << " Found " << nslice << " slices" << endl;
00205   }
00206 
00207   // Select algorithm
00208 
00209   // create Singleton Instance of AlgFactory
00210   AlgFactory &af = AlgFactory::GetInstance();
00211 
00212   // create AlgHandle
00213   AlgHandle aclh = af.GetAlgHandle("AlgCluster3DList","default");
00214 
00215   // Define context : CandContext 
00216   CandContext cx(this, mom);
00217   cx.SetDataIn(slclisth);
00218   cx.SetCandRecord(candrec);
00219 
00220   // Make Candidate - MakeCandidate method creates  a CandCluster3DList
00221   // object using the Algorithm handle and the CandContext.
00222  
00223   CandCluster3DListHandle clustlisth = 
00224         CandCluster3DList::MakeCandidate(aclh, cx);
00225 
00226     CandCluster3DListHandle* cl = &clustlisth;
00227     Int_t nclust = cl->GetNDaughters();
00228     MSG("Cluster3D",Msg::kDebug) << " Cluster3DModule::Reco: " 
00229        << " Found " << nclust << " clusters" << endl;
00230 
00231   // Set Name and Title
00232 
00233    clustlisth.SetName("CandCluster3DList");
00234    clustlisth.SetTitle(TString("Created by Cluster3DModule from ").
00235                  Append(slclisth->GetName()));
00236 
00237 
00238 // Add handle to CandRecord
00239    candrec->SecureCandHandle(clustlisth);
00240 
00241   return JobCResult::kAOK; // possibilites: kPassed, kFailed, 
00242                            // kAOK, kWarning, kError, kFatal
00243 }

void Cluster3DModule::Reset (  )  [virtual]

Implement to reset oneself

Reimplemented from JobCModule.

Definition at line 440 of file Cluster3DModule.cxx.

00441 {
00442 //======================================================================
00443 // FILL_IN: [Document your code!!]
00444 //======================================================================
00445 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1