Attachment 'FDC2Hist.C'
Download// Example for SAMURAI FDC2
void FDC2Hist(){
// 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/SAMURAIFDC2.xml");
// TArtStoreManager is a class for accessing calibrated data
TArtStoreManager *sman = TArtStoreManager::Instance();
// calibration classes
TArtCalibFDC2Hit *calibfdc2hit = new TArtCalibFDC2Hit;
Int_t fdc2_int_drift_tdc = 1495-1090;
Int_t fdc2_tzero = 1495;
TArtCalibFDC2Track *calibfdc2track
= new TArtCalibFDC2Track(fdc2_int_drift_tdc, fdc2_tzero);
// define histograms
TH1* hid = new TH1I("hid", "FDC2 ID", 1568, 0.5, 1568.5);
TH1* hlayertdc = new TH2D("hlayertdc", "FDC2 Layer-TDC", 14,-0.5,13.5, 4100, 0, 4100);
TH1* hchi2 = new TH1D("hchi2","FDC2 track chi2", 200,0,2000000);
TH1* hnhitlayer = new TH1D("hnhitlayer","FDC2 Num of Hit Layers", 15, -0.5,14.5);
TH1* hxy = new TH2D("hxy", "FDC2 X-Y", 200, -1200, 1200, 200,-500,500);
TH1* hxa = new TH2D("hxa", "FDC2 X-A", 200, -1200, 1200, 200,-0.5,0.5);
TH1* hyb = new TH2D("hyb", "FDC2 Y-B", 200, -500, 500, 200,-0.5,0.5);
// event loop
int nevent = 0;
while(eventstore->GetNextEvent() && nevent<1000){
calibfdc2hit->ReconstructData();
calibfdc2track->ReconstructData();
//--------------------------------------------------------
// Get FDC2 hit information
TClonesArray *fdc2hits =
(TClonesArray *)sman->FindDataContainer("SAMURAIFDC2Hit");
if (fdc2hits!=0){
Int_t nhit = fdc2hits->GetEntries();
for (Int_t i=0; i<nhit; i++){
TArtDCHit *hit = (TArtDCHit*)fdc2hits->At(i);
hid->Fill( hit->GetID() );
hlayertdc->Fill( hit->GetLayer(), hit->GetTDC() );
}
}
//--------------------------------------------------------
// Get FDC2 track information
TClonesArray *fdc2trks =
(TClonesArray*)sman->FindDataContainer("SAMURAIFDC2Track");
if ( 0 != fdc2trks ){
if ( 0 < fdc2trks->GetEntries() ){
TArtDCTrack *trk = (TArtDCTrack*)fdc2trks->At(0);//best track
hchi2->Fill( trk->GetChi2() );
hnhitlayer->Fill( trk->GetNumHitLayer() );
hxy->Fill( trk->GetPosition(0), trk->GetPosition(1) );
hxa->Fill( trk->GetPosition(0), trk->GetAngle(0) );
hyb->Fill( trk->GetPosition(1), trk->GetAngle(1) );
}
}
// clear
calibfdc2hit->ClearData();
calibfdc2track->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.