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

EnergyCorrections Namespace Reference

Track Energy/Momentum Correction. More...


Typedefs

typedef enum EnergyCorrections::EWhichCorrection WhichCorrection_t
typedef enum EnergyCorrections::ECorrectionVersion CorrectionVersion_t

Enumerations

enum  EWhichCorrection {
  kDefault = 0, kVersion1, kVersion2, kVersion3,
  kVersion4, kVersion5, kVersion6, kNoCalGroup
}
enum  ECorrectionVersion { kUnknown, kBirch, kCedar }

Functions

float FullyCorrectShowerEnergy (float E, const CandShowerHandle::ShowerType_t &st, VldContext vc, ReleaseType::Release_t release, EnergyCorrections::WhichCorrection_t whichCor=EnergyCorrections::kDefault)
float FullyCorrectMomentumFromRange (float p, VldContext vc, ReleaseType::Release_t release, EnergyCorrections::WhichCorrection_t whichCor=EnergyCorrections::kDefault)
 Track Energy/Momentum Correction.
float FullyCorrectEnergyFromRange (float E, VldContext vc, ReleaseType::Release_t release, EnergyCorrections::WhichCorrection_t whichCor=EnergyCorrections::kDefault)
float FullyCorrectSignedMomentumFromCurvature (float p, VldContext vc, ReleaseType::Release_t release, EnergyCorrections::WhichCorrection_t whichCor=EnergyCorrections::kDefault)
float CalibrationGroupEnergyCorrections (float E, VldContext vc, ReleaseType::Release_t release, EnergyCorrections::WhichCorrection_t whichCor=EnergyCorrections::kDefault)
float ShowerEnergyCorrectionNearCedarPhyBhcurve (float energy, const CandShowerHandle::ShowerType_t &st, EnergyCorrections::WhichCorrection_t whichCor)
float ShowerEnergyCorrectionFarCedarPhyBhcurve (float energy, const CandShowerHandle::ShowerType_t &st, EnergyCorrections::WhichCorrection_t whichCor)
float ShowerEnergyCorrectionNearCedar (float energy, const CandShowerHandle::ShowerType_t &st, EnergyCorrections::WhichCorrection_t whichCor)
float ShowerEnergyCorrectionFarCedar (float energy, const CandShowerHandle::ShowerType_t &st, EnergyCorrections::WhichCorrection_t whichCor)
float MasakiNearDec15th (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiFarDec15th (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiNearDec15thScaled (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiFarDec15thScaled (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiNearMay17th (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiFarMay17th (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiNearMay17thScaled (float energy, const CandShowerHandle::ShowerType_t &st)
float MasakiFarMay17thScaled (float energy, const CandShowerHandle::ShowerType_t &st)
float SignedMomentumCurvatureCorrectionCedar (float p, VldContext vc, WhichCorrection_t whichCor)
float SignedMomentumCurvatureCorrectionBirch (float p, VldContext vc, WhichCorrection_t whichCor)
float MomentumRangeCorrectionBirch (float p, VldContext vc, WhichCorrection_t whichCor)
float MomentumRangeCorrectionCedar (float p, VldContext vc, WhichCorrection_t whichCor)
float EnergyRangeCorrectionCedar (float E, VldContext vc, WhichCorrection_t whichCor)
float ShowerEnergyConversionDogwood (float E, VldContext vc)
float WeightedShowerEnergyConversionDogwood (float E, VldContext vc)
void SetCorrectionVersion (const CorrectionVersion_t &ver, Short_t subver=0)
std::string GetCorrectionAsString ()
void WarnUnknownVersion (const char *caller_routine)
CorrectionVersion_t VersionFromFilename (const char *)
float CorrectMomentumFromRange (float p, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectEnergyFromRange (float E, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectSignedMomentumFromCurvature (float p, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectShowerEnergy (float E, const Detector::Detector_t &det, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)
float CorrectShowerEnergyNear (float E, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)
float CorrectShowerEnergyFar (float E, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)
float CorrectMomentumFromRange_Birch (float p, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectSignedMomentumFromCurvature_Birch (float p, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectShowerEnergyNear_Birch (float E, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)
float CorrectShowerEnergyFar_Birch (float E, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)
float CorrectMomentumFromRange_Cedar (float p, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectSignedMomentumFromCurvature_Cedar (float p, bool isdata=true, Detector::Detector_t det=Detector::kNear)
float CorrectShowerEnergyNear_Cedar (float E, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)
float CorrectShowerEnergyFar_Cedar (float E, const CandShowerHandle::ShowerType_t &st, int mode=1, bool isdata=true)

Variables

const float cgffBirchDataFD = 1.018
const float cgffCedarPhyDataFD = 0.9988
const float cgffCedarPhyDataND = 1.0039
const float cgffCedarR1_24_1MCFD = (0.001737/0.001786)
const float cgffCedarR1_24_1MCND = (0.001759/0.001792)
const float cgffCedarPhyDataFDOld = 0.996
const float cgffCedarPhyDataNDOld = 1.003
const float cgffCedarR1_24_1MCFDOld = 0.986
const float cgffCedarR1_24_1MCNDOld = 0.994
const float cgffCedarR1_24_2MCFD = cgffCedarR1_24_1MCFD*(0.001786/0.001737)
const float cgffCedarR1_24_2MCND = cgffCedarR1_24_1MCND*(0.001792/0.001759)
const float cgffCedarPhyDaikonND = 1
const float cgffCedarPhyDaikonFD = 1
CorrectionVersion_t fVersion = EnergyCorrections::kUnknown
Short_t fSubVersion = 0


Detailed Description

Track Energy/Momentum Correction.

kNoCalGroup = Nothing

Notes: The currently implemented corrections are: i) 1.8% FD data correction for PRL era data ii) The MC drift bug correction for Cedar MC iii) The preliminary data and MC fudge factors that tweak the MEU scale. The numbers are taken from DocDB 3139 by Jeff Hartnell and Tingjun Yang

Further notes: This routine uses the Calibrator, and requires read access to the offline database. At present, any up-to-date database will do. Note that this routine initializes a custom Calibrator on the first call; it should not interfere with other Calibrators you may be using.


Typedef Documentation

typedef enum EnergyCorrections::ECorrectionVersion EnergyCorrections::CorrectionVersion_t
 

Referenced by VersionFromFilename().

typedef enum EnergyCorrections::EWhichCorrection EnergyCorrections::WhichCorrection_t
 


Enumeration Type Documentation

enum ECorrectionVersion
 

Enumeration values:
kUnknown 
kBirch 
kCedar 

Definition at line 324 of file EnergyCorrections.h.

00324                                    {
00325       kUnknown,
00326       kBirch,
00327       kCedar
00328    } CorrectionVersion_t;

enum EWhichCorrection
 

Enumeration values:
kDefault 
kVersion1 
kVersion2 
kVersion3 
kVersion4 
kVersion5 
kVersion6 
kNoCalGroup 

Definition at line 215 of file EnergyCorrections.h.

00215                                  {
00216       kDefault=0,
00217       kVersion1,
00218       kVersion2,
00219       kVersion3,
00220       kVersion4,
00221       kVersion5,
00222       kVersion6,
00223       kNoCalGroup
00224    } WhichCorrection_t;


Function Documentation

float EnergyCorrections::CalibrationGroupEnergyCorrections float  E,
VldContext  vc,
ReleaseType::Release_t  release,
EnergyCorrections::WhichCorrection_t  whichCor = EnergyCorrections::kDefault
 

Definition at line 353 of file EnergyCorrections.cxx.

References ReleaseType::AsString(), Calibrator::CreateCustomCalibrator(), VldContext::GetDetector(), Calibrator::GetDriftCorrected(), ReleaseType::GetRecoInfo(), VldContext::GetSimFlag(), MsgService::GetStream(), MsgService::Instance(), ReleaseType::IsBirch(), ReleaseType::IsCedar(), ReleaseType::IsDaikon(), MAXMSG, CalScheme::Reset(), CfgPromptConfigurable::Set(), and MsgStream::SetLogLevel().

Referenced by CorrectionsForMasaki::CalibratedShowerEnergy(), MeuPlots::CalibrationGroupEnergyCorrections(), and FullyCorrectShowerEnergy().

00357 {
00358   //Nb: This function is called by FullyCorrectShowerEnergy, do not use it for CC Shower's
00359 
00360   float retval = E; // Default return value.
00361 
00362   MAXMSG("DataUtil",Msg::kInfo,1)
00363     << "CalibrationGroupEnergyCorrections:: Using Release Type: "
00364     << ReleaseType::AsString(release) << "\tusing correction version: "
00365     << whichCor << "\n";
00366   
00367   static Calibrator* customCalibrator = 0;
00368   if(customCalibrator ==0 ) {
00369     //Initialize. Disable warning that we're about to do something 'tricksy'.
00370     // This tricksyness is just to make a custom instance of the calibrator, so we don't
00371     // interfere with any other custom settings that the user (i.e. Jeff H) is doing
00372     // This is actually pretty safe, if an expert like me (Nathaniel) does it.
00373     MsgService::Instance()->GetStream("Calib")->SetLogLevel(Msg::kFatal);
00374     customCalibrator = Calibrator::CreateCustomCalibrator();
00375 
00376     // Turn off the units we aren't using, just to make them go faster.
00377     // "Speed holes!" -Homer Simpson
00378     
00379     customCalibrator->Set("Thermometer=SimpleCalScheme "
00380                           "PeCalibrator=SimpleCalScheme "
00381                           "LinCalibrator=SimpleCalScheme "
00382                           "StripCalibrator=SimpleCalScheme "
00383                           "AttenCalibrator=SimpleCalScheme "
00384                           "MIPCalibrator=SimpleCalScheme "
00385                           "TimeCalibrator=SimpleCalScheme ");
00386     MsgService::Instance()->GetStream("Calib")->SetLogLevel(Msg::kWarning);    
00387   }
00388 
00389 
00390 
00391   // Get the reconstruction version.
00392   ReleaseType::Release_t recoVers = ReleaseType::GetRecoInfo(release);
00393 
00394   // Fudge #0:
00395   // For PRL-era data, we fudged the FD data by 1.8%
00396   if(    ReleaseType::IsBirch(release)
00397          && vc.GetSimFlag()==SimFlag::kData
00398          && vc.GetDetector()==Detector::kFar ) 
00399     {
00400       MAXMSG("DataUtil",Msg::kInfo,1)
00401         << "EnergyCorrections -- Applying Birch Far Detector Factor ( "
00402         << EnergyCorrections::cgffBirchDataFD << ")\n";
00403       retval = retval*EnergyCorrections::cgffBirchDataFD;
00404     }
00405   
00406 
00407 
00408   if(ReleaseType::IsCedar(release) && whichCor!=EnergyCorrections::kNoCalGroup) {
00409     //
00410     // Fudge #1
00411     // Attempt to remove the MC bug, where the drift decalibration was applied with the wrong sign.
00412     // This is a time-dependent correction which should fix the problem for cedar-daikon MC R1.24.1 
00413     // This problem was fixed in R1.24.2 and R1.24.calB, but NOT R1.24.calA.
00414     //
00415     if(   ReleaseType::IsCedar(release) 
00416           && ReleaseType::IsDaikon(release) 
00417           && (recoVers < ReleaseType::kR1_24_2 || recoVers == ReleaseType::kR1_24_Cal )
00418           && vc.GetSimFlag()==SimFlag::kMC) 
00419       {
00420         // Removes MC bug where drift correction was applied twice.
00421         // Fix it by de-applying the drift twice.
00422         MAXMSG("DataUtil",Msg::kInfo,1)
00423           << "EnergyCorrections -- Applying Infamous MC Drift Bug Correction\n";
00424         
00425         customCalibrator->Reset(vc);
00426         float drift = customCalibrator->GetDriftCorrected(1.0,PlexStripEndId());
00427         retval = retval / (drift*drift);     
00428       }
00429     
00430     
00431     // Correction #2
00432     // These are the preliminary final corrections for the June 2007 cc box opening.
00433     // The numbers are taken from DocDB 3139 by Jeff Hartnell and Tingjun Yang
00434     // These are only applied if using the default (or version3) correction
00435     if(!(whichCor==EnergyCorrections::kVersion1 || whichCor==EnergyCorrections::kVersion2)) {
00436       
00437       if(vc.GetSimFlag()==SimFlag::kMC) {
00438         //For the Cedar MC we have the following possible datasets:
00439         // i) CedarDaikon -- used in Summer analysis 2007
00440         // ii) CedarPhyDaikon -- reprocessed by batch group over summer 2007
00441 
00442         if(ReleaseType::IsCedar(release) && recoVers<=ReleaseType::kR1_24_1) {
00443           //Now here we have two options either use the latest greatest numbers
00444           // or we use the old numbers from the 2007 summer analysis
00445           if(whichCor==kVersion3) {
00446             //Use the old numbers
00447             if(vc.GetDetector()==Detector::kFar) {
00448               MAXMSG("DataUtil",Msg::kInfo,1)
00449                 << "EnergyCorrections -- Applying R_1_24_1 (Summer 2007) Far MC Correction Factor"
00450                 << " (" << EnergyCorrections::cgffCedarR1_24_1MCFDOld << ")\n";
00451               retval*=EnergyCorrections::cgffCedarR1_24_1MCFDOld;
00452             }
00453             else if(vc.GetDetector()==Detector::kNear) {
00454               MAXMSG("DataUtil",Msg::kInfo,1)
00455                 << "EnergyCorrections -- Applying R_1_24_1 (Summer 2007) Near MC Correction Factor"
00456                 << " (" << EnergyCorrections::cgffCedarR1_24_1MCNDOld << ")\n";
00457               retval*=EnergyCorrections::cgffCedarR1_24_1MCNDOld;
00458             }
00459           }
00460           else {
00461             //Use the new numbers
00462             if(vc.GetDetector()==Detector::kFar) {
00463               MAXMSG("DataUtil",Msg::kInfo,1)
00464                 << "EnergyCorrections -- Applying R_1_24_1 (Fall 2007) Far MC Correction Factor"
00465                 << " (" << EnergyCorrections::cgffCedarR1_24_1MCFD << ")\n";
00466               retval*=EnergyCorrections::cgffCedarR1_24_1MCFD;
00467             }
00468             else if(vc.GetDetector()==Detector::kNear) {
00469               MAXMSG("DataUtil",Msg::kInfo,1)
00470                 << "EnergyCorrections -- Applying R_1_24_1 (Fall 2007) Near MC Correction Factor"
00471                 << " (" << EnergyCorrections::cgffCedarR1_24_1MCND << ")\n";
00472               retval*=EnergyCorrections::cgffCedarR1_24_1MCND;
00473             }
00474               
00475           }
00476         }
00477         else if(ReleaseType::IsCedar(release) && recoVers>=ReleaseType::kR1_24_2) 
00478           {
00479             //Changed because we updated the GevPerMIP number in the MC
00480             // reprocessing. Bloody annoying.     
00481             if(vc.GetDetector()==Detector::kFar) {
00482               MAXMSG("DataUtil",Msg::kInfo,1)
00483                 << "EnergyCorrections -- Applying R_1_24_2 (Fall 2007) Far MC Correction Factor"
00484                 << " (" << EnergyCorrections::cgffCedarR1_24_2MCFD << ")\n";
00485               retval*=EnergyCorrections::cgffCedarR1_24_2MCFD;
00486             }
00487             else if(vc.GetDetector()==Detector::kNear) {
00488               MAXMSG("DataUtil",Msg::kInfo,1)
00489                 << "EnergyCorrections -- Applying R_1_24_2 (Fall 2007) Near MC Correction Factor"
00490                 << " (" << EnergyCorrections::cgffCedarR1_24_2MCND << ")\n";
00491               retval*=EnergyCorrections::cgffCedarR1_24_2MCND;
00492             }
00493           }     
00494       }
00495       else if(vc.GetSimFlag()==SimFlag::kData) {
00496         //Data corrections only available for Cedar_Phy
00497         //Once again we are going to have the option to use the old or
00498         // the new numbers
00499         if(whichCor==kVersion3) {
00500           //Use the old numbers from the Summer 2007 analysis
00501           if(recoVers>=ReleaseType::kCedarPhy) {
00502             if(vc.GetDetector()==Detector::kFar) {
00503               MAXMSG("DataUtil",Msg::kInfo,1)
00504                 << "EnergyCorrections -- Applying CedarPhy (Summer 2007) Far Correction Factor"
00505                 << " (" << EnergyCorrections::cgffCedarPhyDataFDOld << ")\n";
00506               retval*=EnergyCorrections::cgffCedarPhyDataFDOld;
00507             }
00508             else if(vc.GetDetector()==Detector::kNear) {
00509               MAXMSG("DataUtil",Msg::kInfo,1)
00510                 << "EnergyCorrections -- Applying CedarPhy (Summer 2007) Near Correction Factor"
00511                 << " (" << EnergyCorrections::cgffCedarPhyDataNDOld << ")\n";
00512               retval*=EnergyCorrections::cgffCedarPhyDataNDOld;
00513             }
00514           }
00515         }
00516         else {
00517           //Use the latest greatest numbers
00518           if(recoVers>=ReleaseType::kCedarPhy) {
00519             if(vc.GetDetector()==Detector::kFar) {
00520               MAXMSG("DataUtil",Msg::kInfo,1)
00521                 << "EnergyCorrections -- Applying CedarPhy (Fall 2007) Far Correction Factor"
00522                 << " (" << EnergyCorrections::cgffCedarPhyDataFD << ")\n";
00523               retval*=EnergyCorrections::cgffCedarPhyDataFD;
00524             }
00525             else if(vc.GetDetector()==Detector::kNear) {
00526               MAXMSG("DataUtil",Msg::kInfo,1)
00527                 << "EnergyCorrections -- Applying CedarPhy (Fall 2007) Near Correction Factor"
00528                 << " (" << EnergyCorrections::cgffCedarPhyDataND << ")\n";
00529               retval*=EnergyCorrections::cgffCedarPhyDataND;
00530             }
00531           }
00532         }
00533       }
00534     }
00535   }
00536 
00537   return retval;
00538 
00539 }

float EnergyCorrections::CorrectEnergyFromRange float  E,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 729 of file EnergyCorrections.cxx.

References CorrectMomentumFromRange().

00729                                                                                            {
00730    const float m=0.1057;// mon mass
00731    float p = sqrt(E*E -m*m);
00732    float pcor = CorrectMomentumFromRange(p,isdata,det);
00733    return sqrt(pcor*pcor +m*m);
00734 } 

float EnergyCorrections::CorrectMomentumFromRange float  p,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 690 of file EnergyCorrections.cxx.

References CorrectMomentumFromRange_Birch(), CorrectMomentumFromRange_Cedar(), and WarnUnknownVersion().

Referenced by CorrectEnergyFromRange(), MadMKAnalysis::CreatePAN(), NCAnalysisModule::FillRecoInfo(), MadMKAnalysis::RecoMKMuEnergy(), MadEvDisplay::RecoMKMuEnergy(), MadQuantities::RecoMuEnergy(), and ANtpTrackInfoAna::RecoMuEnergy().

00691                                                       {
00692   float pcor=p;
00693     switch(fVersion){
00694     case kCedar:
00695       pcor=CorrectMomentumFromRange_Cedar(p,isdata,det);
00696       break;
00697     case kBirch:
00698       pcor=CorrectMomentumFromRange_Birch(p,isdata,det);
00699       break;
00700     case kUnknown:
00701     default:
00702       WarnUnknownVersion("CorrectMomentumFromRange()");
00703       pcor=CorrectMomentumFromRange_Birch(p,isdata,det);      
00704       break;
00705     }
00706     return pcor;
00707 }

float EnergyCorrections::CorrectMomentumFromRange_Birch float  p,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 817 of file EnergyCorrections.cxx.

References pow().

Referenced by CorrectMomentumFromRange().

00817                                                                                                    {
00818   static const float c[4]={1.01334,0.05563,-0.05346,0.01205};
00819   
00820   // correction for difference in data mc steel density
00821   if(isdata){
00822     // inital correction, pre-Oxford 2006
00823     //static const float dcor=7.755/7.87;// data/mc density
00824     float dcor=1;
00825     if (det==Detector::kNear) dcor=(7.85*2.563)/(7.87*2.54); 
00826     else if(det==Detector::kFar) dcor=(7.85*2.558)/(7.87*2.54);
00827 
00828     p*=dcor;
00829   }
00830   // 
00831   float pcor=p/(c[0] + c[1]*log(p) + c[2]*pow(log(p), 2) + c[3]*pow(log(p),3));
00832   return pcor;
00833 }

float EnergyCorrections::CorrectMomentumFromRange_Cedar float  p,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 905 of file EnergyCorrections.cxx.

Referenced by CorrectMomentumFromRange().

00905                                                                                                                {
00906   return p;
00907 }

float EnergyCorrections::CorrectShowerEnergy float  E,
const Detector::Detector_t det,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 797 of file EnergyCorrections.cxx.

References CorrectShowerEnergyFar(), and CorrectShowerEnergyNear().

Referenced by MadEvDisplay::DrawTextBox(), NCAnalysisCuts::IsGoodShower(), MadMKAnalysis::RecoShwEnergy(), and ANtpShowerInfoAna::RecoShwEnergy().

00799                                                 {
00800    //People should not be using this function
00801   float ecor=E;
00802    if(det==Detector::kNear){
00803       ecor = CorrectShowerEnergyNear(E,st,mode,isdata);
00804    }
00805    else if(det==Detector::kFar){
00806       ecor = CorrectShowerEnergyFar(E,st,mode,isdata);
00807    }
00808 
00809    return ecor;
00810    
00811 }

float EnergyCorrections::CorrectShowerEnergyFar float  E,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 759 of file EnergyCorrections.cxx.

References CorrectShowerEnergyFar_Birch(), CorrectShowerEnergyFar_Cedar(), and WarnUnknownVersion().

Referenced by CorrectShowerEnergy(), MadQuantities::RecoShwEnergy(), MadBase::RecoShwEnergy(), and ANtpShowerInfoAna::RecoShwEnergy().

00759                                                                                                                      {
00760    //People should not be using this function
00761    
00762 
00763   float ecor=E;  
00764   switch(fVersion){
00765   case kCedar:
00766     ecor=CorrectShowerEnergyFar_Cedar(E,st,mode,isdata);
00767     break;
00768   case kBirch:
00769      if(isdata) {
00770         // a correction for the FD MIP scale
00771         // for the beam data, one measured MIP 
00772         // actually corresponds to 1.018 MIPs
00773         // so we must correct shower energy up
00774         const float mip_scale_correction=1.018;
00775         E*=mip_scale_correction;
00776      }
00777     ecor=CorrectShowerEnergyFar_Birch(E,st,mode,isdata);
00778     break;
00779   case kUnknown:
00780   default:
00781     WarnUnknownVersion("CorrectShowerEnergyFar()");
00782     if(isdata) {
00783        // a correction for the FD MIP scale
00784        // for the beam data, one measured MIP 
00785        // actually corresponds to 1.018 MIPs
00786        // so we must correct shower energy up
00787        const float mip_scale_correction=1.018;
00788         E*=mip_scale_correction;
00789      }    
00790     ecor=CorrectShowerEnergyFar_Birch(E,st,mode,isdata);      
00791     break;
00792   }
00793   return ecor;
00794 
00795 }

float EnergyCorrections::CorrectShowerEnergyFar_Birch float  E,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 875 of file EnergyCorrections.cxx.

Referenced by CorrectShowerEnergyFar(), and FullyCorrectShowerEnergy().

00875                                                                                                                                {
00876    //   std::cout << "CorrectShowerEnergyFar_Birch: " << E << std::endl;
00877    float ecor=E;
00878    if(st==CandShowerHandle::kCC){
00879      if(mode==1){
00880        // Niki Correction
00881        ecor=((E)*(1.-0.12*exp(-0.12*E)));
00882      }
00883      else if(mode==2){
00884        // Andy Correction
00885        //        ecor=(E)*(1.-0.2*exp(-0.2*E));
00886        ecor=E*(0.99-0.035*E*exp(-0.25*E));
00887      }
00888    }
00889    else if(st==CandShowerHandle::kWtCC){
00890       if(mode==1){
00891          // Niki Correction
00892          ecor=((E)*(1.+0.18*exp(-0.35*E)));
00893       }
00894       else if(mode==2){
00895          // Andy Correction
00896          E=ecor;
00897       }
00898    }
00899    return ecor;
00900 }

float EnergyCorrections::CorrectShowerEnergyFar_Cedar float  E,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 925 of file EnergyCorrections.cxx.

Referenced by CorrectShowerEnergyFar(), and ShowerEnergyCorrectionFarCedar().

00925                                                                                                                                          {
00926   
00927    float ecor=E;
00928    if(st==CandShowerHandle::kCC){
00929      ecor = ecor*(0.950+0.277*exp(-ecor*1.64));
00930    }
00931    else if(st==CandShowerHandle::kWtCC){
00932      ecor = ecor*(0.957+0.271*exp(-ecor*1.64));
00933    }
00934    return ecor;
00935 
00936 }

float EnergyCorrections::CorrectShowerEnergyNear float  E,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 737 of file EnergyCorrections.cxx.

References CorrectShowerEnergyNear_Birch(), CorrectShowerEnergyNear_Cedar(), and WarnUnknownVersion().

Referenced by CorrectShowerEnergy(), MadQuantities::RecoShwEnergy(), MadBase::RecoShwEnergy(), and ANtpShowerInfoAna::RecoShwEnergy().

00737                                                                                                                        {
00738    //People should not be using this function
00739 
00740   float ecor=E;
00741   switch(fVersion){
00742   case kCedar:
00743     ecor=CorrectShowerEnergyNear_Cedar(E,st,mode,isdata);
00744     break;
00745   case kBirch:
00746     ecor=CorrectShowerEnergyNear_Birch(E,st,mode,isdata);
00747     break;
00748   case kUnknown:
00749   default:
00750     WarnUnknownVersion("CorrectShowerEnergyNear()");
00751     ecor=CorrectShowerEnergyNear_Birch(E,st,mode,isdata);      
00752     break;
00753   }
00754   return ecor;
00755 }

float EnergyCorrections::CorrectShowerEnergyNear_Birch float  E,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 848 of file EnergyCorrections.cxx.

Referenced by CorrectShowerEnergyNear(), and FullyCorrectShowerEnergy().

00848                                                                                                                                   {
00849 
00850    //   std::cout << "CorrectShowerEnergyNear_Birch: " << E << "\t" << mode <<  std::endl;
00851    float ecor=E;
00852    if(st==CandShowerHandle::kCC){
00853       if(mode==1){
00854          // Niki Correction
00855          ecor=E/1.18;
00856       }
00857       else if(mode==2){
00858          // Andy Correction
00859          ecor=((E/1.05)*(1.-0.35*exp(-0.18*E/1.06)));
00860       }
00861    }
00862    else if(st==CandShowerHandle::kWtCC){
00863       if(mode==1){
00864          // Niki Correction
00865          ecor=((E)*(1.+0.50*exp(-1.00*E)));
00866       }
00867       else if(mode==2){
00868          // Andy Correction
00869          ecor=E/1.03;
00870       }
00871    }
00872    return ecor;
00873 }

float EnergyCorrections::CorrectShowerEnergyNear_Cedar float  E,
const CandShowerHandle::ShowerType_t st,
int  mode = 1,
bool  isdata = true
 

Definition at line 913 of file EnergyCorrections.cxx.

Referenced by CorrectShowerEnergyNear(), and ShowerEnergyCorrectionNearCedar().

00913                                                                                                                                           {
00914 
00915    float ecor=E;
00916    if(st==CandShowerHandle::kCC){
00917      ecor = ecor*(0.921+0.231*exp(-ecor*1.63));
00918    }
00919    else if(st==CandShowerHandle::kWtCC){
00920      ecor = ecor*(0.924+0.235*exp(-ecor*1.63));
00921    }
00922    return ecor;
00923 }

float EnergyCorrections::CorrectSignedMomentumFromCurvature float  p,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 709 of file EnergyCorrections.cxx.

References CorrectSignedMomentumFromCurvature_Birch(), CorrectSignedMomentumFromCurvature_Cedar(), and WarnUnknownVersion().

Referenced by MadMKAnalysis::CreatePAN(), NCAnalysisModule::FillRecoInfo(), MadMKAnalysis::RecoMKMuEnergy(), MadQuantities::RecoMuEnergy(), and ANtpTrackInfoAna::RecoMuEnergy().

00709                                                                                                          {
00710 
00711   float pcor=p;
00712     switch(fVersion){
00713     case kCedar:
00714       pcor=CorrectSignedMomentumFromCurvature_Cedar(p,isdata,det);
00715       break;
00716     case kBirch:
00717       pcor=CorrectSignedMomentumFromCurvature_Birch(p,isdata,det);
00718       break;
00719     case kUnknown:
00720     default:
00721       WarnUnknownVersion("CorrectSignedMomentumFromCurvature()");
00722       pcor=CorrectSignedMomentumFromCurvature_Birch(p,isdata,det);      
00723       break;
00724     }
00725     return pcor;
00726 }

float EnergyCorrections::CorrectSignedMomentumFromCurvature_Birch float  p,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 835 of file EnergyCorrections.cxx.

Referenced by CorrectSignedMomentumFromCurvature().

00835                                                                                                                          {
00836   // input is the signed momentum (e.g. p/q)
00837   // isdata and det are not used... but maybe in the future
00838   float pcor=p;
00839   if(pcor!=0) {
00840     // correction advertised in 1430-v2, J. Musser
00841     // note: for 1/p < 0   C=1, so correction only matters for mu+
00842     float C = (1.01+0.1*fabs(1/p))/(1.01-0.1*(1/p));
00843     pcor*=(1.0/C);
00844   }
00845   return pcor;
00846 }

float EnergyCorrections::CorrectSignedMomentumFromCurvature_Cedar float  p,
bool  isdata = true,
Detector::Detector_t  det = Detector::kNear
 

Definition at line 909 of file EnergyCorrections.cxx.

Referenced by CorrectSignedMomentumFromCurvature().

00909                                                                                                                          {
00910   return p;
00911 }

float EnergyCorrections::EnergyRangeCorrectionCedar float  E,
VldContext  vc,
WhichCorrection_t  whichCor
 

Definition at line 1207 of file EnergyCorrections.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), and MAXMSG.

Referenced by FullyCorrectEnergyFromRange(), and MomentumRangeCorrectionCedar().

01208 {
01209   MAXMSG("DataUtil",Msg::kInfo,1)
01210     << "EnergyCorrections -- Applying Energy from Range Correction for Cedar (1.018*E)-0.009 for ND Data and (1.010*E)-0.009 for everything else.\n";
01211   float eCor=E;
01212   if(vc.GetSimFlag()==SimFlag::kData && vc.GetDetector()==Detector::kNear) {
01213     eCor=(1.018*E)-0.009;
01214   }
01215   else {
01216     eCor=(1.010*E)-0.009;
01217   }
01218   
01219   return eCor;
01220 }

float EnergyCorrections::FullyCorrectEnergyFromRange float  E,
VldContext  vc,
ReleaseType::Release_t  release,
EnergyCorrections::WhichCorrection_t  whichCor = EnergyCorrections::kDefault
 

Definition at line 243 of file EnergyCorrections.cxx.

References EnergyRangeCorrectionCedar(), FullyCorrectMomentumFromRange(), ReleaseType::IsBirch(), and ReleaseType::IsCedar().

00247 {
00248   if(ReleaseType::IsBirch(release)) {
00249     const float m=0.1057;// muon mass
00250     float p = sqrt(E*E -m*m);
00251     float pcor = EnergyCorrections::FullyCorrectMomentumFromRange(p,vc,release,whichCor);
00252     return sqrt(pcor*pcor +m*m);   
00253   }
00254   else if(ReleaseType::IsCedar(release)) {
00255     return EnergyCorrections::EnergyRangeCorrectionCedar(E,vc,whichCor);
00256   }
00257   return E;
00258 }

float EnergyCorrections::FullyCorrectMomentumFromRange float  p,
VldContext  vc,
ReleaseType::Release_t  release,
EnergyCorrections::WhichCorrection_t  whichCor = EnergyCorrections::kDefault
 

Track Energy/Momentum Correction.

INPUTS:

  • Track energy/momentum in GeV
  • Valdity context of the event
  • Release code for the batch release (code+scripts+database+MC) used to generate the data
  • WhichCorrection_t generally speaking kDefault will be what most people want, but to compare corrections this switch is in place.

OUTPUT:

  • Track energy/momentum

Definition at line 227 of file EnergyCorrections.cxx.

References ReleaseType::IsBirch(), ReleaseType::IsCedar(), MomentumRangeCorrectionBirch(), and MomentumRangeCorrectionCedar().

Referenced by MNtpModule::Ana(), MuonRemovalInfoAna::Analyze(), MadTVAnalysis::CreatePAN(), FullyCorrectEnergyFromRange(), NCAnalysisUtils::GetTrackEnergy(), MadQuantities::RecoMuEnergyNew(), ANtpTrackInfoAna::RecoMuEnergyNew(), and Anp::FillTrack::Run().

00231 {
00232    float pcor=p;
00233    if(ReleaseType::IsBirch(release)) {   
00234       pcor=EnergyCorrections::MomentumRangeCorrectionBirch(p,vc,whichCor);
00235    }
00236    else if(ReleaseType::IsCedar(release)) {
00237       pcor=EnergyCorrections::MomentumRangeCorrectionCedar(p,vc,whichCor);
00238    }
00239    return pcor;
00240 
00241 }

float EnergyCorrections::FullyCorrectShowerEnergy float  E,
const CandShowerHandle::ShowerType_t st,
VldContext  vc,
ReleaseType::Release_t  release,
EnergyCorrections::WhichCorrection_t  whichCor = EnergyCorrections::kDefault
 

INPUTS:

  • Shower energy in GeV (for Masaki CC correction). SigMap and MEU/MIP are also supported for non kCC CandShowerHandle::ShowerType_t.
  • Shower type (only kCC showers have Masaki's correction)
  • Valdity context of the event
  • Release code for the batch release (code+scripts+database+MC) used to generate the data
  • WhichCorrection_t generally speaking kDefault will be what most people want, but to compare corrections this switch is in place.

OUTPUT:

  • Shower energy in same units as input.

Further notes: This routine uses the Calibrator, and requires read access to the offline database. At present, any up-to-date database will do. Note that this routine initializes a custom Calibrator on the first call; it should not interfere with other Calibrators you may be using.

WhichCorrection_t lookup table

Birch -- Shower ================= kDefault = Niki's Correction kVersion1 = Niki's Correction kVersion2 = Andy's Correction Cedar -- Shower =============== kDefault = (MC Only) Drift Correction + Cal Group Fudge Factors + Scaled Masaki 17th May kVersion1 = (MC Only) Drift Correction + Masaki 17th May kVersion2 = Masaki Exponential kVersion3 = (MC Only) Drift Correction + Cal Group Fudge Factors + Scaled Masaki 17th May kNoCalGroup = Scaled Masaki 17th May

Definition at line 162 of file EnergyCorrections.cxx.

References CalibrationGroupEnergyCorrections(), CorrectShowerEnergyFar_Birch(), CorrectShowerEnergyNear_Birch(), VldContext::GetDetector(), ReleaseType::GetRecoInfo(), ReleaseType::IsBirch(), ReleaseType::IsCedar(), ReleaseType::IsDogwood(), ShowerEnergyCorrectionFarCedar(), ShowerEnergyCorrectionFarCedarPhyBhcurve(), ShowerEnergyCorrectionNearCedar(), and ShowerEnergyCorrectionNearCedarPhyBhcurve().

Referenced by MNtpModule::Ana(), MuonRemovalInfoAna::Analyze(), NCAnalysisUtils::GetShowerEnergy(), MadQuantities::RecoShwEnergyNew(), ANtpShowerInfoAna::RecoShwEnergyNew(), Anp::FillShower::Run(), and Anp::FillEnergy::Run().

00167 {
00168 
00169    //First step is to apply Calibration Group Corrections
00170    float eCor=EnergyCorrections::CalibrationGroupEnergyCorrections(E,vc,release,whichCor);
00171 
00172   // Get the reconstruction version.
00173   ReleaseType::Release_t recoVers = ReleaseType::GetRecoInfo(release);
00174 
00175   //Now need to apply Masaki's correction
00176   if(ReleaseType::IsBirch(release)) {
00177     int mode=1;
00178     if(whichCor==EnergyCorrections::kVersion2)
00179       mode=2;
00180     if(vc.GetDetector()==Detector::kNear)
00181       return EnergyCorrections::CorrectShowerEnergyNear_Birch(eCor,st,mode);
00182      else if(vc.GetDetector()==Detector::kFar)
00183        return EnergyCorrections::CorrectShowerEnergyFar_Birch(eCor,st,mode);
00184     
00185   }
00186   else if(ReleaseType::IsCedar(release)) {
00187     //Now need to check version
00188     if(recoVers >= ReleaseType::kR1_24_3) {
00189       if(vc.GetDetector()==Detector::kNear)
00190         return EnergyCorrections::ShowerEnergyCorrectionNearCedarPhyBhcurve(eCor,st,whichCor);
00191       else if(vc.GetDetector()==Detector::kFar)
00192         return EnergyCorrections::ShowerEnergyCorrectionFarCedarPhyBhcurve(eCor,st,whichCor);
00193 
00194     }
00195     else {
00196       if(vc.GetDetector()==Detector::kNear)
00197         return EnergyCorrections::ShowerEnergyCorrectionNearCedar(eCor,st,whichCor);
00198       else if(vc.GetDetector()==Detector::kFar)
00199         return EnergyCorrections::ShowerEnergyCorrectionFarCedar(eCor,st,whichCor);
00200     }
00201     
00202   }
00203   else if(ReleaseType::IsDogwood(release)) {
00204     
00205   }
00206   
00207   return E;
00208 }  

float EnergyCorrections::FullyCorrectSignedMomentumFromCurvature float  p,
VldContext  vc,
ReleaseType::Release_t  release,
EnergyCorrections::WhichCorrection_t  whichCor = EnergyCorrections::kDefault
 

Definition at line 260 of file EnergyCorrections.cxx.

References ReleaseType::IsBirch(), ReleaseType::IsCedar(), SignedMomentumCurvatureCorrectionBirch(), and SignedMomentumCurvatureCorrectionCedar().

Referenced by MNtpModule::Ana(), MuonRemovalInfoAna::Analyze(), MadTVAnalysis::CreatePAN(), NCAnalysisUtils::GetTrackEnergy(), MadQuantities::RecoMuEnergyNew(), and ANtpTrackInfoAna::RecoMuEnergyNew().

00264 {
00265    float pcor=p;
00266    if(ReleaseType::IsBirch(release)) {   
00267       pcor=EnergyCorrections::SignedMomentumCurvatureCorrectionBirch(p,vc,whichCor);
00268    }
00269    else if(ReleaseType::IsCedar(release)) {
00270       pcor=EnergyCorrections::SignedMomentumCurvatureCorrectionCedar(p,vc,whichCor);
00271    }
00272    return pcor;
00273 
00274 }

std::string EnergyCorrections::GetCorrectionAsString  ) 
 

Definition at line 640 of file EnergyCorrections.cxx.

References fSubVersion, and s().

Referenced by WarnUnknownVersion().

00640                                                   {
00641   std::string s;
00642   switch(fVersion){
00643   case kBirch:
00644     s+="BIRCH"; break;
00645   case kCedar:
00646     s+="CEDAR"; break;
00647   case kUnknown:
00648   default:
00649     s+="???"; 
00650     break;
00651   }
00652   std::ostringstream os; os<<"-v"<<fSubVersion<<std::ends;
00653   s+=os.str();
00654 
00655   return s;
00656 }

float EnergyCorrections::MasakiFarDec15th float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1026 of file EnergyCorrections.cxx.

References NR::fmin(), MAXMSG, and pow().

Referenced by ShowerEnergyCorrectionFarCedarPhyBhcurve().

01028 {
01029    //From DocDB 3077_v3
01030   MAXMSG("DataUtil",Msg::kInfo,1)
01031     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Far Detector from DocDB 3895_v4\n";
01032   float recoE=energy;
01033   float le = log10(fmin(fmax(energy,0.3),20)); 
01034   float we=0;
01035   if(st==CandShowerHandle::kCC){
01036     recoE = energy*( 1.15566-0.286445*le+ 0.122705*(2.*pow(le,2)-1)-0.0183855*(4.*pow(le,3)-3.*le));
01037   }
01038   else if(st==CandShowerHandle::kWtCC) {
01039     we = fmin(fmax(energy,0.3),20); 
01040     recoE= energy*(0.971346+0.00314063*we-0.000135242*pow(we,2)+0.626512*TMath::Exp(-we*3.26053));
01041   }
01042   return recoE;
01043 }

float EnergyCorrections::MasakiFarDec15thScaled float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1067 of file EnergyCorrections.cxx.

References NR::fmin(), MAXMSG, and pow().

01069 {
01070    //From DocDB 3077_v3
01071   MAXMSG("DataUtil",Msg::kInfo,1)
01072     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Far Detector from DocDB 3895_v4\n";
01073   float tempE=energy/EnergyCorrections::cgffCedarPhyDaikonFD;
01074   float recoE=tempE;
01075   float le = log10(fmin(fmax(tempE,0.3),20)); 
01076   float we=0;
01077   if(st==CandShowerHandle::kCC){
01078     recoE = tempE*( 1.15566-0.286445*le+ 0.122705*(2.*pow(le,2)-1)-0.0183855*(4.*pow(le,3)-3.*le));
01079   }
01080   else if(st==CandShowerHandle::kWtCC) {
01081     we = fmin(fmax(energy,0.3),20); 
01082     recoE= energy*(0.971346+0.00314063*we-0.000135242*pow(we,2)+0.626512*TMath::Exp(-we*3.26053));
01083   }
01084   return recoE;
01085 }

float EnergyCorrections::MasakiFarMay17th float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1105 of file EnergyCorrections.cxx.

References MAXMSG, and pow().

Referenced by ShowerEnergyCorrectionFarCedar().

01107 {
01108    //From DocDB 3077_v3
01109   MAXMSG("DataUtil",Msg::kInfo,1)
01110     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Far Detector from DocDB 3077_v3\n";
01111    float recoE=energy;
01112    //   std::cout << "Old:\t" << recoE << std::endl;
01113    float le = log10(fmax(energy,0.2));   
01114    if(st==CandShowerHandle::kCC){
01115       recoE = energy*(1.113584-0.299139*le+0.145169*(2.*pow(le,2)-1)-0.0232853*(4.*pow(le,3)-3.*le));
01116    }
01117    else if (st==CandShowerHandle::kWtCC){
01118       recoE= energy*(1.052872-0.19185*le+0.102449*(2.*pow(le,2)-1)-0.0182317*(4.*pow(le,3)-3.*le));
01119    }
01120    return recoE;
01121 }

float EnergyCorrections::MasakiFarMay17thScaled float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1144 of file EnergyCorrections.cxx.

References MAXMSG, and pow().

Referenced by ShowerEnergyCorrectionFarCedar(), and ShowerEnergyCorrectionFarCedarPhyBhcurve().

01146 {
01147    //From DocDB 3077_v3
01148   MAXMSG("DataUtil",Msg::kInfo,1)
01149     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Far Detector from DocDB 3077_v3 -- Scaled by Appropriate CG factor for uncalibrated data he used\n";
01150    float tempE=energy/EnergyCorrections::cgffCedarR1_24_1MCFD;
01151    float recoE=tempE;
01152    //   std::cout <<  "New:\t" <<recoE << std::endl;
01153    float le = log10(fmax(tempE,0.2));   
01154    if(st==CandShowerHandle::kCC){
01155       recoE = tempE*(1.113584-0.299139*le+0.145169*(2.*pow(le,2)-1)-0.0232853*(4.*pow(le,3)-3.*le));
01156    }
01157    else if (st==CandShowerHandle::kWtCC){
01158       recoE= tempE*(1.052872-0.19185*le+0.102449*(2.*pow(le,2)-1)-0.0182317*(4.*pow(le,3)-3.*le));
01159    }
01160    return recoE;
01161 }

float EnergyCorrections::MasakiNearDec15th float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1007 of file EnergyCorrections.cxx.

References NR::fmin(), MAXMSG, and pow().

Referenced by ShowerEnergyCorrectionNearCedarPhyBhcurve().

01009 {
01010    //From DocDB 3077_v3
01011   MAXMSG("DataUtil",Msg::kInfo,1)
01012     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Near Detector from DocDB 3895_v4\n";
01013   float recoE=energy;
01014   float le = log10(fmin(fmax(energy,0.3),20)); 
01015   float we=0;
01016   if(st==CandShowerHandle::kCC){
01017     recoE = energy*(1.10973-0.248714*le +0.116769*(2.*pow(le,2)-1)-0.0200268*(4.*pow(le,3)-3.*le));
01018   }
01019   else if(st==CandShowerHandle::kWtCC) {
01020     we = fmin(fmax(energy,0.3),20); 
01021     recoE= energy*(0.999461-0.00334628*we+0.0000563316*pow(we,2)+0.35232*TMath::Exp(-we*1.76594));
01022   }
01023   return recoE;
01024 }

float EnergyCorrections::MasakiNearDec15thScaled float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1047 of file EnergyCorrections.cxx.

References NR::fmin(), MAXMSG, and pow().

01049 {
01050    //From DocDB 3077_v3
01051   MAXMSG("DataUtil",Msg::kInfo,1)
01052     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Near Detector from DocDB 3895_v4\n";
01053   float tempE=energy/EnergyCorrections::cgffCedarPhyDaikonND;
01054   float recoE=tempE;
01055   float le = log10(fmin(fmax(tempE,0.3),20)); 
01056   float we=0;
01057   if(st==CandShowerHandle::kCC){
01058     recoE = tempE*(1.10973-0.248714*le +0.116769*(2.*pow(le,2)-1)-0.0200268*(4.*pow(le,3)-3.*le));
01059   }
01060   else if(st==CandShowerHandle::kWtCC) {
01061     we = fmin(fmax(energy,0.3),20); 
01062     recoE= energy*(0.999461-0.00334628*we+0.0000563316*pow(we,2)+0.35232*TMath::Exp(-we*1.76594));
01063   }
01064   return recoE;
01065 }

float EnergyCorrections::MasakiNearMay17th float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1088 of file EnergyCorrections.cxx.

References MAXMSG, and pow().

Referenced by ShowerEnergyCorrectionNearCedar().

01090 {
01091    //From DocDB 3077_v3
01092   MAXMSG("DataUtil",Msg::kInfo,1)
01093     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Near Detector from DocDB 3077_v3\n";
01094   float recoE=energy;
01095    float le = log10(fmax(energy,0.2));
01096    if(st==CandShowerHandle::kCC){
01097       recoE = energy*(1.078984-0.249843*le+0.134518*(2.*pow(le,2)-1)-0.025613*(4.*pow(le,3)-3.*le));
01098    }
01099    else if(st==CandShowerHandle::kWtCC) {
01100       recoE= energy*(1.070553-0.207148*le+0.0943124*(2.*pow(le,2)-1)-0.0153231*(4.*pow(le,3)-3.*le));
01101    }
01102    return recoE;
01103 }

float EnergyCorrections::MasakiNearMay17thScaled float  energy,
const CandShowerHandle::ShowerType_t st
 

Definition at line 1125 of file EnergyCorrections.cxx.

References MAXMSG, and pow().

Referenced by ShowerEnergyCorrectionNearCedar(), and ShowerEnergyCorrectionNearCedarPhyBhcurve().

01127 {
01128    //From DocDB 3077_v3
01129   MAXMSG("DataUtil",Msg::kInfo,1)
01130     << "EnergyCorrections -- Applying Masaki (Reco to True) Correction for Near Detector from DocDB 3077_v3 -- Scaled by Appropriate CG factor for uncalibrated data he used\n";
01131    float tempE=energy/EnergyCorrections::cgffCedarR1_24_1MCND;
01132    float recoE=tempE;
01133    float le = log10(fmax(tempE,0.2));
01134    if(st==CandShowerHandle::kCC){
01135       recoE = tempE*(1.078984-0.249843*le+0.134518*(2.*pow(le,2)-1)-0.025613*(4.*pow(le,3)-3.*le));
01136    }
01137    else if(st==CandShowerHandle::kWtCC) {
01138       recoE= tempE*(1.070553-0.207148*le+0.0943124*(2.*pow(le,2)-1)-0.0153231*(4.*pow(le,3)-3.*le));
01139    }
01140    return recoE;
01141 }

float EnergyCorrections::MomentumRangeCorrectionBirch float  p,
VldContext  vc,
WhichCorrection_t  whichCor
 

Definition at line 1164 of file EnergyCorrections.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), and pow().

Referenced by FullyCorrectMomentumFromRange().

01165 {
01166   static const float c[4]={1.01334,0.05563,-0.05346,0.01205};
01167   
01168   // correction for difference in data mc steel density
01169   if(vc.GetSimFlag()==SimFlag::kData){
01170     // inital correction, pre-Oxford 2006
01171     //static const float dcor=7.755/7.87;// data/mc density
01172     float dcor=1;
01173     if (vc.GetDetector()==Detector::kNear) dcor=(7.85*2.563)/(7.87*2.54); 
01174     else if(vc.GetDetector()==Detector::kFar) dcor=(7.85*2.558)/(7.87*2.54);
01175 
01176     p*=dcor;
01177   }
01178   // 
01179   float pcor=p/(c[0] + c[1]*log(p) + c[2]*pow(log(p), 2) + c[3]*pow(log(p),3));
01180   return pcor;
01181 }

float EnergyCorrections::MomentumRangeCorrectionCedar float  p,
VldContext  vc,
WhichCorrection_t  whichCor
 

Definition at line 1198 of file EnergyCorrections.cxx.

References EnergyRangeCorrectionCedar().

Referenced by FullyCorrectMomentumFromRange().

01199 {
01200   //return p;
01201     const float m=0.1057;// muon mass
01202     float E = sqrt(p*p+m*m);
01203     float eCor = EnergyCorrections::EnergyRangeCorrectionCedar(E,vc,whichCor);
01204     return sqrt(eCor*eCor-m*m);  
01205 }

void EnergyCorrections::SetCorrectionVersion const CorrectionVersion_t ver,
Short_t  subver = 0
 

Definition at line 635 of file EnergyCorrections.cxx.

References fSubVersion, and fVersion.

Referenced by MNtpModule::Ana(), MuonRemovalInfoAna::Analyze(), ANtpTrackInfoAna::Analyze(), ANtpShowerInfoAna::Analyze(), and NCAnalysisCuts::IsGoodShower().

00635                                                                                           {
00636   fVersion=ver;
00637   fSubVersion=subver;
00638 }

float EnergyCorrections::ShowerEnergyConversionDogwood float  E,
VldContext  vc
 

Definition at line 550 of file EnergyCorrections.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), ShowerEnergyCorrectionFarCedarPhyBhcurve(), and ShowerEnergyCorrectionNearCedarPhyBhcurve().

Referenced by CandShowerHandle::CalibrateEnergy().

00551 {
00552   //Two things to do:
00553   //i) apply Calibration Group tweaks
00554   //ii) apply Maskai's Reco->Truth formula
00555   float eCor=E;
00556   if(vc.GetDetector()==Detector::kFar) {
00557     //Cal group corrections
00558     if(vc.GetSimFlag()==SimFlag::kData) {
00559       eCor*=EnergyCorrections::cgffCedarPhyDataFD;
00560     }
00561     else if(vc.GetSimFlag()==SimFlag::kMC) {
00562       eCor*=EnergyCorrections::cgffCedarPhyDaikonFD;
00563     } 
00564     //Reco-Truth Conversion
00565     eCor=EnergyCorrections::ShowerEnergyCorrectionFarCedarPhyBhcurve(eCor,CandShowerHandle::kCC,EnergyCorrections::kDefault);
00566   }
00567   else if(vc.GetDetector()==Detector::kNear) {
00568     //Cal group corrections
00569     if(vc.GetSimFlag()==SimFlag::kData) {
00570       eCor*=EnergyCorrections::cgffCedarPhyDataND;
00571     }
00572     else if(vc.GetSimFlag()==SimFlag::kMC) {
00573       eCor*=EnergyCorrections::cgffCedarPhyDaikonND;
00574     } 
00575     //Reco-Truth Conversion
00576     eCor=EnergyCorrections::ShowerEnergyCorrectionNearCedarPhyBhcurve(eCor,CandShowerHandle::kCC,EnergyCorrections::kDefault);
00577   }
00578 
00579   return eCor;
00580 
00581 }

float EnergyCorrections::ShowerEnergyCorrectionFarCedar float  energy,
const CandShowerHandle::ShowerType_t st,
EnergyCorrections::WhichCorrection_t  whichCor
 

Definition at line 990 of file EnergyCorrections.cxx.

References CorrectShowerEnergyFar_Cedar(), MasakiFarMay17th(), and MasakiFarMay17thScaled().

Referenced by FullyCorrectShowerEnergy().

00993 {
00994    switch(whichCor) {
00995    case EnergyCorrections::kVersion2:
00996       return EnergyCorrections::CorrectShowerEnergyFar_Cedar(energy,st);
00997    case EnergyCorrections::kVersion1:
00998       return EnergyCorrections::MasakiFarMay17th(energy,st);
00999    case EnergyCorrections::kVersion3:
01000    case EnergyCorrections::kDefault:
01001    default:
01002       return EnergyCorrections::MasakiFarMay17thScaled(energy,st);
01003    }   
01004    return energy;
01005 }

float EnergyCorrections::ShowerEnergyCorrectionFarCedarPhyBhcurve float  energy,
const CandShowerHandle::ShowerType_t st,
EnergyCorrections::WhichCorrection_t  whichCor
 

Definition at line 956 of file EnergyCorrections.cxx.

References MasakiFarDec15th(), and MasakiFarMay17thScaled().

Referenced by FullyCorrectShowerEnergy(), ShowerEnergyConversionDogwood(), and WeightedShowerEnergyConversionDogwood().

00959 {
00960    switch(whichCor) {
00961    case EnergyCorrections::kVersion4:
00962       return EnergyCorrections::MasakiFarMay17thScaled(energy,st);
00963    case EnergyCorrections::kDefault:
00964    default:
00965       return EnergyCorrections::MasakiFarDec15th(energy,st);
00966    }   
00967    return energy;
00968 }

float EnergyCorrections::ShowerEnergyCorrectionNearCedar float  energy,
const CandShowerHandle::ShowerType_t st,
EnergyCorrections::WhichCorrection_t  whichCor
 

Definition at line 972 of file EnergyCorrections.cxx.

References CorrectShowerEnergyNear_Cedar(), MasakiNearMay17th(), and MasakiNearMay17thScaled().

Referenced by FullyCorrectShowerEnergy().

00975 {
00976 
00977    switch(whichCor) {
00978    case EnergyCorrections::kVersion2:
00979       return EnergyCorrections::CorrectShowerEnergyNear_Cedar(energy,st);
00980    case EnergyCorrections::kVersion1:
00981       return EnergyCorrections::MasakiNearMay17th(energy,st);
00982    case EnergyCorrections::kVersion3:
00983    case EnergyCorrections::kDefault:
00984    default:
00985       return EnergyCorrections::MasakiNearMay17thScaled(energy,st);
00986    }   
00987    return energy;
00988 }

float EnergyCorrections::ShowerEnergyCorrectionNearCedarPhyBhcurve float  energy,
const CandShowerHandle::ShowerType_t st,
EnergyCorrections::WhichCorrection_t  whichCor
 

Definition at line 941 of file EnergyCorrections.cxx.

References MasakiNearDec15th(), and MasakiNearMay17thScaled().

Referenced by FullyCorrectShowerEnergy(), ShowerEnergyConversionDogwood(), and WeightedShowerEnergyConversionDogwood().

00944 {
00945 
00946    switch(whichCor) {
00947    case EnergyCorrections::kVersion4:
00948       return EnergyCorrections::MasakiNearMay17thScaled(energy,st);
00949    case EnergyCorrections::kDefault:
00950    default:
00951       return EnergyCorrections::MasakiNearDec15th(energy,st);
00952    }   
00953    return energy;
00954 }

float EnergyCorrections::SignedMomentumCurvatureCorrectionBirch float  p,
VldContext  vc,
WhichCorrection_t  whichCor
 

Definition at line 1183 of file EnergyCorrections.cxx.

Referenced by FullyCorrectSignedMomentumFromCurvature().

01183                                                                                                                          {
01184   // input is the signed momentum (e.g. p/q)
01185   // isdata and det are not used... but maybe in the future
01186   float pcor=p;
01187   if(pcor!=0) {
01188     // correction advertised in 1430-v2, J. Musser
01189     // note: for 1/p < 0   C=1, so correction only matters for mu+
01190     float C = (1.01+0.1*fabs(1/p))/(1.01-0.1*(1/p));
01191     pcor*=(1.0/C);
01192   }
01193   return pcor;
01194 }

float EnergyCorrections::SignedMomentumCurvatureCorrectionCedar float  p,
VldContext  vc,
WhichCorrection_t  whichCor
 

Definition at line 1222 of file EnergyCorrections.cxx.

References MAXMSG.

Referenced by FullyCorrectSignedMomentumFromCurvature().

01223 {
01224   MAXMSG("DataUtil",Msg::kInfo,1)
01225     << "EnergyCorrections -- Not applying momentum from curvature correction for Cedar\n";
01226   return p;
01227 }

EnergyCorrections::CorrectionVersion_t EnergyCorrections::VersionFromFilename const char *   ) 
 

Definition at line 675 of file EnergyCorrections.cxx.

References CorrectionVersion_t, and s().

00675                                                                                            {
00676   CorrectionVersion_t ver = kUnknown;
00677   std::string s=name;
00678   
00679   if(s.find("R1_18")!=std::string::npos){
00680     ver=EnergyCorrections::kBirch;
00681   }
00682   else if(s.find("cedar")!=std::string::npos){
00683     ver=EnergyCorrections::kCedar;
00684   }
00685   return ver;
00686 }

void EnergyCorrections::WarnUnknownVersion const char *  caller_routine  ) 
 

Definition at line 658 of file EnergyCorrections.cxx.

References GetCorrectionAsString().

Referenced by CorrectMomentumFromRange(), CorrectShowerEnergyFar(), CorrectShowerEnergyNear(), and CorrectSignedMomentumFromCurvature().

00658                                                                     {
00659   static Short_t nwarn=0;
00660   if(nwarn<=9){
00661     std::cerr<<"Energy Corrections: In "<<caller_routine
00662              <<"Energy Corrections: Warning, unknown correction version "
00663              <<GetCorrectionAsString()
00664              <<"Energy Corrections: Defaulting to Birch era corrections.\n"
00665              <<"Energy Corrections: Please Call SetCorrectionVersion() in the future.\n"
00666              <<std::endl;
00667     nwarn++;
00668   }
00669   if(nwarn==9){
00670     std::cerr<<"Energy Corrections: last message of this type..."<<std::endl;
00671   }
00672   
00673 }

float EnergyCorrections::WeightedShowerEnergyConversionDogwood float  E,
VldContext  vc
 

Definition at line 588 of file EnergyCorrections.cxx.

References VldContext::GetDetector(), VldContext::GetSimFlag(), ShowerEnergyCorrectionFarCedarPhyBhcurve(), and ShowerEnergyCorrectionNearCedarPhyBhcurve().

Referenced by CandShowerHandle::CalibrateEnergy().

00589 {
00590   //Two things to do:
00591   //i) apply Calibration Group tweaks
00592   //ii) apply Maskai's Reco->Truth formula
00593   float eCor=E;
00594   if(vc.GetDetector()==Detector::kFar) {
00595     //Cal group corrections
00596     if(vc.GetSimFlag()==SimFlag::kData) {
00597       eCor*=EnergyCorrections::cgffCedarPhyDataFD;
00598     }
00599     else if(vc.GetSimFlag()==SimFlag::kMC) {
00600       eCor*=EnergyCorrections::cgffCedarPhyDaikonFD;
00601     } 
00602     //Reco-Truth Conversion
00603     eCor=EnergyCorrections::ShowerEnergyCorrectionFarCedarPhyBhcurve(eCor,CandShowerHandle::kWtCC,EnergyCorrections::kDefault);
00604   }
00605   else if(vc.GetDetector()==Detector::kNear) {
00606     //Cal group corrections
00607     if(vc.GetSimFlag()==SimFlag::kData) {
00608       eCor*=EnergyCorrections::cgffCedarPhyDataND;
00609     }
00610     else if(vc.GetSimFlag()==SimFlag::kMC) {
00611       eCor*=EnergyCorrections::cgffCedarPhyDaikonND;
00612     } 
00613     //Reco-Truth Conversion
00614     eCor=EnergyCorrections::ShowerEnergyCorrectionNearCedarPhyBhcurve(eCor,CandShowerHandle::kWtCC,EnergyCorrections::kDefault);
00615   }
00616 
00617   return eCor;
00618 
00619 }


Variable Documentation

const float EnergyCorrections::cgffBirchDataFD = 1.018 [static]
 

Definition at line 327 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarPhyDaikonFD = 1 [static]
 

Definition at line 349 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarPhyDaikonND = 1 [static]
 

Definition at line 348 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarPhyDataFD = 0.9988 [static]
 

Definition at line 331 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarPhyDataFDOld = 0.996 [static]
 

Definition at line 338 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarPhyDataND = 1.0039 [static]
 

Definition at line 332 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarPhyDataNDOld = 1.003 [static]
 

Definition at line 339 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarR1_24_1MCFD = (0.001737/0.001786) [static]
 

Definition at line 333 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarR1_24_1MCFDOld = 0.986 [static]
 

Definition at line 340 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarR1_24_1MCND = (0.001759/0.001792) [static]
 

Definition at line 334 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarR1_24_1MCNDOld = 0.994 [static]
 

Definition at line 341 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarR1_24_2MCFD = cgffCedarR1_24_1MCFD*(0.001786/0.001737) [static]
 

Definition at line 345 of file EnergyCorrections.cxx.

const float EnergyCorrections::cgffCedarR1_24_2MCND = cgffCedarR1_24_1MCND*(0.001792/0.001759) [static]
 

Definition at line 346 of file EnergyCorrections.cxx.

Short_t EnergyCorrections::fSubVersion = 0 [static]
 

Definition at line 632 of file EnergyCorrections.cxx.

Referenced by GetCorrectionAsString(), and SetCorrectionVersion().

CorrectionVersion_t EnergyCorrections::fVersion = EnergyCorrections::kUnknown [static]
 

Definition at line 631 of file EnergyCorrections.cxx.

Referenced by SetCorrectionVersion().


Generated on Fri Mar 28 16:16:03 2008 for loon by  doxygen 1.3.9.1