]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated (Pedro Glz)
authormrodrigu <mrodrigu@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Feb 2008 13:08:03 +0000 (13:08 +0000)
committermrodrigu <mrodrigu@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Feb 2008 13:08:03 +0000 (13:08 +0000)
ACORDE/ACORDEbaseLinkDef.h
ACORDE/AliACORDECalibData.cxx
ACORDE/AliACORDECalibData.h
ACORDE/AliACORDEPreprocessor.cxx [new file with mode: 0644]
ACORDE/AliACORDEPreprocessor.h [new file with mode: 0644]
ACORDE/libACORDEbase.pkg

index 1e79e7e57a7808ac5b3a36188809990d184f7d68..b4ffbd90cd0e9cf6f392f466f3059cb4eb09dfe1 100644 (file)
@@ -13,5 +13,6 @@
 #pragma link C++ class  AliACORDELoader+;
 #pragma link C++ class  AliGenACORDE+;
 #pragma link C++ class  AliACORDECalibData+;
+#pragma link C++ class  AliACORDEPreprocessor+;
 
 #endif
index 6f575347d3be18a691ee1d12090e21d645ec3ec1..37a4739edbd57949e7a74e6953b65f391fe49da1 100644 (file)
 
 
 #include "AliACORDECalibData.h"
+#include "TList.h"
+#include "TCanvas.h"
 
 ClassImp(AliACORDECalibData)
 
+TH1D *fHits;
+  TH1D *fTHits;
+  TH1D *fMultiHits;
+  TH1D *fTMultiHits;
+
+
+
 //________________________________________________________________
-AliACORDECalibData::AliACORDECalibData()
+AliACORDECalibData::AliACORDECalibData():
+fHits(0),
+fTHits(0),
+fMultiHits(0),
+fTMultiHits(0)
 {
   
 }
@@ -58,7 +71,30 @@ AliACORDECalibData::AliACORDECalibData(const AliACORDECalibData& calibda) :
   fRates[t] = calibda.GetRate(t+1);
   }
 }
+//_______________________________________________________________
+void AliACORDECalibData::Draw()
+{
+
+  //fHits->Draw();
+
+
 
+  TCanvas *ch;
+  TString canvasHistoName="Histos";
+  ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);
+  ch->Divide(2,2);
+  ch->cd(1);
+  fHits->Draw();
+  ch->cd(2);
+  fTHits->Draw();
+  ch->cd(3);
+  fMultiHits->Draw();
+  ch->cd(4);
+  fTMultiHits->Draw();
+
+}
 //________________________________________________________________
 AliACORDECalibData &AliACORDECalibData::operator =(const AliACORDECalibData& calibda)
 {
@@ -74,6 +110,19 @@ AliACORDECalibData &AliACORDECalibData::operator =(const AliACORDECalibData& cal
   }
   return *this;
 }
+//_______________________________________________________________
+/*void AliACORDECalibData::AddHisto(TH1D *fHist)
+{
+    
+
+
+ = (TH1D*)fHist->Clone("hnew");
+
+     
+   
+}
+*/
 
 //________________________________________________________________
 AliACORDECalibData::~AliACORDECalibData()
index 71755ea2752c3c8c3b2c8ea009302b7f98dbb238..6ff7924426b1ebe798b8309ae7fd42a5a180992a 100644 (file)
@@ -5,11 +5,13 @@
  * See cxx source for full Copyright notice                               */
 
 #include "TNamed.h"
