NueUtilities Namespace Reference

Classes

class  AnaNueProcessor
class  Histograms

Functions

TChain * CreateChain (std::string treeName, std::string fileListName)
Double_t GetChainPOT (TChain *chain)
Double_t GetWeightedChainPOT (TChain *chain)

Function Documentation

TChain * NueUtilities::CreateChain ( std::string  treeName,
std::string  fileListName 
)

Definition at line 31 of file NueUtilities.cxx.

Referenced by NueUtilities::AnaNueProcessor::AnaNueProcessor(), and NueUtilities::AnaNueProcessor::operator=().

00032  {
00033   //This function can take:
00034   //1) a single root file which must end with ".root"
00035   //2) a collection of root files using a wild card
00036   //   for example: "MyAnaNueFiles/AnaNue*"
00037   //3) a ASCII file with a list of AnaNue file names
00038   
00039   TChain *chain= new TChain(treeName.c_str());
00040   
00041   if(fileListName.find("*")!=string::npos)
00042   {
00043    //Filenames using a wildcard:
00044    chain->Add(fileListName.c_str());
00045   }
00046   else if( ".root" == fileListName.substr(fileListName.length()-5,5) )
00047   {
00048    //Filenames using a wildcard:
00049    chain->Add(fileListName.c_str());
00050   }
00051   else
00052   {  
00053    ifstream fileList(fileListName.c_str());
00054    if( fileList )
00055    {
00056     //Must be an ASCII file with a list of AnaNue file names
00057     while( fileList.good() && !fileList.eof() )
00058     {
00059      std::string line;
00060      getline(fileList,line,'\n');
00061      if ( line.size()==0 ) continue;
00062      chain->Add(line.c_str());
00063     }
00064    }
00065   }
00066   return chain;
00067  }

Double_t NueUtilities::GetChainPOT ( TChain *  chain  ) 

Definition at line 70 of file NueUtilities.cxx.

References NuePOT::pot.

Referenced by NueUtilities::AnaNueProcessor::GetTotalPOT().

00071  {
00072   NuePOT *nuepot = NULL;
00073   chain->SetBranchAddress("NuePOT",&nuepot);
00074  
00075   Double_t pot = 0;
00076   for( int i = 0; i<chain->GetEntries(); ++i )
00077   {
00078     chain->GetEntry(i);
00079     pot += nuepot->pot;
00080   }
00081   chain->ResetBranchAddresses();
00082 
00083   return(pot);
00084  }

Double_t NueUtilities::GetWeightedChainPOT ( TChain *  chain  ) 

Definition at line 86 of file NueUtilities.cxx.

References NuePOT::beamtype, BeamType::kL010z185i_i124, BeamType::kL010z185i_i191, BeamType::kL010z185i_i213, BeamType::kL010z185i_i224, BeamType::kL010z185i_i232, BeamType::kL010z185i_i243, BeamType::kL010z185i_i257, BeamType::kL010z185i_i282, BeamType::kL010z185i_i303, BeamType::kL010z185i_i324, and NuePOT::pot.

00087  {
00088   NuePOT *nuepot = NULL;
00089   chain->SetBranchAddress("NuePOT",&nuepot);
00090  
00091   Double_t pot = 0;
00092   for( int i = 0; i<chain->GetEntries(); ++i )
00093   {
00094     chain->GetEntry(i);
00095     switch(nuepot->beamtype){
00096       case BeamType::kL010z185i_i124: pot += 1.24932*nuepot->pot; break;
00097       case BeamType::kL010z185i_i191: pot += 1.62047*nuepot->pot; break;
00098       case BeamType::kL010z185i_i213: pot += 1.19021*nuepot->pot; break;
00099       case BeamType::kL010z185i_i224: pot += 1.69376*nuepot->pot; break;
00100       case BeamType::kL010z185i_i232: pot += 1.28621*nuepot->pot; break;
00101       case BeamType::kL010z185i_i243: pot += 1.26755*nuepot->pot; break;
00102       case BeamType::kL010z185i_i257: pot += 1.07360*nuepot->pot; break;
00103       case BeamType::kL010z185i_i282: pot += 1.11812*nuepot->pot; break;
00104       case BeamType::kL010z185i_i303: pot += 1.06092*nuepot->pot; break;
00105       case BeamType::kL010z185i_i324: pot += 2.60657*nuepot->pot; break;
00106       default:                        pot += nuepot->pot;         break;
00107     }
00108   }
00109   chain->ResetBranchAddresses();
00110 
00111   return(pot);
00112  }


Generated on 19 Jan 2018 for loon by  doxygen 1.6.1