]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALEMCGeometry.cxx
Update from satyajit: HM Analysis
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALEMCGeometry.cxx
index 4e4aa0c7c4ca43c87fa37073f05964c2690e7e7c..73dc0f1079fea136ae3358b054c19ad40efbcf6e 100644 (file)
 //   EMCAL_COMPLETE (geometry for expected complete detector)
 //      = equivalent to SHISH_77_TRD1_2X2_FINAL_110DEG scTh=0.176 pbTh=0.144
 //          in old notation
+//
+//   EMCAL_FIRSTYEAR - geometry for December 2009 to December 2010 run period
+//                     with four Super Modules
+//  
+//   Adding V1 (EMCAL_FIRSTYEARV1, EMCAL_COMPLETEV1) - geometry from December 2009 ; 
+//                1. Fixed bug for positions of modules inside SM
+//                   (first module has tilt 0.75 degree);
+//                2. Added Al front plate (width 1 cm) and 2 paper sheets per sampling
+//                   layer (additional 0.2 mm) 
+//                   The sizes have updated with last information from production
+//                   drawing (end of October 2010). 
+//                3. COMPLETEV1 contains now only 10 SM for runs for year 2011
+//                4. COMPLETE12SMV1 contains 12 SM for runs from year 2012 and on
+//                5. COMPLETE12SMV1_DCAL contains 12 SM and 6 DCal SM
+//                6. COMPLETE12SMV1_DCAL_DEV contains 12 SM and 10 DCal SM
+//               7. COMPLETE12SMV1_DCAL_8SM contains 12 SM and 6 DCal SM and 2 extentions
+//
 //   EMCAL_WSUC (Wayne State test stand)
 //      = no definite equivalent in old notation, was only used by
 //          Aleksei, but kept for testing purposes
@@ -47,6 +64,7 @@
 //     and  : Jennifer Klay (LBL)
 //     and  : Aleksei Pavlinov (WSU) 
 //     and  : Magali Estienne (SUBATECH)
+//     and  : Adapted for DCAL by M.L. Wang CCNU Wuhan & Subatech Oct-23-2009
 
 // --- Root header files ---
 #include <TObjArray.h>
@@ -64,27 +82,28 @@ ClassImp(AliEMCALEMCGeometry)
 
 // these initialisations are needed for a singleton
 Bool_t    AliEMCALEMCGeometry::fgInit      = kFALSE;
-const Char_t*   AliEMCALEMCGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE";
+const Char_t*   AliEMCALEMCGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE12SMV1";
 
 
 AliEMCALEMCGeometry::AliEMCALEMCGeometry() 
   : TNamed(),
-    fGeoName(0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
+    fGeoName(0),fEMCSMSystem(0x0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
     fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
-    fShellThickness(0.),fZLength(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
+    fShellThickness(0.),fZLength(0.),fDCALInnerEdge(0.),fDCALPhiMin(0),fDCALPhiMax(0),fEMCALPhiMax(0),
+    fDCALStandardPhiMax(0),fDCALInnerExtandedEta(0),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
     fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
-    fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),
+    fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fPhiSuperModule(0),fNPhiSuperModule(0),
     fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
     // Trigger staff
-    fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0),
+    fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0), fNTotalTRU(0),
     // 
-    fTrd1Angle(0.),f2Trd1Dx2(0.),
-    fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0),fEtaMaxOfTRD1(0),
+    fTrd1Angle(0.),f2Trd1Dx2(0.),fPhiGapForSM(0.),fKey110DEG(0),fnSupModInDCAL(0),fPhiBoundariesOfSM(0),
+    fPhiCentersOfSM(0),fPhiCentersOfSMSec(0),fEtaMaxOfTRD1(0),fTrd1AlFrontThick(0.0), fTrd1BondPaperThick(0.),
     fCentersOfCellsEtaDir(0), fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
     fEtaCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(0),
-    fILOSS(-1), fIHADR(-1),
+    fParSM(), fILOSS(-1), fIHADR(-1),
     //obsolete member data
-    fAlFrontThick(0.), fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
+     fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
     f2Trd2Dy2(0.), fEmptySpace(0.), fTubsR(0.), fTubsTurnAngle(0.)
 { 
   // default ctor only for internal usage (singleton)
@@ -97,30 +116,32 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry()
   AliDebug(2, "AliEMCALEMCGeometry : default ctor ");
 }
 //______________________________________________________________________
-AliEMCALEMCGeometry::AliEMCALEMCGeometry(const Text_t* name, const Text_t* title) :
+AliEMCALEMCGeometry::AliEMCALEMCGeometry(const Text_t* name, const Text_t* title,
+                                         const Text_t* mcname, const Text_t* mctitle ) :
   TNamed(name,title),
