The on-line Databases with reprocessed info will be converted to root objects on ,at most, weekly basis to this directories.
For the Quality histograms
The procedure to use root to view the histograms is very simple:
Note: Should root report a missing .so file (specifically,
HbBrowser.so), try setting the environment variable
LD_LIBRARY_PATH with
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/afs/desy.de/group/hera-b/DATABASE/hblipcs4.1/Linux_intel_glibc/lib
before invoking root, so that root knows where to look for the
aditional file(s). This is more likely to be needed if you use
directory /hb/database2/DQ_REPRO/2 in step 4.
This is for the bash shell; if you're using the tcsh
shell, use instead:
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/afs/desy.de/group/hera-b/DATABASE/hblipcs4.1/Linux_intel_glibc/lib
Now suppose you would like to see the histograms for the run 15012. The procedure continues as follows:
Note: It might happen that your looking for some runs that are not in the database (in the range of 16*** to 17***, which corresponds to a time lenght of about 3 weeks). Those runs probably correspond to the period of data acquisition where the Data Quality system was off due to some problems in the storage size.
It might have some interest manipulate the information contained inside the histograms using the powererful scripting facilities that ROOT provides. That's why in this page we describe some examples of simple scripts. Those scripts can be copied and easilly edited (just take a glimpse to the new ROOT Manual) in order to personalise the solution. To run them you just need to invoke the interpreter with root myscript If it doesn't work claiming that it doesn't find some *.so library, set the environment variable export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/afs/desy.de/group/hera-b/group/DATABASE/hblipcs4.1/Linux_intel_glibc/lib
Script 1:
This script opens a .root file (e.g., DQ_17042), checks for all histogram subsets inside the Run for one particular histogram (H10x1820a003) and gets the value of the bin content 5, printing it to the standart output.
{
TFile f("/hb/database/DQ_HISTOS/17000/DQ_17042.root");
// Looking inside the root file
TIter next(f.GetListOfKeys());
TKey *key;
while ((key=(TKey*)next())) {
printf("Key:%s Class:%s at %d\n",
key->GetName(),key->GetClassName(),key->GetSeekKey());
f->cd(key->GetName());
cout << ((TH1F*) gDirectory->Get("H10x1820a003"))->GetBinContent(5) << endl;
f->cd();
}
}
Script 2:
The next script gets the first 10 bins of the histogram "H10x1820a00" and dumps those values to an example file named example.txt.
{
ofstream out("example.txt");
TFile f("/hb/database/DQ_HISTOS/17000/DQ_17042.root");
// Looking inside the root file
TIter next(f.GetListOfKeys());
TKey *key;
while ((key=(TKey*)next())) {
printf("Key:%s Class:%s at %d\n",
key->GetName(),key->GetClassName(),key->GetSeekKey());
f->cd(key->GetName());
TH1F *h=(TH1F*) gDirectory->Get("H10x1820a003");
out << key << endl;
for (int i=1; i<=10;i++)
out << h->GetBinContent(i) << endl;
f->cd();
}
out.close();
}
Script 3:
The following script is an evolution of the first example, being a little bit more complex but very usefull at the same time, it looks at a given directory and for each run's root file it retrieves the data of a given histogram that it contains.
{
char* dir = gSystem->ExpandPathName("/hb/database/DQ_HISTOS/17000/");
void* dirp = gSystem->OpenDirectory(dir);
if( !dirp )
{
printf("Failed to open directory: %d\n",inDir);
return;
}
const char* entry;
const char* filename;
TString *str;
TKey *key;
TIter *iter;
TFile *f;
while( entry=gSystem->GetDirEntry(dirp) )
{
str = new TString(entry);
if( str->EndsWith(".root") )
{
filename = gSystem->ConcatFileName(dir,entry);
printf("File %s\n",filename);
f = new TFile(filename);
iter = new TIter(f->GetListOfKeys());
while ((key=(TKey*)iter->Next()))
{
printf("Key:%s Class:%s at %d\n",
key->GetName(), key->GetClassName(),
key->GetSeekKey());
f->cd(key->GetName());
//INSERT YOUR CODE HERE
if ( ((TH1F*)(gDirectory->Get("H10x1820a003")))!=NULL )
{
cout <<
((TH1F*)gDirectory->Get("H10x1820a003"))->GetBinContent(5) << endl;
}
else
{
cout << "INFO: this histogram is not here!" << endl;
};
f->cd();
}
delete filename;
delete iter;
delete f;
}
delete str;
}
}