Ignore:
Timestamp:
11/19/12 11:55:18 (12 years ago)
Author:
Jens Buss
Message:
bugfix: pedestal readout in correct place no segfault
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/marsmacros/mc2csv/MonteCarlo.C

    r14657 r14658  
    116116    mNumberOfEvents = 2;
    117117
    118     mVerbosityLvl   = 2;
     118    mVerbosityLvl   = 3;
    119119
    120120    return;
     
    209209        mpHeaderTree->SetBranchAddress("MGeomCam.",         &mpGeomCam);
    210210    }
     211    else cout << "...could not load branch: MGeomCam" << endl;
    211212
    212213    // -----------------------------------------------------------------------
     
    218219        mpHeaderTree->SetBranchAddress("IntendedPulsePos.", &mpIntendedPulsePos);
    219220    }
     221    else cout << "...could not load branch: IntendedPulsePos" << endl;
    220222
    221223    // -----------------------------------------------------------------------
     
    227229        mpHeaderTree->SetBranchAddress("MMcRunHeader.",     &mpMcRunHeader);
    228230    }
     231    else cout << "...could not load branch: MMcRunHeader" << endl;
    229232
    230233    // -----------------------------------------------------------------------
     
    236239        mpHeaderTree->SetBranchAddress("ElectronicNoise.",  &mpElectronicNoise);
    237240    }
     241    else cout << "...could not load branch: ElectronicNoise" << endl;
    238242
    239243    // -----------------------------------------------------------------------
     
    245249        mpHeaderTree->SetBranchAddress("MRawRunHeader.",    &mpRawRunHeader);
    246250    }
     251    else cout << "...could not load branch: MRawRunHeader" << endl;
    247252
    248253    // -----------------------------------------------------------------------
     
    254259        mpHeaderTree->SetBranchAddress("MCorsikaRunHeader.",&mpCorsikaRunHeader);
    255260    }
     261    else cout << "...could not load branch: MCorsikaRunHeader" << endl;
    256262
    257263    // =======================================================================
     
    350356    else if (mVerbosityLvl > 2)
    351357        cout << "...could not read data from: MCorsikaRunHeader" << endl;
     358
     359    // -----------------------------------------------------------------------
     360
     361    // delete Pixel Array before you set refferences for a new one
     362    if (mpPixel != NULL)
     363    {
     364        delete[] mpPixel;
     365    }
     366    mpPixel = new pixel_t[mNumberOfPixels];
     367
     368    // -----------------------------------------------------------------------
     369
     370    //Get Pedestal from "ElectronicNoise" Branch
     371    if ( mpElectronicNoise != NULL)
     372    {
     373        if (mVerbosityLvl > 1) cout << "   ...reading pedestal offsets" << endl;
     374
     375        // Read Pedestal Offset
     376        for ( int i = 0; i < mNumberOfPixels; i++ )
     377        {
     378            if ( &(mpElectronicNoise[0][i]) != NULL)
     379                mpPixel[i].pedestal   = mpElectronicNoise[0][i].GetPedestal();
     380            else if (mVerbosityLvl > 2)
     381                cout << "   ...cannot read pedestal offset" << endl;
     382        }
     383    }
     384    else if (mVerbosityLvl > 2)
     385        cout << "...could not read data from: ElectronicNoise" << endl;
    352386
    353387    return;
     
    844878MonteCarlo::WritePedestalInfo2Csv()
    845879{
    846     mCsv << "### [Pedestal info]" << endl;
    847     mCsv << "# SoftID" ;
    848     mCsv << mSeparator ;
    849     mCsv << "Pedestal" << endl;
     880    mCsv << "### [Pedestal]" << endl;
     881//    mCsv << "# SoftID" ;
     882//    mCsv << mSeparator ;
     883//    mCsv << "Pedestal" << endl;
    850884}
    851885
     
    857891    for (int pixelID = 0; pixelID < mNumberOfPixels; pixelID++)
    858892    {
    859         mCsv << mpPixel[pixelID].SoftId;
    860         mCsv << mSeparator;
     893//        mCsv << mpPixel[pixelID].SoftId;
    861894        mCsv << mpPixel[pixelID].pedestal;
    862         mCsv << endl;
     895        if (pixelID < mNumberOfPixels -1)
     896            mCsv << mSeparator;
    863897    }
    864898    mCsv << endl;
Note: See TracChangeset for help on using the changeset viewer.