Ignore:
Timestamp:
02/19/09 16:27:33 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msimreflector/MSimReflector.cc

    r9336 r9349  
    429429    TClonesArray &arr  = fEvt->GetArray();
    430430
    431     TClonesArray &cpy0 = fMirror0->GetArray();
    432     //TClonesArray &cpy1 = fMirror1->GetArray();
    433     TClonesArray &cpy2 = fMirror2->GetArray();
    434     TClonesArray &cpy3 = fMirror3->GetArray();
    435     TClonesArray &cpy4 = fMirror4->GetArray();
    436     cpy0.ExpandCreateFast(arr.GetEntriesFast());
    437     //cpy1.ExpandCreateFast(arr.GetEntriesFast());
    438     cpy2.ExpandCreateFast(arr.GetEntriesFast());
    439     cpy3.ExpandCreateFast(arr.GetEntriesFast());
    440     cpy4.ExpandCreateFast(arr.GetEntriesFast());
     431    // Because we knwo in advance what the maximum storage space could
     432    // be we allocated it in advance (or shrink it if it was extremely
     433    // huge before)
     434    // Note, that the drawback is that an extremly large event
     435    //       will take about five times its storage space
     436    //       for a moment even if a lot from it is unused.
     437    //       It will be freed in the next step.
     438    fMirror0->Resize(arr.GetEntriesFast()); // Free memory of allocated MPhotonData
     439    fMirror2->Resize(arr.GetEntriesFast()); // Free memory of allocated MPhotonData
     440    fMirror3->Resize(arr.GetEntriesFast()); // Free memory of allocated MPhotonData
     441    fMirror4->Resize(arr.GetEntriesFast()); // Free memory of allocated MPhotonData
    441442
    442443    // Initialize mirror properties
     
    448449
    449450    // Rotation matrix to derotate sky
     451    // For the new coordinate system see the Wiki
    450452    TRotation rot;    // The signs are positive because we align the incident point on ground to the telescope axis
    451453    rot.RotateZ( az); // Rotate point on ground to align it with the telescope axis
    452454    rot.RotateX(-zd); // tilt the point from ground to make it parallel to the mirror plane
    453455
    454     // Now: viewed from the backside of the mirror
    455     //  x is pointing downwards
    456     //  y is pointing left
    457 
    458     // Rotate around z counterclockwise
    459     // rot.RotateZ(TMath::Pi()/2); // Rotate x to point right / y downwards / z from mirror to camera
    460     // rot.RotateX(TMath::Pi());   // Flip -y and y (also flips Z :( )
    461 
    462     // Now: viewed from the backside of the mirror
    463     //  x is pointing upwards
    464     //  y is pointing right
    465 
     456    // Now get the impact point from Corsikas output
    466457    const TVector3 impact(fEvtHeader->GetX(), fEvtHeader->GetY(), 0);
    467458
     
    500491        dat->SetDirection(w);
    501492
    502         *static_cast<MPhotonData*>(cpy0.UncheckedAt(cnt[0]++)) = *dat;
     493        (*fMirror0)[cnt[0]++] = *dat;
     494        //*static_cast<MPhotonData*>(cpy0.UncheckedAt(cnt[0]++)) = *dat;
    503495
    504496        // Check if the photon has hit the camera housing and holding
     
    507499
    508500        // FIXME: Do we really need this one??
     501        //(*fMirror1)[cnt[1]++] = *dat;
    509502        //*static_cast<MPhotonData*>(cpy1.UncheckedAt(cnt[1]++)) = *dat;
    510503
     
    513506            continue;
    514507
    515         *static_cast<MPhotonData*>(cpy2.UncheckedAt(cnt[2]++)) = *dat;
     508        (*fMirror2)[cnt[2]++] = *dat;
     509        //*static_cast<MPhotonData*>(cpy2.UncheckedAt(cnt[2]++)) = *dat;
    516510
    517511        // Now execute the reflection of the photon on the mirrors' surfaces
     
    526520        dat->SetDirection(w);
    527521
    528         *static_cast<MPhotonData*>(cpy3.UncheckedAt(cnt[3]++)) = *dat;
     522        (*fMirror3)[cnt[3]++] = *dat;
     523        //*static_cast<MPhotonData*>(cpy3.UncheckedAt(cnt[3]++)) = *dat;
    529524
    530525        // Propagate the photon along its trajectory to the focal plane z=F
     
    534529        dat->SetPosition(p);
    535530
    536         *static_cast<MPhotonData*>(cpy4.UncheckedAt(cnt[4]++)) = *dat;
     531        (*fMirror4)[cnt[4]++] = *dat;
     532        //*static_cast<MPhotonData*>(cpy4.UncheckedAt(cnt[4]++)) = *dat;
    537533
    538534        // FIXME: It make make sense to move this out of this class
Note: See TracChangeset for help on using the changeset viewer.