#include <EPileupMap.h>
Collaboration diagram for Atlfast::EPileupMap:
Public Methods | |
EPileupMap (int) | |
Constructor, takes luminosity as an argument. | |
~EPileupMap () | |
Delete all newed data members. | |
void | fillMap () |
Fills vector m_map with new EPileupDeposits from a text file. | |
std::vector< EPileupDeposit * > * | getEMMap () const |
Returns std::vector of EPileupDeposits. | |
std::vector< EPileupDeposit * > * | getHadMap () const |
Private Methods | |
void | makeCellMap () |
Make cell maps for eta and phi. | |
void | setInputFile () |
Randomly set m_pileupFile. | |
void | emptyMap () |
tidy up pileupMaps | |
Private Attributes | |
std::vector< EPileupDeposit * > * | m_hadPileupMap |
std::vector containg the EPileupDeposits | |
std::vector< EPileupDeposit * > * | m_emPileupMap |
std::vector containg the EPileupDeposits | |
std::map< int, double > * | m_phiMap |
std::map relating cell id to phi position | |
std::map< int, double > * | m_etaMap |
std::map relating cell id to eta position | |
std::string | m_pileupFile |
Name of input text file containg the EPileup values. | |
std::string | m_fileDir |
Name of directory containg input files. | |
int | m_nFiles |
Number of files in m_fileDir. |
Definition at line 40 of file EPileupMap.h.
|
Constructor, takes luminosity as an argument. Set input epileup file directory and number of files in directory depending on the luminosity Construnt maps relating the cell ids to etas and phis Definition at line 9 of file EPileupMap.cxx. References m_emPileupMap, m_fileDir, m_hadPileupMap, m_nFiles, and makeCellMap().
00009 { 00010 m_emPileupMap = new vector<EPileupDeposit*>; 00011 m_hadPileupMap = new vector<EPileupDeposit*>; 00012 00015 if (luminosity == 1){ 00016 m_nFiles = 10401; 00017 m_fileDir = "allfiles_ll/"; 00018 }else if (luminosity == 2){ 00019 m_nFiles = 10830; 00020 m_fileDir = "allfiles_hl/"; 00021 } 00023 this->makeCellMap(); 00024 } |
|
Delete all newed data members.
Definition at line 26 of file EPileupMap.cxx. References emptyMap(), m_emPileupMap, m_etaMap, m_hadPileupMap, and m_phiMap.
00026 { 00027 this->emptyMap(); 00028 delete m_emPileupMap; 00029 delete m_hadPileupMap; 00030 delete m_phiMap; 00031 delete m_etaMap; 00032 } |
|
Fills vector m_map with new EPileupDeposits from a text file. Deletes any deposits in vector before it fills it with the new ones Definition at line 35 of file EPileupMap.cxx. References emptyMap(), m_emPileupMap, m_etaMap, m_hadPileupMap, m_phiMap, m_pileupFile, and setInputFile(). Referenced by Atlfast::CellMaker::execute().
00035 { 00037 this->emptyMap(); 00039 this->setInputFile(); 00040 00041 ifstream input; 00043 input.open( m_pileupFile.c_str()); 00044 if (input) { 00045 int code; 00046 double energy; 00047 while (input >> code && input >> energy){ 00048 if (code > 0){ 00049 std::string type; 00051 int intType = code/100000; 00053 int eta = (code - intType*100000)/100; 00054 int phi = code - intType*100000 - eta*100; 00056 double et = energy/1000.0; 00057 00058 if(intType == 1){ 00060 m_emPileupMap->push_back(new EPileupDeposit((m_etaMap->find(eta))->second,(m_phiMap->find(phi))->second,et)); 00061 } 00062 if(intType == 2){ 00064 m_hadPileupMap->push_back(new EPileupDeposit((m_etaMap->find(eta))->second,(m_phiMap->find(phi))->second,et)); 00065 } 00066 00067 } 00068 00069 } 00070 }else{ 00071 std::cout << "ERROR! COULD NOT OPEN EPILEUP FILE " << m_pileupFile << std::endl; 00072 } 00073 return; 00074 } |
|
Returns std::vector of EPileupDeposits.
Definition at line 50 of file EPileupMap.h. References m_emPileupMap. Referenced by Atlfast::CellMaker::execute().
00050 {return m_emPileupMap;} |
|
Definition at line 51 of file EPileupMap.h. References m_hadPileupMap. Referenced by Atlfast::CellMaker::execute().
00051 {return m_hadPileupMap;} |
|
Make cell maps for eta and phi. Maybe these should be setable member variables. As we only have one set of maps at the moment, it would be dangerous for user to fiddle with these Definition at line 94 of file EPileupMap.cxx. References m_etaMap, and m_phiMap. Referenced by EPileupMap().
00094 { 00095 m_phiMap = new std::map<int,double> ; 00096 m_etaMap = new std::map<int,double> ; 00100 int EtaCells = 100; 00101 double EtaRange = 10; 00102 int PhiCells = 64; 00103 double PhiRange = 2*3.1415; 00104 for (int i = 1 ; i <= EtaCells; ++i){ 00105 m_etaMap->insert(pair<int,double>(i,((((i)-(EtaCells/2))/(EtaCells/EtaRange)) - (EtaRange/(EtaCells*2.0))))); 00106 } 00107 for (int i = 1 ; i <= PhiCells; ++i){ 00108 m_phiMap->insert(pair<int,double>(i,((((i)-(PhiCells/2))/(PhiCells/PhiRange)) - (PhiRange/(PhiCells*2.0))))) ; 00109 } 00110 return; 00111 } |
|
Randomly set m_pileupFile.
Definition at line 115 of file EPileupMap.cxx. References m_fileDir, m_nFiles, and m_pileupFile. Referenced by fillMap().
00115 { 00116 double max = RAND_MAX; 00117 int i = (int)(rand()/max*m_nFiles); 00118 if(i < 10){ 00119 m_pileupFile = m_fileDir + "part0000" + numberToString(i); 00120 } else if(i < 100){ 00121 m_pileupFile = m_fileDir + "part000" + numberToString(i); 00122 } else if(i < 1000){ 00123 m_pileupFile = m_fileDir + "part00" + numberToString(i); 00124 } else if(i < 10000){ 00125 m_pileupFile = m_fileDir + "part0" + numberToString(i); 00126 } else { 00127 m_pileupFile = m_fileDir + "part" + numberToString(i); 00128 } 00129 return; 00130 } |
|
tidy up pileupMaps
Definition at line 76 of file EPileupMap.cxx. References m_emPileupMap, and m_hadPileupMap. Referenced by fillMap(), and ~EPileupMap().
00076 { 00077 if (m_emPileupMap->size()){ 00078 std::vector<EPileupDeposit*>::iterator itr=m_emPileupMap->begin(); 00079 for (; itr != m_emPileupMap->end();++itr){ 00080 delete (*itr); 00081 } 00082 m_emPileupMap->clear(); 00083 } 00084 if (m_hadPileupMap->size()){ 00085 std::vector<EPileupDeposit*>::iterator itr=m_hadPileupMap->begin(); 00086 for (; itr != m_hadPileupMap->end();++itr){ 00087 delete (*itr); 00088 } 00089 m_hadPileupMap->clear(); 00090 } 00091 return; 00092 } |
|
std::vector containg the EPileupDeposits
Definition at line 61 of file EPileupMap.h. Referenced by emptyMap(), EPileupMap(), fillMap(), getHadMap(), and ~EPileupMap(). |
|
std::vector containg the EPileupDeposits
Definition at line 63 of file EPileupMap.h. Referenced by emptyMap(), EPileupMap(), fillMap(), getEMMap(), and ~EPileupMap(). |
|
std::map relating cell id to phi position
Definition at line 65 of file EPileupMap.h. Referenced by fillMap(), makeCellMap(), and ~EPileupMap(). |
|
std::map relating cell id to eta position
Definition at line 67 of file EPileupMap.h. Referenced by fillMap(), makeCellMap(), and ~EPileupMap(). |
|
Name of input text file containg the EPileup values.
Definition at line 69 of file EPileupMap.h. Referenced by fillMap(), and setInputFile(). |
|
Name of directory containg input files.
Definition at line 71 of file EPileupMap.h. Referenced by EPileupMap(), and setInputFile(). |
|
Number of files in m_fileDir.
Definition at line 73 of file EPileupMap.h. Referenced by EPileupMap(), and setInputFile(). |