OscFit::EventCalculator Class Reference

#include <EventCalculator.h>

List of all members.

Public Member Functions

EventReweight (Event *event, Systematic_t systematic, Shift_t shift)
Double_t GetOscWeight (Event *event, GridPoint *gridPoint=NULL, Bool_t combineWeights=false)
Double_t GetOscWeightVacuum (Event *event, GridPoint *gridPoint=NULL, Bool_t combineWeights=false)
Double_t GetOscWeightMatter (Event *event, GridPoint *gridPoint=NULL, Bool_t combineWeights=false)

Static Public Member Functions

static EventCalculatorInstance ()

Private Member Functions

 EventCalculator ()
 ~EventCalculator ()
EventReweightAtmosData (Event *event, Systematic_t systematic, Shift_t shift)
EventReweightBeamData (Event *event, Systematic_t systematic, Shift_t shift)
Double_t GetOscProb (OscType_t osctype, Source_t source, Flavour_t flavour, Charge_t charge, Double_t energy, Double_t costheta, Double_t height, GridPoint *gridPoint)
Double_t GetOscProb3Flav (OscType_t osctype, Source_t source, Flavour_t flavour, Charge_t charge, Double_t energy, Double_t costheta, Double_t height, GridPoint *gridPoint)
Double_t GetOscProb2Flav (OscType_t osctype, Source_t source, Flavour_t flavour, Charge_t charge, Double_t energy, Double_t costheta, Double_t height, Double_t dmsq, Double_t sinsq=1.0)

Private Attributes

EventfEvent

Detailed Description

Definition at line 12 of file EventCalculator.h.


Constructor & Destructor Documentation

EventCalculator::EventCalculator (  )  [private]

Definition at line 25 of file EventCalculator.cxx.

References fEvent.

Referenced by Instance().

00026 {
00027   fEvent = new Event();
00028 }

EventCalculator::~EventCalculator (  )  [private]

Definition at line 30 of file EventCalculator.cxx.

References fEvent.

00031 {
00032   delete fEvent;
00033 }


Member Function Documentation

Double_t EventCalculator::GetOscProb ( OscType_t  osctype,
Source_t  source,
Flavour_t  flavour,
Charge_t  charge,
Double_t  energy,
Double_t  costheta,
Double_t  height,
GridPoint gridPoint 
) [private]

Definition at line 499 of file EventCalculator.cxx.

References GetOscProb3Flav().

Referenced by GetOscWeight().

00500 {
00501   return GetOscProb3Flav( osctype, source, flavour, charge, 
00502                           energy, costheta, height, gridPoint );
00503 }

Double_t EventCalculator::GetOscProb2Flav ( OscType_t  osctype,
Source_t  source,
Flavour_t  flavour,
Charge_t  charge,
Double_t  energy,
Double_t  costheta,
Double_t  height,
Double_t  dmsq,
Double_t  sinsq = 1.0 
) [private]

Definition at line 541 of file EventCalculator.cxx.

References Instance(), OscFit::kAtmosData, OscFit::kNonOsc, OscFit::kNoOsc, OscFit::kNue2Nutau, OscFit::kNumu, OscFit::kNumu2Nue, OscFit::kNumu2Nutau, and OscFit::kNutau.

00542 { 
00543   // Checks on Data
00544   if( osctype==OscFit::kNonOsc ) return 1.0;
00545 
00546   // Checks on Flavour 
00547   if( osctype==OscFit::kNoOsc      && flavour!=OscFit::kNumu  ) return 1.0;  // Numu<->Numu
00548   if( osctype==OscFit::kNumu2Nutau && flavour!=OscFit::kNutau ) return 0.0;  // Numu<->Nutau
00549   if( osctype==OscFit::kNumu2Nue  ) return 0.0;
00550   if( osctype==OscFit::kNue2Nutau ) return 0.0;
00551 
00552   // Set up Two-Flavour Oscillations
00553   Double_t Lnu = 0.0;
00554   Double_t Enu = energy;
00555 
00556   if( source==OscFit::kAtmosData ){
00557     Lnu = Oscillation::Instance()->PropagationLengthThroughEarth( costheta, height );
00558   }
00559   else{
00560     Lnu = Oscillation::Instance()->GetPropagationLength();
00561   }
00562 
00563   // Calculate Oscillation Probability
00564   Double_t pOsc = sinsq*pow(sin(1.267*dmsq*Lnu/Enu),2.0);
00565 
00566   if( osctype==OscFit::kNumu2Nutau && flavour==OscFit::kNutau ) return pOsc;       // NuTau Appearance Probability
00567   if( osctype==OscFit::kNoOsc      && flavour==OscFit::kNumu  ) return 1.0 - pOsc; // NuMu  Survival Probability
00568  
00569   return 0.0;
00570 } 

