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

Public Types | |
| typedef int | NuInt_t |
| typedef int | Mode_t |
| enum | ENeuInt { kCCnue = 0x0001, kCCnuebar = 0x0002, kCCnumu = 0x0004, kCCnumubar = 0x0008, kCCnutau = 0x0010, kCCnutaubar = 0x0020, kNC = 0x0040, kAllNuInt = 0xFFFF } |
| enum | Emode { kElastic = 0x0001, kResonant = 0x0002, kDIS = 0x0003, kAllMode = 0xFFFF } |
Public Member Functions | |
| DemoMCFilter () | |
| const Registry & | DefaultConfig () const |
| JobCResult | Ana (const MomNavigator *mom) |
| void | Config (const Registry &r) |
| void | Report () |
| void | HandleCommand (JobCommand *cmd) |
| void | Help () |
| void | SetNuInt (NuInt_t i) |
| void | SetNuMode (Mode_t i) |
| void | SetEnuMin (double e) |
| void | SetEnuMax (double e) |
| void | SetYmin (double y) |
| void | SetYmax (double y) |
| void | SetPrint (bool doPrint=true) |
Private Member Functions | |
| NuInt_t | GetNuInt (const REROOT_NeuKin *nukin) |
| Mode_t | GetMode (const REROOT_NeuKin *nukin) |
| double | GetEnu (const REROOT_NeuKin *nukin) |
| double | GetY (const REROOT_NeuKin *nukin) |
| void | Print (const REROOT_NeuKin *nukin) |
Private Attributes | |
| double | fEnuMin |
| double | fEnuMax |
| double | fYmin |
| double | fYmax |
| int | fNuIntSelect |
| int | fModeSelect |
| bool | fDoPrint |
|
|
Definition at line 50 of file DemoMCFilter.h. Referenced by Ana(), GetMode(), and HandleCommand(). |
|
|
Definition at line 41 of file DemoMCFilter.h. Referenced by Ana(), GetNuInt(), and HandleCommand(). |
|
|
Definition at line 44 of file DemoMCFilter.h. 00044 {
00045 kElastic = 0x0001,
00046 kResonant = 0x0002,
00047 kDIS = 0x0003,
00048 kAllMode = 0xFFFF
00049 };
|
|
|
Definition at line 31 of file DemoMCFilter.h. 00031 {
00032 kCCnue = 0x0001,
00033 kCCnuebar = 0x0002,
00034 kCCnumu = 0x0004,
00035 kCCnumubar = 0x0008,
00036 kCCnutau = 0x0010,
00037 kCCnutaubar = 0x0020,
00038 kNC = 0x0040,
00039 kAllNuInt = 0xFFFF
00040 };
|
|
|
Definition at line 27 of file DemoMCFilter.cxx. 00027 : fNuIntSelect(0), fModeSelect(0) { }
|
|
|
Implement this for read only access to the MomNavigator Reimplemented from JobCModule. Definition at line 31 of file DemoMCFilter.cxx. References GetEnu(), GetMode(), GetNuInt(), MINFast::GetREROOTEvent(), GetY(), gMINFast, Mode_t, REROOT_Event::neukins(), NuInt_t, and Print(). 00032 {
00033 //======================================================================
00034 // Analyze the event to see if the MC information meets the selection
00035 // criteria.
00036 //======================================================================
00037 // Get the pointer to the neutrino interaction data
00038 const REROOT_Event* rrevt = gMINFast->GetREROOTEvent();
00039 const REROOT_NeuKin* nukin =
00040 dynamic_cast<REROOT_NeuKin*>(rrevt->neukins()->First());
00041
00042 // Energy cut
00043 double Enu = this->GetEnu(nukin);
00044 if (Enu < fEnuMin) return JobCResult::kFailed;
00045 if (Enu > fEnuMax) return JobCResult::kFailed;
00046
00047 // y cut
00048 double y = this->GetY(nukin);
00049 if (y < fYmin) return JobCResult::kFailed;
00050 if (y > fYmax) return JobCResult::kFailed;
00051
00052 // Interaction cut
00053 NuInt_t nuint = this->GetNuInt(nukin);
00054 if ((nuint & fNuIntSelect) == 0) return JobCResult::kFailed;
00055
00056 // Interaction mode cut
00057 Mode_t numode = this->GetMode(nukin);
00058 if ((numode & fModeSelect) == 0) return JobCResult::kFailed;
00059
00060 // Get here if all checks passed
00061 if (fDoPrint) this->Print(nukin);
00062 return JobCResult::kPassed;
00063 }
|
|
|
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 104 of file DemoMCFilter.cxx. References fDoPrint, fEnuMax, fEnuMin, fModeSelect, fNuIntSelect, fYmax, fYmin, Registry::Get(), kCCnue, kCCnuebar, kCCnumu, kCCnumubar, kCCnutau, kCCnutaubar, kDIS, kElastic, and kResonant. 00105 {
00106 //======================================================================
00107 // Configure the module given the registry r
00108 //======================================================================
00109 int tmpb;
00110 double tmpd;
00111
00112 if (r.Get("EnuMin", tmpd)) { fEnuMin = tmpd; }
00113 if (r.Get("EnuMax", tmpd)) { fEnuMax = tmpd; }
00114 if (r.Get("Ymin", tmpd)) { fYmin = tmpd; }
00115 if (r.Get("Ymax", tmpd)) { fYmax = tmpd; }
00116
00117 if (r.Get("CCnue", tmpb)) {
00118 tmpb ? fNuIntSelect |= kCCnue : fNuIntSelect &= ~kCCnue;
00119 }
00120 if (r.Get("CCnuebar", tmpb)) {
00121 tmpb ? fNuIntSelect |= kCCnuebar : fNuIntSelect &= ~kCCnuebar;
00122 }
00123 if (r.Get("CCnumu", tmpb)) {
00124 tmpb ? fNuIntSelect |= kCCnumu : fNuIntSelect &= ~kCCnumu;
00125 }
00126 if (r.Get("CCnumubar", tmpb)) {
00127 tmpb ? fNuIntSelect |= kCCnumubar : fNuIntSelect &= ~kCCnumubar;
00128 }
00129 if (r.Get("CCnutau", tmpb)) {
00130 tmpb ? fNuIntSelect |= kCCnutau : fNuIntSelect &= ~kCCnutau;
00131 }
00132 if (r.Get("CCnutaubar", tmpb)) {
00133 tmpb ? fNuIntSelect |= kCCnutaubar : fNuIntSelect &= ~kCCnutaubar;
00134 }
00135 if (r.Get("NC", tmpb)) {
00136 tmpb ? fNuIntSelect |= kCCnumubar : fNuIntSelect &= ~kCCnumubar;
00137 }
00138 if (r.Get("AllNuInt", tmpb)) {
00139 if (tmpb) fNuIntSelect = kAllNuInt;
00140 }
00141 // if absolutely nothing is selected default to "all"
00142 if (!fNuIntSelect) fNuIntSelect = kAllNuInt;
00143
00144 if (r.Get("Elastic", tmpb)) {
00145 tmpb ? fModeSelect |= kElastic : fModeSelect &= ~kElastic;
00146 }
00147 if (r.Get("Resonant", tmpb)) {
00148 tmpb ? fModeSelect |= kResonant : fModeSelect &= ~kResonant;
00149 }
00150 if (r.Get("DIS", tmpb)) {
00151 tmpb ? fModeSelect |= kDIS : fModeSelect &= ~kDIS;
00152 }
00153 if (r.Get("AllMode", tmpb)) {
00154 if (tmpb) fModeSelect = kAllMode;
00155 }
00156 // if absolutely nothing is selected default to "all"
00157 if (!fModeSelect) fModeSelect = kAllMode;
00158
00159 if (r.Get("DoPrint", tmpb)) { fDoPrint = tmpb; }
00160 }
|
|
|
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 67 of file DemoMCFilter.cxx. References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues(). 00068 {
00069 //======================================================================
00070 // Supply a default configuration for this module
00071 //======================================================================
00072 static Registry r;
00073 std::string name = this->GetName();
00074 name += ".config.default";
00075
00076 r.UnLockValues();
00077 r.Set("EnuMin", 0.0);
00078 r.Set("EnuMax", 999999.0);
00079 r.Set("Ymin", 0.0);
00080 r.Set("Ymax", 1.0);
00081
00082 r.Set("CCnue", false);
00083 r.Set("CCnuebar", false);
00084 r.Set("CCnumu", false);
00085 r.Set("CCnumubar", false);
00086 r.Set("CCnutau", false);
00087 r.Set("CCnutaubar",false);
00088 r.Set("NC", false);
00089 r.Set("AllNuInt", false);
00090
00091 r.Set("Elastic", false);
00092 r.Set("Resonant", false);
00093 r.Set("DIS", false);
00094 r.Set("AllMode", false);
00095
00096 r.Set("DoPrint", false);
00097 r.LockValues();
00098
00099 return r;
00100 }
|
|
|
Definition at line 324 of file DemoMCFilter.cxx. References REROOT_NeuKin::P4Neu(). Referenced by Ana(). 00325 {
00326 return nukin->P4Neu()[3];
00327 }
|
|
|
Definition at line 317 of file DemoMCFilter.cxx. References Mode_t. Referenced by Ana(). 00318 {
00319 return kAllMode;
00320 }
|
|
|
Definition at line 298 of file DemoMCFilter.cxx. References REROOT_NeuKin::IAction(), REROOT_NeuKin::INu(), and NuInt_t. Referenced by Ana(). 00299 {
00300 bool isNC = (nukin->IAction()==0);
00301
00302 if (isNC) { return kNC; }
00303
00304 int ntype = nukin->INu();
00305 if (ntype == 12) { return kCCnue; }
00306 if (ntype == -12) { return kCCnuebar; }
00307 if (ntype == 14) { return kCCnumu; }
00308 if (ntype == -14) { return kCCnumubar; }
00309 if (ntype == 16) { return kCCnutau; }
00310 if (ntype == -16) { return kCCnutaubar; }
00311
00312 return 0;
00313 }
|
|
|
Definition at line 331 of file DemoMCFilter.cxx. References REROOT_NeuKin::Y(). Referenced by Ana(). 00332 {
00333 return nukin->Y();
00334 }
|
|
|
Implement to handle a JobCommand Reimplemented from JobCModule. Definition at line 164 of file DemoMCFilter.cxx. References Mode_t, NuInt_t, JobCommand::PopCmd(), JobCommand::PopFloatOpt(), JobCommand::PopOpt(), Report(), SetEnuMax(), SetEnuMin(), SetNuInt(), SetNuMode(), SetYmax(), and SetYmin(). 00165 {
00166 const char* c = cmd->PopCmd();
00167 if (c) {
00168 string cs(c);
00169 if (cs == "Report") {
00170 this->Report();
00171 return;
00172 }
00173 if (cs == "Accept") {
00174 NuInt_t nuIntAccept = 0;
00175 Mode_t modeAccept = 0;
00176 const char* opt = 0;
00177 while ( (opt=cmd->PopOpt()) !=0 ) {
00178 string sopt(opt);
00179
00180 // Which interactions to accept?
00181 if (sopt == "CCnue") nuIntAccept |= kCCnue;
00182 else if (sopt == "CCnuebar") nuIntAccept |= kCCnuebar;
00183 else if (sopt == "CCnumu") nuIntAccept |= kCCnumu;
00184 else if (sopt == "CCnumubar") nuIntAccept |= kCCnumubar;
00185 else if (sopt == "CCnutau") nuIntAccept |= kCCnutau;
00186 else if (sopt == "CCnutaubar") nuIntAccept |= kCCnutaubar;
00187 else if (sopt == "NC") nuIntAccept |= kNC;
00188 else if (sopt == "AllNuInt") nuIntAccept |= kAllNuInt;
00189
00190 if (sopt == "Elastic") modeAccept |= kElastic;
00191 else if (sopt == "Resonant") modeAccept |= kResonant;
00192 else if (sopt == "DIS") modeAccept |= kDIS;
00193 else if (sopt == "AllMode") modeAccept |= kAllMode;
00194
00195 // Which interaction modes to accept?
00196 if (sopt == "Emin") {
00197 float e = cmd->PopFloatOpt();
00198 this->SetEnuMin(e);
00199 }
00200
00201 // Which range of neutrino energy to accept?
00202 if (sopt == "Emax") {
00203 float e = cmd->PopFloatOpt();
00204 this->SetEnuMax(e);
00205 }
00206
00207 // Which range of y to accept?
00208 if (sopt == "Ymin") {
00209 float y = cmd->PopFloatOpt();
00210 this->SetYmin(y);
00211 }
00212 if (sopt == "Ymax") {
00213 float y = cmd->PopFloatOpt();
00214 this->SetYmax(y);
00215 }
00216 }
00217 // Apply interaction selections
00218 if (nuIntAccept !=0 ) this->SetNuInt(nuIntAccept);
00219 if (modeAccept !=0 ) this->SetNuMode(modeAccept);
00220 return;
00221 }
00222 }
00223 }
|
|
|
Implement to spew some useful help to cout Reimplemented from JobCModule. Definition at line 227 of file DemoMCFilter.cxx. 00227 {}
|
|
|
Definition at line 338 of file DemoMCFilter.cxx. Referenced by Ana(). 00339 {
00340 }
|
|
|
Implement to spew end of running report Reimplemented from JobCModule. Definition at line 231 of file DemoMCFilter.cxx. References fEnuMax, fEnuMin, fModeSelect, fNuIntSelect, fYmax, fYmin, JobCModule::GetName(), and MSGSTREAM. Referenced by HandleCommand(). 00232 {
00233 MsgStream& msg = MSGSTREAM("Demo",Msg::kInfo);
00234
00235 msg <<
00236 this->GetName() << ": Selecting events with:\n" <<
00237 "-> Enu in range [" << fEnuMin << "," << fEnuMax << "]\n" <<
00238 "-> y in range [" << fYmin << "," << fYmax << "]\n" <<
00239 "-> Interactions types: ( ";
00240 if (fNuIntSelect>=kAllNuInt) {
00241 msg << "All ";
00242 }
00243 else {
00244 if (fNuIntSelect&kCCnue) msg << "CCnue ";
00245 if (fNuIntSelect&kCCnuebar) msg << "CCnuebar ";
00246 if (fNuIntSelect&kCCnumu) msg << "CCnumu ";
00247 if (fNuIntSelect&kCCnumubar) msg << "CCnumubar ";
00248 if (fNuIntSelect&kCCnutau) msg << "CCnutau ";
00249 if (fNuIntSelect&kCCnutaubar) msg << "CCnutaubar ";
00250 if (fNuIntSelect&kNC) msg << "NC ";
00251 }
00252 msg << ")\n";
00253 msg << "-> Interaction modes: ( ";
00254 if (fModeSelect>=kAllMode) {
00255 msg << "All ";
00256 }
00257 else {
00258 if (fModeSelect&kElastic) msg << "Elastic ";
00259 if (fModeSelect&kResonant) msg << "Resonant ";
00260 if (fModeSelect&kDIS) msg << "DIS ";
00261 }
00262 msg << ")\n";
00263 }
|
|
|
Definition at line 291 of file DemoMCFilter.cxx. References fEnuMax. Referenced by HandleCommand(). 00291 { fEnuMax = e; }
|
|
|
Definition at line 290 of file DemoMCFilter.cxx. References fEnuMin. Referenced by HandleCommand(). 00290 { fEnuMin = e; }
|
|
|
Definition at line 267 of file DemoMCFilter.cxx. References fNuIntSelect. Referenced by HandleCommand(). 00267 {
00268 if (i>=kAllNuInt) {
00269 fNuIntSelect = kAllNuInt;
00270 }
00271 else {
00272 fNuIntSelect = i;
00273 }
00274 }
|
|
|
Definition at line 278 of file DemoMCFilter.cxx. References fModeSelect. Referenced by HandleCommand(). 00279 {
00280 if (i>=kAllMode) {
00281 fModeSelect = kAllMode;
00282 }
00283 else {
00284 fModeSelect = i;
00285 }
00286 }
|
|
|
Definition at line 294 of file DemoMCFilter.cxx. References fDoPrint. 00294 { fDoPrint = doPrint; }
|
|
|
Definition at line 293 of file DemoMCFilter.cxx. References fYmax. Referenced by HandleCommand(). 00293 { fYmax = y; }
|
|
|
Definition at line 292 of file DemoMCFilter.cxx. References fYmin. Referenced by HandleCommand(). 00292 { fYmin = y; }
|
|
|
Definition at line 77 of file DemoMCFilter.h. Referenced by Config(), and SetPrint(). |
|
|
Definition at line 72 of file DemoMCFilter.h. Referenced by Config(), Report(), and SetEnuMax(). |
|
|
Definition at line 71 of file DemoMCFilter.h. Referenced by Config(), Report(), and SetEnuMin(). |
|
|
Definition at line 76 of file DemoMCFilter.h. Referenced by Config(), Report(), and SetNuMode(). |
|
|
Definition at line 75 of file DemoMCFilter.h. Referenced by Config(), Report(), and SetNuInt(). |
|
|
Definition at line 74 of file DemoMCFilter.h. |
|
|
Definition at line 73 of file DemoMCFilter.h. |
1.3.9.1