Added docs and fixed a bug
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Nov 2004 09:12:23 +0000 (09:12 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 Nov 2004 09:12:23 +0000 (09:12 +0000)
21 files changed:
FMD/AliFMDMult.cxx
FMD/AliFMDMult.h
FMD/AliFMDMultAlgorithm.cxx
FMD/AliFMDMultNaiive.cxx
FMD/AliFMDMultPoisson.cxx
FMD/AliFMDMultRegion.cxx
FMD/AliFMDMultRegion.h
FMD/AliFMDMultStrip.cxx
FMD/AliFMDMultStrip.h
FMD/AliFMDRawReader.cxx
FMD/AliFMDRawReader.h
FMD/AliFMDRawStream.cxx
FMD/AliFMDRawWriter.cxx
FMD/AliFMDRawWriter.h
FMD/AliFMDReconstructor.cxx
FMD/AliFMDSubDetector.cxx
FMD/AliFMDSubDetector.h
FMD/AliFMDUShortMap.cxx
FMD/Config.C
FMD/Simulate.C
FMD/ViewFMD.C

index 4efb3808442ffab412839ca4fc5bb350039119a0..7b805fc78e572a40bfb8b13399ae1abef327cefe 100644 (file)
 
 //____________________________________________________________________
 //
-//  Forward Multiplicity Detector have to be reconstructed number of
-//  particles in fixed pseudorapidity interval from fNumOfMinRing
-//  to fNumOfMaxRing and phi interval from fNumOfMinSector to
-//  fNumOfMaxSector
+// Base class for reconstructed charged particle multiplicty in the
+// FMD.  The class contains the field fMethod which is a flag set by
+// the AliFMDMultAlgorithm that created the object. The flag tells us
+// which algorithm was used to create the data stored in the object. 
 //
 #include "AliFMDMult.h"                // ALIFMDMULT_H
 #include <TString.h>            // ROOT_TString 
index 9b716572c2c04f4d1bea960e3d427959e9eebecb..ec4353741bcb687a666619998d96563d0e64e9fd 100644 (file)
@@ -20,9 +20,11 @@ public:
   AliFMDMult(Float_t  particles=0, UShort_t method=kNaiive);
   virtual ~AliFMDMult() {};
 
-  Float_t      Particles() const { return fParticles; }
-  UShort_t     Method()    const { return fMethod; }
-  virtual void Print(Option_t* opt="") const;
+  Float_t         Particles() const { return fParticles; }
+  UShort_t        Method()    const { return fMethod; }
+  virtual Float_t Eta() const = 0;
+  virtual Float_t Phi() const = 0;
+  virtual void    Print(Option_t* opt="") const;
 protected:
   Float_t  fParticles;       // Number of particles 
   UShort_t fMethod;          // Method use to get fParticles
index 7c8c77871d50a6fef7781d8a693f85cab0aa040f..5e1c0a8c024ff8f14a1282d7f0bee7900abb8f6e 100644 (file)
 // Derived classes will implement various ways of reconstructing the
 // charge particle multiplicity in the FMD.  
 // 
+//      +---------------------+       +---------------------+
+//      | AliFMDReconstructor |<>-----| AliFMDMultAlgorithm |
+//      +---------------------+       +---------------------+
+//                                               ^
+//                                               |
+//                                   +-----------+---------+
+//                                   |                     |
+//                         +-------------------+   +------------------+
+//                         | AliFMDMultPoisson |   | AliFMDMultNaiive |
+//                         +-------------------+   +------------------+
+//
+// AliFMDReconstructor acts as a manager class.  It contains a list of
+// AliFMDMultAlgorithm objects.  The call graph looks something like 
+//
+//
+//       +----------------------+            +----------------------+
+//       | :AliFMDReconstructor |            | :AliFMDMultAlgorithm |
+//       +----------------------+            +----------------------+
+//                  |                                  |
+//    Reconstruct  +-+                                 |
+//    ------------>| |                         PreRun +-+
+//                 | |------------------------------->| |   
+//                 | |                                +-+
+//                 | |-----+ (for each event)          |
+//                 | |     | *ProcessEvent             |
+//                 |+-+    |                           |
+//                 || |<---+                 PreEvent +-+
+//                 || |------------------------------>| |      
+//                 || |                               +-+
+//                 || |-----+                          |
+//                 || |     | ProcessDigits            |
+//                 ||+-+    |                          |
+//                 ||| |<---+                          |
+//                 ||| |         *ProcessDigit(digit) +-+
+//                 ||| |----------------------------->| |
+//                 ||| |                              +-+
+//                 ||+-+                               |
+//                 || |                     PostEvent +-+
+//                 || |------------------------------>| |
+//                 || |                               +-+
+//                 |+-+                                |
+//                 | |                        PostRun +-+
+//                 | |------------------------------->| |
+//                 | |                                +-+
+//                 +-+                                 |
+//                  |                                  |
+//
+//
 #include "AliFMDMultAlgorithm.h"       // ALIFMDMULTALGORITHM_H
 #include "AliFMDDigit.h"               // ALIFMDDIGIT_H
 #include <TClonesArray.h>               // ROOT_TClonesArray
index 2d9baa7d35c0451c339f6e38c7b85c11035ae39b..0cb45798cc713fb1b01cc81149f59e8827f208b5 100644 (file)
 
 //____________________________________________________________________
 // 
-// Base class for FMD naiive algorithms. 
-//
-// Derived classes will implement various ways of reconstructing the
-// charge particle multiplicity in the FMD.  
+// Reconstruct charged particle multiplicity in the FMD 
+// 
+// [See also the AliFMDReconstructor class]
+// 
+// This class reconstructs the multiplicity based on the assumption
+// that all particles are minimum ionizing. 
 // 
 #include "AliFMD.h"                    // ALIFMD_H
 #include "AliFMDMultNaiive.h"          // ALIFMDMULTNAIIVE_H
@@ -47,7 +49,7 @@ AliFMDMultNaiive::PreRun(AliFMD* fmd)
   // Initialise before a run 
   AliFMDMultAlgorithm::PreRun(fmd);
   fEdepMip = fmd->GetEdepMip();
-  fGain = (fmd->GetVA1MipRange() / fmd->GetAltroChannelSize() 
+  fGain = (Float_t(fmd->GetVA1MipRange()) / fmd->GetAltroChannelSize() 
           * fEdepMip);
 }
 
@@ -99,14 +101,16 @@ AliFMDMultNaiive::ProcessDigit(AliFMDDigit* digit,
   if (!digit) return;
   Double_t edep  = Adc2Energy(digit, eta, count);
   Double_t mult  = Energy2Multiplicity(digit, edep);
-
-  new ((*fMult)[fNMult]) AliFMDMultStrip(digit->Detector(), 
-                                        digit->Ring(), 
-                                        digit->Sector(),
-                                        digit->Strip(),
-                                        eta, phi, 
-                                        edep, mult, 
-                                        AliFMDMult::kNaiive);
+  
+  AliFMDMultStrip* m = 
+    new ((*fMult)[fNMult]) AliFMDMultStrip(digit->Detector(), 
+                                          digit->Ring(), 
+                                          digit->Sector(),
+                                          digit->Strip(),
+                                          eta, phi, 
+                                          edep, mult,
+                                  AliFMDMult::kNaiive);
+  (void)m;
   fNMult++;
 }
 //____________________________________________________________________
index 37e08a811fdeb0c0ad21b2b83a132a78a128fb42..94857b0b43fd90a0a624228bc903ec8deffbbd83 100644 (file)
 
 //____________________________________________________________________
 // 
-// Base class for FMD poisson algorithms. 
-//
-// Derived classes will implement various ways of reconstructing the
-// charge particle multiplicity in the FMD.  
+// Reconstruct charged particle multiplicity in the FMD 
+// 
+// [See also the AliFMDReconstructor class]
 // 
+// This class reconstructs the muliplicity in regions based on the
+// ratio of empty to full strips. 
+//
 #include "AliFMD.h"                    // ALIFMD_H
 #include "AliFMDMultPoisson.h"         // ALIFMDMULTPOISSON_H
 #include "AliFMDMultRegion.h"          // ALIFMDMULTREGION_H
@@ -187,11 +189,12 @@ AliFMDMultPoisson::PostEvent()
          Int_t reconstructed = Int_t(lambda * nTotal + 0.5);
            
          // Add a AliFMDMultRegion to the reconstruction tree. 
-         new((*fMult)[fNMult])   
+         AliFMDMultRegion* m = new((*fMult)[fNMult])   
            AliFMDMultRegion(sub->GetId(), r->GetId(),
                             minSector, maxSector, minStrip, maxStrip,
                             minEta, maxEta, minPhi, maxPhi,
                             reconstructed, AliFMDMultRegion::kPoission);
+         (void)m;
          fNMult++;
        } // phi 
       } // eta
index d7c98eb16e9a0a41b0a0be6432b9b9f5eb6c6c0a..0d171b781fd74d1aa33b0534d3117308eb9bebf5 100644 (file)
 
 //____________________________________________________________________
 //
-//  Forward Multiplicity Detector have to be reconstructed number of
-//  particles in fixed pseudorapidity interval from fNumOfMinRing
-//  to fNumOfMaxRing and phi interval from fNumOfMinSector to
-//  fNumOfMaxSector
+// FMD reconstructed multiplicity in a region of a ring.  The region
+// is identified by (strip_min,sector_min)x(strip_max,sector_max) or
+// by (eta_max,phi_min),(eta_min,phi_max).   It's also possible to
+// get the peudorapidity of the center-of-mass of the region, as well
+// as the mean azimuthal angle.
+//
+// [Note, that minStrip corresponds to maxEta, and maxStrip
+// corresponds to minEta]
+// 
+// These objects are usually created by the Poisson reconstruction
+// method. 
 //
 #include "AliFMDMultRegion.h"  // ALIFMDPARTICLES_H
 #include <TString.h>            // ROOT_TString
