Renaming AliPHOSv0hits to AliPHOSv1 and AliPHOSv1 to AliPHOSv2 to comply with the...
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 31 May 2000 09:37:05 +0000 (09:37 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 31 May 2000 09:37:05 +0000 (09:37 +0000)
PHOS/AliPHOSv1.cxx
PHOS/AliPHOSv1.h
PHOS/AliPHOSv2.cxx [new file with mode: 0644]
PHOS/AliPHOSv2.h [new file with mode: 0644]
PHOS/Makefile
PHOS/PHOSLinkDef.h

index 6b1c6f291caee8f221ee06cdb81507393b398730..955a88a0edb6d4cace732915c7919d2939356732 100644 (file)
  **************************************************************************/
 
 /* $Id$ */
-
 //_________________________________________________________________________
-// Implementation version v0 of PHOS Manager class 
-// Layout EMC + PPSD has name GPS2  
-// The main goal of this version of AliPHOS is to calculte the 
-//  induced charged in the PIN diode, taking into account light
-//  tracking in the PbWO4 crystal, induced signal in the 
-//  PIN due to MIPS particle and electronic noise.
-// This is done in the StepManager 
+// Version of AliPHOSv0 which allows for keeping all hits in TreeH
 //                  
-//*-- Author:  Odd Harald Oddland & Gines Martinez (SUBATECH)
+//*-- Author: Gines MARTINEZ (SUBATECH)
 
 
 // --- ROOT system ---
+
+#include "TBRIK.h"
+#include "TNode.h"
 #include "TRandom.h"
 
 // --- Standard library ---
 #include "AliPHOSv1.h"
 #include "AliPHOSHit.h"
 #include "AliPHOSDigit.h"
+#include "AliPHOSReconstructioner.h"
 #include "AliRun.h"
 #include "AliConst.h"
 
 ClassImp(AliPHOSv1)
 
+//____________________________________________________________________________
+AliPHOSv1::AliPHOSv1()
+{
+  // default ctor
+  fNTmpHits = 0 ; 
+  fTmpHits  = 0 ; 
+}
+
 //____________________________________________________________________________
 AliPHOSv1::AliPHOSv1(const char *name, const char *title):
   AliPHOSv0(name,title)
 {
-  // ctor 
-
-  // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using 
-  // following formula
-  // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency * 
-  //                     exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
-  //                     RecalibrationFactor ;
-  // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
-  // PINEfficiency is 0.1875 from Odd Harald Odland work
-  // k_0 is 0.0045 from Valery Antonenko 
-
-  fLightYieldMean = 700000. ;
-  fIntrinsicPINEfficiency = 0.1875 ;
-  fLightYieldAttenuation = 0.0045 ;
-  fRecalibrationFactor = 6.2 / fLightYieldMean ;
-  fElectronsPerGeV = 2.77e+8 ; 
+  // ctor
+   fHits= new TClonesArray("AliPHOSHit",1000) ;
 }
 
 //____________________________________________________________________________
-AliPHOSv1::AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
-  AliPHOSv0(Reconstructioner,name,title)
+AliPHOSv1::~AliPHOSv1()
 {
-  // ctor 
-
-  // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using 
-  // following formula
-  // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency * 
-  //                     exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
-  //                     RecalibrationFactor ;
-  // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
-  // PINEfficiency is 0.1875 from Odd Harald Odland work
-  // k_0 is 0.0045 from Valery Antonenko 
-
-  fLightYieldMean = 700000.;
-  fIntrinsicPINEfficiency = 0.1875 ;
-  fLightYieldAttenuation = 0.0045 ;
-  fRecalibrationFactor = 6.2 / fLightYieldMean ;
-  fElectronsPerGeV = 2.77e+8 ;
+  // dtor
+  fTmpHits->Delete() ; 
+  delete fTmpHits ;
+  fTmpHits = 0 ; 
+
+  fEmcRecPoints->Delete() ; 
+  delete fEmcRecPoints ; 
+  fEmcRecPoints = 0 ; 
+
+  fPpsdRecPoints->Delete() ;
+  delete fPpsdRecPoints ;
+  fPpsdRecPoints = 0 ; 
+
+  fTrackSegments->Delete() ; 
+  delete fTrackSegments ;
+  fTrackSegments = 0 ; 
 }
 
 //____________________________________________________________________________
+void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits)
+{
+  // Add a hit to the hit list.
+  // In this version of AliPHOSv0, a PHOS hit is real geant 
+  // hits in a single crystal or in a single PPSD gas cell
+
+  // cout << "Primary is " << primary << endl;
+  //cout << "Tracknumber is " << tracknumber << endl;
+  //cout << "Vol Id is " << Id << endl;
+  //cout << "hits is " << hits[0] << "  " << hits[1] << "  " << hits[2] << "   " << hits[3] <<endl;
+
+  //  cout << " Adding a hit number " << fNhits << endl ;
+
+  TClonesArray &ltmphits = *fHits ;
+  AliPHOSHit *newHit ;
+
+  //  fHits->Print("");
+
+  newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ;
+
+  // We DO want to save in TreeH the raw hits 
+  //  TClonesArray &lhits = *fHits;
+  //  cout << " Adding a hit to fHits TCloneArray number " << fNhits << endl ;     
+  new(ltmphits[fNhits]) AliPHOSHit(*newHit) ;
+  fNhits++ ;
+
+  // cout << " Added a hit to fHits TCloneArray number " << fNhits << endl ; 
+  // We do not want to save in TreeH the raw hits 
+  //   new(lhits[fNhits]) AliPHOSHit(*newHit) ;    
+  //   fNhits++ ;
+
+  // Please note that the fTmpHits array must survive up to the
+  // end of the events, so it does not appear e.g. in ResetHits() (
+  // which is called at the end of each primary).  
+
+  delete newHit;
+
+}
+
+
+
+
+//___________________________________________________________________________
+void AliPHOSv1::FinishEvent()
+{
+  // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell
+  // Adds to the energy the electronic noise
+  // Keeps digits with energy above fDigitThreshold
+
+  // Save the cumulated hits instead of raw hits (need to create the branch myself)
+  // It is put in the Digit Tree because the TreeH is filled after each primary
+  // and the TreeD at the end of the event.
+  
+  Int_t i ;
+  Int_t relid[4];
+  Int_t j ; 
+  TClonesArray &lDigits = *fDigits ;
+  AliPHOSHit  * hit ;
+  AliPHOSDigit * newdigit ;
+  AliPHOSDigit * curdigit ;
+  Bool_t deja = kFALSE ; 
+  
+  for ( i = 0 ; i < fNhits ; i++ ) {
+    hit = (AliPHOSHit*)fHits->At(i) ;
+    newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
+    deja =kFALSE ;
+    for ( j = 0 ; j < fNdigits ;  j++) { 
+      curdigit = (AliPHOSDigit*) lDigits[j] ;
+      if ( *curdigit == *newdigit) {
+       *curdigit = *curdigit + *newdigit ; 
+       deja = kTRUE ; 
+      }
+    }
+    if ( !deja ) {
+      new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
+      fNdigits++ ;  
+    }
+    delete newdigit ;    
+  } 
+  
+  // Noise induced by the PIN diode of the PbWO crystals
+
+  Float_t energyandnoise ;
+  for ( i = 0 ; i < fNdigits ; i++ ) {
+    newdigit =  (AliPHOSDigit * ) fDigits->At(i) ;
+    fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
+
+    if (relid[1]==0){   // Digits belong to EMC (PbW0_4 crystals)
+      energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
+
+      if (energyandnoise < 0 ) 
+       energyandnoise = 0 ;
+
+      if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
+       fDigits->RemoveAt(i) ; 
+    }
+  }
+  
+  fDigits->Compress() ;  
+
+  fNdigits =  fDigits->GetEntries() ; 
+  for (i = 0 ; i < fNdigits ; i++) { 
+    newdigit = (AliPHOSDigit *) fDigits->At(i) ; 
+    newdigit->SetIndexInList(i) ; 
+  }
+
+}
+
 void AliPHOSv1::StepManager(void)
 {
   // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
-  // Adds the energy deposited in the PIN diode
 
   Int_t          relid[4] ;      // (box, layer, row, column) indices
   Float_t        xyze[4] ;       // position wrt MRS and energy deposited
   TLorentzVector pos ;
-  Int_t copy;
-  Float_t        lightyield ;   // Light Yield per GeV
-  Float_t        nElectrons ;   // Number of electrons in the PIN diode
-  TString name = fGeom->GetName() ; 
-  Float_t        global[3] ;
-  Float_t        local[3] ;
-  Float_t        lostenergy ;
+  Int_t copy ;
 
-  Int_t primary =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
+  Int_t tracknumber =  gAlice->CurrentTrack() ; 
+  Int_t primary     =  gAlice->GetPrimary( gAlice->CurrentTrack() );
 
+  TString name = fGeom->GetName() ; 
   if ( name == "GPS2" ) { // the CPV is a PPSD
     if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell 
     {
@@ -117,8 +212,7 @@ void AliPHOSv1::StepManager(void)
       xyze[0] = pos[0] ;
       xyze[1] = pos[1] ;
       xyze[2] = pos[2] ;
-      xyze[3] = gMC->Edep() ;
-
+      xyze[3] = gMC->Edep() ; 
 
       if ( xyze[3] != 0 ) { // there is deposited energy 
                gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
@@ -131,81 +225,39 @@ void AliPHOSv1::StepManager(void)
        // get the absolute Id number
 
        Int_t absid ; 
-               fGeom->RelToAbsNumbering(relid,absid) ; 
-       
+               fGeom->RelToAbsNumbering(relid, absid) ; 
 
-       AddHit(primary, absid, xyze );
+       // add current hit to the hit list      
+       AddHit(fIshunt, primary, tracknumber, absid, xyze);
 
       } // there is deposited energy 
      } // We are inside the gas of the CPV  
    } // GPS2 configuration
   
-  if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )//  We are inside a PBWO crystal 
+   if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )  //  We are inside a PBWO crystal
      {
        gMC->TrackPosition(pos) ;
        xyze[0] = pos[0] ;
        xyze[1] = pos[1] ;
        xyze[2] = pos[2] ;
-       lostenergy = gMC->Edep() ; 
        xyze[3] = gMC->Edep() ;
 
-       global[0] = pos[0] ;
-       global[1] = pos[1] ;
-       global[2] = pos[2] ;
-
        if ( xyze[3] != 0 ) {
           gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
-          relid[1] = 0   ;                    // means PW04
+          relid[1] = 0   ;                    // means PBW04
           gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
           gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
 
       // get the absolute Id number
 
           Int_t absid ; 
-          fGeom->RelToAbsNumbering(relid,absid) ; 
-         gMC->Gmtod(global, local, 1) ;
-         
-         // calculating number of electrons in the PIN diode asociated to this hit
-         lightyield = gRandom->Poisson(fLightYieldMean) ;
-         nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *
-           exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
-
-         xyze[3] = nElectrons * fRecalibrationFactor ;
-         // add current hit to the hit list
-          AddHit(primary, absid, xyze);
+          fGeom->RelToAbsNumbering(relid, absid) ; 
+      // add current hit to the hit list
+
+          AddHit(fIshunt, primary,tracknumber, absid, xyze);
     
        } // there is deposited energy
     } // we are inside a PHOS Xtal
