Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

DetectorAlignmentModule Class Reference

#include <DetectorAlignmentModule.h>

Inheritance diagram for DetectorAlignmentModule:

JobCModule List of all members.

Public Member Functions

 DetectorAlignmentModule ()
 ~DetectorAlignmentModule ()
const RegistryDefaultConfig () const
JobCResult Reco (MomNavigator *mom)
void BeginJob ()
void EndJob ()

Private Attributes

DetectorAlignmentfAlign
int fNSnarls
int fNAlignmentTracks
int fNSkippedRecords
TStopwatch fTimer

Constructor & Destructor Documentation

DetectorAlignmentModule::DetectorAlignmentModule  ) 
 

Definition at line 82 of file DetectorAlignmentModule.cxx.

References MSG.

00083    : fAlign(0),
00084      fNSnarls(0),
00085      fNAlignmentTracks(0),
00086      fNSkippedRecords(0)
00087 {
00088    MSG("Align", Msg::kInfo) << "Constructor DetectorAlignmentModule()" << endl;
00089    fAlign = new DetectorAlignment();
00090 }

DetectorAlignmentModule::~DetectorAlignmentModule  ) 
 

Definition at line 100 of file DetectorAlignmentModule.cxx.

References fAlign, and MSG.

00101 {
00102    MSG("Align", Msg::kInfo) << "Destructor ~DetectorAlignmentModule()" << endl;
00103    if(fAlign){
00104       delete fAlign;
00105       fAlign = 0;
00106    }
00107    
00108    MSG("Align", Msg::kInfo) << "Destructor ~DetectorAlignmentModule()... Done" << endl;
00109 }


Member Function Documentation

void DetectorAlignmentModule::BeginJob  )  [virtual]
 

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 92 of file DetectorAlignmentModule.cxx.

References fTimer, and MSG.

00093 {      
00094    MSG("Align", Msg::kInfo) << "DetectorAlignmentModule::BeginJob()" << endl;
00095    fTimer.Start();
00096 
00097 
00098 }

const Registry & DetectorAlignmentModule::DefaultConfig  )  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 192 of file DetectorAlignmentModule.cxx.

References JobCModule::GetName(), and name.

00193 {
00194    //======================================================================
00195    // Supply the default configuration for the module
00196    //======================================================================
00197    static bool been_here = false;
00198    static Registry def_cfg;
00199    if (been_here) 
00200       return def_cfg;
00201    
00202    been_here = true;
00203    
00204    std::string name = this -> JobCModule::GetName();
00205    name += ".config.default";
00206    def_cfg.SetName(name.c_str());
00207    
00208    return def_cfg;
00209 }

void DetectorAlignmentModule::EndJob  )  [virtual]
 

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 211 of file DetectorAlignmentModule.cxx.

References fAlign, fNAlignmentTracks, fNSkippedRecords, fNSnarls, fTimer, and MSG.

00212 {
00213 
00214    MSG("Align", Msg::kInfo) << "DetectorAlignmentModule: EndJob()" << endl
00215                             << "Number of processed snarls: " << fNSnarls << endl
00216                             << "Number of tracks used for alignment: " 
00217                             << fNAlignmentTracks << endl
00218                             << "Number of skipped alignment records: "
00219                             << fNSkippedRecords << endl
00220                             << "Cpu time:  " << fTimer.CpuTime() << endl
00221                             << "Real time: " << fTimer.RealTime() << endl;
00222 
00223    if(fAlign){
00224       delete fAlign;
00225       fAlign = 0;
00226    }
00227 
00228 }

JobCResult DetectorAlignmentModule::Reco MomNavigator mom  )  [virtual]
 

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 111 of file DetectorAlignmentModule.cxx.

References fAlign, CandRecord::FindCandHandle(), fNAlignmentTracks, fNSkippedRecords, fNSnarls, MomNavigator::GetFragment(), CandHandle::GetNDaughters(), RawRecord::GetRawHeader(), RawDaqSnarlHeader::GetSnarl(), DataUtil::GetVldContext(), UgliGeomHandle::GetVldRange(), and MSG.

