OscFit::TemplateMap Class Reference

#include <TemplateMap.h>

List of all members.

Public Member Functions

 TemplateMap ()
 ~TemplateMap ()
Bool_t TouchAtmosData ()
Bool_t TouchBeamData ()
Bool_t TouchData ()
Bool_t TouchMC ()
Bool_t TouchBeamNueMC ()
Bool_t TouchAtmosRockMC ()
TemplateGetTemplate (Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Shift_t shift)
TemplateMakeTemplate (Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Shift_t shift)
Bool_t TouchTemplate (Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Shift_t shift)
UInt_t GetNumTemplates ()
Int_t GetIndex (UInt_t n)
TemplateGetTemplate (UInt_t n)
TemplateGetTemplateAtIndex (Int_t n)
Bool_t TouchSystematic (Source_t source, Sample_t sample, Systematic_t systematic)
Bool_t TouchSystematics ()
void PrintTemplates ()
void PrintTemplateNumbers ()
void SetDebug (Bool_t yesno=1)
void DeleteContents ()
void Reset ()
TemplateGetData (Run_t run)
TemplateGetMC (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction)
TemplateGetMC (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift)
TemplateGetTemplate (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift)
TemplateMakeTemplate (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift)
Bool_t TouchTemplate (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift)
Bool_t TouchSystematics ()
Bool_t TouchData (Run_t run)
Bool_t TouchMC (Run_t run)
Int_t GetNumTemplates ()
Int_t GetNumPoints ()
Double_t GetGridPoint (Int_t n)
Double_t GetInterpolatedPoint (Double_t dmsq)
Bool_t TouchGrid ()
void PrintGrid ()
void BuildGrid (Double_t dmsq)
void BuildGrid (Int_t n, Double_t min, Double_t max)
void WriteGrid (const char *filename)
void ReadGrid (const char *filename)
void DoSystematics (Bool_t yesno=1)
void SwitchOnSystematics ()
void SwitchOffSystematics ()
Bool_t DoingSystematics ()
void UseData (Run_t run, Bool_t useme=1)
void BuildTemplates ()
void BuildTemplates (Run_t run, Sample_t sample)
void ReadTemplates (const char *filename)
void ReadTemplates (Run_t run, Sample_t sample, const char *filename)
void WriteTemplates (const char *filename)
void WriteTemplates (Run_t run, Sample_t sample, const char *filename)
void PrintTemplates ()
void PrintTemplateNumbers ()
void Reset ()

Static Public Member Functions

static Int_t GetID (Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Shift_t shift)
static void InvertID (Int_t id, Source_t &source, Sample_t &sample, Flavour_t &flavour, Charge_t &charge, Systematic_t &systematic, Shift_t &shift)
static TemplateMapInstance ()

Private Member Functions

TemplateGet (Int_t id)
void Load (Int_t id, Template *temp)
void BuildTemplate (Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Shift_t shift)
TemplateGet (Int_t id)
void Load (Int_t id, Template *temp)
void BuildTemplate (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift)
void ReadTemplate (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift, const char *filename)
void WriteTemplate (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift, const char *filename)
Bool_t UseThisRun (Run_t run)
 TemplateMap ()
virtual ~TemplateMap ()

Private Attributes

std::map< Int_t, Template * > fTemplateMap
std::vector< Template * > fTemplateList
std::vector< Int_t > fIndexList
TemplatefTemplate
Int_t fIndex
Bool_t fDoSystematics
Bool_t fSystematicsAreLoaded
Bool_t fDebug
std::map< Run_t, Bool_t > fTemplateFlags
Bool_t fUseSubsetOfData
Int_t fN_Actual
Int_t fN
Double_t fMin
Double_t fMax
Double_t * fX
Double_t * fXedges

Detailed Description

Definition at line 13 of file TemplateMap.h.


Constructor & Destructor Documentation

TemplateMap::TemplateMap (  ) 

Definition at line 9 of file TemplateMap.cxx.

00010 {
00011   fDebug = 0; 
00012 
00013   fSystematicsAreLoaded = 0;
00014 
00015   fTemplate = 0;
00016 }

TemplateMap::~TemplateMap (  ) 

Definition at line 18 of file TemplateMap.cxx.

References DeleteContents().

00019 {
00020   DeleteContents();
00021 }

OscFit::TemplateMap::TemplateMap (  )  [private]
virtual OscFit::TemplateMap::~TemplateMap (  )  [private, virtual]

Member Function Documentation

void TemplateMap::BuildGrid ( Int_t  n,
Double_t  min,
Double_t  max 
)

Definition at line 59 of file twoflavours/TemplateMap.cxx.

References fMax, fMin, fN, fN_Actual, fX, fXedges, and PrintGrid().

00060 {
00061   std::cout << " *** TemplateMap::BuildGrid(...) *** " << std::endl;
00062   std::cout << "  bins=" << n << " (min=" << min << ", max=" << max << ") " << std::endl;
00063 
00064   if( n<2 ){
00065     return;
00066   }
00067 
00068   fN_Actual = n + 1;
00069 
00070   fN = n;
00071   fMin = min;
00072   fMax = max;
00073 
00074   if( fX ) delete [] fX;
00075   if( fXedges ) delete [] fXedges;
00076 
00077   fX = new Double_t[fN_Actual];
00078   fXedges = new Double_t[fN_Actual+1];
00079 
00080   for( Int_t i=0; i<fN_Actual; i++ ){
00081     fX[i] = fMin + (fMax-fMin)*(double)i/(fN-1.0);
00082   }
00083 
00084   for( Int_t i=0; i<fN_Actual+1; i++ ){
00085     fXedges[i] = fMin + (fMax-fMin)*(double)(i-0.5)/(fN-1.0);
00086   }
00087   
00088   this->PrintGrid();
00089 
00090   return;
00091 }

void TemplateMap::BuildGrid ( Double_t  dmsq  ) 

Definition at line 54 of file twoflavours/TemplateMap.cxx.

Referenced by ReadGrid().

00055 {
00056   this->BuildGrid( 2, 0.0, dmsq );
00057 }

void TemplateMap::BuildTemplate ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift 
) [private]

Definition at line 458 of file twoflavours/TemplateMap.cxx.

References OscFit::Template::BuildHistograms(), fSystematicsAreLoaded, fTemplate, Get(), GetID(), OscFit::kCentre, Load(), and UseThisRun().

