Ignore:
Timestamp:
05/12/15 19:33:34 (9 years ago)
Author:
dbaack
Message:
Fixed bug with non cleared "PhotonEvent"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Corsika7405Compatibility/mcorsika/MCorsikaRead.cc

    r18179 r18180  
    5454#include "MCorsikaEvtHeader.h"
    5555
     56#include "../msim/MPhotonData.h"
     57
    5658#include "MPhotonEvent.h"
    5759
     
    476478Int_t MCorsikaRead::Process()
    477479{
    478         //std::cout << "Process \n\n" << std::endl;
     480        fEvent->Clear();
     481        fEvent->Reset();
     482        fEvent->Resize(0);
     483
     484
     485        std::cout << "\n\n MCorsikaRead Process " << std::endl;
    479486   while (1)  // loop for multiple input files
    480487   {
    481            //std::cout << "OuterLoop \n\n" << std::endl;
    482488
    483489      if (fInFormat)
     
    498504         Int_t status = kTRUE;
    499505
    500          //std::cout << "||||ReadState: " << fReadState
    501         //               << "  Block: " << fBlockType << "\n\n" << std::endl;
    502 
    503506         switch (fBlockType)
    504507            {
     
    516519               Float_t buffer[272];
    517520               static int asd = 0;
    518               // std::cout << "EventHeader |||||| " << ++asd << std::endl;
    519521               if (!fInFormat->Read(buffer, 272 * sizeof(Float_t)))
    520522                  return kFALSE;
     
    528530               status = fEvtHeader->ReadEvt(buffer);
    529531
    530                //fEvtHeader->Print();
    531                //std::cout << "TotReuse: " << fEvtHeader->GetTotReuse();
    532532
    533533               if (fArrayIdx >= (Int_t)fEvtHeader->GetTotReuse())
     
    543543
    544544            case 1204: // top level block for one array (only for eventio data)
    545             //  std::cout << "EventIO1 |||||||" << std::endl;
    546                if (fArrayIdx < 0 || fArrayIdx == fBlockIdentifier)
     545              if (fArrayIdx < 0 || fArrayIdx == fBlockIdentifier)
    547546                  {
    548547                  fReadState = 4;
     
    558557            case 1205: // eventio data
    559558               {
    560               // std::cout << "EventIO2 |||||||" << std::endl;
    561559               Int_t telIdx   = fBlockIdentifier % 1000;
    562            //    std::cout << "TelIDX: " << telIdx << " fTelescopeIdx:" << fTelescopeIdx
    563             //             << " fBlockVersion" << fBlockVersion << std::endl;
    564560
    565561               if (fBlockVersion == 0  && (fTelescopeIdx < 0 || fTelescopeIdx ==  telIdx) )
    566562               {
    567563                  status = fEvent->ReadEventIoEvt(fInFormat);
    568 
    569                   //std::cout << " ArrayIdx:" << fBlockIdentifier / 1000.0 << std::endl;
    570564
    571565                  Int_t arrayIdx = fBlockIdentifier / 1000;
     
    579573                  fEvent->SimWavelength(fRunHeader->GetWavelengthMin(),
    580574                                          fRunHeader->GetWavelengthMax());
     575
     576
     577                  bool tmpWeight = false;
     578                  std::cout << "ReadEventIO Telescope data with " << fEvent->GetNumPhotons() << std::endl;
     579                  for(int i=0; i<fEvent->GetNumPhotons(); i++)
     580                  {
     581
     582                          const MPhotonData &ph = (*fEvent)[i];
     583                          if(ph.GetWeight() != 1)
     584                                  tmpWeight = true;
     585                  }
     586                  if(tmpWeight)
     587                          std::cout << "CorsikaRead Photon weight != 1" << std::endl;
     588
    581589                  }
    582590               else
     
    591599
    592600            case 1209:  // the event end
    593            //   std::cout << "EventEnd ||||||" << std::endl;
    594601               status = fEvtHeader->ReadEvtEnd(fInFormat);
    595602               
     
    608615
    609616            case 1210:  // the run end
    610                 //std::cout << "RunEnd ||||||" << std::endl;
    611                status = fRunHeader->ReadEvtEnd(fInFormat, kTRUE);
     617                status = fRunHeader->ReadEvtEnd(fInFormat, kTRUE);
    612618               fNumEvents += fRunHeader->GetNumEvents();
    613619               //fRunHeader->SetReadyToSave();
     
    637643
    638644            case 1109:  // save corsika events
    639                 //std::cout << "SaveCorsika ||||||" << std::endl;
     645                std::cout << "Block1109" << std::endl;
    640646               fEvtHeader->InitXY();
    641647               status = fEvent->ReadCorsikaEvt(&fRawEvemtBuffer[0],
     
    667673            }
    668674
    669          std::cout << "Status: " << status << std::endl;
    670 
    671675         if (status != kTRUE)
    672676            // there was an error while data were read
     
    674678
    675679         Int_t headerStatus =  ReadNextBlockHeader();
    676 
    677          std::cout << "Header Status: " << headerStatus << std::endl;
    678 
    679680
    680681         if (headerStatus == kFALSE)
Note: See TracChangeset for help on using the changeset viewer.