]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
1. Added getting detElemId in StepManager, to be stored later in the hit. 2.Added...
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Sep 2004 11:42:14 +0000 (11:42 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Sep 2004 11:42:14 +0000 (11:42 +0000)
MUON/AliMUONv1.cxx
MUON/AliMUONv1.h

index d1ace1b2ca82432d7b83581b71819f9bd0fc1b40..e56042e3a02d6eb2c5f20b1b28c8e8872345ff57 100644 (file)
@@ -24,6 +24,7 @@
 #include <TClonesArray.h>
 #include <TRandom.h> 
 #include <TVirtualMC.h>
+#include <TGeoMatrix.h>
 
 #include "AliMUONv1.h"
 #include "AliConst.h" 
@@ -33,6 +34,7 @@
 #include "AliMUONHit.h"
 #include "AliMUONTriggerCircuit.h"
 #include "AliMUONGeometryBuilder.h"    
+#include "AliMUONGeometrySVMap.h"      
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliMC.h"
@@ -158,6 +160,8 @@ void AliMUONv1::CreateMaterials()
   fGeometryBuilder->CreateMaterials();
 }
 
+#include "AliMUONChamberGeometry.h"    
+#include "AliMUONGeometryTransformStore.h"     
 //___________________________________________
 void AliMUONv1::Init()
 {
@@ -184,6 +188,25 @@ void AliMUONv1::Init()
    }
    if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
    //cp
+
+   //
+   // Debug info
+   //
+   if (GetDebug() >1) {
+     // Print transformations and SV map
+     for (i=0; i<AliMUONConstants::NCh(); i++) {
+       cout << "Chamber: " << i+1 << endl;
+       cout << "===================" << endl; 
+     
+       Chamber(i).GetGeometry()
+          ->GetTransformStore()->Print("");
+       Chamber(i).GetGeometry()
+          ->GetSVMap()->Print("");
+     }
+     cout << endl;
+   }  
 }
 
 //__________________________________________________________________
@@ -203,6 +226,32 @@ Int_t  AliMUONv1::GetChamberId(Int_t volId) const
 
   return 0;
 }
+
+//_______________________________________________________________________________
+TString  AliMUONv1::CurrentVolumePath() const
+{
+// Returns current volume path
+// (Could be removed when this function is available via gMC)
+// ---      
+
+  TString path = "";
+  TString name;
+  Int_t copyNo;
+  Int_t imother = 0;
+  do {
+    name = gMC->CurrentVolOffName(imother);
+    gMC->CurrentVolOffID(imother++, copyNo);
+    TString add = "/";
+    add += name;
+    add += ".";
+    add += copyNo;
+    path.Insert(0,add); 
+  }
+  while ( name != TString("ALIC") );
+  
+  return path;  
+}
+
 //_______________________________________________________________________________
 void AliMUONv1::StepManager()
 {
@@ -214,7 +263,7 @@ void AliMUONv1::StepManager()
   }
 
   // Only charged tracks
-  if( !(gMC->TrackCharge()) ) return; 
+  if( !(gMC->TrackCharge()) && !(gMC->TrackPid()==0) ) return; 
   // Only charged tracks
   
   // Only gas gap inside chamber
@@ -234,6 +283,18 @@ void AliMUONv1::StepManager()
   idvol = iChamber -1;
 
   if (idvol == -1) return;
+  
+  if (GetDebug() > 1) {
+    // Fill the global position of detection elements
+    // Only for verification 
+    AliMUONGeometrySVMap* svMap
+      =  Chamber(iChamber-1).GetGeometry()->GetSVMap();
+    Double_t x, y, z;
+    gMC->TrackPosition(x, y, z);          
+    svMap->AddPosition(CurrentVolumePath(), TGeoTranslation(x, y, z));
+  }   
+  
+  if (gMC->TrackPid()==0) return;
 
   // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
   if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )     
@@ -259,8 +320,7 @@ void AliMUONv1::StepManager()
   
 //   if (GetDebug()) {
 //     Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
-//       iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());
-//     Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
+//       iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());//     Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
 //     gMC->TrackPosition(fTrackPosition);
 //     Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
 //   }
@@ -313,6 +373,31 @@ void AliMUONv1::StepManager()
     }
     }
     
+    // Detection elements ids
+    AliMUONGeometryTransformStore* transforms
+      =  Chamber(iChamber-1).GetGeometry()->GetTransformStore();
+    const TGeoCombiTrans* kTransform
+      = transforms->FindBySensitiveVolume(CurrentVolumePath());
+      
+    Int_t detElemId = 0;
+    if (kTransform) detElemId = kTransform->GetUniqueID(); 
+    if (!detElemId) {
+      cerr << "Chamber id: "
+           << setw(3) << iChamber << "  "
+           << "Current SV: " 
+           <<  CurrentVolumePath() 
+          << "  detElemId: "
+           << setw(5) << detElemId 
+          << endl;
+      Double_t x, y, z;
+      gMC->TrackPosition(x, y, z);        
+      cerr << "   global position: "
+           << x << ", " << y << ", " << z
+           << endl;
+      Warning("StepManager", "DetElemId not identified.");
+    }  
+    
     // One hit per chamber
     GetMUONData()->AddHit(fIshunt, 
                          gAlice->GetMCApp()->GetCurrentTrackNumber(), 
@@ -522,3 +607,27 @@ void AliMUONv1::StepManagerOld()
       tlength += step ;
   }
 }
+
+//______________________________________________________________________________
+void   AliMUONv1::FinishRun()
+{
+// Print debug info 
+// ---
+
+  if (GetDebug() <= 1) return;
+
+  // Print the global positions of detection elements
+  for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
+
+    cout << "Chamber: " << i+1 << endl;
+    cout << "===================" << endl; 
+     
+    AliMUONGeometrySVMap* svMap
+      = Chamber(i).GetGeometry()->GetSVMap();
+      
+    svMap->SortPositions();
+    svMap->PrintPositions();
+    svMap->ClearPositions();
+  }
+  cout << endl;           
+}  
index 921069126b81b125d05f7ba441ec07ef9427f8d8..ce7410bb7ccfc9884d4728f28d22816c462fc110 100644 (file)
@@ -30,6 +30,7 @@ class AliMUONv1 : public AliMUON
    virtual void   Init();
    virtual Int_t  IsVersion() const {return 1;}
    virtual void   StepManager();
+   virtual void   FinishRun();
    void StepManagerOld();
    void SetStepManagerVersionOld(Bool_t Opt) 
      { fStepManagerVersionOld = Opt; }
@@ -43,6 +44,7 @@ class AliMUONv1 : public AliMUON
    AliMUONv1&  operator = (const AliMUONv1& right);
 
    virtual Int_t  GetChamberId(Int_t volId) const;
+   TString CurrentVolumePath() const;       
 
    Bool_t  fStepManagerVersionOld; // Version of StepManager, Default is false
    Bool_t  fAngleEffect; // Angle Effect along wires, Default is true
@@ -58,15 +60,7 @@ class AliMUONv1 : public AliMUON
    TF1 *          fAngleEffect10; // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)  
    TF1 *          fAngleEffectNorma;// Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)
 
- private:
-   // method
-   void PlaceVolume(const TString& name, const TString& mName, Int_t copyNo, 
-             const TGeoHMatrix& matrix, Int_t npar, Double_t* param,
-            const char* only) const;
-
-   ClassDef(AliMUONv1,2)  // MUON Detector class Version 1
-
-
+   ClassDef(AliMUONv1,3)  // MUON Detector class Version 1
 };
 #endif