@@ -64,7 +71,71 @@ AliFMDMultRegion::AliFMDMultRegion(UShort_t detector,  Char_t ring,
     fMaxPhi(maxPhi)
 {}
 
+//____________________________________________________________________
+Float_t
+AliFMDMultRegion::Eta() const 
+{
+  // Return the center-of-mass eta of the region.   This is calculated
+  // as the weighted mean of min and max eta, where the weights are
+  // the length of the arcs of the upper and lower edge of the region: 
+  // 
+  //            (maxPhi - minPhi)
+  //  f       = -----------------
+  //                   360     
+  //
+  //  w_max   = ds*minStrip*2*pi*f
+  //                                   
+  //  w_min   = ds*maxStrip*2*pi*f
+  // 
+  //  1/w^2   = 1/w_max^2 + 1/w_min^2 
+  //
+  //                      1                        1         
+  //          = ---------------------- + ----------------------
+  //            (ds*minStrip*2*pi*f)^2  (ds*maxStrip*2*pi*f)^2
+  // 
+  //            (ds*maxStrip*2*pi*f)^2 + (ds*minStrip*2*pi*f)^2
+  //          = -----------------------------------------------
+  //            (ds*maxStrip*2*pi*f)^2 * (ds*minStrip*2*pi*f)^2
+  //
+  //          
+  //             4 * pi^2 * ds^2 * f^2 (maxStrip^2  + minStrip^2)
+  //          = -------------------------------------------------
+  //             16 * pi^4 * ds^4 * f^4 minStrip^2 * maxStrip^2 
+  //
+  //                     (maxStrip^2  + minStrip^2)
+  //          = -------------------------------------------------
+  //             4 * pi^2 * ds^2 * f^2 minStrip^2 * maxStrip^2 
+  //
+  //  <eta> = (maxEta/w_max^2 + minEta /w_min^2) / (1/w^2)
+  //      
+  //           w_min^2 * maxEta + w_max^2 * minEta
+  //        = ------------------------------------ / (1/w^2)
+  //                  w_max^2 * w_min^2
+  // 
+  //           4*pi^2*ds^2*(maxStrip*maxEta + minStrip*minEta)
+  //        =  ----------------------------------------------- / (1/w^2)
+  //               16*pi^4*ds^4*f^4*minStrip^2*maxStrip^2 
+  //
+  //           maxStrip * maxEta + minStrip * minEta   
+  //        =  ------------------------------------- 
+  //           4*pi^2*ds^2*f^2*minStrip^2*maxStrip^2 
+  //
+  //               4*pi^2*ds^2*f^2*minStrip^2*maxStrip^2
+  //             * -------------------------------------                 
+  //                    maxStrip^2+minStrip^2            
+  // 
+  //           maxStrip * maxEta + minStrip * minEta   
+  //        =  ------------------------------------- 
+  //                  maxStrip^2 + minStrip^2
+  //                                                     _
+  //                                                    |_|
+  //
+  Float_t eta = (fMaxStrip * fMaxEta + fMinStrip * fMinEta) 
+    / (fMaxStrip * fMaxStrip + fMinStrip * fMinStrip);
+  return eta;
+}
 
+  
 //____________________________________________________________________
 void
 AliFMDMultRegion::Print(Option_t* option) const
@@ -79,13 +150,11 @@ AliFMDMultRegion::Print(Option_t* option) const
   //    P:           Phi range (default)
   //
   TString opt(option);
-  cout << "FMD Reconstructed particles: " << fParticles << endl;
+  cout << "FMD Multiplicity in a region: " << fParticles << endl;
   if (opt.Contains("D", TString::kIgnoreCase))
-    cout << "  Detector:      FMD" << fDetector << fRing << endl;
-  if (opt.Contains("S", TString::kIgnoreCase))
-    cout << "  Sector range:  [" << fMinSector << "," << fMaxSector << endl;
-  if (opt.Contains("T", TString::kIgnoreCase))
-    cout << "  Strip range:   [" << fMinStrip << "," << fMaxStrip << endl;
+    cout << "  Detector:      FMD" << fDetector << fRing 
+        << "[" << fMinSector << "-" << fMaxSector 
+        << "," <<  fMinStrip << "-" << fMaxStrip << "]" << endl;
   if (opt.Contains("E", TString::kIgnoreCase))
     cout << "  Eta range:     [" << fMinEta << "," << fMaxEta << endl;
   if (opt.Contains("P", TString::kIgnoreCase))
index 67e394a4f56f29b095482af52977b3157c5bbe81..74359f6678ae2c0e19a95324962f3505686cc8bf 100644 (file)
@@ -23,6 +23,8 @@ public:
 
   UShort_t     Detector() const        { return fDetector; }
   Char_t       Ring() const            { return fRing; }
+  Float_t      Eta() const;
+  Float_t      Phi() const             { return (fMaxPhi + fMinPhi) / 2; }  
   UShort_t     MinSector() const       { return fMinSector; }
   UShort_t     MaxSector() const       { return fMaxSector; }
   UShort_t     MinStrip() const        { return fMinStrip; }
@@ -31,7 +33,7 @@ public:
   Float_t      MaxEta() const          { return fMaxEta; }
   Float_t      MinPhi() const          { return fMinPhi; }
   Float_t      MaxPhi() const          { return fMaxPhi; }
-  virtual void Print(Option_t* opt="") const;
+  virtual void Print(Option_t* opt="EP") const;
 protected:
   UShort_t fDetector;        // Detector #
   Char_t   fRing;            // Ring ID
index 976f595194aa8d7b8ac91ce1faebcfeace145ba7..10f7831c1dd382313dfdd65b5a289cc719e1b581 100644 (file)
 
 //____________________________________________________________________
 //
-//  Forward Multiplicity Detector have to be reconstructed number of
-//  particles in fixed pseudorapidity interval from fNumOfMinRing
-//  to fNumOfMaxRing and phi interval from fNumOfMinSector to
-//  fNumOfMaxSector
+//  FMD reconstructed multiplicity in a strip.   It contains the
+//  information of which strip in what sector of what ring, in which
+//  detector the information belongs, as well as the pseudo-rapidity,
+//  and azimuthal angle the strip had in the event.  Note, that this
+//  may change when the interaction points z--coordinate changes
+//  (which it probably will - experience from RHIC says so).  Also,
+//  the reconstructed energy deposited is stored. 
+//
 //
 #include "AliFMDMultStrip.h"   // ALIFMDMULTSTRIP_H
 #include <TString.h>            // ROOT_TString
@@ -70,7 +74,7 @@ AliFMDMultStrip::Print(Option_t* option) const
   //    P:           Phi range (default)
   //
   TString opt(option);
-  cout << "FMD Reconstructed particles: " << fParticles << endl;
+  cout << "FMD Multiplicity in a strip: " << fParticles << endl;
   if (opt.Contains("D", TString::kIgnoreCase))
     cout << "  Detector:      FMD" << fDetector << fRing 
         << "[" << fSector << "," << fStrip << "]" << endl;
index 341fef3c694caa958688ff4605edaacd62063354..a2affc96195ba44e52cb8e9c0813858d746dc72d 100644 (file)
@@ -27,7 +27,7 @@ public:
   Float_t      Eta() const             { return fEta; }
   Float_t      Phi() const             { return fPhi; }
   Float_t      Edep() const            { return fEdep; }
-  virtual void Print(Option_t* opt="") const;
+  virtual void Print(Option_t* opt="D") const;
 protected:
   UShort_t fDetector;        // Detector #
   Char_t   fRing;            // Ring ID
index 08b08a26ccca13b535ee0c09205b5501ff02b456..95bfb86cb56d00c3815ec763cfd030eba87369d9 100644 (file)
 //
 // Class to read ADC values from a AliRawReader object. 
 //
+// This class uses the AliFMDRawStreamer class to read the ALTRO
+// formatted data. 
+// 
+//          +-------+
+//          | TTask |
+//          +-------+
+//              ^
+//              |
+//      +-----------------+  <<references>>  +--------------+
+//      | AliFMDRawReader |<>----------------| AliRawReader |
+//      +-----------------+                  +--------------+
+//              |                                  ^
+//              | <<uses>>                         |
+//              V                                  |
+//      +-----------------+      <<uses>>          |
+//      | AliFMDRawStream |------------------------+
+//      +-----------------+
+//              |
+//              V
+//      +----------------+
+//      | AliAltroStream |
+//      +----------------+
+//
 #include <AliLog.h>            // ALILOG_H
 #include "AliFMD.h"            // ALIFMD_H
 #include "AliFMDDigit.h"       // ALIFMDDIGIT_H
index d2a086ccbec8d2ce84982be487ea09dba245cb16..60ad7d88e2e6cbb38da21d2f7bd5936fb68e7d5f 100644 (file)
@@ -12,7 +12,6 @@
 // 
 // Class to read ADC values from a AliRawReader object. 
 // 
-
 #ifndef ROOT_TTask
 # include <TTask.h>
 #endif
index d698fbcdd530f45638e6637172686aa68e149b84..52cecef7cb71524ca39f99e97059423e87af2b8f 100644 (file)
 //                                                                          
 // Buffer to read RAW ALTRO FMD format from a AliRawReader 
 // 
+// This class derives from AliAltroBuffer, but overloads the memer
+// function Next to do some extra processing.  In particular, it tries
+// to autodetect the sample rate.  If zero-suppression was used when
+// writing the raw data, then the automatic discovery will not work,
+// and the sample rate should be set explicitly. 
 //
 #include "AliFMDRawStream.h"           // ALIFMDRAWSTREAM_H
 #include <AliRawReader.h>              // ALIRAWREADER_H
index 97b7352fd289bace6542cfc63e9d6997691ec85b..bdc65a44fdeab77c7cd03d0e966974739a95f3ab 100644 (file)
 //
 // Class to write ADC values to a raw data file
 //
+// This class writes FMD Raw data to a file.   The sample rate (number
+// of times the ALTRO ADC samples each pre-amp. channel - that is,
+// data from a single strip), can be set via SetSampleRate. 
+//
+// Zero-suppression can be enabled by calling SetThreshold with a
+// non-zero argument.   ADC values less than the value set will not be
+// written to output.   Note, that if you use zero-suppression, you
+// need to explicitly set the sample rate when reading back the data
+// with AliFMDRawReader. 
+// 
+// This class uses the AliAltroBuffer class to write the data in the
+// ALTRO format.  See the Exec member function for more information on
+// that format.  
+//
 #include <AliLog.h>            // ALILOG_H
 #include <AliLoader.h>         // ALILOADER_H
 #include <AliAltroBuffer.h>     // ALIALTROBUFFER_H
@@ -37,6 +51,8 @@ AliFMDRawWriter::AliFMDRawWriter(AliFMD* fmd)
     fFMD(fmd)
 {
   SetSampleRate();
+  SetThreshold();
+  SetChannelsPerAltro();
 }
 
 
@@ -141,7 +157,7 @@ AliFMDRawWriter::Exec(Option_t*)
 
     // A buffer to hold 1 ALTRO channel - Normally, one ALTRO channel
     // holds 128 VA1_ALICE channels, sampled at a rate of `sampleRate' 
-    TArrayI channel(128 * sampleRate);
+    TArrayI channel(fChannelsPerAltro * sampleRate);
     
     // The Altro buffer 
     AliAltroBuffer* altro = 0;
@@ -178,10 +194,7 @@ AliFMDRawWriter::Exec(Option_t*)
          //    row       |     sector
          //    sector    |       ring
          // 
-         altro->WriteChannel(Int_t(startStrip), 
-                             Int_t(prevSector), 
-                             Int_t((prevRing == 'I' ? 0 : 1)), 
-                             channel.fN, channel.fArray, 0);
+         WriteChannel(altro, startStrip, prevSector, prevRing, channel);
          altro->Flush();
          altro->WriteDataHeader(kFALSE, kFALSE);
          delete altro;
@@ -212,27 +225,24 @@ AliFMDRawWriter::Exec(Option_t*)
          if (digit->Count3() >= 0) sampleRate = 3;
        }
 
