Change to TRDdigitizer
[u/mrichter/AliRoot.git] / TRD / AliTRDcreateDigits.C
index da75b659fe49dacbb3f09d442d543acf08086fec..945f835b271ba22dc7f6bc81c01a694a2932b03a 100644 (file)
@@ -6,8 +6,6 @@ Int_t AliTRDcreateDigits()
 
   Int_t rc = 0;
 
-  return rc;
-
   if (!gAlice) {
     cout << "<AliTRDcreateDigits> No AliRun object found" << endl;
     rc = 1;
@@ -16,25 +14,42 @@ Int_t AliTRDcreateDigits()
   gAlice->GetEvent(0);
 
   // Create the TRD digitzer 
-  AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","Digitizer class");
+  AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer","Digitizer class");
+  digitizer->InitDetector();
+
+  // Set the parameter (for TRF ~200ns)
+  digitizer->SetGasGain(1600.);
+  digitizer->SetChipGain(8.0);
+  digitizer->SetNoise(1000.);
+  digitizer->SetADCinRange(1000.);
+  digitizer->SetADCoutRange(1023.);
+  digitizer->SetADCthreshold(0);
+  digitizer->SetVerbose(1);
 
-  // Initialize the TRD and the geometry
-  if (!Digitizer->InitDetector()) {
-    cout << "<AliTRDcreateDigits> No TRD geometry found" << endl;
+  // Create the digits
+  if (!(digitizer->MakeDigits())) {
     rc = 2;
     return rc;
   }
 
-  // Set the parameter
-  Digitizer->SetDiffusion();
-  Digitizer->SetVerbose(1);
-
-  // Create the digits
-  if (!Digitizer->MakeDigits()) {
+  // Write the digits into the input file
+  if (!(digitizer->MakeBranch())) {
     rc = 3;
     return rc;
   }
 
+  // Write the digits into the input file
+  if (!(digitizer->WriteDigits())) {
+    rc = 4;
+    return rc;
+  }
+
+  // Save the digitizer class in the AliROOT file
+  if (!(digitizer->Write())) {
+    rc = 4;
+    return rc;
+  }
+
   return rc;
 
 }