+
+//_________________________________________________________________________________
+Bool_t AliAnalysisTaskGammaConvCalo::CheckIfContainedInString(TString input, Int_t tobechecked){
+ TObjArray *arr = input.Tokenize(",");
+ for (Int_t i = 0; i < arr->GetEntriesFast();i++){
+ TString tempStr = ((TObjString*)arr->At(i))->GetString();
+ if (tempStr.Atoi() == tobechecked) return kTRUE;
+ }
+ return kFALSE;
+}
+
+//_________________________________________________________________________________
+Bool_t AliAnalysisTaskGammaConvCalo::CheckIfContainedInStringAndAppend(TString &input, Int_t tobechecked){
+ TObjArray *arr = input.Tokenize(",");
+ Bool_t isContained = kFALSE;
+ for (Int_t i = 0; i < arr->GetEntriesFast();i++){
+ TString tempStr = ((TObjString*)arr->At(i))->GetString();
+ if (tempStr.Atoi() == tobechecked) isContained= kTRUE;
+ }
+ if (!isContained)input.Append(Form("%i,",tobechecked));
+ return isContained;
+}
+
+//_________________________________________________________________________________
+void AliAnalysisTaskGammaConvCalo::ProcessConversionPhotonsForMissingTags (){
+
+ if (!fMCStack) return;
+
+ for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
+ AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
+ if (gamma0->IsTrueConvertedPhoton()){
+ Int_t gamma0MotherLabel = -1;
+ Int_t gamma0MCLabel = gamma0->GetMCParticleLabel(fMCStack);
+ if(gamma0MCLabel != -1){
+ TParticle * gammaMC0 = (TParticle*)fMCStack->Particle(gamma0MCLabel);
+ gamma0MotherLabel=gammaMC0->GetFirstMother();
+ if (gamma0MotherLabel>-1){
+ if(((TParticle*)fMCStack->Particle(gamma0MotherLabel))->GetPdgCode() == 111){
+ if (!CheckIfContainedInStringAndAppend(fStringRecTruePi0s[fiCut],gamma0MotherLabel)){
+ if (gamma0MotherLabel >= fMCStack->GetNprimary()){
+ Int_t secMotherLabel = ((TParticle*)fMCStack->Particle(gamma0MotherLabel))->GetMother(0);
+ Float_t weightedSec= 1;
+ if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && fMCStack->Particle(secMotherLabel)->GetPdgCode()==310){
+ weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
+ }
+ fHistoTrueSecondaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weightedSec);
+ } else {
+ Float_t weighted= 1;
+ if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, fMCStack, fInputEvent)){
+ if (((TParticle*)fMCStack->Particle(gamma0MotherLabel))->Pt()>0.005){
+ weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma0MotherLabel, fMCStack, fInputEvent);
+ }
+ }
+ fHistoTruePrimaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
+ }
+ }
+ } else if(((TParticle*)fMCStack->Particle(gamma0MotherLabel))->GetPdgCode() == 221){
+ if (!CheckIfContainedInStringAndAppend(fStringRecTrueEtas[fiCut],gamma0MotherLabel)){
+ Float_t weighted= 1;
+ if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, fMCStack, fInputEvent)){
+ if (((TParticle*)fMCStack->Particle(gamma0MotherLabel))->Pt()>0.005){
+ weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma0MotherLabel, fMCStack, fInputEvent);
+ }
+ }
+ fHistoTruePrimaryEtaMissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
+ }
+ }
+ }
+ }
+ }
+ }
+ return;
+}
+
+//_________________________________________________________________________________
+void AliAnalysisTaskGammaConvCalo::ProcessConversionPhotonsForMissingTagsAOD (){
+
+ TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+
+ for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
+ AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
+
+ if (gamma0->IsTrueConvertedPhoton()){
+ AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0->GetMCLabelPositive()));
+ AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0->GetMCLabelNegative()));
+
+ Int_t gamma0MCLabel = -1;
+ Int_t gamma0MotherLabel = -1;
+ if(!positiveMC||!negativeMC)
+ return;
+
+ if (gamma0->IsTrueConvertedPhoton()){
+ gamma0MCLabel = positiveMC->GetMother();
+ AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
+ gamma0MotherLabel=gammaMC0->GetMother();
+
+ if (gamma0MotherLabel>-1){
+ if(((AliAODMCParticle*)AODMCTrackArray->At(gamma0MotherLabel))->GetPdgCode() == 111){
+ if (!CheckIfContainedInStringAndAppend(fStringRecTruePi0s[fiCut],gamma0MotherLabel)){
+ if (!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){
+ Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->GetMother();
+ Float_t weightedSec= 1;
+ if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
+ weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, 0x0, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
+ }
+ fHistoTrueSecondaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weightedSec);
+ } else {
+ Float_t weighted= 1;
+ if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, 0x0, fInputEvent)){
+ if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->Pt()>0.005){
+ weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma0MotherLabel, 0x0, fInputEvent);
+ }
+ }
+ fHistoTruePrimaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
+ }
+ }
+ } else if(((AliAODMCParticle*)AODMCTrackArray->At(gamma0MotherLabel))->GetPdgCode() == 221){
+ if (!CheckIfContainedInStringAndAppend(fStringRecTrueEtas[fiCut],gamma0MotherLabel)){
+ Float_t weighted= 1;
+ if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, 0x0, fInputEvent)){
+ if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->Pt()>0.005){
+ weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma0MotherLabel, 0x0, fInputEvent);
+ }
+ }
+ fHistoTruePrimaryEtaMissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
+ }
+ }
+ }
+ }
+ }
+ }
+ return;
+}
\ No newline at end of file