From 6d50f529b7ba0b8b8cea934ac14d4969bb6107a9 Mon Sep 17 00:00:00 2001 From: cblume Date: Fri, 11 Aug 2006 17:58:05 +0000 Subject: [PATCH] Next round of effc++ changes --- TRD/AliTRDTriggerL1.cxx | 35 +- TRD/AliTRDTriggerL1.h | 4 +- TRD/AliTRDcalibDB.cxx | 294 +++++++++------- TRD/AliTRDcalibDB.h | 18 +- TRD/AliTRDcluster.cxx | 212 ++++++----- TRD/AliTRDcluster.h | 91 ++--- TRD/AliTRDclusterMI.cxx | 42 ++- TRD/AliTRDclusterMI.h | 31 +- TRD/AliTRDclusterizer.cxx | 156 ++++---- TRD/AliTRDclusterizer.h | 51 +-- TRD/AliTRDclusterizerV1.cxx | 380 +++++++++----------- TRD/AliTRDclusterizerV1.h | 29 +- TRD/AliTRDgtuTrack.cxx | 223 +++++++----- TRD/AliTRDgtuTrack.h | 107 +++--- TRD/AliTRDltuTracklet.cxx | 75 ++-- TRD/AliTRDltuTracklet.h | 81 +++-- TRD/AliTRDmcm.cxx | 684 +++++++++++++++++++++--------------- TRD/AliTRDmcm.h | 136 +++---- TRD/AliTRDmcmTracklet.cxx | 144 +++++--- TRD/AliTRDmcmTracklet.h | 77 ++-- TRD/AliTRDmodule.cxx | 333 +++++++++++++----- TRD/AliTRDmodule.h | 116 +++--- TRD/AliTRDrecPoint.cxx | 185 +++++----- TRD/AliTRDrecPoint.h | 85 +++-- TRD/AliTRDtrigParam.cxx | 235 +++++++------ TRD/AliTRDtrigParam.h | 178 +++++----- TRD/AliTRDtrigger.cxx | 421 +++++++++++++--------- TRD/AliTRDtrigger.h | 133 ++++--- 28 files changed, 2559 insertions(+), 1997 deletions(-) diff --git a/TRD/AliTRDTriggerL1.cxx b/TRD/AliTRDTriggerL1.cxx index 4e4715ca75c..00df3444301 100644 --- a/TRD/AliTRDTriggerL1.cxx +++ b/TRD/AliTRDTriggerL1.cxx @@ -48,19 +48,32 @@ AliTRDTriggerL1::AliTRDTriggerL1():AliTriggerDetector() //_____________________________________________________________________________ void AliTRDTriggerL1::CreateInputs() { - // - // See TRIGGER/DAQ/HLT/DCS Techical Design Report, p. 58, Table 4.1 for the proposed inputs + // See TRIGGER/DAQ/HLT/DCS Techical Design Report, + // p. 58, Table 4.1 for the proposed inputs // - fInputs.AddLast(new AliTriggerInput( "TRD_Unlike_EPair_L1", "Unlike electron pair", 0x01 )); - fInputs.AddLast(new AliTriggerInput( "TRD_Like_EPair_L1", "Like electron pair", 0x02 )); - fInputs.AddLast(new AliTriggerInput( "TRD_Jet_LPt_L1", "Jet low pt", 0x04 )); - fInputs.AddLast(new AliTriggerInput( "TRD_Jet_HPt_L1", "Jet high pt", 0x08 )); - fInputs.AddLast(new AliTriggerInput( "TRD_Electron_L1", "Single electron", 0x10 )); - fInputs.AddLast(new AliTriggerInput( "TRD_HadrLPt_L1", "Single hadron low pt ", 0x20 )); - fInputs.AddLast(new AliTriggerInput( "TRD_HadrHPt_L1", "Single hadron high pt", 0x40 )); - + fInputs.AddLast(new AliTriggerInput("TRD_Unlike_EPair_L1" + ,"Unlike electron pair" + ,0x01 )); + fInputs.AddLast(new AliTriggerInput("TRD_Like_EPair_L1" + ,"Like electron pair" + ,0x02 )); + fInputs.AddLast(new AliTriggerInput("TRD_Jet_LPt_L1" + ,"Jet low pt" + ,0x04 )); + fInputs.AddLast(new AliTriggerInput("TRD_Jet_HPt_L1" + ,"Jet high pt" + ,0x08 )); + fInputs.AddLast(new AliTriggerInput("TRD_Electron_L1" + ,"Single electron" + ,0x10 )); + fInputs.AddLast(new AliTriggerInput("TRD_HadrLPt_L1" + ,"Single hadron low pt " + ,0x20 )); + fInputs.AddLast(new AliTriggerInput("TRD_HadrHPt_L1" + ,"Single hadron high pt" + ,0x40 )); } @@ -103,7 +116,7 @@ void AliTRDTriggerL1::Trigger() // Trigger (tracks, GTU) - Float_t highPt = trigp->GetHighPt(); + Float_t highPt = trigp->GetHighPt(); Float_t jetLowPt = trigp->GetJetLowPt(); Float_t jetHighPt = trigp->GetJetHighPt(); diff --git a/TRD/AliTRDTriggerL1.h b/TRD/AliTRDTriggerL1.h index dfcfdcb8f1f..f2862e521ca 100644 --- a/TRD/AliTRDTriggerL1.h +++ b/TRD/AliTRDTriggerL1.h @@ -14,8 +14,8 @@ class AliTRDTriggerL1 : public AliTriggerDetector public: - AliTRDTriggerL1(); // constructor - virtual ~AliTRDTriggerL1(){} // destructor + AliTRDTriggerL1(); + virtual ~AliTRDTriggerL1() {} virtual void CreateInputs(); virtual void Trigger(); diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx index 6f7df324b7a..ddb16c1fb91 100644 --- a/TRD/AliTRDcalibDB.cxx +++ b/TRD/AliTRDcalibDB.cxx @@ -65,11 +65,13 @@ AliTRDcalibDB* AliTRDcalibDB::Instance() // Returns an instance of this class, it is created if neccessary // - if (fgTerminated != kFALSE) + if (fgTerminated != kFALSE) { return 0; + } - if (fgInstance == 0) + if (fgInstance == 0) { fgInstance = new AliTRDcalibDB(); + } return fgInstance; } @@ -85,8 +87,7 @@ void AliTRDcalibDB::Terminate() fgTerminated = kTRUE; - if (fgInstance != 0) - { + if (fgInstance != 0) { delete fgInstance; fgInstance = 0; } @@ -97,6 +98,12 @@ void AliTRDcalibDB::Terminate() AliTRDcalibDB::AliTRDcalibDB() :TObject() ,fRun(-1) + ,fPRFsmp(0) + ,fPRFbin(0) + ,fPRFlo(0) + ,fPRFhi(0) + ,fPRFwid(0) + ,fPRFpad(0) { // // Default constructor @@ -106,15 +113,7 @@ AliTRDcalibDB::AliTRDcalibDB() // TODO invalid calibration data to be used. // - fPadResponse.fPRFbin = 0; - fPadResponse.fPRFlo = 0.0; - fPadResponse.fPRFhi = 0.0; - fPadResponse.fPRFwid = 0.0; - fPadResponse.fPRFpad = 0; - fPadResponse.fPRFsmp = 0; - - for (Int_t i=0; i (GetCachedCDBObject(kIDVdriftPad)); - if (!calPad) + const AliTRDCalPad* calPad = dynamic_cast + (GetCachedCDBObject(kIDVdriftPad)); + if (!calPad) { return -1; + } AliTRDCalROC* roc = calPad->GetCalROC(det); - if (!roc) + if (!roc) { return -1; + } - const AliTRDCalDet* calChamber = dynamic_cast (GetCachedCDBObject(kIDVdriftChamber)); - if (!calChamber) + const AliTRDCalDet* calChamber = dynamic_cast + (GetCachedCDBObject(kIDVdriftChamber)); + if (!calChamber) { return -1; + } return calChamber->GetValue(det) * roc->GetValue(col, row); @@ -365,9 +367,11 @@ Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det) // Returns the average drift velocity for the given detector // - const AliTRDCalDet* calDet = dynamic_cast (GetCachedCDBObject(kIDVdriftChamber)); - if (!calDet) + const AliTRDCalDet* calDet = dynamic_cast + (GetCachedCDBObject(kIDVdriftChamber)); + if (!calDet) { return -1; + } return calDet->GetValue(det); @@ -380,17 +384,22 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) // Returns t0 for the given pad. // - const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDT0Pad)); - if (!calPad) + const AliTRDCalPad* calPad = dynamic_cast + (GetCachedCDBObject(kIDT0Pad)); + if (!calPad) { return -1; + } AliTRDCalROC* roc = calPad->GetCalROC(det); - if (!roc) + if (!roc) { return -1; + } - const AliTRDCalDet* calChamber = dynamic_cast (GetCachedCDBObject(kIDT0Chamber)); - if (!calChamber) + const AliTRDCalDet* calChamber = dynamic_cast + (GetCachedCDBObject(kIDT0Chamber)); + if (!calChamber) { return -1; + } return calChamber->GetValue(det) * roc->GetValue(col, row); @@ -403,9 +412,11 @@ Float_t AliTRDcalibDB::GetT0Average(Int_t det) // Returns the average t0 for the given detector // - const AliTRDCalDet* calDet = dynamic_cast (GetCachedCDBObject(kIDT0Chamber)); - if (!calDet) + const AliTRDCalDet* calDet = dynamic_cast + (GetCachedCDBObject(kIDT0Chamber)); + if (!calDet) { return -1; + } return calDet->GetValue(det); @@ -418,17 +429,21 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) // Returns the gain factor for the given pad. // - const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDGainFactorPad)); - if (!calPad) + const AliTRDCalPad* calPad = dynamic_cast + (GetCachedCDBObject(kIDGainFactorPad)); + if (!calPad) { return -1; + } AliTRDCalROC* roc = calPad->GetCalROC(det); if (!roc) return -1; - const AliTRDCalDet* calChamber = dynamic_cast (GetCachedCDBObject(kIDGainFactorChamber)); - if (!calChamber) + const AliTRDCalDet* calChamber = dynamic_cast + (GetCachedCDBObject(kIDGainFactorChamber)); + if (!calChamber) { return -1; + } return calChamber->GetValue(det) * roc->GetValue(col, row); @@ -441,9 +456,11 @@ Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) // Returns the average gain factor for the given detector // - const AliTRDCalDet* calDet = dynamic_cast (GetCachedCDBObject(kIDGainFactorChamber)); - if (!calDet) + const AliTRDCalDet* calDet = dynamic_cast + (GetCachedCDBObject(kIDGainFactorChamber)); + if (!calDet) { return -1; + } return calDet->GetValue(det); @@ -456,13 +473,16 @@ Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) // Returns the PRF width for the given pad. // - const AliTRDCalPad* calPad = dynamic_cast (GetCachedCDBObject(kIDPRFWidth)); - if (!calPad) + const AliTRDCalPad* calPad = dynamic_cast + (GetCachedCDBObject(kIDPRFWidth)); + if (!calPad) { return -1; + } AliTRDCalROC* roc = calPad->GetCalROC(det); - if (!roc) + if (!roc) { return -1; + } return roc->GetValue(col, row); @@ -475,10 +495,12 @@ Float_t AliTRDcalibDB::GetSamplingFrequency() // Returns the sampling frequency of the TRD read-out. // - const AliTRDCalGlobals* calGlobal = dynamic_cast (GetCachedCDBObject(kIDGlobals)); - if (!calGlobal) + const AliTRDCalGlobals* calGlobal = dynamic_cast + (GetCachedCDBObject(kIDGlobals)); + if (!calGlobal) { return -1; - + } + return calGlobal->GetSamplingFrequency(); } @@ -490,9 +512,11 @@ Int_t AliTRDcalibDB::GetNumberOfTimeBins() // Returns the number of time bins which are read-out. // - const AliTRDCalGlobals* calGlobal = dynamic_cast (GetCachedCDBObject(kIDGlobals)); - if (!calGlobal) + const AliTRDCalGlobals* calGlobal = dynamic_cast + (GetCachedCDBObject(kIDGlobals)); + if (!calGlobal) { return -1; + } return calGlobal->GetNumberOfTimeBins(); @@ -505,13 +529,16 @@ Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) // Returns the status of the given pad // - const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); - if (!cal) + const AliTRDCalPadStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDPadStatus)); + if (!cal) { return -1; + } const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det); - if (!roc) + if (!roc) { return -1; + } return roc->GetStatus(col, row); @@ -524,15 +551,19 @@ Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row) // Returns the status of the given MCM // + // To translate pad column number into MCM number Int_t mcm = ((Int_t) col / 18); - const AliTRDCalMCMStatus* cal = dynamic_cast (GetCachedCDBObject(kIDMCMStatus)); - if (!cal) + const AliTRDCalMCMStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDMCMStatus)); + if (!cal) { return -1; + } const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det); - if (!roc) + if (!roc) { return -1; + } return roc->GetStatus(mcm, row); @@ -545,9 +576,11 @@ Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) // Returns the status of the given chamber // - const AliTRDCalChamberStatus* cal = dynamic_cast (GetCachedCDBObject(kIDChamberStatus)); - if (!cal) + const AliTRDCalChamberStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDChamberStatus)); + if (!cal) { return -1; + } return cal->GetStatus(det); @@ -560,9 +593,11 @@ Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm) // Returns the status of the given chamber // - const AliTRDCalSuperModuleStatus* cal = dynamic_cast (GetCachedCDBObject(kIDSuperModuleStatus)); - if (!cal) + const AliTRDCalSuperModuleStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDSuperModuleStatus)); + if (!cal) { return -1; + } return cal->GetStatus(sm); @@ -575,9 +610,11 @@ Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row) // Returns status, see name of functions for details ;-) // - const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); - if (!cal) + const AliTRDCalPadStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDPadStatus)); + if (!cal) { return -1; + } return cal->IsMasked(det, col, row); @@ -590,9 +627,11 @@ Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row) // Returns status, see name of functions for details ;-) // - const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); - if (!cal) + const AliTRDCalPadStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDPadStatus)); + if (!cal) { return -1; + } return cal->IsBridgedLeft(det, col, row); @@ -605,9 +644,11 @@ Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) // Returns status, see name of functions for details ;-) // - const AliTRDCalPadStatus* cal = dynamic_cast (GetCachedCDBObject(kIDPadStatus)); - if (!cal) + const AliTRDCalPadStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDPadStatus)); + if (!cal) { return -1; + } return cal->IsBridgedRight(det, col, row); @@ -620,9 +661,11 @@ Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row) // Returns status, see name of functions for details ;-) // - const AliTRDCalMCMStatus* cal = dynamic_cast (GetCachedCDBObject(kIDMCMStatus)); - if (!cal) + const AliTRDCalMCMStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDMCMStatus)); + if (!cal) { return -1; + } return cal->IsMasked(det, col, row); @@ -635,9 +678,11 @@ Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det) // Returns status, see name of functions for details ;-) // - const AliTRDCalChamberStatus* cal = dynamic_cast (GetCachedCDBObject(kIDChamberStatus)); - if (!cal) + const AliTRDCalChamberStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDChamberStatus)); + if (!cal) { return -1; + } return cal->IsInstalled(det); @@ -650,9 +695,11 @@ Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det) // Returns status, see name of functions for details ;-) // - const AliTRDCalChamberStatus* cal = dynamic_cast (GetCachedCDBObject(kIDChamberStatus)); - if (!cal) + const AliTRDCalChamberStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDChamberStatus)); + if (!cal) { return -1; + } return cal->IsMasked(det); @@ -665,9 +712,11 @@ Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det) // Returns status, see name of functions for details ;-) // - const AliTRDCalSuperModuleStatus* cal = dynamic_cast (GetCachedCDBObject(kIDSuperModuleStatus)); - if (!cal) + const AliTRDCalSuperModuleStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDSuperModuleStatus)); + if (!cal) { return -1; + } return cal->IsInstalled(det); @@ -680,9 +729,11 @@ Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det) // Returns status, see name of functions for details ;-) // - const AliTRDCalSuperModuleStatus* cal = dynamic_cast (GetCachedCDBObject(kIDSuperModuleStatus)); - if (!cal) + const AliTRDCalSuperModuleStatus* cal = dynamic_cast + (GetCachedCDBObject(kIDSuperModuleStatus)); + if (!cal) { return -1; + } return cal->IsMasked(det); @@ -759,7 +810,8 @@ void AliTRDcalibDB::SamplePRF() const Int_t kPRFbin = 61; - Float_t prf[kNplan][kPRFbin] = { {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02, + Float_t prf[kNplan][kPRFbin] = { + {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02, 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02, 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01, 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01, @@ -857,20 +909,20 @@ void AliTRDcalibDB::SamplePRF() 1.5096e-02}}; // More sampling precision with linear interpolation - fPadResponse.fPRFlo = -1.5; - fPadResponse.fPRFhi = 1.5; + fPRFlo = -1.5; + fPRFhi = 1.5; Float_t pad[kPRFbin]; Int_t sPRFbin = kPRFbin; - Float_t sPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) sPRFbin); + Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin); for (Int_t iPad = 0; iPad < sPRFbin; iPad++) { - pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPadResponse.fPRFlo; + pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo; } - fPadResponse.fPRFbin = 500; - fPadResponse.fPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) fPadResponse.fPRFbin); - fPadResponse.fPRFpad = ((Int_t) (1.0 / fPadResponse.fPRFwid)); + fPRFbin = 500; + fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin); + fPRFpad = ((Int_t) (1.0 / fPRFwid)); - if (fPadResponse.fPRFsmp) delete [] fPadResponse.fPRFsmp; - fPadResponse.fPRFsmp = new Float_t[kNplan*fPadResponse.fPRFbin]; + if (fPRFsmp) delete [] fPRFsmp; + fPRFsmp = new Float_t[kNplan*fPRFbin]; Int_t ipos1; Int_t ipos2; @@ -878,25 +930,25 @@ void AliTRDcalibDB::SamplePRF() for (Int_t iPla = 0; iPla < kNplan; iPla++) { - for (Int_t iBin = 0; iBin < fPadResponse.fPRFbin; iBin++) { + for (Int_t iBin = 0; iBin < fPRFbin; iBin++) { - Float_t bin = (((Float_t) iBin) + 0.5) * fPadResponse.fPRFwid + fPadResponse.fPRFlo; + Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo; ipos1 = ipos2 = 0; diff = 0; do { diff = bin - pad[ipos2++]; } while ((diff > 0) && (ipos2 < kPRFbin)); if (ipos2 == kPRFbin) { - fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1]; + fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1]; } else if (ipos2 == 1) { - fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1]; + fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1]; } else { ipos2--; if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1; ipos1 = ipos2 - 1; - fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2] + fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2] + diff * (prf[iPla][ipos2] - prf[iPla][ipos1]) / sPRFwid; } @@ -914,24 +966,24 @@ Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist // Applies the pad response // - Int_t iBin = ((Int_t) (( - dist - fPadResponse.fPRFlo) / fPadResponse.fPRFwid)); - Int_t iOff = plane * fPadResponse.fPRFbin; + Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid)); + Int_t iOff = plane * fPRFbin; - Int_t iBin0 = iBin - fPadResponse.fPRFpad + iOff; + Int_t iBin0 = iBin - fPRFpad + iOff; Int_t iBin1 = iBin + iOff; - Int_t iBin2 = iBin + fPadResponse.fPRFpad + iOff; + Int_t iBin2 = iBin + fPRFpad + iOff; pad[0] = 0.0; pad[1] = 0.0; pad[2] = 0.0; - if ((iBin1 >= 0) && (iBin1 < (fPadResponse.fPRFbin*kNplan))) { + if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNplan))) { if (iBin0 >= 0) { - pad[0] = signal * fPadResponse.fPRFsmp[iBin0]; + pad[0] = signal * fPRFsmp[iBin0]; } - pad[1] = signal * fPadResponse.fPRFsmp[iBin1]; - if (iBin2 < (fPadResponse.fPRFbin*kNplan)) { - pad[2] = signal * fPadResponse.fPRFsmp[iBin2]; + pad[1] = signal * fPRFsmp[iBin1]; + if (iBin2 < (fPRFbin*kNplan)) { + pad[2] = signal * fPRFsmp[iBin2]; } return 1; diff --git a/TRD/AliTRDcalibDB.h b/TRD/AliTRDcalibDB.h index 705afb4c986..f2f01a2c9a7 100644 --- a/TRD/AliTRDcalibDB.h +++ b/TRD/AliTRDcalibDB.h @@ -91,20 +91,18 @@ class AliTRDcalibDB : public TObject { static AliTRDcalibDB *fgInstance; // Instance of this class (singleton implementation) static Bool_t fgTerminated; // Defines if this class has already been terminated + AliCDBEntry *fCDBEntries[kCDBCacheSize]; // Cache for CDB entries TObject *fCDBCache[kCDBCacheSize]; // Cache for calibration objects. Long64_t fRun; // Run Number - struct - { - Float_t *fPRFsmp; //! Sampled pad response - Int_t fPRFbin; // Number of bins for the PRF - Float_t fPRFlo; // Lower boundary of the PRF - Float_t fPRFhi; // Higher boundary of the PRF - Float_t fPRFwid; // Bin width of the sampled PRF - Int_t fPRFpad; // Distance to next pad in PRF - } fPadResponse; + Float_t *fPRFsmp; //! Sampled pad response + Int_t fPRFbin; // Number of bins for the PRF + Float_t fPRFlo; // Lower boundary of the PRF + Float_t fPRFhi; // Higher boundary of the PRF + Float_t fPRFwid; // Bin width of the sampled PRF + Int_t fPRFpad; // Distance to next pad in PRF private: @@ -113,7 +111,7 @@ class AliTRDcalibDB : public TObject { AliTRDcalibDB &operator=(const AliTRDcalibDB &c); virtual ~AliTRDcalibDB(); - ClassDef(AliTRDcalibDB, 2) // Provides central access to the CDB + ClassDef(AliTRDcalibDB,3) // Provides central access to the CDB }; diff --git a/TRD/AliTRDcluster.cxx b/TRD/AliTRDcluster.cxx index 2010ab87582..64d2c642d1f 100644 --- a/TRD/AliTRDcluster.cxx +++ b/TRD/AliTRDcluster.cxx @@ -27,70 +27,81 @@ ClassImp(AliTRDcluster) - - //___________________________________________________________________________ - - AliTRDcluster::AliTRDcluster() : AliCluster() { +//___________________________________________________________________________ +AliTRDcluster::AliTRDcluster() + :AliCluster() + ,fDetector(0) + ,fX(0) + ,fTimeBin(0) + ,fQ(0) + ,fNPads(0) + ,fCenter(0) +{ // // default constructor // - fQ=0; - fTimeBin=0; - fDetector=0; - fNPads=0; - fX =0; - for (Int_t i = 0;i<7; i++) fSignals[i]=0; + + for (Int_t i = 0; i < 7; i++) { + fSignals[i] = 0; + } + } + //_____________________________________________________________________________ - AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster() +AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p) + :AliCluster() + ,fDetector(p.GetDetector()) + ,fX(0) + ,fTimeBin(p.GetLocalTimeBin()) + ,fQ(p.GetEnergy()) + ,fNPads(0) + ,fCenter(0) { // // Constructor from AliTRDrecPoint // - fDetector = p.GetDetector(); - fTimeBin = p.GetLocalTimeBin(); - - fTracks[0] = p.GetTrackIndex(0); - fTracks[1] = p.GetTrackIndex(1); - fTracks[2] = p.GetTrackIndex(2); + fTracks[0] = p.GetTrackIndex(0); + fTracks[1] = p.GetTrackIndex(1); + fTracks[2] = p.GetTrackIndex(2); + fY = p.GetY(); + fZ = p.GetZ(); - fQ = p.GetEnergy(); + //fSigmaY2 = p.GetSigmaY2(); + //fSigmaZ2 = p.GetSigmaZ2(); + // Why is this ???? + fSigmaY2 = 0.2; + fSigmaZ2 = 5.0; - fY = p.GetY(); - fZ = p.GetZ(); - fSigmaY2 = p.GetSigmaY2(); - fSigmaZ2 = p.GetSigmaZ2(); - - fSigmaY2 = 0.2; - fSigmaZ2 = 5.; - fNPads =0; - fCenter = 0; } //_____________________________________________________________________________ -AliTRDcluster::AliTRDcluster(const AliTRDcluster &c):AliCluster() +AliTRDcluster::AliTRDcluster(const AliTRDcluster &c) + :AliCluster() + ,fDetector(c.fDetector) + ,fX(c.fX) + ,fTimeBin(c.fTimeBin) + ,fQ(c.fQ) + ,fNPads(c.fNPads) + ,fCenter(c.fCenter) { // // Copy constructor // - fTracks[0] = c.GetLabel(0); - fTracks[1] = c.GetLabel(1); - fTracks[2] = c.GetLabel(2); - - fX = c.GetX(); - fY = c.GetY(); - fZ = c.GetZ(); - fSigmaY2 = c.GetSigmaY2(); - fSigmaZ2 = c.GetSigmaZ2(); - - fDetector = c.GetDetector(); - fTimeBin = c.GetLocalTimeBin(); - fQ = c.GetQ(); - fNPads = c.fNPads; - fCenter = c.fCenter; - for (Int_t i=0;i<7;i++) fSignals[i] = c.fSignals[i]; + fTracks[0] = c.GetLabel(0); + fTracks[1] = c.GetLabel(1); + fTracks[2] = c.GetLabel(2); + + fY = c.GetY(); + fZ = c.GetZ(); + fSigmaY2 = c.GetSigmaY2(); + fSigmaZ2 = c.GetSigmaZ2(); + + for (Int_t i = 0; i < 7; i++) { + fSignals[i] = c.fSignals[i]; + } + } //_____________________________________________________________________________ @@ -106,88 +117,97 @@ void AliTRDcluster::AddTrackIndex(Int_t *track) // const Int_t kSize = 9; + Int_t entries[kSize][2]; - Int_t entries[kSize][2], i, j, index; - + Int_t i = 0; + Int_t j = 0; + Int_t k = 0; + Int_t index; Bool_t indexAdded; - for (i=0; i= 0) { - while ( (!indexAdded) && ( j < kSize ) ) { - if ((entries[j][0]==index) || (entries[j][1]==0)) { - entries[j][0]=index; - entries[j][1]=entries[j][1]+1; - indexAdded=kTRUE; + while ((!indexAdded) && (j < kSize)) { + if ((entries[j][0] == index) || + (entries[j][1] == 0)) { + entries[j][0] = index; + entries[j][1] = entries[j][1] + 1; + indexAdded = kTRUE; } j++; } } - } - - // sort by number of appearances and index value - Int_t swap=1, tmp0, tmp1; - while ( swap > 0) { - swap=0; - for(i=0; i<(kSize-1); i++) { - if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { + + } + + // Sort by number of appearances and index value + Int_t swap = 1; + Int_t tmp0; + Int_t tmp1; + while (swap > 0) { + swap = 0; + for (i = 0; i < (kSize - 1); i++) { + if ((entries[i][0] >= 0) && + (entries[i+1][0] >= 0)) { if ((entries[i][1] < entries[i+1][1]) || ((entries[i][1] == entries[i+1][1]) && - (entries[i][0] > entries[i+1][0]))) { - tmp0=entries[i][0]; - tmp1=entries[i][1]; - entries[i][0]=entries[i+1][0]; - entries[i][1]=entries[i+1][1]; - entries[i+1][0]=tmp0; - entries[i+1][1]=tmp1; - swap++; + (entries[i][0] > entries[i+1][0]))) { + tmp0 = entries[i][0]; + tmp1 = entries[i][1]; + entries[i][0] = entries[i+1][0]; + entries[i][1] = entries[i+1][1]; + entries[i+1][0] = tmp0; + entries[i+1][1] = tmp1; + swap++; } } } } - // set track indexes - for(i=0; i<3; i++) SetLabel(entries[i][0],i); + // Set track indexes + for (i = 0; i < 3; i++) { + SetLabel(entries[i][0],i); + } return; } -void AliTRDcluster::SetSignals(Short_t*signals){ +//_____________________________________________________________________________ +void AliTRDcluster::SetSignals(Short_t *signals) +{ // - // write signals in the cluster + // Write signals in the cluster // - for (Int_t i = 0;i<7;i++) fSignals[i]=signals[i]; + + for (Int_t i = 0; i < 7; i++) { + fSignals[i] = signals[i]; + } + } +//_____________________________________________________________________________ Float_t AliTRDcluster::GetSumS() const { // - // return total charge in non unfolded cluster + // Returns the total charge from a not unfolded cluster // - Float_t sum=0; - for (Int_t i = 0;i<7;i++) sum+=fSignals[i]; - return sum; -} -Float_t AliTRDcluster::GetCenterS() const -{ - // - // - // - Float_t sum=0; - Float_t sum2=0; - for (Int_t i = 0;i<7;i++) { - sum+=fSignals[i]; - sum2+=i*fSignals[i]; + + Float_t sum = 0.0; + for (Int_t i = 0; i < 7; i++) { + sum += fSignals[i]; } - if (sum>0) return sum2/sum-2; - return 0; + + return sum; } diff --git a/TRD/AliTRDcluster.h b/TRD/AliTRDcluster.h index a1456193655..c291777004d 100644 --- a/TRD/AliTRDcluster.h +++ b/TRD/AliTRDcluster.h @@ -5,6 +5,11 @@ /* $Id$ */ +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD cluster // +// // +/////////////////////////////////////////////////////////////////////////////// #include "AliCluster.h" @@ -18,59 +23,57 @@ class AliTRDcluster : public AliCluster { AliTRDcluster(const AliTRDcluster &c); AliTRDcluster(const AliTRDrecPoint &p); - virtual void AddTrackIndex(Int_t *i); + virtual void AddTrackIndex(Int_t *i); - - Int_t IsUsed() const { return (fQ < 0) ? 1 : 0; } - void Use(Int_t = 0) { fQ = -fQ; } + Int_t IsUsed() const { return (fQ < 0) ? 1 : 0; } + void Use(Int_t = 0) { fQ = -fQ; } - Bool_t From2pad() const { return TestBit(k2pad); } - Bool_t From3pad() const { return TestBit(k3pad); } - Bool_t From4pad() const { return TestBit(k4pad); } - Bool_t From5pad() const { return TestBit(k5pad); } - Bool_t FromLarge() const { return TestBit(kLarge);} - Bool_t Isolated() const { return (TestBit(k2pad) || TestBit(k3pad)); } + Bool_t From2pad() const { return TestBit(k2pad); } + Bool_t From3pad() const { return TestBit(k3pad); } + Bool_t From4pad() const { return TestBit(k4pad); } + Bool_t From5pad() const { return TestBit(k5pad); } + Bool_t FromLarge() const { return TestBit(kLarge); } + Bool_t Isolated() const { return (TestBit(k2pad) || TestBit(k3pad)); } - virtual void SetDetector(Int_t d) { fDetector = d; } - void SetLocalTimeBin(Int_t t) { fTimeBin = t; } - void SetQ(Float_t q) { fQ = q; } - virtual void SetX(Float_t x) { fX = x; } - void SetSignals(Short_t *signals); + virtual void SetDetector(Int_t d) { fDetector = d; } + void SetLocalTimeBin(Int_t t) { fTimeBin = t; } + void SetQ(Float_t q) { fQ = q; } + virtual void SetX(Float_t x) { fX = x; } + void SetCenter(Float_t c) { fCenter = c; } + void SetSignals(Short_t *signals); + void Set2pad() { SetBit(k2pad); fNPads = 2; } + void Set3pad() { SetBit(k3pad); fNPads = 3; } + void Set4pad() { SetBit(k4pad); fNPads = 4; } + void Set5pad() { SetBit(k5pad); fNPads = 5; } + void SetLarge() { SetBit(kLarge); fNPads = 6; } - virtual Int_t GetDetector() const { return fDetector; } - Int_t GetLocalTimeBin() const { return fTimeBin; } - Float_t GetQ() const { return fQ; } - virtual Float_t GetX() const { return fX; } + virtual Int_t GetDetector() const { return fDetector; } + Int_t GetLocalTimeBin() const { return fTimeBin; } + Float_t GetQ() const { return fQ; } + virtual Float_t GetX() const { return fX; } + Int_t GetNPads() const { return fNPads; } + Float_t GetCenter() const { return fCenter; } + Float_t GetSumS() const; - void Set2pad() { SetBit(k2pad); fNPads=2; } - void Set3pad() { SetBit(k3pad); fNPads=3; } - void Set4pad() { SetBit(k4pad); fNPads=4; } - void Set5pad() { SetBit(k5pad); fNPads=5; } - void SetLarge() { SetBit(kLarge);fNPads=6; } - Int_t GetNPads() const {return fNPads;} - void SetCenter(Float_t center){fCenter =center;} - Float_t GetCenter() const {return fCenter;} - Float_t GetSumS() const; - Float_t GetCenterS() const; protected: - enum { - k2pad = 0x00000001, // 2 pad cluster - k3pad = 0x00000002, // 3 pad cluster - k4pad = 0x00000004, // 4 pad cluster - k5pad = 0x00000008, // 5 pad cluster - kLarge = 0x00000016 // Large cluster - }; + enum { + k2pad = 0x00000001, // 2 pad cluster + k3pad = 0x00000002, // 3 pad cluster + k4pad = 0x00000004, // 4 pad cluster + k5pad = 0x00000008, // 5 pad cluster + kLarge = 0x00000016 // Large cluster + }; - Int_t fDetector; // TRD detector number - Float_t fX; // local (in this detector) x pos (first order proportional to time bin (depends on local drift velocity!), (x=0 corresponds timebin=0, thus x increases TOWARDS interaction point ) - Char_t fTimeBin; // Time bin number within the detector - Float_t fQ; // amplitude - Char_t fNPads; // number of pads in cluster - Float_t fCenter; // center of the cluster relative to the pad - Short_t fSignals[7]; // signals in the cluster + Int_t fDetector; // TRD detector number + Float_t fX; // Local x position (first order proportional to time bin) + Char_t fTimeBin; // Time bin number within the detector + Float_t fQ; // Amplitude + Char_t fNPads; // Number of pads in cluster + Float_t fCenter; // Center of the cluster relative to the pad + Short_t fSignals[7]; // Signals in the cluster - ClassDef(AliTRDcluster,3) // Cluster for the TRD + ClassDef(AliTRDcluster,3) // Cluster for the TRD }; diff --git a/TRD/AliTRDclusterMI.cxx b/TRD/AliTRDclusterMI.cxx index 5ce4cee75fe..45b9e04481a 100644 --- a/TRD/AliTRDclusterMI.cxx +++ b/TRD/AliTRDclusterMI.cxx @@ -15,10 +15,9 @@ /* $Id$ */ - /////////////////////////////////////////////////////////////////////////////// // // -// TRD cluster // +// TRD cluster, alternative version // // // /////////////////////////////////////////////////////////////////////////////// @@ -27,29 +26,42 @@ ClassImp(AliTRDclusterMI) - //___________________________________________________________________________ - -AliTRDclusterMI::AliTRDclusterMI() : AliTRDcluster() +//___________________________________________________________________________ +AliTRDclusterMI::AliTRDclusterMI() + :AliTRDcluster() + ,fRmsY(0) + ,fNPads(0) + ,fRelPos(0) { - fNPads = 0; - fRelPos = 0; - fRmsY = 0; + // + // Default constructor + // + } -AliTRDclusterMI::AliTRDclusterMI(AliTRDcluster & cl): AliTRDcluster(cl) +//___________________________________________________________________________ +AliTRDclusterMI::AliTRDclusterMI(const AliTRDcluster &c) + :AliTRDcluster(c) + ,fRmsY(0) + ,fNPads(0) + ,fRelPos(0) { - fNPads = 0; - fRelPos = 0; - fRmsY = 0; + // + // Copy constructor + // + } + //_____________________________________________________________________________ - AliTRDclusterMI::AliTRDclusterMI(const AliTRDrecPoint &p):AliTRDcluster(p) +AliTRDclusterMI::AliTRDclusterMI(const AliTRDrecPoint &p) + :AliTRDcluster(p) + ,fRmsY(0) + ,fNPads(0) + ,fRelPos(0) { // // Constructor from AliTRDrecPoint // - fNPads = 0; - fRelPos =0; } diff --git a/TRD/AliTRDclusterMI.h b/TRD/AliTRDclusterMI.h index 2ac4ea941f7..4776f67369d 100644 --- a/TRD/AliTRDclusterMI.h +++ b/TRD/AliTRDclusterMI.h @@ -5,6 +5,11 @@ /* $Id$ */ +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD cluster, alternative version // +// // +/////////////////////////////////////////////////////////////////////////////// #include "AliTRDcluster.h" #include "TMath.h" @@ -14,18 +19,26 @@ class AliTRDrecPoint; class AliTRDclusterMI : public AliTRDcluster { public: + AliTRDclusterMI(); - AliTRDclusterMI(AliTRDcluster&cl); + AliTRDclusterMI(const AliTRDcluster &c); AliTRDclusterMI(const AliTRDrecPoint &p); - void SetRelPos(Float_t pos){fRelPos = TMath::Nint(pos*128.);} - Float_t GetRelPos(){return float(fRelPos)/128.;} - void SetNPads(Int_t npads){fNPads = npads;} - Char_t GetNPads(){return fNPads;} - Float_t fRmsY; + + void SetRmsY(Float_t rmsy) { fRmsY = rmsy; } + void SetNPads(Int_t npads) { fNPads = npads; } + void SetRelPos(Float_t pos) { fRelPos = TMath::Nint(pos*128.0); } + + Float_t GetRmsY() const { return fRmsY; } + Char_t GetNPads() const { return fNPads; } + Float_t GetRelPos() const { return float(fRelPos)/128.0; } + protected: - Char_t fNPads; - Char_t fRelPos; - ClassDef(AliTRDclusterMI,1) // ClusterMI for the TRD + + Float_t fRmsY; // RMS in y direction ???? + Char_t fNPads; // Number of pads ???? + Char_t fRelPos; // Relative position ???? + + ClassDef(AliTRDclusterMI,2) // ClusterMI for the TRD }; diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index 87af305108a..9ea7f049a6d 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -24,10 +24,12 @@ #include #include #include +#include #include "AliRun.h" #include "AliRunLoader.h" #include "AliLoader.h" +#include "AliLog.h" #include "AliTRDclusterizer.h" #include "AliTRDcluster.h" @@ -38,41 +40,42 @@ ClassImp(AliTRDclusterizer) //_____________________________________________________________________________ -AliTRDclusterizer::AliTRDclusterizer():TNamed() +AliTRDclusterizer::AliTRDclusterizer() + :TNamed() + ,fRunLoader(NULL) + ,fClusterTree(NULL) + ,fRecPoints(NULL) { // // AliTRDclusterizer default constructor // - fClusterTree = NULL; - fRecPoints = 0; - fVerbose = 0; - } //_____________________________________________________________________________ AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title) - :TNamed(name, title) + :TNamed(name,title) + ,fRunLoader(NULL) + ,fClusterTree(NULL) + ,fRecPoints(NULL) { // - // AliTRDclusterizer default constructor + // AliTRDclusterizer constructor // - fClusterTree = NULL; - fRecPoints = 0; - fVerbose = 0; - } //_____________________________________________________________________________ -AliTRDclusterizer::AliTRDclusterizer(const AliTRDclusterizer &c):TNamed(c) +AliTRDclusterizer::AliTRDclusterizer(const AliTRDclusterizer &c) + :TNamed(c) + ,fRunLoader(NULL) + ,fClusterTree(NULL) + ,fRecPoints(NULL) { // // AliTRDclusterizer copy constructor // - ((AliTRDclusterizer &) c).Copy(*this); - } //_____________________________________________________________________________ @@ -86,6 +89,7 @@ AliTRDclusterizer::~AliTRDclusterizer() fRecPoints->Delete(); delete fRecPoints; } + } //_____________________________________________________________________________ @@ -109,7 +113,6 @@ void AliTRDclusterizer::Copy(TObject &c) const ((AliTRDclusterizer &) c).fClusterTree = NULL; ((AliTRDclusterizer &) c).fRecPoints = NULL; - ((AliTRDclusterizer &) c).fVerbose = fVerbose; } @@ -119,21 +122,25 @@ Bool_t AliTRDclusterizer::Open(const Char_t *name, Int_t nEvent) // // Opens the AliROOT file. Output and input are in the same file // + TString evfoldname = AliConfig::GetDefaultEventFolderName(); - fRunLoader = AliRunLoader::GetRunLoader(evfoldname); - if (!fRunLoader) + fRunLoader = AliRunLoader::GetRunLoader(evfoldname); + + if (!fRunLoader) { fRunLoader = AliRunLoader::Open(name); - if (!fRunLoader) - { - Error("Open","Can not open session for file %s.",name); - return kFALSE; - } + } + + if (!fRunLoader) { + AliError(Form("Can not open session for file %s.",name)); + return kFALSE; + } OpenInput(nEvent); OpenOutput(); + return kTRUE; -} +} //_____________________________________________________________________________ Bool_t AliTRDclusterizer::OpenOutput() @@ -146,10 +153,10 @@ Bool_t AliTRDclusterizer::OpenOutput() AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); loader->MakeTree("R"); + fClusterTree = loader->TreeR(); fClusterTree->Branch("TRDcluster","TObjArray",&ioArray,32000,0); - return kTRUE; } @@ -162,17 +169,18 @@ Bool_t AliTRDclusterizer::OpenInput(Int_t nEvent) // // Connect the AliRoot file containing Geometry, Kine, and Hits - if (fRunLoader->GetAliRun() == 0x0) fRunLoader->LoadgAlice(); + if (fRunLoader->GetAliRun() == 0x0) { + fRunLoader->LoadgAlice(); + } gAlice = fRunLoader->GetAliRun(); if (!(gAlice)) { fRunLoader->LoadgAlice(); gAlice = fRunLoader->GetAliRun(); - if (!(gAlice)) { - printf("AliTRDclusterizer::OpenInput -- "); - printf("Could not find AliRun object.\n"); - return kFALSE; - } + if (!(gAlice)) { + AliError("Could not find AliRun object.\n"); + return kFALSE; + } } // Import the Trees for the event nEvent in the file @@ -190,20 +198,20 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) // found in detector = det. For det=-1 writes the tree. // - if ((det < -1) || (det >= AliTRDgeometry::Ndet())) { - printf("AliTRDclusterizer::WriteClusters -- "); - printf("Unexpected detector index %d.\n",det); + if ((det < -1) || + (det >= AliTRDgeometry::Ndet())) { + AliError(Form("Unexpected detector index %d.\n",det)); return kFALSE; } - TBranch *branch = fClusterTree->GetBranch("TRDcluster"); if (!branch) { TObjArray *ioArray = 0; branch = fClusterTree->Branch("TRDcluster","TObjArray",&ioArray,32000,0); } - if ((det >= 0) && (det < AliTRDgeometry::Ndet())) { + if ((det >= 0) && + (det < AliTRDgeometry::Ndet())) { Int_t nRecPoints = RecPoints()->GetEntriesFast(); TObjArray *detRecPoints = new TObjArray(400); @@ -214,8 +222,7 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) detRecPoints->AddLast(c); } else { - printf("AliTRDclusterizer::WriteClusters --"); - printf("Attempt to write a cluster with unexpected detector index\n"); + AliError("Attempt to write a cluster with unexpected detector index\n"); } } @@ -230,26 +237,17 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) if (det == -1) { - Info("WriteClusters","Writing the cluster tree %s for event %d." - ,fClusterTree->GetName(),fRunLoader->GetEventNumber()); - /* - fClusterTree->Write(); - AliTRDgeometry *geo = fTRD->GetGeometry(); - geo->SetName("TRDgeometry"); - geo->Write(); - */ - AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + AliInfo(Form("Writing the cluster tree %s for event %d." + ,fClusterTree->GetName(),fRunLoader->GetEventNumber())); + + AliLoader *loader = fRunLoader->GetLoader("TRDLoader"); loader->WriteRecPoints("OVERWRITE"); return kTRUE; } - /* - AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); - loader->WriteDigits("OVERWRITE"); - */ - printf("AliTRDclusterizer::WriteClusters -- "); - printf("Unexpected detector index %d.\n",det); + + AliError(Form("Unexpected detector index %d.\n",det)); return kFALSE; @@ -257,8 +255,10 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det) //_____________________________________________________________________________ -AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin, Int_t det, Double_t amp - , Int_t *tracks, Double_t *sig, Int_t iType, Float_t center) +AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin + , Int_t det, Double_t amp + , Int_t *tracks, Double_t *sig + , Int_t iType, Float_t center) { // // Add a cluster for the TRD @@ -276,6 +276,7 @@ AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin, Int_t c->SetSigmaZ2(sig[1]); c->SetLocalTimeBin(timebin); c->SetCenter(center); + switch (iType) { case 0: c->Set2pad(); @@ -296,25 +297,58 @@ AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin, Int_t RecPoints()->Add(c); return c; + } //_____________________________________________________________________________ -Double_t AliTRDclusterizer::CalcXposFromTimebin(Float_t timebin, Int_t idet, Int_t col, Int_t row) +Double_t AliTRDclusterizer::CalcXposFromTimebin(Float_t timebin, Int_t idet + , Int_t col, Int_t row) { // - // Calculates the local x position in the detector from the timebin, depends on the drift velocity - // and t0 + // Calculates the local x position in the detector from the timebin, + // depends on the drift velocity and t0 // - AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); - if (!calibration) + AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); + if (!calibration) { + AliError("Cannot calibration object"); return -1; + } - Float_t vdrift = calibration->GetVdrift(idet, col, row); - Float_t t0 = calibration->GetT0(idet, col, row); + Float_t vdrift = calibration->GetVdrift(idet,col,row); + Float_t t0 = calibration->GetT0(idet,col,row); Float_t samplingFrequency = calibration->GetSamplingFrequency(); timebin -= t0; return timebin / samplingFrequency * vdrift; + +} + +//_____________________________________________________________________________ +void AliTRDclusterizer::ResetRecPoints() +{ + // + // Resets the list of rec points + // + + if (fRecPoints) { + fRecPoints->Delete(); + } + +} + +//_____________________________________________________________________________ +TObjArray* AliTRDclusterizer::RecPoints() +{ + // + // Returns the list of rec points + // + + if (!fRecPoints) { + fRecPoints = new TObjArray(400); + } + + return fRecPoints; + } diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index 2bb295caf7e..4fd83714e96 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -5,17 +5,22 @@ /* $Id$ */ +//////////////////////////////////////////////////////////////////////////// +// // +// TRD cluster finder base class // +// // +//////////////////////////////////////////////////////////////////////////// + #include -#include class TFile; class TTree; +class TObjArray; + class AliRunLoader; + class AliTRD; class AliTRDcluster; -/////////////////////////////////////////////////////// -// Finds and handles cluster // -/////////////////////////////////////////////////////// class AliTRDclusterizer : public TNamed { @@ -24,35 +29,31 @@ class AliTRDclusterizer : public TNamed { AliTRDclusterizer(); AliTRDclusterizer(const Text_t* name, const Text_t* title); AliTRDclusterizer(const AliTRDclusterizer &c); - virtual ~AliTRDclusterizer(); + virtual ~AliTRDclusterizer(); AliTRDclusterizer &operator=(const AliTRDclusterizer &c); - virtual void Copy(TObject &c) const; - virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0); - - virtual Bool_t OpenInput(Int_t nEvent = 0); - virtual Bool_t OpenOutput(); - virtual Bool_t MakeClusters() = 0; - virtual Bool_t WriteClusters(Int_t det); - void SetVerbose(Int_t v = 1) { fVerbose = v; }; + virtual void Copy(TObject &c) const; + virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0); + virtual Bool_t OpenInput(Int_t nEvent = 0); + virtual Bool_t OpenOutput(); + virtual Bool_t MakeClusters() = 0; + virtual Bool_t WriteClusters(Int_t det); + void ResetRecPoints(); - TObjArray* RecPoints() {if (!fRecPoints) fRecPoints = new TObjArray(400); return fRecPoints;} - virtual AliTRDcluster * AddCluster(Double_t *pos, Int_t timebin, Int_t det, Double_t amp, Int_t *tracks - , Double_t *sig, Int_t iType, Float_t center = 0); - void ResetRecPoints() {if (fRecPoints) fRecPoints->Delete();} + TObjArray *RecPoints(); + virtual AliTRDcluster *AddCluster(Double_t *pos, Int_t timebin, Int_t det + , Double_t amp, Int_t *tracks + , Double_t *sig, Int_t iType, Float_t center = 0); protected: - Double_t CalcXposFromTimebin(Float_t timebin, Int_t idet, Int_t col, Int_t row); + Double_t CalcXposFromTimebin(Float_t timebin, Int_t idet, Int_t col, Int_t row); - AliRunLoader *fRunLoader; //! Run Loader - - TTree *fClusterTree; //! Tree with the cluster - - TObjArray* fRecPoints; //! Array of clusters - Int_t fVerbose; // Sets the verbose level + AliRunLoader *fRunLoader; //! Run Loader + TTree *fClusterTree; //! Tree with the cluster + TObjArray *fRecPoints; //! Array of clusters - ClassDef(AliTRDclusterizer,3) // TRD-Cluster manager base class + ClassDef(AliTRDclusterizer,4) // TRD-Cluster manager base class }; diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index c2233e8dd00..ee32b8c305f 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -18,7 +18,7 @@ /////////////////////////////////////////////////////////////////////////////// // // -// TRD cluster finder for the slow simulator. +// TRD cluster finder // // // /////////////////////////////////////////////////////////////////////////////// @@ -31,6 +31,7 @@ #include "AliRunLoader.h" #include "AliLoader.h" #include "AliRawReader.h" +#include "AliLog.h" #include "AliTRDclusterizerV1.h" #include "AliTRDgeometry.h" @@ -48,39 +49,38 @@ ClassImp(AliTRDclusterizerV1) //_____________________________________________________________________________ -AliTRDclusterizerV1::AliTRDclusterizerV1():AliTRDclusterizer() +AliTRDclusterizerV1::AliTRDclusterizerV1() + :AliTRDclusterizer() + ,fDigitsManager(NULL) { // // AliTRDclusterizerV1 default constructor // - fDigitsManager = 0; - } //_____________________________________________________________________________ AliTRDclusterizerV1::AliTRDclusterizerV1(const Text_t* name, const Text_t* title) - :AliTRDclusterizer(name,title) + :AliTRDclusterizer(name,title) + ,fDigitsManager(new AliTRDdigitsManager()) { // - // AliTRDclusterizerV1 default constructor + // AliTRDclusterizerV1 constructor // - fDigitsManager = new AliTRDdigitsManager(); fDigitsManager->CreateArrays(); } //_____________________________________________________________________________ AliTRDclusterizerV1::AliTRDclusterizerV1(const AliTRDclusterizerV1 &c) -:AliTRDclusterizer(c) + :AliTRDclusterizer(c) + ,fDigitsManager(NULL) { // // AliTRDclusterizerV1 copy constructor // - ((AliTRDclusterizerV1 &) c).Copy(*this); - } //_____________________________________________________________________________ @@ -130,12 +130,14 @@ Bool_t AliTRDclusterizerV1::ReadDigits() // if (!fRunLoader) { - printf(" "); - printf("No input file open\n"); + AliError("No run loader available"); return kFALSE; } + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); - if (!loader->TreeD()) loader->LoadDigits(); + if (!loader->TreeD()) { + loader->LoadDigits(); + } // Read in the digit arrays return (fDigitsManager->ReadDigits(loader->TreeD())); @@ -150,7 +152,6 @@ Bool_t AliTRDclusterizerV1::ReadDigits(AliRawReader* rawReader) // AliTRDrawData raw; - fDigitsManager = raw.Raw2Digits(rawReader); return kTRUE; @@ -164,71 +165,54 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Generates the cluster. // - Int_t row, col, time; - - /* - if (fTRD->IsVersion() != 1) { - printf(" "); - printf("TRD must be version 1 (slow simulator).\n"); - return kFALSE; - } - */ + Int_t row = 0; + Int_t col = 0; + Int_t time = 0; + Int_t icham = 0; + Int_t iplan = 0; + Int_t isect = 0; + Int_t iPad = 0; + + AliTRDdataArrayI *digitsIn; + AliTRDdataArrayI *track0; + AliTRDdataArrayI *track1; + AliTRDdataArrayI *track2; // Get the geometry - AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(fRunLoader); - AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); - if (!calibration) - { - printf(" "); - printf("ERROR getting instance of AliTRDcalibDB"); + AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(fRunLoader); + AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); + if (!calibration) { + AliError("No AliTRDcalibDB instance available\n"); return kFALSE; } - AliTRDSimParam* simParam = AliTRDSimParam::Instance(); - if (!simParam) - { - printf(" "); - printf("ERROR getting instance of AliTRDSimParam"); + AliTRDSimParam *simParam = AliTRDSimParam::Instance(); + if (!simParam) { + AliError("No AliTRDSimParam instance available\n"); return kFALSE; } - AliTRDRecParam* recParam = AliTRDRecParam::Instance(); - if (!recParam) - { - printf(" "); - printf("ERROR getting instance of AliTRDRecParam"); + AliTRDRecParam *recParam = AliTRDRecParam::Instance(); + if (!recParam) { + AliError("No AliTRDRecParam instance available\n"); return kFALSE; } - AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) - { - printf(" "); - printf("Could not get common params\n"); + AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); + if (!commonParam) { + AliError("Could not get common parameters\n"); return kFALSE; } - - Float_t ADCthreshold = simParam->GetADCthreshold(); - - if (fVerbose > 0) { - //printf(" "); - //printf("OmegaTau = %f \n",omegaTau); - printf(" "); - printf("Start creating clusters.\n"); - } - - AliTRDdataArrayI *digitsIn; - AliTRDdataArrayI *track0; - AliTRDdataArrayI *track1; - AliTRDdataArrayI *track2; + // ADC threshols + Float_t ADCthreshold = simParam->GetADCthreshold(); // Threshold value for the maximum - Float_t maxThresh = recParam->GetClusMaxThresh(); + Float_t maxThresh = recParam->GetClusMaxThresh(); // Threshold value for the digit signal - Float_t sigThresh = recParam->GetClusSigThresh(); + Float_t sigThresh = recParam->GetClusSigThresh(); + // Iteration limit for unfolding procedure const Float_t kEpsilon = 0.01; - const Int_t kNclus = 3; const Int_t kNsig = 5; const Int_t kNtrack = 3 * kNclus; @@ -238,36 +222,33 @@ Bool_t AliTRDclusterizerV1::MakeClusters() Double_t ratioLeft = 1.0; Double_t ratioRight = 1.0; - // Double_t padSignal[kNsig]; Double_t clusterSignal[kNclus]; Double_t clusterPads[kNclus]; Int_t clusterTracks[kNtrack]; - Int_t chamBeg = 0; - Int_t chamEnd = AliTRDgeometry::Ncham(); - Int_t planBeg = 0; - Int_t planEnd = AliTRDgeometry::Nplan(); - Int_t sectBeg = 0; - Int_t sectEnd = AliTRDgeometry::Nsect(); + Int_t chamBeg = 0; + Int_t chamEnd = AliTRDgeometry::Ncham(); + Int_t planBeg = 0; + Int_t planEnd = AliTRDgeometry::Nplan(); + Int_t sectBeg = 0; + Int_t sectEnd = AliTRDgeometry::Nsect(); + Int_t nTimeTotal = calibration->GetNumberOfTimeBins(); - Int_t nTimeTotal = calibration->GetNumberOfTimeBins(); - - if (fVerbose > 0) { - printf(" "); - printf("Number of Time Bins = %d.\n",nTimeTotal); - } + AliDebug(1,Form("Number of Time Bins = %d.\n",nTimeTotal)); // Start clustering in every chamber - for (Int_t icham = chamBeg; icham < chamEnd; icham++) { - for (Int_t iplan = planBeg; iplan < planEnd; iplan++) { - for (Int_t isect = sectBeg; isect < sectEnd; isect++) { + for (icham = chamBeg; icham < chamEnd; icham++) { + for (iplan = planBeg; iplan < planEnd; iplan++) { + for (isect = sectBeg; isect < sectEnd; isect++) { Int_t idet = geo->GetDetector(iplan,icham,isect); Int_t nRowMax = commonParam->GetRowMax(iplan,icham,isect); Int_t nColMax = commonParam->GetColMax(iplan); + AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham); + Int_t nClusters = 0; Int_t nClusters2pad = 0; Int_t nClusters3pad = 0; @@ -275,59 +256,46 @@ Bool_t AliTRDclusterizerV1::MakeClusters() Int_t nClusters5pad = 0; Int_t nClustersLarge = 0; - if (fVerbose > 0) { - printf(" "); - printf("Analyzing chamber %d, plane %d, sector %d.\n" - ,icham,iplan,isect); - } - - AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham); + AliDebug(1,Form("Analyzing chamber %d, plane %d, sector %d.\n" + ,icham,iplan,isect)); // Get the digits digitsIn = fDigitsManager->GetDigits(idet); digitsIn->Expand(); - AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow(), digitsIn->GetNcol(), digitsIn->GetNtime()); - - Transform(digitsIn, digitsOut, idet, nRowMax, nColMax, nTimeTotal, ADCthreshold); - - track0 = fDigitsManager->GetDictionary(idet,0); + track0 = fDigitsManager->GetDictionary(idet,0); track0->Expand(); - track1 = fDigitsManager->GetDictionary(idet,1); + track1 = fDigitsManager->GetDictionary(idet,1); track1->Expand(); - track2 = fDigitsManager->GetDictionary(idet,2); + track2 = fDigitsManager->GetDictionary(idet,2); track2->Expand(); + AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow() + ,digitsIn->GetNcol() + ,digitsIn->GetNtime()); + Transform(digitsIn, digitsOut,idet,nRowMax,nColMax,nTimeTotal,ADCthreshold); + // Loop through the chamber and find the maxima for ( row = 0; row < nRowMax; row++) { for ( col = 2; col < nColMax; col++) { - //for ( col = 4; col < nColMax-2; col++) { for (time = 0; time < nTimeTotal; time++) { Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col ,time)); Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)); -// // Lonok for the maximum -// if (signalM >= maxThresh) { -// if (((signalL >= sigThresh) && -// (signalL < signalM)) || -// ((signalR >= sigThresh) && -// (signalR < signalM))) { -// // Maximum found, mark the position by a negative signal -// digitsOut->SetDataUnchecked(row,col-1,time,-signalM); -// } -// } // Look for the maximum if (signalM >= maxThresh) { - if ( (TMath::Abs(signalL)<=signalM) && (TMath::Abs(signalR)<=signalM) && - (TMath::Abs(signalL)+TMath::Abs(signalR))>sigThresh ) { + if ((TMath::Abs(signalL) <= signalM) && + (TMath::Abs(signalR) <= signalM) && + ((TMath::Abs(signalL) + TMath::Abs(signalR)) > sigThresh)) { // Maximum found, mark the position by a negative signal digitsOut->SetDataUnchecked(row,col-1,time,-signalM); } } - } - } - } + + } + } + } // Now check the maxima and calculate the cluster position for ( row = 0; row < nRowMax ; row++) { @@ -337,12 +305,11 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Maximum found ? if (digitsOut->GetDataUnchecked(row,col,time) < 0) { - Int_t iPad; for (iPad = 0; iPad < kNclus; iPad++) { Int_t iPadCol = col - 1 + iPad; clusterSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row - ,iPadCol - ,time)); + ,iPadCol + ,time)); clusterTracks[3*iPad ] = track0->GetDataUnchecked(row,iPadCol,time) - 1; clusterTracks[3*iPad+1] = track1->GetDataUnchecked(row,iPadCol,time) - 1; clusterTracks[3*iPad+2] = track2->GetDataUnchecked(row,iPadCol,time) - 1; @@ -351,15 +318,13 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Count the number of pads in the cluster Int_t nPadCount = 0; Int_t ii = 0; - while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii ,time)) - >= sigThresh) { + while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii ,time)) >= sigThresh) { nPadCount++; ii++; if (col-ii < 0) break; } ii = 0; - while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) - >= sigThresh) { + while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh) { nPadCount++; ii++; if (col+ii+1 >= nColMax) break; @@ -389,18 +354,18 @@ Bool_t AliTRDclusterizerV1::MakeClusters() break; }; - // Look for 5 pad cluster with minimum in the middle + // Look for 5 pad cluster with minimum in the middle Bool_t fivePadCluster = kFALSE; - if (col < nColMax-3) { + if (col < (nColMax - 3)) { if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) { fivePadCluster = kTRUE; } - if ((fivePadCluster) && (col < nColMax-5)) { + if ((fivePadCluster) && (col < (nColMax - 5))) { if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh) { fivePadCluster = kFALSE; } } - if ((fivePadCluster) && (col > 1)) { + if ((fivePadCluster) && (col > 1)) { if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh) { fivePadCluster = kFALSE; } @@ -441,29 +406,31 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Take the shift of the additional time bins into account clusterPads[2] = time + 0.5; - if (recParam->LUTOn()) { // Calculate the position of the cluster by using the // lookup table method clusterPads[1] = recParam->LUTposition(iplan,clusterSignal[0] - ,clusterSignal[1] - ,clusterSignal[2]); + ,clusterSignal[1] + ,clusterSignal[2]); } else { // Calculate the position of the cluster by using the // center of gravity method - for (Int_t i=0;i<5;i++) padSignal[i]=0; - padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time)); // central pad + for (Int_t i = 0; i < 5; i++) { + padSignal[i] = 0; + } + padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col ,time)); // central pad padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // left pad padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // right pad - if (col>2 &&TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time) 2) && + (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) { padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)); } - if (colGetDataUnchecked(row,col+2,time)GetDataUnchecked(row,col+2,time)) < padSignal[3])) { padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)); } - clusterPads[1] = GetCOG(padSignal); - + clusterPads[1] = GetCOG(padSignal); } Double_t q0 = clusterSignal[0]; @@ -472,19 +439,20 @@ Bool_t AliTRDclusterizerV1::MakeClusters() Double_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) / (clusterCharge*clusterCharge); - - + // // Calculate the position and the error - - // correct for t0 - Int_t clusterTimeBin = TMath::Nint(time - calibration->GetT0(idet, col, row)); + // + + // Correct for t0 + Int_t clusterTimeBin = TMath::Nint(time - calibration->GetT0(idet, col, row)); + + Double_t colSize = padPlane->GetColSize(col); + Double_t rowSize = padPlane->GetRowSize(row); - Double_t colSize = padPlane->GetColSize(col); - Double_t rowSize = padPlane->GetRowSize(row); Double_t clusterPos[3]; - clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1]+0.5)*colSize; // MI change - clusterPos[1] = padPlane->GetRowPos(row) - 0.5*rowSize; //MI change - clusterPos[2] = CalcXposFromTimebin(clusterPads[2], idet, col, row); + clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1]+0.5)*colSize; + clusterPos[1] = padPlane->GetRowPos(row) - 0.5*rowSize; + clusterPos[2] = CalcXposFromTimebin(clusterPads[2],idet,col,row); Double_t clusterSig[2]; clusterSig[0] = (clusterSigmaY2 + 1./12.) * colSize*colSize; clusterSig[1] = rowSize * rowSize / 12.; @@ -492,21 +460,25 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Add the cluster to the output array AliTRDcluster * cluster = AddCluster(clusterPos - ,clusterTimeBin - ,idet - ,clusterCharge - ,clusterTracks - ,clusterSig - ,iType,clusterPads[1]); - // - // - Short_t signals[7]={0,0,0,0,0,0,0}; - for (Int_t jPad = col-3;jPad<=col+3;jPad++){ - if (jPad<0 ||jPad>=nColMax-1) continue; + ,clusterTimeBin + ,idet + ,clusterCharge + ,clusterTracks + ,clusterSig + ,iType + ,clusterPads[1]); + + Short_t signals[7]={ 0, 0, 0, 0, 0, 0, 0 }; + for (Int_t jPad = col-3; jPad <= col+3; jPad++) { + if ((jPad < 0) || (jPad >= nColMax-1)) { + continue; + } signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time))); } cluster->SetSignals(signals); + } + } } } @@ -521,17 +493,11 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Write the cluster and reset the array WriteClusters(idet); ResetRecPoints(); + } } } - if (fVerbose > 0) { - printf(" "); - printf("Done.\n"); - } - - //delete digitsIn; - return kTRUE; } @@ -540,11 +506,15 @@ Bool_t AliTRDclusterizerV1::MakeClusters() Double_t AliTRDclusterizerV1::GetCOG(Double_t signal[5]) { // - // get COG position - // used for clusters with more than 3 pads - where LUT not applicable + // Get COG position + // Used for clusters with more than 3 pads - where LUT not applicable + // + Double_t sum = signal[0]+signal[1]+signal[2]+signal[3]+signal[4]; Double_t res = (0.0*(-signal[0]+signal[4])+(-signal[1]+signal[3]))/sum; + return res; + } //_____________________________________________________________________________ @@ -558,10 +528,8 @@ Double_t AliTRDclusterizerV1::Unfold(Double_t eps, Int_t plane, Double_t* padSig // AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); - if (!calibration) - { - printf(" "); - printf("ERROR getting instance of AliTRDcalibDB"); + if (!calibration) { + AliError("No AliTRDcalibDB instance available\n"); return kFALSE; } @@ -614,68 +582,66 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn, Int_t nColMax, Int_t nTimeTotal, Float_t ADCthreshold) { - // // Apply gain factor // Apply tail cancellation: Transform digitsIn to digitsOut // + Int_t iRow = 0; + Int_t iCol = 0; + Int_t iTime = 0; AliTRDRecParam* recParam = AliTRDRecParam::Instance(); - if (!recParam) - { - printf(" "); - printf("ERROR getting instance of AliTRDRecParam"); + if (!recParam) { + AliError("No AliTRDRecParam instance available\n"); return; } AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); + if (!calibration) { + AliError("No AliTRDcalibDB instance available\n"); + return; + } Double_t *inADC = new Double_t[nTimeTotal]; // adc data before tail cancellation Double_t *outADC = new Double_t[nTimeTotal]; // adc data after tail cancellation - if (fVerbose > 0) { - printf(" "); - printf("Tail cancellation (nExp = %d) for detector %d.\n", - recParam->GetTCnexp(),idet); - } + AliDebug(1,Form("Tail cancellation (nExp = %d) for detector %d.\n" + ,recParam->GetTCnexp(),idet)); + + for (iRow = 0; iRow < nRowMax; iRow++ ) { + for (iCol = 0; iCol < nColMax; iCol++ ) { + for (iTime = 0; iTime < nTimeTotal; iTime++) { - for (Int_t iRow = 0; iRow < nRowMax; iRow++ ) { - for (Int_t iCol = 0; iCol < nColMax; iCol++ ) { - for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) { // - // add gain + // Add gain // - Double_t gain = calibration->GetGainFactor(idet, iCol, iRow); - if (gain==0) { + Double_t gain = calibration->GetGainFactor(idet,iCol,iRow); + if (gain == 0) { AliError("Not a valid gain\n"); } - inADC[iTime] = digitsIn->GetDataUnchecked(iRow, iCol, iTime); - + inADC[iTime] = digitsIn->GetDataUnchecked(iRow,iCol,iTime); inADC[iTime] /= gain; outADC[iTime] = inADC[iTime]; + } // Apply the tail cancelation via the digital filter - if (recParam->TCOn()) - { + if (recParam->TCOn()) { DeConvExp(inADC,outADC,nTimeTotal,recParam->GetTCnexp()); } - for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) { + for (iTime = 0; iTime < nTimeTotal; iTime++) { + // Store the amplitude of the digit if above threshold if (outADC[iTime] > ADCthreshold) { - if (fVerbose > 1) - { - printf(" iRow = %d, iCol = %d, iTime = %d, adc = %f\n" - ,iRow,iCol,iTime,outADC[iTime]); - } + AliDebug(2,Form(" iRow = %d, iCol = %d, iTime = %d, adc = %f\n" + ,iRow,iCol,iTime,outADC[iTime])); digitsOut->SetDataUnchecked(iRow,iCol,iTime,outADC[iTime]); } } } - } delete [] inADC; @@ -685,20 +651,18 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI* digitsIn, } - //_____________________________________________________________________________ void AliTRDclusterizerV1::DeConvExp(Double_t *source, Double_t *target, Int_t n, Int_t nexp) { // - // Tail Cancellation by Deconvolution for PASA v4 TRF + // Tail cancellation by deconvolution for PASA v4 TRF // Double_t rates[2]; Double_t coefficients[2]; - // initialize (coefficient = alpha, rates = lambda) - + // Initialization (coefficient = alpha, rates = lambda) Double_t R1 = 1.0; Double_t R2 = 1.0; Double_t C1 = 0.5; @@ -725,23 +689,29 @@ void AliTRDclusterizerV1::DeConvExp(Double_t *source, Double_t *target, rates[0] = TMath::Exp(-Dt/(R1)); rates[1] = TMath::Exp(-Dt/(R2)); - Int_t i, k; - Double_t reminder[2]; - Double_t correction, result; - - /* attention: computation order is important */ - correction=0.0; + Int_t i = 0; + Int_t k = 0; - for ( k=0; k #include +#include "AliLog.h" + #include "AliTRDgeometry.h" #include "AliTRDcalibDB.h" -#include "Cal/AliTRDCalPIDLQ.h" - #include "AliTRDltuTracklet.h" - #include "AliTRDgtuTrack.h" +#include "Cal/AliTRDCalPIDLQ.h" ClassImp(AliTRDgtuTrack) //_____________________________________________________________________________ AliTRDgtuTrack::AliTRDgtuTrack() + :TObject() + ,fTracklets(new TObjArray(400)) + ,fYproj(0) + ,fZproj(0) + ,fSlope(0) + ,fDetector(-1) + ,fNtracklets(0) + ,fNplanes(0) + ,fNclusters(0) + ,fPt(0) + ,fPhi(0) + ,fEta(0) + ,fLabel(-1) + ,fPID(0) + ,fIsElectron(kFALSE) { // // Default constructor // - fYproj = 0.0; - fZproj = 0.0; - fSlope = 0.0; - fDetector = -1; - fNtracklets = 0; - fNplanes = 0; - fNclusters = 0; - fPt = 0.0; - fPhi = 0.0; - fEta = 0.0; - fLabel = -1; - fPID = 0.0; - fIsElectron = kFALSE; - - fTracklets = new TObjArray(400); - } //_____________________________________________________________________________ -AliTRDgtuTrack::AliTRDgtuTrack(const AliTRDgtuTrack& track): - TObject(track), - fTracklets(NULL), - fYproj(track.fYproj), - fZproj(track.fZproj), - fSlope(track.fSlope), - fDetector(track.fDetector), - fNtracklets(track.fNtracklets), - fNplanes(track.fNplanes), - fNclusters(track.fNclusters), - fPt(track.fPt), - fPhi(track.fPhi), - fEta(track.fEta), - fLabel(track.fLabel), - fPID(track.fPID), - fIsElectron(track.fIsElectron) +AliTRDgtuTrack::AliTRDgtuTrack(const AliTRDgtuTrack& t) + :TObject(t) + ,fTracklets(NULL) + ,fYproj(t.fYproj) + ,fZproj(t.fZproj) + ,fSlope(t.fSlope) + ,fDetector(t.fDetector) + ,fNtracklets(t.fNtracklets) + ,fNplanes(t.fNplanes) + ,fNclusters(t.fNclusters) + ,fPt(t.fPt) + ,fPhi(t.fPhi) + ,fEta(t.fEta) + ,fLabel(t.fLabel) + ,fPID(t.fPID) + ,fIsElectron(t.fIsElectron) { // - // copy contructor + // Copy contructor // } @@ -87,19 +86,19 @@ AliTRDgtuTrack::AliTRDgtuTrack(const AliTRDgtuTrack& track): AliTRDgtuTrack &AliTRDgtuTrack::operator=(const AliTRDgtuTrack &t) { // - // assignment operator + // Assignment operator // if (this != &t) ((AliTRDgtuTrack &) t).Copy(*this); return *this; -} +} //_____________________________________________________________________________ void AliTRDgtuTrack::Copy(TObject &t) const { // - // copy function + // Copy function // ((AliTRDgtuTrack &) t).fTracklets = NULL; @@ -123,9 +122,14 @@ void AliTRDgtuTrack::Copy(TObject &t) const AliTRDgtuTrack::~AliTRDgtuTrack() { // - // destructor + // Destructor // + if (fTracklets) { + fTracklets->Delete(); + delete fTracklets; + } + } //_____________________________________________________________________________ @@ -146,11 +150,15 @@ AliTRDltuTracklet* AliTRDgtuTrack::GetTracklet(Int_t pos) const // Return LTU tracklet at position "pos" // - if (fTracklets == 0) return 0; - void * trk = fTracklets->UncheckedAt(pos); - if (trk == 0) return 0; + if (fTracklets == 0) { + return 0; + } + void *trk = fTracklets->UncheckedAt(pos); + if (trk == 0) { + return 0; + } - return (AliTRDltuTracklet*)trk; + return (AliTRDltuTracklet *) trk; } @@ -177,18 +185,18 @@ void AliTRDgtuTrack::Reset() // Reset the track information // - fYproj = 0.0; - fZproj = 0.0; - fSlope = 0.0; - fDetector = -1; + fYproj = 0.0; + fZproj = 0.0; + fSlope = 0.0; + fDetector = -1; fNtracklets = 0; - fNplanes = 0; - fNclusters = 0; - fPt = 0.0; - fPhi = 0.0; - fEta = 0.0; - fLabel = -1; - fPID = 0.0; + fNplanes = 0; + fNclusters = 0; + fPt = 0.0; + fPhi = 0.0; + fEta = 0.0; + fLabel = -1; + fPID = 0.0; fIsElectron = kFALSE; } @@ -200,21 +208,27 @@ void AliTRDgtuTrack::Track(Float_t xpl, Float_t field) // Calculate the kinematics of the found track // + Int_t i = 0; + Int_t iDet = 0; + Int_t nDet = 0; + Bool_t newDetector; + AliTRDltuTracklet *trk; Int_t nTracklets = GetNtracklets(); Float_t fC[kNmaxTrk][3]; // X, Y, Z coordinates of segments - fYproj = 0.0; - fZproj = 0.0; - fSlope = 0.0; - fNclusters = 0; - fNplanes = 0; + fYproj = 0.0; + fZproj = 0.0; + fSlope = 0.0; + fNclusters = 0; + fNplanes = 0; fNtracklets = GetNtracklets(); Int_t inDetector[kNplan]; - for (Int_t i = 0; i < kNplan; i++) inDetector[i] = -1; - Int_t iDet, nDet = 0; - Bool_t newDetector; - for (Int_t i = 0; i < nTracklets; i++) { + for (i = 0; i < kNplan; i++) { + inDetector[i] = -1; + } + + for (i = 0; i < nTracklets; i++) { trk = GetTracklet(i); fYproj += trk->GetYproj(xpl); @@ -276,7 +290,7 @@ void AliTRDgtuTrack::Track(Float_t xpl, Float_t field) smatrix.Zero(); sums.Zero(); - for (Int_t i = 0; i < nTracklets; i++) { + for (i = 0; i < nTracklets; i++) { xv = (Double_t)x[i+1]; yv = (Double_t)y[i+1]; smatrix(0,0) += 1.0; @@ -290,15 +304,14 @@ void AliTRDgtuTrack::Track(Float_t xpl, Float_t field) a = res(0,0); b = res(1,0); - Float_t dist = AliTRDgeometry::GetTime0(1) - AliTRDgeometry::GetTime0(0); - - Float_t fx1 = x[1] + dist * (Float_t)(nTracklets-1)/6.0; - Float_t fy1 = a + b * fx1; - Float_t fx2 = x[nTracklets] - dist * (Float_t)(nTracklets-1)/6.0; - Float_t fy2 = a + b * fx2; - Float_t d12 = TMath::Sqrt((fx2-fx1)*(fx2-fx1)+(fy2-fy1)*(fy2-fy1)); + Float_t dist = AliTRDgeometry::GetTime0(1) - AliTRDgeometry::GetTime0(0); + Float_t fx1 = x[1] + dist * (Float_t)(nTracklets-1)/6.0; + Float_t fy1 = a + b * fx1; + Float_t fx2 = x[nTracklets] - dist * (Float_t)(nTracklets-1)/6.0; + Float_t fy2 = a + b * fx2; + Float_t d12 = TMath::Sqrt((fx2-fx1)*(fx2-fx1)+(fy2-fy1)*(fy2-fy1)); Float_t alpha = TMath::ATan(fy2/fx2) - TMath::ATan(fy1/fx1); - Float_t r = (d12/2.0)/TMath::Sin(alpha); + Float_t r = (d12/2.0)/TMath::Sin(alpha); fPt = 0.3 * field * 0.01 * r; @@ -311,7 +324,8 @@ void AliTRDgtuTrack::Track(Float_t xpl, Float_t field) if (yc != 0.0) { fPhi = TMath::ATan(xc/yc); - } else { + } + else { fPhi = TMath::PiOver2(); } @@ -319,7 +333,7 @@ void AliTRDgtuTrack::Track(Float_t xpl, Float_t field) smatrix.Zero(); sums.Zero(); - for (Int_t i = 0; i < nTracklets+1; i++) { + for (i = 0; i < nTracklets+1; i++) { xv = (Double_t)z[i]; yv = (Double_t)x[i]; smatrix(0,0) += 1.0; @@ -334,11 +348,13 @@ void AliTRDgtuTrack::Track(Float_t xpl, Float_t field) b = res(1,0); Float_t theta = TMath::ATan(b); - if (theta < 0.0) theta = TMath::Pi() + theta; - + if (theta < 0.0) { + theta = TMath::Pi() + theta; + } if (theta == 0.0) { fEta = 0.0; - } else { + } + else { fEta = -TMath::Log(TMath::Tan(theta/2.0)); } @@ -351,10 +367,12 @@ void AliTRDgtuTrack::MakePID() // Electron likelihood signal // + Int_t i = 0; + AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); if (!calibration) { - Error("MakePID","No instance of AliTRDcalibDB."); + AliError("No instance of AliTRDcalibDB."); return; } const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject(); @@ -363,7 +381,7 @@ void AliTRDgtuTrack::MakePID() Int_t nTracklets = GetNtracklets(); Int_t det, pla; Float_t sl, th, q, probPio = 1.0, probEle = 1.0; - for (Int_t i = 0; i < nTracklets; i++) { + for (i = 0; i < nTracklets; i++) { trk = GetTracklet(i); @@ -417,7 +435,8 @@ void AliTRDgtuTrack::MakePID() if ((probEle+probPio) > 0.0) { fPID = probEle/(probEle+probPio); - } else { + } + else { fPID = 0.0; } @@ -507,3 +526,45 @@ void AliTRDgtuTrack::CookLabel() } +//_____________________________________________________________________________ +void AliTRDgtuTrack::ResetTracklets() +{ + // + // Resets the list of tracklets + // + + if (fTracklets) { + fTracklets->Delete(); + } + +} + +//_____________________________________________________________________________ +TObjArray* AliTRDgtuTrack::Tracklets() +{ + // + // Returns the list of tracklets + // + + if (!fTracklets) { + fTracklets = new TObjArray(400); + } + + return fTracklets; + +} + +//_____________________________________________________________________________ +Int_t AliTRDgtuTrack::GetNtracklets() const +{ + // + // Returns the number of tracklets + // + + if (fTracklets) { + return fTracklets->GetEntriesFast(); + } + + return 0; + +} diff --git a/TRD/AliTRDgtuTrack.h b/TRD/AliTRDgtuTrack.h index d1992564515..551e7e466e3 100644 --- a/TRD/AliTRDgtuTrack.h +++ b/TRD/AliTRDgtuTrack.h @@ -1,5 +1,9 @@ #ifndef ALITRDGTUTRACK_H #define ALITRDGTUTRACK_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -7,7 +11,7 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include +#include class AliTRDltuTracklet; @@ -18,67 +22,62 @@ class AliTRDgtuTrack : public TObject { enum { kNmaxTrk = 12, kNplan = 6 }; AliTRDgtuTrack(); - AliTRDgtuTrack(const AliTRDgtuTrack& track); - virtual ~AliTRDgtuTrack(); - AliTRDgtuTrack &operator=(const AliTRDgtuTrack &t); - virtual void Copy(TObject &t) const; - - Bool_t IsSortable() const { return kTRUE; } - virtual Int_t Compare(const TObject *o) const; - - void Reset(); - void ResetTracklets() { if(fTracklets) fTracklets->Delete(); }; - void AddTracklet(AliTRDltuTracklet *trk); - AliTRDltuTracklet *GetTracklet(Int_t pos) const; - TObjArray *Tracklets() { - if(!fTracklets) fTracklets = new TObjArray(400); return fTracklets; - }; - Int_t GetNtracklets() const { - if (fTracklets) return fTracklets->GetEntriesFast(); - return 0; - }; - - Float_t GetYproj() const { return fYproj; }; - Float_t GetZproj() const { return fZproj; }; - Float_t GetSlope() const { return fSlope; }; - Int_t GetTracklets() const { return fNtracklets; }; - Int_t GetPlanes() const { return fNplanes; }; - Int_t GetClusters() const { return fNclusters; }; - Float_t GetPt() const { return fPt; }; - Float_t GetPhi() const { return fPhi; }; - Float_t GetEta() const { return fEta; }; - Int_t GetLabel() const { return fLabel; }; - Int_t GetDetector() const { return fDetector; }; - Float_t GetPID() const { return fPID; }; - Bool_t IsElectron() const { return fIsElectron; }; - - void Track(Float_t xpl, Float_t field); - void CookLabel(); - void SetDetector(Int_t det) { fDetector = det; }; - void MakePID(); + AliTRDgtuTrack(const AliTRDgtuTrack &t); + virtual ~AliTRDgtuTrack(); + AliTRDgtuTrack &operator=(const AliTRDgtuTrack &t); + + virtual void Copy(TObject &t) const; + + Bool_t IsSortable() const { return kTRUE; } + virtual Int_t Compare(const TObject *o) const; + void Reset(); + void ResetTracklets(); + void Track(Float_t xpl, Float_t field); + void CookLabel(); + void SetDetector(Int_t det) { fDetector = det; }; + void MakePID(); + void AddTracklet(AliTRDltuTracklet *trk); + Int_t GetNtracklets() const; + + AliTRDltuTracklet *GetTracklet(Int_t pos) const; + TObjArray *Tracklets(); + + Float_t GetYproj() const { return fYproj; }; + Float_t GetZproj() const { return fZproj; }; + Float_t GetSlope() const { return fSlope; }; + Int_t GetTracklets() const { return fNtracklets; }; + Int_t GetPlanes() const { return fNplanes; }; + Int_t GetClusters() const { return fNclusters; }; + Float_t GetPt() const { return fPt; }; + Float_t GetPhi() const { return fPhi; }; + Float_t GetEta() const { return fEta; }; + Int_t GetLabel() const { return fLabel; }; + Int_t GetDetector() const { return fDetector; }; + Float_t GetPID() const { return fPID; }; + Bool_t IsElectron() const { return fIsElectron; }; protected: - TObjArray *fTracklets; //! Array of LTU tracklets + TObjArray *fTracklets; //! Array of LTU tracklets - Float_t fYproj; // Average y-projection - Float_t fZproj; // Average z-projection - Float_t fSlope; // Average slope + Float_t fYproj; // Average y-projection + Float_t fZproj; // Average z-projection + Float_t fSlope; // Average slope - Int_t fDetector; // First detector in the module + Int_t fDetector; // First detector in the module - Int_t fNtracklets; // Number of tracklets - Int_t fNplanes; // Number of TRD planes - Int_t fNclusters; // Total number of clusters + Int_t fNtracklets; // Number of tracklets + Int_t fNplanes; // Number of TRD planes + Int_t fNclusters; // Total number of clusters - Float_t fPt; // Transverse momentum - Float_t fPhi; // Phi angle at the vertex - Float_t fEta; // Eta at the vertex - Int_t fLabel; // Track label - Float_t fPID; // PID electron likelihood - Bool_t fIsElectron; // Electron flag + Float_t fPt; // Transverse momentum + Float_t fPhi; // Phi angle at the vertex + Float_t fEta; // Eta at the vertex + Int_t fLabel; // Track label + Float_t fPID; // PID electron likelihood + Bool_t fIsElectron; // Electron flag - ClassDef(AliTRDgtuTrack,2) + ClassDef(AliTRDgtuTrack,2) // TRD module global track (GTU) }; diff --git a/TRD/AliTRDltuTracklet.cxx b/TRD/AliTRDltuTracklet.cxx index ef5da95e02d..58a46bcaffa 100644 --- a/TRD/AliTRDltuTracklet.cxx +++ b/TRD/AliTRDltuTracklet.cxx @@ -18,6 +18,8 @@ // // // TRD chamber local track (LTU, tracklet) // // // +// Author: // +// Bogdan Vulpescu // // // /////////////////////////////////////////////////////////////////////////////// @@ -28,29 +30,41 @@ ClassImp(AliTRDltuTracklet) //_____________________________________________________________________________ -AliTRDltuTracklet::AliTRDltuTracklet(Int_t det, - Int_t row, - Float_t rowz, - Float_t slope, - Float_t offset, - Float_t time, - Int_t ncl, - Int_t label, - Float_t q) +AliTRDltuTracklet::AliTRDltuTracklet() + :TObject() + ,fX(0) + ,fY(0) + ,fSlope(0) + ,fRowz(0) + ,fDetector(0) + ,fRow(0) + ,fNclusters(0) + ,fLabel(0) + ,fQ(0) { // - // AliTRDltuTracklet constructor + // AliTRDltuTracklet default constructor // +} - fDetector = det; - fRow = row; - fRowz = rowz; - fSlope = slope; - fX = time; - fY = offset; - fNclusters = ncl; - fLabel = label; - fQ = q; +//_____________________________________________________________________________ +AliTRDltuTracklet::AliTRDltuTracklet(Int_t det, Int_t row, Float_t rowz + , Float_t slope, Float_t offset, Float_t time + , Int_t ncl, Int_t label, Float_t q) + :TObject() + ,fX(time) + ,fY(offset) + ,fSlope(slope) + ,fRowz(rowz) + ,fDetector(det) + ,fRow(row) + ,fNclusters(ncl) + ,fLabel(label) + ,fQ(q) +{ + // + // AliTRDltuTracklet constructor + // } @@ -66,17 +80,20 @@ AliTRDltuTracklet::~AliTRDltuTracklet() //_____________________________________________________________________________ Float_t AliTRDltuTracklet::GetPt(Float_t field) const { - // transverse momentum calculation - // curvature R = (fX*fX + fY*fY) / (2 * sin(alpha)) + // + // Transverse momentum calculation + // Curvature R = (fX*fX + fY*fY) / (2 * sin(alpha)) // alpha = angle deviation from "infinite momentum" // - // consistent with AliTRDmcmTracklet::GetPt(...) + // Consistent with AliTRDmcmTracklet::GetPt(...) + // Float_t infSlope = TMath::ATan(fY/fX)/TMath::Pi()*180.0; - Float_t alpha = fSlope - infSlope; - Float_t r = TMath::Sqrt(fX*fX + fY*fY)/(2.0*TMath::Sin(alpha/180.0*TMath::Pi())); + Float_t alpha = fSlope - infSlope; + Float_t r = TMath::Sqrt(fX*fX + fY*fY) + / (2.0*TMath::Sin(alpha/180.0*TMath::Pi())); - Float_t pt = 0.3 * field * 0.01 * r; + Float_t pt = 0.3 * field * 0.01 * r; return pt; @@ -108,9 +125,7 @@ Float_t AliTRDltuTracklet::GetYproj(Float_t xpl) const // y-projection (bending plane) onto the median plane // - Float_t yproj; - - yproj = fY + TMath::Tan(fSlope/180.0*TMath::Pi()) * (xpl - fX); + Float_t yproj = fY + TMath::Tan(fSlope/180.0*TMath::Pi()) * (xpl - fX); return yproj; @@ -123,9 +138,7 @@ Float_t AliTRDltuTracklet::GetZproj(Float_t xpl) const // z-projection (using pad row center) onto the median plane // - Float_t zproj; - - zproj = fRowz * xpl / fX; + Float_t zproj = fRowz * xpl / fX; return zproj; diff --git a/TRD/AliTRDltuTracklet.h b/TRD/AliTRDltuTracklet.h index af6c7400580..c1bf3d5b066 100644 --- a/TRD/AliTRDltuTracklet.h +++ b/TRD/AliTRDltuTracklet.h @@ -1,5 +1,15 @@ #ifndef ALITRDLTUTRACKLET_H #define ALITRDLTUTRACKLET_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD LTU tracklet // +// // +/////////////////////////////////////////////////////////////////////////////// #include @@ -9,48 +19,41 @@ class AliTRDltuTracklet : public TObject { enum { kNplan = 6 }; - AliTRDltuTracklet(Int_t det, - Int_t row, - Float_t rowz, - Float_t slope, - Float_t offset, - Float_t time, - Int_t ncl, - Int_t label, - Float_t q); - - virtual ~AliTRDltuTracklet(); - - Bool_t IsSortable() const { return kTRUE; } - virtual Int_t Compare(const TObject *o) const; - - Int_t GetDetector() const { return fDetector; }; - Int_t GetPlane(Int_t det) const { return ((Int_t) (det % kNplan)); }; - Int_t GetRow() const { return fRow; }; - Int_t GetNclusters() const { return fNclusters; }; - Float_t GetSlope() const { return fSlope; }; - Float_t GetOffset() const { return fY; }; - Float_t GetTime0() const { return fX; }; - Float_t GetRowz() const { return fRowz; }; - Float_t GetYproj(Float_t xpl) const; - Float_t GetZproj(Float_t xpl) const; - Int_t GetLabel() const { return fLabel; }; - Float_t GetPt(Float_t field) const; - Float_t GetQ() const { return fQ; }; + AliTRDltuTracklet(); + AliTRDltuTracklet(Int_t det, Int_t row, Float_t rowz, Float_t slope, Float_t offset + ,Float_t time, Int_t ncl, Int_t label, Float_t q); + virtual ~AliTRDltuTracklet(); + + Bool_t IsSortable() const { return kTRUE; } + virtual Int_t Compare(const TObject *o) const; + + Int_t GetDetector() const { return fDetector; }; + Int_t GetPlane(Int_t det) const { return ((Int_t) (det % kNplan)); }; + Int_t GetRow() const { return fRow; }; + Int_t GetNclusters() const { return fNclusters; }; + Float_t GetSlope() const { return fSlope; }; + Float_t GetOffset() const { return fY; }; + Float_t GetTime0() const { return fX; }; + Float_t GetRowz() const { return fRowz; }; + Float_t GetYproj(Float_t xpl) const; + Float_t GetZproj(Float_t xpl) const; + Int_t GetLabel() const { return fLabel; }; + Float_t GetPt(Float_t field) const; + Float_t GetQ() const { return fQ; }; protected: - Float_t fX; // distance vertex to entrance window - Float_t fY; // tracklet offset at entrance window - Float_t fSlope; // tracklet slope - Float_t fRowz; // z coordinate of the pad row center - Int_t fDetector; // detector number - Int_t fRow; // pad row number - Int_t fNclusters; // number of clusters - Int_t fLabel; // mc track label - Float_t fQ; // charge sum divided by number of clusters - - ClassDef(AliTRDltuTracklet,2) + Float_t fX; // Distance vertex to entrance window + Float_t fY; // Tracklet offset at entrance window + Float_t fSlope; // Tracklet slope + Float_t fRowz; // z coordinate of the pad row center + Int_t fDetector; // Detector number + Int_t fRow; // Pad row number + Int_t fNclusters; // Number of clusters + Int_t fLabel; // MC track label + Float_t fQ; // Charge sum divided by number of clusters + + ClassDef(AliTRDltuTracklet,2) // LTU tracklet }; diff --git a/TRD/AliTRDmcm.cxx b/TRD/AliTRDmcm.cxx index 71e1426ab3a..f9633100309 100644 --- a/TRD/AliTRDmcm.cxx +++ b/TRD/AliTRDmcm.cxx @@ -15,6 +15,20 @@ /* $Log$ +Revision 1.2 2006/04/05 12:45:40 hristov +Updated TRD trigger code. Now the trigger code can run: + +- in the simulation step, through the central trigger interface, to +produce and store "tracklets" and to produce and analyze tracks, with +inputs to the central trigger + +- in the reconstruction step: if the tracklets have already been produced +in the simulation step (by the trigger option), then only the tracks are +produced and stored in the ESD event; if not, the trigger start by +producing the tracklets, etc. + +Bogdan + Revision 1.1.1.1 2004/08/19 14:58:11 vulpescu CVS head @@ -33,6 +47,8 @@ test #include +#include "AliLog.h" + #include "AliTRDmcm.h" #include "AliTRDtrigParam.h" @@ -40,91 +56,132 @@ ClassImp(AliTRDmcm) //_____________________________________________________________________________ AliTRDmcm::AliTRDmcm() + :TObject() + ,fTrigParam(0) + ,fNtrk(0) + ,fRobId(0) + ,fChaId(0) + ,fRow(0) + ,fColFirst(0) + ,fColLast(0) + ,fTime1(0) + ,fTime2(0) + ,fClusThr(0) + ,fPadThr(0) + ,fNtrkSeeds(0) + ,fR1(0) + ,fR2(0) + ,fC1(0) + ,fC2(0) + ,fPedestal(0) + ,fId(0) { // // AliTRDmcm default constructor // - fTrigParam = 0; + Int_t i = 0; + Int_t j = 0; - fNtrk = 0; - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { + for (i = 0; i < kMaxTrackletsPerMCM; i++) { fTrkIndex[i] = 0; + fSeedCol[i] = -1; } - fRobId = 0; - fChaId = 0; - fRow = 0; - fColFirst = 0; - fColLast = 0; - for (Int_t i = 0; i < kMcmCol; i++) { - fPadHits[i] = 0; - for (Int_t j = 0; j < kMcmTBmax; j++) { - fADC[i][j] = 0.0; + for (i = 0; i < kMcmCol; i++) { + fPadHits[i] = 0; + for (j = 0; j < kMcmTBmax; j++) { + fADC[i][j] = 0.0; fIsClus[i][j] = kFALSE; } } - fPadThr = 0; - fClusThr = 0; - fTime1 = 0; - fTime2 = 0; - fNtrkSeeds = 0; - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { - fSeedCol[i] = -1; - } - - fR1 = 0.0; - fR2 = 0.0; - fC1 = 0.0; - fC2 = 0.0; - fPedestal = 0.0; - - fId = 0; } //_____________________________________________________________________________ AliTRDmcm::AliTRDmcm(AliTRDtrigParam *trigp, const Int_t id) + :TObject() + ,fTrigParam(trigp) + ,fNtrk(0) + ,fRobId(0) + ,fChaId(0) + ,fRow(0) + ,fColFirst(0) + ,fColLast(0) + ,fTime1(trigp->GetTime1()) + ,fTime2(trigp->GetTime2()) + ,fClusThr(trigp->GetClusThr()) + ,fPadThr(trigp->GetPadThr()) + ,fNtrkSeeds(0) + ,fR1(0) + ,fR2(0) + ,fC1(0) + ,fC2(0) + ,fPedestal(0) + ,fId(id) { // // AliTRDmcm constructor // - fTrigParam = trigp; + Int_t i = 0; + Int_t j = 0; - fNtrk = 0; - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { + for (i = 0; i < kMaxTrackletsPerMCM; i++) { fTrkIndex[i] = 0; + fSeedCol[i] = -1; } - fRobId = 0; - fChaId = 0; - fRow = 0; - fColFirst = 0; - fColLast = 0; - for (Int_t i = 0; i < kMcmCol; i++) { - fPadHits[i] = 0; - for (Int_t j = 0; j < kMcmTBmax; j++) { - fADC[i][j] = 0.0; + for (i = 0; i < kMcmCol; i++) { + fPadHits[i] = 0; + for (j = 0; j < kMcmTBmax; j++) { + fADC[i][j] = 0.0; fIsClus[i][j] = kFALSE; } } - fPadThr = fTrigParam->GetPadThr(); - fClusThr = fTrigParam->GetClusThr(); - fTime1 = fTrigParam->GetTime1(); - fTime2 = fTrigParam->GetTime2(); - fNtrkSeeds = 0; - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { - fSeedCol[i] = -1; - } - fR1 = 0.0; - fR2 = 0.0; - fC1 = 0.0; - fC2 = 0.0; - fPedestal = 0.0; - fTrigParam->GetFilterParam(fR1,fR2,fC1,fC2,fPedestal); - fId = id; +} + +//_____________________________________________________________________________ +AliTRDmcm::AliTRDmcm(const AliTRDmcm &m) + :TObject(m) + ,fTrigParam(NULL) + ,fNtrk(m.fNtrk) + ,fRobId(m.fRobId) + ,fChaId(m.fChaId) + ,fRow(m.fRow) + ,fColFirst(m.fColFirst) + ,fColLast(m.fColLast) + ,fTime1(m.fTime1) + ,fTime2(m.fTime2) + ,fClusThr(m.fClusThr) + ,fPadThr(m.fPadThr) + ,fNtrkSeeds(m.fNtrkSeeds) + ,fR1(m.fR1) + ,fR2(m.fR2) + ,fC1(m.fC1) + ,fC2(m.fC2) + ,fPedestal(m.fPedestal) + ,fId(m.fId) +{ + // + // AliTRDmcm copy constructor + // + + Int_t i = 0; + Int_t j = 0; + + for (i = 0; i < kMaxTrackletsPerMCM; i++) { + ((AliTRDmcm &) m).fTrkIndex[i] = 0; + ((AliTRDmcm &) m).fSeedCol[i] = -1; + } + for (i = 0; i < kMcmCol; i++) { + ((AliTRDmcm &) m).fPadHits[i] = 0; + for (j = 0; j < kMcmTBmax; j++) { + ((AliTRDmcm &) m).fADC[i][j] = 0.0; + ((AliTRDmcm &) m).fIsClus[i][j] = kFALSE; + } + } } @@ -141,7 +198,7 @@ AliTRDmcm::~AliTRDmcm() AliTRDmcm &AliTRDmcm::operator=(const AliTRDmcm &m) { // - // assignment operator + // Assignment operator // if (this != &m) ((AliTRDmcm &) m).Copy(*this); @@ -153,9 +210,12 @@ AliTRDmcm &AliTRDmcm::operator=(const AliTRDmcm &m) void AliTRDmcm::Copy(TObject &m) const { // - // copy function + // Copy function // + Int_t i = 0; + Int_t j = 0; + ((AliTRDmcm &) m).fTrigParam = NULL; ((AliTRDmcm &) m).fNtrk = fNtrk; ((AliTRDmcm &) m).fRobId = fRobId; @@ -175,19 +235,17 @@ void AliTRDmcm::Copy(TObject &m) const ((AliTRDmcm &) m).fPedestal = fPedestal; ((AliTRDmcm &) m).fId = fId; - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { + for (i = 0; i < kMaxTrackletsPerMCM; i++) { ((AliTRDmcm &) m).fTrkIndex[i] = 0; + ((AliTRDmcm &) m).fSeedCol[i] = -1; } - for (Int_t i = 0; i < kMcmCol; i++) { - ((AliTRDmcm &) m).fPadHits[i] = 0; - for (Int_t j = 0; j < kMcmTBmax; j++) { - ((AliTRDmcm &) m).fADC[i][j] = 0.0; + for (i = 0; i < kMcmCol; i++) { + ((AliTRDmcm &) m).fPadHits[i] = 0; + for (j = 0; j < kMcmTBmax; j++) { + ((AliTRDmcm &) m).fADC[i][j] = 0.0; ((AliTRDmcm &) m).fIsClus[i][j] = kFALSE; } } - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { - ((AliTRDmcm &) m).fSeedCol[i] = -1; - } } @@ -212,14 +270,17 @@ void AliTRDmcm::Reset() // Reset MCM data // - for (Int_t i = 0; i < kMcmCol; i++) { + Int_t i = 0; + Int_t j = 0; + + for (i = 0; i < kMcmCol; i++) { fPadHits[i] = 0; - for (Int_t j = 0; j < kMcmTBmax; j++) { - fADC[i][j] = 0.0; + for (j = 0; j < kMcmTBmax; j++) { + fADC[i][j] = 0.0; fIsClus[i][j] = kFALSE; } } - for (Int_t i = 0; i < kMaxTrackletsPerMCM; i++) { + for (i = 0; i < kMaxTrackletsPerMCM; i++) { fSeedCol[i] = -1; } @@ -232,49 +293,55 @@ Bool_t AliTRDmcm::Run() // Run MCM // - if ( fTrigParam->GetDebugLevel() > 1 ) printf("AliTRDmcm::Run MCM %d\n",Id()); + AliDebug(2,(Form("Run MCM %d\n",Id()))); + + Int_t iTime = 0; + Int_t iCol = 0; + Int_t iPad = 0; + Int_t iPlus = 0; + Int_t i = 0; + Int_t j = 0; - Float_t amp[3] = {0.0, 0.0, 0.0}; + Float_t amp[3] = { 0.0, 0.0, 0.0 }; Int_t nClus; Int_t clusCol[kMcmCol/2]; Float_t clusAmp[kMcmCol/2]; Float_t veryLarge; Int_t clusMin = -1; - for (Int_t iTime = fTime1; iTime <= fTime2; iTime++) { // main TB loop + // Main TB loop + for (iTime = fTime1; iTime <= fTime2; iTime++) { - // find clusters... + // Find clusters... nClus = 0; - for (Int_t iCol = 1; iCol < (kMcmCol-1); iCol++) { + for (iCol = 1; iCol < (kMcmCol-1); iCol++) { amp[0] = fADC[iCol-1][iTime]; amp[1] = fADC[iCol ][iTime]; amp[2] = fADC[iCol+1][iTime]; if (IsCluster(amp)) { fIsClus[iCol][iTime] = kTRUE; - clusCol[nClus] = iCol; - clusAmp[nClus] = amp[0]+amp[1]+amp[2]; + clusCol[nClus] = iCol; + clusAmp[nClus] = amp[0]+amp[1]+amp[2]; nClus++; if (nClus == kMcmCol/2) { - printf("Too many clusters in time bin %2d MCM %d...\n",iTime,Id()); - //return kFALSE; + AliWarning(Form("Too many clusters in time bin %2d MCM %d...\n",iTime,Id())); break; } } } // ...but no more than six... - if (nClus > (Int_t)kSelClus) { - for (Int_t j = kSelClus/2; j < nClus-kSelClus/2; j++) { + if (nClus > (Int_t) kSelClus) { + for (j = kSelClus/2; j < nClus-kSelClus/2; j++) { fIsClus[clusCol[j]][iTime] = kFALSE; } } // ...and take the largest four. - Int_t nClusPlus = nClus - kMaxClus; - for (Int_t iPlus = 0; iPlus < nClusPlus; iPlus++ ) { + for (iPlus = 0; iPlus < nClusPlus; iPlus++ ) { veryLarge = 1.E+10; - for (Int_t i = 0; i < nClus; i++) { + for (i = 0; i < nClus; i++) { if (fIsClus[clusCol[i]][iTime]) { if (clusAmp[i] <= veryLarge) { veryLarge = clusAmp[i]; @@ -290,29 +357,28 @@ Bool_t AliTRDmcm::Run() } // end main TB loop if (fTrigParam->GetDebugLevel() > 1) { - for (Int_t i = fTime1; i <= fTime2; i++) { + for (i = fTime1; i <= fTime2; i++) { printf("%2d: ",i); - for (Int_t j = 0; j < kMcmCol; j++) { + for (j = 0; j < kMcmCol; j++) { printf("%1d ",fIsClus[j][i]); } printf("\n"); } printf("PadHits: "); - for (Int_t iPad = 0; iPad < kMcmCol; iPad++) { + for (iPad = 0; iPad < kMcmCol; iPad++) { printf("%2d ",fPadHits[iPad]); } printf("\n"); } if ((fNtrkSeeds = CreateSeeds())) { - return kTRUE; - } return kFALSE; } + //_____________________________________________________________________________ Int_t AliTRDmcm::CreateSeeds() { @@ -320,17 +386,19 @@ Int_t AliTRDmcm::CreateSeeds() // Make column seeds (from Falk Lesser, ex KIP) // - if ( fTrigParam->GetDebugLevel() > 1 ) printf("AliTRDmcm::CreateSeeds MCM %d \n",Id()); - + Int_t i = 0; + Int_t j = 0; Int_t nSeeds = 0; - // working array for hit sums + AliDebug(2,Form("AliTRDmcm::CreateSeeds MCM %d \n",Id())); + + // Working array for hit sums Int_t fHit2padSum[2][kMcmCol]; - // initialize the array - for( Int_t i = 0; i < 2; i++ ) { - for( Int_t j = 0; j < kMcmCol; j++ ) { - if( i == 0 ) { + // Initialize the array + for (i = 0; i < 2; i++) { + for (j = 0; j < kMcmCol; j++ ) { + if (i == 0) { fHit2padSum[i][j] = j; } else { fHit2padSum[i][j] = -1; @@ -341,19 +409,22 @@ Int_t AliTRDmcm::CreateSeeds() Int_t sum10 = fTrigParam->GetSum10(); Int_t sum12 = fTrigParam->GetSum12(); - // build the 2padSum + // Build the 2padSum Int_t nsum2seed = 0; - for( Int_t i = 0; i < kMcmCol; i++ ) { - if( i < (kMcmCol-1) ) { - if( (fPadHits[i] >= sum10) && ((fPadHits[i] + fPadHits[i+1]) >= sum12) ) { + for (i = 0; i < kMcmCol; i++) { + if (i < (kMcmCol-1)) { + if ((fPadHits[i] >= sum10) && ((fPadHits[i] + fPadHits[i+1]) >= sum12)) { fHit2padSum[1][i] = fPadHits[i] + fPadHits[i+1]; - } else { + } + else { fHit2padSum[1][i] = -1; } - } else { - if ( fPadHits[i] >= sum12 ) { + } + else { + if (fPadHits[i] >= sum12) { fHit2padSum[1][i] = fPadHits[i]; - } else { + } + else { fHit2padSum[1][i] = -1; } } @@ -362,12 +433,12 @@ Int_t AliTRDmcm::CreateSeeds() if (fTrigParam->GetDebugLevel() > 1) { printf("fHit2padSum: "); - for( Int_t i = 0; i < kMcmCol; i++ ) { + for (i = 0; i < kMcmCol; i++) { printf("%2d ",fHit2padSum[0][i]); } printf("\n"); printf(" "); - for( Int_t i = 0; i < kMcmCol; i++ ) { + for (i = 0; i < kMcmCol; i++) { printf("%2d ",fHit2padSum[1][i]); } printf("\n"); @@ -378,12 +449,12 @@ Int_t AliTRDmcm::CreateSeeds() if (fTrigParam->GetDebugLevel() > 1) { printf("fHit2padSum: "); - for( Int_t i = 0; i < kMcmCol; i++ ) { + for (i = 0; i < kMcmCol; i++) { printf("%2d ",fHit2padSum[0][i]); } printf("\n"); printf(" "); - for( Int_t i = 0; i < kMcmCol; i++ ) { + for (i = 0; i < kMcmCol; i++ ) { printf("%2d ",fHit2padSum[1][i]); } printf("\n"); @@ -393,19 +464,19 @@ Int_t AliTRDmcm::CreateSeeds() nSeeds = TMath::Min(nsum2seed,kMaxTrackletsPerMCM); Sort(nSeeds,&fHit2padSum[1][0],&fHit2padSum[0][0],0); - for (Int_t i = 0; i < nSeeds; i++) { + for (i = 0; i < nSeeds; i++) { fSeedCol[i] = fHit2padSum[0][i]; } if (fTrigParam->GetDebugLevel() > 1) { printf("Found %d seeds before multiple rejection. \n",nSeeds); printf("fHit2padSum: "); - for( Int_t i = 0; i < kMcmCol; i++ ) { + for (i = 0; i < kMcmCol; i++) { printf("%2d ",fHit2padSum[0][i]); } printf("\n"); printf(" "); - for( Int_t i = 0; i < kMcmCol; i++ ) { + for (i = 0; i < kMcmCol; i++) { printf("%2d ",fHit2padSum[1][i]); } printf("\n"); @@ -413,24 +484,26 @@ Int_t AliTRDmcm::CreateSeeds() // reject multiple found tracklets Int_t imax = nSeeds-1; - for (Int_t i = 0; i < imax; i++) { + for (i = 0; i < imax; i++) { if ((fHit2padSum[0][i]+1) == fHit2padSum[0][i+1]) { nSeeds--; if (fHit2padSum[1][i] >= fHit2padSum[1][i+1]) { - if (fTrigParam->GetDebugLevel() > 1) - printf("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i+1]); + if (fTrigParam->GetDebugLevel() > 1) { + AliWarning(Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i+1])); + } fSeedCol[i+1] = -1; } else { - if (fTrigParam->GetDebugLevel() > 1) - printf("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i]); - fSeedCol[i] = -1; + if (fTrigParam->GetDebugLevel() > 1) { + AliWarning(Form("Reject seed %1d in col %02d. \n",i,fHit2padSum[0][i])); + } + fSeedCol[i] = -1; } } } - if ( fTrigParam->GetDebugLevel() > 1 ) { + if (fTrigParam->GetDebugLevel() > 1) { printf("Found %d seeds in MCM %d ",nSeeds,Id()); for (Int_t i = 0; i < (imax+1); i++) { if (fSeedCol[i] >= 0) printf(", %02d ",fSeedCol[i]); @@ -451,42 +524,46 @@ void AliTRDmcm::Sort(Int_t nel, Int_t *x1, Int_t *x2, Int_t dir) // dir = 1 descending order // + Int_t i = 0; Bool_t sort; - Int_t tmp1, tmp2; + Int_t tmp1; + Int_t tmp2; - if ( dir == 0 ) { + if (dir == 0) { do { sort = kTRUE; - for ( Int_t i = 0; i < (nel-1); i++ ) - if ( x2[i+1] < x2[i] ) { - tmp2 = x2[i]; - x2[i] = x2[i+1]; + for (i = 0; i < (nel-1); i++) { + if (x2[i+1] < x2[i]) { + tmp2 = x2[i]; + x2[i] = x2[i+1]; x2[i+1] = tmp2; - tmp1 = x1[i]; - x1[i] = x1[i+1]; + tmp1 = x1[i]; + x1[i] = x1[i+1]; x1[i+1] = tmp1; - sort = kFALSE; + sort = kFALSE; } - } while ( sort == kFALSE ); + } + } while (sort == kFALSE); } - if ( dir == 1 ) { + if (dir == 1) { do { sort = kTRUE; - for ( Int_t i = 0; i < (nel-1); i++ ) - if ( x2[i+1] > x2[i] ) { - tmp2 = x2[i]; - x2[i] = x2[i+1]; + for (i = 0; i < (nel-1); i++) { + if (x2[i+1] > x2[i]) { + tmp2 = x2[i]; + x2[i] = x2[i+1]; x2[i+1] = tmp2; - tmp1 = x1[i]; - x1[i] = x1[i+1]; + tmp1 = x1[i]; + x1[i] = x1[i+1]; x1[i+1] = tmp1; - sort = kFALSE; + sort = kFALSE; } - } while ( sort == kFALSE ); + } + } while (sort == kFALSE); } @@ -515,13 +592,19 @@ Bool_t AliTRDmcm::IsCluster(Float_t amp[3]) const // // -> shape - if (amp[0] > amp[1] || amp[2] > amp[1]) return kFALSE; + if (amp[0] > amp[1] || amp[2] > amp[1]) { + return kFALSE; + } // -> cluster amplitude - if ((amp[0]+amp[1]+amp[2]) < fClusThr) return kFALSE; + if ((amp[0]+amp[1]+amp[2]) < fClusThr) { + return kFALSE; + } // -> pad amplitude - if (amp[0] < fPadThr && amp[2] < fPadThr) return kFALSE; + if (amp[0] < fPadThr && amp[2] < fPadThr) { + return kFALSE; + } return kTRUE; @@ -531,24 +614,26 @@ Bool_t AliTRDmcm::IsCluster(Float_t amp[3]) const void AliTRDmcm::Filter(Int_t nexp, Int_t ftype) { // - // exponential filter + // Exponential filter // + Int_t iCol = 0; + Int_t iTime = 0; + Double_t sour[kMcmTBmax]; Double_t dtarg[kMcmTBmax]; Int_t itarg[kMcmTBmax]; switch(ftype) { - case 0: + case 0: - for (Int_t iCol = 0; iCol < kMcmCol; iCol++) { - for (Int_t iTime = 0; iTime < kMcmTBmax; iTime++) { + for (iCol = 0; iCol < kMcmCol; iCol++) { + for (iTime = 0; iTime < kMcmTBmax; iTime++) { sour[iTime] = fADC[iCol][iTime]; } DeConvExpA(sour,dtarg,kMcmTBmax,nexp); - for (Int_t iTime = 0; iTime < kMcmTBmax; iTime++) { - //fADC[iCol][iTime] = (Int_t)TMath::Max(0.0,dtarg[iTime]); + for (iTime = 0; iTime < kMcmTBmax; iTime++) { fADC[iCol][iTime] = TMath::Max(0.0,dtarg[iTime]); } } @@ -556,12 +641,12 @@ void AliTRDmcm::Filter(Int_t nexp, Int_t ftype) case 1: - for (Int_t iCol = 0; iCol < kMcmCol; iCol++) { - for (Int_t iTime = 0; iTime < kMcmTBmax; iTime++) { + for (iCol = 0; iCol < kMcmCol; iCol++) { + for (iTime = 0; iTime < kMcmTBmax; iTime++) { sour[iTime] = fADC[iCol][iTime]; } DeConvExpD(sour,itarg,kMcmTBmax,nexp); - for (Int_t iTime = 0; iTime < kMcmTBmax; iTime++) { + for (iTime = 0; iTime < kMcmTBmax; iTime++) { fADC[iCol][iTime] = itarg[iTime]; } } @@ -569,13 +654,12 @@ void AliTRDmcm::Filter(Int_t nexp, Int_t ftype) case 2: - for (Int_t iCol = 0; iCol < kMcmCol; iCol++) { - for (Int_t iTime = 0; iTime < kMcmTBmax; iTime++) { + for (iCol = 0; iCol < kMcmCol; iCol++) { + for (iTime = 0; iTime < kMcmTBmax; iTime++) { sour[iTime] = fADC[iCol][iTime]; } DeConvExpMI(sour,dtarg,kMcmTBmax); - for (Int_t iTime = 0; iTime < kMcmTBmax; iTime++) { - //fADC[iCol][iTime] = (Int_t)TMath::Max(0.0,dtarg[iTime]); + for (iTime = 0; iTime < kMcmTBmax; iTime++) { fADC[iCol][iTime] = TMath::Max(0.0,dtarg[iTime]); } } @@ -583,7 +667,7 @@ void AliTRDmcm::Filter(Int_t nexp, Int_t ftype) default: - printf("Invalid filter type %d ! \n",ftype); + AliError(Form("Invalid filter type %d ! \n",ftype)); return; } @@ -597,10 +681,15 @@ void AliTRDmcm::DeConvExpA(Double_t *source, Double_t *target, Int_t n, Int_t ne // Exponential filter "analog" // + Int_t i = 0; + Int_t k = 0; + Double_t reminder[2]; + Double_t correction; + Double_t result; Double_t rates[2]; Double_t coefficients[2]; - // initialize (coefficient = alpha, rates = lambda) + // Initialize (coefficient = alpha, rates = lambda) // FilterOpt.C (aliroot@pel:/homel/aliroot/root/work/beamt/CERN02) Double_t r1, r2, c1, c2; @@ -615,23 +704,27 @@ void AliTRDmcm::DeConvExpA(Double_t *source, Double_t *target, Int_t n, Int_t ne Double_t dt = 0.100; rates[0] = TMath::Exp(-dt/(r1)); rates[1] = TMath::Exp(-dt/(r2)); - - Int_t i, k; - Double_t reminder[2]; - Double_t correction, result; - /* attention: computation order is important */ - correction=0.0; - for ( k=0; k 0x0FFF ) { + if ((rem1 + rem2) > 0x0FFF) { correction = 0x0FFF; - } else { + } + else { correction = (rem1 + rem2) & 0x0FFF; } fTailPed = iFactor - correction; - for (Int_t i=0; i> 11) ); - if ( h1 > 0x0FFF ) { + h1 = (rem1 + ((iAlphaL * result) >> 11)); + if (h1 > 0x0FFF) { h1 = 0x0FFF; - } else { + } + else { h1 &= 0x0FFF; } - h2 = ( rem2 + ((iAlphaS * result) >> 11)); - if ( h2 > 0x0FFF ) { + h2 = (rem2 + ((iAlphaS * result) >> 11)); + if (h2 > 0x0FFF) { h2 = 0x0FFF; - } else { + } + else { h2 &= 0x0FFF; } rem1 = (iLambdaL * h1 ) >> 11; rem2 = (iLambdaS * h2 ) >> 11; - if ( (rem1 + rem2) > 0x0FFF ) { + if ((rem1 + rem2) > 0x0FFF) { correction = 0x0FFF; - } else { + } + else { correction = (rem1 + rem2) & 0x0FFF; } } @@ -741,21 +840,27 @@ void AliTRDmcm::DeConvExpMI(Double_t *source, Double_t *target, Int_t n) // Exponential filter (M. Ivanov) // - Double_t sig1[100], sig2[100], sig3[100];//, sig4[100]; - for (Int_t i = 0; i < n; i++) sig1[i] = source[i]; + Int_t i = 0; - Float_t dt = 0.100; + Double_t sig1[100]; + Double_t sig2[100]; + Double_t sig3[100]; - //Float_t lambda0 = 9.8016*dt; // short - //Float_t lambda1 = 1.0778*dt; // long + for (i = 0; i < n; i++) { + sig1[i] = source[i]; + } - Float_t lambda0 = (1.0/fR2)*dt; - Float_t lambda1 = (1.0/fR1)*dt; + Float_t dt = 0.100; - TailMakerSpline(sig1,sig2,lambda0,n); - TailCancelationMI(sig2,sig3,0.7,lambda1,n); + Float_t lambda0 = (1.0/fR2)*dt; + Float_t lambda1 = (1.0/fR1)*dt; - for (Int_t i = 0; i < n; i++) target[i] = sig3[i]; + TailMakerSpline(sig1,sig2,lambda0,n); + TailCancelationMI(sig2,sig3,0.7,lambda1,n); + + for (i = 0; i < n; i++) { + target[i] = sig3[i]; + } } @@ -766,116 +871,115 @@ void AliTRDmcm::TailMakerSpline(Double_t *ampin, Double_t *ampout, Double_t lamb // Special filter (M. Ivanov) // - Double_t l = TMath::Exp(-lambda*0.5); - // - // - Double_t in[1000]; - Double_t out[1000]; - // initialize in[] and out[] goes 0 ... 2*n+19 - for (Int_t i=0; i=0; i--){ - out[i] = in[i] + temp; - temp = l*(temp+in[i]); - } - - // - for (int i=0;i= 0; i--) { + out[i] = in[i] + temp; + temp = l*(temp+in[i]); + } + + for (i = 0; i < n; i++){ + //ampout[i] = out[2*i+1]; // org + ampout[i] = out[2*i]; + } } //______________________________________________________________________________ -void AliTRDmcm::TailCancelationMI(Double_t *ampin, Double_t *ampout, Double_t norm, Double_t lambda, Int_t n) +void AliTRDmcm::TailCancelationMI(Double_t *ampin, Double_t *ampout + , Double_t norm, Double_t lambda, Int_t n) { // // Special filter (M. Ivanov) // - Double_t l = TMath::Exp(-lambda*0.5); - Double_t k = l*(1.-norm*lambda*0.5); - // - // - Double_t in[1000]; - Double_t out[1000]; - // initialize in[] and out[] goes 0 ... 2*n+19 - for (Int_t i=0; i #include +#include "AliLog.h" + #include "AliTRDcalibDB.h" #include "AliTRDCommonParam.h" #include "AliTRDpadPlane.h" #include "AliTRDgeometry.h" - #include "AliTRDmcmTracklet.h" ClassImp(AliTRDmcmTracklet) //_____________________________________________________________________________ AliTRDmcmTracklet::AliTRDmcmTracklet() + :TObject() + ,fDetector(-1) + ,fRow(-1) + ,fTrackLabel(-1) + ,fNclusters(0) + ,fN(0) + ,fGPos(0) + ,fGAmp(0) + ,fTime0(0) + ,fRowz(0) + ,fSlope(0) + ,fOffset(0) + ,fPt(0) + ,fdQdl(0) { // // AliTRDmcmTracklet default constructor // - fDetector = -1; - fRow = -1; - for (Int_t time = 0; time < kNtimeBins; time++) { for (Int_t icl = 0; icl < kNclsPads; icl++) { fADC[time][icl] = 0; @@ -55,32 +67,29 @@ AliTRDmcmTracklet::AliTRDmcmTracklet() fCol[time] = 0; } - fNclusters = 0; - fN = 0; - fTrackLabel = -1; - - fGPos = 0; - fGAmp = 0; - - fSlope = 0.0; - fOffset = 0.0; - fTime0 = 0.0; - fRowz = 0.0; - fPt = 0.0; - fdQdl = 0.0; - } //_____________________________________________________________________________ AliTRDmcmTracklet::AliTRDmcmTracklet(Int_t det, Int_t row, Int_t n) + :TObject() + ,fDetector(det) + ,fRow(row) + ,fTrackLabel(-1) + ,fNclusters(0) + ,fN(n) + ,fGPos(0) + ,fGAmp(0) + ,fTime0(0) + ,fRowz(0) + ,fSlope(0) + ,fOffset(0) + ,fPt(0) + ,fdQdl(0) { // // AliTRDmcmTracklet default constructor // - fDetector = det; - fRow = row; - for (Int_t time = 0; time < kNtimeBins; time++) { for (Int_t icl = 0; icl < kNclsPads; icl++) { fADC[time][icl] = 0; @@ -92,21 +101,42 @@ AliTRDmcmTracklet::AliTRDmcmTracklet(Int_t det, Int_t row, Int_t n) fCol[time] = 0; } - fNclusters = 0; - - fN = n; - - fTrackLabel = -1; - fGPos = new TGraph(0); fGAmp = new TGraph(0); - fSlope = 0.0; - fOffset = 0.0; - fTime0 = 0.0; - fRowz = 0.0; - fPt = 0.0; - fdQdl = 0.0; +} + +//_____________________________________________________________________________ +AliTRDmcmTracklet::AliTRDmcmTracklet(const AliTRDmcmTracklet &t) + :TObject(t) + ,fDetector(t.fDetector) + ,fRow(t.fRow) + ,fTrackLabel(t.fTrackLabel) + ,fNclusters(t.fNclusters) + ,fN(t.fN) + ,fGPos(NULL) + ,fGAmp(NULL) + ,fTime0(t.fTime0) + ,fRowz(t.fRowz) + ,fSlope(t.fSlope) + ,fOffset(t.fOffset) + ,fPt(t.fPt) + ,fdQdl(t.fdQdl) +{ + // + // AliTRDmcmTracklet copy constructor + // + + for (Int_t time = 0; time < kNtimeBins; time++) { + for (Int_t icl = 0; icl < kNclsPads; icl++) { + ((AliTRDmcmTracklet &) t).fADC[time][icl] = 0; + } + for (Int_t it = 0; it < kNdict; it++) { + ((AliTRDmcmTracklet &) t).fTrack[time][it] = -1; + } + ((AliTRDmcmTracklet &) t).fTime[time] = 0; + ((AliTRDmcmTracklet &) t).fCol[time] = 0; + } } @@ -126,7 +156,7 @@ AliTRDmcmTracklet::~AliTRDmcmTracklet() AliTRDmcmTracklet &AliTRDmcmTracklet::operator=(const AliTRDmcmTracklet &t) { // - // assignment operator + // Assignment operator // if (this != &t) ((AliTRDmcmTracklet &) t).Copy(*this); @@ -138,7 +168,7 @@ AliTRDmcmTracklet &AliTRDmcmTracklet::operator=(const AliTRDmcmTracklet &t) void AliTRDmcmTracklet::Copy(TObject &t) const { // - // copy function + // Copy function // ((AliTRDmcmTracklet &) t).fDetector = fDetector; @@ -215,7 +245,6 @@ void AliTRDmcmTracklet::AddCluster(Int_t icol, Int_t itb, Float_t *adc, Int_t *t if (fNclusters >= kNtimeBins) return; for (Int_t icl = 0; icl < kNclsPads; icl++) { - //fADC[fNclusters][icl] = (Int_t)adc[icl]; fADC[fNclusters][icl] = adc[icl]; } @@ -237,21 +266,19 @@ void AliTRDmcmTracklet::MakeTrackletGraph(AliTRDgeometry *geo, Float_t field) // if (!geo) { - Error("MakeTrackletGraph","No geometry."); + AliError("No geometry."); return; } AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) - { - Error("MakeTrackletGraph","No common params."); + if (!commonParam) { + AliError("No common parameters."); return; } AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); - if (!calibration) - { - Error("MakeTrackletGraph","No instance of AliTRDcalibDB."); + if (!calibration) { + AliError("No instance of AliTRDcalibDB."); return; } @@ -291,7 +318,7 @@ void AliTRDmcmTracklet::MakeTrackletGraph(AliTRDgeometry *geo, Float_t field) // From v4-03-Release to HEAD28Mar06 the sign has changed from "-" to "+" // due to a change in the digitizer - omegaTau = +TMath::Sign(1.0,(Double_t)field)*GetOmegaTau(vDrift,TMath::Abs(field)); + omegaTau = TMath::Sign(1.0,(Double_t)field)*GetOmegaTau(vDrift,TMath::Abs(field)); lorentzAngle = TMath::ATan(omegaTau)*180.0/TMath::Pi(); xpos = (time+0.5) * timeBinSize; @@ -318,9 +345,13 @@ void AliTRDmcmTracklet::MakeTrackletGraph(AliTRDgeometry *geo, Float_t field) fTime0 = geo->GetTime0(iplan) - AliTRDgeometry::CdrHght() - 0.5*AliTRDgeometry::CamHght(); fRowz = padPlane->GetRowPos(fRow) - padPlane->GetRowSize(fRow)/2.0; - Double_t xMin = 0, xMax = 0, x, y; - fGPos->GetPoint(0 ,x,y); xMax = x + 0.1; - fGPos->GetPoint(npg-1,x,y); xMin = x - 0.1; + Double_t xMin = 0; + Double_t xMax = 0; + Double_t x, y; + fGPos->GetPoint(0 ,x,y); + xMax = x + 0.1; + fGPos->GetPoint(npg-1,x,y); + xMin = x - 0.1; TF1 *line = new TF1("line","[0]+x*[1]",xMin,xMax); fGPos->Fit(line,"WRQ0"); @@ -334,8 +365,8 @@ void AliTRDmcmTracklet::MakeTrackletGraph(AliTRDgeometry *geo, Float_t field) Float_t fy = fOffset; Float_t infSlope = TMath::ATan(fy/fx)/TMath::Pi()*180.0; - Float_t alpha = fSlope - infSlope; - Float_t r = TMath::Sqrt(fx*fx + fy*fy)/(2.0*TMath::Sin(alpha/180.0*TMath::Pi())); + Float_t alpha = fSlope - infSlope; + Float_t r = TMath::Sqrt(fx*fx + fy*fy)/(2.0*TMath::Sin(alpha/180.0*TMath::Pi())); fPt = 0.3 * field * 0.01 * r; @@ -350,9 +381,10 @@ void AliTRDmcmTracklet::MakeClusAmpGraph() // Tracklet graph of cluster charges // - Int_t time; + Int_t time; Float_t amp[3]; - Int_t npg = 0; + Int_t npg = 0; + fdQdl = 0.0; for (Int_t icl = 0; icl < fNclusters; icl++) { @@ -410,7 +442,7 @@ Float_t AliTRDmcmTracklet::GetClusY(Float_t *adc, Int_t pla) const case 5: sigma = 0.463; break; default: - Error("GetClusY","Wrong plane number."); + AliError("Wrong plane number."); return 0.0; } @@ -475,7 +507,7 @@ void AliTRDmcmTracklet::CookLabel(Float_t frac) trackCount[nTracks]++; nTracks++; if (nTracks == kMaxTracks) { - Warning("CookLabel","Too many tracks for this tracklet."); + AliWarning("Too many tracks for this tracklet."); nTracks--; break; } @@ -518,9 +550,9 @@ Float_t AliTRDmcmTracklet::GetOmegaTau(Float_t vdrift, Float_t field) const ib = TMath::Min(kNb,ib); Float_t alphaL = p0[ib] - + p1[ib] * vdrift - + p2[ib] * vdrift*vdrift - + p3[ib] * vdrift*vdrift*vdrift; + + p1[ib] * vdrift + + p2[ib] * vdrift*vdrift + + p3[ib] * vdrift*vdrift*vdrift; return TMath::Tan(alphaL); diff --git a/TRD/AliTRDmcmTracklet.h b/TRD/AliTRDmcmTracklet.h index 4ad87080a44..416cd303717 100644 --- a/TRD/AliTRDmcmTracklet.h +++ b/TRD/AliTRDmcmTracklet.h @@ -23,39 +23,40 @@ class AliTRDmcmTracklet : public TObject { AliTRDmcmTracklet(); AliTRDmcmTracklet(Int_t det, Int_t row, Int_t n); - virtual ~AliTRDmcmTracklet(); + AliTRDmcmTracklet(const AliTRDmcmTracklet &t); + virtual ~AliTRDmcmTracklet(); AliTRDmcmTracklet &operator=(const AliTRDmcmTracklet &t); - virtual void Copy(TObject &t) const; - - void Reset(); - - void AddCluster(Int_t icol, Int_t itb, Float_t *adc, Int_t *track); - void MakeTrackletGraph(AliTRDgeometry *geo = 0, Float_t field = 0); - void MakeClusAmpGraph(); - void CookLabel(Float_t frac); - - void SetRow(Int_t row) { fRow = row; }; - void SetDetector(Int_t det) { fDetector = det; }; - void SetN(Int_t n) { fN = n; }; - - Int_t GetNclusters() const { return fNclusters; }; - Int_t GetDetector() const { return fDetector; }; - Int_t GetRow() const { return fRow; }; - Float_t GetOffset() const { return fOffset; }; - Float_t GetSlope() const { return fSlope; }; - Float_t GetTime0() const { return fTime0; }; - Float_t GetRowz() const { return fRowz; }; - Float_t GetPt() const { return fPt; }; - Float_t GetdQdl() const { return fdQdl; }; - Int_t GetLabel() const { return fTrackLabel; }; - Int_t GetNumber() const { return fN; }; + virtual void Copy(TObject &t) const; + + void Reset(); + + void AddCluster(Int_t icol, Int_t itb, Float_t *adc, Int_t *track); + void MakeTrackletGraph(AliTRDgeometry *geo = 0, Float_t field = 0); + void MakeClusAmpGraph(); + void CookLabel(Float_t frac); + + void SetRow(Int_t row) { fRow = row; }; + void SetDetector(Int_t det) { fDetector = det; }; + void SetN(Int_t n) { fN = n; }; + + Int_t GetNclusters() const { return fNclusters; }; + Int_t GetDetector() const { return fDetector; }; + Int_t GetRow() const { return fRow; }; + Float_t GetOffset() const { return fOffset; }; + Float_t GetSlope() const { return fSlope; }; + Float_t GetTime0() const { return fTime0; }; + Float_t GetRowz() const { return fRowz; }; + Float_t GetPt() const { return fPt; }; + Float_t GetdQdl() const { return fdQdl; }; + Int_t GetLabel() const { return fTrackLabel; }; + Int_t GetNumber() const { return fN; }; Float_t GetOmegaTau(Float_t vdrift, Float_t field) const; Float_t GetClusY(Float_t *adc, Int_t pla) const; - TGraph *GetTrackletGraph() const { return fGPos; }; - TGraph *GetClusAmpGraph() const { return fGAmp; }; - Float_t *GetClusterADC(Int_t icl) { return fADC[icl]; }; - Int_t GetClusterTime(Int_t icl) const { return fTime[icl]; }; - Int_t GetClusterCol(Int_t icl) const { return fCol[icl]; }; + TGraph *GetTrackletGraph() const { return fGPos; }; + TGraph *GetClusAmpGraph() const { return fGAmp; }; + Float_t *GetClusterADC(Int_t icl) { return fADC[icl]; }; + Int_t GetClusterTime(Int_t icl) const { return fTime[icl]; }; + Int_t GetClusterCol(Int_t icl) const { return fCol[icl]; }; protected: @@ -68,19 +69,19 @@ class AliTRDmcmTracklet : public TObject { Int_t fCol[kNtimeBins]; // Array of pad column values Int_t fNclusters; // Number of clusters in the tracklet - Int_t fN; // Tracklet number + Int_t fN; // Tracklet number TGraph *fGPos; //! Positions TGraph *fGAmp; //! Amplitudes - Float_t fTime0; // X position at the entrance window - Float_t fRowz; // Z position of the row center - Float_t fSlope; // Slope [deg] - Float_t fOffset; // Offset - Float_t fPt; // Transverse momentum - Float_t fdQdl; // Charge per unit length + Float_t fTime0; // X position at the entrance window + Float_t fRowz; // Z position of the row center + Float_t fSlope; // Slope [deg] + Float_t fOffset; // Offset + Float_t fPt; // Transverse momentum + Float_t fdQdl; // Charge per unit length - ClassDef(AliTRDmcmTracklet,2) // Track segment for the TRD (Tracklet) + ClassDef(AliTRDmcmTracklet,2) // Track segment for the TRD (Tracklet) }; diff --git a/TRD/AliTRDmodule.cxx b/TRD/AliTRDmodule.cxx index d27a5764b98..f901b3d7d83 100644 --- a/TRD/AliTRDmodule.cxx +++ b/TRD/AliTRDmodule.cxx @@ -21,6 +21,10 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include + +#include "AliLog.h" + #include "AliTRDgeometry.h" #include "AliTRDmodule.h" #include "AliTRDltuTracklet.h" @@ -31,21 +35,38 @@ ClassImp(AliTRDmodule) //_____________________________________________________________________________ -AliTRDmodule::AliTRDmodule(AliTRDtrigParam *trigp) +AliTRDmodule::AliTRDmodule() + :TObject() + ,fXprojPlane(0) + ,fField(0) + ,fTracklets(NULL) + ,fTracks(NULL) + ,fDeltaY(0) + ,fDeltaS(0) + ,fLTUtrk(0) + ,fGTUtrk(0) { - // // AliTRDmodule default constructor // - fDeltaY = trigp->GetDeltaY(); - fDeltaS = trigp->GetDeltaS(); - fXprojPlane = trigp->GetXprojPlane(); - fField = trigp->GetField(); - fLTUtrk = 0; - fGTUtrk = 0; - fTracklets = new TObjArray(400); - fTracks = new TObjArray(400); +} + +//_____________________________________________________________________________ +AliTRDmodule::AliTRDmodule(AliTRDtrigParam *trigp) + :TObject() + ,fXprojPlane(trigp->GetXprojPlane()) + ,fField(trigp->GetField()) + ,fTracklets(new TObjArray(400)) + ,fTracks(new TObjArray(400)) + ,fDeltaY(trigp->GetDeltaY()) + ,fDeltaS(trigp->GetDeltaS()) + ,fLTUtrk(0) + ,fGTUtrk(0) +{ + // + // AliTRDmodule constructor + // for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { for (Int_t i = 0; i < kNsubZchan; i++) { @@ -58,11 +79,38 @@ AliTRDmodule::AliTRDmodule(AliTRDtrigParam *trigp) } +//_____________________________________________________________________________ +AliTRDmodule::AliTRDmodule(const AliTRDmodule &m) + :TObject(m) + ,fXprojPlane(m.fXprojPlane) + ,fField(m.fField) + ,fTracklets(NULL) + ,fTracks(NULL) + ,fDeltaY(m.fDeltaY) + ,fDeltaS(m.fDeltaS) + ,fLTUtrk(NULL) + ,fGTUtrk(NULL) +{ + // + // AliTRDmodule copy constructor + // + + for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { + for (Int_t i = 0; i < kNsubZchan; i++) { + ((AliTRDmodule &) m).fZnchan[iPlan][i] = 0; + for (Int_t j = 0; j < kNmaxZchan; j++) { + ((AliTRDmodule &) m).fZtrkid[iPlan][j][i] = -1; + } + } + } + +} + //_____________________________________________________________________________ AliTRDmodule::~AliTRDmodule() { // - // destructor + // Destructor // } @@ -71,7 +119,7 @@ AliTRDmodule::~AliTRDmodule() AliTRDmodule &AliTRDmodule::operator=(const AliTRDmodule &m) { // - // assignment operator + // Assignment operator // if (this != &m) ((AliTRDmodule &) m).Copy(*this); @@ -86,14 +134,14 @@ void AliTRDmodule::Copy(TObject &m) const // copy function // - ((AliTRDmodule &) m).fXprojPlane = fXprojPlane; - ((AliTRDmodule &) m).fField = fField; - ((AliTRDmodule &) m).fTracklets = NULL; - ((AliTRDmodule &) m).fTracks = NULL; - ((AliTRDmodule &) m).fDeltaY = fDeltaY; - ((AliTRDmodule &) m).fDeltaS = fDeltaS; - ((AliTRDmodule &) m).fLTUtrk = NULL; - ((AliTRDmodule &) m).fGTUtrk = NULL; + ((AliTRDmodule &) m).fXprojPlane = fXprojPlane; + ((AliTRDmodule &) m).fField = fField; + ((AliTRDmodule &) m).fTracklets = NULL; + ((AliTRDmodule &) m).fTracks = NULL; + ((AliTRDmodule &) m).fDeltaY = fDeltaY; + ((AliTRDmodule &) m).fDeltaS = fDeltaS; + ((AliTRDmodule &) m).fLTUtrk = NULL; + ((AliTRDmodule &) m).fGTUtrk = NULL; for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { for (Int_t i = 0; i < kNsubZchan; i++) { @@ -116,10 +164,10 @@ void AliTRDmodule::Reset() ResetTracklets(); ResetTracks(); - fLTUtrk = 0; - fGTUtrk = 0; - fTracklets = new TObjArray(400); - fTracks = new TObjArray(400); + fLTUtrk = 0; + fGTUtrk = 0; + fTracklets = new TObjArray(400); + fTracks = new TObjArray(400); } @@ -153,11 +201,16 @@ AliTRDgtuTrack* AliTRDmodule::GetTrack(Int_t pos) const // Return track at position "pos" // - if (fTracks == 0) return 0; - void * trk = fTracks->UncheckedAt(pos); - if (trk == 0) return 0; + if (fTracks == 0) { + return 0; + } - return (AliTRDgtuTrack*)trk; + void *trk = fTracks->UncheckedAt(pos); + if (trk == 0) { + return 0; + } + + return (AliTRDgtuTrack *) trk; } @@ -168,29 +221,25 @@ void AliTRDmodule::RemoveTrack(Int_t pos) // Remove the track at position "pos" // - if (fTracks == 0) return; + if (fTracks == 0) { + return; + } + fTracks->RemoveAt(pos); fTracks->Compress(); } //_____________________________________________________________________________ -void AliTRDmodule::AddTracklet(Int_t det, - Int_t row, - Float_t rowz, - Float_t slope, - Float_t offset, - Float_t time, - Int_t ncl, - Int_t label, - Float_t q) +void AliTRDmodule::AddTracklet(Int_t det, Int_t row, Float_t rowz, Float_t slope + , Float_t offset, Float_t time, Int_t ncl + , Int_t label, Float_t q) { // // Add a tracklet to this track // fLTUtrk = new AliTRDltuTracklet(det,row,rowz,slope,offset,time,ncl,label,q); - Tracklets()->Add(fLTUtrk); } @@ -202,11 +251,16 @@ AliTRDltuTracklet* AliTRDmodule::GetTracklet(Int_t pos) const // Get the tracklet at position "pos" // - if (fTracklets == 0) return 0; - void * trk = fTracklets->UncheckedAt(pos); - if (trk == 0) return 0; + if (fTracklets == 0) { + return 0; + } + + void *trk = fTracklets->UncheckedAt(pos); + if (trk == 0) { + return 0; + } - return (AliTRDltuTracklet*)trk; + return (AliTRDltuTracklet *) trk; } @@ -217,7 +271,10 @@ void AliTRDmodule::RemoveTracklet(Int_t pos) // Remove the tracklet at position "pos" // - if (fTracklets == 0) return; + if (fTracklets == 0) { + return; + } + fTracklets->RemoveAt(pos); fTracklets->Compress(); @@ -233,32 +290,31 @@ void AliTRDmodule::RemoveMultipleTracklets() Float_t offDiffMin = 0.5; // [cm] AliTRDltuTracklet *trk; - Int_t det1, det2, row1, row2, ncl1, ncl2, label1, label2; + Int_t det1, det2, row1, row2, ncl1, ncl2, label1, label2; Float_t off1, off2; - Int_t itrk = 0; - while (itrk < (GetNtracklets()-1)) { - - trk = GetTracklet(itrk ); - - det1 = trk->GetDetector(); - row1 = trk->GetRow(); - off1 = trk->GetOffset(); - ncl1 = trk->GetNclusters(); + Int_t itrk = 0; + while (itrk < (GetNtracklets() - 1)) { + + trk = GetTracklet(itrk); + det1 = trk->GetDetector(); + row1 = trk->GetRow(); + off1 = trk->GetOffset(); + ncl1 = trk->GetNclusters(); label1 = trk->GetLabel(); - trk = GetTracklet(itrk+1); - - det2 = trk->GetDetector(); - row2 = trk->GetRow(); - off2 = trk->GetOffset(); - ncl2 = trk->GetNclusters(); + trk = GetTracklet(itrk+1); + det2 = trk->GetDetector(); + row2 = trk->GetRow(); + off2 = trk->GetOffset(); + ncl2 = trk->GetNclusters(); label2 = trk->GetLabel(); - if (det1 == det2 && row1 == row2) { - if ((off2-off1) < offDiffMin) { + if ((det1 == det2) && (row1 == row2)) { + if ((off2 - off1) < offDiffMin) { if (ncl1 < ncl2) { RemoveTracklet(itrk ); - } else { + } + else { RemoveTracklet(itrk+1); } } @@ -281,10 +337,10 @@ void AliTRDmodule::SortZ(Int_t cha) AliTRDltuTracklet *trk; Int_t row, pla, det; + for (Int_t iTrk = 0; iTrk < GetNtracklets(); iTrk++) { trk = GetTracklet(iTrk); - row = trk->GetRow(); det = trk->GetDetector(); pla = trk->GetPlane(det); @@ -335,13 +391,13 @@ void AliTRDmodule::FindTracks() void AliTRDmodule::FindTracksCombi(Int_t zchan) { // - // find tracks by pure combinatorics... + // Find tracks by pure combinatorics... // static Int_t trkTrack[12]; - Int_t nTracklets, nPlanes; - Int_t ntrk1, trkId1, ntrk2, trkId2; + Int_t nTracklets, nPlanes; + Int_t ntrk1, trkId1, ntrk2, trkId2; Float_t y1, y1min, y1max, s1, z1, s1min, s1max, y2, s2, z2; AliTRDltuTracklet *trk1; AliTRDltuTracklet *trk2; @@ -355,7 +411,9 @@ void AliTRDmodule::FindTracksCombi(Int_t zchan) for (Int_t iTrk1 = 0; iTrk1 < ntrk1; iTrk1++) { - for (Int_t iPlan = 0; iPlan < kNplan; iPlan++) isPlane[iPlan] = kFALSE; + for (Int_t iPlan = 0; iPlan < kNplan; iPlan++) { + isPlane[iPlan] = kFALSE; + } trkId1 = fZtrkid[iPlan1][iTrk1][zchan]; @@ -363,13 +421,11 @@ void AliTRDmodule::FindTracksCombi(Int_t zchan) for (Int_t iList = 0; iList < kNmaxTrk; iList++) { trkTrack[iList] = -1; } - trkTrack[nTracklets++] = trkId1; isPlane[iPlan1] = kTRUE; - trk1 = GetTracklet(trkId1); - + trk1 = GetTracklet(trkId1); y1 = trk1->GetYproj(fXprojPlane); y1min = y1 - fDeltaY; y1max = y1 + fDeltaY; @@ -391,17 +447,17 @@ void AliTRDmodule::FindTracksCombi(Int_t zchan) if (trkId2 == trkId1) continue; trk2 = GetTracklet(trkId2); - - y2 = trk2->GetYproj(fXprojPlane); - s2 = trk2->GetSlope(); - z2 = trk2->GetZproj(fXprojPlane); + y2 = trk2->GetYproj(fXprojPlane); + s2 = trk2->GetSlope(); + z2 = trk2->GetZproj(fXprojPlane); if ((y1min < y2 && y2 < y1max) && (s1min < s2 && s2 < s1max)) { if (nTracklets >= kNmaxTrk) { - Warning("FindTracksCombi","Too many tracklets for this track."); - } else { + AliWarning("Too many tracklets for this track."); + } + else { trkTrack[nTracklets++] = trkId2; isPlane[iPlan2] = kTRUE; } @@ -414,13 +470,13 @@ void AliTRDmodule::FindTracksCombi(Int_t zchan) nPlanes = 0; for (Int_t iPlan = 0; iPlan < kNplan; iPlan++) { - nPlanes += (Int_t)isPlane[iPlan]; + nPlanes += (Int_t) isPlane[iPlan]; } if (nPlanes >= 4) { Int_t cha1, cha2, npoints1, npoints2; - for (Int_t iList = 0; iList < (nTracklets-1); iList++) { + for (Int_t iList = 0; iList < (nTracklets - 1); iList++) { if (trkTrack[iList] == -1 || trkTrack[iList+1] == -1) continue; trk1 = GetTracklet(trkTrack[iList ]); @@ -435,7 +491,8 @@ void AliTRDmodule::FindTracksCombi(Int_t zchan) if (npoints1 == npoints2) { trkTrack[iList] = -1; - } else { + } + else { if (npoints1 > npoints2) trkTrack[iList+1] = -1; if (npoints1 < npoints2) trkTrack[iList ] = -1; } @@ -450,6 +507,7 @@ void AliTRDmodule::FindTracksCombi(Int_t zchan) } fGTUtrk->Track(fXprojPlane,fField); AddTrack(); + } } // end trk 1 @@ -480,13 +538,13 @@ void AliTRDmodule::RemoveMultipleTracks() AliTRDgtuTrack *trk2; Float_t yproj1, yproj2, alpha1, alpha2; - Int_t ntrk1, ntrk2; - Int_t iTrack = 0; + Int_t ntrk1, ntrk2; + Int_t iTrack = 0; while (iTrack < (GetNtracks()-1)) { - trk1 = GetTrack(iTrack ); - trk2 = GetTrack(iTrack+1); + trk1 = GetTrack(iTrack ); + trk2 = GetTrack(iTrack+1); ntrk1 = trk1->GetNtracklets(); yproj1 = trk1->GetYproj(); @@ -495,13 +553,16 @@ void AliTRDmodule::RemoveMultipleTracks() yproj2 = trk2->GetYproj(); alpha2 = trk2->GetSlope(); - if (TMath::Abs(yproj1-yproj2) < fDeltaY && TMath::Abs(alpha1-alpha2) < fDeltaS) { + if ((TMath::Abs(yproj1-yproj2) < fDeltaY) && + (TMath::Abs(alpha1-alpha2) < fDeltaS)) { if (ntrk1 < ntrk2) { RemoveTrack(iTrack ); - } else { + } + else { RemoveTrack(iTrack+1); } - } else { + } + else { iTrack++; } @@ -509,3 +570,101 @@ void AliTRDmodule::RemoveMultipleTracks() } +//_____________________________________________________________________________ +TObjArray* AliTRDmodule::Tracklets() +{ + // + // Returns the list of tracklets + // + + if (!fTracklets) { + fTracklets = new TObjArray(400); + } + + return fTracklets; + +} + +//_____________________________________________________________________________ +void AliTRDmodule::ResetTracklets() +{ + // + // Resets the list of tracklets + // + + if (fTracklets) { + fTracklets->Delete(); + } + +} + +//_____________________________________________________________________________ +void AliTRDmodule::SortTracklets() +{ + // + // Sorts the list of tracklets + // + + if (fTracklets) { + fTracklets->Sort(); + } + +} + +//_____________________________________________________________________________ +Int_t AliTRDmodule::GetNtracklets() const +{ + // + // Returns the number of tracklets + // + + if (fTracklets) { + return fTracklets->GetEntriesFast(); + } + + return 0; + +} + +//_____________________________________________________________________________ +TObjArray* AliTRDmodule::Tracks() +{ + // + // Returns the list of tracks + // + + if (!fTracks) { + fTracks = new TObjArray(400); + } + + return fTracks; + +} + +//_____________________________________________________________________________ +void AliTRDmodule::SortTracks() +{ + // + // Sort the list of tracks + // + + if (fTracks) { + fTracks->Sort(); + } + +} + +//_____________________________________________________________________________ +Int_t AliTRDmodule::GetNtracks() const +{ + // + // Returns the number of tracks + // + + if (fTracks) { + return fTracks->GetEntriesFast(); + } + + return 0; + +} diff --git a/TRD/AliTRDmodule.h b/TRD/AliTRDmodule.h index 0a3bf535b37..17ae3dacfc6 100644 --- a/TRD/AliTRDmodule.h +++ b/TRD/AliTRDmodule.h @@ -1,7 +1,17 @@ #ifndef ALITRDMODULE_H #define ALITRDMODULE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ -#include +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD module class // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include class AliTRDgtuTrack; class AliTRDltuTracklet; @@ -13,75 +23,57 @@ class AliTRDmodule : public TObject { enum { kNplan = 6, kNmaxZchan = 100, kNsubZchan = 16, kNmaxTrk = 12 }; + AliTRDmodule(); + AliTRDmodule(const AliTRDmodule &m); AliTRDmodule(AliTRDtrigParam *trigp); - virtual ~AliTRDmodule(); - AliTRDmodule &operator=(const AliTRDmodule &m); - virtual void Copy(TObject &m) const; - - void Reset(); - - void AddTracklet(Int_t det, - Int_t row, - Float_t rowz, - Float_t slope, - Float_t offset, - Float_t time, - Int_t ncl, - Int_t label, - Float_t q); - - TObjArray *Tracklets() { - if(!fTracklets) fTracklets = new TObjArray(400); return fTracklets; - }; - - void ResetTracklets() { if(fTracklets) fTracklets->Delete(); }; - void SortTracklets() { if(fTracklets) fTracklets->Sort(); }; - AliTRDltuTracklet *GetTracklet(Int_t pos) const; - void RemoveMultipleTracklets(); - void RemoveTracklet(Int_t pos); - Int_t GetNtracklets() const { - if (fTracklets) return fTracklets->GetEntriesFast(); - return 0; - }; - void AddTrack(); - TObjArray *Tracks() { - if(!fTracks) fTracks = new TObjArray(400); return fTracks; - }; - - void ResetTracks(); - void SortTracks() { if(fTracks) fTracks->Sort(); }; - AliTRDgtuTrack *GetTrack(Int_t pos) const; - void RemoveMultipleTracks(); - void RemoveTrack(Int_t pos); - Int_t GetNtracks() const { - if (fTracks) return fTracks->GetEntriesFast(); - return 0; - }; - void SortZ(Int_t cha); - void InitZLUT(); - void FindTracks(); - void FindTracksCombi(Int_t zchan); + virtual ~AliTRDmodule(); + AliTRDmodule &operator=(const AliTRDmodule &m); + + virtual void Copy(TObject &m) const; + + Int_t GetNtracklets() const; + Int_t GetNtracks() const; + + void Reset(); + void AddTracklet(Int_t det, Int_t row, Float_t rowz, Float_t slope, Float_t offset + , Float_t time, Int_t ncl, Int_t label, Float_t q); + void AddTrack(); + + void ResetTracklets(); + void ResetTracks(); + void SortTracklets(); + void SortTracks(); + void RemoveMultipleTracklets(); + void RemoveMultipleTracks(); + void RemoveTracklet(Int_t pos); + void RemoveTrack(Int_t pos); + void SortZ(Int_t cha); + void InitZLUT(); + void FindTracks(); + void FindTracksCombi(Int_t zchan); + + TObjArray *Tracklets(); + TObjArray *Tracks(); + AliTRDltuTracklet *GetTracklet(Int_t pos) const; + AliTRDgtuTrack *GetTrack(Int_t pos) const; protected: - Float_t fXprojPlane; //! X (time) coordinate of the - // projection plane - Float_t fField; //! Magnetic field - TObjArray *fTracklets; //! Array of LTU tracklets - TObjArray *fTracks; //! Array of GTU tracks + Float_t fXprojPlane; //! X (time) coordinate of the projection plane + Float_t fField; //! Magnetic field + TObjArray *fTracklets; //! Array of LTU tracklets + TObjArray *fTracks; //! Array of GTU tracks - Int_t fZnchan[kNplan][kNsubZchan]; //! number of LTU tracklets in each - // subchannel - Int_t fZtrkid[kNplan][kNmaxZchan][kNsubZchan]; //! list of LTU tracklet id's for - // each subchannel + Int_t fZnchan[kNplan][kNsubZchan]; //! Number of LTU tracklets in each subchannel + Int_t fZtrkid[kNplan][kNmaxZchan][kNsubZchan]; //! List of LTU tracklet id's for each subchannel - Float_t fDeltaY; // Y (offset) matching window in the GTU - Float_t fDeltaS; // Slope matching window in the GTU + Float_t fDeltaY; // Y (offset) matching window in the GTU + Float_t fDeltaS; // Slope matching window in the GTU - AliTRDltuTracklet *fLTUtrk; //! Current LTU tracklet - AliTRDgtuTrack *fGTUtrk; //! Current GTU track + AliTRDltuTracklet *fLTUtrk; //! Current LTU tracklet + AliTRDgtuTrack *fGTUtrk; //! Current GTU track - ClassDef(AliTRDmodule,2) + ClassDef(AliTRDmodule,2) // TRD module class }; diff --git a/TRD/AliTRDrecPoint.cxx b/TRD/AliTRDrecPoint.cxx index f9d367999ae..1e8e95cb2d9 100644 --- a/TRD/AliTRDrecPoint.cxx +++ b/TRD/AliTRDrecPoint.cxx @@ -29,27 +29,45 @@ ClassImp(AliTRDrecPoint) //_____________________________________________________________________________ -AliTRDrecPoint::AliTRDrecPoint():AliRecPoint() +AliTRDrecPoint::AliTRDrecPoint() + :AliRecPoint() + ,fDetector(0) + ,fTimeBin(0) + ,fUsed(0) + ,fY(0) + ,fZ(0) + ,fSigmaY2(0) + ,fSigmaZ2(0) { // - // Standard constructor + // Default constructor // - fDetector = 0; - + for (Int_t i = 0; i < 3; i++) { + fTracks[i] = 0; + } fGeom = AliTRDgeometry::GetGeometry(); } //_____________________________________________________________________________ -AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt) +AliTRDrecPoint::AliTRDrecPoint(const char * opt) + :AliRecPoint(opt) + ,fDetector(0) + ,fTimeBin(0) + ,fUsed(0) + ,fY(0) + ,fZ(0) + ,fSigmaY2(0) + ,fSigmaZ2(0) { // // Standard constructor // - fDetector = 0; - + for (Int_t i = 0; i < 3; i++) { + fTracks[i] = 0; + } fGeom = AliTRDgeometry::GetGeometry(); } @@ -72,7 +90,8 @@ void AliTRDrecPoint::AddDigit(Int_t digit) // First resize the list // (no clusters with more than 3 digits for the TRD - if ((fMulDigit == 0) && (fMaxDigit >= 5)) { + if ((fMulDigit == 0) && + (fMaxDigit >= 5)) { fMaxDigit = 5; delete fDigitsList; fDigitsList = new int[fMaxDigit]; @@ -82,9 +101,10 @@ void AliTRDrecPoint::AddDigit(Int_t digit) if (fMulDigit >= fMaxDigit) { fMaxDigit *= 2; Int_t *tempo = new Int_t[fMaxDigit]; - Int_t index; - for (index = 0; index < fMulDigit; index++) + Int_t index; + for (index = 0; index < fMulDigit; index++) { tempo[index] = fDigitsList[index]; + } delete fDigitsList; fDigitsList = tempo; } @@ -102,131 +122,92 @@ void AliTRDrecPoint::SetLocalPosition(TVector3 & /*pos*/) // system. // - //const Float_t kSq12 = 3.464101615; - - // Set the position - //fLocPos = pos; - - // Set the error matrix - // row: pad-size / sqrt(12) - // col: not defined yet - // time: bin-size / sqrt(12) - //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector); - //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector); - //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector); - //fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane - // ,chamber - // ,sector) - // / kSq12; - //fLocPosM->operator()(1,1) = 0.0; - //fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize() - // / kSq12; - - // printf("rec. point: row = %f, col = %f, time = %f \n", - // fLocPos[0],fLocPos[1],fLocPos[2]); + AliFatal("Not implemented"); } //_____________________________________________________________________________ void AliTRDrecPoint::SetTrackingYZ(Float_t /*sigmaY*/, Float_t /*sigmaZ*/) { - // - // Sets the position of the point in the local coordinate system - // of tracking sector - // - - //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector); - //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector); - //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector); - - - // Set the position - - //Float_t padRow = fLocPos[0]; // Pad Row position - //Float_t padCol = fLocPos[1]; // Pad Column position - - //Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane); - //Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector); - - // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane); - - //fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane)); - //fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane - // ,chamber - // ,sector); - - // fSigmaY = sigmaY * sigmaY; - // fSigmaZ = sigmaZ * sigmaZ; - -//fSigmaY2 = 0.05 * 0.05; - -//fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector) -// * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector) -// / 12.; + // + // Sets the position of the point in the local coordinate system + // of tracking sector + // + + AliFatal("Not implemented"); } //_____________________________________________________________________________ void AliTRDrecPoint::AddTrackIndex(Int_t *track) { - // Adds track index. Currently assumed that track is an array of - // size 9, and up to 3 track indexes are stored in fTracks[3]. - // Indexes are sorted according to: - // 1) index of max number of appearances is stored first - // 2) if two or more indexes appear equal number of times, the lowest - // ones are stored first; + // + // Adds track index. Currently assumed that track is an array of + // size 9, and up to 3 track indexes are stored in fTracks[3]. + // Indexes are sorted according to: + // 1) index of max number of appearances is stored first + // 2) if two or more indexes appear equal number of times, the lowest + // ones are stored first; + // const Int_t kSize = 9; + Int_t entries[kSize][2]; - Int_t entries[kSize][2], i, j, index; + Int_t i = 0; + Int_t j = 0; + Int_t k = 0; + Int_t index; Bool_t indexAdded; - for (i=0; i= 0) { - while ( (!indexAdded) && ( j < kSize ) ) { - if ((entries[j][0]==index) || (entries[j][1]==0)) { - entries[j][0]=index; - entries[j][1]=entries[j][1]+1; - indexAdded=kTRUE; + while ((!indexAdded) && (j < kSize)) { + if ((entries[j][0] == index) || + (entries[j][1] == 0)) { + entries[j][0] = index; + entries[j][1] = entries[j][1]+1; + indexAdded = kTRUE; } j++; } } - } - - // sort by number of appearances and index value - Int_t swap=1, tmp0, tmp1; - while ( swap > 0) { - swap=0; - for(i=0; i<(kSize-1); i++) { - if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { + } + + // Sort by number of appearances and index value + Int_t swap = 1; + Int_t tmp0; + Int_t tmp1; + while (swap > 0) { + swap = 0; + for (i = 0; i < (kSize - 1); i++) { + if ((entries[i][0] >= 0) && + (entries[i+1][0] >= 0)) { if ((entries[i][1] < entries[i+1][1]) || ((entries[i][1] == entries[i+1][1]) && - (entries[i][0] > entries[i+1][0]))) { - tmp0=entries[i][0]; - tmp1=entries[i][1]; - entries[i][0]=entries[i+1][0]; - entries[i][1]=entries[i+1][1]; - entries[i+1][0]=tmp0; - entries[i+1][1]=tmp1; + (entries[i][0] > entries[i+1][0]))) { + tmp0 = entries[i][0]; + tmp1 = entries[i][1]; + entries[i][0] = entries[i+1][0]; + entries[i][1] = entries[i+1][1]; + entries[i+1][0] = tmp0; + entries[i+1][1] = tmp1; swap++; } } } } - // set track indexes - - for(i=0; i<3; i++) { + // Set track indexes + for(i = 0; i < 3; i++) { fTracks[i] = entries[i][0]; } diff --git a/TRD/AliTRDrecPoint.h b/TRD/AliTRDrecPoint.h index 9e096f9bfd5..a6aff31101f 100644 --- a/TRD/AliTRDrecPoint.h +++ b/TRD/AliTRDrecPoint.h @@ -19,53 +19,52 @@ class AliTRDrecPoint : public AliRecPoint { AliTRDrecPoint(); AliTRDrecPoint(const char * opt); - virtual ~AliTRDrecPoint(); - - virtual void Print(Option_t* ) const {}; - virtual void AddDigit(Int_t digit); - virtual void AddDigit(AliDigitNew& ) {}; - - virtual void SetEnergy(Float_t amp) { fAmp = amp; }; - virtual void SetDetector(Int_t det) { fDetector = det; }; - virtual void SetLocalPosition(TVector3 &pos); - virtual void SetLocalRow(Float_t r) { fLocPos.SetX(r); }; - virtual void SetLocalCol(Float_t c) { fLocPos.SetY(c); }; - virtual void SetLocalTime(Float_t t) { fLocPos.SetZ(t); }; - - virtual void SetLocalTimeBin(Int_t tb) { fTimeBin = tb; } - virtual void SetTrackingYZ(Float_t fSigmaY = 0.0, Float_t fSigmaZ = 0.0); - - virtual Int_t GetDetector() const { return fDetector; }; - virtual Int_t GetDigit(Int_t i = 0) const { if (i < fMulDigit) - return fDigitsList[i]; - else - return -1;}; - virtual Float_t GetLocalRow() const { return fLocPos(0); }; - virtual Float_t GetLocalCol() const { return fLocPos(1); }; - virtual Float_t GetLocalTime() const { return fLocPos(2); }; - - virtual Int_t GetLocalTimeBin() const { return Int_t(fLocPos(2)); } - virtual Float_t GetSigmaY2() const { return fSigmaY2; } - virtual Float_t GetSigmaZ2() const { return fSigmaZ2; } - virtual Float_t GetY() const { return fY; } - virtual Float_t GetZ() const { return fZ; } - Int_t IsUsed() const { return fUsed; } - void Use() { fUsed++; } - Int_t GetTrackIndex(Int_t i) const { return fTracks[i]; } - void AddTrackIndex(Int_t *i); + virtual ~AliTRDrecPoint(); + + virtual void Print(Option_t* ) const {}; + virtual void AddDigit(Int_t digit); + virtual void AddDigit(AliDigitNew& ) {}; + + void SetEnergy(Float_t amp) { fAmp = amp; } + void SetDetector(Int_t det) { fDetector = det; } + void SetLocalPosition(TVector3 &pos); + void SetLocalRow(Float_t r) { fLocPos.SetX(r); } + void SetLocalCol(Float_t c) { fLocPos.SetY(c); } + void SetLocalTime(Float_t t) { fLocPos.SetZ(t); } + + void SetLocalTimeBin(Int_t tb) { fTimeBin = tb; } + void SetTrackingYZ(Float_t fSigmaY = 0.0, Float_t fSigmaZ = 0.0); + + Int_t GetDetector() const { return fDetector; } + Int_t GetDigit(Int_t i = 0) const { if (i < fMulDigit) return fDigitsList[i]; + else return -1; } + Float_t GetLocalRow() const { return fLocPos(0); } + Float_t GetLocalCol() const { return fLocPos(1); } + Float_t GetLocalTime() const { return fLocPos(2); } + + Int_t GetLocalTimeBin() const { return Int_t(fLocPos(2)); } + Float_t GetSigmaY2() const { return fSigmaY2; } + Float_t GetSigmaZ2() const { return fSigmaZ2; } + Float_t GetY() const { return fY; } + Float_t GetZ() const { return fZ; } + + Int_t IsUsed() const { return fUsed; } + void Use() { fUsed++; } + Int_t GetTrackIndex(Int_t i) const { return fTracks[i]; } + void AddTrackIndex(Int_t *i); protected: - Int_t fDetector; // TRD detector number - Int_t fTimeBin; // Time bin number within the detector - Int_t fUsed; // 0 initially and incremented if the point is "used" - Int_t fTracks[3]; // labels of overlapped tracks - Float_t fY; // local Rphi coordinate (cm) within tracking sector - Float_t fZ; // local Z coordinate (cm) within tracking sector - Float_t fSigmaY2; // Y variance (cm) - Float_t fSigmaZ2; // Z variance (cm) + Int_t fDetector; // TRD detector number + Int_t fTimeBin; // Time bin number within the detector + Int_t fUsed; // 0 initially and incremented if the point is "used" + Int_t fTracks[3]; // Labels of overlapped tracks + Float_t fY; // Local Rphi coordinate (cm) within tracking sector + Float_t fZ; // Local Z coordinate (cm) within tracking sector + Float_t fSigmaY2; // Y variance (cm) + Float_t fSigmaZ2; // Z variance (cm) - ClassDef(AliTRDrecPoint,1) // Reconstructed point for the TRD + ClassDef(AliTRDrecPoint,1) // Reconstructed point for the TRD }; diff --git a/TRD/AliTRDtrigParam.cxx b/TRD/AliTRDtrigParam.cxx index 8fa80e15c90..3fd55530efc 100644 --- a/TRD/AliTRDtrigParam.cxx +++ b/TRD/AliTRDtrigParam.cxx @@ -18,6 +18,8 @@ // // // TRD trigger parameters class // // // +// Author: // +// Bogdan Vulpescu // // // /////////////////////////////////////////////////////////////////////////////// @@ -28,105 +30,128 @@ ClassImp(AliTRDtrigParam) //_____________________________________________________________________________ -AliTRDtrigParam::AliTRDtrigParam():TNamed() +AliTRDtrigParam::AliTRDtrigParam() + :TNamed() + ,fDebug(0) + ,fTime1(0) + ,fTime2(0) + ,fClusThr(0) + ,fPadThr(0) + ,fSum10(0) + ,fSum12(0) + ,fTCOn(0) + ,fTCnexp(0) + ,fFilterType(0) + ,fR1(0) + ,fR2(0) + ,fC1(0) + ,fC2(0) + ,fPedestal(0) + ,fADCnoise(0) + ,fDeltaY(0) + ,fDeltaS(0) + ,fXprojPlane(0) + ,fLtuPtCut(0) + ,fGtuPtCut(0) + ,fField(0) + ,fHighPt(0) + ,fNPartJetLow(0) + ,fNPartJetHigh(0) + ,fJetLowPt(0) + ,fJetHighPt(0) { // // AliTRDtrigParam default constructor // - fDebug = 0; - fTime1 = 0; - fTime2 = 0; - fClusThr = 0; - fPadThr = 0; - fSum10 = 0; - fSum12 = 0; - fTCOn = 0; - fTCnexp = 0; - fFilterType = 0; - fR1 = 0; - fR2 = 0; - fC1 = 0; - fC2 = 0; - fPedestal = 0; - fDeltaY = 0.0; - fDeltaS = 0.0; - fXprojPlane = 0.0; - fField = 0.0; - fLtuPtCut = 0.0; - fGtuPtCut = 0.0; - fHighPt = 0.0; - - fNPartJetLow = 0; - fNPartJetHigh = 0; - fJetLowPt = 0.0; - fJetHighPt = 0.0; - } //_____________________________________________________________________________ AliTRDtrigParam::AliTRDtrigParam(const Text_t *name, const Text_t *title) - :TNamed(name,title) + :TNamed(name,title) + ,fDebug(0) + ,fTime1(2) + ,fTime2(22) + ,fClusThr(10.0) + ,fPadThr(1) + ,fSum10(2) + ,fSum12(10) + ,fTCOn(1) + ,fTCnexp(1) + ,fFilterType(0) + ,fR1(0) + ,fR2(0) + ,fC1(0) + ,fC2(0) + ,fPedestal(0) + ,fADCnoise(0) + ,fDeltaY(2.0) + ,fDeltaS(2.5) + ,fXprojPlane(0) + ,fLtuPtCut(2.3) + ,fGtuPtCut(3.0) + ,fField(0) + ,fHighPt(10.0) + ,fNPartJetLow(5) + ,fNPartJetHigh(3) + ,fJetLowPt(3.0) + ,fJetHighPt(5.0) { // // AliTRDtrigParam constructor // - fDebug = 0; - fTime1 = 2; - fTime2 = 22; - fClusThr = 10.0; - fPadThr = 1; - fSum10 = 2; - fSum12 = 10; - fTCOn = 1; - fTCnexp = 1; - fFilterType = 0; - fR1 = 0.0; - fR2 = 0.0; - fC1 = 0.0; - fC2 = 0.0; - fPedestal = 0.0; - fDeltaY = 2.0; - fDeltaS = 2.5; - fXprojPlane = 0.0; - fField = 0.0; - fLtuPtCut = 2.3; - fGtuPtCut = 3.0; - fHighPt = 10.0; - - fNPartJetLow = 5; - fNPartJetHigh = 3; - fJetLowPt = 3.0; - fJetHighPt = 5.0; - // PASA.v.4 - - if (fTCnexp == 1) { - fR1 = 1.1563; - fR2 = 0.1299; - fC1 = 0.0657; - fC2 = 0.0000; + if (fTCnexp == 1) { + fR1 = 1.1563; + fR2 = 0.1299; + fC1 = 0.0657; + fC2 = 0.0000; } - - if (fTCnexp == 2) { - fR1 = 1.1563; - fR2 = 0.1299; - fC1 = 0.1141; - fC2 = 0.6241; + else if (fTCnexp == 2) { + fR1 = 1.1563; + fR2 = 0.1299; + fC1 = 0.1141; + fC2 = 0.6241; } } //_____________________________________________________________________________ -AliTRDtrigParam::AliTRDtrigParam(const AliTRDtrigParam &p):TNamed(p) +AliTRDtrigParam::AliTRDtrigParam(const AliTRDtrigParam &p) + :TNamed(p) + ,fDebug(p.fDebug) + ,fTime1(p.fTime1) + ,fTime2(p.fTime2) + ,fClusThr(p.fClusThr) + ,fPadThr(p.fPadThr) + ,fSum10(p.fSum10) + ,fSum12(p.fSum12) + ,fTCOn(p.fTCOn) + ,fTCnexp(p.fTCnexp) + ,fFilterType(p.fFilterType) + ,fR1(p.fR1) + ,fR2(p.fR2) + ,fC1(p.fC1) + ,fC2(p.fC2) + ,fPedestal(p.fPedestal) + ,fADCnoise(p.fADCnoise) + ,fDeltaY(p.fDeltaY) + ,fDeltaS(p.fDeltaS) + ,fXprojPlane(p.fXprojPlane) + ,fLtuPtCut(p.fLtuPtCut) + ,fGtuPtCut(p.fGtuPtCut) + ,fField(p.fField) + ,fHighPt(p.fHighPt) + ,fNPartJetLow(p.fNPartJetLow) + ,fNPartJetHigh(p.fNPartJetHigh) + ,fJetLowPt(p.fJetLowPt) + ,fJetHighPt(p.fJetHighPt) { // // AliTRDtrigParam copy constructor // - ((AliTRDtrigParam &) p).Copy(*this); - } //_____________________________________________________________________________ @@ -135,6 +160,7 @@ AliTRDtrigParam::~AliTRDtrigParam() // // AliTRDtrigParam destructor // + } //_____________________________________________________________________________ @@ -156,29 +182,29 @@ void AliTRDtrigParam::Copy(TObject &p) const // Copy function // - ((AliTRDtrigParam &) p).fDebug = fDebug; - ((AliTRDtrigParam &) p).fTime1 = fTime1; - ((AliTRDtrigParam &) p).fTime2 = fTime2; - ((AliTRDtrigParam &) p).fClusThr = fClusThr; - ((AliTRDtrigParam &) p).fPadThr = fPadThr; - ((AliTRDtrigParam &) p).fSum10 = fSum10; - ((AliTRDtrigParam &) p).fSum12 = fSum12; - ((AliTRDtrigParam &) p).fTCOn = fTCOn; - ((AliTRDtrigParam &) p).fTCnexp = fTCnexp; - ((AliTRDtrigParam &) p).fFilterType = fFilterType; - ((AliTRDtrigParam &) p).fR1 = fR1; - ((AliTRDtrigParam &) p).fR2 = fR2; - ((AliTRDtrigParam &) p).fC1 = fC1; - ((AliTRDtrigParam &) p).fC2 = fC2; - ((AliTRDtrigParam &) p).fPedestal = fPedestal; - ((AliTRDtrigParam &) p).fADCnoise = fADCnoise; - ((AliTRDtrigParam &) p).fDeltaY = fDeltaY; - ((AliTRDtrigParam &) p).fDeltaS = fDeltaS; - ((AliTRDtrigParam &) p).fXprojPlane = fXprojPlane; - ((AliTRDtrigParam &) p).fField = fField; - ((AliTRDtrigParam &) p).fLtuPtCut = fLtuPtCut; - ((AliTRDtrigParam &) p).fGtuPtCut = fGtuPtCut; - ((AliTRDtrigParam &) p).fHighPt = fHighPt; + ((AliTRDtrigParam &) p).fDebug = fDebug; + ((AliTRDtrigParam &) p).fTime1 = fTime1; + ((AliTRDtrigParam &) p).fTime2 = fTime2; + ((AliTRDtrigParam &) p).fClusThr = fClusThr; + ((AliTRDtrigParam &) p).fPadThr = fPadThr; + ((AliTRDtrigParam &) p).fSum10 = fSum10; + ((AliTRDtrigParam &) p).fSum12 = fSum12; + ((AliTRDtrigParam &) p).fTCOn = fTCOn; + ((AliTRDtrigParam &) p).fTCnexp = fTCnexp; + ((AliTRDtrigParam &) p).fFilterType = fFilterType; + ((AliTRDtrigParam &) p).fR1 = fR1; + ((AliTRDtrigParam &) p).fR2 = fR2; + ((AliTRDtrigParam &) p).fC1 = fC1; + ((AliTRDtrigParam &) p).fC2 = fC2; + ((AliTRDtrigParam &) p).fPedestal = fPedestal; + ((AliTRDtrigParam &) p).fADCnoise = fADCnoise; + ((AliTRDtrigParam &) p).fDeltaY = fDeltaY; + ((AliTRDtrigParam &) p).fDeltaS = fDeltaS; + ((AliTRDtrigParam &) p).fXprojPlane = fXprojPlane; + ((AliTRDtrigParam &) p).fField = fField; + ((AliTRDtrigParam &) p).fLtuPtCut = fLtuPtCut; + ((AliTRDtrigParam &) p).fGtuPtCut = fGtuPtCut; + ((AliTRDtrigParam &) p).fHighPt = fHighPt; ((AliTRDtrigParam &) p).fNPartJetLow = fNPartJetLow; ((AliTRDtrigParam &) p).fNPartJetHigh = fNPartJetHigh; ((AliTRDtrigParam &) p).fJetLowPt = fJetLowPt; @@ -193,13 +219,16 @@ void AliTRDtrigParam::Init() // Initialize the other parameters // - Float_t fXplane0, fXplane5; - - fXplane0 = AliTRDgeometry::GetTime0(0) - AliTRDgeometry::CdrHght() - 0.5*AliTRDgeometry::CamHght(); - - fXplane5 = AliTRDgeometry::GetTime0(5) - AliTRDgeometry::CdrHght() - 0.5*AliTRDgeometry::CamHght(); - - fXprojPlane = 0.5 * (fXplane0 + fXplane5); + Float_t xPlane0; + Float_t xPlane5; + + xPlane0 = AliTRDgeometry::GetTime0(0) + - AliTRDgeometry::CdrHght() + - 0.5*AliTRDgeometry::CamHght(); + xPlane5 = AliTRDgeometry::GetTime0(5) + - AliTRDgeometry::CdrHght() + - 0.5*AliTRDgeometry::CamHght(); + fXprojPlane = 0.5 * (xPlane0 + xPlane5); } diff --git a/TRD/AliTRDtrigParam.h b/TRD/AliTRDtrigParam.h index 79063442841..97b8b095153 100644 --- a/TRD/AliTRDtrigParam.h +++ b/TRD/AliTRDtrigParam.h @@ -18,110 +18,110 @@ class AliTRDtrigParam : public TNamed { AliTRDtrigParam(); AliTRDtrigParam(const Text_t* name, const Text_t* title); AliTRDtrigParam(const AliTRDtrigParam &p); - virtual ~AliTRDtrigParam(); + virtual ~AliTRDtrigParam(); AliTRDtrigParam &operator=(const AliTRDtrigParam &p); - virtual void Copy(TObject &p) const; - - void Init(); - - void SetTimeRange(Int_t time1, Int_t time2) { fTime1 = time1; fTime2 = time2; }; - Int_t GetTime1() const { return fTime1; }; - Int_t GetTime2() const { return fTime2; }; - void SetClusThr(Float_t clth) { fClusThr = clth; }; - void SetPadThr(Float_t path) { fPadThr = path; }; - Float_t GetClusThr() const { return fClusThr; }; - Float_t GetPadThr() const { return fPadThr; }; - void SetSum10(Int_t sum) { fSum10 = sum; }; - void SetSum12(Int_t sum) { fSum12 = sum; }; - Int_t GetSum10() const { return fSum10; }; - Int_t GetSum12() const { return fSum12; }; - - void SetTailCancelation(Int_t tcOn = 0) { fTCOn = tcOn; }; - void SetNexponential(Int_t nexp = 1) { fTCnexp = nexp; }; - void SetFilterType(Int_t ftype = 0) { fFilterType = ftype; }; - void SetFilterParam(Float_t r1, Float_t r2, Float_t c1, Float_t c2, Float_t ped) - { fR1 = r1; fR2 = r2; fC1 = c1; fC2 = c2; fPedestal = ped; }; - - Int_t GetTailCancelation() const { return fTCOn; }; - Int_t GetNexponential() const { return fTCnexp; }; - Int_t GetFilterType() const { return fFilterType; }; - void GetFilterParam(Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped) const { r1 = fR1; r2 = fR2; c1 = fC1; c2 = fC2; ped = fPedestal; }; - - void SetADCnoise(Float_t adcn) { fADCnoise = adcn; }; - Float_t GetADCnoise() const { return fADCnoise; }; - - void SetDebugLevel(Int_t deb) { fDebug = deb; }; - Int_t GetDebugLevel() const { return fDebug; }; - void SetDeltaY(Float_t dy) { fDeltaY = dy; }; - Float_t GetDeltaY() const { return fDeltaY; }; - void SetDeltaS(Float_t ds) { fDeltaS = ds; }; - Float_t GetDeltaS() const { return fDeltaS; }; - - Float_t GetXprojPlane() const { return fXprojPlane; }; - - void SetField(Float_t b) { fField = b; }; - Float_t GetField() const { return fField; }; - - void SetLtuPtCut(Float_t ptcut) { fLtuPtCut = ptcut; }; - Float_t GetLtuPtCut() const { return fLtuPtCut; }; - - void SetGtuPtCut(Float_t ptcut) { fGtuPtCut = ptcut; }; - Float_t GetGtuPtCut() const { return fGtuPtCut; }; - - void SetHighPt(Float_t hpt) { fHighPt = hpt; }; - Float_t GetHighPt() const { return fHighPt; }; - - void SetNPartJetLow(Int_t npj) { fNPartJetLow = npj; }; - Int_t GetNPartJetLow() const { return fNPartJetLow; }; - void SetNPartJetHigh(Int_t npj) { fNPartJetHigh = npj; }; - Int_t GetNPartJetHigh() const { return fNPartJetHigh; }; + virtual void Copy(TObject &p) const; - void SetJetLowPt(Float_t thr) { fJetLowPt = thr; }; - Float_t GetJetLowPt() const { return fJetLowPt; }; - void SetJetHighPt(Float_t thr) { fJetHighPt = thr; }; - Float_t GetJetHighPt() const { return fJetHighPt; }; + void Init(); + + Int_t GetTime1() const { return fTime1; }; + Int_t GetTime2() const { return fTime2; }; + Float_t GetClusThr() const { return fClusThr; }; + Float_t GetPadThr() const { return fPadThr; }; + Int_t GetSum10() const { return fSum10; }; + Int_t GetSum12() const { return fSum12; }; + Int_t GetTailCancelation() const { return fTCOn; }; + Int_t GetNexponential() const { return fTCnexp; }; + Int_t GetFilterType() const { return fFilterType; }; + void GetFilterParam(Float_t &r1, Float_t &r2, Float_t &c1, Float_t &c2, Float_t &ped) const + { r1 = fR1; + r2 = fR2; + c1 = fC1; + c2 = fC2; + ped = fPedestal; }; + Float_t GetADCnoise() const { return fADCnoise; }; + Int_t GetDebugLevel() const { return fDebug; }; + Float_t GetDeltaY() const { return fDeltaY; }; + Float_t GetDeltaS() const { return fDeltaS; }; + Float_t GetXprojPlane() const { return fXprojPlane; }; + Float_t GetField() const { return fField; }; + Float_t GetLtuPtCut() const { return fLtuPtCut; }; + Float_t GetGtuPtCut() const { return fGtuPtCut; }; + Float_t GetHighPt() const { return fHighPt; }; + Int_t GetNPartJetLow() const { return fNPartJetLow; }; + Int_t GetNPartJetHigh() const { return fNPartJetHigh; }; + Float_t GetJetLowPt() const { return fJetLowPt; }; + Float_t GetJetHighPt() const { return fJetHighPt; }; + + void SetTimeRange(Int_t time1, Int_t time2) { fTime1 = time1; + fTime2 = time2; }; + void SetClusThr(Float_t clth) { fClusThr = clth; }; + void SetPadThr(Float_t path) { fPadThr = path; }; + void SetSum10(Int_t sum) { fSum10 = sum; }; + void SetSum12(Int_t sum) { fSum12 = sum; }; + void SetTailCancelation(Int_t tcOn = 0) { fTCOn = tcOn; }; + void SetNexponential(Int_t nexp = 1) { fTCnexp = nexp; }; + void SetFilterType(Int_t ftype = 0) { fFilterType = ftype; }; + void SetFilterParam(Float_t r1, Float_t r2, Float_t c1, Float_t c2, Float_t ped) + { fR1 = r1; + fR2 = r2; + fC1 = c1; + fC2 = c2; + fPedestal = ped; }; + void SetADCnoise(Float_t adcn) { fADCnoise = adcn; }; + void SetDebugLevel(Int_t deb) { fDebug = deb; }; + void SetDeltaY(Float_t dy) { fDeltaY = dy; }; + void SetDeltaS(Float_t ds) { fDeltaS = ds; }; + void SetField(Float_t b) { fField = b; }; + void SetLtuPtCut(Float_t ptcut) { fLtuPtCut = ptcut; }; + void SetGtuPtCut(Float_t ptcut) { fGtuPtCut = ptcut; }; + void SetHighPt(Float_t hpt) { fHighPt = hpt; }; + void SetNPartJetLow(Int_t npj) { fNPartJetLow = npj; }; + void SetNPartJetHigh(Int_t npj) { fNPartJetHigh = npj; }; + void SetJetLowPt(Float_t thr) { fJetLowPt = thr; }; + void SetJetHighPt(Float_t thr) { fJetHighPt = thr; }; protected: - Int_t fDebug; // debugging flag + Int_t fDebug; // Debugging flag - Int_t fTime1; // first time bin for tracking (incl.) - Int_t fTime2; // last time bin for tracking (incl.) - Float_t fClusThr; // cluster threshold - Float_t fPadThr; // pad threshold - Int_t fSum10; // MCM CreateSeeds: Min_Thr_Left_Neighbour - Int_t fSum12; // MCM CreateSeeds: Min_Sum_From_Two_Neighbours - Int_t fTCOn; // tail cancelation flag - Int_t fTCnexp; // number of exp in filter - Int_t fFilterType; // filter type (0=A - analog, 1=D - digital) + Int_t fTime1; // First time bin for tracking (incl.) + Int_t fTime2; // Last time bin for tracking (incl.) + Float_t fClusThr; // Cluster threshold + Float_t fPadThr; // Pad threshold + Int_t fSum10; // MCM CreateSeeds: Min_Thr_Left_Neighbour + Int_t fSum12; // MCM CreateSeeds: Min_Sum_From_Two_Neighbours + Int_t fTCOn; // Tail cancelation flag + Int_t fTCnexp; // Number of exp in filter + Int_t fFilterType; // Filter type (0=A - analog, 1=D - digital) - // filter parameters (1 = long, 2 = short component) - Float_t fR1; // time constant [microseconds] - Float_t fR2; // time constant [microseconds] - Float_t fC1; // weight - Float_t fC2; // weight - Float_t fPedestal; // ADC baseline - Float_t fADCnoise; // ADC noise (not contained in the digitizer) + // Filter parameters (1 = long, 2 = short component) + Float_t fR1; // Time constant [microseconds] + Float_t fR2; // Time constant [microseconds] + Float_t fC1; // Weight + Float_t fC2; // Weight + Float_t fPedestal; // ADC baseline + Float_t fADCnoise; // ADC noise (not contained in the digitizer) - Float_t fDeltaY; // Y (offset) matching window in the GTU - Float_t fDeltaS; // Slope matching window in the GTU + Float_t fDeltaY; // Y (offset) matching window in the GTU + Float_t fDeltaS; // Slope matching window in the GTU - Float_t fXprojPlane; // Projection plane (X) for GTU matching + Float_t fXprojPlane; // Projection plane (X) for GTU matching - Float_t fLtuPtCut; // Local pt cut - Float_t fGtuPtCut; // Global pt cut + Float_t fLtuPtCut; // Local pt cut + Float_t fGtuPtCut; // Global pt cut - Float_t fField; // Magnetic field + Float_t fField; // Magnetic field - Float_t fHighPt; // High pt selection + Float_t fHighPt; // High pt selection - Int_t fNPartJetLow; // Number of tracks for jet (low) - Int_t fNPartJetHigh; // Number of tracks for jet (high) - Float_t fJetLowPt; // Low pt threshold for jet particles - Float_t fJetHighPt; // High pt threshold for jet particles + Int_t fNPartJetLow; // Number of tracks for jet (low) + Int_t fNPartJetHigh; // Number of tracks for jet (high) + Float_t fJetLowPt; // Low pt threshold for jet particles + Float_t fJetHighPt; // High pt threshold for jet particles - ClassDef(AliTRDtrigParam,2) // TRD trigger parameter class + ClassDef(AliTRDtrigParam,2) // TRD trigger parameter class }; diff --git a/TRD/AliTRDtrigger.cxx b/TRD/AliTRDtrigger.cxx index 1248da7c81c..abb77ee7ef2 100644 --- a/TRD/AliTRDtrigger.cxx +++ b/TRD/AliTRDtrigger.cxx @@ -15,15 +15,18 @@ /////////////////////////////////////////////////////////////////////////////// // // -// // // TRD trigger class // // // +// Author: // +// Bogdan Vulpescu // // // /////////////////////////////////////////////////////////////////////////////// #include #include #include +#include +#include #include "AliLog.h" #include "AliRun.h" @@ -34,105 +37,112 @@ #include "AliTRDdataArrayI.h" #include "AliTRDcalibDB.h" #include "AliTRDCommonParam.h" -#include "Cal/AliTRDCalPIDLQ.h" #include "AliTRDrawData.h" - #include "AliTRDtrigger.h" #include "AliTRDmodule.h" #include "AliTRDmcmTracklet.h" +#include "AliTRDgtuTrack.h" #include "AliTRDtrigParam.h" #include "AliTRDmcm.h" #include "AliTRDzmaps.h" - -//#include "AliHeader.h" +#include "Cal/AliTRDCalPIDLQ.h" ClassImp(AliTRDtrigger) //_____________________________________________________________________________ -AliTRDtrigger::AliTRDtrigger(): - TNamed(), - fTracks("AliTRDgtuTrack",0) +AliTRDtrigger::AliTRDtrigger() + :TNamed() + ,fField(0) + ,fGeo(NULL) + ,fCalib(NULL) + ,fCParam(NULL) + ,fTrigParam(NULL) + ,fRunLoader(NULL) + ,fDigitsManager(NULL) + ,fTrackletTree(NULL) + ,fTracklets(NULL) + ,fNROB(0) + ,fMCM(NULL) + ,fTrk(NULL) + ,fTrkTest(NULL) + ,fModule(NULL) + ,fGTUtrk(NULL) + ,fNtracklets(0) + ,fDigits(NULL) + ,fTrack0(NULL) + ,fTrack1(NULL) + ,fTrack2(NULL) + ,fNPrimary(0) + ,fTracks(NULL) { // // AliTRDtrigger default constructor // - fDigitsManager = NULL; - fTrackletTree = NULL; - fTracklets = NULL; - - fNROB = 0; - fTrigParam = NULL; - fMCM = NULL; - fTrk = NULL; - fTrkTest = NULL; - fGTUtrk = NULL; - - fNtracklets = 0; - - fDigits = NULL; - fTrack0 = NULL; - fTrack1 = NULL; - fTrack2 = NULL; - - fModule = NULL; - - fNPrimary = 0; - - fField = 0.0; - fGeo = NULL; - fCalib = NULL; - fCParam = NULL; - } //_____________________________________________________________________________ -AliTRDtrigger::AliTRDtrigger(const Text_t *name, const Text_t *title): - TNamed(name,title), - fTracks("AliTRDgtuTrack",1000) +AliTRDtrigger::AliTRDtrigger(const Text_t *name, const Text_t *title) + :TNamed(name,title) + ,fField(0) + ,fGeo(NULL) + ,fCalib(NULL) + ,fCParam(NULL) + ,fTrigParam(NULL) + ,fRunLoader(NULL) + ,fDigitsManager(new AliTRDdigitsManager()) + ,fTrackletTree(NULL) + ,fTracklets(new TObjArray(400)) + ,fNROB(0) + ,fMCM(NULL) + ,fTrk(NULL) + ,fTrkTest(NULL) + ,fModule(NULL) + ,fGTUtrk(NULL) + ,fNtracklets(0) + ,fDigits(NULL) + ,fTrack0(NULL) + ,fTrack1(NULL) + ,fTrack2(NULL) + ,fNPrimary(0) + ,fTracks(new TClonesArray("AliTRDgtuTrack",1000)) { // // AliTRDtrigger constructor // - fDigitsManager = new AliTRDdigitsManager(); - fTrackletTree = NULL; - fTracklets = new TObjArray(400); - - fNROB = 0; - fTrigParam = NULL; - fMCM = NULL; - fTrk = NULL; - fTrkTest = NULL; - fGTUtrk = NULL; - - fNtracklets = 0; - - fDigits = NULL; - fTrack0 = NULL; - fTrack1 = NULL; - fTrack2 = NULL; - - fModule = NULL; - - fNPrimary = 0; - - fField = 0.0; - fGeo = NULL; - fCalib = NULL; - fCParam = NULL; - } //_____________________________________________________________________________ -AliTRDtrigger::AliTRDtrigger(const AliTRDtrigger &p):TNamed(p) +AliTRDtrigger::AliTRDtrigger(const AliTRDtrigger &p) + :TNamed(p) + ,fField(p.fField) + ,fGeo(NULL) + ,fCalib(NULL) + ,fCParam(NULL) + ,fTrigParam(NULL) + ,fRunLoader(NULL) + ,fDigitsManager(NULL) + ,fTrackletTree(NULL) + ,fTracklets(NULL) + ,fNROB(p.fNROB) + ,fMCM(NULL) + ,fTrk(NULL) + ,fTrkTest(NULL) + ,fModule(NULL) + ,fGTUtrk(NULL) + ,fNtracklets(p.fNtracklets) + ,fDigits(NULL) + ,fTrack0(NULL) + ,fTrack1(NULL) + ,fTrack2(NULL) + ,fNPrimary(p.fNPrimary) + ,fTracks(NULL) { // // AliTRDtrigger copy constructor // - ((AliTRDtrigger &) p).Copy(*this); - } ///_____________________________________________________________________________ @@ -147,7 +157,10 @@ AliTRDtrigger::~AliTRDtrigger() delete fTracklets; } - fTracks.Delete(); + if (fTracks) { + fTracks->Delete(); + delete fTracks; + } } @@ -179,26 +192,20 @@ void AliTRDtrigger::Init() { fModule = new AliTRDmodule(fTrigParam); - /* - AliHeader *header = fRunLoader->GetHeader(); - fNPrimary = header->GetNprimary(); - */ - fTracks.Clear(); + fTracks->Clear(); - fField = fTrigParam->GetField(); - fGeo = (AliTRDgeometry*)AliTRDgeometry::GetGeometry(fRunLoader); + fField = fTrigParam->GetField(); + fGeo = (AliTRDgeometry*)AliTRDgeometry::GetGeometry(fRunLoader); - fCalib = AliTRDcalibDB::Instance(); - if (!fCalib) - { - Error("Init","No instance of AliTRDcalibDB."); + fCalib = AliTRDcalibDB::Instance(); + if (!fCalib) { + AliError("No instance of AliTRDcalibDB."); return; } fCParam = AliTRDCommonParam::Instance(); - if (!fCParam) - { - Error("Init","No common params."); + if (!fCParam) { + AliError("No common parameters."); return; } @@ -212,26 +219,26 @@ Bool_t AliTRDtrigger::Open(const Char_t *name, Int_t nEvent) // TString evfoldname = AliConfig::GetDefaultEventFolderName(); - fRunLoader = AliRunLoader::GetRunLoader(evfoldname); + fRunLoader = AliRunLoader::GetRunLoader(evfoldname); - if (!fRunLoader) + if (!fRunLoader) { fRunLoader = AliRunLoader::Open(name); - + } if (!fRunLoader) { - Error("Open","Can not open session for file %s.",name); + AliError(Form("Can not open session for file %s.",name)); return kFALSE; } // Open input - - if (fRunLoader->GetAliRun() == 0x0) fRunLoader->LoadgAlice(); + if (fRunLoader->GetAliRun() == 0x0) { + fRunLoader->LoadgAlice(); + } gAlice = fRunLoader->GetAliRun(); - if (!(gAlice)) { fRunLoader->LoadgAlice(); gAlice = fRunLoader->GetAliRun(); if (!(gAlice)) { - Error("Open","Could not find AliRun object."); + AliError("Could not find AliRun object."); return kFALSE; } } @@ -240,23 +247,17 @@ Bool_t AliTRDtrigger::Open(const Char_t *name, Int_t nEvent) fRunLoader->GetEvent(nEvent); // Open output - TObjArray *ioArray = 0; - - AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); + AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); loader->MakeTree("T"); fTrackletTree = loader->TreeT(); fTrackletTree->Branch("TRDmcmTracklet","TObjArray",&ioArray,32000,0); - /* - fRunLoader->LoadHeader(); - */ Init(); return kTRUE; } - //_____________________________________________________________________________ Bool_t AliTRDtrigger::ReadDigits() { @@ -265,14 +266,17 @@ Bool_t AliTRDtrigger::ReadDigits() // if (!fRunLoader) { - Error("ReadDigits","Can not find the Run Loader"); + AliError("Can not find the Run Loader"); return kFALSE; } AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); - if (!loader->TreeD()) loader->LoadDigits(); - - if (!loader->TreeD()) return kFALSE; + if (!loader->TreeD()) { + loader->LoadDigits(); + } + if (!loader->TreeD()) { + return kFALSE; + } return (fDigitsManager->ReadDigits(loader->TreeD())); @@ -286,8 +290,7 @@ Bool_t AliTRDtrigger::ReadDigits(AliRawReader* rawReader) // AliTRDrawData *raw = new AliTRDrawData(); - - fDigitsManager = raw->Raw2Digits(rawReader); + fDigitsManager = raw->Raw2Digits(rawReader); return kTRUE; @@ -304,35 +307,38 @@ Bool_t AliTRDtrigger::ReadTracklets(AliRunLoader *rl) AliLoader *loader = rl->GetLoader("TRDLoader"); loader->LoadTracks(); - fTrackletTree = loader->TreeT(); + fTrackletTree = loader->TreeT(); - TBranch *branch = fTrackletTree->GetBranch("TRDmcmTracklet"); + TBranch *branch = fTrackletTree->GetBranch("TRDmcmTracklet"); if (!branch) { - Error("ReadTracklets","Can't get the branch !"); + AliError("Can't get the branch !"); return kFALSE; } TObjArray *tracklets = new TObjArray(400); branch->SetAddress(&tracklets); - Int_t nEntries = (Int_t) fTrackletTree->GetEntries(); - Int_t iEntry, itrk; - Int_t iStack, iStackPrev = -1; + Int_t nEntries = (Int_t) fTrackletTree->GetEntries(); + Int_t iEntry; + Int_t itrk; + Int_t iStack; + Int_t iStackPrev = -1; for (iEntry = 0; iEntry < nEntries; iEntry++) { + fTrackletTree->GetEvent(iEntry); - for (itrk = 0; itrk < tracklets->GetEntriesFast(); itrk++){ - - fTrk = (AliTRDmcmTracklet*)tracklets->UncheckedAt(itrk); - - idet = fTrk->GetDetector(); + for (itrk = 0; itrk < tracklets->GetEntriesFast(); itrk++) { + fTrk = (AliTRDmcmTracklet*)tracklets->UncheckedAt(itrk); + idet = fTrk->GetDetector(); iStack = idet / (AliTRDgeometry::Nplan()); + if (iStackPrev != iStack) { if (iStackPrev == -1) { iStackPrev = iStack; - } else { - MakeTracks(idet-AliTRDgeometry::Nplan()); + } + else { + MakeTracks(idet - AliTRDgeometry::Nplan()); ResetTracklets(); iStackPrev = iStack; } @@ -340,7 +346,8 @@ Bool_t AliTRDtrigger::ReadTracklets(AliRunLoader *rl) Tracklets()->Add(fTrk); - if (iEntry == (nEntries-1) && itrk == (tracklets->GetEntriesFast()-1)) { + if ((iEntry == (nEntries-1)) && + (itrk == (tracklets->GetEntriesFast() - 1))) { idet++; MakeTracks(idet-AliTRDgeometry::Nplan()); ResetTracklets(); @@ -363,31 +370,35 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) // Create tracklets from digits // - Int_t chamBeg = 0; - Int_t chamEnd = AliTRDgeometry::Ncham(); - Int_t planBeg = 0; - Int_t planEnd = AliTRDgeometry::Nplan(); - Int_t sectBeg = 0; - Int_t sectEnd = AliTRDgeometry::Nsect(); + Int_t chamBeg = 0; + Int_t chamEnd = AliTRDgeometry::Ncham(); + Int_t planBeg = 0; + Int_t planEnd = AliTRDgeometry::Nplan(); + Int_t sectBeg = 0; + Int_t sectEnd = AliTRDgeometry::Nsect(); fTrkTest = new AliTRDmcmTracklet(0,0,0); - - fMCM = new AliTRDmcm(fTrigParam,0); - - Int_t time, col, row, col1, col2; + fMCM = new AliTRDmcm(fTrigParam,0); + + Int_t time; + Int_t col; + Int_t row; + Int_t col1; + Int_t col2; + Int_t idet = -1; + Int_t iStack = -1; + Int_t iStackPrev = -1; Float_t amp; - Int_t idet, iStack, iStackPrev; - idet = -1; - iStack = -1; - iStackPrev = -1; + for (Int_t isect = sectBeg; isect < sectEnd; isect++) { for (Int_t icham = chamBeg; icham < chamEnd; icham++) { - // number of ROBs in the chamber - if( icham == 2 ) { + // Number of ROBs in the chamber + if(icham == 2) { fNROB = 6; - } else { + } + else { fNROB = 8; } @@ -401,7 +412,8 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) if (iStackPrev != iStack) { if (iStackPrev == -1) { iStackPrev = iStack; - } else { + } + else { MakeTracks(idet-AliTRDgeometry::Nplan()); ResetTracklets(); iStackPrev = iStack; @@ -409,9 +421,9 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) } } - Int_t nRowMax = fCParam->GetRowMax(iplan,icham,isect); - Int_t nColMax = fCParam->GetColMax(iplan); - Int_t nTimeTotal = fCalib->GetNumberOfTimeBins(); + Int_t nRowMax = fCParam->GetRowMax(iplan,icham,isect); + Int_t nColMax = fCParam->GetColMax(iplan); + Int_t nTimeTotal = fCalib->GetNumberOfTimeBins(); // Get the digits fDigits = fDigitsManager->GetDigits(idet); @@ -432,7 +444,6 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) for (Int_t iMcm = 0; iMcm < kNMCM; iMcm++) { fMCM->Reset(); - fMCM->SetRobId(iRob); fMCM->SetChaId(idet); @@ -440,8 +451,8 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) row = fMCM->GetRow(); - if (row < 0 || row >= nRowMax) { - Error("MakeTracklets","MCM row number out of range."); + if ((row < 0) || (row >= nRowMax)) { + AliError("MCM row number out of range."); continue; } @@ -449,13 +460,13 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) for (time = 0; time < nTimeTotal; time++) { for (col = col1; col < col2; col++) { - if (col >= 0 && col < nColMax) { + if ((col >= 0) && (col < nColMax)) { amp = TMath::Abs(fDigits->GetDataUnchecked(row,col,time)); - } else { + } + else { amp = 0.0; } fMCM->SetADC(col-col1,time,amp); - } } @@ -467,13 +478,16 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) for (Int_t iSeed = 0; iSeed < kMaxTrackletsPerMCM; iSeed++) { - if (fMCM->GetSeedCol()[iSeed] < 0) continue; + if (fMCM->GetSeedCol()[iSeed] < 0) { + continue; + } - if ( fTrigParam->GetDebugLevel() > 1 ) - printf("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed]); + if (fTrigParam->GetDebugLevel() > 1) { + AliInfo(Form("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed])); + } - if ( fTrigParam->GetDebugLevel() == -1 ) { - printf("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed]); + if (fTrigParam->GetDebugLevel() == -1) { + AliInfo(Form("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed])); for (time = 0; time < nTimeTotal; time++) { for (col = 0; col < kMcmCol; col++) { printf("%03.0f ",fMCM->GetADC(col,time)); @@ -509,7 +523,7 @@ Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks) if (makeTracks) { idet++; - MakeTracks(idet-AliTRDgeometry::Nplan()); + MakeTracks(idet - AliTRDgeometry::Nplan()); ResetTracklets(); } @@ -535,31 +549,32 @@ void AliTRDtrigger::SetMCMcoordinates(Int_t imcm) if (robid%kNcolRob == 0) { - if ( mcmid%kNmcmRob == 0 ) { + if (mcmid%kNmcmRob == 0) { fMCM->SetColRange(18*0-1,18*1-1+2+1); } - if ( mcmid%kNmcmRob == 1 ) { + if (mcmid%kNmcmRob == 1) { fMCM->SetColRange(18*1-1,18*2-1+2+1); } - if ( mcmid%kNmcmRob == 2 ) { + if (mcmid%kNmcmRob == 2) { fMCM->SetColRange(18*2-1,18*3-1+2+1); } - if ( mcmid%kNmcmRob == 3 ) { + if (mcmid%kNmcmRob == 3) { fMCM->SetColRange(18*3-1,18*4-1+2+1); } - } else { + } + else { - if ( mcmid%kNmcmRob == 0 ) { + if (mcmid%kNmcmRob == 0) { fMCM->SetColRange(18*4-1,18*5-1+2+1); } - if ( mcmid%kNmcmRob == 1 ) { + if (mcmid%kNmcmRob == 1) { fMCM->SetColRange(18*5-1,18*6-1+2+1); } - if ( mcmid%kNmcmRob == 2 ) { + if (mcmid%kNmcmRob == 2) { fMCM->SetColRange(18*6-1,18*7-1+2+1); } - if ( mcmid%kNmcmRob == 3 ) { + if (mcmid%kNmcmRob == 3) { fMCM->SetColRange(18*7-1,18*8-1+2+1); } @@ -600,11 +615,12 @@ Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime); track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime); - if (fMCM->IsCluster(iCol,iTime)) { + if (fMCM->IsCluster(iCol,iTime)) { fTrkTest->AddCluster(iCol+iCol1,iTime,amp,track); - } else if ((iCol+1+1) < kMcmCol) { + } + else if ((iCol+1+1) < kMcmCol) { amp[0] = fMCM->GetADC(iCol-1+1,iTime); amp[1] = fMCM->GetADC(iCol +1,iTime); @@ -621,8 +637,7 @@ Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) } - } else { - } + } } @@ -672,11 +687,12 @@ void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime); track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime); - if (fMCM->IsCluster(iCol,iTime)) { + if (fMCM->IsCluster(iCol,iTime)) { fTrk->AddCluster(iCol+iCol1,iTime,amp,track); - } else if ((iCol+1+1) < kMcmCol) { + } + else if ((iCol+1+1) < kMcmCol) { amp[0] = fMCM->GetADC(iCol-1+1,iTime); amp[1] = fMCM->GetADC(iCol +1,iTime); @@ -693,7 +709,6 @@ void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n) } - } else { } } @@ -725,7 +740,7 @@ Bool_t AliTRDtrigger::WriteTracklets(Int_t det) // if ((det < -1) || (det >= AliTRDgeometry::Ndet())) { - Error("WriteTracklets","Unexpected detector index %d.",det); + AliError(Form("Unexpected detector index %d.",det)); return kFALSE; } @@ -741,13 +756,13 @@ Bool_t AliTRDtrigger::WriteTracklets(Int_t det) TObjArray *detTracklets = new TObjArray(400); for (Int_t i = 0; i < nTracklets; i++) { + AliTRDmcmTracklet *trk = (AliTRDmcmTracklet *) Tracklets()->UncheckedAt(i); if (det == trk->GetDetector()) { detTracklets->AddLast(trk); } - else { - } + } branch->SetAddress(&detTracklets); @@ -761,8 +776,8 @@ Bool_t AliTRDtrigger::WriteTracklets(Int_t det) if (det == -1) { - Info("WriteTracklets","Writing the Tracklet tree %s for event %d." - ,fTrackletTree->GetName(),fRunLoader->GetEventNumber()); + AliInfo(Form("Writing the Tracklet tree %s for event %d." + ,fTrackletTree->GetName(),fRunLoader->GetEventNumber())); AliLoader* loader = fRunLoader->GetLoader("TRDLoader"); loader->WriteTracks("OVERWRITE"); @@ -787,7 +802,7 @@ void AliTRDtrigger::MakeTracks(Int_t det) Int_t nRowMax, iplan, icham, isect, row; if ((det < 0) || (det >= AliTRDgeometry::Ndet())) { - Error("MakeTracks","Unexpected detector index %d.",det); + AliError(Form("Unexpected detector index %d.",det)); return; } @@ -836,4 +851,64 @@ void AliTRDtrigger::MakeTracks(Int_t det) } +//_____________________________________________________________________________ +void AliTRDtrigger::AddTrack(const AliTRDgtuTrack *t, Int_t det) +{ + // + // Add a track to the list + // + + AliTRDgtuTrack *track = new(fTracks->operator[](fTracks->GetEntriesFast())) + AliTRDgtuTrack(*t); + track->SetDetector(det); + +} + +//_____________________________________________________________________________ +TObjArray* AliTRDtrigger::Tracklets() +{ + // + // Returns list of tracklets + // + + if (!fTracklets) { + fTracklets = new TObjArray(400); + } + return fTracklets; +} + +//_____________________________________________________________________________ +void AliTRDtrigger::ResetTracklets() +{ + // + // Resets the list of tracklets + // + + if (fTracklets) { + fTracklets->Delete(); + } + +} + +//_____________________________________________________________________________ +Int_t AliTRDtrigger::GetNumberOfTracks() const +{ + // + // Returns number of tracks + // + + return fTracks->GetEntriesFast(); + +} + +//_____________________________________________________________________________ +AliTRDgtuTrack* AliTRDtrigger::GetTrack(Int_t i) const +{ + // + // Returns a given track from the list + // + + return (AliTRDgtuTrack *) fTracks->UncheckedAt(i); + +} diff --git a/TRD/AliTRDtrigger.h b/TRD/AliTRDtrigger.h index 31a35b8350c..1224e546608 100644 --- a/TRD/AliTRDtrigger.h +++ b/TRD/AliTRDtrigger.h @@ -3,6 +3,8 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +/* $Id$ */ + /////////////////////////////////////////////////////////////////////////////// // // // TRD trigger class // @@ -10,26 +12,24 @@ /////////////////////////////////////////////////////////////////////////////// #include -#include -#include - -#include "AliTRDgtuTrack.h" class TTree; - -class AliTRDdigitsManager; -class AliTRDdataArrayI; -class AliTRDgeometry; -class AliTRDcalibDB; -class AliTRDCommonParam; +class TClonesArray; +class TObjArray; class AliRunLoader; class AliRawReader; class AliTRDmcmTracklet; +class AliTRDgtuTrack; class AliTRDmcm; class AliTRDmodule; class AliTRDtrigParam; +class AliTRDdigitsManager; +class AliTRDdataArrayI; +class AliTRDgeometry; +class AliTRDcalibDB; +class AliTRDCommonParam; class AliTRDtrigger : public TNamed { @@ -40,76 +40,69 @@ class AliTRDtrigger : public TNamed { AliTRDtrigger(); AliTRDtrigger(const Text_t* name, const Text_t* title); AliTRDtrigger(const AliTRDtrigger &p); - virtual ~AliTRDtrigger(); - - AliTRDtrigger &operator=(const AliTRDtrigger &p); - virtual void Copy(TObject &p) const; - - void Init(); - - void SetRunLoader(AliRunLoader *rl) { fRunLoader = rl; }; - Bool_t Open(const Char_t *name, Int_t nEvent = 0); - Bool_t ReadDigits(); - Bool_t ReadDigits(AliRawReader* rawReader); - Bool_t MakeTracklets(Bool_t makeTracks = kFALSE); - Bool_t WriteTracklets(Int_t det); - Bool_t ReadTracklets(AliRunLoader *rl); - - void AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n); - Bool_t TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n); - TObjArray *Tracklets() { - if(!fTracklets) fTracklets = new TObjArray(400); return fTracklets; - }; - void ResetTracklets() { if(fTracklets) fTracklets->Delete(); }; - void SetMCMcoordinates(Int_t imcm); - void SetParameter(AliTRDtrigParam *trigp) { fTrigParam = trigp; }; - AliTRDtrigParam *GetParameter() const { return fTrigParam; }; - - void MakeTracks(Int_t det); - - AliTRDgtuTrack *GetTrack(Int_t i) const { - return (AliTRDgtuTrack *)fTracks.UncheckedAt(i); - } - void AddTrack(const AliTRDgtuTrack *t, Int_t det) { - AliTRDgtuTrack * track = new(fTracks[fTracks.GetEntriesFast()]) AliTRDgtuTrack(*t); - track->SetDetector(det); - } - Int_t GetNumberOfTracks() const {return fTracks.GetEntriesFast();} - - Int_t GetNPrimary() const { return fNPrimary; }; + virtual ~AliTRDtrigger(); + AliTRDtrigger &operator=(const AliTRDtrigger &p); + + virtual void Copy(TObject &p) const; + + void Init(); + + Bool_t Open(const Char_t *name, Int_t nEvent = 0); + Bool_t ReadDigits(); + Bool_t ReadDigits(AliRawReader* rawReader); + Bool_t MakeTracklets(Bool_t makeTracks = kFALSE); + void MakeTracks(Int_t det); + Bool_t WriteTracklets(Int_t det); + Bool_t ReadTracklets(AliRunLoader *rl); + + void AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n); + void AddTrack(const AliTRDgtuTrack *t, Int_t det); + Bool_t TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n); + TObjArray *Tracklets(); + void ResetTracklets(); + + Int_t GetNumberOfTracks() const; + Int_t GetNPrimary() const { return fNPrimary; }; + AliTRDtrigParam *GetParameter() const { return fTrigParam; }; + AliTRDgtuTrack *GetTrack(Int_t i) const; + + void SetRunLoader(AliRunLoader *rl) { fRunLoader = rl; }; + void SetMCMcoordinates(Int_t imcm); + void SetParameter(AliTRDtrigParam *trigp) { fTrigParam = trigp; }; + protected: - Float_t fField; //! Magnetic field - AliTRDgeometry *fGeo; //! TRD geometry - AliTRDcalibDB *fCalib; //! Calibration DB - AliTRDCommonParam *fCParam; //! Common parameters + Float_t fField; //! Magnetic field + AliTRDgeometry *fGeo; //! TRD geometry + AliTRDcalibDB *fCalib; //! Calibration DB + AliTRDCommonParam *fCParam; //! Common parameters - AliTRDtrigParam *fTrigParam; //! Trigger class parameters - AliRunLoader *fRunLoader; //! Run Loader - AliTRDdigitsManager *fDigitsManager; //! TRD digits manager - TTree *fTrackletTree; //! Tree with tracklets - TObjArray *fTracklets; //! Array of tracklets + AliTRDtrigParam *fTrigParam; //! Trigger class parameters + AliRunLoader *fRunLoader; //! Run Loader + AliTRDdigitsManager *fDigitsManager; //! TRD digits manager + TTree *fTrackletTree; //! Tree with tracklets + TObjArray *fTracklets; //! Array of tracklets - Int_t fNROB; //! Number of ROBs in the current chamber - AliTRDmcm *fMCM; //! Current MCM - AliTRDmcmTracklet *fTrk; //! Current tracklet - AliTRDmcmTracklet *fTrkTest; //! Test tracklet - AliTRDmodule *fModule; //! Current module - AliTRDgtuTrack *fGTUtrk; //! Current GTU track + Int_t fNROB; //! Number of ROBs in the current chamber + AliTRDmcm *fMCM; //! Current MCM + AliTRDmcmTracklet *fTrk; //! Current tracklet + AliTRDmcmTracklet *fTrkTest; //! Test tracklet + AliTRDmodule *fModule; //! Current module + AliTRDgtuTrack *fGTUtrk; //! Current GTU track - Int_t fNtracklets; //! Tracklets counter + Int_t fNtracklets; //! Tracklets counter - AliTRDdataArrayI *fDigits; //! Array with digits - AliTRDdataArrayI *fTrack0; //! Track dictionary 0 - AliTRDdataArrayI *fTrack1; //! Track dictionary 1 - AliTRDdataArrayI *fTrack2; //! Track dictionary 2 + AliTRDdataArrayI *fDigits; //! Array with digits + AliTRDdataArrayI *fTrack0; //! Track dictionary 0 + AliTRDdataArrayI *fTrack1; //! Track dictionary 1 + AliTRDdataArrayI *fTrack2; //! Track dictionary 2 - Int_t fNPrimary; //! Number of primary tracks + Int_t fNPrimary; //! Number of primary tracks - TClonesArray fTracks; //! Array of GTU tracks + TClonesArray *fTracks; //! Array of GTU tracks - ClassDef(AliTRDtrigger,2) // TRD trigger class + ClassDef(AliTRDtrigger,3) // TRD trigger class }; -- 2.39.3