-       channel.Set(128 * sampleRate);
+       channel.Set(fChannelsPerAltro * sampleRate);
        offset     = 0;
        prevRing   = ring;
        prevSector = sector;
        startStrip = strip;
       }
-      else if (offset == 128                        
+      else if (offset == fChannelsPerAltro
               || digit->Ring() != prevRing 
               || digit->Sector() != prevSector) {
        // Force a new Altro channel
        AliDebug(10, Form("Flushing channel to disk because %s",
-                         (offset == 128 ? "channel is full" :
+                         (offset == fChannelsPerAltro ? "channel is full" :
                           (ring != prevRing ? "new ring up" :
                            "new sector up"))));
        AliDebug(10, Form("New Channel: Write channel at %d Strip: %d "
                          "Sector: %d  Ring: %d", 
                          i, startStrip, prevSector, prevRing));
-       altro->WriteChannel(Int_t(startStrip), 
-                           Int_t(prevSector), 
-                           Int_t((prevRing == 'I' ? 0 : 1)), 
-                           channel.fN, channel.fArray, 0);
+       WriteChannel(altro, startStrip, prevSector, prevRing, channel);
        // Reset and update channel variables 
        channel.Reset(0);
        offset     = 0; 
@@ -260,6 +270,24 @@ AliFMDRawWriter::Exec(Option_t*)
   loader->UnloadDigits();
 }
 
+//____________________________________________________________________
+void
+AliFMDRawWriter::WriteChannel(AliAltroBuffer* altro, 
+                             UShort_t strip, UShort_t sector, Char_t ring, 
+                             const TArrayI& data) 
+{
+  // Write out one ALTRO channel to the data file. 
+  // Derived classes can overload this method to use a per-ALTRO
+  // threshold.   This implementation uses the common threshold set by
+  // SetThreshold. 
+  altro->WriteChannel(Int_t(strip), 
+                     Int_t(sector), 
+                     Int_t((ring == 'I' ? 0 : 1)), 
+                     data.fN, data.fArray, fThreshold);
+}
+
+  
+
 //____________________________________________________________________
 // 
 // EOF
index 2e0d4cb57c90bcc3e361db8c3a3fa67e828cbb9b..7a841a08617ba4aa20533b1ef0c5e0830fde5c1d 100644 (file)
@@ -18,6 +18,8 @@
 
 //____________________________________________________________________
 class AliFMD;
+class AliAltroBuffer;
+class TArrayI;
 
 
 //____________________________________________________________________
@@ -29,10 +31,16 @@ public:
   virtual void Exec(Option_t* option="");
   void SetSampleRate(UShort_t sampleRate=1) { fSampleRate = sampleRate; }
   void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
+  void SetThreshold(UShort_t t=0) { fThreshold = t; }
 protected:
-  AliFMD*       fFMD;        //! Pointer to detector description 
-  UShort_t      fSampleRate; // The sample rate (if 0, inferred from data)
-  UShort_t      fChannelsPerAltro;
+  virtual void WriteChannel(AliAltroBuffer* altro, 
+                           UShort_t strip, UShort_t sector, Char_t ring, 
+                           const TArrayI& data);
+  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 
+  UShort_t      fThreshold;        // Threshold for zero-suppression
+  
   ClassDef(AliFMDRawWriter, 0) // Write FMD raw data to a DDL file
 };
 
index 49ea78a70a024b58a020eb57917e67ca3a97babb..67c10240a07332e52a6b2d502737c12995ff6649 100644 (file)
@@ -17,9 +17,8 @@
 
 //____________________________________________________________________
 //
-// This is a class that constructs ReconstParticles (reconstructed
-// particles) out of Digits
-//
+// This is a class that constructs AliFMDMult (reconstructed
+// multiplicity) 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
 // signal to an energy deposition, and then dividing by the typical
 // energy loss of a particle.
 // 
-// Currently, this class only reads the digits from a TClonesArray,
-// and the Poission method for reconstruction. 
+//      +---------------------+       +---------------------+
+//      | AliFMDReconstructor |<>-----| AliFMDMultAlgorithm |
+//      +---------------------+       +---------------------+
+//                                               ^
+//                                               |
+//                                   +-----------+---------+
+//                                   |                     |
+//                         +-------------------+   +------------------+
+//                         | AliFMDMultPoisson |   | AliFMDMultNaiive |
+//                         +-------------------+   +------------------+
+//
+// AliFMDReconstructor acts as a manager class.  It contains a list of
+// AliFMDMultAlgorithm objects.  The call graph looks something like 
+//
+//
+//       +----------------------+            +----------------------+
+//       | :AliFMDReconstructor |            | :AliFMDMultAlgorithm |
+//       +----------------------+            +----------------------+
+//                  |                                  |
+//    Reconstruct  +-+                                 |
+//    ------------>| |                         PreRun +-+
+//                 | |------------------------------->| |   
+//                 | |                                +-+
+//                 | |-----+ (for each event)          |
+//                 | |     | *ProcessEvent             |
+//                 |+-+    |                           |
+//                 || |<---+                 PreEvent +-+
+//                 || |------------------------------>| |      
+//                 || |                               +-+
+//                 || |-----+                          |
+//                 || |     | ProcessDigits            |
+//                 ||+-+    |                          |
+//                 ||| |<---+                          |
+//                 ||| |         *ProcessDigit(digit) +-+
+//                 ||| |----------------------------->| |
+//                 ||| |                              +-+
+//                 ||+-+                               |
+//                 || |                     PostEvent +-+
+//                 || |------------------------------>| |
+//                 || |                               +-+
+//                 |+-+                                |
+//                 | |                        PostRun +-+
+//                 | |------------------------------->| |
+//                 | |                                +-+
+//                 +-+                                 |
+//                  |                                  |
+//
 //
 // 
 //-- Authors: Evgeny Karpechev(INR) and Alla Maevsksia
@@ -281,7 +325,9 @@ AliFMDReconstructor::ProcessEvent(Int_t event,
 
   if  (reader) {
     AliFMDRawReader rawRead(fFMD, reader);
-    // rawRead->SetSampleRate(fSampleRate);
+    AliDebug(10, Form("Making raw reader with sample rate: %d",
+                     fFMD->GetSampleRate()));
+    rawRead.SetSampleRate(fFMD->GetSampleRate());
     rawRead.Exec();
   }
   else {
@@ -323,10 +369,10 @@ AliFMDReconstructor::SubtractPedestal(AliFMDDigit* digit) const
   // something like that. 
 
   Int_t counts = 0;
-  Float_t ped = fPedestal * fPedestalFactor * fPedestalWidth;
-  if (digit->Count3() >= 0)      counts = digit->Count3();
-  else if (digit->Count2() >= 0) counts = digit->Count2();
-  else                           counts = digit->Count2();
+  Float_t ped = fPedestal + fPedestalFactor * fPedestalWidth;
+  if (digit->Count3() > 0)      counts = digit->Count3();
+  else if (digit->Count2() > 0) counts = digit->Count2();
+  else                          counts = digit->Count1();
   counts = TMath::Max(Int_t(counts - ped), 0);
   return  UShort_t(counts);
 }
index 29fd0446d8a2ac6f862c3350c6dca044b316d973..133c9b9bea2e85d9240adaaf7df6afcc9a062003 100644 (file)
 #include <TList.h>             // ROOT_TList
 #include <TString.h>           // ROOT_TString
 
+//____________________________________________________________________
 ClassImp(AliFMDSubDetector);
 
+//____________________________________________________________________
+const Char_t* AliFMDSubDetector::fgkHoneyTopFormat         = "F%d%cH";
+const Char_t* AliFMDSubDetector::fgkHoneyBottomFormat      = "F%d%cI";
+const Char_t* AliFMDSubDetector::fgkHoneyTopInnerFormat    = "F%d%cJ";
+const Char_t* AliFMDSubDetector::fgkHoneyBottomInnerFormat = "F%d%cK";
+
 //____________________________________________________________________
 AliFMDSubDetector::AliFMDSubDetector(Int_t n)
   : fId(n), 
@@ -43,7 +50,11 @@ AliFMDSubDetector::AliFMDSubDetector(Int_t n)
     fOuterZ(0), 
     fInner(0), 
     fOuter(0)
-{}
+{
+  SetAlThickness();
+  SetHoneycombThickness();
+}
+
 
 //____________________________________________________________________
 void 
@@ -119,7 +130,8 @@ AliFMDSubDetector::SimpleGeometry(TList* nodes,
   
 //____________________________________________________________________
 void 
-AliFMDSubDetector::SetupGeometry(Int_t airId, Int_t kaptionId) 
+AliFMDSubDetector::SetupGeometry(Int_t airId, Int_t alId, Int_t /* cId
+                                                                */) 
 {
   // Set up the geometry of this particular detector. 
   // 
@@ -128,7 +140,7 @@ AliFMDSubDetector::SetupGeometry(Int_t airId, Int_t kaptionId)
   // 
   // Parameters
   //   airId           Medium of inactive virtual volumes 
-  //   kaptionId       Medium of honeycomb
+  //   alId       Medium of honeycomb
   // 
   // DebugGuard guard("AliFMDSubDetector::SetupGeometry");
   AliDebug(10, "AliFMDSubDetector::SetupGeometry");
@@ -141,44 +153,44 @@ AliFMDSubDetector::SetupGeometry(Int_t airId, Int_t kaptionId)
     switch (i) {
     case 0: 
       r      = fInner;
-      c      = 'I';
       par[0] = fInnerHoneyLowR;
       par[1] = fInnerHoneyHighR;
       break;
     case 1: 
       r     = fOuter;
-      c     = 'O';
       par[0] = fOuterHoneyLowR;
       par[1] = fOuterHoneyHighR;
       break;
     }
     if (!r) continue;
+    c = r->GetId();
+    
     // Top of honeycomb, inner ring 
     par[2] = fHoneycombThickness / 2;
     par[3] = 0;
     par[4] = 180;
-    name   = Form("HT%c%d", c, fId);
-    gMC->Gsvolu(name.Data(), "TUBS", kaptionId, par, 5);
+    name   = Form(fgkHoneyTopFormat, fId, c);
+    gMC->Gsvolu(name.Data(), "TUBS", alId, par, 5);
     
     // Bottom of honeycomb, inner ring 
     par[3] = 180;
     par[4] = 360;
-    name   = Form("HB%c%d", c, fId);
-    gMC->Gsvolu(name.Data(), "TUBS", kaptionId, par, 5);
+    name   = Form(fgkHoneyBottomFormat, fId, c);
+    gMC->Gsvolu(name.Data(), "TUBS", alId, par, 5);
     
     // Air in top of honeycomb, inner ring 
-    par[0] += fKaptionThickness;
-    par[1] -= fKaptionThickness;
-    par[2] -= fKaptionThickness;
+    par[0] += fAlThickness;
+    par[1] -= fAlThickness;
+    par[2] -= fAlThickness;
     par[3] = 0;
     par[4] = 180;
-    name   = Form("GT%c%d", c, fId);
+    name   = Form(fgkHoneyTopInnerFormat, fId, c);
     gMC->Gsvolu(name.Data(), "TUBS", airId, par, 5);
     
     // Air in bottom of honeycomb, inner ring 
     par[3] = 180;
     par[4] = 360;
-    name   = Form("GB%c%d", c, fId);
+    name   = Form(fgkHoneyBottomInnerFormat, fId, c);
     gMC->Gsvolu(name.Data(), "TUBS", airId, par, 5);
   }
 }
@@ -217,44 +229,45 @@ AliFMDSubDetector::Geometry(const char* mother, Int_t pbRotId, Int_t idRotId,
     switch (i) {
     case 0: 
       r     = fInner;
-      c     = 'I';
       z     = fInnerZ;
       break;
     case 1: 
       r     =  fOuter;
-      c     =  'O';
       z     =  fOuterZ;
       break;
     }
     if (!r) continue;
+    c = r->GetId();
 
     // Make the coordinates relative to the mother volume.   If we're
     // on the positive side, then we need to flip the z-coordinate, as
     // we'll rotate the whole sub-detector afterwards. 
-    z -= zMother;
-    if (zMother > 0) z *= -1;
-    
-    r->Geometry(mother, fId, z, pbRotId, idRotId);
+    Double_t z2 = z;
+    z2 -= zMother;
+    if (zMother > 0) z2 *= -1;
+    AliDebug(10, Form("Putting ring %c in %s at z=%lf-%lf=%lf", 
+                     c, mother, z, zMother, z2));
+    r->Geometry(mother, fId, z2, pbRotId, idRotId);
     ringW =  r->GetRingDepth();
-    z     -= ringW + fHoneycombThickness / 2;
+    z2    -= ringW + fHoneycombThickness / 2;
 
     // Top of honeycomb
-    name = Form("HT%c%d", c, fId);
-    gMC->Gspos(name.Data(), 1, mother, 0, 0, z, idRotId);
+    name   = Form(fgkHoneyTopFormat, fId, c);
+    gMC->Gspos(name.Data(), 1, mother, 0, 0, z2, idRotId);
 
     // Air in top of honeycomb
     name2 = name;
-    name  = Form("GT%c%d", c, fId);
-    gMC->Gspos(name.Data(), 1, name2.Data(),0,fKaptionThickness,0,idRotId);
+    name   = Form(fgkHoneyTopInnerFormat, fId, c);
+    gMC->Gspos(name.Data(), 1, name2.Data(),0,fAlThickness,0,idRotId);
     
     // Bottom of honeycomb
-    name = Form("HB%c%d", c, fId);
-    gMC->Gspos(name.Data(), 1, mother, 0, 0, z, idRotId);
+    name   = Form(fgkHoneyBottomFormat, fId, c);
+    gMC->Gspos(name.Data(), 1, mother, 0, 0, z2, idRotId);
 
     // Air in bottom of honeycomb
     name2 = name;
-    name  = Form("GB%c%d", c, fId);
-    gMC->Gspos(name.Data(),1,name2.Data(),0,-fKaptionThickness,0,idRotId);
+    name   = Form(fgkHoneyBottomInnerFormat, fId, c);
+    gMC->Gspos(name.Data(),1,name2.Data(),0,-fAlThickness,0,idRotId);
   }
 }
 
@@ -266,8 +279,33 @@ AliFMDSubDetector::Gsatt()
   // 
   // DebugGuard guard("AliFMDSubDetector::Gsatt");
   AliDebug(10, "AliFMDSubDetector::Gsatt");
-  TString name(Form("FMD%d", fId));
+  TString name;
+
+  name = Form("FMD%d", fId);
   gMC->Gsatt(name.Data(), "SEEN", 0);
+
+  for (int i = 0; i < 2; i++) {
+    AliFMDRing* r = 0;
+    char  c = '\0';
+    switch (i) {
+    case 0: r = fInner; break;
+    case 1: r = fOuter; break;
+    }
+    if (!r) continue;
+    c = r->GetId();
+
+    name = Form(fgkHoneyTopFormat, fId, c);
+    gMC->Gsatt(name.Data(), "SEEN", 1);
+
+    name = Form(fgkHoneyBottomFormat, fId, c);
+    gMC->Gsatt(name.Data(), "SEEN", 1);
+
+    name = Form(fgkHoneyTopInnerFormat, fId, c);
+    gMC->Gsatt(name.Data(), "SEEN", 0);
+
+    name = Form(fgkHoneyBottomInnerFormat, fId, c);
+    gMC->Gsatt(name.Data(), "SEEN", 0);
+  }
 }
 
 
