43 #include "TDataMember.h"
44 #include "TDataType.h"
46 #include "TClonesArray.h"
47 #include "StStrangeCuts.hh"
48 #include "StMessMgr.h"
50 static const TCut unknownCut(
"NO or UNKNOWN cuts!",
"");
59 TCut::Class()->IgnoreTObjectStreamer();
62 StStrangeCuts::~StStrangeCuts() {
65 void StStrangeCuts::Fill(
const char* prefix,
TDataSet* cutSet) {
68 if (!cutTable)
return;
73 for (Int_t row = 0; row<nrows; row++) {
74 for (UInt_t col = 0; col<cutTable->GetNumberOfColumns(); col++) {
75 const Char_t* colBaseName = cutTable->GetColumnName(col);
76 ((colName = prefix) +=
".") += colBaseName;
78 sprintf(buf,
":%d",row);
81 Long_t colOffset = (Long_t) (cutTable->GetOffset(col));
82 void* colValue = (
void*) (((Long_t) ((*cutTable)[row])) + colOffset);
83 TDataType* colType = rowClass->GetDataMember(colBaseName)->GetDataType();
84 Add(colName.Data(),colType->AsString(colValue));
89 void StStrangeCuts::Append(
const TOrdCollection* oldCuts) {
92 for (Int_t i=(oldCuts->GetSize() - 1); i>=0; i--) {
93 AddIfNew((TCut*) oldCuts->At(i), kTRUE);
96 gMessMgr->Warning() <<
"StStrangeCuts: no StrangeCuts to read in.\n "
97 <<
" Creating new one." << endm;
101 void StStrangeCuts::Reset(
const TSeqCollection* oldCuts) {
104 if (oldCuts->IsA() == TClonesArray::Class()) {
105 cutsSize = ((TClonesArray*) oldCuts)->GetEntriesFast();
107 cutsSize = oldCuts->GetSize();
111 if (additionals) theCuts = lastResetCuts;
113 Bool_t reset = (cutsSize != theCuts->GetSize());
114 while ((!reset) && (i<cutsSize)) {
115 reset = theCuts->NewCut((TCut*) oldCuts->At(i++));
120 if (additionals) lastResetCuts->Clear();
121 for (i=0; i<cutsSize; i++) {
122 TCut* oldCutI = (TCut*) (oldCuts->At(i));
124 if (additionals) lastResetCuts->Add(oldCutI);
127 for (i=0; i<additionals->GetSize(); i++) {
128 Add((TCut*) (additionals->At(i)));
134 Bool_t StStrangeCuts::Contains(
const TObject* aCut) {
135 for (Int_t i=0; i<GetSize(); i++) {
136 TObject* bCut = At(i);
137 if (!(bCut->Compare(aCut))) {
138 if (!(strcmp(bCut->GetTitle(),aCut->GetTitle())))
145 void StStrangeCuts::AddIfNew(TCut* aCut, Bool_t reverse) {
147 if (reverse) AddFirst(aCut);
156 void StStrangeCuts::UpdateArray(TClonesArray* cutsArray) {
158 Int_t cutsSize = GetSize();
159 cutsArray->Expand(cutsSize);
160 for (Int_t i=0; i<cutsSize; i++) {
161 new((*cutsArray)[i]) TCut(* CutAt(i));
167 void StStrangeCuts::UnknownCuts() {
172 void StStrangeCuts::Init() {
175 additionals->Clear();
176 lastResetCuts->Clear();
182 additionals->AddAll(
this);
virtual TClass * GetRowClass() const
to be documented
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.