NueModule Class Reference

#include <NueModule.h>

Inheritance diagram for NueModule:

JobCModule List of all members.

Public Member Functions

 NueModule ()
 ~NueModule ()
JobCResult Reco (MomNavigator *mom)
JobCResult Analyze (MomNavigator *mom, NtpStRecord *str, NtpMRRecord *mr, UberRecord *ur, NtpStRecord *oldst)
void BeginJob ()
void EndJob ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
void LoadBeamSummaryData (const char *bd)
void SetMRCCRunning (bool val=true)
BeamType::BeamType_t DetermineBeamType (VldContext vc)
BeamType::BeamType_t DetermineBeamType (string file)

Private Member Functions

bool PassesBlindingCuts (NueRecord *nr)

Private Attributes

std::string tmpltfile
std::string beamstring
NueAnalysisCuts fCut
Int_t kDPlaneCut
Int_t kLoPhNStripCut
Int_t kLoPhNPlaneCut
Float_t kPhStripCut
Float_t kPhPlaneCut
Float_t kCPhPlaneCut
BeamType::BeamType_t kBeamType
string kMuPiDir
bool kFixMuParents
bool kOpenedMuPiFile
int counter
int passcounter
int passcutcounter
int failcounter
int writecounter
bool foundmeu
float MSTminsig
float MSTmaxmetric
float MSTminfarsig
float MSTmaxmetriclowz
float SIGMAPMEU
TProfile2D * MSTetemplate
TProfile2D * MSTbtemplate
TProfile2D * MSTemtemplate
TProfile2D * MSTbmtemplate
Double_t threshCut
std::string sasFileName
float pot
float MEUPERGEV
bool foundRelease
int release
string skzpcfg
string title
string filename
bool mrccRun
MuParentHelpermupar
Zbeamzbeam
Zflukzfluk
Kflukkfluk
SKZPWeightCalculatorskzpCalc
MCReweightmcr
Registryxsecreweightreg
string kPidName
double kPIDHighCut
double kPIDLowCut
double kCCPIDCut
double kHighECut
double kLowECut
string kCCPidName

Detailed Description

Definition at line 32 of file NueModule.h.


Constructor & Destructor Documentation

NueModule::NueModule (  ) 

Definition at line 61 of file NueModule.cxx.

References Registry::Clear(), MCReweight::Instance(), kCCPIDCut, ANtpDefaultValue::kDouble, kFixMuParents, kfluk, kHighECut, kLowECut, kPIDHighCut, kPIDLowCut, kPidName, Registry::LockKeys(), Registry::LockValues(), mcr, mrccRun, mupar, Registry::Registry(), skzpCalc, skzpcfg, Registry::UnLockKeys(), Registry::UnLockValues(), xsecreweightreg, zbeam, and zfluk.

00061                     :
00062    tmpltfile(""),
00063    kDPlaneCut(-1),
00064    kLoPhNStripCut(-1),
00065    kLoPhNPlaneCut(-1),
00066    kPhStripCut(-1),
00067    kPhPlaneCut(-1),
00068    kCPhPlaneCut(-1),
00069    kBeamType(BeamType::kUnknown),
00070    kMuPiDir(""),
00071    kOpenedMuPiFile(false),
00072    counter(0),
00073    passcounter(0),
00074    passcutcounter(0),
00075    failcounter(0),
00076    writecounter(0),
00077    foundmeu(false),
00078    MSTminsig(0.),
00079    MSTmaxmetric(0.),
00080    MSTminfarsig(0.),
00081    MSTmaxmetriclowz(0.),
00082    SIGMAPMEU(1.),
00083    MSTetemplate(0),
00084    MSTbtemplate(0),
00085    MSTemtemplate(0),
00086    MSTbmtemplate(0),
00087    threshCut(0.),
00088    sasFileName(""),
00089    pot(0.),
00090    MEUPERGEV(25),   //not correct but close, correctly set by NueCalibration
00091                     //  adjusted on 01-08-2008 by JAB
00092    foundRelease(false),
00093    release(0),
00094    //   skzpcfg("PiMinus_CedarDaikon")
00095    skzpcfg("DetXs")
00096 {
00097 
00098 //make sure that pointers that have objects deleted at end are initialized at 0 to start
00099   mupar=0;
00100   zbeam=0;
00101   skzpCalc=0;
00102   zfluk=0;
00103   kfluk=0;
00104 //end ptr initilization
00105 
00106 
00107   if(kFixMuParents){
00108     mupar = new MuParentHelper();
00109   }
00110   else{
00111     mupar=0;
00112   }
00113 //  zbeam = new Zbeam();
00114 //  zfluk = new Zfluk();
00115 //  zfluk->UseParameterization("SKZP"); //this is the default
00116 //  kfluk = new Kfluk();
00117   kfluk = 0;
00118 
00119   skzpCalc = new SKZPWeightCalculator(skzpcfg, true);
00120   mcr = &MCReweight::Instance();
00121   //  NeugenWeightCalculator *n=new NeugenWeightCalculator();
00122   //  mcr->AddWeightCalculator(n);
00123 
00124   xsecreweightreg = new Registry();
00125   xsecreweightreg->UnLockValues();
00126   xsecreweightreg->UnLockKeys();
00127   xsecreweightreg->Clear();
00128   //  xsecreweightreg->Set("neugen:config_name","MODBYRS");
00129   //  xsecreweightreg->Set("neugen:config_no",3);
00130   xsecreweightreg->LockValues();
00131   xsecreweightreg->LockKeys();
00132 
00133   mrccRun = false;
00134   
00135   kPidName = "None";
00136   kPIDHighCut = ANtpDefVal::kDouble;
00137   kPIDLowCut = ANtpDefVal::kDouble;
00138   kCCPIDCut = ANtpDefVal::kDouble;
00139   kHighECut = ANtpDefVal::kDouble;
00140   kLowECut = ANtpDefVal::kDouble;
00141 }

NueModule::~NueModule (  ) 

Definition at line 145 of file NueModule.cxx.

References kfluk, mupar, skzpCalc, zbeam, and zfluk.

00146 {
00147   if(mupar){
00148     delete mupar;
00149     mupar=0;
00150   }
00151   if(zbeam){
00152     delete zbeam;
00153     zbeam=0;
00154   }
00155 
00156   if(skzpCalc){
00157     delete skzpCalc;
00158     skzpCalc=0;
00159   }
00160   if(zfluk){
00161     delete zfluk;
00162     zfluk=0;
00163   }
00164   if(kfluk){
00165     delete kfluk;
00166     kfluk=0;
00167   }
00168 }


Member Function Documentation

JobCResult NueModule::Analyze ( MomNavigator mom,
NtpStRecord str,
NtpMRRecord mr,
UberRecord ur,
NtpStRecord oldst 
)

Definition at line 291 of file NueModule.cxx.