00459 {
00460   if( UseThisRun(run)==0 ) return;
00461   
00462   Int_t id = OscFit::GetID(n,run,sample,interaction,systematic,shift);
00463 
00464   if( id>0 ){ 
00465     fTemplate = Get( id );  
00466     
00467     if( fTemplate==0 ){
00468       fTemplate = new Template();
00469       fTemplate->BuildHistograms();
00470 
00471       if( fSystematicsAreLoaded==0
00472        && systematic!=OscFit::kCentre ) fSystematicsAreLoaded = 1;
00473 
00474       Load( id, fTemplate );
00475     }
00476   }
00477 
00478   return;
00479 }

void TemplateMap::BuildTemplate ( Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Shift_t  shift 
) [private]

Definition at line 106 of file TemplateMap.cxx.

References fSystematicsAreLoaded, fTemplate, Get(), GetID(), OscFit::kCentre, and Load().

Referenced by BuildTemplates(), and MakeTemplate().

00107 {  
00108   Int_t id = GetID( source, sample, flavour, charge, systematic, shift );
00109 
00110   if( id>=0 ){ 
00111     fTemplate = Get( id );  
00112     
00113     if( fTemplate==0 ){
00114       fTemplate = new Template();
00115 
00116       if( fSystematicsAreLoaded==0
00117        && systematic!=OscFit::kCentre ) fSystematicsAreLoaded = 1;
00118 
00119       Load( id, fTemplate );
00120     }
00121   }
00122 
00123   return;
00124 }

void TemplateMap::BuildTemplates ( Run_t  run,
Sample_t  sample 
)

Definition at line 292 of file twoflavours/TemplateMap.cxx.

References BuildTemplate(), fDoSystematics, fN_Actual, OscFit::GetNumShifts(), OscFit::GetNumSystematics(), OscFit::GetShift(), OscFit::GetSystematic(), OscFit::kCCnu, OscFit::kCCnubar, OscFit::kCentre, OscFit::kData, OscFit::kNC, OscFit::kNoShift, OscFit::kNull, and n.

00293 { 
00294   // Data
00295   // ====
00296   if( sample==OscFit::kData ) {
00297     BuildTemplate(0,run,sample,OscFit::kNull,OscFit::kCentre,OscFit::kNoShift);
00298   }
00299   
00300   // Monte Carlo
00301   // ===========
00302   else {
00303 
00304     // no oscillations
00305     BuildTemplate(0,run,sample,OscFit::kNC,OscFit::kCentre,OscFit::kNoShift);
00306 
00307     if( fDoSystematics ){
00308       for( Int_t isys=0; isys<OscFit::GetNumSystematics(); isys++ ){
00309         Systematic_t systematic = OscFit::GetSystematic(isys);
00310         for( Int_t ishift=0; ishift<OscFit::GetNumShifts(); ishift++ ){
00311           Shift_t shift = OscFit::GetShift(ishift);
00312           BuildTemplate(0,run,sample,OscFit::kNC,systematic,shift);
00313         }
00314       }
00315     }
00316 
00317     // oscillations
00318     for( Int_t n=0; n<=fN_Actual; n++ ){
00319       BuildTemplate(n,run,sample,OscFit::kCCnu,OscFit::kCentre,OscFit::kNoShift);
00320       BuildTemplate(n,run,sample,OscFit::kCCnubar,OscFit::kCentre,OscFit::kNoShift);
00321 
00322       if( fDoSystematics ){
00323         for( Int_t isys=0; isys<OscFit::GetNumSystematics(); isys++ ){
00324           Systematic_t systematic = OscFit::GetSystematic(isys);
00325           for( Int_t ishift=0; ishift<OscFit::GetNumShifts(); ishift++ ){
00326             Shift_t shift = OscFit::GetShift(ishift);
00327             BuildTemplate(n,run,sample,OscFit::kCCnu,   systematic,shift);
00328             BuildTemplate(n,run,sample,OscFit::kCCnubar,systematic,shift);
00329           }
00330         }
00331       }
00332     }
00333   }
00334 
00335   return;
00336 }

void TemplateMap::BuildTemplates (  ) 

Definition at line 281 of file twoflavours/TemplateMap.cxx.

References OscFit::GetNumRuns(), OscFit::GetNumSamples(), OscFit::GetRun(), OscFit::GetSample(), and run().

00282 {
00283   for( Int_t irun=0; irun<OscFit::GetNumRuns(); irun++ ){
00284     Run_t run = OscFit::GetRun(irun);
00285     for( Int_t isample=0; isample<OscFit::GetNumSamples(); isample++ ){
00286       Sample_t sample = OscFit::GetSample(isample);
00287       BuildTemplates(run,sample);
00288     }
00289   }
00290 }

void TemplateMap::DeleteContents (  ) 

Definition at line 28 of file TemplateMap.cxx.

References fIndexList, fTemplateList, and fTemplateMap.

Referenced by Reset(), and ~TemplateMap().

00029 {
00030   std::map<Int_t,Template*>::iterator myIter = fTemplateMap.begin();
00031 
00032   for( ; myIter!=fTemplateMap.end(); myIter++ ){
00033     Template* temp = myIter->second;
00034     if( temp ) delete temp;
00035   }
00036 
00037   fTemplateMap.clear();
00038 
00039   fTemplateList.clear();
00040   fIndexList.clear();
00041 
00042   return;
00043 }

Bool_t OscFit::TemplateMap::DoingSystematics (  )  [inline]

Definition at line 56 of file twoflavours/TemplateMap.h.

References fDoSystematics.

00056 { return fDoSystematics; }

void TemplateMap::DoSystematics ( Bool_t  yesno = 1  ) 

Definition at line 206 of file twoflavours/TemplateMap.cxx.

References fDoSystematics.

Referenced by SwitchOffSystematics(), and SwitchOnSystematics().

00207 {
00208   std::cout << " --- TemplateMap: Switching Systematics [";
00209     if( yesno==0 ) std::cout << "OFF"; else std::cout << "ON";
00210   std::cout << "] --- " << std::endl;
00211 
00212   fDoSystematics = yesno;
00213 }

Template* OscFit::TemplateMap::Get ( Int_t  id  )  [private]
Template * TemplateMap::Get ( Int_t  id  )  [private]

Definition at line 141 of file TemplateMap.cxx.

References fTemplateMap.

Referenced by BuildTemplate(), GetTemplate(), GetTemplateAtIndex(), ReadTemplate(), and WriteTemplate().

00142 {
00143   Template* temp = 0;
00144 
00145   std::map<Int_t,Template*>::iterator myEntry = fTemplateMap.find(id);
00146 
00147   if( myEntry != fTemplateMap.end() ){
00148     temp = myEntry->second;
00149   }
00150 
00151   return temp;
00152 } 

Template * TemplateMap::GetData ( Run_t  run  ) 
Double_t TemplateMap::GetGridPoint ( Int_t  n  ) 

Definition at line 113 of file twoflavours/TemplateMap.cxx.

References fN, fN_Actual, and fX.

