]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added DigitPublisher class and relative modifications to the Geometry. added example...
authorfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Aug 2011 11:08:19 +0000 (11:08 +0000)
committerfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Aug 2011 11:08:19 +0000 (11:08 +0000)
HLT/EMCAL/AliHLTEMCALGeometry.cxx
HLT/EMCAL/AliHLTEMCALGeometry.h
HLT/EMCAL/offline/AliHLTEMCALDigitHandler.cxx [new file with mode: 0644]
HLT/EMCAL/offline/AliHLTEMCALDigitHandler.h [new file with mode: 0644]
HLT/EMCAL/offline/macros/rec.C [new file with mode: 0644]
HLT/EMCAL/offline/macros/sim_hlt_emcal.C [new file with mode: 0644]

index 4e77c9f51db2c681ede005a0385722818d069397..0b0f68cb933d850da433a05b416822a1528cb5cc 100644 (file)
@@ -28,7 +28,7 @@ AliHLTEMCALGeometry::AliHLTEMCALGeometry() :
        AliHLTCaloGeometry ("EMCAL"),
        fGeo(0),fReco(0)
 {
-  GetGeometryFromCDB();
+  //GetGeometryFromCDB();
 }
 
 Int_t AliHLTEMCALGeometry::InitialiseGeometry()
@@ -122,11 +122,14 @@ AliHLTEMCALGeometry::GetGeometryFromCDB()
              delete fGeo;
              fGeo = 0;
            }
-
-         gGeoManager = (TGeoManager*) pEntry->GetObject();
+         if(!gGeoManager)
+         {
+           gGeoManager = (TGeoManager*) pEntry->GetObject();
+         }
 
          if(gGeoManager)
            {
+             HLTDebug("Getting geometry from CDB");
              fGeo = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
              //fGeo = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
              fReco = new AliEMCALRecoUtils;
@@ -154,3 +157,15 @@ AliHLTEMCALGeometry::GetGeometryFromCDB()
     }
   return 0;
 }
+
+void AliHLTEMCALGeometry::GetLocalCoordinatesFromAbsId(Int_t absId, Int_t& module, Int_t& x, Int_t& z)
+{
+  Int_t mod; // not super module
+  Int_t tmpx;
+  Int_t tmpz;
+  
+  fGeo->GetCellIndex(absId, module, mod, tmpx, tmpz);
+  fGeo->GetCellPhiEtaIndexInSModule(module,mod,tmpx,tmpz, x, z);
+  
+  HLTDebug("ID: %d, smodule: %d, mod: %d, x: %d, z: %d", absId, module, mod, x, z);
+}
index d66664df7d9741275d043fa9540cb0c7990f690b..970b988888f7989c19c948cbfa3a4bb834f2360b 100644 (file)
@@ -38,8 +38,9 @@ class  AliHLTEMCALGeometry : public AliHLTCaloGeometry
        void GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId);
        virtual Int_t InitialiseGeometry();
        
-
-
+       virtual void GetLocalCoordinatesFromAbsId(Int_t absId, Int_t& module, Int_t& x, Int_t& z);
+       
+       
 protected:
        int GetGeometryFromCDB();
 