-    fGeoName(0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
+    fGeoName(0),fEMCSMSystem(0x0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
     fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
-    fShellThickness(0.),fZLength(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
+    fShellThickness(0.),fZLength(0.),fDCALInnerEdge(0.),fDCALPhiMin(0),fDCALPhiMax(0),fEMCALPhiMax(0),
+    fDCALStandardPhiMax(0),fDCALInnerExtandedEta(0),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
     fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
-    fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),
+    fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fPhiSuperModule(0),fNPhiSuperModule(0),
     fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
     // Trigger staff
-    fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0),
+    fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0), fNTotalTRU(0),
     // 
-    fTrd1Angle(0.),f2Trd1Dx2(0.),
-    fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0), fEtaMaxOfTRD1(0),
+    fTrd1Angle(0.),f2Trd1Dx2(0.),fPhiGapForSM(0.),fKey110DEG(0),fnSupModInDCAL(0),fPhiBoundariesOfSM(0),
+    fPhiCentersOfSM(0),fPhiCentersOfSMSec(0),fEtaMaxOfTRD1(0),fTrd1AlFrontThick(0.0), fTrd1BondPaperThick(0.),
     fCentersOfCellsEtaDir(0),fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
     fEtaCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(0),
-    fILOSS(-1), fIHADR(-1), 
+    fParSM(),fILOSS(-1), fIHADR(-1), 
     //obsolete member data
