AtNuOscFitTemplate Class Reference

#include <AtNuOscFitTemplate.h>

List of all members.

Public Member Functions

 AtNuOscFitTemplate ()
 AtNuOscFitTemplate (const char *filename)
 AtNuOscFitTemplate (AtNuTemplateType::AtNuTemplateType_t templatetype, Int_t nE, Double_t E1, Double_t E2, Int_t nsys=0)
 AtNuOscFitTemplate (const AtNuOscFitTemplate &rhs)
 ~AtNuOscFitTemplate ()
AtNuOscFitHistogramGetHistogram (AtNuResolutionEventType::AtNuResolutionEventType_t eventtype, AtNuResolutionType::AtNuResolutionType_t resolutiontype, Int_t updn=0, Int_t chg=0, Int_t nsys=0, Int_t nsigma=0)
Int_t GetBins ()
Double_t GetMin ()
Double_t GetMax ()
void WriteHistograms (const char *filename)
void ReadHistograms (const char *filename)
void CreateHistograms (AtNuTemplateType::AtNuTemplateType_t templatetype, Int_t nE, Double_t E1, Double_t E2, Int_t nsys)
Double_t GetTotalContent (Int_t updn, Int_t chg, Int_t isys=0, Int_t isigma=0)
void Scale (Int_t updn, Int_t chg, Int_t isys, Int_t isigma, Double_t scale)
void Randomize (TRandom *random)
void Scale (Double_t scale)
void PrintMe ()
void Reset ()
void TruncateHistograms ()

Private Member Functions

void ClearHistograms ()
void DeleteHistograms ()
void Initialize (AtNuTemplateType::AtNuTemplateType_t templatetype, Int_t nE, Double_t E1, Double_t E2, Int_t nsys)

Private Attributes

Int_t fNE
Double_t fE1
Double_t fE2
Int_t fNdir
Int_t fNchg
Int_t fNsys
Int_t fNhist
Int_t fHistograms
TString fHistName
TObjArray * fHistArray
AtNuTemplateType::AtNuTemplateType_t fTemplateType

Detailed Description

Definition at line 45 of file AtNuOscFitTemplate.h.


Constructor & Destructor Documentation

AtNuOscFitTemplate::AtNuOscFitTemplate (  ) 

Definition at line 64 of file AtNuOscFitTemplate.cxx.

References fE1, fE2, fNchg, fNdir, fNE, fNhist, fNsys, and fTemplateType.

00064                                        : fHistArray(0)
00065 {
00066   fNE = 1;
00067   fE1 = -0.5;
00068   fE2 = +4.5;
00069 
00070   fNdir = 0;
00071   fNchg = 0;
00072   fNsys = 0;
00073   fNhist = 0;
00074 
00075   fTemplateType = 0;
00076 }

AtNuOscFitTemplate::AtNuOscFitTemplate ( const char *  filename  ) 

Definition at line 106 of file AtNuOscFitTemplate.cxx.

References ReadHistograms().

00106                                                            : fHistArray(0)
00107 {
00108   std::cout << " *** AtNuOscFitTemplate::AtNuOscFitTemplate(READ) *** " << std::endl;
00109 
00110   this->ReadHistograms(filename);
00111 }

AtNuOscFitTemplate::AtNuOscFitTemplate ( AtNuTemplateType::AtNuTemplateType_t  templatetype,
Int_t  nE,
Double_t  E1,
Double_t  E2,
Int_t  nsys = 0 
)

Definition at line 99 of file AtNuOscFitTemplate.cxx.

References CreateHistograms().

00099                                                                                                                                       : fHistArray(0)
00100 {
00101   std::cout << " *** AtNuOscFitTemplate::AtNuOscFitTemplate(CREATE) *** " << std::endl;
00102  
00103   this->CreateHistograms(templatetype,nE,E1,E2,nsys);
00104 }

AtNuOscFitTemplate::AtNuOscFitTemplate ( const AtNuOscFitTemplate rhs  ) 

Definition at line 78 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNhist, and n.

00078                                                                     :
00079   TObject(rhs),
00080   fNE(rhs.fNE),
00081   fE1(rhs.fE1),
00082   fE2(rhs.fE2),
00083   fNdir(rhs.fNdir),
00084   fNchg(rhs.fNchg),
00085   fNsys(rhs.fNsys),
00086   fNhist(rhs.fNhist),
00087   fHistName(rhs.fHistName),
00088   fTemplateType(rhs.fTemplateType)
00089 {
00090   std::cout << " *** AtNuOscFitTemplate::AtNuOscFitTemplate(COPY) *** " << std::endl;
00091   
00092   fHistArray = new TObjArray[fNhist];
00093 
00094   for( Int_t n=0; n<fNhist; n++ ){
00095     fHistArray[n] = rhs.fHistArray[n];
00096   }
00097 }

AtNuOscFitTemplate::~AtNuOscFitTemplate (  ) 

Definition at line 113 of file AtNuOscFitTemplate.cxx.

References DeleteHistograms().

00114 {
00115   this->DeleteHistograms();
00116 }


Member Function Documentation

void AtNuOscFitTemplate::ClearHistograms (  )  [private]

Definition at line 118 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNhist, n, and AtNuOscFitHistogram::Reset().

Referenced by Reset().

00119 {
00120   if( fHistArray && fNhist>0 ){
00121     for( Int_t n=0; n<fNhist; n++ ){
00122       for( Int_t hist=0; hist<10; hist++ ){
00123         AtNuOscFitHistogram* myHist = (AtNuOscFitHistogram*)(fHistArray[n].At(hist)); 
00124         myHist->Reset();
00125       }
00126     }
00127   }
00128 
00129   return;
00130 }

void AtNuOscFitTemplate::CreateHistograms ( AtNuTemplateType::AtNuTemplateType_t  templatetype,
Int_t  nE,
Double_t  E1,
Double_t  E2,
Int_t  nsys 
)

Definition at line 203 of file AtNuOscFitTemplate.cxx.

References fE1, fE2, fHistArray, fNE, fNhist, Initialize(), and n.

Referenced by AtNuOscFitTemplate().