References MomNavigator::AdoptFragment(), NueRecordAna::Analyze(), EventQualAna::Analyze(), ANtpEventInfoAna::Analyze(), NueRecordAna::aneia, NueRecordAna::ansia, NueRecordAna::antia, NtpMREvent::best_complete, DetermineBeamType(), NueRecordAna::equala, NtpStRecord::evthdr, failcounter, fCut, NueRecordAna::fiana, filename, SntpHelpers::FillEventEnergy(), NueRecordAna::FillReco(), NueRecordAna::FillTrue(), NtpVtxFinder::FindVertex(), MCFluxInfoAna::FixMuParents(), NueRecordAna::fva, SntpHelpers::GetEvent(), RecRecordImp< T >::GetHeader(), SntpHelpers::GetMREvent(), MINFHeader::GetRun(), SntpHelpers::GetTrack(), SntpHelpers::GetTrackIndex(), RecHeader::GetVldContext(), NueRecordAna::hca, header, Anp::Factory< T >::Instance(), ReleaseType::IsCarrot(), ReleaseType::IsCedar(), ReleaseType::IsData(), kBeamType, kCPhPlaneCut, SimFlag::kData, Msg::kDebug, kDPlaneCut, Msg::kError, kFixMuParents, kfluk, NueConvention::kHydra, BeamType::kL010z000i, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, kMuPiDir, kOpenedMuPiFile, JobCResult::kPassed, kPhPlaneCut, kPhStripCut, Msg::kWarning, MAXMSG, mcr, NueRecordAna::mda, MEUPERGEV, NtpMRRecord::mrhdr, MSG, NueRecordAna::msta, MSTbmtemplate, MSTbtemplate, MSTemtemplate, MSTetemplate, MSTmaxmetric, MSTmaxmetriclowz, MSTminfarsig, MSTminsig, mupar, NtpSRPlane::n, NtpSREventSummary::nevent, NtpMRSummary::nmrevt, NtpSREvent::ntrack, NueConvention::nue, NueRecordAna::nuefwa, NueRecordAna::nuexsa, passcutcounter, NueAnalysisCuts::PassesAllCuts(), NtpSRTrack::plane, release, sasFileName, NueRecordAna::SetBeamType(), NueHeader::SetBeamType(), MSTCalcAna::SetBGMIPTemplate(), MSTCalcAna::SetBGTemplate(), ShwfitAna::SetCutParams(), NueRecordAna::SetEventEnergyArray(), NueHeader::SetEventNo(), NueHeader::SetEvents(), MuParentHelper::SetFileDir(), NueHeader::SetFoundBits(), NueAnalysisCuts::SetInfoObject(), NueFluxWeightsAna::SetKfluk(), NueXsecWeightAna::SetMCReweight(), MdaDiscrimAna::SetMdaParams(), MSTCalcAna::SetMSTParams(), MCFluxInfoAna::SetMuParentHelper(), NueHeader::SetNueRelease(), NueAnaBase::SetParams(), NueXsecWeightAna::SetRegistry(), NueRecordAna::SetRelease(), NueHeader::SetRelease(), NueHeader::SetRun(), MSTCalcAna::SetSigMIPTemplate(), MSTCalcAna::SetSigTemplate(), NueFluxWeightsAna::SetSKZPCalc(), NueHeader::SetSnarl(), NueHeader::SetSubRun(), NtpVtxFinder::SetTargetEvent(), NueHeader::SetTrackLength(), NueRecordAna::sfa, SIGMAPMEU, skzpCalc, skzpcfg, threshCut, title, Anp::Handle< T >::valid(), NtpVtxFinder::VtxPlane(), NtpVtxFinder::VtxT(), NtpVtxFinder::VtxU(), NtpVtxFinder::VtxV(), NtpVtxFinder::VtxX(), NtpVtxFinder::VtxY(), NtpVtxFinder::VtxZ(), writecounter, and xsecreweightreg.

Referenced by Reco().