-    fAlFrontThick(0.), fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
+    fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
     f2Trd2Dy2(0.), fEmptySpace(0.), fTubsR(0.), fTubsTurnAngle(0.)
 {
   // ctor only for internal usage (singleton)
-  AliDebug(2, Form("AliEMCALEMCGeometry(%s,%s) ", name,title));
+  AliDebug(2, Form("AliEMCALEMCGeometry(%s,%s,%s,%s) ", name,title,mcname,mctitle));
 
-  Init();
+  Init(mcname,mctitle);
 
   //  CreateListOfTrd1Modules();
 
@@ -133,6 +154,7 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const Text_t* name, const Text_t* title
 AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
   : TNamed(geom),
     fGeoName(geom.fGeoName),
+    fEMCSMSystem(geom.fEMCSMSystem),
     fArrayOpts(geom.fArrayOpts),
     fNAdditionalOpts(geom.fNAdditionalOpts),
     fECPbRadThickness(geom.fECPbRadThickness),
@@ -145,6 +167,12 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
     fIPDistance(geom.fIPDistance),
     fShellThickness(geom.fShellThickness),
     fZLength(geom.fZLength),
+    fDCALInnerEdge(geom.fDCALInnerEdge),
+    fDCALPhiMin(geom.fDCALPhiMin),
+    fDCALPhiMax(geom.fDCALPhiMax),
+    fEMCALPhiMax(geom.fEMCALPhiMax),
+    fDCALStandardPhiMax(geom.fDCALStandardPhiMax),
+    fDCALInnerExtandedEta(geom.fDCALInnerExtandedEta),
     fNZ(geom.fNZ),
     fNPhi(geom.fNPhi),
     fSampling(geom.fSampling),
@@ -157,6 +185,7 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
     fPhiTileSize(geom.fPhiTileSize),
     fEtaTileSize(geom.fEtaTileSize),
     fLongModuleSize(geom.fLongModuleSize),
+    fPhiSuperModule(geom.fPhiSuperModule),
     fNPhiSuperModule(geom.fNPhiSuperModule),
     fNPHIdiv(geom.fNPHIdiv),
     fNETAdiv(geom.fNETAdiv),
@@ -169,14 +198,19 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
     fNModulesInTRUEta(geom.fNModulesInTRUEta),
     fNModulesInTRUPhi(geom.fNModulesInTRUPhi),
     fNEtaSubOfTRU(geom.fNEtaSubOfTRU),
+    fNTotalTRU(geom.fNTotalTRU),
     //
     fTrd1Angle(geom.fTrd1Angle),
     f2Trd1Dx2(geom.f2Trd1Dx2),
     fPhiGapForSM(geom.fPhiGapForSM),
     fKey110DEG(geom.fKey110DEG),
+    fnSupModInDCAL(geom.fnSupModInDCAL),
     fPhiBoundariesOfSM(geom.fPhiBoundariesOfSM),
     fPhiCentersOfSM(geom.fPhiCentersOfSM),
+    fPhiCentersOfSMSec(geom.fPhiCentersOfSMSec),
     fEtaMaxOfTRD1(geom.fEtaMaxOfTRD1),
+    fTrd1AlFrontThick(geom.fTrd1AlFrontThick),
+    fTrd1BondPaperThick(geom.fTrd1BondPaperThick),
     fCentersOfCellsEtaDir(geom.fCentersOfCellsEtaDir),
     fCentersOfCellsXDir(geom.fCentersOfCellsXDir),
     fCentersOfCellsPhiDir(geom.fCentersOfCellsPhiDir),
@@ -185,7 +219,6 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
     fShishKebabTrd1Modules(geom.fShishKebabTrd1Modules),
     fILOSS(geom.fILOSS), fIHADR(geom.fIHADR),
     //obsolete member data
-    fAlFrontThick(geom.fAlFrontThick),
     fGap2Active(geom.fGap2Active),
     fSteelFrontThick(geom.fSteelFrontThick),
     fTrd2AngleY(geom.fTrd2AngleY),
@@ -208,10 +241,11 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
 //______________________________________________________________________
 AliEMCALEMCGeometry::~AliEMCALEMCGeometry(void){
     // dtor
+ delete fEMCSMSystem;
 }
 
 //______________________________________________________________________
-void AliEMCALEMCGeometry::Init(void){
+void AliEMCALEMCGeometry::Init(const Text_t* mcname, const Text_t* mctitle){
   //
   // Initializes the EMCAL parameters based on the name
   // Only Shashlyk geometry is available, but various combinations of
@@ -241,25 +275,44 @@ void AliEMCALEMCGeometry::Init(void){
       fGeoName = "EMCAL_PDC06";
     }
   }
+  
   if(fGeoName.Contains("WSUC")) fGeoName = "EMCAL_WSUC";
 
   //check that we have a valid geometry name
-  if(!(fGeoName.Contains("EMCAL_PDC06") || fGeoName.Contains("EMCAL_COMPLETE") || fGeoName.Contains("EMCAL_WSUC") || fGeoName.Contains("EMCAL_FIRSTYEAR"))) {
+  if(!( fGeoName.Contains("EMCAL_PDC06")
+     || fGeoName.Contains("EMCAL_WSUC")  
+     || fGeoName.Contains("EMCAL_COMPLETE")
+     || fGeoName.Contains("EMCAL_COMPLETEV1")
+     || fGeoName.Contains("EMCAL_COMPLETE12SMV1") 
+     || fGeoName.Contains("EMCAL_FIRSTYEAR")
+     || fGeoName.Contains("EMCAL_FIRSTYEARV1") )) {
     Fatal("Init", "%s is an undefined geometry!", fGeoName.Data()) ; 
   }
 
   // Option to know whether we have the "half" supermodule(s) or not
   fKey110DEG = 0;
-  if(fGeoName.Contains("COMPLETE") || fGeoName.Contains("PDC06")) fKey110DEG = 1; // for GetAbsCellId
+  if(  fGeoName.Contains("COMPLETE")
+    || fGeoName.Contains("PDC06") 
+    || fGeoName.Contains("12SM")) fKey110DEG = 1; // for GetAbsCellId
+  if(fGeoName.Contains("COMPLETEV1"))  fKey110DEG = 0; 
   fShishKebabTrd1Modules = 0;
 
+  fnSupModInDCAL = 0;
+  if(fGeoName.Contains("DCAL_DEV")){
+    fnSupModInDCAL = 10;  
+  } else if(fGeoName.Contains("DCAL_8SM")){
+    fnSupModInDCAL = 8;
+  } else if(fGeoName.Contains("DCAL")){
+    fnSupModInDCAL = 6;
+  }
+
   // JLK 13-Apr-2008
   //default parameters are those of EMCAL_COMPLETE geometry
   //all others render variations from these at the end of
   //geometry-name specific options
 
   fNumberOfSuperModules = 12;       // 12 = 6 * 2 (6 in phi, 2 in Z)
-  fNPhi                 = 12;      // module granularity in phi within smod (azimuth)
+  fNPhi                 = 12;       // module granularity in phi within smod (azimuth)
   fNZ                   = 24;       // module granularity along Z within smod (eta)
   fNPHIdiv = fNETAdiv   = 2;        // tower granularity within module
   fArm1PhiMin           = 80.0;            // degrees, Starting EMCAL Phi position
@@ -282,7 +335,8 @@ void AliEMCALEMCGeometry::Init(void){
   fEtaModuleSize = fPhiModuleSize;
 
   fZLength              = 700.;     // Z coverage (cm)
-
+  fPhiSuperModule       = 20. ;     // phi in degree
+  fDCALInnerEdge        = fIPDistance * TMath::Tan( fTrd1Angle * 8.* TMath::DegToRad());
 
   //needs to be called for each geometry and before setting geometry
   //parameters which can depend on the outcome
@@ -296,27 +350,124 @@ void AliEMCALEMCGeometry::Init(void){
 
   //modifications to the above for WSUC geometry
   if(fGeoName.Contains("WSUC")){ // 18-may-05 - about common structure
-    fPhiModuleSize = 12.5;     // 20-may-05 - rectangular shape
-    fEtaModuleSize = 11.9;
-    fECScintThick  = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov)
-    fNumberOfSuperModules = 1; // 27-may-05
-    fShellThickness = 30.;       // should be change 
+    fNumberOfSuperModules = 2;  // 27-may-05; Nov 24,2010 for TB
     fNPhi = fNZ = 4; 
+    fTrd1AlFrontThick   = 1.0;  // one cm
+    // Bond paper - two sheets around Sc tile
+    fTrd1BondPaperThick = 0.01; // 0.01cm = 0.1 mm
+    
+    fPhiModuleSize = 12.0;
+    fEtaModuleSize = fPhiModuleSize;
+    fLateralSteelStrip = 0.015; // 0.015cm  = 0.15mm
+
     CheckAdditionalOptions();
   }
 
   //In 2009-2010 data taking runs only 4 SM, in the upper position.
   if(fGeoName.Contains("FIRSTYEAR")){  
-       fNumberOfSuperModules = 4;      
-       fArm1PhiMax           = 120.0; 
-       CheckAdditionalOptions();       
-  }    
-       
+    fNumberOfSuperModules = 4; 
+    fArm1PhiMax           = 120.0;
+    CheckAdditionalOptions();  
+  }
+  
+  if(fGeoName.Contains("FIRSTYEARV1") || fGeoName.Contains("COMPLETEV1") || fGeoName.Contains("COMPLETE12SMV1") ){
+    // Oct 26,2010 : First module has tilt = 0.75 degree : 
+    // look to AliEMCALShishKebabTrd1Module::DefineFirstModule(key)
+    // New sizes from production drawing, added Al front plate.
+    // The thickness of sampling is change due to existing two sheets of paper.
+    
+    // Will replace fFrontSteelStrip
+    fTrd1AlFrontThick   = 1.0;  // one cm
+    // Bond paper - two sheets around Sc tile
+    fTrd1BondPaperThick = 0.01; // 0.01cm = 0.1 mm
+    
+    fPhiModuleSize = 12.0;
+    fEtaModuleSize = fPhiModuleSize;
+    fLateralSteelStrip = 0.015; // 0.015cm  = 0.15mm
+    
+    if(fGeoName.Contains("COMPLETEV1"))
+    {
+      fNumberOfSuperModules = 10;      
+      fArm1PhiMax           = 180.0;
+    }
+    else if (fGeoName.Contains("COMPLETE12SMV1"))
+    {
+      fNumberOfSuperModules = 12;      
+      fArm1PhiMax           = 200.0; 
+    }
+    if (fGeoName.Contains("DCAL"))
+    {
+      fNumberOfSuperModules = 12 + fnSupModInDCAL;
+      fArm1PhiMax           = 320.0; 
+      if(fGeoName.Contains("DCAL_8SM"))      fArm1PhiMax      = 340.0;     // degrees, End of DCAL Phi position
+      else if(fGeoName.Contains("DCAL_DEV")) fArm1PhiMin      = 40.0;      // degrees, Starting EMCAL(shifted) Phi position
+      fDCALPhiMin           = fArm1PhiMax - 10.*fnSupModInDCAL; 
+    }
+    CheckAdditionalOptions();  
+  }
+
+   fEMCSMSystem = new Int_t[fNumberOfSuperModules];
+   Int_t iSM = 0;
+
+ // BASIC EMCAL SM
+   if(fGeoName.Contains("WSUC") ){
+     for(int i = 0; i<2; i++){
+       fEMCSMSystem[iSM] = kEMCAL_Standard;
+       iSM++;
+     }
+   } else if(fGeoName.Contains("FIRSTYEAR") ){
+     for(int i = 0; i<4; i++){
+       fEMCSMSystem[iSM] = kEMCAL_Standard;
+       iSM++;
+     }
+   } else if( fGeoName.Contains("PDC06")
+           || fGeoName.Contains("COMPLETE") ){
+     for(int i = 0; i<10; i++){
+       fEMCSMSystem[iSM] = kEMCAL_Standard;
+       iSM++;
+     }
+   }
+ // EMCAL 110SM
+   if(fKey110DEG && fGeoName.Contains("12SM") ){
+     for(int i = 0; i<2; i++){
+       fEMCSMSystem[iSM] = kEMCAL_Half;
+       if(fGeoName.Contains("12SMV1") ){
+         fEMCSMSystem[iSM] = kEMCAL_3rd;
+       }
+       iSM++;
+     }
+   }
+ // DCAL SM
+   if(fnSupModInDCAL && fGeoName.Contains("DCAL")){
+     if(fGeoName.Contains("8SM")) {
+       for(int i = 0; i<fnSupModInDCAL-2; i++){
+         fEMCSMSystem[iSM] = kDCAL_Standard;
+         iSM++;
+       }
+       for(int i = 0; i<2; i++){
+         fEMCSMSystem[iSM] = kDCAL_Ext;
+         iSM++;
+       }
+     } else {
+       for(int i = 0; i<fnSupModInDCAL; i++){
+         fEMCSMSystem[iSM] = kDCAL_Standard;
+         iSM++;
+       }
+     }
+   }
+
   // constant for transition absid <--> indexes
   fNCellsInModule = fNPHIdiv*fNETAdiv;
   fNCellsInSupMod = fNCellsInModule*fNPhi*fNZ;
-  fNCells         = fNCellsInSupMod*fNumberOfSuperModules;
-  if(GetKey110DEG()) fNCells -= fNCellsInSupMod;
+  fNCells = 0;
+   for( int i=0; i<fNumberOfSuperModules; i++) {
+     if(      GetSMType(i) == kEMCAL_Standard) fNCells +=   fNCellsInSupMod   ;
+     else if( GetSMType(i) == kEMCAL_Half)     fNCells +=   fNCellsInSupMod/2 ;
+     else if( GetSMType(i) == kEMCAL_3rd)      fNCells +=   fNCellsInSupMod/3 ;
+     else if( GetSMType(i) == kDCAL_Standard)  fNCells += 2*fNCellsInSupMod/3 ;
+     else if( GetSMType(i) == kDCAL_Ext)       fNCells +=   fNCellsInSupMod/3 ;
+     else AliError(Form("Uknown SuperModule Type !!"));
+   }
 
   fNPhiSuperModule = fNumberOfSuperModules/2;
   if(fNPhiSuperModule < 1) fNPhiSuperModule = 1;
@@ -325,7 +476,13 @@ void AliEMCALEMCGeometry::Init(void){
   fEtaTileSize = fEtaModuleSize/double(fNETAdiv) - fLateralSteelStrip; // 13-may-05 
 
   fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness);  
+  if(fGeoName.Contains("V1")){
+    Double_t ws = fECScintThick + fECPbRadThickness + 2.*fTrd1BondPaperThick; // sampling width
+    // Number of Pb tiles = Number of Sc tiles - 1
+    fLongModuleSize = fTrd1AlFrontThick + (ws*fNECLayers - fECPbRadThickness);
+  }
   f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.);
+
   if(!fGeoName.Contains("WSUC")) fShellThickness  = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2);
 
   //These parameters are used to create the mother volume to hold the supermodules
@@ -339,30 +496,62 @@ void AliEMCALEMCGeometry::Init(void){
   fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.;
   fParSM[2] = fZLength/4.;  //divide by 4 to get half-length of SM
 
-  // SM phi boundaries - (0,1),(2,3) .. (10,11) - has the same boundaries; Nov 7, 2006 
+  // SM phi boundaries - (0,1),(2,3) ... - has the same boundaries;
   fPhiBoundariesOfSM.Set(fNumberOfSuperModules);
   fPhiCentersOfSM.Set(fNumberOfSuperModules/2);
-  fPhiBoundariesOfSM[0] = TMath::PiOver2() - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules)
-  fPhiCentersOfSM[0]     = TMath::PiOver2();
-  if(fNumberOfSuperModules > 1) 
-    fPhiBoundariesOfSM[1] = TMath::PiOver2() + TMath::ATan2(fParSM[1] , fIPDistance);
-  if(fNumberOfSuperModules > 2) {
-       Int_t maxPhiBlock =fNumberOfSuperModules/2-1;
-       if(fNumberOfSuperModules > 10) maxPhiBlock = 4;
-    for(int i=1; i<=maxPhiBlock; i++) { // from 2th ro 9th
-      fPhiBoundariesOfSM[2*i]   = fPhiBoundariesOfSM[0] + 20.*TMath::DegToRad()*i;
-      fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[1] + 20.*TMath::DegToRad()*i;
-      fPhiCentersOfSM[i]        = fPhiCentersOfSM[0]     + 20.*TMath::DegToRad()*i;
+  fPhiCentersOfSMSec.Set(fNumberOfSuperModules/2);
+  Double_t kfSupermodulePhiWidth = fPhiSuperModule*TMath::DegToRad();
+  fPhiCentersOfSM[0]    = (fArm1PhiMin + fPhiSuperModule/2.) * TMath::DegToRad(); // Define from First SM
+  fPhiCentersOfSMSec[0] = fPhiCentersOfSM[0];  // the same in the First SM
+  fPhiBoundariesOfSM[0] = fPhiCentersOfSM[0] - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules)
+  fPhiBoundariesOfSM[1] = fPhiCentersOfSM[0] + TMath::ATan2(fParSM[1] , fIPDistance);
+  if(fNumberOfSuperModules > 2) { // 2 to Max
+    Int_t tmpSMType = GetSMType(2);
+     for(int i = 1; i<fNPhiSuperModule; i++) {
+       fPhiBoundariesOfSM[2*i]   += fPhiBoundariesOfSM[2*i-2] + kfSupermodulePhiWidth;
+       if(tmpSMType == GetSMType(2*i)) {
+         fPhiBoundariesOfSM[2*i+1]  += fPhiBoundariesOfSM[2*i-1] + kfSupermodulePhiWidth;
+       } else { 
+         //changed SM Type, redefine the [2*i+1] Boundaries
+         tmpSMType = GetSMType(2*i);
+         if(        GetSMType(2*i)  == kEMCAL_Standard) {
+           fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[2*i] + kfSupermodulePhiWidth;
+         } else if( GetSMType(2*i)  == kEMCAL_Half)     {
+           fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[2*i] + 2.*TMath::ATan2((fParSM[1])/2, fIPDistance);
+         } else if( GetSMType(2*i)  == kEMCAL_3rd )     {
+           fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[2*i] + 2.*TMath::ATan2((fParSM[1])/3, fIPDistance);
+         } else if( GetSMType(2*i)  == kDCAL_Standard ) {      // jump the gap
+           fPhiBoundariesOfSM[2*i]   = (fDCALPhiMin - fArm1PhiMin)*TMath::DegToRad() + fPhiBoundariesOfSM[0];
+           fPhiBoundariesOfSM[2*i+1] = (fDCALPhiMin - fArm1PhiMin)*TMath::DegToRad() + fPhiBoundariesOfSM[1];
+         } else if( GetSMType(2*i)  == kDCAL_Ext)       {
+           fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[2*i] + 2.*TMath::ATan2((fParSM[1])/3, fIPDistance); 
+         }
+      }
+      fPhiCentersOfSM[i]    = (fPhiBoundariesOfSM[2*i]+fPhiBoundariesOfSM[2*i+1])/2.;
+      fPhiCentersOfSMSec[i] = fPhiBoundariesOfSM[2*i] + TMath::ATan2(fParSM[1] , fIPDistance);
     }
   }
-  if(fNumberOfSuperModules > 10) {
-    fPhiBoundariesOfSM[11] = 190.*TMath::DegToRad();
-    fPhiBoundariesOfSM[10] = fPhiBoundariesOfSM[11] - TMath::ATan2((fParSM[1]) , fIPDistance);
-    fPhiCentersOfSM[5]     = (fPhiBoundariesOfSM[10]+fPhiBoundariesOfSM[11])/2.; 
-  }
 
+  //inner extend in eta (same as outer part) for DCal (0.189917), //calculated from the smallest gap (1# cell to the 80-degree-edge),
+  Double_t fInnerExtandedPhi = 1.102840997; //calculated from the smallest gap (1# cell to the 80-degree-edge), too complicatd to explain...
+  fDCALInnerExtandedEta = -TMath::Log(TMath::Tan( (TMath::Pi()/2. - 8*fTrd1Angle*TMath::DegToRad() + (TMath::Pi()/2 - fNZ*fTrd1Angle*TMath::DegToRad() - TMath::ATan(TMath::Exp(fArm1EtaMin))*2))/2.));
+
+  fEMCALPhiMax  = fArm1PhiMin;    
+  fDCALPhiMax   = fDCALPhiMin;// DCAl extention will not be included
+  for( Int_t i = 0; i < fNumberOfSuperModules; i+=2) {
+    if(      GetSMType(i) == kEMCAL_Standard ) fEMCALPhiMax += 20.;
+    else if( GetSMType(i) == kEMCAL_Half     ) fEMCALPhiMax += fPhiSuperModule/2. + fInnerExtandedPhi;
+    else if( GetSMType(i) == kEMCAL_3rd      ) fEMCALPhiMax += fPhiSuperModule/3. + 4.0*fInnerExtandedPhi/3.0;
+    else if( GetSMType(i) == kDCAL_Standard  ) {fDCALPhiMax  += 20.; fDCALStandardPhiMax = fDCALPhiMax;}
+    else if( GetSMType(i) == kDCAL_Ext       ) fDCALPhiMax  += fPhiSuperModule/3. + 4.0*fInnerExtandedPhi/3.0;
+    else AliError("Unkown SM Type!!");
+  }
+// for compatible reason
+// if(fNumberOfSuperModules == 4) {fEMCALPhiMax = fArm1PhiMax ;}
+ if(fNumberOfSuperModules == 12) {fEMCALPhiMax = fArm1PhiMax ;}  
+  
   //called after setting of scintillator and lead layer parameters
-  DefineSamplingFraction();
+  DefineSamplingFraction(mcname,mctitle);
 
   
   // TRU parameters - Apr 29,08 by PAI. 
@@ -377,6 +566,18 @@ void AliEMCALEMCGeometry::Init(void){
   // 3*6*10 + 2*6*2 = 204 -> matrix (nphi(17), neta(12))
   fNEtaSubOfTRU     = 6;  
 
+  fNTotalTRU = 0;
+  for(Int_t i = 0; i < GetNumberOfSuperModules(); i++){
+    if(      GetSMType(i) == kEMCAL_Standard)  fNTotalTRU += 3;
+    else if( GetSMType(i) == kEMCAL_Half)      fNTotalTRU += 1;
+    else if( GetSMType(i) == kEMCAL_3rd)       fNTotalTRU += 1;
+    else if( GetSMType(i) == kDCAL_Standard)   fNTotalTRU += 3;
+    else if( GetSMType(i) == kDCAL_Ext)        fNTotalTRU += 1;
+    else {
+      AliError(Form("Uknown SuperModule Type !!"));
+    }
+  }
+
   fgInit = kTRUE; 
 }
 
@@ -391,6 +592,11 @@ void AliEMCALEMCGeometry::PrintGeometry()
       printf(" %i : %s \n", i, o->String().Data());
     }
   }