00204 {
00205   this->Initialize(templatetype,nE,E1,E2,nsys);
00206 
00207   //
00208   // std::cout << "   adding 10 histograms to each template... " << std::endl;
00209   //  
00210 
00211   AtNuOscFitHistogram* histNUE = 0;
00212   AtNuOscFitHistogram* histNUMU = 0;
00213 
00214   AtNuOscFitHistogram* histCV1 = 0;
00215   AtNuOscFitHistogram* histCV2 = 0;
00216   AtNuOscFitHistogram* histCV3 = 0;
00217   AtNuOscFitHistogram* histCV4 = 0;
00218 
00219   AtNuOscFitHistogram* histUP1 = 0;
00220   AtNuOscFitHistogram* histUP2 = 0;
00221   AtNuOscFitHistogram* histUP3 = 0;
00222   AtNuOscFitHistogram* histUP4 = 0;
00223 
00224   for( Int_t n=0; n<fNhist; n++ ){
00225     histNUE = new AtNuOscFitHistogram(1,fE1,fE2);
00226     fHistArray[n].Add(histNUE);
00227 
00228     histNUMU = new AtNuOscFitHistogram(1,fE1,fE2);
00229     fHistArray[n].Add(histNUMU);
00230 
00231     histCV1 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00232     fHistArray[n].Add(histCV1);
00233 
00234     histCV2 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00235     fHistArray[n].Add(histCV2);
00236 
00237     histCV3 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00238     fHistArray[n].Add(histCV3);
00239 
00240     histCV4 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00241     fHistArray[n].Add(histCV4);
00242 
00243     histUP1 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00244     fHistArray[n].Add(histUP1);
00245 
00246     histUP2 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00247     fHistArray[n].Add(histUP2);
00248 
00249     histUP3 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00250     fHistArray[n].Add(histUP3);
00251 
00252     histUP4 = new AtNuOscFitHistogram(fNE,fE1,fE2);
00253     fHistArray[n].Add(histUP4);
00254   }
00255 
00256   return;
00257 }

void AtNuOscFitTemplate::DeleteHistograms (  )  [private]

Definition at line 132 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNhist, and n.

Referenced by Initialize(), and ~AtNuOscFitTemplate().

00133 {
00134   if( fHistArray && fNhist>0 ){
00135     for( Int_t n=0; n<fNhist; n++ ){
00136       fHistArray[n].Delete();
00137     }
00138     delete [] fHistArray;
00139   }
00140 
00141   fNhist = 0;
00142 
00143   return;
00144 }

Int_t AtNuOscFitTemplate::GetBins (  )  [inline]

Definition at line 57 of file AtNuOscFitTemplate.h.

References fNE.

Referenced by AtNuOscFit::AddToExpectation().

00057 { return fNE; }

AtNuOscFitHistogram * AtNuOscFitTemplate::GetHistogram ( AtNuResolutionEventType::AtNuResolutionEventType_t  eventtype,
AtNuResolutionType::AtNuResolutionType_t  resolutiontype,
Int_t  updn = 0,
Int_t  chg = 0,
Int_t  nsys = 0,
Int_t  nsigma = 0 
)

Definition at line 259 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNchg, fNdir, fNhist, fNsys, fTemplateType, AtNuTemplateType::kAtmosData, AtNuTemplateType::kAtmosMC, AtNuTemplateType::kAtmosNueCC, AtNuTemplateType::kAtmosNueNC, AtNuTemplateType::kAtmosNumuCC, AtNuTemplateType::kAtmosNumuNC, AtNuTemplateType::kCosmicData, AtNuTemplateType::kCosmicMC, AtNuResolutionEventType::kCV, AtNuResolutionType::kHiRes1, AtNuResolutionType::kHiRes2, AtNuResolutionType::kHiRes3, AtNuResolutionType::kHiRes4, AtNuResolutionType::kLoRes, AtNuResolutionType::kNone, AtNuResolutionEventType::kNUE, AtNuResolutionEventType::kUPMU, and n.

Referenced by AtNuOscFit::AddToExpectation(), AtNuEventCounter::FillTemplates(), AtNuOscFit::GetDeltaLikelihood(), AtNuOscFit::GetDeltaLikelihoodBayes(), GetTotalContent(), AtNuOscFitTemplateMaker::Run(), and Scale().

