]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv0hits.cxx
Corrections to comply with coding convention
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0hits.cxx
index bb4f90b900d60eebf982f40305ae9922c516f578..7d0a83fe519a0f3225ea8792f9dabf3e67c698b8 100644 (file)
@@ -47,7 +47,7 @@ ClassImp(AliPHOSv0hits)
 //____________________________________________________________________________
 AliPHOSv0hits::AliPHOSv0hits()
 {
-  // ctor
+  // default ctor
   fNTmpHits = 0 ; 
   fTmpHits  = 0 ; 
 }
@@ -56,6 +56,7 @@ AliPHOSv0hits::AliPHOSv0hits()
 AliPHOSv0hits::AliPHOSv0hits(const char *name, const char *title):
   AliPHOSv0(name,title)
 {
+  // ctor
    fHits= new TClonesArray("AliPHOSHit",1000) ;
 }
 
@@ -82,13 +83,14 @@ AliPHOSv0hits::~AliPHOSv0hits()
 }
 
 //____________________________________________________________________________
-void AliPHOSv0hits::AddHit(Int_t primary, Int_t Id, Float_t * hits)
+void AliPHOSv0hits::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits)
 {
   // Add a hit to the hit list.
   // In this version of AliPHOSv0, a PHOS hit is real geant 
   // hits in a single crystal or in a single PPSD gas cell
 
-  //  cout << "Primary particle is " << primary << endl;
+  // cout << "Primary is " << primary << endl;
+  //cout << "Tracknumber is " << tracknumber << endl;
   //cout << "Vol Id is " << Id << endl;
   //cout << "hits is " << hits[0] << "  " << hits[1] << "  " << hits[2] << "   " << hits[3] <<endl;
 
@@ -99,7 +101,7 @@ void AliPHOSv0hits::AddHit(Int_t primary, Int_t Id, Float_t * hits)
 
   //  fHits->Print("");
 
-  newHit = new AliPHOSHit(primary, Id, hits) ;
+  newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ;
 
   // We DO want to save in TreeH the raw hits 
   //  TClonesArray &lhits = *fHits;
@@ -190,3 +192,72 @@ void AliPHOSv0hits::FinishEvent()
 
 }
 
+void AliPHOSv0hits::StepManager(void)
+{
+  // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
+
+  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 tracknumber =  gAlice->CurrentTrack() ; 
+  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") ) // 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
+               gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
+      // 1-> Geom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() upper                         
+      //  >  fGeom->GetNumberOfModulesPhi()  *  fGeom->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
+
+       Int_t absid ; 
+               fGeom->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(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() ;
+
+       if ( xyze[3] != 0 ) {
+          gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
+          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
+
+      // get the absolute Id number
+
+          Int_t absid ; 
+          fGeom->RelToAbsNumbering(relid, absid) ; 
+      // add current hit to the hit list
+
+          AddHit(fIshunt, primary,tracknumber, absid, xyze);
+    
+       } // there is deposited energy
+    } // we are inside a PHOS Xtal
+}
+