Double_t EventCalculator::GetOscProb3Flav ( OscType_t  osctype,
Source_t  source,
Flavour_t  flavour,
Charge_t  charge,
Double_t  energy,
Double_t  costheta,
Double_t  height,
GridPoint gridPoint 
) [private]

Definition at line 505 of file EventCalculator.cxx.

References OscFit::GetPDG(), Instance(), OscFit::kAtmosData, OscFit::kNoFlavour, OscFit::kNonOsc, OscFit::kNoOsc, OscFit::OscillateBackward(), and OscFit::GridPoint::Oscillations().

Referenced by GetOscProb().

00506 {
00507   // Sanity Check
00508   if( gridPoint==0 ) return 0.0;
00509 
00510   // Checks on Data
00511   if( osctype==OscFit::kNonOsc ) return 1.0;
00512 
00513   // Checks on Flavour and Oscillations 
00514   if( flavour==OscFit::kNoFlavour 
00515    || gridPoint->Oscillations()==false ){
00516     if( osctype==OscFit::kNoOsc ) return 1.0;
00517     else                          return 0.0;
00518   }
00519 
00520   // Set up Three-Flavour Oscillations
00521   Oscillation::Instance()->SetParams( gridPoint );
00522 
00523   Int_t jpdg = OscFit::GetPDG( flavour, charge );
00524   Int_t ipdg = OscFit::OscillateBackward( jpdg, osctype );
00525 
00526   //
00527   //std::cout << " --- debug EventInfo: [" << AsString(osctype) << "][" << AsString(source) << "][" << AsString(flavour) << "][" << AsString(charge) << "], (E=" << energy << ", cosz=" << costheta << " h=" << height << ")" << std::endl;
00528   //std::cout << "           GridPoint: (i,j)=(" << ipdg << "," << jpdg << "), params:"; gridPoint->PrintParams();
00529   //
00530 
00531   // Calculate Oscillation Probability
00532   if( source==OscFit::kAtmosData ){
00533     return Oscillation::Instance()->OscProb( ipdg, jpdg, energy, 
00534                                              costheta, height );
00535   }
00536   else{
00537     return Oscillation::Instance()->OscProb( ipdg, jpdg, energy );
00538   }
00539 }

Double_t EventCalculator::GetOscWeight ( Event event,
GridPoint gridPoint = NULL,
Bool_t  combineWeights = false 
)

Definition at line 436 of file EventCalculator.cxx.

References GetOscProb(), OscFit::kNonOsc, OscFit::kNoOsc, OscFit::kNue2Nutau, OscFit::kNumu2Nue, OscFit::kNumu2Nutau, OscFit::Event::Numu2Nue, OscFit::Event::OscType, OscFit::Event::Source, OscFit::Event::TrueCharge, OscFit::Event::TrueCosZen, OscFit::Event::TrueEnu, OscFit::Event::TrueFlavour, OscFit::Event::TrueHeight, and OscFit::Event::TrueHeightNumu2Nue.

Referenced by GetOscWeightMatter(), and GetOscWeightVacuum().

