]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coding conventions (Christian)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Apr 2006 17:06:07 +0000 (17:06 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Apr 2006 17:06:07 +0000 (17:06 +0000)
69 files changed:
FMD/AliFMD.cxx
FMD/AliFMD.h
FMD/AliFMD1.cxx
FMD/AliFMD1.h
FMD/AliFMD2.cxx
FMD/AliFMD2.h
FMD/AliFMD3.cxx
FMD/AliFMD3.h
FMD/AliFMDAlignFaker.cxx
FMD/AliFMDAlignFaker.h
FMD/AliFMDAltroMapping.cxx
FMD/AliFMDAltroMapping.h
FMD/AliFMDBaseDigit.cxx [new file with mode: 0644]
FMD/AliFMDBaseDigit.h [new file with mode: 0644]
FMD/AliFMDBaseDigitizer.cxx [new file with mode: 0644]
FMD/AliFMDBaseDigitizer.h [new file with mode: 0644]
FMD/AliFMDCalibFaker.cxx
FMD/AliFMDCalibFaker.h
FMD/AliFMDCalibGain.cxx
FMD/AliFMDCalibGain.h
FMD/AliFMDCalibPedestal.cxx
FMD/AliFMDCalibPedestal.h
FMD/AliFMDCalibSampleRate.cxx
FMD/AliFMDCalibSampleRate.h
FMD/AliFMDCalibStripRange.cxx
FMD/AliFMDCalibStripRange.h
FMD/AliFMDDetector.cxx
FMD/AliFMDDetector.h
FMD/AliFMDDigit.cxx
FMD/AliFMDDigit.h
FMD/AliFMDDigitizer.cxx
FMD/AliFMDDigitizer.h
FMD/AliFMDDisplay.cxx
FMD/AliFMDDisplay.h
FMD/AliFMDEdepHitPair.h [new file with mode: 0644]
FMD/AliFMDEdepMap.cxx
FMD/AliFMDEdepMap.h
FMD/AliFMDGeometry.cxx
FMD/AliFMDGeometry.h
FMD/AliFMDGeometryBuilder.cxx
FMD/AliFMDGeometryBuilder.h
FMD/AliFMDHit.cxx
FMD/AliFMDHit.h
FMD/AliFMDIndex.cxx
FMD/AliFMDInput.cxx
FMD/AliFMDInput.h
FMD/AliFMDParameters.cxx
FMD/AliFMDParameters.h
FMD/AliFMDPoints.cxx [new file with mode: 0644]
FMD/AliFMDPoints.h [new file with mode: 0644]
FMD/AliFMDRawReader.cxx
FMD/AliFMDRawReader.h
FMD/AliFMDRawStream.cxx
FMD/AliFMDRawWriter.cxx
FMD/AliFMDRawWriter.h
FMD/AliFMDRecPoint.cxx
FMD/AliFMDReconstructor.cxx
FMD/AliFMDReconstructor.h
FMD/AliFMDRing.cxx
FMD/AliFMDRing.h
FMD/AliFMDSDigit.cxx [new file with mode: 0644]
FMD/AliFMDSDigit.h [new file with mode: 0644]
FMD/AliFMDSDigitizer.cxx [new file with mode: 0644]
FMD/AliFMDSDigitizer.h [new file with mode: 0644]
FMD/AliFMDUShortMap.h
FMD/AliFMDv1.cxx
FMD/FMDutilLinkDef.h
FMD/libFMDbase.pkg
FMD/libFMDsim.pkg

index fd95c4dc377c832cde5bf630bed368734cd7816a..1e73d4904e2a77d4831d714b274ce9872d20dad1 100644 (file)
@@ -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 <math.h>               // __CMATH__
+// #include <math.h>               // __CMATH__
 #include <TClonesArray.h>      // ROOT_TClonesArray
 #include <TGeometry.h>         // ROOT_TGeomtry
 #include <TNode.h>             // ROOT_TNode
 #include <TTUBE.h>             // ROOT_TTUBE
 #include <TTree.h>             // ROOT_TTree
 #include <TBrowser.h>          // ROOT_TBrowser
-#include <TMath.h>             // ROOT_TMath
-#include <TVirtualMC.h>                // ROOT_TVirtualMC
-#include <TVector2.h>
-#include <TVector3.h>
-#include <TMarker3DBox.h>
+// #include <TVirtualMC.h>     // ROOT_TVirtualMC
+#include <TVector2.h>           // ROOT_TVector2 
 
 #include <AliRunDigitizer.h>   // ALIRUNDIGITIZER_H
 #include <AliLoader.h>         // ALILOADER_H
 #include <AliRun.h>            // ALIRUN_H
 #include <AliMC.h>             // ALIMC_H
-#include "AliMagF.h"           // ALIMAGF_H
+#include <AliMagF.h>           // ALIMAGF_H
 #include <AliLog.h>            // 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.
index e2ca8d813e52f21af3572322d5cb0ffd6be382ca..513ef90b784cd80c4b6e5bbb17174671c17c83be 100644 (file)
 #ifndef ALIDETECTOR_H  
 # include <AliDetector.h>
 #endif
-#ifndef ROOT_TBranch
-# include <TBranch.h>
-#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
index 9718a2e725c679e0b91db19f92f6cacdafd30372..91f3e77eae64ccfdc86d104d13553f6e78fc7651 100644 (file)
@@ -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 
 
 
 //====================================================================
index 89395d00710c4197065464c16b5920d9f895f54e..a272e429e2f114da8c15f9f364b74571d19f4650 100644 (file)
@@ -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 <FMD/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
 */
index 9e05ea75f7f3ef4084171df699f223b8289d6d65..350c035988d134aab008d73e636367a7b7419bcd 100644 (file)
@@ -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)
index a4c30a5314097e04a686c3d04944fa0a98d56fab..19bfcc1fe0f8e50015e89031d1b049d2d44e8c9b 100644 (file)
@@ -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
 /** @class AliFMD2 AliFMD2.h <FMD/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);
index c422c2731a0242b8397619a63c962e7aad21368d..ecdab228bb1e0231811453ff851ba5b11b721bcd 100644 (file)
@@ -30,7 +30,7 @@
 #include "AliFMD3.h"           // ALIFMD3_H 
 #include "AliLog.h"            // ALILOG_H
 #include "AliFMDRing.h"                // ALIFMDRING_H 
-#include <TMath.h>             // ROOT_TMath
+// #include <TMath.h>          // ROOT_TMath
 
 //====================================================================
 ClassImp(AliFMD3)
index b81051c871b7ec04ce2ac09801dcbedb245a55e9..785dba99ead314b78720171c6a8d50468370d030 100644 (file)
@@ -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
index 7cfa1930cfc539b8f17eb1ceb6a3eb886405ee4c..6945074400f18354408b5f3921999939b1e44ad9 100644 (file)
     @brief   Implementation of AliFMDAlignFaker 
 */
 //____________________________________________________________________
