1st draft for pass0
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 27 Feb 2011 22:08:58 +0000 (22:08 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 27 Feb 2011 22:08:58 +0000 (22:08 +0000)
T0/AddTaskT0Calib.C [new file with mode: 0644]
T0/AliT0CalibOffsetChannelsTask.cxx [new file with mode: 0644]
T0/AliT0CalibOffsetChannelsTask.h [new file with mode: 0644]
T0/AliT0PreprocessorOffline.cxx [new file with mode: 0644]
T0/AliT0PreprocessorOffline.h [new file with mode: 0644]
T0/CMakelibT0calib.pkg [new file with mode: 0644]
T0/T0calibLinkDef.h [new file with mode: 0644]

diff --git a/T0/AddTaskT0Calib.C b/T0/AddTaskT0Calib.C
new file mode 100644 (file)
index 0000000..0a2317f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+
+ This macros setup the TPC calibration task AddTaskTPCCalib
+ for Pass0.
+ - the run number is required to config TPC OCDB
+ The following calibration components are added to the AliTPCAnalysisTaskcalib task:
+ 1. AliTPCcalibCalib - redo reconstruction with current calibration
+ 2. AliTPCcalibTimeGain - TPC time dependent gain calibration
+ 3. AliTPCcalibTime - TPC time dependent drift time calibration
+ 4. AliTPCcalibLaser - laser track calibration
+
+*/
+//_____________________________________________________________________________
+AliAnalysisTask  *AddTaskT0Calib(Int_t runNumber)
+{
+  //
+  // add calibration task
+  //
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskT0Calib", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // check the input handler
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskT0Calib", "This task requires an input event handler");
+    return NULL;
+  }  
+
+  // set TPC OCDB parameters
+  //ConfigOCDB(runNumber);
+
+  // setup task
+ AliT0CalibOffsetChannelsTask  *task1=new AliT0CalibOffsetChannelsTask("CalibObjectsTrain1");
+ // SetupCalibTaskTrain1(task1);
+  mgr->AddTask(task1);
+
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
+                                      AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("T0Calib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
+
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,1,coutput1);
+  return task1;
+}
diff --git a/T0/AliT0CalibOffsetChannelsTask.cxx b/T0/AliT0CalibOffsetChannelsTask.cxx
new file mode 100644 (file)
index 0000000..0cb352f
--- /dev/null
@@ -0,0 +1,150 @@
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1D.h"
+#include "TF1.h"
+#include "TCanvas.h"
+#include "TObjArray.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+
+#include "AliT0CalibSeasonTimeShift.h"
+#include "AliT0CalibOffsetChannelsTask.h"
+
+#include "AliCDBMetaData.h"
+#include "AliCDBId.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+
+// Task should calculate channels offset 
+// Authors: Alla 
+
+ClassImp(AliT0CalibOffsetChannelsTask)
+//________________________________________________________________________
+AliT0CalibOffsetChannelsTask::AliT0CalibOffsetChannelsTask() 
+  : AliAnalysisTaskSE(),  fESD(0), fTzeroObject(0),fRunNumber(0)
+{
+  // Constructor
+
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  DefineInput(0, TChain::Class());
+  DefineOutput(1, TObjArray::Class());
+  fTzeroObject = new TObjArray(0);
+  fTzeroObject->SetOwner(kTRUE);
+  // Output slot #0 id reserved by the base class for AOD
+  // Output slot #1 writes into a TH1 container
+  // DefineOutput(1, TList::Class());
+}
+
+
+//________________________________________________________________________
+AliT0CalibOffsetChannelsTask::AliT0CalibOffsetChannelsTask(const char *name) 
+  : AliAnalysisTaskSE(name), fESD(0), fTzeroObject(0),fRunNumber(0)
+{
+  // Constructor
+  
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  DefineInput(0, TChain::Class());
+  DefineOutput(1, TObjArray::Class());
+  // Output slot #0 id reserved by the base class for AOD
+  // Output slot #1 writes into a TH1 container
+  // DefineOutput(1, TList::Class());
+}
+
+//________________________________________________________________________
+AliT0CalibOffsetChannelsTask::~AliT0CalibOffsetChannelsTask() 
+{
+  // Destructor
+ printf("AliT0CalibOffsetChannels~AliT0CalibOffsetChannels() ");
+ if( fTzeroObject )fTzeroObject->Delete();
+}
+
+//________________________________________________________________________
+void AliT0CalibOffsetChannelsTask::ConnectInputData(Option_t *) {
+  //
+  //
+  //
+  TTree* tree=dynamic_cast<TTree*>(GetInputData(0));
+  if (!tree) {
+    printf("ERROR: Could not read chain from input slot 0");
+  } 
+  else {
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+    if (!esdH) {
+      printf ("ERROR: Could not get ESDInputHandler");
+    } 
+    else {
+      fESD = esdH->GetEvent();
+      printf ("*** CONNECTED NEW EVENT ****");
+    }
+  }
+}
+
+//________________________________________________________________________
+void AliT0CalibOffsetChannelsTask::UserCreateOutputObjects()
+{
+  // Create histograms
+  for (Int_t i=0; i<24; i++) {
+    fTimeDiff[i]   = new TH1F (Form("CFD1minCFD%d",i+1),"fTimeDiff",300, -300, 300);
+    fCFD[i]   = new TH1F("CFD","CFD",500, 6000, 7000);
+  }
+  fTzeroObject = new TObjArray(0);
+  fTzeroObject->SetOwner(kTRUE);
+  PostData(1, fTzeroObject);
+  // Called once
+}
+
+//________________________________________________________________________
+void AliT0CalibOffsetChannelsTask::UserExec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+
+  // Post output data.
+  fESD = dynamic_cast<AliESDEvent*>(InputEvent());
+  if (!fESD) {
+    printf("ERROR: fESD not available\n");
+    return;
+  }
+
+  const Double32_t* time = fESD->GetT0time();
+  for (Int_t i=0; i<12; i++) {
+    if( time[i]>1 ){
+      fCFD[i]->Fill( time[i]);
+      if(  time[0]>1 ) 
+       fTimeDiff[i]->Fill( time[i]-time[0]);
+    }
+  }
+  for (Int_t i=12; i<24; i++) {
+    if( time[i]>1) {
+      fCFD[i]->Fill( time[i]);
+      if( time[12]>1 ) 
+       fTimeDiff[i]->Fill( time[i]-time[12]);
+    }
+  }
+  fRunNumber =  fESD->GetRunNumber() ; 
+  
+  // printf("%lf   %lf  %lf\n",orA,orC,time);
+  PostData(1, fTzeroObject);
+}      
+ //________________________________________________________________________
+void AliT0CalibOffsetChannelsTask::Terminate(Option_t *) 
+{
+  
+  // Called once at the end of the query
+  for (Int_t i=0; i<24; i++)
+    fTzeroObject->AddAtAndExpand(fTimeDiff[i],i);
+
+  for (Int_t i=24; i<48; i++)
+    fTzeroObject->AddAtAndExpand(fCFD[i],i);
+
+}
+
diff --git a/T0/AliT0CalibOffsetChannelsTask.h b/T0/AliT0CalibOffsetChannelsTask.h
new file mode 100644 (file)
index 0000000..8ff1504
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef AliT0CalibOffsetChannelsTask_cxx\r
+#define AliT0CalibOffsetChannelsTask_cxx\r
+\r
+// task determines mean and sigma of T0 signals  ORA, ORC, ORA-ORC, ORA+ORC/2  \r
+// Authors: FK  \r
+\r
+class TH1F;\r
+class AliESDEvent;\r
+class AliT0CalibSeasonTimeShift;\r
+\r
+#include "AliAnalysisTaskSE.h"\r
+\r
+class AliT0CalibOffsetChannelsTask : public AliAnalysisTaskSE {\r
+ public:\r
+  AliT0CalibOffsetChannelsTask();\r
+  AliT0CalibOffsetChannelsTask(const char *name);\r
+  virtual ~AliT0CalibOffsetChannelsTask(); \r
+  \r
+  virtual void ConnectInputData(Option_t *option);\r
+  virtual void   UserCreateOutputObjects();\r
+  //  virtual void     Process(AliESDEvent *event);\r
+  virtual void   UserExec(Option_t *option);\r
+  virtual void   Terminate(Option_t *);\r
+  TObjArray* GetOffsetHistos() {return fTzeroObject;}\r
+  \r
+ private:\r
+  AliESDEvent *fESD;        //! ESD object\r
+  TObjArray *fTzeroObject;  //array with CFDi-CFD1 and  CFDi\r
+  TH1F        *fTimeDiff[24];   //! CFDi-CFD1 vs Npmt   \r
+  TH1F        *fCFD[24];   //! CFDi  vs Npmt \r
+   int         fRunNumber;\r
+  \r
+   //  AliT0CalibSeasonTimeShift *fTzeroObject;\r
\r
+  AliT0CalibOffsetChannelsTask(const AliT0CalibOffsetChannelsTask&); // not implemented\r
+  AliT0CalibOffsetChannelsTask& operator=(const AliT0CalibOffsetChannelsTask&); // not implemented\r
+  \r
+  ClassDef(AliT0CalibOffsetChannelsTask, 1); // example of analysis\r
+};\r
+\r
+#endif\r
diff --git a/T0/AliT0PreprocessorOffline.cxx b/T0/AliT0PreprocessorOffline.cxx
new file mode 100644 (file)
index 0000000..0a0e40b
--- /dev/null
@@ -0,0 +1,89 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+
+*/   
+// T0 preprocessor:
+// 2) takes data after  pass0 , 
+// processes it, and stores either to OCDB .
+
+
+#include "AliT0PreprocessorOffline.h"
+#include "AliT0CalibTimeEq.h"
+#include "AliCDBStorage.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBManager.h"
+
+#include "AliCDBEntry.h"
+#include "AliLog.h"
+
+#include <TTimeStamp.h>
+#include <TFile.h>
+#include <TObjString.h>
+#include <TNamed.h>
+#include "TClass.h"
+
+
+ClassImp(AliT0PreprocessorOffline)
+
+//____________________________________________________
+AliT0PreprocessorOffline::AliT0PreprocessorOffline():
+TNamed("AliT0PreprocessorOffline","AliT0PreprocessorOffline")
+{
+  //constructor
+}
+//____________________________________________________
+
+AliT0PreprocessorOffline::~AliT0PreprocessorOffline()
+{
+  //destructor
+
+}
+//____________________________________________________
+//____________________________________________________
+
+void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString ocdbStorage)
+{
+
+
+  //Processing data from DAQ Physics run
+  AliInfo("Processing Time Offset between channels");
+  if (filePhysName)
+    {
+      AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
+      offline->Reset();
+      Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data());
+      AliCDBMetaData metaData;
+      metaData.SetBeamPeriod(1);
+      metaData.SetResponsible("Alla Maevskaya");
+      metaData.SetComment("Time equalizing result with slew");
+      
+      if (writeok)  {
+       AliCDBId* id1=NULL;
+       id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun);
+       AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
+       gStorage->Put(offline, (*id1), &metaData);
+      }
+      else {
+       
+          AliWarning(Form("writeok = %d not enough data for equalizing",writeok));
+      }                  
+   
+      delete offline;
+    }
+       
+
+}
diff --git a/T0/AliT0PreprocessorOffline.h b/T0/AliT0PreprocessorOffline.h
new file mode 100644 (file)
index 0000000..2fa3f82
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef ALI_T0_PREPROCESSOROFFLINE_H
+#define ALI_T0_PREPRECESSOROFFLINE_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/* $Id: AliT0Preprocessor.h 39249 2010-02-28 19:09:52Z alla $ */
+
+
+// T0 preprocessor. 
+#include "TNamed.h"
+
+class AliT0PreprocessorOffline: public TNamed 
+{
+  public:
+  AliT0PreprocessorOffline();  
+  virtual ~AliT0PreprocessorOffline();
+  void CalibOffsetChannels(TString FileName, Int_t ustartRun, Int_t uendRun, TString ocdbStorage);
+  private:
+       AliT0PreprocessorOffline(const AliT0PreprocessorOffline & proc); // copy constructor    
+       AliT0PreprocessorOffline& operator=(const AliT0PreprocessorOffline&); //operator
+       ClassDef(AliT0PreprocessorOffline, 1)
+};
+
+
+#endif
diff --git a/T0/CMakelibT0calib.pkg b/T0/CMakelibT0calib.pkg
new file mode 100644 (file)
index 0000000..249f8d3
--- /dev/null
@@ -0,0 +1,40 @@
+#--------------------------------------------------------------------------------#
+# Package File for T0 calib                                                         #
+# Author : Johny Jose (johny.jose@cern.ch)                                       #
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS  AliT0CalibOffsetChannelsTask.cxx AliT0PreprocessorOffline.cxx)
+
+string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
+
+set ( DHDR  T0calibLinkDef.h)
+
+set ( EINCLUDE  RAW)
+
+if( ALICE_TARGET STREQUAL "win32gcc")
+       
+                               set ( PACKSOFLAGS  ${SOFLAGS} -L${ALICE_ROOT}/lib/tgt_${ALICE_TARGET} -lT0base -lSTEER -lCDB -lSTEERBase -lRAWDatarec -L${ROOTLIBDIR} -lGui)
+
+endif( ALICE_TARGET STREQUAL "win32gcc")
diff --git a/T0/T0calibLinkDef.h b/T0/T0calibLinkDef.h
new file mode 100644 (file)
index 0000000..90b1158
--- /dev/null
@@ -0,0 +1,14 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: T0calibLinkDef.h 40168 2010-04-06 09:37:48Z alla $ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class AliT0PreprocessorOffline+;
+#pragma link C++ class AliT0CalibOffsetChannelsTask+;
+
+#endif