00114 {
00115   if( fN<=0 ) return 0.0;
00116 
00117   if( n>=1 && n<=fN_Actual ){ // Numbered
00118     return fX[n-1];           // from one 
00119   }
00120   else{
00121     return 0.0;
00122   }
00123 }

Int_t TemplateMap::GetID ( Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Shift_t  shift 
) [static]

Definition at line 346 of file TemplateMap.cxx.

References OscFit::GetNumCharges(), OscFit::GetNumFlavours(), OscFit::GetNumSamples(), OscFit::GetNumShifts(), OscFit::GetNumSources(), OscFit::GetNumSystematics(), OscFit::kCentre, OscFit::kCosmic, OscFit::kCV, OscFit::kData, OscFit::kNoCharge, OscFit::kNoFlavour, OscFit::kNoShift, OscFit::kNu, OscFit::kNuBar, OscFit::kNutau, and OscFit::kRock.

Referenced by BuildTemplate(), GetTemplate(), ReadTemplate(), and WriteTemplate().

00347 {
00348   Int_t id = -1;
00349 
00350   if( sample==kData || sample==kCosmic ){
00351     if( !(flavour==kNoFlavour && charge==kNoCharge 
00352        && systematic==kCentre && shift==kNoShift) ){
00353       return -1; 
00354     }   
00355   }
00356 
00357   if( sample==kCV || sample==kRock ){
00358     if( !(charge==kNu || charge==kNuBar) ){
00359       return -1;
00360     }
00361   }
00362  
00363   if( systematic==kCentre && shift!=kNoShift ) return -1;
00364   if( systematic!=kCentre && shift==kNoShift ) return -1;
00365 
00366   if( flavour==kNutau && systematic!=kCentre ) return -1;
00367 
00368   // 
00369   // if( flavour!=kNumu  && sample==kRock )       return -1;
00370   //
00371 
00372   Int_t isource     = static_cast<Int_t>(source);
00373   Int_t isample     = static_cast<Int_t>(sample);
00374   Int_t iflavour    = static_cast<Int_t>(flavour);
00375   Int_t icharge     = static_cast<Int_t>(charge);
00376   Int_t isystematic = static_cast<Int_t>(systematic);
00377   Int_t ishift      = static_cast<Int_t>(shift);
00378 
00379   if( isource>=0     && isource<GetNumSources() 
00380    && isample>=0     && isample<GetNumSamples()
00381    && iflavour>=0    && iflavour<GetNumFlavours()
00382    && icharge>=0     && icharge<GetNumCharges()
00383    && isystematic>=0 && isystematic<GetNumSystematics()
00384    && ishift>=0      && ishift<GetNumShifts() ){
00385 
00386     id = (1+isource)      * 100000
00387        + (1+isample)      * 10000
00388        + (1+iflavour)     * 1000
00389        + (1+icharge)      * 100
00390        + (1+isystematic)  * 10 
00391        + (1+ishift);
00392   }
00393     
00394   return id;
00395 }  

Int_t TemplateMap::GetIndex ( UInt_t  n  ) 

Definition at line 159 of file TemplateMap.cxx.

References fIndexList.

Referenced by OscFit::TemplateIO::WriteData(), and OscFit::TemplateIO::WriteMC().

00160 {
00161   if( n<fIndexList.size() ){
00162     return fIndexList.at(n);
00163   }
00164   else{
00165     return -1;
00166   }
00167 }

Double_t TemplateMap::GetInterpolatedPoint ( Double_t  dmsq  ) 

Definition at line 125 of file twoflavours/TemplateMap.cxx.

References fMax, fMin, and fN.

00126 { 
00127   if( fN<=0 ) return 0.0;
00128   if( dmsq==0 ) return 0.0;
00129 
00130   return 1.0 + (double)(fN-1.0)*(dmsq-fMin)/(fMax-fMin);
00131 }

Template * TemplateMap::GetMC ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 225 of file twoflavours/TemplateMap.cxx.

References GetTemplate().

00226 {
00227   return GetTemplate(n,run,sample,interaction,systematic,shift);
00228 }

Template * TemplateMap::GetMC ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction 
)

Definition at line 220 of file twoflavours/TemplateMap.cxx.

References GetTemplate(), OscFit::kCentre, and OscFit::kNoShift.

00221 {
00222   return GetTemplate(n,run,sample,interaction,kCentre,kNoShift);
00223 }

Int_t TemplateMap::GetNumPoints (  ) 

Definition at line 108 of file twoflavours/TemplateMap.cxx.

References fN.

00109 {
00110   return fN;
00111 }

Int_t OscFit::TemplateMap::GetNumTemplates (  ) 
Int_t TemplateMap::GetNumTemplates (  ) 

Definition at line 154 of file TemplateMap.cxx.

References fIndexList.

Referenced by OscFit::TemplateIO::WriteData(), and OscFit::TemplateIO::WriteMC().

00155 {
00156   return fIndexList.size();
00157 }

Template * TemplateMap::GetTemplate ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 230 of file twoflavours/TemplateMap.cxx.

References Get(), GetID(), OscFit::kCentre, OscFit::kData, OscFit::kNC, OscFit::kNoShift, and OscFit::kNull.

00231 {
00232   Template* temp = 0;
00233 
00234   Int_t nOsc = n;
00235   Systematic_t nSyst = systematic;
00236   Interaction_t nInt = interaction;
00237 
00238   if( sample==OscFit::kData ) nInt = OscFit::kNull;
00239   if( interaction==OscFit::kNC && nOsc>0 ) nOsc = 0;
00240   if( shift==OscFit::kNoShift ) nSyst = OscFit::kCentre;
00241 
00242   Int_t id = OscFit::GetID(nOsc,run,sample,nInt,nSyst,shift);
00243 
00244   if( id>0 ) temp = Get( id );
00245 
00246   return temp;
00247 }

Template * TemplateMap::GetTemplate ( UInt_t  n  ) 

Definition at line 169 of file TemplateMap.cxx.

References fTemplateList.

00170 {
00171   if( n<fTemplateList.size() ){
00172     return fTemplateList.at(n);
00173   }
00174   else{
00175     return 0;
00176   }
00177 }