-
-   if(gMC->CurrentVolID(copy) == gMC->VolId("PPIN") ) // We are inside de PIN diode 
-     {
-       gMC->TrackPosition(pos) ;
-       xyze[0] = pos[0] ;
-       xyze[1] = pos[1] ;
-       xyze[2] = pos[2] ;
-       lostenergy = gMC->Edep() ;
-       xyze[3] = gMC->Edep() ;
-
-       if ( xyze[3] != 0 ) {
-          gMC->CurrentVolOffID(11, relid[0]) ; // get the PHOS module number ;
-          relid[1] = 0   ;                    // means PW04 and PIN
-          gMC->CurrentVolOffID(5, relid[2]) ; // get the row number inside the module
-          gMC->CurrentVolOffID(4, relid[3]) ; // get the cell number inside the module
-
-      // get the absolute Id number
-
-          Int_t absid ; 
-          fGeom->RelToAbsNumbering(relid,absid) ;
-         
-         // calculating number of electrons in the PIN diode asociated to this hit
-         nElectrons = lostenergy * fElectronsPerGeV ;
-         xyze[3] = nElectrons * fRecalibrationFactor ;
-
-         // add current hit to the hit list
-          AddHit(primary, absid, xyze);
-         //printf("PIN volume is  %d, %d, %d, %d \n",relid[0],relid[1],relid[2],relid[3]);
-         //printf("Lost energy in the PIN is %f \n",lostenergy) ;
-       } // there is deposited energy
-    } // we are inside a PHOS XtalPHOS PIN diode
 }
 
