Updates in SDD DAs for AMORE monitoring: a TObjArray of TH1F objects is published...
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Jul 2009 14:53:48 +0000 (14:53 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Jul 2009 14:53:48 +0000 (14:53 +0000)
15 files changed:
ITS/AliITSDetTypeRec.cxx
ITS/AliITSDetTypeRec.h
ITS/AliITSOnlineSDDCMN.cxx
ITS/AliITSOnlineSDDCMN.h
ITS/AliITSOnlineSDDInjectors.cxx
ITS/AliITSOnlineSDDInjectors.h
ITS/AliITSOnlineSDDTP.cxx
ITS/AliITSOnlineSDDTP.h
ITS/AnalyzeSDDGainAllMod.C
ITS/AnalyzeSDDInjectorsAllMod.C
ITS/AnalyzeSDDNoiseAllMod.C
ITS/ITSSDDBASda.cxx
ITS/ITSSDDGAINda.cxx
ITS/ITSSDDINJda.cxx
ITS/PlotSDDRawData.C

index 7aea9bf..e6dcf0d 100644 (file)
@@ -36,7 +36,6 @@
 #include "AliITSRecPoint.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSMapSDD.h"
-#include "AliITSHLTforSDD.h"
 #include "AliITSCalibrationSSD.h"
 #include "AliITSNoiseSSDv2.h"
 #include "AliITSGainSSDv2.h"
@@ -82,7 +81,6 @@ fFOSignals(0),
 fDDLMapSDD(0),
 fRespSDD(0),
 fAveGainSDD(0),
-fIsHLTmodeC(0),
 fRecPoints(0),
 fNRecPoints(0),
 fFirstcall(kTRUE),
@@ -127,7 +125,6 @@ fFOSignals(rec.fFOSignals),
 fDDLMapSDD(rec.fDDLMapSDD),
 fRespSDD(rec.fRespSDD),
 fAveGainSDD(rec.fAveGainSDD),
-fIsHLTmodeC(rec.fIsHLTmodeC),
 fRecPoints(rec.fRecPoints),
 fNRecPoints(rec.fNRecPoints),
 fFirstcall(rec.fFirstcall),
@@ -499,11 +496,10 @@ Bool_t AliITSDetTypeRec::GetCalibrationSDD(Bool_t cacheStatus) {
   AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD");
   AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD");
   AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
-  AliCDBEntry *hltforSDD = AliCDBManager::Instance()->Get("ITS/Calib/HLTforSDD");
   //   AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD");
   AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD");
 
-  if(!entrySDD || !entry2SDD || !drSpSDD || !ddlMapSDD || !hltforSDD || !mapTSDD ){
+  if(!entrySDD || !entry2SDD || !drSpSDD || !ddlMapSDD || !mapTSDD ){
     AliFatal("SDD Calibration object retrieval failed! ");
     return kFALSE;
   }    
@@ -526,10 +522,6 @@ Bool_t AliITSDetTypeRec::GetCalibrationSDD(Bool_t cacheStatus) {
   if(!cacheStatus)ddlMapSDD->SetObject(NULL);
   ddlMapSDD->SetOwner(kTRUE);
 
-  AliITSHLTforSDD* hltsdd=(AliITSHLTforSDD*)hltforSDD->GetObject();
-  if(!cacheStatus)hltforSDD->SetObject(NULL);
-  hltforSDD->SetOwner(kTRUE);
-  
 //   TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
 //   if(!cacheStatus)mapASDD->SetObject(NULL);
 //   mapASDD->SetOwner(kTRUE);
@@ -544,13 +536,12 @@ Bool_t AliITSDetTypeRec::GetCalibrationSDD(Bool_t cacheStatus) {
     delete entrySDD;
     delete entry2SDD;
     //delete mapASDD;
-    delete hltforSDD;
     delete mapTSDD;
     delete drSpSDD;
     delete ddlMapSDD;
   }
 
-  if ((!pSDD)||(!calSDD) || (!drSp) || (!ddlsdd) || (!hltsdd) || (!mapT) ){
+  if ((!pSDD)||(!calSDD) || (!drSp) || (!ddlsdd) || (!mapT) ){
     AliWarning("Can not get SDD calibration from calibration database !");
     return kFALSE;
   }
@@ -559,7 +550,6 @@ Bool_t AliITSDetTypeRec::GetCalibrationSDD(Bool_t cacheStatus) {
 
   fDDLMapSDD=ddlsdd;
   fRespSDD=pSDD;
-  fIsHLTmodeC=hltsdd->IsHLTmodeC();
   AliITSCalibration* cal;
   Float_t avegain=0.;
   Float_t nGdAnodes=0;
index d7e0380..2f297bf 100644 (file)
@@ -61,8 +61,6 @@ class AliITSDetTypeRec : public TObject {
     virtual AliITSClusterFinder* GetReconstructionModel(Int_t dettype) const;
     virtual AliITSDDLModuleMapSDD* GetDDLModuleMapSDD() const { return fDDLMapSDD;}
     virtual AliITSresponseSDD* GetResponseSDD() const { return fRespSDD;}
-    virtual Bool_t IsHLTmodeC() const {return fIsHLTmodeC;}
-    virtual void SetHLTmodeC(Bool_t ishltc){fIsHLTmodeC=ishltc;}
     virtual Float_t GetAverageGainSDD() const {
       if(fAveGainSDD>0.) return fAveGainSDD;
       else return 1.;
@@ -135,7 +133,6 @@ class AliITSDetTypeRec : public TObject {
     AliITSDDLModuleMapSDD *fDDLMapSDD; //! mapping DDL/module -> SDD module number
     AliITSresponseSDD *fRespSDD;  //! SDD response parameters 
     Float_t       fAveGainSDD;    //! Average gain of SDD good anodes
-    Bool_t        fIsHLTmodeC;    //! flag for HLT mode C status (used by SDD)
     const Char_t*       fkDigClassName[3];     //! String with digit class name.
 
 
@@ -147,7 +144,7 @@ class AliITSDetTypeRec : public TObject {
 
     TBits fFastOrFiredMap;     //! Map of FastOr fired chips (after processing of raw signals)
 
-    ClassDef(AliITSDetTypeRec,18) // ITS Reconstruction structure
+    ClassDef(AliITSDetTypeRec,19) // ITS Reconstruction structure
 };
 
 #endif
index ac14eaa..cb24f9e 100644 (file)
@@ -183,7 +183,7 @@ void AliITSOnlineSDDCMN::WriteToASCII(){
 TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hbd%02dc%02ds%d",fDDL,fCarlos,fSide);
+  sprintf(hisnam,"hbase%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->SetBinContent(ian+1,GetAnodeBaseline(ian));
@@ -194,7 +194,7 @@ TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hnd%02dc%02ds%d",fDDL,fCarlos,fSide);
+  sprintf(hisnam,"hnois%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->SetBinContent(ian+1,GetAnodeRawNoise(ian));
@@ -205,7 +205,7 @@ TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hcd%02dc%02ds%d",fDDL,fCarlos,fSide);
+  sprintf(hisnam,"hcorn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->SetBinContent(ian+1,GetAnodeCorrNoise(ian));
@@ -213,6 +213,28 @@ TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
   return h;
 }
 //______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetCMNCoefAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hcmn%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeCommonMode(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDCMN::GetStatusAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hgood%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,float(IsAnodeGood(ian)));
+  }
+  return h;
+}
+//______________________________________________________________________
 TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const {
   //
   Char_t hisnam[20];  
index d6de843..23b1fe2 100644 (file)
@@ -45,6 +45,8 @@ class AliITSOnlineSDDCMN : public AliITSOnlineSDD {
   TH1F* GetBaselineAnodeHisto() const;
   TH1F* GetRawNoiseAnodeHisto() const;
   TH1F* GetCorrNoiseAnodeHisto() const;
+  TH1F* GetCMNCoefAnodeHisto() const;
+  TH1F* GetStatusAnodeHisto() const;
   TH1F* GetBaselineHisto() const;
   TH1F* GetRawNoiseHisto() const;
   TH1F* GetCorrNoiseHisto() const;
index 4e8bae9..30a33c4 100644 (file)
@@ -528,6 +528,22 @@ void AliITSOnlineSDDInjectors::WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_
   fclose(outf);  
 }
 //______________________________________________________________________
+TH1F* AliITSOnlineSDDInjectors::GetMeanDriftSpeedVsPadHisto() const{
+  Char_t hisnam[20];
+  sprintf(hisnam,"hdrsp%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",kInjPads,-0.5,kInjPads-0.5);
+  if(fNEvents>0){
+    for(Int_t i=0;i<kInjPads;i++){ 
+      h->SetBinContent(i+1,GetMeanDriftSpeed(i));    
+      Double_t rms=GetRMSDriftSpeed(i);
+      Double_t err=0.;
+      if(rms>0.) err=rms/TMath::Sqrt(fNEvents);
+      h->SetBinError(i+1,err);
+    }
+  }
+  return h;
+}
+//______________________________________________________________________
 Bool_t AliITSOnlineSDDInjectors::WriteToROOT(TFile *fil) const {
   //
   if(fil==0){ 
index 2ff66f1..f8fba99 100644 (file)
@@ -14,6 +14,7 @@
 #include "AliITSOnlineSDD.h"
 
 
+class TH1F;
 class TH2F;
 class TGraphErrors;
 class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
@@ -64,6 +65,7 @@ class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
   void SetUseTimeZeroSignal(Bool_t useTZ=kTRUE){
     fUseTimeZeroSignal=useTZ;
   }
+  TH1F* GetMeanDriftSpeedVsPadHisto() const;
   TGraphErrors* GetTimeVsDistGraph(Int_t jpad) const;
   TGraphErrors* GetDriftSpeedGraph() const;
   TGraphErrors* GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const;
index b025311..a4efc27 100644 (file)
@@ -184,6 +184,72 @@ void AliITSOnlineSDDTP::WriteToASCII(){
   fclose(outf);  
 }
 //______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetBaselineAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hbase%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeBaseline(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetRawNoiseAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hnois%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeRawNoise(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetCorrNoiseAnodeHisto() const {
+  //
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hcorn%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeCorrNoise(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetCMNCoefAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hcmn%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetAnodeCommonMode(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetStatusAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hgood%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,float(IsAnodeGood(ian)));
+  }
+  return h;
+}
+//______________________________________________________________________
+TH1F* AliITSOnlineSDDTP::GetGainAnodeHisto() const {
+//
+  Char_t hisnam[20];  
+  sprintf(hisnam,"hgain%02dc%02ds%d",fDDL,fCarlos,fSide);
+  TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
+  for(Int_t ian=0;ian<fgkNAnodes;ian++){
+    h->SetBinContent(ian+1,GetChannelGain(ian));
+  }
+  return h;
+}
+//______________________________________________________________________
 Bool_t AliITSOnlineSDDTP::WriteToROOT(TFile *fil){
   //
   if(fil==0){ 
index 7778c37..2f42992 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "AliITSOnlineSDD.h"
 
+class TH1F;
 class TH2F;
 class AliITSOnlineSDDTP : public AliITSOnlineSDD {
 
@@ -46,6 +47,13 @@ class AliITSOnlineSDDTP : public AliITSOnlineSDD {
   void WriteToASCII();
   Bool_t WriteToROOT(TFile *fil);
 
+  TH1F* GetBaselineAnodeHisto() const;
+  TH1F* GetRawNoiseAnodeHisto() const;
+  TH1F* GetCorrNoiseAnodeHisto() const;
+  TH1F* GetCMNCoefAnodeHisto() const;
+  TH1F* GetGainAnodeHisto() const;
+  TH1F* GetStatusAnodeHisto() const;
+
  protected:
 
  private:
index 0b2be12..f6f8a6a 100644 (file)
 void AnalyzeSDDGainAllMod(Char_t *datafil, 
                          Int_t adcfreq=20, 
                          Int_t nDDL=0, 
-                         Int_t firstEv=10, 
-                         Int_t lastEv=16, 
-                         Float_t pascalDAC=100, 
-                         Int_t dataformat=1){
+                         Int_t firstEv=18, 
+                         Int_t lastEv=22, 
+                         Float_t pascalDAC=100){
 
   const Int_t kTotDDL=24;
   const Int_t kModPerDDL=12;
   const Int_t kSides=2;
+  Bool_t writtenoutput=kFALSE;
 
 
   TH2F** histo = new TH2F*[kTotDDL*kModPerDDL*kSides];
@@ -85,12 +85,13 @@ void AnalyzeSDDGainAllMod(Char_t *datafil,
        }
       }
     }
-    AliITSRawStream* s;
-    if(dataformat==0){
-      s=new AliITSRawStreamSDD(rd);
-    }else{
-      s=new AliITSRawStreamSDDCompressed(rd);
-      if(dataformat==1) s->SetADCEncoded(kTRUE);
+
+    UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd);
+    UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
+    AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr);
+    if(!writtenoutput){
+      printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
+      writtenoutput=kTRUE;
     }
     while(s->Next()){
       Int_t iDDL=rd->GetDDLID();
@@ -238,17 +239,17 @@ void AnalyzeSDDGainAllMod(Char_t *datafil,
 
 }
 
-void AnalyzeSDDGainAllMod(Int_t nrun, Int_t n2, Char_t* dir="LHC08d_SDD",
+void AnalyzeSDDGainAllMod(Int_t nrun, Int_t n2, Int_t year=2009, Char_t* dir="LHC09b_SDD",
                          Int_t adcfreq=20, 
                          Int_t nDDL=0, 
-                         Int_t firstEv=15, 
-                         Int_t lastEv=20, 
-                         Float_t pascalDAC=100, 
-                         Int_t dataformat=1){
+                         Int_t firstEv=18, 
+                         Int_t lastEv=22, 
+                         Float_t pascalDAC=100){
+
 
   TGrid::Connect("alien:",0,0,"t");
   Char_t filnam[200];
-  sprintf(filnam,"alien:///alice/data/2008/%s/%09d/raw/08%09d%03d.10.root",dir,nrun,nrun,n2);
+  sprintf(filnam,"alien:///alice/data/%d/%s/%09d/raw/%02d%09d%03d.10.root",year,dir,nrun,year-2000,nrun,n2);
   printf("Open file %s\n",filnam);
-  AnalyzeSDDGainAllMod(filnam,adcfreq,nDDL,firstEv,lastEv,pascalDAC,dataformat);
+  AnalyzeSDDGainAllMod(filnam,adcfreq,nDDL,firstEv,lastEv,pascalDAC);
 }
index ef87116..386b5cf 100644 (file)
 void AnalyzeSDDInjectorsAllMod(Char_t *datafil, 
                               Int_t adcfreq=20, 
                               Int_t nDDL=0, 
-                              Int_t firstEv=10, 
-                              Int_t lastEv=15,
+                              Int_t firstEv=18, 
+                              Int_t lastEv=20,
                               Int_t jpad=20, 
-                              Int_t statuscut=7, 
-                              Int_t dataformat=1){
+                              Int_t statuscut=7){
+
 
   const Int_t kTotDDL=24;
   const Int_t kModPerDDL=12;
   const Int_t kSides=2;
+  Bool_t writtenoutput=kFALSE;
 
   AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD();
   dmap->SetJun08Map();
@@ -83,6 +84,7 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
   gStyle->SetPalette(1);
   TCanvas* c1 = new TCanvas("c1","Drift Speed vs. anode",900,900);
   Char_t text[50];
+  UInt_t timeSt=0;
 
   Int_t iev=firstEv;
   AliRawReader *rd; 
@@ -105,7 +107,7 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
     c1->Clear();
     c1->Divide(4,6,0.001,0.001);
     printf("Event # %d\n",iev);
-    UInt_t timeSt=rd->GetTimestamp();
+    timeSt=rd->GetTimestamp();
     rd->Reset();
     for(Int_t iddl=0; iddl<kTotDDL;iddl++){
       for(Int_t imod=0; imod<kModPerDDL;imod++){
@@ -116,12 +118,13 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
       }
     }
 
-    AliITSRawStream* s;
-    if(dataformat==0){
-      s=new AliITSRawStreamSDD(rd);
-    }else{
-      s=new AliITSRawStreamSDDCompressed(rd);
-      if(dataformat==1) s->SetADCEncoded(kTRUE);
+
+    UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd);
+    UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
+    AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr);
+    if(!writtenoutput){
+      printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
+      writtenoutput=kTRUE;
     }
     while(s->Next()){
       Int_t iDDL=rd->GetDDLID();
@@ -139,7 +142,6 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
        for(Int_t isid=0;isid<kSides;isid++){
          Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
          anal[index]->AnalyzeEvent(histo[index]); 
-         anal[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
          nWrittenEv[index]++;
          Int_t iMod=dmap->GetModuleNumber(iddl,imod);
          if(iMod!=-1){
@@ -209,6 +211,8 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
     for(Int_t imod=0; imod<kModPerDDL;imod++){
       for(Int_t isid=0;isid<kSides;isid++){
        Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       anal[index]->FitMeanDriftSpeedVsAnode();
+       anal[index]->WriteToASCII(0,timeSt,0);
        anal[index]->WriteToROOT(outfil1);
       }
     }
@@ -336,20 +340,19 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
 
 }
 
-void AnalyzeSDDInjectorsAllMod(Int_t nrun, Int_t n2, Char_t* dir="LHC08d_SDD", 
+void AnalyzeSDDInjectorsAllMod(Int_t nrun, Int_t n2, Int_t year=2009, Char_t* dir="LHC09b_SDD",
                               Int_t adcfreq=20, 
                               Int_t nDDL=0, 
-                              Int_t firstEv=15, 
-                              Int_t lastEv=15,
+                              Int_t firstEv=18, 
+                              Int_t lastEv=20,
                               Int_t jpad=20, 
-                              Int_t statuscut=7, 
-                              Int_t dataformat=1){
+                              Int_t statuscut=7){
 
   TGrid::Connect("alien:",0,0,"t");
   Char_t filnam[200];
-  sprintf(filnam,"alien:///alice/data/2008/%s/%09d/raw/08%09d%03d.10.root",dir,nrun,nrun,n2);
+  sprintf(filnam,"alien:///alice/data/%d/%s/%09d/raw/%02d%09d%03d.10.root",year,dir,nrun,year-2000,nrun,n2);
   printf("Open file %s\n",filnam);
-  AnalyzeSDDInjectorsAllMod(filnam,adcfreq,nDDL,firstEv,lastEv,jpad,statuscut,dataformat);
+  AnalyzeSDDInjectorsAllMod(filnam,adcfreq,nDDL,firstEv,lastEv,jpad,statuscut);
 }
 
 
index 2fe4397..32e09ff 100644 (file)
 void AnalyzeSDDNoiseAllMod(Char_t *datafil, 
                           Int_t adcfreq=20, 
                           Int_t nDDL=0, 
-                          Int_t firstEv=10, 
-                          Int_t lastEv=12, 
-                          Int_t dataformat=1){
+                          Int_t firstEv=18, 
+                          Int_t lastEv=20){ 
 
 
   const Int_t kTotDDL=24;
   const Int_t kModPerDDL=12;
   const Int_t kSides=2;
+  Bool_t writtenoutput=kFALSE;
 
   AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[kTotDDL*kModPerDDL*kSides];
   TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
@@ -83,13 +83,15 @@ void AnalyzeSDDNoiseAllMod(Char_t *datafil,
        }
       }
     }
-    AliITSRawStream* s;
-    if(dataformat==0){
-      s=new AliITSRawStreamSDD(rd);
-    }else{
-      s=new AliITSRawStreamSDDCompressed(rd);
-      if(dataformat==1) s->SetADCEncoded(kTRUE);
+
+    UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd);
+    UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
+    AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr);
+    if(!writtenoutput){
+      printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
+      writtenoutput=kTRUE;
     }
+
     while(s->Next()){
       Int_t iDDL=rd->GetDDLID();
       Int_t iCarlos=s->GetCarlosId();
@@ -171,12 +173,12 @@ void AnalyzeSDDNoiseAllMod(Char_t *datafil,
       }
     }
     
-    AliITSRawStream* s;
-    if(dataformat==0){
-      s=new AliITSRawStreamSDD(rd2);
-    }else{
-      s=new AliITSRawStreamSDDCompressed(rd2);
-      if(dataformat==1) s->SetADCEncoded(kTRUE);
+    UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd2);
+    UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
+    AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd2,cdhAttr);
+    if(!writtenoutput){
+      printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
+      writtenoutput=kTRUE;
     }
     while(s->Next()){
       Int_t iDDL=rd2->GetDDLID();
@@ -394,16 +396,15 @@ void AnalyzeSDDNoiseAllMod(Char_t *datafil,
 
 }
 
-void AnalyzeSDDNoiseAllMod(Int_t nrun, Int_t n2, Char_t* dir="LHC08d_SDD",
+void AnalyzeSDDNoiseAllMod(Int_t nrun, Int_t n2, Int_t year=2009, Char_t* dir="LHC09b_SDD",
                           Int_t adcfreq=20, 
                           Int_t nDDL=0, 
-                          Int_t firstEv=15, 
-                          Int_t lastEv=18, 
-                          Int_t dataformat=1){
+                          Int_t firstEv=18, 
+                          Int_t lastEv=20){
 
   TGrid::Connect("alien:",0,0,"t");
   Char_t filnam[200];
-  sprintf(filnam,"alien:///alice/data/2008/%s/%09d/raw/08%09d%03d.10.root",dir,nrun,nrun,n2);
+  sprintf(filnam,"alien:///alice/data/%d/%s/%09d/raw/%02d%09d%03d.10.root",year,dir,nrun,year-2000,nrun,n2);
   printf("Open file %s\n",filnam);
-  AnalyzeSDDNoiseAllMod(filnam,adcfreq,nDDL,firstEv,lastEv,dataformat);
+  AnalyzeSDDNoiseAllMod(filnam,adcfreq,nDDL,firstEv,lastEv);
 }
index 1107b57..0875fd5 100644 (file)
@@ -3,7 +3,7 @@
 - Link: - http://www.to.infn.it/~prino/alice/RawData/run11161.date
 - Run Type: - PEDESTAL_RUN
 - DA Type: - LDC
-- Number of events needed: 100
+- Number of events needed: > 10
 - Input Files: - 
 - Output Files: - SDDbase_step1_ddl*c*_sid*.data SDDbase_step2_ddl*c*_sid*.data
 - Trigger types used: 
@@ -45,6 +45,9 @@ extern "C" {
 #include <TH2F.h>
 #include <TROOT.h>
 #include <TPluginManager.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TDatime.h>
 
 // AliRoot includes
 #include "AliRawReaderDate.h"
@@ -52,6 +55,11 @@ extern "C" {
 #include "AliITSOnlineSDDCMN.h"
 #include "AliITSRawStreamSDD.h"
 #include "AliITSRawStreamSDDCompressed.h"
+
+#ifdef ALI_AMORE
+#include <AmoreDA.h>
+#endif
+
 /* Main routine
       Arguments: list of DATE raw data files
 */
@@ -253,15 +261,21 @@ int main(int argc, char **argv) {
   }
 
   /* write report */
-  printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),ievPed);
+  TDatime time;
+  TObjString timeinfo(Form("%02d%02d%02d%02d%02d%02d",time.GetYear()-2000,time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()));
+  printf("Run #%s, received %d calibration events, time %s\n",getenv("DATE_RUN_NUMBER"),ievPed,timeinfo.GetString().Data());
 
   /* report progress */
   daqDA_progressReport(90);
 
+  TObjArray* basHistos=new TObjArray();
+  TObjArray* noiseHistos=new TObjArray();
+  TObjArray* cmnHistos=new TObjArray();
+  TObjArray* corrnHistos=new TObjArray();
+  TObjArray* statusHistos=new TObjArray();
 
 
   Char_t filnam[100],command[150];
-  TFile *fh=new TFile("SDDbaseHistos.root","RECREATE");
   for(Int_t iddl=0; iddl<kTotDDL;iddl++){
     for(Int_t imod=0; imod<kModPerDDL;imod++){
       for(Int_t isid=0;isid<kSides;isid++){
@@ -269,7 +283,11 @@ int main(int argc, char **argv) {
        corr[index]->ValidateAnodes();
        corr[index]->WriteToASCII();
        if(isFilled[index]){
-         corr[index]->WriteToROOT(fh);
+         basHistos->AddLast(corr[index]->GetBaselineAnodeHisto());
+         noiseHistos->AddLast(corr[index]->GetRawNoiseAnodeHisto());
+         cmnHistos->AddLast(corr[index]->GetCMNCoefAnodeHisto());
+         corrnHistos->AddLast(corr[index]->GetCorrNoiseAnodeHisto());
+         statusHistos->AddLast(corr[index]->GetStatusAnodeHisto());
          sprintf(filnam,"SDDbase_step2_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
          sprintf(command,"tar -rf SDDbase_step2_LDC.tar %s",filnam);
          gSystem->Exec(command);
@@ -277,8 +295,32 @@ int main(int argc, char **argv) {
       }
     }
   }
-  fh->Close();
 
+#ifdef ALI_AMORE
+  amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+  Int_t status =0;
+  status += amoreDA.Send("TimeInfo",&timeinfo);
+  status += amoreDA.Send("Baselines",basHistos);
+  status += amoreDA.Send("RawNoise",noiseHistos);
+  status += amoreDA.Send("CommonMode",cmnHistos);
+  status += amoreDA.Send("CorrectedNoise",corrnHistos);
+  status += amoreDA.Send("NoisyChannels",statusHistos);
+  if ( status )
+    printf("Warning: Failed to write Arrays in the AMORE database\n");
+  else 
+    printf("amoreDA.Send() OK\n");
+#else
+  printf("Warning: SDDBAS DA not compiled with AMORE support\n");
+#endif
+    
+    
+  TFile *fh=new TFile("SDDbaseHistos.root","RECREATE");
+  basHistos->Write();
+  noiseHistos->Write();
+  cmnHistos->Write();
+  corrnHistos->Write();
+  statusHistos->Write();
+  fh->Close();
 
   /* report progress */
   daqDA_progressReport(100);
index 428af61..9f40a3d 100644 (file)
@@ -3,7 +3,7 @@
 - Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date
 - Run Type: - PULSER_RUN
 - DA Type: - LDC
-- Number of events needed: 100
+- Number of events needed: >15
 - Input Files: - SDDbase_step1_ddl*c*_sid*.data
 - Output Files: - SDDbase_ddl*c*_sid*.data
 - Trigger types used: 
@@ -44,12 +44,19 @@ extern "C" {
 #include <TSystem.h>
 #include <TROOT.h>
 #include <TPluginManager.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TDatime.h>
 
 // AliRoot includes
 #include "AliRawReaderDate.h"
 #include "AliITSOnlineSDDTP.h"
 #include "AliITSRawStreamSDD.h"
 #include "AliITSRawStreamSDDCompressed.h"
+
+#ifdef ALI_AMORE
+#include <AmoreDA.h>
+#endif
 /* Main routine
       Arguments: list of DATE raw data files
 */
@@ -210,7 +217,17 @@ int main(int argc, char **argv) {
     
   }
     
-  TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
+  /* write report */
+  TDatime time;
+  TObjString timeinfo(Form("%02d%02d%02d%02d%02d%02d",time.GetYear()-2000,time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()));
+  printf("Run #%s, received %d calibration events, time %s\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv,timeinfo.GetString().Data());
+
+  /* report progress */
+  daqDA_progressReport(90);
+
+  TObjArray* gainHistos=new TObjArray();
+  TObjArray* statusHistos=new TObjArray();
+  
   Char_t filnam[100],command[120];
   for(Int_t iddl=0; iddl<kTotDDL;iddl++){
     for(Int_t imod=0; imod<kModPerDDL;imod++){
@@ -219,7 +236,8 @@ int main(int argc, char **argv) {
        if(isFilled[index]){
          tpan[index]->ValidateAnodes();
          tpan[index]->WriteToASCII();
-         tpan[index]->WriteToROOT(fh);
+         gainHistos->AddLast(tpan[index]->GetGainAnodeHisto());
+         statusHistos->AddLast(tpan[index]->GetStatusAnodeHisto());
          sprintf(filnam,"SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
          sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
          gSystem->Exec(command);
@@ -227,29 +245,37 @@ int main(int argc, char **argv) {
       }
     }  
   }
-  fh->Close();
+
 
   FILE *conffil=fopen("fee.conf","w");
   fprintf(conffil,"%d\n",amSamplFreq);
   fprintf(conffil,"%02X\n",cdhAttr);
   fclose(conffil);
   gSystem->Exec("tar -rf SDDbase_LDC.tar fee.conf");
+  status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
 
 
-  /* write report */
-  printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv);
-
-  /* report progress */
-  daqDA_progressReport(90);
-
-
-
+#ifdef ALI_AMORE
+  amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+  Int_t status =0;
+  status += amoreDA.Send("TimeInfo",&timeinfo);
+  status += amoreDA.Send("Gain",gainHistos);
+  status += amoreDA.Send("BadChannels",corrnHistos);
+  if ( status )
+    printf("Warning: Failed to write Arrays in the AMORE database\n");
+  else 
+    printf("amoreDA.Send() OK\n");
+#else
+  printf("Warning: SDDGAIN DA not compiled with AMORE support\n");
+#endif
+    
+  TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
+  gainHistos->Write();
+  statusHistos->Write();
   fh->Close();
 
 
-
-  status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
-
   /* report progress */
   daqDA_progressReport(100);
 
index eb2f9ed..1a3cabb 100644 (file)
@@ -1,9 +1,9 @@
 /*
 - Contact: - prino@to.infn.it
 - Link: -
-- Run Type: - PHYSICS
+- Run Type: - INJECTOR
 - DA Type: - LDC
-- Number of events needed: 
+- Number of events needed: >20
 - Input Files: - 
 - Output Files: - SDDinj_ddl*c*_sid*.data
 - Trigger types used: 
@@ -42,6 +42,9 @@ extern "C" {
 #include <TSystem.h>
 #include <TROOT.h>
 #include <TPluginManager.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TDatime.h>
 
 
 // AliRoot includes
@@ -49,6 +52,11 @@ extern "C" {
 #include "AliITSOnlineSDDInjectors.h"
 #include "AliITSRawStreamSDD.h"
 #include "AliITSRawStreamSDDCompressed.h"
+
+#ifdef ALI_AMORE
+#include <AmoreDA.h>
+#endif
+
 /* Main routine
       Arguments: list of DATE raw data files
 */
@@ -75,7 +83,7 @@ int main(int argc, char **argv) {
   }
 
 
-  Int_t maxNEvents=10; // maximum number of events to be analyzed
+  Int_t maxNEvents=20; // maximum number of events to be analyzed
   const Int_t kTotDDL=24;
   const Int_t kModPerDDL=12;
   const Int_t kSides=2;
@@ -91,7 +99,7 @@ int main(int argc, char **argv) {
   Int_t nWrittenEv[kTotDDL*kModPerDDL*kSides];
   Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
   Bool_t writtenoutput=kFALSE;
-
+  UInt_t timeSt=0;
   Char_t hisnam[20];
   for(Int_t iddl=0; iddl<kTotDDL;iddl++){
     for(Int_t imod=0; imod<kModPerDDL;imod++){
@@ -165,7 +173,7 @@ int main(int argc, char **argv) {
        printf(" event number = %i \n",iev);
        ievInj++; 
        AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-       UInt_t timeSt=rawReader->GetTimestamp();
+       timeSt=rawReader->GetTimestamp();
        rawReader->Reset();
        UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rawReader);
        amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
@@ -204,9 +212,8 @@ int main(int argc, char **argv) {
              if(isFilled[index]){
                if(amSamplFreq==20) injan[index]->Set20MHzConfig();
                else injan[index]->Set40MHzConfig();
-               injan[index]->Reset();
-               injan[index]->AnalyzeEvent(histo[index]);    
-               injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
+               injan[index]->AddEvent(histo[index]);    
+               //              injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
                nWrittenEv[index]++;
              }
            }
@@ -220,16 +227,24 @@ int main(int argc, char **argv) {
   }
 
   /* write report */
-  printf("Run #%s, received %d injector events\n",getenv("DATE_RUN_NUMBER"),ievInj);
+  TDatime time;
+  TObjString timeinfo(Form("%02d%02d%02d%02d%02d%02d",time.GetYear()-2000,time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()));
+  printf("Run #%s, received %d calibration events, time %s\n",getenv("DATE_RUN_NUMBER"),ievInj,timeinfo.GetString().Data());
+
+  /* report progress */
+  daqDA_progressReport(90);
+  TObjArray* dspHistos=new TObjArray();
 
+  
   Char_t filnam[100],command[120];
-  TFile *fh=new TFile("SDDinjectHistos.root","RECREATE");
   for(Int_t iddl=0; iddl<kTotDDL;iddl++){
     for(Int_t imod=0; imod<kModPerDDL;imod++){
       for(Int_t isid=0;isid<kSides;isid++){
        Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
        if(nWrittenEv[index]>0){
-         injan[index]->WriteToROOT(fh);
+         injan[index]->FitMeanDriftSpeedVsAnode();
+         injan[index]->WriteToASCII(0,timeSt,0);
+         dspHistos->AddLast(injan[index]->GetMeanDriftSpeedVsPadHisto());
          sprintf(filnam,"SDDinj_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
          sprintf(command,"tar -rf SDDinj_LDC.tar %s",filnam);
          gSystem->Exec(command);
@@ -237,13 +252,26 @@ int main(int argc, char **argv) {
       }  
     }
   }
-  fh->Close();
+  status=daqDA_FES_storeFile("./SDDinj_LDC.tar","SDD_Injec");
 
-  /* report progress */
-  daqDA_progressReport(90);
 
+#ifdef ALI_AMORE
+  amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+  Int_t status =0;
+  status += amoreDA.Send("TimeInfo",&timeinfo);
+  status += amoreDA.Send("DriftSpeed",dspHistos);
+  if ( status )
+    printf("Warning: Failed to write Arrays in the AMORE database\n");
+  else 
+    printf("amoreDA.Send() OK\n");
+#else
+  printf("Warning: SDDINJ DA not compiled with AMORE support\n");
+#endif
+
+  TFile *fh=new TFile("SDDinjectHistos.root","RECREATE");
+  dspHistos->Write();
+  fh->Close();
 
-  status=daqDA_FES_storeFile("./SDDinj_LDC.tar","SDD_Injec");
 
   /* report progress */
   daqDA_progressReport(100);
index 642045a..a7907d3 100644 (file)
@@ -1,20 +1,22 @@
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include <TH2F.h>
+#include <TGrid.h>
 #include <TCanvas.h>
 #include <TStopwatch.h>
 #include <TStyle.h>
 #include "AliRawReaderDate.h"
 #include "AliRawReaderRoot.h"
 #include "AliITSRawStreamSDD.h"
+#include "AliITSRawStreamSDDCompressed.h"
 #endif
 
 // Macro to display the SDD Raw Data for 1 DDL
 // Origin: F. Prino,   prino@to.infn.it
 
-void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=0, Int_t lastEv=5){
+void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=18, Int_t lastEv=20){
 
   const Int_t nHybrids=24;
-
+  Bool_t writtenoutput=kFALSE;
   TH2F** histo = new TH2F*[nHybrids];
   Char_t nome[20];
   for(Int_t i=0;i<nHybrids;i++){
@@ -33,7 +35,7 @@ void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=0, Int_t last
   TStopwatch *evtime=new TStopwatch();
   TCanvas* c0 = new TCanvas("cd0","c0",900,900);
   gStyle->SetPalette(1);
-  Int_t idev;
+
   do{
     c0->Clear();                               
     c0->Divide(4,6,0.001,0.001);
@@ -42,18 +44,24 @@ void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=0, Int_t last
     printf("Event # %d\n",iev);
     rd->Reset();
     for(Int_t i=0;i<nHybrids;i++) histo[i]->Reset();
-    AliITSRawStreamSDD s(rd);
+    UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd);
+    UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
+    AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr);
+    if(!writtenoutput){
+      printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
+      writtenoutput=kTRUE;
+    }
+
     Int_t iCountNext=0;    
-    while(s.Next()){
+    while(s->Next()){
       iCountNext++;
-      if(s.IsCompletedModule()==kFALSE && s.IsCompletedDDL()==kFALSE){
-       Int_t i=s.GetCarlosId()*2+s.GetChannel();
-       if(rd->GetDDLID()==nDDL) histo[i]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
+      if(s->IsCompletedModule()==kFALSE && s->IsCompletedDDL()==kFALSE){
+       Int_t i=s->GetCarlosId()*2+s->GetChannel();
+       if(rd->GetDDLID()==nDDL) histo[i]->Fill(s->GetCoord2(),s->GetCoord1(),s->GetSignal());
       }
     }
-    idev=s.GetEventId();
     evtime->Stop();
-    printf("**** Event=%d  ID=%d\n",iev,idev);
+    printf("**** Event=%d  \n",iev);
     evtime->Print("u");
     evtime->Reset();
     iev++;
@@ -67,3 +75,15 @@ void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=0, Int_t last
 
 }
 
+void PlotSDDRawData(Int_t nrun, Int_t n2, Int_t year=2009, Char_t* dir="LHC09b_SDD",
+                   Int_t nDDL=0, 
+                   Int_t firstEv=18, 
+                   Int_t lastEv=20){
+
+  TGrid::Connect("alien:",0,0,"t");
+  Char_t filnam[200];
+  sprintf(filnam,"alien:///alice/data/%d/%s/%09d/raw/%02d%09d%03d.10.root",year,dir,nrun,year-2000,nrun,n2);
+  printf("Open file %s\n",filnam);
+  PlotSDDRawData(filnam,nDDL,firstEv,lastEv);
+}
+