X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONv1.cxx;h=49ebf4dd447703c8c2efd9f8b2a82f77efff735f;hb=061d7a52a64e5cfcc44a766ccb92333e4d21e843;hp=a6390c9f153826e5abfb948cd046ac373dcb245b;hpb=5398f94668e02dcbf8366fd69a3a87777c1476d2;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONv1.cxx b/MUON/AliMUONv1.cxx index a6390c9f153..49ebf4dd447 100644 --- a/MUON/AliMUONv1.cxx +++ b/MUON/AliMUONv1.cxx @@ -15,21 +15,17 @@ /* $Id$ */ -// -------------------- +//----------------------------------------------------------------------------- // Class AliMUONv1 // -------------------- // AliDetector class for MUON subsystem which implements // functions for simulation +//----------------------------------------------------------------------------- #include "AliMUONv1.h" #include "AliMUONConstants.h" -#include "AliMUONSegFactory.h" #include "AliMUONResponseFactory.h" -#include "AliMUONSegmentation.h" #include "AliMUONHit.h" -#include "AliMUONTriggerCircuit.h" -#include "AliMUONTriggerCircuitNew.h" -#include "AliMUONTriggerCrateStore.h" #include "AliMUONGeometryBuilder.h" #include "AliMUONGeometry.h" #include "AliMUONGeometryTransformer.h" @@ -37,6 +33,9 @@ #include "AliMUONStringIntMap.h" #include "AliMUONGeometryDetElement.h" +#include "AliMpCDB.h" +#include "AliMpDEManager.h" + #include "AliConst.h" #include "AliMagF.h" #include "AliRun.h" @@ -46,6 +45,7 @@ #include #include +#include #include #include #include @@ -53,6 +53,8 @@ #include +#include "AliMUONVHitStore.h" + /// \cond CLASSIMP ClassImp(AliMUONv1) /// \endcond @@ -61,6 +63,7 @@ ClassImp(AliMUONv1) AliMUONv1::AliMUONv1() : AliMUON(), fAngleEffect(kTRUE), + fMagEffect(kTRUE), fStepMaxInActiveGas(0.6), fStepSum(0x0), fDestepSum(0x0), @@ -68,7 +71,8 @@ AliMUONv1::AliMUONv1() fTrackPosition(), fElossRatio(0x0), fAngleEffect10(0x0), - fAngleEffectNorma(0x0) + fAngleEffectNorma(0x0), + fMagAngleEffectNorma(0x0) { /// Default constructor @@ -76,11 +80,10 @@ AliMUONv1::AliMUONv1() } //___________________________________________ -AliMUONv1::AliMUONv1(const char *name, const char *title, - const char* sDigitizerClassName, - const char* digitizerClassName) -: AliMUON(name,title,sDigitizerClassName,digitizerClassName), +AliMUONv1::AliMUONv1(const char *name, const char* title) +: AliMUON(name, title), fAngleEffect(kTRUE), + fMagEffect(kTRUE), fStepMaxInActiveGas(0.6), fStepSum(0x0), fDestepSum(0x0), @@ -88,12 +91,18 @@ AliMUONv1::AliMUONv1(const char *name, const char *title, fTrackPosition(), fElossRatio(0x0), fAngleEffect10(0x0), - fAngleEffectNorma(0x0) + fAngleEffectNorma(0x0), + fMagAngleEffectNorma(0x0) { /// Standard onstructor AliDebug(1,Form("ctor this=%p",this)); + // Load mapping + if ( ! AliMpCDB::LoadMpSegmentation() ) { + AliFatal("Could not access mapping from OCDB !"); + } + // By default include all stations fStepSum = new Float_t [AliMUONConstants::NCh()]; @@ -122,6 +131,11 @@ AliMUONv1::AliMUONv1(const char *name, const char *title, fAngleEffectNorma->SetParameter(1,-6.809e-01); fAngleEffectNorma->SetParameter(2,5.151e-02); fAngleEffectNorma->SetParameter(3,-1.490e-03); + + // Magnetic field effect: Normalisation form theta=16 degres (eq. 10 degrees B=0) to theta between -20 and 20 (Lamia Benhabib jun 2006 ) + // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. + 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.); + fMagAngleEffectNorma->SetParameters(8.6995, 25.4022, 13.8822, 2.4717, 1.1551, -0.0624, 0.0012); } //___________________________________________ @@ -135,6 +149,7 @@ AliMUONv1::~AliMUONv1() delete fElossRatio; delete fAngleEffect10; delete fAngleEffectNorma; + delete fMagAngleEffectNorma; } //__________________________________________________ @@ -153,6 +168,15 @@ void AliMUONv1::CreateMaterials() fGeometryBuilder->CreateMaterials(); } +//________________________________________________________________ +void AliMUONv1::AddAlignableVolumes() const +{ +/// Construct materials using geometry builder + + GetGeometryTransformer()->AddAlignableVolumes(); +} + + //___________________________________________ void AliMUONv1::Init() { @@ -164,58 +188,29 @@ void AliMUONv1::Init() AliDebug(1,"Finished Init for version 1 - CPC chamber type"); - std::string ftype(GetTitle()); - // Build segmentation // using geometry parametrisation // - AliMUONSegFactory segFactory(GetGeometryTransformer()); - fSegmentation = segFactory.CreateSegmentation(ftype); - - if (!fSegmentation) { - AliFatal(Form("Wrong factory type : %s",ftype.c_str())); - } - // Build response // - AliMUONResponseFactory respFactory("default"); + AliMUONResponseFactory respFactory("default", fIsTailEffect); respFactory.Build(this); - - // Initialize segmentation - // - fSegmentation->Init(); - - // Initialize trigger circuits - // - for (Int_t i=0; iAt(i)); - c->Init(i); - } - - AliMUONTriggerCrateStore store; - store.ReadFromFile(); - for (Int_t i=0; iAt(i)); - c->Init(i,store); - } - } //__________________________________________________________________ -Int_t AliMUONv1::GetChamberId(Int_t volId) const +Int_t AliMUONv1::GetGeomModuleId(Int_t volId) const { /// Check if the volume with specified volId is a sensitive volume (gas) /// of some chamber and return the chamber number; /// if not sensitive volume - return 0. - for (Int_t i = 0; i < AliMUONConstants::NCh(); i++) { + for (Int_t i = 0; i < AliMUONConstants::NGeomModules(); i++) { if ( GetGeometry()->GetModule(i)->IsSensitiveVolume(volId) ) - return i+1; + return i; } - return 0; + return -1; } //_______________________________________________________________________________ @@ -254,8 +249,6 @@ void AliMUONv1::StepManager() // Only gas gap inside chamber // Tag chambers and record hits when track enters static Int_t idvol=-1, iEnter = 0; - Int_t iChamber=0; - Int_t id=0; Int_t copy; const Float_t kBig = 1.e10; static Double_t xyzEnter[3]; @@ -263,25 +256,31 @@ void AliMUONv1::StepManager() // // Only gas gap inside chamber // Tag chambers and record hits when track enters - id=gMC->CurrentVolID(copy); - iChamber = GetChamberId(id); - idvol = iChamber -1; + Int_t id=gMC->CurrentVolID(copy); + Int_t iGeomModule = GetGeomModuleId(id); + if (iGeomModule == -1) return; - if (idvol == -1) return; - // Detection elements id const AliMUONGeometryModule* kGeometryModule - = GetGeometry()->GetModule(iChamber-1); - + = GetGeometry()->GetModule(iGeomModule); AliMUONGeometryDetElement* detElement = kGeometryModule->FindBySensitiveVolume(CurrentVolumePath()); + + if (!detElement && iGeomModule < AliMUONConstants::NGeomModules()-2) { + iGeomModule++; + const AliMUONGeometryModule* kGeometryModule2 + = GetGeometry()->GetModule(iGeomModule); + detElement + = kGeometryModule2->FindBySensitiveVolume(CurrentVolumePath()); + } Int_t detElemId = 0; if (detElement) detElemId = detElement->GetUniqueID(); if (!detElemId) { - cerr << "Chamber id: " - << setw(3) << iChamber << " " + AliErrorStream() + << "Geometry module id: " + << setw(3) << iGeomModule << " " << "Current SV: " << CurrentVolumePath() << " detElemId: " @@ -289,16 +288,20 @@ void AliMUONv1::StepManager() << endl; Double_t x, y, z; gMC->TrackPosition(x, y, z); - cerr << " global position: " + AliErrorStream() + << " global position: " << x << ", " << y << ", " << z << endl; - AliError("DetElemId not identified."); - } + AliErrorStream() << "DetElemId not identified." << endl; + } + + Int_t iChamber = AliMpDEManager::GetChamberId(detElemId) + 1; + idvol = iChamber -1; // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) ) { AliTrackReference* trackReference - = AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); + = AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kMUON); trackReference->SetUserId(detElemId); } @@ -400,10 +403,13 @@ void AliMUONv1::StepManager() Float_t sigmaEffectThetadegrees; Float_t eLossParticleELossMip; Float_t yAngleEffect=0.; - Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative - + Float_t thetawires = TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) ;// We use Pi-theta because z is negative + Double_t bField[3] = {0}; + fTrackPosition.Vect().GetXYZ(tmp); + gAlice->Field(tmp,bField); - if (fAngleEffect){ + if (fAngleEffect && !fMagEffect){ + thetawires = TMath::Abs(thetawires); if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) { betaxGamma=TMath::Log(betaxGamma); eLossParticleELossMip = fElossRatio->Eval(betaxGamma); @@ -416,27 +422,37 @@ void AliMUONv1::StepManager() yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm } } + else if (fAngleEffect && fMagEffect) { + if ( (betaxGamma >3.2) && (TMath::Abs(thetawires*kRaddeg)<=15.) ) { + betaxGamma=TMath::Log(betaxGamma); + eLossParticleELossMip = fElossRatio->Eval(betaxGamma); + // 10 degrees is a reference for a model (arbitrary) + sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers + // Angle with respect to the wires assuming that chambers are perpendicular to the z axis. + sigmaEffectThetadegrees = sigmaEffect10degrees/fMagAngleEffectNorma->Eval(thetawires*kRaddeg,bField[0]/10.); // For 5mm gap + if ( (iChamber==1) || (iChamber==2) ) + sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm) + yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm + } + } + + AliMUONHit hit(fIshunt, + gAlice->GetMCApp()->GetCurrentTrackNumber(), + detElemId, ipart, + fTrackPosition.X(), + fTrackPosition.Y()+yAngleEffect, + fTrackPosition.Z(), + gMC->TrackTime(), + fTrackMomentum.P(), + theta, + phi, + fStepSum[idvol], + fDestepSum[idvol], + fTrackPosition.X(), + fTrackPosition.Y(), + fTrackPosition.Z()); - // One hit per chamber - GetMUONData()->AddHit2(fIshunt, - gAlice->GetMCApp()->GetCurrentTrackNumber(), - detElemId, ipart, - fTrackPosition.X(), - fTrackPosition.Y()+yAngleEffect, - fTrackPosition.Z(), - gMC->TrackTime(), - fTrackMomentum.P(), - theta, - phi, - fStepSum[idvol], - fDestepSum[idvol], - fTrackPosition.X(), - fTrackPosition.Y(), - fTrackPosition.Z()); - - // AliDebug(1,Form("Exit: Particle exiting from chamber %d",iChamber)); - // AliDebug(1,Form("Exit: StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol])); - // AliDebug(1,Form("Exit: Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ; + fHitStore->Add(hit); fStepSum[idvol] =0; // Reset for the next event fDestepSum[idvol]=0; // Reset for the next event