Reconstructor to fill new ESD, Digitizer reading new OCDBs and macros to crate them
authormbroz <Michal.Broz@cern.ch>
Thu, 29 Jan 2015 12:55:24 +0000 (13:55 +0100)
committermbroz <Michal.Broz@cern.ch>
Thu, 29 Jan 2015 12:55:24 +0000 (13:55 +0100)
AD/ADbase/AliADCalibData.cxx
AD/ADrec/AliADReconstructor.cxx
AD/ADrec/AliADReconstructor.h
AD/ADsim/AliADDigitizer.cxx
AD/macros/MakeADCalibEntry.C [new file with mode: 0644]
AD/macros/MakeADLightYieldsEntry.C [new file with mode: 0644]
AD/macros/MakeADPMGainsEntry.C [new file with mode: 0644]
AD/macros/MakeADRecoParamEntry.C [new file with mode: 0644]
AD/macros/MakeADTimeDelaysEntry.C [new file with mode: 0644]

index 98e901b..7acf9ca 100644 (file)
@@ -274,7 +274,7 @@ void  AliADCalibData::InitLightYields()
   // Read from a separate OCDB entry
   if (fLightYields) return;
 
-  AliCDBEntry *entry = AliCDBManager::Instance()->Get("VZERO/Calib/LightYields");
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("AD/Calib/LightYields");
   if (!entry) AliFatal("AD light yields are not found in OCDB !");
   TH1F *yields = (TH1F*)entry->GetObject();
 
@@ -291,8 +291,8 @@ void  AliADCalibData::InitPMGains()
   // Read from a separate OCDB entry
   if (fPMGainsA) return;
 
-  AliCDBEntry *entry = AliCDBManager::Instance()->Get("VZERO/Calib/PMGains");
-  if (!entry) AliFatal("VZERO PM gains are not found in OCDB !");
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("AD/Calib/PMGains");
+  if (!entry) AliFatal("AD PM gains are not found in OCDB !");
   TH2F *gains = (TH2F*)entry->GetObject();
 
   fPMGainsA = new Float_t[16];
index 1f648ec..c0dc36b 100644 (file)
 #include "AliCDBStorage.h"
 #include "AliCDBEntry.h"
 #include "AliESDEvent.h"
+#include "AliRunInfo.h"
+#include "AliCTPTimeParams.h"
+#include "AliLHCClockPhase.h"
 
 #include "AliADReconstructor.h"
 #include "AliADdigit.h"
 #include "AliESDAD.h"
+#include "AliESDADfriend.h"
 #include "AliADConst.h"
 #include "AliADCalibData.h"
 #include "AliADRawStream.h"
@@ -39,8 +43,12 @@ ClassImp(AliADReconstructor)
 AliADReconstructor:: AliADReconstructor():
   AliReconstructor(),
   fESDAD(0x0),
+  fESD(0x0),
+  fESDADfriend(0x0),
   fCalibData(NULL),
-  fDigitsArray(0)
+  fDigitsArray(0),
+  fCollisionMode(0),
+  fBeamEnergy(0.)
 
 {
   fCalibData = GetCalibData();
@@ -64,6 +72,7 @@ AliADReconstructor::~AliADReconstructor()
 {
 // destructor
   delete fESDAD;
+  delete fESDADfriend;
   delete fDigitsArray;
 }
 
@@ -72,6 +81,7 @@ void AliADReconstructor::Init()
 {
 // initializer
     fESDAD  = new AliESDAD;
+    fESDADfriend  = new AliESDADfriend;
 }
 
 //_____________________________________________________________________________
@@ -113,7 +123,19 @@ void AliADReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTre
       if(!fCalibData->IsChannelDead(iChannel)){
          new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()]) AliADdigit(offlineCh, time, width,integrator, chargeADC, BBflag, BGflag);
       }
