DCS DP with correct getters
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Mar 2010 08:31:51 +0000 (08:31 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Mar 2010 08:31:51 +0000 (08:31 +0000)
T0/AliT0DataDCS.cxx
T0/AliT0DataDCS.h
T0/TestPreprocessor.C

index 9d9ca05..4ee0c19 100644 (file)
@@ -66,8 +66,8 @@ AliT0DataDCS::AliT0DataDCS():
 {
   for(Int_t i=0;i<kScalers;i++) 
   {
-    fScalerMean[i]=0.;
-    fScalerSecMean[i]=0.;
+    fScalerMean[i]=0;
+    fScalerSecMean[i]=0;
   }
   for(Int_t i=0;i<kHV;i++)
   {
@@ -113,8 +113,8 @@ AliT0DataDCS::AliT0DataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, UInt_t
 {
   for(Int_t i=0;i<kScalers;i++)
   {
-    fScalerMean[i]=0.;
-    fScalerSecMean[i]=0.;
+    fScalerMean[i]=0;
+    fScalerSecMean[i]=0;
   }
   for(Int_t i=0;i<kHV;i++)
   {
@@ -245,8 +245,8 @@ AliT0DataDCS::~AliT0DataDCS()
 //---------------------------------------------------------------
 Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
 {
-               Int_t t0_scaler[kScalers];
-               Int_t t0_scaler_sec[kScalers];
+               UInt_t t0_scaler[kScalers];
+               UInt_t t0_scaler_sec[kScalers];
                Int_t aliasEntr[kNAliases];
                Float_t t0_a_hv_imon[kHV];
                Float_t t0_a_hv_vmon[kHV];
@@ -308,7 +308,7 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                    t0_ac_drm[k]=0.;
                 }
 
-// here starts the main loop
+            // here starts the main loop
                for(Int_t j=0; j<kNAliases; j++)
                {
                  aliasEntr[j]=0;
@@ -319,6 +319,7 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                    
                  }
                  aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
+
                   if(!aliasArr)
                   {
                         AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
@@ -337,9 +338,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                    for(Int_t l=0; l<aliasEntr[j]; l++)
                    {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                     t0_scaler[j]+= aValue->GetUInt();
+                     t0_scaler[j]+= (UInt_t)  aValue->GetFloat(); 
                    }
-                   fScalerMean[j] = t0_scaler[j] / aliasEntr[j];
+                   fScalerMean[j] = ((UInt_t) t0_scaler[j])/((UInt_t) aliasEntr[j]);
                  }
                  else if (j < 2*kScalers)
                  {
@@ -347,9 +348,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                    for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_scaler_sec[j-kScalers]+= aValue->GetUInt();
+                      t0_scaler_sec[j-kScalers]+= (UInt_t)  aValue->GetFloat();  
                     }
-                   fScalerSecMean[j-kScalers] = t0_scaler_sec[j-kScalers] / aliasEntr[j];
+                   fScalerSecMean[j-kScalers] = ((UInt_t) t0_scaler_sec[j-kScalers])/((UInt_t) aliasEntr[j]);
                  }
                  else if (j < 2*kScalers+kHV)
                   {
@@ -497,9 +498,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                    for(Int_t l=0; l<aliasEntr[j]; l++)
                    {           
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_atten += aValue->GetInt();
+                      t0_atten += aValue->GetFloat();  
                     }
-                    fAtten = t0_atten / aliasEntr[j];
+                    fAtten = t0_atten /((Float_t) aliasEntr[j]);
                   }
                  else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+2*kAtten)
                   {
@@ -507,9 +508,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_MPDcentA += aValue->GetInt();
+                      t0_MPDcentA +=  aValue->GetFloat();
                     }
-                    fMPDcentA = t0_MPDcentA / aliasEntr[j];
+                    fMPDcentA = t0_MPDcentA /((Float_t) aliasEntr[j]);
                   }
                  else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+3*kAtten)
                   {
@@ -517,9 +518,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_MPDcentC += aValue->GetInt();
+                      t0_MPDcentC += (Int_t) aValue->GetFloat();
                     }
-                    fMPDcentC = t0_MPDcentC / aliasEntr[j];
+                    fMPDcentC = ((Int_t) t0_MPDcentC) /((Int_t) aliasEntr[j]);
                   }
                   else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+4*kAtten)
                   {
@@ -527,9 +528,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_MPDsemiCentA += aValue->GetInt();
+                      t0_MPDsemiCentA += (Int_t) aValue->GetFloat();
                     }