00260 {  
00261 
00262   //
00263   // Event Type
00264   // ==========
00265   // AtNuResolutionEventType::AtNuResolutionEventType_t eventtype
00266   //  event type: NUE, CV, UPMU
00267   //
00268   // Event Resolution
00269   // ================
00270   // AtNuResolutionType::AtNuResolutionType_t resolutiontype
00271   //  resolution type: LORES, HIRES1, HIRES2, HIRES3, HIRES4
00272   // 
00273   // Systematic Effects
00274   // ==================
00275   // Int_t updn : Up/Down  
00276   //    (-1) down-going events
00277   //    (0) all events
00278   //    (+1) up-going events
00279   // Int_t chg: Positive/Negative
00280   //    (0) all events
00281   //    (-1) nu
00282   //    (+1) nubar
00283   // Int_t nsys: Systematic Effect
00284   //    (0) none
00285   //    (1)
00286   //    (2)
00287   //    (3)
00288   //    (4)
00289   //    (5)
00290   //    (...)
00291   // Int_t nsigma: Standard Deviations
00292   //
00293 
00294   Int_t n = -1;  
00295   Int_t hist = -1; 
00296   AtNuOscFitHistogram* myHist = 0;
00297 
00298   switch( eventtype ){
00299     case AtNuResolutionEventType::kNUE:
00300       switch( resolutiontype ){
00301         case AtNuResolutionType::kNone:   hist = -1; break;  //  -> check...
00302         case AtNuResolutionType::kLoRes:  hist = 0;  break;  // NUE
00303         case AtNuResolutionType::kHiRes1: hist = -1; break;  //  -> check...
00304         case AtNuResolutionType::kHiRes2: hist = -1; break;  //  -> check...
00305         case AtNuResolutionType::kHiRes3: hist = -1; break;  //  -> check...
00306         case AtNuResolutionType::kHiRes4: hist = -1; break;  //  -> check...
00307       }
00308       break;
00309     case AtNuResolutionEventType::kCV:
00310       switch( resolutiontype ){
00311         case AtNuResolutionType::kNone:   hist = -1; break;  //  -> check...
00312         case AtNuResolutionType::kLoRes:  hist = 1;  break;  // NUMU LORES
00313         case AtNuResolutionType::kHiRes1: hist = 2;  break;  // NUMU HIRES (1)
00314         case AtNuResolutionType::kHiRes2: hist = 3;  break;  // NUMU HIRES (2)
00315         case AtNuResolutionType::kHiRes3: hist = 4;  break;  // NUMU HIRES (3)
00316         case AtNuResolutionType::kHiRes4: hist = 5;  break;  // NUMU HIRES (4)
00317       }
00318       break;
00319     case AtNuResolutionEventType::kUPMU:
00320       switch( resolutiontype ){
00321         case AtNuResolutionType::kNone:   hist = -1; break;  //  -> check...
00322         case AtNuResolutionType::kLoRes:  hist = -1; break;  //  -> check...
00323         case AtNuResolutionType::kHiRes1: hist = 6; break;   // UPMU HIRES (1)
00324         case AtNuResolutionType::kHiRes2: hist = 7; break;   // UPMU HIRES (2)
00325         case AtNuResolutionType::kHiRes3: hist = 8; break;   // UPMU HIRES (3)
00326         case AtNuResolutionType::kHiRes4: hist = 9; break;   // UPMU HIRES (4)
00327       }
00328       break;
00329     default:
00330       break;
00331   }
00332 
00333   if( fTemplateType==AtNuTemplateType::kAtmosNumuCC
00334    || fTemplateType==AtNuTemplateType::kAtmosNueCC
00335    || fTemplateType==AtNuTemplateType::kAtmosNumuNC
00336    || fTemplateType==AtNuTemplateType::kAtmosNueNC ){
00337 
00338     Int_t binupdn = -1;
00339     if( fNdir>1 && updn!=0 ){
00340       if( updn==-1 ) binupdn = 0;
00341       if( updn==+1 ) binupdn = 1;
00342     }
00343     else if( fNdir==1 && updn==0 ){
00344       binupdn = 0;
00345     }
00346 
00347     Int_t binchg = -1;  
00348     if( fNchg>1 && chg!=0 ){
00349       if( chg==-1 ) binchg = 0;
00350       if( chg==+1 ) binchg = 1;
00351     }
00352     else if( fNchg==1 && chg==0 ){
00353       binchg = 0;
00354     }
00355 
00356     Int_t binshift = 0;
00357     if( nsys>0 && nsys<fNsys && nsigma!=0 ){
00358       binshift = 1;
00359     }
00360 
00361     Int_t binsys = 0;
00362     if( nsys>0 && nsys<fNsys && nsigma!=0 ){
00363       binsys = nsys-1;
00364     }
00365 
00366     Int_t binsigma = 0;
00367     if( nsys>0 && nsys<fNsys && nsigma!=0 ){
00368       if( nsigma==-1 )      binsigma = 1;
00369       else if( nsigma==+1 ) binsigma = 2;
00370       else if( nsigma==-2 ) binsigma = 0;
00371       else if( nsigma==+2 ) binsigma = 3;
00372       else binsigma = -1;
00373     }
00374 
00375     if( binupdn>=0 && binchg>=0 
00376      && binsys>=0 && binsigma>=0 ){
00377       n = binupdn*fNchg*(4*fNsys-3)
00378         + binchg*(4*fNsys-3)
00379         + binshift
00380         + 4*binsys
00381         + binsigma;
00382     }
00383   }
00384 
00385   else 
00386   if( fTemplateType==AtNuTemplateType::kAtmosData
00387    || fTemplateType==AtNuTemplateType::kAtmosMC
00388    || fTemplateType==AtNuTemplateType::kCosmicMC
00389    || fTemplateType==AtNuTemplateType::kCosmicData ){
00390     if( updn==0 && chg==0 && nsys==0 && nsigma==0 ){
00391       n = 0;
00392     }
00393   }
00394 
00395   if( n>=0 && n<fNhist ){
00396     if( hist>=0 && hist<10 ){
00397       myHist = (AtNuOscFitHistogram*)(fHistArray[n].At(hist));
00398     }
00399   }
00400 
00401   return myHist;
00402 }

Double_t AtNuOscFitTemplate::GetMax (  )  [inline]

Definition at line 59 of file AtNuOscFitTemplate.h.

References fE2.

Referenced by AtNuOscFit::AddToExpectation().

00059 { return fE2; }

Double_t AtNuOscFitTemplate::GetMin (  )  [inline]

Definition at line 58 of file AtNuOscFitTemplate.h.

References fE1.

Referenced by AtNuOscFit::AddToExpectation().

00058 { return fE1; }

Double_t AtNuOscFitTemplate::GetTotalContent ( Int_t  updn,
Int_t  chg,
Int_t  isys = 0,
Int_t  isigma = 0 
)

Definition at line 1012 of file AtNuOscFitTemplate.cxx.

References GetHistogram(), AtNuOscFitHistogram::GetTotalContent(), AtNuResolutionEventType::kCV, AtNuResolutionType::kHiRes1, AtNuResolutionType::kHiRes2, AtNuResolutionType::kHiRes3, AtNuResolutionType::kHiRes4, AtNuResolutionType::kLoRes, AtNuResolutionEventType::kNUE, AtNuResolutionEventType::kUPMU, and total().

