From 5f006bd756617a464e854140e33d1ed5e097e7ec Mon Sep 17 00:00:00 2001 From: jklein Date: Tue, 5 Jul 2011 18:56:13 +0000 Subject: [PATCH] remove trailing whitespaces to get meaningful diffs for following commits --- TRD/AliTRDTrigger.cxx | 4 +- TRD/AliTRDTriggerL0.cxx | 2 +- TRD/AliTRDTriggerL1.cxx | 14 +- TRD/AliTRDgtuParam.cxx | 82 +-- TRD/AliTRDgtuParam.h | 8 +- TRD/AliTRDgtuSim.cxx | 80 +-- TRD/AliTRDgtuSim.h | 4 +- TRD/AliTRDgtuTMU.cxx | 138 +++--- TRD/AliTRDgtuTMU.h | 4 +- TRD/AliTRDmcmSim.cxx | 490 +++++++++--------- TRD/AliTRDmcmSim.h | 70 +-- TRD/AliTRDrawStream.cxx | 362 +++++++------- TRD/AliTRDrawStream.h | 40 +- TRD/AliTRDtrackGTU.cxx | 26 +- TRD/AliTRDtrackGTU.h | 2 +- TRD/AliTRDtrackletBase.cxx | 2 +- TRD/AliTRDtrackletBase.h | 28 +- TRD/AliTRDtrackletGTU.cxx | 54 +- TRD/AliTRDtrackletGTU.h | 10 +- TRD/AliTRDtrackletMCM.cxx | 22 +- TRD/AliTRDtrackletMCM.h | 12 +- TRD/AliTRDtrackletWord.cxx | 8 +- TRD/AliTRDtrackletWord.h | 8 +- TRD/AliTRDtrapConfig.cxx | 124 ++--- TRD/AliTRDtrapConfig.h | 850 ++++++++++++++++---------------- TRD/AliTRDtrapConfigHandler.cxx | 2 +- 26 files changed, 1223 insertions(+), 1223 deletions(-) diff --git a/TRD/AliTRDTrigger.cxx b/TRD/AliTRDTrigger.cxx index 4a909462e76..94bdf5c2349 100644 --- a/TRD/AliTRDTrigger.cxx +++ b/TRD/AliTRDTrigger.cxx @@ -49,7 +49,7 @@ AliTRDTrigger::~AliTRDTrigger() { // destructor TIter trigger(&fTriggers); - while (AliTriggerDetector *trgDet = (AliTriggerDetector*) trigger()) + while (AliTriggerDetector *trgDet = (AliTriggerDetector*) trigger()) delete trgDet; fInputs.Clear(); // inputs are deleted either by CTP or submodule @@ -75,7 +75,7 @@ void AliTRDTrigger::CreateInputs() void AliTRDTrigger::Trigger() { // TRD trigger steering - // all registered TRD trigger mechanism are + // all registered TRD trigger mechanism are // run from here TIter trigger(&fTriggers); diff --git a/TRD/AliTRDTriggerL0.cxx b/TRD/AliTRDTriggerL0.cxx index 73224b58986..cc69271ed35 100644 --- a/TRD/AliTRDTriggerL0.cxx +++ b/TRD/AliTRDTriggerL0.cxx @@ -76,7 +76,7 @@ void AliTRDTriggerL0::Trigger() for (Int_t iResult = 1; iResult <= simulationResult[0]; iResult++) { AliDebug(5, Form("Result[%d]=0x%x\n",iResult,simulationResult[iResult])); } - if ((simulationResult[0] > 0) || (simulationResult[1] > 0)) { + if ((simulationResult[0] > 0) || (simulationResult[1] > 0)) { AliInfo("Fired single gap trigger"); SetInput("0HSG"); } diff --git a/TRD/AliTRDTriggerL1.cxx b/TRD/AliTRDTriggerL1.cxx index c361955c097..006394d1a3c 100644 --- a/TRD/AliTRDTriggerL1.cxx +++ b/TRD/AliTRDTriggerL1.cxx @@ -68,11 +68,11 @@ void AliTRDTriggerL1::Trigger() AliLoader *trdLoader = runLoader->GetLoader("TRDLoader"); if (!trdLoader) return; - + // now running the GTU tracking; AliTRDgtuSim *gtusim = new AliTRDgtuSim(); gtusim->RunGTU(trdLoader, 0x0); - + TTree *trackTree = trdLoader->GetDataLoader("gtutracks")->Tree(); if (!trackTree) { AliDebug(1,"Did not find track tree"); @@ -80,17 +80,17 @@ void AliTRDTriggerL1::Trigger() } TBranch *branch = trackTree->GetBranch("TRDtrackGTU"); AliDebug(1,Form("TRD trigger: found %lld tracks", trackTree->GetEntriesFast())); - + // trigger thresholds should go elsewhere Float_t ptThreshold1 = 2; Float_t ptThreshold2 = 9.9; Int_t trackThreshold1 = 6; Int_t trackThreshold2 = 2; - + // trigger algorithms to come, e.g. Bool_t triggeredHighPt = kFALSE; Bool_t triggeredJet = kFALSE; - + if (branch) { AliTRDtrackGTU *trk = 0x0; branch->SetAddress(&trk); @@ -99,7 +99,7 @@ void AliTRDTriggerL1::Trigger() for (Int_t iTrack = 0; iTrack < trackTree->GetEntriesFast(); iTrack++) { trackTree->GetEntry(iTrack); if (TMath::Abs(trk->GetPt()) > 3.0) { - AliDebug(1, Form("Found track in sector %2i, stack %i with pt = %3.1f, triggered", + AliDebug(1, Form("Found track in sector %2i, stack %i with pt = %3.1f, triggered", trk->GetSector(), trk->GetStack(), trk->GetPt())); triggeredHighPt = kTRUE; } @@ -126,7 +126,7 @@ void AliTRDTriggerL1::Trigger() AliWarning("GTU Branch not found"); } - if (triggeredHighPt) { + if (triggeredHighPt) { AliInfo("Fired high-pt trigger"); SetInput("1HSH"); } diff --git a/TRD/AliTRDgtuParam.cxx b/TRD/AliTRDgtuParam.cxx index 120e2577da8..53fbcfebcea 100644 --- a/TRD/AliTRDgtuParam.cxx +++ b/TRD/AliTRDgtuParam.cxx @@ -49,11 +49,11 @@ const Float_t AliTRDgtuParam::fgkBinWidthdY = 140e-4; // ----- Bit widths (used for internal representation) ----- const Int_t AliTRDgtuParam::fgkBitWidthY = 13; -const Int_t AliTRDgtuParam::fgkBitWidthdY = 7; +const Int_t AliTRDgtuParam::fgkBitWidthdY = 7; const Int_t AliTRDgtuParam::fgkBitWidthYProj = 10; -const Int_t AliTRDgtuParam::fgkBitExcessY = 4; -const Int_t AliTRDgtuParam::fgkBitExcessAlpha = 10; -const Int_t AliTRDgtuParam::fgkBitExcessYProj = 2; +const Int_t AliTRDgtuParam::fgkBitExcessY = 4; +const Int_t AliTRDgtuParam::fgkBitExcessAlpha = 10; +const Int_t AliTRDgtuParam::fgkBitExcessYProj = 2; // ----- Tracking parameters ----- /* @@ -84,10 +84,10 @@ AliTRDgtuParam::AliTRDgtuParam() : fCki[iLayer] = 0.; } - GenerateZChannelMap(); + GenerateZChannelMap(); } -AliTRDgtuParam::~AliTRDgtuParam() +AliTRDgtuParam::~AliTRDgtuParam() { // dtor @@ -95,17 +95,17 @@ AliTRDgtuParam::~AliTRDgtuParam() delete [] fRefLayers; } -AliTRDgtuParam* AliTRDgtuParam::Instance() +AliTRDgtuParam* AliTRDgtuParam::Instance() { // get (or create) the single instance - if (fgInstance == 0) + if (fgInstance == 0) fgInstance = new AliTRDgtuParam(); return fgInstance; } -void AliTRDgtuParam::Terminate() +void AliTRDgtuParam::Terminate() { // destruct the instance @@ -115,7 +115,7 @@ void AliTRDgtuParam::Terminate() } } -Bool_t AliTRDgtuParam::IsInZChannel(Int_t stack, Int_t layer, Int_t zchannel, Int_t zpos) const +Bool_t AliTRDgtuParam::IsInZChannel(Int_t stack, Int_t layer, Int_t zchannel, Int_t zpos) const { return (fZSubChannel[stack][zchannel][layer][zpos] != 0); } @@ -125,20 +125,20 @@ Int_t AliTRDgtuParam::GetZSubchannel(Int_t stack, Int_t layer, Int_t zchannel, I return fZSubChannel[stack][zchannel][layer][zpos]; } -Int_t AliTRDgtuParam::GetRefLayer(Int_t refLayerIdx) const +Int_t AliTRDgtuParam::GetRefLayer(Int_t refLayerIdx) const { // returns the reference layer indexed by refLayerIdx if (refLayerIdx >= 0 && refLayerIdx < fgkNRefLayers) return fRefLayers[refLayerIdx]; - else + else return -1; } -Int_t AliTRDgtuParam::GenerateZChannelMap() +Int_t AliTRDgtuParam::GenerateZChannelMap() { // generate the z-channel map - // assuming that the tracks come from the vertex + // assuming that the tracks come from the vertex // +/- fVertexSize in z-direction Int_t iSec = 0; // sector is irrelevant @@ -149,27 +149,27 @@ Int_t AliTRDgtuParam::GenerateZChannelMap() Float_t x[6] = { 0 }; Float_t z[6][16] = {{ 0 }}; Float_t dZ[6][16] = {{ 0 }}; - + for (Int_t iLayer = 0; iLayer < fGeo->Nlayer(); iLayer++) { AliTRDpadPlane *pp = fGeo->GetPadPlane(iLayer, iStack); x[iLayer] = fGeo->GetTime0(iLayer) - fGeo->CdrHght(); // ??? for (Int_t iRow = 0; iRow < fGeo->GetRowMax(iLayer, iStack, iSec); iRow++) { z[iLayer][iRow] = pp->GetRowPos(iRow); // this is the right (pos. z-direction) border of the pad dZ[iLayer][iRow] = pp->GetRowSize(iRow); // length of the pad in z-direction - for (Int_t i = 0; i < fgkNZChannels; i++) + for (Int_t i = 0; i < fgkNZChannels; i++) fZSubChannel[iStack][i][iLayer][iRow] = 0; } } for (Int_t fixRow = 0; fixRow < fGeo->GetRowMax(fgkFixLayer, iStack, iSec); fixRow++) { - - Double_t fixZmin = z[fgkFixLayer][fixRow] - dZ[fgkFixLayer][fixRow]; + + Double_t fixZmin = z[fgkFixLayer][fixRow] - dZ[fgkFixLayer][fixRow]; Double_t fixZmax = z[fgkFixLayer][fixRow]; - Double_t fixX = x[fgkFixLayer] + 1.5; // ??? 1.5 from where? + Double_t fixX = x[fgkFixLayer] + 1.5; // ??? 1.5 from where? for (Int_t iLayer = 0; iLayer < fGeo->Nlayer(); iLayer++) { Double_t leftZ, rightZ; - + if (iLayer <= fgkFixLayer) { leftZ = (fixZmin + fVertexSize) * (x[iLayer] + 1.5) / fixX - fVertexSize; rightZ = (fixZmax - fVertexSize) * (x[iLayer] + 1.5) / fixX + fVertexSize; @@ -178,17 +178,17 @@ Int_t AliTRDgtuParam::GenerateZChannelMap() leftZ = (fixZmin - fVertexSize) * (x[iLayer] + 1.5) / fixX + fVertexSize; rightZ = (fixZmax + fVertexSize) * (x[iLayer] + 1.5) / fixX - fVertexSize; } - + Double_t epsilon = 0.001; for (Int_t iRow = 0; iRow < fGeo->GetRowMax(iLayer, iStack, iSec); iRow++) { - if ( (z[iLayer][iRow] ) > (leftZ + epsilon) && + if ( (z[iLayer][iRow] ) > (leftZ + epsilon) && (z[iLayer][iRow] - dZ[iLayer][iRow] ) < (rightZ - epsilon) ) { fZChannelMap[iStack][fixRow][iLayer][iRow] = 1; if (fZSubChannel[iStack][fixRow % fgkNZChannels][iLayer][iRow] != 0) { AliError("Collision in Z-Channel assignment occured! No reliable tracking!!!"); collision = kTRUE; } - else + else fZSubChannel[iStack][fixRow % fgkNZChannels][iLayer][iRow] = fixRow / fgkNZChannels + 1; } @@ -200,9 +200,9 @@ Int_t AliTRDgtuParam::GenerateZChannelMap() return ~collision; } -Bool_t AliTRDgtuParam::DisplayZChannelMap(Int_t zchannel, Int_t subchannel) const +Bool_t AliTRDgtuParam::DisplayZChannelMap(Int_t zchannel, Int_t subchannel) const { - // display the z-channel map + // display the z-channel map if (zchannel >= fgkNZChannels) { AliError("Invalid Z channel!"); @@ -216,7 +216,7 @@ Bool_t AliTRDgtuParam::DisplayZChannelMap(Int_t zchannel, Int_t subchannel) cons TCanvas *c = new TCanvas("zchmap", "Z-Chhannel Mapping"); c->cd(); TGraph **graphz = new TGraph*[fgkNZChannels]; - for (Int_t zch = zchmin; zch < zchmax; zch++) + for (Int_t zch = zchmin; zch < zchmax; zch++) graphz[zch] = new TGraph; TGraphAsymmErrors *graph = new TGraphAsymmErrors(); graph->SetTitle("Z-Channel Map"); @@ -250,7 +250,7 @@ Bool_t AliTRDgtuParam::DisplayZChannelMap(Int_t zchannel, Int_t subchannel) cons return kTRUE; } -Int_t AliTRDgtuParam::GetCiAlpha(Int_t layer) const +Int_t AliTRDgtuParam::GetCiAlpha(Int_t layer) const { // get the constant for the calculation of alpha @@ -258,25 +258,25 @@ Int_t AliTRDgtuParam::GetCiAlpha(Int_t layer) const return ci; } -Int_t AliTRDgtuParam::GetCiYProj(Int_t layer) const +Int_t AliTRDgtuParam::GetCiYProj(Int_t layer) const { // get the constant for the calculation of y_proj - Float_t xmid = (fGeo->GetTime0(0) + fGeo->GetTime0(fGeo->Nlayer()-1)) / 2.; + Float_t xmid = (fGeo->GetTime0(0) + fGeo->GetTime0(fGeo->Nlayer()-1)) / 2.; Int_t ci = (Int_t) (- (fGeo->GetTime0(layer) - xmid) / GetChamberThickness() * GetBinWidthdY() / GetBinWidthY() * (1 << GetBitExcessYProj()) ); return ci; } Int_t AliTRDgtuParam::GetYt(Int_t stack, Int_t layer, Int_t zrow) const { - return (Int_t) (- ( (layer % 2 ? 1 : -1) * - (GetGeo()->GetPadPlane(layer, stack)->GetRowPos(zrow) - GetGeo()->GetPadPlane(layer, stack)->GetRowSize(zrow) / 2) * + return (Int_t) (- ( (layer % 2 ? 1 : -1) * + (GetGeo()->GetPadPlane(layer, stack)->GetRowPos(zrow) - GetGeo()->GetPadPlane(layer, stack)->GetRowSize(zrow) / 2) * TMath::Tan(- 2.0 / 180.0 * TMath::Pi()) ) / 0.016 ); } -Bool_t AliTRDgtuParam::GenerateRecoCoefficients(Int_t trackletMask) +Bool_t AliTRDgtuParam::GenerateRecoCoefficients(Int_t trackletMask) { - // calculate the coefficients for the straight line fit + // calculate the coefficients for the straight line fit // depending on the mask of contributing tracklets fCurrTrackletMask = trackletMask; @@ -290,7 +290,7 @@ Bool_t AliTRDgtuParam::GenerateRecoCoefficients(Int_t trackletMask) a(layer, 0) = 0; a(layer, 1) = 0; a(layer, 2) = 0; - } + } else { a(layer, 0) = 1; a(layer, 1) = fGeo->GetTime0(layer); @@ -311,7 +311,7 @@ Bool_t AliTRDgtuParam::GenerateRecoCoefficients(Int_t trackletMask) return kTRUE; } -Float_t AliTRDgtuParam::GetAki(Int_t k, Int_t i) +Float_t AliTRDgtuParam::GetAki(Int_t k, Int_t i) { // get A_ki for the calculation of the tracking parameters if (fCurrTrackletMask != k) @@ -320,7 +320,7 @@ Float_t AliTRDgtuParam::GetAki(Int_t k, Int_t i) return fAki[i]; } -Float_t AliTRDgtuParam::GetBki(Int_t k, Int_t i) +Float_t AliTRDgtuParam::GetBki(Int_t k, Int_t i) { // get B_ki for the calculation of the tracking parameters @@ -330,7 +330,7 @@ Float_t AliTRDgtuParam::GetBki(Int_t k, Int_t i) return fBki[i]; } -Float_t AliTRDgtuParam::GetCki(Int_t k, Int_t i) +Float_t AliTRDgtuParam::GetCki(Int_t k, Int_t i) { // get B_ki for the calculation of the tracking parameters @@ -341,7 +341,7 @@ Float_t AliTRDgtuParam::GetCki(Int_t k, Int_t i) } /* -Float_t AliTRDgtuParam::GetD(Int_t k) const +Float_t AliTRDgtuParam::GetD(Int_t k) const { // get the determinant for the calculation of the tracking parameters @@ -363,7 +363,7 @@ Float_t AliTRDgtuParam::GetD(Int_t k) const return t.Determinant(); } -Bool_t AliTRDgtuParam::GetFitParams(TVectorD& rhs, Int_t k) +Bool_t AliTRDgtuParam::GetFitParams(TVectorD& rhs, Int_t k) { // calculate the fitting parameters // will be changed! @@ -389,7 +389,7 @@ Bool_t AliTRDgtuParam::GetFitParams(TVectorD& rhs, Int_t k) } */ -Bool_t AliTRDgtuParam::GetIntersectionPoints(Int_t k, Float_t &x1, Float_t &x2) +Bool_t AliTRDgtuParam::GetIntersectionPoints(Int_t k, Float_t &x1, Float_t &x2) { // get the x-coord. of the assumed circle/straight line intersection points @@ -398,7 +398,7 @@ Bool_t AliTRDgtuParam::GetIntersectionPoints(Int_t k, Float_t &x1, Float_t &x2) Int_t nHits = 0; for (Int_t layer = 0; layer < GetNLayers(); layer++) { if ( (k >> layer) & 0x1 ) { - if (l1 < 0) + if (l1 < 0) l1 = layer; l2 = layer; nHits++; diff --git a/TRD/AliTRDgtuParam.h b/TRD/AliTRDgtuParam.h index ee25ac12e4f..84b50b4c18f 100644 --- a/TRD/AliTRDgtuParam.h +++ b/TRD/AliTRDgtuParam.h @@ -6,8 +6,8 @@ /* $Id: AliTRDgtuParam.h 27496 2008-07-22 08:35:45Z cblume $ */ // -------------------------------------------------------- -// -// Singleton class to hold the parameters steering the GTU +// +// Singleton class to hold the parameters steering the GTU // tracking // // -------------------------------------------------------- @@ -21,7 +21,7 @@ class AliTRDgtuParam : public TObject { virtual ~AliTRDgtuParam(); static AliTRDgtuParam *Instance(); // Singleton - static void Terminate(); + static void Terminate(); static Int_t GetNLinks() { return fgkNLinks; } static Int_t GetNLayers() { return fgkNLinks/2; } @@ -94,7 +94,7 @@ class AliTRDgtuParam : public TObject { static const Int_t fgkBitExcessY; // excess bits for y-position static const Int_t fgkBitExcessAlpha; // excess bits for alpha static const Int_t fgkBitExcessYProj; // excess bits for projected y-position - + Float_t fVertexSize; // assumed vertex size (z-dir.) for the z-channel map Int_t fZChannelMap[5][16][6][16]; // must be changed diff --git a/TRD/AliTRDgtuSim.cxx b/TRD/AliTRDgtuSim.cxx index a23b271eac0..80e995fc09f 100644 --- a/TRD/AliTRDgtuSim.cxx +++ b/TRD/AliTRDgtuSim.cxx @@ -48,7 +48,7 @@ ClassImp(AliTRDgtuSim) -AliTRDgtuSim::AliTRDgtuSim(AliRunLoader *rl) +AliTRDgtuSim::AliTRDgtuSim(AliRunLoader *rl) : TObject(), fRunLoader(rl), fFeeParam(AliTRDfeeParam::Instance()), @@ -61,7 +61,7 @@ AliTRDgtuSim::AliTRDgtuSim(AliRunLoader *rl) fTrackletTree->SetDirectory(0); } -AliTRDgtuSim::~AliTRDgtuSim() +AliTRDgtuSim::~AliTRDgtuSim() { // destructor @@ -71,18 +71,18 @@ AliTRDgtuSim::~AliTRDgtuSim() delete fTrackletTree; } -Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t noev) +Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t noev) { - // run the GTU from a file of tracklets + // run the GTU from a file of tracklets // used for comparison to VHDL simulation AliInfo(Form("Running the GTU simulation on file: %s", filename.Data())); ifstream input(filename.Data()); - + std::string str; TString string; int lineno = 0; - + Int_t iEventPrev = -1; Int_t iStackPrev = -1; Int_t iSecPrev = -1; @@ -91,22 +91,22 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t Int_t iLink = -1; Int_t iEvent = -1; Int_t evcnt = -1; - + fTMU = 0x0; - + AliDebug(5,"--------- Reading from file ----------"); while (getline(input, str)) { lineno++; string = str; AliDebug(5,Form("Line %i : %s", lineno, string.Data())); - + TObjArray *tokens = string.Tokenize(" "); if (tokens->GetEntriesFast() < 7) { AliWarning(Form("Invalid input in line %i, too few parameters", lineno)); continue; } - if ( ((TObjString*) tokens->At(0))->GetString().Atoi() < event) + if ( ((TObjString*) tokens->At(0))->GetString().Atoi() < event) continue; iEvent = ((TObjString*) tokens->At(0))->GetString().Atoi(); @@ -125,10 +125,10 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t fTMU->WriteTrackletsToTree(fTrackletTree); WriteTracksToLoader(listOfTracks); WriteTracksToDataFile(listOfTracks, iEventPrev); - if (listOfTracks->GetEntries() > 0) + if (listOfTracks->GetEntries() > 0) AliDebug(2,Form(" %4.1f GeV/c", ((AliTRDtrackGTU*) listOfTracks->At(0))->GetPt() )); delete fTMU; - fTMU = new AliTRDgtuTMU(); + fTMU = new AliTRDgtuTMU(); delete listOfTracks; listOfTracks = 0x0; } else { @@ -144,7 +144,7 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t for (Int_t i = 5; i < tokens->GetEntriesFast(); i++) { UInt_t trackletWord = 0; sscanf(((TObjString*) tokens->At(i))->GetString().Data(), "%i", &trackletWord); - if (trackletWord == 0x10001000) + if (trackletWord == 0x10001000) break; AliDebug(2,Form("%i. tracklet: %s -> 0x%08x", i-4, ((TObjString*) tokens->At(i))->GetString().Data(), trackletWord)); AliTRDtrackletWord *trkl = new AliTRDtrackletWord(trackletWord); @@ -152,7 +152,7 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t fTMU->AddTracklet(trkl, iLink); } } - + if (fTMU && evcnt < noev) { TList *listOfTracks = new TList(); fTMU->SetStack(iStackPrev); @@ -168,13 +168,13 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t } AliInfo(Form("Analyzed %i events", evcnt)); - return kTRUE; + return kTRUE; } -Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) +Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) { // run the GTU on tracklets taken from the loader - // if specified the GTU tracks are written to the ESD event + // if specified the GTU tracks are written to the ESD event if (!fFeeParam->GetTracklet()) return kFALSE; @@ -196,9 +196,9 @@ Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) delete fTMU; fTMU = 0x0; } - + TList *listOfTracks = new TList(); - + TIter next(fTrackletArray); AliTRDtrackletBase *trkl; @@ -228,7 +228,7 @@ Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) if (fTMU) fTMU->AddTracklet(trkl, iLink); } - + if (fTMU) { fTMU->SetStack(iStackPrev); fTMU->SetSector(iSecPrev); @@ -247,7 +247,7 @@ Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) return kTRUE; } -Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *const loader) +Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *const loader) { // load the tracklets using the given loader @@ -285,7 +285,7 @@ Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *const loader) fTrackletArray = new TClonesArray("AliTRDtrackletMCM", 1000); } - AliTRDtrackletMCM *trkl = new AliTRDtrackletMCM; + AliTRDtrackletMCM *trkl = new AliTRDtrackletMCM; trklbranch->SetAddress(&trkl); for (Int_t iTracklet = 0; iTracklet < trklbranch->GetEntries(); iTracklet++) { trklbranch->GetEntry(iTracklet); @@ -309,8 +309,8 @@ Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *const loader) delete fTrackletArray; fTrackletArray = new TClonesArray("AliTRDtrackletWord", 1000); } - - Int_t hc; + + Int_t hc; TClonesArray *ar = 0x0; trackletTree->SetBranchAddress("hc", &hc); trackletTree->SetBranchAddress("trkl", &ar); @@ -325,13 +325,13 @@ Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *const loader) } return kTRUE; } - + AliError("No raw tracklet tree found\n"); return kFALSE; } -Bool_t AliTRDgtuSim::WriteTracksToDataFile(TList *listOfTracks, Int_t event) +Bool_t AliTRDgtuSim::WriteTracksToDataFile(TList *listOfTracks, Int_t event) { // write the found tracks to a data file // used for comparison to VHDL simulation @@ -348,21 +348,21 @@ Bool_t AliTRDgtuSim::WriteTracksToDataFile(TList *listOfTracks, Int_t event) AliTRDtrackGTU *trk = (AliTRDtrackGTU*) listOfTracks->At(i); sm = trk->GetSector(); stack = trk->GetStack(); - fprintf(out, "1 %5i %2i %2i %3i %3i %3i %3i %3i %3i %3i %4i %f\n", event, sm, stack, trk->GetTrackletMask(), - trk->GetTrackletIndex(5), - trk->GetTrackletIndex(4), - trk->GetTrackletIndex(3), - trk->GetTrackletIndex(2), - trk->GetTrackletIndex(1), + fprintf(out, "1 %5i %2i %2i %3i %3i %3i %3i %3i %3i %3i %4i %f\n", event, sm, stack, trk->GetTrackletMask(), + trk->GetTrackletIndex(5), + trk->GetTrackletIndex(4), + trk->GetTrackletIndex(3), + trk->GetTrackletIndex(2), + trk->GetTrackletIndex(1), trk->GetTrackletIndex(0), - trk->GetPtInt(), + trk->GetPtInt(), trk->GetPt()); } fclose(out); return kTRUE; } -Bool_t AliTRDgtuSim::WriteTracksToTree(TList *listOfTracks, Int_t /*event*/) +Bool_t AliTRDgtuSim::WriteTracksToTree(TList *listOfTracks, Int_t /*event*/) { // write the tracks to the tree for intermediate storage @@ -371,7 +371,7 @@ Bool_t AliTRDgtuSim::WriteTracksToTree(TList *listOfTracks, Int_t /*event*/) if (!listOfTracks) return kFALSE; - if (listOfTracks->GetEntries() <= 0) + if (listOfTracks->GetEntries() <= 0) return kTRUE; if (!fTrackTree) { @@ -389,11 +389,11 @@ Bool_t AliTRDgtuSim::WriteTracksToTree(TList *listOfTracks, Int_t /*event*/) while ((trk = (AliTRDtrackGTU*) next())) { trk->CookLabel(); branch->SetAddress(&trk); - fTrackTree->Fill(); + fTrackTree->Fill(); } fTrackTree->ResetBranchAddress(branch); - return kTRUE; + return kTRUE; } Bool_t AliTRDgtuSim::WriteTreesToFile() const { @@ -409,7 +409,7 @@ Bool_t AliTRDgtuSim::WriteTreesToFile() const { return kTRUE; } -Bool_t AliTRDgtuSim::WriteTracksToESD(const TList * const listOfTracks, AliESDEvent *esd) +Bool_t AliTRDgtuSim::WriteTracksToESD(const TList * const listOfTracks, AliESDEvent *esd) { // fill the found tracks to the given ESD event @@ -450,12 +450,12 @@ Bool_t AliTRDgtuSim::WriteTracksToLoader(const TList * const listOfTracks) dl->MakeTree(); trackTree = dl->Tree(); } - + AliTRDtrackGTU *trk = 0x0; if (!trackTree->GetBranch("TRDtrackGTU")) trackTree->Branch("TRDtrackGTU", "AliTRDtrackGTU", &trk, 32000); - + TIter next(listOfTracks); while ((trk = (AliTRDtrackGTU*) next())) { trackTree->SetBranchAddress("TRDtrackGTU", &trk); diff --git a/TRD/AliTRDgtuSim.h b/TRD/AliTRDgtuSim.h index 6124b46b173..d100059f6bf 100644 --- a/TRD/AliTRDgtuSim.h +++ b/TRD/AliTRDgtuSim.h @@ -6,7 +6,7 @@ /* $Id: AliTRDgtuSim.h 27496 2008-07-22 08:35:45Z cblume $ */ // -------------------------------------------------------- -// +// // GTU simulation // // -------------------------------------------------------- @@ -33,7 +33,7 @@ class AliTRDgtuSim : public TObject { Bool_t RunGTUFromTrackletFile(TString filename, Int_t event, Int_t noev = 1); TTree* GetTreeOfTracks() { return fTrackTree; } - Bool_t WriteTracksToTree(TList *listOfTracks, Int_t event = 0); + Bool_t WriteTracksToTree(TList *listOfTracks, Int_t event = 0); Bool_t WriteTracksToDataFile(TList *listOfTracks, Int_t event); Bool_t WriteTreesToFile() const; Bool_t WriteTracksToESD(const TList *const listOfTracks, AliESDEvent *esd); diff --git a/TRD/AliTRDgtuTMU.cxx b/TRD/AliTRDgtuTMU.cxx index 5378f4d59d6..00e4825adf9 100644 --- a/TRD/AliTRDgtuTMU.cxx +++ b/TRD/AliTRDgtuTMU.cxx @@ -63,13 +63,13 @@ AliTRDgtuTMU::AliTRDgtuTMU(Int_t stack, Int_t sector) : for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) { fTracks[zch] = new TList[fGtuParam->GetNRefLayers()]; } - if (stack > -1) + if (stack > -1) SetStack(stack); if (sector > -1) SetSector(sector); } -AliTRDgtuTMU::~AliTRDgtuTMU() +AliTRDgtuTMU::~AliTRDgtuTMU() { // destructor @@ -78,7 +78,7 @@ AliTRDgtuTMU::~AliTRDgtuTMU() } delete [] fTracks; for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { - fTracklets[layer]->Delete(); + fTracklets[layer]->Delete(); delete [] fZChannelTracklets[layer]; delete fTracklets[layer]; } @@ -91,7 +91,7 @@ Bool_t AliTRDgtuTMU::SetSector(Int_t sector) // set the sector if (sector > -1 && sector < fGtuParam->GetGeo()->Nsector() ) { - fSector = sector; + fSector = sector; return kTRUE; } @@ -99,7 +99,7 @@ Bool_t AliTRDgtuTMU::SetSector(Int_t sector) return kFALSE; } -Bool_t AliTRDgtuTMU::SetStack(Int_t stack) +Bool_t AliTRDgtuTMU::SetStack(Int_t stack) { // Set the stack (necessary for tracking) @@ -112,7 +112,7 @@ Bool_t AliTRDgtuTMU::SetStack(Int_t stack) return kFALSE; } -Bool_t AliTRDgtuTMU::Reset() +Bool_t AliTRDgtuTMU::Reset() { // delete all tracks @@ -135,17 +135,17 @@ Bool_t AliTRDgtuTMU::Reset() return kTRUE; } -Bool_t AliTRDgtuTMU::AddTracklet(AliTRDtrackletBase *tracklet, Int_t link) +Bool_t AliTRDgtuTMU::AddTracklet(AliTRDtrackletBase *tracklet, Int_t link) { // add a tracklet on the given link - AliTRDtrackletGTU *trkl = new AliTRDtrackletGTU(tracklet); + AliTRDtrackletGTU *trkl = new AliTRDtrackletGTU(tracklet); fTracklets[(Int_t) link/2]->Add(trkl); return kTRUE; } -Bool_t AliTRDgtuTMU::RunTMU(TList *ListOfTracks, AliESDEvent *esd) +Bool_t AliTRDgtuTMU::RunTMU(TList *ListOfTracks, AliESDEvent *esd) { // performs the analysis as in a TMU module of the GTU, i. e. // track matching @@ -183,7 +183,7 @@ Bool_t AliTRDgtuTMU::RunTMU(TList *ListOfTracks, AliESDEvent *esd) AliError(Form("Track Finder in z-channel %i failed", zch)); return kFALSE; } - } + } // ----- Track Merging ----- if (!RunTrackMerging(ListOfTracks)) { @@ -209,7 +209,7 @@ Bool_t AliTRDgtuTMU::RunTMU(TList *ListOfTracks, AliESDEvent *esd) return kTRUE; } -Bool_t AliTRDgtuTMU::RunInputUnit(Int_t layer) +Bool_t AliTRDgtuTMU::RunInputUnit(Int_t layer) { // precalculations for the tracking and reconstruction @@ -219,7 +219,7 @@ Bool_t AliTRDgtuTMU::RunInputUnit(Int_t layer) while ( AliTRDtrackletGTU *trk = (AliTRDtrackletGTU*) next() ) { trk->SetIndex(fTracklets[layer]->IndexOf(trk)); - Int_t alpha = (trk->GetYbin() >> fGtuParam->GetBitExcessY()) * fGtuParam->GetCiAlpha(layer); + Int_t alpha = (trk->GetYbin() >> fGtuParam->GetBitExcessY()) * fGtuParam->GetCiAlpha(layer); alpha = ( 2 * trk->GetdY() - (alpha >> fGtuParam->GetBitExcessAlpha()) + 1 ) >> 1; trk->SetAlpha(alpha); @@ -229,13 +229,13 @@ Bool_t AliTRDgtuTMU::RunInputUnit(Int_t layer) trk->SetYPrime(trk->GetYbin() + fGtuParam->GetYt(fStack, layer, trk->GetZbin())); - AliDebug(10, Form("InputUnit : GetIndex(): %3i, GetZbin(): %2i, GetY() : %5i, GetdY() : %3i, GetYPrime() : %5i, GetYProj() : %5i, GetAlpha() : %3i", + AliDebug(10, Form("InputUnit : GetIndex(): %3i, GetZbin(): %2i, GetY() : %5i, GetdY() : %3i, GetYPrime() : %5i, GetYProj() : %5i, GetAlpha() : %3i", trk->GetIndex(), trk->GetZbin(), trk->GetYbin(), trk->GetdY(), trk->GetYPrime(), trk->GetYProj(), trk->GetAlpha() )); } return kTRUE; } -Bool_t AliTRDgtuTMU::RunZChannelUnit(Int_t layer) +Bool_t AliTRDgtuTMU::RunZChannelUnit(Int_t layer) { // run the z-channel unit @@ -251,13 +251,13 @@ Bool_t AliTRDgtuTMU::RunZChannelUnit(Int_t layer) TIter nexttrkl(&fZChannelTracklets[layer][zch], kIterBackward); AliTRDtrackletGTU *t = 0x0; while ((t = (AliTRDtrackletGTU*) nexttrkl.Next())) { - if (t->GetSubChannel(zch) < trk->GetSubChannel(zch) || + if (t->GetSubChannel(zch) < trk->GetSubChannel(zch) || (t->GetSubChannel(zch) == trk->GetSubChannel(zch) && t->GetYProj() < trk->GetYProj()) ) break; } fZChannelTracklets[layer][zch].AddAfter(t, trk); } -// else +// else // printf(" "); } // printf("\n"); @@ -265,7 +265,7 @@ Bool_t AliTRDgtuTMU::RunZChannelUnit(Int_t layer) return kTRUE; } -Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) +Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) { // run the track finding @@ -273,7 +273,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) Int_t *ptrA = new Int_t[fGtuParam->GetNLayers()]; Int_t *ptrB = new Int_t[fGtuParam->GetNLayers()]; - Bool_t *bHitA = new Bool_t[fGtuParam->GetNLayers()]; + Bool_t *bHitA = new Bool_t[fGtuParam->GetNLayers()]; Bool_t *bHitB = new Bool_t[fGtuParam->GetNLayers()]; Bool_t *bAligned = new Bool_t[fGtuParam->GetNLayers()]; Bool_t *bAlignedA = new Bool_t[fGtuParam->GetNLayers()]; @@ -286,13 +286,13 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) // ----- signals within current layer ----- Int_t yPlus; - Int_t yMinus; - Int_t ybPlus; + Int_t yMinus; + Int_t ybPlus; Int_t ybMinus; Int_t alphaPlus; - Int_t alphaMinus; + Int_t alphaMinus; Int_t nHits; - Int_t nUnc; + Int_t nUnc; Int_t nWayBeyond; AliTRDtrackletGTU *trkRA = 0x0; // reference tracklet A @@ -301,7 +301,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) AliTRDtrackletGTU *trkB = 0x0; // tracklet B in current layer /* AliTRDtrackletGTU *trkEnd = new AliTRDtrackletGTU(); - for (Int_t i = 0; i < fGtuParam->GetNZChannels(); i++) + for (Int_t i = 0; i < fGtuParam->GetNZChannels(); i++) trkEnd->SetSubChannel(i, 7); trkEnd->SetYProj(0); trkEnd->SetAlpha(0); @@ -326,8 +326,8 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) if (reflayer == 1) AliDebug(5,Form("in layer: %i (zchannel = %i) there are: %i tracklets", layer, zch, notr[layer])); } - - if (ptrA[reflayer] < 0 && ptrB[reflayer] < 0) + + if (ptrA[reflayer] < 0 && ptrB[reflayer] < 0) continue; while (!ready) { @@ -338,7 +338,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) trkRA = (AliTRDtrackletGTU*) fZChannelTracklets[reflayer][zch].At(ptrA[reflayer]); else { AliDebug(10,Form("No valid tracklet in the reference at ptr: %i! Nothing done!", ptrA[reflayer])); - break; + break; } if (0 <= ptrB[reflayer] && ptrB[reflayer] < notr[reflayer]) @@ -361,7 +361,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) nHits = 0; nUnc = 0; nWayBeyond = 0; - + for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { bHitA[layer] = bHitB[layer] = bAligned[layer] = kFALSE; inc[layer] = incprime[layer] = 0; @@ -370,7 +370,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) bHitA[layer] = kTRUE; bAligned[layer] = kTRUE; nHits++; - continue; + continue; } trkA = 0x0; @@ -383,12 +383,12 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) bAlignedA[layer] = kFALSE; bAlignedB[layer] = kFALSE; - if (trkA) { + if (trkA) { bHitA[layer] = ( !(trkA->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() < yMinus) ) && !(trkA->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() > yPlus) ) && !(trkA->GetAlpha() < alphaMinus) && !(trkA->GetAlpha() > alphaPlus) ); - bAlignedA[layer] = !(trkA->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() < yMinus) ); + bAlignedA[layer] = !(trkA->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() < yMinus) ); } else { bHitA[layer] = 0; @@ -401,15 +401,15 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) !(alphaMinus > trkB->GetAlpha()) && !(alphaPlus > trkB->GetAlpha()) ); bAlignedB[layer] = (trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > yPlus) ); - } + } else { bHitB[layer] = 0; bAlignedB[layer] = kTRUE; } - + bAligned[layer] = bAlignedA[layer] || bAlignedB[layer]; //??? // bAligned[layer] = bAlignedA[layer]; //??? - + if (bAligned[layer] && (bHitA[layer] || bHitB[layer]) ) nHits++; else if (!bAligned[layer] ) @@ -419,7 +419,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) if ((trkA->GetSubChannel(zch) > trkRB->GetSubChannel(zch)) || (trkA->GetSubChannel(zch) == trkRB->GetSubChannel(zch) && trkA->GetYProj() > ybPlus) ) nWayBeyond++; } - else + else nWayBeyond++; } @@ -428,18 +428,18 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) if(trkRB) { if ((trkA->GetSubChannel(zch) < trkRB->GetSubChannel(zch)) || (trkA->GetSubChannel(zch) == trkRB->GetSubChannel(zch) && trkA->GetYProj() < ybMinus )) // could trkA be aligned for trkRB incprime[layer] = 1; - else + else incprime[layer] = 0; } - else + else incprime[layer] = 1; - if (trkB) { + if (trkB) { if (trkRB) { if ((trkB->GetSubChannel(zch) < trkRB->GetSubChannel(zch)) || (trkB->GetSubChannel(zch) == trkRB->GetSubChannel(zch) && trkB->GetYProj() < ybMinus )) // could trkB be aligned for trkRB incprime[layer] = 2; } - else + else incprime[layer] = 2; } } @@ -454,9 +454,9 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) track->SetSector(fSector); track->SetStack(fStack); for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++ ) { - if (bHitA[layer] || layer == reflayer) + if (bHitA[layer] || layer == reflayer) track->AddTracklet((AliTRDtrackletGTU* ) fZChannelTracklets[layer][zch].At(ptrA[layer]), layer ); - else if (bHitB[layer]) + else if (bHitB[layer]) track->AddTracklet((AliTRDtrackletGTU* ) fZChannelTracklets[layer][zch].At(ptrB[layer]), layer ); } @@ -475,19 +475,19 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) fTracks[zch][refLayerIdx].Add(track); } } - + if ( (nUnc != 0) && (nUnc + nHits >= 4) ) // could this position of the reference layer give some track //??? special check in case of hit? inc[reflayer] = 0; else if (nWayBeyond > 2) // no track possible for both reference tracklets inc[reflayer] = 2; - else + else inc[reflayer] = 1; - + if (inc[reflayer] != 0) // reflayer is shifted for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { if (layer == reflayer) continue; - inc[layer] = incprime[layer]; + inc[layer] = incprime[layer]; } else { // reflayer is not shifted for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { @@ -503,7 +503,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) trkB = (AliTRDtrackletGTU*) fZChannelTracklets[layer][zch].At(ptrB[layer]); if (trkA) { - if ( !(trkA->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() < yMinus) ) && + if ( !(trkA->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() < yMinus) ) && !(trkA->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() > yPlus ) ) ) // trkA could hit trkRA inc[layer] = 0; else if (trkB) { @@ -511,15 +511,15 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) inc[layer] = 2; else if ( !(trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > yPlus) ) ) inc[layer] = 1; - else + else inc[layer] = incprime[layer]; } - else + else inc[layer] = incprime[layer]; } } } - + ready = kTRUE; for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { @@ -553,7 +553,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) return kTRUE; } -Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) +Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) { TList **tracksRefMerged = new TList*[fGtuParam->GetNZChannels()]; TList **tracksRefUnique = new TList*[fGtuParam->GetNZChannels()]; @@ -593,7 +593,7 @@ Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) minIdx = refLayerIdx; done = kFALSE; } - else if (trkInRefLayer[refLayerIdx]->GetZSubChannel() < trkStage0->GetZSubChannel() || + else if (trkInRefLayer[refLayerIdx]->GetZSubChannel() < trkStage0->GetZSubChannel() || (trkInRefLayer[refLayerIdx]->GetZSubChannel() == trkStage0->GetZSubChannel() && trkInRefLayer[refLayerIdx]->GetYapprox() < trkStage0->GetYapprox()) ) { minIdx = refLayerIdx; trkStage0 = trkInRefLayer[refLayerIdx]; @@ -610,7 +610,7 @@ Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) } // ----- Merging in zchannels - 1st stage ----- - + do { done = kTRUE; trkStage0 = 0x0; @@ -630,24 +630,24 @@ Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) done = kFALSE; } } - + if (!trkStage0) break; tracksZMergedStage0->Add(trkStage0); tracksRefUnique[minIdx]->RemoveFirst(); } while (trkStage0 != 0); - + Uniquifier(tracksZMergedStage0, tracksZUniqueStage0); - + // ----- Splitting in z ----- - + TIter next(tracksZUniqueStage0); while (AliTRDtrackGTU *trk = (AliTRDtrackGTU*) next()) { tracksZSplitted[(trk->GetZChannel() + 3 * (trk->GetZSubChannel() - 1)) % 2]->Add(trk); } - + // ----- Merging in zchanels - 2nd stage ----- - + do { done = kTRUE; trkStage0 = 0x0; @@ -667,16 +667,16 @@ Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) done = kFALSE; } } - + if (!trkStage0) break; tracksZMergedStage1->Add(trkStage0); tracksZSplitted[minIdx]->RemoveFirst(); } while (trkStage0 != 0); - + Uniquifier(tracksZMergedStage1, ListOfTracks); - - // cleaning up + + // cleaning up for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) { delete tracksRefMerged[zch]; delete tracksRefUnique[zch]; @@ -699,7 +699,7 @@ Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) return kTRUE; } -Bool_t AliTRDgtuTMU::RunTrackReconstruction(TList* ListOfTracks) +Bool_t AliTRDgtuTMU::RunTrackReconstruction(TList* ListOfTracks) { // run the track reconstruction for all tracks in the list @@ -733,7 +733,7 @@ Bool_t AliTRDgtuTMU::CalculatePID(AliTRDtrackGTU *track) return kTRUE; } -Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track) +Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track) { // calculate the track parameters @@ -760,7 +760,7 @@ Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track) continue; } AliDebug(10,Form("trk yprime: %i", trk->GetYPrime())); - a += (((Int_t) (2048 * fGtuParam->GetAki(track->GetTrackletMask(), layer))) * trk->GetYPrime() + 1) >> 8; + a += (((Int_t) (2048 * fGtuParam->GetAki(track->GetTrackletMask(), layer))) * trk->GetYPrime() + 1) >> 8; b += fGtuParam->GetBki(track->GetTrackletMask(), layer) * trk->GetYPrime() * fGtuParam->GetBinWidthY(); c += fGtuParam->GetCki(track->GetTrackletMask(), layer) * trk->GetYPrime() * fGtuParam->GetBinWidthY(); } @@ -775,7 +775,7 @@ Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track) Float_t r = fGtuParam->GetPt(a, b, x1, x2); Int_t pt = (Int_t) (2 * r); - if (pt >= 0) + if (pt >= 0) pt += 32; else pt -= 29; @@ -833,13 +833,13 @@ Bool_t AliTRDgtuTMU::Uniquifier(TList *inlist, TList *outlist) if (tracksEqual) { if (trkStage0->GetNTracklets() > trkStage1->GetNTracklets()) trkStage1 = trkStage0; - } + } else { - if (trkStage1 != 0x0) + if (trkStage1 != 0x0) outlist->Add(trkStage1); trkStage1 = trkStage0; - } - + } + } while (trkStage1 != 0x0); return kTRUE; } diff --git a/TRD/AliTRDgtuTMU.h b/TRD/AliTRDgtuTMU.h index cefb1727b3a..2307dec2da6 100644 --- a/TRD/AliTRDgtuTMU.h +++ b/TRD/AliTRDgtuTMU.h @@ -40,10 +40,10 @@ class AliTRDgtuTMU : public TObject { Bool_t RunInputUnit(Int_t layer); Bool_t RunZChannelUnit(Int_t layer); Bool_t RunTrackFinder(Int_t zchannel, TList* ListOfTracks); - Bool_t RunTrackMerging(TList* ListOfTracks); + Bool_t RunTrackMerging(TList* ListOfTracks); Bool_t RunTrackReconstruction(TList* ListOfTracks); - Bool_t CalculateTrackParams(AliTRDtrackGTU *track); + Bool_t CalculateTrackParams(AliTRDtrackGTU *track); Bool_t Uniquifier(TList* inlist, TList *outlist); Bool_t CalculatePID(AliTRDtrackGTU *track); diff --git a/TRD/AliTRDmcmSim.cxx b/TRD/AliTRDmcmSim.cxx index 247dee10703..ac667e938f4 100644 --- a/TRD/AliTRDmcmSim.cxx +++ b/TRD/AliTRDmcmSim.cxx @@ -54,13 +54,13 @@ ClassImp(AliTRDmcmSim) Bool_t AliTRDmcmSim::fgApplyCut = kTRUE; Int_t AliTRDmcmSim::fgAddBaseline = 0; -const Int_t AliTRDmcmSim::fgkFormatIndex = std::ios_base::xalloc(); +const Int_t AliTRDmcmSim::fgkFormatIndex = std::ios_base::xalloc(); const Int_t AliTRDmcmSim::fgkNADC = AliTRDfeeParam::GetNadcMcm(); -const UShort_t AliTRDmcmSim::fgkFPshifts[4] = {11, 14, 17, 21}; +const UShort_t AliTRDmcmSim::fgkFPshifts[4] = {11, 14, 17, 21}; -AliTRDmcmSim::AliTRDmcmSim() : +AliTRDmcmSim::AliTRDmcmSim() : TObject(), fInitialized(kFALSE), fDetector(-1), @@ -99,7 +99,7 @@ AliTRDmcmSim::AliTRDmcmSim() : fFitPtr[3] = 0; } -AliTRDmcmSim::~AliTRDmcmSim() +AliTRDmcmSim::~AliTRDmcmSim() { // // AliTRDmcmSim destructor @@ -114,26 +114,26 @@ AliTRDmcmSim::~AliTRDmcmSim() delete [] fADCF; delete [] fZSMap; delete [] fMCMT; - + delete [] fPedAcc; delete [] fGainCounterA; delete [] fGainCounterB; delete [] fTailAmplLong; delete [] fTailAmplShort; delete [] fFitReg; - + fTrackletArray->Delete(); delete fTrackletArray; } } -void AliTRDmcmSim::Init( Int_t det, Int_t robPos, Int_t mcmPos, Bool_t /* newEvent */ ) +void AliTRDmcmSim::Init( Int_t det, Int_t robPos, Int_t mcmPos, Bool_t /* newEvent */ ) { // // Initialize the class with new MCM position information // memory is allocated in the first initialization // - + if (!fInitialized) { fFeeParam = AliTRDfeeParam::Instance(); fTrapConfig = AliTRDtrapConfig::Instance(); @@ -144,7 +144,7 @@ void AliTRDmcmSim::Init( Int_t det, Int_t robPos, Int_t mcmPos, Bool_t /* newEve fMcmPos = mcmPos; fNTimeBin = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kC13CPUA); fRow = fFeeParam->GetPadRowFromMCM( fRobPos, fMcmPos ); - + if (!fInitialized) { fADCR = new Int_t *[fgkNADC]; fADCF = new Int_t *[fgkNADC]; @@ -155,16 +155,16 @@ void AliTRDmcmSim::Init( Int_t det, Int_t robPos, Int_t mcmPos, Bool_t /* newEve fADCR[iAdc] = new Int_t[fNTimeBin]; fADCF[iAdc] = new Int_t[fNTimeBin]; } - + // filter registers fPedAcc = new UInt_t[fgkNADC]; // accumulator for pedestal filter fTailAmplLong = new UShort_t[fgkNADC]; fTailAmplShort = new UShort_t[fgkNADC]; - + // tracklet calculation - fFitReg = new FitReg_t[fgkNADC]; + fFitReg = new FitReg_t[fgkNADC]; fTrackletArray = new TClonesArray("AliTRDtrackletMCM", fgkMaxTracklets); - + fMCMT = new UInt_t[fgkMaxTracklets]; } @@ -178,7 +178,7 @@ void AliTRDmcmSim::Reset() // Resets the data values and internal filter registers // by re-initialising them - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; for( Int_t iAdc = 0 ; iAdc < fgkNADC; iAdc++ ) { @@ -190,25 +190,25 @@ void AliTRDmcmSim::Reset() fGainCounterA[iAdc] = 0; fGainCounterB[iAdc] = 0; } - + for(Int_t i = 0; i < fgkMaxTracklets; i++) { fMCMT[i] = 0; } for (Int_t iDict = 0; iDict < 3; iDict++) fDict[iDict] = 0x0; - + FilterPedestalInit(); FilterGainInit(); FilterTailInit(); } -void AliTRDmcmSim::SetNTimebins(Int_t ntimebins) +void AliTRDmcmSim::SetNTimebins(Int_t ntimebins) { - // Reallocate memory if a change in the number of timebins + // Reallocate memory if a change in the number of timebins // is needed (should not be the case for real data) - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; fNTimeBin = ntimebins; @@ -220,11 +220,11 @@ void AliTRDmcmSim::SetNTimebins(Int_t ntimebins) } } -Bool_t AliTRDmcmSim::LoadMCM(AliRunLoader* const runloader, Int_t det, Int_t rob, Int_t mcm) +Bool_t AliTRDmcmSim::LoadMCM(AliRunLoader* const runloader, Int_t det, Int_t rob, Int_t mcm) { // loads the ADC data as obtained from the digitsManager for the specified MCM. - // This method is meant for rare execution, e.g. in the visualization. When called - // frequently use SetData(...) instead. + // This method is meant for rare execution, e.g. in the visualization. When called + // frequently use SetData(...) instead. Init(det, rob, mcm); @@ -257,35 +257,35 @@ Bool_t AliTRDmcmSim::LoadMCM(AliRunLoader* const runloader, Int_t det, Int_t rob SetData(digits); } - else + else retval = kFALSE; - + delete digMgr; - + return retval; } void AliTRDmcmSim::NoiseTest(Int_t nsamples, Int_t mean, Int_t sigma, Int_t inputGain, Int_t inputTail) { - // This function can be used to test the filters. + // This function can be used to test the filters. // It feeds nsamples of ADC values with a gaussian distribution specified by mean and sigma. // The filter chain implemented here consists of: // Pedestal -> Gain -> Tail - // With inputGain and inputTail the input to the gain and tail filter, respectively, - // can be chosen where + // With inputGain and inputTail the input to the gain and tail filter, respectively, + // can be chosen where // 0: noise input // 1: pedestal output // 2: gain output - // The input has to be chosen from a stage before. - // The filter behaviour is controlled by the TRAP parameters from AliTRDtrapConfig in the + // The input has to be chosen from a stage before. + // The filter behaviour is controlled by the TRAP parameters from AliTRDtrapConfig in the // same way as in normal simulation. // The functions produces four histograms with the values at the different stages. - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; TString nameInputGain; - TString nameInputTail; + TString nameInputTail; switch (inputGain) { case 0: @@ -322,46 +322,46 @@ void AliTRDmcmSim::NoiseTest(Int_t nsamples, Int_t mean, Int_t sigma, Int_t inpu TH1F *h = new TH1F("noise", "Gaussian Noise;sample;ADC count", nsamples, 0, nsamples); TH1F *hfp = new TH1F("ped", "Noise #rightarrow Pedestal filter;sample;ADC count", nsamples, 0, nsamples); - TH1F *hfg = new TH1F("gain", - (nameInputGain + "#rightarrow Gain;sample;ADC count").Data(), + TH1F *hfg = new TH1F("gain", + (nameInputGain + "#rightarrow Gain;sample;ADC count").Data(), nsamples, 0, nsamples); - TH1F *hft = new TH1F("tail", - (nameInputTail + "#rightarrow Tail;sample;ADC count").Data(), + TH1F *hft = new TH1F("tail", + (nameInputTail + "#rightarrow Tail;sample;ADC count").Data(), nsamples, 0, nsamples); h->SetStats(kFALSE); hfp->SetStats(kFALSE); hfg->SetStats(kFALSE); hft->SetStats(kFALSE); - + Int_t value; // ADC count with noise (10 bit) Int_t valuep; // pedestal filter output (12 bit) Int_t valueg; // gain filter output (12 bit) Int_t valuet; // tail filter value (12 bit) - + for (Int_t i = 0; i < nsamples; i++) { - value = (Int_t) gRandom->Gaus(mean, sigma); // generate noise with gaussian distribution + value = (Int_t) gRandom->Gaus(mean, sigma); // generate noise with gaussian distribution h->SetBinContent(i, value); valuep = FilterPedestalNextSample(1, 0, ((Int_t) value) << 2); - + if (inputGain == 0) valueg = FilterGainNextSample(1, ((Int_t) value) << 2); - else - valueg = FilterGainNextSample(1, valuep); - + else + valueg = FilterGainNextSample(1, valuep); + if (inputTail == 0) valuet = FilterTailNextSample(1, ((Int_t) value) << 2); else if (inputTail == 1) - valuet = FilterTailNextSample(1, valuep); + valuet = FilterTailNextSample(1, valuep); else - valuet = FilterTailNextSample(1, valueg); + valuet = FilterTailNextSample(1, valueg); hfp->SetBinContent(i, valuep >> 2); hfg->SetBinContent(i, valueg >> 2); hft->SetBinContent(i, valuet >> 2); } - TCanvas *c = new TCanvas; + TCanvas *c = new TCanvas; c->Divide(2,2); c->cd(1); h->Draw(); @@ -379,7 +379,7 @@ Bool_t AliTRDmcmSim::CheckInitialized() const // Check whether object is initialized // - if( ! fInitialized ) + if( ! fInitialized ) AliError(Form ("AliTRDmcmSim is not initialized but function other than Init() is called.")); return fInitialized; @@ -388,16 +388,16 @@ Bool_t AliTRDmcmSim::CheckInitialized() const void AliTRDmcmSim::Print(Option_t* const option) const { // Prints the data stored and/or calculated for this MCM. - // The output is controlled by option which can be a sequence of any of + // The output is controlled by option which can be a sequence of any of // the following characters: // R - prints raw ADC data - // F - prints filtered data + // F - prints filtered data // H - prints detected hits // T - prints found tracklets - // The later stages are only meaningful after the corresponding calculations + // The later stages are only meaningful after the corresponding calculations // have been performed. - if ( !CheckInitialized() ) + if ( !CheckInitialized() ) return; printf("MCM %i on ROB %i in detector %i\n", fMcmPos, fRobPos, fDetector); @@ -423,18 +423,18 @@ void AliTRDmcmSim::Print(Option_t* const option) const } } -void AliTRDmcmSim::Draw(Option_t* const option) +void AliTRDmcmSim::Draw(Option_t* const option) { // Plots the data stored in a 2-dim. timebin vs. ADC channel plot. - // The option selects what data is plotted and can be a sequence of + // The option selects what data is plotted and can be a sequence of // the following characters: // R - plot raw data (default) // F - plot filtered data (meaningless if R is specified) // In addition to the ADC values: - // H - plot hits + // H - plot hits // T - plot tracklets - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; TString opt = option; @@ -465,8 +465,8 @@ void AliTRDmcmSim::Draw(Option_t* const option) if (opt.Contains("H")) { TGraph *grHits = new TGraph(); for (Int_t iHit = 0; iHit < fNHits; iHit++) { - grHits->SetPoint(iHit, - fHits[iHit].fChannel + 1 + fHits[iHit].fYpos/256., + grHits->SetPoint(iHit, + fHits[iHit].fChannel + 1 + fHits[iHit].fYpos/256., fHits[iHit].fTimebin); } grHits->Draw("*"); @@ -479,7 +479,7 @@ void AliTRDmcmSim::Draw(Option_t* const option) Float_t padWidth = 0.635 + 0.03 * (fDetector % 6); Float_t offset = padWidth/256. * ((((((fRobPos & 0x1) << 2) + (fMcmPos & 0x3)) * 18) << 8) - ((18*4*2 - 18*2 - 3) << 7)); // revert adding offset in FitTracklet Int_t ndrift = fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrNdrift, fDetector, fRobPos, fMcmPos) >> 5; - Float_t slope = trkl->GetdY() * 140e-4 / ndrift; + Float_t slope = trkl->GetdY() * 140e-4 / ndrift; Int_t t0 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFS); Int_t t1 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFE); @@ -536,7 +536,7 @@ void AliTRDmcmSim::SetData(AliTRDarrayADC* const adcArray, AliTRDdigitsManager * { // Set the ADC data from an AliTRDarrayADC - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; fDigitsManager = digitsManager; @@ -544,20 +544,20 @@ void AliTRDmcmSim::SetData(AliTRDarrayADC* const adcArray, AliTRDdigitsManager * for (Int_t iDict = 0; iDict < 3; iDict++) { AliTRDarrayDictionary *newDict = (AliTRDarrayDictionary*) fDigitsManager->GetDictionary(fDetector, iDict); if (fDict[iDict] != 0x0 && newDict != 0x0) { - + if (fDict[iDict] == newDict) continue; fDict[iDict] = newDict; - fDict[iDict]->Expand(); + fDict[iDict]->Expand(); } else { fDict[iDict] = newDict; if (fDict[iDict]) fDict[iDict]->Expand(); } - - // If there is no data, set dictionary to zero to avoid crashes + + // If there is no data, set dictionary to zero to avoid crashes if (fDict[iDict]->GetDim() == 0) { AliError(Form("Dictionary %i of det. %i has dim. 0", fDetector, iDict)); fDict[iDict] = 0x0; @@ -567,7 +567,7 @@ void AliTRDmcmSim::SetData(AliTRDarrayADC* const adcArray, AliTRDdigitsManager * if (fNTimeBin != adcArray->GetNtime()) SetNTimebins(adcArray->GetNtime()); - + Int_t offset = (fMcmPos % 4 + 1) * 21 + (fRobPos % 2) * 84 - 1; for (Int_t iTimeBin = 0; iTimeBin < fNTimeBin; iTimeBin++) { @@ -588,10 +588,10 @@ void AliTRDmcmSim::SetData(AliTRDarrayADC* const adcArray, AliTRDdigitsManager * void AliTRDmcmSim::SetDataByPad(AliTRDarrayADC* const adcArray, AliTRDdigitsManager * const digitsManager) { - // Set the ADC data from an AliTRDarrayADC + // Set the ADC data from an AliTRDarrayADC // (by pad, to be used during initial reading in simulation) - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; fDigitsManager = digitsManager; @@ -599,20 +599,20 @@ void AliTRDmcmSim::SetDataByPad(AliTRDarrayADC* const adcArray, AliTRDdigitsMana for (Int_t iDict = 0; iDict < 3; iDict++) { AliTRDarrayDictionary *newDict = (AliTRDarrayDictionary*) fDigitsManager->GetDictionary(fDetector, iDict); if (fDict[iDict] != 0x0 && newDict != 0x0) { - + if (fDict[iDict] == newDict) continue; fDict[iDict] = newDict; - fDict[iDict]->Expand(); + fDict[iDict]->Expand(); } else { fDict[iDict] = newDict; if (fDict[iDict]) fDict[iDict]->Expand(); } - - // If there is no data, set dictionary to zero to avoid crashes + + // If there is no data, set dictionary to zero to avoid crashes if (fDict[iDict]->GetDim() == 0) { AliError(Form("Dictionary %i of det. %i has dim. 0", fDetector, iDict)); fDict[iDict] = 0x0; @@ -622,14 +622,14 @@ void AliTRDmcmSim::SetDataByPad(AliTRDarrayADC* const adcArray, AliTRDdigitsMana if (fNTimeBin != adcArray->GetNtime()) SetNTimebins(adcArray->GetNtime()); - + Int_t offset = (fMcmPos % 4 + 1) * 18 + (fRobPos % 2) * 72 + 1; for (Int_t iTimeBin = 0; iTimeBin < fNTimeBin; iTimeBin++) { for (Int_t iAdc = 0; iAdc < fgkNADC; iAdc++) { Int_t value = -1; Int_t pad = offset - iAdc; - if (pad > -1 && pad < 144) + if (pad > -1 && pad < 144) value = adcArray->GetData(GetRow(), offset - iAdc, iTimeBin); // Int_t value = adcArray->GetDataByAdcCol(GetRow(), offset - iAdc, iTimeBin); if (value < 0 || (offset - iAdc < 1) || (offset - iAdc > 165)) { @@ -651,7 +651,7 @@ void AliTRDmcmSim::SetDataPedestal( Int_t adc ) // Store ADC data into array of raw data // - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; if( adc < 0 || adc >= fgkNADC ) { @@ -670,13 +670,13 @@ Bool_t AliTRDmcmSim::GetHit(Int_t index, Int_t &channel, Int_t &timebin, Int_t & if (index < 0 || index >= fNHits) return kFALSE; - + channel = fHits[index].fChannel; timebin = fHits[index].fTimebin; qtot = fHits[index].fQtot; ypos = fHits[index].fYpos; y = (Float_t) ((((((fRobPos & 0x1) << 2) + (fMcmPos & 0x3)) * 18) << 8) - ((18*4*2 - 18*2 - 1) << 7) - - (channel << 8) - ypos) + (channel << 8) - ypos) * (0.635 + 0.03 * (fDetector % 6)) / 256.0; label = fHits[index].fLabel[0]; @@ -690,13 +690,13 @@ Int_t AliTRDmcmSim::GetCol( Int_t adc ) // Return column id of the pad for the given ADC channel // - if( !CheckInitialized() ) + if( !CheckInitialized() ) return -1; Int_t col = fFeeParam->GetPadColFromADC(fRobPos, fMcmPos, adc); - if (col < 0 || col >= fFeeParam->GetNcol()) + if (col < 0 || col >= fFeeParam->GetNcol()) return -1; - else + else return col; } @@ -704,11 +704,11 @@ Int_t AliTRDmcmSim::ProduceRawStream( UInt_t *buf, Int_t bufSize, UInt_t iEv) co { // // Produce raw data stream from this MCM and put in buf - // Returns number of words filled, or negative value + // Returns number of words filled, or negative value // with -1 * number of overflowed words // - if( !CheckInitialized() ) + if( !CheckInitialized() ) return 0; UInt_t x; @@ -720,14 +720,14 @@ Int_t AliTRDmcmSim::ProduceRawStream( UInt_t *buf, Int_t bufSize, UInt_t iEv) co Int_t **adc; Int_t nActiveADC = 0; // number of activated ADC bits in a word - if( !CheckInitialized() ) + if( !CheckInitialized() ) return 0; if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBSF) != 0) // store unfiltered data adc = fADCR; - else + else adc = fADCF; - + // Produce ADC mask : nncc cccm mmmm mmmm mmmm mmmm mmmm 1100 // n : unused , c : ADC count, m : selected ADCs if( rawVer >= 3 && @@ -791,26 +791,26 @@ Int_t AliTRDmcmSim::ProduceTrackletStream( UInt_t *buf, Int_t bufSize ) { // // Produce tracklet data stream from this MCM and put in buf - // Returns number of words filled, or negative value + // Returns number of words filled, or negative value // with -1 * number of overflowed words // - if( !CheckInitialized() ) + if( !CheckInitialized() ) return 0; Int_t nw = 0; // Number of written words Int_t of = 0; // Number of overflowed words - - // Produce tracklet data. A maximum of four 32 Bit words will be written per MCM + + // Produce tracklet data. A maximum of four 32 Bit words will be written per MCM // fMCMT is filled continuously until no more tracklet words available for (Int_t iTracklet = 0; iTracklet < fTrackletArray->GetEntriesFast(); iTracklet++) { - if (nw < bufSize) + if (nw < bufSize) buf[nw++] = ((AliTRDtrackletMCM*) (*fTrackletArray)[iTracklet])->GetTrackletWord(); - else + else of++; } - + if( of != 0 ) return -of; else return nw; } @@ -819,20 +819,20 @@ void AliTRDmcmSim::Filter() // // Filter the raw ADC values. The active filter stages and their // parameters are taken from AliTRDtrapConfig. - // The raw data is stored separate from the filtered data. Thus, - // it is possible to run the filters on a set of raw values + // The raw data is stored separate from the filtered data. Thus, + // it is possible to run the filters on a set of raw values // sequentially for parameter tuning. // - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; // Apply filters sequentially. Bypass is handled by filters - // since counters and internal registers may be updated even + // since counters and internal registers may be updated even // if the filter is bypassed. - // The first filter takes the data from fADCR and - // outputs to fADCF. - + // The first filter takes the data from fADCR and + // outputs to fADCF. + // Non-linearity filter not implemented. FilterPedestal(); FilterGain(); @@ -840,21 +840,21 @@ void AliTRDmcmSim::Filter() // Crosstalk filter not implemented. } -void AliTRDmcmSim::FilterPedestalInit(Int_t baseline) +void AliTRDmcmSim::FilterPedestalInit(Int_t baseline) { - // Initializes the pedestal filter assuming that the input has + // Initializes the pedestal filter assuming that the input has // been constant for a long time (compared to the time constant). UShort_t fptc = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kFPTC); // 0..3, 0 - fastest, 3 - slowest for (Int_t iAdc = 0; iAdc < fgkNADC; iAdc++) - fPedAcc[iAdc] = (baseline << 2) * (1 << fgkFPshifts[fptc]); + fPedAcc[iAdc] = (baseline << 2) * (1 << fgkFPshifts[fptc]); } UShort_t AliTRDmcmSim::FilterPedestalNextSample(Int_t adc, Int_t timebin, UShort_t value) { // Returns the output of the pedestal filter given the input value. - // The output depends on the internal registers and, thus, the + // The output depends on the internal registers and, thus, the // history of the filter. UShort_t fpnp = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kFPNP); // 0..511 -> 0..127.75, pedestal at the output @@ -864,7 +864,7 @@ UShort_t AliTRDmcmSim::FilterPedestalNextSample(Int_t adc, Int_t timebin, UShort UShort_t accumulatorShifted; Int_t correction; UShort_t inpAdd; - + inpAdd = value + fpnp; accumulatorShifted = (fPedAcc[adc] >> fgkFPshifts[fptc]) & 0x3FF; // 10 bits @@ -873,7 +873,7 @@ UShort_t AliTRDmcmSim::FilterPedestalNextSample(Int_t adc, Int_t timebin, UShort correction = (value & 0x3FF) - accumulatorShifted; fPedAcc[adc] = (fPedAcc[adc] + correction) & 0x7FFFFFFF; // 31 bits } - + if (fpby == 0) return value; @@ -882,9 +882,9 @@ UShort_t AliTRDmcmSim::FilterPedestalNextSample(Int_t adc, Int_t timebin, UShort else { inpAdd = inpAdd - accumulatorShifted; - if (inpAdd > 0xFFF) + if (inpAdd > 0xFFF) return 0xFFF; - else + else return inpAdd; } } @@ -894,10 +894,10 @@ void AliTRDmcmSim::FilterPedestal() // // Apply pedestal filter // - // As the first filter in the chain it reads data from fADCR - // and outputs to fADCF. - // It has only an effect if previous samples have been fed to - // find the pedestal. Currently, the simulation assumes that + // As the first filter in the chain it reads data from fADCR + // and outputs to fADCF. + // It has only an effect if previous samples have been fed to + // find the pedestal. Currently, the simulation assumes that // the input has been stable for a sufficiently long time. for (Int_t iTimeBin = 0; iTimeBin < fNTimeBin; iTimeBin++) { @@ -909,11 +909,11 @@ void AliTRDmcmSim::FilterPedestal() void AliTRDmcmSim::FilterGainInit() { - // Initializes the gain filter. In this case, only threshold + // Initializes the gain filter. In this case, only threshold // counters are reset. for (Int_t iAdc = 0; iAdc < fgkNADC; iAdc++) { - // these are counters which in hardware continue + // these are counters which in hardware continue // until maximum or reset fGainCounterA[iAdc] = 0; fGainCounterB[iAdc] = 0; @@ -924,7 +924,7 @@ UShort_t AliTRDmcmSim::FilterGainNextSample(Int_t adc, UShort_t value) { // Apply the gain filter to the given value. // BEGIN_LATEX O_{i}(t) = #gamma_{i} * I_{i}(t) + a_{i} END_LATEX - // The output depends on the internal registers and, thus, the + // The output depends on the internal registers and, thus, the // history of the filter. UShort_t fgby = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kFGBY); // bypass, active low @@ -940,19 +940,19 @@ UShort_t AliTRDmcmSim::FilterGainNextSample(Int_t adc, UShort_t value) corr = corr > 0xfff ? 0xfff : corr; corr = AddUintClipping(corr, fga, 12); - // Update threshold counters + // Update threshold counters // not really useful as they are cleared with every new event if (!((fGainCounterA[adc] == 0x3FFFFFF) || (fGainCounterB[adc] == 0x3FFFFFF))) // stop when full { - if (corr >= fgtb) + if (corr >= fgtb) fGainCounterB[adc]++; - else if (corr >= fgta) + else if (corr >= fgta) fGainCounterA[adc]++; } if (fgby == 1) - return corr; + return corr; else return value; } @@ -970,8 +970,8 @@ void AliTRDmcmSim::FilterGain() void AliTRDmcmSim::FilterTailInit(Int_t baseline) { - // Initializes the tail filter assuming that the input has - // been at the baseline value (configured by FTFP) for a + // Initializes the tail filter assuming that the input has + // been at the baseline value (configured by FTFP) for a // sufficiently long time. // exponents and weight calculated from configuration @@ -992,7 +992,7 @@ void AliTRDmcmSim::FilterTailInit(Int_t baseline) if (baseline < 0) baseline = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kFPNP); - + ql = lambdaL * (1 - lambdaS) * alphaL; qs = lambdaS * (1 - lambdaL) * (1 - alphaL); @@ -1012,8 +1012,8 @@ void AliTRDmcmSim::FilterTailInit(Int_t baseline) UShort_t AliTRDmcmSim::FilterTailNextSample(Int_t adc, UShort_t value) { - // Returns the output of the tail filter for the given input value. - // The output depends on the internal registers and, thus, the + // Returns the output of the tail filter for the given input value. + // The output depends on the internal registers and, thus, the // history of the filter. // exponents and weight calculated from configuration @@ -1026,21 +1026,21 @@ UShort_t AliTRDmcmSim::FilterTailNextSample(Int_t adc, UShort_t value) UInt_t alInpv; UShort_t aQ; UInt_t tmp; - + UShort_t inpVolt = value & 0xFFF; // 12 bits - + // add the present generator outputs aQ = AddUintClipping(fTailAmplLong[adc], fTailAmplShort[adc], 12); // calculate the difference between the input and the generated signal - if (inpVolt > aQ) + if (inpVolt > aQ) aDiff = inpVolt - aQ; - else + else aDiff = 0; - + // the inputs to the two generators, weighted alInpv = (aDiff * alphaLong) >> 11; - + // the new values of the registers, used next time // long component tmp = AddUintClipping(fTailAmplLong[adc], alInpv, 12); @@ -1050,7 +1050,7 @@ UShort_t AliTRDmcmSim::FilterTailNextSample(Int_t adc, UShort_t value) tmp = AddUintClipping(fTailAmplShort[adc], aDiff - alInpv, 12); tmp = (tmp * lambdaShort) >> 11; fTailAmplShort[adc] = tmp & 0xFFF; - + // the output of the filter if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kFTBY) == 0) // bypass mode, active low return value; @@ -1060,7 +1060,7 @@ UShort_t AliTRDmcmSim::FilterTailNextSample(Int_t adc, UShort_t value) void AliTRDmcmSim::FilterTail() { - // Apply tail cancellation filter to all data. + // Apply tail cancellation filter to all data. for (Int_t iTimeBin = 0; iTimeBin < fNTimeBin; iTimeBin++) { for (Int_t iAdc = 0; iAdc < fgkNADC; iAdc++) { @@ -1079,17 +1079,17 @@ void AliTRDmcmSim::ZSMapping() // http://www.kip.uni-heidelberg.de/ti/TRD/doc/trap/TRAP-UserManual.pdf // - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; - Int_t eBIS = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIS); - Int_t eBIT = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIT); - Int_t eBIL = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIL); - Int_t eBIN = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIN); + Int_t eBIS = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIS); + Int_t eBIT = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIT); + Int_t eBIL = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIL); + Int_t eBIN = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kEBIN); Int_t **adc = fADCF; - for (Int_t iAdc = 0; iAdc < fgkNADC; iAdc++) + for (Int_t iAdc = 0; iAdc < fgkNADC; iAdc++) fZSMap[iAdc] = -1; for( Int_t it = 0 ; it < fNTimeBin ; it++ ) { @@ -1099,55 +1099,55 @@ void AliTRDmcmSim::ZSMapping() Int_t an; Int_t mask; Int_t supp; // suppression of the current channel (low active) - + // ----- first channel ----- iAdc = 0; - + ap = 0; // previous ac = adc[iAdc ][it]; // current an = adc[iAdc+1][it]; // next - + mask = ( ac >= ap && ac >= an ) ? 0 : 0x1; // peak center detection mask += ( ap + ac + an > eBIT ) ? 0 : 0x2; // cluster mask += ( ac > eBIS ) ? 0 : 0x4; // absolute large peak - + supp = (eBIL >> mask) & 1; - + fZSMap[iAdc] &= ~((1-supp) << it); if( eBIN == 0 ) { // neighbour sensitivity fZSMap[iAdc+1] &= ~((1-supp) << it); } - + // ----- last channel ----- iAdc = fgkNADC - 1; - + ap = adc[iAdc-1][it]; // previous ac = adc[iAdc ][it]; // current an = 0; // next - + mask = ( ac >= ap && ac >= an ) ? 0 : 0x1; // peak center detection mask += ( ap + ac + an > eBIT ) ? 0 : 0x2; // cluster mask += ( ac > eBIS ) ? 0 : 0x4; // absolute large peak - + supp = (eBIL >> mask) & 1; - + fZSMap[iAdc] &= ~((1-supp) << it); if( eBIN == 0 ) { // neighbour sensitivity fZSMap[iAdc-1] &= ~((1-supp) << it); } - + // ----- middle channels ----- for( iAdc = 1 ; iAdc < fgkNADC-1; iAdc++ ) { ap = adc[iAdc-1][it]; // previous ac = adc[iAdc ][it]; // current an = adc[iAdc+1][it]; // next - + mask = ( ac >= ap && ac >= an ) ? 0 : 0x1; // peak center detection mask += ( ap + ac + an > eBIT ) ? 0 : 0x2; // cluster mask += ( ac > eBIS ) ? 0 : 0x4; // absolute large peak - + supp = (eBIL >> mask) & 1; - + fZSMap[iAdc] &= ~((1-supp) << it); if( eBIN == 0 ) { // neighbour sensitivity fZSMap[iAdc-1] &= ~((1-supp) << it); @@ -1160,20 +1160,20 @@ void AliTRDmcmSim::ZSMapping() void AliTRDmcmSim::AddHitToFitreg(Int_t adc, UShort_t timebin, UShort_t qtot, Short_t ypos, Int_t label[]) { - // Add the given hit to the fit register which is lateron used for - // the tracklet calculation. - // In addition to the fit sums in the fit register MC information + // Add the given hit to the fit register which is lateron used for + // the tracklet calculation. + // In addition to the fit sums in the fit register MC information // is stored. - if ((timebin >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS0)) && + if ((timebin >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS0)) && (timebin < fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQE0))) fFitReg[adc].fQ0 += qtot; - - if ((timebin >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS1)) && + + if ((timebin >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS1)) && (timebin < fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQE1))) fFitReg[adc].fQ1 += qtot; - - if ((timebin >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFS) ) && + + if ((timebin >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFS) ) && (timebin < fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFE))) { fFitReg[adc].fSumX += timebin; @@ -1195,32 +1195,32 @@ void AliTRDmcmSim::AddHitToFitreg(Int_t adc, UShort_t timebin, UShort_t qtot, Sh fNHits++; } -void AliTRDmcmSim::CalcFitreg() +void AliTRDmcmSim::CalcFitreg() { // Preprocessing. // Detect the hits and fill the fit registers. - // Requires 12-bit data from fADCF which means Filter() + // Requires 12-bit data from fADCF which means Filter() // has to be called before even if all filters are bypassed. //??? to be clarified: UInt_t adcMask = 0xffffffff; - + UShort_t timebin, adcch, adcLeft, adcCentral, adcRight, hitQual, timebin1, timebin2, qtotTemp; Short_t ypos, fromLeft, fromRight, found; UShort_t qTotal[19+1]; // the last is dummy UShort_t marked[6], qMarked[6], worse1, worse2; - - timebin1 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFS); - if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS0) + + timebin1 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFS); + if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS0) < timebin1) timebin1 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQS0); - timebin2 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFE); - if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQE1) + timebin2 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFE); + if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQE1) > timebin2) timebin2 = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPQE1); // reset the fit registers - fNHits = 0; + fNHits = 0; for (adcch = 0; adcch < fgkNADC-2; adcch++) // due to border channels { fFitReg[adcch].fNhits = 0; @@ -1232,7 +1232,7 @@ void AliTRDmcmSim::CalcFitreg() fFitReg[adcch].fSumY2 = 0; fFitReg[adcch].fSumXY = 0; } - + for (timebin = timebin1; timebin < timebin2; timebin++) { // first find the hit candidates and store the total cluster charge in qTotal array @@ -1243,10 +1243,10 @@ void AliTRDmcmSim::CalcFitreg() adcLeft = fADCF[adcch ][timebin]; adcCentral = fADCF[adcch+1][timebin]; adcRight = fADCF[adcch+2][timebin]; - if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPVBY) == 1) - hitQual = ( (adcLeft * adcRight) < + if (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPVBY) == 1) + hitQual = ( (adcLeft * adcRight) < (fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPVT) * adcCentral) ); - else + else hitQual = 1; // The accumulated charge is with the pedestal!!! qtotTemp = adcLeft + adcCentral + adcRight; @@ -1260,7 +1260,7 @@ void AliTRDmcmSim::CalcFitreg() } else qTotal[adcch] = 0; //jkl - if (qTotal[adcch] != 0) + if (qTotal[adcch] != 0) AliDebug(10,Form("ch %2d qTotal %5d",adcch, qTotal[adcch])); } @@ -1280,7 +1280,7 @@ void AliTRDmcmSim::CalcFitreg() } adcch++; } - + fromRight = -1; adcch = 18; found = 0; @@ -1300,7 +1300,7 @@ void AliTRDmcmSim::CalcFitreg() if ((fromLeft >= 0) && (fromRight >= 0) && (fromLeft < fromRight)) for (adcch = fromLeft+1; adcch < fromRight; adcch++) qTotal[adcch] = 0; - + found = 0; for (adcch = 0; adcch < 19; adcch++) if (qTotal[adcch] > 0) found++; @@ -1314,7 +1314,7 @@ void AliTRDmcmSim::CalcFitreg() qMarked[found] = qTotal[marked[found]] >> 4; AliDebug(10,Form("ch_%d qTotal %d qTotals %d",marked[found],qTotal[marked[found]],qMarked[found])); } - + Sort6To2Worst(marked[0], marked[3], marked[4], marked[1], marked[2], marked[5], qMarked[0], qMarked[3], @@ -1335,7 +1335,7 @@ void AliTRDmcmSim::CalcFitreg() AliDebug(10,Form("Kill ch %d\n",worse2)); } } - + for (adcch = 0; adcch < 19; adcch++) { if (qTotal[adcch] > 0) // the channel is marked for processing { @@ -1344,10 +1344,10 @@ void AliTRDmcmSim::CalcFitreg() adcRight = fADCF[adcch+2][timebin]; // hit detected, in TRAP we have 4 units and a hit-selection, here we proceed all channels! // subtract the pedestal TPFP, clipping instead of wrapping - + Int_t regTPFP = fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPFP); AliDebug(10, Form("Hit found, time=%d, adcch=%d/%d/%d, adc values=%d/%d/%d, regTPFP=%d, TPHT=%d\n", - timebin, adcch, adcch+1, adcch+2, adcLeft, adcCentral, adcRight, regTPFP, + timebin, adcch, adcch+1, adcch+2, adcLeft, adcCentral, adcRight, regTPFP, fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPHT))); if (adcLeft < regTPFP) adcLeft = 0; else adcLeft -= regTPFP; @@ -1372,7 +1372,7 @@ void AliTRDmcmSim::CalcFitreg() Int_t label[maxLabels] = { 0 }; // up to 9 different labels possible Int_t count[maxLabels] = { 0 }; Int_t nLabels = 0; - Int_t padcol[3]; + Int_t padcol[3]; padcol[0] = fFeeParam->GetPadColFromADC(fRobPos, fMcmPos, adcch); padcol[1] = fFeeParam->GetPadColFromADC(fRobPos, fMcmPos, adcch+1); padcol[2] = fFeeParam->GetPadColFromADC(fRobPos, fMcmPos, adcch+2); @@ -1381,7 +1381,7 @@ void AliTRDmcmSim::CalcFitreg() if (!fDict[iDict]) continue; for (Int_t iPad = 0; iPad < 3; iPad++) { - if (padcol[iPad] < 0) + if (padcol[iPad] < 0) continue; Int_t currLabel = fDict[iDict]->GetData(padrow, padcol[iPad], timebin); AliDebug(10, Form("Read label: %4i for det: %3i, row: %i, col: %i, tb: %i\n", currLabel, fDetector, padrow, padcol[iPad], timebin)); @@ -1391,7 +1391,7 @@ void AliTRDmcmSim::CalcFitreg() currLabel = -1; break; } - } + } if (currLabel >= 0) { label[nLabels] = currLabel; count[nLabels] = 1; @@ -1428,9 +1428,9 @@ void AliTRDmcmSim::CalcFitreg() } } -void AliTRDmcmSim::TrackletSelection() +void AliTRDmcmSim::TrackletSelection() { - // Select up to 4 tracklet candidates from the fit registers + // Select up to 4 tracklet candidates from the fit registers // and assign them to the CPUs. UShort_t adcIdx, i, j, ntracks, tmp; @@ -1438,7 +1438,7 @@ void AliTRDmcmSim::TrackletSelection() ntracks = 0; for (adcIdx = 0; adcIdx < 18; adcIdx++) // ADCs - if ( (fFitReg[adcIdx].fNhits + if ( (fFitReg[adcIdx].fNhits >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPCL)) && (fFitReg[adcIdx].fNhits+fFitReg[adcIdx+1].fNhits >= fTrapConfig->GetTrapReg(AliTRDtrapConfig::kTPCT))) @@ -1449,7 +1449,7 @@ void AliTRDmcmSim::TrackletSelection() ntracks++; }; - for (i=0; i 4) @@ -1475,7 +1475,7 @@ void AliTRDmcmSim::TrackletSelection() ntracks = 4; // cut the rest, 4 is the max } // else is not necessary to sort - + // now sort, so that the first tracklet going to CPU0 corresponds to the highest adc channel - as in the TRAP for (j = 0; j < (ntracks-1); j++) { @@ -1504,8 +1504,8 @@ void AliTRDmcmSim::TrackletSelection() void AliTRDmcmSim::FitTracklet() { - // Perform the actual tracklet fit based on the fit sums - // which have been filled in the fit registers. + // Perform the actual tracklet fit based on the fit sums + // which have been filled in the fit registers. // parameters in fitred.asm (fit program) Int_t rndAdd = 0; @@ -1520,7 +1520,7 @@ void AliTRDmcmSim::FitTracklet() // calculated in fitred.asm Int_t padrow = ((fRobPos >> 1) << 2) | (fMcmPos >> 2); - Int_t yoffs = (((((fRobPos & 0x1) << 2) + (fMcmPos & 0x3)) * 18) << 8) - + Int_t yoffs = (((((fRobPos & 0x1) << 2) + (fMcmPos & 0x3)) * 18) << 8) - ((18*4*2 - 18*2 - 1) << 7); yoffs = yoffs << decPlaces; // holds position of ADC channel 1 Int_t layer = fDetector % 6; @@ -1528,7 +1528,7 @@ void AliTRDmcmSim::FitTracklet() UInt_t scaleD = (UInt_t) ((0.635 + 0.03 * layer)/(256.0 * 140.0e-4) * shift); Int_t deflCorr = (Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCorr, fDetector, fRobPos, fMcmPos); - Int_t ndrift = (Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrNdrift, fDetector, fRobPos, fMcmPos); + Int_t ndrift = (Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrNdrift, fDetector, fRobPos, fMcmPos); // local variables for calculation Long64_t mult, temp, denom; //??? @@ -1539,7 +1539,7 @@ void AliTRDmcmSim::FitTracklet() Int_t sumY2; // not used in the current TRAP program, now used for error calculation (simulation only) Float_t fitError, fitSlope, fitOffset; FitReg_t *fit0, *fit1; // pointers to relevant fit registers - + // const uint32_t OneDivN[32] = { // 2**31/N : exactly like in the TRAP, the simple division here gives the same result! // 0x00000000, 0x80000000, 0x40000000, 0x2AAAAAA0, 0x20000000, 0x19999990, 0x15555550, 0x12492490, // 0x10000000, 0x0E38E380, 0x0CCCCCC0, 0x0BA2E8B0, 0x0AAAAAA0, 0x09D89D80, 0x09249240, 0x08888880, @@ -1549,7 +1549,7 @@ void AliTRDmcmSim::FitTracklet() for (Int_t cpu = 0; cpu < 4; cpu++) { if (fFitPtr[cpu] == 31) { - fMCMT[cpu] = 0x10001000; //??? AliTRDfeeParam::GetTrackletEndmarker(); + fMCMT[cpu] = 0x10001000; //??? AliTRDfeeParam::GetTrackletEndmarker(); } else { @@ -1582,28 +1582,28 @@ void AliTRDmcmSim::FitTracklet() offset = temp >> 32; // take the upper 32 bits offset = offset + yoffs; - AliDebug(10, Form("slope = %i, slope * ndrift = %i, deflCorr: %i", + AliDebug(10, Form("slope = %i, slope * ndrift = %i, deflCorr: %i", slope, slope * ndrift, deflCorr)); slope = ((slope * ndrift) >> ndriftDp) + deflCorr; offset = offset - (fFitPtr[cpu] << (8 + decPlaces)); - + temp = slope; temp = temp * scaleD; slope = (temp >> 32); temp = offset; temp = temp * scaleY; offset = (temp >> 32); - + // rounding, like in the TRAP slope = (slope + rndAdd) >> decPlaces; offset = (offset + rndAdd) >> decPlaces; - AliDebug(5, Form("Det: %3i, ROB: %i, MCM: %2i: deflection: %i, min: %i, max: %i", - fDetector, fRobPos, fMcmPos, slope, - (Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCutStart + 2*fFitPtr[cpu], fDetector, fRobPos, fMcmPos), + AliDebug(5, Form("Det: %3i, ROB: %i, MCM: %2i: deflection: %i, min: %i, max: %i", + fDetector, fRobPos, fMcmPos, slope, + (Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCutStart + 2*fFitPtr[cpu], fDetector, fRobPos, fMcmPos), (Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCutStart + 1 + 2*fFitPtr[cpu], fDetector, fRobPos, fMcmPos))); - AliDebug(5, Form("Fit sums: x = %i, X = %i, y = %i, Y = %i, Z = %i", + AliDebug(5, Form("Fit sums: x = %i, X = %i, y = %i, Y = %i, Z = %i", sumX, sumX2, sumY, sumY2, sumXY)); fitSlope = (Float_t) (nHits * sumXY - sumX * sumY) / (nHits * sumX2 - sumX*sumX); @@ -1620,7 +1620,7 @@ void AliTRDmcmSim::FitTracklet() Bool_t rejected = kFALSE; // deflection range table from DMEM - if ((slope < ((Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCutStart + 2*fFitPtr[cpu], fDetector, fRobPos, fMcmPos))) || + if ((slope < ((Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCutStart + 2*fFitPtr[cpu], fDetector, fRobPos, fMcmPos))) || (slope > ((Int_t) fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrDeflCutStart + 1 + 2*fFitPtr[cpu], fDetector, fRobPos, fMcmPos)))) rejected = kTRUE; @@ -1637,8 +1637,8 @@ void AliTRDmcmSim::FitTracklet() } slope = slope & 0x7F; // 7 bit - - if (offset > 0xfff || offset < -0xfff) + + if (offset > 0xfff || offset < -0xfff) AliWarning("Overflow in offset"); offset = offset & 0x1FFF; // 13 bit @@ -1647,7 +1647,7 @@ void AliTRDmcmSim::FitTracklet() if (pid > 0xff) AliWarning("Overflow in PID"); pid = pid & 0xFF; // 8 bit, exactly like in the TRAP program - + // assemble and store the tracklet word fMCMT[cpu] = (pid << 24) | (padrow << 20) | (slope << 13) | offset; @@ -1700,7 +1700,7 @@ void AliTRDmcmSim::FitTracklet() new ((*fTrackletArray)[fTrackletArray->GetEntriesFast()]) AliTRDtrackletMCM((UInt_t) fMCMT[cpu], fDetector*2 + fRobPos%2, fRobPos, fMcmPos); ((AliTRDtrackletMCM*) (*fTrackletArray)[fTrackletArray->GetEntriesFast()-1])->SetLabel(mcLabel); - + ((AliTRDtrackletMCM*) (*fTrackletArray)[fTrackletArray->GetEntriesFast()-1])->SetNHits(fit0->fNhits + fit1->fNhits); ((AliTRDtrackletMCM*) (*fTrackletArray)[fTrackletArray->GetEntriesFast()-1])->SetNHits0(nHits0); ((AliTRDtrackletMCM*) (*fTrackletArray)[fTrackletArray->GetEntriesFast()-1])->SetNHits1(nHits1); @@ -1734,7 +1734,7 @@ void AliTRDmcmSim::FitTracklet() if (fitError < 0) AliError(Form("Strange fit error: %f from Sx: %i, Sy: %i, Sxy: %i, Sx2: %i, Sy2: %i, nHits: %i", fitError, sumX, sumY, sumXY, sumX2, sumY2, nHits)); - AliDebug(3, Form("fit slope: %f, offset: %f, error: %f", + AliDebug(3, Form("fit slope: %f, offset: %f, error: %f", fitSlope, fitOffset, TMath::Sqrt(TMath::Abs(fitError)/nHits))); } } @@ -1745,7 +1745,7 @@ void AliTRDmcmSim::Tracklet() { // Run the tracklet calculation by calling sequentially: // CalcFitreg(); TrackletSelection(); FitTracklet() - // and store the tracklets + // and store the tracklets if (!fInitialized) { AliError("Called uninitialized! Nothing done!"); @@ -1761,11 +1761,11 @@ void AliTRDmcmSim::Tracklet() FitTracklet(); } -Bool_t AliTRDmcmSim::StoreTracklets() +Bool_t AliTRDmcmSim::StoreTracklets() { // store the found tracklets via the loader - if (fTrackletArray->GetEntriesFast() == 0) + if (fTrackletArray->GetEntriesFast() == 0) return kTRUE; AliRunLoader *rl = AliRunLoader::Instance(); @@ -1782,12 +1782,12 @@ Bool_t AliTRDmcmSim::StoreTracklets() dl->MakeTree(); trackletTree = dl->Tree(); } - + AliTRDtrackletMCM *trkl = 0x0; TBranch *trkbranch = trackletTree->GetBranch(fTrklBranchName.Data()); if (!trkbranch) trkbranch = trackletTree->Branch(fTrklBranchName.Data(), "AliTRDtrackletMCM", &trkl, 32000); - + for (Int_t iTracklet = 0; iTracklet < fTrackletArray->GetEntriesFast(); iTracklet++) { trkl = ((AliTRDtrackletMCM*) (*fTrackletArray)[iTracklet]); trkbranch->SetAddress(&trkl); @@ -1803,7 +1803,7 @@ void AliTRDmcmSim::WriteData(AliTRDarrayADC *digits) // EBSF = 1: unfiltered data; EBSF = 0: filtered data // zero-suppressed valued are written as -1 to digits - if( !CheckInitialized() ) + if( !CheckInitialized() ) return; Int_t offset = (fMcmPos % 4 + 1) * 21 + (fRobPos % 2) * 84 - 1; @@ -1895,7 +1895,7 @@ Int_t AliTRDmcmSim::GetPID(Int_t q0, Int_t q1) if(addrQ0 >= nBinsQ0) { // check for overflow AliDebug(5,Form("Overflow in q0: %llu/4 is bigger then %u", addrQ0, nBinsQ0)); addrQ0 = nBinsQ0 -1; - } + } addr = corrQ1; addr = (((addr*q1)>>16)>>16); @@ -1904,7 +1904,7 @@ Int_t AliTRDmcmSim::GetPID(Int_t q0, Int_t q1) if(addr >= pidTotalSize) { AliDebug(5,Form("Overflow in q1. Address %llu/4 is bigger then %u", addr, pidTotalSize)); addr = pidTotalSize -1; - } + } // For a LUT with 11 input and 8 output bits, the first memory address is set to LUT[0] | (LUT[1] << 8) | (LUT[2] << 16) | (LUT[3] << 24) // and so on @@ -1918,21 +1918,21 @@ Int_t AliTRDmcmSim::GetPID(Int_t q0, Int_t q1) UInt_t AliTRDmcmSim::AddUintClipping(UInt_t a, UInt_t b, UInt_t nbits) const { - // - // This function adds a and b (unsigned) and clips to - // the specified number of bits. - // + // + // This function adds a and b (unsigned) and clips to + // the specified number of bits. + // UInt_t sum = a + b; if (nbits < 32) { UInt_t maxv = (1 << nbits) - 1;; - if (sum > maxv) + if (sum > maxv) sum = maxv; } else { - if ((sum < a) || (sum < b)) + if ((sum < a) || (sum < b)) sum = 0xFFFFFFFF; } return sum; @@ -2104,10 +2104,10 @@ ostream& AliTRDmcmSim::Text(ostream& os) ostream& AliTRDmcmSim::Cfdat(ostream& os) { - // manipulator to activate output in CFDAT format + // manipulator to activate output in CFDAT format // to send to the FEE via SCSN - os.iword(fgkFormatIndex) = 1; + os.iword(fgkFormatIndex) = 1; return os; } @@ -2122,20 +2122,20 @@ ostream& AliTRDmcmSim::Raw(ostream& os) ostream& operator<<(ostream& os, const AliTRDmcmSim& mcm) { // output implementation - + // no output for non-initialized MCM if (!mcm.CheckInitialized()) return os; // ----- human-readable output ----- if (os.iword(AliTRDmcmSim::fgkFormatIndex) == 0) { - - os << "MCM " << mcm.fMcmPos << " on ROB " << mcm.fRobPos << + + os << "MCM " << mcm.fMcmPos << " on ROB " << mcm.fRobPos << " in detector " << mcm.fDetector << std::endl; - + os << "----- Unfiltered ADC data (10 bit) -----" << std::endl; os << "ch "; - for (Int_t iChannel = 0; iChannel < mcm.fgkNADC; iChannel++) + for (Int_t iChannel = 0; iChannel < mcm.fgkNADC; iChannel++) os << std::setw(5) << iChannel; os << std::endl; for (Int_t iTimeBin = 0; iTimeBin < mcm.fNTimeBin; iTimeBin++) { @@ -2145,10 +2145,10 @@ ostream& operator<<(ostream& os, const AliTRDmcmSim& mcm) } os << std::endl; } - + os << "----- Filtered ADC data (10+2 bit) -----" << std::endl; os << "ch "; - for (Int_t iChannel = 0; iChannel < mcm.fgkNADC; iChannel++) + for (Int_t iChannel = 0; iChannel < mcm.fgkNADC; iChannel++) os << std::setw(4) << iChannel << ((~mcm.fZSMap[iChannel] != 0) ? "!" : " "); os << std::endl; @@ -2167,11 +2167,11 @@ ostream& operator<<(ostream& os, const AliTRDmcmSim& mcm) Int_t dest = 127; Int_t addrOffset = 0x2000; Int_t addrStep = 0x80; - + for (Int_t iTimeBin = 0; iTimeBin < mcm.fNTimeBin; iTimeBin++) { for (Int_t iChannel = 0; iChannel < mcm.fgkNADC; iChannel++) { - os << std::setw(5) << 10 - << std::setw(5) << addrOffset + iChannel * addrStep + iTimeBin + os << std::setw(5) << 10 + << std::setw(5) << addrOffset + iChannel * addrStep + iTimeBin << std::setw(5) << (mcm.fADCF[iChannel][iTimeBin]) << std::setw(5) << dest << std::endl; } @@ -2183,12 +2183,12 @@ ostream& operator<<(ostream& os, const AliTRDmcmSim& mcm) else if (os.iword(AliTRDmcmSim::fgkFormatIndex) == 2) { Int_t bufSize = 300; UInt_t *buf = new UInt_t[bufSize]; - + Int_t bufLength = mcm.ProduceRawStream(&buf[0], bufSize); - - for (Int_t i = 0; i < bufLength; i++) + + for (Int_t i = 0; i < bufLength; i++) std::cout << "0x" << std::hex << buf[i] << std::dec << std::endl; - + delete [] buf; } @@ -2218,7 +2218,7 @@ void AliTRDmcmSim::PrintFitRegXml(ostream& os) const os << "" << std::endl; os << " " << std::endl; os << " " << std::endl; - + for(int cpu=0; cpu<4; cpu++) { os << " " << std::endl; if(fFitPtr[cpu] != 31) { @@ -2226,7 +2226,7 @@ void AliTRDmcmSim::PrintFitRegXml(ostream& os) const os << " "<< std::endl; os << " " << fFitReg[adcch].fNhits << ""<< std::endl; os << " " << fFitReg[adcch].fQ0/4 << ""<< std::endl; // divided by 4 because in simulation we have 2 additional decimal places - os << " " << fFitReg[adcch].fQ1/4 << ""<< std::endl; // in the output + os << " " << fFitReg[adcch].fQ1/4 << ""<< std::endl; // in the output os << " " << fFitReg[adcch].fSumX << ""<< std::endl; os << " " << fFitReg[adcch].fSumX2 << ""<< std::endl; os << " " << fFitReg[adcch].fSumY << ""<< std::endl; @@ -2273,7 +2273,7 @@ void AliTRDmcmSim::PrintTrackletsXml(ostream& os) const offset = (fMCMT[cpu] & 0x1FFF ) ; } - os << " " << pid << "" << " " << padrow << "" + os << " " << pid << "" << " " << padrow << "" << " " << slope << "" << " " << offset << "" << "" << std::endl; } @@ -2290,12 +2290,12 @@ void AliTRDmcmSim::PrintAdcDatHuman(ostream& os) const { // print ADC data in human-readable format - os << "MCM " << fMcmPos << " on ROB " << fRobPos << + os << "MCM " << fMcmPos << " on ROB " << fRobPos << " in detector " << fDetector << std::endl; - + os << "----- Unfiltered ADC data (10 bit) -----" << std::endl; os << "ch "; - for (Int_t iChannel = 0; iChannel < fgkNADC; iChannel++) + for (Int_t iChannel = 0; iChannel < fgkNADC; iChannel++) os << std::setw(5) << iChannel; os << std::endl; for (Int_t iTimeBin = 0; iTimeBin < fNTimeBin; iTimeBin++) { @@ -2305,10 +2305,10 @@ void AliTRDmcmSim::PrintAdcDatHuman(ostream& os) const } os << std::endl; } - + os << "----- Filtered ADC data (10+2 bit) -----" << std::endl; os << "ch "; - for (Int_t iChannel = 0; iChannel < fgkNADC; iChannel++) + for (Int_t iChannel = 0; iChannel < fgkNADC; iChannel++) os << std::setw(4) << iChannel << ((~fZSMap[iChannel] != 0) ? "!" : " "); os << std::endl; @@ -2325,7 +2325,7 @@ void AliTRDmcmSim::PrintAdcDatHuman(ostream& os) const void AliTRDmcmSim::PrintAdcDatXml(ostream& os) const { - // print ADC data in XML format + // print ADC data in XML format os << "" << std::endl; os << "" << std::endl; @@ -2362,7 +2362,7 @@ void AliTRDmcmSim::PrintAdcDatDatx(ostream& os, Bool_t broadcast) const Int_t addrOffset = 0x2000; Int_t addrStep = 0x80; Int_t addrOffsetEBSIA = 0x20; - + for (Int_t iTimeBin = 0; iTimeBin < fNTimeBin; iTimeBin++) { for (Int_t iChannel = 0; iChannel < fgkNADC; iChannel++) { if(broadcast==kFALSE) @@ -2386,7 +2386,7 @@ void AliTRDmcmSim::PrintPidLutHuman() std::cout << "nBinsQ0: " << nBinsQ0 << std::endl; std::cout << "LUT table length: " << fTrapConfig->GetDmemUnsigned(AliTRDtrapConfig::fgkDmemAddrLUTLength) << std::endl; - + for(UInt_t addr=AliTRDtrapConfig::fgkDmemAddrLUTStart; addr< addrEnd; addr++) { result = fTrapConfig->GetDmemUnsigned(addr); std::cout << addr << " # x: " << ((addr-AliTRDtrapConfig::fgkDmemAddrLUTStart)%((nBinsQ0)/4))*4 << ", y: " <<(addr-AliTRDtrapConfig::fgkDmemAddrLUTStart)/(nBinsQ0/4) diff --git a/TRD/AliTRDmcmSim.h b/TRD/AliTRDmcmSim.h index d7cb0673552..53665411841 100644 --- a/TRD/AliTRDmcmSim.h +++ b/TRD/AliTRDmcmSim.h @@ -29,39 +29,39 @@ class AliTRDmcmSim : public TObject { AliTRDmcmSim(); virtual ~AliTRDmcmSim(); - void Init(Int_t det, Int_t rob, Int_t mcm, Bool_t newEvent = kFALSE); + void Init(Int_t det, Int_t rob, Int_t mcm, Bool_t newEvent = kFALSE); // Initialize MCM by the position parameters - void Reset(); + void Reset(); // clears filter registers and internal data Bool_t LoadMCM(AliRunLoader* const runloader, Int_t det, Int_t rob, Int_t mcm); void NoiseTest(Int_t nsamples, Int_t mean, Int_t sigma, Int_t inputGain = 1, Int_t inputTail = 2); - Int_t GetDataRaw(Int_t iadc, Int_t timebin) const { return (fADCR[iadc][timebin] >> 2); } - // Get unfiltered ADC data - Int_t GetDataFiltered(Int_t iadc, Int_t timebin) const { return (fADCF[iadc][timebin] >> 2); } + Int_t GetDataRaw(Int_t iadc, Int_t timebin) const { return (fADCR[iadc][timebin] >> 2); } + // Get unfiltered ADC data + Int_t GetDataFiltered(Int_t iadc, Int_t timebin) const { return (fADCF[iadc][timebin] >> 2); } // Get filtered ADC data - void SetData(Int_t iadc, Int_t *adc); // Set ADC data with array + void SetData(Int_t iadc, Int_t *adc); // Set ADC data with array void SetData(Int_t iadc, Int_t it, Int_t adc); // Set ADC data - void SetData(AliTRDarrayADC * const adcArray, + void SetData(AliTRDarrayADC * const adcArray, AliTRDdigitsManager * const digitsManager = 0x0); // Set ADC data from adcArray - void SetDataByPad(AliTRDarrayADC *const adcArray, + void SetDataByPad(AliTRDarrayADC *const adcArray, AliTRDdigitsManager * const digitsManager = 0x0); // Set ADC data from adcArray void SetDataPedestal(Int_t iadc); // Fill ADC data with pedestal values static Bool_t GetApplyCut() { return fgApplyCut; } static void SetApplyCut(Bool_t applyCut) { fgApplyCut = applyCut; } - static Int_t GetAddBaseline() { return fgAddBaseline; } - static void SetAddBaseline(Int_t baseline) { fgAddBaseline = baseline; } - // Additional baseline which is added for the processing - // in the TRAP and removed when writing back the data. - // This is needed to run with TRAP parameters set for a - // different baseline but it will not change the baseline - // of the output. + static Int_t GetAddBaseline() { return fgAddBaseline; } + static void SetAddBaseline(Int_t baseline) { fgAddBaseline = baseline; } + // Additional baseline which is added for the processing + // in the TRAP and removed when writing back the data. + // This is needed to run with TRAP parameters set for a + // different baseline but it will not change the baseline + // of the output. Int_t GetDetector() const { return fDetector; }; // Returns Chamber ID (0-539) Int_t GetRobPos() const { return fRobPos; }; // Returns ROB position (0-7) @@ -77,7 +77,7 @@ class AliTRDmcmSim : public TObject { Int_t ProduceRawStream( UInt_t *buf, Int_t bufsize, UInt_t iEv = 0 ) const; // Produce raw data stream - Real data format Int_t ProduceTrackletStream( UInt_t *buf, Int_t bufsize ); // produce the tracklet stream for this MCM - + // different stages of processing in the TRAP void Filter(); // Apply digital filters for existing data (according to configuration) void ZSMapping(); // Do ZS mapping for existing data @@ -91,7 +91,7 @@ class AliTRDmcmSim : public TObject { // filter initialization (resets internal registers) void FilterPedestalInit(Int_t baseline = 10); void FilterGainInit(); - void FilterTailInit(Int_t baseline = -1); + void FilterTailInit(Int_t baseline = -1); // feed single sample to individual filter // this changes the internal registers @@ -132,12 +132,12 @@ class AliTRDmcmSim : public TObject { protected: Bool_t CheckInitialized() const; // Check whether the class is initialized - + void SetNTimebins(Int_t ntimebins); // allocate data arrays corr. to the no. of timebins static const Int_t fgkFormatIndex; // index for format settings in stream - static const Int_t fgkNADC; // Number of ADC + static const Int_t fgkNADC; // Number of ADC static const Int_t fgkMaxTracklets = 4; // maximum number of tracklet-words submitted per MCM (one per CPU) static const Int_t fgkAddDigits = 2; // additional digits used for internal representation of ADC data // all internal data as after data control block (i.e. 12 bit), s. TRAP manual @@ -149,13 +149,13 @@ class AliTRDmcmSim : public TObject { Bool_t fInitialized; // memory is allocated if initialized Int_t fDetector; // Chamber ID - Int_t fRobPos; // ROB Position on chamber - Int_t fMcmPos; // MCM Position on chamber + Int_t fRobPos; // ROB Position on chamber + Int_t fMcmPos; // MCM Position on chamber Int_t fRow; // Pad row number (0-11 or 0-15) of the MCM on chamber Int_t fNTimeBin; // Number of timebins currently allocated Int_t **fADCR; // Array with MCM ADC values (Raw, 12 bit) Int_t **fADCF; // Array with MCM ADC values (Filtered, 12 bit) - UInt_t *fMCMT; // tracklet word for one mcm/trap-chip + UInt_t *fMCMT; // tracklet word for one mcm/trap-chip TClonesArray *fTrackletArray; // Array of AliTRDtrackletMCM which contains MC information in addition to the tracklet word Int_t *fZSMap; // Zero suppression map (1 dimensional projection) @@ -191,33 +191,33 @@ class AliTRDmcmSim : public TObject { Int_t fNHits; // Number of detected hits // tracklet calculation - struct FitReg_t { // pointer to the 18 fit registers + struct FitReg_t { // pointer to the 18 fit registers Int_t fNhits; // number of hits UInt_t fQ0; // charge accumulated in first window UInt_t fQ1; // charge accumulated in second window UInt_t fSumX; // sum x - Int_t fSumY; // sum y + Int_t fSumY; // sum y UInt_t fSumX2; // sum x**2 UInt_t fSumY2; // sum y**2 Int_t fSumXY; // sum x*y } *fFitReg; // Sort functions as in TRAP - void Sort2(UShort_t idx1i, UShort_t idx2i, UShort_t val1i, UShort_t val2i, + void Sort2(UShort_t idx1i, UShort_t idx2i, UShort_t val1i, UShort_t val2i, UShort_t * const idx1o, UShort_t * const idx2o, UShort_t * const val1o, UShort_t * const val2o) const; - void Sort3(UShort_t idx1i, UShort_t idx2i, UShort_t idx3i, - UShort_t val1i, UShort_t val2i, UShort_t val3i, - UShort_t * const idx1o, UShort_t * const idx2o, UShort_t * const idx3o, + void Sort3(UShort_t idx1i, UShort_t idx2i, UShort_t idx3i, + UShort_t val1i, UShort_t val2i, UShort_t val3i, + UShort_t * const idx1o, UShort_t * const idx2o, UShort_t * const idx3o, UShort_t * const val1o, UShort_t * const val2o, UShort_t * const val3o); - void Sort6To4(UShort_t idx1i, UShort_t idx2i, UShort_t idx3i, UShort_t idx4i, UShort_t idx5i, UShort_t idx6i, - UShort_t val1i, UShort_t val2i, UShort_t val3i, UShort_t val4i, UShort_t val5i, UShort_t val6i, - UShort_t * const idx1o, UShort_t * const idx2o, UShort_t * const idx3o, UShort_t * const idx4o, + void Sort6To4(UShort_t idx1i, UShort_t idx2i, UShort_t idx3i, UShort_t idx4i, UShort_t idx5i, UShort_t idx6i, + UShort_t val1i, UShort_t val2i, UShort_t val3i, UShort_t val4i, UShort_t val5i, UShort_t val6i, + UShort_t * const idx1o, UShort_t * const idx2o, UShort_t * const idx3o, UShort_t * const idx4o, UShort_t * const val1o, UShort_t * const val2o, UShort_t * const val3o, UShort_t * const val4o); - void Sort6To2Worst(UShort_t idx1i, UShort_t idx2i, UShort_t idx3i, UShort_t idx4i, UShort_t idx5i, UShort_t idx6i, - UShort_t val1i, UShort_t val2i, UShort_t val3i, UShort_t val4i, UShort_t val5i, UShort_t val6i, + void Sort6To2Worst(UShort_t idx1i, UShort_t idx2i, UShort_t idx3i, UShort_t idx4i, UShort_t idx5i, UShort_t idx6i, + UShort_t val1i, UShort_t val2i, UShort_t val3i, UShort_t val4i, UShort_t val5i, UShort_t val6i, UShort_t * const idx5o, UShort_t * const idx6o); - UInt_t AddUintClipping(UInt_t a, UInt_t b, UInt_t nbits) const; + UInt_t AddUintClipping(UInt_t a, UInt_t b, UInt_t nbits) const; // Add a and b (unsigned) with clipping to the maximum value representable by nbits private: @@ -226,7 +226,7 @@ class AliTRDmcmSim : public TObject { static Bool_t fgApplyCut; // apply cut on deflection length - static Int_t fgAddBaseline; // add baseline to the ADC values + static Int_t fgAddBaseline; // add baseline to the ADC values ClassDef(AliTRDmcmSim,6) }; diff --git a/TRD/AliTRDrawStream.cxx b/TRD/AliTRDrawStream.cxx index b30585ef025..1aee804f112 100644 --- a/TRD/AliTRDrawStream.cxx +++ b/TRD/AliTRDrawStream.cxx @@ -69,14 +69,14 @@ const char* AliTRDrawStream::fgkErrorMessages[] = { "Invalid Stack header", "Invalid detector number", "No digits could be retrieved from the digitsmanager", - "HC header mismatch", + "HC header mismatch", "HC check bits wrong", "Unexpected position in readout stream", "Invalid testpattern mode", "Testpattern mismatch", "Number of timebins changed", - "ADC mask inconsistent", - "ADC check bits invalid", + "ADC mask inconsistent", + "ADC check bits invalid", "Missing ADC data", "Missing expected ADC channels", "Missing MCM headers" @@ -85,21 +85,21 @@ const char* AliTRDrawStream::fgkErrorMessages[] = { Int_t AliTRDrawStream::fgErrorDebugLevel[] = { 0, 0, - 2, - 1, - 0, - 1, - 1, + 2, + 1, + 0, + 1, + 1, + 1, 1, - 1, 2, 1, 1, 1, - 1, - 2, - 1, - 1, + 1, + 2, + 1, + 1, 1 }; @@ -125,7 +125,7 @@ AliTRDrawStream::ErrorBehav_t AliTRDrawStream::fgErrorBehav[] = { }; AliTRDrawStream::AliTRDrawStream(AliRawReader *rawReader) : - fStats(), + fStats(), fStoreError(&AliTRDrawStream::ForgetError), fRawReader(rawReader), fDigitsManager(0x0), @@ -199,12 +199,12 @@ AliTRDrawStream::AliTRDrawStream(AliRawReader *rawReader) : fCurrTrkHeaderSize = new UInt_t[fgkNstacks]; fCurrTrgHeaderIndexWord = new UInt_t[fgkNtriggers]; fCurrTrgHeaderSize = new UInt_t[fgkNtriggers]; - fCurrStackIndexWord = new UInt_t[fgkNstacks]; - fCurrStackHeaderSize = new UInt_t[fgkNstacks]; + fCurrStackIndexWord = new UInt_t[fgkNstacks]; + fCurrStackHeaderSize = new UInt_t[fgkNstacks]; fCurrStackHeaderVersion = new UInt_t[fgkNstacks]; - fCurrLinkMask = new UInt_t[fgkNstacks]; - fCurrCleanCheckout = new UInt_t[fgkNstacks]; - fCurrBoardId = new UInt_t[fgkNstacks]; + fCurrLinkMask = new UInt_t[fgkNstacks]; + fCurrCleanCheckout = new UInt_t[fgkNstacks]; + fCurrBoardId = new UInt_t[fgkNstacks]; fCurrHwRevTMU = new UInt_t[fgkNstacks]; fCurrLinkMonitorFlags = new UInt_t[fgkNstacks * fgkNlinks]; fCurrLinkDataTypeFlags = new UInt_t[fgkNstacks * fgkNlinks]; @@ -336,7 +336,7 @@ Bool_t AliTRDrawStream::NextDDL() fCurrEquipmentId = fRawReader->GetEquipmentId(); AliDebug(2, Form("equipment: %i", fCurrEquipmentId)); - + if (fCurrEquipmentId < kDDLOffset || fCurrEquipmentId > kDDLMax) { EquipmentError(kNonTrdEq, "Skipping"); continue; @@ -364,7 +364,7 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *digMgr) // in case you only want to read the data of a single chamber // to read all data ReadEvent(...) is recommended - fDigitsManager = digMgr; + fDigitsManager = digMgr; fDigitsParam = 0x0; fErrorFlags = 0; @@ -376,9 +376,9 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *digMgr) AliDataLoader *trklLoader = trdLoader ? trdLoader->GetDataLoader("tracklets") : NULL; if (trklLoader) { AliTreeLoader *trklTreeLoader = (AliTreeLoader*) trklLoader->GetBaseLoader("tracklets-raw"); - if (trklTreeLoader) + if (trklTreeLoader) trklTree = trklTreeLoader->Tree(); - else + else trklTree = trklLoader->Tree(); } @@ -415,7 +415,7 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *digMgr) else // read the data from one HC ReadLinkData(); - + // read all data endmarkers SeekNextLink(); @@ -429,15 +429,15 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *digMgr) } } - //??? to check + //??? to check do { - fCurrLink++; + fCurrLink++; if (fCurrLink >= fgkNlinks) { fCurrLink = 0; fCurrSlot++; } - } while ((fCurrSlot < fgkNstacks) && - (((fCurrStackMask & (1 << fCurrSlot)) == 0) || + } while ((fCurrSlot < fgkNstacks) && + (((fCurrStackMask & (1 << fCurrSlot)) == 0) || ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink))) == 0)); // return chamber information from HC if it is valid @@ -496,7 +496,7 @@ Int_t AliTRDrawStream::ReadGTUHeaders(UInt_t *buffer) Int_t AliTRDrawStream::ReadSmHeader() { - // read the SMU index header at the current reading position + // read the SMU index header at the current reading position // and store the information in the corresponding variables if (fPayloadCurr - fPayloadStart >= fPayloadSize - 1) { @@ -754,7 +754,7 @@ Int_t AliTRDrawStream::ReadTrackingHeader(Int_t stack) upperWord = kTRUE; continue; } - + if ((word & 0xffff0008) == 0x13370008) { AliDebug(1, Form("stack %i: fast track word: 0x%08x", stack, word)); continue; @@ -918,7 +918,7 @@ Int_t AliTRDrawStream::ReadLinkData() Int_t det = fCurrSm * 30 + fCurrStack * 6 + fCurrLayer; if (det > -1 && det < 540) { - + if ((fAdcArray = fDigitsManager->GetDigits(det))) { //fAdcArray->Expand(); if (fAdcArray->GetNtime() != fCurrNtimebins) @@ -927,7 +927,7 @@ Int_t AliTRDrawStream::ReadLinkData() else { LinkError(kNoDigits); } - + if (!fDigitsParam) { fDigitsParam = fDigitsManager->GetDigitsParam(); } @@ -936,7 +936,7 @@ Int_t AliTRDrawStream::ReadLinkData() fDigitsParam->SetNTimeBins(det, fCurrNtimebins); fDigitsParam->SetADCbaseline(det, 10); } - + if (fDigitsManager->UsesDictionaries()) { fDigitsManager->GetDictionary(det, 0)->Reset(); fDigitsManager->GetDictionary(det, 1)->Reset(); @@ -951,7 +951,7 @@ Int_t AliTRDrawStream::ReadLinkData() if (!fSignalIndex->IsAllocated()) fSignalIndex->Allocate(16, 144, fCurrNtimebins); } - + // ----- check which kind of data ----- if (fCurrMajor & 0x40) { if ((fCurrMajor & 0x7) == 0x7) { @@ -961,7 +961,7 @@ Int_t AliTRDrawStream::ReadLinkData() *fPayloadCurr != fgkDataEndmarker) fPayloadCurr++; count += fPayloadCurr - startPos; - + // feeding TRAP config AliTRDtrapConfig *trapcfg = AliTRDtrapConfig::Instance(); trapcfg->ReadPackedConfig(fCurrHC, startPos, fPayloadCurr - startPos); @@ -1005,7 +1005,7 @@ Int_t AliTRDrawStream::ReadTracklets() fTrackletArray->Clear(); UInt_t *start = fPayloadCurr; - while (*(fPayloadCurr) != fgkTrackletEndmarker && + while (*(fPayloadCurr) != fgkTrackletEndmarker && fPayloadCurr - fPayloadStart < fPayloadSize) { new ((*fTrackletArray)[fTrackletArray->GetEntriesFast()]) AliTRDtrackletWord(*(fPayloadCurr), fCurrHC); @@ -1013,7 +1013,7 @@ Int_t AliTRDrawStream::ReadTracklets() } if (fTrackletArray->GetEntriesFast() > 0) { - AliDebug(1, Form("Found %i tracklets in %i %i %i (ev. %i)", fTrackletArray->GetEntriesFast(), + AliDebug(1, Form("Found %i tracklets in %i %i %i (ev. %i)", fTrackletArray->GetEntriesFast(), (fCurrEquipmentId-kDDLOffset), fCurrSlot, fCurrLink, fRawReader->GetEventIndex())); if (fCurrSm > -1 && fCurrSm < 18) { fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNTracklets += fTrackletArray->GetEntriesFast(); @@ -1028,10 +1028,10 @@ Int_t AliTRDrawStream::ReadTracklets() } // loop over remaining tracklet endmarkers - while ((*(fPayloadCurr) == fgkTrackletEndmarker && - fPayloadCurr - fPayloadStart < fPayloadSize)) + while ((*(fPayloadCurr) == fgkTrackletEndmarker && + fPayloadCurr - fPayloadStart < fPayloadSize)) fPayloadCurr++; - + return fPayloadCurr - start; } @@ -1056,28 +1056,28 @@ Int_t AliTRDrawStream::ReadHcHeader() fCurrSide = (*fPayloadCurr >> 2) & 0x1; fCurrCheck = (*fPayloadCurr) & 0x3; - if ((fCurrSm != (((Int_t) fCurrEquipmentId) - kDDLOffset)) || - (fCurrStack != fCurrSlot) || - (fCurrLayer != fCurrLink / 2) || + if ((fCurrSm != (((Int_t) fCurrEquipmentId) - kDDLOffset)) || + (fCurrStack != fCurrSlot) || + (fCurrLayer != fCurrLink / 2) || (fCurrSide != fCurrLink % 2)) { LinkError(kHCmismatch, - "HC: %i, %i, %i, %i\n 0x%08x 0x%08x 0x%08x 0x%08x", + "HC: %i, %i, %i, %i\n 0x%08x 0x%08x 0x%08x 0x%08x", fCurrSm, fCurrStack, fCurrLayer, fCurrSide, fPayloadCurr[0], fPayloadCurr[1], fPayloadCurr[2], fPayloadCurr[3]); } if (fCurrCheck != 0x1) { LinkError(kHCcheckFailed); } - + if (fCurrAddHcWords > 0) { fCurrNtimebins = (fPayloadCurr[1] >> 26) & 0x3f; fCurrBC = (fPayloadCurr[1] >> 10) & 0xffff; fCurrPtrgCnt = (fPayloadCurr[1] >> 6) & 0xf; fCurrPtrgPhase = (fPayloadCurr[1] >> 2) & 0xf; } - + fPayloadCurr += 1 + fCurrAddHcWords; - + return (fPayloadCurr - start); } @@ -1100,13 +1100,13 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) UInt_t* start = fPayloadCurr; - while (*(fPayloadCurr) != fgkDataEndmarker && + while (*(fPayloadCurr) != fgkDataEndmarker && fPayloadCurr - fPayloadStart < fPayloadSize - 1) { // ----- Checking MCM Header ----- AliDebug(2, Form("MCM header: 0x%08x", *fPayloadCurr)); mcmcount++; - + // ----- checking for proper readout order - ROB ----- if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) { lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2); @@ -1115,7 +1115,7 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) ROBError(kPosUnexp, Form("#%i after #%i in readout order", GetROBReadoutPos(ROB(*fPayloadCurr) / 2), lastrobpos)); } fCurrRobPos = ROB(*fPayloadCurr); - + // ----- checking for proper readout order - MCM ----- if (GetMCMReadoutPos(MCM(*fPayloadCurr)) >= (lastmcmpos + 1) % 16) { lastmcmpos = GetMCMReadoutPos(MCM(*fPayloadCurr)); @@ -1124,10 +1124,10 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) MCMError(kPosUnexp, Form("#%i after #%i in readout order", GetMCMReadoutPos(MCM(*fPayloadCurr)), lastmcmpos)); } fCurrMcmPos = MCM(*fPayloadCurr); - + fPayloadCurr++; - + evcnt = 0x3f & *fPayloadCurr >> 26; cpu = -1; channelcount = 0; @@ -1138,13 +1138,13 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) expadcval = (1 << 9) | (fCurrRobPos << 6) | (fCurrMcmPos << 2) | cpu; wordcount = 0; } - + while (count < 10) { if (channelcount % 2 == 0) expword = 0x3; - else + else expword = 0x2; - + if (mode == 1) { // ----- TP 1 ----- expword |= expadcval << 2; @@ -1156,14 +1156,14 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) } else if (mode == 2) { // ----- TP 2 ------ - expword = ((0x3f & evcnt) << 26) | ((fCurrSm + 1) << 21) | ((fCurrLayer + 1) << 18) | - ((fCurrStack + 1) << 15) | - (fCurrRobPos << 12) | (fCurrMcmPos << 8) | (cpu << 6) | (wordcount + 1); + expword = ((0x3f & evcnt) << 26) | ((fCurrSm + 1) << 21) | ((fCurrLayer + 1) << 18) | + ((fCurrStack + 1) << 15) | + (fCurrRobPos << 12) | (fCurrMcmPos << 8) | (cpu << 6) | (wordcount + 1); } else if (mode == 3) { // ----- TP 3 ----- - expword = ((0xfff & evcnt) << 20) | (fCurrSm << 15) | (fCurrLink/2 << 12) | (fCurrStack << 9) | - (fCurrRobPos << 6) | (fCurrMcmPos << 2) | (cpu << 0); + expword = ((0xfff & evcnt) << 20) | (fCurrSm << 15) | (fCurrLink/2 << 12) | (fCurrStack << 9) | + (fCurrRobPos << 6) | (fCurrMcmPos << 2) | (cpu << 0); } else { expword = 0; @@ -1173,7 +1173,7 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) diff = *fPayloadCurr ^ expword; if (diff != 0) { MCMError(kTPmismatch, - "Seen 0x%08x, expected 0x%08x, diff: 0x%08x (0x%02x)", + "Seen 0x%08x, expected 0x%08x, diff: 0x%08x (0x%02x)", *fPayloadCurr, expword, diff, 0xff & (diff | diff >> 8 | diff >> 16 | diff >> 24));; } fPayloadCurr++; @@ -1184,16 +1184,16 @@ Int_t AliTRDrawStream::ReadTPData(Int_t mode) } // continue with next MCM } - return fPayloadCurr - start; + return fPayloadCurr - start; } Int_t AliTRDrawStream::ReadZSData() { // read the zs data from one link from the current reading position - + UInt_t *start = fPayloadCurr; - + Int_t mcmcount = 0; Int_t mcmcountExp = fCurrStack == 2 ? 48 : 64; Int_t channelcount = 0; @@ -1207,21 +1207,21 @@ Int_t AliTRDrawStream::ReadZSData() Int_t lastrobpos = -1; if (fCurrNtimebins != fNtimebins) { - if (fNtimebins > 0) + if (fNtimebins > 0) LinkError(kNtimebinsChanged, "No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins); fNtimebins = fCurrNtimebins; } - + timebins = fNtimebins; - - while (*(fPayloadCurr) != fgkDataEndmarker && + + while (*(fPayloadCurr) != fgkDataEndmarker && fPayloadCurr - fPayloadStart < fPayloadSize) { - + // ----- Checking MCM Header ----- AliDebug(2, DumpMcmHeader("MCM header: ", *fPayloadCurr)); UInt_t *startPosMCM = fPayloadCurr; - + // ----- checking for proper readout order - ROB ----- if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) { if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) > lastrobpos) @@ -1233,7 +1233,7 @@ Int_t AliTRDrawStream::ReadZSData() GetROBReadoutPos(ROB(*fPayloadCurr) / 2), lastrobpos, GetROBReadoutPos(fCurrRobPos))); } fCurrRobPos = ROB(*fPayloadCurr); - + // ----- checking for proper readout order - MCM ----- if (GetMCMReadoutPos(MCM(*fPayloadCurr)) > lastmcmpos) { lastmcmpos = GetMCMReadoutPos(MCM(*fPayloadCurr)); @@ -1243,7 +1243,7 @@ Int_t AliTRDrawStream::ReadZSData() GetMCMReadoutPos(MCM(*fPayloadCurr)), lastmcmpos, GetMCMReadoutPos(fCurrMcmPos))); } fCurrMcmPos = MCM(*fPayloadCurr); - + if (EvNo(*fPayloadCurr) != evno) { if (evno == -1) evno = EvNo(*fPayloadCurr); @@ -1255,17 +1255,17 @@ Int_t AliTRDrawStream::ReadZSData() Int_t padcoloff = PadColOffset(*fPayloadCurr); Int_t row = Row(*fPayloadCurr); fPayloadCurr++; - + // ----- Reading ADC channels ----- AliDebug(2, DumpAdcMask("ADC mask: ", *fPayloadCurr)); - + // ----- analysing the ADC mask ----- channelcount = 0; channelcountExp = GetNActiveChannelsFromMask(*fPayloadCurr); channelcountMax = GetNActiveChannels(*fPayloadCurr); Int_t channelmask = GetActiveChannels(*fPayloadCurr); Int_t channelno = -1; - fPayloadCurr++; + fPayloadCurr++; if (channelcountExp != channelcountMax) { if (channelcountExp > channelcountMax) { @@ -1273,89 +1273,89 @@ Int_t AliTRDrawStream::ReadZSData() channelcountExp = channelcountMax; channelcountMax = temp; } - while (channelcountExp < channelcountMax && channelcountExp < 21 && + while (channelcountExp < channelcountMax && channelcountExp < 21 && fPayloadCurr - fPayloadStart < fPayloadSize - 10 * channelcountExp - 1) { MCMError(kAdcMaskInconsistent, - "Possible MCM-H: 0x%08x, possible ADC-mask: 0x%08x", - *(fPayloadCurr + 10 * channelcountExp), + "Possible MCM-H: 0x%08x, possible ADC-mask: 0x%08x", + *(fPayloadCurr + 10 * channelcountExp), *(fPayloadCurr + 10 * channelcountExp + 1) ); - if (!CouldBeMCMhdr( *(fPayloadCurr + 10 * channelcountExp)) && !CouldBeADCmask( *(fPayloadCurr + 10 * channelcountExp + 1))) + if (!CouldBeMCMhdr( *(fPayloadCurr + 10 * channelcountExp)) && !CouldBeADCmask( *(fPayloadCurr + 10 * channelcountExp + 1))) channelcountExp++; else { break; } } MCMError(kAdcMaskInconsistent, - "Inconsistency in no. of active channels: Counter: %i, Mask: %i, chosen: %i!", + "Inconsistency in no. of active channels: Counter: %i, Mask: %i, chosen: %i!", GetNActiveChannels(fPayloadCurr[-1]), GetNActiveChannelsFromMask(fPayloadCurr[-1]), channelcountExp); } AliDebug(2, Form("expecting %i active channels, %i timebins", channelcountExp, fCurrNtimebins)); - + // ----- reading marked ADC channels ----- while (channelcount < channelcountExp && *(fPayloadCurr) != fgkDataEndmarker) { if (channelno < 20) channelno++; while (channelno < 20 && (channelmask & 1 << channelno) == 0) channelno++; - + if (fCurrNtimebins > 30) { currentTimebin = ((*fPayloadCurr >> 2) & 0x3f); timebins = ((*fPayloadCurr >> 8) & 0xf) * 3; - } + } else { currentTimebin = 0; } - + adcwc = 0; AliDebug(3, Form("Now reading %i words for channel %2i", timebins / 3, channelno)); Int_t adccol = adccoloff - channelno; Int_t padcol = padcoloff - channelno; -// if (adccol < 3 || adccol > 165) -// AliInfo(Form("writing channel %i of det %3i %i:%2i to adcrow/-col: %i/%i padcol: %i", +// if (adccol < 3 || adccol > 165) +// AliInfo(Form("writing channel %i of det %3i %i:%2i to adcrow/-col: %i/%i padcol: %i", // channelno, fCurrHC/2, fCurrRobPos, fCurrMcmPos, row, adccol, padcol)); - while (adcwc < timebins / 3 && - *(fPayloadCurr) != fgkDataEndmarker && + while (adcwc < timebins / 3 && + *(fPayloadCurr) != fgkDataEndmarker && fPayloadCurr - fPayloadStart < fPayloadSize) { int check = 0x3 & *fPayloadCurr; if (channelno % 2 != 0) { // odd channel if (check != 0x2 && channelno < 21) { MCMError(kAdcCheckInvalid, - "%i for %2i. ADC word in odd channel %i", + "%i for %2i. ADC word in odd channel %i", check, adcwc+1, channelno); } } else { // even channel if (check != 0x3 && channelno < 21) { MCMError(kAdcCheckInvalid, - "%i for %2i. ADC word in even channel %i", + "%i for %2i. ADC word in even channel %i", check, adcwc+1, channelno); } } - + // filling the actual timebin data int tb2 = 0x3ff & *fPayloadCurr >> 22; int tb1 = 0x3ff & *fPayloadCurr >> 12; int tb0 = 0x3ff & *fPayloadCurr >> 2; - if (adcwc != 0 || fCurrNtimebins <= 30) + if (adcwc != 0 || fCurrNtimebins <= 30) fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb0); else tb0 = -1; fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb1); fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb2); - + adcwc++; fPayloadCurr++; } - - if (adcwc != timebins / 3) + + if (adcwc != timebins / 3) MCMError(kAdcDataAbort); - - // adding index + + // adding index if (padcol > 0 && padcol < 144) { fSignalIndex->AddIndexRC(row, padcol); } - + channelcount++; } @@ -1365,7 +1365,7 @@ Int_t AliTRDrawStream::ReadZSData() } if (channelcount != channelcountExp) MCMError(kAdcChannelsMiss); - + mcmcount++; if (fCurrSm > -1 && fCurrSm < 18) { fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNMCMs++; @@ -1383,7 +1383,7 @@ Int_t AliTRDrawStream::ReadZSData() // check for missing MCMs (if header suppression is inactive) if (((fCurrMajor & 0x1) == 0) && (mcmcount != mcmcountExp)) { LinkError(kMissMcmHeaders, - "No. of MCM headers %i not as expected: %i", + "No. of MCM headers %i not as expected: %i", mcmcount, mcmcountExp); } @@ -1393,9 +1393,9 @@ Int_t AliTRDrawStream::ReadZSData() Int_t AliTRDrawStream::ReadNonZSData() { // read the non-zs data from one link from the current reading position - + UInt_t *start = fPayloadCurr; - + Int_t mcmcount = 0; Int_t mcmcountExp = fCurrStack == 2 ? 48 : 64; Int_t channelcount = 0; @@ -1408,20 +1408,20 @@ Int_t AliTRDrawStream::ReadNonZSData() Int_t lastrobpos = -1; if (fCurrNtimebins != fNtimebins) { - if (fNtimebins > 0) + if (fNtimebins > 0) LinkError(kNtimebinsChanged, "No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins); fNtimebins = fCurrNtimebins; } - + timebins = fNtimebins; - - while (*(fPayloadCurr) != fgkDataEndmarker && + + while (*(fPayloadCurr) != fgkDataEndmarker && fPayloadCurr - fPayloadStart < fPayloadSize - 2) { - + // ----- Checking MCM Header ----- AliDebug(2, Form("MCM header: 0x%08x", *fPayloadCurr)); - + // ----- checking for proper readout order - ROB ----- if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) { lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2); @@ -1430,7 +1430,7 @@ Int_t AliTRDrawStream::ReadNonZSData() ROBError(kPosUnexp, Form("#%i after #%i in readout order", GetROBReadoutPos(ROB(*fPayloadCurr) / 2), lastrobpos)); } fCurrRobPos = ROB(*fPayloadCurr); - + // ----- checking for proper readout order - MCM ----- if (GetMCMReadoutPos(MCM(*fPayloadCurr)) >= (lastmcmpos + 1) % 16) { lastmcmpos = GetMCMReadoutPos(MCM(*fPayloadCurr)); @@ -1439,7 +1439,7 @@ Int_t AliTRDrawStream::ReadNonZSData() MCMError(kPosUnexp, Form("#%i after #%i in readout order", GetMCMReadoutPos(MCM(*fPayloadCurr)), lastmcmpos)); } fCurrMcmPos = MCM(*fPayloadCurr); - + if (EvNo(*fPayloadCurr) != evno) { if (evno == -1) evno = EvNo(*fPayloadCurr); @@ -1447,7 +1447,7 @@ Int_t AliTRDrawStream::ReadNonZSData() MCMError(kPtrgCntMismatch, "%i <-> %i", evno, EvNo(*fPayloadCurr)); } } - + channelcount = 0; channelcountExp = 21; int channelno = -1; @@ -1459,41 +1459,41 @@ Int_t AliTRDrawStream::ReadNonZSData() fPayloadCurr++; // ----- reading marked ADC channels ----- - while (channelcount < channelcountExp && + while (channelcount < channelcountExp && *(fPayloadCurr) != fgkDataEndmarker) { if (channelno < 20) channelno++; - + currentTimebin = 0; - + adcwc = 0; AliDebug(2, Form("Now looking %i words", timebins / 3)); Int_t adccol = adccoloff - channelno; Int_t padcol = padcoloff - channelno; - while (adcwc < timebins / 3 && - *(fPayloadCurr) != fgkDataEndmarker && + while (adcwc < timebins / 3 && + *(fPayloadCurr) != fgkDataEndmarker && fPayloadCurr - fPayloadStart < fPayloadSize) { int check = 0x3 & *fPayloadCurr; if (channelno % 2 != 0) { // odd channel if (check != 0x2 && channelno < 21) { MCMError(kAdcCheckInvalid, - "%i for %2i. ADC word in odd channel %i", + "%i for %2i. ADC word in odd channel %i", check, adcwc+1, channelno); } } else { // even channel if (check != 0x3 && channelno < 21) { MCMError(kAdcCheckInvalid, - "%i for %2i. ADC word in even channel %i", + "%i for %2i. ADC word in even channel %i", check, adcwc+1, channelno); } } - + // filling the actual timebin data int tb2 = 0x3ff & *fPayloadCurr >> 22; int tb1 = 0x3ff & *fPayloadCurr >> 12; int tb0 = 0x3ff & *fPayloadCurr >> 2; - if (adcwc != 0 || fCurrNtimebins <= 30) + if (adcwc != 0 || fCurrNtimebins <= 30) fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb0); else tb0 = -1; @@ -1504,10 +1504,10 @@ Int_t AliTRDrawStream::ReadNonZSData() fPayloadCurr++; } - if (adcwc != timebins / 3) + if (adcwc != timebins / 3) MCMError(kAdcDataAbort); - - // adding index + + // adding index if (padcol > 0 && padcol < 144) { fSignalIndex->AddIndexRC(row, padcol); } @@ -1549,22 +1549,22 @@ Int_t AliTRDrawStream::SeekNextLink() return (fPayloadCurr - start); } -Bool_t AliTRDrawStream::ConnectTracklets(TTree *trklTree) +Bool_t AliTRDrawStream::ConnectTracklets(TTree *trklTree) { // connect the tracklet tree used to store the tracklet output fTrackletTree = trklTree; - if (!fTrackletTree) + if (!fTrackletTree) return kTRUE; - if (!fTrackletTree->GetBranch("hc")) + if (!fTrackletTree->GetBranch("hc")) fTrackletTree->Branch("hc", &fCurrHC, "hc/I"); - else + else fTrackletTree->SetBranchAddress("hc", &fCurrHC); - if (!fTrackletTree->GetBranch("trkl")) + if (!fTrackletTree->GetBranch("trkl")) fTrackletTree->Branch("trkl", &fTrackletArray); - else + else fTrackletTree->SetBranchAddress("trkl", &fTrackletArray); return kTRUE; @@ -1572,8 +1572,8 @@ Bool_t AliTRDrawStream::ConnectTracklets(TTree *trklTree) void AliTRDrawStream::EquipmentError(ErrorCode_t err, const char *const msg, ...) -{ - // register error according to error code on equipment level +{ + // register error according to error code on equipment level // and return the corresponding error message fLastError.fSector = fCurrEquipmentId - kDDLOffset; @@ -1585,22 +1585,22 @@ void AliTRDrawStream::EquipmentError(ErrorCode_t err, const char *const msg, ... (this->*fStoreError)(); va_list ap; - if (fgErrorDebugLevel[err] > 10) + if (fgErrorDebugLevel[err] > 10) AliDebug(fgErrorDebugLevel[err], - Form("Event %6i: Eq. %2d - %s : %s", + Form("Event %6i: Eq. %2d - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); - else - AliError(Form("Event %6i: Eq. %2d - %s : %s", + else + AliError(Form("Event %6i: Eq. %2d - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); fErrorFlags |= fgErrorBehav[err]; -} +} void AliTRDrawStream::StackError(ErrorCode_t err, const char *const msg, ...) -{ - // register error according to error code on stack level +{ + // register error according to error code on stack level // and return the corresponding error message fLastError.fSector = fCurrEquipmentId - kDDLOffset; @@ -1612,22 +1612,22 @@ void AliTRDrawStream::StackError(ErrorCode_t err, const char *const msg, ...) (this->*fStoreError)(); va_list ap; - if (fgErrorDebugLevel[err] > 0) - AliDebug(fgErrorDebugLevel[err], - Form("Event %6i: Eq. %2d S %i - %s : %s", + if (fgErrorDebugLevel[err] > 0) + AliDebug(fgErrorDebugLevel[err], + Form("Event %6i: Eq. %2d S %i - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); - else - AliError(Form("Event %6i: Eq. %2d S %i - %s : %s", + else + AliError(Form("Event %6i: Eq. %2d S %i - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); fErrorFlags |= fgErrorBehav[err]; -} +} void AliTRDrawStream::LinkError(ErrorCode_t err, const char *const msg, ...) -{ - // register error according to error code on link level +{ + // register error according to error code on link level // and return the corresponding error message fLastError.fSector = fCurrEquipmentId - kDDLOffset; @@ -1640,21 +1640,21 @@ void AliTRDrawStream::LinkError(ErrorCode_t err, const char *const msg, ...) va_list ap; if (fgErrorDebugLevel[err] > 0) - AliDebug(fgErrorDebugLevel[err], - Form("Event %6i: Eq. %2d S %i l %2i - %s : %s", + AliDebug(fgErrorDebugLevel[err], + Form("Event %6i: Eq. %2d S %i l %2i - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); - else - AliError(Form("Event %6i: Eq. %2d S %i l %2i - %s : %s", + else + AliError(Form("Event %6i: Eq. %2d S %i l %2i - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); fErrorFlags |= fgErrorBehav[err]; -} +} void AliTRDrawStream::ROBError(ErrorCode_t err, const char *const msg, ...) -{ - // register error according to error code on ROB level +{ + // register error according to error code on ROB level // and return the corresponding error message fLastError.fSector = fCurrEquipmentId - kDDLOffset; @@ -1666,22 +1666,22 @@ void AliTRDrawStream::ROBError(ErrorCode_t err, const char *const msg, ...) (this->*fStoreError)(); va_list ap; - if (fgErrorDebugLevel[err] > 0) - AliDebug(fgErrorDebugLevel[err], - Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s", + if (fgErrorDebugLevel[err] > 0) + AliDebug(fgErrorDebugLevel[err], + Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s", fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); - else - AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s", - fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err], + else + AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s", + fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); fErrorFlags |= fgErrorBehav[err]; -} +} void AliTRDrawStream::MCMError(ErrorCode_t err, const char *const msg, ...) -{ - // register error according to error code on MCM level +{ + // register error according to error code on MCM level // and return the corresponding error message fLastError.fSector = fCurrEquipmentId - kDDLOffset; @@ -1693,27 +1693,27 @@ void AliTRDrawStream::MCMError(ErrorCode_t err, const char *const msg, ...) (this->*fStoreError)(); va_list ap; - if (fgErrorDebugLevel[err] > 0) - AliDebug(fgErrorDebugLevel[err], + if (fgErrorDebugLevel[err] > 0) + AliDebug(fgErrorDebugLevel[err], Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : %s", - fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err], + fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); - else + else AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : %s", - fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err], + fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err], (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) )); fErrorFlags |= fgErrorBehav[err]; } const char* AliTRDrawStream::GetErrorMessage(ErrorCode_t errCode) -{ +{ // return the error message for the given error code - if (errCode > 0 && errCode < kLastErrorCode) + if (errCode > 0 && errCode < kLastErrorCode) return fgkErrorMessages[errCode]; - else - return ""; -} + else + return ""; +} void AliTRDrawStream::AliTRDrawStats::ClearStats() { @@ -1753,11 +1753,11 @@ void AliTRDrawStream::AliTRDrawStats::AliTRDrawStatsSector::AliTRDrawStatsHC::Cl } void AliTRDrawStream::SetDumpMCM(Int_t det, Int_t rob, Int_t mcm, Bool_t dump) -{ +{ // mark MCM for dumping of raw data if (dump) { - fDumpMCM[fNDumpMCMs++] = (det << 7) | (rob << 4) | mcm; + fDumpMCM[fNDumpMCMs++] = (det << 7) | (rob << 4) | mcm; } else { Int_t iMCM; @@ -1795,25 +1795,25 @@ TString AliTRDrawStream::DumpRaw(TString title, UInt_t *start, Int_t length, UIn if ((start[pos+1] != endmarker && pos+1 < length)) if ((start[pos+2] != endmarker && pos+2 < length)) if ((start[pos+3] != endmarker && pos+3 < length)) - title += Form(" 0x%08x 0x%08x 0x%08x 0x%08x\n", + title += Form(" 0x%08x 0x%08x 0x%08x 0x%08x\n", start[pos+0], start[pos+1], start[pos+2], start[pos+3]); else { - title += Form(" 0x%08x 0x%08x 0x%08x 0x%08x\n", + title += Form(" 0x%08x 0x%08x 0x%08x 0x%08x\n", start[pos+0], start[pos+1], start[pos+2], start[pos+3]); return title; } else { - title += Form(" 0x%08x 0x%08x 0x%08x\n", + title += Form(" 0x%08x 0x%08x 0x%08x\n", start[pos+0], start[pos+1], start[pos+2]); return title; } else { - title += Form(" 0x%08x 0x%08x\n", + title += Form(" 0x%08x 0x%08x\n", start[pos+0], start[pos+1]); return title; } else { - title += Form(" 0x%08x\n", + title += Form(" 0x%08x\n", start[pos+0]); return title; } @@ -1835,11 +1835,11 @@ TString AliTRDrawStream::DumpAdcMask(TString title, UInt_t word) return title; } -AliTRDrawStream::AliTRDrawStreamError::AliTRDrawStreamError(Int_t error, Int_t sector, Int_t stack, Int_t link, Int_t rob, Int_t mcm) : +AliTRDrawStream::AliTRDrawStreamError::AliTRDrawStreamError(Int_t error, Int_t sector, Int_t stack, Int_t link, Int_t rob, Int_t mcm) : fError(error), fSector(sector), fStack(stack), - fLink(link), + fLink(link), fRob(rob), fMcm(mcm) { diff --git a/TRD/AliTRDrawStream.h b/TRD/AliTRDrawStream.h index a8d56a5b3b2..bd9d71d52ff 100644 --- a/TRD/AliTRDrawStream.h +++ b/TRD/AliTRDrawStream.h @@ -3,7 +3,7 @@ //----------------------------------- // -// decoding of TRD raw data stream +// decoding of TRD raw data stream // and translation into digits // //---------------------------------- @@ -53,7 +53,7 @@ class AliTRDrawStream : public TObject Bool_t ReadEvent(TTree *trackletTree = 0x0); Bool_t NextDDL(); - Int_t NextChamber(AliTRDdigitsManager *digMgr); + Int_t NextChamber(AliTRDdigitsManager *digMgr); Int_t NextChamber(AliTRDdigitsManager *digMgr, UInt_t ** /* trackletContainer */, UShort_t ** /* errorContainer */) { AliError("Deprecated, use NextChamber(AliTRDdigitsManger*) instead!"); return NextChamber(digMgr); } @@ -65,10 +65,10 @@ class AliTRDrawStream : public TObject void DisableErrorStorage() { fStoreError = &AliTRDrawStream::ForgetError; } // error handling - enum ErrorCode_t { - kUnknown = 0, - kLinkMonitor, - kPtrgCntMismatch, + enum ErrorCode_t { + kUnknown = 0, + kLinkMonitor, + kPtrgCntMismatch, kNonTrdEq, kStackHeaderInvalid, kInvalidDetector, @@ -85,11 +85,11 @@ class AliTRDrawStream : public TObject kAdcChannelsMiss, kMissMcmHeaders, kLastErrorCode - }; + }; enum ErrorBehav_t { kTolerate = 0, - kAbort = 1, + kAbort = 1, kDiscardMCM = 2, kDiscardHC = 4 }; @@ -106,7 +106,7 @@ class AliTRDrawStream : public TObject class AliTRDrawStreamError : public TObject { public: - AliTRDrawStreamError(Int_t error = 0, Int_t sector = -1, Int_t stack = -1, Int_t link = -1, Int_t rob = -1, Int_t mcm = -1); + AliTRDrawStreamError(Int_t error = 0, Int_t sector = -1, Int_t stack = -1, Int_t link = -1, Int_t rob = -1, Int_t mcm = -1); virtual ~AliTRDrawStreamError() {} Int_t fError; // error code Int_t fSector; // sector @@ -169,7 +169,7 @@ class AliTRDrawStream : public TObject Bool_t IsDumping() const { return (fNDumpMCMs > 0); } Bool_t DumpingMCM(Int_t det, Int_t rob, Int_t mcm) const; - TString DumpRaw(TString title, UInt_t *start, Int_t length, UInt_t endmarker = 0xffffffff); + TString DumpRaw(TString title, UInt_t *start, Int_t length, UInt_t endmarker = 0xffffffff); TString DumpMcmHeader(TString title, UInt_t word); TString DumpAdcMask(TString title, UInt_t word); @@ -213,13 +213,13 @@ class AliTRDrawStream : public TObject inline Int_t GetNActiveChannelsFromMask(UInt_t adcmask) const; // { Int_t nch = 0; for (Int_t i = 0; i < 21; i++) if ((GetActiveChannels(adcmask) & 1 << i)) nch++; return nch; } Int_t GetNActiveChannels(UInt_t adcmask) const { return (0x1f & ~(adcmask >> 25)); } Int_t CouldBeADCmask(UInt_t adcmask) const { return ((0xf & adcmask) == 0xc && (0x3 & adcmask >> 30) == 0x1); } - + // error message generation - void EquipmentError(ErrorCode_t err = kUnknown, const char *const msg = "", ...); - void StackError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); - void LinkError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); - void ROBError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); - void MCMError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); + void EquipmentError(ErrorCode_t err = kUnknown, const char *const msg = "", ...); + void StackError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); + void LinkError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); + void ROBError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); + void MCMError (ErrorCode_t err = kUnknown, const char *const msg = "", ...); void StoreErrorTree() { fErrors->Fill(); } void StoreErrorArray() { new ((*fMarkers)[fMarkers->GetEntriesFast()]) AliTRDrawStreamError(fLastError); } void ForgetError() { return; } @@ -230,7 +230,7 @@ class AliTRDrawStream : public TObject static ErrorBehav_t fgErrorBehav[kLastErrorCode]; // bevhaviour in case of error of given type // I/O - AliRawReader *fRawReader; // pointer to the raw reader to take the data from + AliRawReader *fRawReader; // pointer to the raw reader to take the data from AliTRDdigitsManager *fDigitsManager; // pointer to the digitsManager to fill the data AliTRDdigitsParam *fDigitsParam; // pointer to the parameters belonging to the digits @@ -247,19 +247,19 @@ class AliTRDrawStream : public TObject static const Int_t fgkNsectors; // number of sectors static const Int_t fgkNstacks; // number of stacks to read static const Int_t fgkNtriggers; // number of triggers in data stream - static const UInt_t fgkDataEndmarker; // data endmarker + static const UInt_t fgkDataEndmarker; // data endmarker static const UInt_t fgkTrackletEndmarker; // tracklet endmarker static Int_t fgMcmOrder []; // expected readout order of the MCMs static Int_t fgRobOrder []; // expected readout order of the ROBs // persistent information Int_t fNtimebins; // number of timebins - Int_t fLastEvId; // Event ID of last event + Int_t fLastEvId; // Event ID of last event // information valid at current reader position // all the variables fCurr... refer to the value at the current // reading position - Int_t fCurrSlot; // current slot + Int_t fCurrSlot; // current slot Int_t fCurrLink; // current link Int_t fCurrRobPos; // current ROB number Int_t fCurrMcmPos; // current MCM number diff --git a/TRD/AliTRDtrackGTU.cxx b/TRD/AliTRDtrackGTU.cxx index 52e7d69ab31..9ade791e634 100644 --- a/TRD/AliTRDtrackGTU.cxx +++ b/TRD/AliTRDtrackGTU.cxx @@ -37,7 +37,7 @@ #include "AliESDTrdTrack.h" ClassImp(AliTRDtrackGTU) - + AliTRDtrackGTU::AliTRDtrackGTU() : TObject(), fStack(-1), @@ -71,7 +71,7 @@ AliTRDtrackGTU::~AliTRDtrackGTU() delete fTracklets; } -void AliTRDtrackGTU::AddTracklet(const AliTRDtrackletGTU * const tracklet, Int_t layer) +void AliTRDtrackGTU::AddTracklet(const AliTRDtrackletGTU * const tracklet, Int_t layer) { // add a tracklet to this track @@ -85,13 +85,13 @@ void AliTRDtrackGTU::AddTracklet(const AliTRDtrackletGTU * const tracklet, Int_t fTrackletMask |= (1 << layer); } -AliTRDtrackletGTU* AliTRDtrackGTU::GetTracklet(Int_t layer) +AliTRDtrackletGTU* AliTRDtrackGTU::GetTracklet(Int_t layer) { // get a pointer to the tracklet in the layer specified if (IsTrackletInLayer(layer)) return ((AliTRDtrackletGTU*) (*fTracklets)[layer]); - else + else return 0x0; } @@ -102,26 +102,26 @@ Int_t AliTRDtrackGTU::GetNTracklets() const return fNTracklets; } -Bool_t AliTRDtrackGTU::IsTrackletInLayer(Int_t layer) const +Bool_t AliTRDtrackGTU::IsTrackletInLayer(Int_t layer) const { // checks for a tracklet in the given layer if ( (GetTrackletMask() & (1 << layer)) != 0) return kTRUE; - else + else return kFALSE; } -void AliTRDtrackGTU::SetFitParams(Float_t a, Float_t b, Float_t c) +void AliTRDtrackGTU::SetFitParams(Float_t a, Float_t b, Float_t c) { // set the fit parameters - fA = a; + fA = a; fB = b; fC = c; } -Int_t AliTRDtrackGTU::GetZSubChannel() +Int_t AliTRDtrackGTU::GetZSubChannel() { // returns the z-subchannel @@ -135,11 +135,11 @@ Int_t AliTRDtrackGTU::GetZSubChannel() return fZSubChannel; } -Int_t AliTRDtrackGTU::GetYapprox() +Int_t AliTRDtrackGTU::GetYapprox() { // returns an approximated y-position for the track - for (Int_t layer = 0; layer < AliTRDgtuParam::GetNLayers(); layer++) + for (Int_t layer = 0; layer < AliTRDgtuParam::GetNLayers(); layer++) { if (IsTrackletInLayer(layer)) return ((AliTRDtrackletGTU*) (*fTracklets)[layer])->GetYProj(); @@ -159,7 +159,7 @@ AliESDTrdTrack* AliTRDtrackGTU::CreateTrdTrack() const return trk; } -Bool_t AliTRDtrackGTU::CookLabel() +Bool_t AliTRDtrackGTU::CookLabel() { TH1F *h = new TH1F("trkref", "trkref", 100000, 0, 100000); for (Int_t iTracklet = 0; iTracklet < 6; iTracklet++) { @@ -169,7 +169,7 @@ Bool_t AliTRDtrackGTU::CookLabel() } if (h->GetEntries() > 0) fLabel = h->GetMaximumBin() - 1; - else + else fLabel = -1; delete h; return (fLabel >= 0); diff --git a/TRD/AliTRDtrackGTU.h b/TRD/AliTRDtrackGTU.h index 302aa7694c4..fe557d0c4d0 100644 --- a/TRD/AliTRDtrackGTU.h +++ b/TRD/AliTRDtrackGTU.h @@ -35,7 +35,7 @@ class AliTRDtrackGTU : public TObject { Int_t GetNTracklets() const; Int_t GetTrackletMask() const { return fTrackletMask; } Bool_t IsTrackletInLayer(Int_t layer) const; - Int_t GetTrackletIndex(Int_t layer) { return IsTrackletInLayer(layer) ? ((AliTRDtrackletGTU*) (*fTracklets)[layer])->GetIndex() : -1; } + Int_t GetTrackletIndex(Int_t layer) { return IsTrackletInLayer(layer) ? ((AliTRDtrackletGTU*) (*fTracklets)[layer])->GetIndex() : -1; } AliTRDtrackletGTU* GetTracklet(Int_t layer); // ----- Quantities used internally for the calculation diff --git a/TRD/AliTRDtrackletBase.cxx b/TRD/AliTRDtrackletBase.cxx index b1860371bcb..4cf9c928057 100644 --- a/TRD/AliTRDtrackletBase.cxx +++ b/TRD/AliTRDtrackletBase.cxx @@ -31,4 +31,4 @@ ClassImp(AliTRDtrackletBase) //_____________________________________________________________________________ - + diff --git a/TRD/AliTRDtrackletBase.h b/TRD/AliTRDtrackletBase.h index ee9a9ff4091..f200305bf89 100644 --- a/TRD/AliTRDtrackletBase.h +++ b/TRD/AliTRDtrackletBase.h @@ -2,7 +2,7 @@ #define ALITRDTRACKLETBASE_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ + * See cxx source for full Copyright notice */ /* $Id: AliTRDtrackletBase.h 26327 2008-06-02 15:36:18Z cblume $ */ @@ -28,33 +28,33 @@ class AliTRDtrackletBase : public TObject { AliTRDtrackletBase() : TObject() {} AliTRDtrackletBase(const AliTRDtrackletBase &o) : TObject(o) {} virtual ~AliTRDtrackletBase() {} - + virtual Bool_t CookPID() = 0; - + virtual Int_t GetDetector() const = 0 ; - virtual Float_t GetX() const = 0; - virtual Float_t GetY() const = 0; + virtual Float_t GetX() const = 0; + virtual Float_t GetY() const = 0; virtual Float_t GetZ() const = 0; - virtual Float_t GetdYdX() const = 0; + virtual Float_t GetdYdX() const = 0; virtual Float_t GetdZdX() const { return 0; } virtual Int_t GetdY() const = 0; // in units of 140um - virtual Int_t GetYbin() const = 0; // in units of 160um + virtual Int_t GetYbin() const = 0; // in units of 160um virtual Int_t GetZbin() const = 0; // in pad length units virtual Double_t GetPID(Int_t is=-1) const = 0; - + virtual void LocalToGlobal(Float_t&, Float_t&, Float_t&, Float_t&) {} virtual void Print(Option_t * /*option=""*/) const {} - - virtual UInt_t GetTrackletWord() const = 0; - - virtual void SetDetector(Int_t id) = 0; - + + virtual UInt_t GetTrackletWord() const = 0; + + virtual void SetDetector(Int_t id) = 0; + protected: - + ClassDef(AliTRDtrackletBase, 1); // Base class for TRD on- and offline tracklets }; diff --git a/TRD/AliTRDtrackletGTU.cxx b/TRD/AliTRDtrackletGTU.cxx index 070cc443c40..8212286ca7d 100644 --- a/TRD/AliTRDtrackletGTU.cxx +++ b/TRD/AliTRDtrackletGTU.cxx @@ -41,7 +41,7 @@ AliTRDtrackletBase* AliTRDtrackletGTU::fgkDummyTracklet = new AliTRDtrackletWord AliTRDtrackletGTU::AliTRDtrackletGTU() : AliTRDtrackletBase(), fGtuParam(AliTRDgtuParam::Instance()), - fTracklet(0x0), //fgkDummyTracklet), + fTracklet(0x0), //fgkDummyTracklet), fSubChannel(0x0), fAssignedZ(kFALSE), fAlpha(0), @@ -52,14 +52,14 @@ AliTRDtrackletGTU::AliTRDtrackletGTU() : // ctor for any tracklet deriving from AliTRDtrackletBase fSubChannel = new Int_t[fGtuParam->GetNZChannels()]; - for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) + for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) fSubChannel[zch] = 0; } AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) : AliTRDtrackletBase(*tracklet), fGtuParam(AliTRDgtuParam::Instance()), - fTracklet(0x0), + fTracklet(0x0), fSubChannel(0x0), fAssignedZ(kFALSE), fAlpha(0), @@ -70,7 +70,7 @@ AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) : // ctor for any tracklet deriving from AliTRDtrackletBase fSubChannel = new Int_t[fGtuParam->GetNZChannels()]; - for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) + for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) fSubChannel[zch] = 0; fTracklet = tracklet; if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) { @@ -81,18 +81,18 @@ AliTRDtrackletGTU::AliTRDtrackletGTU(AliTRDtrackletBase *tracklet) : AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) : AliTRDtrackletBase(tracklet), fGtuParam(AliTRDgtuParam::Instance()), - fTracklet(tracklet.fTracklet), + fTracklet(tracklet.fTracklet), fSubChannel(0x0), fAssignedZ(tracklet.fAssignedZ), fAlpha(tracklet.fAlpha), fYProj(tracklet.fYProj), - fYPrime(tracklet.fYPrime), + fYPrime(tracklet.fYPrime), fIndex(tracklet.fIndex) { // copy ctor fSubChannel = new Int_t[fGtuParam->GetNZChannels()]; - for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) + for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) fSubChannel[zch] = tracklet.fSubChannel[zch]; } @@ -102,7 +102,7 @@ AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs) if (&rhs != this) { fTracklet = rhs.fTracklet; - for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) + for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) fSubChannel[zch] = rhs.fSubChannel[zch]; fIndex = rhs.fIndex; fYPrime = rhs.fYPrime; @@ -110,15 +110,15 @@ AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs) fAlpha = rhs.fAlpha; fAssignedZ = rhs.fAssignedZ; } - + return *this; } -AliTRDtrackletGTU::~AliTRDtrackletGTU() +AliTRDtrackletGTU::~AliTRDtrackletGTU() { // dtor if (fSubChannel) - delete [] fSubChannel; + delete [] fSubChannel; fTracklet = 0x0; } @@ -128,7 +128,7 @@ Int_t AliTRDtrackletGTU::Compare(const TObject *o) const { // must be changed to Z-channel, Y_proj // will be changed - if (!o) + if (!o) return 0; if (!o->InheritsFrom("AliTRDtrackletGTU")) { @@ -137,36 +137,36 @@ Int_t AliTRDtrackletGTU::Compare(const TObject *o) const { } if (!fAssignedZ) { - if ( GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin()) + if ( GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin()) return -1; - else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin()) + else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin()) return 1; - else + else if (GetYbin() < ((AliTRDtrackletGTU*) o)->GetYbin()) return -1; else if (GetYbin() > ((AliTRDtrackletGTU*) o)->GetYbin()) return 1; - else + else return 0; } else { // sorting should be according to zsubindex, not to Z !!! // therefore this depends on the zch - if (GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin()) + if (GetZbin() < ((AliTRDtrackletGTU*) o)->GetZbin()) return -1; - else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin()) + else if (GetZbin() > ((AliTRDtrackletGTU*) o)->GetZbin()) return 1; - else + else if (GetYProj() < ((AliTRDtrackletGTU*) o)->GetYProj()) return -1; else if (GetYProj() > ((AliTRDtrackletGTU*) o)->GetYProj()) return 1; - else + else return 0; } } -void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch) +void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch) { // set the subchannel in the given z-channel fAssignedZ = kTRUE; @@ -190,24 +190,24 @@ Int_t AliTRDtrackletGTU::GetLabel() const } /* -Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer) +Float_t AliTRDtrackletGTU::GetPhysX(Int_t layer) { // get the x-position (in the local system) assuming the tracklet is in the given layer return fGtuParam->GetGeo()->GetTime0(layer); } -Float_t AliTRDtrackletGTU::GetPhysY() +Float_t AliTRDtrackletGTU::GetPhysY() { - // - return GetYbin() * 0.0160; + // + return GetYbin() * 0.0160; } -Float_t AliTRDtrackletGTU::GetPhysAlpha() +Float_t AliTRDtrackletGTU::GetPhysAlpha() { return GetAlpha() * 0.01; // wrong factor! } -Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer) +Float_t AliTRDtrackletGTU::GetPhysZ(Int_t stack, Int_t layer) { return fGtuParam->GetGeo()->GetPadPlane(layer, stack)->GetRowPos(GetZbin()); // not the middle of a pad! } diff --git a/TRD/AliTRDtrackletGTU.h b/TRD/AliTRDtrackletGTU.h index 6ac20092cfb..e6744d33ea1 100644 --- a/TRD/AliTRDtrackletGTU.h +++ b/TRD/AliTRDtrackletGTU.h @@ -6,9 +6,9 @@ /* $Id: AliTRDtrackletGTU.h 27496 2008-07-22 08:35:45Z cblume $ */ // -------------------------------------------------------- -// +// // GTU tracklet -// +// // // -------------------------------------------------------- @@ -20,12 +20,12 @@ class AliTRDgtuParam; class AliTRDtrackletGTU : public AliTRDtrackletBase { public: AliTRDtrackletGTU(); - AliTRDtrackletGTU(AliTRDtrackletBase *tracklet); + AliTRDtrackletGTU(AliTRDtrackletBase *tracklet); AliTRDtrackletGTU(const AliTRDtrackletGTU& trk); ~AliTRDtrackletGTU(); - AliTRDtrackletGTU& operator=(const AliTRDtrackletGTU &rhs); + AliTRDtrackletGTU& operator=(const AliTRDtrackletGTU &rhs); Bool_t IsSortable() const { return kTRUE; } Int_t Compare(const TObject *o) const; @@ -56,7 +56,7 @@ class AliTRDtrackletGTU : public AliTRDtrackletBase { // AliTRDtrackletBase* GetTracklet() const { return fTracklet; } UInt_t GetTrackletWord() const { return fTracklet->GetTrackletWord(); } - Int_t GetSide() const { return GetYbin() < 0 ? 0 : 1; } + Int_t GetSide() const { return GetYbin() < 0 ? 0 : 1; } Int_t GetLabel() const; // { return fLabel; } diff --git a/TRD/AliTRDtrackletMCM.cxx b/TRD/AliTRDtrackletMCM.cxx index df3a8911470..ff4cbfda642 100644 --- a/TRD/AliTRDtrackletMCM.cxx +++ b/TRD/AliTRDtrackletMCM.cxx @@ -32,9 +32,9 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord) : AliTRDtrackletBase(), fGeo(0x0), fHCId(-1), - fTrackletWord(trackletWord), - fMCM(-1), - fROB(-1), + fTrackletWord(trackletWord), + fMCM(-1), + fROB(-1), fQ0(0), fQ1(0), fNHits(0), @@ -46,7 +46,7 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord) : fNClusters(0), fResiduals(0x0), fClsCharges(0x0) -{ +{ fGeo = new AliTRDgeometry(); fLabel[0] = -1; fLabel[1] = -1; @@ -57,7 +57,7 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) : AliTRDtrackletBase(), fGeo(0x0), fHCId(hcid), - fTrackletWord(trackletWord), + fTrackletWord(trackletWord), fMCM(-1), fROB(-1), fQ0(0), @@ -71,7 +71,7 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) : fNClusters(0), fResiduals(0x0), fClsCharges(0x0) -{ +{ fGeo = new AliTRDgeometry(); fLabel[0] = -1; fLabel[1] = -1; @@ -82,7 +82,7 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, AliTRDtrackletBase(), fGeo(0x0), fHCId(hcid), - fTrackletWord(trackletWord), + fTrackletWord(trackletWord), fMCM(mcm), fROB(rob), fQ0(0), @@ -96,7 +96,7 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, fNClusters(0), fResiduals(0x0), fClsCharges(0x0) -{ +{ fGeo = new AliTRDgeometry(); fLabel[0] = -1; fLabel[1] = -1; @@ -134,7 +134,7 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) : fLabel[2] = rhs.fLabel[2]; } -AliTRDtrackletMCM::~AliTRDtrackletMCM() +AliTRDtrackletMCM::~AliTRDtrackletMCM() { delete [] fResiduals; delete [] fClsCharges; @@ -151,7 +151,7 @@ Int_t AliTRDtrackletMCM::GetYbin() const { } } -Int_t AliTRDtrackletMCM::GetdY() const +Int_t AliTRDtrackletMCM::GetdY() const { // returns (signed) value of the deflection length if (fTrackletWord & (1 << 19)) { @@ -163,7 +163,7 @@ Int_t AliTRDtrackletMCM::GetdY() const } void AliTRDtrackletMCM::SetLabel(Int_t label[]) -{ +{ fLabel[0] = label[0]; fLabel[1] = label[1]; fLabel[2] = label[2]; diff --git a/TRD/AliTRDtrackletMCM.h b/TRD/AliTRDtrackletMCM.h index 884471d8a25..3b4251a26a0 100644 --- a/TRD/AliTRDtrackletMCM.h +++ b/TRD/AliTRDtrackletMCM.h @@ -25,8 +25,8 @@ class AliTRDtrackletMCM : public AliTRDtrackletBase { ~AliTRDtrackletMCM(); // ----- Getters for contents of tracklet word ----- - Int_t GetYbin() const; - Int_t GetdY() const; + Int_t GetYbin() const; + Int_t GetdY() const; Int_t GetZbin() const { return ((fTrackletWord >> 20) & 0xf); } Int_t GetPID() const { return ((fTrackletWord >> 24) & 0xff); } @@ -45,9 +45,9 @@ class AliTRDtrackletMCM : public AliTRDtrackletBase { Float_t GetdYdX() const { return (GetdY() * 140e-4 / 3.); } Float_t GetX() const { return fGeo->GetTime0((fHCId % 12) / 2); } Float_t GetY() const { return (GetYbin() * 160e-4); } - Float_t GetZ() const { return fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowPos( 4 * (fROB / 2) + fMCM / 4) - + Float_t GetZ() const { return fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowPos( 4 * (fROB / 2) + fMCM / 4) - fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId /12) % 5)->GetRowSize(4 * (fROB / 2) + fMCM / 4) * .5; } - Float_t GetLocalZ() const { return GetZ() - + Float_t GetLocalZ() const { return GetZ() - (fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRow0()+fGeo->GetPadPlane((fHCId % 12) / 2, (fHCId / 12) % 5)->GetRowEnd())/2.; } Int_t GetQ0() const { return fQ0; } @@ -86,7 +86,7 @@ class AliTRDtrackletMCM : public AliTRDtrackletBase { AliTRDgeometry *fGeo; //! TRD geometry Int_t fHCId; // half-chamber ID (only transient) - UInt_t fTrackletWord; // tracklet word: PID | Z | deflection length | Y + UInt_t fTrackletWord; // tracklet word: PID | Z | deflection length | Y // bits: 12 4 7 13 Int_t fMCM; // MCM no. in which the tracklet was found Int_t fROB; // ROB no. on which the tracklet was found @@ -99,7 +99,7 @@ class AliTRDtrackletMCM : public AliTRDtrackletBase { Int_t fNHits1; // no. of contributing clusters in window 1 Int_t fLabel[3]; // up to 3 labels for MC track - + Float_t fSlope; // tracklet slope Float_t fOffset; // tracklet offset Float_t fError; // tracklet error diff --git a/TRD/AliTRDtrackletWord.cxx b/TRD/AliTRDtrackletWord.cxx index 8c2102fb926..c0540c20b18 100644 --- a/TRD/AliTRDtrackletWord.cxx +++ b/TRD/AliTRDtrackletWord.cxx @@ -36,7 +36,7 @@ AliTRDtrackletWord::AliTRDtrackletWord(UInt_t trackletWord) : AliTRDtrackletBase(), fHCId(-1), fTrackletWord(trackletWord) -{ +{ } @@ -44,7 +44,7 @@ AliTRDtrackletWord::AliTRDtrackletWord(UInt_t trackletWord, Int_t hcid) : AliTRDtrackletBase(), fHCId(hcid), fTrackletWord(trackletWord) -{ +{ } @@ -56,7 +56,7 @@ AliTRDtrackletWord::AliTRDtrackletWord(const AliTRDtrackletWord &rhs) : } -AliTRDtrackletWord::~AliTRDtrackletWord() +AliTRDtrackletWord::~AliTRDtrackletWord() { } @@ -71,7 +71,7 @@ Int_t AliTRDtrackletWord::GetYbin() const { } } -Int_t AliTRDtrackletWord::GetdY() const +Int_t AliTRDtrackletWord::GetdY() const { // returns (signed) value of the deflection length if (fTrackletWord & (1 << 19)) { diff --git a/TRD/AliTRDtrackletWord.h b/TRD/AliTRDtrackletWord.h index 352c36f835d..ac23edc8c31 100644 --- a/TRD/AliTRDtrackletWord.h +++ b/TRD/AliTRDtrackletWord.h @@ -24,13 +24,13 @@ class AliTRDtrackletWord : public AliTRDtrackletBase { ~AliTRDtrackletWord(); // ----- Getters for contents of tracklet word ----- - Int_t GetYbin() const; - Int_t GetdY() const; + Int_t GetYbin() const; + Int_t GetdY() const; Int_t GetZbin() const { return ((fTrackletWord >> 20) & 0xf); } Int_t GetPID() const { return ((fTrackletWord >> 24) & 0xff); } Int_t GetROB() const; - Int_t GetMCM() const; + Int_t GetMCM() const; // ----- Getters for offline corresponding values ----- Bool_t CookPID() { return kFALSE; } @@ -52,7 +52,7 @@ class AliTRDtrackletWord : public AliTRDtrackletBase { protected: Int_t fHCId; // half-chamber ID - UInt_t fTrackletWord; // tracklet word: PID | Z | deflection length | Y + UInt_t fTrackletWord; // tracklet word: PID | Z | deflection length | Y // bits: 12 4 7 13 static AliTRDgeometry *fgGeo; // pointer to TRD geometry for coordinate calculations diff --git a/TRD/AliTRDtrapConfig.cxx b/TRD/AliTRDtrapConfig.cxx index 595cf98c8d9..ea0a0d724a4 100644 --- a/TRD/AliTRDtrapConfig.cxx +++ b/TRD/AliTRDtrapConfig.cxx @@ -38,7 +38,7 @@ AliTRDtrapConfig* AliTRDtrapConfig::fgInstance = 0x0; const Int_t AliTRDtrapConfig::fgkMaxMcm = AliTRDfeeParam::GetNmcmRob() + 2; const Int_t AliTRDtrapConfig::fgkDmemStartAddress = 0xc000; -AliTRDtrapConfig::AliTRDtrapConfig() : +AliTRDtrapConfig::AliTRDtrapConfig() : TObject(), fScaleQ0(0), fScaleQ1(0) { // default constructor, initializing array of TRAP registers @@ -481,7 +481,7 @@ AliTRDtrapConfig::AliTRDtrapConfig() : for(Int_t iAddr = 0; iAddr < fgkDmemWords; iAddr++) { - + if(iAddr == fgkDmemAddrDeflCorr - fgkDmemStartAddress) { fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; fDmemDepth[iAddr] = fgkDmemSizeSmIndividual; @@ -493,7 +493,7 @@ AliTRDtrapConfig::AliTRDtrapConfig() : } else if(iAddr >= fgkDmemAddrDeflCutStart-fgkDmemStartAddress && iAddr <= fgkDmemAddrDeflCutEnd-fgkDmemStartAddress) { - fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; + fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; fDmemDepth[iAddr] = fgkDmemSizeSmIndividual; } @@ -508,15 +508,15 @@ AliTRDtrapConfig::AliTRDtrapConfig() : } else if(iAddr == fgkDmemAddrLUTcor0-fgkDmemStartAddress) { - fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; + fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; fDmemDepth[iAddr] = fgkDmemSizeSmIndividual; } else if(iAddr == fgkDmemAddrLUTcor1-fgkDmemStartAddress) { - fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; + fDmem[iAddr] = new UInt_t[fgkDmemSizeSmIndividual]; fDmemDepth[iAddr] = fgkDmemSizeSmIndividual; } - + else if(iAddr == fgkDmemAddrLUTnbins-fgkDmemStartAddress) { fDmem[iAddr] = new UInt_t; // same value for all MCMs fDmemDepth[iAddr] = fgkDmemSizeUniform; @@ -531,7 +531,7 @@ AliTRDtrapConfig::AliTRDtrapConfig() : fDmem[iAddr] = NULL; fDmemDepth[iAddr] = fgkDmemSizeEmpty; } - + } InitRegs(); @@ -576,7 +576,7 @@ AliTRDtrapConfig::~AliTRDtrapConfig() else if(iAddr == fgkDmemAddrLUTcor1-fgkDmemStartAddress) delete [] fDmem[iAddr]; - + else if(iAddr == fgkDmemAddrLUTnbins-fgkDmemStartAddress) delete fDmem[iAddr]; @@ -633,7 +633,7 @@ void AliTRDtrapConfig::ResetDmem() Int_t AliTRDtrapConfig::GetTrapReg(TrapReg_t reg, Int_t det, Int_t rob, Int_t mcm) const { - // get the value of an individual TRAP register + // get the value of an individual TRAP register // if it is individual for TRAPs a valid TRAP has to be specified if ((reg < 0) || (reg >= kLastReg)) { @@ -645,8 +645,8 @@ Int_t AliTRDtrapConfig::GetTrapReg(TrapReg_t reg, Int_t det, Int_t rob, Int_t mc return fRegisterValue[reg].globalValue; } else if (fRegisterValue[reg].state == RegValue_t::kIndividual) { - if((det >= 0 && det < AliTRDgeometry::Ndet()) && - (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) && + if((det >= 0 && det < AliTRDgeometry::Ndet()) && + (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) && (mcm >= 0 && mcm < fgkMaxMcm)) { return fRegisterValue[reg].individualValue[det*AliTRDfeeParam::GetNrobC1()*fgkMaxMcm + rob*fgkMaxMcm + mcm]; } @@ -689,7 +689,7 @@ Bool_t AliTRDtrapConfig::SetTrapReg(TrapReg_t reg, Int_t value, Int_t det) return kTRUE; } else if (fRegisterValue[reg].state == RegValue_t::kIndividual) { - // if the register is in idividual mode but a broadcast is requested, the selected register is + // if the register is in idividual mode but a broadcast is requested, the selected register is // set to value for all MCMs on the chamber if( (det>=0 && det= 0 && det < AliTRDgeometry::Ndet()) && - (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) && + if( (det >= 0 && det < AliTRDgeometry::Ndet()) && + (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) && (mcm >= 0 && mcm < fgkMaxMcm) ) { if (fRegisterValue[reg].state == RegValue_t::kGlobal) { Int_t defaultValue = fRegisterValue[reg].globalValue; - + fRegisterValue[reg].state = RegValue_t::kIndividual; fRegisterValue[reg].individualValue = new Int_t[AliTRDgeometry::Ndet()*AliTRDfeeParam::GetNrobC1()*fgkMaxMcm]; @@ -754,7 +754,7 @@ UInt_t AliTRDtrapConfig::Peek(Int_t addr, Int_t det, Int_t rob, Int_t mcm) const { // reading from given address - if ( (addr >= fgkDmemStartAddress) && + if ( (addr >= fgkDmemStartAddress) && (addr < (fgkDmemStartAddress + fgkDmemWords)) ) { return GetDmemUnsigned(addr, det, rob, mcm); } @@ -773,7 +773,7 @@ Bool_t AliTRDtrapConfig::Poke(Int_t addr, UInt_t value, Int_t det, Int_t rob, In { // writing to given address - if ( (addr >= fgkDmemStartAddress) && + if ( (addr >= fgkDmemStartAddress) && (addr < (fgkDmemStartAddress + fgkDmemWords)) ) { AliDebug(2, Form("DMEM 0x%08x : %i", addr, value)); SetDmem(addr, value, det, rob, mcm); @@ -787,14 +787,14 @@ Bool_t AliTRDtrapConfig::Poke(Int_t addr, UInt_t value, Int_t det, Int_t rob, In return kTRUE; } } - + return kFALSE; } Bool_t AliTRDtrapConfig::SetDmem(Int_t addr, UInt_t value) { - // Set the content of the given DMEM address + // Set the content of the given DMEM address addr = addr - fgkDmemStartAddress; @@ -849,12 +849,12 @@ Bool_t AliTRDtrapConfig::SetDmem(Int_t addr, UInt_t value) Bool_t AliTRDtrapConfig::SetDmem(Int_t addr, UInt_t value, Int_t det, Int_t rob, Int_t mcm) { - // Set the content of the given DMEM address + // Set the content of the given DMEM address addr = addr - fgkDmemStartAddress; Int_t roc = det%30; Int_t loc; - + if(addr < 0 || addr >= fgkDmemWords) { AliError(Form("No DMEM address: 0x%08x", addr+fgkDmemStartAddress)); return kFALSE; @@ -892,7 +892,7 @@ Bool_t AliTRDtrapConfig::SetDmem(Int_t addr, UInt_t value, Int_t det, Int_t rob, if(loc < fgkDmemSizeTotalIndividual) { if(fDmem[addr][loc]!=0) AliDebug(5, Form("Warning: Setting new value to DMEM 0x%08x", addr+fgkDmemStartAddress)); - + fDmem[addr][loc]=value; } else { @@ -911,14 +911,14 @@ Bool_t AliTRDtrapConfig::SetDmem(Int_t addr, UInt_t value, Int_t det, Int_t rob, AliError(Form("DMEM sub-address %i out of scope", det)); return kFALSE; } - + break; default: AliError(Form("Invalid selection type")); return kFALSE; break; } - + return kTRUE; } @@ -945,7 +945,7 @@ UInt_t AliTRDtrapConfig::GetDmemUnsigned(Int_t addr, Int_t det, Int_t rob, Int_t addr = addr - fgkDmemStartAddress; Int_t roc = det%30; Int_t loc; - + if(addr < 0 || addr >= fgkDmemWords) { AliError(Form("No DMEM address: 0x%08x", addr+fgkDmemStartAddress)); return 0; @@ -996,17 +996,17 @@ UInt_t AliTRDtrapConfig::GetDmemUnsigned(Int_t addr, Int_t det, Int_t rob, Int_t return 0; break; } - + return 0; } -Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) +Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) { // Read the packed configuration from the passed memory block // - // To be used to retrieve the TRAP configuration from the - // configuration as sent in the raw data. + // To be used to retrieve the TRAP configuration from the + // configuration as sent in the raw data. AliDebug(1, "Reading packed configuration"); @@ -1015,31 +1015,31 @@ Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) Int_t idx = 0; Int_t err = 0; Int_t step, bwidth, nwords, exitFlag, bitcnt; - + UShort_t caddr; UInt_t dat, msk, header, dataHi; - + while (idx < size && *data != 0x00000000) { - + Int_t rob = (*data >> 28) & 0x7; Int_t mcm = (*data >> 24) & 0xf; AliDebug(1, Form("Config of det. %3i MCM %i:%02i (0x%08x)", det, rob, mcm, *data)); data++; - + while (idx < size && *data != 0x00000000) { - + header = *data; data++; idx++; - + AliDebug(5, Form("read: 0x%08x", header)); - + if (header & 0x01) // single data { - dat = (header >> 2) & 0xFFFF; // 16 bit data - caddr = (header >> 18) & 0x3FFF; // 14 bit address - + dat = (header >> 2) & 0xFFFF; // 16 bit data + caddr = (header >> 18) & 0x3FFF; // 14 bit address + if (caddr != 0x1FFF) // temp!!! because the end marker was wrong { if (header & 0x02) // check if > 16 bits @@ -1066,18 +1066,18 @@ Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) return err; } } - - else // block of data + + else // block of data { step = (header >> 1) & 0x0003; bwidth = ((header >> 3) & 0x001F) + 1; nwords = (header >> 8) & 0x00FF; caddr = (header >> 16) & 0xFFFF; exitFlag = (step == 0) || (step == 3) || (nwords == 0); - - if (exitFlag) + + if (exitFlag) break; - + switch (bwidth) { case 15: @@ -1105,7 +1105,7 @@ Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) AliDebug(5, Form("addr=0x%04x (%s) data=0x%08x\n", caddr, GetRegName(GetRegByAddress(caddr)), header & msk)); if ( ! Poke(caddr, header & msk, det, rob, mcm) ) AliDebug(5, Form("(single-write): non-existing address 0x%04x containing 0x%08x\n", caddr, header)); - + caddr += step; header = header >> bwidth; if (idx >= size) @@ -1115,7 +1115,7 @@ Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) } } break; - } // end case 5-15 + } // end case 5-15 case 31: { while (nwords > 0) @@ -1126,11 +1126,11 @@ Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) idx++; nwords--; err += (header & 1); - + AliDebug(5, Form("addr=0x%04x (%s) data=0x%08x", caddr, GetRegName(GetRegByAddress(caddr)), header >> 1)); if ( ! Poke(caddr, header >> 1, det, rob, mcm) ) AliDebug(5, Form("(single-write): non-existing address 0x%04x containing 0x%08x\n", caddr, header)); - + caddr += step; if (idx >= size) { @@ -1141,12 +1141,12 @@ Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size) break; } default: return err; - } // end switch + } // end switch } // end block case } } // end while AliDebug(5, Form("no end marker! %d words read", idx)); - return -err; // only if the max length of the block reached! + return -err; // only if the max length of the block reached! } @@ -1156,7 +1156,7 @@ Bool_t AliTRDtrapConfig::PrintTrapReg(TrapReg_t reg, Int_t det, Int_t rob, Int_t // if it is individual a valid MCM has to be specified if (fRegisterValue[reg].state == RegValue_t::kGlobal) { - printf("%s (%i bits) at 0x%08x is 0x%08x and resets to: 0x%08x (currently global mode)\n", + printf("%s (%i bits) at 0x%08x is 0x%08x and resets to: 0x%08x (currently global mode)\n", GetRegName((TrapReg_t) reg), GetRegNBits((TrapReg_t) reg), GetRegAddress((TrapReg_t) reg), @@ -1164,10 +1164,10 @@ Bool_t AliTRDtrapConfig::PrintTrapReg(TrapReg_t reg, Int_t det, Int_t rob, Int_t GetRegResetValue((TrapReg_t) reg)); } else if (fRegisterValue[reg].state == RegValue_t::kIndividual) { - if((det >= 0 && det < AliTRDgeometry::Ndet()) && - (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) && + if((det >= 0 && det < AliTRDgeometry::Ndet()) && + (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) && (mcm >= 0 && mcm < fgkMaxMcm)) { - printf("%s (%i bits) at 0x%08x is 0x%08x and resets to: 0x%08x (currently individual mode)\n", + printf("%s (%i bits) at 0x%08x is 0x%08x and resets to: 0x%08x (currently individual mode)\n", GetRegName((TrapReg_t) reg), GetRegNBits((TrapReg_t) reg), GetRegAddress((TrapReg_t) reg), @@ -1218,7 +1218,7 @@ Bool_t AliTRDtrapConfig::AddValues(UInt_t det, UInt_t cmd, UInt_t extali, Int_t // configuration registers if(mcmReg >= 0 && mcmReg < kLastReg) { - + for(Int_t linkPair=0; linkPair= fgkDmemStartAddress) && + else if ( (addr >= fgkDmemStartAddress) && (addr < (fgkDmemStartAddress + fgkDmemWords))) { for(Int_t linkPair=0; linkPair= 0 && reg < kLastReg ? fRegs[reg].fName.Data() : ""; } @@ -477,7 +477,7 @@ class AliTRDtrapConfig : public TObject void ResetRegs(); void ResetDmem(); - // DMEM + // DMEM Bool_t SetDmem(Int_t addr, UInt_t value); // Bool_t SetDmem(Int_t addr, UInt_t value, Int_t det); Bool_t SetDmem(Int_t addr, UInt_t value, Int_t det, Int_t rob, Int_t mcm); @@ -493,7 +493,7 @@ class AliTRDtrapConfig : public TObject void PrintMemDatx(ostream &os, TrapReg_t reg) const; void PrintMemDatx(ostream &os, TrapReg_t reg, Int_t det, Int_t rob, Int_t mcm) const; void PrintDatx(ostream &os, UInt_t addr, UInt_t data, Int_t rob, Int_t mcm) const; - + // PID void SetPIDscale(Double_t sq0, Double_t sq1) {fScaleQ0=sq0; fScaleQ1=sq1;} // The two scaling factors are not available in the TRAP but needed by the DCS board void GetPIDscale(Double_t scale[2]) {scale[0] = fScaleQ0; scale[1]=fScaleQ1;} // The two scaling factors are not available in the TRAP but needed by the DCS board @@ -507,17 +507,17 @@ class AliTRDtrapConfig : public TObject static const Int_t fgkDmemAddrLUTcor0 = 0xC02A; static const Int_t fgkDmemAddrLUTcor1 = 0xC028; static const Int_t fgkDmemAddrLUTnbins = 0xC029; - + static const Int_t fgkDmemAddrLUTStart = 0xC100; // LUT start address static const Int_t fgkDmemAddrLUTEnd = 0xC3FF; // maximum possible end address for the LUT table static const Int_t fgkDmemAddrLUTLength = 0xC02B; // address where real size of the LUT table is stored - + static const Int_t fgkDmemAddrTrackletStart = 0xC0E0; // Storage area for tracklets, start address static const Int_t fgkDmemAddrTrackletEnd = 0xC0E3; // Storage area for tracklets, end address static const Int_t fgkDmemAddrDeflCorr = 0xc022; // DMEM address of deflection correction static const Int_t fgkDmemAddrNdrift = 0xc025; // DMEM address of Ndrift - static const Int_t fgkDmemAddrDeflCutStart = 0xc030; // DMEM start address of deflection cut + static const Int_t fgkDmemAddrDeflCutStart = 0xc030; // DMEM start address of deflection cut static const Int_t fgkDmemAddrDeflCutEnd = 0xc055; // DMEM end address of deflection cut // DMEM memory in simulation; @@ -532,7 +532,7 @@ class AliTRDtrapConfig : public TObject UShort_t fAddr; // Address in GIO of TRAP UShort_t fNbits; // Number of bits, from 1 to 32 UInt_t fResetValue; // reset value - SimpleReg_t(const char *nnn = 0, UShort_t a = 0, UShort_t n = 0, UInt_t r = 0) : + SimpleReg_t(const char *nnn = 0, UShort_t a = 0, UShort_t n = 0, UInt_t r = 0) : fName(nnn), fAddr(a), fNbits(n), fResetValue(r) {} }; @@ -552,7 +552,7 @@ class AliTRDtrapConfig : public TObject SimpleReg_t fRegs[kLastReg]; // array of TRAP registers RegValue_t fRegisterValue[kLastReg]; // array of TRAP register values in use - static const UInt_t fgkScsnCmdWrite=10; // Command number for the write command + static const UInt_t fgkScsnCmdWrite=10; // Command number for the write command static const Int_t fgkMaxLinkPairs=4; // number of linkpairs used during configuration static const Int_t fgkMaxMcm; // max. no. of MCMs to be treated static const Int_t fgkMcmlistSize=256; // list of MCMs to which a value has to be written diff --git a/TRD/AliTRDtrapConfigHandler.cxx b/TRD/AliTRDtrapConfigHandler.cxx index ec502800479..519539b3ec3 100644 --- a/TRD/AliTRDtrapConfigHandler.cxx +++ b/TRD/AliTRDtrapConfigHandler.cxx @@ -256,7 +256,7 @@ Int_t AliTRDtrapConfigHandler::LoadConfig(TString filename) if(!infile.eof()) infile.clear(); } - + infile.close(); AliDebug(5, Form("Ignored lines: %i, ignored cmds: %i", ignoredLines, ignoredCmds)); -- 2.43.0