00437 {  
00438   // get event type
00439   OscType_t myOscType = myEvent->OscType;
00440 
00441   // non-neutrino samples
00442   if( myOscType==kNonOsc ) return 1.0;
00443 
00444   // no oscillations
00445   if( gridPoint==NULL ){
00446     if( myOscType==kNoOsc ) return 1.0;
00447     else                    return 0.0;
00448   }
00449 
00450   // calculate oscillation probability
00451   Double_t oscWeight = this->GetOscProb( myOscType,
00452                                          myEvent->Source,
00453                                          myEvent->TrueFlavour, 
00454                                          myEvent->TrueCharge, 
00455                                          myEvent->TrueEnu,
00456                                          myEvent->TrueCosZen,
00457                                          myEvent->TrueHeight,
00458                                          gridPoint );
00459 
00460   // combine NoOsc/Numu2Nue and Numu2Nutau/Nue2Nutau 
00461   if( combineWeights ){
00462 
00463     // combine NoOsc and Numu2Nue 
00464     if( myOscType==kNoOsc ){
00465       oscWeight += myEvent->Numu2Nue
00466                  * this->GetOscProb( kNumu2Nue,
00467                                      myEvent->Source,
00468                                      myEvent->TrueFlavour, 
00469                                      myEvent->TrueCharge, 
00470                                      myEvent->TrueEnu,
00471                                      myEvent->TrueCosZen,
00472                                      myEvent->TrueHeightNumu2Nue,
00473                                      gridPoint );
00474     }
00475     if( myOscType==kNumu2Nue ){
00476       oscWeight = 0.0;
00477     }
00478 
00479     // combine Numu2Nutau and Nue2Nutau 
00480     if( myOscType==kNumu2Nutau ){
00481       oscWeight += myEvent->Numu2Nue
00482                  * this->GetOscProb( kNue2Nutau,
00483                                      myEvent->Source,
00484                                      myEvent->TrueFlavour, 
00485                                      myEvent->TrueCharge, 
00486                                      myEvent->TrueEnu,
00487                                      myEvent->TrueCosZen,
00488                                      myEvent->TrueHeightNumu2Nue,
00489                                      gridPoint );
00490     }
00491     if( myOscType==kNue2Nutau ){
00492       oscWeight = 0.0;
00493     }
00494   }
00495 
00496   return oscWeight;
00497 }

Double_t EventCalculator::GetOscWeightMatter ( Event event,
GridPoint gridPoint = NULL,
Bool_t  combineWeights = false 
)

Definition at line 423 of file EventCalculator.cxx.

References GetOscWeight(), and Instance().

00424 {  
00425   Bool_t saveMatter = Oscillation::Instance()->DoingMatterEffects();
00426 
00427   Oscillation::Instance()->DoMatterEffects(true);
00428 
00429   Double_t weight = this->GetOscWeight( myEvent, gridPoint, combineWeights );
00430 
00431   Oscillation::Instance()->DoMatterEffects(saveMatter);
00432 
00433   return weight;
00434 }

Double_t EventCalculator::GetOscWeightVacuum ( Event event,
GridPoint gridPoint = NULL,
Bool_t  combineWeights = false 
)

Definition at line 410 of file EventCalculator.cxx.

References GetOscWeight(), and Instance().

00411 {  
00412   Bool_t saveMatter = Oscillation::Instance()->DoingMatterEffects();
00413 
00414   Oscillation::Instance()->DoMatterEffects(false);
00415 
00416   Double_t weight = this->GetOscWeight( myEvent, gridPoint, combineWeights );
00417 
00418   Oscillation::Instance()->DoMatterEffects(saveMatter);
00419 
00420   return weight;
00421 }

EventCalculator * EventCalculator::Instance (  )  [static]

Definition at line 16 of file EventCalculator.cxx.

References EventCalculator().

Referenced by GetOscProb2Flav(), GetOscProb3Flav(), GetOscWeightMatter(), and GetOscWeightVacuum().

00017 {
00018   if( !fgEventCalculator ){
00019     fgEventCalculator = new EventCalculator();
00020   }
00021 
00022   return fgEventCalculator;
00023 }

