]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update of calibration classes by Jan Fiete
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Mar 2006 08:09:23 +0000 (08:09 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Mar 2006 08:09:23 +0000 (08:09 +0000)
50 files changed:
TRD/AliTRDReconstructor.cxx
TRD/AliTRDReconstructor.h
TRD/AliTRDcalibDB.cxx
TRD/AliTRDcalibDB.h
TRD/AliTRDclusterizer.cxx
TRD/AliTRDclusterizer.h
TRD/AliTRDclusterizerV1.cxx
TRD/AliTRDclusterizerV1.h
TRD/AliTRDdigitizer.cxx
TRD/AliTRDdigitizer.h
TRD/AliTRDgeometry.cxx
TRD/AliTRDgeometry.h
TRD/AliTRDpidESD.cxx
TRD/AliTRDsimpleMC.cxx
TRD/AliTRDsimpleMC.h
TRD/AliTRDtracker.cxx
TRD/AliTRDtracker.h
TRD/Cal/AliTRDCalChamberPos.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalChamberPos.h [new file with mode: 0644]
TRD/Cal/AliTRDCalChamberStatus.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalChamberStatus.h [new file with mode: 0644]
TRD/Cal/AliTRDCalDet.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalDet.h [new file with mode: 0644]
TRD/Cal/AliTRDCalGlobals.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalGlobals.h [new file with mode: 0644]
TRD/Cal/AliTRDCalMCMStatus.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalMCMStatus.h [new file with mode: 0644]
TRD/Cal/AliTRDCalMonitoring.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalMonitoring.h [new file with mode: 0644]
TRD/Cal/AliTRDCalPIDLQ.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalPIDLQ.h [new file with mode: 0644]
TRD/Cal/AliTRDCalPad.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalPad.h [new file with mode: 0644]
TRD/Cal/AliTRDCalPadStatus.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalPadStatus.h [new file with mode: 0644]
TRD/Cal/AliTRDCalROC.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalROC.h [new file with mode: 0644]
TRD/Cal/AliTRDCalSingleChamberStatus.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalSingleChamberStatus.h [new file with mode: 0644]
TRD/Cal/AliTRDCalStackPos.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalStackPos.h [new file with mode: 0644]
TRD/Cal/AliTRDCalSuperModulePos.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalSuperModulePos.h [new file with mode: 0644]
TRD/Cal/AliTRDCalSuperModuleStatus.cxx [new file with mode: 0644]
TRD/Cal/AliTRDCalSuperModuleStatus.h [new file with mode: 0644]
TRD/Cal/AliTRDCreateDummyCDB.C [new file with mode: 0644]
TRD/Cal/AliTRDTestCal.C [new file with mode: 0644]
TRD/Cal/AliTRDbenchmarkCalibDB.C [new file with mode: 0644]
TRD/TRDbaseLinkDef.h
TRD/libTRDbase.pkg

index b5e76c58ab3dcaa2071152216415c7b65c002518..ee4d145ccbc33d50269002af5376ccd1ce0fd5aa 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "AliTRDReconstructor.h"
 #include "AliRunLoader.h"
-#include "AliTRDparameter.h"
 #include "AliTRDclusterizerV1.h"
 #include "AliTRDtracker.h"
 #include "AliTRDpidESD.h"
@@ -45,13 +44,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader) const
 
   AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer");
   runLoader->CdGAFile();
-  AliTRDparameter* trdParam = GetTRDparameter(runLoader); 
-  if (!trdParam) {
-    Error("Reconstruct", "no TRD parameters found");
-    return;
-  }
-  trdParam->ReInit();
-  clusterer.SetParameter(trdParam);
   Int_t nEvents = runLoader->GetNumberOfEvents();
 
   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
@@ -77,13 +69,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader,
 
   AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer");
   runLoader->CdGAFile();
-  AliTRDparameter* trdParam = GetTRDparameter(runLoader); 
-  if (!trdParam) {
-    Error("Reconstruct", "no TRD parameters found");
-    return;
-  }
-  trdParam->ReInit();
-  clusterer.SetParameter(trdParam);
   Int_t nEvents = runLoader->GetNumberOfEvents();
 
   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
@@ -122,18 +107,4 @@ void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/,
 }
 
 
-//_____________________________________________________________________________
-AliTRDparameter* AliTRDReconstructor::GetTRDparameter(AliRunLoader* runLoader) const
-{
-// get the TRD parameters
-
-  runLoader->CdGAFile();
-  AliTRDparameter* trdParam = (AliTRDparameter*) gFile->Get("TRDparameter"); 
-  if (!trdParam) {
-    Error("GetTRDparameter", "no TRD parameters available");
-    return NULL;
-  }
-  return trdParam;
-}
-
 
index 28a64b80dcbd3803a36372e7b07ec0a5074a6da1..2935dc0d47d8aa8517717ed9cbf1d07617130201 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "AliReconstructor.h"
 
-class AliTRDparameter;
 class AliRawReader;
 
 class AliTRDReconstructor: public AliReconstructor {
@@ -32,7 +31,6 @@ public:
   virtual void         FillESD(AliRunLoader* runLoader, AliESD* esd) const;
 
 private:
-  AliTRDparameter*     GetTRDparameter(AliRunLoader* runLoader) const;
 
   ClassDef(AliTRDReconstructor, 0)   // class for the TRD reconstruction
 };
index 9a640c0d33d6f5f1971f0dbb5498ed576411092c..2bbd584d49c7c09e73b90cbf27921cddce6236b6 100644 (file)
 #include "AliTRDpadPlane.h"
 #include "AliTRDCommonParam.h"
 
-#include "AliTRDCalROC.h"
-#include "AliTRDCalChamberPos.h"
-#include "AliTRDCalStackPos.h"
-#include "AliTRDCalPad.h"
-#include "AliTRDCalDet.h"
-#include "AliTRDCalGlobals.h"
-#include "AliTRDCalPIDLQ.h"
+#include "Cal/AliTRDCalROC.h"
+
+#include "Cal/AliTRDCalChamberPos.h"
+#include "Cal/AliTRDCalStackPos.h"
+#include "Cal/AliTRDCalSuperModulePos.h"
+
+#include "Cal/AliTRDCalPad.h"
+#include "Cal/AliTRDCalDet.h"
+#include "Cal/AliTRDCalGlobals.h"
+#include "Cal/AliTRDCalPIDLQ.h"
+#include "Cal/AliTRDCalMonitoring.h"
+
+#include "Cal/AliTRDCalSuperModuleStatus.h"
+#include "Cal/AliTRDCalChamberStatus.h"
+#include "Cal/AliTRDCalMCMStatus.h"
+#include "Cal/AliTRDCalPadStatus.h"
+#include "Cal/AliTRDCalSingleChamberStatus.h"
 
 ClassImp(AliTRDcalibDB)
 
@@ -152,17 +162,30 @@ const TObject* AliTRDcalibDB::GetCachedCDBObject(Int_t id)
     switch (id)
     {
       // parameters defined per pad and chamber
-      case kIDVdrift : return CacheMergeCDBEntry(kIDVdrift, "TRD/Calib/LocalVdrift", "TRD/Calib/ChamberVdrift"); break;
-      case kIDT0 : return CacheMergeCDBEntry(kIDT0, "TRD/Calib/LocalT0", "TRD/Calib/ChamberT0"); break;
-      
+      case kIDVdriftPad : return CacheCDBEntry(kIDVdriftPad, "TRD/Calib/LocalVdrift"); break;
+      case kIDVdriftChamber : return CacheCDBEntry(kIDVdriftChamber, "TRD/Calib/ChamberVdrift"); break;
+
+      case kIDT0Pad : return CacheCDBEntry(kIDT0Pad, "TRD/Calib/LocalT0"); break;
+      case kIDT0Chamber : return CacheCDBEntry(kIDT0Chamber, "TRD/Calib/ChamberT0"); break;
+
+      case kIDGainFactorPad : return CacheCDBEntry(kIDGainFactorPad, "TRD/Calib/LocalGainFactor"); break;
+      case kIDGainFactorChamber : return CacheCDBEntry(kIDGainFactorChamber, "TRD/Calib/ChamberGainFactor"); break;
+
       // parameters defined per pad
-      case kIDGainFactor : return CacheCDBEntry(kIDGainFactor, "TRD/Calib/GainFactor"); break;
       case kIDPRFWidth : return CacheCDBEntry(kIDPRFWidth, "TRD/Calib/PRFWidth"); break;
-    
+
+      // status values
+      case kIDSuperModuleStatus : return CacheCDBEntry(kIDSuperModuleStatus, "TRD/Calib/SuperModuleStatus"); break;
+      case kIDChamberStatus : return CacheCDBEntry(kIDChamberStatus, "TRD/Calib/ChamberStatus"); break;
+      case kIDMCMStatus : return CacheCDBEntry(kIDMCMStatus, "TRD/Calib/MCMStatus"); break;
+      case kIDPadStatus : return CacheCDBEntry(kIDPadStatus, "TRD/Calib/PadStatus"); break;
+
       // global parameters
+      case kIDMonitoringData : return CacheCDBEntry(kIDMonitoringData, "TRD/Calib/MonitoringData"); break;
       case kIDGlobals : return CacheCDBEntry(kIDGlobals, "TRD/Calib/Globals"); break;
-      case kIDChamber : return CacheCDBEntry(kIDChamber, "TRD/Calib/Chamber"); break;
-      case kIDStack : return CacheCDBEntry(kIDStack, "TRD/Calib/Stack"); break;
+      case kIDSuperModulePos : return CacheCDBEntry(kIDSuperModulePos, "TRD/Calib/SuperModulePos"); break;
+      case kIDChamberPos : return CacheCDBEntry(kIDChamberPos, "TRD/Calib/ChamberPos"); break;
+      case kIDStackPos : return CacheCDBEntry(kIDStackPos, "TRD/Calib/StackPos"); break;
       case kIDPIDLQ : return CacheCDBEntry(kIDPIDLQ, "TRD/Calib/PIDLQ"); break;
     }
     return 0;
@@ -213,72 +236,21 @@ const TObject* AliTRDcalibDB::CacheCDBEntry(Int_t id, const char* cdbPath)
   return fCDBCache[id];
 }
 
-//_____________________________________________________________________________
-const TObject* AliTRDcalibDB::CacheMergeCDBEntry(Int_t id, const char* cdbPadPath, const char* cdbChamberPath)
-{
-  //
-  // Retrieves and caches an object (id <id>) from the CDB. This function is specialized for parameters which are stored
-  // as local variation at pad level of a global variable defined per detector chamber. It uses the classes AliTRDCalPad and AliTRDCalDet.
-  // Before storing the object it retrieves the local variations (cdbPadPath) and the global variable (cdbChamberPath) and merges them using
-  // the AliTRDCalPad::ScaleROCs.
-  //
-    
-  if (!fCDBCache[id]) 
-  {
-    AliTRDCalPad* padObject = 0;
-    AliTRDCalDet* detObject = 0;
-   
-    fCDBEntries[id] = GetCDBEntry(cdbPadPath);
-    if (fCDBEntries[id])
-      padObject = dynamic_cast<AliTRDCalPad*>(fCDBEntries[id]->GetObject());
-   
-    AliCDBEntry* mergeEntry = GetCDBEntry(cdbChamberPath);
-    if (mergeEntry)
-      detObject = dynamic_cast<AliTRDCalDet*>(mergeEntry->GetObject());
-    
-    if (!padObject || !detObject) 
-    {
-      if (fCDBEntries[id]) {
-        if (fCDBEntries[id]->IsOwner() == kFALSE && padObject)
-          delete padObject;
-        delete fCDBEntries[id];
-        fCDBEntries[id] = 0;
-      }
-      if (mergeEntry) 
-      {
-        if (mergeEntry->IsOwner() == kFALSE && detObject)
-          delete detObject;
-        delete mergeEntry;
-      }
-      return 0;
-    }
-    
-    padObject->ScaleROCs(detObject);
-    if (mergeEntry->IsOwner() == kFALSE)
-      delete detObject;
-    delete mergeEntry;
-    
-    fCDBCache[id] = padObject;
-  }
-  
-  return fCDBCache[id];
-}
-
 //_____________________________________________________________________________
 void AliTRDcalibDB::SetRun(Long64_t run)
 {
   //
-  // Sets current run number. Calibration data is read from the corresponding file. 
+  // Sets current run number. Calibration data is read from the corresponding file.
   // When the run number changes the caching is invalidated.
   //
-  
+
   if (fRun == run)
     return;
-  
+
   fRun = run;
   Invalidate();
 }
-  
+
 //_____________________________________________________________________________
 void AliTRDcalibDB::Invalidate()
 {
@@ -307,14 +279,14 @@ Bool_t AliTRDcalibDB::GetChamberPos(Int_t det, Float_t* xyz)
   // Returns the deviation of the chamber position from the nominal position.
   //
   
-  const AliTRDCalChamberPos* chamber = dynamic_cast<const AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamber));
+  const AliTRDCalChamberPos* chamber = dynamic_cast<const AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamberPos));
   if (!chamber)
     return kFALSE;
   
-  const Float_t* kvalues = chamber->GetChamberPos(det);
+  const Float_t* kvalues = chamber->GetPos(det);
   if (!kvalues)
     return kFALSE;
-  
+
   xyz[0] = kvalues[0];
   xyz[1] = kvalues[1];
   xyz[2] = kvalues[2];
@@ -329,11 +301,11 @@ Bool_t AliTRDcalibDB::GetChamberRot(Int_t det, Float_t* xyz)
   // Returns the rotation of the chamber from the nominal position.
   //
   
-  const AliTRDCalChamberPos* chamber = dynamic_cast<const AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamber));
+  const AliTRDCalChamberPos* chamber = dynamic_cast<const AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamberPos));
   if (!chamber)
     return kFALSE;
   
-  const Float_t* kvalues = chamber->GetChamberRot(det);
+  const Float_t* kvalues = chamber->GetRot(det);
   if (!kvalues)
     return kFALSE;
   
@@ -351,11 +323,11 @@ Bool_t AliTRDcalibDB::GetStackPos(Int_t chamber, Int_t sector, Float_t* xyz)
   // Returns the deviation of the stack position from the nominal position.
   //
   
-  const AliTRDCalStackPos* stack = dynamic_cast<const AliTRDCalStackPos*>(GetCachedCDBObject(kIDStack));
+  const AliTRDCalStackPos* stack = dynamic_cast<const AliTRDCalStackPos*>(GetCachedCDBObject(kIDStackPos));
   if (!stack)
     return kFALSE;
   
-  const Float_t* kvalues = stack->GetStackPos(chamber, sector);
+  const Float_t* kvalues = stack->GetPos(chamber, sector);
   if (!kvalues)
     return kFALSE;
   
@@ -373,11 +345,55 @@ Bool_t AliTRDcalibDB::GetStackRot(Int_t chamber, Int_t sector, Float_t* xyz)
   // Returns the rotation of the stack from the nominal position.
   //
   
-  const AliTRDCalStackPos* stack = dynamic_cast<const AliTRDCalStackPos*>(GetCachedCDBObject(kIDStack));
+  const AliTRDCalStackPos* stack = dynamic_cast<const AliTRDCalStackPos*>(GetCachedCDBObject(kIDStackPos));
   if (!stack)
     return kFALSE;
   