index c1641faa6a9a398d15cbb9cb799d22dfd39a032b..09f6d1977f7aa33ca57533f24714cdc948f1f6f3 100644 (file)
@@ -25,7 +25,7 @@ class AliFMDSubDetector : public TObject
 public:  
   AliFMDSubDetector(Int_t n);
   virtual ~AliFMDSubDetector() {}
-  virtual void   SetupGeometry(Int_t airId, Int_t kaptionId);  
+  virtual void   SetupGeometry(Int_t airId, Int_t alId, Int_t cId=0);  
   virtual void   Geometry(const char* mother, Int_t pbRotId, 
                          Int_t idRotId, Double_t z=0);
   virtual void   SimpleGeometry(TList* nodes, 
@@ -46,7 +46,7 @@ public:
   void   SetInnerHoneyHighR(Double_t r)      { fInnerHoneyHighR = r; }
   void   SetOuterHoneyLowR(Double_t r)       { fOuterHoneyLowR = r; }
   void   SetOuterHoneyHighR(Double_t r)      { fOuterHoneyHighR = r; }
-  void   SetKaptionThickness(Double_t t=.1)  { fKaptionThickness = t; }
+  void   SetAlThickness(Double_t t=.05)      { fAlThickness = t; }
      
   Double_t    GetInnerZ()             const { return fInnerZ; }
   Double_t    GetOuterZ()             const { return fOuterZ; }
@@ -57,7 +57,7 @@ public:
   Double_t    GetInnerHoneyHighR()    const { return fInnerHoneyHighR; }
   Double_t    GetOuterHoneyLowR()     const { return fOuterHoneyLowR; }
   Double_t    GetOuterHoneyHighR()    const { return fOuterHoneyHighR; }
-  Double_t    GetKaptionThickness()   const { return fKaptionThickness; }
+  Double_t    GetAlThickness()        const { return fAlThickness; }
   Int_t       GetId()                 const { return fId; }     
   Bool_t      IsFolder()              const { return kTRUE; }
 
@@ -66,7 +66,7 @@ protected:
   Double_t    fInnerZ;             // Position of outer ring along z
   Double_t    fOuterZ;             // Position of outer ring along z 
   Double_t    fHoneycombThickness; // Thickness of honeycomb plate 
-  Double_t    fKaptionThickness;   // Thickness of kaption of honeycomb
+  Double_t    fAlThickness;        // Thickness of aluminium of honeycomb
   Double_t    fInnerHoneyLowR;     // Inner radius of inner honeycomb
   Double_t    fInnerHoneyHighR;    // Outer radius of inner honeycomb
   Int_t       fInnerHoneyTopId;    // Volume ID of top of inner honeycomb
@@ -81,6 +81,11 @@ protected:
   AliFMDRing* fInner;              // Reference to inner ring description
   AliFMDRing* fOuter;              // Reference to outer ring description
 
+  static const Char_t* fgkHoneyTopFormat;         // Format of honeycomb name
+  static const Char_t* fgkHoneyBottomFormat;      // Format of honeycomb name
+  static const Char_t* fgkHoneyTopInnerFormat;    // Format of honeycomb name
+  static const Char_t* fgkHoneyBottomInnerFormat; // Format of honeycomb name
+
   ClassDef(AliFMDSubDetector, 1) // FMD Sub detector base class
 };
 
index daba529bd3133d7160bc6314b617b1c7e9e1d5f7..dacfe4e29c0fb89796365689bd1bfcdb848b6c8d 100644 (file)
@@ -17,7 +17,8 @@
 
 //____________________________________________________________________
 //                                                                          
-//
+// A map of per strip UShort_t information (for example ADC values,
+// number of hits and so on). 
 //
 #include "AliFMDUShortMap.h"           // ALIFMDUSHORTMAP_H
 