00292 {
00293    bool foundSR=false;
00294    bool foundMC=false;
00295    bool foundTH=false;
00296    bool foundMR=false;
00297    bool foundUR=false;
00298 
00299    bool foundST=false;
00300    bool passesCuts = false;
00301 
00302   if(str) foundST = true;
00303   if(mr) foundMR = true;
00304   if(ur) foundUR = true;
00305 
00306 
00307   int evtn = 0;
00308   const RecCandHeader *header = 0;
00309   VldContext vc;
00310    
00311    if(foundST){ 
00312      vc=str->GetHeader().GetVldContext();
00313      evtn=str->evthdr.nevent;
00314      header = &(str->GetHeader());
00315    }
00316 
00317 //   if(!foundSR&&foundMC){
00318 //      vc = mc->GetHeader().GetVldContext();
00319 //      header = &(mc->GetHeader());
00320 //      evtn = 0;
00321 //   }
00322 
00323    if(foundSR){
00324 //     MSG("NueModule",Msg::kDebug)<<"Got SR from mom"<<endl;
00325 //     evtn=sr->evthdr.nevent;
00326 //     header = &(sr->GetHeader());
00327    }
00328 
00329    //if first event and we want to fix the Mu parents,
00330    // set the mupar file directory
00331    if(header->GetVldContext().GetSimFlag() == SimFlag::kData)
00332      kFixMuParents = 0;
00333 
00334    if(ReleaseType::IsData(release))
00335       kBeamType = DetermineBeamType(vc);
00336    else
00337       kBeamType = DetermineBeamType(filename);
00338 
00339    if(!kOpenedMuPiFile&&kFixMuParents && ReleaseType::IsCarrot(release)){
00340      string flxsfx="le010z185i";
00341      if(kBeamType==BeamType::kL010z185i){     flxsfx="le010z185i";  }
00342      else if(kBeamType==BeamType::kL100z200i){flxsfx="le100z200i";  }
00343      else if(kBeamType==BeamType::kL250z200i){flxsfx="le250z200i";  }
00344      else if(kBeamType==BeamType::kL150z200i){flxsfx="le150z200i";  }
00345      else if(kBeamType==BeamType::kL010z170i){flxsfx="le010z170i";  }
00346      else if(kBeamType==BeamType::kL010z200i){flxsfx="le010z200i";  }
00347      else if(kBeamType==BeamType::kL010z000i){flxsfx="le010z000i";  }
00348         
00349      string fullPath = kMuPiDir + flxsfx;
00350      mupar->SetFileDir(kMuPiDir,true);
00351      kOpenedMuPiFile=true;
00352    }
00353 
00354    MSG("NueModule",Msg::kDebug)<<"Events in this snarl: "<<evtn<<endl;
00355 
00356    if(ReleaseType::IsData(release))
00357       kBeamType = DetermineBeamType(vc);
00358 
00359 
00360    bool fUseROPID = true;
00361    //Loading up Rustems variables
00362    Anp::Handle<StorekNNData> data = Anp::Factory<StorekNNData>::Instance().Get("kNNData");
00363    if(!data.valid())
00364    {
00365       MAXMSG("NueModule", Msg::kError, 1)
00366           << "NueModule::Reco - Handle<StorekNNData> is invalid, assuming no Rustem variable to run" 
00367           << endl;
00368       fUseROPID = false;
00369    }
00370 
00371    if(fUseROPID){
00372      VldContext roVld = data->GetValidity();
00373      if(roVld != vc){
00374         MSG("NueModule", Msg::kError)
00375           << "NueModule::Reco - Validity sheer when trying to access Rustem's PID, assuming no Rustem variable to run"
00376           << endl;
00377         fUseROPID = false;
00378      }
00379    }           
00380    //int kzarkoBeamType = BeamType::ToZarko(kBeamType);
00381                                              
00382    if(evtn == 0)
00383    {
00384       NueHeader h(vc);
00385       h.SetSnarl(header->GetSnarl());
00386       h.SetRun(header->GetRun());
00387       h.SetSubRun(header->GetSubRun());
00388       h.SetEventNo(-1);
00389       h.SetEvents(0);
00390       h.SetTrackLength(0);
00391       h.SetRelease(release);
00392       h.SetBeamType(kBeamType);
00393       h.SetFoundBits(foundSR, foundMC || foundST, foundTH,foundMR);
00394 
00395      //make an ana_nue object
00396      NueRecord *nue = new NueRecord(h);
00397      //make a nuerecordana object
00398      NueRecordAna ana_nue(*nue);
00399      ana_nue.SetRelease(release);
00400      ana_nue.SetBeamType(kBeamType);
00401 
00402      nue->SetTitle(title.c_str());
00403      //fill the truth info
00404      //if it's data, we can also do beam mon analyze
00405      //  ana_nue.bmona.SetBeamSummary(bsum);
00406                                                                                 
00407      //must set the beam and parent helper to fill flux info
00408 //     ana_nue.anaia.SetBeam(kzarkoBeamType);
00409 //     ana_nue.nuefwa.SetBeam(kzarkoBeamType);
00410 //     ana_nue.anaia.SetBeam(kBeamType);
00411 //     ana_nue.nuefwa.SetBeam(kBeamType);
00412      ana_nue.nuefwa.SetSKZPCalc(skzpCalc, skzpcfg);
00413 //     ana_nue.nuefwa.SetZfluk(zfluk);
00414      ana_nue.nuefwa.SetKfluk(kfluk);
00415      ana_nue.fiana.SetMuParentHelper(mupar);
00416      ana_nue.fiana.FixMuParents(kFixMuParents);
00417                
00418      //set xsec registry and mcreweight to do xsec reweighting
00419      ana_nue.nuexsa.SetMCReweight(mcr);
00420      ana_nue.nuexsa.SetRegistry(xsecreweightreg);
00421      
00422      if(foundST)
00423        ana_nue.FillTrue(0,str);
00424 //     if(foundMC || foundSR)
00425 //       ana_nue.FillTrue(0,sr,mc,th);
00426 
00427      ana_nue.aneia.Analyze(-10,str);  //need to fill srevent to get quality
00428      ana_nue.equala.Analyze(-10, str);
00429                                                                                 
00430      //give the ana_nue object to mom, she'll write it to the file
00431      mom->AdoptFragment(nue);
00432      writecounter++;
00433      failcounter++;
00434      if(fUseROPID) data->Clear();
00435      return JobCResult::kPassed;
00436    }
00437 
00438    bool anypassed = false;
00439 
00440    //Correct all the vertex information 
00441    // because of the nearby event check this has to be done all at once 
00442    //  and seperate from the analysis loop
00443 
00444 
00445    if(ReleaseType::IsCedar(release)){
00446     for(int i = 0; i < evtn; i++){
00447       NtpSREvent *event = SntpHelpers::GetEvent(i,str);
00448       if(event == 0) continue;
00449 
00450       NtpVtxFinder vtxf;
00451       vtxf.SetTargetEvent(i, str);
00452       if(vtxf.FindVertex() > 0){
00453         event->vtx.x = vtxf.VtxX();
00454         event->vtx.y = vtxf.VtxY();
00455         event->vtx.z = vtxf.VtxZ();
00456         event->vtx.u = vtxf.VtxU();
00457         event->vtx.v = vtxf.VtxV();
00458         event->vtx.t = vtxf.VtxT();
00459         event->vtx.plane = vtxf.VtxPlane();
00460       }
00461     }
00462    }
00463 
00464   const int SIZE = (str->evthdr).nstrip;
00465   float* ph0 = new float[SIZE];
00466   float* ph1 = new float[SIZE];
00467 
00468   for(int i=0;i<evtn;i++){
00469      passesCuts = false;
00470 
00471      for(int k=0; k < SIZE; k++) { ph0[k] = ph1[k] = -1;}
00472 
00473      SntpHelpers::FillEventEnergy(ph0, ph1, i, str, SIZE);
00474 
00475      for(int k=0; k < SIZE; k++) { 
00476        //Protection for uncalibrated strips
00477        // no evidence they exist but still protected
00478        if(ph0[k] < 0) ph0[k] = 0;
00479        if(ph1[k] < 0) ph1[k] = 0;
00480      }
00481  
00482      //make a header
00483      NueHeader h(vc);
00484      
00485      //fill header info
00486      h.SetSnarl(header->GetSnarl());
00487      h.SetRun(header->GetRun());
00488      h.SetSubRun(header->GetSubRun());
00489      h.SetEventNo(i);
00490      h.SetEvents(evtn);
00491      h.SetRelease(release);
00492      h.SetNueRelease(NueConvention::kHydra);
00493      h.SetBeamType(kBeamType);
00494      h.SetFoundBits((foundSR || foundST), foundMC || foundST,
00495                     foundTH || foundST, foundMR);
00496 
00497      MSG("NueModule",Msg::kDebug)<<"Getting event "<<evtn<<endl;
00498      
00499      NtpSREvent *event = 0;
00500      if(foundST) event = SntpHelpers::GetEvent(i,str);
00501 //     if(foundSR) event = SntpHelpers::GetEvent(i,sr);
00502      
00503      //loop over tracks in this event, find longest
00504      int longtrack=0;
00505      if(event){
00506        for(int j=0;j<event->ntrack;j++){
00507            int tindex = SntpHelpers::GetTrackIndex(j,event);
00508            NtpSRTrack *track = 0;
00509            if(foundST) track = SntpHelpers::GetTrack(tindex,str);
00510 //           if(foundSR) track = SntpHelpers::GetTrack(tindex,sr);
00511            if(track && longtrack<track->plane.n){
00512               longtrack = track->plane.n;
00513            }
00514         }
00515      }
00516      
00517      h.SetTrackLength(longtrack);
00518      
00519      NueRecord *nue = new NueRecord(h);
00520      //make a nuerecordana object
00521      NueRecordAna ana_nue(*nue);
00522      ana_nue.SetRelease(release);
00523      ana_nue.SetBeamType(kBeamType);
00524      ana_nue.SetEventEnergyArray(ph0, ph1);
00525 
00526      nue->SetTitle(title.c_str());
00527 
00528      
00529      if(foundST && event != 0)
00530      {                   
00531         fCut.SetInfoObject(i, str);
00532         passesCuts = fCut.PassesAllCuts();
00533      }
00534 
00535      if(foundSR && event != 0)
00536      {
00537        passesCuts = true;
00538        MSG("NueModule",Msg::kWarning)
00539           <<"Unable to cut on pre-Birch files - why are you running these files?"<<endl;
00540      }
00541      
00542      ana_nue.aneia.SetParams(SIGMAPMEU, MEUPERGEV);
00543      ana_nue.ansia.SetParams(SIGMAPMEU, MEUPERGEV);
00544      ana_nue.antia.SetParams(SIGMAPMEU, MEUPERGEV);
00545      ana_nue.hca.SetParams(SIGMAPMEU, MEUPERGEV);
00546 
00547      //must set the beam and parent helper to fill flux info
00548 //     ana_nue.nuefwa.SetBeam(kzarkoBeamType);
00549 //     ana_nue.nuefwa.SetBeam(kBeamType);
00550      ana_nue.nuefwa.SetSKZPCalc(skzpCalc, skzpcfg);
00551 
00552 //     ana_nue.nuefwa.SetZbeam(zbeam);
00553 //     ana_nue.nuefwa.SetZfluk(zfluk);
00554      ana_nue.nuefwa.SetKfluk(kfluk);
00555      ana_nue.fiana.SetMuParentHelper(mupar);
00556      ana_nue.fiana.FixMuParents(kFixMuParents);
00557 
00558      //set xsec registry and mcreweight to do xsec reweighting
00559      ana_nue.nuexsa.SetMCReweight(mcr);
00560      ana_nue.nuexsa.SetRegistry(xsecreweightreg);
00561 
00562      if(event != 0){
00563 
00564        if(foundST){
00565          if(!foundMR){
00566            ana_nue.FillTrue(i,str);
00567          }
00568                  else{
00569            //find the best matching rmmu entry for this event
00570            Int_t best_rmmu = -1;
00571            //Int_t best_rmmu = i;
00572            Float_t best_com = 0;
00573            for(int xi=0;xi<mr->mrhdr.nmrevt;xi++){        
00574              NtpMREvent *ev = SntpHelpers::GetMREvent(xi,mr);
00575              if(ev && ev->best_event==i && ev->best_complete>best_com) {
00576                best_com = ev->best_complete;
00577                best_rmmu = ev->orig_event;
00578                //              cout<<"found mr match "<<i<<" "<<ev->best_event<<" "<<xi<<endl;
00579              }
00580            }
00581            if(best_rmmu>=0){
00582              ana_nue.FillTrue(best_rmmu,oldst);
00583            }    
00584          }
00585          ana_nue.FillReco(i,str);
00586        }
00587 //       if(foundSR){
00588 //         ana_nue.FillTrue(i,sr,mc,th);
00589 //         ana_nue.FillReco(i,sr);
00590 //       } 
00591                                                                               
00592        if(passesCuts)
00593        {
00594          MSG("NueModule",Msg::kDebug)<<"Tracklength: "<<longtrack
00595             <<"Event Length: "<<event->plane.n
00596             <<"Event Energy: "<<event->ph.sigcor
00597             <<"Event Energy : "<<event->ph.sigcor<<endl;
00598 
00599          passcutcounter++;
00600          //analyze calculates everybodies variables, then calls the Truth and Reco Object Fillers
00601          //configure MSTCalcAna routine
00602          MSG("NueModule",Msg::kDebug)<<"Setting templates: "
00603                                      <<MSTetemplate->GetName()<<" "
00604                                      <<MSTbtemplate->GetName()<<" "
00605                                      <<MSTemtemplate->GetName()<<" "
00606                                      <<MSTbmtemplate->GetName()<<endl;
00607          
00608          ana_nue.msta.SetSigTemplate(MSTetemplate);
00609          ana_nue.msta.SetBGTemplate(MSTbtemplate);
00610          ana_nue.msta.SetSigMIPTemplate(MSTemtemplate);
00611          ana_nue.msta.SetBGMIPTemplate(MSTemtemplate);
00612          ana_nue.msta.SetMSTParams(MSTminsig,MSTmaxmetric,
00613                                    MSTminfarsig,MSTmaxmetriclowz,SIGMAPMEU);
00614          ana_nue.sfa.SetParams(SIGMAPMEU, MEUPERGEV);
00615          ana_nue.sfa.SetCutParams(kDPlaneCut,kPhStripCut,kPhPlaneCut, kCPhPlaneCut);
00616          ana_nue.fva.SetParams(SIGMAPMEU, MEUPERGEV);
00617          ana_nue.mda.SetMdaParams(threshCut, sasFileName);
00618                                
00619          if(foundST)  ana_nue.Analyze(i,str);
00620 //         if(foundSR)  ana_nue.Analyze(i,sr);
00621          if(foundMR)  ana_nue.Analyze(i,mr,oldst);
00622          if(foundUR)  ana_nue.Analyze(ur);
00623        }// end of If(passcuts)
00624        else{
00625          cout<<"Rejecting based on cuts"<<endl;
00626        }
00627      }else{
00628        //No event here - still fill for POT info
00629        ana_nue.aneia.Analyze(-10,str);
00630        ana_nue.equala.Analyze(-10, str);
00631      }
00632 
00633      if(PassesBlindingCuts(nue)){  
00634        anypassed = true;
00635        //give the ana_nue object to mom, she'll write it to the file
00636        MSG("NueModule",Msg::kDebug)<<"Giving Fragment to mom  "<<event<<endl;
00637        writecounter++;
00638        mom->AdoptFragment(nue);
00639        MSG("NueModule",Msg::kDebug)<<"Mom took it"<<endl;
00640      }else{
00641         //we aren't saving this nue object.. so delete it to prevent a memory leak
00642         //sc 7/6/09
00643         delete nue;
00644         nue=0;
00645      }
00646  
00647      if(i+1 == evtn && !anypassed){ 
00648        //push through something so the POT are still counted
00649        h.SetEvents(evtn);
00650        NueRecord *nueblank = new NueRecord(h);
00651        NueRecordAna ana_nue(*nueblank);
00652        ana_nue.SetRelease(release);
00653        ana_nue.SetBeamType(kBeamType);
00654        nueblank->SetTitle(title.c_str());
00655        ana_nue.aneia.Analyze(-10,str);
00656        ana_nue.equala.Analyze(-10, str);
00657        writecounter++;
00658        mom->AdoptFragment(nueblank);
00659      }
00660 
00661    }
00662    delete [] ph0;
00663    delete [] ph1;
00664 
00665    if(fUseROPID) data->Clear();
00666 
00667    MSG("NueModule",Msg::kDebug)<<"Done with snarl"<<endl;
00668    passcounter++;
00669    return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00670 }

