Locked History Actions

attachment:ArtAnalyzeDALI2.C of ANAROOT/Manual/tutorial

Attachment 'ArtAnalyzeDALI2.C'

Download

#ifndef __CINT__
#include <iostream>

#include "TSystem.h"
#include "TH1I.h"
#include "TH1D.h"

#include "TArtEventStore.hh"

#include "TArtDALIParameters.hh"

#include "TArtCalibDALI.hh"
#include "TArtDALINaI.hh"
#include "TArtDALINaIPara.hh"
#endif

void ArtAnalyzeDALI2()
{
  TH1* hid = new TH1I("hid", "DALI ID", 150, 0, 150);
  TH1* hadc = new TH1D("hadc", "DALI ADC", 4100, 0, 4100);
  TH1* henergy = new TH1D("henergy", "DALI energy", 400, 0, 10);
  TH1* hqcal = new TH1D("hqcal", "DALI parameter of ADC to energy", 400, 0, 10);

  TArtEventStore *eventstore = new TArtEventStore;
  const char* filename = "ridf/1205_dayone/sdaq02/dayone0123.ridf";
  if(!eventstore->Open(filename)){
    std::cout << "cannot open " << filename << std::endl;
    return;
  }

  TArtDALIParameters *daliparameters = new TArtDALIParameters;
  daliparameters->LoadParameter("db/DALI.xml");
  TArtCalibDALI *calibdali= new TArtCalibDALI;

  std::cout << " start to scan" << std::endl;
  int nevent = 0;
  while(eventstore->GetNextEvent() && nevent<10000){
    calibdali->ReconstructData();

    Int_t NumDALI = calibdali->GetNumNaI();
    for(Int_t j=0; j<NumDALI; j++){
      TArtDALINaI *dalinai = (TArtDALINaI*)calibdali->GetNaI(j);
      TArtDALINaIPara *dalinaipara = (TArtDALINaIPara*)calibdali->GetNaIPara(j);

      hid->Fill(dalinai->GetID());
      hadc->Fill(dalinai->GetRawADC());
      henergy->Fill(dalinai->GetEnergy());
      hqcal->Fill(dalinaipara->GetQCal());

      /* DEBUG
      std::cout << dalinai->GetID() << " "
                << dalinai->GetRawADC() << " "
                << dalinai->GetEnergy() << " "
                << dalinaipara->GetQCal() << " "
                << std::endl;
      */
    }

    calibdali->ClearData();
    eventstore->ClearData();
    ++nevent;

    std::cout << "\r AnaDALI: " << nevent << ", NumDALI: " << NumDALI << std::flush;
  }
  std::cout << std::endl;

  return;
}

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2012-07-13 05:51:44, 1.0 KB) [[attachment:ArtAnalyzeDALI1.C]]
  • [get | view] (2012-07-13 05:52:19, 1.8 KB) [[attachment:ArtAnalyzeDALI2.C]]

You are not allowed to attach a file to this page.