- Int_t tracknumber = gAlice->CurrentTrack() ;
- Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
- TString name = GetGeometry()->GetName() ;
-
-
- if ( name == "GPS2" || name == "MIXT" ) { // ======> CPV is a GPS' PPSD
-
- if( gMC->CurrentVolID(copy) == gMC->VolId("PPCE") ) // 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
- if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){
- relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
- }
- gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
- // 1-> GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() upper
- // > GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->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
-
- GetGeometry()->RelToAbsNumbering(relid, absid) ;
-
- // 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 ( name == "IHEP" || name == "MIXT" ) { // ======> CPV is a IHEP's one
-
- // Yuri Kharlov, 28 September 2000
-
- if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
- (gMC->IsTrackEntering() ) &&
- gMC->TrackCharge() != 0) {
+ Int_t moduleNumber ;
+
+ static Int_t idPCPQ = -1;
+ if (strstr(fTitle.Data(),"noCPV") == 0)
+ idPCPQ = gMC->VolId("PCPQ");
+
+ if( gMC->CurrentVolID(copy) == idPCPQ &&
+ (gMC->IsTrackEntering() ) &&
+ gMC->TrackCharge() != 0) {
+
+ gMC -> TrackPosition(pos);
+
+ Float_t xyzm[3], xyzd[3] ;
+ Int_t i;
+ for (i=0; i<3; i++) xyzm[i] = pos[i];
+ gMC -> Gmtod (xyzm, xyzd, 1); // transform coordinate from master to daughter system
+
+
+ Float_t xyd[3]={0,0,0} ; //local position of the entering
+ xyd[0] = xyzd[0];
+ xyd[1] =-xyzd[2];
+ xyd[2] =-xyzd[1];
+
+ // Current momentum of the hit's track in the local ref. system
+ TLorentzVector pmom ; //momentum of the particle initiated hit
+ 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];
+
+ // Digitize the current CPV hit:
+
+ // 1. find pad response and
+ gMC->CurrentVolOffID(3,moduleNumber);
+ moduleNumber--;
+
+// TClonesArray *cpvDigits = new TClonesArray("AliPHOSCPVDigit",0); // array of digits for current hit
+ CPVDigitize(pmom,xyd,&fCPVDigits);