]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- added first sketch of trigger component for selecting cosmics tracks in the TPC...
authorkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Mar 2011 11:42:52 +0000 (11:42 +0000)
committerkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Mar 2011 11:42:52 +0000 (11:42 +0000)
- respective test macro running on ESD input

HLT/CMakelibAliHLTTrigger.pkg
HLT/trigger/AliHLTTriggerAgent.cxx
HLT/trigger/AliHLTTriggerCosmics.cxx [new file with mode: 0644]
HLT/trigger/AliHLTTriggerCosmics.h [new file with mode: 0644]
HLT/trigger/AliHLTTriggerLinkDef.h
HLT/trigger/macros/testCosmicsTrigger.C [new file with mode: 0644]

index 9524c650b0923d03d2cc56b36db51d050c0a9ac4..c60f4bded67b3953db11d5a29d937569ed606e02 100644 (file)
@@ -51,6 +51,7 @@ set ( CLASS_HDRS
     AliHLTMuonSpectroScalars.h
     AliHLTMuonSpectroTriggerComponent.h
     AliHLTUpcTriggerComponent.h
+    AliHLTTriggerCosmics.h
     AliHLTTriggerCounterComponent.h
     AliHLTTriggerCounters.h
     )
index 21a92956d4278d5d75414fea4e76f0f135bce4d8..75fd6813cf7c951798850d1a8a52a588ee34519a 100644 (file)
@@ -48,6 +48,7 @@
 #include "AliHLTTriggerGammaConversion.h"
 #include "AliHLTMuonSpectroTriggerComponent.h"
 #include "AliHLTUpcTriggerComponent.h"
+#include "AliHLTTriggerCosmics.h"
 #include "AliHLTTriggerCounterComponent.h"
 
 
@@ -90,6 +91,7 @@ int AliHLTTriggerAgent::RegisterComponents(AliHLTComponentHandler* pHandler) con
   pHandler->AddComponent(new AliHLTTriggerGammaConversion);
   pHandler->AddComponent(new AliHLTMuonSpectroTriggerComponent);
   pHandler->AddComponent(new AliHLTUpcTriggerComponent);
+  pHandler->AddComponent(new AliHLTTriggerCosmics);
   pHandler->AddComponent(new AliHLTTriggerCounterComponent);
   return 0;
 }
