]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONContourHandler.cxx
Fixing Coverity UNINIT defect
[u/mrichter/AliRoot.git] / MUON / AliMUONContourHandler.cxx
index 16c14efa165cc00d74ebbb0c28d28668f2b8e602..02529fa8da88b9767d5d2e0899248da90d3bf7ad 100644 (file)
@@ -70,9 +70,15 @@ fAllContourArray(0x0)
   /// before you've loaded the mapping in memory (see e.g. AliMpCDB::LoadDDLStore)
   ///
   
-  fTransformations = GenerateTransformations(explodedView);
+  if ( explodedView ) 
+  {
+    fTransformations = GenerateTransformations(explodedView);
+  }
+  
   AliMUONManuContourMaker manuMaker(fTransformations);
+  
   TObjArray* manus = manuMaker.GenerateManuContours(kTRUE);
+  
   if (manus)
   {
     manus->SetOwner(kFALSE);
@@ -85,6 +91,7 @@ fAllContourArray(0x0)
 AliMUONContourHandler::~AliMUONContourHandler()
 {
   /// Dtor
+  delete fTransformations;
   delete fAllContourMap;
   delete fAllContourArray;
 }
@@ -120,8 +127,15 @@ AliMUONContourHandler::CreateContourList(const TObjArray& manuContours)
   /// of station0/chamber0 and station0/chamber1 in the example above).
   ///
   
-  AliCodeTimerAuto("");
+  AliCodeTimerAuto("",0);
+  
+  Int_t start(0);
   
+  if ( !fTransformations )
+  {
+    start = 2; // skip chamber and station contours, as we seem to be in 3D
+  }
+    
   TIter next(&manuContours);
   AliMUONContour* contour;
   TObjArray* mapArray = new TObjArray;
@@ -132,7 +146,7 @@ AliMUONContourHandler::CreateContourList(const TObjArray& manuContours)
     
     TString key(contour->GetName());
     TObjArray* s = key.Tokenize("/");
-    for ( Int_t i = 0; i < s->GetLast(); ++i ) 
+    for ( Int_t i = start; i < s->GetLast(); ++i ) 
     {
       TMap* m = static_cast<TMap*>(mapArray->At(i));
       if (!m)
@@ -179,14 +193,11 @@ AliMUONContourHandler::GenerateAllContours(const TObjArray& manuContours)
   /// Note that manuContours should NOT be the owner of its contours,
   /// as they are adopted by the array returned by this method.
   
-  AliCodeTimerAuto("");
+  AliCodeTimerAuto("",0);
   
   // Get the list of contours to create
   TObjArray* mapArray = CreateContourList(manuContours);
   
-  // Now loop over the mapArray to actually create the contours
-  TIter next2(mapArray,kIterBackward);
-  
   fAllContourMap = new TMap(20000,1);
   fAllContourMap->SetOwnerKeyValue(kTRUE,kTRUE);
   
@@ -267,7 +278,7 @@ AliMUONContourHandler::GenerateTransformations(Bool_t exploded)
   /// If exploded=kFALSE then we generate real transformations, otherwise
   /// we generate tweaked ones that look fine on screen.
   
-  AliCodeTimerAuto("");
+  AliCodeTimerAuto("",0);
   
   AliMUONGeometryTransformer transformer;
   Bool_t ok = transformer.LoadGeometryData("transform.dat");
@@ -337,4 +348,11 @@ AliMUONContourHandler::Print(Option_t* opt) const
                  fAllContourMap->GetSize(),
                  fAllContourMap->Capacity()) << endl;
   }
+  TString sopt(opt);
+  sopt.ToUpper();
+  
+  if ( sopt.Contains("ALL") || sopt.Contains("FULL") )
+  {
+    fAllContourMap->Print();
+  }
 }