]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFv0.cxx
Data classes for RICH (completely updated) (JB,AM)
[u/mrichter/AliRoot.git] / TOF / AliTOFv0.cxx
index c50b199b73ebdc5afe5043fccca6a2ec1a4a9526..960c801949744e54121ab0b241795c3971aee376 100644 (file)
 
 /*
 $Log$
+Revision 1.14  1999/11/05 22:39:06  fca
+New hits structure
+
+Revision 1.13  1999/11/01 20:41:57  fca
+Added protections against using the wrong version of FRAME
+
 Revision 1.12  1999/10/22 08:04:14  fca
 Correct improper use of negative parameters
 
@@ -57,6 +63,7 @@ Introduction of the Copyright and cvs Log
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include <iostream.h>
 #include <stdlib.h>
 
 #include "AliTOFv0.h"
@@ -80,6 +87,19 @@ AliTOFv0::AliTOFv0(const char *name, const char *title)
   //
   // Standard constructor
   //
+  //
+  // Check that FRAME is there otherwise we have no place where to
+  // put TOF
+  AliModule* FRAME=gAlice->GetModule("FRAME");
+  if(!FRAME) {
+    Error("Ctor","TOF needs FRAME to be present\n");
+    exit(1);
+  } else 
+    if(FRAME->IsVersion()!=0) {
+      Error("Ctor","FRAME version 0 needed with this version of TOF\n");
+      exit(1);
+    }
+
 }
  
 //_____________________________________________________________________________
@@ -221,7 +241,7 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
   Float_t zSenStrip;
   zSenStrip = StripWidth-2*DeadBound;//cm
 
-  par[0] = xFLT*0.5;
+  par[0] = xFLT/2;
   par[1] = yPad/2; 
   par[2] = StripWidth/2.;
   
@@ -229,7 +249,7 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
   gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
 
   // Freon for non-sesitive boundaries
-  par[0] = xFLT*0.5;
+  par[0] = xFLT/2;
   par[1] = 0.110/2;
   par[2] = -1;
   gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
@@ -255,7 +275,7 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
   gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
 
   // Freon sensitive layer
-  par[0] = xFLT*0.5;
+  par[0] = -1;
   par[1] = 0.110/2.;
   par[2] = zSenStrip/2.;
   gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
@@ -265,9 +285,9 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
   gMC->Gsdvn("FLZ","FCFC", nz, 3); 
   gMC->Gsdvn("FLX","FLZ" , nx, 1); 
 
-
 ////  Positioning the Strips  (FSTR) in the FLT volumes  /////
 
   // 3 (Central) Plate 
   Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
   Float_t zpos = 0;
@@ -281,14 +301,14 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
  
   do{
      ang = atan(zcoor/t);
-     ang = ang*kRaddeg;
-     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang,90.);
-     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang,90.);
+     ang = ang * kRaddeg;
+     AliMatrix (idrotm[nrot],  90.,  0.,90.-ang,90.,-ang, 90.);   
+     AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90.,ang, 90.);
      ycoor = -14.5+ Space; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
      gMC->Gspos("FSTR",j  ,"FLT3",0.,ycoor, zcoor,idrotm[nrot],  "ONLY");
      gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
-     ang  = ang/kRaddeg;
+     ang = ang / kRaddeg;
      
      zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
      UpDown*= -1; // Alternate strips 
@@ -309,13 +329,13 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
 
   do {
      ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang*kRaddeg;
-     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang,270.);
+     ang = ang * kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ycoor = -29./2.+ Space ; //2 cm over front plate
      ycoor += (1-(UpDown+1)/2)*Gap;
      zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
      gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang/kRaddeg;
+     ang  = ang / kRaddeg;
      zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
      last = StripWidth*TMath::Cos(ang)/2;
      UpDown*=-1;
@@ -333,12 +353,12 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
 
  do {
      ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
-     ang = ang*kRaddeg;
-     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang,270.);
+     ang = ang * kRaddeg;
+     AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      i++;
      zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
      gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
-     ang  = ang /kRaddeg;
+     ang  = ang / kRaddeg;
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      last = StripWidth*TMath::Cos(ang)/2.;
   }  while (zpos>-t+7.+last);
@@ -483,19 +503,6 @@ void AliTOFv0::Init()
 
   AliTOF::Init();
 
-  //
-  // Check that FRAME is there otherwise we have no place where to
-  // put TOF
-  AliModule* FRAME=gAlice->GetModule("FRAME");
-  if(!FRAME) {
-    Error("Ctor","TOF needs FRAME to be present\n");
-    exit(1);
-  } else 
-    if(FRAME->IsVersion()!=0) {
-      Error("Ctor","FRAME version 0 needed with this version of TOF\n");
-      exit(1);
-    }
-
   fIdFTO2=gMC->VolId("FTO2");
   fIdFTO3=gMC->VolId("FTO3");
   fIdFLT1=gMC->VolId("FLT1");
@@ -514,37 +521,51 @@ void AliTOFv0::StepManager()
   // Procedure called at each step in the Time Of Flight
   //
   TLorentzVector mom, pos;
-  Float_t hits[8];
-  Int_t vol[3];
-  Int_t copy, id, i;
+  Float_t hits[8],rho,phi,phid,z;
+  Int_t sector, plate, pad_x, pad_z, strip;
+  Int_t copy, pad_z_id, pad_x_id, strip_id, i;
   Int_t *idtmed = fIdtmed->GetArray()-499;
-  if(gMC->GetMedium()==idtmed[514-1] && 
+  
+  
+  if(gMC->GetMedium()==idtmed[513] && 
      gMC->IsTrackEntering() && gMC->TrackCharge()
-     && gMC->CurrentVolID(copy)==fIdSens) {
+     && gMC->CurrentVolID(copy)==fIdSens) 
+  {
     TClonesArray &lhits = *fHits;
-    //
-    // Record only charged tracks at entrance
-    gMC->CurrentVolOffID(1,copy);
-    vol[2]=copy;
-    gMC->CurrentVolOffID(3,copy);
-    vol[1]=copy;
-    id=gMC->CurrentVolOffID(8,copy);
-    vol[0]=copy;
-    if(id==fIdFTO3) {
-      vol[0]+=22;
-      id=gMC->CurrentVolOffID(5,copy);
-      if(id==fIdFLT3) vol[1]+=6;
-    } else if (id==fIdFTO2) {
-      vol[0]+=20;
-      id=gMC->CurrentVolOffID(5,copy);
-      if(id==fIdFLT2) vol[1]+=8;
-    } else {
-      id=gMC->CurrentVolOffID(5,copy);
-      if(id==fIdFLT1) vol[1]+=14;
-    }
+    
+    //_________getting information about hit volumes_____________
+    
+    pad_z_id=gMC->CurrentVolOffID(2,copy);
+    pad_z=copy;  
+    
+    pad_x_id=gMC->CurrentVolOffID(1,copy);
+    pad_x=copy;  
+    
+    strip_id=gMC->CurrentVolOffID(5,copy);
+    strip=copy;  
+
+    pad_z = (strip-1)*2+pad_z;
+
     gMC->TrackPosition(pos);
     gMC->TrackMomentum(mom);
-    //
+
+    rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
+    phi = TMath::ACos(pos[0]/rho);
+    Float_t as = TMath::ASin(pos[1]/rho);
+    if (as<0) phi = 2*3.141592654-phi;
+
+    z = pos[2];
+   
+    if (z<=  62. && z>=-62.) plate = 3;
+    if (z<= 216. && z>62.)   plate = 4;
+    if (z>=-216. && z<-62.)  plate = 2;
+    if (z>216.)  plate = 5;
+    if (z<-216.) plate = 1;
+
+    phid = phi*kRaddeg;
+    sector = Int_t (phid/20.);
+    sector++;
+
     Double_t ptot=mom.Rho();
     Double_t norm=1/ptot;
     for(i=0;i<3;++i) {
@@ -553,7 +574,8 @@ void AliTOFv0::StepManager()
     }
     hits[6]=ptot;
     hits[7]=pos[3];
-    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+    new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector, plate, pad_x, pad_z, hits);
   }
 }
 
+