void NueModule::BeginJob (  )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 791 of file NueModule.cxx.

References Msg::kDebug, MSG, MSTbmtemplate, MSTbtemplate, MSTemtemplate, MSTetemplate, and tmpltfile.

00792 {
00793   MSG("NueModule",Msg::kDebug)<<"In NueModule::BeginJob"<<endl;
00794    
00795   if(tmpltfile!=""){
00796     MSG("NueModule",Msg::kDebug)<<"opening MST template file "
00797                                 <<tmpltfile<<endl;
00798     TFile f(tmpltfile.c_str());
00799     if(f.IsOpen()){
00800       MSTetemplate = (TProfile2D *)f.Get("nlambdanele");
00801       MSTbtemplate = (TProfile2D *)f.Get("nlambdanother");
00802       MSTemtemplate = (TProfile2D *)f.Get("mipdistele");
00803       MSTbmtemplate = (TProfile2D *)f.Get("mipdistother");
00804       MSG("NueModule",Msg::kDebug)<<"Did I get the histos? "
00805                                   <<MSTetemplate<<" "<<MSTbtemplate<<" "
00806                                   <<MSTemtemplate<<" "<<MSTbmtemplate<<endl;
00807       MSTetemplate->SetDirectory(0);
00808       MSTbtemplate->SetDirectory(0);
00809       MSTemtemplate->SetDirectory(0);
00810       MSTbmtemplate->SetDirectory(0);
00811       f.Close();
00812       MSG("NueModule",Msg::kDebug)<<"Do I still have them? "
00813                                   <<MSTetemplate->GetName()<<endl;
00814 
00815     }
00816   }
00817 // Beam Summary ntuples are obsolete!
00818 //  LoadBeamSummaryData(bmondir.c_str());
00819 }

void NueModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 726 of file NueModule.cxx.

References beamstring, NueAnalysisCuts::Config(), fCut, Registry::Get(), kBeamType, kCCPIDCut, kCCPidName, kCPhPlaneCut, Msg::kDebug, kDPlaneCut, kFixMuParents, kHighECut, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, kLoPhNPlaneCut, kLoPhNStripCut, kLowECut, kMuPiDir, kPhPlaneCut, kPhStripCut, kPIDHighCut, kPIDLowCut, kPidName, BeamType::kUnknown, MSG, MSTmaxmetric, MSTmaxmetriclowz, MSTminfarsig, MSTminsig, sasFileName, SetMRCCRunning(), threshCut, and tmpltfile.

