Changeset 19675


Ignore:
Timestamp:
09/24/19 15:22:49 (5 years ago)
Author:
tbretz
Message:
Allow to read Transmission curve during init process, simplified the main loop a bit further by removing the pre-step, note that the transmission is now a coefficient and not in percent anymore.
Location:
trunk/Mars/msimreflector
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/msimreflector/MFresnelLens.cc

    r19647 r19675  
    289289        const double lambda = transmission.GetX()[i];;
    290290
    291         double trans = transmission.GetY()[i]/100;
     291        double trans = transmission.GetY()[i];
    292292        if (trans>1)
    293293        {
     
    322322
    323323    return fAbsorptionLength.GetNp();
     324}
     325
     326Int_t MFresnelLens::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     327{
     328    const int correction  = GetEnvValue(env, prefix, "Transmission.FresnelCorrection", -1);
     329    const float thickness = GetEnvValue(env, prefix, "Transmission.Thickness", -1.0); // [cm]
     330    const TString fname   = GetEnvValue(env, prefix, "Transmission.FileName", "");
     331
     332    const bool correction_valid = correction>=0;
     333    const bool thickness_valid  = thickness>0;
     334    const bool fname_valid      = !fname.IsNull();
     335
     336    if (!correction_valid && !thickness_valid && !fname_valid)
     337        return kFALSE;
     338
     339    if (correction_valid && thickness_valid && fname_valid)
     340        return ReadTransmission(fname, thickness, correction) >= 0;
     341
     342    *fLog << err << "Reading transmission file required FileName, Thickness and FresnelCorrection." << endl;
     343    return kERROR;
    324344}
    325345
     
    13911411    try
    13921412    {
    1393         int last_surface = EnterGroove(kEntrySurface, n0, p, u);
     1413        int last_surface = kEntrySurface;//EnterGroove(kEntrySurface, n0, p, u);
    13941414
    13951415        // last_surface that was hit (photon originates from)
     
    14011421        // nagative: photon is inside  of material  -->  Try to leave
    14021422
    1403         double T0 = 0;
     1423        double T0 = 0;//last_surface<0 ? p.T() : 0;
    14041424
    14051425        // The general assumption is: no surface can be hit twice in a row
    14061426
    1407         int cnt = 0;
     1427        int cnt = -1;
    14081428        while (last_surface!=0)
    14091429        {
     
    14131433            if (last_surface>0)
    14141434            {
    1415                 last_surface = EnterGroove( last_surface, n0, p, u);
     1435                last_surface = EnterGroove(last_surface, n0, p, u);
    14161436
    14171437                // successfully entered --> remember time of entrance to calculate transimission
     
    15091529    try
    15101530    {
    1511         int last_surface = EnterGroove(kEntrySurface, n0, p, u);
    1512         //cout << "enter1 = " << last_surface << endl;
     1531        int last_surface = kEntrySurface;//EnterGroove(kEntrySurface, n0, p, u);
    15131532
    15141533        // last_surface that was hit (photon originates from)
     
    15241543        // The general assumption is: no surface can be hit twice in a row
    15251544
    1526         int cnt = 0;
     1545        int cnt = -1;
    15271546        while (last_surface!=0)
    15281547        {
  • trunk/Mars/msimreflector/MFresnelLens.h

    r19638 r19675  
    101101    int LeavePeak(int surface, double n0, MQuaternion &pos, MQuaternion &dir, double T0) const;
    102102
     103    // MParContainer
     104    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     105
    103106public:
    104107    MFresnelLens(const char *name=NULL, const char *title=NULL);
Note: See TracChangeset for help on using the changeset viewer.