+//
+//  Class 
+//  to 
+//  make 
+//  fake 
+//  alignment
+//  parameters 
+//
+//____________________________________________________________________
 //                                                                          
 // Forward Multiplicity Detector based on Silicon wafers. 
 //
 #include "AliFMDAlignFaker.h"      // ALIFMDALIGNFAKER_H
 #include <AliCDBManager.h>         // ALICDBMANAGER_H
 #include <AliCDBEntry.h>           // ALICDBMANAGER_H
-#include <AliAlignObj.h>
+// #include <AliAlignObj.h>
 #include <AliAlignObjAngles.h>
-#include <Riostream.h>
-#include <TSystem.h>
-#include <TMath.h>
+// #include <Riostream.h>
+// #include <TSystem.h>
+// #include <TMath.h>
 #include <TRandom.h>
 #include <TClonesArray.h>
 #include <TString.h>
 #include <TFile.h>
 #include <TGeoManager.h>
 #include <TGeoNode.h>
-#include <TGeoVolume.h>
-#include <TROOT.h>
+// #include <TGeoVolume.h>
+// #include <TROOT.h>
 
 //====================================================================
 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()));
index e819704270188db838fa4ff53f2d9243fa5f4301..ef6d90c44b0aace8e15cb0bfce1fa2ae143863cd 100644 (file)
 */
 //____________________________________________________________________
 //
-//  Class to make fake alignration parameters 
+//  Class 
+//  to 
+//  make 
+//  fake 
+//  alignment
+//  parameters 
 //
 #ifndef ROOT_TTask
 # include <TTask.h>