00727 {
00728 //======================================================================
00729 // Configure the module given the Registry r
00730 //======================================================================
00731   MSG("NueModule",Msg::kDebug)<<"In NueModule::Config"<<endl;
00732 
00733   fCut.Config(r);
00734 
00735   const char* tmps;
00736 
00737   if(r.Get("ANTIPID", tmps)) {kPidName = tmps;}
00738   if(r.Get("CCPID", tmps))      { kCCPidName = tmps;}
00739 
00740   if(r.Get("MSTTmpltFile",tmps)) { tmpltfile = tmps;}
00741   int imps;
00742   if(r.Get("DPlaneCut",imps)) { kDPlaneCut=imps;}
00743   if(r.Get("LoPhNStripCut",imps)) { kLoPhNStripCut=imps;}
00744   if(r.Get("LoPhNPlaneCut",imps)) { kLoPhNPlaneCut=imps;}
00745 
00746   if(r.Get("MdaSASFile",tmps)) { sasFileName = tmps;}
00747 
00748   double fmps;
00749   if(r.Get("HighPIDCut", fmps)) { kPIDHighCut = fmps; }
00750   if(r.Get("LowPIDCut", fmps))  { kPIDLowCut = fmps; }
00751   if(r.Get("CCPIDCut", fmps))   { kCCPIDCut = fmps;  }
00752   if(r.Get("HighEnergyCut", fmps)) { kHighECut = fmps; }
00753   if(r.Get("LowEnergyCut", fmps))  { kLowECut = fmps; }
00754 
00755   if(r.Get("PhStripCut",fmps)) { kPhStripCut=fmps;}
00756   if(r.Get("PhPlaneCut",fmps)) { kPhPlaneCut=fmps;}
00757   if(r.Get("ContPhPlaneCut",fmps)) { kCPhPlaneCut=fmps;}
00758 
00759 
00760   if(r.Get("MSTminsig",fmps)){ MSTminsig=fmps; }
00761   if(r.Get("MSTmaxmetric",fmps)){ MSTmaxmetric=fmps; }
00762   if(r.Get("MSTminfarsig",fmps)){ MSTminfarsig=fmps; }
00763   if(r.Get("MSTmaxmetriclowz",fmps)){ MSTmaxmetriclowz=fmps; }
00764   if(r.Get("MdaThreshCut",fmps)) { threshCut = fmps;}
00765 
00766   if(r.Get("MuPiDir",tmps)){kMuPiDir=(string)(tmps);}
00767 
00768 //  if(r.Get("BeamType",imps)){kBeamType=imps;}
00769 
00770   if(r.Get("BeamString", tmps)){
00771      beamstring = tmps;  
00772      BeamType::BeamType_t beam = BeamType::kUnknown;
00773      if(beamstring.find("le010z185i")!=string::npos){ beam=BeamType::kL010z185i; }
00774      if(beamstring.find("le100z200i")!=string::npos){ beam=BeamType::kL100z200i; }
00775      if(beamstring.find("le250z200i")!=string::npos){ beam=BeamType::kL250z200i; }
00776      if(beamstring.find("le150z200i")!=string::npos){ beam=BeamType::kL150z200i; }
00777      if(beamstring.find("le010z200i")!=string::npos){ beam=BeamType::kL010z200i; }
00778      if(beamstring.find("le010z170i")!=string::npos){ beam=BeamType::kL010z170i; }
00779      if(beamstring.find("le010z000i")!=string::npos){ beam=BeamType::kL010z200i; }
00780      kBeamType = beam;
00781   }
00782 
00783   if(r.Get("FixMuParents",imps)){ 
00784     if(imps==1) kFixMuParents=true; 
00785     else kFixMuParents=false;
00786   }
00787 
00788   if(r.Get("MRCC",imps)){ SetMRCCRunning(imps);}
00789 }

const Registry & NueModule::DefaultConfig (  )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 674 of file NueModule.cxx.

References NueAnalysisCuts::DefaultConfig(), fCut, JobCModule::GetName(), Msg::kDebug, ANtpDefaultValue::kDouble, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00675 {
00676 //======================================================================
00677 // Supply the default configuration for the module
00678 //======================================================================
00679    MSG("NueModule",Msg::kDebug)<<"In NueModule::DefaultConfig"<<endl;
00680 
00681   static Registry r  = fCut.DefaultConfig(); // Default configuration for module
00682 
00683   // Set name of config
00684   std::string name = this->GetName();
00685   name += ".config.default";
00686   r.SetName(name.c_str());
00687 
00688   // Set values in configuration
00689   r.UnLockValues();
00690   r.Set("MSTTmpltFile","templates.root");
00691   r.Set("DPlaneCut",-1);
00692   r.Set("LoPhNStripCut",-1);
00693   r.Set("LoPhNPlaneCut",-1);
00694 
00695   r.Set("PhStripCut",-1);
00696   r.Set("PhPlaneCut",-1);
00697   r.Set("ContPhPlaneCut",-1.);
00698 
00699   r.Set("MSTminsig",0.5);
00700   r.Set("MSTmaxmetric",1000.);
00701   r.Set("MSTminfarsig",1.5);
00702   r.Set("MSTmaxmetriclowz",20.);
00703   
00704   r.Set("MdaThreshCut",0.0);
00705   r.Set("MdaSASFile","");
00706   r.Set("BeamString", "");
00707   r.Set("MuPiDir","");
00708   r.Set("BeamType",2);
00709   r.Set("FixMuParents",0);
00710   r.Set("MRCC", 0);
00711 
00712   r.Set("HighEnergyCut", ANtpDefVal::kDouble);
00713   r.Set("LowEnergyCut", ANtpDefVal::kDouble);
00714   r.Set("HighPIDCut", ANtpDefVal::kDouble);
00715   r.Set("LowPIDCut", ANtpDefVal::kDouble);
00716   r.Set("ANTIPID", "None");
00717   r.Set("CCPID", "None");
00718 
00719   r.LockValues();
00720 
00721   return r;
00722 }

BeamType::BeamType_t NueModule::DetermineBeamType ( string  file  ) 

Definition at line 921 of file NueModule.cxx.

References BeamType::kL010z000i, BeamType::kL010z000i_i209, BeamType::kL010z000i_i225, BeamType::kL010z000i_i232, BeamType::kL010z000i_i259, BeamType::kL010z000i_i300, BeamType::kL010z000i_i317, BeamType::kL010z000i_i326, BeamType::kL010z000i_i380, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z185i_i124, BeamType::kL010z185i_i191, BeamType::kL010z185i_i213, BeamType::kL010z185i_i224, BeamType::kL010z185i_i232, BeamType::kL010z185i_i243, BeamType::kL010z185i_i257, BeamType::kL010z185i_i282, BeamType::kL010z185i_i303, BeamType::kL010z185i_i324, BeamType::kL010z185i_rev, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, BeamType::kL250z200i_i100, BeamType::kL250z200i_i114, BeamType::kL250z200i_i130, BeamType::kL250z200i_i152, BeamType::kL250z200i_i165, BeamType::kL250z200i_i194, BeamType::kL250z200i_i232, and BeamType::kUnknown.

00922 {
00923    BeamType::BeamType_t beam = BeamType::kUnknown;
00924    if(file.find("L010185")!=string::npos)
00925    {
00926     beam=BeamType::kL010z185i;
00927     //Check to see if this has a special intensity
00928     if(file.find("D04_i124")!=string::npos){beam=BeamType::kL010z185i_i124;}
00929     else if(file.find("D04_i191")!=string::npos){beam=BeamType::kL010z185i_i191;}
00930     else if(file.find("D04_i213")!=string::npos){beam=BeamType::kL010z185i_i213;}
00931     else if(file.find("D04_i224")!=string::npos){beam=BeamType::kL010z185i_i224;}
00932     else if(file.find("D04_i232")!=string::npos){beam=BeamType::kL010z185i_i232;}
00933     else if(file.find("D04_i243")!=string::npos){beam=BeamType::kL010z185i_i243;}
00934     else if(file.find("D04_i257")!=string::npos){beam=BeamType::kL010z185i_i257;}
00935     else if(file.find("D04_i282")!=string::npos){beam=BeamType::kL010z185i_i282;}
00936     else if(file.find("D04_i303")!=string::npos){beam=BeamType::kL010z185i_i303;}
00937     else if(file.find("D04_i324")!=string::npos){beam=BeamType::kL010z185i_i324;}
00938 
00939     else if(file.find("L010185R_D07_r4")!=string::npos){beam=BeamType::kL010z185i_rev;}
00940    }
00941    if(file.find("L010000")!=string::npos)
00942    {
00943     beam=BeamType::kL010z000i; 
00944     //Check to see if this has a special intensity
00945     if(file.find("D04_i209")!=string::npos){beam=BeamType::kL010z000i_i209;}
00946     else if(file.find("D04_i225")!=string::npos){beam=BeamType::kL010z000i_i225;}
00947     else if(file.find("D04_i232")!=string::npos){beam=BeamType::kL010z000i_i232;}
00948     else if(file.find("D04_i259")!=string::npos){beam=BeamType::kL010z000i_i259;}
00949     else if(file.find("D04_i300")!=string::npos){beam=BeamType::kL010z000i_i300;}
00950     else if(file.find("D04_i317")!=string::npos){beam=BeamType::kL010z000i_i317;}
00951     else if(file.find("D04_i326")!=string::npos){beam=BeamType::kL010z000i_i326;}
00952     else if(file.find("D04_i380")!=string::npos){beam=BeamType::kL010z000i_i380;}
00953    }
00954    if(file.find("L100200")!=string::npos){ beam=BeamType::kL100z200i; }
00955    if(file.find("L250200")!=string::npos)
00956    { 
00957     beam=BeamType::kL250z200i;
00958     //Check to see if this has a special intensity
00959     if(file.find("D04_i100")!=string::npos){beam=BeamType::kL250z200i_i100;}
00960     else if(file.find("D04_i114")!=string::npos){beam=BeamType::kL250z200i_i114;}
00961     else if(file.find("D04_i130")!=string::npos){beam=BeamType::kL250z200i_i130;}
00962     else if(file.find("D04_i152")!=string::npos){beam=BeamType::kL250z200i_i152;}
00963     else if(file.find("D04_i165")!=string::npos){beam=BeamType::kL250z200i_i165;}
00964     else if(file.find("D04_i194")!=string::npos){beam=BeamType::kL250z200i_i194;}
00965     else if(file.find("D04_i232")!=string::npos){beam=BeamType::kL250z200i_i232;}
00966    }
00967    if(file.find("L150200")!=string::npos){ beam=BeamType::kL150z200i; }
00968    if(file.find("L010200")!=string::npos){ beam=BeamType::kL010z200i; }
00969    if(file.find("L010170")!=string::npos){ beam=BeamType::kL010z170i; }
00970 
00971    return beam;
00972 }