index d843edb7e6707e7c01689737c894dd79b6e34382..a61df17a4cb24739ef9fd8665847e2e787579dcf 100644 (file)
@@ -1,47 +1,36 @@
 #ifndef ALIPHOSV1_H
 #define ALIPHOSV1_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* Copyright(c) 1998-1999-2000, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
-
 //_________________________________________________________________________
-// Implementation version v0 of PHOS Manager class 
-// Layout EMC + PPSD has name GPS2  
-// The main goal of this version of AliPHOS is to calculte the 
-//  induced charged in the PIN diode, taking into account light
-//  tracking in the PbWO4 crystal, induced signal in the 
-//  PIN due to MIPS particle and electronic noise.
-// This is done in the StepManager 
+// Version of AliPHOSv0 which allows for keeping all hits in TreeH
+//  This version is NOT recommended for Reconstruction analysis
 //                  
-//*-- Author:  Odd Harald Oddland & Gines Martinez (SUBATECH)
+//*-- Author: Gines MARTINEZ (SUBATECH)
 
 // --- ROOT system ---
-
+#include "TClonesArray.h"
 
 // --- AliRoot header files ---
 #include "AliPHOSv0.h"
-
+#include "AliPHOSReconstructioner.h"
 
 class AliPHOSv1 : public AliPHOSv0 {
 
 public:
 
-  AliPHOSv1(void) : AliPHOSv0() {} // ctor 
+  AliPHOSv1(void) ;
   AliPHOSv1(const char *name, const char *title="") ;
-  AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title="") ;
-  virtual ~AliPHOSv1(void) {} 
-                            
-  virtual void   StepManager(void) ;                                // does the tracking through PHOS and a preliminary digitalization
-  
-private:
-  
-  Float_t fLightYieldMean ;         // Mean lightyield in the PbOW4 xtal per GeV (Poisson distribution)
-  Float_t fIntrinsicPINEfficiency ; // Photo efficiency of the PIN diode   
-  Float_t fLightYieldAttenuation ;  // Attenuation of the light through the crystal
-  Float_t fRecalibrationFactor ;    // Recalibration factor
-  Float_t fElectronsPerGeV ;        // Number of electrons per GeV created in the PIN by a ionizing particle
-
-  ClassDef(AliPHOSv1,1)  // Implementation of PHOS manager class for layout EMC+PPSD with light transport, MIPS in PIN and electronic noise
+  virtual ~AliPHOSv1(void) ;
+
+  virtual void   AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) ; 
+// adds a hit to the hit tree (any pre=digitalization is done here (so large root file !!) 
+  void            FinishEvent(void) ;          // makes the digits from the hits 
+  virtual void    StepManager(void) ;  // StepManager to keep current tack number in the hit
+
+protected:
+
+  ClassDef(AliPHOSv1,1)  // Class AliPHOSv0 which allows to write ond disk al the information of the hits. 
 
 };
 
