]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/trigger/AliHLTTriggerBarrelGeomMultiplicity.cxx
- synchronized the overlay macro to the changes of the drawing one
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerBarrelGeomMultiplicity.cxx
index aa399b9f7c340657c494722e54319af818c4d75f..f0b5be8e19cb7c5948074ca99b3ebd4290c20302 100644 (file)
@@ -1,3 +1,4 @@
+// $Id$
 //**************************************************************************
 //* This file is property of and copyright by the ALICE HLT Project        * 
 //* ALICE Experiment at CERN, All rights reserved.                         *
@@ -17,7 +18,6 @@
 /// @file   AliHLTTriggerBarrelGeomMultiplicity.cxx
 /// @author Oystein Djuvsland
 /// @date   2009-10-08
-
 /// @brief  HLT trigger component for charged particle multiplicity 
 ///         within a geometrical acceptance in the central barrel.
 
@@ -28,7 +28,6 @@
 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
 
 #include "AliHLTTriggerBarrelGeomMultiplicity.h"
-
 #include "AliHLTTriggerDetectorGeom.h"
 #include "AliHLTTriggerDecisionParameters.h"
 #include "AliESDEvent.h"
@@ -37,8 +36,6 @@
 #include "AliHLTGlobalBarrelTrack.h"
 #include "TObjArray.h"
 #include "TObjString.h"
-#include "TObjArray.h"
-#include "TVector3.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
 #include "TFile.h"
@@ -66,19 +63,17 @@ AliHLTTriggerBarrelGeomMultiplicity::AliHLTTriggerBarrelGeomMultiplicity()
 
 }
 
-
-const char* AliHLTTriggerBarrelGeomMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelGeomMultiplicityTrigger";
-
->>>>>>> - Adding the new track multiplicity trigger cutting on geometrical acceptance
 AliHLTTriggerBarrelGeomMultiplicity::~AliHLTTriggerBarrelGeomMultiplicity()
 {
   // see header file for class documentation
-}
 
+  if (fDetectorArray != NULL) delete fDetectorArray;
+}
 
-const char* AliHLTTriggerBarrelGeomMultiplicity::GetTriggerName() const
+const char* AliHLTTriggerBarrelGeomMultiplicity::GetTriggerName() const 
 {
   // see header file for class documentation
+
   return "BarrelGeomMultiplicityTrigger";
 }
 
@@ -88,7 +83,6 @@ AliHLTComponent* AliHLTTriggerBarrelGeomMultiplicity::Spawn()
   return new AliHLTTriggerBarrelGeomMultiplicity;
 }
 
