00001 #include <iostream> 00002 using std::cerr; 00003 using std::cout; 00004 using std::endl; 00005 00006 #include "Alignment/AlignmentModule.h" 00007 #include "Alignment/AlignHists.h" 00008 00009 #include "Registry/Registry.h" 00010 #include "CandData/CandRecord.h" 00011 #include "RecoBase/CandTrackHandle.h" 00012 #include "RecoBase/CandTrackListHandle.h" 00013 #include "MinosObjectMap/MomNavigator.h" 00014 #include "DataUtil/GetCandidate.h" 00015 00016 #include "JobControl/JobCModuleRegistry.h" 00017 JOBMODULE(AlignmentModule,"Alignment","Aligns detector using straight tracks"); 00018 00019 AlignmentModule::AlignmentModule() 00020 { 00021 this->Init(); 00022 } 00023 00024 AlignmentModule::~AlignmentModule() 00025 { 00026 } 00027 00028 00029 void AlignmentModule::Init(void) 00030 { 00031 std::string name = this->GetName(); 00032 name += ".config.default"; 00033 fDefConfig.SetName(name.c_str()); 00034 // Paul's by default: 00035 fDefConfig.Set("TrackName","candfitthrumuonlist"); 00036 fDefConfig.Set("TrackType","CandThruMuonListHandle"); 00037 fDefConfig.Set("HistFileName","alignment-hists.root"); 00038 fDefConfig.LockValues(); 00039 fConfig = fDefConfig; 00040 } 00041 00042 00043 JobCResult AlignmentModule::Ana(const MomNavigator* mom) 00044 { 00045 00046 CandTrackListHandle* ctlh = DataUtil::GetCandidate<CandTrackListHandle> 00047 (mom, fConfig.GetCharString("TrackType"), 00048 fConfig.GetCharString("TrackName")); 00049 00050 if (!ctlh) { 00051 cerr << "No track\n"; 00052 return JobCResult::kAOK; 00053 } 00054 00055 static bool been_here = false; 00056 if (!been_here) { // need mom, o.w. would be in BeginJob. 00057 UgliGeomHandle ugh(*(ctlh->GetVldContext())); 00058 fSTA.Init(ugh,fConfig.GetCharString("HistFileName")); 00059 been_here = true; 00060 } 00061 00062 CandTrackHandleItr cth_itr(ctlh->GetDaughterIterator()); 00063 for (;cth_itr.IsValid();cth_itr.Next()) { 00064 CandTrackHandle* cth = *cth_itr; 00065 fSTA.AddTrack(*cth); 00066 } 00067 00068 return JobCResult::kAOK; 00069 } 00070 00071 void AlignmentModule::EndJob() 00072 { 00073 cerr << "AlignmentModule::EndJob\n"; 00074 for (int count=0; count<3; ++count) { 00075 double ret = fSTA.ApplyAllTracks(); 00076 fSTA.ApplyAllOffsets(); 00077 cout << count << " returns: " << ret << endl; 00078 } 00079 cerr << "EndJob done\n"; 00080 } 00081 00082 // ClassImp(AlignmentModule)