MCEvent::GetTrack gives back *VParticle.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Sep 2009 16:12:39 +0000 (16:12 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Sep 2009 16:12:39 +0000 (16:12 +0000)
Cast to *MCParticle needed

22 files changed:
ANALYSIS/AliAnalysisTaskMCParticleFilter.cxx
FMD/analysis/AliFMDAnalysisTaskDndeta.cxx
FMD/analysis/AliFMDAnalysisTaskGenerateCorrection.cxx
FMD/analysis/AliFMDAnalysisTaskSharing.cxx
PWG1/AliAnalysisTaskV0QA.cxx
PWG1/AliMaterialBudget.cxx
PWG1/AliPerformanceEff.cxx
PWG1/AliPerformanceMC.cxx
PWG1/AliPerformanceRes.cxx
PWG2/EVCHAR/AliAnalysisTaskSPDdNdEta.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx
PWG2/RESONANCES/AliRsnAnalysisEffSE.cxx
PWG2/RESONANCES/AliRsnAnalysisTrackEffSE.cxx
PWG2/SPECTRA/AliProtonQAAnalysis.cxx
PWG3/hfe/AliAnalysisTaskHFE.cxx
PWG3/hfe/AliHFEpidBase.cxx
PWG3/muon/AliAnalysisTaskLinkToMC.cxx
PWG3/muon/AliCFMuonResTask1.cxx
STEER/AliMCEvent.cxx
STEER/AliMCEvent.h
TRD/qaRec/AliTRDcheckESD.cxx
TRD/qaRec/AliTRDinfoGen.cxx

index 5d5233a97902db77f48b7b03e70aaf3095aa3271..2a13ecac2a098df6020c046e0aca8c44ecb41f84 100644 (file)
@@ -247,7 +247,7 @@ void AliAnalysisTaskMCParticleFilter::UserExec(Option_t */*option*/)
 
   Int_t j=0;
   for (Int_t ip = 0; ip < np; ip++){
-    AliMCParticle* mcpart =  mcE->GetTrack(ip);
+    AliMCParticle* mcpart = (AliMCParticle*) mcE->GetTrack(ip);
     TParticle* part = mcpart->Particle();
     Float_t xv = part->Vx();
     Float_t yv = part->Vy();
@@ -265,11 +265,11 @@ void AliAnalysisTaskMCParticleFilter::UserExec(Option_t */*option*/)
       AliMCParticle* mother = mcpart;
       Int_t imo = mcpart->GetMother();
       while((imo >= nprim) && (mother->GetUniqueID() == 4)) {
-       mother = mcE->GetTrack(imo);
+       mother =  (AliMCParticle*) mcE->GetTrack(imo);
        imo =  mother->GetMother();
       }
       // Select according to pseudorapidity and production point of primary ancestor
-      if (imo < nprim && Select(mcE->GetTrack(imo)->Particle(), rv, zv))write = kTRUE;         
+      if (imo < nprim && Select(((AliMCParticle*) mcE->GetTrack(imo))->Particle(), rv, zv))write = kTRUE;         
     } else if (part->GetUniqueID() == 5) {
       // Now look for pair production
       Int_t imo = mcpart->GetMother();
@@ -278,10 +278,10 @@ void AliAnalysisTaskMCParticleFilter::UserExec(Option_t */*option*/)
        write = kTRUE;
       } else {
        // Check if the gamma comes from the decay chain of a primary particle
-       AliMCParticle* mother = mcE->GetTrack(imo);
+       AliMCParticle* mother =  (AliMCParticle*) mcE->GetTrack(imo);
        imo = mother->GetMother();
        while((imo >= nprim) && (mother->GetUniqueID() == 4)) {
-         mother =  mcE->GetTrack(imo);
+         mother =   (AliMCParticle*) mcE->GetTrack(imo);
          imo =  mother->GetMother();
        }
        // Select according to pseudorapidity and production point 
@@ -316,7 +316,7 @@ void AliAnalysisTaskMCParticleFilter::UserExec(Option_t */*option*/)
   static int  iAll = 0;
   static int  iCharm = 0;
   for (Int_t ip = 0; ip < np; ip++){
-    AliMCParticle* mcpart =  mcE->GetTrack(ip);
+    AliMCParticle* mcpart =   (AliMCParticle*) mcE->GetTrack(ip);
     TParticle* part = mcpart->Particle();
 
     //    if((TMath::Abs(part->GetPdgCode())/400)==1){
index 668d705db9e25bcb5c511aada32f1fcd7de01775..38e52777bdb913db7b0cc1ac6495826c0edb9ab9 100644 (file)
@@ -244,7 +244,7 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() {
     nTracks = stack->GetNtrack();
   
   for(Int_t i = 0 ;i<nTracks;i++) {
-    particle = mcEvent->GetTrack(i);
+    particle = (AliMCParticle*) mcEvent->GetTrack(i);
     if(!particle)
       continue;
    
index d484e57eb83134834b21818b8ac3b8121cfd7728..0b7cb36817301ad898bd4d6cd2fca08b7785ae28 100644 (file)
@@ -192,7 +192,7 @@ void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/)
   //   hTriggeredAll->Fill(vertexBin);
   
   for(Int_t i = 0 ;i<nTracks;i++) {
-    particle = mcevent->GetTrack(i);
+    particle = (AliMCParticle*) mcevent->GetTrack(i);
     
     if(!particle)
       continue;
index 6bf271a2933cba8bf25a2ff92754bdbb4afe9afc..c8d39a7ca46e526f7b11cc39a95aa862a6314397 100644 (file)
@@ -388,7 +388,7 @@ void AliFMDAnalysisTaskSharing::ProcessPrimary() {
   Int_t nTracks = stack->GetNprimary();
   TH1F* nMCevents = (TH1F*)fDiagList->FindObject("nMCEventsNoCuts");
   for(Int_t i = 0 ;i<nTracks;i++) {
-    particle = mcEvent->GetTrack(i);
+    particle = (AliMCParticle*) mcEvent->GetTrack(i);
     if(!particle)
       continue;
     
index 0bdfc456e8114291ae2e94fc3ff2c1f0fd80bccb..d00c05401017597b1a27913827b5619f6fe9721a 100644 (file)
@@ -825,7 +825,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* ePosTPC;
        mctruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,clRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(posiGIndex);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(posiGIndex));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
@@ -862,7 +862,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* eNegTPC;
        mctruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,clRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(elecGIndex);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(elecGIndex));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
@@ -949,7 +949,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* ePosTPC;
        mctruth->MCEvent()->GetParticleAndTR(piPosK0Index,ePosTPC,clRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(piPosK0Index);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(piPosK0Index));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
@@ -984,7 +984,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* eNegTPC;
        mctruth->MCEvent()->GetParticleAndTR(piNegK0Index,eNegTPC,clRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(piNegK0Index);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(piNegK0Index));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
@@ -1071,7 +1071,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* ePosTPC;
        mctruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,clRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(pPosLIndex);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(pPosLIndex));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
@@ -1106,7 +1106,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* eNegTPC;
        mctruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,clRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(piNegLIndex);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(piNegLIndex));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
@@ -1198,7 +1198,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* ePosTPC;
        mctruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,clRefsP);
 
-       AliMCParticle *mcParticlePos = mctruth->MCEvent()->GetTrack(piPosALIndex);
+       AliMCParticle *mcParticlePos = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(piPosALIndex));
        if(!mcParticlePos) continue;
 
        Int_t counter; 
@@ -1230,7 +1230,7 @@ void AliAnalysisTaskV0QA::Exec(Option_t *) {
        TParticle* eNegTPC;
        mctruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,clRefsN);
 
-       AliMCParticle *mcParticleNeg = mctruth->MCEvent()->GetTrack(apNegALIndex);
+       AliMCParticle *mcParticleNeg = (AliMCParticle*) (mctruth->MCEvent()->GetTrack(apNegALIndex));
        if(!mcParticleNeg) continue;
 
        Int_t counterN; 
index 6152c964e2cd345b02f5101fcc1b8bc937f44091..2c422fd95185dc9cdefb0ff1280dd847039c9ade 100644 (file)
@@ -337,7 +337,7 @@ void  AliMaterialBudget::ProcessMCInfo(){
   //
   for (Int_t ipart=0;ipart<npart;ipart++){
     Int_t status = fMCinfo->GetParticleAndTR(ipart, particle, trefs);
-    AliMCParticle * pp = fMCinfo->GetTrack(ipart);
+    AliMCParticle * pp = (AliMCParticle*) fMCinfo->GetTrack(ipart);
     if (!pp) continue;
     if (particle->P()<kPcut) continue;
     Double_t mass = particle->GetMass();
@@ -767,7 +767,7 @@ void AliMaterialBudget::FindPairs(AliESDEvent * event) {
       // HERE WE WILL PUT THE ACCESS TO THE MC TRACKS AND MATCH THESE !!!!
       //
       Int_t label0 = TMath::Abs(track0->GetLabel());
-      AliMCParticle *mcParticle0 = fMCinfo->GetTrack(label0);
+      AliMCParticle *mcParticle0 = (AliMCParticle*) fMCinfo->GetTrack(label0);
       TParticle *particle0 = mcParticle0->Particle();
       AliTrackReference *ref0 = GetFirstTPCTrackRef(mcParticle0); // get the first TPC track reference
       if (!ref0) continue;
@@ -775,7 +775,7 @@ void AliMaterialBudget::FindPairs(AliESDEvent * event) {
       paramMC0 = MakeTrack(ref0, particle0);
       //
       Int_t label1 = TMath::Abs(track1->GetLabel());
-      AliMCParticle *mcParticle1 = fMCinfo->GetTrack(label1);
+      AliMCParticle *mcParticle1 = (AliMCParticle*) fMCinfo->GetTrack(label1);
       TParticle *particle1 = mcParticle1->Particle();
       AliTrackReference *ref1 = GetFirstTPCTrackRef(mcParticle1); // get the first TPC track reference
       if (!ref1) continue;
index e157cb5a1c3432cda5088412ffb53752b5f26e05..b947050cf289ef6081eb0dd3deae0f99648d8701 100644 (file)
@@ -659,7 +659,7 @@ Bool_t AliPerformanceEff::IsFindable(AliMCEvent *mcEvent, Int_t label)
 {\r
 if(!mcEvent) return kFALSE;\r
 \r
-  AliMCParticle *mcParticle = mcEvent->GetTrack(label);\r
+  AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(label);\r
   if(!mcParticle) return kFALSE;\r
 \r
   Int_t counter; \r
index 690a61a72769966fbc9f7f76c7cf66a72d5831d1..44de992a506c4803e0e4143dcf416655d5ec1fe0 100644 (file)
@@ -240,7 +240,7 @@ void AliPerformanceMC::Exec(AliMCEvent* const mcEvent, AliESDEvent *const /*esdE
     if(!part) continue;
     if(!trefs) continue;
 
-    AliMCParticle *mcParticle = mcEvent->GetTrack(iPart);
+    AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(iPart);
     if(!mcParticle) continue;
 
     TParticle *particle = mcParticle->Particle();
index c2f03c0b6b1ceadae35e99cc33a0be099371e6fc..16d608523a8acf65ad1b5e5259972585eb3ed2de 100644 (file)
@@ -512,7 +512,7 @@ void AliPerformanceRes::ProcessInnerTPC(AliMCEvent *const mcEvent, AliESDtrack *
   if(!mcEvent) return;
 
   Int_t label = TMath::Abs(esdTrack->GetLabel()); 
-  AliMCParticle *mcParticle = mcEvent->GetTrack(label);
+  AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(label);
   if(!mcParticle) return;
 
   // get the first TPC track reference
@@ -611,7 +611,7 @@ void AliPerformanceRes::ProcessOuterTPC(AliMCEvent *const mcEvent, AliESDtrack *
   if(!mcEvent) return;
 
   Int_t label = TMath::Abs(esdTrack->GetLabel()); 
-  AliMCParticle *mcParticle = mcEvent->GetTrack(label);
+  AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(label);
   if(!mcParticle) return;
 
   // get the last TPC track reference
index 347a5bd49f5b5d02fc91c384a7f06a1171ab6f0d..1cb46e32911e5c01309c87f49e173b6872d1018d 100644 (file)
@@ -690,7 +690,7 @@ void AliAnalysisTaskSPDdNdEta::Exec(Option_t *)
 
       fHistoPt->Fill(ptgen[multMCCharged]);
 
-      AliMCParticle* mcpart = mcEvent->GetTrack(imc);
+      AliMCParticle* mcpart = (AliMCParticle*) mcEvent->GetTrack(imc);
       Int_t nref = mcpart->GetNumberOfTrackReferences();
 
       // Detectable primaries 
index 89023cd8673511dce73e0571c5c58bc489d4b9f5..b4c426c941cc8553f5b1051f72eaa26d93a43df1 100644 (file)
@@ -88,7 +88,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, Ali
     //loop over tracks
     while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
       //get input particle
-      AliMCParticle* pParticle = anInput->GetTrack(itrkN);   
+      AliMCParticle* pParticle = (AliMCParticle*) anInput->GetTrack(itrkN);   
       //make new AliFlowTrackSimple
       AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
       pTrack->SetPt(pParticle->Pt() );
@@ -359,7 +359,7 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
       //get Label
       Int_t iLabel = pParticle->GetLabel();
       //match to mc particle
-      AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
+      AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
       
       //check
       if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<"  "<<pMcParticle->Label()<<endl;
@@ -568,7 +568,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
 
   //normal loop
   while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
-    AliMCParticle* pParticle = anInput->GetTrack(itrkN);   //get input particle
+    AliMCParticle* pParticle = (AliMCParticle*) anInput->GetTrack(itrkN);   //get input particle
     //cut on tracks
     if (TMath::Abs(pParticle->Eta()) < 0.9)
       {
@@ -779,7 +779,7 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
     //get Label
     Int_t iLabel = pParticle->GetLabel();
     //match to mc particle
-    AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
+    AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
     
     //check
     if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<"  "<<pMcParticle->Label()<<endl;
index 23fc80dbe24001f14e85737b91e04954ff15cc11..a7c4568869e2092bb3b9bbd3532eb30d44e19995 100644 (file)
@@ -221,14 +221,14 @@ void AliRsnAnalysisEffSE::ProcessEventMC(AliRsnPairDef *pairDef)
   // in this case, we first take the resonance from MC
   // and then we find its daughters and compute cuts on them
   for (ipart = 0; ipart < stack->GetNprimary(); ipart++) {
-    mother = fMCEvent->GetTrack(ipart);
+    mother = (AliMCParticle*) fMCEvent->GetTrack(ipart);
     if (mother->Particle()->GetNDaughters() != 2) continue;
 
     i[0] = mother->Particle()->GetFirstDaughter();
     i[1] = mother->Particle()->GetLastDaughter();
 
     for (j = 0; j < 2; j++) {
-      daughter = fMCEvent->GetTrack(i[j]);
+      daughter = (AliMCParticle*) fMCEvent->GetTrack(i[j]);
       fDaughter[j].SetRef(daughter);
       fDaughter[j].SetParticle(daughter->Particle());
       fDaughter[j].FindMotherPDG(stack);
index f8906c8a5c039706c31b7afc6171a1c594287186..75f3971746b3d06d36d5245e9318f980101afdb3 100644 (file)
@@ -174,7 +174,7 @@ void AliRsnAnalysisTrackEffSE::ProcessEventMC()
   // and then we find its daughters and compute cuts on them
   for (ipart = 0; ipart < fMCEvent->GetNumberOfTracks(); ipart++)
   {
-    part = fMCEvent->GetTrack(ipart);
+    part = (AliMCParticle*) fMCEvent->GetTrack(ipart);
 
     fDaughter.SetRef(part);
     fDaughter.SetParticle(part->Particle());
index ef6692dca2ee2377f4b715cfb3bee5d8a22d38c6..4e88f05d3c709dae271f111c520d41fd0d0ace2c 100644 (file)
@@ -3028,7 +3028,7 @@ void AliProtonQAAnalysis::RunReconstructionEfficiencyAnalysis(AliMCEvent *const
   TArrayI labelMCArray(nMCParticles);
 
   for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {
-    AliMCParticle *mcTrack = mcEvent->GetTrack(iTracks);
+    AliMCParticle *mcTrack = (AliMCParticle*) mcEvent->GetTrack(iTracks);
     if (!mcTrack) {
       Printf("ERROR: Could not receive track %d (mc loop)", iTracks);
       continue;
@@ -3096,7 +3096,7 @@ void AliProtonQAAnalysis::RunReconstructionEfficiencyAnalysis(AliMCEvent *const
        Int_t lPartMother = -1;
        Int_t motherPDGCode = -1;
        lPartMother = particle->GetFirstMother();
-       AliMCParticle *mcMotherTrack = mcEvent->GetTrack(lPartMother);
+       AliMCParticle *mcMotherTrack = (AliMCParticle*) mcEvent->GetTrack(lPartMother);
        TParticle *motherParticle = mcMotherTrack->Particle();
        if(motherParticle) motherPDGCode = motherParticle->GetPdgCode();
        
index 600784075a1131527794da3f189b4df9f4d38cd3..69a82024ec213d909e4c1d16fa4c8871ea4063cc 100644 (file)
@@ -362,7 +362,7 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
   // Loop MC
   //
   for(Int_t imc = fMC->GetNumberOfTracks(); imc--;){
-    mctrack = fMC->GetTrack(imc);
+    mctrack = (AliMCParticle*) fMC->GetTrack(imc);
 
     container[0] = mctrack->Pt();
     container[1] = mctrack->Eta();
@@ -426,7 +426,7 @@ void AliAnalysisTaskHFE::Exec(Option_t *){
     
 
     // Check if it is signal electrons
-    if(!(mctrack = fMC->GetTrack(TMath::Abs(track->GetLabel())))) continue;
+    if(!(mctrack = (AliMCParticle*) fMC->GetTrack(TMath::Abs(track->GetLabel())))) continue;
     
     container[3] = mctrack->Pt();
     container[4] = mctrack->Eta();
index 87f2fe1628c19eedc04fe86833853fbae68e8579..afb6117ce62af62b566dad7cb3437a8de310ede7 100644 (file)
@@ -85,7 +85,7 @@ Int_t AliHFEpidBase::GetPdgCode(AliVParticle *track){
   if(!fMCEvent) return 0;
   AliMCParticle *mctrack = 0x0;
   if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0)
-    mctrack = fMCEvent->GetTrack(TMath::Abs((dynamic_cast<AliESDtrack *>(track))->GetLabel()));
+    mctrack = (AliMCParticle*) (fMCEvent->GetTrack(TMath::Abs((dynamic_cast<AliESDtrack *>(track))->GetLabel())));
   else if(TString(track->IsA()->GetName()).CompareTo("AliMCParticle") == 0)
     mctrack = dynamic_cast<AliMCParticle *>(track);
   if(!mctrack) return 0;
index ab63658ab8b37d1430609e99d98eff55e97601f2..f4de8fddf10deaf63c78dabdb631034d06f01811 100644 (file)
@@ -521,7 +521,7 @@ void AliAnalysisTaskLinkToMC::FillHistsFromMC()
        
        for (Int_t i = 0; i < MCEvent()->GetNumberOfTracks(); i++)
        {
-               AliMCParticle* mcTrack = MCEvent()->GetTrack(i);
+               AliMCParticle* mcTrack = (AliMCParticle*) MCEvent()->GetTrack(i);
                
                // Select only reconstructible tracks to fill into findable hist.
                if (IsFindable(mcTrack))
index 356a6b3066d4b286e3a6ca23bb890d614a0c15d5..807c0e2a63c1274d5f37cd085d75af6f28976473 100644 (file)
@@ -154,7 +154,7 @@ void AliCFMuonResTask1::UserExec(Option_t *)
 
   // loop on the MC event
   for (Int_t ipart=0; ipart<fMCEvent->GetNumberOfTracks(); ipart++) { 
-    AliMCParticle *mcPart  = fMCEvent->GetTrack(ipart);
+    AliMCParticle *mcPart  = (AliMCParticle*) fMCEvent->GetTrack(ipart);
  
     TParticle *part = mcPart->Particle(); 
     TParticle *part0 = mcPart->Particle();
index 286c9a96716bcb697aad244616a083c4b591e7e1..e7b687aec4a1e4d7f65c6175f3d6f8f394c555bf 100644 (file)
@@ -43,7 +43,7 @@ Int_t AliMCEvent::fgkBgLabelOffset(10000000);
 AliMCEvent::AliMCEvent():
     AliVEvent(),
     fStack(0),
-    fMCParticles(new TClonesArray("AliMCParticle",1000)),
+    fMCParticles(0),
     fMCParticleMap(0),
     fHeader(new AliHeader()),
     fTRBuffer(0),
@@ -55,7 +55,8 @@ AliMCEvent::AliMCEvent():
     fNparticles(-1),
     fSubsidiaryEvents(0),
     fPrimaryOffset(0),
-    fSecondaryOffset(0)
+    fSecondaryOffset(0),
+    fExternal(0)
 {
     // Default constructor
 }
@@ -75,7 +76,8 @@ AliMCEvent::AliMCEvent(const AliMCEvent& mcEvnt) :
     fNparticles(mcEvnt.fNparticles),
     fSubsidiaryEvents(0),
     fPrimaryOffset(0),
-    fSecondaryOffset(0)
+    fSecondaryOffset(0),
+    fExternal(0)
 { 
 // Copy constructor
 }
@@ -100,6 +102,8 @@ void AliMCEvent::ConnectTreeE (TTree* tree)
 void AliMCEvent::ConnectTreeK (TTree* tree)
 {
     // Connect the kinematics tree to the stack
+    if (!fMCParticles) fMCParticles = new TClonesArray("AliMCParticle",1000);
+    //
     fStack = fHeader->Stack();
     fStack->ConnectTree(tree);
     //
@@ -454,12 +458,18 @@ void AliMCEvent::ReorderAndExpandTreeTR()
     fTreeTR = fTmpTreeTR;
 }
 
-AliMCParticle* AliMCEvent::GetTrack(Int_t i) const
+AliVParticle* AliMCEvent::GetTrack(Int_t i) const
 {
     // Get MC Particle i
     //
+
+    if (fExternal) {
+       return ((AliVParticle*) (fMCParticles->At(i)));
+    }
+    
     //
     // Check first if this explicitely accesses the subsidiary event
+    
     if (i >= BgLabelOffset()) {
        if (fSubsidiaryEvents) {
            AliMCEvent* bgEvent = (AliMCEvent*) (fSubsidiaryEvents->At(1));
index 57ddc248993475923d6bfcc615fae1dc8348248f..aabdae664693ae39d6254cc21cf4415611227c6d 100644 (file)
 
 #include <TTree.h>
 #include <TRefArray.h>
+#include <TClonesArray.h>
 
 #include <AliVEvent.h>
 #include "AliVHeader.h"
+#include "AliVParticle.h"
 #include "AliMCParticle.h"
 
 class AliStack;
@@ -63,7 +65,7 @@ public:
     
   
     virtual Int_t    GetRunNumber()          const         {return 0;}
-    virtual UInt_t   GetPeriodNumber()       const {return 0;}
+    virtual UInt_t   GetPeriodNumber()       const         {return 0;}
     virtual Double_t GetMagneticField()      const         {return 0.;}
 
     // Setters not needed
@@ -73,10 +75,10 @@ public:
     virtual void      SetTriggerMask(ULong64_t /*n*/)      {;}
     virtual void      SetTriggerCluster(UChar_t /*n*/)     {;} 
 
-    virtual UInt_t    GetOrbitNumber()       const {return 0;}
-    virtual UShort_t  GetBunchCrossNumber()  const {return 0;}
+    virtual UInt_t    GetOrbitNumber()        const {return 0;}
+    virtual UShort_t  GetBunchCrossNumber()   const {return 0;}
     
-    virtual UInt_t    GetEventType()         const {return 0;}
+    virtual UInt_t    GetEventType()          const {return 0;}
 
     virtual ULong64_t GetTriggerMask()        const {return 0;}
     virtual UChar_t   GetTriggerCluster()     const {return 0;}
@@ -87,7 +89,7 @@ public:
     virtual Double_t  GetZDCEMEnergy(Int_t /*i*/) 
                                               const {return 0.;}
     // Tracks
-    virtual AliMCParticle *GetTrack(Int_t i) const;
+    virtual AliVParticle *GetTrack(Int_t i) const;
     virtual Int_t     GetNumberOfTracks()    const {return fNparticles;}
     virtual Int_t     GetNumberOfV0s()       const {return -1;}
     virtual Int_t     GetNumberOfCascades()  const {return -1;}
@@ -117,11 +119,16 @@ public:
     virtual Bool_t    IsPhysicalPrimary(Int_t i);
     virtual Int_t     BgLabelToIndex(Int_t label);
     static  Int_t     BgLabelOffset() {return fgkBgLabelOffset;}
-
+    // External particle array
+    virtual void      SetParticleArray(TClonesArray* mcParticles) 
+       {fMCParticles = mcParticles; fNparticles = fMCParticles->GetEntries(); fExternal = kTRUE;}
+    
+     
 private:
     virtual void      ReorderAndExpandTreeTR();
     virtual Int_t     FindIndexAndEvent(Int_t oldidx, AliMCEvent*& event) const;
 private: 
+    // Stanndard implementation for ESD production
     AliStack         *fStack;            // Current pointer to stack
     TClonesArray     *fMCParticles;      // Pointer to list of particles
     TRefArray        *fMCParticleMap;    // Map of MC Particles
@@ -136,6 +143,7 @@ private:
     TList            *fSubsidiaryEvents; // List of possible subsidiary events (for example merged underlying event) 
     Int_t             fPrimaryOffset;    // Offset for primaries
     Int_t             fSecondaryOffset;  // Offset for secondaries
+    Bool_t            fExternal;         // True if external particle array
     static Int_t      fgkBgLabelOffset;  // Standard branch name    
     ClassDef(AliMCEvent, 1)  // AliVEvent realisation for MC data
 };
index 2eff35ec794e8698c90dd4ddbe29687adad36f61..ae890f9548deef7bdd402db73d57d20f1347be24 100644 (file)
@@ -203,7 +203,7 @@ void AliTRDcheckESD::Exec(Option_t *){
     
     // read MC particle
     AliMCParticle *mcParticle = 0x0; 
-    if(!(mcParticle = fMC->GetTrack(TMath::Abs(fLabel)))){
+    if(!(mcParticle = (AliMCParticle*) fMC->GetTrack(TMath::Abs(fLabel)))){
       AliWarning(Form("MC particle missing. Label[ %d].", fLabel));
       continue;
     }
index 7ca60dc935f369ea619e4b6eb6f2a92d6d3b45d3..1e86e8f50cbc2a9a2b98c36c9a0759f58cc13bc1 100644 (file)
@@ -234,7 +234,7 @@ void AliTRDinfoGen::Exec(Option_t *){
         continue; 
       }
       AliMCParticle *mcParticle = 0x0; 
-      if(!(mcParticle = fMC->GetTrack(alab))){
+      if(!(mcParticle = (AliMCParticle*) fMC->GetTrack(alab))){
         AliError(Form("MC particle label[%d] missing for Ev[%d] Trk[%d].", label, (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), itrk));
         continue;
       }
@@ -329,7 +329,7 @@ void AliTRDinfoGen::Exec(Option_t *){
   
     for(Int_t itk = 0; itk < nTracksMC; itk++){
       if(trackMap[itk]) continue;
-      AliMCParticle *mcParticle = fMC->GetTrack(TMath::Abs(itk));
+      AliMCParticle *mcParticle =  (AliMCParticle*) fMC->GetTrack(TMath::Abs(itk));
       Int_t fPdg = mcParticle->Particle()->GetPdgCode();
       Int_t nRefs = mcParticle->GetNumberOfTrackReferences();
       Int_t iref = 0; AliTrackReference *ref = 0x0;