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

DetectorAlignmentModule Class Reference

#include <DetectorAlignmentModule.h>

Inheritance diagram for DetectorAlignmentModule:

JobCModule List of all members.

Public Member Functions

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

Private Attributes

DetectorAlignmentfAlign
int fNRecords
int fNProcessedRecords
int fNSkippedRecords
int fNAlignmentTracks
int fNMultipleTracks
TStopwatch fTimer

Constructor & Destructor Documentation

DetectorAlignmentModule::DetectorAlignmentModule  ) 
 

Definition at line 40 of file DetectorAlignmentModule.cxx.

References fAlign, and MSG.

00041    : fAlign(0),
00042      fNRecords(0),
00043      fNProcessedRecords(0),
00044      fNSkippedRecords(0),
00045      fNAlignmentTracks(0),
00046      fNMultipleTracks(0)
00047 {
00048    MSG("Align", Msg::kInfo) << "Constructor DetectorAlignmentModule()" << endl;
00049    fAlign = new DetectorAlignment();
00050 }

DetectorAlignmentModule::~DetectorAlignmentModule  )  [virtual]
 

Definition at line 178 of file DetectorAlignmentModule.cxx.

References fAlign, and MSG.

00179 {
00180    MSG("Align", Msg::kInfo) << "Destructor ~DetectorAlignmentModule()" << endl;
00181    if(fAlign)
00182    {
00183       delete fAlign;
00184       fAlign = 0;
00185    }
00186 }


Member Function Documentation

void DetectorAlignmentModule::BeginJob  )  [virtual]
 

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 52 of file DetectorAlignmentModule.cxx.

References fTimer, and MSG.

00053 {      
00054    MSG("Align", Msg::kInfo) << "DetectorAlignmentModule::BeginJob()" << endl;
00055    fTimer.Start();
00056 }

void DetectorAlignmentModule::EndJob  )  [virtual]
 

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 159 of file DetectorAlignmentModule.cxx.

References fAlign, fNAlignmentTracks, fNMultipleTracks, fNProcessedRecords, fNRecords, fNSkippedRecords, fTimer, and MSG.

00160 {
00161 
00162    MSG("Align", Msg::kInfo) << "DetectorAlignmentModule: EndJob()" << endl
00163                             << "Number of processed snarls: " << fNRecords << endl
00164                             << "Number of alignment tracks: " << fNAlignmentTracks << endl
00165                             << "Number of proccesed records: " << fNProcessedRecords << endl
00166                             << "Number of skipped records: " << fNSkippedRecords << endl
00167                             << "Number of multiple tracks records: " << fNMultipleTracks << endl 
00168                             << "Cpu time:  " << fTimer.CpuTime() << endl
00169                             << "Real time: " << fTimer.RealTime() << endl;
00170 
00171    if(fAlign){
00172       delete fAlign;
00173       fAlign = 0;
00174    }
00175 }

JobCResult DetectorAlignmentModule::Reco MomNavigator mom  )  [virtual]
 

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 58 of file DetectorAlignmentModule.cxx.

References fAlign, fNAlignmentTracks, fNMultipleTracks, fNProcessedRecords, fNRecords, fNSkippedRecords, CandHandle::GetNDaughters(), RawRecord::GetRawHeader(), DataUtil::GetVldContext(), and MSG.

