Allowing modularity of the MUON geometry during the generation (geant) phase with...
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Mar 2005 09:28:34 +0000 (09:28 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Mar 2005 09:28:34 +0000 (09:28 +0000)
MUON/AliMUONFactoryV2.cxx
MUON/AliMUONFactoryV2.h
MUON/AliMUONTriggerCircuit.cxx

index 1a7116e6e5fa038c91cc4fb2e56809b3d3fbe76d..13a796f35861a62e7e93fa52a431c8206a123059 100644 (file)
@@ -32,6 +32,7 @@
 #include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryStore.h"
 #include "AliMUONGeometrySegmentation.h"
 #include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryStore.h"
 #include "AliMUONGeometrySegmentation.h"
+#include "AliMUONVGeometryDEIndexing.h"
 #include "AliMUONSt12QuadrantSegmentation.h"
 #include "AliMUONSt345SlatSegmentation.h"
 #include "AliMUONTriggerSegmentation.h"
 #include "AliMUONSt12QuadrantSegmentation.h"
 #include "AliMUONSt345SlatSegmentation.h"
 #include "AliMUONTriggerSegmentation.h"
@@ -93,6 +94,22 @@ AliMUONFactoryV2&  AliMUONFactoryV2::operator=(const AliMUONFactoryV2& rhs)
   return *this;  
 }    
           
   return *this;  
 }    
           
+//__________________________________________________________________________
+Bool_t AliMUONFactoryV2::IsGeometryDefined(Int_t ichamber)
+{
+// Return true, if det elements for the chamber with the given ichamber Id
+// are defined in geometry (the geometry builder for this chamber was activated)
+
+  if ( ! fMUON ||
+       ! fMUON->Chamber(ichamber).GetGeometry() ||
+       ! fMUON->Chamber(ichamber).GetGeometry()->GetDEIndexing() ||
+       ! fMUON->Chamber(ichamber).GetGeometry()->GetDEIndexing()->GetNofDetElements() )
+       
+    return kFALSE;
+  
+  return kTRUE;
+}  
+
 //__________________________________________________________________________
 void AliMUONFactoryV2::BuildCommon() 
 {
 //__________________________________________________________________________
 void AliMUONFactoryV2::BuildCommon() 
 {
@@ -967,14 +984,14 @@ void AliMUONFactoryV2::Build(AliMUON* where, const char* what)
     fMUON->SetMaxStepGas(0.1);
     fMUON->SetMaxStepAlu(0.1);
 
     fMUON->SetMaxStepGas(0.1);
     fMUON->SetMaxStepAlu(0.1);
 
-    // Build all stations
+    // Build stations
     BuildCommon();
     BuildCommon();
-    BuildStation1();
-    BuildStation2();
-    BuildStation3();
-    BuildStation4();
-    BuildStation5();
-    BuildStation6();
+    if (IsGeometryDefined(0))  BuildStation1();
+    if (IsGeometryDefined(2))  BuildStation2();
+    if (IsGeometryDefined(4))  BuildStation3();
+    if (IsGeometryDefined(6))  BuildStation4();
+    if (IsGeometryDefined(8))  BuildStation5();
+    if (IsGeometryDefined(10)) BuildStation6();
   } 
   else
     AliDebug(0,"Non default version of MUON selected. You have to construct yourself the MUON elements !!");
   } 
   else
     AliDebug(0,"Non default version of MUON selected. You have to construct yourself the MUON elements !!");
index d5541cd54a03862387b9ff2dfcbcf1adb1a92eb9..5dadce9e3dcbcac7ff890848ceea64b77ba6666c 100644 (file)
@@ -35,6 +35,7 @@ class AliMUONFactoryV2 : public  AliMUONFactory {
     AliMUONFactoryV2& operator=(const AliMUONFactoryV2& rhs);
 
   private:
     AliMUONFactoryV2& operator=(const AliMUONFactoryV2& rhs);
 
   private:
+    Bool_t IsGeometryDefined(Int_t ichamber);
     void BuildCommon();
     void BuildStation1();
     void BuildStation2();
     void BuildCommon();
     void BuildStation1();
     void BuildStation2();
index d5a0900ef02ce6ea93c811f6e152c4f6150fe3c4..6b0d737cc9b3ed4e073d07bae5e34910121304bd 100644 (file)
@@ -420,13 +420,18 @@ void AliMUONTriggerCircuit::LoadYPos2(){
   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
   AliMUONChamber*  iChamber;
   AliMUONGeometrySegmentation* segmentation;    
   AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");  
   AliMUONChamber*  iChamber;
   AliMUONGeometrySegmentation* segmentation;    
-
+  
 // first plane (11)
   chamber=11;
   cathode=1;
   iChamber = &(pMUON->Chamber(chamber-1));
   segmentation=iChamber->SegmentationModel2(cathode);
   
 // first plane (11)
   chamber=11;
   cathode=1;
   iChamber = &(pMUON->Chamber(chamber-1));
   segmentation=iChamber->SegmentationModel2(cathode);
   
+  if (!segmentation) {
+    AliWarning("Segmentation not defined.");
+    return;
+  }  
+
   for (istrip=0; istrip<16; istrip++) {
     code=fXcode[0][istrip];           // decode current strip
     idModule=Int_t(code/100);           // corresponding module Id.
   for (istrip=0; istrip<16; istrip++) {
     code=fXcode[0][istrip];           // decode current strip
     idModule=Int_t(code/100);           // corresponding module Id.
@@ -483,6 +488,11 @@ void AliMUONTriggerCircuit::LoadXPos2(){
   iChamber = &(pMUON->Chamber(chamber-1));
   segmentation=iChamber->SegmentationModel2(cathode);
   
   iChamber = &(pMUON->Chamber(chamber-1));
   segmentation=iChamber->SegmentationModel2(cathode);
   
+  if (!segmentation) {
+    AliWarning("Segmentation not defined.");
+    return;
+  }  
+  
   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.  
 // number of Y strips
   idDE = DetElemId(chamber, idModule);
   Int_t idModule=Module(fIdCircuit);        // corresponding module Id.  
 // number of Y strips
   idDE = DetElemId(chamber, idModule);