Changeset 16671


Ignore:
Timestamp:
06/03/13 22:20:46 (12 years ago)
Author:
Daniela Dorner
Message:
implemented fOnTimeAfterCuts, made macro compile,fixed some small bugs
File:
1 edited

Legend:

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

    r15530 r16671  
     1#include <iostream>
     2
     3#include <TCanvas.h>
     4#include <TString.h>
     5#include <TTree.h>
     6#include <TFile.h>
     7#include <TSystem.h>
     8#include <TSQLResult.h>
     9#include <TSQLRow.h>
     10
     11#include "MSQLMagic.h"
     12#include "MAlphaFitter.h"
     13#include "MHThetaSq.h"
     14#include "MStatusArray.h"
     15
     16
    117using namespace std;
    218
     
    1632        return 0;
    1733    }
     34    serv.SetIsDummy(dummy);
    1835
    1936    //select runs, where star finished, format the list nicely
     
    4057
    4158    //allocate variables to use in the loop
    42     TString night;
     59    TString night2;
    4360    TString runid;
    4461    TString run;
     
    5976    Float_t fNumExcEvts         = 0;
    6077    Float_t fNumIslandsMean     = 0;
     78    Float_t fOnTimeAfterCuts    = 0;
    6179
    6280    //loop over the data files
    6381    TSQLRow *row=0;
    64     Int_t counter=0;
    6582
    6683    /*
     
    7794    {
    7895        //use the results from the query
    79         night=(*row)[4];
     96        night2=(*row)[4];
    8097        runid=(*row)[5];
    8198        run=(*row)[0];
     
    88105            ganymed_fname=inpath+"/ganymed_run/"+year+"/"+month+"/"+day+"/"+run+"-analysis.root";
    89106        else
    90             ganymed_fname=inpath+"/ganymed_night/"+night+"-analysis.root";
     107            ganymed_fname=inpath+"/ganymed_night/"+night2+"-analysis.root";
    91108        //cout << "gf => " << ganymed_fname << endl;
    92109
     
    150167            continue;
    151168        }
     169
     170        TH1D *vstime = (TH1D*)arr.FindObjectInCanvas("OnTime",  "TH1D", "OnTime");
     171        if (!vstime)
     172        {
     173            cout << "WARNING - Reading of Theta failed." << endl;
     174            continue;
     175        }
     176        fOnTimeAfterCuts = vstime->Integral();
    152177
    153178        //Get number of events after quality cuts
     
    204229
    205230        //inserting or updating the information in the database
    206         vars = Form("fRunID=%s, fNight=%s,", runid.Data(), night.Data());
     231        vars = Form("fRunID=%s, fNight=%s,", runid.Data(), night2.Data());
    207232        vars += Form(" fNumEvtsAfterQualCuts=%d, "
    208233                    " fNumEvtsAfterBgCuts=%d, "
    209234                    " fNumBgEvts=%6.1f, "
    210235                    " fNumSigEvts=%6.1f, "
    211                     " fNumExcEvts=%6.1f ",
     236                    " fNumExcEvts=%6.1f, "
     237                    " fOnTimeAfterCuts=%7.2f ",
    212238                    fNumEvtsAfterQualCuts,
    213239                    fNumEvtsAfterBgCuts,
    214240                    fNumBgEvts,
    215241                    fNumSigEvts,
    216                     fNumExcEvts
     242                    fNumExcEvts,
     243                    fOnTimeAfterCuts
    217244                   );
    218245        if (!pernight)
    219             vars += Form(", fNumIslandsMean=%6.2f ",
    220                          ", fNumEvtsAfterCleaning=%d ",
     246            vars += Form(", fNumIslandsMean=%6.2f, fNumEvtsAfterCleaning=%d ",
    221247                         fNumIslandsMean,
    222248                         fNumEvtsAfterCleaning
     
    225251
    226252        if (pernight)
    227             where = Form("fNight=%s", night.Data());
     253            where = Form("fNight=%s", night2.Data());
    228254        else
    229             where = Form("fRunID=%s AND fNight=%s", runid.Data(), night.Data());
     255            where = Form("fRunID=%s AND fNight=%s", runid.Data(), night2.Data());
    230256
    231257        cout << "vars: " << vars << endl;
Note: See TracChangeset for help on using the changeset viewer.