]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsimulationSPD.cxx
A new version of UserExec()
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSPD.cxx
index 0b1ec3365c4f17dde22287566a851fbf32e8e921..9c9a4d6b613b74bdb3b333fea48546229e337fdb 100644 (file)
@@ -128,8 +128,8 @@ void AliITSsimulationSPD::Init(){
    } else {
        fCoupling=1;
    } // end if
-   //SetLorentzDrift(kTRUE);
-   if (fLorentz) SetTanLorAngle();
+   SetLorentzDrift(simpar->GetSPDLorentzDrift());
+   if (fLorentz) SetTanLorAngle(simpar->GetSPDLorentzHoleWeight());
    //SetStrobeGeneration(kFALSE);
    if (fStrobe) GenerateStrobePhase();
 }
@@ -155,13 +155,11 @@ Bool_t AliITSsimulationSPD::SetTanLorAngle(Double_t WeightHole) {
     }
     Double_t WeightEle=1.-WeightHole;
     AliITSSimuParam* simpar = fDetType->GetSimuParam();
-    Double_t pos[3]={0.,0.,0.};
-    Double_t B[3]={0.,0.,0.};
-    TGeoGlobalMagField::Instance()->Field(pos,B);
-    fTanLorAng = TMath::Tan(WeightHole*simpar->LorentzAngleHole(B[2]) +
-                             WeightEle*simpar->LorentzAngleElectron(B[2]));
-    fTanLorAng*=-1.; // this only for the old geometry
-                      // comment the upper line for the new geometry
+    AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+    if (!fld) AliFatal("The field is not initialized");
+    Double_t bz = fld->SolenoidField();
+    fTanLorAng = TMath::Tan(WeightHole*simpar->LorentzAngleHole(bz) +
+                             WeightEle*simpar->LorentzAngleElectron(bz));
     return kTRUE;
 }
 //______________________________________________________________________
@@ -840,7 +838,7 @@ void AliITSsimulationSPD::CreateHistograms(){
    fSPDname="spd_";
    for(Int_t i=0;i<GetNPixelsZ();i++) {
        Char_t pixelz[4];
-       sprintf(pixelz,"%d",i);
+       snprintf(pixelz,3,"%d",i);
        fSPDname.Append(pixelz);
        fHis->AddAt(new TH1F(fSPDname.Data(),"SPD maps",
                             GetNPixelsX(),0.,(Double_t)GetNPixelsX()),i);