]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
addind cuts on DCA for the BarrelMultiplicityTrigger
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Oct 2009 12:48:50 +0000 (12:48 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Oct 2009 12:48:50 +0000 (12:48 +0000)
new arguments
 -dca-reference     x,y,z
  reference point for the transverse and longitudinal dca cut
 -min-ldca     dca
  minimum longitudinal dca to reference point
 -max-ldca     dca
  maximum longitudinal dca to reference point
 -min-tdca     dca
  minimum transverse dca to reference point
 -max-tdca     dca
  maximum transverse dca to reference point
 -solenoidBz     field
  magnetic field needed if the input is not an ESD object

adding test macro

HLT/trigger/AliHLTTriggerBarrelMultiplicity.cxx
HLT/trigger/AliHLTTriggerBarrelMultiplicity.h
HLT/trigger/macros/rec-BarrelMultiplicityTrigger.C [new file with mode: 0644]

index fe356f4c4e90fa829bbe4bf7bdbcb60e9db4ca93..cd1e4c59d02738838516ccb1133c198b51142cb5 100644 (file)
@@ -32,6 +32,8 @@
 #include "AliHLTTriggerDecision.h"
 #include "AliHLTDomainEntry.h"
 #include "AliHLTGlobalBarrelTrack.h"
+#include "TObjArray.h"
+#include "TObjString.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTriggerBarrelMultiplicity)
@@ -41,12 +43,20 @@ AliHLTTriggerBarrelMultiplicity::AliHLTTriggerBarrelMultiplicity()
   , fPtMin(0.0)
   , fPtMax(0.0)
   , fMinTracks(1)
+  , fDCAReference()
+  , fMinLDca(-1.)
+  , fMaxLDca(-1.)
+  , fMinTDca(-1.)
+  , fMaxTDca(-1.)
+  , fSolenoidBz(0.0)
 {
   // see header file for class documentation
   // or
   // refer to README to build package
   // or
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+  for (int i=0; i<fgkDCAReferenceSize; i++) fDCAReference[i]=0.0;
 }
 
 const char* AliHLTTriggerBarrelMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelMultiplicityTrigger";
@@ -78,13 +88,13 @@ int AliHLTTriggerBarrelMultiplicity::DoTrigger()
   const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
   TString description;
-  TString ptcut;
+  TString ptcut,tdca,ldca,dcaref,op1st,op2nd;
   if (esd != NULL) {
     numberOfTracks=0;
     esd->GetStdContent();
     
     for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
-      if (CheckCondition(esd->GetTrack(i))) numberOfTracks++;
+      if (CheckCondition(esd->GetTrack(i), esd->GetMagneticField())) numberOfTracks++;
     }
   }
 