01013 {
01014   Double_t total = 0.0;                
01015 
01016   AtNuOscFitHistogram* myHistogram = 0;
01017 
01018   // electron neutrino events
01019   // ========================
01020   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kNUE,
01021                                                            AtNuResolutionType::kLoRes,
01022                                                             idir,ichg,isys,isigma));
01023   if( myHistogram ) total += myHistogram->GetTotalContent();
01024 
01025   // contained vertex events
01026   // =======================
01027   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01028                                                            AtNuResolutionType::kLoRes,
01029                                                             idir,ichg,isys,isigma));
01030   if( myHistogram ) total += myHistogram->GetTotalContent();
01031 
01032   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01033                                                            AtNuResolutionType::kHiRes1,
01034                                                             idir,ichg,isys,isigma));  
01035   if( myHistogram ) total += myHistogram->GetTotalContent();
01036 
01037   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01038                                                            AtNuResolutionType::kHiRes2,
01039                                                             idir,ichg,isys,isigma)); 
01040   if( myHistogram ) total += myHistogram->GetTotalContent();
01041 
01042   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01043                                                            AtNuResolutionType::kHiRes3,
01044                                                             idir,ichg,isys,isigma));     
01045   if( myHistogram ) total += myHistogram->GetTotalContent();
01046 
01047   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01048                                                            AtNuResolutionType::kHiRes4,
01049                                                             idir,ichg,isys,isigma));
01050   if( myHistogram ) total += myHistogram->GetTotalContent();
01051 
01052   // upward muon events
01053   // ==================
01054   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01055                                                            AtNuResolutionType::kHiRes1,
01056                                                             idir,ichg,isys,isigma));  
01057   if( myHistogram ) total += myHistogram->GetTotalContent();
01058 
01059   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01060                                                            AtNuResolutionType::kHiRes2,
01061                                                             idir,ichg,isys,isigma));  
01062   if( myHistogram ) total += myHistogram->GetTotalContent();
01063 
01064   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01065                                                            AtNuResolutionType::kHiRes3,
01066                                                             idir,ichg,isys,isigma));     
01067   if( myHistogram ) total += myHistogram->GetTotalContent();
01068 
01069   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01070                                                            AtNuResolutionType::kHiRes4,
01071                                                             idir,ichg,isys,isigma)); 
01072   if( myHistogram ) total += myHistogram->GetTotalContent();
01073 
01074   return total;    
01075 }

void AtNuOscFitTemplate::Initialize ( AtNuTemplateType::AtNuTemplateType_t  templatetype,
Int_t  nE,
Double_t  E1,
Double_t  E2,
Int_t  nsys 
) [private]

Definition at line 167 of file AtNuOscFitTemplate.cxx.

References DeleteHistograms(), fE1, fE2, fHistArray, fHistName, fNchg, fNdir, fNE, fNhist, fNsys, fTemplateType, AtNuTemplateType::kAtmosNueCC, AtNuTemplateType::kAtmosNueNC, AtNuTemplateType::kAtmosNumuCC, and AtNuTemplateType::kAtmosNumuNC.

Referenced by CreateHistograms(), and ReadHistograms().

00168 {
00169   this->DeleteHistograms();
00170 
00171   fHistName = "oscfit_hist";
00172 
00173   fNE = nE;
00174   fE1 = E1;
00175   fE2 = E2;
00176 
00177   fTemplateType = templatetype;
00178 
00179   if( fTemplateType==AtNuTemplateType::kAtmosNumuCC
00180    || fTemplateType==AtNuTemplateType::kAtmosNueCC 
00181    || fTemplateType==AtNuTemplateType::kAtmosNumuNC 
00182    || fTemplateType==AtNuTemplateType::kAtmosNueNC ){
00183     fNdir = 2; fNchg = 2; fNsys = nsys+1;
00184   }
00185   else{
00186     fNdir = 1; fNchg = 1; fNsys = 1;
00187   }
00188   
00189   fNhist = fNdir*fNchg*(4*fNsys-3);
00190 
00191   //
00192   // std::cout << "   Template Type  = " << AtNuTemplateType::AsString(templatetype) << std::endl;
00193   // std::cout << "   Template Array = [" << fNdir << "][" << fNchg << "][" << fNsys << "]" << std::endl; 
00194   // std::cout << "   L/E Binning    = [" << nE << "," << E1 << "," << E2 << "]" << std::endl; 
00195   // std::cout << "   creating array of " << fNhist << " templates... " << std::endl;
00196   //
00197 
00198   fHistArray = new TObjArray[fNhist];
00199 
00200   return;
00201 }

void AtNuOscFitTemplate::PrintMe (  ) 

Definition at line 1153 of file AtNuOscFitTemplate.cxx.

01154 {
01155   return;
01156 }

void AtNuOscFitTemplate::Randomize ( TRandom *  random  ) 

Definition at line 998 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNhist, n, and AtNuOscFitHistogram::Randomize().

Referenced by AtNuOscFit::Run(), and AtNuOscFit::RunExpt().

00999 {
01000   std::cout << " *** AtNuOscFitTemplate::Randomize(...) *** " << std::endl;
01001 
01002   for( Int_t n=0; n<fNhist; n++ ){
01003     for( Int_t k=0; k<1+fHistArray[n].GetLast(); k++ ){
01004       AtNuOscFitHistogram* myHistogram = (AtNuOscFitHistogram*)(fHistArray[n].At(k));
01005       myHistogram->Randomize(random);
01006     }
01007   }
01008 
01009   return;
01010 }

void AtNuOscFitTemplate::ReadHistograms ( const char *  filename  ) 

Definition at line 522 of file AtNuOscFitTemplate.cxx.

References fHistArray, fHistName, fNchg, fNdir, fNsys, Initialize(), and n.

Referenced by AtNuOscFitTemplate().

