- cpvDigits->Compress() ;
-
- // 3. add digits to temporary hit list fTmpHits
-
- ndigits = cpvDigits->GetEntriesFast();
- for (idigit=0; idigit<ndigits; idigit++) {
- AliPHOSCPVDigit *cpvDigit = (AliPHOSCPVDigit*) cpvDigits->UncheckedAt(idigit);
- relid[0] = moduleNumber + 1 ; // CPV (or PHOS) module number
- relid[1] =-1 ; // means CPV
- relid[2] = cpvDigit->GetXpad() ; // column number of a pad
- relid[3] = cpvDigit->GetYpad() ; // row number of a pad
-
- // get the absolute Id number
- fGeom->RelToAbsNumbering(relid, absid) ;
-
- // add current digit to the temporary hit list
- xyze[0] = 0. ;
- xyze[1] = 0. ;
- xyze[2] = 0. ;
- xyze[3] = cpvDigit->GetQpad() ; // amplitude in a pad
- primary = -1; // No need in primary for CPV
- AddHit(fIshunt, primary, tracknumber, absid, xyze, trackpid);
-
- if (cpvDigit->GetQpad() > 0.02) {
- xmean += cpvDigit->GetQpad() * (cpvDigit->GetXpad() + 0.5);
- zmean += cpvDigit->GetQpad() * (cpvDigit->GetYpad() + 0.5);
- qsum += cpvDigit->GetQpad();
- }
- }
- delete cpvDigits;
- }
- } // end of IHEP 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() ;
-
- // Track enters to the crystal from the top edge
-
- if (gMC->IsTrackEntering()) {
- Float_t posloc[3];
- gMC -> Gmtod (xyze, posloc, 1);
- if (posloc[1] > fGeom->GetCrystalSize(1)/2-0.01) {
- Int_t row,cel;
- Float_t xyd[3]={0,0,0};
- AliPHOSv1 &phos = *(AliPHOSv1*)gAlice->GetModule("PHOS");
-
- Int_t moduleNumber;
- gMC->CurrentVolOffID(10,moduleNumber);
-
- if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
- moduleNumber += fGeom->GetNModules() - fGeom->GetNPPSDModules();
- moduleNumber--;
-
- gMC->CurrentVolOffID(4, row) ; // get the row number inside the module
- gMC->CurrentVolOffID(3, cel) ; // get the cell number inside the module
- xyd[0] = -(posloc[2] + (cel-0.5-fGeom->GetNZ() /2) *
- (fGeom->GetCrystalSize(2) + 2 * fGeom->GetGapBetweenCrystals()));
- xyd[1] = posloc[0] + (row-0.5-fGeom->GetNPhi()/2) *
- (fGeom->GetCrystalSize(0) + 2 * fGeom->GetGapBetweenCrystals());
-
- // Current momentum of the hit's track in the CPV module ref. system
-
- TLorentzVector pmom;
- gMC -> TrackMomentum(pmom);
- Float_t pm[3], pd[3];
- for (i=0; i<3; i++) pm[i] = pmom[i];
- gMC -> Gmtod (pm, pd, 2); // transform 3-momentum from master to daughter system
- pmom[0] = pd[0];
- pmom[1] =-pd[1];
- pmom[2] =-pd[2];
-
- // Current particle type of the hit's track
-
- Int_t ipart = gMC->TrackPid();
-
- // Add the current particle in the list of the EMC hits.
-
- phos.GetEMCModule(moduleNumber).AddHit(fIshunt,primary,pmom,xyd,ipart);
-
- if (fDebug == 1) {
- printf("EMC hit added to module #%2d: p = (% .4f, % .4f, % .4f, % .4f) GeV,\n",
- moduleNumber+1,pmom.Px(),pmom.Py(),pmom.Pz(),pmom.E());
- printf( " xy = (%8.4f, %8.4f) cm, ipart = %d, primary = %d\n",
- xyd[0],xyd[1],ipart,primary);
- }
- }
- }
-
- // Track is inside the crystal and deposits some energy
-
- if ( xyze[3] != 0 ) {
- gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
- if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
- relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules();