From: cblume Date: Thu, 6 Aug 2009 11:18:32 +0000 (+0000) Subject: Coding rules and warnings X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=36dc33376694936d779ad300f226d680f4ae227d Coding rules and warnings --- diff --git a/TRD/AliTRDCalibraFit.h b/TRD/AliTRDCalibraFit.h index d054fafbae1..85063f336fa 100644 --- a/TRD/AliTRDCalibraFit.h +++ b/TRD/AliTRDCalibraFit.h @@ -12,8 +12,9 @@ /////////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TObject -# include -#endif +# include +#endif +#include class TTree; class TProfile2D; diff --git a/TRD/AliTRDCalibraVdriftLinearFit.h b/TRD/AliTRDCalibraVdriftLinearFit.h index de9267e6173..824f3712a92 100644 --- a/TRD/AliTRDCalibraVdriftLinearFit.h +++ b/TRD/AliTRDCalibraVdriftLinearFit.h @@ -12,8 +12,10 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include "TObjArray.h" +//#include "TObjArray.h" +#include "TObject.h" +//class TVectorD; class TObjArray; class TH2F; class TTreeSRedirector; diff --git a/TRD/AliTRDTrigger.h b/TRD/AliTRDTrigger.h index f0c0c6eac77..e17c111eff9 100644 --- a/TRD/AliTRDTrigger.h +++ b/TRD/AliTRDTrigger.h @@ -26,7 +26,7 @@ class AliTRDTrigger : public AliTriggerDetector { virtual void Trigger(); private: - TObjArray fTriggers; + TObjArray fTriggers; // array of all contributing triggers ClassDef(AliTRDTrigger, 1); diff --git a/TRD/AliTRDTriggerL0.cxx b/TRD/AliTRDTriggerL0.cxx index 73e2448f19e..21587ee38ee 100644 --- a/TRD/AliTRDTriggerL0.cxx +++ b/TRD/AliTRDTriggerL0.cxx @@ -30,8 +30,6 @@ #include "AliLoader.h" #include "AliTRDTriggerL0.h" -#include "AliTRDgtuSim.h" -#include "AliTRDtrackGTU.h" AliTRDTriggerL0::AliTRDTriggerL0() { diff --git a/TRD/AliTRDTriggerL1.cxx b/TRD/AliTRDTriggerL1.cxx index 82e91cb9464..99245a3b17e 100644 --- a/TRD/AliTRDTriggerL1.cxx +++ b/TRD/AliTRDTriggerL1.cxx @@ -48,6 +48,8 @@ AliTRDTriggerL1::~AliTRDTriggerL1() void AliTRDTriggerL1::CreateInputs() { + // create the trigger inputs for TRD + if (fInputs.GetEntriesFast() > 0) return; @@ -57,6 +59,8 @@ void AliTRDTriggerL1::CreateInputs() void AliTRDTriggerL1::Trigger() { + // run the trigger algorithms + AliRunLoader *runLoader = AliRunLoader::Instance(); if (!runLoader) return; @@ -84,8 +88,8 @@ void AliTRDTriggerL1::Trigger() Int_t trackThreshold2 = 2; // trigger algorithms to come, e.g. - Bool_t triggered_highpt = kFALSE; - Bool_t triggered_jet = kFALSE; + Bool_t triggeredHighPt = kFALSE; + Bool_t triggeredJet = kFALSE; if (branch) { AliTRDtrackGTU *trk = 0x0; @@ -97,7 +101,7 @@ void AliTRDTriggerL1::Trigger() if (TMath::Abs(trk->GetPt()) > 3.0) { AliDebug(1, Form("Found track in sector %2i, stack %i with pt = %3.1f, triggered", trk->GetSector(), trk->GetStack(), trk->GetPt())); - triggered_highpt = kTRUE; + triggeredHighPt = kTRUE; } } @@ -113,19 +117,19 @@ void AliTRDTriggerL1::Trigger() } for (Int_t iStack = 0; iStack < 90; iStack++) { if ((nTracks1[iStack] >= trackThreshold1) || (nTracks2[iStack] >= trackThreshold2)) - triggered_jet = kTRUE; + triggeredJet = kTRUE; } } else { AliWarning("GTU Branch not found"); } - if (triggered_highpt) { + if (triggeredHighPt) { AliInfo("Fired high-pt trigger"); SetInput("1HSH"); } - if (triggered_jet) { + if (triggeredJet) { AliInfo("Fired jet trigger"); SetInput("1HJT"); } diff --git a/TRD/AliTRDgtuParam.cxx b/TRD/AliTRDgtuParam.cxx index ed6004156fa..ccc5f6fe1ca 100644 --- a/TRD/AliTRDgtuParam.cxx +++ b/TRD/AliTRDgtuParam.cxx @@ -72,7 +72,7 @@ AliTRDgtuParam::AliTRDgtuParam() : fRefLayers[0] = 3; fRefLayers[1] = 2; fRefLayers[2] = 1; - zChannelGen(); + GenerateZChannelMap(); } AliTRDgtuParam::~AliTRDgtuParam() @@ -115,13 +115,15 @@ Int_t AliTRDgtuParam::GetZSubchannel(Int_t stack, Int_t layer, Int_t zchannel, I Int_t AliTRDgtuParam::GetRefLayer(Int_t refLayerIdx) const { + // returns the reference layer indexed by refLayerIdx + if (refLayerIdx >= 0 && refLayerIdx < fgkNRefLayers) return fRefLayers[refLayerIdx]; else return -1; } -Int_t AliTRDgtuParam::zChannelGen() +Int_t AliTRDgtuParam::GenerateZChannelMap() { // generate the z-channel map // assuming that the tracks come from the vertex @@ -132,15 +134,15 @@ Int_t AliTRDgtuParam::zChannelGen() for (Int_t iStack = 0; iStack < fGeo->Nstack(); iStack++) { - Float_t X[6] = { 0 }; - Float_t Z[6][16] = {{ 0 }}; + 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(); // ??? + 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 + 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++) fZSubChannel[iStack][i][iLayer][iRow] = 0; @@ -149,26 +151,26 @@ Int_t AliTRDgtuParam::zChannelGen() for (Int_t fixRow = 0; fixRow < fGeo->GetRowMax(fgkFixLayer, iStack, iSec); 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 fixZmin = z[fgkFixLayer][fixRow] - dZ[fgkFixLayer][fixRow]; + Double_t fixZmax = z[fgkFixLayer][fixRow]; + 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; + leftZ = (fixZmin + fVertexSize) * (x[iLayer] + 1.5) / fixX - fVertexSize; + rightZ = (fixZmax - fVertexSize) * (x[iLayer] + 1.5) / fixX + fVertexSize; } else { - leftZ = (fixZmin - fVertexSize) * (X[iLayer] + 1.5) / fixX + fVertexSize; - rightZ = (fixZmax + fVertexSize) * (X[iLayer] + 1.5) / fixX - fVertexSize; + 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) && - (Z[iLayer][iRow] - dZ[iLayer][iRow] ) < (rightZ - 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!!!"); @@ -237,17 +239,17 @@ Int_t AliTRDgtuParam::GetCiAlpha(Int_t layer) const { // get the constant for the calculation of alpha - Int_t Ci = (Int_t) (GetChamberThickness() / fGeo->GetTime0(layer) * GetBinWidthY() / GetBinWidthdY() * (1 << (GetBitExcessAlpha() + GetBitExcessY() + 1)) ); - return Ci; + Int_t ci = (Int_t) (GetChamberThickness() / fGeo->GetTime0(layer) * GetBinWidthY() / GetBinWidthdY() * (1 << (GetBitExcessAlpha() + GetBitExcessY() + 1)) ); + return ci; } 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.; - Int_t Ci = (Int_t) (- (fGeo->GetTime0(layer) - Xmid) / GetChamberThickness() * GetBinWidthdY() / GetBinWidthY() * (1 << GetBitExcessYProj()) ); - return Ci; + 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 @@ -259,6 +261,9 @@ Int_t AliTRDgtuParam::GetYt(Int_t stack, Int_t layer, Int_t zrow) const Bool_t AliTRDgtuParam::GenerateRecoCoefficients(Int_t trackletMask) { + // calculate the coefficients for the straight line fit + // depending on the mask of contributing tracklets + fCurrTrackletMask = trackletMask; TMatrix a(GetNLayers(), 3); @@ -391,7 +396,7 @@ Bool_t AliTRDgtuParam::GetIntersectionPoints(Int_t k, Float_t &x1, Float_t &x2) return ( (l1 >= 0) && (l2 >= 0) ); } -Float_t AliTRDgtuParam::GetRadius(Int_t a, Float_t b, Float_t x1, Float_t x2) +Float_t AliTRDgtuParam::GetRadius(Int_t a, Float_t b, Float_t x1, Float_t x2) const { // get the radius for the track Float_t d = (1 + b * b /2 ) * (x2 - x1); diff --git a/TRD/AliTRDgtuParam.h b/TRD/AliTRDgtuParam.h index 413eb7ad55d..740cd7cced5 100644 --- a/TRD/AliTRDgtuParam.h +++ b/TRD/AliTRDgtuParam.h @@ -13,7 +13,6 @@ // -------------------------------------------------------- #include "TObject.h" -#include "TVectorD.h" class AliTRDgeometry; @@ -24,24 +23,24 @@ class AliTRDgtuParam : public TObject { static AliTRDgtuParam *Instance(); // Singleton static void Terminate(); - static inline Int_t GetNLinks() { return fgkNLinks; } - static inline Int_t GetNLayers() { return fgkNLinks/2; } - static inline Int_t GetNZChannels() { return fgkNZChannels; } - static inline Int_t GetNRefLayers() { return fgkNRefLayers; } + static Int_t GetNLinks() { return fgkNLinks; } + static Int_t GetNLayers() { return fgkNLinks/2; } + static Int_t GetNZChannels() { return fgkNZChannels; } + static Int_t GetNRefLayers() { return fgkNRefLayers; } - static inline Float_t GetChamberThickness() { return 3.0; } + static Float_t GetChamberThickness() { return 3.0; } // ----- Bin widths (granularity) ----- - static inline Float_t GetBinWidthY() { return fgkBinWidthY; } - static inline Float_t GetBinWidthdY() { return fgkBinWidthdY; } + static Float_t GetBinWidthY() { return fgkBinWidthY; } + static Float_t GetBinWidthdY() { return fgkBinWidthdY; } // ----- Bit Widths (used for internal representation) ----- - static inline Int_t GetBitWidthY() { return fgkBitWidthY; } - static inline Int_t GetBitWidthdY() { return fgkBitWidthdY; } - static inline Int_t GetBitWidthYProj() { return fgkBitWidthYProj; } - static inline Int_t GetBitExcessY() { return fgkBitExcessY; } - static inline Int_t GetBitExcessAlpha() { return fgkBitExcessAlpha; } - static inline Int_t GetBitExcessYProj() { return fgkBitExcessYProj; } + static Int_t GetBitWidthY() { return fgkBitWidthY; } + static Int_t GetBitWidthdY() { return fgkBitWidthdY; } + static Int_t GetBitWidthYProj() { return fgkBitWidthYProj; } + static Int_t GetBitExcessY() { return fgkBitExcessY; } + static Int_t GetBitExcessAlpha() { return fgkBitExcessAlpha; } + static Int_t GetBitExcessYProj() { return fgkBitExcessYProj; } AliTRDgeometry* GetGeo() const { return fGeo; } Float_t GetVertexSize() const { return fVertexSize; } @@ -54,14 +53,14 @@ class AliTRDgtuParam : public TObject { Int_t GetRefLayer(Int_t refLayerIdx) const; // Bool_t GetFitParams(TVectorD &rhs, Int_t k); // const Bool_t GetIntersectionPoints(Int_t k, Float_t &x1, Float_t &x2); // const - Float_t GetRadius(Int_t a, Float_t b, Float_t x1, Float_t x2); // const + Float_t GetRadius(Int_t a, Float_t b, Float_t x1, Float_t x2) const; Bool_t IsInZChannel(Int_t stack, Int_t layer, Int_t zchannel, Int_t zpos) const; void SetVertexSize(Float_t vertexsize) { fVertexSize = vertexsize; } // z-channel map - Int_t zChannelGen(); // could have different modes (for beam-beam, cosmics, ...) + Int_t GenerateZChannelMap(); // could have different modes (for beam-beam, cosmics, ...) Bool_t DisplayZChannelMap(Int_t zchannel = -1, Int_t subch = 0) const; // variables for pt-reconstruction (not used at the moment) diff --git a/TRD/AliTRDgtuSim.cxx b/TRD/AliTRDgtuSim.cxx index eec2dc2ae48..6eba70dd2d6 100644 --- a/TRD/AliTRDgtuSim.cxx +++ b/TRD/AliTRDgtuSim.cxx @@ -59,6 +59,8 @@ AliTRDgtuSim::AliTRDgtuSim(AliRunLoader *rl) AliTRDgtuSim::~AliTRDgtuSim() { + // destructor + if (fTrackletArray) fTrackletArray->Delete(); delete fTrackletArray; @@ -67,6 +69,9 @@ AliTRDgtuSim::~AliTRDgtuSim() Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t noev) { + // 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()); @@ -107,20 +112,20 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t if (iEvent != iEventPrev || iStack != iStackPrev || iSec != iSecPrev) { if(fTMU) { - TList *ListOfTracks = new TList(); + TList *listOfTracks = new TList(); fTMU->SetStack(iStackPrev); fTMU->SetSector(iSecPrev); - fTMU->RunTMU(ListOfTracks); - AliDebug(1,Form("--- There are %i tracks. Writing ...", ListOfTracks->GetEntries())); - WriteTracksToTree(ListOfTracks); + fTMU->RunTMU(listOfTracks); + AliDebug(1,Form("--- There are %i tracks. Writing ...", listOfTracks->GetEntries())); + WriteTracksToTree(listOfTracks); fTMU->WriteTrackletsToTree(fTrackletTree); - WriteTracksToDataFile(ListOfTracks, iEventPrev); - if (ListOfTracks->GetEntries() > 0) - AliDebug(2,Form(" %d GeV/c", ((AliTRDtrackGTU*) ListOfTracks->At(0))->GetPt() )); + WriteTracksToDataFile(listOfTracks, iEventPrev); + if (listOfTracks->GetEntries() > 0) + AliDebug(2,Form(" %d GeV/c", ((AliTRDtrackGTU*) listOfTracks->At(0))->GetPt() )); delete fTMU; fTMU = new AliTRDgtuTMU(); - delete ListOfTracks; - ListOfTracks = 0x0; + delete listOfTracks; + listOfTracks = 0x0; } else { fTMU = new AliTRDgtuTMU(); } @@ -143,15 +148,15 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t } if (fTMU && evcnt < noev) { - TList *ListOfTracks = new TList(); + TList *listOfTracks = new TList(); fTMU->SetStack(iStackPrev); fTMU->SetSector(iSecPrev); - fTMU->RunTMU(ListOfTracks); - WriteTracksToTree(ListOfTracks); + fTMU->RunTMU(listOfTracks); + WriteTracksToTree(listOfTracks); fTMU->WriteTrackletsToTree(fTrackletTree); - WriteTracksToDataFile(ListOfTracks, iEventPrev); + WriteTracksToDataFile(listOfTracks, iEventPrev); delete fTMU; - delete ListOfTracks; + delete listOfTracks; fTMU = 0x0; } @@ -161,6 +166,9 @@ Bool_t AliTRDgtuSim::RunGTUFromTrackletFile(TString filename, Int_t event, Int_t 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 (!LoadTracklets(loader)) { AliError("Could not load the tracklets. Nothing done ..."); return kFALSE; @@ -177,7 +185,7 @@ Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) fTMU = 0x0; } - TList *ListOfTracks = new TList(); + TList *listOfTracks = new TList(); TIter next(fTrackletArray); AliTRDtrackletBase *trkl; @@ -191,12 +199,12 @@ Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) if(fTMU) { fTMU->SetStack(iStackPrev); fTMU->SetSector(iSecPrev); - fTMU->RunTMU(ListOfTracks); - WriteTracksToTree(ListOfTracks); + fTMU->RunTMU(listOfTracks); + WriteTracksToTree(listOfTracks); fTMU->WriteTrackletsToTree(fTrackletTree); - WriteTracksToESD(ListOfTracks, esd); + WriteTracksToESD(listOfTracks, esd); fTMU->Reset(); - ListOfTracks->Delete(); + listOfTracks->Delete(); } else { fTMU = new AliTRDgtuTMU(); } @@ -209,22 +217,24 @@ Bool_t AliTRDgtuSim::RunGTU(AliLoader *loader, AliESDEvent *esd) if (fTMU) { fTMU->SetStack(iStackPrev); fTMU->SetSector(iSecPrev); - fTMU->RunTMU(ListOfTracks); - WriteTracksToTree(ListOfTracks); + fTMU->RunTMU(listOfTracks); + WriteTracksToTree(listOfTracks); fTMU->WriteTrackletsToTree(fTrackletTree); - WriteTracksToESD(ListOfTracks, esd); + WriteTracksToESD(listOfTracks, esd); delete fTMU; fTMU = 0x0; - ListOfTracks->Delete(); + listOfTracks->Delete(); } - delete ListOfTracks; + delete listOfTracks; return kTRUE; } -Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *loader) +Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *const loader) { + // load the tracklets using the given loader + AliDebug(1,"Loading tracklets ..."); if (!loader) { @@ -304,18 +314,21 @@ Bool_t AliTRDgtuSim::LoadTracklets(AliLoader *loader) return kTRUE; } -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 + Int_t sm = 0; Int_t stack = 0; FILE *out; out = fopen("test.data", "a"); - AliDebug(1,Form("%i tracks found in event %i", ListOfTracks->GetSize(), event)); + AliDebug(1,Form("%i tracks found in event %i", listOfTracks->GetSize(), event)); fprintf(out, "0 %5i %2i %i 00000000\n", event, sm, stack); - for (Int_t i = 0; i < ListOfTracks->GetSize(); i++) { - AliTRDtrackGTU *trk = (AliTRDtrackGTU*) ListOfTracks->At(i); + for (Int_t i = 0; i < listOfTracks->GetSize(); i++) { + 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(), @@ -332,14 +345,16 @@ Bool_t AliTRDgtuSim::WriteTracksToDataFile(TList *ListOfTracks, Int_t event) return kTRUE; } -Bool_t AliTRDgtuSim::WriteTracksToTree(TList *ListOfTracks, Int_t /*event*/) +Bool_t AliTRDgtuSim::WriteTracksToTree(TList *listOfTracks, Int_t /*event*/) { - AliDebug(1,Form("Writing %i tracks to the tree...", ListOfTracks->GetEntries())); + // write the tracks to the tree for intermediate storage - if (!ListOfTracks) + AliDebug(1,Form("Writing %i tracks to the tree...", listOfTracks->GetEntries())); + + if (!listOfTracks) return kFALSE; - if (ListOfTracks->GetEntries() <= 0) + if (listOfTracks->GetEntries() <= 0) return kTRUE; if (!fTrackTree) { @@ -353,7 +368,7 @@ Bool_t AliTRDgtuSim::WriteTracksToTree(TList *ListOfTracks, Int_t /*event*/) branch = fTrackTree->Branch("TRDgtuTrack", "AliTRDtrackGTU", &trk, 32000, 99); } - TIter next(ListOfTracks); + TIter next(listOfTracks); while ((trk = (AliTRDtrackGTU*) next())) { trk->CookLabel(); branch->SetAddress(&trk); @@ -364,7 +379,9 @@ Bool_t AliTRDgtuSim::WriteTracksToTree(TList *ListOfTracks, Int_t /*event*/) return kTRUE; } -Bool_t AliTRDgtuSim::WriteTreesToFile() { +Bool_t AliTRDgtuSim::WriteTreesToFile() const { + // write the trees holding tracklets and tracks to file + TFile *f = TFile::Open("TRD.GtuTracking.root", "RECREATE"); f->cd(); if (fTrackTree) @@ -375,10 +392,12 @@ Bool_t AliTRDgtuSim::WriteTreesToFile() { return kTRUE; } -Bool_t AliTRDgtuSim::WriteTracksToESD(TList *ListOfTracks, AliESDEvent *esd) +Bool_t AliTRDgtuSim::WriteTracksToESD(const TList * const listOfTracks, AliESDEvent *esd) { + // fill the found tracks to the given ESD event + if (esd) { - TIter next(ListOfTracks); + TIter next(listOfTracks); while (AliTRDtrackGTU *trk = (AliTRDtrackGTU*) next()) { AliESDTrdTrack *trdtrack = trk->CreateTrdTrack(); esd->AddTrdTrack(trdtrack); @@ -390,6 +409,9 @@ Bool_t AliTRDgtuSim::WriteTracksToESD(TList *ListOfTracks, AliESDEvent *esd) Bool_t AliTRDgtuSim::WriteTracksToLoader() { + // write the GTU tracks to the dedicated loader + // these tracks contain more information than the ones in the ESD + if (!fTrackTree) { AliError("No track tree found!"); return kFALSE; diff --git a/TRD/AliTRDgtuSim.h b/TRD/AliTRDgtuSim.h index c9f158dd7fe..e84ac9aca12 100644 --- a/TRD/AliTRDgtuSim.h +++ b/TRD/AliTRDgtuSim.h @@ -26,16 +26,16 @@ class AliTRDgtuSim : public TObject { AliTRDgtuSim(AliRunLoader *rl = 0x0); ~AliTRDgtuSim(); - Bool_t LoadTracklets(AliLoader *loader); + Bool_t LoadTracklets(AliLoader * const loader); Bool_t RunGTU(AliLoader *loader, AliESDEvent *esd = 0x0); 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 WriteTracksToDataFile(TList *ListOfTracks, Int_t event); - Bool_t WriteTreesToFile(); - Bool_t WriteTracksToESD(TList *ListOfTracks, AliESDEvent *esd); + 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); Bool_t WriteTracksToLoader(); protected: diff --git a/TRD/AliTRDgtuTMU.cxx b/TRD/AliTRDgtuTMU.cxx index eeb90431012..71bc880c1d2 100644 --- a/TRD/AliTRDgtuTMU.cxx +++ b/TRD/AliTRDgtuTMU.cxx @@ -50,6 +50,8 @@ AliTRDgtuTMU::AliTRDgtuTMU(Int_t stack, Int_t sector) : fStack(-1), fSector(-1) { + // constructor which initializes the position information of the TMU + fGtuParam = AliTRDgtuParam::Instance(); fTracklets = new TObjArray*[fGtuParam->GetNLayers()]; fZChannelTracklets = new TList*[fGtuParam->GetNLayers()]; @@ -69,6 +71,8 @@ AliTRDgtuTMU::AliTRDgtuTMU(Int_t stack, Int_t sector) : AliTRDgtuTMU::~AliTRDgtuTMU() { + // destructor + for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) { delete [] fTracks[zch]; } @@ -148,7 +152,7 @@ Bool_t AliTRDgtuTMU::RunTMU(TList *ListOfTracks, AliESDEvent *esd) // calculation of track parameteres (pt, deflection, ???) if (fStack < 0 || fSector < 0) { - AliError("No valid stack/sector set for this TMU! Tracking aborted!"); + AliError("No valid stack/sector set for this TMU! No tracking!"); return kFALSE; } @@ -281,15 +285,15 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) Int_t *incprime = new Int_t[fGtuParam->GetNLayers()]; // ----- signals within current layer ----- - Int_t Yplus; - Int_t Yminus; - Int_t YBplus; - Int_t YBminus; - Int_t Alphaplus; - Int_t Alphaminus; - Int_t NHits; - Int_t NUnc; - Int_t NWayBeyond; + Int_t yPlus; + Int_t yMinus; + Int_t ybPlus; + Int_t ybMinus; + Int_t alphaPlus; + Int_t alphaMinus; + Int_t nHits; + Int_t nUnc; + Int_t nWayBeyond; AliTRDtrackletGTU *trkRA = 0x0; // reference tracklet A AliTRDtrackletGTU *trkRB = 0x0; // reference tracklet B @@ -341,22 +345,22 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) trkRB = (AliTRDtrackletGTU*) fZChannelTracklets[reflayer][zch].At(ptrB[reflayer]); AliDebug(10,Form("ptrRA: %i, ptrRB: %i", ptrA[reflayer], ptrB[reflayer])); - Yplus = trkRA->GetYProj() + fGtuParam->GetDeltaY(); - Yminus = trkRA->GetYProj() - fGtuParam->GetDeltaY(); - Alphaplus = trkRA->GetAlpha() + fGtuParam->GetDeltaAlpha(); - Alphaminus = trkRA->GetAlpha() - fGtuParam->GetDeltaAlpha(); + yPlus = trkRA->GetYProj() + fGtuParam->GetDeltaY(); + yMinus = trkRA->GetYProj() - fGtuParam->GetDeltaY(); + alphaPlus = trkRA->GetAlpha() + fGtuParam->GetDeltaAlpha(); + alphaMinus = trkRA->GetAlpha() - fGtuParam->GetDeltaAlpha(); if (trkRB) { - YBplus = trkRB->GetYProj() + fGtuParam->GetDeltaY(); - YBminus = trkRB->GetYProj() - fGtuParam->GetDeltaY(); + ybPlus = trkRB->GetYProj() + fGtuParam->GetDeltaY(); + ybMinus = trkRB->GetYProj() - fGtuParam->GetDeltaY(); } else { // irrelevant (should be, is it?) - YBplus = trkRA->GetYProj() + fGtuParam->GetDeltaY(); - YBminus = trkRA->GetYProj() - fGtuParam->GetDeltaY(); + ybPlus = trkRA->GetYProj() + fGtuParam->GetDeltaY(); + ybMinus = trkRA->GetYProj() - fGtuParam->GetDeltaY(); } - NHits = 0; - NUnc = 0; - NWayBeyond = 0; + nHits = 0; + nUnc = 0; + nWayBeyond = 0; for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { bHitA[layer] = bHitB[layer] = bAligned[layer] = kFALSE; @@ -365,7 +369,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) if (layer == reflayer) { bHitA[layer] = kTRUE; bAligned[layer] = kTRUE; - NHits++; + nHits++; continue; } @@ -380,11 +384,11 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) bAlignedB[layer] = kFALSE; 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) ); + 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) ); } else { bHitA[layer] = 0; @@ -392,11 +396,11 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) } if (trkB) { - bHitB[layer] = ( !(trkB->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() < Yminus) ) && - !(trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > Yplus) ) && - !(Alphaminus > trkB->GetAlpha()) && - !(Alphaplus > trkB->GetAlpha()) ); - bAlignedB[layer] = (trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > Yplus) ); + bHitB[layer] = ( !(trkB->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() < yMinus) ) && + !(trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > yPlus) ) && + !(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; @@ -407,22 +411,22 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) // bAligned[layer] = bAlignedA[layer]; //??? if (bAligned[layer] && (bHitA[layer] || bHitB[layer]) ) - NHits++; + nHits++; else if (!bAligned[layer] ) - NUnc++; + nUnc++; if (trkRB) { if (trkA) { - if ((trkA->GetSubChannel(zch) > trkRB->GetSubChannel(zch)) || (trkA->GetSubChannel(zch) == trkRB->GetSubChannel(zch) && trkA->GetYProj() > YBplus) ) - NWayBeyond++; + if ((trkA->GetSubChannel(zch) > trkRB->GetSubChannel(zch)) || (trkA->GetSubChannel(zch) == trkRB->GetSubChannel(zch) && trkA->GetYProj() > ybPlus) ) + nWayBeyond++; } else - NWayBeyond++; + nWayBeyond++; } // pre-calculation for the layer shifting (alignment w. r. t. trkRB) if (trkA) { if(trkRB) { - if ((trkA->GetSubChannel(zch) < trkRB->GetSubChannel(zch)) || (trkA->GetSubChannel(zch) == trkRB->GetSubChannel(zch) && trkA->GetYProj() < YBminus )) // could trkA be aligned for 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 incprime[layer] = 0; @@ -432,7 +436,7 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) 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 + 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 @@ -441,9 +445,9 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) } } // end of loop over layers - AliDebug(5,Form("logic calculation finished, Nhits: %i", NHits)); + AliDebug(5,Form("logic calculation finished, Nhits: %i", nHits)); - if (NHits >= 4) { + if (nHits >= 4) { // ----- track registration ----- AliDebug(1,"***** TMU: Track found *****"); AliTRDtrackGTU *track = new AliTRDtrackGTU(); @@ -472,9 +476,9 @@ Bool_t AliTRDgtuTMU::RunTrackFinder(Int_t zch, TList* /* ListOfTracks */) } } - if ( (NUnc != 0) && (NUnc + NHits >= 4) ) // could this position of the reference layer give some track //??? special check in case of hit? + 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 + else if (nWayBeyond > 2) // no track possible for both reference tracklets inc[reflayer] = 2; else inc[reflayer] = 1; @@ -499,13 +503,13 @@ 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) ) && - !(trkA->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkA->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkA->GetYProj() > Yplus ) ) ) // trkA could hit trkRA + 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) { - if ( trkB->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() < Yminus) ) + if ( trkB->GetSubChannel(zch) < trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() < yMinus) ) inc[layer] = 2; - else if ( !(trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > Yplus) ) ) + else if ( !(trkB->GetSubChannel(zch) > trkRA->GetSubChannel(zch) || (trkB->GetSubChannel(zch) == trkRA->GetSubChannel(zch) && trkB->GetYProj() > yPlus) ) ) inc[layer] = 1; else inc[layer] = incprime[layer]; @@ -677,6 +681,8 @@ Bool_t AliTRDgtuTMU::RunTrackMerging(TList* ListOfTracks) Bool_t AliTRDgtuTMU::RunTrackReconstruction(TList* ListOfTracks) { + // run the track reconstruction for all tracks in the list + TIter next(ListOfTracks); while (AliTRDtrackGTU *track = (AliTRDtrackGTU*) next()) { CalculateTrackParams(track); @@ -687,6 +693,7 @@ Bool_t AliTRDgtuTMU::RunTrackReconstruction(TList* ListOfTracks) Bool_t AliTRDgtuTMU::CalculatePID(AliTRDtrackGTU *track) { + // calculate PID for the given track if (!track) { AliError("No track to calculate!"); return kFALSE; @@ -703,6 +710,7 @@ Bool_t AliTRDgtuTMU::CalculatePID(AliTRDtrackGTU *track) nTracklets++; } track->SetPID(pidSum/nTracklets); + return kTRUE; } Bool_t AliTRDgtuTMU::CalculateTrackParams(AliTRDtrackGTU *track) @@ -783,6 +791,8 @@ Bool_t AliTRDgtuTMU::WriteTrackletsToTree(TTree *trklTree) Bool_t AliTRDgtuTMU::Uniquifier(TList *inlist, TList *outlist) { + // remove multiple occurences of the same track + TIter next(inlist); AliTRDtrackGTU *trkStage0 = 0x0; AliTRDtrackGTU *trkStage1 = 0x0; @@ -790,17 +800,17 @@ Bool_t AliTRDgtuTMU::Uniquifier(TList *inlist, TList *outlist) do { trkStage0 = (AliTRDtrackGTU*) next(); - Bool_t tracks_equal = kFALSE; + Bool_t tracksEqual = kFALSE; if (trkStage0 != 0 && trkStage1 != 0) { for (Int_t layer = 0; layer < fGtuParam->GetNLayers(); layer++) { if (trkStage0->GetTrackletIndex(layer) != -1 && trkStage0->GetTrackletIndex(layer) == trkStage1->GetTrackletIndex(layer)) { - tracks_equal = kTRUE; + tracksEqual = kTRUE; break; } } } - if (tracks_equal) { + if (tracksEqual) { if (trkStage0->GetNTracklets() > trkStage1->GetNTracklets()) trkStage1 = trkStage0; } diff --git a/TRD/AliTRDmcmSim.cxx b/TRD/AliTRDmcmSim.cxx index 259a92aacd8..aa1ce76e97f 100644 --- a/TRD/AliTRDmcmSim.cxx +++ b/TRD/AliTRDmcmSim.cxx @@ -1074,7 +1074,7 @@ void AliTRDmcmSim::ZSMapping() } } -void AliTRDmcmSim::DumpData( char *f, char *target ) +void AliTRDmcmSim::DumpData( const char * const f, const char * const target ) { // // Dump data stored (for debugging). @@ -1648,7 +1648,6 @@ void AliTRDmcmSim::FitTracklet() // calculate MC label Int_t mcLabel = -1; - Int_t nHits = 0; Int_t nHits0 = 0; Int_t nHits1 = 0; if (fDigitsManager) { @@ -1705,6 +1704,8 @@ void AliTRDmcmSim::FitTracklet() Int_t AliTRDmcmSim::GetPID(Float_t q0, Float_t q1) { + // get PID from accumulated charges q0 and q1 + Int_t binQ0 = (Int_t) (q0 * fgPidNBinsQ0) + 1; Int_t binQ1 = (Int_t) (q1 * fgPidNBinsQ1) + 1; binQ0 = binQ0 >= fgPidNBinsQ0 ? fgPidNBinsQ0-1 : binQ0; @@ -1715,6 +1716,8 @@ Int_t AliTRDmcmSim::GetPID(Float_t q0, Float_t q1) void AliTRDmcmSim::SetPIDlut(Int_t *lut, Int_t nbinsq0, Int_t nbinsq1) { + // set a user-defined PID LUT + if (fgPidLutDelete) delete [] fgPidLut; @@ -1726,6 +1729,8 @@ void AliTRDmcmSim::SetPIDlut(Int_t *lut, Int_t nbinsq0, Int_t nbinsq1) void AliTRDmcmSim::SetPIDlut(TH2F *lut) { + // set a user-defined PID LUT from a 2D histogram + if (fgPidLutDelete) delete [] fgPidLut; @@ -1745,6 +1750,8 @@ void AliTRDmcmSim::SetPIDlut(TH2F *lut) void AliTRDmcmSim::SetPIDlutDefault() { + // use the default PID LUT + if (fgPidLutDelete ) delete [] fgPidLut; @@ -1776,6 +1783,8 @@ void AliTRDmcmSim::Tracklet() Bool_t AliTRDmcmSim::StoreTracklets() { + // store the found tracklets via the loader + if (fTrackletArray->GetEntriesFast() == 0) return kTRUE; diff --git a/TRD/AliTRDmcmSim.h b/TRD/AliTRDmcmSim.h index 85000b725cc..91bfd0e685e 100644 --- a/TRD/AliTRDmcmSim.h +++ b/TRD/AliTRDmcmSim.h @@ -40,8 +40,8 @@ class AliTRDmcmSim : public TObject { 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) { return (fADCR[iadc][timebin] >> 2); } // Get unfiltered ADC data - Int_t GetDataFiltered(Int_t iadc, Int_t timebin) { return (fADCF[iadc][timebin] >> 2); } // Get filtered ADC data + 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 it, Int_t adc ); // Set ADC data void SetData(AliTRDarrayADC *adcArray, @@ -110,7 +110,7 @@ class AliTRDmcmSim : public TObject { // data display void Print(Option_t* const option="") const; // print stored data to stdout void Draw(Option_t* const option =""); // draw data (ADC data, hits and tracklets) - void DumpData( char *f, char *target ); // Dump data stored (only for debugging) + void DumpData( const char *const f, const char *const target ); // Dump data stored (only for debugging) protected: Bool_t CheckInitialized(); // Check whether the class is initialized @@ -197,16 +197,16 @@ class AliTRDmcmSim : public TObject { AliTRDmcmSim(const AliTRDmcmSim &m); // not implemented AliTRDmcmSim &operator=(const AliTRDmcmSim &m); // not implemented - static Bool_t fgApplyCut; + static Bool_t fgApplyCut; // apply cut on deflection length - static Int_t fgAddBaseline; + static Int_t fgAddBaseline; // add baseline to the ADC values - static Float_t fgChargeNorm; - static Int_t fgPidNBinsQ0; - static Int_t fgPidNBinsQ1; - static Int_t fgPidLutDefault[40][50]; - static Int_t *fgPidLut; - static Bool_t fgPidLutDelete; + static Float_t fgChargeNorm; // normalization factor for charge (for PID) + static Int_t fgPidNBinsQ0; // number of bins in the PID LUT for Q0 + static Int_t fgPidNBinsQ1; // number of bins in the PID LUT for Q1 + static Int_t fgPidLutDefault[40][50]; // the default PID LUT + static Int_t *fgPidLut; // pointer to user defined PID LUT + static Bool_t fgPidLutDelete; // owns the LUT ClassDef(AliTRDmcmSim,4) }; diff --git a/TRD/AliTRDtrackletGTU.cxx b/TRD/AliTRDtrackletGTU.cxx index d63ed5ccff2..070cc443c40 100644 --- a/TRD/AliTRDtrackletGTU.cxx +++ b/TRD/AliTRDtrackletGTU.cxx @@ -98,6 +98,8 @@ AliTRDtrackletGTU::AliTRDtrackletGTU(const AliTRDtrackletGTU& tracklet) : AliTRDtrackletGTU& AliTRDtrackletGTU::operator=(const AliTRDtrackletGTU &rhs) { + // assignment operator + if (&rhs != this) { fTracklet = rhs.fTracklet; for (Int_t zch = 0; zch < fGtuParam->GetNZChannels(); zch++) @@ -171,7 +173,7 @@ void AliTRDtrackletGTU::SetSubChannel(Int_t zch, Int_t subch) fSubChannel[zch] = subch; } -Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch) +Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch) const { // get the subchannel in the given z-channel return fSubChannel[zch]; @@ -179,6 +181,8 @@ Int_t AliTRDtrackletGTU::GetSubChannel(Int_t zch) Int_t AliTRDtrackletGTU::GetLabel() const { + // get the MC label for the tracklet, -1 if none + if ( fTracklet->IsA() == TClass::GetClass("AliTRDtrackletMCM")) return ((AliTRDtrackletMCM*) fTracklet)->GetLabel(); else diff --git a/TRD/AliTRDtrackletGTU.h b/TRD/AliTRDtrackletGTU.h index 04a74aee48e..6ac20092cfb 100644 --- a/TRD/AliTRDtrackletGTU.h +++ b/TRD/AliTRDtrackletGTU.h @@ -34,14 +34,14 @@ class AliTRDtrackletGTU : public AliTRDtrackletBase { Int_t GetYbin() const { return fTracklet->GetYbin(); } Int_t GetdY() const { return fTracklet->GetdY(); } Int_t GetZbin() const { return fTracklet->GetZbin(); } - Int_t GetPID() const { return fTracklet->GetPID(); } + Int_t GetPID() const { return ((Int_t) (255 * fTracklet->GetPID())); } Double_t GetPID(Int_t is) const { return fTracklet->GetPID(is); } // ----- Getters for calculated properties ----- Int_t GetYProj() const { return fYProj; } Int_t GetAlpha() const { return fAlpha; } Int_t GetYPrime() const { return fYPrime; } - Int_t GetSubChannel(Int_t zch); + Int_t GetSubChannel(Int_t zch) const; // ----- Getters for offline corresponding values ----- Bool_t CookPID() { return kFALSE; } diff --git a/TRD/AliTRDtrackletMCM.cxx b/TRD/AliTRDtrackletMCM.cxx index e9597623a8a..f403aa3dfc6 100644 --- a/TRD/AliTRDtrackletMCM.cxx +++ b/TRD/AliTRDtrackletMCM.cxx @@ -37,6 +37,9 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord) : fROB(-1), fQ0(0), fQ1(0), + fNHits(0), + fNHits0(0), + fNHits1(0), fLabel(-1) { fGeo = new AliTRDgeometry(); @@ -51,6 +54,9 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) : fROB(-1), fQ0(0), fQ1(0), + fNHits(0), + fNHits0(0), + fNHits1(0), fLabel(-1) { fGeo = new AliTRDgeometry(); @@ -65,6 +71,9 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, fROB(rob), fQ0(0), fQ1(0), + fNHits(0), + fNHits0(0), + fNHits1(0), fLabel(-1) { fGeo = new AliTRDgeometry(); @@ -79,6 +88,9 @@ AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) : fROB(rhs.fROB), fQ0(rhs.fQ0), fQ1(rhs.fQ1), + fNHits(rhs.fNHits), + fNHits0(rhs.fNHits0), + fNHits1(rhs.fNHits1), fLabel(rhs.fLabel) { fGeo = new AliTRDgeometry(); diff --git a/TRD/AliTRDtrackletMCM.h b/TRD/AliTRDtrackletMCM.h index 67008c9595f..6a918c40b2a 100644 --- a/TRD/AliTRDtrackletMCM.h +++ b/TRD/AliTRDtrackletMCM.h @@ -37,7 +37,7 @@ class AliTRDtrackletMCM : public AliTRDtrackletBase { // ----- Getters for offline corresponding values ----- Bool_t CookPID() { return kFALSE; } - Double_t GetPID(Int_t /* is */) const { return 0; } + Double_t GetPID(Int_t /* is */) const { return GetPID()/255.; } Int_t GetDetector() const { return fHCId / 2; } Int_t GetHCId() const { return fHCId; } Float_t GetdYdX() const { return (GetdY() * 140e-4 / 3.); } diff --git a/TRD/AliTRDtrapConfig.cxx b/TRD/AliTRDtrapConfig.cxx index f35e743f34a..8503813aa2d 100644 --- a/TRD/AliTRDtrapConfig.cxx +++ b/TRD/AliTRDtrapConfig.cxx @@ -1,3 +1,26 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +//////////////////////////////////////////////////////////////////////////// +// // +// TRAP config // +// // +// Author: J. Klein (Jochen.Klein@cern.ch) // +// // +//////////////////////////////////////////////////////////////////////////// + #include "AliLog.h" #include "AliTRDgeometry.h" @@ -790,7 +813,7 @@ Bool_t AliTRDtrapConfig::AddValues(UInt_t det, UInt_t cmd, UInt_t extali, UInt_t for(Int_t linkPair=0; linkPair #include @@ -445,12 +453,12 @@ class AliTRDtrapConfig : public TObject kDMDELS, kLastReg }; // enum of all TRAP registers, to be used for access to them - inline const char* GetRegName(TrapReg_t reg) { return fRegs[reg].name.Data(); } - inline UShort_t GetRegAddress(TrapReg_t reg) { return fRegs[reg].addr; } - inline UShort_t GetRegNBits(TrapReg_t reg) { return fRegs[reg].nbits; } - inline UInt_t GetRegResetValue(TrapReg_t reg) { return fRegs[reg].res_val; } + const char* GetRegName(TrapReg_t reg) const { return fRegs[reg].fName.Data(); } + UShort_t GetRegAddress(TrapReg_t reg) const { return fRegs[reg].fAddr; } + UShort_t GetRegNBits(TrapReg_t reg) const { return fRegs[reg].fNbits; } + UInt_t GetRegResetValue(TrapReg_t reg) const { return fRegs[reg].fResetValue; } - TrapReg_t GetRegByAddress(Int_t address); + TrapReg_t GetRegByAddress(Int_t address) const; Int_t GetTrapReg(TrapReg_t reg, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1); Bool_t PrintTrapReg(TrapReg_t reg, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1); @@ -472,12 +480,12 @@ class AliTRDtrapConfig : public TObject static AliTRDtrapConfig *fgInstance; // pointer to instance (singleton) struct SimpleReg_t { - TString name; // Name of the register - UShort_t addr; // Address in GIO of TRAP - UShort_t nbits; // Number of bits, from 1 to 32 - UInt_t res_val; // reset value + TString fName; // Name of the register + 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(char *nnn = 0, UShort_t a = 0, UShort_t n = 0, UInt_t r = 0) : - name(nnn), addr(a), nbits(n), res_val(r) {} + fName(nnn), fAddr(a), fNbits(n), fResetValue(r) {} }; struct RegValue_t { @@ -485,7 +493,7 @@ class AliTRDtrapConfig : public TObject kInvalid = 0, kGlobal, kIndividual - } state; + } state; // mode of storage (global or per MCM) union { Int_t globalValue; Int_t *individualValue; @@ -496,15 +504,15 @@ class AliTRDtrapConfig : public TObject RegValue_t fRegisterValue[kLastReg]; // array of TRAP register values in use Bool_t AddValues(UInt_t det, UInt_t cmd, UInt_t extali, UInt_t addr, UInt_t data); - Short_t GetRobAB( UShort_t robsel, UShort_t linkpair ); // Converts the ROB part of the extended ALICE ID to robs + Short_t GetRobAB( UShort_t robsel, UShort_t linkpair ) const; // Converts the ROB part of the extended ALICE ID to robs Short_t ChipmaskToMCMlist( Int_t cmA, Int_t cmB, UShort_t linkpair ); // Converts the chipmask to a list of MCMs 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 fMcmlistSize=256; // list of MCMs to which a value has to be written + static const Int_t fgkMcmlistSize=256; // list of MCMs to which a value has to be written - Int_t fMcmlist[fMcmlistSize]; // stores the list of MCMs after the conversion from extAliID -> AliID + Int_t fMcmlist[fgkMcmlistSize]; // stores the list of MCMs after the conversion from extAliID -> AliID AliTRDtrapConfig(); // private constructor due to singleton implementation @@ -530,6 +538,11 @@ class AliTRDtrapConfig : public TObject kDBankSCSNData }; */ + + private: + AliTRDtrapConfig& operator=(const AliTRDtrapConfig &rhs); // not implemented + AliTRDtrapConfig(const AliTRDtrapConfig& cfg); // not implemented + ClassDef(AliTRDtrapConfig, 2); };