00001
00002
00003
00004
00005
00007
00008 #include <cmath>
00009
00010 #include "TMath.h"
00011 #include "TH1F.h"
00012 #include "TROOT.h"
00013
00014 #include "Conventions/BeamType.h"
00015 #include "DataUtil/infid.h"
00016 #include "DataUtil/infid_finder.h"
00017 #include "Conventions/Munits.h"
00018 #include "Conventions/ReleaseType.h"
00019
00020 #include "NtupleUtils/NuCuts.h"
00021 #include "NtupleUtils/NuEvent.h"
00022 #include "NtupleUtils/NuMCEvent.h"
00023 #include "NtupleUtils/NuLibrary.h"
00024 #include "NtupleUtils/NuXMLConfig.h"
00025
00026 using std::endl;
00027 using std::cout;
00028
00029 CVSID("$Id: NuCuts.cxx,v 1.146 2014/11/10 16:34:28 radovic Exp $");
00030
00031
00032
00033 Bool_t NuCuts::IsNMB(const NuEvent &nu) {
00034 return (nu.anaVersion == NuCuts::kNMB0325Alpha ||
00035 nu.anaVersion == NuCuts::kNMB0325Bravo ||
00036 nu.anaVersion == NuCuts::kNMB0325BravoTwo ||
00037 nu.anaVersion == NuCuts::kNMB0325Charlie ||
00038 nu.anaVersion == NuCuts::kNMB0325Delta ||
00039 nu.anaVersion == NuCuts::kNMB0325Echo ||
00040 nu.anaVersion == NuCuts::kNMB0325ChairSound ||
00041 nu.anaVersion == NuCuts::kRM1 ||
00042 nu.anaVersion == NuCuts::kRM2 ||
00043 nu.anaVersion == NuCuts::kJJE2 ||
00044 nu.anaVersion == NuCuts::kNMBFree ||
00045 nu.anaVersion == NuCuts::kRHC);
00046 }
00047
00048
00049
00050 Bool_t NuCuts::IsNMBPQ(const NuEvent &nu) {
00051 return IsNMB(nu) && (nu.charge == 1);
00052 }
00053
00054
00055
00056 Bool_t NuCuts::IsNMBNQ(const NuEvent &nu) {
00057 return IsNMB(nu) && (nu.charge == -1);
00058 }
00059
00060
00061
00062 NuCuts::NuCuts()
00063 {
00064 MSG("NuCuts",Msg::kDebug)
00065 <<"Running NuCuts Constructor..."<<endl;
00066
00067
00068 MSG("NuCuts",Msg::kDebug)
00069 <<"Finished NuCuts Constructor"<<endl;
00070 }
00071
00072
00073
00074 NuCuts::~NuCuts()
00075 {
00076 MSG("NuCuts",Msg::kDebug)
00077 <<"Running NuCuts Destructor..."<<endl;
00078
00079
00080 MSG("NuCuts",Msg::kDebug)
00081 <<"Finished NuCuts Destructor"<<endl;
00082 }
00083
00084
00085
00086 Bool_t NuCuts::IsGoodNumberOfTracks(const NuEvent& nu) const
00087 {
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 MAXMSG("NuCuts",Msg::kInfo,1)
00111 <<"Making cut on number of tracks>=1"<<endl;
00112 return nu.ntrk >= 1;
00113 }
00114
00115
00116
00117 Bool_t NuCuts::IsGoodTrackFitPass(const NuEvent& nu) const
00118 {
00119 if (nu.anaVersion==NuCuts::kJJH1) {
00120 MAXMSG("NuCuts",Msg::kInfo,1)
00121 <<"Cutting on trk.fit.pass"<<endl;
00122 return nu.trkfitpass==1;
00123 }
00124 else if (IsNMBPQ(nu))
00125 {
00126 MAXMSG("NuCuts",Msg::kInfo,1)
00127 <<"Cutting on trk.fit.pass for +ve tracks"<<endl;
00128 return nu.trkfitpass==1;
00129 }
00130 else if (nu.anaVersion==NuCuts::kJJE1)
00131 {
00132 MAXMSG("NuCuts",Msg::kInfo,1)
00133 <<"Cutting on trk.fit.pass for +ve tracks, "
00134 << "trk.fit.pass w/ trk reclamation for -ve tracks." <<endl;
00135 if (nu.charge==1){
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 return nu.trkfitpass==1;
00148 }
00149 else if (nu.charge==-1)
00150 {
00151 if (nu.detector==Detector::kNear){
00152 return this->IsGoodTrackFitPassReclamation(nu);
00153 }
00154 else if (nu.detector==Detector::kFar){
00155 return nu.trkfitpass==1;
00156 }
00157 else {
00158 cout<<"Ahhhh det not known"<<endl;
00159 return nu.trkfitpass==1;
00160 }
00161 }
00162 else
00163 {
00164 cout<<"Bad charge"<<endl;
00165 return false;
00166 }
00167 }
00168 else if (nu.anaVersion==NuCuts::kJJE2 && nu.charge==1){
00169 MAXMSG("NuCuts",Msg::kInfo,1)
00170 <<"Cutting on trk.fit.pass for +ve tracks, "
00171 << "letting IsNMBNQ deal with -ve tracks." <<endl;
00172 return nu.trkfitpass==1;
00173 }
00174 else if (nu.anaVersion==NuCuts::kCC0093Std ||
00175 nu.anaVersion==NuCuts::kCC0250Std ||
00176 nu.anaVersion==NuCuts::kCC0325Std ||
00177 nu.anaVersion==NuCuts::kCC0720Std ||
00178 nu.anaVersion==NuCuts::kCC1070Std ||
00179 nu.anaVersion==NuCuts::kCC2014 ||
00180 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
00181 nu.anaVersion==NuCuts::kCC0720Test || IsNMBNQ(nu) ||
00182 nu.anaVersion==NuCuts::kNSI2011Fhc) {
00183 if (nu.detector==Detector::kNear) {
00184 MAXMSG("NuCuts",Msg::kInfo,1)
00185 <<"Cutting on trk.fit.pass w/ trk reclamation"<<endl;
00186 return this->IsGoodTrackFitPassReclamation(nu);
00187 }
00188 else if (nu.detector==Detector::kFar) {
00189 MAXMSG("NuCuts",Msg::kInfo,1)
00190 <<"Cutting on trk.fit.pass"
00191 <<", NOT doing track reclamation for the FD"<<endl;
00192 return nu.trkfitpass==1;
00193 }
00194 else {
00195 cout<<"Ahhhh det not known"<<endl;
00196 return nu.trkfitpass==1;
00197 }
00198 }
00199 else {
00200 MAXMSG("NuCuts",Msg::kInfo,1)
00201 <<"Cutting on trk.fit.pass"<<endl;
00202 return nu.trkfitpass==1;
00203 }
00204 }
00205
00206
00207
00208 Bool_t NuCuts::IsGoodTrackFitPassReclamation(const NuEvent& nu)
00209 {
00210
00211 if (nu.trkfitpass==1) return true;
00212
00213
00214
00215
00216
00217
00218
00219 Bool_t goodTrack= ( abs(nu.planeTrkBegu-nu.planeTrkBegv)<=5 &&
00220 abs(nu.planeTrkEndu-nu.planeTrkEndv)<=40 &&
00221 nu.planeTrkEndu<270 &&
00222 nu.planeTrkEndv<270 );
00223 return goodTrack;
00224 }
00225
00226
00227
00228 Bool_t NuCuts::IsGoodPID(const NuEvent& nu) const
00229 {
00230 if (nu.anaVersion==NuCuts::kJJH1) {
00231 return this->IsGoodAbID(nu);
00232 }
00233 else if (nu.anaVersion==NuCuts::kJJE1){
00234 if (nu.charge==1){
00235 return this->IsGoodDpID(nu);
00236 }
00237 else if (nu.charge==-1){
00238 return this->IsGoodAbID(nu);
00239 }
00240 else {
00241 cout<<"Bad charge"<<endl;
00242 return false;
00243 }
00244 }
00245 else if (nu.anaVersion==NuCuts::kJJE2 && nu.charge==1){
00246 return this->IsGoodDpID(nu);
00247 }
00248 else if (nu.anaVersion==NuCuts::kCC0093Std) {
00249 return this->IsGoodDpID(nu);
00250 }
00251 else if (nu.anaVersion==NuCuts::kCC0250Std) {
00252 return this->IsGoodAbID(nu);
00253 }
00254 else if (nu.anaVersion==NuCuts::kCC0325Std
00255 || nu.anaVersion == NuCuts::kCC0720Std
00256 || nu.anaVersion == NuCuts::kCC1070Std
00257 || nu.anaVersion == NuCuts::kCC2014
00258 || nu.anaVersion == NuCuts::kCC2014NewCoilCut
00259 || IsNMBNQ(nu)
00260 || nu.anaVersion == NuCuts::kNMB0325ChairSound
00261 || nu.anaVersion == NuCuts::kMSRock
00262 || nu.anaVersion == NuCuts::kNSI2011Fhc) {
00263 return this->IsGoodRoID(nu);
00264 }
00265 else if (nu.anaVersion==NuCuts::kCC0720Test){
00266 return (this->IsGoodRoID(nu) || this->IsGoodJmID(nu));
00267 }
00268 else if (((nu.anaVersion==NuCuts::kNMB0325Alpha) ||
00269 (nu.anaVersion==NuCuts::kNMB0325Charlie) ||
00270 (nu.anaVersion==NuCuts::kNMB0325Delta) ||
00271 (nu.anaVersion==NuCuts::kRM1) ||
00272 (nu.anaVersion==NuCuts::kRM2) ||
00273 (nu.anaVersion==NuCuts::kRHC) ) && IsNMBPQ(nu) ||
00274 (nu.anaVersion == NuCuts::kNCPRLCC)) {
00275
00276 return this->IsGoodRoID(nu);
00277 }
00278 else if ((nu.anaVersion == NuCuts::kNMB0325Bravo ||
00279 nu.anaVersion == NuCuts::kNMB0325BravoTwo) && IsNMBPQ(nu)) {
00280 return this->IsGoodDpID(nu);
00281 }
00282 else if ((nu.anaVersion == NuCuts::kNMB0325Echo) && IsNMBPQ(nu)) {
00283 return this->IsGoodPoKIN(nu);
00284 }
00285 else if ((nu.anaVersion == NuCuts::kNMBFree)&& IsNMBPQ(nu)){
00286 return true;
00287 }
00288 else {
00289 return this->IsGoodAbID(nu);
00290 }
00291 return true;
00292 }
00293
00294
00295
00296 Bool_t NuCuts::IsGoodDpID(const NuEvent& nu) const
00297 {
00298 if (nu.anaVersion==NuCuts::kJJH1) {
00299 Float_t cutValue=0.4;
00300
00301
00302
00303
00304 if (nu.charge==+1){
00305 MAXMSG("NuCuts",Msg::kInfo,1)
00306 <<"Making cut on +ve track: IsGoodDpID>"<<cutValue<<endl;
00307 if (nu.dpID>cutValue) return true;
00308 else return false;
00309 }
00310 else if (nu.charge==-1){
00311 if (nu.detector==Detector::kNear) cutValue=-0.1;
00312 else if (nu.detector==Detector::kFar) cutValue=-0.2;
00313 else {
00314 cout<<"Ahhh, detector="<<nu.detector<<endl;
00315 return false;
00316 }
00317
00318
00319
00320
00321 MAXMSG("NuCuts",Msg::kInfo,1)
00322 <<"Making cut on -ve track: IsGoodDpID>"<<cutValue<<endl;
00323 if (nu.dpID>cutValue) return true;
00324 else return false;
00325 }
00326 else {
00327 cout<<"Bad charge"<<endl;
00328 return false;
00329 }
00330 }
00331 else if (nu.anaVersion==NuCuts::kJJE1){
00332 if (nu.charge==1){
00333 MAXMSG("NuCuts",Msg::kInfo,1)
00334 <<"Making combined dpID and track jitter cut" <<endl;
00335 if (nu.dpID < 0.0){return false;}
00336 if (nu.jitter > 0.5){return false;}
00337 if (nu.jitter > (0.59*nu.dpID + 0.2)){return false;}
00338 return true;
00339 }
00340 else if(nu.charge==-1){
00341 Float_t cutValue=-0.1;
00342 if (nu.detector==Detector::kNear) cutValue=-0.1;
00343 else if (nu.detector==Detector::kFar) cutValue=-0.2;
00344 else {
00345 cout<<"Ahhh, detector="<<nu.detector<<endl;
00346 return false;
00347 }
00348 MAXMSG("NuCuts",Msg::kInfo,1)
00349 <<"Making cut: IsGoodDpID>"<<cutValue<<endl;
00350
00351 if (nu.dpID>cutValue) return true;
00352 else return false;
00353 }
00354 else{
00355 cout<<"Bad charge"<<endl;
00356 return false;
00357 }
00358 }
00359 else if (nu.anaVersion==NuCuts::kJJE2 && nu.charge==1){
00360 MAXMSG("NuCuts",Msg::kInfo,1)
00361 <<"Making combined dpID and track jitter cut" <<endl;
00362 if (nu.dpID < 0.0){return false;}
00363 if (nu.jitter > 0.5){return false;}
00364 if (nu.jitter > (0.59*nu.dpID + 0.2)){return false;}
00365 return true;
00366 }
00367 else if (nu.anaVersion==NuCuts::kCC0093Std) {
00368 Float_t cutValue=-0.1;
00369 if (nu.detector==Detector::kNear) cutValue=-0.1;
00370 else if (nu.detector==Detector::kFar) cutValue=-0.2;
00371 else {
00372 cout<<"Ahhh, detector="<<nu.detector<<endl;
00373 return false;
00374 }
00375 MAXMSG("NuCuts",Msg::kInfo,1)
00376 <<"Making cut: IsGoodDpID>"<<cutValue<<endl;
00377
00378 if (nu.dpID>cutValue) return true;
00379 else return false;
00380 }
00381 else if (nu.anaVersion==NuCuts::kCC0250Std ||
00382 nu.anaVersion==NuCuts::kCC0325Std ||
00383 nu.anaVersion==NuCuts::kCC0720Std ||
00384 nu.anaVersion==NuCuts::kCC1070Std ||
00385 nu.anaVersion==NuCuts::kCC2014 ||
00386 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
00387 nu.anaVersion==NuCuts::kCC0720Test || IsNMBNQ(nu) ||
00388 nu.anaVersion==NuCuts::kNSI2011Fhc) {
00389 Float_t cutValue=-0.1;
00390 if (nu.detector==Detector::kNear) cutValue=-0.1;
00391 else if (nu.detector==Detector::kFar) cutValue=-0.2;
00392 else {
00393 cout<<"Ahhh, detector="<<nu.detector<<endl;
00394 return false;
00395 }
00396 MAXMSG("NuCuts",Msg::kInfo,1)
00397 <<"Making cut: IsGoodDpID>"<<cutValue<<endl;
00398
00399 if (nu.dpID>cutValue) return true;
00400 else return false;
00401 }
00402 else if ((nu.anaVersion == NuCuts::kNMB0325Bravo ||
00403 nu.anaVersion == NuCuts::kNMB0325BravoTwo) && IsNMBPQ(nu)) {
00404 Float_t cutValue=0.25;
00405
00406 if (nu.anaVersion == NuCuts::kNMB0325BravoTwo) {
00407 cutValue = 0.32;
00408 }
00409 MAXMSG("NuCuts",Msg::kInfo,1)
00410 << "Making +ve cut: IsGoodDpID>"<<cutValue<<endl;
00411 if (nu.dpID>cutValue)
00412 return true;
00413 else
00414 return false;
00415 }
00416 else {
00417
00418 Float_t cutValue=0.0;
00419
00420
00421 if (nu.charge==+1){
00422 MAXMSG("NuCuts",Msg::kInfo,1)
00423 <<"Making cut on +ve track: IsGoodDpID>"<<cutValue<<endl;
00424 if (nu.dpID>cutValue) return true;
00425 else return false;
00426 }
00427 else if (nu.charge==-1){
00428 if (nu.detector==Detector::kNear) cutValue=-0.1;
00429 else if (nu.detector==Detector::kFar) cutValue=-0.2;
00430 else {
00431 cout<<"Ahhh, detector="<<nu.detector<<endl;
00432 return false;
00433 }
00434 MAXMSG("NuCuts",Msg::kInfo,1)
00435 <<"Making cut on -ve track: IsGoodDpID>"<<cutValue<<endl;
00436
00437 if (nu.dpID>cutValue) return true;
00438 else return false;
00439 }
00440 else {
00441 cout<<"Bad charge"<<endl;
00442 return false;
00443 }
00444 }
00445 return true;
00446 }
00447
00448
00449
00450 Bool_t NuCuts::IsGoodRoID(const NuEvent& nu) const
00451 {
00452 Float_t cutValue=0.3;
00453
00454
00455
00456 if (IsNMBPQ(nu)) {
00457 if ((nu.anaVersion == NuCuts::kNMB0325Alpha) ||
00458 (nu.anaVersion == NuCuts::kNMB0325Charlie) ||
00459 (nu.anaVersion == NuCuts::kRM1)) {
00460 cutValue = 0.625;
00461 }
00462 else if (nu.anaVersion == NuCuts::kRM2) {
00463 cutValue = 0.65;
00464 }
00465 else if (nu.anaVersion == NuCuts::kNMB0720RM) {
00466 cutValue = 0.65;
00467 }
00468 else if (nu.anaVersion == NuCuts::kNMB0325Delta) {
00469 cutValue = 0.55;
00470 }
00471 else if (nu.anaVersion == NuCuts::kRHC) {
00472 cutValue = 0.30;
00473 }
00474 MAXMSG("NuCuts",Msg::kInfo,1)
00475 <<"Making +ve IsGoodRoID>"<<cutValue<<endl;
00476 }
00477
00478
00479
00480
00481 if (!IsNMB(nu) || IsNMBNQ(nu)) {
00482
00483 if (nu.detector==Detector::kNear) cutValue=0.3;
00484 else if (nu.detector==Detector::kFar) cutValue=0.3;
00485 else {
00486 cout<<"Ahhh, detector="<<nu.detector<<endl;
00487 return false;
00488 }
00489 }
00490 if (nu.anaVersion == NuCuts::kNCPRLCC) {
00491 cutValue = 0.3;
00492 }
00493
00494
00495 if (nu.anaVersion == NuCuts::kMSRock) {
00496 cutValue = 0.20;
00497 }
00498
00499 MAXMSG("NuCuts",Msg::kInfo,1)
00500 <<"Making cut: IsGoodRoID>"<<cutValue<<endl;
00501
00502 return (nu.roID>cutValue);
00503 return true;
00504 }
00505 Bool_t NuCuts::IsGoodJmID(const NuEvent& nu) const
00506 {
00507 Float_t cutValue=0.5;
00508 MAXMSG("NuCuts",Msg::kInfo,1)
00509 <<"Making cut: IsGoodJmID>"<<cutValue<<endl;
00510 return (nu.jmID>cutValue);
00511 return true;
00512 }
00513 Bool_t NuCuts::IsGoodNtID(const NuEvent& ) const
00514 {
00515 Float_t cutValue=0.8;
00516 MAXMSG("NuCuts",Msg::kInfo,1)
00517 <<"Making cut: ISGoodNtID>"<<cutValue<<endl;
00518
00519 return true;
00520 }
00521
00522
00523
00524 Bool_t NuCuts::IsGoodPoKIN(const NuEvent& nu) const
00525 {
00526 Float_t cutValue=-0.1;
00527 MAXMSG("NuCuts",Msg::kInfo,1)
00528 <<"Making Cut: IsGoodPoKIN>" << cutValue << endl;
00529
00530 if (nu.anaVersion == NuCuts::kNMB0325Echo) {
00531 if (nu.poIDKin <= cutValue) return false;
00532 }
00533
00534
00535 return true;
00536 }
00537
00538
00539
00540 Bool_t NuCuts::IsGoodAbID(const NuEvent& nu) const
00541 {
00542 Float_t cutValue=0.85;
00543
00544 if (nu.anaVersion==NuCuts::kJJH1) {
00545 cutValue=0.99;
00546
00547 if (nu.charge==+1){
00548 MAXMSG("NuCuts",Msg::kInfo,1)
00549 <<"Making cut on +ve track: IsGoodAbID>"<<cutValue<<endl;
00550 if (nu.abID>cutValue) return true;
00551 else return false;
00552 }
00553 else if (nu.charge==-1){
00554 if (nu.detector==Detector::kNear) cutValue=0.85;
00555 else if (nu.detector==Detector::kFar) cutValue=0.85;
00556 else {
00557 cout<<"Ahhh, detector="<<nu.detector<<endl;
00558 return false;
00559 }
00560
00561 MAXMSG("NuCuts",Msg::kInfo,1)
00562 <<"Making cut on -ve track: IsGoodAbID>"<<cutValue<<endl;
00563 if (nu.abID>cutValue) return true;
00564 else return false;
00565 }
00566 else {
00567 cout<<"Bad charge"<<endl;
00568 return false;
00569 }
00570 }
00571 else if (nu.anaVersion==NuCuts::kJJE1){
00572 MAXMSG("NuCuts",Msg::kInfo,1)
00573 <<"Making cut: IsGoodAbID>"<<cutValue<<endl;
00574 if (nu.abID>cutValue) return true;
00575 else return false;
00576 }
00577 else if (nu.anaVersion==NuCuts::kCC0093Std) {
00578 MAXMSG("NuCuts",Msg::kInfo,1)
00579 <<"Making cut: IsGoodAbID>"<<cutValue<<endl;
00580 if (nu.abID>cutValue) return true;
00581 else return false;
00582 }
00583 else if (nu.anaVersion==NuCuts::kCC0250Std ||
00584 nu.anaVersion==NuCuts::kCC0325Std ||
00585 nu.anaVersion==NuCuts::kCC0720Std ||
00586 nu.anaVersion==NuCuts::kCC1070Std ||
00587 nu.anaVersion==NuCuts::kCC2014 ||
00588 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
00589 nu.anaVersion==NuCuts::kCC0720Test || IsNMBNQ(nu) ||
00590 nu.anaVersion==NuCuts::kNSI2011Fhc) {
00591 MAXMSG("NuCuts",Msg::kInfo,1)
00592 <<"Making cut: IsGoodAbID>"<<cutValue<<endl;
00593 if (nu.abID>cutValue) return true;
00594 else return false;
00595 }
00596 else {
00597 MAXMSG("NuCuts",Msg::kInfo,1)
00598 <<"Making cut: IsGoodAbID>"<<cutValue<<endl;
00599 if (nu.abID>cutValue) return true;
00600 else return false;
00601 }
00602 return true;
00603 }
00604
00605
00606
00607 Bool_t NuCuts::IsGoodSigmaQP_QP(const NuEvent& nu) const
00608 {
00609 Float_t cutValue=0.3;
00610
00611 if (nu.anaVersion==NuCuts::kJJH1) {
00612
00613 if (nu.charge>0){
00614 MAXMSG("NuCuts",Msg::kInfo,1)
00615 <<"Making cut on +ve track: SigmaQP/QP<"<<cutValue<<endl;
00616 if (fabs(nu.sigqp_qp)<cutValue) {
00617 return true;
00618 }
00619 else return false;
00620 }
00621
00622 else if (nu.charge<0) {
00623 Bool_t doCut=false;
00624 if (doCut) {
00625 MAXMSG("NuCuts",Msg::kInfo,1)
00626 <<"If curv used, making cut on -ve track: SigmaQP/QP>"
00627 <<-1*cutValue<<"; if range used, no cut"<<endl;
00628 if (nu.usedRange) {
00629 return true;
00630
00631 }
00632 else if (nu.usedCurv) {
00633 if (fabs(nu.sigqp_qp)<cutValue) return true;
00634 else return false;
00635 }
00636 else {
00637 MAXMSG("NuCuts",Msg::kWarning,10)
00638 <<"Ahh, usedRange="<<nu.usedRange
00639 <<"and usedCurv="<<nu.usedCurv<<endl;
00640 return false;
00641 }
00642 }
00643 else {
00644
00645 MAXMSG("NuCuts",Msg::kInfo,1)
00646 <<"Not cutting on SigmaQP/QP for -ve tracks"<<endl;
00647 return true;
00648 }
00649 }
00650 else {
00651 cout<<"Ahh, bad charge"<<endl;
00652 return false;
00653 }
00654 }
00655 else if (nu.anaVersion==NuCuts::kJJE1){
00656 if (1==nu.charge){
00657 cutValue = 0.065;
00658 MAXMSG("NuCuts",Msg::kInfo,1)
00659 <<"Making cut on sigmaQP>" << cutValue <<endl;
00660 if (nu.sigqp>cutValue){return false;}
00661 else{return true;}
00662 }
00663 else if (-1==nu.charge){
00664
00665 MAXMSG("NuCuts",Msg::kInfo,1)
00666 <<"Not cutting on SigmaQP/QP"<<endl;
00667 return true;
00668 }
00669 else {
00670 cout<<"Bad charge"<<endl;
00671 return false;
00672 }
00673 }
00674 else if (nu.anaVersion==NuCuts::kJJE2 && nu.charge==1){
00675 cutValue = 0.065;
00676 MAXMSG("NuCuts",Msg::kInfo,1)
00677 <<"Making cut on sigmaQP>" << cutValue <<endl;
00678 if (nu.sigqp>cutValue){return false;}
00679 else{return true;}
00680 }
00681 else if (nu.anaVersion==NuCuts::kCC0093Std ||
00682 nu.anaVersion==NuCuts::kCC0250Std ||
00683 nu.anaVersion==NuCuts::kCC0325Std ||
00684 nu.anaVersion==NuCuts::kCC0720Std ||
00685 nu.anaVersion==NuCuts::kCC1070Std ||
00686 nu.anaVersion==NuCuts::kCC2014 ||
00687 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
00688 nu.anaVersion==NuCuts::kCC0720Test || IsNMBNQ(nu) ||
00689 nu.anaVersion==NuCuts::kNSI2011Fhc ) {
00690
00691 MAXMSG("NuCuts",Msg::kInfo,1)
00692 <<"Not cutting on SigmaQP/QP"<<endl;
00693 return true;
00694 }
00695 else if (((nu.anaVersion == NuCuts::kNMB0325Bravo) ||
00696 (nu.anaVersion == NuCuts::kNMB0325Echo)) && IsNMBPQ(nu)){
00697 cutValue = 3.5;
00698 MAXMSG("NuCuts",Msg::kInfo,1)
00699 << "Making Cut on +ve, QP_sigmaQP>" << cutValue << endl;
00700 if (1./nu.sigqp_qp > cutValue)
00701 return true;
00702 else
00703 return false;
00704
00705 }
00706 else if ( ((nu.anaVersion == NuCuts::kRM2) || (nu.anaVersion == NuCuts::kNMB0720RM)) && IsNMBPQ(nu)) {
00707 cutValue = 2.3;
00708 MAXMSG("NuCuts",Msg::kInfo,1)
00709 << "Making Cut on +ve, QP_sigmaQP>" << cutValue << endl;
00710 if (1./nu.sigqp_qp > cutValue)
00711 return true;
00712 else
00713 return false;
00714 }
00715 else if ((nu.anaVersion == NuCuts::kRM1) && IsNMBPQ(nu)) {
00716 cutValue = 2.0;
00717 MAXMSG("NuCuts",Msg::kInfo,1)
00718 << "Making Cut on +ve, QP_sigmaQP>" << cutValue << endl;
00719 if (1./nu.sigqp_qp > cutValue)
00720 return true;
00721 else
00722 return false;
00723 }
00724 else {
00725
00726 MAXMSG("NuCuts",Msg::kInfo,1)
00727 <<"Not cutting on SigmaQP/QP"<<endl;
00728 return true;
00729 }
00730 return true;
00731 }
00732
00733
00734
00735 Bool_t NuCuts::IsGoodRelAngle(const NuEvent &nu) const
00736 {
00737
00738 Float_t cutValue = 0;
00739
00740
00741 if (!IsNMB(nu))
00742 return true;
00743
00744
00745 if (nu.charge == -1)
00746 return true;
00747 else if (nu.charge != 1)
00748 {
00749 cout << "Bad Charge: " << nu.charge << endl;
00750 return false;
00751 }
00752
00753
00754 if (nu.anaVersion == NuCuts::kRM1)
00755 {
00756 if (nu.relativeAngle < 1.0 || nu.relativeAngle > 5.0)
00757 return true;
00758 else
00759 return false;
00760 }
00761
00762 switch (nu.anaVersion)
00763 {
00764 case NuCuts::kNMB0325Alpha:
00765 cutValue = 2.12;
00766 break;
00767 case NuCuts::kNMB0325Bravo:
00768 cutValue = 2.12;
00769 break;
00770 case NuCuts::kNMB0325BravoTwo:
00771 cutValue = 2.12;
00772 break;
00773 case NuCuts::kNMB0325Echo:
00774 cutValue = 2.02;
00775 break;
00776 case NuCuts::kRM2:
00777 cutValue = 2.0;
00778 break;
00779 case NuCuts::kNMB0720RM:
00780 cutValue = 2.0;
00781 break;
00782 default:
00783
00784 MAXMSG("NuCuts",Msg::kInfo,1)
00785 << "Not Cutting on |relA-Pi|" << endl;
00786 return true;
00787 }
00788
00789 MAXMSG("NuCuts",Msg::kInfo,1)
00790 << "Cutting on |relA-Pi|>" << cutValue << endl;
00791 if (abs(nu.relativeAngle - TMath::Pi()) <= cutValue)
00792 return false;
00793
00794 return true;
00795 }
00796
00797
00798
00799 Bool_t NuCuts::IsGoodTrackLength(const NuEvent &nu) const
00800 {
00801 Int_t cutValue = 0;
00802
00803
00804 if (!IsNMB(nu))
00805 return true;
00806
00807
00808 if (nu.charge == -1)
00809 return true;
00810 else if (nu.charge != 1)
00811 {
00812 cout << "Bad Charge: " << nu.charge << endl;
00813 return false;
00814 }
00815
00816 switch (nu.anaVersion)
00817 {
00818 case NuCuts::kNMB0325Alpha:
00819 case NuCuts::kNMB0325Charlie:
00820 cutValue = 35;
00821 break;
00822 case NuCuts::kNMB0325Delta:
00823 cutValue = 37;
00824 break;
00825 case NuCuts::kRM1:
00826 cutValue = 36;
00827 break;
00828 case NuCuts::kJJE2:
00829 cutValue = 34;
00830 break;
00831 default:
00832
00833 MAXMSG("NuCuts",Msg::kInfo,1) << "Not Cutting on trkL" << endl;
00834 return true;
00835 }
00836
00837
00838
00839 if (nu.charge == -1)
00840 return true;
00841 else if (nu.charge != 1) {
00842 cout << "Bad Charge: " << nu.charge << endl;
00843 return false;
00844 }
00845
00846 MAXMSG("NuCuts",Msg::kInfo,1)
00847 << "Cutting on trkL>" << cutValue << endl;
00848 if (nu.trkLength <= cutValue)
00849 return false;
00850
00851 return true;
00852 }
00853
00854
00855
00856
00857 Bool_t NuCuts::IsGoodTrackLengthInUV(const NuEvent &nu) const
00858 {
00859 Int_t cutValue = 19;
00860 Int_t DiffU=0;
00861 Int_t DiffV=0;
00862
00863
00864 if (!IsNMB(nu))
00865 return true;
00866
00867
00868 if (nu.charge == -1)
00869 return true;
00870 else if (nu.charge != 1)
00871 {
00872 cout << "Bad Charge for TrkLenghInUV cut: " << nu.charge << endl;
00873 return false;
00874 }
00875
00876 if ( (nu.anaVersion == NuCuts::kRM2) || (nu.anaVersion == NuCuts::kNMB0720RM)) {
00877 DiffV=nu.planeTrkEndv -nu.planeTrkBegv;
00878 DiffU=nu.planeTrkEndu -nu.planeTrkBegu;
00879 MAXMSG("NuCuts",Msg::kInfo,1)
00880 << "Making Cut on UV Track length >" << cutValue << endl;
00881 if (DiffU > cutValue && DiffV > cutValue)
00882 return true;
00883 else
00884 return false;
00885 }
00886 else {
00887
00888 MAXMSG("NuCuts",Msg::kInfo,1)
00889 <<"Not cutting on UV Track length"<<endl;
00890 return true;
00891 }
00892 }
00893
00894
00895
00896 Bool_t NuCuts::IsGoodQP(const NuEvent& nu) const
00897 {
00898 MAXMSG("NuCuts",Msg::kWarning,1) << "CUTTING ON QP. YOU PROBABLY DON'T WANT TO DO THIS" << endl;
00899
00900 switch (nu.anaVersion)
00901 {
00902 case NuCuts::kNMB0325Alpha:
00903 case NuCuts::kNMB0325Bravo:
00904 case NuCuts::kNMB0325BravoTwo:
00905 case NuCuts::kNMB0325Charlie:
00906 case NuCuts::kNMB0325Delta:
00907 case NuCuts::kNMB0325Echo:
00908 case NuCuts::kRM2:
00909 case NuCuts::kNMBFree:
00910 case NuCuts::kRHC:
00911 {
00912 MAXMSG("NuCuts",Msg::kInfo,1) << "Cutting on Q/P>0" << endl;
00913 if (nu.qp <= 0)
00914 return false;
00915 break;
00916 }
00917 default:
00918 {
00919 MAXMSG("NuCuts",Msg::kInfo,1) << "Not Cutting on Q/P" << endl;
00920 }
00921 }
00922
00923
00924 return true;
00925 }
00926
00927
00928
00929 Bool_t NuCuts::IsGoodFitChi2PerNdof(const NuEvent& nu) const
00930 {
00931 Float_t cutValue=10;
00932
00933 if (nu.anaVersion==NuCuts::kJJH1) {
00934 Bool_t doCut=false;
00935 if (doCut) {
00936 MAXMSG("NuCuts",Msg::kInfo,1)
00937 <<"Making cut on chi2PerNdof<"<<cutValue<<endl;
00938
00939 if (nu.chi2PerNdof>cutValue) {
00940 return false;
00941 }
00942 else return true;
00943 }
00944 else {
00945 MAXMSG("NuCuts",Msg::kInfo,1)
00946 <<"Not cutting on Chi2PerNdof"<<endl;
00947 return true;
00948 }
00949 }
00950
00951 else if (nu.anaVersion==NuCuts::kCC0093Std ||
00952 nu.anaVersion==NuCuts::kCC0250Std ||
00953 nu.anaVersion==NuCuts::kJJE1 ||
00954 nu.anaVersion==NuCuts::kCC0325Std ||
00955 nu.anaVersion==NuCuts::kCC0720Std ||
00956 nu.anaVersion==NuCuts::kCC1070Std ||
00957 nu.anaVersion==NuCuts::kCC2014 ||
00958 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
00959 nu.anaVersion==NuCuts::kCC0720Test || IsNMB(nu) ||
00960 nu.anaVersion==NuCuts::kNSI2011Fhc ) {
00961
00962 MAXMSG("NuCuts",Msg::kInfo,1)
00963 <<"Not cutting on Chi2PerNdof"<<endl;
00964 return true;
00965 }
00966 else {
00967
00968 MAXMSG("NuCuts",Msg::kInfo,1)
00969 <<"Not cutting on Chi2PerNdof"<<endl;
00970 return true;
00971 }
00972 }
00973
00974
00975
00976 Bool_t NuCuts::IsGoodFitProb(const NuEvent& nu) const
00977 {
00978 Float_t cutValue=0.1;
00979
00980 if (nu.anaVersion==NuCuts::kJJH1) {
00981 if (nu.charge==+1){
00982 cutValue=0.1;
00983 MAXMSG("NuCuts",Msg::kInfo,1)
00984 <<"Making cut on +ve track: Fit Prob>"<<cutValue<<endl;
00985 if (nu.prob>cutValue) return true;
00986 else return false;
00987 }
00988 else if (nu.charge==-1){
00989 Bool_t doCut=false;
00990
00991 if (doCut) {
00992
00993
00994
00995
00996
00997
00998 cutValue=0.0;
00999
01000 MAXMSG("NuCuts",Msg::kInfo,1)
01001 <<"Making cut on -ve track: Fit Prob>="<<cutValue<<endl;
01002 if (nu.prob>=cutValue) return true;
01003 else return false;
01004 }
01005 else {
01006
01007 MAXMSG("NuCuts",Msg::kInfo,1)
01008 <<"Not cutting on trk fit probability for -ve tracks"<<endl;
01009 return true;
01010 }
01011 }
01012 else {
01013 cout<<"Bad charge"<<endl;
01014 return false;
01015 }
01016 }
01017 else if (nu.anaVersion==NuCuts::kJJE1){
01018 if (1==nu.charge){
01019 MAXMSG("NuCuts",Msg::kInfo,1)
01020 <<"Making cut on tfProb>" << cutValue <<endl;
01021 cutValue = 0.1;
01022 if (nu.prob<0.1){return false;}
01023 else{return true;}
01024 }
01025 else if (-1==nu.charge){
01026
01027 MAXMSG("NuCuts",Msg::kInfo,1)
01028 <<"Not cutting on Fit Prob"<<endl;
01029 return true;
01030 }
01031 else {
01032 cout<<"Bad charge"<<endl;
01033 return false;
01034 }
01035 }
01036 else if (nu.anaVersion==NuCuts::kJJE2 && nu.charge==1){
01037 MAXMSG("NuCuts",Msg::kInfo,1)
01038 <<"Making cut on tfProb>" << cutValue <<endl;
01039 cutValue = 0.1;
01040 if (nu.prob<0.1){return false;}
01041 else{return true;}
01042 }
01043 else if (nu.anaVersion==NuCuts::kCC0093Std ||
01044 nu.anaVersion==NuCuts::kCC0250Std ||
01045 nu.anaVersion==NuCuts::kCC0325Std ||
01046 nu.anaVersion==NuCuts::kCC0720Std ||
01047 nu.anaVersion==NuCuts::kCC1070Std ||
01048 nu.anaVersion==NuCuts::kCC2014 ||
01049 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
01050 nu.anaVersion==NuCuts::kCC0720Test ||
01051 nu.anaVersion==NuCuts::kNSI2011Fhc ||
01052 IsNMBNQ(nu) ) {
01053
01054 MAXMSG("NuCuts",Msg::kInfo,1)
01055 <<"Not cutting on Fit Prob"<<endl;
01056 return true;
01057 }
01058 else if ((nu.anaVersion == NuCuts::kNMB0325Delta) && IsNMBPQ(nu))
01059 {
01060 MAXMSG("NuCuts",Msg::kInfo,1) << "Cutting on prob>0.003" << endl;
01061 if (nu.prob <= 0.003)
01062 return false;
01063 else
01064 return true;
01065 } else {
01066
01067 MAXMSG("NuCuts",Msg::kInfo,1)
01068 <<"Not cutting on Fit Prob"<<endl;
01069 return true;
01070 }
01071 return true;
01072 }
01073
01074
01075
01076 Bool_t NuCuts::IsGoodMajorityCurvature(const NuEvent& nu) const
01077 {
01078 if (nu.anaVersion==NuCuts::kJJE1){
01079 if (1==nu.charge){
01080 MAXMSG("NuCuts",Msg::kInfo,1)
01081 <<"Making cut on Majority Curvature < 0" << endl;
01082 if (nu.smoothMajC<0.0){return false;}
01083 else{return true;}
01084 }
01085 else if (-1==nu.charge){
01086
01087 MAXMSG("NuCuts",Msg::kInfo,1)
01088 <<"Not cutting on Majority Curvature for charge=-1"<<endl;
01089 return true;
01090 }
01091 else {
01092 cout<<"Bad charge"<<endl;
01093 return false;
01094 }
01095 }
01096 else if (nu.anaVersion==NuCuts::kJJE2 && nu.charge==1){
01097 MAXMSG("NuCuts",Msg::kInfo,1)
01098 <<"Making cut on Majority Curvature < 0" << endl;
01099 if (nu.smoothMajC<0.0){return false;}
01100 else{return true;}
01101 }
01102 else if (nu.anaVersion==NuCuts::kJJH1 ||
01103 nu.anaVersion==NuCuts::kCC0093Std ||
01104 nu.anaVersion==NuCuts::kCC0250Std ||
01105 nu.anaVersion==NuCuts::kCC0325Std ||
01106 nu.anaVersion==NuCuts::kCC0720Std ||
01107 nu.anaVersion==NuCuts::kCC1070Std ||
01108 nu.anaVersion==NuCuts::kCC2014 ||
01109 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
01110 nu.anaVersion==NuCuts::kCC0720Test ||
01111 nu.anaVersion==NuCuts::kNSI2011Fhc ||
01112 IsNMBNQ(nu) ) {
01113
01114 MAXMSG("NuCuts",Msg::kInfo,1)
01115 <<"Not cutting on Majority Curvature"<<endl;
01116 return true;
01117 }
01118 else if ((nu.anaVersion == NuCuts::kNMB0325Charlie) && IsNMBPQ(nu)) {
01119 MAXMSG("NuCuts",Msg::kInfo,1)<<"Making cut on Majority Curvature > -0.22" << endl;
01120
01121
01122 if (nu.smoothMajC > -0.22)
01123 return true;
01124 else
01125 return false;
01126 }
01127 else {
01128
01129 MAXMSG("NuCuts",Msg::kInfo,1)
01130 <<"Not cutting on Majority Curvature"<<endl;
01131 return true;
01132 }
01133 return true;
01134 }
01135
01136
01137
01138 Bool_t NuCuts::IsLI(const NuEvent& nu) const
01139 {
01140
01141 if (nu.detector==Detector::kNear) {
01142 MAXMSG("NuCuts",Msg::kInfo,1)
01143 <<"Cutting on ND LI events using litime!=-1"<<endl;
01144 return (nu.litime!=-1);
01145 }
01146
01147
01148 if (nu.anaVersion==NuCuts::kJJH1 ||
01149 nu.anaVersion==NuCuts::kJJE1 ||
01150 nu.anaVersion==NuCuts::kCC0325Std ||
01151 nu.anaVersion==NuCuts::kCC0720Std ||
01152 nu.anaVersion==NuCuts::kCC1070Std ||
01153 nu.anaVersion==NuCuts::kCC2014 ||
01154 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
01155 nu.anaVersion==NuCuts::kCC0720Test ||
01156 nu.anaVersion==NuCuts::kNSI2011Fhc ||
01157 IsNMB(nu)) {
01158
01159 MAXMSG("NuCuts",Msg::kInfo,1)
01160 <<"Cutting on LI events using LISieve and litime!=-1"<<endl;
01161 return (nu.isLI || nu.litime!=-1);
01162 }
01163 else if (nu.anaVersion==NuCuts::kCC0093Std ||
01164 nu.anaVersion==NuCuts::kCC0250Std) {
01165 MAXMSG("NuCuts",Msg::kInfo,1)
01166 <<"Cutting on LI events using FDRCBoundary and litime!=-1"<<endl;
01167 return (nu.litag>0 || nu.litime!=-1);
01168 }
01169 else {
01170 MAXMSG("NuCuts",Msg::kInfo,1)
01171 <<"Cutting on LI events using LISieve and litime!=-1"<<endl;
01172 return (nu.isLI || nu.litime!=-1);
01173 }
01174 }
01175
01176
01177
01178 Bool_t NuCuts::IsCoilOk(const NuEvent& nu) const
01179 {
01180
01181 if (nu.simFlag!=SimFlag::kData) {
01182 MAXMSG("NuCuts",Msg::kInfo,1)
01183 <<"Not cutting on IsCoilOk for simFlag="<<nu.simFlag<<endl;
01184 return true;
01185 }
01186
01187
01188 if (!nu.cutOnDataQuality) {
01189 MAXMSG("NuCuts",Msg::kWarning,1)
01190 <<"Not cutting on IsCoilOk (flag set to not cut)"<<endl;
01191 return true;
01192 }
01193
01194 MAXMSG("NuCuts",Msg::kInfo,1)
01195 <<"Cutting on coilIsOk"<<endl;
01196
01197
01198 if (nu.coilIsOk) {
01199 return true;
01200 }
01201 else {
01202 MAXMSG("NuCuts",Msg::kInfo,10)
01203 <<"Bad magnetic coil, coilIsOk="<<nu.coilIsOk<<endl;
01204 return false;
01205 }
01206 }
01207
01208
01209
01210 Bool_t NuCuts::IsGoodCoilCurrent(const NuEvent& nu) const
01211 {
01212
01213 if (nu.simFlag!=SimFlag::kData) {
01214 MAXMSG("NuCuts",Msg::kInfo,1)
01215 <<"Not cutting on CoilCurrent for simFlag="<<nu.simFlag<<endl;
01216 return true;
01217 }
01218
01219
01220 if (nu.detector!=Detector::kNear) {
01221 MAXMSG("NuCuts",Msg::kInfo,1)
01222 <<"Not cutting on ND CoilCurrent for detector="<<nu.detector
01223 <<endl;
01224 return true;
01225 }
01226
01227
01228 if (!nu.cutOnDataQuality) {
01229 MAXMSG("NuCuts",Msg::kWarning,1)
01230 <<"Not cutting on CoilCurrent (flag set to not cut)"<<endl;
01231 return true;
01232 }
01233
01234 Float_t valueLow=-1000;
01235 Float_t valueHigh=1000;
01236
01237 if (nu.anaVersion==NuCuts::kJJH1 ||
01238 nu.anaVersion==NuCuts::kJJE1 ||
01239 IsNMB(nu)) {
01240
01241 if (nu.coilCurrent<valueLow || nu.coilCurrent>valueHigh) {
01242 MAXMSG("NuCuts",Msg::kInfo,1)
01243 <<"Cutting on CoilCurrent < "<<valueLow
01244 <<" || CoilCurrent > "<<valueHigh<<endl;
01245 return true;
01246 }
01247 else {
01248 MAXMSG("NuCuts",Msg::kInfo,10)
01249 <<"Bad coil current="<<nu.coilCurrent<<endl;
01250 return false;
01251 }
01252 }
01253 else if (nu.anaVersion==NuCuts::kCC0093Std ||
01254 nu.anaVersion==NuCuts::kCC0250Std ||
01255 nu.anaVersion==NuCuts::kCC0325Std ||
01256 nu.anaVersion==NuCuts::kCC0720Std ||
01257 nu.anaVersion==NuCuts::kCC1070Std ||
01258 nu.anaVersion==NuCuts::kCC2014 ||
01259 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
01260 nu.anaVersion==NuCuts::kCC0720Test ||
01261 nu.anaVersion==NuCuts::kNSI2011Fhc) {
01262 if (nu.coilCurrent<valueLow) {
01263 MAXMSG("NuCuts",Msg::kInfo,1)
01264 <<"Cutting on CoilCurrent < "<<valueLow<<endl;
01265 return true;
01266 }
01267 else {
01268 MAXMSG("NuCuts",Msg::kInfo,10)
01269 <<"Bad coil current="<<nu.coilCurrent<<endl;
01270 return false;
01271 }
01272 }
01273 else {
01274 if (nu.coilCurrent<valueLow) {
01275 MAXMSG("NuCuts",Msg::kInfo,1)
01276 <<"Cutting on CoilCurrent < "<<valueLow<<endl;
01277 return true;
01278 }
01279 else {
01280 MAXMSG("NuCuts",Msg::kInfo,10)
01281 <<"Bad coil current="<<nu.coilCurrent<<endl;
01282 return false;
01283 }
01284 }
01285 }
01286
01287
01288
01289 Bool_t NuCuts::IsGoodBeamDetPOTCountingStage(const NuEvent& nu) const
01290 {
01292
01293
01294 if (nu.simFlag!=SimFlag::kData) {
01295 MAXMSG("NuCuts",Msg::kInfo,1)
01296 <<"Not cutting on GoodBeam for simFlag="<<nu.simFlag<<endl;
01297 return true;
01298 }
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308 MAXMSG("NuCuts",Msg::kInfo,1)
01309 <<"Cutting on IsGoodBeamDetPOTCountingStage"<<endl;
01310
01311 if (nu.goodBeamSntp && nu.coilIsOk) {
01312 return true;
01313 }
01314 return false;
01315 }
01316
01317
01318
01319 Bool_t NuCuts::IsGoodBeam(const NuEvent& nu) const
01320 {
01322
01323
01324 if (nu.simFlag!=SimFlag::kData) {
01325 MAXMSG("NuCuts",Msg::kInfo,1)
01326 <<"Not cutting on GoodBeam for simFlag="<<nu.simFlag<<endl;
01327 return true;
01328 }
01329
01330
01331 if (!nu.cutOnBeamInfo) {
01332 MAXMSG("NuCuts",Msg::kWarning,1)
01333 <<"Not cutting on BeamInfo (flag set to not cut)"<<endl;
01334 return true;
01335 }
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346 if (nu.anaVersion==NuCuts::kCC0093Std ||
01347 nu.anaVersion==NuCuts::kCC0250Std) {
01348 MAXMSG("NuCuts",Msg::kInfo,1)
01349 <<"Cutting on GoodBeam with CC0250Std cuts"<<endl;
01350 if (nu.goodBeam &&
01351 nu.hornCur<-10 && nu.hornCur!=-999999 &&
01352 (nu.beamTypeDB==BeamType::kL010z185i ||
01353 nu.beamTypeDB==BeamType::kL010z170i ||
01354 nu.beamTypeDB==BeamType::kL010z200i)){
01355 return true;
01356 }
01357 else {
01358 MAXMSG("NuCuts",Msg::kInfo,100)
01359 <<"Bad beam: goodBeam="<<nu.goodBeam
01360 <<", goodBeamSntp="<<nu.goodBeamSntp
01361 <<", hornCur="<<nu.hornCur
01362 <<", nu.beamTypeDB="<<nu.beamTypeDB
01363 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01364 <<"), hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01365 << endl;
01366 if (nu.detector==Detector::kNear) {
01367 MAXMSG("NuCuts",Msg::kError,1000)
01368 <<"IsGoodBeam: cutting on Bad beam here messes"
01369 <<" up POT counting. Event: " << nu.run << "/" << nu.subRun << ", " << nu.snarl <<endl;
01370 }
01371 return false;
01372 }
01373 }
01374 else if (nu.anaVersion == NuCuts::kCC0325Std ||
01375 nu.anaVersion == NuCuts::kCC0720Std ||
01376 nu.anaVersion == NuCuts::kCC1070Std ||
01377 nu.anaVersion == NuCuts::kCC2014 ||
01378 nu.anaVersion == NuCuts::kCC2014NewCoilCut ||
01379 nu.anaVersion == NuCuts::kCC0720Test || IsNMB(nu) ||
01380 nu.anaVersion==NuCuts::kNSI2011Fhc ){
01381 MAXMSG("NuCuts",Msg::kInfo,1)
01382 <<"Cutting on GoodBeam with CC0325Std cuts"<<endl;
01383
01384
01385 bool isGood = true;
01386
01387
01388 if (!nu.goodBeam)
01389 isGood = false;
01390 if (nu.hornCur==-999999)
01391 isGood = false;
01392
01393 if (nu.hornCur < -10) {
01394 if (nu.beamTypeDB != BeamType::kL010z185i &&
01395 nu.beamTypeDB != BeamType::kL010z170i &&
01396 nu.beamTypeDB != BeamType::kL010z200i &&
01397 nu.beamTypeDB != BeamType::kL250z200i) {
01398 isGood = false;
01399 }
01400 if (nu.hornIsReverse) {
01401 MAXMSG("NuCuts",Msg::kError,1000)
01402 << "nu.hornIsReverse is true but it shouldn't be for beamTypeDB="
01403 << nu.beamTypeDB << "("
01404 << BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01405 << ")" << endl;
01406 }
01407 }
01408 else if (nu.hornCur > 10) {
01409 if (nu.beamTypeDB != BeamType::kL010z185i_rev)
01410 isGood = false;
01411 if (!nu.hornIsReverse) {
01412 MAXMSG("NuCuts",Msg::kError,1000)
01413 << "nu.hornIsReverse is false but it shouldn't be for beamTypeDB="
01414 << nu.beamTypeDB << "("
01415 << BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01416 << ")" << endl;
01417 }
01418 }
01419 else {
01420 if (nu.beamTypeDB != BeamType::kL010z000i)
01421 isGood = false;
01422 }
01423
01424
01425 if (!isGood) {
01426 MAXMSG("NuCuts",Msg::kInfo,100)
01427 <<"Bad beam: goodBeam="<<nu.goodBeam
01428 <<", goodBeamSntp="<<nu.goodBeamSntp
01429 <<", hornCur="<<nu.hornCur
01430 <<", nu.beamTypeDB="<<nu.beamTypeDB
01431 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01432 <<"), hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01433 << endl;
01434 if (nu.detector==Detector::kNear) {
01435 MAXMSG("NuCuts",Msg::kError,1000)
01436 <<"IsGoodBeam: cutting on Bad beam here messes"
01437 <<" up POT counting. Event: " << nu.run << "/" << nu.subRun << ", " << nu.snarl <<endl;
01438 }
01439 return false;
01440 }
01441
01442
01443 static Bool_t firstGoodEvent = true;
01444 static Int_t firstType = 0;
01445
01446 if (firstGoodEvent){
01447 firstGoodEvent = false;
01448 firstType = nu.beamTypeDB;
01449
01450 if (firstType == BeamType::kL010z170i ||
01451 firstType == BeamType::kL010z200i) {
01452 firstType = BeamType::kL010z185i;
01453 }
01454 }
01455 else{
01456 Int_t thisType = nu.beamTypeDB;
01457
01458 if (nu.simFlag==SimFlag::kData && nu.detector==Detector::kFar){
01459 if (thisType == BeamType::kL010z170i ||
01460 thisType == BeamType::kL010z200i) {
01461 thisType = BeamType::kL010z185i;
01462 }
01463 }
01464
01465 if (thisType != firstType) {
01466 MAXMSG("NuCuts",Msg::kWarning,100)
01467 << "Seeing mixed beam: firstType=" << firstType
01468 << ", thisType=" << thisType
01469 << ", beamTypeDB=" << nu.beamTypeDB
01470 << "(" << BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01471 << ")" << endl;
01472 if (nu.detector==Detector::kNear) {
01473 MAXMSG("NuCuts",Msg::kError,1000)
01474 <<"IsGoodBeam: cutting on Bad beam here messes"
01475 <<" up POT counting. Event: " << nu.run << "/" << nu.subRun << ", " << nu.snarl <<endl;
01476 }
01477 return false;
01478 }
01479 }
01480
01481 return true;
01482 }
01483 else {
01484 MAXMSG("NuCuts",Msg::kInfo,1)
01485 <<"Not cutting on GoodBeam"<<endl;
01486 return true;
01487 }
01488 }
01489
01490
01491
01492 Bool_t NuCuts::IsGoodBeamTypeCC2008(const NuEvent& nu)
01493 {
01495
01496 Bool_t goodBeamToUse = nu.goodBeamSntp;
01497 if (Detector::kFar == nu.detector &&
01498 SimFlag::kData == nu.simFlag){
01499 goodBeamToUse = nu.goodBeam;
01500 }
01501
01502
01503 if (nu.simFlag!=SimFlag::kData) {
01504 MAXMSG("NuCuts",Msg::kInfo,1)
01505 <<"Not cutting on IsGoodBeamTypeCC2008 for simFlag="
01506 <<nu.simFlag<<endl;
01507 return true;
01508 }
01509
01510
01511
01512
01513
01514 if (!goodBeamToUse) {
01515 MAXMSG("NuCuts",Msg::kInfo,1)
01516 <<"Not cutting on IsGoodBeamTypeCC2008 for"
01517 <<" events with bad beam data"
01518 <<", goodBeamToUse="<<goodBeamToUse
01519 <<endl;
01520 return true;
01521 }
01522
01523
01524 if (!nu.cutOnBeamInfo) {
01525 MAXMSG("NuCuts",Msg::kWarning,1)
01526 <<"Not cutting on BeamInfo (flag set to not cut)"<<endl;
01527 return true;
01528 }
01529
01530 Bool_t isGoodBeamType=false;
01531
01532 MAXMSG("NuCuts",Msg::kInfo,1)
01533 <<"Cutting on beamTypeDB"<<endl;
01534 if (nu.beamTypeDB==BeamType::kL010z185i ||
01535 nu.beamTypeDB==BeamType::kL010z170i ||
01536 nu.beamTypeDB==BeamType::kL010z200i ||
01537
01538 nu.beamTypeDB==BeamType::kM000z200i_nova ||
01539 nu.beamTypeDB==BeamType::kM000z200i_nova_rev ||
01540 nu.beamTypeDB==BeamType::kL250z200i) {
01541
01542
01543 if (nu.hornCur < -155 && nu.hornCur!=-999999) isGoodBeamType = true;
01544 }
01545 else isGoodBeamType=false;
01546
01547
01548
01549 static Int_t errorCounterBeamType=0;
01550 if (isGoodBeamType) errorCounterBeamType=0;
01551
01552
01553 if (!isGoodBeamType) {
01554 errorCounterBeamType++;
01555 if (nu.detector==Detector::kNear) {
01556
01557
01558
01559 Int_t upperLimit=10;
01560 if (errorCounterBeamType>upperLimit) {
01561 MAXMSG("NuCuts",Msg::kError,100)
01562 <<"Bad beamType: "
01563 <<" beamTypeDB="<<nu.beamTypeDB
01564 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01565 <<"), goodBeamToUse="<<goodBeamToUse
01566 <<", hornCur="<<nu.hornCur
01567 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01568 <<", coilIsOk="<<nu.coilIsOk
01569 <<", coilIsReverse="<<nu.coilIsReverse
01570 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01571 <<", run="<<nu.run<<", subRun="<<nu.subRun
01572 <<", snarl="<<nu.snarl
01573 << endl;
01574 MSG("NuCutImps",Msg::kError)
01575 <<"Asserting on wrong beam type"
01576 <<" when we get more than "<<upperLimit<<" events with"
01577 <<" wrong beam in a row"
01578 <<", errorCounterBeamType="<<errorCounterBeamType
01579 <<endl;
01580 assert(isGoodBeamType);
01581 }
01582 else {
01583 MSG("NuCutImps",Msg::kWarning)
01584 <<"Not asserting on wrong beam type until"
01585 <<" we get more than "<<upperLimit<<" events with"
01586 <<" mixed beam in a row"
01587 <<", errorCounterBeamType="<<errorCounterBeamType
01588 <<", beamTypeDB="<<nu.beamTypeDB
01589 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01590 <<"), goodBeamToUse="<<goodBeamToUse
01591 <<", hornCur="<<nu.hornCur
01592 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01593 <<", coilIsOk="<<nu.coilIsOk
01594 <<", coilIsReverse="<<nu.coilIsReverse
01595 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01596 <<", run="<<nu.run<<", subRun="<<nu.subRun
01597 <<", snarl="<<nu.snarl
01598 <<endl;
01599 }
01600 }
01601 else if (nu.detector==Detector::kFar) {
01602 MSG("NuCuts",Msg::kWarning)
01603 <<"Bad beamType: "
01604 <<" beamTypeDB="<<nu.beamTypeDB
01605 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01606 <<"), goodBeamToUse="<<goodBeamToUse
01607 <<", hornCur="<<nu.hornCur
01608 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01609 <<", coilIsOk="<<nu.coilIsOk
01610 <<", coilIsReverse="<<nu.coilIsReverse
01611 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01612 <<", run="<<nu.run<<", subRun="<<nu.subRun
01613 <<", snarl="<<nu.snarl
01614 << endl;
01615
01616
01617
01618 }
01619 else {
01620 cout<<"Ahhh, detector not known..."<<endl;
01621 }
01622 }
01623
01624 return isGoodBeamType;
01625 }
01626
01627
01628
01629 Bool_t NuCuts::IsGoodBeamTypeRHC2010(const NuEvent& nu)
01630 {
01632
01633 Bool_t goodBeamToUse = nu.goodBeamSntp;
01634 if (Detector::kFar == nu.detector &&
01635 SimFlag::kData == nu.simFlag){
01636 goodBeamToUse = nu.goodBeam;
01637 }
01638
01639
01640 if (nu.simFlag!=SimFlag::kData) {
01641 MAXMSG("NuCuts",Msg::kInfo,1)
01642 <<"Not cutting on IsGoodBeamTypeRHC2010 for simFlag="
01643 <<nu.simFlag<<endl;
01644 return true;
01645 }
01646
01647
01648
01649
01650
01651 if (!goodBeamToUse) {
01652 MAXMSG("NuCuts",Msg::kInfo,1)
01653 <<"Not cutting on IsGoodBeamTypeRHC2010 for"
01654 <<" events with bad beam data"
01655 <<", goodBeamToUse="<<goodBeamToUse
01656 <<endl;
01657 return true;
01658 }
01659
01660
01661 if (!nu.cutOnBeamInfo) {
01662 MAXMSG("NuCuts",Msg::kWarning,1)
01663 <<"Not cutting on BeamInfo (flag set to not cut)"<<endl;
01664 return true;
01665 }
01666
01667 Bool_t isGoodBeamType=false;
01668
01669 MAXMSG("NuCuts",Msg::kInfo,1)
01670 <<"Cutting on beamTypeDB"<<endl;
01671 if (nu.beamTypeDB==BeamType::kL010z185i_rev &&
01672 nu.hornIsReverse) {
01673
01674
01675
01676 if (nu.hornCur > 155 && nu.hornCur!=-999999) isGoodBeamType = true;
01677 }
01678 else isGoodBeamType=false;
01679
01680
01681
01682 static Int_t errorCounterBeamType=0;
01683 if (isGoodBeamType) errorCounterBeamType=0;
01684
01685
01686 if (!isGoodBeamType) {
01687 errorCounterBeamType++;
01688 if (nu.detector==Detector::kNear) {
01689
01690
01691
01692 Int_t upperLimit=10;
01693 if (errorCounterBeamType>upperLimit) {
01694 MAXMSG("NuCuts",Msg::kError,100)
01695 <<"Bad beamType: "
01696 <<" beamTypeDB="<<nu.beamTypeDB
01697 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01698 <<"), goodBeamToUse="<<goodBeamToUse
01699 <<", hornCur="<<nu.hornCur
01700 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01701 <<", coilIsOk="<<nu.coilIsOk
01702 <<", coilIsReverse="<<nu.coilIsReverse
01703 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01704 <<", run="<<nu.run<<", subRun="<<nu.subRun
01705 <<", snarl="<<nu.snarl
01706 << endl;
01707 MSG("NuCutImps",Msg::kError)
01708 <<"Asserting on wrong beam type"
01709 <<" when we get more than "<<upperLimit<<" events with"
01710 <<" wrong beam in a row"
01711 <<", errorCounterBeamType="<<errorCounterBeamType
01712 <<endl;
01713 assert(isGoodBeamType);
01714 }
01715 else {
01716 MSG("NuCutImps",Msg::kWarning)
01717 <<"Not asserting on wrong beam type until"
01718 <<" we get more than "<<upperLimit<<" events with"
01719 <<" mixed beam in a row"
01720 <<", errorCounterBeamType="<<errorCounterBeamType
01721 <<", beamTypeDB="<<nu.beamTypeDB
01722 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01723 <<"), goodBeamToUse="<<goodBeamToUse
01724 <<", hornCur="<<nu.hornCur
01725 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01726 <<", coilIsOk="<<nu.coilIsOk
01727 <<", coilIsReverse="<<nu.coilIsReverse
01728 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01729 <<", run="<<nu.run<<", subRun="<<nu.subRun
01730 <<", snarl="<<nu.snarl
01731 <<endl;
01732 }
01733 }
01734 else if (nu.detector==Detector::kFar) {
01735 MSG("NuCuts",Msg::kWarning)
01736 <<"Bad beamType: "
01737 <<" beamTypeDB="<<nu.beamTypeDB
01738 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01739 <<"), goodBeamToUse="<<goodBeamToUse
01740 <<", hornCur="<<nu.hornCur
01741 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01742 <<", coilIsOk="<<nu.coilIsOk
01743 <<", coilIsReverse="<<nu.coilIsReverse
01744 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01745 <<", run="<<nu.run<<", subRun="<<nu.subRun
01746 <<", snarl="<<nu.snarl
01747 << endl;
01748
01749
01750
01751 }
01752 else {
01753 cout<<"Ahhh, detector not known..."<<endl;
01754 }
01755 }
01756
01757 return isGoodBeamType;
01758 }
01759
01760
01761
01762 Bool_t NuCuts::IsGoodCoilCurrentDirectionRHC2010(const NuEvent& nu)
01763 {
01765
01766
01767 if (nu.simFlag!=SimFlag::kData) {
01768 MAXMSG("NuCuts",Msg::kInfo,1)
01769 <<"Not cutting on IsGoodCoilCurrentRHC2010 for simFlag="
01770 <<nu.simFlag<<endl;
01771 return true;
01772 }
01773
01774
01775
01776
01777
01778 if (!nu.coilIsOk) {
01779 MAXMSG("NuCuts",Msg::kInfo,1)
01780 <<"Not cutting on IsGoodCoilCurrentRHC2010 for"
01781 <<" events with bad coil current data"
01782 <<", coilIsOk="<<nu.coilIsOk
01783 <<endl;
01784 return true;
01785 }
01786
01787 Bool_t isGoodCoilCurrent=false;
01788
01789 MAXMSG("NuCuts",Msg::kInfo,1)
01790 <<"Cutting on IsGoodCoilCurrentRHC2010"<<endl;
01791 if (nu.coilIsReverse) {
01792 isGoodCoilCurrent = true;
01793 }
01794 else isGoodCoilCurrent=false;
01795
01796
01797 if (!isGoodCoilCurrent) {
01798 if (nu.detector==Detector::kNear) {
01799 MAXMSG("NuCuts",Msg::kError,100)
01800 <<"Bad coil current: "
01801 <<" coilIsReverse="<<nu.coilIsReverse
01802 <<", coilIsOk="<<nu.coilIsOk
01803 <<", beamTypeDB="<<nu.beamTypeDB
01804 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01805 <<"), goodBeamSntp="<<nu.goodBeamSntp
01806 <<", goodBeam="<<nu.goodBeam
01807 <<", hornCur="<<nu.hornCur
01808 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01809 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01810 <<", run="<<nu.run<<", subRun="<<nu.subRun
01811 <<", snarl="<<nu.snarl
01812 << endl;
01813 assert(isGoodCoilCurrent);
01814 }
01815 else if (nu.detector==Detector::kFar) {
01816 MSG("NuCuts",Msg::kWarning)
01817 <<"Bad coil current: "
01818 <<" coilIsReverse="<<nu.coilIsReverse
01819 <<", coilIsOk="<<nu.coilIsOk
01820 <<", beamTypeDB="<<nu.beamTypeDB
01821 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01822 <<"), goodBeamSntp="<<nu.goodBeamSntp
01823 <<", goodBeam="<<nu.goodBeam
01824 <<", hornCur="<<nu.hornCur
01825 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01826 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01827 <<", run="<<nu.run<<", subRun="<<nu.subRun
01828 <<", snarl="<<nu.snarl
01829 << endl;
01830
01831
01832
01833 }
01834 else {
01835 cout<<"Ahhh, detector not known..."<<endl;
01836 }
01837 }
01838
01839 return isGoodCoilCurrent;
01840 }
01841
01842
01843
01844 Bool_t NuCuts::IsGoodCoilCurrentDirectionCC2008(const NuEvent& nu)
01845 {
01847
01848
01849 if (nu.simFlag!=SimFlag::kData) {
01850 MAXMSG("NuCuts",Msg::kInfo,1)
01851 <<"Not cutting on IsGoodCoilCurrentCC2008 for simFlag="
01852 <<nu.simFlag<<endl;
01853 return true;
01854 }
01855
01856
01857
01858
01859
01860 if (!nu.coilIsOk) {
01861 MAXMSG("NuCuts",Msg::kInfo,1)
01862 <<"Not cutting on IsGoodCoilCurrentCC2008 for"
01863 <<" events with bad coil current data"
01864 <<", coilIsOk="<<nu.coilIsOk
01865 <<endl;
01866 return true;
01867 }
01868
01869 Bool_t isGoodCoilCurrent=false;
01870
01871 MAXMSG("NuCuts",Msg::kInfo,1)
01872 <<"Cutting on IsGoodCoilCurrentCC2008"<<endl;
01873 if (!nu.coilIsReverse) {
01874 isGoodCoilCurrent = true;
01875 }
01876 else isGoodCoilCurrent=false;
01877
01878 if (!isGoodCoilCurrent) {
01879 if (nu.detector==Detector::kNear) {
01880 MAXMSG("NuCuts",Msg::kError,100)
01881 <<"Bad coil current: "
01882 <<" coilIsReverse="<<nu.coilIsReverse
01883 <<", coilIsOk="<<nu.coilIsOk
01884 <<", beamTypeDB="<<nu.beamTypeDB
01885 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01886 <<"), goodBeamSntp="<<nu.goodBeamSntp
01887 <<", goodBeam="<<nu.goodBeam
01888 <<", hornCur="<<nu.hornCur
01889 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01890 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01891 <<", run="<<nu.run<<", subRun="<<nu.subRun
01892 <<", snarl="<<nu.snarl
01893 << endl;
01894 assert(isGoodCoilCurrent);
01895 }
01896 else if (nu.detector==Detector::kFar) {
01897 MSG("NuCuts",Msg::kWarning)
01898 <<"Bad coil current: "
01899 <<" coilIsReverse="<<nu.coilIsReverse
01900 <<", coilIsOk="<<nu.coilIsOk
01901 <<", beamTypeDB="<<nu.beamTypeDB
01902 <<"("<<BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
01903 <<"), goodBeamSntp="<<nu.goodBeamSntp
01904 <<", goodBeam="<<nu.goodBeam
01905 <<", hornCur="<<nu.hornCur
01906 <<", hornIsReverse="<< (nu.hornIsReverse?"Yes":"No")
01907 <<", isGoodDataQuality="<<nu.isGoodDataQuality
01908 <<", run="<<nu.run<<", subRun="<<nu.subRun
01909 <<", snarl="<<nu.snarl
01910 << endl;
01911
01912
01913
01914 }
01915 else {
01916 cout<<"Ahhh, detector not known..."<<endl;
01917 }
01918 }
01919
01920 return isGoodCoilCurrent;
01921 }
01922
01923
01924
01925 Bool_t NuCuts::IsGoodDataQuality(const NuEvent& nu) const
01926 {
01927
01928 if (nu.simFlag!=SimFlag::kData) {
01929 MAXMSG("NuCuts",Msg::kInfo,1)
01930 <<"Not cutting on DataQuality for simFlag="<<nu.simFlag<<endl;
01931 return true;
01932 }
01933
01934
01935 if (!nu.cutOnDataQuality) {
01936 MAXMSG("NuCuts",Msg::kWarning,1)
01937 <<"Not cutting on DataQuality (flag set to not cut)"
01938 <<", isGoodDataQuality="<<nu.isGoodDataQuality<<endl;
01939 return true;
01940 }
01941
01942
01943 if (nu.detector==Detector::kFar) {
01944 MAXMSG("NuCuts",Msg::kInfo,1)
01945 <<"Cutting on IsGoodDataQuality"<<endl;
01946 return nu.isGoodDataQuality;
01947 }
01948 else if (nu.detector==Detector::kNear) {
01949 if (nu.anaVersion==NuCuts::kCC0093Std ||
01950 nu.anaVersion==NuCuts::kJJH1 ||
01951 nu.anaVersion==NuCuts::kCC0250Std ||
01952 nu.anaVersion==NuCuts::kJJE1 ||
01953 nu.anaVersion==NuCuts::kCC0325Std ||
01954 nu.anaVersion == NuCuts::kCC0720Std ||
01955 nu.anaVersion == NuCuts::kCC1070Std ||
01956 nu.anaVersion == NuCuts::kCC2014 ||
01957 nu.anaVersion == NuCuts::kCC2014NewCoilCut ||
01958 nu.anaVersion==NuCuts::kCC0720Test ||
01959 nu.anaVersion==NuCuts::kNSI2011Fhc ||
01960 nu.anaVersion==NuCuts::kJJE2 ||
01961 nu.anaVersion == NuCuts::kNMB0325Alpha ||
01962 nu.anaVersion == NuCuts::kNMB0325Bravo ||
01963 nu.anaVersion == NuCuts::kNMB0325BravoTwo ||
01964 nu.anaVersion == NuCuts::kNMB0325Charlie ||
01965 nu.anaVersion == NuCuts::kNMB0325Delta ||
01966 nu.anaVersion == NuCuts::kNMB0325Echo ||
01967 nu.anaVersion == NuCuts::kRM1 ||
01968 nu.anaVersion == NuCuts::kRM2 ||
01969 nu.anaVersion == NuCuts::kNMBFree) {
01970 MAXMSG("NuCuts",Msg::kInfo,1)
01971 <<"NOT cutting on IsGoodDataQuality for anaVersion="<<nu.anaVersion<<endl;
01972
01973
01974
01975
01976 return true;
01977 }
01978 else {
01979 MAXMSG("NuCuts",Msg::kInfo,1)
01980 <<"Cutting on IsGoodDataQuality"<<endl;
01981 return nu.isGoodDataQuality;
01982 }
01983 }
01984 else {
01985 cout<<"Ahhh, det="<<nu.detector<<endl;
01986 return false;
01987 }
01988 }
01989
01990
01991
01992 Bool_t NuCuts::IsGoodTimeToNearestSpill(const NuEvent& nu) const
01993 {
01996
01997
01998 if (nu.simFlag!=SimFlag::kData) {
01999 MAXMSG("NuCuts",Msg::kInfo,1)
02000 <<"Not cutting on TimeToNearestSpill for simFlag="<<nu.simFlag
02001 <<endl;
02002 return true;
02003 }
02004
02005
02006 if (nu.detector!=Detector::kFar) {
02007 MAXMSG("NuCuts",Msg::kInfo,1)
02008 <<"Not cutting on TimeToNearestSpill for detector="<<nu.detector
02009 <<endl;
02010 return true;
02011 }
02012
02013
02014 if (!nu.cutOnSpillTiming) {
02015 MAXMSG("NuCuts",Msg::kWarning,1)
02016 <<"Not cutting on SpillTiming (flag set to not cut)"<<endl;
02017 return true;
02018 }
02019
02020
02021 Double_t lowerTimeBound=-20*(Munits::microsecond);
02022 Double_t upperTimeBound=+30*(Munits::microsecond);
02023
02024 if (this->IsNMB(nu) || NuCuts::kJJE1==nu.anaVersion){
02025
02026 lowerTimeBound=-2*(Munits::microsecond);
02027 upperTimeBound=+12*(Munits::microsecond);
02028 }
02029
02030 MAXMSG("NuCuts",Msg::kInfo,1)
02031 <<"Cutting on TimeToNearestSpill: "
02032 <<lowerTimeBound/(Munits::microsecond)<<"<t<"
02033 <<upperTimeBound/(Munits::microsecond)<<" us"<<endl;
02034
02035 if (nu.timeEvtMin-nu.timeToNearestSpill>lowerTimeBound &&
02036 nu.timeEvtMin-nu.timeToNearestSpill<upperTimeBound) {
02037 return true;
02038 }
02039 else return false;
02040 }
02041
02042
02043
02044 Bool_t NuCuts::IsGoodDirCos(const NuEvent& nu) const
02045 {
02046 Float_t cutValue=0.6;
02047
02048 Float_t value=nu.dirCosNu;
02049
02050 if (nu.detector==Detector::kNear) {
02051 MAXMSG("NuCuts",Msg::kInfo,1)
02052 <<"Not cutting on track direction cosine for ND"<<endl;
02053 return true;
02054 }
02055 else if (nu.detector==Detector::kFar) {
02056 MAXMSG("NuCuts",Msg::kInfo,1)
02057 <<"Making cut on track direction cosine>"<<cutValue<<endl;
02058 if (value>cutValue) return true;
02059 else return false;
02060 }
02061 else {
02062 cout<<"Ahhh, detector="<<nu.detector<<endl;
02063 return false;
02064 }
02065 }
02066
02067
02068
02069 Bool_t NuCuts::IsInFidVol(Float_t x,Float_t y,Float_t z,
02070 Float_t u,Float_t v,
02071 Int_t planeTrkVtx,Float_t rTrkVtx,
02072 Int_t detector,Int_t anaVersion,
02073 Int_t releaseType,Int_t simFlag) const
02074 {
02075
02076 static Bool_t infid_initialised=false;
02077
02079
02081 if (detector==Detector::kNear){
02082 if (anaVersion==NuCuts::kCC0093Std) {
02083 MAXMSG("NuCuts",Msg::kInfo,1)
02084 <<"Cutting on ND xyz point being in kCC0093Std fid vol"<<endl;
02085 return this->IsInFidVolNDCC0093Std(x,y,z);
02086 }
02087 else if (anaVersion==NuCuts::kCC0250Std) {
02088 MAXMSG("NuCuts",Msg::kInfo,1)
02089 <<"Cutting on ND xyz point being in kCC0250Std fid vol"<<endl;
02090 return this->IsInFidVolNDCC0250Std(x,y,z);
02091 }
02092 else if ( anaVersion==NuCuts::kCC0325Std ||
02093 anaVersion == NuCuts::kCC0720Std ||
02094 anaVersion == NuCuts::kCC1070Std ||
02095 anaVersion == NuCuts::kCC2014 ||
02096 anaVersion == NuCuts::kCC2014NewCoilCut ||
02097 anaVersion==NuCuts::kCC0720Test ||
02098 anaVersion==NuCuts::kNSI2011Fhc ||
02099 anaVersion==NuCuts::kJJH1 ||
02100 anaVersion==NuCuts::kJJE1 ||
02101 anaVersion==NuCuts::kJJE2 ||
02102 anaVersion == NuCuts::kNMB0325Alpha ||
02103 anaVersion == NuCuts::kNMB0325Bravo ||
02104 anaVersion == NuCuts::kNMB0325BravoTwo ||
02105 anaVersion == NuCuts::kNMB0325Charlie ||
02106 anaVersion == NuCuts::kNMB0325Delta ||
02107 anaVersion == NuCuts::kNMB0325Echo ||
02108 anaVersion == NuCuts::kRM1 ||
02109 anaVersion == NuCuts::kRM2 ||
02110 anaVersion == NuCuts::kNMBFree ||
02111 anaVersion == NuCuts::kRHC ||
02112 anaVersion == NuCuts::kMSRock ) {
02113 static Int_t msgCounter = 0;
02114 if (msgCounter < 20){
02115 MAXMSG("NuCuts",Msg::kInfo,1)
02116 <<"Cutting on ND xyz point being in kCC0325Std fid vol"<<endl;
02117 ++msgCounter;
02118 }
02119 if (!infid_initialised) {
02120 infid_initialised=true;
02121 choose_infid_set("cc2008");
02122 }
02123 return infid(static_cast<Detector::Detector_t>(detector),
02124 static_cast<SimFlag::SimFlag_t>(simFlag),
02125 x,y,z);
02126 }
02127 else if (anaVersion==NuCuts::kFullDST) {
02128 MAXMSG("NuCuts",Msg::kInfo,1)
02129 <<"For kFullDST cutting on ND xyz point being in"
02130 <<" \"loose\" fid vol"<<endl;
02131 return this->IsInFidVolLoose(x,y,z,detector);
02132 }
02133 else {
02134 MAXMSG("NuCuts",Msg::kInfo,1)
02135 <<"Cutting on ND xyz point being in Pitt fid vol"<<endl;
02136 return this->IsInFidVolPitt(x,y,z,u,v);
02137 }
02138 }
02140
02142 else if (detector==Detector::kFar){
02143 if (anaVersion==NuCuts::kCC0093Std) {
02144 MAXMSG("NuCuts",Msg::kInfo,1)
02145 <<"Cutting on FD xyz point being in kCC0093Std fid vol"<<endl;
02146 return this->IsInFidVolFDCC0093Std(x,y,z);
02147 }
02148 else if (anaVersion==NuCuts::kCC0250Std) {
02149 if (ReleaseType::IsBirch(releaseType)) {
02150 MSG("NuCuts",Msg::kError)
02151 <<"You can't run kCC0250Std cuts on Birch data since not all"
02152 <<" the variables are available!"<<endl;
02153 MSG("NuCuts",Msg::kFatal)<<"This doesn't print"<<endl;
02154 }
02155 MAXMSG("NuCuts",Msg::kInfo,1)
02156 <<"Cutting on FD xyz point being in kCC0250Std fid vol"<<endl;
02157 return this->IsInFidVolFDCC0250Std(planeTrkVtx,rTrkVtx);
02158 }
02159 else if (anaVersion==NuCuts::kCC0325Std ||
02160 anaVersion == NuCuts::kCC0720Std ||
02161 anaVersion == NuCuts::kCC1070Std ||
02162 anaVersion == NuCuts::kCC2014 ||
02163 anaVersion == NuCuts::kCC2014NewCoilCut ||
02164 anaVersion==NuCuts::kCC0720Test ||
02165 anaVersion==NuCuts::kNSI2011Fhc ||
02166 anaVersion==NuCuts::kJJH1 ||
02167 anaVersion==NuCuts::kJJE1 ||
02168 anaVersion==NuCuts::kJJE2 ||
02169 anaVersion == NuCuts::kNMB0325Alpha ||
02170 anaVersion == NuCuts::kNMB0325Bravo ||
02171 anaVersion == NuCuts::kNMB0325BravoTwo ||
02172 anaVersion == NuCuts::kNMB0325Charlie ||
02173 anaVersion == NuCuts::kNMB0325Delta ||
02174 anaVersion == NuCuts::kNMB0325Echo ||
02175 anaVersion == NuCuts::kRM1 ||
02176 anaVersion == NuCuts::kRM2 ||
02177 anaVersion == NuCuts::kNMBFree ||
02178 anaVersion == NuCuts::kRHC ||
02179 anaVersion == NuCuts::kMSRock) {
02180 MAXMSG("NuCuts",Msg::kInfo,1)
02181 <<"Cutting on FD xyz point being in kCC0325Std fid vol"<<endl;
02182 if (!infid_initialised) {
02183 infid_initialised=true;
02184 choose_infid_set("cc2008");
02185 }
02186 Bool_t isin = infid(static_cast<Detector::Detector_t>(detector),
02187 static_cast<SimFlag::SimFlag_t>(simFlag),
02188 x,y,z);
02189
02190 if (anaVersion == NuCuts::kMSRock) {
02191 MAXMSG("NuCuts",Msg::kInfo,1)
02192 <<"Cutting on INVERSE fiducial volume"<<endl;
02193 return !isin;
02194 }
02195 return isin;
02196 }
02197 else if (anaVersion==NuCuts::kFullDST) {
02198 MAXMSG("NuCuts",Msg::kInfo,1)
02199 <<"For kFullDST cutting on FD xyz point being in"
02200 <<" \"loose\" fid vol"<<endl;
02201 return this->IsInFidVolLoose(x,y,z,detector);
02202 }
02203 else {
02204
02205 MAXMSG("NuCuts",Msg::kInfo,1)
02206 <<"Cutting on FD xyz point being in kCC0093Std fid vol"<<endl;
02207 return this->IsInFidVolFDCC0093Std(x,y,z);
02208 }
02209 }
02210 else {
02211 cout<<"Ahhh, detector not recognised, det="<<detector<<endl;
02212 return false;
02213 }
02214 }
02215
02216
02217
02218 Bool_t NuCuts::IsInFidVolTrueEvt(const NuMCEvent& mc) const
02219 {
02223 MAXMSG("NuCuts",Msg::kInfo,1)
02224 <<"Cutting on IsInFidVolTrueEvt()"<<endl;
02225 return this->IsInFidVol
02226 (mc.vtxxMC,mc.vtxyMC,mc.vtxzMC,mc.vtxuMC, mc.vtxvMC,
02227 mc.planeTrkVtxMC,mc.rTrkVtxMC,
02228 mc.detector,mc.anaVersion,mc.releaseType,mc.simFlag);
02229 }
02230
02231
02232
02233 Bool_t NuCuts::IsInFidVolTrueEvt(const NuEvent& nu) const
02234 {
02238
02239 if (nu.simFlag != SimFlag::kMC) {
02240 MSG("NuCuts",Msg::kError) << "Cannot do true cut on data" << endl;
02241 MSG("NuCuts",Msg::kFatal) << "Cannot do true cut on data" << endl;
02242 }
02243
02244 return this->IsInFidVol
02245 (nu.vtxxMC,nu.vtxyMC,nu.vtxzMC,nu.vtxuMC, nu.vtxvMC,
02246 nu.planeTrkVtxMC,nu.rTrkVtxMC,
02247 nu.detector,nu.anaVersion,nu.releaseType,nu.simFlag);
02248 }
02249
02250
02251
02252 Bool_t NuCuts::IsInFidVolTrk(const NuEvent& nu) const
02253 {
02256
02257
02258 Float_t z=nu.zTrkVtx;
02259
02260
02261
02262 if (nu.anaVersion==NuCuts::kCC0325Std ||
02263 nu.anaVersion==NuCuts::kCC0720Std ||
02264 nu.anaVersion==NuCuts::kCC1070Std ||
02265 nu.anaVersion==NuCuts::kCC2014 ||
02266 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
02267 nu.anaVersion==NuCuts::kCC0720Test ||
02268 nu.anaVersion==NuCuts::kNSI2011Fhc ||
02269 nu.anaVersion==NuCuts::kJJH1 ||
02270 nu.anaVersion==NuCuts::kJJE1 ||
02271 IsNMB(nu) ) {
02272 z=nu.zTrkVtx-(0.0392*Munits::m);
02273 }
02274
02275 MAXMSG("NuCuts",Msg::kInfo,1)
02276 <<"Cutting on IsInFidVolTrk()"<<endl;
02277 return this->IsInFidVol(nu.xTrkVtx,nu.yTrkVtx,
02278 z,
02279 nu.uTrkVtx,nu.vTrkVtx,
02280 nu.planeTrkVtx,nu.rTrkVtx,
02281 nu.detector,nu.anaVersion,
02282 nu.releaseType,nu.simFlag);
02283 }
02284
02285
02286
02287 Bool_t NuCuts::IsInFidVolEvt(const NuEvent& nu) const
02288 {
02291
02292
02293 Float_t z=nu.zEvtVtx;
02294
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307
02308 MAXMSG("NuCuts",Msg::kInfo,1)
02309 <<"Cutting on IsInFidVolTrk()"<<endl;
02310 return this->IsInFidVol(nu.xEvtVtx,nu.yEvtVtx,
02311 z,
02312 nu.uEvtVtx,nu.vEvtVtx,
02313 nu.planeEvtVtx,nu.rEvtVtx,
02314 nu.detector,nu.anaVersion,
02315 nu.releaseType,nu.simFlag);
02316 }
02317
02318
02319
02320 Bool_t NuCuts::IsInFidVolOffset(Float_t x,Float_t y,Float_t z) const
02321 {
02322 const Float_t zerox=0.9*(Munits::m);
02323 const Float_t zeroy=0.0*(Munits::m);
02324 const Float_t minZ=1.0*(Munits::m);
02325 const Float_t maxZ=4.0*(Munits::m);
02326 const Float_t maxR=0.6*(Munits::m);
02327 Bool_t passFid=this->IsInCylindricalVolume(x,y,z,zerox,zeroy,
02328 minZ,maxZ,maxR);
02329 passFid=passFid && x>=0.7;
02330 return passFid;
02331 }
02332
02333
02334
02335 Bool_t NuCuts::IsInFidVolOffset(const NuEvent& nu) const
02336 {
02337 return this->IsInFidVolOffset(nu.xTrkVtx,nu.yTrkVtx,nu.zTrkVtx);
02338 }
02339
02340
02341
02342 Bool_t NuCuts::IsInFidVolNDNuMuBar(Float_t x,Float_t y,
02343 Float_t z) const
02344 {
02345
02346 const Float_t beamzerox=1.4828*(Munits::m);
02347 const Float_t beamzeroy=0.2384*(Munits::m);
02348
02349
02350 Float_t minZ=0.6*(Munits::m);
02351 Float_t maxZ=4.0*(Munits::m);
02352 Float_t maxR=0.8*(Munits::m);
02353
02354 return this->IsInCylindricalVolume(x,y,z,beamzerox,beamzeroy,
02355 minZ,maxZ,maxR);
02356 }
02357
02358
02359
02360 Bool_t NuCuts::IsInFidVolNDCC0093Std(Float_t x,Float_t y,
02361 Float_t z) const
02362 {
02363
02364
02365 const Float_t beamzerox=1.4885*(Munits::m);
02366 const Float_t beamzeroy=0.1397*(Munits::m);
02367
02368
02369
02370 Float_t minZ=1.0*(Munits::m);
02371 Float_t maxZ=5.0*(Munits::m);
02372 Float_t maxR=1.0*(Munits::m);
02373
02374 return this->IsInCylindricalVolume(x,y,z,beamzerox,beamzeroy,
02375 minZ,maxZ,maxR);
02376 }
02377
02378
02379
02380 Bool_t NuCuts::IsInFidVolNDCC0250Std(Float_t x,Float_t y,
02381 Float_t z) const
02382 {
02383
02384 const Float_t beamzerox=1.4828*(Munits::m);
02385 const Float_t beamzeroy=0.2384*(Munits::m);
02386
02387
02388 Float_t minZ=1.0*(Munits::m);
02389 Float_t maxZ=5.0*(Munits::m);
02390 Float_t maxR=1.0*(Munits::m);
02391
02392 return this->IsInCylindricalVolume(x,y,z,beamzerox,beamzeroy,
02393 minZ,maxZ,maxR);
02394 }
02395
02396
02397
02398 Bool_t NuCuts::IsInFidVolFDNuMuBar(Int_t planeTrkVtx,
02399 Float_t rTrkVtx) const
02400 {
02401
02402
02403
02404
02405
02406 if (rTrkVtx>(0.4*Munits::m) &&
02407 rTrkVtx<sqrt(14.)*Munits::m &&
02408 ((planeTrkVtx>4 && planeTrkVtx<241) ||
02409 (planeTrkVtx>253 && planeTrkVtx<466))) return true;
02410 else return false;
02411 }
02412
02413
02414
02415 Bool_t NuCuts::IsInFidVolFDCC0093Std(Float_t x,Float_t y,
02416 Float_t z) const
02417 {
02418
02419
02420
02421 if(((z>0.50 && z<14.3) || (z>16.2 && z<28.0)) &&
02422 ((x*x)+(y*y))<14.0) return true;
02423 else return false;
02424 }
02425
02426
02427
02428 Bool_t NuCuts::IsInFidVolFDCC0250Std(Int_t planeTrkVtx,
02429 Float_t rTrkVtx) const
02430 {
02431
02432
02433
02434
02435
02436
02437
02438
02439
02440
02441 if (rTrkVtx<sqrt(14.)*Munits::m &&
02442 ((planeTrkVtx>4 && planeTrkVtx<241) ||
02443 (planeTrkVtx>253 && planeTrkVtx<466))) return true;
02444 else return false;
02445 }
02446
02447
02448
02449
02450
02451
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470 Bool_t NuCuts::IsInFidVolPitt(Float_t x,Float_t y,Float_t z,
02471 Float_t u,Float_t v) const
02472 {
02473
02474
02475
02476 if( !( z>0.6 && z<3.56) ) return kFALSE;
02477 if( !( u>0.3 && u<1.8) ) return kFALSE;
02478 if( !( v>-1.8 && v< -0.3) ) return kFALSE;
02479 if( x>=2.4) return kFALSE;
02480 const Float_t coil_cut=0.8*0.8;
02481 if( (x*x + y*y) <= coil_cut) return kFALSE;
02482 return kTRUE;
02483 }
02484
02485
02486
02487 Bool_t NuCuts::IsInFidVolLoose(const NuEvent& nu) const
02488 {
02493
02494
02495 const NuLibrary& lib = NuLibrary::Instance();
02496
02497
02498 for(int trkIdx = 1; trkIdx <= 3; ++trkIdx){
02499 if(get_trkExists(nu, trkIdx) &&
02500 lib.cuts.IsInFidVolLoose(get_xTrkVtx(nu, trkIdx),
02501 get_yTrkVtx(nu, trkIdx),
02502 get_zTrkVtx(nu, trkIdx),
02503 nu.detector)) return true;
02504 }
02505
02506
02507
02508 for(int shwIdx = 1; shwIdx <= 3; ++shwIdx){
02509 if(get_shwExists(nu, shwIdx) &&
02510 lib.cuts.IsInFidVolLoose(get_xShwVtx(nu, shwIdx),
02511 get_yShwVtx(nu, shwIdx),
02512 get_zShwVtx(nu, shwIdx),
02513 nu.detector)) return true;
02514 }
02515
02516 if(lib.cuts.IsInFidVolLoose(nu.xEvtVtx,
02517 nu.yEvtVtx,
02518 nu.zEvtVtx,
02519 nu.detector)) return true;
02520
02521
02522
02523 return false;
02524 }
02525
02526
02527
02528 Bool_t NuCuts::IsInFidVolLoose(Float_t x,Float_t y,Float_t z,
02529 Int_t detector) const
02530 {
02535
02536
02537 if (detector==Detector::kFar) return true;
02538
02539
02540
02541 const Float_t beamzerox=1.4828*(Munits::m);
02542 const Float_t beamzeroy=0.1397*(Munits::m);
02543 const Float_t minZ=0.5*(Munits::m);
02544 const Float_t maxZ=5.1*(Munits::m);
02545 const Float_t maxR=1.4*(Munits::m);
02546
02547
02548 Bool_t passFid=this->IsInCylindricalVolume
02549 (x,y,z,beamzerox,beamzeroy,minZ,maxZ,maxR);
02550
02551
02552 return passFid;
02553 }
02554
02555
02556
02557 Bool_t NuCuts::IsInCylindricalVolume(Float_t x,Float_t y,
02558 Float_t z,
02559 Float_t zerox,Float_t zeroy,
02560 Float_t minZ,Float_t maxZ,
02561 Float_t maxR) const
02562 {
02563 Float_t r=sqrt(pow((x-zerox),2)+pow((y-zeroy),2));
02564 if(z>minZ && z<maxZ && r<maxR) return true;
02565 else return false;
02566 }
02567
02568
02569
02570 void NuCuts::FindZCuts() const
02571 {
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589
02590
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606 FidVol::find_z_cuts(17,84,8,240,255,452,
02607 FidVol::kBetweenScintAndSteel,
02608 FidVol::kMiddle,Munits::micrometer);
02609
02610 FidVol::find_z_cuts(17,84,8,240,255,452,
02611 FidVol::kDownstreamOfSteel,
02612 FidVol::kMiddle,Munits::micrometer);
02613
02614
02615 FidVol::find_z_cuts(13,68,3,239,252,464,
02616 FidVol::kDownstreamOfSteel,
02617 FidVol::kMiddle,Munits::micrometer);
02618 }
02619
02620
02621
02622 Bool_t NuCuts::IsGoodUVVtx(const NuEvent& nu) const
02623 {
02624 Float_t cutValue=5;
02625 if (false) {
02626 MAXMSG("NuCuts",Msg::kInfo,1)
02627 <<"Cutting on UV trk vtx<="<<cutValue<<endl;
02628 if (abs(nu.trkVtxUVDiffPl)<=cutValue) return true;
02629 else return false;
02630 }
02631 else if (nu.anaVersion==NuCuts::kCC0093Std ||
02632 nu.anaVersion==NuCuts::kCC0250Std ||
02633 nu.anaVersion==NuCuts::kJJE1 ||
02634 nu.anaVersion==NuCuts::kCC0325Std ||
02635 nu.anaVersion==NuCuts::kCC0720Std ||
02636 nu.anaVersion==NuCuts::kCC1070Std ||
02637 nu.anaVersion==NuCuts::kCC2014 ||
02638 nu.anaVersion==NuCuts::kCC2014NewCoilCut ||
02639 nu.anaVersion==NuCuts::kCC0720Test ||
02640 nu.anaVersion==NuCuts::kNSI2011Fhc ||
02641 nu.anaVersion==NuCuts::kJJH1 || IsNMB(nu) ) {
02642 MAXMSG("NuCuts",Msg::kInfo,1)
02643 <<"Not cutting on UV trk vtx"<<endl;
02644 return true;
02645 }
02646 else {
02647 MAXMSG("NuCuts",Msg::kInfo,1)
02648 <<"Cutting on UV trk vtx<="<<cutValue<<endl;
02649 if (abs(nu.trkVtxUVDiffPl)<=cutValue) return true;
02650 else return false;
02651 }
02652 }
02653
02654
02655
02656
02657
02658
02659
02660
02661
02662
02663
02664
02665
02666
02667
02668
02669
02670
02671
02672
02673
02674
02675
02676
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716
02717
02718
02719
02720
02721
02722
02723
02724
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741
02742
02743
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763
02764
02765
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791
02792
02794
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805
02806
02807
02808
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836
02837
02839
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850
02851
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861
02862
02863
02864
02865
02866
02867
02868
02869
02870
02871
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884
02885
02886
02887
02888
02889
02890
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907
02908
02909
02910
02911
02912
02913
02914
02915
02916
02917
02918
02919
02920
02921
02922
02923
02924
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943 void NuCuts::CalcTotalPot(Float_t& totalPotHist,
02944 Float_t& totalPotBadHist) const
02945 {
02946
02947 TH1F* hPottortgt=dynamic_cast<TH1F*>(gROOT->FindObject("hPottortgt"));
02948 TH1F* hPotBadtortgt=
02949 dynamic_cast<TH1F*>(gROOT->FindObject("hPotBadtortgt"));
02950
02951 if (hPottortgt && hPotBadtortgt) {
02952
02953
02954
02955 for (Int_t i=0;i<hPotBadtortgt->GetNbinsX();i++) {
02956 Float_t num=hPottortgt->GetBinContent(i);
02957 Float_t val=hPottortgt->GetBinLowEdge(i);
02958 val+=hPottortgt->GetBinWidth(i)/2.;
02959 Float_t sum=num*val;
02960 if (sum<0) {
02961 MAXMSG("NuCuts",Msg::kInfo,10)
02962 <<"sum<0, sum="<<sum
02963 <<", num="<<num
02964 <<", val="<<val<<endl;
02965 sum=0;
02966 }
02967 totalPotHist+=sum;
02968
02969 Float_t numBad=hPotBadtortgt->GetBinContent(i);
02970 Float_t valBad=hPotBadtortgt->GetBinLowEdge(i);
02971 valBad+=hPotBadtortgt->GetBinWidth(i)/2.;
02972 Float_t sumBad=numBad*valBad;
02973 if (sumBad<0) {
02974 MAXMSG("NuCuts",Msg::kInfo,10)
02975 <<"sumBad<0, sumBad="<<sumBad
02976 <<", num="<<numBad
02977 <<", val="<<valBad<<endl;
02978 sumBad=0;
02979 }
02980 totalPotBadHist+=sumBad;
02981
02982 MSG("NuCuts",Msg::kDebug)
02983 <<"i="<<i<<", Good: num="<<num
02984 <<", val="<<val<<", sum="<<sum
02985 <<", totalPot="<<totalPotHist<<endl;
02986
02987 MSG("NuCuts",Msg::kDebug)
02988 <<"i="<<i<<", Bad: num="<<numBad
02989 <<", val="<<valBad<<", sum="<<sumBad
02990 <<", totalPotBad="<<totalPotBadHist<<endl;
02991 }
02992 }
02993 else cout<<"Can't find histograms to calc total POT"<<endl;
02994 }
02995
02996
02997
02998 void NuCuts::CheckTrackDirectionIsPositive(const NuEvent& nu) const
02999 {
03000 if (nu.planeTrkEnd-nu.planeTrkVtx<0) {
03001
03002
03003 MSG("NuAnalysis",Msg::kWarning)
03004 <<endl<<endl<<endl
03005 <<"Track direction wrong!!!, vtx plane="<<nu.planeTrkVtx
03006 <<", end plane="<<nu.planeTrkEnd
03007 <<endl<<endl<<endl<<endl;
03008 }
03009 }
03010
03011
03012
03013 const Char_t* NuCuts::AsString(NuAnaVersion_t v) const
03014 {
03015
03016 switch (v) {
03017 case kCC0093Std: return "Std CC 1.27e20 POT";
03018 case kJJH1: return "JJH NuMuBar";
03019 case kJJE1: return "JJE NuMuBar";
03020 case kJJE2: return "JJE thesis NuMuBar";
03021 case kCC0250Std: return "Std CC 2.50e20 POT";
03022 case kCC0325Std: return "Std CC 3.25e20 POT";
03023 case kCC0720Test: return "Std CC (with JMCUTS) for 2010 analysis";
03024 case kFullDST: return "Full DST w/ loose cuts";
03025 case kMSRock: return "Matt Straits Ely2009 Rock muon selection";
03026 case kCC0720Std: return "Std CC 7.20e20 POT";
03027 case kCC1070Std: return "Std CC 9.70e20 POT";
03028 case kCC2014: return "Std CC MINOS+";
03029 case kCC2014NewCoilCut: return "Std CC MINOS+ No Coil Cut";
03030 case kNSI2011Fhc: return "NSI FHC";
03031 case kPreselectionNC2012: return "NC PRL Preselection";
03032 case kNCPRLNC: return "NC PRL NC selector";
03033 case kNCPRLCC: return "NC PRL CC selector";
03034 case kUnknown: return "Unknown"; break;
03035 default: return "!?Bad Value Passed?!"; break;
03036 }
03037 }
03038
03039
03040
03041 Double_t NuCuts::FiducialMass(const NuEvent& nu) const
03042 {
03043 return this->FiducialMass(nu.detector,nu.simFlag,nu.anaVersion);
03044 }
03045
03046
03047
03048 Double_t NuCuts::FiducialMass(const Int_t detector,
03049 const Int_t simFlag,
03050 const Int_t anaVersion) const
03051 {
03052 if (detector == Detector::kNear){
03053 if (anaVersion==NuCuts::kJJH1 ||
03054 anaVersion==NuCuts::kJJE1 ||
03055 anaVersion==NuCuts::kJJE2 ||
03056 anaVersion == NuCuts::kCC0325Std ||
03057 anaVersion == NuCuts::kCC0720Std ||
03058 anaVersion == NuCuts::kCC1070Std ||
03059 anaVersion == NuCuts::kCC2014 ||
03060 anaVersion == NuCuts::kCC2014NewCoilCut ||
03061 anaVersion == NuCuts::kNSI2011Fhc ||
03062 anaVersion == NuCuts::kNMB0325Alpha ||
03063 anaVersion == NuCuts::kNMB0325Bravo ||
03064 anaVersion == NuCuts::kNMB0325BravoTwo ||
03065 anaVersion == NuCuts::kNMB0325Charlie ||
03066 anaVersion == NuCuts::kNMB0325Delta ||
03067 anaVersion == NuCuts::kNMB0325Echo ||
03068 anaVersion == NuCuts::kRM1 ||
03069 anaVersion == NuCuts::kRM2 ||
03070 anaVersion == NuCuts::kNMB0720RM ||
03071 anaVersion == NuCuts::kNMBFree ||
03072 anaVersion == NuCuts::kRHC){
03073
03074 if (simFlag==SimFlag::kData) return 23.7217*
03075 Munits::tonne;
03076 else if (simFlag==SimFlag::kMC) return 23.4989*
03077 Munits::tonne;
03078 else {
03079 cout<<"Ahhhh simFlag="<<simFlag<<endl;
03080 return -1;
03081 }
03082 }
03083 else if (anaVersion == NuCuts::kCC0093Std){
03084 return -1.0;
03085 }
03086 else if (anaVersion == NuCuts::kCC0250Std){
03087 return 44.66068761*Munits::tonne;
03088 }
03089 else {
03090
03091 return -1.0;
03092 }
03093 }
03094 else if (detector == Detector::kFar){
03095 if (anaVersion==NuCuts::kJJH1 ||
03096 anaVersion==NuCuts::kJJE1 ||
03097 anaVersion==NuCuts::kJJE2 ||
03098 anaVersion == NuCuts::kCC0325Std ||
03099 anaVersion == NuCuts::kCC0720Std ||
03100 anaVersion == NuCuts::kCC1070Std ||
03101 anaVersion == NuCuts::kCC2014 ||
03102 anaVersion == NuCuts::kCC2014NewCoilCut ||
03103 anaVersion == NuCuts::kCC0720Test ||
03104 anaVersion==NuCuts::kNSI2011Fhc ||
03105 anaVersion == NuCuts::kNMB0325Alpha ||
03106 anaVersion == NuCuts::kNMB0325Bravo ||
03107 anaVersion == NuCuts::kNMB0325BravoTwo ||
03108 anaVersion == NuCuts::kNMB0325Charlie ||
03109 anaVersion == NuCuts::kNMB0325Delta ||
03110 anaVersion == NuCuts::kNMB0325Echo ||
03111 anaVersion == NuCuts::kRM1 ||
03112 anaVersion == NuCuts::kRM2 ||
03113 anaVersion == NuCuts::kNMB0720RM ||
03114 anaVersion == NuCuts::kNMBFree ||
03115 anaVersion == NuCuts::kRHC) {
03116
03117 if (simFlag==SimFlag::kData) return 4.17235*
03118 Munits::kilotonne;
03119 else if (simFlag==SimFlag::kMC) return 4.13923*
03120 Munits::kilotonne;
03121 else {
03122 cout<<"Ahhhh simFlag="<<simFlag<<endl;
03123 return -1;
03124 }
03125 }
03126 else if (anaVersion == NuCuts::kCC0093Std){
03127 return -1.0;
03128 }
03129 else if (anaVersion == NuCuts::kCC0250Std){
03130 return 4.164776186*Munits::kilotonne;
03131
03132 }
03133 else {
03134
03135 return -1.0;
03136 }
03137 }
03138 else{
03139 MAXMSG("NuCuts",Msg::kWarning,5)
03140 << "Bad detector: returning 0 fiducial mass." << endl;
03141 return 0;
03142 }
03143 }
03144
03145
03146 Bool_t NuCuts::FreeCuts(const NuEvent& nu, const NuXMLConfig* xmlConfig)const{
03147 if(nu.roID<=xmlConfig->RoID()||
03148 nu.jmID<=xmlConfig->JmID()||
03149 nu.jmEventknnID <= xmlConfig->NtID()||
03150 nu.dpID<=xmlConfig->DpID() ||
03151 nu.poIDKin<=xmlConfig->PoKIN() ||
03152 fabs(1./nu.sigqp_qp)<=xmlConfig->Sigqp() ||
03153 fabs(nu.relativeAngle - TMath::Pi())<= xmlConfig->RelativeAngle() ||
03154 nu.trkLength<=xmlConfig->TrackLength() ||
03155 nu.prob<=xmlConfig->Trkpro() ||
03156 nu.smoothMajC<=xmlConfig->MajorityCurvature())
03157 {
03158 MSG("NuCuts",Msg::kInfo)
03159 <<"Inside free cuts true"<<endl;
03160 return false;}
03161 else
03162 {MSG("NuCuts",Msg::kInfo)
03163 <<"Inside free cuts false"<<endl;
03164 return true;}
03165 }
03166
03167
03168
03169 Bool_t NuCuts::IsGoodCosPr(const NuEvent& nu) const
03170 {
03171 if (nu.anaVersion==NuCuts::kMSRock) {
03172
03173 MAXMSG("NuCuts",Msg::kInfo,1)
03174 <<"Making Cut: IsGoodCosPr < -0.2" << endl;
03175 if (nu.cosPrTrkVtx >= -0.2) return false;
03176 }
03177
03178 return true;
03179 }
03180
03181
03182
03183 Bool_t NuCuts::IsGoodTrackDr(const NuEvent& nu) const
03184 {
03185 if (nu.anaVersion==NuCuts::kMSRock) {
03186 MAXMSG("NuCuts",Msg::kInfo,1)
03187 <<"Making Cut: IsGoodTrackDr < 0.06" << endl;
03188
03189
03190 if (nu.drTrkFidvtx >= 0.06) return false;
03191 }
03192
03193 return true;
03194 }
03195
03196
03197
03198 Bool_t NuCuts::IsGoodNearShowerEn(const NuEvent& nu) const
03199 {
03200 if (nu.anaVersion==NuCuts::kMSRock) {
03201 MAXMSG("NuCuts",Msg::kInfo,1)
03202 <<"Making Cut: IsGoodNearshowerEnergy < 0.5" << endl;
03203
03204
03205 if (nu.trkShwEnNear >= 0.5) return false;
03206 }
03207
03208 return true;
03209 }
03210
03211
03212
03213 Bool_t NuCuts::GoodTimeToNearestSpill(const NuEvent &nu, Double_t lower_us, Double_t upper_us)
03214 {
03215
03216 lower_us *= (Munits::microsecond);
03217 upper_us *= (Munits::microsecond);
03218
03219 if (nu.timeEvtMin-nu.timeToNearestSpill>lower_us &&
03220 nu.timeEvtMin-nu.timeToNearestSpill<upper_us) {
03221 return true;
03222 }
03223 else return false;
03224
03225 }