Template * TemplateMap::GetTemplate ( Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 45 of file TemplateMap.cxx.

References Get(), and GetID().

Referenced by OscFit::TemplateCalculator::GetData(), GetData(), OscFit::TemplateCalculator::GetDeltaExpectation(), OscFit::TemplateCalculator::GetExpectation(), GetMC(), MakeTemplate(), PrintTemplates(), and TouchTemplate().

00046 {
00047   Template* temp = 0;
00048 
00049   Int_t id = GetID( source, sample, flavour, charge, systematic, shift );
00050 
00051   if( id>=0 ) temp = Get( id );
00052     
00053   return temp;
00054 }

Template * TemplateMap::GetTemplateAtIndex ( Int_t  n  ) 

Definition at line 179 of file TemplateMap.cxx.

References Get().

Referenced by OscFit::TemplateIO::WriteData(), and OscFit::TemplateIO::WriteMC().

00180 {
00181   return Get(n);
00182 }

TemplateMap * TemplateMap::Instance (  )  [static]
void TemplateMap::InvertID ( Int_t  id,
Source_t source,
Sample_t sample,
Flavour_t flavour,
Charge_t charge,
Systematic_t systematic,
Shift_t shift 
) [static]

Definition at line 397 of file TemplateMap.cxx.

References OscFit::GetNumCharges(), OscFit::GetNumFlavours(), OscFit::GetNumSamples(), OscFit::GetNumShifts(), OscFit::GetNumSources(), OscFit::GetNumSystematics(), OscFit::kNoShift, OscFit::kUnknown, OscFit::kUnknownCharge, OscFit::kUnknownData, OscFit::kUnknownFlavour, OscFit::kUnknownSystematic, and total().

Referenced by PrintTemplateNumbers(), OscFit::TemplateIO::WriteData(), and OscFit::TemplateIO::WriteMC().

00398 {
00399   source     = kUnknownData;
00400   sample     = kUnknown;
00401   flavour    = kUnknownFlavour;
00402   charge     = kUnknownCharge;
00403   systematic = kUnknownSystematic;
00404   shift      = kNoShift;
00405 
00406   if( id<0 ) return;
00407 
00408   Double_t total = id;
00409 
00410   Int_t isource = (Int_t)(total/100000.0) - 1;
00411   total -= (1+isource)*100000.0;
00412 
00413   Int_t isample = (Int_t)(total/10000.0) - 1;
00414   total -= (1+isample)*10000.0;
00415 
00416   Int_t iflavour = (Int_t)(total/1000.0) - 1;
00417   total -= (1+iflavour)*1000.0;
00418 
00419   Int_t icharge = (Int_t)(total/100.0) - 1;
00420   total -= (1+icharge)*100.0;
00421 
00422   Int_t isystematic = (Int_t)(total/10.0) - 1;
00423   total -= (1+isystematic)*10.0;
00424 
00425   Int_t ishift = (Int_t)(total) - 1;
00426 
00427   if( isource>=0     && isource<GetNumSources() 
00428    && isample>=0     && isample<GetNumSamples()
00429    && iflavour>=0    && iflavour<GetNumFlavours()
00430    && icharge>=0     && icharge<GetNumCharges()
00431    && isystematic>=0 && isystematic<GetNumSystematics()
00432    && ishift>=0      && ishift<GetNumShifts() ){
00433     source     = static_cast<Source_t>(isource);
00434     sample     = static_cast<Sample_t>(isample);
00435     flavour    = static_cast<Flavour_t>(iflavour);
00436     charge     = static_cast<Charge_t>(icharge);
00437     systematic = static_cast<Systematic_t>(isystematic);
00438     shift      = static_cast<Shift_t>(ishift);
00439   }
00440 
00441   return;
00442 }

void OscFit::TemplateMap::Load ( Int_t  id,
Template temp 
) [private]
void TemplateMap::Load ( Int_t  id,
Template temp 
) [private]

Definition at line 126 of file TemplateMap.cxx.

References fIndex, fIndexList, fTemplate, fTemplateList, and fTemplateMap.

Referenced by BuildTemplate(), and ReadTemplate().

00127 {
00128   if( temp==0 ) return;
00129 
00130   std::map<Int_t,Template*>::iterator myEntry = fTemplateMap.find(id);
00131   
00132   if( myEntry==fTemplateMap.end() ){
00133     fTemplateMap.insert( std::pair<Int_t,Template*>(id,temp) );
00134     fTemplate = temp; fTemplateList.push_back(fTemplate);
00135     fIndex = id; fIndexList.push_back(fIndex);
00136   }
00137 
00138   return;
00139 }

Template * TemplateMap::MakeTemplate ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 249 of file twoflavours/TemplateMap.cxx.

References BuildTemplate(), GetTemplate(), and TouchTemplate().

00250 {
00251   if( TouchTemplate(n,run,sample,interaction,systematic,shift)==0 ){
00252     BuildTemplate(n,run,sample,interaction,systematic,shift);
00253   }
00254 
00255   return GetTemplate(n,run,sample,interaction,systematic,shift);
00256 }

Template * TemplateMap::MakeTemplate ( Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 56 of file TemplateMap.cxx.

References BuildTemplate(), GetTemplate(), and TouchTemplate().

Referenced by OscFit::Interface::Fill().

00057 {
00058   if( TouchTemplate( source, sample, flavour, charge, systematic, shift )==0 ){
00059     BuildTemplate( source, sample, flavour, charge, systematic, shift );
00060   }
00061 
00062   return GetTemplate( source, sample, flavour, charge, systematic, shift );
00063 }

void TemplateMap::PrintGrid (  ) 

Definition at line 93 of file twoflavours/TemplateMap.cxx.

References fN, fN_Actual, fX, and fXedges.

Referenced by BuildGrid().

00094 {
00095   std::cout << " *** TemplateMap::PrintGrid() *** " << std::endl;
00096 
00097   if( fN<=0 ){
00098     std::cout << "  No Grid... " << std::endl;
00099     return;
00100   }
00101 
00102   for( Int_t i=0; i<fN_Actual; i++ ){
00103     if( i<fN ) std::cout << " [" << i+1 << "] "; else std::cout << " (" << i+1 << ") ";
00104     std::cout << fX[i] << " (" << fXedges[i] << "->" << fXedges[i+1] << ") " << std::endl;
00105   }
00106 }

void OscFit::TemplateMap::PrintTemplateNumbers (  ) 
void TemplateMap::PrintTemplateNumbers (  ) 

Definition at line 316 of file TemplateMap.cxx.

References OscFit::AsString(), fTemplateMap, InvertID(), OscFit::kNoShift, OscFit::kUnknown, OscFit::kUnknownCharge, OscFit::kUnknownData, OscFit::kUnknownFlavour, and OscFit::kUnknownSystematic.

00317 {
00318   std::cout << " *** TemplateMap::PrintTemplateNumbers() *** " << std::endl;
00319 
00320   std::map<Int_t,Template*>::iterator myIter = fTemplateMap.begin();
00321 
00322   Int_t ctr = 0;
00323 
00324   for( ; myIter!=fTemplateMap.end(); myIter++ ){
00325     Int_t id = myIter->first;
00326 
00327     Source_t     source     = kUnknownData;
00328     Sample_t     sample     = kUnknown;
00329     Flavour_t    flavour    = kUnknownFlavour;
00330     Charge_t     charge     = kUnknownCharge;
00331     Systematic_t systematic = kUnknownSystematic;
00332     Shift_t      shift      = kNoShift;
00333 
00334     InvertID( id, source, sample, flavour, charge, systematic, shift );
00335 
00336     std::cout << " [" << ctr << "]\t" 
00337               << "[" << OscFit::AsString(source) << "][" << OscFit::AsString(sample) << "]"
00338               << "[" << OscFit::AsString(flavour) << "][" << OscFit::AsString(charge) << "]"
00339               << "[" << OscFit::AsString(systematic) << "][" << OscFit::AsString(shift) << "]" << std::endl;
00340     ctr++;
00341   }
00342   
00343   return;
00344 }

void OscFit::TemplateMap::PrintTemplates (  ) 
void TemplateMap::PrintTemplates (  ) 

Definition at line 240 of file TemplateMap.cxx.

References OscFit::AsString(), fSystematicsAreLoaded, OscFit::GetCharge(), OscFit::GetFlavour(), OscFit::GetNumCharges(), OscFit::GetNumFlavours(), OscFit::GetNumSamples(), OscFit::GetNumSources(), OscFit::GetNumSystematics(), OscFit::GetSample(), OscFit::GetSource(), OscFit::GetSystematic(), GetTemplate(), OscFit::Template::GetTotalContent(), OscFit::kCentre, OscFit::kData, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNoCharge, OscFit::kNoFlavour, OscFit::kNoShift, OscFit::kPlus1, OscFit::kPlus2, TouchData(), and TouchMC().

Referenced by OscFit::TemplateGrid::PrintTemplates(), and OscFit::TemplateGrid::TouchMC().

00241 {
00242   std::cout << " *** TemplateMap::PrintTemplates() *** " << std::endl;
00243 
00244   std::cout << " --- Systematics --- " << std::endl;
00245   std::cout << "  Systematic templates have";
00246   if( fSystematicsAreLoaded==0 ) std::cout << " not";
00247   std::cout << " been loaded" << std::endl;
00248 
00249   std::cout << " --- Data/MC --- " << std::endl;
00250 
00251   if( this->TouchData()==0 ){
00252     std::cout << "  Data \t Not Loaded..." << std::endl;
00253   }
00254 
00255   if( this->TouchMC()==0 ){
00256     std::cout << "  MC \t Not Loaded..." << std::endl;
00257   }
00258 
00259   for( Int_t isource=0; isource<OscFit::GetNumSources(); isource++ ){
00260     OscFit::Source_t source = OscFit::GetSource(isource);
00261 
00262     Template* temp1 = this->GetTemplate(source,kData,kNoFlavour,kNoCharge,kCentre,kNoShift);
00263     if( temp1 ){
00264       std::cout << "  Data \t"
00265                 << "[" << OscFit::AsString(source) << "][" << OscFit::AsString(kData) << "]"
00266                 << " Total=" << temp1->GetTotalContent() << std::endl;
00267     }
00268     
00269     for( Int_t isample=1; isample<OscFit::GetNumSamples(); isample++ ){  // skip data
00270       OscFit::Sample_t sample = OscFit::GetSample(isample);
00271 
00272       for( Int_t iflavour=0; iflavour<OscFit::GetNumFlavours(); iflavour++ ){
00273         OscFit::Flavour_t flavour = OscFit::GetFlavour(iflavour);
00274         
00275         for( Int_t icharge=0; icharge<OscFit::GetNumCharges(); icharge++ ){
00276           OscFit::Charge_t charge = OscFit::GetCharge(icharge);
00277 
00278           Template* temp2 = this->GetTemplate(source,sample,flavour,charge,kCentre,kNoShift);
00279           if( temp2 ){
00280             std::cout << "  MC \t"
00281                       << "[" << OscFit::AsString(source) << "][" << OscFit::AsString(sample) << "]"
00282                       << "[" << OscFit::AsString(flavour) << "][" << OscFit::AsString(charge) << "]"
00283                       << " Total=" << temp2->GetTotalContent() << std::endl;
00284 
00285             // Un-comment for detailed print-out
00286             // temp2->PrintHistograms(); // --- debug
00287           }
00288 
00289           for( Int_t isys=1; isys<OscFit::GetNumSystematics(); isys++ ){
00290             Systematic_t systematic = OscFit::GetSystematic(isys);
00291 
00292             Template* temp_m2 = this->GetTemplate(source,sample,flavour,charge,systematic,kMinus2);
00293             Template* temp_m1 = this->GetTemplate(source,sample,flavour,charge,systematic,kMinus1);
00294             Template* temp_p1 = this->GetTemplate(source,sample,flavour,charge,systematic,kPlus1);
00295             Template* temp_p2 = this->GetTemplate(source,sample,flavour,charge,systematic,kPlus2);
00296 
00297             if( temp_m2 && temp_m1 && temp_p1 && temp_p2 ){
00298               std::cout << "  MC \t"
00299                         << "[" << OscFit::AsString(source) << "][" << OscFit::AsString(sample) << "]"
00300                         << "[" << OscFit::AsString(flavour) << "][" << OscFit::AsString(charge) << "]"
00301                         << "[" << OscFit::AsString(systematic) << "]" << std::endl;
00302 
00303               // Don't report these totals as not all bins are filled
00304               // std::cout << " Totals=(" << temp_m2->GetTotalContent() << "|" << temp_m1->GetTotalContent()
00305               //                   << "|" << temp_p1->GetTotalContent() << "|" << temp_p2->GetTotalContent() << ")" << std::endl;
00306 
00307             }
00308           }
00309         }
00310       }
00311     }
00312   }
00313 
00314 }

void TemplateMap::ReadGrid ( const char *  filename  ) 

Definition at line 138 of file twoflavours/TemplateMap.cxx.

References BuildGrid(), max, min, and n.

00139 {
00140   std::cout << " *** TemplateMap::ReadGrid() *** " << std::endl
00141             << "  filename = " << filename << std::endl;
00142 
00143   TDirectory* tmpd = gDirectory;
00144   TFile* file = new TFile(filename,"READ");
00145   TH1D* hGrid = (TH1D*)(file->Get("hgrid"));
00146 
00147   if( hGrid ){
00148     Int_t n = hGrid->GetNbinsX();
00149     Double_t min = hGrid->GetBinCenter(1);
00150     Double_t max = hGrid->GetBinCenter(n);
00151 
00152     this->BuildGrid( n, min, max );
00153   }
00154 
00155   file->Close();
00156   tmpd->cd();
00157 
00158   return;
00159 }

void TemplateMap::ReadTemplate ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift,
const char *  filename 
) [private]

Definition at line 481 of file twoflavours/TemplateMap.cxx.

References OscFit::AsString(), fSystematicsAreLoaded, fTemplate, Get(), GetID(), gSystem(), OscFit::kCentre, Load(), OscFit::Template::ReadHistograms(), and UseThisRun().

Referenced by ReadTemplates().

00482 {
00483   if( UseThisRun(run)==0 ) return;
00484   
00485   Int_t id = OscFit::GetID(n,run,sample,interaction,systematic,shift);
00486 
00487   if( id>0 ){ 
00488     fTemplate = Get( id );  
00489     
00490     if( fTemplate==0 ){
00491       
00492       TString Infile = filename;
00493       TString Tag = ".";
00494       if( id<1000000000 ) Tag.Append("0"); Tag+=id;
00495     
00496       if( Infile.EndsWith(".root") ){
00497         Infile.Insert(Infile.Length()-5,Tag);
00498       }
00499       else{
00500         Infile.Append(Tag);
00501       }
00502 
00503       if( gSystem->AccessPathName( Infile.Data() ) ) return; // returns kTrue if non-existent
00504 
00505       std::cout << "  Reading Template: \t[" << n << "]\t[" << OscFit::AsString(run) << "][" << OscFit::AsString(sample) << "][" << OscFit::AsString(interaction) << "][" << OscFit::AsString(systematic) << "][" << OscFit::AsString(shift) << "]" << std::endl;
00506 
00507       fTemplate = new Template();
00508       fTemplate->ReadHistograms( Infile.Data() );
00509 
00510       if( fSystematicsAreLoaded==0
00511        && systematic!=OscFit::kCentre ) fSystematicsAreLoaded = 1;
00512 
00513       Load( id, fTemplate );
00514     }
00515   }
00516 
00517   return;
00518 }

void TemplateMap::ReadTemplates ( Run_t  run,
Sample_t  sample,
const char *  filename 
)

Definition at line 352 of file twoflavours/TemplateMap.cxx.

References fDoSystematics, fN_Actual, OscFit::GetNumShifts(), OscFit::GetNumSystematics(), OscFit::GetShift(), OscFit::GetSystematic(), OscFit::kCCnu, OscFit::kCCnubar, OscFit::kCentre, OscFit::kData, OscFit::kNC, OscFit::kNoShift, OscFit::kNull, n, and ReadTemplate().

00353 {
00354   // Data
00355   // ====
00356   if( sample==OscFit::kData ) {
00357     ReadTemplate(0,run,sample,OscFit::kNull,OscFit::kCentre,OscFit::kNoShift,filename);
00358   }
00359   
00360   // Monte Carlo
00361   // ===========
00362   else {
00363 
00364     // no oscillations
00365     ReadTemplate(0,run,sample,OscFit::kNC,OscFit::kCentre,OscFit::kNoShift,filename);
00366 
00367     if( fDoSystematics ){
00368       for( Int_t isys=0; isys<OscFit::GetNumSystematics(); isys++ ){
00369         Systematic_t systematic = OscFit::GetSystematic(isys);
00370         for( Int_t ishift=0; ishift<OscFit::GetNumShifts(); ishift++ ){
00371           Shift_t shift = OscFit::GetShift(ishift);
00372           ReadTemplate(0,run,sample,OscFit::kNC,systematic,shift,filename);
00373         }
00374       }
00375     }
00376 
00377     // oscillations
00378     for( Int_t n=0; n<=fN_Actual; n++ ){
00379       ReadTemplate(n,run,sample,OscFit::kCCnu,   OscFit::kCentre,OscFit::kNoShift,filename);
00380       ReadTemplate(n,run,sample,OscFit::kCCnubar,OscFit::kCentre,OscFit::kNoShift,filename);
00381 
00382       if( fDoSystematics ){
00383         for( Int_t isys=0; isys<OscFit::GetNumSystematics(); isys++ ){
00384           Systematic_t systematic = OscFit::GetSystematic(isys);
00385           for( Int_t ishift=0; ishift<OscFit::GetNumShifts(); ishift++ ){
00386             Shift_t shift = OscFit::GetShift(ishift);
00387             ReadTemplate(n,run,sample,OscFit::kCCnu,   systematic,shift,filename);
00388             ReadTemplate(n,run,sample,OscFit::kCCnubar,systematic,shift,filename);
00389           }
00390         }
00391       }
00392     }
00393   }
00394 
00395   return;
00396 }

void TemplateMap::ReadTemplates ( const char *  filename  ) 

Definition at line 338 of file twoflavours/TemplateMap.cxx.

References OscFit::GetNumRuns(), OscFit::GetNumSamples(), OscFit::GetRun(), OscFit::GetSample(), and run().

00339 {
00340   std::cout << " *** TemplateMap::ReadTemplates(...) *** " << std::endl;
00341   std::cout << "  FileName: " << filename << std::endl;
00342 
00343   for( Int_t irun=0; irun<OscFit::GetNumRuns(); irun++ ){
00344     Run_t run = OscFit::GetRun(irun);
00345     for( Int_t isample=0; isample<OscFit::GetNumSamples(); isample++ ){
00346       Sample_t sample = OscFit::GetSample(isample);
00347       ReadTemplates(run,sample,filename);
00348     }
00349   }
00350 }

void OscFit::TemplateMap::Reset (  ) 
void TemplateMap::Reset (  ) 

Definition at line 23 of file TemplateMap.cxx.

References DeleteContents().

00024 {
00025   DeleteContents();
00026 }

void OscFit::TemplateMap::SetDebug ( Bool_t  yesno = 1  )  [inline]

Definition at line 53 of file TemplateMap.h.

References fDebug.

00053 { fDebug = yesno; }

void OscFit::TemplateMap::SwitchOffSystematics (  )  [inline]

Definition at line 55 of file twoflavours/TemplateMap.h.

References DoSystematics().

00055 { DoSystematics(0); }

void OscFit::TemplateMap::SwitchOnSystematics (  )  [inline]

Definition at line 54 of file twoflavours/TemplateMap.h.

References DoSystematics().

00054 { DoSystematics(1); }

Bool_t TemplateMap::TouchAtmosData (  ) 
Bool_t TemplateMap::TouchAtmosRockMC (  ) 
Bool_t TemplateMap::TouchBeamData (  ) 
Bool_t TemplateMap::TouchBeamNueMC (  ) 
Bool_t TemplateMap::TouchData ( Run_t  run  ) 
Bool_t TemplateMap::TouchData (  ) 
Bool_t TemplateMap::TouchGrid (  ) 

Definition at line 133 of file twoflavours/TemplateMap.cxx.

References fN.

00134 {
00135   if( fN>0 ) return 1; else return 0;
00136 }

Bool_t TemplateMap::TouchMC ( Run_t  run  ) 
Bool_t TemplateMap::TouchMC (  ) 

Definition at line 212 of file TemplateMap.cxx.

References OscFit::kAtmosData, OscFit::kBeamData, OscFit::kCentre, OscFit::kCV, OscFit::kNoShift, OscFit::kNu, OscFit::kNuBar, OscFit::kNue, OscFit::kNumu, OscFit::kRock, and TouchTemplate().

Referenced by PrintTemplates(), OscFit::TemplateGrid::TouchMC(), and OscFit::TemplateIO::WriteMC().

Bool_t TemplateMap::TouchSystematic ( Source_t  source,
Sample_t  sample,
Systematic_t  systematic 
)

Definition at line 70 of file TemplateMap.cxx.

References OscFit::kMinus1, OscFit::kMinus2, OscFit::kNu, OscFit::kNuBar, OscFit::kNue, OscFit::kNumu, OscFit::kPlus1, OscFit::kPlus2, TouchSystematics(), and TouchTemplate().

Referenced by OscFit::TemplateGrid::TouchSystematic().

00071 {
00072   // check that systematics are loaded
00073   if( TouchSystematics()==false ) return false;
00074 
00075   // check muon neutrinos
00076   if( TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNu, systematic, OscFit::kMinus2 )
00077    && TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNu, systematic, OscFit::kMinus1 )
00078    && TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNu, systematic, OscFit::kPlus1  )
00079    && TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNu, systematic, OscFit::kPlus2  ) )
00080     return true;
00081 
00082   // check muon anti-neutrinos
00083   if( TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNuBar, systematic, OscFit::kMinus2 )
00084    && TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNuBar, systematic, OscFit::kMinus1 )
00085    && TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNuBar, systematic, OscFit::kPlus1  )
00086    && TouchTemplate( source, sample, OscFit::kNumu, OscFit::kNuBar, systematic, OscFit::kPlus2  ) )
00087     return true;
00088 
00089   // check electron neutrinos
00090   if( TouchTemplate( source, sample, OscFit::kNue, OscFit::kNu, systematic, OscFit::kMinus2 )
00091    && TouchTemplate( source, sample, OscFit::kNue, OscFit::kNu, systematic, OscFit::kMinus1 )
00092    && TouchTemplate( source, sample, OscFit::kNue, OscFit::kNu, systematic, OscFit::kPlus1  )
00093    && TouchTemplate( source, sample, OscFit::kNue, OscFit::kNu, systematic, OscFit::kPlus2  ) )
00094     return true;
00095 
00096   // check electron anti-neutrinos
00097   if( TouchTemplate( source, sample, OscFit::kNue, OscFit::kNuBar, systematic, OscFit::kMinus2 )
00098    && TouchTemplate( source, sample, OscFit::kNue, OscFit::kNuBar, systematic, OscFit::kMinus1 )
00099    && TouchTemplate( source, sample, OscFit::kNue, OscFit::kNuBar, systematic, OscFit::kPlus1  )
00100    && TouchTemplate( source, sample, OscFit::kNue, OscFit::kNuBar, systematic, OscFit::kPlus2  ) )
00101     return true;
00102 
00103   return false;
00104 }