@@ -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 
index d0e9d89efb9e76532e4b0305670349e8adb9a235..e731f4645e03d601f3b7927b1b2deb8c3e314cd8 100644 (file)
 //                                                                          
 // 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"
index 1e4e56f4238f2565c2650f3c611dcf816498eca3..1f98aa39fdfbf9298d7c3cbcc46015f032598402 100644 (file)
 #ifndef ROOT_TArrayI
 # include <TArrayI.h>
 #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 (file)
index 0000000..f570eff
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @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 <TString.h>
+#include <AliLog.h>
+
+//====================================================================
+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<AliFMDBaseDigit*>(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 (file)
index 0000000..fe9b7e7
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef ALIFMDBASEDIGIT_H
+#define ALIFMDBASEDIGIT_H
+/** @file    AliFMDBaseDigit.h
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @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 <TObject.h>
+#endif
+#ifndef ROOT_TString
+# include <TString.h>
+#endif
+
+//____________________________________________________________________
+/** @class AliFMDBaseDigit AliFMDDigit.h <FMD/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 (file)
index 0000000..7eb02c9
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @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<Type> to make an
+// internal cache of the energy deposted of the hits.  The class
+// template is instantasized as 
+//
+//  typedef AliFMDMap<std::pair<Float_t, UShort_t> > 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 <TTree.h>             // ROOT_TTree
+//#include <TRandom.h>         // ROOT_TRandom
+#include <AliLog.h>            // 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>   // ALIRUNDIGITIZER_H
+//#include <AliRun.h>          // ALIRUN_H
+#include <AliLoader.h>         // ALILOADER_H
+#include <AliRunLoader.h>      // 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<AliFMDHit*>(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 (file)
index 0000000..86a188c
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @date    Mon Mar 27 12:38:26 2006
+    @brief   FMD Digitizers declaration
+    @ingroup FMD_sim
+*/
+#ifndef ALIDIGITIZER_H
+# include <AliDigitizer.h>
+#endif
+#ifndef ALIRUNDIGITIZER_H
+# include <AliRunDigitizer.h>
+#endif
+#ifndef ALIFMDEdepMAP_H
+# include "AliFMDEdepMap.h"
+#endif
+//====================================================================
+class TClonesArray;
+class AliFMD;
+class AliLoader;
+class AliRunLoader;
+class AliFMDDigit;
+
+
+//====================================================================
+/** @class AliFMDBaseDigitizer AliFMDDigitizer.h <FMD/AliFMDDigitizer>
+    @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
+//
+
index 491c506da5e08b03beea2501450c5fbeaec76a4c..d7491c9e0327ec4dbc777cd399fe63969cdd5da1 100644 (file)
@@ -17,6 +17,7 @@
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @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>         // ALICDBMANAGER_H
 #include <AliCDBEntry.h>           // ALICDBMANAGER_H
-#include <Riostream.h>
+//#include <Riostream.h>
 #include <TSystem.h>
-#include <TMath.h>
+// #include <TMath.h>
 #include <TROOT.h>
 #include <TRandom.h>
 
@@ -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;
 }
index e7c8edb2096427af5231d294a00dfa239cd624ab..72a664c212b096d4c0b4df8035a92b7a5d81ae99 100644 (file)
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @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 <TTask.h>
@@ -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)
 };
index 6f20ab63fd8f8e19446e831c63b4a5357e8bb5cb..831ed6c95db0d49a3e8431cda753e7a74d85d2ee 100644 (file)
 */
 //____________________________________________________________________
 //                                                                          
-//
+// 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);
 }
 
index 3607837301f07d263e98984e0a088e53df3945c6..e01ad78814f22da884a533c849b18995b144bb63 100644 (file)
     @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 <AliFMDFloatMap.h>
 #endif
index c985d257268327c8eb10b53f6834a3c282e9339f..b1a8c8f134543a9e27676c2f0bb9b2244a63ff78 100644 (file)
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @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);
 }
 
index 553397e6f66e8dbc6312a22cb1466d13650c4813..afb69f059f366eddfc4daeb1a79c3f83c5c4010a 100644 (file)
@@ -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 <cholm@nbi.dk>
     @date    Sun Mar 26 18:30:51 2006
     @brief   Per strip pedestal calibration 
