From: hristov Date: Tue, 11 Apr 2006 17:06:07 +0000 (+0000) Subject: Coding conventions (Christian) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=02a27b508bdd34a6febe776298cc20b18fdbb2ed;hp=d202144c4160ff96592b1020b1457ff88079693e;p=u%2Fmrichter%2FAliRoot.git Coding conventions (Christian) --- diff --git a/FMD/AliFMD.cxx b/FMD/AliFMD.cxx index fd95c4dc377..1e73d4904e2 100644 --- a/FMD/AliFMD.cxx +++ b/FMD/AliFMD.cxx @@ -84,7 +84,7 @@ // These files are not in the same directory, so there's no reason to // ask the preprocessor to search in the current directory for these // files by including them with `#include "..."' -#include // __CMATH__ +// #include // __CMATH__ #include // ROOT_TClonesArray #include // ROOT_TGeomtry #include // ROOT_TNode @@ -93,79 +93,27 @@ #include // ROOT_TTUBE #include // ROOT_TTree #include // ROOT_TBrowser -#include // ROOT_TMath -#include // ROOT_TVirtualMC -#include -#include -#include +// #include // ROOT_TVirtualMC +#include // ROOT_TVector2 #include // ALIRUNDIGITIZER_H #include // ALILOADER_H #include // ALIRUN_H #include // ALIMC_H -#include "AliMagF.h" // ALIMAGF_H +#include // ALIMAGF_H #include // ALILOG_H #include "AliFMD.h" // ALIFMD_H -#include "AliFMDDigit.h" // ALIFMDDIGIG_H +#include "AliFMDDigit.h" // ALIFMDDIGIT_H +#include "AliFMDSDigit.h" // ALIFMDSDIGIT_H #include "AliFMDHit.h" // ALIFMDHIT_H #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H #include "AliFMDDetector.h" // ALIFMDDETECTOR_H #include "AliFMDRing.h" // ALIFMDRING_H #include "AliFMDDigitizer.h" // ALIFMDDIGITIZER_H -#include "AliPoints.h" // ALIPOINTS_H -#include "AliFMDGeometryBuilder.h" +#include "AliFMDSDigitizer.h" // ALIFMDSDIGITIZER_H +// #include "AliFMDGeometryBuilder.h" #include "AliFMDRawWriter.h" // ALIFMDRAWWRITER_H - - -class AliFMDPoints : public AliPoints -{ -public: - /** Constructor - @param hit Hit to draw - @param color Color of hit */ - AliFMDPoints(AliFMDHit* hit, UInt_t color) - : AliPoints(1), fMarker(0) - { - if (!hit) return; - Float_t size = TMath::Min(TMath::Max(hit->Edep() * .1, .1), 1.); - TVector3 p(hit->Px(), hit->Py(), hit->Pz()); - fMarker = new TMarker3DBox(hit->X(), hit->Y(), hit->Z(), size, size, size, - p.Theta(), p.Phi()); - fMarker->SetLineColor(color); - fMarker->SetRefObject(this); - fP[0] = hit->X(); - fP[1] = hit->Y(); - fP[2] = hit->Z(); - } - /** Destructor */ - ~AliFMDPoints() - { - // if (fMarker) delete fMarker; - } - void SetXYZ(Double_t x, Double_t y, Double_t z) - { - if (fMarker) fMarker->SetPosition(x, y, z); - } - Int_t DistancetoPrimitive(Int_t px, Int_t py) - { - return fMarker->DistancetoPrimitive(px, py); - } - void Draw(Option_t* option) - { - if (fMarker) fMarker->Draw(option); - } - void Paint(Option_t* option) - { - if (fMarker) fMarker->Paint(option); - } - void SetMarkerColor(Color_t colour) - { - if (fMarker) fMarker->SetLineColor(colour); - } -private: - TMarker3DBox* fMarker; -}; - +#include "AliFMDPoints.h" // ALIFMDPOINTS_H //____________________________________________________________________ ClassImp(AliFMD) @@ -550,13 +498,13 @@ AliFMD::BuildGeometry() return; } Double_t siThick = r->GetSiThickness(); - const Int_t nv = r->GetNVerticies(); + const Int_t knv = r->GetNVerticies(); Double_t theta = r->GetTheta(); Int_t nmod = r->GetNModules(); - TXTRU* shape = new TXTRU(r->GetName(), r->GetTitle(), "void", nv, 2); - for (Int_t j = 0; j < nv; j++) { - TVector2* vv = r->GetVertex(nv - 1 - j); + TXTRU* shape = new TXTRU(r->GetName(), r->GetTitle(), "void", knv, 2); + for (Int_t j = 0; j < knv; j++) { + TVector2* vv = r->GetVertex(knv - 1 - j); shape->DefineVertex(j, vv->X(), vv->Y()); } shape->DefineSection(0, -siThick / 2, 1, 0, 0); @@ -731,7 +679,7 @@ AliFMD::DrawDetector() //____________________________________________________________________ Int_t -AliFMD::DistanceToPrimitive(Int_t, Int_t) +AliFMD::DistancetoPrimitive(Int_t, Int_t) { // Calculate the distance from the mouse to the FMD on the screen // Dummy routine. diff --git a/FMD/AliFMD.h b/FMD/AliFMD.h index e2ca8d813e5..513ef90b784 100644 --- a/FMD/AliFMD.h +++ b/FMD/AliFMD.h @@ -213,9 +213,6 @@ #ifndef ALIDETECTOR_H # include #endif -#ifndef ROOT_TBranch -# include -#endif class TBranch; class TClonesArray; class TBrowser; @@ -347,7 +344,7 @@ public: virtual void DrawDetector(); /** Calculate the distance from the mouse to the FMD on the screen Dummy routine */ - virtual Int_t DistanceToPrimitive(Int_t px, Int_t py); + virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); /** Store x, y, z of all hits in memory for display. Normally, the hits are drawn using TPolyMarker3D - however, that is not very useful for the FMD. Therefor, this member function diff --git a/FMD/AliFMD1.cxx b/FMD/AliFMD1.cxx index 9718a2e725c..91f3e77eae6 100644 --- a/FMD/AliFMD1.cxx +++ b/FMD/AliFMD1.cxx @@ -28,7 +28,7 @@ // It is the FMD ring with highest eta // #include "AliFMD1.h" // ALIFMD1_H -#include "AliFMDRing.h" // ALIFMDRING_H +// #include "AliFMDRing.h" // ALIFMDRING_H //==================================================================== diff --git a/FMD/AliFMD1.h b/FMD/AliFMD1.h index 89395d00710..a272e429e2f 100644 --- a/FMD/AliFMD1.h +++ b/FMD/AliFMD1.h @@ -6,7 +6,10 @@ @date Sun Mar 26 18:00:56 2006 @brief Declaration of FMD1 declaration */ - +// Geometry description and parameters of the FMD1 detector. The FMD1 +// has only one ring. Need to flesh out the support once it's +// defined +// #ifndef ALIFMDDETECTOR_H # include "AliFMDDetector.h" #endif @@ -16,6 +19,7 @@ class AliFMDRing; /** @class AliFMD1 AliFMD1.h @brief Geometry description and parameters of the FMD1 detector. The FMD1 has only one ring. + @todo Need to flesh out the support once it's defined @image html FMD1.png @ingroup FMD_base */ diff --git a/FMD/AliFMD2.cxx b/FMD/AliFMD2.cxx index 9e05ea75f7f..350c035988d 100644 --- a/FMD/AliFMD2.cxx +++ b/FMD/AliFMD2.cxx @@ -28,7 +28,7 @@ // Support is not fleshed ot yet. // #include "AliFMD2.h" // ALIFMD2_H -#include "AliFMDRing.h" // ALIFMDRING_H +// #include "AliFMDRing.h" // ALIFMDRING_H //==================================================================== ClassImp(AliFMD2) diff --git a/FMD/AliFMD2.h b/FMD/AliFMD2.h index a4c30a53140..19bfcc1fe0f 100644 --- a/FMD/AliFMD2.h +++ b/FMD/AliFMD2.h @@ -8,6 +8,10 @@ @date Sun Mar 26 18:25:28 2006 @brief Geometry parameters of the FMD2 detector. */ +// Geometry parameters of the FMD2 detector. This has two rings. +// Other than that it's fairly straight forward. Needs to make the +// full support stuff. +// #ifndef ALIFMDDETECTOR_H # include "AliFMDDetector.h" #endif @@ -16,17 +20,19 @@ /** @class AliFMD2 AliFMD2.h @brief Geometry parameters of the FMD2 detector. This has two rings. + @todo Flesh out support once it's defined @image html FMD2.png @ingroup FMD_base */ class AliFMD2 : public AliFMDDetector { -protected: public: /** Constructor @param inner Pointer to inner ring description @param outer Pointer to outer ring description */ AliFMD2(AliFMDRing* inner, AliFMDRing* outer); + /** Destructor */ + virtual ~AliFMD2() {} /** Initialize the geometry */ virtual void Init(); ClassDef(AliFMD2, 1); diff --git a/FMD/AliFMD3.cxx b/FMD/AliFMD3.cxx index c422c2731a0..ecdab228bb1 100644 --- a/FMD/AliFMD3.cxx +++ b/FMD/AliFMD3.cxx @@ -30,7 +30,7 @@ #include "AliFMD3.h" // ALIFMD3_H #include "AliLog.h" // ALILOG_H #include "AliFMDRing.h" // ALIFMDRING_H -#include // ROOT_TMath +// #include // ROOT_TMath //==================================================================== ClassImp(AliFMD3) diff --git a/FMD/AliFMD3.h b/FMD/AliFMD3.h index b81051c871b..785dba99ead 100644 --- a/FMD/AliFMD3.h +++ b/FMD/AliFMD3.h @@ -8,6 +8,10 @@ @date Sun Mar 26 18:23:48 2006 @brief Geometry parameters of the FMD3 detector. */ +// Geometry parameters of the FMD3 detector. FMD3 has a fairly +// complicated support structure. The cone also supports the +// beam-pipe. +// #ifndef ALIFMDDETECTOR_H # include "AliFMDDetector.h" #endif diff --git a/FMD/AliFMDAlignFaker.cxx b/FMD/AliFMDAlignFaker.cxx index 7cfa1930cfc..6945074400f 100644 --- a/FMD/AliFMDAlignFaker.cxx +++ b/FMD/AliFMDAlignFaker.cxx @@ -19,6 +19,15 @@ @brief Implementation of AliFMDAlignFaker */ //____________________________________________________________________ +// +// Class +// to +// make +// fake +// alignment +// parameters +// +//____________________________________________________________________ // // Forward Multiplicity Detector based on Silicon wafers. // @@ -33,19 +42,19 @@ #include "AliFMDAlignFaker.h" // ALIFMDALIGNFAKER_H #include // ALICDBMANAGER_H #include // ALICDBMANAGER_H -#include +// #include #include -#include -#include -#include +// #include +// #include +// #include #include #include #include #include #include #include -#include -#include +// #include +// #include //==================================================================== ClassImp(AliFMDAlignFaker) @@ -180,6 +189,16 @@ AliFMDAlignFaker::MakeAlign(const TString& path, Int_t id, Double_t transX, Double_t transY, Double_t transZ, Double_t rotX, Double_t rotY, Double_t rotZ) { + // make alignment for a path + // Params: + // path Path to node + // id Volume number + // transX Translation in X + // transZ Translation in Y + // transZ Translation in Z + // rotX Rotation about X-axis + // rotY Rotation about Y-axis + // rotZ Rotation about Z-axis AliDebug(1, Form("Make alignment for %s (volume %d): (%f,%f,%f) (%f,%f,%f)", path.Data(), id, transX, transY, transZ, rotX, rotY, rotZ)); Int_t nAlign = fArray->GetEntries(); @@ -200,6 +219,7 @@ AliFMDAlignFaker::MakeAlign(const TString& path, Int_t id, Bool_t AliFMDAlignFaker::MakeAlignHalf(const TString& path, Int_t id) { + // Make alignment of a half ring/cone AliDebug(15, Form("Make alignment for half-ring/cone %s", path.Data())); Double_t transX = gRandom->Uniform(fHalfTransMin.X(), fHalfTransMax.X()); Double_t transY = gRandom->Uniform(fHalfTransMin.Y(), fHalfTransMax.Y()); @@ -215,6 +235,7 @@ AliFMDAlignFaker::MakeAlignHalf(const TString& path, Int_t id) Bool_t AliFMDAlignFaker::MakeAlignSensor(const TString& path, Int_t id) { + // Make alignment of a sensor AliDebug(15, Form("Make alignment for sensor %s", path.Data())); Double_t transX = gRandom->Uniform(fSensorTransMin.X(), fSensorTransMax.X()); Double_t transY = gRandom->Uniform(fSensorTransMin.Y(), fSensorTransMax.Y()); @@ -249,6 +270,7 @@ AliFMDAlignFaker::WriteToCDB() void AliFMDAlignFaker::WriteToFile() { + // Write to a local file TFile* file = TFile::Open(GetTitle(), "RECREATE"); if (!file) { AliFatal(Form("Failed to open file '%s' for output", GetTitle())); diff --git a/FMD/AliFMDAlignFaker.h b/FMD/AliFMDAlignFaker.h index e8197042701..ef6d90c44b0 100644 --- a/FMD/AliFMDAlignFaker.h +++ b/FMD/AliFMDAlignFaker.h @@ -14,7 +14,12 @@ */ //____________________________________________________________________ // -// Class to make fake alignration parameters +// Class +// to +// make +// fake +// alignment +// parameters // #ifndef ROOT_TTask # include @@ -119,6 +124,9 @@ public: @param option Not used. */ void Exec(Option_t* option=""); protected: + AliFMDAlignFaker(const AliFMDAlignFaker& o) : TTask(o) {} + AliFMDAlignFaker& operator=(const AliFMDAlignFaker&) { return *this; } + /** Make the alignment object for a path @param path Node path. @param volID Volume identifier diff --git a/FMD/AliFMDAltroMapping.cxx b/FMD/AliFMDAltroMapping.cxx index d0e9d89efb9..e731f4645e0 100644 --- a/FMD/AliFMDAltroMapping.cxx +++ b/FMD/AliFMDAltroMapping.cxx @@ -22,6 +22,16 @@ // // Mapping of ALTRO hardware channel to detector coordinates // +// The hardware address consist of a DDL number and 12bits of ALTRO +// addresses. The ALTRO address are formatted as follows. +// +// 12 7 4 0 +// |---------------|---------|------------| +// | Board # | ALTRO # | Channel # | +// +---------------+---------+------------+ +// +// +// #include "AliFMDAltroMapping.h" // ALIFMDALTROMAPPING_H #include "AliFMDParameters.h" #include "AliLog.h" diff --git a/FMD/AliFMDAltroMapping.h b/FMD/AliFMDAltroMapping.h index 1e4e56f4238..1f98aa39fdf 100644 --- a/FMD/AliFMDAltroMapping.h +++ b/FMD/AliFMDAltroMapping.h @@ -21,7 +21,18 @@ #ifndef ROOT_TArrayI # include #endif - +// +// Map hardware address to detector coordinates. +// +// The hardware address consist of a DDL number and 12bits of ALTRO +// addresses. The ALTRO address are formatted as follows. +// +// 12 7 4 0 +// |---------------|---------|------------| +// | Board # | ALTRO # | Channel # | +// +---------------+---------+------------+ +// +// //____________________________________________________________________ /** @class AliFMDAltroMapping @brief Class that encodes a map to/from ALTRO hardware address to @@ -43,6 +54,8 @@ class AliFMDAltroMapping : public AliAltroMapping public: /** Constructor */ AliFMDAltroMapping(); + /** Destructor */ + virtual ~AliFMDAltroMapping() {} /** Map a hardware address into a detector index. @param ddl Hardware DDL number @param hwaddr Hardware address. diff --git a/FMD/AliFMDBaseDigit.cxx b/FMD/AliFMDBaseDigit.cxx new file mode 100644 index 00000000000..f570effc8d0 --- /dev/null +++ b/FMD/AliFMDBaseDigit.cxx @@ -0,0 +1,155 @@ +/************************************************************************** + * Copyright(c) 2004, 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 AliFMDBaseDigit.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:37:41 2006 + @brief Digits for the FMD + @ingroup FMD_base +*/ +////////////////////////////////////////////////////////////////////// +// +// Digits classes for the FMD +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// +// As the Digits and SDigits have so much in common, the classes +// AliFMDDigit and AliFMDSDigit are implemented via a base +// class AliFMDBaseDigit. +/// +// +-----------------+ +// | AliFMDBaseDigit | +// +-----------------+ +// ^ +// | +// +------------+ +// | | +// +-------------+ +--------------+ +// | AliFMDDigit | | AliFMDSDigit | +// +-------------+ +--------------+ +// +// (Note, that I'd really would have liked to implement AliFMDHit as a +// derived class from some base class - say AliFMDStrip, and the Digit +// classes would (eventually) have derived from that as well. +// However, ROOT doesn't do well with multiple inheritance, so I chose +// not to anyway). +// +// Latest changes by Christian Holm Christensen +// +////////////////////////////////////////////////////////////////////// + +#include "AliFMDBaseDigit.h" // ALIFMDDIGIT_H +#include "Riostream.h" // ROOT_Riostream +#include +#include + +//==================================================================== +ClassImp(AliFMDBaseDigit) +#if 0 + ; // This is here to keep Emacs from indenting the next line +#endif + +//____________________________________________________________________ +AliFMDBaseDigit::AliFMDBaseDigit() + : fDetector(0), + fRing('\0'), + fSector(0), + fStrip(0) +{} + +//____________________________________________________________________ +AliFMDBaseDigit::AliFMDBaseDigit(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip) + : fDetector(detector), + fRing(ring), + fSector(sector), + fStrip(strip) +{ + // + // Creates a base data digit object + // + // Parameters + // + // detector Detector # (1, 2, or 3) + // ring Ring ID ('I' or 'O') + // sector Sector # (For inner/outer rings: 0-19/0-39) + // strip Strip # (For inner/outer rings: 0-511/0-255) +} + +//____________________________________________________________________ +void +AliFMDBaseDigit::Print(Option_t* /* option*/) const +{ + // Print digit to standard out + cout << ClassName() << ": FMD" << GetName() << flush; +} + +//____________________________________________________________________ +const char* +AliFMDBaseDigit::GetName() const +{ + // Get the name of a FMD digit. + if (fName.IsNull()) + fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip); + return fName.Data(); +} +#define fMaxStrips 512 +#define fMaxSectors 40 +#define fMaxRings 2 + +//____________________________________________________________________ +ULong_t +AliFMDBaseDigit::Hash() const +{ + size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1); + return fStrip + fMaxStrips * + (fSector + fMaxSectors * (ringi + fMaxRings * (fDetector - 1))); +} + + +//____________________________________________________________________ +Int_t +AliFMDBaseDigit::Compare(const TObject* o) const +{ + if (!o) + AliFatal("Can not compare to NULL!"); + if (o->IsA() != AliFMDBaseDigit::Class()) + AliFatal(Form("Cannot compare to a %s object", o->ClassName())); + // AliFMDBaseDigit* of = static_cast(o); + if (Hash() == o->Hash()) return 0; + if (Hash() < o->Hash()) return -1; + return 1; +} + + +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/AliFMDBaseDigit.h b/FMD/AliFMDBaseDigit.h new file mode 100644 index 00000000000..fe9b7e70d2d --- /dev/null +++ b/FMD/AliFMDBaseDigit.h @@ -0,0 +1,82 @@ +#ifndef ALIFMDBASEDIGIT_H +#define ALIFMDBASEDIGIT_H +/** @file AliFMDBaseDigit.h + @author Christian Holm Christensen + @date Mon Mar 27 12:37:41 2006 + @brief Digits for the FMD + @ingroup FMD_base +*/ +//___________________________________________________________________ +// +// Digits classes for the FMD +// AliFMDBaseDigit - base class +// AliFMDDigit - Normal (smeared) digit +// AliFMDSDigit - Summable (non-smeared) digit +// +#ifndef ROOT_TObject +# include +#endif +#ifndef ROOT_TString +# include +#endif + +//____________________________________________________________________ +/** @class AliFMDBaseDigit AliFMDDigit.h + @brief base class for digits + @ingroup FMD_base + */ +class AliFMDBaseDigit : public TObject +{ +public: + /** CTOR */ + AliFMDBaseDigit(); + /** Constrctor + @param detector Detector + @param ring Ring + @param sector Sector + @param strip Strip */ + AliFMDBaseDigit(UShort_t detector, + Char_t ring='\0', + UShort_t sector=0, + UShort_t strip=0); + /** DTOR */ + virtual ~AliFMDBaseDigit() {} + /** @return Detector # */ + UShort_t Detector() const { return fDetector; } + /** @return Ring ID */ + Char_t Ring() const { return fRing; } + /** @return sector # */ + UShort_t Sector() const { return fSector; } + /** @return strip # */ + UShort_t Strip() const { return fStrip; } + /** Print information + @param opt Not used */ + virtual void Print(Option_t* opt="") const; + /** @return Name */ + const char* GetName() const; + /** @param rhs Other digit to compare to + @return -1 if this is less than @a rhs, 0 if the refer to the + same, and 1 if @a rhs is larger than this */ + Int_t Compare(const TObject* o) const; + /** @return Always true */ + Bool_t IsSortable() const { return kTRUE; } +protected: + ULong_t Hash() const; + UShort_t fDetector; // (Sub) Detector # (1,2, or 3) + Char_t fRing; // Ring ID ('I' or 'O') + UShort_t fSector; // Sector # (phi division) + UShort_t fStrip; // Strip # (radial division) + mutable TString fName; //! Name (cached, but not stored) + ClassDef(AliFMDBaseDigit, 2) // Base class for FMD digits +}; + +#endif +//____________________________________________________________________ +// +// Local Variables: +// mode: C++ +// End: +// +// +// EOF +// diff --git a/FMD/AliFMDBaseDigitizer.cxx b/FMD/AliFMDBaseDigitizer.cxx new file mode 100644 index 00000000000..7eb02c9e6c7 --- /dev/null +++ b/FMD/AliFMDBaseDigitizer.cxx @@ -0,0 +1,504 @@ +/************************************************************************** + * Copyright(c) 2004, 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 AliFMDBaseDigitizer.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:38:26 2006 + @brief FMD Digitizers implementation + @ingroup FMD_sim +*/ +////////////////////////////////////////////////////////////////////////////// +// +// This class contains the procedures simulation ADC signal for the +// Forward Multiplicity detector : Hits->Digits and Hits->SDigits +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// +// As the Digits and SDigits have so much in common, the classes +// AliFMDDigitizer and AliFMDSDigitizer are implemented via a base +// class AliFMDBaseDigitizer. +// +// +---------------------+ +// | AliFMDBaseDigitizer | +// +---------------------+ +// ^ +// | +// +----------+---------+ +// | | +// +-----------------+ +------------------+ +// | AliFMDDigitizer | | AliFMDSDigitizer | +// +-----------------+ +------------------+ +// +// These classes has several paramters: +// +// fPedestal +// fPedestalWidth +// (Only AliFMDDigitizer) +// Mean and width of the pedestal. The pedestal is simulated +// by a Guassian, but derived classes my override MakePedestal +// to simulate it differently (or pick it up from a database). +// +// fVA1MipRange +// The dymamic MIP range of the VA1_ALICE pre-amplifier chip +// +// fAltroChannelSize +// The largest number plus one that can be stored in one +// channel in one time step in the ALTRO ADC chip. +// +// fSampleRate +// How many times the ALTRO ADC chip samples the VA1_ALICE +// pre-amplifier signal. The VA1_ALICE chip is read-out at +// 10MHz, while it's possible to drive the ALTRO chip at +// 25MHz. That means, that the ALTRO chip can have time to +// sample each VA1_ALICE signal up to 2 times. Although it's +// not certain this feature will be used in the production, +// we'd like have the option, and so it should be reflected in +// the code. +// +// +// The shaping function of the VA1_ALICE is generally given by +// +// f(x) = A(1 - exp(-Bx)) +// +// where A is the total charge collected in the pre-amp., and B is a +// paramter that depends on the shaping time of the VA1_ALICE circut. +// +// When simulating the shaping function of the VA1_ALICe +// pre-amp. chip, we have to take into account, that the shaping +// function depends on the previous value of read from the pre-amp. +// +// That results in the following algorithm: +// +// last = 0; +// FOR charge IN pre-amp. charge train DO +// IF last < charge THEN +// f(t) = (charge - last) * (1 - exp(-B * t)) + last +// ELSE +// f(t) = (last - charge) * exp(-B * t) + charge) +// ENDIF +// FOR i IN # samples DO +// adc_i = f(i / (# samples)) +// DONE +// last = charge +// DONE +// +// Here, +// +// pre-amp. charge train +// is a series of 128 charges read from the VA1_ALICE chip +// +// # samples +// is the number of times the ALTRO ADC samples each of the 128 +// charges from the pre-amp. +// +// Where Q is the total charge collected by the VA1_ALICE +// pre-amplifier. Q is then given by +// +// E S +// Q = - - +// e R +// +// where E is the total energy deposited in a silicon strip, R is the +// dynamic range of the VA1_ALICE pre-amp (fVA1MipRange), e is the +// energy deposited by a single MIP, and S ALTRO channel size in each +// time step (fAltroChannelSize). +// +// The energy deposited per MIP is given by +// +// e = M * rho * w +// +// where M is the universal number 1.664, rho is the density of +// silicon, and w is the depth of the silicon sensor. +// +// The final ADC count is given by +// +// C' = C + P +// +// where P is the (randomized) pedestal (see MakePedestal) +// +// This class uses the class template AliFMDMap to make an +// internal cache of the energy deposted of the hits. The class +// template is instantasized as +// +// typedef AliFMDMap > AliFMDEdepMap; +// +// The first member of the values is the summed energy deposition in a +// given strip, while the second member of the values is the number of +// hits in a given strip. Using the second member, it's possible to +// do some checks on just how many times a strip got hit, and what +// kind of error we get in our reconstructed hits. Note, that this +// information is currently not written to the digits tree. I think a +// QA (Quality Assurance) digit tree is better suited for that task. +// However, the information is there to be used in the future. +// +// +// Latest changes by Christian Holm Christensen +// +////////////////////////////////////////////////////////////////////////////// + +// /1 +// | A(-1 + B + exp(-B)) +// | f(x) dx = ------------------- = 1 +// | B +// / 0 +// +// and B is the a parameter defined by the shaping time (fShapingTime). +// +// Solving the above equation, for A gives +// +// B +// A = ---------------- +// -1 + B + exp(-B) +// +// So, if we define the function g: [0,1] -> [0:1] by +// +// / v +// | Bu + exp(-Bu) - Bv - exp(-Bv) +// g(u,v) = | f(x) dx = -A ----------------------------- +// | B +// / u +// +// we can evaluate the ALTRO sample of the VA1_ALICE pre-amp between +// any two times (u, v), by +// +// +// B Bu + exp(-Bu) - Bv - exp(-Bv) +// C = Q g(u,v) = - Q ---------------- ----------------------------- +// -1 + B + exp(-B) B +// +// Bu + exp(-Bu) - Bv - exp(-Bv) +// = - Q ----------------------------- +// -1 + B + exp(-B) +// + +#include // ROOT_TTree +//#include // ROOT_TRandom +#include // ALILOG_H +#include "AliFMDBaseDigitizer.h" // ALIFMDDIGITIZER_H +#include "AliFMD.h" // ALIFMD_H +#include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H +#include "AliFMDDetector.h" // ALIFMDDETECTOR_H +#include "AliFMDRing.h" // ALIFMDRING_H +#include "AliFMDHit.h" // ALIFMDHIT_H +#include "AliFMDDigit.h" // ALIFMDDIGIT_H +#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H +#include // ALIRUNDIGITIZER_H +//#include // ALIRUN_H +#include // ALILOADER_H +#include // ALIRUNLOADER_H + +//==================================================================== +ClassImp(AliFMDBaseDigitizer) +#if 0 + ; // This is here to keep Emacs for indenting the next line +#endif + +//____________________________________________________________________ +AliFMDBaseDigitizer::AliFMDBaseDigitizer() + : fRunLoader(0) +{ + // Default ctor - don't use it +} + +//____________________________________________________________________ +AliFMDBaseDigitizer::AliFMDBaseDigitizer(AliRunDigitizer* manager) + : AliDigitizer(manager, "AliFMDBaseDigitizer", "FMD Digitizer base class"), + fRunLoader(0), + fEdep(AliFMDMap::kMaxDetectors, + AliFMDMap::kMaxRings, + AliFMDMap::kMaxSectors, + AliFMDMap::kMaxStrips) +{ + // Normal CTOR + AliDebug(1," processed"); + SetShapingTime(); +} + +//____________________________________________________________________ +AliFMDBaseDigitizer::AliFMDBaseDigitizer(const Char_t* name, + const Char_t* title) + : AliDigitizer(name, title), + fRunLoader(0), + fEdep(AliFMDMap::kMaxDetectors, + AliFMDMap::kMaxRings, + AliFMDMap::kMaxSectors, + AliFMDMap::kMaxStrips) +{ + // Normal CTOR + AliDebug(1," processed"); + SetShapingTime(); +} + +//____________________________________________________________________ +AliFMDBaseDigitizer::~AliFMDBaseDigitizer() +{ + // Destructor +} + +//____________________________________________________________________ +Bool_t +AliFMDBaseDigitizer::Init() +{ + // Initialization + AliFMDParameters::Instance()->Init(); + return kTRUE; +} + + +//____________________________________________________________________ +UShort_t +AliFMDBaseDigitizer::MakePedestal(UShort_t, + Char_t, + UShort_t, + UShort_t) const +{ + // Make a pedestal + return 0; +} + +//____________________________________________________________________ +void +AliFMDBaseDigitizer::SumContributions(AliFMD* fmd) +{ + // Sum energy deposited contributions from each hit in a cache + // (fEdep). + if (!fRunLoader) + Fatal("SumContributions", "no run loader"); + + // Clear array of deposited energies + fEdep.Reset(); + + // Get the FMD loader + AliLoader* inFMD = fRunLoader->GetLoader("FMDLoader"); + // And load the hits + inFMD->LoadHits("READ"); + + // Get the tree of hits + TTree* hitsTree = inFMD->TreeH(); + if (!hitsTree) { + // Try again + inFMD->LoadHits("READ"); + hitsTree = inFMD->TreeH(); + } + + // Get the FMD branch + TBranch* hitsBranch = hitsTree->GetBranch("FMD"); + if (hitsBranch) fmd->SetHitsAddressBranch(hitsBranch); + else AliFatal("Branch FMD hit not found"); + + // Get a list of hits from the FMD manager + TClonesArray *fmdHits = fmd->Hits(); + + // Get number of entries in the tree + Int_t ntracks = Int_t(hitsTree->GetEntries()); + + AliFMDParameters* param = AliFMDParameters::Instance(); + Int_t read = 0; + // Loop over the tracks in the + for (Int_t track = 0; track < ntracks; track++) { + // Read in entry number `track' + read += hitsBranch->GetEntry(track); + + // Get the number of hits + Int_t nhits = fmdHits->GetEntries (); + for (Int_t hit = 0; hit < nhits; hit++) { + // Get the hit number `hit' + AliFMDHit* fmdHit = + static_cast(fmdHits->UncheckedAt(hit)); + + // Extract parameters + UShort_t detector = fmdHit->Detector(); + Char_t ring = fmdHit->Ring(); + 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)) { + 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)", + detector, ring, sector, strip)); + + // Sum energy deposition + fEdep(detector, ring, sector, strip).fEdep += edep; + fEdep(detector, ring, sector, strip).fN += 1; + // Add this to the energy deposited for this strip + } // hit loop + } // track loop + AliDebug(1, Form("Size of cache: %d bytes, read %d bytes", + sizeof(fEdep), read)); +} + +//____________________________________________________________________ +void +AliFMDBaseDigitizer::DigitizeHits(AliFMD* fmd) const +{ + // For the stored energy contributions in the cache (fEdep), convert + // the energy signal to ADC counts, and store the created digit in + // the digits array (AliFMD::fDigits) + // + AliFMDGeometry* geometry = AliFMDGeometry::Instance(); + + TArrayI counts(3); + for (UShort_t detector=1; detector <= 3; detector++) { + // Get pointer to subdetector + AliFMDDetector* det = geometry->GetDetector(detector); + if (!det) continue; + for (UShort_t ringi = 0; ringi <= 1; ringi++) { + Char_t ring = ringi == 0 ? 'I' : 'O'; + // Get pointer to Ring + AliFMDRing* r = det->GetRing(ring); + if (!r) continue; + + // Get number of sectors + UShort_t nSectors = UShort_t(360. / r->GetTheta()); + // Loop over the number of sectors + for (UShort_t sector = 0; sector < nSectors; sector++) { + // Get number of strips + UShort_t nStrips = r->GetNStrips(); + // Loop over the stips + Float_t last = 0; + for (UShort_t strip = 0; strip < nStrips; strip++) { + // Reset the counter array to the invalid value -1 + counts.Reset(-1); + // Reset the last `ADC' value when we've get to the end of a + // VA1_ALICE channel. + if (strip % 128 == 0) last = 0; + + Float_t edep = fEdep(detector, ring, sector, strip).fEdep; + ConvertToCount(edep, last, detector, ring, sector, strip, counts); + last = edep; + AddDigit(fmd, detector, ring, sector, strip, edep, + UShort_t(counts[0]), Short_t(counts[1]), + Short_t(counts[2])); +#if 0 + // This checks if the digit created will give the `right' + // number of particles when reconstructed, using a naiive + // approach. It's here only as a quality check - nothing + // else. + CheckDigit(digit, fEdep(detector, ring, sector, strip).fN, + counts); +#endif + } // Strip + } // Sector + } // Ring + } // Detector +} + +//____________________________________________________________________ +void +AliFMDBaseDigitizer::ConvertToCount(Float_t edep, + Float_t last, + UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + TArrayI& counts) const +{ + // Convert the total energy deposited to a (set of) ADC count(s). + // + // This is done by + // + // Energy_Deposited ALTRO_Channel_Size + // ADC = -------------------------- ------------------- + pedestal + // Energy_Deposition_Of_1_MIP VA1_ALICE_MIP_Range + // + // Energy_Deposited fAltroChannelSize + // = --------------------------------- ----------------- + pedestal + // 1.664 * Si_Thickness * Si_Density fVA1MipRange + // + // + // = Energy_Deposited * ConversionFactor + pedestal + // + // However, this is modified by the response function of the + // VA1_ALICE pre-amp. chip in case we are doing oversampling of the + // VA1_ALICE output. + // + // In that case, we get N=fSampleRate values of the ADC, and the + // `EnergyDeposited' is a function of which sample where are + // calculating the ADC for + // + // ADC_i = f(EnergyDeposited, i/N, Last) * ConversionFactor + pedestal + // + // where Last is the Energy deposited in the previous strip. + // + // Here, f is the shaping function of the VA1_ALICE. This is given + // by + // + // | (E - l) * (1 - exp(-B * t) + l if E > l + // f(E, t, l) = < + // | (l - E) * exp(-B * t) + E otherwise + // + // + // = E + (l - E) * ext(-B * t) + // + AliFMDParameters* param = AliFMDParameters::Instance(); + 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(detector,ring,sector,strip); + UShort_t size = param->GetAltroChannelSize(); + + // In case we don't oversample, just return the end value. + if (rate == 1) { + counts[0] = UShort_t(TMath::Min(edep * convF + ped, Float_t(size))); + return; + } + + // Create a pedestal + Float_t b = fShapingTime; + for (Ssiz_t i = 0; i < rate; i++) { + Float_t t = Float_t(i) / rate; + Float_t s = edep + (last - edep) * TMath::Exp(-b * t); + counts[i] = UShort_t(TMath::Min(s * convF + ped, Float_t(maxAdc))); + } +} + + + +//____________________________________________________________________ +// +// EOF +// + + + + diff --git a/FMD/AliFMDBaseDigitizer.h b/FMD/AliFMDBaseDigitizer.h new file mode 100644 index 00000000000..86a188cde7e --- /dev/null +++ b/FMD/AliFMDBaseDigitizer.h @@ -0,0 +1,260 @@ +#ifndef ALIFMDBASEDIGITIZER_H +#define ALIFMDBASEDIGITIZER_H +/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights + * reserved. + * + * See cxx source for full Copyright notice + */ +// Classses to make Hits into digits and summable digits. +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Summable digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// +/** @file AliFMDBaseDigitizer.h + @author Christian Holm Christensen + @date Mon Mar 27 12:38:26 2006 + @brief FMD Digitizers declaration + @ingroup FMD_sim +*/ +#ifndef ALIDIGITIZER_H +# include +#endif +#ifndef ALIRUNDIGITIZER_H +# include +#endif +#ifndef ALIFMDEdepMAP_H +# include "AliFMDEdepMap.h" +#endif +//==================================================================== +class TClonesArray; +class AliFMD; +class AliLoader; +class AliRunLoader; +class AliFMDDigit; + + +//==================================================================== +/** @class AliFMDBaseDigitizer AliFMDDigitizer.h + @brief Base class for digitizers. + + This class contains the procedures simulation ADC signal for the + Forward Multiplicity detector : Hits->Digits and Hits->SDigits + + Digits consists of + - Detector # + - Ring ID + - Sector # + - Strip # + - ADC count in this channel + + Summable digits consists of + - Detector # + - Ring ID + - Sector # + - Strip # + - Total energy deposited in the strip + - ADC count in this channel + + As the Digits and SDigits have so much in common, the classes + AliFMDDigitizer and AliFMDSDigitizer are implemented via a base + class AliFMDBaseDigitizer. + @verbatim + +---------------------+ + | AliFMDBaseDigitizer | + +---------------------+ + ^ + | + +----------+---------+ + | | + +-----------------+ +------------------+ + | AliFMDDigitizer | | AliFMDSDigitizer | + +-----------------+ +------------------+ + @endverbatim + These classes uses parameters fetched from the AliFMDParameters + manager. + + The shaping function of the VA1 is generally given by + @f[ + f(x) = A(1 - \exp(-Bx)) + @f] + where A is the total charge collected in the pre-amp., and B is a + paramter that depends on the shaping time of the VA1 circut. + + When simulating the shaping function of the VA1 pre-amp. chip, we + have to take into account, that the shaping function depends on + the previous value of read from the pre-amp. + + That results in the following algorithm: + @code + last = 0; + for (i=0; i < n_pre_amp_charge; i++) { + charge = GetCharge(i); + if (last < charge) + f(t) = (charge - last) * (1 - exp(-B * t)) + last + else + f(t) = (last - charge) * exp(-B * t) + charge) + for (j=0; j < sample_rate; j++) + adc[j] = f(i / (# samples)) + last = charge + } + @endcode + Here, the first loop is over all charges collected by the VA1 + chip, and the @c sample_rate is how many times the ALTRO ADC + samples each of the 128 charges from the pre-amp. + + The @c charge is the total charge @f$ Q@f$ collected by the VA1 + pre-amplifier for a strip. @f$ Q@f$ is then given by + @f[ + Q = \frac{E}{e}\frac{S}{r} + @f] + where @f$ E@f$ is the total energy deposited in a silicon strip, + @f$ R@f$ is the dynamic range of the VA1 pre-amp, @f$ e@f$ is the + energy deposited by a single MIP, and @f$ S@f$ ALTRO channel size + in each time step. + + The energy deposited per MIP is given by + @f$ + e = M \rho w + @f$ + where @f$ M@f$ is the universal number + @f$ 1.664 \mbox{keV}\mbox{cm}^{2}\mbox{g}^{-1}@f$, @f$ \rho@f$ is + the density of silicon, and @f$ w@f$ is the depth of the silicon + sensor. + + The final ADC count is given by + @f[ + C' = C + P + @f] + where @f$ P@f$ is the (randomized) pedestal. + + This class uses the class template AliFMDEdepMap to make an + internal cache of the energy deposted of the hits. The class + template is instantasized as + + The first member of the values is the summed energy deposition in a + given strip, while the second member of the values is the number of + hits in a given strip. Using the second member, it's possible to + do some checks on just how many times a strip got hit, and what + kind of error we get in our reconstructed hits. Note, that this + information is currently not written to the digits tree. I think a + QA (Quality Assurance) digit tree is better suited for that task. + However, the information is there to be used in the future. + @ingroup FMD_sim + */ +class AliFMDBaseDigitizer : public AliDigitizer +{ +public: + /** CTOR */ + AliFMDBaseDigitizer(); + /** Normal CTOR + @param manager Manager of digitization */ + AliFMDBaseDigitizer(AliRunDigitizer * manager); + /** Normal ctor + @param name Name + @param title Title */ + AliFMDBaseDigitizer(const Char_t* name, const Char_t* title); + /** DTOR */ + virtual ~AliFMDBaseDigitizer(); + + /** Initialize */ + virtual Bool_t Init(); + + /** The response shape of the VA1 shaping circuit is approximently + given by + @f[ + f(x) = A(1 - \exp(-Bx)) + @f] + where @f$ A@f$ is the total charge collected by the pre-amp., + and @f$ B@f$ is parameter that depends on the shaping time of + the @b VA1 pre-amp. This member function sets the parameter @f$ + B@f$ + @param B */ + void SetShapingTime(Float_t B=10) { fShapingTime = B; } + /** @return Get the shaping time */ + Float_t GetShapingTime() const { return fShapingTime; } +protected: + /** Sum energy deposited contributions from each hit in a cache + @param fmd Pointer to detector */ + virtual void SumContributions(AliFMD* fmd); + /** For the stored energy contributions in the cache, convert the + energy signal to ADC counts, and store the created digit in + the digits array + @param fmd Pointer to detector */ + virtual void DigitizeHits(AliFMD* fmd) const; + /** Convert the total energy deposited to a (set of) ADC count(s). + See also the class description for more details. + @param edep Total energy deposited in detector + @param last Last charge collected in previous VA1 channnel + @param detector Detector # + @param ring Ring ID + @param sector Sector # + @param strip Strip # + @param counts Array holding the counts on return */ + virtual void ConvertToCount(Float_t edep, + Float_t last, + UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + TArrayI& counts) const; + /** Make a pedestal + @param detector Detector # + @param ring Ring ID + @param sector Sector # + @param strip Strip # + @return Pedestal value */ + virtual UShort_t MakePedestal(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip) const; + /** Add noise to each sample */ + virtual void AddNoise(TArrayI&) const {} + /** Add a digit to output */ + virtual void AddDigit(AliFMD* /* fmd */, + UShort_t /* detector */, + Char_t /* ring */, + UShort_t /* sector */, + UShort_t /* strip */, + Float_t /* edep */, + UShort_t /* count1 */, + Short_t /* count2 */, + Short_t /* count3 */) const {} + + AliRunLoader* fRunLoader; //! Run loader + AliFMDEdepMap fEdep; // Cache of Energy from hits + Float_t fShapingTime; // Shaping profile parameter + + /** Copy CTOR + @param o object to copy from */ + AliFMDBaseDigitizer(const AliFMDBaseDigitizer& o) + : AliDigitizer(o) {} + /** Assignment operator + @return Reference to this object */ + AliFMDBaseDigitizer& operator=(const AliFMDBaseDigitizer&) { return *this; } + ClassDef(AliFMDBaseDigitizer,2) // Base class for FMD digitizers +}; + + +#endif +//____________________________________________________________________ +// +// Local Variables: +// mode: C++ +// End: +// +// +// EOF +// + diff --git a/FMD/AliFMDCalibFaker.cxx b/FMD/AliFMDCalibFaker.cxx index 491c506da5e..d7491c9e032 100644 --- a/FMD/AliFMDCalibFaker.cxx +++ b/FMD/AliFMDCalibFaker.cxx @@ -17,6 +17,7 @@ @author Christian Holm Christensen @date Sun Mar 26 18:29:21 2006 @brief Make fake calibration data + @ingroup FMD_util */ //____________________________________________________________________ // @@ -38,9 +39,9 @@ #include "AliFMDCalibStripRange.h" // ALIFMDCALIBSTRIPRANGE_H #include // ALICDBMANAGER_H #include // ALICDBMANAGER_H -#include +//#include #include -#include +// #include #include #include @@ -102,7 +103,7 @@ AliFMDCalibFaker::Exec(Option_t*) fGain = (param->GetVA1MipRange() * param->GetEdepMip() / maxADC); fThreshold = fThresholdFactor * param->GetEdepMip(); AliFMDCalibGain* gain = MakePulseGain(); - AliCDBId id(AliFMDParameters::fgkPulseGain, fRunMin, fRunMax); + AliCDBId id(AliFMDParameters::PulseGainPath(), fRunMin, fRunMax); MAKE_META(meta); meta->SetProperty("key1", gain); cdb->Put(gain, id, meta); @@ -113,7 +114,7 @@ AliFMDCalibFaker::Exec(Option_t*) fPedestalMin = TMath::Max(TMath::Min(fPedestalMin, maxADC), 0.F); fPedestalMax = TMath::Max(TMath::Min(fPedestalMax, maxADC), fPedestalMin); AliFMDCalibPedestal* pedestal = MakePedestal(); - AliCDBId id(AliFMDParameters::fgkPedestal, fRunMin, fRunMax); + AliCDBId id(AliFMDParameters::PedestalPath(), fRunMin, fRunMax); MAKE_META(meta); meta->SetProperty("key1", pedestal); cdb->Put(pedestal, id, meta); @@ -123,7 +124,7 @@ AliFMDCalibFaker::Exec(Option_t*) if (TESTBIT(fMask, kDeadMap)) { fDeadChance = TMath::Max(TMath::Min(fDeadChance, 1.F), 0.F); AliFMDCalibDeadMap* deadMap = MakeDeadMap(); - AliCDBId id(AliFMDParameters::fgkDead, fRunMin, fRunMax); + AliCDBId id(AliFMDParameters::DeadPath(), fRunMin, fRunMax); MAKE_META(meta); meta->SetProperty("key1", deadMap); cdb->Put(deadMap, id, meta); @@ -133,7 +134,7 @@ AliFMDCalibFaker::Exec(Option_t*) if (TESTBIT(fMask, kZeroSuppression)) { fZeroThreshold = TMath::Min(fZeroThreshold, UShort_t(maxADC)); AliFMDCalibZeroSuppression* zeroSup = MakeZeroSuppression(); - AliCDBId id(AliFMDParameters::fgkZeroSuppression, + AliCDBId id(AliFMDParameters::ZeroSuppressionPath(), fRunMin, fRunMax); MAKE_META(meta); meta->SetProperty("key1", zeroSup); @@ -144,7 +145,7 @@ AliFMDCalibFaker::Exec(Option_t*) if (TESTBIT(fMask, kSampleRate)) { fRate = TMath::Max(TMath::Min(fRate, UShort_t(8)), UShort_t(1)); AliFMDCalibSampleRate* rate = MakeSampleRate(); - AliCDBId id(AliFMDParameters::fgkSampleRate,fRunMin,fRunMax); + AliCDBId id(AliFMDParameters::SampleRatePath(),fRunMin,fRunMax); MAKE_META(meta); meta->SetProperty("key1", rate); cdb->Put(rate, id, meta); @@ -154,7 +155,7 @@ AliFMDCalibFaker::Exec(Option_t*) 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); + AliCDBId id(AliFMDParameters::StripRangePath(),fRunMin,fRunMax); MAKE_META(meta); meta->SetProperty("key1", range); cdb->Put(range, id, meta); @@ -163,7 +164,7 @@ AliFMDCalibFaker::Exec(Option_t*) } if (TESTBIT(fMask, kAltroMap)) { AliFMDAltroMapping* altroMap = MakeAltroMap(); - AliCDBId id(AliFMDParameters::fgkAltroMap, fRunMin, fRunMax); + AliCDBId id(AliFMDParameters::AltroMapPath(), fRunMin, fRunMax); MAKE_META(meta); meta->SetProperty("key1", altroMap); cdb->Put(altroMap, id, meta); @@ -177,7 +178,7 @@ AliFMDCalibFaker::Exec(Option_t*) //__________________________________________________________________ AliFMDCalibGain* -AliFMDCalibFaker::MakePulseGain() +AliFMDCalibFaker::MakePulseGain() const { // Make the actual data AliFMDCalibGain* gain = new AliFMDCalibGain; @@ -201,7 +202,7 @@ AliFMDCalibFaker::MakePulseGain() //__________________________________________________________________ AliFMDCalibPedestal* -AliFMDCalibFaker::MakePedestal() +AliFMDCalibFaker::MakePedestal() const { // Make the actual data AliFMDCalibPedestal* pedestal = new AliFMDCalibPedestal; @@ -223,7 +224,7 @@ AliFMDCalibFaker::MakePedestal() //__________________________________________________________________ AliFMDCalibDeadMap* -AliFMDCalibFaker::MakeDeadMap() +AliFMDCalibFaker::MakeDeadMap() const { // Make the actual data AliFMDCalibDeadMap* deadmap = new AliFMDCalibDeadMap; @@ -245,7 +246,7 @@ AliFMDCalibFaker::MakeDeadMap() //__________________________________________________________________ AliFMDCalibZeroSuppression* -AliFMDCalibFaker::MakeZeroSuppression() +AliFMDCalibFaker::MakeZeroSuppression() const { // Make the actual data AliFMDCalibZeroSuppression* zs = new AliFMDCalibZeroSuppression; @@ -266,8 +267,9 @@ AliFMDCalibFaker::MakeZeroSuppression() //__________________________________________________________________ AliFMDCalibSampleRate* -AliFMDCalibFaker::MakeSampleRate() +AliFMDCalibFaker::MakeSampleRate() const { + // Make sample rates AliFMDCalibSampleRate* sampleRate = new AliFMDCalibSampleRate; for (UShort_t det = 1; det <= 3; det++) { Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' }; @@ -283,8 +285,9 @@ AliFMDCalibFaker::MakeSampleRate() //__________________________________________________________________ AliFMDCalibStripRange* -AliFMDCalibFaker::MakeStripRange() +AliFMDCalibFaker::MakeStripRange() const { + // Make strip ranges AliFMDCalibStripRange* striprange = new AliFMDCalibStripRange; for (UShort_t det = 1; det <= 3; det++) { Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' }; @@ -300,8 +303,9 @@ AliFMDCalibFaker::MakeStripRange() //__________________________________________________________________ AliFMDAltroMapping* -AliFMDCalibFaker::MakeAltroMap() +AliFMDCalibFaker::MakeAltroMap() const { + // Make hardware mapping AliFMDAltroMapping* m = new AliFMDAltroMapping; return m; } diff --git a/FMD/AliFMDCalibFaker.h b/FMD/AliFMDCalibFaker.h index e7c8edb2096..72a664c212b 100644 --- a/FMD/AliFMDCalibFaker.h +++ b/FMD/AliFMDCalibFaker.h @@ -11,10 +11,13 @@ @author Christian Holm Christensen @date Sun Mar 26 18:29:36 2006 @brief Make fake calibration data + @ingroup FMD_util */ //____________________________________________________________________ // // Class to make fake calibration parameters +// Used for populating inital data base +// Utility class // #ifndef ROOT_TTask # include @@ -122,25 +125,25 @@ public: protected: /** Make zero suppression parameters @return Map of zero suppression */ - virtual AliFMDCalibZeroSuppression* MakeZeroSuppression(); + virtual AliFMDCalibZeroSuppression* MakeZeroSuppression() const; /** Make sample rate parameters @return Map of sample rate */ - virtual AliFMDCalibSampleRate* MakeSampleRate(); + virtual AliFMDCalibSampleRate* MakeSampleRate() const; /** Make pedestal parameters @return Map of pedestal */ - virtual AliFMDCalibPedestal* MakePedestal(); + virtual AliFMDCalibPedestal* MakePedestal() const; /** Make gain parameters @return Map of gain */ - virtual AliFMDCalibGain* MakePulseGain(); + virtual AliFMDCalibGain* MakePulseGain() const; /** Make dead channel parameters @return Map of dead channel */ - virtual AliFMDCalibDeadMap* MakeDeadMap(); + virtual AliFMDCalibDeadMap* MakeDeadMap() const; /** Make a hardware map @return hardware map */ - virtual AliFMDAltroMapping* MakeAltroMap(); + virtual AliFMDAltroMapping* MakeAltroMap() const; /** Make a strip range @return strip range map */ - virtual AliFMDCalibStripRange* MakeStripRange(); + virtual AliFMDCalibStripRange* MakeStripRange() const; Long_t fMask; // What to write Float_t fGain; // Gain @@ -151,10 +154,10 @@ protected: Float_t fDeadChance; // Chance of dead channel UShort_t fRate; // Sample rate UShort_t fZeroThreshold; // Zero suppression threshold - Int_t fRunMin; - Int_t fRunMax; - UShort_t fStripMin; - UShort_t fStripMax; + Int_t fRunMin; // Min run number + Int_t fRunMax; // Max run number + UShort_t fStripMin; // Min strip read out + UShort_t fStripMax; // Max strip read out ClassDef(AliFMDCalibFaker,0) }; diff --git a/FMD/AliFMDCalibGain.cxx b/FMD/AliFMDCalibGain.cxx index 6f20ab63fd8..831ed6c95db 100644 --- a/FMD/AliFMDCalibGain.cxx +++ b/FMD/AliFMDCalibGain.cxx @@ -20,7 +20,11 @@ */ //____________________________________________________________________ // -// +// Gain value and width for each strip in the FMD. +// Foo +// Bar +// Baz +// Gnus // #include "AliFMDCalibGain.h" // ALIFMDCALIBGAIN_H //____________________________________________________________________ @@ -32,6 +36,7 @@ ClassImp(AliFMDCalibGain) //____________________________________________________________________ AliFMDCalibGain::AliFMDCalibGain() { + // CTOR fValue.Reset(-1.); fThreshold = -1.; } @@ -39,12 +44,15 @@ AliFMDCalibGain::AliFMDCalibGain() //____________________________________________________________________ AliFMDCalibGain::AliFMDCalibGain(const AliFMDCalibGain& o) : TObject(o), fValue(o.fValue), fThreshold(o.fThreshold) -{} +{ + // Copy CTOR +} //____________________________________________________________________ AliFMDCalibGain& AliFMDCalibGain::operator=(const AliFMDCalibGain& o) { + // Assignment operator fValue = o.fValue; fThreshold = o.fThreshold; return (*this); @@ -55,6 +63,7 @@ void AliFMDCalibGain::Set(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, Float_t val) { + // Set the value for a strip if (fValue.CheckIndex(det, ring, sec, str) < 0) return; fValue(det, ring, sec, str) = val; } @@ -64,6 +73,7 @@ Float_t AliFMDCalibGain::Value(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) { + // Get the value for a strip return fValue(det, ring, sec, str); } diff --git a/FMD/AliFMDCalibGain.h b/FMD/AliFMDCalibGain.h index 3607837301f..e01ad78814f 100644 --- a/FMD/AliFMDCalibGain.h +++ b/FMD/AliFMDCalibGain.h @@ -10,6 +10,10 @@ @date Sun Mar 26 18:30:16 2006 @brief Per strip gain calibration */ +// Gain value and width for each strip in the FMD. +// Foo +// Bar +// #ifndef ALIFMDFLOATMAP_H # include #endif diff --git a/FMD/AliFMDCalibPedestal.cxx b/FMD/AliFMDCalibPedestal.cxx index c985d257268..b1a8c8f1345 100644 --- a/FMD/AliFMDCalibPedestal.cxx +++ b/FMD/AliFMDCalibPedestal.cxx @@ -17,10 +17,15 @@ @author Christian Holm Christensen @date Sun Mar 26 18:30:36 2006 @brief Per strip pedestal calibration + @ingroup FMD_base */ //____________________________________________________________________ // -// +// This class stores a pedestal and pedestal width for each strip in +// the FMD detectors. +// The values are stored as floats, since they may be results from a +// fit. +// Need to make algorithm that makes this data // #include "AliFMDCalibPedestal.h" // ALIFMDCALIBPEDESTAL_H //____________________________________________________________________ @@ -32,6 +37,7 @@ ClassImp(AliFMDCalibPedestal) //____________________________________________________________________ AliFMDCalibPedestal::AliFMDCalibPedestal() { + // CTOR fValue.Reset(-1.); fWidth.Reset(-1.); } @@ -39,12 +45,15 @@ AliFMDCalibPedestal::AliFMDCalibPedestal() //____________________________________________________________________ AliFMDCalibPedestal::AliFMDCalibPedestal(const AliFMDCalibPedestal& o) : TObject(o), fValue(o.fValue), fWidth(o.fWidth) -{} +{ + // Copy Ctor +} //____________________________________________________________________ AliFMDCalibPedestal& AliFMDCalibPedestal::operator=(const AliFMDCalibPedestal& o) { + // Assignment operator fValue = o.fValue; fWidth = o.fWidth; return (*this); @@ -55,6 +64,7 @@ void AliFMDCalibPedestal::Set(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, Float_t ped, Float_t pedW) { + // set value and width for a strip if (fValue.CheckIndex(det, ring, sec, str) < 0) return; fValue(det, ring, sec, str) = ped; fWidth(det, ring, sec, str) = pedW; @@ -65,6 +75,7 @@ Float_t AliFMDCalibPedestal::Value(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) { + // Get pedestal value for a strip return fValue(det, ring, sec, str); } @@ -73,6 +84,7 @@ Float_t AliFMDCalibPedestal::Width(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) { + // Get pedestal width for a strip return fWidth(det, ring, sec, str); } diff --git a/FMD/AliFMDCalibPedestal.h b/FMD/AliFMDCalibPedestal.h index 553397e6f66..afb69f059f3 100644 --- a/FMD/AliFMDCalibPedestal.h +++ b/FMD/AliFMDCalibPedestal.h @@ -5,10 +5,18 @@ * * See cxx source for full Copyright notice */ +//____________________________________________________________________ +// +// This class stores a pedestal and pedestal width for each strip in +// the FMD detectors. +// The values are stored as floats, since they may be results from a +// fit. +// Need to make algorithm that makes this data /** @file AliFMDCalibPedestal.h @author Christian Holm Christensen @date Sun Mar 26 18:30:51 2006 @brief Per strip pedestal calibration + @ingroup FMD_base */ #ifndef ALIFMDFLOATMAP_H # include diff --git a/FMD/AliFMDCalibSampleRate.cxx b/FMD/AliFMDCalibSampleRate.cxx index 5e51121d3c6..5ac341033e1 100644 --- a/FMD/AliFMDCalibSampleRate.cxx +++ b/FMD/AliFMDCalibSampleRate.cxx @@ -20,7 +20,11 @@ */ //____________________________________________________________________ // -// +// This class stores the sample rate (that is, how many times the +// ATLRO's sample each VA1 channel). In principle these can be +// controlled per half ring, but in real life it's most likely that +// this value will be the same for all detectors. This value must be +// retrived from DCS or the like. // #include "AliFMDCalibSampleRate.h" // ALIFMDCALIBGAIN_H #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H @@ -37,18 +41,22 @@ AliFMDCalibSampleRate::AliFMDCalibSampleRate() : fRates(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1) // fRates(3) { + // CTOR fRates.Reset(1); } //____________________________________________________________________ AliFMDCalibSampleRate::AliFMDCalibSampleRate(const AliFMDCalibSampleRate& o) : TObject(o), fRates(o.fRates) -{} +{ + // Copy ctor +} //____________________________________________________________________ AliFMDCalibSampleRate& AliFMDCalibSampleRate::operator=(const AliFMDCalibSampleRate& o) { + // Assignment operator fRates = o.fRates; return (*this); } @@ -58,6 +66,7 @@ void AliFMDCalibSampleRate::Set(UShort_t det, Char_t ring, UShort_t sector, UShort_t, UShort_t rate) { + // Set values. Strip argument is ignored UInt_t nSec = (ring == 'I' ? 20 : 40); UInt_t board = sector / nSec; fRates(det, ring, board, 0) = rate; @@ -68,6 +77,7 @@ UShort_t AliFMDCalibSampleRate::Rate(UShort_t det, Char_t ring, UShort_t sec, UShort_t) const { + // Get the sample rate 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)", diff --git a/FMD/AliFMDCalibSampleRate.h b/FMD/AliFMDCalibSampleRate.h index fbd3a34257c..7719554c9c0 100644 --- a/FMD/AliFMDCalibSampleRate.h +++ b/FMD/AliFMDCalibSampleRate.h @@ -5,11 +5,19 @@ * * See cxx source for full Copyright notice */ +//____________________________________________________________________ +// +// This class stores the sample rate (that is, how many times the +// ATLRO's sample each VA1 channel). In principle these can be +// controlled per half ring, but in real life it's most likely that +// this value will be the same for all detectors. This value must be +// retrived from DCS or the like. +// /** @file AliFMDCalibSampleRate.h @author Christian Holm Christensen @date Sun Mar 26 18:32:14 2006 @brief Per digitizer card pulser calibration - + @ingroup FMD_base */ #ifndef ROOT_TObject # include @@ -53,7 +61,7 @@ public: UShort_t Rate(UShort_t det, Char_t ring, UShort_t sec, UShort_t str=0) const; protected: // TArrayI fRates; // Sample rates - AliFMDUShortMap fRates; + AliFMDUShortMap fRates; // Sample rates ClassDef(AliFMDCalibSampleRate,2); // Sample rates }; diff --git a/FMD/AliFMDCalibStripRange.cxx b/FMD/AliFMDCalibStripRange.cxx index f1edcb3936f..4da7294d296 100644 --- a/FMD/AliFMDCalibStripRange.cxx +++ b/FMD/AliFMDCalibStripRange.cxx @@ -20,7 +20,11 @@ */ //____________________________________________________________________ // -// +// This class stores which strips are read-out. +// In principle this can be set for each half-ring. +// However, in real life, all the detectors will probably read out all +// strips, and dead areas can be handled off-line. +// This information comes from DCS or the like. // #include "AliFMDCalibStripRange.h" // ALIFMDCALIBGAIN_H #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H @@ -33,22 +37,26 @@ ClassImp(AliFMDCalibStripRange) //____________________________________________________________________ AliFMDCalibStripRange::AliFMDCalibStripRange() - : fRates(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1) - // fRates(3) + : fRanges(AliFMDMap::kMaxDetectors, AliFMDMap::kMaxRings, 2, 1) + // fRanges(3) { - fRates.Reset(1); + // CTOR + fRanges.Reset(1); } //____________________________________________________________________ AliFMDCalibStripRange::AliFMDCalibStripRange(const AliFMDCalibStripRange& o) - : TObject(o), fRates(o.fRates) -{} + : TObject(o), fRanges(o.fRanges) +{ + // Copy CTOR +} //____________________________________________________________________ AliFMDCalibStripRange& AliFMDCalibStripRange::operator=(const AliFMDCalibStripRange& o) { - fRates = o.fRates; + // Assignement operator + fRanges = o.fRanges; return (*this); } @@ -58,9 +66,10 @@ AliFMDCalibStripRange::Set(UShort_t det, Char_t ring, UShort_t sector, UShort_t, UShort_t min, UShort_t max) { + // Set the min and max for a half-ring UInt_t nSec = (ring == 'I' ? 20 : 40); UInt_t board = sector / nSec; - fRates(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f); + fRanges(det, ring, board, 0) = ((max & 0x7f) << 8) + (min & 0x7f); } //____________________________________________________________________ @@ -68,9 +77,10 @@ UShort_t AliFMDCalibStripRange::Min(UShort_t det, Char_t ring, UShort_t sec, UShort_t) const { + // Get the min for a half-ring UInt_t nSec = (ring == 'I' ? 20 : 40); UInt_t board = sec / nSec; - return (fRates(det, ring, board, 0) & 0x7f); + return (fRanges(det, ring, board, 0) & 0x7f); } //____________________________________________________________________ @@ -78,9 +88,10 @@ UShort_t AliFMDCalibStripRange::Max(UShort_t det, Char_t ring, UShort_t sec, UShort_t) const { + // Get the max for a half-ring UInt_t nSec = (ring == 'I' ? 20 : 40); UInt_t board = sec / nSec; - return ((fRates(det, ring, board, 0) >> 8) & 0x7f); + return ((fRanges(det, ring, board, 0) >> 8) & 0x7f); } //____________________________________________________________________ diff --git a/FMD/AliFMDCalibStripRange.h b/FMD/AliFMDCalibStripRange.h index a02f7a790d5..943dd52ae19 100644 --- a/FMD/AliFMDCalibStripRange.h +++ b/FMD/AliFMDCalibStripRange.h @@ -5,10 +5,19 @@ * * See cxx source for full Copyright notice */ +//____________________________________________________________________ +// +// This class stores which strips are read-out. +// In principle this can be set for each half-ring. +// However, in real life, all the detectors will probably read out all +// strips, and dead areas can be handled off-line. +// This information comes from DCS or the like. +// /** @file AliFMDCalibStripRange.h @author Christian Holm Christensen @date Sun Mar 26 18:32:14 2006 @brief Per digitizer card pulser calibration + @ingroup FMD_base */ #ifndef ROOT_TObject # include @@ -60,7 +69,7 @@ public: UShort_t Max(UShort_t det, Char_t ring, UShort_t sec, UShort_t str=0) const; protected: // TArrayI fRates; // Sample rates - AliFMDUShortMap fRates; + AliFMDUShortMap fRanges; // Min max ClassDef(AliFMDCalibStripRange,1); // Sample rates }; diff --git a/FMD/AliFMDDetector.cxx b/FMD/AliFMDDetector.cxx index 9be65057107..d23cf2d1fba 100644 --- a/FMD/AliFMDDetector.cxx +++ b/FMD/AliFMDDetector.cxx @@ -17,6 +17,7 @@ @author Christian Holm Christensen @date Mon Mar 27 12:36:27 2006 @brief Sub-detector base class implementation + @ingroup FMD_base */ //____________________________________________________________________ @@ -34,7 +35,7 @@ #include "AliLog.h" // ALILOG_H #include // ROOT_TGeoManager #include // ROOT_TGeoMatrix -#include // ROOT_TMath +// #include // ROOT_TMath //==================================================================== ClassImp(AliFMDDetector) @@ -129,6 +130,8 @@ AliFMDDetector::Init() Bool_t AliFMDDetector::HasAllTransforms(Char_t ring) const { + // Check if we got all transformations for a given ring. Return + // true in that case. AliFMDRing* r = GetRing(ring); if (!r) return kTRUE; TObjArray* matricies = (r == fInner ? fInnerTransforms : fOuterTransforms); @@ -147,6 +150,7 @@ AliFMDDetector::HasAllTransforms(Char_t ring) const void AliFMDDetector::InitTransformations() { + // Find all local<->global transformations for this detector. if ((!fInner || (fInner && fInnerTransforms)) && (!fOuter || (fOuter && fOuterTransforms))) { AliDebug(5, Form("Transforms for FMD%d already registered", fId)); diff --git a/FMD/AliFMDDetector.h b/FMD/AliFMDDetector.h index 5654d6f5d04..3740256fd96 100644 --- a/FMD/AliFMDDetector.h +++ b/FMD/AliFMDDetector.h @@ -7,10 +7,16 @@ * * See cxx source for full Copyright notice */ +//__________________________________________________________________ +// +// Utility class to help implement the FMD geometry. This provides +// the interface for the concrete geometry implementations of the FMD +// sub-detectors. /** @file AliFMDDetector.h @author Christian Holm Christensen @date Mon Mar 27 12:36:27 2006 @brief Sub-detector base class declaration + @ingroup FMD_base */ #ifndef ROOT_TNamed # include diff --git a/FMD/AliFMDDigit.cxx b/FMD/AliFMDDigit.cxx index a2c9cc67c63..178ca82ef9f 100644 --- a/FMD/AliFMDDigit.cxx +++ b/FMD/AliFMDDigit.cxx @@ -66,61 +66,6 @@ #include "Riostream.h" // ROOT_Riostream #include -//==================================================================== -ClassImp(AliFMDBaseDigit) -#if 0 - ; // This is here to keep Emacs from indenting the next line -#endif - -//____________________________________________________________________ -AliFMDBaseDigit::AliFMDBaseDigit() - : fDetector(0), - fRing('\0'), - fSector(0), - fStrip(0) -{} - -//____________________________________________________________________ -AliFMDBaseDigit::AliFMDBaseDigit(UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip) - : fDetector(detector), - fRing(ring), - fSector(sector), - fStrip(strip) -{ - // - // Creates a base data digit object - // - // Parameters - // - // detector Detector # (1, 2, or 3) - // ring Ring ID ('I' or 'O') - // sector Sector # (For inner/outer rings: 0-19/0-39) - // strip Strip # (For inner/outer rings: 0-511/0-255) -} - -//____________________________________________________________________ -void -AliFMDBaseDigit::Print(Option_t* /* option*/) const -{ - // Print digit to standard out - cout << ClassName() << ": FMD" << fDetector << fRing << "[" - << setw(3) << fSector << "," - << setw(3) << fStrip << "]" - << flush; -} - -//____________________________________________________________________ -const char* -AliFMDBaseDigit::GetName() const -{ - static TString n; - n = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip); - return n.Data(); -} - //==================================================================== ClassImp(AliFMDDigit) @@ -129,7 +74,9 @@ AliFMDDigit::AliFMDDigit() : fCount1(0), fCount2(-1), fCount3(-1) -{} +{ + // CTOR +} //____________________________________________________________________ AliFMDDigit::AliFMDDigit(UShort_t detector, @@ -162,6 +109,7 @@ AliFMDDigit::AliFMDDigit(UShort_t detector, const char* AliFMDDigit::GetTitle() const { + // Get the title static TString t; t = Form("ADC: %d", Counts()); return t.Data(); @@ -178,58 +126,6 @@ AliFMDDigit::Print(Option_t* /* option*/) const << Counts() << endl; } -//==================================================================== -ClassImp(AliFMDSDigit) - -//____________________________________________________________________ -AliFMDSDigit::AliFMDSDigit() - : fEdep(0), - fCount1(0), - fCount2(-1), - fCount3(-1) -{} - -//____________________________________________________________________ -AliFMDSDigit::AliFMDSDigit(UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - Float_t edep, - UShort_t count1, - Short_t count2, - Short_t count3) - : AliFMDBaseDigit(detector, ring, sector, strip), - fEdep(edep), - fCount1(count1), - fCount2(count2), - fCount3(count3) -{ - // - // Creates a real data digit object - // - // Parameters - // - // detector Detector # (1, 2, or 3) - // ring Ring ID ('I' or 'O') - // sector Sector # (For inner/outer rings: 0-19/0-39) - // strip Strip # (For inner/outer rings: 0-511/0-255) - // edep Total energy deposited - // count1 ADC count (a 10-bit word) - // count2 ADC count (a 10-bit word) -1 if not used - // count3 ADC count (a 10-bit word) -1 if not used -} - -//____________________________________________________________________ -void -AliFMDSDigit::Print(Option_t* /* option*/) const -{ - // Print digit to standard out - AliFMDBaseDigit::Print(); - cout << "\t" << fEdep << " -> " - << fCount1 << " (+ " << fCount2 << " + " << fCount2 << ") = " - << Counts() << endl; -} - //____________________________________________________________________ // // EOF diff --git a/FMD/AliFMDDigit.h b/FMD/AliFMDDigit.h index 7994207235f..9bd96561c29 100644 --- a/FMD/AliFMDDigit.h +++ b/FMD/AliFMDDigit.h @@ -12,52 +12,10 @@ // AliFMDDigit - Normal (smeared) digit // AliFMDSDigit - Summable (non-smeared) digit // -#ifndef ROOT_TObject -# include +#ifndef ALIFMDBASEDIGIT_H +# include #endif -//____________________________________________________________________ -/** @class AliFMDBaseDigit AliFMDDigit.h - @brief base class for digits - @ingroup FMD_base - */ -class AliFMDBaseDigit : public TObject -{ -public: - /** CTOR */ - AliFMDBaseDigit(); - /** Constrctor - @param detector Detector - @param ring Ring - @param sector Sector - @param strip Strip */ - AliFMDBaseDigit(UShort_t detector, - Char_t ring='\0', - UShort_t sector=0, - UShort_t strip=0); - /** DTOR */ - virtual ~AliFMDBaseDigit() {} - /** @return Detector # */ - UShort_t Detector() const { return fDetector; } - /** @return Ring ID */ - Char_t Ring() const { return fRing; } - /** @return sector # */ - UShort_t Sector() const { return fSector; } - /** @return strip # */ - UShort_t Strip() const { return fStrip; } - /** Print information - @param opt Not used */ - virtual void Print(Option_t* opt="") const; - /** @return Name */ - const char* GetName() const; -protected: - UShort_t fDetector; // (Sub) Detector # (1,2, or 3) - Char_t fRing; // Ring ID ('I' or 'O') - UShort_t fSector; // Sector # (phi division) - UShort_t fStrip; // Strip # (radial division) - ClassDef(AliFMDBaseDigit, 1) // Base class for FMD digits -}; - //____________________________________________________________________ /** @class AliFMDDigit AliFMDDigit.h @brief class for digits @@ -127,65 +85,6 @@ AliFMDDigit::Count(size_t i) const return -1; } -//____________________________________________________________________ -/** @class AliFMDSDigit AliFMDDigit.h - @brief class for summable digits - @ingroup FMD_base - */ -class AliFMDSDigit : public AliFMDBaseDigit -{ -public: - /** CTOR */ - AliFMDSDigit(); - /** Constrctor - @param detector Detector - @param ring Ring - @param sector Sector - @param strip Strip - @param edep Energy deposited - @param count ADC (first sample) - @param count2 ADC (second sample, or -1 if not used) - @param count3 ADC (third sample, or -1 if not used) */ - AliFMDSDigit(UShort_t detector, - Char_t ring='\0', - UShort_t sector=0, - UShort_t strip=0, - Float_t edep=0, - UShort_t count=0, - Short_t count2=-1, - Short_t count3=-1); - /** DTOR */ - virtual ~AliFMDSDigit() {} - /** @return ADC count (first sample) */ - UShort_t Count1() const { return fCount1; } - /** @return ADC count (second sample, or -1 if not used) */ - Short_t Count2() const { return fCount2; } - /** @return ADC count (third sample, or -1 if not used) */ - Short_t Count3() const { return fCount3; } - /** @return Canonical ADC counts */ - UShort_t Counts() const; - /** @return Energy deposited */ - Float_t Edep() const { return fEdep; } - /** Print info - @param opt Not used */ - void Print(Option_t* opt="") const; -protected: - Float_t fEdep; // Energy deposited - UShort_t fCount1; // Digital signal - Short_t fCount2; // Digital signal (-1 if not used) - Short_t fCount3; // Digital signal (-1 if not used) - ClassDef(AliFMDSDigit,1) // Summable FMD digit -}; - -inline UShort_t -AliFMDSDigit::Counts() const -{ - return fCount1 - + (fCount2 >= 0 ? fCount2 : 0) - + (fCount3 >= 0 ? fCount3 : 0); -} - - #endif //____________________________________________________________________ // diff --git a/FMD/AliFMDDigitizer.cxx b/FMD/AliFMDDigitizer.cxx index 61d79c95eda..f68ee457c99 100644 --- a/FMD/AliFMDDigitizer.cxx +++ b/FMD/AliFMDDigitizer.cxx @@ -17,6 +17,7 @@ @author Christian Holm Christensen @date Mon Mar 27 12:38:26 2006 @brief FMD Digitizers implementation + @ingroup FMD_sim */ ////////////////////////////////////////////////////////////////////////////// // @@ -196,7 +197,7 @@ // #include // ROOT_TTree -#include // ROOT_TRandom +//#include // ROOT_TRandom #include // ALILOG_H #include "AliFMDDigitizer.h" // ALIFMDDIGITIZER_H #include "AliFMD.h" // ALIFMD_H @@ -211,286 +212,6 @@ #include // ALILOADER_H #include // ALIRUNLOADER_H -//==================================================================== -ClassImp(AliFMDBaseDigitizer) -#if 0 - ; // This is here to keep Emacs for indenting the next line -#endif - -//____________________________________________________________________ -AliFMDBaseDigitizer::AliFMDBaseDigitizer() - : fRunLoader(0) -{ - // Default ctor - don't use it -} - -//____________________________________________________________________ -AliFMDBaseDigitizer::AliFMDBaseDigitizer(AliRunDigitizer* manager) - : AliDigitizer(manager, "AliFMDBaseDigitizer", "FMD Digitizer base class"), - fRunLoader(0), - fEdep(AliFMDMap::kMaxDetectors, - AliFMDMap::kMaxRings, - AliFMDMap::kMaxSectors, - AliFMDMap::kMaxStrips) -{ - // Normal CTOR - AliDebug(1," processed"); - SetShapingTime(); -} - -//____________________________________________________________________ -AliFMDBaseDigitizer::AliFMDBaseDigitizer(const Char_t* name, - const Char_t* title) - : AliDigitizer(name, title), - fRunLoader(0), - fEdep(AliFMDMap::kMaxDetectors, - AliFMDMap::kMaxRings, - AliFMDMap::kMaxSectors, - AliFMDMap::kMaxStrips) -{ - // Normal CTOR - AliDebug(1," processed"); - SetShapingTime(); -} - -//____________________________________________________________________ -AliFMDBaseDigitizer::~AliFMDBaseDigitizer() -{ - // Destructor -} - -//____________________________________________________________________ -Bool_t -AliFMDBaseDigitizer::Init() -{ - // Initialization - AliFMDParameters::Instance()->Init(); - return kTRUE; -} - - -//____________________________________________________________________ -UShort_t -AliFMDBaseDigitizer::MakePedestal(UShort_t, - Char_t, - UShort_t, - UShort_t) const -{ - return 0; -} - -//____________________________________________________________________ -void -AliFMDBaseDigitizer::SumContributions(AliFMD* fmd) -{ - // Sum energy deposited contributions from each hit in a cache - // (fEdep). - if (!fRunLoader) - Fatal("SumContributions", "no run loader"); - - // Clear array of deposited energies - fEdep.Reset(); - - // Get the FMD loader - AliLoader* inFMD = fRunLoader->GetLoader("FMDLoader"); - // And load the hits - inFMD->LoadHits("READ"); - - // Get the tree of hits - TTree* hitsTree = inFMD->TreeH(); - if (!hitsTree) { - // Try again - inFMD->LoadHits("READ"); - hitsTree = inFMD->TreeH(); - } - - // Get the FMD branch - TBranch* hitsBranch = hitsTree->GetBranch("FMD"); - if (hitsBranch) fmd->SetHitsAddressBranch(hitsBranch); - else AliFatal("Branch FMD hit not found"); - - // Get a list of hits from the FMD manager - TClonesArray *fmdHits = fmd->Hits(); - - // Get number of entries in the tree - Int_t ntracks = Int_t(hitsTree->GetEntries()); - - AliFMDParameters* param = AliFMDParameters::Instance(); - Int_t read = 0; - // Loop over the tracks in the - for (Int_t track = 0; track < ntracks; track++) { - // Read in entry number `track' - read += hitsBranch->GetEntry(track); - - // Get the number of hits - Int_t nhits = fmdHits->GetEntries (); - for (Int_t hit = 0; hit < nhits; hit++) { - // Get the hit number `hit' - AliFMDHit* fmdHit = - static_cast(fmdHits->UncheckedAt(hit)); - - // Extract parameters - UShort_t detector = fmdHit->Detector(); - Char_t ring = fmdHit->Ring(); - 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)) { - 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)", - detector, ring, sector, strip)); - - // Sum energy deposition - fEdep(detector, ring, sector, strip).fEdep += edep; - fEdep(detector, ring, sector, strip).fN += 1; - // Add this to the energy deposited for this strip - } // hit loop - } // track loop - AliDebug(1, Form("Size of cache: %d bytes, read %d bytes", - sizeof(fEdep), read)); -} - -//____________________________________________________________________ -void -AliFMDBaseDigitizer::DigitizeHits(AliFMD* fmd) const -{ - // For the stored energy contributions in the cache (fEdep), convert - // the energy signal to ADC counts, and store the created digit in - // the digits array (AliFMD::fDigits) - // - AliFMDGeometry* geometry = AliFMDGeometry::Instance(); - - TArrayI counts(3); - for (UShort_t detector=1; detector <= 3; detector++) { - // Get pointer to subdetector - AliFMDDetector* det = geometry->GetDetector(detector); - if (!det) continue; - for (UShort_t ringi = 0; ringi <= 1; ringi++) { - Char_t ring = ringi == 0 ? 'I' : 'O'; - // Get pointer to Ring - AliFMDRing* r = det->GetRing(ring); - if (!r) continue; - - // Get number of sectors - UShort_t nSectors = UShort_t(360. / r->GetTheta()); - // Loop over the number of sectors - for (UShort_t sector = 0; sector < nSectors; sector++) { - // Get number of strips - UShort_t nStrips = r->GetNStrips(); - // Loop over the stips - Float_t last = 0; - for (UShort_t strip = 0; strip < nStrips; strip++) { - // Reset the counter array to the invalid value -1 - counts.Reset(-1); - // Reset the last `ADC' value when we've get to the end of a - // VA1_ALICE channel. - if (strip % 128 == 0) last = 0; - - Float_t edep = fEdep(detector, ring, sector, strip).fEdep; - ConvertToCount(edep, last, detector, ring, sector, strip, counts); - last = edep; - AddDigit(fmd, detector, ring, sector, strip, edep, - UShort_t(counts[0]), Short_t(counts[1]), - Short_t(counts[2])); -#if 0 - // This checks if the digit created will give the `right' - // number of particles when reconstructed, using a naiive - // approach. It's here only as a quality check - nothing - // else. - CheckDigit(digit, fEdep(detector, ring, sector, strip).fN, - counts); -#endif - } // Strip - } // Sector - } // Ring - } // Detector -} - -//____________________________________________________________________ -void -AliFMDBaseDigitizer::ConvertToCount(Float_t edep, - Float_t last, - UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - TArrayI& counts) const -{ - // Convert the total energy deposited to a (set of) ADC count(s). - // - // This is done by - // - // Energy_Deposited ALTRO_Channel_Size - // ADC = -------------------------- ------------------- + pedestal - // Energy_Deposition_Of_1_MIP VA1_ALICE_MIP_Range - // - // Energy_Deposited fAltroChannelSize - // = --------------------------------- ----------------- + pedestal - // 1.664 * Si_Thickness * Si_Density fVA1MipRange - // - // - // = Energy_Deposited * ConversionFactor + pedestal - // - // However, this is modified by the response function of the - // VA1_ALICE pre-amp. chip in case we are doing oversampling of the - // VA1_ALICE output. - // - // In that case, we get N=fSampleRate values of the ADC, and the - // `EnergyDeposited' is a function of which sample where are - // calculating the ADC for - // - // ADC_i = f(EnergyDeposited, i/N, Last) * ConversionFactor + pedestal - // - // where Last is the Energy deposited in the previous strip. - // - // Here, f is the shaping function of the VA1_ALICE. This is given - // by - // - // | (E - l) * (1 - exp(-B * t) + l if E > l - // f(E, t, l) = < - // | (l - E) * exp(-B * t) + E otherwise - // - // - // = E + (l - E) * ext(-B * t) - // - AliFMDParameters* param = AliFMDParameters::Instance(); - 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(detector,ring,sector,strip); - UShort_t size = param->GetAltroChannelSize(); - - // In case we don't oversample, just return the end value. - if (rate == 1) { - counts[0] = UShort_t(TMath::Min(edep * convF + ped, Float_t(size))); - return; - } - - // Create a pedestal - Float_t b = fShapingTime; - for (Ssiz_t i = 0; i < rate; i++) { - Float_t t = Float_t(i) / rate; - Float_t s = edep + (last - edep) * TMath::Exp(-b * t); - counts[i] = UShort_t(TMath::Min(s * convF + ped, Float_t(maxAdc))); - } -} - - //==================================================================== ClassImp(AliFMDDigitizer) @@ -640,108 +361,6 @@ AliFMDDigitizer::CheckDigit(AliFMDDigit* digit, mips, nhits); } -//==================================================================== -ClassImp(AliFMDSDigitizer) - -//____________________________________________________________________ -AliFMDSDigitizer::AliFMDSDigitizer() -{ - // Default ctor - don't use it -} - -//____________________________________________________________________ -AliFMDSDigitizer::AliFMDSDigitizer(const Char_t* headerFile, - const Char_t* /* sdigfile */) - : AliFMDBaseDigitizer("FMDSDigitizer", "FMD SDigitizer") -{ - // Normal CTOR - AliDebug(1," processed"); - - fRunLoader = AliRunLoader::GetRunLoader(); // Open(headerFile); - if (!fRunLoader) - Fatal("AliFMDSDigitizer", "cannot open session, header file '%s'", - headerFile); - AliLoader* loader = fRunLoader->GetLoader("FMDLoader"); - if (!loader) - Fatal("AliFMDSDigitizer", "cannot find FMD loader in specified event"); - - // Add task to tasks folder - loader->PostSDigitizer(this); - -} - -//____________________________________________________________________ -AliFMDSDigitizer::~AliFMDSDigitizer() -{ - // Destructor - AliLoader* loader = fRunLoader->GetLoader("FMDLoader"); - loader->CleanSDigitizer(); -} - -//____________________________________________________________________ -void -AliFMDSDigitizer::Exec(Option_t*) -{ - // Get the output manager - if (!fRunLoader) { - Error("Exec", "Run loader is not set"); - return; - } - if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice(); - if (!fRunLoader->TreeE()) fRunLoader->LoadHeader(); - - AliLoader* fmdLoader = fRunLoader->GetLoader("FMDLoader"); - if (!fmdLoader) Fatal("Exec", "no FMD loader"); - - // Get the AliFMD object - AliFMD* fmd = - static_cast(fRunLoader->GetAliRun()->GetDetector("FMD")); - if (!fmd) { - AliError("Can not get FMD from gAlice"); - return; - } - - Int_t nEvents = Int_t(fRunLoader->TreeE()->GetEntries()); - for (Int_t event = 0; event < nEvents; event++) { - AliDebug(1,Form(" Digitizing event number %d", event)); - // Get the current loader - fRunLoader->GetEvent(event); - - if (!fmdLoader->TreeS()) fmdLoader->MakeTree("S"); - // Make a branch - fmd->MakeBranch("S"); - - // Cache contriutions - SumContributions(fmd); - - // Digitize the event - DigitizeHits(fmd); - - fmdLoader->TreeS()->Reset(); - fmdLoader->TreeS()->Fill(); - fmdLoader->WriteSDigits("OVERWRITE"); - } -} - -//____________________________________________________________________ -void -AliFMDSDigitizer::AddDigit(AliFMD* fmd, - UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - Float_t edep, - UShort_t count1, - Short_t count2, - Short_t count3) const -{ - // Add a summable digit - fmd->AddSDigitByFields(detector, ring, sector, strip, edep, - count1, count2, count3); -} - - - //____________________________________________________________________ // // EOF diff --git a/FMD/AliFMDDigitizer.h b/FMD/AliFMDDigitizer.h index 10a369e4d23..22ceced04bb 100644 --- a/FMD/AliFMDDigitizer.h +++ b/FMD/AliFMDDigitizer.h @@ -5,26 +5,32 @@ * * See cxx source for full Copyright notice */ +// Classses to make Hits into digits and summable digits. +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Summable digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// /** @file AliFMDDigitizer.h @author Christian Holm Christensen @date Mon Mar 27 12:38:26 2006 @brief FMD Digitizers declaration + @ingroup FMD_sim */ -#ifndef ALIDIGITIZER_H -# include -#endif -#ifndef ALIRUNDIGITIZER_H -# include -#endif -#ifndef ALIFMDEdepMAP_H -# include "AliFMDEdepMap.h" +#ifndef ALIFMDBASEDIGITIZER_H +# include #endif -#ifndef __UTILITY__ -# include -#endif -// #ifndef ROOT_TArrayF -// # include -// #endif //==================================================================== class TClonesArray; @@ -34,206 +40,6 @@ class AliRunLoader; class AliFMDDigit; -//==================================================================== -/** @class AliFMDBaseDigitizer AliFMDDigitizer.h - @brief Base class for digitizers. - - This class contains the procedures simulation ADC signal for the - Forward Multiplicity detector : Hits->Digits and Hits->SDigits - - Digits consists of - - Detector # - - Ring ID - - Sector # - - Strip # - - ADC count in this channel - - Summable digits consists of - - Detector # - - Ring ID - - Sector # - - Strip # - - Total energy deposited in the strip - - ADC count in this channel - - As the Digits and SDigits have so much in common, the classes - AliFMDDigitizer and AliFMDSDigitizer are implemented via a base - class AliFMDBaseDigitizer. - @verbatim - +---------------------+ - | AliFMDBaseDigitizer | - +---------------------+ - ^ - | - +----------+---------+ - | | - +-----------------+ +------------------+ - | AliFMDDigitizer | | AliFMDSDigitizer | - +-----------------+ +------------------+ - @endverbatim - These classes uses parameters fetched from the AliFMDParameters - manager. - - The shaping function of the VA1 is generally given by - @f[ - f(x) = A(1 - \exp(-Bx)) - @f] - where A is the total charge collected in the pre-amp., and B is a - paramter that depends on the shaping time of the VA1 circut. - - When simulating the shaping function of the VA1 pre-amp. chip, we - have to take into account, that the shaping function depends on - the previous value of read from the pre-amp. - - That results in the following algorithm: - @code - last = 0; - for (i=0; i < n_pre_amp_charge; i++) { - charge = GetCharge(i); - if (last < charge) - f(t) = (charge - last) * (1 - exp(-B * t)) + last - else - f(t) = (last - charge) * exp(-B * t) + charge) - for (j=0; j < sample_rate; j++) - adc[j] = f(i / (# samples)) - last = charge - } - @endcode - Here, the first loop is over all charges collected by the VA1 - chip, and the @c sample_rate is how many times the ALTRO ADC - samples each of the 128 charges from the pre-amp. - - The @c charge is the total charge @f$ Q@f$ collected by the VA1 - pre-amplifier for a strip. @f$ Q@f$ is then given by - @f[ - Q = \frac{E}{e}\frac{S}{r} - @f] - where @f$ E@f$ is the total energy deposited in a silicon strip, - @f$ R@f$ is the dynamic range of the VA1 pre-amp, @f$ e@f$ is the - energy deposited by a single MIP, and @f$ S@f$ ALTRO channel size - in each time step. - - The energy deposited per MIP is given by - @f$ - e = M \rho w - @f$ - where @f$ M@f$ is the universal number - @f$ 1.664 \mbox{keV}\mbox{cm}^{2}\mbox{g}^{-1}@f$, @f$ \rho@f$ is - the density of silicon, and @f$ w@f$ is the depth of the silicon - sensor. - - The final ADC count is given by - @f[ - C' = C + P - @f] - where @f$ P@f$ is the (randomized) pedestal. - - This class uses the class template AliFMDEdepMap to make an - internal cache of the energy deposted of the hits. The class - template is instantasized as - - The first member of the values is the summed energy deposition in a - given strip, while the second member of the values is the number of - hits in a given strip. Using the second member, it's possible to - do some checks on just how many times a strip got hit, and what - kind of error we get in our reconstructed hits. Note, that this - information is currently not written to the digits tree. I think a - QA (Quality Assurance) digit tree is better suited for that task. - However, the information is there to be used in the future. - @ingroup FMD_sim - */ -class AliFMDBaseDigitizer : public AliDigitizer -{ -public: - /** CTOR */ - AliFMDBaseDigitizer(); - /** Normal CTOR - @param manager Manager of digitization */ - AliFMDBaseDigitizer(AliRunDigitizer * manager); - /** Normal ctor - @param name Name - @param title Title */ - AliFMDBaseDigitizer(const Char_t* name, const Char_t* title); - /** DTOR */ - virtual ~AliFMDBaseDigitizer(); - - /** Initialize */ - virtual Bool_t Init(); - - /** The response shape of the VA1 shaping circuit is approximently - given by - @f[ - f(x) = A(1 - \exp(-Bx)) - @f] - where @f$ A@f$ is the total charge collected by the pre-amp., - and @f$ B@f$ is parameter that depends on the shaping time of - the @b VA1 pre-amp. This member function sets the parameter @f$ - B@f$ - @param B */ - void SetShapingTime(Float_t B=10) { fShapingTime = B; } - /** @return Get the shaping time */ - Float_t GetShapingTime() const { return fShapingTime; } -protected: - /** Sum energy deposited contributions from each hit in a cache - @param fmd Pointer to detector */ - virtual void SumContributions(AliFMD* fmd); - /** For the stored energy contributions in the cache, convert the - energy signal to ADC counts, and store the created digit in - the digits array - @param fmd Pointer to detector */ - virtual void DigitizeHits(AliFMD* fmd) const; - /** Convert the total energy deposited to a (set of) ADC count(s). - See also the class description for more details. - @param edep Total energy deposited in detector - @param last Last charge collected in previous VA1 channnel - @param detector Detector # - @param ring Ring ID - @param sector Sector # - @param strip Strip # - @param counts Array holding the counts on return */ - virtual void ConvertToCount(Float_t edep, - Float_t last, - UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - TArrayI& counts) const; - /** Make a pedestal - @param detector Detector # - @param ring Ring ID - @param sector Sector # - @param strip Strip # - @return Pedestal value */ - virtual UShort_t MakePedestal(UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip) const; - /** Add noise to each sample */ - virtual void AddNoise(TArrayI&) const {} - /** Add a digit to output */ - virtual void AddDigit(AliFMD* /* fmd */, - UShort_t /* detector */, - Char_t /* ring */, - UShort_t /* sector */, - UShort_t /* strip */, - Float_t /* edep */, - UShort_t /* count1 */, - Short_t /* count2 */, - Short_t /* count3 */) const {} - - AliRunLoader* fRunLoader; //! Run loader - AliFMDEdepMap fEdep; // Cache of Energy from hits - Float_t fShapingTime; // Shaping profile parameter - - /** Copy CTOR - @param o object to copy from */ - AliFMDBaseDigitizer(const AliFMDBaseDigitizer& o) - : AliDigitizer(o) {} - /** Assignment operator - @return Reference to this object */ - AliFMDBaseDigitizer& operator=(const AliFMDBaseDigitizer&) { return *this; } - ClassDef(AliFMDBaseDigitizer,2) // Base class for FMD digitizers -}; //==================================================================== /** @class AliFMDDigitizer @@ -294,50 +100,6 @@ protected: ClassDef(AliFMDDigitizer,1) // Make Digits from Hits }; -//==================================================================== -/** @class AliFMDSDigitizer AliFMDDigitizer.h - @brief Concrete implementation to make summable digits. - See also class documentation of AliFMDBaseDigitizer - @ingroup FMD_sim - */ -class AliFMDSDigitizer : public AliFMDBaseDigitizer -{ -public: - /** CTOR */ - AliFMDSDigitizer(); - /** CTOR - @param headerFile Where to write headings - @param sdigFile Where to write digits. */ - AliFMDSDigitizer(const Char_t* headerFile, const Char_t* sdigFile=""); - /** DTOR */ - virtual ~AliFMDSDigitizer(); - /** Do it all - @param option Not used */ - virtual void Exec(Option_t* option=0); -protected: - /** Add a digit to output. - @param fmd Pointer to detector object - @param detector Detector # - @param ring Ring ID - @param sector Sector number - @param strip Strip number - @param edep Energy deposited (not used) - @param count1 ADC count 1 - @param count2 ADC count 2 (-1 if not used) - @param count3 ADC count 3 (-1 if not used) */ - virtual void AddDigit(AliFMD* fmd, - UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - Float_t edep, - UShort_t count1, - Short_t count2, - Short_t count3) const; - ClassDef(AliFMDSDigitizer,0) // Make Summable Digits from Hits -}; - - #endif //____________________________________________________________________ diff --git a/FMD/AliFMDDisplay.cxx b/FMD/AliFMDDisplay.cxx index eae7fa01499..4e6f93f1967 100644 --- a/FMD/AliFMDDisplay.cxx +++ b/FMD/AliFMDDisplay.cxx @@ -34,16 +34,16 @@ #include "AliFMDRecPoint.h" // ALIFMDRECPOINT_H #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H -#include // ALIESDFMD_H +// #include // ALIESDFMD_H #include #include -#include +// #include #include #include -#include +// #include #include #include -#include +// #include #include #include #include @@ -61,6 +61,7 @@ AliFMDDisplay* AliFMDDisplay::fgInstance = 0; AliFMDDisplay* AliFMDDisplay::Instance() { + // Return static instance return fgInstance; } @@ -144,6 +145,7 @@ AliFMDDisplay::DistancetoPrimitive(Int_t px, Int_t) Bool_t AliFMDDisplay::Init() { + // Initialize. GEt transforms and such, if (!AliFMDInput::Init()) return kFALSE; AliFMDGeometry* geom = AliFMDGeometry::Instance(); geom->Init(); @@ -156,6 +158,7 @@ AliFMDDisplay::Init() Bool_t AliFMDDisplay::Begin(Int_t event) { + // Begin of event. Make canvas is not already done if (!fCanvas) { gStyle->SetPalette(1); fCanvas = new TCanvas("display", "Display", 700, 700); @@ -201,6 +204,7 @@ AliFMDDisplay::Begin(Int_t event) Bool_t AliFMDDisplay::End() { + // End of event. Draw everything fPad->cd(); fMarkers->Draw(); fPad->cd(); @@ -228,6 +232,7 @@ AliFMDDisplay::End() Int_t AliFMDDisplay::LookupColor(Float_t x, Float_t max) const { + // Look-up color Int_t idx = Int_t(x / max * gStyle->GetNumberOfColors()); return gStyle->GetColorPalette(idx); } @@ -237,6 +242,7 @@ AliFMDDisplay::LookupColor(Float_t x, Float_t max) const Bool_t AliFMDDisplay::ProcessHit(AliFMDHit* hit, TParticle* p) { + // Process a hit if (!hit) { AliError("No hit"); return kFALSE; } if (!p) { AliError("No track"); return kFALSE; } @@ -257,6 +263,7 @@ AliFMDDisplay::ProcessHit(AliFMDHit* hit, TParticle* p) Bool_t AliFMDDisplay::ProcessDigit(AliFMDDigit* digit) { + // Process a digit if (!digit) { AliError("No digit"); return kFALSE; } Double_t x, y, z; @@ -289,6 +296,7 @@ AliFMDDisplay::ProcessDigit(AliFMDDigit* digit) Bool_t AliFMDDisplay::ProcessRaw(AliFMDDigit* digit) { + // PRocess raw data return ProcessDigit(digit); } @@ -296,6 +304,7 @@ AliFMDDisplay::ProcessRaw(AliFMDDigit* digit) Bool_t AliFMDDisplay::ProcessRecPoint(AliFMDRecPoint* recpoint) { + // Process reconstructed point if (!recpoint) { AliError("No recpoint"); return kFALSE; } if (recpoint->Particles() < .1) return kTRUE; fHits->Add(recpoint); diff --git a/FMD/AliFMDDisplay.h b/FMD/AliFMDDisplay.h index 3ace7ddc8d0..19b62739972 100644 --- a/FMD/AliFMDDisplay.h +++ b/FMD/AliFMDDisplay.h @@ -95,6 +95,9 @@ public: @return @c false on error */ virtual Int_t LookupColor(Float_t x, Float_t max) const; protected: + AliFMDDisplay(const AliFMDDisplay& o) : AliFMDInput(o) { } + AliFMDDisplay& operator=(const AliFMDDisplay&) { return *this; } + static AliFMDDisplay* fgInstance; // Static instance Bool_t fWait; // Wait until user presses `Continue' TObjArray* fMarkers; // Cache of markers diff --git a/FMD/AliFMDEdepHitPair.h b/FMD/AliFMDEdepHitPair.h new file mode 100644 index 00000000000..33bf40690fe --- /dev/null +++ b/FMD/AliFMDEdepHitPair.h @@ -0,0 +1,62 @@ +#ifndef ALIFMDEDEPHITPAIR_H +#define ALIFMDEDEPHITPAIR_H +/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights + * reserved. + * + * See cxx source for full Copyright notice + */ +/** @file AliFMDEdepHitPair.h + @author Christian Holm Christensen + @date Mon Mar 27 12:39:50 2006 + @brief Per strip map of energy deposited and number of hits + @ingroup FMD_sim +*/ +//____________________________________________________________________ +// +// Contains a pair of energy deposited fEdep and number of hits +// fN, fEdep is the summed energy deposition, and fN is the +// number of hits. The map contains one such object or each strip. +// It is used to cache the data in the digitization classes +// AliFMDBaseDigitizer and so on. +// +#ifndef ROOT_Rtypes +# include +#endif +//____________________________________________________________________ +/** @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 + @ingroup FMD_sim +*/ +class AliFMDEdepHitPair +{ +public: + Float_t fEdep; // summed energy deposition + UShort_t fN; // Number of hits + /** CTOR */ + AliFMDEdepHitPair() : fEdep(0), fN(0) {} + /** DTOR */ + virtual ~AliFMDEdepHitPair() {} + /** Assignment operator + @param o Object to assign from + @return Reference to this object */ + AliFMDEdepHitPair& operator=(const AliFMDEdepHitPair& o) + { fEdep = o.fEdep; fN = o.fN; return *this; } + /** Copy CTOR + @param o Object to copy from */ + AliFMDEdepHitPair(const AliFMDEdepHitPair& o) : fEdep(o.fEdep), fN(o.fN) {} + ClassDef(AliFMDEdepHitPair, 1) +}; + +#endif +//____________________________________________________________________ +// +// Local Variables: +// mode: C++ +// End: +// +// EOF +// + + diff --git a/FMD/AliFMDEdepMap.cxx b/FMD/AliFMDEdepMap.cxx index ec7625ccd3b..aa8cd817bd8 100644 --- a/FMD/AliFMDEdepMap.cxx +++ b/FMD/AliFMDEdepMap.cxx @@ -17,9 +17,15 @@ @author Christian Holm Christensen @date Mon Mar 27 12:39:50 2006 @brief Per strip map of energy deposited and number of hits + @ingroup FMD_sim */ //____________________________________________________________________ // +// Contains a pair of energy deposited fEdep and number of hits +// fN, fEdep is the summed energy deposition, and fN is the +// number of hits. The map contains one such object or each strip. +// It is used to cache the data in the digitization classes +// AliFMDBaseDigitizer and so on. // // #include "AliFMDEdepMap.h" // ALIFMDEDEPMAP_H diff --git a/FMD/AliFMDEdepMap.h b/FMD/AliFMDEdepMap.h index 850f4162898..ec77f2b9fbb 100644 --- a/FMD/AliFMDEdepMap.h +++ b/FMD/AliFMDEdepMap.h @@ -9,42 +9,27 @@ @author Christian Holm Christensen @date Mon Mar 27 12:39:50 2006 @brief Per strip map of energy deposited and number of hits + @ingroup FMD_sim */ +// +// 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 #ifndef ALIFMDMAP_H # include "AliFMDMap.h" #endif +#ifndef ALIFMDEDEPHITPAIR_H +# include +#endif + + //____________________________________________________________________ -/** @brief Cache 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 @ingroup FMD_sim */ -class AliFMDEdepHitPair -{ -public: - Float_t fEdep; // summed energy deposition - UShort_t fN; // Number of hits - /** CTOR */ - AliFMDEdepHitPair() : fEdep(0), fN(0) {} - /** DTOR */ - virtual ~AliFMDEdepHitPair() {} - /** Assignment operator - @param o Object to assign from - @return Reference to this object */ - AliFMDEdepHitPair& operator=(const AliFMDEdepHitPair& o) - { fEdep = o.fEdep; fN = o.fN; return *this; } - /** Copy CTOR - @param o Object to copy from */ - AliFMDEdepHitPair(const AliFMDEdepHitPair& o) : fEdep(o.fEdep), fN(o.fN) {} - ClassDef(AliFMDEdepHitPair, 1) -}; - -//____________________________________________________________________ -/** @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 */ class AliFMDEdepMap : public AliFMDMap { public: diff --git a/FMD/AliFMDGeometry.cxx b/FMD/AliFMDGeometry.cxx index 7740c2b9c26..b001ceb7ec4 100644 --- a/FMD/AliFMDGeometry.cxx +++ b/FMD/AliFMDGeometry.cxx @@ -68,11 +68,11 @@ #include "AliRecPoint.h" // ALIRECPOINT_H #include "AliLog.h" // ALIRECPOINT_H #include // ROOT_TVector3 -#include // ROOT_TMatrix -#include // ROOT_TParticle +// #include // ROOT_TMatrix +// #include // ROOT_TParticle #include #include "AliFMDGeometryBuilder.h" -#include +// #include #include #include #include @@ -175,6 +175,7 @@ AliFMDGeometry::Init() void AliFMDGeometry::InitTransformations() { + // Find all local <-> global transforms if (!gGeoManager) { AliError("No TGeoManager defined"); return; @@ -189,6 +190,7 @@ AliFMDGeometry::InitTransformations() void AliFMDGeometry::Build() { + // Build the geometry if (!fBuilder) fBuilder = new AliFMDGeometryBuilder(fDetailed); fBuilder->SetDetailed(fDetailed); fBuilder->UseAssembly(fUseAssembly); @@ -199,6 +201,7 @@ AliFMDGeometry::Build() void AliFMDGeometry::SetActive(Int_t* active, Int_t n) { + // Set active volumes fActive.Set(n); for (Int_t i = 0; i < n; i++) { AliDebug(1, Form("Active vol id # %d: %d", i, active[i])); @@ -210,6 +213,7 @@ AliFMDGeometry::SetActive(Int_t* active, Int_t n) void AliFMDGeometry::AddActive(Int_t active) { + // Add an active volume Int_t n = fActive.fN; fActive.Set(n+1); fActive[n] = active; @@ -219,6 +223,7 @@ AliFMDGeometry::AddActive(Int_t active) Bool_t AliFMDGeometry::IsActive(Int_t vol) const { + // Check if a volume is active for (Int_t i = 0; i < fActive.fN; i++) if (fActive[i] == vol) return kTRUE; return kFALSE; @@ -474,6 +479,7 @@ CheckNodes(TGeoNode* node, const char* name, Int_t& lvl) Int_t FindNodeDepth(const char* name, const char* volname) { + // Find the depth of a node TGeoVolume* vol = gGeoManager->GetVolume(volname); if (!vol) { std::cerr << "No top volume defined" << std::endl; diff --git a/FMD/AliFMDGeometry.h b/FMD/AliFMDGeometry.h index 90c3dc1f132..abb51cc6c8f 100644 --- a/FMD/AliFMDGeometry.h +++ b/FMD/AliFMDGeometry.h @@ -12,8 +12,8 @@ @date Mon Mar 27 12:40:37 2006 @brief Geometry mananger for the FMD */ -//____________________________________________________________________ -// +//____________________________________________________________________ +// // Forward Multiplicity Detector based on Silicon wafers. // // This class is a singleton that handles the geometry parameters of @@ -226,16 +226,16 @@ protected: AliFMDGeometry& operator=(const AliFMDGeometry& other); virtual ~AliFMDGeometry() {} - AliFMDGeometryBuilder* fBuilder; - Int_t fDetectorOff; - Int_t fModuleOff; - Int_t fRingOff; - Int_t fSectorOff; - TArrayI fActive; - Bool_t fDetailed; - Bool_t fUseAssembly; + AliFMDGeometryBuilder* fBuilder; // Geometry builder + Int_t fDetectorOff; // Detector off-set + Int_t fModuleOff; // Module off-set + Int_t fRingOff; // ring offset + Int_t fSectorOff; // Sector offset + TArrayI fActive; // Active volumes + Bool_t fDetailed; // Whether to make detailed geom + Bool_t fUseAssembly; // Whther to use assemblies - ClassDef(AliFMDGeometry,1); // + ClassDef(AliFMDGeometry,1); // Geometry parameters and manager }; diff --git a/FMD/AliFMDGeometryBuilder.cxx b/FMD/AliFMDGeometryBuilder.cxx index cdacecc57d3..6fc9a6a5de7 100644 --- a/FMD/AliFMDGeometryBuilder.cxx +++ b/FMD/AliFMDGeometryBuilder.cxx @@ -20,6 +20,11 @@ */ //____________________________________________________________________ // +// Builder of FMD geometry. +// This class takes care of actually building the geometry using the +// TGeo classes. Various parameters are fecthed from the +// AliFMDGeometry manager. +// // 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 @@ -37,11 +42,11 @@ #include "AliLog.h" // ALILOG_H #include // ROOT_TGeoVolume #include // ROOT_TGeoTube -#include // ROOT_TGeoPcon -#include // ROOT_TGeoMaterial -#include // ROOT_TGeoMedium +//#include // ROOT_TGeoPcon +//#include // ROOT_TGeoMaterial +//#include // ROOT_TGeoMedium #include // ROOT_TGeoXtru -#include // ROOT_TGeoPolygon +//#include // ROOT_TGeoPolygon #include // ROOT_TGeoTube #include // ROOT_TGeoManager #include // ROOT_TVector2 @@ -135,7 +140,7 @@ AliFMDGeometryBuilder::RingGeometry(AliFMDRing* r) } Char_t id = r->GetId(); Double_t siThick = r->GetSiThickness(); - const Int_t nv = r->GetNVerticies(); + const Int_t knv = r->GetNVerticies(); TVector2* a = r->GetVertex(5); TVector2* b = r->GetVertex(3); TVector2* c = r->GetVertex(4); @@ -155,13 +160,13 @@ AliFMDGeometryBuilder::RingGeometry(AliFMDRing* r) Double_t stripoff = a->Mod(); Double_t dstrip = (rmax - stripoff) / ns; Double_t space = r->GetSpacing(); - TArrayD xs(nv); - TArrayD ys(nv); - for (Int_t i = 0; i < nv; i++) { + TArrayD xs(knv); + TArrayD ys(knv); + for (Int_t i = 0; i < knv; i++) { // Reverse the order - TVector2* vv = r->GetVertex(nv - 1 - i); + TVector2* vv = r->GetVertex(knv - 1 - i); if (!vv) { - AliError(Form("Failed to get vertex # %d", nv - 1 - i)); + AliError(Form("Failed to get vertex # %d", knv - 1 - i)); continue; } xs[i] = vv->X(); @@ -170,7 +175,7 @@ AliFMDGeometryBuilder::RingGeometry(AliFMDRing* r) // Shape of actual sensor TGeoXtru* sensorShape = new TGeoXtru(2); - sensorShape->DefinePolygon(nv, xs.fArray, ys.fArray); + sensorShape->DefinePolygon(knv, xs.fArray, ys.fArray); sensorShape->DefineSection(0, - siThick/2); sensorShape->DefineSection(1, siThick/2); TGeoVolume* sensorVolume = new TGeoVolume(Form(fgkSensorName, id), @@ -207,10 +212,10 @@ AliFMDGeometryBuilder::RingGeometry(AliFMDRing* r) } // Shape of Printed circuit Board - for (Int_t i = 0; i < nv / 2; i++) ys[i] -= off; - for (Int_t i = nv / 2; i < nv; i++) ys[i] += off; + for (Int_t i = 0; i < knv / 2; i++) ys[i] -= off; + for (Int_t i = knv / 2; i < knv; i++) ys[i] += off; TGeoXtru* pcbShape = new TGeoXtru(2); - pcbShape->DefinePolygon(nv, xs.fArray, ys.fArray); + pcbShape->DefinePolygon(knv, xs.fArray, ys.fArray); pcbShape->DefineSection(0, - pcbThick/2); pcbShape->DefineSection(1, pcbThick/2); TGeoVolume* pcbVolume = new TGeoVolume(Form(fgkPCBName, id), diff --git a/FMD/AliFMDGeometryBuilder.h b/FMD/AliFMDGeometryBuilder.h index 2a77662d5f8..e6110dcbaa7 100644 --- a/FMD/AliFMDGeometryBuilder.h +++ b/FMD/AliFMDGeometryBuilder.h @@ -7,6 +7,10 @@ * * See cxx source for full Copyright notice */ +// Builder of FMD geometry. +// This class takes care of actually building the geometry using the +// TGeo classes. Various parameters are fecthed from the +// AliFMDGeometry manager. /** @file AliFMDGeometryBuilder.h @author Christian Holm Christensen @date Mon Mar 27 12:41:17 2006 @@ -60,6 +64,10 @@ public: /** @return Detector offfset in the volume tree */ Int_t GetDetectorOff() const { return fDetectorOff; } protected: + /** Copy CTOR */ + AliFMDGeometryBuilder(const AliFMDGeometryBuilder& o) : TTask(o) {} + /** Assignment operator */ + AliFMDGeometryBuilder& operator=(const AliFMDGeometryBuilder&){return *this;} /** Make a ring volume @param r Ring geometry @return Ring volume */ diff --git a/FMD/AliFMDHit.cxx b/FMD/AliFMDHit.cxx index f2b1147cdfc..e4a21a4b832 100644 --- a/FMD/AliFMDHit.cxx +++ b/FMD/AliFMDHit.cxx @@ -17,6 +17,7 @@ @author Christian Holm Christensen @date Mon Mar 27 12:41:58 2006 @brief Hit in the FMD + @ingroup FMD_sim */ //____________________________________________________________________ // @@ -32,10 +33,10 @@ // Latest changes by Christian Holm Christensen // #include "AliFMDHit.h" // ALIFMDHIT_H -#include "AliLog.h" // ALILOG_H +// #include "AliLog.h" // ALILOG_H #include "Riostream.h" // ROOT_Riostream #include -#include +// #include #include //____________________________________________________________________ @@ -126,6 +127,7 @@ AliFMDHit::AliFMDHit(Int_t shunt, const char* AliFMDHit::GetName() const { + // Get the name static TString n; n = Form("FMD%d%c[%2d,%3d]", fDetector,fRing,fSector,fStrip); return n.Data(); @@ -135,6 +137,7 @@ AliFMDHit::GetName() const const char* AliFMDHit::GetTitle() const { + // Get the title static TString t; TDatabasePDG* pdgDB = TDatabasePDG::Instance(); TParticlePDG* pdg = pdgDB->GetParticle(fPdg); diff --git a/FMD/AliFMDHit.h b/FMD/AliFMDHit.h index 0acc7778c00..ff18605e825 100644 --- a/FMD/AliFMDHit.h +++ b/FMD/AliFMDHit.h @@ -5,10 +5,14 @@ * * See cxx source for full Copyright notice */ +// 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. /** @file AliFMDHit.h @author Christian Holm Christensen @date Mon Mar 27 12:41:58 2006 @brief Hit in the FMD + @ingroup FMD_sim */ //___________________________________________________________________ // diff --git a/FMD/AliFMDIndex.cxx b/FMD/AliFMDIndex.cxx index 799a3d3757a..1c91261e812 100644 --- a/FMD/AliFMDIndex.cxx +++ b/FMD/AliFMDIndex.cxx @@ -50,7 +50,9 @@ AliFMDIndex::AliFMDIndex() fSector(0), fStrip(0), fHash(-1) -{} +{ + // CTOR +} //____________________________________________________________________ AliFMDIndex::AliFMDIndex(const AliFMDIndex& o) @@ -102,6 +104,7 @@ AliFMDIndex::operator=(const AliFMDIndex& o) Int_t AliFMDIndex::Hash() const { + // calculate hash value if (fHash < 0) { size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1); fHash = (fStrip + @@ -125,6 +128,7 @@ AliFMDIndex::Print(Option_t* /* option*/) const const char* AliFMDIndex::Name() const { + // GEt the name of the index if (fName.IsNull()) fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip); return fName.Data(); @@ -140,6 +144,7 @@ ClassImp(AliFMDObjIndex) Int_t AliFMDObjIndex::Compare(const TObject* o) const { + // Compare to another index const AliFMDObjIndex* a = dynamic_cast(o); if (!a) { Fatal("Compare", diff --git a/FMD/AliFMDInput.cxx b/FMD/AliFMDInput.cxx index 6fcba8f5d21..3189d46c543 100644 --- a/FMD/AliFMDInput.cxx +++ b/FMD/AliFMDInput.cxx @@ -38,6 +38,7 @@ #include "AliFMD.h" // ALIFMD_H #include "AliFMDHit.h" // ALIFMDHIT_H #include "AliFMDDigit.h" // ALIFMDDigit_H +#include "AliFMDSDigit.h" // ALIFMDDigit_H #include "AliFMDRecPoint.h" // ALIFMDRECPOINT_H #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H #include @@ -348,6 +349,8 @@ AliFMDInput::Event() Bool_t AliFMDInput::ProcessHits() { + // Read the hit tree, and pass each hit to the member function + // ProcessHit. if (!fTreeH) { AliError("No hit tree defined"); return kFALSE; @@ -518,30 +521,6 @@ AliFMDInput::Run() return retval; } -//==================================================================== -ClassImp(AliFMDInputHits) -#if 0 - ; -#endif - - -//==================================================================== -ClassImp(AliFMDInputDigits) -#if 0 - ; -#endif - -//==================================================================== -ClassImp(AliFMDInputSDigits) -#if 0 - ; -#endif - -//==================================================================== -ClassImp(AliFMDInputRecPoints) -#if 0 - ; -#endif //____________________________________________________________________ // diff --git a/FMD/AliFMDInput.h b/FMD/AliFMDInput.h index 904283cf7f9..a3828c92392 100644 --- a/FMD/AliFMDInput.h +++ b/FMD/AliFMDInput.h @@ -5,6 +5,13 @@ * * See cxx source for full Copyright notice */ +//___________________________________________________________________ +// +// The classes defined here, are utility classes for reading in data +// for the FMD. They are put in a seperate library to not polute the +// normal libraries. The classes are intended to be used as base +// classes for customized class that do some sort of analysis on the +// various types of data produced by the FMD. /** @file AliFMDInput.h @author Christian Holm Christensen @date Mon Mar 27 12:42:40 2006 @@ -189,6 +196,13 @@ public: virtual Bool_t ProcessESD(AliESDFMD*) { return kTRUE; } protected: + /** Copy ctor + @param o Object to copy from */ + AliFMDInput(const AliFMDInput& o) : TObject(o) {} + /** Assignement operator + @return REference to this */ + AliFMDInput& operator=(const AliFMDInput&) { return *this; } + TString fGAliceFile; // File name of gAlice file AliRunLoader* fLoader; // Loader of FMD data AliRun* fRun; // Run information @@ -213,80 +227,11 @@ protected: TClonesArray* fArrayA; // Raw data (digits) info array TGeoManager* fGeoManager; // Geometry manager Int_t fTreeMask; // Which tree's to load - Bool_t fIsInit; + Bool_t fIsInit; // Have we been initialized ClassDef(AliFMDInput,0) //Hits for detector FMD }; -//____________________________________________________________________ -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); -}; - -//____________________________________________________________________ -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); -}; - -//____________________________________________________________________ -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); -}; - -//____________________________________________________________________ -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); -}; - #endif //____________________________________________________________________ // diff --git a/FMD/AliFMDParameters.cxx b/FMD/AliFMDParameters.cxx index 999ae96a424..43ed7b7f808 100644 --- a/FMD/AliFMDParameters.cxx +++ b/FMD/AliFMDParameters.cxx @@ -71,7 +71,7 @@ AliFMDParameters::Instance() //____________________________________________________________________ AliFMDParameters::AliFMDParameters() : fIsInit(kFALSE), - fSiDeDxMip(1.664), + fkSiDeDxMip(1.664), fFixedPulseGain(0), fEdepMip(0), fZeroSuppression(0), @@ -116,6 +116,8 @@ AliFMDParameters::Init() void AliFMDParameters::Print(Option_t* option) const { + // Print information. + // If option contains an 'A' then everything is printed. TString opt(option); Bool_t showStrips = opt.Contains("a", TString::kIgnoreCase); for (UShort_t det=1 ; det <= 3; det++) { @@ -166,6 +168,7 @@ AliFMDParameters::Print(Option_t* option) const void AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) { + // Set fixed strip range fFixedMinStrip = min; fFixedMaxStrip = max; } @@ -174,6 +177,7 @@ AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) void AliFMDParameters::InitPulseGain() { + // Get pulse gain from CDB or used fixed AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* gain = cdb->Get(fgkPulseGain); if (!gain) { @@ -190,6 +194,7 @@ AliFMDParameters::InitPulseGain() void AliFMDParameters::InitPedestal() { + // Initialize the pedestals from CDB AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* pedestal = cdb->Get(fgkPedestal); if (!pedestal) { @@ -206,6 +211,7 @@ AliFMDParameters::InitPedestal() void AliFMDParameters::InitDeadMap() { + // Get Dead-channel-map from CDB AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* deadMap = cdb->Get(fgkDead); if (!deadMap) { @@ -222,6 +228,7 @@ AliFMDParameters::InitDeadMap() void AliFMDParameters::InitZeroSuppression() { + // Get 0-suppression from CDB AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* zeroSup = cdb->Get(fgkZeroSuppression); if (!zeroSup) { @@ -239,6 +246,7 @@ AliFMDParameters::InitZeroSuppression() void AliFMDParameters::InitSampleRate() { + // get Sample rate from CDB AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* sampRat = cdb->Get(fgkSampleRate); if (!sampRat) { @@ -255,6 +263,7 @@ AliFMDParameters::InitSampleRate() void AliFMDParameters::InitAltroMap() { + // Get hardware mapping from CDB AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* hwMap = cdb->Get(fgkAltroMap); if (!hwMap) { @@ -275,6 +284,7 @@ AliFMDParameters::InitAltroMap() void AliFMDParameters::InitStripRange() { + // Get strips read-out from CDB AliCDBManager* cdb = AliCDBManager::Instance(); AliCDBEntry* range = cdb->Get(fgkStripRange); if (!range) { @@ -292,6 +302,7 @@ AliFMDParameters::InitStripRange() Float_t AliFMDParameters::GetThreshold() const { + // Get threshold from CDB if (!fPulseGain) return fFixedThreshold; return fPulseGain->Threshold(); } @@ -326,6 +337,7 @@ Bool_t AliFMDParameters::IsDead(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const { + // Check if the channel is dead if (!fDeadMap) return kFALSE; AliDebug(50, Form("Dead for FMD%d%c[%2d,%3d]=%s", detector, ring, sector, strip, @@ -339,6 +351,7 @@ UShort_t AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const { + // Get zero suppression threshold if (!fZeroSuppression) return fFixedZeroSuppression; // Need to map strip to ALTRO chip. AliDebug(50, Form("zero sup. for FMD%d%c[%2d,%3d]=%f", @@ -353,6 +366,7 @@ UShort_t AliFMDParameters::GetSampleRate(UShort_t det, Char_t ring, UShort_t sector, UShort_t str) const { + // Get sampl rate if (!fSampleRate) return fFixedSampleRate; // Need to map sector to digitizier card. UInt_t ret = fSampleRate->Rate(det, ring, sector, str); @@ -366,6 +380,7 @@ UShort_t AliFMDParameters::GetMinStrip(UShort_t det, Char_t ring, UShort_t sector, UShort_t str) const { + // Get strip range read out if (!fStripRange) return fFixedMinStrip; // Need to map sector to digitizier card. UInt_t ret = fStripRange->Min(det, ring, sector, str); @@ -379,6 +394,7 @@ UShort_t AliFMDParameters::GetMaxStrip(UShort_t det, Char_t ring, UShort_t sector, UShort_t str) const { + // Get strip range read out if (!fStripRange) return fFixedMaxStrip; // Need to map sector to digitizier card. UInt_t ret = fStripRange->Max(det, ring, sector, str); @@ -392,6 +408,7 @@ Float_t AliFMDParameters::GetPedestal(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const { + // Get the pedesal if (!fPedestal) return fFixedPedestal; AliDebug(50, Form("pedestal for FMD%d%c[%2d,%3d]=%f", detector, ring, sector, strip, @@ -404,6 +421,7 @@ Float_t AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const { + // Get the pedesal if (!fPedestal) return fFixedPedestalWidth; AliDebug(50, Form("pedetal width for FMD%d%c[%2d,%3d]=%f", detector, ring, sector, strip, @@ -415,6 +433,7 @@ AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring, AliFMDAltroMapping* AliFMDParameters::GetAltroMap() const { + // Get the hardware address to detector index map return fAltroMap; } @@ -425,6 +444,7 @@ AliFMDParameters::Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det, Char_t& ring, UShort_t& sec, UShort_t& str) const { + // Map hardware address to detector index if (!fAltroMap) return kFALSE; return fAltroMap->Hardware2Detector(ddl, addr, det, ring, sec, str); } @@ -435,6 +455,7 @@ AliFMDParameters::Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UInt_t& ddl, UInt_t& addr) const { + // Map detector index to hardware address if (!fAltroMap) return kFALSE; return fAltroMap->Detector2Hardware(det, ring, sec, str, ddl, addr); } @@ -447,7 +468,7 @@ AliFMDParameters::GetEdepMip() const // Get energy deposited by a MIP in the silicon sensors if (fEdepMip <= 0){ AliFMDGeometry* fmd = AliFMDGeometry::Instance(); - fEdepMip = (fSiDeDxMip + fEdepMip = (fkSiDeDxMip * fmd->GetRing('I')->GetSiThickness() * fmd->GetSiDensity()); } diff --git a/FMD/AliFMDParameters.h b/FMD/AliFMDParameters.h index 0e50bc774be..3a465daae7d 100644 --- a/FMD/AliFMDParameters.h +++ b/FMD/AliFMDParameters.h @@ -7,17 +7,17 @@ * * 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 // FMD // Should get ata fromm Conditions DB. // +/** @file AliFMDParameters.h + @author Christian Holm Christensen + @date Mon Mar 27 12:44:43 2006 + @brief Manager of FMD parameters +*/ #ifndef ROOT_TNamed # include #endif @@ -37,6 +37,12 @@ class AliFMDCalibGain; class AliFMDCalibSampleRate; class AliFMDCalibStripRange; class AliFMDAltroMapping; +//____________________________________________________________________ +// +// Singleton class to handle various parameters (not geometry) of the +// FMD +// Should get ata fromm Conditions DB. +// /** @brief This class is a singleton that handles various parameters of the FMD detectors. @@ -242,16 +248,22 @@ public: enum { kBaseDDL = 0x1000 // DDL offset for the FMD }; - static const char* fgkPulseGain; // Path to PulseGain calib object - static const char* fgkPedestal; // Path to Pedestal calib object - static const char* fgkDead; // Path to Dead calib object - 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 + static const char* PulseGainPath() { return fgkPulseGain; } + static const char* PedestalPath() { return fgkPedestal; } + static const char* DeadPath() { return fgkDead; } + static const char* SampleRatePath() { return fgkSampleRate; } + static const char* AltroMapPath() { return fgkAltroMap; } + static const char* ZeroSuppressionPath() { return fgkZeroSuppression; } + static const char* StripRangePath() { return fgkStripRange; } protected: /** CTOR */ AliFMDParameters(); + /** CTOR */ + AliFMDParameters(const AliFMDParameters& o) + : TNamed(o), fkSiDeDxMip(o.fkSiDeDxMip) {} + /** Assignement operator + @return Reference to this */ + AliFMDParameters& operator=(const AliFMDParameters&) { return *this; } /** DTOR */ virtual ~AliFMDParameters() {} /** Singleton instance */ @@ -273,7 +285,14 @@ protected: Bool_t fIsInit; // Whether we've been initialised - const Float_t fSiDeDxMip; // MIP dE/dx in Silicon + static const char* fgkPulseGain; // Path to PulseGain calib object + static const char* fgkPedestal; // Path to Pedestal calib object + static const char* fgkDead; // Path to Dead calib object + 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 + const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon UShort_t fVA1MipRange; // # MIPs the pre-amp can do UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch. UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan. @@ -283,9 +302,9 @@ protected: Float_t fFixedPedestalWidth; // Width of pedestal 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; + Float_t fFixedThreshold; // Threshold in ADC counts + UShort_t fFixedMinStrip; // Minimum strip read-out + UShort_t fFixedMaxStrip; // Maximum strip read-out mutable Float_t fFixedPulseGain; //! Gain (cached) mutable Float_t fEdepMip; //! Cache of energy loss for a MIP @@ -297,7 +316,7 @@ protected: AliFMDAltroMapping* fAltroMap; // Map of hardware AliFMDCalibStripRange* fStripRange; // Strip range - ClassDef(AliFMDParameters,4) + ClassDef(AliFMDParameters,5) // Manager of parameters }; #endif diff --git a/FMD/AliFMDPoints.cxx b/FMD/AliFMDPoints.cxx new file mode 100644 index 00000000000..b64e62017f7 --- /dev/null +++ b/FMD/AliFMDPoints.cxx @@ -0,0 +1,133 @@ +/************************************************************************** + * 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 AliFMDPoints.cxx + @author Christian Holm Christensen + @date Tue Apr 11 12:42:50 2006 + @brief Specialised class for drawing hits in the FMD. + @ingroup FMD_sim +*/ +// Specialised class for drawing hits in the FMD. The normal +// AliPoints class isn't really suited for the FMD, as it connects the +// dots between hits from the same particle. However, in the FMD, all +// hits are not identified by a track, so this has little meaning. +// What is more interresting, is the actual size of the hit. +#include // ROOT_TMath +#include // ROOT_TVector3 +#include // ROOT_TMarker3DBox +#include "AliFMDHit.h" // ALIFMDHIT_H +#include "AliFMDPoints.h" // ALIFMDPOINTS_H + +//____________________________________________________________________ +AliFMDPoints::AliFMDPoints(AliFMDHit* hit, UInt_t color) + : AliPoints(1), fMarker(0) +{ + // Constructor + // Params: + // hit Hit to represent + // color Color of marker + // + if (!hit) return; + Float_t size = TMath::Min(TMath::Max(hit->Edep() * .1, .1), 1.); + TVector3 p(hit->Px(), hit->Py(), hit->Pz()); + fMarker = new TMarker3DBox(hit->X(), hit->Y(), hit->Z(), size, size, size, + p.Theta(), p.Phi()); + fMarker->SetLineColor(color); + fMarker->SetRefObject(this); + fP[0] = hit->X(); + fP[1] = hit->Y(); + fP[2] = hit->Z(); +} + +//____________________________________________________________________ +AliFMDPoints::AliFMDPoints(const AliFMDPoints& other) + : AliPoints(other), fMarker(other.fMarker) +{ + // Copy constructor +} + +//____________________________________________________________________ +AliFMDPoints& +AliFMDPoints::operator=(const AliFMDPoints& other) +{ + // Assignment operator + fMarker = other.fMarker; + return *this; +} + + +//____________________________________________________________________ +AliFMDPoints::~AliFMDPoints() +{ + // Destructor + // if (fMarker) delete fMarker; +} +//____________________________________________________________________ +void +AliFMDPoints::SetXYZ(Double_t x, Double_t y, Double_t z) +{ + // Set (x,y,z) position of marker + // Params + // X X position + // Y Y position + // Z Z position + if (fMarker) fMarker->SetPosition(x, y, z); +} + +//____________________________________________________________________ +Int_t +AliFMDPoints::DistancetoPrimitive(Int_t px, Int_t py) +{ + // Calculate distance from (px,py) to this + // Params: + // Px X-coordinate of marker + // Py Y-coordinate of marker + // Return + // Distance to this + return fMarker->DistancetoPrimitive(px, py); +} +//____________________________________________________________________ +void +AliFMDPoints::Draw(Option_t* option) +{ + // Draw on pad + // Params + // option See TMarker3DBox::Draw + if (fMarker) fMarker->Draw(option); +} +//____________________________________________________________________ +void +AliFMDPoints::Paint(Option_t* option) +{ + // Draw on pad + // Params + // option See TMarker3DBox::Paint + if (fMarker) fMarker->Paint(option); +} + +//____________________________________________________________________ +void +AliFMDPoints::SetMarkerColor(Color_t colour) +{ + // Set the marker color + // Params + // colour Colour of marker + if (fMarker) fMarker->SetLineColor(colour); +} + +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/AliFMDPoints.h b/FMD/AliFMDPoints.h new file mode 100644 index 00000000000..46a24f97375 --- /dev/null +++ b/FMD/AliFMDPoints.h @@ -0,0 +1,71 @@ +#ifndef ALIFMDPOINTS_H +#define ALIFMDPOINTS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights + * reserved. + * + * Latest changes by Christian Holm Christensen + * + * See cxx source for full Copyright notice + */ +/** @file AliFMDPoints.h + @author Christian Holm Christensen + @date Tue Apr 11 12:35:31 2006 + @brief Specialised class for drawing hits in the FMD. + @ingroup FMD_sim +*/ +#ifndef ALIPOINTS_H +# include +#endif +class AliFMHit; +class TMarker3DBox; + +/** @class AliFMDPoints + @brief Class to draw hits for the FMD + @ingroup FMD_sim + */ +class AliFMDPoints : public AliPoints +{ +public: + /** Constructor + @param hit Hit to draw + @param color Color of hit */ + AliFMDPoints(AliFMDHit* hit, UInt_t color); + /** Copy constructor + @param other Objct to copy from */ + AliFMDPoints(const AliFMDPoints& other); + /** Assignment operator + @param other Objct to copy from + @return reference to this */ + AliFMDPoints& operator=(const AliFMDPoints& other); + /** Destructor */ + virtual ~AliFMDPoints(); + /** Set position + @param x @f$ x@f$ coordinate + @param y @f$ y@f$ coordinate + @param z @f$ z@f$ coordinate */ + void SetXYZ(Double_t x, Double_t y, Double_t z); + /** Calculate the distance to this object from cursor + @param px Curser X-position + @param py Cursor Y-position + @return Distance to @f$(p_x,p_y)@f$ */ + Int_t DistancetoPrimitive(Int_t px, Int_t py); + /** Attach to canvas + @param option See TMarker3DBox::Draw */ + void Draw(Option_t* option); + /** Paint in canvas + @param option See TMarker3DBox::Paint */ + void Paint(Option_t* option); + /** @param colour Colour of marker */ + void SetMarkerColor(Color_t colour); +private: + /** Marker */ + TMarker3DBox* fMarker; // Marker +}; + +#endif +// Local Variables: +// mode: C++ +// End: +// +// EOF +// diff --git a/FMD/AliFMDRawReader.cxx b/FMD/AliFMDRawReader.cxx index 5e8c7ffda83..3d565a47ad5 100644 --- a/FMD/AliFMDRawReader.cxx +++ b/FMD/AliFMDRawReader.cxx @@ -17,6 +17,7 @@ @author Christian Holm Christensen @date Mon Mar 27 12:45:23 2006 @brief Class to read raw data + @ingroup FMD_rec */ //____________________________________________________________________ // @@ -52,15 +53,11 @@ #include "AliRawReader.h" // ALIRAWREADER_H #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H // #include "AliFMDAltroIO.h" // ALIFMDALTROIO_H -#include // ROOT_TArrayI +// #include // ROOT_TArrayI #include // ROOT_TTree #include // ROOT_TClonesArray -#include -#include -#include -#define PRETTY_HEX(N,X) \ - " 0x" << std::setfill('0') << std::setw(N) << std::hex << X \ - << std::setfill(' ') << std::dec +// #include +// #include //____________________________________________________________________ ClassImp(AliFMDRawReader) @@ -82,6 +79,7 @@ AliFMDRawReader::AliFMDRawReader(AliRawReader* reader, TTree* tree) void AliFMDRawReader::Exec(Option_t*) { + // Read the data TClonesArray* array = new TClonesArray("AliFMDDigit"); if (!fTree) { AliError("No tree"); diff --git a/FMD/AliFMDRawReader.h b/FMD/AliFMDRawReader.h index 483a5a8d9ed..f7b43333ff5 100644 --- a/FMD/AliFMDRawReader.h +++ b/FMD/AliFMDRawReader.h @@ -7,18 +7,19 @@ * * 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. // Note, that it uses an ALTRO reader, which is wrong. // Perhaps we need to implement it our selves // +/* $Id$ */ +/** @file AliFMDRawReader.h + @author Christian Holm Christensen + @date Mon Mar 27 12:45:23 2006 + @brief Class to read raw data + @ingroup FMD_rec +*/ #ifndef ROOT_TTask # include #endif @@ -57,6 +58,8 @@ public: @return @c true on success */ virtual Bool_t ReadAdcs(TClonesArray* array); protected: + AliFMDRawReader(const AliFMDRawReader& o) : TTask(o) {} + AliFMDRawReader& operator=(const AliFMDRawReader&) { return *this; } TTree* fTree; //! Pointer to tree to read into AliRawReader* fReader; //! Pointer to raw reader UShort_t fSampleRate; // The sample rate (if 0, inferred from data) diff --git a/FMD/AliFMDRawStream.cxx b/FMD/AliFMDRawStream.cxx index 7c47e9591b7..8fc23a9f004 100644 --- a/FMD/AliFMDRawStream.cxx +++ b/FMD/AliFMDRawStream.cxx @@ -26,11 +26,11 @@ // and the sample rate should be set explicitly. // #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H -#include // ALIRAWREADER_H +// #include // ALIRAWREADER_H #include "AliFMDParameters.h" #include -#include -#include +// #include +// #include //____________________________________________________________________ ClassImp(AliFMDRawStream) @@ -42,6 +42,7 @@ ClassImp(AliFMDRawStream) AliFMDRawStream::AliFMDRawStream(AliRawReader* reader) : AliAltroRawStream(reader) { + // CTOR fNoAltroMapping = kFALSE; // Select FMD DDL's SelectRawData(AliFMDParameters::kBaseDDL>>8); @@ -52,6 +53,8 @@ Bool_t AliFMDRawStream::ReadChannel(UInt_t& ddl, UInt_t& addr, UInt_t& len, UShort_t* data) { + // Read one channel and return. Returns 0 when there's no more + // data. Int_t l = 0; static Int_t last = 0xFFFF; // 0xFFFF means signal is used Bool_t next = kTRUE; diff --git a/FMD/AliFMDRawWriter.cxx b/FMD/AliFMDRawWriter.cxx index 9b3cbadfca0..e607c323327 100644 --- a/FMD/AliFMDRawWriter.cxx +++ b/FMD/AliFMDRawWriter.cxx @@ -47,7 +47,7 @@ // #include "AliFMDAltroIO.h" // ALIFMDALTROWRITER_H #include // ROOT_TArrayI #include // ROOT_TClonesArray -#include +// #include //____________________________________________________________________ ClassImp(AliFMDRawWriter) @@ -59,7 +59,10 @@ ClassImp(AliFMDRawWriter) AliFMDRawWriter::AliFMDRawWriter(AliFMD* fmd) : TTask("FMDRawWriter", "Writer of Raw ADC values from the FMD"), fFMD(fmd) -{} +{ + // CTOR +} + //____________________________________________________________________ @@ -154,6 +157,7 @@ AliFMDRawWriter::Exec(Option_t*) void AliFMDRawWriter::WriteDigits(TClonesArray* digits) { + // WRite an array of digits to disk file Int_t nDigits = digits->GetEntries(); if (nDigits < 1) return; diff --git a/FMD/AliFMDRawWriter.h b/FMD/AliFMDRawWriter.h index 35e25538b01..e0b4e34cf40 100644 --- a/FMD/AliFMDRawWriter.h +++ b/FMD/AliFMDRawWriter.h @@ -57,6 +57,8 @@ public: ALTRO data. */ virtual void WriteDigits(TClonesArray* digits); protected: + AliFMDRawWriter(const AliFMDRawWriter& o) : TTask(o) {} + AliFMDRawWriter& operator=(const AliFMDRawWriter&) { return *this; } 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 cea8f0730e3..989b5128e87 100644 --- a/FMD/AliFMDRecPoint.cxx +++ b/FMD/AliFMDRecPoint.cxx @@ -45,7 +45,9 @@ AliFMDRecPoint::AliFMDRecPoint() fEta(0), fPhi(0), fEdep(0) -{} +{ + // CTOR +} //____________________________________________________________________ AliFMDRecPoint::AliFMDRecPoint(UShort_t detector, Char_t ring, @@ -67,6 +69,7 @@ AliFMDRecPoint::AliFMDRecPoint(UShort_t detector, Char_t ring, const char* AliFMDRecPoint::GetName() const { + // Get the name static TString n; n = Form("FMD%d%c[%2d,%3d]", fDetector,fRing,fSector,fStrip); return n.Data(); @@ -76,6 +79,7 @@ AliFMDRecPoint::GetName() const const char* AliFMDRecPoint::GetTitle() const { + // Get the title static TString t; t = Form("%f (%f,%f)", fParticles, fEta, fPhi); return t.Data(); diff --git a/FMD/AliFMDReconstructor.cxx b/FMD/AliFMDReconstructor.cxx index 620aa22e420..788655eb71a 100644 --- a/FMD/AliFMDReconstructor.cxx +++ b/FMD/AliFMDReconstructor.cxx @@ -20,8 +20,7 @@ */ //____________________________________________________________________ // -// This is a class that constructs AliFMDMult (reconstructed -// multiplicity) from of Digits +// This is a class that constructs AliFMDRecPoint objects from of Digits // // This class reads either digits from a TClonesArray or raw data from // a DDL file (or similar), and stores the read ADC counts in an @@ -36,23 +35,17 @@ #include // ALILOG_H #include // ALIRUN_H #include // ALIRUNLOADER_H -#include // ALILOADER_H #include // ALIHEADER_H -#include // ALIRAWREADER_H #include // ALIGENEVENTHEADER_H -#include "AliFMD.h" // ALIFMD_H #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H #include "AliFMDParameters.h" // ALIFMDPARAMETERS_H -#include "AliFMDDetector.h" // ALIFMDDETECTOR_H -#include "AliFMDRing.h" // ALIFMDRING_H #include "AliFMDDigit.h" // ALIFMDDIGIT_H #include "AliFMDReconstructor.h" // ALIFMDRECONSTRUCTOR_H -#include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H #include "AliFMDRawReader.h" // ALIFMDRAWREADER_H #include "AliFMDRecPoint.h" // ALIFMDMULTNAIIVE_H #include "AliESD.h" // ALIESD_H #include // ALIESDFMD_H -#include +class AliRawReader; //____________________________________________________________________ ClassImp(AliFMDReconstructor) diff --git a/FMD/AliFMDReconstructor.h b/FMD/AliFMDReconstructor.h index dac28d63614..22b3b1ef5d6 100644 --- a/FMD/AliFMDReconstructor.h +++ b/FMD/AliFMDReconstructor.h @@ -94,20 +94,6 @@ public: /** Not used */ virtual void SetESD(AliESD* esd) { fESD = esd; } -private: - /** Hide base classes unused function */ - void Reconstruct(AliRawReader*, TTree*) const; - /** Hide base classes unused function */ - void Reconstruct(AliRunLoader*) const; - /** Hide base classes unused function */ - void Reconstruct(AliRunLoader*, AliRawReader*) const; - /** Hide base classes unused function */ - void FillESD(AliRawReader*, TTree*, AliESD*) const; - /** Hide base classes unused function */ - void FillESD(AliRunLoader*, AliESD*) const; - /** Hide base classes unused function */ - void FillESD(AliRunLoader*, AliRawReader*, AliESD*) const; - protected: /** Copy CTOR @param other Object to copy from. */ @@ -167,7 +153,21 @@ protected: mutable TTree* fTreeR; // Output tree mutable Float_t fCurrentVertex; // Z-coordinate of primary vertex mutable AliESDFMD* fESDObj; // ESD output object - AliESD* fESD; + AliESD* fESD; // ESD object(?) + +private: + /** Hide base classes unused function */ + void Reconstruct(AliRawReader*, TTree*) const; + /** Hide base classes unused function */ + void Reconstruct(AliRunLoader*) const; + /** Hide base classes unused function */ + void Reconstruct(AliRunLoader*, AliRawReader*) const; + /** Hide base classes unused function */ + void FillESD(AliRawReader*, TTree*, AliESD*) const; + /** Hide base classes unused function */ + void FillESD(AliRunLoader*, AliESD*) const; + /** Hide base classes unused function */ + void FillESD(AliRunLoader*, AliRawReader*, AliESD*) const; ClassDef(AliFMDReconstructor, 0) // class for the FMD reconstruction }; diff --git a/FMD/AliFMDRing.cxx b/FMD/AliFMDRing.cxx index b887b4b6f8f..da598669999 100644 --- a/FMD/AliFMDRing.cxx +++ b/FMD/AliFMDRing.cxx @@ -30,9 +30,9 @@ // Latest changes by Christian Holm Christensen // -#include // ALILOG_H +// #include // ALILOG_H #include "AliFMDRing.h" // ALIFMDRING_H -#include // ROOT_TMath +// #include // ROOT_TMath #include // ROOT_TVector2 //==================================================================== diff --git a/FMD/AliFMDRing.h b/FMD/AliFMDRing.h index ad39893de4a..10790311565 100644 --- a/FMD/AliFMDRing.h +++ b/FMD/AliFMDRing.h @@ -15,7 +15,6 @@ //__________________________________________________________________ // // Parameters of the FMD rings. -// // This class is responsible to make the (common) rings of the three // sub-detectors. // diff --git a/FMD/AliFMDSDigit.cxx b/FMD/AliFMDSDigit.cxx new file mode 100644 index 00000000000..b7773b334b0 --- /dev/null +++ b/FMD/AliFMDSDigit.cxx @@ -0,0 +1,127 @@ +/************************************************************************** + * Copyright(c) 2004, 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 AliFMDSDigit.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:37:41 2006 + @brief Digits for the FMD + @ingroup FMD_base +*/ +////////////////////////////////////////////////////////////////////// +// +// Digits classes for the FMD +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// +// As the Digits and SDigits have so much in common, the classes +// AliFMDDigit and AliFMDSDigit are implemented via a base +// class AliFMDBaseDigit. +/// +// +-----------------+ +// | AliFMDBaseDigit | +// +-----------------+ +// ^ +// | +// +------------+ +// | | +// +-------------+ +--------------+ +// | AliFMDDigit | | AliFMDSDigit | +// +-------------+ +--------------+ +// +// (Note, that I'd really would have liked to implement AliFMDHit as a +// derived class from some base class - say AliFMDStrip, and the Digit +// classes would (eventually) have derived from that as well. +// However, ROOT doesn't do well with multiple inheritance, so I chose +// not to anyway). +// +// Latest changes by Christian Holm Christensen +// +////////////////////////////////////////////////////////////////////// + +#include "AliFMDSDigit.h" // ALIFMDDIGIT_H +#include "Riostream.h" // ROOT_Riostream +#include + +//==================================================================== +ClassImp(AliFMDSDigit) + +//____________________________________________________________________ +AliFMDSDigit::AliFMDSDigit() + : fEdep(0), + fCount1(0), + fCount2(-1), + fCount3(-1) +{ + // cTOR +} + +//____________________________________________________________________ +AliFMDSDigit::AliFMDSDigit(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + Float_t edep, + UShort_t count1, + Short_t count2, + Short_t count3) + : AliFMDBaseDigit(detector, ring, sector, strip), + fEdep(edep), + fCount1(count1), + fCount2(count2), + fCount3(count3) +{ + // + // Creates a real data digit object + // + // Parameters + // + // detector Detector # (1, 2, or 3) + // ring Ring ID ('I' or 'O') + // sector Sector # (For inner/outer rings: 0-19/0-39) + // strip Strip # (For inner/outer rings: 0-511/0-255) + // edep Total energy deposited + // count1 ADC count (a 10-bit word) + // count2 ADC count (a 10-bit word) -1 if not used + // count3 ADC count (a 10-bit word) -1 if not used +} + +//____________________________________________________________________ +void +AliFMDSDigit::Print(Option_t* /* option*/) const +{ + // Print digit to standard out + AliFMDBaseDigit::Print(); + cout << "\t" << fEdep << " -> " + << fCount1 << " (+ " << fCount2 << " + " << fCount2 << ") = " + << Counts() << endl; +} + +//____________________________________________________________________ +// +// EOF +// diff --git a/FMD/AliFMDSDigit.h b/FMD/AliFMDSDigit.h new file mode 100644 index 00000000000..2beb6c9a40a --- /dev/null +++ b/FMD/AliFMDSDigit.h @@ -0,0 +1,86 @@ +#ifndef ALIFMDSDIGIT_H +#define ALIFMDSDIGIT_H +/** @file AliFMDSDigit.h + @author Christian Holm Christensen + @date Mon Mar 27 12:37:41 2006 + @brief Digits for the FMD +*/ +//___________________________________________________________________ +// +// Digits classes for the FMD +// AliFMDBaseDigit - base class +// AliFMDDigit - Normal (smeared) digit +// AliFMDSDigit - Summable (non-smeared) digit +// +#ifndef ALIFMDBASEDIGIT_H +# include +#endif +//____________________________________________________________________ +/** @class AliFMDSDigit AliFMDDigit.h + @brief class for summable digits + @ingroup FMD_base + */ +class AliFMDSDigit : public AliFMDBaseDigit +{ +public: + /** CTOR */ + AliFMDSDigit(); + /** Constrctor + @param detector Detector + @param ring Ring + @param sector Sector + @param strip Strip + @param edep Energy deposited + @param count ADC (first sample) + @param count2 ADC (second sample, or -1 if not used) + @param count3 ADC (third sample, or -1 if not used) */ + AliFMDSDigit(UShort_t detector, + Char_t ring='\0', + UShort_t sector=0, + UShort_t strip=0, + Float_t edep=0, + UShort_t count=0, + Short_t count2=-1, + Short_t count3=-1); + /** DTOR */ + virtual ~AliFMDSDigit() {} + /** @return ADC count (first sample) */ + UShort_t Count1() const { return fCount1; } + /** @return ADC count (second sample, or -1 if not used) */ + Short_t Count2() const { return fCount2; } + /** @return ADC count (third sample, or -1 if not used) */ + Short_t Count3() const { return fCount3; } + /** @return Canonical ADC counts */ + UShort_t Counts() const; + /** @return Energy deposited */ + Float_t Edep() const { return fEdep; } + /** Print info + @param opt Not used */ + void Print(Option_t* opt="") const; +protected: + Float_t fEdep; // Energy deposited + UShort_t fCount1; // Digital signal + Short_t fCount2; // Digital signal (-1 if not used) + Short_t fCount3; // Digital signal (-1 if not used) + ClassDef(AliFMDSDigit,1) // Summable FMD digit +}; + +inline UShort_t +AliFMDSDigit::Counts() const +{ + return fCount1 + + (fCount2 >= 0 ? fCount2 : 0) + + (fCount3 >= 0 ? fCount3 : 0); +} + + +#endif +//____________________________________________________________________ +// +// Local Variables: +// mode: C++ +// End: +// +// +// EOF +// diff --git a/FMD/AliFMDSDigitizer.cxx b/FMD/AliFMDSDigitizer.cxx new file mode 100644 index 00000000000..70c4ca31413 --- /dev/null +++ b/FMD/AliFMDSDigitizer.cxx @@ -0,0 +1,324 @@ +/************************************************************************** + * Copyright(c) 2004, 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 AliFMDSDigitizer.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:38:26 2006 + @brief FMD Digitizers implementation + @ingroup FMD_sim +*/ +////////////////////////////////////////////////////////////////////////////// +// +// This class contains the procedures simulation ADC signal for the +// Forward Multiplicity detector : Hits->Digits and Hits->SDigits +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// +// As the Digits and SDigits have so much in common, the classes +// AliFMDDigitizer and AliFMDSDigitizer are implemented via a base +// class AliFMDBaseDigitizer. +// +// +---------------------+ +// | AliFMDBaseDigitizer | +// +---------------------+ +// ^ +// | +// +----------+---------+ +// | | +// +-----------------+ +------------------+ +// | AliFMDDigitizer | | AliFMDSDigitizer | +// +-----------------+ +------------------+ +// +// These classes has several paramters: +// +// fPedestal +// fPedestalWidth +// (Only AliFMDDigitizer) +// Mean and width of the pedestal. The pedestal is simulated +// by a Guassian, but derived classes my override MakePedestal +// to simulate it differently (or pick it up from a database). +// +// fVA1MipRange +// The dymamic MIP range of the VA1_ALICE pre-amplifier chip +// +// fAltroChannelSize +// The largest number plus one that can be stored in one +// channel in one time step in the ALTRO ADC chip. +// +// fSampleRate +// How many times the ALTRO ADC chip samples the VA1_ALICE +// pre-amplifier signal. The VA1_ALICE chip is read-out at +// 10MHz, while it's possible to drive the ALTRO chip at +// 25MHz. That means, that the ALTRO chip can have time to +// sample each VA1_ALICE signal up to 2 times. Although it's +// not certain this feature will be used in the production, +// we'd like have the option, and so it should be reflected in +// the code. +// +// +// The shaping function of the VA1_ALICE is generally given by +// +// f(x) = A(1 - exp(-Bx)) +// +// where A is the total charge collected in the pre-amp., and B is a +// paramter that depends on the shaping time of the VA1_ALICE circut. +// +// When simulating the shaping function of the VA1_ALICe +// pre-amp. chip, we have to take into account, that the shaping +// function depends on the previous value of read from the pre-amp. +// +// That results in the following algorithm: +// +// last = 0; +// FOR charge IN pre-amp. charge train DO +// IF last < charge THEN +// f(t) = (charge - last) * (1 - exp(-B * t)) + last +// ELSE +// f(t) = (last - charge) * exp(-B * t) + charge) +// ENDIF +// FOR i IN # samples DO +// adc_i = f(i / (# samples)) +// DONE +// last = charge +// DONE +// +// Here, +// +// pre-amp. charge train +// is a series of 128 charges read from the VA1_ALICE chip +// +// # samples +// is the number of times the ALTRO ADC samples each of the 128 +// charges from the pre-amp. +// +// Where Q is the total charge collected by the VA1_ALICE +// pre-amplifier. Q is then given by +// +// E S +// Q = - - +// e R +// +// where E is the total energy deposited in a silicon strip, R is the +// dynamic range of the VA1_ALICE pre-amp (fVA1MipRange), e is the +// energy deposited by a single MIP, and S ALTRO channel size in each +// time step (fAltroChannelSize). +// +// The energy deposited per MIP is given by +// +// e = M * rho * w +// +// where M is the universal number 1.664, rho is the density of +// silicon, and w is the depth of the silicon sensor. +// +// The final ADC count is given by +// +// C' = C + P +// +// where P is the (randomized) pedestal (see MakePedestal) +// +// This class uses the class template AliFMDMap to make an +// internal cache of the energy deposted of the hits. The class +// template is instantasized as +// +// typedef AliFMDMap > AliFMDEdepMap; +// +// The first member of the values is the summed energy deposition in a +// given strip, while the second member of the values is the number of +// hits in a given strip. Using the second member, it's possible to +// do some checks on just how many times a strip got hit, and what +// kind of error we get in our reconstructed hits. Note, that this +// information is currently not written to the digits tree. I think a +// QA (Quality Assurance) digit tree is better suited for that task. +// However, the information is there to be used in the future. +// +// +// Latest changes by Christian Holm Christensen +// +////////////////////////////////////////////////////////////////////////////// + +// /1 +// | A(-1 + B + exp(-B)) +// | f(x) dx = ------------------- = 1 +// | B +// / 0 +// +// and B is the a parameter defined by the shaping time (fShapingTime). +// +// Solving the above equation, for A gives +// +// B +// A = ---------------- +// -1 + B + exp(-B) +// +// So, if we define the function g: [0,1] -> [0:1] by +// +// / v +// | Bu + exp(-Bu) - Bv - exp(-Bv) +// g(u,v) = | f(x) dx = -A ----------------------------- +// | B +// / u +// +// we can evaluate the ALTRO sample of the VA1_ALICE pre-amp between +// any two times (u, v), by +// +// +// B Bu + exp(-Bu) - Bv - exp(-Bv) +// C = Q g(u,v) = - Q ---------------- ----------------------------- +// -1 + B + exp(-B) B +// +// Bu + exp(-Bu) - Bv - exp(-Bv) +// = - Q ----------------------------- +// -1 + B + exp(-B) +// + +#include // ROOT_TTree +//#include // ROOT_TRandom +#include // ALILOG_H +#include "AliFMDSDigitizer.h" // ALIFMDDIGITIZER_H +#include "AliFMD.h" // ALIFMD_H +#include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H +#include "AliFMDDetector.h" // ALIFMDDETECTOR_H +#include "AliFMDRing.h" // ALIFMDRING_H +#include "AliFMDHit.h" // ALIFMDHIT_H +#include "AliFMDDigit.h" // ALIFMDDIGIT_H +#include "AliFMDParameters.h" // ALIFMDPARAMETERS_H +#include // ALIRUNDIGITIZER_H +#include // ALIRUN_H +#include // ALILOADER_H +#include // ALIRUNLOADER_H + +//==================================================================== +ClassImp(AliFMDSDigitizer) + +//____________________________________________________________________ +AliFMDSDigitizer::AliFMDSDigitizer() +{ + // Default ctor - don't use it +} + +//____________________________________________________________________ +AliFMDSDigitizer::AliFMDSDigitizer(const Char_t* headerFile, + const Char_t* /* sdigfile */) + : AliFMDBaseDigitizer("FMDSDigitizer", "FMD SDigitizer") +{ + // Normal CTOR + AliDebug(1," processed"); + + fRunLoader = AliRunLoader::GetRunLoader(); // Open(headerFile); + if (!fRunLoader) + Fatal("AliFMDSDigitizer", "cannot open session, header file '%s'", + headerFile); + AliLoader* loader = fRunLoader->GetLoader("FMDLoader"); + if (!loader) + Fatal("AliFMDSDigitizer", "cannot find FMD loader in specified event"); + + // Add task to tasks folder + loader->PostSDigitizer(this); + +} + +//____________________________________________________________________ +AliFMDSDigitizer::~AliFMDSDigitizer() +{ + // Destructor + AliLoader* loader = fRunLoader->GetLoader("FMDLoader"); + loader->CleanSDigitizer(); +} + +//____________________________________________________________________ +void +AliFMDSDigitizer::Exec(Option_t*) +{ + // Get the output manager + if (!fRunLoader) { + Error("Exec", "Run loader is not set"); + return; + } + if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice(); + if (!fRunLoader->TreeE()) fRunLoader->LoadHeader(); + + AliLoader* fmdLoader = fRunLoader->GetLoader("FMDLoader"); + if (!fmdLoader) Fatal("Exec", "no FMD loader"); + + // Get the AliFMD object + AliFMD* fmd = + static_cast(fRunLoader->GetAliRun()->GetDetector("FMD")); + if (!fmd) { + AliError("Can not get FMD from gAlice"); + return; + } + + Int_t nEvents = Int_t(fRunLoader->TreeE()->GetEntries()); + for (Int_t event = 0; event < nEvents; event++) { + AliDebug(1,Form(" Digitizing event number %d", event)); + // Get the current loader + fRunLoader->GetEvent(event); + + if (!fmdLoader->TreeS()) fmdLoader->MakeTree("S"); + // Make a branch + fmd->MakeBranch("S"); + + // Cache contriutions + SumContributions(fmd); + + // Digitize the event + DigitizeHits(fmd); + + fmdLoader->TreeS()->Reset(); + fmdLoader->TreeS()->Fill(); + fmdLoader->WriteSDigits("OVERWRITE"); + } +} + +//____________________________________________________________________ +void +AliFMDSDigitizer::AddDigit(AliFMD* fmd, + UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + Float_t edep, + UShort_t count1, + Short_t count2, + Short_t count3) const +{ + // Add a summable digit + fmd->AddSDigitByFields(detector, ring, sector, strip, edep, + count1, count2, count3); +} + + + +//____________________________________________________________________ +// +// EOF +// + + + + diff --git a/FMD/AliFMDSDigitizer.h b/FMD/AliFMDSDigitizer.h new file mode 100644 index 00000000000..872c95327e6 --- /dev/null +++ b/FMD/AliFMDSDigitizer.h @@ -0,0 +1,90 @@ +#ifndef ALIFMDSDIGITIZER_H +#define ALIFMDSDIGITIZER_H +/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights + * reserved. + * + * See cxx source for full Copyright notice + */ +// Classses to make Hits into digits and summable digits. +// +// Digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - ADC count in this channel +// +// Summable digits consists of +// - Detector # +// - Ring ID +// - Sector # +// - Strip # +// - Total energy deposited in the strip +// - ADC count in this channel +// +/** @file AliFMDSDigitizer.h + @author Christian Holm Christensen + @date Mon Mar 27 12:38:26 2006 + @brief FMD Digitizers declaration + @ingroup FMD_sim +*/ +#ifndef ALIFMDBASEDIGITIZER_H +# include +#endif + +//==================================================================== +/** @class AliFMDSDigitizer AliFMDDigitizer.h + @brief Concrete implementation to make summable digits. + See also class documentation of AliFMDBaseDigitizer + @ingroup FMD_sim + */ +class AliFMDSDigitizer : public AliFMDBaseDigitizer +{ +public: + /** CTOR */ + AliFMDSDigitizer(); + /** CTOR + @param headerFile Where to write headings + @param sdigFile Where to write digits. */ + AliFMDSDigitizer(const Char_t* headerFile, const Char_t* sdigFile=""); + /** DTOR */ + virtual ~AliFMDSDigitizer(); + /** Do it all + @param option Not used */ + virtual void Exec(Option_t* option=0); +protected: + /** Add a digit to output. + @param fmd Pointer to detector object + @param detector Detector # + @param ring Ring ID + @param sector Sector number + @param strip Strip number + @param edep Energy deposited (not used) + @param count1 ADC count 1 + @param count2 ADC count 2 (-1 if not used) + @param count3 ADC count 3 (-1 if not used) */ + virtual void AddDigit(AliFMD* fmd, + UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + Float_t edep, + UShort_t count1, + Short_t count2, + Short_t count3) const; + ClassDef(AliFMDSDigitizer,0) // Make Summable Digits from Hits +}; + + + +#endif +//____________________________________________________________________ +// +// Local Variables: +// mode: C++ +// End: +// +// +// EOF +// + diff --git a/FMD/AliFMDUShortMap.h b/FMD/AliFMDUShortMap.h index 74add96c67c..5935aeac598 100644 --- a/FMD/AliFMDUShortMap.h +++ b/FMD/AliFMDUShortMap.h @@ -10,6 +10,9 @@ @date Mon Mar 27 12:48:18 2006 @brief Per strip of unisgned shorts (16 bit) data */ +// Map of an integer per strip +// This class stores one short unsigned integer (16 bits) per strip in +// the FMD detectors. #ifndef ALIFMDMAP_H # include "AliFMDMap.h" #endif diff --git a/FMD/AliFMDv1.cxx b/FMD/AliFMDv1.cxx index f7aeb7aec4f..e521452285f 100644 --- a/FMD/AliFMDv1.cxx +++ b/FMD/AliFMDv1.cxx @@ -18,6 +18,7 @@ @date Mon Mar 27 12:48:51 2006 @brief Concrete implementation of FMD detector driver - detailed version + @ingroup FMD_sim */ //____________________________________________________________________ // @@ -37,7 +38,7 @@ #include // ALIMC_H #include // ALILOG_H #include "AliFMDv1.h" // ALIFMDV1_H -#include "AliFMDGeometryBuilder.h" +// #include "AliFMDGeometryBuilder.h" #include "AliFMDGeometry.h" #include "AliFMDDetector.h" #include "AliFMDRing.h" @@ -57,6 +58,7 @@ Bool_t AliFMDv1::VMC2FMD(TLorentzVector& v, UShort_t& detector, Char_t& ring, UShort_t& sector, UShort_t& strip) const { + // Convert VMC coordinates to detector coordinates TVirtualMC* mc = TVirtualMC::GetMC(); AliFMDGeometry* fmd = AliFMDGeometry::Instance(); @@ -101,6 +103,7 @@ AliFMDv1::VMC2FMD(Int_t copy, TLorentzVector& v, UShort_t& detector, Char_t& ring, UShort_t& sector, UShort_t& strip) const { + // Convert VMC coordinates to detector coordinates TVirtualMC* mc = TVirtualMC::GetMC(); AliFMDGeometry* fmd = AliFMDGeometry::Instance(); @@ -157,6 +160,7 @@ Bool_t AliFMDv1::CheckHit(Int_t trackno, Int_t pdg, Float_t absQ, const TLorentzVector& p, Float_t edep) const { + // Check that a hit is good if (AliLog::GetDebugLevel("FMD", "AliFMD") < 5) return kFALSE; TVirtualMC* mc = TVirtualMC::GetMC(); Double_t mass = mc->TrackMass(); diff --git a/FMD/FMDutilLinkDef.h b/FMD/FMDutilLinkDef.h index 2cab0519a5c..2b9967ace9f 100644 --- a/FMD/FMDutilLinkDef.h +++ b/FMD/FMDutilLinkDef.h @@ -20,10 +20,6 @@ // #pragma link C++ class AliFMDMap >; // #pragma link C++ typedef AliFMDEdepMap; #pragma link C++ class AliFMDInput; -#pragma link C++ class AliFMDInputHits; -#pragma link C++ class AliFMDInputDigits; -#pragma link C++ class AliFMDInputSDigits; -#pragma link C++ class AliFMDInputRecPoints; #pragma link C++ class AliFMDDisplay; #pragma link C++ class AliFMDCalibFaker; #pragma link C++ class AliFMDAlignFaker; diff --git a/FMD/libFMDbase.pkg b/FMD/libFMDbase.pkg index 80559af7f7a..8323c1de527 100644 --- a/FMD/libFMDbase.pkg +++ b/FMD/libFMDbase.pkg @@ -3,7 +3,9 @@ # $Id$ SRCS = AliFMDIndex.cxx \ + AliFMDBaseDigit.cxx \ AliFMDDigit.cxx \ + AliFMDSDigit.cxx \ AliFMDBoolMap.cxx \ AliFMDUShortMap.cxx \ AliFMDCalibPedestal.cxx \ @@ -21,7 +23,7 @@ SRCS = AliFMDIndex.cxx \ # AliFMDAltroIO.cxx -HDRS = $(SRCS:.cxx=.h) +HDRS = $(SRCS:.cxx=.h) DHDR := FMDbaseLinkDef.h EINCLUDE := RAW diff --git a/FMD/libFMDsim.pkg b/FMD/libFMDsim.pkg index 14db01d3d67..8b62d8c4400 100644 --- a/FMD/libFMDsim.pkg +++ b/FMD/libFMDsim.pkg @@ -6,12 +6,15 @@ SRCS = AliFMD.cxx \ AliFMDv0.cxx \ AliFMDv1.cxx \ AliFMDGeometryBuilder.cxx \ + AliFMDPoints.cxx \ AliFMDHit.cxx \ + AliFMDBaseDigitizer.cxx \ AliFMDDigitizer.cxx \ + AliFMDSDigitizer.cxx \ AliFMDEdepMap.cxx \ AliFMDRawWriter.cxx \ -HDRS = $(SRCS:.cxx=.h) +HDRS = $(SRCS:.cxx=.h) AliFMDEdepHitPair.h DHDR := FMDsimLinkDef.h EINCLUDE := RAW