plitting of drift speed (updated at every physics run) from other calibration paramet...
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Nov 2007 17:14:44 +0000 (17:14 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Nov 2007 17:14:44 +0000 (17:14 +0000)
17 files changed:
ITS/AliITSCalibration.h
ITS/AliITSCalibrationSDD.cxx
ITS/AliITSCalibrationSDD.h
ITS/AliITSDetTypeRec.cxx
ITS/AliITSDetTypeSim.cxx
ITS/AliITSDriftSpeedArraySDD.cxx [new file with mode: 0644]
ITS/AliITSDriftSpeedArraySDD.h [new file with mode: 0644]
ITS/AliITSDriftSpeedSDD.cxx [new file with mode: 0644]
ITS/AliITSDriftSpeedSDD.h [new file with mode: 0644]
ITS/AliITSOnlineSDDInjectors.cxx
ITS/AliITSPreprocessorSDD.cxx
ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root
ITS/Calib/DriftSpeedSDD/Run0_9999999_v0_s0.root [new file with mode: 0644]
ITS/ITSbaseLinkDef.h
ITS/StoreCalibSDD.C
ITS/StoreDriftSpeedSDD.C [new file with mode: 0644]
ITS/libITSbase.pkg

index 2294683..499f111 100644 (file)
@@ -12,6 +12,7 @@
 #include "AliLog.h"
 #include "AliITSresponse.h"
 #include "AliITSMapSDD.h"
+#include "AliITSDriftSpeedArraySDD.h"
 
 class AliITSsegmentation;
 class TF1;
@@ -78,6 +79,7 @@ class AliITSCalibration : public TObject {
     virtual void   Thresholds(Double_t &, Double_t &) const = 0;
     virtual void   SetMapA(Int_t, AliITSMapSDD*) {AliError("This method must be implemented in a derived class");}
     virtual void   SetMapT(Int_t, AliITSMapSDD*) {AliError("This method must be implemented in a derived class");}
+    virtual void   SetDriftSpeed(Int_t, AliITSDriftSpeedArraySDD*) {AliError("This method must be implemented in a derived class");}
     virtual Double_t DriftSpeed() const {return SpeedElectron();};
     // Set sigmas of the charge spread function
     virtual void    SetSigmaSpread(Double_t, Double_t) = 0;
index fc97b6b..42c8c74 100644 (file)
@@ -46,7 +46,9 @@ fBadChannels(),
 fMapAW0(0),
 fMapAW1(0),
 fMapTW0(0),
-fMapTW1(0)
+fMapTW1(0),
+fDrSpeed0(0),
+fDrSpeed1(0)
 {
   // default constructor
 
@@ -65,12 +67,6 @@ fMapTW1(0)
   SetThresholds(fgkMinValDefault,0.);
   SetTemperature(fgkTemperatureDefault);
   SetDataType();
-  fDriftVelParW0[0]= AliITSresponseSDD::DefaultDriftSpeed();
-  fDriftVelParW1[0]= AliITSresponseSDD::DefaultDriftSpeed();
-  for(Int_t i=1;i<4;i++){
-    fDriftVelParW0[i]=0.;
-    fDriftVelParW1[i]=0.;
-  }
  }
 //______________________________________________________________________
 AliITSCalibrationSDD::AliITSCalibrationSDD(const char *dataType):
@@ -83,7 +79,10 @@ fBadChannels(),
 fMapAW0(0),
 fMapAW1(0),
 fMapTW0(0),
-fMapTW1(0){
+fMapTW1(0),
+fDrSpeed0(0),
+fDrSpeed1(0)
+{
   // constructor
 
   SetDeadChannels();
@@ -102,12 +101,6 @@ fMapTW1(0){
   SetThresholds(fgkMinValDefault,0.);
   SetTemperature(fgkTemperatureDefault);
   SetDataType(dataType);
-  fDriftVelParW0[0]= AliITSresponseSDD::DefaultDriftSpeed();
-  fDriftVelParW1[0]= AliITSresponseSDD::DefaultDriftSpeed();
-  for(Int_t i=1;i<4;i++){
-    fDriftVelParW0[i]=0.;
-    fDriftVelParW1[i]=0.;
-  }
  }
 //_____________________________________________________________________
 AliITSCalibrationSDD::~AliITSCalibrationSDD(){
@@ -117,7 +110,8 @@ AliITSCalibrationSDD::~AliITSCalibrationSDD(){
   if(fMapAW1) delete fMapAW1;
   if(fMapTW0) delete fMapTW0;
   if(fMapTW1) delete fMapTW1;
-
+  if(fDrSpeed0) delete fDrSpeed0;
+  if(fDrSpeed1) delete fDrSpeed1;
 }
 
 //______________________________________________________________________
@@ -147,27 +141,6 @@ void AliITSCalibrationSDD::SetBadChannel(Int_t i,Int_t anode){
   fBadChannels[i]=anode;
   fGain[wing][chip][channel]=0;
 }
-//_____________________________________________________________________
-void AliITSCalibrationSDD::SetDriftSpeedParam(Int_t iWing, Float_t* p){
-  // Sets coefficients of pol3 fit to drift speed vs. anode
-  if(iWing==0){
-    for(Int_t i=0;i<4;i++) fDriftVelParW0[i]=p[i];
-  }else{
-    for(Int_t i=0;i<4;i++) fDriftVelParW1[i]=p[i];
-  }
-}
-
-//_____________________________________________________________________
-Float_t AliITSCalibrationSDD::GetDriftSpeedAtAnode(Float_t nAnode) const {
-  // Calculates drift speed for given position along anodes
-  if(nAnode<256){
-    return fDriftVelParW0[0]+fDriftVelParW0[1]*nAnode+fDriftVelParW0[2]*nAnode*nAnode+fDriftVelParW0[3]*nAnode*nAnode*nAnode;
-  }else{
-    nAnode-=256;
-    return fDriftVelParW1[0]+fDriftVelParW1[1]*nAnode+fDriftVelParW1[2]*nAnode*nAnode+fDriftVelParW1[3]*nAnode*nAnode*nAnode;
-  }
-}
-
 //______________________________________________________________________
 Float_t AliITSCalibrationSDD::GetChannelGain(Int_t anode) const{
   // returns gain for givenanode
index b73c8dc..86fa51c 100644 (file)
@@ -11,6 +11,7 @@
 #include "TArrayI.h"
 
 class AliITSMapSDD;
+class AliITSDriftSpeedArraySDD;
 class AliITSresponseSDD;
 ///////////////////////////////////////////////////////
 //  Response for SDD                                 //
@@ -117,6 +118,11 @@ class AliITSCalibrationSDD : public AliITSCalibration {
       else fMapTW1=mapT;
     } 
     static Int_t GetMapTimeNBin() {return fgkMapTimeNBin;} 
+    
+    virtual void SetDriftSpeed(Int_t wing, AliITSDriftSpeedArraySDD* arr){
+      if(wing==0) fDrSpeed0=arr;
+      else fDrSpeed1=arr;
+    }
 
     virtual void SetElectronics(Int_t p1=1) {((AliITSresponseSDD*)fResponse)->SetElectronics(p1);}
     virtual Int_t GetElectronics() const {return ((AliITSresponseSDD*)fResponse)->Electronics();}
@@ -127,11 +133,13 @@ class AliITSCalibrationSDD : public AliITSCalibration {
     virtual void SetDynamicRange(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetDynamicRange(p1);}
     virtual Float_t GetDynamicRange() const {return ((AliITSresponseSDD*)fResponse)->DynamicRange();} 
 
-    virtual void SetDriftSpeedParam(Int_t iWing, Float_t* p);
     virtual Float_t GetTimeOffset() const {return ((AliITSresponseSDD*)fResponse)->TimeOffset();}
     virtual Float_t GetADC2keV() const {return ((AliITSresponseSDD*)fResponse)->ADC2keV();}
-    virtual Float_t GetDriftSpeedAtAnode(Float_t nAnode) const;
-
+    virtual Float_t GetDriftSpeedAtAnode(Float_t nAnode) const{
+      if(fDrSpeed0==0 || fDrSpeed1==0) AliFatal("Drift speed not set\n");
+      if(nAnode<256) return fDrSpeed0->GetDriftSpeed(0,nAnode);
+      else return fDrSpeed1->GetDriftSpeed(0,nAnode-256);
+    }
     virtual void SetParamOptions(const char *opt1,const char *opt2) {((AliITSresponseSDD*)fResponse)->SetParamOptions(opt1,opt2);}
     virtual void GetParamOptions(char *opt1,char *opt2) const {((AliITSresponseSDD*)fResponse)->ParamOptions(opt1,opt2);}
     virtual Bool_t Do10to8() const {return ((AliITSresponseSDD*)fResponse)->Do10to8();}
@@ -174,21 +182,20 @@ class AliITSCalibrationSDD : public AliITSCalibration {
     Bool_t   fIsDead;  // module is dead or alive ?
     TArrayI  fBadChannels; //Array with bad anodes number (0-512) 
 
-    Float_t fDriftVelParW0[4];  // Coeff. of pol3 fit to drift speed vs. anode (wing0)
-    Float_t fDriftVelParW1[4];  // Coeff. of pol3 fit to drift speed vs. anode (wing1)
     
     AliITSMapSDD* fMapAW0;     //! map of residuals on anode coord. wing 0
     AliITSMapSDD* fMapAW1;     //! map of residuals on anode coord. wing 1
     AliITSMapSDD* fMapTW0;     //! map of residuals on time coord. wing 0
     AliITSMapSDD* fMapTW1;     //! map of residuals on time coord. wing 1
-
+    AliITSDriftSpeedArraySDD* fDrSpeed0; //! drift speed for wing 0
+    AliITSDriftSpeedArraySDD* fDrSpeed1; //! drift speed for wing 1
 
  private:
     AliITSCalibrationSDD(const AliITSCalibrationSDD &ob); // copy constructor
     AliITSCalibrationSDD& operator=(const AliITSCalibrationSDD & /* source */); // ass. op.
 
 
-    ClassDef(AliITSCalibrationSDD,7) // SDD response 
+    ClassDef(AliITSCalibrationSDD,8) // SDD response 
     
     };
 #endif
index 47b9a54..019ae4a 100644 (file)
@@ -45,6 +45,7 @@
 #include "AliITSRecPoint.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSMapSDD.h"
+#include "AliITSDriftSpeedArraySDD.h"
 #include "AliITSCalibrationSSD.h"
 #include "AliITSNoiseSSD.h"
 #include "AliITSGainSSD.h"
@@ -400,11 +401,12 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
   AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD");
   AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD");
   AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD");
+  AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD");
   AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD");
   AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD");
 
   if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD || 
-     !entry2SPD || !entry2SDD || !entry2SSD || !mapASDD || !mapTSDD){
+     !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !mapASDD || !mapTSDD){
     AliFatal("Calibration object retrieval failed! ");
     return kFALSE;
   }    
@@ -425,6 +427,10 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
   if(!cacheStatus)entry2SDD->SetObject(NULL);
   entry2SDD->SetOwner(kTRUE);
 
+  TObjArray *drSp = (TObjArray *)drSpSDD->GetObject();
+  if(!cacheStatus)drSpSDD->SetObject(NULL);
+  drSpSDD->SetOwner(kTRUE);
+
   TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
   if(!cacheStatus)mapASDD->SetObject(NULL);
   mapASDD->SetOwner(kTRUE);
@@ -461,9 +467,10 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
     delete entry2SSD;
     delete mapASDD;
     delete mapTSDD;
+    delete drSpSDD;
   }
 
-  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) 
+  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp)
       || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
     AliWarning("Can not get calibration from calibration database !");
     return kFALSE;
@@ -480,19 +487,23 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
     cal->SetResponse((AliITSresponse*)pSPD);
     SetCalibrationModel(i, cal);
   }
-  Int_t nn1=0;
-  Int_t nn2=0;
   for (Int_t i=0; i<fNMod[1]; i++) {
     cal = (AliITSCalibration*) calSDD->At(i);
     cal->SetResponse((AliITSresponse*)pSDD);
-    AliITSMapSDD* m1 = (AliITSMapSDD*)mapAn->At(nn1);nn1++;
-    AliITSMapSDD* m2 = (AliITSMapSDD*)mapAn->At(nn1);nn1++;
-    AliITSMapSDD* m3 = (AliITSMapSDD*)mapT->At(nn2);nn2++;
-    AliITSMapSDD* m4 = (AliITSMapSDD*)mapT->At(nn2);nn2++; 
-    cal->SetMapA(0,m1);
-    cal->SetMapA(1,m2);
-    cal->SetMapT(0,m3);
-    cal->SetMapT(1,m4);
+    Int_t i0=2*i;
+    Int_t i1=1+2*i;
+    AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0);
+    AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0);
+    AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0);
+    AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1);
+    AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1);
+    AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1);
+    cal->SetDriftSpeed(0,arr0);
+    cal->SetDriftSpeed(1,arr1);
+    cal->SetMapA(0,ma0);
+    cal->SetMapA(1,ma1);
+    cal->SetMapT(0,mt0);
+    cal->SetMapT(1,mt1);
     Int_t iMod = i + fNMod[0];
     SetCalibrationModel(iMod, cal);
   }
