Changeset 15603 for trunk/Mars/fact


Ignore:
Timestamp:
05/13/13 15:59:13 (11 years ago)
Author:
mknoetig
Message:
add fTriggerRateTimeOverx and TriggerRateRms to ontime.C
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/fact/processing/ontime.C

    r15513 r15603  
    3535    int     counter             = 0;    //cnt the number of non zero ElTime datapoints
    3636
    37     double  TriggerTimeOver125  = 0.;   //this will be the time  in sec the Trigger
    38                                         //is above 125Hz
     37    double  TriggerTimeOver100  = 0.;   //this will be the time  in sec the Trigger
     38    double  TriggerTimeOver125  = 0.;   //is above 100Hz,125Hz,...
     39    double  TriggerTimeOver150  = 0.;
     40    double  TriggerTimeOver175  = 0.;
     41
     42    double  SumRate             = 0.;   //for calculating the sqrt(var) of the trigger rate
     43    double  SumRate2            = 0.;   //same
     44    double  TriggerRateRms      = 0.;
     45    int     ratecounter         = 0;
    3946
    4047    //loop over all rows in slow-file
     
    6673        }
    6774
    68         //sum the time the trigger is over 125Hz
    69         if (TriggerRate>125.){
    70             TriggerTimeOver125 += ElTime;
     75        //to calculate the sqrt(var) of the rate
     76        SumRate     +=TriggerRate;
     77        SumRate2    +=TriggerRate*TriggerRate;
     78        ratecounter +=1;
     79
     80        //sum the time the triggerate is over 100Hz, 125Hz,...
     81        if (TriggerRate>100.){
     82            TriggerTimeOver100 += ElTime;
     83
     84            if (TriggerRate>125.){
     85                TriggerTimeOver125 += ElTime;
     86
     87                if (TriggerRate>1500.){
     88                    TriggerTimeOver150 += ElTime;
     89
     90                    if (TriggerRate>175.){
     91                        TriggerTimeOver175 += ElTime;
     92
     93                    }
     94                }
     95            }
    7196        }
    7297
     
    80105                                       (SumOnEl/counter*SumOnEl/counter)) : 0.;
    81106    EffectiveOnRMS      = EffectiveOnRMS>0 ? sqrt(EffectiveOnRMS) : 0;
     107    TriggerRateRms      = ratecounter>0? (SumRate2/ratecounter-
     108                                          (SumRate/ratecounter*SumRate/ratecounter)) : 0.;
     109    TriggerRateRms      = TriggerRateRms>0 ? sqrt(TriggerRateRms) : 0;
    82110
    83111    //check for crap data, which happenes sometimes...
    84112    if (EffectiveOn>1.) EffectiveOn = 1.;
    85113    if (EffectiveOnRMS>0.5) EffectiveOnRMS = 0.5;
     114    if (TriggerRateRms>1000) TriggerRateRms = 0.;
    86115
    87116    //return fun. The style from daniela (grep the output) requires an non scientific notation,
    88117    //i.e. withour exponential+ therefore set the precision to ~double with fixed width after decimal point
    89     cout << setiosflags(ios::fixed) << setprecision(12) << "result " << EffectiveOn << " " << EffectiveOnRMS << " " << SumOnTime << " " << TriggerTimeOver125 << endl;
     118    cout << setiosflags(ios::fixed) << setprecision(12)
     119         << "result "
     120         << EffectiveOn         << " "
     121         << EffectiveOnRMS      << " "
     122         << SumOnTime           << " "
     123         << TriggerTimeOver100  << " "
     124         << TriggerTimeOver125  << " "
     125         << TriggerTimeOver150  << " "
     126         << TriggerTimeOver175  << " "
     127         << TriggerRateRms  << " "
     128         << endl;
    90129}
Note: See TracChangeset for help on using the changeset viewer.