From: cblume Date: Tue, 19 Jun 2007 13:50:47 +0000 (+0000) Subject: Move pad planes from AliTRDCommomParam to AliTRDgeometry X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=f162af6205f51774212a6007e8ac93a12f011978;p=u%2Fmrichter%2FAliRoot.git Move pad planes from AliTRDCommomParam to AliTRDgeometry --- diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 9b48974e5b2..7e44e869da9 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -108,18 +108,10 @@ AliTRD::AliTRD(const char *name, const char *title) exit(1); } - // Save the geometry - TDirectory *saveDir = gDirectory; - gAlice->GetRunLoader()->CdGAFile(); - fGeometry->Write("TRDgeometry"); - saveDir->cd(); - // Allocate the hit array fHits = new TClonesArray("AliTRDhit",405); gAlice->GetMCApp()->AddHitList(fHits); - //PH SetMarkerColor(kWhite); - } //_____________________________________________________________________________ diff --git a/TRD/AliTRDCalibPadStatus.cxx b/TRD/AliTRDCalibPadStatus.cxx index 09f1d032c7b..0308a6aa6e2 100644 --- a/TRD/AliTRDCalibPadStatus.cxx +++ b/TRD/AliTRDCalibPadStatus.cxx @@ -64,17 +64,18 @@ histo->Draw(); #include #include #include "TTreeStream.h" + //AliRoot includes #include "AliRawReader.h" #include "AliRawReaderRoot.h" #include "AliRawReaderDate.h" + #include "AliTRDRawStream.h" +#include "AliTRDarrayF.h" +#include "AliTRDgeometry.h" #include "./Cal/AliTRDCalROC.h" #include "./Cal/AliTRDCalPadStatus.h" #include "./Cal/AliTRDCalSingleChamberStatus.h" -#include "AliTRDarrayF.h" -#include "AliTRDCommonParam.h" - #ifdef ALI_DATE #include "event.h" @@ -83,13 +84,12 @@ histo->Draw(); //header file #include "AliTRDCalibPadStatus.h" - - ClassImp(AliTRDCalibPadStatus) /*FOLD00*/ //_____________________________________________________________________ AliTRDCalibPadStatus::AliTRDCalibPadStatus() : /*FOLD00*/ TObject(), + fGeo(0), fAdcMin(0), fAdcMax(20), fDetector(-1), @@ -107,11 +107,15 @@ AliTRDCalibPadStatus::AliTRDCalibPadStatus() : /*FOLD00*/ // // default constructor // + + fGeo = new AliTRDgeometry(); + } //_____________________________________________________________________ AliTRDCalibPadStatus::AliTRDCalibPadStatus(const AliTRDCalibPadStatus &ped) : /*FOLD00*/ TObject(ped), + fGeo(0), fAdcMin(ped.GetAdcMin()), fAdcMax(ped.GetAdcMax()), fDetector(ped.fDetector), @@ -150,7 +154,14 @@ AliTRDCalibPadStatus::AliTRDCalibPadStatus(const AliTRDCalibPadStatus &ped) : /* } } + + if (fGeo) { + delete fGeo; + } + fGeo = new AliTRDgeometry(); + } + //_____________________________________________________________________ AliTRDCalibPadStatus& AliTRDCalibPadStatus::operator = (const AliTRDCalibPadStatus &source) { @@ -162,13 +173,20 @@ AliTRDCalibPadStatus& AliTRDCalibPadStatus::operator = (const AliTRDCalibPadSta return *this; } + //_____________________________________________________________________ AliTRDCalibPadStatus::~AliTRDCalibPadStatus() /*FOLD00*/ { // // destructor // + + if (fGeo) { + delete fGeo; + } + } + //_____________________________________________________________________ Int_t AliTRDCalibPadStatus::Update(const Int_t icdet, /*FOLD00*/ const Int_t icRow, @@ -336,20 +354,16 @@ Bool_t AliTRDCalibPadStatus::TestEvent(Int_t nevent) /*FOLD00*/ // fill one oroc and one iroc with random gaus // - AliTRDCommonParam *comParam = AliTRDCommonParam::Instance(); - if (!comParam) { - return 0; - } gRandom->SetSeed(0); for (Int_t ism=0; ism<18; ism++){ for (Int_t ich=0; ich < 5; ich++){ for (Int_t ipl=0; ipl < 6; ipl++){ - for(Int_t irow = 0; irow < comParam->GetRowMax(ipl,ich,ism); irow++){ - for(Int_t icol = 0; icol < comParam->GetColMax(ipl); icol++){ + for(Int_t irow = 0; irow < fGeo->GetRowMax(ipl,ich,ism); irow++){ + for(Int_t icol = 0; icol < fGeo->GetColMax(ipl); icol++){ for (Int_t iTimeBin=0; iTimeBin<(30*nevent); iTimeBin++){ Int_t signal=(Int_t)(ich+8+gRandom->Gaus(0,1.2)); - if ( signal>0 )Update((ipl+ich*6+ism*6*5),irow,icol,signal,comParam->GetRowMax(ipl,ich,ism)); + if ( signal>0 )Update((ipl+ich*6+ism*6*5),irow,icol,signal,fGeo->GetRowMax(ipl,ich,ism)); } } } @@ -366,20 +380,16 @@ Bool_t AliTRDCalibPadStatus::TestEventHisto(Int_t nevent) /*FOLD00*/ // fill one oroc and one iroc with random gaus // - AliTRDCommonParam *comParam = AliTRDCommonParam::Instance(); - if (!comParam) { - return 0; - } gRandom->SetSeed(0); for (Int_t ism=0; ism<18; ism++){ for (Int_t ich=0; ich < 5; ich++){ for (Int_t ipl=0; ipl < 6; ipl++){ - for(Int_t irow = 0; irow < comParam->GetRowMax(ipl,ich,ism); irow++){ - for(Int_t icol = 0; icol < comParam->GetColMax(ipl); icol++){ + for(Int_t irow = 0; irow < fGeo->GetRowMax(ipl,ich,ism); irow++){ + for(Int_t icol = 0; icol < fGeo->GetColMax(ipl); icol++){ for (Int_t iTimeBin=0; iTimeBin<(30*nevent); iTimeBin++){ Int_t signal=(Int_t)(ich+8+gRandom->Gaus(0,1.2)); - if ( signal>0 )UpdateHisto((ipl+ich*6+ism*6*5),irow,icol,signal,comParam->GetRowMax(ipl,ich,ism)); + if ( signal>0 )UpdateHisto((ipl+ich*6+ism*6*5),irow,icol,signal,fGeo->GetRowMax(ipl,ich,ism)); } } } @@ -406,11 +416,8 @@ TH2F* AliTRDCalibPadStatus::GetHisto(Int_t det, TObjArray *arr, /*FOLD00*/ sprintf(name,"hCalib%s%.2d",type,det); sprintf(title,"%s calibration histogram detector %.2d;ADC channel;Channel (pad)",type,det); - AliTRDCommonParam *comParam = AliTRDCommonParam::Instance(); - if (!comParam) { - return 0x0; - } - Int_t nbchannels = comParam->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det))*comParam->GetColMax(GetPlane(det)); + Int_t nbchannels = fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det)) + * fGeo->GetColMax(GetPlane(det)); // new histogram with calib information. One value for each pad! TH2F* hist = new TH2F(name,title, @@ -443,11 +450,8 @@ AliTRDarrayF* AliTRDCalibPadStatus::GetCal(Int_t det, TObjArray* arr, Bool_t for // if we are forced and histogram doesn't yes exist create it AliTRDarrayF *croc = new AliTRDarrayF(); - AliTRDCommonParam *comParam = AliTRDCommonParam::Instance(); - if (!comParam) { - return croc; - } - Int_t nbpad = comParam->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det))*comParam->GetColMax(GetPlane(det)); + Int_t nbpad = fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det)) + * fGeo->GetColMax(GetPlane(det)); // new AliTRDCalROC. One value for each pad! croc->Expand(nbpad); diff --git a/TRD/AliTRDCalibPadStatus.h b/TRD/AliTRDCalibPadStatus.h index cfa1cb73a38..69d3dc6a9cd 100644 --- a/TRD/AliTRDCalibPadStatus.h +++ b/TRD/AliTRDCalibPadStatus.h @@ -14,11 +14,15 @@ class TObjArray; class TH2F; class TTreeSRedirector; + +class AliRawReader; + class AliTRDCalROC; class AliTRDCalPadStatus; class AliTRDRawStream; class AliTRDarrayF; -class AliRawReader; +class AliTRDgeometry; + struct eventHeaderStruct; class AliTRDCalibPadStatus : public TObject { @@ -64,6 +68,9 @@ public: private: + // Geometry + AliTRDgeometry *fGeo; //! The TRD geometry + Int_t fAdcMin; // min adc channel of pedestal value Int_t fAdcMax; // max adc channel of pedestal value Int_t fDetector; // Current detector @@ -93,9 +100,7 @@ private: virtual Int_t GetChamber(Int_t d) const; virtual Int_t GetSector(Int_t d) const; -public: - - ClassDef(AliTRDCalibPadStatus,1) + ClassDef(AliTRDCalibPadStatus,2) }; diff --git a/TRD/AliTRDCalibraFillHisto.cxx b/TRD/AliTRDCalibraFillHisto.cxx index 15dac5e5b1a..cffb941b6a0 100644 --- a/TRD/AliTRDCalibraFillHisto.cxx +++ b/TRD/AliTRDCalibraFillHisto.cxx @@ -54,6 +54,8 @@ #include "AliLog.h" #include "AliCDBManager.h" +#include "AliRawReader.h" +#include "AliRawReaderDate.h" #include "AliTRDCalibraFillHisto.h" #include "AliTRDCalibraMode.h" @@ -65,14 +67,12 @@ #include "AliTRDcluster.h" #include "AliTRDtrack.h" #include "AliTRDRawStream.h" -#include "AliRawReader.h" -#include "AliRawReaderDate.h" +#include "AliTRDgeometry.h" #ifdef ALI_DATE #include "event.h" #endif - ClassImp(AliTRDCalibraFillHisto) AliTRDCalibraFillHisto* AliTRDCalibraFillHisto::fgInstance = 0; @@ -116,6 +116,7 @@ void AliTRDCalibraFillHisto::Terminate() //______________________________________________________________________________________ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto() :TObject() + ,fGeo(0) ,fMITracking(kFALSE) ,fMcmTracking(kFALSE) ,fMcmCorrectAngle(kFALSE) @@ -174,56 +175,60 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto() fNumberUsedCh[1] = 0; fNumberUsedPh[0] = 0; fNumberUsedPh[1] = 0; + + fGeo = new AliTRDgeometry(); } + //______________________________________________________________________________________ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c) -:TObject(c) -,fMITracking(c.fMITracking) -,fMcmTracking(c.fMcmTracking) -,fMcmCorrectAngle(c.fMcmCorrectAngle) -,fCH2dOn(c.fCH2dOn) -,fPH2dOn(c.fPH2dOn) -,fPRF2dOn(c.fPRF2dOn) -,fHisto2d(c.fHisto2d) -,fVector2d(c.fVector2d) -,fLinearFitterOn(c.fLinearFitterOn) -,fLinearFitterDebugOn(c.fLinearFitterDebugOn) -,fRelativeScale(c.fRelativeScale) -,fThresholdClusterPRF2(c.fThresholdClusterPRF2) -,fCalibraMode(0x0) -,fDebugStreamer(0) -,fDebugLevel(c.fDebugLevel) -,fDetectorAliTRDtrack(c.fDetectorAliTRDtrack) -,fDetectorPreviousTrack(c.fDetectorPreviousTrack) -,fNumberClusters(c.fNumberClusters) -,fProcent(c.fProcent) -,fDifference(c.fDifference) -,fNumberTrack(c.fNumberTrack) -,fTimeMax(c.fTimeMax) -,fSf(c.fSf) -,fNumberBinCharge(c.fNumberBinCharge) -,fNumberBinPRF(c.fNumberBinPRF) -,fNgroupprf(c.fNgroupprf) -,fListClusters(new TObjArray()) -,fPar0(c.fPar0) -,fPar1(c.fPar1) -,fPar2(c.fPar2) -,fPar3(c.fPar3) -,fPar4(c.fPar4) -,fAmpTotal(c.fAmpTotal) -,fPHPlace(c.fPHPlace) -,fPHValue(c.fPHValue) -,fGoodTracklet(c.fGoodTracklet) -,fGoodTrack(c.fGoodTrack) -,fEntriesCH(c.fEntriesCH) -,fEntriesLinearFitter(fEntriesLinearFitter) -,fCalibraVector(0x0) -,fPH2d(0x0) -,fPRF2d(0x0) -,fCH2d(0x0) -,fLinearFitterArray(0) -,fLinearFitterHistoArray(0) + :TObject(c) + ,fGeo(0) + ,fMITracking(c.fMITracking) + ,fMcmTracking(c.fMcmTracking) + ,fMcmCorrectAngle(c.fMcmCorrectAngle) + ,fCH2dOn(c.fCH2dOn) + ,fPH2dOn(c.fPH2dOn) + ,fPRF2dOn(c.fPRF2dOn) + ,fHisto2d(c.fHisto2d) + ,fVector2d(c.fVector2d) + ,fLinearFitterOn(c.fLinearFitterOn) + ,fLinearFitterDebugOn(c.fLinearFitterDebugOn) + ,fRelativeScale(c.fRelativeScale) + ,fThresholdClusterPRF2(c.fThresholdClusterPRF2) + ,fCalibraMode(0x0) + ,fDebugStreamer(0) + ,fDebugLevel(c.fDebugLevel) + ,fDetectorAliTRDtrack(c.fDetectorAliTRDtrack) + ,fDetectorPreviousTrack(c.fDetectorPreviousTrack) + ,fNumberClusters(c.fNumberClusters) + ,fProcent(c.fProcent) + ,fDifference(c.fDifference) + ,fNumberTrack(c.fNumberTrack) + ,fTimeMax(c.fTimeMax) + ,fSf(c.fSf) + ,fNumberBinCharge(c.fNumberBinCharge) + ,fNumberBinPRF(c.fNumberBinPRF) + ,fNgroupprf(c.fNgroupprf) + ,fListClusters(new TObjArray()) + ,fPar0(c.fPar0) + ,fPar1(c.fPar1) + ,fPar2(c.fPar2) + ,fPar3(c.fPar3) + ,fPar4(c.fPar4) + ,fAmpTotal(c.fAmpTotal) + ,fPHPlace(c.fPHPlace) + ,fPHValue(c.fPHValue) + ,fGoodTracklet(c.fGoodTracklet) + ,fGoodTrack(c.fGoodTrack) + ,fEntriesCH(c.fEntriesCH) + ,fEntriesLinearFitter(fEntriesLinearFitter) + ,fCalibraVector(0x0) + ,fPH2d(0x0) + ,fPRF2d(0x0) + ,fCH2d(0x0) + ,fLinearFitterArray(0) + ,fLinearFitterHistoArray(0) { // // Copy constructor @@ -260,7 +265,13 @@ AliTRDCalibraFillHisto::AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c) } } } + if (fGeo) { + delete fGeo; + } + fGeo = new AliTRDgeometry(); + } + //____________________________________________________________________________________ AliTRDCalibraFillHisto::~AliTRDCalibraFillHisto() { @@ -270,6 +281,10 @@ AliTRDCalibraFillHisto::~AliTRDCalibraFillHisto() ClearHistos(); if ( fDebugStreamer ) delete fDebugStreamer; + + if (fGeo) { + delete fGeo; + } } @@ -720,13 +735,6 @@ Int_t *AliTRDCalibraFillHisto::CalculateRowCol(AliTRDcluster *cl) const rowcol[0] = 0; rowcol[1] = 0; - // Get the parameter object - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam"); - return rowcol; - } - // Localisation of the detector Int_t detector = cl->GetDetector(); Int_t chamber = GetChamber(detector); @@ -739,7 +747,7 @@ Int_t *AliTRDCalibraFillHisto::CalculateRowCol(AliTRDcluster *cl) const pos[2] = cl->GetZ(); // Position of the cluster - AliTRDpadPlane *padplane = parCom->GetPadPlane(plane,chamber); + AliTRDpadPlane *padplane = fGeo->GetPadPlane(plane,chamber); Int_t row = padplane->GetPadRowNumber(pos[2]); //Do not take from here because it was corrected from ExB already.... //Double_t offsetz = padplane->GetPadRowOffset(row,pos[2]); @@ -1771,13 +1779,6 @@ Bool_t AliTRDCalibraFillHisto::FindP1TrackPH() // This function will be called in the functions UpdateHistogram... // to fill the find the parameter P1 of a track for the drift velocity calibration // - - // Get the parameter object - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam"); - return kFALSE; - } //Number of points: if less than 3 return kFALSE Int_t Npoints = fListClusters->GetEntriesFast(); @@ -1799,7 +1800,7 @@ Bool_t AliTRDCalibraFillHisto::FindP1TrackPH() Double_t tiltingangle = 0; // tiltingangle of the pad Float_t dzdx = 0; // dz/dx now from dz/dl Int_t nbli = 0; // number linear fitter points - AliTRDpadPlane *padplane = parCom->GetPadPlane(GetPlane(detector),GetChamber(detector)); + AliTRDpadPlane *padplane = fGeo->GetPadPlane(GetPlane(detector),GetChamber(detector)); linearFitterTracklet.StoreData(kFALSE); linearFitterTracklet.ClearPoints(); @@ -1908,13 +1909,6 @@ Bool_t AliTRDCalibraFillHisto::HandlePRF() // For the offline tracking // Fit the tracklet with a line and take the position as reference for the PRF // - - // Get the parameter object - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam"); - return kFALSE; - } //Number of points Int_t Npoints = fListClusters->GetEntriesFast(); // number of total points diff --git a/TRD/AliTRDCalibraFillHisto.h b/TRD/AliTRDCalibraFillHisto.h index 67a44f552ea..6324d6d0c2d 100644 --- a/TRD/AliTRDCalibraFillHisto.h +++ b/TRD/AliTRDCalibraFillHisto.h @@ -33,14 +33,15 @@ class TH2; class TLinearFitter; class AliLog; +class AliRawReader; + class AliTRDCalibraMode; class AliTRDCalibraVector; - -class AliRawReader; class AliTRDRawStream; class AliTRDcluster; class AliTRDtrack; class AliTRDmcmTracklet; +class AliTRDgeometry; class TTreeSRedirector; struct eventHeaderStruct; @@ -164,6 +165,9 @@ AliTRDCalibraVector *GetCalibraVector() const { r protected: + // Geometry + AliTRDgeometry *fGeo; //! The TRD geometry + // Choice to fill or not the 2D Bool_t fMITracking; // Chose to fill the 2D histos or vectors during the offline MI tracking Bool_t fMcmTracking; // Chose to fill the 2D histos or vectors during the tracking with tracklets @@ -274,7 +278,7 @@ AliTRDCalibraVector *GetCalibraVector() const { r static Bool_t fgTerminated; // If terminated - ClassDef(AliTRDCalibraFillHisto,2) // TRD Calibration class + ClassDef(AliTRDCalibraFillHisto,3) // TRD Calibration class }; diff --git a/TRD/AliTRDCalibraFit.cxx b/TRD/AliTRDCalibraFit.cxx index 6bf95201556..91a73d8b299 100644 --- a/TRD/AliTRDCalibraFit.cxx +++ b/TRD/AliTRDCalibraFit.cxx @@ -75,7 +75,6 @@ #include "AliTRDCalibraVector.h" #include "AliTRDcalibDB.h" #include "AliTRDgeometry.h" -#include "AliTRDCommonParam.h" #include "./Cal/AliTRDCalROC.h" #include "./Cal/AliTRDCalPad.h" #include "./Cal/AliTRDCalDet.h" @@ -125,6 +124,7 @@ void AliTRDCalibraFit::Terminate() //______________________________________________________________________________________ AliTRDCalibraFit::AliTRDCalibraFit() :TObject() + ,fGeo(0) ,fWriteNameCoef(0) ,fFitPHOn(kFALSE) ,fFitPol2On(kFALSE) @@ -173,6 +173,7 @@ AliTRDCalibraFit::AliTRDCalibraFit() // Default constructor // + fGeo = new AliTRDgeometry(); fCalibraMode = new AliTRDCalibraMode(); // Write @@ -197,6 +198,7 @@ AliTRDCalibraFit::AliTRDCalibraFit() //______________________________________________________________________________________ AliTRDCalibraFit::AliTRDCalibraFit(const AliTRDCalibraFit &c) :TObject(c) + ,fGeo(0) ,fWriteNameCoef(0) ,fFitPHOn(kFALSE) ,fFitPol2On(kFALSE) @@ -256,6 +258,10 @@ AliTRDCalibraFit::~AliTRDCalibraFit() ClearTree(); + if (fGeo) { + delete fGeo; + } + } //_____________________________________________________________________________ @@ -2495,13 +2501,6 @@ Bool_t AliTRDCalibraFit::InitFit(Int_t nbins, Int_t i) gStyle->SetPadLeftMargin(0.13); gStyle->SetPadRightMargin(0.01); - // Get the parameter object - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam"); - return kFALSE; - } - // Mode groups of pads: the total number of bins! Int_t numberofbinsexpected = 0; fCalibraMode->ModePadCalibration(2,i); @@ -2617,8 +2616,8 @@ Bool_t AliTRDCalibraFit::InitFit(Int_t nbins, Int_t i) AliInfo(Form("You will see the detector: iPlane %d, iChamb %d, iSect %d" ,fDet[0],fDet[1],fDet[2])); // A little geometry: - Int_t rowMax = parCom->GetRowMax(fDet[0],fDet[1],fDet[2]); - Int_t colMax = parCom->GetColMax(fDet[0]); + Int_t rowMax = fGeo->GetRowMax(fDet[0],fDet[1],fDet[2]); + Int_t colMax = fGeo->GetColMax(fDet[0]); // Create the histos to visualise CreateFitHistoCHDB(rowMax,colMax); if (fDebug == 4) { @@ -2689,8 +2688,8 @@ Bool_t AliTRDCalibraFit::InitFit(Int_t nbins, Int_t i) AliInfo(Form("You will see the detector: iPlane %d, iChamb %d, iSect %d" ,fDet[0],fDet[1],fDet[2])); // A little geometry: - Int_t rowMax = parCom->GetRowMax(fDet[0],fDet[1],fDet[2]); - Int_t colMax = parCom->GetColMax(fDet[0]); + Int_t rowMax = fGeo->GetRowMax(fDet[0],fDet[1],fDet[2]); + Int_t colMax = fGeo->GetColMax(fDet[0]); // Create the histos to visualise CreateFitHistoPHDB(rowMax,colMax); CreateFitHistoT0DB(rowMax,colMax); @@ -2761,8 +2760,8 @@ Bool_t AliTRDCalibraFit::InitFit(Int_t nbins, Int_t i) AliInfo(Form("You will see the detector: iPlane %d, iChamb %d, iSect %d" ,fDet[0],fDet[1],fDet[2])); // A little geometry: - Int_t rowMax = parCom->GetRowMax(fDet[0],fDet[1],fDet[2]); - Int_t colMax = parCom->GetColMax(fDet[0]); + Int_t rowMax = fGeo->GetRowMax(fDet[0],fDet[1],fDet[2]); + Int_t colMax = fGeo->GetColMax(fDet[0]); // Create the histos to visualise CreateFitHistoPRFDB(rowMax,colMax); if (fDebug == 4) { @@ -2865,14 +2864,7 @@ Bool_t AliTRDCalibraFit::NotEnoughStatistic(Int_t idect, Int_t i) // of the calibration group, the value present in the choosen database // will be put. A negativ sign enables to know that a fit was not possible. // - - // Get the parameter object - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam Manager"); - return kFALSE; - } - + // Get cal AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); if (!cal) { @@ -3051,7 +3043,7 @@ Bool_t AliTRDCalibraFit::NotEnoughStatistic(Int_t idect, Int_t i) // Pointer to the branch for (Int_t k = fCalibraMode->GetRowMin(2); k < fCalibraMode->GetRowMax(2); k++) { for (Int_t j = fCalibraMode->GetColMin(2); j < fCalibraMode->GetColMax(2); j++) { - if((parCom->GetColMax(GetPlane(fCountDet[2])) != (j+1)) && (j != 0)){ + if((fGeo->GetColMax(GetPlane(fCountDet[2])) != (j+1)) && (j != 0)){ if (GetChamber(fCountDet[2]) == 2) { fPRFPad[(Int_t)(j*12+k)] = -fPRFCoef[1]; } @@ -3099,13 +3091,6 @@ Bool_t AliTRDCalibraFit::FillInfosFit(Int_t idect, Int_t i) // methods from the Fit functions // - // Get the parameter object - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam Manager"); - return kFALSE; - } - // Get cal AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); if (!cal) { @@ -3180,7 +3165,7 @@ Bool_t AliTRDCalibraFit::FillInfosFit(Int_t idect, Int_t i) // Pointer to the branch for (Int_t k = fCalibraMode->GetRowMin(2); k < fCalibraMode->GetRowMax(2); k++) { for (Int_t j = fCalibraMode->GetColMin(2); j < fCalibraMode->GetColMax(2); j++) { - if ((parCom->GetColMax(GetPlane(fCountDet[2])) != (j+1)) && (j != 0)) { + if ((fGeo->GetColMax(GetPlane(fCountDet[2])) != (j+1)) && (j != 0)) { if (GetChamber(fCountDet[2]) == 2) { fPRFPad[(Int_t)(j*12+k)] = fPRFCoef[fFitPRFNDB]; } @@ -4931,11 +4916,6 @@ Bool_t AliTRDCalibraFit::CalculChargeCoefMean(Int_t dect, Int_t idect, Bool_t vr AliInfo("Could not get calibDB Manager"); return kFALSE; } - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam Manager"); - return kFALSE; - } fChargeCoef[3] = 0.0; @@ -5004,12 +4984,6 @@ Bool_t AliTRDCalibraFit::CalculPRFCoefMean(Int_t dect, Int_t idect) return kFALSE; } - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam Manager"); - return kFALSE; - } - fPRFCoef[1] = 0.0; Int_t cot = 0; @@ -5017,7 +4991,7 @@ Bool_t AliTRDCalibraFit::CalculPRFCoefMean(Int_t dect, Int_t idect) for (Int_t row = fCalibraMode->GetRowMin(2); row < fCalibraMode->GetRowMax(2); row++) { for (Int_t col = fCalibraMode->GetColMin(2); col < fCalibraMode->GetColMax(2); col++) { - if ((parCom->GetColMax(GetPlane(dect)) != (col+1)) && (col != 0)) { + if ((fGeo->GetColMax(GetPlane(dect)) != (col+1)) && (col != 0)) { cot++; if (fAccCDB) { fPRFCoef[1] += (Float_t) cal->GetPRFWidth(dect,col,row); diff --git a/TRD/AliTRDCalibraFit.h b/TRD/AliTRDCalibraFit.h index 1b6e3bff4ca..4e247f218f4 100644 --- a/TRD/AliTRDCalibraFit.h +++ b/TRD/AliTRDCalibraFit.h @@ -27,9 +27,11 @@ class TH2F; class TF1; class AliLog; + class AliTRDCalibraMode; class AliTRDCalibraVector; class AliTRDCalDet; +class AliTRDgeometry; class AliTRDCalibraFit : public TObject { @@ -174,6 +176,9 @@ AliTRDCalibraVector *GetCalibraVector() const { r protected: + // Geometry + AliTRDgeometry *fGeo; //! The TRD geometry + // Write Bool_t fWriteCoef[3]; // Do you want to write the result in a file? TString fWriteNameCoef; // Where the coef Det are written @@ -393,7 +398,7 @@ AliTRDCalibraVector *GetCalibraVector() const { r static AliTRDCalibraFit *fgInstance; // Instance static Bool_t fgTerminated; // If terminated - ClassDef(AliTRDCalibraFit,1) // TRD Calibration class + ClassDef(AliTRDCalibraFit,2) // TRD Calibration class }; diff --git a/TRD/AliTRDCalibraMode.cxx b/TRD/AliTRDCalibraMode.cxx index 1dfada6c9b4..0c95899fb15 100644 --- a/TRD/AliTRDCalibraMode.cxx +++ b/TRD/AliTRDCalibraMode.cxx @@ -56,13 +56,14 @@ #include "AliLog.h" #include "AliTRDCalibraMode.h" -#include "AliTRDCommonParam.h" +#include "AliTRDgeometry.h" ClassImp(AliTRDCalibraMode) //______________________________________________________________________________________ AliTRDCalibraMode::AliTRDCalibraMode() :TObject() + ,fGeo(0) { // // Default constructor @@ -89,12 +90,15 @@ AliTRDCalibraMode::AliTRDCalibraMode() fNfragRphi[i] = -1; fXbins[i] = -1; } - + + fGeo = new AliTRDgeometry(); + } //______________________________________________________________________________________ AliTRDCalibraMode::AliTRDCalibraMode(const AliTRDCalibraMode &c) :TObject(c) + ,fGeo(0) { // // Copy constructor @@ -116,7 +120,13 @@ AliTRDCalibraMode::AliTRDCalibraMode(const AliTRDCalibraMode &c) fDetChamb2[k] = c.fDetChamb2[k]; } + if (fGeo) { + delete fGeo; + } + fGeo = new AliTRDgeometry(); + } + //____________________________________________________________________________________ AliTRDCalibraMode::~AliTRDCalibraMode() { @@ -124,6 +134,10 @@ AliTRDCalibraMode::~AliTRDCalibraMode() // AliTRDCalibraMode destructor // + if (fGeo) { + delete fGeo; + } + } //_____________________________________________________________________________ @@ -232,16 +246,10 @@ Bool_t AliTRDCalibraMode::ModePadFragmentation(Int_t iPlane,Int_t iChamb, Int_t fNfragZ[i] = 0; fNfragRphi[i] = 0; - - AliTRDCommonParam *parCom = AliTRDCommonParam::Instance(); - if (!parCom) { - AliInfo("Could not get CommonParam Manager"); - return kFALSE; - } // A little geometry: - Int_t rowMax = parCom->GetRowMax(iPlane,iChamb,iSect); - Int_t colMax = parCom->GetColMax(iPlane); + Int_t rowMax = fGeo->GetRowMax(iPlane,iChamb,iSect); + Int_t colMax = fGeo->GetColMax(iPlane); // The fragmentation if (fNnZ[i] != 0) { diff --git a/TRD/AliTRDCalibraMode.h b/TRD/AliTRDCalibraMode.h index d3e9afcb5d4..9b087d6a45d 100644 --- a/TRD/AliTRDCalibraMode.h +++ b/TRD/AliTRDCalibraMode.h @@ -15,6 +15,8 @@ # include #endif +class AliTRDgeometry; + class AliTRDCalibraMode : public TObject { public: @@ -64,6 +66,9 @@ class AliTRDCalibraMode : public TObject { protected: + // Geometry + AliTRDgeometry *fGeo; //! The TRD geometry + Short_t fNz[3]; // Mode of calibration Short_t fNrphi[3]; // Mode of calibration Short_t fNnZ[3]; // Number of pad rows in a group @@ -83,7 +88,7 @@ class AliTRDCalibraMode : public TObject { virtual Int_t GetChamber(Int_t d) const; virtual Int_t GetSector(Int_t d) const; - ClassDef(AliTRDCalibraMode,1) // TRD Calibration class + ClassDef(AliTRDCalibraMode,2) // TRD Calibration class }; #endif diff --git a/TRD/AliTRDCommonParam.cxx b/TRD/AliTRDCommonParam.cxx index aa025f39305..ed377a62d56 100644 --- a/TRD/AliTRDCommonParam.cxx +++ b/TRD/AliTRDCommonParam.cxx @@ -30,8 +30,6 @@ #include "AliRun.h" #include "AliTRDCommonParam.h" -#include "AliTRDpadPlane.h" - ClassImp(AliTRDCommonParam) @@ -82,7 +80,6 @@ AliTRDCommonParam::AliTRDCommonParam() :TObject() ,fExBOn(kFALSE) ,fSamplingFrequency(0.0) - ,fPadPlaneArray(0) { // // Default constructor @@ -104,19 +101,6 @@ void AliTRDCommonParam::Init() // Sampling Frequency in MHz fSamplingFrequency = 10.0; - - // ---------------------------------------------------------------------------- - // The pad planes - // ---------------------------------------------------------------------------- - - fPadPlaneArray = new TObjArray(kNplan * kNcham); - - for (Int_t iplan = 0; iplan < kNplan; iplan++) { - for (Int_t icham = 0; icham < kNcham; icham++) { - Int_t ipp = iplan + icham * kNplan; - fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp); - } - } } @@ -127,12 +111,6 @@ AliTRDCommonParam::~AliTRDCommonParam() // Destructor // - if (fPadPlaneArray) { - fPadPlaneArray->Delete(); - delete fPadPlaneArray; - fPadPlaneArray = 0; - } - } //_____________________________________________________________________________ @@ -140,7 +118,6 @@ AliTRDCommonParam::AliTRDCommonParam(const AliTRDCommonParam &p) :TObject(p) ,fExBOn(p.fExBOn) ,fSamplingFrequency(p.fSamplingFrequency) - ,fPadPlaneArray(0) { // // Copy constructor @@ -179,59 +156,3 @@ void AliTRDCommonParam::Copy(TObject &p) const target->fSamplingFrequency = fSamplingFrequency; } - -//_____________________________________________________________________________ -AliTRDpadPlane *AliTRDCommonParam::GetPadPlane(Int_t p, Int_t c) const -{ - // - // Returns the pad plane for a given plane