BeamType::BeamType_t NueModule::DetermineBeamType ( VldContext  vc  ) 

Definition at line 864 of file NueModule.cxx.

References VldTimeStamp::GetSec(), VldContext::GetTimeStamp(), BeamType::kL000z200i, BeamType::kL010z000i, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, and BeamType::kUnknown.

Referenced by Analyze().

00864                                                             {
00865 
00866 /*    BDSpillAccessor& sa = BDSpillAccessor::Get();
00867     VldContext evt_vldc = nr->GetHeader().GetVldContext();
00868 
00869     const BeamMonSpill* bms = sa.LoadSpill(vc.GetTimeStamp());
00870     VldTimeStamp bms_vts;
00871     if (!bms) {
00872        MSG("NueBeamMon",Msg::kError) << "No BeamMonSpill found for " << evt_vldc << endl;
00873        bms_vts = VldTimeStamp::GetEOT();
00874     }
00875     else {
00876         bms_vts = bms->SpillTime();
00877     }
00878     return bms->BeamType();
00879 */
00880     int time = vc.GetTimeStamp().GetSec();
00881 
00882     BeamType::BeamType_t beam = BeamType::kUnknown;
00883 
00884     if(time >= 1107216000 && time < 1109539850) beam = BeamType::kL100z200i;
00885     if(time >= 1109540615 && time < 1109899325) beam = BeamType::kL250z200i;
00886     if(time >= 1109899938 && time < 1110239564) beam = BeamType::kL100z200i;
00887     if(time >= 1110323763 && time < 1111622400) beam = BeamType::kL000z200i;
00888     if(time >= 1114892377 && time < 1115927583) beam = BeamType::kL100z200i;
00889     if(time >= 1115937438 && time < 1116604821) beam = BeamType::kL250z200i;
00890     if(time >= 1116618256 && time < 1122659668) beam = BeamType::kL010z185i;
00891     if(time >= 1122659886 && time < 1122922688) beam = BeamType::kL010z170i;
00892     if(time >= 1122922890 && time < 1123112674) beam = BeamType::kL010z200i;
00893     if(time >= 1123112803 && time < 1139605423) beam = BeamType::kL010z185i;
00894     if(time >= 1139605543 && time < 1140022084) beam = BeamType::kL010z000i;
00895     if(time >= 1140026702 && time < 1140908579) beam = BeamType::kL010z185i;
00896     // End of Run 1
00897     if(time >= 1149180600 && time < 1150047780) beam = BeamType::kL150z200i;
00898     if(time >= 1150047780 && time < 1151690460) beam = BeamType::kL250z200i;
00899     if(time >= 1153956600 && time < 1155510000) beam = BeamType::kL250z200i;
00900     if(time >= 1158004800 && time < 1158019870) beam = BeamType::kL010z200i;
00901     if(time >= 1158019870 && time < 1161892800) beam = BeamType::kL010z185i;
00902     if(time >= 1161892800 && time < 1184351737) beam = BeamType::kL010z185i;
00903     if(time >= 1184351737 && time < 1184708040) beam = BeamType::kL010z000i;
00904     //End of Run 2
00905 
00906     if(time >= 1195357170 && time < 1226738986) beam = BeamType::kL010z185i;
00907     if(time >= 1226738986 && time < 1229106262) beam = BeamType::kL010z000i;// Nov. 2008
00908     if(time >= 1229106262 && time < 1238766448) beam = BeamType::kL010z185i;
00909     if(time >= 1238766448 && time < 1239062404) beam = BeamType::kL010z000i;
00910     if(time >= 1239062404 && time < 1239608626) beam = BeamType::kL010z185i;
00911     if(time >= 1239608626 && time < 1239641024) beam = BeamType::kL010z000i;
00912     if(time >= 1239641024 && time < 1240002769) beam = BeamType::kL010z185i;
00913     if(time >= 1240002769 && time < 1240159225) beam = BeamType::kL010z000i;
00914     if(time >= 1240159225 && time < 1244887229) beam = BeamType::kL010z185i;// need to be modified when new data is available
00915     // End of Run 16502_0000
00916 
00917 
00918     return beam;
00919 }

void NueModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 821 of file NueModule.cxx.

References counter, failcounter, Msg::kInfo, MSG, MSTbmtemplate, MSTbtemplate, MSTemtemplate, MSTetemplate, passcounter, passcutcounter, and writecounter.

00822 {
00823 
00824    MSG("NueModule",Msg::kInfo)<<"Counter "<<counter
00825                               <<" passcutcounter "<<passcutcounter
00826                               <<" passcounter "<<passcounter
00827                               <<" failcounter "<<failcounter
00828                               <<" writecounter "<<writecounter<<endl;
00829 //   MSG("NueModule",Msg::kInfo)<<"Number of POT in this run: "<<pot<<endl;
00830 
00831    if(MSTetemplate!=0){
00832      delete MSTetemplate;
00833      MSTetemplate=0;
00834    }
00835    if(MSTbtemplate!=0){
00836      delete MSTbtemplate;
00837      MSTbtemplate=0;
00838    }
00839    if(MSTemtemplate!=0){
00840      delete MSTemtemplate;
00841      MSTemtemplate=0;
00842    }
00843    if(MSTbmtemplate!=0){
00844      delete MSTbmtemplate;
00845      MSTbmtemplate=0;
00846    }
00847 
00848 }

void NueModule::LoadBeamSummaryData ( const char *  bd  ) 

Definition at line 850 of file NueModule.cxx.

References Msg::kError, and MSG.

00851 {
00852     MSG("NueModule",Msg::kError)<<"Beam Summary ntuples are obsolete!"<<endl;
00853     return;
00854 
00855 
00856   DIR *dfd;
00857   if(!(dfd =  opendir(bd))){
00858     MSG("NueModule",Msg::kError)<<"Can not ls Beam Monitoring path "
00859                                 <<bd<<" "<<dfd<<std::endl;
00860     return;
00861   }
00862 }

bool NueModule::PassesBlindingCuts ( NueRecord nr  )  [private]

Definition at line 974 of file NueModule.cxx.

