*** Create_TRD_Geometry_v18c_1e.C 2017-03-10 00:12:09.120667994 +0100 --- Create_TRD_Geometry_v18c_1e.C.root6 2017-03-10 00:11:37.712335658 +0100 *************** *** 78,83 **** --- 78,87 ---- #include "TRandom3.h" #include "TDatime.h" + #include "TGeoArb8.h" + #include "TGeoTube.h" + #include "TGeoCone.h" + #include // Name of output file with geometry *************** *** 441,451 **** // Forward declarations void create_materials_from_media_file(); ! void create_trd_module_type(Int_t moduleType); void create_detector_layers(Int_t layer); void create_xtru_supports(); void create_box_supports(); ! void add_trd_labels(); void create_mag_field_vector(); void dump_info_file(); void dump_digi_file(); --- 445,455 ---- // Forward declarations void create_materials_from_media_file(); ! TGeoVolume* create_trd_module_type(Int_t moduleType); void create_detector_layers(Int_t layer); void create_xtru_supports(); void create_box_supports(); ! void add_trd_labels(TGeoVolume*, TGeoVolume*, TGeoVolume*); void create_mag_field_vector(); void dump_info_file(); void dump_digi_file(); *************** *** 516,522 **** TFile* outfile = new TFile(FileNameSim,"RECREATE"); top->Write(); // use this as input to simulations (run_sim.C) outfile->Close(); ! TFile* outfile = new TFile(FileNameGeo,"RECREATE"); gGeoMan->Write(); // use this is you want GeoManager format in the output outfile->Close(); --- 520,526 ---- TFile* outfile = new TFile(FileNameSim,"RECREATE"); top->Write(); // use this as input to simulations (run_sim.C) outfile->Close(); ! outfile = new TFile(FileNameGeo,"RECREATE"); gGeoMan->Write(); // use this is you want GeoManager format in the output outfile->Close(); *************** *** 542,548 **** DetectorSizeX[1] - 2 * FrameWidth[1] }; const Int_t NofSectors = 3; const Int_t NofPadsInRow[2] = { 80, 128 }; // numer of pads in rows ! Double_t nrow = 0; // number of rows in module const Double_t PadHeightInSector[NofModuleTypes][NofSectors] = // pad height { { 1.50, 1.50, 1.50 }, // module type 1 - 1.01 mm2 --- 546,552 ---- DetectorSizeX[1] - 2 * FrameWidth[1] }; const Int_t NofSectors = 3; const Int_t NofPadsInRow[2] = { 80, 128 }; // numer of pads in rows ! Int_t nrow = 0; // number of rows in module const Double_t PadHeightInSector[NofModuleTypes][NofSectors] = // pad height { { 1.50, 1.50, 1.50 }, // module type 1 - 1.01 mm2 *************** *** 592,598 **** { printf("WARNING: sector size does not add up to module size for module type %d\n", im+1); printf("%.2f = %.2f + %.2f + %.2f\n", ActiveAreaX[ModuleType[im]], HeightOfSector[im][0], HeightOfSector[im][1], HeightOfSector[im][2]); ! exit(); } //============================================================== --- 596,602 ---- { printf("WARNING: sector size does not add up to module size for module type %d\n", im+1); printf("%.2f = %.2f + %.2f + %.2f\n", ActiveAreaX[ModuleType[im]], HeightOfSector[im][0], HeightOfSector[im][1], HeightOfSector[im][2]); ! exit(1); } //============================================================== *************** *** 752,771 **** fprintf(ifile,"# envelope\n"); // Show extension of TRD ! fprintf(ifile,"%4d cm start of TRD (z)\n", z_first_layer); ! fprintf(ifile,"%4d cm end of TRD (z)\n", z_last_layer + LayerThickness); fprintf(ifile,"\n"); // Layer thickness fprintf(ifile,"# thickness\n"); ! fprintf(ifile,"%4d cm per single layer (z)\n", LayerThickness); fprintf(ifile,"\n"); // Show extra gaps fprintf(ifile,"# extra gaps\n "); for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) if (ShowLayer[iLayer]) ! fprintf(ifile,"%3d ", LayerOffset[iLayer]); fprintf(ifile," extra gaps in z (cm)\n"); fprintf(ifile,"\n"); --- 756,775 ---- fprintf(ifile,"# envelope\n"); // Show extension of TRD ! fprintf(ifile,"%4f cm start of TRD (z)\n", z_first_layer); ! fprintf(ifile,"%4f cm end of TRD (z)\n", z_last_layer + LayerThickness); fprintf(ifile,"\n"); // Layer thickness fprintf(ifile,"# thickness\n"); ! fprintf(ifile,"%4f cm per single layer (z)\n", LayerThickness); fprintf(ifile,"\n"); // Show extra gaps fprintf(ifile,"# extra gaps\n "); for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) if (ShowLayer[iLayer]) ! fprintf(ifile,"%3f ", LayerOffset[iLayer]); fprintf(ifile," extra gaps in z (cm)\n"); fprintf(ifile,"\n"); *************** *** 781,804 **** fprintf(ifile,"# dimensions in x\n"); for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) if (ShowLayer[iLayer]) if (PlaneId[iLayer] < 5) ! fprintf(ifile,"%5d cm to %5d cm x-dimension of layer %2d\n", -3.5 * DetectorSizeX[1], 3.5 * DetectorSizeX[1], PlaneId[iLayer]); ! else if (PlaneId[iLayer] < 9) ! fprintf(ifile,"%5d cm to %5d cm x-dimension of layer %2d\n", -4.5 * DetectorSizeX[1], 4.5 * DetectorSizeX[1], PlaneId[iLayer]); ! else ! fprintf(ifile,"%5d cm to %5d cm x-dimension of layer %2d\n", -5.5 * DetectorSizeX[1], 5.5 * DetectorSizeX[1], PlaneId[iLayer]); fprintf(ifile,"\n"); // Dimensions in y fprintf(ifile,"# dimensions in y\n"); for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) if (ShowLayer[iLayer]) if (PlaneId[iLayer] < 5) ! fprintf(ifile,"%5d cm to %5d cm y-dimension of layer %2d\n", -2.5 * DetectorSizeY[1], 2.5 * DetectorSizeY[1], PlaneId[iLayer]); ! else if (PlaneId[iLayer] < 9) ! fprintf(ifile,"%5d cm to %5d cm y-dimension of layer %2d\n", -3.5 * DetectorSizeY[1], 3.5 * DetectorSizeY[1], PlaneId[iLayer]); ! else ! fprintf(ifile,"%5d cm to %5d cm y-dimension of layer %2d\n", -4.5 * DetectorSizeY[1], 4.5 * DetectorSizeY[1], PlaneId[iLayer]); fprintf(ifile,"\n"); // Show layer positions --- 785,818 ---- fprintf(ifile,"# dimensions in x\n"); for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) if (ShowLayer[iLayer]) + { if (PlaneId[iLayer] < 5) ! fprintf(ifile,"%5f cm to %5f cm x-dimension of layer %2d\n", -3.5 * DetectorSizeX[1], 3.5 * DetectorSizeX[1], PlaneId[iLayer]); ! else ! { ! if (PlaneId[iLayer] < 9) ! fprintf(ifile,"%5f cm to %5f cm x-dimension of layer %2d\n", -4.5 * DetectorSizeX[1], 4.5 * DetectorSizeX[1], PlaneId[iLayer]); ! else ! fprintf(ifile,"%5f cm to %5f cm x-dimension of layer %2d\n", -5.5 * DetectorSizeX[1], 5.5 * DetectorSizeX[1], PlaneId[iLayer]); ! } ! } fprintf(ifile,"\n"); // Dimensions in y fprintf(ifile,"# dimensions in y\n"); for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) if (ShowLayer[iLayer]) + { if (PlaneId[iLayer] < 5) ! fprintf(ifile,"%5f cm to %5f cm y-dimension of layer %2d\n", -2.5 * DetectorSizeY[1], 2.5 * DetectorSizeY[1], PlaneId[iLayer]); ! else ! { ! if (PlaneId[iLayer] < 9) ! fprintf(ifile,"%5f cm to %5f cm y-dimension of layer %2d\n", -3.5 * DetectorSizeY[1], 3.5 * DetectorSizeY[1], PlaneId[iLayer]); ! else ! fprintf(ifile,"%5f cm to %5f cm y-dimension of layer %2d\n", -4.5 * DetectorSizeY[1], 4.5 * DetectorSizeY[1], PlaneId[iLayer]); ! } ! } fprintf(ifile,"\n"); // Show layer positions *************** *** 806,812 **** for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) { if (ShowLayer[iLayer]) ! fprintf(ifile,"%5d cm z-position of layer %2d\n", LayerPosition[iLayer], PlaneId[iLayer]); } fprintf(ifile,"\n"); --- 820,826 ---- for (Int_t iLayer = 0; iLayer < MaxLayers; iLayer++) { if (ShowLayer[iLayer]) ! fprintf(ifile,"%5f cm z-position of layer %2d\n", LayerPosition[iLayer], PlaneId[iLayer]); } fprintf(ifile,"\n"); *************** *** 1682,1687 **** --- 1696,1702 ---- if (IncludeAsics) { + TGeoHMatrix *incline_asic; // put many ASICs on each inclined FEB TGeoBBox* trd_asic = new TGeoBBox("", asic_width/2., asic_thickness/2., asic_width/2.); // ASIC dimensions // TODO: use Silicon as ASICs material *************** *** 1708,1714 **** asic_pos_x = asic_pos * activeAreaX; // trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2., 0.); // move asic on top of FEB trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! TGeoHMatrix *incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, iAsic+1, incline_asic); // now we have ASICs on the inclined FEB } --- 1723,1729 ---- asic_pos_x = asic_pos * activeAreaX; // trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2., 0.); // move asic on top of FEB trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, iAsic+1, incline_asic); // now we have ASICs on the inclined FEB } *************** *** 1721,1727 **** asic_pos_x = asic_pos * activeAreaX + (0.5 + asic_distance/2.) * asic_width; // trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2., 0.); // move asic on top of FEB trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB); ! TGeoHMatrix *incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 2*iAsic+1, incline_asic); // now we have ASICs on the inclined FEB --- 1736,1742 ---- asic_pos_x = asic_pos * activeAreaX + (0.5 + asic_distance/2.) * asic_width; // trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2., 0.); // move asic on top of FEB trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB); ! incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 2*iAsic+1, incline_asic); // now we have ASICs on the inclined FEB *************** *** 1729,1735 **** asic_pos_x = asic_pos * activeAreaX - (0.5 + asic_distance/2.) * asic_width; // trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2., 0.); // move asic on top of FEB trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! TGeoHMatrix *incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 2*iAsic+2, incline_asic); // now we have ASICs on the inclined FEB } --- 1744,1750 ---- asic_pos_x = asic_pos * activeAreaX - (0.5 + asic_distance/2.) * asic_width; // trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2., 0.); // move asic on top of FEB trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 2*iAsic+2, incline_asic); // now we have ASICs on the inclined FEB } *************** *** 1741,1761 **** // ASIC 1 asic_pos_x = asic_pos * activeAreaX + 1.1 * asic_width; // (0.5 + asic_distance/2.) * asic_width; trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB); ! TGeoHMatrix *incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 3*iAsic+1, incline_asic); // now we have ASICs on the inclined FEB // ASIC 2 asic_pos_x = asic_pos * activeAreaX; trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! TGeoHMatrix *incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 3*iAsic+2, incline_asic); // now we have ASICs on the inclined FEB // ASIC 3 asic_pos_x = asic_pos * activeAreaX - 1.1 * asic_width; // (0.5 + asic_distance/2.) * asic_width; trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! TGeoHMatrix *incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 3*iAsic+3, incline_asic); // now we have ASICs on the inclined FEB } --- 1756,1776 ---- // ASIC 1 asic_pos_x = asic_pos * activeAreaX + 1.1 * asic_width; // (0.5 + asic_distance/2.) * asic_width; trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB); ! incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 3*iAsic+1, incline_asic); // now we have ASICs on the inclined FEB // ASIC 2 asic_pos_x = asic_pos * activeAreaX; trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 3*iAsic+2, incline_asic); // now we have ASICs on the inclined FEB // ASIC 3 asic_pos_x = asic_pos * activeAreaX - 1.1 * asic_width; // (0.5 + asic_distance/2.) * asic_width; trd_asic_trans1 = new TGeoTranslation("", asic_pos_x, feb_thickness/2.+asic_thickness/2.+asic_offset, 0.); // move asic on top of FEB ! incline_asic = new TGeoHMatrix(""); (*incline_asic) = (*trd_asic_trans1) * (*incline_feb); trd_feb_box->AddNode(trdmod1_asic, 3*iAsic+3, incline_asic); // now we have ASICs on the inclined FEB } *************** *** 1917,1930 **** Int_t* outerLayer; if ( 1 == layerType ) { ! innerLayer = layer1i; ! outerLayer = layer1o; } else if ( 2 == layerType ) { ! innerLayer = layer2i; ! outerLayer = layer2o; } else if ( 3 == layerType ) { ! innerLayer = layer3i; ! outerLayer = layer3o; } else { std::cout << "Type of layer not known" << std::endl; } --- 1932,1945 ---- Int_t* outerLayer; if ( 1 == layerType ) { ! innerLayer = (Int_t*) layer1i; ! outerLayer = (Int_t*) layer1o; } else if ( 2 == layerType ) { ! innerLayer = (Int_t*) layer2i; ! outerLayer = (Int_t*) layer2o; } else if ( 3 == layerType ) { ! innerLayer = (Int_t*) layer3i; ! outerLayer = (Int_t*) layer3o; } else { std::cout << "Type of layer not known" << std::endl; } *************** *** 2481,2487 **** } ! add_trd_labels(TGeoVolume* trdbox1, TGeoVolume* trdbox2, TGeoVolume* trdbox3) { // write TRD (the 3 characters) in a simple geometry TGeoMedium* textVolMed = gGeoMan->GetMedium(TextVolumeMedium); --- 2496,2502 ---- } ! void add_trd_labels(TGeoVolume* trdbox1, TGeoVolume* trdbox2, TGeoVolume* trdbox3) { // write TRD (the 3 characters) in a simple geometry TGeoMedium* textVolMed = gGeoMan->GetMedium(TextVolumeMedium);