]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt1GeometryBuilderV2.cxx
Flexible pt range for the efficiency histogramming
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilderV2.cxx
index 61aaca937198ffb7cb41539a424394fa9b40b80b..1eced07766933a79904c62365bfbe7a0732f3977 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "AliMpSegmentation.h"
 #include "AliMpDEManager.h"
-#include "AliMpContainers.h"
 #include "AliMpConstants.h"
 #include "AliMpCDB.h"
 #include "AliMpSector.h"
 #include "AliMagF.h"
 #include "AliLog.h"
 
-#include <TVector2.h>
-#include <TVector3.h>
-#include <TGeoMatrix.h>
-#include <TClonesArray.h>
 #include <Riostream.h>
-#include <TSystem.h>
-#include <TVirtualMC.h>
+#include <TClonesArray.h>
+#include <TGeoCompositeShape.h>
+#include <TGeoGlobalMagField.h>
 #include <TGeoManager.h>
-#include <TGeoVolume.h>
+#include <TGeoMatrix.h>
 #include <TGeoTube.h>
+#include <TGeoVolume.h>
 #include <TGeoXtru.h>
-#include <TGeoCompositeShape.h>
-
-#ifdef WITH_STL
-  #include <vector>
-#endif
-
-#ifdef WITH_ROOT
-  #include "TArrayI.h"
-#endif
+#include <TSystem.h>
+#include <TVector2.h>
+#include <TVector3.h>
+#include <TVirtualMC.h>
+#include <TArrayI.h>
 
+using std::endl;
+using std::cout;
 /// \cond CLASSIMP
 ClassImp(AliMUONSt1GeometryBuilderV2)
 /// \endcond
@@ -428,8 +423,15 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
   
   Int_t nb = AliMpConstants::ManuMask(AliMp::kNonBendingPlane);
   TExMapIter it(&specialMap);
+#if (defined(ROOT_SVN_REVISION) && ROOT_SVN_REVISION >= 29598) || \
+  (defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE >= ROOT_VERSION(5,25,02))
+  Long64_t key;
+  Long64_t value;
+#else
   Long_t key;
   Long_t value;
+#endif  
+  
   while ( it.Next(key,value) == kTRUE ) { 
     delete reinterpret_cast<AliMUONSt1SpecialMotif*>(value);
   }
@@ -452,7 +454,7 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
 
   //reflectZ = false;
   reflectZ = true;
-  TVector2 offset = kSector2->Position();
+  TVector2 offset = TVector2(kSector2->GetPositionX(), kSector2->GetPositionY());
   where = TVector3(where.X()+offset.X(), where.Y()+offset.Y(), 0.); 
       // Add the half-pad shift of the non-bending plane wrt bending plane
       // (The shift is defined in the mapping as sector offset)
@@ -1164,7 +1166,7 @@ void AliMUONSt1GeometryBuilderV2::CreateFrame(Int_t chamber)
     
     // TopAnode1 -  layer 2 of 2
     par[2] = kHzTA12;    
-    gMC->Gsvolu("SQ09","BOX",idFR4,par,11); 
+    gMC->Gsvolu("SQ09","BOX",idFR4,par,3); 
 
     // TopAnode2 -  layer 1 of 2
     par[0] = kHzTA21;
@@ -1975,14 +1977,8 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
   
   GReal_t posX,posY,posZ;
   
-#ifdef WITH_STL  
-  vector<Int_t> alreadyDone;
-#endif
-
-#ifdef WITH_ROOT  
   TArrayI alreadyDone(20);
   Int_t nofAlreadyDone = 0;
-#endif  
 
   for (Int_t irow=0;irow<sector->GetNofRows();irow++){ // for each row
     AliMpRow* row = sector->GetRow(irow);
@@ -1996,10 +1992,11 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
       if ( value == 0 ){ //if this is a normal segment (ie. not part of <specialMap>)
       
         // create the cathode part
-        CreatePlaneSegment(segNum, seg->Dimensions(), seg->GetNofMotifs());
+        CreatePlaneSegment(segNum, TVector2(seg->GetDimensionX(),seg->GetDimensionY()), 
+                           seg->GetNofMotifs());
   
-        posX = where.X() + seg->Position().X();
-        posY = where.Y() + seg->Position().Y();
+        posX = where.X() + seg->GetPositionX();
+        posY = where.Y() + seg->GetPositionY();
         posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
         gMC->Gspos(PlaneSegmentName(segNum).Data(), 1, 
                   QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
@@ -2017,8 +2014,8 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
          if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
   
           // Position
-          posX = where.X() + motifPos->Position().X() + fgkOffsetX;
-          posY = where.Y() + motifPos->Position().Y() + fgkOffsetY;
+          posX = where.X() + motifPos->GetPositionX() + fgkOffsetX;
+          posY = where.Y() + motifPos->GetPositionY() + fgkOffsetY;
          posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
           gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
         }  
@@ -2034,12 +2031,6 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
 
           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
           
-#ifdef WITH_STL
-          if (find(alreadyDone.begin(),alreadyDone.end(),motifPosId)
-              != alreadyDone.end()) continue; // don't treat the same motif twice
-
-#endif
-#ifdef WITH_ROOT
           Bool_t isDone = false;
          Int_t i=0;
          while (i<nofAlreadyDone && !isDone) {
@@ -2047,7 +2038,6 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
            i++;
          }  
          if (isDone) continue; // don't treat the same motif twice
-#endif
 
           AliMUONSt1SpecialMotif spMot = *((AliMUONSt1SpecialMotif*)specialMap.GetValue(motifPosId));
          AliDebugStream(2) << chamber << " processing special motif: " << motifPosId << endl;  
@@ -2061,8 +2051,8 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
           // place the hole for the motif, wrt the requested rotation angle
           Int_t rot = ( spMot.GetRotAngle()<0.1 ) ? reflZ:rotMat;
 
-          posX = where.X() + motifPos->Position().X() + spMot.GetDelta().X();
-          posY = where.Y() + motifPos->Position().Y() + spMot.GetDelta().Y();
+          posX = where.X() + motifPos->GetPositionX() + spMot.GetDelta().X();
+          posY = where.Y() + motifPos->GetPositionY() + spMot.GetDelta().Y();
           posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
           // Shift the hole for special motif 46 to avoid debording into S047
           if ( copyNo == 2070 ) {
@@ -2082,14 +2072,10 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
          posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
           gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
 
-#ifdef WITH_STL
-          alreadyDone.push_back(motifPosId);// mark this motif as done
-#endif
-#ifdef WITH_ROOT
           if (nofAlreadyDone == alreadyDone.GetSize()) 
             alreadyDone.Set(2*nofAlreadyDone); 
           alreadyDone.AddAt(motifPosId, nofAlreadyDone++);               
-#endif
+
          AliDebugStream(2) << chamber << " processed motifPosId: " << motifPosId << endl;
        }               
 // COMMENT OUT END
@@ -2227,8 +2213,8 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
   GReal_t maxStepAlu   = fMUON->GetMaxStepAlu();
   GReal_t maxDestepAlu = fMUON->GetMaxDestepAlu();
   // GReal_t maxStepGas   = fMUON->GetMaxStepGas();
-  Int_t iSXFLD   = gAlice->Field()->PrecInteg();
-  Float_t sXMGMX = gAlice->Field()->Max();
+  Int_t iSXFLD   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->PrecInteg();
+  Float_t sXMGMX = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
 
   fMUON->AliMedium(21, "ALU_II$",    41, 0, iSXFLD, sXMGMX, 
                    tmaxfd, maxStepAlu, maxDestepAlu, epsil, stmin);