-                    fMPDsemiCentA = t0_MPDsemiCentA / aliasEntr[j];
+                    fMPDsemiCentA =  ((Int_t) t0_MPDsemiCentA) /((Int_t) aliasEntr[j]);
                   }
                  else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+5*kAtten)
                   {
@@ -537,9 +538,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_MPDsemiCentC += aValue->GetInt();
+                      t0_MPDsemiCentC += (Int_t) aValue->GetFloat();
                     }
-                    fMPDsemiCentC = t0_MPDsemiCentC / aliasEntr[j];
+                    fMPDsemiCentC =  ((Int_t) t0_MPDsemiCentC)/ ((Int_t) aliasEntr[j]);
                   }
                  else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+6*kAtten)
                   {
@@ -547,9 +548,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_TVDCtop += aValue->GetInt();
+                      t0_TVDCtop += (Int_t)  aValue->GetFloat();
                     }
-                    fTVDCtop = t0_TVDCtop / aliasEntr[j];
+                    fTVDCtop =  ((Int_t) t0_TVDCtop)/((Int_t) aliasEntr[j]);
                   }
                  else if (j < 2*kScalers+4*kHV+4*kLV+4*kCFD+kTRM+kDRM+7*kAtten)
                   {
@@ -557,9 +558,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_TVDCbottom += aValue->GetInt();
+                      t0_TVDCbottom += (Int_t) aValue->GetFloat();
                     }
-                    fTVDCbottom = t0_TVDCbottom / aliasEntr[j];
+                    fTVDCbottom = ((Int_t) t0_TVDCbottom) /((Int_t) aliasEntr[j]);
                   }
                  else
                   {
@@ -567,9 +568,9 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
                     for(Int_t l=0; l<aliasEntr[j]; l++)
                     {
                       AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(l));
-                      t0_MPDmode += aValue->GetInt();
+                      t0_MPDmode += (Int_t) aValue->GetFloat();
                     }
-                    fMPDmode = t0_MPDmode / aliasEntr[j];
+                    fMPDmode = ((Int_t) t0_MPDmode)/((Int_t) aliasEntr[j]);
                  }
                }
        fIsProcessed=kTRUE;
@@ -577,8 +578,7 @@ Bool_t AliT0DataDCS::ProcessData(TMap& aliasMap)
 }
 
 //---------------------------------------------------------------