diff --git a/HLT/trigger/AliHLTTriggerCosmics.cxx b/HLT/trigger/AliHLTTriggerCosmics.cxx
new file mode 100644 (file)
index 0000000..7a681a6
--- /dev/null
@@ -0,0 +1,464 @@
+// $Id$
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Kalliopi Kanaki <Kalliopi.Kanaki@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.                  *
+//**************************************************************************
+
+/// @file   AliHLTTriggerCosmics.cxx
+/// @author Kalliopi Kanaki
+/// @date   2011-02-25
+/// @brief  HLT trigger component for tagging cosmics tracks in the TPC
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTTriggerCosmics.h"
+#include "AliESDtrack.h"
+#include "AliESDEvent.h"
+#include "AliHLTTriggerDecision.h"
+#include "AliHLTDomainEntry.h"
+#include "AliHLTGlobalBarrelTrack.h"
+#include "AliHLTErrorGuard.h"
+#include "AliTPCcalibTime.h"
+#include "AliTracker.h"
+
+#include "TObjArray.h"
+#include "TObjString.h"
+#include "TDatabasePDG.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTriggerCosmics)
+
+AliHLTTriggerCosmics::AliHLTTriggerCosmics()
+  : AliHLTTrigger()
+  , fName()
+  , fTrackSelection()
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+const char* AliHLTTriggerCosmics::fgkDefaultOCDBEntry="HLT/ConfigHLT/CosmicsTrigger";
+
+AliHLTTriggerCosmics::~AliHLTTriggerCosmics(){
+// see header file for class documentation
+}
+
+const char* AliHLTTriggerCosmics::GetTriggerName() const{
+// see header file for class documentation
+
+  if (!fName.IsNull())
+    return fName.Data();
+  else
+    return "CosmicsTrigger";
+}
+
+AliHLTComponent* AliHLTTriggerCosmics::Spawn(){
+  // see header file for class documentation
+  return new AliHLTTriggerCosmics;
+}
+
+int AliHLTTriggerCosmics::DoTrigger(){
+// see header file for class documentation
+  if (!IsDataEvent()) {
+    IgnoreEvent();  // dont generate any trigger decision.
+  }
+
+  int iResult=0;
+  int numberOfCosmics=-1;
+
+  const TObject *obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
+  AliESDEvent *esd   = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
+  if(!esd){
+     printf("Empty ESD\n"); 
+     return 0;
+  }
+  esd->GetStdContent();
+  
+  Int_t startTime = esd->GetTimeStamp()-60*60*1;  //Start time one hour before first event, will make precise cuts later.
+  Int_t   endTime = esd->GetTimeStamp()+60*60*23; //End time 23 hours after first event.
+  fTrackSelection = new AliTPCcalibTime("calibTime","time dependent Vdrift calibration", startTime, endTime, 20*60);
+  
+  fTrackSelection->UpdateEventInfo(esd); // needed for getting the run number and time stamp information correct on the offline side
+    
+  //TArrayI clusterSideA(esd->GetNumberOfTracks());
+  //TArrayI clusterSideC(esd->GetNumberOfTracks());
+  Float_t bz = AliTracker::GetBz();
+  Double_t vtxx[3]={0,0,0};
+  Double_t svtxx[3]={0.000001,0.000001,100.};
+  AliESDVertex vtx(vtxx,svtxx);
+
+  for(Int_t i=0; i<esd->GetNumberOfTracks(); ++i){
+
+    AliESDtrack *track0 = esd->GetTrack(i); // track 0 upper part   
+    if(!track0) continue;    
+    if(!track0->GetOuterParam()) continue;
+    if(track0->GetOuterParam()->GetAlpha()<0) continue;
+    Double_t d1[3];
+    track0->GetDirection(d1);    
+
+    for(Int_t j=0; j<esd->GetNumberOfTracks(); ++j){
+      
+      if(i==j) continue;
+      AliESDtrack *track1 = esd->GetTrack(j); //track 1 lower part
+      if(!track1) continue; 
+      if(!track1->GetOuterParam()) continue;
+      if( track0->GetTPCNcls() + track1->GetTPCNcls()< 80 /*kMinClusters*/) continue;
+      
+      //Int_t nAC = TMath::Max( TMath::Min(clusterSideA[i], clusterSideC[j]), TMath::Min(clusterSideC[i], clusterSideA[j]));
+      //if(nAC<30/*kMinClustersCross*/) continue; 
+      //Int_t nA0 = clusterSideA[i];
+      //Int_t nC0 = clusterSideC[i];
+      //Int_t nA1 = clusterSideA[j];
+      //Int_t nC1 = clusterSideC[j];
+      //      if (track1->GetOuterParam()->GetAlpha()>0) continue;
+      //
+      Double_t d2[3];
+      track1->GetDirection(d2);
+      
+//       AliTPCseed * seed0 = (AliTPCseed*) tpcSeeds.At(i);
+//       AliTPCseed * seed1 = (AliTPCseed*) tpcSeeds.At(j);
+//       if (! seed0) continue; 
+//       if (! seed1) continue;
+      Float_t dir = (d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2]);
+      Float_t dist0  = track0->GetLinearD(0,0);
+      Float_t dist1  = track1->GetLinearD(0,0);
+      //
+      // conservative cuts - convergence to be guarantied
+      // applying before track propagation
+      if (TMath::Abs(TMath::Abs(dist0)-TMath::Abs(dist1))>3 /*fCutMaxD*/) continue;   // distance to the 0,0
+      if (TMath::Abs(dir)<TMath::Abs(-0.99/*fCutMinDir*/)) continue;               // direction vector product
+                  
+      Float_t dvertex0[2];   //distance to 0,0
+      Float_t dvertex1[2];   //distance to 0,0 
+      track0->GetDZ(0,0,0,bz,dvertex0);
+      track1->GetDZ(0,0,0,bz,dvertex1);
+      if (TMath::Abs(dvertex0[1])>250) continue;
+      if (TMath::Abs(dvertex1[1])>250) continue;
+
+      Float_t dmax = TMath::Max(TMath::Abs(dist0),TMath::Abs(dist1));
+      AliExternalTrackParam param0(*track0);
+      AliExternalTrackParam param1(*track1);
+      //
+      // Propagate using Magnetic field and correct for material budget
+      //    
+      
+      AliTracker::PropagateTrackTo(&param0,dmax+1,TDatabasePDG::Instance()->GetParticle("e-")->Mass(),3,kTRUE);
+      AliTracker::PropagateTrackTo(&param1,dmax+1,TDatabasePDG::Instance()->GetParticle("e-")->Mass(),3,kTRUE);
+            
+      // Propagate rest to the 0,0 DCA - z should be ignored
+
+      param0.PropagateToDCA(&vtx,bz,1000);
+      param1.PropagateToDCA(&vtx,bz,1000);
+      param0.GetDZ(0,0,0,bz,dvertex0);
+      param1.GetDZ(0,0,0,bz,dvertex1);
+      
+      Double_t xyz0[3];
+      Double_t xyz1[3];
+      param0.GetXYZ(xyz0);
+      param1.GetXYZ(xyz1);
+      Bool_t isPair  = fTrackSelection->IsPair(&param0,&param1);
+      Bool_t isCross = fTrackSelection->IsCross(track0, track1);
+      Bool_t isSame  = fTrackSelection->IsSame(track0, track1);
+
+      if((isSame) || (isCross && isPair)){
+       if( track0->GetTPCNcls() + track1->GetTPCNcls()> 80 ){
+          numberOfCosmics++;
+       }
+      }
+    } // end 2nd order loop        
+  } // end 1st order loop
+  
+  bool condition = false;
+  TString description;
+  if(numberOfCosmics>0){    
+     description.Form("Event contains %d cosmics", numberOfCosmics);
+     condition = true;
+  } 
+  else {
+    if(IsDataEvent()) {
+      description.Form("No input blocks found");
+    } else {
+      description.Form("No DataEvent found");
+    }
+  }
+   
+   SetDescription(description.Data());
+  // add a specific trigger decision object with initialized name
+  // the readout list however is fixed 
+  AliHLTTriggerDecision decision(
+                                condition,
+                                GetTriggerName(),
+                                GetReadoutList(),
+                                GetDescription()
+                                );
+  TriggerEvent(&decision, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
+
+  return iResult;
+}
+
+int AliHLTTriggerCosmics::DoInit(int argc, const char** argv){
+// see header file for class documentation
+
+  int iResult = 0;
+
+  // check if the -triggername argument is used
+  // the name of the trigger determines the following initialization
+  vector<const char*> remainingArgs;
+  for (int i=0; i<argc; i++) {
+    if (strcmp(argv[i], "-triggername")==0) {
+      if (++i<argc) fName=argv[i];
+      else {
+       HLTError("invalid parameter for argument '-triggername', string expected");
+       return -EINVAL;
+      }
+      continue;
+    }
+    remainingArgs.push_back(argv[i]);
+  }
+
+  // get path from triggername, use default object otherwise
+  TString cdbPath;
+  if (!fName.IsNull()) {
+    cdbPath="HLT/ConfigHLT/";
+    cdbPath+=fName;
+  } else {
+    cdbPath=fgkDefaultOCDBEntry;
+  }
+
+  iResult = ConfigureFromCDBObject(cdbPath);
+
+  // -- Configure from the command line parameters if specified
+  if (iResult>=0 && argc>0) iResult = ConfigureFromArgumentString(remainingArgs.size(), &(remainingArgs[0]));
+
+  return iResult;
+}
+
+int AliHLTTriggerCosmics::DoDeinit(){
+// see header file for class documentation
+
+  if(fTrackSelection) delete fTrackSelection; fTrackSelection = NULL;
+  return 0;
+}
+
+int AliHLTTriggerCosmics::Reconfigure(const char* cdbEntry, const char* /*chainId*/){
+// see header file for class documentation
+
+  // configure from the specified antry or the default one
+  TString cdbPath;
+  if (!cdbEntry || cdbEntry[0]==0) {
+    if (!fName.IsNull()) {
+      cdbPath="HLT/ConfigHLT/";
+      cdbPath+=fName;
+    } else {
+      cdbPath=fgkDefaultOCDBEntry;
+    }
+  } else {
+    cdbPath=cdbEntry;
+  }
+
+  return ConfigureFromCDBObject(cdbPath);
+}
+
+int AliHLTTriggerCosmics::ReadPreprocessorValues(const char* /*modules*/){
+// see header file for class documentation
+  return 0;
+}
+
+Int_t AliHLTTriggerCosmics::ConfigureFromCDBObject(TString cdbPath){
+// see header file for class documentation
+
+  Int_t iResult = 0;
+  TString arguments;
+
+  // -- check for "-" and replace by "_._" in the path name
+  cdbPath.ReplaceAll("-",1,"_._",3);
+
+  TObject *pCDBObject = LoadAndExtractOCDBObject(cdbPath);
+  if (pCDBObject) {
+//     AliHLTESDTrackCuts *pCuts = dynamic_cast<AliHLTESDTrackCuts*>(pCDBObject);
+//     if (pCuts) {
+//       HLTInfo("Received AliHLTESDTrackCuts configuration object : \'%s\'", pCuts->GetTitle());
+//       if (fHLTESDTrackCuts)
+//     delete fHLTESDTrackCuts;
+//       fHLTESDTrackCuts = pCuts;
+//     }
+//     else {
+//       TObjString *pString = dynamic_cast<TObjString*>(pCDBObject);
+//       if(pString){
+//     HLTInfo("Received configuration object string: \'%s\'", pString->GetString().Data());
+//     arguments+=pString->GetString().Data();
+//       } 
+//       else{
+//     HLTError("Configuration object \"%s\" has wrong type, required AliHLTESDTrackCuts or TObjString", cdbPath.Data());
+//     iResult=-EINVAL;
+//       }
+//     }
+  } 
+  else {
+    HLTError("Cannot fetch object \"%s\" from CDB", cdbPath.Data());
+    iResult=-ENOENT;
+  }
+  
+  if( iResult>=0 && !arguments.IsNull() ){
+    const Char_t* array = arguments.Data();
+    iResult = ConfigureFromArgumentString(1, &array);
+  }
+
+  return iResult;
+}
+
+//int AliHLTTriggerCosmics::ScanConfigurationArgument(int argc, const char** argv){
+// see header file for class documentation
+
+//   if (argc<=0) return 0;
+//   int i=0;
+//   TString argument=argv[i];
+// 
+//   if (!fHLTESDTrackCuts)
+//     fHLTESDTrackCuts = new AliHLTESDTrackCuts("AliHLTESDTrackCuts","No track cuts");
+// 
+//   // -maxpt
+//   if (argument.CompareTo("-maxpt")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+// 
+//     Float_t minPt, maxPt;
+//     fHLTESDTrackCuts->GetPtRange(minPt,maxPt);
+//     maxPt = argument.Atof(); 
+//     fHLTESDTrackCuts->SetPtRange(minPt,maxPt);
+// 
+//     TString title = fHLTESDTrackCuts->GetTitle();
+//     if (!title.CompareTo("No track cuts")) title = "";
+//     else title += " && ";
+//     title += Form("p_t < %f", maxPt);
+//     fHLTESDTrackCuts->SetTitle(title);
+//     return 2;
+//   }    
+// 
+//   // -minpt
+//   if (argument.CompareTo("-minpt")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+// 
+//     Float_t minPt, maxPt;
+//     fHLTESDTrackCuts->GetPtRange(minPt,maxPt);
+//     minPt = argument.Atof(); 
+//     fHLTESDTrackCuts->SetPtRange(minPt,maxPt);
+// 
+//     TString title = fHLTESDTrackCuts->GetTitle();
+//     if (!title.CompareTo("No track cuts")) title = "";
+//     else title += " && ";
+//     title += Form("p_t > %f", minPt);
+//     fHLTESDTrackCuts->SetTitle(title);
+//     return 2;
+//   }    
+// 
+//   // -mintracks
+//   if (argument.CompareTo("-mintracks")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+//     fMinTracks=argument.Atoi();
+//     return 2;
+//   }    
+// 
+//   // -min-ldca
+//   // minimum longitudinal dca to vertex
+//   if (argument.CompareTo("-min-ldca")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+// 
+//     fHLTESDTrackCuts->SetMinDCAToVertexZ(argument.Atof());
+//     TString title = fHLTESDTrackCuts->GetTitle();
+//     if (!title.CompareTo("No track cuts")) title = "";
+//     else title += " && ";
+//     title += Form("DCAz > %f", argument.Atof());
+//     fHLTESDTrackCuts->SetTitle(title);
+//     return 2;
+//   }
+//   
+//   // -max-ldca
+//   // maximum longitudinal dca to vertex
+//   if (argument.CompareTo("-max-ldca")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+// 
+//     fHLTESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof());
+//     TString title = fHLTESDTrackCuts->GetTitle();
+//     if (!title.CompareTo("No track cuts")) title = "";
+//     else title += " && ";
+//     title += Form("DCAz < %f", argument.Atof());
+//     fHLTESDTrackCuts->SetTitle(title);
+//     return 2;
+//   }
+// 
+//   // -min-tdca
+//   // minimum transverse dca to vertex
+//   if (argument.CompareTo("-min-tdca")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+// 
+//     fHLTESDTrackCuts->SetMinDCAToVertexXY(argument.Atof());
+//     TString title = fHLTESDTrackCuts->GetTitle();
+//     if (!title.CompareTo("No track cuts")) title = "";
+//     else title += " && ";
+//     title += Form("DCAr > %f", argument.Atof());
+//     fHLTESDTrackCuts->SetTitle(title);
+//     return 2;
+//   }
+//   
+//   // -max-tdca
+//   // maximum transverse dca to vertex
+//   if (argument.CompareTo("-max-tdca")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     argument=argv[i];
+// 
+//     fHLTESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof());
+//     TString title = fHLTESDTrackCuts->GetTitle();
+//     if (!title.CompareTo("No track cuts")) title = "";
+//     else title += " && ";
+//     title += Form("DCAr < %f", argument.Atof());
+//     fHLTESDTrackCuts->SetTitle(title);
+//     return 2;
+//   }
+// 
+//   // -- deprecated
+// 
+//   // -dca-reference
+//   // reference point for the transverse and longitudinal dca cut
+//   if (argument.CompareTo("-dca-reference")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     HLTWarning("argument -dca-reference deprecated, ESDTrackCuts only allow for DCA to vertex");
+//     return 2;
+//   }
+// 
+//   // -solenoidBz
+//   if (argument.CompareTo("-solenoidBz")==0) {
+//     if (++i>=argc) return -EPROTO;
+//     HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
+//     return 2;
+//   }
+// 
+//   // unknown argument
+//   return -EINVAL;
+//}
diff --git a/HLT/trigger/AliHLTTriggerCosmics.h b/HLT/trigger/AliHLTTriggerCosmics.h
new file mode 100644 (file)
index 0000000..bb222d1
--- /dev/null
@@ -0,0 +1,146 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTRIGGERCOSMICS_H
+#define ALIHLTTRIGGERCOSMICS_H
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/// @file   AliHLTTriggerCosmics.h
+/// @author Kalliopi Kanaki
+/// @date   2011-02-23
+/// @brief  HLT trigger component for tagging cosmics tracks inside the TPC
+
+#include "AliHLTTrigger.h"
+#include "TString.h"
+
+class AliESDtrack;
+class AliTPCcalibTime;
+
+/**
+ * @class AliHLTTriggerCosmics
+ * HLT trigger component for charged particle multiplicity in the
+ * central barrel.
+ * 
+ * Triggers on charged particle number in a certain pt range and geometrical
+ * acceptance
+ * 
+ * Multiple instances of this component can serve different trigger
+ * conditions, i.e. component parameters. The different instances get
+ * different names, specified by the '-triggername' component argument.
+ * The configuration is loaded from OCDB entries according to the name, see
+ * below.
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b BarrelMultiplicityTrigger                             <br>
+ * Library: \b libAliHLTTrigger.so                                        <br>
+ * Input Data Types:  kAliHLTDataTypeESDObject, kAliHLTDataTypeESDTree
+ *                    kAliHLTDataTypeTrack                                <br>
+ * Output Data Types: ::kAliHLTAnyDataType                                <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Optional arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -mintracks     <i> n   </i> <br>
+ *      required number of tracks for a trigger
+ * \li -minpt    <i> pt  </i> <br>
+ *      required minimum pt for a trigger
+ * \li -maxpt    <i> pt  </i> <br>
+ *      required maximum pt for a trigger
+ * \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 -triggername    <i> name  </i> <br>
+ *      The name of this specific trigger.
+ *
+ * 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 <br>
+ * HLT/ConfigHLT/<name>: for triggers with specific names
+ *
+ * HLT/ConfigHLT/H_._Barrel_pT_Single_._V0001.001
+ *   - TriggerName : H-Barrel_pT_Single-V0001.001
+ *   - ObjectType  : AliHLTESDTrackCuts 
+ * HLT/ConfigHLT/H_._Barrel_pT_Single_._V0002.001
+ *   - TriggerName : H-Barrel_pT_Single-V0002.001
+ *   - ObjectType  : AliHLTESDTrackCuts 
+ * HLT/ConfigHLT/H_._Barrel_pT_Single_._V0003.001
+ *   - TriggerName : H-Barrel_pT_Single-V0003.001
+ *   - ObjectType  : AliHLTESDTrackCuts 
+ *
+ * <h2>Performance:</h2>
+ * 
+ *
+ * <h2>Memory consumption:</h2>
+ * 
+ *
+ * <h2>Output size:</h2>
+ * 
+ *
+ * \ingroup alihlt_trigger_components
+ */
+class AliHLTTriggerCosmics : public AliHLTTrigger
+{
+ public:
+  AliHLTTriggerCosmics();
+  virtual ~AliHLTTriggerCosmics();
+
+  /// inherited from AliHLTTrigger: name of this trigger
+  virtual const char* GetTriggerName() const;
+  /// inherited from AliHLTComponent: create an instance
+  virtual AliHLTComponent* Spawn();
+
+ protected:
+  /// inherited from AliHLTComponent: handle the initialization
+  int DoInit(int argc, const char** argv);
+
+  /// inherited from AliHLTComponent: handle cleanup
+  int DoDeinit();
+
+  /// 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);
+
+  /// Configure from CDB object, checking if AliHLTESDTrackCuts or TObjString
+  int ConfigureFromCDBObject(TString cdbPath);
+
+  /// inherited from AliHLTComponent, scan one argument and
+  /// its parameters
+  //int ScanConfigurationArgument(int argc, const char** argv);
+
+ private:
+  /// copy constructor prohibited 
+  AliHLTTriggerCosmics (const AliHLTTriggerCosmics&);
+  
+  /// assignment operator prohibited
+  AliHLTTriggerCosmics& operator=(const AliHLTTriggerCosmics&);
+
+  /// inherited from AliHLTTrigger: calculate the trigger
+  virtual int DoTrigger();
+
+  /// Name of the trigger
+  TString  fName;               //! transient
+  /// object for accessing the offline code 
+  AliTPCcalibTime *fTrackSelection; //! transient
+  
+  /// the default configuration entry for this component
+  static const char* fgkDefaultOCDBEntry; //!transient
+
+  ClassDef(AliHLTTriggerCosmics, 1)
+};
+#endif //ALIHLTTRIGGERCOSMICS_H
index c55a56f7549290cd0143c96c250f12c9517ef574..52012f22de762160114ebebf6ccfa300bc3fb56d 100644 (file)
@@ -28,6 +28,7 @@
 #pragma link C++ class AliHLTMuonSpectroScalars::AliScalar+;
 #pragma link C++ class AliHLTMuonSpectroTriggerComponent+;
 #pragma link C++ class AliHLTUpcTriggerComponent+;
