X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONClusterInput.cxx;h=558f6510931422baa2c6f78435d6e40d3971b73d;hb=642b74ab3eb2726f3f33bf600fc5471d1ae99ad2;hp=3e786cf55f487b5768721704c033da351e06e290;hpb=9825400f5d450e99343d698994ea62005d6d1b7f;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONClusterInput.cxx b/MUON/AliMUONClusterInput.cxx index 3e786cf55f4..558f6510931 100644 --- a/MUON/AliMUONClusterInput.cxx +++ b/MUON/AliMUONClusterInput.cxx @@ -13,91 +13,156 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ -#include "AliRun.h" -#include "AliMUON.h" -#include "AliMUONChamber.h" +/* $Id$ */ + +// ---------------------------- +// Class AliMUONClusterInput +// ---------------------------- +// Global data service for hit reconstruction +// Author: to be added + #include "AliMUONClusterInput.h" + +#include "AliMUONGeometryTransformer.h" +#include "AliMUONGeometrySegmentation.h" +#include "AliMUONSegFactory.h" #include "AliMUONSegmentation.h" -#include "AliMUONResponse.h" +#include "AliMUONConstants.h" +#include "AliMUONMathieson.h" #include "AliMUONRawCluster.h" #include "AliMUONDigit.h" +#include "AliLog.h" + #include #include +#include + +AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0; +TMinuit* AliMUONClusterInput::fgMinuit = 0; +AliMUONMathieson* AliMUONClusterInput::fgMathieson = 0; +AliMUONGeometryTransformer* AliMUONClusterInput::fgTransformer = 0; +AliMUONSegmentation* AliMUONClusterInput::fgSegmentation = 0; ClassImp(AliMUONClusterInput) -AliMUONClusterInput* AliMUONClusterInput::fgClusterInput = 0; -TMinuit* AliMUONClusterInput::fgMinuit = 0; +AliMUONClusterInput::AliMUONClusterInput() + : TObject(), + fNseg(0), + fChamber(0), + fCluster(0), + fZ(0.), + fChargeCorrel(1.), + fDetElemId(0) + +{ +// Default constructor + + fDigits[0]=0; + fDigits[1]=0; + fSegmentation2[0]=0; + fSegmentation2[1]=0; +} AliMUONClusterInput* AliMUONClusterInput::Instance() { // return pointer to the singleton instance if (fgClusterInput == 0) { fgClusterInput = new AliMUONClusterInput(); - fgMinuit = new TMinuit(5); + fgMinuit = new TMinuit(8); + + // Create segmentation with activated Root geometry + if ( ! gGeoManager ) { + AliFatalClass("Geometry not loaded."); + return fgClusterInput; + } + fgTransformer = new AliMUONGeometryTransformer(true); + fgTransformer->ReadGeometryData("volpath.dat", gGeoManager); + AliMUONSegFactory factory(fgTransformer); + fgSegmentation = factory.CreateSegmentation(); } return fgClusterInput; } -void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig1, TClonesArray* dig2) +AliMUONClusterInput::~AliMUONClusterInput() +{ +// Destructor + delete fgMinuit; + delete fgMathieson; + delete fgTransformer; + delete fgSegmentation; + fgMinuit = 0; + fgMathieson = 0; +} + +void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig1, TClonesArray* dig2) { -// Set pointer to digits with corresponding segmentations and responses (two cathode planes) - fDigits[0]=dig1; - fDigits[1]=dig2; - AliMUON *pMUON; - AliMUONChamber* iChamber; - - pMUON = (AliMUON*) gAlice->GetModule("MUON"); - iChamber = &(pMUON->Chamber(chamber)); - - fSegmentation[0]=iChamber->SegmentationModel(1); - fSegmentation[1]=iChamber->SegmentationModel(2); - fResponse=iChamber->ResponseModel(); + // Set pointer to digits with corresponding segmentations and responses (two cathode planes) + fChamber = chamber; + fDetElemId = idDE; + fDigits[0] = dig1; + fDigits[1] = dig2; + fNDigits[0] = dig1->GetEntriesFast(); + fNDigits[1] = dig2->GetEntriesFast(); + + delete fgMathieson; + fgMathieson = new AliMUONMathieson(); + + fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0); + fSegmentation2[1]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 1); + fNseg = 2; + if (chamber < AliMUONConstants::NTrackingCh()) { + if (chamber > 1 ) { + fgMathieson->SetPitch(AliMUONConstants::Pitch()); + fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3()); + fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3()); + fChargeCorrel = AliMUONConstants::ChargeCorrel(); + } else { + fgMathieson->SetPitch(AliMUONConstants::PitchSt1()); + fgMathieson->SetSqrtKx3AndDeriveKx2Kx4(AliMUONConstants::SqrtKx3St1()); + fgMathieson->SetSqrtKy3AndDeriveKy2Ky4(AliMUONConstants::SqrtKy3St1()); + fChargeCorrel = AliMUONConstants::ChargeCorrelSt1(); + } + } } -void AliMUONClusterInput::SetDigits(Int_t chamber, TClonesArray* dig) +void AliMUONClusterInput::SetDigits(Int_t chamber, Int_t idDE, TClonesArray* dig) { // Set pointer to digits with corresponding segmentations and responses (one cathode plane) - fDigits[0]=dig; - AliMUON *pMUON; - AliMUONChamber* iChamber; - pMUON = (AliMUON*) gAlice->GetModule("MUON"); - iChamber = &(pMUON->Chamber(chamber)); + fChamber = chamber; + fDetElemId = idDE; + fDigits[0] = dig; - fSegmentation[0]=iChamber->SegmentationModel(1); - fResponse=iChamber->ResponseModel(); + fSegmentation2[0]= fgSegmentation->GetModuleSegmentationByDEId(fDetElemId, 0); fNseg=1; } void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster) { // Set the current cluster - fCluster=cluster; - Float_t qtot; - Int_t i, cath, ix, iy; - AliMUONDigit* digit; - fNmul[0]=cluster->fMultiplicity[0]; - fNmul[1]=cluster->fMultiplicity[1]; - printf("\n %p %p ", fDigits[0], fDigits[1]); - - for (cath=0; cath<2; cath++) { - qtot=0; - for (i=0; iUncheckedAt(cluster->fIndexMap[i][cath])); + //PH printf("\n %p \n", cluster); + fCluster=cluster; + Float_t qtot; + Int_t i, cath, ix, iy; + AliMUONDigit* digit; + fNmul[0]=cluster->GetMultiplicity(0); + fNmul[1]=cluster->GetMultiplicity(1); + //PH printf("\n %p %p ", fDigits[0], fDigits[1]); + + for (cath=0; cath<2; cath++) { + qtot=0; + for (i=0; iUncheckedAt(cluster->GetIndex(i,cath))); // pad coordinates - ix = digit->fPadX; - iy = digit->fPadY; + ix = digit->PadX(); + iy = digit->PadY(); // pad charge - fCharge[i][cath] = digit->fSignal; + fCharge[i][cath] = digit->Signal(); // pad centre coordinates // fSegmentation[cath]->GetPadCxy(ix, iy, x, y); // globals kUsed in fitting functions @@ -105,6 +170,9 @@ void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster) fiy[i][cath]=iy; // total charge per cluster qtot+=fCharge[i][cath]; + // Current z + Float_t xc, yc; + fSegmentation2[cath]->GetPadC(fDetElemId,ix,iy,xc,yc,fZ); } // loop over cluster digits fQtot[cath]=qtot; fChargeTot[cath]=Int_t(qtot); @@ -115,16 +183,8 @@ void AliMUONClusterInput::SetCluster(AliMUONRawCluster* cluster) Float_t AliMUONClusterInput::DiscrChargeS1(Int_t i,Double_t *par) { -// par[0] x-position of cluster -// par[1] y-position of cluster - - fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]); -// First Cluster - fSegmentation[0]->SetHit(par[0],par[1]); - Float_t q1=fResponse->IntXY(fSegmentation[0]); - - Float_t value = fQtot[0]*q1; - return value; +// Compute the charge on first cathod only. +return DiscrChargeCombiS1(i,par,0); } Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cath) @@ -132,11 +192,12 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS1(Int_t i,Double_t *par, Int_t cat // par[0] x-position of cluster // par[1] y-position of cluster - fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); -// First Cluster - fSegmentation[cath]->SetHit(par[0],par[1]); - Float_t q1=fResponse->IntXY(fSegmentation[cath]); - + Float_t q1; + fSegmentation2[cath]-> SetPad(fDetElemId, fix[i][cath], fiy[i][cath]); + // First Cluster + fSegmentation2[cath]-> SetHit(fDetElemId, par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); + Float_t value = fQtot[cath]*q1; return value; } @@ -151,17 +212,19 @@ Float_t AliMUONClusterInput::DiscrChargeS2(Int_t i,Double_t *par) // par[4] charge fraction of first cluster // 1-par[4] charge fraction of second cluster - fSegmentation[0]->SetPad(fix[i][0], fiy[i][0]); -// First Cluster - fSegmentation[0]->SetHit(par[0],par[1]); - Float_t q1=fResponse->IntXY(fSegmentation[0]); - -// Second Cluster - fSegmentation[0]->SetHit(par[2],par[3]); - Float_t q2=fResponse->IntXY(fSegmentation[0]); - - Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); - return value; + Float_t q1, q2; + + fSegmentation2[0]->SetPad(fDetElemId, fix[i][0], fiy[i][0]); + // First Cluster + fSegmentation2[0]->SetHit(fDetElemId, par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]); + + // Second Cluster + fSegmentation2[0]->SetHit(fDetElemId,par[2],par[3],fZ); + q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[0]); + + Float_t value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); + return value; } Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cath) @@ -170,26 +233,38 @@ Float_t AliMUONClusterInput::DiscrChargeCombiS2(Int_t i,Double_t *par, Int_t cat // par[1] y-position of first cluster // par[2] x-position of second cluster // par[3] y-position of second cluster -// par[4] charge fraction of first cluster -// 1-par[4] charge fraction of second cluster +// par[4] charge fraction of first cluster - first cathode +// 1-par[4] charge fraction of second cluster +// par[5] charge fraction of first cluster - second cathode - fSegmentation[cath]->SetPad(fix[i][cath], fiy[i][cath]); -// First Cluster - fSegmentation[cath]->SetHit(par[0],par[1]); - Float_t q1=fResponse->IntXY(fSegmentation[cath]); - -// Second Cluster - fSegmentation[cath]->SetHit(par[2],par[3]); - Float_t q2=fResponse->IntXY(fSegmentation[cath]); - Float_t value; - if (cath==0) { - value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); - } else { - value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2); - } - return value; -} + Float_t q1, q2; + fSegmentation2[cath]->SetPad(fDetElemId,fix[i][cath], fiy[i][cath]); + // First Cluster + fSegmentation2[cath]->SetHit(fDetElemId,par[0],par[1],fZ); + q1 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); + + // Second Cluster + fSegmentation2[cath]->SetHit(fDetElemId,par[2],par[3],fZ); + q2 = fgMathieson->IntXY(fDetElemId, fSegmentation2[cath]); + + Float_t value; + if (cath==0) { + value = fQtot[0]*(par[4]*q1+(1.-par[4])*q2); + } else { + value = fQtot[1]*(par[5]*q1+(1.-par[5])*q2); + } + return value; +} +AliMUONClusterInput& AliMUONClusterInput +::operator = (const AliMUONClusterInput& rhs) +{ +// Protected assignement operator + if (this == &rhs) return *this; + AliFatal("Not implemented."); + + return *this; +}