5 #include <boost/format.hpp> 7 #include <TParameter.h> 43 return *
reinterpret_cast<uint16_t *
>(&
r);
90 fileToRead_ = TFile::Open(fip.
fullPath().c_str());
91 TFile & fileToRead=*fileToRead_;
93 if(fileToRead.IsOpen()) {
96 TIter
next(((TDirectoryFile*)fileToRead.Get(
"schemas"))->GetListOfKeys());
98 while ((key = (TKey*)
next())) {
99 TClass *
cl = gROOT->GetClass(key->GetClassName());
100 if (!cl->InheritsFrom(
"TDirectoryFile"))
continue;
101 std::string schemaNumber = key->ReadObj()->GetName();
102 uint16_t schemaN = std::stoi(schemaNumber);
105 for (
int i = 0;
i < 5;
i++) {
106 for (
int j =
i; j < 5; j++) {
111 std::vector<float> vParams ;
112 TVector *
p=(TVector*) fileToRead.Get((folder+
"/param").c_str());
113 for(
int k = 0 ;
k < p->GetNoElements() ;
k++){
114 vParams.push_back((*p)[
k]);
119 (
int) ((TParameter<int>*) fileToRead.Get(bitString.c_str()))->GetVal(), vParams);
128 }
else {loadedVersion_=-1;}
136 for (
int i = 0;
i < 5;
i++) {
137 for (
int j =
i; j < 5; j++) {
142 addTheHistogram(&cov_elements_pixelHit, String_first_positive,
i, j,f);
143 addTheHistogram(&cov_elements_noPixelHit, String_second_positive,
i, j,f);
153 std::string List_covName[5] = {
"qoverp",
"lambda",
"phi",
"dxy",
"dsz"};
155 std::string histoNameString =
"covariance_" + List_covName[
i] +
"_" + List_covName[j] + StringToAddInTheName+
"parametrization" ;
156 TH3D * matrixElememtHistogramm = (TH3D*) fileToRead.Get(histoNameString.c_str());
157 HistoVector->push_back(matrixElememtHistogramm);
163 int hitNumberToUse = nHits;
164 if (hitNumberToUse < 2 ) hitNumberToUse = 2;
165 if (hitNumberToUse > 32 ) hitNumberToUse = 32;
166 int ptBin = cov_elements_pixelHit[0]->GetXaxis()->FindBin(pt);
167 int etaBin = cov_elements_pixelHit[0]->GetYaxis()->FindBin(
std::abs(eta));
168 int hitBin = cov_elements_pixelHit[0]->GetZaxis()->FindBin(hitNumberToUse);
177 int indexOfTheHitogramInTheList = ((9 - min_idx)*min_idx)/2 + max_idx;
179 double meanValue = 0.;
181 meanValue =sign* cov_elements_pixelHit[indexOfTheHitogramInTheList]->GetBinContent(ptBin, etaBin, hitBin);
184 meanValue = sign*cov_elements_noPixelHit[indexOfTheHitogramInTheList]->GetBinContent(ptBin, etaBin, hitBin);
192 float ref=meanValue(i,j,1.,pt,eta,nHits,pixelHits,cii,cjj);
196 if(schema==0 && i==j && (i==2 || i==0) ) ref=1./(pt*
pt);
201 return (*schemas.find(schema)).
second(i,j).pack(value,ref);
205 float ref=meanValue(i,j,1.,pt,eta,nHits,pixelHits,cii,cjj);
209 if(schema==0 && i==j && (i==2 || i==0) ) ref=1./(pt*
pt);
210 if(i==j && (*schemas.find(schema)).
second(i,j).unpack(packed,ref)==0)
return 1
e-9;
212 return (*schemas.find(schema)).
second(i,j).unpack(packed,ref);
float unpack(uint16_t packed, int schema, int i, int j, float pt, float eta, int nHits, int pixelHits, float cii=1., float cjj=1.) const
void addTheHistogram(std::vector< TH3D * > *HistoVector, std::string StringToAddInTheName, int i, int j, TFile &fileToRead)
double unpack16log(int16_t i, double lmin, double lmax, uint16_t base=32768)
static float float16to32(uint16_t h)
float pack(float value, int schema, int i, int j, float pt, float eta, int nHits, int pixelHits, float cii=1., float cjj=1.) const
U second(std::pair< T, U > const &p)
std::vector< float > params
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
static uint16_t float32to16(float x)
Abs< T >::type abs(const T &t)
format
Some error handling for the usage.
uint16_t pack(float value, float ref=0.) const
float meanValue(int i, int j, int sign, float pt, float eta, int nHits, int pixelHits, float cii=1., float cjj=1.) const
std::string fullPath() const
float unpack(uint16_t packed, float ref=0.) const
int16_t pack16log(double x, double lmin, double lmax, uint16_t base=32768)
static float reduceMantissaToNbits(const float &f)