correct TrackRef usage for charged particles
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Feb 2009 07:23:43 +0000 (07:23 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Feb 2009 07:23:43 +0000 (07:23 +0000)
T0/AliT0v1.cxx

index cd9298e..5c1f0ac 100644 (file)
@@ -680,43 +680,41 @@ void AliT0v1::StepManager()
   
   if(!gMC->IsTrackAlive()) return; // particle has disappeared
   
+  id=gMC->CurrentVolID(copy);
   
-    // If particles is photon then ...
-  
- if (gMC->TrackPid() == 50000050)
-  {
-      id=gMC->CurrentVolID(copy);
+  // Check the sensetive volume
+  if(id==fIdSens1 ) { 
+    if(gMC->IsTrackEntering()) {
+      gMC->CurrentVolOffID(2,copy);
+      vol[1]=copy;
+      gMC->CurrentVolOffID(3,copy1);
+      vol[0]=copy1;
+      gMC->TrackPosition(pos);
+      hits[0] = pos[0];
+      hits[1] = pos[1];
+      hits[2] = pos[2];
+      if(pos[2]<0) vol[0] = 2;
+      if(pos[2]>=0) vol[0] = 1; 
       
+      Float_t etot=gMC->Etot();
+      hits[3]=etot;
+      Int_t iPart= gMC->TrackPid();
+      Int_t partID=gMC->IdFromPDG(iPart);
+      hits[4]=partID;
+      Float_t ttime=gMC->TrackTime();
+      hits[5]=ttime*1e12;
+      if (gMC->TrackPid() == 50000050)   // If particles is photon then ...
+       {
+         if(RegisterPhotoE(vol[1]-1,hits[3])) {
+           AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
+           // Create a track reference at the exit of photocatode
+         }         
+       }
+
+      //charge particle 
+      if ( gMC->TrackCharge() )
+       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kT0);
       
-      // Check the sensetive volume
-      if(id==fIdSens1 ) { 
-       if(gMC->IsTrackEntering()) {
-           gMC->CurrentVolOffID(2,copy);
-           vol[1]=copy;
-           gMC->CurrentVolOffID(3,copy1);
-           vol[0]=copy1;
-           gMC->TrackPosition(pos);
-           hits[0] = pos[0];
-           hits[1] = pos[1];
-           hits[2] = pos[2];
-           if(pos[2]<0) vol[0] = 2;
-           if(pos[2]>=0) vol[0] = 1; 
-           
-           Float_t etot=gMC->Etot();
-           hits[3]=etot;
-           Int_t iPart= gMC->TrackPid();
-           Int_t partID=gMC->IdFromPDG(iPart);
-           hits[4]=partID;
-           Float_t ttime=gMC->TrackTime();
-           hits[5]=ttime*1e12;
-           if(RegisterPhotoE(vol[1]-1,hits[3])) {
-             AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
-       // Create a track reference at the exit of photocatode
-                     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kT0);
-           }       
-         }
-         //  cout<< gAlice->GetMCApp()->GetCurrentTrackNumber()<<" hit added "<<endl;
-       
        /*              
                printf("track(%i) alive(%i) disap(%i) enter(%i) exit(%i) inside(%i) out(%i) stop(%i) new(%i) \n",
                       gAlice->GetMCApp()->GetCurrentTrackNumber(),
@@ -728,9 +726,10 @@ void AliT0v1::StepManager()
               gMC->IsTrackOut(),
               gMC->IsTrackStop(),
               gMC->IsNewTrack());
-       */              
-      } //sensitive
-  } //photon
+       */
+    }// trck entering          
+  } //sensitive
+  
 }