// *************************************************** // // *** Macro for displaying firing tubes per event *** // // *** Input: digi root file *** // // *** Author: S.Costanza - April 2014 *** // // *************************************************** // #include read_digi() { gROOT->SetStyle("Plain"); Int_t fVerbose = 1; TString namefile = "digi_complete.root"; TFile InFile(namefile); TTree *tree = (TTree*) InFile.Get("cbmsim"); TClonesArray *digi = new TClonesArray("PndSttHit"); tree->SetBranchAddress("STTHit", &digi); PndSttHit *hit; TCanvas *geoCanvas = new TCanvas("geo", "geo", 0, 0, 800, 800); TH2F *h = new TH2F("h", "h", 100, 470, 670, 100, -100, 100); h->SetStats(kFALSE); TArc *straw = NULL; TArc *iso = NULL; for (Int_t evt = 0; evt < tree->GetEntriesFast(); evt++) { char goOnChar; cout << "Press any key to see next event [type .q to exit]: " << endl; cin >> goOnChar; if (cin.get() == 'q') gROOT->ProcessLine(".q"); tree->GetEntry(evt); if (evt%1 == 0) cout << "Event # " << evt << ", " << digi->GetEntriesFast() << " hits" << endl; h->Draw(); for (Int_t i = 0; i < digi->GetEntriesFast(); i++) { hit = (PndSttHit*) digi->At(i); Double_t driftr = hit->GetIsochrone(); Int_t tubeID = hit->GetTubeID(); TVector3 pos; pos.SetXYZ(hit->GetX(), hit->GetY(), hit->GetZ()); Double_t phi = TMath::ATan2(pos.Y(), pos.Z()); if (fVerbose>0) cout << "Tube " << tubeID << ", isochrone = " << driftr << "\t pos: (" << pos.Z() << ", " << pos.Y() << ")" << "\t phi " << phi << endl; straw = new TArc(pos.Z()*10, pos.Y()*10, 0.5*10); straw->Draw("SAME"); iso = new TArc(pos.Z()*10, pos.Y()*10, driftr*10); iso->SetLineColor(kRed); iso->Draw("SAME"); } cout << endl; geoCanvas->Update(); geoCanvas->Modified(); } }