Modifications to take into account new muon esd structure (P. Cortese)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jun 2007 14:52:29 +0000 (14:52 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jun 2007 14:52:29 +0000 (14:52 +0000)
STEER/AliAODTrack.cxx
STEER/AliAODTrack.h
STEER/CreateAODfromESD.C

index 4eb7a0b..e30a527 100644 (file)
@@ -34,7 +34,8 @@ AliAODTrack::AliAODTrack() :
   fProdVertex(0x0),
   fCharge(-99),
   fITSMuonClusterMap(0),
-  fType(kUndef)
+  fType(kUndef),
+  fChi2MatchTrigger(0.)
 {
   // default constructor
 
@@ -66,7 +67,8 @@ AliAODTrack::AliAODTrack(Int_t id,
   fProdVertex(prodVertex),
   fCharge(charge),
   fITSMuonClusterMap(itsClusMap),
-  fType(ttype)
+  fType(ttype),
+  fChi2MatchTrigger(0.)
 {
   // constructor
  
@@ -102,7 +104,8 @@ AliAODTrack::AliAODTrack(Int_t id,
   fProdVertex(prodVertex),
   fCharge(charge),
   fITSMuonClusterMap(itsClusMap),
-  fType(ttype)
+  fType(ttype),
+  fChi2MatchTrigger(0.)
 {
   // constructor
  
@@ -132,7 +135,8 @@ AliAODTrack::AliAODTrack(const AliAODTrack& trk) :
   fProdVertex(trk.fProdVertex),
   fCharge(trk.fCharge),
   fITSMuonClusterMap(trk.fITSMuonClusterMap),
-  fType(trk.fType)
+  fType(trk.fType),
+  fChi2MatchTrigger(0.)
 {
   // Copy constructor
 
@@ -409,3 +413,104 @@ void AliAODTrack::Print(Option_t* /* option */) const
   printf(" PID object: %p\n", PID());
 }
 
+void AliAODTrack::SetMatchTrigger(Int_t MatchTrigger){
+  switch(MatchTrigger){
+    case 0: // 0 track does not match trigger
+      fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff;
+      break;
+    case 1: // 1 track match but does not pass pt cut
+      fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x40000000;
+      break;
+    case 2: // 2 track match Low pt cut
+      fITSMuonClusterMap=(fITSMuonClusterMap&0x3fffffff)|0x80000000;
+      break;
+    case 3: // 3 track match High pt cut
+      fITSMuonClusterMap=fITSMuonClusterMap|0xc0000000;
+      break;
+    default:
+      fITSMuonClusterMap=fITSMuonClusterMap&0x3fffffff;
+      printf("AliAODTrack::SetMatchTrigger unknown case for MatchTrigger: %d\n",MatchTrigger);
+  }
+}
+
+void AliAODTrack::SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh){
+  fITSMuonClusterMap=(fITSMuonClusterMap&0xffff00ff)|(hitsPatternInTrigCh<<8);
+}
+
+Int_t AliAODTrack::HitsMT(Int_t istation, Int_t iplane, Char_t *cathode){
+  if(cathode){
+    if(cathode[0]=='x'||cathode[0]=='X'){
+      if(istation==1){
+        if(iplane==1)
+         return (fITSMuonClusterMap&0x8000)?1:0;
+       else if(iplane==2)
+         return (fITSMuonClusterMap&0x4000)?1:0;
+       else
+         return 0;
+      }else if(istation==2){
+        if(iplane==1)
+         return (fITSMuonClusterMap&0x2000)?1:0;
+       else if(iplane==2)
+         return (fITSMuonClusterMap&0x1000)?1:0;
+       else
+         return 0;
+      }else{
+        return 0;
+      }
+    }else if(cathode[0]=='y'||cathode[0]=='Y'){
+      if(istation==1){
+        if(iplane==1)
+         return (fITSMuonClusterMap&0x0800)?1:0;
+       else if(iplane==2)
+         return (fITSMuonClusterMap&0x0400)?1:0;
+       else
+         return 0;
+      }else if(istation==2){
+        if(iplane==1)
+         return (fITSMuonClusterMap&0x0200)?1:0;
+       else if(iplane==2)
+         return (fITSMuonClusterMap&0x0100)?1:0;
+       else
+         return 0;
+      }else{
+        return 0;
+      }
+    }else{
+      return 0;
+    }
+  }else{
+    if(istation==1){
+      if(iplane==1)
+       return (HitsMT(1,1,"X")||HitsMT(1,1,"Y"))?1:0;
+      else if(iplane==2)
+       return (HitsMT(1,2,"X")||HitsMT(1,2,"Y"))?1:0;
+      else
+       return 0;
+    }else if(istation==2){
+      if(iplane==1)
+       return (HitsMT(2,1,"X")||HitsMT(2,1,"Y"))?1:0;
+      else if(iplane==2)
+       return (HitsMT(2,2,"X")||HitsMT(2,2,"Y"))?1:0;
+      else
+       return 0;
+    }else{
+      return 0;
+    }
+  }
+}
+
+Int_t AliAODTrack::HitsMuonChamber(Int_t MuonChamber){
+  switch(MuonChamber){
+    case 11:
+      return HitsMT(1,1);
+    case 12:
+      return HitsMT(1,2);
+    case 13:
+      return HitsMT(2,1);
+    case 14:
+      return HitsMT(2,2);
+    default:
+      printf("Unknown MUON chamber: %d\n",MuonChamber);
+      return 0;
+  }
+}
index 1305e70..32161ea 100644 (file)
@@ -177,6 +177,23 @@ class AliAODTrack : public AliVirtualParticle {
   void SetMuonClusterMap(UInt_t muonClusMap)       { fITSMuonClusterMap = muonClusMap*65536; }
   void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; }
 
+  Int_t    GetMatchTrigger() const {return fITSMuonClusterMap>>30;}
+                                       //  0 Muon track does not match trigger
+                                       //  1 Muon track match but does not pass pt cut
+                                       //  2 Muon track match Low pt cut
+                                       //  3 Muon track match High pt cut
+  void     SetMatchTrigger(Int_t MatchTrigger);
+  Int_t    MatchTrigger(){ return (GetMatchTrigger()>0)?1:0; } //  Muon track matches trigger track
+  Int_t    MatchTriggerAnyPt(){ return (GetMatchTrigger()>0)?1:0; }    //  Muon track matches trigger track
+  Int_t    MatchTriggerLowPt(){ return (GetMatchTrigger()>1)?1:0; }    //  Muon track matches trigger track and passes Low pt cut
+  Int_t    MatchTriggerHighPt(){ return (GetMatchTrigger()>2)?1:0; }   //  Muon track matches trigger track and passes High pt cut
+  Double_t GetChi2MatchTrigger() const {return fChi2MatchTrigger;}
+  void     SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;}
+  UShort_t GetHitsPatternInTrigCh() const { return (fITSMuonClusterMap&0xff00)>>8; }
+  void     SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh);
+  Int_t HitsMT(Int_t istation, Int_t iplane, Char_t *cathode=0);  // Check if track hits Muon chambers
+  Int_t HitsMuonChamber(Int_t MuonChamber);  // Check if track hits Muon chambers
+
   void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
 
   // name and title
@@ -201,6 +218,7 @@ class AliAODTrack : public AliVirtualParticle {
   UInt_t        fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer (ITS: bit 1-8, muon: bit 17-32) 
   Char_t        fType;              // Track Type
 
+  Double_t fChi2MatchTrigger; // chi2 of trigger/track matching
 
   ClassDef(AliAODTrack,2);
 };
index d13ae5e..bd75e41 100644 (file)
@@ -622,7 +622,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
       // has to be changed once the muon pid is provided by the ESD
       for (Int_t i = 0; i < 10; pid[i++] = 0.); pid[AliAODTrack::kMuon]=1.;
       
-      primary->AddDaughter(
+      primary->AddDaughter( aodTrack =
          new(tracks[jTracks++]) AliAODTrack(0, // no ID provided
                                             0, // no label provided
                                             p,
@@ -638,6 +638,13 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                             kTRUE,  // not used for vertex fit
                                             AliAODTrack::kPrimary)
          );
+       aodTrack->SetHitsPatternInTrigCh(esdMuTrack->GetHitsPatternInTrigCh());
+       Int_t track2Trigger = esdMuTrack->GetMatchTrigger();
+       aodTrack->SetMatchTrigger(track2Trigger);
+       if (track2Trigger) 
+         aodTrack->SetChi2MatchTrigger(esdMuTrack->GetChi2MatchTrigger());
+       else 
+         aodTrack->SetChi2MatchTrigger(0.);
     }
     
     // Access to the AOD container of clusters