Bool_t OscFit::TemplateMap::TouchSystematics (  ) 
Bool_t TemplateMap::TouchSystematics (  )  [inline]
Bool_t TemplateMap::TouchTemplate ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 258 of file twoflavours/TemplateMap.cxx.

References GetTemplate().

00259 {
00260   if( GetTemplate(n,run,sample,interaction,systematic,shift) ) return 1; else return 0;
00261 }

Bool_t TemplateMap::TouchTemplate ( Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Shift_t  shift 
)

Definition at line 65 of file TemplateMap.cxx.

References GetTemplate().

Referenced by MakeTemplate(), TouchAtmosData(), TouchAtmosRockMC(), TouchBeamData(), TouchBeamNueMC(), TouchData(), TouchMC(), and TouchSystematic().

00066 {
00067   if( GetTemplate( source, sample, flavour, charge, systematic, shift ) ) return 1; else return 0;
00068 }

void TemplateMap::UseData ( Run_t  run,
Bool_t  useme = 1 
)

Definition at line 180 of file twoflavours/TemplateMap.cxx.

References fTemplateFlags, and fUseSubsetOfData.

00181 {
00182   fUseSubsetOfData = 1;
00183 
00184   std::map<Run_t,Bool_t>::iterator myEntry = fTemplateFlags.find(run);
00185   
00186   if( myEntry==fTemplateFlags.end() ){
00187     fTemplateFlags.insert( std::pair<Run_t,Bool_t>(run,useme) );
00188   }
00189 
00190   return;
00191 }