Event * EventCalculator::Reweight ( Event event,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 35 of file EventCalculator.cxx.

References OscFit::kAtmosData, OscFit::kBeamData, OscFit::kCentre, OscFit::kNoShift, ReweightAtmosData(), ReweightBeamData(), and OscFit::Event::Source.

00036 {
00037   if( event==0 
00038    || systematic==kCentre
00039    || shift==kNoShift ) return event;
00040 
00041   switch( event->Source ){
00042     case kAtmosData: return ReweightAtmosData( event, systematic, shift );
00043     case kBeamData:  return ReweightBeamData( event, systematic, shift );
00044     default:         return event;
00045   }
00046 
00047   return 0;
00048 }

Event * EventCalculator::ReweightAtmosData ( Event event,
Systematic_t  systematic,
Shift_t  shift 
) [private]

Definition at line 50 of file EventCalculator.cxx.

References fEvent, OscFit::Configuration::Instance(), OscFit::Event::Inu, OscFit::kCentre, OscFit::kCosmic, OscFit::kCV, OscFit::kData, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNoShift, OscFit::kNue, OscFit::kNueEnergy, OscFit::kNumu, OscFit::kPlus1, OscFit::kPlus2, OscFit::kRock, OscFit::kShwEn, OscFit::kSpec, OscFit::kTrkEn, OscFit::kTrkEnExit, OscFit::kZenith, OscFit::OscillateBackward(), OscFit::Event::OscType, OscFit::Event::RecoEmu, OscFit::Event::RecoEnergy, OscFit::Event::RecoEnu, OscFit::Event::RecoEshw, OscFit::Event::RecoExiting, OscFit::Event::RecoFlavour, OscFit::Event::Sample, OscFit::Event::Set(), OscFit::Event::Shift, OscFit::Event::ShiftedEnergy, OscFit::Syst_Atmos_CV_Spec_Nue(), OscFit::Syst_Atmos_CV_Spec_NueBar(), OscFit::Syst_Atmos_CV_Spec_Numu(), OscFit::Syst_Atmos_CV_Spec_NumuBar(), OscFit::Syst_Atmos_CV_UpDnRatio(), OscFit::Syst_Atmos_Nue_Energy(), OscFit::Syst_Atmos_Numu_ShwEn(), OscFit::Syst_Atmos_Numu_TrkEn(), OscFit::Syst_Atmos_Numu_TrkEn_Exit(), OscFit::Syst_Atmos_Rock_Spec_Nu(), OscFit::Syst_Atmos_Rock_Spec_NuBar(), OscFit::Event::Systematic, OscFit::Event::TrueCosZen, OscFit::Event::TrueEmu, OscFit::Event::TrueEnu, OscFit::Event::TrueEshw, OscFit::Event::TrueFlavour, and OscFit::Event::Weight.

Referenced by Reweight().

00051 {
00052   // initialisation
00053   // ==============
00054   fEvent->Set(event);
00055 
00056   fEvent->Systematic = mySystematic;
00057   fEvent->Shift      = myShift;
00058 
00059   fEvent->ShiftedEnergy = 0;
00060 
00061   if( fEvent->Sample==OscFit::kData
00062    || fEvent->Sample==OscFit::kCosmic 
00063    || fEvent->Systematic==OscFit::kCentre
00064    || fEvent->Shift==OscFit::kNoShift
00065    || fEvent->TrueEnu<=0.0 ) return fEvent;
00066 
00067   // size of shift
00068   // =============
00069   Double_t shift = 0.0;
00070 
00071   if( myShift==OscFit::kPlus2  ) shift = +2.0;
00072   if( myShift==OscFit::kPlus1  ) shift = +1.0;
00073   if( myShift==OscFit::kMinus1 ) shift = -1.0;
00074   if( myShift==OscFit::kMinus2 ) shift = -2.0;
00075 
00076   if( shift==0 ) return fEvent;
00077 
00078   // spectral index
00079   // ==============
00080   if( mySystematic==OscFit::kSpec ){
00081 
00082     Double_t enustop    = 0.0;
00083     Double_t enufix     = 0.0;
00084     Double_t enuspec    = 0.0;  
00085     Double_t sigmaspec  = 0.0;  
00086     Double_t specweight = 2.0;
00087     Double_t enu        = fEvent->TrueEnu;
00088 
00089     // get parent neutrino 
00090     Int_t parentInu = OscFit::OscillateBackward( fEvent->Inu, fEvent->OscType ); 
00091 
00092     // contained-vertex muons
00093     if( fEvent->Sample==OscFit::kCV ){
00094       enuspec = 3.0; 
00095       if( fabs(parentInu)==12 ){
00096         if( parentInu>0 ) sigmaspec = OscFit::Syst_Atmos_CV_Spec_Nue();
00097         if( parentInu<0 ) sigmaspec = OscFit::Syst_Atmos_CV_Spec_NueBar();
00098       }
00099       else{
00100         if( parentInu>0 ) sigmaspec = OscFit::Syst_Atmos_CV_Spec_Numu();
00101         if( parentInu<0 ) sigmaspec = OscFit::Syst_Atmos_CV_Spec_NumuBar();
00102       }
00103     }
00104 
00105     // neutrino-induced muons
00106     else if( fEvent->Sample==OscFit::kRock ){
00107       enuspec = 30.0; 
00108       if( parentInu>0 ) sigmaspec = OscFit::Syst_Atmos_Rock_Spec_Nu();
00109       if( parentInu<0 ) sigmaspec = OscFit::Syst_Atmos_Rock_Spec_NuBar();
00110     }
00111 
00112     // note: positive shift lifts low energies
00113     if( enuspec>0.0 && sigmaspec>0.0 ){
00114       if( enu>0 && enu<=enuspec ){ 
00115         fEvent->Weight *= 1.0 + shift*sigmaspec*specweight*(enu-enuspec)/enuspec;
00116       }
00117       else if( enu>enuspec ){
00118         enustop = enuspec*exp(1.0/(2.0*sigmaspec));  // a fix to keep
00119         enufix  = enustop*(1.0-exp(-enu/enustop));   //  -1<weight<+1
00120         fEvent->Weight *= 1.0 + shift*sigmaspec*(log(enufix/enuspec));
00121       }
00122     }
00123   }
00124 
00125   // muon energy (stopping)
00126   // ======================
00127   if( mySystematic==OscFit::kTrkEn
00128    && fEvent->TrueFlavour==OscFit::kNumu
00129    && fEvent->RecoFlavour==OscFit::kNumu
00130    && fEvent->RecoExiting==0 ){
00131 
00132     Double_t shift_energy = shift*OscFit::Syst_Atmos_Numu_TrkEn();
00133     Double_t delta_energy = 0.0;
00134 
00135     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00136       if( shift_energy<-1.0 ) shift_energy = -1.0;
00137       delta_energy = shift_energy*fEvent->RecoEmu;
00138    
00139       fEvent->RecoEmu    += delta_energy;
00140       fEvent->RecoEnu    += delta_energy;
00141       fEvent->RecoEnergy += delta_energy;
00142     }
00143     else{
00144       if( shift_energy>+1.0 ) shift_energy = +1.0;
00145       delta_energy = shift_energy*fEvent->TrueEmu;
00146    
00147       fEvent->TrueEmu  -= delta_energy;
00148       fEvent->TrueEnu  -= delta_energy;
00149       fEvent->ShiftedEnergy = true;
00150     }
00151   }
00152 
00153   // muon energy (exiting)
00154   // =====================
00155   if( mySystematic==OscFit::kTrkEnExit
00156    && fEvent->TrueFlavour==OscFit::kNumu
00157    && fEvent->RecoFlavour==OscFit::kNumu 
00158    && fEvent->RecoExiting==1 ){
00159 
00160     Double_t shift_energy = shift*OscFit::Syst_Atmos_Numu_TrkEn_Exit();
00161     Double_t delta_energy = 0.0;
00162 
00163     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00164       if( shift_energy<-1.0 ) shift_energy = -1.0;
00165       delta_energy = shift_energy*fEvent->RecoEmu;
00166    
00167       fEvent->RecoEmu    += delta_energy;
00168       fEvent->RecoEnu    += delta_energy;
00169       fEvent->RecoEnergy += delta_energy;
00170     }
00171     else{
00172       if( shift_energy>+1.0 ) shift_energy = +1.0;
00173       delta_energy = shift_energy*fEvent->TrueEmu;
00174    
00175       fEvent->TrueEmu  -= delta_energy;
00176       fEvent->TrueEnu  -= delta_energy;
00177       fEvent->ShiftedEnergy = true;
00178     }
00179   }
00180 
00181   // electromagnetic energy
00182   // ======================
00183   if( mySystematic==OscFit::kNueEnergy
00184    && fEvent->TrueFlavour==OscFit::kNue
00185    && fEvent->RecoFlavour==OscFit::kNue ){
00186 
00187     Double_t shift_energy = shift*OscFit::Syst_Atmos_Nue_Energy();
00188     Double_t delta_energy = 0.0;
00189 
00190     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00191       if( shift_energy<-1.0 ) shift_energy = -1.0;
00192       delta_energy = shift_energy*(fEvent->RecoEnu-fEvent->RecoEshw);
00193    
00194       fEvent->RecoEshw   += delta_energy;
00195       fEvent->RecoEnu    += delta_energy;
00196       fEvent->RecoEnergy += delta_energy;
00197     }
00198     else{
00199       if( shift_energy>+1.0 ) shift_energy = +1.0;
00200       delta_energy = shift_energy*(fEvent->TrueEnu-fEvent->TrueEshw);
00201 
00202       fEvent->TrueEshw  -= delta_energy;
00203       fEvent->TrueEnu   -= delta_energy;
00204       fEvent->ShiftedEnergy = true;
00205     }
00206   }
00207 
00208   // hadronic shower energy
00209   // ======================
00210   if( mySystematic==OscFit::kShwEn ){
00211 
00212     Double_t shift_energy = shift*OscFit::Syst_Atmos_Numu_ShwEn();
00213     Double_t delta_energy = 0.0;
00214 
00215     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00216       if( shift_energy<-1.0 ) shift_energy = -1.0;
00217       delta_energy = shift_energy*fEvent->RecoEshw;
00218    
00219       fEvent->RecoEshw   += delta_energy;
00220       fEvent->RecoEnu    += delta_energy;
00221       fEvent->RecoEnergy += delta_energy;
00222     }
00223     else{
00224       if( shift_energy>+1.0 ) shift_energy = +1.0;
00225       delta_energy = shift_energy*fEvent->TrueEshw;
00226 
00227       fEvent->TrueEshw  -= delta_energy;
00228       fEvent->TrueEnu   -= delta_energy;
00229       fEvent->ShiftedEnergy = true;
00230     }
00231   }
00232 
00233   // zenith angle
00234   // ============
00235   if( mySystematic==OscFit::kZenith ){
00236 
00237     Double_t shift_updn = shift*OscFit::Syst_Atmos_CV_UpDnRatio(); 
00238 
00239     if( fEvent->TrueCosZen>=0.0 ) fEvent->Weight *= 1.0 - 0.5*shift_updn; // down-going
00240     else                          fEvent->Weight *= 1.0 + 0.5*shift_updn; // up-going
00241   }
00242 
00243   return fEvent;
00244 }