-  const Float_t* kvalues = stack->GetStackRot(chamber, sector);
+  const Float_t* kvalues = stack->GetRot(chamber, sector);
+  if (!kvalues)
+    return kFALSE;
+
+  xyz[0] = kvalues[0];
+  xyz[1] = kvalues[1];
+  xyz[2] = kvalues[2];
+  
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::GetSuperModulePos(Int_t sm, Float_t* xyz)
+{
+  //
+  // Returns the deviation of the supermodule position from the nominal position.
+  //
+  
+  const AliTRDCalSuperModulePos* smPos = dynamic_cast<const AliTRDCalSuperModulePos*>(GetCachedCDBObject(kIDSuperModulePos));
+  if (!smPos)
+    return kFALSE;
+  
+  const Float_t* kvalues = smPos->GetPos(sm);
+  if (!kvalues)
+    return kFALSE;
+  
+  xyz[0] = kvalues[0];
+  xyz[1] = kvalues[1];
+  xyz[2] = kvalues[2];
+  
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::GetSuperModuleRot(Int_t sm, Float_t* xyz)
+{
+  //
+  // Returns the rotation of the supermodule from the nominal position.
+  //
+  
+  const AliTRDCalSuperModulePos* smPos = dynamic_cast<const AliTRDCalSuperModulePos*>(GetCachedCDBObject(kIDSuperModulePos));
+  if (!smPos)
+    return kFALSE;
+  
+  const Float_t* kvalues = smPos->GetRot(sm);
   if (!kvalues)
     return kFALSE;
   
@@ -394,8 +410,8 @@ Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
   //
   // Returns the drift velocity for the given pad.
   //
-  
-  const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDVdrift));
+
+  const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDVdriftPad));
   if (!calPad)
     return -1;
 
@@ -403,7 +419,25 @@ Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
   if (!roc)
     return -1;
 
-  return roc->GetValue(col, row);
+  const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDVdriftChamber));
+  if (!calChamber)
+    return -1;
+
+  return calChamber->GetValue(det) * roc->GetValue(col, row);
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
+{
+  //
+  // Returns the average drift velocity for the given detector
+  //
+
+  const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDVdriftChamber));
+  if (!calDet)
+    return -1;
+
+  return calDet->GetValue(det);
 }
 
 //_____________________________________________________________________________
@@ -413,7 +447,7 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
   // Returns t0 for the given pad.
   //
   
-  const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDT0));
+  const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDT0Pad));
   if (!calPad)
     return -1;
 
@@ -421,7 +455,25 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
   if (!roc)
     return -1;
 
-  return roc->GetValue(col, row);
+  const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDT0Chamber));
+  if (!calChamber)
+    return -1;
+
+  return calChamber->GetValue(det) * roc->GetValue(col, row);
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDcalibDB::GetT0Average(Int_t det)
+{
+  //
+  // Returns the average t0 for the given detector
+  //
+
+  const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDT0Chamber));
+  if (!calDet)
+    return -1;
+
+  return calDet->GetValue(det);
 }
 
 //_____________________________________________________________________________
@@ -431,7 +483,7 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
   // Returns the gain factor for the given pad.
   //
   
-  const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDGainFactor));
+  const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDGainFactorPad));
   if (!calPad)
     return -1;
 
@@ -439,7 +491,25 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
   if (!roc)
     return -1;
 
-  return roc->GetValue(col, row);
+  const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDGainFactorChamber));
+  if (!calChamber)
+    return -1;
+
+  return calChamber->GetValue(det) * roc->GetValue(col, row);
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
+{
+  //
+  // Returns the average gain factor for the given detector
+  //
+
+  const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDGainFactorChamber));
+  if (!calDet)
+    return -1;
+
+  return calDet->GetValue(det);
 }
 
 //_____________________________________________________________________________
@@ -480,24 +550,210 @@ Int_t AliTRDcalibDB::GetNumberOfTimeBins()
   //
   // Returns the number of time bins which are read-out.
   //
-  
+
   const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals));
   if (!calGlobal)
-    return -1;  
-  
+    return -1;
+
   return calGlobal->GetNumberOfTimeBins();
 }
 
+//_____________________________________________________________________________
+Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns the status of the given pad
+  //
+
+  const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
+  if (!cal)
+    return -1;
+
+  const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
+  if (!roc)
+    return -1;
+
+  return roc->GetStatus(col, row);
+}
+
+//_____________________________________________________________________________
+Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns the status of the given MCM
+  //
+
+  const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*> (GetCachedCDBObject(kIDMCMStatus));
+  if (!cal)
+    return -1;
+
+  const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
+  if (!roc)
+    return -1;
+
+  return roc->GetStatus(col, row);
+}
+
+//_____________________________________________________________________________
+Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
+{
+  //
+  // Returns the status of the given chamber
+  //
+
+  const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
+  if (!cal)
+    return -1;
+
+  return cal->GetStatus(det);
+}
+
+//_____________________________________________________________________________
+Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm)
+{
+  //
+  // Returns the status of the given chamber
+  //
+
+  const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
+  if (!cal)
+    return -1;
+
+  return cal->GetStatus(sm);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsMasked(det, col, row);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsBridgedLeft(det, col, row);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsBridgedRight(det, col, row);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*> (GetCachedCDBObject(kIDMCMStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsMasked(det, col, row);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsInstalled(det);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsMasked(det);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsInstalled(det);
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
+  if (!cal)
+    return -1;
+
+  return cal->IsMasked(det);
+}
+
 //_____________________________________________________________________________
 const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject()
 {
   //
   // Returns the object storing the distributions for PID with likelihood
   //
-  
+
   return dynamic_cast<const AliTRDCalPIDLQ*> (GetCachedCDBObject(kIDPIDLQ));
 }
 
+//_____________________________________________________________________________
+const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject()
+{
+  //
+  // Returns the object storing the monitoring data
+  //
+
+  return dynamic_cast<const AliTRDCalMonitoring*> (GetCachedCDBObject(kIDMonitoringData));
+}
+
 //_____________________________________________________________________________
 Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift)
 {
index fe986b707dbbf227058512ff88605f35ee53dafc..ce308225f470cad145b33763b2e385660297434f 100644 (file)
@@ -21,6 +21,7 @@
 #include <AliCDBEntry.h>
 
 class AliTRDCalPIDLQ;
+class AliTRDCalMonitoring;
 
 class AliTRDcalibDB : public TObject
 {
@@ -31,43 +32,67 @@ public:
   static void Terminate();
 
   void SetRun(Long64_t run);
-  
+  Long64_t GetRun() { return fRun; }
+
   Bool_t GetChamberPos(Int_t det, Float_t* xyz);
-  Bool_t GetChamberPos(Int_t plane, Int_t chamber, Int_t sector, Float_t* xyz) { return GetChamberPos(AliTRDgeometry::GetDetector(plane, chamber, sector), xyz); }  
-  
   Bool_t GetChamberRot(Int_t det, Float_t* xyz);
-  Bool_t GetChamberRot(Int_t plane, Int_t chamber, Int_t sector, Float_t* xyz) { return GetChamberRot(AliTRDgeometry::GetDetector(plane, chamber, sector), xyz); }  
-  
+
   Bool_t GetStackPos(Int_t chamber, Int_t sector, Float_t* xyz);
   Bool_t GetStackRot(Int_t chamber, Int_t sector, Float_t* xyz);
-   
+
+  Bool_t GetSuperModulePos(Int_t sm, Float_t* xyz);
+  Bool_t GetSuperModuleRot(Int_t sm, Float_t* xyz);
+
   Float_t GetVdrift(Int_t det, Int_t col, Int_t row);
-  Float_t GetVdrift(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetVdrift(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); }
-    
+  Float_t GetVdriftAverage(Int_t det);
+
   Float_t GetT0(Int_t det, Int_t col, Int_t row);
-  Float_t GetT0(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetT0(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); }
-  
+  Float_t GetT0Average(Int_t det);
+
   Float_t GetGainFactor(Int_t det, Int_t col, Int_t row);
-  Float_t GetGainFactor(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetGainFactor(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); }
+  Float_t GetGainFactorAverage(Int_t det);
 
   Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row);
-  Float_t GetPRFWidth(Int_t plane, Int_t chamber, Int_t sector, Int_t col, Int_t row) { return GetPRFWidth(AliTRDgeometry::GetDetector(plane, chamber, sector), col, row); }
-  
-  Float_t GetSamplingFrequency(); 
+
+  Float_t GetSamplingFrequency();
   Int_t GetNumberOfTimeBins();
+
+  Char_t GetPadStatus(Int_t det, Int_t col, Int_t row);
+  Char_t GetMCMStatus(Int_t det, Int_t col, Int_t row);
+  Char_t GetChamberStatus(Int_t det);
+  Char_t GetSuperModuleStatus(Int_t sm);
+
+  Bool_t IsPadMasked(Int_t det, Int_t col, Int_t row);
+  Bool_t IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
+  Bool_t IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
   
-  const AliTRDCalPIDLQ* GetPIDLQObject();
+  Bool_t IsMCMMasked(Int_t det, Int_t col, Int_t row);
   
+  Bool_t IsChamberInstalled(Int_t det);
+  Bool_t IsChamberMasked(Int_t det);
+  
+  Bool_t IsSuperModuleInstalled(Int_t det);
+  Bool_t IsSuperModuleMasked(Int_t det);
+
+  const AliTRDCalMonitoring* GetMonitoringObject();
+  const AliTRDCalPIDLQ* GetPIDLQObject();
+
   //Related functions, these depend on calibration data
   static Float_t GetOmegaTau(Float_t vdrift);
   Int_t PadResponse(Double_t signal, Double_t dist, Int_t plane, Double_t *pad) const;
   
 protected:
   // for caching see also implentation of GetCachedCDBObject in the .cxx file
-  enum { kCDBCacheSize = 8 };   // Number of cached objects
-  enum { kIDVdrift = 0, kIDT0 = 1, kIDGainFactor = 2, kIDPRFWidth = 3, kIDGlobals = 4, 
-         kIDChamber = 5, kIDStack = 6, kIDPIDLQ = 7 };    // IDs of cached objects
-  
+  enum { kCDBCacheSize = 17 };   // Number of cached objects
+  enum { kIDVdriftPad = 0, kIDVdriftChamber,
+         kIDT0Pad, kIDT0Chamber,
+         kIDGainFactorPad, kIDGainFactorChamber,
+         kIDPRFWidth,
+         kIDGlobals,
+         kIDChamberPos, kIDStackPos, kIDSuperModulePos,
+         kIDPIDLQ, kIDMonitoringData,
+         kIDSuperModuleStatus, kIDChamberStatus, kIDMCMStatus, kIDPadStatus };    // IDs of cached objects
+
   const TObject* GetCachedCDBObject(Int_t id);
   
   void Invalidate();
@@ -75,8 +100,7 @@ protected:
   
   AliCDBEntry* GetCDBEntry(const char* cdbPath);
   const TObject* CacheCDBEntry(Int_t id, const char* cdbPath);
-  const TObject* CacheMergeCDBEntry(Int_t id, const char* cdbPadPath, const char* cdbChamberPath);
-  
+
   static AliTRDcalibDB* fgInstance;     // Instance of this class (singleton implementation)
   static Bool_t fgTerminated;               // Defines if this class has already been terminated and therefore does not return instances in GetInstance anymore
 
@@ -102,7 +126,7 @@ private:
   AliTRDcalibDB();
   virtual ~AliTRDcalibDB();
 
-  ClassDef(AliTRDcalibDB, 0)
+  ClassDef(AliTRDcalibDB, 1)
 };
 
 #endif
index f078f779488ee302ffa0e5cc3febb6156055dde6..87af305108a4d6ecfe1caaf4c99cff3994025bdc 100644 (file)
@@ -33,7 +33,6 @@
 #include "AliTRDcluster.h"
 #include "AliTRDrecPoint.h"
 #include "AliTRDgeometry.h"
-#include "AliTRDparameter.h"
 #include "AliTRDcalibDB.h"
 
 ClassImp(AliTRDclusterizer)
@@ -48,7 +47,6 @@ AliTRDclusterizer::AliTRDclusterizer():TNamed()
   fClusterTree = NULL;
   fRecPoints   = 0;
   fVerbose     = 0;
-  fPar         = 0;
 
 }
 
@@ -63,7 +61,6 @@ AliTRDclusterizer::AliTRDclusterizer(const Text_t* name, const Text_t* title)
   fClusterTree = NULL;
   fRecPoints   = 0;
   fVerbose     = 0;
-  fPar         = 0;
 
 }
 
@@ -113,7 +110,6 @@ void AliTRDclusterizer::Copy(TObject &c) const
   ((AliTRDclusterizer &) c).fClusterTree = NULL;
   ((AliTRDclusterizer &) c).fRecPoints   = NULL;  
   ((AliTRDclusterizer &) c).fVerbose     = fVerbose;  
-  ((AliTRDclusterizer &) c).fPar         = 0;
 
 }
 
@@ -241,7 +237,6 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
     AliTRDgeometry *geo = fTRD->GetGeometry();
     geo->SetName("TRDgeometry");
     geo->Write();
-    fPar->Write();
     */
     AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
     loader->WriteRecPoints("OVERWRITE");
index 0b01ccf25a5f4fbc78f9b7b1cf7f6977ee62bac0..2bb295caf7e1864af6495392f70abd7cf631435b 100644 (file)
@@ -11,7 +11,6 @@
 class TFile;
 class TTree;
 class AliRunLoader;
-class AliTRDparameter;
 class AliTRD;
 class AliTRDcluster;
 ///////////////////////////////////////////////////////
