22 #include "HepMC/GenParticle.h"
23 #include "HepMC/GenVertex.h"
43 HcalConstantsASCIIWriter::~HcalConstantsASCIIWriter()
56 myout_hcal =
new std::ofstream(fDataFile.c_str());
57 if(!myout_hcal)
std::cout <<
" Output file not open!!! "<<std::endl;
61 void HcalConstantsASCIIWriter::endJob()
76 std::cout<<
" Start HcalConstantsASCIIWriter::analyze "<<std::endl;
91 std::map<HcalDetId,float> corrold;
94 int mysubd,
depth,ieta,iphi;
97 std::vector<HcalDetId> theVector;
98 for(std::vector<DetId>::iterator
i = did.begin();
i != did.end();
i++)
102 theVector.push_back(hid);
108 std::cout<<
" Get old calibration "<<std::endl;
114 std::ifstream
in( fDataFile.c_str() );
117 double corrnew_p[5][5][45][75];
118 double corrnew_m[5][5][45][75];
119 std::cout<<
" Start to read txt file "<<fDataFile.c_str()<<std::endl;
120 while( std::getline(
in, line)){
124 if(!line.size() || line[0]==
'#')
continue;
125 std::istringstream linestream(line);
127 linestream>>mysubd>>depth>>ieta>>iphi>>coradd>>corerr;
133 if(ieta<0) ietak = -1*ieta;
134 if(ieta>0) corrnew_p[mysubd][
depth][ietak][iphi] = coradd;
135 if(ieta<0) corrnew_m[mysubd][
depth][ietak][iphi] = coradd;
136 std::cout<<
" Try to initialize mysubd "<<mysubd<<
" depth "<<depth<<
" ieta "<<ieta<<
" "<<ietak<<
" iphi "<<iphi<<
" "<<coradd<<
142 for(std::vector<HcalDetId>::iterator it = theVector.begin(); it != theVector.end(); it++)
144 float cc1 = (*corrold.find(*it)).
second;
147 int ietak = (*it).ieta();
149 if((*it).ieta()<0) ietak=-1*(*it).ieta();
151 if((*it).ieta()>0) cc2 = corrnew_p[(*it).subdet()][(*it).depth()][ietak][(*it).iphi()];
152 if((*it).ieta()<0) cc2 = corrnew_m[(*it).subdet()][(*it).depth()][ietak][(*it).iphi()];
155 std::cout<<
" Multiply "<<(*it).subdet()<<
" "<<(*it).depth()<<
" "<<(*it).ieta()<<
" "<<ietak<<
" "<<(*it).iphi()<<
" "<<(*it).rawId()<<
" "<<cc1<<
" "<<cc2<<std::endl;
T getParameter(std::string const &) const
const Item * getValues(DetId fId, bool throwOnFail=true) const
U second(std::pair< T, U > const &p)
int depth() const
get the tower depth
int ieta() const
get the cell ieta
int iphi() const
get the cell iphi
T const * product() const
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::string fullPath() const
bool addValues(const Item &myItem)
const HcalTopology * topo() const