diff --git a/PHOS/AliPHOSv2.cxx b/PHOS/AliPHOSv2.cxx
new file mode 100644 (file)
index 0000000..aaee915
--- /dev/null
@@ -0,0 +1,211 @@
+/**************************************************************************
+ * 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$ */
+
+//_________________________________________________________________________
+// Implementation version v0 of PHOS Manager class 
+// Layout EMC + PPSD has name GPS2  
+// The main goal of this version of AliPHOS is to calculte the 
+//  induced charged in the PIN diode, taking into account light
+//  tracking in the PbWO4 crystal, induced signal in the 
+//  PIN due to MIPS particle and electronic noise.
+// This is done in the StepManager 
+//                  
+//*-- Author:  Odd Harald Oddland & Gines Martinez (SUBATECH)
+
+
+// --- ROOT system ---
+#include "TRandom.h"
+
+// --- Standard library ---
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <strstream.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSv2.h"
+#include "AliPHOSHit.h"
+#include "AliPHOSDigit.h"
+#include "AliRun.h"
+#include "AliConst.h"
+
+ClassImp(AliPHOSv2)
+
+//____________________________________________________________________________
+AliPHOSv2::AliPHOSv2(const char *name, const char *title):
+  AliPHOSv0(name,title)
+{
+  // ctor 
+
+  // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using 
+  // following formula
+  // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency * 
+  //                     exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
+  //                     RecalibrationFactor ;
+  // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
+  // PINEfficiency is 0.1875 from Odd Harald Odland work
+  // k_0 is 0.0045 from Valery Antonenko 
+
+  fLightYieldMean = 700000. ;
+  fIntrinsicPINEfficiency = 0.1875 ;
+  fLightYieldAttenuation = 0.0045 ;
+  fRecalibrationFactor = 6.2 / fLightYieldMean ;
+  fElectronsPerGeV = 2.77e+8 ; 
+}
+
+//____________________________________________________________________________
+AliPHOSv2::AliPHOSv2(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
+  AliPHOSv0(Reconstructioner,name,title)
+{
+  // ctor 
+
+  // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using 
+  // following formula
+  // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency * 
+  //                     exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
+  //                     RecalibrationFactor ;
+  // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
+  // PINEfficiency is 0.1875 from Odd Harald Odland work
+  // k_0 is 0.0045 from Valery Antonenko 
+
+  fLightYieldMean = 700000.;
+  fIntrinsicPINEfficiency = 0.1875 ;
+  fLightYieldAttenuation = 0.0045 ;
+  fRecalibrationFactor = 6.2 / fLightYieldMean ;
+  fElectronsPerGeV = 2.77e+8 ;
+}
+
+//____________________________________________________________________________
+void AliPHOSv2::StepManager(void)
+{
+  // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
+  // Adds the energy deposited in the PIN diode
+
+  Int_t          relid[4] ;      // (box, layer, row, column) indices
+  Float_t        xyze[4] ;       // position wrt MRS and energy deposited
+  TLorentzVector pos ;
+  Int_t copy;
+  Float_t        lightyield ;   // Light Yield per GeV
+  Float_t        nElectrons ;   // Number of electrons in the PIN diode
+  TString name = fGeom->GetName() ; 
+  Float_t        global[3] ;
+  Float_t        local[3] ;
+  Float_t        lostenergy ;
+
+  Int_t primary =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
+
+  if ( name == "GPS2" ) { // the CPV is a PPSD
+    if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell 
+    {
+      gMC->TrackPosition(pos) ;
+      xyze[0] = pos[0] ;
+      xyze[1] = pos[1] ;
+      xyze[2] = pos[2] ;
+      xyze[3] = gMC->Edep() ;
+
+
+      if ( xyze[3] != 0 ) { // there is deposited energy 
+               gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
+               gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
+      // 1-> Geom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() upper                         
+      //  >  fGeom->GetNumberOfModulesPhi()  *  fGeom->GetNumberOfModulesZ() lower
+               gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
+        gMC->CurrentVolID(relid[3]) ;        // get the column number 
+
+       // get the absolute Id number
+
+       Int_t absid ; 
+               fGeom->RelToAbsNumbering(relid,absid) ; 
+       
+
+       AddHit(primary, absid, xyze );
+
+      } // there is deposited energy 
+     } // We are inside the gas of the CPV  
+   } // GPS2 configuration
+  
+  if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )//  We are inside a PBWO crystal 
+     {
+       gMC->TrackPosition(pos) ;
+       xyze[0] = pos[0] ;
+       xyze[1] = pos[1] ;
+       xyze[2] = pos[2] ;
+       lostenergy = gMC->Edep() ; 
+       xyze[3] = gMC->Edep() ;
+
+       global[0] = pos[0] ;
+       global[1] = pos[1] ;
+       global[2] = pos[2] ;
+
+       if ( xyze[3] != 0 ) {
+          gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
+          relid[1] = 0   ;                    // means PW04
+          gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
+          gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
+
+      // get the absolute Id number
+
+          Int_t absid ; 
+          fGeom->RelToAbsNumbering(relid,absid) ; 
+         gMC->Gmtod(global, local, 1) ;
+         
+         // calculating number of electrons in the PIN diode asociated to this hit
+         lightyield = gRandom->Poisson(fLightYieldMean) ;
+         nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *
+           exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
+
+         xyze[3] = nElectrons * fRecalibrationFactor ;
+         // add current hit to the hit list
+          AddHit(primary, absid, xyze);
+    
+       } // there is deposited energy
+    } // we are inside a PHOS Xtal
+
+   if(gMC->CurrentVolID(copy) == gMC->VolId("PPIN") ) // We are inside de PIN diode 
+     {
+       gMC->TrackPosition(pos) ;
+       xyze[0] = pos[0] ;
+       xyze[1] = pos[1] ;
+       xyze[2] = pos[2] ;
+       lostenergy = gMC->Edep() ;
+       xyze[3] = gMC->Edep() ;
+
+       if ( xyze[3] != 0 ) {
+          gMC->CurrentVolOffID(11, relid[0]) ; // get the PHOS module number ;
+          relid[1] = 0   ;                    // means PW04 and PIN
+          gMC->CurrentVolOffID(5, relid[2]) ; // get the row number inside the module
+          gMC->CurrentVolOffID(4, relid[3]) ; // get the cell number inside the module
+
+      // get the absolute Id number
+
+          Int_t absid ; 
+          fGeom->RelToAbsNumbering(relid,absid) ;
+         
+         // calculating number of electrons in the PIN diode asociated to this hit
+         nElectrons = lostenergy * fElectronsPerGeV ;
+         xyze[3] = nElectrons * fRecalibrationFactor ;
+
+         // add current hit to the hit list
+          AddHit(primary, absid, xyze);
+         //printf("PIN volume is  %d, %d, %d, %d \n",relid[0],relid[1],relid[2],relid[3]);
+         //printf("Lost energy in the PIN is %f \n",lostenergy) ;
+       } // there is deposited energy
+    } // we are inside a PHOS XtalPHOS PIN diode
+}
+
diff --git a/PHOS/AliPHOSv2.h b/PHOS/AliPHOSv2.h
new file mode 100644 (file)
index 0000000..9e0590c
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef ALIPHOSV2_H
+#define ALIPHOSV2_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//_________________________________________________________________________
+// Implementation version v0 of PHOS Manager class 
+// Layout EMC + PPSD has name GPS2  
+// The main goal of this version of AliPHOS is to calculte the 
+//  induced charged in the PIN diode, taking into account light
+//  tracking in the PbWO4 crystal, induced signal in the 
+//  PIN due to MIPS particle and electronic noise.
+// This is done in the StepManager 
+//                  
+//*-- Author:  Odd Harald Oddland & Gines Martinez (SUBATECH)
+
+// --- ROOT system ---
+
+
+// --- AliRoot header files ---
+#include "AliPHOSv0.h"
+
+
+class AliPHOSv2 : public AliPHOSv0 {
+
+public:
+
+  AliPHOSv2(void) : AliPHOSv0() {
+    // ctor
+  }
+  AliPHOSv2(const char *name, const char *title="") ;
+  AliPHOSv2(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title="") ;
+  virtual ~AliPHOSv2(void) {
+    // dtor
+  } 
+                            
+  virtual void   StepManager(void) ;                                // does the tracking through PHOS and a preliminary digitalization
+  
+private:
+  
+  Float_t fLightYieldMean ;         // Mean lightyield in the PbOW4 xtal per GeV (Poisson distribution)
+  Float_t fIntrinsicPINEfficiency ; // Photo efficiency of the PIN diode   
+  Float_t fLightYieldAttenuation ;  // Attenuation of the light through the crystal
+  Float_t fRecalibrationFactor ;    // Recalibration factor
+  Float_t fElectronsPerGeV ;        // Number of electrons per GeV created in the PIN by a ionizing particle
+
+  ClassDef(AliPHOSv2,1)  // Implementation of PHOS manager class for layout EMC+PPSD with light transport, MIPS in PIN and electronic noise
+
+};
+
+#endif // AliPHOSV2_H
index 35a005243c1b8993805b667bc4154a8946481d15..fee14dd6f55121b8e1490b006d089df2414ddfa6 100644 (file)
@@ -9,7 +9,7 @@ PACKAGE = PHOS
 
 # C++ sources
 
-SRCS          =  AliPHOS.cxx AliPHOSv0.cxx AliPHOSv0hits.cxx AliPHOSv1.cxx AliPHOSHit.cxx \
+SRCS          =  AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx AliPHOSv2.cxx AliPHOSHit.cxx \
                  AliPHOSGeometry.cxx \
                  AliPHOSDigit.cxx  \
                  AliPHOSRecPoint.cxx AliPHOSEmcRecPoint.cxx AliPHOSPpsdRecPoint.cxx \
index 482af7c1e7a8afed3ac95c7705ae23604be80e31..34d3db1e1af4f3bd266563f938746b1d89b556f9 100644 (file)
@@ -18,8 +18,8 @@
 #pragma link C++ class AliPHOSReconstructioner ;
 #pragma link C++ class AliPHOSRecPoint ;
 #pragma link C++ class AliPHOSv0 ;
-#pragma link C++ class AliPHOSv0hits ;
 #pragma link C++ class AliPHOSv1 ;
+#pragma link C++ class AliPHOSv2 ;
 #pragma link C++ class AliPHOSTrackSegment ;
 #pragma link C++ class AliPHOSTrackSegmentMaker ;
 #pragma link C++ class AliPHOSTrackSegmentMakerv1 ;