@@ -35,11 +34,8 @@ class AliTRDclusterizer : public TNamed {
   virtual Bool_t  OpenOutput();
   virtual Bool_t  MakeClusters() = 0;
   virtual Bool_t  WriteClusters(Int_t det);
-  virtual void    SetParameter(AliTRDparameter *par)      { fPar           = par; };
   void            SetVerbose(Int_t v = 1)                 { fVerbose       = v;   };
 
-  AliTRDparameter *GetParameter()                   const { return fPar;          };
-
   TObjArray*      RecPoints() {if (!fRecPoints) fRecPoints = new TObjArray(400); return fRecPoints;}
   virtual AliTRDcluster  * AddCluster(Double_t *pos, Int_t timebin, Int_t det, Double_t amp, Int_t *tracks
                             , Double_t *sig, Int_t iType, Float_t center = 0);
@@ -52,7 +48,6 @@ class AliTRDclusterizer : public TNamed {
   AliRunLoader    *fRunLoader;     //! Run Loader
   
   TTree           *fClusterTree;   //! Tree with the cluster
-  AliTRDparameter *fPar;           //  TRD digitization parameter object
 
   TObjArray*       fRecPoints;     //! Array of clusters
   Int_t            fVerbose;       //  Sets the verbose level
index 87885edb96af5bf24adf5f4117de2119add7d4c8..97ab7584ea4f3d193c323a9bf4617b8fa67e9de7 100644 (file)
@@ -38,7 +38,6 @@
 #include "AliTRDdataArrayF.h"
 #include "AliTRDdataArrayI.h"
 #include "AliTRDdigitsManager.h"
-#include "AliTRDparameter.h"
 #include "AliTRDpadPlane.h"
 #include "AliTRDrawData.h"
 #include "AliTRDcalibDB.h"
index 4e04ba090a4a87d2898cacdb8729b55ea56ed597..db1e2bcb78f618f6974fb05bfccedeadd62c0c8b 100644 (file)
@@ -13,7 +13,6 @@
 
 class AliTRDdataArrayI;
 class AliTRDdigitsManager;
-class AliTRDparameter;
 class AliRawReader;
 
 class AliTRDclusterizerV1 : public AliTRDclusterizer {
index 9268e8f52c633fa804b6691df02dab2353b230ff..c1621f4ae080c690e9cae209a33739169f51fa09 100644 (file)
@@ -71,7 +71,6 @@
 #include "AliTRDsegmentArray.h"
 #include "AliTRDdigitsManager.h"
 #include "AliTRDgeometry.h"
-#include "AliTRDparameter.h"
 #include "AliTRDpadPlane.h"
 #include "AliTRDcalibDB.h"
 #include "AliTRDSimParam.h"
@@ -92,7 +91,6 @@ AliTRDdigitizer::AliTRDdigitizer()
   fSDigitsManagerList = 0;
   fTRD                = 0;
   fGeo                = 0;
-  fPar                = 0;
   fEvent              = 0;
   fMasks              = 0;
   fCompress           = kTRUE;
@@ -169,7 +167,6 @@ Bool_t AliTRDdigitizer::Init()
   fSDigitsManagerList = 0;
   fTRD                = 0;
   fGeo                = 0;
-  fPar                = 0;  
   //End NewIO comment
 
   fEvent              = 0;
@@ -271,7 +268,6 @@ void AliTRDdigitizer::Copy(TObject &d) const
   ((AliTRDdigitizer &) d).fSDigitsManagerList = 0;
   ((AliTRDdigitizer &) d).fTRD                = 0;
   ((AliTRDdigitizer &) d).fGeo                = 0;
-  ((AliTRDdigitizer &) d).fPar                = 0;
   ((AliTRDdigitizer &) d).fEvent              = 0;
   ((AliTRDdigitizer &) d).fMasks              = 0;
   ((AliTRDdigitizer &) d).fCompress           = fCompress;
@@ -439,7 +435,6 @@ void AliTRDdigitizer::Exec(Option_t* option)
 
   //Write parameters
   orl->CdGAFile();
-  if (!gFile->Get("TRDparameter")) GetParameter()->Write();
 
   if (fDebug > 0) {
     printf("<AliTRDdigitizer::Exec> ");
@@ -636,15 +631,7 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
   TGeoManager::Import("geometry.root");
 
-  // Create a default parameter class if none is defined
-  if (!fPar) {
-    fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
-    if (fDebug > 0) {
-      printf("<AliTRDdigitizer::MakeDigits> ");
-      printf("Create the default parameter object\n");
-    }
-  }
-  
+
   AliTRDSimParam* simParam = AliTRDSimParam::Instance();
   if (!simParam) {
     printf("<AliTRDdigitizer::MakeDigits> ");
@@ -1160,6 +1147,11 @@ Bool_t AliTRDdigitizer::MakeDigits()
               // Pad and time coupling
               signalAmp *= coupling;
              Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow);
+              if (padgain<=0) {
+                TString error;
+                error.Form("Not a valid gain %f, %d %d %d\n", padgain, iDet, iCol, iRow);
+                AliError(error);
+              }
              signalAmp *= padgain;
               // Add the noise, starting from minus ADC baseline in electrons
               Double_t baselineEl = simParam->GetADCbaseline() * (simParam->GetADCinRange()
@@ -1290,14 +1282,6 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
   Int_t iCol;
   Int_t iTime;
 
-  if (!fPar) {    
-    fPar = new AliTRDparameter("TRDparameter","Standard parameter");
-    if (fDebug > 0) {
-      printf("<AliTRDdigitizer::ConvertSDigits> ");
-      printf("Create the default parameter object\n");
-    }
-  }
-
   AliTRDSimParam* simParam = AliTRDSimParam::Instance();
   if (!simParam)
   {
@@ -1376,6 +1360,13 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
         for (iTime = 0; iTime < nTimeTotal; iTime++) {         
           Double_t signal = (Double_t) digitsIn->GetDataUnchecked(iRow,iCol,iTime);
           signal *= sDigitsScale;
+          Float_t padgain = calibration->GetGainFactor(iDet, iCol, iRow);
+          if (padgain<=0) {
+                  TString error;
+                  error.Form("Not a valid gain %f, %d %d %d\n", padgain, iDet, iCol, iRow);
+                  AliError(error);
+          }
+          signal *= padgain;
           // Pad and time coupling
           signal *= coupling;
           // Add the noise, starting from minus ADC baseline in electrons
@@ -1444,14 +1435,6 @@ Bool_t AliTRDdigitizer::MergeSDigits()
   // Number of track dictionary arrays
   const Int_t kNDict = AliTRDdigitsManager::kNDict;
 
-  if (!fPar) {
-    fPar = new AliTRDparameter("TRDparameter","Standard parameter");
-    if (fDebug > 0) {
-      printf("<AliTRDdigitizer::MergeSDigits> ");
-      printf("Create the default parameter object\n");
-    }
-  }
-
   AliTRDSimParam* simParam = AliTRDSimParam::Instance();
   if (!simParam)
   {
@@ -1648,7 +1631,6 @@ Bool_t AliTRDdigitizer::WriteDigits() const
 
   //Write parameters
   fRunLoader->CdGAFile();
-  if (!gFile->Get("TRDparameter")) GetParameter()->Write();
 
   // Store the digits and the dictionary in the tree
   return fDigitsManager->WriteDigits();
@@ -1734,7 +1716,7 @@ Double_t AliTRDdigitizer::TimeStruct(Float_t vdrift, Double_t dist, Double_t z)
   const Int_t kz2 = kz1+1;
 
   if (r1<0 || r1>37 || kz1<0 || kz1>10) {
-    printf("<AliTRDparameter::TimeStruct> Warning. Indices out of range: ");
+    printf("<AliTRDdigitizer::TimeStruct> Warning. Indices out of range: ");
     printf("dist=%.2f, z=%.2f, r1=%d, kz1=%d\n",dist,z,r1,kz1);
   }
 
@@ -1805,16 +1787,16 @@ void AliTRDdigitizer::SampleTimeStruct(Float_t vdrift)
   fVDsmp[7] = 2.134;
 
   if ( vdrift < fVDsmp[0] ) {
-    printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-    printf("<AliTRDparameter::SampleTimeStruct> Drift Velocity too small (%.3f<%.3f)\n"
+    printf("<AliTRDdigitizer::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+    printf("<AliTRDdigitizer::SampleTimeStruct> Drift Velocity too small (%.3f<%.3f)\n"
           , vdrift, fVDsmp[0]);
-    printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+    printf("<AliTRDdigitizer::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
     vdrift = fVDsmp[0];
   } else if ( vdrift > fVDsmp[7] ) {
-    printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-    printf("<AliTRDparameter::SampleTimeStruct> Drift Velocity too large (%.3f>%.3f)\n"
+    printf("<AliTRDdigitizer::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+    printf("<AliTRDdigitizer::SampleTimeStruct> Drift Velocity too large (%.3f>%.3f)\n"
           , vdrift,fVDsmp[6]);
-    printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+    printf("<AliTRDdigitizer::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
     vdrift = fVDsmp[7];
   }
 
@@ -2506,15 +2488,7 @@ void AliTRDdigitizer::RecalcDiffusion(Float_t vdrift)
 {
   if (vdrift == fDiffusionInfo.fLastVdrift)
     return;
-  
-  if (!fPar) {
-    fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
-    if (fDebug > 0) {
-      printf("<AliTRDdigitizer::RecalcDiffusion> ");
-      printf("Create the default parameter object\n");
-    }
-  }
-  
+
   AliTRDSimParam* simParam = AliTRDSimParam::Instance();
   if (!simParam)
   {
index bb7f824c755ce25419f0b38fef3cce27620d6341..8f2aced714f56ac5c6225a20fe2e3cd68b840db9 100644 (file)
@@ -16,7 +16,6 @@ class AliRunLoader;
 class AliTRD;
 class AliTRDdigitsManager;
 class AliTRDgeometry;
-class AliTRDparameter;
 
 ///////////////////////////////////////////////////////
 //  Produces digits from the hits information        //
@@ -54,9 +53,8 @@ class AliTRDdigitizer : public AliDigitizer {
   virtual void         SetSDigits(Int_t v = 1)              { fSDigits         = v;   };
   virtual void         SetSDigitsScale(Float_t s)           { fSDigitsScale    = s;   };
   virtual void         SetEvent(Int_t v = 0)                { fEvent           = v;   };
-  virtual void         SetManager(AliTRDdigitsManager *man) { fDigitsManager   = man; };   
+  virtual void         SetManager(AliTRDdigitsManager *man) { fDigitsManager   = man; };
   virtual void         SetGeometry(AliTRDgeometry *geo)     { fGeo             = geo; };
-  virtual void         SetParameter(AliTRDparameter *par)   { fPar             = par; };
   virtual void         SetMergeSignalOnly(Bool_t m = kTRUE) { fMergeSignalOnly = m;   };
 
   AliTRDdigitsManager *Digits()                       const { return fDigitsManager; };
@@ -64,9 +62,8 @@ class AliTRDdigitizer : public AliDigitizer {
   Bool_t               GetCompress()                  const { return fCompress;      };
   Bool_t               GetSDigits()                   const { return fSDigits;       };
   Float_t              GetSDigitsScale()              const { return fSDigitsScale;  };
-  AliTRDparameter     *GetParameter()                 const { return fPar;           };
 
-  virtual Double_t     TimeStruct(Float_t vdrift, Double_t time, Double_t z);  
+  virtual Double_t     TimeStruct(Float_t vdrift, Double_t time, Double_t z);
 
           Float_t      GetDiffusionT(Float_t vdrift);
           Float_t      GetDiffusionL(Float_t vdrift);
@@ -83,7 +80,6 @@ class AliTRDdigitizer : public AliDigitizer {
   TList               *fSDigitsManagerList; //! List of managers of input s-digits
   AliTRD              *fTRD;                //! TRD detector class
   AliTRDgeometry      *fGeo;                //! TRD geometry
-  AliTRDparameter     *fPar;                //  TRD common parameter object
   Int_t                fEvent;              //! Event number
   Int_t               *fMasks;              //! Masks for the merging
   Bool_t               fCompress;           //  Switch to keep only compressed data in memory
@@ -120,7 +116,7 @@ class AliTRDdigitizer : public AliDigitizer {
     
   virtual Bool_t       CheckDetector(Int_t plane, Int_t chamber, Int_t sector);
 
-  ClassDef(AliTRDdigitizer,9)               //  Produces TRD-Digits
+  ClassDef(AliTRDdigitizer, 10)               //  Produces TRD-Digits
 
 };
 
index 4483c164d61f3ceb67c93056b441c624a77a2e49..9e433b360f37abbbc1a22ccffd21f7c3c607c6be 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "AliRunLoader.h"
 #include "AliTRDgeometry.h"
-#include "AliTRDparameter.h"
 #include "AliTRDpadPlane.h"
 
 #include "AliRun.h"
@@ -302,21 +301,22 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
   Float_t  timeSlice = local[2] + 0.5;
   Float_t  time0     = GetTime0(iplan);
 
+  Int_t idet = GetDetector(iplan, icham, isect);
+
   Double_t  rot[3];
-  rot[0] = time0 - (timeSlice - calibration->GetT0(iplan, icham, isect, col, row)) 
-      * calibration->GetVdrift(iplan, icham, isect, col, row)/calibration->GetSamplingFrequency();
+  rot[0] = time0 - (timeSlice - calibration->GetT0(idet, col, row))
+      * calibration->GetVdrift(idet, col, row)/calibration->GetSamplingFrequency();
   rot[1] = padPlane->GetColPos(col) - 0.5 * padPlane->GetColSize(col);
   rot[2] = padPlane->GetRowPos(row) - 0.5 * padPlane->GetRowSize(row);
 
   // Rotate back to original position
-  Int_t idet = GetDetector(iplan,icham,isect); 
   return RotateBack(idet,rot,global);
 
 }
 
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *global
-                                   , Int_t* index,  AliTRDparameter *par) const
+                                   , Int_t* index) const
 {
   //
   // Converts local pad-coordinates (row,col,time) into 
@@ -330,11 +330,6 @@ Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *globa
   // mode=2  - local coordinate in pad, and pad row, x - rotated global
   //
 
-  if (!par) {
-    Error("Global2Local","No parameter defined\n");
-    return kFALSE;
-  }
-  
   //Int_t    idet    = GetDetector(iplan,icham,isect); // Detector number
   Int_t    idet      = GetDetector(index[0],index[1],index[2]); // Detector number
   Rotate(idet,global,local);
index 5923b765842e597cc0e03432c263b58094282b80..edee8963ce79c1a2576d853489cae06a8a516133 100644 (file)
@@ -14,7 +14,6 @@
 #include "AliGeometry.h"
 
 class AliRunLoader;
-class AliTRDparameter;
 
 class AliTRDgeometry : public AliGeometry {
 
@@ -34,7 +33,7 @@ class AliTRDgeometry : public AliGeometry {
                                 , Double_t *local, Double_t *global) const;
 
   virtual Bool_t   Global2Local(Int_t mode, Double_t *local, Double_t *global
-                               , Int_t* index,  AliTRDparameter *par) const;
+                               , Int_t* index) const;
   virtual Bool_t   Global2Detector(Double_t global[3], Int_t index[3]);
 
   virtual Bool_t   Rotate(Int_t d, Double_t *pos, Double_t *rot) const;
index eb4f888c967cedfe10b94286eaa53cfaad716fad..52e17dcf9a76ecca061833246e233e7b6efa393c 100644 (file)
@@ -27,7 +27,7 @@
 #include "AliESD.h"
 #include "AliESDtrack.h"
 #include "AliTRDcalibDB.h"
-#include "AliTRDCalPIDLQ.h"
+#include "Cal/AliTRDCalPIDLQ.h"
 
 ClassImp(AliTRDpidESD)
 
index c2ade3f12b853d313a014db6b9be273e76295094..d4a1133153c2e832ba5db56fea40457a480b3077 100644 (file)
  
 #include "AliRun.h"
 #include "AliTRDgeometry.h"
-#include "AliTRDparameter.h"
 #include "AliTRDsimpleMC.h"
 #include "AliTRDv1.h"
-#include "AliTRDparameter.h"
 #include "AliMC.h"
+
 ClassImp(AliTRDsimpleMC)
  
 //_____________________________________________________________________________
@@ -60,9 +58,8 @@ AliTRDsimpleMC::AliTRDsimpleMC()
   fTrackEntering = kFALSE;   
 
   fTRD           = NULL;
-  fPar           = NULL;
-                                        
-}                                                                               
+
+}
 
 //_____________________________________________________________________________
 AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title)
@@ -90,9 +87,8 @@ AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title)
   fTrackEntering = kFALSE;   
 
   fTRD           = NULL;
-  fPar           = NULL;
-                                        
-}                                                                               
+
+}
  
 //_____________________________________________________________________________
 AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m):TVirtualMC(m)
@@ -160,13 +156,9 @@ void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg
   // Starts a new track.
   // 
 
-  if (!fPar) {
-    fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
-  }
-
   if (!fTRD) {
     fTRD = (AliTRDv1 *) gAlice->GetDetector("TRD");   
-    fX0  = AliTRDgeometry::GetTime0(0) - AliTRDgeometry::DrThick(); 
+    fX0  = AliTRDgeometry::GetTime0(0) - AliTRDgeometry::DrThick();
   }
 
   fTRD->ResetHits();
index 7a456b13d992d61ee17e386d69d20f96d6adc619..2f076b6bc0e931bd9debc515f471ecc7054f37c8 100644 (file)
@@ -17,7 +17,6 @@
 #include "AliDecayer.h"
 
 class AliTRDv1;
-class AliTRDparameter;
 class TArrayD;
 
 class AliTRDsimpleMC : public TVirtualMC {
@@ -304,9 +303,8 @@ class AliTRDsimpleMC : public TVirtualMC {
   Bool_t           fTrackEntering;      //  Track entering chamber
 
   AliTRDv1        *fTRD;                //! TRD detector object
-  AliTRDparameter *fPar;                //! TRD parameter object
 
-  ClassDef(AliTRDsimpleMC,2)            //  Simple TRD Monte Carlo class
+  ClassDef(AliTRDsimpleMC, 3)            //  Simple TRD Monte Carlo class
 
 };
 #endif
index a3b444f3aaa62d054aae7083c2a7ceeed5989045..2d99849e78727a40b74d3dcea6d870a77c22c3a2 100644 (file)
@@ -28,7 +28,6 @@
 #include <TObjArray.h> 
 
 #include "AliTRDgeometry.h"
-#include "AliTRDparameter.h"
 #include "AliTRDpadPlane.h"
 #include "AliTRDgeometryFull.h"
 #include "AliTRDcluster.h" 
index 3dfa29a4032c710f1ea995184f8203ebf18e72a8..6e77b4ae1706a94d5724ef77538c7fca15a0247f 100644 (file)
@@ -13,7 +13,6 @@ class TParticle;
 class TParticlePDG;
 
 class AliTRDgeometry;
-class AliTRDparameter;
 class AliTRDtrack;
 class AliTRDtracklet;
 class AliTRDcluster;
diff --git a/TRD/Cal/AliTRDCalChamberPos.cxx b/TRD/Cal/AliTRDCalChamberPos.cxx
new file mode 100644 (file)
index 0000000..c4111b5
--- /dev/null
@@ -0,0 +1,58 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for position parameters of chambers //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalChamberPos.h"
+
+ClassImp(AliTRDCalChamberPos)
+
+//_____________________________________________________________________________
+AliTRDCalChamberPos::AliTRDCalChamberPos():TNamed()
+{
+  //
+  // AliTRDCalChamberPos default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    for (Int_t i = 0; i < 3; ++i) {
+      fChamberPos[idet][i] = 0;
+      fChamberRot[idet][i] = 0;
+    }
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalChamberPos::AliTRDCalChamberPos(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalChamberPos constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    for (Int_t i = 0; i < 3; ++i) {
+      fChamberPos[idet][i] = 0;
+      fChamberRot[idet][i] = 0;
+    }
+  }
+}
+
diff --git a/TRD/Cal/AliTRDCalChamberPos.h b/TRD/Cal/AliTRDCalChamberPos.h
new file mode 100644 (file)
index 0000000..f5559fb
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef AliTRDCALCHAMBERPOS_H
+#define AliTRDCALCHAMBERPOS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for position parameters chambers //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalChamberPos : public TNamed {
+  public:
+    enum { kNdet = 540 };
+  
+    AliTRDCalChamberPos();
+    AliTRDCalChamberPos(const Text_t* name, const Text_t* title);
+  
+    const Float_t* GetPos(Int_t det) const { return fChamberPos[det]; };
+    const Float_t* GetRot(Int_t det) const { return fChamberRot[det]; };
+    
+    void SetPos(Int_t det, Float_t x, Float_t y, Float_t z) { fChamberPos[det][0] = x; fChamberPos[det][1] = y; fChamberPos[det][2] = z; };
+    void SetPos(Int_t det, Float_t* xyz) { SetPos(det, xyz[0], xyz[1], xyz[2]); };
+  
+    void SetRot(Int_t det, Float_t x, Float_t y, Float_t z) { fChamberRot[det][0] = x; fChamberRot[det][1] = y; fChamberRot[det][2] = z; };
+    void SetRot(Int_t det, Float_t* xyz) { SetRot(det, xyz[0], xyz[1], xyz[2]); };
+  
+  protected:
+    Float_t fChamberPos[kNdet][3];                    //  Deviations of the positions of the chambers from the ideal position
+    Float_t fChamberRot[kNdet][3];                    //  Rotation of the chambers in respect to the ideal position
+    
+    ClassDef(AliTRDCalChamberPos,1)                      
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalChamberStatus.cxx b/TRD/Cal/AliTRDCalChamberStatus.cxx
new file mode 100644 (file)
index 0000000..8053060
--- /dev/null
@@ -0,0 +1,52 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for status of chambers                             //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalChamberStatus.h"
+
+ClassImp(AliTRDCalChamberStatus)
+
+//_____________________________________________________________________________
+AliTRDCalChamberStatus::AliTRDCalChamberStatus():TNamed()
+{
+  //
+  // AliTRDCalChamberStatus default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fStatus[idet] = 0;
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalChamberStatus::AliTRDCalChamberStatus(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalChamberStatus constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fStatus[idet] = 0;
+  }
+}
+
diff --git a/TRD/Cal/AliTRDCalChamberStatus.h b/TRD/Cal/AliTRDCalChamberStatus.h
new file mode 100644 (file)
index 0000000..7a063c2
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef AliTRDCalChamberStatus_H
+#define AliTRDCalChamberStatus_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for status of supermodules                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalChamberStatus : public TNamed {
+  public:
+    enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 };
+    enum { kInstalled = 1, kMasked = 2 };
+  
+    AliTRDCalChamberStatus();
+    AliTRDCalChamberStatus(const Text_t* name, const Text_t* title);
+
+    const Char_t GetStatus(Int_t det) const { return fStatus[det]; };
+    void SetStatus(Int_t det, Char_t status) { fStatus[det] = status; };
+
+    Bool_t IsInstalled(Int_t sm) const { return (GetStatus(sm) & kInstalled) ? kTRUE : kFALSE; }
+    Bool_t IsMasked(Int_t sm) const { return (GetStatus(sm) & kMasked) ? kTRUE : kFALSE; }
+
+  protected:
+    Char_t fStatus[kNdet];                    //  status byte
+
+    ClassDef(AliTRDCalChamberStatus,1)
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalDet.cxx b/TRD/Cal/AliTRDCalDet.cxx
new file mode 100644 (file)
index 0000000..55fcab0
--- /dev/null
@@ -0,0 +1,102 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for parameters which saved per detector            //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalDet.h"
+
+ClassImp(AliTRDCalDet)
+
+//_____________________________________________________________________________
+AliTRDCalDet::AliTRDCalDet():TNamed()
+{
+  //
+  // AliTRDCalDet default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fData[idet] = 0;
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalDet::AliTRDCalDet(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalDet constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fData[idet] = 0;
+  }
+
+}
+
+
+//_____________________________________________________________________________
+AliTRDCalDet::AliTRDCalDet(const AliTRDCalDet &c):TNamed(c)
+{
+  //
+  // AliTRDCalDet copy constructor
+  //
+
+  ((AliTRDCalDet &) c).Copy(*this);
+
+}
+
+///_____________________________________________________________________________
+AliTRDCalDet::~AliTRDCalDet()
+{
+  //
+  // AliTRDCalDet destructor
+  //
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalDet &AliTRDCalDet::operator=(const AliTRDCalDet &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalDet &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalDet::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    ((AliTRDCalDet &) c).fData[idet] = fData[idet];
+  }
+
+  TObject::Copy(c);
+
+}
+
diff --git a/TRD/Cal/AliTRDCalDet.h b/TRD/Cal/AliTRDCalDet.h
new file mode 100644 (file)
index 0000000..d6cddf7
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef ALITRDCALDET_H
+#define ALITRDCALDET_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for parameters which are saved per detector        //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+#include "AliTRDgeometry.h"
+
+class AliTRDCalDet : public TNamed {
+
+ public:
+  enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };
+
+  AliTRDCalDet();
+  AliTRDCalDet(const Text_t* name, const Text_t* title);
+  AliTRDCalDet(const AliTRDCalDet &c);   
+  virtual ~AliTRDCalDet();
+  AliTRDCalDet &operator=(const AliTRDCalDet &c);
+
+  virtual void     Copy(TObject &c) const;
+
+  Float_t GetValue(Int_t d) const { return fData[d]; };
+  Float_t GetValue(Int_t p, Int_t c, Int_t s) const { return fData[AliTRDgeometry::GetDetector(p,c,s)]; };
+
+  void SetValue(Int_t d, Float_t value) { fData[d] = value; };
+  void SetValue(Int_t p, Int_t c, Int_t s, Float_t value) { fData[AliTRDgeometry::GetDetector(p,c,s)] = value; };
+  
+  protected:
+
+  Float_t  fData[kNdet];                          //[kNdet] Data
+
+  ClassDef(AliTRDCalDet,1)                      //  TRD calibration class for parameters which are saved per detector
+
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalGlobals.cxx b/TRD/Cal/AliTRDCalGlobals.cxx
new file mode 100644 (file)
index 0000000..64929cd
--- /dev/null
@@ -0,0 +1,59 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for global TRD parameters //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalGlobals.h"
+
+ClassImp(AliTRDCalGlobals)
+
+//_____________________________________________________________________________
+AliTRDCalGlobals::AliTRDCalGlobals():TNamed()
+{
+  //
+  // AliTRDCalGlobals default constructor
+  //
+  
+  
+  Init();
+}
+
+//_____________________________________________________________________________
+AliTRDCalGlobals::AliTRDCalGlobals(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalGlobals constructor
+  //
+
+  Init();
+}
+
+//_____________________________________________________________________________
+void AliTRDCalGlobals::Init()
+{
+  //
+  // default initialization
+  //
+  
+  fSamplingFrequency = 0;
+  fNumberOfTimeBins = 0;
+}
diff --git a/TRD/Cal/AliTRDCalGlobals.h b/TRD/Cal/AliTRDCalGlobals.h
new file mode 100644 (file)
index 0000000..2f85035
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef AliTRDCALGLOBALS_H
+#define AliTRDCALGLOBALS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for global TRD parameters        //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalGlobals : public TNamed {
+  public:
+    AliTRDCalGlobals();
+    AliTRDCalGlobals(const Text_t* name, const Text_t* title);
+    virtual ~AliTRDCalGlobals() {};
+    
+    void SetSamplingFrequency(Float_t freq)                { fSamplingFrequency = freq; };
+    Float_t GetSamplingFrequency()                   const { return fSamplingFrequency; };
+    
+    void SetNumberOfTimeBins(Int_t value)     { fNumberOfTimeBins = value; };
+    Int_t GetNumberOfTimeBins()         const { return fNumberOfTimeBins; };
+  
+  protected:
+    Float_t fSamplingFrequency;                  // Sampling Frequency in MHz
+    Int_t fNumberOfTimeBins;                     // Number of timebins  
+    
+    void Init();
+    
+    ClassDef(AliTRDCalGlobals,1)                      //  TRD calibration class for global TRD parameters
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalMCMStatus.cxx b/TRD/Cal/AliTRDCalMCMStatus.cxx
new file mode 100644 (file)
index 0000000..6ed6063
--- /dev/null
@@ -0,0 +1,116 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for MCM status                                     //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalMCMStatus.h"
+#include "AliTRDCalSingleChamberStatus.h"
+
+ClassImp(AliTRDCalMCMStatus)
+
+//_____________________________________________________________________________
+AliTRDCalMCMStatus::AliTRDCalMCMStatus():TNamed()
+{
+  //
+  // AliTRDCalMCMStatus default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fROC[idet] = 0;
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalMCMStatus::AliTRDCalMCMStatus(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalMCMStatus constructor
+  //
+
+  for (Int_t isec = 0; isec < kNsect; isec++) {
+    for (Int_t ipla = 0; ipla < kNplan; ipla++) {
+      for (Int_t icha = 0; icha < kNcham; icha++) {
+        Int_t idet = AliTRDgeometry::GetDetector(ipla,icha,isec);
+        fROC[idet] = new AliTRDCalSingleChamberStatus(ipla,icha,8);
+      }
+    }
+  }
+
+}
+
+
+//_____________________________________________________________________________
+AliTRDCalMCMStatus::AliTRDCalMCMStatus(const AliTRDCalMCMStatus &c):TNamed(c)
+{
+  //
+  // AliTRDCalMCMStatus copy constructor
+  //
+
+  ((AliTRDCalMCMStatus &) c).Copy(*this);
+
+}
+
+///_____________________________________________________________________________
+AliTRDCalMCMStatus::~AliTRDCalMCMStatus()
+{
+  //
+  // AliTRDCalMCMStatus destructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) {
+      delete fROC[idet];
+      fROC[idet] = 0;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalMCMStatus &AliTRDCalMCMStatus::operator=(const AliTRDCalMCMStatus &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalMCMStatus &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalMCMStatus::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) {
+      fROC[idet]->Copy(*((AliTRDCalMCMStatus &) c).fROC[idet]);
+    }
+  }
+
+  TObject::Copy(c);
+}
+
diff --git a/TRD/Cal/AliTRDCalMCMStatus.h b/TRD/Cal/AliTRDCalMCMStatus.h
new file mode 100644 (file)
index 0000000..8c3d026
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef ALITRDCALMCMSTATUS_H
+#define ALITRDCALMCMSTATUS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for MCM status                                     //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+#include "AliTRDgeometry.h"
+#include "AliTRDCalSingleChamberStatus.h"
+
+class AliTRDCalMCMStatus : public TNamed {
+
+ public:
+  enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };
+  enum { kMasked = 2, kMCMTemperatureBit1 = 4, kMBMTemperatureBit2 = 8 };
+
+  AliTRDCalMCMStatus();
+  AliTRDCalMCMStatus(const Text_t* name, const Text_t* title);
+  AliTRDCalMCMStatus(const AliTRDCalMCMStatus &c);   
+  virtual ~AliTRDCalMCMStatus();
+  AliTRDCalMCMStatus &operator=(const AliTRDCalMCMStatus &c);
+
+  virtual void     Copy(TObject &c) const;
+
+  AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; };
+  AliTRDCalSingleChamberStatus *GetCalROC(Int_t p, Int_t c, Int_t s) const
+                                               { return GetCalROC(AliTRDgeometry::GetDetector(p,c,s)); };
+
+  Bool_t IsMasked(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kMasked); };
+  inline Bool_t CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const;
+
+ protected:
+
+  AliTRDCalSingleChamberStatus *fROC[kNdet];          //  Array of ROC objects which contain the values per pad
+
+  ClassDef(AliTRDCalMCMStatus,1)                      //  TRD calibration class for MCM status
+
+};
+
+Bool_t AliTRDCalMCMStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const
+{
+  AliTRDCalSingleChamberStatus* roc = GetCalROC(d);
+  if (!roc)
+    return kFALSE;
+    
+  return (roc->GetStatus(col, row) & bitMask) ? kTRUE : kFALSE;
+}
+
+#endif
diff --git a/TRD/Cal/AliTRDCalMonitoring.cxx b/TRD/Cal/AliTRDCalMonitoring.cxx
new file mode 100644 (file)
index 0000000..e97e3ad
--- /dev/null
@@ -0,0 +1,57 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for global TRD parameters //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalMonitoring.h"
+
+ClassImp(AliTRDCalMonitoring)
+
+//_____________________________________________________________________________
+AliTRDCalMonitoring::AliTRDCalMonitoring():TNamed()
+{
+  //
+  // AliTRDCalMonitoring default constructor
+  //
+  
+  
+  Init();
+}
+
+//_____________________________________________________________________________
+AliTRDCalMonitoring::AliTRDCalMonitoring(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalMonitoring constructor
+  //
+
+  Init();
+}
+
+//_____________________________________________________________________________
+void AliTRDCalMonitoring::Init()
+{
+  //
+  // default initialization
+  //
+  
+}
diff --git a/TRD/Cal/AliTRDCalMonitoring.h b/TRD/Cal/AliTRDCalMonitoring.h
new file mode 100644 (file)
index 0000000..44ef427
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef AliTRDCALMONITORING_H
+#define AliTRDCALMONITORING_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for monitoring data                                //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalMonitoring : public TNamed {
+  public:
+    AliTRDCalMonitoring();
+    AliTRDCalMonitoring(const Text_t* name, const Text_t* title);
+    virtual ~AliTRDCalMonitoring() {};
+
+    //void SetSamplingFrequency(Float_t freq)                { fSamplingFrequency = freq; };
+    //Float_t GetSamplingFrequency()                   const { return fSamplingFrequency; };
+
+  protected:
+    Int_t fADCTresholds[6700];
+    Float_t fDriftVelocity;                      // Drift velocity from the monitor
+    TString fGasComposition;                    // Gas composition
+    Float_t fEnvironmentTemperature;
+
+    //Float_t fMCMTemperature[6700];
+
+    Float_t fAnodeCurrentsMin[540];
+    Float_t fAnodeCurrentsMax[540];
+    Float_t fDriftCurrentsMin[540];
+    Float_t fDriftCurrentsMax[540];
+    Float_t fAnodeVoltagesMin[540];
+    Float_t fAnodeVoltagesMax[540];
+    Float_t fDriftVoltagesMin[540];
+    Float_t fDriftVoltagesMax[540];
+
+    Float_t fLVVoltage[360];
+    Float_t fLVCurrent[360];
+
+    void Init();
+
+    ClassDef(AliTRDCalMonitoring,1)                      //  TRD calibration class for global TRD parameters
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalPIDLQ.cxx b/TRD/Cal/AliTRDCalPIDLQ.cxx
new file mode 100644 (file)
index 0000000..da33cfe
--- /dev/null
@@ -0,0 +1,348 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+// Class for dE/dx and Time Bin of Max. Cluster for Electrons and 
+// pions in TRD. 
+// It is instantiated in class AliTRDpidESD for particle identification
+// in TRD
+// Prashant Shukla <shukla@pi0.physi.uni-heidelberg.de>
+//-----------------------------------------------------------------
+
+#include "AliTRDCalPIDLQ.h"
+#include <TH1F.h>
+#include <TFile.h>
+
+ClassImp(AliTRDCalPIDLQ)
+
+Char_t* AliTRDCalPIDLQ::fpartName[AliPID::kSPECIES] = {"electron", "muon", "pion", "kaon", "proton"};
+    
+//_________________________________________________________________________
+AliTRDCalPIDLQ::AliTRDCalPIDLQ():
+  TNamed(),
+  fNMom(0),
+  fTrackMomentum(0),
+  fMeanChargeRatio(0),
+  fNbins(0),
+  fBinSize(0),
+  fHistdEdx(0),
+  fHistTimeBin(0)
+{
+  //
+  //  The Default constructor
+  //
+  
+}
+
+//_________________________________________________________________________
+AliTRDCalPIDLQ::AliTRDCalPIDLQ(const Text_t *name, const Text_t *title) : TNamed(name, title)
+{
+  //
+  //  The main constructor
+  //
+  
+  Init();
+}
+
+//_____________________________________________________________________________
+AliTRDCalPIDLQ::AliTRDCalPIDLQ(const AliTRDCalPIDLQ &c) : TNamed(c)
+{
+  //
+  // copy constructor
+  //
+
+  Init();
+  
+  ((AliTRDCalPIDLQ &) c).Copy(*this);
+}
+
+//_________________________________________________________________________
+AliTRDCalPIDLQ::~AliTRDCalPIDLQ()
+{
+  //
+  // Destructor
+  //
+  
+  CleanUp();
+}
+
+//_________________________________________________________________________
+void AliTRDCalPIDLQ::CleanUp()
+{
+  if (fHistdEdx)
+  {
+    delete fHistdEdx;
+    fHistdEdx = 0;
+  }
+  
+  if (fHistTimeBin)
+  {
+    delete fHistTimeBin;
+    fHistTimeBin = 0;
+  }
+
+  if (fTrackMomentum)
+  {
+    delete[] fTrackMomentum;
+    fTrackMomentum = 0;
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalPIDLQ &AliTRDCalPIDLQ::operator=(const AliTRDCalPIDLQ &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalPIDLQ &) c).Copy(*this);
+  return *this;
+}
+
+//_____________________________________________________________________________
+void AliTRDCalPIDLQ::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  AliTRDCalPIDLQ& target = (AliTRDCalPIDLQ &) c;
+  
+  target.CleanUp();
+  
+  target.fNMom = fNMom;
+  
+  target.fTrackMomentum = new Double_t[fNMom];
+  for (Int_t i=0; i<fNMom; ++i)
+    target.fTrackMomentum[i] = fTrackMomentum[i];
+      
+  target.fMeanChargeRatio = fMeanChargeRatio;
+
+  target.fNbins = fNbins;
+  target.fBinSize = fBinSize;
+
+  if (fHistdEdx)
+    target.fHistdEdx = (TObjArray*) fHistdEdx->Clone();
+  
+  if (fHistTimeBin)
+    target.fHistTimeBin = (TObjArray*) fHistTimeBin->Clone();
+    
+  TObject::Copy(c);
+}
+
+//_________________________________________________________________________
+void AliTRDCalPIDLQ::Init()
+{
+  fNMom = 11;
+  
+  fTrackMomentum = new Double_t[fNMom];
+  Double_t trackMomentum[11] = {0.6, 0.8, 1, 1.5, 2, 3, 4, 5, 6, 8, 10};
+  for (Int_t imom = 0; imom < 11; imom++)
+    fTrackMomentum[imom] = trackMomentum[imom];
+  
+  fHistdEdx = new TObjArray(AliPID::kSPECIES * fNMom);
+  fHistdEdx->SetOwner();
+  fHistTimeBin = new TObjArray(AliPID::kSPECIES * fNMom);
+  fHistTimeBin->SetOwner();  
+  
+  // ADC Gain normalization
+  fMeanChargeRatio=1.0;
+  
+  // Number of bins and bin size
+  fNbins = 0;
+  fBinSize = 0.;
+}
+
+//_________________________________________________________________________
+Bool_t AliTRDCalPIDLQ::ReadData(Char_t *responseFile)
+{
+  //
+  // Read the TRD dEdx histograms.
+  //
+  // Read histogram Root file  
+  TFile *histFile = new TFile(responseFile, "READ");
+  if (!histFile || !histFile->IsOpen()) {
+    Error("AliTRDCalPIDLQ", "opening TRD histgram file %s failed", responseFile);
+    return kFALSE;
+  }
+  gROOT->cd();
+
+  // Read histograms
+  Char_t text[200];
+  for (Int_t particle = 0; particle < AliPID::kSPECIES; ++particle)
+  {
+    Char_t* particleKey = "";
+    switch (particle)
+    {
+      case AliPID::kElectron: particleKey = "EL"; break;
+      case AliPID::kPion: particleKey = "PI"; break;
+      case AliPID::kMuon: particleKey = "MU"; break;
+      case AliPID::kKaon: particleKey = "KA"; break;
+      case AliPID::kProton: particleKey = "PR"; break;
+    }
+    
+    for (Int_t imom = 0; imom < fNMom; imom++) 
+    {
+      sprintf(text, "h1dEdx%s%01d", particleKey, imom+1);
+      TH1F* hist = (TH1F*)histFile->Get(text)->Clone();
+      hist->Scale(1.0/hist->Integral());
+      fHistdEdx->AddAt(hist, GetHistID(particle, imom));
+  
+      if (particle == AliPID::kElectron || particle == AliPID::kPion)
+      {
+        sprintf(text,"h1MaxTimBin%s%01d", particleKey, imom+1);
+        TH1F* hist = (TH1F*)histFile->Get(text)->Clone();
+        hist->Scale(1.0/hist->Integral());
+        fHistTimeBin->AddAt(hist, GetHistID(particle,imom));
+      }
+    }
+  }
+  
+  histFile->Close();
+  delete histFile;
+  
+  // Number of bins and bin size
+  TH1F* hist = (TH1F*) fHistdEdx->At(GetHistID(AliPID::kPion, 1));
+  fNbins   = hist->GetNbinsX();
+  fBinSize = hist->GetBinWidth(1);
+  
+  return kTRUE;
+}
+
+//_________________________________________________________________________
+Double_t  AliTRDCalPIDLQ::GetMean(Int_t k, Int_t ip) const
+{
+  //
+  // Gets mean of de/dx dist. of e
+  printf("Mean for particle = %s and momentum = %.2f is:\n", fpartName[k], fTrackMomentum[ip]);
+  if (k < 0 || k > AliPID::kSPECIES)
+    return 0;
+  
+  return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->GetMean();
+}
+
+//_________________________________________________________________________
+Double_t  AliTRDCalPIDLQ::GetNormalization(Int_t k, Int_t ip) const
+{
+  //
+  // Gets Normalization of de/dx dist. of e
+
+  printf("Normalization for particle = %s and momentum = %.2f is:\n",fpartName[k], fTrackMomentum[ip]);
+  if (k < 0 || k > AliPID::kSPECIES)
+    return 0;
+  
+  return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->Integral();
+}
+
+//_________________________________________________________________________
+TH1F* AliTRDCalPIDLQ::GetHistogram(Int_t k, Int_t ip) const
+{
+  //
+  //
+  printf("Histogram for particle = %s and momentum = %.2f is:\n", fpartName[k], fTrackMomentum[ip]);
+  if (k < 0 || k > AliPID::kSPECIES)
+    return 0;
+  
+  return (TH1F*) fHistdEdx->At(GetHistID(k,ip));
+}
+
+//_________________________________________________________________________
+Double_t AliTRDCalPIDLQ::GetProbability(Int_t k, Double_t mom, Double_t dedx1) const
+{
+  //
+  // Gets the Probability of having dedx at a given momentum (mom)
+  // and particle type k (0 for e) and (2 for pi)
+  // from the precalculated de/dx distributions 
+  
+  Double_t dedx = dedx1/fMeanChargeRatio;
+  Int_t iEnBin= ((Int_t) (dedx/fBinSize+1));
+  if(iEnBin > fNbins) iEnBin = fNbins;
+
+  if (k < 0 || k > AliPID::kSPECIES)
+    return 1;
+  
+  TH1F* hist1 = 0;
+  TH1F* hist2 = 0;
+  Double_t mom1 = 0;
+  Double_t mom2 = 0;
+  
+  // Lower limit
+  if (mom<=fTrackMomentum[0]) 
+  {
+    hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,1));
+    hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,0));
+    mom1 = fTrackMomentum[1];
+    mom2 = fTrackMomentum[0];
+  }
+    
+  // Upper Limit
+  if(mom>=fTrackMomentum[fNMom-1]) 
+  {
+    hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,fNMom-1));
+    hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,fNMom-2));
+    mom2 = fTrackMomentum[fNMom-1];
+    mom1 = fTrackMomentum[fNMom-2];
+  }
+    
+  // In the range
+  for (Int_t ip=1; ip<fNMom; ip++) 
+  {
+    if ((fTrackMomentum[ip-1]<= mom) && (mom<fTrackMomentum[ip])) 
+    {
+      hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,ip));
+      hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,ip-1));
+      mom1 = fTrackMomentum[ip];
+      mom2 = fTrackMomentum[ip-1];
+    }
+  }
+  
+  Double_t slop = (hist1->GetBinContent(iEnBin) - hist2->GetBinContent(iEnBin)) / (mom1 - mom2);
+  return hist2->GetBinContent(iEnBin) + slop * (mom - mom2);
+}
+
+//_________________________________________________________________________
+Double_t AliTRDCalPIDLQ::GetProbabilityT(Int_t k, Double_t mom, Int_t timbin) const
+{
+  //
+  // Gets the Probability of having timbin at a given momentum (mom)
+  // and particle type k (0 for e) and (2 for pi)
+  // from the precalculated timbin distributions 
+  
+  if (timbin<=0) 
+    return 0.;
+  Int_t iTBin=timbin+1;
+  
+  // everything which is not electron counts as pion for time bin
+  if (k != AliPID::kElectron)
+    k = AliPID::kPion;
+
+  if (mom<=fTrackMomentum[0]) 
+    return ((TH1F*) fHistTimeBin->At(GetHistID(k,0)))->GetBinContent(iTBin);
+  
+  if (mom>=fTrackMomentum[fNMom-1]) 
+    return ((TH1F*) fHistTimeBin->At(GetHistID(k,fNMom-1)))->GetBinContent(iTBin);
+  
+  for (Int_t ip=1; ip<fNMom; ip++)
+  {
+    if ((fTrackMomentum[ip-1]<= mom) && (mom<fTrackMomentum[ip])) 
+    {
+      Double_t slop=(((TH1F*) fHistTimeBin->At(GetHistID(k,ip)))->GetBinContent(iTBin) - ((TH1F*) fHistTimeBin->At(GetHistID(k,ip-1)))->GetBinContent(iTBin)) / (fTrackMomentum[ip] - fTrackMomentum[ip-1]);
+      // Linear Interpolation
+      return ((TH1F*) fHistTimeBin->At(GetHistID(k,ip-1)))->GetBinContent(iTBin) + slop * (mom - fTrackMomentum[ip-1]);
+    }
+  }
+  
+  return -1;
+}
diff --git a/TRD/Cal/AliTRDCalPIDLQ.h b/TRD/Cal/AliTRDCalPIDLQ.h
new file mode 100644 (file)
index 0000000..2600a8b
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef ALITRDCALPIDLQ_H
+#define ALITRDCALPIDLQ_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/*-----------------------------------------------------------------
+   Class for dE/dx and Time Bin of Max. Cluster for Electrons and 
+   pions in TRD. 
+   It is instantiated in class AliTRDpidESD for particle identification
+   in TRD
+   Prashant Shukla <shukla@pi0.physi.uni-heidelberg.de>
+   -----------------------------------------------------------------*/
+
+#include <TNamed.h>
+#include <AliPID.h>
+
+class TH1F;
+class TObjArray;
+
+class AliTRDCalPIDLQ : public TNamed {
+  public:
+    AliTRDCalPIDLQ(); 
+    AliTRDCalPIDLQ(const Text_t *name, const Text_t *title);
+    
+    AliTRDCalPIDLQ(const AliTRDCalPIDLQ& pd);  // Copy Constructor
+    virtual ~AliTRDCalPIDLQ();               // Destructor
+    
+    AliTRDCalPIDLQ &operator=(const AliTRDCalPIDLQ &c);
+    virtual void Copy(TObject &c) const;
+
+    Double_t GetMeanChargeRatio() const { return fMeanChargeRatio; } 
+
+    Double_t GetMomentum(Int_t ip) const {return fTrackMomentum[ip];}
+                      // Gets the momentum for given histogram number ip
+    Double_t GetMean(Int_t iType, Int_t ip) const;        
+                      // Particle type is iType and histogram number is ip         
+    Double_t GetNormalization(Int_t iType, Int_t ip) const;
+
+    TH1F* GetHistogram(Int_t iType, Int_t ip) const;
+
+    Double_t GetProbability(Int_t iType, Double_t mom, Double_t dedx) const;
+                      // Gets the Probability of having dedx
+    Double_t GetProbabilityT(Int_t iType, Double_t mom, Int_t timbin) const;
+                      // Gets the Probability of having timbin
+    Int_t GetNbins() const {return fNbins;}         // Number of Energy bins
+    Double_t GetBinSize() const {return fBinSize;}  // Size of Energy bin
+
+    Bool_t ReadData(Char_t *responseFile);       // Read histograms
+                      // Update the histograms from responseFile
+    void SetMeanChargeRatio(Double_t ratio) { fMeanChargeRatio = ratio; }  
+
+  protected:
+    void Init();                // Reset data
+    void CleanUp();             // Delete pointers;
+    inline Int_t GetHistID(Int_t particle, Int_t mom) const { return particle*fNMom + mom; }
+    
+    static Char_t *fpartName[AliPID::kSPECIES]; //! Names of particle species
+    
+    Int_t fNMom;                // Number of momenta  
+    Double_t* fTrackMomentum;   //[fNMom] Track momenta for which response functions are available
+    Double_t fMeanChargeRatio;  // Ratio of mean charge from real Det. to prob. dist.
+
+    Int_t fNbins;               // Number of Energy bins
+    Double_t fBinSize;          // Size of Energy bin
+    
+    TObjArray *fHistdEdx;           //-> Prob. of dEdx for 5 particles (e, pi, muon, kaon, proton) and for several momenta
+    TObjArray *fHistTimeBin;        //-> Prob. of max time bin for 5 particles (e, pi, muon, kaon, proton) and for several momenta
+    
+    ClassDef(AliTRDCalPIDLQ, 1)
+};
+
+
+#endif
+
diff --git a/TRD/Cal/AliTRDCalPad.cxx b/TRD/Cal/AliTRDCalPad.cxx
new file mode 100644 (file)
index 0000000..59ce274
--- /dev/null
@@ -0,0 +1,136 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for parameters which saved per pad                 //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalPad.h"
+#include "AliTRDCalROC.h"
+#include "AliTRDCalDet.h"
+
+ClassImp(AliTRDCalPad)
+
+//_____________________________________________________________________________
+AliTRDCalPad::AliTRDCalPad():TNamed()
+{
+  //
+  // AliTRDCalPad default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fROC[idet] = 0;
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalPad::AliTRDCalPad(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalPad constructor
+  //
+
+  for (Int_t isec = 0; isec < kNsect; isec++) {
+    for (Int_t ipla = 0; ipla < kNplan; ipla++) {
+      for (Int_t icha = 0; icha < kNcham; icha++) {
+        Int_t idet = GetDet(ipla,icha,isec);
+        fROC[idet] = new AliTRDCalROC(ipla,icha);
+      }
+    }
+  }
+
+}
+
+
+//_____________________________________________________________________________
+AliTRDCalPad::AliTRDCalPad(const AliTRDCalPad &c):TNamed(c)
+{
+  //
+  // AliTRDCalPad copy constructor
+  //
+
+  ((AliTRDCalPad &) c).Copy(*this);
+
+}
+
+///_____________________________________________________________________________
+AliTRDCalPad::~AliTRDCalPad()
+{
+  //
+  // AliTRDCalPad destructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) {
+      delete fROC[idet];
+      fROC[idet] = 0;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalPad &AliTRDCalPad::operator=(const AliTRDCalPad &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalPad &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalPad::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) {
+      fROC[idet]->Copy(*((AliTRDCalPad &) c).fROC[idet]);
+    }
+  }
+
+  TObject::Copy(c);
+}
+
+//_____________________________________________________________________________
+void AliTRDCalPad::ScaleROCs(AliTRDCalDet* values)
+{
+  // 
+  // Scales ROCs of this class with the values from the class <values>
+  // Is used if an AliTRDCalPad object defines local variations of a parameter
+  // defined per detector using a AliTRDCalDet class
+  //
+  
+  if (!values)
+    return;
+  
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) { 
+      fROC[idet]->Scale(values->GetValue(idet));
+    }
+  }
+}
+
diff --git a/TRD/Cal/AliTRDCalPad.h b/TRD/Cal/AliTRDCalPad.h
new file mode 100644 (file)
index 0000000..28b68da
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALITRDCALPAD_H
+#define ALITRDCALPAD_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for parameters which are saved per pad                 //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalROC;
+class AliTRDCalDet;
+
+class AliTRDCalPad : public TNamed {
+
+ public:
+  enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };
+
+  AliTRDCalPad();
+  AliTRDCalPad(const Text_t* name, const Text_t* title);
+  AliTRDCalPad(const AliTRDCalPad &c);   
+  virtual ~AliTRDCalPad();
+  AliTRDCalPad &operator=(const AliTRDCalPad &c);
+
+  virtual void     Copy(TObject &c) const;
+
+  static inline Int_t               GetDet(Int_t p, Int_t c, Int_t s) { return p+c*kNplan+s*kNplan*kNcham; };
+
+  AliTRDCalROC *GetCalROC(Int_t d) const { return fROC[d]; };
+  AliTRDCalROC *GetCalROC(Int_t p, Int_t c, Int_t s) const
+                                               { return fROC[GetDet(p,c,s)]; };
+  
+  void ScaleROCs(AliTRDCalDet* values);
+
+ protected:
+
+  AliTRDCalROC *fROC[kNdet];                    //  Array of ROC objects which contain the values per pad
+
+  ClassDef(AliTRDCalPad,1)                      //  TRD calibration class for parameters which are saved per pad
+
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalPadStatus.cxx b/TRD/Cal/AliTRDCalPadStatus.cxx
new file mode 100644 (file)
index 0000000..ef8896c
--- /dev/null
@@ -0,0 +1,117 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for MCM status                                     //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalPadStatus.h"
+
+#include "AliTRDCalSingleChamberStatus.h"
+
+ClassImp(AliTRDCalPadStatus)
+
+//_____________________________________________________________________________
+AliTRDCalPadStatus::AliTRDCalPadStatus():TNamed()
+{
+  //
+  // AliTRDCalPadStatus default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    fROC[idet] = 0;
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalPadStatus::AliTRDCalPadStatus(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalPadStatus constructor
+  //
+
+  for (Int_t isec = 0; isec < kNsect; isec++) {
+    for (Int_t ipla = 0; ipla < kNplan; ipla++) {
+      for (Int_t icha = 0; icha < kNcham; icha++) {
+        Int_t idet = AliTRDgeometry::GetDetector(ipla,icha,isec);
+        fROC[idet] = new AliTRDCalSingleChamberStatus(ipla,icha,144);
+      }
+    }
+  }
+
+}
+
+
+//_____________________________________________________________________________
+AliTRDCalPadStatus::AliTRDCalPadStatus(const AliTRDCalPadStatus &c):TNamed(c)
+{
+  //
+  // AliTRDCalPadStatus copy constructor
+  //
+
+  ((AliTRDCalPadStatus &) c).Copy(*this);
+
+}
+
+///_____________________________________________________________________________
+AliTRDCalPadStatus::~AliTRDCalPadStatus()
+{
+  //
+  // AliTRDCalPadStatus destructor
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) {
+      delete fROC[idet];
+      fROC[idet] = 0;
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalPadStatus &AliTRDCalPadStatus::operator=(const AliTRDCalPadStatus &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalPadStatus &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalPadStatus::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  for (Int_t idet = 0; idet < kNdet; idet++) {
+    if (fROC[idet]) {
+      fROC[idet]->Copy(*((AliTRDCalPadStatus &) c).fROC[idet]);
+    }
+  }
+
+  TObject::Copy(c);
+}
+
diff --git a/TRD/Cal/AliTRDCalPadStatus.h b/TRD/Cal/AliTRDCalPadStatus.h
new file mode 100644 (file)
index 0000000..c4c4778
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef ALITRDCALPADSTATUS_H
+#define ALITRDCALPADSTATUS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for MCM status                                     //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+#include "AliTRDgeometry.h"
+#include "AliTRDCalSingleChamberStatus.h"
+
+class AliTRDCalPadStatus : public TNamed {
+
+ public:
+  enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };
+  enum { kMasked = 2, kPadBridgedLeft = 4,     kPadBridgedRight = 8    };
+
+  AliTRDCalPadStatus();
+  AliTRDCalPadStatus(const Text_t* name, const Text_t* title);
+  AliTRDCalPadStatus(const AliTRDCalPadStatus &c);   
+  virtual ~AliTRDCalPadStatus();
+  AliTRDCalPadStatus &operator=(const AliTRDCalPadStatus &c);
+
+  virtual void     Copy(TObject &c) const;
+
+  AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; };
+  AliTRDCalSingleChamberStatus *GetCalROC(Int_t p, Int_t c, Int_t s) const
+                                               { return fROC[AliTRDgeometry::GetDetector(p,c,s)]; };
+
+  Bool_t IsMasked(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kMasked); };
+  Bool_t IsBridgedLeft(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kPadBridgedLeft); };
+  Bool_t IsBridgedRight(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kPadBridgedRight); };
+  inline Bool_t CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const;
+
+ protected:
+
+  AliTRDCalSingleChamberStatus *fROC[kNdet];          //  Array of ROC objects which contain the values per pad
+
+  ClassDef(AliTRDCalPadStatus,1)                      //  TRD calibration class for MCM status
+
+};
+
+Bool_t AliTRDCalPadStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const
+{
+  AliTRDCalSingleChamberStatus* roc = GetCalROC(d);
+  if (!roc)
+    return kFALSE;
+
+  return (roc->GetStatus(col, row) & bitMask) ? kTRUE : kFALSE;
+}
+          
+#endif
diff --git a/TRD/Cal/AliTRDCalROC.cxx b/TRD/Cal/AliTRDCalROC.cxx
new file mode 100644 (file)
index 0000000..e6e7cf2
--- /dev/null
@@ -0,0 +1,208 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  Calibration base class for a single ROC                                  //
+//  Contains one UShort_t value per pad                                      //
+//  However, values are set and get as float, there are stored internally as //
+//  (UShort_t) value * 10000                                                 //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalROC.h"
+
+ClassImp(AliTRDCalROC)
+
+//_____________________________________________________________________________
+AliTRDCalROC::AliTRDCalROC():TObject()
+{
+  //
+  // Default constructor
+  //
+
+  fPla          = 0;
+  fCha          = 0;
+
+  fNrows        = 0;
+  fNcols        = 0;
+
+  fNchannels    = 0;
+  fData         = 0;
+}
+
+//_____________________________________________________________________________
+AliTRDCalROC::AliTRDCalROC(Int_t p, Int_t c):TObject()
+{
+  //
+  // Constructor that initializes a given pad plane type
+  //
+
+  fPla = p;
+  fCha = c;
+
+  fNcols      = 144;
+
+  //
+  // The pad plane parameter
+  //
+  switch (p) {
+  case 0:
+    if (c == 2) {
+      // L0C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L0C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 1:
+    if (c == 2) {
+      // L1C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L1C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 2:
+    if (c == 2) {
+      // L2C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L2C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 3:
+    if (c == 2) {
+      // L3C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L3C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 4:
+    if (c == 2) {
+      // L4C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L4C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 5:
+    if (c == 2) {
+      // L5C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L5C1 type
+      fNrows        =  16;
+    }
+    break;
+  };
+
+  fNchannels = fNrows * fNcols;
+  if (fNchannels != 0)
+    fData = new UShort_t[fNchannels];
+
+  for (Int_t i=0; i<fNchannels; ++i)
+    fData[i] = 0;
+}
+
+//_____________________________________________________________________________
+AliTRDCalROC::AliTRDCalROC(const AliTRDCalROC &c):TObject(c)
+{
+  //
+  // AliTRDCalROC copy constructor
+  //
+
+  ((AliTRDCalROC &) c).Copy(*this);
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalROC::~AliTRDCalROC()
+{
+  //
+  // AliTRDCalROC destructor
+  //
+
+  if (fData) {
+    delete [] fData;
+    fData = 0;
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalROC &AliTRDCalROC::operator=(const AliTRDCalROC &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalROC &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalROC::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDCalROC &) c).fPla          = fPla;
+  ((AliTRDCalROC &) c).fCha          = fCha;
+
+  ((AliTRDCalROC &) c).fNrows        = fNrows;
+  ((AliTRDCalROC &) c).fNcols        = fNcols;
+
+  Int_t iBin = 0;
+
+  ((AliTRDCalROC &) c).fNchannels = fNchannels;
+
+  if (((AliTRDCalROC &) c).fData) delete [] ((AliTRDCalROC &) c).fData;
+  ((AliTRDCalROC &) c).fData = new UShort_t[fNchannels];
+  for (iBin = 0; iBin < fNchannels; iBin++) {
+    ((AliTRDCalROC &) c).fData[iBin] = fData[iBin];
+  }
+
+  TObject::Copy(c);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalROC::Scale(Float_t value)
+{
+  //
+  // Scales all values of this ROC with the provided parameter. Is used if ROC defines
+  // local variations of a global (or per detector defined) parameter
+  //
+
+  for (Int_t iBin = 0; iBin < fNchannels; iBin++) {
+    fData[iBin] = (UShort_t) (value * fData[iBin]);
+  }
+}
diff --git a/TRD/Cal/AliTRDCalROC.h b/TRD/Cal/AliTRDCalROC.h
new file mode 100644 (file)
index 0000000..68124ad
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef ALITRDCALROC_H
+#define ALITRDCALROC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDCalROC.h,v */
+
+//////////////////////////////////////////////////
+//                                              //
+//  TRD calibration base class for one ROC      //
+//                                              //
+//////////////////////////////////////////////////
+
+#include <TObject.h>
+
+//_____________________________________________________________________________
+class AliTRDCalROC : public TObject {
+
+ public:
+
+  AliTRDCalROC();
+  AliTRDCalROC(Int_t p, Int_t c);
+  AliTRDCalROC(const AliTRDCalROC &c);
+  virtual           ~AliTRDCalROC();
+  AliTRDCalROC      &operator=(const AliTRDCalROC &c);
+  virtual void       Copy(TObject &c) const;
+
+  Int_t    GetNrows() const                  { return fNrows; };
+  Int_t    GetNcols() const                  { return fNcols; };
+
+  Int_t        GetChannel(Int_t c, Int_t r)     { return r+c*fNrows; };
+  Int_t        GetNchannels()       const       { return fNchannels;   };
+
+  Float_t GetValue(Int_t ich) const       { return (Float_t) fData[ich] / 10000; };
+  Float_t GetValue(Int_t col, Int_t row)  { return GetValue(GetChannel(col,row)); };
+
+  void         SetValue(Int_t ich, Float_t value) { fData[ich] = (UShort_t) (value * 10000); };
+  void         SetValue(Int_t col, Int_t row, Float_t value) { SetValue(GetChannel(col,row), value); };
+
+  void Scale(Float_t value);
+
+ protected:
+
+  Int_t     fPla;             //  Plane number
+  Int_t     fCha;             //  Chamber number
+
+  Int_t     fNrows;           //  Number of rows
+  Int_t     fNcols;           //  Number of columns
+
+  Int_t     fNchannels;             //  Number of channels
+  UShort_t  *fData;                //[fNchannels] Data
+
+  ClassDef(AliTRDCalROC, 2)    //  TRD ROC calibration class
+
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalSingleChamberStatus.cxx b/TRD/Cal/AliTRDCalSingleChamberStatus.cxx
new file mode 100644 (file)
index 0000000..d8aed9c
--- /dev/null
@@ -0,0 +1,193 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  Calibration base class for a single ROC                                  //
+//  Contains one char value per pad                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalSingleChamberStatus.h"
+
+ClassImp(AliTRDCalSingleChamberStatus)
+
+//_____________________________________________________________________________
+AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus():TObject()
+{
+  //
+  // Default constructor
+  //
+
+  fPla          = 0;
+  fCha          = 0;
+
+  fNrows        = 0;
+  fNcols        = 0;
+
+  fNchannels    = 0;
+  fData         = 0;
+}
+
+//_____________________________________________________________________________
+AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols):TObject()
+{
+  //
+  // Constructor that initializes a given pad plane type
+  //
+
+  fPla = p;
+  fCha = c;
+
+  fNcols      = cols;
+
+  //
+  // The pad plane parameter
+  //
+  switch (p) {
+  case 0:
+    if (c == 2) {
+      // L0C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L0C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 1:
+    if (c == 2) {
+      // L1C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L1C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 2:
+    if (c == 2) {
+      // L2C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L2C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 3:
+    if (c == 2) {
+      // L3C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L3C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 4:
+    if (c == 2) {
+      // L4C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L4C1 type
+      fNrows        =  16;
+    }
+    break;
+  case 5:
+    if (c == 2) {
+      // L5C0 type
+      fNrows        =  12;
+    }
+    else {
+      // L5C1 type
+      fNrows        =  16;
+    }
+    break;
+  };
+
+  fNchannels = fNrows * fNcols;
+  if (fNchannels != 0)
+    fData = new Char_t[fNchannels];
+
+  for (Int_t i=0; i<fNchannels; ++i)
+    fData[i] = 0;
+}
+
+//_____________________________________________________________________________
+AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus(const AliTRDCalSingleChamberStatus &c):TObject(c)
+{
+  //
+  // AliTRDCalSingleChamberStatus copy constructor
+  //
+
+  ((AliTRDCalSingleChamberStatus &) c).Copy(*this);
+
+}
+
+//_____________________________________________________________________________
+AliTRDCalSingleChamberStatus::~AliTRDCalSingleChamberStatus()
+{
+  //
+  // AliTRDCalSingleChamberStatus destructor
+  //
+
+  if (fData) {
+    delete [] fData;
+    fData = 0;
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalSingleChamberStatus &AliTRDCalSingleChamberStatus::operator=(const AliTRDCalSingleChamberStatus &c)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &c) ((AliTRDCalSingleChamberStatus &) c).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDCalSingleChamberStatus::Copy(TObject &c) const
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDCalSingleChamberStatus &) c).fPla          = fPla;
+  ((AliTRDCalSingleChamberStatus &) c).fCha          = fCha;
+
+  ((AliTRDCalSingleChamberStatus &) c).fNrows        = fNrows;
+  ((AliTRDCalSingleChamberStatus &) c).fNcols        = fNcols;
+
+  Int_t iBin = 0;
+
+  ((AliTRDCalSingleChamberStatus &) c).fNchannels = fNchannels;
+
+  if (((AliTRDCalSingleChamberStatus &) c).fData) delete [] ((AliTRDCalSingleChamberStatus &) c).fData;
+  ((AliTRDCalSingleChamberStatus &) c).fData = new Char_t[fNchannels];
+  for (iBin = 0; iBin < fNchannels; iBin++) {
+    ((AliTRDCalSingleChamberStatus &) c).fData[iBin] = fData[iBin];
+  }
+
+  TObject::Copy(c);
+
+}
diff --git a/TRD/Cal/AliTRDCalSingleChamberStatus.h b/TRD/Cal/AliTRDCalSingleChamberStatus.h
new file mode 100644 (file)
index 0000000..cb9993e
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef AliTRDCalSingleChamberStatus_H
+#define AliTRDCalSingleChamberStatus_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDCalSingleChamberStatus.h,v */
+
+//////////////////////////////////////////////////
+//                                              //
+//  TRD calibration base class containing status values for one ROC      //
+//                                              //
+//////////////////////////////////////////////////
+
+#include <TObject.h>
+
+//_____________________________________________________________________________
+class AliTRDCalSingleChamberStatus : public TObject {
+
+ public:
+
+  AliTRDCalSingleChamberStatus();
+  AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols);
+  AliTRDCalSingleChamberStatus(const AliTRDCalSingleChamberStatus &c);
+  virtual           ~AliTRDCalSingleChamberStatus();
+  AliTRDCalSingleChamberStatus      &operator=(const AliTRDCalSingleChamberStatus &c);
+  virtual void       Copy(TObject &c) const;
+
+  Int_t    GetNrows() const                  { return fNrows; };
+  Int_t    GetNcols() const                  { return fNcols; };
+
+  Int_t        GetChannel(Int_t c, Int_t r) const    { return r+c*fNrows; };
+  Int_t        GetNchannels()       const       { return fNchannels;   };
+  Char_t       GetStatus(Int_t ich) const       { return fData[ich]; };
+  Char_t       GetStatus(Int_t col, Int_t row) const { return fData[GetChannel(col,row)]; };
+
+  void         SetStatus(Int_t ich, Char_t vd) { fData[ich] = vd;   };
+  void         SetStatus(Int_t col, Int_t row, Char_t vd)
+                                                { fData[GetChannel(col,row)] = vd; };
+
+ protected:
+
+  Int_t     fPla;             //  Plane number
+  Int_t     fCha;             //  Chamber number
+
+  Int_t     fNrows;           //  Number of rows
+  Int_t     fNcols;           //  Number of columns
+
+  Int_t     fNchannels;             //  Number of channels
+  Char_t   *fData;                //[fNchannels] Data
+
+  ClassDef(AliTRDCalSingleChamberStatus,1)    //  TRD ROC calibration class
+
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCalStackPos.cxx b/TRD/Cal/AliTRDCalStackPos.cxx
new file mode 100644 (file)
index 0000000..e29c916
--- /dev/null
@@ -0,0 +1,58 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for position parameters of the stacks //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalStackPos.h"
+
+ClassImp(AliTRDCalStackPos)
+
+//_____________________________________________________________________________
+AliTRDCalStackPos::AliTRDCalStackPos():TNamed()
+{
+  //
+  // AliTRDCalStackPos default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNstacks; idet++) {
+    for (Int_t i = 0; i < 3; ++i) {
+      fStackPos[idet][i] = 0;
+      fStackRot[idet][i] = 0;
+    }
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalStackPos::AliTRDCalStackPos(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalStackPos constructor
+  //
+
+  for (Int_t idet = 0; idet < kNstacks; idet++) {
+    for (Int_t i = 0; i < 3; ++i) {
+      fStackPos[idet][i] = 0;
+      fStackRot[idet][i] = 0;
+    }
+  }
+}
+
diff --git a/TRD/Cal/AliTRDCalStackPos.h b/TRD/Cal/AliTRDCalStackPos.h
new file mode 100644 (file)
index 0000000..129026c
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef AliTRDCALSTACKPOS_H
+#define AliTRDCALSTACKPOS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for position parameters of the stacks and chambers //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalStackPos : public TNamed {
+  public:
+    enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 };
+  
+    AliTRDCalStackPos();
+    AliTRDCalStackPos(const Text_t* name, const Text_t* title);
+  
+    const Float_t* GetPos(Int_t chamber, Int_t sector) const { return fStackPos[GetStackNumber(chamber, sector)]; };
+    const Float_t* GetRot(Int_t chamber, Int_t sector) const { return fStackPos[GetStackNumber(chamber, sector)]; };
+
+    inline void SetPos(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z);
+    void SetPos(Int_t chamber, Int_t sector, Float_t* xyz) { SetPos(chamber, sector, xyz[0], xyz[1], xyz[2]); };
+  
+    inline void SetRot(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z);
+    void SetRot(Int_t chamber, Int_t sector, Float_t* xyz) { SetRot(chamber, sector, xyz[0], xyz[1], xyz[2]); };
+  
+  protected:
+    static Int_t GetStackNumber(Int_t chamber, Int_t sector) { return chamber+sector*kNcham; };
+
+    Float_t fStackPos[kNstacks][3];                    //  Deviations of the positions of the stacks from the ideal position
+    Float_t fStackRot[kNstacks][3];                    //  Rotation of the stacks in respect to the ideal position
+    
+    ClassDef(AliTRDCalStackPos,1)                     
+};
+    
+void AliTRDCalStackPos::SetPos(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z) 
+{ 
+  Int_t stack = GetStackNumber(chamber, sector); 
+  fStackPos[stack][0] = x; 
+  fStackPos[stack][1] = y; 
+  fStackPos[stack][2] = z; 
+}
+
+void AliTRDCalStackPos::SetRot(Int_t chamber, Int_t sector, Float_t x, Float_t y, Float_t z) 
+{ 
+  Int_t stack = GetStackNumber(chamber, sector); 
+  fStackRot[stack][0] = x; 
+  fStackRot[stack][1] = y; 
+  fStackRot[stack][2] = z; 
+}
+
+#endif
diff --git a/TRD/Cal/AliTRDCalSuperModulePos.cxx b/TRD/Cal/AliTRDCalSuperModulePos.cxx
new file mode 100644 (file)
index 0000000..29e2885
--- /dev/null
@@ -0,0 +1,58 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for position parameters of the supermodules        //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalSuperModulePos.h"
+
+ClassImp(AliTRDCalSuperModulePos)
+
+//_____________________________________________________________________________
+AliTRDCalSuperModulePos::AliTRDCalSuperModulePos():TNamed()
+{
+  //
+  // AliTRDCalSuperModulePos default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNsect; idet++) {
+    for (Int_t i = 0; i < 3; ++i) {
+      fPos[idet][i] = 0;
+      fRot[idet][i] = 0;
+    }
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalSuperModulePos::AliTRDCalSuperModulePos(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalSuperModulePos constructor
+  //
+
+  for (Int_t idet = 0; idet < kNsect; idet++) {
+    for (Int_t i = 0; i < 3; ++i) {
+      fPos[idet][i] = 0;
+      fRot[idet][i] = 0;
+    }
+  }
+}
+
diff --git a/TRD/Cal/AliTRDCalSuperModulePos.h b/TRD/Cal/AliTRDCalSuperModulePos.h
new file mode 100644 (file)
index 0000000..7e9c66b
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef AliTRDCALSUPERMODULEPOS_H
+#define AliTRDCALSUPERMODULEPOS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for position parameters of the supermodules        //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalSuperModulePos : public TNamed {
+  public:
+    enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 };
+  
+    AliTRDCalSuperModulePos();
+    AliTRDCalSuperModulePos(const Text_t* name, const Text_t* title);
+  
+    const Float_t* GetPos(Int_t sm) const { return fPos[sm]; };
+    const Float_t* GetRot(Int_t sm) const { return fRot[sm]; };
+
+    inline void SetPos(Int_t sm, Float_t x, Float_t y, Float_t z);
+    void SetPos(Int_t sm, Float_t* xyz) { SetPos(sm, xyz[0], xyz[1], xyz[2]); };
+  
+    inline void SetRot(Int_t sm, Float_t x, Float_t y, Float_t z);
+    void SetRot(Int_t sm, Float_t* xyz) { SetRot(sm, xyz[0], xyz[1], xyz[2]); };
+  
+  protected:
+    Float_t fPos[kNsect][3];                    //  Deviations of the positions of the supermodules from the ideal position
+    Float_t fRot[kNsect][3];                    //  Rotation of the supermodules in respect to the ideal position
+    
+    ClassDef(AliTRDCalSuperModulePos,1)                     
+};
+    
+void AliTRDCalSuperModulePos::SetPos(Int_t sm, Float_t x, Float_t y, Float_t z) 
+{ 
+  fPos[sm][0] = x; 
+  fPos[sm][1] = y;
+  fPos[sm][2] = z; 
+}
+
+void AliTRDCalSuperModulePos::SetRot(Int_t sm, Float_t x, Float_t y, Float_t z) 
+{ 
+  fRot[sm][0] = x;
+  fRot[sm][1] = y;
+  fRot[sm][2] = z;
+}
+
+#endif
diff --git a/TRD/Cal/AliTRDCalSuperModuleStatus.cxx b/TRD/Cal/AliTRDCalSuperModuleStatus.cxx
new file mode 100644 (file)
index 0000000..3643ce9
--- /dev/null
@@ -0,0 +1,52 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for status of supermodules                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDCalSuperModuleStatus.h"
+
+ClassImp(AliTRDCalSuperModuleStatus)
+
+//_____________________________________________________________________________
+AliTRDCalSuperModuleStatus::AliTRDCalSuperModuleStatus():TNamed()
+{
+  //
+  // AliTRDCalSuperModuleStatus default constructor
+  //
+
+  for (Int_t idet = 0; idet < kNsect; idet++) {
+    fStatus[idet] = 0;
+  }
+}
+
+//_____________________________________________________________________________
+AliTRDCalSuperModuleStatus::AliTRDCalSuperModuleStatus(const Text_t *name, const Text_t *title)
+                :TNamed(name,title)
+{
+  //
+  // AliTRDCalSuperModuleStatus constructor
+  //
+
+  for (Int_t idet = 0; idet < kNsect; idet++) {
+    fStatus[idet] = 0;
+  }
+}
+
diff --git a/TRD/Cal/AliTRDCalSuperModuleStatus.h b/TRD/Cal/AliTRDCalSuperModuleStatus.h
new file mode 100644 (file)
index 0000000..24ba215
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef ALITRDCALSUPERMODULESTATUS_H
+#define ALITRDCALSUPERMODULESTATUS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  TRD calibration class for status of supermodules                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+class AliTRDCalSuperModuleStatus : public TNamed {
+  public:
+    enum { kNdet = 540, kNstacks = 90, kNcham = 5, kNsect = 18 };
+    enum { kInstalled = 1, kMasked = 2 };
+  
+    AliTRDCalSuperModuleStatus();
+    AliTRDCalSuperModuleStatus(const Text_t* name, const Text_t* title);
+
+    const Char_t GetStatus(Int_t sm) const { return fStatus[sm]; };
+    void SetStatus(Int_t sm, Char_t status) { fStatus[sm] = status; };
+
+    Bool_t IsInstalled(Int_t sm) const { return (GetStatus(sm) & kInstalled) ? kTRUE : kFALSE; }
+    Bool_t IsMasked(Int_t sm) const { return (GetStatus(sm) & kMasked) ? kTRUE : kFALSE; }
+
+  protected:
+    Char_t fStatus[kNsect];                    //  status byte
+
+    ClassDef(AliTRDCalSuperModuleStatus,1)
+};
+
+#endif
diff --git a/TRD/Cal/AliTRDCreateDummyCDB.C b/TRD/Cal/AliTRDCreateDummyCDB.C
new file mode 100644 (file)
index 0000000..859a4b0
--- /dev/null
@@ -0,0 +1,285 @@
+#if !defined( __CINT__) || defined(__MAKECINT__)
+
+#include <iostream>
+
+#include <AliCDBManager.h>
+#include <AliCDBStorage.h>
+#include <AliCDBEntry.h>
+#include <AliCDBMetaData.h>
+
+#include "AliTRDgeometry.h"
+
+#include "AliTRDCalROC.h"
+#include "AliTRDCalChamberPos.h"
+#include "AliTRDCalStackPos.h"
+#include "AliTRDCalSuperModulePos.h"
+#include "AliTRDCalPad.h"
+#include "AliTRDCalDet.h"
+#include "AliTRDCalGlobals.h"
+
+#include "AliTRDCalSuperModuleStatus.h"
+#include "AliTRDCalChamberStatus.h"
+#include "AliTRDCalMCMStatus.h"
+#include "AliTRDCalPadStatus.h"
+#include "AliTRDCalSingleChamberStatus.h"
+
+#include "AliTRDCalPIDLQ.h"
+#include "AliTRDCalMonitoring.h"
+
+#endif
+
+// run number for the dummy file
+const Int_t gkDummyRun = 0;
+AliCDBStorage* gStorLoc = 0;
+
+TObject* CreatePadObject(const char* shortName, const char* description, Float_t value)
+{
+  AliTRDCalPad *calPad = new AliTRDCalPad(shortName, description);
+  for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det)
+  {
+    AliTRDCalROC *calROC = calPad->GetCalROC(det);
+    for (Int_t channel=0; channel<calROC->GetNchannels(); ++channel)
+      calROC->SetValue(channel, value);
+  }
+  return calPad;
+}
+
+TObject* CreateDetObject(const char* shortName, const char* description, Float_t value)
+{
+  AliTRDCalDet *object = new AliTRDCalDet(shortName, description);
+  for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det)
+    object->SetValue(det, value);
+  return object;
+}
+
+TObject* CreateGlobalsObject()
+{
+  AliTRDCalGlobals *object = new AliTRDCalGlobals("Globals", "Global TRD calibration parameters");
+
+  object->SetSamplingFrequency(10.0);
+  object->SetNumberOfTimeBins(22);
+  
+  return object;
+}
+
+TObject* CreateChamberObject()
+{
+  AliTRDCalChamberPos *object = new AliTRDCalChamberPos("Chamber", "TRD chamber positions");
+  
+  for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det)
+  {
+    object->SetPos(det, 0, 0, 0);
+    object->SetRot(det, 0, 0, 0);
+  }
+  
+  return object;
+}
+
+TObject* CreateStackObject()
+{
+  AliTRDCalStackPos *object = new AliTRDCalStackPos("Stack", "TRD stack positions");
+
+  for (Int_t sect=0; sect<AliTRDgeometry::kNsect; ++sect)
+  {
+    for (Int_t chamber=0; chamber<AliTRDgeometry::kNcham; ++chamber)
+    {
+      object->SetPos(chamber, sect, 0, 0, 0);
+      object->SetRot(chamber, sect, 0, 0, 0);
+    }
+  }
+
+  return object;
+}
+
+TObject* CreateSuperModuleObject()
+{
+  AliTRDCalSuperModulePos *object = new AliTRDCalSuperModulePos("Stack", "TRD supermodule positions");
+
+  for (Int_t sect=0; sect<AliTRDgeometry::kNsect; ++sect)
+  {
+    object->SetPos(sect, 0, 0, 0);
+    object->SetRot(sect, 0, 0, 0);
+  }
+
+  return object;
+}
+
+
+TObject* CreatePRFWidthObject()
+{
+  AliTRDCalPad *calPad = new AliTRDCalPad("PRFWidth","PRFWidth");
+  for (Int_t plane=0; plane<AliTRDgeometry::kNplan; ++plane)
+  {
+    Float_t value = 0;
+    switch (plane)
+    {
+      case 0: value = 0.515; break;
+      case 1: value = 0.502; break;
+      case 2: value = 0.491; break;
+      case 3: value = 0.481; break;
+      case 4: value = 0.471; break;
+      case 5: value = 0.463; break;
+      default: cout << "CreatePRFWidthObject: UNEXPECTED" << endl; return 0;
+    }
+    for (Int_t chamber=0; chamber<AliTRDgeometry::kNcham; ++chamber)
+    {
+      for (Int_t sector=0; sector<AliTRDgeometry::kNsect; ++sector)
+      {
+        AliTRDCalROC *calROC = calPad->GetCalROC(plane, chamber, sector);
+        for (Int_t channel=0; channel<calROC->GetNchannels(); ++channel)
+          calROC->SetValue(channel, value);
+      }
+    }
+  }
+      
+  return calPad;
+}
+
+AliTRDCalSuperModuleStatus* CreateSuperModuleStatusObject()
+{
+  AliTRDCalSuperModuleStatus* obj = new AliTRDCalSuperModuleStatus("supermodulestatus", "supermodulestatus");
+
+  for (Int_t i=0; i<AliTRDgeometry::kNsect; ++i)
+    obj->SetStatus(i, AliTRDCalSuperModuleStatus::kInstalled);
+
+  return obj;
+}
+
+AliTRDCalChamberStatus* CreateChamberStatusObject()
+{
+  AliTRDCalChamberStatus* obj = new AliTRDCalChamberStatus("chamberstatus", "chamberstatus");
+
+  for (Int_t i=0; i<AliTRDgeometry::kNdet; ++i)
+    obj->SetStatus(i, AliTRDCalChamberStatus::kInstalled);
+
+  return obj;
+}
+
+AliTRDCalMCMStatus* CreateMCMStatusObject()
+{
+  AliTRDCalMCMStatus* obj = new AliTRDCalMCMStatus("mcmstatus", "mcmstatus");
+
+  return obj;
+}
+
+AliTRDCalPadStatus* CreatePadStatusObject()
+{
+  AliTRDCalPadStatus* obj = new AliTRDCalPadStatus("padstatus", "padstatus");
+
+  return obj;
+}
+
+AliTRDCalPIDLQ* CreatePIDLQObject()
+{
+  AliTRDCalPIDLQ* pid = new AliTRDCalPIDLQ("pidobject", "pidobject");
+  pid->ReadData("$ALICE_ROOT/TRD/TRDdEdxHistogramsV1.root");
+  pid->SetMeanChargeRatio(1.0); // The factor is the ratio of Mean of pi charge dist.
+                    // for the New TRD code divided by the Mean of pi charge
+                    // dist. given in AliTRDCalPIDLQ object
+  
+  return pid;
+}
+
+AliTRDCalMonitoring* CreateMonitoringObject()
+{
+  AliTRDCalMonitoring* obj = new AliTRDCalMonitoring();
+
+  return obj;
+}
+
+AliCDBMetaData* CreateMetaObject(const char* objectClassName)
+{
+  AliCDBMetaData *md1= new AliCDBMetaData(); 
+  md1->SetObjectClassName(objectClassName);
+  md1->SetResponsible("Jan Fiete Grosse-Oetringhaus");
+  md1->SetBeamPeriod(1);
+  md1->SetAliRootVersion("05-06-00"); //root version
+  md1->SetComment("The dummy values in this calibration file are for testing only");
+  
+  return md1;
+}
+
+void StoreObject(const char* cdbPath, TObject* object, AliCDBMetaData* metaData)
+{
+  AliCDBId id1(cdbPath, gkDummyRun, gkDummyRun); 
+  gStorLoc->Put(object, id1, metaData); 
+}
+    
+
+void AliTRDCreateDummyCDB()
+{
+  cout << endl << "TRD :: Creating dummy CDB with event number " << gkDummyRun << endl;
+  
+  AliCDBManager *man = AliCDBManager::Instance();
+  gStorLoc = man->GetStorage("local://$ALICE_ROOT");
+  if (!gStorLoc)
+    return;
+
+  TObject* obj = 0;
+  AliCDBMetaData* metaData = 0;
+  
+  metaData = CreateMetaObject("AliTRDCalPad");
+  
+  obj = CreatePadObject("LocalVdrift","TRD drift velocities (local variations)", 1);
+  StoreObject("TRD/Calib/LocalVdrift", obj, metaData);
+  
+  obj = CreatePadObject("LocalT0","T0 (local variations)", 1);
+  StoreObject("TRD/Calib/LocalT0", obj, metaData);
+
+  obj = CreatePadObject("GainFactor","GainFactor (local variations)", 1);
+  StoreObject("TRD/Calib/LocalGainFactor", obj, metaData);
+
+  obj = CreatePRFWidthObject();
+  StoreObject("TRD/Calib/PRFWidth", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalDet");
+  
+  obj = CreateDetObject("ChamberVdrift","TRD drift velocities (detector value)", 1.5);
+  StoreObject("TRD/Calib/ChamberVdrift", obj, metaData);
+  
+  obj = CreateDetObject("ChamberT0","T0 (detector value)", 0);
+  StoreObject("TRD/Calib/ChamberT0", obj, metaData);
+  
+  obj = CreateDetObject("ChamberGainFactor","GainFactor (detector value)", 1);
+  StoreObject("TRD/Calib/ChamberGainFactor", obj, metaData);
+  
+  metaData = CreateMetaObject("AliTRDCalGlobals");
+  obj = CreateGlobalsObject();
+  StoreObject("TRD/Calib/Globals", obj, metaData);
+  
+  metaData = CreateMetaObject("AliTRDCalChamberPos");
+  obj = CreateChamberObject();
+  StoreObject("TRD/Calib/ChamberPos", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalStackPos");
+  obj = CreateStackObject();
+  StoreObject("TRD/Calib/StackPos", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalSuperModulePos");
+  obj = CreateSuperModuleObject();
+  StoreObject("TRD/Calib/SuperModulePos", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalSuperModuleStatus");
+  obj = CreateSuperModuleStatusObject();
+  StoreObject("TRD/Calib/SuperModuleStatus", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalChamberStatus");
+  obj = CreateChamberStatusObject();
+  StoreObject("TRD/Calib/ChamberStatus", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalMCMStatus");
+  obj = CreateMCMStatusObject();
+  StoreObject("TRD/Calib/MCMStatus", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalPadStatus");
+  obj = CreatePadStatusObject();
+  StoreObject("TRD/Calib/PadStatus", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalPIDLQ");
+  obj = CreatePIDLQObject();
+  StoreObject("TRD/Calib/PIDLQ", obj, metaData);
+
+  metaData = CreateMetaObject("AliTRDCalMonitoring");
+  obj = CreateMonitoringObject();
+  StoreObject("TRD/Calib/MonitoringData", obj, metaData);
+}
diff --git a/TRD/Cal/AliTRDTestCal.C b/TRD/Cal/AliTRDTestCal.C
new file mode 100644 (file)
index 0000000..437752c
--- /dev/null
@@ -0,0 +1,55 @@
+void Dump(Char_t* comment, Float_t* f)
+{
+  cout << f[0] << " " << f[1] << " " << f[2] << endl;
+}
+
+void Dump(Char_t* comment, Float_t f)
+{
+  cout << comment << ": " << f << endl;
+}
+
+void AliTRDTestCal()
+{
+  AliTRDcalibDB* calib = AliTRDcalibDB::Instance();
+  if (!calib)
+  {
+    cerr << "calibDB singleton has already been terminated." << endl;
+    return;
+  }
+
+  Float_t f[3];
+
+  calib->GetChamberPos(0, f); Dump("chamberpos", f);
+  calib->GetChamberRot(0, f); Dump("chamberrot", f);
+
+  calib->GetStackPos(0, 0, f); Dump("stackpos", f);
+  calib->GetStackRot(0, 0, f); Dump("stackrot", f);
+
+  calib->GetSuperModulePos(0, f); Dump("smpos", f);
+  calib->GetSuperModuleRot(0, f); Dump("smrot", f);
+
+  Dump("vdrift", calib->GetVdrift(0, 0, 0));
+  Dump("vdrift-av", calib->GetVdriftAverage(0));
+
+  Dump("t0", calib->GetT0(0, 0, 0));
+  Dump("t0-av", calib->GetT0Average(0));
+
+  Dump("gain", calib->GetGainFactor(0, 0, 0));
+  Dump("gain-av", calib->GetGainFactorAverage(0));
+
+  Dump("prf", calib->GetPRFWidth(0, 0, 0));
+
+  Dump("sf", calib->GetSamplingFrequency());
+  Dump("timebins", calib->GetNumberOfTimeBins());
+
+  Dump("padstatus", calib->GetPadStatus(0, 0, 0));
+  Dump("mcmstatus", calib->GetMCMStatus(0, 0, 0));
+  Dump("chamberstatus", calib->GetChamberStatus(0));
+  Dump("smstatus", calib->GetSuperModuleStatus(0));
+
+  AliTRDCalMonitoring* mon = calib->GetMonitoringObject();
+  Dump("monitoring", (Float_t) mon);
+  AliTRDCalPIDLQ* pid = calib->GetPIDLQObject();
+  Dump("pid", (Float_t) pid);
+
+}
\ No newline at end of file
diff --git a/TRD/Cal/AliTRDbenchmarkCalibDB.C b/TRD/Cal/AliTRDbenchmarkCalibDB.C
new file mode 100644 (file)
index 0000000..69a8874
--- /dev/null
@@ -0,0 +1,53 @@
+#if !defined( __CINT__) || defined(__MAKECINT__)
+
+#include <iostream>
+
+#include "AliTRDcalibDB.h"
+#include <TStopwatch.h>
+#include <TRandom.h>
+
+extern TRandom* gRandom;
+
+#endif
+
+#define BENCHMARK(code, comment) \
+  timer.Reset(); timer.Start(); \
+  for (Int_t i=0; i<NUMBER; ++i) { \
+  code \
+  } \
+  timer.Stop(); \
+  cerr   << "Tested " << NUMBER << " times: " << comment << ". Time/call: " << timer.CpuTime() / NUMBER << endl; \
+  timer.Print();
+
+#define NUMBER 100000
+
+void AliTRDbenchmarkCalibDB()
+{
+  TStopwatch timer; 
+  AliTRDcalibDB* calib = AliTRDcalibDB::Instance();
+  if (!calib)
+  {
+    cerr << "calibDB singleton has already been terminated." << endl;
+    return;
+  }
+
+  Float_t xyz[3];
+  
+  calib->SetRun(1);
+  calib->SetRun(0);
+  calib->GetNumberOfTimeBins();
+  
+  BENCHMARK(calib->GetNumberOfTimeBins();, "GetNumberOfTimeBins");
+  BENCHMARK(calib->GetChamberPos(1, xyz);, "GetChamberPos");
+  BENCHMARK(calib->GetVdrift((Int_t) (gRandom->Uniform() * 500), (Int_t) (gRandom->Uniform() * 100), (Int_t) (gRandom->Uniform() * 10));, "GetVdrift");
+
+  #undef NUMBER
+  #define NUMBER 10000
+  BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetNumberOfTimeBins();, "GetNumberOfTimeBins with invalidating");
+  BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetChamberPos(1, xyz);, "GetChamberPos with invalidating");
+  #undef NUMBER
+  #define NUMBER 200
+  BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetVdrift(1, 1, 1);, "GetVdrift with invalidating");
+  
+  AliTRDcalibDB::Terminate();
+}
index 1965679c072e697ec82be62b04d8326a6cfe961b..89fefb5221b8c4c70771592d043ae146b6577888 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma link C++ class  AliTRDgeometry+;
 #pragma link C++ class  AliTRDgeometryFull+;
-#pragma link C++ class  AliTRDparameter+;
 #pragma link C++ class  AliTRDpadPlane+;
 
 #pragma link C++ class  AliTRDdigit+;
 #pragma link C++ class  AliTRDCalGlobals+;
 #pragma link C++ class  AliTRDCalChamberPos+;
 #pragma link C++ class  AliTRDCalStackPos+;
+#pragma link C++ class  AliTRDCalSuperModulePos+;
 #pragma link C++ class  AliTRDCalPIDLQ+;
+#pragma link C++ class  AliTRDCalMonitoring+;
+
+#pragma link C++ class  AliTRDCalSuperModuleStatus+;
+#pragma link C++ class  AliTRDCalChamberStatus+;
+#pragma link C++ class  AliTRDCalMCMStatus+;
+#pragma link C++ class  AliTRDCalPadStatus+;
+#pragma link C++ class  AliTRDCalSingleChamberStatus+;
+
 
 #endif
index ab7258834ffd78a8cb440deafc6202d88a899d69..905dd5be79e523c6dd8857bf2a2400ba3ef78e24 100644 (file)
@@ -8,23 +8,29 @@ SRCS= AliTRDarrayI.cxx \
       AliTRDsegmentArray.cxx \
       AliTRDgeometry.cxx \
       AliTRDgeometryFull.cxx \
-      AliTRDparameter.cxx \
       AliTRDdigit.cxx \
       AliTRDdigitsManager.cxx \
       AliTRDrawData.cxx \
       AliTRDpadPlane.cxx \
       AliTRDRawStream.cxx \
-      AliTRDCalROC.cxx \
-      AliTRDCalPad.cxx \
-      AliTRDCalDet.cxx \
-      AliTRDCalGlobals.cxx \
-      AliTRDCalChamberPos.cxx \
-      AliTRDCalStackPos.cxx \
       AliTRDCommonParam.cxx \
       AliTRDcalibDB.cxx \
-      AliTRDCalPIDLQ.cxx
+      Cal/AliTRDCalROC.cxx \
+      Cal/AliTRDCalPad.cxx \
+      Cal/AliTRDCalDet.cxx \
+      Cal/AliTRDCalGlobals.cxx \
+      Cal/AliTRDCalChamberPos.cxx \
+      Cal/AliTRDCalStackPos.cxx \
+      Cal/AliTRDCalSuperModulePos.cxx \
+      Cal/AliTRDCalPIDLQ.cxx \
+      Cal/AliTRDCalMonitoring.cxx \
+      Cal/AliTRDCalSuperModuleStatus.cxx \
+      Cal/AliTRDCalChamberStatus.cxx \
+      Cal/AliTRDCalMCMStatus.cxx \
+      Cal/AliTRDCalPadStatus.cxx \
+      Cal/AliTRDCalSingleChamberStatus.cxx
 
-HDRS= $(SRCS:.cxx=.h)                
+HDRS= $(SRCS:.cxx=.h)
 
 DHDR= TRDbaseLinkDef.h