+      
+      fESDADfriend->SetTriggerInputs(rawStream.GetTriggerInputs());
+      fESDADfriend->SetTriggerInputsMask(rawStream.GetTriggerInputsMask());
+    
+      fESDADfriend->SetBBScalers(offlineCh,rawStream.GetBBScalers(iChannel));
+      fESDADfriend->SetBGScalers(offlineCh,rawStream.GetBGScalers(iChannel));
+      for (Int_t iEv = 0; iEv < kNClocks; iEv++) {
+         fESDADfriend->SetBBFlag(offlineCh,iEv,rawStream.GetBBFlag(iChannel,iEv));
+         fESDADfriend->SetBGFlag(offlineCh,iEv,rawStream.GetBGFlag(iChannel,iEv));
+      }
     }
+    for(Int_t iScaler = 0; iScaler < AliESDADfriend::kNScalers; iScaler++)
+      fESDADfriend->SetTriggerScalers(iScaler,rawStream.GetTriggerScalers(iScaler));
 
     digitsTree->Fill();
   }
@@ -128,47 +150,140 @@ void AliADReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,AliE
 
   printf("Running AD Reconstruction \n");
 
-  // fills ESD with AD Digits
-
-  if (!digitsTree)
-    {
+  if (!digitsTree) {
       AliError("No digits tree!");
       return;
-    }
-
-  TBranch* digitBranch = digitsTree->GetBranch("ADdigit");
-  if (!digitBranch) {
-    AliError("No AD digits branch found!");
-    return;
   }
+
+  TBranch* digitBranch = digitsTree->GetBranch("ADDigit");
   digitBranch->SetAddress(&fDigitsArray);
 
-  digitsTree->GetEvent(0);
+  Float_t   mult[16];  
+  Float_t    adc[16]; 
+  Float_t   time[16]; 
+  Float_t  width[16];
+  Bool_t aBBflag[16];
+  Bool_t aBGflag[16];
+   
+  for (Int_t i=0; i<16; i++){
+       adc[i]    = 0.0;
+       mult[i]   = 0.0;
+       time[i]   = kInvalidTime;
+       width[i]  = 0.0;
+       aBBflag[i] = kFALSE;
+       aBGflag[i] = kFALSE;
+  }
 
-  Bool_t ADHits[16];
-  for(Int_t i = 0; i < 16; i++) { ADHits[i] = kFALSE; }
+  Int_t nEntries = (Int_t)digitsTree->GetEntries();
+  for (Int_t e=0; e<nEntries; e++) {
+    digitsTree->GetEvent(e);
 
-  Int_t nDigits = fDigitsArray->GetEntriesFast();
+    Int_t nDigits = fDigitsArray->GetEntriesFast();
     
-  for (Int_t d=0; d<nDigits; d++) {    
-    AliADdigit* digit = (AliADdigit*) fDigitsArray->At(d);
-    Int_t module = digit->PMNumber();
- //   printf("AD Module: %d\n",module);
-    ADHits[module] = kTRUE;
-  }  
-  if (!esd) {
-       AliError("NO AD ESD branch found!");
-       return;
-}
-  //fESDAD->SetADBitCell(ADHits);
-
-  if (esd)
-    {
-      AliDebug(1, Form("Writing AD data to ESD Tree"));
-      esd->SetADData(fESDAD);
+    for (Int_t d=0; d<nDigits; d++) {    
+        AliADdigit* digit = (AliADdigit*) fDigitsArray->At(d);      
+        Int_t  pmNumber = digit->PMNumber();
+
+        // Pedestal retrieval and suppression
+       Bool_t integrator = digit->Integrator();
+        Float_t maxadc = 0;
+        Int_t imax = -1;
+        Float_t adcPedSub[kNClocks];
+        for(Int_t iClock=0; iClock < kNClocks; ++iClock) {
+         Short_t charge = digit->ChargeADC(iClock);
+         Bool_t iIntegrator = (iClock%2 == 0) ? integrator : !integrator;
+         Int_t k = pmNumber + 16*iIntegrator;
+         adcPedSub[iClock] = (Float_t)charge - fCalibData->GetPedestal(k);
+         //if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
+         if(adcPedSub[iClock] <= 2*fCalibData->GetSigma(k)) {
+           adcPedSub[iClock] = 0;
+           continue;
+         }
+         //if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
+         if(iClock < 8 || iClock > 12) continue;
+         if(adcPedSub[iClock] > maxadc) {
+           maxadc = adcPedSub[iClock];
+           imax   = iClock;
+         }
+       }
+
+       if (imax != -1) {
+         //Int_t start = imax - GetRecoParam()->GetNPreClocks();
+         Int_t start = imax - 2;
+         if (start < 0) start = 0;
+         //Int_t end = imax + GetRecoParam()->GetNPostClocks();
+         Int_t end = imax + 1;
+         if (end > 20) end = 20;
+         for(Int_t iClock = start; iClock <= end; iClock++) {
+           adc[pmNumber] += adcPedSub[iClock];
+         }
+       }
+
+       // HPTDC leading time and width
+       // Correction for slewing and various time delays
+        //time[pmNumber]  =  CorrectLeadingTime(pmNumber,digit->Time(),adc[pmNumber]);
+       time[pmNumber]  =  digit->Time();
+       width[pmNumber] =  digit->Width();
+       aBBflag[pmNumber] = digit->GetBBflag();
+       aBGflag[pmNumber] = digit->GetBGflag();
+
+       if (adc[pmNumber] > 0) {
+         AliDebug(1,Form("PM = %d ADC = %.2f (%.2f) TDC %.2f (%.2f)   Int %d (%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d)    %.2f %.2f   %.2f %.2f    %d %d",pmNumber, adc[pmNumber],
+                      digit->ChargeADC(11)+digit->ChargeADC(10)+digit->ChargeADC(9)+digit->ChargeADC(8)+
+                      digit->ChargeADC(7)+digit->ChargeADC(6)+digit->ChargeADC(5)+digit->ChargeADC(4)-
+                      4.*fCalibData->GetPedestal(pmNumber)-4.*fCalibData->GetPedestal(pmNumber+16),
+                         digit->Time(),time[pmNumber],
+                         integrator,
+                         digit->ChargeADC(0),digit->ChargeADC(1),digit->ChargeADC(2),digit->ChargeADC(3),digit->ChargeADC(4),digit->ChargeADC(5),digit->ChargeADC(6),digit->ChargeADC(7),
+                         digit->ChargeADC(8),digit->ChargeADC(9),digit->ChargeADC(10),
+                         digit->ChargeADC(11),digit->ChargeADC(12),
+                         digit->ChargeADC(13),digit->ChargeADC(14),digit->ChargeADC(15),digit->ChargeADC(16),digit->ChargeADC(17),digit->ChargeADC(18),digit->ChargeADC(19),digit->ChargeADC(20),
+                         fCalibData->GetPedestal(pmNumber),fCalibData->GetSigma(pmNumber),
+                         fCalibData->GetPedestal(pmNumber+16),fCalibData->GetSigma(pmNumber+16),
+                         aBBflag[pmNumber],aBGflag[pmNumber]));
+           };
+
+       // Fill ESD friend object
+       for (Int_t iEv = 0; iEv < kNClocks; iEv++) {
+         fESDADfriend->SetPedestal(pmNumber,iEv,(Float_t)digit->ChargeADC(iEv));
+         fESDADfriend->SetIntegratorFlag(pmNumber,iEv,(iEv%2 == 0) ? integrator : !integrator);
+       }
+       fESDADfriend->SetTime(pmNumber,digit->Time());
+       fESDADfriend->SetWidth(pmNumber,digit->Width());
+
+    } // end of loop over digits
+  } // end of loop over events in digits tree
+         
+  //fESDAD->SetBit(AliESDAD::kCorrectedLeadingTime,kTRUE);
+  //fESDAD->SetMultiplicity(mult);
+  fESDAD->SetADC(adc);
+  fESDAD->SetTime(time);
+  fESDAD->SetWidth(width);
+  fESDAD->SetBit(AliESDAD::kOnlineBitsFilled,kTRUE);
+  fESDAD->SetBBFlag(aBBflag);
+  fESDAD->SetBGFlag(aBGflag);
+  //fESDAD->SetBit(AliESDAD::kCorrectedForSaturation,kTRUE);
+
+  /*/ now fill the V0 decision and channel flags
+  {
+    AliADTriggerMask triggerMask;
+    triggerMask.SetRecoParam(GetRecoParam());
+    triggerMask.FillMasks(fESDAD, fCalibData, fTimeSlewing);
+  }/*/
+
+  if (esd) { 
+     AliDebug(1, Form("Writing AD data to ESD tree"));
+     esd->SetADData(fESDAD);
+     AliESDfriend *fr = (AliESDfriend*)esd->FindListObject("AliESDfriend");
+     if (fr) {
+        AliDebug(1, Form("Writing AD friend data to ESD tree"));
+        //fr->SetADfriend(fESDADfriend);
     }
+  }
 
   fDigitsArray->Clear();
+
 }
 
 //_____________________________________________________________________________
@@ -178,15 +293,15 @@ AliADCalibData* AliADReconstructor::GetCalibData() const
 
   AliCDBEntry *entry=0;
 
-  //entry = man->Get("AD/Calib/Data");
-  //if(!entry){
-    //AliWarning("Load of calibration data from default storage failed!");
-    //AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
+  entry = man->Get("AD/Calib/Data");
+  if(!entry){
+    AliWarning("Load of calibration data from default storage failed!");
+    AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
        
     man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     man->SetRun(1);
     entry = man->Get("AD/Calib/Data");
-  //}
+  }
   // Retrieval of data in directory AD/Calib/Data:
 
   AliADCalibData *calibdata = 0;
@@ -197,4 +312,56 @@ AliADCalibData* AliADReconstructor::GetCalibData() const
   return calibdata;
 }
 
