Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

NueExtrapHelper.cxx

Go to the documentation of this file.
00001 #include "NueAna/Extrapolation/NueExtrapHelper.h"
00002 #include "NueAna/NueStandard.h"
00003 #include "TMath.h"
00004 #include <iostream>
00005 #include "NueAna/NueAnaTools/NueConvention.h"
00006 
00007 NueExtrapHelper::NueExtrapHelper() :
00008   fNXBins(0),fXBins(0),fNYBins(0),fYBins(0),fRecord(0),fMini(0)
00009 {
00010   this->Init();
00011 }
00012 
00013 NueExtrapHelper::NueExtrapHelper(Int_t nx,Double_t lx,Double_t ux,
00014                                  Int_t ny,Double_t ly,Double_t uy) :
00015   fNXBins(nx),fXBins(0),fNYBins(ny),fYBins(0),fRecord(0),fMini(0)
00016 {
00017   fXBins = new Double_t[fNXBins+1];
00018   Float_t bwidth = (ux-lx)/float(fNXBins);
00019   for(int i=0;i<fNXBins+1;i++) fXBins[i] = lx + float(i)*bwidth;
00020   if(fNYBins>0) {
00021     fYBins = new Double_t[fNYBins+1];
00022     bwidth = (uy-ly)/float(fNYBins);
00023     for(int i=0;i<fNYBins+1;i++) fYBins[i] = ly + float(i)*bwidth;
00024   }
00025   this->Init();
00026 }
00027 
00028 NueExtrapHelper::NueExtrapHelper(Int_t nx,Double_t *x,
00029                                  Int_t ny,Double_t *y) :
00030   fNXBins(nx),fXBins(x),fNYBins(ny),fYBins(y),fRecord(0),fMini(0)
00031 {
00032   this->Init();
00033 }
00034 
00035 void NueExtrapHelper::Init()
00036 {
00037   fNearChain = NULL;
00038   fFarChain = NULL;
00039   fNearPOT = 0.;
00040   fFarPOT = 0.; 
00041   fCurSel = Selection::kUnknown;
00042 }
00043 
00044 NueExtrapHelper::~NueExtrapHelper()
00045 {
00046   delete [] fXBins;
00047   delete [] fYBins;
00048 }
00049 
00050 Bool_t NueExtrapHelper::PassBasicCuts()
00051 {
00052   if(fRecord->GetHeader().GetEventNo()<0) return false;
00053   if(fRecord->anainfo.inFiducialVolume!=1) return false;
00054   if(fRecord->srtrack.planes>=25) return false;  
00055   if(fRecord->srtrack.trklikePlanes>=18) return false;
00056   //if(fRecord->srevent.phMeu>150) return false;
00057   //if(TMath::Max(fRecord->srtrack.pulseHeight,
00058   //    fRecord->srshower.pulseHeight)<5000) return false;  
00059   if(fRecord->GetHeader().GetVldContext().GetDetector()==Detector::kNear && 
00060      fRecord->anainfo.isFullyContained==-2) return true;
00061   if(fRecord->anainfo.isFullyContained!=1) return false;
00062   return true;
00063 }
00064 
00065 Bool_t NueExtrapHelper::PassCuts(NueRecord *nr, Selection::Selection_t sel)
00066 {
00067   return NueStandard::PassesSelection(nr, sel);
00068 }
00069 
00070 Bool_t NueExtrapHelper::PassCuts(Selection::Selection_t sel)
00071 {
00072   return PassCuts(fRecord, sel);
00073 }
00074 
00075 void NueExtrapHelper::AddNueSystematic(NueSystematic */*nueSys*/)
00076 {
00077 }
00078 
00079 void NueExtrapHelper::MakeHelpers(Selection::Selection_t sel)
00080 {
00081   fCurSel = sel;
00082 }
00083 
00084 void NueExtrapHelper::WriteFile(std::string /*fname*/)
00085 {
00086 }
00087 
00088 void NueExtrapHelper::SetChains(TChain *nearChain, TChain *farChain,
00089                                 Double_t nearPOT, Double_t farPOT)
00090 {
00091   fNearChain = nearChain;
00092   fFarChain = farChain;
00093   SetUpNueAnaChain(fNearChain);
00094   SetUpNueAnaChain(fFarChain);
00095   fNearPOT = nearPOT;
00096   fFarPOT = farPOT;
00097 }
00098 
00099 void NueExtrapHelper::SetUpNueMiniChain(TChain *chain)
00100 {
00101   if(!fMini) fMini = new NueMini();
00102   chain->SetBranchAddress("NueMini",&fMini);
00103 }
00104 
00105 void NueExtrapHelper::SetUpNueAnaChain(TChain *chain)
00106 {
00107   if(!fRecord) fRecord = new NueRecord();
00108   chain->SetBranchAddress("NueRecord",&fRecord);
00109 
00110 //  chain->SetBranchStatus("dtree*", 0);
00111   chain->SetBranchStatus("mcnnv*", 0);
00112   chain->SetBranchStatus("timing*", 0);
00113   chain->SetBranchStatus("cdi*", 0);
00114   chain->SetBranchStatus("mri*", 0);
00115   chain->SetBranchStatus("mri*", 0);
00116   chain->SetBranchStatus("treepid*", 0);
00117   chain->SetBranchStatus("highhit*", 0);
00118   chain->SetBranchStatus("mstvar*", 0);
00119   chain->SetBranchStatus("fracvars*", 0);
00120   chain->SetBranchStatus("shield*", 0);
00121   chain->SetBranchStatus("angcluster*", 0);
00122   chain->SetBranchStatus("shwfit*", 0);
00123   chain->SetBranchStatus("hitcalc*", 0);
00124   chain->SetBranchStatus("anainfo*", 0);
00125   chain->SetBranchStatus("mda*", 0);
00126   chain->SetBranchStatus("srshower*", 0);
00127   chain->SetBranchStatus("srshower.phNueGeV", 1);
00128   chain->SetBranchStatus("srshower.phCCGeV",  1);
00129   chain->SetBranchStatus("srtrack*", 0);
00130   chain->SetBranchStatus("srtrack.begPlane", 1);
00131   chain->SetBranchStatus("srtrack.endPlane*", 1);
00132   chain->SetBranchStatus("srtrack.planes", 1);
00133   chain->SetBranchStatus("srtrack.trklikePlanes", 1);
00134   chain->SetBranchStatus("srtrack.phCCGeV",  1);
00135   chain->SetBranchStatus("srtrack.passedFit",  1);
00136   chain->SetBranchStatus("srtrack.deltaUVVtx",  1);
00137 
00138 
00139   chain->SetBranchStatus("ann*", 0);
00140   chain->SetBranchStatus("ann.pid_30inp", 1);
00141   chain->SetBranchStatus("shi*", 0);
00142   chain->SetBranchStatus("shi.epi0", 1);
00143   chain->SetBranchStatus("shi.emenergy", 1);
00144   chain->SetBranchStatus("bmon*", 0);
00145   chain->SetBranchStatus("bmon.goodBeamMon", 1);
00146   chain->SetBranchStatus("bmon.dt_stnd", 1);
00147   chain->SetBranchStatus("subshowervars*", 0);
00148   chain->SetBranchStatus("subshowervars.pid*", 1);
00149   chain->SetBranchStatus("fluxinfo*", 0);
00150   chain->SetBranchStatus("fluxinfo.tptype", 1);
00151 
00152   chain->SetBranchStatus("mctrue*", 0);
00153   chain->SetBranchStatus("mctrue.interactionType", 1);
00154   chain->SetBranchStatus("mctrue.nu*", 1);
00155   chain->SetBranchStatus("mctrue.fNue*", 1);
00156   chain->SetBranchStatus("mctrue.leptonMom*", 1);
00157   chain->SetBranchStatus("mctrue.emShower*", 1);
00158   chain->SetBranchStatus("mctrue.trueVisible*", 1);
00159   chain->SetBranchStatus("mctrue.hadronic*", 1);
00160   chain->SetBranchStatus("mctrue.atomic*", 1);
00161   chain->SetBranchStatus("mctrue.resonance*", 1);
00162   chain->SetBranchStatus("mctrue.q2", 1);
00163   chain->SetBranchStatus("mctrue.w2", 1);
00164   chain->SetBranchStatus("mctrue.bj*", 1);
00165   chain->SetBranchStatus("mctrue.target*", 1);
00166   chain->SetBranchStatus("mctrue.nonOscNuFlavor*", 1);
00167   chain->SetBranchStatus("mctrue.initialState", 1);
00168                                                                                 
00169   chain->SetBranchStatus("srevent*", 0);
00170   chain->SetBranchStatus("srevent.vtx*", 1);
00171   chain->SetBranchStatus("srevent.vtxM*", 0);
00172   chain->SetBranchStatus("srevent.ph*", 1);
00173   chain->SetBranchStatus("srevent.triggerTime", 1);
00174   chain->SetBranchStatus("srevent.spillType", 1);
00175   chain->SetBranchStatus("srevent.coil*", 1);
00176   chain->SetBranchStatus("srevent.liTime", 1);
00177   chain->SetBranchStatus("srevent.eventTimeMin", 1);
00178   chain->SetBranchStatus("srevent.rcBoundary", 1);
00179   chain->SetBranchStatus("srevent.daveFD*", 1);
00180   chain->SetBranchStatus("fHeader*", 0);
00181   chain->SetBranchStatus("fHeader.fVld*", 1);
00182   chain->SetBranchStatus("fHeader.fRelease", 1);
00183   chain->SetBranchStatus("srevent.tracks",1);
00184   chain->SetBranchStatus("anainfo.abCCPID",1);
00185 
00186 }
00187 
00188 Double_t NueExtrapHelper::GetNueEnergy(Selection::Selection_t sel)
00189 {
00190   return this->GetNueEnergy(fRecord, sel);
00191 }
00192 
00193 Double_t NueExtrapHelper::GetNueEnergy(NueRecord * nRecord, Selection::Selection_t sel)
00194 {
00195   double ntupleEnergy = nRecord->srevent.phNueGeV;
00196   if(sel != Selection::kCC){
00197     return ntupleEnergy;
00198   }
00199   else{
00200    Double_t recoE = 0.0;
00201    if(nRecord->srtrack.phCCGeV > 0) recoE += nRecord->srtrack.phCCGeV;
00202    if(nRecord->srshower.phCCGeV > 0) recoE += nRecord->srshower.phCCGeV;
00203    return recoE;
00204   }
00205 
00206   // Killed by above at present
00207   Double_t fracDiff = 0;
00208   Double_t corEnergy = ntupleEnergy;
00209   if(fracDiff+1!=0) corEnergy /= (fracDiff+1);
00210   return corEnergy;
00211 }

Generated on Mon Feb 15 11:07:11 2010 for loon by  doxygen 1.3.9.1