00059 {
00060    assert(mom);
00061    fNRecords++;
00062 
00063    RawRecord *raw_record=0;
00064    CandRecord *cand_record=0;
00065    int n_raw_record=0, n_cand_record=0;
00066 
00067    TIter mit(mom -> FragmentIter());
00068    TObject *fragment_obj;
00069    while( (fragment_obj = mit()) ) 
00070    {
00071       raw_record  = dynamic_cast<RawRecord *> (fragment_obj);
00072       cand_record = dynamic_cast<CandRecord *> (fragment_obj);
00073       if(raw_record) n_raw_record++;
00074       if(cand_record) n_cand_record++;
00075    }
00076 
00077    if(n_raw_record != 1 && n_cand_record != 1)
00078    {
00079       MSG("Align", Msg::kWarning) << "Multiple entries for RawRecord or CandRecord!" << endl;
00080       return JobCResult::kAOK;
00081    }
00082    
00083    const RawDaqSnarlHeader *rawhdr = dynamic_cast<const RawDaqSnarlHeader *>(raw_record->GetRawHeader());
00084    if(!rawhdr) 
00085    {
00086       MSG("Align", Msg::kError) << "Missing required raw data header." << endl;
00087       return JobCResult::kAOK;
00088    }
00089 
00090    CandTrackSRListHandle *tklh=0;
00091    CandStripListHandle *cslh=0;
00092    int n_track_lists=0, n_strip_lists=0;
00093 
00094    TIter cit(cand_record -> GetCandHandleIter());
00095    TObject *cand_obj;
00096    while( (cand_obj = mit()) ) 
00097    {
00098       tklh = dynamic_cast<CandTrackSRListHandle *> (cand_obj);
00099       cslh = dynamic_cast<CandStripListHandle *> (cand_obj);
00100       if(tklh) n_track_lists++;
00101       if(cslh) n_strip_lists++;
00102    }
00103 
00104    if(n_track_lists != 1 && n_strip_lists != 1)
00105    {
00106       MSG("Align", Msg::kWarning) << "Multiple entries for track or strip lists." << endl;
00107       return JobCResult::kAOK;
00108    }
00109 
00110 
00111    if(tklh->GetNDaughters() != 1)
00112    {
00113       fNMultipleTracks++;
00114       MSG("Align", Msg::kDebug)<< "There are "<< tklh -> GetNDaughters() << " tracks." << endl;
00115       return JobCResult::kAOK;  
00116    }      
00117 
00118    TIter itr(tklh -> GetDaughterIterator());
00119    while( CandTrackSRHandle* trkh = dynamic_cast<CandTrackSRHandle *>(itr()) )
00120    {
00121       MSG("Align", Msg::kDebug) << "Found alignment track"<< endl;
00122       
00123       fNAlignmentTracks++;
00124       RecCandHeader ntphdr(rawhdr -> GetVldContext(),
00125                            rawhdr -> GetRun(),
00126                            rawhdr -> GetSubRun(),
00127                            rawhdr -> GetRunType(),
00128                            rawhdr -> GetErrorCode(),
00129                            rawhdr -> GetSnarl(),
00130                            rawhdr -> GetTrigSrc(),
00131                            rawhdr -> GetTimeFrameNum(),
00132                            rawhdr -> GetRemoteSpillType(),
00133                            fNAlignmentTracks);
00134       
00135       NtpAlignmentRecord* ntpalignrec = new NtpAlignmentRecord(ntphdr);   
00136       
00137       //Main alignment algorithm
00138       const bool result =  fAlign -> RunAlignment(trkh, cslh, ntpalignrec);
00139       
00140       if(result)
00141          mom -> AdoptFragment(ntpalignrec);
00142       else 
00143       {
00144          delete ntpalignrec;
00145          MSG("Align",Msg::kDebug) << "Snarl "<<fNRecords<<" false result!"<<endl;
00146          fNSkippedRecords++;
00147       }
00148    }
00149 
00150    if(fNRecords % 1000 == 0)
00151       MSG("Align", Msg::kInfo) << "DetectorAlignmentModule snarl #" << fNRecords << endl;
00152    else 
00153       MSG("Align",Msg::kDebug) << "DetectorAlignmentModule snarl #" << fNRecords << endl; 
00154 
00155    fNProcessedRecords++;
00156    return JobCResult::kAOK;
00157 }


Member Data Documentation

DetectorAlignment* DetectorAlignmentModule::fAlign [private]
 

Definition at line 45 of file DetectorAlignmentModule.h.

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

int DetectorAlignmentModule::fNAlignmentTracks [private]
 

Definition at line 50 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

int DetectorAlignmentModule::fNMultipleTracks [private]
 

Definition at line 51 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

int DetectorAlignmentModule::fNProcessedRecords [private]
 

Definition at line 48 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

int DetectorAlignmentModule::fNRecords [private]
 

Definition at line 47 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

int DetectorAlignmentModule::fNSkippedRecords [private]
 

Definition at line 49 of file DetectorAlignmentModule.h.

Referenced by EndJob(), and Reco().

TStopwatch DetectorAlignmentModule::fTimer [private]
 

Definition at line 53 of file DetectorAlignmentModule.h.

Referenced by BeginJob(), and EndJob().


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:01:07 2008 for loon by  doxygen 1.3.9.1