index 54be5e6..f056e12 100644 (file)
@@ -45,6 +45,7 @@
 #include "AliITSresponseSDD.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSMapSDD.h"
+#include "AliITSDriftSpeedArraySDD.h"
 #include "AliITSCalibrationSSD.h"
 #include "AliITSNoiseSSD.h"
 #include "AliITSGainSSD.h"
@@ -450,6 +451,7 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
 
   AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead", run);
   AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
+  AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD",run);
   AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD",run);
   AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD",run);
   // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
@@ -462,7 +464,7 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
   AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
 
   if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD || 
-     !entry2SPD || !entry2SDD || !entry2SSD || !mapASDD ||!mapTSDD){
+     !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !mapASDD ||!mapTSDD){
     AliFatal("Calibration object retrieval failed! ");
     return kFALSE;
   }    
@@ -489,6 +491,10 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
   if(!isCacheActive)entry2SDD->SetObject(NULL);
   entry2SDD->SetOwner(kTRUE);
 
+  TObjArray *drSp = (TObjArray *)drSpSDD->GetObject();
+  if(!isCacheActive)drSpSDD->SetObject(NULL);
+  drSpSDD->SetOwner(kTRUE);
+
   TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
   if(!isCacheActive)mapASDD->SetObject(NULL);
   mapASDD->SetOwner(kTRUE);
@@ -531,11 +537,12 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
     delete entry2SSD;
     delete mapASDD;   
     delete mapTSDD;
+    delete drSpSDD;
   }
   
   AliCDBManager::Instance()->SetCacheFlag(origCacheStatus);
 
-  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) 
+  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp)
       || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
     AliWarning("Can not get calibration from calibration database !");
     return kFALSE;
@@ -551,20 +558,24 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
     cal = (AliITSCalibration*) calSPD->At(i);
     cal->SetResponse(pSPD);
     SetCalibrationModel(i, cal);
- }
-  Int_t nn1=0;
-  Int_t nn2=0;
+  }
   for (Int_t i=0; i<fNMod[1]; i++) {
     cal = (AliITSCalibration*) calSDD->At(i);
     cal->SetResponse(pSDD);
-    AliITSMapSDD* m1 = (AliITSMapSDD*)mapAn->At(nn1);nn1++;
-    AliITSMapSDD* m2 = (AliITSMapSDD*)mapAn->At(nn1);nn1++;
-    AliITSMapSDD* m3 = (AliITSMapSDD*)mapT->At(nn2);nn2++;
-    AliITSMapSDD* m4 = (AliITSMapSDD*)mapT->At(nn2);nn2++; 
-    cal->SetMapA(0,m1);
-    cal->SetMapA(1,m2);
-    cal->SetMapT(0,m3);
-    cal->SetMapT(1,m4);
+    Int_t i0=2*i;
+    Int_t i1=1+2*i;
+    AliITSDriftSpeedArraySDD* arr0 = (AliITSDriftSpeedArraySDD*) drSp->At(i0);
+    AliITSMapSDD* ma0 = (AliITSMapSDD*)mapAn->At(i0);
+    AliITSMapSDD* mt0 = (AliITSMapSDD*)mapT->At(i0);
+    AliITSDriftSpeedArraySDD* arr1 = (AliITSDriftSpeedArraySDD*) drSp->At(i1);
+    AliITSMapSDD* ma1 = (AliITSMapSDD*)mapAn->At(i1);
+    AliITSMapSDD* mt1 = (AliITSMapSDD*)mapT->At(i1);
+    cal->SetDriftSpeed(0,arr0);
+    cal->SetDriftSpeed(1,arr1);
+    cal->SetMapA(0,ma0);
+    cal->SetMapA(1,ma1);
+    cal->SetMapT(0,mt0);
+    cal->SetMapT(1,mt1);
     Int_t iMod = i + fNMod[0];
     SetCalibrationModel(iMod, cal);
  }
