]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDPreprocessor.cxx
Add a comment behind ClassDef
[u/mrichter/AliRoot.git] / TRD / AliTRDPreprocessor.cxx
index 45c8bfd0fb099eca9419f1931339a6e413a77b90..9f6cdacd4a271c4c87f4fbb94817f729dc1911bf 100644 (file)
@@ -1,10 +1,31 @@
-////////////////////////////////////////////////////////
-//
-// This class is a first implementation for the TRD.
-// It takes data from HLT and computes the parameters
-// and stores both reference data and online calibration parameters in the CDB 
-//
-/////////////////////////////////////////////////////////
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+// This class is a first implementation for the TRD.                      //
+// It takes data from HLT and computes the parameters                     //
+// and stores both reference data and online calibration                  //
+// parameters in the CDB                                                  //
+//                                                                        //
+// Author:                                                                //
+//   R. Bailhache (R.Bailhache@gsi.de)                                    //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
 
 #include "AliTRDPreprocessor.h"
 
 #include "AliDCSValue.h"
 #include "AliLog.h"
 
-#include "AliTRDCalibra.h"
+#include "AliTRDCalibraFit.h"
+#include "AliTRDCalibraMode.h"
 #include "Cal/AliTRDCalDet.h"
 
-
 ClassImp(AliTRDPreprocessor)
 
 //______________________________________________________________________________________________
-AliTRDPreprocessor::AliTRDPreprocessor(const Char_t *detector, AliShuttleInterface *shuttle)
-                   :AliPreprocessor(detector, shuttle)
+AliTRDPreprocessor::AliTRDPreprocessor(AliShuttleInterface *shuttle)
+                   :AliPreprocessor("TRD", shuttle)
 {
   //
   // Constructor
@@ -62,7 +83,7 @@ void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
 UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
 {
   //
-  // Process the calibraion data for the HLT part
+  // Process the calibration data for the HLT part
   //
 
   // How long does it take for the HLT part?
@@ -75,7 +96,6 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
   metaData.SetResponsible("Raphaelle Bailhache");
   metaData.SetComment("This preprocessor fills reference data.");
 
-
   // Take the file from the HLT file exchange server
   TList *filesources = GetFileSources(kHLT,"GAINDRIFTPRF");
   if (!filesources) {
@@ -88,7 +108,18 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
   }
 
   // Call a AliTRDCalibra instance for fit
-  AliTRDCalibra *calibra = AliTRDCalibra::Instance();
+  AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
+
+  //Choose the fit methods
+  calibra->SetFitChargeNDB(4); //for the relative gain
+  calibra->SetFitMeanWOn();   //weighted mean
+  calibra->SetFitPHNDB(3);    //for the average pulse height
+  calibra->SetFitLagrPolOn(); //LagrPol
+  calibra->SetFitPRFNDB(0);   //for the PRF
+  calibra->SetFitPRFOn();     //gaussian fit
+
+  //Debug mode
+  //calibra->SetDebug(1);       //Debug
 
   // Init some things
   AliTRDCalDet *objgaindet          = 0x0; // Object for det average gain factor
@@ -107,14 +138,13 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
   Double_t statisticmean[3]    = { 0.0, 0.0, 0.0 }; // Mean values of the number of entries in these histos
   Int_t    numbertotalgroup[3] = { 0,   0,   0   }; // Total number of groups
 
-
-  // Loop over the files taken from the HLT/
+  // Loop over the files taken from the HLT
   TIter iter(filesources);
   TObjString *source;
   while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
     
     TString filename = GetFile(kHLT,"GAINDRIFTPRF",source->GetName());
-    if (!filename.Data()) {
+    if (filename.Length() == 0) {
       AliError(Form("Error retrieving file from source %d failed!", source->GetName()));
       delete filesources;
       return 0;
@@ -142,12 +172,12 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
     // Set the mode of calibration from the TObject, store the reference data and try to fit them
     if (histogain) {
       calibra->SetModeCalibrationFromTObject((TObject *) histogain,0);
-      Store("Data","Gain",(TObject *) histogain,&metaData,0,0);
+      StoreReferenceData("HLTData","Gain",(TObject *) histogain,&metaData);
       AliInfo("Take the CH reference data. Now we will try to fit\n");
       calibra->SetMinEntries(100); // If there is less than 100 entries in the histo: no fit
       calibra->FitCHOnline(histogain);
-      numbertotalgroup[0] = 6*4*18*((Int_t) calibra->GetDetChamb0(0))
-                          + 6*  18*((Int_t) calibra->GetDetChamb2(0));
+      numbertotalgroup[0] = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0))
+                         + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0));
       numberfit[0]        = calibra->GetNumberFit();
       statisticmean[0]    = calibra->GetStatisticMean(); 
       numberEnt[0]        = calibra->GetNumberEnt();
@@ -157,12 +187,12 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
     
     if (histodriftvelocity) {
       calibra->SetModeCalibrationFromTObject((TObject *) histodriftvelocity,1);
-      Store("Data","VdriftT0",(TObject *) histodriftvelocity,&metaData,0,0);
+      StoreReferenceData("HLTData","VdriftT0",(TObject *) histodriftvelocity,&metaData);
       AliInfo("Take the PH reference data. Now we will try to fit\n");
       calibra->SetMinEntries(100*20); // If there is less than 2000
       calibra->FitPHOnline(histodriftvelocity);
-      numbertotalgroup[1] = 6*4*18*((Int_t) calibra->GetDetChamb0(1))
-                          + 6*  18*((Int_t) calibra->GetDetChamb2(1));
+      numbertotalgroup[1] = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
+                         + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
       numberfit[1]        = calibra->GetNumberFit();
       statisticmean[1]    = calibra->GetStatisticMean(); 
       numberEnt[1]        = calibra->GetNumberEnt();
@@ -174,13 +204,13 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
     
     if (histoprf) {
       calibra->SetModeCalibrationFromTObject((TObject *) histoprf,2);
-      Store("Data","PRF",(TObject *) histoprf,&metaData,0,0);
+      StoreReferenceData("HLTData","PRF",(TObject *) histoprf,&metaData);
       AliInfo("Take the PRF reference data. Now we will try to fit\n");
       calibra->SetMinEntries(100*20); // If there is less than 2000
       calibra->SetRangeFitPRF(0.5);
       calibra->FitPRFOnline(histoprf);
-      numbertotalgroup[2] = 6*4*18*((Int_t) calibra->GetDetChamb0(2))
-                          + 6*  18*((Int_t) calibra->GetDetChamb2(2));
+      numbertotalgroup[2] = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2))
+                           + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2));
       numberfit[2]        = calibra->GetNumberFit();
       statisticmean[2]    = calibra->GetStatisticMean(); 
       numberEnt[2]        = calibra->GetNumberEnt();
@@ -199,7 +229,7 @@ UInt_t AliTRDPreprocessor::Process(TMap* /*dcsAliasMap*/)
   AliInfo(Form("FOR THE PRF: There is a mean statistic of: %f, with %d fits for %d groups and %d histos with entries"
               ,statisticmean[2],numberfit[2],numbertotalgroup[2],numberEnt[2]));
   
-
+  
   //
   // Store the coefficients in the grid OCDB if enough statistics
   //