NuCutImps::Preselection2010 Class Reference

#include <NuCutImps.h>

Inheritance diagram for NuCutImps::Preselection2010:
NuCut

List of all members.

Public Member Functions

 Preselection2010 (const NuPlots *plots=0)
void Preselection (const NuEvent &nu)
void Selection (const NuEvent &nu)

Private Member Functions

Bool_t InFidVol (const NuEvent &nu) const

Private Attributes

Int_t fCoilDir
 +ve -> expect !coilIsReverse. 0 -> not initialized
Int_t fBeamType

Detailed Description

Definition at line 22 of file NuCutImps.h.


Constructor & Destructor Documentation

NuCutImps::Preselection2010::Preselection2010 ( const NuPlots plots = 0  ) 

Definition at line 631 of file NuCutImps.cxx.

References NuCuts::kCC0720Std, NuCut::SetAnaVersion(), and NuCut::SetFidVol().

00631                                                          :
00632     NuCut("Preselection2010", plots), fCoilDir(0), fBeamType(0)
00633   {
00634     SetFidVol("cc2008");
00635     SetAnaVersion(NuCuts::kCC0720Std);
00636   }


Member Function Documentation

Bool_t NuCutImps::Preselection2010::InFidVol ( const NuEvent nu  )  const [private, virtual]

Fiducial volume calculation function. This is the basic 'infid' derived version, and should be overridden/passed to for any more complicated evaluations.

Reimplemented from NuCut.

Definition at line 638 of file NuCutImps.cxx.

References NuCut::InFidVolEvt(), Munits::m, NuEvent::nplaneShw, NuEvent::ntrk, NuEvent::trknplane, and NuEvent::zTrkVtx.

Referenced by Preselection().

00639   {
00640     //had to duplicate the code here
00641     //if the definitions of the CC0720Std or NC0720Std fidvols ever
00642     //change then that must be replicated here
00643     Bool_t inCC=false;
00644     Bool_t inNC=false;
00645 
00647     //cc fidvol cut version
00649     if (nu.ntrk > 0){
00650       // Move trk vtx upstream by 3.92cm from scintillator to steel
00651       // for this analysis version
00652       NuEvent nuc = nu;
00653       nuc.zTrkVtx = nu.zTrkVtx - (0.0392*Munits::m);
00654 
00655       inCC=NuCut::InFidVol(nuc);
00656     }
00657 
00659     //nc fidvol cut version
00661     // If there's a track and it's longer than the shower then use its
00662     // vertex, otherwise use the event vertex. This is what is done in
00663     // the NC analysis.
00664     if(nu.ntrk > 0 && nu.trknplane > nu.nplaneShw){
00665       // Move trk vtx upstream by 3.92cm from scintillator to steel
00666       NuEvent nuc = nu;
00667       nuc.zTrkVtx = nu.zTrkVtx - (0.0392*Munits::m);
00668       inNC=NuCut::InFidVol(nuc);
00669     }
00670     else inNC=NuCut::InFidVolEvt(nu);
00671 
00672     return inCC || inNC;
00673   }

void NuCutImps::Preselection2010::Preselection ( const NuEvent nu  )  [virtual]

Implements NuCut.

Definition at line 676 of file NuCutImps.cxx.

References bfld::AsString(), NuEvent::beamTypeDB, NuEvent::coilIsOk, NuEvent::coilIsReverse, NuCut::Cut_If(), NuEvent::cutOnDataQuality, NuEvent::cutOnSpillTiming, NuEvent::detector, fBeamType, fCoilDir, NuEvent::goodBeam, NuEvent::goodBeamSntp, NuCuts::GoodTimeToNearestSpill(), InFidVol(), NuEvent::isGoodDataQuality, NuEvent::isLI, SimFlag::kData, NuCut::Keep_Data_If(), NuCut::Keep_If(), Msg::kError, Detector::kFar, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, Detector::kNear, Msg::kWarning, NuEvent::litime, MAXMSG, MSG, NuEvent::run, NuEvent::simFlag, NuEvent::snarl, and NuEvent::subRun.

