#include "AliPHOSv1.h"
#include "AliPHOSHit.h"
-#include "AliPHOSDigit.h"
-#include "AliPHOSReconstructioner.h"
-#include "AliPHOSSDigitizer.h"
+#include "AliPHOSCPVDigit.h"
#include "AliRun.h"
#include "AliConst.h"
#include "AliMC.h"
+#include "AliPHOSGeometry.h"
ClassImp(AliPHOSv1)
{
// ctor
- fReconstructioner = 0;
- fTrackSegmentMaker = 0;
-
}
//____________________________________________________________________________
// (this array is reset after each primary has been tracked).
//
- fPinElectronicNoise = 0.010 ;
- fDigitThreshold = 0.01 ; // 1 GeV
- fDigitizeA= 0. ;
- fDigitizeB = 10000000. ;
// We do not want to save in TreeH the raw hits
fNhits = 0 ;
- fReconstructioner = 0;
- fTrackSegmentMaker = 0;
-
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)
-
- fPinElectronicNoise = 0.010 ;
-
- // We do not want to save in TreeH the raw hits
-
- fDigits = 0 ;
- fHits= new TClonesArray("AliPHOSHit",1000) ;
-
- 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 << "AliPHOS" << Version() << " : PHOS geometry intialized for " << fGeom->GetName() << endl ;
- else
- cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;
-
- // Defining the PHOS Reconstructioner
-
- fReconstructioner = Reconstructioner ;
-
-}
-
//____________________________________________________________________________
AliPHOSv1::~AliPHOSv1()
{
delete fHits ;
fHits = 0 ;
}
-
- if ( fSDigits) {
- fSDigits->Delete() ;
- delete fSDigits ;
- fSDigits = 0 ;
- }
-
- if ( fDigits) {
- fDigits->Delete() ;
- delete fDigits ;
- fDigits = 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 AliPHOSv1::Hits2SDigits(){
- char * fileSDigits = 0 ;
- AliPHOSSDigitizer * sd = new AliPHOSSDigitizer(fileSDigits) ;
- sd->SetPedestalParameter(fDigitizeA) ;
- sd->SetSlopeParameter(fDigitizeB) ;
- sd->Exec("") ;
- delete sd ;
-}
-
-//____________________________________________________________________________
-void AliPHOSv1::SDigits2Digits(){
- //Adds noise to the summable digits and removes everething below thresholds
- //Note, that sDigits should be SORTED in accordance with abs ID.
-
-
- gAlice->TreeS()->GetEvent(0) ;
-
- // First calculate noise induced by the PIN diode of the PbWO crystals
- Int_t iCurSDigit = 0 ;
-
- //we assume, that there is al least one EMC digit...
- if(fSDigits->GetEntries() == 0) {
- cout << "PHOS::SDigits2Digits> No SDigits !!! Do not produce Digits " << endl ;
- return ;
- }
-
- Int_t idCurSDigit = ((AliPHOSDigit *)fSDigits->At(0))->GetId() ;
-
- Int_t absID ;
- for(absID = 1; absID < fGeom->GetNModules()*fGeom->GetNPhi()*fGeom->GetNZ(); absID++){
- Float_t noise = gRandom->Gaus(0., fPinElectronicNoise) ;
- if(absID < idCurSDigit ){
- if(noise >fDigitThreshold ){
- new((*fDigits)[fNdigits]) AliPHOSDigit( -1,absID,Digitize(noise) ) ;
- fNdigits++ ;
- }
- }
- else{ //add noise and may be remove the true hit
- Float_t signal = noise + Calibrate(((AliPHOSDigit *)fSDigits->At(iCurSDigit))->GetAmp()) ;
- if( signal >fDigitThreshold ){
- AliPHOSDigit * digit = (AliPHOSDigit*) fSDigits->At(iCurSDigit) ;
- new((*fDigits)[fNdigits]) AliPHOSDigit( *digit ) ;
- ((AliPHOSDigit *)fDigits->At(fNdigits))->SetAmp(Digitize(signal));
- fNdigits++ ;
- }
-
- if(iCurSDigit < fSDigits->GetEntries()-1){
- iCurSDigit++ ;
- idCurSDigit = ((AliPHOSDigit*)fSDigits->At(iCurSDigit))->GetId() ;
- }
- else
- idCurSDigit = 10000000; //no real hits left
- }
-
- }
-
- //remove PPSD/CPV digits below thresholds
- Int_t idigit ;
- for(idigit = iCurSDigit; idigit < fSDigits->GetEntries() ; idigit++){ //loop over CPV/PPSD digits
-
- AliPHOSDigit * digit = (AliPHOSDigit *) fSDigits->At(idigit) ;
- Float_t ene = Calibrate(digit->GetAmp()) ;
-
- Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- if ( relid[0] > fGeom->GetNCPVModules() ){ //ppsd
- if ( ( (relid[1] > 0) && (ene > fPpsdEnergyThreshold)) || //PPSD digit
- ( (relid[1] < 0) && (ene > fCpvEnergyThreshold ) ) ) //CPV digit
- new((*fDigits)[fNdigits]) AliPHOSDigit( *digit ) ;
- fNdigits++ ;
- }
- }
-
- fDigits->Compress() ;
-
- fNdigits = fDigits->GetEntries() ;
- fDigits->Expand(fNdigits) ;
-
- Int_t i ;
- for (i = 0 ; i < fNdigits ; i++) {
- AliPHOSDigit * digit = (AliPHOSDigit *) fDigits->At(i) ;
- digit->SetIndexInList(i) ;
- }
-
- gAlice->TreeD()->Fill() ;
-
- gAlice->TreeD()->Write(0,TObject::kOverwrite) ;
-
-}
-
-//___________________________________________________________________________
-void AliPHOSv1::MakeBranch(Option_t* opt, char *file)
-{
-
- char *cH ;
- // Create new branche in the current Root Tree in the digit Tree
- AliDetector::MakeBranch(opt) ;
-
-
- cH = strstr(opt,"S");
- //Create a branch for SDigits
- if( cH ){
- char branchname[20];
- sprintf(branchname,"%s",GetName());
- if(fSDigits)
- fSDigits->Clear();
-
- fnSdigits = 0 ;
- gAlice->MakeBranchInTree(gAlice->TreeS(),branchname,&fSDigits,fBufferSize,file);
- }
-
- cH = strstr(opt,"D");
- //Create a branch for Digits
- if( cH ){
- char branchname[20];
- sprintf(branchname,"%s",GetName());
-
- if(fDigits)
- fDigits->Clear();
-
- gAlice->MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,fBufferSize,file);
- }
-
- cH = strstr(opt,"R");
- //Create a branch for Reconstruction
- if( cH ){
- char branchname[20];
-
- Int_t splitlevel = 0 ;
-
- if(fEmcRecPoints)
- fEmcRecPoints->Delete() ;
-
- if ( fEmcRecPoints && gAlice->TreeR() ) {
- sprintf(branchname,"%sEmcRP",GetName()) ;
- gAlice->MakeBranchInTree(gAlice->TreeR(),branchname,"TObjArray",&fEmcRecPoints, fBufferSize, splitlevel,file);
- }
-
- if(fPpsdRecPoints)
- fPpsdRecPoints->Delete() ;
-
- if ( fPpsdRecPoints && gAlice->TreeR() ) {
- sprintf(branchname,"%sPpsdRP",GetName()) ;
- gAlice->MakeBranchInTree(gAlice->TreeR(),branchname,"TObjArray",&fPpsdRecPoints, fBufferSize, splitlevel,file);
- }
-
- if(fTrackSegments)
- fTrackSegments->Clear() ;
-
- if ( fTrackSegments && gAlice->TreeR() ) {
- sprintf(branchname,"%sTS",GetName()) ;
- gAlice->MakeBranchInTree(gAlice->TreeR(),branchname,&fTrackSegments,fBufferSize,file);
- }
-
- if(fRecParticles)
- fRecParticles->Clear() ;
-
- if ( fRecParticles && gAlice->TreeR() ) {
- sprintf(branchname,"%sRP",GetName()) ;
- gAlice->MakeBranchInTree(gAlice->TreeR(),branchname,&fRecParticles,fBufferSize,file);
- }
-
- }
-
-}
-
-//_____________________________________________________________________________
-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 ;
-
- // 1.
-
- // gAlice->MakeTree("R") ;
-
- MakeBranch("R") ;
-
- // 3.
-
- fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
-
- printf("Reconstruction: %d %d %d %d\n",
- fEmcRecPoints->GetEntries(),fPpsdRecPoints->GetEntries(),
- fTrackSegments->GetEntries(),fRecParticles->GetEntries());
-
- // 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() ;
- // 5.
-
- gAlice->TreeR()->Write(0,TObject::kOverwrite) ;
-
- // Deleting reconstructed objects
- ResetReconstruction();
-
-}
-
-//____________________________________________________________________________
-void AliPHOSv1::ResetReconstruction()
-{
- // Deleting reconstructed objects
-
- if ( fEmcRecPoints ) fEmcRecPoints ->Delete();
- if ( fPpsdRecPoints ) fPpsdRecPoints->Delete();
- if ( fTrackSegments ) fTrackSegments->Delete();
- if ( fRecParticles ) fRecParticles ->Delete();
-
-}
-
-//____________________________________________________________________________
-
void AliPHOSv1::StepManager(void)
{
// Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
if ( name == "GPS2" || name == "MIXT" ) { // ======> CPV is a GPS' PPSD
- if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell
+ if( gMC->CurrentVolID(copy) == gMC->VolId("PCEL") ) // We are inside a gas cell
{
gMC->TrackPosition(pos) ;
xyze[0] = pos[0] ;
// Yuri Kharlov, 28 September 2000
- if( gMC->CurrentVolID(copy) == gMC->VolId("CPVQ") &&
+ if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
(gMC->IsTrackEntering() ) &&
gMC->TrackCharge() != 0) {
} // there is deposited energy
} // we are inside a PHOS Xtal
-
-
}
//____________________________________________________________________________