Bool_t TemplateMap::UseThisRun ( Run_t  run  )  [private]

Definition at line 193 of file twoflavours/TemplateMap.cxx.

References fTemplateFlags, and fUseSubsetOfData.

Referenced by BuildTemplate(), ReadTemplate(), and WriteTemplate().

00194 {
00195   if( fUseSubsetOfData==0 ) return true;
00196 
00197   std::map<Run_t,Bool_t>::iterator myEntry = fTemplateFlags.find(run);
00198 
00199   if( myEntry != fTemplateFlags.end() ){
00200     return myEntry->second;
00201   }
00202   
00203   return false;
00204 }

void TemplateMap::WriteGrid ( const char *  filename  ) 

Definition at line 161 of file twoflavours/TemplateMap.cxx.

References fN, and fXedges.

00162 {
00163   if( fN<=0 ) return;
00164 
00165   std::cout << " *** TemplateMap::WriteGrid() *** " << std::endl
00166             << "  filename = " << filename << std::endl;
00167 
00168   TH1D* hGrid = new TH1D("hgrid","",fN,fXedges);
00169 
00170   TDirectory* tmpd = gDirectory;
00171   TFile* file = new TFile(filename,"RECREATE");
00172   hGrid->SetDirectory(file);
00173   hGrid->Write();
00174   file->Close();
00175   tmpd->cd();
00176 
00177   return;
00178 }

void TemplateMap::WriteTemplate ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift,
const char *  filename 
) [private]

Definition at line 520 of file twoflavours/TemplateMap.cxx.

References OscFit::AsString(), fTemplate, Get(), GetID(), UseThisRun(), and OscFit::Template::WriteHistograms().

Referenced by WriteTemplates().

00521 {
00522   if( UseThisRun(run)==0 ) return;
00523 
00524   Int_t id = OscFit::GetID(n,run,sample,interaction,systematic,shift);
00525 
00526   if( id>0 ){ 
00527     fTemplate = Get( id );
00528 
00529     if( fTemplate ){
00530       
00531       TString Outfile = filename;
00532       TString Tag = ".";
00533       if( id<1000000000 ) Tag.Append("0"); Tag+=id;
00534 
00535       if( Outfile.EndsWith(".root") ){
00536         Outfile.Insert(Outfile.Length()-5,Tag);
00537       }
00538       else{
00539         Outfile.Append(Tag);
00540       }
00541 
00542       std::cout << "  Writing Template: \t[" << n << "]\t[" << OscFit::AsString(run) << "][" << OscFit::AsString(sample) << "][" << OscFit::AsString(interaction) << "][" << OscFit::AsString(systematic) << "][" << OscFit::AsString(shift) << "]" << std::endl;
00543 
00544       fTemplate->WriteHistograms( Outfile.Data() );
00545     }
00546   }
00547 
00548   return;
00549 }

