D0 trigger update by Gaute
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Dec 2009 14:01:50 +0000 (14:01 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Dec 2009 14:01:50 +0000 (14:01 +0000)
- clean up
- Able to use AliHLTGlobalBarrel Track and ESD tracks

HLT/trigger/AliHLTD0Trigger.cxx
HLT/trigger/AliHLTD0Trigger.h
HLT/trigger/AliHLTD0toKpi.cxx
HLT/trigger/AliHLTD0toKpi.h

index 97b3363..eeb49fd 100644 (file)
@@ -39,6 +39,7 @@
 #include "TH1F.h"
 #include "AliHLTD0toKpi.h"
 #include "AliAODVertex.h"
+#include "AliESDVertex.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTD0Trigger)
@@ -61,6 +62,8 @@ AliHLTD0Trigger::AliHLTD0Trigger()
   , fd0calc(NULL)                  
   , ftwoTrackArray(NULL)
   , fTotalD0(0)
+  , fVertex(NULL)
+  , fField(0)
 {
   
   // see header file for class documentation
@@ -103,19 +106,44 @@ int AliHLTD0Trigger::DoTrigger()
   Int_t nD0=0;
   TString description;
 
-    HLTDebug("Cuts: -pt:%f -dca:%f -invmass:%f -costhetastar:%f -d0:%f -d0d0:%f -cospoint:%f",fPtMin,fdca,finvMass,fcosThetaStar,fd0,fd0d0,fcosPoint);
-
   for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {   
     if(fUseV0){
       nD0=RecV0(iter);
     }
     else{
-      nD0=RecESDTracks(iter);
+       AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
+       event->GetStdContent();
+       fField = event->GetMagneticField();
+       const AliESDVertex* pv = event->GetPrimaryVertexTracks();
+       fVertex =  new AliESDVertex(*pv);
+       
+       for(Int_t it=0;it<event->GetNumberOfTracks();it++){
+        SingleTrackSelect(event->GetTrack(it));
+       }
+       
+       nD0=RecD0();
     }
   }
 
-  for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeTrack); iter != NULL; iter = GetNextInputObject() ) { 
-    nD0=RecBarrelTracks(iter);
+  for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); 
+       iter != NULL; iter = GetNextInputObject() ) { 
+    fVertex = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ));
+    if(!fVertex){
+      HLTError("ITS SPD vertex object is corrupted");
+      //iResult = -EINVAL;    
+    }
+  }  
+   
+  for ( const AliHLTComponentBlockData* iter = GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginITS); 
+       iter != NULL; iter = GetNextInputBlock() ) { 
+    vector<AliHLTGlobalBarrelTrack> tracksVector;
+    AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(iter->fPtr), iter->fSize, tracksVector);
+    
+    fField = GetBz();
+    for(UInt_t i=0;i<tracksVector.size();i++){
+      SingleTrackSelect(&tracksVector[i]);
+    }
+    nD0=RecD0();
   }    
 
   fTotalD0+=nD0;
@@ -123,9 +151,9 @@ int AliHLTD0Trigger::DoTrigger()
   ftwoTrackArray->Clear();
   fPos.clear();
   fNeg.clear();
-  
-  HLTDebug("Number of D0 found: %d",nD0);
-  HLTDebug("Total Number of D0 found: %d",fTotalD0);
+     
+  HLTInfo("Number of D0 found: %d",nD0);
+  HLTInfo("Total Number of D0 found: %d",fTotalD0);
 
   if(fplothisto){PushBack( (TObject*) fD0mass, kAliHLTDataTypeHistogram,0);}
   
@@ -186,6 +214,7 @@ int AliHLTD0Trigger::DoDeinit()
   if(fd0calc){delete fd0calc;}  
   if(fD0mass){delete fD0mass;}
   if(ftwoTrackArray){delete ftwoTrackArray;}
+  if(fVertex){delete fVertex;}
   return 0;
 }
 
@@ -272,11 +301,13 @@ int AliHLTD0Trigger::ScanConfigurationArgument(int argc, const char** argv)
   return -EINVAL;
 }
 