@@ -97,7 +107,7 @@ int AliHLTTriggerBarrelMultiplicity::DoTrigger()
       if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
        for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
             element!=tracks.end(); element++) {
-         if (CheckCondition(&(*element))) numberOfTracks++;
+         if (CheckCondition(&(*element), fSolenoidBz)) numberOfTracks++;
        }
       } else if (iResult<0) {
        HLTError("can not extract tracks from data block of type %s (specification %08x) of size %d: error %d", 
@@ -112,9 +122,47 @@ int AliHLTTriggerBarrelMultiplicity::DoTrigger()
     } else {
       ptcut.Form(" pt >= %.02f GeV/c", fPtMin);
     }
+
+    if (fMinTDca>=0.0) {
+      if (fMaxTDca>=0.0) {
+       tdca.Form(", %.02f<=transverse_dca<=%.02f", fMinTDca, fMaxTDca);
+      } else {
+       tdca.Form(" transverse_dca >= %.02f", fMinTDca);
+      }
+    } else if (fMaxTDca>=0.0) {
+       tdca.Form(" transverse_dca<=%.02f", fMaxTDca);
+    }
+    if (!tdca.IsNull()) {
+      if (op1st.IsNull()) op1st=" && ";
+      else op2nd=" && ";
+    }
+
+    if (fMinLDca>=0.0) {
+      if (fMaxLDca>=0.0) {
+       ldca.Form(" %.02f<=longitudinal_dca<=%.02f", fMinLDca, fMaxLDca);
+      } else {
+       ldca.Form(" longitudinal_dca >= %.02f", fMinLDca);
+      }
+    } else if (fMaxLDca>=0.0) {
+       ldca.Form(" longitudinal_dca<=%.02f", fMaxLDca);
+    }
+    if (!ldca.IsNull()) {
+      if (op1st.IsNull()) op1st=" && ";
+      else op2nd=" && ";
+    }
+
+    if (fMinTDca>=0.0 || fMaxTDca>=0 || fMinLDca>=0.0 || fMaxLDca>=0) {
+      dcaref.Form(" (%.01f,%.01f,%.01f)", fDCAReference[0], fDCAReference[1], fDCAReference[2]);
+    }
+
     if (numberOfTracks>=fMinTracks) {
       description.Form("Event contains %d track(s) with ", numberOfTracks);
       description+=ptcut;
+      description+=op1st;
+      description+=ldca;
+      description+=op2nd;
+      description+=tdca;
+      description+=dcaref;
       SetDescription(description.Data());
       // Enable the central detectors for readout.
       GetReadoutList().Enable(
@@ -132,8 +180,14 @@ int AliHLTTriggerBarrelMultiplicity::DoTrigger()
       TriggerEvent(true);
       return 0;
     }
-    description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, %s)",
-                    fMinTracks, ptcut.Data());
+    description.Form("No tracks matching the tresholds found in the central barrel (min tracks %d, ", fMinTracks);
+    description+=ptcut;
+    description+=op1st;
+    description+=ldca;
+    description+=op2nd;
+    description+=tdca;
+    description+=dcaref;
+    description+=")";
   } else {
     description.Form("No input blocks found");
   }
@@ -143,14 +197,28 @@ int AliHLTTriggerBarrelMultiplicity::DoTrigger()
 }
 
 template<class T>