+    @ingroup FMD_base
 */
 #ifndef ALIFMDFLOATMAP_H
 # include <AliFMDFloatMap.h>
index 5e51121d3c6ad97bd1c2a89d6a74f05173f2aea9..5ac341033e1a8b789033f1ee9fd732b3afc8660b 100644 (file)
 */
 //____________________________________________________________________
 //                                                                          
-//
+// 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)", 
index fbd3a34257c46b0bebad40eb4055757e92b95421..7719554c9c08689ee881523eea6a28c684f4b47b 100644 (file)
@@ -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 <cholm@nbi.dk>
     @date    Sun Mar 26 18:32:14 2006
     @brief   Per digitizer card pulser calibration
-    
+    @ingroup FMD_base    
 */
 #ifndef ROOT_TObject
 # include <TObject.h>
@@ -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 
 };
 
index f1edcb3936f8cb0696b0c1ccb2d2b9353dfe14da..4da7294d296bba1d608f21c0d105100fbe6b470b 100644 (file)
 */
 //____________________________________________________________________
 //                                                                          
-//
+// 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);
 }
 
 //____________________________________________________________________
index a02f7a790d581556feb138ab756635aa30478b09..943dd52ae198dac8d7e083f19ba232898bc8a5e4 100644 (file)
@@ -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 <cholm@nbi.dk>
     @date    Sun Mar 26 18:32:14 2006
     @brief   Per digitizer card pulser calibration
+    @ingroup FMD_base
 */
 #ifndef ROOT_TObject
 # include <TObject.h>
@@ -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 
 };
 
index 9be6505710789003dc994dd9f9013126dc599ca2..d23cf2d1fba0df881a1a5ea191102f7cdc7bae79 100644 (file)
@@ -17,6 +17,7 @@
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @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 <TGeoManager.h>       // ROOT_TGeoManager 
 #include <TGeoMatrix.h>                // ROOT_TGeoMatrix 
-#include <TMath.h>              // ROOT_TMath
+// #include <TMath.h>              // 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));
index 5654d6f5d04278f74b0b2f921fef2966d4ff1f7a..3740256fd96a0152527b36146a22862c9a281c0d 100644 (file)
@@ -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 <cholm@nbi.dk>
     @date    Mon Mar 27 12:36:27 2006
     @brief   Sub-detector base class declaration
+    @ingroup FMD_base
 */
 #ifndef ROOT_TNamed
 # include <TNamed.h>
index a2c9cc67c6396a1efed7316633bb32d3aa91d3a6..178ca82ef9f1640f39f27c5442d77c4b7a50b09f 100644 (file)
 #include "Riostream.h"         // ROOT_Riostream
 #include <TString.h>
 
-//====================================================================
-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
index 7994207235fa1a59f9dfdca414d40eeffc175b95..9bd96561c2901d64a34fb227f59fb653ca3f8e2e 100644 (file)
 //  AliFMDDigit     - Normal (smeared) digit             
 //  AliFMDSDigit    - Summable (non-smeared) digit             
 //
-#ifndef ROOT_TObject
-# include <TObject.h>
+#ifndef ALIFMDBASEDIGIT_H
+# include <AliFMDBaseDigit.h>
 #endif
 
-//____________________________________________________________________
-/** @class AliFMDBaseDigit AliFMDDigit.h <FMD/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 <FMD/AliFMDDigit.h>
     @brief class for digits 
@@ -127,65 +85,6 @@ AliFMDDigit::Count(size_t i) const
   return -1;
 }
 
-//____________________________________________________________________
-/** @class AliFMDSDigit AliFMDDigit.h <FMD/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
 //____________________________________________________________________
 //
index 61d79c95edaf26e89f93ee6df941238dbba5cc29..f68ee457c991de49f7fbc3ec2b8f6e80c1db93a0 100644 (file)
@@ -17,6 +17,7 @@
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @date    Mon Mar 27 12:38:26 2006
     @brief   FMD Digitizers implementation
+    @ingroup FMD_sim
 */
 //////////////////////////////////////////////////////////////////////////////
 //
 //
 
 #include <TTree.h>             // ROOT_TTree
-#include <TRandom.h>           // ROOT_TRandom
+//#include <TRandom.h>         // ROOT_TRandom
 #include <AliLog.h>            // ALILOG_H
 #include "AliFMDDigitizer.h"   // ALIFMDDIGITIZER_H
 #include "AliFMD.h"            // ALIFMD_H
 #include <AliLoader.h>         // ALILOADER_H
 #include <AliRunLoader.h>      // 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<AliFMDHit*>(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<AliFMD*>(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
index 10a369e4d230441767baecbfaf3792b001cab171..22ceced04bb6ca690ec45b7ee0df010f54213ae7 100644 (file)
@@ -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 <cholm@nbi.dk>
     @date    Mon Mar 27 12:38:26 2006
     @brief   FMD Digitizers declaration
+    @ingroup FMD_sim
 */
-#ifndef ALIDIGITIZER_H
-# include <AliDigitizer.h>
-#endif
-#ifndef ALIRUNDIGITIZER_H
-# include <AliRunDigitizer.h>
-#endif
-#ifndef ALIFMDEdepMAP_H
-# include "AliFMDEdepMap.h"
+#ifndef ALIFMDBASEDIGITIZER_H
+# include <AliFMDBaseDigitizer.h>
 #endif
-#ifndef __UTILITY__
-# include <utility>
-#endif
-// #ifndef ROOT_TArrayF
-// # include <TArrayF.h>
-// #endif
 
 //====================================================================
 class TClonesArray;
@@ -34,206 +40,6 @@ class AliRunLoader;
 class AliFMDDigit;
 
 
-//====================================================================
-/** @class AliFMDBaseDigitizer AliFMDDigitizer.h <FMD/AliFMDDigitizer>
-    @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 <FMD/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
 //____________________________________________________________________
index eae7fa0149953ebed6347c17831dc7366caf561d..4e6f93f196715f71ffb2b1e1429cf32d8f08fc2a 100644 (file)
 #include "AliFMDRecPoint.h"     // ALIFMDRECPOINT_H
 #include "AliFMDGeometry.h"    // ALIFMDGEOMETRY_H
 #include "AliFMDParameters.h"  // ALIFMDPARAMETERS_H
-#include <AliESDFMD.h>          // ALIESDFMD_H
+// #include <AliESDFMD.h>          // ALIESDFMD_H
 #include <AliLog.h>
 #include <TStyle.h>
-#include <TArrayF.h>
+// #include <TArrayF.h>
 #include <TMarker3DBox.h>
 #include <TGeoManager.h>
-#include <TMath.h>
+// #include <TMath.h>
 #include <TApplication.h>
 #include <TButton.h>
-#include <TParticle.h>
+// #include <TParticle.h>
 #include <TCanvas.h>
 #include <TView.h>
 #include <TVirtualX.h>
@@ -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);
index 3ace7ddc8d0098a04a653ec7f8d98875360f5782..19b627399721f73aba6b1b18d0605a4dd66907c6 100644 (file)
@@ -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 (file)
index 0000000..33bf406
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @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 <Rtypes.h>
+#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
+//
+
+
index ec7625ccd3be56f078302584d6d88251c0c8c3bf..aa8cd817bd8c376851a80bb9983331d99d4fbe96 100644 (file)
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @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
index 850f41628984956c683c4b65a3a731fd08861622..ec77f2b9fbb0c0c2119fbfb30a202d56954806d6 100644 (file)
@@ -9,42 +9,27 @@
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @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 <AliFMDEdepHitPair.h>
+#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:
index 7740c2b9c26bcd3ca6ddaa44a571f384d1ec90ba..b001ceb7ec4c9376065ebbd1b656d5475f0e7423 100644 (file)
 #include "AliRecPoint.h"       // ALIRECPOINT_H
 #include "AliLog.h"            // ALIRECPOINT_H
 #include <TVector3.h>           // ROOT_TVector3
-#include <TMatrix.h>            // ROOT_TMatrix
-#include <TParticle.h>          // ROOT_TParticle
+// #include <TMatrix.h>            // ROOT_TMatrix
+// #include <TParticle.h>          // ROOT_TParticle
 #include <Riostream.h>
 #include "AliFMDGeometryBuilder.h"
-#include <TArrayI.h>
+// #include <TArrayI.h>
 #include <TGeoManager.h>
 #include <TGeoVolume.h>
 #include <TGeoNode.h>
@@ -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;
index 90c3dc1f132ac106664ebcfa46a2d3e4898a4fbd..abb51cc6c8fabca46763e232fe7808741c1269f9 100644 (file)
@@ -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 
 };
 
 
index cdacecc57d3ce58c13555d4a174e2138d7cb3e23..6fc9a6a5de71fefcaefc0f58348773aff2d8e050 100644 (file)
 */
 //____________________________________________________________________
 //                                                                          
+// 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
 #include "AliLog.h"            // ALILOG_H
 #include <TGeoVolume.h>                // ROOT_TGeoVolume
 #include <TGeoTube.h>          // ROOT_TGeoTube
-#include <TGeoPcon.h>          // ROOT_TGeoPcon
-#include <TGeoMaterial.h>      // ROOT_TGeoMaterial
-#include <TGeoMedium.h>                // ROOT_TGeoMedium
+//#include <TGeoPcon.h>                // ROOT_TGeoPcon
+//#include <TGeoMaterial.h>    // ROOT_TGeoMaterial
+//#include <TGeoMedium.h>              // ROOT_TGeoMedium
 #include <TGeoXtru.h>          // ROOT_TGeoXtru
-#include <TGeoPolygon.h>       // ROOT_TGeoPolygon
+//#include <TGeoPolygon.h>     // ROOT_TGeoPolygon
 #include <TGeoTube.h>          // ROOT_TGeoTube
 #include <TGeoManager.h>       // ROOT_TGeoManager
 #include <TVector2.h>          // 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), 
index 2a77662d5f876742add1947dc2291eefa4f7c651..e6110dcbaa7c88f78dacd10d760e7549e2f7df12 100644 (file)
@@ -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 <cholm@nbi.dk>
     @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 */
index f2b1147cdfc9d032bf5919b6a7f22c4ab04cd732..e4a21a4b832b043f3088ca34555de32c194358a3 100644 (file)
@@ -17,6 +17,7 @@
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @date    Mon Mar 27 12:41:58 2006
     @brief   Hit in the FMD
+    @ingroup FMD_sim
 */
 //____________________________________________________________________
 //
 //  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 <TDatabasePDG.h>
-#include <TMath.h>
+// #include <TMath.h>
 #include <TString.h>
 
 //____________________________________________________________________
@@ -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);
index 0acc7778c000c563d95babd08542a003a2b0a4d6..ff18605e8258b20ce5b804bb175dd32cd808f735 100644 (file)
@@ -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 <cholm@nbi.dk>
     @date    Mon Mar 27 12:41:58 2006
     @brief   Hit in the FMD
+    @ingroup FMD_sim
 */
 //___________________________________________________________________
 //
index 799a3d3757adcb2b108c6b58da693c708dcb40bb..1c91261e812ae5c02a5e288036a3c61db6d22ad1 100644 (file)
@@ -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<const AliFMDObjIndex*>(o);
   if (!a) {
     Fatal("Compare", 
index 6fcba8f5d2159f069145e68eef4143f8fe0b18df..3189d46c54330bb1739d6f080274d25093f4b44a 100644 (file)
@@ -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 <AliESD.h>
@@ -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
 
 //____________________________________________________________________
 //
index 904283cf7f9f391cf47ecddd388dab41f9536de5..a3828c92392a5c15ff07f89fd2f711fb9313fc6d 100644 (file)
@@ -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 <cholm@nbi.dk>
     @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
 //____________________________________________________________________
 //
index 999ae96a424e36c249bb85a4a5e4ad6cf72c3c92..43ed7b7f8080cb4d8fbdb97a41200ce327a1e9e6 100644 (file)
@@ -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());
   }
index 0e50bc774be9ceec44c63075208446dce09a338f..3a465daae7d9f2f3538c96b170c44a8b160ba6b5 100644 (file)
@@ -7,17 +7,17 @@
  *
  * See cxx source for full Copyright notice                               
  */
-/** @file    AliFMDParameters.h
-    @author  Christian Holm Christensen <cholm@nbi.dk>
-    @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 <cholm@nbi.dk>
+    @date    Mon Mar 27 12:44:43 2006
+    @brief   Manager of FMD parameters
+*/
 #ifndef ROOT_TNamed
 # include <TNamed.h>
 #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 (file)
