LCOV - code coverage report
Current view: top level - MUON/MUONsim - AliMUONv1.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 199 232 85.8 %
Date: 2016-06-14 17:26:59 Functions: 16 16 100.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpeateose. It is      *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : //-----------------------------------------------------------------------------
      19             : // Class AliMUONv1
      20             : // --------------------
      21             : // AliDetector class for MUON subsystem which implements
      22             : // functions for simulation 
      23             : //-----------------------------------------------------------------------------
      24             : 
      25             : #include "AliMUONv1.h"
      26             : #include "AliMUONConstants.h"
      27             : #include "AliMUONResponseFactory.h"
      28             : #include "AliMUONHit.h"
      29             : #include "AliMUONGeometryBuilder.h"   
      30             : #include "AliMUONGeometry.h"  
      31             : #include "AliMUONGeometryTransformer.h"       
      32             : #include "AliMUONGeometryModule.h"    
      33             : #include "AliMUONStringIntMap.h"      
      34             : #include "AliMUONGeometryDetElement.h"        
      35             : 
      36             : #include "AliMpCDB.h"
      37             : #include "AliMpDEManager.h"
      38             : 
      39             : #include "AliConst.h" 
      40             : #include "AliMagF.h"
      41             : #include "AliRun.h"
      42             : #include "AliMC.h"
      43             : #include "AliTrackReference.h"
      44             : #include "AliLog.h"
      45             : 
      46             : #include <TClonesArray.h>
      47             : #include <TF1.h>
      48             : #include <TF2.h>
      49             : #include <TGeoGlobalMagField.h>
      50             : #include <TGeoMatrix.h>
      51             : #include <TRandom.h>
      52             : #include <TRandom.h> 
      53             : #include <TVirtualMC.h>
      54             : 
      55             : #include <string>
      56             : 
      57             : #include "AliMUONVHitStore.h"
      58             : #include <iostream>
      59             : #include <iomanip>
      60             : 
      61             : using std::endl;
      62             : using std::cout;
      63             : using std::setw;
      64             : /// \cond CLASSIMP
      65          16 : ClassImp(AliMUONv1)
      66             : /// \endcond
      67             :  
      68             : //___________________________________________
      69             : AliMUONv1::AliMUONv1() 
      70          12 :   : AliMUON(),
      71          12 :     fAngleEffect(kTRUE),
      72          12 :     fMagEffect(kTRUE),
      73          12 :     fStepMaxInActiveGas(0.6),
      74          12 :     fStepSum(0x0),
      75          12 :     fDestepSum(0x0),
      76          12 :     fTrackMomentum(), 
      77          12 :     fTrackPosition(),
      78          12 :     fElossRatio(0x0),
      79          12 :     fAngleEffect10(0x0),
      80          12 :     fAngleEffectNorma(0x0),
      81          12 :     fMagAngleEffectNorma(0x0)
      82          60 : {
      83             : /// Default constructor
      84             :   
      85          60 :   AliDebug(1,Form("default (empty) ctor this=%p",this));
      86          24 : } 
      87             : 
      88             : //___________________________________________
      89             : AliMUONv1::AliMUONv1(const char *name, const char* title)
      90           1 : : AliMUON(name, title), 
      91           1 :     fAngleEffect(kTRUE),
      92           1 :     fMagEffect(kTRUE),
      93           1 :     fStepMaxInActiveGas(0.6),
      94           1 :     fStepSum(0x0),
      95           1 :     fDestepSum(0x0),
      96           1 :     fTrackMomentum(), 
      97           1 :     fTrackPosition(),
      98           1 :     fElossRatio(0x0),
      99           1 :     fAngleEffect10(0x0),
     100           1 :     fAngleEffectNorma(0x0),
     101           1 :     fMagAngleEffectNorma(0x0)
     102           5 : {
     103             : /// Standard onstructor
     104             : 
     105           5 :     AliDebug(1,Form("ctor this=%p",this));    
     106             :         
     107             :     // Load mapping
     108           2 :     if ( ! AliMpCDB::LoadMpSegmentation() ) {
     109           0 :       AliFatal("Could not access mapping from OCDB !");
     110             :     }
     111             :        
     112             :     // By default include all stations
     113             : 
     114           3 :     fStepSum   = new Float_t [AliMUONConstants::NCh()];
     115           3 :     fDestepSum = new Float_t [AliMUONConstants::NCh()];
     116          45 :     for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
     117          14 :       fStepSum[i] =0.0;
     118          14 :       fDestepSum[i]=0.0;
     119             :     }
     120             :     // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book
     121           3 :     fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.); 
     122           1 :     fElossRatio->SetParameter(0,1.02138);
     123           1 :     fElossRatio->SetParameter(1,-9.54149e-02);
     124           1 :     fElossRatio->SetParameter(2,+7.83433e-02); 
     125           1 :     fElossRatio->SetParameter(3,-9.98208e-03);
     126           1 :     fElossRatio->SetParameter(4,+3.83279e-04);
     127             : 
     128             :     // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)
     129           3 :     fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0);
     130           1 :     fAngleEffect10->SetParameter(0, 1.90691e+02);
     131           1 :     fAngleEffect10->SetParameter(1,-6.62258e+01);
     132           1 :     fAngleEffect10->SetParameter(2,+1.28247e+01);
     133             :     // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)  
     134             :     // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
     135           3 :     fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
     136           1 :     fAngleEffectNorma->SetParameter(0,4.148);
     137           1 :     fAngleEffectNorma->SetParameter(1,-6.809e-01);
     138           1 :     fAngleEffectNorma->SetParameter(2,5.151e-02);
     139           1 :     fAngleEffectNorma->SetParameter(3,-1.490e-03);
     140             : 
     141             :     // Magnetic field effect: Normalisation form theta=16 degres (eq. 10 degrees B=0) to theta between -20 and 20 (Lamia Benhabib jun 2006 )  
     142             :     // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
     143           3 :     fMagAngleEffectNorma = new TF2("MagAngleEffectNorma","121.24/(([1]+[2]*abs(y))+[3]*abs(x-[0]*y)+[4]*abs((x-[0]*y)*(x-[0]*y))+[5]*abs((x-[0]*y)*(x-[0]*y)*(x-[0]*y))+[6]*abs((x-[0]*y)*(x-[0]*y)*(x-[0]*y)*(x-[0]*y)))",-20.0,20.0,-1.,1.);
     144           1 :     fMagAngleEffectNorma->SetParameters(8.6995, 25.4022, 13.8822, 2.4717, 1.1551, -0.0624, 0.0012);
     145           2 : }
     146             : 
     147             : //___________________________________________
     148             : AliMUONv1::~AliMUONv1()
     149          78 : {
     150             : /// Destructor
     151             :   
     152          65 :   AliDebug(1,Form("dtor this=%p",this));
     153          14 :   delete [] fStepSum;
     154          14 :   delete [] fDestepSum;
     155          26 :   delete fElossRatio;
     156          26 :   delete fAngleEffect10;
     157          26 :   delete fAngleEffectNorma; 
     158          26 :   delete fMagAngleEffectNorma;
     159          39 : }
     160             : 
     161             : //__________________________________________________
     162             : void AliMUONv1::CreateGeometry()
     163             : {
     164             : /// Construct geometry using geometry builder
     165             : 
     166           2 :   fGeometryBuilder->CreateGeometry();
     167           1 : }
     168             : 
     169             : //________________________________________________________________
     170             : void AliMUONv1::CreateMaterials()
     171             : {
     172             : /// Construct materials using geometry builder
     173             : 
     174           2 :   fGeometryBuilder->CreateMaterials();
     175           1 : }
     176             : 
     177             : //________________________________________________________________
     178             : void AliMUONv1::UpdateInternalGeometry()
     179             : {
     180             : /// Update geometry after applying mis-alignment
     181             : 
     182             :   // Load mapping
     183           2 :   if ( ! AliMpCDB::LoadMpSegmentation() ) {
     184           0 :     AliFatal("Could not access mapping from OCDB !");
     185           0 :   }
     186             : 
     187           1 :   fGeometryBuilder->UpdateInternalGeometry();
     188           1 : }
     189             : 
     190             : //________________________________________________________________
     191             : void AliMUONv1::AddAlignableVolumes() const
     192             : {
     193             : /// Construct materials using geometry builder
     194             : 
     195           2 :   GetGeometryTransformer()->AddAlignableVolumes();
     196           1 : }
     197             : 
     198             : 
     199             : //___________________________________________
     200             : void AliMUONv1::Init()
     201             : { 
     202             : /// Initialize geometry
     203             : 
     204           4 :   AliDebug(1,"Start Init for version 1 - CPC chamber type");
     205             :    
     206           1 :   fGeometryBuilder->InitGeometry();
     207           3 :   AliDebug(1,"Finished Init for version 1 - CPC chamber type");   
     208             :  
     209             : 
     210             :   // Build segmentation
     211             :   // using geometry parametrisation
     212             :   //
     213             :   // Build response
     214             :   //
     215           1 :   AliMUONResponseFactory respFactory("default", fIsTailEffect);
     216           1 :   respFactory.Build(this);
     217             :   
     218           1 : }
     219             : 
     220             : //__________________________________________________________________
     221             : Int_t  AliMUONv1::GetGeomModuleId(Int_t volId) const
     222             : {
     223             : /// Check if the volume with specified  volId is a sensitive volume (gas) 
     224             : /// of some chamber and return the chamber number;
     225             : /// if not sensitive volume - return 0.
     226             : 
     227      371803 :   for (Int_t i = 0; i < AliMUONConstants::NGeomModules(); i++) {
     228      169535 :     if ( GetGeometry()->GetModule(i)->IsSensitiveVolume(volId) )
     229         745 :       return i;
     230             :   }    
     231             : 
     232        7997 :   return -1;
     233        8742 : }
     234             : 
     235             : //_______________________________________________________________________________
     236             : TString  AliMUONv1::CurrentVolumePath() const
     237             : {
     238             : /// Return current volume path
     239             : /// (Could be removed when this function is available via TVirtualMC::GetMC())
     240             : 
     241        1950 :   TString path = "";
     242         975 :   TString name;
     243         975 :   Int_t copyNo;
     244             :   Int_t imother = 0;
     245         975 :   do {
     246       22152 :     name = TVirtualMC::GetMC()->CurrentVolOffName(imother);
     247       14768 :     TVirtualMC::GetMC()->CurrentVolOffID(imother++, copyNo);
     248        7384 :     TString add = "/";
     249        7384 :     add += name;
     250        7384 :     add += "_";
     251        7384 :     add += copyNo;
     252        7384 :     path.Insert(0,add); 
     253       14768 :   }
     254       22152 :   while ( name != TString("ALIC") );
     255             :   
     256             :   return path;  
     257        1950 : }
     258             : 
     259             : //_______________________________________________________________________________
     260             : void AliMUONv1::StepManager()
     261             : {
     262             : /// Step manager for the chambers
     263             : 
     264             :   // Only charged tracks
     265       18128 :   if( !(TVirtualMC::GetMC()->TrackCharge()) ) return; 
     266             :   // Only charged tracks
     267             :   
     268             :   // Only gas gap inside chamber
     269             :   // Tag chambers and record hits when track enters 
     270             :   static Int_t   idvol=-1, iEnter = 0;
     271        8742 :   Int_t   copy;
     272             :   const  Float_t kBig = 1.e10;
     273             :   static Double_t xyzEnter[3];
     274             : 
     275             :   //
     276             :   // Only gas gap inside chamber
     277             :   // Tag chambers and record hits when track enters 
     278        8742 :   Int_t id=TVirtualMC::GetMC()->CurrentVolID(copy);
     279        8742 :   Int_t iGeomModule = GetGeomModuleId(id);
     280       16739 :   if (iGeomModule == -1) return;
     281             : 
     282             :   // Detection elements id
     283             :   const AliMUONGeometryModule* kGeometryModule
     284         745 :     = GetGeometry()->GetModule(iGeomModule);
     285             :   AliMUONGeometryDetElement* detElement
     286        1490 :     = kGeometryModule->FindBySensitiveVolume(CurrentVolumePath());
     287             :     
     288         975 :   if (!detElement && iGeomModule < AliMUONConstants::NGeomModules()-2) {
     289         230 :     iGeomModule++;
     290             :     const AliMUONGeometryModule* kGeometryModule2
     291         230 :       = GetGeometry()->GetModule(iGeomModule);
     292         230 :     detElement 
     293         230 :       = kGeometryModule2->FindBySensitiveVolume(CurrentVolumePath());
     294         230 :   }    
     295             : 
     296             :   Int_t detElemId = 0;
     297        1490 :   if (detElement) detElemId = detElement->GetUniqueID(); 
     298             :  
     299         745 :   if (!detElemId) {
     300           0 :     AliErrorStream() 
     301           0 :          << "Geometry module id: "
     302           0 :          << setw(3) << iGeomModule << "  "
     303           0 :          << "Current SV: " 
     304           0 :          <<  CurrentVolumePath() 
     305           0 :          << "  detElemId: "
     306           0 :          << setw(5) << detElemId 
     307           0 :          << endl;
     308           0 :     Double_t x, y, z;
     309           0 :     TVirtualMC::GetMC()->TrackPosition(x, y, z);      
     310           0 :     AliErrorStream() 
     311           0 :          << "        global position: "
     312           0 :          << x << ", " << y << ", " << z
     313           0 :          << endl;
     314           0 :     AliErrorStream() << "DetElemId not identified." << endl;
     315           0 :   } 
     316             :   
     317         745 :   Int_t iChamber = AliMpDEManager::GetChamberId(detElemId) + 1; 
     318         745 :   idvol = iChamber -1;
     319             :     
     320             :   // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
     321        1375 :   if ( (TVirtualMC::GetMC()->IsTrackEntering() || TVirtualMC::GetMC()->IsTrackExiting() ) ) {
     322             :     AliTrackReference* trackReference    
     323         230 :       = AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kMUON);
     324         230 :     trackReference->SetUserId(detElemId);
     325         230 :   }  
     326             :   
     327         745 :   if( TVirtualMC::GetMC()->IsTrackEntering() ) {
     328         115 :      Float_t theta = fTrackMomentum.Theta();
     329         230 :      if ( fIsMaxStep && (TMath::Pi()-theta)*kRaddeg>=15. ) {
     330           2 :        TVirtualMC::GetMC()->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
     331           2 :      }  
     332         115 :      iEnter = 1;
     333         115 :      TVirtualMC::GetMC()->TrackPosition(xyzEnter[0], xyzEnter[1], xyzEnter[2]); // save coordinates of entrance point
     334         115 :   }
     335             : 
     336             :    //   AliDebug(1,
     337             :    //       Form("Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber,
     338             :    //            ( (AliMUONChamber*)(*fChambers)[idvol])->Z())) ;
     339             :   // Particule id and mass, 
     340         745 :   Int_t     ipart = TVirtualMC::GetMC()->TrackPid();
     341         745 :   Float_t   mass  = TVirtualMC::GetMC()->TrackMass();
     342             : 
     343         745 :   fDestepSum[idvol]+=TVirtualMC::GetMC()->Edep();
     344             :   // Get current particle id (ipart), track position (pos)  and momentum (mom)
     345         975 :   if ( fStepSum[idvol]==0.0 )  TVirtualMC::GetMC()->TrackMomentum(fTrackMomentum);
     346         745 :   fStepSum[idvol]+=TVirtualMC::GetMC()->TrackStep();
     347             :   
     348             :   //  if (AliDebugLevel()) {
     349             :   //   AliDebug(1,Form("Step, iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
     350             :   //                 iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg,
     351             :   //         mass, fStepSum[idvol], TVirtualMC::GetMC()->Edep()));
     352             :   // AliDebug(1,Form("Step:Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), 
     353             :   //         fTrackMomentum.Z()));
     354             :   // TVirtualMC::GetMC()->TrackPosition(fTrackPosition);
     355             :   // AliDebug(1,Form("Step: Track Position %f %f %f",fTrackPosition.X(),
     356             :   //         fTrackPosition.Y(),fTrackPosition.Z())) ;
     357             :   //}
     358             : 
     359             :   // Track left chamber or StepSum larger than fStepMaxInActiveGas
     360        1375 :   if ( TVirtualMC::GetMC()->IsTrackExiting() || 
     361         630 :        TVirtualMC::GetMC()->IsTrackStop() || 
     362         630 :        TVirtualMC::GetMC()->IsTrackDisappeared()||
     363         630 :        (fStepSum[idvol]>fStepMaxInActiveGas) ) {
     364             :     
     365         115 :     if   ( fIsMaxStep && 
     366         115 :            ( TVirtualMC::GetMC()->IsTrackExiting() || 
     367           0 :              TVirtualMC::GetMC()->IsTrackStop() || 
     368         115 :              TVirtualMC::GetMC()->IsTrackDisappeared() ) ) TVirtualMC::GetMC()->SetMaxStep(kBig);
     369         115 :     if (fDestepSum[idvol] == 0) {
     370             :       // AZ - no energy release
     371           0 :       fStepSum[idvol] = 0; // Reset for the next event
     372           0 :       iEnter = 0;
     373           0 :       return; 
     374             :     }
     375             : 
     376         115 :     TVirtualMC::GetMC()->TrackPosition(fTrackPosition);
     377         115 :     Float_t theta = fTrackMomentum.Theta();
     378         115 :     Float_t phi   = fTrackMomentum.Phi();
     379             :     
     380             :     Int_t merge = 0;
     381         115 :     Double_t xyz0[3]={0}, xyz1[3]={0}, tmp[3]={0};
     382         115 :     if (TVirtualMC::GetMC()->IsTrackExiting() && iEnter != 0) {
     383             :       // AZ - this code is to avoid artificial hit splitting at the
     384             :       // "fake" boundary inside the same chamber. It will still produce 
     385             :       // 2 hits but with the same coordinates (at the wire) to allow 
     386             :       // their merging at the digitization level.
     387             : 
     388             :       // Only for a track going from the entrance to the exit from the volume
     389             :       // Get local coordinates
     390         115 :       TVirtualMC::GetMC()->Gmtod(xyzEnter, xyz0, 1); // local coord. at the entrance
     391             : 
     392         115 :       fTrackPosition.Vect().GetXYZ(tmp);
     393         115 :       TVirtualMC::GetMC()->Gmtod(tmp, xyz1, 1); // local coord. at the exit
     394         115 :       Float_t dx = xyz0[0] - xyz1[0];
     395         115 :       Float_t dy = xyz0[1] - xyz1[1];
     396         115 :       Float_t thLoc = TMath::ATan2 (TMath::Sqrt(dx*dx+dy*dy), TMath::Abs(xyz0[2]-xyz1[2]));
     397         229 :       if (thLoc * TMath::RadToDeg() < 15) merge = 1; 
     398         115 :     }
     399             : 
     400         115 :     if (merge) {
     401             :       Double_t dz = -0.5;
     402         228 :       if (xyz1[2] != xyz0[2]) dz = xyz0[2] / (xyz1[2] - xyz0[2]);
     403         114 :       tmp[0] = xyz0[0] - (xyz1[0] - xyz0[0]) * dz; // local coord. at the wire
     404         114 :       tmp[1] = xyz0[1] - (xyz1[1] - xyz0[1]) * dz;
     405         114 :       tmp[2] = xyz0[2] - (xyz1[2] - xyz0[2]) * dz;
     406         114 :       TVirtualMC::GetMC()->Gdtom(tmp, xyz1, 1); // global coord. at the wire
     407         114 :       fTrackPosition.SetXYZT(xyz1[0], xyz1[1], xyz1[2], fTrackPosition.T());
     408         114 :     } else {
     409           2 :       TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
     410           1 :                                  fStepSum[idvol]/2.*sin(theta)*sin(phi),
     411           1 :                                  fStepSum[idvol]/2.*cos(theta),0.0       );
     412           1 :       fTrackPosition-=backToWire;
     413             :       //printf(" %d %d %d %f %d \n", TVirtualMC::GetMC()->IsTrackExiting(), TVirtualMC::GetMC()->IsTrackStop(), TVirtualMC::GetMC()->IsTrackDisappeared(), fStepSum[idvol], iEnter);
     414             :       //    AliDebug(1,
     415             :       //     Form("Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()));
     416             :       // AliDebug(1,
     417             :       //     Form("Exit: Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z())) ;
     418           1 :     }
     419             :     
     420             :     //-------------- Angle effect 
     421             :     // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
     422             :     
     423         115 :     Float_t betaxGamma    = fTrackMomentum.P()/mass;//  pc/mc2
     424             :     Float_t sigmaEffect10degrees;
     425             :     Float_t sigmaEffectThetadegrees;
     426             :     Float_t eLossParticleELossMip;
     427             :     Float_t yAngleEffect=0.;
     428         115 :     Float_t thetawires      =  TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) ;// We use Pi-theta because z is negative
     429         115 :     Double_t bField[3] = {0};
     430         115 :     fTrackPosition.Vect().GetXYZ(tmp);
     431         115 :     TGeoGlobalMagField::Instance()->Field(tmp,bField);
     432             : 
     433         230 :     if (fAngleEffect && !fMagEffect){
     434           0 :       thetawires = TMath::Abs(thetawires);
     435           0 :     if ( (betaxGamma >3.2)   &&  (thetawires*kRaddeg<=15.) ) {
     436           0 :       betaxGamma=TMath::Log(betaxGamma);
     437           0 :       eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
     438             :       // 10 degrees is a reference for a model (arbitrary)
     439           0 :       sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
     440             :       // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
     441           0 :       sigmaEffectThetadegrees =  sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg);  // For 5mm gap  
     442           0 :       if ( (iChamber==1)  ||  (iChamber==2) )  
     443           0 :         sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
     444           0 :       yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
     445           0 :     }
     446             :     }
     447         230 :     else if (fAngleEffect && fMagEffect) {
     448         229 :       if ( (betaxGamma >3.2)   &&  (TMath::Abs(thetawires*kRaddeg)<=15.) ) {
     449         114 :         betaxGamma=TMath::Log(betaxGamma);
     450         114 :         eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
     451             :         // 10 degrees is a reference for a model (arbitrary)
     452         114 :         sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
     453             :         // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
     454         114 :         sigmaEffectThetadegrees =  sigmaEffect10degrees/fMagAngleEffectNorma->Eval(thetawires*kRaddeg,bField[0]/10.);  // For 5mm gap  
     455         114 :       if ( (iChamber==1)  ||  (iChamber==2) )  
     456          16 :         sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
     457         114 :         yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
     458         114 :       }
     459             :     }
     460             : 
     461         230 :     AliMUONHit hit(fIshunt, 
     462         115 :                    gAlice->GetMCApp()->GetCurrentTrackNumber(), 
     463             :                    detElemId, ipart,
     464         115 :                    fTrackPosition.X(), 
     465         115 :                    fTrackPosition.Y()+yAngleEffect, 
     466         115 :                    fTrackPosition.Z(), 
     467         115 :                    TVirtualMC::GetMC()->TrackTime(),
     468         115 :                    fTrackMomentum.P(),
     469             :                    theta, 
     470             :                    phi, 
     471         115 :                    fStepSum[idvol], 
     472         115 :                    fDestepSum[idvol],                        
     473         115 :                    fTrackPosition.X(),
     474         115 :                    fTrackPosition.Y(),
     475         115 :                    fTrackPosition.Z());
     476             :     
     477         115 :     fHitStore->Add(hit);
     478             : 
     479         115 :     fStepSum[idvol]  =0; // Reset for the next event
     480         115 :     fDestepSum[idvol]=0; // Reset for the next event
     481         115 :     iEnter = 0;
     482         115 :   }
     483       18551 : }

Generated by: LCOV version 1.11