Changeset 16863


Ignore:
Timestamp:
06/18/13 03:50:37 (11 years ago)
Author:
Daniela Dorner
Message:
bugfix for case histogram in star does not exist, update code for nightly files
File:
1 edited

Legend:

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

    r16671 r16863  
    2121// create tables in DB
    2222
    23 int numevents(TString night="20130418", TString inpath="/daq/analysis/1/", TString table= "AnalysisResultsRunLP", Bool_t dummy=kTRUE, Bool_t pernight=kFALSE)
     23int numevents(TString night="20130418", TString inpath="/daq/analysis/1/", TString table= "AnalysisResultsRunLP", Bool_t dummy=kTRUE, Bool_t pernight=kFALSE, Int_t source=0)
    2424{
    2525
     
    105105            ganymed_fname=inpath+"/ganymed_run/"+year+"/"+month+"/"+day+"/"+run+"-analysis.root";
    106106        else
    107             ganymed_fname=inpath+"/ganymed_night/"+night2+"-analysis.root";
    108         //cout << "gf => " << ganymed_fname << endl;
     107            if (!source)
     108                cout << "ERROR - source " << source << " not valid. " << endl;
     109            else
     110                ganymed_fname=Form("%s/ganymed_night/%d/%s-analysis.root", inpath.Data(), source, night2.Data());
     111        cout << "gf => " << ganymed_fname << endl;
    109112
    110113        if (!pernight)
    111114        {
    112115            star_fname=inpath+"/star/"+year+"/"+month+"/"+day+"/"+run+"_I.root";
    113             //cout << "sf => " << star_fname << endl;
     116            cout << "sf => " << star_fname << endl;
    114117
    115118            //check star file status
     
    142145            star_tree->Draw("MImagePar.fNumIslands>>IslandHisto","","");
    143146            TH1F *HistJo = (TH1F*)gDirectory->Get("IslandHisto");
     147            if (!HistJo)
     148            {
     149                cout << "ERROR - Reading of IslandHisto failed " << HistJo << endl;
     150                continue;
     151            }
    144152            fNumIslandsMean = HistJo->GetMean();
    145153        }
     
    229237
    230238        //inserting or updating the information in the database
    231         vars = Form("fRunID=%s, fNight=%s,", runid.Data(), night2.Data());
     239        if (!pernight)
     240            vars = Form("fRunID=%s, fNight=%s,", runid.Data(), night2.Data());
     241        else
     242            vars = Form("fNight=%s, fSourceKey=%d, ", night2.Data(), source);
    232243        vars += Form(" fNumEvtsAfterQualCuts=%d, "
    233244                    " fNumEvtsAfterBgCuts=%d, "
     
    251262
    252263        if (pernight)
    253             where = Form("fNight=%s", night2.Data());
     264            where = Form("fNight=%s AND fSourceKey=%d", night2.Data(), source);
    254265        else
    255266            where = Form("fRunID=%s AND fNight=%s", runid.Data(), night2.Data());
Note: See TracChangeset for help on using the changeset viewer.