index 0000000..b64e620
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @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 <TMath.h>             // ROOT_TMath
+#include <TVector3.h>           // ROOT_TVector3
+#include <TMarker3DBox.h>       // 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 (file)
index 0000000..46a24f9
--- /dev/null
@@ -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 <cholm@nbi.dk>
+ *
+ * See cxx source for full Copyright notice                               
+ */
+/** @file    AliFMDPoints.h
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Tue Apr 11 12:35:31 2006
+    @brief   Specialised class for drawing hits in the FMD. 
+    @ingroup FMD_sim
+*/
+#ifndef ALIPOINTS_H
+# include <AliPoints.h>
+#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
+//
index 5e8c7ffda83fde7dbd991f68aec6f4c4edfd4332..3d565a47ad52303551e7ea620a6d19d6576c411f 100644 (file)
@@ -17,6 +17,7 @@
     @author  Christian Holm Christensen <cholm@nbi.dk>
     @date    Mon Mar 27 12:45:23 2006
     @brief   Class to read raw data 
+    @ingroup FMD_rec
 */
 //____________________________________________________________________
 //
 #include "AliRawReader.h"      // ALIRAWREADER_H 
 #include "AliFMDRawReader.h"   // ALIFMDRAWREADER_H 
 // #include "AliFMDAltroIO.h"  // ALIFMDALTROIO_H 
-#include <TArrayI.h>           // ROOT_TArrayI
+// #include <TArrayI.h>                // ROOT_TArrayI
 #include <TTree.h>             // ROOT_TTree
 #include <TClonesArray.h>      // ROOT_TClonesArray
-#include <iostream>
-#include <iomanip>
-#include <sstream>
-#define PRETTY_HEX(N,X) \
-  "  0x" << std::setfill('0') << std::setw(N) << std::hex << X \
-         << std::setfill(' ') << std::dec
+// #include <iostream>
+// #include <iomanip>
 
 //____________________________________________________________________
 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");
index 483a5a8d9ed3622cb093001554cb9ddc938097f5..f7b43333ff58b070e9651e9aa2fa33329ee88f23 100644 (file)
@@ -7,18 +7,19 @@
  *
  * See cxx source for full Copyright notice                               
  */
-/* $Id$ */
-/** @file    AliFMDRawReader.h
-    @author  Christian Holm Christensen <cholm@nbi.dk>
-    @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 <cholm@nbi.dk>
+    @date    Mon Mar 27 12:45:23 2006
+    @brief   Class to read raw data 
+    @ingroup FMD_rec
+*/
 #ifndef ROOT_TTask
 # include <TTask.h>
 #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)
index 7c47e9591b704c83df5d060c6e50f2d9eed9d3f0..8fc23a9f0048921022141f0aa5811d47ef3ab05c 100644 (file)
 // and the sample rate should be set explicitly. 
 //
 #include "AliFMDRawStream.h"           // ALIFMDRAWSTREAM_H
-#include <AliRawReader.h>              // ALIRAWREADER_H
+// #include <AliRawReader.h>           // ALIRAWREADER_H
 #include "AliFMDParameters.h"
 #include <AliLog.h>
-#include <iomanip>
-#include <iostream>
+// #include <iomanip>
+// #include <iostream>
 
 //____________________________________________________________________
 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;
index 9b3cbadfca011a059f316a1b06fadce219c38788..e607c323327c6be919d4f6c0ec9388b62411ff51 100644 (file)
@@ -47,7 +47,7 @@
 // #include "AliFMDAltroIO.h"   // ALIFMDALTROWRITER_H
 #include <TArrayI.h>           // ROOT_TArrayI
 #include <TClonesArray.h>      // ROOT_TClonesArray
-#include <fstream>
+// #include <fstream>
 
 //____________________________________________________________________
 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;
 
index 35e25538b01ede4838a4b8b74d8002d1df96996a..e0b4e34cf4059696a56a419eaefbb00264275ccd 100644 (file)
@@ -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 
index cea8f0730e3e63ebc1209109e94dc1f61d1bd6b6..989b5128e87acb00aa59697d4e1df0b3961c6af7 100644 (file)
@@ -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();
index 620aa22e42096373e8127e4f90c6f7010a44b8a1..788655eb71a585dd0ccdf3a3783991ccb24e78ca 100644 (file)
@@ -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
 #include <AliLog.h>                        // ALILOG_H
 #include <AliRun.h>                        // ALIRUN_H
 #include <AliRunLoader.h>                  // ALIRUNLOADER_H
