Ignore:
Timestamp:
04/07/14 15:05:14 (10 years ago)
Author:
ftemme
Message:
Added the creation of a MTruePhotonsPerPixelCont in MSimCamera and the filling of the arrays of the container. Also added the container to the fitsoutput
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/msimcamera/MSimCamera.cc

    r17643 r17663  
    4747#include "MLogManip.h"
    4848
     49#include "MTruePhotonsPerPixelCont.h"
     50
    4951#include "MSpline3.h"
    5052#include "MParSpline.h"
     
    149151    {
    150152        *fLog << err << "CrosstalkCoeffParam [MParameterD] not found... aborting." << endl;
     153        return kFALSE;
     154    }
     155
     156    fTruePhotons = (MTruePhotonsPerPixelCont*)pList->FindCreateObj("MTruePhotonsPerPixelCont");
     157    if (!fTruePhotons)
     158    {
     159        *fLog << err << "MTruePhotonsPerPixelCont not found... aborting." << endl;
    151160        return kFALSE;
    152161    }
     
    344353
    345354        if (ph.GetPrimary()!=MMcEvt::kNightSky && ph.GetPrimary()!=MMcEvt::kArtificial)
     355        {
    346356            tot += ph.GetWeight();
     357            (*fTruePhotons->cherenkov_photons_weight)[idx] += ph.GetWeight();
     358            (*fTruePhotons->cherenkov_photons_number)[idx] += 1;
     359
     360            (*fTruePhotons->cherenkov_arrival_time_mean)[idx] += t;
     361            (*fTruePhotons->cherenkov_arrival_time_variance)[idx] += t*t;
     362
     363            if (ph.GetPrimary()==MMcEvt::kMUON)
     364            {
     365                (*fTruePhotons->muon_cherenkov_photons_weight)[idx] += ph.GetWeight();
     366                (*fTruePhotons->muon_cherenkov_photons_number)[idx] += 1;
     367            }
     368
     369            // find min
     370            if (t < (*fTruePhotons->cherenkov_arrival_time_min)[idx] )
     371            {
     372                (*fTruePhotons->cherenkov_arrival_time_min)[idx] = t;
     373            }
     374            // find max
     375            if (t > (*fTruePhotons->cherenkov_arrival_time_max)[idx] )
     376            {
     377               (*fTruePhotons->cherenkov_arrival_time_max)[idx] = t;
     378            }
     379        }
     380        else
     381        {
     382            (*fTruePhotons->noise_photons_weight)[idx] += ph.GetWeight();
     383        }
    347384
    348385        // Sorry, the name "pedestal" is misleading here
     
    352389        // === FIXME === FIXME === FIXME === Frequency!!!!
    353390        (*fCamera)[idx].AddPulse(*fSpline, t, ph.GetWeight()*gain);
     391    }
     392
     393    for (unsigned int i=0 ; i < 1440 ; i++)
     394    {
     395        float number = (*fTruePhotons->cherenkov_photons_number)[i];
     396        (*fTruePhotons->cherenkov_arrival_time_mean)[i] /= number;
     397        float mean = (*fTruePhotons->cherenkov_arrival_time_mean)[i];
     398        float sum_tt = (*fTruePhotons->cherenkov_arrival_time_variance)[i];
     399        (*fTruePhotons->cherenkov_arrival_time_variance)[i] = (sum_tt / number - mean*mean) /(number - 1);
    354400    }
    355401
Note: See TracChangeset for help on using the changeset viewer.