diff --git a/ITS/AliITSDriftSpeedArraySDD.cxx b/ITS/AliITSDriftSpeedArraySDD.cxx
new file mode 100644 (file)
index 0000000..6e92640
--- /dev/null
@@ -0,0 +1,123 @@
+/**************************************************************************
+ * Copyright(c) 2007-2009, 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$ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Implementation of the class with array of AliITSDriftSpeedSDD //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include <TClonesArray.h>
+#include "AliITSDriftSpeedArraySDD.h"
+#include "AliITSDriftSpeedSDD.h"
+#include "AliLog.h"
+
+ClassImp(AliITSDriftSpeedArraySDD)
+//______________________________________________________________________
+AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD():
+TObject(),
+fNEvents(0),
+fDriftSpeedSDD(0){
+  // default constructor
+  fDriftSpeedSDD=new TClonesArray("AliITSDriftSpeedSDD",100);
+}
+//______________________________________________________________________
+AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD(Int_t numEv):
+TObject(),
+fNEvents(0),
+fDriftSpeedSDD(0){
+  // standard constructor
+  fDriftSpeedSDD=new TClonesArray("AliITSDriftSpeedSDD",numEv);
+}
+//______________________________________________________________________
+AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD(const AliITSDriftSpeedArraySDD& array):
+TObject(),
+fNEvents(array.fNEvents),
+fDriftSpeedSDD(array.fDriftSpeedSDD){
+  // copy constructor
+}
+//______________________________________________________________________
+AliITSDriftSpeedArraySDD& AliITSDriftSpeedArraySDD::operator=(const AliITSDriftSpeedArraySDD& array){
+  // assignment operator
+  this->~AliITSDriftSpeedArraySDD();
+  new(this) AliITSDriftSpeedArraySDD(array);
+  return *this;
+}
+
+//______________________________________________________________________
+AliITSDriftSpeedArraySDD::~AliITSDriftSpeedArraySDD(){
+  // destructor
+  if(fDriftSpeedSDD){
+    fDriftSpeedSDD->Delete();
+    delete fDriftSpeedSDD;
+  }
+}
+//______________________________________________________________________
+void AliITSDriftSpeedArraySDD::AddDriftSpeed(AliITSDriftSpeedSDD* drSpeed){
+  // adds an AliITSDriftSpeedSDD object in the array
+  TClonesArray &arr = *fDriftSpeedSDD;
+  new(arr[fNEvents]) AliITSDriftSpeedSDD(*drSpeed);
+  fNEvents++;
+  
+}
+//______________________________________________________________________
+void AliITSDriftSpeedArraySDD::PrintAll() const{
+  // print drift speed parameters for all elements in the array
+  printf("Array Size=%d\n",fDriftSpeedSDD->GetSize());
+  printf("Array Elements =%d\n",fNEvents);
+  for(Int_t i=0;i<fNEvents; i++){
+    printf("     ====== Array el. #%d ======\n",i);
+    AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD->At(i);
+    if(d) d->PrintDriftSpeedParameters();
+  }
+}
+//______________________________________________________________________
+Float_t AliITSDriftSpeedArraySDD::GetDriftSpeed(Int_t iEvent, Float_t iAnode) const{
+  // returns drift speed for given event number and anode
+  if(!fDriftSpeedSDD->IsSorted()) fDriftSpeedSDD->Sort();
+  if(fNEvents==1){
+    AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD->At(0);
+    return d->GetDriftSpeedAtAnode(iAnode);
+  }else{
+    Int_t nInjEv1=-1;
+    Int_t nInjEv2=-1;
+    AliITSDriftSpeedSDD *d1=NULL;
+    AliITSDriftSpeedSDD *d2=NULL;
+    for(Int_t i=0;i<fNEvents; i++){
+      d1=d2;
+      d2=(AliITSDriftSpeedSDD*)fDriftSpeedSDD->At(i);
+      nInjEv1=nInjEv2;
+      if(d2!=0){
+       nInjEv2=d2->GetEventNumber();
+       if(nInjEv2>=iEvent){
+         if(i==0) d1=(AliITSDriftSpeedSDD*)fDriftSpeedSDD->At(i+1);
+         nInjEv1=d1->GetEventNumber();
+         break;
+       }
+      }
+    }
+    if(nInjEv1>=0 && nInjEv2>=0 && nInjEv1!=nInjEv2){
+      Float_t v1=d1->GetDriftSpeedAtAnode(iAnode);
+      Float_t v2=d2->GetDriftSpeedAtAnode(iAnode);
+      Float_t vdrift=(v2-v1)*(iEvent-nInjEv1)/(nInjEv2-nInjEv1)+v1;
+      return vdrift;
+    }
+  }
+  AliWarning("Vdrift interpolation error\n");
+  return -999.;
+}
diff --git a/ITS/AliITSDriftSpeedArraySDD.h b/ITS/AliITSDriftSpeedArraySDD.h
new file mode 100644 (file)
index 0000000..21dd89f
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALIITSDRIFTSPEEDARRAYSDD_H
+#define ALIITSDRIFTSPEEDARRAYSDD_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Class for a TClonesArray of the AliITSDriftSpeedSDD objects   //
+// from 1 run (1 AliITSDriftSpeedSDD for  each injector trigger  //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include<TObject.h>
+#include<TClonesArray.h>
+
+class AliITSDriftSpeedSDD;
+
+
+class AliITSDriftSpeedArraySDD : public TObject{
+ public:
+  AliITSDriftSpeedArraySDD();
+  AliITSDriftSpeedArraySDD(Int_t numEv);
+  AliITSDriftSpeedArraySDD(const AliITSDriftSpeedArraySDD& array);
+  AliITSDriftSpeedArraySDD& operator=(const AliITSDriftSpeedArraySDD& array);
+  virtual ~AliITSDriftSpeedArraySDD();
+
+  void AddDriftSpeed(AliITSDriftSpeedSDD* drSpeed);
+
+  void PrintAll() const;
+  Float_t GetDriftSpeed(Int_t iEvent, Float_t iAnode) const;
+
+ protected:  
+  Int_t fNEvents;               // number of drift speed determination
+  TClonesArray *fDriftSpeedSDD; // array of AliITSDriftSpeedSDD objects
+  ClassDef(AliITSDriftSpeedArraySDD,1);
+};
+#endif
diff --git a/ITS/AliITSDriftSpeedSDD.cxx b/ITS/AliITSDriftSpeedSDD.cxx
new file mode 100644 (file)
index 0000000..a434d64
--- /dev/null
@@ -0,0 +1,71 @@
+/**************************************************************************
+ * Copyright(c) 2007-2009, 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$ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Implementation of the class for SDD drift speed               //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include "AliITSDriftSpeedSDD.h"
+#include "AliITSresponseSDD.h"
+#include "AliLog.h"
+
+ClassImp(AliITSDriftSpeedSDD)
+//______________________________________________________________________
+AliITSDriftSpeedSDD::AliITSDriftSpeedSDD():
+TObject(),
+fEvNum(0),
+fTimestamp(0),
+fPolDeg(0){
+  // default constructor
+  fDriftSpeedParam[0]=AliITSresponseSDD::DefaultDriftSpeed();
+  for(Int_t i=1; i<fgkMaxPolDeg+1; i++) fDriftSpeedParam[i]=0;
+}
+//______________________________________________________________________
+AliITSDriftSpeedSDD::AliITSDriftSpeedSDD(Int_t ev, UInt_t timest, Int_t deg, Float_t *coeff):
+TObject(),
+fEvNum(ev),
+fTimestamp(timest),
+fPolDeg(deg){
+  // standard constructor
+  if(deg>fgkMaxPolDeg){
+    fPolDeg=fgkMaxPolDeg;
+    AliWarning(Form("Polynomial degree must be <%d. Drift speed parametrization limited to %dth degree poly.\n",fgkMaxPolDeg,fgkMaxPolDeg));
+  }
+  for(Int_t i=0; i<fPolDeg+1; i++) fDriftSpeedParam[i]=coeff[i];
+  for(Int_t i=fPolDeg+1; i<fgkMaxPolDeg+1; i++) fDriftSpeedParam[i]=0;
+}
+//______________________________________________________________________
+AliITSDriftSpeedSDD::AliITSDriftSpeedSDD(const AliITSDriftSpeedSDD& drSpeed):
+TObject(),
+fEvNum(drSpeed.fEvNum),
+fTimestamp(drSpeed.fTimestamp),
+fPolDeg(drSpeed.fPolDeg)
+{
+  // copy constructor
+  for(Int_t i=0; i<fgkMaxPolDeg+1; i++) fDriftSpeedParam[i]=drSpeed.GetDriftSpeedParameter(i);
+  
+}
+//______________________________________________________________________
+void AliITSDriftSpeedSDD::PrintDriftSpeedParameters() const {
+  // printout drift speed parametrization
+  printf("Injector event #%d at time %d\n",fEvNum,fTimestamp);
+  printf("Coefficients of %d degree poly fit:\n",fPolDeg);
+  for(Int_t i=0; i<fgkMaxPolDeg+1; i++) printf("par[%d]=%f\n",i,fDriftSpeedParam[i]);
+}
diff --git a/ITS/AliITSDriftSpeedSDD.h b/ITS/AliITSDriftSpeedSDD.h
new file mode 100644 (file)
index 0000000..ab15154
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef ALIITSDRIFTSPEEDSDD_H
+#define ALIITSDRIFTSPEEDSDD_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Class for SDD drift speed extracted from injector triggers    //
+// drift speed dependence on anode number is parametrized via    //
+// a polynomial function (3rd degree by default, max. 5th degree)//
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include<TObject.h>
+#include<TMath.h>
+
+class AliITSDriftSpeedSDD : public TObject {
+ public:
+  AliITSDriftSpeedSDD();
+  AliITSDriftSpeedSDD(Int_t ev, UInt_t timest, Int_t deg, Float_t *coeff);
+  AliITSDriftSpeedSDD(const AliITSDriftSpeedSDD& drSpeed);
+  virtual ~AliITSDriftSpeedSDD(){};
+
+  virtual Bool_t IsEqual(const TObject *obj) const 
+    {return fEvNum == ((AliITSDriftSpeedSDD*)obj)->fEvNum;}
+  virtual Bool_t      IsSortable() const { return kTRUE; }
+  virtual Int_t       Compare(const TObject *obj) const 
+    {if(fEvNum<((AliITSDriftSpeedSDD*)obj)->fEvNum) return -1;
+    else if(fEvNum>((AliITSDriftSpeedSDD*)obj)->fEvNum) return 1;
+    else return 0; }
+
+  void PrintDriftSpeedParameters() const;
+
+  Int_t GetEventNumber() const {return fEvNum;}
+  UInt_t GetEventTimestamp() const {return fTimestamp;}
+  Float_t GetDriftSpeedParameter(Int_t i) const {return fDriftSpeedParam[i];}
+  Float_t GetDriftSpeedAtAnode(Float_t nAnode) const{
+    Float_t drSpeed=0;
+    for(Int_t i=0; i<fgkMaxPolDeg+1; i++) drSpeed+=fDriftSpeedParam[i]*TMath::Power(nAnode,i);
+    return drSpeed;
+  }
+
+ protected:
+  static const Int_t fgkMaxPolDeg=5; // max. degree of the poly fit
+  Int_t fEvNum;  // event number of injector event
+  UInt_t fTimestamp; // event timestamp
+  Int_t fPolDeg;    // degree of the ploy fit to drift speed vs. anode
+  Float_t fDriftSpeedParam[fgkMaxPolDeg+1];  // coefficients of the poly fit
+  ClassDef(AliITSDriftSpeedSDD,1);
+};
+#endif
index dac882a..85ad7de 100644 (file)
@@ -392,7 +392,10 @@ void AliITSOnlineSDDInjectors::WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_
   Char_t outfilnam[100];
   sprintf(outfilnam,"SDDinj_mod%03d_sid%d.data",fModuleId,fSide);
   FILE* outf;
-  if(optAppend==0) outf=fopen(outfilnam,"w");
+  if(optAppend==0){ 
+    outf=fopen(outfilnam,"w");
+    fprintf(outf,"%d\n",fPolOrder);
+  }
   else outf=fopen(outfilnam,"a");
   fprintf(outf,"%d   %d   ",evNumb,timeStamp);
   for(Int_t ic=0;ic<fPolOrder+1;ic++){
index 8cdefee..56ea4d3 100644 (file)
@@ -8,6 +8,8 @@
 
 #include "AliITSPreprocessorSDD.h"
 #include "AliITSCalibrationSDD.h"
+#include "AliITSDriftSpeedSDD.h"
+#include "AliITSDriftSpeedArraySDD.h"
 #include "AliShuttleInterface.h"
 #include "AliCDBMetaData.h"
 #include "TObjArray.h"
@@ -27,122 +29,134 @@ UInt_t AliITSPreprocessorSDD::Process(TMap*/* dcsAliasMap*/){
 
   //preprocessing. 
 
-  TObjArray respSDD(fgkNumberOfSDD);
-  respSDD.SetOwner(kFALSE);
-  Float_t baseline,rawnoise,cmn,corn,gain;
-  Int_t isgoodan,i,im,is,isgoodmod;
-  Int_t numOfBadChannels[fgkNumberOfSDD];
-  //TString pwd = gSystem->pwd();
-//  const Char_t* tempDir=AliShuttleInterface::GetShuttleTempDir();
-  
-  TList* sourceList = GetFileSources(kDAQ, "SDD_Calib");
-  if (!sourceList){ 
-    Log("Error: no sources found for SDD_Calib");
-    return 2;
-  }
-
-  Int_t ind = 0;
+  TString runType = GetRunType();
+  Bool_t retcode;
   Char_t command[100];
-  while (sourceList->At(ind)!=NULL) {
-    TObjString* tarId = (TObjString*) sourceList->At(ind);
-    TString tarName = GetFile(kDAQ, "SDD_Calib", tarId->GetString().Data());
-//    gSystem->cd(tempDir);
-    if(tarName.Length()==0){
-      Log(Form("Baseline tar file from source %d not found.",ind));
-      return 2;
-    }
-    sprintf(command,"tar -xf %s",tarName.Data());
-    gSystem->Exec(command);
-    ind++;
-  }
-   
-  sourceList = GetFileSources(kDAQ, "SDD_Injec");
-  if (!sourceList){ 
-    Log("Error: no sources found for SDD_Injec");
-    return 2;
-  }
+  Char_t inpFileName[100];
+  AliCDBMetaData *md1= new AliCDBMetaData();
+  md1->SetResponsible("Elisabetta Crescio, Francesco Prino");
+  md1->SetBeamPeriod(0);
+  md1->SetAliRootVersion("head 30 November 2007"); //root version
+  md1->SetComment("This is a test");
 
-  ind = 0;
-  while (sourceList->At(ind)!=NULL) {
-   TObjString* tarId = (TObjString*) sourceList->At(ind);
-   TString tarName = GetFile(kDAQ, "SDD_Injec", tarId->GetString().Data());
-//    gSystem->cd(tempDir);
-    if(tarName.Length()==0){
-      Log(Form("Injector tar file from source %d not found.",ind));
+  if (runType == "PULSER_RUN"){
+    TObjArray calSDD(fgkNumberOfSDD);
+    calSDD.SetOwner(kFALSE);
+    Float_t baseline,rawnoise,cmn,corn,gain;
+    Int_t isgoodan,i,im,is,isgoodmod;
+    Int_t numOfBadChannels[fgkNumberOfSDD];
+  
+    TList* sourceList = GetFileSources(kDAQ, "SDD_Calib");
+    if (!sourceList){ 
+      Log("Error: no sources found for SDD_Calib");
       return 2;
     }
-    sprintf(command,"tar -xf %s",tarName.Data());
-    gSystem->Exec(command);
-    ind++;
-  }
-  
-  delete sourceList;
 
-  for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
-    AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated");
-    numOfBadChannels[imod]=0;
-    Int_t badch[fgkNumberOfChannels];
-    for(Int_t isid=0;isid<=1;isid++){
-      Char_t basFileName[100];
-//      sprintf(basFileName,"%s/SDDbase_mod%03d_sid%d.data",tempDir,imod,isid);
-      sprintf(basFileName,"./SDDbase_mod%03d_sid%d.data",imod,isid);
-      FILE* basFil = fopen(basFileName,"read");
-      if (basFil == 0) {
-       Log(Form("File %s not found.",basFileName));
+    Int_t ind = 0;
+    while (sourceList->At(ind)!=NULL) {
+      TObjString* tarId = (TObjString*) sourceList->At(ind);
+      TString tarName = GetFile(kDAQ, "SDD_Calib", tarId->GetString().Data());
+      if(tarName.Length()==0){
+       Log(Form("Baseline tar file from source %d not found.",ind));
        return 2;
-      }      
-      fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
-      if(!isgoodmod) cal->SetDead();
-      for(Int_t ian=0;ian<(fgkNumberOfChannels/2);ian++){
-       fscanf(basFil,"%d %d %f %f %f %f %f\n",&i,&isgoodan,&baseline,&rawnoise,&cmn,&corn,&gain);
-       Int_t ich=ian;
-       if(isid==1) ich+=256;
-       if(!isgoodan){ 
-         Int_t ibad=numOfBadChannels[imod];
-         numOfBadChannels[imod]++;
-         badch[ibad]=ich;
-       }
-       cal->SetBaseline(ich,baseline);
-       cal->SetNoiseAfterElectronics(ich,rawnoise);
-       Int_t iChip=cal->GetChip(ich);
-       Int_t iChInChip=cal->GetChipChannel(ich);
-       cal->SetGain(gain,isid,iChip,iChInChip);
       }
-      cal->SetDeadChannels(numOfBadChannels[imod]);
-      for(Int_t ibad=0;ibad<numOfBadChannels[imod];ibad++){
-       cal->SetBadChannel(ibad,badch[ibad]);
-      }
-      fclose(basFil);
+      sprintf(command,"tar -xf %s",tarName.Data());
+      gSystem->Exec(command);
+      ind++;
+    }
+    delete sourceList;
 
-      Char_t injFileName[100];
-      Int_t evNumb; 
-      UInt_t timeStamp;
-      Float_t param[4];
-      sprintf(injFileName,"./SDDinj_mod%03d_sid%d.data",imod,isid);
-      FILE* injFil = fopen(injFileName,"read");
-      if (injFil == 0) {
-       Log(Form("File %s not found.",basFileName));
-       return 2;
-      }      
-      while (!feof(injFil)){
-       fscanf(injFil,"%d %d",&evNumb,&timeStamp);
-       if(feof(injFil)) break;
-       for(Int_t ic=0;ic<4;ic++) fscanf(injFil,"%f",&param[ic]);
-       cal->SetDriftSpeedParam(isid,param);
+    for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
+      AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated");
+      numOfBadChannels[imod]=0;
+      Int_t badch[fgkNumberOfChannels];
+      for(Int_t isid=0;isid<=1;isid++){
+       sprintf(inpFileName,"./SDDbase_mod%03d_sid%d.data",imod,isid);
+       FILE* basFil = fopen(inpFileName,"read");
+       if (basFil == 0) {
+        Log(Form("File %s not found.",inpFileName));
+        return 2;
+       }      
+       fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
+       if(!isgoodmod) cal->SetDead();
+       for(Int_t ian=0;ian<(fgkNumberOfChannels/2);ian++){
+        fscanf(basFil,"%d %d %f %f %f %f %f\n",&i,&isgoodan,&baseline,&rawnoise,&cmn,&corn,&gain);
+        Int_t ich=ian;
+        if(isid==1) ich+=256;
+        if(!isgoodan){ 
+          Int_t ibad=numOfBadChannels[imod];
+          numOfBadChannels[imod]++;
+          badch[ibad]=ich;
+        }
+        cal->SetBaseline(ich,baseline);
+        cal->SetNoiseAfterElectronics(ich,rawnoise);
+        Int_t iChip=cal->GetChip(ich);
+        Int_t iChInChip=cal->GetChipChannel(ich);
+        cal->SetGain(gain,isid,iChip,iChInChip);
+       }
+       cal->SetDeadChannels(numOfBadChannels[imod]);
+       for(Int_t ibad=0;ibad<numOfBadChannels[imod];ibad++){
+        cal->SetBadChannel(ibad,badch[ibad]);
+       }
+       fclose(basFil);
       }
+      calSDD.Add(cal);
     }
-    respSDD.Add(cal);
-  }
+    md1->SetObjectClassName("AliITSCalibration");
+    retcode = Store("Calib","CalibSDD",&calSDD,md1, 0, kTRUE);
+  }else if(runType == "PHYSICS"){
 
-  AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
-  md1->SetObjectClassName("AliITSCalibration");
-  md1->SetResponsible("Elisabetta Crescio, Francesco Prino");
-  md1->SetBeamPeriod(0);
-  md1->SetAliRootVersion("head 5 April 2007"); //root version
-  md1->SetComment("This is a test");
+    TObjArray vdrift(2*fgkNumberOfSDD);
+    vdrift.SetOwner(kFALSE);
+    Int_t evNumb,polDeg; 
+    UInt_t timeStamp;
+    Float_t param[4];
 
-  Bool_t retcode = Store("Calib","CalibSDD",&respSDD,md1, 0, kTRUE);
+    TList* sourceList = GetFileSources(kDAQ, "SDD_Injec");
+    if (!sourceList){ 
+      Log("Error: no sources found for SDD_Injec");
+      return 2;
+    }
+    Int_t ind = 0;
+    while (sourceList->At(ind)!=NULL) {
+      TObjString* tarId = (TObjString*) sourceList->At(ind);
+      TString tarName = GetFile(kDAQ, "SDD_Injec", tarId->GetString().Data());
+      if(tarName.Length()==0){
+       Log(Form("Injector tar file from source %d not found.",ind));
+       return 2;
+      }
+      sprintf(command,"tar -xf %s",tarName.Data());
+      gSystem->Exec(command);
+      ind++;
+    }
+    delete sourceList;
 
+    for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
+      for(Int_t isid=0;isid<=1;isid++){
+       AliITSDriftSpeedArraySDD *arr=new AliITSDriftSpeedArraySDD();
+       sprintf(inpFileName,"./SDDinj_mod%03d_sid%d.data",imod,isid);
+       FILE* injFil = fopen(inpFileName,"read");
+       if (injFil == 0) {
+         Log(Form("File %s not found.",inpFileName));
+         return 2;
+       }
+       fscanf(injFil,"%d",&polDeg);
+       while (!feof(injFil)){
+         fscanf(injFil,"%d %d",&evNumb,&timeStamp);
+         if(feof(injFil)) break;
+         for(Int_t ic=0;ic<4;ic++) fscanf(injFil,"%f",&param[ic]);
+         AliITSDriftSpeedSDD *dsp=new AliITSDriftSpeedSDD(evNumb,timeStamp,polDeg,param);
+         arr->AddDriftSpeed(dsp);
+       }
+       vdrift.Add(arr);
+      }
+    }
+    md1->SetObjectClassName("AliITSDriftSpeedArraySDD");
+    retcode = Store("Calib","DriftSpeedSDD",&vdrift,md1,0, kTRUE);    
+  }else{
+    // do nothing for other run types
+    retcode=1;
+  }
   if(retcode) return 0;
   else return 1;
 }
index fb92149..e677098 100644 (file)
Binary files a/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root and b/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root differ
diff --git a/ITS/Calib/DriftSpeedSDD/Run0_9999999_v0_s0.root b/ITS/Calib/DriftSpeedSDD/Run0_9999999_v0_s0.root
new file mode 100644 (file)
index 0000000..63bd792
Binary files /dev/null and b/ITS/Calib/DriftSpeedSDD/Run0_9999999_v0_s0.root differ
index 0f23e30..f38a4ec 100644 (file)
@@ -54,6 +54,8 @@
 #pragma link C++ class  AliITSCalibrationSDD+;
 #pragma link C++ class  AliITSCalibrationSSD+;
 #pragma link C++ class  AliITSMapSDD+;
+#pragma link C++ class  AliITSDriftSpeedSDD+;
+#pragma link C++ class  AliITSDriftSpeedArraySDD+;
 #pragma link C++ class  AliITSBadChannelsSSD+;
 #pragma link C++ class  AliITSGainSSD+;
 #pragma link C++ class  AliITSNoiseSSD+;
index b7be6ba..d94ed93 100644 (file)
@@ -77,11 +77,6 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
   for(Int_t mod=0;mod<260;mod++){
     AliITSCalibrationSDD* resd = new AliITSCalibrationSDD("simulated");
 
-    // drift velocity wing 0 and 1
-    for(Int_t ic=0;ic<4;ic++) drVel[ic]=gran->Gaus(drVelParam[ic],edrVelParam[ic]);
-    resd->SetDriftSpeedParam(0,drVel);
-    for(Int_t ic=0;ic<4;ic++) drVel[ic]=gran->Gaus(drVelParam[ic],edrVelParam[ic]);
-    resd->SetDriftSpeedParam(1,drVel);
     Int_t nBadUp = 0;
     Int_t nBadDown = 0;
       
diff --git a/ITS/StoreDriftSpeedSDD.C b/ITS/StoreDriftSpeedSDD.C
new file mode 100644 (file)
index 0000000..d22c734
--- /dev/null
@@ -0,0 +1,63 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include "AliCDBManager.h"
+#include "AliITSCalibrationSDD.h"
+#include "AliITSresponseSDD.h"
+#include "AliITSDriftSpeedSDD.h"
+#include "AliITSDriftSpeedArraySDD.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBStorage.h"
+#include "AliCDBId.h"
+#include "AliCDBPath.h"
+#include "AliCDBEntry.h"
+#include <TObjArray.h>
+#include <TRandom3.h>
+#endif
+
+void StoreDriftSpeedSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
+  ///////////////////////////////////////////////////////////////////////
+  // Macro to generate and store the drift speed files for SDD         //
+  // Generates:                                                        //
+  //  1 file with 520 AliITSDriftSpeedArraySDD objects with            //
+  ///////////////////////////////////////////////////////////////////////
+  
+  if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
+    AliCDBManager::Instance()->SetDefaultStorage("local://OCDB");
+  }
+  
+
+  AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
+  md1->SetObjectClassName("AliITSDriftSpeedArraySDD");
+  md1->SetResponsible("Elisabetta Crescio, Francesco Prino");
+  md1->SetBeamPeriod(0);
+  md1->SetAliRootVersion("Head 20 nov. 2007"); //root version
+  md1->SetComment("This is a test");
+
+  AliCDBId drSpeed("ITS/Calib/DriftSpeedSDD",firstRun, lastRun);
+  TObjArray vdrift(520);
+  vdrift.SetOwner(kFALSE);
+
+
+
+  Float_t drVelParam[4]={7.75,0.002344,-0.000009,0};
+  Float_t edrVelParam[4]={0.1,0,0,0};
+  Float_t drVel[4];
+  TRandom3 *gran = new TRandom3();
+  
+  for(Int_t mod=0;mod<260;mod++){
+    AliITSDriftSpeedArraySDD *arr0 = new AliITSDriftSpeedArraySDD(5);
+    AliITSDriftSpeedArraySDD *arr1 = new AliITSDriftSpeedArraySDD(5);
+    for(Int_t iev=0; iev<5;iev++){
+      for(Int_t ic=0;ic<4;ic++) drVel[ic]=gran->Gaus(drVelParam[ic],edrVelParam[ic]);
+      AliITSDriftSpeedSDD *v0=new AliITSDriftSpeedSDD(iev*20,iev+1000,3,drVel);
+      arr0->AddDriftSpeed(v0);
+      for(Int_t ic=0;ic<4;ic++) drVel[ic]=gran->Gaus(drVelParam[ic],edrVelParam[ic]);
+      AliITSDriftSpeedSDD *v1=new AliITSDriftSpeedSDD(iev*20,iev+1000,3,drVel);
+      arr1->AddDriftSpeed(v1);
+    }
+    vdrift.Add(arr0);
+    vdrift.Add(arr1);
+    printf("Added module %d\n",mod);
+  }
+    
+  AliCDBManager::Instance()->GetDefaultStorage()->Put(&vdrift, drSpeed, md1);   
+}
index 49c993c..0f4b34b 100644 (file)
@@ -31,6 +31,8 @@ SRCS =        AliITSgeom.cxx \
                AliITSCalibrationSDD.cxx \
                AliITSCalibrationSSD.cxx \
                AliITSMapSDD.cxx \
+               AliITSDriftSpeedSDD.cxx \
+               AliITSDriftSpeedArraySDD.cxx \
                AliITSBadChannelsSSD.cxx \
                AliITSGainSSD.cxx \
                AliITSNoiseSSD.cxx \