/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Authors: Svein Lindal, Daniel Lohner *
- * Version 1.0 *
- * *
- * *
- * based on: on older version (see aliroot up to v5-04-42-AN) *
- * AliV0Reader.cxx *
- * Authors: Kathrin Koch, Kenneth Aamodt, Ana Marin *
- * *
+ * *
+ * Authors: Svein Lindal, Daniel Lohner *
+ * Version 1.0 *
+ * *
+ * *
+ * based on: on older version (see aliroot up to v5-04-42-AN) *
+ * AliV0Reader.cxx *
+ * Authors: Kathrin Koch, Kenneth Aamodt, Ana Marin *
+ * *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
fCreateAOD(kFALSE),
fDeltaAODBranchName("GammaConv"),
fDeltaAODFilename("AliAODGammaConversion.root"),
+ fRelabelAODs(kFALSE),
fEventIsSelected(kFALSE),
fPeriodName("")
{
void AliV0ReaderV1::Init()
{
// Initialize function to be called once before analysis
-
if(fConversionCuts==NULL){
if(fConversionCuts==NULL)AliError("No Cut Selection initialized");
}
-
if(fCreateAOD){kUseAODConversionPhoton=kTRUE;}
if(fConversionGammas != NULL){
fConversionGammas = new TClonesArray("AliKFConversionPhoton",100);}
}
fConversionGammas->Delete();//Reset the TClonesArray
-
}
//________________________________________________________________________
}
}
-
//________________________________________________________________________
-void AliV0ReaderV1::UserExec(Option_t *){
-
+Bool_t AliV0ReaderV1::Notify()
+{
if (fPeriodName.CompareTo("") == 0){
AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
if(man) {
fPeriodName = testObjString->GetString();
i = arr->GetEntriesFast();
}
- }
-// cout << fileName.Data() << "\t" <<fPeriodName.Data() << endl;
+ }
}
}
+ if(!fConversionCuts->GetDoEtaShift()) return kTRUE; // No Eta Shift requested, continue
+ if(fConversionCuts->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
+ fConversionCuts->GetCorrectEtaShiftFromPeriod(fPeriodName);
+ fConversionCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
+ return kTRUE;
+ }
+ else{
+ printf(" Gamma Conversion Reader %s :: Eta Shift Manually Set to %f \n\n",
+ (fConversionCuts->GetCutNumber()).Data(),fConversionCuts->GetEtaShift());
+ fConversionCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
+ }
}
+ return kTRUE;
+}
+//________________________________________________________________________
+void AliV0ReaderV1::UserExec(Option_t *option){
+
// Check if correctly initialized
if(!fConversionGammas)Init();
// User Exec
fEventIsSelected=ProcessEvent(fInputEvent,fMCEvent);
+
+ // AOD Output
+ FillAODOutput();
+
}
//________________________________________________________________________
Bool_t AliV0ReaderV1::ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent)
{
+
//Reset the TClonesArray
fConversionGammas->Delete();
GetAODConversionGammas();
}
- // AOD Output
- FillAODOutput();
-
return kTRUE;
}
///________________________________________________________________________
Bool_t AliV0ReaderV1::ProcessESDV0s()
{
// Process ESD V0s for conversion photon reconstruction
-
AliESDEvent *fESDEvent=dynamic_cast<AliESDEvent*>(fInputEvent);
AliKFConversionPhoton *fCurrentMotherKFCandidate=NULL;
AliESDv0 *fCurrentV0=(AliESDv0*)(fESDEvent->GetV0(currentV0Index));
if(!fCurrentV0){
printf("Requested V0 does not exist");
- continue;}
+ continue;
+ }
fCurrentMotherKFCandidate=ReconstructV0(fCurrentV0,currentV0Index);
if(fCurrentMotherKFCandidate){
-
// Add Gamma to the TClonesArray
if(kUseAODConversionPhoton){
new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(fCurrentMotherKFCandidate);
+ AliAODConversionPhoton * currentConversionPhoton = (AliAODConversionPhoton*)(fConversionGammas->At(fConversionGammas->GetEntriesFast()-1));
+ currentConversionPhoton->SetMass(fCurrentMotherKFCandidate->M());
+ currentConversionPhoton->SetMassToZero();
+
}
else{
new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliKFConversionPhoton(*fCurrentMotherKFCandidate);
// Reconstruct Gamma
if(fUseConstructGamma){
- fCurrentMotherKF = new AliKFConversionPhoton();
- fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
+ fCurrentMotherKF = new AliKFConversionPhoton();
+ fCurrentMotherKF->ConstructGamma(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
}else{
- fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
- fCurrentMotherKF->SetMassConstraint(0,0);
+ fCurrentMotherKF = new AliKFConversionPhoton(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle);
+ fCurrentMotherKF->SetMassConstraint(0,0.0001);
}
// Set Track Labels
// Double_t u[3] = {pPlus[0]+pMinus[0],pPlus[1]+pMinus[1],pPlus[2]+pMinus[2]};
// Double_t normu = sqrt( (u[0]*u[0]) + (u[1]*u[1]) + (u[2]*u[2]) );
-
+
// u[0] = u[0] / normu;
// u[1] = u[1] / normu;
// u[2] = u[2] / normu;
// v[0] = (pPlus[1]*pMinus[2]) - (pPlus[2]*pMinus[1]);
// v[1] = (pPlus[2]*pMinus[0]) - (pPlus[0]*pMinus[2]);
// v[2] = (pPlus[0]*pMinus[1]) - (pPlus[1]*pMinus[0]);
-
+
// Double_t w[3] = {0,0,0}; // u X v
// w[0] = (u[1]*v[2]) - (u[2]*v[1]);
// w[1] = (u[2]*v[0]) - (u[0]*v[2]);
for(Int_t i=0;i<fInputGammas->GetEntriesFast();i++){
gamma=dynamic_cast<AliAODConversionPhoton*>(fInputGammas->At(i));
if(gamma){
+ if(fRelabelAODs)RelabelAODPhotonCandidates(gamma);
if(fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
new((*fConversionGammas)[fConversionGammas->GetEntriesFast()]) AliAODConversionPhoton(*gamma);}
}
}
}
}
-
+//________________________________________________________________________
+void AliV0ReaderV1::RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate){
+
+ // Relabeling For AOD Event
+ // ESDiD -> AODiD
+ // MCLabel -> AODMCLabel
+ Bool_t AODLabelPos = kFALSE;
+ Bool_t AODLabelNeg = kFALSE;
+
+ for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
+ AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
+ if(!AODLabelPos){
+ if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
+ PhotonCandidate->SetMCLabelPositive(abs(tempDaughter->GetLabel()));
+ PhotonCandidate->SetLabelPositive(i);
+ AODLabelPos = kTRUE;
+ }
+ }
+ if(!AODLabelNeg){
+ if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
+ PhotonCandidate->SetMCLabelNegative(abs(tempDaughter->GetLabel()));
+ PhotonCandidate->SetLabelNegative(i);
+ AODLabelNeg = kTRUE;
+ }
+ }
+ if(AODLabelNeg && AODLabelPos){
+ return;
+ }
+ }
+ if(!AODLabelPos || !AODLabelNeg){
+ AliError(Form("NO AOD Daughters Found Pos: %i %i Neg: %i %i",AODLabelPos,PhotonCandidate->GetTrackLabelPositive(),AODLabelNeg,PhotonCandidate->GetTrackLabelNegative()));
+ }
+
+}
//________________________________________________________________________
void AliV0ReaderV1::Terminate(Option_t *)