diff --git a/HLT/EMCAL/offline/AliHLTEMCALDigitHandler.cxx b/HLT/EMCAL/offline/AliHLTEMCALDigitHandler.cxx
new file mode 100644 (file)
index 0000000..a638ac6
--- /dev/null
@@ -0,0 +1,135 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no>               *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * 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 "AliHLTEMCALDigitHandler.h"
+#include "AliRunLoader.h"
+#include "AliEMCALLoader.h"
+#include "AliHLTEMCALGeometry.h"
+#include "TTree.h"
+#include "AliEMCALDigit.h"
+#include "AliEMCALCalibData.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliCDBPath.h"
+
+AliHLTEMCALDigitHandler *AliHLTEMCALDigitHandler::fgkInstance = NULL;
+
+AliHLTEMCALDigitHandler::AliHLTEMCALDigitHandler() : AliHLTCaloDigitHandler("EMCAL")
+,fCalibData(0)
+{
+
+}
+
+AliHLTEMCALDigitHandler::~AliHLTEMCALDigitHandler()
+{
+
+}
+
+AliHLTEMCALDigitHandler* AliHLTEMCALDigitHandler::Instance()
+{
+    if (!fgkInstance)
+    {
+        fgkInstance = new AliHLTEMCALDigitHandler;
+    }
+    return fgkInstance;
+}
+
+Int_t AliHLTEMCALDigitHandler::Init(AliRunLoader* runLoader)
+{
+
+    fGeometry = new AliHLTEMCALGeometry();
+    if (fGeometry) fGeometry->InitialiseGeometry();
+    if(GetGainsFromCDB())
+    {
+      HLTFatal("Could not get gains from CDB");
+      return -3;
+    }
+
+    Int_t nev = AliHLTCaloDigitHandler::Init(runLoader);
+    if (nev > 0)
+    {
+        if (fRunLoader)
+        {
+            fDetLoader = dynamic_cast<AliEMCALLoader*>(fRunLoader->GetDetectorLoader("EMCAL"));
+            if (!fDetLoader)
+            {
+                HLTFatal("Could not get EMCAL loader");
+                return -1;
+            }
+        }
+        else
+        {
+            return -2;
+        }
+    }
+
+    return nev;
+}
+
+Int_t AliHLTEMCALDigitHandler::ConvertDigit(AliDigitNew *digit)
+{
+    AliEMCALDigit *dig = dynamic_cast<AliEMCALDigit*>(digit);
+
+    if(!dig)
+    {
+      HLTError("Wrong data, cannot create digits");
+      return -1;
+    }
+    
+    Int_t module = 0;
+    Int_t x = 0;
+    Int_t z = 0;
+
+    fGeometry->GetLocalCoordinatesFromAbsId(dig->GetId(), module, x, z);
+    AliHLTCaloDigitDataStruct *hDig = &(fDigits[module][fDigitsInModule[module]]);
+
+    hDig->fID = dig->GetId();
+    hDig->fX = x;
+    hDig->fZ = z;
+    hDig->fModule = module;
+    hDig->fEnergy = dig->GetAmplitude()*(fCalibData->GetADCchannel(module, z, x));
+    hDig->fTime = dig->GetTime();
+    hDig->fAmplitude = 0;
+    hDig->fOverflow = false;
+    hDig->fHgPresent = true;
+    hDig->fAssociatedCluster = -1;
+    fDigitsInModule[module]++;
+    
+  return 0;
+}
+
+int AliHLTEMCALDigitHandler::GetGainsFromCDB()
+{
+   // See header file for class documentation
+
+  AliCDBPath path("EMCAL","Calib","Data");
+  if(path.GetPath())
+    {
+      //      HLTInfo("configure from entry %s", path.GetPath());
+      AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+       if (pEntry) 
+       {
+           fCalibData = (AliEMCALCalibData*)pEntry->GetObject();
+       }
+      else
+       {
+//         HLTError("can not fetch object \"%s\" from CDB", path);
+           return -1;
+       }
+    }
+   if(!fCalibData) return -1;
+   return 0;
+}
diff --git a/HLT/EMCAL/offline/AliHLTEMCALDigitHandler.h b/HLT/EMCAL/offline/AliHLTEMCALDigitHandler.h
new file mode 100644 (file)
index 0000000..5d04a39
--- /dev/null
@@ -0,0 +1,64 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no>               *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+#ifndef ALIHLTEMCALDIGITHANDLER_H
+#define ALIHLTEMCALDIGITHANDLER_H
+
+#include "offline/AliHLTCaloDigitHandler.h"
+#include "AliHLTEMCALDefinitions.h"
+
+class AliEMCALCalibData;
+class AliDigitNew;
+class AliHLTEMCALDigitHandler : public AliHLTCaloDigitHandler
+{
+
+public:
+      
+    virtual ~AliHLTEMCALDigitHandler();
+    
+    static AliHLTEMCALDigitHandler* Instance();
+      
+    virtual Int_t Init(AliRunLoader* runLoader);
+    
+    virtual AliHLTComponentDataType GetDataType() { return AliHLTEMCALDefinitions::fgkDigitDataType; }
+    
+
+protected:
+  
+    virtual Int_t ConvertDigit(AliDigitNew *digit);    
+    
+    int GetGainsFromCDB();
+
+    
+private:
+  
+  /** Constructor, private */
+  AliHLTEMCALDigitHandler();
+
+  /** The one and only instance of class */
+  static AliHLTEMCALDigitHandler *fgkInstance;
+  
+  /** Calibration data */
+  AliEMCALCalibData *fCalibData;
+  
+  /** Prohibited */
+  AliHLTEMCALDigitHandler(const AliHLTEMCALDigitHandler& );
+    
+  /** Prohibited */
+  AliHLTEMCALDigitHandler& operator=(const AliHLTEMCALDigitHandler& );
+};
+
+#endif // ALIHLTEMCALDIGITHANDLER_H
diff --git a/HLT/EMCAL/offline/macros/rec.C b/HLT/EMCAL/offline/macros/rec.C
new file mode 100644 (file)
index 0000000..187964e
--- /dev/null
@@ -0,0 +1,26 @@
+#include "../AliRoot-TRUNK-20110708-build/include/AliReconstruction.h"
+void rec() {
+  AliReconstruction reco;
+
+  //reco.SetWriteESDfriend();
+  //reco.SetWriteAlignmentData();
+
+  reco.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  reco.SetSpecificStorage("GRP/GRP/Data",
+                         Form("local://%s",gSystem->pwd()));
+
+  reco.SetRunQA(":") ;
+  
+  reco.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
+  
+  //for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
+//    reco.SetQACycles(det, 999) ;
+    //reco.SetQAWriteExpert(det) ; 
+  //}
+
+  TStopwatch timer;
+  timer.Start();
+  reco.Run();
+  timer.Stop();
+  timer.Print();
+}
diff --git a/HLT/EMCAL/offline/macros/sim_hlt_emcal.C b/HLT/EMCAL/offline/macros/sim_hlt_emcal.C
new file mode 100644 (file)
index 0000000..efd5fc6
--- /dev/null
@@ -0,0 +1,167 @@
+
+void sim_hlt_calo(const char *input = "./", const char *grp = "./", bool doPhos = true, bool doEmcal = true, bool doTM = true)
+{
+
+    //AliCDBManager::Instance()->SetRun(0);
+
+ //   if (!gSystem->AccessPathName("galice.root")) {
+   if(0){
+        cerr << "please delete the galice.root or run at different place." << endl;
+        return;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////////////////////
+    //
+    // init the HLT system in order to define the analysis chain below
+    //
+    AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
+
+    // Input to the ESD converter
+    TString ecInput;
+    TString option="libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTCalo.so libAliHLTPHOS.so libAliHLTEMCAL.so libAliHLTGlobal.so loglevel=0x7f chains=ESD-CONVERTER";
+
+ const char* cdbEntry="GRP/Geometry/Data";
+  AliCDBManager* pMan=AliCDBManager::Instance();
+  if (pMan) {
+    if (!pMan->IsDefaultStorageSet()) {
+      pMan->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+      pMan->SetRun(0);
+    }
+    AliCDBEntry *pEntry = pMan->Get(cdbEntry);
+    if (pEntry && 
+       pEntry->GetObject()) {
+    } else {
+      HLTWarning("can not load CDB entry %s", cdbEntry);
+    }
+  }
+
+//    if (doPhos)
+    if(0)
+    {
+        ///////////////////////////////////////
+        // The PHOS part of the chain
+        //////////////////////////////////////
+
+        int moduleStart = 2;
+        int moduleEnd = 4;
+        int rcuStart = 0;
+        int rcuEnd = 3;
+        int rcusPerModule = 4;
+        int ddlOffset = 1792;
+
+        for (int module = moduleStart; module <= moduleEnd; module++)
+        {
+            TString clInput;
+
+             TString arg, cl;
+
+            // Clusterizer
+            cl.Form("PHS-CL_%02d", module);
+            arg = "";
+            AliHLTConfiguration clConf(cl.Data(), "PhosClusterizer", clInput.Data(), arg.Data());
+
+            if (ecInput.Length() > 0) ecInput += " ";
+            ecInput += cl;
+        }
+
+        // END OF PHOS
+    }
+
+    if (doEmcal)
+    {
+        int moduleStart = 0;
+        int moduleEnd = 0;
+        int rcuStart = 0;
+        int rcuEnd = 1;
+        int rcusPerModule = 2;
+        int ddlOffset = 4608;
+
+        histoInput = "";
+
+        for (int module = moduleStart; module <= moduleEnd; module++)
+        {
+            TString clInput;
+
+            for (int rcu = rcuStart; rcu <= rcuEnd; rcu++)
+            {
+ /*               TString arg, publisher, ra, dm;
+                // raw data publisher components
+                publisher.Form("EMC-RP_%02d_%d", module, rcu);
+                arg.Form("-minid %d -datatype 'DDL_RAW ' 'EMCA'  -dataspec 0x%x ", ddlOffset + module*(rcusPerModule) + rcu, 0x1 << (module*rcusPerModule + rcu));
+                AliHLTConfiguration pubConf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+               
+               
+                // Raw analyzer
+                arg = "";
+                ra.Form("EMC-RA_%02d_%d", module, rcu);
+                AliHLTConfiguration rawConf(ra.Data(), "EmcalRawCrude", publisher.Data(), arg.Data());
+
+                // digit maker components
+                dm.Form("EMC-DM_%02d_%d", module, rcu);
+                arg="";
+                AliHLTConfiguration dmConf(dm.Data(), "EmcalDigitMaker", ra.Data(), arg.Data());
+
+                if (clInput.Length() > 0) clInput += " ";
+                clInput+=dm;
+  */          }
+            
+            TString arg, publisher, cl, ca;
+           publisher.Form("EMC-DP_%02d", module);
+           arg.Form("-detector EMCAL -module %d", module);
+           AliHLTConfiguration digPubConf(publisher.Data(), "CaloDigitPublisher", NULL, arg.Data());
+           
+            // Clusterizer
+            cl.Form("EMC-CL_%02d", module);
+            arg = "";
+            AliHLTConfiguration clConf(cl.Data(), "EmcalClusterizer", publisher.Data(), arg.Data());
+
+            if (ecInput.Length() > 0) ecInput += " ";
+            ecInput += cl;
+        }
+
+
+        // END OF EMCAL
+    }
+
+    // If there are no tracks it shouldn't do anything...
+    AliHLTConfiguration tmconf("track-matcher", "TrackMatcher", ecInput.Data(), "");
+
+    //if (doEmcal)
+    if(0)
+    {
+        // EMCAL Histograms
+        AliHLTConfiguration hconf("emcalHistocomp", "CaloPhysicsHistos", "track-matcher", "-emcal -invariantmass -clusterenergy -matchedtracks");
+        AliHLTConfiguration fwconf("emcalHist", "ROOTFileWriter"   , "emcalHistocomp", "-datafile emcalHistograms -concatenate-events -overwrite");
+    }
+
+    //if (doPhos)
+    if(0)
+    {
+        // PHOS Histograms
+        AliHLTConfiguration hconf("phosHistocomp", "CaloPhysicsHistos", "track-matcher", "-phos -invariantmass -clusterenergy -matchedtracks");
+        AliHLTConfiguration fwconf("phosHist", "ROOTFileWriter"   , "phosHistocomp", "-datafile phosHistograms -concatenate-events -overwrite");
+    }
+    
+    TString arg, ec;
+
+
+    ec.Form("ESD-CONVERTER");
+    arg = "";
+
+    AliHLTConfiguration esdcconf(ec.Data(), "GlobalEsdConverter"   , "track-matcher", "");
+    
+    AliSimulation sim;
+        sim.SetRunHLT("libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTCalo.so libAliHLTPHOS.so libAliHLTEMCAL.so libAliHLTGlobal.so loglevel=0x7f chains=ESD-CONVERTER");
+        sim.SetRunGeneration(kFALSE);
+        sim.SetMakeDigits("");
+        sim.SetMakeSDigits("");
+        //sim.SetMakeDigits("EMCAL");
+        //sim.SetMakeSDigits("EMCAL");
+        sim.SetMakeDigitsFromHits("");
+       sim.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+       sim.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
+
+        sim.Run(5);
+
+    
+}