Re: Event data formats: BrEvent, BrGeantInput, BrRawInput

From: Konstantin Olchanski (olchansk@ux1.phy.bnl.gov)
Date: Thu Mar 09 2000 - 17:08:08 EST

  • Next message: Flemming Videbaek: "Fw: Event formats"

    The code below makes no sense. Why get a list of records and loop over them?
    You already know which records you want, so just get the damned records
    and be done with. No looping, switch()ing and if/else'ing is necessary.
    
    
    K.O.
    
    
    > 
    >   switch(recordId) {
    >   ...
    >   case 2302:
    >   case kT1B: 
    >   case kT1:
    >   case kT2B:
    >   case kT2:
    >     if(recordId==kT1B){
    >       fTable = new BrDataTable("TPCSequence T1B","Raw mapped");
    >       ...
    >     else if(recordId==kT1){
    >       fTable = new BrDataTable("TPCSequence T1", "Raw mapped");
    >       ...
    >     else if(recordId == kT2B){
    >       fTable = new BrDataTable("TPCSequence T2B","Raw mapped");
    >       ...
    >     else if(recordId == kT2){
    >       fTable = new BrDataTable("TPCSequence T2", "Raw mapped");
    >       ...
    >     else if(recordId == 2302){
    >       fTable = new BrDataTable("TPCSequence T1B","Raw mapped");
    >       ....      
    >   }
    > 
    > What about doing:
    > 
    >   switch(recordId) {
    >   ...
    >   case 2302:
    >   case kT1B: 
    >     DecodeTPC(kT1BName);
    >     break;
    >   case kT1:
    >     DecodeTPC(kT1Name);
    >     break;
    >   case kT2B:
    >     DecodeTPC(kT2BName);
    >     break;
    >   case kT2:
    >     DecodeTPC(kT2Name);
    >     break;
    >   ...
    >   }
    > 
    > And
    > 
    >   DecodeTPC(const Char_t* name) {
    >     if(fRawEvent->getRecordUint16(recordId, buf16, length) 
    >        != fRawEvent->kOk) 
    >     ...
    >     const Char_t tablename = Form(kTPCFormat, name);
    >     BrDataTable* fTable = new BrDataTable(tablename, kTPCTitle);
    >     fFFSNode->AddDataTable(fTable);
    >     ...
    >   }
    > 
    > where 
    > 
    >   const Char_t* kT1BName   = "T1B"
    >   ...
    >   const Char_t* kTPCFormat = "TPCSequence %s";
    >   ...
    >   const Char_t* kTPCTitle  = "RAW mapped";
    >    
    > > That's my one cent response to the two pennies worth.
    > 
    > Hmm, I guess we're down to lires! 
    > 
    > Cheers, 
    > 
    > Christian  -----------------------------------------------------------
    > Holm Christensen                             Phone:  (+45) 35 35 96 91 
    >   Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
    >   DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
    >   Denmark                                    Email:       cholm@nbi.dk
    > 
    
    -- 
    Konstantin Olchanski
    Physics Department, Brookhaven National Laboratory, Long Island, New York
    olchansk@bnl.gov
    



    This archive was generated by hypermail 2b29 : Thu Mar 09 2000 - 17:10:26 EST