Event * EventCalculator::ReweightBeamData ( Event event,
Systematic_t  systematic,
Shift_t  shift 
) [private]

Definition at line 246 of file EventCalculator.cxx.

References fEvent, OscFit::Configuration::Instance(), OscFit::kCentre, OscFit::kCosmic, OscFit::kData, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNC, OscFit::kNCbkg, OscFit::kNoShift, OscFit::kNue, OscFit::kNueEnergy, OscFit::kNueNCbkg, OscFit::kNumu, OscFit::kPlus1, OscFit::kPlus2, OscFit::kShwEn, OscFit::kTrkEn, OscFit::kTrkEnExit, OscFit::Event::RecoEmu, OscFit::Event::RecoEnergy, OscFit::Event::RecoEnu, OscFit::Event::RecoEshw, OscFit::Event::RecoExiting, OscFit::Event::RecoFlavour, OscFit::Event::Sample, OscFit::Event::Set(), OscFit::Event::Shift, OscFit::Event::ShiftedEnergy, OscFit::Syst_Beam_Nue_Energy(), OscFit::Syst_Beam_Nue_NCBkg(), OscFit::Syst_Beam_Numu_NCBkg(), OscFit::Syst_Beam_Numu_ShwEn(), OscFit::Syst_Beam_Numu_TrkEn(), OscFit::Syst_Beam_Numu_TrkEn_Exit(), OscFit::Event::Systematic, OscFit::Event::TrueEmu, OscFit::Event::TrueEnu, OscFit::Event::TrueEshw, OscFit::Event::TrueFlavour, and OscFit::Event::Weight.