-
 int AliHLTTriggerBarrelGeomMultiplicity::Reconfigure(const char *cdbEntry, const char *chainId)
 {
   // see header file for class documentation
@@ -105,13 +99,16 @@ int AliHLTTriggerBarrelGeomMultiplicity::Reconfigure(const char *cdbEntry, const
   return GetDetectorGeomsFromCDBObject(entry, chainId);
 } 
 
-
 int AliHLTTriggerBarrelGeomMultiplicity::DoTrigger()
 {
   // see header file for class documentation
   int iResult=0;
   int numberOfTracks=-1;
 
+  if (!fTriggerDecisionPars) {
+    iResult=-ENODEV;
+  }
+
   // try the ESD as input
   const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
@@ -121,7 +118,6 @@ int AliHLTTriggerBarrelGeomMultiplicity::DoTrigger()
     {
       numberOfTracks=0;
       esd->GetStdContent();
-
       for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) 
        {
          if (CheckCondition(esd->GetTrack(i), esd->GetMagneticField())) numberOfTracks++;
@@ -152,22 +148,31 @@ int AliHLTTriggerBarrelGeomMultiplicity::DoTrigger()
        }
     }
 
+  bool condition=false;
+  description="Geometrical conditions not matched";
+  AliHLTReadoutList readout;
+
   if (numberOfTracks>=fMinTracks) 
     {
-      SetDescription(fTriggerDecisionPars->GetDescription());
-      AliHLTReadoutList readout(fTriggerDecisionPars->GetReadoutListParameter());
-      AliHLTTriggerDecision decision(
-                                    true,
-                                    fTriggerDecisionPars->GetTriggerName().Data(),
-                                    AliHLTTriggerDomain(readout),
-                                    fTriggerDecisionPars->GetDescription()
-                                    );
-      TriggerEvent(&decision);
+      condition=true;
+      description=fTriggerDecisionPars->GetDescription();
+      readout=fTriggerDecisionPars->GetReadoutListParameter();
+      HLTDebug("Geometrical acceptance trigger %s triggered", fTriggerDecisionPars->GetTriggerName().Data());
     }
-  
+
+  AliHLTTriggerDecision decision(
+                                condition,
+                                fTriggerDecisionPars->GetTriggerName().Data(),
+                                AliHLTTriggerDomain(readout),
+                                description.Data()
+                                );
+  TriggerEvent(&decision, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
+
   return iResult;
+
 }
 
+
 template<class T>
 bool AliHLTTriggerBarrelGeomMultiplicity::CheckCondition(T* track, float b)
 {
@@ -214,35 +219,56 @@ int AliHLTTriggerBarrelGeomMultiplicity::DoInit(int argc, const char** argv)
   // first configure the default
   int iResult=0;
 
+  // Matthias 05.04.2011 code audit
+  // looks like somebody has to commission this component
+  HLTWarning("this component is not tested and needs most likely a major revision!");
+
   if (iResult>=0 && argc>0)
     iResult=ConfigureFromArgumentString(argc, argv);
 
+  if (!fTriggerDecisionPars) {
+    HLTError("decision parameter not initialized");
+    iResult=-ENODEV;
+  }
+  fSolenoidBz=GetBz();
+
   return iResult;
 }
 
 int AliHLTTriggerBarrelGeomMultiplicity::DoDeinit()
-{
+ {
   // see header file for class documentation
+   if (fTriggerName) delete fTriggerName;
+   fTriggerName=NULL;
   return 0;
 }
 
-
 int AliHLTTriggerBarrelGeomMultiplicity::ReadPreprocessorValues(const char* /*modules*/)
 {
-  // see header file for class documentation
+    // see header file for function documentation
 
-  // TODO 2009-10-10: implementation
-  // for the moment very quick, just reload the magnetic field
-  return ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
+  // nothing to do for the moment
+  return 0;
 }
 
 int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromCDBObject(const char *cdbEntry, const char* chainId)
 {
     // see header file for function documentation
   int nDetectorGeoms=0;
+
+  if(fDetectorArray)
+    {
+      fDetectorArray->Clear();
+    }
+  else
+    {
+      fDetectorArray = new TObjArray();
+    }
+  
   const char *path = cdbEntry;
-  if(!path) path = fOCDBEntry;
 
+  if(!path) path = fOCDBEntry;
+  
   if(path)
     {
       //     const char* chainId=GetChainId();
@@ -264,7 +290,7 @@ int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromCDBObject(const cha
                    {
                      fDetectorArray->AddLast(dynamic_cast<AliHLTTriggerDetectorGeom*>(pArr->At(i)));
                      nDetectorGeoms++;
-                     HLTWarning("received detector geometry of type %s", pArr->At(i)->ClassName());
+                     HLTDebug("received detector geometry of type %s", pArr->At(i)->ClassName());
                    }
                  else
                    {
@@ -284,6 +310,9 @@ int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromCDBObject(const cha
          nDetectorGeoms=-ENOENT;
        }
     }
+
+  HLTInfo("received %d detector geometries", nDetectorGeoms);
+
   return nDetectorGeoms;
 }
 
@@ -292,6 +321,16 @@ int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromFile(const char *fi
     // see header file for function documentation
   int nDetectorGeoms=0;
 
+  if(fDetectorArray)
+    {
+      fDetectorArray->Clear();
+    }
+  else
+    {
+      fDetectorArray = new TObjArray();
+    }
+  
+
   if (filename) 
     {
       TFile *geomfile = TFile::Open(filename, "READ");
@@ -313,7 +352,7 @@ int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromFile(const char *fi
                    {
                      fDetectorArray->AddLast(dynamic_cast<AliHLTTriggerDetectorGeom*>(pArr->At(i)));
                      nDetectorGeoms++;
-                     HLTWarning("received detector geometry of type %s", pArr->At(i)->ClassName());
+                     HLTDebug("received detector geometry of type %s", pArr->At(i)->ClassName());
                    }
                  else
                    {
@@ -333,19 +372,22 @@ int AliHLTTriggerBarrelGeomMultiplicity::GetDetectorGeomsFromFile(const char *fi
          nDetectorGeoms=-ENOENT;
        }
     }
-  HLTWarning("received TObjArray with %d detector geometries", nDetectorGeoms);
+  else
+    {
+      HLTError("ROOT file name not specified");
+    }
+  HLTInfo("received %d detector geometries", nDetectorGeoms);
 
   return nDetectorGeoms;
 }
 
 int AliHLTTriggerBarrelGeomMultiplicity::ScanConfigurationArgument(int argc, const char** argv)
 {
-  // see header file for class documentation
+  // See header file for class documentation
   if (argc<=0) return 0;
   int i=0;
   TString argument=argv[i];
 
-
   if (argument.CompareTo("-geomfile")==0) 
     {
       if (++i>=argc) return -EPROTO;
@@ -357,10 +399,12 @@ int AliHLTTriggerBarrelGeomMultiplicity::ScanConfigurationArgument(int argc, con
 
   if (argument.CompareTo("-triggername")==0) 
     {
-      if (++i>=argc) return -EPROTO;
-      
-      fTriggerName = new char[128];
-      sprintf(fTriggerName, argv[i]);
+      if (++i>=argc || argv[i]==NULL) return -EPROTO;
+
+      int namelen=strlen(argv[i])+1;
+      fTriggerName = new char[namelen];
+      if (!fTriggerName) return -ENOMEM;
+      snprintf(fTriggerName, namelen, "%s", argv[i]);
       
       fOCDBEntry = fTriggerName;
 
@@ -368,3 +412,4 @@ int AliHLTTriggerBarrelGeomMultiplicity::ScanConfigurationArgument(int argc, con
   }    
   return 0;
 }
+