+//_____________________________________________________________________________
+AliCDBStorage* AliADReconstructor::SetStorage(const char *uri) 
+{
+// Sets the storage  
+
+  Bool_t deleteManager = kFALSE;
+  
+  AliCDBManager *manager = AliCDBManager::Instance();
+  AliCDBStorage *defstorage = manager->GetDefaultStorage();
+  
+  if(!defstorage || !(defstorage->Contains("AD"))){ 
+     AliWarning("No default storage set or default storage doesn't contain AD!");
+     manager->SetDefaultStorage(uri);
+     deleteManager = kTRUE;
+  }
+  AliCDBStorage *storage = manager->GetDefaultStorage();
+
+  if(deleteManager){
+     AliCDBManager::Instance()->UnsetDefaultStorage();
+     defstorage = 0;   // the storage is killed by AliCDBManager::Instance()->Destroy()
+  }
+
+  return storage; 
+}
+
+//____________________________________________________________________________
+void AliADReconstructor::GetCollisionMode()
+{
+  // Retrieval of collision mode 
+
+  TString beamType = GetRunInfo()->GetBeamType();
+  if(beamType==AliGRPObject::GetInvalidString()){
+     AliError("AD cannot retrieve beam type");
+     return;
+  }
+
+  if( (beamType.CompareTo("P-P") ==0)  || (beamType.CompareTo("p-p") ==0) ){
+    fCollisionMode=0;
+  }
+  else if( (beamType.CompareTo("Pb-Pb") ==0)  || (beamType.CompareTo("A-A") ==0) ){
+    fCollisionMode=1;
+  }
+    
+  fBeamEnergy = GetRunInfo()->GetBeamEnergy();
+  if(fBeamEnergy==AliGRPObject::GetInvalidFloat()) {
+     AliError("Missing value for the beam energy ! Using 0");
+     fBeamEnergy = 0.;
+  }
+  
+  AliDebug(1,Form("\n ++++++ Beam type and collision mode retrieved as %s %d @ %1.3f GeV ++++++\n\n",beamType.Data(), fCollisionMode, fBeamEnergy));
 
+}
index 14711b3..1856953 100644 (file)
 #include "AliReconstructor.h"
 #include "AliLog.h"
 #include "AliADConst.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