and chamber number - // - - Int_t ipp = p + c * kNplan; - return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp)); - -} - -//_____________________________________________________________________________ -Int_t AliTRDCommonParam::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const -{ - // - // Returns the number of rows on the pad plane - // - - return GetPadPlane(p,c)->GetNrows(); - -} - -//_____________________________________________________________________________ -Int_t AliTRDCommonParam::GetColMax(Int_t p) const -{ - // - // Returns the number of rows on the pad plane - // - - return GetPadPlane(p,0)->GetNcols(); - -} - -//_____________________________________________________________________________ -Double_t AliTRDCommonParam::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const -{ - // - // Returns the position of the border of the first pad in a row - // - - return GetPadPlane(p,c)->GetRow0(); - -} - -//_____________________________________________________________________________ -Double_t AliTRDCommonParam::GetCol0(Int_t p) const -{ - // - // Returns the position of the border of the first pad in a column - // - - return GetPadPlane(p,0)->GetCol0(); - -} diff --git a/TRD/AliTRDCommonParam.h b/TRD/AliTRDCommonParam.h index 34789af7498..c29c23b4d65 100644 --- a/TRD/AliTRDCommonParam.h +++ b/TRD/AliTRDCommonParam.h @@ -36,11 +36,6 @@ class AliTRDCommonParam : public TObject Bool_t ExBOn() const { return fExBOn; } - AliTRDpadPlane *GetPadPlane(Int_t p, Int_t c) const; - Int_t GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const; - Int_t GetColMax(Int_t p) const; - Double_t GetRow0(Int_t p, Int_t c, Int_t /*s*/) const; - Double_t GetCol0(Int_t p) const; Float_t GetSamplingFrequency() const { return fSamplingFrequency; } protected: @@ -54,14 +49,13 @@ class AliTRDCommonParam : public TObject Float_t fSamplingFrequency; // Sampling Frequency in MHz - TObjArray *fPadPlaneArray; //! Array of pad plane objects - private: // This is a singleton, constructor is private! AliTRDCommonParam(); - ClassDef(AliTRDCommonParam,3) // The constant parameters common to simulation and reconstruction + ClassDef(AliTRDCommonParam,4) // The constant parameters common to simulation and reconstruction + }; #endif diff --git a/TRD/AliTRDRawStream.cxx b/TRD/AliTRDRawStream.cxx index a34a9f2a6fb..cf249cc43a3 100644 --- a/TRD/AliTRDRawStream.cxx +++ b/TRD/AliTRDRawStream.cxx @@ -32,7 +32,6 @@ #include "AliRawReader.h" #include "AliTRDRawStream.h" #include "AliTRDgeometry.h" -#include "AliTRDCommonParam.h" #include "AliTRDcalibDB.h" ClassImp(AliTRDRawStream) @@ -104,8 +103,6 @@ AliTRDRawStream::AliTRDRawStream() ,fDataWord(NULL) ,fTimeBinsCalib(0) ,fGeo(NULL) - ,fCommonParam(NULL) - ,fCalibration(NULL) { // // Default constructor @@ -184,8 +181,6 @@ AliTRDRawStream::AliTRDRawStream(AliRawReader *rawReader) ,fDataWord(NULL) ,fTimeBinsCalib(0) ,fGeo(NULL) - ,fCommonParam(NULL) - ,fCalibration(NULL) { // // Create an object to read TRD raw digits @@ -266,8 +261,6 @@ AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream) ,fDataWord(NULL) ,fTimeBinsCalib(0) ,fGeo(NULL) - ,fCommonParam(NULL) - ,fCalibration(NULL) { // // Copy constructor @@ -296,8 +289,11 @@ AliTRDRawStream::~AliTRDRawStream() // // Destructor // - - delete fGeo; + + if (fGeo) { + delete fGeo; + } + } //_____________________________________________________________________________ @@ -308,6 +304,7 @@ void AliTRDRawStream::SetRawReader(AliRawReader *rawReader) fRawReader = rawReader; } } + //_____________________________________________________________________________ Bool_t AliTRDRawStream::SetRawVersion(Int_t rv) { @@ -332,24 +329,16 @@ Int_t AliTRDRawStream::Init() // Initialization // - fCommonParam = AliTRDCommonParam::Instance(); - if (!fCommonParam) { - AliError("Could not get common parameters"); - return 0; - } - - fCalibration = AliTRDcalibDB::Instance(); - if (!fCalibration) { + if (!AliTRDcalibDB::Instance()) { AliError("Could not get calibration object"); return 0; } - if (!fGeo) - { - fGeo = new AliTRDgeometry(); - } + if (!fGeo) { + fGeo = new AliTRDgeometry(); + } - fTimeBinsCalib = fCalibration->GetNumberOfTimeBins(); + fTimeBinsCalib = AliTRDcalibDB::Instance()->GetNumberOfTimeBins(); AliDebug(2, Form("Number of Timebins read from CDB: %d", fTimeBinsCalib)); // The number of data words needed for this number of time bins (there @@ -550,8 +539,8 @@ Bool_t AliTRDRawStream::Next() { // HC header DecodeHCheader(fTimeBinsCalib); // This is the new header! fDET = fGeo->GetDetector(fLAYER, fSTACK, fSM); - fRowMax = fCommonParam->GetRowMax(fLAYER,fSTACK,fSM); - fColMax = fCommonParam->GetColMax(fROC); + fRowMax = fGeo->GetRowMax(fLAYER,fSTACK,fSM); + fColMax = fGeo->GetColMax(fROC); fMCMHctr2 = 0; fHCdataCtr = 0; diff --git a/TRD/AliTRDRawStream.h b/TRD/AliTRDRawStream.h index 7c47d633978..06eec72a33a 100644 --- a/TRD/AliTRDRawStream.h +++ b/TRD/AliTRDRawStream.h @@ -15,8 +15,6 @@ class AliTRDgeometry; class AliRawReader; -class AliTRDCommonParam; -class AliTRDcalibDB; // Some constants: const UInt_t kEndoftrackletmarker = 0xAAAAAAAA; /*This marks the end of tracklet data words*/ @@ -144,15 +142,15 @@ class AliTRDRawStream: public TObject { Bool_t fADCmask[21]; // Mask of active ADCs for zero suppression UShort_t fChamberDone[540]; // Chamber was processed already (1=1HC, 2=full chamber) - Int_t fRetVal; // Datadecode return - Int_t fEqID; // Equipment id - UInt_t fDataSize; // Size of the data available in the current buffer - Bool_t fSizeOK; // Did we read anything + Int_t fRetVal; // Datadecode return + Int_t fEqID; // Equipment id + UInt_t fDataSize; // Size of the data available in the current buffer + Bool_t fSizeOK; // Did we read anything UInt_t fCountBytes; // Bytes traversed in the buffer UInt_t fBufSize; // Size of the current RawReader buffer Bool_t fkBufferSet; // Is the RawReader buffer available - UChar_t *fPos; // Position in the buffer of the RawReader - UInt_t *fDataWord; // The pointer to the current 32 bit data word + UChar_t *fPos; // Position in the buffer of the RawReader + UInt_t *fDataWord; // The pointer to the current 32 bit data word UInt_t fTimeBinsCalib; // N of time bins retrieved from calibration enum ETRDzRawStreamError { @@ -175,17 +173,10 @@ class AliTRDRawStream: public TObject { AliTRDgeometry *fGeo; // TRD geometry - AliTRDCommonParam *fCommonParam; - AliTRDcalibDB *fCalibration; - void DecodeHCheader(Int_t timeBins); - void DecodeMCMheader(); - void DecodeTracklet(); - void DecodeGTUlinkMask(); - Int_t DecodeDataWord(); Int_t DecodeDataWordV1V2(); // Valid for fRawversion = 1, 2, ... Int_t DecodeDataWordV3(); // Valid for fRawversion = 3, ... @@ -194,7 +185,7 @@ class AliTRDRawStream: public TObject { enum { fkStart, fkStop, fkWordOK, fkNoMoreData, fkNextSM, fkNextHC, fkSeekNonEoTracklet, fkDecodeHC, fkNextMCM, fkNextData, fkReading}; - ClassDef(AliTRDRawStream, 4) // Class for reading TRD raw digits + ClassDef(AliTRDRawStream, 5) // Class for reading TRD raw digits }; #endif diff --git a/TRD/AliTRDReconstructor.cxx b/TRD/AliTRDReconstructor.cxx index 372faa488cf..680b1034d4f 100644 --- a/TRD/AliTRDReconstructor.cxx +++ b/TRD/AliTRDReconstructor.cxx @@ -33,8 +33,6 @@ #include "AliTRDclusterizerV1.h" #include "AliTRDtracker.h" #include "AliTRDpidESD.h" -#include "AliTRDtrigger.h" -#include "AliTRDtrigParam.h" #include "AliTRDgtuTrack.h" #include "AliTRDrawData.h" #include "AliTRDdigitsManager.h" @@ -86,39 +84,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader loader->UnloadRecPoints(); - // - // Trigger (tracklets, LTU) - // -// loader->LoadTracks(); -// if (loader->TreeT()) { -// AliError("Tracklets already exist"); -// return; -// } -// AliInfo("Trigger tracklets will be produced"); - -// AliTRDtrigger trdTrigger("Trigger","Trigger class"); - -// AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam" -// ,"TRD Trigger parameters"); - -// Float_t field = AliTracker::GetBz() * 0.1; // Tesla -// AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field)); -// trigp->SetField(field); -// trigp->Init(); -// trdTrigger.SetParameter(trigp); - -// rawReader->RewindEvents(); - -// for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { -// if (!rawReader->NextEvent()) break; -// trdTrigger.Open(runLoader->GetFileName(),iEvent); -// trdTrigger.ReadDigits(rawReader); -// trdTrigger.MakeTracklets(); -// trdTrigger.WriteTracklets(-1); -// } - -// loader->UnloadTracks(); - } //_____________________________________________________________________________ @@ -136,10 +101,6 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader clusterer.ReadDigits(rawReader); clusterer.MakeClusters(); - // - // No trigger, since we don't have the output tree for tracklets - // - } //_____________________________________________________________________________ @@ -155,10 +116,6 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree clusterer.ReadDigits(digitsTree); clusterer.MakeClusters(); - // - // No trigger, since we don't have the output tree for tracklets - // - } //_____________________________________________________________________________ @@ -184,32 +141,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader) const loader->UnloadRecPoints(); - // - // Trigger (tracklets, LTU) - // - loader->LoadTracks("RECREATE"); - AliInfo("Trigger tracklets will be produced"); - - AliTRDtrigger trdTrigger("Trigger","Trigger class"); - - AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam" - ,"TRD Trigger parameters"); - - Float_t field = AliTracker::GetBz() * 0.1; // Tesla - AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field)); - trigp->SetField(field); - trigp->Init(); - trdTrigger.SetParameter(trigp); - - for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { - trdTrigger.Open(runLoader->GetFileName(),iEvent); - trdTrigger.ReadDigits(); - trdTrigger.MakeTracklets(); - trdTrigger.WriteTracklets(-1); - } - - loader->UnloadTracks(); - } //_____________________________________________________________________________ @@ -237,10 +168,6 @@ void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/ AliTRDpidESD trdPID; trdPID.MakePID(esd); - // - // No trigger, since we don't have the output tree for tracklets - // - } //_____________________________________________________________________________ @@ -255,10 +182,6 @@ void AliTRDReconstructor::FillESD(AliRawReader* /*rawReader*/ AliTRDpidESD trdPID; trdPID.MakePID(esd); - // - // No trigger, since we don't have the output tree for tracklets - // - } //_____________________________________________________________________________ @@ -273,10 +196,6 @@ void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/ AliTRDpidESD trdPID; trdPID.MakePID(esd); - // - // No trigger, since we don't have the output tree for tracklets - // - } //_____________________________________________________________________________ @@ -290,51 +209,4 @@ void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/ AliTRDpidESD trdPID; trdPID.MakePID(esd); - // - // Trigger (tracks, GTU) - // -// AliTRDtrigger trdTrigger("Trigger","Trigger class"); - -// AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam" -// ,"TRD Trigger parameters"); - -// Float_t field = AliTracker::GetBz() * 0.1; // Tesla -// AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field)); -// trigp->SetField(field); -// trigp->Init(); - -// trdTrigger.SetParameter(trigp); -// trdTrigger.SetRunLoader(runLoader); -// trdTrigger.Init(); - -// Int_t iEvent = runLoader->GetEventNumber(); -// runLoader->GetEvent(iEvent); -// trdTrigger.ReadTracklets(runLoader); - -// AliESDTrdTrack *TrdTrack = new AliESDTrdTrack(); -// AliTRDgtuTrack *GtuTrack; - -// Int_t nTracks = trdTrigger.GetNumberOfTracks(); -// for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) { - -// GtuTrack = trdTrigger.GetTrack(iTrack); - -// TrdTrack->SetYproj(GtuTrack->GetYproj()); -// TrdTrack->SetZproj(GtuTrack->GetZproj()); -// TrdTrack->SetSlope(GtuTrack->GetSlope()); -// TrdTrack->SetDetector(GtuTrack->GetDetector()); -// TrdTrack->SetTracklets(GtuTrack->GetTracklets()); -// TrdTrack->SetPlanes(GtuTrack->GetPlanes()); -// TrdTrack->SetClusters(GtuTrack->GetClusters()); -// TrdTrack->SetPt(GtuTrack->GetPt()); -// TrdTrack->SetPhi(GtuTrack->GetPhi()); -// TrdTrack->SetEta(GtuTrack->GetEta()); -// TrdTrack->SetLabel(GtuTrack->GetLabel()); -// TrdTrack->SetPID(GtuTrack->GetPID()); -// TrdTrack->SetIsElectron(GtuTrack->IsElectron()); - -// esd->AddTrdTrack(TrdTrack); - -// } - } diff --git a/TRD/AliTRDTriggerL1.cxx b/TRD/AliTRDTriggerL1.cxx index a8cb2fe259c..5b72aa99275 100644 --- a/TRD/AliTRDTriggerL1.cxx +++ b/TRD/AliTRDTriggerL1.cxx @@ -90,18 +90,13 @@ void AliTRDTriggerL1::Trigger() TString evfoldname = AliConfig::GetDefaultEventFolderName(); AliRunLoader *runLoader = AliRunLoader::GetRunLoader(evfoldname); AliLoader *loader = runLoader->GetLoader("TRDLoader"); - AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(runLoader); - AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam","TRD Trigger parameters"); + AliTRDgeometry geo; AliTRDtrigger trdTrigger("Trigger","Trigger class"); Float_t field = AliTracker::GetBz() * 0.1; // Tesla AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field)); - trigp->SetField(field); - trigp->Init(); - - trdTrigger.SetParameter(trigp); trdTrigger.SetRunLoader(runLoader); trdTrigger.Init(); @@ -112,9 +107,9 @@ void AliTRDTriggerL1::Trigger() // Trigger (tracks, GTU) - Float_t highPt = trigp->GetHighPt(); - Float_t jetLowPt = trigp->GetJetLowPt(); - Float_t jetHighPt = trigp->GetJetHighPt(); + Float_t highPt = AliTRDtrigParam::Instance()->GetHighPt(); + Float_t jetLowPt = AliTRDtrigParam::Instance()->GetJetLowPt(); + Float_t jetHighPt = AliTRDtrigParam::Instance()->GetJetHighPt(); Float_t pid; Float_t pt; @@ -154,7 +149,7 @@ void AliTRDTriggerL1::Trigger() isElectron = gtuTrack->IsElectron(); pt = gtuTrack->GetPt(); det = gtuTrack->GetDetector(); - sec = geo->GetSector(det); + sec = geo.GetSector(det); if (isElectron) { @@ -201,10 +196,10 @@ void AliTRDTriggerL1::Trigger() } // Hadrons from jets - if (hadronJetLowPt >= trigp->GetNPartJetLow() ) { + if (hadronJetLowPt >= AliTRDtrigParam::Instance()->GetNPartJetLow() ) { SetInput("TRD_Jet_LPt_L1"); } - if (hadronJetHighPt >= trigp->GetNPartJetHigh()) { + if (hadronJetHighPt >= AliTRDtrigParam::Instance()->GetNPartJetHigh()) { SetInput("TRD_Jet_HPt_L1"); } diff --git a/TRD/AliTRDcluster.cxx b/TRD/AliTRDcluster.cxx index bef947b9296..279733c6fd7 100644 --- a/TRD/AliTRDcluster.cxx +++ b/TRD/AliTRDcluster.cxx @@ -23,7 +23,6 @@ /////////////////////////////////////////////////////////////////////////////// #include "AliTRDcluster.h" -#include "AliTRDrecPoint.h" ClassImp(AliTRDcluster) @@ -47,34 +46,6 @@ AliTRDcluster::AliTRDcluster() } -//_____________________________________________________________________________ -AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p) - :AliCluster() - ,fDetector(p.GetDetector()) - ,fTimeBin(p.GetLocalTimeBin()) - ,fQ(p.GetEnergy()) - ,fNPads(0) - ,fCenter(0) - ,fPad(0) -{ - // - // Constructor from AliTRDrecPoint - // - - SetLabel(p.GetTrackIndex(0),0); - SetLabel(p.GetTrackIndex(1),1); - SetLabel(p.GetTrackIndex(2),2); - SetY(p.GetY()); - SetZ(p.GetZ()); - - //fSigmaY2 = p.GetSigmaY2(); - //fSigmaZ2 = p.GetSigmaZ2(); - // Why is this ???? - SetSigmaY2(0.2); - SetSigmaZ2(5.0); - -} - //_____________________________________________________________________________ AliTRDcluster::AliTRDcluster(const AliTRDcluster &c) :AliCluster() diff --git a/TRD/AliTRDcluster.h b/TRD/AliTRDcluster.h index 84a11d02838..0c369f3311c 100644 --- a/TRD/AliTRDcluster.h +++ b/TRD/AliTRDcluster.h @@ -13,15 +13,12 @@ #include "AliCluster.h" -class AliTRDrecPoint; - class AliTRDcluster : public AliCluster { public: AliTRDcluster(); AliTRDcluster(const AliTRDcluster &c); - AliTRDcluster(const AliTRDrecPoint &p); virtual void AddTrackIndex(Int_t *i); diff --git a/TRD/AliTRDclusterMI.cxx b/TRD/AliTRDclusterMI.cxx index 45b9e04481a..b9fad66f8f9 100644 --- a/TRD/AliTRDclusterMI.cxx +++ b/TRD/AliTRDclusterMI.cxx @@ -22,7 +22,6 @@ /////////////////////////////////////////////////////////////////////////////// #include "AliTRDclusterMI.h" -#include "AliTRDrecPoint.h" ClassImp(AliTRDclusterMI) @@ -51,17 +50,3 @@ AliTRDclusterMI::AliTRDclusterMI(const AliTRDcluster &c) // } - -//_____________________________________________________________________________ -AliTRDclusterMI::AliTRDclusterMI(const AliTRDrecPoint &p) - :AliTRDcluster(p) - ,fRmsY(0) - ,fNPads(0) - ,fRelPos(0) -{ - // - // Constructor from AliTRDrecPoint - // - -} - diff --git a/TRD/AliTRDclusterMI.h b/TRD/AliTRDclusterMI.h index 4776f67369d..2f96e7d7297 100644 --- a/TRD/AliTRDclusterMI.h +++ b/TRD/AliTRDclusterMI.h @@ -14,15 +14,12 @@ #include "AliTRDcluster.h" #include "TMath.h" -class AliTRDrecPoint; - class AliTRDclusterMI : public AliTRDcluster { public: AliTRDclusterMI(); AliTRDclusterMI(const AliTRDcluster &c); - AliTRDclusterMI(const AliTRDrecPoint &p); void SetRmsY(Float_t rmsy) { fRmsY = rmsy; } void SetNPads(Int_t npads) { fNPads = npads; } diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index fcc53cf9c46..618cab4a7d9 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -32,7 +32,6 @@ #include "AliTRDclusterizer.h" #include "AliTRDcluster.h" -#include "AliTRDrecPoint.h" #include "AliTRDgeometry.h" #include "AliTRDcalibDB.h" #include "AliTRDCommonParam.h" diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index e1bcf392958..76ac4575438 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -43,7 +43,6 @@ #include "AliTRDcalibDB.h" #include "AliTRDSimParam.h" #include "AliTRDRecParam.h" -#include "AliTRDCommonParam.h" #include "AliTRDcluster.h" #include "Cal/AliTRDCalROC.h" @@ -192,11 +191,12 @@ Bool_t AliTRDclusterizerV1::MakeClusters() AliTRDdataArrayI *tracksIn; // Get the geometry - AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(fRunLoader); - if (!geo) { - AliWarning("Loading default TRD geometry!"); - geo = new AliTRDgeometry(); - } + //AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(fRunLoader); + //if (!geo) { + // AliWarning("Creating default TRD geometry!"); + // geo = new AliTRDgeometry(); + //} + AliTRDgeometry geo; AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); if (!calibration) { @@ -215,12 +215,6 @@ Bool_t AliTRDclusterizerV1::MakeClusters() AliError("No AliTRDRecParam instance available\n"); return kFALSE; } - - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { - AliError("Could not get common parameters\n"); - return kFALSE; - } // ADC thresholds Float_t ADCthreshold = simParam->GetADCthreshold(); @@ -269,7 +263,7 @@ Bool_t AliTRDclusterizerV1::MakeClusters() for (iplan = planBeg; iplan < planEnd; iplan++) { for (isect = sectBeg; isect < sectEnd; isect++) { - Int_t idet = geo->GetDetector(iplan,icham,isect); + Int_t idet = geo.GetDetector(iplan,icham,isect); Int_t ilayer = AliGeomManager::kTRD1 + iplan; Int_t imodule = icham + chamEnd * isect; UShort_t volid = AliGeomManager::LayerToVolUID(ilayer,imodule); @@ -284,10 +278,10 @@ Bool_t AliTRDclusterizerV1::MakeClusters() AliTRDdataArrayI *tracksTmp = fDigitsManager->GetDictionary(idet,0); tracksTmp->Expand(); - Int_t nRowMax = commonParam->GetRowMax(iplan,icham,isect); - Int_t nColMax = commonParam->GetColMax(iplan); + Int_t nRowMax = geo.GetRowMax(iplan,icham,isect); + Int_t nColMax = geo.GetColMax(iplan); - AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham); + AliTRDpadPlane *padPlane = geo.GetPadPlane(iplan,icham); // Calibration object with pad wise values for t0 AliTRDCalROC *calT0ROC = calibration->GetT0ROC(idet); diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index 2f033f0ec72..a3438eb3e11 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -333,6 +333,11 @@ AliTRDdigitizer::~AliTRDdigitizer() fTimeStruct2 = 0; } + if (fGeo) { + delete fGeo; + fGeo = 0; + } + } //_____________________________________________________________________________ @@ -658,8 +663,7 @@ Bool_t AliTRDdigitizer::InitDetector() } // Get the geometry - fGeo = fTRD->GetGeometry(); - AliDebug(1,Form("Geometry version %d",fGeo->IsVersion())); + fGeo = new AliTRDgeometry(); // Create a digits manager delete fDigitsManager; @@ -858,7 +862,7 @@ Bool_t AliTRDdigitizer::MakeDigits() Float_t hittime = hit->GetTime(); Int_t plane = fGeo->GetPlane(detector); Int_t chamber = fGeo->GetChamber(detector); - padPlane = commonParam->GetPadPlane(plane,chamber); + padPlane = fGeo->GetPadPlane(plane,chamber); Float_t row0 = padPlane->GetRow0ROC(); Int_t nRowMax = padPlane->GetNrows(); Int_t nColMax = padPlane->GetNcols(); @@ -1169,8 +1173,8 @@ Bool_t AliTRDdigitizer::MakeDigits() Int_t plane = fGeo->GetPlane(iDet); Int_t sector = fGeo->GetSector(iDet); Int_t chamber = fGeo->GetChamber(iDet); - Int_t nRowMax = commonParam->GetRowMax(plane,chamber,sector); - Int_t nColMax = commonParam->GetColMax(plane); + Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector); + Int_t nColMax = fGeo->GetColMax(plane); Double_t *inADC = new Double_t[nTimeTotal]; Double_t *outADC = new Double_t[nTimeTotal]; @@ -1385,12 +1389,6 @@ Bool_t AliTRDdigitizer::ConvertSDigits() return kFALSE; } - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { - AliFatal("Could not get common parameters"); - return kFALSE; - } - AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); if (!calibration) { AliFatal("Could not get calibration object"); @@ -1424,8 +1422,8 @@ Bool_t AliTRDdigitizer::ConvertSDigits() Int_t plane = fGeo->GetPlane(iDet); Int_t sector = fGeo->GetSector(iDet); Int_t chamber = fGeo->GetChamber(iDet); - Int_t nRowMax = commonParam->GetRowMax(plane,chamber,sector); - Int_t nColMax = commonParam->GetColMax(plane); + Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector); + Int_t nColMax = fGeo->GetColMax(plane); Double_t *inADC = new Double_t[nTimeTotal]; Double_t *outADC = new Double_t[nTimeTotal]; @@ -1549,12 +1547,6 @@ Bool_t AliTRDdigitizer::MergeSDigits() return kFALSE; } - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { - AliFatal("Could not get common parameters"); - return kFALSE; - } - AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); if (!calibration) { AliFatal("Could not get calibration object"); @@ -1601,8 +1593,8 @@ Bool_t AliTRDdigitizer::MergeSDigits() Int_t plane = fGeo->GetPlane(iDet); Int_t sector = fGeo->GetSector(iDet); Int_t chamber = fGeo->GetChamber(iDet); - Int_t nRowMax = commonParam->GetRowMax(plane,chamber,sector); - Int_t nColMax = commonParam->GetColMax(plane); + Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector); + Int_t nColMax = fGeo->GetColMax(plane); // Loop through the pixels of one detector and add the signals digitsA = fSDigitsManager->GetDigits(iDet); diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index 401fd25ce27..f451be96b30 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -34,7 +34,6 @@ #include "AliTRD.h" #include "AliTRDcalibDB.h" -#include "AliTRDCommonParam.h" #include "AliTRDgeometry.h" #include "AliTRDpadPlane.h" @@ -164,7 +163,7 @@ AliTRDgeometry::AliTRDgeometry() ,fMatrixArray(0) ,fMatrixCorrectionArray(0) ,fMatrixGeo(0) - + ,fPadPlaneArray(0) { // // AliTRDgeometry default constructor @@ -177,9 +176,10 @@ AliTRDgeometry::AliTRDgeometry() //_____________________________________________________________________________ AliTRDgeometry::AliTRDgeometry(const AliTRDgeometry &g) :AliGeometry(g) - ,fMatrixArray(g.fMatrixArray) - ,fMatrixCorrectionArray(g.fMatrixCorrectionArray) - ,fMatrixGeo(g.fMatrixGeo) + ,fMatrixArray(0) + ,fMatrixCorrectionArray(0) + ,fMatrixGeo(0) + ,fPadPlaneArray(0) { // // AliTRDgeometry copy constructor @@ -214,6 +214,12 @@ AliTRDgeometry::~AliTRDgeometry() fMatrixGeo = 0; } + if (fPadPlaneArray) { + fPadPlaneArray->Delete(); + delete fPadPlaneArray; + fPadPlaneArray = 0; + } + } //_____________________________________________________________________________ @@ -275,12 +281,253 @@ void AliTRDgeometry::Init() fRotB22[isect] = TMath::Cos(phi); } + // Initialize the SM status for (isect = 0; isect < fgkNsect; isect++) { SetSMstatus(isect,1); } } +//_____________________________________________________________________________ +void AliTRDgeometry::CreatePadPlaneArray() +{ + // + // Creates the array of AliTRDpadPlane objects + // + + if (fPadPlaneArray) { + fPadPlaneArray->Delete(); + delete fPadPlaneArray; + } + + fPadPlaneArray = new TObjArray(fgkNplan * fgkNcham); + for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { + for (Int_t icham = 0; icham < fgkNcham; icham++) { + Int_t ipp = GetDetectorSec(iplan,icham); + fPadPlaneArray->AddAt(CreatePadPlane(iplan,icham),ipp); + } + } + +} + +//_____________________________________________________________________________ +AliTRDpadPlane *AliTRDgeometry::CreatePadPlane(Int_t iplan, Int_t icham) +{ + // + // Creates an AliTRDpadPlane object + // + + AliTRDpadPlane *padPlane = new AliTRDpadPlane(); + + padPlane->SetPlane(iplan); + padPlane->SetChamber(icham); + + padPlane->SetRowSpacing(0.0); + padPlane->SetColSpacing(0.0); + + padPlane->SetLengthRim(1.0); + padPlane->SetWidthRim(0.5); + + padPlane->SetNcols(144); + + // + // The pad plane parameter + // + switch (iplan) { + case 0: + if (icham == 2) { + // L0C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(92.2); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.515); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.635); + padPlane->SetTiltingAngle(-2.0); + } + else { + // L0C1 type + padPlane->SetNrows(16); + padPlane->SetLength(122.0); + padPlane->SetWidth(92.2); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.515); + padPlane->SetLengthIPad(7.5); + padPlane->SetWidthIPad(0.635); + padPlane->SetTiltingAngle(-2.0); + } + break; + case 1: + if (icham == 2) { + // L1C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(96.6); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.585); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.665); + padPlane->SetTiltingAngle(2.0); + } + else { + // L1C1 type + padPlane->SetNrows(16); + padPlane->SetLength(122.0); + padPlane->SetWidth(96.6); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.585); + padPlane->SetLengthIPad(7.5); + padPlane->SetWidthIPad(0.665); + padPlane->SetTiltingAngle(2.0); + } + break; + case 2: + if (icham == 2) { + // L2C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(101.1); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.705); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.695); + padPlane->SetTiltingAngle(-2.0); + } + else { + // L2C1 type + padPlane->SetNrows(16); + padPlane->SetLength(129.0); + padPlane->SetWidth(101.1); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.705); + padPlane->SetLengthIPad(8.0); + padPlane->SetWidthIPad(0.695); + padPlane->SetTiltingAngle(-2.0); + } + break; + case 3: + if (icham == 2) { + // L3C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(105.5); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.775); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.725); + padPlane->SetTiltingAngle(2.0); + } + else { + // L3C1 type + padPlane->SetNrows(16); + padPlane->SetLength(136.0); + padPlane->SetWidth(105.5); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.775); + padPlane->SetLengthIPad(8.5); + padPlane->SetWidthIPad(0.725); + padPlane->SetTiltingAngle(2.0); + } + break; + case 4: + if (icham == 2) { + // L4C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(109.9); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.845); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.755); + padPlane->SetTiltingAngle(-2.0); + } + else { + // L4C1 type + padPlane->SetNrows(16); + padPlane->SetLength(143.0); + padPlane->SetWidth(109.9); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.845); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.755); + padPlane->SetTiltingAngle(-2.0); + } + break; + case 5: + if (icham == 2) { + // L5C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(114.4); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.965); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.785); + padPlane->SetTiltingAngle(2.0); + } + else { + // L5C1 type + padPlane->SetNrows(16); + padPlane->SetLength(145.0); + padPlane->SetWidth(114.4); + padPlane->SetLengthOPad(8.5); + padPlane->SetWidthOPad(0.965); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.785); + padPlane->SetTiltingAngle(2.0); + } + break; + }; + + // + // The positions of the borders of the pads + // + // Row direction + // + Double_t row = fClength[iplan][icham] / 2.0 + - fgkRpadW + - padPlane->GetLengthRim(); + for (Int_t ir = 0; ir < padPlane->GetNrows(); ir++) { + padPlane->SetPadRow(ir,row); + row -= padPlane->GetRowSpacing(); + if (ir == 0) { + row -= padPlane->GetLengthOPad(); + } + else { + row -= padPlane->GetLengthIPad(); + } + } + // + // Column direction + // + Double_t col = fCwidth[iplan] / 2.0 + + fgkCroW + - padPlane->GetWidthRim(); + for (Int_t ic = 0; ic < padPlane->GetNcols(); ic++) { + padPlane->SetPadCol(ic,col); + col -= padPlane->GetColSpacing(); + if (ic == 0) { + col -= padPlane->GetWidthOPad(); + } + else { + col -= padPlane->GetWidthIPad(); + } + } + // Calculate the offset to translate from the local ROC system into + // the local supermodule system, which is used for clusters + Double_t rowTmp = fClength[iplan][0] + + fClength[iplan][1] + + fClength[iplan][2] / 2.0; + for (Int_t ic = 0; ic < icham; ic++) { + rowTmp -= fClength[iplan][ic]; + } + padPlane->SetPadRowSMOffset(rowTmp - fClength[iplan][icham]/2.0); + + return padPlane; + +} + //_____________________________________________________________________________ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) { @@ -937,12 +1184,6 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) gMC->Matrix(matrix[1], 80.0, 0.0, 90.0, 90.0, 10.0, 180.0); gMC->Matrix(matrix[2], 0.0, 0.0, 90.0, 90.0, 90.0, 0.0); gMC->Matrix(matrix[3], 180.0, 0.0, 90.0, 90.0, 90.0, 180.0); - - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { - AliError("Could not get common parameters\n"); - return; - } // // The cooling arterias @@ -1090,7 +1331,7 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) for (iplan = 0; iplan < kNplan; iplan++) { Int_t iDet = GetDetectorSec(iplan,icham); Int_t iCopy = GetDetector(iplan,icham,0) * 100; - Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0); + Int_t nMCMrow = GetRowMax(iplan,icham,0); Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW) / ((Float_t) nMCMrow); sprintf(cTagV,"UU%02d",iDet); @@ -1123,7 +1364,7 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) for (iplan = 0; iplan < kNplan; iplan++) { Int_t iDet = GetDetectorSec(iplan,icham); Int_t iCopy = GetDetector(iplan,icham,0) * 100; - Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0); + Int_t nMCMrow = GetRowMax(iplan,icham,0); Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW) / ((Float_t) nMCMrow); sprintf(cTagV,"UU%02d",iDet); @@ -1200,7 +1441,7 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) for (iplan = 0; iplan < kNplan; iplan++) { Int_t iDet = GetDetectorSec(iplan,icham); Int_t iCopy = GetDetector(iplan,icham,0) * 1000; - Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0); + Int_t nMCMrow = GetRowMax(iplan,icham,0); Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW) / ((Float_t) nMCMrow); Int_t nMCMcol = 8; @@ -1397,23 +1638,82 @@ Int_t AliTRDgeometry::GetSector(Int_t d) const } -//CL //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetPadRowFromMCM(Int_t irob, Int_t imcm) const +AliTRDpadPlane *AliTRDgeometry::GetPadPlane(Int_t p, Int_t c) { + // + // Returns the pad plane for a given plane

