]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRD.cxx
Faster version of raw data reading + raw-data error log
[u/mrichter/AliRoot.git] / TRD / AliTRD.cxx
index 8b0ce742af379b450807a67dfe598ff9c91d2ac3..9b48974e5b2b5e6272f8d69cf04a90149e318577 100644 (file)
@@ -46,6 +46,7 @@
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliTrackReference.h"
+#include "AliRawReader.h"
 
 #include "AliTRD.h"
 #include "AliTRDdigit.h"
@@ -294,14 +295,19 @@ void AliTRD::Digits2Raw()
 
 //_____________________________________________________________________________
 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
-                  , Bool_t inDrift)
+                  , Float_t time, Bool_t inDrift)
 {
   //
   // Add a hit for the TRD
   // 
 
   TClonesArray &lhits = *fHits;
-  AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
+  AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt
+                                                 ,track
+                                                 ,det
+                                                 ,hits
+                                                 ,q
+                                                 ,time);
 
   if (inDrift) {
     hit->SetDrift();
@@ -623,10 +629,6 @@ void AliTRD::CreateMaterials()
   AliMedium(25,"Serv-Cu"    , 5,0,isxfld,sxmgmx
               ,tmaxfd,stemax,deemax,epsil,stmin);
 
-  // Special tracking options for charged particles for XeCO2
-  gMC->Gstpar((* fIdtmed)[9],"DRAY",1.0);
-  gMC->Gstpar((* fIdtmed)[9],"STRA",1.0); 
-
   // Save the density values for the TRD absorbtion
   Float_t dmy  = 1.39;
   fFoilDensity = dmy;
@@ -707,7 +709,14 @@ void AliTRD::Init()
   if (fGeometry->IsVersion() != 1) {
     AliError("Not a valid geometry");
   }
-  
+
+  // Special tracking options for charged particles for XeCO2
+  gMC->Gstpar((* fIdtmed)[9],"DRAY"    , 1.0);
+  gMC->Gstpar((* fIdtmed)[9],"STRA"    , 1.0); 
+  gMC->Gstpar((* fIdtmed)[9],"LOSS"    ,13.0);      // Specific energy loss
+  gMC->Gstpar((* fIdtmed)[9],"PRIMIO_E",23.53);     // 1st ionisation potential
+  gMC->Gstpar((* fIdtmed)[9],"PRIMIO_N",19.344431); // Number of primaries
+
 }
 
 //_____________________________________________________________________________
@@ -902,6 +911,40 @@ void AliTRD::SetTreeAddress()
 
 }
 
+//_____________________________________________________________________________
+Bool_t AliTRD::Raw2SDigits(AliRawReader *rawReader)
+{
+  //
+  // Converts RAW data to SDigits
+  //
+
+  AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
+  if (!loader) {
+    AliError("Can not get TRD loader from Run Loader");
+    return kFALSE;
+  }
+    
+  TTree *tree = 0;
+  tree = loader->TreeS();
+  if (!tree) {
+    loader->MakeTree("S");
+    tree = loader->TreeS();
+  }
+
+  AliTRDrawData       *rawdata        = new AliTRDrawData();
+  AliTRDdigitsManager *sdigitsManager = rawdata->Raw2Digits(rawReader);
+  if (sdigitsManager) {
+    sdigitsManager->SetSDigits(kTRUE);
+    sdigitsManager->MakeBranch(tree);
+    sdigitsManager->WriteDigits();
+    return kTRUE;
+  } 
+  else {
+    return kFALSE;
+  }
+
+}
+
 //_____________________________________________________________________________
 AliTRD &AliTRD::operator=(const AliTRD &trd)
 {
@@ -915,339 +958,4 @@ AliTRD &AliTRD::operator=(const AliTRD &trd)
 
   return *this;
 
-} 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+}