+#include "AliADRecoParam.h"
 
 class AliESDAD;
+class AliESDADfriend;
 class AliESDEvent;
 class AliADCalibData;
 
@@ -39,11 +44,23 @@ public:
   virtual Bool_t HasDigitConversion() const { return kTRUE; }
   virtual void ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const;
 
+  static const AliADRecoParam* GetRecoParam() { return dynamic_cast<const AliADRecoParam*>(AliReconstructor::GetRecoParam(14)); }
+
+  AliCDBStorage     *SetStorage(const char* uri);
+  void GetCollisionMode();
+
   AliADCalibData *GetCalibData() const; 
 
+  enum {kInvalidADC   =  -1024,
+        kInvalidTime  =  -1024};
+
+  AliESDAD*    GetESDAD() { return fESDAD; }
+
 protected:
 
-  AliESDAD*        fESDAD;      // AD ESD object  
+  AliESDAD*        fESDAD;       // AD ESD object 
+  AliESDEvent*     fESD;         // ESD object
+  AliESDADfriend*  fESDADfriend; // AD ESDfriend object  
 
 private:
   AliADReconstructor(const AliADReconstructor &reconstructor); //Not implemented
@@ -51,6 +68,9 @@ private:
   
   AliADCalibData* fCalibData;      //! calibration data
   mutable TClonesArray *fDigitsArray;  // clones-array for ConvertDigits() and FillESD()
