/** @file RICH Geometry and Mapping checker ** @author Adrian Weber ** @date 05.08.2019 ** ROOT macro to check the RICH Geometry and the Mapping in the Geo File */ void checkGeometryMapping() { //TString buildDir = gSystem->Getenv("CBMROOT_BUILD"); //gSystem->Load(buildDir + "/lib/libCbmRich.so"); std::cout<<"checking the Geometry.."<Getenv("VMCWORKDIR"); TString geoFile = srcDir + "/macro/mcbm/data/mcbm_beam_2019_03.geo.root"; gGeoManager->Import(geoFile.Data()); std::cout<<"DONE!"< pixelData; std::vector PmtData; void DrawPMTs(std::vector pmt); void DrawFull(std::vector ,std::vector); // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ int Pixelcnt = 0; for (Int_t dirich =0x0000; dirich<= 0xFFFF; ++dirich) { for (Int_t ch =1; ch< 33; ++ch) { Int_t address = (dirich << 16) | (ch & 0x00FF); CbmRichPixelData* data = CbmRichMCbmDigiMapManager::GetInstance().GetPixelDataByAddress(address); if (data != nullptr) { pixelData.push_back(data); int size = pixelData.size(); //std::cout<<"X: "<fX<<" Y: "<fY<<" Z: "<fZ< PmtIds = CbmRichMCbmDigiMapManager::GetInstance().GetPmtIds(); std::cout<<"Number of Ids: "<fX<<" "<fY<fPixelAddresses.size()< pmts){ TCanvas* c = new TCanvas("fhPmtMap","fhPmtMap",1000,1000); c->SetGrid(true, true); TH2D* pad = new TH2D("PmtMap", "PmtMap;X [cm];Y [cm]", 100, -40., 40., 100, -40., 40.); pad->SetStats(false); pad->Draw(); for (auto pmt : pmts) { auto x = pmt->fX; auto y = pmt->fY; auto width = pmt->fWidth; auto height = pmt->fHeight; TBox* box = new TBox(x-width/2,y-height/2,x+width/2,y+height/2); box->SetFillStyle(0); box->SetLineColor(kBlack); box->SetLineWidth(2); box->Draw(); char id[4]; sprintf(id,"0x%02x",pmt->fId); TText* t = new TText(x-width/2+0.5,y-0.5,id); t->SetTextSize(0.02); t->Draw(); } } void DrawFull(std::vector pmts, std::vector pixels){ TCanvas* c = new TCanvas("fhPmtMapFull","fhPmtMapFull",1000,1000); c->SetGrid(true, true); TH2D* pad = new TH2D("PmtMapFull", "PmtMapFull;X [cm];Y [cm]", 100, -40., 40., 100, -40., 40.); pad->SetStats(false); pad->Draw(); for (auto pmt : pmts) { auto x = pmt->fX; auto y = pmt->fY; auto width = pmt->fWidth; auto height = pmt->fHeight; TBox* box = new TBox(x-width/2,y-height/2,x+width/2,y+height/2); box->SetFillStyle(0); box->SetLineColor(kBlack); box->SetLineWidth(2); box->Draw(); } for (auto pixel : pixels){ auto x = pixel->fX; auto y = pixel->fY; auto width = 0.6;//pmt->fWidth; auto height = 0.6;//pmt->fHeight; int addr = pixel->fAddress; // int addr_end = addr & 0xF; // if (addr_end == 0x0 || addr_end == 0xF || addr_end == 0x1 || addr_end == 0x2 ) { // width = 0.625;//pmt->fWidth; // } // if ((((addr >>16) & 0x1) == 1 && // ( addr_end == 0xF || addr_end == 0xd || addr_end == 0xb || addr_end == 0x9 || // addr_end == 0x7 || addr_end == 0x5 || addr_end == 0x3 || addr_end == 0x1) // (((addr >>16) & 0x1) == 0 && // ( addr_end == 0xF || addr_end == 0xd || addr_end == 0xb || addr_end == 0x9 || // addr_end == 0x7 || addr_end == 0x5 || addr_end == 0x3 || addr_end == 0x1) // ) // ){ // width = 0.625;//pmt->fWidth; // } TBox* box = new TBox(x-width/2,y-height/2,x+width/2,y+height/2); box->SetFillStyle(0); box->SetLineColor(kBlack); box->SetLineWidth(2); box->Draw(); char id[4]; sprintf(id,"0x%08x",addr); TText* t = new TText(x-width/2,y,id); t->SetTextSize(0.01); t->Draw(); } }