]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merging AliMUONv3 in AliMUONv1
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 May 2003 17:03:54 +0000 (17:03 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 May 2003 17:03:54 +0000 (17:03 +0000)
MUON/AliMUONv1.cxx
MUON/AliMUONv1.h

index a1a8f3588f7312278821ad5807da770b32ae07b3..2ea4d82118508479d0059a757762f62ace0043bd 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.41  2003/05/02 15:09:38  hristov
+Code for MUON Station1 (I.Hrivnacova)
+
 Revision 1.40  2003/01/28 13:21:06  morsch
 Improved response simulation for station 1.
 (M. Mac Cormick, I. Hrivnacova, D. Guez)
@@ -206,7 +209,10 @@ AliMUONv1::AliMUONv1() : AliMUON()
 // Constructor
     fChambers = 0;
     fStations = 0;
+    fStepManagerVersionOld = kFALSE;
+    fStepMaxInActiveGas = 0.6;
 }
+
  
 //___________________________________________
 AliMUONv1::AliMUONv1(const char *name, const char *title)
@@ -219,6 +225,9 @@ AliMUONv1::AliMUONv1(const char *name, const char *title)
 
     AliMUONFactory factory;
     factory.Build(this, title);
+
+    fStepManagerVersionOld = kFALSE;
+    fStepMaxInActiveGas = 0.6;
 }
 
 //___________________________________________
@@ -2088,8 +2097,69 @@ void AliMUONv1::Init()
    //cp
 
 }
-
 //___________________________________________
+void AliMUONv1::StepManager()
+{
+  if (fStepManagerVersionOld) {
+    StepManagerOld();
+    return;
+  }
+  // Volume id
+  Int_t   copy, id;
+  Int_t   idvol;
+  Int_t   iChamber=0;
+  // Particule id, pos and mom vectors, 
+  // theta, phi angles with respect the normal of the chamber, 
+  // spatial step, delta_energy and time of flight
+  Int_t          ipart;
+  TLorentzVector pos, mom;
+  Float_t        theta, phi, tof;
+  Float_t        destep, step;
+  const  Float_t kBig = 1.e10;
+
+  // Only charged tracks
+  if( !(gMC->TrackCharge()) ) return; 
+
+  // Only gas gap inside chamber
+  // Tag chambers and record hits when track enters 
+  idvol=-1;
+  id=gMC->CurrentVolID(copy);
+  for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
+    if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
+      iChamber = i;
+      idvol  = i-1;
+    }
+  }
+  if (idvol == -1) return;
+
+
+  // record hits when track enters ...
+  if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);  
+
+  if (gMC->TrackStep() > 0.) {
+    // Get current particle id (ipart), track position (pos)  and momentum (mom)
+    gMC->TrackPosition(pos);
+    gMC->TrackMomentum(mom);
+    ipart    = gMC->TrackPid();
+    theta    = mom.Theta()*kRaddeg;     // theta of track
+    phi      = mom.Phi()  *kRaddeg;     // phi of the track
+    tof      = gMC->TrackTime();        // Time of flight
+    //
+    // momentum loss and steplength in last step
+    destep = gMC->Edep();
+    step   = gMC->TrackStep();
+    //new hit
+    AddHit(fIshunt, gAlice->CurrentTrack(), iChamber, ipart, 
+          pos.X(), pos.Y(), pos.Z(), tof, mom.P(), 
+          theta, phi, step, destep);
+  }
+  // Track left chamber ...
+  if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
+    gMC->SetMaxStep(kBig);
+  }
+    
+}
+
 Int_t  AliMUONv1::GetChamberId(Int_t volId) const
 {
 // Check if the volume with specified  volId is a sensitive volume (gas) 
@@ -2104,7 +2174,7 @@ Int_t  AliMUONv1::GetChamberId(Int_t volId) const
 }
 
 //___________________________________________
-void AliMUONv1::StepManager()
+void AliMUONv1::StepManagerOld()
 {
   Int_t          copy, id;
   static Int_t   idvol;
index f0119ea12580a1a5398e3b92478dc96f62b3b46b..9c990a67d462e60015c1d99e9580d7f368387df6 100644 (file)
@@ -21,9 +21,16 @@ public:
    virtual void   Init();
    virtual Int_t  IsVersion() const {return 1;}
    virtual void   StepManager();
+   void StepManagerOld();
+   void SetStepManagerVersionOld(Bool_t Opt) 
+     { fStepManagerVersionOld = Opt; }
+   void SetStepMaxInActiveGas(Float_t StepMax)
+     {fStepMaxInActiveGas = StepMax; }
 protected:
+   Int_t*  fStations; //! allow to externally set which station to create
+   Bool_t  fStepManagerVersionOld; // Version of StepManager, Default is false
+   Float_t fStepMaxInActiveGas; // Step mas in active gas default 0.6cm
    virtual Int_t  GetChamberId(Int_t volId) const;
-   Int_t* fStations; //! allow to externally set which station to create
 private:
    ClassDef(AliMUONv1,1)  // MUON Detector class Version 1
 };