Locked History Actions

attachment:BPCHist.C of ANAROOT/Macros

Attachment 'BPCHist.C'

Download

// Example for SAMURAI BPC
void BPCHist(){

  // 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/SAMURAIBPC.xml");

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

  // calibration class
  TArtCalibBPCHit *calibbpc = new TArtCalibBPCHit;

  // define histograms
  TH1* hid = new TH1I("hid", "BPC ID", 128, 0.5, 128.5);
  TH1* hlayertdc  = new TH2D("hlayertdc", "BPCLayer-TDC", 2,-0.5,1.5, 4100, 0, 4100);
  TH1* hx = new TH1D("hx", "BPC X", 200,-150,150);

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

    //--------------------------------------------------------
    // Get BPC hit information
    TClonesArray *bpchits = 
      (TClonesArray *)sman->FindDataContainer("SAMURAIBPCHit");

    if ( bpchits != 0 ){
      Int_t nhit = bpchits->GetEntries();

      if ( nhit > 0 ){
        Double_t pos_sum = 0;
        for (Int_t i=0; i<nhit; i++){
          TArtDCHit *hit = (TArtDCHit*)bpchits->At(i);
          hid->Fill( hit->GetID() );
          hlayertdc->Fill( hit->GetLayer(), hit->GetTDC() );
          pos_sum += hit->GetWirePosition();
        }
        hx->Fill( pos_sum/nhit );// simple position determination
      }

    }

    // clear
    calibbpc->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.