00523 {
00524   std::cout << " *** AtNuOscFitTemplate::ReadHistograms(...) *** " << std::endl;
00525   std::cout << "   reading histograms from file: " << filename << std::endl;
00526 
00527   TDirectory* tmpd = gDirectory;
00528   TFile* myFile = TFile::Open(filename,"read");
00529 
00530   if( myFile ){
00531 
00532     // read in configuration
00533     // =====================
00534     // 
00535     // std::cout << "   reading configuration... " << std::endl;
00536     //
00537 
00538     TH1I* hConfig = (TH1I*)(myFile->Get("hConfig"));
00539     TH1I* hBinning = (TH1I*)(myFile->Get("hBinning"));
00540 
00541     Int_t ftemplatetype = (Int_t)hConfig->GetBinContent(1);
00542     Int_t fnsys = (Int_t)hConfig->GetBinContent(2);
00543 
00544     Int_t fne = hBinning->GetNbinsX();
00545     Double_t fe1 = hBinning->GetBinLowEdge(1);
00546     Double_t fe2 = hBinning->GetBinLowEdge(fne+1);
00547 
00548     this->Initialize(ftemplatetype,fne,fe1,fe2,fnsys);
00549 
00550     // read in histograms
00551     // ==================
00552     AtNuOscFitHistogram* myHistogram = 0;
00553     
00554     for( Int_t ndir=0; ndir<fNdir; ndir++ ){
00555       for( Int_t nchg=0; nchg<fNchg; nchg++ ){
00556         for( Int_t nsys=0; nsys<fNsys; nsys++ ){
00557           for( Int_t nsigma=0; nsigma<4; nsigma++ ){
00558 
00559             if( nsys>0 || nsigma==0 ){
00560               Int_t binshift = 0;
00561               Int_t binsys = 0;
00562               Int_t binsigma = 0;
00563 
00564               if( nsys>0 ){
00565                 binshift = 1;
00566                 binsys = nsys-1;
00567                 binsigma = nsigma;
00568               }
00569 
00570               Int_t n = ndir*fNchg*(4*fNsys-3)
00571                       + nchg*(4*fNsys-3)
00572                       + binshift
00573                       + 4*binsys
00574                       + binsigma;
00575 
00576               TString histnamebase(fHistName.Data());
00577               histnamebase.Append("_"); histnamebase+=ndir;
00578               histnamebase.Append("_"); histnamebase+=nchg;
00579               histnamebase.Append("_"); histnamebase+=nsys;
00580               histnamebase.Append("_"); histnamebase+=nsigma;
00581               
00582               //
00583               // std::cout << "   getting: " << histnamebase.Data() << "*" << std::endl; 
00584               //
00585 
00586               Int_t k;
00587               TString histname = "";
00588               TString histname_up_neg = "";
00589               TString histname_up_0 = "";
00590               TString histname_up_pos = "";              
00591               TString histname_dn_neg = "";
00592               TString histname_dn_0 = "";
00593               TString histname_dn_pos = "";
00594               TString histname_lores = "";
00595 
00596               TH1D* htemp_up_neg = 0;
00597               TH1D* htemp_up_0 = 0;
00598               TH1D* htemp_up_pos = 0;             
00599               TH1D* htemp_dn_neg = 0;
00600               TH1D* htemp_dn_0 = 0;
00601               TH1D* htemp_dn_pos = 0;   
00602               TH1D* htemp_lores = 0;
00603 
00604               // (0) NUE LORES
00605               k = 0;
00606               histname = histnamebase;
00607               histname.Append("_"); histname += k;
00608 
00609               histname_up_neg = histname;
00610               histname_up_neg.Append("_up_neg");
00611               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00612 
00613               histname_up_0 = histname;
00614               histname_up_0.Append("_up_0");
00615               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00616             
00617               histname_up_pos = histname;
00618               histname_up_pos.Append("_up_pos");
00619               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00620 
00621               histname_dn_neg = histname;
00622               histname_dn_neg.Append("_dn_neg");
00623               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00624 
00625               histname_dn_0 = histname;
00626               histname_dn_0.Append("_dn_0");
00627               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00628             
00629               histname_dn_pos = histname;
00630               histname_dn_pos.Append("_dn_pos");
00631               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00632 
00633               histname_lores = histname;
00634               histname_lores.Append("_lores");
00635               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00636 
00637               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00638                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00639                                                     htemp_lores);
00640               fHistArray[n].Add(myHistogram);  
00641 
00642               // (1) NUMU LORES
00643               k = 1;
00644               histname = histnamebase;
00645               histname = histnamebase;
00646               histname.Append("_"); histname += k;
00647 
00648               histname_up_neg = histname;
00649               histname_up_neg.Append("_up_neg");
00650               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00651 
00652               histname_up_0 = histname;
00653               histname_up_0.Append("_up_0");
00654               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00655             
00656               histname_up_pos = histname;
00657               histname_up_pos.Append("_up_pos");
00658               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00659 
00660               histname_dn_neg = histname;
00661               histname_dn_neg.Append("_dn_neg");
00662               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00663 
00664               histname_dn_0 = histname;
00665               histname_dn_0.Append("_dn_0");
00666               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00667             
00668               histname_dn_pos = histname;
00669               histname_dn_pos.Append("_dn_pos");
00670               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00671 
00672               histname_lores = histname;
00673               histname_lores.Append("_lores");
00674               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00675 
00676               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00677                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00678                                                     htemp_lores);
00679               fHistArray[n].Add(myHistogram);  
00680 
00681               // (2) NUMU HIRES 1
00682               k = 2;
00683               histname = histnamebase;
00684               histname.Append("_"); histname += k;
00685 
00686               histname_up_neg = histname;
00687               histname_up_neg.Append("_up_neg");
00688               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00689 
00690               histname_up_0 = histname;
00691               histname_up_0.Append("_up_0");
00692               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00693             
00694               histname_up_pos = histname;
00695               histname_up_pos.Append("_up_pos");
00696               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00697 
00698               histname_dn_neg = histname;
00699               histname_dn_neg.Append("_dn_neg");
00700               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00701 
00702               histname_dn_0 = histname;
00703               histname_dn_0.Append("_dn_0");
00704               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00705             
00706               histname_dn_pos = histname;
00707               histname_dn_pos.Append("_dn_pos");
00708               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00709 
00710               histname_lores = histname;
00711               histname_lores.Append("_lores");
00712               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00713 
00714               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00715                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00716                                                     htemp_lores);
00717               fHistArray[n].Add(myHistogram);  
00718 
00719               // (3) NUMU HIRES 2
00720               k = 3;
00721               histname = histnamebase;
00722               histname.Append("_"); histname += k;
00723 
00724               histname_up_neg = histname;
00725               histname_up_neg.Append("_up_neg");
00726               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00727 
00728               histname_up_0 = histname;
00729               histname_up_0.Append("_up_0");
00730               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00731             
00732               histname_up_pos = histname;
00733               histname_up_pos.Append("_up_pos");
00734               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00735 
00736               histname_dn_neg = histname;
00737               histname_dn_neg.Append("_dn_neg");
00738               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00739 
00740               histname_dn_0 = histname;
00741               histname_dn_0.Append("_dn_0");
00742               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00743             
00744               histname_dn_pos = histname;
00745               histname_dn_pos.Append("_dn_pos");
00746               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00747 
00748               histname_lores = histname;
00749               histname_lores.Append("_lores");
00750               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00751 
00752               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00753                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00754                                                     htemp_lores);
00755               fHistArray[n].Add(myHistogram);  
00756 
00757               // (4) NUMU HIRES 3
00758               k = 4;
00759               histname = histnamebase;
00760               histname.Append("_"); histname += k;
00761 
00762               histname_up_neg = histname;
00763               histname_up_neg.Append("_up_neg");
00764               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00765 
00766               histname_up_0 = histname;
00767               histname_up_0.Append("_up_0");
00768               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00769             
00770               histname_up_pos = histname;
00771               histname_up_pos.Append("_up_pos");
00772               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00773 
00774               histname_dn_neg = histname;
00775               histname_dn_neg.Append("_dn_neg");
00776               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00777 
00778               histname_dn_0 = histname;
00779               histname_dn_0.Append("_dn_0");
00780               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00781             
00782               histname_dn_pos = histname;
00783               histname_dn_pos.Append("_dn_pos");
00784               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00785 
00786               histname_lores = histname;
00787               histname_lores.Append("_lores");
00788               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00789 
00790               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00791                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00792                                                     htemp_lores);
00793               fHistArray[n].Add(myHistogram);  
00794 
00795               // (5) NUMU HIRES 4
00796               k = 5;
00797               histname = histnamebase;
00798               histname.Append("_"); histname += k;
00799 
00800               histname_up_neg = histname;
00801               histname_up_neg.Append("_up_neg");
00802               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00803 
00804               histname_up_0 = histname;
00805               histname_up_0.Append("_up_0");
00806               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00807             
00808               histname_up_pos = histname;
00809               histname_up_pos.Append("_up_pos");
00810               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00811 
00812               histname_dn_neg = histname;
00813               histname_dn_neg.Append("_dn_neg");
00814               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00815 
00816               histname_dn_0 = histname;
00817               histname_dn_0.Append("_dn_0");
00818               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00819             
00820               histname_dn_pos = histname;
00821               histname_dn_pos.Append("_dn_pos");
00822               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00823 
00824               histname_lores = histname;
00825               histname_lores.Append("_lores");
00826               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00827 
00828               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00829                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00830                                                     htemp_lores);
00831               fHistArray[n].Add(myHistogram);
00832 
00833               // (6) UPMU HIRES 1
00834               k = 6;
00835               histname = histnamebase;
00836               histname.Append("_"); histname += k;
00837 
00838               histname_up_neg = histname;
00839               histname_up_neg.Append("_up_neg");
00840               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00841 
00842               histname_up_0 = histname;
00843               histname_up_0.Append("_up_0");
00844               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00845             
00846               histname_up_pos = histname;
00847               histname_up_pos.Append("_up_pos");
00848               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00849 
00850               histname_dn_neg = histname;
00851               histname_dn_neg.Append("_dn_neg");
00852               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00853 
00854               histname_dn_0 = histname;
00855               histname_dn_0.Append("_dn_0");
00856               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00857             
00858               histname_dn_pos = histname;
00859               histname_dn_pos.Append("_dn_pos");
00860               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00861 
00862               histname_lores = histname;
00863               histname_lores.Append("_lores");
00864               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00865 
00866               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00867                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00868                                                     htemp_lores);
00869               fHistArray[n].Add(myHistogram);  
00870 
00871               // (7) UPMU HIRES 2
00872               k = 7;
00873               histname = histnamebase;
00874               histname.Append("_"); histname += k;
00875 
00876               histname_up_neg = histname;
00877               histname_up_neg.Append("_up_neg");
00878               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00879 
00880               histname_up_0 = histname;
00881               histname_up_0.Append("_up_0");
00882               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00883             
00884               histname_up_pos = histname;
00885               histname_up_pos.Append("_up_pos");
00886               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00887 
00888               histname_dn_neg = histname;
00889               histname_dn_neg.Append("_dn_neg");
00890               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00891 
00892               histname_dn_0 = histname;
00893               histname_dn_0.Append("_dn_0");
00894               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00895             
00896               histname_dn_pos = histname;
00897               histname_dn_pos.Append("_dn_pos");
00898               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00899 
00900               histname_lores = histname;
00901               histname_lores.Append("_lores");
00902               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00903 
00904               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00905                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00906                                                     htemp_lores);
00907               fHistArray[n].Add(myHistogram);  
00908 
00909               // (8) UPMU HIRES 3
00910               k = 8;
00911               histname = histnamebase;
00912               histname.Append("_"); histname += k;
00913 
00914               histname_up_neg = histname;
00915               histname_up_neg.Append("_up_neg");
00916               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00917 
00918               histname_up_0 = histname;
00919               histname_up_0.Append("_up_0");
00920               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00921             
00922               histname_up_pos = histname;
00923               histname_up_pos.Append("_up_pos");
00924               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00925 
00926               histname_dn_neg = histname;
00927               histname_dn_neg.Append("_dn_neg");
00928               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00929 
00930               histname_dn_0 = histname;
00931               histname_dn_0.Append("_dn_0");
00932               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00933             
00934               histname_dn_pos = histname;
00935               histname_dn_pos.Append("_dn_pos");
00936               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00937 
00938               histname_lores = histname;
00939               histname_lores.Append("_lores");
00940               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00941 
00942               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00943                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00944                                                     htemp_lores);
00945               fHistArray[n].Add(myHistogram);  
00946 
00947               // (9) UPMU HIRES 4
00948               k = 9;
00949               histname = histnamebase;
00950               histname.Append("_"); histname += k;
00951 
00952               histname_up_neg = histname;
00953               histname_up_neg.Append("_up_neg");
00954               htemp_up_neg = (TH1D*)(myFile->Get(histname_up_neg.Data()));
00955 
00956               histname_up_0 = histname;
00957               histname_up_0.Append("_up_0");
00958               htemp_up_0 = (TH1D*)(myFile->Get(histname_up_0.Data()));
00959             
00960               histname_up_pos = histname;
00961               histname_up_pos.Append("_up_pos");
00962               htemp_up_pos = (TH1D*)(myFile->Get(histname_up_pos.Data()));
00963 
00964               histname_dn_neg = histname;
00965               histname_dn_neg.Append("_dn_neg");
00966               htemp_dn_neg = (TH1D*)(myFile->Get(histname_dn_neg.Data()));
00967 
00968               histname_dn_0 = histname;
00969               histname_dn_0.Append("_dn_0");
00970               htemp_dn_0 = (TH1D*)(myFile->Get(histname_dn_0.Data()));
00971             
00972               histname_dn_pos = histname;
00973               histname_dn_pos.Append("_dn_pos");
00974               htemp_dn_pos = (TH1D*)(myFile->Get(histname_dn_pos.Data()));
00975 
00976               histname_lores = histname;
00977               histname_lores.Append("_lores");
00978               htemp_lores = (TH1D*)(myFile->Get(histname_lores.Data()));
00979 
00980               myHistogram = new AtNuOscFitHistogram(htemp_up_neg,htemp_up_0,htemp_up_pos,
00981                                                     htemp_dn_neg,htemp_dn_0,htemp_dn_pos,
00982                                                     htemp_lores);
00983               fHistArray[n].Add(myHistogram);  
00984 
00985             }
00986           }
00987         }
00988       }
00989     }
00990   }
00991 
00992   myFile->Close();
00993   gDirectory = tmpd;
00994 
00995   return;
00996 }

void AtNuOscFitTemplate::Reset (  ) 
void AtNuOscFitTemplate::Scale ( Double_t  scale  ) 

Definition at line 1140 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNhist, n, and AtNuOscFitHistogram::Scale().

01141 {
01142 
01143   for( Int_t n=0; n<fNhist; n++ ){
01144     for( Int_t k=0; k<1+fHistArray[n].GetLast(); k++ ){
01145       AtNuOscFitHistogram* myHistogram = (AtNuOscFitHistogram*)(fHistArray[n].At(k));
01146       myHistogram->Scale(scale);
01147     }
01148   }
01149 
01150   return;
01151 }

void AtNuOscFitTemplate::Scale ( Int_t  updn,
Int_t  chg,
Int_t  isys,
Int_t  isigma,
Double_t  scale 
)

Definition at line 1077 of file AtNuOscFitTemplate.cxx.

References GetHistogram(), AtNuResolutionEventType::kCV, AtNuResolutionType::kHiRes1, AtNuResolutionType::kHiRes2, AtNuResolutionType::kHiRes3, AtNuResolutionType::kHiRes4, AtNuResolutionType::kLoRes, AtNuResolutionEventType::kNUE, AtNuResolutionEventType::kUPMU, and AtNuOscFitHistogram::Scale().

