From c2fc12580f7bb903a1f061ae3d60882098e8a988 Mon Sep 17 00:00:00 2001 From: cholm Date: Tue, 28 Mar 2006 13:08:09 +0000 Subject: [PATCH] Added documentation of each file. Re-enabled RAW I/O using AliAltroBuffer and AliAltroRawStream. Re-implemented AliFMDRawStream for better use with AliAltroRawStream. Added strip range to calibration parameters. Perhaps I also need a calibration that says how many pre-samples the ALTRO makes. Currrently with the hardware we have now, it seems that the ALTRO makes 4 pre-samples, regardless of the oversampling rate. However, we've only varied the VA1 shift clock (between 5 and 1.25MHz), relative to 10MHZ for the ALTRO sample clock. It may be that the number of pre-samples is a constant time, which means it depends on the actual sample clock frequency. If that's the case, then this parameter should be stored with the sampling rate parameter. If not, then it should probably be stored independently. I'm seriously considering making a base class, AliFMDIndex, like struct AliFMDIndex { UShort_t fDetector; Char_t fRing; UShort_t fSector; UShort_t fStrip; }; and have the `per-strip' classes derive from that, like class AliFMDHit : public AliHit, public AliFMDIndex { ... } class AliFMDDigit : public TObject, public AliFMDIndex { ... } What does the experts think about that? --- FMD/AliFMD.cxx | 7 +- FMD/AliFMD.h | 5 + FMD/AliFMD1.cxx | 7 +- FMD/AliFMD1.h | 13 +- FMD/AliFMD2.cxx | 7 +- FMD/AliFMD2.h | 10 +- FMD/AliFMD3.cxx | 7 +- FMD/AliFMD3.h | 13 +- FMD/AliFMDAlignFaker.cxx | 12 +- FMD/AliFMDAlignFaker.h | 11 +- FMD/AliFMDAltroIO.cxx | 7 +- FMD/AliFMDAltroIO.h | 5 + FMD/AliFMDAltroMapping.cxx | 7 +- FMD/AliFMDAltroMapping.h | 5 + FMD/AliFMDBoolMap.cxx | 5 + FMD/AliFMDBoolMap.h | 5 + FMD/AliFMDCalibFaker.cxx | 56 ++++++- FMD/AliFMDCalibFaker.h | 25 ++- FMD/AliFMDCalibGain.cxx | 7 +- FMD/AliFMDCalibGain.h | 7 +- FMD/AliFMDCalibPedestal.cxx | 9 +- FMD/AliFMDCalibPedestal.h | 7 +- FMD/AliFMDCalibSampleRate.cxx | 31 ++-- FMD/AliFMDCalibSampleRate.h | 31 +++- FMD/AliFMDCalibStripRange.cxx | 89 +++++++++++ FMD/AliFMDCalibStripRange.h | 75 +++++++++ FMD/AliFMDDetector.cxx | 6 +- FMD/AliFMDDetector.h | 9 +- FMD/AliFMDDigit.cxx | 7 +- FMD/AliFMDDigit.h | 19 +++ FMD/AliFMDDigitizer.cxx | 26 +++- FMD/AliFMDDigitizer.h | 5 + FMD/AliFMDDisplay.cxx | 7 +- FMD/AliFMDDisplay.h | 5 + FMD/AliFMDEdepMap.cxx | 7 +- FMD/AliFMDEdepMap.h | 9 +- FMD/AliFMDGeometry.cxx | 7 +- FMD/AliFMDGeometry.h | 7 +- FMD/AliFMDGeometryBuilder.cxx | 7 +- FMD/AliFMDGeometryBuilder.h | 5 + FMD/AliFMDHit.cxx | 7 +- FMD/AliFMDHit.h | 13 +- FMD/AliFMDInput.cxx | 15 +- FMD/AliFMDInput.h | 25 +++ FMD/AliFMDParameters.cxx | 125 ++++++++++++++- FMD/AliFMDParameters.h | 131 +++++++++++++++- FMD/AliFMDRawReader.cxx | 114 +++++++++++--- FMD/AliFMDRawReader.h | 5 + FMD/AliFMDRawStream.cxx | 215 ++++--------------------- FMD/AliFMDRawStream.h | 74 +++++---- FMD/AliFMDRawWriter.cxx | 284 ++++++++++++++-------------------- FMD/AliFMDRawWriter.h | 8 +- FMD/AliFMDRecPoint.cxx | 7 +- FMD/AliFMDRecPoint.h | 10 +- FMD/AliFMDReconstructor.cxx | 7 +- FMD/AliFMDReconstructor.h | 13 +- FMD/AliFMDRing.cxx | 7 +- FMD/AliFMDRing.h | 7 +- FMD/AliFMDUShortMap.cxx | 7 +- FMD/AliFMDUShortMap.h | 5 + FMD/AliFMDv0.cxx | 8 +- FMD/AliFMDv0.h | 16 +- FMD/AliFMDv1.cxx | 8 +- FMD/AliFMDv1.h | 16 +- FMD/Config.C | 5 + FMD/Doxyfile | 2 +- FMD/DrawFMD.C | 5 + FMD/FMDbaseLinkDef.h | 13 +- FMD/FMDrecLinkDef.h | 6 + FMD/FMDsimLinkDef.h | 6 +- FMD/FMDutilLinkDef.h | 6 +- FMD/Reconstruct.C | 9 +- FMD/Simulate.C | 12 +- FMD/ViewFMD.C | 6 + FMD/libFMDbase.pkg | 4 +- FMD/scripts/MakeAlignment.C | 12 +- FMD/scripts/MakeCalibration.C | 35 +++++ FMD/scripts/Poisson.C | 63 ++++++-- FMD/scripts/PoissonHit.C | 154 ++++++++++++++++++ FMD/scripts/PrintAlignment.C | 50 ++++++ FMD/scripts/ReadRaw.C | 24 +++ 81 files changed, 1543 insertions(+), 585 deletions(-) create mode 100644 FMD/AliFMDCalibStripRange.cxx create mode 100644 FMD/AliFMDCalibStripRange.h create mode 100644 FMD/scripts/MakeCalibration.C create mode 100644 FMD/scripts/PoissonHit.C create mode 100644 FMD/scripts/PrintAlignment.C create mode 100644 FMD/scripts/ReadRaw.C diff --git a/FMD/AliFMD.cxx b/FMD/AliFMD.cxx index be02c1b7311..fd95c4dc377 100644 --- a/FMD/AliFMD.cxx +++ b/FMD/AliFMD.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMD.cxx + @author Christian Holm Christensen + @date Sun Mar 26 17:59:18 2006 + @brief Implementation of AliFMD base class +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. This class diff --git a/FMD/AliFMD.h b/FMD/AliFMD.h index 43e02d85d90..e2ca8d813e5 100644 --- a/FMD/AliFMD.h +++ b/FMD/AliFMD.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMD.h + @author Christian Holm Christensen + @date Sun Mar 26 17:59:37 2006 + @brief Declaration of AliFMD detector driver +*/ /** @mainpage ALICE FMD Off-line code @b Contents diff --git a/FMD/AliFMD1.cxx b/FMD/AliFMD1.cxx index 98e2040b60f..9718a2e725c 100644 --- a/FMD/AliFMD1.cxx +++ b/FMD/AliFMD1.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMD1.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:00:23 2006 + @brief Implementation of FMD1 parameters +*/ //____________________________________________________________________ // // Concrete implementation of AliFMDDetector diff --git a/FMD/AliFMD1.h b/FMD/AliFMD1.h index 9c8f63388ea..89395d00710 100644 --- a/FMD/AliFMD1.h +++ b/FMD/AliFMD1.h @@ -1,8 +1,12 @@ #ifndef ALIFMD1_H #define ALIFMD1_H -// -// $Id$ -// +/* $Id$ */ +/** @file AliFMD1.h + @author Christian Holm Christensen + @date Sun Mar 26 18:00:56 2006 + @brief Declaration of FMD1 declaration +*/ + #ifndef ALIFMDDETECTOR_H # include "AliFMDDetector.h" #endif @@ -10,8 +14,9 @@ class AliFMDRing; //__________________________________________________________________ /** @class AliFMD1 AliFMD1.h - Geometry description and parameters of the FMD1 detector. + @brief Geometry description and parameters of the FMD1 detector. The FMD1 has only one ring. + @image html FMD1.png @ingroup FMD_base */ class AliFMD1 : public AliFMDDetector diff --git a/FMD/AliFMD2.cxx b/FMD/AliFMD2.cxx index 6f355dcfc15..9e05ea75f7f 100644 --- a/FMD/AliFMD2.cxx +++ b/FMD/AliFMD2.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMD2.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:25:51 2006 + @brief Concrete implementation of AliFMDDetector for FMD2 +*/ //____________________________________________________________________ // // Concrete implementation of AliFMDDetector diff --git a/FMD/AliFMD2.h b/FMD/AliFMD2.h index bccb449e1f2..a4c30a53140 100644 --- a/FMD/AliFMD2.h +++ b/FMD/AliFMD2.h @@ -3,14 +3,20 @@ // #ifndef ALIFMD2_H #define ALIFMD2_H - +/** @file AliFMD2.h + @author Christian Holm Christensen + @date Sun Mar 26 18:25:28 2006 + @brief Geometry parameters of the FMD2 detector. +*/ #ifndef ALIFMDDETECTOR_H # include "AliFMDDetector.h" #endif //____________________________________________________________________ /** @class AliFMD2 AliFMD2.h - Geometry parameters of the FMD2 detector. This has two rings. + @brief Geometry parameters of the FMD2 detector. + This has two rings. + @image html FMD2.png @ingroup FMD_base */ class AliFMD2 : public AliFMDDetector diff --git a/FMD/AliFMD3.cxx b/FMD/AliFMD3.cxx index 83efcab8633..c422c2731a0 100644 --- a/FMD/AliFMD3.cxx +++ b/FMD/AliFMD3.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMD3.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:26:12 2006 + @brief Concrete implementation of AliFMDDetector for FMD3 +*/ //____________________________________________________________________ // // Concrete implementation of AliFMDDetector diff --git a/FMD/AliFMD3.h b/FMD/AliFMD3.h index ee3da7e3278..b81051c871b 100644 --- a/FMD/AliFMD3.h +++ b/FMD/AliFMD3.h @@ -3,15 +3,20 @@ // #ifndef ALIFMD3_H #define ALIFMD3_H - +/** @file AliFMD3.h + @author Christian Holm Christensen + @date Sun Mar 26 18:23:48 2006 + @brief Geometry parameters of the FMD3 detector. +*/ #ifndef ALIFMDDETECTOR_H # include "AliFMDDetector.h" #endif /** @class AliFMD3 AliFMD3.h - Geometry parameters of the FMD3 detector. FMD3 has a fairly - complicated support structure. The cone also supports the - beam-pipe. + @brief Geometry parameters of the FMD3 detector. + FMD3 has a fairly complicated support structure. The cone also + supports the beam-pipe. + @image html FMD3.png @ingroup FMD_base */ class AliFMD3 : public AliFMDDetector diff --git a/FMD/AliFMDAlignFaker.cxx b/FMD/AliFMDAlignFaker.cxx index 49822e97d9d..7cfa1930cfc 100644 --- a/FMD/AliFMDAlignFaker.cxx +++ b/FMD/AliFMDAlignFaker.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDAlignFaker.cxx + @author Christian Holm Christensen + @date Sun Mar 26 17:57:55 2006 + @brief Implementation of AliFMDAlignFaker +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. @@ -165,7 +168,7 @@ AliFMDAlignFaker::Exec(Option_t*) } TString t(GetTitle()); - if (t.Contains("local://") || t.Contains("alien://")) + if (t.IsNull() || t.Contains("local://") || t.Contains("alien://")) WriteToCDB(); else WriteToFile(); @@ -228,7 +231,8 @@ AliFMDAlignFaker::WriteToCDB() { // Make the objects. AliCDBManager* cdb = AliCDBManager::Instance(); - if (GetTitle()) cdb->SetDefaultStorage(GetTitle()); + if (GetTitle() && GetTitle()[0] != '\0') + cdb->SetDefaultStorage(GetTitle()); AliCDBMetaData* meta = new AliCDBMetaData; meta->SetResponsible(gSystem->GetUserInfo()->fRealName.Data()); diff --git a/FMD/AliFMDAlignFaker.h b/FMD/AliFMDAlignFaker.h index e9ffe8ea35e..e8197042701 100644 --- a/FMD/AliFMDAlignFaker.h +++ b/FMD/AliFMDAlignFaker.h @@ -7,7 +7,11 @@ * * See cxx source for full Copyright notice */ - +/** @file AliFMDAlignFaker.h + @author Christian Holm Christensen + @date Sun Mar 26 18:26:39 2006 + @brief Make fake alignment +*/ //____________________________________________________________________ // // Class to make fake alignration parameters @@ -22,8 +26,9 @@ class TClonesArray; class TString; /** @class AliFMDAlignFaker - This task creates fake alignment. Which alignment, depends on the - bit mask passed to the constructor, or added by `AddAlign'. + @brief This task creates fake alignment. + Which alignment, depends on the bit mask passed to the + constructor, or added by `AddAlign'. The default is to write all alignment parameters to a local storage @c local://cdb which is a directory in the current diff --git a/FMD/AliFMDAltroIO.cxx b/FMD/AliFMDAltroIO.cxx index 3d7b68a3fe5..b55a2da6d3b 100644 --- a/FMD/AliFMDAltroIO.cxx +++ b/FMD/AliFMDAltroIO.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDAltroIO.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:27:06 2006 + @brief Altro Input/Output +*/ //____________________________________________________________________ // // Mapping of ALTRO hardware channel to detector coordinates diff --git a/FMD/AliFMDAltroIO.h b/FMD/AliFMDAltroIO.h index 096f659b994..57b0850d38a 100644 --- a/FMD/AliFMDAltroIO.h +++ b/FMD/AliFMDAltroIO.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDAltroIO.h + @author Christian Holm Christensen + @date Sun Mar 26 18:27:31 2006 + @brief ALTRO Input/output +*/ #include #include diff --git a/FMD/AliFMDAltroMapping.cxx b/FMD/AliFMDAltroMapping.cxx index d474d3c7e5f..d0e9d89efb9 100644 --- a/FMD/AliFMDAltroMapping.cxx +++ b/FMD/AliFMDAltroMapping.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDAltroMapping.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:27:56 2006 + @brief Map HW to detector +*/ //____________________________________________________________________ // // Mapping of ALTRO hardware channel to detector coordinates diff --git a/FMD/AliFMDAltroMapping.h b/FMD/AliFMDAltroMapping.h index 94bc99d80a6..1e4e56f4238 100644 --- a/FMD/AliFMDAltroMapping.h +++ b/FMD/AliFMDAltroMapping.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDAltroMapping.h + @author Christian Holm Christensen + @date Sun Mar 26 18:28:11 2006 + @brief Map HW address to detector coordinates and back again. +*/ #ifndef ALIALTROMAPPING_H # include #endif diff --git a/FMD/AliFMDBoolMap.cxx b/FMD/AliFMDBoolMap.cxx index 3e72594db2e..aa2c6dc633f 100644 --- a/FMD/AliFMDBoolMap.cxx +++ b/FMD/AliFMDBoolMap.cxx @@ -15,6 +15,11 @@ * is provided "as is" without express or implied warranty. * **************************************************************/ /* $Id$ */ +/** @file AliFMDBoolMap.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:28:42 2006 + @brief Per strip Boolean map +*/ //__________________________________________________________ // // Map of Bool_t for each FMD strip diff --git a/FMD/AliFMDBoolMap.h b/FMD/AliFMDBoolMap.h index 2ceb3d120aa..4cd8cddab82 100644 --- a/FMD/AliFMDBoolMap.h +++ b/FMD/AliFMDBoolMap.h @@ -7,6 +7,11 @@ * Created Mon Nov 8 12:51:51 2004 by Christian Holm Christensen */ /* $Id$ */ +/** @file AliFMDBoolMap.h + @author Christian Holm Christensen + @date Sun Mar 26 18:28:59 2006 + @brief Per strip boolean map +*/ //__________________________________________________________ // // Map of Bool_t for each FMD strip diff --git a/FMD/AliFMDCalibFaker.cxx b/FMD/AliFMDCalibFaker.cxx index 3296e5b5711..491c506da5e 100644 --- a/FMD/AliFMDCalibFaker.cxx +++ b/FMD/AliFMDCalibFaker.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDCalibFaker.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:29:21 2006 + @brief Make fake calibration data +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. @@ -32,6 +35,7 @@ #include "AliFMDCalibPedestal.h" // ALIFMDCALIBPEDESTAL_H #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBPEDESTAL_H #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H +#include "AliFMDCalibStripRange.h" // ALIFMDCALIBSTRIPRANGE_H #include // ALICDBMANAGER_H #include // ALICDBMANAGER_H #include @@ -59,7 +63,9 @@ AliFMDCalibFaker::AliFMDCalibFaker(Int_t mask, const char* loc) fRate(1), fZeroThreshold(0), fRunMin(0), - fRunMax(10) + fRunMax(10), + fStripMin(0), + fStripMax(127) { // Default constructor } @@ -84,7 +90,11 @@ AliFMDCalibFaker::Exec(Option_t*) Float_t maxADC = param->GetAltroChannelSize(); TObjArray cleanup; - if (GetTitle()) cdb->SetDefaultStorage(GetTitle()); + if (GetTitle() && GetTitle()[0] != '\0') { + AliInfo(Form("Setting default storage to '%s'", GetTitle())); + cdb->SetDefaultStorage(GetTitle()); + } + AliCDBMetaData* meta = 0; if (TESTBIT(fMask, kPulseGain)) { @@ -141,6 +151,16 @@ AliFMDCalibFaker::Exec(Option_t*) cleanup.Add(rate); cleanup.Add(meta); } + if (TESTBIT(fMask, kStripRange)) { + fRate = TMath::Max(TMath::Min(fRate, UShort_t(8)), UShort_t(1)); + AliFMDCalibStripRange* range = MakeStripRange(); + AliCDBId id(AliFMDParameters::fgkStripRange,fRunMin,fRunMax); + MAKE_META(meta); + meta->SetProperty("key1", range); + cdb->Put(range, id, meta); + cleanup.Add(range); + cleanup.Add(meta); + } if (TESTBIT(fMask, kAltroMap)) { AliFMDAltroMapping* altroMap = MakeAltroMap(); AliCDBId id(AliFMDParameters::fgkAltroMap, fRunMin, fRunMax); @@ -249,11 +269,35 @@ AliFMDCalibSampleRate* AliFMDCalibFaker::MakeSampleRate() { AliFMDCalibSampleRate* sampleRate = new AliFMDCalibSampleRate; - for (int i = 0; i < 3; i++) - sampleRate->Set(AliFMDParameters::kBaseDDL+i, fRate); + for (UShort_t det = 1; det <= 3; det++) { + Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' }; + for (Char_t* ring = rings; *ring != '\0'; ring++) { + UShort_t nSec = ( *ring == 'I' ? 20 : 40 ); + for (UShort_t sec = 0; sec < nSec; sec++) { + sampleRate->Set(det, *ring, sec, 0, fRate); + } + } + } return sampleRate; } +//__________________________________________________________________ +AliFMDCalibStripRange* +AliFMDCalibFaker::MakeStripRange() +{ + AliFMDCalibStripRange* striprange = new AliFMDCalibStripRange; + for (UShort_t det = 1; det <= 3; det++) { + Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' }; + for (Char_t* ring = rings; *ring != '\0'; ring++) { + UShort_t nSec = ( *ring == 'I' ? 20 : 40 ); + for (UShort_t sec = 0; sec < nSec; sec++) { + striprange->Set(det, *ring, sec, 0, fStripMin, fStripMax); + } + } + } + return striprange; +} + //__________________________________________________________________ AliFMDAltroMapping* AliFMDCalibFaker::MakeAltroMap() diff --git a/FMD/AliFMDCalibFaker.h b/FMD/AliFMDCalibFaker.h index 1f8ab423b9e..e7c8edb2096 100644 --- a/FMD/AliFMDCalibFaker.h +++ b/FMD/AliFMDCalibFaker.h @@ -7,7 +7,11 @@ * * See cxx source for full Copyright notice */ - +/** @file AliFMDCalibFaker.h + @author Christian Holm Christensen + @date Sun Mar 26 18:29:36 2006 + @brief Make fake calibration data +*/ //____________________________________________________________________ // // Class to make fake calibration parameters @@ -43,12 +47,14 @@ public: /** Dead map */ kDeadMap, /** Hardware map */ - kAltroMap + kAltroMap, + /** Strip range */ + kStripRange }; enum { /** All parameters */ kAll = (1< + @date Sun Mar 26 18:30:02 2006 + @brief Per strip gain calibration +*/ //____________________________________________________________________ // // diff --git a/FMD/AliFMDCalibGain.h b/FMD/AliFMDCalibGain.h index 280c459d772..3607837301f 100644 --- a/FMD/AliFMDCalibGain.h +++ b/FMD/AliFMDCalibGain.h @@ -5,11 +5,16 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDCalibGain.h + @author Christian Holm Christensen + @date Sun Mar 26 18:30:16 2006 + @brief Per strip gain calibration +*/ #ifndef ALIFMDFLOATMAP_H # include #endif //____________________________________________________________________ -/** Gain value and width for each strip in the FMD +/** @brief Gain value and width for each strip in the FMD @ingroup FMD_base */ class AliFMDCalibGain : public TObject diff --git a/FMD/AliFMDCalibPedestal.cxx b/FMD/AliFMDCalibPedestal.cxx index 776cdc06f5c..c985d257268 100644 --- a/FMD/AliFMDCalibPedestal.cxx +++ b/FMD/AliFMDCalibPedestal.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDCalibPedestal.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:30:36 2006 + @brief Per strip pedestal calibration +*/ //____________________________________________________________________ // // @@ -70,7 +73,7 @@ Float_t AliFMDCalibPedestal::Width(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) { - return fValue(det, ring, sec, str); + return fWidth(det, ring, sec, str); } //____________________________________________________________________ diff --git a/FMD/AliFMDCalibPedestal.h b/FMD/AliFMDCalibPedestal.h index 78e04360b44..553397e6f66 100644 --- a/FMD/AliFMDCalibPedestal.h +++ b/FMD/AliFMDCalibPedestal.h @@ -5,11 +5,16 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDCalibPedestal.h + @author Christian Holm Christensen + @date Sun Mar 26 18:30:51 2006 + @brief Per strip pedestal calibration +*/ #ifndef ALIFMDFLOATMAP_H # include #endif //____________________________________________________________________ -/** Pedestal value and width for each strip in the FMD +/** @brief Pedestal value and width for each strip in the FMD @ingroup FMD_base */ class AliFMDCalibPedestal : public TObject diff --git a/FMD/AliFMDCalibSampleRate.cxx b/FMD/AliFMDCalibSampleRate.cxx index de7357f63af..5e51121d3c6 100644 --- a/FMD/AliFMDCalibSampleRate.cxx +++ b/FMD/AliFMDCalibSampleRate.cxx @@ -12,15 +12,19 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDCalibSampleRate.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:31:09 2006 + @brief Per digitizer card pulser calibration +*/ //____________________________________________________________________ // // // #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBGAIN_H #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H +#include //____________________________________________________________________ ClassImp(AliFMDCalibSampleRate) @@ -30,9 +34,10 @@ ClassImp(AliFMDCalibSampleRate) //____________________________________________________________________ AliFMDCalibSampleRate::AliFMDCalibSampleRate() - : fRates(3) + : fRates(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1) + // fRates(3) { - fRates.Reset(0); + fRates.Reset(1); } //____________________________________________________________________ @@ -50,18 +55,24 @@ AliFMDCalibSampleRate::operator=(const AliFMDCalibSampleRate& o) //____________________________________________________________________ void -AliFMDCalibSampleRate::Set(UShort_t ddl, UShort_t rate) +AliFMDCalibSampleRate::Set(UShort_t det, Char_t ring, + UShort_t sector, UShort_t, UShort_t rate) { - if (ddl - AliFMDParameters::kBaseDDL < 0) return; - fRates[ddl - AliFMDParameters::kBaseDDL] = rate; + UInt_t nSec = (ring == 'I' ? 20 : 40); + UInt_t board = sector / nSec; + fRates(det, ring, board, 0) = rate; } //____________________________________________________________________ UShort_t -AliFMDCalibSampleRate::Rate(UShort_t ddl) const +AliFMDCalibSampleRate::Rate(UShort_t det, Char_t ring, + UShort_t sec, UShort_t) const { - if (ddl - AliFMDParameters::kBaseDDL < 0) return 0; - return fRates[ddl - AliFMDParameters::kBaseDDL]; + UInt_t nSec = (ring == 'I' ? 20 : 40); + UInt_t board = sec / nSec; + AliDebug(10, Form("Getting sample rate for FMD%d%c[%2d,0] (board %d)", + det, ring, sec, board)); + return fRates(det, ring, board, 0); } //____________________________________________________________________ diff --git a/FMD/AliFMDCalibSampleRate.h b/FMD/AliFMDCalibSampleRate.h index 7e2ac7b1c4a..fbd3a34257c 100644 --- a/FMD/AliFMDCalibSampleRate.h +++ b/FMD/AliFMDCalibSampleRate.h @@ -5,14 +5,23 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDCalibSampleRate.h + @author Christian Holm Christensen + @date Sun Mar 26 18:32:14 2006 + @brief Per digitizer card pulser calibration + +*/ #ifndef ROOT_TObject # include #endif +#ifndef ALIFMDUSHORTMAP_H +# include "AliFMDUShortMap.h" +#endif #ifndef ROOT_TArrayI # include #endif //____________________________________________________________________ -/** Gain value and width for each strip in the FMD +/** @brief Per digitizer card pulser calibration @ingroup FMD_base */ class AliFMDCalibSampleRate : public TObject @@ -28,16 +37,24 @@ public: @return Reference to assign from */ AliFMDCalibSampleRate& operator=(const AliFMDCalibSampleRate& o); /** Set sample for a DDL - @param ddl DDL (detector) + @param det Detector # + @param ring Ring ID + @param sec Sector # + @param str Strip number (not used) @param rate Sample rate */ - void Set(UShort_t ddl, UShort_t rate); + void Set(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, + UShort_t rate); /** Get sample rate for a detector - @param ddl Detector (DDL) identifier + @param det Detector # + @param ring Ring ID + @param sec Sector # + @param str Strip number (not used) @return Sample rate */ - UShort_t Rate(UShort_t ddl) const; + UShort_t Rate(UShort_t det, Char_t ring, UShort_t sec, UShort_t str=0) const; protected: - TArrayI fRates; // Sample rates - ClassDef(AliFMDCalibSampleRate,1); // Sample rates + // TArrayI fRates; // Sample rates + AliFMDUShortMap fRates; + ClassDef(AliFMDCalibSampleRate,2); // Sample rates }; #endif diff --git a/FMD/AliFMDCalibStripRange.cxx b/FMD/AliFMDCalibStripRange.cxx new file mode 100644 index 00000000000..f1edcb3936f --- /dev/null +++ b/FMD/AliFMDCalibStripRange.cxx @@ -0,0 +1,89 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +/* $Id$ */ +/** @file AliFMDCalibStripRange.cxx + @author Christian Holm Christensen + @date Sun Mar 26 18:31:09 2006 + @brief Per digitizer card pulser calibration +*/ +//____________________________________________________________________ +// +// +// +#include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H +#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H + +//____________________________________________________________________ +ClassImp(AliFMDCalibStripRange) +#if 0 + ; // This is here to keep Emacs for indenting the next line +#endif + +//____________________________________________________________________ +AliFMDCalibStripRange::AliFMDCalibStripRange() + : fRates(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1) + // fRates(3) +{ + fRates.Reset(1); +} + +//____________________________________________________________________ +AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o) + : TObject(o), fRates(o.fRates) +{} + +//____________________________________________________________________ +AliFMDCalibStripRange& +AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o) +{ + fRates = o.fRates; + return (*this); +} + +//____________________________________________________________________ +void +AliFMDCalibStripRange::Set(UShort_t det, Char_t ring, + UShort_t sector, UShort_t, UShort_t min, + UShort_t max) +{ + UInt_t nSec = (ring == 'I' ? 20 : 40); + UInt_t board = sector / nSec; + fRates(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f); +} + +//____________________________________________________________________ +UShort_t +AliFMDCalibStripRange::Min(UShort_t det, Char_t ring, + UShort_t sec, UShort_t) const +{ + UInt_t nSec = (ring == 'I' ? 20 : 40); + UInt_t board = sec / nSec; + return (fRates(det, ring, board, 0) & 0x7f); +} + +//____________________________________________________________________ +UShort_t +AliFMDCalibStripRange::Max(UShort_t det, Char_t ring, + UShort_t sec, UShort_t) const +{ + UInt_t nSec = (ring == 'I' ? 20 : 40); + UInt_t board = sec / nSec; + return ((fRates(det, ring, board, 0) >> 8) & 0x7f); +} + +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/AliFMDCalibStripRange.h b/FMD/AliFMDCalibStripRange.h new file mode 100644 index 00000000000..a02f7a790d5 --- /dev/null +++ b/FMD/AliFMDCalibStripRange.h @@ -0,0 +1,75 @@ +#ifndef ALIFMDCALIBSTRIPRANGE_H +#define ALIFMDCALIBSTRIPRANGE_H +/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights + * reserved. + * + * See cxx source for full Copyright notice + */ +/** @file AliFMDCalibStripRange.h + @author Christian Holm Christensen + @date Sun Mar 26 18:32:14 2006 + @brief Per digitizer card pulser calibration +*/ +#ifndef ROOT_TObject +# include +#endif +#ifndef ALIFMDUSHORTMAP_H +# include "AliFMDUShortMap.h" +#endif +#ifndef ROOT_TArrayI +# include +#endif +//____________________________________________________________________ +/** @brief Per digitizer card pulser calibration + @ingroup FMD_base +*/ +class AliFMDCalibStripRange : public TObject +{ +public: + /** CTOR */ + AliFMDCalibStripRange(); + /** Copy CTOR + @param o Object to copy from */ + AliFMDCalibStripRange(const AliFMDCalibStripRange& o); + /** Assignment operator + @param o Object to assign from + @return Reference to assign from */ + AliFMDCalibStripRange& operator=(const AliFMDCalibStripRange& o); + /** Set sample for a DDL + @param det Detector # + @param ring Ring ID + @param sec Sector # + @param str Strip number (not used) + @param min Minimum strip (0-127) + @param max Maximum strip (0-127) */ + void Set(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, + UShort_t min, UShort_t max); + /** Get minimum strip read out (0-127) + @param det Detector # + @param ring Ring ID + @param sec Sector # + @param str Strip number (not used) + @return Minimum strip */ + UShort_t Min(UShort_t det, Char_t ring, UShort_t sec, UShort_t str=0) const; + /** Get maximum strip read out (0-127) + @param det Detector # + @param ring Ring ID + @param sec Sector # + @param str Strip number (not used) + @return Maximum strip */ + UShort_t Max(UShort_t det, Char_t ring, UShort_t sec, UShort_t str=0) const; +protected: + // TArrayI fRates; // Sample rates + AliFMDUShortMap fRates; + ClassDef(AliFMDCalibStripRange,1); // Sample rates +}; + +#endif +//____________________________________________________________________ +// +// Local Variables: +// mode: C++ +// End: +// + + diff --git a/FMD/AliFMDDetector.cxx b/FMD/AliFMDDetector.cxx index 6c7574bd3ff..9be65057107 100644 --- a/FMD/AliFMDDetector.cxx +++ b/FMD/AliFMDDetector.cxx @@ -12,8 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ +/** @file AliFMDDetector.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:36:27 2006 + @brief Sub-detector base class implementation +*/ //____________________________________________________________________ // diff --git a/FMD/AliFMDDetector.h b/FMD/AliFMDDetector.h index e4872029c13..5654d6f5d04 100644 --- a/FMD/AliFMDDetector.h +++ b/FMD/AliFMDDetector.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDDetector.h + @author Christian Holm Christensen + @date Mon Mar 27 12:36:27 2006 + @brief Sub-detector base class declaration +*/ #ifndef ROOT_TNamed # include #endif @@ -15,8 +20,8 @@ class TGeoMatrix; /** @defgroup FMD_base Basic classes */ //__________________________________________________________________ -/** Base class for the geometry description and parameters of the FMD - sub detectors FMD1, FMD2, and FMD3. +/** @brief Base class for the geometry description and parameters of + the FMD sub detectors FMD1, FMD2, and FMD3. This class hold common parameters of the specific FMD detectors. @ingroup FMD_base diff --git a/FMD/AliFMDDigit.cxx b/FMD/AliFMDDigit.cxx index 995cc932fdb..a2c9cc67c63 100644 --- a/FMD/AliFMDDigit.cxx +++ b/FMD/AliFMDDigit.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDDigit.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:37:41 2006 + @brief Digits for the FMD +*/ ////////////////////////////////////////////////////////////////////// // // Digits classes for the FMD diff --git a/FMD/AliFMDDigit.h b/FMD/AliFMDDigit.h index 9ea0bfde9d5..7994207235f 100644 --- a/FMD/AliFMDDigit.h +++ b/FMD/AliFMDDigit.h @@ -1,5 +1,10 @@ #ifndef ALIFMDDIGIT_H #define ALIFMDDIGIT_H +/** @file AliFMDDigit.h + @author Christian Holm Christensen + @date Mon Mar 27 12:37:41 2006 + @brief Digits for the FMD +*/ //___________________________________________________________________ // // Digits classes for the FMD @@ -80,6 +85,9 @@ public: Short_t count3=-1); /** DTOR */ virtual ~AliFMDDigit() {} + /** @param i # of sample to get + @return sample # @a i */ + Int_t Count(size_t i=0) const; /** @return ADC count (first sample) */ UShort_t Count1() const { return fCount1; } /** @return ADC count (second sample, or -1 if not used) */ @@ -108,6 +116,17 @@ AliFMDDigit::Counts() const + (fCount3 >= 0 ? fCount3 : 0); } +inline Int_t +AliFMDDigit::Count(size_t i) const +{ + switch (i) { + case 0: return fCount1; + case 1: return fCount2; + case 2: return fCount3; + } + return -1; +} + //____________________________________________________________________ /** @class AliFMDSDigit AliFMDDigit.h @brief class for summable digits diff --git a/FMD/AliFMDDigitizer.cxx b/FMD/AliFMDDigitizer.cxx index 64f491855ea..61d79c95eda 100644 --- a/FMD/AliFMDDigitizer.cxx +++ b/FMD/AliFMDDigitizer.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDDigitizer.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:38:26 2006 + @brief FMD Digitizers implementation +*/ ////////////////////////////////////////////////////////////////////////////// // // This class contains the procedures simulation ADC signal for the @@ -332,10 +335,21 @@ AliFMDBaseDigitizer::SumContributions(AliFMD* fmd) UShort_t sector = fmdHit->Sector(); UShort_t strip = fmdHit->Strip(); Float_t edep = fmdHit->Edep(); - + UShort_t minstrip = param->GetMinStrip(detector, ring, sector, strip); + UShort_t maxstrip = param->GetMaxStrip(detector, ring, sector, strip); // Check if strip is `dead' - if (param->IsDead(detector, ring, sector, strip)) continue; - + if (param->IsDead(detector, ring, sector, strip)) { + AliDebug(5, Form("FMD%d%c[%2d,%3d] is marked as dead", + detector, ring, sector, strip)); + continue; + } + // Check if strip is out-side read-out range + if (strip < minstrip || strip > maxstrip) { + AliDebug(5, Form("FMD%d%c[%2d,%3d] is outside range [%3d,%3d]", + detector, ring, sector, strip, minstrip, maxstrip)); + continue; + } + // Give warning in case of double hit if (fEdep(detector, ring, sector, strip).fEdep != 0) AliDebug(5, Form("Double hit in %d%c(%d,%d)", @@ -458,7 +472,7 @@ AliFMDBaseDigitizer::ConvertToCount(Float_t edep, Float_t convF = 1/param->GetPulseGain(detector,ring,sector,strip); UShort_t ped = MakePedestal(detector,ring,sector,strip); UInt_t maxAdc = param->GetAltroChannelSize(); - UShort_t rate = param->GetSampleRate(AliFMDParameters::kBaseDDL); + UShort_t rate = param->GetSampleRate(detector,ring,sector,strip); UShort_t size = param->GetAltroChannelSize(); // In case we don't oversample, just return the end value. diff --git a/FMD/AliFMDDigitizer.h b/FMD/AliFMDDigitizer.h index 092360cb804..10a369e4d23 100644 --- a/FMD/AliFMDDigitizer.h +++ b/FMD/AliFMDDigitizer.h @@ -5,6 +5,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDDigitizer.h + @author Christian Holm Christensen + @date Mon Mar 27 12:38:26 2006 + @brief FMD Digitizers declaration +*/ #ifndef ALIDIGITIZER_H # include #endif diff --git a/FMD/AliFMDDisplay.cxx b/FMD/AliFMDDisplay.cxx index a4c4ed8a6bd..eae7fa01499 100644 --- a/FMD/AliFMDDisplay.cxx +++ b/FMD/AliFMDDisplay.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDDisplay.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:39:09 2006 + @brief FMD Event display +*/ //___________________________________________________________________ // // The classes defined here, are utility classes for reading in data diff --git a/FMD/AliFMDDisplay.h b/FMD/AliFMDDisplay.h index 455533f725f..3ace7ddc8d0 100644 --- a/FMD/AliFMDDisplay.h +++ b/FMD/AliFMDDisplay.h @@ -5,6 +5,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDDisplay.h + @author Christian Holm Christensen + @date Mon Mar 27 12:39:09 2006 + @brief FMD Event display +*/ //___________________________________________________________________ // // The classes defined here, are utility classes for reading in data diff --git a/FMD/AliFMDEdepMap.cxx b/FMD/AliFMDEdepMap.cxx index e6872b06ef7..ec7625ccd3b 100644 --- a/FMD/AliFMDEdepMap.cxx +++ b/FMD/AliFMDEdepMap.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDEdepMap.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:39:50 2006 + @brief Per strip map of energy deposited and number of hits +*/ //____________________________________________________________________ // // diff --git a/FMD/AliFMDEdepMap.h b/FMD/AliFMDEdepMap.h index 882661d7ff1..850f4162898 100644 --- a/FMD/AliFMDEdepMap.h +++ b/FMD/AliFMDEdepMap.h @@ -5,11 +5,16 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDEdepMap.h + @author Christian Holm Christensen + @date Mon Mar 27 12:39:50 2006 + @brief Per strip map of energy deposited and number of hits +*/ #ifndef ALIFMDMAP_H # include "AliFMDMap.h" #endif //____________________________________________________________________ -/** Cache of Energy deposited, hit information per strip. +/** @brief Cache of Energy deposited, hit information per strip. Contains a pair of energy deposited @c fEdep and number of hits @c fN, @c fEdep is the summed energy deposition, and @c fN is the number of hits @@ -36,7 +41,7 @@ public: }; //____________________________________________________________________ -/** Map of Energy deposited, hit information per strip. +/** @brief Map of Energy deposited, hit information per strip. Contains a pair of energy deposited @c fEdep and number of hits @c fN, @c fEdep is the summed energy deposition, and @c fN is the number of hits */ diff --git a/FMD/AliFMDGeometry.cxx b/FMD/AliFMDGeometry.cxx index aa637539e80..7740c2b9c26 100644 --- a/FMD/AliFMDGeometry.cxx +++ b/FMD/AliFMDGeometry.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDGeometry.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:40:37 2006 + @brief Geometry mananger for the FMD +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. diff --git a/FMD/AliFMDGeometry.h b/FMD/AliFMDGeometry.h index 98da215aca3..90c3dc1f132 100644 --- a/FMD/AliFMDGeometry.h +++ b/FMD/AliFMDGeometry.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDGeometry.h + @author Christian Holm Christensen + @date Mon Mar 27 12:40:37 2006 + @brief Geometry mananger for the FMD +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. @@ -35,7 +40,7 @@ class AliFMDGeometryBuilder; //__________________________________________________________________ -/** Singleton object of FMD geometry descriptions and parameters. +/** @brief Singleton object of FMD geometry descriptions and parameters. This class is a singleton that handles the geometry parameters of the FMD detectors. diff --git a/FMD/AliFMDGeometryBuilder.cxx b/FMD/AliFMDGeometryBuilder.cxx index 1ebe19a332d..cdacecc57d3 100644 --- a/FMD/AliFMDGeometryBuilder.cxx +++ b/FMD/AliFMDGeometryBuilder.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDGeometryBuilder.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:41:17 2006 + @brief Class to build the FMD geometry +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. This class diff --git a/FMD/AliFMDGeometryBuilder.h b/FMD/AliFMDGeometryBuilder.h index 11711302337..2a77662d5f8 100644 --- a/FMD/AliFMDGeometryBuilder.h +++ b/FMD/AliFMDGeometryBuilder.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDGeometryBuilder.h + @author Christian Holm Christensen + @date Mon Mar 27 12:41:17 2006 + @brief Class to build the FMD geometry +*/ #ifndef ROOT_TTask # include #endif diff --git a/FMD/AliFMDHit.cxx b/FMD/AliFMDHit.cxx index a94bcc94a21..f2b1147cdfc 100644 --- a/FMD/AliFMDHit.cxx +++ b/FMD/AliFMDHit.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDHit.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:41:58 2006 + @brief Hit in the FMD +*/ //____________________________________________________________________ // // Hits in the FMD diff --git a/FMD/AliFMDHit.h b/FMD/AliFMDHit.h index fe6e87b146c..0acc7778c00 100644 --- a/FMD/AliFMDHit.h +++ b/FMD/AliFMDHit.h @@ -5,6 +5,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDHit.h + @author Christian Holm Christensen + @date Mon Mar 27 12:41:58 2006 + @brief Hit in the FMD +*/ //___________________________________________________________________ // #ifndef ALIHIT_H @@ -12,10 +17,10 @@ #endif //___________________________________________________________________ -/** AliFMDhit is the hit class for the FMD. Hits are the information - that comes from a Monte Carlo at each step as a particle mass - through sensitive detector elements as particles are transported - through a detector. +/** @brief AliFMDhit is the hit class for the FMD. + Hits are the information that comes from a Monte Carlo at each + step as a particle mass through sensitive detector elements as + particles are transported through a detector. @ingroup FMD_sim */ class AliFMDHit : public AliHit diff --git a/FMD/AliFMDInput.cxx b/FMD/AliFMDInput.cxx index a6592640e24..6fcba8f5d21 100644 --- a/FMD/AliFMDInput.cxx +++ b/FMD/AliFMDInput.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDInput.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:42:40 2006 + @brief FMD utility classes for reading FMD data +*/ //___________________________________________________________________ // // The classes defined here, are utility classes for reading in data @@ -179,9 +182,13 @@ AliFMDInput::Init() // Optionally, get the ESD files if (TESTBIT(fTreeMask, kESD)) { fChainE = new TChain("esdTree"); - TSystemDirectory dir; + TSystemDirectory dir(".","."); TList* files = dir.GetListOfFiles(); - TSystemFile* file; + TSystemFile* file = 0; + if (!files) { + AliError("No files"); + return kFALSE; + } files->Sort(); TIter next(files); while ((file = static_cast(next()))) { diff --git a/FMD/AliFMDInput.h b/FMD/AliFMDInput.h index 7434a3bfcad..904283cf7f9 100644 --- a/FMD/AliFMDInput.h +++ b/FMD/AliFMDInput.h @@ -5,6 +5,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDInput.h + @author Christian Holm Christensen + @date Mon Mar 27 12:42:40 2006 + @brief FMD utility classes for reading FMD data +*/ //___________________________________________________________________ /** @defgroup FMD_util Utility classes. @@ -215,9 +220,13 @@ protected: //____________________________________________________________________ class AliFMDHit; +/** @brief Class to read FMD hits + */ class AliFMDInputHits : public AliFMDInput { public: + /** Constructor + @param file Name of @c gAlice file */ AliFMDInputHits(const char* file="galice.root") : AliFMDInput(file) { AddLoad(kHits); } ClassDef(AliFMDInputHits, 0); @@ -225,9 +234,13 @@ public: //____________________________________________________________________ class AliFMDDigit; +/** @brief Class to read FMD digits + */ class AliFMDInputDigits : public AliFMDInput { public: + /** Constructor + @param file Name of @c gAlice file */ AliFMDInputDigits(const char* file="galice.root") : AliFMDInput(file) { AddLoad(kDigits); } ClassDef(AliFMDInputDigits, 0); @@ -235,18 +248,26 @@ public: //____________________________________________________________________ class AliFMDSDigit; +/** @brief Class to read FMD summable digits + */ class AliFMDInputSDigits : public AliFMDInput { public: + /** Constructor + @param file Name of @c gAlice file */ AliFMDInputSDigits(const char* file="galice.root") : AliFMDInput(file) { AddLoad(kSDigits); } ClassDef(AliFMDInputSDigits, 0); }; //____________________________________________________________________ +/** @brief Class to read FMD raw data + */ class AliFMDInputRaw : public AliFMDInput { public: + /** Constructor + @param file Name of @c gAlice file */ AliFMDInputRaw(const char* file="galice.root") : AliFMDInput(file) { AddLoad(kRaw); } ClassDef(AliFMDInputRaw, 0); @@ -254,9 +275,13 @@ public: //____________________________________________________________________ class AliFMDRecPoint; +/** @brief Class to read FMD reconstructed data + */ class AliFMDInputRecPoints : public AliFMDInput { public: + /** Constructor + @param file Name of @c gAlice file */ AliFMDInputRecPoints(const char* file="galice.root") : AliFMDInput(file) { AddLoad(kRecPoints); } ClassDef(AliFMDInputRecPoints, 0); diff --git a/FMD/AliFMDParameters.cxx b/FMD/AliFMDParameters.cxx index d7bff74ef9e..999ae96a424 100644 --- a/FMD/AliFMDParameters.cxx +++ b/FMD/AliFMDParameters.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDParameters.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:44:26 2006 + @brief Manager of FMD parameters +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. @@ -30,7 +33,8 @@ #include "AliFMDRing.h" // ALIFMDRING_H #include "AliFMDCalibGain.h" // ALIFMDCALIBGAIN_H #include "AliFMDCalibPedestal.h" // ALIFMDCALIBPEDESTAL_H -#include "AliFMDCalibSampleRate.h" // ALIFMDCALIBPEDESTAL_H +#include "AliFMDCalibSampleRate.h" // ALIFMDCALIBSAMPLERATE_H +#include "AliFMDCalibStripRange.h" // ALIFMDCALIBSTRIPRANGE_H #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H #include // ALICDBMANAGER_H #include // ALICDBMANAGER_H @@ -52,6 +56,7 @@ const char* AliFMDParameters::fgkDead = "FMD/Calib/Dead"; const char* AliFMDParameters::fgkSampleRate = "FMD/Calib/SampleRate"; const char* AliFMDParameters::fgkAltroMap = "FMD/Calib/AltroMap"; const char* AliFMDParameters::fgkZeroSuppression = "FMD/Calib/ZeroSuppression"; +const char* AliFMDParameters::fgkStripRange = "FMD/Calib/StripRange"; //____________________________________________________________________ @@ -74,7 +79,8 @@ AliFMDParameters::AliFMDParameters() fPedestal(0), fPulseGain(0), fDeadMap(0), - fAltroMap(0) + fAltroMap(0), + fStripRange(0) { // Default constructor SetVA1MipRange(); @@ -86,6 +92,7 @@ AliFMDParameters::AliFMDParameters() SetPedestalWidth(); SetPedestalFactor(); SetThreshold(); + SetStripRange(); } //__________________________________________________________________ @@ -104,6 +111,65 @@ AliFMDParameters::Init() fIsInit = kTRUE; } + +//__________________________________________________________________ +void +AliFMDParameters::Print(Option_t* option) const +{ + TString opt(option); + Bool_t showStrips = opt.Contains("a", TString::kIgnoreCase); + for (UShort_t det=1 ; det <= 3; det++) { + std::cout << "FMD" << det << std::endl; + Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' }; + for (Char_t* ring = rings; *ring != '\0'; ring++) { + std::cout << " Ring " << *ring << std::endl; + UShort_t nSec = ( *ring == 'I' ? 20 : 40 ); + UShort_t nStr = ( *ring == 'I' ? 512 : 256 ); + for (UShort_t sec = 0; sec < nSec; sec++) { + UShort_t min = GetMinStrip(det, *ring, sec, 0); + UShort_t max = GetMaxStrip(det, *ring, sec, 0); + UShort_t rate = GetSampleRate(det, *ring, sec, 0); + std::cout << " Sector " << std::setw(2) << sec + << " Strip range: " << std::setw(3) << min << "," + << std::setw(3) << max << " Rate: " << std::setw(2) + << rate << std::endl; + if (!showStrips) continue; + std::cout + << " Strip | Pedestal | Gain | ZS thr. | Address\n" + << "--------+-------------------+----------+---------+---------" + << std::endl; + for (UShort_t str = 0; str < nStr; str++) { + std::cout << " " << std::setw(3) << str << " | "; + if (IsDead(det, *ring, sec, str)) { + std::cout << "dead" << std::endl; + continue; + } + UInt_t ddl, addr; + Detector2Hardware(det, *ring, sec, str, ddl, addr); + std::cout << std::setw(7) << GetPedestal(det, *ring, sec, str) + << "+/-" << std::setw(7) + << GetPedestalWidth(det, *ring, sec, str) + << " | " << std::setw(8) + << GetPulseGain(det, *ring, sec, str) + << " | " << std::setw(5) + << GetZeroSuppression(det, *ring, sec, str) + << " | 0x" << std::hex << std::setw(4) + << std::setfill('0') << ddl << ",0x" << std::setw(3) + << addr << std::dec << std::setfill(' ') << std::endl; + } + } + } + } +} + +//__________________________________________________________________ +void +AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) +{ + fFixedMinStrip = min; + fFixedMaxStrip = max; +} + //__________________________________________________________________ void AliFMDParameters::InitPulseGain() @@ -205,6 +271,22 @@ AliFMDParameters::InitAltroMap() } } +//__________________________________________________________________ +void +AliFMDParameters::InitStripRange() +{ + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBEntry* range = cdb->Get(fgkStripRange); + if (!range) { + AliWarning(Form("No %s found in CDB, perhaps you need to " + "use AliFMDCalibFaker?", fgkStripRange)); + return; + } + AliDebug(1, Form("Got strip range from CDB")); + fStripRange = dynamic_cast(range->GetObject()); + if (!fStripRange) AliWarning("Invalid strip range object from CDB"); +} + //__________________________________________________________________ Float_t @@ -268,12 +350,41 @@ AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring, //__________________________________________________________________ UShort_t -AliFMDParameters::GetSampleRate(UShort_t ddl) const +AliFMDParameters::GetSampleRate(UShort_t det, Char_t ring, UShort_t sector, + UShort_t str) const { if (!fSampleRate) return fFixedSampleRate; // Need to map sector to digitizier card. - AliDebug(50, Form("Sample rate for %d=%d", ddl, fSampleRate->Rate(ddl))); - return fSampleRate->Rate(ddl); + UInt_t ret = fSampleRate->Rate(det, ring, sector, str); + AliDebug(50, Form("Sample rate for FMD%d%c[%2d,%3d]=%d", + det, ring, sector, str, ret)); + return ret; +} + +//__________________________________________________________________ +UShort_t +AliFMDParameters::GetMinStrip(UShort_t det, Char_t ring, UShort_t sector, + UShort_t str) const +{ + if (!fStripRange) return fFixedMinStrip; + // Need to map sector to digitizier card. + UInt_t ret = fStripRange->Min(det, ring, sector, str); + AliDebug(50, Form("Min strip # for FMD%d%c[%2d,%3d]=%d", + det, ring, sector, str, ret)); + return ret; +} + +//__________________________________________________________________ +UShort_t +AliFMDParameters::GetMaxStrip(UShort_t det, Char_t ring, UShort_t sector, + UShort_t str) const +{ + if (!fStripRange) return fFixedMaxStrip; + // Need to map sector to digitizier card. + UInt_t ret = fStripRange->Max(det, ring, sector, str); + AliDebug(50, Form("Max strip # for FMD%d%c[%2d,%3d]=%d", + det, ring, sector, str, ret)); + return ret; } //__________________________________________________________________ diff --git a/FMD/AliFMDParameters.h b/FMD/AliFMDParameters.h index 423bd26ebfc..0e50bc774be 100644 --- a/FMD/AliFMDParameters.h +++ b/FMD/AliFMDParameters.h @@ -7,7 +7,11 @@ * * See cxx source for full Copyright notice */ - +/** @file AliFMDParameters.h + @author Christian Holm Christensen + @date Mon Mar 27 12:44:43 2006 + @brief Manager of FMD parameters +*/ //____________________________________________________________________ // // Singleton class to handle various parameters (not geometry) of the @@ -31,12 +35,14 @@ typedef AliFMDBoolMap AliFMDCalibDeadMap; class AliFMDCalibPedestal; class AliFMDCalibGain; class AliFMDCalibSampleRate; +class AliFMDCalibStripRange; class AliFMDAltroMapping; -/** This class is a singleton that handles various parameters of the - FMD detectors. This class reads from the Conditions DB to get the - various parameters, which code can then request from here. In that - way, all code uses the same data, and the interface is consistent. +/** @brief This class is a singleton that handles various parameters + of the FMD detectors. + This class reads from the Conditions DB to get the various + parameters, which code can then request from here. In that way, + all code uses the same data, and the interface is consistent. Some of the parameter managed are - @c fPedestal, @c fPedestalWidth @@ -71,62 +77,165 @@ public: CDB. If that fails, the class uses the hard-coded parameters. */ void Init(); + /** Print all parameters. + @param option Option string */ + void Print(Option_t* option="A") const; /** @{ */ /** @name Set various `Fixed' parameters */ + /** @param r How many MIP signals we can fit in the VA1 + pre-amps. (default and design is 20) */ void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; } + /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit + ADC so, the maximum number is 1024 */ void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;} + /** @param size The number of strips multiplexed into one ALTRO + channel. That is, how many strips is connected to one VA1 + pre-amp. */ void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; } + /** @param f Factor to use for accepting a signal. */ void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; } /** @} */ /** @{ */ /** @name Set various variable parameter defaults */ + /** @param s Zero suppression threshold in ADC counts */ void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; } + /** @param r How many times we oversample each strip. */ void SetSampleRate(UShort_t r=1) { fFixedSampleRate = (r>2?2:r);} + /** @param p Pedestal value in ADC counts */ void SetPedestal(Float_t p=10) { fFixedPedestal = p; } + /** @param w Pedestal width in ADC counts */ void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; } + /** @param t Threshold used for 1 MIP acceptance. */ void SetThreshold(Float_t t=0) { fFixedThreshold = t; } + /** Range of strips read out + @param min Minimum strip number (0-127). + @param max Maximum strip number (0-127). */ + void SetStripRange(UShort_t min=0, UShort_t max=127); /** @} */ /** @{ */ /** @name Get `Fixed' various parameters */ + /** @return Number of MIP signals that fit inside a VA1 channel */ UShort_t GetVA1MipRange() const { return fVA1MipRange; } + /** @return The maximum count in the ADC */ UShort_t GetAltroChannelSize() const { return fAltroChannelSize; } + /** @return Number of strips muliplexed into one ADC channel */ UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; } + /** @return The average energy deposited by one MIP */ Float_t GetEdepMip() const; + /** @return The factor used of signal acceptance */ Float_t GetPedestalFactor() const { return fPedestalFactor; } /** @} */ /** @{ */ /** @name Get variable parameters */ + /** Whether the strip is considered dead + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return @c true if the strip is considered dead, @c false if + it's OK. */ Bool_t IsDead(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const; Float_t GetThreshold() const; + /** Gain of pre-amp. + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return Gain of pre-amp. */ Float_t GetPulseGain(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const; + /** Get mean of pedestal + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return Mean of pedestal */ Float_t GetPedestal(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const; + /** Width of pedestal + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return Width of pedestal */ Float_t GetPedestalWidth(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const; + /** zero suppression threshold (in ADC counts) + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return zero suppression threshold (in ADC counts) */ UShort_t GetZeroSuppression(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const; - UShort_t GetSampleRate(UShort_t ddl) const; - + /** Get the sampling rate + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return The sampling rate */ + UShort_t GetSampleRate(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip) const; + /** Get the minimum strip in the read-out range + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return Minimum strip */ + UShort_t GetMinStrip(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip) const; + /** Get the maximum strip in the read-out range + @param detector Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sector Sector number (0-39) + @param strip Strip number (0-511) + @return Maximum strip */ + UShort_t GetMaxStrip(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip) const; + /** Translate hardware address to detector coordinates + @param ddl DDL number + @param addr Hardware address + @param det On return, Detector # (1-3) + @param ring On return, Ring ID ('I' or 'O') + @param sec On return, Sector number (0-39) + @param str On return, Strip number (0-511) + @return @c true on success. */ Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det, Char_t& ring, UShort_t& sec, UShort_t& str) const; + /** Translate detector coordinates to hardware address + @param det Detector # (1-3) + @param ring Ring ID ('I' or 'O') + @param sec Sector number (0-39) + @param str Strip number (0-511) + @param ddl On return, DDL number + @param addr On return, Hardware address + @return @c true on success. */ Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UInt_t& ddl, UInt_t& addr) const; + /** Get the map that translates hardware to detector coordinates + @return Get the map that translates hardware to detector + coordinates */ AliFMDAltroMapping* GetAltroMap() const; /** @} */ @@ -139,6 +248,7 @@ public: static const char* fgkSampleRate; // Path to SampleRate calib object static const char* fgkAltroMap; // Path to AltroMap calib object static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object + static const char* fgkStripRange; // Path to strip range cal object protected: /** CTOR */ AliFMDParameters(); @@ -158,6 +268,8 @@ protected: void InitZeroSuppression(); /** Initialize hardware map. Try to get it from CDB */ void InitAltroMap(); + /** Initialize strip range. Try to get it from CDB */ + void InitStripRange(); Bool_t fIsInit; // Whether we've been initialised @@ -172,6 +284,8 @@ protected: UShort_t fFixedZeroSuppression; // Threshold for zero-suppression UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp. Float_t fFixedThreshold; // + UShort_t fFixedMinStrip; + UShort_t fFixedMaxStrip; mutable Float_t fFixedPulseGain; //! Gain (cached) mutable Float_t fEdepMip; //! Cache of energy loss for a MIP @@ -181,8 +295,9 @@ protected: AliFMDCalibGain* fPulseGain; // Pulser gain AliFMDCalibDeadMap* fDeadMap; // Pulser gain AliFMDAltroMapping* fAltroMap; // Map of hardware + AliFMDCalibStripRange* fStripRange; // Strip range - ClassDef(AliFMDParameters,3) + ClassDef(AliFMDParameters,4) }; #endif diff --git a/FMD/AliFMDRawReader.cxx b/FMD/AliFMDRawReader.cxx index 9b6bccd6371..a730238e2d7 100644 --- a/FMD/AliFMDRawReader.cxx +++ b/FMD/AliFMDRawReader.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDRawReader.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:45:23 2006 + @brief Class to read raw data +*/ //____________________________________________________________________ // // Class to read ADC values from a AliRawReader object. @@ -48,7 +51,7 @@ #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H #include "AliRawReader.h" // ALIRAWREADER_H #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H -#include "AliFMDAltroIO.h" // ALIFMDALTROIO_H +// #include "AliFMDAltroIO.h" // ALIFMDALTROIO_H #include // ROOT_TArrayI #include // ROOT_TTree #include // ROOT_TClonesArray @@ -75,6 +78,89 @@ AliFMDRawReader::AliFMDRawReader(AliRawReader* reader, TTree* tree) // Default CTOR } +//____________________________________________________________________ +void +AliFMDRawReader::Exec(Option_t*) +{ + TClonesArray* array = new TClonesArray("AliFMDDigit"); + if (!fTree) { + AliError("No tree"); + return; + } + fTree->Branch("FMD", &array); + ReadAdcs(array); + Int_t nWrite = fTree->Fill(); + AliDebug(1, Form("Got a grand total of %d digits, wrote %d bytes to tree", + array->GetEntries(), nWrite)); +} + + +#if 1 +//____________________________________________________________________ +Bool_t +AliFMDRawReader::ReadAdcs(TClonesArray* array) +{ + // Read raw data into the digits array, using AliFMDAltroReader. + if (!array) { + AliError("No TClonesArray passed"); + return kFALSE; + } + if (!fReader->ReadHeader()) { + AliError("Couldn't read header"); + return kFALSE; + } + // Get sample rate + AliFMDParameters* pars = AliFMDParameters::Instance(); + AliFMDRawStream input(fReader); + // Select FMD DDL's + fReader->Select(AliFMDParameters::kBaseDDL>>8); + + UShort_t stripMin = 0; + UShort_t stripMax = 127; + UShort_t preSamp = 0; + + UInt_t ddl = 0; + UInt_t rate = 0; + UInt_t last = 0; + UInt_t hwaddr = 0; + // Data array is approx twice the size needed. + UShort_t data[2048]; + while (input.ReadChannel(ddl, hwaddr, last, data)) { + AliDebug(5, Form("Read channel 0x%x of size %d", hwaddr, last)); + UShort_t det, sec, str; + Char_t ring; + if (!pars->Hardware2Detector(ddl, hwaddr, det, ring, sec, str)) { + AliError(Form("Failed to get detector id from DDL %d " + "and hardware address 0x%x", ddl, hwaddr)); + continue; + } + rate = pars->GetSampleRate(det, ring, sec, str); + stripMin = pars->GetMinStrip(det, ring, sec, str); + stripMax = pars->GetMaxStrip(det, ring, sec, str); + AliDebug(5, Form("DDL 0x%04x, address 0x%03x maps to FMD%d%c[%2d,%3d]", + ddl, hwaddr, det, ring, sec, str)); + + // Loop over the `timebins', and make the digits + for (size_t i = 0; i < last; i++) { + if (i < preSamp) continue; + Int_t n = array->GetEntries(); + UShort_t curStr = str + stripMin + i / rate; + if ((curStr-str) > stripMax) { + AliError(Form("Current strip is %d but DB says max is %d", + curStr, stripMax)); + } + AliDebug(5, Form("making digit for FMD%d%c[%2d,%3d] from sample %4d", + det, ring, sec, curStr, i)); + new ((*array)[n]) AliFMDDigit(det, ring, sec, curStr, data[i], + (rate >= 2 ? data[i+1] : 0), + (rate >= 3 ? data[i+2] : 0)); + if (rate >= 2) i++; + if (rate >= 3) i++; + } + } + return kTRUE; +} +#else //____________________________________________________________________ Bool_t AliFMDRawReader::ReadAdcs(TClonesArray* array) @@ -103,7 +189,7 @@ AliFMDRawReader::ReadAdcs(TClonesArray* array) if (!fReader->ReadNextData(cdata)) break; size_t nchar = fReader->GetDataSize(); UShort_t ddl = AliFMDParameters::kBaseDDL + fReader->GetDDLID(); - UShort_t rate = pars->GetSampleRate(ddl); + UShort_t rate = 0; AliDebug(1, Form("Reading %d bytes (%d 10bit words) from %d", nchar, nchar * 8 / 10, ddl)); // Make a stream to read from @@ -122,6 +208,9 @@ AliFMDRawReader::ReadAdcs(TClonesArray* array) "and hardware address 0x%x", ddl, hwaddr)); continue; } + rate = pars->GetSampleRate(det, ring, sec, str); + stripMin = pars->GetMinStrip(det, ring, sec, str); + stripMax = pars->GetMaxStrip(det, ring, sec, str); AliDebug(5, Form("DDL 0x%04x, address 0x%03x maps to FMD%d%c[%2d,%3d]", ddl, hwaddr, det, ring, sec, str)); @@ -150,23 +239,6 @@ AliFMDRawReader::ReadAdcs(TClonesArray* array) -//____________________________________________________________________ -void -AliFMDRawReader::Exec(Option_t*) -{ - TClonesArray* array = new TClonesArray("AliFMDDigit"); - if (!fTree) { - AliError("No tree"); - return; - } - fTree->Branch("FMD", &array); - ReadAdcs(array); - Int_t nWrite = fTree->Fill(); - AliDebug(1, Form("Got a grand total of %d digits, wrote %d bytes to tree", - array->GetEntries(), nWrite)); -} - -#if 0 // This is the old method, for comparison. It's really ugly, and far // too convoluted. //____________________________________________________________________ diff --git a/FMD/AliFMDRawReader.h b/FMD/AliFMDRawReader.h index e8275395cd9..483a5a8d9ed 100644 --- a/FMD/AliFMDRawReader.h +++ b/FMD/AliFMDRawReader.h @@ -8,6 +8,11 @@ * See cxx source for full Copyright notice */ /* $Id$ */ +/** @file AliFMDRawReader.h + @author Christian Holm Christensen + @date Mon Mar 27 12:45:23 2006 + @brief Class to read raw data +*/ //____________________________________________________________________ // // Class to read ADC values from a AliRawReader object. diff --git a/FMD/AliFMDRawStream.cxx b/FMD/AliFMDRawStream.cxx index c33ad39286c..6eac519578a 100644 --- a/FMD/AliFMDRawStream.cxx +++ b/FMD/AliFMDRawStream.cxx @@ -27,6 +27,7 @@ // #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H #include // ALIRAWREADER_H +#include "AliFMDParameters.h" #include #include #include @@ -38,197 +39,47 @@ ClassImp(AliFMDRawStream) #endif //____________________________________________________________________ -AliFMDRawStream::AliFMDRawStream(AliRawReader* reader, UShort_t sampleRate) - : AliAltroRawStream(reader), - fSampleRate(sampleRate), - fPrevTime(-1), - fExplicitSampleRate(kFALSE), - fPos(0), - fCur(0), - fRead(0) +AliFMDRawStream::AliFMDRawStream(AliRawReader* reader) + : AliAltroRawStream(reader) { - if (fSampleRate > 0) fExplicitSampleRate = kTRUE; -} - -//_____________________________________________________________________________ -Int_t -AliFMDRawStream::ReadTrailer(UInt_t& addr, UInt_t& len) -{ - if (fPos <= 0) return 0; - if (fPos < 4) { - AliError("could not read trailer"); - return -1; - } - AliDebug(1, Form("Reading a trailer at %d", fPos)); - Int_t temp = Get10BitWord(); - if (temp != 0x2AA) { - AliError(Form("Incorrect trailer! Expected 0x2AA but got %x!",temp)); - return -1; - } - temp = Get10BitWord(); - if ((temp >> 6) != 0xA) { - AliError(Form("Incorrect trailer! Expected 0xA but got %x!",temp >> 6)); - return -1; - } - - len = (temp << 4) & 0x3FF; - temp = Get10BitWord(); - len |= (temp >> 6); - if (((temp >> 2) & 0xF) != 0xA) { - AliError(Form("Incorrect trailer! Expected 0xA but got %x!",temp >> 6)); - return -1; - } - addr = (temp & 0x3) << 10; - temp = Get10BitWord(); - addr |= temp; - - return 4; -} - -//_____________________________________________________________________________ -Int_t -AliFMDRawStream::ReadFillWords(UInt_t len) -{ - if (len % 4 == 0) return 0; - Int_t nFill = (4 - (len % 4)) % 4; - AliDebug(1, Form("Reading %d fill words", nFill)); - for (Int_t i = 0; i < nFill; i++) { - UInt_t fill = Get10BitWord(); - if (fill != 0x2AA) { - AliError(Form("Invalid fill! Expected 0x2AA, but got %X!", fill)); - return -1; - } - } - return nFill; -} - -//_____________________________________________________________________________ -Int_t -AliFMDRawStream::ReadBunch(UShort_t* data) -{ - AliDebug(1, "Reading a bunch"); - if (fPos <= 0) { - AliError("could not read bunch length"); - return -1; - } - UShort_t len = Get10BitWord(); - if (fPos <= 0) { - AliError("could not read bunch length"); - return -1; - } - UShort_t time = Get10BitWord(); - - AliDebug(1, Form("Bunch is %d long and ends at t=%d", len, time)); - for (UInt_t i = 2; i < len; i++) { - Int_t amp = Get10BitWord(); - if (amp < 0) { - AliError(Form("Bad adc value (%X) !", amp)); - return -1; - } - data[time - (i-2)] = amp; - } - return len; -} - -//_____________________________________________________________________________ -Int_t -AliFMDRawStream::ReadIntoBuffer() -{ - if (fPos > 0) return kTRUE; - do { - AliDebug(1, Form("Reading into the buffer")); - if (!fRawReader->ReadNextData(fRead)) return -1; - } while (fRawReader->GetDataSize() == 0); - fPos = (fRawReader->GetDataSize() * 8) / 10; - // Skip trailing `0x2AA's - is this needed? Won't it break the - // trailer? -#if 0 - UShort_t skip; - while ((skip = Get10BitWord()) != 0x2AA) - AliDebug(1,Form("Skipping one %x", skip)); -#endif - fPos++; - return fPos; -} - -//_____________________________________________________________________________ -Bool_t -AliFMDRawStream::ReadChannel(UInt_t& addr, UInt_t& len, UShort_t* data) -{ - Int_t ret = 0; - AliDebug(1, "Reading a channel"); - if ((ret = ReadIntoBuffer()) < 0) return kFALSE; - if ((ret = ReadTrailer(addr, len)) < 0) return kFALSE; - if ((ret = ReadFillWords(len)) < 0) return kFALSE; - Int_t toRead = len; - while (toRead > 0) { - if ((ret = ReadBunch(data)) < 0) return kFALSE; - toRead -= ret; - } - len -= 2; - return kTRUE; + fNoAltroMapping = kFALSE; } //_____________________________________________________________________________ Bool_t -AliFMDRawStream::DumpData() +AliFMDRawStream::ReadChannel(UInt_t& ddl, UInt_t& addr, + UInt_t& len, UShort_t* data) { - Int_t ret; - if ((ret = ReadIntoBuffer()) < 0) return kFALSE; - UShort_t data; - Int_t i = 0; - while ((data = Get10BitWord()) != 0xffff) { - if (i % 4 == 0) { - if (i != 0) std::cout << "\n"; - std::cout << std::setw(6) << i << ":"; + UInt_t prevddl = 0; + Int_t l = 0; + static Int_t last = 0xFFFF; // 0xFFFF means signal is used + Bool_t next = kTRUE; + do { + Int_t signal = last; + if (last > 0x3FF) { + AliDebug(30, Form("Last is 0x%x, so reading a new word", last)); + next = Next(); + if (!next) break; + signal = GetSignal(); + if (GetHWAddress() != GetPrevHWAddress() && GetPrevHWAddress() >= 0) { + AliDebug(15, Form("New hardware address, was 0x%x, now 0x%x", + GetPrevHWAddress(), GetHWAddress())); + addr = GetPrevHWAddress(); + ddl = AliFMDParameters::kBaseDDL + prevddl; + len = l+1; + last = signal; + break; + } } - std::cout << " 0x" << std::setfill('0') << std::setw(3) - << std::hex << data << std::dec << std::setfill(' ') - << std::flush; - i++; - } - return kTRUE; + prevddl = fRawReader->GetDDLID(); + Int_t t = GetTime(); + l = TMath::Max(l, t); + data[t] = signal; + last = 0xFFFF; + } while (next); + return next; } -//_____________________________________________________________________________ -UShort_t -AliFMDRawStream::Get10BitWord() -{ - // return a word in a 10 bit array as an UShort_t - --fPos; - if (fPos < 0) { - AliWarning("At high water mark"); - return 0xFFFF; - } - Int_t iBit = fPos * 10; - Int_t iByte = iBit / 8; - Int_t shift = iBit % 8; - // return ((buffer[iByte+1] * 256 + buffer[iByte]) >> shift) & 0x03FF; - - // recalculate the byte numbers and the shift because - // the raw data is written as integers where the high bits are filled first - // -> little endian is assumed here ! - Int_t iByteHigh = 4 * (iByte / 4) + 3 - (iByte % 4); - iByte++; - Int_t iByteLow = 4 * (iByte / 4) + 3 - (iByte % 4); - shift = 6 - shift; - return ((fRead[iByteHigh] * 256 + fRead[iByteLow]) >> shift) & 0x03FF; -} - -//_____________________________________________________________________________ -Bool_t -AliFMDRawStream::Next() -{ - // read the next raw digit - // returns kFALSE if there is no digit left - fPrevTime = fTime; - if (AliAltroRawStream::Next()) { - if (!fExplicitSampleRate && fPrevPad != fPad) - fSampleRate = fTimeBunch / 128; - return kTRUE; - } - return kFALSE; -} //_____________________________________________________________________________ // diff --git a/FMD/AliFMDRawStream.h b/FMD/AliFMDRawStream.h index 413874702cb..e0efc7dcf8e 100644 --- a/FMD/AliFMDRawStream.h +++ b/FMD/AliFMDRawStream.h @@ -7,56 +7,54 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDRawStream.h + @author Christian Holm Christensen + @date Tue Mar 28 12:53:26 2006 + @brief Class to read ALTRO formated data from an AliRawReader. +*/ #ifndef ALIALTRORAWSTREAM_H # include #endif -// TPC to FMD translations -// -// TPC FMD -// ----------+----------- -// pad+time | strip -// row | sector -// sector | ring -// +/** @class AliFMDRawStream + @brief Class to read ALTRO formated data from an AliRawReader. + This class is mostly here to set + AliAltroRawStream::fNoAltroMapping to false. Furthermore, it + defines the utility function ReadChannel to read in a full ALTRO + channel. The data is unpacked into the passed array. + */ class AliFMDRawStream : public AliAltroRawStream { public: - AliFMDRawStream(AliRawReader* reader, UShort_t sampleRate=0); + /** Constructor + @param reader Raw reader to use */ + AliFMDRawStream(AliRawReader* reader); + /** Destructor */ virtual ~AliFMDRawStream() {} - Short_t Sector() const { return fRow; } - Char_t Ring() const { return (fSector == 0 ? 'I' : 'O'); } - Short_t Strip() const { return fPad + fTime / fSampleRate; } - Short_t Sample() const { return fTime % fSampleRate; } - Short_t PrevSector() const { return fPrevRow; } - Char_t PrevRing() const { return (fPrevSector == 0 ? 'I' : 'O'); } - Short_t PrevStrip() const { return fPrevPad + fPrevTime/fSampleRate; } - - Bool_t IsNewRing() const { return (fSector != fPrevSector); } - Bool_t IsNewSector() const { return (fRow != fPrevRow) || IsNewRing(); } - Bool_t IsNewStrip() const { return(Strip() != PrevStrip())||IsNewSector();} - - Short_t Count() const { return fSignal; } - Short_t SampleRate() const { return fSampleRate; } - - virtual Bool_t Next(); - virtual Bool_t ReadChannel(UInt_t& addr, UInt_t& len, UShort_t* data); - virtual Bool_t DumpData(); + /** Read one ALTRO channel from the raw reader + @param ddl On return, the DDL + @param addr On return, the hardware address + @param len On return, the number of entries filled in @a data + @param data On return, the read ADC channels. + @return @c true on success */ + virtual Bool_t ReadChannel(UInt_t& ddl, UInt_t& addr, + UInt_t& len, UShort_t* data); protected: - virtual Int_t ReadIntoBuffer(); - virtual Int_t ReadTrailer(UInt_t& head, UInt_t& len); - virtual Int_t ReadFillWords(UInt_t len); - virtual Int_t ReadBunch(UShort_t* data); - virtual UShort_t Get10BitWord(); + /** @{ */ + /** @name Hide base classes `stupid' member functions */ + Int_t GetSector() const { return -1; } + Int_t GetPrevSector() const { return -1; } + Bool_t IsNewSector() const { return kFALSE; } + Int_t GetRow() const { return -1; } + Int_t GetPrevRow() const { return -1; } + Bool_t IsNewRow() const { return kFALSE; } + Int_t GetPad() const { return -1; } + Int_t GetPrevPad() const { return -1; } + Bool_t IsNewPad() const { return kFALSE; } + /** @} */ - UShort_t fSampleRate; // # of ALTRO samples per VA1_ALICE clock - Int_t fPrevTime; // Last time bin - Bool_t fExplicitSampleRate; // True if the sample rate was set externally - Int_t fPos; - Int_t fCur; - UChar_t* fRead; ClassDef(AliFMDRawStream, 0) // Read raw FMD Altro data }; diff --git a/FMD/AliFMDRawWriter.cxx b/FMD/AliFMDRawWriter.cxx index e0aa48a4744..9b3cbadfca0 100644 --- a/FMD/AliFMDRawWriter.cxx +++ b/FMD/AliFMDRawWriter.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDRawWriter.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:45:56 2006 + @brief Class to write raw data +*/ //____________________________________________________________________ // // Class to write ADC values to a raw data file @@ -41,7 +44,7 @@ #include "AliFMDDigit.h" // ALIFMDDIGIT_H #include "AliFMDRawWriter.h" // ALIFMDRAWREADER_H #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H -#include "AliFMDAltroIO.h" // ALIFMDALTROWRITER_H +// #include "AliFMDAltroIO.h" // ALIFMDALTROWRITER_H #include // ROOT_TArrayI #include // ROOT_TClonesArray #include @@ -56,11 +59,7 @@ ClassImp(AliFMDRawWriter) AliFMDRawWriter::AliFMDRawWriter(AliFMD* fmd) : TTask("FMDRawWriter", "Writer of Raw ADC values from the FMD"), fFMD(fmd) -{ - AliFMDParameters* pars = AliFMDParameters::Instance(); - fSampleRate = pars->GetSampleRate(AliFMDParameters::kBaseDDL); - fChannelsPerAltro = pars->GetChannelsPerAltro(); -} +{} //____________________________________________________________________ @@ -105,9 +104,9 @@ AliFMDRawWriter::Exec(Option_t*) // 10-bit word, and the samples are grouped into 40-bit blocks // // +------------------------------------+ - // | S(n) | S(n-1) | S(n-2) | S(n-3) | + // | S(1) | S(2) | S(3) | S(4) | // | ... | ... | ... | ... | - // | S(2) | S(1) | AA | AA | + // | S(n) | T(n) | n+2 | 2AA | // +------------------------------------+ // Counts + possible filler // @@ -116,7 +115,7 @@ AliFMDRawWriter::Exec(Option_t*) // words, packed into 40-bits. // // +------------------------------------+ - // | # words | start | sector | ring | + // | 2AAA | Len | A | Address | // +------------------------------------+ // Trailer // @@ -150,6 +149,111 @@ AliFMDRawWriter::Exec(Option_t*) loader->UnloadDigits(); } +#if 1 +//____________________________________________________________________ +void +AliFMDRawWriter::WriteDigits(TClonesArray* digits) +{ + Int_t nDigits = digits->GetEntries(); + if (nDigits < 1) return; + + AliFMDParameters* pars = AliFMDParameters::Instance(); + UShort_t threshold = 0; + UInt_t prevddl = 0; + UInt_t prevaddr = 0xFFF; + // UShort_t prevStrip = 0; + + // Which channel number in the ALTRO channel we're at + UShort_t nWords = 0; + UShort_t preSamples = 0; + + // How many times the ALTRO Samples one VA1_ALICE channel + Int_t sampleRate = 1; + + // A buffer to hold 1 ALTRO channel - Normally, one ALTRO channel + // holds 128 VA1_ALICE channels, sampled at a rate of `sampleRate' + TArrayI data(pars->GetChannelsPerAltro() * 8); + + // The Altro buffer + AliAltroBuffer* altro = 0; + + // Loop over the digits in the event. Note, that we assume the + // the digits are in order in the branch. If they were not, we'd + // have to cache all channels before we could write the data to + // the ALTRO buffer, or we'd have to set up a map of the digits. + for (Int_t i = 0; i < nDigits; i++) { + // Get the digit + AliFMDDigit* digit = static_cast(digits->At(i)); + + UShort_t det = digit->Detector(); + Char_t ring = digit->Ring(); + UShort_t sector = digit->Sector(); + UShort_t strip = digit->Strip(); + UInt_t ddl; + UInt_t addr; + threshold = pars->GetZeroSuppression(det, ring, sector, strip); + if (!pars->Detector2Hardware(det, ring, sector, strip, ddl, addr)) { + AliError(Form("Failed to get hardware address for FMD%d%c[%2d,%3d]", + det, ring, sector, strip)); + continue; + } + if (addr != prevaddr) { + // Flush a channel to output + AliDebug(15, Form("Now hardware address 0x%x from FMD%d%c[%2d,%3d] " + "(board 0x%x, chip 0x%x, channel 0x%x), flushing old " + "channel at 0x%x with %d words", + addr, det, ring, sector, strip, + (addr >> 7), (addr >> 4) & 0x7, addr & 0xf, + prevaddr, nWords)); + if (altro) altro->WriteChannel(prevaddr,nWords,data.fArray,threshold); + nWords = preSamples; + prevaddr = addr; + for (size_t i = 0; i < nWords; i++) data[i] = digit->Count(0); + } + if (ddl != prevddl) { + AliDebug(15, Form("FMD: New DDL, was %d, now %d", prevddl, ddl)); + // If an altro exists, delete the object, flushing the data to + // disk, and closing the file. + if (altro) { + // When the first argument is false, we write the real + // header. + AliDebug(15, Form("Closing output")); + altro->Flush(); + altro->WriteDataHeader(kFALSE, kFALSE); + delete altro; + altro = 0; + } + prevddl = ddl; + // Need to open a new DDL! + TString filename(Form("%s_%d.ddl", fFMD->GetName(), ddl)); + AliDebug(15, Form("New altro buffer with DDL file %s", filename.Data())); + // Create a new altro buffer - a `1' as the second argument + // means `write mode' + altro = new AliAltroBuffer(filename.Data(), 1); + altro->SetMapping(pars->GetAltroMap()); + // Write a dummy (first argument is true) header to the DDL + // file - later on, when we close the file, we write the real + // header + altro->WriteDataHeader(kTRUE, kFALSE); + } + + // Store the counts of the ADC in the channel buffer + sampleRate = pars->GetSampleRate(det, ring, sector, strip); + for (int s = 0; s < sampleRate; s++) { + data[nWords] = digit->Count(s); + nWords++; + } + } + // Finally, we need to close the final ALTRO buffer if it wasn't + // already + if (altro) { + if (nWords > 0) altro->WriteChannel(prevaddr,nWords,data.fArray,threshold); + altro->Flush(); + altro->WriteDataHeader(kFALSE, kFALSE); + delete altro; + } +} +#else //____________________________________________________________________ void AliFMDRawWriter::WriteDigits(TClonesArray* digits) @@ -216,9 +320,9 @@ AliFMDRawWriter::WriteDigits(TClonesArray* digits) } writer = new AliFMDAltroWriter(*file); writer->SetThreshold(pars->GetZeroSuppression(det, ring, sector, strip)); - sampleRate = pars->GetSampleRate(ddl); } // Write out our signal + sampleRate = pars->GetSampleRate(det,ring,sector,strip); writer->AddSignal(digit->Count1()); if (sampleRate >= 2) writer->AddSignal(digit->Count2()); if (sampleRate >= 3) writer->AddSignal(digit->Count3()); @@ -231,163 +335,9 @@ AliFMDRawWriter::WriteDigits(TClonesArray* digits) delete file; } } - - - -#if 0 -//____________________________________________________________________ -void -AliFMDRawWriter::WriteDigits(TClonesArray* digits) -{ - Int_t nDigits = digits->GetEntries(); - if (nDigits < 1) return; - - AliFMDParameters* pars = AliFMDParameters::Instance(); - UShort_t prevDetector = 0; - Char_t prevRing = '\0'; - UShort_t prevSector = 0; - // UShort_t prevStrip = 0; - - // The first seen strip number for a channel - UShort_t startStrip = 0; - - // Which channel number in the ALTRO channel we're at - UShort_t offset = 0; - - // How many times the ALTRO Samples one VA1_ALICE channel - Int_t sampleRate = 1; - - // A buffer to hold 1 ALTRO channel - Normally, one ALTRO channel - // holds 128 VA1_ALICE channels, sampled at a rate of `sampleRate' - TArrayI channel(fChannelsPerAltro * sampleRate); - - // The Altro buffer - AliAltroBuffer* altro = 0; - - // Loop over the digits in the event. Note, that we assume the - // the digits are in order in the branch. If they were not, we'd - // have to cache all channels before we could write the data to - // the ALTRO buffer, or we'd have to set up a map of the digits. - for (Int_t i = 0; i < nDigits; i++) { - // Get the digit - AliFMDDigit* digit = static_cast(digits->At(i)); - - UShort_t det = digit->Detector(); - Char_t ring = digit->Ring(); - UShort_t sector = digit->Sector(); - UShort_t strip = digit->Strip(); - fThreshold = pars->GetZeroSuppression(det, ring, sector, strip); - if (det != prevDetector) { - AliDebug(15, Form("FMD: New DDL, was %d, now %d", - AliFMDParameters::kBaseDDL + prevDetector - 1, - AliFMDParameters::kBaseDDL + det - 1)); - // If an altro exists, delete the object, flushing the data to - // disk, and closing the file. - if (altro) { - // When the first argument is false, we write the real - // header. - AliDebug(15, Form("New altro: Write channel at %d Strip: %d " - "Sector: %d Ring: %d", - i, startStrip, prevSector, prevRing)); - // TPC to FMD translations - // - // TPC FMD - // ----------+----------- - // pad | strip - // row | sector - // sector | ring - // - WriteChannel(altro, startStrip, prevSector, prevRing, channel); - altro->Flush(); - altro->WriteDataHeader(kFALSE, kFALSE); - delete altro; - altro = 0; - } - prevDetector = det; - // Need to open a new DDL! - Int_t ddlId = AliFMDParameters::kBaseDDL + det - 1; - TString filename(Form("%s_%d.ddl", fFMD->GetName(), ddlId)); - - AliDebug(15, Form("New altro buffer with DDL file %s", - filename.Data())); - AliDebug(15, Form("New altro at %d", i)); - // Create a new altro buffer - a `1' as the second argument - // means `write mode' - altro = new AliAltroBuffer(filename.Data(), 1); - altro->SetMapping(pars->GetAltroMap()); - - // Write a dummy (first argument is true) header to the DDL - // file - later on, when we close the file, we write the real - // header - altro->WriteDataHeader(kTRUE, kFALSE); - - // Figure out the sample rate - if (fSampleRate > 0) sampleRate = fSampleRate; - else { - if (digit->Count2() >= 0) sampleRate = 2; - if (digit->Count3() >= 0) sampleRate = 3; - } - - channel.Set(fChannelsPerAltro * sampleRate); - offset = 0; - prevRing = ring; - prevSector = sector; - startStrip = strip; - } - else if (offset == fChannelsPerAltro - || digit->Ring() != prevRing - || digit->Sector() != prevSector) { - // Force a new Altro channel - AliDebug(15, Form("Flushing channel to disk because %s", - (offset == fChannelsPerAltro ? "channel is full" : - (ring != prevRing ? "new ring up" : - "new sector up")))); - AliDebug(15, Form("New Channel: Write channel at %d Strip: %d " - "Sector: %d Ring: %d", - i, startStrip, prevSector, prevRing)); - WriteChannel(altro, startStrip, prevSector, prevRing, channel); - // Reset and update channel variables - channel.Reset(0); - offset = 0; - startStrip = strip; - prevRing = ring; - prevSector = sector; - } - - // Store the counts of the ADC in the channel buffer - channel[offset * sampleRate] = digit->Count1(); - if (sampleRate > 1) - channel[offset * sampleRate + 1] = digit->Count2(); - if (sampleRate > 2) - channel[offset * sampleRate + 2] = digit->Count3(); - offset++; - } - // Finally, we need to close the final ALTRO buffer if it wasn't - // already - if (altro) { - altro->Flush(); - altro->WriteDataHeader(kFALSE, kFALSE); - delete altro; - } -} - -//____________________________________________________________________ -void -AliFMDRawWriter::WriteChannel(AliAltroBuffer* altro, - UShort_t strip, UShort_t sector, Char_t ring, - const TArrayI& data) -{ - // Write out one ALTRO channel to the data file. - // Derived classes can overload this method to use a per-ALTRO - // threshold. This implementation uses the common threshold set by - // SetThreshold. - altro->WriteChannel(Int_t(strip), - Int_t(sector), - Int_t((ring == 'I' ? 0 : 1)), - data.fN, data.fArray, fThreshold); -} #endif + //____________________________________________________________________ diff --git a/FMD/AliFMDRawWriter.h b/FMD/AliFMDRawWriter.h index af2655eb2df..35e25538b01 100644 --- a/FMD/AliFMDRawWriter.h +++ b/FMD/AliFMDRawWriter.h @@ -8,6 +8,11 @@ * See cxx source for full Copyright notice */ /* $Id$ */ +/** @file AliFMDRawWriter.h + @author Christian Holm Christensen + @date Mon Mar 27 12:45:56 2006 + @brief Class to write raw data +*/ //____________________________________________________________________ // // Class to writer ADC values to a Raw File @@ -52,9 +57,6 @@ public: ALTRO data. */ virtual void WriteDigits(TClonesArray* digits); protected: - /* Write a single channel. This member function is obsolete. */ - // virtual void WriteChannel(AliAltroBuffer* altro, UShort_t strip, - // UShort_t sector, Char_t ring, const TArrayI& d); AliFMD* fFMD; //! Pointer to detector description UShort_t fSampleRate; // The sample rate (0 -> inferred from data) UShort_t fChannelsPerAltro; // Number of pre-amp. channels/adc channel diff --git a/FMD/AliFMDRecPoint.cxx b/FMD/AliFMDRecPoint.cxx index 935de574976..cea8f0730e3 100644 --- a/FMD/AliFMDRecPoint.cxx +++ b/FMD/AliFMDRecPoint.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDRecPoint.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:46:26 2006 + @brief Pseudo reconstructed charged particle multiplicity +*/ //____________________________________________________________________ // // Base class for reconstructed charged particle multiplicty in the diff --git a/FMD/AliFMDRecPoint.h b/FMD/AliFMDRecPoint.h index ece49d14d3b..fc9ffbc86ad 100644 --- a/FMD/AliFMDRecPoint.h +++ b/FMD/AliFMDRecPoint.h @@ -1,16 +1,20 @@ #ifndef ALIFMDRECPOINT_H #define ALIFMDRECPOINT_H - // Reconstracted Particles Class: has number of reconstructed // particles in sectors from NumOfMinSector to NumberOfMaxSector() // rings from NumOfMinRing to NumOfMaxRing for each FMDvolume // +/** @file AliFMDRecPoint.h + @author Christian Holm Christensen + @date Mon Mar 27 12:46:26 2006 + @brief Pseudo reconstructed charged particle multiplicity +*/ #ifndef ROOT_TObject # include #endif -/** Reconstructed FMD points. It contains the pseudo-inclusive - multiplicity +/** @brief Reconstructed FMD points. + It contains the pseudo-inclusive multiplicity @ingroup FMD_rec */ class AliFMDRecPoint: public TObject diff --git a/FMD/AliFMDReconstructor.cxx b/FMD/AliFMDReconstructor.cxx index d901bad8cd8..620aa22e420 100644 --- a/FMD/AliFMDReconstructor.cxx +++ b/FMD/AliFMDReconstructor.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDReconstructor.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:47:09 2006 + @brief FMD reconstruction +*/ //____________________________________________________________________ // // This is a class that constructs AliFMDMult (reconstructed diff --git a/FMD/AliFMDReconstructor.h b/FMD/AliFMDReconstructor.h index 9ab7083bc14..dac28d63614 100644 --- a/FMD/AliFMDReconstructor.h +++ b/FMD/AliFMDReconstructor.h @@ -12,6 +12,11 @@ //-- Authors: Evgeny Karpechev (INR) and Alla Maevskaia (INR) // Latest changes by Christian Holm Christensen /* $Id$ */ +/** @file AliFMDReconstructor.h + @author Christian Holm Christensen + @date Mon Mar 27 12:47:09 2006 + @brief FMD reconstruction +*/ //____________________________________________________________________ // Header guards in the header files speeds up the compilation @@ -31,10 +36,12 @@ class AliESDFMD; /** @defgroup FMD_rec Reconstruction */ //____________________________________________________________________ -/** This is a class that reconstructs AliFMDRecPoint objects from of - Digits. This class reads either digits from a TClonesArray or raw - data from a DDL file (or similar), and applies calibrations to get +/** @brief This is a class that reconstructs AliFMDRecPoint objects from of + Digits. + This class reads either digits from a TClonesArray or raw data + from a DDL file (or similar), and applies calibrations to get psuedo-inclusive multiplicities per strip. + @ingroup FMD_rec */ class AliFMDReconstructor: public AliReconstructor diff --git a/FMD/AliFMDRing.cxx b/FMD/AliFMDRing.cxx index 0fe186cdcce..b887b4b6f8f 100644 --- a/FMD/AliFMDRing.cxx +++ b/FMD/AliFMDRing.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDRing.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:47:43 2006 + @brief FMD ring geometry parameters +*/ //__________________________________________________________________ // // Utility class to help implement collection of FMD modules into diff --git a/FMD/AliFMDRing.h b/FMD/AliFMDRing.h index 800aca1157e..ad39893de4a 100644 --- a/FMD/AliFMDRing.h +++ b/FMD/AliFMDRing.h @@ -7,6 +7,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDRing.h + @author Christian Holm Christensen + @date Mon Mar 27 12:47:43 2006 + @brief FMD ring geometry parameters +*/ //__________________________________________________________________ // // Parameters of the FMD rings. @@ -24,7 +29,7 @@ class TBrowser; class TVector2; -/** Geometry description and parameters of a ring in the FMD +/** @brief Geometry description and parameters of a ring in the FMD detector. As there are only 2 kinds of rings @e Inner (@c 'I') and @e diff --git a/FMD/AliFMDUShortMap.cxx b/FMD/AliFMDUShortMap.cxx index 62e440f1bb6..9a4ff2306ff 100644 --- a/FMD/AliFMDUShortMap.cxx +++ b/FMD/AliFMDUShortMap.cxx @@ -12,9 +12,12 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDUShortMap.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:48:18 2006 + @brief Per strip of unisgned shorts (16 bit) data +*/ //____________________________________________________________________ // // A map of per strip UShort_t information (for example ADC values, diff --git a/FMD/AliFMDUShortMap.h b/FMD/AliFMDUShortMap.h index dce3209d146..74add96c67c 100644 --- a/FMD/AliFMDUShortMap.h +++ b/FMD/AliFMDUShortMap.h @@ -5,6 +5,11 @@ * * See cxx source for full Copyright notice */ +/** @file AliFMDUShortMap.h + @author Christian Holm Christensen + @date Mon Mar 27 12:48:18 2006 + @brief Per strip of unisgned shorts (16 bit) data +*/ #ifndef ALIFMDMAP_H # include "AliFMDMap.h" #endif diff --git a/FMD/AliFMDv0.cxx b/FMD/AliFMDv0.cxx index 6298dda20c5..d931b834e0e 100644 --- a/FMD/AliFMDv0.cxx +++ b/FMD/AliFMDv0.cxx @@ -12,9 +12,13 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDv0.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:48:51 2006 + @brief Concrete implementation of FMD detector driver - coarse + version +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. This class diff --git a/FMD/AliFMDv0.h b/FMD/AliFMDv0.h index a67d23d05a9..0e0c0a53bd5 100644 --- a/FMD/AliFMDv0.h +++ b/FMD/AliFMDv0.h @@ -7,7 +7,12 @@ * * See cxx source for full Copyright notice */ - +/** @file AliFMDv0.h + @author Christian Holm Christensen + @date Mon Mar 27 12:48:51 2006 + @brief Concrete implementation of FMD detector driver - coarse + version +*/ //____________________________________________________________________ // // Manager class for the FMD - Coarse version. @@ -17,10 +22,11 @@ #endif //____________________________________________________________________ -/** Forward Multiplicity Detector based on Silicon wafers. This class - contains the base procedures for the Forward Multiplicity detector - Detector consists of 3 sub-detectors FMD1, FMD2, and FMD3, each of - which has 1 or 2 rings of silicon sensors. +/** @brief Forward Multiplicity Detector based on Silicon wafers. + + This class contains the base procedures for the Forward + Multiplicity detector Detector consists of 3 sub-detectors FMD1, + FMD2, and FMD3, each of which has 1 or 2 rings of silicon sensors. This contains the coarse version of the FMD - that is, the simulation produces no hits in the FMD volumes, and the sensors diff --git a/FMD/AliFMDv1.cxx b/FMD/AliFMDv1.cxx index 330ba5faf2d..f7aeb7aec4f 100644 --- a/FMD/AliFMDv1.cxx +++ b/FMD/AliFMDv1.cxx @@ -12,9 +12,13 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDv1.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:48:51 2006 + @brief Concrete implementation of FMD detector driver - detailed + version +*/ //____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. This class diff --git a/FMD/AliFMDv1.h b/FMD/AliFMDv1.h index 98068a2f757..89d51c3bf36 100644 --- a/FMD/AliFMDv1.h +++ b/FMD/AliFMDv1.h @@ -7,7 +7,12 @@ * * See cxx source for full Copyright notice */ - +/** @file AliFMDv1.h + @author Christian Holm Christensen + @date Mon Mar 27 12:48:51 2006 + @brief Concrete implementation of FMD detector driver - detailed + version +*/ //____________________________________________________________________ // // Manager class for the FMD - Detailed version. @@ -22,10 +27,11 @@ #endif //____________________________________________________________________ -/** Forward Multiplicity Detector based on Silicon wafers. This class - contains the base procedures for the Forward Multiplicity detector - Detector consists of 3 sub-detectors FMD1, FMD2, and FMD3, each of - which has 1 or 2 rings of silicon sensors. +/** @brief Forward Multiplicity Detector based on Silicon wafers. + + This class contains the base procedures for the Forward + Multiplicity detector Detector consists of 3 sub-detectors FMD1, + FMD2, and FMD3, each of which has 1 or 2 rings of silicon sensors. This class contains the detailed version of the FMD - that is, hits are produced during simulation. diff --git a/FMD/Config.C b/FMD/Config.C index 4fa3148be64..32f1c103115 100644 --- a/FMD/Config.C +++ b/FMD/Config.C @@ -8,6 +8,11 @@ // -I$ALICE_ROOT -I$ALICE/geant3/TGeant3"); // root [0] .x grun.C(1,"ConfigPPR.C++") // +/** @file Config.C + @author Christian Holm Christensen + @date Mon Mar 27 12:50:29 2006 + @brief Simulation configuration script +*/ #if !defined(__CINT__) || defined(__MAKECINT__) #include #include diff --git a/FMD/Doxyfile b/FMD/Doxyfile index 145aa43d6de..5028e207f94 100644 --- a/FMD/Doxyfile +++ b/FMD/Doxyfile @@ -93,7 +93,7 @@ EXCLUDE_PATTERNS = EXAMPLE_PATH = /home/hehi/cholm/work/alice/aliroot/FMD/scripts/ EXAMPLE_PATTERNS = *.C EXAMPLE_RECURSIVE = NO -IMAGE_PATH = +IMAGE_PATH = /home/hehi/cholm/work/alice/aliroot/FMD/pics/ INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO diff --git a/FMD/DrawFMD.C b/FMD/DrawFMD.C index 09bc728364b..f4af85806dd 100644 --- a/FMD/DrawFMD.C +++ b/FMD/DrawFMD.C @@ -1,3 +1,8 @@ +/** @file DrawFMD.C + @author Christian Holm Christensen + @date Mon Mar 27 14:18:21 2006 + @brief Script to draw the FMD3 - obsolete +*/ void DrawFMD() { // gSystem->Load("/usr/lib/libshift"); diff --git a/FMD/FMDbaseLinkDef.h b/FMD/FMDbaseLinkDef.h index a8c16c20875..75fdfa6ce3f 100644 --- a/FMD/FMDbaseLinkDef.h +++ b/FMD/FMDbaseLinkDef.h @@ -4,7 +4,11 @@ * See cxx source for full Copyright notice */ /* $Id$ */ - +/** @file FMDbaseLinkDef.h + @author Christian Holm Christensen + @date Mon Mar 27 14:18:46 2006 + @brief Link specifications for base library +*/ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; @@ -24,10 +28,11 @@ #pragma link C++ class AliFMDCalibPedestal+; #pragma link C++ class AliFMDCalibGain+; #pragma link C++ class AliFMDCalibSampleRate+; +#pragma link C++ class AliFMDCalibStripRange+; #pragma link C++ class AliFMDAltroMapping+; -#pragma link C++ class AliFMDAltroIO+; -#pragma link C++ class AliFMDAltroReader+; -#pragma link C++ class AliFMDAltroWriter+; +// #pragma link C++ class AliFMDAltroIO+; +// #pragma link C++ class AliFMDAltroReader+; +// #pragma link C++ class AliFMDAltroWriter+; #else # error Not for compilation diff --git a/FMD/FMDrecLinkDef.h b/FMD/FMDrecLinkDef.h index 57a5cfd2424..1fc40923117 100644 --- a/FMD/FMDrecLinkDef.h +++ b/FMD/FMDrecLinkDef.h @@ -5,6 +5,12 @@ * See cxx source for full Copyright notice */ /* $Id$ */ +/** @file FMDrecLinkDef.h + @author Christian Holm Christensen + @date Mon Mar 27 14:19:08 2006 + @brief Link specifications for reconstruction library + +*/ #ifdef __CINT__ #pragma link off all globals; diff --git a/FMD/FMDsimLinkDef.h b/FMD/FMDsimLinkDef.h index 8569b45354a..6a70caee964 100644 --- a/FMD/FMDsimLinkDef.h +++ b/FMD/FMDsimLinkDef.h @@ -4,7 +4,11 @@ * * See cxx source for full Copyright notice */ - +/** @file FMDsimLinkDef.h + @author Christian Holm Christensen + @date Mon Mar 27 14:19:24 2006 + @brief Link specifications fo simulation library +*/ /* $Id$ */ #ifdef __CINT__ diff --git a/FMD/FMDutilLinkDef.h b/FMD/FMDutilLinkDef.h index 575b4c32165..2cab0519a5c 100644 --- a/FMD/FMDutilLinkDef.h +++ b/FMD/FMDutilLinkDef.h @@ -4,7 +4,11 @@ * * See cxx source for full Copyright notice */ - +/** @file FMDutilLinkDef.h + @author Christian Holm Christensen + @date Mon Mar 27 14:19:41 2006 + @brief Link specification for utility libary +*/ /* $Id$ */ #ifdef __CINT__ diff --git a/FMD/Reconstruct.C b/FMD/Reconstruct.C index efc5aa89f78..51570bb5b14 100644 --- a/FMD/Reconstruct.C +++ b/FMD/Reconstruct.C @@ -14,14 +14,19 @@ **************************************************************************/ /* $Id$ */ - +/** @file Reconstruct.C + @author Christian Holm Christensen + @date Mon Mar 27 14:19:56 2006 + @brief Script to do reconstruction +*/ // Script to do test the FMD digitization class. +/** Do reconstruction */ void Reconstruct() { AliCDBManager* cdb = AliCDBManager::Instance(); - cdb->SetDefaultStorage("local://cdb"); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); AliLog::SetModuleDebugLevel("FMD", 2); AliReconstruction rec; rec.SetRunLocalReconstruction("FMD"); diff --git a/FMD/Simulate.C b/FMD/Simulate.C index 970442bc7f1..a529c6b2a38 100644 --- a/FMD/Simulate.C +++ b/FMD/Simulate.C @@ -12,15 +12,19 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - -// Script to do test the FMD digitization class. +/** @file Simulate.C + @author Christian Holm Christensen + @date Mon Mar 27 14:20:24 2006 + @brief Script to do simulation +*/ +/** Script to do test the FMD digitization class. + */ void Simulate() { AliCDBManager* cdb = AliCDBManager::Instance(); - cdb->SetDefaultStorage("local://cdb"); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); AliSimulation sim; AliCDBEntry* align = cdb->Get("FMD/Align/Data"); if (align) { diff --git a/FMD/ViewFMD.C b/FMD/ViewFMD.C index 6bcdc8f0834..1037393c9d4 100644 --- a/FMD/ViewFMD.C +++ b/FMD/ViewFMD.C @@ -1,3 +1,9 @@ +/** @file ViewFMD.C + @author Christian Holm Christensen + @date Mon Mar 27 14:20:48 2006 + @brief Script to setup FMD volumes for viewing - obsolete +*/ +/** Setup FMD volumes for viewing - obsolete */ void ViewFMD() { gMC->Gsatt("FMD1","seen",0); diff --git a/FMD/libFMDbase.pkg b/FMD/libFMDbase.pkg index e4dbc96a151..1bc646c054a 100644 --- a/FMD/libFMDbase.pkg +++ b/FMD/libFMDbase.pkg @@ -8,8 +8,8 @@ SRCS = AliFMDDigit.cxx \ AliFMDCalibPedestal.cxx \ AliFMDCalibGain.cxx \ AliFMDCalibSampleRate.cxx \ + AliFMDCalibStripRange.cxx \ AliFMDAltroMapping.cxx \ - AliFMDAltroIO.cxx \ AliFMDParameters.cxx \ AliFMDGeometry.cxx \ AliFMDRing.cxx \ @@ -18,6 +18,8 @@ SRCS = AliFMDDigit.cxx \ AliFMD2.cxx \ AliFMD3.cxx +# AliFMDAltroIO.cxx + HDRS = $(SRCS:.cxx=.h) DHDR := FMDbaseLinkDef.h diff --git a/FMD/scripts/MakeAlignment.C b/FMD/scripts/MakeAlignment.C index 7a51fb82a2e..ce90aaabf80 100644 --- a/FMD/scripts/MakeAlignment.C +++ b/FMD/scripts/MakeAlignment.C @@ -13,13 +13,15 @@ MakeAlignment() if (!TGeoManager::Import("geometry.root")) gAlice->Init("$ALICE_ROOT/FMD/Config.C"); AliCDBManager* cdb = AliCDBManager::Instance(); - cdb->SetDefaultStorage("local://cdb"); - + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + gSystem->Load("libFMDutil.so"); - AliFMDAlignFaker f; - f.RemoveAlign(AliFMDAlignFaker::kHalves); + AliFMDAlignFaker f(AliFMDAlignFaker::kAll, "geometry.root", 0); + // f.RemoveAlign(AliFMDAlignFaker::kHalves); f.SetSensorDisplacement(0, 0, 0, 0, 0, 0); - f.SetSensorRotation(0, 0, 0, 3, 3, 3); + f.SetSensorRotation(0, 0, 0, 0, 0, 0); + f.SetHalfDisplacement(0, 0, 0, 0, 0, 0); + f.SetHalfRotation(0, 0, 0, 0, 0, 0); f.Exec(); } //____________________________________________________________________ diff --git a/FMD/scripts/MakeCalibration.C b/FMD/scripts/MakeCalibration.C new file mode 100644 index 00000000000..faf4829ec8c --- /dev/null +++ b/FMD/scripts/MakeCalibration.C @@ -0,0 +1,35 @@ +//____________________________________________________________________ +// +// $Id$ +// +// Make fake alignment data. +// +/** @file MakeCalibration.C + @author Christian Holm Christensen + @date Sun Mar 26 17:58:27 2006 + @brief Make fake calibration data. +*/ +/** Make fake calibration data + @ingroup simple_script + */ +void +MakeCalibration() +{ + AliCDBManager* cdb = AliCDBManager::Instance(); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + + gSystem->Load("libFMDutil.so"); + AliFMDCalibFaker f(AliFMDCalibFaker::kAll, 0); + f.SetGainSeed(30); + f.SetThresholdFactor(3); + f.SetPedestalRange(20,40); + f.SetDeadChance(0); + f.SetZeroThreshold(0); + f.SetStripRange(0, 127); + f.SetRate(1); + f.Exec(); +} +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/scripts/Poisson.C b/FMD/scripts/Poisson.C index a3f82a387f1..0e005b89c8c 100644 --- a/FMD/scripts/Poisson.C +++ b/FMD/scripts/Poisson.C @@ -16,6 +16,10 @@ #include #include #include +#include +#include +#include +#include #include /** @class Poisson @@ -30,17 +34,26 @@ */ class Poisson : public AliFMDInput { -private: +protected: TH2D* fEmpty; // Histogram TH2D* fTotal; // Histogram TH2D* fMult; // Histogram TFile* fFile; // File Int_t fEv; // Event number + Double_t fThreshold; public: + /** Constructor + @param threshold Threshold + @param nEta # of @f$ \eta@f$ bins + @param minEta minimum @f$ \eta@f$ + @param maxEta maximum @f$ \eta@f$ + @param nPhi # of @f$ \eta@f$ bins + @param minPhi minimum @f$ \varphi@f$ + @param maxPhi maximum @f$ \varphi@f$ */ Poisson(Double_t threshold=.3, Int_t nEta=120, Float_t minEta=-6, Float_t maxEta=6, Int_t nPhi=4, Float_t minPhi=0, Float_t maxPhi=2*TMath::Pi()) - : fFile(0), fEv(0) + : fFile(0), fEv(0), fThreshold(threshold) { AddLoad(kESD); @@ -61,17 +74,19 @@ public: fMult->SetZTitle(""); } - Bool_t Init() + /** Initialize the analyser. Opens the output file. + @return @c true on success. */ + virtual Bool_t Init() { - if (!AliFMDInput::Begin(event)) return kFALSE; - fFile = TFile::Open("poisson.root"); + if (!AliFMDInput::Init()) return kFALSE; + fFile = TFile::Open("poisson.root", "RECREATE"); if (!fFile) return kFALSE; return kTRUE; } /** Begining of event @param event Event number @return @c false on error */ - Bool_t Begin(Int_t event) + virtual Bool_t Begin(Int_t event) { if (!AliFMDInput::Begin(event)) return kFALSE; fEv = event; @@ -80,30 +95,36 @@ public: fMult->Clear(); return kTRUE; } - Bool_t ProcessESD(AliESDFMDHit* esd) + /** Process ESD data. For each strip, check if the + psuedo-multiplicity is less than the threshold. If it is, then + count the strip as empty. + @param esd ESD data + @return @c true on success. */ + virtual Bool_t ProcessESD(AliESDFMD* esd) { - for (UShort_t det = 1; det <= esd->MaxDetector(); det++) { - for (UShort_t rng = 0; rng < esd->MaxRing(); rng++) { + for (UShort_t det = 1; det <= 3; det++) { + for (UShort_t rng = 0; rng < 2; rng++) { Char_t ring = (rng == 0 ? 'I' : 'O'); // Not covered channels - for (UShort_t sec = 0; sec < esd->MaxSector(); sec++) { - for (UShort_t str = 0; str < esd->MaxStrip(); str++) { + for (UShort_t sec = 0; sec < 40; sec++) { + for (UShort_t str = 0; str < 512; str++) { Float_t mult = esd->Multiplicity(det, ring, sec, str); Float_t eta = esd->Eta(det, ring, sec, str); // Dead channels, or not covered. if (mult >= AliESDFMD::kInvalidMult) continue; - if (esd >= AliESDFMD::kInvalidEta) continue; + if (eta >= AliESDFMD::kInvalidEta) continue; Float_t phi; switch (ring) { case 'I': phi = (sec + .5) * 2 * TMath::Pi() / 20; break; case 'O': phi = (sec + .5) * 2 * TMath::Pi() / 40; break; } fTotal->Fill(eta, phi); - if (mult < threshold) fEmpty->Fill(eta, phi); + if (mult < fThreshold) fEmpty->Fill(eta, phi); } // Loop over strips } // Loop over sectors } // Loop over rings } // Loop over detectors + return kTRUE; } /** For each bin, reconstruct the charge particle multiplicity as @f[ @@ -113,23 +134,31 @@ public: and @f$ N_{empty}@f$ is the number of strips in the bin that did not fire. @return @c true */ - Bool_t End() + virtual Bool_t End() { for (Int_t etaBin = 1; etaBin <= fEmpty->GetNbinsX(); etaBin++) { for (Int_t phiBin = 1; phiBin <= fEmpty->GetNbinsY(); phiBin++) { Double_t empty = fEmpty->GetBinContent(etaBin, phiBin); Double_t total = fTotal->GetBinContent(etaBin, phiBin); - Double_t lambda = (empty > 0 ? - TMath::Log(empty / nTotal) : 1); - Double_t mult = lambda * nTotal; + Double_t lambda = (empty > 0 ? - TMath::Log(empty / total) : 1); + Double_t mult = lambda * total; fMult->SetBinContent(etaBin, phiBin, mult); } } fFile->cd(); fMult->Write(Form("mult%03d", fEv)); + if (!gROOT->IsBatch()) { + gStyle->SetPalette(1); + TCanvas* c = new TCanvas("poisson", "Poisson multiplicity"); + c->SetFillColor(0); + fMult->Draw("colz"); + } return AliFMDInput::End(); } - Bool_t Finish() + /** At end of run. Write and close output file @c poisson.root + @return @c true on success */ + virtual Bool_t Finish() { fFile->Write(); fFile->Close(); diff --git a/FMD/scripts/PoissonHit.C b/FMD/scripts/PoissonHit.C new file mode 100644 index 00000000000..79d4bcbdacf --- /dev/null +++ b/FMD/scripts/PoissonHit.C @@ -0,0 +1,154 @@ +//____________________________________________________________________ +// +// $Id$ +// +// Script that contains a class to draw hits, using the +// AliFMDInputHits class in the util library. +// +// It draws the energy loss versus the p/(mq^2). It can be overlayed +// with the Bethe-Bloc curve to show how the simulation behaves +// relative to the expected. +// +// Use the script `Compile.C' to compile this class using ACLic. +// +#include "Poisson.C" +#include +#include +#include +#include + +/** @class PoissonHit + @brief Make a poisson reconstruction and compare to simulated hits + @code + Root> .L Compile.C + Root> Compile("Poisson.C") + Root> Compile("PoissonHit.C") + Root> PoissonHit c + Root> c.Run(); + @endcode + @ingroup FMD_script + */ +class PoissonHit : public Poisson +{ +protected: + TH2D* fHits; // Histogram + TH2D* fDiff; // Histogram +public: + /** Constructor + @param threshold Threshold + @param nEta # of @f$ \eta@f$ bins + @param minEta minimum @f$ \eta@f$ + @param maxEta maximum @f$ \eta@f$ + @param nPhi # of @f$ \eta@f$ bins + @param minPhi minimum @f$ \varphi@f$ + @param maxPhi maximum @f$ \varphi@f$ */ + PoissonHit(Double_t threshold=.3, + Int_t nEta=120, Float_t minEta=-6, Float_t maxEta=6, + Int_t nPhi=4, Float_t minPhi=0, Float_t maxPhi=2*TMath::Pi()) + : Poisson(threshold, nEta, minEta, maxEta, nPhi, minPhi, maxPhi) + { + AddLoad(kHits); + AddLoad(kGeometry); + fHits = new TH2D(*fEmpty); + fHits->SetName("hits"); + fHits->SetTitle("# of hits"); + fDiff = new TH2D(*fEmpty); + fDiff->SetName("diff"); + fDiff->SetTitle("Difference between poisson and hits"); + fHits->SetXTitle("#eta"); + fHits->SetYTitle("#phi"); + fHits->SetZTitle("N"); + fDiff->SetXTitle("#eta"); + fDiff->SetYTitle("#phi"); + fDiff->SetZTitle("#frac{N_{hit}-N_{poisson}}{N_{hit}}"); + } + /** Initialize the analyser. Opens the output file. + @return @c true on success. */ + virtual Bool_t Init() + { + if (!Poisson::Init()) return kFALSE; + AliFMDGeometry::Instance()->Init(); + AliFMDGeometry::Instance()->InitTransformations(); + return kTRUE; + } + /** Get the @f$ \eta@f$ and @f$\varphi@f$ corresponding to the + spatial coordinates @f$ \mathbf{v} = (x,y,z)@f$ + @param x X coordinate + @param y Y coordinate + @param z Z coordinate + @param eta Psuedo rapidity @f$ \eta@f$ + @param phi Azimuthal angle @f$\varphi@f$ + */ + void PhysicalCoordinates(Double_t x, Double_t y, Double_t z, + Double_t& eta, Double_t& phi) + { + Double_t r, theta; + phi = TMath::ATan2(y, x); + r = TMath::Sqrt(y * y + x * x); + theta = TMath::ATan2(r, z); + eta = -TMath::Log(TMath::Tan(theta / 2)); + if (phi < 0) phi += 2 * TMath::Pi(); + } + /** Process one hit. Increment bin corresponding to strip. + @param hit Hit. + @return @c true on success */ + virtual Bool_t ProcessHit(AliFMDHit* hit, TParticle*) + { + Double_t x, y, z; +#if 0 + AliFMDGeometry* geom = AliFMDGeometry::Instance(); + geom->Detector2XYZ(hit->Detector(),hit->Ring(),hit->Sector(), + hit->Strip(),x,y,z); +#else + x = hit->X(); + y = hit->Y(); + z = hit->Z(); +#endif + Double_t eta, phi; + PhysicalCoordinates(x, y, z, eta, phi); + fHits->Fill(eta, phi); + return kTRUE; + } + /** Begining of event + @param event Event number + @return @c false on error */ + virtual Bool_t Begin(Int_t event) + { + if (!Poisson::Begin(event)) return kFALSE; + fHits->Clear(); + fDiff->Clear(); + return kTRUE; + } + /** Let the poisson code do it's job, and then compare to the + numberr of hits. + @return @c true */ + virtual Bool_t End() + { + if (!Poisson::End()) return kFALSE; + fDiff->Add(fMult,fHits,-1.,1.); + fDiff->Divide(fHits); + if (!gROOT->IsBatch()) { + gStyle->SetPalette(1); + TCanvas* c1 = new TCanvas("hits", "Hit multiplicity"); + c1->SetFillColor(0); + fHits->Draw("colz"); + TCanvas* c2 = new TCanvas("diff", "Difference between Hit and poisson"); + c2->SetFillColor(0); + fDiff->Draw("colz"); + TCanvas* c3 = new TCanvas("empty", "# of Empty strips"); + c3->SetFillColor(0); + fEmpty->Draw("colz"); + TCanvas* c4 = new TCanvas("total", "Total # of strips"); + c4->SetFillColor(0); + fTotal->Draw("colz"); + } + return kTRUE; + } + + ClassDef(PoissonHit,0); +}; + +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/scripts/PrintAlignment.C b/FMD/scripts/PrintAlignment.C new file mode 100644 index 00000000000..bb897f23168 --- /dev/null +++ b/FMD/scripts/PrintAlignment.C @@ -0,0 +1,50 @@ +//____________________________________________________________________ +// +// $Id$ +// +// Read in the geometry, and get alignment data from CDB, and apply +// that to the geometry. +// +/** Print alignment to a geometry + @ingroup simple_script + */ +#include +void +PrintAlignment() +{ + AliCDBManager* cdb = AliCDBManager::Instance(); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + AliCDBEntry* align = cdb->Get("FMD/Align/Data"); + if (!align) { + Error("PrintAlignment","didn't alignment data from CDB"); + return; + } + + TClonesArray* array = dynamic_cast(align->GetObject()); + if (!array) { + Warning("PrintAlignement", "Invalid align data from CDB"); + return; + } + Int_t nAlign = array->GetEntries(); + for (Int_t i = 0; i < nAlign; i++) { + AliAlignObjAngles* a = static_cast(array->At(i)); + Double_t ang[3]; + Double_t trans[3]; + a->GetAngles(ang); + a->GetTranslation(trans); + std::cout << a->GetVolPath() << "\n" + << " translation: " + << "(" << std::setw(12) << trans[0] + << "," << std::setw(12) << trans[1] + << "," << std::setw(12) << trans[2] << ")\n" + << " rotation: " + << "(" << std::setw(12) << ang[0] + << "," << std::setw(12) << ang[1] + << "," << std::setw(12) << ang[2] << ")" << std::endl; + // a->Print(); + } +} +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/scripts/ReadRaw.C b/FMD/scripts/ReadRaw.C new file mode 100644 index 00000000000..f03d6820235 --- /dev/null +++ b/FMD/scripts/ReadRaw.C @@ -0,0 +1,24 @@ +/** @file ReadRaw.C + @author Christian Holm Christensen + @date Tue Mar 28 12:39:08 2006 + @brief Script to read raw data +*/ +/** @ingroup FMD_script + @brief Read raw data into a TClonesArray - for testing + */ +void +ReadRaw() +{ + AliCDBManager* cdb = AliCDBManager::Instance(); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + AliLog::SetModuleDebugLevel("FMD", 10); + AliFMDParameters::Instance()->Init(); + AliRawReader* r = new AliRawReaderFile(0); + AliFMDRawReader* fr = new AliFMDRawReader(r, 0); + TClonesArray* a = new TClonesArray("AliFMDDigit"); + fr->ReadAdcs(a); +} +//____________________________________________________________________ +// +// EOF +// -- 2.43.0