12 #include<TGeoMatrix.h> 
   14 #include <TGeoPhysicalNode.h> 
   29         double test_mult_fact = 1.; 
 
  220         nav_paths.push_back(
"LumActivePixelRect"); 
 
  222         fgGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
 
  224                 cout << 
"Error: could not find the geometry manager!" << endl;
 
  229                 cout << 
" fix for pedantic compiler will never appear on cout " << endl;
 
  234         cout << 
" Cleaning up PndLmdDim " << endl;
 
  236         << 
" If you see that message several times please check the performance of your code! " 
  273 #include<FairGeoLoader.h> 
  274 #include<FairGeoInterface.h> 
  275 #include<FairGeoMedia.h> 
  276 #include<FairGeoBuilder.h> 
  277 #include<TGeoTorus.h> 
  278 #include<TGeoSphere.h> 
  280 #include<TGeoCompositeShape.h> 
  283 #include <TGeoPcon.h> 
  289         TGeoManager* 
gGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
 
  291                 cout << 
" Info: no FAIRGeom found, using gGeoManager " << endl;
 
  298                 TGeoVolume* vol = gGeoMan->FindVolumeFast(
nav_paths[0].c_str());
 
  301                         string sversion = vol->GetTitle();
 
  302                         if (sversion.compare(0, 8, 
"version ") != 0) {
 
  304                                 << 
" Warning from PndLmdDim::Retrieve_version_number: no version number encoded in the node title. Setting it to 0. " 
  312                         << 
" Info from PndLmdDim::Retrieve_version_number: The geometry version was set to " 
  317                         cout << 
" *** Error in PndLmdDim::Retrieve_version_number:" << endl;
 
  318                         cout << 
" Could not find the top volume " << 
nav_paths[0].c_str()
 
  319                                                         << 
" to retrieve the version number of the luminosity detector! Is the geometry already loaded? " 
  323                 cout << 
" *** Error in PndLmdDim::Retrieve_version_number:" << endl;
 
  325                 << 
" Could not find a GeoManager to retrieve the version number of the luminosity detector! " 
  333         FairGeoLoader* 
geoLoad = FairGeoLoader::Instance();
 
  335                 geoLoad = 
new FairGeoLoader(
"TGeo", 
"FairGeoLoader");
 
  336                 cout << 
" creating FairGeoLoader instance " << endl;
 
  338         FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
 
  339         string dir = getenv(
"VMCWORKDIR");
 
  340         geoFace->setMediaFile((dir + 
"/geometry/media_pnd.geo").c_str());       
 
  341         geoFace->readMedia();
 
  344         FairGeoMedia *
Media = geoFace->getMedia();
 
  345         FairGeoBuilder *
geobuild = geoLoad->getGeoBuilder();
 
  349         FairGeoMedium* FairMediumSteel = Media->getMedium(
"steel");
 
  350         FairGeoMedium* FairMediumAl = Media->getMedium(
"Aluminum");
 
  351         FairGeoMedium *FairMediumSilicon = Media->getMedium(
"silicon");
 
  352         FairGeoMedium *FairMediumDiamond = Media->getMedium(
"HYPdiamond");
 
  354         FairGeoMedium *FairMediumKapton = Media->getMedium(
"kapton");
 
  355         FairGeoMedium *FairMediumCopper = Media->getMedium(
"copper");
 
  357         if (!FairMediumAir || !FairMediumSteel || !FairMediumAl || !FairMediumKapton
 
  358                         || !FairMediumSilicon || !FairMediumVacuum || !FairMediumCopper) {
 
  359                 std::cout << 
" Error: not all media found " << std::endl;
 
  364         nmed = geobuild->createMedium(FairMediumAir);
 
  365         nmed = geobuild->createMedium(FairMediumSteel);
 
  366         nmed = geobuild->createMedium(FairMediumAl);
 
  367         nmed = geobuild->createMedium(FairMediumKapton);
 
  368         nmed = geobuild->createMedium(FairMediumSilicon);
 
  369         nmed = geobuild->createMedium(FairMediumDiamond);
 
  370         nmed = geobuild->createMedium(FairMediumVacuum);
 
  372                 cout << 
" fix for pedantic compiler line " << endl;
 
  375         TGeoRotation* rot_no = 
new TGeoRotation(
"rot_no", 0., 0., 0.); 
 
  376         TGeoTranslation* trans_no = 
new TGeoTranslation(
"trans_no", 0., 0., 0.); 
 
  377         TGeoCombiTrans* rottrans_no = 
new TGeoCombiTrans(
"rottrans_no", 0., 0., 0.,
 
  379         rottrans_no->RegisterYourself();
 
  383         double tube_upstream_length = 33.3 / 2.;
 
  384         double tube_upstream_rad_in = 10.;
 
  385         double tube_upstream_rad_out = tube_upstream_rad_in + 0.2;
 
  386         double tube_dostream_length = 12. / 2.; 
 
  389         double lmd_total_length = 
box_size_z + tube_upstream_length
 
  390                         + tube_dostream_length;
 
  392         double origin[3] = { 0., 0., lmd_total_length };
 
  394                         lmd_total_length, origin);
 
  395         TGeoVolume *lmd_vol_vac = 
new TGeoVolume(
nav_paths[0].c_str(), lmd_box_vac,
 
  398         lmd_vol_vac->SetLineColor(3);
 
  399         double x, 
y, 
z, rottheta, rotphi, rotpsi;
 
  401         TGeoRotation* lmd_rot = 
new TGeoRotation(
"lmd_rot");
 
  402         lmd_rot->RotateX(rottheta / 
pi * 180.);
 
  403         lmd_rot->RotateY(rotphi / 
pi * 180.);
 
  404         lmd_rot->RotateZ(rotpsi / 
pi * 180.);
 
  405         TGeoCombiTrans* lmd_transrot = 
new TGeoCombiTrans(x, y, z, lmd_rot);
 
  406         lmd_transrot->SetName(
"lmd_transrot");
 
  407         lmd_transrot->RegisterYourself();
 
  409         TGeoTube* pipe_upstream = 
new TGeoTube(
"pipe_upstream", tube_upstream_rad_in,
 
  410                         tube_upstream_rad_out, tube_upstream_length);
 
  411         TGeoCombiTrans* comb_trans_pipe_upstream = 
new TGeoCombiTrans(
 
  412                         "comb_trans_pipe_upstream", 0., 0., tube_upstream_length, rot_no);
 
  414         TGeoVolume* lmd_vol_pipe_up = 
new TGeoVolume(
"lmd_vol_pipe_up", pipe_upstream,
 
  416         lmd_vol_pipe_up->SetLineColor(11);
 
  417         lmd_vol_vac->AddNode(lmd_vol_pipe_up, 0, comb_trans_pipe_upstream);
 
  419         TGeoBBox* lmd_box_outer = 
new TGeoBBox(
"lmd_box_outer", 
box_size_x,
 
  421         TGeoBBox* lmd_box_inner = 
new TGeoBBox(
"lmd_box_inner",
 
  424         TGeoBBox* lmd_box_rib = 
new TGeoBBox(
"lmd_box_rib",
 
  427         TGeoTube* box_hole_upstream = 
new TGeoTube(
"box_hole_upstream", 0.0,
 
  430         TGeoCombiTrans* comb_trans_cut_pipe_upstream = 
new TGeoCombiTrans(
 
  433         comb_trans_cut_pipe_upstream->RegisterYourself();
 
  434         TGeoTube* box_hole_downstream = 
new TGeoTube(
"box_hole_downstream", 0.0,
 
  437         TGeoCombiTrans* comb_trans_cut_pipe_downstream = 
new TGeoCombiTrans(
 
  438                         "comb_trans_cut_pipe_downstream", 0., 0.,
 
  440         comb_trans_cut_pipe_downstream->RegisterYourself();
 
  442         TGeoCombiTrans* comb_trans_rib = 
new TGeoCombiTrans(
"comb_trans_rib", 0., 0.,
 
  444         comb_trans_rib->RegisterYourself();
 
  446         double clash_rod_x = 3.;
 
  447         double clash_rod_y = 0.5;
 
  448         double clash_rod_z = 29.75;
 
  449         double origin_left[3] =
 
  451         new TGeoBBox(
"lmd_box_clash_rod_left",
 
  452                         clash_rod_x, clash_rod_y, clash_rod_z, origin_left);
 
  455         new TGeoBBox(
"lmd_box_clash_rod_right",
 
  456                         clash_rod_x, clash_rod_y, clash_rod_z, origin_right);
 
  458         TGeoCompositeShape *shape_lmd_box =
 
  459                         new TGeoCompositeShape(
"shape_lmd_box",
 
  460                                         "(lmd_box_outer-lmd_box_inner + ((lmd_box_rib-box_hole_upstream):comb_trans_rib))" 
  461                                         "-box_hole_upstream:comb_trans_cut_pipe_upstream" 
  462                                         "-box_hole_downstream:comb_trans_cut_pipe_downstream" 
  463                                         "+lmd_box_clash_rod_left+lmd_box_clash_rod_right");
 
  464         TGeoVolume *lmd_vol_box = 
new TGeoVolume(
"lmd_vol_box", shape_lmd_box,
 
  466         lmd_vol_box->SetLineColor(11);
 
  469         TGeoCombiTrans* comb_trans_lmd_box = 
new TGeoCombiTrans(
"comb_trans_lmd_box",
 
  470                         0., 0., 2 * tube_upstream_length + 
box_size_z, rot_no);
 
  472         lmd_vol_vac->AddNode(lmd_vol_box, 0, comb_trans_lmd_box);
 
  475         double lmd_pipe_box_do[18];
 
  476         lmd_pipe_box_do[0] = 0.;
 
  477         lmd_pipe_box_do[1] = 360.;
 
  478         lmd_pipe_box_do[2] = 4.;
 
  480         lmd_pipe_box_do[3] = 
box_size_z * 2. + tube_upstream_length * 2.;
 
  481         lmd_pipe_box_do[4] = 
rad_exit - 0.2;
 
  484         lmd_pipe_box_do[6] = lmd_pipe_box_do[3] + tube_dostream_length * 2. - 4.;
 
  485         lmd_pipe_box_do[7] = lmd_pipe_box_do[4];
 
  486         lmd_pipe_box_do[8] = lmd_pipe_box_do[5];
 
  488         lmd_pipe_box_do[9] = lmd_pipe_box_do[6];
 
  489         lmd_pipe_box_do[10] = lmd_pipe_box_do[4];
 
  490         lmd_pipe_box_do[11] = 7.;
 
  492         lmd_pipe_box_do[12] = lmd_pipe_box_do[3] + tube_dostream_length * 2.;
 
  493         lmd_pipe_box_do[13] = lmd_pipe_box_do[10];
 
  494         lmd_pipe_box_do[14] = lmd_pipe_box_do[11];
 
  500         TGeoPcon* shape_pipe_box_do = 
new TGeoPcon(lmd_pipe_box_do);
 
  501         TGeoVolume* vlum_pipe_box_do = 
new TGeoVolume(
"vlum_pipe_box_do",
 
  502                         shape_pipe_box_do, 
fgGeoMan->GetMedium(
"steel"));
 
  503         vlum_pipe_box_do->SetLineColor(kGray);  
 
  504         TGeoCombiTrans* lmd_trans_pipe_box_do = 
new TGeoCombiTrans(
 
  505                         "lmd_trans_pipe_box_do", 0., 0., 0., rot_no);
 
  506         lmd_trans_pipe_box_do->RegisterYourself();
 
  507         lmd_vol_vac->AddNode(vlum_pipe_box_do, 0, lmd_trans_pipe_box_do);
 
  522         double debug_multiplier = 1.;
 
  524         double box_inner_up_z = 2 * tube_upstream_length + 
box_thickness;
 
  527         double lmd_cone_clamp_length = 13.;
 
  528         double lmd_cone_clamp_params[15];
 
  529         lmd_cone_clamp_params[0] = 0.;
 
  530         lmd_cone_clamp_params[1] = 360.;
 
  531         lmd_cone_clamp_params[2] = 4.;
 
  535         lmd_cone_clamp_params[3] = 0.;
 
  536         lmd_cone_clamp_params[4] = 20. / 2.;
 
  537         lmd_cone_clamp_params[5] = 20.4 / 2.;
 
  539         lmd_cone_clamp_params[6] = 10.;
 
  540         lmd_cone_clamp_params[7] = 20. / 2.;
 
  541         lmd_cone_clamp_params[8] = 20.4 / 2.;
 
  543         lmd_cone_clamp_params[9] = 10.;
 
  544         lmd_cone_clamp_params[10] = 20. / 2.;
 
  545         lmd_cone_clamp_params[11] = 26. / 2.;
 
  547         lmd_cone_clamp_params[12] = lmd_cone_clamp_length;
 
  548         lmd_cone_clamp_params[13] = 20. / 2.;
 
  549         lmd_cone_clamp_params[14] = 26. / 2.;
 
  551         TGeoPcon* lmd_cone_clamp = 
new TGeoPcon(lmd_cone_clamp_params);
 
  552         TGeoVolume* vlum_cone_clamp = 
new TGeoVolume(
"vlum_cone_clamp",
 
  553                         lmd_cone_clamp, 
fgGeoMan->GetMedium(
"steel"));
 
  554         vlum_cone_clamp->SetLineColor(kGray);   
 
  555         TGeoCombiTrans* lmd_trans_lmd_cone_clamp = 
new TGeoCombiTrans(
 
  556                         "lmd_trans_lmd_cone_clamp", 0., 0., box_inner_up_z, rot_no);
 
  557         lmd_trans_lmd_cone_clamp->RegisterYourself();
 
  558         lmd_vol_vac->AddNode(vlum_cone_clamp, 0, lmd_trans_lmd_cone_clamp);
 
  587         double cALthick = 0.001 * debug_multiplier;
 
  589         double cpolthick = 0.002 * debug_multiplier;
 
  591         double tbrthick = 0.05;
 
  593         double tA2thick = 0.05;
 
  594         double cone_angle = 15. / 180. * 3.1416;
 
  596         double cALdiy = 7. / 2.;
 
  598         double cALdoy = cALdiy + cALthick / 
cos(cone_angle);
 
  599         double cALdoz = cALdiz;
 
  600         double cpoldiy = cALdoy;
 
  601         double cpoldiz = cALdoz;
 
  602         double cpoldoy = cpoldiy + cpolthick / 
cos(cone_angle);
 
  603         double cpoldoz = cpoldiz;
 
  604         double cbrdoy = cALdiy;
 
  605         double cbrdoz = cALdiz;
 
  606         double cbrdiy = cbrdoy - tbrthick; 
 
  607         double cbrdiz = cbrdoz;
 
  609         double cALuiz = lmd_cone_clamp_length;
 
  610         double cALuiy = cALdiy + (cALdiz - cALuiz) * tan(cone_angle);
 
  611         double cALuoy = cALuiy + cALthick / 
cos(cone_angle);
 
  612         double cALuoz = cALuiz;
 
  613         double cpoluiy = cALuoy;
 
  614         double cpoluiz = cALuoz;
 
  615         double cpoluoy = cpoluiy + cpolthick / 
cos(cone_angle);
 
  616         double cpoluoz = cpoluiz;
 
  618         double cbruoz = cbrdiz - 0.5;
 
  619         double cbruoy = cbrdoy + 0.5 * tan(cone_angle);
 
  620         double cbruiz = cbruoz;
 
  621         double cbruiy = cbruoy - tbrthick; 
 
  623         double cA2diy = cALdiy;
 
  624         double cA2diz = cpoldoz + (cpoldoy - cALdiy) / tan(cone_angle);
 
  625         double cA2uiz = cA2diz - 0.1 / tan(cone_angle);
 
  626         double cA2uiy = cA2diy + 0.1;
 
  627         double cA2uoy = cA2uiy + tA2thick;
 
  629         double cA2doy = cA2diy + tA2thick;
 
  632         double tbruiz = cbrdiz;
 
  633         double tbruiy = cbrdiy;
 
  635         double tbruoy = cbrdoy;
 
  637         double tbrdiz = tbruiz + 2.;
 
  638         double tbrdiy = tbruiy;
 
  640         double tbrdoy = tbruoy;
 
  643         double tA2uoy = cA2doy;
 
  644         double tA2uiz = cA2diz;
 
  645         double tA2uiy = cA2diy;
 
  647         double tA2diz = tA2uiz + 44.;
 
  648         double tA2diy = tA2uiy;
 
  650         double tA2doy = tA2uoy;
 
  652         TGeoCone* lmd_capton_cone = 
new TGeoCone(
"lmd_capton_cone",
 
  653                         (cpoldoz - cpoluoz) / 2., cpoluiy, cpoluoy, cpoldiy, cpoldoy);
 
  654         TGeoCombiTrans* lmd_trans_cap_co = 
new TGeoCombiTrans(
"lmd_trans_cap_co", 0.,
 
  655                         0., box_inner_up_z + (cpoldoz - cpoluoz) / 2. + cpoluoz, rot_no);
 
  656         lmd_trans_cap_co->RegisterYourself();
 
  657         TGeoVolume *vlum_CaptonCone = 
new TGeoVolume(
"vlum_CaptonCone",
 
  658                         lmd_capton_cone, 
fgGeoMan->GetMedium(
"kapton"));
 
  659         vlum_CaptonCone->SetLineColor(kRed); 
 
  660         lmd_vol_vac->AddNode(vlum_CaptonCone, 0, lmd_trans_cap_co); 
 
  663         TGeoCone* lmd_al_cone = 
new TGeoCone(
"lmd_al_cone", (cALdiz - cALuiz) / 2.,
 
  664                         cALuiy, cALuoy, cALdiy, cALdoy);
 
  665         TGeoVolume *vlum_AlCone = 
new TGeoVolume(
"vlum_AlCone", lmd_al_cone,
 
  667         vlum_AlCone->SetLineColor(kGray); 
 
  668         lmd_vol_vac->AddNode(vlum_AlCone, 0, lmd_trans_cap_co); 
 
  670         double lmd_pipe_params[36];
 
  671         lmd_pipe_params[0] = 0.;
 
  672         lmd_pipe_params[1] = 360.;
 
  673         lmd_pipe_params[2] = 11.;
 
  675         lmd_pipe_params[3] = cA2uiz;
 
  676         lmd_pipe_params[4] = cA2uiy;
 
  677         lmd_pipe_params[5] = cA2uoy;
 
  679         lmd_pipe_params[6] = cA2diz;
 
  680         lmd_pipe_params[7] = cA2diy;
 
  681         lmd_pipe_params[8] = cA2doy;
 
  683         lmd_pipe_params[9] = tA2diz;
 
  684         lmd_pipe_params[10] = tA2diy;
 
  685         lmd_pipe_params[11] = tA2doy;
 
  687         lmd_pipe_params[12] = 0 + lmd_pipe_params[9];
 
  688         lmd_pipe_params[13] = 3.5;
 
  689         lmd_pipe_params[14] = 4.05;
 
  691         lmd_pipe_params[15] = 1.5 + lmd_pipe_params[9];
 
  692         lmd_pipe_params[16] = 3.5;
 
  693         lmd_pipe_params[17] = 4.05;
 
  695         lmd_pipe_params[18] = 3.5 + lmd_pipe_params[9];
 
  696         lmd_pipe_params[19] = 4.2;
 
  697         lmd_pipe_params[20] = 6.;
 
  699         lmd_pipe_params[21] = 10. + lmd_pipe_params[9];
 
  700         lmd_pipe_params[22] = 4.2;
 
  701         lmd_pipe_params[23] = 6.;
 
  703         lmd_pipe_params[24] = 10. + lmd_pipe_params[9];
 
  704         lmd_pipe_params[25] = 4.2;
 
  705         lmd_pipe_params[26] = 4.55;
 
  707         lmd_pipe_params[27] = 20. + lmd_pipe_params[9];
 
  708         lmd_pipe_params[28] = 4.2;
 
  709         lmd_pipe_params[29] = 4.55;
 
  711         lmd_pipe_params[30] = 20. + lmd_pipe_params[9];
 
  712         lmd_pipe_params[31] = 4.2;
 
  713         lmd_pipe_params[32] = 4.55; 
 
  715         lmd_pipe_params[33] = 22 + lmd_pipe_params[9];
 
  716         lmd_pipe_params[34] = 4.2;
 
  717         lmd_pipe_params[35] = 4.55; 
 
  719         TGeoPcon* lmd_V2_pipe = 
new TGeoPcon(lmd_pipe_params);
 
  720         TGeoVolume* vlum_V2_pipe = 
new TGeoVolume(
"vlum_V2_pipe", lmd_V2_pipe,
 
  722         vlum_V2_pipe->SetLineColor(kGray); 
 
  723         TGeoCombiTrans* lmd_trans_lmd_V2_pipe = 
new TGeoCombiTrans(
 
  724                         "lmd_trans_lmd_V2_pipe", 0., 0., box_inner_up_z, rot_no);
 
  725         lmd_trans_lmd_V2_pipe->RegisterYourself();
 
  726         lmd_vol_vac->AddNode(vlum_V2_pipe, 0, lmd_trans_lmd_V2_pipe);
 
  728         double lmd_conductor_params[12];
 
  729         lmd_conductor_params[0] = 0.;
 
  730         lmd_conductor_params[1] = 360.;
 
  731         lmd_conductor_params[2] = 3.;
 
  733         lmd_conductor_params[3] = cbruiz;
 
  734         lmd_conductor_params[4] = cbruiy;
 
  735         lmd_conductor_params[5] = cbruoy;
 
  737         lmd_conductor_params[6] = cbrdiz;
 
  738         lmd_conductor_params[7] = cbrdiy;
 
  739         lmd_conductor_params[8] = cbrdoy;
 
  741         lmd_conductor_params[9] = tbrdiz;
 
  742         lmd_conductor_params[10] = tbrdiy;
 
  743         lmd_conductor_params[11] = tbrdoy;
 
  745         TGeoPcon* lmd_cond_ring = 
new TGeoPcon(lmd_conductor_params);
 
  746         TGeoVolume* vlum_cond_ring = 
new TGeoVolume(
"vlum_cond_ring", lmd_cond_ring,
 
  748         vlum_cond_ring->SetLineColor(kYellow); 
 
  749         TGeoCombiTrans* lmd_trans_lmd_cond_ring = 
new TGeoCombiTrans(
 
  750                         "lmd_trans_lmd_cond_ring", 0., 0., box_inner_up_z, rot_no);
 
  751         lmd_trans_lmd_cond_ring->RegisterYourself();
 
  752         lmd_vol_vac->AddNode(vlum_cond_ring, 0, lmd_trans_lmd_cond_ring);
 
  768         TGeoCombiTrans* rottrans_lmd_in_box = 
new TGeoCombiTrans(
 
  769                         "rottrans_lmd_in_box", 0., 0., 
pos_plane_0, rot_no);
 
  770         TGeoVolumeAssembly* lmd_vol_ref_sys = 
new TGeoVolumeAssembly(
 
  777         double lmd_cool_sup_inner_rad = 10.6;
 
  778         double lmd_cool_sup_outer_rad = 16.;
 
  779         double lmd_cool_sup_outer_cut = 14.;
 
  780         double lmd_cool_sup_thick = 1.; 
 
  783         new TGeoTube(
"shape_cool_sup_tube",
 
  784                         lmd_cool_sup_inner_rad, lmd_cool_sup_outer_rad, lmd_cool_sup_thick);
 
  786         new TGeoBBox(
"shape_cool_sup_cut",
 
  787                         lmd_cool_sup_outer_rad, lmd_cool_sup_outer_rad, lmd_cool_sup_thick + 0.1);
 
  789         TGeoTranslation* trans_shape_cool_sup_cut_low = 
new TGeoTranslation(
 
  790                         "trans_shape_cool_sup_cut_low", 0., -lmd_cool_sup_outer_rad + 0.5, 0.); 
 
  791         TGeoCombiTrans* combtrans_shape_cool_sup_cut_low = 
new TGeoCombiTrans(
 
  792                         *trans_shape_cool_sup_cut_low, *rot_no);
 
  793         combtrans_shape_cool_sup_cut_low->SetName(
"combtrans_shape_cool_sup_cut_low");
 
  794         combtrans_shape_cool_sup_cut_low->RegisterYourself();
 
  796         TGeoTranslation* trans_shape_cool_sup_cut_high = 
new TGeoTranslation(
 
  797                         "trans_shape_cool_sup_cut_high", 0., +lmd_cool_sup_outer_rad - 0.5, 0.); 
 
  798         TGeoCombiTrans* combtrans_shape_cool_sup_cut_high = 
new TGeoCombiTrans(
 
  799                         *trans_shape_cool_sup_cut_high, *rot_no);
 
  800         combtrans_shape_cool_sup_cut_high->SetName(
 
  801                         "combtrans_shape_cool_sup_cut_high");
 
  802         combtrans_shape_cool_sup_cut_high->RegisterYourself();
 
  806         new TGeoTube(
"shape_module_cutout", 0.,
 
  809         for (
size_t imodule = 0; imodule < 
nmodules * 2 ;
 
  815                 if (((imodule) % 2) == 0)
 
  819                 TGeoTranslation* trans_shape_module_cutout = 
new TGeoTranslation(_x, _y,
 
  821                 TGeoCombiTrans* combtrans_shape_module_cutout = 
new TGeoCombiTrans(
 
  822                                 *trans_shape_module_cutout, *rot_no);
 
  823                 stringstream _cutout_name;
 
  824                 _cutout_name << 
"rottrans_cutout_" << imodule;
 
  825                 combtrans_shape_module_cutout->SetName(_cutout_name.str().c_str());
 
  826                 combtrans_shape_module_cutout->RegisterYourself();
 
  828                 _x = 
cos(angle) * (lmd_cool_sup_outer_cut + lmd_cool_sup_outer_rad);
 
  829                 _y = 
sin(angle) * (lmd_cool_sup_outer_cut + lmd_cool_sup_outer_rad);
 
  830                 TGeoTranslation* trans_cool_sup_cut_outer = 
new TGeoTranslation(_x, _y, 0.);
 
  831                 stringstream _cutshape_rot_name;
 
  832                 _cutshape_rot_name << 
"cutshaperot_" << imodule;
 
  833                 TGeoRotation* rot_cool_sup_cut_outer = 
new TGeoRotation(
 
  834                                 _cutshape_rot_name.str().c_str(), angle / 
pi * 180., 0., 0.);
 
  835                 TGeoCombiTrans* combtrans_cool_sup_cut_outer = 
new TGeoCombiTrans(
 
  836                                 *trans_cool_sup_cut_outer, *rot_cool_sup_cut_outer);
 
  837                 stringstream _cutshape_name;
 
  838                 _cutshape_name << 
"cutshape_" << imodule;
 
  839                 combtrans_cool_sup_cut_outer->SetName(_cutshape_name.str().c_str());
 
  840                 combtrans_cool_sup_cut_outer->RegisterYourself();
 
  844         TGeoCompositeShape *shape_cool_sup_up = 
new TGeoCompositeShape(
 
  846                         "shape_cool_sup_tube-shape_cool_sup_cut:combtrans_shape_cool_sup_cut_low" 
  847                         "-shape_module_cutout:rottrans_cutout_0" 
  848                         "-shape_module_cutout:rottrans_cutout_1" 
  849                         "-shape_module_cutout:rottrans_cutout_2" 
  850                         "-shape_module_cutout:rottrans_cutout_3" 
  851                         "-shape_module_cutout:rottrans_cutout_4" 
  852                         "-shape_cool_sup_cut:cutshape_0" 
  853                         "-shape_cool_sup_cut:cutshape_1" 
  854                         "-shape_cool_sup_cut:cutshape_2" 
  855                         "-shape_cool_sup_cut:cutshape_3" 
  856                         "-shape_cool_sup_cut:cutshape_4");
 
  858         TGeoVolume* lmd_vol_cool_sup_up = 
new TGeoVolume(
"lmd_vol_cool_sup_up",
 
  859                         shape_cool_sup_up, 
fgGeoMan->GetMedium(
"Aluminum"));
 
  860         lmd_vol_cool_sup_up->SetLineColor(17);
 
  863         TGeoRotation* rot_shape_cool_sup_down = 
new TGeoRotation(
 
  864                         "rot_shape_cool_sup_down", 180., 180., 0.);
 
  865         TGeoCombiTrans* combtrans_shape_cool_sup_down = 
new TGeoCombiTrans(*trans_no,
 
  866                         *rot_shape_cool_sup_down);
 
  867         combtrans_shape_cool_sup_down->SetName(
"combtrans_shape_cool_sup_down");
 
  868         combtrans_shape_cool_sup_down->RegisterYourself();
 
  870         TGeoCompositeShape *shape_cool_sup_down = 
new TGeoCompositeShape(
 
  871                         "shape_cool_sup_down",
 
  872                         "shape_cool_sup_tube-shape_cool_sup_cut:combtrans_shape_cool_sup_cut_high" 
  873                         "-shape_module_cutout:rottrans_cutout_5" 
  874                         "-shape_module_cutout:rottrans_cutout_6" 
  875                         "-shape_module_cutout:rottrans_cutout_7" 
  876                         "-shape_module_cutout:rottrans_cutout_8" 
  877                         "-shape_module_cutout:rottrans_cutout_9" 
  878                         "-shape_cool_sup_cut:cutshape_5" 
  879                         "-shape_cool_sup_cut:cutshape_6" 
  880                         "-shape_cool_sup_cut:cutshape_7" 
  881                         "-shape_cool_sup_cut:cutshape_8" 
  882                         "-shape_cool_sup_cut:cutshape_9");
 
  884         TGeoVolume* lmd_vol_cool_sup_down = 
new TGeoVolume(
"lmd_vol_cool_sup_down",
 
  885                         shape_cool_sup_down, 
fgGeoMan->GetMedium(
"Aluminum"));
 
  886         lmd_vol_cool_sup_down->SetLineColor(17);
 
  890         double gap_between_disc_and_support_structure(0.025); 
 
  891         TGeoTubeSeg* shape_cvd_disc = 
new TGeoTubeSeg(
"shape_cvd_disc", 
inner_rad,
 
  892                         lmd_cool_sup_inner_rad - gap_between_disc_and_support_structure,
 
  896         TGeoRotation* cvd_rotation = 
new TGeoRotation(
"cvd_rotation", 0, 0, 0);
 
  897         TGeoTranslation* cvd_translation = 
new TGeoTranslation(
"cvd_translation",
 
  899         TGeoCombiTrans* cvd_combtrans = 
new TGeoCombiTrans(*cvd_translation,
 
  901         cvd_combtrans->SetName(
"cvd_combtrans");
 
  902         cvd_combtrans->RegisterYourself();
 
  906         TGeoCompositeShape *shape_cvd_support = 
new TGeoCompositeShape(
 
  908                         "(shape_cvd_disc:cvd_combtrans+shape_cvd_disc:cvd_combtrans)");
 
  910         TGeoVolume* lmd_vol_cvd_disc = 
new TGeoVolume(
"lmd_vol_cvd_disc",
 
  911                         shape_cvd_support, 
fgGeoMan->GetMedium(
"HYPdiamond"));
 
  912         lmd_vol_cvd_disc->SetLineColor(9);
 
  915         TGeoTubeSeg* shape_kapton_disc = 
new TGeoTubeSeg(
"shape_kapton_disc",
 
  917                         lmd_cool_sup_inner_rad - gap_between_disc_and_support_structure,
 
  921         TGeoRotation* kapton_rotation = 
new TGeoRotation(
"kapton_rotation", 0, 0, 0);
 
  922         TGeoTranslation* kapton_translation = 
new TGeoTranslation(
 
  924         TGeoCombiTrans* kapton_combtrans = 
new TGeoCombiTrans(*kapton_translation,
 
  926         kapton_combtrans->SetName(
"kapton_combtrans");
 
  927         kapton_combtrans->RegisterYourself();
 
  931         TGeoCompositeShape *shape_kapton_support =
 
  932                         new TGeoCompositeShape(
"shape_kapton_support",
 
  933                                         "(shape_kapton_disc:kapton_combtrans+shape_kapton_disc:kapton_combtrans)");
 
  935         TGeoVolume* lmd_vol_kapton_disc = 
new TGeoVolume(
"lmd_vol_kapton_disc",
 
  936                         shape_kapton_support, 
fgGeoMan->GetMedium(
"Aluminum")); 
 
  937         lmd_vol_kapton_disc->SetLineColor(kRed);
 
  939         lmd_vol_kapton_disc->SetVisibility(
false);
 
  943         TGeoBBox *shape_maps_active_centered = 
new TGeoBBox(
 
  946         TGeoCombiTrans* combtrans_maps_active = 
new TGeoCombiTrans(
 
  947                         "combtrans_maps_active",
 
  950         combtrans_maps_active->RegisterYourself();
 
  951         TGeoBBox *shape_maps_passive_left = 
new TGeoBBox(
"shape_maps_passive_left",
 
  953         TGeoCombiTrans* combtrans_maps_passive_left = 
new TGeoCombiTrans(
 
  956         combtrans_maps_passive_left->RegisterYourself();
 
  957         TGeoBBox *shape_maps_passive_right = 
new TGeoBBox(
"shape_maps_passive_right",
 
  959         TGeoCombiTrans* combtrans_maps_passive_right = 
new TGeoCombiTrans(
 
  962         combtrans_maps_passive_right->RegisterYourself();
 
  963         TGeoBBox *shape_maps_passive_top = 
new TGeoBBox(
"shape_maps_passive_top",
 
  965         TGeoCombiTrans* combtrans_maps_passive_top = 
new TGeoCombiTrans(
 
  968         combtrans_maps_passive_top->RegisterYourself();
 
  969         TGeoBBox *shape_maps_passive_bottom = 
new TGeoBBox(
 
  972         TGeoCombiTrans* combtrans_maps_passive_bottom = 
new TGeoCombiTrans(
 
  975         combtrans_maps_passive_bottom->RegisterYourself();
 
  977         if (!lmd_box_outer || !lmd_box_inner || !lmd_box_rib || !box_hole_upstream
 
  978                         || !box_hole_downstream || !shape_cvd_disc || !shape_kapton_disc
 
  979                         || !shape_maps_active_centered || !shape_maps_passive_left
 
  980                         || !shape_maps_passive_right || !shape_maps_passive_top
 
  981                         || !shape_maps_passive_bottom)
 
  982                 cout << 
" pedantic compiler together with root geometries sucks " << endl;
 
  984         TGeoCompositeShape *shape_maps_passive =
 
  985                         new TGeoCompositeShape(
"shape_maps_passive",
 
  986                                         "(shape_maps_passive_top:combtrans_maps_passive_top+shape_maps_passive_right:combtrans_maps_passive_right+shape_maps_passive_bottom:combtrans_maps_passive_bottom+shape_maps_passive_left:combtrans_maps_passive_left)");
 
  988         TGeoCompositeShape *shape_maps_active = 
new TGeoCompositeShape(
 
  990                         "(shape_maps_active_centered:combtrans_maps_active-shape_maps_passive)");
 
  992         TGeoVolume* _vol_passive = 
new TGeoVolume(
"LumPassiveRect",
 
  993                         shape_maps_passive, 
fgGeoMan->GetMedium(
"silicon"));
 
  994         _vol_passive->SetLineColor(30);
 
  996         TGeoVolume* _vol_active = 
new TGeoVolume(
nav_paths[7].c_str(),
 
  997                         shape_maps_active, 
fgGeoMan->GetMedium(
"silicon"));
 
  998         _vol_active->SetLineColor(36);
 
 1003         stringstream uniqueid; 
 
 1004         double _x(0), _y(0), _z(0), _rotphi(0), _rottheta(0), _rotpsi(0);
 
 1005         double _offset_x(0), _offset_y(0), _offset_z(0), _offset_phi(0),
 
 1006                         _offset_theta(0), _offset_psi(0);
 
 1007         unsigned int sensor_id(0);
 
 1008         unsigned int module_id(0);
 
 1009         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++) { 
 
 1016                 TGeoVolumeAssembly* lmd_vol_half_ = 
new TGeoVolumeAssembly(
 
 1017                                 name.str().c_str());
 
 1019                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++) { 
 
 1021                         name << nav_paths[3]; 
 
 1024                         TGeoVolumeAssembly* lmd_vol_plane_ = 
new TGeoVolumeAssembly(
 
 1025                                         (name.str() + uniqueid.str()).c_str());
 
 1027                         TGeoMatrix* rottrans_plane = 
new TGeoCombiTrans(0., 0.,
 
 1030                                 Get_offset(ihalf, iplane, -1, -1, -1, -1, _offset_x, _offset_y,
 
 1031                                                 _offset_z, _offset_phi, _offset_theta, _offset_psi, 
true);
 
 1032                                 TGeoRotation* rot_plane_offset = 
new TGeoRotation(
"rot_plane_offset",
 
 1033                                                 _offset_phi / 
pi * 180., _offset_theta / 
pi * 180.,
 
 1034                                                 _offset_psi / 
pi * 180.);
 
 1035                                 TGeoCombiTrans* rottrans_plane_offset = 
new TGeoCombiTrans(_offset_x,
 
 1036                                                 _offset_y, _offset_z, rot_plane_offset);
 
 1038                                 rottrans_plane = 
new TGeoHMatrix(
 
 1039                                                 *rottrans_plane_offset * *rottrans_plane);
 
 1041                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) { 
 
 1043                                 name << nav_paths[4]; 
 
 1046                                 TGeoVolumeAssembly* lmd_vol_module_ = 
new TGeoVolumeAssembly(
 
 1047                                                 (name.str() + uniqueid.str()).c_str());
 
 1052                                 if (((imodule + ihalf) % 2) == 0)
 
 1059                                 _rotpsi = angle / 
pi * 180.;
 
 1060                                 TGeoRotation* rot_module = 
new TGeoRotation(
"rot_module", _rotphi,
 
 1061                                                 _rottheta, _rotpsi);
 
 1062                                 TGeoMatrix* rottrans_module = 
new TGeoCombiTrans(_x, _y, _z,
 
 1065                                         Get_offset(ihalf, iplane, imodule, -1, -1, -1, _offset_x, _offset_y,
 
 1066                                                         _offset_z, _offset_phi, _offset_theta, _offset_psi, 
true);
 
 1067                                         TGeoRotation* rot_module_offset = 
new TGeoRotation(
 
 1068                                                         "rot_module_offset", _offset_phi / 
pi * 180.,
 
 1069                                                         _offset_theta / 
pi * 180., _offset_psi / 
pi * 180.);
 
 1070                                         TGeoCombiTrans* rottrans_module_offset = 
new TGeoCombiTrans(_offset_x,
 
 1071                                                         _offset_y, _offset_z, rot_module_offset);
 
 1072                                         rottrans_module = 
new TGeoHMatrix(
 
 1073                                                         *rottrans_module_offset * *rottrans_module);
 
 1086                                 lmd_vol_module_->AddNode(lmd_vol_cvd_disc, module_id, rottrans_no);
 
 1088                                 for (
unsigned int iside = 0; iside < 2; iside++) { 
 
 1090                                         name << nav_paths[5]; 
 
 1093                                         TGeoVolumeAssembly* lmd_vol_side_ = 
new TGeoVolumeAssembly(
 
 1094                                                         (name.str() + uniqueid.str()).c_str());
 
 1109                                         TGeoRotation* rot_side = 
new TGeoRotation(
"rot_side", _rotphi,
 
 1110                                                         _rottheta, _rotpsi);
 
 1111                                         TGeoMatrix* rottrans_side = 
new TGeoCombiTrans(_x, _y, _z, rot_side);
 
 1113                                                 Get_offset(ihalf, iplane, imodule, iside, -1, -1, _offset_x,
 
 1114                                                                 _offset_y, _offset_z, _offset_phi, _offset_theta, _offset_psi,
 
 1116                                                 TGeoRotation* rot_side_offset = 
new TGeoRotation(
"rot_side_offset",
 
 1117                                                                 _offset_phi / 
pi * 180., _offset_theta / 
pi * 180.,
 
 1118                                                                 _offset_psi / 
pi * 180.);
 
 1119                                                 TGeoCombiTrans* rottrans_side_offset = 
new TGeoCombiTrans(_offset_x,
 
 1120                                                                 _offset_y, _offset_z, rot_side_offset);
 
 1121                                                 rottrans_side = 
new TGeoHMatrix(
 
 1122                                                                 *rottrans_side_offset * *rottrans_side);
 
 1125                                         for (
unsigned int idie = 0; idie < 2; idie++) { 
 
 1129                                                 name << nav_paths[6];                                           
 
 1132                                                 TGeoVolumeAssembly* lmd_vol_die_ = 
new TGeoVolumeAssembly(
 
 1133                                                                 (name.str() + uniqueid.str()).c_str());
 
 1136                                                 const double _sinhalf = 
sin(delta_phi / 2.);
 
 1138                                                 const double _edge_y = +_sinhalf * 
inner_rad;
 
 1140                                                 const double _edgeangle = asin(-_edge_y / 
cvd_disc_rad);
 
 1145                                                 _rotphi = +delta_phi / 2. / 
pi * 180.;
 
 1148                                                 TGeoRotation* rot_die = 
new TGeoRotation(
"rot_die", _rotphi,
 
 1149                                                                 _rottheta, _rotpsi);
 
 1150                                                 TGeoCombiTrans* rottrans_die = 
new TGeoCombiTrans(_x, _y, _z,
 
 1153                                                 for (
unsigned int isensor = 0; isensor < 3; isensor++) { 
 
 1196                                                         TGeoRotation* rot_sensor = 
new TGeoRotation(
"rot_sensor", _rotphi,
 
 1197                                                                         _rottheta, _rotpsi);
 
 1198                                                         TGeoMatrix* rottrans_sensor = 
new TGeoCombiTrans(_x, _y, _z,
 
 1201                                                                 Get_offset(ihalf, iplane, imodule, iside, idie, isensor,
 
 1202                                                                                 _offset_x, _offset_y, _offset_z, _offset_phi, _offset_theta,
 
 1204                                                                 TGeoRotation* rot_sensor_offset = 
new TGeoRotation(
 
 1205                                                                                 "rot_sensor_offset", _offset_phi / 
pi * 180.,
 
 1206                                                                                 _offset_theta / 
pi * 180., _offset_psi / 
pi * 180.);
 
 1207                                                                 TGeoCombiTrans* rottrans_sensor_offset = 
new TGeoCombiTrans(
 
 1208                                                                                 _offset_x, _offset_y, _offset_z, rot_sensor_offset);
 
 1209                                                                 rottrans_sensor = 
new TGeoHMatrix(
 
 1210                                                                                 *rottrans_sensor_offset * *rottrans_sensor);
 
 1212                                                         lmd_vol_die_->AddNode(_vol_active, sensor_id, rottrans_sensor);
 
 1213                                                         lmd_vol_die_->AddNode(_vol_passive, sensor_id, rottrans_sensor);
 
 1218                                                                         isensor)] = 
new TGeoHMatrix(
 
 1219                                                                                         (*rottrans_die) * (*rottrans_sensor));
 
 1222                                                                 unsigned int _sensor_id = 
Get_sensor_id(ihalf, iplane, imodule,
 
 1223                                                                                 iside, idie, isensor);
 
 1224                                                                 if (sensor_id != _sensor_id) {
 
 1225                                                                         cout << 
" wrong sensor id " << _sensor_id << 
" != " 
 1226                                                                                         << sensor_id << endl;
 
 1228                                                                 int _ihalf, _iplane, _imodule, _iside, _idie, _isensor;
 
 1231                                                                 if ((
signed) ihalf != _ihalf)
 
 1232                                                                         cout << 
" wrong half " << _ihalf << endl;
 
 1233                                                                 if ((
signed) iplane != _iplane)
 
 1234                                                                         cout << 
" wrong plane " << _iplane << endl;
 
 1235                                                                 if ((
signed) imodule != _imodule)
 
 1236                                                                         cout << 
" wrong module " << _imodule << endl;
 
 1237                                                                 if ((
signed) iside != _iside)
 
 1238                                                                         cout << 
" wrong side " << _iside << endl;
 
 1239                                                                 if ((
signed) idie != _idie)
 
 1240                                                                         cout << 
" wrong die " << _idie << endl;
 
 1241                                                                 if ((
signed) isensor != _isensor)
 
 1242                                                                         cout << 
" wrong sensor " << _isensor << endl;
 
 1246                                                 lmd_vol_side_->AddNode(lmd_vol_die_, idie, rottrans_die);
 
 1255                                         TGeoRotation* rot_kapton = 
new TGeoRotation(
"rot_kapton", _rotphi,
 
 1256                                                         _rottheta, _rotpsi);
 
 1257                                         TGeoCombiTrans* rottrans_kapton = 
new TGeoCombiTrans(_x, _y, _z,
 
 1259                                         lmd_vol_side_->AddNode(lmd_vol_kapton_disc, 0, rottrans_kapton); 
 
 1260                                         lmd_vol_module_->AddNode(lmd_vol_side_, iside, rottrans_side);
 
 1265                                                                         (*rottrans_plane) * (*rottrans_module) * (*rottrans_side));
 
 1267                                 lmd_vol_plane_->AddNode(lmd_vol_module_, imodule, rottrans_module);
 
 1272                                 lmd_vol_plane_->AddNode(lmd_vol_cool_sup_up, iplane, rottrans_no);
 
 1274                                 lmd_vol_plane_->AddNode(lmd_vol_cool_sup_down, iplane, rottrans_no);
 
 1275                         lmd_vol_half_->AddNode(lmd_vol_plane_, iplane, rottrans_plane);
 
 1281                 lmd_vol_ref_sys->AddNode(lmd_vol_half_, ihalf, rottrans_no);
 
 1284                                 (*lmd_transrot) * (*rottrans_lmd_in_box));
 
 1287         stringstream nodetitle;
 
 1289         lmd_vol_vac->SetTitle(nodetitle.str().c_str());
 
 1290         lmd_vol_vac->AddNode(lmd_vol_ref_sys, 0, rottrans_lmd_in_box);
 
 1326         TGeoRotation* rot_no = 
new TGeoRotation(
"rot_no", 0., 0., 0.); 
 
 1330         double _x(0), _y(0), _z(0), _rotphi(0), _rottheta(0), _rotpsi(0);
 
 1331         double _offset_x(0), _offset_y(0), _offset_z(0), _offset_phi(0),
 
 1332                         _offset_theta(0), _offset_psi(0);
 
 1334         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++) { 
 
 1335                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++) { 
 
 1337                         TGeoMatrix* rottrans_plane = 
new TGeoCombiTrans(0., 0.,
 
 1349                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) { 
 
 1354                                 if (((imodule + ihalf) % 2) == 0)
 
 1361                                 _rotpsi = angle / 
pi * 180.;
 
 1362                                 TGeoRotation* rot_module = 
new TGeoRotation(
"rot_module", _rotphi,
 
 1363                                                 _rottheta, _rotpsi);
 
 1364                                 TGeoMatrix* rottrans_module = 
new TGeoCombiTrans(_x, _y, _z,
 
 1368                                 Get_offset(ihalf, iplane, imodule, -1, -1, -1, _offset_x, _offset_y,
 
 1369                                                 _offset_z, _offset_phi, _offset_theta, _offset_psi);
 
 1373                                 TGeoRotation* rot_module_offset = 
new TGeoRotation(
"rot_module_offset",
 
 1380                                 rot_module_offset->RotateZ(_offset_psi / 
pi * 180.);
 
 1381                                 rot_module_offset->RotateY(_offset_theta / 
pi * 180.);
 
 1382                                 rot_module_offset->RotateX(_offset_phi / 
pi * 180.);
 
 1386                                 TGeoCombiTrans* rottrans_module_offset = 
new TGeoCombiTrans(_offset_x,
 
 1387                                                 _offset_y, _offset_z, rot_module_offset);
 
 1389                                 rottrans_module = 
new TGeoHMatrix(
 
 1390                                                 *rottrans_module * *rottrans_module_offset);
 
 1391                                 for (
int iside = 0; iside < 2; iside++) { 
 
 1405                                         TGeoRotation* rot_side = 
new TGeoRotation(
"rot_side", _rotphi,
 
 1406                                                         _rottheta, _rotpsi);
 
 1407                                         TGeoMatrix* rottrans_side = 
new TGeoCombiTrans(_x, _y, _z, rot_side);
 
 1420                                                                         (*rottrans_plane) * (*rottrans_module) * (*rottrans_side));
 
 1438         double _offset_x(0), _offset_y(0), _offset_z(0), _offset_phi(0),
 
 1439                         _offset_theta(0), _offset_psi(0);
 
 1440         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++) { 
 
 1451                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++) { 
 
 1463                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) { 
 
 1476                                 for (
unsigned int iside = 0; iside < 2; iside++) { 
 
 1477                                         TGeoMatrix* rottrans_side = 
Get_matrix(ihalf, iplane, imodule, iside,
 
 1479                                         Get_offset(ihalf, iplane, imodule, iside, -1, -1, _offset_x,
 
 1480                                                         _offset_y, _offset_z, _offset_phi, _offset_theta, _offset_psi);
 
 1482                                         TGeoRotation* rot_side_offset = 
new TGeoRotation(
"rot_side_offset",
 
 1483                                                         _offset_phi / 
pi * 180., _offset_theta / 
pi * 180.,
 
 1484                                                         _offset_psi / 
pi * 180.);
 
 1485                                         TGeoCombiTrans* rottrans_side_offset = 
new TGeoCombiTrans(_offset_x,
 
 1486                                                         _offset_y, _offset_z, rot_side_offset);
 
 1487                                         rottrans_side = 
new TGeoHMatrix(
 
 1488                                                         *rottrans_side_offset * *rottrans_side);
 
 1501                                                         -1, -1)] = 
new TGeoHMatrix((*rottrans_side)); 
 
 1516                 int version_number) {
 
 1518         map<Tkey, TGeoMatrix*>* matrices = NULL;
 
 1532         string dir = getenv(
"VMCWORKDIR");
 
 1533         if (filename == 
""){
 
 1534                 filename = dir + 
"/geometry/trafo_matrices_lmd.dat";
 
 1540         ifstream 
file(filename.c_str());
 
 1541         int matrices_counter(0);
 
 1542         if (
file.is_open()) {
 
 1546                 getline(
file, line0);
 
 1548                 string keyword = 
"version ";
 
 1549                 if (line0.compare(0, 8, keyword) != 0) {
 
 1551                         cout << 
" **** Warning in PndLmdDim: the input file " << filename
 
 1552                                         << 
" has no version! **** " << endl;
 
 1556                         istringstream inputstream0(&line0[8]);
 
 1557                         inputstream0 >> _version;
 
 1558                         if (_version != version_number) {
 
 1559                                 cout << 
" **** Warning in PndLmdDim: the version " << _version
 
 1560                                                 << 
"  in " << filename << 
" does not match the geometry version " 
 1561                                                 << version_number << 
"! **** " << endl;
 
 1574                                 getline(
file, line1);
 
 1575                                 istringstream inputstream1(line1);
 
 1576                                 double translation[3];
 
 1577                                 for (
int i = 0; 
i < 3; 
i++) {
 
 1578                                         inputstream1 >> translation[
i];
 
 1581                                 getline(
file, line2);
 
 1582                                 istringstream inputstream2(line2);
 
 1584                                 for (
int i = 0; 
i < 9; 
i++) {
 
 1585                                         inputstream2 >> rotation[
i];
 
 1587                                 TGeoRotation* 
rot = 
new TGeoRotation(
"rotation");
 
 1588                                 rot->SetMatrix(rotation);
 
 1589                                 TGeoCombiTrans* rottrans = 
new TGeoCombiTrans(translation[0],
 
 1590                                                 translation[1], translation[2], rot);
 
 1591                                 (*matrices)[
Tkey(key)] = rottrans;
 
 1599                 cout << 
" Read " << matrices_counter << 
" matrices from " << filename
 
 1603                 << 
" Error in PndLmdDim::Read_transformation_matrices: could not read from " 
 1604                 << filename << endl;
 
 1609                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor) {
 
 1610         TGeoHMatrix* result = NULL;
 
 1612                 cout << 
" Error in PndLmdDim::Get_matrix: path " << path << 
" is not valid " 
 1620                 string uname = 
Generate_key(ihalf, iplane, imodule, iside, idie, isensor);
 
 1621                 pne = 
gGeoManager->GetAlignableEntry(uname.c_str());
 
 1623                         TGeoPhysicalNode *node = pne->GetPhysicalNode();
 
 1625                                 result = 
new TGeoHMatrix(*node->GetOriginalMatrix());
 
 1629                                 cout << 
" no node found in pn entry at " << path << endl;
 
 1630                                 cout << 
" obtaining default matrix " << endl;
 
 1633                         cout << 
" no pn entry (alignable node) found in " << path << endl;
 
 1634                         cout << 
" obtaining default matrix " << endl;
 
 1639         TGeoMatrix* matrix = 
gGeoManager->GetCurrentNode()->GetMatrix();
 
 1642         result = 
new TGeoHMatrix(*(matrix));
 
 1671                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor) {
 
 1675                 cout << 
" Error in PndLmdDim::Set_matrix: path " << path << 
" is not valid " 
 1680         TGeoPhysicalNode *node;
 
 1681         string uname = 
Generate_key(ihalf, iplane, imodule, iside, idie, isensor);
 
 1682         pne = 
gGeoManager->GetAlignableEntry(uname.c_str());
 
 1684                 cout << 
" creating alignable entry for " << path << endl;
 
 1686                         int sensID = 
Get_sensor_id(ihalf, iplane, imodule, iside, idie, isensor);
 
 1687                         pne = 
gGeoManager->SetAlignableEntry(uname.c_str(), path.c_str(), sensID);
 
 1689                         pne = 
gGeoManager->SetAlignableEntry(uname.c_str(), path.c_str());
 
 1692                         node = 
new TGeoPhysicalNode(path.c_str());
 
 1693                         pne->SetPhysicalNode(node);
 
 1697                 cout << 
" Error: no pn entry (alignable node) at " << path << 
" created " 
 1701         node = pne->GetPhysicalNode();
 
 1703                 cout << 
" no node found for pn entry (alignable node) at " << path << endl;
 
 1706         node->Align(matrix);  
 
 1720                 << 
" *** Error in PndLmdDim::Read_transformation_matrices_from_geometry:" 
 1723                                 << 
" is not compatible with this method! " << endl;
 
 1726         bool result = 
false;
 
 1728         TGeoManager* 
gGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
 
 1730                 cout << 
" Info: no FAIRGeom found, using gGeoManager " << endl;
 
 1734                 vector<string> list_of_sensors;
 
 1739                         << 
" *** Error in PndLmdDim::Read_transformation_matrices_from_geometry:" 
 1741                         cout << 
" could not retrieve list of sensors from geometry " << endl;
 
 1745                 map<Tkey, TGeoMatrix*>* matrices = NULL;
 
 1762                 TGeoVolume* vol = gGeoMan->FindVolumeFast(
nav_paths[0].c_str());
 
 1776                         stringstream path_to_ref;
 
 1777                         path_to_ref << path_to_top << 
"/" << 
nav_paths[1] << 
"_0";
 
 1778                         gGeoMan->cd(path_to_ref.str().c_str());
 
 1779                         TGeoHMatrix* top_matrix = 
new TGeoHMatrix(*gGeoMan->GetCurrentMatrix());
 
 1782                                 (*matrices)[
Tkey(-1, -1, -1, -1, -1, -1)] = 
new TGeoHMatrix(
 
 1784                         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++) { 
 
 1785                                 stringstream path_to_half;
 
 1786                                 path_to_half << path_to_ref.str() << 
"/" << nav_paths[2] << 
"_" 
 1789                                 TGeoHMatrix* half_matrix = 
Get_matrix(path_to_half.str(), aligned,
 
 1790                                                 ihalf, -1, -1, -1, -1, -1); 
 
 1794                                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++) { 
 
 1795                                         stringstream path_to_plane;
 
 1796                                         path_to_plane << path_to_half.str() << 
"/" << nav_paths[3] << 
"_" 
 1799                                         TGeoHMatrix* plane_matrix = 
Get_matrix(path_to_plane.str(), aligned,
 
 1800                                                         ihalf, iplane, -1, -1, -1, -1);
 
 1802                                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) { 
 
 1803                                                 stringstream path_to_module;
 
 1804                                                 path_to_module << path_to_plane.str() << 
"/" << nav_paths[4] << 
"_" 
 1807                                                 TGeoHMatrix* module_matrix = 
Get_matrix(path_to_module.str(),
 
 1808                                                                 aligned, ihalf, iplane, imodule, -1, -1, -1);
 
 1810                                                 for (
unsigned int iside = 0; iside < 2; iside++) { 
 
 1811                                                         stringstream path_to_side;
 
 1812                                                         path_to_side << path_to_module.str() << 
"/" << nav_paths[5] << 
"_" 
 1815                                                         TGeoHMatrix* side_matrix = 
Get_matrix(path_to_side.str(), aligned,
 
 1816                                                                         ihalf, iplane, imodule, iside, -1, -1); 
 
 1817                                                         if (plane_matrix && module_matrix && side_matrix)
 
 1818                                                                 (*matrices)[
Tkey(ihalf, iplane, imodule, iside, -1, -1)] =
 
 1820                                                                                                 *plane_matrix * *module_matrix * *side_matrix);
 
 1821                                                         for (
unsigned int idie = 0; idie < 2; idie++) { 
 
 1822                                                                 stringstream path_to_die;
 
 1823                                                                 path_to_die << path_to_side.str() << 
"/" << nav_paths[6] << 
"_" 
 1825                                                                 TGeoHMatrix* die_matrix = 
Get_matrix(path_to_die.str(), aligned,
 
 1826                                                                                 ihalf, iplane, imodule, iside, idie, -1);
 
 1827                                                                 for (
unsigned int isensor = 0; isensor < 3; isensor++) { 
 
 1832                                                                         stringstream path_to_sensor;
 
 1833                                                                         path_to_sensor << path_to_die.str() << 
"/" << nav_paths[7]
 
 1834                                                                                                                                                                                         << 
"_" << sensor_id;
 
 1835                                                                         TGeoHMatrix* sensor_matrix = 
Get_matrix(path_to_sensor.str(),
 
 1836                                                                                         aligned, ihalf, iplane, imodule, iside, idie, isensor); 
 
 1837                                                                         if (sensor_matrix && die_matrix)
 
 1838                                                                                 (*matrices)[
Tkey(ihalf, iplane, imodule, iside, idie,
 
 1839                                                                                                 isensor)] = 
new TGeoHMatrix(
 
 1840                                                                                                                 *die_matrix * *sensor_matrix); 
 
 1843                                                                         delete sensor_matrix;
 
 1849                                                 delete module_matrix;
 
 1851                                         delete plane_matrix;
 
 1857                         cout << 
" read " << (*matrices).size() << 
" matrices from root geometry " 
 1862                         << 
" *** Error in PndLmdDim::Read_transformation_matrices_from_geometry:" 
 1864                         cout << 
" Could not find the top volume " << 
nav_paths[0].c_str()
 
 1865                                                         << 
" to retrieve the transformation matrix for the luminosity detector! Is the geometry already loaded? " 
 1870                 << 
" *** Error in PndLmdDim::Read_transformation_matrices_from_geometry:" 
 1873                 << 
" Could not find a GeoManager to load the luminosity detector matrices from it! " 
 1885                 << 
" *** Error in PndLmdDim::Write_transformation_matrices_to_geometry:" 
 1888                                 << 
" is not compatible with this method! " << endl;
 
 1891         bool result = 
false;
 
 1893         TGeoManager* 
gGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
 
 1895                 cout << 
" Info: no FAIRGeom found, using gGeoManager " << endl;
 
 1899                 vector<string> list_of_sensors;
 
 1904                         << 
" *** Error in PndLmdDim::Write_transformation_matrices_to_geometry:" 
 1906                         cout << 
" could not retrieve list of sensors from geometry " << endl;
 
 1910                 map<Tkey, TGeoMatrix*>* matrices = NULL;
 
 1917                 if (matrices->size() == 0) {
 
 1919                         << 
" *** Error in PndLmdDim::Write_transformation_matrices_to_geometry:" 
 1921                         cout << 
" no matrices to apply to the geometry! " << endl;
 
 1926                 TGeoHMatrix* matrix;
 
 1927                 TGeoHMatrix* matrix_mother;
 
 1929                 TGeoVolume* vol = gGeoMan->FindVolumeFast(
nav_paths[0].c_str());
 
 1943                         stringstream path_to_ref;
 
 1944                         path_to_ref << path_to_top << 
"/" << 
nav_paths[1] << 
"_0";
 
 1945                         matrix = (TGeoHMatrix*) 
Get_matrix(-1, -1, -1, -1, -1, -1, aligned);
 
 1948                         gGeoMan->cd(path_to_top.c_str());
 
 1949                         matrix_mother = (TGeoHMatrix*) gGeoMan->GetCurrentMatrix();
 
 1950                         if (matrix && matrix_mother) {
 
 1951                                 TGeoHMatrix* _matrix = 
new TGeoHMatrix(
 
 1952                                                 matrix_mother->Inverse() * *matrix);
 
 1953                                 Set_matrix(path_to_ref.str(), _matrix, -1, -1, -1, -1, -1, -1);
 
 1955                         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++) { 
 
 1956                                 stringstream path_to_half;
 
 1957                                 path_to_half << path_to_ref.str() << 
"/" << nav_paths[2] << 
"_" 
 1959                                 gGeoMan->cd(path_to_half.str().c_str());
 
 1967                                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++) { 
 
 1968                                         stringstream path_to_plane;
 
 1969                                         path_to_plane << path_to_half.str() << 
"/" << nav_paths[3] << 
"_" 
 1972                                         TGeoHMatrix* plane_matrix = 
Get_matrix(path_to_plane.str(), 
false,
 
 1973                                                         ihalf, iplane, -1, -1, -1, -1);
 
 1977                                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) { 
 
 1978                                                 stringstream path_to_module;
 
 1979                                                 path_to_module << path_to_plane.str() << 
"/" << nav_paths[4] << 
"_" 
 1981                                                 TGeoHMatrix* module_matrix = 
Get_matrix(path_to_module.str(), 
false,
 
 1982                                                                 ihalf, iplane, imodule, -1, -1, -1);
 
 1987                                                 for (
unsigned int iside = 0; iside < 2; iside++) { 
 
 1988                                                         stringstream path_to_side;
 
 1989                                                         path_to_side << path_to_module.str() << 
"/" << nav_paths[5] << 
"_" 
 1992                                                         TGeoHMatrix* side_matrix = 
Get_matrix(path_to_side.str(), 
false,
 
 1993                                                                         ihalf, iplane, imodule, iside, -1, -1);
 
 1994                                                         matrix = (TGeoHMatrix*) 
Get_matrix(ihalf, iplane, imodule, iside,
 
 1996                                                         if (matrix && plane_matrix && module_matrix && side_matrix) {
 
 1997                                                                 TGeoHMatrix* _matrix = 
new TGeoHMatrix(
 
 1998                                                                                 (*plane_matrix * *module_matrix).Inverse() * *matrix);
 
 1999                                                                 Set_matrix(path_to_side.str(), _matrix, ihalf, iplane, imodule,
 
 2002                                                         for (
unsigned int idie = 0; idie < 2; idie++) { 
 
 2003                                                                 stringstream path_to_die;
 
 2004                                                                 path_to_die << path_to_side.str() << 
"/" << nav_paths[6] << 
"_" 
 2008                                                                 TGeoHMatrix* die_matrix = 
Get_matrix(path_to_die.str(), aligned,
 
 2009                                                                                 ihalf, iplane, imodule, iside, idie, -1);
 
 2012                                                                 for (
unsigned int isensor = 0; isensor < 3; isensor++) { 
 
 2017                                                                         stringstream path_to_sensor;
 
 2018                                                                         stringstream path_to_sensor_passive;
 
 2019                                                                         path_to_sensor << path_to_die.str() << 
"/" << nav_paths[7]
 
 2020                                                                                                                                                                                         << 
"_" << sensor_id;
 
 2023                                                                         path_to_sensor_passive << path_to_die.str() << 
"/" 
 2024                                                                                         << 
"LumPassiveRect" << 
"_" << sensor_id - 
sensIDoffset;
 
 2026                                                                         TGeoHMatrix* sensor_matrix = 
Get_matrix(path_to_sensor.str(),
 
 2027                                                                                         aligned, ihalf, iplane, imodule, iside, idie, isensor);
 
 2028                                                                         matrix = (TGeoHMatrix*) 
Get_matrix(ihalf, iplane, imodule,
 
 2029                                                                                         iside, idie, isensor, aligned);
 
 2030                                                                         if (sensor_matrix && die_matrix && matrix) {
 
 2031                                                                                 TGeoHMatrix* _matrix = 
new TGeoHMatrix(
 
 2032                                                                                                 die_matrix->Inverse() * *matrix);
 
 2034                                                                                 Set_matrix(path_to_sensor.str(), _matrix, ihalf, iplane,
 
 2035                                                                                                 imodule, iside, idie, isensor);
 
 2036                                                                                 Set_matrix(path_to_sensor_passive.str(), _matrix, ihalf,
 
 2037                                                                                                 iplane, imodule, iside, idie, isensor + 1000);
 
 2050                         cout << 
" set " << (*matrices).size() << 
" matrices to root geometry " 
 2055                         << 
" *** Error in PndLmdDim::Write_transformation_matrices_to_geometry:" 
 2057                         cout << 
" Could not find the top volume " << 
nav_paths[0].c_str()
 
 2058                                                         << 
" to retrieve the transformation matrix for the luminosity detector! Is the geometry already loaded? " 
 2061                 gGeoMan->RefreshPhysicalNodes();
 
 2064                 << 
" *** Error in PndLmdDim::Write_transformation_matrices_to_geometry:" 
 2067                 << 
" Could not find a GeoManager to load the luminosity detector matrices from it! " 
 2075                 bool found_lmd, 
bool first_call) {
 
 2083                         gGeoManager->GetCurrentNavigator()->GetCurrentNode()->GetName());
 
 2087                 list_of_sensors.push_back(
gGeoManager->GetPath());
 
 2089         int nnodes = 
gGeoManager->GetCurrentNode()->GetNdaughters();
 
 2090         for (
int i = 0; 
i < nnodes; 
i++) {
 
 2094                 if (nodename == 
nav_paths[1] || found_lmd) {
 
 2095                         cout << 
" found the lmd node! Aborting recursive search. " << endl;
 
 2103                 cout << 
" top volume is " << result << endl;
 
 2113         int max_sensID = nsensorstotal - 1;
 
 2116         if ((
int)list_of_sensors.size() != nsensorstotal) {
 
 2117                 cout << 
" PndLmdDim::Test_List_of_Sensors: number of sensors is wrong " 
 2118                                 << list_of_sensors.size() << 
" != " << nsensorstotal << endl;
 
 2121         for (
int isensor = 0; isensor < nsensorstotal; isensor++) {
 
 2122                 gGeoManager->cd(list_of_sensors[isensor].c_str());
 
 2123                 string path(
gGeoManager->GetCurrentNavigator()->GetPath());
 
 2124                 if (path != list_of_sensors[isensor]) {
 
 2125                         cout << 
" PndLmdDim::Test_List_of_Sensors: Could not navigate to " 
 2126                                         << list_of_sensors[isensor] << endl;
 
 2130                 char sensID_char[5] = { 
'0', 
'0', 
'0', 
'\0' };
 
 2131                 sensID_char[4] = 
'\0';
 
 2132                 for (
unsigned ichar = 3; ichar > 0; ichar--) { 
 
 2133                         char digit = path[path.size() - 4 + ichar];
 
 2136                         sensID_char[ichar] = digit;
 
 2138                 int sensID = atoi(sensID_char);
 
 2139                 if (sensID > max_sensID) {
 
 2140                         max_sensID = sensID;
 
 2142                 checksum += isensor;
 
 2143                 sumtocheck += sensID;
 
 2145         offset = max_sensID - (nsensorstotal - 1);
 
 2148                 << 
" PndLmdDim::Test_List_of_Sensors: Found an offset in the sensorIDs of " 
 2150                 checksum += (nsensorstotal * 
offset);
 
 2152         if (checksum != sumtocheck) {
 
 2154                 << 
" PndLmdDim::Test_List_of_Sensors: check sum of sensor id's does not match " 
 2155                 << checksum << 
" != " << sumtocheck << endl;
 
 2166         vector<string> sensors;
 
 2172                 cout << 
" Could not set sensIDoffset from root geometry " << endl;
 
 2180                 int version_number) {
 
 2181         map<Tkey, TGeoMatrix*>* matrices = NULL;
 
 2187         int matrices_counter(0);
 
 2188         string dir = getenv(
"VMCWORKDIR");
 
 2190                 filename = dir + 
"/geometry/trafo_matrices_lmd.dat";
 
 2191         ofstream 
file(filename.c_str());
 
 2192         if (
file.is_open()) {
 
 2194                 file << 
"version " << version_number << 
"\n";
 
 2203                         const double * translation =
 
 2208                         for (
int i = 0; 
i < 3; 
i++) {
 
 2209                                 file << setw(14) << setprecision(14) << scientific << translation[
i];
 
 2216                         for (
int i = 0; 
i < 9; 
i++) {
 
 2217                                 file << setw(14) << setprecision(14) << scientific << rotation[
i];
 
 2226                 cout << matrices_counter << 
" Transformation matrices were written to " 
 2227                                 << filename << endl;
 
 2230                 << 
" Error in PndLmdDim::Write_transformation_matrices: could not write to " 
 2231                 << filename << endl;
 
 2253         double fShiftX[40], fShiftY[40], fShiftZ[40];
 
 2254         double fRotateX[40], fRotateY[40], fRotateZ[40];
 
 2272         if (0 == lmdalignpar) {
 
 2273                 Error(
"PndLmdStripClusterTask::SetCalculators()",
 
 2274                                 "A ALIGN Parameter Set does not exist properly.");
 
 2278                 for (
int ik = 0; ik < 40; ik++) {
 
 2280                         fShiftX[ik] = lmdalignpar->
GetShiftX(ik);
 
 2282                         fShiftY[ik] = lmdalignpar->
GetShiftY(ik);
 
 2283                         fShiftZ[ik] = lmdalignpar->
GetShiftZ(ik);
 
 2295         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++) { 
 
 2296                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++) { 
 
 2297                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) { 
 
 2298                                 Tkey key(ihalf, iplane, imodule, -1, -1, -1);
 
 2299                                 int ikey = (ihalf * n_planes * 
nmodules) + (iplane * nmodules)
 
 2302                                 offsets[key].push_back(fShiftX[ikey]);
 
 2303                                 offsets[key].push_back(fShiftY[ikey]);
 
 2304                                 offsets[key].push_back(fShiftZ[ikey]);
 
 2305                                 offsets[key].push_back(fRotateX[ikey]);
 
 2306                                 offsets[key].push_back(fRotateY[ikey]);
 
 2307                                 offsets[key].push_back(fRotateZ[ikey]);
 
 2309                                 Tkey key2(ihalf, iplane, imodule, 0, -1, -1); 
 
 2311                                 offsets[key2].push_back(fShiftX[ikey]);
 
 2312                                 offsets[key2].push_back(fShiftY[ikey]);
 
 2313                                 offsets[key2].push_back(fShiftZ[ikey]);
 
 2314                                 offsets[key2].push_back(fRotateX[ikey]);
 
 2315                                 offsets[key2].push_back(fRotateY[ikey]);
 
 2316                                 offsets[key2].push_back(fRotateZ[ikey]);
 
 2319                                 Tkey key3(ihalf, iplane, imodule, 1, -1, -1);                           
 
 2320                                 offsets[key3].push_back(fShiftX[ikey]);
 
 2321                                 offsets[key3].push_back(fShiftY[ikey]);
 
 2322                                 offsets[key3].push_back(fShiftZ[ikey]);
 
 2323                                 offsets[key3].push_back(fRotateX[ikey]);
 
 2324                                 offsets[key3].push_back(fRotateY[ikey]);
 
 2325                                 offsets[key3].push_back(fRotateZ[ikey]);
 
 2332                 int idie, 
int isensor, 
double x, 
double y, 
double z, 
double rotphi,
 
 2333                 double rottheta, 
double rotpsi) {
 
 2334         Tkey key = 
Tkey(ihalf, iplane, imodule, iside, idie, isensor);
 
 2338                 << 
" **** Warning in PndLmdDim::Set_offset: offset exists already! Replacing it! *** " 
 2345                 offsets[key].push_back(rotphi);
 
 2346                 offsets[key].push_back(rottheta);
 
 2347                 offsets[key].push_back(rotpsi);
 
 2353                 int idie, 
int isensor, 
double& 
x, 
double& 
y, 
double& 
z, 
double& rotphi,
 
 2354                 double& rottheta, 
double& rotpsi, 
bool random) {
 
 2355         Tkey key = 
Tkey(ihalf, iplane, imodule, iside, idie, isensor);
 
 2367                         cout << 
" generating offset for";
 
 2368                         if (ihalf >= 0 && iplane >= 0 && imodule >= 0 && iside >= 0 && idie >= 0
 
 2370                                 cout << 
" one sensor ";
 
 2415                         if (ihalf >= 0 && iplane >= 0 && imodule >= 0 && iside >= 0 && idie < 0
 
 2417                                 cout << 
" one module side ";
 
 2428                         if (ihalf >= 0 && iplane >= 0 && imodule >= 0 && iside < 0 && idie < 0
 
 2430                                 cout << 
" one module ";
 
 2446                         if (ihalf >= 0 && iplane >= 0 && imodule < 0 && iside < 0 && idie < 0
 
 2448                                 cout << 
" one plane half ";
 
 2458                         if (ihalf >= 0 && iplane < 0 && imodule < 0 && iside < 0 && idie < 0
 
 2460                                 cout << 
" one half ";
 
 2471                         if (ihalf < 0 && imodule < 0 && iplane < 0 && iside < 0 && idie < 0
 
 2473                                 cout << 
" the luminosity detector ";
 
 2475                                 x = gRandom->Gaus(0, 0);
 
 2476                                 y = gRandom->Gaus(0, 0);
 
 2477                                 z = gRandom->Gaus(0, 0);
 
 2478                                 rottheta = gRandom->Gaus(0, 0);
 
 2479                                 rotphi = gRandom->Gaus(0, 0);
 
 2480                                 rotpsi = gRandom->Gaus(0, 0);
 
 2482                         cout << 
" of x = " << x << 
" cm y = " << y << 
" cm z = " << 
z;
 
 2483                         cout << 
" cm theta = " << rottheta << 
" rad phi = " << rotphi;
 
 2484                         cout << 
" rad psi = " << rotpsi << 
" rad " << endl;
 
 2496                 offsets[key].push_back(rotphi);
 
 2497                 offsets[key].push_back(rottheta);
 
 2498                 offsets[key].push_back(rotpsi);
 
 2504                 const double row, 
const bool aligned, 
bool newVersion) {
 
 2524                 TVector3 
hit(x, y, 0.);
 
 2525                 int ihalf, iplane, imodule, iside, idie, isensor;
 
 2528                                 isensor, 
false, aligned);
 
 2538         TVector3 
hit(x, y, 0.);
 
 2539         int ihalf, iplane, imodule, iside, idie, isensor;
 
 2544                         isensor, 
false, aligned);
 
 2549         static bool first_call(
true);
 
 2553                 << 
" Warning in PndLmdDim::Propagate_fast_ip_to_lmd: Wrong geometry version " 
 2555                 cout << 
" Transformation matrix was fit to data with geometry version 2 ! " 
 2558         if (pbeam != 1.5 && pbeam != 15) {
 
 2559                 cout << 
" Error in PndLmdDim::Propagate_fast_ip_to_lmd: no matrix fit for " 
 2560                                 << pbeam << 
" GeV/c beam momentum";
 
 2561                 cout << 
" nor interpolation is implemented yet " << endl;
 
 2573                 int& iplane, 
int& imodule, 
int& iside, 
int& idie, 
int& isensor,
 
 2575         bool result = 
false;
 
 2578         int _iplane = iplane;
 
 2580         int _imodule = imodule;
 
 2586         int _isensor = isensor;
 
 2589         if (!
Is_on_Sensor(point, _ihalf, _iplane, _imodule, _iside, _idie, _isensor,
 
 2599         vector<int> jsensor;
 
 2604         for (
int icheck = 0; icheck < nchecks; icheck++) {
 
 2605                 if (
Is_on_Sensor(point, _ihalf, _iplane, _imodule, _iside, jdie[icheck],
 
 2606                                 jsensor[icheck], aligned)) {
 
 2611                         idie = jdie[icheck];
 
 2612                         isensor = jsensor[icheck];
 
 2621                 vector<int> &jsensor) {
 
 2624         if (idie == 0 && isensor == 0) {
 
 2626                 jsensor.push_back(0);
 
 2628                 jsensor.push_back(1);
 
 2631         if (idie == 0 && isensor == 1) {
 
 2633                 jsensor.push_back(1);
 
 2635                 jsensor.push_back(1);
 
 2637                 jsensor.push_back(0);
 
 2640         if (idie == 0 && isensor == 2) {
 
 2642                 jsensor.push_back(2);
 
 2644                 jsensor.push_back(1);
 
 2647         if (idie == 1 && isensor == 1) {
 
 2649                 jsensor.push_back(1);
 
 2651                 jsensor.push_back(2);
 
 2653                 jsensor.push_back(1);
 
 2655                 jsensor.push_back(2);
 
 2658         if (idie == 1 && isensor == 2) {
 
 2660                 jsensor.push_back(2);
 
 2662                 jsensor.push_back(2);
 
 2664                 jsensor.push_back(1);
 
 2671                 int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 2672         bool result_x = 
false;
 
 2673         bool result_y = 
false;
 
 2675                         iplane, imodule, iside, idie, isensor, 
false, aligned);
 
 2677         double x = point_on_sensor.X();
 
 2678         double y = point_on_sensor.Y();
 
 2696         return (result_x && result_y);
 
 2702         double from[3] = { 
x, 
y, z };
 
 2705         matrix.MasterToLocal(from, to);
 
 2713                 double& 
z, 
bool aligned) {
 
 2715         double from[3] = { 
x, 
y, z };
 
 2718         matrix.MasterToLocalVect(from, to);
 
 2726         map<Tkey, TGeoMatrix*>* matrices = NULL;
 
 2732         if (matrices->size() == 0) {
 
 2734                 << 
" Warning in PndLmdDim::Get_matrices: No transformation matrices loaded! => trying to load default ones. " 
 2742                 int idie, 
int isensor, 
bool aligned) {
 
 2743         map<Tkey, TGeoMatrix*>* matrices = 
Get_matrices(aligned);
 
 2747                         Tkey(ihalf, iplane, imodule, iside, idie, isensor));
 
 2758                 int iside, 
int idie, 
int isensor, 
double& 
dx, 
double& 
dy, 
double& 
dz,
 
 2759                 double& dphi, 
double& 
dtheta, 
double& dpsi) {
 
 2768         TGeoMatrix* matrix = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 2770         TGeoMatrix* matrix_aligned = 
Get_matrix(ihalf, iplane, imodule, iside, idie,
 
 2772         if (!matrix || !matrix_aligned)
 
 2774         TGeoCombiTrans combi_trans_matrix(*matrix);
 
 2775         TGeoCombiTrans combi_trans_matrix_aligned(*matrix_aligned);
 
 2776         if (combi_trans_matrix.IsTranslation()
 
 2777                         && combi_trans_matrix_aligned.IsTranslation()) {
 
 2778                 const double* 
pos = combi_trans_matrix.GetTranslation();
 
 2779                 const double* pos_aligned = combi_trans_matrix_aligned.GetTranslation();
 
 2780                 dx = pos[0] - pos_aligned[0];
 
 2781                 dy = pos[1] - pos_aligned[1];
 
 2782                 dz = pos[2] - pos_aligned[2];
 
 2784         if (combi_trans_matrix.IsRotation()
 
 2785                         && combi_trans_matrix_aligned.IsRotation()) {
 
 2786                 double rot[3], rot_aligned[3];
 
 2787                 combi_trans_matrix.GetRotation()->GetAngles(rot[0], rot[1], rot[2]);
 
 2788                 combi_trans_matrix_aligned.GetRotation()->GetAngles(rot_aligned[0],
 
 2789                                 rot_aligned[1], rot_aligned[2]);
 
 2790                 dphi = rot[0] - rot_aligned[0];
 
 2791                 dtheta = rot[1] - rot_aligned[1];
 
 2792                 dpsi = rot[2] - rot_aligned[2];
 
 2807         dphi = dphi / 180. * 
pi * 1.e6;   
 
 2808         dtheta = dtheta / 180. * 
pi * 1.e6; 
 
 2809         dpsi = dpsi / 180. * 
pi * 1.e6;   
 
 2817         int ihalf(-1), iplane(-1), imodule(-1), iside(-1), idie(-1), isensor(-1);
 
 2818         double dx(0), 
dy(0), 
dz(0), dphi(0), 
dtheta(0), dpsi(0);
 
 2819         TH1D hist_dx_sensors_local(
"hist_dx_sensors_local",
 
 2820                         "ref local;#Deltax [#mum]; entries", 100, -1e3, 1e3);
 
 2821         TH1D hist_dx_sensors_global(
"hist_dx_sensors_lmd ",
 
 2822                         "ref lmd;#Deltax [#mum]; entries", 100, -1e3, 1e3);
 
 2823         TH1D hist_dy_sensors_local(
"hist_dy_sensors_local",
 
 2824                         "ref local;#Deltay [#mum]; entries", 100, -1e3, 1e3);
 
 2825         TH1D hist_dy_sensors_global(
"hist_dy_sensors_lmd",
 
 2826                         "ref lmd;#Deltay [#mum]; entries", 100, -1e3, 1e3);
 
 2827         TH1D hist_dz_sensors_local(
"hist_dz_sensors_local",
 
 2828                         "ref local;#Deltaz [#mum]; entries", 100, -1e3, 1e3);
 
 2829         TH1D hist_dz_sensors_global(
"hist_dz_sensors_lmd",
 
 2830                         "ref lmd;#Deltaz [#mum]; entries", 100, -1e3, 1e3);
 
 2831         TH1D hist_dphi_sensors_local(
"hist_dphi_sensors_local",
 
 2832                         "ref local;#Delta#phi [#murad]; entries", 100, -1e3, 1e3);
 
 2833         TH1D hist_dphi_sensors_global(
"hist_dphi_sensors_lmd",
 
 2834                         "ref lmd;#Delta#phi [#murad]; entries", 100, -1e3, 1e3);
 
 2835         TH1D hist_dtheta_sensors_local(
"hist_dtheta_sensors_local",
 
 2836                         "ref local;#Delta#theta [#murad]; entries", 100, -1e3, 1e3);
 
 2837         TH1D hist_dtheta_sensors_global(
"hist_dtheta_sensors_lmd",
 
 2838                         "ref lmd;#Delta#theta [#murad]; entries", 100, -1e3, 1e3);
 
 2839         TH1D hist_dpsi_sensors_local(
"hist_dpsi_sensors_local",
 
 2840                         "ref local;#Delta#psi [#murad]; entries", 100, -1e3, 1e3);
 
 2841         TH1D hist_dpsi_sensors_global(
"hist_dpsi_sensors_lmd",
 
 2842                         "ref lmd;#Delta#psi [#murad]; entries", 100, -1e3, 1e3);
 
 2844         ofstream 
outfile(
"offsets.txt");
 
 2845         if (outfile.is_open()) {
 
 2846                 outfile.setf(std::ios::fixed, std::ios::floatfield);   
 
 2847                 outfile.precision(7);
 
 2851                         outfile << 
" coordinate offset of the lmd reference system \n";
 
 2853                         << 
" \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2854                         outfile << 
dx << 
"\t" << 
dy << 
"\t" << 
dz << 
"\t" << dphi << 
"\t" 
 2855                                         << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2858                 for (ihalf = 0; ihalf < 2; ihalf++) {
 
 2866                                 outfile << 
"\t coordinate offset of the lmd half " << ihalf << 
" \n";
 
 2868                                 << 
"\t \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2869                                 outfile << 
"\t" << 
dx << 
"\t" << 
dy << 
"\t" << 
dz << 
"\t" << dphi
 
 2870                                                 << 
"\t" << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2873                         for (iplane = 0; iplane < (int)
n_planes; iplane++) {
 
 2880                                         outfile << 
"\t\t coordinate offset of the lmd plane " << iplane
 
 2883                                         << 
"\t\t \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2884                                         outfile << 
"\t\t" << 
dx << 
"\t" << 
dy << 
"\t" << 
dz << 
"\t" << dphi
 
 2885                                                         << 
"\t" << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2888                                 for (imodule = 0; imodule < 
n_cvd_discs / 2; imodule++) {
 
 2894                                                 outfile << 
"\t\t\t coordinate offset of the lmd module " << imodule
 
 2897                                                 << 
"\t\t\t \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2898                                                 outfile << 
"\t\t\t" << 
dx << 
"\t" << 
dy << 
"\t" << 
dz << 
"\t" 
 2899                                                                 << dphi << 
"\t" << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2902                                         for (iside = 0; iside < 2; iside++) {
 
 2907                                                         outfile << 
"\t\t\t\t coordinate offset of the lmd module side " 
 2910                                                         << 
"\t\t\t\t \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2911                                                         outfile << 
"\t\t\t\t" << 
dx << 
"\t" << 
dy << 
"\t" << 
dz << 
"\t" 
 2912                                                                         << dphi << 
"\t" << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2915                                                 for (idie = 0; idie < 2; idie++) {
 
 2919                                                                 outfile << 
"\t\t\t\t\t coordinate offset of the lmd die " 
 2922                                                                 << 
"\t\t\t\t\t \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2923                                                                 outfile << 
"\t\t\t\t\t" << 
dx << 
"\t" << 
dy << 
"\t" << 
dz 
 2924                                                                                 << 
"\t" << dphi << 
"\t" << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2927                                                         for (isensor = 0; isensor < 3; isensor++) {
 
 2930                                                                         outfile << 
"\t\t\t\t\t\t coordinate offset of the lmd sensor " 
 2931                                                                                         << isensor << 
" \n";
 
 2933                                                                         << 
"\t\t\t\t\t\t \u0394x [µm] \t \u0394y [µm] \t \u0394z [µm] \t \u0394\u03C6 [µrad] \t \u0394\u03D1 [µrad] \t \u0394\u03C8 [µrad] \t \n";
 
 2934                                                                         outfile << 
"\t\t\t\t\t\t" << 
dx << 
"\t" << 
dy << 
"\t" << 
dz 
 2935                                                                                         << 
"\t" << dphi << 
"\t" << 
dtheta << 
"\t" << dpsi << 
"\n";
 
 2937                                                                         hist_dx_sensors_local.Fill(
dx);
 
 2938                                                                         hist_dy_sensors_local.Fill(
dy);
 
 2939                                                                         hist_dz_sensors_local.Fill(
dz);
 
 2940                                                                         hist_dphi_sensors_local.Fill(dphi);
 
 2941                                                                         hist_dtheta_sensors_local.Fill(
dtheta);
 
 2942                                                                         hist_dpsi_sensors_local.Fill(dpsi);
 
 2951                 TCanvas outcanvas(
"canvas", 
"canvas", 600, 600);
 
 2952                 hist_dx_sensors_local.Draw();
 
 2953                 outcanvas.Print(
"offsets.pdf(");
 
 2954                 hist_dy_sensors_local.Draw();
 
 2955                 outcanvas.Print(
"offsets.pdf(");
 
 2956                 hist_dz_sensors_local.Draw();
 
 2957                 outcanvas.Print(
"offsets.pdf(");
 
 2958                 hist_dphi_sensors_local.Draw();
 
 2959                 outcanvas.Print(
"offsets.pdf(");
 
 2960                 hist_dtheta_sensors_local.Draw();
 
 2961                 outcanvas.Print(
"offsets.pdf(");
 
 2962                 hist_dpsi_sensors_local.Draw();
 
 2963                 outcanvas.Print(
"offsets.pdf)");
 
 2965                 cout << 
" sorry, could not write file into the current directory. " << endl;
 
 2971         return Get_matrix(-1, -1, -1, -1, -1, -1, aligned);
 
 2979                 int iplane, 
int imodule, 
int iside, 
bool aligned) {
 
 2980         return Get_matrix(ihalf, iplane, imodule, iside, -1, -1, aligned);
 
 2984                 int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 2985         return Get_matrix(ihalf, iplane, imodule, iside, idie, isensor, aligned);
 
 2989         TGeoMatrix *matrix = 
Get_matrix(-1, -1, -1, -1, -1, -1, aligned);
 
 2991                 return TGeoHMatrix();
 
 2992         return TGeoHMatrix(*matrix);
 
 2996                 int iplane, 
int imodule, 
int iside, 
bool aligned) {
 
 2997         TGeoMatrix* matrix = 
Get_matrix(ihalf, iplane, imodule, iside, -1, -1,
 
 3000                 return TGeoHMatrix();
 
 3001         return TGeoHMatrix(*matrix);
 
 3005                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 3006         TGeoMatrix* matrix = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 3010         return TGeoHMatrix(*matrix);
 
 3014                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 3018         TGeoMatrix* matrix1 = 
Get_matrix(-1, -1, -1, -1, -1, -1, aligned);
 
 3019         TGeoMatrix* matrix2 = 
Get_matrix(ihalf, iplane, imodule, iside, -1, -1,
 
 3021         TGeoMatrix* matrix3 = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 3023         if (!matrix1 || !matrix2 || !matrix3)
 
 3024                 return TGeoHMatrix();
 
 3026         return TGeoHMatrix((*matrix1) * (*matrix2) * (*matrix3));
 
 3030                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 3031         TGeoMatrix* matrix2 = 
Get_matrix(ihalf, iplane, imodule, iside, -1, -1,
 
 3033         TGeoMatrix* matrix3 = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 3035         if (!matrix2 || !matrix3)
 
 3036                 return TGeoHMatrix();
 
 3037         return TGeoHMatrix((*matrix2) * (*matrix3));
 
 3041         TGeoMatrix* matrix = 
Get_matrix(-1, -1, -1, -1, -1, -1, aligned);
 
 3043                 return TGeoHMatrix();
 
 3044         return TGeoHMatrix(matrix->Inverse());
 
 3048                 int iplane, 
int imodule, 
int iside, 
bool aligned) {
 
 3049         TGeoMatrix* matrix = 
Get_matrix(ihalf, iplane, imodule, iside, -1, -1,
 
 3053         return TGeoHMatrix(matrix->Inverse());
 
 3057                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 3058         TGeoMatrix* matrix = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 3061                 return TGeoHMatrix();
 
 3062         return TGeoHMatrix(matrix->Inverse());
 
 3066                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 3070         TGeoMatrix* matrix1 = 
Get_matrix(-1, -1, -1, -1, -1, -1, aligned);
 
 3071         TGeoMatrix* matrix2 = 
Get_matrix(ihalf, iplane, imodule, iside, -1, -1,
 
 3073         TGeoMatrix* matrix3 = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 3075         if (!matrix1 || !matrix2 || !matrix3)
 
 3076                 return TGeoHMatrix();
 
 3077         return TGeoHMatrix(((*matrix1) * (*matrix2) * (*matrix3)).Inverse());
 
 3083                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool aligned) {
 
 3084         TGeoMatrix* matrix2 = 
Get_matrix(ihalf, iplane, imodule, iside, -1, -1,
 
 3086         TGeoMatrix* matrix3 = 
Get_matrix(ihalf, iplane, imodule, iside, idie, isensor,
 
 3088         if (!matrix2 || !matrix3)
 
 3089                 return TGeoHMatrix();
 
 3090         return TGeoHMatrix(((*matrix2) * (*matrix3)).Inverse());
 
 3094                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor) {
 
 3097                         imodule, iside, idie, isensor, 
false);
 
 3099                         iplane, imodule, iside, idie, isensor, 
true);
 
 3100         return TGeoHMatrix(matrix * matrix_aligned);
 
 3104                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor) {
 
 3107                         iplane, imodule, iside, idie, isensor, 
true);
 
 3109                         imodule, iside, idie, isensor, 
false);
 
 3110         return TGeoHMatrix(matrix_aligned * matrix);
 
 3114                 bool isvector, 
bool aligned) {
 
 3117         point.GetXYZ(master);
 
 3120                 matrix.MasterToLocalVect(master, local);
 
 3122                 matrix.MasterToLocal(master, local);
 
 3123         return TVector3(local);
 
 3127                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
bool isvector,
 
 3130                         iplane, imodule, iside, aligned);
 
 3132         point.GetXYZ(master);
 
 3135                 matrix.MasterToLocalVect(master, local);
 
 3137                 matrix.MasterToLocal(master, local);
 
 3138         return TVector3(local);
 
 3142                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3143                 bool isvector, 
bool aligned) {
 
 3145                         iplane, imodule, iside, idie, isensor, aligned);
 
 3147         point.GetXYZ(master);
 
 3150                 matrix.MasterToLocalVect(master, local);
 
 3152                 matrix.MasterToLocal(master, local);
 
 3153         return TVector3(local);
 
 3157                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool isvector,
 
 3160                         imodule, iside, idie, isensor, aligned);
 
 3162         point.GetXYZ(master);
 
 3165                 matrix.MasterToLocalVect(master, local);
 
 3167                 matrix.MasterToLocal(master, local);
 
 3168         return TVector3(local);
 
 3172                 bool isvector, 
bool aligned) {
 
 3176         point.GetXYZ(local);
 
 3179                 matrix.LocalToMasterVect(local, master);
 
 3181                 matrix.LocalToMaster(local, master);
 
 3182         return TVector3(master);
 
 3186                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3187                 bool isvector, 
bool aligned) {
 
 3189                         iplane, imodule, iside, idie, isensor, aligned);
 
 3191         point.GetXYZ(master);
 
 3194                 matrix.MasterToLocalVect(master, local);
 
 3196                 matrix.MasterToLocal(master, local);
 
 3197         return TVector3(local);
 
 3201                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
bool isvector,
 
 3205                         iplane, imodule, iside, aligned);
 
 3207         point.GetXYZ(local);
 
 3210                 matrix.LocalToMasterVect(local, master);
 
 3212                 matrix.LocalToMaster(local, master);
 
 3213         return TVector3(master);
 
 3217                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3218                 bool isvector, 
bool aligned) {
 
 3221                         iplane, imodule, iside, idie, isensor, aligned);
 
 3223         point.GetXYZ(local);
 
 3226                 matrix.LocalToMasterVect(local, master);
 
 3228                 matrix.LocalToMaster(local, master);
 
 3229         return TVector3(master);
 
 3233                 int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor, 
bool isvector,
 
 3237                         imodule, iside, idie, isensor, aligned);
 
 3239         point.GetXYZ(local);
 
 3242                 matrix.LocalToMasterVect(local, master);
 
 3244                 matrix.LocalToMaster(local, master);
 
 3245         return TVector3(master);
 
 3249                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3250                 bool isvector, 
bool aligned) {
 
 3252                         iplane, imodule, iside, idie, isensor, aligned);
 
 3254         point.GetXYZ(local);
 
 3257                 matrix.LocalToMasterVect(local, master);
 
 3259                 matrix.LocalToMaster(local, master);
 
 3260         return TVector3(master);
 
 3264                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3267                         iplane, imodule, iside, idie, isensor);
 
 3269         point.GetXYZ(master);
 
 3272                 matrix.MasterToLocalVect(master, local);
 
 3274                 matrix.MasterToLocal(master, local);
 
 3275         return TVector3(local);
 
 3279                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3282                         iplane, imodule, iside, idie, isensor);
 
 3284         point.GetXYZ(master);
 
 3287                 matrix.MasterToLocalVect(master, local);
 
 3289                 matrix.MasterToLocal(master, local);
 
 3290         return TVector3(local);
 
 3294                 int ihalf_from, 
int iplane_from, 
int imodule_from, 
int iside_from,
 
 3295                 int idie_from, 
int isensor_from, 
int ihalf_to, 
int iplane_to,
 
 3296                 int imodule_to, 
int iside_to, 
int idie_to, 
int isensor_to, 
bool isvector,
 
 3299                         ihalf_from, iplane_from, imodule_from, iside_from, idie_from,
 
 3300                         isensor_from, aligned);
 
 3302                         ihalf_to, iplane_to, imodule_to, iside_to, idie_to, isensor_to, aligned);
 
 3303         TGeoHMatrix matrix(matrix_from * matrix_to);
 
 3305         point.GetXYZ(master);
 
 3308                 matrix.MasterToLocalVect(master, local);
 
 3310                 matrix.MasterToLocal(master, local);
 
 3311         return TVector3(local);
 
 3319                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3323                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
bool aligned) {
 
 3326                                         aligned).GetRotationMatrix());
 
 3328                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3332                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3336                                         idie, isensor, aligned).GetRotationMatrix());
 
 3338                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3342                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3346                                         isensor, aligned).GetRotationMatrix());
 
 3348                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3352                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3356                                         idie, isensor, aligned).GetRotationMatrix());
 
 3358                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3366                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3370                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
bool aligned) {
 
 3373                                         aligned).GetRotationMatrix());
 
 3375                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3379                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3383                                         idie, isensor, aligned).GetRotationMatrix());
 
 3385                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3389                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3393                                         isensor, aligned).GetRotationMatrix());
 
 3395                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3399                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor,
 
 3403                                         idie, isensor, aligned).GetRotationMatrix());
 
 3405                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3409                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor) {
 
 3412                                         idie, isensor).GetRotationMatrix());
 
 3414                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3418                 int ihalf, 
int iplane, 
int imodule, 
int iside, 
int idie, 
int isensor) {
 
 3421                                         idie, isensor).GetRotationMatrix());
 
 3423                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3427                 int ihalf_from, 
int iplane_from, 
int imodule_from, 
int iside_from,
 
 3428                 int idie_from, 
int isensor_from, 
int ihalf_to, 
int iplane_to,
 
 3429                 int imodule_to, 
int iside_to, 
int idie_to, 
int isensor_to, 
bool aligned) {
 
 3432                                         imodule_from, iside_from, idie_from, isensor_from, aligned)
 
 3434                                                         imodule_to, iside_to, idie_to, isensor_to, aligned)).GetRotationMatrix());
 
 3436                         rotmatrix * 
TMatrixD(matrix, TMatrixD::kMultTranspose, rotmatrix));
 
 3444         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++)
 
 3445                 for (
unsigned int iplane = 0; iplane < 
n_planes; iplane++)
 
 3446                         for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++)
 
 3447                                 for (
unsigned int iside = 0; iside < 2; iside++)
 
 3448                                         for (
unsigned int idie = 0; idie < 2; idie++)
 
 3449                                                 for (
unsigned int isensor = 0; isensor < 3; isensor++) {
 
 3450                                                         if (idie == 1 && isensor == 0)
 
 3452                                                         TVector3 from_sens(1., 2., 3.);
 
 3454                                                                         iplane, imodule, iside, idie, isensor);
 
 3456                                                                         imodule, iside, idie, isensor);
 
 3457                                                         if ((from_sens - to_sens).Mag() > 1e7)
 
 3458                                                                 cout << 
" error " << endl;
 
 3465         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++)
 
 3467                 for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++) {
 
 3469                                 for (
unsigned int iside = 0; iside < 2; iside++) {
 
 3470                                         for (
unsigned int idie = 0; idie < 2; idie++) {
 
 3471                                                 for (
unsigned int isensor = 0; isensor < 3; isensor++)
 
 3480                                                         if (idie == 1 && isensor == 0)
 
 3483                                                                         iside, idie, isensor, aligned, lmd_frame);
 
 3485                                                                 sensor_shape->SetLineColor(17);
 
 3487                                                                 sensor_shape->SetLineColor(13);
 
 3488                                                         sensor_shape->Draw();
 
 3495                                 for (
unsigned int idie = 0; idie < 2; idie++) {
 
 3496                                         for (
unsigned int isensor = 0; isensor < 3; isensor++) {
 
 3497                                                 if (idie == 1 && isensor == 0)
 
 3500                                                                 iside, idie, isensor, aligned, lmd_frame);
 
 3502                                                         sensor_shape->SetLineColor(17);
 
 3504                                                         sensor_shape->SetLineColor(13);
 
 3505                                                 sensor_shape->Draw();
 
 3514                 int iside, 
int idie, 
int isensor, 
bool aligned, 
bool lmd_frame) {
 
 3521         for (
unsigned int ipoint = 0; ipoint < 5; ipoint++) {
 
 3522                 TVector3 
point(x[ipoint], y[ipoint], 0);
 
 3523                 TVector3 point_master;
 
 3526                                         imodule, iside, idie, isensor, 
false, aligned);
 
 3529                                         iside, idie, isensor, 
false, aligned);
 
 3531                 x[ipoint] = point_master.X();
 
 3532                 y[ipoint] = point_master.Y();
 
 3534         TPolyLine* pline = 
new TPolyLine(5, x, y);
 
 3536         pline->SetLineColor(2);
 
 3537         pline->SetLineWidth(1);
 
 3545                 int iside, 
int idie, 
int isensor, 
bool aligned, 
bool lmd_frame,
 
 3546                 bool pixel_subdivision) {
 
 3551         vector<TGraph*> result; 
 
 3561         xs.push_back(x_top);
 
 3562         ys.push_back(y_top);
 
 3569         xs.push_back(x_bottom);
 
 3570         ys.push_back(y_bottom);
 
 3578         xs.push_back(x_left);
 
 3579         ys.push_back(y_left);
 
 3588         xs.push_back(x_right);
 
 3589         ys.push_back(y_right);
 
 3593         if (!pixel_subdivision) {
 
 3596                                 isensor, aligned, lmd_frame);
 
 3597                 double* 
x = shape->GetX();
 
 3598                 double* 
y = shape->GetY();
 
 3599                 double n = shape->GetN();
 
 3600                 result.push_back(
new TGraph(n, x, y));
 
 3603                 cout << 
"creating " << nrows << 
" rows x " << ncols << 
" cols of pixels " 
 3605                 for (
int irow = 0; irow < nrows; irow++) {
 
 3608                         for (
int icol = 0; icol < ncols; icol++) {
 
 3611                                 double* 
x = 
new double[5];
 
 3612                                 double* 
y = 
new double[5];
 
 3632         for (
unsigned int ipoints = 0; ipoints < xs.size(); ipoints++) {
 
 3635                 for (
unsigned int ipoint = 0; ipoint < 5; ipoint++) {
 
 3636                         TVector3 
point(xs[ipoints][ipoint], ys[ipoints][ipoint], 0);
 
 3637                         TVector3 point_master;
 
 3640                                                 imodule, iside, idie, isensor, 
false, aligned);
 
 3643                                                 iside, idie, isensor, 
false, aligned);
 
 3645                         xs[ipoints][ipoint] = point_master.X();
 
 3646                         ys[ipoints][ipoint] = point_master.Y();
 
 3648                 result.push_back(
new TGraph(5, xs[ipoints], ys[ipoints]));
 
 3651                         delete[] xs[ipoints];
 
 3652                         delete[] ys[ipoints];
 
 3659                 bool lmd_frame, 
bool pixel_subdivision) {
 
 3661         name << 
"histpoly_plane_" << iplane << 
"_side_" << iside;
 
 3663         title << 
"plane " << iplane << 
" side " << iside;
 
 3664         TH2Poly* result = 
new TH2Poly();
 
 3665         result->SetNameTitle(name.str().c_str(), title.str().c_str());
 
 3667         result->SetXTitle(
"x [cm]");
 
 3668         result->SetYTitle(
"y [cm]");
 
 3670         for (
unsigned int ihalf = 0; ihalf < 2; ihalf++)
 
 3672                 for (
unsigned int imodule = 0; imodule < 
nmodules; imodule++)
 
 3674                         for (
unsigned int idie = 0; idie < 2; idie++)
 
 3675                                 for (
unsigned int isensor = 0; isensor < 3; isensor++) {
 
 3676                                         if (idie == 1 && isensor == 0)
 
 3679                                                         imodule, iside, idie, isensor, aligned, lmd_frame,
 
 3681                                         for (
size_t igraph = 0; igraph < sensor_graph.size(); igraph++) {
 
 3682                                                 result->AddBin(sensor_graph[igraph]);
 
 3690                 int iside, 
bool aligned, 
bool lmd_frame, 
bool pixel_subdivision) {
 
 3692         name << 
"histpoly_half_" << ihalf << 
"_plane_" << iplane << 
"_module_" 
 3693                         << imodule << 
"_side_" << iside;
 
 3695         title << 
"half " << ihalf << 
" plane " << iplane << 
" module " << imodule
 
 3696                         << 
" side " << iside;
 
 3697         TH2Poly* result = 
new TH2Poly();
 
 3698         result->SetNameTitle(name.str().c_str(), title.str().c_str());
 
 3700         result->SetXTitle(
"x [cm]");
 
 3701         result->SetYTitle(
"y [cm]");
 
 3707         for (
unsigned int idie = 0; idie < 2; idie++)
 
 3708                 for (
unsigned int isensor = 0; isensor < 3; isensor++) {
 
 3709                         if (idie == 1 && isensor == 0)
 
 3712                                         iside, idie, isensor, aligned, lmd_frame, pixel_subdivision);
 
 3713                         for (
size_t igraph = 0; igraph < sensor_graph.size(); igraph++) {
 
 3714                                 result->AddBin(sensor_graph[igraph]);
 
 3722                 int iside, 
int idie, 
int isensor, 
bool aligned, 
bool lmd_frame) {
 
 3724         name << 
"histpoly_sensor_half_" << ihalf << 
"_plane_" << iplane << 
"_module_" 
 3725                         << imodule << 
"_side_" << iside << 
"_die_" << idie << 
"_sensor_" 
 3729                         << 
Get_sensor_id(ihalf, iplane, imodule, iside, idie, isensor);
 
 3730         TH2Poly* result = 
new TH2Poly();
 
 3731         result->SetNameTitle(name.str().c_str(), title.str().c_str());
 
 3733         result->SetXTitle(
"x [cm]");
 
 3734         result->SetYTitle(
"y [cm]");
 
 3736         vector<TGraph*> sensor_graph = 
Get_Sensor_Graph(ihalf, iplane, imodule, iside,
 
 3737                         idie, isensor, aligned, lmd_frame, 
true);
 
 3738         for (
size_t igraph = 0; igraph < sensor_graph.size(); igraph++) {
 
 3740                 result->AddBin(sensor_graph[igraph]);
 
 3748         int fhalf, fplane, fmodule, fside, fdie, fsensor;
 
 3749         int bhalf, bplane, bmodule, bside, bdie, bsensor;
 
 3751         int smalloverlap = 0;
 
 3753         Get_sensor_by_id(firstSensorId, fhalf, fplane, fmodule, fside, fdie, fsensor);
 
 3757         if (fside == bside) {
 
 3762         if (bside < fside) {
 
 3763                 std::swap(firstSensorId, secondSensorId);
 
 3770         if (bhalf != fhalf) {
 
 3773         if (bplane != fplane) {
 
 3776         if (bmodule != fmodule) {
 
 3781         if (fdie == 0 && fsensor == 0 && bdie == 0 && bsensor == 0) {
 
 3785         else if (fdie == 1 && fsensor == 1 && bdie == 1 && bsensor == 1) {
 
 3789         else if (fdie == 1 && fsensor == 2 && bdie == 1 && bsensor == 2) {
 
 3793         else if (fdie == 1 && fsensor == 1 && bdie == 0 && bsensor == 1) {
 
 3797         else if (fdie == 0 && fsensor == 1 && bdie == 1 && bsensor == 1) {
 
 3801         else if (fdie == 0 && fsensor == 2 && bdie == 1 && bsensor == 1) {
 
 3805         else if (fdie == 0 && fsensor == 2 && bdie == 1 && bsensor == 2) {
 
 3809         else if (fdie == 1 && fsensor == 1 && bdie == 0 && bsensor == 2) {
 
 3813         else if (fdie == 1 && fsensor == 2 && bdie == 0 && bsensor == 2) {
 
 3819         return 1000 * fhalf + 100 * fplane + 10 * fmodule + smalloverlap;
 
 3824         int fhalf, fplane, fmodule, fside, fdie, fsensor;
 
 3830         fhalf = std::floor(overlapID / 1000); 
 
 3831         fplane = std::floor((overlapID % 1000) / 100); 
 
 3832         fmodule = std::floor((overlapID % 100) / 10);
 
 3833         int smalloverlap = std::floor(overlapID % 10);
 
 3838         if (smalloverlap == 0) {
 
 3843         } 
else if (smalloverlap == 1) {
 
 3848         } 
else if (smalloverlap == 2) {
 
 3853         } 
else if (smalloverlap == 3) {
 
 3858         } 
else if (smalloverlap == 4) {
 
 3863         } 
else if (smalloverlap == 5) {
 
 3868         } 
else if (smalloverlap == 6) {
 
 3873         } 
else if (smalloverlap == 7) {
 
 3878         } 
else if (smalloverlap == 8) {
 
 3887         int id = 
Get_sensor_id(fhalf, fplane, fmodule, fside, fdie, fsensor);
 
 3893         int bhalf, bplane, bmodule, bside, bdie, bsensor;
 
 3898         bhalf = std::floor(overlapID / 1000); 
 
 3899         bplane = std::floor((overlapID % 1000) / 100); 
 
 3900         bmodule = std::floor((overlapID % 100) / 10); 
 
 3901         int smalloverlap = std::floor(overlapID % 10);
 
 3906         if (smalloverlap == 0) {
 
 3911         } 
else if (smalloverlap == 1) {
 
 3916         } 
else if (smalloverlap == 2) {
 
 3921         } 
else if (smalloverlap == 3) {
 
 3926         } 
else if (smalloverlap == 4) {
 
 3931         } 
else if (smalloverlap == 5) {
 
 3936         } 
else if (smalloverlap == 6) {
 
 3941         } 
else if (smalloverlap == 7) {
 
 3946         } 
else if (smalloverlap == 8) {
 
 3955         int id = 
Get_sensor_id(bhalf, bplane, bmodule, bside, bdie, bsensor);
 
 3960         int moduleID = std::floor(overlapID / 10.0);
 
 3965         std::vector<int> result;
 
 3968         for (
int iHalf = 0; iHalf < 2; iHalf++) {
 
 3969                 for (
int iPlane = 0; iPlane < 
n_planes; iPlane++) {
 
 3970                         for (
int iModule = 0; iModule < 
nmodules; iModule++) {
 
 3971                                 for (
int iOverlap = 0; iOverlap < 9; iOverlap++) {
 
 3972                                         overlapID = 1000 * iHalf + 100 * iPlane + 10 * iModule + iOverlap;
 
 3973                                         result.push_back(overlapID);
 
double maps_active_pixel_size
void Draw_Sensors(int iplane, bool aligned=true, bool lmd_frame=true, int glside=2)
void Get_offset(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, double &x, double &y, double &z, double &rotphi, double &rottheta, double &rotpsi, bool random=false)
bool Test_List_of_Sensors(vector< string > list_of_sensors, int &offset)
map< Tkey, vector< double > >::iterator itoffset
friend F32vec4 cos(const F32vec4 &a)
void Transform_global_to_lmd_local_vect(double &x, double &y, double &z, bool aligned=true)
void Get_pos_lmd_global(double &x, double &y, double &z, double &rotx, double &roty, double &rotz, bool misaligned=false)
TH2Poly * Get_histogram_Plane(int iplane, int iside, bool aligned=true, bool lmd_frame=true, bool pixel_subdivision=false)
int makeModuleID(int overlapID)
void Propagate_fast_ip_to_lmd(TVector3 &pos, TVector3 &mom, double pbeam)
FairGeoMedium * FairMediumVacuum
double plane_half_tilt_theta
string Generate_key(int ihalf, int iplane, int imodule, int iside, int idie, int isensor)
TGeoMatrix * Get_matrix_global_to_lmd_local(bool aligned=true)
TGeoMatrix * Get_matrix_lmd_local_to_module_side(int ihalf, int iplane, int imodule, int iside, bool aligned=true)
TH2Poly * Get_histogram_Sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true, bool lmd_frame=true)
TPolyLine * Get_Sensor_Shape(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true, bool lmd_frame=true)
double plane_half_offset_y
bool Get_matrix_difference(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, double &dx, double &dy, double &dz, double &dphi, double &dtheta, double &dpsi)
Double_t GetRotateZ(int j) const 
friend F32vec4 sqrt(const F32vec4 &a)
map< Tkey, TGeoMatrix * > * Get_matrices(bool aligned=true)
static PndLmdDim * Instance()
TVector3 Transform_sensor_aligned_to_sensor(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false)
friend F32vec4 sin(const F32vec4 &a)
double plane_half_tilt_phi
TVector3 Transform_global_to_lmd_local(const TVector3 &point, bool isvector=false, bool aligned=true)
TGeoHMatrix Get_transformation_sensor_to_sensor_aligned(int ihalf, int iplane, int imodule, int iside, int idie, int isensor)
TVector3 Transform_sensor_to_module_side(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false, bool aligned=true)
double maps_passive_right
string Get_List_of_Sensors(vector< string > &list_of_sensors, bool found_lmd=false, bool first_call=true)
TVector3 Transform_module_side_to_lmd_local(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, bool isvector=false, bool aligned=true)
double plane_half_tilt_psi
TGeoManager * gGeoManager
bool Read_transformation_matrices_from_geometry(bool aligned=true)
void Calc_matrix_offsets()
TVector3 Transform_sensor_to_sensor_aligned(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false)
int Get_sensor_id(int ihalf, int iplane, int imodule, int iside, int idie, int isensor)
Double_t GetRotateY(int j) const 
double maps_passive_bottom
void Set_offset(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, double x, double y, double z, double rotphi, double rottheta, double rotpsi)
static PndLmdDim * pinstance
unsigned int sensIDoffset
TVector3 Transform_lmd_local_to_global(const TVector3 &point, bool isvector=false, bool aligned=true)
double cvd_disc_thick_half
TGeoHMatrix Get_transformation_lmd_local_to_module_side(int ihalf, int iplane, int imodule, int iside, bool aligned=true)
FairGeoMedium * FairMediumAir
FairGeoBuilder * geobuild
bool Retrieve_version_number()
void Generate_rootgeom(TGeoVolume &mothervol, bool misaligned=false)
Alignment Parameter Class for LMD. 
double maps_active_offset_x
Double_t GetRotateX(int j) const 
TGeoHMatrix Get_transformation_module_side_to_sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
void Get_sensor_by_id(const int sensor_id, int &ihalf, int &iplane, int &imodule, int &iside, int &idie, int &isensor)
double kapton_disc_thick_half
int makeOverlapID(int firstSensorId, int secondSensorId)
TGeoMatrix * Get_matrix(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
TVector3 Transform_lmd_local_to_module_side(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, bool isvector=false, bool aligned=true)
map< Tkey, TGeoMatrix * > transformation_matrices_aligned
int getID2fromOverlapID(int overlapID)
map< Tkey, TGeoMatrix * > transformation_matrices
TGeoHMatrix Get_transformation_sensor_to_module_side(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
bool Set_sensIDoffset(int offset=-1)
TGeoHMatrix Get_transformation_lmd_local_to_sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
TGeoHMatrix Get_transformation_sensor_to_global(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
TVector3 Transform_global_to_sensor(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false, bool aligned=true)
double maps_active_offset_y
int getID1fromOverlapID(int overlapID)
TGeoHMatrix Get_transformation_global_to_sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
TH2Poly * Get_histogram_Moduleside(int ihalf, int iplane, int imodule, int iside, bool aligned=true, bool lmd_frame=true, bool pixel_subdivision=true)
void Read_DB_offsets(PndLmdAlignPar *lmdalignpar)
double cvd_disc_even_odd_offset
void Write_transformation_matrices(string filename, bool aligned=true, int version_number=geometry_version)
void reCreate_transformation_matrices()
void Read_transformation_matrices(string filename="", bool aligned=true, int version_number=geometry_version)
static int geometry_version
map< Tkey, vector< double > > offsets
TGeoHMatrix Get_transformation_sensor_to_lmd_local(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
bool Set_matrix(string path, TGeoHMatrix *matrix, int ihalf=-1, int iplane=-1, int imodule=-1, int iside=-1, int idie=-1, int isensor=-1)
double plane_half_offset_x
static PndLmdDim & Get_instance()
double maps_active_height
map< Tkey, TGeoMatrix * >::iterator it_transformation_matrices
TGeoHMatrix Get_transformation_global_to_lmd_local(bool aligned=true)
bool Is_on_Sensor(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
TVector3 Transform_sensor_to_lmd_local(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false, bool aligned=true)
TGeoHMatrix Get_transformation_sensor_aligned_to_sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor)
bool Get_overlapping_sensor(const TVector3 &point, int &ihalf, int &iplane, int &imodule, int &iside, int &idie, int &isensor, bool aligned=true)
TGeoHMatrix Get_transformation_lmd_local_to_global(bool aligned=true)
void Correct_transformation_matrices()
FairGeoInterface * geoFace
double plane_half_offset_z
bool Write_transformation_matrices_to_geometry(bool aligned=true)
TGeoMatrix * Get_matrix_module_side_to_sensor(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true)
vector< string > nav_paths
TGeoHMatrix Get_transformation_module_side_to_lmd_local(int ihalf, int iplane, int imodule, int iside, bool aligned=true)
TVector3 Transform_module_side_to_sensor(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false, bool aligned=true)
TVector3 Transform_sensor_to_sensor(const TVector3 &point, int ihalf_from, int iplane_from, int imodule_from, int iside_from, int idie_from, int isensor_from, int ihalf_to, int iplane_to, int imodule_to, int iside_to, int idie_to, int isensor_to, bool isvector=false, bool aligned=true)
Double_t GetShiftY(int j) const 
std::vector< int > getAvailableOverlapIDs()
map< double, PndLmdDimPropMat > propagation_matrices
Double_t GetShiftZ(int j) const 
Double_t GetShiftX(int j) const 
TVector3 Transform_sensor_to_global(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false, bool aligned=true)
TVector3 Transform_lmd_local_to_sensor(const TVector3 &point, int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool isvector=false, bool aligned=true)
TMatrixT< double > TMatrixD
vector< TGraph * > Get_Sensor_Graph(int ihalf, int iplane, int imodule, int iside, int idie, int isensor, bool aligned=true, bool lmd_frame=true, bool pixel_subdivision=true)
TVector3 Decode_hit(const int sensorID, const double column, const double row, const bool aligned=true, bool newVersion=false)