Referenced by AtNuOscFit::ScaleTemplates().

01078 {
01079   AtNuOscFitHistogram* myHistogram = 0;
01080 
01081   // electron neutrino events
01082   // ========================
01083   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kNUE,
01084                                                            AtNuResolutionType::kLoRes,
01085                                                             idir,ichg,isys,isigma));
01086   if( myHistogram ) myHistogram->Scale(scale);
01087 
01088   // contained vertex events
01089   // =======================
01090   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01091                                                            AtNuResolutionType::kLoRes,
01092                                                             idir,ichg,isys,isigma));
01093   if( myHistogram ) myHistogram->Scale(scale);
01094 
01095   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01096                                                            AtNuResolutionType::kHiRes1,
01097                                                             idir,ichg,isys,isigma));  
01098   if( myHistogram ) myHistogram->Scale(scale);
01099 
01100   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01101                                                            AtNuResolutionType::kHiRes2,
01102                                                             idir,ichg,isys,isigma)); 
01103   if( myHistogram ) myHistogram->Scale(scale);
01104 
01105   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01106                                                            AtNuResolutionType::kHiRes3,
01107                                                             idir,ichg,isys,isigma));     
01108   if( myHistogram ) myHistogram->Scale(scale);
01109 
01110   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kCV,
01111                                                            AtNuResolutionType::kHiRes4,
01112                                                             idir,ichg,isys,isigma));
01113   if( myHistogram ) myHistogram->Scale(scale);
01114 
01115   // upward muon events
01116   // ==================
01117   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01118                                                            AtNuResolutionType::kHiRes1,
01119                                                             idir,ichg,isys,isigma));  
01120   if( myHistogram ) myHistogram->Scale(scale);
01121 
01122   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01123                                                            AtNuResolutionType::kHiRes2,
01124                                                             idir,ichg,isys,isigma));  
01125   if( myHistogram ) myHistogram->Scale(scale);
01126 
01127   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01128                                                            AtNuResolutionType::kHiRes3,
01129                                                             idir,ichg,isys,isigma));     
01130   if( myHistogram ) myHistogram->Scale(scale);
01131 
01132   myHistogram = (AtNuOscFitHistogram*)(this->GetHistogram(AtNuResolutionEventType::kUPMU,
01133                                                            AtNuResolutionType::kHiRes4,
01134                                                             idir,ichg,isys,isigma)); 
01135   if( myHistogram ) myHistogram->Scale(scale);
01136 
01137   return;
01138 }

void AtNuOscFitTemplate::TruncateHistograms (  ) 

Definition at line 146 of file AtNuOscFitTemplate.cxx.

References fHistArray, fNhist, n, and AtNuOscFitHistogram::Truncate().

Referenced by AtNuOscFit::GetExpectation().

00147 {
00148   if( fHistArray && fNhist>0 ){
00149     for( Int_t n=0; n<fNhist; n++ ){
00150       for( Int_t hist=0; hist<10; hist++ ){
00151         AtNuOscFitHistogram* myHist = (AtNuOscFitHistogram*)(fHistArray[n].At(hist)); 
00152         myHist->Truncate();
00153       }
00154     }
00155   }
00156 
00157   return;
00158 }