Referenced by Reweight().

00247 {  
00248   // initialisation
00249   // ==============
00250   fEvent->Set( event );
00251 
00252   fEvent->Systematic = mySystematic;
00253   fEvent->Shift      = myShift;
00254 
00255   fEvent->ShiftedEnergy = 0;
00256 
00257   if( fEvent->Sample==OscFit::kData
00258    || fEvent->Sample==OscFit::kCosmic 
00259    || fEvent->Systematic==OscFit::kCentre
00260    || fEvent->Shift==OscFit::kNoShift
00261    || fEvent->TrueEnu<=0.0 ) return fEvent;
00262 
00263   // size of shift
00264   // =============
00265   Double_t shift = 0.0;
00266 
00267   if( myShift==OscFit::kPlus2  ) shift = +2.0;
00268   if( myShift==OscFit::kPlus1  ) shift = +1.0;
00269   if( myShift==OscFit::kMinus1 ) shift = -1.0;
00270   if( myShift==OscFit::kMinus2 ) shift = -2.0;
00271 
00272   if( shift==0 ) return fEvent;
00273 
00274   // Numu-NC background
00275   // ==================
00276   if( mySystematic==OscFit::kNCbkg
00277    && fEvent->RecoFlavour==OscFit::kNumu
00278    && fEvent->TrueFlavour==OscFit::kNC ){
00279  
00280     Double_t shift_nc = shift*OscFit::Syst_Beam_Numu_NCBkg();
00281     if( shift_nc<-1.0 ) shift_nc = -1.0;
00282 
00283     fEvent->Weight *= 1.0 + shift_nc;
00284   }
00285 
00286   // Nue-NC background
00287   // ==================
00288   if( mySystematic==OscFit::kNueNCbkg
00289    && fEvent->RecoFlavour==OscFit::kNue
00290    && fEvent->TrueFlavour==OscFit::kNC ){
00291  
00292     Double_t shift_nc = shift*OscFit::Syst_Beam_Nue_NCBkg();
00293     if( shift_nc<-1.0 ) shift_nc = -1.0;
00294 
00295     fEvent->Weight *= 1.0 + shift_nc;
00296   }
00297 
00298   // muon energy (stopping)
00299   // ======================
00300   if( mySystematic==OscFit::kTrkEn
00301    && fEvent->TrueFlavour==OscFit::kNumu
00302    && fEvent->RecoFlavour==OscFit::kNumu
00303    && fEvent->RecoExiting==0 ){
00304 
00305     Double_t shift_energy = shift*OscFit::Syst_Beam_Numu_TrkEn();
00306     Double_t delta_energy = 0.0;
00307 
00308     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00309       if( shift_energy<-1.0 ) shift_energy = -1.0;
00310       delta_energy = shift_energy*fEvent->RecoEmu;
00311    
00312       fEvent->RecoEmu    += delta_energy;
00313       fEvent->RecoEnu    += delta_energy;
00314       fEvent->RecoEnergy += delta_energy;
00315     }
00316     else{
00317       if( shift_energy>+1.0 ) shift_energy = +1.0;
00318       delta_energy = shift_energy*fEvent->TrueEmu;
00319    
00320       fEvent->TrueEmu  -= delta_energy;
00321       fEvent->TrueEnu  -= delta_energy;
00322       fEvent->ShiftedEnergy = true;
00323     }
00324   }
00325 
00326   // muon energy (exiting)
00327   // =====================
00328   if( mySystematic==OscFit::kTrkEnExit
00329    && fEvent->TrueFlavour==OscFit::kNumu
00330    && fEvent->RecoFlavour==OscFit::kNumu 
00331    && fEvent->RecoExiting==1 ){
00332 
00333     Double_t shift_energy = shift*OscFit::Syst_Beam_Numu_TrkEn_Exit();
00334     Double_t delta_energy = 0.0;
00335 
00336     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00337       if( shift_energy<-1.0 ) shift_energy = -1.0;
00338       delta_energy = shift_energy*fEvent->RecoEmu;
00339    
00340       fEvent->RecoEmu    += delta_energy;
00341       fEvent->RecoEnu    += delta_energy;
00342       fEvent->RecoEnergy += delta_energy;
00343     }
00344     else{
00345       if( shift_energy>+1.0 ) shift_energy = +1.0;
00346       delta_energy = shift_energy*fEvent->TrueEmu;
00347    
00348       fEvent->TrueEmu  -= delta_energy;
00349       fEvent->TrueEnu  -= delta_energy;
00350       fEvent->ShiftedEnergy = true;
00351     }
00352   }
00353 
00354   // electromagnetic energy
00355   // ======================
00356   if( mySystematic==OscFit::kNueEnergy
00357    && fEvent->TrueFlavour==OscFit::kNue
00358    && fEvent->RecoFlavour==OscFit::kNue ){
00359 
00360     Double_t shift_energy = shift*OscFit::Syst_Beam_Nue_Energy();
00361     Double_t delta_energy = 0.0;
00362 
00363     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00364       if( shift_energy<-1.0 ) shift_energy = -1.0;
00365       delta_energy = shift_energy*(fEvent->RecoEnu-fEvent->RecoEshw);
00366    
00367       fEvent->RecoEshw   += delta_energy;
00368       fEvent->RecoEnu    += delta_energy;
00369       fEvent->RecoEnergy += delta_energy;
00370     }
00371     else{
00372       if( shift_energy>+1.0 ) shift_energy = +1.0;
00373       delta_energy = shift_energy*(fEvent->TrueEnu-fEvent->TrueEshw);
00374 
00375       fEvent->TrueEshw  -= delta_energy;
00376       fEvent->TrueEnu   -= delta_energy;
00377       fEvent->ShiftedEnergy = true;
00378     }
00379   }
00380 
00381   // hadronic shower energy
00382   // ======================
00383   if( mySystematic==OscFit::kShwEn ){
00384 
00385     Double_t shift_energy = shift*OscFit::Syst_Beam_Numu_ShwEn();
00386     Double_t delta_energy = 0.0;
00387 
00388     if( Configuration::Instance()->DoingSystematicsInRecoEnergy()==true ){
00389       if( shift_energy<-1.0 ) shift_energy = -1.0;
00390       delta_energy = shift_energy*fEvent->RecoEshw;
00391    
00392       fEvent->RecoEshw   += delta_energy;
00393       fEvent->RecoEnu    += delta_energy;
00394       fEvent->RecoEnergy += delta_energy;
00395     }
00396     else{
00397       if( shift_energy>+1.0 ) shift_energy = +1.0;
00398       delta_energy = shift_energy*fEvent->TrueEshw;
00399 
00400       fEvent->TrueEshw  -= delta_energy;
00401       fEvent->TrueEnu   -= delta_energy;
00402       fEvent->ShiftedEnergy = true;
00403     }
00404   }
00405 
00406 
00407   return fEvent;
00408 }


Member Data Documentation


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

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1