}
//____________________________________________________________________________
-void AliPHOSv0::AddHit(Int_t track, Int_t Id, Float_t * hits)
+void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
{
Int_t hitCounter ;
TClonesArray <mphits = *fTmpHits ;
AliPHOSHit *newHit ;
AliPHOSHit *curHit ;
- Bool_t deja = false ;
+ Bool_t deja = kFALSE ;
// In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
- newHit = new AliPHOSHit(fIshunt, track, Id, hits) ;
+ newHit = new AliPHOSHit(primary, Id, hits) ;
for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
if( *curHit == *newHit ) {
- *curHit = *curHit + *newHit ;
- deja = true ;
+ *curHit = *curHit + *newHit ;
+ deja = kTRUE ;
}
}
// fNhits++ ;
// }
- delete newHit;
+ delete newHit;
}
//___________________________________________________________________________
void AliPHOSv0::FinishEvent()
{
- cout << "//_____________________________________________________" << endl ;
- cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ;
+ // cout << "//_____________________________________________________" << endl ;
+ // cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ;
Int_t i ;
+ Int_t j ;
TClonesArray &lDigits = *fDigits ;
AliPHOSHit * hit ;
- AliPHOSDigit * digit ;
+ AliPHOSDigit * newdigit ;
+ AliPHOSDigit * curdigit ;
+ Bool_t deja = kFALSE ;
for ( i = 0 ; i < fNTmpHits ; i++ ) {
hit = (AliPHOSHit*)fTmpHits->At(i) ;
- digit = new AliPHOSDigit(hit->GetId(),Digitize(hit->GetEnergy())) ;
- new(lDigits[fNdigits]) AliPHOSDigit(* digit) ;
- fNdigits++; delete digit ;
+ cout << "FinishEvent hit" << hit->GetPrimary() << " " << hit->GetId() << endl ;
+ newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
+ for ( j = 0 ; j < fNdigits ; j++) {
+ curdigit = (AliPHOSDigit*) lDigits[j] ;
+ if ( *curdigit == *newdigit) {
+ *curdigit = *newdigit + *curdigit ;
+ deja = kTRUE ;
+ }
+ }
+ if ( !deja ) {
+ new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
+ fNdigits++ ;
+ }
+
+ delete newdigit ;
}
+
+ for ( i = 0 ; i < fNdigits ; i++ ) {
+ newdigit = (AliPHOSDigit*)lDigits[i] ;
+ Int_t * prim = newdigit->GetPrimary() ;
+ for ( j = 0 ; j < newdigit->GetNprimary() ; j++)
+ cout << "FinishEvent digit " << prim[j] << " " << newdigit->GetId() << endl ;
+ }
+
Float_t energyandnoise ;
for ( i = 0 ; i < fNdigits ; i++ ) {
- digit = (AliPHOSDigit * ) fDigits->At(i) ;
- // printf("GetId is %d and GetAmp is %d \n",digit->GetId(), digit->GetAmp()) ;
- energyandnoise = digit->GetAmp() + Digitize(gRandom->Gaus(0.,fPINElectronicNoise)) ;
+ newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
+ energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPINElectronicNoise)) ;
if (energyandnoise < 0 ) energyandnoise = 0 ;
- digit->SetAmp(energyandnoise);
- // printf("GetId is %d and GetAmp is %d \n",digit->GetId(), digit->GetAmp()) ;
+ newdigit->SetAmp(energyandnoise) ;
-
}
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 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") )
- // if( strcmp ( gMC->CurrentVolName(), "GCEL" ) == 0 ) // We are inside a gas cell
{
gMC->TrackPosition(pos) ;
xyze[0] = pos[0] ;
// get the absolute Id number
Int_t absid ;
- fGeom->RelToAbsNumbering(relid,absid) ;
+ fGeom->RelToAbsNumbering(relid, absid) ;
// add current hit to the hit list
- AddHit(gAlice->CurrentTrack(), absid, xyze);
+ 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") )
- // if( strcmp ( gMC->CurrentVolName(), "PXTL" ) == 0 ) { // We are inside a PWO crystal
+ if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal
{
gMC->TrackPosition(pos) ;
xyze[0] = pos[0] ;
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
// add current hit to the hit list
- AddHit(gAlice->CurrentTrack(), absid, xyze);
+ AddHit(primary, absid, xyze);
} // there is deposited energy
} // we are inside a PHOS Xtal