index 056501ba788ce6447ad33c3ecc2bdda23bb1fc93..2badda0588c4c6910e7eacf92754a57b0a65421f 100644 (file)
-static Int_t    eventsPerRun = 1;
-static Int_t    nParticles   = 100;
+//____________________________________________________________________
+//
+// $Id$
+//
+// One can use the configuration macro in compiled mode by
+// root [0] gSystem->Load("libgeant321");
+// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
+//                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
+// root [0] .x grun.C(1,"ConfigPPR.C++")
+//
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <Riostream.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <TVirtualMC.h>
+#include <TGeant3.h>
+#include "STEER/AliRunLoader.h"
+#include "STEER/AliRun.h"
+#include "STEER/AliConfig.h"
+#include "STEER/AliGenerator.h"
+#include "PYTHIA6/AliDecayerPythia.h"
+#include "EVGEN/AliGenHIJINGpara.h"
+#include "THijing/AliGenHijing.h"
+#include "EVGEN/AliGenCocktail.h"
+#include "EVGEN/AliGenSlowNucleons.h"
+#include "EVGEN/AliSlowNucleonModelExp.h"
+#include "EVGEN/AliGenParam.h"
+#include "EVGEN/AliGenMUONlib.h"
+#include "EVGEN/AliGenMUONCocktail.h"
+#include "PYTHIA6/AliGenPythia.h"
+#include "STEER/AliMagFMaps.h"
+#include "STRUCT/AliBODY.h"
+#include "STRUCT/AliMAG.h"
+#include "STRUCT/AliABSOv0.h"
+#include "STRUCT/AliDIPOv2.h"
+#include "STRUCT/AliHALL.h"
+#include "STRUCT/AliFRAMEv2.h"
+#include "STRUCT/AliSHILv2.h"
+#include "STRUCT/AliPIPEv0.h"
+#include "ITS/AliITSvPPRasymmFMD.h"
+#include "TPC/AliTPCv2.h"
+#include "TOF/AliTOFv4T0.h"
+#include "RICH/AliRICHv1.h"
+#include "ZDC/AliZDCv2.h"
+#include "TRD/AliTRDv1.h"
+#include "FMD/AliFMDv1.h"
+#include "MUON/AliMUONv1.h"
+#include "MUON/AliMUONSt1GeometryBuilderV2.h"
+#include "MUON/AliMUONSt2GeometryBuilder.h"
+#include "MUON/AliMUONSlatGeometryBuilder.h"
+#include "MUON/AliMUONTriggerGeometryBuilder.h"
+#include "PHOS/AliPHOSv1.h"
+#include "PMD/AliPMDv1.h"
+#include "START/AliSTARTv1.h"
+#include "EMCAL/AliEMCALv1.h"
+#include "CRT/AliCRTv0.h"
+#include "VZERO/AliVZEROv2.h"
+#endif
 
