- // Not Accepted == kFALSE == 0
- // Accepted == kTRUE == 1
- // FirstHeader == kTRUE == 3
- if(index < 0) return 0; // No Particle
-
- Int_t accepted = 0;
- if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
- if( index >= MCStack->GetNprimary()){ // Secondary Particle
- if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
- return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack,InputEvent);
- }
- for(Int_t i = 0;i<fnHeaders;i++){
- if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
- accepted = 1;
- if(i == 0) accepted = 2; // MB Header
- }
- }
- }
- else if(InputEvent->IsA()==AliAODEvent::Class()){
- TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
- AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
- if(!aodMCParticle) return 1; // Photon Without a Mother ? --> Accepted
- if(!aodMCParticle->IsPrimary()){
- if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother??
- return IsParticleFromBGEvent(aodMCParticle->GetMother(),MCStack,InputEvent);
- }
- index = abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
- for(Int_t i = 0;i<fnHeaders;i++){
- if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
- accepted = 1;
- if(i == 0) accepted = 2; // MB Header
- }
- }
- }
+ // Not Accepted == kFALSE == 0
+ // Accepted == kTRUE == 1
+ // FirstHeader == kTRUE == 3
+ if(index < 0) return 0; // No Particle
+
+// if (index == 100){
+// cout << "possible headers" << endl;
+// for(Int_t i = 0;i<fnHeaders;i++){
+// cout << i << "\t" <<fGeneratorNames[i] << "\t" << fNotRejectedStart[i] << "\t" <<fNotRejectedEnd[i] << endl;
+// }
+// }
+ Int_t accepted = 0;
+ if(!InputEvent || InputEvent->IsA()==AliESDEvent::Class()){
+ if( index >= MCStack->GetNprimary()){ // Secondary Particle
+ if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return 1; // Secondary Particle without Mother??
+ return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack,InputEvent);
+ }
+ for(Int_t i = 0;i<fnHeaders;i++){
+ if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
+ accepted = 1;
+ if(i == 0) accepted = 2; // MB Header
+ }
+ }
+ }
+ else if(InputEvent->IsA()==AliAODEvent::Class()){
+ TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(InputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+ AliAODMCParticle *aodMCParticle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index));
+ if(!aodMCParticle) return 1; // Photon Without a Mother ? --> Accepted
+ if(!aodMCParticle->IsPrimary()){
+ if( aodMCParticle->GetMother() < 0) return 1;// Secondary Particle without Mother??
+ return IsParticleFromBGEvent(aodMCParticle->GetMother(),MCStack,InputEvent);
+ }
+ index = abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(index))->GetLabel());
+ for(Int_t i = 0;i<fnHeaders;i++){
+ if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i]){
+ accepted = 1;
+ if(i == 0) accepted = 2; // MB Header
+ }
+ }
+ }