]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merging changes: Trigger, muondata and new step manager
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Sep 2003 08:42:56 +0000 (08:42 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Sep 2003 08:42:56 +0000 (08:42 +0000)
MUON/AliMUONv1.cxx
MUON/AliMUONv1.h

index 902f0209a440ef2c1eaa0f90ae0070d783a79a5a..68cced8fe2556792c24174274e7a4b37c5a3ee09 100644 (file)
@@ -18,7 +18,8 @@
 /////////////////////////////////////////////////////////
 //  Manager and hits classes for set:MUON version 0    //
 /////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////
 //  Manager and hits classes for set:MUON version 0    //
 /////////////////////////////////////////////////////////
-
+#include <TRandom.h>
+#include <TF1.h>
 #include <Riostream.h>
 #include <TClonesArray.h>
 #include <TLorentzVector.h> 
 #include <Riostream.h>
 #include <TClonesArray.h>
 #include <TLorentzVector.h> 
@@ -48,7 +49,10 @@ AliMUONv1::AliMUONv1() : AliMUON()
     fChambers = 0;
     fStations = 0;
     fStepManagerVersionOld = kFALSE;
     fChambers = 0;
     fStations = 0;
     fStepManagerVersionOld = kFALSE;
-    fStepMaxInActiveGas = 0.6;
+    fStepManagerVersionNew = kFALSE;
+    fStepManagerVersionTest = kFALSE;
+
+    fStepMaxInActiveGas = 2.0;
 }
 
  
 }
 
  
@@ -65,7 +69,10 @@ AliMUONv1::AliMUONv1(const char *name, const char *title)
     factory.Build(this, title);
 
     fStepManagerVersionOld = kFALSE;
     factory.Build(this, title);
 
     fStepManagerVersionOld = kFALSE;
-    fStepMaxInActiveGas = 0.6;
+    fStepManagerVersionNew = kFALSE;
+    fStepManagerVersionTest = kFALSE;
+
+    fStepMaxInActiveGas = 2.0;
 }
 
 //___________________________________________
 }
 
 //___________________________________________
@@ -1236,7 +1243,6 @@ void AliMUONv1::CreateGeometry()
 //********************************************************************
 //                            Trigger                               **
 //******************************************************************** 
 //********************************************************************
 //                            Trigger                               **
 //******************************************************************** 