void TemplateMap::WriteTemplates ( Run_t  run,
Sample_t  sample,
const char *  filename 
)

Definition at line 412 of file twoflavours/TemplateMap.cxx.

References fDoSystematics, fN_Actual, OscFit::GetNumShifts(), OscFit::GetNumSystematics(), OscFit::GetShift(), OscFit::GetSystematic(), OscFit::kCCnu, OscFit::kCCnubar, OscFit::kCentre, OscFit::kData, OscFit::kNC, OscFit::kNoShift, OscFit::kNull, n, and WriteTemplate().

00413 {
00414   // Data
00415   // ====
00416   if( sample==OscFit::kData ) {
00417     WriteTemplate(0,run,sample,OscFit::kNull,OscFit::kCentre,OscFit::kNoShift,filename);
00418   }
00419   
00420   // Monte Carlo
00421   // ===========
00422   else {
00423 
00424     // no oscillations
00425     WriteTemplate(0,run,sample,OscFit::kNC,OscFit::kCentre,OscFit::kNoShift,filename);
00426 
00427     if( fDoSystematics ){
00428       for( Int_t isys=0; isys<OscFit::GetNumSystematics(); isys++ ){
00429         Systematic_t systematic = OscFit::GetSystematic(isys);
00430         for( Int_t ishift=0; ishift<OscFit::GetNumShifts(); ishift++ ){
00431           Shift_t shift = OscFit::GetShift(ishift);
00432           WriteTemplate(0,run,sample,OscFit::kNC,systematic,shift,filename);
00433         }
00434       }
00435     }
00436 
00437     // oscillations
00438     for( Int_t n=0; n<=fN_Actual; n++ ){
00439       WriteTemplate(n,run,sample,OscFit::kCCnu,   OscFit::kCentre,OscFit::kNoShift,filename);
00440       WriteTemplate(n,run,sample,OscFit::kCCnubar,OscFit::kCentre,OscFit::kNoShift,filename);
00441 
00442       if( fDoSystematics ){
00443         for( Int_t isys=0; isys<OscFit::GetNumSystematics(); isys++ ){
00444           Systematic_t systematic = OscFit::GetSystematic(isys);
00445           for( Int_t ishift=0; ishift<OscFit::GetNumShifts(); ishift++ ){
00446             Shift_t shift = OscFit::GetShift(ishift);
00447             WriteTemplate(n,run,sample,OscFit::kCCnu,   systematic,shift,filename);
00448             WriteTemplate(n,run,sample,OscFit::kCCnubar,systematic,shift,filename);
00449           }
00450         }
00451       }
00452     }
00453   }
00454 
00455   return;
00456 }

void TemplateMap::WriteTemplates ( const char *  filename  ) 

Definition at line 398 of file twoflavours/TemplateMap.cxx.

References OscFit::GetNumRuns(), OscFit::GetNumSamples(), OscFit::GetRun(), OscFit::GetSample(), and run().

00399 {
00400   std::cout << " *** TemplateMap::WriteTemplates(...) *** " << std::endl;
00401   std::cout << "  FileName: " << filename << std::endl;
00402 
00403   for( Int_t irun=0; irun<OscFit::GetNumRuns(); irun++ ){
00404     Run_t run = OscFit::GetRun(irun);
00405     for( Int_t isample=0; isample<OscFit::GetNumSamples(); isample++ ){
00406       Sample_t sample = OscFit::GetSample(isample);
00407       WriteTemplates(run,sample,filename);
00408     }
00409   }
00410 }


Member Data Documentation

Bool_t OscFit::TemplateMap::fDebug [private]

Definition at line 90 of file TemplateMap.h.

Referenced by SetDebug().

Int_t OscFit::TemplateMap::fIndex [private]

Definition at line 85 of file TemplateMap.h.

Referenced by Load().

std::vector<Int_t> OscFit::TemplateMap::fIndexList [private]

Definition at line 82 of file TemplateMap.h.

Referenced by DeleteContents(), GetIndex(), GetNumTemplates(), and Load().

Double_t OscFit::TemplateMap::fMax [private]

Definition at line 106 of file twoflavours/TemplateMap.h.

Referenced by BuildGrid(), and GetInterpolatedPoint().

Double_t OscFit::TemplateMap::fMin [private]

Definition at line 105 of file twoflavours/TemplateMap.h.

Referenced by BuildGrid(), and GetInterpolatedPoint().

Int_t OscFit::TemplateMap::fN [private]

Definition at line 88 of file TemplateMap.h.

Referenced by BuildTemplate(), PrintTemplates(), ReadTemplate(), and TouchSystematics().

Definition at line 84 of file TemplateMap.h.

Referenced by BuildTemplate(), Load(), ReadTemplate(), and WriteTemplate().

std::map<Run_t,Bool_t> OscFit::TemplateMap::fTemplateFlags [private]

Definition at line 98 of file twoflavours/TemplateMap.h.

Referenced by UseData(), and UseThisRun().

Definition at line 81 of file TemplateMap.h.

Referenced by DeleteContents(), GetTemplate(), and Load().

std::map< Int_t, Template * > OscFit::TemplateMap::fTemplateMap [private]

Definition at line 79 of file TemplateMap.h.

Referenced by DeleteContents(), Get(), Load(), and PrintTemplateNumbers().

Definition at line 100 of file twoflavours/TemplateMap.h.

Referenced by UseData(), and UseThisRun().

Double_t* OscFit::TemplateMap::fX [private]

Definition at line 108 of file twoflavours/TemplateMap.h.

Referenced by BuildGrid(), GetGridPoint(), and PrintGrid().

Double_t* OscFit::TemplateMap::fXedges [private]

Definition at line 109 of file twoflavours/TemplateMap.h.

Referenced by BuildGrid(), PrintGrid(), and WriteGrid().


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

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1