+  
+  Int_t              fCollisionMode;  // =0->p-p, =1->A-A
+  Float_t            fBeamEnergy;     // beam energy
 
   ClassDef(AliADReconstructor, 1)  // class for the AD reconstruction
 };
index aedc470..1007fea 100644 (file)
@@ -171,7 +171,7 @@ Bool_t AliADDigitizer::Init()
   AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
   l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
 
-  AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
+  AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("AD/Calib/TimeDelays");
   if (!entry2) AliFatal("AD time delays are not found in OCDB !");
   TH1F *delays = (TH1F*)entry2->GetObject();
 
@@ -198,13 +198,9 @@ Bool_t AliADDigitizer::Init()
     fNBinsLT[i] = TMath::Nint(((Float_t)(fCalibData->GetMatchWindow(board)+1)*25.0)/
                              fCalibData->GetTimeResolution(board));
     fBinSize[i] = fCalibData->GetTimeResolution(board);
-    fHptdcOffset[i] = (((Float_t)fCalibData->GetRollOver(board)-
-                       (Float_t)fCalibData->GetTriggerCountOffset(board))*25.0+
-                      fCalibData->GetTimeOffset(i)-
-                      l1Delay-
-                      phase->GetMeanPhase()+
-                      delays->GetBinContent(i+1)+
-                      kADOffset);
+
+    fHptdcOffset[i] =  delays->GetBinContent(i+1);
+                      
     fClockOffset[i] = (((Float_t)fCalibData->GetRollOver(board)-
                        (Float_t)fCalibData->GetTriggerCountOffset(board))*25.0+
                       fCalibData->GetTimeOffset(i)-
@@ -311,6 +307,8 @@ void AliADDigitizer::DigitizeHits()
           Float_t dt_scintillator = gRandom->Gaus(0,kIntTimeRes);
           Float_t t = dt_scintillator + hit->GetTof();
           //t += fHptdcOffset[pmt];
+          
+          
           Int_t nPhE;
           Float_t prob = fCalibData->GetLightYields(pmt)*kPhotoCathodeEfficiency; // Optical losses included!
           if (nPhot > 100)
@@ -322,7 +320,9 @@ void AliADDigitizer::DigitizeHits()
           
           for (Int_t iPhE = 0; iPhE < nPhE; ++iPhE) {       
             Float_t tPhE = t + fSignalShape->GetRandom(0,fBinSize[pmt]*Float_t(fNBins[pmt]));
+            
             Float_t gainVar = fSinglePhESpectrum->GetRandom(0,20)/meansPhE;
+            
             Int_t firstBin = TMath::Max(0,(Int_t)((tPhE-kPMRespTime)/fBinSize[pmt]));
             Int_t lastBin = TMath::Min(fNBins[pmt]-1,(Int_t)((tPhE+2.*kPMRespTime)/fBinSize[pmt]));
             
@@ -567,20 +567,26 @@ void AliADDigitizer::ResetDigits()
 AliADCalibData* AliADDigitizer::GetCalibData() const
 
 {
-/*/
-  AliCDBManager *man = AliCDBManager::Instance();
+AliCDBManager *man = AliCDBManager::Instance();
 
   AliCDBEntry *entry=0;
 
   entry = man->Get("AD/Calib/Data");
+  if(!entry){
+    AliWarning("Load of calibration data from default storage failed!");
+    AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
+       
+    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+    man->SetRun(1);
+    entry = man->Get("AD/Calib/Data");
+  }
+  // Retrieval of data in directory AD/Calib/Data:
 
   AliADCalibData *calibdata = 0;
 
   if (entry) calibdata = (AliADCalibData*) entry->GetObject();
   if (!calibdata)  AliFatal("No calibration data from calibration database !");
-/*/
-  AliADCalibData *calibdata = new AliADCalibData();
-  
+
   return calibdata;
 
 }
diff --git a/AD/macros/MakeADCalibEntry.C b/AD/macros/MakeADCalibEntry.C
new file mode 100644 (file)
index 0000000..2a2babe
--- /dev/null
@@ -0,0 +1,22 @@
+void MakeADCalibEntry(Int_t run=1,const char *inputCDB = "raw://"){
+
+  AliCDBManager *man = AliCDBManager::Instance();
+
+  man->SetDefaultStorage(inputCDB);
+  man->SetRun(run);
+
+  AliADCalibData *calibda = new AliADCalibData();
+
+  // Creation of the object AD Calibration as a MetaData
+  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
+  md->SetResponsible("Michal Broz");
+  md->SetBeamPeriod(0);
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetComment("AD Calibration test");
+  AliCDBId id("AD/Calib/Data",0,AliCDBRunRange::Infinity());
+
+  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  AliCDBStorage *storLoc = man->GetDefaultStorage();
+  storLoc->Put(calibda, id, md);
+
+}
diff --git a/AD/macros/MakeADLightYieldsEntry.C b/AD/macros/MakeADLightYieldsEntry.C
new file mode 100644 (file)
index 0000000..e434695
--- /dev/null
@@ -0,0 +1,31 @@
+void MakeADLightYieldsEntry()
+{
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+
+  // Creation of the light yields OCDB object
+  const Double_t lightYieldCorr[66] = {0.0,
+                                      0.01051, 0.00955, 0.00861, 0.00948, 0.01082, 0.00870, 0.01023, 0.01012,
+                                      0.01270, 0.01184, 0.01110, 0.01266, 0.00956, 0.00826, 0.00966, 0.00891,
+                                      0.0};
+
+  TH1F *yields = new TH1F("ADLightYields","AD Light Yields",16,-0.5,15.5);
+  yields->SetContent(lightYieldCorr);
+       
+  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
+  md->SetResponsible("Michal Broz");
+  md->SetBeamPeriod(0);
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetComment("Light Yields channel by channel");
+  md->PrintMetaData();
+
+  AliCDBStorage *storLoc = man->GetDefaultStorage();
+  AliCDBId id("AD/Calib/LightYields",0,AliCDBRunRange::Infinity());
+
+  storLoc->Put(yields, id, md);
+
+  storLoc->Delete();
+  delete md;
+
+}
diff --git a/AD/macros/MakeADPMGainsEntry.C b/AD/macros/MakeADPMGainsEntry.C
new file mode 100644 (file)
index 0000000..42f114e
--- /dev/null
@@ -0,0 +1,34 @@
+void MakeADPMGainsEntry()
+{
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+
+  // Creation of the PM gains OCDB object
+  Double_t a[16] = {1012, 1203, 1021, 1083, 835, 1067, 1163, 1050,
+                   1033, 1026, 1121, 1135, 1050, 1312, 957, 1013};
+  Double_t b[16] = {7.32, 8.91, 6.05, 6.57, 5.34, 6.64, 8,25, 6.44,
+                   7.24, 6.77, 6.85, 7.67, 4.86, 7.38, 5.48 , 7.13};
+
+  TH2F *gains = new TH2F("ADPMGains","AD PM gain factors",16,-0.5,15.5,2,-0.5,1.5);
+  for(Int_t channel = 0; channel < 16; ++channel) {
+    gains->SetBinContent(channel+1,1,a[channel]);
+    gains->SetBinContent(channel+1,2,b[channel]);
+  }
+       
+  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
+  md->SetResponsible("Michal Broz");
+  md->SetBeamPeriod(0);
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetComment("PM gain factors channel by channel");
+  md->PrintMetaData();
+
+  AliCDBStorage *storLoc = man->GetDefaultStorage();
+  AliCDBId id("AD/Calib/PMGains",0,AliCDBRunRange::Infinity());
+
+  storLoc->Put(gains, id, md);
+
+  storLoc->Delete();
+  delete md;
+
+}
diff --git a/AD/macros/MakeADRecoParamEntry.C b/AD/macros/MakeADRecoParamEntry.C
new file mode 100644 (file)
index 0000000..a30c031
--- /dev/null
@@ -0,0 +1,69 @@
+void MakeADRecoParamEntry(AliRecoParam::EventSpecie_t default=AliRecoParam::kLowMult) {
+//========================================================================
+//
+// Steering macro for AD reconstruction parameters
+//
+// Author: Brigitte Cheynis
+//
+//========================================================================
+
+  const char* macroname = "MakeADRecoParam.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  cdb->SetRun(0);
+  
+  TObjArray *recoParamArray = new TObjArray();
+
+  {
+    AliADRecoParam * ADRecoParam = new AliADRecoParam;
+    ADRecoParam->SetEventSpecie(AliRecoParam::kCosmic);
+    recoParamArray->AddLast(ADRecoParam);
+  }
+  {
+    AliADRecoParam * ADRecoParam = new AliADRecoParam;
+    // the following two settings are needed to high lumi runs in 2011
+    ADRecoParam->SetStartClock(9);
+    ADRecoParam->SetEndClock(11);
+    ADRecoParam->SetNPreClocks(1);
+    ADRecoParam->SetNPostClocks(1);
+    ADRecoParam->SetEventSpecie(AliRecoParam::kLowMult);
+    recoParamArray->AddLast(ADRecoParam);
+  }
+  {
+    AliADRecoParam * ADRecoParam = new AliADRecoParam;
+    ADRecoParam->SetStartClock(9);
+    ADRecoParam->SetEndClock(11);
+    ADRecoParam->SetNPreClocks(6);
+    ADRecoParam->SetEventSpecie(AliRecoParam::kHighMult);
+    recoParamArray->AddLast(ADRecoParam);
+  }
+
+  // Set the default
+  Bool_t defaultIsSet = kFALSE;
+  for(Int_t i =0; i < recoParamArray->GetEntriesFast(); i++) {
+    AliDetectorRecoParam *param = (AliDetectorRecoParam *)recoParamArray->UncheckedAt(i);
+    if (!param) continue;
+    if (default & param->GetEventSpecie()) {
+      param->SetAsDefault();
+      defaultIsSet = kTRUE;
+    }
+  }
+
+  if (!defaultIsSet) {
+    Error(macroname,"The default reconstruction parameters are not set! Exiting...");
+    return;
+  }
+
+  // save in CDB storage
+  AliCDBMetaData *md= new AliCDBMetaData();
+  md->SetResponsible("Michal Broz");
+  md->SetComment("Reconstruction parameters for AD");
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetBeamPeriod(0);
+  AliCDBId id("AD/Calib/RecoParam",0,AliCDBRunRange::Infinity());
+  cdb->GetDefaultStorage()->Put(recoParamArray,id, md);
+
+  return;
+}
diff --git a/AD/macros/MakeADTimeDelaysEntry.C b/AD/macros/MakeADTimeDelaysEntry.C
new file mode 100644 (file)
index 0000000..3565301
--- /dev/null
@@ -0,0 +1,27 @@
+void MakeADTimeDelaysEntry()
+{
+
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+
+  // Creation of the time delays OCDB object
+  const Double_t timeShift[18] = {0.0 ,203.2, 203.4, 203.5, 203.0, 203.4, 203.5, 203.1, 203.2, 194.2, 194.4, 194.5, 194.2, 194.7, 194.5, 194.3, 192.8, 0.0};
+  TH1F *delays = new TH1F("ADTimeDelays","AD Time delays",16,-0.5,15.5);
+  delays->SetContent(timeShift);
+       
+  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
+  md->SetResponsible("Michal Broz");
+  md->SetBeamPeriod(0);
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetComment("Time delays channel by channel");
+  md->PrintMetaData();
+
+  AliCDBStorage *storLoc = man->GetDefaultStorage();
+  AliCDBId id("AD/Calib/TimeDelays",0,AliCDBRunRange::Infinity());
+
+  storLoc->Put(delays, id, md);
+
+  storLoc->Delete();
+  delete md;
+
+}