-void AliPHOSv1::Hit2Digit(Int_t ntracks){
- //Collects all hits in the same active volume into digits
-
- if(fDigits!= 0)
- fDigits->Clear() ;
- else
- fDigits = new TClonesArray("AliPHOSDigit",1000) ;
-
- // Branch address for digit tree
- char branchname[20];
- sprintf(branchname,"%s",GetName());
- gAlice->TreeD()->Branch(branchname,&fDigits,fBufferSize);
-
- gAlice->TreeD()->GetEvent(0);
-
-
- Int_t i ;
- Int_t relid[4];
- Int_t j ;
- AliPHOSHit * hit ;
- AliPHOSDigit * newdigit ;
- AliPHOSDigit * curdigit ;
- Bool_t deja = kFALSE ;
-
- Int_t itrack ;
- for (itrack=0; itrack<ntracks; itrack++){
-
- //=========== Get the Hits Tree for the Primary track itrack
- gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(itrack);
-
- for ( i = 0 ; i < fHits->GetEntries() ; i++ ) {
- hit = (AliPHOSHit*)fHits->At(i) ;
-
- // Assign primary number only if contribution is significant
- if( hit->GetEnergy() > fDigitThreshold)
- newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
- else
- newdigit = new AliPHOSDigit( -1 , hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
- deja =kFALSE ;
-
-
- for ( j = 0 ; j < fNdigits ; j++) {
- curdigit = (AliPHOSDigit*) fDigits->At(j) ;
- if ( *curdigit == *newdigit) {
- *curdigit = *curdigit + *newdigit ;
- deja = kTRUE ;
- }
- }
-
- if ( !deja ) {
- new((*fDigits)[fNdigits]) AliPHOSDigit(* newdigit) ;
- fNdigits++ ;
- }
-
- delete newdigit ;
- }
-
- } // loop over tracks
-
- // 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() ;
- fDigits->Expand(fNdigits) ;
-
- for (i = 0 ; i < fNdigits ; i++) {
- newdigit = (AliPHOSDigit *) fDigits->At(i) ;
- newdigit->SetIndexInList(i) ;
- }
-
- gAlice->TreeD()->Fill() ;
-
- gAlice->TreeD()->Write(0,TObject::kOverwrite) ;
-
-}
-//___________________________________________________________________________
-void AliPHOSv1::MakeBranch(Option_t* opt)
-{
- // Create new branche in the current Root Tree in the digit Tree
- AliDetector::MakeBranch(opt) ;
-
- // Create new branches EMC<i> for hits in EMC modules
-
- for( Int_t i=0; i<fGeom->GetNModules(); i++ ) GetEMCModule(i).MakeBranch("EMC",i+1);
-
- // Create new branches CPV<i> for hits in CPV modules for IHEP geometry
-
- if ( strcmp(fGeom->GetName(),"IHEP") == 0 || strcmp(fGeom->GetName(),"MIXT") == 0 ) {
- for( Int_t i=0; i<fGeom->GetNCPVModules(); i++ ) GetCPVModule(i).MakeBranch("CPV",i+1);
- }
-
-}
-
-//_____________________________________________________________________________
-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 ;
-
- fEmcRecPoints->Delete() ;
-
- if ( fEmcRecPoints && gAlice->TreeR() ) {
- sprintf(branchname,"%sEmcRP",GetName()) ;
- gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
- }
-
- fPpsdRecPoints->Delete() ;
-
- if ( fPpsdRecPoints && gAlice->TreeR() ) {
- sprintf(branchname,"%sPpsdRP",GetName()) ;
- gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
- }
-
- fTrackSegments->Delete() ;
-
- if ( fTrackSegments && gAlice->TreeR() ) {
- sprintf(branchname,"%sTS",GetName()) ;
- gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
- }
-
- fRecParticles->Delete() ;
-
- if ( fRecParticles && gAlice->TreeR() ) {
- sprintf(branchname,"%sRP",GetName()) ;
- gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
- }
-
- // 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.