-enum PprRun_t {
+//____________________________________________________________________
+// 
+// Generator types 
+//
+enum EG_t {
   test50,
-  kParam_8000,   
-  kParam_4000,  
-  kParam_2000,
-  kHijing_cent1, 
-  kHijing_cent2,
-  kHijing_per1,  
-  kHijing_per2, 
-  kHijing_per3, 
-  kHijing_per4,  
-  kHijing_per5,
-  kHijing_jj25,  
-  kHijing_jj50, 
-  kHijing_jj75, 
-  kHijing_jj100, 
-  kHijing_jj200,
-  kHijing_gj25,  
-  kHijing_gj50, 
-  kHijing_gj75, 
-  kHijing_gj100, 
-  kHijing_gj200,
-  kHijing_pA, 
-  kPythia6, 
-  kPythia6Jets, 
-  kD0PbPb5500, 
-  kD_TRD, 
-  kB_TRD, 
-  kJpsi_TRD,
-  kU_TRD, 
-  kPyJJ, 
-  kPyGJ
+  kParam_8000,                 //
+  kParam_4000,                 //
+  kParam_2000,                 //
+  kHijing_cent1,               //
+  kHijing_cent2,               //
+  kHijing_per1,                        //
+  kHijing_per2,                        //
+  kHijing_per3,                        //
+  kHijing_per4,                        //
+  kHijing_per5,                        //
+  kHijing_jj25,                        //
+  kHijing_jj50,                        //
+  kHijing_jj75,                        //
+  kHijing_jj100,               //
+  kHijing_jj200,               //
+  kHijing_gj25,                        //
+  kHijing_gj50,                        //
+  kHijing_gj75,                        //
+  kHijing_gj100,               //
+  kHijing_gj200,               //
+  kHijing_pA,                  //
+  kPythia6,                    //
+  kPythia6Jets20_24,           //
+  kPythia6Jets24_29,           //
+  kPythia6Jets29_35,           //
+  kPythia6Jets35_42,           //
+  kPythia6Jets42_50,           //
+  kPythia6Jets50_60,           //
+  kPythia6Jets60_72,           //
+  kPythia6Jets72_86,           //
+  kPythia6Jets86_104,          //
+  kPythia6Jets104_125,         //
+  kPythia6Jets125_150,         //
+  kPythia6Jets150_180,         //
+  kD0PbPb5500,                 //
+  kCharmSemiElPbPb5500,                //
+  kBeautySemiElPbPb5500,       //
+  kCocktailTRD,                        //
+  kPyJJ,                       //
+  kPyGJ,                       //
+  kMuonCocktailCent1,          //
+  kMuonCocktailPer1,           //
+  kMuonCocktailPer4,           //
+  kMuonCocktailCent1HighPt,    //
+  kMuonCocktailPer1HighPt,     //
+  kMuonCocktailPer4HighPt,     //
+  kMuonCocktailCent1Single,    //
+  kMuonCocktailPer1Single,     //
+  kMuonCocktailPer4Single,
+  kEgMax
 };
 
-enum PprGeo_t {
-  kHoles, 
-  kNoHoles
+//____________________________________________________________________
+// 
+// Generator types names
+//
+const char* egName[kEgMax] = {
+  "test50",
+  "kParam_8000",               //
+  "kParam_4000",               //
+  "kParam_2000",               //
+  "kHijing_cent1",             //
+  "kHijing_cent2",             //
+  "kHijing_per1",              //
+  "kHijing_per2",              //
+  "kHijing_per3",              //
+  "kHijing_per4",              //
+  "kHijing_per5",              //
+  "kHijing_jj25",              //
+  "kHijing_jj50",              //
+  "kHijing_jj75",              //
+  "kHijing_jj100",             //
+  "kHijing_jj200",             //
+  "kHijing_gj25",              //
+  "kHijing_gj50",              //
+  "kHijing_gj75",              //
+  "kHijing_gj100",             //
+  "kHijing_gj200",             //
+  "kHijing_pA",                        //
+  "kPythia6",                  //
+  "kPythia6Jets20_24",         //
+  "kPythia6Jets24_29",         //
+  "kPythia6Jets29_35",         //
+  "kPythia6Jets35_42",         //
+  "kPythia6Jets42_50",         //
+  "kPythia6Jets50_60",         //
+  "kPythia6Jets60_72",         //
+  "kPythia6Jets72_86",         //
+  "kPythia6Jets86_104",                //
+  "kPythia6Jets104_125",       //
+  "kPythia6Jets125_150",       //
+  "kPythia6Jets150_180",       //
+  "kD0PbPb5500",               //
+  "kCharmSemiElPbPb5500",      //
+  "kBeautySemiElPbPb5500",     //
+  "kCocktailTRD",              //
+  "kPyJJ",                     //
+  "kPyGJ",                     //
+  "kMuonCocktailCent1",                //
+  "kMuonCocktailPer1",         //
+  "kMuonCocktailPer4",         //
+  "kMuonCocktailCent1HighPt",  //
+  "kMuonCocktailPer1HighPt",   //
+  "kMuonCocktailPer4HighPt",   //
+  "kMuonCocktailCent1Single",  //
+  "kMuonCocktailPer1Single",   //
+  "kMuonCocktailPer4Single"
 };
 
-enum PprRad_t {
-  kGluonRadiation, 
-  kNoGluonRadiation
+//____________________________________________________________________
+enum Geo_t {
+  kHoles,                      //
+  kNoHoles                     //
 };
 
-enum PprMag_t {
-  k2kG, 
-  k4kG, 
-  k5kG
+//____________________________________________________________________
+enum Rad_t {
+  kGluonRadiation,             //
+  kNoGluonRadiation            //
 };
 
+//____________________________________________________________________
+enum Mag_t {
+  k2kG,                                //
+  k4kG,                                //
+  k5kG                         //
+};
+
+//____________________________________________________________________
 enum MC_t {
   kFLUKA, 
   kGEANT3, 
   kGEANT4
 };
 
-
-// This part for configuration
-//static PprRun_t srun = test50;
-static PprRun_t srun = kPythia6;
-static PprGeo_t sgeo = kHoles;
-static PprRad_t srad = kGluonRadiation;
-static PprMag_t smag = k5kG;
-// static MC_t     smc  = kFLUKA;
-static MC_t     smc  = kGEANT3;
-
-// Comment line
-static TString  comment;
-
+//____________________________________________________________________
 // Functions
-Float_t EtaToTheta(Float_t arg);
-
+Float_t       EtaToTheta(Float_t eta);
+Eg_t          LookupEG(const Char_t* name);
+AliGenerator* GeneratorFactory(EG_t eg, Rad_t rad, TString& comment);
+AliGenHijing* HijingStandard();
+void          ProcessEnvironmentVars(EG_t& eg, Int_t& seed);
 
-void Config()
+//____________________________________________________________________
+void 
+Config()
 {
-  cout << "==> Config.C..." << endl;
+  //____________________________________________________________________
+  // This part for configuration    
+  //static EG_t eg = test50;
+  EG_t  eg   = kParam_2000;
+  Geo_t geo  = kNoHoles;
+  Rad_t rad  = kGluonRadiation;
+  Mag_t mag  = k5kG;
+  Int_t seed = 12345; //Set 0 to use the current time
+  MC_t  mc   = kGEANT3;
   
+  //____________________________________________________________________
+  // Comment line 
+  static TString  comment;
+  
+  //____________________________________________________________________
+  // Get settings from environment variables
+  ProcessEnvironmentVars(eg, seed);
+
+  //____________________________________________________________________
   // Set Random Number seed
-  gRandom->SetSeed(12345);
-  cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
+  gRandom->SetSeed(seed);
+  cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl; 
 
-  switch (smc) {
+
+  //__________________________________________________________________
+  switch (mc) {
   case kFLUKA: 
     // 
     // libraries required by fluka21
@@ -112,14 +265,14 @@ void Config()
     gAlice->Fatal("Config.C", "No MC type chosen");
     return;
   }
-  
-  //
-  // Run loader
-  //
+
+  //__________________________________________________________________
+  AliRunLoader* rl = 0;
+
   cout<<"Config.C: Creating Run Loader ..."<<endl;
-  AliRunLoader* rl = AliRunLoader::Open("galice.root",
-                                       AliConfig::GetDefaultEventFolderName(),
-                                       "recreate");
+  rl = AliRunLoader::Open("galice.root",
+                         AliConfig::GetDefaultEventFolderName(),
+                         "recreate");
   if (!rl) {
     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
     return;
@@ -128,7 +281,9 @@ void Config()
   rl->SetNumberOfEventsPerFile(3);
   gAlice->SetRunLoader(rl);
 
-  switch (smc) {
+  //__________________________________________________________________
+  // For FLUKA 
+  switch (mc) {
   case kFLUKA: 
     {
       //
@@ -142,33 +297,37 @@ void Config()
     }
     break;
   }
-  
-     
+
+  //__________________________________________________________________
   //
   // Set External decayer
-  // 
   AliDecayer *decayer = new AliDecayerPythia();
-  decayer->SetForceDecay(kAll);
+  switch (eg) {
+  case kD0PbPb5500:           decayer->SetForceDecay(kHadronicD);      break;
+  case kCharmSemiElPbPb5500:  decayer->SetForceDecay(kSemiElectronic); break;
+  case kBeautySemiElPbPb5500: decayer->SetForceDecay(kSemiElectronic); break;
+  default:                    decayer->SetForceDecay(kAll);            break;
+  }
   decayer->Init();
   gMC->SetExternalDecayer(decayer);
 
-
-  //
-  // Physics process control
-  // 
+  //__________________________________________________________________
+  // ************* STEERING parameters FOR ALICE SIMULATION **************
+  // --- Specify event type to be tracked through the ALICE setup
+  // --- All positions are in cm, angles in degrees, and P and E in GeV
   gMC->SetProcess("DCAY",1);
   gMC->SetProcess("PAIR",1);
   gMC->SetProcess("COMP",1);
   gMC->SetProcess("PHOT",1);
   gMC->SetProcess("PFIS",0);
-  gMC->SetProcess("DRAY",1);
+  gMC->SetProcess("DRAY",0);
   gMC->SetProcess("ANNI",1);
   gMC->SetProcess("BREM",1);
   gMC->SetProcess("MUNU",1);
-  gMC->SetProcess("CKOV",1); 
+  gMC->SetProcess("CKOV",1);
   gMC->SetProcess("HADR",1);
   gMC->SetProcess("LOSS",2);
-  gMC->SetProcess("MULS",1);  
+  gMC->SetProcess("MULS",1);
   gMC->SetProcess("RAYL",1);
 
   Float_t cut = 1.e-3;        // 1MeV cut by default
@@ -179,73 +338,57 @@ void Config()
   gMC->SetCut("CUTNEU", cut);
   gMC->SetCut("CUTHAD", cut);
   gMC->SetCut("CUTMUO", cut);
-  gMC->SetCut("BCUTE",  cut);
-  gMC->SetCut("BCUTM",  cut);
-  gMC->SetCut("DCUTE",  cut);
-  gMC->SetCut("DCUTM",  cut);
+  gMC->SetCut("BCUTE",  cut); 
+  gMC->SetCut("BCUTM",  cut); 
+  gMC->SetCut("DCUTE",  cut); 
+  gMC->SetCut("DCUTM",  cut); 
   gMC->SetCut("PPCUTM", cut);
-  gMC->SetCut("TOFMAX", tofmax);
+  gMC->SetCut("TOFMAX", tofmax); 
 
-  //
-  //=======================================================================
-  // STEERING parameters FOR ALICE SIMULATION 
-  // 
-  // Specify event type to be tracked through the ALICE setup.  All
-  // positions are in cm, angles in degrees, and P and E in GeV
-  // 
-  if (gSystem->Getenv("CONFIG_NPARTICLES"))
-    nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
-
-  cout << "\t* Creating and configuring generator for " << nParticles 
-       << " particles..." << endl;
-  AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
-  gener->SetMomentumRange(0., 999);
-  gener->SetPhiRange(0, 360);
-
-  // Set pseudorapidity range from -6 to 6.
-  Float_t thmin = EtaToTheta( 6.);   // theta min. <---> eta max
-  Float_t thmax = EtaToTheta(-6.);   // theta max. <---> eta min 
-  gener->SetThetaRange(thmin,thmax);
-  gener->SetOrigin(0, 0, 0);  //vertex position
-  gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
-  gener->Init();
-  // 
-  // Activate this line if you want the vertex smearing to happen
-  // track by track
-  //
-  gAlice->SetDebug(10);
 
+  //__________________________________________________________________
+  // Generator Configuration
+  gAlice->SetDebug(0);
+  AliGenerator* gener = GeneratorFactory(eg, rad, comment);
+  gener->SetOrigin(0, 0, 0);    // vertex position
+  gener->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
+  gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
+  gener->SetVertexSmear(kPerEvent); 
+  gener->SetTrackingFlag(1);
+  gener->Init();
+    
+  //__________________________________________________________________
   // 
   // Comments 
   // 
-  switch (smag) {
+  switch (mag) {
   case k2kG: comment = comment.Append(" | L3 field 0.2 T"); break;
   case k4kG: comment = comment.Append(" | L3 field 0.4 T"); break;
   case k5kG: comment = comment.Append(" | L3 field 0.5 T"); break;
   }
 
-  switch (srad) {
+  switch (rad) {
   case kGluonRadiation: 
     comment = comment.Append(" | Gluon Radiation On");  break;
   default:
     comment = comment.Append(" | Gluon Radiation Off"); break;
   }
 
-  switch(sgeo) {
+  switch(geo) {
   case kHoles: comment = comment.Append(" | Holes for PHOS/RICH"); break;
   default:     comment = comment.Append(" | No holes for PHOS/RICH"); break;
   }
 
   std::cout << "\n\n Comment: " << comment << "\n" << std::endl;
 
-  // 
+  //__________________________________________________________________
   // Field (L3 0.4 T)
-  // 
-  AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
+  AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag);
   field->SetL3ConstField(0); //Using const. field in the barrel
   rl->CdGAFile();
-  gAlice->SetField(field);
+  gAlice->SetField(field);    
 
+  //__________________________________________________________________
   // 
   // Used detectors 
   // 
@@ -273,7 +416,6 @@ void Config()
 
   cout << "\t* Creating the detectors ..." << endl;
   //=================== Alice BODY parameters =============================
-  //=================== Alice BODY parameters =============================
   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
   
   
@@ -291,7 +433,6 @@ void Config()
 
   if (useDIPO) {
     //=================== DIPO parameters ============================
-    
     AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
   }
 
@@ -304,7 +445,7 @@ void Config()
   if (useFRAME) {
     //=================== FRAME parameters ============================
     AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
-    switch (sgeo) {
+    switch (geo) {
     case kHoles: FRAME->SetHoles(1); break;
     default:     FRAME->SetHoles(0); break;
     }
@@ -451,7 +592,7 @@ void Config()
 
     // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
     TRD->SetGasMix(1);
-    if (sgeo == kHoles) {
+    if (geo == kHoles) {
       // With hole in front of PHOS
       TRD->SetPHOShole();
       // With hole in front of RICH
@@ -506,8 +647,914 @@ void Config()
   }
 }
 
+//____________________________________________________________________
 Float_t EtaToTheta(Float_t arg)
 {
-  return (180./TMath::Pi())*2.*atan(exp(-arg));
+  return (180./TMath::Pi())*2.*TMath::ATan(TMath::Exp(-arg));
+}
+
+//____________________________________________________________________
+Int_t 
+LookupEG(const Char_t* name) 
+{
+  TString n(name);
+  for (Int_t i = 0; i < kEgMax; i++) {
+    if (n == egName[i]) return i;
+  }
+  return -1;
+}
+
+//____________________________________________________________________  
+AliGenerator* 
+GeneratorFactory(EG_t eg, Rad_t rad, TString& comment)  
+{
+  Int_t isw = 3;
+  if (rad == kNoGluonRadiation) isw = 0;
+  
+  
+  AliGenerator * gGener = 0;
+  switch (eg) {
+  case test50:
+    {
+      comment = comment.Append(":HIJINGparam test 50 particles");
+      AliGenHIJINGpara *gener = new AliGenHIJINGpara(50);
+      gener->SetMomentumRange(0, 999999.);
+      gener->SetPhiRange(0., 360.);
+      // Set pseudorapidity range from -8 to 8.
+      Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
+      Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
+      gener->SetThetaRange(thmin,thmax);
+      gGener=gener;
+    }
+    break;
+  case kParam_8000:
+    {
+      comment = comment.Append(":HIJINGparam N=8000");
+      AliGenHIJINGpara *gener = new AliGenHIJINGpara(86030);
+      gener->SetMomentumRange(0, 999999.);
+      gener->SetPhiRange(0., 360.);
+      // Set pseudorapidity range from -8 to 8.
+      Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
+      Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
+      gener->SetThetaRange(thmin,thmax);
+      gGener=gener;
+    }
+    break;
+  case kParam_4000:
+    {
+      comment = comment.Append("HIJINGparam N=4000");
+      AliGenHIJINGpara *gener = new AliGenHIJINGpara(43015);
+      gener->SetMomentumRange(0, 999999.);
+      gener->SetPhiRange(0., 360.);
+      // Set pseudorapidity range from -8 to 8.
+      Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
+      Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
+      gener->SetThetaRange(thmin,thmax);
+      gGener=gener;
+    }
+    break;
+  case kParam_2000:
+    {
+      comment = comment.Append("HIJINGparam N=2000");
+      AliGenHIJINGpara *gener = new AliGenHIJINGpara(21507);
+      gener->SetMomentumRange(0, 999999.);
+      gener->SetPhiRange(0., 360.);
+      // Set pseudorapidity range from -8 to 8.
+      Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
+      Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
+      gener->SetThetaRange(thmin,thmax);
+      gGener=gener;
+    }
+    break;
+    //
+    //  Hijing Central
+    //
+  case kHijing_cent1:
+    {
+      comment = comment.Append("HIJING cent1");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      gGener=gener;
+    }
+    break;
+  case kHijing_cent2:
+    {
+      comment = comment.Append("HIJING cent2");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 2.);
+      gGener=gener;
+    }
+    break;
+    //
+    // Hijing Peripheral 
+    //
+  case kHijing_per1:
+    {
+      comment = comment.Append("HIJING per1");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(5., 8.6);
+      gGener=gener;
+    }
+    break;
+  case kHijing_per2:
+    {
+      comment = comment.Append("HIJING per2");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(8.6, 11.2);
+      gGener=gener;
+    }
+    break;
+  case kHijing_per3:
+    {
+      comment = comment.Append("HIJING per3");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(11.2, 13.2);
+      gGener=gener;
+    }
+    break;
+  case kHijing_per4:
+    {
+      comment = comment.Append("HIJING per4");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(13.2, 15.);
+      gGener=gener;
+    }
+    break;
+  case kHijing_per5:
+    {
+      comment = comment.Append("HIJING per5");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(15., 100.);
+      gGener=gener;
+    }
+    break;
+    //
+    //  Jet-Jet
+    //
+  case kHijing_jj25:
+    {
+      comment = comment.Append("HIJING Jet 25 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(1);
+      gener->SetPtJet(25.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.3,0.3);
+      gener->SetJetPhiRange(75., 165.);   
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_jj50:
+    {
+      comment = comment.Append("HIJING Jet 50 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(1);
+      gener->SetPtJet(50.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.3,0.3);
+      gener->SetJetPhiRange(75., 165.);   
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_jj75:
+    {
+      comment = comment.Append("HIJING Jet 75 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(1);
+      gener->SetPtJet(75.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.3,0.3);
+      gener->SetJetPhiRange(75., 165.);   
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_jj100:
+    {
+      comment = comment.Append("HIJING Jet 100 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(1);
+      gener->SetPtJet(100.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.3,0.3);
+      gener->SetJetPhiRange(75., 165.);   
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_jj200:
+    {
+      comment = comment.Append("HIJING Jet 200 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(1);
+      gener->SetPtJet(200.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.3,0.3);
+      gener->SetJetPhiRange(75., 165.);   
+      gGener=gener;
+    }
+    break;
+    //
+    // Gamma-Jet
+    //
+  case kHijing_gj25:
+    {
+      comment = comment.Append("HIJING Gamma 25 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(2);
+      gener->SetPtJet(25.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.12, 0.12);
+      gener->SetJetPhiRange(220., 320.);
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_gj50:
+    {
+      comment = comment.Append("HIJING Gamma 50 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(2);
+      gener->SetPtJet(50.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.12, 0.12);
+      gener->SetJetPhiRange(220., 320.);
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_gj75:
+    {
+      comment = comment.Append("HIJING Gamma 75 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(2);
+      gener->SetPtJet(75.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.12, 0.12);
+      gener->SetJetPhiRange(220., 320.);
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_gj100:
+    {
+      comment = comment.Append("HIJING Gamma 100 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(2);
+      gener->SetPtJet(100.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.12, 0.12);
+      gener->SetJetPhiRange(220., 320.);
+      gGener=gener;
+    }
+    break;
+
+  case kHijing_gj200:
+    {
+      comment = comment.Append("HIJING Gamma 200 GeV");
+      AliGenHijing *gener = HijingStandard();
+      // impact parameter range
+      gener->SetImpactParameterRange(0., 5.);
+      // trigger
+      gener->SetTrigger(2);
+      gener->SetPtJet(200.);
+      gener->SetRadiation(isw);
+      gener->SetSimpleJets(!isw);
+      gener->SetJetEtaRange(-0.12, 0.12);
+      gener->SetJetPhiRange(220., 320.);
+      gGener=gener;
+    }
+    break;
+  case kHijing_pA:
+    {
+      comment = comment.Append("HIJING pA");
+
+      AliGenCocktail *gener  = new AliGenCocktail();
+
+      AliGenHijing   *hijing = new AliGenHijing(-1);
+      // centre of mass energy 
+      hijing->SetEnergyCMS(TMath::Sqrt(82./208.) * 14000.);
+      // impact parameter range
+      hijing->SetImpactParameterRange(0., 15.);
+      // reference frame
+      hijing->SetReferenceFrame("CMS");
+      hijing->SetBoostLHC(1);
+      // projectile
+      hijing->SetProjectile("P", 1, 1);
+      hijing->SetTarget    ("A", 208, 82);
+      // tell hijing to keep the full parent child chain
+      hijing->KeepFullEvent();
+      // enable jet quenching
+      hijing->SetJetQuenching(0);
+      // enable shadowing
+      hijing->SetShadowing(1);
+      // Don't track spectators
+      hijing->SetSpectators(0);
+      // kinematic selection
+      hijing->SetSelectAll(0);
+      //
+      AliGenSlowNucleons*  gray    = new AliGenSlowNucleons(1);
+      AliSlowNucleonModel* model   = new AliSlowNucleonModelExp();
+      gray->SetSlowNucleonModel(model);
+      gray->SetDebug(1);
+      gener->AddGenerator(hijing,"Hijing pPb", 1);
+      gener->AddGenerator(gray,  "Gray Particles",1);
+      gGener=gener;
+    }
+    break;
+  case kPythia6:
+    {
+      comment = comment.Append(":Pythia p-p @ 14 TeV");
+      AliGenPythia *gener = new AliGenPythia(-1); 
+      gener->SetMomentumRange(0,999999);
+      gener->SetThetaRange(0., 180.);
+      gener->SetYRange(-12,12);
+      gener->SetPtRange(0,1000);
+      gener->SetProcess(kPyMb);
+      gener->SetEnergyCMS(14000.);
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets20_24:
+    {
+      comment = comment.Append(":Pythia jets 20-24 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(20., 24.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets24_29:
+    {
+      comment = comment.Append(":Pythia jets 24-29 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(24., 29.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets29_35:
+    {
+      comment = comment.Append(":Pythia jets 29-35 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(29., 35.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets35_42:
+    {
+      comment = comment.Append(":Pythia jets 35-42 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(35., 42.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets42_50:
+    {
+      comment = comment.Append(":Pythia jets 42-50 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(42., 50.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets50_60:
+    {
+      comment = comment.Append(":Pythia jets 50-60 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(50., 60.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets60_72:
+    {
+      comment = comment.Append(":Pythia jets 60-72 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(60., 72.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets72_86:
+    {
+      comment = comment.Append(":Pythia jets 72-86 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(72., 86.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets86_104:
+    {
+      comment = comment.Append(":Pythia jets 86-104 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(86., 104.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets104_125:
+    {
+      comment = comment.Append(":Pythia jets 105-125 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(104., 125.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets125_150:
+    {
+      comment = comment.Append(":Pythia jets 125-150 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(125., 150.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kPythia6Jets150_180:
+    {
+      comment = comment.Append(":Pythia jets 150-180 GeV @ 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);//        Centre of mass energy
+      gener->SetProcess(kPyJets);//        Process type
+      gener->SetJetEtaRange(-0.5, 0.5);//  Final state kinematic cuts
+      gener->SetJetPhiRange(0., 360.);
+      gener->SetJetEtRange(10., 1000.);
+      gener->SetGluonRadiation(1,1);
+      //    gener->SetPtKick(0.);
+      //   Structure function
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(150., 180.);// Pt transfer of the hard scattering
+      gener->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
+      gener->SetForceDecay(kAll);//  Decay type (semielectronic, etc.)
+      gGener=gener;
+    }
+    break;
+  case kD0PbPb5500:
+    {
+      comment = comment.Append(" D0 in Pb-Pb at 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(10);
+      gener->SetProcess(kPyD0PbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      gener->SetForceDecay(kHadronicD);
+      gener->SetYRange(-2,2);
+      gener->SetFeedDownHigherFamily(kFALSE);
+      gener->SetStackFillOpt(AliGenPythia::kParentSelection);
+      gener->SetCountMode(AliGenPythia::kCountParents);
+      gGener=gener;
+    }
+    break;
+  case kCharmSemiElPbPb5500:
+    {
+      comment = comment.Append(" Charm in Pb-Pb at 5.5 TeV");
+      AliGenPythia * gener = new AliGenPythia(10);
+      gener->SetProcess(kPyCharmPbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.1,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      gener->SetForceDecay(kSemiElectronic);
+      gener->SetYRange(-2,2);
+      gener->SetFeedDownHigherFamily(kFALSE);
+      gener->SetCountMode(AliGenPythia::kCountParents);
+      gGener=gener;
+    }
+    break;
+  case kBeautySemiElPbPb5500:
+    {
+      comment = comment.Append(" Beauty in Pb-Pb at 5.5 TeV");
+      AliGenPythia *gener = new AliGenPythia(10);
+      gener->SetProcess(kPyBeautyPbPbMNR);
+      gener->SetStrucFunc(kCTEQ4L);
+      gener->SetPtHard(2.75,-1.0);
+      gener->SetEnergyCMS(5500.);
+      gener->SetNuclei(208,208);
+      gener->SetForceDecay(kSemiElectronic);
+      gener->SetYRange(-2,2);
+      gener->SetFeedDownHigherFamily(kFALSE);
+      gener->SetCountMode(AliGenPythia::kCountParents);
+      gGener=gener;
+    }
+    break;
+  case kCocktailTRD:
+    {
+      comment = comment.Append(" Cocktail for TRD at 5.5 TeV");
+      AliGenCocktail *gener  = new AliGenCocktail();
+
+      AliGenParam *jpsi = new AliGenParam(10,
+                                         new AliGenMUONlib(),
+                                         AliGenMUONlib::kJpsiFamily,
+                                         "Vogt PbPb");
+
+      jpsi->SetPtRange(0, 100);
+      jpsi->SetYRange(-1., +1.);
+      jpsi->SetForceDecay(kDiElectron);
+
+      AliGenParam *ups = new AliGenParam(10,
+                                        new AliGenMUONlib(),
+                                        AliGenMUONlib::kUpsilonFamily,
+                                        "Vogt PbPb");
+      ups->SetPtRange(0, 100);
+      ups->SetYRange(-1., +1.);
+      ups->SetForceDecay(kDiElectron);
+       
+      AliGenParam *charm = new AliGenParam(10,
+                                          new AliGenMUONlib(), 
+                                          AliGenMUONlib::kCharm,
+                                          "central");
+      charm->SetPtRange(0, 100);
+      charm->SetYRange(-1.5, +1.5);
+      charm->SetForceDecay(kSemiElectronic);
+       
+       
+      AliGenParam *beauty = new AliGenParam(10,
+                                           new AliGenMUONlib(), 
+                                           AliGenMUONlib::kBeauty,
+                                           "central");
+      beauty->SetPtRange(0, 100);
+      beauty->SetYRange(-1.5, +1.5);
+      beauty->SetForceDecay(kSemiElectronic);
+
+      gener->AddGenerator(jpsi,"J/psi",1);
+      gener->AddGenerator(ups,"Upsilon",1);
+      gener->AddGenerator(charm,"Charm",1);
+      gener->AddGenerator(beauty,"Beauty",1);
+      gGener=gener;
+    }
+    break;
+  case kPyJJ:
+    {
+      comment = comment.Append(" Jet-jet at 5.5 TeV");
+      AliGenPythia *gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);
+      gener->SetProcess(kPyJets);
+      Double_t ptHardMin=10.0, ptHardMax=-1.0;
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      gener->SetYHard(-0.7,0.7);
+      gener->SetJetEtaRange(-0.2,0.2);
+      gener->SetEventListRange(0,1);
+      gGener=gener;
+    }
+    break;
+  case kPyGJ:
+    {
+      comment = comment.Append(" Gamma-jet at 5.5 TeV");
+      AliGenPythia *gener = new AliGenPythia(-1);
+      gener->SetEnergyCMS(5500.);
+      gener->SetProcess(kPyDirectGamma);
+      Double_t ptHardMin=10.0, ptHardMax=-1.0;
+      gener->SetPtHard(ptHardMin,ptHardMax);
+      gener->SetYHard(-1.0,1.0);
+      gener->SetGammaEtaRange(-0.13,0.13);
+      gener->SetGammaPhiRange(210.,330.);
+      gener->SetEventListRange(0,1);
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailCent1:
+    {
+      comment = comment.Append(" Muon Cocktail Cent1");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(0.8);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(2);
+      gener->SetNumberOfCollisions(1626.);  //Centrality class Cent1 for PDC04
+      gener->SetNumberOfParticipants(359.4);//Centrality class Cent1 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailPer1:
+    {
+      comment = comment.Append(" Muon Cocktail Per1");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(0.8);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(2);
+      gener->SetNumberOfCollisions(820.0);//Centrality class Per1 for PDC04
+      gener->SetNumberOfParticipants(229.3);//Centrality class Per1 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailPer4:
+    {
+      comment = comment.Append(" Muon Cocktail Per4");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(0.8);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(2);
+      gener->SetNumberOfCollisions(13.6);//Centrality class Per4 for PDC04
+      gener->SetNumberOfParticipants(13.3);//Centrality class Per4 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailCent1HighPt:
+    {
+      comment = comment.Append(" Muon Cocktail HighPt Cent1");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(2.5);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(2);
+      gener->SetNumberOfCollisions(1626.);  //Centrality class Cent1 for PDC04
+      gener->SetNumberOfParticipants(359.4);//Centrality class Cent1 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailPer1HighPt :
+    {
+      comment = comment.Append(" Muon Cocktail HighPt Per1");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(2.5);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(2);
+      gener->SetNumberOfCollisions(820.0);//Centrality class Per1 for PDC04
+      gener->SetNumberOfParticipants(229.3);//Centrality class Per1 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailPer4HighPt:
+    {
+      comment = comment.Append(" Muon Cocktail HighPt Per4");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(2.5);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(2);
+      gener->SetNumberOfCollisions(13.6);//Centrality class Per4 for PDC04
+      gener->SetNumberOfParticipants(13.3);//Centrality class Per4 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailCent1Single:
+    {
+      comment = comment.Append(" Muon Cocktail Single Cent1");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(0.8);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(1);
+      gener->SetNumberOfCollisions(1626.);  //Centrality class Cent1 for PDC04
+      gener->SetNumberOfParticipants(359.4);//Centrality class Cent1 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailPer1Single :
+    {
+      comment = comment.Append(" Muon Cocktail Single Per1");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(0.8);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(1);
+      gener->SetNumberOfCollisions(820.0);//Centrality class Per1 for PDC04
+      gener->SetNumberOfParticipants(229.3);//Centrality class Per1 for PDC04
+      gGener=gener;
+    }
+    break;
+  case kMuonCocktailPer4Single:
+    {
+      comment = comment.Append(" Muon Cocktail Single Per4");
+      AliGenMUONCocktail * gener = new AliGenMUONCocktail();
+      gener->SetPtRange(1.0,100.);       // Transverse momentum range   
+      gener->SetPhiRange(0.,360.);    // Azimuthal angle range  
+      gener->SetYRange(-4.0,-2.4);
+      gener->SetMuonPtCut(0.8);
+      gener->SetMuonThetaCut(171.,178.);
+      gener->SetMuonMultiplicity(1);
+      gener->SetNumberOfCollisions(13.6);//Centrality class Per4 for PDC04
+      gener->SetNumberOfParticipants(13.3);//Centrality class Per4 for PDC04
+      gGener=gener;
+    }
+    break;
+  default: break;
+  }
+  return gGener;
+}
+
+//____________________________________________________________________
+AliGenHijing* 
+HijingStandard()
+{
+  AliGenHijing *gener = new AliGenHijing(-1);
+  // centre of mass energy 
+  gener->SetEnergyCMS(5500.);
+  // reference frame
+  gener->SetReferenceFrame("CMS");
+  // projectile
+  gener->SetProjectile("A", 208, 82);
+  gener->SetTarget    ("A", 208, 82);
+  // tell hijing to keep the full parent child chain
+  gener->KeepFullEvent();
+  // enable jet quenching
+  gener->SetJetQuenching(1);
+  // enable shadowing
+  gener->SetShadowing(1);
+  // neutral pion and heavy particle decays switched off
+  gener->SetDecaysOff(1);
+  // Don't track spectators
+  gener->SetSpectators(0);
+  // kinematic selection
+  gener->SetSelectAll(0);
+  return gener;
+}
+
+
+//____________________________________________________________________
+void 
+ProcessEnvironmentVars(EG_t& eg, Int_t& seed)
+{
+  // Run type
+  if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
+    Int_t eg1 = LookupEG(gSystem->Getenv("CONFIG_RUN_TYPE"));
+    if  (eg1 >= 0) eg = EG_t(eg1);
+  }
+  // Random Number seed
+  if (gSystem->Getenv("CONFIG_SEED")) {
+    seed = atoi(gSystem->Getenv("CONFIG_SEED"));
+  }
 }
 
+//____________________________________________________________________
+//
+// EOF
+// 
index ae1fe73fda3e47bbc0eb1533cf80afd7ab66ad50..f3150c0982e876f2ecbe0a7a2c7ccbc478498ace 100644 (file)
@@ -20,7 +20,7 @@ void
 Simulate()
 {
  AliSimulation sim;
- sim.SetConfigFile("$(ALICE)/FMD/Config.C");
+ sim.SetConfigFile("$(ALICE)/FMD/Config_new.C");
  // sim.SetMakeSDigits("FMD");
  // sim.SetMakeDigits("FMD");
  sim.SetWriteRawData("FMD");
index a38b32e49db2ae8585e9ead09779ab5166c7b178..2f66bf0e710b9e5ad69f93cae9d649ef430d6712 100644 (file)
@@ -1,18 +1,70 @@
 void ViewFMD()
 {
-   gMC->Gsatt("FMD1","seen",0);
-   gMC->Gsatt("FMD2","seen",0);
-   gMC->Gsatt("FMD3","seen",0);
-   gMC->Gsatt("FRGI","seen",0);
-   gMC->Gsatt("FRGO","seen",0);
-   gMC->Gsatt("FVFI","seen",0);
-   gMC->Gsatt("FVFO","seen",0);
-   gMC->Gsatt("FVBI","seen",0);
-   gMC->Gsatt("FVBO","seen",0);
-   gMC->Gsatt("FACI","seen",1);
-   gMC->Gsatt("FACO","seen",1);
-   gMC->Gsatt("FPTI","seen",1);
-   gMC->Gsatt("FPTO","seen",1);
-   gMC->Gsatt("FPBI","seen",1);
-   gMC->Gsatt("FPBO","seen",1);
+  gMC->Gsatt("FMD1","seen",0);
+  gMC->Gsatt("FMD2","seen",0);
+  gMC->Gsatt("FMD3","seen",0);
+  gMC->Gsatt("FSSL","seen",1);
+  gMC->Gsatt("FSLL","seen",1);
+
+  TString name;
+  // Rings
+  for (Int_t i = 0; i < 2; i++) {
+    char c;
+    switch (i) {
+    case 0: c = 'I'; break;
+    case 1: c = 'O'; break;
+    }
+     
+    name = Form("F%cRG", c);
+    gMC->Gsatt(name.Data(),"seen",0); // Ring volume        
+
+    name = Form("F%cVF", c);
+    gMC->Gsatt(name.Data(),"seen",0); // Virtual volume front
+
+    name = Form("F%cVB", c);
+    gMC->Gsatt(name.Data(),"seen",0); // Virtual volume back
+
+    name = Form("F%cAC", c);
+    gMC->Gsatt(name.Data(),"seen",-2); // Active volume
+
+    // name = Form("F%cAP", c);
+    // gMC->Gsatt(name.Data(),"seen",-1); // Phi segmentation of active
+
+    // name = Form("F%cAR", c);
+    // gMC->Gsatt(name.Data(),"seen",-1); // R segmentation of active
+
+    name = Form("F%cPT", c);
+    gMC->Gsatt(name.Data(),"seen",1); // Top of print-board
+
+    name = Form("F%cPB", c);
+    gMC->Gsatt(name.Data(),"seen",1); // Bottom of print board
+  }
+   
+  for (Int_t i = 1; i <= 3; i++) {
+    for (Int_t j = 0;  j < 2; j++) {
+      if (i == 1 && j == 1) break;
+      char c;
+      switch (j) {
+      case 0: c = 'I'; break;
+      case 1: c = 'O'; break;
+      }
+       
+      name = Form("F%d%cH", i, c);
+      gMC->Gsatt(name.Data(),"seen",-2); // Honeycomp top 
+
+      name = Form("F%d%cI", i, c);
+      gMC->Gsatt(name.Data(),"seen",-2); // Honeycomp bottom
+
+      name = Form("F%d%cJ", i, c);
+      gMC->Gsatt(name.Data(),"seen",0); // Honeycomp inner top 
+
+      name = Form("F%d%cK", i, c);
+      gMC->Gsatt(name.Data(),"seen",0); // Honeycomp inner bottom 
+    }
+  }
+
+  gMC->Gsatt("F3SN", "seen", 1); // Nose of FMD3 Cone
+  gMC->Gsatt("F3SB", "seen", 1); // Back of FMD3 Cone
+  gMC->Gsatt("F3SL", "seen", 1); // Beams of FMD3 Cone
+  gMC->Gsatt("F3SF", "seen", 1); // Flanges on FMD3 Cone
 }