#include "MGeomCam.h" #include // floor #include "TCanvas.h" #include "MLog.h" #include "MHexagon.h" ClassImp(MGeomCam) MGeomCam::MGeomCam(Int_t type ) { // default constructor if ( type == 1 ) { // set up the Geometry of CT1 fNbPixels = 127 ; fPixels = new TObjArray ( fNbPixels ) ; CreateCT1() ; } else { // set up the standard Geometry MAGIC fNbPixels = 577 ; fPixels = new TObjArray ( fNbPixels ) ; CreateMagic() ; } } void MGeomCam::Draw( Option_t * ) { TCanvas *can = new TCanvas("can", "Camera Geometry", 4 ) ; // set the range of the canvas if ( fNbPixels == 127 ) // case of CT1 can->Range(-175, -175, 175, 175 ) ; else can->Range(-600, -600, 600, 600 ) ; // draw all pixels for ( Int_t i=0; i < fNbPixels ; i++ ) { MHexagon *el = new MHexagon ( (*this)[i] ) ; el->Draw() ; } } void MGeomCam::Print(Option_t *) { // Print Information about the Geometry of the camera gLog << " Number of Pixels: " << fNbPixels << endl ; for ( Int_t i=0; iAdd( new MGeomPix(xtemp[i], ytemp[i], rtemp[i]) ) ; } } void MGeomCam::CreateCT1() { // // fill the geometry class with the coordinates of the CT1 camera // gLog << " Create CT1 geometry " << endl ; // // this algorithm is from Martin Kestel originally // it was punt into a root/C++ context by Harald Kornmayer and Thomas Bretz const Float_t pixdiameter = 21 ; // units are cm // // add the first pixel to the list // fPixels->Add( new MGeomPix( 0, 0, pixdiameter ) ) ; const Float_t kS32 = sqrt(3)/2; const Float_t kPI23 = kPI*2/3; for (Int_t ringcounter=1; ringcounter<7; ringcounter++) { // // calc. numofpix in ring number i first // const Int_t numpixthisring = ringcounter*6; // // calc. coords for this ring counting from the // starting number to the ending number // for (Int_t ipix = 0; ipix < numpixthisring; ipix++) { Float_t ang = 60.0/ringcounter * ipix; Float_t fracang = ang - 60*(int)floor(ang/60); ang /= kRad2Deg; fracang /= kRad2Deg; Float_t rad = pixdiameter * ringcounter; rad *= sin(kPI23-fracang) * kS32; // fill the ObjArray with the pixels data ; fPixels->Add( new MGeomPix(rad * cos(ang), rad * sin(ang), pixdiameter ) ) ; } } }