-#include <AliLoader.h>                     // ALILOADER_H
 #include <AliHeader.h>                     // ALIHEADER_H
-#include <AliRawReader.h>                  // ALIRAWREADER_H
 #include <AliGenEventHeader.h>             // 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>                    // ALIESDFMD_H
-#include <TFile.h>
+class AliRawReader;
 
 //____________________________________________________________________
 ClassImp(AliFMDReconstructor)
index dac28d63614df0742e9121c35f139f24723fbec5..22b3b1ef5d62471c0a01c452d689e60160f8880f 100644 (file)
@@ -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
 }; 
index b887b4b6f8f4ffddfc5440d84c22ede2e293edda..da598669999b1123c9fb0507fbed2431ddf1f300 100644 (file)
@@ -30,9 +30,9 @@
 // Latest changes by Christian Holm Christensen
 //
 
-#include <AliLog.h>            // ALILOG_H
+// #include <AliLog.h>         // ALILOG_H
 #include "AliFMDRing.h"                // ALIFMDRING_H
-#include <TMath.h>             // ROOT_TMath
+// #include <TMath.h>          // ROOT_TMath
 #include <TVector2.h>          // ROOT_TVector2
 
 //====================================================================
index ad39893de4a0bbcaee5b3cc748f766f3d7ab573d..10790311565ab7860a0e923e7d7a06327165953b 100644 (file)
@@ -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 (file)
index 0000000..b7773b3
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @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 <TString.h>
+
+//====================================================================
+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 (file)
index 0000000..2beb6c9
--- /dev/null
@@ -0,0 +1,86 @@
+#ifndef ALIFMDSDIGIT_H
+#define ALIFMDSDIGIT_H
+/** @file    AliFMDSDigit.h
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @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 <AliFMDBaseDigit.h>
+#endif
+//____________________________________________________________________
+/** @class AliFMDSDigit AliFMDDigit.h <FMD/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 (file)
index 0000000..70c4ca3
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @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<Type> to make an
+// internal cache of the energy deposted of the hits.  The class
+// template is instantasized as 
+//
+//  typedef AliFMDMap<std::pair<Float_t, UShort_t> > 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 <TTree.h>             // ROOT_TTree
+//#include <TRandom.h>         // ROOT_TRandom
+#include <AliLog.h>            // 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>   // ALIRUNDIGITIZER_H
+#include <AliRun.h>            // ALIRUN_H
+#include <AliLoader.h>         // ALILOADER_H
+#include <AliRunLoader.h>      // 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<AliFMD*>(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 (file)
index 0000000..872c953
--- /dev/null
@@ -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 <cholm@nbi.dk>
+    @date    Mon Mar 27 12:38:26 2006
+    @brief   FMD Digitizers declaration
+    @ingroup FMD_sim
+*/
+#ifndef ALIFMDBASEDIGITIZER_H
+# include <AliFMDBaseDigitizer.h>
+#endif
+
+//====================================================================
+/** @class AliFMDSDigitizer AliFMDDigitizer.h <FMD/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
+//
+
index 74add96c67c3ba3d2f89f9f6e779c031ab61f89e..5935aeac598ef671cbf764cf1e71a55f536128b2 100644 (file)
@@ -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 
index f7aeb7aec4ff34e365b4683cf5f4417c62649bb0..e521452285fb92b447663cabba90922737c89d13 100644 (file)
@@ -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>             // ALIMC_H
 #include <AliLog.h>            // 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();
index 2cab0519a5caf8f2edd1218f55033c7905c89586..2b9967ace9f154fd44de3147ad4a948639a06443 100644 (file)
 // #pragma link C++ class  AliFMDMap<std::pair<Float_t,UShort_t> >;
 // #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;
index 80559af7f7abf06e800ec7af16ab30a8dde4a46e..8323c1de527d5ae1fa2c3274305e21fae20a70ec 100644 (file)
@@ -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
index 14db01d3d679a2144f795923dcf7ebc4cd092f15..8b62d8c44000089806df0cfaf32e29022e45db05 100644 (file)
@@ -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