]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDv1.cxx
Minor corrections needed on alpha
[u/mrichter/AliRoot.git] / TRD / AliTRDv1.cxx
index 38ee115a6c8b0190667b0fcba85f97855a3c6280..0d56cd7221bfa0795de89d010c96e4408181e89e 100644 (file)
 
 /*
 $Log$
+Revision 1.21  2000/06/09 11:10:07  cblume
+Compiler warnings and coding conventions, next round
+
+Revision 1.20  2000/06/08 18:32:58  cblume
+Make code compliant to coding conventions
+
+Revision 1.19  2000/06/07 16:27:32  cblume
+Try to remove compiler warnings on Sun and HP
+
+Revision 1.18  2000/05/08 16:17:27  cblume
+Merge TRD-develop
+
 Revision 1.17.2.1  2000/05/08 14:59:16  cblume
 Made inline function non-virtual. Bug fix in setting sensitive chamber
 
@@ -74,6 +86,30 @@ Introduction of the Copyright and cvs Log
 
 ClassImp(AliTRDv1)
 
+//_____________________________________________________________________________
+AliTRDv1::AliTRDv1():AliTRD()
+{
+  //
+  // Default constructor
+  //
+
+  fIdSens          =  0;
+
+  fIdChamber1      =  0;
+  fIdChamber2      =  0;
+  fIdChamber3      =  0;
+
+  fSensSelect      =  0;
+  fSensPlane       = -1;
+  fSensChamber     = -1;
+  fSensSector      = -1;
+  fSensSectorRange =  0;
+
+  fDeltaE          = NULL;
+
+}
+
 //_____________________________________________________________________________
 AliTRDv1::AliTRDv1(const char *name, const char *title) 
          :AliTRD(name, title) 
@@ -82,31 +118,81 @@ AliTRDv1::AliTRDv1(const char *name, const char *title)
   // Standard constructor for Transition Radiation Detector version 1
   //
 
-  fIdSens        =  0;
+  fIdSens          =  0;
 
-  fIdChamber1    =  0;
-  fIdChamber2    =  0;
-  fIdChamber3    =  0;
+  fIdChamber1      =  0;
+  fIdChamber2      =  0;
+  fIdChamber3      =  0;
 
-  fSensSelect    =  0;
-  fSensPlane     = -1;
-  fSensChamber   = -1;
-  fSensSector    = -1;
+  fSensSelect      =  0;
+  fSensPlane       = -1;
+  fSensChamber     = -1;
+  fSensSector      = -1;
+  fSensSectorRange =  0;
 
-  fDeltaE        = NULL;
+  fDeltaE          = NULL;
 
   SetBufferSize(128000);
 
 }
 
+//_____________________________________________________________________________
+AliTRDv1::AliTRDv1(const AliTRDv1 &trd)
+{
+  //
+  // Copy constructor
+  //
+
+  ((AliTRDv1 &) trd).Copy(*this);
+
+}
+
 //_____________________________________________________________________________
 AliTRDv1::~AliTRDv1()
 {
+  //
+  // AliTRDv1 destructor
+  //
 
   if (fDeltaE) delete fDeltaE;
 
 }
  
+//_____________________________________________________________________________
+AliTRDv1 &AliTRDv1::operator=(const AliTRDv1 &trd)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &trd) ((AliTRDv1 &) trd).Copy(*this);
+  return *this;
+
+}
+//_____________________________________________________________________________
+void AliTRDv1::Copy(TObject &trd)
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDv1 &) trd).fIdSens          = fIdSens;
+
+  ((AliTRDv1 &) trd).fIdChamber1      = fIdChamber1;
+  ((AliTRDv1 &) trd).fIdChamber2      = fIdChamber2;
+  ((AliTRDv1 &) trd).fIdChamber3      = fIdChamber3;
+
+  ((AliTRDv1 &) trd).fSensSelect      = fSensSelect;
+  ((AliTRDv1 &) trd).fSensPlane       = fSensPlane;
+  ((AliTRDv1 &) trd).fSensChamber     = fSensChamber;
+  ((AliTRDv1 &) trd).fSensSector      = fSensSector;
+  ((AliTRDv1 &) trd).fSensSectorRange = fSensSectorRange;
+
+  ((AliTRDv1 &) trd).fDeltaE          = NULL;
+
+}
+
 //_____________________________________________________________________________
 void AliTRDv1::CreateGeometry()
 {
@@ -116,8 +202,8 @@ void AliTRDv1::CreateGeometry()
   //
 
   // Check that FRAME is there otherwise we have no place where to put the TRD
-  AliModule* FRAME = gAlice->GetModule("FRAME");
-  if (!FRAME) return;
+  AliModule* frame = gAlice->GetModule("FRAME");
+  if (!frame) return;
 
   // Define the chambers
   AliTRD::CreateGeometry();
@@ -150,8 +236,12 @@ void AliTRDv1::Init()
       printf("          Only plane %d is sensitive\n",fSensPlane);
     if (fSensChamber >= 0)   
       printf("          Only chamber %d is sensitive\n",fSensChamber);
-    if (fSensSector  >= 0)
-      printf("          Only sector %d is sensitive\n",fSensSector);
+    if (fSensSector  >= 0) {
+      Int_t sens1  = fSensSector;
+      Int_t sens2  = fSensSector + fSensSectorRange;
+            sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect;
+      printf("          Only sectors %d - %d are sensitive\n",sens1,sens2-1);
+    }
   }
   printf("\n");
 
@@ -160,9 +250,9 @@ void AliTRDv1::Init()
   // Maximum energy (50 keV);
   const Float_t kEend = 50000.0;
   // Ermilova distribution for the delta-ray spectrum
-  Float_t Poti = TMath::Log(kPoti);
-  Float_t Eend = TMath::Log(kEend);
-  fDeltaE  = new TF1("deltae",Ermilova,Poti,Eend,0);
+  Float_t poti = TMath::Log(kPoti);
+  Float_t eEnd = TMath::Log(kEend);
+  fDeltaE  = new TF1("deltae",Ermilova,poti,eEnd,0);
 
   // Identifier of the sensitive volume (drift region)
   fIdSens     = gMC->VolId("UL05");
@@ -224,16 +314,40 @@ void AliTRDv1::SetSensSector(Int_t isector)
   // Defines the hit-sensitive sector (0-17)
   //
 
+  SetSensSector(isector,1);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDv1::SetSensSector(Int_t isector, Int_t nsector)
+{
+  //
+  // Defines a range of hit-sensitive sectors. The range is defined by
+  // <isector> (0-17) as the starting point and <nsector> as the number 
+  // of sectors to be included.
+  //
+
   if ((isector < 0) || (isector > 17)) {
-    printf("Wrong input value: %d\n",isector);
+    printf("Wrong input value <isector>: %d\n",isector);
     printf("Use standard setting\n");
-    fSensSector = -1;
-    fSensSelect =  0;
+    fSensSector      = -1;
+    fSensSectorRange =  0;
+    fSensSelect      =  0;
     return;
   }
 
-  fSensSelect = 1;
-  fSensSector = isector;
+  if ((nsector < 1) || (nsector > 18)) {
+    printf("Wrong input value <nsector>: %d\n",nsector);
+    printf("Use standard setting\n");
+    fSensSector      = -1;
+    fSensSectorRange =  0;
+    fSensSelect      =  0;
+    return;
+  }
+
+  fSensSelect      = 1;
+  fSensSector      = isector;
+  fSensSectorRange = nsector;
 
 }
 
@@ -255,6 +369,8 @@ void AliTRDv1::StepManager()
   Int_t    sec = 0;
   Int_t    iPdg;
 
+  Int_t    det[1];
+
   Float_t  hits[4];
   Float_t  random[1];
   Float_t  charge;
@@ -285,7 +401,7 @@ void AliTRDv1::StepManager()
   const Float_t  kPoti    = 12.1;
 
   // PDG code electron
-  const Int_t    pdgElectron = 11;
+  const Int_t    kPdgElectron = 11;
 
   // Set the maximum step size to a very large number for all 
   // neutral particles and those outside the driftvolume
@@ -348,23 +464,34 @@ void AliTRDv1::StepManager()
       if (fSensSelect) {
         if ((fSensPlane   >= 0) && (pla != fSensPlane  )) addthishit = 0;
         if ((fSensChamber >= 0) && (cha != fSensChamber)) addthishit = 0;
-        if ((fSensSector  >= 0) && (sec != fSensSector )) addthishit = 0;
+        if (fSensSector  >= 0) {
+          Int_t sens1  = fSensSector;
+          Int_t sens2  = fSensSector + fSensSectorRange;
+                sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect;
+          if (sens1 < sens2) {
+            if ((sec < sens1) || (sec >= sens2)) addthishit = 0;
+         }
+          else {
+            if ((sec < sens1) && (sec >= sens2)) addthishit = 0;
+         }
+       }
       }
 
       // Add this hit
       if (addthishit) {
 
+        det[0] = fGeometry->GetDetector(pla,cha,sec);
         new(lhits[fNhits++]) AliTRDhit(fIshunt
                                       ,gAlice->CurrentTrack()
-                                      ,fGeometry->GetDetector(pla,cha,sec)
+                                      ,det
                                       ,hits);
 
         // The energy loss according to Bethe Bloch
         gMC->TrackMomentum(mom);
         pTot = mom.Rho();
         iPdg = TMath::Abs(gMC->TrackPid());
-        if ( (iPdg != pdgElectron) ||
-           ((iPdg == pdgElectron) && (pTot < kPTotMax))) {
+        if ( (iPdg != kPdgElectron) ||
+           ((iPdg == kPdgElectron) && (pTot < kPTotMax))) {
           aMass     = gMC->TrackMass();
           betaGamma = pTot / aMass;
           pp        = kPrim * BetheBloch(betaGamma);
@@ -446,23 +573,23 @@ Double_t Ermilova(Double_t *x, Double_t *)
 
   Int_t    pos1, pos2;
 
-  const Int_t nV = 31;
+  const Int_t kNv = 31;
 
-  Float_t vxe[nV] = { 2.3026, 2.9957, 3.4012, 3.6889, 3.9120  
-                    , 4.0943, 4.2485, 4.3820, 4.4998, 4.6052
-                    , 4.7005, 5.0752, 5.2983, 5.7038, 5.9915
-                    , 6.2146, 6.5221, 6.9078, 7.3132, 7.6009
-                    , 8.0064, 8.5172, 8.6995, 8.9872, 9.2103
-                    , 9.4727, 9.9035,10.3735,10.5966,10.8198
-                    ,11.5129 };
+  Float_t vxe[kNv] = { 2.3026, 2.9957, 3.4012, 3.6889, 3.9120  
+                     , 4.0943, 4.2485, 4.3820, 4.4998, 4.6052
+                     , 4.7005, 5.0752, 5.2983, 5.7038, 5.9915
+                     , 6.2146, 6.5221, 6.9078, 7.3132, 7.6009
+                     , 8.0064, 8.5172, 8.6995, 8.9872, 9.2103
+                     , 9.4727, 9.9035,10.3735,10.5966,10.8198
+                     ,11.5129 };
 
-  Float_t vye[nV] = { 80.0  , 31.0  , 23.3  , 21.1  , 21.0
-                    , 20.9  , 20.8  , 20.0  , 16.0  , 11.0
-                    ,  8.0  ,  6.0  ,  5.2  ,  4.6  ,  4.0
-                    ,  3.5  ,  3.0  ,  1.4  ,  0.67 ,  0.44
-                    ,  0.3  ,  0.18 ,  0.12 ,  0.08 ,  0.056
-                    ,  0.04 ,  0.023,  0.015,  0.011,  0.01
-                   ,  0.004 };
+  Float_t vye[kNv] = { 80.0  , 31.0  , 23.3  , 21.1  , 21.0
+                     , 20.9  , 20.8  , 20.0  , 16.0  , 11.0
+                     ,  8.0  ,  6.0  ,  5.2  ,  4.6  ,  4.0
+                     ,  3.5  ,  3.0  ,  1.4  ,  0.67 ,  0.44
+                     ,  0.3  ,  0.18 ,  0.12 ,  0.08 ,  0.056
+                     ,  0.04 ,  0.023,  0.015,  0.011,  0.01
+                    ,  0.004 };
 
   energy = x[0];
 
@@ -474,7 +601,7 @@ Double_t Ermilova(Double_t *x, Double_t *)
   } 
   while (dpos > 0);
   pos2--; 
-  if (pos2 > nV) pos2 = nV;
+  if (pos2 > kNv) pos2 = kNv;
   pos1 = pos2 - 1;
 
   // Differentiate between the sampling points