+#pragma link C++ class AliHLTTriggerCosmics+;
 #pragma link C++ class AliHLTTriggerCounterComponent+;
 #pragma link C++ class AliHLTTriggerCounters+;
 #pragma link C++ class AliHLTTriggerCounters::AliCounter+;
diff --git a/HLT/trigger/macros/testCosmicsTrigger.C b/HLT/trigger/macros/testCosmicsTrigger.C
new file mode 100644 (file)
index 0000000..abb7886
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ * @file testCosmicsTrigger.C
+ * @brief Test macro for the cosmics trigger
+ *
+ * Usage:
+ * <pre>
+ *   aliroot -b -q testCosmicsTrigger.C'("./","HLTesdTree","local://$ALICE_ROOT/OCDB", nOfEvents)' | tee cosmics-trigger.log
+ *   aliroot -b -q testCosmicsTrigger.C'("./","esdTree","local://$ALICE_ROOT/OCDB", nOfEvents)' | tee cosmics-trigger.log
+ *   aliroot -b -q testCosmicsTrigger.C'("alien:///alice/data/...","HLTesdTree","local://$ALICE_ROOT/OCDB", nOfEvents)' | tee cosmics-trigger.log
+ * </pre>
+ *
+ * The macro takes as input an ESD file, as the component works on ESD tracks. 
+ * The user can speficy which tree will be used. 
+ *
+ * @author Kalliopi Kanaki (Kalliopi.Kanaki@ift.uib.no)
+ */
+
+void testCosmicsTrigger(const char *esdfilename,
+                       const char *treename,
+                       const char *cdbURI,
+                       int nofEvents=-1
+                       )
+{
+  // check the name of the tree
+  TString strtree=treename;
+  if (strtree.CompareTo("esdTree")==0) strtree="ESD";
+  else if (strtree.CompareTo("HLTesdTree")==0) strtree="HLTESD";
+  else {
+    cerr << "invalid treename '" << treename << "', supported 'esdTree' and 'HLTesdTree'" << endl;
+    return;
+  }
+
+  // connect to the GRID if we use a file or OCDB from the GRID
+  TString struri=cdbURI;
+  TString strfile=esdfilename;
+  if (struri.BeginsWith("raw://") ||
+      strfile.Contains("://") && !strfile.Contains("local://")) {
+    TGrid::Connect("alien");
+  }
+
+  // open the ESD file and get the event count
+  if (!strfile.EndsWith("/")) strfile+="/";
+  strfile+="AliESDs.root";
+  TFile* esdfile=TFile::Open(strfile);
+  if (!esdfile || esdfile->IsZombie()) {
+    cerr << "cannot open file " << strfile << endl;
+    return;
+  }
+
+  // get number of events
+  TTree* pTree=NULL;
+  esdfile->GetObject(treename, pTree);
+  if (!pTree) {
+    cerr << "can not find " << treename << " in file " << strfile << endl;
+    return;
+  }
+  if (pTree->GetEntries()<=0) {
+    cerr << "empty tree " << treename << " in file " << strfile << endl;
+    return;
+  }
+  
+  AliESDEvent* esd=new AliESDEvent;
+  esd->ReadFromTree(pTree);
+  pTree->GetEntry(0);
+
+  if (nofEvents<0 || nofEvents>pTree->GetEntries())
+    nofEvents=pTree->GetEntries();
+
+  // Set the CDB storage location
+  AliCDBManager *man = AliCDBManager::Instance();
+  man->SetDefaultStorage(cdbURI);
+  man->SetRun(esd->GetRunNumber());
+  if (struri.BeginsWith("local://")) {
+    // set specific storage for GRP entry
+    // search in the working directory and one level above, the latter
+    // follows the standard simulation setup like e.g. in test/ppbench
+    if (!gSystem->AccessPathName("GRP/GRP/Data")) {
+      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
+    } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
+      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");      
+    }
+  }
+
+  //////////////////////////////////////////////////////////////////////////////////////
+  //
+  // setup the HLT system
+  AliHLTSystem *pHLT = AliHLTPluginBase::GetInstance();
+  
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libTPCcalib");  
+  
+  TString arguments, triggerinput;
+
+  // ESD publisher component
+  arguments=" -datapath "; arguments+=esdfilename;
+  arguments+=" -entrytype "; arguments+=strtree;
+  triggerinput="ESD-publisher";
+
+  AliHLTConfiguration esdpublisher(triggerinput.Data(), "ESDMCEventPublisher", "", arguments.Data());
+
+  AliHLTConfiguration cosmicstr("cosmics-trigger","CosmicsTrigger", triggerinput.Data(),"");
+  //AliHLTConfiguration globaltriggerconf("global-trigger", "HLTGlobalTrigger", "cosmics-trigger" , "");
+    
+  // set option for the HLT system
+  // arguments
+  //  - libraries to be used as plugins
+  //  - loglevel=0x79 : Important, Warning, Error, Fatal
+  pHLT->ScanOptions("libAliHLTUtil.so libAliHLTMUON.so libAliHLTTRD.so libAliHLTGlobal.so libAliHLTTrigger.so loglevel=0x79");
+
+  pHLT->BuildTaskList("cosmics-trigger");
+  //pHLT->BuildTaskList("global-trigger");
+  pHLT->Run(nofEvents);
+}
+
+void testCosmicsTrigger(){
+   cout << "=====================" << endl;
+   cout << "  " << endl;
+   cout << "Usage: aliroot -b -q testCosmicsTrigger.C\'(\"./\",\"HLTesdTree\",\"local://$ALICE_ROOT/OCDB\", nOfEvents)\' | tee cosmics-trigger.log" << endl;
+   cout << "  " << endl;
+   cout << "=====================" << endl;
+
+
+}