00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4ConditionStatus.h"
00017
00018 #include <iostream.h>
00019
00020 #include "Go4Log/TGo4Log.h"
00021 #include "Go4ConditionsBase/TGo4CondArray.h"
00022 #include "Go4ConditionsBase/TGo4PolyCond.h"
00023 #include "Go4ConditionsBase/TGo4WinCond.h"
00024
00025 TGo4ConditionStatus::TGo4ConditionStatus(TGo4Condition* condition)
00026 : TGo4ObjectStatus(condition),fxCondition(0), fiArrayType(0),fbIsHistogram(kFALSE)
00027 {
00028 TRACE((14,"TGo4ConditionStatus::TGo4ConditionStatus(TGo4Condition*)",__LINE__, __FILE__));
00029 if(condition!=0)
00030 {
00031
00032
00033
00034 fbIsHistogram=condition->IsHistogramLink();
00035 if(fbIsHistogram)
00036 fxHistogram=condition->GetLinkedHistogram();
00037 else
00038 fxHistogram="no";
00039
00042 Int_t fieldsize=0;
00043 if(condition->InheritsFrom("TGo4CondArray"))
00044 {
00045 TGo4CondArray* arrcon=dynamic_cast<TGo4CondArray*>(condition);
00046 arrcon->GetType(fiArrayType);
00047
00048 Int_t num=arrcon->GetNumberOfConditions();
00049 for(Int_t j=0; j<num;++j)
00050 {
00051 TGo4WinCond* win=arrcon->Win(j);
00052 TGo4PolyCond* pol=arrcon->Poly(j);
00053 if(win)
00054 {
00055 fieldsize+=win->IsA()->Size();
00056 }
00057 else if(pol)
00058 {
00059 fieldsize+=ConditionSize(pol);
00060 }
00061 else
00062 {
00063
00064 }
00065
00066 }
00067 fiObjectSize+=fieldsize;
00068
00069 }
00070 else if (condition->InheritsFrom("TGo4PolyCond"))
00071 {
00072 TGo4PolyCond* polly=dynamic_cast<TGo4PolyCond*>(condition);
00073 fiObjectSize=ConditionSize(polly);
00074 }
00075 else
00076 {
00077
00078 }
00080
00081
00082
00083
00084 }
00085 else
00086 { }
00087 }
00088 TGo4ConditionStatus::TGo4ConditionStatus()
00089 : TGo4ObjectStatus(),fxCondition(0), fiArrayType(0),fbIsHistogram(kFALSE)
00090 {
00091 TRACE((14,"TGo4ConditionStatus::TGo4ConditionStatus()",__LINE__, __FILE__));
00092
00093 }
00094
00095 TGo4ConditionStatus::~TGo4ConditionStatus()
00096 {
00097 TRACE((14,"TGo4ConditionStatus::TGo4ConditionStatus()",__LINE__, __FILE__));
00098 if(fxCondition)
00099 delete fxCondition;
00100
00101 }
00102
00103
00104 Int_t TGo4ConditionStatus::PrintStatus(Text_t* buffer, Int_t buflen)
00105 {
00106 TRACE((12,"TGo4ConditionStatus::PrintStatus()",__LINE__, __FILE__));
00107 if(buflen<=0 && buffer!=0)
00108 return 0;
00109 Int_t locallen=128000;
00110 Text_t localbuf[locallen];
00111 Int_t size=0;
00112 Text_t* current=localbuf;
00113 Int_t restlen=locallen;
00114 Int_t delta= TGo4ObjectStatus::PrintStatus(current,restlen);
00115 restlen-=delta;
00116 current+=delta;
00117 current=PrintIndent(current,restlen);
00118 current=PrintBuffer(current,restlen, "G-OOOO-> Condition Status Class Printout <-OOOO-G\n");
00119 current=PrintIndent(current,restlen);
00120 current=PrintBuffer(current,restlen, "G-OOOO-> ---------------------------------------------- <-OOOO-G\n");
00121
00122
00124 if(buffer==0)
00125 {
00126 cout << localbuf << endl;
00127 if(fxCondition)
00128 fxCondition->PrintCondition(kTRUE);
00129 }
00130 else
00131 {
00132 size=locallen-restlen;
00133 if(size>buflen-1)
00134 size=buflen-1;
00135 strncpy(buffer,localbuf,size);
00136 }
00137 return size;
00138 }
00139
00140
00141 Int_t TGo4ConditionStatus::ConditionSize(TGo4PolyCond* polly)
00142 {
00143 if(polly==0) return 0;
00144 Int_t size=polly->IsA()->Size();
00145 TCutG* thecut=polly->GetCut(kFALSE);
00146 if(thecut)
00147 {
00148 size=2*sizeof(Float_t)*thecut->GetN();
00149 size+=thecut->IsA()->Size();
00150 }
00151 return size;
00152 }
00153
00154 ClassImp(TGo4ConditionStatus)
00155
00156