00677   {
00678     //The pot counting cuts on 3 variables to ensure only good spills
00679     //are included:
00680     // - beam quality
00681     // - coil quality
00682     // - detector data quality
00683     //the exact same variables have to be cut on here to be consistent
00684 
00685     Bool_t goodBeamToUse = nu.goodBeamSntp;
00686     if (Detector::kFar == nu.detector &&
00687         SimFlag::kData == nu.simFlag){
00688       goodBeamToUse = nu.goodBeam;
00689     }
00690 
00691     //only accept events where the beam hit the target well
00692     Keep_Data_If(goodBeamToUse, nu,"GoodBeam");
00693 
00694     //Is the coil okay? Only cut if we have the cutOnDataQuality flag
00695     Keep_Data_If(nu.coilIsOk || !nu.cutOnDataQuality, nu, "CoilIsOkay");
00696 
00697     //Data Quality
00698     Keep_Data_If(nu.isGoodDataQuality ||
00699                 !nu.cutOnDataQuality, nu, "DataQuality");
00700 
00701     //Filter out LI events
00702     Cut_If(nu.isLI || nu.litime != -1, "IsLI");
00703 
00704     // Per-detector cuts
00705     if (nu.detector == Detector::kFar) {
00706       //Keep events in time with the beam spill
00707       //Use the standard -2, 12us cuts
00708       Keep_Data_If(NuCuts::GoodTimeToNearestSpill(nu, -2, +12) ||
00709                   !nu.cutOnSpillTiming, nu, "SpillTime");
00710     }
00711     else if (nu.detector == Detector::kNear) {
00712       //only run the fidvol cut for the ND
00713       //since we want the RAF events at the FD
00714       Keep_If(this->InFidVol(nu),"InFidVolCCOrNC");
00715     } // End of per-detector cuts
00716 
00717     //Now do some sanity checks
00718     //files must never mix data where
00719     //- detector coil is not always the same direction
00720     //- beam type is not always the same
00721     //NOTE: for the FD data, the pot counting is less of an issue
00722     //the crucial thing is that the value of pot used was obtained
00723     //using the same cuts as are applied here
00724 
00725     if (nu.coilIsOk){
00726       //store the coil direction on the first ("good") event
00727       if (fCoilDir == 0) {
00728         if (nu.coilIsReverse) fCoilDir = -1;
00729         else fCoilDir = +1;
00730       }
00731 
00732       //check that the coil current direction is the same as first event
00733       //can't just cut it out because then the POT count will be wrong
00734       if (!((fCoilDir < 0 && nu.coilIsReverse) ||
00735             (fCoilDir > 0 && !nu.coilIsReverse)))
00736       {
00737         if (nu.detector==Detector::kNear){
00738           MAXMSG("NuCutImps",Msg::kError,100)
00739             <<"Seeing mixed coil current: fCoilDir="<<fCoilDir
00740             <<", coilIsReverse="<<nu.coilIsReverse
00741             <<", coilIsOk="<<nu.coilIsOk
00742             <<", goodBeamSntp="<<nu.goodBeamSntp
00743             <<", goodBeam="<<nu.goodBeam
00744             <<", goodBeamToUse="<<goodBeamToUse
00745             <<", isGoodDataQuality="<<nu.isGoodDataQuality
00746             <<", run="<<nu.run<<", subRun="<<nu.subRun
00747             <<", snarl="<<nu.snarl
00748             <<endl;
00749           assert((fCoilDir < 0 && nu.coilIsReverse) ||
00750                  (fCoilDir > 0 && !nu.coilIsReverse));
00751         }
00752         else if (nu.detector==Detector::kFar) {
00753           //want to print out every single one of these warnings!
00754           MSG("NuCutImps",Msg::kWarning)
00755             <<"Seeing mixed coil current: fCoilDir="<<fCoilDir
00756             <<", coilIsReverse="<<nu.coilIsReverse
00757             <<", coilIsOk="<<nu.coilIsOk
00758             <<", goodBeamSntp="<<nu.goodBeamSntp
00759             <<", goodBeam="<<nu.goodBeam
00760             <<", goodBeamToUse="<<goodBeamToUse
00761             <<", isGoodDataQuality="<<nu.isGoodDataQuality
00762             <<", run="<<nu.run<<", subRun="<<nu.subRun
00763             <<", snarl="<<nu.snarl
00764             <<endl;
00765         }
00766         else {
00767           cout<<"Ahhh, detector not known..."<<endl;
00768         }
00769       }
00770     }
00771 
00772     if (goodBeamToUse){
00773       //store the beam type on the first ("good") event
00774       if (fBeamType==0) {
00775       //treat the special horn current runs as std le-10
00776       if (nu.beamTypeDB == BeamType::kL010z170i ||
00777           nu.beamTypeDB == BeamType::kL010z200i) {
00778         fBeamType = BeamType::kL010z185i;
00779       }
00780       else fBeamType=nu.beamTypeDB;
00781     }
00782 
00783       //count the number of mixed beam types in a row
00784       static Int_t errorCounterBeamType=0;
00785       if (nu.beamTypeDB==fBeamType) errorCounterBeamType=0;
00786 
00787       //assert on the beam type being the same as the first event
00788       if (nu.beamTypeDB != fBeamType) {
00789         if ((nu.beamTypeDB == BeamType::kL010z170i ||
00790              nu.beamTypeDB == BeamType::kL010z200i)
00791             && fBeamType==BeamType::kL010z185i)
00792         {
00793             //don't assert on the special horn current runs
00794             //these beam types are ok
00795 
00796             //reset the mixed beam type counter
00797             errorCounterBeamType=0;
00798         } else {
00799           if (nu.detector==Detector::kNear){
00800             //count the number of sequential events with mixed beam type
00801             errorCounterBeamType++;
00802 
00803             //check if the number of sequential mixed beam type
00804             //events is greater than the upper limit
00805             Int_t upperLimit=10;
00806             if (errorCounterBeamType>upperLimit) {
00807               MAXMSG("NuCutImps",Msg::kError,100)
00808                 <<"Seeing mixed beam: fBeamType="<<fBeamType
00809                 << "(" << BeamType::AsString(BeamType::BeamType_t(fBeamType))
00810                 <<"), beamTypeDB="<<nu.beamTypeDB
00811                 << "(" << BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
00812                 <<"), goodBeamSntp="<<nu.goodBeamSntp
00813                 <<", goodBeam="<<nu.goodBeam
00814                 <<", goodBeamToUse="<<goodBeamToUse
00815                 <<", coilIsOk="<<nu.coilIsOk
00816                 <<", coilIsReverse="<<nu.coilIsReverse
00817                 <<", isGoodDataQuality="<<nu.isGoodDataQuality
00818                 <<", run="<<nu.run<<", subRun="<<nu.subRun
00819                 <<", snarl="<<nu.snarl
00820                 <<endl;
00821               MSG("NuCutImps",Msg::kError)
00822                 <<"Asserting on mixed beam "
00823                 <<" when we get more than "<<upperLimit<<" events with"
00824                 <<" mixed beam in a row"
00825                 <<", errorCounterBeamType="<<errorCounterBeamType
00826                 <<endl;
00827               assert(nu.beamTypeDB==fBeamType);
00828             }
00829             else {
00830               MSG("NuCutImps",Msg::kWarning)
00831                 <<"Not asserting on mixed beam until"
00832                 <<" we get more than "<<upperLimit<<" events with"
00833                 <<" mixed beam in a row"
00834                 <<", errorCounterBeamType="<<errorCounterBeamType
00835                 <<", fBeamType="<<fBeamType
00836                 <<"(" << BeamType::AsString(BeamType::BeamType_t(fBeamType))
00837                 <<"), beamTypeDB="<<nu.beamTypeDB
00838                 <<"(" << BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
00839                 <<"), goodBeamSntp="<<nu.goodBeamSntp
00840                 <<", goodBeam="<<nu.goodBeam
00841                 <<", goodBeamToUse="<<goodBeamToUse
00842                 <<", coilIsOk="<<nu.coilIsOk
00843                 <<", coilIsReverse="<<nu.coilIsReverse
00844                 <<", isGoodDataQuality="<<nu.isGoodDataQuality
00845                 <<", run="<<nu.run<<", subRun="<<nu.subRun
00846                 <<", snarl="<<nu.snarl
00847                 <<endl;
00848             }
00849           }
00850           else if (nu.detector==Detector::kFar) {
00851             //want to print out every single one of these warnings!
00852             MSG("NuCutImps",Msg::kWarning)
00853               <<"Seeing mixed beam: fBeamType="<<fBeamType
00854               <<"(" << BeamType::AsString(BeamType::BeamType_t(fBeamType))
00855               <<"), beamTypeDB="<<nu.beamTypeDB
00856               <<"(" << BeamType::AsString(BeamType::BeamType_t(nu.beamTypeDB))
00857               <<"), goodBeamSntp="<<nu.goodBeamSntp
00858               <<", goodBeam="<<nu.goodBeam
00859               <<", goodBeamToUse="<<goodBeamToUse
00860               <<", coilIsOk="<<nu.coilIsOk
00861               <<", coilIsReverse="<<nu.coilIsReverse
00862               <<", isGoodDataQuality="<<nu.isGoodDataQuality
00863               <<", run="<<nu.run<<", subRun="<<nu.subRun
00864               <<", snarl="<<nu.snarl
00865               <<endl;
00866           }
00867           else {
00868             cout<<"Ahhh, detector not known..."<<endl;
00869           }
00870         }
00871       }
00872     }
00873   }

void NuCutImps::Preselection2010::Selection ( const NuEvent nu  )  [virtual]

Implements NuCut.

Definition at line 876 of file NuCutImps.cxx.

00877   {
00878     // Since this is a preselection only class, we have no selection
00879   }


Member Data Documentation

Definition at line 33 of file NuCutImps.h.

Referenced by Preselection().

+ve -> expect !coilIsReverse. 0 -> not initialized

Definition at line 32 of file NuCutImps.h.

Referenced by Preselection().


The documentation for this class was generated from the following files:

Generated on 16 Jan 2018 for loon by  doxygen 1.6.1