-void AliHLTD0Trigger::SingleTrackSelect(AliESDtrack* t, Double_t b,Double_t* pv){
+void AliHLTD0Trigger::SingleTrackSelect(AliExternalTrackParam* t){
   // Offline har || på disse kuttene på de to henfallsproduktene 
-    
+  Double_t pv[3];
+  fVertex->GetXYZ(pv);
+
   if(t->Pt()<fPtMin){return;}
-  if(TMath::Abs(t->GetD(pv[0],pv[1],b)) > fd0){return;}
+  if(TMath::Abs(t->GetD(pv[0],pv[1],fField)) > fd0){return;}
 
   if(t->Charge()>0){
     fPos.push_back(t);
@@ -286,7 +317,7 @@ void AliHLTD0Trigger::SingleTrackSelect(AliESDtrack* t, Double_t b,Double_t* pv)
   }
 }
 
-Int_t AliHLTD0Trigger::RecESDTracks(const TObject* iter){
+Int_t AliHLTD0Trigger::RecD0(){
   
   int nD0=0;
   Double_t D0,D0bar,xdummy,ydummy; 
@@ -294,30 +325,26 @@ Int_t AliHLTD0Trigger::RecESDTracks(const TObject* iter){
   Double_t svpos[3];
   Double_t pvpos[3];
   
-  AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
-  event->GetStdContent();
-  Double_t field = event->GetMagneticField();
-  const AliESDVertex* pv = event->GetPrimaryVertexTracks();
-  pv->GetXYZ(pvpos);
-  
-  for(Int_t it=0;it<event->GetNumberOfTracks();it++){
-    SingleTrackSelect(event->GetTrack(it),field,pvpos);
+  if(!fVertex){
+    HLTError("No Vertex is set");
+    return 0;
   }
-  
-  for(Int_t ip=0;ip<fPos.size();ip++){
-    AliESDtrack *tP=fPos[ip];
-    for(Int_t in=0;in<fNeg.size();in++){
-      AliESDtrack *tN=fNeg[in];
-      
-      tP->PropagateToDCA(pv,field,kVeryBig);  //do I need this??????
-      tN->PropagateToDCA(pv,field,kVeryBig);
+  fVertex->GetXYZ(pvpos);
+    
+  for(UInt_t ip=0;ip<fPos.size();ip++){
+    AliExternalTrackParam *tP=fPos[ip];
+    for(UInt_t in=0;in<fNeg.size();in++){
+      AliExternalTrackParam *tN=fNeg[in];
+          
+      tP->PropagateToDCA(fVertex,fField,kVeryBig);  //do I need this??????
+      tN->PropagateToDCA(fVertex,fField,kVeryBig);
       
-      Double_t dcatPtN = tP->GetDCA(tN,field,xdummy,ydummy);
+      Double_t dcatPtN = tP->GetDCA(tN,fField,xdummy,ydummy);
       if(dcatPtN>fdca) { continue; }
       
-      ftwoTrackArray->AddAt(fPos[ip],0);
-      ftwoTrackArray->AddAt(fNeg[in],1);
-      AliAODVertex *vertexp1n1 = fd0calc->ReconstructSecondaryVertex(ftwoTrackArray,field,pv);
+      ftwoTrackArray->AddAt(tP,0);
+      ftwoTrackArray->AddAt(tN,1);
+      AliAODVertex *vertexp1n1 = fd0calc->ReconstructSecondaryVertex(ftwoTrackArray,fField,fVertex);
       if(!vertexp1n1) { 
        ftwoTrackArray->Clear();
        continue; 
@@ -325,14 +352,14 @@ Int_t AliHLTD0Trigger::RecESDTracks(const TObject* iter){
       
       vertexp1n1->GetXYZ(svpos);
       
-      tP->PropagateToDCA(vertexp1n1,field,kVeryBig); 
-      tN->PropagateToDCA(vertexp1n1,field,kVeryBig);
+      tP->PropagateToDCA(vertexp1n1,fField,kVeryBig); 
+      tN->PropagateToDCA(vertexp1n1,fField,kVeryBig);
       
       if((TMath::Abs(fd0calc->InvMass(tN,tP)-mD0PDG)) > finvMass && TMath::Abs((fd0calc->InvMass(tP,tN))-mD0PDG) > finvMass){continue;}
       fd0calc->cosThetaStar(tN,tP,D0,D0bar);
       if(TMath::Abs(D0) > fcosThetaStar && TMath::Abs(D0bar) > fcosThetaStar){continue;}
-      d0[0] = tP->GetD(pvpos[0],pvpos[1],field);
-      d0[1] = tN->GetD(pvpos[0],pvpos[1],field);
+      d0[0] = tP->GetD(pvpos[0],pvpos[1],fField);
+      d0[1] = tN->GetD(pvpos[0],pvpos[1],fField);
       if((d0[0]*d0[1]) > fd0d0){continue;}
       if(fd0calc->pointingAngle(tN,tP,pvpos,svpos) < fcosPoint){continue;}
       
@@ -404,9 +431,3 @@ Int_t AliHLTD0Trigger::RecV0(const TObject* iter){
   return nD0;
   
 }
-
-Int_t AliHLTD0Trigger::RecBarrelTracks(const TObject* iter){
-
-  return 0;
-
-}
index f431733..539c9e4 100644 (file)
 
 #include "AliHLTTrigger.h"
 #include <vector>
-#include "AliESDtrack.h"
+#include "AliHLTD0toKpi.h"
 
 class TH1F;
 class TObjArray;
-class AliHLTD0toKpi;
+class AliESDVertex;
+class AliExternalTrackParam;
 
 /**
  * @class  AliHLTD0Trigger
@@ -99,11 +100,10 @@ class AliHLTD0Trigger : public AliHLTTrigger
 
   /// inherited from AliHLTTrigger: calculate the trigger
   virtual int DoTrigger();
-
-  void SingleTrackSelect(AliESDtrack*,Double_t,Double_t*);
-  Int_t RecESDTracks(const TObject* iter);
+  
+  void SingleTrackSelect(AliExternalTrackParam*);
   Int_t RecV0(const TObject* iter);
-  Int_t RecBarrelTracks(const TObject* iter);
+  Int_t RecD0();
 
   /// pt cut for decay, minimum [GeV/c]
   float fPtMin;                                            //! transient
@@ -128,14 +128,16 @@ class AliHLTD0Trigger : public AliHLTTrigger
   /// D0 inv. mass plot
   TH1F *fD0mass;                                           //! transient  
 
-  vector<AliESDtrack*> fPos;                                //! transient
-  vector<AliESDtrack*> fNeg;                                //! transient
-
-  AliHLTD0toKpi *fd0calc;                                    //! transient
-  TObjArray *ftwoTrackArray;                                 //! transient
+  vector<AliExternalTrackParam*> fPos;                       //! transient
+  vector<AliExternalTrackParam*> fNeg;                       //! transient
 
-  Int_t fTotalD0;                                            //! transient
+  AliHLTD0toKpi *fd0calc;                                   //! transient
+  TObjArray *ftwoTrackArray;                                //! transient
 
+  Int_t fTotalD0;                                           //! transient
+  AliESDVertex *fVertex;                                 //! transient
+  Double_t fField;                                         //!transient
+  
   /// the default configuration entry for this component
   static const char* fgkOCDBEntry; //!transient
 
index 47705ec..9eff08c 100644 (file)
@@ -8,7 +8,8 @@
 #include "AliESDVertex.h"
 #include "TObjArray.h"
 #include "AliVertexerTracks.h"
-
+#include "AliHLTGlobalBarrelTrack.h"
+#include "AliExternalTrackParam.h"
 
 ClassImp(AliHLTD0toKpi)
 
@@ -16,7 +17,7 @@ AliHLTD0toKpi::AliHLTD0toKpi()
 {
 }
 
-Double_t AliHLTD0toKpi::InvMass(AliESDtrack* d1, AliESDtrack* d2)
+Double_t AliHLTD0toKpi::InvMass(AliExternalTrackParam* d1, AliExternalTrackParam* d2)
 {
   Double_t mpi=TDatabasePDG::Instance()->GetParticle(211)->Mass();
   Double_t mK=TDatabasePDG::Instance()->GetParticle(321)->Mass();
@@ -36,7 +37,7 @@ Double_t AliHLTD0toKpi::InvMass(AliESDtrack* d1, AliESDtrack* d2)
   return TMath::Sqrt((energy[0]+energy[1])*(energy[0]+energy[1])-momTot2);
 
 }
-void AliHLTD0toKpi::cosThetaStar(AliESDtrack* d1, AliESDtrack* d2,Double_t &D0,Double_t &D0bar)
+void AliHLTD0toKpi::cosThetaStar(AliExternalTrackParam* d1, AliExternalTrackParam* d2,Double_t &D0,Double_t &D0bar)
 {
   Double_t mD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();
   Double_t mpi=TDatabasePDG::Instance()->GetParticle(211)->Mass();
@@ -67,7 +68,7 @@ void AliHLTD0toKpi::cosThetaStar(AliESDtrack* d1, AliESDtrack* d2,Double_t &D0,D
   D0bar = (qL/gamma-beta*TMath::Sqrt(pStar*pStar+mK*mK))/pStar;
 
 }
-Double_t AliHLTD0toKpi::pointingAngle(AliESDtrack* n, AliESDtrack* p, Double_t *pv, Double_t *sv)
+Double_t AliHLTD0toKpi::pointingAngle(AliExternalTrackParam* n, AliExternalTrackParam* p, Double_t *pv, Double_t *sv)
 {
 
   TVector3 mom(n->Px()+p->Px(),n->Py()+p->Py(),n->Pz()+p->Pz());
@@ -78,16 +79,22 @@ Double_t AliHLTD0toKpi::pointingAngle(AliESDtrack* n, AliESDtrack* p, Double_t *
   return TMath::Cos(pta); 
 }
 
-AliAODVertex* AliHLTD0toKpi::ReconstructSecondaryVertex(TObjArray *trkArray, Double_t b, const AliESDVertex *v)
+AliAODVertex* AliHLTD0toKpi::ReconstructSecondaryVertex(TObjArray *trkArray, Double_t b, AliESDVertex *v)
 {
   
   AliESDVertex *vertexESD = 0;
   AliAODVertex *vertexAOD = 0;
   
   AliVertexerTracks *vertexer = new AliVertexerTracks(b);
-  AliESDVertex* fV1 = new AliESDVertex(*v);
-  vertexer->SetVtxStart(fV1);
-  vertexESD = (AliESDVertex*)vertexer->VertexForSelectedESDTracks(trkArray);
+  vertexer->SetVtxStart(v);
+  //if(isESD){vertexESD = (AliESDVertex*)vertexer->VertexForSelectedESDTracks(trkArray);}
+  UShort_t *id = new UShort_t[2];
+  AliHLTGlobalBarrelTrack *t1 = (AliHLTGlobalBarrelTrack*) trkArray->At(0);
+  AliHLTGlobalBarrelTrack *t2 = (AliHLTGlobalBarrelTrack*) trkArray->At(1);
+  id[0]=(UShort_t) t1->GetID();
+  id[1]=(UShort_t) t2->GetID();
+  vertexESD = (AliESDVertex*)vertexer->VertexForSelectedTracks(trkArray,id);
+  delete id;
   delete vertexer; vertexer=NULL;
   
   if(!vertexESD) return vertexAOD;
index 30035a3..7c7fdec 100644 (file)
 
 #include "TObject.h"
 
-class AliESDtrack;
-class AliAODVertex;
 class AliESDVertex;
 class TObjArray;
+class AliExternalTrackParam;
+class AliAODVertex;
 
 class AliHLTD0toKpi : public TObject
 {
 public:
   AliHLTD0toKpi();
-  Double_t InvMass(AliESDtrack* d1, AliESDtrack* d2);
-  void cosThetaStar(AliESDtrack* n, AliESDtrack* p,Double_t &D0,Double_t &D0bar);
-  Double_t pointingAngle(AliESDtrack* n, AliESDtrack* p, Double_t *pv, Double_t *sv);
 
-  AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray, Double_t b, const AliESDVertex *v);
+  Double_t InvMass(AliExternalTrackParam* d1, AliExternalTrackParam* d2);
+  void cosThetaStar(AliExternalTrackParam* n, AliExternalTrackParam* p,Double_t &D0,Double_t &D0bar);
+  Double_t pointingAngle(AliExternalTrackParam* n, AliExternalTrackParam* p, Double_t *pv, Double_t *sv);
+
+  AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray, Double_t b, AliESDVertex *v);
 
 private: