ReweightLooper Class Reference

#include <ReweightLooper.h>

List of all members.

Public Member Functions

 ReweightLooper (std::string, Int_t, Double_t, Double_t)
 ~ReweightLooper ()
void AddDaughter (std::string, Int_t, Double_t, Double_t)
ReweightLooperGetDaughter ()
std::string GetName ()
Double_t GetValue (Int_t)
void ResetCounter ()
Int_t GetNIntervals ()
Bool_t Grind (std::map< std::string, Double_t * >)

Protected Attributes

std::string fVarName
Int_t fNIntervals
Double_t fMin
Double_t fMax
ReweightLooperfDaughter
Int_t fInternalCounter

Detailed Description

Definition at line 7 of file ReweightLooper.h.


Constructor & Destructor Documentation

ReweightLooper::ReweightLooper ( std::string  VarName,
Int_t  NIntervals,
Double_t  Min,
Double_t  Max 
)

Definition at line 4 of file ReweightLooper.cxx.

References fDaughter, fInternalCounter, fMax, fMin, fNIntervals, and fVarName.

Referenced by AddDaughter().

00005                                                           {
00006   fVarName = VarName;
00007   fNIntervals = NIntervals;
00008   fMin = Min;
00009   fMax = Max;
00010   fDaughter = NULL;
00011   fInternalCounter = 0;
00012 }

ReweightLooper::~ReweightLooper (  ) 

Definition at line 14 of file ReweightLooper.cxx.

References fDaughter.

00014                                 {
00015   std::cout << "Deleting daughter looper" << std::endl;
00016   delete fDaughter;
00017 }


Member Function Documentation

void ReweightLooper::AddDaughter ( std::string  VarName,
Int_t  NIntervals,
Double_t  Min,
Double_t  Max 
)

Definition at line 19 of file ReweightLooper.cxx.

References AddDaughter(), fDaughter, and ReweightLooper().

Referenced by AddDaughter().

00020                                                             {
00021   if(fDaughter) fDaughter->AddDaughter(VarName,NIntervals,Min,Max);
00022   else fDaughter = new ReweightLooper(VarName,NIntervals,Min,Max);
00023 }

ReweightLooper* ReweightLooper::GetDaughter (  )  [inline]

Definition at line 24 of file ReweightLooper.h.

References fDaughter.

Referenced by PANAnalysis::MakeReweightTree().

00024 {return fDaughter;}

std::string ReweightLooper::GetName (  )  [inline]

Definition at line 25 of file ReweightLooper.h.

References fVarName.

Referenced by PANAnalysis::MakeReweightTree().

00025 { return fVarName; }

Int_t ReweightLooper::GetNIntervals (  )  [inline]

Definition at line 28 of file ReweightLooper.h.

References fNIntervals.

00028 { return fNIntervals; }

Double_t ReweightLooper::GetValue ( Int_t  n  ) 

Definition at line 25 of file ReweightLooper.cxx.

References fMax, fMin, and fNIntervals.

Referenced by Grind().

00025                                          {
00026   if(n<0||n>fNIntervals) return 999;
00027   return fMin + Double_t(n)*(fMax-fMin)/Double_t(fNIntervals);
00028 }

Bool_t ReweightLooper::Grind ( std::map< std::string, Double_t * >  variables  ) 

Definition at line 30 of file ReweightLooper.cxx.

References fDaughter, fInternalCounter, fNIntervals, fVarName, GetValue(), Grind(), and ResetCounter().

Referenced by Grind(), and PANAnalysis::MakeReweightTree().

00030                                                                   {
00031   if(fInternalCounter<=fNIntervals){
00032     (*variables[fVarName]) = this->GetValue(fInternalCounter);    
00033     if(fDaughter) {
00034       if(!fDaughter->Grind(variables)) {
00035         fInternalCounter += 1;
00036         fDaughter->ResetCounter();
00037         return this->Grind(variables);
00038       }
00039     }
00040     else {
00041       fInternalCounter += 1;
00042     }
00043   }
00044   else return false;
00045   return true;
00046 }

void ReweightLooper::ResetCounter (  )  [inline]

Definition at line 27 of file ReweightLooper.h.

References fInternalCounter.

Referenced by Grind(), and PANAnalysis::MakeReweightTree().

00027 { fInternalCounter = 0; }


Member Data Documentation

Definition at line 16 of file ReweightLooper.h.

Referenced by AddDaughter(), GetDaughter(), Grind(), ReweightLooper(), and ~ReweightLooper().

Definition at line 17 of file ReweightLooper.h.

Referenced by Grind(), ResetCounter(), and ReweightLooper().

Double_t ReweightLooper::fMax [protected]

Definition at line 15 of file ReweightLooper.h.

Referenced by GetValue(), and ReweightLooper().

Double_t ReweightLooper::fMin [protected]

Definition at line 14 of file ReweightLooper.h.

Referenced by GetValue(), and ReweightLooper().

Int_t ReweightLooper::fNIntervals [protected]

Definition at line 13 of file ReweightLooper.h.

Referenced by GetNIntervals(), GetValue(), Grind(), and ReweightLooper().

std::string ReweightLooper::fVarName [protected]

Definition at line 12 of file ReweightLooper.h.

Referenced by GetName(), Grind(), and ReweightLooper().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1