References NueRecord::ann, TreePID::fCutPID, MCNNVars::fracCCy, NueStandard::GetPIDValue(), ANtpDefaultValue::IsDefault(), Selection::kANN30, Selection::kANN6, kCCPIDCut, kCCPidName, Selection::kCuts, ANtpDefaultValue::kDouble, kHighECut, ANtpDefaultValue::kInt, kLowECut, Selection::kMCNN, kPIDHighCut, kPIDLowCut, kPidName, Selection::kSSPID, NueRecord::mcnnv, NueRecord::mri, NueConvention::NueEnergyCorrection(), MuonRemovalInfo::orig_abCCPID, MuonRemovalInfo::orig_cc_pid, ANtpEventInfoNue::phNueGeV, SubShowerVar::pid, Ann::pid_30inp, Ann::pid_6inp, NueRecord::srevent, Selection::StringToEnum(), NueRecord::subshowervars, and NueRecord::treepid.

00975 {
00976   bool passes = true;
00977 
00978   if( kPidName != "None"){
00979      Selection::Selection_t pid = Selection::StringToEnum(kPidName.c_str());
00980 
00981      double pidVal = NueStandard::GetPIDValue(nr, pid);
00982      
00983      if(!ANtpDefVal::IsDefault(kPIDHighCut))
00984          passes = pidVal < kPIDHighCut;
00985 
00986      if(!ANtpDefVal::IsDefault(kPIDLowCut))
00987          passes = (passes) && pidVal > kPIDLowCut;
00988 
00989     if(pid != Selection::kANN6) nr->ann.pid_6inp = ANtpDefVal::kDouble;
00990     if(pid != Selection::kANN30) nr->ann.pid_30inp = ANtpDefVal::kDouble;
00991     if(pid != Selection::kSSPID) 
00992              nr->subshowervars.pid = ANtpDefVal::kDouble;
00993     if(pid != Selection::kMCNN) nr->mcnnv.fracCCy = ANtpDefVal::kDouble;
00994     if(pid != Selection::kCuts) nr->treepid.fCutPID = ANtpDefVal::kInt;
00995 
00996   }
00997 
00998   if(!ANtpDefVal::IsDefault(kCCPIDCut)){
00999      if(kCCPidName == "CC_DP")
01000          passes = passes &&  nr->mri.orig_cc_pid > kCCPIDCut;
01001      if(kCCPidName == "CC_AB")
01002          passes = passes &&  nr->mri.orig_abCCPID > kCCPIDCut;
01003   }
01004 
01005   NueConvention::NueEnergyCorrection(nr);
01006 
01007   if(!ANtpDefVal::IsDefault(kHighECut))
01008      passes = passes && nr->srevent.phNueGeV < kHighECut;
01009 
01010   if(!ANtpDefVal::IsDefault(kLowECut))
01011      passes =  passes && nr->srevent.phNueGeV > kLowECut;
01012 
01013   return passes;
01014 }

JobCResult NueModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 172 of file NueModule.cxx.

References Analyze(), ReleaseType::AsString(), counter, failcounter, filename, foundmeu, foundRelease, MomNavigator::GetFragment(), MomNavigator::GetFragmentList(), RecRecordImp< T >::GetHeader(), DbiResultPtr< T >::GetNumRows(), NtpStRecord::GetRelease(), DbiResultPtr< T >::GetRow(), DataUtil::GetTempTagString(), RecHeader::GetVldContext(), gSystem(), ReleaseType::IsBirch(), Msg::kDebug, JobCResult::kFailed, Msg::kInfo, JobCResult::kPassed, Msg::kWarning, mrccRun, MSG, DbiResultPtr< T >::NewQuery(), release, SIGMAPMEU, and title.

00173 {
00174 //======================================================================
00175 // Reads in sue-style ntuples from mom, calculates a bunch of useful
00176 // nue quantites
00177 //======================================================================
00178    MSG("NueModule",Msg::kDebug)<<"In NueModule::Reco"<<endl;
00179 
00180    if(counter%1000==0){      
00181       MSG("NueModule",Msg::kInfo)<<"On entry "<<counter<<endl;
00182    }
00183    counter++;
00184    bool foundMR=false;
00185    bool foundUR=false;
00186 
00187    bool foundST=false;
00188 //   bool passesCuts = false;
00189 
00190    NtpStRecord *str = 0;
00191    NtpStRecord *oldst = 0;
00192    NtpMRRecord *mr = 0;
00193 
00194 
00195    VldContext vc;  
00196    str = dynamic_cast<NtpStRecord *>(mom->GetFragment("NtpStRecord",
00197                                                       "Primary"));
00198 
00199    std::vector<TObject*> stRecords =  mom->GetFragmentList("NtpStRecord");
00200 
00201    if(str){
00202      foundST=true;
00203      vc=str->GetHeader().GetVldContext();
00204      if(!foundRelease){
00205         release = str->GetRelease();
00206         foundRelease = true; 
00207         title = ReleaseType::AsString(release);
00208         string file = DataUtil::GetTempTagString(str, "file");
00209         filename = gSystem->BaseName(file.c_str());
00210      }
00211      //check for MR:
00212      mr =  dynamic_cast<NtpMRRecord *>(mom->GetFragment("NtpMRRecord"));
00213      if(mr){
00214        if(ReleaseType::IsBirch(release)) {
00215          oldst=dynamic_cast<NtpStRecord *>(mom->GetFragment("NtpStRecord",
00216                                                             "NtpStRecordOld")); 
00217        }
00218        else {
00219          oldst=str;
00220          str=dynamic_cast<NtpStRecord *>(mom->GetFragment("NtpStRecord",
00221                                                           "MuonRemoved"));
00222        }
00223        if(oldst) foundMR = true;
00224      }
00225    }
00226 
00227    if(!foundST&&!foundMR){
00228       //got nothing useful from mom
00229       MSG("NueModule",Msg::kWarning)<<"Got Nothing from mom"<<endl;
00230       failcounter++;
00231       return JobCResult::kFailed;
00232    }
00233    if(mrccRun&&!(foundMR&&foundST)){
00234       return JobCResult::kFailed;
00235    }
00236 
00237 
00238    std::vector<TObject*> urRecords =  mom->GetFragmentList("UberRecord");
00239    if(urRecords.size()) foundUR=true;
00240    
00241    //UGLY!!!!
00242    //need to be able to compare single strip 
00243    //pulseheight between ND and FD, but we can't
00244    //in the ntuple.  Will ask the db for the
00245    //conversion from sigcor to MEU 
00246    //on the first event, and use throughout.  
00247    //Since sigcorrs are already corrected for all strip variations, 
00248    //it's ok to ask for 1 number.  
00249    //Should be ok for MC, maybe ok for 1 run of data at a time, but will
00250    //definitely be wrong if many weeks worth of data are strung together
00251    //we should revisit this and make it better in the future!!!!!!!
00252    if(!foundmeu)
00253    {
00254     //Setup and give context
00255     DbiResultPtr<CalMIPCalibration> fResPtr;
00256     fResPtr.NewQuery(vc,10);
00257 
00258     //Get Scale
00259     if(fResPtr.GetNumRows()>0)
00260     {
00261      const CalMIPCalibration* mipcal = fResPtr.GetRow(0);
00262      SIGMAPMEU = mipcal->GetScale();
00263      foundmeu=true;
00264     }
00265    }
00266 
00267   bool oneGood = false;
00268   //check if we find a UberRecord
00269   if(foundUR){
00270     //if we did, it's a caldet record and we have to treat it specially
00271     //note, we're assuming we will never want to MRCC caldet!
00272     for(unsigned int i = 0; i < stRecords.size(); i++)
00273       {
00274         UberRecord* uTemp = 0;
00275         NtpStRecord* st  = dynamic_cast<NtpStRecord *>(stRecords[i]);
00276         if(foundUR) uTemp = dynamic_cast<UberRecord *>(urRecords[i]);
00277         Analyze(mom,st, 0, uTemp, oldst);
00278         oneGood = true;
00279       }
00280   }
00281   else{
00282     //its not caldet, and there should only be one StRecord, one MRRecord, and no UberRecords
00283     Analyze(mom,str,mr,0,oldst);
00284     oneGood=true;
00285   }
00286 
00287   if(oneGood)  return JobCResult::kPassed ;
00288   return JobCResult::kFailed;
00289 }