+  if(fGeoName.Contains("DCAL")) {
+   printf("Phi min of DCAL SuperModule: %7.1f, DCAL has %d SuperModule\n", fDCALPhiMin, fnSupModInDCAL);
+   printf("The DCAL inner edge is +- %7.1f\n", fDCALInnerEdge);
+    if(fGeoName.Contains("DCAL_8SM")) printf("DCAL has its 2 EXTENTION SM\n");
+  }
   printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ;
   printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f -> for EMCAL envelope only\n",  
           GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() );
@@ -406,17 +612,21 @@ void AliEMCALEMCGeometry::PrintGeometry()
   printf(" #of sampling layers %i(fNECLayers) \n", fNECLayers);
   printf(" fLongModuleSize     %6.3f cm \n", fLongModuleSize);
   printf(" #supermodule in phi direction %i \n", fNPhiSuperModule );
+  printf(" supermodule width in phi direction %f \n", fPhiSuperModule );
   printf(" fILOSS %i : fIHADR %i \n", fILOSS, fIHADR);
   printf(" fTrd1Angle %7.4f\n", fTrd1Angle);
   printf(" f2Trd1Dx2  %7.4f\n",  f2Trd1Dx2);
+  printf(" fTrd1AlFrontThick   %7.4f \n", fTrd1AlFrontThick);
+  printf(" fTrd1BondPaperThick %5.4f \n", fTrd1BondPaperThick);
   printf("SM dimensions(TRD1) : dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", 
         fParSM[0],fParSM[1],fParSM[2]);
   printf(" fPhiGapForSM  %7.4f cm (%7.4f <- phi size in degree)\n",  
         fPhiGapForSM, TMath::ATan2(fPhiGapForSM,fIPDistance)*TMath::RadToDeg());
