/* $Id$ */
//_________________________________________________________________________
-// Algorythm class to analyze PHOSv0 events:
+// Algorythm class to analyze PHOSv1 events:
// Construct histograms and displays them.
// Use the macro EditorBar.C for best access to the functionnalities
//
}
else {
gAlice = (AliRun*) fRootFile->Get("gAlice");
- fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
+ fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ) ;
fEvt = -999 ;
}
//========== Get AliRun object from file
gAlice = (AliRun*) fRootFile->Get("gAlice") ;
//=========== Get the PHOS object and associated geometry from the file
- fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
+ fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
//========== Booking Histograms
cout << "AnalyzeManyEvents > " << "Booking Histograms" << endl ;
//=========== Get the PHOS object and associated geometry from the file
- fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
+ fPHOS = (AliPHOSv1 *)gAlice->GetDetector("PHOS") ;
fGeom = AliPHOSGeometry::GetInstance( fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() );
} // else !ok
/* $Id$ */
//_________________________________________________________________________
-// Algorithm class to analyze PHOSv0 events
+// Algorithm class to analyze PHOSv1 events
//*-- Author : Yves Schutz (SUBATECH)
// --- ROOT system ---
// --- AliRoot header files ---
-#include "AliPHOSv0.h"
+#include "AliPHOSv1.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSPID.h"
#include "AliPHOSIndexToObject.h"
Int_t fEvt ; // the evt number being processed
AliPHOSGeometry * fGeom ; // the PHOS Geometry object
AliPHOSIndexToObject * fObjGetter ; // provides methods to retrieve objects from their index in a list
- AliPHOSv0 * fPHOS ; // the PHOS object from the root file
+ AliPHOSv1 * fPHOS ; // the PHOS object from the root file
AliPHOSPID * fPID ; // a particle identifier
AliPHOSReconstructioner * fRec ; // a reconstructioner
TFile * fRootFile ; // the root file that contains the data
TH1F * fhPhotonHadronPositionY ; // Y distribution of detected Photon-Hadron
-ClassDef(AliPHOSAnalyze,1) // PHOSv0 event analyzis algorithm
+ClassDef(AliPHOSAnalyze,1) // PHOSv1 event analyzis algorithm
};
//_________________________________________________________________________
// Implementation version v0 of PHOS Manager class
// Layout EMC + PPSD has name GPS2
+// An object of this class does not produce hits nor digits
+// It is the one to use if you do not want to produce outputs in TREEH or TREED
//
//*-- Author: Yves Schutz (SUBATECH)
// --- AliRoot header files ---
#include "AliPHOSv0.h"
-#include "AliPHOSHit.h"
-#include "AliPHOSDigit.h"
-#include "AliPHOSReconstructioner.h"
#include "AliRun.h"
#include "AliConst.h"
ClassImp(AliPHOSv0)
-//____________________________________________________________________________
-AliPHOSv0::AliPHOSv0()
-{
- // ctor
- fNTmpHits = 0 ;
- fTmpHits = 0 ;
-}
-
//____________________________________________________________________________
AliPHOSv0::AliPHOSv0(const char *name, const char *title):
AliPHOS(name,title)
{
// ctor : title is used to identify the layout
// GPS2 = 5 modules (EMC + PPSD)
- // We use 2 arrays of hits :
- //
- // - fHits (the "normal" one), which retains the hits associated with
- // the current primary particle being tracked
- // (this array is reset after each primary has been tracked).
- //
- // - fTmpHits, which retains all the hits of the current event. It
- // is used for the digitization part.
-
- fPinElectronicNoise = 0.010 ;
- fDigitThreshold = 1. ; // 1 GeV
-
- // We do not want to save in TreeH the raw hits
- // fHits = new TClonesArray("AliPHOSHit",100) ;
- // gAlice->AddHitList(fHits) ;
-
- // But save the cumulated hits instead (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 (branch is set in FinishEvent() ).
-
- fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
-
- fNTmpHits = fNhits = 0 ;
-
- fDigits = new TClonesArray("AliPHOSDigit",1000) ;
-
-
- fIshunt = 1 ; // All hits are associated with primary particles
// gets an instance of the geometry parameters class
else
cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
- // For reconstruction
- // fEmcRecPoints = new TObjArray(1000);
- //fPpsdRecPoints = new TObjArray(1000);
- //fRecParticles = new TClonesArray("AliPHOSRecParticle", 1000) ;
- //fTrackSegments = new TClonesArray("AliPHOSTrackSegment", 1000) ;
-}
-
-//____________________________________________________________________________
-AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
- AliPHOS(name,title)
-{
- // ctor : title is used to identify the layout
- // GPS2 = 5 modules (EMC + PPSD)
- // We use 2 arrays of hits :
- //
- // - fHits (the "normal" one), which retains the hits associated with
- // the current primary particle being tracked
- // (this array is reset after each primary has been tracked).
- //
- // - fTmpHits, which retains all the hits of the current event. It
- // is used for the digitization part.
-
- fPinElectronicNoise = 0.010 ;
-
- // We do not want to save in TreeH the raw hits
- //fHits = new TClonesArray("AliPHOSHit",100) ;
-
- fDigits = new TClonesArray("AliPHOSDigit",1000) ;
- fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
-
- fNTmpHits = fNhits = 0 ;
-
- fIshunt = 1 ; // All hits are associated with primary particles
-
- // gets an instance of the geometry parameters class
- fGeom = AliPHOSGeometry::GetInstance(title, "") ;
-
- if (fGeom->IsInitialized() )
- cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
- else
- cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
-
- // Defining the PHOS Reconstructioner
-
- fReconstructioner = Reconstructioner ;
-
-
-}
-
-//____________________________________________________________________________
-AliPHOSv0::~AliPHOSv0()
-{
- // dtor
-
- if ( fTmpHits) {
- fTmpHits->Delete() ;
- delete fTmpHits ;
- fTmpHits = 0 ;
- }
-
- if ( fEmcRecPoints ) {
- fEmcRecPoints->Delete() ;
- delete fEmcRecPoints ;
- fEmcRecPoints = 0 ;
- }
-
- if ( fPpsdRecPoints ) {
- fPpsdRecPoints->Delete() ;
- delete fPpsdRecPoints ;
- fPpsdRecPoints = 0 ;
- }
-
- if ( fTrackSegments ) {
- fTrackSegments->Delete() ;
- delete fTrackSegments ;
- fTrackSegments = 0 ;
- }
-
}
-//____________________________________________________________________________
-void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
-{
- // Add a hit to the hit list.
- // A PHOS hit is the sum of all hits in a single crystal
- // or in a single PPSD gas cell
-
- Int_t hitCounter ;
- TClonesArray <mphits = *fTmpHits ;
- AliPHOSHit *newHit ;
- AliPHOSHit *curHit ;
- // AliPHOSHit *curHit2 ;
- Bool_t deja = kFALSE ;
-
- // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
-
- newHit = new AliPHOSHit(primary, Id, hits) ;
-
- // We do not want to save in TreeH the raw hits
- // TClonesArray &lhits = *fHits;
-
- for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
- curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
- if( *curHit == *newHit ) {
- *curHit = *curHit + *newHit ;
- deja = kTRUE ;
- }
- }
-
- if ( !deja ) {
- new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
- fNTmpHits++ ;
- }
-
- // 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 AliPHOSv0::BuildGeometry()
{
}
-//___________________________________________________________________________
-Int_t AliPHOSv0::Digitize(Float_t Energy)
-{
- // Applies the energy calibration
-
- Float_t fB = 100000000. ;
- Float_t fA = 0. ;
- Int_t chan = Int_t(fA + Energy*fB ) ;
- return chan ;
-}
-
-//___________________________________________________________________________
-void AliPHOSv0::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 < fNTmpHits ; i++ ) {
- hit = (AliPHOSHit*)fTmpHits->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 AliPHOSv0::Init(void)
}
-//___________________________________________________________________________
-void AliPHOSv0::MakeBranch(Option_t* opt)
-{
- // Create new branche in the current Root Tree in the digit Tree
-
- AliDetector::MakeBranch(opt) ;
-
- char branchname[10];
- sprintf(branchname,"%s",GetName());
- char *cdD = strstr(opt,"D");
- if (fDigits && gAlice->TreeD() && cdD) {
- gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
- }
-
- // Create new branche PHOSCH in the current Root Tree in the digit Tree for accumulated Hits
- if ( ! (gAlice->IsLegoRun()) ) { // only when not in lego plot mode
- if ( fTmpHits && gAlice->TreeD() && cdD) {
- char branchname[10] ;
- sprintf(branchname, "%sCH", GetName()) ;
- gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
- }
- }
-
-}
-
-
-//_____________________________________________________________________________
-void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
-{
- // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
- // 2. Creates TreeR with a branch for each list
- // 3. Steers the reconstruction processes
- // 4. Saves the 3 lists in TreeR
- // 5. Write the Tree to File
-
- fReconstructioner = Reconstructioner ;
-
- char branchname[10] ;
-
- // 1.
-
- // gAlice->MakeTree("R") ;
- Int_t splitlevel = 0 ;
-
- if (fEmcRecPoints) {
- fEmcRecPoints->Delete() ;
- delete fEmcRecPoints ;
- fEmcRecPoints = 0 ;
- }
-
- // fEmcRecPoints= new AliPHOSRecPoint::RecPointsList("AliPHOSEmcRecPoint", 1000) ; if TClonesArray
- fEmcRecPoints= new AliPHOSRecPoint::RecPointsList(2000) ;
-
- if ( fEmcRecPoints && gAlice->TreeR() ) {
- sprintf(branchname,"%sEmcRP",GetName()) ;
-
- // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray
- gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
- }
-
- if (fPpsdRecPoints) {
- fPpsdRecPoints->Delete() ;
- delete fPpsdRecPoints ;
- fPpsdRecPoints = 0 ;
- }
-
- // fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList("AliPHOSPpsdRecPoint", 1000) ; if TClonesArray
- fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList(2000) ;
-
- if ( fPpsdRecPoints && gAlice->TreeR() ) {
- sprintf(branchname,"%sPpsdRP",GetName()) ;
-
- // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray
- gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
- }
-
- if (fTrackSegments) {
- fTrackSegments->Delete() ;
- delete fTrackSegments ;
- fTrackSegments = 0 ;
- }
-
- fTrackSegments = new AliPHOSTrackSegment::TrackSegmentsList("AliPHOSTrackSegment", 2000) ;
- if ( fTrackSegments && gAlice->TreeR() ) {
- sprintf(branchname,"%sTS",GetName()) ;
- gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
- }
-
- if (fRecParticles) {
- fRecParticles->Delete() ;
- delete fRecParticles ;
- fRecParticles = 0 ;
- }
- fRecParticles = new AliPHOSRecParticle::RecParticlesList("AliPHOSRecParticle", 2000) ;
- if ( fRecParticles && gAlice->TreeR() ) {
- sprintf(branchname,"%sRP",GetName()) ;
- gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
- }
-
- // 3.
-
- fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
-
- // 4. Expand or Shrink the arrays to the proper size
-
- Int_t size ;
-
- size = fEmcRecPoints->GetEntries() ;
- fEmcRecPoints->Expand(size) ;
-
- size = fPpsdRecPoints->GetEntries() ;
- fPpsdRecPoints->Expand(size) ;
-
- size = fTrackSegments->GetEntries() ;
- fTrackSegments->Expand(size) ;
-
- size = fRecParticles->GetEntries() ;
- fRecParticles->Expand(size) ;
-
- gAlice->TreeR()->Fill() ;
- cout << "filled" << endl ;
- // 5.
-
- gAlice->TreeR()->Write() ;
- cout << "writen" << endl ;
-
- // Deleting reconstructed objects
- ResetReconstruction();
-
-
-}
-
-//____________________________________________________________________________
-void AliPHOSv0::ResetDigits()
-{
- // May sound strange, but cumulative hits are store in digits Tree
- AliDetector::ResetDigits();
- if( fTmpHits ) {
- fTmpHits->Delete();
- fNTmpHits = 0 ;
- }
-}
-//____________________________________________________________________________
-void AliPHOSv0::ResetReconstruction()
-{
- // Deleting reconstructed objects
-
- if ( fEmcRecPoints ) fEmcRecPoints->Delete();
- if ( fPpsdRecPoints ) fPpsdRecPoints->Delete();
- if ( fTrackSegments ) fTrackSegments->Delete();
- if ( fRecParticles ) fRecParticles->Delete();
-
-}
-//____________________________________________________________________________
-
-//____________________________________________________________________________
-void AliPHOSv0::SetTreeAddress()
-{
- // TBranch *branch;
- AliPHOS::SetTreeAddress();
-
- // //Branch address for TreeR: RecPpsdRecPoint
-// TTree *treeR = gAlice->TreeR();
-// if ( treeR && fPpsdRecPoints ) {
-// branch = treeR->GetBranch("PHOSPpsdRP");
-// if (branch) branch->SetAddress(&fPpsdRecPoints) ;
- // }
-}
-
-//____________________________________________________________________________
-
-void AliPHOSv0::StepManager(void)
-{
- // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
-
- Int_t relid[4] ; // (box, layer, row, column) indices
- Float_t xyze[4] ; // position wrt MRS and energy deposited
- TLorentzVector pos ;
- Int_t copy ;
-
- 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
- {
- 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) ;
-
- // add current hit to the hit list
- 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] ;
- xyze[3] = gMC->Edep() ;
-
- if ( xyze[3] != 0 ) {
- gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
- 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) ;
-
- // add current hit to the hit list
-
- AddHit(primary, absid, xyze);
-
- } // there is deposited energy
- } // we are inside a PHOS Xtal
-}
-
public:
- AliPHOSv0(void) ;
+ AliPHOSv0(void){
+ // ctor
+ }
AliPHOSv0(const char *name, const char *title="") ;
AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title="") ;
AliPHOSv0(const AliPHOSv0 & phos) {
// cpy ctor: no implementation yet
// requested by the Coding Convention
assert(0==1) ;
- }
-
- virtual ~AliPHOSv0(void) ;
+ }
+ virtual ~AliPHOSv0(void){
+ // dtor
+ }
- virtual void AddHit( Int_t primary, Int_t id, Float_t *hits ) ; // adds a pre-digitilized hit to the hit tree
virtual void BuildGeometry(void) ; // creates the geometry for the ROOT display
void BuildGeometryforPHOS(void) ; // creates the PHOS geometry for the ROOT display
void BuildGeometryforPPSD(void) ; // creates the PPSD geometry for the ROOT display
virtual void CreateGeometry(void) ; // creates the geometry for GEANT
void CreateGeometryforPHOS(void) ; // creates the PHOS geometry for GEANT
void CreateGeometryforPPSD(void) ; // creates the PPSD geometry for GEANT
- Int_t Digitize(Float_t Energy);
- void FinishEvent(void) ; // makes the digits from the hits
virtual AliPHOSGeometry * GetGeometry() { return fGeom ; }
virtual void Init(void) ; // does nothing
Int_t IsVersion(void) const { return 0 ; }
- void MakeBranch(Option_t* opt) ;
- virtual AliPHOSRecPoint::RecPointsList * PpsdRecPoints() {
- // Getting list of PPSD RecPoints
- return fPpsdRecPoints ;
- }
- void Reconstruction(AliPHOSReconstructioner * Reconstructioner) ;
- void ResetClusters(){} ;
- virtual void ResetDigits() ;
- virtual void ResetReconstruction() ; // Reset reconstructed objects
- void SetReconstructioner(AliPHOSReconstructioner& Reconstructioner) {fReconstructioner = &Reconstructioner ;}
- void SetDigitThreshold(Float_t th) { fDigitThreshold = th ; }
- virtual void SetTreeAddress();
- virtual void StepManager(void) ; // does the tracking through PHOS and a preliminary digitalization
virtual TString Version(void){ return TString("v0"); }
-
+
AliPHOSv0 & operator = (const AliPHOSv0 & rvalue) {
// assignement operator requested by coding convention
// but not needed
assert(0==1) ;
return *this ;
}
-
-protected:
-
- Float_t fDigitThreshold ; // Threshold for the digit registration
+
+ protected:
+
AliPHOSGeometry * fGeom ; // Geometry definition
- Int_t fNTmpHits ; //! Used internally for digitalization
- Float_t fPinElectronicNoise ; // Electronic Noise in the PIN
- AliPHOSRecPoint::RecPointsList * fPpsdRecPoints ; // The RecPoints (clusters) list in PPSD
- AliPHOSReconstructioner * fReconstructioner ; // Reconstrutioner of the PHOS event: Clusterization and subtracking procedures
- TClonesArray * fTmpHits ; //! Used internally for digitalization
- AliPHOSTrackSegmentMaker * fTrackSegmentMaker ; // Reconstructioner of the PHOS track segment: 2 x PPSD + 1 x EMC
-
+
ClassDef(AliPHOSv0,1) // Implementation of PHOS manager class for layout EMC+PPSD
-
-};
-
+
+ };
+
#endif // AliPHOSV0_H
**************************************************************************/
/* $Id$ */
+
//_________________________________________________________________________
-// Version of AliPHOSv0 which allows for keeping all hits in TreeH
-//
-//*-- Author: Gines MARTINEZ (SUBATECH)
+// Implementation version v1 of PHOS Manager class
+// Layout EMC + PPSD has name GPS2
+// Produces cumulated hits (no hits) and digits
+//*-- Author: Yves Schutz (SUBATECH)
// --- ROOT system ---
#include "TNode.h"
#include "TRandom.h"
+
// --- Standard library ---
#include <stdio.h>
//____________________________________________________________________________
AliPHOSv1::AliPHOSv1()
{
- // default ctor
+ // ctor
fNTmpHits = 0 ;
fTmpHits = 0 ;
}
AliPHOSv1::AliPHOSv1(const char *name, const char *title):
AliPHOSv0(name,title)
{
- // ctor
- fHits= new TClonesArray("AliPHOSHit",1000) ;
+ // ctor : title is used to identify the layout
+ // GPS2 = 5 modules (EMC + PPSD)
+ // We use 2 arrays of hits :
+ //
+ // - fHits (the "normal" one), which retains the hits associated with
+ // the current primary particle being tracked
+ // (this array is reset after each primary has been tracked).
+ //
+ // - fTmpHits, which retains all the hits of the current event. It
+ // is used for the digitization part.
+
+ fPinElectronicNoise = 0.010 ;
+ fDigitThreshold = 1. ; // 1 GeV
+
+ // We do not want to save in TreeH the raw hits
+ // But save the cumulated hits instead (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 (branch is set in FinishEvent() ).
+
+ fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
+
+ fNTmpHits = fNhits = 0 ;
+
+ fDigits = new TClonesArray("AliPHOSDigit",1000) ;
+
+
+ fIshunt = 1 ; // All hits are associated with primary particles
+
+}
+
+//____________________________________________________________________________
+AliPHOSv1::AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
+ AliPHOSv0(name,title)
+{
+ // ctor : title is used to identify the layout
+ // GPS2 = 5 modules (EMC + PPSD)
+ // We use 2 arrays of hits :
+ //
+ // - fHits (the "normal" one), which retains the hits associated with
+ // the current primary particle being tracked
+ // (this array is reset after each primary has been tracked).
+ //
+ // - fTmpHits, which retains all the hits of the current event. It
+ // is used for the digitization part.
+
+ fPinElectronicNoise = 0.010 ;
+
+ // We do not want to save in TreeH the raw hits
+ //fHits = new TClonesArray("AliPHOSHit",100) ;
+
+ fDigits = new TClonesArray("AliPHOSDigit",1000) ;
+ fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
+
+ fNTmpHits = fNhits = 0 ;
+
+ fIshunt = 1 ; // All hits are associated with primary particles
+
+ // gets an instance of the geometry parameters class
+ fGeom = AliPHOSGeometry::GetInstance(title, "") ;
+
+ if (fGeom->IsInitialized() )
+ cout << "AliPHOSv1 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
+ else
+ cout << "AliPHOSv1 : PHOS geometry initialization failed !" << endl ;
+
+ // Defining the PHOS Reconstructioner
+
+ fReconstructioner = Reconstructioner ;
+
+
}
//____________________________________________________________________________
AliPHOSv1::~AliPHOSv1()
{
// dtor
+
if ( fTmpHits) {
fTmpHits->Delete() ;
delete fTmpHits ;
fTmpHits = 0 ;
}
-
- if ( fEmcRecPoints ) {
+
+ if ( fEmcRecPoints ) {
fEmcRecPoints->Delete() ;
delete fEmcRecPoints ;
fEmcRecPoints = 0 ;
}
-
+
if ( fPpsdRecPoints ) {
fPpsdRecPoints->Delete() ;
delete fPpsdRecPoints ;
fPpsdRecPoints = 0 ;
}
-
+
if ( fTrackSegments ) {
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;
+ // A PHOS hit is the sum of all hits in a single crystal
+ // or in a single PPSD gas cell
- // cout << " Adding a hit number " << fNhits << endl ;
-
- TClonesArray <mphits = *fHits ;
+ Int_t hitCounter ;
+ TClonesArray <mphits = *fTmpHits ;
AliPHOSHit *newHit ;
+ AliPHOSHit *curHit ;
+ Bool_t deja = kFALSE ;
- // fHits->Print("");
+ // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ;
- // We DO want to save in TreeH the raw hits
+ // We do not 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 ;
+ for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
+ curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
+ if( *curHit == *newHit ) {
+ *curHit = *curHit + *newHit ;
+ deja = kTRUE ;
+ }
+ }
+
+ if ( !deja ) {
+ new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
+ fNTmpHits++ ;
+ }
+
// We do not want to save in TreeH the raw hits
// new(lhits[fNhits]) AliPHOSHit(*newHit) ;
// fNhits++ ;
}
-
-
+//___________________________________________________________________________
+Int_t AliPHOSv1::Digitize(Float_t Energy)
+{
+ // Applies the energy calibration
+
+ Float_t fB = 100000000. ;
+ Float_t fA = 0. ;
+ Int_t chan = Int_t(fA + Energy*fB ) ;
+ return chan ;
+}
//___________________________________________________________________________
void AliPHOSv1::FinishEvent()
// 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 ;
AliPHOSDigit * curdigit ;
Bool_t deja = kFALSE ;
- for ( i = 0 ; i < fNhits ; i++ ) {
- hit = (AliPHOSHit*)fHits->At(i) ;
+ for ( i = 0 ; i < fNTmpHits ; i++ ) {
+ hit = (AliPHOSHit*)fTmpHits->At(i) ;
newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
deja =kFALSE ;
for ( j = 0 ; j < fNdigits ; j++) {
newdigit = (AliPHOSDigit *) fDigits->At(i) ;
newdigit->SetIndexInList(i) ;
}
+
+}
+
+//___________________________________________________________________________
+void AliPHOSv1::MakeBranch(Option_t* opt)
+{
+ // Create new branche in the current Root Tree in the digit Tree
+
+ AliDetector::MakeBranch(opt) ;
+
+ char branchname[10];
+ sprintf(branchname,"%s",GetName());
+ char *cdD = strstr(opt,"D");
+ if (fDigits && gAlice->TreeD() && cdD) {
+ gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
+ }
+
+ // Create new branche PHOSCH in the current Root Tree in the digit Tree for accumulated Hits
+ if ( ! (gAlice->IsLegoRun()) ) { // only when not in lego plot mode
+ if ( fTmpHits && gAlice->TreeD() && cdD) {
+ char branchname[10] ;
+ sprintf(branchname, "%sCH", GetName()) ;
+ gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
+ }
+ }
}
+
+//_____________________________________________________________________________
+void AliPHOSv1::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
+{
+ // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
+ // 2. Creates TreeR with a branch for each list
+ // 3. Steers the reconstruction processes
+ // 4. Saves the 3 lists in TreeR
+ // 5. Write the Tree to File
+
+ fReconstructioner = Reconstructioner ;
+
+ char branchname[10] ;
+
+ // 1.
+
+ // gAlice->MakeTree("R") ;
+ Int_t splitlevel = 0 ;
+
+ if (fEmcRecPoints) {
+ fEmcRecPoints->Delete() ;
+ delete fEmcRecPoints ;
+ fEmcRecPoints = 0 ;
+ }
+
+ // fEmcRecPoints= new AliPHOSRecPoint::RecPointsList("AliPHOSEmcRecPoint", 1000) ; if TClonesArray
+ fEmcRecPoints= new AliPHOSRecPoint::RecPointsList(2000) ;
+
+ if ( fEmcRecPoints && gAlice->TreeR() ) {
+ sprintf(branchname,"%sEmcRP",GetName()) ;
+
+ // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray
+ gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
+ }
+
+ if (fPpsdRecPoints) {
+ fPpsdRecPoints->Delete() ;
+ delete fPpsdRecPoints ;
+ fPpsdRecPoints = 0 ;
+ }
+
+ // fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList("AliPHOSPpsdRecPoint", 1000) ; if TClonesArray
+ fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList(2000) ;
+
+ if ( fPpsdRecPoints && gAlice->TreeR() ) {
+ sprintf(branchname,"%sPpsdRP",GetName()) ;
+
+ // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray
+ gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
+ }
+
+ if (fTrackSegments) {
+ fTrackSegments->Delete() ;
+ delete fTrackSegments ;
+ fTrackSegments = 0 ;
+ }
+
+ fTrackSegments = new AliPHOSTrackSegment::TrackSegmentsList("AliPHOSTrackSegment", 2000) ;
+ if ( fTrackSegments && gAlice->TreeR() ) {
+ sprintf(branchname,"%sTS",GetName()) ;
+ gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
+ }
+
+ if (fRecParticles) {
+ fRecParticles->Delete() ;
+ delete fRecParticles ;
+ fRecParticles = 0 ;
+ }
+ fRecParticles = new AliPHOSRecParticle::RecParticlesList("AliPHOSRecParticle", 2000) ;
+ if ( fRecParticles && gAlice->TreeR() ) {
+ sprintf(branchname,"%sRP",GetName()) ;
+ gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
+ }
+
+ // 3.
+
+ fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
+
+ // 4. Expand or Shrink the arrays to the proper size
+
+ Int_t size ;
+
+ size = fEmcRecPoints->GetEntries() ;
+ fEmcRecPoints->Expand(size) ;
+
+ size = fPpsdRecPoints->GetEntries() ;
+ fPpsdRecPoints->Expand(size) ;
+
+ size = fTrackSegments->GetEntries() ;
+ fTrackSegments->Expand(size) ;
+
+ size = fRecParticles->GetEntries() ;
+ fRecParticles->Expand(size) ;
+
+ gAlice->TreeR()->Fill() ;
+ cout << "filled" << endl ;
+ // 5.
+
+ gAlice->TreeR()->Write() ;
+ cout << "writen" << endl ;
+
+ // Deleting reconstructed objects
+ ResetReconstruction();
+
+}
+
+//____________________________________________________________________________
+void AliPHOSv1::ResetDigits()
+{
+ // May sound strange, but cumulative hits are store in digits Tree
+ AliDetector::ResetDigits();
+ if( fTmpHits ) {
+ fTmpHits->Delete();
+ fNTmpHits = 0 ;
+ }
+}
+//____________________________________________________________________________
+void AliPHOSv1::ResetReconstruction()
+{
+ // Deleting reconstructed objects
+
+ if ( fEmcRecPoints ) fEmcRecPoints->Delete();
+ if ( fPpsdRecPoints ) fPpsdRecPoints->Delete();
+ if ( fTrackSegments ) fTrackSegments->Delete();
+ if ( fRecParticles ) fRecParticles->Delete();
+
+}
+//____________________________________________________________________________
+
+//____________________________________________________________________________
+void AliPHOSv1::SetTreeAddress()
+{
+ // TBranch *branch;
+ AliPHOS::SetTreeAddress();
+
+ // //Branch address for TreeR: RecPpsdRecPoint
+// TTree *treeR = gAlice->TreeR();
+// if ( treeR && fPpsdRecPoints ) {
+// branch = treeR->GetBranch("PHOSPpsdRP");
+// if (branch) branch->SetAddress(&fPpsdRecPoints) ;
+ // }
+}
+
+//____________________________________________________________________________
+
void AliPHOSv1::StepManager(void)
{
// Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
Int_t copy ;
Int_t tracknumber = gAlice->CurrentTrack() ;
- Int_t primary = gAlice->GetPrimary( 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
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
-
+ // get the absolute Id number
+
Int_t absid ;
fGeom->RelToAbsNumbering(relid, absid) ;
- // add current hit to the hit list
+ // add current hit to the hit list
- AddHit(fIshunt, primary,tracknumber, absid, xyze);
-
+ AddHit(fIshunt, primary,tracknumber, absid, xyze);
+
} // there is deposited energy
- } // we are inside a PHOS Xtal
+ } // we are inside a PHOS Xtal
}
#ifndef ALIPHOSV1_H
#define ALIPHOSV1_H
-/* Copyright(c) 1998-1999-2000, ALICE Experiment at CERN, All rights reserved. *
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
+
//_________________________________________________________________________
-// Version of AliPHOSv0 which allows for keeping all hits in TreeH
-// This version is NOT recommended for Reconstruction analysis
+// Implementation version v1 of PHOS Manager class
+// Layout EMC + PPSD has name GPS2
//
-//*-- Author: Gines MARTINEZ (SUBATECH)
+//*-- Author: Yves Schutz (SUBATECH)
// --- ROOT system ---
#include "TClonesArray.h"
// --- AliRoot header files ---
#include "AliPHOSv0.h"
+#include "AliPHOSGeometry.h"
#include "AliPHOSReconstructioner.h"
+#include "AliPHOSTrackSegmentMaker.h"
+#include "AliPHOSPID.h"
class AliPHOSv1 : public AliPHOSv0 {
AliPHOSv1(void) ;
AliPHOSv1(const char *name, const char *title="") ;
+ AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title="") ;
+ AliPHOSv1(const AliPHOSv1 & phos) {
+ // cpy ctor: no implementation yet
+ // requested by the Coding Convention
+ assert(0==1) ;
+ }
+
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
+ // adds a pre-digitilized hit to the hit tree
+ Int_t Digitize(Float_t Energy);
+ virtual void FinishEvent(void) ; // makes the digits from the hits
+ Int_t IsVersion(void) const { return 1 ; }
+ virtual void MakeBranch(Option_t* opt) ;
+ virtual AliPHOSRecPoint::RecPointsList * PpsdRecPoints() {
+ // Getting list of PPSD RecPoints
+ return fPpsdRecPoints ;
+ }
+ void Reconstruction(AliPHOSReconstructioner * Reconstructioner) ;
+ void ResetClusters(){} ;
+ virtual void ResetDigits() ;
+ virtual void ResetReconstruction() ; // Reset reconstructed objects
+ void SetReconstructioner(AliPHOSReconstructioner& Reconstructioner) {fReconstructioner = &Reconstructioner ;}
+ void SetDigitThreshold(Float_t th) { fDigitThreshold = th ; }
+ virtual void SetTreeAddress();
+ virtual void StepManager(void) ; // does the tracking through PHOS and a preliminary digitalization
+ virtual TString Version(void){ return TString("v1"); }
+
+ AliPHOSv1 & operator = (const AliPHOSv1 & rvalue) {
+ // assignement operator requested by coding convention
+ // but not needed
+ assert(0==1) ;
+ return *this ;
+ }
protected:
- ClassDef(AliPHOSv1,1) // Class AliPHOSv0 which allows to write ond disk al the information of the hits.
+ Float_t fDigitThreshold ; // Threshold for the digit registration
+ Int_t fNTmpHits ; //! Used internally for digitalization
+ Float_t fPinElectronicNoise ; // Electronic Noise in the PIN
+ AliPHOSRecPoint::RecPointsList * fPpsdRecPoints ; // The RecPoints (clusters) list in PPSD
+ AliPHOSReconstructioner * fReconstructioner ; // Reconstrutioner of the PHOS event: Clusterization and subtracking procedures
+ TClonesArray * fTmpHits ; //! Used internally for digitalization
+ AliPHOSTrackSegmentMaker * fTrackSegmentMaker ; // Reconstructioner of the PHOS track segment: 2 x PPSD + 1 x EMC
+
+ ClassDef(AliPHOSv1,1) // Implementation of PHOS manager class for layout EMC+PPSD
};
**************************************************************************/
/* $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 AliPHOSv1 which keeps all hits in TreeH
+// AddHit, StepManager,and FinishEvent are redefined
//
-//*-- 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 "AliPHOSv2.h"
#include "AliPHOSHit.h"
#include "AliPHOSDigit.h"
+#include "AliPHOSReconstructioner.h"
#include "AliRun.h"
#include "AliConst.h"
ClassImp(AliPHOSv2)
+//____________________________________________________________________________
+AliPHOSv2::AliPHOSv2()
+{
+ // default ctor
+ fNTmpHits = 0 ;
+ fTmpHits = 0 ;
+}
+
//____________________________________________________________________________
AliPHOSv2::AliPHOSv2(const char *name, const char *title):
- AliPHOSv0(name,title)
+ AliPHOSv1(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) ;
}
//____________________________________________________________________________
-AliPHOSv2::AliPHOSv2(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
- AliPHOSv0(Reconstructioner,name,title)
+AliPHOSv2::~AliPHOSv2()
{
- // 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
+ if ( fTmpHits) {
+ fTmpHits->Delete() ;
+ delete fTmpHits ;
+ fTmpHits = 0 ;
+ }
+
+ if ( fEmcRecPoints ) {
+ fEmcRecPoints->Delete() ;
+ delete fEmcRecPoints ;
+ fEmcRecPoints = 0 ;
+ }
+
+ if ( fPpsdRecPoints ) {
+ fPpsdRecPoints->Delete() ;
+ delete fPpsdRecPoints ;
+ fPpsdRecPoints = 0 ;
+ }
+
+ if ( fTrackSegments ) {
+ fTrackSegments->Delete() ;
+ delete fTrackSegments ;
+ fTrackSegments = 0 ;
+ }
}
//____________________________________________________________________________
+void AliPHOSv2::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 AliPHOSv1, a PHOS hit is real geant
+ // hits in a single crystal or in a single PPSD gas cell
+
+ TClonesArray <mphits = *fHits ;
+ AliPHOSHit *newHit ;
+
+ // fHits->Print("");
+
+ newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ;
+
+ // We DO want to save in TreeH the raw hits
+ new(ltmphits[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 AliPHOSv2::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 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 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
{
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
// 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
}
#ifndef ALIPHOSV2_H
#define ALIPHOSV2_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 keeps 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 "AliPHOSv1.h"
+#include "AliPHOSReconstructioner.h"
-class AliPHOSv2 : public AliPHOSv0 {
+class AliPHOSv2 : public AliPHOSv1 {
public:
- AliPHOSv2(void) : AliPHOSv0() {
- // ctor
- }
+ AliPHOSv2(void) ;
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
+ virtual ~AliPHOSv2(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 !!)
+ virtual void FinishEvent(void) ; // makes the digits from the hits
+ virtual void StepManager(void) ; // StepManager to keep current tack number in the hit
+
+protected:
+
+ ClassDef(AliPHOSv2,1) // Class AliPHOSv0 which allows to write ond disk al the information of the hits.
};
--- /dev/null
+/**************************************************************************
+ * 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 "AliPHOSv3.h"
+#include "AliPHOSHit.h"
+#include "AliPHOSDigit.h"
+#include "AliRun.h"
+#include "AliConst.h"
+
+ClassImp(AliPHOSv3)
+
+//____________________________________________________________________________
+AliPHOSv3::AliPHOSv3(const char *name, const char *title):
+ AliPHOSv1(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 ;
+}
+
+//____________________________________________________________________________
+AliPHOSv3::AliPHOSv3(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
+ AliPHOSv1(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 AliPHOSv3::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 tracknumber = gAlice->CurrentTrack() ;
+ 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(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
+ {
+ 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(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(fIshunt, primary, tracknumber, 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
+}
--- /dev/null
+#ifndef ALIPHOSV3_H
+#define ALIPHOSV3_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//_________________________________________________________________________
+// Implementation version v1 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 "AliPHOSv1.h"
+
+
+class AliPHOSv3 : public AliPHOSv1 {
+
+public:
+
+ AliPHOSv3(void) : AliPHOSv1() {
+ // ctor
+ }
+ AliPHOSv3(const char *name, const char *title="") ;
+ AliPHOSv3(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title="") ;
+ virtual ~AliPHOSv3(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(AliPHOSv3,1) // Implementation of PHOS manager class for layout EMC+PPSD with light transport, MIPS in PIN and electronic noise
+
+};
+
+#endif // AliPHOSV3_H
--- /dev/null
+/**************************************************************************
+ * 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 of the PHOS manager class for fast simulations
+// Tracks particles until the reach a grossly designed PHOS module
+// Modify the particles property (momentum, energy, type) according to
+// the PHOS response function. The result is called a virtual reconstructed
+// particle.
+//
+//*-- Author: Yves Schutz (SUBATECH)
+
+// --- ROOT system ---
+
+#include "TBRIK.h"
+#include "TNode.h"
+#include "TParticle.h"
+
+// --- Standard library ---
+
+#include <stdio.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSv4.h"
+#include "AliRun.h"
+#include "AliConst.h"
+
+ClassImp(AliPHOSv4)
+
+//____________________________________________________________________________
+AliPHOSv4::AliPHOSv4()
+{
+ // ctor
+
+ fFastRecParticles = 0 ;
+ fNRecParticles = 0 ;
+}
+
+//____________________________________________________________________________
+AliPHOSv4::AliPHOSv4(const char *name, const char *title):
+ AliPHOS(name,title)
+{
+ // ctor
+
+ // gets an instance of the geometry parameters class
+
+ fGeom = AliPHOSGeometry::GetInstance(title, "") ;
+
+ if (fGeom->IsInitialized() )
+ cout << "AliPHOSv4 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
+ else
+ cout << "AliPHOSv4 : PHOS geometry initialization failed !" << endl ;
+
+ SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ;
+ SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) ;
+ SetBigBox(2, fGeom->GetOuterBoxSize(0) );
+
+ fNRecParticles = 0 ;
+ fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
+
+ fResPara1 = 0.030 ; // GeV
+ fResPara2 = 0.00003 ;
+ fResPara3 = 0.00001 ;
+
+ fPosParaA0 = 2.87 ; // mm
+ fPosParaA1 = -0.0975 ;
+ fPosParaB0 = 0.257 ;
+ fPosParaB1 = 0.137 ;
+ fPosParaB2 = 0.00619 ;
+}
+
+//____________________________________________________________________________
+AliPHOSv4::~AliPHOSv4()
+{
+ // dtor
+
+ fFastRecParticles->Delete() ;
+ delete fFastRecParticles ;
+ fFastRecParticles = 0 ;
+
+}
+
+//____________________________________________________________________________
+void AliPHOSv4::AddRecParticle(const AliPHOSFastRecParticle & rp)
+{
+ // Add a virtually reconstructed particle to the list
+
+ new( (*fFastRecParticles)[fNRecParticles] ) AliPHOSFastRecParticle(rp) ;
+ fNRecParticles++ ;
+}
+
+//____________________________________________________________________________
+void AliPHOSv4::BuildGeometry()
+{
+ // Build the PHOS geometry for the ROOT display
+ //BEGIN_HTML
+ /*
+ <H2>
+ PHOS FAST in ALICE displayed by root
+ </H2>
+ <H4> All Views </H4>
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="Fast All Views" SRC="../images/AliPHOSv4AllViews.gif">
+ </CENTER></P>
+ <H4> Front View </H4>
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="Fast Front View" SRC="../images/AliPHOSv4FrontView.gif">
+ </CENTER></P>
+ */
+ //END_HTML
+
+ const Int_t kColorPHOS = kRed ;
+
+ Double_t const kRADDEG = 180.0 / kPI ;
+
+ new TBRIK( "BigBox", "PHOS box", "void", GetBigBox(0)/2,
+ GetBigBox(1)/2,
+ GetBigBox(2)/2 );
+
+ // position PHOS into ALICE
+
+ Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+ Int_t number = 988 ;
+ Float_t pphi = TMath::ATan( GetBigBox(0) / ( 2.0 * fGeom->GetIPtoCrystalSurface() ) ) ;
+ pphi *= kRADDEG ;
+ TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
+
+ char * nodename = new char[20] ;
+ char * rotname = new char[20] ;
+
+ for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
+ Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
+ sprintf(rotname, "%s%d", "rot", number++) ;
+ new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
+ top->cd();
+ sprintf(nodename,"%s%d", "Module", i) ;
+ Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
+ Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
+ TNode * bigboxnode = new TNode(nodename, nodename, "BigBox", x, y, 0, rotname ) ;
+ bigboxnode->SetLineColor(kColorPHOS) ;
+ fNodes->Add(bigboxnode) ;
+ }
+ delete[] nodename ;
+ delete[] rotname ;
+}
+
+//____________________________________________________________________________
+void AliPHOSv4::CreateGeometry()
+{
+ // Create the geometry for GEANT
+
+ AliPHOSv4 *phostmp = (AliPHOSv4*)gAlice->GetModule("PHOS") ;
+
+ if ( phostmp == NULL ) {
+
+ fprintf(stderr, "PHOS detector not found!\n") ;
+ return ;
+
+ }
+
+ // Get pointer to the array containing media indeces
+ Int_t *idtmed = fIdtmed->GetArray() - 699 ;
+
+ Float_t bigbox[3] ;
+ bigbox[0] = GetBigBox(0) / 2.0 ;
+ bigbox[1] = GetBigBox(1) / 2.0 ;
+ bigbox[2] = GetBigBox(2) / 2.0 ;
+
+ gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
+
+ // --- Position PHOS mdules in ALICE setup ---
+
+ Int_t idrotm[99] ;
+ Double_t const kRADDEG = 180.0 / kPI ;
+
+ for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
+
+ Float_t angle = fGeom->GetPHOSAngle(i) ;
+ AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
+
+ Float_t r = fGeom->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ;
+
+ Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
+ Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
+ gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
+
+ } // for GetNModules
+
+}
+
+
+//____________________________________________________________________________
+void AliPHOSv4::Init(void)
+{
+ // Prints out an information message
+
+ Int_t i;
+
+ printf("\n");
+ for(i=0;i<35;i++) printf("*");
+ printf(" FAST PHOS_INIT ");
+ for(i=0;i<35;i++) printf("*");
+ printf("\n");
+
+ // Here the PHOS initialisation code (if any!)
+
+ for(i=0;i<80;i++) printf("*");
+ printf("\n");
+
+}
+
+//___________________________________________________________________________
+Float_t AliPHOSv4::GetBigBox(Int_t index)
+{
+ // Get the X, Y or Z dimension of the box describing a PHOS module
+
+ Float_t rv = 0 ;
+
+ switch (index) {
+ case 0:
+ rv = fBigBoxX ;
+ break ;
+ case 1:
+ rv = fBigBoxY ;
+ break ;
+ case 2:
+ rv = fBigBoxZ ;
+ break ;
+ }
+ return rv ;
+}
+
+//___________________________________________________________________________
+void AliPHOSv4::MakeBranch(Option_t* opt)
+{
+ // Create new branch in the current reconstructed Root Tree
+
+ AliDetector::MakeBranch(opt) ;
+
+ char branchname[10];
+ sprintf(branchname,"%s",GetName());
+ char *cd = strstr(opt,"R");
+
+ if (fFastRecParticles && gAlice->TreeR() && cd) {
+ gAlice->TreeR()->Branch(branchname, &fFastRecParticles, fBufferSize);
+ }
+}
+
+//____________________________________________________________________________
+Double_t AliPHOSv4::MakeEnergy(const Double_t energy)
+{
+ // Smears the energy according to the energy dependent energy resolution.
+ // A gaussian distribution is assumed
+
+ Double_t sigma = SigmaE(energy) ;
+ return fRan.Gaus(energy, sigma) ;
+}
+
+//____________________________________________________________________________
+TVector3 AliPHOSv4::MakePosition(const Double_t energy, const TVector3 pos, const Double_t theta, const Double_t phi)
+{
+ // Smears the impact position according to the energy dependent position resolution
+ // A gaussian position distribution is assumed
+
+ TVector3 newpos ;
+ Double_t sigma = SigmaP( energy, theta*180./TMath::Pi() ) ;
+ Double_t x = fRan.Gaus( pos.X(), sigma ) ;
+ sigma = SigmaP( energy, phi*180./TMath::Pi() ) ;
+ Double_t z = fRan.Gaus( pos.Z(), sigma ) ;
+ Double_t y = pos.Y() ;
+
+ newpos.SetX(x) ;
+ newpos.SetY(y) ;
+ newpos.SetZ(z) ;
+
+ return newpos ;
+}
+
+//____________________________________________________________________________
+void AliPHOSv4::MakeRecParticle(const Int_t modid, const TVector3 pos, AliPHOSFastRecParticle & rp)
+{
+ // Modify the primary particle properties according
+ // 1. the response function of PHOS
+ // 2. the performance of the EMC+PPSD setup
+
+ Int_t type = MakeType( rp ) ;
+ rp.SetType(type) ;
+
+
+ // get the detected energy
+
+ TLorentzVector momentum ;
+ rp.Momentum(momentum) ;
+ Double_t kineticenergy = TMath::Sqrt( TMath::Power(momentum.E(), 2) - TMath::Power(rp.GetMass(), 2) ) ;
+ Double_t modifiedkineticenergy = MakeEnergy(kineticenergy ) ;
+ Double_t modifiedenergy = TMath::Sqrt( TMath::Power(modifiedkineticenergy, 2)
+ + TMath::Power( rp.GetMass(), 2) ) ;
+
+ // get the angle of incidence
+
+ Double_t incidencetheta = 90. * TMath::Pi() /180 - rp.Theta() ;
+ Double_t incidencephi = ( 270 + fGeom->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ;
+
+ // get the detected direction
+
+ TVector3 modifiedposition = MakePosition(kineticenergy, pos, incidencetheta, incidencephi) ;
+ modifiedposition *= modifiedkineticenergy / modifiedposition.Mag() ;
+
+ // Set the modified 4-momentum of the reconstructed particle
+
+ rp.SetMomentum(modifiedposition.X(), modifiedposition.Y(), modifiedposition.Z(), modifiedenergy) ;
+
+ }
+
+//____________________________________________________________________________
+Int_t AliPHOSv4::MakeType(AliPHOSFastRecParticle & rp )
+{
+ // Generate a particle type using the performance of the EMC+PPSD setup
+
+ Int_t rv = AliPHOSFastRecParticle::kUNDEFINED ;
+ Int_t charge = (Int_t)rp.GetPDG()->Charge() ;
+ Int_t test ;
+ Float_t ran ;
+ if ( charge != 0 && ( TMath::Abs(rp.GetPdgCode()) != 11 ) )
+ test = - 1 ;
+ else
+ test = rp.GetPdgCode() ;
+
+ switch (test) {
+
+ case 22: // it's a photon
+ ran = fRan.Rndm() ;
+ if ( ran <= 0.5 ) // 50 %
+ rv = AliPHOSFastRecParticle::kGAMMA ;
+ else {
+ ran = fRan.Rndm() ;
+ if( ran <= 0.9498 )
+ rv = AliPHOSFastRecParticle::kNEUTRALEM ;
+ else
+ rv = AliPHOSFastRecParticle::kNEUTRALHA ;
+ }
+ break ;
+
+ case 2112: // it's a neutron
+ ran = fRan.Rndm() ;
+ if ( ran <= 0.9998 )
+ rv = AliPHOSFastRecParticle::kNEUTRALHA ;
+ else
+ rv = AliPHOSFastRecParticle::kNEUTRALEM ;
+ break ;
+
+ case -2112: // it's a anti-neutron
+ ran = fRan.Rndm() ;
+ if ( ran <= 0.9984 )
+ rv = AliPHOSFastRecParticle::kNEUTRALHA ;
+ else
+ rv = AliPHOSFastRecParticle::kNEUTRALEM ;
+ break ;
+
+ case 11: // it's a electron
+ ran = fRan.Rndm() ;
+ if ( ran <= 0.9996 )
+ rv = AliPHOSFastRecParticle::kELECTRON ;
+ else
+ rv = AliPHOSFastRecParticle::kCHARGEDHA ;
+ break;
+
+ case -11: // it's a positon
+ ran = fRan.Rndm() ;
+ if ( ran <= 0.9996 )
+ rv = AliPHOSFastRecParticle::kELECTRON ;
+ else
+ rv = AliPHOSFastRecParticle::kCHARGEDHA ;
+ break;
+
+ case -1: // it's a charged
+ ran = fRan.Rndm() ;
+ if ( ran <= 0.9996 )
+ rv = AliPHOSFastRecParticle::kCHARGEDHA ;
+ else
+ rv = AliPHOSFastRecParticle::kGAMMA ;
+
+ break ;
+ }
+
+
+ return rv ;
+}
+
+//___________________________________________________________________________
+void AliPHOSv4::ResetPoints()
+{
+ // This overloads the method in AliDetector
+
+ ResetFastRecParticles() ;
+}
+
+//___________________________________________________________________________
+void AliPHOSv4::ResetFastRecParticles()
+{
+ // Resets the list of virtual reconstructed particles
+
+ if (fFastRecParticles)
+ fFastRecParticles->Clear() ;
+ fNRecParticles = 0 ;
+}
+
+//___________________________________________________________________________
+void AliPHOSv4::SetBigBox(Int_t index, Float_t value)
+{
+ // Set the size of the Box describing a PHOS module
+
+ switch (index) {
+ case 0:
+ fBigBoxX = value ;
+ break ;
+ case 1:
+ fBigBoxY = value ;
+ break ;
+ case 2:
+ fBigBoxZ = value ;
+ break ;
+ }
+
+}
+
+//____________________________________________________________________________
+Double_t AliPHOSv4::SigmaE(Double_t energy)
+{
+ // Calculates the energy dependent energy resolution
+
+ Double_t rv = -1 ;
+
+ rv = TMath::Sqrt( TMath::Power(fResPara1/energy, 2)
+ + TMath::Power(fResPara2/TMath::Sqrt(energy), 2)
+ + TMath::Power(fResPara3, 2) ) ;
+
+ return rv * energy ;
+}
+
+//____________________________________________________________________________
+Double_t AliPHOSv4::SigmaP(Double_t energy, Int_t incidence)
+{
+ // Calculates the energy dependent position resolution
+
+ Double_t paraA = fPosParaA0 + fPosParaA1 * incidence ;
+ Double_t paraB = fPosParaB0 + fPosParaB1 * incidence + fPosParaB2 * incidence * incidence ;
+
+ return ( paraA / TMath::Sqrt(energy) + paraB ) * 0.1 ; // in cm
+}
+
+//____________________________________________________________________________
+void AliPHOSv4::StepManager(void)
+{
+ // Only verifies if the particle reaches PHOS and stops the tracking
+
+ Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
+ TLorentzVector lv ;
+ gMC->TrackPosition(lv) ;
+ TVector3 pos = lv.Vect() ;
+ Int_t modid ;
+ gMC->CurrentVolID(modid);
+
+ // Makes a reconstructed particle from the primary particle
+
+ TClonesArray * particlelist = gAlice->Particles() ;
+ TParticle * part = (TParticle *)particlelist->At(primary) ;
+
+ AliPHOSFastRecParticle rp(*part) ;
+ rp.SetPrimary(primary) ;
+
+ // Adds the response of PHOS to the particle
+
+ MakeRecParticle(modid, pos, rp) ;
+
+ // add the primary particle to the FastRecParticles list
+
+ AddRecParticle(rp) ;
+
+ // stop the track as soon PHOS is reached
+
+ gMC->StopTrack() ;
+
+}
+
--- /dev/null
+#ifndef ALIPHOSV4_H
+#define ALIPHOSV4_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Implementation of the PHOS manager class for fast simulations
+// Tracks particles until the reach a grossly designed PHOS module
+// Modify the particles property (momentum, energy, type) according to
+// the PHOS response function. The result is called a virtual reconstructed
+// particle.
+//
+//*-- Author: Yves Schutz (SUBATECH)
+
+// --- ROOT system ---
+#include "TClonesArray.h"
+#include "TRandom.h"
+
+// --- AliRoot header files ---
+#include "AliPHOS.h"
+#include "AliPHOSGeometry.h"
+#include "AliPHOSPID.h"
+#include "AliPHOSFastRecParticle.h"
+
+class AliPHOSv4 : public AliPHOS {
+
+public:
+
+ AliPHOSv4(void) ;
+ AliPHOSv4(const char *name, const char *title="") ;
+ AliPHOSv4(const AliPHOSv4 & fast) {
+ // cpy ctor: no implementation yet
+ // requested by the Coding Convention
+ assert(0==1) ;
+ }
+ virtual ~AliPHOSv4(void) ;
+
+ void AddRecParticle(const AliPHOSFastRecParticle & rp) ; // adds primary particle to the RecParticles list
+ virtual void BuildGeometry(void) ; // creates the geometry for the ROOT display
+ virtual void CreateGeometry(void) ; // creates the geometry for GEANT
+ Float_t GetBigBox(Int_t index) ;
+ virtual AliPHOSGeometry * GetGeometry() { return fGeom ; }
+ virtual void Init(void) ; // does nothing
+ Int_t IsVersion(void) const { return -1 ; }
+ void MakeBranch(Option_t* opt) ;
+ Double_t MakeEnergy(const Double_t energy) ; // makes the detected energy
+ TVector3 MakePosition(const Double_t energy, const TVector3 pos, const Double_t th, const Double_t ph) ;
+ // makes the detected position
+ void MakeRecParticle(const Int_t modid, const TVector3 pos, AliPHOSFastRecParticle & rp) ; // makes a reconstructes particle from primary
+ Int_t MakeType(AliPHOSFastRecParticle & rp) ; // gets the detected type of particle
+ // gets TClonesArray of reconstructed particles
+ AliPHOSFastRecParticle::FastRecParticlesList * FastRecParticles() { return fFastRecParticles ; }
+ virtual void ResetPoints() ;
+ void ResetFastRecParticles() ;
+ void SetBigBox(Int_t index, Float_t value) ;
+ Double_t SigmaE(Double_t energy) ; // calulates the energy resolution at a given Energy
+ Double_t SigmaP(Double_t energy, Int_t inc) ; // calulates the position resolution at a given Energy at a given incidence
+ virtual void StepManager(void) ; // does the tracking through PHOS and a preliminary digitalization
+
+ AliPHOSv4 & operator = (const AliPHOSv4 & rvalue) {
+ // assignement operator requested by coding convention
+ // but not needed
+ assert(0==1) ;
+ return *this ;
+ }
+
+private:
+
+ Float_t fBigBoxX ; // main box containing all PHOS (EMC+PPSD)
+ Float_t fBigBoxY ; // main box containing all PHOS (EMC+PPSD)
+ Float_t fBigBoxZ ; // main box containing all PHOS (EMC+PPSD)
+ AliPHOSFastRecParticle::FastRecParticlesList * fFastRecParticles ; // list of particles modified by the response function
+ AliPHOSGeometry * fGeom ; // geometry definition
+ Int_t fNRecParticles ; // number of detected particles
+ TRandom fRan ; // random number generator
+ Double_t fResPara1 ; // parameter for the energy resolution dependence
+ Double_t fResPara2 ; // parameter for the energy resolution dependence
+ Double_t fResPara3 ; // parameter for the energy resolution dependence
+ Double_t fPosParaA0 ; // parameter for the position resolution
+ Double_t fPosParaA1 ; // parameter for the position resolution
+ Double_t fPosParaB0 ; // parameter for the position resolution
+ Double_t fPosParaB1 ; // parameter for the position resolution
+ Double_t fPosParaB2 ; // parameter for the position resolution
+
+ ClassDef(AliPHOSv4,1) // Implementation of the PHOS manager class for fast simulations
+
+};
+
+#endif // AliPHOSV4_H
# C++ sources
-SRCS = AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx AliPHOSv2.cxx AliPHOSHit.cxx \
+SRCS = AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx AliPHOSv2.cxx \
+ AliPHOSv3.cxx AliPHOSv4.cxx \
+ AliPHOSHit.cxx \
AliPHOSGeometry.cxx \
AliPHOSDigit.cxx \
AliPHOSRecPoint.cxx AliPHOSEmcRecPoint.cxx AliPHOSPpsdRecPoint.cxx \
AliPHOSReconstructioner.cxx AliPHOSTrackSegment.cxx \
AliPHOSTrackSegmentMaker.cxx AliPHOSTrackSegmentMakerv1.cxx \
AliPHOSRecParticle.cxx AliPHOSPID.cxx AliPHOSPIDv1.cxx \
- AliPHOSAnalyze.cxx AliPHOSvFast.cxx AliPHOSFastRecParticle.cxx \
+ AliPHOSAnalyze.cxx AliPHOSFastRecParticle.cxx \
AliPHOSIndexToObject.cxx \
# C++ Headers
#pragma link C++ class AliPHOSv0 ;
#pragma link C++ class AliPHOSv1 ;
#pragma link C++ class AliPHOSv2 ;
+#pragma link C++ class AliPHOSv3 ;
+#pragma link C++ class AliPHOSv4 ;
#pragma link C++ class AliPHOSTrackSegment ;
#pragma link C++ class AliPHOSTrackSegmentMaker ;
#pragma link C++ class AliPHOSTrackSegmentMakerv1 ;
#pragma link C++ class AliPHOSPID ;
#pragma link C++ class AliPHOSPIDv1 ;
#pragma link C++ class AliPHOSAnalyze ;
-#pragma link C++ class AliPHOSvFast ;
#endif