Helper class to read dead material correction coeffitients from ASCII file.
More...
#include <CaloHadDMCoeffHelper.h>
Helper class to read dead material correction coeffitients from ASCII file.
- Version
- $Id: CaloHadDMCoeffHelper.h,v 1.1 2009-03-03 17:30:21 pospelov Exp $
- Author
- Gennady Pospelov guenn.nosp@m.adi..nosp@m.pospe.nosp@m.lov@.nosp@m.cern..nosp@m.ch
- Date
- 23-Januar-2009
Definition at line 22 of file CaloHadDMCoeffHelper.h.
◆ key_area_type
◆ CaloHadDMCoeffHelper()
CaloHadDMCoeffHelper::CaloHadDMCoeffHelper |
( |
| ) |
|
◆ ~CaloHadDMCoeffHelper()
CaloHadDMCoeffHelper::~CaloHadDMCoeffHelper |
( |
| ) |
|
|
virtual |
◆ getBin()
int CaloHadDMCoeffHelper::getBin |
( |
CaloHadDMCoeff2 * |
m_coeff, |
|
|
const int |
n_area, |
|
|
int |
ifrac, |
|
|
int |
iener, |
|
|
int |
ilambda, |
|
|
int |
ieta |
|
) |
| const |
◆ getHadDMAreaFromBin()
Definition at line 39 of file CaloHadDMCoeffHelper.cxx.
42 int narea =
coeff->getSizeDMAreaSet();
43 for(i_area=0; i_area<narea; i_area++) {
44 if( iBin < coeff->getHadDMArea(i_area)->m_offset )
break;
45 if( iBin >=
coeff->getHadDMArea(i_area)->m_offset
46 && (i_area == narea-1 || iBin < coeff->getHadDMArea(i_area+1)->m_offset) )
break;
48 return coeff->getHadDMArea(i_area);
◆ getHadDMAreaFromName()
Definition at line 52 of file CaloHadDMCoeffHelper.cxx.
54 for(
int i_area=0; i_area<
coeff->getSizeDMAreaSet(); i_area++) {
55 if(sname ==
coeff->getHadDMArea(i_area)->m_title) {
56 return coeff->getHadDMArea(i_area);
59 std::cout <<
"CaloHadDMCoeffHelper::getHadDMAreaFromName() -> Error! No such dmArea '" << sname <<
"'" << std::endl;
◆ InitDataFromFile()
CaloHadDMCoeff2 * CaloHadDMCoeffHelper::InitDataFromFile |
( |
std::string & |
hadDMCoeffFileName | ) |
|
Definition at line 78 of file CaloHadDMCoeffHelper.cxx.
85 std::cout <<
"CaloHadDMCoeffHelper::InitDataFromFile() - Reading file '" <<
filename <<
"'." << std::endl;
89 std::cout <<
"CaloHadDMCoeffHelper::InitDataFromFile() - Can't open file '" <<
filename <<
"'." << std::endl;
90 delete data;
return nullptr;
97 std::istringstream ist;
98 while(
fin.getline(cLine,
sizeof(cLine)-1)) {
99 if( strlen(cLine)==0 || cLine[0] ==
'#' || cLine[0] ==
'\n')
continue;
105 ist.clear(); ist.str(sLine);
106 if( !(ist >> sdummy >> dmArea.
m_indx >> dmArea.
m_is_on >> dmArea.
m_title) && sdummy.find(
"zone")==std::string::npos ) {
107 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() -> Error! Could not parse line '" << cLine <<
"' at p1." << std::endl;
108 delete data;
return nullptr;
112 if(dmArea.
m_title.find(
"DEAD_FCAL") != std::string::npos) {
114 }
else if(dmArea.
m_title.find(
"DEAD_LEAKAGE") != std::string::npos) {
116 }
else if(dmArea.
m_title.find(
"DEAD_UNCLASS") != std::string::npos) {
121 std::vector<CaloHadDMCoeff2::HadDMDimension > v_dims;
122 while(
fin.getline(cLine,
sizeof(cLine)-1)){
123 if( cLine[0] ==
'#')
continue;
126 if(sLine.find(
"npars") != std::string::npos){
127 ist.clear(); ist.str(sLine);
128 if( !(ist >> sdummy >> dmArea.
m_nPars) ||
132 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() ->Error! Could not parse line '" << cLine <<
"' at p2." << std::endl;
133 delete data;
return nullptr;
140 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() ->Error! Could not parse line '" << sLine <<
"' at p2a." << std::endl;
141 delete data;
return nullptr;
143 v_dims.push_back(
dim);
146 int ndim = (
int) v_dims.size();
148 for(
int i=0;
i<ndim;
i++){
154 for(
int i_dim=0; i_dim<ndim; i_dim++){
156 for(
int j=i_dim+1; j<ndim; j++){
157 xloc = xloc*v_dims[j].m_vBins.size();
159 v_dims[i_dim].xloc = xloc;
161 if( v_dims.size() != 4 ){
162 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() ->Error! Wrong number of dimensions for area'" << dmArea.
m_title <<
"' at p3." << std::endl;
163 delete data;
return nullptr;
170 data->addHadDMArea(dmArea);
177 for(
int i_len=0; i_len<dmArea.
m_length; i_len++){
178 if(!
fin.getline(cLine,
sizeof(cLine)-1)) {
179 std::cout <<
"panic " << std::endl;
180 delete data;
return nullptr;
183 ist.clear(); ist.str(sLine);
185 if( !(ist >> idummy) ) {
186 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() -> Warning! Area " << dmArea.
m_title <<
" doesn't have parameters." << std::endl;
189 if(idummy != dmArea.
m_offset+i_len){
190 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() ->Error! Could not parse line '" << cLine <<
"' at p3." << std::endl;
191 delete data;
return nullptr;
193 for(
int j=0; j<(
int)v_dims.size(); j++) {
194 if(!(ist >> idummy)) {
195 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() -> panic!" << std::endl;
196 delete data;
return nullptr;
201 for(
int j=0; j<dmArea.
m_nPars; j++) {
202 if( !(ist >>
pars[j]) ) {
203 std::cout <<
"CaloHadDMCoeffHelper::initDataFromFile() ->Error! Could not parse line '" << cLine <<
"' at p4." << std::endl;
204 std::cout <<
" dmArea.m_title" << dmArea.
m_title << std::endl;
205 delete data;
return nullptr;
◆ parse_dim()
Definition at line 221 of file CaloHadDMCoeffHelper.cxx.
225 std::istringstream ist(sLine.c_str());
227 if( !(ist >>
dim.m_title >>
dim.m_nbins >>
dim.m_vMin >>
dim.m_vMax >> stype)||
231 std::cout <<
"CaloHadDMCoeffHelper::parse_dim() -> Error! Could not parse line '" << sLine <<
"' at pp1." << std::endl;
235 if(stype.find(
"flat") != std::string::npos) {
237 dim.m_bin_size = (
dim.m_vMax -
dim.m_vMin)/
float(
dim.m_nbins);
240 }
else if(stype.find(
"hand") != std::string::npos) {
243 for(
int i=0;
i<
dim.m_nbins;
i++)
if( ist >>
e )
dim.m_vBins.push_back(
e);
245 std::cout <<
"CaloHadDMCoeffHelper::parse_dim() -> Error! Could not parse line '" << sLine <<
"' at pp3." << std::endl;
248 if((
int)
dim.m_vBins.size() !=
dim.m_nbins){
249 std::cout <<
"CaloHadDMCoeffHelper::parse_dim() -> Error! Could not parse line '" << sLine <<
"' at pp4." << std::endl;
252 return (
int)
dim.m_vBins.size();
The documentation for this class was generated from the following files: