8 #include "TDirectoryFile.h" 11 #define NOISEPREFIX "Profile_NoiseFromCondDB__det__" 12 #define PEDESTALPREFIX "Profile_PedestalFromCondDB__det__" 13 #define OCCUPANCYPREFIX "ClusterDigiPosition__det__" 25 bool debugPrint =
false;
26 bool imagePrint =
false;
29 rootfilename =
argv[1];
30 modulelistname =
argv[2];
31 pnbits = atoi(
argv[3]);
35 std::cout <<
"Wrong number of parameters " <<
argc << std::endl;
40 std::cout <<
"ready to go " << rootfilename <<
' ' << modulelistname << std::endl;
42 TFile*
rootfile = TFile::Open(rootfilename,
"READ");
44 std::cout <<
"Problems with input root file" << std::endl;
48 std::ifstream modulelist(modulelistname);
50 std::stringstream outrootfilename;
51 outrootfilename <<
prefix <<
"SummaryFile" <<
postfix <<
".root";
52 TFile* outrootfile = TFile::Open(outrootfilename.str().c_str(),
"RECREATE");
54 TH1D* th_summary =
nullptr;
55 Double_t TotalEvents = 0.0;
56 Double_t TotalDigis = 0.0;
58 TH1D* TotEvents =
new TH1D(
"TotEvents",
"TotEvents", 1, 0, 1);
61 TDirectoryFile* tdir = (TDirectoryFile*)
rootfile->FindObjectAny(
"AlCaReco");
62 TH1D*
hist = (TH1D*)tdir->FindObjectAny(
"TotalNumberOfCluster__TIB");
64 TotalEvents =
hist->GetEntries();
65 TotEvents->SetBinContent(1, TotalEvents);
69 while (modulelist >>
detid) {
71 std::cout <<
" ready to go with detid " <<
detid <<
" " << pnbits << std::endl;
74 std::stringstream histoname;
77 std::cout <<
" ready to go with histogram " << histoname.str() << std::endl;
78 TH1D*
hist = (TH1D*)
rootfile->FindObjectAny(histoname.str().c_str());
81 std::cout << histoname.str() <<
" found!" << std::endl;
86 std::cout << histoname.str() <<
" NOT found..." << std::endl;
91 std::stringstream histoname;
94 std::cout <<
" ready to go with histogram " << histoname.str() << std::endl;
95 TH1D*
hist = (TH1D*)
rootfile->FindObjectAny(histoname.str().c_str());
98 std::cout << histoname.str() <<
" found!" << std::endl;
103 std::cout << histoname.str() <<
" NOT found..." << std::endl;
108 std::stringstream histoname;
110 std::string SummaryName =
"ClusterDigiPosition__det__Summary";
113 std::cout <<
" ready to go with histogram " << histoname.str() << std::endl;
114 if (th_summary ==
nullptr)
115 th_summary =
new TH1D(SummaryName.c_str(), SummaryName.c_str(), 768, 0.5, 768.5);
116 TH1D*
hist = (TH1D*)
rootfile->FindObjectAny(histoname.str().c_str());
119 std::cout << histoname.str() <<
" found!" <<
hist->GetEntries() << std::endl;
120 for (
int i = 1;
i <
hist->GetNbinsX() + 1;
i++) {
121 th_summary->AddBinContent(
i,
hist->GetBinContent(
i));
122 TotalDigis +=
hist->GetBinContent(
i);
124 hist->SetLineColor(2);
129 std::cout << histoname.str() <<
" NOT found..." << std::endl;
134 std::stringstream histoname;
137 std::cout <<
" ready to go with histogram " << histoname.str() << std::endl;
138 TH1D*
hist = (TH1D*)
rootfile->FindObjectAny(histoname.str().c_str());
141 std::cout << histoname.str() <<
" found!" << std::endl;
142 std::stringstream histoname_reorder;
144 TH1D* hist_reorder =
new TH1D(histoname_reorder.str().c_str(),
145 histoname_reorder.str().c_str(),
146 hist->GetXaxis()->GetNbins(),
147 hist->GetXaxis()->GetXmin(),
148 hist->GetXaxis()->GetXmax());
149 for (
int i = 0;
i < hist_reorder->GetNbinsX();
i++) {
151 hist_reorder->SetBinContent(
i + 1,
hist->GetBinContent(
chan));
154 hist_reorder->Write();
156 std::cout << histoname.str() <<
" NOT found..." << std::endl;
164 Double_t fac = 1.0 / TotalEvents;
165 th_summary->Scale(fac);
166 std::cout <<
" Run Number " <<
run <<
" Events " << TotalEvents <<
" Total # of Digis " << TotalDigis
167 <<
" Av. Digis " << TotalDigis * fac << std::endl;
168 th_summary->SetEntries(TotalDigis * fac);
174 outrootfile->Close();
180 TCanvas*
cc =
new TCanvas;
188 int chan =
int(32 * fmod(
int(fmod(ival, 256.) / 2.), 4.) + 8 *
int(
int(fmod(ival, 256.) / 2.) / 4.) -
189 31 *
int(
int(fmod(ival, 256.) / 2.) / 16.) + fmod(fmod(ival, 256.), 2.) * 128 +
int(ival / 256) * 256);
void printPlot(TH1D *hist, char *prefix, char *postfix)
uint32_t cc[maxCellsPerHit]
int getChannelNumber(int ival)
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
int main(int argc, char *argv[])