Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4StatusAnalysis/TGo4ConditionStatus.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
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          // we take out encapsulation of whole condition, unnecessary
00032          //fxCondition=dynamic_cast<TGo4Condition*> ( condition->Clone() ); // status consists of full condition copy
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                 // add size of all array members here:
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                              // nothing in this slot? add nothing
00064                           }
00065                        //cout <<"fieldsize after "<<j<<" is"<<fieldsize << endl;
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                // size of window condition is only on stack. already done
00078             }
00080 
00081 
00082 //         cout <<"Condition: "<< condition->GetName() << endl;
00083 //         cout <<"object size is"<<fiObjectSize << endl;
00084       }
00085    else
00086       {      } //if(condtion!=0)
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    // put printout of condition infos here:
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(); // size of polycond on stack
00145 TCutG* thecut=polly->GetCut(kFALSE);
00146 if(thecut)
00147    {
00148        size=2*sizeof(Float_t)*thecut->GetN(); // size of point arrays
00149        size+=thecut->IsA()->Size(); // size of cut object on heap
00150    }
00151 return size;
00152 }
00153 
00154 ClassImp(TGo4ConditionStatus)
00155 
00156 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:05 2005 for Go4-v2.10-5 by doxygen1.2.15