Ignore:
Timestamp:
04/03/03 10:28:31 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHMatrix.cc

    r1887 r1891  
    10021002
    10031003// --------------------------------------------------------------------------
     1004//
     1005// Read the setup from a TEnv:
     1006//   Column0, Column1, Column2, ..., Column10, ..., Column100, ...
     1007//
     1008// Searching stops if the first key isn't found in the TEnv. Empty
     1009// columns are not allowed
     1010//
     1011// eg.
     1012//     MHMatrix.Column0: cos(MMcEvt.fTelescopeTheta)
     1013//     MHMatrix.Column1: MHillasSrc.fAlpha
     1014//
     1015Bool_t MHMatrix::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     1016{
     1017    if (fM.IsValid())
     1018    {
     1019        *fLog << err << "ERROR - matrix is already in use. Can't add a new column from TEnv... skipped." << endl;
     1020        return kERROR;
     1021    }
     1022
     1023    if (TestBit(kIsLocked))
     1024    {
     1025        *fLog << err << "ERROR - matrix is locked. Can't add new column from TEnv... skipped." << endl;
     1026        return kERROR;
     1027    }
     1028
     1029    if (fData)
     1030    {
     1031        *fLog << inf << "Removing all existing columns in " << GetDescriptor() << endl;
     1032        fData->Delete();
     1033    }
     1034    else
     1035    {
     1036        fData = new MDataArray;
     1037        SetBit(kIsOwner);
     1038    }
     1039
     1040    //
     1041    // Search (beginning with 0) all keys
     1042    //
     1043    for (int i=0;; i++)
     1044    {
     1045        TString idx = "Column";
     1046        idx += i;
     1047
     1048        // Output if print set to kTRUE
     1049        IsEnvDefined(env, prefix, idx, print);
     1050
     1051        // Try to get the file name
     1052        TString name = GetEnvValue(env, prefix, idx, "");
     1053        if (name.IsNull())
     1054            return kTRUE;
     1055
     1056        /*
     1057        if (name.BeginsWith("\"") && name.EndsWith("\""))
     1058        {
     1059            name.Remove(name.Last('\"'), 1);
     1060            name.Remove(name.First('\"'), 1);
     1061        }
     1062        */
     1063
     1064        if (print)
     1065            *fLog << all << "Add Column: " << name << endl;
     1066        fData->AddEntry(name);
     1067    }
     1068
     1069    return kTRUE;
     1070}
Note: See TracChangeset for help on using the changeset viewer.