#include <SelectNuMu.h>
Inheritance diagram for Anp::SelectNuMu:

Public Member Functions | |
| SelectNuMu () | |
| virtual | ~SelectNuMu () |
| bool | Run (Record &record) |
| bool | Run (Event &event, const Record &record, bool pass) |
| void | Config (const Registry ®) |
| void | Set (TDirectory *dir) |
| void | End (const DataBlock &block) |
Private Member Functions | |
| bool | PassSign (const Track &track) |
| void | ResetStop (Event &event, const Track &track, const Header &header) const |
Private Attributes | |
| std::string | fDirName |
| std::string | fRegPath |
| Handle< AlgEvent > | fCount |
| bool | fErase |
| bool | fEvent |
| bool | fPrint |
| bool | fReset |
| bool | fTrack |
| int | fAngKey |
| double | fAngMax |
| double | fAngMin |
| double | fEQPCut |
| int | fMuSign |
| int | fNPlane |
| int | fNeuKey |
| int | fPidKey |
| double | fPidCut |
|
|
Definition at line 30 of file SelectNuMu.cxx. 00031 :fDirName(""), 00032 fRegPath("SelectNuMu.txt"), 00033 fCount(new SelectCount()), 00034 fErase(true), 00035 fEvent(true), 00036 fPrint(false), 00037 fReset(false), 00038 fTrack(false), 00039 fAngKey(108), 00040 fAngMax(5.0), 00041 fAngMin(1.0), 00042 fEQPCut(2.0), 00043 fMuSign(0), 00044 fNPlane(20), 00045 fNeuKey(1000), 00046 fPidKey(4280), 00047 fPidCut(0.3) 00048 { 00049 }
|
|
|
Definition at line 52 of file SelectNuMu.cxx. 00053 {
00054 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 198 of file SelectNuMu.cxx. References fAngKey, fAngMax, fAngMin, fCount, fDirName, fEQPCut, fErase, fEvent, fMuSign, fNeuKey, fNPlane, fPidCut, fPidKey, fPrint, fRegPath, fReset, fTrack, Registry::Get(), infile, Registry::KeyExists(), Registry::Merge(), Anp::Read(), Anp::ReadRegistry(), reg, Registry::Set(), Registry::UnLockKeys(), and Registry::UnLockValues(). 00199 {
00200 //
00201 // Configure self
00202 //
00203
00204 const char *value_path = 0;
00205 if(reg_.Get("SelectNuMuRegPath", value_path) && value_path)
00206 {
00207 fRegPath = value_path;
00208 }
00209
00210 Registry tmp(false);
00211 Registry reg(reg_);
00212
00213 ifstream infile(fRegPath.c_str());
00214 if(infile.is_open() && Anp::ReadRegistry(fRegPath, tmp, true))
00215 {
00216 cout << "SelectNuMu::Config - read registry configuration from: " << endl
00217 << " " << fRegPath << endl;
00218
00219 reg.UnLockKeys();
00220 reg.UnLockValues();
00221 reg.Merge(tmp);
00222 }
00223
00224 const char *value_char = 0;
00225 if(reg.Get("SelectNuMuDirName", value_char) && value_char)
00226 {
00227 fDirName = value_char;
00228 }
00229
00230 Anp::Read(reg, "SelectNuMuErase", fErase);
00231 Anp::Read(reg, "SelectNuMuEvent", fEvent);
00232 Anp::Read(reg, "SelectNuMuPrint", fPrint);
00233 Anp::Read(reg, "SelectNuMuReset", fReset);
00234 Anp::Read(reg, "SelectNuMuTrack", fTrack);
00235
00236 const char *value_sign = 0;
00237 if(reg.Get("SELECT", value_sign) && value_sign)
00238 {
00239 if (std::strcmp(value_sign, "numu-all") == 0) fMuSign = 0;
00240 else if(std::strcmp(value_sign, "numu-neg") == 0) fMuSign = -1;
00241 else if(std::strcmp(value_sign, "numu-pos") == 0) fMuSign = +1;
00242 }
00243
00244 reg.Get("SelectNuMuAngKey", fAngKey);
00245 reg.Get("SelectNuMuAngMax", fAngMax);
00246 reg.Get("SelectNuMuAngMin", fAngMin);
00247 reg.Get("SelectNuMuEQPCut", fEQPCut);
00248 reg.Get("SelectNuMuMuSign", fMuSign);
00249 reg.Get("SelectNuMuNPlane", fNPlane);
00250 reg.Get("SelectNuMuNeuKey", fNeuKey);
00251 reg.Get("SelectNuMuPidKey", fPidKey);
00252 reg.Get("SelectNuMuPidCut", fPidCut);
00253
00254 const char *value_list = 0;
00255 if(reg.Get("SelectNuMuList", value_list) && value_list)
00256 {
00257 Registry config(reg);
00258 config.Set("AlgEventList", value_list);
00259 config.Set("AlgEventList", value_list);
00260 fCount -> Config(config);
00261 }
00262
00263 if(reg.KeyExists("PrintConfig"))
00264 {
00265 cout << "SelectNuMu::Config" << endl
00266 << " DirName = " << fDirName << endl
00267 << " RegPath = " << fRegPath << endl
00268 << " Erase = " << fErase << endl
00269 << " Event = " << fEvent << endl
00270 << " Print = " << fPrint << endl
00271 << " Reset = " << fReset << endl
00272 << " Track = " << fTrack << endl
00273 << " AngKey = " << fAngKey << endl
00274 << " AngMax = " << fAngMax << endl
00275 << " AngMin = " << fAngMin << endl
00276 << " EQPCut = " << fEQPCut << endl
00277 << " MuSign = " << fMuSign << endl
00278 << " NPlane = " << fNPlane << endl
00279 << " NeuKey = " << fNeuKey << endl
00280 << " PidKey = " << fPidKey << endl
00281 << " PidCut = " << fPidCut << endl;
00282
00283 if(value_list) cout << " List = " << value_list << endl;
00284 }
00285 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 299 of file SelectNuMu.cxx. References fCount.
|
|
|
Definition at line 305 of file SelectNuMu.cxx. References Anp::Track::ErrorQP(), fAngKey, fAngMin, fMuSign, fNPlane, Anp::Track::GetBasic(), Anp::Track::KeyExists(), Anp::Basic::NUPlane(), Anp::Basic::NVPlane(), Anp::Track::Pass(), Anp::Track::QP(), and Anp::Track::Stop(). 00306 {
00307 //
00308 // Select sign of muon track: =0 for all, =-1 for mu-, =+1 for mu+
00309 //
00310
00311 bool pass = false;
00312 if(track.Pass() && track.ErrorQP() > 0.0 && std::fabs(track.QP())/track.ErrorQP() > fEQPCut)
00313 {
00314 pass = true;
00315 }
00316
00317 if(fMuSign == 0)
00318 {
00319 if(track.Stop() || pass)
00320 {
00321 return true;
00322 }
00323 }
00324 else if(fMuSign == -1)
00325 {
00326 if(pass && track.QP() < 0.0)
00327 {
00328 return true;
00329 }
00330 }
00331 else if(fMuSign == +1)
00332 {
00333 if(!pass || !(track.QP() > 0.0))
00334 {
00335 return false;
00336 }
00337
00338 if(fAngKey > 0)
00339 {
00340 if(!track.KeyExists(fAngKey) || (track[fAngKey] > fAngMin && track[fAngKey] < fAngMax))
00341 {
00342 return false;
00343 }
00344 }
00345
00346 if(fNPlane > 0)
00347 {
00348 if(track.GetBasic().NUPlane() < fNPlane || track.GetBasic().NVPlane() < fNPlane)
00349 {
00350 return false;
00351 }
00352 }
00353
00354 return true;
00355 }
00356 else if(fMuSign == -2)
00357 {
00358 if(!pass || !(track.QP() < 0.0))
00359 {
00360 return false;
00361 }
00362
00363 if(fAngKey > 0)
00364 {
00365 if(!track.KeyExists(fAngKey) || !(track[fAngKey] > fAngMin && track[fAngKey] < fAngMax))
00366 {
00367 return false;
00368 }
00369 }
00370
00371 if(fNPlane > 0)
00372 {
00373 if(track.GetBasic().NUPlane() < fNPlane || track.GetBasic().NVPlane() < fNPlane)
00374 {
00375 return false;
00376 }
00377 }
00378
00379 return true;
00380 }
00381
00382 return false;
00383 }
|
|
||||||||||||||||
|
Definition at line 386 of file SelectNuMu.cxx. References Anp::Basic::EndPlane(), Anp::Track::GetBasic(), Anp::Track::GetEndVtx(), Anp::Event::GetRecoNu(), Anp::Header::IsFar(), Anp::Header::IsNear(), Anp::RecoNu::Pass(), Anp::RecoNu::PCur(), Anp::RecoNu::PRan(), Anp::RecoNu::SetPLep(), Anp::RecoNu::SetStop(), Anp::RecoNu::Stop(), Anp::Track::Stop(), Anp::Vertex::X(), Anp::Vertex::Y(), and Anp::Vertex::Z(). 00387 {
00388 const Vertex &vtx = track.GetEndVtx();
00389
00390 bool contained = false;
00391 if(header.IsNear())
00392 {
00393 if(vtx.X() > 1.3 && track.Stop())
00394 {
00395 contained = true;
00396 }
00397 else if(+0.0 < vtx.Z() && vtx.Z() < 15.0 &&
00398 -1.65 < vtx.X() && vtx.X() < 2.70 &&
00399 -1.65 < vtx.Y() && vtx.Y() < 1.65 &&
00400 -vtx.X() - 1.65 < vtx.Y() && vtx.Y() < vtx.X() + 1.65 &&
00401 +vtx.X() - 3.55 < vtx.Y() && vtx.Y() < -vtx.X() + 3.55)
00402 {
00403 contained = true;
00404 }
00405 }
00406 else if(header.IsFar())
00407 {
00408 if(vtx.X()*vtx.X() + vtx.Y()*vtx.Y() < 14.0 &&
00409 track.GetBasic().EndPlane() >= 5 &&
00410 track.GetBasic().EndPlane() <= 475)
00411 {
00412 contained = true;
00413 }
00414 }
00415 else
00416 {
00417 return;
00418 }
00419
00420 RecoNu &rnu = event.GetRecoNu();
00421 rnu.SetStop(contained);
00422
00423 if(rnu.Stop())
00424 {
00425 rnu.SetPLep(rnu.PRan());
00426 }
00427 else if(rnu.Pass())
00428 {
00429 rnu.SetPLep(rnu.PCur());
00430 }
00431 }
|
|
||||||||||||||||
|
Implements Anp::AlgEvent. Definition at line 126 of file SelectNuMu.cxx. References Anp::Event::Add(), fCount, fNeuKey, fPidKey, Anp::Record::GetHeader(), Anp::Event::KeyExists(), Anp::LongestTrack(), Anp::Event::Pid(), Run(), Anp::Event::SetPid(), Anp::Record::TrackEnd(), and Anp::TrackIter. 00127 {
00128 //
00129 // Select charged current \nu_{\mu} interactions
00130 //
00131 if(!pass) return true;
00132
00133 const TrackIter itrack = Anp::LongestTrack(event, record);
00134 if(itrack != record.TrackEnd())
00135 {
00136 fCount -> Run(event, record, true);
00137 }
00138 else
00139 {
00140 fCount -> Run(event, record, false);
00141 return false;
00142 }
00143
00144 //
00145 // Reset contained flag
00146 //
00147 if(fReset) SelectNuMu::ResetStop(event, *itrack, record.GetHeader());
00148
00149 //
00150 // Set event particle id variable
00151 //
00152 if(itrack -> KeyExists(fPidKey))
00153 {
00154 event.SetPid(itrack -> DataAt(fPidKey));
00155 fCount -> Run(event, record, true);
00156 }
00157 else
00158 {
00159 fCount -> Run(event, record, false);
00160 return false;
00161 }
00162
00163 //
00164 // Event is charged current interaction
00165 //
00166 if(event.Pid() > fPidCut)
00167 {
00168 fCount -> Run(event, record, true);
00169 }
00170 else
00171 {
00172 fCount -> Run(event, record, false);
00173 return false;
00174 }
00175
00176 //
00177 // Select all, mu- or mu+ tracks
00178 //
00179 if(SelectNuMu::PassSign(*itrack))
00180 {
00181 fCount -> Run(event, record, true);
00182 }
00183 else
00184 {
00185 fCount -> Run(event, record, false);
00186 return false;
00187 }
00188
00189 //
00190 // Add key signaling that this event passed selection
00191 //
00192 if(fNeuKey > 0 && !event.KeyExists(fNeuKey)) event.Add(fNeuKey, 1.0);
00193
00194 return true;
00195 }
|
|
|
Implements Anp::AlgSnarl. Definition at line 57 of file SelectNuMu.cxx. References Anp::CleanRecord(), Anp::Record::Erase(), Anp::Record::EventBeg(), Anp::Record::EventBegIterator(), Anp::Record::EventEnd(), Anp::Record::EventEndIterator(), Anp::EventIterator, fPidKey, Anp::Record::TrackBegIterator(), Anp::Record::TrackEndIterator(), and Anp::TrackIterator. Referenced by Run(). 00058 {
00059 //
00060 // Run over all events and erase events that fail CC \nu_{\mu} selection
00061 //
00062
00063 if(fEvent)
00064 {
00065 EventIterator ievent = record.EventBegIterator();
00066 while(ievent != record.EventEndIterator())
00067 {
00068 if(!SelectNuMu::Run(*ievent, record, true) && fErase)
00069 {
00070 ievent = record.Erase(ievent);
00071 }
00072 else
00073 {
00074 ++ievent;
00075 }
00076 }
00077
00078 //
00079 // Remove reconstructed tracks and showers that do not match selected events
00080 //
00081 if(fErase) Anp::CleanRecord(record.EventBeg(), record.EventEnd(), record);
00082 }
00083
00084 if(fTrack)
00085 {
00086 TrackIterator itrack = record.TrackBegIterator();
00087 while(itrack != record.TrackEndIterator())
00088 {
00089 bool pass_track = true;
00090
00091 //
00092 // Select muon tracks
00093 //
00094 if(!(itrack -> KeyExists(fPidKey)))
00095 {
00096 pass_track = false;
00097 }
00098 else if(!(itrack -> DataAt(fPidKey) > fPidCut))
00099 {
00100 pass_track = false;
00101 }
00102
00103 //
00104 // Select all, mu- or mu+ tracks
00105 //
00106 if(!SelectNuMu::PassSign(*itrack))
00107 {
00108 pass_track = false;
00109 }
00110
00111 if(pass_track)
00112 {
00113 ++itrack;
00114 }
00115 else
00116 {
00117 itrack = record.Erase(itrack);
00118 }
00119 }
00120 }
00121
00122 return true;
00123 }
|
|
|
Reimplemented from Anp::AlgEvent. Definition at line 288 of file SelectNuMu.cxx. References fCount, and fDirName. 00289 {
00290 if(!dir)
00291 {
00292 return;
00293 }
00294
00295 fCount -> Set(Anp::GetDir(fDirName, dir));
00296 }
|
|
|
Definition at line 54 of file SelectNuMu.h. Referenced by Config(), and PassSign(). |
|
|
Definition at line 55 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 56 of file SelectNuMu.h. Referenced by Config(), and PassSign(). |
|
|
Reimplemented from Anp::Base. Definition at line 46 of file SelectNuMu.h. |
|
|
Definition at line 43 of file SelectNuMu.h. |
|
|
Definition at line 57 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 48 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 49 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 58 of file SelectNuMu.h. Referenced by Config(), and PassSign(). |
|
|
Definition at line 60 of file SelectNuMu.h. |
|
|
Definition at line 59 of file SelectNuMu.h. Referenced by Config(), and PassSign(). |
|
|
Definition at line 62 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 61 of file SelectNuMu.h. |
|
|
Definition at line 50 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 44 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 51 of file SelectNuMu.h. Referenced by Config(). |
|
|
Definition at line 52 of file SelectNuMu.h. Referenced by Config(). |
1.3.9.1