+#include "TH1D.h"
 class AliACORDECalibData: public TNamed {
 
  public:
   AliACORDECalibData();
   AliACORDECalibData(const char* name);
+  
   AliACORDECalibData(const AliACORDECalibData &calibda);
   AliACORDECalibData& operator= (const AliACORDECalibData &calibda);
   virtual ~AliACORDECalibData();
@@ -19,14 +21,25 @@ class AliACORDECalibData: public TNamed {
   Float_t  GetEfficiency(Int_t i) const { return fEfficiencies[i-1];}
   Float_t* GetRates() const {return (float*)fRates;}
   Float_t GetRate(Int_t i) const {return fRates[i-1];}
+ // TList*  GetHistos()const {return Hist;} 
   void SetRates(Float_t* Rt);
   void SetRate(Float_t rate, Int_t mod){fRates[mod-1]=rate;}
   void SetEfficiencies(Float_t* Eff);
   void SetEfficiency(Float_t eff, Int_t mod) {fEfficiencies[mod-1]=eff;}
+  void AddHHits(TH1D  *Histo){fHits=(TH1D*)Histo->Clone("Hits");}// Hits
+  void AddHTHits(TH1D *Histo){fTHits=(TH1D*)Histo->Clone("Total Hits");}//Total Hits 
+  void AddHMultiHits(TH1D  *Histo){fMultiHits=(TH1D*)Histo->Clone("MultiHits");}//
+  void AddHTMultiHits(TH1D *Histo){fTMultiHits=(TH1D*)Histo->Clone("Total Multi Hits");}
+  void Draw();
+
 
  protected:
   Float_t fEfficiencies[60];
   Float_t fRates[60];
+  TH1D *fHits;
+  TH1D *fTHits;
+  TH1D *fMultiHits;
+  TH1D *fTMultiHits;
 
   ClassDef(AliACORDECalibData,1)    // ACORDE Calibration data
 };
diff --git a/ACORDE/AliACORDEPreprocessor.cxx b/ACORDE/AliACORDEPreprocessor.cxx
new file mode 100644 (file)
index 0000000..b5d4305
--- /dev/null
@@ -0,0 +1,196 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+
+#include "AliACORDEPreprocessor.h"
+#include "TRandom.h"
+#include "TFile.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBEntry.h"
+#include "AliLog.h"
+#include "AliACORDECalibData.h"
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TList.h>
+#include <TH1F.h>
+
+//
+// This is the first version of ACORDE Preprocessor
+// It takes data from DAQ and passes it to the class AliACORDECalibModule and 
+// stores reference data.
+//
+// Authors
+// Pedro Gonzalez pedro.gonzalez@fcfm.buap.mx
+// Irais Bautista irais@fcfm.buap.mx
+// Arturo Fernandez Tellez afernan@cern.ch
+
+ClassImp(AliACORDEPreprocessor)
+
+//______________________________________________________________________________________________
+AliACORDEPreprocessor::AliACORDEPreprocessor(AliShuttleInterface* shuttle) :
+  AliPreprocessor("ACO", shuttle),
+  fCalData(0)
+{
+  // constructor
+}
+
+//______________________________________________________________________________________________
+AliACORDEPreprocessor::~AliACORDEPreprocessor()
+{
+  // destructor
+}
+
+//______________________________________________________________________________________________
+void AliACORDEPreprocessor::Initialize(Int_t run, UInt_t startTime,
+       UInt_t endTime)
+{
+  // Creates AliACORDECalibModule object
+
+  AliPreprocessor::Initialize(run, startTime, endTime);
+
+       Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
+               TTimeStamp(startTime).AsString(),
+               TTimeStamp(endTime).AsString()));
+
+        fCalData = new AliACORDECalibData();
+}
+
+//______________________________________________________________________________________________
+UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
+{
+  
+
+  TH1D *fH1,*fH2,*fH3,*fH4; //Histogram of the rates per module
+   TFile *daqFile=0x0;
+
+
+   // retrieve the run type from the Shuttle,
+
+   TString runType = GetRunType();
+
+
+   //acorde    STANDALONE_BC
+   //acorde    STANDALONE_PULSER
+    
+   if(runType !="STANDALONE_PULSER")
+   {
+
+   Log("RunType is not STANDALONE_PULSER, nothing to do");
+   return 1;
+
+   }
+
+
+   Log(Form("Run type for run %d: %s", fRun, runType.Data()));
+   TString SourcesId = "CALIB";
+
+  
+
+   //retrieve the list of sources that produced the file with id RATES
+    TList* sourceList = GetFileSources(kDAQ,SourcesId.Data());
+
+   if (!sourceList)
+   {
+       Log(Form("Error: No sources found for id %s", SourcesId.Data()));
+       return 2;
+   }
+  
+   // TODO We have the list of sources that produced the files with Id RATES 
+   // Now we will loop on the list and we'll query the files one by one. 
+
+
+
+   Log(Form("The following sources produced files with the id %s",SourcesId.Data()));
+   sourceList->Print();
+     
+   TIter iter(sourceList);
+   TObjString *source = 0;
+
+   while((source=dynamic_cast<TObjString*> (iter.Next())))
+   {
+       
+        TString fileName = GetFile(kDAQ,SourcesId.Data(), source->GetName());
+
+       if (fileName.Length() > 0)
+               Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
+
+                daqFile = new TFile(fileName.Data(),"READ");
+              
+              if(!daqFile)
+              {
+                            
+              Log(Form("There are not histos     1"));
+             return 3;
+
+              }
+
+           
+                
+            fH1 = (TH1D*)daqFile->Get("fHist1");
+            fH2 = (TH1D*)daqFile->Get("fHist2");
+            fH3 = (TH1D*)daqFile->Get("fHist3");
+            fH4 = (TH1D*)daqFile->Get("fHist4");
+          
+
+             
+             if(fH1!=NULL&&fH2!=NULL&&fH3!=NULL&&fH4!=NULL)  
+             {  
+             fCalData->AddHHits(fH1);
+             fCalData->AddHTHits(fH2);
+             fCalData->AddHMultiHits(fH3);
+             fCalData->AddHTMultiHits(fH4);
+             }
+            
+             else
+            {
+             Log(Form("There are not histos     2"));
+             return 4;
+            }
+    
+
+   }                   
+                                                                          
+  delete sourceList;
+  
+
+        //Now we have to store
+
+        AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("Pedro and Irais");
+       metaData.SetComment("This preprocessor fills an AliACORDECalibModule object.");
+
+               Bool_t result = StoreReferenceData("Calib", "Data",fCalData, &metaData);
+      
+       delete fCalData;
+       fCalData = 0;
+  
+
+  if (!result)
+  return 4;
+  
+  return 0;
+}
+
diff --git a/ACORDE/AliACORDEPreprocessor.h b/ACORDE/AliACORDEPreprocessor.h
new file mode 100644 (file)
index 0000000..3820c11
--- /dev/null
@@ -0,0 +1,35 @@
+//#ifndef ALI_ACORDE_PREPROCESSOR_H
+//#define ALI_ACORDE_PREPROCESSOR_H
+#ifndef ALIACORDEPREPROCESSOR_H
+#define AliACORDEPREPROCESSOR_H
+
+#include "AliPreprocessor.h"
+
+// test preprocessor that writes data to AliACORDECalibModule
+
+class AliACORDECalibData;
+
+class AliACORDEPreprocessor : public AliPreprocessor
+{
+  public:
+    enum{kNModules=60};
+    AliACORDEPreprocessor(AliShuttleInterface* shuttle);
+    virtual ~AliACORDEPreprocessor();
+
+  protected:
+    virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+    virtual UInt_t Process(TMap* dcsAliasMap);
+    void CreateTableofReference();
+    //virtual Bool_t ProcessDCS();
+
+  private:
+
+    AliACORDEPreprocessor(const AliACORDEPreprocessor &proc); //copy constructor
+    AliACORDEPreprocessor& operator = (const AliACORDEPreprocessor & proc);
+    AliACORDECalibData *fCalData;    // CDB class that stores the data
+
+    ClassDef(AliACORDEPreprocessor, 0);
+};
+
+#endif
+
index 6d2e6523c614c97d215bbad9b6ade2b7a02dd856..b264cf7a5f335d5989123bb894e76f8a0d046ecd 100644 (file)
@@ -1,5 +1,5 @@
 SRCS = AliACORDE.cxx AliACORDEConstants.cxx AliACORDECalibData.cxx \
-       AliGenACORDE.cxx  AliACORDELoader.cxx
+       AliGenACORDE.cxx  AliACORDELoader.cxx AliACORDEPreprocessor.cxx
                                                                                           
 HDRS:= $(SRCS:.cxx=.h)