void AtNuOscFitTemplate::WriteHistograms ( const char *  filename  ) 

Definition at line 404 of file AtNuOscFitTemplate.cxx.

References fE1, fE2, fHistArray, fHistName, fNchg, fNdir, fNE, fNsys, fTemplateType, AtNuTemplateType::kAtmosData, AtNuTemplateType::kAtmosMC, AtNuOscFitHistogram::MakeTH1D(), and n.

Referenced by AtNuOscFitTemplateMaker::Run(), AtNuOscFit::RunExpts(), AtNuOscFit::RunWriteExptTemplates(), AtNuOscFit::RunWriteFitTemplates(), AtNuOscFit::RunWriteOscTemplates(), AtNuOscFit::RunWriteSystTemplates(), and AtNuEventCounter::WriteTemplates().

00405 {
00406   std::cout << " *** AtNuOscFitTemplate::WriteHistograms(...) *** " << std::endl;
00407   std::cout << "   writing histograms to file: " << filename << std::endl;
00408 
00409   TDirectory* tmpd = gDirectory;
00410   TFile* myFile = TFile::Open(filename,"recreate");
00411 
00412   // write out configuration
00413   // =======================
00414   TH1I* hConfig = new TH1I("hConfig","hConfig",5,-0.5,4.5);
00415   TH1I* hBinning = new TH1I("hBinning","hBinning",fNE,fE1,fE2);
00416 
00417   hConfig->SetBinContent(1,fTemplateType);
00418   hConfig->SetBinContent(2,fNsys-1);
00419 
00420   hConfig->Write();
00421   hBinning->Write();
00422 
00423   // write out histograms
00424   // ====================
00425   AtNuOscFitHistogram* myHistogram = 0;
00426 
00427   TH1D* histUpNeg = 0; 
00428   TH1D* histUp0 = 0; 
00429   TH1D* histUpPos = 0;  
00430   TH1D* histDnNeg = 0; 
00431   TH1D* histDn0 = 0; 
00432   TH1D* histDnPos = 0;
00433   TH1D* histLowRes = 0;
00434 
00435   TH1D* histNeg = 0; 
00436   TH1D* hist0 = 0; 
00437   TH1D* histPos = 0;  
00438   TH1D* histAll = 0;
00439 
00440   for( Int_t ndir=0; ndir<fNdir; ndir++ ){
00441     for( Int_t nchg=0; nchg<fNchg; nchg++ ){
00442       for( Int_t nsys=0; nsys<fNsys; nsys++ ){
00443         for( Int_t nsigma=0; nsigma<4; nsigma++ ){
00444 
00445           if( nsys>0 || nsigma==0 ){
00446             Int_t binshift = 0;
00447             Int_t binsys = 0;
00448             Int_t binsigma = 0;
00449 
00450             if( nsys>0 ){
00451               binshift = 1;
00452               binsys = nsys-1;
00453               binsigma = nsigma;
00454             }
00455 
00456             Int_t n = ndir*fNchg*(4*fNsys-3)
00457                     + nchg*(4*fNsys-3)
00458                     + binshift
00459                     + 4*binsys
00460                     + binsigma;
00461 
00462             for( Int_t k=0; k<1+fHistArray[n].GetLast(); k++ ){
00463               TString histname(fHistName.Data());
00464               histname.Append("_"); histname+=ndir;
00465               histname.Append("_"); histname+=nchg;
00466               histname.Append("_"); histname+=nsys;
00467               histname.Append("_"); histname+=nsigma;
00468               histname.Append("_"); histname+=k;
00469 
00470               myHistogram = (AtNuOscFitHistogram*)(fHistArray[n].At(k));  
00471               histUpNeg = 0; 
00472               histUp0 = 0; 
00473               histUpPos = 0;  
00474               histDnNeg = 0; 
00475               histDn0 = 0; 
00476               histDnPos = 0;
00477               histLowRes = 0;
00478               histNeg = 0; 
00479               hist0 = 0; 
00480               histPos = 0; 
00481               histAll = 0;
00482 
00483               myHistogram->MakeTH1D(histname.Data(),
00484                                     histUpNeg,histUp0,histUpPos,
00485                                     histDnNeg,histDn0,histDnPos,histLowRes,
00486                                     histNeg,hist0,histPos,histAll);
00487 
00488               histUpNeg->Write(); 
00489               histUp0->Write(); 
00490               histUpPos->Write();  
00491               histDnNeg->Write(); 
00492               histDn0->Write(); 
00493               histDnPos->Write();
00494               histLowRes->Write();
00495 
00496               if( fTemplateType==AtNuTemplateType::kAtmosData
00497                || fTemplateType==AtNuTemplateType::kAtmosMC ){
00498                 if( fNdir == 1 
00499                  && fNchg == 1 
00500                  && fNsys == 1 ){
00501                   histNeg->Write(); 
00502                   hist0->Write(); 
00503                   histPos->Write(); 
00504                   histAll->Write();
00505                 }
00506               }
00507 
00508             }
00509 
00510           }
00511         }
00512       }
00513     }
00514   }
00515     
00516   myFile->Close();
00517   gDirectory = tmpd;
00518 
00519   return;
00520 }


Member Data Documentation

Double_t AtNuOscFitTemplate::fE1 [private]
Double_t AtNuOscFitTemplate::fE2 [private]
TObjArray* AtNuOscFitTemplate::fHistArray [private]
TString AtNuOscFitTemplate::fHistName [private]

Definition at line 93 of file AtNuOscFitTemplate.h.

Referenced by Initialize(), ReadHistograms(), and WriteHistograms().

Definition at line 91 of file AtNuOscFitTemplate.h.

Int_t AtNuOscFitTemplate::fNchg [private]
Int_t AtNuOscFitTemplate::fNdir [private]
Int_t AtNuOscFitTemplate::fNE [private]
Int_t AtNuOscFitTemplate::fNhist [private]
Int_t AtNuOscFitTemplate::fNsys [private]

Definition at line 97 of file AtNuOscFitTemplate.h.

Referenced by AtNuOscFitTemplate(), GetHistogram(), Initialize(), and WriteHistograms().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1