and chamber number + // - // return on which row this mcm sits + if (!fPadPlaneArray) { + CreatePadPlaneArray(); + } + + Int_t ipp = GetDetectorSec(p,c); + return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp)); + +} + +//_____________________________________________________________________________ +Int_t AliTRDgeometry::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) +{ + // + // Returns the number of rows on the pad plane + // + + return GetPadPlane(p,c)->GetNrows(); + +} + +//_____________________________________________________________________________ +Int_t AliTRDgeometry::GetColMax(Int_t p) +{ + // + // Returns the number of rows on the pad plane + // + + return GetPadPlane(p,0)->GetNcols(); + +} + +//_____________________________________________________________________________ +Double_t AliTRDgeometry::GetRow0(Int_t p, Int_t c, Int_t /*s*/) +{ + // + // Returns the position of the border of the first pad in a row + // + + return GetPadPlane(p,c)->GetRow0(); + +} + +//_____________________________________________________________________________ +Double_t AliTRDgeometry::GetCol0(Int_t p) +{ + // + // Returns the position of the border of the first pad in a column + // + + return GetPadPlane(p,0)->GetCol0(); + +} + +//_____________________________________________________________________________ +Int_t AliTRDgeometry::GetPadRowFromMCM(Int_t irob, Int_t imcm) const +{ + // + // Return on which row this mcm sits + // return fgkMCMrow*(irob/2) + imcm/fgkMCMrow; -; } //_____________________________________________________________________________ Int_t AliTRDgeometry::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const { // - // return which pad is connected to this adc channel. return -1 if it + // Return which pad is connected to this adc channel. return -1 if it // is one of the not directly connected adc channels (0, 1 20) // @@ -1426,8 +1726,9 @@ Int_t AliTRDgeometry::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const //_____________________________________________________________________________ Int_t AliTRDgeometry::GetMCMfromPad(Int_t irow, Int_t icol) const { - - // return on which mcm this pad is + // + // Return on which mcm this pad is + // if ( irow < 0 || icol < 0 || irow > fgkRowmaxC1 || icol > fgkColmax ) return -1; @@ -1438,8 +1739,9 @@ Int_t AliTRDgeometry::GetMCMfromPad(Int_t irow, Int_t icol) const //_____________________________________________________________________________ Int_t AliTRDgeometry::GetROBfromPad(Int_t irow, Int_t icol) const { - - // return on which rob this pad is + // + // Return on which rob this pad is + // return (irow/fgkMCMrow)*2 + GetColSide(icol); @@ -1448,8 +1750,9 @@ Int_t AliTRDgeometry::GetROBfromPad(Int_t irow, Int_t icol) const //_____________________________________________________________________________ Int_t AliTRDgeometry::GetRobSide(Int_t irob) const { - - // return on which side this rob sits (A side = 0, B side = 1) + // + // Return on which side this rob sits (A side = 0, B side = 1) + // if ( irob < 0 || irob >= fgkROBmaxC1 ) return -1; @@ -1459,51 +1762,14 @@ Int_t AliTRDgeometry::GetRobSide(Int_t irob) const //_____________________________________________________________________________ Int_t AliTRDgeometry::GetColSide(Int_t icol) const -{ - - // return on which side this column sits (A side = 0, B side = 1) - - if ( icol < 0 || icol >= fgkColmax ) return -1; - - return icol/(fgkColmax/2); - -} - -//_____________________________________________________________________________ -AliTRDgeometry *AliTRDgeometry::GetGeometry(AliRunLoader *runLoader) { // - // Load the geometry from the galice file + // Return on which side this column sits (A side = 0, B side = 1) // - if (!runLoader) { - runLoader = AliRunLoader::GetRunLoader(); - } - if (!runLoader) { - AliErrorGeneral("AliTRDgeometry::GetGeometry","No run loader"); - return NULL; - } - - TDirectory *saveDir = gDirectory; - runLoader->CdGAFile(); - - // Try from the galice.root file - static AliTRDgeometry *geom = (AliTRDgeometry *) gDirectory->Get("TRDgeometry"); - - if (!geom) { - // If it is not in the file, try to get it from the run loader - if (runLoader->GetAliRun()) { - AliTRD *trd = (AliTRD *) runLoader->GetAliRun()->GetDetector("TRD"); - geom = trd->GetGeometry(); - } - } - if (!geom) { - AliErrorGeneral("AliTRDgeometry::GetGeometry","Geometry not found"); - return NULL; - } + if ( icol < 0 || icol >= fgkColmax ) return -1; - saveDir->cd(); - return geom; + return icol/(fgkColmax/2); } diff --git a/TRD/AliTRDgeometry.h b/TRD/AliTRDgeometry.h index 2b98b1862f7..2c6e6260c61 100644 --- a/TRD/AliTRDgeometry.h +++ b/TRD/AliTRDgeometry.h @@ -15,9 +15,12 @@ #include "TObjArray.h" -class AliRunLoader; class TGeoHMatrix; +class AliRunLoader; + +class AliTRDpadPlane; + class AliTRDgeometry : public AliGeometry { public: @@ -49,14 +52,20 @@ class AliTRDgeometry : public AliGeometry { void SetSMstatus(Int_t sm, Char_t status) { fSMstatus[sm] = status; } - static AliTRDgeometry* GetGeometry(AliRunLoader *runLoader = NULL); - static Int_t GetDetectorSec(Int_t p, Int_t c); static Int_t GetDetector(Int_t p, Int_t c, Int_t s); virtual Int_t GetPlane(Int_t d) const; virtual Int_t GetChamber(Int_t d) const; virtual Int_t GetSector(Int_t d) const; + void CreatePadPlaneArray(); + AliTRDpadPlane *CreatePadPlane(Int_t p, Int_t c); + AliTRDpadPlane *GetPadPlane(Int_t p, Int_t c); + Int_t GetRowMax(Int_t p, Int_t c, Int_t /*s*/); + Int_t GetColMax(Int_t p); + Double_t GetRow0(Int_t p, Int_t c, Int_t /*s*/); + Double_t GetCol0(Int_t p); + // Translation from MCM to Pad and vice versa virtual Int_t GetPadRowFromMCM(Int_t irob, Int_t imcm) const; virtual Int_t GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const; @@ -217,7 +226,9 @@ class AliTRDgeometry : public AliGeometry { TObjArray *fMatrixCorrectionArray; //! Transformation Cluster to Tracking systerm TObjArray *fMatrixGeo; //! Geo matrices - ClassDef(AliTRDgeometry,13) // TRD geometry class + TObjArray *fPadPlaneArray; //! Array of pad plane objects + + ClassDef(AliTRDgeometry,14) // TRD geometry class }; diff --git a/TRD/AliTRDmcm.cxx b/TRD/AliTRDmcm.cxx index 481c81e95c9..e51c0ca5e63 100644 --- a/TRD/AliTRDmcm.cxx +++ b/TRD/AliTRDmcm.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.4 2006/08/28 17:12:18 cblume +Remove the last print statements + Revision 1.3 2006/08/11 17:58:05 cblume Next round of effc++ changes @@ -60,7 +63,6 @@ ClassImp(AliTRDmcm) //_____________________________________________________________________________ AliTRDmcm::AliTRDmcm() :TObject() - ,fTrigParam(0) ,fNtrk(0) ,fRobId(0) ,fChaId(0) @@ -101,19 +103,18 @@ AliTRDmcm::AliTRDmcm() } //_____________________________________________________________________________ -AliTRDmcm::AliTRDmcm(AliTRDtrigParam *trigp, const Int_t id) +AliTRDmcm::AliTRDmcm(const Int_t id) :TObject() - ,fTrigParam(trigp) ,fNtrk(0) ,fRobId(0) ,fChaId(0) ,fRow(0) ,fColFirst(0) ,fColLast(0) - ,fTime1(trigp->GetTime1()) - ,fTime2(trigp->GetTime2()) - ,fClusThr(trigp->GetClusThr()) - ,fPadThr(trigp->GetPadThr()) + ,fTime1(0) + ,fTime2(0) + ,fClusThr(0) + ,fPadThr(0) ,fNtrkSeeds(0) ,fR1(0) ,fR2(0) @@ -140,15 +141,19 @@ AliTRDmcm::AliTRDmcm(AliTRDtrigParam *trigp, const Int_t id) fIsClus[i][j] = kFALSE; } } + + fTime1 = AliTRDtrigParam::Instance()->GetTime1(); + fTime2 = AliTRDtrigParam::Instance()->GetTime2(); + fClusThr = AliTRDtrigParam::Instance()->GetClusThr(); + fPadThr = AliTRDtrigParam::Instance()->GetPadThr(); - fTrigParam->GetFilterParam(fR1,fR2,fC1,fC2,fPedestal); + AliTRDtrigParam::Instance()->GetFilterParam(fR1,fR2,fC1,fC2,fPedestal); } //_____________________________________________________________________________ AliTRDmcm::AliTRDmcm(const AliTRDmcm &m) :TObject(m) - ,fTrigParam(NULL) ,fNtrk(m.fNtrk) ,fRobId(m.fRobId) ,fChaId(m.fChaId) @@ -220,7 +225,6 @@ void AliTRDmcm::Copy(TObject &m) const Int_t i = 0; Int_t j = 0; - ((AliTRDmcm &) m).fTrigParam = NULL; ((AliTRDmcm &) m).fNtrk = fNtrk; ((AliTRDmcm &) m).fRobId = fRobId; ((AliTRDmcm &) m).fChaId = fChaId; @@ -301,7 +305,6 @@ Bool_t AliTRDmcm::Run() Int_t iTime = 0; Int_t iCol = 0; - Int_t iPad = 0; Int_t iPlus = 0; Int_t i = 0; Int_t j = 0; @@ -395,8 +398,8 @@ Int_t AliTRDmcm::CreateSeeds() } } - Int_t sum10 = fTrigParam->GetSum10(); - Int_t sum12 = fTrigParam->GetSum12(); + Int_t sum10 = AliTRDtrigParam::Instance()->GetSum10(); + Int_t sum12 = AliTRDtrigParam::Instance()->GetSum12(); // Build the 2padSum Int_t nsum2seed = 0; @@ -440,15 +443,11 @@ Int_t AliTRDmcm::CreateSeeds() if ((fHit2padSum[0][i]+1) == fHit2padSum[0][i+1]) { nSeeds--; if (fHit2padSum[1][i] >= fHit2padSum[1][i+1]) { - if (fTrigParam->GetDebugLevel() > 1) { - AliWarning(Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i+1])); - } + AliDebug(2,Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i+1])); fSeedCol[i+1] = -1; } else { - if (fTrigParam->GetDebugLevel() > 1) { - AliWarning(Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i])); - } + AliDebug(2,Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i])); fSeedCol[i] = -1; } } diff --git a/TRD/AliTRDmcm.h b/TRD/AliTRDmcm.h index 0b47a330319..4c0aff422c9 100644 --- a/TRD/AliTRDmcm.h +++ b/TRD/AliTRDmcm.h @@ -13,8 +13,6 @@ #include -class AliTRDtrigParam; - class AliTRDmcm : public TObject { public: @@ -23,7 +21,7 @@ class AliTRDmcm : public TObject { AliTRDmcm(); AliTRDmcm(const AliTRDmcm &m); - AliTRDmcm(AliTRDtrigParam *trigp, Int_t id); + AliTRDmcm(Int_t id); virtual ~AliTRDmcm(); AliTRDmcm &operator=(const AliTRDmcm &m); @@ -67,8 +65,6 @@ class AliTRDmcm : public TObject { protected: - AliTRDtrigParam *fTrigParam; //! Pointer to the trigger parameters class - Int_t fNtrk; // Number of found tracklets Int_t fTrkIndex[kMaxTrackletsPerMCM]; // Index of found tracklets Int_t fRobId; // ROB id @@ -94,7 +90,7 @@ class AliTRDmcm : public TObject { Int_t fId; // Dummy id - ClassDef(AliTRDmcm,2) // TRD MCM class + ClassDef(AliTRDmcm,3) // TRD MCM class }; diff --git a/TRD/AliTRDmcmTracklet.cxx b/TRD/AliTRDmcmTracklet.cxx index 3b269e2f4c1..e895ebcfe0c 100644 --- a/TRD/AliTRDmcmTracklet.cxx +++ b/TRD/AliTRDmcmTracklet.cxx @@ -38,6 +38,7 @@ ClassImp(AliTRDmcmTracklet) //_____________________________________________________________________________ AliTRDmcmTracklet::AliTRDmcmTracklet() :TObject() + ,fGeo(0) ,fDetector(-1) ,fRow(-1) ,fTrackLabel(-1) @@ -67,11 +68,14 @@ AliTRDmcmTracklet::AliTRDmcmTracklet() fCol[time] = 0; } + fGeo = new AliTRDgeometry(); + } //_____________________________________________________________________________ AliTRDmcmTracklet::AliTRDmcmTracklet(Int_t det, Int_t row, Int_t n) :TObject() + ,fGeo(0) ,fDetector(det) ,fRow(row) ,fTrackLabel(-1) @@ -104,11 +108,14 @@ AliTRDmcmTracklet::AliTRDmcmTracklet(Int_t det, Int_t row, Int_t n) fGPos = new TGraph(0); fGAmp = new TGraph(0); + fGeo = new AliTRDgeometry(); + } //_____________________________________________________________________________ AliTRDmcmTracklet::AliTRDmcmTracklet(const AliTRDmcmTracklet &t) :TObject(t) + ,fGeo(0) ,fDetector(t.fDetector) ,fRow(t.fRow) ,fTrackLabel(t.fTrackLabel) @@ -138,6 +145,11 @@ AliTRDmcmTracklet::AliTRDmcmTracklet(const AliTRDmcmTracklet &t) ((AliTRDmcmTracklet &) t).fCol[time] = 0; } + if (fGeo) { + delete fGeo; + } + fGeo = new AliTRDgeometry(); + } //_____________________________________________________________________________ @@ -150,6 +162,10 @@ AliTRDmcmTracklet::~AliTRDmcmTracklet() if (fGPos != 0) delete fGPos; if (fGAmp != 0) delete fGAmp; + if (fGeo) { + delete fGeo; + } + } //_____________________________________________________________________________ @@ -270,8 +286,7 @@ void AliTRDmcmTracklet::MakeTrackletGraph(AliTRDgeometry *geo, Float_t field) return; } - AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { + if (!AliTRDCommonParam::Instance()) { AliError("No common parameters."); return; } @@ -287,9 +302,9 @@ void AliTRDmcmTracklet::MakeTrackletGraph(AliTRDgeometry *geo, Float_t field) iplan = geo->GetPlane(fDetector); icham = geo->GetChamber(fDetector); - AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham); + AliTRDpadPlane *padPlane = fGeo->GetPadPlane(iplan,icham); - Float_t samplFreq = commonParam->GetSamplingFrequency(); + Float_t samplFreq = AliTRDCommonParam::Instance()->GetSamplingFrequency(); Int_t time, col; Float_t amp[3]; diff --git a/TRD/AliTRDmcmTracklet.h b/TRD/AliTRDmcmTracklet.h index 416cd303717..7292ab41061 100644 --- a/TRD/AliTRDmcmTracklet.h +++ b/TRD/AliTRDmcmTracklet.h @@ -59,6 +59,8 @@ class AliTRDmcmTracklet : public TObject { Int_t GetClusterCol(Int_t icl) const { return fCol[icl]; }; protected: + // Geometry + AliTRDgeometry *fGeo; //! The TRD geometry Int_t fDetector; // TRD detector number (0 ... 539) Int_t fRow; // Row number in the detector @@ -81,7 +83,7 @@ class AliTRDmcmTracklet : public TObject { Float_t fPt; // Transverse momentum Float_t fdQdl; // Charge per unit length - ClassDef(AliTRDmcmTracklet,2) // Track segment for the TRD (Tracklet) + ClassDef(AliTRDmcmTracklet,3) // Track segment for the TRD (Tracklet) }; diff --git a/TRD/AliTRDmodule.cxx b/TRD/AliTRDmodule.cxx index 477dadecbee..b2ed6c0b896 100644 --- a/TRD/AliTRDmodule.cxx +++ b/TRD/AliTRDmodule.cxx @@ -23,6 +23,7 @@ #include +#include "AliRun.h" #include "AliLog.h" #include "AliTRDgeometry.h" @@ -36,11 +37,11 @@ ClassImp(AliTRDmodule) //_____________________________________________________________________________ AliTRDmodule::AliTRDmodule() - :TObject() + :TObject() ,fXprojPlane(0) ,fField(0) - ,fTracklets(NULL) - ,fTracks(NULL) + ,fTracklets(new TObjArray(400)) + ,fTracks(new TObjArray(400)) ,fDeltaY(0) ,fDeltaS(0) ,fLTUtrk(0) @@ -50,23 +51,15 @@ AliTRDmodule::AliTRDmodule() // AliTRDmodule default constructor // -} + fXprojPlane = AliTRDtrigParam::Instance()->GetXprojPlane(); + fDeltaY = AliTRDtrigParam::Instance()->GetDeltaY(); + fDeltaS = AliTRDtrigParam::Instance()->GetDeltaS(); -//_____________________________________________________________________________ -AliTRDmodule::AliTRDmodule(AliTRDtrigParam *trigp) - :TObject() - ,fXprojPlane(trigp->GetXprojPlane()) - ,fField(trigp->GetField()) - ,fTracklets(new TObjArray(400)) - ,fTracks(new TObjArray(400)) - ,fDeltaY(trigp->GetDeltaY()) - ,fDeltaS(trigp->GetDeltaS()) - ,fLTUtrk(0) - ,fGTUtrk(0) -{ - // - // AliTRDmodule constructor - // + // The magnetic field strength + Double_t x[3] = { 0.0, 0.0, 0.0 }; + Double_t b[3]; + gAlice->Field(x,b); // b[] is in kilo Gauss + fField = b[2] * 0.1; // Tesla for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { for (Int_t i = 0; i < kNsubZchan; i++) { diff --git a/TRD/AliTRDmodule.h b/TRD/AliTRDmodule.h index 17ae3dacfc6..7c27b0e6f6a 100644 --- a/TRD/AliTRDmodule.h +++ b/TRD/AliTRDmodule.h @@ -15,7 +15,6 @@ class AliTRDgtuTrack; class AliTRDltuTracklet; -class AliTRDtrigParam; class AliTRDmodule : public TObject { @@ -25,7 +24,6 @@ class AliTRDmodule : public TObject { AliTRDmodule(); AliTRDmodule(const AliTRDmodule &m); - AliTRDmodule(AliTRDtrigParam *trigp); virtual ~AliTRDmodule(); AliTRDmodule &operator=(const AliTRDmodule &m); diff --git a/TRD/AliTRDpadPlane.cxx b/TRD/AliTRDpadPlane.cxx index 23e40f01ecf..11606597cde 100644 --- a/TRD/AliTRDpadPlane.cxx +++ b/TRD/AliTRDpadPlane.cxx @@ -38,7 +38,6 @@ ClassImp(AliTRDpadPlane) //_____________________________________________________________________________ AliTRDpadPlane::AliTRDpadPlane() :TObject() - ,fGeo(0) ,fPla(0) ,fCha(0) ,fLength(0) @@ -65,254 +64,9 @@ AliTRDpadPlane::AliTRDpadPlane() } -//_____________________________________________________________________________ -AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c) - :TObject() - ,fGeo(0) - ,fPla(0) - ,fCha(0) - ,fLength(0) - ,fWidth(0) - ,fLengthRim(0) - ,fWidthRim(0) - ,fLengthOPad(0) - ,fWidthOPad(0) - ,fLengthIPad(0) - ,fWidthIPad(0) - ,fRowSpacing(0) - ,fColSpacing(0) - ,fNrows(0) - ,fNcols(0) - ,fTiltingAngle(0) - ,fTiltingTan(0) - ,fPadRow(0) - ,fPadCol(0) - ,fPadRowSMOffset(0) -{ - // - // Constructor that initializes a given pad plane type - // - - fGeo = new AliTRDgeometry(); - - fPla = p; - fCha = c; - - fRowSpacing = 0.0; - fColSpacing = 0.0; - - fLengthRim = 1.0; - fWidthRim = 0.5; - - fNcols = 144; - - // - // The pad plane parameter - // - switch (p) { - case 0: - if (c == 2) { - // L0C0 type - fNrows = 12; - fLength = 108.0; - fWidth = 92.2; - fLengthOPad = 8.0; - fWidthOPad = 0.515; - fLengthIPad = 9.0; - fWidthIPad = 0.635; - fTiltingAngle = -2.0; - } - else { - // L0C1 type - fNrows = 16; - fLength = 122.0; - fWidth = 92.2; - fLengthOPad = 7.5; - fWidthOPad = 0.515; - fLengthIPad = 7.5; - fWidthIPad = 0.635; - fTiltingAngle = -2.0; - } - break; - case 1: - if (c == 2) { - // L1C0 type - fNrows = 12; - fLength = 108.0; - fWidth = 96.6; - fLengthOPad = 8.0; - fWidthOPad = 0.585; - fLengthIPad = 9.0; - fWidthIPad = 0.665; - fTiltingAngle = 2.0; - } - else { - // L1C1 type - fNrows = 16; - fLength = 122.0; - fWidth = 96.6; - fLengthOPad = 7.5; - fWidthOPad = 0.585; - fLengthIPad = 7.5; - fWidthIPad = 0.665; - fTiltingAngle = 2.0; - } - break; - case 2: - if (c == 2) { - // L2C0 type - fNrows = 12; - fLength = 108.0; - fWidth = 101.1; - fLengthOPad = 8.0; - fWidthOPad = 0.705; - fLengthIPad = 9.0; - fWidthIPad = 0.695; - fTiltingAngle = -2.0; - } - else { - // L2C1 type - fNrows = 16; - fLength = 129.0; - fWidth = 101.1; - fLengthOPad = 7.5; - fWidthOPad = 0.705; - fLengthIPad = 8.0; - fWidthIPad = 0.695; - fTiltingAngle = -2.0; - } - break; - case 3: - if (c == 2) { - // L3C0 type - fNrows = 12; - fLength = 108.0; - fWidth = 105.5; - fLengthOPad = 8.0; - fWidthOPad = 0.775; - fLengthIPad = 9.0; - fWidthIPad = 0.725; - fTiltingAngle = 2.0; - } - else { - // L3C1 type - fNrows = 16; - fLength = 136.0; - fWidth = 105.5; - fLengthOPad = 7.5; - fWidthOPad = 0.775; - fLengthIPad = 8.5; - fWidthIPad = 0.725; - fTiltingAngle = 2.0; - } - break; - case 4: - if (c == 2) { - // L4C0 type - fNrows = 12; - fLength = 108.0; - fWidth = 109.9; - fLengthOPad = 8.0; - fWidthOPad = 0.845; - fLengthIPad = 9.0; - fWidthIPad = 0.755; - fTiltingAngle = -2.0; - } - else { - // L4C1 type - fNrows = 16; - fLength = 143.0; - fWidth = 109.9; - fLengthOPad = 7.5; - fWidthOPad = 0.845; - fLengthIPad = 9.0; - fWidthIPad = 0.755; - fTiltingAngle = -2.0; - } - break; - case 5: - if (c == 2) { - // L5C0 type - fNrows = 12; - fLength = 108.0; - fWidth = 114.4; - fLengthOPad = 8.0; - fWidthOPad = 0.965; - fLengthIPad = 9.0; - fWidthIPad = 0.785; - fTiltingAngle = 2.0; - } - else { - // L5C1 type - fNrows = 16; - fLength = 145.0; - fWidth = 114.4; - fLengthOPad = 8.5; - fWidthOPad = 0.965; - fLengthIPad = 9.0; - fWidthIPad = 0.785; - fTiltingAngle = 2.0; - } - break; - }; - - // - // Store tilting angle as tangens - // - fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle); - - // - // The positions of the borders of the pads - // - // Row direction - // - fPadRow = new Double_t[fNrows]; - Double_t row = fGeo->GetChamberLength(p,c) / 2.0 - - fGeo->RpadW() - - fLengthRim; - for (Int_t ir = 0; ir < fNrows; ir++) { - fPadRow[ir] = row; - row -= fRowSpacing; - if (ir == 0) { - row -= fLengthOPad; - } - else { - row -= fLengthIPad; - } - } - // - // Column direction - // - fPadCol = new Double_t[fNcols]; - Double_t col = fGeo->GetChamberWidth(p) / 2.0 - + fGeo->CroWid() - - fWidthRim; - for (Int_t ic = 0; ic < fNcols; ic++) { - fPadCol[ic] = col; - col -= fColSpacing; - if (ic == 0) { - col -= fWidthOPad; - } - else { - col -= fWidthIPad; - } - } - // Calculate the offset to translate from the local ROC system into - // the local supermodule system, which is used for clusters - Double_t rowTmp = fGeo->GetChamberLength(p,0) - + fGeo->GetChamberLength(p,1) - + fGeo->GetChamberLength(p,2) / 2.0; - for (Int_t ic = 0; ic < c; ic++) { - rowTmp -= fGeo->GetChamberLength(p,ic); - } - fPadRowSMOffset = rowTmp - fGeo->GetChamberLength(p,c)/2.0; - -} - //_____________________________________________________________________________ AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p) :TObject(p) - ,fGeo(0) ,fPla(p.fPla) ,fCha(p.fCha) ,fLength(p.fLength) @@ -364,11 +118,6 @@ AliTRDpadPlane::~AliTRDpadPlane() // AliTRDpadPlane destructor // - if (fGeo) { - delete fGeo; - fGeo = 0; - } - if (fPadRow) { delete [] fPadRow; fPadRow = 0; @@ -405,8 +154,6 @@ void AliTRDpadPlane::Copy(TObject &p) const Int_t iBin = 0; - ((AliTRDpadPlane &) p).fGeo = 0; - ((AliTRDpadPlane &) p).fPla = fPla; ((AliTRDpadPlane &) p).fCha = fCha; diff --git a/TRD/AliTRDpadPlane.h b/TRD/AliTRDpadPlane.h index 000166b3482..b1e2aaf4c20 100644 --- a/TRD/AliTRDpadPlane.h +++ b/TRD/AliTRDpadPlane.h @@ -3,7 +3,7 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -/* $Id: AliTRDpadPlane.h,v */ +/* $Id$ */ ////////////////////////////////////////////////// // // @@ -18,20 +18,41 @@ #include -class AliTRDgeometry; - //_____________________________________________________________________________ class AliTRDpadPlane : public TObject { public: AliTRDpadPlane(); - AliTRDpadPlane(Int_t p, Int_t c); AliTRDpadPlane(const AliTRDpadPlane &p); virtual ~AliTRDpadPlane(); AliTRDpadPlane &operator=(const AliTRDpadPlane &p); virtual void Copy(TObject &p) const; + void SetPlane(Int_t p) { fPla = p; }; + void SetChamber(Int_t c) { fCha = c; }; + void SetRowSpacing(Double_t s) { fRowSpacing = s; }; + void SetColSpacing(Double_t s) { fColSpacing = s; }; + void SetLengthRim(Double_t l) { fLengthRim = l; }; + void SetWidthRim(Double_t w) { fWidthRim = w; }; + void SetNcols(Int_t n) { fNcols = n; + if (fPadCol) delete[] fPadCol; + fPadCol = new Double_t[fNcols]; }; + void SetNrows(Int_t n) { fNrows = n; + if (fPadRow) delete[] fPadRow; + fPadRow = new Double_t[fNrows]; }; + void SetPadCol(Int_t ic, Double_t c) { if (ic < fNcols) fPadCol[ic] = c; }; + void SetPadRow(Int_t ir, Double_t r) { if (ir < fNrows) fPadRow[ir] = r; }; + void SetLength(Double_t l) { fLength = l; }; + void SetWidth(Double_t w) { fWidth = w; }; + void SetLengthOPad(Double_t l) { fLengthOPad = l; }; + void SetWidthOPad(Double_t w) { fWidthOPad = w; }; + void SetLengthIPad(Double_t l) { fLengthIPad = l; }; + void SetWidthIPad(Double_t w) { fWidthIPad = w; }; + void SetTiltingAngle(Double_t t) { fTiltingAngle = t; + fTiltingTan = TMath::Tan(TMath::Pi()/180.0 * fTiltingAngle); }; + void SetPadRowSMOffset(Double_t o) { fPadRowSMOffset = o; }; + Int_t GetPadRowNumber(Double_t z) const; Int_t GetPadRowNumberROC(Double_t z) const; Int_t GetPadColNumber(Double_t rphi) const; @@ -81,11 +102,20 @@ class AliTRDpadPlane : public TObject { return fWidthOPad; else return fWidthIPad; }; + Double_t GetLengthRim() const { return fLengthRim; }; + Double_t GetWidthRim() const { return fWidthRim; }; - protected: + Double_t GetRowSpacing() const { return fRowSpacing; }; + Double_t GetColSpacing() const { return fColSpacing; }; - AliTRDgeometry *fGeo; //! TRD geometry + Double_t GetLengthOPad() const { return fLengthOPad; }; + Double_t GetLengthIPad() const { return fLengthIPad; }; + + Double_t GetWidthOPad() const { return fWidthOPad; }; + Double_t GetWidthIPad() const { return fWidthIPad; }; + + protected: Int_t fPla; // Plane number Int_t fCha; // Chamber number @@ -111,12 +141,12 @@ class AliTRDpadPlane : public TObject { Double_t fTiltingAngle; // Pad tilting angle Double_t fTiltingTan; // Tangens of pad tilting angle - Double_t *fPadRow; //! Pad border positions in row direction - Double_t *fPadCol; //! Pad border positions in column direction + Double_t *fPadRow; // Pad border positions in row direction + Double_t *fPadCol; // Pad border positions in column direction Double_t fPadRowSMOffset; // To be added to translate local ROC system to local SM system - ClassDef(AliTRDpadPlane,3) // TRD ROC pad plane + ClassDef(AliTRDpadPlane,4) // TRD ROC pad plane }; diff --git a/TRD/AliTRDpidESD.cxx b/TRD/AliTRDpidESD.cxx index 52d1aa7b28e..fb255d89218 100644 --- a/TRD/AliTRDpidESD.cxx +++ b/TRD/AliTRDpidESD.cxx @@ -220,16 +220,9 @@ Bool_t AliTRDpidESD::GetTrackSegmentKine(AliESDtrack *t, Int_t plan, Float_t &mo } // Retrieve TRD geometry -> Maybe there is a better way to do this - Bool_t kSelfGeom = kFALSE; - AliTRDgeometry *TRDgeom =0x0; - if(gAlice) TRDgeom = AliTRDgeometry::GetGeometry(gAlice->GetRunLoader()); - if(!TRDgeom){ - AliWarningGeneral("AliTRDpidESD::GetTrackSegmentKine()", "Cannot load TRD geometry from gAlice! Build a new one.\n"); - TRDgeom = new AliTRDgeometry(); - kSelfGeom = kTRUE; - } + AliTRDgeometry trdGeom; const Float_t kAmHalfWidth = AliTRDgeometry::AmThick() / 2.; - const Float_t kDrWidth = AliTRDgeometry::DrThick(); + const Float_t kDrWidth = AliTRDgeometry::DrThick(); // retrive the magnetic field @@ -237,19 +230,17 @@ Bool_t AliTRDpidESD::GetTrackSegmentKine(AliESDtrack *t, Int_t plan, Float_t &mo Double_t b[3], alpha; gAlice->Field(xyz0,b); // b[] is in kilo Gauss Float_t field = b[2] * 0.1; // Tesla - // find momentum at chamber entrance and track length in chamber AliExternalTrackParam *param = (plan<3) ? new AliExternalTrackParam(*t->GetInnerParam()) : new AliExternalTrackParam(*t->GetOuterParam()); - param->PropagateTo(TRDgeom->GetTime0(plan)+kAmHalfWidth, field); + param->PropagateTo(trdGeom.GetTime0(plan)+kAmHalfWidth, field); param->GetXYZ(xyz0); alpha = param->GetAlpha(); - param->PropagateTo(TRDgeom->GetTime0(plan)-kAmHalfWidth-kDrWidth, field); + param->PropagateTo(trdGeom.GetTime0(plan)-kAmHalfWidth-kDrWidth, field); // eliminate track segments which are crossing SM boundaries along chamber if(TMath::Abs(alpha-param->GetAlpha())>.01){ delete param; - if(kSelfGeom) delete TRDgeom; return kFALSE; } param->GetXYZ(xyz1); @@ -261,7 +252,6 @@ Bool_t AliTRDpidESD::GetTrackSegmentKine(AliESDtrack *t, Int_t plan, Float_t &mo param->GetPxPyPz(xyz1); mom = sqrt(xyz1[0]*xyz1[0] + xyz1[1]*xyz1[1] + xyz1[2]*xyz1[2]); delete param; - if(kSelfGeom) delete TRDgeom; return kTRUE; } diff --git a/TRD/AliTRDrawData.cxx b/TRD/AliTRDrawData.cxx index 70367642040..54aed2d4b5e 100644 --- a/TRD/AliTRDrawData.cxx +++ b/TRD/AliTRDrawData.cxx @@ -35,7 +35,6 @@ #include "AliTRDdataArrayI.h" #include "AliTRDRawStream.h" -#include "AliTRDCommonParam.h" #include "AliTRDcalibDB.h" ClassImp(AliTRDrawData) @@ -44,8 +43,6 @@ ClassImp(AliTRDrawData) AliTRDrawData::AliTRDrawData() :TObject() ,fRawVersion(2) // Default Raw Data version set here - ,fCommonParam(0) - ,fCalibration(0) ,fGeo(0) ,fNumberOfDDLs(0) { @@ -59,8 +56,6 @@ AliTRDrawData::AliTRDrawData() AliTRDrawData::AliTRDrawData(const AliTRDrawData &r) :TObject(r) ,fRawVersion(2) // Default Raw Data version set here - ,fCommonParam(0) - ,fCalibration(0) ,fGeo(0) ,fNumberOfDDLs(0) { @@ -123,16 +118,7 @@ Bool_t AliTRDrawData::Digits2Raw(TTree *digitsTree, TTree *tracks ) fGeo = new AliTRDgeometry(); - fCommonParam = AliTRDCommonParam::Instance(); - if (!fCommonParam) { - AliError("Could not get common params"); - delete fGeo; - delete digitsManager; - return kFALSE; - } - - fCalibration = AliTRDcalibDB::Instance(); - if (!fCalibration) { + if (!AliTRDcalibDB::Instance()) { AliError("Could not get calibration object"); delete fGeo; delete digitsManager; @@ -196,7 +182,7 @@ Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager) Int_t iDet = fGeo->GetDetector(plan, cham, sect); // If chamber status is ok, we assume that the optical link is also OK. // This is shown in the GTU link mask. - if ( fCalibration->GetChamberStatus(iDet) ) + if ( AliTRDcalibDB::Instance()->GetChamberStatus(iDet) ) GtuCdh = GtuCdh | (3 << (2*plan)); } of->write((char *) (& GtuCdh), sizeof(GtuCdh)); @@ -271,9 +257,9 @@ Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayI *digits, Int_t side Int_t plan = fGeo->GetPlane( det ); // Plane Int_t cham = fGeo->GetChamber( det ); // Chamber Int_t sect = fGeo->GetSector( det ); // Sector (=iDDL) - Int_t nRow = fCommonParam->GetRowMax( plan, cham, sect ); - Int_t nCol = fCommonParam->GetColMax( plan ); - const Int_t nTBin = fCalibration->GetNumberOfTimeBins(); + Int_t nRow = fGeo->GetRowMax( plan, cham, sect ); + Int_t nCol = fGeo->GetColMax( plan ); + const Int_t nTBin = AliTRDcalibDB::Instance()->GetNumberOfTimeBins(); Int_t kCtype = 0; // Chamber type (0:C0, 1:C1) Int_t iEv = 0xA; // Event ID. Now fixed to 10, how do I get event id? UInt_t x = 0; // General used number diff --git a/TRD/AliTRDrawData.h b/TRD/AliTRDrawData.h index ed1a4e61916..772b5953113 100644 --- a/TRD/AliTRDrawData.h +++ b/TRD/AliTRDrawData.h @@ -18,8 +18,6 @@ class TTree; class AliRawReader; class AliTRDdigitsManager; -class AliTRDCommonParam; -class AliTRDcalibDB; class AliTRDgeometry; class AliTRDdataArrayI; @@ -45,12 +43,10 @@ class AliTRDrawData : public TObject { virtual Int_t ProduceHcDataV1andV2(AliTRDdataArrayI *digits, Int_t side, Int_t det, UInt_t *buf, Int_t maxSize); Int_t fRawVersion; // Which version of raw simulator is used - AliTRDCommonParam *fCommonParam; //! Common parameters - AliTRDcalibDB *fCalibration; //! Offline database interface AliTRDgeometry *fGeo; //! Geometry Int_t fNumberOfDDLs; // Number of DDLs - ClassDef(AliTRDrawData,3) // TRD raw data class + ClassDef(AliTRDrawData,4) // TRD raw data class }; #endif diff --git a/TRD/AliTRDtracker.cxx b/TRD/AliTRDtracker.cxx index 03e0db3d4a3..772ca8b958f 100644 --- a/TRD/AliTRDtracker.cxx +++ b/TRD/AliTRDtracker.cxx @@ -173,24 +173,26 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile) // TDirectory *savedir = gDirectory; - TFile *in = (TFile *) geomfile; - - if (!in->IsOpen()) { - AliWarning("geometry file is not open!\n"); - AliWarning("FULL TRD geometry and DEFAULT TRD parameter will be used\n"); - } - else { - in->cd(); - fGeom = (AliTRDgeometry *) in->Get("TRDgeometry"); - } - if (!fGeom) { - AliWarning("Cannot find TRD geometry!\n"); - fGeom = new AliTRDgeometry(); - } + //TFile *in = (TFile *) geomfile; + // + //if (!in->IsOpen()) { + // AliWarning("geometry file is not open!\n"); + // AliWarning("FULL TRD geometry and DEFAULT TRD parameter will be used\n"); + //} + //else { + // in->cd(); + // fGeom = (AliTRDgeometry *) in->Get("TRDgeometry"); + //} + // + //if (!fGeom) { + // AliWarning("Cannot find TRD geometry!\n"); + // fGeom = new AliTRDgeometry(); + //} + fGeom = new AliTRDgeometry(); fGeom->ReadGeoMatrices(); - savedir->cd(); + //savedir->cd(); for (Int_t geomS = 0; geomS < kTrackingSectors; geomS++) { Int_t trS = geomS; @@ -200,7 +202,7 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile) } } - AliTRDpadPlane *padPlane = AliTRDCommonParam::Instance()->GetPadPlane(0,0); + AliTRDpadPlane *padPlane = fGeom->GetPadPlane(0,0); Float_t tiltAngle = TMath::Abs(padPlane->GetTiltingAngle()); if (tiltAngle < 0.1) { fNoTilt = kTRUE; @@ -241,7 +243,9 @@ AliTRDtracker::~AliTRDtracker() delete fSeeds; } - delete fGeom; + if (fGeom) { + delete fGeom; + } for (Int_t geomS = 0; geomS < kTrackingSectors; geomS++) { delete fTrSec[geomS]; @@ -367,8 +371,7 @@ Bool_t AliTRDtracker::Transform(AliTRDcluster *cluster) Double_t vdrift = AliTRDcalibDB::Instance()->GetVdrift(cluster->GetDetector(),0,0); Double_t exB = AliTRDcalibDB::Instance()->GetOmegaTau(vdrift,-AliTracker::GetBz()*0.1); - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - AliTRDpadPlane *padPlane = commonParam->GetPadPlane(plane,chamber); + AliTRDpadPlane *padPlane = fGeom->GetPadPlane(plane,chamber); Double_t zshiftIdeal = 0.5*(padPlane->GetRow0()+padPlane->GetRowEnd()); Double_t localPos[3]; Double_t localPosTracker[3]; @@ -1571,7 +1574,7 @@ void AliTRDtracker::MakeSeedsMI(Int_t /*inner*/, Int_t /*outer*/, AliESD *esd) } } - AliTRDpadPlane *padPlane = AliTRDCommonParam::Instance()->GetPadPlane(0,0); + AliTRDpadPlane *padPlane = fGeom->GetPadPlane(0,0); Double_t h01 = TMath::Tan(-TMath::Pi() / 180.0 * padPlane->GetTiltingAngle()); Double_t hL[6]; // Tilting angle Double_t xcl[6]; // X - position of reference cluster @@ -3035,31 +3038,24 @@ AliTRDtracker::AliTRDtrackingSector Double_t *zc = new Double_t[kNchambers]; Double_t *zmax = new Double_t[kNchambers]; Double_t *zmaxsensitive = new Double_t[kNchambers]; - - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { - AliErrorGeneral("AliTRDtrackingSector::Ctor" - ,"Could not get common parameters\n"); - return; - } for (Int_t plane = 0; plane < AliTRDgeometry::Nplan(); plane++) { ymax = fGeom->GetChamberWidth(plane) / 2.0; - padPlane = commonParam->GetPadPlane(plane,0); + padPlane = fGeom->GetPadPlane(plane,0); ymaxsensitive = (padPlane->GetColSize(1) * padPlane->GetNcols() - 4.0) / 2.0; for (Int_t ch = 0; ch < kNchambers; ch++) { zmax[ch] = fGeom->GetChamberLength(plane,ch) / 2.0; Float_t pad = padPlane->GetRowSize(1); - Float_t row0 = commonParam->GetRow0(plane,ch,0); - Int_t nPads = commonParam->GetRowMax(plane,ch,0); + Float_t row0 = fGeom->GetRow0(plane,ch,0); + Int_t nPads = fGeom->GetRowMax(plane,ch,0); zmaxsensitive[ch] = Float_t(nPads) * pad / 2.0; zc[ch] = -(pad * nPads) / 2.0 + row0; } dx = AliTRDcalibDB::Instance()->GetVdrift(0,0,0) - / commonParam->GetSamplingFrequency(); + / AliTRDCommonParam::Instance()->GetSamplingFrequency(); rho = 0.00295 * 0.85; //???? radLength = 11.0; @@ -3446,7 +3442,7 @@ Double_t AliTRDtracker::GetTiltFactor(const AliTRDcluster *c) Int_t det = c->GetDetector(); Int_t plane = fGeom->GetPlane(det); - AliTRDpadPlane *padPlane = AliTRDCommonParam::Instance()->GetPadPlane(plane,0); + AliTRDpadPlane *padPlane = fGeom->GetPadPlane(plane,0); Double_t h01 = TMath::Tan(-TMath::Pi() / 180.0 * padPlane->GetTiltingAngle()); if (fNoTilt) { diff --git a/TRD/AliTRDtrackingAnalysis.cxx b/TRD/AliTRDtrackingAnalysis.cxx index 9ec479c4722..dd7758e51e2 100644 --- a/TRD/AliTRDtrackingAnalysis.cxx +++ b/TRD/AliTRDtrackingAnalysis.cxx @@ -44,7 +44,6 @@ #include "AliTrackReference.h" #include "AliTRDcluster.h" -#include "AliTRDCommonParam.h" #include "AliTRDpadPlane.h" #include "AliTRDcalibDB.h" #include "AliTracker.h" @@ -441,7 +440,7 @@ void AliTRDtrackingAnalysis::DrawRecPointResolution(int startEvent, int stopEve fClZXcl->Fill(cls->GetZ(), cls->GetX()); fClZXref->Fill(zref, cls->GetX()); - AliTRDpadPlane *padPlane = AliTRDCommonParam::Instance()->GetPadPlane(plane,0); + AliTRDpadPlane *padPlane = fGeo->GetPadPlane(plane,0); Double_t h01 = TMath::Tan(-TMath::Pi() / 180.0 * padPlane->GetTiltingAngle()); //double dz = zref - padPlane->GetRow0(); @@ -653,8 +652,8 @@ void AliTRDtrackingAnalysis::CheckFiles() fEsdTree = (TTree*)esdFile->Get("esdTree"); fESD = new AliESD(); - - fEsdTree->SetBranchAddress("ESD", &fESD); + fESD->ReadFromTree(fEsdTree); + //fEsdTree->SetBranchAddress("ESD", &fESD); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/TRD/AliTRDtrigParam.cxx b/TRD/AliTRDtrigParam.cxx index 3fd55530efc..71096fa2322 100644 --- a/TRD/AliTRDtrigParam.cxx +++ b/TRD/AliTRDtrigParam.cxx @@ -15,9 +15,11 @@ /////////////////////////////////////////////////////////////////////////////// // // -// // // TRD trigger parameters class // // // +// Request an instance with AliTRDCommonParam::Instance() // +// Then request the needed values // +// // // Author: // // Bogdan Vulpescu // // // @@ -29,47 +31,51 @@ ClassImp(AliTRDtrigParam) +AliTRDtrigParam *AliTRDtrigParam::fgInstance = 0; +Bool_t AliTRDtrigParam::fgTerminated = kFALSE; + +//_ singleton implementation __________________________________________________ +AliTRDtrigParam *AliTRDtrigParam::Instance() +{ + // + // Singleton implementation + // Returns an instance of this class, it is created if neccessary + // + + if (fgTerminated != kFALSE) { + return 0; + } + + if (fgInstance == 0) { + fgInstance = new AliTRDtrigParam(); + } + + return fgInstance; + +} + //_____________________________________________________________________________ -AliTRDtrigParam::AliTRDtrigParam() - :TNamed() - ,fDebug(0) - ,fTime1(0) - ,fTime2(0) - ,fClusThr(0) - ,fPadThr(0) - ,fSum10(0) - ,fSum12(0) - ,fTCOn(0) - ,fTCnexp(0) - ,fFilterType(0) - ,fR1(0) - ,fR2(0) - ,fC1(0) - ,fC2(0) - ,fPedestal(0) - ,fADCnoise(0) - ,fDeltaY(0) - ,fDeltaS(0) - ,fXprojPlane(0) - ,fLtuPtCut(0) - ,fGtuPtCut(0) - ,fField(0) - ,fHighPt(0) - ,fNPartJetLow(0) - ,fNPartJetHigh(0) - ,fJetLowPt(0) - ,fJetHighPt(0) +void AliTRDtrigParam::Terminate() { // - // AliTRDtrigParam default constructor + // Singleton implementation + // Deletes the instance of this class and sets the terminated flag, + // instances cannot be requested anymore + // This function can be called several times. // + fgTerminated = kTRUE; + + if (fgInstance != 0) { + delete fgInstance; + fgInstance = 0; + } + } //_____________________________________________________________________________ -AliTRDtrigParam::AliTRDtrigParam(const Text_t *name, const Text_t *title) - :TNamed(name,title) - ,fDebug(0) +AliTRDtrigParam::AliTRDtrigParam() + :TObject() ,fTime1(2) ,fTime2(22) ,fClusThr(10.0) @@ -90,7 +96,6 @@ AliTRDtrigParam::AliTRDtrigParam(const Text_t *name, const Text_t *title) ,fXprojPlane(0) ,fLtuPtCut(2.3) ,fGtuPtCut(3.0) - ,fField(0) ,fHighPt(10.0) ,fNPartJetLow(5) ,fNPartJetHigh(3) @@ -98,7 +103,7 @@ AliTRDtrigParam::AliTRDtrigParam(const Text_t *name, const Text_t *title) ,fJetHighPt(5.0) { // - // AliTRDtrigParam constructor + // AliTRDtrigParam default constructor // // PASA.v.4 @@ -114,13 +119,14 @@ AliTRDtrigParam::AliTRDtrigParam(const Text_t *name, const Text_t *title) fC1 = 0.1141; fC2 = 0.6241; } + + Init(); } //_____________________________________________________________________________ AliTRDtrigParam::AliTRDtrigParam(const AliTRDtrigParam &p) - :TNamed(p) - ,fDebug(p.fDebug) + :TObject(p) ,fTime1(p.fTime1) ,fTime2(p.fTime2) ,fClusThr(p.fClusThr) @@ -141,7 +147,6 @@ AliTRDtrigParam::AliTRDtrigParam(const AliTRDtrigParam &p) ,fXprojPlane(p.fXprojPlane) ,fLtuPtCut(p.fLtuPtCut) ,fGtuPtCut(p.fGtuPtCut) - ,fField(p.fField) ,fHighPt(p.fHighPt) ,fNPartJetLow(p.fNPartJetLow) ,fNPartJetHigh(p.fNPartJetHigh) @@ -182,7 +187,6 @@ void AliTRDtrigParam::Copy(TObject &p) const // Copy function // - ((AliTRDtrigParam &) p).fDebug = fDebug; ((AliTRDtrigParam &) p).fTime1 = fTime1; ((AliTRDtrigParam &) p).fTime2 = fTime2; ((AliTRDtrigParam &) p).fClusThr = fClusThr; @@ -201,7 +205,6 @@ void AliTRDtrigParam::Copy(TObject &p) const ((AliTRDtrigParam &) p).fDeltaY = fDeltaY; ((AliTRDtrigParam &) p).fDeltaS = fDeltaS; ((AliTRDtrigParam &) p).fXprojPlane = fXprojPlane; - ((AliTRDtrigParam &) p).fField = fField; ((AliTRDtrigParam &) p).fLtuPtCut = fLtuPtCut; ((AliTRDtrigParam &) p).fGtuPtCut = fGtuPtCut; ((AliTRDtrigParam &) p).fHighPt = fHighPt; diff --git a/TRD/AliTRDtrigParam.h b/TRD/AliTRDtrigParam.h index 97b8b095153..98dd5633736 100644 --- a/TRD/AliTRDtrigParam.h +++ b/TRD/AliTRDtrigParam.h @@ -9,18 +9,19 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include +#include "TObject.h" -class AliTRDtrigParam : public TNamed { +class AliTRDtrigParam : public TObject { public: - AliTRDtrigParam(); - AliTRDtrigParam(const Text_t* name, const Text_t* title); AliTRDtrigParam(const AliTRDtrigParam &p); virtual ~AliTRDtrigParam(); AliTRDtrigParam &operator=(const AliTRDtrigParam &p); + static AliTRDtrigParam *Instance(); + static void Terminate(); + virtual void Copy(TObject &p) const; void Init(); @@ -41,11 +42,9 @@ class AliTRDtrigParam : public TNamed { c2 = fC2; ped = fPedestal; }; Float_t GetADCnoise() const { return fADCnoise; }; - Int_t GetDebugLevel() const { return fDebug; }; Float_t GetDeltaY() const { return fDeltaY; }; Float_t GetDeltaS() const { return fDeltaS; }; Float_t GetXprojPlane() const { return fXprojPlane; }; - Float_t GetField() const { return fField; }; Float_t GetLtuPtCut() const { return fLtuPtCut; }; Float_t GetGtuPtCut() const { return fGtuPtCut; }; Float_t GetHighPt() const { return fHighPt; }; @@ -70,10 +69,8 @@ class AliTRDtrigParam : public TNamed { fC2 = c2; fPedestal = ped; }; void SetADCnoise(Float_t adcn) { fADCnoise = adcn; }; - void SetDebugLevel(Int_t deb) { fDebug = deb; }; void SetDeltaY(Float_t dy) { fDeltaY = dy; }; void SetDeltaS(Float_t ds) { fDeltaS = ds; }; - void SetField(Float_t b) { fField = b; }; void SetLtuPtCut(Float_t ptcut) { fLtuPtCut = ptcut; }; void SetGtuPtCut(Float_t ptcut) { fGtuPtCut = ptcut; }; void SetHighPt(Float_t hpt) { fHighPt = hpt; }; @@ -84,7 +81,8 @@ class AliTRDtrigParam : public TNamed { protected: - Int_t fDebug; // Debugging flag + static AliTRDtrigParam *fgInstance; // Instance of this class (singleton implementation) + static Bool_t fgTerminated; // Defines if this class has already been terminated Int_t fTime1; // First time bin for tracking (incl.) Int_t fTime2; // Last time bin for tracking (incl.) @@ -112,8 +110,6 @@ class AliTRDtrigParam : public TNamed { Float_t fLtuPtCut; // Local pt cut Float_t fGtuPtCut; // Global pt cut - Float_t fField; // Magnetic field - Float_t fHighPt; // High pt selection Int_t fNPartJetLow; // Number of tracks for jet (low) @@ -121,7 +117,12 @@ class AliTRDtrigParam : public TNamed { Float_t fJetLowPt; // Low pt threshold for jet particles Float_t fJetHighPt; // High pt threshold for jet particles - ClassDef(AliTRDtrigParam,2) // TRD trigger parameter class + private: + + // This is a singleton, constructor is private! + AliTRDtrigParam(); + + ClassDef(AliTRDtrigParam,3) // TRD trigger parameter class }; diff --git a/TRD/AliTRDtrigger.cxx b/TRD/AliTRDtrigger.cxx index e0f4ddbd918..b1b95375eee 100644 --- a/TRD/AliTRDtrigger.cxx +++ b/TRD/AliTRDtrigger.cxx @@ -36,7 +36,6 @@ #include "AliTRDgeometry.h" #include "AliTRDdataArrayI.h" #include "AliTRDcalibDB.h" -#include "AliTRDCommonParam.h" #include "AliTRDrawData.h" #include "AliTRDtrigger.h" #include "AliTRDmodule.h" @@ -55,9 +54,6 @@ AliTRDtrigger::AliTRDtrigger() :TNamed() ,fField(0) ,fGeo(NULL) - ,fCalib(NULL) - ,fCParam(NULL) - ,fTrigParam(NULL) ,fRunLoader(NULL) ,fDigitsManager(NULL) ,fTrackletTree(NULL) @@ -87,9 +83,6 @@ AliTRDtrigger::AliTRDtrigger(const Text_t *name, const Text_t *title) :TNamed(name,title) ,fField(0) ,fGeo(NULL) - ,fCalib(NULL) - ,fCParam(NULL) - ,fTrigParam(NULL) ,fRunLoader(NULL) ,fDigitsManager(new AliTRDdigitsManager()) ,fTrackletTree(NULL) @@ -119,9 +112,6 @@ AliTRDtrigger::AliTRDtrigger(const AliTRDtrigger &p) :TNamed(p) ,fField(p.fField) ,fGeo(NULL) - ,fCalib(NULL) - ,fCParam(NULL) - ,fTrigParam(NULL) ,fRunLoader(NULL) ,fDigitsManager(NULL) ,fTrackletTree(NULL) @@ -144,6 +134,11 @@ AliTRDtrigger::AliTRDtrigger(const AliTRDtrigger &p) // AliTRDtrigger copy constructor // + if (fGeo) { + delete fGeo; + } + fGeo = new AliTRDgeometry(); + } ///_____________________________________________________________________________ @@ -163,6 +158,10 @@ AliTRDtrigger::~AliTRDtrigger() delete fTracks; } + if (fGeo) { + delete fGeo; + } + } //_____________________________________________________________________________ @@ -192,24 +191,22 @@ void AliTRDtrigger::Copy(TObject &) const void AliTRDtrigger::Init() { - fModule = new AliTRDmodule(fTrigParam); + fModule = new AliTRDmodule(); fTracks->Clear(); - fField = fTrigParam->GetField(); - fGeo = (AliTRDgeometry*)AliTRDgeometry::GetGeometry(fRunLoader); + // The magnetic field strength + Double_t x[3] = { 0.0, 0.0, 0.0 }; + Double_t b[3]; + gAlice->Field(x,b); // b[] is in kilo Gauss + fField = b[2] * 0.1; // Tesla + + fGeo = new AliTRDgeometry(); - fCalib = AliTRDcalibDB::Instance(); - if (!fCalib) { + if (!AliTRDcalibDB::Instance()) { AliError("No instance of AliTRDcalibDB."); return; } - fCParam = AliTRDCommonParam::Instance(); - if (!fCParam) { - AliError("No common parameters."); - return; - } - } //_____________________________________________________________________________ @@ -327,7 +324,7 @@ Bool_t AliTRDtrigger::ReadTracklets(AliRunLoader *rl) for (itrk = 0; itrk < tracklets->GetEntriesFast(); itrk++) { - fTrk = (AliTRDmcmTracklet*)tracklets->UncheckedAt(itrk); + fTrk = (AliTRDmcmTracklet *) tracklets->UncheckedAt(itrk); idet = fTrk->GetDetector(); iStack = idet / (AliTRDgeometry::Nplan()); @@ -376,7 +373,7 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) Int_t sectEnd = AliTRDgeometry::Nsect(); fTrkTest = new AliTRDmcmTracklet(0,0,0); - fMCM = new AliTRDmcm(fTrigParam,0); + fMCM = new AliTRDmcm(0); Int_t time; Int_t col; @@ -419,9 +416,9 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) } } - Int_t nRowMax = fCParam->GetRowMax(iplan,icham,isect); - Int_t nColMax = fCParam->GetColMax(iplan); - Int_t nTimeTotal = fCalib->GetNumberOfTimeBins(); + Int_t nRowMax = fGeo->GetRowMax(iplan,icham,isect); + Int_t nColMax = fGeo->GetColMax(iplan); + Int_t nTimeTotal = AliTRDcalibDB::Instance()->GetNumberOfTimeBins(); // Get the digits fDigits = fDigitsManager->GetDigits(idet); @@ -472,8 +469,9 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) } } - if (fTrigParam->GetTailCancelation()) { - fMCM->Filter(fTrigParam->GetNexponential(),fTrigParam->GetFilterType()); + if (AliTRDtrigParam::Instance()->GetTailCancelation()) { + fMCM->Filter(AliTRDtrigParam::Instance()->GetNexponential() + ,AliTRDtrigParam::Instance()->GetFilterType()); } if (fMCM->Run()) { @@ -484,9 +482,7 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) continue; } - if (fTrigParam->GetDebugLevel() > 1) { - AliInfo(Form("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed])); - } + AliDebug(2,Form("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed])); if (TestTracklet(idet,row,iSeed,0)) { AddTracklet(idet,row,iSeed,fNtracklets++); @@ -583,7 +579,7 @@ Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) // Check first the tracklet pt // - Int_t nTimeTotal = fCalib->GetNumberOfTimeBins(); + Int_t nTimeTotal = AliTRDcalibDB::Instance()->GetNumberOfTimeBins(); // Calibration fill 2D AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance(); @@ -656,7 +652,7 @@ Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) fTrkTest->MakeClusAmpGraph(); - if (TMath::Abs(fTrkTest->GetPt()) < fTrigParam->GetLtuPtCut()) { + if (TMath::Abs(fTrkTest->GetPt()) < AliTRDtrigParam::Instance()->GetLtuPtCut()) { return kFALSE; } @@ -671,7 +667,7 @@ void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) // Add a found tracklet // - Int_t nTimeTotal = fCalib->GetNumberOfTimeBins(); + Int_t nTimeTotal = AliTRDcalibDB::Instance()->GetNumberOfTimeBins(); fTrk = new AliTRDmcmTracklet(det,row,n); @@ -727,7 +723,7 @@ void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) // LTU Pt cut fTrk->MakeTrackletGraph(fGeo,fField); fTrk->MakeClusAmpGraph(); - if (TMath::Abs(fTrk->GetPt()) < fTrigParam->GetLtuPtCut()) { + if (TMath::Abs(fTrk->GetPt()) < AliTRDtrigParam::Instance()->GetLtuPtCut()) { return; } @@ -821,7 +817,7 @@ void AliTRDtrigger::MakeTracks(Int_t det) icham = fGeo->GetChamber(trk->GetDetector()); isect = fGeo->GetSector(trk->GetDetector()); - nRowMax = fCParam->GetRowMax(iplan,icham,isect); + nRowMax = fGeo->GetRowMax(iplan,icham,isect); row = trk->GetRow(); fModule->AddTracklet(trk->GetDetector(), @@ -847,7 +843,7 @@ void AliTRDtrigger::MakeTracks(Int_t det) AliTRDgtuTrack *gtutrk; for (Int_t i = 0; i < nModTracks; i++) { gtutrk = (AliTRDgtuTrack*)fModule->GetTrack(i); - if (TMath::Abs(gtutrk->GetPt()) < fTrigParam->GetGtuPtCut()) continue; + if (TMath::Abs(gtutrk->GetPt()) < AliTRDtrigParam::Instance()->GetGtuPtCut()) continue; gtutrk->CookLabel(); gtutrk->MakePID(); AddTrack(gtutrk,det); diff --git a/TRD/AliTRDtrigger.h b/TRD/AliTRDtrigger.h index 8682f0258c0..b74f415338a 100644 --- a/TRD/AliTRDtrigger.h +++ b/TRD/AliTRDtrigger.h @@ -24,12 +24,9 @@ class AliTRDmcmTracklet; class AliTRDgtuTrack; class AliTRDmcm; class AliTRDmodule; -class AliTRDtrigParam; class AliTRDdigitsManager; class AliTRDdataArrayI; class AliTRDgeometry; -class AliTRDcalibDB; -class AliTRDCommonParam; class AliTRDtrigger : public TNamed { @@ -64,22 +61,16 @@ class AliTRDtrigger : public TNamed { Int_t GetNumberOfTracks() const; Int_t GetNPrimary() const { return fNPrimary; }; - AliTRDtrigParam *GetParameter() const { return fTrigParam; }; AliTRDgtuTrack *GetTrack(Int_t i) const; void SetRunLoader(AliRunLoader *rl) { fRunLoader = rl; }; void SetMCMcoordinates(Int_t imcm); - void SetParameter(AliTRDtrigParam *trigp) { fTrigParam = trigp; }; - protected: Float_t fField; //! Magnetic field AliTRDgeometry *fGeo; //! TRD geometry - AliTRDcalibDB *fCalib; //! Calibration DB - AliTRDCommonParam *fCParam; //! Common parameters - AliTRDtrigParam *fTrigParam; //! Trigger class parameters AliRunLoader *fRunLoader; //! Run Loader AliTRDdigitsManager *fDigitsManager; //! TRD digits manager TTree *fTrackletTree; //! Tree with tracklets @@ -103,7 +94,7 @@ class AliTRDtrigger : public TNamed { TClonesArray *fTracks; //! Array of GTU tracks - ClassDef(AliTRDtrigger,3) // TRD trigger class + ClassDef(AliTRDtrigger,4) // TRD trigger class }; diff --git a/TRD/TRDrecLinkDef.h b/TRD/TRDrecLinkDef.h index f11f4342595..1dda033e462 100644 --- a/TRD/TRDrecLinkDef.h +++ b/TRD/TRDrecLinkDef.h @@ -8,7 +8,6 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class AliTRDrecPoint+; #pragma link C++ class AliTRDcluster+; #pragma link C++ class AliTRDclusterMI+; diff --git a/TRD/libTRDrec.pkg b/TRD/libTRDrec.pkg index 91d7deba853..7938cbde194 100644 --- a/TRD/libTRDrec.pkg +++ b/TRD/libTRDrec.pkg @@ -1,5 +1,4 @@ -SRCS= AliTRDrecPoint.cxx \ - AliTRDcluster.cxx \ +SRCS= AliTRDcluster.cxx \ AliTRDclusterMI.cxx \ AliTRDclusterizer.cxx \ AliTRDclusterizerV1.cxx \