00112 {
00113 
00114    assert(mom);
00115    const RawRecord* rawrec = dynamic_cast<const RawRecord*>(mom->GetFragment("RawRecord","","DaqSnarl"));
00116    const RawDaqSnarlHeader* rawhdr = dynamic_cast<const RawDaqSnarlHeader*>(rawrec->GetRawHeader());
00117    const CandRecord* cndrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00118 
00119    if( fNSnarls == 0){
00120       UgliGeomHandle ugh(rawhdr -> GetVldContext());
00121       cout << "ugh.GetVldRange():" << ugh.GetVldRange() << endl;
00122       char hname[120];
00123       sprintf(hname,"/home/rustem/events_%4d.root", rawhdr -> GetRun());
00124    }
00125 
00126    fNSnarls++;
00127    if( fNSnarls % 1000 == 0)
00128       MSG("Align", Msg::kInfo) << "Processing snarl #" << fNSnarls <<endl;
00129    
00130    
00131    if (!cndrec) {
00132       MSG("Align", Msg::kError) << "No PrimaryCandidateRecord in Mom" << endl;
00133       return JobCResult::kAOK;
00134    }
00135 
00136    CandTrackSRListHandle* tklh =
00137       dynamic_cast<CandTrackSRListHandle *> (cndrec->FindCandHandle("CandTrackListHandle",""));
00138 
00139    if (!tklh) {
00140       MSG("Align", Msg::kError) << "No CandTrackListHandle found in the event!!!" << endl;
00141       return JobCResult::kAOK;
00142    }
00143    
00144    CandStripListHandle *cslh = dynamic_cast<CandStripListHandle *>
00145       (cndrec->FindCandHandle("CandStripListHandle"));
00146    if (!cslh) {
00147       MSG("Align", Msg::kDebug) << "No CandStripListHandle found!"<<endl;
00148       return JobCResult::kAOK;
00149    }
00150    
00151    if(tklh->GetNDaughters() != 1){
00152       MSG("Align", Msg::kDebug)<< "#tracks = "<< tklh->GetNDaughters()
00153                                << ", bail out of snarl #"<<rawhdr->GetSnarl()<<endl;
00154       return JobCResult::kAOK;  
00155    }      
00156 
00157    TIter itr(tklh -> GetDaughterIterator());
00158    while( CandTrackSRHandle* trkh = dynamic_cast<CandTrackSRHandle*>(itr()) ){
00159       MSG("Align", Msg::kDebug) << "Found alignment track"<< endl;
00160       
00161       fNAlignmentTracks++;
00162       RecCandHeader ntphdr(rawhdr -> GetVldContext(),
00163                            rawhdr -> GetRun(),
00164                            rawhdr -> GetSubRun(),
00165                            rawhdr -> GetRunType(),
00166                            rawhdr -> GetErrorCode(),
00167                            rawhdr -> GetSnarl(),
00168                            rawhdr -> GetTrigSrc(),
00169                            rawhdr -> GetTimeFrameNum(),
00170                            rawhdr -> GetRemoteSpillType(),
00171                            fNAlignmentTracks);
00172       
00173       NtpAlignmentRecord* ntpalignrec = new NtpAlignmentRecord(ntphdr);   
00174       
00175       //Main alignment algorithm
00176       bool result =  fAlign -> RunAlignment(trkh, cslh, ntpalignrec);
00177       
00178       if(result)
00179          mom -> AdoptFragment(ntpalignrec);
00180       else 
00181       {
00182          delete ntpalignrec;
00183          MSG("Align",Msg::kDebug) << "Snarl "<<fNSnarls<<" false result!"<<endl;
00184          fNSkippedRecords++;
00185       }
00186    }
00187    MSG("Align",Msg::kDebug)<<"Alignment module is done with snarl "<<rawhdr->GetSnarl()<<endl; 
00188    return JobCResult::kAOK;
00189 }


Member Data Documentation

DetectorAlignment* DetectorAlignmentModule::fAlign [private]
 

Definition at line 57 of file DetectorAlignmentModule.h.

Referenced by EndJob(), Reco(), and ~DetectorAlignmentModule().

int DetectorAlignmentModule::fNAlignmentTracks [private]
 

Definition at line 60 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

int DetectorAlignmentModule::fNSkippedRecords [private]
 

Definition at line 61 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

int DetectorAlignmentModule::fNSnarls [private]
 

Definition at line 59 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

TStopwatch DetectorAlignmentModule::fTimer [private]
 

Definition at line 63 of file DetectorAlignmentModule.h.

Referenced by BeginJob(), and EndJob().


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:56:29 2007 for loon by  doxygen 1.3.9.1