-bool AliHLTTriggerBarrelMultiplicity::CheckCondition(T* track)
+bool AliHLTTriggerBarrelMultiplicity::CheckCondition(T* track, float b)
 {
   // see header file for class documentation
-  if (track && track->Pt() >= fPtMin &&
-      (fPtMax<=fPtMin || track->Pt() < fPtMax)) {
-    return true;
+  if (!track) return false;
+
+  // check on ptransverse momentum
+  if (TMath::Abs(track->Pt()) < fPtMin || (fPtMax>fPtMin && TMath::Abs(track->Pt()) > fPtMax)) {
+    return false;
+  }
+
+  // check on transverse and longitudinal DCA
+  if (fMinTDca>=0.0 || fMaxTDca>=0 || fMinLDca>=0.0 || fMaxLDca>=0) {
+    Float_t dz[2]={0.0,0.0};
+    track->GetDZ(fDCAReference[0], fDCAReference[1], fDCAReference[2], b, dz);
+    HLTDebug("checking dca condition: transversal %f logitudinal %f", dz[0], dz[1]);
+    if (fMinTDca>=0 && TMath::Abs(dz[0])<fMinTDca) return false;
+    if (fMaxTDca>=0 && TMath::Abs(dz[0])>fMaxTDca) return false;
+    if (fMinLDca>=0 && TMath::Abs(dz[1])<fMinLDca) return false;
+    if (fMaxLDca>=0 && TMath::Abs(dz[1])>fMaxLDca) return false;
   }
-  return false;
+
+  return true;
 }
 
 int AliHLTTriggerBarrelMultiplicity::DoInit(int argc, const char** argv)
@@ -158,7 +226,9 @@ int AliHLTTriggerBarrelMultiplicity::DoInit(int argc, const char** argv)
   // see header file for class documentation
 
   // first configure the default
-  int iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
+  int iResult=0;
+  iResult=ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
+  if (iResult>=0) iResult=ConfigureFromCDBTObjString(fgkOCDBEntry);
 
   // configure from the command line parameters if specified
   if (iResult>=0 && argc>0)
@@ -178,11 +248,23 @@ int AliHLTTriggerBarrelMultiplicity::Reconfigure(const char* cdbEntry, const cha
 
   // configure from the specified antry or the default one
   const char* entry=cdbEntry;
-  if (!entry || entry[0]==0) entry=fgkOCDBEntry;
+  if (!entry || entry[0]==0) {
+    ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
+    entry=fgkOCDBEntry;
+  }
 
   return ConfigureFromCDBTObjString(entry);
 }
 
+int AliHLTTriggerBarrelMultiplicity::ReadPreprocessorValues(const char* /*modules*/)
+{
+  // see header file for class documentation
+
+  // TODO 2009-09-10: implementation
+  // for the moment very quick, just reload the magnetic field
+  return ConfigureFromCDBTObjString(kAliHLTCDBSolenoidBz);
+}
+
 int AliHLTTriggerBarrelMultiplicity::ScanConfigurationArgument(int argc, const char** argv)
 {
   // see header file for class documentation
@@ -213,7 +295,68 @@ int AliHLTTriggerBarrelMultiplicity::ScanConfigurationArgument(int argc, const c
     fMinTracks=argument.Atoi();
     return 2;
   }    
+
+  // -dca-reference
+  // reference point for the transverse and longitudinal dca cut
+  if (argument.CompareTo("-dca-reference")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    // scan x,y,z
+    TObjArray* pTokens=argument.Tokenize("'");
+    if (pTokens) {
+      for (int c=0; c<pTokens->GetEntriesFast() && c<fgkDCAReferenceSize; c++) {
+       argument=((TObjString*)pTokens->At(c))->GetString();
+       fDCAReference[i]=argument.Atof();
+      }
+      delete pTokens;
+    }
+    return 2;
+  }
+
+  // -min-ldca
+  // minimum longitudinal dca to reference point
+  if (argument.CompareTo("-min-ldca")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    fMinLDca=argument.Atof();
+    return 2;
+  }
   
+  // -max-ldca
+  // maximum longitudinal dca to reference point
+  if (argument.CompareTo("-max-ldca")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    fMaxLDca=argument.Atof();
+    return 2;
+  }
+
+  // -min-tdca
+  // minimum transverse dca to reference point
+  if (argument.CompareTo("-min-tdca")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    fMinTDca=argument.Atof();
+    return 2;
+  }
+  
+  // -max-tdca
+  // maximum transverse dca to reference point
+  if (argument.CompareTo("-max-tdca")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    fMaxTDca=argument.Atof();
+    return 2;
+  }
+
+  // -solenoidBz
+  if (argument.CompareTo("-solenoidBz")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    fSolenoidBz=argument.Atof();
+    return 2;
+  }
+
   // unknown argument
   return -EINVAL;
 }
index 19e2c6660c368149d7c241ef0d9612c5ba30909b..0074406feccaf434956b97927b4b9d4840c195ba 100644 (file)
@@ -45,12 +45,25 @@ class AliESDtrack;
  *      required minimum pt for a trigger
  * \li -maxpt    <i> pt  </i> <br>
  *      required maximum pt for a trigger
+ * \li -dca-reference    <i> x,y,z  </i> <br>
+ *      reference point for the transverse and longitudinal dca cut
+ * \li -min-ldca    <i> dca  </i> <br>
+ *      minimum longitudinal dca to reference point
+ * \li -max-ldca    <i> dca  </i> <br>
+ *      maximum longitudinal dca to reference point
+ * \li -min-tdca    <i> dca  </i> <br>
+ *      minimum transverse dca to reference point
+ * \li -max-tdca    <i> dca  </i> <br>
+ *      maximum transverse dca to reference point
+ * \li  -solenoidBz    <i> field  </i> <br>
+ *      magnetic field needed if the input is not an ESD object
  *
  * By default, configuration is loaded from OCDB, can be overridden by
  * component arguments.
  *
  * <h2>Default CDB entries:</h2>
  * HLT/ConfigHLT/BarrelMultiplicityTrigger: TObjString storing the arguments
+ * HLT/ConfigHLT/Solenoidbz: TObjString -solenoidBz field
  *
  * <h2>Performance:</h2>
  * 
@@ -84,6 +97,9 @@ class AliHLTTriggerBarrelMultiplicity : public AliHLTTrigger
   /// inherited from AliHLTComponent: handle re-configuration event
   int Reconfigure(const char* cdbEntry, const char* chainId);
 
+  /// inherited from AliHLTComponent: handle dcs update event
+  int ReadPreprocessorValues(const char* modules);
+
   /// inherited from AliHLTComponent, scan one argument and
   /// its parameters
   int ScanConfigurationArgument(int argc, const char** argv);
@@ -94,7 +110,7 @@ class AliHLTTriggerBarrelMultiplicity : public AliHLTTrigger
 
   /// check whether a track meets the criteria
   template<class T>
-  bool CheckCondition(T* track);
+  bool CheckCondition(T* track, float b);
 
   /// pt cut, minimum
   float fPtMin; //! transient
@@ -103,6 +119,21 @@ class AliHLTTriggerBarrelMultiplicity : public AliHLTTrigger
   /// required number of tracks
   int fMinTracks; //!transient
 
+  /// number of coordinates for the DCA reference point
+  const static short fgkDCAReferenceSize=3;
+  /// reference point for the transverse and longitudinal dca cut
+  float fDCAReference[fgkDCAReferenceSize];
+  /// minimum longitudinal dca to reference point
+  float fMinLDca;
+  /// maximum longitudinal dca to reference point
+  float fMaxLDca;
+  /// minimum transverse dca to reference point
+  float fMinTDca;
+  /// maximum transverse dca to reference point
+  float fMaxTDca;
+  /// magnetic field (dca estimation for)
+  float fSolenoidBz;
+
   /// the default configuration entry for this component
   static const char* fgkOCDBEntry; //!transient
 
diff --git a/HLT/trigger/macros/rec-BarrelMultiplicityTrigger.C b/HLT/trigger/macros/rec-BarrelMultiplicityTrigger.C
new file mode 100644 (file)
index 0000000..bbc259c
--- /dev/null
@@ -0,0 +1,45 @@
+void rec_BarrelMultiplicityTrigger(const char *filename="../raw.root")
+{
+  if(!gSystem->AccessPathName("galice.root")){
+    cerr << "You have to run in a subfolder of the original data directory. If so, please delete the galice.root." << endl;
+    return;
+  }
+
+  if (!filename) {
+    cerr << "please specify input or run without arguments" << endl;
+    return;
+  }
+  // Set the CDB storage location
+  AliCDBManager * man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local:///opt/HLT-public/OCDB/LHC09c");
+
+  ///////////////////////////////////////////////////////////////////////////////////////////////////
+  //
+  // init the HLT system in order to define the analysis chain below
+  //
+  AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
+  ///////////////////////////////////////////////////////////////////////////////////////////////////
+  //
+  // define the analysis chain to be run
+  //
+  AliHLTConfiguration pubconf("hltesd-publisher", "ESDMCEventPublisher", NULL , "-entrytype HLTESD -datapath ..");
+
+  AliHLTConfiguration triggerconf("multiplicity-trigger", "BarrelMultiplicityTrigger", "hltesd-publisher" , "-max-tdca 60");
+  AliHLTConfiguration globaltriggerconf("global-trigger", "HLTGlobalTrigger", "multiplicity-trigger" , "");
+
+  // Reconstruction settings
+  AliReconstruction rec;
+
+  // QA options
+  rec.SetRunQA(":") ;
+
+  // AliReconstruction settings
+  rec.SetInput(filename);
+  //rec.SetEventRange(0,20);
+  rec.SetRunReconstruction("HLT TPC");
+  rec.SetOption("HLT", "loglevel=0x7c chains=hltesd-publisher,global-trigger ignore-hltout");
+
+  rec.Run();
+
+}