void NueModule::SetMRCCRunning ( bool  val = true  )  [inline]

Definition at line 49 of file NueModule.h.

References mrccRun.

Referenced by Config().

00049 {mrccRun = val;};  


Member Data Documentation

std::string NueModule::beamstring [private]

Definition at line 57 of file NueModule.h.

Referenced by Config().

int NueModule::counter [private]

Definition at line 74 of file NueModule.h.

Referenced by EndJob(), and Reco().

int NueModule::failcounter [private]

Definition at line 77 of file NueModule.h.

Referenced by Analyze(), EndJob(), and Reco().

NueAnalysisCuts NueModule::fCut [private]

Definition at line 59 of file NueModule.h.

Referenced by Analyze(), Config(), and DefaultConfig().

string NueModule::filename [private]

Definition at line 103 of file NueModule.h.

Referenced by Analyze(), and Reco().

bool NueModule::foundmeu [private]

Definition at line 79 of file NueModule.h.

Referenced by Reco().

bool NueModule::foundRelease [private]

Definition at line 99 of file NueModule.h.

Referenced by Reco().

BeamType::BeamType_t NueModule::kBeamType [private]

Definition at line 69 of file NueModule.h.

Referenced by Analyze(), and Config().

double NueModule::kCCPIDCut [private]

Definition at line 119 of file NueModule.h.

Referenced by Config(), NueModule(), and PassesBlindingCuts().

string NueModule::kCCPidName [private]

Definition at line 122 of file NueModule.h.

Referenced by Config(), and PassesBlindingCuts().

Float_t NueModule::kCPhPlaneCut [private]

Definition at line 66 of file NueModule.h.

Referenced by Analyze(), and Config().

Int_t NueModule::kDPlaneCut [private]

Definition at line 61 of file NueModule.h.

Referenced by Analyze(), and Config().

bool NueModule::kFixMuParents [private]

Definition at line 71 of file NueModule.h.

Referenced by Analyze(), Config(), and NueModule().

Kfluk* NueModule::kfluk [private]

Definition at line 110 of file NueModule.h.

Referenced by Analyze(), NueModule(), and ~NueModule().

double NueModule::kHighECut [private]

Definition at line 120 of file NueModule.h.

Referenced by Config(), NueModule(), and PassesBlindingCuts().

Int_t NueModule::kLoPhNPlaneCut [private]

Definition at line 63 of file NueModule.h.

Referenced by Config().

Int_t NueModule::kLoPhNStripCut [private]

Definition at line 62 of file NueModule.h.

Referenced by Config().

double NueModule::kLowECut [private]

Definition at line 121 of file NueModule.h.

Referenced by Config(), NueModule(), and PassesBlindingCuts().

string NueModule::kMuPiDir [private]

Definition at line 70 of file NueModule.h.

Referenced by Analyze(), and Config().

bool NueModule::kOpenedMuPiFile [private]

Definition at line 72 of file NueModule.h.

Referenced by Analyze().

Float_t NueModule::kPhPlaneCut [private]

Definition at line 65 of file NueModule.h.

Referenced by Analyze(), and Config().

Float_t NueModule::kPhStripCut [private]

Definition at line 64 of file NueModule.h.

Referenced by Analyze(), and Config().

double NueModule::kPIDHighCut [private]

Definition at line 117 of file NueModule.h.

Referenced by Config(), NueModule(), and PassesBlindingCuts().

double NueModule::kPIDLowCut [private]

Definition at line 118 of file NueModule.h.

Referenced by Config(), NueModule(), and PassesBlindingCuts().

string NueModule::kPidName [private]

Definition at line 116 of file NueModule.h.

Referenced by Config(), NueModule(), and PassesBlindingCuts().

MCReweight* NueModule::mcr [private]

Definition at line 113 of file NueModule.h.

Referenced by Analyze(), and NueModule().

float NueModule::MEUPERGEV [private]

Definition at line 97 of file NueModule.h.

Referenced by Analyze().

bool NueModule::mrccRun [private]

Definition at line 105 of file NueModule.h.

Referenced by NueModule(), Reco(), and SetMRCCRunning().

TProfile2D* NueModule::MSTbmtemplate [private]

Definition at line 91 of file NueModule.h.

Referenced by Analyze(), BeginJob(), and EndJob().

TProfile2D* NueModule::MSTbtemplate [private]

Definition at line 89 of file NueModule.h.

Referenced by Analyze(), BeginJob(), and EndJob().

TProfile2D* NueModule::MSTemtemplate [private]

Definition at line 90 of file NueModule.h.

Referenced by Analyze(), BeginJob(), and EndJob().

TProfile2D* NueModule::MSTetemplate [private]

Definition at line 88 of file NueModule.h.

Referenced by Analyze(), BeginJob(), and EndJob().

float NueModule::MSTmaxmetric [private]

Definition at line 82 of file NueModule.h.

Referenced by Analyze(), and Config().

float NueModule::MSTmaxmetriclowz [private]

Definition at line 84 of file NueModule.h.

Referenced by Analyze(), and Config().

float NueModule::MSTminfarsig [private]

Definition at line 83 of file NueModule.h.

Referenced by Analyze(), and Config().

float NueModule::MSTminsig [private]

Definition at line 81 of file NueModule.h.

Referenced by Analyze(), and Config().

MuParentHelper* NueModule::mupar [private]

Definition at line 107 of file NueModule.h.

Referenced by Analyze(), NueModule(), and ~NueModule().

int NueModule::passcounter [private]

Definition at line 75 of file NueModule.h.

Referenced by EndJob().

int NueModule::passcutcounter [private]

Definition at line 76 of file NueModule.h.

Referenced by Analyze(), and EndJob().

float NueModule::pot [private]

Definition at line 96 of file NueModule.h.

int NueModule::release [private]

Definition at line 100 of file NueModule.h.

Referenced by Analyze(), and Reco().

std::string NueModule::sasFileName [private]

Definition at line 94 of file NueModule.h.

Referenced by Analyze(), and Config().

float NueModule::SIGMAPMEU [private]

Definition at line 86 of file NueModule.h.

Referenced by Analyze(), and Reco().

SKZPWeightCalculator* NueModule::skzpCalc [private]

Definition at line 111 of file NueModule.h.

Referenced by Analyze(), NueModule(), and ~NueModule().

string NueModule::skzpcfg [private]

Definition at line 101 of file NueModule.h.

Referenced by Analyze(), and NueModule().

Double_t NueModule::threshCut [private]

Definition at line 93 of file NueModule.h.

Referenced by Analyze(), and Config().

string NueModule::title [private]

Definition at line 102 of file NueModule.h.

Referenced by Analyze(), and Reco().

std::string NueModule::tmpltfile [private]

Definition at line 56 of file NueModule.h.

Referenced by BeginJob(), and Config().

int NueModule::writecounter [private]

Definition at line 78 of file NueModule.h.

Referenced by Analyze(), and EndJob().

Registry* NueModule::xsecreweightreg [private]

Definition at line 114 of file NueModule.h.

Referenced by Analyze(), and NueModule().

Zbeam* NueModule::zbeam [private]

Definition at line 108 of file NueModule.h.

Referenced by NueModule(), and ~NueModule().

Zfluk* NueModule::zfluk [private]

Definition at line 109 of file NueModule.h.

Referenced by NueModule(), and ~NueModule().


The documentation for this class was generated from the following files:
Generated on Thu Jul 10 22:53:13 2014 for loon by  doxygen 1.4.7