73 leveldb::Status
status = leveldb::DB::Open(options, directory, &db);
75 if (!status.ok())
return 1;
79 TH1D* hLabels =
new TH1D(
"hLabels",
";Event Type", 15, 0, 15);
80 TH1D* hPE =
new TH1D(
"hPE",
"Scaled PE", 256, 0, 256);
88 leveldb::Iterator* itCount = db->NewIterator(leveldb::ReadOptions());
89 for (itCount->SeekToFirst(); itCount->Valid(); itCount->Next())
96 leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());
97 for (it->SeekToFirst(); it->Valid(); it->Next())
101 datum.ParseFromString( it->value().ToString() );
103 int height = datum.height();
104 int width = datum.width();
105 int label = datum.label();
112 const char*
pixels = datum.data().data();
113 for (
int iX = 0; iX < channels*height*width; ++iX)
115 hPE->Fill( (uint8_t)pixels[iX] );
116 hLabels->Fill(label);
124 TString hName =
"PixelMap_";
129 TH2D* xMap =
new TH2D(hName + TString(
"_X"),
";Wire;TDC",
130 height, 0, height, width, 0, width);
131 XVec.push_back(xMap);
132 TH2D* yMap =
new TH2D(hName + TString(
"_Y"),
";Wire;TDC",
133 height, 0, height, width, 0, width);
134 YVec.push_back(yMap);
135 TH2D* zMap =
new TH2D(hName + TString(
"_Z"),
";Wire;TDC",
136 height, 0, height, width, 0, width);
137 ZVec.push_back(zMap);
139 for (
int iPix = 0; iPix < channels*height*width; ++iPix)
141 int iCell = iPix%width;
142 int iPlane = (iPix/width)%height;
143 int iChan = (iPix/width)/height;
144 int pixVal = (uint8_t)pixels[iPix];
147 xMap->SetBinContent(iPlane+1, iCell+1, pixVal);
151 yMap->SetBinContent(iPlane+1, iCell+1, pixVal);
155 zMap->SetBinContent(iPlane+1, iCell+1, pixVal);
184 TFile*
fOut =
new TFile(
"test.root",
"recreate");
185 fOut->WriteTObject(hPE);
186 fOut->WriteTObject(hLabels);
188 for (
size_t i = 0; i < XVec.size(); ++i)
190 TString cName =
"cPixelMap_";
192 TCanvas* canv =
new TCanvas(cName, cName);
195 std::cout<<XVec[i]->Integral()<<
std::endl;
196 XVec[i]->Draw(
"colz");
198 std::cout<<YVec[i]->Integral()<<
std::endl;
199 YVec[i]->Draw(
"colz");
201 std::cout<<ZVec[i]->Integral()<<
std::endl;
202 ZVec[i]->Draw(
"colz");
203 fOut->WriteTObject(canv);
po::variables_map getOptions(int argc, char *argv[], std::string &dir)
QTextStream & endl(QTextStream &s)