22 const ProcFileElements::ProcFileElement *
e =
23 dynamic_cast<const ProcFileElements::ProcFileElement *
>(o);
29 }
else if (fFirst < e->
fFirst) {
39 Int_t ProcFileElements::ProcFileElement::Overlapping(ProcFileElement *e)
49 if (
fFirst == 0 && fLast == -1) {
56 if (fLast < e->fFirst - 1) {
61 if (fLast == e->fFirst - 1) {
73 }
else if (fFirst == e->fFirst) {
75 if (fFirst == fLast || e->fFirst == e->fLast)
return 0;
80 if (e->fLast < fFirst - 1) {
85 if (e->fLast == fFirst - 1) {
100 Warning(
"Overlapping",
"should never be here!");
105 Int_t ProcFileElements::ProcFileElement::MergeElement(ProcFileElement *e)
111 if (Overlapping(e) < 0)
return -1;
114 if (e->fFirst < fFirst) fFirst = e->fFirst;
117 if (fLast == -1 || e->fLast == -1) {
120 if (fLast < e->fLast) fLast = e->fLast;
131 Printf(
"\tfirst: %lld\t last: %lld", fFirst, fLast);
143 Error(
"Add",
"could not create internal list!");
148 ProcFileElements::ProcFileElement *ne =
149 new ProcFileElements::ProcFileElement(fst, lst);
152 TIter nxe(fElements);
153 ProcFileElements::ProcFileElement *e = 0;
154 while ((e = (ProcFileElements::ProcFileElement *)nxe())) {
155 if (e->MergeElement(ne) == 0)
break;
161 fElements->Remove(e);
174 ProcFileElements::ProcFileElement *ep = 0, *en = 0;
175 TObjLink *olp = fElements->FirstLink(), *oln = 0;
176 while (olp && (ep = (ProcFileElements::ProcFileElement *) olp->
GetObject())) {
179 if ((en = (ProcFileElements::ProcFileElement *) oln->GetObject())) {
180 if (ep->MergeElement(en) == 0) {
181 fElements->Remove(en);
191 if ((e = (ProcFileElements::ProcFileElement *) fElements->First())) fFirst = e->fFirst;
192 if ((e = (ProcFileElements::ProcFileElement *) fElements->Last())) fLast = e->fLast;
203 Printf(
"--- ProcFileElements ----------------------------------------");
204 Printf(
" File: %s", fName.Data());
205 Printf(
" # proc elements: %d", fElements ? fElements->GetSize() : 0);
206 TIter nxe(fElements);
207 ProcFileElements::ProcFileElement *e = 0;
208 while ((e = (ProcFileElements::ProcFileElement *)nxe())) { e->Print(); }
209 Printf(
" Raw overall range: [%lld, %lld]", fFirst, fLast);
210 Printf(
"-------------------------------------------------------------");
221 if (li->
GetSize() <= 0)
return 0;
225 ProcFileElements *pfe = 0;
226 while ((pfe = (ProcFileElements *) nxo())) {
227 if (strcmp(
GetName(), pfe->GetName()))
228 Warning(
"Merge",
"merging objects of different name! ('%s' != '%s')",
230 TIter nxe(pfe->GetListOfElements());
231 ProcFileElements::ProcFileElement *e = 0;
232 while ((e = (ProcFileElements::ProcFileElement *)nxe())) {
233 Int_t rc =
Add(e->fFirst, e->fLast);
std::string GetName(const std::string &scope_name)
Class to hold information about the processed elements of a file.
A sorted doubly linked list.
void Error(const char *location, const char *msgfmt,...)
Collection abstract base class.
void Warning(const char *location, const char *msgfmt,...)
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, const THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
void Print(std::ostream &os, const OptionType &opt)
Wrapper around a TObject so it can be stored in a TList.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Mother of all ROOT objects.
TObject * GetObject() const
Int_t Compare(const void *item1, const void *item2)
virtual Int_t GetSize() const