-void AliT0DataDCS::Init()
-{
+void AliT0DataDCS::Init(){
        TString sindex;
        for(int i=0;i<kNAliases;i++)
        {       
@@ -725,4 +725,70 @@ void AliT0DataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
 }
 
 
+//---------------------------------------------------------------
+void  AliT0DataDCS::PrintfArray(const char *label,  const Float_t *array, Int_t numElements) const
+{
+  printf("%s: \n",label);
+  for(Int_t i=0;i<numElements;i++){
+    printf("  %.2f", array[i]);
+  }
+  printf("\n");
+}
+//---------------------------------------------------------------
+
+void AliT0DataDCS::PrintT0Data() const
+{
+  printf("AliT0DataDCS::Print()\n");
+  printf("RUN:                %d\n", fRun);           
+  printf("START TIME:         %d\n", fStartTime);  
+  printf("END TIME:           %d\n", fEndTime); 
+  printf("StartTimeDCSQuery:  %d\n", fStartTimeDCSQuery);
+  printf("EndTimeDCSQuery:    %d\n", fEndTimeDCSQuery);
+
+  PrintfArray("HV A side current", fHViA, kHV);
+  PrintfArray("HV A side voltage", fHVvA, kHV);
+  PrintfArray("LV A side current", fLViA, kLV);
+  PrintfArray("LV A side voltage", fLVvA, kLV);
+  PrintfArray("HV C side current", fHViC, kHV);
+  PrintfArray("HV C side voltage", fHVvC, kHV);
+  PrintfArray("LV C side current", fLViC, kLV);
+  PrintfArray("LV C side voltage", fLVvC, kLV);
+
+  PrintfArray("CFD threshold A side", fCFDtA, kCFD);        
+  PrintfArray("CFD walk A side", fCFDwA, kCFD);              
+  PrintfArray("CFD threshold C side", fCFDtC, kCFD);          
+  PrintfArray("CFD walk C side", fCFDwC, kCFD);                
+
+  //PrintfArray("SCALERS", (Float_t*) fScalerMean, kScalers); 
+  printf("SCALERS: \n");
+  for(Int_t i=0;i<kScalers;i++){
+    printf("  %d", fScalerMean[i]);
+  }
+  printf("\n");
+
+  
+ // PrintfArray("SCALERS per second",(Float_t*) fScalerSecMean, kScalers);  
+  printf("SCALERS per second: \n");
+  for(Int_t i=0;i<kScalers;i++){
+    printf("  %d", fScalerSecMean[i]);
+  }
+  printf("\n");
+
+
+
+
+  PrintfArray("TRM", fTRM, kTRM);                 
+  PrintfArray("DRM", fDRM, kDRM);                  
+
+  printf("Laser Amplitude: %f\n", fAtten);                    
+  printf("mult. discrim. central A side: %d\n", fMPDcentA);                     
+  printf("mult. discrim. central C side: %d\n", fMPDcentC);                     
+  printf("mult. discrim. semi-central A side: %d\n", fMPDsemiCentA);                     
+  printf("mult. discrim. semi-central C side: %d\n", fMPDsemiCentC);                    
+
+  printf("TVDC top:     %d\n", fTVDCtop);   
+  printf("TVDC bottom:  %d\n", fTVDCbottom);   
+  printf("MPDmode:      %d\n", fMPDmode);   
+}
+
 
index ae9a9cc..612d4e0 100644 (file)
@@ -20,25 +20,61 @@ public:
        AliT0DataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery);
        AliT0DataDCS(const AliT0DataDCS & data);
        AliT0DataDCS& operator=(const AliT0DataDCS & data);
-       ~AliT0DataDCS();
+               ~AliT0DataDCS();
 
        void SetRun(Int_t run) {fRun = run;}
        void SetStartTime(Int_t startTime) {fStartTime = startTime;}
        void SetEndTime(Int_t endTime) {fEndTime = endTime;}
        void SetStartTimeDCSQuery(Int_t startTimeDCSQuery) {fStartTimeDCSQuery = startTimeDCSQuery;}
        void SetEndTimeDCSQuery(Int_t endTimeDCSQuery) {fEndTimeDCSQuery = endTimeDCSQuery;}
-       Int_t GetRun() const {return fRun;}
+
+
+        Int_t GetRun() const {return fRun;}
        Int_t GetStartTime() const {return fStartTime;}
        Int_t GetEndTime() const {return fEndTime;}
        Int_t GetStartTimeDCSQuery() const {return fStartTimeDCSQuery;}
        Int_t GetEndTimeDCSQuery() const {return fEndTimeDCSQuery;}     
 
+        Int_t GetTVDCtop() const {return    fTVDCtop;}     
+       Int_t GetTVDCbottom() const {return fTVDCbottom;} 
+
+        Float_t GetMeanPMTCurrentASide(Int_t pmt)   const {return fHViA[pmt];} 
+        Float_t GetMeanPMTVoltageASide(Int_t pmt)   const {return fHVvA[pmt];} 
+        Float_t GetMeanLVCurrentASide (Int_t index) const {return fLViA[index];} 
+        Float_t GetMeanLVVoltageASide (Int_t index) const {return fLVvA[index];}
+
+        Float_t GetMeanPMTCurrentCSide(Int_t pmt)   const {return fHViC[pmt];} 
+        Float_t GetMeanPMTVoltageCSide(Int_t pmt)   const {return fHVvC[pmt];} 
+        Float_t GetMeanLVCurrentCSide (Int_t index) const {return fLViC[index];} 
+        Float_t GetMeanLVVoltageCSide (Int_t index) const {return fLVvC[index];}
+
+        Float_t GetMeanCFDThresholdASide(Int_t pmt) const{return fCFDtA[pmt];}
+       Float_t GetMeanCFDWalkASide   (Int_t pmt)   const{return fCFDwA[pmt];}  
+        Float_t GetMeanCFDThresholdCSide(Int_t pmt) const{return fCFDtC[pmt];}
+       Float_t GetMeanCFDWalkCSide   (Int_t pmt)   const{return fCFDwC[pmt];}  
+
+        UInt_t GetMeanValueOfT0ScalerFromEntireRun(Int_t scaler) const{return fScalerMean[scaler];}         
+        UInt_t GetMeanValueOfT0ScalerPerSecond    (Int_t scaler) const{return fScalerSecMean[scaler];} 
+
+        Float_t GetMeanTemperatureTRM (Int_t trm)   const {return fTRM[trm];}                  
+       Float_t GetMeanTemperatureDRM (Int_t drm)   const {return fDRM[drm];}   
+       Float_t GetLaserAmplitude() const { return  fAtten;}    
+       Int_t  GetMultDiscriminatorCentralASide() const     {return fMPDcentA;}
+       Int_t  GetMultDiscriminatorCentralCSide() const     {return fMPDcentC;}     
+        Int_t  GetMultDiscriminatorSemiCentralASide() const {return fMPDsemiCentA;}
+        Int_t  GetMultDiscriminatorSemiCentralCSide() const {return fMPDsemiCentC;}          
+       Int_t  GetMultDiscriminatorMode() const {return fMPDmode;}
+
+
        Bool_t ProcessData(TMap& aliasMap);
 
        const char* GetAliasName(Int_t pos) const {return pos<kNAliases ? fAliasNames[pos].Data() : 0;}
+
+        void PrintT0Data() const;
 private:
        void Init();
        void Introduce(UInt_t numAlias, const TObjArray* aliasArr)const;
+        void PrintfArray(const char *label, const Float_t *array, Int_t numElements) const;
 
        Int_t fRun;                             // Run number
        UInt_t fStartTime;                      // Start time
@@ -57,8 +93,8 @@ private:
        Float_t fCFDwA[kCFD];                   // Mean walk on CFD in V on A-side
        Float_t fCFDtC[kCFD];                   // Mean threshold on CFD in V on C-side
         Float_t fCFDwC[kCFD];                  // Mean walk on CFD in V on C-side
-        Float_t fScalerMean[kScalers];         // Mean value of T0 scaler counts from the entire run
-        Float_t fScalerSecMean[kScalers];      // Mean value of T0 scaler counts per second
+        UInt_t fScalerMean[kScalers];          // Mean value of T0 scaler counts from the entire run
+        UInt_t fScalerSecMean[kScalers];       // Mean value of T0 scaler counts per second
        Float_t fTRM[kTRM];                     // Mean temperature on TRM in degrees of Celsius
        Float_t fDRM[kDRM];                     // Mean temperature on DRM in degrees of Celsius
        Float_t fAtten;                         // Laser amplitude in MIPs
@@ -71,7 +107,7 @@ private:
        Int_t fMPDmode;                       // Multiplicity Discriminator on C-side only, A-side only, or both sides
        TString fAliasNames[kNAliases];         // T0 data points aliases  
        Bool_t fIsProcessed;                    // status - was processing data successful
-       ClassDef(AliT0DataDCS, 3);
+       ClassDef(AliT0DataDCS, 2)
 
 protected:
 };
