From: belikov Date: Fri, 20 Feb 2015 15:31:58 +0000 (+0100) Subject: A more efficient way of volume creations and other minor improvements (Mario) X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=e14c51b69d31f0a2afa3c035b572c791468a4647 A more efficient way of volume creations and other minor improvements (Mario) --- diff --git a/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.cxx b/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.cxx index 852cf274337..0198a5b0799 100644 --- a/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.cxx +++ b/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.cxx @@ -538,8 +538,9 @@ TGeoVolume* AliITSUv1Layer::CreateStave(const TGeoManager * /*mgr*/){ fHierarchy[kHalfStave] = 2; // RS mechStaveVol = CreateSpaceFrameOuterB(); if (mechStaveVol) { - staveVol->AddNode(mechStaveVol, 1, - new TGeoCombiTrans(0, -fgkOBSFrameULegHeight1, 0, + if (fBuildLevel < 6) // Carbon + staveVol->AddNode(mechStaveVol, 1, + new TGeoCombiTrans(0, -fgkOBSFrameULegHeight1, 0, new TGeoRotation("", 180, 0, 0))); } } // if (fStaveModel) @@ -2102,7 +2103,7 @@ TGeoVolume* AliITSUv1Layer::CreateStaveModelInnerB4(const Double_t xstave, TGeoVolume *mechStavVol = new TGeoVolume(volname, mechStruct, medAir); mechStavVol->SetLineColor(12); mechStavVol->SetFillColor(12); - mechStavVol->SetVisibility(kTRUE); + mechStavVol->SetVisibility(kFALSE); TGeoVolume *kapCableVol = new TGeoVolume("FPCKapton", kapCable, medKapton); kapCableVol->SetLineColor(kBlue); @@ -2878,6 +2879,8 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterBDummy(const TGeoManager *) con TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){ // // Create the space frame for the Outer Barrel (Model 1) +// The building blocks are created in another method to avoid +// replicating the same volumes for all OB staves // // Input: // mgr : the GeoManager (used only to get the proper material) @@ -2887,12 +2890,100 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){ // Return: // a TGeoVolume with the Space Frame of a stave // -// Created: 20 Dec 2013 Anastasia Barbano -// Updated: 15 Jan 2014 Mario Sitta -// Updated: 18 Feb 2014 Mario Sitta -// Updated: 12 Mar 2014 Mario Sitta -// Updated: 15 Dec 2014 Mario Sitta -// Updated: 28 Jan 2014 Mario Sitta Change frame shape to avoid overlaps +// Created: 03 Feb 2015 Mario Sitta +// + + TGeoMedium *medAir = mgr->GetMedium("ITS_AIR$"); + + TGeoVolume *unitVol[2], *endVol[2]; + Double_t *xtru, *ytru; + Double_t zlen, zpos; + Int_t nPoints; + char volname[30]; + + + // Check whether we have already all pieces + // Otherwise create them + unitVol[0] = mgr->GetVolume("SpaceFrameUnit0"); + + if (!unitVol[0]) { + CreateOBSpaceFrameObjects(mgr); + unitVol[0] = mgr->GetVolume("SpaceFrameUnit0"); + } + + unitVol[1] = mgr->GetVolume("SpaceFrameUnit1"); + + endVol[0] = mgr->GetVolume("SpaceFrameEndUnit0"); + endVol[1] = mgr->GetVolume("SpaceFrameEndUnit1"); + + // Get the shape of the units + // and create a similar shape for the Space Frame container + TGeoXtru *volShape = (TGeoXtru*)(unitVol[0]->GetShape()); + + nPoints = volShape->GetNvert(); + xtru = new Double_t[nPoints]; + ytru = new Double_t[nPoints]; + + for (Int_t i=0; iGetX(i); + ytru[i] = volShape->GetY(i); + } + + zlen = fgkOBSpaceFrameZLen[fLayerNumber/5]; // 3,4 -> 0 - 5,6 -> 1 + + TGeoXtru *spaceFrame = new TGeoXtru(2); + spaceFrame->DefinePolygon(nPoints, xtru, ytru); + spaceFrame->DefineSection(0,-zlen/2); + spaceFrame->DefineSection(1, zlen/2); + + snprintf(volname, 30, "SpaceFrameVolumeLay%d", fLayerNumber); + TGeoVolume *spaceFrameVol = new TGeoVolume(volname, spaceFrame, medAir); + spaceFrameVol->SetVisibility(kFALSE); + + + // Finally build up the space frame + Int_t nUnits = fgkOBSpaceFrameNUnits[fLayerNumber/5]; // 3,4 -> 0 - 5,6 -> 1 + + TGeoXtru *frameUnit = (TGeoXtru*)(unitVol[0]->GetShape()); + TGeoXtru *endUnit = (TGeoXtru*)( endVol[0]->GetShape()); + + zpos = -spaceFrame->GetDZ() + endUnit->GetDZ(); + spaceFrameVol->AddNode(endVol[0], 1, new TGeoTranslation(0, 0, zpos)); + + for(Int_t i=1; iGetDZ() + (1 + 2*i)*frameUnit->GetDZ(); + Int_t j = i/2; + Int_t k = i - j*2; // alternatively 0 or 1 + spaceFrameVol->AddNode(unitVol[k], j+1, new TGeoTranslation(0, 0, zpos)); + } + + zpos = -spaceFrame->GetDZ() + (2*nUnits - 1)*endUnit->GetDZ(); + spaceFrameVol->AddNode(endVol[1], 1, new TGeoTranslation(0, 0, zpos)); + + + // Done, clean up and return the space frame structure + delete [] xtru; + delete [] ytru; + + return spaceFrameVol; +} + +//________________________________________________________________________ +void AliITSUv1Layer::CreateOBSpaceFrameObjects(const TGeoManager *mgr){ +// +// Create the space frame building blocks for the Outer Barrel +// This method is practically identical to previous versions of +// CreateSpaceFrameOuterB1 +// +// Input: +// mgr : the GeoManager (used only to get the proper material) +// +// Output: +// +// Return: +// a TGeoVolume with the Space Frame of a stave +// +// Created: 03 Feb 2015 Mario Sitta // @@ -2921,7 +3012,7 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){ Double_t basePhiDeg = fgkOBSFrameBaseRibPhi; Double_t basePhiRad = basePhiDeg*TMath::DegToRad(); Double_t ulegHalfLen = fgkOBSFrameULegLen/2; - Double_t ulegHalfWidth = fgkOBSFrameULegWidth; + Double_t ulegHalfWidth = fgkOBSFrameULegWidth/2; Double_t ulegHigh1 = fgkOBSFrameULegHeight1; Double_t ulegHigh2 = fgkOBSFrameULegHeight2; Double_t ulegThick = fgkOBSFrameULegThick; @@ -2972,14 +3063,9 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){ ytru[20] = ytru[15]; - // The space frame container and a single unit + // The space frame single units // We need two units because the base ribs are alternately oriented // The end units are slightly different - TGeoXtru *spaceFrame = new TGeoXtru(2); - spaceFrame->DefinePolygon(22, xtru, ytru); - spaceFrame->DefineSection(0,-zlen/2); - spaceFrame->DefineSection(1, zlen/2); - TGeoXtru *frameUnit = new TGeoXtru(2); frameUnit->DefinePolygon(22, xtru, ytru); frameUnit->DefineSection(0,-unitlen/2); @@ -2991,10 +3077,6 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){ endUnit->DefineSection(1, unitlen/2); - snprintf(volname, 30, "SpaceFrameVolumeLay%d", fLayerNumber); - TGeoVolume *spaceFrameVol = new TGeoVolume(volname, spaceFrame, medAir); - spaceFrameVol->SetVisibility(kFALSE); - TGeoVolume *unitVol[2]; unitVol[0] = new TGeoVolume("SpaceFrameUnit0", frameUnit, medAir); unitVol[1] = new TGeoVolume("SpaceFrameUnit1", frameUnit, medAir); @@ -3271,25 +3353,8 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){ new TGeoTranslation( -xpos, -ypos, zpos)); - // Finally build up the space frame - Int_t nUnits = fgkOBSpaceFrameNUnits[fLayerNumber/5]; // 3,4 -> 0 - 5,6 -> 1 - - zpos = -spaceFrame->GetDZ() + endUnit->GetDZ(); - spaceFrameVol->AddNode(endVol[0], 1, new TGeoTranslation(0, 0, zpos)); - - for(Int_t i=1; iGetDZ() + (1 + 2*i)*frameUnit->GetDZ(); - Int_t j = i/2; - Int_t k = i - j*2; // alternatively 0 or 1 - spaceFrameVol->AddNode(unitVol[k], j+1, new TGeoTranslation(0, 0, zpos)); - } - - zpos = -spaceFrame->GetDZ() + (2*nUnits - 1)*endUnit->GetDZ(); - spaceFrameVol->AddNode(endVol[1], 1, new TGeoTranslation(0, 0, zpos)); - - - // Done, return the space frame structure - return spaceFrameVol; + // Done + return; } //________________________________________________________________________ @@ -3330,14 +3395,21 @@ TGeoVolume* AliITSUv1Layer::CreateChipInnerB(const Double_t xchip, // We have all shapes: now create the real volumes TGeoMedium *medSi = mgr->GetMedium("ITS_SI$"); + TGeoMedium *medAir = mgr->GetMedium("ITS_AIR$"); + TGeoMedium *medChip; + + if (fBuildLevel < 7) + medChip = medSi; + else + medChip = medAir; snprintf(volname, 30, "%s%d", AliITSUGeomTGeo::GetITSChipPattern(), fLayerNumber); - TGeoVolume *chipVol = new TGeoVolume(volname, chip, medSi); + TGeoVolume *chipVol = new TGeoVolume(volname, chip, medChip); chipVol->SetVisibility(kTRUE); chipVol->SetLineColor(1); snprintf(volname, 30, "%s%d", AliITSUGeomTGeo::GetITSSensorPattern(), fLayerNumber); - TGeoVolume *sensVol = new TGeoVolume(volname, sensor, medSi); + TGeoVolume *sensVol = new TGeoVolume(volname, sensor, medChip); sensVol->SetVisibility(kTRUE); sensVol->SetLineColor(8); sensVol->SetLineWidth(1); diff --git a/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.h b/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.h index 4363829413f..2940f9c648b 100644 --- a/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.h +++ b/ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.h @@ -100,6 +100,7 @@ class AliITSUv1Layer : public AliITSv11Geometry { TGeoVolume* CreateSpaceFrameOuterB(const TGeoManager *mgr=gGeoManager); TGeoVolume* CreateSpaceFrameOuterBDummy(const TGeoManager *mgr=gGeoManager) const; TGeoVolume* CreateSpaceFrameOuterB1(const TGeoManager *mgr=gGeoManager); + void CreateOBSpaceFrameObjects(const TGeoManager *mgr=gGeoManager); TGeoXtru* CreateStaveSide(const char *name, Double_t dz, Double_t alpha, Double_t beta, diff --git a/ITS/UPGRADE/testITSUv1/GetMaterialBudget.C b/ITS/UPGRADE/testITSUv1/GetMaterialBudget.C index 45e78172d58..f5c55ea10ff 100644 --- a/ITS/UPGRADE/testITSUv1/GetMaterialBudget.C +++ b/ITS/UPGRADE/testITSUv1/GetMaterialBudget.C @@ -41,7 +41,7 @@ // Original version // Chinorat Kobdaj , Stefan Rossegger // Revised and adapted to newer AliITSUv1 versions -// Mario Sitta - Nov 2014 +// Mario Sitta - Nov 2014, Feb 2015 enum { @@ -51,6 +51,7 @@ enum { kIBModel21=3, kIBModel22=4, kIBModel3=5, + kIBModel4=10, kOBModelDummy=6, kOBModel0=7, kOBModel1=8, @@ -241,6 +242,7 @@ void DrawMaterialBudget_Splitted(Int_t nLay = 0, Double_t rmin = 1., const Int_t maxNumberOfScenarios = nScenariosOB; Double_t meanX0[maxNumberOfScenarios]; + Double_t contribX0[maxNumberOfScenarios]; TH1F *l[maxNumberOfScenarios+1]; TString strDescrip[maxNumberOfScenarios]; @@ -257,36 +259,39 @@ void DrawMaterialBudget_Splitted(Int_t nLay = 0, Double_t rmin = 1., char title[30]; Int_t model, buildlevel; + + strcpy(title, + gGeoManager->GetVolume(Form("ITSULayer%d",nLay))->GetTitle()); + if (strlen(title) == 0) // No Model info -> old model schema + model = -1; + else // New model schema -> extract model + sscanf(title, "Model %d Build level %d", &model, &buildlevel); + if (nLay < 3) { // IB has only 6 scenarios nScenarios = nScenariosIB; - for (Int_t i=0; i same name/colors as OB + for (Int_t i=0; i old names/colors + for (Int_t i=0; iGetVolume(Form("ITSULayer%d",nLay))->GetTitle()); - if (strlen(title) == 0) { // Old OB has only 6 scenarios like IB + if (model == kOBModel2) { // New OB + nScenarios = nScenariosOB; + for (Int_t i=0; iAddEntry(l[i],strDescrip[i].Data(),"l"); @@ -370,6 +378,10 @@ void DrawMaterialBudget_Splitted(Int_t nLay = 0, Double_t rmin = 1., l[nScenarios]->SetLineWidth(2); l[nScenarios]->DrawCopy("same"); + printf("\n X/X0 contributions:\n"); + for (Int_t i=0; iSaveAs("Material-details.pdf"); }