#include <RemoveMuon.h>
Inheritance diagram for RemoveMuon:

Public Member Functions | |
| RemoveMuon () | |
| ~RemoveMuon () | |
| void | BeginJob () |
| void | EndJob () |
| void | BeginFile () |
| void | EndFile () |
| JobCResult | Ana (const MomNavigator *mom) |
| JobCResult | Reco (MomNavigator *mom) |
| const Registry & | DefaultConfig () const |
| void | Config (const Registry &r) |
Private Attributes | |
| std::string | fAlgName |
| std::string | fAlgConfig |
| std::string | fNameListOut |
| std::string | fAlgOutputName |
| std::string | fAlgOutputConfig |
| int | fMakeNtp |
| std::string | fNtpFileName |
| std::string | fNtpTreeName |
| std::string | fTrackListName |
| TFile * | fNtpFile |
| TTree * | fNtpTree |
| Int_t | fNtpRun |
| Int_t | fNtpSnarl |
| Float_t | fNtpVtxX |
| Float_t | fNtpVtxY |
| Float_t | fNtpVtxZ |
| Int_t | fNtpVtxP |
| Int_t | fNtpNPln |
| Float_t | fNtpPRng |
| Float_t | fNtpPCrv |
| Float_t | fNtpVDrX |
| Float_t | fNtpVDrY |
| Float_t | fNtpVDrZ |
| Int_t | fNtpFitP |
| Int_t | fNtpEndC |
| Int_t | fNtpPass |
| Float_t | fNtpPMuX |
| Float_t | fNtpPMuY |
| Float_t | fNtpPMuZ |
Definition at line 19 of file RemoveMuon.h.
| RemoveMuon::RemoveMuon | ( | ) |
Definition at line 47 of file RemoveMuon.cxx.
00047 : 00048 fAlgName(""), 00049 fAlgConfig(""), 00050 fNameListOut(""), 00051 fAlgOutputName(""), 00052 fAlgOutputConfig(""), 00053 fMakeNtp(0), 00054 fNtpFileName("muon_removal.root"), fNtpTreeName("ms"), 00055 fTrackListName("CandFitTrackCamList"), 00056 fNtpFile(NULL), fNtpTree(NULL), 00057 fNtpRun(0), fNtpSnarl(0), 00058 fNtpVtxX(0), fNtpVtxY(0), fNtpVtxZ(0), fNtpVtxP(0), fNtpNPln(0), 00059 fNtpPRng(0), fNtpPCrv(0), fNtpVDrX(0), fNtpVDrY(0), fNtpVDrZ(0), 00060 fNtpFitP(0), fNtpEndC(0), 00061 fNtpPass(0), fNtpPMuX(0), fNtpPMuY(0), fNtpPMuZ(0) 00062 { 00063 }
| RemoveMuon::~RemoveMuon | ( | ) |
| JobCResult RemoveMuon::Ana | ( | const MomNavigator * | mom | ) | [virtual] |
Implement this for read only access to the MomNavigator
Reimplemented from JobCModule.
Definition at line 129 of file RemoveMuon.cxx.
References CandRecord::FindCandHandle(), fMakeNtp, fNtpEndC, fNtpFitP, fNtpNPln, fNtpPass, fNtpPCrv, fNtpPMuX, fNtpPMuY, fNtpPMuZ, fNtpPRng, fNtpRun, fNtpSnarl, fNtpTree, fNtpVDrX, fNtpVDrY, fNtpVDrZ, fNtpVtxP, fNtpVtxX, fNtpVtxY, fNtpVtxZ, CandRecoHandle::GetEndPlane(), MomNavigator::GetFragment(), RecMinos::GetHeader(), CandFitTrackHandle::GetMomentumCurve(), CandFitTrackHandle::GetMomentumRange(), CandFitTrackHandle::GetPass(), GetRemovableTrack(), MINFHeader::GetRun(), CandRecoHandle::GetVtxDirCosU(), CandRecoHandle::GetVtxDirCosV(), CandRecoHandle::GetVtxDirCosZ(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), header, Msg::kDebug, Msg::kError, JobCResult::kPassed, MSG, SelectEvent(), JobCResult::SetFailed(), and TrackEndContained().
00130 { 00135 JobCResult result(JobCResult::kPassed); 00136 00137 CandRecord* record = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord")); 00138 if(!record){ 00139 MSG("RmMu",Msg::kError) << " Unable to find CandRecord in mom !!! " << endl; 00140 result.SetFailed(); 00141 return result; 00142 } 00143 const CandHeader* header = dynamic_cast<const CandHeader*>(record->GetHeader()); 00144 00145 CandEventListHandle * eventlist = dynamic_cast<CandEventListHandle*> 00146 (record->FindCandHandle("CandEventListHandle")); 00147 if(!eventlist){ 00148 MSG("RmMun",Msg::kDebug) << " Rejecting event as it has no events " << endl; 00149 result.SetFailed(); 00150 return result; 00151 } 00152 00153 //bool has_good_track = 0; 00154 00155 TIter event_iter(eventlist->GetDaughterIterator()); 00156 while( const CandEventHandle* event = dynamic_cast<const CandEventHandle*>(event_iter()) ){ 00157 cout << " Event has " << event->GetLastTrack()+1 << " tracks " <<endl; 00158 if(SelectEvent(event)){ 00159 if(fMakeNtp){ 00160 const CandTrackHandle* track_tmp = GetRemovableTrack(event); 00161 const CandFitTrackHandle* track = dynamic_cast<const CandFitTrackHandle*>(track_tmp); 00162 if(track==NULL){ 00163 MSG("RmMu",Msg::kError) << " GetRemovableTrack failed to return a good track " << endl; 00164 continue; 00165 } 00166 fNtpRun = header->GetRun(); 00167 fNtpSnarl = header->GetSnarl(); 00168 fNtpVtxX = .707106781*(track->GetVtxU() - track->GetVtxV()); 00169 fNtpVtxY = .707106781*(track->GetVtxU() + track->GetVtxV()); 00170 fNtpVtxZ = track->GetVtxZ(); 00171 fNtpVtxP = track->GetVtxPlane(); 00172 fNtpNPln = abs(track->GetEndPlane() - track->GetVtxPlane()) +1; 00173 fNtpPRng = track->GetMomentumRange(); 00174 fNtpPCrv = track->GetMomentumCurve(); 00175 fNtpVDrX = 0.707106781*(track->GetVtxDirCosU() - track->GetVtxDirCosV()) ; 00176 fNtpVDrY= 0.707106781*(track->GetVtxDirCosU() + track->GetVtxDirCosV()) ; 00177 fNtpVDrZ = track->GetVtxDirCosZ(); 00178 fNtpFitP = track->GetPass(); 00179 fNtpEndC = TrackEndContained(track); 00180 fNtpPass = 0; 00181 Float_t momentum = fNtpPRng; 00182 fNtpPass = 1; 00183 if(!fNtpEndC){ 00184 fNtpPass = fNtpFitP; 00185 momentum = fNtpPCrv; 00186 } 00187 fNtpPMuX = fNtpVDrX*fabs(momentum); 00188 fNtpPMuY = fNtpVDrY*fabs(momentum); 00189 fNtpPMuZ = fNtpVDrZ*fabs(momentum); 00190 fNtpTree->Fill(); 00191 } 00192 }else{ 00193 result.SetFailed(); 00194 } 00195 } //iterate over events. 00196 return result; 00197 00198 }
| void RemoveMuon::BeginFile | ( | ) | [virtual] |
Implement for notification of begin of file. See GetCurrentFile().
Reimplemented from JobCModule.
Definition at line 117 of file RemoveMuon.cxx.
| void RemoveMuon::BeginJob | ( | ) | [virtual] |
Implement for notification of begin of job
Reimplemented from JobCModule.
Definition at line 72 of file RemoveMuon.cxx.
References fMakeNtp, fNtpEndC, fNtpFile, fNtpFileName, fNtpFitP, fNtpNPln, fNtpPass, fNtpPCrv, fNtpPMuX, fNtpPMuY, fNtpPMuZ, fNtpPRng, fNtpRun, fNtpSnarl, fNtpTree, fNtpTreeName, fNtpVDrX, fNtpVDrY, fNtpVDrZ, fNtpVtxP, fNtpVtxX, fNtpVtxY, and fNtpVtxZ.
00073 { 00074 if(fMakeNtp){ 00075 TDirectory* current_directory = gDirectory; 00076 fNtpFile = TFile::Open(fNtpFileName.c_str(), "recreate"); 00077 fNtpFile->cd(); 00078 fNtpTree = new TTree(fNtpTreeName.c_str(), ""); 00079 fNtpTree->SetDirectory(fNtpFile); 00080 fNtpTree->Branch("run", &fNtpRun, "run/I"); 00081 fNtpTree->Branch("snarl", &fNtpSnarl, "snarl/I"); 00082 fNtpTree->Branch("vtxx", &fNtpVtxX, "vtxx/F"); 00083 fNtpTree->Branch("vtxy", &fNtpVtxY, "vtxy/F"); 00084 fNtpTree->Branch("vtxz", &fNtpVtxZ, "vtxz/F"); 00085 fNtpTree->Branch("vtxp", &fNtpVtxP, "vtxp/I"); 00086 fNtpTree->Branch("npln", &fNtpNPln, "npln/I"); 00087 fNtpTree->Branch("prng", &fNtpPRng, "prng/F"); 00088 fNtpTree->Branch("pcrv", &fNtpPCrv, "pcrv/F"); 00089 fNtpTree->Branch("pvdx", &fNtpVDrX, "pvdx/F"); 00090 fNtpTree->Branch("pvdy", &fNtpVDrY, "pvdy/F"); 00091 fNtpTree->Branch("pvdz", &fNtpVDrZ, "pvdz/F"); 00092 fNtpTree->Branch("fitp", &fNtpFitP, "fitp/I"); 00093 fNtpTree->Branch("endc", &fNtpEndC, "endc/I"); 00094 fNtpTree->Branch("pass", &fNtpPass, "pass/I"); 00095 fNtpTree->Branch("pmux", &fNtpPMuX, "pmux/F"); 00096 fNtpTree->Branch("pmuy", &fNtpPMuY, "pmuy/F"); 00097 fNtpTree->Branch("pmuz", &fNtpPMuZ, "pmuz/F"); 00098 00099 current_directory->cd(); 00100 } 00101 }
| void RemoveMuon::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 314 of file RemoveMuon.cxx.
References fAlgConfig, fAlgName, fAlgOutputConfig, fAlgOutputName, fMakeNtp, fNameListOut, fNtpFileName, fNtpTreeName, fTrackListName, Registry::Get(), and Registry::GetCharString().
00315 { 00319 int tmpi = 0; 00320 00321 fAlgName = r.GetCharString("AlgName"); 00322 fAlgConfig = r.GetCharString("AlgConfig"); 00323 fNameListOut = r.GetCharString("StripListOut"); 00324 fAlgOutputName = r.GetCharString("AlgOutputName"); 00325 fAlgOutputConfig = r.GetCharString("AlgOutputConfig"); 00326 if(r.Get("MakeNtp", tmpi)) fMakeNtp = tmpi; 00327 fNtpFileName = r.GetCharString("NtpFileName"); 00328 fNtpTreeName = r.GetCharString("NtpTreeName"); 00329 if(r.Get("TrackListName", tmpi)) fTrackListName = tmpi; 00330 00331 }
| const Registry & RemoveMuon::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 284 of file RemoveMuon.cxx.
References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().
00285 { 00289 static Registry r; // Default configuration for module 00290 00291 // Set name of config 00292 std::string name = this->GetName(); 00293 name += ".config.default"; 00294 r.SetName(name.c_str()); 00295 00296 // Set values in configuration 00297 r.UnLockValues(); 00298 r.Set("AlgName","AlgMuonRemoval"); 00299 r.Set("AlgConfig","default"); 00300 r.Set("StripListOut", "stripdigitlist"); 00301 r.Set("AlgOutputName","AlgRmMuList"); 00302 r.Set("AlgOutputConfig","default"); 00303 r.Set("MakeNtp", 0); 00304 r.Set("NtpFileName", "muon_summary.root"); 00305 r.Set("NtpTreeName", "muonparams"); 00306 00307 r.LockValues(); 00308 00309 return r; 00310 }
| void RemoveMuon::EndFile | ( | ) | [virtual] |
Implement for notification of end of file. See GetLastFile().
Reimplemented from JobCModule.
Definition at line 123 of file RemoveMuon.cxx.
| void RemoveMuon::EndJob | ( | ) | [virtual] |
Implement for notification of end of job
Reimplemented from JobCModule.
Definition at line 105 of file RemoveMuon.cxx.
References fMakeNtp, fNtpFile, and fNtpTree.
00106 { 00107 if(fMakeNtp){ 00108 TDirectory* current_directory = gDirectory; 00109 fNtpFile->cd(); 00110 fNtpTree->Write(); 00111 current_directory->cd(); 00112 } 00113 }
| JobCResult RemoveMuon::Reco | ( | MomNavigator * | mom | ) | [virtual] |
Implement this for read-write access to the MomNavigator
Reimplemented from JobCModule.
Definition at line 202 of file RemoveMuon.cxx.
References fAlgConfig, fAlgName, fAlgOutputConfig, fAlgOutputName, CandRecord::FindCandHandle(), fNameListOut, fTrackListName, Registry::Get(), AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), Msg::kDebug, Msg::kError, JobCResult::kPassed, CandRmMuList::MakeCandidate(), CandDigitList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), JobCResult::SetFatal(), CandHandle::SetName(), CandHandle::SetTitle(), and Registry::UnLockKeys().
00203 { 00204 00205 // 00206 //This function trys to remove the muon from the event and writes out a new cand digit list 00207 // NB: it does no event selection, i.e. it doesnt decide which events are suitable for 00208 // event removal. To run the event selection, run the Ana function befor ethe reco funtion. 00209 // 00210 00211 JobCResult result(JobCResult::kPassed); 00212 MSG("RmMu", Msg::kDebug) << " Starting RemoveMuon::Reco() " <<endl; 00213 MSG("RmMu", Msg::kDebug) << " Alg : " << fAlgName<< endl; 00214 MSG("RmMu", Msg::kDebug) << " AlgConfig : " << fAlgConfig<< endl; 00215 MSG("RmMu", Msg::kDebug) << " NameListOut: " << fNameListOut<< endl; 00216 MSG("RmMu", Msg::kDebug) << " TrackListName: " << fTrackListName<< endl; 00217 00218 // 00219 // Find PrimaryCandidateRecord fragment in MOM. 00220 // 00221 CandRecord *record = dynamic_cast<CandRecord *>(mom->GetFragment("CandRecord", 00222 "PrimaryCandidateRecord")); 00223 if (record == 0) { 00224 MSG("RmMu", Msg::kError) << "No PrimaryCandidateRecord in MOM."<< endl; 00225 result.SetFatal().SetFailed(); 00226 return result; 00227 } 00228 00229 // 00230 //Remove the muon 00231 // 00232 CandContext cx(NULL, mom); 00233 TObjArray alg_input; 00234 alg_input.Add(record); 00235 cx.SetDataIn(&alg_input); 00236 cx.SetCandRecord(record); 00237 AlgHandle algorithm = AlgFactory::GetInstance().GetAlgHandle(fAlgName.c_str(), 00238 fAlgConfig.c_str()); 00239 AlgConfig& algconfig = algorithm.GetAlgConfig(); 00240 Int_t cMaxTrackLikePlanes = 0; 00241 if(!algconfig.Get("cMaxTrackLikePlanes",cMaxTrackLikePlanes)) 00242 cMaxTrackLikePlanes = 6; 00243 00244 CandDigitListHandle digitlist = CandDigitList::MakeCandidate(algorithm, cx); 00245 digitlist.SetName(fNameListOut.c_str()); 00246 digitlist.SetTitle(fNameListOut.c_str()); 00247 record->SecureCandHandle(digitlist); 00248 00249 // make a candidate to hold the removed muon info 00250 // along with handles to the remaining digits 00251 CandEventListHandle * eventlist = dynamic_cast<CandEventListHandle*> 00252 (record->FindCandHandle("CandEventListHandle")); 00253 CandTrackListHandle * tracklist = dynamic_cast<CandTrackListHandle*> 00254 (record->FindCandHandle("CandTrackListHandle", fTrackListName.c_str())); 00255 CandDigitListHandle * digitlist2 = dynamic_cast<CandDigitListHandle*> 00256 (record->FindCandHandle("CandDigitListHandle")); 00257 00258 CandContext cx2(NULL, mom); 00259 TObjArray alg_input2; 00260 alg_input2.Add(digitlist2); 00261 alg_input2.Add(eventlist); 00262 alg_input2.Add(tracklist); 00263 cx2.SetDataIn(&alg_input2); 00264 cx2.SetCandRecord(record); 00265 AlgHandle algorithm2 = AlgFactory::GetInstance(). 00266 GetAlgHandle(fAlgOutputName.c_str(),fAlgOutputConfig.c_str()); 00267 AlgConfig& algconfig2 = algorithm2.GetAlgConfig(); 00268 algconfig2.UnLockKeys(); 00269 algconfig2.UnLockValues(); 00270 algconfig2.Set("MaxTrackLikePlanes",cMaxTrackLikePlanes); 00271 algconfig2.LockKeys(); 00272 algconfig2.LockValues(); 00273 CandRmMuListHandle rmmulist = CandRmMuList::MakeCandidate(algorithm2, cx2); 00274 rmmulist.SetName("candrmmulist"); 00275 rmmulist.SetTitle("candrmmulist"); 00276 record->SecureCandHandle(rmmulist); 00277 00278 MSG("RmMu", Msg::kDebug) << " Leaving RemoveMuon::Reco() " <<endl; 00279 return JobCResult::kPassed; // kNoDecision, kFailed, etc. 00280 }
std::string RemoveMuon::fAlgConfig [private] |
std::string RemoveMuon::fAlgName [private] |
std::string RemoveMuon::fAlgOutputConfig [private] |
std::string RemoveMuon::fAlgOutputName [private] |
int RemoveMuon::fMakeNtp [private] |
Definition at line 48 of file RemoveMuon.h.
Referenced by Ana(), BeginJob(), Config(), and EndJob().
std::string RemoveMuon::fNameListOut [private] |
Int_t RemoveMuon::fNtpEndC [private] |
TFile* RemoveMuon::fNtpFile [private] |
std::string RemoveMuon::fNtpFileName [private] |
Int_t RemoveMuon::fNtpFitP [private] |
Int_t RemoveMuon::fNtpNPln [private] |
Int_t RemoveMuon::fNtpPass [private] |
Float_t RemoveMuon::fNtpPCrv [private] |
Float_t RemoveMuon::fNtpPMuX [private] |
Float_t RemoveMuon::fNtpPMuY [private] |
Float_t RemoveMuon::fNtpPMuZ [private] |
Float_t RemoveMuon::fNtpPRng [private] |
Int_t RemoveMuon::fNtpRun [private] |
Int_t RemoveMuon::fNtpSnarl [private] |
TTree* RemoveMuon::fNtpTree [private] |
std::string RemoveMuon::fNtpTreeName [private] |
Float_t RemoveMuon::fNtpVDrX [private] |
Float_t RemoveMuon::fNtpVDrY [private] |
Float_t RemoveMuon::fNtpVDrZ [private] |
Int_t RemoveMuon::fNtpVtxP [private] |
Float_t RemoveMuon::fNtpVtxX [private] |
Float_t RemoveMuon::fNtpVtxY [private] |
Float_t RemoveMuon::fNtpVtxZ [private] |
std::string RemoveMuon::fTrackListName [private] |
1.4.7