index 39cdeb0..4dbeea1 100644 (file)
@@ -11,37 +11,24 @@ void TestPreprocessor()
   AliTestShuttle::SetMainRefStorage("local://./TestRef");
   AliTestShuttle::SetLocalRefStorage("local://./TestRef");
 
-  AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1);
+  AliTestShuttle* shuttle = new AliTestShuttle(104890, 0, 1);
+
+ TMap* dcsAliasMap = CreateDCSAliasMap();
 
-  TMap* dcsAliasMap = CreateDCSAliasMap();
 
-  shuttle->SetDCSInput(dcsAliasMap);
 
-  //shuttle->SetInputRunType("STANDALONE");
+  shuttle->SetDCSInput(dcsAliasMap);
 
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "LASER", "LDC0","daLaser.root");
+ shuttle->SetInputRunType("AMPLITUDE_CALIBRATION");
  
-  shuttle->SetInputRunType("PHYSICS");
+ //shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "AMPLITUDE_CALIBRATION", "LDC0","daLaser.root");
+   shuttle->SetInputRunType("PHYSICS");
 
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "PHYSICS", "LDC0", "daCosmic.root");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "PHYSICS", "LDC0", "daPhys.root");
 
   AliPreprocessor* start = new AliT0Preprocessor(shuttle);
 
   shuttle->Process();
-  
-  /* AliCDBManager::Instance()->SetDefaultStorage("local://TestCDB");
-
-  AliCDBEntry* entry = AliCDBManager::Instance()->Get("T00/Calib/Data", 0);
-  if (!entry)
-  {
-    printf("The file is not there. Something went wrong.\n");
-    return;
-  }
-
-  AliT0Calc* output = dynamic_cast<AliT0Calc*> (entry->GetObject());
-
-   // output->Print();
-  */
 }
 
 TMap* CreateDCSAliasMap()
@@ -156,12 +143,15 @@ TMap* CreateDCSAliasMap()
 
     for (int timeStamp=0;timeStamp<nValues;timeStamp++)
     {
-      AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e8,50), timeStamp);
+      //CHIARA's original // AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e8,50), timeStamp);
+      AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e3,50), timeStamp);
       valueSet->Add(dcsVal);
+
       printf("Alias: %s - value n. %d: (val=%d timestamp=%d)\n" ,
            aliasName.Data(), timeStamp, dcsVal->GetFloat(), dcsVal->GetTimeStamp());
     }
     aliasMap->Add(new TObjString(aliasName), valueSet);
+
   }
 
   return aliasMap;