Locked History Actions

attachment:HODHist.C of ANAROOT/Macros

Attachment 'HODHist.C'

Download

// Example for SAMURAI HOD
void HODHist(){

  // set raw data file
  TArtEventStore *eventstore = new TArtEventStore;
  const char* filename = "ridf/sdaq02/dayone0080.ridf";//22C+C run
  if(!eventstore->Open(filename)){
    std::cout << "cannot open " << filename << std::endl;
    return;
  }

  // calibration parameters
  TArtSAMURAIParameters *smprm = TArtSAMURAIParameters::Instance();
  smprm->LoadParameter("db/SAMURAIHOD.xml");

  // TArtStoreManager is a class for accessing calibrated data
  TArtStoreManager *sman = TArtStoreManager::Instance();

  // TArtCalibHODPla is a class for calibartion of SAMURAI Hodoscope
  TArtCalibHODPla *calibhod = new TArtCalibHODPla;

  // define histograms
  TH1* hid = new TH1I("hid", "HOD ID", 16, 0.5, 16.5);
  TH1* hqu = new TH2D("hqu", "HOD ID-QURaw", 16,0.5,16.5, 4100, 0, 4100);
  TH1* hqd = new TH2D("hqd", "HOD ID-QDRaw", 16,0.5,16.5, 4100, 0, 4100);
  TH1* htu = new TH2D("htu", "HOD ID-TURaw", 16,0.5,16.5, 4100, 0, 4100);
  TH1* htd = new TH2D("htd", "HOD ID-TDRaw", 16,0.5,16.5, 4100, 0, 4100);

  TH1* hqave = new TH2D("hqave", "HOD ID-Qave", 16,0.5,16.5, 200, 0, 1000);
  TH1* htime = new TH2D("htime", "HOD ID-Time", 16,0.5,16.5, 200, 0, 200);

  // event loop
  int nevent = 0;
  while(eventstore->GetNextEvent() && nevent<10000){
    calibhod->ReconstructData();

    // Get calibrated data
    TClonesArray *pla_array 
      = (TClonesArray*)sman->FindDataContainer("SAMURAIHODPla");
    // another way
    //TClonesArray *pla_array = (TClonesArray*)calibhod->GetHODPlaArray();

    Int_t NumHODPla = pla_array->GetEntries();
    for(Int_t j=0; j<NumHODPla; j++){
      TArtHODPla *pla = (TArtHODPla*)pla_array->At(j);

      hid->Fill( pla->GetID() );

      hqu->Fill( pla->GetID(), pla->GetQURaw() );
      hqd->Fill( pla->GetID(), pla->GetQDRaw() );
      htu->Fill( pla->GetID(), pla->GetTURaw() );
      htd->Fill( pla->GetID(), pla->GetTDRaw() );
      hqave->Fill( pla->GetID(), pla->GetQAveCal() );
      htime->Fill( pla->GetID(), pla->GetTime() );
    }

    // clear
    calibhod->ClearData();
    eventstore->ClearData();
    ++nevent;
  }

  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-11-02 05:21:15, 1.6 KB) [[attachment:BPCHist.C]]
  • [get | view] (2013-02-27 09:18:59, 0.8 KB) [[attachment:CoinHist.C]]
  • [get | view] (2012-11-02 05:10:49, 2.6 KB) [[attachment:FDC2Hist.C]]
  • [get | view] (2012-11-02 04:31:49, 2.1 KB) [[attachment:HODHist.C]]
  • [get | view] (2012-11-02 04:31:32, 1.6 KB) [[attachment:ICBHist.C]]
  • [get | view] (2014-12-31 11:41:13, 19.5 KB) [[attachment:OnlineMonitor.cc]]
  • [get | view] (2014-12-31 11:41:02, 2.6 KB) [[attachment:OnlineMonitor.hh]]
  • [get | view] (2012-11-02 05:25:41, 1.7 KB) [[attachment:PlaHist.C]]
  • [get | view] (2012-02-15 09:14:24, 3.2 KB) [[attachment:ch2ns.C]]
  • [get | view] (2012-02-15 10:05:13, 3.0 KB) [[attachment:getlandaupeak.C]]
  • [get | view] (2012-02-15 09:14:53, 2.7 KB) [[attachment:getped.C]]
  • [get | view] (2012-02-13 09:49:04, 2.6 KB) [[attachment:makevsta.C]]
  • [get | view] (2012-02-19 14:44:04, 0.5 KB) [[attachment:slew.C]]

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