-
  /* 
     zpos1 and zpos2 are the middle of the first and second
     planes of station 1 (+1m for second station):
  /* 
     zpos1 and zpos2 are the middle of the first and second
     planes of station 1 (+1m for second station):
@@ -1599,6 +1605,17 @@ void AliMUONv1::StepManager()
     StepManagerOld();
     return;
   }
     StepManagerOld();
     return;
   }
+ if (fStepManagerVersionNew) {
+    StepManagerNew();
+    return;
+  }
+ if (fStepManagerVersionTest) {
+    StepManagerTest();
+    return;
+  }
+
+
   // Volume id
   Int_t   copy, id;
   Int_t   idvol;
   // Volume id
   Int_t   copy, id;
   Int_t   idvol;
@@ -1627,6 +1644,7 @@ void AliMUONv1::StepManager()
   }
   if (idvol == -1) return;
 
   }
   if (idvol == -1) return;
 
+   printf(">>>> This Chamber %d\n",iChamber);
 
   // record hits when track enters ...
   if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);  
 
   // record hits when track enters ...
   if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);  
@@ -1643,8 +1661,8 @@ void AliMUONv1::StepManager()
     // momentum loss and steplength in last step
     destep = gMC->Edep();
     step   = gMC->TrackStep();
     // momentum loss and steplength in last step
     destep = gMC->Edep();
     step   = gMC->TrackStep();
-    //new hit
 
 
+    //new hit
     GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart, 
                          pos.X(), pos.Y(), pos.Z(), tof, mom.P(), 
                          theta, phi, step, destep);
     GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart, 
                          pos.X(), pos.Y(), pos.Z(), tof, mom.P(), 
                          theta, phi, step, destep);
@@ -1653,9 +1671,9 @@ void AliMUONv1::StepManager()
   if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
     gMC->SetMaxStep(kBig);
   }
   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) 
 Int_t  AliMUONv1::GetChamberId(Int_t volId) const
 {
 // Check if the volume with specified  volId is a sensitive volume (gas) 
@@ -1668,6 +1686,107 @@ Int_t  AliMUONv1::GetChamberId(Int_t volId) const
 
   return 0;
 }
 
   return 0;
 }
+//__
+
+
+
+void AliMUONv1::StepManagerTest()
+{
+  return;
+}
+//________________________________________
+void AliMUONv1::StepManagerNew()
+{
+
+
+
+
+
+  // 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;
+    }
+  }
+  static Float_t Sstep[20]; // Sum of steps per chamber
+  // static Float_t Sdestep[20]; // Sum of eloss per chamber
+  Float_t GAP;
+  Float_t TEST; 
+
+  if (idvol == -1) return;
+
+  //  printf(">>>> This Chamber %d\n",iChamber);
+
+  // 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();         // Particle
+    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();
+
+    Sstep[iChamber]+=step;
+    // Sdestep[iChamber]+=destep;
+
+  }
+  
+  step   =  Sstep[iChamber]; // Total step >= gap
+  //  destep   =  Sdestep[iChamber]; // Total eloss
+
+
+  // Track left chamber ...
+  if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
+    gMC->SetMaxStep(kBig);
+
+    Sstep[iChamber]=0; // Reset for the next event
+    //Sdestep[iChamber]=0; // Reset for the next event
+
+    if (iChamber>=1 && iChamber<=2) GAP=0.4;
+    if (iChamber>=11 && iChamber<=14) GAP=0.2;
+    if (iChamber>=3 && iChamber<=10) GAP=0.5;
+   
+    TF1 *ELOSS1 = new TF1("Gauss1","exp(-((x-4.13727e+01)**2)/(2*1.42223e+01**2))",0,75);
+    TF1 *ELOSS2 = new TF1("Gauss2","exp(-((x+6.83795e+02)**2)/(2*4.48415e+02**2))",75,350);
+    TEST=gRandom->Rndm();
+    if (TEST <=0.89) destep=ELOSS1->GetRandom();
+    else destep=ELOSS2->GetRandom();
+    destep*=pow(10,-6)*0.0274;
+    destep*=GAP/0.5;
+
+    // One hit per chamber
+    GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart, 
+          pos.X()-(step/2*sin(theta*kDegrad)*cos(phi*kDegrad)), pos.Y()-(step/2*sin(theta*kDegrad)*sin(phi*kDegrad)), pos.Z()-GAP/2, tof, mom.P(),theta, phi, step, destep);
+
+  }
+}
 
 //___________________________________________
 void AliMUONv1::StepManagerOld()
 
 //___________________________________________
 void AliMUONv1::StepManagerOld()
@@ -1680,7 +1799,8 @@ void AliMUONv1::StepManagerOld()
   TLorentzVector mom;
   Float_t        theta,phi;
   Float_t        destep, step;
   TLorentzVector mom;
   Float_t        theta,phi;
   Float_t        destep, step;
-
+  
+  static Float_t Sstep;
   static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
   const  Float_t kBig = 1.e10;
   static Float_t hits[15];
   static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
   const  Float_t kBig = 1.e10;
   static Float_t hits[15];
@@ -1711,10 +1831,11 @@ void AliMUONv1::StepManagerOld()
   // momentum loss and steplength in last step
   destep = gMC->Edep();
   step   = gMC->TrackStep();
   // momentum loss and steplength in last step
   destep = gMC->Edep();
   step   = gMC->TrackStep();
-  
+  // cout<<"------------"<<step<<endl;
   //
   // record hits when track enters ...
   if( gMC->IsTrackEntering()) {
   //
   // record hits when track enters ...
   if( gMC->IsTrackEntering()) {
+
       gMC->SetMaxStep(fMaxStepGas);
       Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
       Double_t rt = TMath::Sqrt(tc);
       gMC->SetMaxStep(fMaxStepGas);
       Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
       Double_t rt = TMath::Sqrt(tc);
@@ -1744,27 +1865,34 @@ void AliMUONv1::StepManagerOld()
       tlength  = 0;
       eloss    = 0;
       eloss2   = 0;
       tlength  = 0;
       eloss    = 0;
       eloss2   = 0;
+      Sstep=0;
       xhit     = pos[0];
       yhit     = pos[1];      
       zhit     = pos[2];      
       Chamber(idvol).ChargeCorrelationInit();
       // Only if not trigger chamber
 
       xhit     = pos[0];
       yhit     = pos[1];      
       zhit     = pos[2];      
       Chamber(idvol).ChargeCorrelationInit();
       // Only if not trigger chamber
 
-      
+//       printf("---------------------------\n");
+//       printf(">>>> Y =  %f \n",hits[2]);
+//       printf("---------------------------\n");
+    
       
 
       
 
-      if(idvol < AliMUONConstants::NTrackingCh()) {
-         //
-         //  Initialize hit position (cursor) in the segmentation model 
-         ((AliMUONChamber*) (*fChambers)[idvol])
-             ->SigGenInit(pos[0], pos[1], pos[2]);
-      } else {
-         //geant3->Gpcxyz();
-         //printf("In the Trigger Chamber #%d\n",idvol-9);
-      }
+     //  if(idvol < AliMUONConstants::NTrackingCh()) {
+//       //
+//       //  Initialize hit position (cursor) in the segmentation model 
+//       ((AliMUONChamber*) (*fChambers)[idvol])
+//           ->SigGenInit(pos[0], pos[1], pos[2]);
+//       } else {
+//       //geant3->Gpcxyz();
+//       //printf("In the Trigger Chamber #%d\n",idvol-9);
+//       }
   }
   eloss2+=destep;
   }
   eloss2+=destep;
-  
+  Sstep+=step;
+
+  // cout<<Sstep<<endl;
+
   // 
   // Calculate the charge induced on a pad (disintegration) in case 
   //
   // 
   // Calculate the charge induced on a pad (disintegration) in case 
   //
@@ -1798,6 +1926,7 @@ void AliMUONv1::StepManagerOld()
       hits[6] = tlength;   // track length
       hits[7] = eloss2;    // de/dx energy loss
 
       hits[6] = tlength;   // track length
       hits[7] = eloss2;    // de/dx energy loss
 
+
       //      if (fNPadHits > (Int_t)hits[8]) {
       //         hits[8] = hits[8]+1;
       //         hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
       //      if (fNPadHits > (Int_t)hits[8]) {
       //         hits[8] = hits[8]+1;
       //         hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
index 04955c09d838b3d00eca96614f64a3b9c51010a4..a59b1a6842f55522c2d53ab7929f3c230b170b35 100644 (file)
@@ -11,6 +11,7 @@
 /////////////////////////////////////////////////////////
  
 #include "AliMUON.h"
 /////////////////////////////////////////////////////////
  
 #include "AliMUON.h"
+#include <TF1.h>
 
 class AliMUONv1 : public AliMUON {
 public:
 
 class AliMUONv1 : public AliMUON {
 public:
@@ -23,17 +24,32 @@ public:
    virtual Int_t  IsVersion() const {return 1;}
    virtual void   StepManager();
    void StepManagerOld();
    virtual Int_t  IsVersion() const {return 1;}
    virtual void   StepManager();
    void StepManagerOld();
+   void StepManagerNew();
+   void StepManagerTest();
+
+
+
    void SetStepManagerVersionOld(Bool_t Opt) 
      { fStepManagerVersionOld = Opt; }
    void SetStepManagerVersionOld(Bool_t Opt) 
      { fStepManagerVersionOld = Opt; }
+   void SetStepManagerVersionNew(Bool_t Opt) 
+     { fStepManagerVersionNew = Opt; }
+   void SetStepManagerVersionTest(Bool_t Opt) 
+     { fStepManagerVersionTest = 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
    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
+   Bool_t  fStepManagerVersionNew; // Version of StepManager, Default is false
+   Bool_t  fStepManagerVersionTest; // 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;
    Float_t fStepMaxInActiveGas; // Step mas in active gas default 0.6cm
    virtual Int_t  GetChamberId(Int_t volId) const;
+   
+
 private:
    ClassDef(AliMUONv1,1)  // MUON Detector class Version 1
 private:
    ClassDef(AliMUONv1,1)  // MUON Detector class Version 1
+
+
 };
 #endif
 
 };
 #endif