-  if(GetKey110DEG()) printf(" Last two modules have size 10 degree in  phi (180<phi<190)\n");
+  if( fKey110DEG && !fGeoName.Contains("12SMV1") ) printf(" Last two modules have size 10 degree in  phi (180<phi<190)\n");
+  if( fKey110DEG && fGeoName.Contains("12SMV1")) printf(" Last two modules have size 6.6 degree in  phi (180<phi<186.6)\n");
   printf(" phi SM boundaries \n"); 
   for(int i=0; i<fPhiBoundariesOfSM.GetSize()/2.; i++) {
-    printf(" %i : %7.5f(%7.2f) -> %7.5f(%7.2f) : center %7.5f(%7.2f) \n", i, 
+    printf(" %i : %7.15f(%7.12f) -> %7.15f(%7.12f) : center %7.15f(%7.12f) \n", i, 
           fPhiBoundariesOfSM[2*i], fPhiBoundariesOfSM[2*i]*TMath::RadToDeg(),
           fPhiBoundariesOfSM[2*i+1], fPhiBoundariesOfSM[2*i+1]*TMath::RadToDeg(),
           fPhiCentersOfSM[i], fPhiCentersOfSM[i]*TMath::RadToDeg());
@@ -483,26 +693,58 @@ void AliEMCALEMCGeometry::CheckAdditionalOptions()
 }
 
 //__________________________________________________________________
-void AliEMCALEMCGeometry::DefineSamplingFraction()
+void AliEMCALEMCGeometry::DefineSamplingFraction(const Text_t* mcname, const Text_t* mctitle)
 {
   // Jun 05,2006
   // Look http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html
   // Keep for compatibilty
   //
+  
+  // Sampling factor for G3
+  fSampling = 10.87; // Default value - Nov 25,2010
   if(fNECLayers == 69) {        // 10% layer reduction
     fSampling = 12.55;
   } else if(fNECLayers == 61) { // 20% layer reduction
     fSampling = 12.80;
   } else if(fNECLayers == 77) {
-    if       (fECScintThick>0.159 && fECScintThick<0.161) { // original sampling fraction, equal layers
+    if(fGeoName.Contains("V1")){
+      fSampling = 10.87; //Adding paper sheets and cover plate; Nov 25,2010
+    } else if   (fECScintThick>0.159 && fECScintThick<0.161) { // original sampling fraction, equal layers
       fSampling = 12.327; // fECScintThick = fECPbRadThickness = 0.160;
     } else if (fECScintThick>0.175 && fECScintThick<0.177) { // 10% Pb thicknes reduction
       fSampling = 10.5; // fECScintThick = 0.176, fECPbRadThickness=0.144;
     } else if(fECScintThick>0.191 && fECScintThick<0.193) { // 20% Pb thicknes reduction
       fSampling = 8.93; // fECScintThick = 0.192, fECPbRadThickness=0.128;
     }
-
   }
+
+  // Default sampling factor for G3, modify it for other transport model
+  TString mcName  = mcname;
+  TString mcTitle = mctitle;
+
+  Float_t samplingFactorTranportModel = 1. ;
+  if     (mcName.Contains("Geant3")) samplingFactorTranportModel = 1.;//0.988 // Do nothing
+  else if(mcName.Contains("Fluka") ) samplingFactorTranportModel = 1.; // To be set
+  else if(mcName.Contains("Geant4")){
+    if(mcTitle.Contains("EMV"))      samplingFactorTranportModel = 1.096; // 0.906, 0.896 (OPT)
+    else                             samplingFactorTranportModel = 0.86; // 1.15 (CHIPS), 1.149 (BERT), 1.147 (BERT_CHIPS) 
+  }      
+  
+  AliDebug(2,Form("MC modeler <%s>, Title <%s>: Sampling %f, model fraction with respect to G3 %f, final sampling %f \n",
+               mcName.Data(),mcTitle.Data(),fSampling,samplingFactorTranportModel,fSampling*samplingFactorTranportModel));
+
+  
+  fSampling*=samplingFactorTranportModel;
+  
+}
+
+//________________________________________________________________________________________________
+Double_t AliEMCALEMCGeometry::GetPhiCenterOfSMSec(Int_t nsupmod) const
+{
+  //returns center of supermodule in phi
+  int i = nsupmod/2;
+  return fPhiCentersOfSMSec[i];
+
 }
 
 //________________________________________________________________________________________________
@@ -517,9 +759,9 @@ Double_t AliEMCALEMCGeometry::GetPhiCenterOfSM(Int_t nsupmod) const
 //________________________________________________________________________________________________
 Bool_t AliEMCALEMCGeometry::GetPhiBoundariesOfSM(Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const
 {
-  // 0<= nSupMod <=11; phi in rad
-    static int i;
-  if(nSupMod<0 || nSupMod >11) return kFALSE;
+  // 0<= nSupMod <=17; phi in rad
+  static int i;
+  if(nSupMod<0 || nSupMod >12+fnSupModInDCAL-1) return kFALSE;
   i = nSupMod/2;
   phiMin = (Double_t)fPhiBoundariesOfSM[2*i];
   phiMax = (Double_t)fPhiBoundariesOfSM[2*i+1];
@@ -529,13 +771,15 @@ Bool_t AliEMCALEMCGeometry::GetPhiBoundariesOfSM(Int_t nSupMod, Double_t &phiMin
 //________________________________________________________________________________________________
 Bool_t AliEMCALEMCGeometry::GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const
 {
-  // 0<= nPhiSec <=4; phi in rad
+  // 0<= nPhiSec <=max; phi in rad
   // 0;  gap boundaries between  0th&2th  | 1th&3th SM
   // 1;  gap boundaries between  2th&4th  | 3th&5th SM
   // 2;  gap boundaries between  4th&6th  | 5th&7th SM
   // 3;  gap boundaries between  6th&8th  | 7th&9th SM
   // 4;  gap boundaries between  8th&10th | 9th&11th SM
-  if(nPhiSec<0 || nPhiSec >4) return kFALSE;
+  // 5;  gap boundaries between 10th&12th | 11h&13th SM
+  //             ...
+  if(nPhiSec<0 || nPhiSec >5+fnSupModInDCAL/2-1) return kFALSE;
   phiMin = fPhiBoundariesOfSM[2*nPhiSec+1];
   phiMax = fPhiBoundariesOfSM[2*nPhiSec+2];
   return kTRUE;