]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
authorcholm <Christian.Holm.Christensen@cern.ch>
Wed, 14 Jan 2015 00:02:11 +0000 (01:02 +0100)
committercholm <Christian.Holm.Christensen@cern.ch>
Wed, 14 Jan 2015 00:02:11 +0000 (01:02 +0100)
262 files changed:
AD/ADbase/AliADCalibData.cxx
AD/ADbase/AliADCalibData.h
ANALYSIS/ANALYSISalice/AliTriggerAnalysis.cxx
ANALYSIS/macros/AddTaskPIDResponse.C
CMakeLists.txt
DPMJET/dpmjet3.0-5.f
DPMJET/dpmjet3.0-5F.f
EMCAL/EMCALUtils/AliEMCALEMCGeometry.cxx [changed mode: 0644->0755]
EMCAL/EMCALUtils/AliEMCALEMCGeometry.h [changed mode: 0644->0755]
EMCAL/EMCALUtils/AliEMCALGeometry.cxx [changed mode: 0644->0755]
EMCAL/EMCALUtils/AliEMCALGeometry.h [changed mode: 0644->0755]
EMCAL/EMCALUtils/AliEMCALTriggerMapping.cxx [new file with mode: 0644]
EMCAL/EMCALUtils/AliEMCALTriggerMapping.h [new file with mode: 0755]
EMCAL/EMCALUtils/AliEMCALTriggerMappingV1.cxx [new file with mode: 0755]
EMCAL/EMCALUtils/AliEMCALTriggerMappingV1.h [new file with mode: 0755]
EMCAL/EMCALUtils/AliEMCALTriggerMappingV2.cxx [new file with mode: 0644]
EMCAL/EMCALUtils/AliEMCALTriggerMappingV2.h [new file with mode: 0644]
EMCAL/EMCALUtils/CMakeLists.txt
EMCAL/EMCALUtils/EMCALUtilsLinkDef.h [changed mode: 0644->0755]
EMCAL/EMCALbase/AliEMCAL.h
EMCAL/EMCALbase/AliEMCALDigitizer.cxx [changed mode: 0644->0755]
EMCAL/EMCALbase/AliEMCALPreprocessor.cxx [changed mode: 0644->0755]
EMCAL/EMCALbase/AliEMCALTrigger.cxx [deleted file]
EMCAL/EMCALbase/AliEMCALTrigger.h [deleted file]
EMCAL/EMCALbase/AliEMCALTriggerRawDigitMaker.cxx
EMCAL/EMCALbase/CMakeLists.txt
EMCAL/EMCALbase/EMCALbaseLinkDef.h [changed mode: 0644->0755]
FASTSIM/CMakeLists.txt
FIT/FITsim/AliFITv2.cxx
FIT/FITsim/AliFITv2.h
HLT/ITS/trackingSAP/AliITSSAPTracker.h
HLT/global/physics/AliHLTAnaManagerComponent.cxx
ITS/UPGRADE/ITSUpgradeSim/AliITSUv1.cxx
ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.cxx
ITS/UPGRADE/ITSUpgradeSim/AliITSUv1Layer.h
ITS/UPGRADE/testITSUv1/CreateITSUv1.C
ITS/UPGRADE/testITSUv1/CreateITSUv1.C_template
ITS/UPGRADE/testITSUv1/GetMaterialBudget.C
MUON/AlirootRun_MUONtest.sh
MUON/MUONcalib/AliMUONTrackerData.cxx
MUON/MUONraw/CMakeLists.txt
MUON/MUONtrigger/AliMUONLocalTriggerBoard.cxx
MUON/loadlibs.C [deleted file]
MUON/rootlogon.C
PHOS/PHOSUtils/AliPHOSCPVGeometry.cxx
PHOS/PHOSbase/AliPHOSClusterizerv1.cxx
PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.cxx [moved from PHOS/PHOSrec/AliPHOSCpvRawDigiProducer.cxx with 72% similarity]
PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.h [moved from PHOS/PHOSrec/AliPHOSCpvRawDigiProducer.h with 67% similarity]
PHOS/PHOSbase/AliPHOSCpvRawStream.cxx
PHOS/PHOSbase/AliPHOSRawDigiProducer.cxx
PHOS/PHOSbase/AliPHOSReconstructor.cxx
PHOS/PHOSbase/AliPHOSReconstructor.h
PHOS/PHOSbase/CMakeLists.txt
PHOS/PHOSbase/PHOSbaseLinkDef.h
PHOS/PHOSrec/AliPHOSAodCluster.h [changed mode: 0755->0644]
PHOS/PHOSrec/CMakeLists.txt
PHOS/PHOSrec/PHOSrecLinkDef.h
PWG/EMCAL/AliEMCALConfigHandler.cxx
PWG/FLOW/Tasks/AliAnalysisTaskFlowStrange.cxx
PWG/FLOW/Tasks/AliAnalysisTaskFlowStrangee.cxx [new file with mode: 0644]
PWG/FLOW/Tasks/AliAnalysisTaskFlowStrangee.h [new file with mode: 0644]
PWG/FLOW/Tasks/AliAnalysisTaskPIDconfig.cxx
PWG/FLOW/Tasks/AliFlowTrackCuts.cxx
PWG/FLOW/Tasks/AliFlowTrackCuts.h
PWG/FLOW/Tasks/CMakeLists.txt
PWG/FLOW/Tasks/PWGflowTasksLinkDef.h
PWG/Glauber/AliGlauberNucleon.cxx
PWG/Tools/AliJSONData.cxx
PWG/Tools/AliJSONData.h
PWG/Tools/AliJSONReader.cxx
PWG/Tools/THistManager.cxx
PWG/muon/AliAnalysisTaskFlowSingleMu.cxx
PWG/muon/AliAnalysisTaskSingleMu.cxx
PWG/muondep/AccEffTemplates/AOD_merge.sh
PWG/muondep/AccEffTemplates/AODtrainsim.C [moved from PWG/muondep/AccEffTemplates/AODtrain.C with 90% similarity]
PWG/muondep/AccEffTemplates/sim.C
PWG/muondep/AccEffTemplates/simrun.C [deleted file]
PWG/muondep/AccEffTemplates/simrun.sh [new file with mode: 0644]
PWG/muondep/AccEffTemplates/validation.sh [deleted file]
PWG/muondep/AliAnalysisMuMuResult.cxx
PWG/muondep/AliMuonAccEffSubmitter.cxx
PWG/muondep/AliMuonAccEffSubmitter.h
PWG/muondep/AliMuonGridSubmitter.cxx
PWG/muondep/CMakeLists.txt
PWGCF/Correlations/Base/AliAnalysisTaskCFTree.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskDiJetCorrelations.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskDptDptCorrelations.cxx
PWGCF/Correlations/DPhi/CMakeLists.txt
PWGCF/Correlations/DPhi/PWGCFCorrelationsDPhiLinkDef.h
PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.cxx [deleted file]
PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.h [deleted file]
PWGCF/Correlations/JCORRAN/AliJJetJtAnalysis.cxx
PWGCF/Correlations/JCORRAN/AliJJetJtAnalysis.h
PWGCF/Correlations/macros/phieffmc/AddTaskPhiEffMc.C [deleted file]
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.cxx
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.cxx
PWGCF/EBYE/BalanceFunctions/AliBalancePsi.h
PWGCF/EBYE/LRC/AliLRCProcess.h
PWGCF/EBYE/PIDFluctuation/task/AliEbyENetChargeFluctuationTask.cxx
PWGCF/EBYE/macros/drawCorrelationFunctionPsi.C
PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSpherocityEventCut.cxx
PWGCF/FEMTOSCOPY/Chaoticity/AliFourPion.cxx
PWGCF/FEMTOSCOPY/Chaoticity/AliFourPion.h
PWGCF/FEMTOSCOPY/macros/AddTaskFourPion.C
PWGCF/FLOW/macros/AddTaskFlowStrangee.C [new file with mode: 0644]
PWGCF/FLOW/macros/AddTaskPIDFlowSP.C
PWGGA/EMCALTasks/AliAnalysisTaskEMCALIsoPhoton.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALPi0V2ShSh.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaCalo.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvFlow.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.h
PWGGA/GammaConv/AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.cxx
PWGGA/GammaConv/AliAnalysisTaskdPhi.cxx
PWGGA/GammaConv/AliConvEventCuts.cxx
PWGGA/GammaConv/AliConvEventCuts.h
PWGGA/GammaConv/AliConversionCuts.cxx
PWGGA/GammaConv/AliPrimaryPionCuts.cxx
PWGGA/PHOSTasks/PHOS_PbPb/AliAnalysisTaskPi0FlowMC.cxx
PWGGA/PHOSTasks/PHOS_PbPb/AliAnalysisTaskPi0FlowMCParamWeights.cxx
PWGHF/correlationHF/AliAnalysisTaskDStarCorrelations.cxx
PWGHF/correlationHF/AliAnalysisTaskSED0Correlations.cxx
PWGHF/hfe/AliAnalysisTaskFlowTPCEMCalEP.cxx
PWGHF/hfe/AliAnalysisTaskHFECal.cxx
PWGHF/hfe/AliHFEspectrum.cxx
PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.cxx [new file with mode: 0644]
PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.h [new file with mode: 0644]
PWGHF/vertexingHF/AliAnalysisTaskCheckHFMCProd.cxx
PWGHF/vertexingHF/AliAnalysisTaskCombinHF.cxx
PWGHF/vertexingHF/AliAnalysisTaskSEDStarSpectra.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelorTMVA.h [changed mode: 0755->0644]
PWGHF/vertexingHF/AliAnalysisTaskSELc2pK0sfromAODtracks.cxx [new file with mode: 0644]
PWGHF/vertexingHF/AliAnalysisTaskSELc2pK0sfromAODtracks.h [new file with mode: 0644]
PWGHF/vertexingHF/AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.cxx [new file with mode: 0644]
PWGHF/vertexingHF/AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.h [new file with mode: 0644]
PWGHF/vertexingHF/AliCFVertexingHFLctoV0bachelor.cxx
PWGHF/vertexingHF/AliHFPtSpectrum.cxx
PWGHF/vertexingHF/AliRDHFCutsLctopK0sfromAODtracks.cxx [new file with mode: 0644]
PWGHF/vertexingHF/AliRDHFCutsLctopK0sfromAODtracks.h [new file with mode: 0644]
PWGHF/vertexingHF/AliRDHFCutsXicPlustoXiPiPifromAODtracks.cxx [new file with mode: 0644]
PWGHF/vertexingHF/AliRDHFCutsXicPlustoXiPiPifromAODtracks.h [new file with mode: 0644]
PWGHF/vertexingHF/CMakeLists.txt
PWGHF/vertexingHF/PWGHFvertexingHFLinkDef.h
PWGHF/vertexingHF/macros/AddTaskCFVertexingHF3ProngLc.C
PWGHF/vertexingHF/macros/AddTaskLc2pK0sfromAODtracks.C [new file with mode: 0644]
PWGHF/vertexingHF/macros/AddTaskXicPlus2XiPiPifromAODtracks.C [new file with mode: 0644]
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskJetJTJT.cxx
PWGJE/EMCALJetTasks/macros/AddTaskPtEMCalTriggerV1.C
PWGJE/FlavourJetTasks/AliAnalysisTaskEmcalJetV0CF.cxx
PWGJE/FlavourJetTasks/AliAnalysisTaskEmcalJetV0Filter.cxx
PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx
PWGJE/FlavourJetTasks/AliAnalysisTaskSEPicoV0Maker.cxx
PWGJE/PWGJE/AliAnalysisTaskJetCore.cxx
PWGJE/UserTasks/AliAnalysisTaskPIDV0base.cxx
PWGLF/RESONANCES/CMakeLists.txt
PWGLF/RESONANCES/extra/AliAnalysisTaskLambdaStar.cxx
PWGLF/RESONANCES/extra/CMakeLists.txt
PWGLF/RESONANCES/macros/mini/AddAnalysisTaskTPCKStar.C
PWGLF/RESONANCES/macros/mini/AddAnalysisTaskTPCKStarSyst.C
PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStar.C
PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarMC.C
PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarSyst.C
PWGLF/SPECTRA/PiKaPr/ITSsa/AliAnalysisTaskSEITSsaSpectra.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskV2AllChAOD.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothPID.cxx
PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskCTauPbPbaod.cxx
PWGPP/CMakeLists.txt
PWGPP/QA/scripts/alienSync.conf
PWGPP/QA/scripts/alienSync.sh
PWGPP/TPC/AliTPCPIDBase.cxx
PWGPP/TPC/AliTPCcalibResidualPID.cxx
PWGPP/TRD/TRDPID/AliTRDPIDTree.cxx
PWGPP/pid/AliAnalysisTaskK0sBayes.cxx
PWGPP/pid/AliAnalysisTaskLambdaBayes.cxx
PWGPP/pid/AliAnalysisTaskPhiBayes.cxx
PWGPP/scripts/utilities.sh
PWGUD/DIFFRACTIVE/xsAndTwoProng/AliAnalysisTaskCDskimESD.cxx
PYTHIA8/pythia8175/src/SpaceShower.cxx
STARLIGHT/starlight/include/gammaavm.h
STARLIGHT/starlight/include/gammagammaleptonpair.h
STARLIGHT/starlight/include/gammagammasingle.h
STARLIGHT/starlight/include/photonNucleusCrossSection.h
STARLIGHT/starlight/include/readinluminosity.h
STARLIGHT/starlight/src/beambeamsystem.cpp
STARLIGHT/starlight/src/gammaaluminosity.cpp
STARLIGHT/starlight/src/gammaavm.cpp
STARLIGHT/starlight/src/gammagammaleptonpair.cpp
STARLIGHT/starlight/src/gammagammasingle.cpp
STARLIGHT/starlight/src/incoherentPhotonNucleusLuminosity.cpp
STARLIGHT/starlight/src/incoherentVMCrossSection.cpp
STARLIGHT/starlight/src/narrowResonanceCrossSection.cpp
STARLIGHT/starlight/src/photonNucleusCrossSection.cpp
STARLIGHT/starlight/src/readinluminosity.cpp
STARLIGHT/starlight/src/wideResonanceCrossSection.cpp
STEER/CDB/AliBaseCalibViewer.cxx
STEER/ESD/AliESDHeader.cxx
STEER/STEERBase/AliITSPIDResponse.cxx
STEER/STEERBase/AliPIDResponse.cxx
STRUCT/AliFRAMEv3.cxx
T0/AliT0RawReader.cxx [new file with mode: 0644]
TAmpt/AMPT/CMakeLists.txt
TOF/TOFsim/AliTOFT0.cxx
TOF/macrosQA/MakeTrendingTOFQA.C
TPC/AliBarrelRec_TPCparam.C
TPC/AliL1Delay.C
TPC/AliTPCAltro.C
TPC/AliTPCCmpNG.C
TPC/AliTPCCombinedTrackfit.cxx
TPC/AliTPCCombinedTrackfit.h
TPC/AliTPCCompareTracks.C
TPC/AliTPCComparison.C
TPC/AliTPCComparison2.C
TPC/AliTPCCreatePRF.C
TPC/AliTPCCreatePRFGEM.C
TPC/AliTPCDDL.C
TPC/AliTPCDDLRawData.C
TPC/AliTPCDisplayDigits.C
TPC/AliTPCEfield.cxx
TPC/AliTPCEfield.h
TPC/AliTPCExBConical.cxx
TPC/AliTPCExBConical.h
TPC/AliTPCMonitorExec.C [changed mode: 0755->0644]
TPC/AliTPCSavePID.C
TPC/AliTPCScanPID.C
TPC/AliTPCTestMerge.C
TPC/AnalyzeESDtracks.C
TPC/ClassTree.C
TPC/ConfigKr.C
TPC/FindKrClusters.C
TPC/FindKrClustersRaw.C
TPC/LandauTest.C
TPC/MakeTPCAltroMapping.C
TPC/MakeTPCFullMisAlignment.C
TPC/MakeTPCResMisAlignment.C
TPC/MakeTPCZeroMisAlignment.C
TPC/SetTPCParamOptional.C
TPC/TPCbase/AliTPCLaserTrack.cxx
TPC/TPCbase/AliTPCcalibDButil.cxx
TPC/TPCcalib/AliAnalysisTaskPt.cxx
TPC/TestAnalisys.C
TPC/TestTPCTrackHits.cxx
TPC/TestTPCTrackHits.h
TPC/recTPC.C
TRD/TRDbase/AliTRDCommonParam.cxx
TTherminator/CMakeLists.txt
ZDC/ZDCrec/AliZDCReconstructor.cxx
ZDC/ZDCsim/AliZDCDigitizer.cxx
cmake/CMakeLists.example [new file with mode: 0644]
doxygen/.gitignore [new file with mode: 0644]
doxygen/CMakeLists.txt [new file with mode: 0644]
doxygen/Doxyfile.in [new file with mode: 0644]
doxygen/debug/gen_list_includes.sh [new file with mode: 0755]
doxygen/debug/run.sh [new file with mode: 0755]
doxygen/debug/test_idempotency.sh [new file with mode: 0755]
doxygen/img/alice_logo_clearbg.png [new file with mode: 0644]
doxygen/mainpage.dox [new file with mode: 0644]
doxygen/thtml2doxy.py [new file with mode: 0755]
macros/ConfigRaw2015.C [new file with mode: 0644]

index 2eced28feca149bb807bfbd25acc62cf10efea28..a77d2ba81af0b270d9482fe8c260dec22cb7365f 100644 (file)
@@ -36,7 +36,17 @@ ClassImp(AliADCalibData)
 AliADCalibData::AliADCalibData():
   fLightYields(NULL),
   fPMGainsA(NULL),
-  fPMGainsB(NULL)
+  fPMGainsB(NULL),
+  fBBAThreshold(0),
+  fBBCThreshold(0) ,  
+  fBGAThreshold(0) ,  
+  fBGCThreshold(0) ,  
+  fBBAForBGThreshold(0) ,  
+  fBBCForBGThreshold(0) ,   
+  fMultV0AThrLow(0) ,  
+  fMultV0AThrHigh(0) , 
+  fMultV0CThrLow(0) ,  
+  fMultV0CThrHigh(0)
 {
   // default constructor
   
@@ -62,6 +72,21 @@ AliADCalibData::AliADCalibData():
        fTriggerCountOffset[i] = 3247;
        fRollOver[i] = 3563;
     }
+    for(int i=0; i<kNCIUBoards ;i++) {
+       fClk1Win1[i] = fClk1Win2[i] = 0;
+       fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;
+       fClk2Win1[i] = fClk2Win2[i] = 0;
+       fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;
+       fLatchWin1[i] = fLatchWin2[i] = 0;
+       fResetWin1[i] = fResetWin2[i] = 0;
+       fPedestalSubtraction[i] = kFALSE;
+       }
+    for(Int_t j = 0; j < 16; ++j) {
+       fEnableCharge[j] = fEnableTiming[j] = kFALSE;
+       fPedestalOdd[j] = fPedestalEven[j] = 0;
+       fPedestalCutOdd[j] = fPedestalCutEven[j] = 0;
+       }
+    for(Int_t i = 0; i < 5; ++i) fTriggerSelected[i] = 0;
 
 }
 //________________________________________________________________
@@ -74,7 +99,17 @@ void AliADCalibData::Reset()
 AliADCalibData::AliADCalibData(const char* name) :
   fLightYields(NULL),
   fPMGainsA(NULL),
-  fPMGainsB(NULL)
+  fPMGainsB(NULL),
+  fBBAThreshold(0),
+  fBBCThreshold(0) ,  
+  fBGAThreshold(0) ,  
+  fBGCThreshold(0) ,  
+  fBBAForBGThreshold(0) ,  
+  fBBCForBGThreshold(0) ,   
+  fMultV0AThrLow(0) ,  
+  fMultV0AThrHigh(0) , 
+  fMultV0CThrLow(0) ,  
+  fMultV0CThrHigh(0)
 {
   // Constructor
    TString namst = "Calib_";
@@ -103,6 +138,21 @@ AliADCalibData::AliADCalibData(const char* name) :
        fTriggerCountOffset[i] = 3247;
        fRollOver[i] = 3563;
    }
+    for(int i=0; i<kNCIUBoards ;i++) {
+       fClk1Win1[i] = fClk1Win2[i] = 0;
+       fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;
+       fClk2Win1[i] = fClk2Win2[i] = 0;
+       fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;
+       fLatchWin1[i] = fLatchWin2[i] = 0;
+       fResetWin1[i] = fResetWin2[i] = 0;
+       fPedestalSubtraction[i] = kFALSE;
+       }
+    for(Int_t j = 0; j < 16; ++j) {
+       fEnableCharge[j] = fEnableTiming[j] = kFALSE;
+       fPedestalOdd[j] = fPedestalEven[j] = 0;
+       fPedestalCutOdd[j] = fPedestalCutEven[j] = 0;
+       }
+    for(Int_t i = 0; i < 5; ++i) fTriggerSelected[i] = 0;
 }
 
 //________________________________________________________________
@@ -341,6 +391,38 @@ void AliADCalibData::SetParameter(TString name, Int_t val){
        else if(name.Contains("RollOver")) SetRollOver((UInt_t) val,iBoard);
        else if(name.Contains("DelayHit")) SetTimeOffset(0.01*(Float_t)val,iBoard,(iChannel-1));
        else if(name.Contains("DiscriThr")) SetDiscriThr(((Float_t)val-1040.)/112.,iBoard,(iChannel-1));
+               
+       else if(name.Contains("DelayClk1Win1")) SetDelayClk1Win1((UShort_t) val,iBoard);
+       else if(name.Contains("Clk1Win1")) SetClk1Win1((UShort_t) val,iBoard);
+       else if(name.Contains("DelayClk1Win2")) SetDelayClk1Win2((UShort_t) val,iBoard);
+       else if(name.Contains("Clk1Win2")) SetClk1Win2((UShort_t) val,iBoard);
+       else if(name.Contains("DelayClk2Win1")) SetDelayClk2Win1((UShort_t) val,iBoard);
+       else if(name.Contains("Clk2Win1")) SetClk2Win1((UShort_t) val,iBoard);
+       else if(name.Contains("DelayClk2Win2")) SetDelayClk2Win2((UShort_t) val,iBoard);
+       else if(name.Contains("Clk2Win2")) SetClk2Win2((UShort_t) val,iBoard);
+       else if(name.Contains("LatchWin1")) SetLatchWin1((UShort_t) val,iBoard);
+       else if(name.Contains("LatchWin2")) SetLatchWin2((UShort_t) val,iBoard);
+       else if(name.Contains("ResetWin1")) SetResetWin1((UShort_t) val,iBoard);
+       else if(name.Contains("ResetWin2")) SetResetWin2((UShort_t) val,iBoard);
+       else if(name.Contains("PedestalSubtraction")) SetPedestalSubtraction((Bool_t) val,iBoard);
+       else if(name.Contains("BBAThreshold")) SetBBAThreshold((UShort_t) val);
+       else if(name.Contains("BBCThreshold")) SetBBCThreshold((UShort_t) val);
+       else if(name.Contains("BGAThreshold")) SetBGAThreshold((UShort_t) val);
+       else if(name.Contains("BGCThreshold")) SetBGCThreshold((UShort_t) val);
+       else if(name.Contains("BBAForBGThreshold")) SetBBAForBGThreshold((UShort_t) val);
+       else if(name.Contains("BBCForBGThreshold")) SetBBCForBGThreshold((UShort_t) val);
+       else if(name.Contains("MultV0AThrLow")) SetMultV0AThrLow((UShort_t) val);
+       else if(name.Contains("MultV0AThrHigh")) SetMultV0AThrHigh((UShort_t) val);
+       else if(name.Contains("MultV0CThrLow")) SetMultV0CThrLow((UShort_t) val);
+       else if(name.Contains("MultV0CThrHigh")) SetMultV0CThrHigh((UShort_t) val);
+       else if(name.Contains("TriggerSelect")) SetTriggerSelected((UShort_t) val, iChannel-1 );
+       else if(name.Contains("EnableCharge")) SetEnableCharge((Bool_t) val, iBoard , iChannel-1);
+       else if(name.Contains("EnableTiming")) SetEnableTiming((Bool_t) val, iBoard , iChannel-1);
+       else if(name.Contains("PedOdd")) SetOnlinePedestal((UShort_t) val, 1, iBoard, iChannel-1);
+       else if(name.Contains("PedEven")) SetOnlinePedestal((UShort_t) val, 0, iBoard, iChannel-1);
+       else if(name.Contains("PedCutOdd")) SetOnlinePedestalCut((UShort_t) val, 1, iBoard, iChannel-1);
+       else if(name.Contains("PedCutEven")) SetOnlinePedestalCut((UShort_t) val, 0, iBoard, iChannel-1);
+       
        else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));
        //
        delete nameSplit;
@@ -637,6 +719,372 @@ void AliADCalibData::SetDiscriThr(const Float_t* thresholds)
   else for(int t=0; t<16; t++) fDiscriThr[t] = 2.5;
 }
 
+
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestalCut(UShort_t val,Int_t integrator, Int_t channel)
+{
+       // Set Pedestal Cut of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) fPedestalCutOdd[channel] = val;
+               else fPedestalCutEven[channel] = val;
+       } else AliError(Form("Impossible to write at : Channel %d",channel));
+}
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestalCut(UShort_t val,Int_t integrator, Int_t board, Int_t channel)
+{
+  Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+  if(ch>=0 && ch<16) {
+               if(integrator) fPedestalCutOdd[ch] = val;
+               else fPedestalCutEven[ch] = val;
+  }
+  else
+    AliError("Board/Channel numbers are not valid");
+}
+//________________________________________________________________
+UShort_t AliADCalibData::GetOnlinePedestalCut(Int_t integrator, Int_t channel)
+{
+       // Get Pedestal Cut of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) return(fPedestalCutOdd[channel]);
+               else return(fPedestalCutEven[channel]);
+       }else AliError(Form("Impossible to read at : Channel %d",channel));
+       return 0;
+}
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t channel)
+{
+       // Set Pedestal of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) fPedestalOdd[channel] = val;
+               else fPedestalEven[channel] = val;
+       } else AliError(Form("Impossible to write at : Channel %d ; Integrator %d ",channel,integrator));
+}
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestal(UShort_t val,Int_t integrator, Int_t board, Int_t channel)
+{
+  Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+  if(ch>=0 && ch<16) {
+               if(integrator) fPedestalOdd[ch] = val;
+               else fPedestalEven[ch] = val;
+  }
+  else
+    AliError("Board/Channel numbers are not valid");
+}
+//________________________________________________________________
+UShort_t AliADCalibData::GetOnlinePedestal(Int_t integrator, Int_t channel)
+{
+       // Get Pedestal of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) return(fPedestalOdd[channel]);
+               else return(fPedestalEven[channel]);
+       } else AliError(Form("Impossible to read at : Channel %d",channel));
+       return 0;
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableCharge(Bool_t val, Int_t channel)
+{
+       // Set the channels enabled for Charge triggers
+       if(channel>=0 && channel<16) fEnableCharge[channel] = val;
+       else AliError(Form("Impossible to write at : Channel %d",channel));
+}
+//________________________________________________________________
+Bool_t AliADCalibData::GetEnableCharge(Int_t channel)
+{
+       // Get the channels enabled for Charge triggers
+       if(channel>=0 && channel<16) return(fEnableCharge[channel]);
+       else AliError(Form("Impossible to read at : Channel %d",channel));
+       return kFALSE;
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableTiming(Bool_t val, Int_t channel)
+{
+       // Set the channels enabled for Timing triggers
+       if(channel>=0 && channel<16) fEnableTiming[channel] = val;
+       else AliError(Form("Impossible to write at : Channel %d",channel));
+}
+//________________________________________________________________
+Bool_t AliADCalibData::GetEnableTiming(Int_t channel)
+{
+       // Get the channels enabled for Timing triggers
+       if(channel>=0 && channel<16) return(fEnableTiming[channel]);
+       else AliError(Form("Impossible to read at : Channel %d",channel));
+       return kFALSE;
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableCharge(Bool_t val,Int_t board, Int_t channel)
+{
+       Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+       // Set the channels enabled for Charge triggers
+       if(ch>=0) fEnableCharge[ch] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableTiming(Bool_t val,Int_t board, Int_t channel)
+{
+       Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+       // Set the channels enabled for Timing triggers
+       if(ch>=0) fEnableTiming[ch] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+void AliADCalibData::SetTriggerSelected(UShort_t trigger, Int_t output)
+{
+       // Set the trigger selected on the outputs to CTP
+       if(output>=0 && output<5) fTriggerSelected[output] = trigger;
+       else AliError(Form("Trigger output number %d not valid",output));
+}
+
+//________________________________________________________________
+void AliADCalibData::SetClk1Win1(UShort_t* clks)
+{
+       // Set Win clock of BB
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win1(clks[t],t);
+       else AliError("Profil Clock1 Win1 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win1(UShort_t* clks)
+{
+       // Set Win clock of BB
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win1(clks[t],t);
+       else AliError("Profil Clock2 Win1 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk1Win1(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk1Win1[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win1 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win1(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk2Win1[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win1 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetClk1Win2(UShort_t* clks)
+{
+       // Set Win clock of BG
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win2(clks[t],t);
+       else AliError("Profil Clock1 Win2 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win2(UShort_t* clks)
+{
+       // Set Win clock of BG
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win2(clks[t],t);
+       else AliError("Profil Clock2 Win2 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk1Win2(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk1Win2[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win2 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win2(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk2Win2[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win2 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win1(UShort_t* delays)
+{
+       // Set Delay for Win clock of BB
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win1(delays[t],t);
+       else AliError("Profil Clock1 Win1 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win1(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BB
+       if(delay>1023){
+               AliWarning(Form("Profil Clock1 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk1Win1[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win1(UShort_t* delays)
+{
+       // Set Delay for Win clock of BB
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win1(delays[t],t);
+       else AliError("Profil Clock2 Win1 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win1(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BB
+       if(delay>1023){
+               AliWarning(Form("Profil Clock2 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk2Win1[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win2(UShort_t* delays)
+{
+       // Set Delay for Win clock of BG
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win2(delays[t],t);
+       else AliError("Profil Clock1 Win2 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win2(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BG
+       if(delay>1023){
+               AliWarning(Form("Profil Clock1 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk1Win2[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win2(UShort_t* delays)
+{
+       // Set Delay for Win clock of BG
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win2(delays[t],t);
+       else AliError("Profil Clock2 Win2 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win2(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BG
+       if(delay>1023){
+               AliWarning(Form("Profil Clock2 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk2Win2[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin1(UShort_t *latchs){
+       // Set Latch Win clock for BB
+       if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin1(latchs[t],t);
+       else AliError("Latch Win1 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin1(UShort_t latch, Int_t board)
+{
+       // Set Latch Win clock for BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fLatchWin1[board] = latch;
+               if(!IsClkValid(latch)) AliWarning(Form("Latch Win1 of board %d is not valid : %d",board,latch));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin2(UShort_t *latchs){
+       // Set Latch Win clock for BG
+       if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin2(latchs[t],t);
+       else AliError("Latch Win2 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin2(UShort_t latch, Int_t board)
+{
+       // Set Latch Win clock for BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fLatchWin2[board] = latch;
+               if(!IsClkValid(latch)) AliWarning(Form("Latch Win2 of board %d is not valid : %d",board,latch));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin1(UShort_t *resets){
+       // Set Reset Win clock for BB
+       if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin1(resets[t],t);
+       else AliError("Reset Win1 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin1(UShort_t reset, Int_t board)
+{
+       // Set Reset Win clock for BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fResetWin1[board] = reset;
+               if(!IsClkValid(reset)) AliWarning(Form("Reset Win1 of board %d is not valid : %d",board,reset));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin2(UShort_t *resets){
+       // Set Reset Win clock for BG
+       if(resets)  for(int t=0; t<kNCIUBoards; t++) SetResetWin2(resets[t],t);
+       else AliError("Reset Win2 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin2(UShort_t reset, Int_t board)
+{
+       // Set Reset Win clock for BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fResetWin2[board] = reset;
+               if(!IsClkValid(reset)) AliWarning(Form("Reset Win2 of board %d is not valid : %d",board,reset));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetPedestalSubtraction(Bool_t *peds){
+       // Set Pedestal Subtraction Parameter
+       if(peds)  for(int t=0; t<kNCIUBoards; t++) SetPedestalSubtraction(peds[t],t);
+       else AliError("Pedestal Subtraction Not defined.");
+       
+}
+//________________________________________________________________
+void AliADCalibData::SetPedestalSubtraction(Bool_t ped, Int_t board)
+{
+       // Set Pedestal Subtraction Parameter
+       if((board>=0) && (board<kNCIUBoards)) fPedestalSubtraction[board] = ped;
+       else AliError(Form("Board %d is not valid",board));
+}
+
+//________________________________________________________________
+Bool_t AliADCalibData::IsClkValid(UShort_t clock) const {
+       // Check if the given clock has a valid profil.
+       Bool_t word[5];
+       Bool_t isValid = kTRUE;
+       Short_t risingEdge = 0;
+       Short_t fallingEdge = 0;
+       for(int i=0 ; i<5 ; i++) word[i] = (clock >> i) & 0x1;
+       
+       if(word[0] != word[4]){
+               if(word[4]) fallingEdge++;
+               else risingEdge++;
+       }       
+       for(int i=1 ; i<5 ; i++){
+               if(word[i] != word[i-1]) {
+                       if(word[i-1]) fallingEdge++;
+                       else risingEdge++;
+               }
+       }
+       if((fallingEdge>1)||(risingEdge>1)) isValid = kFALSE;
+       if(((risingEdge==0)&&(fallingEdge==0)) &&(!word[0]))  isValid = kFALSE;
+       return isValid;
+}
+
 //________________________________________________________________
 Int_t AliADCalibData::GetOfflineChannelNumber(Int_t board, Int_t channel)
 {
index a574c92d532637a3c1ebcd5f0e8b73b5b19868e8..ad410068eac8ff45bd4a895f4d9b6bc66abe9f5b 100644 (file)
@@ -61,6 +61,62 @@ class AliADCalibData: public TNamed {
   Float_t  GetDiscriThr(Int_t channel) const {return fDiscriThr[channel];}
   Float_t* GetDiscriThr()   const {return (Float_t*)fDiscriThr;}
   Float_t  GetCalibDiscriThr(Int_t channel, Bool_t scaled);
+  
+  UShort_t * GetClk1Win1() const {return (UShort_t*)fClk1Win1;};
+  UShort_t GetClk1Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk1Win1[board]:0);};
+  UShort_t * GetClk2Win1() const {return (UShort_t*)fClk2Win1;};
+  UShort_t GetClk2Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk2Win1[board]:0);};
+
+  UShort_t * GetClk1Win2() const {return (UShort_t*)fClk1Win2;};
+  UShort_t GetClk1Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk1Win2[board]:0);};
+  UShort_t * GetClk2Win2() const {return (UShort_t*)fClk2Win2;};
+  UShort_t GetClk2Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk2Win2[board]:0);};
+
+  UShort_t * GetDelayClk1Win1() const {return (UShort_t*)fDelayClk1Win1;};
+  UShort_t GetDelayClk1Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk1Win1[board]:0);};
+  UShort_t * GetDelayClk2Win1() const {return (UShort_t*)fDelayClk2Win1;};
+  UShort_t GetDelayClk2Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk2Win1[board]:0);};
+  
+  UShort_t * GetDelayClk1Win2() const {return (UShort_t*)fDelayClk1Win2;};
+  UShort_t GetDelayClk1Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk1Win2[board]:0);};
+  UShort_t * GetDelayClk2Win2() const {return (UShort_t*)fDelayClk2Win2;};
+  UShort_t GetDelayClk2Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk2Win2[board]:0);};
+  
+  UShort_t * GetLatchWin1() const {return (UShort_t*)fLatchWin1;};
+  UShort_t GetLatchWin1(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fLatchWin1[board]:0);};
+  UShort_t * GetLatchWin2() const {return (UShort_t*)fLatchWin2;};
+  UShort_t GetLatchWin2(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fLatchWin2[board]:0);};
+  
+  UShort_t * GetResetWin1() const {return (UShort_t*)fResetWin1;};
+  UShort_t GetResetWin1(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fResetWin1[board]:0);};
+  UShort_t * GetResetWin2() const {return (UShort_t*)fResetWin2;};
+  UShort_t GetResetWin2(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fResetWin2[board]:0);};
+  
+  Bool_t * GetPedestalSubtraction() const {return (Bool_t*) fPedestalSubtraction;};
+  Bool_t GetPedestalSubtraction(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fPedestalSubtraction[board]:0);};
+
+  UShort_t GetBBAThreshold() const {return fBBAThreshold;};
+  UShort_t GetBBCThreshold() const {return fBBCThreshold;};
+
+  UShort_t GetBGAThreshold() const {return fBGAThreshold;};
+  UShort_t GetBGCThreshold() const {return fBGCThreshold;};
+
+  UShort_t GetBBAForBGThreshold() const {return fBBAForBGThreshold;};
+  UShort_t GetBBCForBGThreshold() const {return fBBCForBGThreshold;};
+  
+  UShort_t GetMultV0AThrLow() const {return fMultV0AThrLow;};
+  UShort_t GetMultV0AThrHigh() const {return fMultV0AThrHigh;};
+
+  UShort_t GetMultV0CThrLow() const {return fMultV0CThrLow;};
+  UShort_t GetMultV0CThrHigh() const {return fMultV0CThrHigh;};
+
+  UShort_t GetTriggerSelected(Int_t output) const {return ((output>=0 && output<5)?fTriggerSelected[output]:0);};
+  
+  Bool_t GetEnableCharge(Int_t channel);
+  Bool_t GetEnableTiming(Int_t channel);
+  UShort_t GetOnlinePedestal(Int_t integrator, Int_t channel);
+  UShort_t GetOnlinePedestalCut(Int_t integrator, Int_t channel);
+
 
   static Int_t GetBoardNumber(Int_t channel);
   static Int_t GetFEEChannelNumber(Int_t channel);
@@ -109,13 +165,73 @@ class AliADCalibData: public TNamed {
   void     SetDiscriThr(Float_t thr, Int_t board, Int_t channel);
   void     SetDiscriThr(const Float_t* thresholds);
 
+  void SetClk1Win1(UShort_t* clks);
+  void SetClk1Win1(UShort_t clk, Int_t board);
+  void SetClk2Win1(UShort_t* clks);
+  void SetClk2Win1(UShort_t clk, Int_t board);
+  
+  void SetClk1Win2(UShort_t* clks);
+  void SetClk1Win2(UShort_t clk, Int_t board);
+  void SetClk2Win2(UShort_t* clks);
+  void SetClk2Win2(UShort_t clk, Int_t board);
+  
+  void SetDelayClk1Win1(UShort_t* delays);
+  void SetDelayClk1Win1(UShort_t delay, Int_t board);
+  void SetDelayClk2Win1(UShort_t* delays);
+  void SetDelayClk2Win1(UShort_t delay, Int_t board);
+  
+  void SetDelayClk1Win2(UShort_t* delays);
+  void SetDelayClk1Win2(UShort_t delay, Int_t board);
+  void SetDelayClk2Win2(UShort_t* delays);
+  void SetDelayClk2Win2(UShort_t delay, Int_t board);
+  
+  void SetLatchWin1(UShort_t *latchs);
+  void SetLatchWin1(UShort_t latch, Int_t board);
+  void SetLatchWin2(UShort_t *latchs);
+  void SetLatchWin2(UShort_t latch, Int_t board);
+  
+  void SetResetWin1(UShort_t *resets);
+  void SetResetWin1(UShort_t reset, Int_t board);
+  void SetResetWin2(UShort_t *resets);
+  void SetResetWin2(UShort_t reset, Int_t board);
+  
+  void SetPedestalSubtraction(Bool_t *peds);
+  void SetPedestalSubtraction(Bool_t ped, Int_t board);
+  
+  void SetBBAThreshold(UShort_t th) {fBBAThreshold = th;};
+  void SetBBCThreshold(UShort_t th) {fBBCThreshold = th;};
+
+  void SetBGAThreshold(UShort_t th) {fBGAThreshold = th;};
+  void SetBGCThreshold(UShort_t th) {fBGCThreshold = th;};
+
+  void SetBBAForBGThreshold(UShort_t th) {fBBAForBGThreshold = th;};
+  void SetBBCForBGThreshold(UShort_t th) {fBBCForBGThreshold = th;};
+  
+  
+  void SetMultV0AThrLow(UShort_t th) {fMultV0AThrLow = th;};
+  void SetMultV0AThrHigh(UShort_t th) {fMultV0AThrHigh = th;};
+  
+  void SetMultV0CThrLow(UShort_t th) {fMultV0CThrLow = th;};
+  void SetMultV0CThrHigh(UShort_t th) {fMultV0CThrHigh = th;};
+  
+  void SetTriggerSelected(UShort_t trigger, Int_t output);
+  
+  void SetEnableCharge(Bool_t val, Int_t board, Int_t channel);
+  void SetEnableTiming(Bool_t val, Int_t board, Int_t channel);
+  void SetEnableCharge(Bool_t val, Int_t channel);
+  void SetEnableTiming(Bool_t val, Int_t channel);
+  void SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
+  void SetOnlinePedestalCut(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
+  void SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t channel);
+  void SetOnlinePedestalCut(UShort_t val, Int_t integrator, Int_t channel);
 
  protected:
   void     InitLightYields();
   void     InitPMGains();
+  Bool_t   IsClkValid(UShort_t clock) const;
 
-  Float_t  fPedestal[32];     // Mean pedestal values
-  Float_t  fSigma[32];        // Sigmas of pedestal peaks
+  Float_t  fPedestal[32];     // Mean pedestal values - used offline
+  Float_t  fSigma[32];        // Sigmas of pedestal peaks - used offline
   Float_t  fADCmean[32];      // ADC mean values
   Float_t  fADCsigma[32];     // ADC sigma values
   Float_t  fMeanHV[16];        // Mean PMT HV needed to compute MIP value
@@ -131,6 +247,37 @@ class AliADCalibData: public TNamed {
   UInt_t   fSearchWindow[kNCIUBoards];// HPTDC search window (25ns units)
   UInt_t   fTriggerCountOffset[kNCIUBoards]; // HPTDC trigger count offset (25ns units)
   UInt_t   fRollOver[kNCIUBoards]; // HPTDC roll-over (25ns units)
+  
+  UShort_t fClk1Win1[kNCIUBoards]; //Profil of the Clock 1  of the Window 1 (BB window)
+  UShort_t fClk2Win1[kNCIUBoards]; //Profil of the Clock 2  of the Window 1 (BB window)
+  UShort_t fClk1Win2[kNCIUBoards]; //Profil of the Clock 1  of the Window 2 (BG window)
+  UShort_t fClk2Win2[kNCIUBoards]; //Profil of the Clock 2  of the Window 2 (BG window)
+  UShort_t fDelayClk1Win1[kNCIUBoards]; // Delays of the Clock 1  of the Window 1 (BB window)
+  UShort_t fDelayClk2Win1[kNCIUBoards]; // Delays of the Clock 2 of the Window 1 (BB window)
+  UShort_t fDelayClk1Win2[kNCIUBoards]; // Delays of the Clock 1  of the Window 2 (BG window)
+  UShort_t fDelayClk2Win2[kNCIUBoards]; // Delays of the Clock 2 of the Window 2 (BG window)
+  UShort_t fLatchWin1[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 1 (BB window)
+  UShort_t fLatchWin2[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 2 (BG window)
+  UShort_t fResetWin1[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 1 (BB window)
+  UShort_t fResetWin2[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 2 (BG window)
+  Bool_t   fPedestalSubtraction[kNCIUBoards]; // Flag to en(dis)able pedestal subtraction before centrality trigger calculation
+  UShort_t fBBAThreshold;  // Minimum bias Threshold in number of channel hit for ADA
+  UShort_t fBBCThreshold;  // Minimum bias Threshold in number of channel hit for ADC
+  UShort_t fBGAThreshold;  // Beam Gas Threshold in number of channel hit for ADA
+  UShort_t fBGCThreshold;  // Beam Gas Threshold in number of channel hit for ADC
+  UShort_t fBBAForBGThreshold;  // BBA threshold for Beam Gas triggers (i.e. BBA and BGC)
+  UShort_t fBBCForBGThreshold;  // BBC threshold for Beam Gas triggers (i.e. BBC and BGA)
+  UShort_t fMultV0AThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultV0AThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultV0CThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultV0CThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fTriggerSelected[5]; // Triggers selected on the 5 outputs to CTP
+  Bool_t   fEnableCharge[16]; // Flag to know is a channel is participating to the Charge triggers
+  Bool_t   fEnableTiming[16]; // Flag to know is a channel is participating to the Timing triggers
+  UShort_t fPedestalOdd[16]; // Pedestals for the Odd integrators
+  UShort_t fPedestalEven[16]; // Pedestals for the Even integrators
+  UShort_t fPedestalCutOdd[16]; // Pedestals Cut for the Odd integrators
+  UShort_t fPedestalCutEven[16]; // Pedestals Cut for the Even integrators
 
   Float_t  fDiscriThr[16];     // Discriminator thresholds
 
index 280c3924f2e753558a01c83eff550fc002c4cdb2..241b487646c7eb05ed83e40a131255c4417d8d19 100644 (file)
@@ -485,7 +485,7 @@ Int_t AliTriggerAnalysis::SPDFiredChips(const AliESDEvent* aEsd, Int_t origin, B
   // layer  = 2 --> outer
   
   const AliMultiplicity* mult = aEsd->GetMultiplicity();
-  if (!mult) { AliFatal("AliMultiplicity not available"); }
+  if (!mult) { AliFatal("AliMultiplicity not available"); return 0; }
   
   if (origin == 0) {
     if (layer == 0) return mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1);
@@ -1007,7 +1007,7 @@ Bool_t AliTriggerAnalysis::IsSPDClusterVsTrackletBG(const AliVEvent* event, Bool
   // rejects BG based on the cluster vs tracklet correlation
   // returns true if the event is BG
   const AliVMultiplicity* mult = event->GetMultiplicity();
-  if (!mult) { AliFatal("No multiplicity object"); }
+  if (!mult) { AliFatal("No multiplicity object"); return 0; }
   Int_t ntracklet   = mult->GetNumberOfTracklets();
   Int_t spdClusters = event->GetNumberOfITSClusters(0) + event->GetNumberOfITSClusters(1);
   if(fillHists) fHistSPDClsVsTrk->Fill(ntracklet,spdClusters);
index be2ae89988ee3a632729760d21c39be702f6c55b..d363ed1219ceec22a7d5242048f3e3134832be62 100644 (file)
@@ -1,5 +1,5 @@
 AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
-                                    Bool_t tuneOnData=kFALSE, Int_t recoPass=2,
+                                    Bool_t tuneOnData=kTRUE, Int_t recoPass=2,
                                     Bool_t cachePID=kFALSE, TString detResponse="",
                                     Bool_t useTPCEtaCorrection = kTRUE,/*Please use default value! Otherwise splines can be off*/
                                     Bool_t useTPCMultiplicityCorrection = kTRUE,/*Please use default value! Otherwise splines can be off*/
@@ -15,12 +15,13 @@ AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
   AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
 
   //case of multi input event handler (needed for mixing)
+  //WARNING: most probably this is not fully supported!
   if (inputHandler->IsA() == AliMultiInputEventHandler::Class()) {
     printf("========================================================================================\n");
     printf("PIDResponse: AliMultiInputEventHandler detected, initialising AliPIDResponseInputHandler\n");
     printf("========================================================================================\n");
     AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
-    
+
     AliPIDResponseInputHandler *pidResponseIH = new AliPIDResponseInputHandler();
     multiInputHandler->AddInputEventHandler(pidResponseIH);
 
@@ -32,16 +33,25 @@ AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
   // standard with task
   printf("========================================================================================\n");
   printf("PIDResponse: Initialising AliAnalysisTaskPIDResponse\n");
-  printf("========================================================================================\n");
-  
+
   AliAnalysisTaskPIDResponse *pidTask = new AliAnalysisTaskPIDResponse("PIDResponseTask");
 //   pidTask->SelectCollisionCandidates(AliVEvent::kMB);
   pidTask->SetIsMC(isMC);
-  if(isMC&&tuneOnData) {
-    pidTask->SetTuneOnData(kTRUE,recoPass);
-    // tuning on MC is by default active on TPC and TOF, to enable it only on one of them use:
-    // pidTask->SetTuneOnDataMask(AliPIDResponse::kDetTPC);   
-    // pidTask->SetTuneOnDataMask(AliPIDResponse::kDetTOF);   
+  if(isMC){
+    if (tuneOnData) {
+      printf("             Using MC with tune on data.\n");
+      printf("             !!! ATTENTION ATTENTION ATTENTION !!!\n");
+      printf("             You MUST make sure the reco pass set (%d) corresponds to the one this MC was produced for!\n",recoPass);
+      pidTask->SetTuneOnData(kTRUE,recoPass);
+      // tuning on MC is by default active on TPC and TOF, to enable it only on one of them use:
+      // pidTask->SetTuneOnDataMask(AliPIDResponse::kDetTPC);
+      // pidTask->SetTuneOnDataMask(AliPIDResponse::kDetTOF);
+    } else {
+      printf("             !!! ATTENTION ATTENTION ATTENTION !!!\n");
+      printf("             You are using MC without the tune on data option.\n");
+      printf("             NOTE that this is not supported any longer!.\n");
+      printf("             !!! ATTENTION ATTENTION ATTENTION !!!\n");
+    }
   }
   pidTask->SetCachePID(cachePID);
   pidTask->SetSpecialDetectorResponse(detResponse);
@@ -49,13 +59,14 @@ AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
   pidTask->SetUseTPCMultiplicityCorrection(useTPCMultiplicityCorrection);
   pidTask->SetUserDataRecoPass(recoDataPass);
   mgr->AddTask(pidTask);
-  
+
 //   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("PIDResponseQA",
 //     TList::Class(), AliAnalysisManager::kOutputContainer,
 //     "PIDResponseQA.root");
-  
+
   mgr->ConnectInput(pidTask, 0, mgr->GetCommonInputContainer());
 //   mgr->ConnectOutput(pidTask,1,coutput1);
-  
+  printf("========================================================================================\n");
+
   return pidTask;
 }
index 8390d538add818018b05d94754c9fe3dc64990e5..8a44a28dfd414958b9c66dc4d9850c8b5016a400 100644 (file)
@@ -161,6 +161,15 @@ else()
     message(STATUS "No Fortran support. Disabling LHAPDF, PHYTIA6, MICROCERN, etc.")
 endif()
 
+# Optional: Doxygen for reference doc generation
+find_package(Doxygen)
+if(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+    message(STATUS "Doxygen ${DOXYGEN_VERSION} and Graphviz found: ${DOXYGEN_EXECUTABLE}, ${DOXYGEN_DOT_EXECUTABLE}")
+    set(CAN_GENERATE_DOC TRUE)
+else()
+    message(STATUS "Doxygen and Graphviz not found. Disabling support for documentation generation")
+endif(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+
 # DATE
 if(DATE_CONFIG)
     find_package(DATE)
@@ -247,6 +256,7 @@ add_subdirectory(TRIGGER)
 add_subdirectory(TTherminator)
 add_subdirectory(VZERO)
 add_subdirectory(ZDC)
+add_subdirectory(doxygen)
 
 # Fortran modules
 if(CMAKE_Fortran_COMPILER)
index 440c85ddf5028ec9d43f95129f55576c5e87f8e3..cbd43185a9fddc10eb105aecd13539cfd0f4dc65 100644 (file)
@@ -2203,6 +2203,9 @@ C     ENDIF
       LOGICAL LPROD
       CHARACTER*8 CGLB
       COMMON /DTGLGP/ JSTATB,JBINSB,CGLB,IOGLB,LPROD
+      COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 
       DIMENSION WHAT(6)
 
@@ -2302,6 +2305,7 @@ C        IF (LFZC) CALL DT_DECAY1
 
 C     IF (NEVHKK.EQ.5) CALL DT_EVTOUT(4)
       RETURN
+
  9999 CONTINUE
       IREJ = 1
 
@@ -3498,7 +3502,8 @@ C #include "dtu_dtevtp.inc"
       COMMON /DTLTSU/ BGX,BGY,BGZ,GAM
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * flags for diffractive interactions (DTUNUC 1.x)
       COMMON /DTFLG3/ ISINGD,IDOUBD,IFLAGD,IDIFF
 * statistics: double-Pomeron exchange
@@ -5195,9 +5200,7 @@ C           ENDIF
       IREJ   = 0
       ICREQU = ICREQU+1
       NC     = 0
-      NCP    = 0
-      NCT    = 0
-
     1 CONTINUE
       ICSAMP = ICSAMP+1
       NC     = NC+1
@@ -5236,15 +5239,19 @@ C           ENDIF
          ITOLD  = IT
          JJPOLD = JJPROJ
          EPROLD = EPROJ
+         NCP    = 0
+         NCT    = 0
+
         DO 8 I=1, IP
            NCP = NCP+JSSH(I)
 *          WRITE(6,*)' PROJ.NUCL. ',I,' NCOLL = ',NCP 
     8 CONTINUE
+      write(6,*) "why this (1)", NCP, NCT
         DO 9 I=1, IT
-           NCT = NCT+JTSH(I)
-*          WRITE(6,*)' TAR.NUCL. ',I,' NCOLL = ',NCT 
+           NCT = NCT +JTSH(I)
+*          WRITE(6,*)' TAR.NUCL. ',I,' NCOLL = ',NCT
     9 CONTINUE
-      ENDIF
+       ENDIF
 
 * force diffractive particle production in h-K interactions
       IF (((ABS(ISINGD).GT.1).OR.(ABS(IDOUBD).GT.1)).AND.
@@ -5500,7 +5507,8 @@ C           ENDIF
      &                IICH(210),IIBAR(210),K1(210),K2(210)
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * flavors of partons (DTUNUC 1.x)
       COMMON /DTDPMF/ IPVQ(MAXVQU),IPPV1(MAXVQU),IPPV2(MAXVQU),
      &                ITVQ(MAXVQU),ITTV1(MAXVQU),ITTV2(MAXVQU),
@@ -5739,7 +5747,8 @@ C        ENDIF
      &                IICH(210),IIBAR(210),K1(210),K2(210)
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 **temporary
 * statistics: Glauber-formalism
       COMMON /DTSTA3/ ICWP,ICWT,NCSY,ICWPG,ICWTG,ICIG,IPGLB,ITGLB,NGLB
@@ -8718,8 +8727,8 @@ C     PA2(3) = SIGN(SQRT(PZ2NSQ),PA2(3))
      &                IREXCI(3),IRDIFF(2),IRINC
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
-
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
       DIMENSION R(3),PIN(4),POUT(4),DEV(4)
 
       DO 1 K=1,4
@@ -8826,7 +8835,8 @@ C              PHKK(K,I) = PHKK(K,I)-DEV(K)/DBLE(NVAL)
      &                IREXCI(3),IRDIFF(2),IRINC
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * various options for treatment of partons (DTUNUC 1.x)
 * (chain recombination, Cronin,..)
       LOGICAL LCO2CR,LINTPT
@@ -10709,7 +10719,8 @@ C                    ENDIF
       COMMON /DTGPRO/ VIRT,PGAMM(4),PLEPT0(4),PLEPT1(4),PNUCL(4),IDIREC
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * Glauber formalism: flags and parameters for statistics
       LOGICAL LPROD
       CHARACTER*8 CGLB
@@ -16059,7 +16070,8 @@ C           QARJ(I) = PARJ(I)
       COMMON /DTPRTA/ IT,ITZ,IP,IPZ,IJPROJ,IBPROJ,IJTARG,IBTARG
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * flags for input different options
       LOGICAL LEMCCK,LHADRO,LSEADI,LEVAPO
       COMMON /DTFLG1/ IFRAG(2),IRESCO,IMSHL,IRESRJ,IOULEV(6),
@@ -16247,7 +16259,8 @@ C9990 CONTINUE
      &                IICH(210),IIBAR(210),K1(210),K2(210)
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * nuclear potential
       LOGICAL LFERMI
       COMMON /DTNPOT/ PFERMP(2),PFERMN(2),FERMOD,
index 863d66b1cb5727cc72f4110cf021a7a5f1bab754..53ebe99b321697cea10575cac042e5e382a44292 100644 (file)
@@ -5552,8 +5552,6 @@ C           ENDIF
       IREJ   = 0
       ICREQU = ICREQU+1
       NC     = 0
-      NCP    = 0
-      NCT    = 0
 
     1 CONTINUE
       ICSAMP = ICSAMP+1
@@ -5593,6 +5591,9 @@ C           ENDIF
          ITOLD  = IT
          JJPOLD = JJPROJ
          EPROLD = EPROJ
+         NCP    = 0
+         NCT    = 0
+
       DO 8 I=1, IP
         NCP = NCP+JSSH(I)
 *        WRITE(6,*)' PROJ.NUCL. ',I,' NCOLL = ',NCP
old mode 100644 (file)
new mode 100755 (executable)
index 73dc0f1..b4a61ed
@@ -94,9 +94,6 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry()
     fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
     fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fPhiSuperModule(0),fNPhiSuperModule(0),
     fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
-    // Trigger staff
-    fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0), fNTotalTRU(0),
-    // 
     fTrd1Angle(0.),f2Trd1Dx2(0.),fPhiGapForSM(0.),fKey110DEG(0),fnSupModInDCAL(0),fPhiBoundariesOfSM(0),
     fPhiCentersOfSM(0),fPhiCentersOfSMSec(0),fEtaMaxOfTRD1(0),fTrd1AlFrontThick(0.0), fTrd1BondPaperThick(0.),
     fCentersOfCellsEtaDir(0), fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
@@ -126,9 +123,6 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const Text_t* name, const Text_t* title
     fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
     fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fPhiSuperModule(0),fNPhiSuperModule(0),
     fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
-    // Trigger staff
-    fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0), fNTotalTRU(0),
-    // 
     fTrd1Angle(0.),f2Trd1Dx2(0.),fPhiGapForSM(0.),fKey110DEG(0),fnSupModInDCAL(0),fPhiBoundariesOfSM(0),
     fPhiCentersOfSM(0),fPhiCentersOfSMSec(0),fEtaMaxOfTRD1(0),fTrd1AlFrontThick(0.0), fTrd1BondPaperThick(0.),
     fCentersOfCellsEtaDir(0),fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
@@ -192,14 +186,6 @@ AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
     fNCells(geom.fNCells),
     fNCellsInSupMod(geom.fNCellsInSupMod),
     fNCellsInModule(geom.fNCellsInModule),
-    // Trigger staff
-    fNTRUEta(geom.fNTRUEta),
-    fNTRUPhi(geom.fNTRUPhi),
-    fNModulesInTRUEta(geom.fNModulesInTRUEta),
-    fNModulesInTRUPhi(geom.fNModulesInTRUPhi),
-    fNEtaSubOfTRU(geom.fNEtaSubOfTRU),
-    fNTotalTRU(geom.fNTotalTRU),
-    //
     fTrd1Angle(geom.fTrd1Angle),
     f2Trd1Dx2(geom.f2Trd1Dx2),
     fPhiGapForSM(geom.fPhiGapForSM),
@@ -553,31 +539,6 @@ void AliEMCALEMCGeometry::Init(const Text_t* mcname, const Text_t* mctitle){
   //called after setting of scintillator and lead layer parameters
   DefineSamplingFraction(mcname,mctitle);
 
-  
-  // TRU parameters - Apr 29,08 by PAI. 
-  // These parameters values was updated at Nov 05, 2007
-  // As is on Olivier  BOURRION (LPSC) ppt preasentation 
-  // at ALICE trigger meeting at 13th-14th March
-  fNTRUEta = 1;           // was 3
-  fNTRUPhi = 3;           // was 1
-  fNModulesInTRUEta = 24; // was 8
-  fNModulesInTRUPhi = 4;  // was 12
-  // Jet trigger 
-  // 3*6*10 + 2*6*2 = 204 -> matrix (nphi(17), neta(12))
-  fNEtaSubOfTRU     = 6;  
-
-  fNTotalTRU = 0;
-  for(Int_t i = 0; i < GetNumberOfSuperModules(); i++){
-    if(      GetSMType(i) == kEMCAL_Standard)  fNTotalTRU += 3;
-    else if( GetSMType(i) == kEMCAL_Half)      fNTotalTRU += 1;
-    else if( GetSMType(i) == kEMCAL_3rd)       fNTotalTRU += 1;
-    else if( GetSMType(i) == kDCAL_Standard)   fNTotalTRU += 3;
-    else if( GetSMType(i) == kDCAL_Ext)        fNTotalTRU += 1;
-    else {
-      AliError(Form("Uknown SuperModule Type !!"));
-    }
-  }
-
   fgInit = kTRUE; 
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 40812b1..176013e
@@ -110,16 +110,7 @@ public:
   Int_t   GetKey110DEG()      const {return fKey110DEG;}
   Int_t   GetnSupModInDCAL()      const {return fnSupModInDCAL;}
   Int_t   GetILOSS() const {return fILOSS;}
-  Int_t   GetIHADR() const {return fIHADR;}
-    // For gamma(Jet) trigger simulations
-  Int_t    GetNTRU() const    {return fNTRUEta*fNTRUPhi ; }  
-  Int_t    GetNTRUEta() const {return fNTRUEta ; }  
-  Int_t    GetNTRUPhi() const {return fNTRUPhi ; }
-  Int_t    GetNEtaSubOfTRU() const {return fNEtaSubOfTRU;}
-  Int_t    GetNTotalTRU() const {return fNTotalTRU ; }
-  Int_t    GetNModulesInTRU() const {return fNModulesInTRUEta*fNModulesInTRUPhi; }
-  Int_t    GetNModulesInTRUEta() const {return fNModulesInTRUEta ; }  
-  Int_t    GetNModulesInTRUPhi() const {return fNModulesInTRUPhi ; }  
+  Int_t   GetIHADR() const {return fIHADR;}  
 
   // --
   Float_t  GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/ ((Float_t)fNZ);}
@@ -152,10 +143,6 @@ public:
                          printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
   void SetNPhi(Int_t nphi) { fNPhi= nphi; 
                              printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
-  void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru;
-               printf("SetNTRU: Number of TRUs per SuperModule in Eta set to %d", fNTRUEta) ;}
-  void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru;
-              printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
   void SetSampling(Float_t samp) { fSampling = samp; 
                               printf("SetSampling: Sampling factor set to %f", fSampling) ; }
 
@@ -237,13 +224,6 @@ private:
   Int_t   fNCells;                       // number of cells in calo
   Int_t   fNCellsInSupMod;               // number cell in super module
   Int_t   fNCellsInModule;               // number cell in module)
-  //TRU parameters
-  Int_t   fNTRUEta ;                     // Number of TRUs per module in eta
-  Int_t   fNTRUPhi ;                     // Number of TRUs per module in phi
-  Int_t   fNModulesInTRUEta;             // Number of modules per TRU in eta 
-  Int_t   fNModulesInTRUPhi;             // Number of modules per TRU in phi 
-  Int_t   fNEtaSubOfTRU;                 // Number of eta (z) subregiohi
-  Int_t   fNTotalTRU;                   // Total Number of TRU (all SM)
 
   // TRD1 options - 30-sep-04
   Float_t fTrd1Angle;                    // angle in x-z plane (in degree) 
old mode 100644 (file)
new mode 100755 (executable)
index 18c5c80..84e2ee4
 #include "AliLog.h"
 #include "AliEMCALGeometry.h"
 #include "AliEMCALShishKebabTrd1Module.h"
+#include "AliEMCALTriggerMappingV1.h"
+#include "AliEMCALTriggerMappingV2.h"
 
 ClassImp(AliEMCALGeometry)
 
@@ -125,7 +127,7 @@ const Char_t*      AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE12S
 
 //____________________________________________________________________________
 AliEMCALGeometry::AliEMCALGeometry():
-  fEMCGeometry(0x0),fGeoName(0),fEMCSMSystem(0x0),
+  fEMCGeometry(0x0),fTriggerMapping(0x0),fGeoName(0),fEMCSMSystem(0x0),
   fKey110DEG(0),fnSupModInDCAL(0),fNCellsInSupMod(0),fNETAdiv(0),fNPHIdiv(0),
   fNCellsInModule(0),fPhiBoundariesOfSM(0x0),fPhiCentersOfSM(0x0),
   fPhiCentersOfSMSec(0x0),fPhiCentersOfCells(0x0),fCentersOfCellsEtaDir(0x0),
@@ -148,15 +150,12 @@ AliEMCALGeometry::AliEMCALGeometry():
   fParSM[2]   = 0.;
   for (Int_t i=0;i<AliEMCALGeoParams::fgkEMCALModules;i++)
     fkSModuleMatrix[i]=0 ;
-
-  for (Int_t i = 0; i < 48; i++)
-   for (Int_t j = 0; j < 124; j++) fFastOR2DMap[i][j] = -1;
 }  
 
 //____________________________________________________________________________
 AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry & geo)
   : TNamed(geo),
-    fEMCGeometry(geo.fEMCGeometry),fGeoName(geo.fGeoName),fEMCSMSystem(geo.fEMCSMSystem),
+    fEMCGeometry(geo.fEMCGeometry),fTriggerMapping(geo.fTriggerMapping),fGeoName(geo.fGeoName),fEMCSMSystem(geo.fEMCSMSystem),
     fKey110DEG(geo.fKey110DEG),fnSupModInDCAL(geo.fnSupModInDCAL),fNCellsInSupMod(geo.fNCellsInSupMod),fNETAdiv(geo.fNETAdiv),fNPHIdiv(geo.fNPHIdiv),
     fNCellsInModule(geo.fNCellsInModule),fPhiBoundariesOfSM(geo.fPhiBoundariesOfSM),fPhiCentersOfSM(geo.fPhiCentersOfSM),
     fPhiCentersOfSMSec(geo.fPhiCentersOfSMSec),fPhiCentersOfCells(geo.fPhiCentersOfCells),fCentersOfCellsEtaDir(geo.fCentersOfCellsEtaDir),
@@ -178,16 +177,13 @@ AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry & geo)
   fParSM[2]   = geo.fParSM[2];
   for (Int_t i=0;i<AliEMCALGeoParams::fgkEMCALModules;i++)
     fkSModuleMatrix[i]=0 ;
-  
-  for (Int_t i = 0; i < 48; i++)
-    for (Int_t j = 0; j < 124; j++) fFastOR2DMap[i][j] = geo.fFastOR2DMap[i][j];
 }
 
 //____________________________________________________________________________
 AliEMCALGeometry::AliEMCALGeometry(const Text_t* name,   const Text_t* title,
                                    const Text_t* mcname, const Text_t* mctitle) 
   : TNamed(name, title),
-    fEMCGeometry(0x0),fGeoName(0),fEMCSMSystem(0x0),
+    fEMCGeometry(0x0),fTriggerMapping(0x0),fGeoName(0),fEMCSMSystem(0x0),
     fKey110DEG(0),fnSupModInDCAL(0),fNCellsInSupMod(0),fNETAdiv(0),fNPHIdiv(0),
     fNCellsInModule(0),fPhiBoundariesOfSM(0x0),fPhiCentersOfSM(0x0),
     fPhiCentersOfSMSec(0x0),fPhiCentersOfCells(0x0),fCentersOfCellsEtaDir(0x0),
@@ -266,11 +262,12 @@ AliEMCALGeometry::AliEMCALGeometry(const Text_t* name,   const Text_t* title,
     fEMCGeometry->Print();
     PrintGeometryGeoUtils();
   }
-
-  for (Int_t ix = 0; ix < 48; ix++)
-       for(Int_t jx = 0; jx < 124; jx++) fFastOR2DMap[ix][jx] = -1;
-
-  BuildFastOR2DMap();
+  
+  if ((fEMCGeometry->GetGeoName()).Contains("DCAL")) {
+    fTriggerMapping = new AliEMCALTriggerMappingV2(46, this);
+  } else { 
+    fTriggerMapping = new AliEMCALTriggerMappingV1(32, this);
+  }
 }
 
 //____________________________________________________________________________
@@ -303,6 +300,8 @@ AliEMCALGeometry::~AliEMCALGeometry(void)
     
     delete fEMCGeometry; // fEMCGeometry = 0 ;
   }
+  
+  if (fTriggerMapping) delete fTriggerMapping;
 }
 
 //______________________________________________________________________
@@ -1202,370 +1201,6 @@ Int_t AliEMCALGeometry::IsInEMCALOrDCAL(Double_t x, Double_t y, Double_t z) cons
   } 
 }
 
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm) const
-{ 
-  // Nov 6, 2007
-  // Get TRU absolute number from column, row and Super Module number
-  Int_t itru = row + col*fEMCGeometry->GetNModulesInTRUPhi() + sm*fEMCGeometry->GetNTRU();
-  // printf("  GetAbsTRUNumberFromNumberInSm : row %2i col %2i sm %2i -> itru %2i\n", row, col, sm, itru); 
-  return itru;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const
-{
-  //Trigger mapping method, get  FastOr Index from TRU
-
-  if (iTRU > GetNTotalTRU()-1 || iTRU < 0 || iADC > 95 || iADC < 0) 
-  {
-    AliError("TRU out of range!");
-    return kFALSE;
-  }
-       
-  id  = ( iTRU % 2 ) ? iADC%4 + 4 * (23 - int(iADC/4)) : (3 - iADC%4) + 4 * int(iADC/4);
-  id += iTRU * 96;
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const
-{
-  //Trigger mapping method, get TRU number from FastOr Index
-
-  Int_t nModule = GetNTotalTRU()*96;
-  if (id > nModule-1 || id < 0)
-  {
-    AliError("Id out of range!");
-    return kFALSE;
-  }
-       
-  iTRU = id / 96;
-  iADC = id % 96;
-  iADC = ( iTRU % 2 ) ? iADC%4 + 4 * (23 - int(iADC/4)) : (3 - iADC%4) + 4 * int(iADC/4);
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const
-{
-  //Trigger mapping method, get position in TRU from FasOr Index
-       
-  Int_t iADC=-1;       
-  if (!GetTRUFromAbsFastORIndex(id, iTRU, iADC)) return kFALSE;
-       
-  Int_t x = iADC / 4;
-  Int_t y = iADC % 4;
-  if ( iTRU % 2 ) // C side 
-  {
-    iEta = 23 - x;
-    iPhi =      y;
-  }
-  else            // A side
-  {
-    iEta =      x;
-    iPhi =  3 - y;
-  }
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const
-{
-  //Trigger mapping method, get position in Super Module from FasOr Index
-
-  Int_t iTRU=-1;
-  if (!GetPositionInTRUFromAbsFastORIndex(id, iTRU, iEta, iPhi)) return kFALSE;
-  if (iTRU % 2) // C side
-  {
-    iSM  = 2 * ( int( int(iTRU / 2) / 3 ) ) + 1;
-  }
-  else            // A side
-  {
-    iSM  = 2 * ( int( int(iTRU / 2) / 3 ) );
-  }
-  iPhi += 4 * int((iTRU % 6) / 2);
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const
-{
-  //Trigger mapping method, get position in EMCAL from FastOR index
-
-  Int_t iSM=-1;
-  if (GetPositionInSMFromAbsFastORIndex(id, iSM, iEta, iPhi))
-  {
-    if (iSM % 2) iEta += 24; 
-    iPhi += 12 * int(iSM / 2);
-    return kTRUE;
-  }
-  return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const
-{
-  //Trigger mapping method, get Index if FastOr from Position in TRU
-  if (iTRU < 0 || iTRU > GetNTotalTRU()-1 || iEta < 0 || iEta > 23 || iPhi < 0 || iPhi > 3) 
-  {
-    AliError(Form("Out of range! iTRU=%d, iEta=%d, iPhi=%d", iTRU, iEta, iPhi));       
-    return kFALSE;
-  }
-  id =  iPhi  + 4 * iEta + iTRU * 96;
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetAbsFastORIndexFromPositionInSM(const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const
-{
-  //Trigger mapping method, from position in SM Index get FastOR index 
-
-  Int_t iSMMax  = fEMCGeometry->GetNumberOfSuperModules();
-  Int_t iEtaMax = fEMCGeometry->GetNZ();
-  Int_t iPhiMax = fEMCGeometry->GetNPhi();
-  if( GetSMType(iSM) == kEMCAL_3rd || GetSMType(iSM) == kDCAL_Ext ) iPhiMax /= 3;
-  if( GetSMType(iSM) == kEMCAL_Half )                               iPhiMax /= 2;
-  if( GetSMType(iSM) == kDCAL_Standard )                            iEtaMax = iEtaMax*2/3;
-
-  if (iSM < 0 || iSM >= iSMMax || iEta < 0 || iEta >= iEtaMax || iPhi < 0 || iPhi >= iPhiMax) 
-  {
-    AliError("Out of range!");
-    return kFALSE;
-  }
-  Int_t x = iEta;
-  Int_t y = iPhi % 4;  
-  Int_t iOff = (iSM % 2) ? 1 : 0;
-  Int_t iTRU = 2 * int(iPhi / 4) + 6 * int(iSM / 2) + iOff;
-  if(IsDCALSM(iSM) ) iTRU -=4;
-  if (GetAbsFastORIndexFromPositionInTRU(iTRU, x, y, id))
-  {
-    return kTRUE;
-  }
-  return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta, const Int_t iPhi, Int_t& id) const
-{
-  //Trigger mapping method, from position in EMCAL Index get FastOR index 
-
-  if (iEta < 0 || iEta > 47 || iPhi < 0 || iPhi >= 2*GetNTotalTRU() )//for future DCAL trigge
-  {
-    AliError(Form("Out of range! eta: %2d phi: %2d", iEta, iPhi));
-    return kFALSE;
-  }
-  if (fFastOR2DMap[iEta][iPhi] == -1) 
-  {
-    AliError("Invalid index!");
-    return kFALSE;
-  }
-  id = fFastOR2DMap[iEta][iPhi];
-  return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const
-{
-  //Trigger mapping method, from cell index get FastOR index 
-
-  Int_t iSupMod, nModule, nIphi, nIeta, iphim, ietam;
-  Bool_t isOK = GetCellIndex( id, iSupMod, nModule, nIphi, nIeta );
-  GetModulePhiEtaIndexInSModule( iSupMod, nModule, iphim, ietam );
-  if (isOK && GetAbsFastORIndexFromPositionInSM(iSupMod, ietam, iphim, idx))
-  {
-    return kTRUE;
-  }
-  return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const
-{
-  //Trigger mapping method, from FASTOR index get cell index 
-
-  Int_t iSM=-1, iEta=-1, iPhi=-1;
-  if (GetPositionInSMFromAbsFastORIndex(id, iSM, iEta, iPhi))
-  {
-    Int_t ix = 2 * iEta;
-    Int_t iy = 2 * iPhi;
-    for (Int_t i=0; i<2; i++)
-    {
-      for (Int_t j=0; j<2; j++)
-      {
-        idx[2*i+j] = GetAbsCellIdFromCellIndexes(iSM, iy + i, ix + j);
-      }
-    }
-    return kTRUE;
-  }
-  return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const
-{
-  //Trigger mapping method, from STU index get TRU index 
-
-   idx = GetTRUIndexFromSTUIndex(id);
-   if (idx > GetNTotalTRU()-1 || idx < 0)
-   {
-     AliError(Form("TRU index out of range: %d",idx));
-     return kFALSE;
-   }
-   return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetTRUIndexFromSTUIndex(const Int_t id) const
-{
-  //Trigger mapping method, from STU index get TRU index 
-
-  if (id > GetNTotalTRU()-1 || id < 0) 
-  {
-    AliError(Form("TRU index out of range: %d",id));
-  }
-
-  Int_t idx = 0;
-  if(id < 32){
-    idx = (id > 15) ? 2 * (31 - id) : 2 * (15 - id) + 1;
-  } else if(id >= 32){// DCAL
-    idx = (id > 32+3*fnSupModInDCAL/2-1) ? 2 * (GetNTotalTRU()-1 - id)+32 : 2 * (32+3*fnSupModInDCAL/2-1 - id) + 32+1;
-  }
-  return idx;
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::BuildFastOR2DMap()
-{
-  // Needed by STU
-
-  for (Int_t i = 0; i < GetNTotalTRU(); i++)
-  {
-    for (Int_t j = 0; j < 24; j++)
-    {
-      for (Int_t k = 0; k < 4; k++)
-      {
-        Int_t id;
-        if (GetAbsFastORIndexFromPositionInTRU(i, j, k, id))
-        {
-          Int_t x = j, y = k + 4 * int(i / 2);
-          if (i % 2) x += 24;
-          fFastOR2DMap[x][y] = id;
-        }
-      }                        
-    }
-  }
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const
-{
-  //Trigger mapping method, from STU index get TRU index 
-
-   idx = GetOnlineIndexFromTRUIndex(id);
-   if (idx > GetNTotalTRU()-1 || idx < 0)
-   {
-     AliError(Form("TRU index out of range: %d",idx));
-     return kFALSE;
-   }
-   return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetTRUIndexFromOnlineIndex(const Int_t id) const
-{
-  //Trigger mapping method, from STU index get TRU index 
-       
-  if (id > GetNTotalTRU()-1 || id < 0) 
-  {
-    AliError(Form("TRU index out of range: %d",id));
-  }
-  if (id == 31) {
-    return 31;
-  }
-  if (fGeoName.Contains("DCAL_8SM") && id == 51) {
-    return 51;
-  }
-
-  //jump 4 TRUs for DCAL
-  Int_t tmp=0;
-  if(id > 31) tmp = id+4;
-  else        tmp = id;
-  Int_t idx = ((tmp% 6) < 3) ? 6 * int(tmp/ 6) + 2 * (tmp% 3) : 6 * int(tmp/ 6) + 2 * (2 - (tmp% 3)) + 1;
-  if(id > 31) idx-=4;
-  return idx;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const
-{
-  //Trigger mapping method, from STU index get TRU index 
-    idx = GetOnlineIndexFromTRUIndex(id);
-    if (idx > GetNTotalTRU()-1 || idx < 0)
-   {
-     AliError(Form("TRU index out of range: %d",idx));
-     return kFALSE;
-   }
-   return kTRUE;
-}
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetOnlineIndexFromTRUIndex(const Int_t id) const
-{
-  //Trigger mapping method, from STU index get TRU index 
-       
-  if (id > GetNTotalTRU()-1 || id < 0) 
-  {
-    AliError(Form("TRU index out of range: %d",id));
-  }
-  if (id == 31) {
-    return 31;
-  }
-  if (fGeoName.Contains("DCAL_8SM") && id == 51) {
-    return 51;
-  }
-
-  //jump 4 TRUs for DCAL
-  Int_t tmp=0;
-  if(id > 31) tmp = id+4;
-  else        tmp = id;
-  Int_t idx = (tmp % 2) ? int((6 - (tmp % 6)) / 2) + 3 * (2 * int(tmp / 6) + 1) : 3 * int(tmp / 6) + int(tmp / 2);
-  if(id > 31) idx-=4;
-  return idx;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const
-{
-  //Trigger mapping method, from L0 index get FastOR index 
-
-  if (size <= 0 ||size > 4)
-  {
-    AliError("Size not supported!");
-    return kFALSE;
-  }
-               
-  Int_t motif[4] = {0, 1, 4, 5};
-  switch (size)
-  {
-    case 1: // Cosmic trigger
-      if (!GetAbsFastORIndexFromTRU(iTRU, id, idx[1])) return kFALSE;
-      break;
-    case 4: // 4 x 4
-      for (Int_t k = 0; k < 4; k++)
-      {
-        Int_t iADC = motif[k] + 4 * int(id / 3) + (id % 3);
-                               
-        if (!GetAbsFastORIndexFromTRU(iTRU, iADC, idx[k])) return kFALSE;
-      }
-      break;
-    default:
-      break;
-  }
-       
-  return kTRUE;
-}
-
 //____________________________________________________________________________
 const TGeoHMatrix * AliEMCALGeometry::GetMatrixForSuperModule(Int_t smod) const 
 {
@@ -1632,22 +1267,6 @@ const TGeoHMatrix * AliEMCALGeometry::GetMatrixForSuperModule(Int_t smod) const
   return 0 ;
 }
 
-//______________________________________________________________________
-void AliEMCALGeometry::GetModulePhiEtaIndexInSModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &iphiSM, Int_t &ietaSM) const 
-{
-  // This method transforms the (eta,phi) index of module in a 
-  // TRU matrix into Super Module (eta,phi) index.
-  
-  // Calculate in which row and column where the TRU are 
-  // ordered in the SM
-
-  Int_t col = itru/fEMCGeometry->GetNTRUPhi() ; // indexes of TRU in SM
-  Int_t row = itru - col*fEMCGeometry->GetNTRUPhi();
-   
-  iphiSM = fEMCGeometry->GetNModulesInTRUPhi()*row + iphitru  ;
-  ietaSM = fEMCGeometry->GetNModulesInTRUEta()*col + ietatru  ; 
-}
-
 //__________________________________________________________________________________________________________________
 void AliEMCALGeometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t sm, const Float_t depth,
                                                 const Float_t misaligTransShifts[15], const Float_t misaligRotShifts[15], Float_t global[3]) const
old mode 100644 (file)
new mode 100755 (executable)
index e37eab1..c268033
@@ -28,6 +28,7 @@ class TParticle ;
 // --- AliRoot header files ---
 #include "AliEMCALEMCGeometry.h"
 #include "AliEMCALGeoParams.h"
+#include "AliEMCALTriggerMapping.h"
 class AliEMCALShishKebabTrd1Module;
 class AliLog;
 
@@ -78,6 +79,9 @@ public:
   //
   
   AliEMCALEMCGeometry* GetEMCGeometry()       const { return fEMCGeometry                            ; }
+  
+  AliEMCALTriggerMapping* GetTriggerMapping() const { return fTriggerMapping; }
+  
   //
   const Char_t*  GetNameOfEMCALEnvelope(void) const { return fEMCGeometry->GetNameOfEMCALEnvelope()  ; }
   Float_t  GetArm1PhiMin(void)                const { return fEMCGeometry->GetArm1PhiMin()           ; }
@@ -164,9 +168,6 @@ public:
   //
   void SetNZ(Int_t nz)           { fEMCGeometry->SetNZ(nz)         ; }
   void SetNPhi(Int_t nphi)       { fEMCGeometry->SetNPhi(nphi)     ; }
-  //Trigger
-  void SetNTRUEta(Int_t ntru)    { fEMCGeometry->SetNTRUEta(ntru)  ; }
-  void SetNTRUPhi(Int_t ntru)    { fEMCGeometry->SetNTRUPhi(ntru)  ; }
   //
   void SetSampling(Float_t samp) { fEMCGeometry->SetSampling(samp) ; }
   //
@@ -245,44 +246,6 @@ public:
   //
   TArrayD  GetEtaCentersOfCells()    const { return fEtaCentersOfCells    ; }     // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; 
   TArrayD  GetPhiCentersOfCells()    const { return fPhiCentersOfCells    ; }     // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
-
-  
-  // For gamma(Jet) trigger simulations *FIXME OLD TO BE REMOVED with AliEMCALTrigger*
-  Int_t    GetNTRU()             const { return fEMCGeometry->GetNTRU()             ; }  
-  Int_t    GetNTRUEta()          const { return fEMCGeometry->GetNTRUEta()          ; }  
-  Int_t    GetNTRUPhi()          const { return fEMCGeometry->GetNTRUPhi()          ; }
-  Int_t    GetNEtaSubOfTRU()     const { return fEMCGeometry->GetNEtaSubOfTRU()     ; }
-  Int_t    GetNModulesInTRU()    const { return fEMCGeometry->GetNModulesInTRU()    ; }
-  Int_t    GetNModulesInTRUEta() const { return fEMCGeometry->GetNModulesInTRUEta() ; }  
-  Int_t    GetNModulesInTRUPhi() const { return fEMCGeometry->GetNModulesInTRUPhi() ; }
-  Int_t    GetNTotalTRU()        const {return  fEMCGeometry->GetNTotalTRU()        ; }
-  // *MEFIX OLD TO BE REMOVED*
-
-  //
-  // Tranforms Eta-Phi Module index in TRU into Eta-Phi index in Super Module
-  void     GetModulePhiEtaIndexInSModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru, 
-                                                     Int_t &ietaSM, Int_t &iphiSM) const;
-  Int_t   GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm) const ;
-
-       
-  void     BuildFastOR2DMap();
-  Bool_t   GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const;
-  Bool_t                    GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const; 
-  Bool_t                    GetAbsFastORIndexFromPositionInSM( const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const; 
-  Bool_t                    GetAbsFastORIndexFromPositionInEMCAL(                const Int_t iEta, const Int_t iPhi, Int_t& id) const;
-  Bool_t             GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const;
-  Bool_t   GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const;
-  Bool_t    GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const;
-  Bool_t GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const;
-  Bool_t          GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const;
-  Bool_t          GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const;
-  Bool_t              GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const;
-  Int_t               GetTRUIndexFromSTUIndex(const Int_t id) const;
-  Bool_t           GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const;
-  Int_t            GetTRUIndexFromOnlineIndex(const Int_t id) const;
-  Bool_t           GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const;
-  Int_t            GetOnlineIndexFromTRUIndex(const Int_t id) const;
-  Bool_t            GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const;
        
   ///////////////////
   // useful utilities
@@ -305,12 +268,70 @@ public:
   //Returns shift-rotational matrixes for different volumes
   const TGeoHMatrix * GetMatrixForSuperModule(Int_t smod)const ;
        
+  Bool_t GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const { 
+    return fTriggerMapping->GetAbsFastORIndexFromTRU(iTRU, iADC, id);
+  }
+  Bool_t GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const { 
+    return fTriggerMapping->GetAbsFastORIndexFromPositionInTRU(iTRU, iEta, iPhi, id);
+  }
+  Bool_t GetAbsFastORIndexFromPositionInSM(const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const { 
+    return fTriggerMapping->GetAbsFastORIndexFromPositionInSM( iSM, iEta, iPhi, id);
+  }
+  Bool_t GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta, const Int_t iPhi, Int_t& id) const { 
+    return fTriggerMapping->GetAbsFastORIndexFromPositionInEMCAL(iEta, iPhi, id);
+  }
+  Bool_t GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const { 
+    return fTriggerMapping->GetTRUFromAbsFastORIndex(id, iTRU, iADC);
+  }
+  Bool_t GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const { 
+    return fTriggerMapping->GetPositionInTRUFromAbsFastORIndex(id, iTRU, iEta, iPhi);
+  }
+  Bool_t GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const { 
+    return fTriggerMapping->GetPositionInSMFromAbsFastORIndex(id, iSM, iEta, iPhi);
+  }
+  Bool_t GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const { 
+    return fTriggerMapping->GetPositionInEMCALFromAbsFastORIndex(id, iEta, iPhi);
+  }
+  Bool_t GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const { 
+    return fTriggerMapping->GetFastORIndexFromCellIndex(id, idx);
+  }
+  Bool_t GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const { 
+    return fTriggerMapping->GetCellIndexFromFastORIndex(id, idx);
+  }
+  Bool_t GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const { 
+    return fTriggerMapping->GetTRUIndexFromSTUIndex(id, idx);
+  }
+  Bool_t GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const { 
+    return fTriggerMapping->GetTRUIndexFromOnlineIndex(id, idx);
+  }
+  Bool_t GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const { 
+    return fTriggerMapping->GetOnlineIndexFromTRUIndex(id, idx);
+  }
+  Bool_t GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const { 
+    return fTriggerMapping->GetFastORIndexFromL0Index(iTRU, id, idx, size);
+  }
+  Int_t  GetTRUIndexFromSTUIndex(const Int_t id) const { 
+    return fTriggerMapping->GetTRUIndexFromSTUIndex(id);
+  }
+  Int_t  GetTRUIndexFromOnlineIndex(const Int_t id) const { 
+    return fTriggerMapping->GetTRUIndexFromOnlineIndex(id);
+  }
+  Int_t  GetOnlineIndexFromTRUIndex(const Int_t id) const {
+    return fTriggerMapping->GetOnlineIndexFromTRUIndex(id);
+  }
+  Int_t  GetNTotalTRU() const { 
+    return fTriggerMapping->GetNTRU(); 
+  }
+
+  
 protected:
 
   void Init(void);                          // initializes the parameters of EMCAL
   
   AliEMCALEMCGeometry * fEMCGeometry;// Geometry object for Electromagnetic calorimeter
 
+  AliEMCALTriggerMapping* fTriggerMapping; // Trigger mapping
+  
   TString  fGeoName;                 // geometry name
   Int_t    *fEMCSMSystem;                 // geometry structure
   Int_t    fKey110DEG;               // for calculation abs cell id; 19-oct-05 
@@ -354,8 +375,6 @@ protected:
   Float_t  fShellThickness;             // Total thickness in (x,y) direction
   Float_t  fZLength;                        // Total length in z direction
   Float_t  fSampling;                       // Sampling factor
-
-  Int_t    fFastOR2DMap[48][124];    // FastOR 2D Map over full EMCal
        
   TGeoHMatrix* fkSModuleMatrix[AliEMCALGeoParams::fgkEMCALModules] ; //Orientations of EMCAL super modules
   Bool_t   fUseExternalMatrices;      // Use the matrices set in fkSModuleMatrix and not those in the geoManager
diff --git a/EMCAL/EMCALUtils/AliEMCALTriggerMapping.cxx b/EMCAL/EMCALUtils/AliEMCALTriggerMapping.cxx
new file mode 100644 (file)
index 0000000..82200f8
--- /dev/null
@@ -0,0 +1 @@
+//implementation file
diff --git a/EMCAL/EMCALUtils/AliEMCALTriggerMapping.h b/EMCAL/EMCALUtils/AliEMCALTriggerMapping.h
new file mode 100755 (executable)
index 0000000..a0a3ad1
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef ALIEMCALTRIGGERMAPPING_H
+#define ALIEMCALTRIGGERMAPPING_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+Mapping ABC 
+Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+#ifndef ROOT_TObject
+#  include "TObject.h"
+#endif
+
+class AliEMCALGeometry;
+
+class AliEMCALTriggerMapping : public TObject 
+{
+public:
+           AliEMCALTriggerMapping() : fNTRU(0), fGeometry(0x0) {}
+           AliEMCALTriggerMapping(const Int_t ntru, const AliEMCALGeometry* geo) : fNTRU(ntru), fGeometry(geo) {}
+  virtual ~AliEMCALTriggerMapping() {}
+  
+  virtual Bool_t GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id)                             const = 0;
+  virtual Bool_t GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const = 0;
+  virtual Bool_t GetAbsFastORIndexFromPositionInSM(const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id)  const = 0;
+  virtual Bool_t GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta, const Int_t iPhi, Int_t& id)                 const = 0;
+  virtual Bool_t GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC)                                  const = 0;
+  virtual Bool_t GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi)           const = 0;
+  virtual Bool_t GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi)             const = 0;
+  virtual Bool_t GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi)                      const = 0;
+  virtual Bool_t GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx)                                             const = 0;
+  virtual Bool_t GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4])                                           const = 0;
+  virtual Bool_t GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx)                                                 const = 0;
+  virtual Bool_t GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx)                                              const = 0;
+  virtual Bool_t GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx)                                              const = 0;
+  virtual Bool_t GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size)          const = 0;
+
+  virtual Int_t  GetTRUIndexFromSTUIndex(   const Int_t id)                                                          const = 0;
+  virtual Int_t  GetTRUIndexFromOnlineIndex(const Int_t id)                                                          const = 0;
+  virtual Int_t  GetOnlineIndexFromTRUIndex(const Int_t id)                                                          const = 0;
+  
+  virtual void  GetNTRU(Int_t& n) {n = fNTRU;}
+  virtual Int_t GetNTRU() {return fNTRU;}
+  
+protected:  
+  Int_t fNTRU;
+  const AliEMCALGeometry* fGeometry;
+  
+private:
+  AliEMCALTriggerMapping(const AliEMCALTriggerMapping& rhs);
+  AliEMCALTriggerMapping& operator=(const AliEMCALTriggerMapping& rhs);
+  
+  ClassDef(AliEMCALTriggerMapping,1)
+};
+#endif
+
diff --git a/EMCAL/EMCALUtils/AliEMCALTriggerMappingV1.cxx b/EMCAL/EMCALUtils/AliEMCALTriggerMappingV1.cxx
new file mode 100755 (executable)
index 0000000..6fc464b
--- /dev/null
@@ -0,0 +1,331 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+
+
+
+Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
+#include "AliEMCALTriggerMapping.h"
+#include "AliEMCALTriggerMappingV1.h"
+#include "AliEMCALGeometry.h"
+#include "AliLog.h"
+
+ClassImp(AliEMCALTriggerMappingV1)
+
+//________________________________________________________________________________________________
+AliEMCALTriggerMappingV1::AliEMCALTriggerMappingV1() : AliEMCALTriggerMapping()
+{
+  // Ctor
+  
+  SetUniqueID(1);
+}
+//________________________________________________________________________________________________
+AliEMCALTriggerMappingV1::AliEMCALTriggerMappingV1(const Int_t ntru, const AliEMCALGeometry* geo) : AliEMCALTriggerMapping(ntru, geo)
+{
+  // Ctor
+  
+  SetUniqueID(1);
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const
+{
+  //Trigger mapping method, get  FastOr Index from TRU
+
+  if (iTRU > fNTRU - 1 || iTRU < 0 || iADC > 95 || iADC < 0) {
+    AliError("TRU out of range!");
+    return kFALSE;
+  }
+
+  id  = ( iTRU % 2 ) ? iADC%4 + 4 * (23 - int(iADC/4)) : (3 - iADC%4) + 4 * int(iADC/4);
+  id += iTRU * 96;
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const
+{
+  // Trigger mapping method, get TRU number from FastOr Index
+
+  if (id > fNTRU * 96 - 1 || id < 0) {
+    AliError("Fast-OR ID is out of range!");
+    return kFALSE;
+  }
+       
+  iTRU = id / 96;
+  iADC = id % 96;
+  iADC = ( iTRU % 2 ) ? iADC%4 + 4 * (23 - int(iADC/4)) : (3 - iADC%4) + 4 * int(iADC/4);
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const
+{
+  // Trigger mapping method, get position in TRU from FasOr Index
+       
+  Int_t iADC = -1;     
+  if (!GetTRUFromAbsFastORIndex(id, iTRU, iADC)) return kFALSE;
+       
+  Int_t x = iADC / 4;
+  Int_t y = iADC % 4;
+  if ( iTRU % 2 ) { // C side 
+    iEta = 23 - x;
+    iPhi =      y;
+  }
+  else {            // A side
+    iEta =      x;
+    iPhi =  3 - y;
+  }
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const
+{
+  //Trigger mapping method, get position in Super Module from FasOr Index
+
+  Int_t iTRU = -1;
+  if (!GetPositionInTRUFromAbsFastORIndex(id, iTRU, iEta, iPhi)) return kFALSE;
+  if (iTRU % 2) { // C side
+    iSM  = 2 * (int(int(iTRU / 2) / 3)) + 1;
+  } else {        // A side
+    iSM  = 2 * (int(int(iTRU / 2) / 3));
+  }
+  iPhi += 4 * int((iTRU % 6) / 2);
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const
+{
+  //Trigger mapping method, get position in EMCAL from FastOR index
+
+  Int_t iSM = -1;
+  if (GetPositionInSMFromAbsFastORIndex(id, iSM, iEta, iPhi)) {
+    if (iSM % 2) iEta += 24; 
+    iPhi += 12 * int(iSM / 2);
+    return kTRUE;
+  }
+  return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const
+{
+  //Trigger mapping method, get Index if FastOr from Position in TRU
+  if (iTRU < 0 || iTRU > fNTRU - 1 || iEta < 0 || iEta > 23 || iPhi < 0 || iPhi > 3) {
+    AliError(Form("Out of range! iTRU=%d, iEta=%d, iPhi=%d", iTRU, iEta, iPhi));       
+    return kFALSE;
+  }
+  id =  iPhi  + 4 * iEta + iTRU * 96;
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetAbsFastORIndexFromPositionInSM(const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const
+{
+  // Trigger mapping method, from position in SM Index get FastOR index 
+
+  if (iSM < 0 || iSM >= 12 || iEta < 0 || iEta > 23 || iPhi < 0 || iPhi > 11) {
+    AliError(Form("Out of range! iSM=%d, iEta=%d, iPhi=%d", iSM, iEta, iPhi));
+    return kFALSE;
+  }
+  
+  Int_t x = iEta;
+  Int_t y = iPhi % 4;  
+  Int_t iOff = (iSM % 2) ? 1 : 0;
+  Int_t iTRU = 2 * int(iPhi / 4) + 6 * int(iSM / 2) + iOff;
+  if (GetAbsFastORIndexFromPositionInTRU(iTRU, x, y, id)) {
+    return kTRUE;
+  }
+  return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta, const Int_t iPhi, Int_t& id) const
+{
+  // Trigger mapping method, from position in EMCAL Index get FastOR index 
+
+  if (iEta < 0 || iEta > 47 || iPhi < 0 || iPhi > 59) {
+    AliError(Form("Out of range! iEta: %2d iPhi: %2d", iEta, iPhi));
+    return kFALSE;
+  }
+  
+  id = iEta * 48 + iPhi;
+  
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const
+{
+  // Trigger mapping method, from cell index get FastOR index 
+
+  Int_t iSupMod, nModule, nIphi, nIeta, iphim, ietam;
+  Bool_t isOK = fGeometry->GetCellIndex( id, iSupMod, nModule, nIphi, nIeta );
+  fGeometry->GetModulePhiEtaIndexInSModule( iSupMod, nModule, iphim, ietam );
+  
+  if (isOK && GetAbsFastORIndexFromPositionInSM(iSupMod, ietam, iphim, idx)) return kTRUE;
+  return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const
+{
+  // Trigger mapping method, from FASTOR index get cell index 
+
+  Int_t iSM=-1, iEta=-1, iPhi=-1;
+  if (GetPositionInSMFromAbsFastORIndex(id, iSM, iEta, iPhi)) {
+    Int_t ix = 2 * iEta;
+    Int_t iy = 2 * iPhi;
+    for (Int_t i = 0; i < 2; i++) {
+      for (Int_t j = 0; j < 2; j++) {
+        idx[2 * i + j] = fGeometry->GetAbsCellIdFromCellIndexes(iSM, iy + i, ix + j);
+      }
+    }
+    return kTRUE;
+  }
+  return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const
+{
+  // STU mapping: TRU# 0 and 16 are missing 
+
+   if (id > 31 || id < 0) {
+     AliError(Form("TRU index out of range: %d",id));
+     return kFALSE;
+   }
+   
+   idx = GetTRUIndexFromSTUIndex(id);
+   return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALTriggerMappingV1::GetTRUIndexFromSTUIndex(const Int_t id) const
+{
+  // STU mapping: TRU# 0 and 16 are missing 
+
+  if (id > 31 || id < 0) {
+    AliError(Form("TRU index out of range: %d",id));
+  }
+  return (id > 15) ? 2 * (31 - id) : 2 * (15 - id) + 1;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+
+   idx = GetOnlineIndexFromTRUIndex(id);
+   if (idx > fNTRU - 1 || idx < 0) {
+     AliError(Form("TRU index out of range: %d",idx));
+     return kFALSE;
+   }
+   return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALTriggerMappingV1::GetTRUIndexFromOnlineIndex(const Int_t id) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+       
+  if (id > fNTRU - 1 || id < 0) {
+    AliError(Form("TRU index out of range: %d",id));
+  }
+  if (id == 31) {
+    return 31;
+  }
+
+  //jump 4 TRUs for DCAL
+  Int_t tmp=0;
+  if(id > 31) tmp = id+4;
+  else        tmp = id;
+  Int_t idx = ((tmp% 6) < 3) ? 6 * int(tmp/ 6) + 2 * (tmp% 3) : 6 * int(tmp/ 6) + 2 * (2 - (tmp% 3)) + 1;
+  if(id > 31) idx-=4;
+  return idx;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+    idx = GetOnlineIndexFromTRUIndex(id);
+    if (idx > fNTRU-1 || idx < 0)
+   {
+     AliError(Form("TRU index out of range: %d",idx));
+     return kFALSE;
+   }
+   return kTRUE;
+}
+//________________________________________________________________________________________________
+Int_t AliEMCALTriggerMappingV1::GetOnlineIndexFromTRUIndex(const Int_t id) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+       
+  if (id > fNTRU-1 || id < 0) 
+  {
+    AliError(Form("TRU index out of range: %d",id));
+  }
+  if (id == 31) {
+    return 31;
+  }
+
+  //jump 4 TRUs for DCAL
+  Int_t tmp=0;
+  if(id > 31) tmp = id+4;
+  else        tmp = id;
+  Int_t idx = (tmp % 2) ? int((6 - (tmp % 6)) / 2) + 3 * (2 * int(tmp / 6) + 1) : 3 * int(tmp / 6) + int(tmp / 2);
+  if(id > 31) idx-=4;
+  return idx;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV1::GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const
+{
+  //Trigger mapping method, from L0 index get FastOR index 
+
+  if (size <= 0 || size > 4) {
+    AliError("Size not supported!");
+    return kFALSE;
+  }
+               
+  Int_t motif[4] = {0, 1, 4, 5};
+  switch (size) {
+    case 1: // Cosmic trigger
+      if (!GetAbsFastORIndexFromTRU(iTRU, id, idx[1])) return kFALSE;
+      break;
+    case 4: // 4 x 4
+      for (Int_t k = 0; k < 4; k++) {
+        Int_t iADC = motif[k] + 4 * int(id / 3) + (id % 3);
+                               
+        if (!GetAbsFastORIndexFromTRU(iTRU, iADC, idx[k])) return kFALSE;
+      }
+      break;
+    default:
+      break;
+  }
+       
+  return kTRUE;
+}
+
+
+
diff --git a/EMCAL/EMCALUtils/AliEMCALTriggerMappingV1.h b/EMCAL/EMCALUtils/AliEMCALTriggerMappingV1.h
new file mode 100755 (executable)
index 0000000..31f5159
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef ALIEMCALTRIGGERMAPPINGV1_H
+#define ALIEMCALTRIGGERMAPPINGV1_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
+#include "AliEMCALTriggerMapping.h"
+class AliEMCALGeometry;
+class AliEMCALTriggerMappingV1 : public AliEMCALTriggerMapping 
+{
+public:
+       
+                      AliEMCALTriggerMappingV1();
+                      AliEMCALTriggerMappingV1(const Int_t ntru, const AliEMCALGeometry* geo);
+              virtual ~AliEMCALTriggerMappingV1() {}
+
+  Bool_t   GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const;
+  Bool_t                    GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const; 
+  Bool_t                    GetAbsFastORIndexFromPositionInSM( const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const; 
+  Bool_t                    GetAbsFastORIndexFromPositionInEMCAL(                const Int_t iEta, const Int_t iPhi, Int_t& id) const;
+  Bool_t                                GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const;
+  Bool_t   GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const;
+  Bool_t    GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const;
+  Bool_t GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const;
+  Bool_t          GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const;
+  Bool_t          GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const;
+  Bool_t              GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const;
+  Int_t               GetTRUIndexFromSTUIndex(const Int_t id) const;
+  Bool_t           GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const;
+  Int_t            GetTRUIndexFromOnlineIndex(const Int_t id) const;
+  Bool_t           GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const;
+  Int_t            GetOnlineIndexFromTRUIndex(const Int_t id) const;
+  Bool_t            GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const;
+       
+private:
+                           AliEMCALTriggerMappingV1(const AliEMCALTriggerMappingV1& rhs);
+                AliEMCALTriggerMappingV1& operator=(const AliEMCALTriggerMappingV1& rhs);
+       
+       ClassDef(AliEMCALTriggerMappingV1,1)
+};
+#endif
+
diff --git a/EMCAL/EMCALUtils/AliEMCALTriggerMappingV2.cxx b/EMCAL/EMCALUtils/AliEMCALTriggerMappingV2.cxx
new file mode 100644 (file)
index 0000000..dd13c06
--- /dev/null
@@ -0,0 +1,476 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+
+
+
+Author: 
+H. YOKOYAMA Tsukuba University
+R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
+#include "AliEMCALTriggerMapping.h"
+#include "AliEMCALTriggerMappingV2.h"
+#include "AliEMCALGeometry.h"
+#include "AliLog.h"
+
+ClassImp(AliEMCALTriggerMappingV2)
+
+//________________________________________________________________________________________________
+AliEMCALTriggerMappingV2::AliEMCALTriggerMappingV2() : AliEMCALTriggerMapping()
+{
+  // Ctor
+  SetUniqueID(2);
+  
+  for(Int_t iTRU=0; iTRU<46; iTRU++){
+    fTRUFastOROffsetX[iTRU] = 0 ;
+    fTRUFastOROffsetY[iTRU] = 0 ;
+    fnFastORInTRUPhi[ iTRU] = 0 ;
+    fnFastORInTRUEta[ iTRU] = 0 ;
+  }
+  for(Int_t iSM=0; iSM<20; iSM++){
+    fSMFastOROffsetX[ iSM]  = 0 ;
+    fSMFastOROffsetY[ iSM]  = 0 ;
+    fnFastORInSMPhi[  iSM]  = 0 ;
+    fnFastORInSMEta[  iSM]  = 0 ;
+  }
+  fnModuleInEMCALPhi  = 0 ;
+
+  Init_TRU_offset()  ;
+  Init_SM_offset()   ;
+}
+//________________________________________________________________________________________________
+AliEMCALTriggerMappingV2::AliEMCALTriggerMappingV2(const Int_t ntru, const AliEMCALGeometry* geo) : AliEMCALTriggerMapping(ntru, geo)
+{
+  // Ctor
+  SetUniqueID(2);
+  
+  for(Int_t iTRU=0; iTRU<46; iTRU++){
+    fTRUFastOROffsetX[iTRU] = 0;
+    fTRUFastOROffsetY[iTRU] = 0;
+    fnFastORInTRUPhi[ iTRU] = 0;
+    fnFastORInTRUEta[ iTRU] = 0;
+  }
+  for(Int_t iSM=0; iSM<20; iSM++){
+    fSMFastOROffsetX[ iSM]  = 0;
+    fSMFastOROffsetY[ iSM]  = 0;
+    fnFastORInSMPhi[  iSM]  = 0;
+    fnFastORInSMEta[  iSM]  = 0;
+  }
+  fnModuleInEMCALPhi  = 0;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const
+{
+  //Trigger mapping method, get  FastOr Index from TRU
+  if (iTRU > fNTotalTRU-1     || iTRU < 0 || 
+      iADC > fNModulesInTRU-1 || iADC < 0
+  ){
+    AliError(Form("Out of range! iTRU=%d, iADC=%d", iTRU, iADC));      
+    return kFALSE;
+  }
+  Int_t x = fTRUFastOROffsetX[iTRU] +    (iADC % fnFastORInTRUEta[iTRU])  ;
+  Int_t y = fTRUFastOROffsetY[iTRU] + int(iADC / fnFastORInTRUEta[iTRU])  ;
+  id      = y*fNEta*2 + x         ;
+  return kTRUE  ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const
+{
+  //Trigger mapping method, get Index if FastOr from Position in TRU
+  if (iTRU > fNTotalTRU-1               || iTRU < 0 || 
+      iEta > fnFastORInTRUEta[iTRU] - 1 || iEta < 0 ||
+      iPhi > fnFastORInTRUPhi[iTRU] - 1 || iPhi < 0
+  ){
+    AliError(Form("Out of range! iTRU=%d, iEta=%d, iPhi=%d", iTRU, iEta, iPhi));       
+    return kFALSE;
+  }
+  Int_t x = fTRUFastOROffsetX[iTRU] + iEta  ;
+  Int_t y = fTRUFastOROffsetY[iTRU] + iPhi  ;
+  id      = y*fNEta*2 + x         ;
+  return kTRUE  ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetAbsFastORIndexFromPositionInSM(const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const
+{
+  //Trigger mapping method, from position in SM Index get FastOR index 
+  if (iSM  > fNumberOfSuperModules-1  || iSM  < 0 || 
+      iEta > fnFastORInSMEta[iSM] -1  || iEta < 0 ||
+      iPhi > fnFastORInSMPhi[iSM] -1  || iPhi < 0
+  ){
+    AliError(Form("Out of range! iSM=%d, iEta=%d, iPhi=%d", iSM, iEta, iPhi)); 
+    return kFALSE;
+  }
+  Int_t x = fSMFastOROffsetX[iSM] + iEta  ;
+  Int_t y = fSMFastOROffsetY[iSM] + iPhi  ;
+  id      = y*fNEta*2 + x         ;
+  return kTRUE  ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta, const Int_t iPhi, Int_t& id) const
+{
+  //Trigger mapping method, from position in EMCAL Index get FastOR index 
+  if (
+      iEta > 2 * fNEta - 1          || iEta < 0 || 
+      iPhi > fnModuleInEMCALPhi - 1 || iPhi < 0  
+  ){
+    AliError(Form("Out of range! eta: %2d phi: %2d", iEta, iPhi));
+    return kFALSE;
+  }
+  id      = iPhi*fNEta*2 + iEta       ;
+  return kTRUE  ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const
+{
+  //Trigger mapping method, get TRU number from FastOr Index
+  Int_t iEta_TRU , iPhi_TRU , iSM , iEta_SM , iPhi_SM ;
+  return GetInfoFromAbsFastORIndex(
+    id   , 
+    iTRU , iADC , iEta_TRU , iPhi_TRU , 
+    iSM  ,        iEta_SM  , iPhi_SM  
+    );
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const
+{
+  //Trigger mapping method, get position in TRU from FasOr Index
+  Int_t iADC , iSM , iEta_SM , iPhi_SM ;
+  return GetInfoFromAbsFastORIndex(
+    id   , 
+    iTRU , iADC , iEta     , iPhi     , 
+    iSM  ,        iEta_SM  , iPhi_SM  
+    );
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const
+{
+  //Trigger mapping method, get position in Super Module from FasOr Index
+  Int_t iTRU , iADC , iEta_TRU , iPhi_TRU ;
+  return GetInfoFromAbsFastORIndex(
+    id   , 
+    iTRU , iADC , iEta_TRU , iPhi_TRU , 
+    iSM  ,        iEta     , iPhi  
+    );
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const
+{
+  //Trigger mapping method, get position in EMCAL from FastOR index
+  Int_t nModule = fNEta * 2 * fnModuleInEMCALPhi;
+  if (id > nModule-1 || id < 0){
+    AliError("Id out of range!");
+    return kFALSE;
+  }
+  iEta  = id % (2*fNEta) ;
+  iPhi  = id / (2*fNEta) ;
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const
+{
+  // Trigger mapping method, from cell index get FastOR index 
+
+  Int_t iSupMod, nModule, nIphi, nIeta, iphim, ietam;
+  Bool_t isOK = fGeometry->GetCellIndex( id, iSupMod, nModule, nIphi, nIeta );
+  fGeometry->GetModulePhiEtaIndexInSModule( iSupMod, nModule, iphim, ietam );
+  
+  if (isOK && GetAbsFastORIndexFromPositionInSM(iSupMod, ietam, iphim, idx)) return kTRUE;
+  return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const
+{
+  //Trigger mapping method, from FASTOR index get cell index 
+  Int_t iSM=-1, iEta=-1, iPhi=-1;
+  if (GetPositionInSMFromAbsFastORIndex(id, iSM, iEta, iPhi))
+  {
+    Int_t ix = 2 * iEta;
+    Int_t iy = 2 * iPhi;
+    idx[0] = fGeometry->GetAbsCellIdFromCellIndexes(iSM, iy    , ix    );
+    idx[1] = fGeometry->GetAbsCellIdFromCellIndexes(iSM, iy    , ix + 1);
+    idx[2] = fGeometry->GetAbsCellIdFromCellIndexes(iSM, iy + 1, ix    );
+    idx[3] = fGeometry->GetAbsCellIdFromCellIndexes(iSM, iy + 1, ix + 1);
+    return kTRUE;
+  }
+  return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+  idx = GetTRUIndexFromSTUIndex(id);
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALTriggerMappingV2::GetTRUIndexFromSTUIndex(const Int_t id) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+  if (id > fNTotalTRU-1 || id < 0){
+    AliError(Form("TRU index out of range: %d",id));
+  }
+  return id ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+  idx = GetTRUIndexFromOnlineIndex(id);
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALTriggerMappingV2::GetTRUIndexFromOnlineIndex(const Int_t id) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+  if (id > fNTotalTRU-1 || id < 0){
+    AliError(Form("TRU index out of range: %d",id));
+  }
+  return id;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+  idx = GetOnlineIndexFromTRUIndex(id);
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALTriggerMappingV2::GetOnlineIndexFromTRUIndex(const Int_t id) const
+{
+  //Trigger mapping method, from STU index get TRU index 
+  if (id > fNTotalTRU-1 || id < 0){
+    AliError(Form("TRU index out of range: %d",id));
+  }
+  return id;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const
+{
+  //Trigger mapping method, from L0 index get FastOR index 
+
+  if (size <= 0 ||size > 4){
+    AliError("Size not supported!");
+    return kFALSE;
+  }
+               
+  Int_t motif[4];
+  motif[0] = 0;
+  motif[1] = 1;
+  motif[2] = fnFastORInTRUEta[iTRU]     ;
+  motif[3] = fnFastORInTRUEta[iTRU] + 1 ;
+  switch (size)
+  {
+    case 1: // Cosmic trigger
+      if (!GetAbsFastORIndexFromTRU(iTRU, id, idx[1])) return kFALSE;
+      break;
+    case 4: // 4 x 4
+      for (Int_t k = 0; k < 4; k++)
+      {
+        Int_t iADC = motif[k] + fnFastORInTRUEta[iTRU] * int(id/(fnFastORInTRUEta[iTRU]-1)) + (id%(fnFastORInTRUEta[iTRU]-1));
+                               
+        if (!GetAbsFastORIndexFromTRU(iTRU, iADC, idx[k])) return kFALSE;
+      }
+      break;
+    default:
+      break;
+  }
+       
+  return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::Init_TRU_offset(){
+  fTRUFastOROffsetX[0]   = 0 ;
+  fTRUFastOROffsetY[0]   = 0 ;
+  Int_t iTRU  = 0 ;
+
+  for(int iSM=0; iSM<fNumberOfSuperModules; iSM++){
+    Int_t       SM_type   = GetSMType(iSM);
+    Int_t       TRU_type  = 0             ;
+    
+    Int_t nTRU_inSM         = fNTRU                ;
+    Int_t nTRU_inSM_phi     = fNTRUPhi             ;
+    Int_t nTRU_inSM_eta     = fNTRUEta             ;
+    Int_t nModule_inTRU_phi = fNModulesInTRUPhi    ;
+    Int_t nModule_inTRU_eta = fNModulesInTRUEta    ;
+    
+    //kEMCAL_Standard -> default value
+    if(     SM_type == kEMCAL_3rd      ){
+      nTRU_inSM         = (Int_t)((Float_t)nTRU_inSM         / 3. );
+      nTRU_inSM_eta     = (Int_t)((Float_t)nTRU_inSM_eta     / 3. );
+      nModule_inTRU_phi = (Int_t)((Float_t)nModule_inTRU_phi / 3. );
+      nModule_inTRU_eta = nModule_inTRU_eta                  * 3   ;
+    }
+    else if(SM_type == kDCAL_Standard  ){
+      nTRU_inSM         = (Int_t)((Float_t)nTRU_inSM      * 2./3. );
+      nTRU_inSM_eta     = (Int_t)((Float_t)nTRU_inSM_eta  * 2./3. );
+    }
+    else if(SM_type == kDCAL_Ext       ){
+      nTRU_inSM         = (Int_t)((Float_t)nTRU_inSM         / 3. );
+      nTRU_inSM_eta     = (Int_t)((Float_t)nTRU_inSM_eta     / 3. );
+      nModule_inTRU_phi = (Int_t)((Float_t)nModule_inTRU_phi / 3. );
+      nModule_inTRU_eta =                  nModule_inTRU_eta * 3   ;
+    }
+
+    //TRU ieta/iphi offset calculation 
+    for(Int_t i=0; i<nTRU_inSM; i++){
+      fnFastORInTRUPhi[iTRU]  = nModule_inTRU_phi ;
+      fnFastORInTRUEta[iTRU]  = nModule_inTRU_eta ;
+      if((iTRU+1) >= fNTotalTRU)break;
+      
+      TRU_type  = 0 ;
+      if( i==nTRU_inSM-1 ){//last TRU in SM
+        if(      iSM%2==0 && SM_type==kDCAL_Standard ) TRU_type = 2  ;//left  DCAL 
+        else if( iSM%2==1 && SM_type==kDCAL_Standard ) TRU_type = 3  ;//right DCAL 
+        else if( iSM%2==1                            ) TRU_type = 1  ;//right EMCAL
+      }
+      if(      TRU_type == 0){
+        fTRUFastOROffsetX[iTRU+1]  = fTRUFastOROffsetX[iTRU] + nModule_inTRU_eta      ;
+        fTRUFastOROffsetY[iTRU+1]  = fTRUFastOROffsetY[iTRU]                          ;
+      }else if(TRU_type == 1){
+        fTRUFastOROffsetX[iTRU+1]  = 0                                                ;
+        fTRUFastOROffsetY[iTRU+1]  = fTRUFastOROffsetY[iTRU] + nModule_inTRU_phi      ;
+      }else if(TRU_type == 2){
+        fTRUFastOROffsetX[iTRU+1]  = fTRUFastOROffsetX[iTRU] + nModule_inTRU_eta * 3  ;
+        fTRUFastOROffsetY[iTRU+1]  = fTRUFastOROffsetY[iTRU]                          ;
+      }else if(TRU_type == 3){
+        fTRUFastOROffsetX[iTRU+1]  = 0                                                ;
+        fTRUFastOROffsetY[iTRU+1]  = fTRUFastOROffsetY[iTRU] + nModule_inTRU_phi      ;
+      }
+      iTRU++  ;
+    }//TRU loop
+  }//SM loop
+  
+  return kTRUE ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::Init_SM_offset(){
+
+  fSMFastOROffsetX[0]  = 0 ;
+  fSMFastOROffsetY[0]  = 0 ;
+  fnModuleInEMCALPhi  = 0 ;
+
+  for(int iSM=0; iSM<fNumberOfSuperModules; iSM++){
+    Int_t SM_type = GetSMType(iSM);
+    
+    Int_t nModule_inSM_phi  = fNPhi    ;
+    Int_t nModule_inSM_eta  = fNEta    ;
+    
+    //kEMCAL_Standard:kEMCAL_Half -> default value
+    if(     SM_type == kEMCAL_3rd      ){
+      nModule_inSM_phi  = (Int_t)((Float_t)nModule_inSM_phi      / 3.);
+    }
+    else if(SM_type == kDCAL_Standard  ){
+      nModule_inSM_eta  = (Int_t)((Float_t)nModule_inSM_eta * 2. / 3.);
+    }
+    else if(SM_type == kDCAL_Ext       ){
+      nModule_inSM_phi  = (Int_t)((Float_t)nModule_inSM_phi      / 3.);
+    }
+
+    fnFastORInSMPhi[iSM]  = nModule_inSM_phi ;
+    fnFastORInSMEta[iSM]  = nModule_inSM_eta ;
+    if( (iSM+1) >= fNumberOfSuperModules)break  ;
+
+    if(iSM%2 == 1){//right SM
+      fSMFastOROffsetX[iSM+1]  = 0                                        ;
+      fSMFastOROffsetY[iSM+1]  = fSMFastOROffsetY[iSM] + nModule_inSM_phi ;
+    }
+    else{//left SM
+      fnModuleInEMCALPhi += nModule_inSM_phi  ;
+      if(SM_type == kDCAL_Standard){
+        fSMFastOROffsetX[iSM+1]  = fSMFastOROffsetX[iSM] + nModule_inSM_eta * 2 ;
+        fSMFastOROffsetY[iSM+1]  = fSMFastOROffsetY[iSM]                        ;
+      }else{
+        fSMFastOROffsetX[iSM+1]  = fSMFastOROffsetX[iSM] + nModule_inSM_eta     ;
+        fSMFastOROffsetY[iSM+1]  = fSMFastOROffsetY[iSM]                        ;
+      }
+    }
+  }//SM loop
+  return kTRUE ;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALTriggerMappingV2::GetInfoFromAbsFastORIndex(
+    const Int_t id, 
+    Int_t& iTRU , Int_t& iADC , Int_t& iEta_TRU , Int_t& iPhi_TRU , 
+    Int_t& iSM  ,               Int_t& iEta_SM  , Int_t& iPhi_SM  
+    ) const
+{
+
+  Int_t nModule = fNEta * 2 * fnModuleInEMCALPhi;
+  if (id > nModule-1 || id < 0){
+    AliError("Id out of range!");
+    return kFALSE;
+  }
+       
+  Int_t x       = id % (fNEta * 2) ;
+  Int_t y       = id / (fNEta * 2) ;
+  if(y >= fNPhi*5 + 4)  y = y + 8 ;
+  
+  Int_t y_class     = int(y/fNModulesInTRUPhi)   ;
+  Int_t x_class     = int(x/fNModulesInTRUEta)   ;
+  iTRU = y_class*(fNTRUEta*2) + x_class ;
+  
+  Int_t Cside       = int(x/fNEta);//Cside SM
+  //y_class = 5 : EMCAL 1/3 SM
+  //y_class = 9 : DCAL  1/3 SM
+  Int_t DCAL_sepC   = (y_class>5 && y_class<9 && Cside==1)? 1 : 0 ;
+  Bool_t IsPHOS     = (y_class>5 && y_class<9 && (x_class==2 || x_class==3))? kTRUE : kFALSE ;
+
+  if(y_class==5 || y_class==9 ) iTRU = iTRU - (x_class%3) - Cside*2 ;
+  if(y_class> 5               ) iTRU = iTRU - 2 - (y_class-5)*2 - DCAL_sepC*2 ;
+
+  iADC = (y_class==5 || y_class==9)? (y%(fNModulesInTRUPhi/3))*(fNModulesInTRUEta*3) + (x%(fNModulesInTRUEta*3)) :
+                                     (y% fNModulesInTRUPhi   )* fNModulesInTRUEta    + (x% fNModulesInTRUEta   ) ;
+
+  iSM       = int(y/fNPhi)*2 + Cside  ; 
+  iEta_TRU  = (y_class==5 || y_class==9)? x%(fNModulesInTRUEta*3) : x%(fNModulesInTRUEta);
+  iPhi_TRU  = y%fNModulesInTRUPhi;
+  iEta_SM   = (DCAL_sepC == 1)? (x%fNEta - 8) : (x%fNEta);
+  iPhi_SM   = y%fNPhi;
+
+  if(IsPHOS){
+    iTRU      = -1  ;
+    iADC      = -1  ;
+    iSM       = -1  ;
+    iEta_TRU  = -1  ;
+    iPhi_TRU  = -1  ;
+    iEta_SM   = -1  ;
+    iPhi_SM   = -1  ;
+  }
+  return kTRUE;
+}
+
diff --git a/EMCAL/EMCALUtils/AliEMCALTriggerMappingV2.h b/EMCAL/EMCALUtils/AliEMCALTriggerMappingV2.h
new file mode 100644 (file)
index 0000000..f32f3e4
--- /dev/null
@@ -0,0 +1,138 @@
+#ifndef ALIEMCALTRIGGERMAPPINGV2_H
+#define ALIEMCALTRIGGERMAPPINGV2_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/*
+Author: 
+H. YOKOYAMA Tsukuba University
+R. GUERNANE LPSC Grenoble CNRS/IN2P3
+*/
+
+#include "AliEMCALTriggerMapping.h"
+class AliEMCALGeometry;
+class AliEMCALTriggerMappingV2 : public AliEMCALTriggerMapping 
+{
+public:
+
+  //********************************************
+  //static constant
+  //********************************************
+  static const Int_t  fNumberOfSuperModules = 20  ;//Total SM in EMCAL
+  static const Int_t  fNTotalTRU            = 46  ;//Total TRU in EMCAL
+  static const Int_t  fNTRU                 =  3  ;//#TRUs/SM  
+  static const Int_t  fNTRUEta              =  3  ;//#TRUs/SM in Eta  
+  static const Int_t  fNTRUPhi              =  1  ;//#TRUs/SM in Phi
+  static const Int_t  fNEta                 = 24  ;//#FastOR/SM in Eta
+  static const Int_t  fNPhi                 = 12  ;//#FastOR/SM in Phi 
+  static const Int_t  fNModulesInTRU        = 96  ;//#FastOR/TRU
+  static const Int_t  fNModulesInTRUEta     =  8  ;//#FastOR/TRU in Eta
+  static const Int_t  fNModulesInTRUPhi     = 12  ;//#FastOR/TRU in Phi
+  
+  //********************************************
+  //SM type 
+  //********************************************
+  enum fEMCSMType { 
+    kEMCAL_Standard = 0, 
+    kEMCAL_Half     = 1, 
+    kEMCAL_3rd      = 2, 
+    kDCAL_Standard  = 3, 
+    kDCAL_Ext       = 4 
+  }; // possible SM Type
+       
+
+  //********************************************
+  //constructor,destructor
+  //********************************************
+  AliEMCALTriggerMappingV2();
+  AliEMCALTriggerMappingV2(const Int_t ntru, const AliEMCALGeometry* geo);
+  virtual ~AliEMCALTriggerMappingV2() {}
+
+  //********************************************
+  //Get FastOR index from TRU/SM/EMCAL Geometry
+  //********************************************
+  Bool_t  GetAbsFastORIndexFromTRU(          const Int_t iTRU, const Int_t iADC, Int_t& id) const;
+  Bool_t  GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const;   
+  Bool_t  GetAbsFastORIndexFromPositionInSM( const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const;   
+  Bool_t  GetAbsFastORIndexFromPositionInEMCAL(                const Int_t iEta, const Int_t iPhi, Int_t& id) const;
+
+  //********************************************
+  //Get TRU/SM/EMCAL Geometry from FastOR index
+  //********************************************
+  Bool_t  GetTRUFromAbsFastORIndex(             const Int_t id, Int_t& iTRU , Int_t& iADC) const;
+  Bool_t  GetPositionInTRUFromAbsFastORIndex(   const Int_t id, Int_t& iTRU , Int_t& iEta, Int_t& iPhi) const;
+  Bool_t  GetPositionInSMFromAbsFastORIndex(    const Int_t id, Int_t& iSM  , Int_t& iEta, Int_t& iPhi) const;
+  Bool_t  GetPositionInEMCALFromAbsFastORIndex( const Int_t id,               Int_t& iEta, Int_t& iPhi) const;
+
+  //********************************************
+  //Cell Index
+  //********************************************
+  Bool_t  GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const;
+  Bool_t  GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const;
+
+  //********************************************
+  //TRU index
+  //********************************************
+  Bool_t  GetTRUIndexFromSTUIndex(    const Int_t id, Int_t& idx) const;
+  Int_t   GetTRUIndexFromSTUIndex(    const Int_t id            ) const;
+  Bool_t  GetTRUIndexFromOnlineIndex( const Int_t id, Int_t& idx) const;
+  Int_t   GetTRUIndexFromOnlineIndex( const Int_t id            ) const;
+  Bool_t  GetOnlineIndexFromTRUIndex( const Int_t id, Int_t& idx) const;
+  Int_t   GetOnlineIndexFromTRUIndex( const Int_t id            ) const;
+  
+  //********************************************
+  //L0 Index
+  //********************************************
+  Bool_t  GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const;
+       
+private:
+                
+  AliEMCALTriggerMappingV2(const AliEMCALTriggerMappingV2& rhs);
+  AliEMCALTriggerMappingV2& operator=(const AliEMCALTriggerMappingV2& rhs);
+       
+  //********************************************
+  //fastOR offset parameters
+  //********************************************
+  Int_t   fTRUFastOROffsetX[46] ;//FastOR offset[#of TRU]
+  Int_t   fTRUFastOROffsetY[46] ;//
+  Int_t   fnFastORInTRUPhi[ 46] ;//TRU size
+  Int_t   fnFastORInTRUEta[ 46] ;//
+  
+  Int_t   fSMFastOROffsetX[ 20] ;//FastOR offset[#of SM ]
+  Int_t   fSMFastOROffsetY[ 20] ;//
+  Int_t   fnFastORInSMPhi[  20] ;//SM size
+  Int_t   fnFastORInSMEta[  20] ;//
+
+  Int_t   fnModuleInEMCALPhi    ;//#FastOR/EMCAL in Phi
+
+  //********************************************
+  //Initialization of FastOR index offset of each SM/TRU
+  //********************************************
+  Bool_t Init_TRU_offset()  ;
+  Bool_t Init_SM_offset()   ;
+
+  //********************************************
+  //SM type
+  //********************************************
+  Int_t   GetSMType(Int_t iSM)      const {
+    if( iSM<0 || iSM >= fNumberOfSuperModules)return -1  ;
+    if( iSM < 10) return kEMCAL_Standard ;
+    if( iSM < 12) return kEMCAL_3rd      ;
+    if( iSM < 18) return kDCAL_Standard  ;
+    if( iSM < 20) return kDCAL_Ext       ;
+    return -1 ;
+  }
+  
+  Bool_t GetInfoFromAbsFastORIndex(
+    const Int_t id, 
+    Int_t& iTRU , Int_t& iADC , Int_t& iEta_TRU , Int_t& iPhi_TRU , 
+    Int_t& iSM  ,               Int_t& iEta_SM  , Int_t& iPhi_SM  
+    ) const;
+  
+  ClassDef(AliEMCALTriggerMappingV2,1)
+};
+#endif
+
index 4696aa75bf23f701b693ae9c6daa48dbbf449212..4c2363f2f2ba53330710824e4c914a689d70f1dc 100644 (file)
@@ -30,6 +30,9 @@ include_directories(${ROOT_INCLUDE_DIRS}
 set(SRCS
     AliEMCALCalibTimeDepCorrection.cxx
     AliEMCALEMCGeometry.cxx
+    AliEMCALTriggerMapping.cxx
+    AliEMCALTriggerMappingV1.cxx
+    AliEMCALTriggerMappingV2.cxx
     AliEMCALGeometry.cxx
     AliEMCALGeoParams.cxx
     AliEMCALHistoUtilities.cxx
old mode 100644 (file)
new mode 100755 (executable)
index 7e46ef8..ae4115a
@@ -6,6 +6,9 @@
 #pragma link C++ class AliEMCALGeoParams+;
 #pragma link C++ class AliEMCALGeometry+;
 #pragma link C++ class AliEMCALEMCGeometry+;
+#pragma link C++ class AliEMCALTriggerMapping+;
+#pragma link C++ class AliEMCALTriggerMappingV1+;
+#pragma link C++ class AliEMCALTriggerMappingV2+;
 #pragma link C++ class AliEMCALShishKebabTrd1Module+;
 #pragma link C++ class AliEMCALPIDUtils+;
 #pragma link C++ class AliEMCALHistoUtilities+;
index 567c0a96c5d81d13ee4f451d6c2dbeb041e9dc22..a78b37d9047653981eb0a376354ed0a82965a5bf 100644 (file)
@@ -40,7 +40,6 @@ class TF1;
 class AliRawReader;
 #include "AliDetector.h"
 #include "AliEMCALGeometry.h" 
-#include "AliEMCALTrigger.h" 
 #include "AliEMCALRawUtils.h"
 #include "AliReconstructor.h"
 class AliEMCALTriggerData;
@@ -67,9 +66,6 @@ class AliEMCAL : public AliDetector {
   virtual void    Hits2SDigits();
   virtual Int_t   IsVersion(void) const = 0 ;   
   
-  virtual AliTriggerDetector* CreateTriggerDetector() const 
-    { return new AliEMCALTrigger(); }
-
    //  
   virtual AliLoader* MakeLoader(const char* topfoldername);
   virtual const TString Version() const {return TString(" ") ; }   
old mode 100644 (file)
new mode 100755 (executable)
index 70c2e9e..02a02ff
@@ -947,7 +947,7 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
   
   if (AliDebugLevel()) printf("Number of TRG digits: %d\n",digitsTMP->GetEntriesFast());
   
-  Int_t     nSamples = geom->GetNTotalTRU();
+  Int_t     nSamples = 32;
   Int_t *timeSamples = new Int_t[nSamples];
   
   NextDigit = TIter(digitsTMP);
old mode 100644 (file)
new mode 100755 (executable)
index 82dceb8..7e243c9
@@ -61,8 +61,6 @@ const int kReturnCodeNoInfo = 9;
 const int kReturnCodeNoObject = 2;
 const int kReturnCodeNoEntries = 1;
 
-const int kNTRU = 62; // EMCAL  (10 SM + 2/3) + (DCAL 10 SM) * 3 TRU per SM
-
 ClassImp(AliEMCALPreprocessor)
   
 //_______________________________________________________________________________________
@@ -327,6 +325,7 @@ UInt_t AliEMCALPreprocessor::MapTemperature(TMap* dcsAliasMap)
 UInt_t AliEMCALPreprocessor::MapTriggerConfig(TMap* dcsAliasMap)
 { // extract DCS trigger info
        
+  const Int_t kNTRU = 46;
        
        AliInfo("Print DCS alias map content");
        dcsAliasMap->Print();
diff --git a/EMCAL/EMCALbase/AliEMCALTrigger.cxx b/EMCAL/EMCALbase/AliEMCALTrigger.cxx
deleted file mode 100644 (file)
index a8ed0f3..0000000
+++ /dev/null
@@ -1,1193 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * 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   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-/* $Id$ */
-
-//_________________________________________________________________________  
-//
-//  Class for trigger analysis.
-//  Digits are grouped in TRU's  (Trigger Units). A TRU consists of 384 
-//  modules ordered fNTRUPhi x fNTRUEta. The algorithm searches all possible 2x2 
-//  and nxn (n is a multiple of 2) cell combinations per each TRU,  adding the 
-//  digits amplitude and finding the maximum. If found, look if it is isolated.
-//  Maxima are transformed in ADC time samples. Each time bin is compared to the trigger 
-//  threshold until it is larger and then, triggers are set. Thresholds need to be fixed.  
-//  Thresholds need to be fixed. Last 2 modules are half size in Phi, I considered 
-//  that the number of TRU is maintained for the last modules but decision not taken. 
-//  If different, then this must be changed. 
-//  Usage:
-//
-//  //Inside the event loop
-//  AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
-//  tr->SetL0Threshold(100); //Arbitrary threshold values
-//  tr->SetL1GammaLowPtThreshold(1000);
-//  tr->SetL1GammaMediumPtThreshold(10000);
-//  tr->SetL1GammaHighPtThreshold(20000);
-//  ...
-//  tr->Trigger(); //Execute Trigger
-//  tr->Print(""); //Print results
-//
-//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN) 
-//////////////////////////////////////////////////////////////////////////////
-
-#include <cassert>
-
-// --- ROOT system ---
-#include <TTree.h>
-#include <TBranch.h>
-#include <TBrowser.h>
-#include <TH2F.h>
-
-// --- ALIROOT system ---
-#include "AliRun.h" 
-#include "AliRunLoader.h" 
-#include "AliTriggerInput.h"
-#include "AliEMCAL.h" 
-#include "AliEMCALLoader.h" 
-#include "AliEMCALDigit.h"
-#include "AliEMCALTrigger.h" 
-#include "AliEMCALGeometry.h"
-#include "AliEMCALRawUtils.h"
-#include "AliLog.h"
-#include "AliCaloConstants.h"
-#include "AliEMCALRawResponse.h"
-
-using namespace CALO;
-
-ClassImp(AliEMCALTrigger)
-
-TString AliEMCALTrigger::fgNameOfJetTriggers("EMCALJetTriggerL1");
-
-//______________________________________________________________________
-AliEMCALTrigger::AliEMCALTrigger()
-  : AliTriggerDetector(), fGeom(0),
-    f2x2MaxAmp(-1), f2x2ModulePhi(-1),  f2x2ModuleEta(-1),
-    f2x2SM(0),
-    fnxnMaxAmp(-1), fnxnModulePhi(-1),  fnxnModuleEta(-1),
-    fnxnSM(0),
-    fADCValuesHighnxn(0),fADCValuesLownxn(0),
-    fADCValuesHigh2x2(0),fADCValuesLow2x2(0),
-    fDigitsList(0),
-    fL0Threshold(100),fL1GammaLowPtThreshold(200),
-    fL1GammaMediumPtThreshold(500), fL1GammaHighPtThreshold(1000),
-    fPatchSize(1),  fIsolPatchSize(1), 
-    f2x2AmpOutOfPatch(-1), fnxnAmpOutOfPatch(-1), 
-    f2x2AmpOutOfPatchThres(100000),  fnxnAmpOutOfPatchThres(100000), 
-    fIs2x2Isol(kFALSE), fIsnxnIsol(kFALSE),  
-    fSimulation(kTRUE), fIsolateInSuperModule(kTRUE), fTimeKey(kFALSE),
-    fAmpTrus(0),fTimeRtrus(0),fAmpSMods(0),
-    fTriggerPosition(6), fTriggerAmplitudes(4), 
-    fNJetPatchPhi(3), fNJetPatchEta(3), fNJetThreshold(3), fL1JetThreshold(0), fJetMaxAmp(0),
-    fAmpJetMatrix(0), fJetMatrixE(0), fAmpJetMax(6,1), fVZER0Mult(0.)
-{
-  //ctor 
-  fADCValuesHighnxn = 0x0; //new Int_t[fTimeBins];
-  fADCValuesLownxn  = 0x0; //new Int_t[fTimeBins];
-  fADCValuesHigh2x2 = 0x0; //new Int_t[fTimeBins];
-  fADCValuesLow2x2  = 0x0; //new Int_t[fTimeBins];
-
-  SetName("EMCAL");
-  // Define jet threshold - can not change from outside now
-  // fNJetThreshold  = 7; // For MB Pythia suppression
-  fNJetThreshold  = 10;   // Hijing  
-  fL1JetThreshold = new Double_t[fNJetThreshold];
-  if(fNJetThreshold == 7) {
-    fL1JetThreshold[0] =  5./0.0153;
-    fL1JetThreshold[1] =  8./0.0153;
-    fL1JetThreshold[2] = 10./0.0153;
-    fL1JetThreshold[3] = 12./0.0153;
-    fL1JetThreshold[4] = 13./0.0153;
-    fL1JetThreshold[5] = 14./0.0153;
-    fL1JetThreshold[6] = 15./0.0153;
-  } else if(fNJetThreshold == 10) {
-    Double_t thGev[10]={5.,8.,10., 12., 13.,14.,15., 17., 20., 25.};
-    for(Int_t i=0; i<fNJetThreshold; i++) fL1JetThreshold[i] =  thGev[i]/0.0153;
-  } else {
-    fL1JetThreshold[0] =  5./0.0153;
-    fL1JetThreshold[1] = 10./0.0153;
-    fL1JetThreshold[2] = 15./0.0153;
-    fL1JetThreshold[3] = 20./0.0153;
-    fL1JetThreshold[4] = 25./0.0153;
-  }
-  //
-  CreateInputs();
-
-  fInputs.SetName("TriggersInputs");   
-   //Print("") ; 
-}
-
-//____________________________________________________________________________
-AliEMCALTrigger::~AliEMCALTrigger() {
-       
-  //dtor
-       
-  if(GetTimeKey()) {
-    delete [] fADCValuesHighnxn; 
-    delete [] fADCValuesLownxn;
-    delete [] fADCValuesHigh2x2;
-    delete [] fADCValuesLow2x2;
-  }
-  if(fAmpTrus)      {fAmpTrus->Delete();   delete fAmpTrus;}
-  if(fTimeRtrus)    {fTimeRtrus->Delete(); delete fTimeRtrus;}
-  if(fAmpSMods)     {fAmpSMods->Delete();  delete fAmpSMods;}
-  if(fAmpJetMatrix) delete fAmpJetMatrix;
-  if(fJetMatrixE)   delete fJetMatrixE;
-  if(fL1JetThreshold) delete [] fL1JetThreshold;
-}
-
-//----------------------------------------------------------------------
-void AliEMCALTrigger::CreateInputs()
-{
-   // inputs 
-   
-   // Do not create inputs again!!
-   if( fInputs.GetEntriesFast() > 0 ) return;
-
-   // Second parameter should be detector name = "EMCAL"
-   TString det("EMCAL"); // Apr 29, 2008
-   fInputs.AddLast( new AliTriggerInput( det+"_L0",          det, 0x02) );
-   fInputs.AddLast( new AliTriggerInput( det+"_GammaHPt_L1", det, 0x04 ) );
-   fInputs.AddLast( new AliTriggerInput( det+"_GammaMPt_L1", det, 0x08 ) );
-   fInputs.AddLast( new AliTriggerInput( det+"_GammaLPt_L1", det, 0x016 ) );
-   fInputs.AddLast( new AliTriggerInput( det+"_JetHPt_L1", det, 0x032 ) );
-   fInputs.AddLast( new AliTriggerInput( det+"_JetMPt_L1", det, 0x048 ) );
-   fInputs.AddLast( new AliTriggerInput( det+"_JetLPt_L1", det, 0x064 ) );
-
-   if(fNJetThreshold<=0) return;
-   // Jet Trigger(s)
-   UInt_t level = 0x032;
-   for(Int_t i=0; i<fNJetThreshold; i++ ) {
-     TString name(GetNameOfJetTrigger(i));
-     TString title("EMCAL Jet triger L1 :"); // unused now
-     // 0.0153 - hard coded now
-     title += Form("Th %i(%5.1f GeV) :", (Int_t)fL1JetThreshold[i], fL1JetThreshold[i] * 0.0153); 
-     title += Form("patch %ix%i~(%3.2f(#phi)x%3.2f(#eta)) ", 
-                fNJetPatchPhi, fNJetPatchEta, 0.11*(fNJetPatchPhi), 0.11*(fNJetPatchEta)); 
-     fInputs.AddLast( new AliTriggerInput(name, det, UChar_t(level)) );
-     level *= 2;
-   }
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALTrigger::IsPatchIsolated(Int_t iPatchType, const TClonesArray * ampmatrixes, const Int_t iSM, const Int_t mtru, const Float_t maxamp, const Int_t maxphi, const Int_t maxeta) {
-
-  // Nov 8, 2007 
-  // EMCAL RTU size is 4modules(phi) x 24modules (eta)
-  // So maximum size of patch is 4modules x 4modules (EMCAL L0 trigger). 
-  // Calculate if the maximum patch found is isolated, find amplitude around maximum (2x2 or nxn) patch, 
-  // inside isolation patch . iPatchType = 0 means calculation for 2x2 patch, 
-  // iPatchType = 1 means calculation for nxn patch.
-  // In the next table there is an example of the different options of patch size and isolation patch size:
-  //                                                           Patch Size (fPatchSize)
-  //                                           0                          1              
-  //          fIsolPatchSize    0             2x2 (not overlap)   4x4 (overlapped)       
-  //                            1             4x4                      8x8               
-                          
-  Bool_t b = kFALSE;
-  if(!ampmatrixes) return kFALSE;
-  
-  // Get matrix of TRU or Module with maximum amplitude patch.
-  Int_t itru = mtru + iSM * fGeom->GetNTRU(); //number of tru, min 0 max 3*22=66.
-  TMatrixD * ampmatrix   = 0x0;
-  Int_t colborder = 0;
-  Int_t rowborder = 0;
-  static int keyPrint = 0;
-  if(keyPrint) AliDebug(2,Form(" IsPatchIsolated : iSM %i mtru %i itru %i maxphi %i maxeta %i \n", iSM, mtru, itru, maxphi, maxeta));
-  
-  if(fIsolateInSuperModule){ // ?
-    ampmatrix = dynamic_cast<TMatrixD *>(ampmatrixes->At(iSM)) ;
-    rowborder = fGeom->GetNPhi();
-    colborder = fGeom->GetNZ();
-    AliDebug(2,"Isolate trigger in Module");
-  } else{
-    ampmatrix = dynamic_cast<TMatrixD *>(ampmatrixes->At(itru)) ;
-    rowborder = fGeom->GetNModulesInTRUPhi();
-    colborder = fGeom->GetNModulesInTRUEta();
-    AliDebug(2,"Isolate trigger in TRU");
-  }
-  if(iSM>9) rowborder /= 2; // half size in phi
-  
-  if(!ampmatrixes || !ampmatrix){
-    AliError("Could not recover the matrix with the amplitudes");
-    return kFALSE;
-  }
-  
-  //Define patch modules - what is this ??
-  Int_t isolmodules   = fIsolPatchSize*(1+iPatchType);
-  Int_t ipatchmodules = 2*(1+fPatchSize*iPatchType);
-  Int_t minrow      = maxphi - isolmodules;
-  Int_t mincol      = maxeta - isolmodules;
-  Int_t maxrow      = maxphi + isolmodules + ipatchmodules;
-  Int_t maxcol      = maxeta + isolmodules + ipatchmodules;
-
-  minrow =  minrow<0?0 :minrow;
-  mincol =  mincol<0?0 :mincol;
-
-  maxrow =  maxrow>rowborder?rowborder :maxrow;
-  maxcol =  maxcol>colborder?colborder :maxcol;
-  
-  //printf("%s\n",Form("Number of added Isol Modules %d, Patch Size %d",isolmodules, ipatchmodules));
-  //printf("%s\n",Form("Patch: minrow %d, maxrow %d, mincol %d, maxcol %d",minrow,maxrow,mincol,maxcol));
-  //  AliDebug(2,Form("Number of added Isol Modules %d, Patch Size %d",isolmodules, ipatchmodules));
-  //AliDebug(2,Form("Patch: minrow %d, maxrow %d, mincol %d, maxcol %d",minrow,maxrow,mincol,maxcol));
-  
-  //Add amplitudes in all isolation patch
-  Float_t amp = 0.;
-  for(Int_t irow = minrow ; irow <  maxrow; irow ++)
-    for(Int_t icol = mincol ; icol < maxcol ; icol ++)
-      amp += (*ampmatrix)(irow,icol);
-  
-  AliDebug(2,Form("Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
-
-  if(amp < maxamp){
-    //    AliError(Form("Bad sum: Type %d, Maximum amplitude %f, patch+isol square %f",iPatchType, maxamp, amp));
-    //    ampmatrix->Print();
-    return kFALSE;
-  } else {
-    amp-=maxamp; //Calculate energy in isolation patch that do not comes from maximum patch.
-  }
-  
-  AliDebug(2, Form("Maximum amplitude %f, Out of patch %f",maxamp, amp));
-
-  //Fill isolation amplitude data member and say if patch is isolated.
-  if(iPatchType == 0){ //2x2 case
-    f2x2AmpOutOfPatch = amp;   
-    if(amp < f2x2AmpOutOfPatchThres) b=kTRUE;
-  } else  if(iPatchType == 1){ //nxn case
-    fnxnAmpOutOfPatch = amp;   
-    if(amp < fnxnAmpOutOfPatchThres) b=kTRUE;
-  }
-
-  if(keyPrint) AliDebug(2,Form(" IsPatchIsolated - OUT \n"));
-
-  return b;
-
-}
-
-/*
-//____________________________________________________________________________
-void AliEMCALTrigger::MakeSlidingCell(const TClonesArray * amptrus, const TClonesArray * timeRtrus, const Int_t isupermod,TMatrixD &ampmax2, TMatrixD &ampmaxn){
-  
-  //Sums energy of all possible 2x2 (L0) and nxn (L1) modules per each TRU. 
-  //Fast signal in the experiment is given by 2x2 modules, 
-  //for this reason we loop inside the TRU modules by 2. 
-
-  //Declare and initialize variables
-  Int_t nCellsPhi  = fGeom->GetNCellsInTRUPhi();
-  if(isupermod > 9)
-    nCellsPhi =  nCellsPhi / 2 ; //Half size SM. Not Final.
-  // 12(tow)*2(cell)/1 TRU, cells in Phi in one TRU
-  Int_t nCellsEta  = fGeom->GetNCellsInTRUEta();
-  Int_t nTRU  = fGeom->GetNTRU();
-  // 24(mod)*2(tower)/3 TRU, cells in Eta in one TRU
-  //Int_t nTRU          = geom->GeNTRU();//3 TRU per super module
-
-  Float_t amp2 = 0 ;
-  Float_t ampn = 0 ; 
-  for(Int_t i = 0; i < 4; i++){
-    for(Int_t j = 0; j < nTRU; j++){
-      ampmax2(i,j) = -1;
-      ampmaxn(i,j) = -1;
-    }
-  }
-
-  //Create matrix that will contain 2x2 amplitude sums
-  //used to calculate the nxn sums
-  TMatrixD tru2x2(nCellsPhi/2,nCellsEta/2) ;
-  for(Int_t i = 0; i < nCellsPhi/2; i++)
-    for(Int_t j = 0; j < nCellsEta/2; j++)
-      tru2x2(i,j) = -1;
-  
-  //Loop over all TRUS in a supermodule
-  for(Int_t itru = 0 + isupermod * nTRU ; itru < (isupermod+1)*nTRU ; itru++) {
-    TMatrixD * amptru   = dynamic_cast<TMatrixD *>(amptrus->At(itru)) ;
-    TMatrixD * timeRtru = dynamic_cast<TMatrixD *>(timeRtrus->At(itru)) ;
-    Int_t mtru = itru-isupermod*nTRU ; //Number of TRU in Supermodule
-   
-    //Sliding 2x2, add 2x2 amplitudes (NOT OVERLAP)
-    for(Int_t irow = 0 ; irow <  nCellsPhi; irow += 2){ 
-      for(Int_t icol = 0 ; icol < nCellsEta ; icol += 2){
-       amp2 = (*amptru)(irow,icol)+(*amptru)(irow+1,icol)+
-         (*amptru)(irow,icol+1)+(*amptru)(irow+1,icol+1);
-
-       //Fill matrix with added 2x2 cells for use in nxn sums
-       tru2x2(irow/2,icol/2) = amp2 ;
-       //Select 2x2 maximum sums to select L0 
-       if(amp2 > ampmax2(0,mtru)){
-         ampmax2(0,mtru) = amp2 ; 
-         ampmax2(1,mtru) = irow;
-         ampmax2(2,mtru) = icol;
-       }
-      }
-    }
-    
-    //Find most recent time in the selected 2x2 cell
-    ampmax2(3,mtru) = 1 ;
-    Int_t row2 =  static_cast <Int_t> (ampmax2(1,mtru));
-    Int_t col2 =  static_cast <Int_t> (ampmax2(2,mtru));
-    for(Int_t i = 0; i<2; i++){
-      for(Int_t j = 0; j<2; j++){
-       if((*amptru)(row2+i,col2+j) > 0 &&  (*timeRtru)(row2+i,col2+j)> 0){       
-         if((*timeRtru)(row2+i,col2+j) <  ampmax2(3,mtru)  )
-           ampmax2(3,mtru) =  (*timeRtru)(row2+i,col2+j);
-       }
-      }
-    }
-
-    //Sliding nxn, add nxn amplitudes  (OVERLAP)
-    if(fPatchSize > 0){
-      for(Int_t irow = 0 ; irow <  nCellsPhi/2; irow++){ 
-       for(Int_t icol = 0 ; icol < nCellsEta/2 ; icol++){
-         ampn = 0;
-         if( (irow+fPatchSize) < nCellsPhi/2 && (icol+fPatchSize) < nCellsEta/2){//Avoid exit the TRU
-           for(Int_t i = 0 ; i <= fPatchSize ; i++)
-             for(Int_t j = 0 ; j <= fPatchSize ; j++)
-               ampn += tru2x2(irow+i,icol+j);
-           //Select nxn maximum sums to select L1 
-           if(ampn > ampmaxn(0,mtru)){
-             ampmaxn(0,mtru) = ampn ; 
-             ampmaxn(1,mtru) = irow*2;
-             ampmaxn(2,mtru) = icol*2;
-           }
-         }
-       }
-      }
-      
-      //Find most recent time in selected nxn cell
-      ampmaxn(3,mtru) = 1 ;
-      Int_t rown =  static_cast <Int_t> (ampmaxn(1,mtru));
-      Int_t coln =  static_cast <Int_t> (ampmaxn(2,mtru));
-      for(Int_t i = 0; i<4*fPatchSize; i++){
-       for(Int_t j = 0; j<4*fPatchSize; j++){
-         if( (rown+i) < nCellsPhi && (coln+j) < nCellsEta){//Avoid exit the TRU
-           if((*amptru)(rown+i,coln+j) > 0 &&  (*timeRtru)(rown+i,coln+j)> 0){
-             if((*timeRtru)(rown+i,coln+j) <  ampmaxn(3,mtru)  )
-               ampmaxn(3,mtru) =  (*timeRtru)(rown+i,coln+j);
-           }
-         }
-       }
-      }
-    }
-    else {  
-       ampmaxn(0,mtru) =  ampmax2(0,mtru); 
-       ampmaxn(1,mtru) =  ampmax2(1,mtru);
-       ampmaxn(2,mtru) =  ampmax2(2,mtru);
-       ampmaxn(3,mtru) =  ampmax2(3,mtru);
-      }
-  }
-}
-*/
-//____________________________________________________________________________
-void AliEMCALTrigger::MakeSlidingTowers(const TClonesArray * amptrus, const TClonesArray * timeRtrus, 
-                                        const Int_t isupermod,TMatrixD &ampmax2, TMatrixD &ampmaxn){
-  
-  // Output from module (2x2 cells from one module)
-  Int_t nModulesPhi  = fGeom->GetNModulesInTRUPhi(); // now 4 modules (3 div in phi)
-  if(isupermod > 9)
-    nModulesPhi =  nModulesPhi / 2 ; // Half size SM. Not Final.
-  // 
-  Int_t nModulesEta  = fGeom->GetNModulesInTRUEta(); // now 24 modules (no division in eta)
-  Int_t nTRU         = fGeom->GetNTRU();
-  static int keyPrint = 0;
-  if(keyPrint) AliDebug(2,Form("MakeSlidingTowers : nTRU %i nModulesPhi %i nModulesEta %i ", 
-                               nTRU, nModulesPhi, nModulesEta ));
-  
-  Float_t amp2 = 0 ;
-  Float_t ampn = 0 ; 
-  for(Int_t i = 0; i < 4; i++){
-    for(Int_t j = 0; j < nTRU; j++){
-      ampmax2(i,j) = ampmaxn(i,j) = -1;
-    }
-  }
-  
-  // Create matrix that will contain 2x2 amplitude sums
-  // used to calculate the nxn sums
-  TMatrixD tru2x2(nModulesPhi/2,nModulesEta/2);
-  
-  // Loop over all TRUS in a supermodule
-  for(Int_t itru = 0 + isupermod * nTRU ; itru < (isupermod+1)*nTRU ; itru++) {
-    TMatrixD * amptru   = dynamic_cast<TMatrixD *>(amptrus->At(itru)) ;
-    TMatrixD * timeRtru = dynamic_cast<TMatrixD *>(timeRtrus->At(itru)) ;
-    Int_t mtru = itru - isupermod*nTRU ; // Number of TRU in Supermodule !!
-    
-    if(!amptru || !timeRtru){
-      AliError("Amplitude or Time TRU matrix not available");
-      return;
-    }
-    
-    // Sliding 2x2, add 2x2 amplitudes (NOT OVERLAP)
-    for(Int_t irow = 0 ; irow <  nModulesPhi; irow +=2){ 
-      for(Int_t icol = 0 ; icol < nModulesEta ; icol +=2){
-        amp2 = (*amptru)(irow,icol) +(*amptru)(irow+1,icol)+
-        (*amptru)(irow,icol+1)+(*amptru)(irow+1,icol+1);
-        
-        //Fill matrix with added 2x2 towers for use in nxn sums
-        tru2x2(irow/2,icol/2) = amp2 ;
-        //Select 2x2 maximum sums to select L0 
-        if(amp2 > ampmax2(0,mtru)){
-          ampmax2(0,mtru) = amp2 ; 
-          ampmax2(1,mtru) = irow;
-          ampmax2(2,mtru) = icol;
-        }
-      }
-    }
-    
-    ampmax2(3,mtru) = 0.;
-    if(GetTimeKey()) {
-      // Find most recent time in the selected 2x2 towers
-      Int_t row2 =  static_cast <Int_t> (ampmax2(1,mtru));
-      Int_t col2 =  static_cast <Int_t> (ampmax2(2,mtru));
-      for(Int_t i = 0; i<2; i++){
-        for(Int_t j = 0; j<2; j++){
-          if((*amptru)(row2+i,col2+j) > 0 &&  (*timeRtru)(row2+i,col2+j)> 0){    
-            if((*timeRtru)(row2+i,col2+j) >  ampmax2(3,mtru)  )
-              ampmax2(3,mtru) =  (*timeRtru)(row2+i,col2+j); // max time
-          }
-        }
-      }
-    }
-    
-    //Sliding nxn, add nxn amplitudes  (OVERLAP)
-    if(fPatchSize > 0){
-      for(Int_t irow = 0 ; irow <  nModulesPhi/2; irow++){ 
-        for(Int_t icol = 0 ; icol < nModulesEta/2; icol++){
-          ampn = 0;
-          if( (irow+fPatchSize) < nModulesPhi/2 && (icol+fPatchSize) < nModulesEta/2){ //Avoid exit the TRU
-            for(Int_t i = 0 ; i <= fPatchSize ; i++)
-              for(Int_t j = 0 ; j <= fPatchSize ; j++)
-                ampn += tru2x2(irow+i,icol+j);
-            //Select nxn maximum sums to select L1 
-            if(ampn > ampmaxn(0,mtru)){
-              ampmaxn(0,mtru) = ampn ; 
-              ampmaxn(1,mtru) = irow;
-              ampmaxn(2,mtru) = icol;
-            }
-          }
-        }
-      }
-      
-      ampmaxn(3,mtru) = 0.; // Was 1 , I don't know why
-      if(GetTimeKey()) {
-        //Find most recent time in selected nxn cell
-        Int_t rown =  static_cast <Int_t> (ampmaxn(1,mtru));
-        Int_t coln =  static_cast <Int_t> (ampmaxn(2,mtru));
-        for(Int_t i = 0; i<4*fPatchSize; i++){
-          for(Int_t j = 0; j<4*fPatchSize; j++){
-            if( (rown+i) < nModulesPhi && (coln+j) < nModulesEta){//Avoid exit the TRU
-              if((*amptru)(rown+i,coln+j) > 0 &&  (*timeRtru)(rown+i,coln+j)> 0){
-                if((*timeRtru)(rown+i,coln+j) >  ampmaxn(3,mtru)  )
-                  ampmaxn(3,mtru) =  (*timeRtru)(rown+i,coln+j); // max time
-              }
-            }
-          }
-        }
-      }
-    } else { // copy 2x2 to nxn  
-      ampmaxn(0,mtru) =  ampmax2(0,mtru); 
-      ampmaxn(1,mtru) =  ampmax2(1,mtru);
-      ampmaxn(2,mtru) =  ampmax2(2,mtru);
-      ampmaxn(3,mtru) =  ampmax2(3,mtru);
-    }
-  }
-  if(keyPrint) AliDebug(2,Form(" : MakeSlidingTowers -OUt \n"));
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::Print(const Option_t * opt) const 
-{
-  
-  //Prints main parameters
-  
-  if(! opt)
-    return;
-  AliTriggerInput* in = 0x0 ;
-  AliInfo(Form(" fSimulation %i (input option) : #digits %i\n", fSimulation, fDigitsList->GetEntries()));
-  AliInfo(Form(" fTimeKey    %i  \n ", fTimeKey));
-
-  AliInfo(Form("\t Maximum Amplitude after Sliding Cell, \n")) ; 
-  AliInfo(Form("\t -2x2 cells sum (not overlapped): %10.2f, in Super Module %d\n",
-         f2x2MaxAmp,f2x2SM)) ; 
-  AliInfo(Form("\t -2x2 from row %d to row %d and from column %d to column %d\n", f2x2ModulePhi, f2x2ModulePhi+2, f2x2ModuleEta, f2x2ModuleEta+2)); 
-  AliInfo(Form("\t -2x2 Isolation Patch %d x %d, Amplitude out of 2x2 patch is %f, threshold %f, Isolated? %d \n", 2*fIsolPatchSize+2, 2*fIsolPatchSize+2,  f2x2AmpOutOfPatch,  f2x2AmpOutOfPatchThres,static_cast<Int_t> (fIs2x2Isol))); 
-  if(fPatchSize > 0){
-    AliInfo(Form("\t Patch Size, n x n: %d x %d cells\n",2*(fPatchSize+1), 2*(fPatchSize+1)));
-    AliInfo(Form("\t -nxn cells sum (overlapped)    : %10.2f, in Super Module %d\n", fnxnMaxAmp,fnxnSM)); 
-    AliInfo(Form("\t -nxn from row %d to row %d and from column %d to column %d\n", fnxnModulePhi, fnxnModulePhi+4*fPatchSize, fnxnModuleEta, fnxnModuleEta+4*fPatchSize)) ; 
-    AliInfo(Form("\t -nxn Isolation Patch %d x %d, Amplitude out of nxn patch is %f, threshold %f, Isolated? %d \n", 4*fIsolPatchSize+2*(fPatchSize+1),4*fIsolPatchSize+2*(fPatchSize+1) ,  fnxnAmpOutOfPatch,  fnxnAmpOutOfPatchThres,static_cast<Int_t> (fIsnxnIsol) )); 
-  }
-  
-  AliInfo(Form("\t Isolate in SuperModule? %d\n", fIsolateInSuperModule)) ;  
-  AliInfo(Form("\t Threshold for LO %10.2f\n", fL0Threshold));  
-
-  in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_L0" );
-  if(in->GetValue())
-    AliInfo(Form("\t *** EMCAL LO is set ***\n")); 
-  
-  AliInfo(Form("\t Gamma Low Pt Threshold for L1 %10.2f\n", fL1GammaLowPtThreshold));
-  in = (AliTriggerInput*)fInputs.FindObject( "EMCAL_GammaLPt_L1" );
-  if(in->GetValue())
-    AliInfo(Form("\t *** EMCAL Gamma Low Pt for L1 is set ***\n"));
-
-  AliInfo(Form("\t Gamma Medium Pt Threshold for L1 %10.2f\n", fL1GammaMediumPtThreshold));  
-  in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_GammaMPt_L1" );
-  if(in->GetValue())
-    AliInfo(Form("\t *** EMCAL Gamma Medium Pt for L1 is set ***\n"));
-
-  AliInfo(Form("\t Gamma High Pt Threshold for L1 %10.2f\n", fL1GammaHighPtThreshold));  
-  in = (AliTriggerInput*) fInputs.FindObject( "EMCAL_GammaHPt_L1" );
-  if(in->GetValue())
-    AliInfo(Form("\t *** EMCAL Gamma High Pt for L1 is set ***\n")) ;
-
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM, 
-                                 const TMatrixD &ampmax2, 
-                                 const TMatrixD &ampmaxn)  
-{
-  //Checks the 2x2 and nxn maximum amplitude per each TRU and 
-  //compares with the different L0 and L1 triggers thresholds
-  Float_t max2[] = {-1,-1,-1,-1} ;
-  Float_t maxn[] = {-1,-1,-1,-1} ;
-  Int_t   mtru2  = -1 ;
-  Int_t   mtrun  = -1 ;
-
-  Int_t nTRU = fGeom->GetNTRU();
-
-  //Find maximum summed amplitude of all the TRU 
-  //in a Super Module
-    for(Int_t i = 0 ; i < nTRU ; i++){
-      if(max2[0] < ampmax2(0,i) ){
-       max2[0] =  ampmax2(0,i) ; // 2x2 summed max amplitude
-       max2[1] =  ampmax2(1,i) ; // corresponding phi position in TRU
-       max2[2] =  ampmax2(2,i) ; // corresponding eta position in TRU
-       max2[3] =  ampmax2(3,i) ; // corresponding most recent time
-       mtru2   = i ;
-      }
-      if(maxn[0] < ampmaxn(0,i) ){
-       maxn[0] =  ampmaxn(0,i) ; // nxn summed max amplitude
-       maxn[1] =  ampmaxn(1,i) ; // corresponding phi position in TRU
-       maxn[2] =  ampmaxn(2,i) ; // corresponding eta position in TRU
-       maxn[3] =  ampmaxn(3,i) ; // corresponding most recent time
-       mtrun   = i ;
-      }
-    }
-
-  //--------Set max amplitude if larger than in other Super Modules------------
-  Float_t maxtimeR2 = -1 ;
-  Float_t maxtimeRn = -1 ;
-  static AliEMCALRawUtils rawUtil;
-  // Int_t nTimeBins = rawUtil.GetRawFormatTimeBins() ;
-  Int_t nTimeBins = TIMEBINS;  //changed by PTH
-
-  //Set max of 2x2 amplitudes and select L0 trigger
-  if(max2[0] > f2x2MaxAmp ){
-    //    if(max2[0] > 5) printf(" L0 : iSM %i: max2[0] %5.0f :  max2[3] %5.0f  (maxtimeR2) \n", 
-    //                    iSM, max2[0], max2[3]);
-    f2x2MaxAmp  = max2[0] ;
-    f2x2SM      = iSM ;
-    maxtimeR2   = max2[3] ;
-    fGeom->GetModulePhiEtaIndexInSModuleFromTRUIndex(mtru2, 
-                                                 static_cast<Int_t>(max2[1]),
-                                                 static_cast<Int_t>(max2[2]),
-                                                  f2x2ModulePhi,f2x2ModuleEta);
-    
-    //Isolated patch?
-    if(fIsolateInSuperModule)
-      fIs2x2Isol =  IsPatchIsolated(0, ampmatrix, iSM, mtru2,  f2x2MaxAmp, f2x2ModulePhi,f2x2ModuleEta) ;
-    else
-      fIs2x2Isol =  IsPatchIsolated(0, ampmatrix, iSM, mtru2,  f2x2MaxAmp,  static_cast<Int_t>(max2[1]), static_cast<Int_t>(max2[2])) ;
-
-    if(GetTimeKey()) {
-    //Transform digit amplitude in Raw Samples
-      if (fADCValuesLow2x2 == 0) {
-        fADCValuesLow2x2  = new Int_t[nTimeBins];
-        fADCValuesHigh2x2 = new Int_t[nTimeBins];
-      }
-      //printf(" maxtimeR2 %12.5e (1)\n", maxtimeR2);
-      //  rawUtil.RawSampledResponse(maxtimeR2 * AliEMCALRawUtils::GetRawFormatTimeBin(), 
-      //                                f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
-       
-      //  rawUtil.RawSampledResponse(maxtimeR2*TIMEBINMAX/TIMEBINS, 
-      //                                f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
-      
-      AliEMCALRawResponse::RawSampledResponse( maxtimeR2*TIMEBINMAX/TIMEBINS, 
-                                              f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
-
-    // Set Trigger Inputs, compare ADC time bins until threshold is attained
-    // Set L0
-      for(Int_t i = 0 ; i < nTimeBins ; i++){
-      //      printf(" fADCValuesHigh2x2[%i] %i : %i \n", i, fADCValuesHigh2x2[i], fADCValuesLow2x2[i]); 
-        if(fADCValuesHigh2x2[i] >= fL0Threshold          || fADCValuesLow2x2[i] >= fL0Threshold){
-         SetInput("EMCAL_L0") ;
-         break;
-        }
-      }
-    } else {
-      // Nov 5 - no analysis of time information
-      if(f2x2MaxAmp >= fL0Threshold) { // should add the low amp too
-        SetInput("EMCAL_L0");
-      }
-    }
-  }
-  
-  //------------Set max of nxn amplitudes and select L1 trigger---------
-  if(maxn[0] > fnxnMaxAmp ){
-    fnxnMaxAmp  = maxn[0] ;
-    fnxnSM      = iSM ;
-    maxtimeRn   = maxn[3] ;
-    fGeom->GetModulePhiEtaIndexInSModuleFromTRUIndex(mtrun, 
-                                                 static_cast<Int_t>(maxn[1]),
-                                                 static_cast<Int_t>(maxn[2]),
-                                                 fnxnModulePhi,fnxnModuleEta) ; 
-    
-    //Isolated patch?
-    if(fIsolateInSuperModule)
-      fIsnxnIsol =  IsPatchIsolated(1, ampmatrix, iSM, mtrun,  fnxnMaxAmp, fnxnModulePhi, fnxnModuleEta) ;
-    else
-      fIsnxnIsol =  IsPatchIsolated(1, ampmatrix, iSM, mtrun,  fnxnMaxAmp,  static_cast<Int_t>(maxn[1]), static_cast<Int_t>(maxn[2])) ;
-    
-    if(GetTimeKey()) {
-    //Transform digit amplitude in Raw Samples
-      if (fADCValuesLownxn == 0) {
-        fADCValuesHighnxn = new Int_t[nTimeBins];
-        fADCValuesLownxn  = new Int_t[nTimeBins];
-      }
-      //  rawUtil.RawSampledResponse(maxtimeRn * AliEMCALRawUtils::GetRawFormatTimeBin(), 
-      //   fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
-
-      //rawUtil.RawSampledResponse(maxtimeRn*TIMEBINMAX/TIMEBINS, 
-      //                                fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
-
-      AliEMCALRawResponse::RawSampledResponse (maxtimeRn*TIMEBINMAX/TIMEBINS, 
-                                              fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
-      
-    //Set Trigger Inputs, compare ADC time bins until threshold is attained
-    //SetL1 Low
-      for(Int_t i = 0 ; i < nTimeBins ; i++){
-        if(fADCValuesHighnxn[i] >= fL1GammaLowPtThreshold  || fADCValuesLownxn[i] >= fL1GammaLowPtThreshold){
-         SetInput("EMCAL_GammaLPt_L1") ;
-         break; 
-        }
-      }
-    
-    //SetL1 Medium
-      for(Int_t i = 0 ; i < nTimeBins ; i++){
-        if(fADCValuesHighnxn[i] >= fL1GammaMediumPtThreshold || fADCValuesLownxn[i] >= fL1GammaMediumPtThreshold){
-         SetInput("EMCAL_GammaMPt_L1") ;
-         break;
-        }
-      }
-    
-    //SetL1 High
-      for(Int_t i = 0 ; i < nTimeBins ; i++){
-        if(fADCValuesHighnxn[i] >= fL1GammaHighPtThreshold || fADCValuesLownxn[i] >= fL1GammaHighPtThreshold){
-         SetInput("EMCAL_GammaHPt_L1") ;
-         break;
-        }
-      }
-    } else {
-      // Nov 5 - no analysis of time information
-      if(fnxnMaxAmp >= fL1GammaLowPtThreshold) { // should add the low amp too
-       SetInput("EMCAL_GammaLPt_L1") ; //SetL1 Low
-      }
-      if(fnxnMaxAmp >= fL1GammaMediumPtThreshold) { // should add the low amp too
-       SetInput("EMCAL_GammaMPt_L1") ; //SetL1 Medium
-      }
-      if(fnxnMaxAmp >= fL1GammaHighPtThreshold) { // should add the low amp too
-       SetInput("EMCAL_GammaHPt_L1") ; //SetL1 High
-      }
-    }
-  }
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::FillTRU(const TClonesArray * digits, TClonesArray * ampmatrix, TClonesArray * ampmatrixsmod, TClonesArray * timeRmatrix) {
-
-//  Orders digits ampitudes list in fNTRU TRUs (384 cells) per supermodule. 
-//  Each TRU is a TMatrixD, and they are kept in TClonesArrays. The number of 
-//  TRU in phi is fNTRUPhi, and the number of TRU in eta is fNTRUEta.
-//  Last 2 modules are half size in Phi, I considered that the number of TRU
-//  is maintained for the last modules but decision not taken. If different, 
-//  then this must be changed. Also fill a matrix with all amplitudes in supermodule for isolation studies. 
-//  Initilize and declare variables
-//  List of TRU matrices initialized to 0.
-//  printf("<I> AliEMCALTrigger::FillTRU() started : # digits %i\n", digits->GetEntriesFast());
-
-// Nov 2, 2007.
-// One input per EMCAL module so size of matrix is reduced by 4 (2x2 division case) 
-
-  Int_t nPhi        = fGeom->GetNPhi();
-  Int_t nZ          = fGeom->GetNZ();
-  Int_t nTRU        = fGeom->GetNTRU();
-  //  Int_t nTRUPhi     = fGeom->GetNTRUPhi();
-  Int_t nModulesPhi  = fGeom->GetNModulesInTRUPhi();
-  Int_t nModulesPhi2 = fGeom->GetNModulesInTRUPhi();
-  Int_t nModulesEta  = fGeom->GetNModulesInTRUEta();
-  //  printf("<I> AliEMCALTrigger::FillTRU() nTRU %i  nTRUPhi %i : nModulesPhi %i nModulesEta %i \n", 
-  //    nTRU, nTRUPhi, nModulesPhi, nModulesEta);
-
-  Int_t id       = -1; 
-  Float_t amp    = -1;
-  Float_t timeR  = -1;
-  Int_t iSupMod  = -1;
-  Int_t nModule  = -1;
-  Int_t nIphi    = -1;
-  Int_t nIeta    = -1;
-  Int_t iphi     = -1;
-  Int_t ieta     = -1;
-  // iphim, ietam - module indexes in SM 
-  Int_t iphim    = -1;
-  Int_t ietam    = -1;
-
-  //List of TRU matrices initialized to 0.
-  Int_t nSup = fGeom->GetNumberOfSuperModules();
-  for(Int_t k = 0; k < nTRU*nSup; k++){
-    TMatrixD amptrus(nModulesPhi,nModulesEta) ;
-    TMatrixD timeRtrus(nModulesPhi,nModulesEta) ;
-    // Do we need to initialise? I think TMatrixD does it by itself...
-    for(Int_t i = 0; i < nModulesPhi; i++){
-      for(Int_t j = 0; j < nModulesEta; j++){
-       amptrus(i,j) = 0.0;
-       timeRtrus(i,j) = 0.0;
-      }
-    }
-    new((*ampmatrix)[k])   TMatrixD(amptrus) ;
-    new((*timeRmatrix)[k]) TMatrixD(timeRtrus) ; 
-  }
-  
-  // List of Modules matrices initialized to 0.
-  for(Int_t k = 0; k < nSup ; k++){
-    int mphi = nPhi;
-    //    if(nSup>9) mphi = nPhi/2; // the same size
-    TMatrixD  ampsmods( mphi, nZ);
-    for(Int_t i = 0; i <  mphi; i++){
-      for(Int_t j = 0; j < nZ; j++){
-       ampsmods(i,j)   = 0.0;
-      }
-    }
-    new((*ampmatrixsmod)[k]) TMatrixD(ampsmods) ;
-  }
-
-  AliEMCALDigit * dig ;
-  
-  //Digits loop to fill TRU matrices with amplitudes.
-  for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){
-    
-    dig = dynamic_cast<AliEMCALDigit *>(digits->At(idig)) ;
-    if(dig){
-      amp    = Float_t(dig->GetAmplitude()); // Energy of the digit (arbitrary units)
-      id     = dig->GetId() ;          // Id label of the cell
-      timeR  = dig->GetTimeR() ;       // Earliest time of the digit
-      if(amp<=0.0) AliDebug(1,Form(" id %i amp %f \n", id, amp));
-      // printf(" FILLTRU : timeR %10.5e time %10.5e : amp %10.5e \n", timeR, dig->GetTime(), amp);
-      // Get eta and phi cell position in supermodule
-      Bool_t bCell = fGeom->GetCellIndex(id, iSupMod, nModule, nIphi, nIeta) ;
-      if(!bCell)
-        AliError(Form("%i Wrong cell id number %i ", idig, id)) ;
-      
-      fGeom->GetCellPhiEtaIndexInSModule(iSupMod,nModule,nIphi, nIeta,iphi,ieta);
-      // iphim, ietam - module indexes in SM
-      fGeom->GetModuleIndexesFromCellIndexesInSModule(iSupMod,iphi,ieta, iphim, ietam, nModule); 
-      //if(iSupMod >9) 
-      //printf("iSupMod %i nModule %i iphi %i  ieta %i  iphim %i  ietam %i \n",
-      //iSupMod,nModule, iphi, ieta, iphim, ietam); 
-      
-      // Check to which TRU in the supermodule belongs the cell. 
-      // Supermodules are divided in a TRU matrix of dimension 
-      // (fNTRUPhi,fNTRUEta).
-      // Each TRU is a cell matrix of dimension (nModulesPhi,nModulesEta)
-      
-      // First calculate the row and column in the supermodule 
-      // of the TRU to which the cell belongs.
-      Int_t row   = iphim / nModulesPhi;
-      Int_t col   = ietam / nModulesEta;
-      //Calculate label number of the TRU
-      Int_t itru  = fGeom->GetAbsTRUNumberFromNumberInSm(row, col, iSupMod);
-      
-      //Fill TRU matrix with cell values
-      TMatrixD * amptrus   = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ;
-      TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ;
-      
-      if(!amptrus || !timeRtrus){
-        AliError("Could not recover the TRU matrix with amplitudes or times");
-      }
-      else{
-        //Calculate row and column of the module inside the TRU with number itru
-        Int_t irow = iphim - row * nModulesPhi;
-        if(iSupMod > 9)
-          irow = iphim - row *  nModulesPhi2; // size of matrix the same
-        Int_t icol = ietam - col * nModulesEta;
-      
-        (*amptrus)(irow,icol)  += amp ;
-        if((*timeRtrus)(irow,icol) <0.0 || (*timeRtrus)(irow,icol) <= timeR){ // ??
-          (*timeRtrus)(irow,icol) = timeR ;
-        }
-      }
-      //printf(" ieta %i iphi %i iSM %i || col %i row %i : itru %i -> amp %f\n", 
-      //          ieta, iphi, iSupMod, col, row, itru, amp);     
-      //####################SUPERMODULE MATRIX ##################
-      TMatrixD * ampsmods   = dynamic_cast<TMatrixD *>(ampmatrixsmod->At(iSupMod)) ;
-      if(!ampsmods){
-        AliError("Could not recover the matrix per SM");
-        continue;
-      }
-      (*ampsmods)(iphim,ietam)  += amp ;
-      //    printf(" id %i iphim %i ietam %i SM %i : irow %i icol %i itru %i : amp %6.0f\n", 
-      //id, iphim, ietam, iSupMod, irow, icol, itru, amp); 
-    }
-    else AliError("Could not recover the digit");
-  }
-  //assert(0);
-  //printf("<I> AliEMCALTrigger::FillTRU() is ended \n");
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::Trigger() 
-{
-  //Main Method to select triggers.
-  TH1::AddDirectory(0);
-
-  AliRunLoader *runLoader = AliRunLoader::Instance();
-  AliEMCALLoader *emcalLoader = 0;
-  if(runLoader) {
-    emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
-  }
-  //Load EMCAL Geometry
-  if (runLoader && runLoader->GetAliRun()){
-    AliEMCAL* emcal = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"));
-    if(emcal)fGeom = emcal->GetGeometry();
-  }
-  
-  if (!fGeom)   
-    fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());          
-
-  if (!fGeom)
-    AliFatal("Did not get geometry from EMCALLoader");
-  
-  //Define parameters
-  Int_t nSuperModules = fGeom->GetNumberOfSuperModules() ; //12 SM in EMCAL and 6/10 DCAL SMs
-  Int_t nTRU       = fGeom->GetNTRU();    // 3 TRU per super module
-
-  //Intialize data members each time the trigger is called in event loop
-  f2x2MaxAmp = -1; f2x2ModulePhi = -1;  f2x2ModuleEta = -1;
-  fnxnMaxAmp = -1; fnxnModulePhi = -1;  fnxnModuleEta = -1;
-
-  // Take the digits list if simulation
-  if(fSimulation && runLoader && emcalLoader){ // works than run seperate macros
-    runLoader->LoadDigits("EMCAL");
-    fDigitsList = emcalLoader->Digits() ;
-    runLoader->LoadSDigits("EMCAL");
-  }
-  // Digits list should be set by method SetDigitsList(TClonesArray * digits)
-  if(!fDigitsList)
-    AliFatal("Digits not found !") ;
-  
-  //Take the digits list 
-  
-  // Delete old if unzero
-  if(fAmpTrus)     {fAmpTrus->Delete();   delete fAmpTrus;}
-  if(fTimeRtrus)   {fTimeRtrus->Delete(); delete fTimeRtrus;}
-  if(fAmpSMods)    {fAmpSMods->Delete();  delete fAmpSMods;}
-  // Fill TRU and SM matrix    
-  fAmpTrus   = new TClonesArray("TMatrixD",nTRU);
-  fAmpTrus->SetName("AmpTrus");
-  fTimeRtrus = new TClonesArray("TMatrixD",nTRU);
-  fTimeRtrus->SetName("TimeRtrus");
-  fAmpSMods  = new TClonesArray("TMatrixD",nSuperModules);
-  fAmpSMods->SetName("AmpSMods");
-  
-  FillTRU(fDigitsList, fAmpTrus, fAmpSMods, fTimeRtrus);
-
-  // Jet stuff - only one case, no freedom here
-  if(fGeom->GetNEtaSubOfTRU() == 6) {
-    if(fAmpJetMatrix) {delete fAmpJetMatrix; fAmpJetMatrix=0;}
-    if(fJetMatrixE)   {delete fJetMatrixE; fJetMatrixE=0;}
-
-    fAmpJetMatrix = new TMatrixD(17,12); // 17-phi(row), 12-eta(col)
-    fJetMatrixE = new TH2F("fJetMatrixE"," E of max patch in (#phi,#eta)", 
-    17, 80.*TMath::DegToRad(), (180.+20.*2/3.)*TMath::DegToRad(), 12, -0.7, 0.7);
-    for(Int_t row=0; row<fAmpJetMatrix->GetNrows(); row++) {
-      for(Int_t col=0; col<fAmpJetMatrix->GetNcols(); col++) {
-        (*fAmpJetMatrix)(row,col) = 0.;
-      }
-    }
-    FillJetMatrixFromSMs(fAmpSMods, fAmpJetMatrix, fGeom);
-  }
-  if(!CheckConsistentOfMatrixes()) assert(0);
-
-  // Do Tower Sliding and select Trigger
-  // Initialize varible that will contain maximum amplitudes and 
-  // its corresponding tower position in eta and phi, and time.
-  TMatrixD ampmax2(4,nTRU) ; // 0-max amp, 1-irow, 2-icol, 3-timeR
-  TMatrixD ampmaxn(4,nTRU) ;
-  
-  for(Int_t iSM = 0 ; iSM < nSuperModules ; iSM++) {
-    //Do 2x2 and nxn sums, select maximums. 
-
-    MakeSlidingTowers(fAmpTrus, fTimeRtrus, iSM, ampmax2, ampmaxn);
-    
-    // Set the trigger
-    if(fIsolateInSuperModule) // here some discripency between tru and SM
-      SetTriggers(fAmpSMods,iSM,ampmax2,ampmaxn) ;
-    if(!fIsolateInSuperModule)
-      SetTriggers(fAmpTrus,iSM,ampmax2,ampmaxn) ;
-  }
-  
-  // Do patch sliding and select Jet Trigger
-  // 0-max amp-meanFromVZERO(if), 1-irow, 2-icol, 3-timeR, 
-  // 4-max amp , 5-meanFromVZERO (Nov 25, 2007)
-  // fAmpJetMax(6,1)
-  MakeSlidingPatch((*fAmpJetMatrix), fNJetPatchPhi, fAmpJetMax); // no timing information here
-
-  //Print();
-  // fDigitsList = 0;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::GetTriggerInfo(TArrayF &triggerPosition, TArrayF &triggerAmplitudes) const
-{
-  // Template - should be defined; Nov 5, 2007
-  triggerPosition[0]   = 0.; 
-  triggerAmplitudes[0] = 0.;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::FillJetMatrixFromSMs(TClonesArray *ampmatrixsmod, TMatrixD* jetMat, AliEMCALGeometry *g)
-{
-  // Nov 5, 2007
-  // Fill matrix for jet trigger from SM matrixes of modules
-  //
-  static int keyPrint = 0;
-
-  if(ampmatrixsmod==0 || jetMat==0 || g==0) return;
-  Double_t amp = 0.0, ampSum=0.0;
-
-  Int_t nEtaModSum = g->GetNZ()   / g->GetNEtaSubOfTRU(); // should be 4 
-  Int_t nPhiModSum = g->GetNPhi() / g->GetNTRUPhi();      // should be 4 
-
-  if(keyPrint) AliDebug(2,Form("%s",Form(" AliEMCALTrigger::FillJetMatrixFromSMs | nEtaModSum %i : nPhiModSum %i \n", nEtaModSum, nPhiModSum)));
-  Int_t jrow=0, jcol=0;  // indexes of jet matrix
-  Int_t nEtaSM=0, nPhiSM=0;
-  for(Int_t iSM=0; iSM<ampmatrixsmod->GetEntries(); iSM++) {
-    TMatrixD * ampsmods   = dynamic_cast<TMatrixD *>(ampmatrixsmod->At(iSM));
-    
-    if(!ampsmods) return;
-    
-    Int_t nrow = ampsmods->GetNrows();
-    Int_t ncol = ampsmods->GetNcols();
-    //printf("%s",Form(" ######## SM %i : nrow %i : ncol %i ##### \n", iSM, nrow, ncol));
-    for(Int_t row=0; row<nrow; row++) {
-      for(Int_t col=0; col<ncol; col++) {
-        amp  = (*ampsmods)(row,col);
-        nPhiSM = iSM / 2; 
-        nEtaSM = iSM % 2;
-        if       (amp>0.0) {
-           if(keyPrint) AliDebug(2,Form("%s",Form(" ** nPhiSm %i : nEtaSM %i : row %2.2i : col %2.2i -> ", nPhiSM, nEtaSM, row, col))); 
-          if(nEtaSM == 0) { // positive Z
-            jrow = 3*nPhiSM + row/nPhiModSum;
-            jcol = 6 + col / nEtaModSum;
-         } else {         // negative Z
-            if(iSM<=9) jrow = 3*nPhiSM + 2 - row/nPhiModSum;
-            else       jrow = 3*nPhiSM + 1 - row/nPhiModSum; // half size 
-            jcol = 5 - col / nEtaModSum;
-         }
-         if(keyPrint) AliDebug(2,Form("%s",Form(" jrow %2.2i : jcol %2.2i : amp %f (jetMat) \n", jrow, jcol, amp))); 
-
-          (*jetMat)(jrow,jcol) += amp;
-          ampSum += amp; // For controling
-        } else if(amp<0.0) {
-          AliDebug(1,Form(" jrow %2.2i : jcol %2.2i : amp %f (jetMat: amp<0) \n", jrow, jcol, amp)); 
-         assert(0);
-        }
-      }
-    }
-  } // cycle on SM
-  if(ampSum <= 0.0) AliDebug(1,Form("ampSum %f (<=0.0) ", ampSum));
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::MakeSlidingPatch(const TMatrixD &jm, const Int_t nPatchSize, TMatrixD &ampJetMax)
-{
-  // Sliding patch : nPatchSize x nPatchSize (OVERLAP)
-  static int keyPrint = 0;
-  if(keyPrint) AliDebug(2,Form(" AliEMCALTrigger::MakeSlidingPatch() was started \n"));
-  Double_t ampCur = 0.0, e=0.0;
-  ampJetMax(0,0)  = 0.0;
-  ampJetMax(3,0)  = 0.0; // unused now
-  ampJetMax(4,0)  = ampJetMax(5,0)  = 0.0;
-  for(Int_t row=0; row<fAmpJetMatrix->GetNrows(); row ++) {
-    for(Int_t col=0; col<fAmpJetMatrix->GetNcols(); col++) {
-      ampCur = 0.;
-      // check on patch size
-      if( (row+nPatchSize-1) <  fAmpJetMatrix->GetNrows() && (col+nPatchSize-1) < fAmpJetMatrix->GetNcols()){
-        for(Int_t i = 0 ; i < nPatchSize ; i++) {
-         for(Int_t j = 0 ; j < nPatchSize ; j++) {
-            ampCur += jm(row+i, col+j);
-          }
-        } // end cycle on patch
-        if(ampCur > ampJetMax(0,0)){
-         ampJetMax(0,0) = ampCur; 
-         ampJetMax(1,0) = row;
-         ampJetMax(2,0) = col;
-        }
-      } // check on patch size
-    }
-  }
-  if(keyPrint) AliDebug(2,Form(" ampJetMax %i row %2i->%2i col %2i->%2i \n", Int_t(ampJetMax(0,0)), Int_t(ampJetMax(1,0)), Int_t(ampJetMax(1,0))+nPatchSize-1, Int_t(ampJetMax(2,0)), Int_t(ampJetMax(2,0))+nPatchSize-1));
-
-  Double_t eCorrJetMatrix=0.0;
-  if(fVZER0Mult > 0.0) {
-  // Correct patch energy (adc) and jet patch matrix energy
-    Double_t meanAmpBG = GetMeanEmcalPatchEnergy(Int_t(fVZER0Mult), nPatchSize)/0.0153;
-    ampJetMax(4,0) = ampJetMax(0,0);
-    ampJetMax(5,0) = meanAmpBG;
-
-    Double_t eCorr     = ampJetMax(0,0) - meanAmpBG; 
-    AliDebug(2,Form(" ampJetMax(0,0) %f meanAmpBG %f  eCorr %f : ampJetMax(4,0) %f \n",
-          ampJetMax(0,0), meanAmpBG, eCorr, ampJetMax(5,0)));
-    ampJetMax(0,0)     = eCorr;
-    // --
-    eCorrJetMatrix = GetMeanEmcalEnergy(Int_t(fVZER0Mult)) / 208.;
-  }
-  // Fill patch energy matrix
-  for(int row=Int_t(ampJetMax(1,0)); row<Int_t(ampJetMax(1,0))+nPatchSize; row++) {
-    for(int col=Int_t(ampJetMax(2,0)); col<Int_t(ampJetMax(2,0))+nPatchSize; col++) {
-      e = Double_t(jm(row,col)*0.0153);  // 0.0153 - hard coded now
-      if(eCorrJetMatrix > 0.0) { // BG subtraction case
-        e -= eCorrJetMatrix;
-        fJetMatrixE->SetBinContent(row+1, col+1, e);
-      } else if(e > 0.0) {
-        fJetMatrixE->SetBinContent(row+1, col+1, e);
-      }
-    }
-  }
-  // PrintJetMatrix();
-  // Set the jet trigger(s), multiple threshold now, Nov 19,2007
-  for(Int_t i=0; i<fNJetThreshold; i++ ) {
-    if(ampJetMax(0,0) >= fL1JetThreshold[i]) {
-      SetInput(GetNameOfJetTrigger(i)); 
-    }
-  }
-}
-
-//____________________________________________________________________________
-Double_t AliEMCALTrigger::GetEmcalSumAmp() const 
-{ 
-  // Return sum of amplidutes from EMCal
-  // Used calibration coefficeint for transition to energy
-  return fAmpJetMatrix ?fAmpJetMatrix->Sum() :0.0;
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::PrintJetMatrix() const
-{
-  //  fAmpJetMatrix : (17,12); // 17-phi(row), 12-eta(col)
-  if(fAmpJetMatrix == 0) return;
-
-  AliInfo(Form("\n ####  jetMatrix : (%i,%i) ##### \n ", 
-              fAmpJetMatrix->GetNrows(), fAmpJetMatrix->GetNcols()));
-  PrintMatrix(*fAmpJetMatrix);
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::PrintAmpTruMatrix(Int_t ind) const
-{
- // Print matrix with TRU patches
-  TMatrixD * tru = dynamic_cast<TMatrixD *>(fAmpTrus->At(ind));
-  if(tru == 0) return;
-  AliInfo(Form("\n ####  Amp TRU matrix(%i) : (%i,%i) ##### \n ", 
-        ind, tru->GetNrows(), tru->GetNcols()));
-  PrintMatrix(*tru);
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::PrintAmpSmMatrix(Int_t ind) const
-{
-       // Print matrix with SM amplitudes
-       TMatrixD * sm = dynamic_cast<TMatrixD *>(fAmpSMods->At(ind));
-  if(sm == 0) return;
-  AliInfo(Form("\n ####  Amp SM matrix(%i) : (%i,%i) ##### \n ", 
-        ind, sm->GetNrows(), sm->GetNcols()));
-  PrintMatrix(*sm);
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::PrintMatrix(const TMatrixD &mat) const
-{
-  //Print matrix object
-  for(Int_t col=0; col<mat.GetNcols(); col++) AliInfo(Form(" %3i ", col));
-  AliInfo(Form("\n -- \n"));
-  for(Int_t row=0; row<mat.GetNrows(); row++) {
-    AliInfo(Form(" row:%2i ", row));
-    for(Int_t col=0; col<mat.GetNcols(); col++) {
-      AliInfo(Form(" %4i", (Int_t)mat(row,col)));
-    }
-    AliInfo("\n");
-  }
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALTrigger::CheckConsistentOfMatrixes(const Int_t pri)
-{
-  // Check consitency of matrices
-  Double_t sumSM = 0.0, smCur=0.0;
-  Double_t sumTru=0.0,  sumTruInSM = 0.0, truSum=0.0;
-  //  Bool_t key = kTRUE;
-  for(Int_t i=0; i<fAmpSMods->GetEntries(); i++) {
-    TMatrixD * sm = dynamic_cast<TMatrixD *>(fAmpSMods->At(i));
-    if(sm) {
-      smCur  = sm->Sum();
-      sumSM += smCur;
-
-      sumTruInSM = 0.0;
-      for(Int_t itru=0; itru<3; itru++) { // Cycle on tru inside SM
-        Int_t ind = 3*i + itru;
-        TMatrixD *tru = dynamic_cast<TMatrixD *>(fAmpTrus->At(ind)); 
-        if(tru) {
-          truSum = tru->Sum();
-         sumTruInSM += truSum;
-        }
-      }
-      sumTru += sumTruInSM;
-
-      if(sumTruInSM != smCur) {
-        AliDebug(1,Form(" sm %i : smCur %f -> sumTruInSM %f \n", i, smCur, sumTruInSM));
-        return kFALSE;
-      }
-    }
-  }
-  Double_t sumJetMat = fAmpJetMatrix->Sum();
-       if(pri || TMath::Abs(sumSM-sumTru)>0.0001 || TMath::Abs(sumSM-sumJetMat) > 0.0001) 
-   AliDebug(1,Form(" sumSM %f : sumTru %f : sumJetMat %f \n", sumSM, sumTru, sumJetMat)); 
-       if(TMath::Abs(sumSM - sumTru)>0.0001 || TMath::Abs(sumSM-sumJetMat) > 0.0001) return kFALSE; 
-  else                                       return kTRUE; 
-}
-
-//____________________________________________________________________________
-void AliEMCALTrigger::Browse(TBrowser* b)
-{
-  //Browse.
-  if(&fInputs)      b->Add(&fInputs);
-  if(fAmpTrus)      b->Add(fAmpTrus);
-  if(fTimeRtrus)    b->Add(fTimeRtrus);
-  if(fAmpSMods)     b->Add(fAmpSMods);
-  if(fAmpJetMatrix) b->Add(fAmpJetMatrix);
-  if(fJetMatrixE)   b->Add(fJetMatrixE);
-  //  if(c) b->Add(c);
-}
diff --git a/EMCAL/EMCALbase/AliEMCALTrigger.h b/EMCAL/EMCALbase/AliEMCALTrigger.h
deleted file mode 100644 (file)
index 5bd7a37..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-#ifndef ALIEMCALTRIGGER_H
-#define ALIEMCALTRIGGER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-//___________________________________________________________
-//  Class for trigger analysis.
-//
-//  -- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
-//  Digits are grouped in TRU's (Trigger Units). A TRU consist of 384 cells 
-//  ordered fNTRUPhi x fNTRUEta matrix. The algorithm searches all possible 
-//  2x2 and nxn (n multiple of 4) crystal combinations per each TRU, adding the 
-//  digits amplitude and finding the maximum.  It is found is maximum is isolated. 
-//  Maxima are transformed in adc time samples. Each time bin is compared to the 
-//  trigger threshold until it is larger and then, triggers are set. 
-//  Thresholds need to be fixed. 
-//  Last 2 modules are half size in Phi, I considered that the number 
-//  of TRU is maintained for the last modules but final decision has not 
-//  been taken. If different, then this must to be changed. 
-//  Usage:
-//
-//  //Inside the event loop
-//  AliEMCALTrigger *tr = new AliEMCALTrigger();//Init Trigger
-//  tr->SetL0Threshold(100);
-//  tr->SetL1GammaLowPtThreshold(1000);
-//  tr->SetL1GammaMediumPtThreshold(10000);
-//  tr->SetL1GammaHighPtThreshold(20000);
-//  ....
-//  tr->Trigger();  //Execute Trigger
-//  tr->Print("");  //Print data members after calculation.
-//
-//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, SUBATECH, CERN)
-//* -- Author: Aleksei Pavlinov, WSU, Detroit, USA
-// Nov 2, 2007
-// One TRU card receives 96 analogue sums from 12 FEE cards.
-// One sum is correcponding output from on module.      
-// This patch has size 12x8 modules (24x16 modules).
-// Each SM has 3 TRU cards.
-
-// --- ROOT system ---
-
-class TClonesArray ;
-class TTree;
-
-#include <TMatrixD.h>
-#include <TArrayF.h>
-
-// --- AliRoot header files ---
-#include "AliTriggerDetector.h"
-
-class TBrowser;
-class AliEMCALGeometry ;
-class TH2F;
-
-class AliEMCALTrigger : public AliTriggerDetector {
-  
- public:   
-
-  AliEMCALTrigger() ; //  ctor
-  virtual ~AliEMCALTrigger(); //virtual dtor
-
-
-  virtual void    CreateInputs(); //Define trigger inputs for Central Trigger Processor
-  void            Print(const Option_t * opt ="") const ;  
-  virtual void    Trigger();  //Make EMCAL trigger
-
-  //Getters
-  Float_t  Get2x2MaxAmplitude()  const { return f2x2MaxAmp ; }
-  Float_t  GetnxnMaxAmplitude()  const { return fnxnMaxAmp ; }
-  Int_t    Get2x2ModulePhi()     const { return f2x2ModulePhi ; }
-  Int_t    GetnxnModulePhi()     const { return fnxnModulePhi ; }
-  Int_t    Get2x2ModuleEta()     const { return f2x2ModuleEta ; }
-  Int_t    GetnxnModuleEta()     const { return fnxnModuleEta ; }
-  Int_t    Get2x2SuperModule()   const { return f2x2SM ; }
-  Int_t    GetnxnSuperModule()   const { return fnxnSM ; }
-
-  Int_t *  GetADCValuesLowGainMax2x2Sum()  const { return fADCValuesLow2x2; }
-  Int_t *  GetADCValuesHighGainMax2x2Sum() const { return fADCValuesHigh2x2; }
-  Int_t *  GetADCValuesLowGainMaxnxnSum()  const { return fADCValuesLownxn; }
-  Int_t *  GetADCValuesHighGainMaxnxnSum() const { return fADCValuesHighnxn; }
-
-  Float_t  GetL0Threshold()              const { return fL0Threshold ; } 
-  Float_t  GetL1GammaLowPtThreshold()    const { return fL1GammaLowPtThreshold ; }
-  Float_t  GetL1GammaMediumPtThreshold() const { return fL1GammaMediumPtThreshold ; }
-  Float_t  GetL1GammaHighPtThreshold()   const { return fL1GammaHighPtThreshold ; }
-
-  Int_t    GetPatchSize()              const { return fPatchSize ; }
-  Int_t    GetIsolPatchSize()          const { return fIsolPatchSize ; }
-
-  Float_t  Get2x2AmpOutOfPatch()       const { return  f2x2AmpOutOfPatch ; }
-  Float_t  GetnxnAmpOutOfPatch()       const { return  fnxnAmpOutOfPatch ; }
-  Float_t  Get2x2AmpOutOfPatchThres()  const { return  f2x2AmpOutOfPatchThres ; }
-  Float_t  GetnxnAmpOutOfPatchThres()  const { return  fnxnAmpOutOfPatchThres ; } 
-
-  Bool_t   Is2x2Isol()                 const { return  fIs2x2Isol ; }
-  Bool_t   IsnxnIsol()                 const { return  fIsnxnIsol ; }
-
-  Bool_t    IsSimulation()              const { return fSimulation ; }
-  Bool_t    IsIsolatedInSuperModule()   const { return fIsolateInSuperModule ; }
-  Bool_t    GetTimeKey()                const { return fTimeKey;}
-  TH2F*     GetJetMatrixE()             const { return fJetMatrixE;}
-  Double_t  GetEmcalSumAmp()            const;
-  
-  Int_t     GetNJetThreshold()   const {return fNJetThreshold;}
-  Double_t* GetL1JetThresholds() const {return fL1JetThreshold;}
-  TMatrixD  GetAmpJetMax()       const {return fAmpJetMax;}
-
-  void PrintJetMatrix() const;                  // *MENU*
-  void PrintAmpTruMatrix(Int_t ind) const;      // *MENU*
-  void PrintAmpSmMatrix(Int_t ind) const;       // *MENU*
-  void PrintMatrix(const TMatrixD &mat) const;  // *MENU*
-  Bool_t CheckConsistentOfMatrixes(const Int_t pri=0); // *MENU*
-
-
-  //Setters
-  void     SetDigitsList(TClonesArray * digits)          
-   {fDigitsList  = digits ; }
-
-  void     SetL0Threshold(Int_t amp)     
-    {fL0Threshold            = amp; }
-  void     SetL1GammaLowPtThreshold(Int_t amp) 
-    {fL1GammaLowPtThreshold    = amp; } 
-  void     SetL1GammaMediumPtThreshold(Int_t amp) 
-    {fL1GammaMediumPtThreshold = amp; } 
-  void     SetL1GammaHighPtThreshold(Int_t amp)
-    {fL1GammaHighPtThreshold   = amp; }
-
-  void SetPatchSize(Int_t ps)                {fPatchSize = ps ; }
-  void SetIsolPatchSize(Int_t ps)          {fIsolPatchSize = ps ; }
-  void Set2x2AmpOutOfPatchThres(Float_t th) { f2x2AmpOutOfPatchThres = th; }
-  void SetnxnAmpOutOfPatchThres(Float_t th) { fnxnAmpOutOfPatchThres = th; }
-  void SetSimulation(Bool_t sim )          {fSimulation = sim ; }
-  void SetIsolateInSuperModule(Bool_t isol )          {fIsolateInSuperModule = isol ; }
-  void SetTimeKey(Bool_t timeKey) {fTimeKey = timeKey;}
-  void SetJetPatchSize(const Int_t patchSize) {fNJetPatchPhi = fNJetPatchEta = patchSize;}
-  void SetJetParameters(const Int_t patchSize, Double_t* jetThreshold)
-  { // unused now
-    fNJetPatchPhi = fNJetPatchEta = patchSize; 
-    fL1JetThreshold = jetThreshold;
-  }
-  void SetVZER0Multiplicity(Double_t mult) {fVZER0Mult = mult;}
-
-  //
-  virtual void Browse(TBrowser* b);
-  virtual Bool_t  IsFolder() const {return kTRUE;}
-
-  // Name of Jet trigger(s)
-  Char_t* GetNameOfJetTrigger(const Int_t i) {return Form("%s_Th_%2.2i",fgNameOfJetTriggers.Data(),i);}
-  static TString GetNameOfJetTriggers() {return fgNameOfJetTriggers;}
-  static TString fgNameOfJetTriggers; //Name of jet triggers
-  // Estimation on EMCal energy from VZERO multiplicity
-  // 0.0153 is coefficient from adc to energy
-  // Dec 4, 2007
-  // 1  p0           2.52248e-02   3.24364e-05   9.29319e-01  -2.34036e-06
-  static Double_t GetMeanEmcalEnergy(const Int_t mult) {return 2.52248e-02*Double_t(mult);}
-  static Double_t GetMeanEmcalPatchEnergy(const Int_t mult, Int_t patchSize) 
-  {return GetMeanEmcalEnergy(mult)*Double_t(patchSize)*Double_t(patchSize)/208.;}
- private:
-
-  void FillTRU(const TClonesArray * digits, TClonesArray * ampmatrix, TClonesArray * ampmatrixsmod, TClonesArray * timeRmatrix); 
-
-  Bool_t IsPatchIsolated(Int_t iPatchType, const TClonesArray * ampmods, const Int_t imod, const Int_t mtru, const Float_t maxamp, const Int_t maxphi, const Int_t maxeta) ;
-  
-  void MakeSlidingTowers(const TClonesArray * amptrus, const TClonesArray * timeRtrus,
-  const Int_t supermod, TMatrixD &ampmax2, TMatrixD &ampmaxn) ; 
-  
-  void SetTriggers(const TClonesArray * amptrus,const Int_t iSM, const TMatrixD &ampmax2, const TMatrixD &ampmaxn) ;
-  void GetTriggerInfo(TArrayF &triggerPosition, TArrayF &triggerAmplitudes) const; 
-  // Jet staff
-  void FillJetMatrixFromSMs(TClonesArray *ampmatrixsmod, TMatrixD * const jetMat, AliEMCALGeometry * const g); 
-  // no timing information here
-  void MakeSlidingPatch(const TMatrixD &jm, const Int_t nPatchSize, TMatrixD &ampJetMax);
-
- private: 
-  AliEMCALGeometry *fGeom;    //!
-
-  Float_t f2x2MaxAmp ;         //! Maximum 2x2 added amplitude (not overlapped) 
-  Int_t   f2x2ModulePhi ;      //! upper right cell, row(phi)   
-  Int_t   f2x2ModuleEta ;      //! and column(eta)  
-  Int_t   f2x2SM ;             //! Super Module where maximum is found
-  Float_t fnxnMaxAmp ;         //! Maximum nxn added amplitude (overlapped)
-  Int_t   fnxnModulePhi ;      //! upper right cell, row(phi)   
-  Int_t   fnxnModuleEta ;      //! and column(eta)
-  Int_t   fnxnSM ;             //! Super Module where maximum is found
-
-  Int_t*   fADCValuesHighnxn ; //! Sampled ADC high gain values for the nxn crystals amplitude sum
-  Int_t*   fADCValuesLownxn  ; //! " low gain  " 
-  Int_t*   fADCValuesHigh2x2 ; //! " high gain " 2x2 "
-  Int_t*   fADCValuesLow2x2  ; //! " low gaing " "
-
-  TClonesArray* fDigitsList;   //! Array of digits 
-
-  Float_t fL0Threshold ;              // L0 trigger energy threshold
-  Float_t fL1GammaLowPtThreshold ;    // L1 gamma Low pT trigger energy threshold
-  Float_t fL1GammaMediumPtThreshold ; // L1 gamma Medium pT trigger energy threshold
-  Float_t fL1GammaHighPtThreshold ;   // L1 gamma High pT trigger energy threshold
-
-  Int_t fPatchSize;          // Trigger patch factor, to be multiplied to 2x2 cells
-                             //  0 means 2x2, 1 means 4x4 (max size 4x4 now)
-  Int_t fIsolPatchSize ;     //  Isolation patch size, number of rows or columns to add to 
-                             //  the 2x2 or nxn maximum amplitude patch. 
-                             //  1 means a patch around max amplitude of 2x2 of 4x4 and around         
-                             //  max ampl patch of 4x4 of 8x8 
-    
-  Float_t f2x2AmpOutOfPatch;      //  Amplitude in isolation cone minus maximum amplitude of the reference 2x2 patch
-  Float_t fnxnAmpOutOfPatch;      //  Amplitude in isolation cone minus maximum amplitude of the reference nxn patch
-  Float_t f2x2AmpOutOfPatchThres; //  Threshold to select a trigger as isolated on f2x2AmpOutOfPatch value
-  Float_t fnxnAmpOutOfPatchThres; //  Threshold to select a trigger as isolated on fnxnAmpOutOfPatch value
-  Float_t fIs2x2Isol;             //  2x2 Patch is isolated if f2x2AmpOutOfPatchThres threshold is passed
-  Float_t fIsnxnIsol ;            //  nxn Patch is isolated if fnxnAmpOutOfPatchThres threshold is passed
-
-
-  Bool_t  fSimulation ;           // Flag to do the trigger during simulation or reconstruction
-  Bool_t  fIsolateInSuperModule;  // Flag to isolate trigger patch in SuperModule or in TRU acceptance
-  Bool_t  fTimeKey;               // Flag to take into account the digits time information  
-  // 
-  TClonesArray *fAmpTrus;         //! Array of amplides of TRU matrixes
-  TClonesArray *fTimeRtrus;       //! Array of recent times  (unused now)
-  TClonesArray *fAmpSMods;        //! Array of amplides of SM  matrixes
-  // Information for EMCAL ESD
-  TArrayF fTriggerPosition;       // Triggered patch position
-  TArrayF fTriggerAmplitudes;     // Triggered patch amplitude
-  // Jet staf
-  Int_t     fNJetPatchPhi;       // size of jet pathch in phi(row)   direction  (nJetPatchPhi*4 module) 
-  Int_t     fNJetPatchEta;       // size of jet pathch in eta(column) direction (nJetPatchEta*4 module)
-  Int_t     fNJetThreshold;      // number of jet threshold
-  Double_t  *fL1JetThreshold;    //[fNJetThreshold] array of L1 jet energy threshold (this is not Et)
-  Double_t  fJetMaxAmp;          // Max amp from patch (fNJetPatchPhi*fNJetPatchEta)
-  TMatrixD* fAmpJetMatrix;       //-> Jet trigger matrix : (nphi(17), neta(12))
-  TH2F*     fJetMatrixE;         //-> temporary solution for getting coordinate informatin
-  TMatrixD  fAmpJetMax;          // 6 elements
-  // VZER0 
-  Double_t  fVZER0Mult;              // multiplicity (V0A+V0c)
-  
-  const AliEMCALTrigger & operator = (const AliEMCALTrigger & ) ;
-  AliEMCALTrigger(const AliEMCALTrigger & trig) ; // cpy ctor
-  
-  ClassDef(AliEMCALTrigger, 2)
-} ;
-    
-    
-#endif //ALIEMCALTRIGGER_H
-    
index d0a2b13fa1abadca80073211514eb0d50433f0b7..586068e158e41a8880bf385dc726b9dafd352564 100644 (file)
@@ -288,11 +288,7 @@ void AliEMCALTriggerRawDigitMaker::PostProcess()
        Int_t idx;
        
        AliEMCALTriggerRawDigit* dig = 0x0;
-       
-       TVector2 sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch;
-       
-       fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->GetSegmentation(sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch);
-       
+
        fRawReader->Reset();
        fRawReader->Select("EMCAL",44); 
 
@@ -370,6 +366,9 @@ void AliEMCALTriggerRawDigitMaker::PostProcess()
                
                Int_t iTRU, x, y;
 
+               TVector2 sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch;
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->GetSegmentation(sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch);
+
                if (fSTURawStream->GetRawData())
                {
                        if (AliDebugLevel()) printf("| STU => TRU raw data are there!\n");
index 870182d66129f75e60f5c5d40e3c9004453f6949..863eb09b4dbfc63bde47b307ab742f7efa492f25 100644 (file)
@@ -60,7 +60,6 @@ set(SRCS
     AliEMCALSimParam.cxx
     AliEMCALSpaceFrame.cxx
     AliEMCALSurvey.cxx
-    AliEMCALTrigger.cxx
     AliEMCALTriggerData.cxx
     AliEMCALTriggerDCSConfig.cxx
     AliEMCALTriggerDCSConfigDB.cxx
old mode 100644 (file)
new mode 100755 (executable)
index 11d0a02..639696b
@@ -36,7 +36,6 @@
 #pragma link C++ class AliEMCALCalibMapAPDVal+;
 #pragma link C++ class AliEMCALSuperModuleCalibMapAPD+;
 #pragma link C++ class AliEMCALRawDigit+;
-#pragma link C++ class AliEMCALTrigger+;
 #pragma link C++ class AliEMCALTriggerSTURawStream+;
 #pragma link C++ class AliEMCALRawUtils+;
 #pragma link C++ class AliEMCAL+;
index 9acecb375bc741da7b44fd7922bfa90e69a86641..0a030c9532b7973f996f57bcab86ed646c08a5f9 100644 (file)
@@ -73,3 +73,4 @@ install(TARGETS ${MODULE}
         LIBRARY DESTINATION lib)
 
 install(FILES ${HDRS} DESTINATION include)
+install(DIRECTORY data DESTINATION ${MODULE})
index 3d85d45037e92e94da3c2a475786d69b9e09b849..7d419a3ab7ffec03d889874516b222716d419b4c 100644 (file)
@@ -66,6 +66,7 @@ ClassImp(AliFITv2)
 //--------------------------------------------------------------------
 AliFITv2::AliFITv2():  AliFIT(),
                     fIdSens1(0),
+                    fIdSens2(0),
                     fPMTeff(0x0)
 
 {
@@ -76,6 +77,7 @@ AliFITv2::AliFITv2():  AliFIT(),
 AliFITv2::AliFITv2(const char *name, const char *title):
   AliFIT(name,title),
   fIdSens1(0),
+  fIdSens2(0),
   fPMTeff(0x0)
 
 {
@@ -115,7 +117,7 @@ void AliFITv2::CreateGeometry()
   Float_t ptop[3] = {1.324, 1.324, 1.};//cherenkov radiator
   Float_t preg[3] = {1.324, 1.324, 0.05};//photcathode 
 
-  Float_t zV0A = 329.;
+  Float_t zV0A = 325.;
   Float_t pV0Amother[3] = {4.25, 41.25, 0.6};
   Float_t pV0A[3] = {4.3, 41.2, 0.5};
 
@@ -142,11 +144,10 @@ void AliFITv2::CreateGeometry()
   Float_t xa=-12.8;
   Float_t ya=-12.8;
   Int_t itr=0;
-  Int_t itrHole=0;
   for (Int_t itrx=0; itrx<5; itrx++) {
     for (Int_t itry=0; itry<5; itry++) {
       nameTr = Form("0TR%i",itr+1);
-      z=-pstartA[2]+pinstart[2]/*+za[itr]*/;
+      z=-pstartA[2]+pinstart[2]/* +za[itr]*/;
       if(itr !=12){
        if(TMath::Abs(xa)<10 && TMath::Abs(ya)<10) z= z-2;
        tr[itr] = new TGeoTranslation(nameTr.Data(),xa,ya, z );
@@ -165,7 +166,7 @@ void AliFITv2::CreateGeometry()
   for (Int_t itrx=0; itrx<6; itrx++) {
     for (Int_t itry=0; itry<6; itry++) {
       nameTr = Form("0TR%i",itr+1);
-      z=-pstartC[2]+pinstart[2]/*+zc[itr]*/;
+      z=-pstartC[2]+pinstart[2] /*+ zc[itr] */;
       if (itr!=39 && itr!=40 && itr!=45 &&itr!=46) {
        if( TMath::Abs(xc)<10 &&  TMath::Abs(yc)<10) z= z+2;
        tr[itr] = new TGeoTranslation(nameTr.Data(),xc,yc, z );
@@ -216,13 +217,13 @@ void AliFITv2::CreateGeometry()
 // MCP
    z=-pinstart[2] + 2*ptop[2] + 2*preg[2] + pmcp[2];
   ins->AddNode(mcp, 1 , new TGeoTranslation(0,0,z) );
-/*
+
   //V0A 
    TVirtualMC::GetMC()->Gsvolu("0V0AM","TUBE",idtmed[kAir],pV0Amother,3);
    TVirtualMC::GetMC()->Gspos ("0V0AM",1, "ALIC", 0,0,zV0A , 0, "ONLY");
    TVirtualMC::GetMC()->Gsvolu("0V0A","TUBE",idtmed[kSensAir],pV0A,3);
    TVirtualMC::GetMC()->Gspos ("0V0A",1, "0V0AM", 0, 0, 0, 0, "ONLY");
-*/
+
 
  
 }    
index 7ad2d5f5086d2134897110c673f0dfb62e220fde..7ebce90436773a197e2e1f181c3ee6fdb300bb81 100644 (file)
@@ -20,6 +20,7 @@ public:
   AliFITv2(const char *name, const char *title);
   AliFITv2(const AliFITv2& o):AliFIT(),
     fIdSens1(0),
+    fIdSens2(0),
     fPMTeff(0x0) {((AliFITv2 &) o).Copy(*this);}
   
   AliFITv2& operator=(const AliFITv2&) { return *this; }
index 19e1935b88e8b5eb8265473bea5d2585ddd49d4e..ede1a673f16f46e2017ea1681ecf4c4ab5129cf7 100644 (file)
@@ -30,6 +30,7 @@ class AliITSSAPTracker : public TObject
   enum {kInvalidBit=BIT(14)};
   //
   struct SPDtracklet {
+  SPDtracklet() : id1(0),id2(0),label(0),dphi(0),dtht(0),chi2(0) {}
     int id1;
     int id2;
     int label;
index 00d62995e441815f8bde234cfb8a6ae441606043..448e85f7954b100b68b5f46dd4bf010ba721b771 100644 (file)
@@ -220,7 +220,8 @@ Int_t AliHLTAnaManagerComponent::DoEvent(const AliHLTComponentEventData& evtData
     }
     esdEvent->GetStdContent();
   }
-  printf("----> ESDEvent %p has %d tracks: \n", esdEvent, esdEvent->GetNumberOfTracks());
+  if (esdEvent) printf("----> ESDEvent %p has %d tracks: \n", esdEvent, esdEvent->GetNumberOfTracks());
+  else printf("----> No ESDEvent found\n");
   for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDfriendObject); iter != NULL; iter = GetNextInputObject() ) {
     esdFriend = dynamic_cast<AliESDfriend*>(const_cast<TObject*>( iter ) );
     if( !esdFriend ){ 
@@ -229,7 +230,8 @@ Int_t AliHLTAnaManagerComponent::DoEvent(const AliHLTComponentEventData& evtData
       continue;
     }
   }
-  printf("----> ESDFriend %p has %d tracks: \n", esdFriend, esdFriend->GetNumberOfTracks());
+  if (esdFriend) printf("----> ESDFriend %p has %d tracks: \n", esdFriend, esdFriend->GetNumberOfTracks());
+  else printf("----> No ESDFriend found\n");
 
   fAnalysisManager->InitInputData(esdEvent, esdFriend);
   //  fInputHandler->BeginEvent(0);
index 389e7f5607d5113e323c829c60e67fbc3057f27e..449f32270084832b33cb1e32014955555da07c3f 100644 (file)
@@ -439,7 +439,7 @@ void AliITSUv1::CreateSuppCyl(const Bool_t innerBarrel,TGeoVolume *dest,const TG
   //
 
   Double_t rminIB =  4.7;
-  Double_t rminOB = 43.4;
+  Double_t rminOB = 43.9;
   Double_t zLenOB ;
   Double_t cInt        = 0.22; //dimensioni cilindro di supporto interno
   Double_t cExt        = 1.00; //dimensioni cilindro di supporto esterno
index 389245c850ff7dfa5188c2af44034870c2fd25e6..14783f3b59111918bc8c22886862aef2858dcf49 100644 (file)
@@ -93,6 +93,7 @@ const Double_t AliITSUv1Layer::fgkOBCarbonPlateThick  =   0.012*fgkcm;
 const Double_t AliITSUv1Layer::fgkOBGlueThickM1       =   0.03 *fgkcm;
 const Double_t AliITSUv1Layer::fgkOBGlueThick         =   0.01 *fgkcm;
 const Double_t AliITSUv1Layer::fgkOBModuleZLength     =  21.06 *fgkcm;
+const Double_t AliITSUv1Layer::fgkOBHalfStaveYPos     =   2.067*fgkcm;
 const Double_t AliITSUv1Layer::fgkOBHalfStaveYTrans   =   1.76 *fgkmm;
 const Double_t AliITSUv1Layer::fgkOBHalfStaveXOverlap =   4.3  *fgkmm;
 const Double_t AliITSUv1Layer::fgkOBGraphiteFoilThick =  30.0  *fgkmicron;
@@ -102,16 +103,22 @@ const Double_t AliITSUv1Layer::fgkOBCoolTubeInnerD    =   2.05 *fgkmm;
 const Double_t AliITSUv1Layer::fgkOBCoolTubeThick     =  32.0  *fgkmicron;
 const Double_t AliITSUv1Layer::fgkOBCoolTubeXDist     =  11.1  *fgkmm;
 
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameWidth   =  42.0  *fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameTotHigh =  43.1  *fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSFrameBeamRadius  =   0.6  *fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameLa      =   3.0  *fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameHa      =   0.721979*fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameLb      =   3.7  *fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameHb      =   0.890428*fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSpaceFrameL       =   0.25 *fgkmm;
-const Double_t AliITSUv1Layer::fgkOBSFBotBeamAngle    =  56.5;
-const Double_t AliITSUv1Layer::fgkOBSFrameBeamSidePhi =  65.0;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameZLen[2] = { 900.0*fgkmm,
+                                                        1526.0*fgkmm};
+const Int_t    AliITSUv1Layer::fgkOBSpaceFrameNUnits[2]= { 23, 39};
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameUnitLen =  39.1  *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameWidth   =  42.44 *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameHigh    =  36.45 *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameTopVL   =   4.0  *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameTopVH   =   0.35 *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameSideVL  =   4.5  *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameSideVH  =   0.35 *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameVAlpha  =  60.0; // deg
+const Double_t AliITSUv1Layer::fgkOBSpaceFrameVBeta   =  68.0; // deg
+const Double_t AliITSUv1Layer::fgkOBSFrameBaseRibDiam =   1.33 *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSFrameBaseRibPhi  =  54.0; // deg
+const Double_t AliITSUv1Layer::fgkOBSFrameSideRibDiam =   1.25 *fgkmm;
+const Double_t AliITSUv1Layer::fgkOBSFrameSideRibPhi  =  70.0; // deg
 
 
 ClassImp(AliITSUv1Layer)
@@ -454,6 +461,9 @@ TGeoVolume* AliITSUv1Layer::CreateStave(const TGeoManager * /*mgr*/){
 //
 // Created:      22 Jun 2011  Mario Sitta
 // Updated:      18 Dec 2013  Mario Sitta  Handle IB and OB
+// Updated:      12 Jan 2015  Mario Sitta  Fix overlap with new OB space frame
+//                            (by moving the latter, not the sensors to avoid
+//                             spoiling their position in space)
 //
 
   char volname[30];
@@ -515,16 +525,18 @@ TGeoVolume* AliITSUv1Layer::CreateStave(const TGeoManager * /*mgr*/){
     } else { // (if fStaveModel) Create new stave struct as in TDR
       xpos = ((TGeoBBox*)(hstaveVol->GetShape()))->GetDX()
           - fgkOBHalfStaveXOverlap/2;
-      // ypos is CF height as computed in CreateSpaceFrameOuterB1
-      ypos = (fgkOBSpaceFrameTotHigh - fgkOBHalfStaveYTrans)/2;
+      // ypos is now a parameter to avoid HS displacement wrt nominal radii
+      ypos = fgkOBHalfStaveYPos;
       staveVol->AddNode(hstaveVol, 0, new TGeoTranslation(-xpos, ypos, 0));
       staveVol->AddNode(hstaveVol, 1, new TGeoTranslation( xpos, ypos+fgkOBHalfStaveYTrans, 0));
       fHierarchy[kHalfStave] = 2; // RS 
       mechStaveVol = CreateSpaceFrameOuterB();
-      if (mechStaveVol)
+      if (mechStaveVol) {
+       ypos = ((TGeoBBox*)hstaveVol->GetShape())->GetDY();
        staveVol->AddNode(mechStaveVol, 1,
-                         new TGeoCombiTrans(0, 0, 0,
+                         new TGeoCombiTrans(0, -2*ypos, 0,
                                             new TGeoRotation("", 180, 0, 0)));
+      }
     } // if (fStaveModel)
   }
   
@@ -2874,209 +2886,221 @@ TGeoVolume* AliITSUv1Layer::CreateSpaceFrameOuterB1(const TGeoManager *mgr){
 // Updated:      15 Jan 2014  Mario Sitta
 // Updated:      18 Feb 2014  Mario Sitta
 // Updated:      12 Mar 2014  Mario Sitta
+// Updated:      15 Dec 2014  Mario Sitta
 //
 
 
-  // Materials defined in AliITSUv0
-  TGeoMedium *medCarbon       = mgr->GetMedium("ITS_CARBON$");
+  // Materials defined in AliITSUv1
+  TGeoMedium *medCarbon       = mgr->GetMedium("ITS_M55J6K$");
   TGeoMedium *medAir          = mgr->GetMedium("ITS_AIR$");
 
 
   // Local parameters
-  Double_t sframeWidth        = fgkOBSpaceFrameWidth;
-  Double_t sframeHeight       = fgkOBSpaceFrameTotHigh - fgkOBHalfStaveYTrans;
-  Double_t staveBeamRadius    = fgkOBSFrameBeamRadius;
-  Double_t staveLa            = fgkOBSpaceFrameLa;
-  Double_t staveHa            = fgkOBSpaceFrameHa;
-  Double_t staveLb            = fgkOBSpaceFrameLb;
-  Double_t staveHb            = fgkOBSpaceFrameHb;
-  Double_t stavel             = fgkOBSpaceFrameL;
-  Double_t bottomBeamAngle    = fgkOBSFBotBeamAngle;
-  Double_t triangleHeight     = sframeHeight - staveBeamRadius;
-  Double_t halfTheta          = TMath::ATan( 0.5*sframeWidth/triangleHeight );
-//  Double_t alpha              = TMath::Pi()*3./4. - halfTheta/2.;
-  Double_t beta               = (TMath::Pi() - 2.*halfTheta)/4.;
-//  Double_t distCenterSideDown = 0.5*sframeWidth/TMath::Cos(beta);
-
-  Double_t zlen;
+  Double_t halfFrameWidth  = fgkOBSpaceFrameWidth/2;
+  Double_t triangleHeight  = fgkOBSpaceFrameHigh;
+  Double_t sframeHeight    = triangleHeight + fgkOBSFrameBaseRibDiam;
+  Double_t staveLa         = fgkOBSpaceFrameTopVL;
+  Double_t staveHa         = fgkOBSpaceFrameTopVH;
+  Double_t staveLb         = fgkOBSpaceFrameSideVL;
+  Double_t staveHb         = fgkOBSpaceFrameSideVH;
+  Double_t alphaDeg        = fgkOBSpaceFrameVAlpha;
+  Double_t alphaRad        = alphaDeg*TMath::DegToRad()/2;
+  Double_t beta            = fgkOBSpaceFrameVBeta*TMath::DegToRad()/2;
+  Double_t sideRibRadius   = fgkOBSFrameSideRibDiam/2;
+  Double_t sidePhiDeg      = fgkOBSFrameSideRibPhi;
+  Double_t sidePhiRad      = sidePhiDeg*TMath::DegToRad();
+  Double_t baseRibRadius   = fgkOBSFrameBaseRibDiam/2;
+  Double_t basePhiDeg      = fgkOBSFrameBaseRibPhi;
+  Double_t basePhiRad      = basePhiDeg*TMath::DegToRad();
+
+  Double_t xlen, zlen;
   Double_t xpos, ypos, zpos;
-  Double_t seglen;
-  char volname[30];
-
-
-  zlen = fNModules*fgkOBModuleZLength + (fNModules-1)*fgkOBModuleGap;
+  Double_t unitlen;
 
-  snprintf(volname, 30, "%s%d", AliITSUGeomTGeo::GetITSHalfStavePattern(), fLayerNumber);
-  if (gGeoManager->GetVolume(volname)) { // Should always be so
-    sframeHeight -= ((TGeoBBox*)gGeoManager->GetVolume(volname)->GetShape())->GetDY()*2;
-    zlen = ((TGeoBBox*)gGeoManager->GetVolume(volname)->GetShape())->GetDZ()*2;
-  }
-  seglen = zlen/fNModules;
 
+  zlen = fgkOBSpaceFrameZLen[fLayerNumber/5]; // 3,4 -> 0 - 5,6 -> 1
+  unitlen = fgkOBSpaceFrameUnitLen;
 
-  // First create all needed shapes and volumes
+  xlen = halfFrameWidth + sideRibRadius;
 
-  TGeoBBox *spaceFrame = new TGeoBBox(sframeWidth/2,sframeHeight/2,zlen/2);
-  TGeoBBox *segment    = new TGeoBBox(sframeWidth/2,sframeHeight/2,seglen/2);
+  // The space frame container and a single unit
+  // We need two units because the base ribs are alternately oriented
+  // The end units are slightly different
+  TGeoBBox *spaceFrame = new TGeoBBox(xlen, sframeHeight/2, zlen/2);
+  TGeoBBox *frameUnit  = new TGeoBBox(xlen, sframeHeight/2, unitlen/2);
+  TGeoBBox *endUnit    = new TGeoBBox(xlen, sframeHeight/2, unitlen/2);
 
   TGeoVolume *spaceFrameVol = new TGeoVolume("CarbonFrameVolume",
                                             spaceFrame, medAir);
   spaceFrameVol->SetVisibility(kFALSE);
 
-  TGeoVolume *segmentVol    = new TGeoVolume("segmentVol", segment, medAir);
+  TGeoVolume *unitVol[2];
+  unitVol[0] = new TGeoVolume("SpaceFrameUnit0", frameUnit, medAir);
+  unitVol[1] = new TGeoVolume("SpaceFrameUnit1", frameUnit, medAir);
+
+  TGeoVolume *endVol  = new TGeoVolume("SpaceFrameEndUnit", endUnit, medAir);
 
-  //SpaceFrame
+  // The actual volumes
 
-  //--- the top V of the Carbon Fiber Stave (segment)
-  TGeoArb8 *cfStavTop1 = CreateStaveSide("CFstavTopCornerVol1shape", seglen/2., halfTheta, -1, staveLa, staveHa, stavel);
-  TGeoVolume *cfStavTopVol1 = new TGeoVolume("CFstavTopCornerVol1",
-                                            cfStavTop1, medCarbon);
-  cfStavTopVol1->SetLineColor(35);
+  //--- The top V of the Carbon Fiber Stave (segment)
+  TGeoXtru *cfStavTop = CreateStaveSide("CFstavTopCornerVolshape",
+                       unitlen/2., alphaRad, beta, staveLa, staveHa, kTRUE);
 
-  TGeoArb8 *cfStavTop2 = CreateStaveSide("CFstavTopCornerVol2shape", seglen/2., halfTheta,  1, staveLa, staveHa, stavel);
-  TGeoVolume *cfStavTopVol2 = new TGeoVolume("CFstavTopCornerVol2",
-                                            cfStavTop2, medCarbon );
-  cfStavTopVol2->SetLineColor(35);
+  TGeoVolume *cfStavTopVol = new TGeoVolume("CFstavTopCornerVol",
+                                           cfStavTop, medCarbon);
+  cfStavTopVol->SetLineColor(35);
 
-  TGeoTranslation *trTop1 = new TGeoTranslation(0, sframeHeight/2, 0);
+  unitVol[0]->AddNode(cfStavTopVol, 1,
+                     new TGeoTranslation(0, triangleHeight/2, 0));
+
+  unitVol[1]->AddNode(cfStavTopVol, 1,
+                     new TGeoTranslation(0, triangleHeight/2, 0));
+  
+  endVol->AddNode(cfStavTopVol, 1,
+                     new TGeoTranslation(0, triangleHeight/2, 0));
   
-  //--- the 2 side V
-  TGeoArb8 *cfStavSide1 = CreateStaveSide("CFstavSideCornerVol1shape", seglen/2., beta, -1, staveLb, staveHb, stavel);
-  TGeoVolume *cfStavSideVol1 = new TGeoVolume("CFstavSideCornerVol1",
-                                             cfStavSide1, medCarbon);
-  cfStavSideVol1->SetLineColor(35);
-
-  TGeoArb8 *cfStavSide2 = CreateStaveSide("CFstavSideCornerVol2shape", seglen/2., beta,  1, staveLb, staveHb, stavel);
-  TGeoVolume *cfStavSideVol2 = new TGeoVolume("CFstavSideCornerVol2",
-                                             cfStavSide2, medCarbon );
-  cfStavSideVol2->SetLineColor(35);
-
-  xpos = -sframeWidth/2;
-  ypos = -sframeHeight/2 + staveBeamRadius + staveHb*TMath::Sin(beta);
-  TGeoCombiTrans *ctSideR = new TGeoCombiTrans( xpos, ypos, 0,
-                                      new TGeoRotation("", 180-2*beta*TMath::RadToDeg(), 0, 0));
-  TGeoCombiTrans *ctSideL = new TGeoCombiTrans(-xpos, ypos, 0,
-                                      new TGeoRotation("",-180+2*beta*TMath::RadToDeg(), 0, 0));
-
-  segmentVol->AddNode(cfStavTopVol1,1,trTop1);
-  segmentVol->AddNode(cfStavTopVol2,1,trTop1);
-  segmentVol->AddNode(cfStavSideVol1,1,ctSideR);
-  segmentVol->AddNode(cfStavSideVol1,2,ctSideL);
-  segmentVol->AddNode(cfStavSideVol2,1,ctSideR);
-  segmentVol->AddNode(cfStavSideVol2,2,ctSideL);
+  //--- The two side V's
+  TGeoXtru *cfStavSide = CreateStaveSide("CFstavSideCornerVolshape",
+                        unitlen/2., alphaRad, beta, staveLb, staveHb, kFALSE);
+
+  TGeoVolume *cfStavSideVol = new TGeoVolume("CFstavSideCornerVol",
+                                            cfStavSide, medCarbon);
+  cfStavSideVol->SetLineColor(35);
+
+  unitVol[0]->AddNode(cfStavSideVol, 1,
+                  new TGeoTranslation( halfFrameWidth, -triangleHeight/2, 0));
+  unitVol[0]->AddNode(cfStavSideVol, 2,
+                  new TGeoCombiTrans( -halfFrameWidth, -triangleHeight/2, 0,
+                                        new TGeoRotation("",90,180,-90)));
+
+  unitVol[1]->AddNode(cfStavSideVol, 1,
+                  new TGeoTranslation( halfFrameWidth, -triangleHeight/2, 0));
+  unitVol[1]->AddNode(cfStavSideVol, 2,
+                  new TGeoCombiTrans( -halfFrameWidth, -triangleHeight/2, 0,
+                                        new TGeoRotation("",90,180,-90)));
+
+  endVol->AddNode(cfStavSideVol, 1,
+                  new TGeoTranslation( halfFrameWidth, -triangleHeight/2, 0));
+  endVol->AddNode(cfStavSideVol, 2,
+                  new TGeoCombiTrans( -halfFrameWidth, -triangleHeight/2, 0,
+                                        new TGeoRotation("",90,180,-90)));
 
 
   //--- The beams
-  // Beams on the sides
-  Double_t beamPhiPrime = TMath::ASin(1./TMath::Sqrt( (1+TMath::Sin(2*beta)*TMath::Sin(2*beta)/(TanD(fgkOBSFrameBeamSidePhi)*TanD(fgkOBSFrameBeamSidePhi))) ));
-  Double_t beamLength = TMath::Sqrt( sframeHeight*sframeHeight/( TMath::Sin(beamPhiPrime)*TMath::Sin(beamPhiPrime))+ sframeWidth*sframeWidth/4.)-staveLa/2-staveLb/2;
-  TGeoTubeSeg *sideBeam = new TGeoTubeSeg(0, staveBeamRadius,
-                                         beamLength/2, 0, 180);
-  TGeoVolume *sideBeamVol = new TGeoVolume("CFstavSideBeamVol",
-                                          sideBeam, medCarbon);
-  sideBeamVol->SetLineColor(35);
-
-  TGeoRotation *beamRot1 = new TGeoRotation("", /*90-2*beta*/halfTheta*TMath::RadToDeg(),
-                                   -beamPhiPrime*TMath::RadToDeg(), -90);
-  TGeoRotation *beamRot2 = new TGeoRotation("", 90-2.*beta*TMath::RadToDeg(),
-                                    beamPhiPrime*TMath::RadToDeg(), -90);
-  TGeoRotation *beamRot3 = new TGeoRotation("", 90+2.*beta*TMath::RadToDeg(),
-                                    beamPhiPrime*TMath::RadToDeg(), -90);
-  TGeoRotation *beamRot4 = new TGeoRotation("", 90+2.*beta*TMath::RadToDeg(),
-                                   -beamPhiPrime*TMath::RadToDeg(), -90);
-
-  TGeoCombiTrans *beamTransf[8];
-  xpos = 0.49*triangleHeight*TMath::Tan(halfTheta);//was 0.5, fix small overlap
-  ypos = staveBeamRadius/2;
-  zpos = seglen/8;
-  beamTransf[0] = new TGeoCombiTrans( xpos, ypos,-3*zpos, beamRot1);
-
-  beamTransf[1] = new TGeoCombiTrans( xpos, ypos,-3*zpos, beamRot1);
-  AddTranslationToCombiTrans(beamTransf[1], 0, 0, seglen/2);
-
-  beamTransf[2] = new TGeoCombiTrans( xpos, ypos,  -zpos, beamRot2);
-
-  beamTransf[3] = new TGeoCombiTrans( xpos, ypos,  -zpos, beamRot2);
-  AddTranslationToCombiTrans(beamTransf[3], 0, 0, seglen/2);
-
-  beamTransf[4] = new TGeoCombiTrans(-xpos, ypos,-3*zpos, beamRot3);
-
-  beamTransf[5] = new TGeoCombiTrans(-xpos, ypos,-3*zpos, beamRot3);
-  AddTranslationToCombiTrans(beamTransf[5], 0, 0, seglen/2);
-
-  beamTransf[6] = new TGeoCombiTrans(-xpos, ypos,  -zpos, beamRot4);
-  beamTransf[7] = new TGeoCombiTrans(-xpos, ypos, 3*zpos, beamRot4);
-
-  //--- Beams of the bottom
-  TGeoTubeSeg *bottomBeam1 = new TGeoTubeSeg(0, staveBeamRadius,
-                                            sframeWidth/2.-staveLb/3, 0, 180);
-  TGeoVolume *bottomBeam1Vol = new TGeoVolume("CFstavBottomBeam1Vol",
-                                             bottomBeam1, medCarbon);
-  bottomBeam1Vol->SetLineColor(35);
-
-  TGeoTubeSeg *bottomBeam2 = new TGeoTubeSeg(0, staveBeamRadius,
-                                            sframeWidth/2.-staveLb/3, 0, 90);
-  TGeoVolume *bottomBeam2Vol = new TGeoVolume("CFstavBottomBeam2Vol",
-                                             bottomBeam2, medCarbon);
-  bottomBeam2Vol->SetLineColor(35);
-
-  TGeoTubeSeg *bottomBeam3 = new TGeoTubeSeg(0, staveBeamRadius,
-                            0.5*sframeWidth/SinD(bottomBeamAngle) - staveLb/3,
-                                            0, 180);
-  TGeoVolume *bottomBeam3Vol = new TGeoVolume("CFstavBottomBeam3Vol",
-                                             bottomBeam3, medCarbon);
-  bottomBeam3Vol->SetLineColor(35);
-
-  TGeoRotation *bottomBeamRot1 = new TGeoRotation("", 90, 90,  90);
-  TGeoRotation *bottomBeamRot2 = new TGeoRotation("",-90, 90, -90);
-
-  TGeoCombiTrans *bottomBeamTransf1 = new TGeoCombiTrans("",0,
-                                        -(sframeHeight/2-staveBeamRadius), 0,
-                                                        bottomBeamRot1);
-  TGeoCombiTrans *bottomBeamTransf2 = new TGeoCombiTrans(0,
-                                        -(sframeHeight/2-staveBeamRadius),
-                                                        -seglen/2,
-                                                        bottomBeamRot1);
-  TGeoCombiTrans *bottomBeamTransf3 = new TGeoCombiTrans(0,
-                                        -(sframeHeight/2-staveBeamRadius),
-                                                        seglen/2,
-                                                        bottomBeamRot2);
-  // be careful for beams #3: when "reading" from -z to +z and 
-  // from the bottom of the stave, it should draw a Lambda, and not a V
-  TGeoRotation *bottomBeamRot4 = new TGeoRotation("",-90, bottomBeamAngle,-90);
-  TGeoRotation *bottomBeamRot5 = new TGeoRotation("",-90,-bottomBeamAngle,-90);
-
-  TGeoCombiTrans *bottomBeamTransf4 = new TGeoCombiTrans(0,
-                                        -(sframeHeight/2-staveBeamRadius),
-                                                        -seglen/4,
-                                                        bottomBeamRot4);
-  TGeoCombiTrans *bottomBeamTransf5 = new TGeoCombiTrans(0,
-                                        -(sframeHeight/2-staveBeamRadius),
-                                                        seglen/4,
-                                                        bottomBeamRot5);
-
-
-  segmentVol->AddNode(sideBeamVol,1, beamTransf[0]);
-  segmentVol->AddNode(sideBeamVol,2, beamTransf[1]);
-  segmentVol->AddNode(sideBeamVol,3, beamTransf[2]);
-  segmentVol->AddNode(sideBeamVol,4, beamTransf[3]);
-  segmentVol->AddNode(sideBeamVol,5, beamTransf[4]);
-  segmentVol->AddNode(sideBeamVol,6, beamTransf[5]);
-  segmentVol->AddNode(sideBeamVol,7, beamTransf[6]);
-  segmentVol->AddNode(sideBeamVol,8, beamTransf[7]);
-  segmentVol->AddNode(bottomBeam1Vol,1,bottomBeamTransf1);
-  segmentVol->AddNode(bottomBeam2Vol,1,bottomBeamTransf2);
-  segmentVol->AddNode(bottomBeam2Vol,2,bottomBeamTransf3);
-  segmentVol->AddNode(bottomBeam3Vol,1,bottomBeamTransf4);
-  segmentVol->AddNode(bottomBeam3Vol,2,bottomBeamTransf5);
-
-
-  // Then build up the space frame
-  for(Int_t i=0; i<fNModules; i++){
-    zpos = -spaceFrame->GetDZ() + (1 + 2*i)*segment->GetDZ();
-    spaceFrameVol->AddNode(segmentVol, i, new TGeoTranslation(0, 0, zpos));
+  // Ribs on the sides
+  Double_t ribZProj = triangleHeight/TMath::Tan(sidePhiRad);
+  Double_t sideRibLen = TMath::Sqrt( ribZProj*ribZProj             +
+                                    triangleHeight*triangleHeight +
+                                    halfFrameWidth*halfFrameWidth );
+
+  TGeoTubeSeg *sideRib = new TGeoTubeSeg(0, sideRibRadius,
+                                        sideRibLen/2, 0, 180);
+  TGeoVolume *sideRibVol = new TGeoVolume("CFstavSideBeamVol",
+                                         sideRib, medCarbon);
+  sideRibVol->SetLineColor(35);
+
+  TGeoCombiTrans *sideTransf[4];
+  xpos = halfFrameWidth/2 + 0.8*staveHa*TMath::Cos(alphaRad/2);
+  ypos = -sideRibRadius/2;
+  zpos = unitlen/4;
+
+  sideTransf[0] = new TGeoCombiTrans( xpos, ypos,-zpos,
+                                     new TGeoRotation("", 90-alphaDeg,
+                                                      -sidePhiDeg, -90));
+  sideTransf[1] = new TGeoCombiTrans( xpos, ypos, zpos,
+                                     new TGeoRotation("", 90-alphaDeg,
+                                                       sidePhiDeg, -90));
+  sideTransf[2] = new TGeoCombiTrans(-xpos, ypos,-zpos,
+                                     new TGeoRotation("", 90+alphaDeg,
+                                                       sidePhiDeg, -90));
+  sideTransf[3] = new TGeoCombiTrans(-xpos, ypos, zpos,
+                                     new TGeoRotation("", 90+alphaDeg,
+                                                      -sidePhiDeg, -90));
+
+  unitVol[0]->AddNode(sideRibVol, 1, sideTransf[0]);
+  unitVol[0]->AddNode(sideRibVol, 2, sideTransf[1]);
+  unitVol[0]->AddNode(sideRibVol, 3, sideTransf[2]);
+  unitVol[0]->AddNode(sideRibVol, 4, sideTransf[3]);
+
+  unitVol[1]->AddNode(sideRibVol, 1, sideTransf[0]);
+  unitVol[1]->AddNode(sideRibVol, 2, sideTransf[1]);
+  unitVol[1]->AddNode(sideRibVol, 3, sideTransf[2]);
+  unitVol[1]->AddNode(sideRibVol, 4, sideTransf[3]);
+
+  endVol->AddNode(sideRibVol, 1, sideTransf[0]);
+  endVol->AddNode(sideRibVol, 2, sideTransf[1]);
+  endVol->AddNode(sideRibVol, 3, sideTransf[2]);
+  endVol->AddNode(sideRibVol, 4, sideTransf[3]);
+
+
+  // Ribs on the bottom
+  // Rib1 are the inclined ones, Rib2 the straight ones
+  Double_t baseRibLen = 0.98*2*halfFrameWidth/TMath::Sin(basePhiRad);
+
+  TGeoTubeSeg *baseRib1 = new TGeoTubeSeg(0, baseRibRadius,
+                                         baseRibLen/2, 0, 180);
+  TGeoVolume *baseRib1Vol = new TGeoVolume("CFstavBaseBeam1Vol",
+                                          baseRib1, medCarbon);
+  baseRib1Vol->SetLineColor(35);
+
+  TGeoTubeSeg *baseRib2 = new TGeoTubeSeg(0, baseRibRadius,
+                                         halfFrameWidth, 0, 90);
+  TGeoVolume *baseRib2Vol = new TGeoVolume("CFstavBaseBeam2Vol",
+                                          baseRib2, medCarbon);
+  baseRib2Vol->SetLineColor(35);
+
+  TGeoTubeSeg *baseEndRib = new TGeoTubeSeg(0, baseRibRadius,
+                                           halfFrameWidth, 0, 180);
+  TGeoVolume *baseEndRibVol = new TGeoVolume("CFstavBaseEndBeamVol",
+                                            baseEndRib, medCarbon);
+  baseEndRibVol->SetLineColor(35);
+
+  TGeoCombiTrans *baseTransf[5];
+  ypos = sframeHeight/2 - baseRibRadius;
+  zpos = unitlen/2;
+
+  baseTransf[0] = new TGeoCombiTrans("", 0, -ypos, -zpos,
+                                    new TGeoRotation("", 90, 90,  90));
+  baseTransf[1] = new TGeoCombiTrans("", 0, -ypos,  zpos,
+                                    new TGeoRotation("",-90, 90, -90));
+  baseTransf[2] = new TGeoCombiTrans(0, -ypos, 0,
+                                    new TGeoRotation("",-90, basePhiDeg,-90));
+  baseTransf[3] = new TGeoCombiTrans(0, -ypos, 0,
+                                    new TGeoRotation("",-90,-basePhiDeg,-90));
+  zpos -= baseEndRib->GetRmax();
+  baseTransf[4] = new TGeoCombiTrans("", 0, -ypos, -zpos,
+                                    new TGeoRotation("", 90, 90,  90));
+
+  unitVol[0]->AddNode(baseRib2Vol, 1, baseTransf[0]);
+  unitVol[0]->AddNode(baseRib2Vol, 2, baseTransf[1]);
+  unitVol[0]->AddNode(baseRib1Vol, 1, baseTransf[2]);
+
+  unitVol[1]->AddNode(baseRib2Vol, 1, baseTransf[0]);
+  unitVol[1]->AddNode(baseRib2Vol, 2, baseTransf[1]);
+  unitVol[1]->AddNode(baseRib1Vol, 1, baseTransf[3]);
+
+  endVol->AddNode(baseEndRibVol, 1, baseTransf[4]);
+  endVol->AddNode(baseRib2Vol,   1, baseTransf[1]);
+  endVol->AddNode(baseRib1Vol,   1, baseTransf[2]);
+
+
+  // Finally build up the space frame
+  Int_t nUnits = fgkOBSpaceFrameNUnits[fLayerNumber/5]; // 3,4 -> 0 - 5,6 -> 1
+
+  zpos = -spaceFrame->GetDZ() + endUnit->GetDZ();
+  spaceFrameVol->AddNode(endVol, 1, new TGeoTranslation(0, 0, zpos));
+
+  for(Int_t i=1; i<nUnits-1; i++){
+    zpos = -spaceFrame->GetDZ() + (1 + 2*i)*frameUnit->GetDZ();
+    Int_t j = i/2;
+    Int_t k = i - j*2;  // alternatively 0 or 1
+    spaceFrameVol->AddNode(unitVol[k], j+1, new TGeoTranslation(0, 0, zpos));
   }
 
+  zpos = -spaceFrame->GetDZ() + (2*nUnits - 1)*endUnit->GetDZ();
+  spaceFrameVol->AddNode(endVol, 2, new TGeoCombiTrans(0, 0, zpos,
+                                          new TGeoRotation("", 90,180,-90)));
+
 
   // Done, return the space frame structure
   return spaceFrameVol;
@@ -3377,38 +3401,63 @@ void AliITSUv1Layer::SetStaveWidth(const Double_t w){
 }
 
 //________________________________________________________________________
-TGeoArb8 *AliITSUv1Layer::CreateStaveSide(const char *name,
-                         Double_t dz, Double_t angle, Double_t xSign,
-                         Double_t L, Double_t H, Double_t l) {
+TGeoXtru *AliITSUv1Layer::CreateStaveSide(const char *name,
+                         Double_t dz, Double_t alpha, Double_t beta,
+                         Double_t L, Double_t H, Bool_t top) {
 //
 // Creates the V-shaped sides of the OB space frame
 // (from a similar method with same name and function
 // in AliITSv11GeometrySDD class by L.Gaudichet)
 //
+// Updated:      15 Dec 2014  Mario Sitta  Rewritten using Xtru
+// Updated:      09 Jan 2015  Mario Sitta  Rewritten again using different
+//                                         aperture angles (info by C.Gargiulo)
+//
+
+    // Create the V shape corner of CF stave
 
-    // Create one half of the V shape corner of CF stave
+    const Int_t nv = 6;
+    Double_t xv[nv], yv[nv];
   
-    TGeoArb8 *cfStavSide = new TGeoArb8(dz);
+    TGeoXtru *cfStavSide = new TGeoXtru(2);
     cfStavSide->SetName(name);
 
+    Double_t theta = TMath::PiOver2() - beta;
+    Double_t gamma = beta - alpha;
     // Points must be in clockwise order
-    cfStavSide->SetVertex(0, 0,  0);
-    cfStavSide->SetVertex(2, xSign*(L*TMath::Sin(angle)-l*TMath::Cos(angle)),
-                         -L*TMath::Cos(angle)-l*TMath::Sin(angle));
-    cfStavSide->SetVertex(4, 0,  0);
-    cfStavSide->SetVertex(6, xSign*(L*TMath::Sin(angle)-l*TMath::Cos(angle)),
-                         -L*TMath::Cos(angle)-l*TMath::Sin(angle));
-    if (xSign < 0) {
-     cfStavSide->SetVertex(1, 0, -H);
-     cfStavSide->SetVertex(3, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
-     cfStavSide->SetVertex(5, 0, -H);
-     cfStavSide->SetVertex(7, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
-    } else {
-     cfStavSide->SetVertex(1, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
-     cfStavSide->SetVertex(3, 0, -H);
-     cfStavSide->SetVertex(5, xSign*L*TMath::Sin(angle), -L*TMath::Cos(angle));
-     cfStavSide->SetVertex(7, 0, -H);
+    if (top) { // TOP - vertices not in order
+      xv[3] = 0;
+      yv[3] = 0;
+      xv[2] =  L*TMath::Sin(alpha);
+      yv[2] = -L*TMath::Cos(alpha);
+      xv[1] = xv[2] - H*TMath::Cos(alpha);
+      yv[1] = yv[2] - H*TMath::Sin(alpha);
+      xv[0] = 0;
+      yv[0] = yv[1] + TMath::Tan(theta)*xv[1];
+      xv[4] = -xv[2];  // Reflect
+      yv[4] =  yv[2];
+      xv[5] = -xv[1];
+      yv[5] =  yv[1];
+    } else { // SIDE
+      Double_t m = -TMath::Tan(alpha), n = TMath::Tan(gamma);
+      xv[0] = 0;
+      yv[0] = 0;
+      xv[1] = -L*TMath::Cos(2*alpha);
+      yv[1] =  L*TMath::Sin(2*alpha);
+      xv[2] = xv[1] - H*TMath::Sin(2*alpha);
+      yv[2] = yv[1] - H*TMath::Cos(2*alpha);
+      xv[4] = -L;
+      yv[4] =  H;
+      xv[5] = xv[4];
+      yv[5] = 0;
+      xv[3] = (yv[4] - n*xv[4])/(m - n);
+      yv[3] = m*xv[3];
     }
+
+    cfStavSide->DefinePolygon(nv, xv, yv);
+    cfStavSide->DefineSection(0,-dz);
+    cfStavSide->DefineSection(1, dz);
+
     return cfStavSide;
 }
 
index 630dcd34e7c4c32a6726970acf2eb8baede741c1..06b3ea320572ed8e04d57646ceda4153322eb4df 100644 (file)
@@ -101,9 +101,9 @@ class AliITSUv1Layer : public AliITSv11Geometry {
     TGeoVolume* CreateSpaceFrameOuterBDummy(const TGeoManager *mgr=gGeoManager) const;
     TGeoVolume* CreateSpaceFrameOuterB1(const TGeoManager *mgr=gGeoManager);
 
-    TGeoArb8* CreateStaveSide(const char *name,
-                              Double_t dz, Double_t angle, Double_t xSign,
-                              Double_t L, Double_t H, Double_t l);
+    TGeoXtru* CreateStaveSide(const char *name,
+                              Double_t dz, Double_t alpha, Double_t beta,
+                              Double_t L, Double_t H, Bool_t top);
     TGeoCombiTrans* CreateCombiTrans( const char *name,
                                      Double_t dy, Double_t dz, Double_t dphi,
                                      Bool_t planeSym=kFALSE);
@@ -182,6 +182,7 @@ class AliITSUv1Layer : public AliITSv11Geometry {
     static const Double_t fgkOBGlueThickM1;      // OB Glue total Thickness
     static const Double_t fgkOBGlueThick;        // OB Glue Thickness in Model2
     static const Double_t fgkOBModuleZLength;    // OB Chip Length along Z
+    static const Double_t fgkOBHalfStaveYPos;    // OB half staves Y position
     static const Double_t fgkOBHalfStaveYTrans;  // OB half staves Y transl.
     static const Double_t fgkOBHalfStaveXOverlap;// OB half staves X overlap
     static const Double_t fgkOBGraphiteFoilThick;// OB graphite foil thickness
@@ -191,16 +192,21 @@ class AliITSUv1Layer : public AliITSv11Geometry {
     static const Double_t fgkOBCoolTubeThick;    // OB cooling tube thickness
     static const Double_t fgkOBCoolTubeXDist;    // OB cooling tube separation
 
+    static const Double_t fgkOBSpaceFrameZLen[2];// OB Space Frame Length
+    static const Int_t    fgkOBSpaceFrameNUnits[2];//OB Number of SF Units
+    static const Double_t fgkOBSpaceFrameUnitLen;// OB Space Frame Unit length
     static const Double_t fgkOBSpaceFrameWidth;  // OB Space Frame Width
-    static const Double_t fgkOBSpaceFrameTotHigh;// OB Total Y Height
-    static const Double_t fgkOBSFrameBeamRadius; // OB Space Frame Beam Radius
-    static const Double_t fgkOBSpaceFrameLa;     // Parameters defining...
-    static const Double_t fgkOBSpaceFrameHa;     // ...the V side shape...
-    static const Double_t fgkOBSpaceFrameLb;     // ...of the carbon...
-    static const Double_t fgkOBSpaceFrameHb;     // ...OB Space Frame
-    static const Double_t fgkOBSpaceFrameL;      // OB SF
-    static const Double_t fgkOBSFBotBeamAngle;   // OB SF bottom beam angle
-    static const Double_t fgkOBSFrameBeamSidePhi;// OB SF side beam angle
+    static const Double_t fgkOBSpaceFrameHigh;   // OB Space Frame Height
+    static const Double_t fgkOBSpaceFrameTopVL;  // Parameters defining...
+    static const Double_t fgkOBSpaceFrameTopVH;  // ...the Top V shape
+    static const Double_t fgkOBSpaceFrameSideVL; // Parameters defining...
+    static const Double_t fgkOBSpaceFrameSideVH; // ...the Side V shape
+    static const Double_t fgkOBSpaceFrameVAlpha; // Angles of aperture...
+    static const Double_t fgkOBSpaceFrameVBeta;  // ...of the V shapes
+    static const Double_t fgkOBSFrameBaseRibDiam;// OB SFrame Base Rib Diam
+    static const Double_t fgkOBSFrameBaseRibPhi; // OB SF base beam angle
+    static const Double_t fgkOBSFrameSideRibDiam;// OB SFrame Side Rib Diam
+    static const Double_t fgkOBSFrameSideRibPhi; // OB SF side beam angle
 
 
   ClassDef(AliITSUv1Layer,0) // ITS Upgrade v1 geometry
index 6c672bcbbbc0298d78f8c296629a2f412ef4465c..d863b53cd15971a805bce11de48e6474baacef08 100644 (file)
@@ -82,8 +82,8 @@ void CreateITSUv1()
   //
   const int kNWrapVol = 3;
   const double wrpRMin[kNWrapVol]  = { 2.1, 15.0, 32.0};
-  const double wrpRMax[kNWrapVol]  = { 7.0, 27.0+2.5, 43.0+1.5};
-  const double wrpZSpan[kNWrapVol] = {28.0, 86.0, 150.0};
+  const double wrpRMax[kNWrapVol]  = { 7.0, 27.0+2.5, 43.0+1.9};
+  const double wrpZSpan[kNWrapVol] = {28.0, 90.1, 152.7};
   //
   ITS->SetNWrapVolumes(kNWrapVol); // define wrapper volumes for layers
   for (int iw=0;iw<kNWrapVol;iw++) ITS->DefineWrapVolume(iw,wrpRMin[iw],wrpRMax[iw],wrpZSpan[iw]);
index 8fa3f4cf23b2259642dd56900c639ec4c77e833b..f1d746999cfb44a6d85250cf8a4e0c7defb779fe 100644 (file)
@@ -21,8 +21,8 @@ double radii2Phi(double rMin,double rMid,double rMax, double sensW)
 void CreateITSUv1()
 {
   //
-  gSystem->Load("libITSUpgradeBase.so");
-  gSystem->Load("libITSUpgradeSim.so");
+  gSystem->Load("libITSUpgradeBase");
+  gSystem->Load("libITSUpgradeSim");
   //
   // build ITS upgrade detector
   // sensitive area 13x15mm (X,Z) with 20x20 micron pitch, 2mm dead zone on readout side and 50 micron guardring
@@ -82,8 +82,8 @@ void CreateITSUv1()
   //
   const int kNWrapVol = 3;
   const double wrpRMin[kNWrapVol]  = { 2.1, 15.0, 32.0};
-  const double wrpRMax[kNWrapVol]  = { 7.0, 27.0+2.5, 43.0+1.5};
-  const double wrpZSpan[kNWrapVol] = {28.0, 86.0, 150.0};
+  const double wrpRMax[kNWrapVol]  = { 7.0, 27.0+2.5, 43.0+1.8};
+  const double wrpZSpan[kNWrapVol] = {28.0, 90.1, 152.7};
   //
   ITS->SetNWrapVolumes(kNWrapVol); // define wrapper volumes for layers
   for (int iw=0;iw<kNWrapVol;iw++) ITS->DefineWrapVolume(iw,wrpRMin[iw],wrpRMax[iw],wrpZSpan[iw]);
index fe6a777e8324305e7928875607873ee09ab8eee6..45e78172d582f9b5fc182ff95d46c3dc769d8dfa 100644 (file)
@@ -39,7 +39,7 @@
 */
 
 // Original version
-// Chinorat Kobdaj (kobdaj@g.sut.ac.th)
+// Chinorat Kobdaj <kobdaj@g.sut.ac.th> , Stefan Rossegger
 // Revised and adapted to newer AliITSUv1 versions
 // Mario Sitta <sitta@to.infn.it> - Nov 2014
 
index dad00e9f8af2abb29cfb1e1e2482ecad16ba53e8..d9a24d3dff53d8240ad65bd8d8a40b382fee985a 100755 (executable)
@@ -24,7 +24,7 @@ SEED=1234567 # random number generator seed
 SIMDIR="generated" # sub-directory where to move simulated files prior to reco
 DUMPEVENT=5 # event to be dump on files (set to negative to skip dumps)
 
-SIMCONFIG="$ALICE_ROOT/MUON/"$MC"Config.C"
+SIMCONFIG="$ALICE_ROOT/../src/MUON/"$MC"Config.C"
 EMBEDWITH="" # no embedding by default
 REALISTIC=0 # ideal simulation by default
 
@@ -122,13 +122,13 @@ fi
 
 # Copy *ALL* the macros we need in the output directory, not to mess
 # with our source dir in any way.
-cp $ALICE_ROOT/MUON/.rootrc \
-  $ALICE_ROOT/MUON/rootlogon.C \
-  $ALICE_ROOT/MUON/runReconstruction.C $ALICE_ROOT/MUON/runSimulation.C \
-  $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C \
-  $ALICE_ROOT/MUON/MUONefficiency.C \
-  $ALICE_ROOT/MUON/MUONTriggerEfficiency.C \
-  $ALICE_ROOT/MUON/MUONCheck.C \
+cp $ALICE_ROOT/../src/MUON/.rootrc \
+  $ALICE_ROOT/../src/MUON/rootlogon.C \
+  $ALICE_ROOT/../src/MUON/runReconstruction.C $ALICE_ROOT/../src/MUON/runSimulation.C \
+  $ALICE_ROOT/../src/MUON/UpdateCDBCTPConfig.C \
+  $ALICE_ROOT/../src/MUON/MUONefficiency.C \
+  $ALICE_ROOT/../src/MUON/MUONTriggerEfficiency.C \
+  $ALICE_ROOT/../src/MUON/MUONCheck.C \
   $OUTDIR
 
 cd $OUTDIR
@@ -155,7 +155,7 @@ fi
 #
 ###############################################################################
 
-if [ ! -f $ALICE_ROOT/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
+if [ ! -f $ALICE_ROOT/../src/OCDB/GRP/CTP/Config/Run0_999999999_v0_s1.root ]; then
 
   echo "Updating GRP CTP config  ..."
 
@@ -197,14 +197,14 @@ if [ "$SIMULATION" -eq 1 ]; then
 
   # save geometry file in a separate directory
   if [ "$MC" = "g3" ]; then
-    rm -fr $ALICE_ROOT/MUON/geometry
-    mkdir $ALICE_ROOT/MUON/geometry
-    cp $OUTDIR/geometry.root $ALICE_ROOT/MUON/geometry
+    rm -fr $ALICE_ROOT/../src/MUON/geometry
+    mkdir $ALICE_ROOT/../src/MUON/geometry
+    cp $OUTDIR/geometry.root $ALICE_ROOT/../src/MUON/geometry
   fi 
 
   # copy input geometry file in a current directory
   if [ "$MC" = "g4" ]; then
-    cp $ALICE_ROOT/MUON/geometry/geometry.root $OUTDIR
+    cp $ALICE_ROOT/../src/MUON/geometry/geometry.root $OUTDIR
   fi 
   
   cp $OUTDIR/geometry.root $OUTDIR/$SIMDIR/geometry.root
@@ -305,7 +305,7 @@ if [ "$DUMPEVENT" -ge 0 ]; then
   if [ -f "$OUTDIR/$SIMDIR/galice.root" ]; then
     aliroot -l -b  << EOF
     AliCDBManager* man = AliCDBManager::Instance();    
-    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+    man->SetDefaultStorage("local://$ALICE_ROOT/../src/OCDB");
     AliMUONMCDataInterface mcdSim("$OUTDIR/$SIMDIR/galice.root");
     mcdSim.DumpKine($DUMPEVENT);       > $OUTDIR/dump.$DUMPEVENT.kine
     mcdSim.DumpHits($DUMPEVENT);       > $OUTDIR/dump.$DUMPEVENT.hits
@@ -321,7 +321,7 @@ EOF
   if [ -f "$OUTDIR/galice.root" ]; then
     aliroot -l -b << EOF
     AliCDBManager* man = AliCDBManager::Instance();
-    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+    man->SetDefaultStorage("local://$ALICE_ROOT/../src/OCDB");
     AliMUONDataInterface dRec("$OUTDIR/galice.root");
     dRec.DumpDigits($DUMPEVENT,true); > $OUTDIR/dump.$DUMPEVENT.recdigits
     dRec.DumpRecPoints($DUMPEVENT);  > $OUTDIR/dump.$DUMPEVENT.recpoints
index 8e272510fc9f91da17576e980100559af9acb138..a9ebf9e7bb047b45b9e49913d59bd14c5d73c655 100644 (file)
@@ -2175,9 +2175,6 @@ AliMUONTrackerData::Value(const AliMUONVCalibParam& param, Int_t i,
       return 0.0;
     }
   }
-  
-  AliError("Why am I here ?");
-  return 0.0;
 }
 
 //_____________________________________________________________________________
index f27137dbe662e7a23b99eaa55760dfe10f3f2726..c0a5c6f643bcfbf6e1533ec8b76ca7f818cb63ba 100644 (file)
@@ -51,6 +51,12 @@ set(SRCS
 
 # Headers from sources
 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
+set(HDRS ${HDRS}
+    AliMUONTrackerDDLDecoder.h
+    AliMUONTrackerDDLDecoderEventHandler.h
+    AliMUONTriggerDDLDecoder.h
+    AliMUONTriggerDDLDecoderEventHandler.h
+   )
 
 # Generate the dictionary
 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
index 5566d951350df9f53f03c69502e47c778545c972..295b1e30369d7f48df7749a4c9ab4198dc3ed447 100644 (file)
@@ -621,7 +621,7 @@ void AliMUONLocalTriggerBoard::TrigX(Int_t ch1q[16], Int_t ch2q[16], Int_t ch3q[
       printf("===============================================================\n");
       for (i=30; i>=0; i--) {
          printf("%i \t",i);
-         for (istrip=31; istrip>=0; istrip--) printf("%i",rearImage[i][istrip]);
+         for (istrip=30; istrip>=0; istrip--) printf("%i",rearImage[i][istrip]);
          printf("\n");   
       }
    }
diff --git a/MUON/loadlibs.C b/MUON/loadlibs.C
deleted file mode 100644 (file)
index a19f053..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * 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   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/* $Id$ */
-
-/// \ingroup macros
-/// \file loadlibs.C
-/// \brief Macro which loads the libraries needed for simulation and reconstruction
-/// with MUON configuration macros
-///
-/// \author Christian Finck
-///
-/// New libraries list by Laurent Aphecetche
-
-void loadlibs () 
-{
-  gSystem->Load("libVMC");
-  gSystem->Load("libMinuit");
-  gSystem->Load("libTree");
-  gSystem->Load("libProofPlayer");
-  gSystem->Load("libXMLParser");
-  gSystem->Load("libPhysics");
-
-  gSystem->Load("libSTEERBase"); 
-  gSystem->Load("libESD");
-  gSystem->Load("libAOD");
-  
-  gSystem->Load("libRAWDatabase");
-  gSystem->Load("libRAWDatarec");
-  gSystem->Load("libCDB");
-  gSystem->Load("libANALYSIS");
-  gSystem->Load("libSTEER");
-  gSystem->Load("libANALYSISalice");
-  
-  gSystem->Load("libMUONcore");
-  gSystem->Load("libMUONmapping");
-  gSystem->Load("libMUONcalib");
-  gSystem->Load("libMUONgeometry");
-  gSystem->Load("libMUONtrigger");
-  
-  gSystem->Load("libRAWDatabase");
-  gSystem->Load("libMUONraw");
-    
-  gSystem->Load("libMUONbase");
-
-  gSystem->Load("libMUONshuttle");
-
-  gSystem->Load("libMUONrec");
-  
-  gSystem->Load("libRAWDatasim");
-  gSystem->Load("libMUONsim");
-  
-  gSystem->Load("libMUONevaluation");
-  gSystem->Load("libMUONcalign");
-  
-  gSystem->Load("libMUONgraphics");
-
-  gSystem->Load("libEVGEN");
-  gSystem->Load("libgeant321");
-  gSystem->Load("libhijing");
-  gSystem->Load("libFASTSIM");
-  gSystem->Load("libTHijing");
-  gSystem->Load("libpythia6");
-  gSystem->Load("libEGPythia6");
-  gSystem->Load("libAliPythia6");
-  
-}
index 2a103906d6482769bd8c09c2785907555d232a53..9a837957bf96f0a89f458e22a3491c5cd16123fd 100644 (file)
 /// \author Laurent Aphecetche
 
 {
-  cout << "Loading MUON libraries ..." << endl;
-  gROOT->LoadMacro("${ALICE_ROOT}/MUON/loadlibs.C");
-  gInterpreter->ProcessLine("loadlibs()");
-    
-  cout << "Setting include path ..." << endl;
-  TString includePath = "-I${ALICE_ROOT}/STEER ";
-  includePath        += "-I${ALICE_ROOT}/STEER/STEER ";
-  includePath        += "-I${ALICE_ROOT}/STEER/STEERBase ";
-  includePath        += "-I${ALICE_ROOT}/STEER/CDB ";
-  includePath        += "-I${ALICE_ROOT}/STEER/ESD ";
-  includePath        += "-I${ALICE_ROOT}/RAW ";
-  includePath        += "-I${ALICE_ROOT}/FASTSIM ";
-  includePath        += "-I${ALICE_ROOT}/EVGEN ";
-  includePath        += "-I${ALICE_ROOT}/SHUTTLE/TestShuttle ";
-  includePath        += "-I${ALICE_ROOT}/ITS ";
-  includePath        += "-I${ALICE_ROOT}/MUON ";
-  includePath        += "-I${ALICE_ROOT}/MUON/mapping ";
-  includePath        += "-I${ALICE_ROOT}/RAW ";
-  includePath        += "-I${ALICE_ROOT}/include ";
-  
-  if ( gSystem->Getenv("ALICE_INSTALL") ) includePath += "-I${ALICE_INSTALL}/include ";
-  if ( gSystem->Getenv("ALICE_BUILD") ) includePath += "-I${ALICE_BUILD}/include ";
-
-  gSystem->SetIncludePath(includePath.Data());
+  gSystem->SetIncludePath("-I${ALICE_ROOT}/include");
 }
index 34d326ceafa662247a45b4fdacddc2404e91d5cc..874dd89a110df0145624fd4468ecda404bc43350 100644 (file)
@@ -36,9 +36,9 @@ ClassImp(AliPHOSCPVGeometry)
 AliPHOSCPVGeometry::AliPHOSCPVGeometry()
   : fNumberOfCPVLayers(1),
     fNumberOfCPVPadsPhi(128),
-    fNumberOfCPVPadsZ(56),
+    fNumberOfCPVPadsZ(60),
     fCPVPadSizePhi(1.13),
-    fCPVPadSizeZ(2.26),
+    fCPVPadSizeZ(2.1093),
     fNumberOfCPVChipsPhi(8),
     fNumberOfCPVChipsZ(8),
     fCPVGasThickness(1.3),
index 840ffd05454774e42831d4c4172e7c48c6b2a4ed..b2ca2a5d4804fed40b28d0fbaee7ff7fac16d32b 100644 (file)
@@ -255,10 +255,12 @@ void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option)
 
   MakeClusters() ;
     
-  AliDebug(2,Form(" ---- Printing clusters (%d)\n",
-                 fEMCRecPoints->GetEntries()));
-  if(AliLog::GetGlobalDebugLevel()>1)
+  AliDebug(2,Form("Number of EMC clusters: %d, CPV clusters: %d\n",
+                 fEMCRecPoints->GetEntriesFast(), fCPVRecPoints->GetEntriesFast()));
+  if(AliLog::GetGlobalDebugLevel()>1) {
     fEMCRecPoints->Print();
+    fCPVRecPoints->Print();
+  }
 
   if(fToUnfold)             
     MakeUnfolding();
@@ -595,6 +597,7 @@ void AliPHOSClusterizerv1::MakeClusters()
     Int_t index ;
 
     //is this digit so energetic that start cluster?
+    AliDebug(2,Form("Digit %d, energy=%f, ID=%d",i,digit->GetEnergy(),digit->GetId()));
     if (( IsInEmc(digit) &&  Calibrate(digit->GetEnergy(),digit->GetId()) > fEmcClusteringThreshold ) || 
         ( IsInCpv(digit) &&  Calibrate(digit->GetEnergy(),digit->GetId()) > fCpvClusteringThreshold ) ) {
       Int_t iDigitInCluster = 0 ; 
similarity index 72%
rename from PHOS/PHOSrec/AliPHOSCpvRawDigiProducer.cxx
rename to PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.cxx
index de755b796775f9719f84467fcbed8cdc44d1c89a..8753e1779a1c5c70c60f88a0cc1602c5d9428cf2 100644 (file)
@@ -18,8 +18,9 @@
 
 // --- AliRoot header files ---
 #include "AliPHOSCpvRawDigiProducer.h"
-#include "AliPHOSDigit.h"
 #include "AliPHOSCpvRawStream.h"
+#include "AliPHOSDigit.h"
+#include "AliPHOSGeometry.h"
 #include "AliLog.h"
 #include<iostream>
 using namespace std;
@@ -29,42 +30,50 @@ ClassImp(AliPHOSCpvRawDigiProducer);
 //--------------------------------------------------------------------------------------
 AliPHOSCpvRawDigiProducer::AliPHOSCpvRawDigiProducer():
   TObject(),
+  fGeom(0),
   fTurbo(kFALSE),
   fCpvMinE(10.),
   fRawStream(0),
   fhErrors(0),
   fPedFilesRLoaded(kFALSE)
 {
+  fGeom=AliPHOSGeometry::GetInstance() ;
+  if(!fGeom) fGeom = AliPHOSGeometry::GetInstance("IHEP");
+
   CreateErrHist();
   // create a 2d array to store the pedestals                                        
   for (Int_t iDDL=0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++){
-    ped[0][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
-    ped[1][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
+    fPed[0][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
+    fPed[1][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
     for(Int_t ix=0; ix<AliPHOSCpvParam::kPadPcX; ix++) {
-      ped[0][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
-      ped[1][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
+      fPed[0][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
+      fPed[1][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
     }
   }
 }
 //-------------------------------------------------------------------------------------
-AliPHOSCpvRawDigiProducer::AliPHOSCpvRawDigiProducer(AliRawReader *& rawReader):
+AliPHOSCpvRawDigiProducer::AliPHOSCpvRawDigiProducer(AliRawReader * rawReader):
   TObject(),
+  fGeom(0),
   fTurbo(kFALSE),
   fCpvMinE(10.),
   fRawStream(0),
   fhErrors(0),
   fPedFilesRLoaded(kFALSE)
 {
+  fGeom=AliPHOSGeometry::GetInstance() ;
+  if(!fGeom) fGeom = AliPHOSGeometry::GetInstance("IHEP");
+
   fRawStream = new AliPHOSCpvRawStream(rawReader);
   fRawStream->SetTurbo(fTurbo);
   CreateErrHist();
   // create a 2d array to store the pedestals                                               
   for (Int_t iDDL=0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++) {
-    ped[0][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
-    ped[1][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
+    fPed[0][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
+    fPed[1][iDDL] = new Int_t *[AliPHOSCpvParam::kPadPcX];
     for(Int_t ix=0; ix<AliPHOSCpvParam::kPadPcX; ix++) {
-      ped[0][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
-      ped[1][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
+      fPed[0][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
+      fPed[1][iDDL][ix] = new Int_t [AliPHOSCpvParam::kPadPcY];
     }
   }
 }
@@ -75,11 +84,11 @@ AliPHOSCpvRawDigiProducer::~AliPHOSCpvRawDigiProducer()
   if(fhErrors) delete fhErrors; 
   for(Int_t iDDL = 0;iDDL<AliPHOSCpvParam::kNDDL;iDDL++) {
     for(Int_t ix=0; ix<AliPHOSCpvParam::kPadPcX; ix++) { 
-      delete [] ped[0][iDDL][ix];
-      delete [] ped[1][iDDL][ix];
+      delete [] fPed[0][iDDL][ix];
+      delete [] fPed[1][iDDL][ix];
     }
-    delete [] ped[0][iDDL];
-    delete [] ped[1][iDDL];
+    delete [] fPed[0][iDDL];
+    delete [] fPed[1][iDDL];
   }
 }
 //--------------------------------------------------------------------------------------
@@ -92,7 +101,6 @@ Bool_t AliPHOSCpvRawDigiProducer::LoadPedFiles() {
       if(!pedFile) {
        Printf("AliPHOSCpvRawDigiProducer::LoadPedFiles: Error, file thr%d_%02d.dat could not be open",iDDL,iCC);
        continue;
-       //return kFALSE;
       }
       Int_t i3g = 0, iPad = 0;
       Int_t lineCnt = 0;
@@ -117,20 +125,19 @@ Bool_t AliPHOSCpvRawDigiProducer::LoadPedFiles() {
        if(AliPHOSCpvParam::IsValidAbs(abs)) {
          Int_t s = thr & 0x1ff;
          Int_t p = thr >> 9;
-         ped[0][iDDL][AliPHOSCpvParam::A2X(abs)][AliPHOSCpvParam::A2Y(abs)] = p-s;
-         ped[1][iDDL][AliPHOSCpvParam::A2X(abs)][AliPHOSCpvParam::A2Y(abs)] = s;
+         fPed[0][iDDL][AliPHOSCpvParam::A2X(abs)][AliPHOSCpvParam::A2Y(abs)] = p-s;
+         fPed[1][iDDL][AliPHOSCpvParam::A2X(abs)][AliPHOSCpvParam::A2Y(abs)] = s;
          int testAbs = AliPHOSCpvParam::XY2A(iDDL,AliPHOSCpvParam::A2X(abs),AliPHOSCpvParam::A2Y(abs));
          if(abs!=testAbs)
            cout<<"AliPHOSCpvRawDigiProducer::LoadPedFiles(): wrong connection table! abs = "
                <<abs<<", testAbs = "<<testAbs<<endl;
-         //Printf("ped[%d][%d] = %d, pad = %d, abs = %d",AliPHOSCpvParam::A2X(abs),AliPHOSCpvParam::A2Y(abs), p + s, iPad, abs);
        }
        iPad++;
        if(iPad == 64) {iPad = 0; i3g++;}
        lineCnt++;
       }
-      if(lineCnt < AliPHOSCpvParam::kN3GAdd * 64) return kFALSE;
       fclose(pedFile);
+      if(lineCnt < AliPHOSCpvParam::kN3GAdd * 64) return kFALSE;
     }
   fPedFilesRLoaded = kTRUE;
   return kTRUE;
@@ -142,7 +149,7 @@ void AliPHOSCpvRawDigiProducer::SetTurbo(Bool_t turbo)
   if(fRawStream) fRawStream->SetTurbo(fTurbo);
 }
 //--------------------------------------------------------------------------------------
-Bool_t AliPHOSCpvRawDigiProducer::LoadNewEvent(AliRawReader *& rawReader)
+Bool_t AliPHOSCpvRawDigiProducer::LoadNewEvent(AliRawReader * rawReader)
 {
   if(fRawStream) delete fRawStream;
   fRawStream = new AliPHOSCpvRawStream(rawReader);
@@ -154,36 +161,49 @@ Bool_t AliPHOSCpvRawDigiProducer::LoadNewEvent(AliRawReader *& rawReader)
   return kFALSE;
 }
 //--------------------------------------------------------------------------------------
-void AliPHOSCpvRawDigiProducer::MakeDigits(TClonesArray *& digits) const
+void AliPHOSCpvRawDigiProducer::MakeDigits(TClonesArray * digits) const
 {
+  // Fills TClonesArray of AliPHOSDigits and 
   // returns histogram of error types
 
-  if(digits) 
-    digits->Clear();
-  digits = new TClonesArray("AliPHOSDigit", AliPHOSCpvParam::kNDDL * AliPHOSCpvParam::kNRows * AliPHOSCpvParam::kN3GAdd * AliPHOSCpvParam::kNPadAdd);
+  Int_t relId[4], absId=-1;
   Int_t iDigit = 0;
-  while(fRawStream->Next()) {
-    for(Int_t iPad=0;iPad<fRawStream->GetNPads();iPad++) {
-      Int_t charge = fRawStream->GetChargeArray()[iPad];
-      Int_t aPad   = fRawStream->GetPadArray()[iPad];
-      //cout<<"AliPHOSCpvRawDigiProducer::MakeDigits(): I've got pad "<<aPad<< "with amplitude "<<charge<<endl;
+  while (fRawStream->Next()) {
+    for (Int_t iPad=0; iPad<fRawStream->GetNPads(); iPad++) {
+      Float_t charge = fRawStream->GetChargeArray()[iPad];
+      Int_t aPad     = fRawStream->GetPadArray()[iPad];
+      Int_t ix       = AliPHOSCpvParam::A2X(aPad);
+      Int_t iy       = AliPHOSCpvParam::A2Y(aPad);
+      Int_t iddl     = AliPHOSCpvParam::A2DDL(aPad);
+
+      relId[0] = AliPHOSCpvParam::DDL2Mod(iddl) ; // counts from 1 to 5
+      relId[1] = 1;      // 1=CPV
+      relId[2] = ix + 1; // counts from 1 to 128
+      relId[3] = iy + 1; // counts from 1 to 60
+      fGeom->RelToAbsNumbering(relId, absId);
+
+      AliDebug(2,Form("CPV digit: pad=%d, (x,z)=(%3d,%2d), DDL=%d, charge=%.0f",
+                     aPad,ix,iy,iddl,charge)); 
+
       if(fPedFilesRLoaded) {
-       Int_t ix   = AliPHOSCpvParam::A2X(aPad);
-       Int_t iy   = AliPHOSCpvParam::A2Y(aPad);
-       Int_t iddl = AliPHOSCpvParam::A2DDL(aPad);
-       if (charge>ped[0][iddl][ix][iy]+ped[1][iddl][ix][iy]){
-         charge -=ped[0][iddl][ix][iy];
-       }
-       else charge=0;
-       if(charge < fCpvMinE) charge = 0;
+       if (charge > fPed[0][iddl][ix][iy] + fPed[1][iddl][ix][iy])
+         charge -= fPed[0][iddl][ix][iy];
+       else 
+         charge  = 0;
       }
-      // if(charge) new((*digits)[iDigit++]) AliPHOSDigit(AliPHOSCpvParam::A2X(aPad),AliPHOSCpvParam::A2Y(aPad),charge);
-      // Check what is aPad! YK 31.12.2014
-      if(charge) new((*digits)[iDigit++]) AliPHOSDigit(-1,aPad,charge,0);
+      if(charge < fCpvMinE) charge = 0;
+      if (charge>0) new((*digits)[iDigit++]) AliPHOSDigit(-1,absId,charge,0.);
       
     }
   } // while(fRawStream->Next())
-  //cout<<"AliPHOSCpvRawDigiProducer::MakeDigits(): I've created "<<iDigit<<" digits."<<endl;
+  digits->Sort() ;
+  for (Int_t i = 0 ; i < digits->GetEntriesFast() ; i++) { 
+    AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( digits->At(i) ) ; 
+    digit->SetIndexInList(i) ;     
+  }
+
+  AliDebug(1,Form("Array of %d CPV digits is created",digits->GetEntriesFast())); 
+
   // fill histogram of errors
   for(Int_t iDDL=0; iDDL<AliPHOSCpvParam::kNDDL; iDDL++) {
     Int_t nErrors = AliPHOSCpvRawStream::GetNErrors();
similarity index 67%
rename from PHOS/PHOSrec/AliPHOSCpvRawDigiProducer.h
rename to PHOS/PHOSbase/AliPHOSCpvRawDigiProducer.h
index 4eafd5daccd7abcc0dc4f0f90a613ce3a886e52f..7438c486173983389157531f2c1a0d474b92d56f 100644 (file)
 #include "AliRawReaderDate.h"
 #include "AliPHOSCpvParam.h"
 
-class AliPHOSDigit ;
 class AliPHOSCpvRawStream;
+class AliPHOSDigit ;
+class AliPHOSGeometry ;
 
 class AliPHOSCpvRawDigiProducer: public TObject {
 
 public:
 
   AliPHOSCpvRawDigiProducer() ;
-  AliPHOSCpvRawDigiProducer(AliRawReader *& rawReader); // creates an AliPHOSCpvRawStream(rawReader) object to read data
+  AliPHOSCpvRawDigiProducer(AliRawReader * rawReader); // creates an AliPHOSCpvRawStream(rawReader) object to read data
  
   virtual ~AliPHOSCpvRawDigiProducer(); 
 
@@ -31,28 +32,29 @@ public:
                          //If ped files are loaded, then MakeDigits returns digits with 
                          //substruct pedestals from ADCs
 
-  Bool_t LoadNewEvent(AliRawReader *& rawReader); // returns true, if ok
-  void   SetTurbo(Bool_t turbo);                  // if turbo==true then do read without error checking
+  Bool_t LoadNewEvent(AliRawReader * rawReader); // returns true, if ok
+  void   SetTurbo(Bool_t turbo);                 // if turbo==true then do read without error checking
   Bool_t GetTurbo() const {return fTurbo;}
 
-  void MakeDigits(TClonesArray *& digits) const;    // digits is an array of AliPHOSCpvPHOSDigit objects
+  void   MakeDigits(TClonesArray * digits) const;   // digits is an array of AliPHOSCpvPHOSDigit objects
   TH1I * GetErrorsHist() const { return fhErrors; } // takes histogram of errors from AliPHOSCpvRawStream
 
-  void SetCpvMinAmp(Int_t cpvMin) { fCpvMinE=cpvMin; }               // thresholds would be ped + fCpvMinE
+  void   SetCpvMinAmp(Int_t cpvMin) { fCpvMinE=cpvMin; } // thresholds would be ped + fCpvMinE
 
 protected:
   void CreateErrHist();             // initialize histogram of errors
 private:
+  AliPHOSGeometry * fGeom ;         //! PHOS geometry
   Bool_t fTurbo;                    // if true, then read without error checking
   Int_t  fCpvMinE ;                 // minimum energy of digit (ADC)
   AliPHOSCpvRawStream * fRawStream; //! Raw data stream 
 
   TH1I * fhErrors;         // ! histogram of errors
 
-  Int_t ** ped[2][AliPHOSCpvParam::kNDDL]; // pedestals    ped[0][iddl][x][y] = pedestal; ped[1][iddl][x][y] = N*sigma (N was used while creating ped files)
+  Int_t ** fPed[2][AliPHOSCpvParam::kNDDL]; // pedestals    ped[0][iddl][x][y] = pedestal; ped[1][iddl][x][y] = N*sigma (N was used while creating ped files)
   Bool_t fPedFilesRLoaded;
 
-  ClassDef(AliPHOSCpvRawDigiProducer,1);
+  ClassDef(AliPHOSCpvRawDigiProducer,2);
 };
 
 #endif
index 384d58d44554a5adc7480dc5c10ec4b6c1c4344b..dad82f8b43204829771579805f2bb3cf3856ec23 100644 (file)
@@ -88,11 +88,11 @@ AliPHOSCpvRawStream::AliPHOSCpvRawStream() :
   // Default constructor
   //
   Int_t kNDDL = AliPHOSCpvParam::kNDDL;
-  fNumOfErr = new Int_t*[kNDDL];     // Store the number of errors for a given error type and a given DD                                               
+  fNumOfErr = new Int_t*[kNDDL]; // Store the number of errors for a given error type and a given DDL
   for(Int_t iddl=0; iddl<kNDDL; iddl++) {
     fNumOfErr[iddl] = new Int_t [kSumErr];
     for(Int_t ierr=0; ierr < kSumErr; ierr++) {
-      fNumOfErr[iddl][ierr]=0;       // reset errors                                                                                                   
+      fNumOfErr[iddl][ierr]=0;   // reset errors
     }
   }
 
@@ -151,15 +151,16 @@ Bool_t AliPHOSCpvRawStream::Turbo()
     if (!GetWord(1)) return kFALSE;
     //std::cout<<"i've passed getWord(1)"<<std::endl;
     if (fPosition/4 <= 5) continue; // Skip first 5 words 
-
-        row = ((fWord >> kbit22) & 0x1f) - 1;
-        _3G = ((fWord >> kbit18) & 0xf) - 1; // 3GASSIPLEX info in raw word is between bits: 18...21    
-        pad = (fWord >> kbit12) & 0x3f;      // pad info in raw word is between bits: 12...17
-       //std::cout<<"row = "<<row<<", 3Gassiplex = "<<_3G<<", pad info = "<<pad<<std::endl;
-
+    
+    row = ((fWord >> kbit22) & 0x1f) - 1;
+    _3G = ((fWord >> kbit18) & 0xf) - 1; // 3GASSIPLEX info in raw word is between bits: 18...21    
+    pad = (fWord >> kbit12) & 0x3f;      // pad info in raw word is between bits: 12...17
+    //std::cout<<"row = "<<row<<", 3Gassiplex = "<<_3G<<", pad info = "<<pad<<std::endl;
+    
     Int_t charge, abs, eType;
     if(!AliPHOSCpvParam::DecodeRawWord(fDDLNumber,fWord,abs,charge,eType)) {
-      if(eType > 0){ fNumOfErr[fDDLNumber][eType]++;
+      if (eType > 0) {
+       fNumOfErr[fDDLNumber][eType]++;
        //std::cout<<"AliPHOSCpvRawStream::Turbo(): I cannot decode word!"<<std::endl;
        //cout<<"DDL = "<<  fDDLNumber << "; word = "<< fWord <<"; abs = " << abs 
        //    <<"; charge = "<< charge <<"; etype = "<< eType << endl;
index 66074646c08080bab19b78ede5dc2260481be08c..5f696999849ed6d526580b8fdca584d0b4fad59b 100644 (file)
@@ -168,8 +168,6 @@ void AliPHOSRawDigiProducer::MakeDigits(TClonesArray *digits, TClonesArray *tmpD
   //Makes the job.
   //TClonesArray *digits, *tmpDigLG and raw data fitter should be provided by calling function.
 
-  digits->Clear();
   Int_t iDigit=0 ;
   Int_t relId[4], absId=-1, caloFlag=-1;
   
@@ -193,10 +191,10 @@ void AliPHOSRawDigiProducer::MakeDigits(TClonesArray *digits, TClonesArray *tmpD
   while (fRawStream->NextDDL()) {
     while (fRawStream->NextChannel()) {
       relId[0] = 5 - fRawStream->GetModule() ; // counts from 1 to 5
-      relId[1] = 0;
-      relId[2] = fRawStream->GetCellX()  + 1; // counts from 1 to 64
-      relId[3] = fRawStream->GetCellZ()  + 1; // counts from 1 to 56
-      caloFlag = fRawStream->GetCaloFlag();   // 0=LG, 1=HG, 2=TRU
+      relId[1] = 0;                            // 0=EMC
+      relId[2] = fRawStream->GetCellX()  + 1;  // counts from 1 to 64
+      relId[3] = fRawStream->GetCellZ()  + 1;  // counts from 1 to 56
+      caloFlag = fRawStream->GetCaloFlag();    // 0=LG, 1=HG, 2=TRU
       
       if(caloFlag!=0 && caloFlag!=1) continue; //TRU data!
       
index 6841990dab93a4a81202fd9b6e23c330e99ee0a2..2160232cc707b74011e10c3e175f28dac408c44f 100644 (file)
@@ -54,6 +54,7 @@
 #include "AliPHOSRawFitterv3.h"
 #include "AliPHOSRawFitterv4.h"
 #include "AliPHOSRawDigiProducer.h"
+#include "AliPHOSCpvRawDigiProducer.h"
 #include "AliPHOSPulseGenerator.h"
 #include "AliPHOSTriggerRawDigit.h"
 #include "AliPHOSTriggerRawDigiProducer.h"
@@ -408,45 +409,18 @@ void  AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits
   // Works on a single-event basis
   rawReader->Reset() ; 
 
-  AliPHOSRawFitterv0 * fitter ;
-
-  const TObjArray* maps = AliPHOSRecoParam::GetMappings();
-  if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
-
-  AliAltroMapping *mapping[20];
-  for(Int_t i = 0; i < 20; i++) {
-    mapping[i] = (AliAltroMapping*)maps->At(i);
-  }
-
-  if      (strcmp(GetRecoParam()->EMCFitterVersion(),"v0")==0) 
-    fitter=new AliPHOSRawFitterv0();
-  else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v1")==0) 
-    fitter=new AliPHOSRawFitterv1();
-  else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v2")==0) 
-    fitter=new AliPHOSRawFitterv2();
-  else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v3")==0) 
-    fitter=new AliPHOSRawFitterv3();
-  else
-    fitter=new AliPHOSRawFitterv4();
-
-  fitter->SubtractPedestals(GetRecoParam()->EMCSubtractPedestals());
-  fitter->SetAmpOffset     (GetRecoParam()->GetGlobalAltroOffset());
-  fitter->SetAmpThreshold  (GetRecoParam()->GetGlobalAltroThreshold());
-
+  // Create a new array of PHOS and CPV digits and fill it in PHOS and CPV raw data decoders
   TClonesArray *digits = new TClonesArray("AliPHOSDigit",1);
   digits->SetName("DIGITS");
   Int_t bufsize = 32000;
   digitsTree->Branch("PHOS", &digits, bufsize);
 
-  AliPHOSRawDigiProducer rdp(rawReader,mapping);
+  ConvertDigitsEMC(rawReader,digits);
+  ConvertDigitsCPV(rawReader,digits);
 
-  rdp.SetEmcMinAmp(GetRecoParam()->GetEMCRawDigitThreshold()); // in ADC
-  rdp.SetCpvMinAmp(GetRecoParam()->GetCPVMinE());
-  rdp.SetSampleQualityCut(GetRecoParam()->GetEMCSampleQualityCut());
-  rdp.MakeDigits(digits,fTmpDigLG,fitter);
-
-  delete fitter ;
+  AliDebug(2,Form("Number of created digits = %d",digits->GetEntriesFast()));
 
+  // Create a new array of PHOS trigger digits and fill it from raw data
   TClonesArray *tdigits = new TClonesArray("AliPHOSTriggerRawDigit",1);
   tdigits->SetName("TDIGITS");
   digitsTree->Branch("TPHOS", &tdigits, bufsize);  
@@ -491,6 +465,56 @@ void  AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits
   delete tdigits;
 }
 //==================================================================================
+void  AliPHOSReconstructor::ConvertDigitsEMC(AliRawReader* rawReader, TClonesArray* digits) const
+{
+  // Converts CPV raw data to PHOS EMC digits
+  // Works on a single-event basis
+  AliPHOSRawFitterv0 * fitter ;
+
+  const TObjArray* maps = AliPHOSRecoParam::GetMappings();
+  if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
+
+  AliAltroMapping *mapping[20];
+  for(Int_t i = 0; i < 20; i++) {
+    mapping[i] = (AliAltroMapping*)maps->At(i);
+  }
+
+  if      (strcmp(GetRecoParam()->EMCFitterVersion(),"v0")==0) 
+    fitter=new AliPHOSRawFitterv0();
+  else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v1")==0) 
+    fitter=new AliPHOSRawFitterv1();
+  else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v2")==0) 
+    fitter=new AliPHOSRawFitterv2();
+  else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v3")==0) 
+    fitter=new AliPHOSRawFitterv3();
+  else
+    fitter=new AliPHOSRawFitterv4();
+
+  fitter->SubtractPedestals(GetRecoParam()->EMCSubtractPedestals());
+  fitter->SetAmpOffset     (GetRecoParam()->GetGlobalAltroOffset());
+  fitter->SetAmpThreshold  (GetRecoParam()->GetGlobalAltroThreshold());
+
+  AliPHOSRawDigiProducer rdp(rawReader,mapping);
+
+  rdp.SetEmcMinAmp(GetRecoParam()->GetEMCRawDigitThreshold()); // in ADC
+  rdp.SetCpvMinAmp(GetRecoParam()->GetCPVMinE());
+  rdp.SetSampleQualityCut(GetRecoParam()->GetEMCSampleQualityCut());
+  rdp.MakeDigits(digits,fTmpDigLG,fitter);
+
+  delete fitter ;
+}
+//==================================================================================
+void  AliPHOSReconstructor::ConvertDigitsCPV(AliRawReader* rawReader, TClonesArray* digits) const
+{
+  // Converts CPV raw data to PHOS CPV digits
+  // Works on a single-event basis
+  AliPHOSCpvRawDigiProducer rdp(rawReader);
+  rdp.SetCpvMinAmp(GetRecoParam()->GetCPVMinE());
+  rdp.SetTurbo(kTRUE);
+  rdp.MakeDigits(digits);
+
+}
+//==================================================================================
 Float_t AliPHOSReconstructor::Calibrate(Float_t amp, Int_t absId)const{
   // Calibrate EMC digit, i.e. multiply its Amp by a factor read from CDB
 
index a2c881b9ac1dabf24f3cb268a2abe35474486b42..64cd6dfda54251e5d10fa23a9741d050fa5a3e17 100644 (file)
@@ -83,7 +83,9 @@ public:
   virtual void               Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
 
   virtual Bool_t             HasDigitConversion() const {return kTRUE;};
-  virtual void               ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const;
+  virtual void               ConvertDigits   (AliRawReader* rawReader, TTree* digitsTree) const;
+  virtual void               ConvertDigitsEMC(AliRawReader* rawReader, TClonesArray* digits) const;
+  virtual void               ConvertDigitsCPV(AliRawReader* rawReader, TClonesArray* digits) const;
   virtual Float_t            Calibrate(Float_t amp, Int_t absId) const ;
   virtual Float_t            CalibrateT(Float_t time, Int_t absId, Bool_t isLG) const ;
 
index daf03a93e9dfcd38f29a3657a982c2369c1e8898..4d980bdd76df019cf4c993049c547c2aaa05200d 100644 (file)
@@ -41,6 +41,7 @@ set(SRCS
     AliPHOSCpvRecPoint.cxx
     AliPHOSCpv3GConnection.cxx
     AliPHOSCpvParam.cxx
+    AliPHOSCpvRawDigiProducer.cxx
     AliPHOSCpvRawStream.cxx
     AliPHOSDigit.cxx
     AliPHOSDigitizer.cxx
index 0c48a699f5465d94dc63c25c5ae5a707d5f5d156..611df561bebdc540267b784f0b0b8b119ebb0843 100644 (file)
@@ -56,6 +56,7 @@
 #pragma link C++ class AliPHOSTriggerRawReader+;
 #pragma link C++ class AliPHOSTRURawReader+;
 
+#pragma link C++ class AliPHOSCpvRawDigiProducer+;
 #pragma link C++ class AliPHOSCpvRawStream+;
 #pragma link C++ class AliPHOSCpvParam+;
 #pragma link C++ class AliPHOSCpv3GConnection+;
old mode 100755 (executable)
new mode 100644 (file)
index 9ceb5cd0b60b5c39eb7a1fcf77eec9890d8c022d..d75afb4a1199dd80cd006848914b57b42eb53ad5 100644 (file)
@@ -37,7 +37,6 @@ include_directories(${ROOT_INCLUDE_DIRS}
 set(SRCS
     AliPHOSAodCluster.cxx
     AliPHOSClusterizerv2.cxx
-    AliPHOSCpvRawDigiProducer.cxx
     AliPHOSEsdCluster.cxx
     AliPHOSEvalRecPoint.cxx
     AliPHOSGridFile.cxx
index 9d54ebd4441dcc8f5ef06eb968693d6986271b27..16a16e4eb5a43b1a001a62749c369241944641be 100644 (file)
@@ -16,5 +16,4 @@
 #pragma link C++ class AliPHOSEsdCluster+;
 #pragma link C++ class AliPHOSAodCluster+;
 #pragma link C++ class AliPHOSQADataMakerRec+;
-#pragma link C++ class AliPHOSCpvRawDigiProducer+;
 #endif
index e3ef2cc1aa4ee20104d9cc7a2506d23bbed63240..a66f95a481bd43379dc7615d376289b8267aa414 100644 (file)
@@ -42,7 +42,7 @@ void AliEMCALConfigHandler::AddParam(const char* configName, const char* key,
   AliEMCALConfiguration *config = FindConfiguration(configName);
   if(!config){
     this->Warning("AliEMCALConfigHandler", "Configuration with name %s does not exist, creating it", configName);
-    CreateConfiguration(configName);
+    config = CreateConfiguration(configName);
   }
   config->AddParam(key, value);
 }
index 44646f67edb35fd61adcaf21359e42a3e49a91d3..585f26aab18cab9547748a3c929eb5762bcd39ca 100644 (file)
@@ -2273,7 +2273,10 @@ void AliAnalysisTaskFlowStrange::MakeQTPC(AliAODEvent *tAOD) {
   Int_t rawN = tAOD->GetNumberOfTracks();
   for(Int_t id=0; id!=rawN; ++id) {
     track = dynamic_cast<AliAODTrack*>(tAOD->GetTrack(id));
-    if(!track) AliFatal("Not a standard AOD");
+    if(!track) {
+        AliFatal("Not a standard AOD");
+        return; // shut up coverity
+    }
     //=>cuts
     if(!track->TestFilterBit(fRFPFilterBit)) continue;
     if( fExcludeTPCEdges )
diff --git a/PWG/FLOW/Tasks/AliAnalysisTaskFlowStrangee.cxx b/PWG/FLOW/Tasks/AliAnalysisTaskFlowStrangee.cxx
new file mode 100644 (file)
index 0000000..641b715
--- /dev/null
@@ -0,0 +1,4279 @@
+/*************************************************************************
+* Copyright(c) 1998-2008,ALICE Experiment at CERN,All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* 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   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
+
+/////////////////////////////////////////////////////
+// AliAnalysisTaskFlowStrange:
+// Analysis task to select K0/Lambda candidates for flow analysis.
+// Authors: Cristian Ivan (civan@cern.ch)
+//          Carlos Perez  (cperez@cern.ch)
+//          Pawel Debski  (pdebski@cern.ch)
+//////////////////////////////////////////////////////
+
+#include "TChain.h"
+#include "TList.h"
+#include "TH1D.h"
+#include "TH2D.h"
+#include "TH3D.h"
+#include "TF1.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+#include "TVector3.h"
+#include "TStopwatch.h"
+#include "TFile.h"
+
+#include "TRandom3.h"
+
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+
+#include "AliVVertex.h"
+#include "AliVVZERO.h"
+#include "AliStack.h"
+#include "AliMCEvent.h"
+
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+#include "AliESDVertex.h"
+#include "AliESDv0.h"
+#include "AliESDtrackCuts.h"
+
+#include "AliAODEvent.h"
+#include "AliAODTrack.h"
+#include "AliAODVertex.h"
+#include "AliAODv0.h"
+#include "AliAODTracklets.h"
+#include "AliAODHeader.h"
+
+#include "AliAODMCHeader.h"
+#include "AliAODMCParticle.h"
+#include "TClonesArray.h"
+#include "TDatabasePDG.h"
+#include "TParticlePDG.h"
+
+#include "TMath.h"
+#include "TObjArray.h"
+#include "AliFlowCandidateTrack.h"
+
+#include "AliFlowTrackCuts.h"
+#include "AliFlowEventCuts.h"
+#include "AliFlowEvent.h"
+#include "AliFlowBayesianPID.h"
+#include "AliFlowCommonConstants.h"
+#include "AliFlowVector.h"
+
+#include "AliAnalysisTaskFlowStrangee.h"
+
+ClassImp(AliAnalysisTaskFlowStrangee)
+
+//=======================================================================
+AliAnalysisTaskFlowStrangee::AliAnalysisTaskFlowStrangee() :
+  AliAnalysisTaskSE(),
+  fPIDResponse(NULL),
+  fFB1(NULL),
+  fFB1024(NULL),
+  fTPCevent(NULL),
+  fVZEevent(NULL),
+  fCandidates(NULL),
+  fList(NULL),
+  fRunNumber(-1),
+  fDebug(0),
+  fQAlevel(0),
+  fReadESD(kFALSE),
+  fReadMC(kFALSE),
+  fAddPiToMCReactionPlane(kTRUE),
+  fPostMatched(0),
+  fAvoidExec(kFALSE),
+  fSkipSelection(kFALSE),
+  fSkipVn(kFALSE),
+  fUseFP(kFALSE),
+  fRunOnpA(kFALSE),
+  fRunOnpp(kFALSE),
+  fExtraEventRejection(kFALSE),
+  fSkipCentralitySelection(kFALSE),
+  fCentMethod("V0MTRK"),
+  fCentPerMin(0),
+  fCentPerMax(100),
+  fThisCent(-1.0),
+  fV0M(0.0),
+  fTRK(0.0),
+  fPriVtxZ(0.0),
+  fSPDVtxZ(0.0),
+  fSPDtracklets(0),
+  fVZETotM(0.0),
+  fRefMultTPC(0),
+  fRefMultHyb(0),
+  fVertexZcut(10.0),
+  fExcludeTPCEdges(kFALSE),
+  fSpecie(0),
+  fOnline(kFALSE),
+  fHomemade(kFALSE),
+  fWhichPsi(1),
+  fVZEsave(kFALSE),
+  fVZEload(NULL),
+  fVZEResponse(NULL),
+  fVZEmb(kFALSE),
+  fVZEByDisk(kTRUE),
+  fVZECa(0),
+  fVZECb(3),
+  fVZEAa(0),
+  fVZEAb(3),
+  fVZEQA(NULL),
+  fHarmonic(2),
+  fPsi2(0.0),
+  fMCEP(0.0),
+  fQVZEACos(0.0),
+  fQVZEASin(0.0),
+  fQVZECCos(0.0),
+  fQVZECSin(0.0),
+  fQVZEA(0.0),
+  fQVZEC(0.0),
+  fVZEWarning(kFALSE),
+  fQTPCACos(0.0),
+  fQTPCASin(0.0),
+  fQTPCCCos(0.0),
+  fQTPCCSin(0.0),
+  fQTPC2hCos(0.0),
+  fQTPC2hSin(0.0),
+  fQTPCA(0.0),
+  fQTPCC(0.0),
+  fQTPCA_nTracks(0),
+  fQTPCC_nTracks(0),
+  fSkipTerminate(kTRUE),
+  fMassBins(0),
+  fMinMass(0.0),
+  fMaxMass(0.0),
+  fPtBins(0),
+  fRFPFilterBit(1),
+  fRFPminPt(0.2),
+  fRFPmaxPt(5.0),
+  fRFPAminEta(0.0),
+  fRFPAmaxEta(+0.8),
+  fRFPCminEta(-0.8),
+  fRFPCmaxEta(0.0),
+  fRFPTPCsignal(10.0),
+  fRFPmaxIPxy(2.4),
+  fRFPmaxIPz(3.2),
+  fRFPTPCncls(70),
+  fDecayMass(0.0),
+  fDecayPhi(0.0),
+  fDecayEta(0.0),
+  fDecayPt(0.0),
+  fDecayDCAdaughters(0.0),
+  fDecayCosinePointingAngleXY(0.0),
+  fDecayRadXY(0.0),
+  fDecayDecayLength(0.0),
+  fDecayDecayLengthLab(0.0),
+  fDecayQt(0.0),
+  fDecayAlpha(0.0),
+  fDecayRapidity(0.0),
+  fDecayProductIPXY(0.0),
+  fDecayIPneg(0.0),
+  fDecayIPpos(0.0),
+  fDecayXneg(0.0),
+  fDecayXpos(0.0),
+  fDecayIDneg(-1),
+  fDecayIDpos(-1),
+  fDecayID(-1),
+  fDecayMatchOrigin(0.0),
+  fDecayMatchPhi(0.0),
+  fDecayMatchEta(0.0),
+  fDecayMatchPt(0.0),
+  fDecayMatchRadXY(0.0),
+  fDecayMinEta(0.0),
+  fDecayMaxEta(0.0),
+  fDecayMinPt(0.0),
+  fDecayMaxDCAdaughters(0.0),
+  fDecayMinCosinePointingAngleXY(0.0),
+  fDecayMinQt(0.0),
+  fDecayAPCutPie(kTRUE),
+  fDecayStopPIDAtPt(3.0),
+  fDecayMinRadXY(0.0),
+  fDecayMaxDecayLength(0.0),
+  fDecayMaxProductIPXY(0.0),
+  fDecayMaxRapidity(0.0),
+  fDaughterPhi(0.0),
+  fDaughterEta(0.0),
+  fDaughterPt(0.0),
+  fDaughterNClsTPC(0),
+  fDaughterNClsITS(0),
+  fDaughterCharge(0),
+  fDaughterNFClsTPC(0),
+  fDaughterNSClsTPC(0),
+  fDaughterChi2PerNClsTPC(0.0),
+  fDaughterXRows(0.0),
+  fDaughterImpactParameterXY(0.0),
+  fDaughterImpactParameterZ(0.0),
+  fDaughterStatus(0),
+  fDaughterITScm(0),
+  fDaughterNSigmaPID(0.0),
+  fDaughterKinkIndex(0),
+  fDaughterAtSecPhi(0.0),
+  fDaughterAtSecEta(0.0),
+  fDaughterAtSecPt(0.0),
+  fsharedITSCluster(0), 
+  fchi2perClusterITS(0),
+  fcounterForSharedCluster(0),
+  fDaughterMatchPhi(0.0),
+  fDaughterMatchEta(0.0),
+  fDaughterMatchPt(0.0),
+  fDaughterMatchImpactParameterXY(0.0),
+  fDaughterMatchImpactParameterZ(0.0),
+  fDaughterUnTag(kTRUE),
+  fDaughterMinEta(0.0),
+  fDaughterMaxEta(0.0),
+  fDaughterMinPt(0.0),
+  fDaughterMinNClsTPC(0),
+  fDaughterMinNClsITS(-1),
+  fDaughterMinXRows(0),
+  fDaughterMaxChi2PerNClsTPC(0.0),
+  fDaughterMinXRowsOverNClsFTPC(0.0),
+  fDaughterMinImpactParameterXY(0.0),
+  fDaughterMaxNSigmaPID(0.0),
+  fDaughterSPDRequireAny(kFALSE),
+  fDaughterITSrefit(kFALSE),
+  fMaxchi2perITSCluster(0),
+  fmaxSharedITSCluster(0)   
+{
+  //ctor
+  for(Int_t i=0; i!=100; ++i) fPtBinEdge[i]=0;
+  for(Int_t i=0; i!=6; ++i) fDaughterITSConfig[i]=-1;
+  for(Int_t i=0; i!=2000; ++i) fQTPCA_fID[i]=-1;
+  for(Int_t i=0; i!=2000; ++i) fQTPCC_fID[i]=-1;
+  for(Int_t i=0; i!=64; ++i) fVZEextW[i]=1;
+}
+
+//=======================================================================
+AliAnalysisTaskFlowStrangee::AliAnalysisTaskFlowStrangee(const char *name) :
+  AliAnalysisTaskSE(name),
+  fPIDResponse(NULL),
+  fFB1(NULL),
+  fFB1024(NULL),
+  fTPCevent(NULL),
+  fVZEevent(NULL),
+  fCandidates(NULL),
+  fList(NULL),
+  fRunNumber(-1),
+  fDebug(0),
+  fQAlevel(0),
+  fReadESD(kFALSE),
+  fReadMC(kFALSE),
+  fAddPiToMCReactionPlane(kTRUE),
+  fPostMatched(0),
+  fAvoidExec(kFALSE),
+  fSkipSelection(kFALSE),
+  fSkipVn(kFALSE),
+  fUseFP(kFALSE),
+  fRunOnpA(kFALSE),
+  fRunOnpp(kFALSE),
+  fExtraEventRejection(kFALSE),
+  fSkipCentralitySelection(kFALSE),
+  fCentMethod("V0MTRK"),
+  fCentPerMin(0),
+  fCentPerMax(100),
+  fThisCent(-1.0),
+  fV0M(0.0),
+  fTRK(0.0),
+  fPriVtxZ(0.0),
+  fSPDVtxZ(0.0),
+  fSPDtracklets(0),
+  fVZETotM(0.0),
+  fRefMultTPC(0),
+  fRefMultHyb(0),
+  fVertexZcut(10.0),
+  fExcludeTPCEdges(kFALSE),
+  fSpecie(0),
+  fOnline(kFALSE),
+  fHomemade(kFALSE),
+  fWhichPsi(1),
+  fVZEsave(kFALSE),
+  fVZEload(NULL),
+  fVZEResponse(NULL),
+  fVZEmb(kFALSE),
+  fVZEByDisk(kTRUE),
+  fVZECa(0),
+  fVZECb(3),
+  fVZEAa(0),
+  fVZEAb(3),
+  fVZEQA(NULL),
+  fHarmonic(2),
+  fPsi2(0.0),
+  fMCEP(0.0),
+  fQVZEACos(0.0),
+  fQVZEASin(0.0),
+  fQVZECCos(0.0),
+  fQVZECSin(0.0),
+  fQVZEA(0.0),
+  fQVZEC(0.0),
+  fVZEWarning(kFALSE),
+  fQTPCACos(0.0),
+  fQTPCASin(0.0),
+  fQTPCCCos(0.0),
+  fQTPCCSin(0.0),
+  fQTPC2hCos(0.0),
+  fQTPC2hSin(0.0),
+  fQTPCA(0.0),
+  fQTPCC(0.0),
+  fQTPCA_nTracks(0),
+  fQTPCC_nTracks(0),
+  fSkipTerminate(kTRUE),
+  fMassBins(0),
+  fMinMass(0.0),
+  fMaxMass(0.0),
+  fPtBins(0),
+  fRFPFilterBit(1),
+  fRFPminPt(0.2),
+  fRFPmaxPt(5.0),
+  fRFPAminEta(0.0),
+  fRFPAmaxEta(+0.8),
+  fRFPCminEta(-0.8),
+  fRFPCmaxEta(0.0),
+  fRFPTPCsignal(10.0),
+  fRFPmaxIPxy(2.4),
+  fRFPmaxIPz(3.2),
+  fRFPTPCncls(70),
+  fDecayMass(0.0),
+  fDecayPhi(0.0),
+  fDecayEta(0.0),
+  fDecayPt(0.0),
+  fDecayDCAdaughters(0.0),
+  fDecayCosinePointingAngleXY(0.0),
+  fDecayRadXY(0.0),
+  fDecayDecayLength(0.0),
+  fDecayDecayLengthLab(0.0),
+  fDecayQt(0.0),
+  fDecayAlpha(0.0),
+  fDecayRapidity(0.0),
+  fDecayProductIPXY(0.0),
+  fDecayIPneg(0.0),
+  fDecayIPpos(0.0),
+  fDecayXneg(0.0),
+  fDecayXpos(0.0),
+  fDecayIDneg(-1),
+  fDecayIDpos(-1),
+  fDecayID(-1),
+  fDecayMatchOrigin(0.0),
+  fDecayMatchPhi(0.0),
+  fDecayMatchEta(0.0),
+  fDecayMatchPt(0.0),
+  fDecayMatchRadXY(0.0),
+  fDecayMinEta(0.0),
+  fDecayMaxEta(0.0),
+  fDecayMinPt(0.0),
+  fDecayMaxDCAdaughters(0.0),
+  fDecayMinCosinePointingAngleXY(0.0),
+  fDecayMinQt(0.0),
+  fDecayAPCutPie(kTRUE),
+  fDecayStopPIDAtPt(3.0),
+  fDecayMinRadXY(0.0),
+  fDecayMaxDecayLength(0.0),
+  fDecayMaxProductIPXY(0.0),
+  fDecayMaxRapidity(0.0),
+  fDaughterPhi(0.0),
+  fDaughterEta(0.0),
+  fDaughterPt(0.0),
+  fDaughterNClsTPC(0),
+  fDaughterNClsITS(0),
+  fDaughterCharge(0),
+  fDaughterNFClsTPC(0),
+  fDaughterNSClsTPC(0),
+  fDaughterChi2PerNClsTPC(0.0),
+  fDaughterXRows(0.0),
+  fDaughterImpactParameterXY(0.0),
+  fDaughterImpactParameterZ(0.0),
+  fDaughterStatus(0),
+  fDaughterITScm(0),
+  fDaughterNSigmaPID(0.0),
+  fDaughterKinkIndex(0),
+  fDaughterAtSecPhi(0.0),
+  fDaughterAtSecEta(0.0),
+  fDaughterAtSecPt(0.0),
+  fsharedITSCluster(0),
+  fchi2perClusterITS(0),
+  fcounterForSharedCluster(0),
+  fDaughterMatchPhi(0.0),
+  fDaughterMatchEta(0.0),
+  fDaughterMatchPt(0.0),
+  fDaughterMatchImpactParameterXY(0.0),
+  fDaughterMatchImpactParameterZ(0.0),
+  fDaughterUnTag(kTRUE),
+  fDaughterMinEta(0.0),
+  fDaughterMaxEta(0.0),
+  fDaughterMinPt(0.0),
+  fDaughterMinNClsTPC(0),
+  fDaughterMinNClsITS(-1),
+  fDaughterMinXRows(0),
+  fDaughterMaxChi2PerNClsTPC(0.0),
+  fDaughterMinXRowsOverNClsFTPC(0.0),
+  fDaughterMinImpactParameterXY(0.0),
+  fDaughterMaxNSigmaPID(0.0),
+  fDaughterSPDRequireAny(kFALSE),
+  fDaughterITSrefit(kFALSE),
+  fMaxchi2perITSCluster(0),
+  fmaxSharedITSCluster(0)   
+{
+  //ctor
+  for(Int_t i=0; i!=100; ++i) fPtBinEdge[i]=0;
+  for(Int_t i=0; i!=6; ++i) fDaughterITSConfig[i]=-1;
+  for(Int_t i=0; i!=2000; ++i) fQTPCA_fID[i]=-1;
+  for(Int_t i=0; i!=2000; ++i) fQTPCC_fID[i]=-1;
+  for(Int_t i=0; i!=64; ++i) fVZEextW[i]=1;
+  DefineInput( 0,TChain::Class());
+  DefineOutput(1,TList::Class());
+  DefineOutput(2,AliFlowEventSimple::Class()); // TPC object
+  DefineOutput(3,AliFlowEventSimple::Class()); // VZE object
+}
+//=======================================================================
+AliAnalysisTaskFlowStrangee::~AliAnalysisTaskFlowStrangee() {
+  //dtor
+  if (fCandidates) delete fCandidates;
+  if (fTPCevent)   delete fTPCevent;
+  if (fVZEevent)   delete fVZEevent;
+  if (fList)       delete fList;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::SetPtEdges(Int_t n, Double_t *p) {
+  fPtBins = n;
+  for(int i=0;i!=n+1;++i) fPtBinEdge[i] = p[i];
+}
+//=======================================================================
+TList* AliAnalysisTaskFlowStrangee::RunTerminateAgain(TList *lst) {
+  if(!lst) return NULL;
+  fList = lst;
+  fSpecie = Int_t( ((TProfile*)((TList*)fList->FindObject("Event"))->FindObject("Configuration"))->GetBinContent(kSpecie) );
+  fSkipSelection = ((TProfile*)((TList*)fList->FindObject("Event"))->FindObject("Configuration"))->GetBinContent(kSkipSelection);
+  fReadMC = ((TProfile*)((TList*)fList->FindObject("Event"))->FindObject("Configuration"))->GetBinContent(kReadMC);
+  Terminate(NULL);
+  return fList;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::PrintConfig() {
+  //DUMP for main task
+  printf("******************************\n");
+  printf("<TASK Configuration> %s\n",GetName());
+  printf("  fDebug %d\n",fDebug);
+  printf("  fQAlevel %d\n",fQAlevel);
+  printf("  fExtraEventRejection %s\n",fExtraEventRejection?"kTRUE":"kFALSE");
+  printf("  fCentMethod %s\n",fCentMethod.Data());
+  printf("    fCentPerMin %d\n",fCentPerMin);
+  printf("    fCentPerMax %d\n",fCentPerMax);
+  printf("  fVextexZcut %f\n",fVertexZcut);
+  printf("  fRunOnpA %s\n",fRunOnpA?"kTRUE":"kFALSE");
+  printf("  fRunOnpp %s\n",fRunOnpp?"kTRUE":"kFALSE");
+  printf("  fReadESD %s\n",fReadESD?"kTRUE":"kFALSE");
+  printf("  fReadMC %s\n",fReadMC?"kTRUE":"kFALSE");
+  if(fReadMC) {
+    printf("    fAddPiToMCReactionPlane %s\n",fAddPiToMCReactionPlane?"kTRUE":"kFALSE");
+    printf("    fPostMatched %d\n",fPostMatched);
+    printf("    fAvoidExec %s\n",fAvoidExec?"kTRUE":"kFALSE");
+    printf("    fSkipCentralitySelection %s\n",fSkipCentralitySelection?"kTRUE":"kFALSE");
+  }
+  printf("  fVZEsave %s\n",fVZEsave?"kTRUE":"kFALSE");
+  if(fVZEload) {
+    printf("  fVZEload %d runs\n",fVZEload->GetEntries());
+    printf("    fVZEmb %s\n",fVZEmb?"kTRUE":"kFALSE");
+    printf("    fVZEByDisk %s\n",fVZEByDisk?"kTRUE":"kFALSE");
+  }
+  printf("  fHarmonic %d\n",fHarmonic);
+  printf("    fWhichPsi %d\n",fWhichPsi);
+  printf("    fVZECa %d\n",fVZECa);
+  printf("    fVZECb %d\n",fVZECb);
+  printf("    fVZEAa %d\n",fVZEAa);
+  printf("    fVZEAb %d\n",fVZEAb);
+  printf("    fRFPFilterBit %d\n",fRFPFilterBit);
+  printf("    fRFPminPt %f\n",fRFPminPt);
+  printf("    fRFPmaxPt %f\n",fRFPmaxPt);
+  printf("    fRFPAminEta %f\n",fRFPAminEta);
+  printf("    fRFPAmaxEta %f\n",fRFPAmaxEta);
+  printf("    fRFPCminEta %f\n",fRFPCminEta);
+  printf("    fRFPCmaxEta %f\n",fRFPCmaxEta);
+  printf("    fRFPmaxIPxy %f\n",fRFPmaxIPxy);
+  printf("    fRFPmaxIPz %f\n",fRFPmaxIPz);
+  printf("    fRFPTPCsignal %f\n",fRFPTPCsignal);
+  printf("    fRFPTPCncls %d\n",fRFPTPCncls);
+  printf("    fExcludeTPCEdges %s\n",fExcludeTPCEdges?"kTRUE":"kFALSE");
+  printf("  fSkipSelection %s\n",fSkipSelection?"kTRUE":"kFALSE");
+  if(!fSkipSelection) {
+    printf("    fSpecie %d\n",fSpecie);
+    printf("    fPtBins %d\n      |",fPtBins);
+    for(int i=0; i!=fPtBins+1; ++i) printf("%f|",fPtBinEdge[i]); printf("\n");
+    if(fSpecie<90) {
+      printf("    fMassBins %d\n",fMassBins);
+      printf("    fMinMass %f\n",fMinMass);
+      printf("    fMaxMass %f\n",fMaxMass);
+    }
+  }
+  printf("  fSkipVn %s\n",fSkipVn?"kTRUE":"kFALSE");
+  if(!fSkipVn) {
+    printf("    fUseFP %s\n",fUseFP?"kTRUE":"kFALSE");
+  }
+  MyPrintConfig();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MyPrintConfig() {
+  // Dump for derived task
+  printf("==================================\n");
+  printf("<FlowStrange> \n");
+  if(!fSkipSelection) {
+    if(fReadESD) {
+      printf("  fOnline %s\n",fOnline?"kTRUE":"kFALSE");
+      printf("  fHomemade %s\n",fHomemade?"kTRUE":"kFALSE");
+    }
+    printf("  fDecayMinEta %f\n",fDecayMinEta);
+    printf("  fDecayMaxEta %f\n",fDecayMaxEta);
+    printf("  fDecayMinPt %f\n",fDecayMinPt);
+    printf("  fDecayMaxDCAdaughters %f\n",fDecayMaxDCAdaughters);
+    printf("  fDecayMinCosinePointingAngleXY %f\n",fDecayMinCosinePointingAngleXY);
+    printf("  fDecayMinQt %f\n",fDecayMinQt);
+    printf("  fDecayAPCutPie %s\n",fDecayAPCutPie?"kTRUE":"kFALSE");
+    printf("  fDecayStopPIDAtPt %f\n",fDecayStopPIDAtPt);
+    printf("  fDecayMinRadXY %f\n",fDecayMinRadXY);
+    printf("  fDecayMaxDecayLength %f\n",fDecayMaxDecayLength);
+    printf("  fDecayMaxProductIPXY %f\n",fDecayMaxProductIPXY);
+    printf("  fDecayMaxRapidity %f\n",fDecayMaxRapidity);
+  }
+  printf("  fDaughterUnTag %s\n",fDaughterUnTag?"kTRUE":"kFALSE");
+  printf("  fDaughterMinEta %f\n",fDaughterMinEta);
+  printf("  fDaughterMaxEta %f\n",fDaughterMaxEta);
+  printf("  fDaughterMinPt %f\n",fDaughterMinPt);
+  printf("  fDaughterMinNClsTPC %d\n",fDaughterMinNClsTPC);
+  printf("  fDaughterMinXRows %d\n",fDaughterMinXRows);
+  printf("  fDaughterMaxChi2PerNClsTPC %f\n",fDaughterMaxChi2PerNClsTPC);
+  printf("  fDaughterMinXRowsOverNClsFTPC %f\n",fDaughterMinXRowsOverNClsFTPC);
+  printf("  fDaughterMinImpactParameterXY %f\n",fDaughterMinImpactParameterXY);
+  printf("  fDaughterMaxNSigmaPID %f\n",fDaughterMaxNSigmaPID);
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::UserCreateOutputObjects() {
+  //UserCreateOutputObjects
+  if(fDebug) PrintConfig();
+  fList=new TList();
+  fList->SetOwner();
+  AddQAEvents();
+  AddQACandidates();
+  if(fReadESD) MakeFilterBits();
+
+  AliFlowCommonConstants *cc = AliFlowCommonConstants::GetMaster();
+  cc->SetNbinsMult(3000); cc->SetMultMin(0);   cc->SetMultMax(30000);
+  cc->SetNbinsPt(100); cc->SetPtMin(0.0);   cc->SetPtMax(20.0);
+  cc->SetNbinsPhi(100);  cc->SetPhiMin(0.0);  cc->SetPhiMax(TMath::TwoPi());
+  cc->SetNbinsEta(100);  cc->SetEtaMin(-5.0); cc->SetEtaMax(+5.0);
+  cc->SetNbinsQ(100);    cc->SetQMin(0.0);    cc->SetQMax(3.0);
+  cc->SetNbinsMass(fMassBins);
+  cc->SetMassMin(fMinMass);
+  cc->SetMassMax(fMaxMass);
+
+  //loading pid response
+  AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
+  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+  fPIDResponse = inputHandler->GetPIDResponse();
+
+  if(fUseFP) {
+    fTPCevent = new AliFlowEvent(100);
+    fVZEevent = new AliFlowEvent(100);
+    //array of candidates
+    fCandidates = new TObjArray(100);
+    fCandidates->SetOwner();
+  }
+  PostData(1,fList);
+  if(fUseFP) { // for connection to the flow package
+    PostData(2,fTPCevent);
+    PostData(3,fVZEevent);
+  }
+
+  gRandom->SetSeed();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MyUserCreateOutputObjects() {
+  TList *tList;
+  TH1D *tH1D;
+  TH2D *tH2D;
+
+  //reconstruction
+  if(fReadESD) {
+    tList=new TList(); tList->SetName("ESD_TrkAll"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("ESD_TrkSel"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+    tH2D = new TH2D("NPAIR", "NPAIR;NPOS;NNEG",1000,0,5000,1000,0,5000); tList->Add(tH2D);
+    tH2D = new TH2D("PtIPXY","PtIPXY;Pt;IPxy", 100,0,10,200,-10,+10); tList->Add(tH2D);
+  }
+  //aod prefilter candidates
+  tList=new TList(); tList->SetName("V0SAll"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
+  tH2D = new TH2D("V0SADC","V0S AFTER DAUGHTER CUTS;V0ALL;V0IMW",100,0,1000,100,0,1000); tList->Add(tH2D);
+  tList=new TList(); tList->SetName("AllDau"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+  //candidates
+  tList=new TList(); tList->SetName("V0SSel"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
+  tList=new TList(); tList->SetName("SelDau"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+  //flow
+  if(!fSkipVn) {
+    tList=new TList(); tList->SetName("V0SAllVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("V0SSelVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+  }
+  // IN-OUT
+  if(fQAlevel>1) {
+    tList=new TList(); tList->SetName("V0SAllIP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("V0SAllOP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("V0SSelIP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("V0SSelOP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
+  }
+  //match
+  if(fReadMC) {
+    tList=new TList(); tList->SetName("STATMC"); tList->SetOwner(); fList->Add(tList);
+    tH1D = new TH1D("Events", "Events",5,0.5,5.5); tList->Add(tH1D);
+    tH1D->GetXaxis()->SetBinLabel(1,"Selected events");
+    tH1D->GetXaxis()->SetBinLabel(2,"Stack found");
+    tH1D->GetXaxis()->SetBinLabel(3,"Daughters in stack");
+    tH1D->GetXaxis()->SetBinLabel(4,"Correspond to decay");
+    tH1D->GetXaxis()->SetBinLabel(5,"Decay has mother");
+    tList=new TList(); tList->SetName("Mth"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthDau"); tList->SetOwner(); AddTrackSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthPosPos"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthNegNeg"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthPosNeg"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthNegDau"); tList->SetOwner(); AddTrackSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthPosDau"); tList->SetOwner(); AddTrackSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("MthFeedDown"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
+    tList=new TList(); tList->SetName("UnMth"); tList->SetOwner(); AddCandidatesSpy(tList,false); fList->Add(tList);
+    tList=new TList(); tList->SetName("UnMthDau"); tList->SetOwner(); AddTrackSpy(tList,false); fList->Add(tList);
+    if(!fSkipVn) {
+      tList=new TList(); tList->SetName("V0SMthVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("V0SMthPosPosVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("V0SMthNegNegVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("V0SMthPosNegVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("V0SUnMthVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+    }
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddQAEvents() {
+  // function to add event qa
+  TH1D *tH1D;
+  TProfile *tProfile;
+  TList *tQAEvents=new TList();
+  tQAEvents->SetName("Event");
+  tQAEvents->SetOwner();
+  tH1D = new TH1D("Events","Number of Events",6,0,6); tQAEvents->Add(tH1D);
+  tH1D->GetXaxis()->SetBinLabel(1,"exec");
+  tH1D->GetXaxis()->SetBinLabel(2,"userexec");
+  tH1D->GetXaxis()->SetBinLabel(3,"reached");
+  tH1D->GetXaxis()->SetBinLabel(4,"selected");
+  tH1D->GetXaxis()->SetBinLabel(5,"rejectedByLowQw");
+  tH1D->GetXaxis()->SetBinLabel(6,"rejectedByErrorLoadVZEcal");
+  tProfile = new TProfile("Configuration","Configuration",10,0.5,10.5); tQAEvents->Add(tProfile);
+  tProfile->Fill(kSpecie,fSpecie,1);
+  tProfile->GetXaxis()->SetBinLabel(kSpecie,"fSpecie");
+  tProfile->Fill(kHarmonic,fHarmonic,1);
+  tProfile->GetXaxis()->SetBinLabel(kHarmonic,"fHarmonic");
+  tProfile->Fill(kReadMC,fReadMC,1);
+  tProfile->GetXaxis()->SetBinLabel(kReadMC,"fReadMC");
+  tProfile->Fill(kSkipSelection,fSkipSelection,1);
+  tProfile->GetXaxis()->SetBinLabel(kSkipSelection,"fSkipSelection");
+  tH1D = new TH1D("POI","POIs;multiplicity",800,0,800);         tQAEvents->Add(tH1D);
+  tH1D = new TH1D("UNTAG","UNTAG;Untagged Daughters",800,0,800);tQAEvents->Add(tH1D);
+  tH1D = new TH1D("RealTime","RealTime;LogT sec",2000,-10,+10); tQAEvents->Add(tH1D);
+  fList->Add(tQAEvents);
+  AddEventSpy("EventsRaw");
+  AddEventSpy("EventsReached");
+  AddEventSpy("EventsSelected");
+  AddEventSpy("EventsAnalyzed");
+  AddMakeQSpy();
+  AddVZEQA();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddEventSpy(TString name) {
+  TH1D *tH1D;
+  TH2D *tH2D;
+  TList *tList=new TList();
+  tList->SetName(name.Data());
+  tList->SetOwner();
+  tH2D = new TH2D("VTXZ","VTXZ;PriVtxZ;SPDVtxZ",60,-25,+25,60,-25,+25); tList->Add( tH2D );
+  tH2D = new TH2D("CCCC","CCCC;V0M;TRK",60,-10,110,60,-10,110);         tList->Add( tH2D );
+  tH2D = new TH2D("HYBTPC","HYBTPC;TPC ONLY;HYBRID",100,0,3000,100,0,3000); tList->Add( tH2D );
+  tH1D = new TH1D("HYBTPCRat","HYBTPCRat;TPC/HYB",120,0.2,2.2); tList->Add( tH1D );
+  tH2D = new TH2D("SPDVZE","SPDVZE;SPD Tracklets;Total Multiplicity in VZERO",100,0,3500,100,0,25000); tList->Add( tH2D );
+  tH1D = new TH1D("SPDVZERat","SPDVZERat;TotalMultiplicityVZERO/SPDTracklets",120,2,+12); tList->Add( tH1D );
+  if(fReadMC) {
+    tH1D = new TH1D("MCEP","MCEP;MCEP",100,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+  }
+  fList->Add(tList);
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillEventSpy(TString name) {
+  ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("VTXZ"))->Fill( fPriVtxZ, fSPDVtxZ );
+  ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("CCCC"))->Fill( fV0M, fTRK );
+  ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("HYBTPC"))->Fill( fRefMultTPC, fRefMultHyb );
+  if(fRefMultHyb>0)
+    ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject("HYBTPCRat"))->Fill( double(fRefMultTPC)/double(fRefMultHyb) );
+  ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("SPDVZE"))->Fill( fSPDtracklets, fVZETotM );
+  if(fSPDtracklets>0)
+    ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject("SPDVZERat"))->Fill( fVZETotM/fSPDtracklets );
+  if(fReadMC) {
+    ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject("MCEP"))->Fill( fMCEP );
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddMakeQSpy() {
+  TH1D *tH1D;
+  TH2D *tH2D;
+  TProfile *tPF1;
+  TList *tList=new TList();
+  tList->SetName("MakeQSpy");
+  tList->SetOwner();
+  fList->Add(tList);
+  tH1D = new TH1D("RFPTPC","TPC Refrence Multiplicity;multiplicity",3000,0,3000);     tList->Add( tH1D );
+  tH1D = new TH1D("RFPVZE","VZERO Reference Multiplicity;multiplicity",3000,0,30000); tList->Add( tH1D );
+  tH1D = new TH1D("QmTPC","TPC Normalized Q vector;|Q|/#sqrt{M}",360,0,7);   tList->Add( tH1D );
+  tH1D = new TH1D("QmVZEA","VZEROA Normalized Q vector;|Q|/#sqrt{W}",360,0,7); tList->Add( tH1D );
+  tH1D = new TH1D("QmVZEC","VZEROC Normalized Q vector;|Q|/#sqrt{W}",360,0,7); tList->Add( tH1D );
+  tH2D = new TH2D("TPCAllPhiEta","TPCall;Phi;Eta",180,0,TMath::TwoPi(),80,-0.9,+0.9); tList->Add( tH2D );
+  tH2D = new TH2D("VZEAllPhiEta","VZEall;Phi;Eta",20,0,TMath::TwoPi(),40,-4.0,+6.0);  tList->Add( tH2D );
+  tH1D = new TH1D("TPCPSI","TPCPSI;PSI",72,0,TMath::Pi()); tList->Add( tH1D );
+  tH1D = new TH1D("TPCPSIA","TPCPSIA;PSIA",72,0,TMath::Pi()); tList->Add( tH1D );
+  tH1D = new TH1D("TPCPSIC","TPCPSIC;PSIC",72,0,TMath::Pi()); tList->Add( tH1D );
+  tH1D = new TH1D("VZEPSI","VZEPSI;PSI",72,0,TMath::Pi()); tList->Add( tH1D );
+  tH1D = new TH1D("VZEPSIA","VZEPSIA;PSIA",72,0,TMath::Pi()); tList->Add( tH1D );
+  tH1D = new TH1D("VZEPSIC","VZEPSIC;PSIC",72,0,TMath::Pi()); tList->Add( tH1D );
+  tH2D = new TH2D("PSI_TPCAVZEC","PSI_TPCAVZEC",72,0,TMath::Pi(),72,0,TMath::Pi()); tList->Add( tH2D );
+  tH2D = new TH2D("PSI_TPCCVZEA","PSI_TPCAVZEC",72,0,TMath::Pi(),72,0,TMath::Pi()); tList->Add( tH2D );
+  tH2D = new TH2D("PSI_TPCVZE","PSI_TPCVZE",72,0,TMath::Pi(),72,0,TMath::Pi()); tList->Add( tH2D );
+  tPF1 = new TProfile("TPCQm","TPCQm",6,0.5,6.5); tList->Add( tPF1 );
+  tPF1->GetXaxis()->SetBinLabel(1,"Qcy"); tPF1->GetXaxis()->SetBinLabel(2,"Qcx");
+  tPF1->GetXaxis()->SetBinLabel(3,"Qay"); tPF1->GetXaxis()->SetBinLabel(4,"Qax");
+  tPF1->GetXaxis()->SetBinLabel(5,"Qy");  tPF1->GetXaxis()->SetBinLabel(6,"Qx");
+  tPF1 = new TProfile("VZEQm","VZEQm",6,0.5,6.5); tList->Add( tPF1 );
+  tPF1->GetXaxis()->SetBinLabel(1,"Qcy"); tPF1->GetXaxis()->SetBinLabel(2,"Qcx");
+  tPF1->GetXaxis()->SetBinLabel(3,"Qay"); tPF1->GetXaxis()->SetBinLabel(4,"Qax");
+  tPF1->GetXaxis()->SetBinLabel(5,"Qy");  tPF1->GetXaxis()->SetBinLabel(6,"Qx");
+  tPF1 = new TProfile("QmVZEAQmVZEC","QmVZEAQmVZEC",1,0.5,1.5,"s"); tList->Add( tPF1 );
+  tPF1 = new TProfile("QmVZEASQUARED","QmVZEASQUARED",1,0.5,1.5,"s"); tList->Add( tPF1 );
+  tPF1 = new TProfile("QmVZECSQUARED","QmVZECSQUARED",1,0.5,1.5,"s"); tList->Add( tPF1 );
+  tPF1 = new TProfile("QmTPCQmVZEA","QmTPCQmVZEA",1,0.5,1.5,"s"); tList->Add( tPF1 );
+  tPF1 = new TProfile("QmTPCQmVZEC","QmTPCQmVZEC",1,0.5,1.5,"s"); tList->Add( tPF1 );
+  tH1D = new TH1D("ChiSquaredVZEA","ChiSquaredVZEC",1,0.5,1.5); tList->Add( tH1D );
+  tH1D = new TH1D("ChiSquaredVZEC","ChiSquaredVZEC",1,0.5,1.5); tList->Add( tH1D );
+  if(fReadMC) {
+    tH1D = new TH1D("PSIMCDIFFTPC","PSIMCDIFFTPC;MC-TPC",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+    tH1D = new TH1D("PSIMCDIFFTPCA","PSIMCDIFFTPCA;MC-TPCA",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+    tH1D = new TH1D("PSIMCDIFFTPCC","PSIMCDIFFTPCC;MC-TPCC",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+    tH1D = new TH1D("PSIMCDIFFVZE","PSIMCDIFFVZE;MC-VZE",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+    tH1D = new TH1D("PSIMCDIFFVZEA","PSIMCDIFFVZEA;MC-VZEA",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+    tH1D = new TH1D("PSIMCDIFFVZEC","PSIMCDIFFVZEC;MC-VZEC",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
+  }
+  tList=new TList(); tList->SetName("TPCRFPall"); tList->SetOwner(); AddTPCRFPSpy(tList); fList->Add(tList);
+  tList=new TList(); tList->SetName("TPCRFPsel"); tList->SetOwner(); AddTPCRFPSpy(tList); fList->Add(tList);
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddQACandidates() {
+  // function to add histogramming for candidates
+  if(fSkipSelection) return;
+  TList *tList;
+  TH1D *tH1D;
+
+  //charge particles (benchmark)
+  if(fSpecie>=90) {
+    tList=new TList(); tList->SetName("TrkAll"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("TrkSel"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+    if(!fSkipVn) {
+      tList=new TList(); tList->SetName("TrkAllVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("TrkSelVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
+    }
+    //match
+    if(fReadMC) {
+      tList=new TList(); tList->SetName("STATMC"); tList->SetOwner(); fList->Add(tList);
+      tH1D = new TH1D("Events", "Events",3,0.5,3.5); tList->Add(tH1D);
+      tH1D->GetXaxis()->SetBinLabel(1,"Selected events");
+      tH1D->GetXaxis()->SetBinLabel(2,"Stack found");
+      tH1D->GetXaxis()->SetBinLabel(3,"Track in stack");
+      tList=new TList(); tList->SetName("Mth"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("MthPos"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+      tList=new TList(); tList->SetName("MthNeg"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
+      if(!fSkipVn) {
+       tList=new TList(); tList->SetName("MthVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
+       tList=new TList(); tList->SetName("MthPosVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
+       tList=new TList(); tList->SetName("MthNegVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
+      }
+    }
+  }
+  //stack
+  if(fReadMC) {
+    tList=new TList(); tList->SetName("MCTPionGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTKaonGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTK0sGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTProtonGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTLdaGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTPhiGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTXiGenAcc");  tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTOmegaGenAcc");  tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTPion"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTKaon"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTK0s"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTLda"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+    tList=new TList(); tList->SetName("MCTProton"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
+  }
+  MyUserCreateOutputObjects();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::Exec(Option_t* option) {
+  // bypassing ::exec (needed because of AMPT)
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(0);
+  if(fAvoidExec) {
+    AliAnalysisTaskFlowStrangee::UserExec(option);
+  } else {
+    AliAnalysisTaskSE::Exec(option);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::UserExec(Option_t *option) {
+  // bridge
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(1);
+  AliAnalysisTaskFlowStrangee::MyUserExec(option);
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MyNotifyRun() {
+  if(fVZEsave) AddVZEROResponse();
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::CalibrateEvent() {
+  if(fVZEsave) SaveVZEROResponse();
+  Bool_t okay=kTRUE;
+  if(fVZEload) {
+    LoadVZEROResponse();
+    if(!fVZEResponse) okay = kFALSE;
+  }
+  return okay;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::AcceptAAEvent(AliESDEvent* tESD) {
+  // ESD reading discontinued: TO BE UPDATED
+  fRunNumber = tESD->GetRunNumber();
+  Double_t acceptEvent=kTRUE;
+  Double_t tTPCVtxZ = tESD->GetPrimaryVertex()->GetZ();
+  if(tESD->GetPrimaryVertex()->GetNContributors()<=0) return kFALSE;
+  Double_t tSPDVtxZ = tESD->GetPrimaryVertexSPD()->GetZ();
+  if(tESD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;
+  // EventCuts
+  AliCentrality *cent = tESD->GetCentrality();
+  Double_t cc1, cc2;
+  cc1 = cent->GetCentralityPercentile("V0M");
+  cc2 = cent->GetCentralityPercentile("TRK");
+  TString mycent = fCentMethod;
+  if(fCentMethod.Contains("V0MTRK")) {
+    acceptEvent = TMath::Abs(cc1-cc2)>5.0?kFALSE:acceptEvent; // a la Alex
+    mycent = "V0M";
+  }
+  fThisCent = cent->GetCentralityPercentile( mycent );
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
+  acceptEvent = TMath::Abs(tTPCVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;
+  acceptEvent = TMath::Abs(tTPCVtxZ)>fVertexZcut?kFALSE:acceptEvent;
+  ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
+  ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("CCCC"))->Fill( cc1, cc2 );
+  // EndOfCuts
+  if(acceptEvent) {
+    ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
+    ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("CCCC"))->Fill( cc1, cc2 );
+  }
+  return acceptEvent;
+  
+  //return kFALSE;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::MinimumRequirementsAA(AliAODEvent *tAOD) {
+  fRunNumber = tAOD->GetRunNumber();
+  AliCentrality *cent = ((AliVAODHeader*)tAOD->GetHeader())->GetCentralityP();
+  fV0M = cent->GetCentralityPercentile("V0M");
+  fTRK = cent->GetCentralityPercentile("TRK");
+  TString mycent = fCentMethod;
+  if(fCentMethod.Contains("V0MTRK")) {
+    mycent = "V0M";
+  }
+  fThisCent = cent->GetCentralityPercentile( mycent );
+  fPriVtxZ = tAOD->GetPrimaryVertex()->GetZ();
+  fSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();
+  fSPDtracklets = tAOD->GetTracklets()->GetNumberOfTracklets();
+  fVZETotM = tAOD->GetVZEROData()->GetMTotV0A() + tAOD->GetVZEROData()->GetMTotV0C();
+  int hyb_fb = 272; // for 2010h::AOD086
+  if(fRunNumber>=166529&&fRunNumber<=170593) {
+    hyb_fb = 768; // for 2011h::AOD145
+  }
+  fRefMultTPC = RefMult(tAOD,128);
+  fRefMultHyb = RefMult(tAOD,hyb_fb);
+  if(fReadMC) {
+    fMCEP = -999;
+    AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(tAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
+    if(mcHeader) {
+      fMCEP = mcHeader->GetReactionPlaneAngle();
+      if(fAddPiToMCReactionPlane) fMCEP += (gRandom->Rndm()>0.5)*TMath::Pi();
+    }
+  }
+  // centrality selection health
+  // cut in Vtx 10 & NContributors
+  if(!fSkipCentralitySelection) if(fThisCent<0||fThisCent>100) return kFALSE;
+  // vtx z position compatibility within 5 mm
+  if(TMath::Abs(fPriVtxZ-fSPDVtxZ)>0.5) return kFALSE;
+  if(fExtraEventRejection) {
+    // specific cuts for 2010h (AOD086)
+    if(fRunNumber>=136851&&fRunNumber<=139517) {
+      if(fRefMultTPC>1.118*fRefMultHyb+100) return kFALSE;
+      if(fRefMultTPC<1.118*fRefMultHyb-100) return kFALSE;
+    }
+    // specific cuts for 2011h (AOD145)
+    if(fRunNumber>=166529&&fRunNumber<=170593) {
+      if(fRefMultTPC>1.205*fRefMultHyb+100) return kFALSE;
+      if(fRefMultTPC<1.205*fRefMultHyb-100) return kFALSE;
+    }
+  }
+  return kTRUE;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::AcceptAAEvent(AliAODEvent *tAOD) {
+  Bool_t minimum = MinimumRequirementsAA(tAOD);
+  FillEventSpy("EventsRaw");
+  if(!minimum) return kFALSE;
+
+  Double_t acceptEvent=kTRUE;
+  TString mycent = fCentMethod;
+  if(fCentMethod.Contains("V0MTRK")) {
+    acceptEvent = TMath::Abs(fV0M-fTRK)>5.0?kFALSE:acceptEvent;
+    mycent = "V0M";
+  }
+  if(!fSkipCentralitySelection) acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
+  acceptEvent = TMath::Abs(fPriVtxZ)>fVertexZcut?kFALSE:acceptEvent; //fVertexZcut?
+  // HISTOGRAMMING
+  FillEventSpy("EventsReached");
+  if(acceptEvent) FillEventSpy("EventsSelected");
+  return acceptEvent;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::AcceptPPEvent(AliAODEvent*) {
+  // PP reading discontinued: TO BE UPDATED
+  /*
+  Double_t acceptEvent=kTRUE;
+  Double_t tVtxZ = tAOD->GetPrimaryVertex()->GetZ();
+  if(tAOD->GetPrimaryVertex()->GetNContributors()<=0) return kFALSE;
+  Double_t tSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();
+  if(tAOD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;
+  // EventCuts
+  AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();
+  Double_t cc1, cc2;
+  cc1 = cent->GetCentralityPercentile("V0M");
+  cc2 = cent->GetCentralityPercentile("TRK");
+  fThisCent = GetReferenceMultiplicity();
+  //for pp i use fCentPerXXX to select on multiplicity
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
+  acceptEvent = TMath::Abs(tVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;
+  acceptEvent = TMath::Abs(tVtxZ)>fVertexZcut?kFALSE:acceptEvent;
+  ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );
+  ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("CCCC"))->Fill( cc1, cc2 );
+  // EndOfCuts
+  if(acceptEvent) {
+    ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );
+    ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("CCCC"))->Fill( cc1, cc2 );
+  }
+  return acceptEvent;
+  */
+  return kFALSE;
+}
+//=======================================================================
+Int_t AliAnalysisTaskFlowStrangee::GetReferenceMultiplicity() { //toberefined
+  AliAODEvent *tAOD = (AliAODEvent *) InputEvent();
+  if(!tAOD) return -1;
+  AliAODTrack *track;
+  Int_t rawN = tAOD->GetNumberOfTracks();
+  Int_t ref=0;
+  for(Int_t id=0; id!=rawN; ++id) {
+    track = dynamic_cast<AliAODTrack*>(tAOD->GetTrack(id));
+    if(!track) AliFatal("Not a standard AOD");
+    if(!track->TestFilterBit(fRFPFilterBit)) continue;
+    ++ref;
+  }
+  return ref;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::AcceptPAEvent(AliAODEvent*) {
+  // PA reading discontinued: TO BE UPDATED
+  /*
+  //if(aod->GetHeader()->GetEventNumberESDFile() == 0) return; //rejecting first chunk NOT NEEDED ANYMORE
+  Int_t bc2 = ((AliVAODHeader*)tAOD->GetHeader())->GetIRInt2ClosestInteractionMap();
+  if(bc2!=0) return kFALSE;
+  Int_t bc1 = ((AliVAODHeader*)tAOD->GetHeader())->GetIRInt1ClosestInteractionMap();
+  if(bc1!=0) return kFALSE;
+  Short_t isPileup = tAOD->IsPileupFromSPD(5);
+  if(isPileup!=0) return kFALSE;
+  if(tAOD->GetHeader()->GetRefMultiplicityComb08()<0) return kFALSE;
+
+  const AliAODVertex* spdVtx = tAOD->GetPrimaryVertexSPD();
+  if(!spdVtx) return kFALSE;
+  if(spdVtx->GetNContributors()<=0) return kFALSE;
+
+  const AliAODVertex* tpcVtx=NULL;
+  Int_t nVertices = tAOD->GetNumberOfVertices();
+  for(Int_t iVertices = 0; iVertices < nVertices; iVertices++){
+    const AliAODVertex* vertex = tAOD->GetVertex(iVertices);
+    if (vertex->GetType() != AliAODVertex::kMainTPC) continue;
+    tpcVtx = vertex;
+  }
+  if(!tpcVtx) return kFALSE;
+  if(tpcVtx->GetNContributors()<=0) return kFALSE;
+  Double_t tTPCVtxZ = tpcVtx->GetZ();
+  Double_t tSPDVtxZ = spdVtx->GetZ();
+  if (TMath::Abs(tSPDVtxZ - tTPCVtxZ)>2.0) return kFALSE;
+  if(plpMV(tAOD)) return kFALSE;
+
+  Double_t acceptEvent=kTRUE;
+  // EventCuts
+  AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();
+  Double_t cc1, cc2;
+  cc1 = cent->GetCentralityPercentile("V0M");
+  cc2 = cent->GetCentralityPercentile("TRK");
+  if(fCentMethod.Contains("V0MTRK")) fCentMethod = "V0M";
+  fThisCent = cent->GetCentralityPercentile( fCentMethod );
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
+  acceptEvent = TMath::Abs(tTPCVtxZ)>fVertexZcut?kFALSE:acceptEvent;
+  // EndOfCuts
+  ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
+  ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("CCCC"))->Fill( cc1, cc2 );
+  if(acceptEvent) {
+    ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
+    ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("CCCC"))->Fill( cc1, cc2 );    
+  }
+  return acceptEvent;
+  */
+  return kFALSE;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MyUserExec(Option_t *) {
+  // MAIN ROUTINE
+  TStopwatch tTime;
+  tTime.Start();
+  if(fDebug) {
+    printf("****************\n");
+    printf("****************\n");
+    printf("**::MyUserExec()\n");
+  }
+  if(fUseFP) fCandidates->SetLast(-1);
+  AliESDEvent *tESD=dynamic_cast<AliESDEvent*>(InputEvent());
+  AliAODEvent *tAOD=dynamic_cast<AliAODEvent*>(InputEvent());
+  Int_t prevRun = fRunNumber;
+  //=>check event
+  Bool_t acceptEvent=kFALSE;
+  if(fReadESD) {
+    if(!tESD) {ResetContainers(); Publish(); return;}
+    acceptEvent = fRunOnpp?kFALSE:fRunOnpA?kFALSE:AcceptAAEvent(tESD);
+  } else {
+    if(!tAOD) {ResetContainers(); Publish(); return;}
+    acceptEvent = fRunOnpp?AcceptPPEvent(tAOD):fRunOnpA?AcceptPAEvent(tAOD):AcceptAAEvent(tAOD);
+  }
+  if(prevRun!=fRunNumber) {
+    MyNotifyRun();
+  }
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(2);
+  //=>does the event clear?
+  if(!acceptEvent) {ResetContainers(); Publish(); return;}
+  // healthy event incomming
+
+  if( !CalibrateEvent() ) { // saves/retrieves/qas VZEROCAL
+    ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(5);
+    ResetContainers(); Publish(); return; // issue retrieving callibration
+  }
+
+  // loads Q vectors
+  MakeQVectors();
+  if(fPsi2<-0.1) {
+    ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(4);
+    ResetContainers(); Publish(); return;
+  }
+  //}
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(3);
+  //=>great, lets do our stuff!
+  FillEventSpy("EventsAnalyzed");
+  FillVZEQA();
+  //=>load candidates
+  if(!fSkipSelection) {
+    if(fReadESD) {
+      ReadFromESD(tESD);
+    } else {
+      if(fSpecie<10) ReadFromAODv0(tAOD);
+      else ChargeParticles(tAOD);
+    }
+    if(fUseFP) AddCandidates();
+    //=>flow
+    //=>done
+  }
+  tTime.Stop();
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("RealTime"))->Fill( TMath::Log( tTime.RealTime() ) );
+  Publish();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::Publish() {
+  PostData(1,fList);
+  if(fUseFP) {
+    PostData(2,fTPCevent);
+    PostData(3,fVZEevent);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ReadFromESD(AliESDEvent *tESD) {
+  AliStack *stack=NULL;
+  if(fReadMC) {
+    AliMCEvent *mcevent=NULL;
+    mcevent = MCEvent();
+    if(mcevent) stack = mcevent->Stack();
+  }
+
+  Int_t num = tESD->GetNumberOfTracks();
+  AliESDtrack *myTrack;
+  Int_t plist[3000], nlist[3000], np=0, nn=0;
+  Double_t pd0[3000], nd0[3000];
+  for (Int_t i=0; i!=num; ++i) {
+    myTrack = (AliESDtrack*) tESD->GetTrack(i);
+    if(!myTrack) continue;
+    LoadTrack(myTrack);
+    FillTrackSpy("ESD_TrkAll");
+    if(!AcceptDaughter(kFALSE,kTRUE)) continue;
+    FillTrackSpy("ESD_TrkSel");
+    ((TH2D*)((TList*)fList->FindObject("ESD_TrkSel"))->FindObject("PtIPXY" ))->Fill( myTrack->Pt(), fDaughterImpactParameterXY );
+    if( myTrack->Charge()>0 ) {
+      pd0[np] = fDaughterImpactParameterXY;
+      plist[np++] = i;
+    } else {
+      nd0[nn] = fDaughterImpactParameterXY;
+      nlist[nn++] = i;
+    }
+  }
+  ((TH1D*)((TList*)fList->FindObject("ESD_TrkSel"))->FindObject("NPAIR" ))->Fill( np,nn );
+  const AliESDVertex *vtx = tESD->GetPrimaryVertex();
+  AliESDtrack *pT, *nT;
+  for(int p=0; p!=np; ++p) {
+    pT = (AliESDtrack*) tESD->GetTrack( plist[p] );
+    for(int n=0; n!=nn; ++n) {
+      nT = (AliESDtrack*) tESD->GetTrack( nlist[n] );
+      fDecayProductIPXY = pd0[p]*nd0[n];
+      AliExternalTrackParam pETP(*pT), nETP(*nT);
+      Double_t xa, xb;
+      pETP.GetDCA(&nETP,tESD->GetMagneticField(),xa,xb);
+      fDecayDCAdaughters = pETP.PropagateToDCA(&nETP,tESD->GetMagneticField());
+      AliESDv0 vertex( nETP,nlist[n], pETP,plist[p] );
+      fDecayCosinePointingAngleXY = CosThetaPointXY( &vertex, vtx );
+      fDecayRadXY = DecayLengthXY( &vertex, vtx );
+      fDecayPt = vertex.Pt();
+      fDecayPhi = vertex.Phi();
+      fDecayEta = vertex.Eta();
+      Double_t pmx, pmy, pmz, nmx, nmy, nmz;
+      vertex.GetNPxPyPz(nmx,nmy,nmz);
+      vertex.GetPPxPyPz(pmx,pmy,pmz);
+      TVector3 mom1(pmx,pmy,pmz), mom2(nmx,nmy,nmz), mom(vertex.Px(),vertex.Py(),vertex.Pz());
+      Double_t qlpos = mom1.Dot(mom)/mom.Mag();
+      Double_t qlneg = mom2.Dot(mom)/mom.Mag();
+      fDecayQt = mom1.Perp(mom);
+      fDecayAlpha = (qlpos-qlneg)/(qlpos+qlneg);
+      Double_t mpi = 0.13957018;
+      if(fSpecie==0) {
+        Double_t eppi = TMath::Sqrt( mpi*mpi + pmx*pmx + pmy*pmy + pmz*pmz );
+        Double_t enpi = TMath::Sqrt( mpi*mpi + nmx*nmx + nmy*nmy + nmz*nmz );
+        fDecayMass = TMath::Sqrt( mpi*mpi + mpi*mpi + 2*(eppi*enpi - pmx*nmx - pmy*nmy - pmz*nmz ) );
+        fDecayRapidity = vertex.RapK0Short();
+      } else {
+        Double_t mpr = 0.938272013;
+        Double_t epi, epr;
+        if(fDecayAlpha>0) {
+          epr = TMath::Sqrt( mpr*mpr + pmx*pmx + pmy*pmy + pmz*pmz );
+          epi = TMath::Sqrt( mpi*mpi + nmx*nmx + nmy*nmy + nmz*nmz );
+        } else {
+          epi = TMath::Sqrt( mpi*mpi + pmx*pmx + pmy*pmy + pmz*pmz );
+          epr = TMath::Sqrt( mpr*mpr + nmx*nmx + nmy*nmy + nmz*nmz );
+        }
+        fDecayMass = TMath::Sqrt( mpi*mpi + mpr*mpr + 2*(epi*epr - pmx*nmx - pmy*nmy - pmz*nmz ) );
+        fDecayRapidity = vertex.RapLambda();
+      }
+      Double_t energy = TMath::Sqrt( fDecayMass*fDecayMass + vertex.Px()*vertex.Px() + vertex.Py()*vertex.Py() + vertex.Pz()*vertex.Pz() );
+      Double_t gamma = energy/fDecayMass;
+      fDecayDecayLength = DecayLength( &vertex, vtx )/gamma;
+      fDecayDecayLengthLab = DecayLength( &vertex, vtx );
+      Double_t dPHI = fDecayPhi;
+      Double_t dDPHI = dPHI - fPsi2;
+      if( dDPHI < 0 ) dDPHI += TMath::TwoPi();
+      if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;
+      if(fQAlevel>1) {
+        if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SAllOP");
+        else FillCandidateSpy("V0SAllIP");
+      }
+      FillCandidateSpy("V0SAll");
+      ((TH2D*)((TList*)fList->FindObject("V0SAll"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );
+      ((TH2D*)((TList*)fList->FindObject("V0SAll"))->FindObject("XPOSXNEG"))->Fill( xa, xb );
+      if(!AcceptCandidate()) continue;
+      if(fDecayMass<fMinMass) continue;
+      if(fDecayMass>fMaxMass) continue;
+      // PID missing
+      if(fQAlevel>1) {
+        if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SSelOP");
+        else FillCandidateSpy("V0SSelIP");
+      }
+      FillCandidateSpy("V0SSel");
+      ((TH2D*)((TList*)fList->FindObject("V0SSel"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );
+      ((TH2D*)((TList*)fList->FindObject("V0SSel"))->FindObject("XPOSXNEG"))->Fill( xa, xb );
+
+      fDecayIDneg = nT->GetID();
+      fDecayIDpos = pT->GetID();
+      if(fUseFP) MakeTrack();
+      LoadTrack(pT); FillTrackSpy("SelDau");
+      LoadTrack(nT); FillTrackSpy("SelDau");
+
+      //===== BEGIN OF MCMATCH
+      if(stack) {
+        bool matched = false;
+        Int_t labelpos = pT->GetLabel();
+        Int_t labelneg = nT->GetLabel();
+        Double_t rOri=-1;
+        if( labelpos>0 && labelneg>0 ) {
+          TParticle *mcpos = stack->Particle( labelpos );
+          TParticle *mcneg = stack->Particle( labelneg );
+          Int_t pdgRecPos = mcpos->GetPdgCode();
+          Int_t pdgRecNeg = mcneg->GetPdgCode();
+          if( pdgRecPos==211&&pdgRecNeg==-211 ) if(mcpos->GetMother(0)>0) {
+            if( mcpos->GetMother(0)==mcneg->GetMother(0) ) {
+              TParticle *mcmot = stack->Particle( mcpos->GetMother(0) );
+              rOri = TMath::Sqrt( mcmot->Vx()*mcmot->Vx() + mcmot->Vy()*mcmot->Vy() );
+              if( TMath::Abs(mcmot->GetPdgCode())==310) {
+                if(mcmot->GetNDaughters()==2) matched=true;
+              }
+            }
+          }
+        }
+        if(matched) {
+          FillCandidateSpy("Mth");
+          ((TH2D*)((TList*)fList->FindObject("Mth"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );
+          ((TH2D*)((TList*)fList->FindObject("Mth"))->FindObject("XPOSXNEG"))->Fill( xa, xb );
+          ((TH1D*)((TList*)fList->FindObject("Mth"))->FindObject("MCOrigin"))->Fill( rOri );
+          LoadTrack(pT); FillTrackSpy("MthDau");
+          LoadTrack(nT); FillTrackSpy("MthDau");
+        }
+      }
+      //===== END OF MCMATCH
+    }
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ReadStack(TClonesArray* mcArray) {
+  if(!mcArray) return;
+  AliAODMCParticle *myMCTrack;//, *iMCDau, *jMCDau;
+  for(int i=0; i!=mcArray->GetEntriesFast(); ++i) {
+    myMCTrack = dynamic_cast<AliAODMCParticle*>(mcArray->At( i ));
+    if(!myMCTrack) continue;
+    /*
+    int tPDG=310;
+    if(fSpecie>0) tPDG = 3122;
+    if( TMath::Abs(myMCTrack->PdgCode())==tPDG )
+      if( myMCTrack->GetNDaughters() == 2 ) {
+        Int_t iDau = myMCTrack->GetDaughter(0);
+        Int_t jDau = myMCTrack->GetDaughter(1);
+        AliAODMCParticle *posDau=NULL;
+        AliAODMCParticle *negDau=NULL;
+        if(iDau>0&&jDau>0) {
+          iMCDau = dynamic_cast<AliAODMCParticle*>(mcArray->At( iDau ));
+          jMCDau = dynamic_cast<AliAODMCParticle*>(mcArray->At( jDau ));
+          if(iMCDau) {
+            if(iMCDau->Charge()>0) posDau=iMCDau;
+            else negDau=iMCDau;
+          }
+          if(jMCDau) {
+            if(jMCDau->Charge()>0) posDau=jMCDau;
+            else negDau=jMCDau;
+          }
+        } //got two daughters
+        if(posDau&&negDau) {
+          Double_t dx = myMCTrack->Xv() - posDau->Xv();
+          Double_t dy = myMCTrack->Yv() - posDau->Yv();
+          Double_t dz = myMCTrack->Zv() - posDau->Zv();
+          fDecayRadXY = TMath::Sqrt( dx*dx + dy*dy );
+          TVector3 momPos(posDau->Px(),posDau->Py(),posDau->Pz());
+          TVector3 momNeg(negDau->Px(),negDau->Py(),negDau->Pz());
+          TVector3 momTot(myMCTrack->Px(),myMCTrack->Py(),myMCTrack->Pz());
+          Double_t qlpos = momPos.Dot(momTot)/momTot.Mag();
+          Double_t qlneg = momNeg.Dot(momTot)/momTot.Mag();
+          fDecayQt = momPos.Perp(momTot);
+          fDecayAlpha = 1.-2./(1.+qlpos/qlneg);
+          fDecayMass = myMCTrack->GetCalcMass();
+          Double_t energy = myMCTrack->E();
+          Double_t gamma = energy/fDecayMass;
+          fDecayDecayLength = TMath::Sqrt(dx*dx+dy*dy+dz*dz)/gamma;
+          fDecayPt = myMCTrack->Pt();
+          fDecayPhi = myMCTrack->Phi();
+          fDecayEta = myMCTrack->Eta();
+          fDecayRapidity = myMCTrack->Y();
+          fDecayDCAdaughters = 0;
+          fDecayCosinePointingAngleXY = 1;
+          fDecayProductIPXY = -1;
+          if(AcceptCandidate()) FillCandidateSpy("GenTru");
+        }
+      } // k0/lda with two daughters
+    */
+    //==== BEGIN TRACK CUTS
+    if(myMCTrack->Eta()<-0.8) continue;
+    if(myMCTrack->Eta()>+0.8) continue;
+    if(myMCTrack->Y()<-0.5) continue;
+    if(myMCTrack->Y()>+0.5) continue;
+    //==== END TRACK CUTS
+    switch( TMath::Abs(myMCTrack->PdgCode()) ) {
+    case (211): //pi
+      FillMCParticleSpy( "MCTPion", myMCTrack );
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTPionGenAcc", myMCTrack );
+      break;
+    case (321): //kaon
+      FillMCParticleSpy( "MCTKaon", myMCTrack );
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTKaonGenAcc", myMCTrack );
+      break;
+    case (310): //k0s
+      FillMCParticleSpy( "MCTK0s", myMCTrack );
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTK0sGenAcc", myMCTrack );
+      break;
+    case (2212): //proton
+      FillMCParticleSpy( "MCTProton", myMCTrack );
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTProtonGenAcc", myMCTrack );
+      break;
+    case (3122): //lda
+      FillMCParticleSpy( "MCTLda", myMCTrack );
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTLdaGenAcc", myMCTrack );
+      break;
+    case (333): //phi
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTPhiGenAcc", myMCTrack );
+      break;
+    case (3312): //xi
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTXiGenAcc", myMCTrack );
+      break;
+    case (3334): //omega
+      if( myMCTrack->IsPrimary() )
+        FillMCParticleSpy( "MCTOmegaGenAcc", myMCTrack );
+      break;
+    }
+  }
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::CosThetaPointXY(AliESDv0 *me, const AliVVertex *vtx) {
+  TVector3 mom( me->Px(), me->Py(), 0 );
+  TVector3 fli( me->Xv()-vtx->GetX(), me->Yv()-vtx->GetY(), 0 );
+  Double_t ctp = mom.Dot(fli) / mom.Mag() / fli.Mag();
+  return ctp;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::CosThetaPointXY(AliAODv0 *me, const AliVVertex *vtx) {
+  TVector3 mom( me->Px(), me->Py(), 0 );
+  TVector3 fli( me->Xv()-vtx->GetX(), me->Yv()-vtx->GetY(), 0 );
+  Double_t ctp = mom.Dot(fli) / mom.Mag() / fli.Mag();
+  return ctp;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::DecayLengthXY(AliESDv0 *me, const AliVVertex *vtx) {
+  Double_t dx = me->Xv()-vtx->GetX();
+  Double_t dy = me->Yv()-vtx->GetY();
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy );
+  return dxy;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::DecayLengthXY(AliAODv0 *me, const AliVVertex *vtx) {
+  Double_t dx = me->Xv()-vtx->GetX();
+  Double_t dy = me->Yv()-vtx->GetY();
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy );
+  return dxy;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::DecayLength(AliESDv0 *me, const AliVVertex *vtx) {
+  Double_t dx = me->Xv()-vtx->GetX();
+  Double_t dy = me->Yv()-vtx->GetY();
+  Double_t dz = me->Zv()-vtx->GetZ();
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy + dz*dz );
+  return dxy;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::DecayLength(AliAODv0 *me, const AliVVertex *vtx) {
+  Double_t dx = me->Xv()-vtx->GetX();
+  Double_t dy = me->Yv()-vtx->GetY();
+  Double_t dz = me->Zv()-vtx->GetZ();
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy + dz*dz );
+  return dxy;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ReadFromAODv0(AliAODEvent *tAOD) {
+  TClonesArray* mcArray=NULL;
+  if(fReadMC) {
+    mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));
+    ReadStack(mcArray);
+  }
+
+  Int_t nV0s = tAOD->GetNumberOfV0s();
+  AliAODv0 *myV0;
+  Int_t v0all=0, v0imw=0;
+  for (Int_t i=0; i!=nV0s; ++i) {
+    myV0 = (AliAODv0*) tAOD->GetV0(i);
+    if(!myV0) continue;
+    if(!fOnline) if(myV0->GetOnFlyStatus() ) continue;
+    if(fOnline) if(!myV0->GetOnFlyStatus() ) continue;
+
+    fDecayPt = myV0->Pt();
+    fDecayPhi = myV0->Phi();
+    fDecayEta = myV0->Eta();
+
+    AliAODTrack *iT, *jT;
+    AliAODVertex *vtx = tAOD->GetPrimaryVertex();
+    Double_t pos[3],cov[6];
+    vtx->GetXYZ(pos);
+    vtx->GetCovarianceMatrix(cov);
+    const AliESDVertex vESD(pos,cov,100.,100);
+    // TESTING CHARGE
+    int iPos, iNeg;
+    iT=(AliAODTrack*) myV0->GetDaughter(0);
+    if(iT->Charge()>0) {
+      iPos = 0; iNeg = 1;
+    } else {
+      iPos = 1; iNeg = 0;
+    }
+    // END OF TEST
+
+    iT=(AliAODTrack*) myV0->GetDaughter(iPos); // positive
+    AliESDtrack ieT( iT );
+    ieT.SetTPCClusterMap( iT->GetTPCClusterMap() );
+    ieT.SetTPCSharedMap( iT->GetTPCSharedMap() );
+    ieT.SetTPCPointsF( iT->GetTPCNclsF() );
+    ieT.PropagateToDCA(&vESD, tAOD->GetMagneticField(), 100);
+    LoadTrack(&ieT,iT->Chi2perNDF());
+    Float_t ip[2];
+    ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+    fDaughterImpactParameterXY = ip[0];
+    fDaughterImpactParameterZ = ip[1];
+    fDecayIPpos = fDaughterImpactParameterXY; //ieT.GetD(pos[0], pos[1], tAOD->GetMagneticField());
+    FillTrackSpy("AllDau");
+    if(!AcceptDaughter(fDecayPt<2.0?kTRUE:kFALSE)) continue;
+
+    jT=(AliAODTrack*) myV0->GetDaughter(iNeg); // negative
+    AliESDtrack jeT( jT );
+    jeT.SetTPCClusterMap( jT->GetTPCClusterMap() );
+    jeT.SetTPCSharedMap( jT->GetTPCSharedMap() );
+    jeT.SetTPCPointsF( jT->GetTPCNclsF() );
+    jeT.PropagateToDCA(&vESD, tAOD->GetMagneticField(), 100);
+    LoadTrack(&jeT,jT->Chi2perNDF());
+    jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+    fDaughterImpactParameterXY = ip[0];
+    fDaughterImpactParameterZ = ip[1];
+    fDecayIPneg = fDaughterImpactParameterXY; //jeT.GetD(pos[0], pos[1], tAOD->GetMagneticField());
+    FillTrackSpy("AllDau");
+    if(!AcceptDaughter(fDecayPt<2.0?kTRUE:kFALSE)) continue;
+
+    if( fExcludeTPCEdges ) {
+      if( IsAtTPCEdge(iT->Phi(),iT->Pt(),+1,tAOD->GetMagneticField()) ) continue;
+      if( IsAtTPCEdge(jT->Phi(),jT->Pt(),-1,tAOD->GetMagneticField()) ) continue;
+    }
+    ieT.GetDCA(&jeT,tAOD->GetMagneticField(),fDecayXpos,fDecayXneg);
+    /*
+    // cutting out population close to TPC edges :: strange excess saw in 2010
+    if( fExcludeTPCEdges ) {
+    Double_t phimod = myV0->Phi();
+    int sectors[6] = {5,6,9,10,11,12};
+    for(int ii=0; ii!=6; ++ii)
+    if( (phimod<(sectors[ii]+1)*TMath::Pi()/9.0) && (phimod>sectors[ii]*TMath::Pi()/9.0) )
+    return 0;
+    }
+    */
+    if(fSpecie==0)
+      fDecayRapidity = myV0->RapK0Short();
+    else
+      fDecayRapidity = myV0->RapLambda();
+    fDecayDCAdaughters = myV0->DcaV0Daughters();
+    fDecayCosinePointingAngleXY = CosThetaPointXY( myV0, vtx );
+    fDecayRadXY = DecayLengthXY( myV0, vtx );
+    fDecayProductIPXY = fDecayIPpos*fDecayIPneg;
+    fDecayQt = myV0->PtArmV0();
+    fDecayAlpha = myV0->AlphaV0(); // AlphaV0 -> AODRecoDecat::Alpha -> return 1.-2./(1.+QlProng(0)/QlProng(1));
+    if(myV0->ChargeProng(iPos)<0) fDecayAlpha = -fDecayAlpha; // protects for a change in convention
+    fDecayPt = myV0->Pt();
+    fDecayEta = myV0->Eta();
+    if( fSpecie==0 ) {
+      fDecayMass = myV0->MassK0Short();
+    } else {
+      if(fDecayAlpha>0) fDecayMass = myV0->MassLambda();
+      else fDecayMass = myV0->MassAntiLambda();
+    }
+    v0all++;
+    if(fDecayMass<fMinMass) continue;
+    if(fDecayMass>fMaxMass) continue;
+    v0imw++;
+    Double_t energy = TMath::Sqrt( fDecayMass*fDecayMass + myV0->Px()*myV0->Px() + myV0->Py()*myV0->Py() + myV0->Pz()*myV0->Pz() );
+    Double_t gamma = energy/fDecayMass;
+    fDecayDecayLength = DecayLength( myV0, vtx )/gamma;
+    fDecayDecayLengthLab = DecayLength( myV0, vtx );
+    Double_t dPHI = fDecayPhi;
+    Double_t dDPHI = dPHI - fPsi2;
+    if( dDPHI < 0 ) dDPHI += TMath::TwoPi();
+    if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;
+    if(fQAlevel>1) {
+      if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SAllOP");
+      else FillCandidateSpy("V0SAllIP");
+    }
+    FillCandidateSpy("V0SAll");
+    if(!fSkipVn)
+      FillDecayVn("V0SAllVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+    
+    if(!AcceptCandidate()) continue;
+
+    if(fDecayPt<fDecayStopPIDAtPt) {
+      if( fSpecie==0 ) {//PID for kzero::pion+pion
+        if( !PassesPIDCuts(&ieT,AliPID::kPion) ) continue; //positive track
+        if( !PassesPIDCuts(&jeT,AliPID::kPion) ) continue; //negative track
+      } else { //PID for lambda::proton+pion
+        if(fDecayAlpha>0) {
+          if( !PassesPIDCuts(&ieT,AliPID::kProton) ) continue; //positive track
+         if( !PassesPIDCuts(&jeT,AliPID::kPion) ) continue; //negative track
+        } else {
+          if( !PassesPIDCuts(&jeT,AliPID::kProton) ) continue; //negative track
+         if( !PassesPIDCuts(&ieT,AliPID::kPion) ) continue; //positive track
+        }
+      }
+    }
+    if(fQAlevel>1) {
+      if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SSelOP");
+      else FillCandidateSpy("V0SSelIP");
+    }
+    FillCandidateSpy("V0SSel");
+    if(!fSkipVn)
+      FillDecayVn("V0SSelVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+    // ============================
+    // Posting for FlowAnalysis
+    if(!fPostMatched) {
+      fDecayIDneg = iT->GetID();
+      fDecayIDpos = jT->GetID();
+      if(fUseFP) MakeTrack();
+    }
+    // ============================
+    LoadTrack(&ieT,iT->Chi2perNDF());
+    ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+    fDaughterImpactParameterXY = ip[0];
+    fDaughterImpactParameterZ = ip[1];
+    FillTrackSpy("SelDau");
+    LoadTrack(&jeT,jT->Chi2perNDF()); 
+    jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+    fDaughterImpactParameterXY = ip[0];
+    fDaughterImpactParameterZ = ip[1];
+    FillTrackSpy("SelDau");
+    //===== BEGIN OF MCMATCH
+    if(fReadMC) ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 1 ); // Selected event
+    if(mcArray) {
+      ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 2 ); // Stack found
+      bool matched = false;
+      bool feeddown = false;
+      Int_t labelpos = iT->GetLabel();
+      Int_t labelneg = jT->GetLabel();
+      AliAODMCParticle *mcpos = (AliAODMCParticle*) mcArray->At( TMath::Abs(labelpos) );
+      AliAODMCParticle *mcneg = (AliAODMCParticle*) mcArray->At( TMath::Abs(labelneg) );
+      if( mcpos && mcneg ) {
+        ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 3 ); // Daughters in stack
+        Int_t pdgRecPos = mcpos->GetPdgCode();
+        Int_t pdgRecNeg = mcneg->GetPdgCode();
+        int pospdg=211, negpdg=211;
+        int mompdg=310, fdwpdg=333;
+        if(fSpecie>0) {
+          mompdg=3122;
+          fdwpdg=3312;
+          if(fDecayAlpha>0) {
+            pospdg=2212; negpdg=211;
+          } else {
+            negpdg=2212; pospdg=211;
+          }
+        }
+        if( TMath::Abs(pdgRecPos)==pospdg&&TMath::Abs(pdgRecNeg)==negpdg )
+          if(mcpos->GetMother()>-1)
+            if( mcpos->GetMother()==mcneg->GetMother() ) {
+              AliAODMCParticle *mcmot = (AliAODMCParticle*) mcArray->At( mcpos->GetMother() );
+              fDecayMatchOrigin = TMath::Sqrt( mcmot->Xv()*mcmot->Xv() + mcmot->Yv()*mcmot->Yv() );
+              fDecayMatchPt = mcmot->Pt();
+              fDecayMatchEta = mcmot->Eta();
+              fDecayMatchPhi = mcmot->Phi();
+              if( TMath::Abs(mcmot->GetPdgCode())==mompdg) {
+                if(mcmot->GetNDaughters()==2) {
+                 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 4 ); // Correspond to decay
+                  matched=true;
+                  Double_t dx = mcmot->Xv() - mcpos->Xv();
+                  Double_t dy = mcmot->Yv() - mcpos->Yv();
+                  fDecayMatchRadXY = TMath::Sqrt( dx*dx + dy*dy );
+                }
+                if(mcmot->GetMother()>-1) {
+                 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 5 ); // Decay has mother
+                  AliAODMCParticle *mcfdw = (AliAODMCParticle*) mcArray->At( mcmot->GetMother() );
+                  if( TMath::Abs(mcfdw->GetPdgCode())==fdwpdg)
+                    feeddown=true;
+                } // k0/lda have mother
+              } // mother matches k0/lda
+            } // both have same mother
+      }
+      if(matched) {
+        FillCandidateSpy("Mth",true);
+       if(!fSkipVn)
+         FillDecayVn("V0SMthVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+       if(fPostMatched>0) {
+         fDecayIDneg = iT->GetID();
+         fDecayIDpos = jT->GetID();
+         if(fUseFP) MakeTrack();
+       }
+       if(labelpos<0&&labelneg<0) {
+         FillCandidateSpy("MthNegNeg",true);
+         if(!fSkipVn)
+           FillDecayVn("V0SMthNegNegVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+       } else if(labelpos>0&&labelneg>0) {
+         if(!fSkipVn)
+           FillDecayVn("V0SMthPosPosVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+       } else if(labelpos*labelneg<0) {
+         FillCandidateSpy("MthPosNeg",true);
+         if(!fSkipVn)
+           FillDecayVn("V0SMthPosNegVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+       }
+       AliAODVertex *secvtx = myV0->GetSecondaryVtx();
+       Double_t possec[3],covsec[6];
+       secvtx->GetXYZ(possec);
+       secvtx->GetCovarianceMatrix(covsec);
+       const AliESDVertex vSecVtx(possec,covsec,100.,100);
+       AliESDtrack trackAtSecI( iT );
+       trackAtSecI.SetTPCClusterMap( iT->GetTPCClusterMap() );
+       trackAtSecI.SetTPCSharedMap( iT->GetTPCSharedMap() );
+       trackAtSecI.SetTPCPointsF( iT->GetTPCNclsF() );
+       trackAtSecI.PropagateToDCA(&vSecVtx, tAOD->GetMagneticField(), 100);
+       fDaughterAtSecPhi = trackAtSecI.Phi();
+       fDaughterAtSecEta = trackAtSecI.Eta();
+       fDaughterAtSecPt = trackAtSecI.Pt();
+        LoadTrack(&ieT,iT->Chi2perNDF());
+       fDaughterMatchPhi=mcpos->Phi();
+       fDaughterMatchEta=mcpos->Eta();
+       fDaughterMatchPt=mcpos->Pt();
+        ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+        fDaughterImpactParameterXY = ip[0];
+        fDaughterImpactParameterZ = ip[1];
+        FillTrackSpy("MthDau",true);
+       if(labelpos<0||labelneg<0) FillTrackSpy("MthNegDau",true);
+       else FillTrackSpy("MthPosDau",true);
+       AliESDtrack trackAtSecJ( jT );
+       trackAtSecJ.SetTPCClusterMap( jT->GetTPCClusterMap() );
+       trackAtSecJ.SetTPCSharedMap( jT->GetTPCSharedMap() );
+       trackAtSecJ.SetTPCPointsF( jT->GetTPCNclsF() );
+       trackAtSecJ.PropagateToDCA(&vSecVtx, tAOD->GetMagneticField(), 100);
+       fDaughterAtSecPhi = trackAtSecJ.Phi();
+       fDaughterAtSecEta = trackAtSecJ.Eta();
+       fDaughterAtSecPt = trackAtSecJ.Pt();
+        LoadTrack(&jeT,jT->Chi2perNDF());
+       fDaughterMatchPhi=mcneg->Phi();
+       fDaughterMatchEta=mcneg->Eta();
+       fDaughterMatchPt=mcneg->Pt();
+        jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+        fDaughterImpactParameterXY = ip[0];
+        fDaughterImpactParameterZ = ip[1];
+        FillTrackSpy("MthDau",true);
+       if(labelpos<0||labelneg<0) FillTrackSpy("MthNegDau",true);
+       else FillTrackSpy("MthPosDau",true);
+      } else {
+        FillCandidateSpy("UnMth",false);
+       if(!fSkipVn)
+         FillDecayVn("V0SUnMthVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
+       if(fPostMatched<0) {
+         fDecayIDneg = iT->GetID();
+         fDecayIDpos = jT->GetID();
+         if(fUseFP) MakeTrack();
+       }
+        LoadTrack(&ieT,iT->Chi2perNDF());
+        ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+        fDaughterImpactParameterXY = ip[0];
+        fDaughterImpactParameterZ = ip[1];
+        FillTrackSpy("UnMthDau",false);
+        LoadTrack(&jeT,jT->Chi2perNDF());
+        jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+        fDaughterImpactParameterXY = ip[0];
+        fDaughterImpactParameterZ = ip[1];
+        FillTrackSpy("UnMthDau",false);
+      }
+      if(feeddown) {
+        FillCandidateSpy("MthFeedDown",true);
+      }
+    }
+    //===== END OF MCMATCH
+  }
+  ((TH2D*)((TList*)fList->FindObject("V0SAll"))->FindObject("V0SADC"))->Fill( v0all,v0imw );
+  if(!fSkipVn) {
+    QCStoreDecayVn("V0SAllVn");
+    QCStoreDecayVn("V0SSelVn");
+    if(fReadMC) {
+      QCStoreDecayVn("V0SMthVn");
+      QCStoreDecayVn("V0SMthNegNegVn");
+      QCStoreDecayVn("V0SMthPosPosVn");
+      QCStoreDecayVn("V0SMthPosNegVn");
+    }
+  }
+  return;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::PassesPIDCuts(AliESDtrack *myTrack, AliPID::EParticleType pid) {
+  Bool_t pass=kTRUE;
+  if(fPIDResponse) {
+    fDaughterNSigmaPID = fPIDResponse->NumberOfSigmasTPC(myTrack,pid);
+    if( TMath::Abs(fDaughterNSigmaPID) > fDaughterMaxNSigmaPID )
+      pass = kFALSE;
+  }
+  return pass;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ChargeParticles(AliAODEvent *tAOD) {
+  //benchmark purposes
+  if(!tAOD) return;
+  TClonesArray* mcArray=NULL;
+  if(fReadMC) {
+    mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));
+    ReadStack(mcArray);
+  }
+  for(int i=0; i!=tAOD->GetNumberOfTracks(); ++i) {
+    AliAODTrack *t = dynamic_cast<AliAODTrack*>(tAOD->GetTrack( i ));
+    if(!t) continue;
+    if( !t->TestFilterBit(1) ) continue;
+    fDecayMass=0.0; // using mass as nsigmas control plot
+    if(fPIDResponse) { // PID
+      switch(fSpecie) { // TPC PID only
+      case(kPION):
+        fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kPion);
+        break;
+      case(kKAON):
+        fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kKaon);
+        break;
+      case(kPROTON):
+        fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kProton);
+        break;
+      }
+    }
+    Bool_t pass = kTRUE;
+    if( TMath::Abs(fDecayMass) > 3.0 ) pass=kFALSE;
+    if( t->Eta()<-0.5 || t->Eta()>+0.5 ) pass=kFALSE;
+    if( t->Pt()<0.2 || t->Pt()>20.0 ) pass=kFALSE;
+    AliESDtrack et( t );
+    et.SetTPCClusterMap( t->GetTPCClusterMap() );
+    et.SetTPCSharedMap( t->GetTPCSharedMap() );
+    et.SetTPCPointsF( t->GetTPCNclsF() );
+    Float_t ip[2];
+    LoadTrack(&et,t->Chi2perNDF()); 
+    AliAODVertex *vtx = tAOD->GetPrimaryVertex();
+    Double_t pos[3];
+    vtx->GetXYZ(pos);
+    et.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+    fDaughterImpactParameterXY = ip[0];
+    fDaughterImpactParameterZ = ip[1];
+
+    FillTrackSpy("TrkAll");
+    if(!fSkipVn)
+      FillTrackVn("TrkAllVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
+    if(!pass) continue;
+    FillTrackSpy("TrkSel");
+    if(!fSkipVn)
+      FillTrackVn("TrkSelVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
+    if(fReadMC) {
+      ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 1 ); // Selected event 
+      if(mcArray) {
+       ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 2 ); // Stack found
+       bool matched = false;
+       Int_t label = t->GetLabel();
+       AliAODMCParticle *mcpar = (AliAODMCParticle*) mcArray->At( TMath::Abs(label) );
+       if( mcpar ) {
+         ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 3 ); // Particle in stack
+         Int_t pdgmcpar = TMath::Abs(mcpar->GetPdgCode());
+         switch(fSpecie) {
+         case(kPION):
+           if(pdgmcpar==211) matched = true;
+           break;
+         case(kKAON):
+           if(pdgmcpar==211) matched = true;
+           break;
+         case(kPROTON):
+           if(pdgmcpar==2212) matched = true;
+           break;
+         }
+         if(!mcpar->IsPrimary()) matched = false;
+       }
+       if(matched) {
+         FillTrackSpy("Mth");
+         if(!fSkipVn)
+           FillTrackVn("MthVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
+         if(label<0) {
+           FillTrackSpy("MthNeg");
+           if(!fSkipVn)
+             FillTrackVn("MthNegVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
+         } else {
+           FillTrackSpy("MthPos");
+           if(!fSkipVn)
+             FillTrackVn("MthPosVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
+         }
+       }
+      }
+    }
+    if(fUseFP) {
+      fDecayPt=t->Pt();
+      fDecayPhi=t->Phi();
+      fDecayEta=t->Eta();
+      fDecayID=t->GetID();
+      MakeTrack();
+    }
+  }
+  if(!fSkipVn) {
+    QCStoreTrackVn("TrkAllVn");
+    QCStoreTrackVn("TrkSelVn");
+    if(fReadMC) {
+      QCStoreTrackVn("MthVn");
+      QCStoreTrackVn("MthNegVn");
+      QCStoreTrackVn("MthPosVn");
+    }
+  }
+  return;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ComputeChi2VZERO() {
+  Double_t MeanQaQc = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEAQmVZEC"))->GetBinContent( 1 );
+  Double_t MeanQaQa = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEASQUARED"))->GetBinContent( 1 );
+  Double_t MeanQcQc = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZECSQUARED"))->GetBinContent( 1 );
+  Double_t MeanQaQt = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEA"))->GetBinContent( 1 );
+  Double_t MeanQcQt = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEC"))->GetBinContent( 1 );
+  if(!TMath::AreEqualAbs(MeanQaQt,0,1e-10)&&!TMath::AreEqualAbs(MeanQcQt,0,1e-10)&&!TMath::AreEqualAbs(MeanQaQc,0,1e-10)) {
+    Double_t OneOverChiSquaredVZEA = MeanQaQa*MeanQcQt/MeanQaQc/MeanQaQt-1;
+    Double_t OneOverChiSquaredVZEC = MeanQcQc*MeanQaQt/MeanQaQc/MeanQcQt-1;
+    if(!TMath::AreEqualAbs(OneOverChiSquaredVZEA,0,1e-10)&&!TMath::AreEqualAbs(OneOverChiSquaredVZEC,0,1e-10)) {
+      ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEA"))->SetBinContent( 1, 1/OneOverChiSquaredVZEA );
+      ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEC"))->SetBinContent( 1, 1/OneOverChiSquaredVZEC );
+    }
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::Terminate(Option_t *) {
+  //terminate
+  if(fSkipTerminate) return;
+  ComputeChi2VZERO();
+  if(fSkipSelection) return;
+  if(fSkipVn) return;
+  if(fSpecie<10) {
+    ComputeDecayVn("V0SAllVn");
+    ComputeDecayVn("V0SSelVn");
+    if(fReadMC) {
+      ComputeDecayVn("V0SMthVn");
+      ComputeDecayVn("V0SMthPosPosVn");
+      ComputeDecayVn("V0SMthNegNegVn");
+      ComputeDecayVn("V0SMthPosNegVn");
+      ComputeDecayVn("V0SUnMthVn");
+    }
+  } else {
+    ComputeTrackVn("TrkAllVn");
+    ComputeTrackVn("TrkSelVn");
+    if(fReadMC) {
+      ComputeTrackVn("MthVn");
+      ComputeTrackVn("MthPosVn");
+      ComputeTrackVn("MthNegVn");
+    }
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeTrack() {
+  // create track for flow tasks
+  if(fCandidates->GetLast()+5>fCandidates->GetSize()) {
+    fCandidates->Expand( fCandidates->GetSize()+20 );
+  }
+  Bool_t overwrite = kTRUE;
+  AliFlowCandidateTrack *oTrack = (static_cast<AliFlowCandidateTrack*> (fCandidates->At( fCandidates->GetLast()+1 )));
+  if( !oTrack ) { // creates new
+    oTrack = new AliFlowCandidateTrack();
+    overwrite = kFALSE;
+  } else { // overwrites
+    oTrack->ClearMe();
+  }
+  oTrack->SetMass(fDecayMass);
+  oTrack->SetPt(fDecayPt);
+  oTrack->SetPhi(fDecayPhi);
+  oTrack->SetEta(fDecayEta);
+  if(fSpecie<10) {
+    oTrack->AddDaughter(fDecayIDpos);
+    oTrack->AddDaughter(fDecayIDneg);
+  } else {
+    oTrack->SetID( fDecayID );
+  }
+  oTrack->SetForPOISelection(kTRUE);
+  oTrack->SetForRPSelection(kFALSE);
+  if(overwrite) {
+    fCandidates->SetLast( fCandidates->GetLast()+1 );
+  } else {
+    fCandidates->AddLast(oTrack);
+  }
+  return;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddCandidates() {
+  // adds candidates to flow events (untaging if necessary)
+  if(fDebug) printf("FlowEventTPC %d tracks | %d RFP | %d POI\n",fTPCevent->NumberOfTracks(),fTPCevent->GetNumberOfRPs(),fTPCevent->GetNumberOfPOIs());
+  if(fDebug) printf("FlowEventVZE %d tracks | %d RFP | %d POI\n",fVZEevent->NumberOfTracks(),fVZEevent->GetNumberOfRPs(),fVZEevent->GetNumberOfPOIs());
+  if(fDebug) printf("I received %d candidates\n",fCandidates->GetEntriesFast());
+  Int_t untagged=0;
+  Int_t poi=0;
+  for(int iCand=0; iCand!=fCandidates->GetEntriesFast(); ++iCand ) {
+    AliFlowCandidateTrack *cand = static_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));
+    if(!cand) continue;
+    cand->SetForPOISelection(kTRUE);
+    cand->SetForRPSelection(kFALSE);
+    poi++;
+    //if(fDebug) printf(" >Checking at candidate %d with %d daughters: mass %f\n",iCand,cand->GetNDaughters(),cand->Mass());
+    if(fSpecie<10) { // DECAYS
+      // untagging ===>
+      if(fDaughterUnTag) {
+       for(int iDau=0; iDau!=cand->GetNDaughters(); ++iDau) {
+         if(fDebug) printf("  >Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau));
+         for(int iRPs=0; iRPs!=fTPCevent->NumberOfTracks(); ++iRPs ) {
+           AliFlowTrack *iRP = static_cast<AliFlowTrack*>(fTPCevent->GetTrack( iRPs ));
+           if(!iRP) continue;
+           if(!iRP->InRPSelection()) continue;
+           if(cand->GetIDDaughter(iDau) == iRP->GetID()) {
+             if(fDebug) printf(" was in RP set");
+             ++untagged;
+             iRP->SetForRPSelection(kFALSE);
+             fTPCevent->SetNumberOfRPs( fTPCevent->GetNumberOfRPs() -1 );
+           }
+         }
+         if(fDebug) printf("\n");
+       }
+      }
+      // <=== untagging 
+      fTPCevent->InsertTrack( ((AliFlowTrack*) cand) );
+    } else {  // CHARGED
+      // adding only new tracks and tagging accordingly ===>
+      Bool_t found=kFALSE;
+      for(int iRPs=0; iRPs!=fTPCevent->NumberOfTracks(); ++iRPs ) {
+        AliFlowTrack *iRP = static_cast<AliFlowTrack*>(fTPCevent->GetTrack( iRPs ));
+        if(!iRP) continue;
+        if(!iRP->InRPSelection()) continue;
+        if(cand->GetID() == iRP->GetID()) {
+          if(fDebug) printf("  >charged track (%d) was also found in RP set (adding poi tag)\n",cand->GetID());
+         iRP->SetMass( cand->Mass() );
+          iRP->SetForPOISelection(kTRUE);
+          found = kTRUE;
+        }
+      }
+      if(!found) // not found adding track
+        fTPCevent->InsertTrack( ((AliFlowTrack*) cand) );
+    }
+    fVZEevent->InsertTrack( ((AliFlowTrack*) cand) );
+  } //END OF LOOP
+  fTPCevent->SetNumberOfPOIs( poi );
+  fVZEevent->SetNumberOfPOIs( poi );
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("POI"))->Fill( poi );
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("UNTAG"))->Fill( untagged );
+  if(fDebug) printf("FlowEventTPC %d tracks | %d RFP | %d POI\n",fTPCevent->NumberOfTracks(),fTPCevent->GetNumberOfRPs(),fTPCevent->GetNumberOfPOIs());
+  if(fDebug) printf("FlowEventVZE %d tracks | %d RFP | %d POI\n",fVZEevent->NumberOfTracks(),fVZEevent->GetNumberOfRPs(),fVZEevent->GetNumberOfPOIs());
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::PushBackFlowTrack(AliFlowEvent *flowevent, Double_t pt, Double_t phi, Double_t eta, Double_t w, Int_t id) {
+  AliFlowTrack rfp;
+  rfp.SetPt(pt);
+  rfp.SetPhi(phi);
+  rfp.SetEta(eta);
+  rfp.SetWeight(w);
+  rfp.SetForRPSelection(kTRUE);
+  rfp.SetForPOISelection(kFALSE);
+  rfp.SetMass(-999);
+  rfp.SetID(id);
+  flowevent->InsertTrack( &rfp );
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::IsAtTPCEdge(Double_t phi,Double_t pt,Int_t charge,Double_t b) {
+  // Origin: Alex Dobrin
+  // Implemented by Carlos Perez
+  TF1 cutLo("cutLo", "-0.01/x+pi/18.0-0.015", 0, 100);
+  TF1 cutHi("cutHi", "0.55/x/x+pi/18.0+0.03", 0, 100);
+  Double_t phimod = phi;
+  if(b<0) phimod = TMath::TwoPi()-phimod;  //for negatve polarity field
+  if(charge<0) phimod = TMath::TwoPi()-phimod; //for negatve charge
+  phimod += TMath::Pi()/18.0;
+  phimod = fmod(phimod, TMath::Pi()/9.0);
+  if( phimod<cutHi.Eval(pt) && phimod>cutLo.Eval(pt) )
+    return kTRUE;
+
+  return kFALSE;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeQVectors() {
+  //computes event plane and updates fPsi2
+  //if there is a problem fPsi->-1
+  fPsi2=-1;
+  fVZEWarning=kFALSE;
+  //=>loading event
+  MakeQVZE(InputEvent());
+  MakeQTPC(InputEvent());
+  if(fUseFP&&fReadMC) {
+    fVZEevent->SetMCReactionPlaneAngle( fMCEP );    
+    fTPCevent->SetMCReactionPlaneAngle( fMCEP );    
+  }
+  if(fDebug) {
+    printf("**::MakeQVectors()");
+    printf("  fQVZEACos %.16f | fQVZEASin %.16f || fQVZEA %.3f | fQVZEC %.3f \n",fQVZEACos, fQVZEASin, fQVZEA, fQVZEC);
+    printf("  nQTPA_nTracks %d | fQTPC_nTracks %d || fQTPCA %.3f | fQTPCC %.3f \n",fQTPCA_nTracks, fQTPCC_nTracks, fQTPCA, fQTPCC);
+    printf("  fQTPCACos %.16f | fQTPCASin %.16f || fQTPC2hCos %.16f | fQTPC2hSin %.16f \n",fQTPCACos, fQTPCASin, fQTPC2hCos, fQTPC2hSin);
+   }
+  FillMakeQSpy();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillMakeQSpy() {
+  //=>computing psi
+  //VZERO
+  Double_t qvzecos,qvzesin,psivzea,psivzec,psivze,qvze, qvzea, qvzec;
+  psivzea = ( TMath::Pi()+TMath::ATan2(-fQVZEASin,-fQVZEACos) )/fHarmonic;
+  psivzec = ( TMath::Pi()+TMath::ATan2(-fQVZECSin,-fQVZECCos) )/fHarmonic;
+  qvzecos = fQVZEACos + fQVZECCos;
+  qvzesin = fQVZEASin + fQVZECSin;
+  qvzea = fQVZEA;
+  qvzec = fQVZEC;
+  qvze = fQVZEA + fQVZEC;
+  psivze = ( TMath::Pi()+TMath::ATan2(-qvzesin,-qvzecos) )/fHarmonic;
+  //TPC
+  Double_t qtpccos,qtpcsin,psitpca,psitpcc,psitpc,qtpc;
+  psitpca = ( TMath::Pi()+TMath::ATan2(-fQTPCASin,-fQTPCACos) )/fHarmonic;
+  psitpcc = ( TMath::Pi()+TMath::ATan2(-fQTPCCSin,-fQTPCCCos) )/fHarmonic;
+  qtpccos = fQTPCACos + fQTPCCCos;
+  qtpcsin = fQTPCASin + fQTPCCSin;
+  qtpc = fQTPCA + fQTPCC;
+  psitpc = ( TMath::Pi()+TMath::ATan2(-qtpcsin,-qtpccos) )/fHarmonic;
+  //=>does the event clear?
+  switch(fWhichPsi) {
+  case(1): //VZERO
+    if(fVZEWarning) return;
+    fPsi2 = psivze;
+    break;
+  case(2): //TPC
+    if(fQTPCA<2||fQTPCC<2) return;
+    fPsi2 = psitpc;
+    break;
+  }
+  //computing physical Qm vectors
+  Double_t vzec_qmcos = fQVZECCos/fQVZEC;
+  Double_t vzec_qmsin = fQVZECSin/fQVZEC;
+  Double_t vzec_qmnor = TMath::Sqrt( vzec_qmcos*vzec_qmcos + vzec_qmsin*vzec_qmsin );
+  Double_t vzea_qmcos = fQVZEACos/fQVZEA;
+  Double_t vzea_qmsin = fQVZEASin/fQVZEA;
+  Double_t vzea_qmnor = TMath::Sqrt( vzea_qmcos*vzea_qmcos + vzea_qmsin*vzea_qmsin );
+  Double_t vze_qmcos = qvzecos/qvze;
+  Double_t vze_qmsin = qvzesin/qvze;
+  Double_t vze_qmnor = TMath::Sqrt( vze_qmcos*vze_qmcos + vze_qmsin*vze_qmsin );
+  Double_t tpcc_qmcos = fQTPCCCos/fQTPCC;
+  Double_t tpcc_qmsin = fQTPCCSin/fQTPCC;
+  Double_t tpcc_qmnor = TMath::Sqrt( tpcc_qmcos*tpcc_qmcos + tpcc_qmsin*tpcc_qmsin );
+  Double_t tpca_qmcos = fQTPCACos/fQTPCA;
+  Double_t tpca_qmsin = fQTPCASin/fQTPCA;
+  Double_t tpca_qmnor = TMath::Sqrt( tpca_qmcos*tpca_qmcos + tpca_qmsin*tpca_qmsin );
+  Double_t tpc_qmcos = qtpccos/qtpc;
+  Double_t tpc_qmsin = qtpcsin/qtpc;
+  Double_t tpc_qmnor = TMath::Sqrt( tpc_qmcos*tpc_qmcos + tpc_qmsin*tpc_qmsin );
+  //=>great! recording
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSI"))->Fill( psivze );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSIA"))->Fill( psivzea );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSIC"))->Fill( psivzec );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("RFPVZE"))->Fill( qvze );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEA"))->Fill( vzea_qmnor*TMath::Sqrt(qvzea) );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEC"))->Fill( vzec_qmnor*TMath::Sqrt(qvzec) );
+  //------
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSI"))->Fill( psitpc );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSIA"))->Fill( psitpca );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSIC"))->Fill( psitpcc );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("RFPTPC"))->Fill( qtpc );
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPC"))->Fill( tpc_qmnor*TMath::Sqrt(qtpc) );
+  //------
+  ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSI_TPCAVZEC"))->Fill( psitpca, psivzec );
+  ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSI_TPCCVZEA"))->Fill( psitpcc, psivzea );
+  ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSI_TPCVZE"))->Fill( psitpc, psivze );
+
+  if(fReadMC) {
+    ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFTPC"))->Fill( psitpc-fMCEP );
+    ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFTPCA"))->Fill( psitpca-fMCEP );
+    ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFTPCC"))->Fill( psitpcc-fMCEP );
+    ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFVZE"))->Fill( psivze-fMCEP );
+    ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFVZEA"))->Fill( psivzea-fMCEP );
+    ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFVZEC"))->Fill( psivzec-fMCEP );
+  }
+  //------
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 1., tpcc_qmsin, tpcc_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 2., tpcc_qmcos, tpcc_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 3., tpca_qmsin, tpca_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 4., tpca_qmcos, tpca_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 5., tpc_qmsin, tpc_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 6., tpc_qmcos, tpc_qmnor );
+  //------
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 1., vzec_qmsin, vzec_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 2., vzec_qmcos, vzec_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 3., vzea_qmsin, vzea_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 4., vzea_qmcos, vzea_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 5., vze_qmsin, vze_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 6., vze_qmcos, vze_qmnor );
+  //------
+  Double_t vzeqaqc = vzec_qmcos*vzea_qmcos + vzec_qmsin*vzea_qmsin;
+  Double_t vzeqatpcq = vzea_qmcos*tpc_qmcos + vzea_qmsin*tpc_qmsin;
+  Double_t vzeqctpcq = vzec_qmcos*tpc_qmcos + vzec_qmsin*tpc_qmsin;
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEAQmVZEC"))->Fill( 1., vzeqaqc, vze_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEASQUARED"))->Fill( 1., vzea_qmnor*vzea_qmnor, vze_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZECSQUARED"))->Fill( 1., vzec_qmnor*vzec_qmnor, vze_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEA"))->Fill( 1., vzeqatpcq, vze_qmnor );
+  ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEC"))->Fill( 1., vzeqctpcq, vze_qmnor );
+  return;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeQVZE(AliVEvent *tevent) {
+  //=>cleaning
+  if(fUseFP) fVZEevent->ClearFast(); // flowpackage
+  //=>computing
+  fQVZEACos=fQVZEASin=fQVZEA=fQVZECCos=fQVZECSin=fQVZEC=0;
+  Int_t rfp=0;
+  Double_t eta, phi, w;
+  //v0c -> qa
+  for(int id=fVZECa*8;id!=8+fVZECb*8;++id) {
+    eta = -3.45+0.5*(id/8);
+    phi = TMath::PiOver4()*(0.5+id%8);
+    w = tevent->GetVZEROEqMultiplicity(id);
+    if(w<3) fVZEWarning=kTRUE;
+    w *= fVZEextW[id];
+    fQVZECCos += w*TMath::Cos(fHarmonic*phi);
+    fQVZECSin += w*TMath::Sin(fHarmonic*phi);
+    fQVZEC += w;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta, w );
+    rfp++;
+    if(fUseFP) PushBackFlowTrack(fVZEevent,0,phi,eta,w,0); // flowpackage
+  }
+  //v0a -> qb
+  for(int id=32+fVZEAa*8;id!=40+fVZEAb*8;++id) {
+    eta = +4.8-0.6*((id/8)-4);
+    phi = TMath::PiOver4()*(0.5+id%8);
+    w = tevent->GetVZEROEqMultiplicity(id);
+    if(w<3) fVZEWarning=kTRUE;
+    w *= fVZEextW[id];
+    fQVZEACos += w*TMath::Cos(fHarmonic*phi);
+    fQVZEASin += w*TMath::Sin(fHarmonic*phi);
+    fQVZEA += w;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta, w );
+    rfp++;
+    if(fUseFP) PushBackFlowTrack(fVZEevent,0,phi,eta,w,0); // flowpackage
+  }
+  if(fUseFP) { // flowpackage
+    fVZEevent->SetNumberOfRPs(rfp);
+    if(fDebug>0) printf("Inserted tracks in FlowEventVZE %d ==> %.1f\n",fVZEevent->NumberOfTracks(),fQVZEC+fQVZEA);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddTPCRFPSpy(TList *me) {
+  TH1D *tH1D;
+  tH1D = new TH1D("PT",   "PT",           50,0,5);     me->Add(tH1D);
+  tH1D = new TH1D("PHI",  "PHI", 90,0,TMath::TwoPi()); me->Add(tH1D);
+  tH1D = new TH1D("ETA",  "ETA",          40,-1,+1);   me->Add(tH1D);
+  tH1D = new TH1D("TPCS", "TPC Signal",   100,0,500);  me->Add(tH1D);
+  tH1D = new TH1D("IPXY", "IPXY",         100,-2,+2);  me->Add(tH1D);
+  tH1D = new TH1D("IPZ",  "IPZ",          100,-2,+2);  me->Add(tH1D);
+  // TPC
+  tH1D = new TH1D("TPCNCLS", "NCLS", 170,-0.5,+169.5);   me->Add(tH1D);
+  tH1D = new TH1D("TPCSHCL", "NSCLS / NCLS", 100,0,1);   me->Add(tH1D);
+  tH1D = new TH1D("TPCFICL", "NCLS1I / NCLS",100,0,1);   me->Add(tH1D);
+  tH1D = new TH1D("TPCXRNF", "XROW / NFCLS", 100,0,1.5); me->Add(tH1D);
+  tH1D = new TH1D("TPCRCHI", "CHI2 / NCLS",  50,0,5);    me->Add(tH1D);
+  // ITS
+  tH1D = new TH1D("ITSNCLS", "NCLS",   7,-0.5,+6.5); me->Add(tH1D);
+  tH1D = new TH1D("ITSRCHI", "CHI2 / NCLS", 50,0,5); me->Add(tH1D);
+
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::PassesRFPTPCCuts(AliESDtrack *track, Double_t aodchi2cls, Float_t aodipxy, Float_t aodipz) {
+  if(track->GetKinkIndex(0)>0) return kFALSE;
+  if( (track->GetStatus()&AliESDtrack::kTPCrefit)==0 ) return kFALSE;
+  Double_t pt = track->Pt();
+  Double_t phi = track->Phi();
+  Double_t eta = track->Eta();
+  Double_t tpcs = track->GetTPCsignal();
+  Float_t ipxy, ipz;
+  track->GetImpactParameters(ipxy,ipz);
+  Int_t cls = track->GetTPCclusters(0);
+  Double_t xrows, findcls, chi2;
+  findcls = track->GetTPCNclsF();
+  xrows = track->GetTPCCrossedRows();
+  chi2 = track->GetTPCchi2();
+  Double_t rchi2 = chi2/cls;
+  if(!fReadESD) {
+    rchi2 = aodchi2cls;
+    ipxy = aodipxy;
+    ipz = aodipz;
+  }
+  Double_t xrnfcls = xrows/findcls;
+  Double_t scls, cls1i, itschi2;
+  Int_t itscls;
+  cls1i = track->GetTPCNclsIter1();
+  scls = track->GetTPCnclsS();
+  itscls = track->GetITSclusters(0);
+  itschi2 = track->GetITSchi2();
+  Double_t shcl = scls/cls;
+  Double_t ficl = cls1i/cls;
+  Double_t itsrchi2 = itscls/itschi2;
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("PT"))->Fill( pt );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("PHI"))->Fill( phi );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ETA"))->Fill( eta );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCS"))->Fill( tpcs );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("IPXY"))->Fill( ipxy );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("IPZ"))->Fill( ipz );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCNCLS"))->Fill( cls );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCSHCL"))->Fill( shcl );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCFICL"))->Fill( ficl );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCXRNF"))->Fill( xrnfcls );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCRCHI"))->Fill( rchi2 );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ITSNCLS"))->Fill( itscls );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ITSRCHI"))->Fill( itsrchi2 );
+  if(pt<fRFPminPt) return kFALSE; //0.2
+  if(pt>fRFPmaxPt) return kFALSE; //5.0
+  if(eta<fRFPCminEta||(eta>fRFPCmaxEta&&eta<fRFPAminEta)||eta>fRFPAmaxEta) return kFALSE; // -0.8 0.0 0.0 +0.8
+  if(tpcs<fRFPTPCsignal) return kFALSE; //10.0
+  if( TMath::Sqrt(ipxy*ipxy/fRFPmaxIPxy/fRFPmaxIPxy+ipz*ipz/fRFPmaxIPz/fRFPmaxIPz)>1 ) return kFALSE; //2.4 3.2
+  if(cls<fRFPTPCncls) return kFALSE; //70
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("PT"))->Fill( pt );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("PHI"))->Fill( phi );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ETA"))->Fill( eta );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCS"))->Fill( tpcs );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("IPXY"))->Fill( ipxy );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("IPZ"))->Fill( ipz );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCNCLS"))->Fill( cls );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCSHCL"))->Fill( shcl );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCFICL"))->Fill( ficl );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCXRNF"))->Fill( xrnfcls );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCRCHI"))->Fill( rchi2 );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ITSNCLS"))->Fill( itscls );
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ITSRCHI"))->Fill( itsrchi2 );
+  return kTRUE;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeQTPC(AliVEvent *tevent) {
+  AliESDEvent *tESD = (AliESDEvent*) (tevent);
+  AliAODEvent *tAOD = (AliAODEvent*) (tevent);
+  if(fReadESD) {
+    if(!tESD) return;
+    MakeQTPC(tESD);
+  } else {
+    if(!tAOD) return;
+    MakeQTPC(tAOD);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeQTPC(AliAODEvent *tAOD) {
+  //=>cleaning
+  if(fUseFP) fTPCevent->ClearFast(); // flowpackage
+  fQTPCACos=fQTPCASin=fQTPCA=fQTPC2hCos=0;
+  fQTPCCCos=fQTPCCSin=fQTPCC=fQTPC2hSin=0;
+  fQTPCA_nTracks = 0;
+  fQTPCC_nTracks = 0;
+  Int_t rfp=0;
+  Double_t eta, phi, w;
+  //=>aod stuff
+  AliAODVertex *vtx = tAOD->GetPrimaryVertex();
+  Double_t pos[3],cov[6];
+  vtx->GetXYZ(pos);
+  vtx->GetCovarianceMatrix(cov);
+  const AliESDVertex vESD(pos,cov,100.,100);
+  AliAODTrack *track;
+  //=>looping
+  Int_t rawN = tAOD->GetNumberOfTracks();
+  for(Int_t id=0; id!=rawN; ++id) {
+    track = dynamic_cast<AliAODTrack*>(tAOD->GetTrack(id));
+    if(!track) {
+        AliFatal("Not a standard AOD");
+        return;
+    }
+    //=>cuts
+    if(!track->TestFilterBit(fRFPFilterBit)) continue;
+    if( fExcludeTPCEdges )
+      if( IsAtTPCEdge( track->Phi(), track->Pt(), track->Charge(), tAOD->GetMagneticField() ) )        continue;
+    AliESDtrack etrack( track );
+    etrack.SetTPCClusterMap( track->GetTPCClusterMap() );
+    etrack.SetTPCSharedMap( track->GetTPCSharedMap() );
+    etrack.SetTPCPointsF( track->GetTPCNclsF() );
+    Float_t ip[2];
+    etrack.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
+    if(!PassesRFPTPCCuts(&etrack,track->Chi2perNDF(),ip[0],ip[1])) continue;
+    //=>collecting info
+    phi = track->Phi();
+    eta = track->Eta();
+    w = 1;
+    if(eta<0) {
+      fQTPCCCos += w*TMath::Cos(fHarmonic*phi);
+      fQTPCCSin += w*TMath::Sin(fHarmonic*phi);
+      fQTPCC += w;
+      fQTPCC_fID[fQTPCC_nTracks++] = track->GetID();
+    } else {
+      fQTPCACos += w*TMath::Cos(fHarmonic*phi);
+      fQTPCASin += w*TMath::Sin(fHarmonic*phi);
+      fQTPCA += w;
+      fQTPCA_fID[fQTPCA_nTracks++] = track->GetID();
+    }
+    fQTPC2hCos += w*TMath::Cos(2.0*fHarmonic*phi);
+    fQTPC2hSin += w*TMath::Sin(2.0*fHarmonic*phi);
+    rfp++;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta, w );
+    if(fUseFP) PushBackFlowTrack(fTPCevent,track->Pt(),phi,eta,w,track->GetID()); // flow package
+  }
+  if(fUseFP) {
+    fTPCevent->SetNumberOfRPs(rfp);
+    if(fDebug) printf("Inserted tracks in FlowEventTPC %d ==> %.1f\n",fTPCevent->NumberOfTracks(),fQTPCA+fQTPCC);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeQTPC(AliESDEvent *tESD) {
+  //=>cleaning
+  if(fUseFP) fTPCevent->ClearFast(); // flow package
+  fQTPCACos=fQTPCASin=fQTPCA=0;
+  fQTPCCCos=fQTPCCSin=fQTPCC=0;
+  fQTPCA_nTracks = 0;
+  fQTPCC_nTracks = 0;
+  Int_t rfp=0;
+  Double_t eta, phi, w;
+  //=>looping
+  AliESDtrack *track;
+  Int_t rawN = tESD->GetNumberOfTracks();
+  for(Int_t id=0; id!=rawN; ++id) {
+    track = tESD->GetTrack(id);
+    //=>cuts
+    if( fExcludeTPCEdges )
+      if( IsAtTPCEdge( track->Phi(), track->Pt(), track->Charge(), tESD->GetMagneticField() ) )        continue;
+    if(!PassesFilterBit(track)) continue;
+    if(!PassesRFPTPCCuts(track)) continue;
+    //=>collecting info
+    phi = track->Phi();
+    eta = track->Eta();
+    w = 1;
+    if(eta<0) {
+      fQTPCCCos += w*TMath::Cos(fHarmonic*phi);
+      fQTPCCSin += w*TMath::Sin(fHarmonic*phi);
+      fQTPCC += w;
+      fQTPCC_fID[fQTPCC_nTracks++] = track->GetID();
+    } else {
+      fQTPCACos += w*TMath::Cos(fHarmonic*phi);
+      fQTPCASin += w*TMath::Sin(fHarmonic*phi);
+      fQTPCA += w;
+      fQTPCA_fID[fQTPCA_nTracks++] = track->GetID();
+    }
+    rfp++;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta, w );
+    if(fUseFP) PushBackFlowTrack(fTPCevent,track->Pt(),phi,eta,w,track->GetID()); // flowpackage
+  }
+  if(fUseFP) {
+    fTPCevent->SetNumberOfRPs(rfp);
+    if(fDebug) printf("Inserted tracks in FlowEventTPC %d ==> %.1f\n",fTPCevent->NumberOfTracks(),fQTPCA+fQTPCC);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddMCParticleSpy(TList *me) {
+  TH1D *tH1D;
+  TH2D *tH2D;
+  TProfile *tPro;
+  tH1D = new TH1D("Pt",   "Pt",   fPtBins,fPtBinEdge);  me->Add(tH1D);
+  tH1D = new TH1D("Phi",  "Phi",  100,0,TMath::TwoPi()); me->Add(tH1D);
+  tH1D = new TH1D("Eta",  "Eta",  100,-1,+1);   me->Add(tH1D);
+  tH1D = new TH1D("Y",    "Y",    100,-1,+1);   me->Add(tH1D);
+  tH1D = new TH1D("Rad2", "Rad2", 1000,0,+100); me->Add(tH1D);
+  tH2D = new TH2D("Dphi", "phi-MCEP;pt;dphi",fPtBins,fPtBinEdge, 72,0,TMath::Pi()); me->Add(tH2D);
+  tPro = new TProfile("Cos2dphi","Cos2dphi",fPtBins,fPtBinEdge); me->Add(tPro);
+  return;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillMCParticleSpy(TString listName, AliAODMCParticle *p) {
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Pt" ))->Fill( p->Pt() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Eta" ))->Fill( p->Eta() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Y" ))->Fill( p->Y() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Phi" ))->Fill( p->Phi() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Rad2" ))->Fill( TMath::Sqrt( p->Xv()*p->Xv() +
+                                                                                                p->Yv()*p->Yv() ) );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Dphi" ))->Fill( p->Pt(), GetMCDPHI(p->Phi()) );
+  ((TProfile*)((TList*)fList->FindObject(listName.Data()))->FindObject("Cos2dphi" ))->Fill( p->Pt(), TMath::Cos( 2*GetMCDPHI(p->Phi()) ), 1 );
+  return;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::GetMCDPHI(Double_t phi) {
+  Double_t dDPHI = phi - fMCEP;
+  //if( dDPHI < 0 ) dDPHI += TMath::TwoPi();
+  //if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;
+  return dDPHI;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillMCParticleSpy(TString listName, TParticle *p) {
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Pt" ))->Fill( p->Pt() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Eta" ))->Fill( p->Eta() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Phi" ))->Fill( p->Phi() );
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Rad2" ))->Fill( TMath::Sqrt( p->Vx()*p->Vx() +
+                                                                                                p->Vy()*p->Vy() ) );
+  return;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddCandidatesSpy(TList *me,Bool_t res) {
+  TH1D *tH1D;
+  TH2D *tH2D;
+  TProfile *tPro;
+  TProfile2D *tPro2;
+  tH2D = new TH2D("PhiEta",  "PhiEta;Phi;Eta", 100,0,TMath::TwoPi(),100,-1,+1);  me->Add(tH2D);
+  tH2D = new TH2D("PtRAP",   "PtRAP;Pt;Y",     fPtBins,fPtBinEdge,100,-1,+1);  me->Add(tH2D);
+  tH2D = new TH2D("PtDCA",   "PtDCA;Pt;DCA",   fPtBins,fPtBinEdge,100,0,1.5);  me->Add(tH2D);
+  tH2D = new TH2D("PtCTP",   "PtCTP;Pt;CTP",   fPtBins,fPtBinEdge,100,0.95,+1);me->Add(tH2D);
+  tH2D = new TH2D("PtD0D0",  "PtD0D0;Pt;D0D0", fPtBins,fPtBinEdge,100,-5,+5);  me->Add(tH2D);
+  tH2D = new TH2D("PtRad2",  "PtRad2;Pt;RadXY",fPtBins,fPtBinEdge,100,0,+50);  me->Add(tH2D);
+  tH2D = new TH2D("PtDL",    "PtDL;Pt;DL",     fPtBins,fPtBinEdge,100,0,+50);  me->Add(tH2D);
+  tH2D = new TH2D("PtDLlab", "PtDL;Pt;DLlab",  fPtBins,fPtBinEdge,100,0,+100); me->Add(tH2D);
+  tH2D = new TH2D("PtMASS",  "PtMASS;Pt;MASS", fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); me->Add(tH2D);
+  tH2D = new TH2D("APPOS",   "APPOS;alphaPOS;QtPOS",100,-2,+2,100,0,0.3);     me->Add(tH2D);
+  tH2D = new TH2D("D0PD0N",  "D0PD0N;D0P;D0N",      200,-10,+10,200,-10,+10); me->Add(tH2D);
+  tH2D = new TH2D("XPOSXNEG","XPOSXNEG;XPOS;XNEG",  200,-50,+50,200,-50,+50); me->Add(tH2D);
+  if(fReadMC) {
+    if(res) {
+      tH1D = new TH1D("MCOrigin","MCOrigin;Rad2",   1000,0,50); me->Add(tH1D);
+      tH2D = new TH2D("PHIRes","PHIRes;PHI;MC-DAT", 72,0,TMath::TwoPi(),100,-0.12,+0.12); me->Add(tH2D);
+      tH2D = new TH2D("ETARes","ETARes;ETA;MC-DAT", 16,-0.8,+0.8,100,-0.2,+0.2); me->Add(tH2D);
+      tH2D = new TH2D("PTRes", "PTRes;Pt;MC-DAT",   fPtBins,fPtBinEdge,100,-0.4,+0.4); me->Add(tH2D);
+      tH2D = new TH2D("RXYRes","RXYRes;RXY;MC-DAT", 100,0,50,100,-4.0,+4.0); me->Add(tH2D);
+    }
+    tH2D = new TH2D("PTDPHIMC","PtDPHIMC;Pt;PHI-MCEP",fPtBins,fPtBinEdge,72,0,TMath::Pi()); me->Add(tH2D);
+    tPro = new TProfile("Cos2dphiMC",  "Cos2dphiMC",fPtBins,fPtBinEdge); me->Add(tPro);
+    tPro2=new TProfile2D("C2DPHIMCMASS","C2DPHIMCMASS",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); me->Add(tPro2);
+  }
+  return;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillCandidateSpy(TString listName, Bool_t fillRes) {
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PhiEta"))->Fill( fDecayPhi, fDecayEta );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtRAP" ))->Fill( fDecayPt, fDecayRapidity );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDCA" ))->Fill( fDecayPt, fDecayDCAdaughters );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtCTP" ))->Fill( fDecayPt, fDecayCosinePointingAngleXY );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtD0D0"))->Fill( fDecayPt, fDecayProductIPXY );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtRad2"))->Fill( fDecayPt, fDecayRadXY );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDL"  ))->Fill( fDecayPt, fDecayDecayLength );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDLlab"))->Fill( fDecayPt, fDecayDecayLengthLab );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtMASS"))->Fill( fDecayPt, fDecayMass );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("APPOS" ))->Fill( fDecayAlpha, fDecayQt );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("D0PD0N"))->Fill( fDecayIPpos, fDecayIPneg );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("XPOSXNEG"))->Fill( fDecayXpos, fDecayXneg );
+  if(fReadMC) {
+    ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PTDPHIMC" ))->Fill( fDecayPt, GetMCDPHI( fDecayPhi ) );
+    ((TProfile*)((TList*)fList->FindObject(listName.Data()))->FindObject("Cos2dphiMC" ))->Fill( fDecayPt, TMath::Cos( 2*GetMCDPHI(fDecayPhi) ), 1 );
+    ((TProfile2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("C2DPHIMCMASS" ))->Fill(fDecayPt,fDecayMass,TMath::Cos(2*GetMCDPHI(fDecayPhi)), 1 );
+    if(fillRes) {
+      ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("MCOrigin"))->Fill( fDecayMatchOrigin );
+      ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PHIRes"))->Fill( fDecayPhi, fDecayMatchPhi-fDecayPhi );
+      ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("ETARes"))->Fill( fDecayEta, fDecayMatchEta-fDecayEta );
+      ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PTRes"))->Fill( fDecayPt, fDecayMatchPt-fDecayPt );
+      ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("RXYRes"))->Fill( fDecayRadXY, fDecayMatchRadXY-fDecayRadXY );
+    }
+  }
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::AcceptCandidate() {
+  if(fDecayEta<fDecayMinEta) return kFALSE;
+  if(fDecayEta>fDecayMaxEta) return kFALSE;
+  if(fDecayPt<fDecayMinPt) return kFALSE;
+  if(fDecayProductIPXY>fDecayMaxProductIPXY) return kFALSE;
+  if(fDecayDCAdaughters>fDecayMaxDCAdaughters) return kFALSE;
+  if(fDecayCosinePointingAngleXY<fDecayMinCosinePointingAngleXY) return kFALSE;
+  if(fDecayRadXY<fDecayMinRadXY) return kFALSE;
+  if(TMath::Abs(fDecayRapidity)>fDecayMaxRapidity) return kFALSE;
+  if(fSpecie==0) {
+    if(fDecayAPCutPie) {
+      if(fDecayQt/TMath::Abs(fDecayAlpha)<fDecayMinQt) return kFALSE;
+    } else {
+      if(fDecayQt<fDecayMinQt) return kFALSE;
+    }
+    if(fDecayDecayLength>fDecayMaxDecayLength*2.6842) return kFALSE;
+  } else {
+    if(fDecayDecayLength>fDecayMaxDecayLength*7.89) return kFALSE;
+  }
+  if(fSpecie==1) if(fDecayAlpha>0) return kFALSE;
+  if(fSpecie==2) if(fDecayAlpha<0) return kFALSE;
+  return kTRUE;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddTrackSpy(TList *me,Bool_t res) {
+  TH2D *tH2D;
+  tH2D = new TH2D("PHIETA",       "PHIETA;PHI;ETA",       100,0,TMath::TwoPi(),100,-2,2); me->Add(tH2D);
+  tH2D = new TH2D("PTTRACKDECAY", "PTTRACKDECAY;PT;PT",   100,0,10,fPtBins,fPtBinEdge); me->Add(tH2D);
+  tH2D = new TH2D("IPXYIPZ",      "IPXYIPZ;IPXY;IPZ",     100,-10,+10,100,-10,+10); me->Add(tH2D);
+  tH2D = new TH2D("PTTPCNCLS",    "PTTPCNCLS;PT;NCLS",    fPtBins,fPtBinEdge,170,0,170);  me->Add(tH2D);
+  tH2D = new TH2D("PTITSNCLS",    "PTITSNCLS;PT;NCLS",    fPtBins,fPtBinEdge,7,-0.5,6.5); me->Add(tH2D);
+  tH2D = new TH2D("PTITSLAY",     "PTITSLAY;PT;ITSLAYER", fPtBins,fPtBinEdge,6,-0.5,+5.5);me->Add(tH2D);
+  tH2D = new TH2D("PTITSTPCrefit","PTITSTPCrefit;PT",     fPtBins,fPtBinEdge,2,-0.5,+1.5);me->Add(tH2D);
+  tH2D->GetYaxis()->SetBinLabel(1,"ITS refit");
+  tH2D->GetYaxis()->SetBinLabel(2,"TPC refit");
+  tH2D = new TH2D("POSTPCNCLCHI2","POSTPCNCLCHI2;NCLS;CHI2/NCLS", 170,0,170,100,0,8);   me->Add(tH2D);
+  tH2D = new TH2D("POSTPCNFCLNXR","POSTPCNFCLNXR;NFCLS;NXR",      170,0,170,170,0,170); me->Add(tH2D);
+  tH2D = new TH2D("POSTPCNCLNFCL","POSTPCNCLNFCL;NCLS;NFCLS",     170,0,170,170,0,170); me->Add(tH2D);
+  tH2D = new TH2D("POSTPCNCLNSCL","POSTPCNCLNSCL;NCLS;NSCLS",     170,0,170,170,0,170); me->Add(tH2D);
+  tH2D = new TH2D("NEGTPCNCLCHI2","NEGTPCNCLCHI2;NCLS;CHI2/NCLS", 170,0,170,100,0,8);   me->Add(tH2D);
+  tH2D = new TH2D("NEGTPCNFCLNXR","NEGTPCNFCLNXR;NFCLS;NXR",      170,0,170,170,0,170); me->Add(tH2D);
+  tH2D = new TH2D("NEGTPCNCLNFCL","NEGTPCNCLNFCL;NCLS;NFCLS",     170,0,170,170,0,170); me->Add(tH2D);
+  tH2D = new TH2D("NEGTPCNCLNSCL","NEGTPCNCLNSCL;NCLS;NSCLS",     170,0,170,170,0,170); me->Add(tH2D);
+  if(fReadMC) {
+    TProfile *tPro;
+    tPro = new TProfile("COSNDPHIMC","COSNDPHIMC",fPtBins,fPtBinEdge); me->Add(tPro);
+  }
+  if(res) {
+    tH2D = new TH2D("PHIRes", "PHIRes;PHI;MC-DAT", 72,0,TMath::TwoPi(),100,-0.12,+0.12); me->Add(tH2D);
+    tH2D = new TH2D("ETARes", "ETARes;ETA;MC-DAT", 16,-0.8,+0.8,100,-0.2,+0.2); me->Add(tH2D);
+    tH2D = new TH2D("PTRes",  "PTRes;Pt;MC-DAT", fPtBins,fPtBinEdge,100,-0.4,+0.4); me->Add(tH2D);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillTrackSpy(TString listName,Bool_t res) {
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PHIETA" ))->Fill( fDaughterPhi, fDaughterEta );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTTRACKDECAY" ))->Fill( fDaughterPt, fDecayPt );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "IPXYIPZ" ))->Fill( fDaughterImpactParameterXY, fDaughterImpactParameterZ );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTTPCNCLS" ))->Fill( fDaughterPt, fDaughterNClsTPC );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSNCLS" ))->Fill( fDaughterPt, fDaughterNClsITS );
+  if( TESTBIT(fDaughterITScm,0) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 0 );
+  if( TESTBIT(fDaughterITScm,1) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 1 );
+  if( TESTBIT(fDaughterITScm,2) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 2 );
+  if( TESTBIT(fDaughterITScm,3) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 3 );
+  if( TESTBIT(fDaughterITScm,4) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 4 );
+  if( TESTBIT(fDaughterITScm,5) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 5 );
+  if( (fDaughterStatus&AliESDtrack::kITSrefit) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSTPCrefit" ))->Fill( fDaughterPt, 0 );
+  if( (fDaughterStatus&AliESDtrack::kTPCrefit) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSTPCrefit" ))->Fill( fDaughterPt, 1 );
+  TString ch="NEG";
+  if(fDaughterCharge>0) ch="POS";
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLCHI2",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterChi2PerNClsTPC );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNFCLNXR",ch.Data()) ))->Fill( fDaughterNFClsTPC, fDaughterXRows );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLNFCL",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterNFClsTPC );
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLNSCL",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterNSClsTPC );
+  if(fReadMC) {
+    Double_t cosn = TMath::Cos( fHarmonic*GetMCDPHI(fDaughterPhi) );
+    ((TProfile*)((TList*)fList->FindObject(listName.Data()))->FindObject("COSNDPHIMC" ))->Fill( fDaughterPt, cosn, 1 );
+  }
+  if(res) {
+    ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PHIRes"))->Fill( fDaughterPhi, fDaughterMatchPhi-fDaughterAtSecPhi );
+    ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("ETARes"))->Fill( fDaughterEta, fDaughterMatchEta-fDaughterAtSecEta );
+    ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PTRes"))->Fill( fDaughterPt, fDaughterMatchPt-fDaughterAtSecPt );
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::LoadTrack(AliESDtrack *myTrack, Double_t aodChi2NDF) {
+  fDaughterCharge = myTrack->Charge();
+  fDaughterXRows = myTrack->GetTPCCrossedRows();
+  fDaughterNFClsTPC = myTrack->GetTPCNclsF();
+  fDaughterNSClsTPC = myTrack->GetTPCnclsS();
+  fDaughterNClsTPC = myTrack->GetTPCclusters(0);
+  if(fReadESD) {
+    if(fDaughterNClsTPC>0) fDaughterChi2PerNClsTPC = myTrack->GetTPCchi2()/fDaughterNClsTPC;
+  } else {
+    fDaughterChi2PerNClsTPC = aodChi2NDF;
+  }
+  myTrack->GetImpactParameters(fDaughterImpactParameterXY,fDaughterImpactParameterZ);
+  fDaughterStatus = myTrack->GetStatus();
+  fDaughterITScm = myTrack->GetITSClusterMap();
+  fDaughterPhi = myTrack->Phi();
+  fDaughterEta = myTrack->Eta();
+  fDaughterPt = myTrack->Pt();
+  fDaughterKinkIndex = myTrack->GetKinkIndex(0);
+  fDaughterNClsITS=0;
+  for(Int_t lay=0; lay!=6; ++lay)
+    if(TESTBIT(fDaughterITScm,lay)) fDaughterNClsITS++;
+
+  //newITScuts
+  fcounterForSharedCluster = 0;
+  for(int i =0;i<6;i++){
+    fsharedITSCluster = myTrack->HasSharedPointOnITSLayer(i);
+    if(fsharedITSCluster == 1) fcounterForSharedCluster++;
+  }
+  fchi2perClusterITS = myTrack->GetITSchi2()/myTrack->GetNcls(0);
+  
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::AcceptDaughter(Bool_t strongITS, Bool_t newITScuts) {
+  if(fDaughterKinkIndex>0) return kFALSE;
+  if( (fDaughterStatus&AliESDtrack::kTPCrefit)==0 ) return kFALSE;
+  if(fDaughterNFClsTPC<1) return kFALSE;
+  if(fDaughterPt<fDaughterMinPt) return kFALSE;
+  if(fDaughterEta<fDaughterMinEta) return kFALSE;
+  if(fDaughterEta>fDaughterMaxEta) return kFALSE;
+  if(fDaughterNClsTPC<fDaughterMinNClsTPC) return kFALSE;
+  if(fDaughterXRows<fDaughterMinXRows) return kFALSE;
+  if(fDaughterChi2PerNClsTPC>fDaughterMaxChi2PerNClsTPC) return kFALSE;
+  if(TMath::Abs(fDaughterImpactParameterXY)<fDaughterMinImpactParameterXY) return kFALSE;
+  if(fDaughterXRows<fDaughterMinXRowsOverNClsFTPC*fDaughterNFClsTPC) return kFALSE;
+  if(strongITS) {
+    if( (fDaughterITSrefit) & ((fDaughterStatus&AliESDtrack::kITSrefit)==0) ) return kFALSE;
+    for(Int_t lay=0; lay!=6; ++lay)
+      if(fDaughterITSConfig[lay]>-0.5) {
+       if(fDaughterITSConfig[lay]) {
+         if(!TESTBIT(fDaughterITScm,lay)) return kFALSE;
+       } else {
+         if(TESTBIT(fDaughterITScm,lay)) return kFALSE;
+       }
+      }
+    if(fDaughterNClsITS<fDaughterMinNClsITS) return kFALSE;
+    if(fDaughterSPDRequireAny) {
+      if( !TESTBIT(fDaughterITScm,0)&&!TESTBIT(fDaughterITScm,1)) return kFALSE;
+    }
+  }
+  
+  if(newITScuts) {
+    if(fchi2perClusterITS >= fMaxchi2perITSCluster)  return kFALSE;
+    if(fcounterForSharedCluster >= fmaxSharedITSCluster)  return kFALSE;
+  }
+  
+  return kTRUE;
+}
+//=======================================================================
+Double_t AliAnalysisTaskFlowStrangee::GetWDist(const AliVVertex* v0, const AliVVertex* v1) {
+  // calculate sqrt of weighted distance to other vertex
+  if (!v0 || !v1) {
+    printf("One of vertices is not valid\n");
+    return 0;
+  }
+  static TMatrixDSym vVb(3);
+  double dist = -1;
+  double dx = v0->GetX()-v1->GetX();
+  double dy = v0->GetY()-v1->GetY();
+  double dz = v0->GetZ()-v1->GetZ();
+  double cov0[6],cov1[6];
+  v0->GetCovarianceMatrix(cov0);
+  v1->GetCovarianceMatrix(cov1);
+  vVb(0,0) = cov0[0]+cov1[0];
+  vVb(1,1) = cov0[2]+cov1[2];
+  vVb(2,2) = cov0[5]+cov1[5];
+  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
+  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
+  vVb.InvertFast();
+  if (!vVb.IsValid()) {printf("Singular Matrix\n"); return dist;}
+  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
+    +    2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
+  return dist>0 ? TMath::Sqrt(dist) : -1;
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::plpMV(const AliVEvent *event) {
+  // check for multi-vertexer pile-up
+  const AliAODEvent *aod = (const AliAODEvent*)event;
+  const AliESDEvent *esd = (const AliESDEvent*)event;
+  //
+  const int    kMinPlpContrib = 5;
+  const double kMaxPlpChi2 = 5.0;
+  const double kMinWDist = 15;
+  //
+  if (!aod && !esd) {
+    printf("Event is neither of AOD nor ESD\n");
+    exit(1);
+  }
+  //
+  const AliVVertex* vtPrm = 0;
+  const AliVVertex* vtPlp = 0;
+  int nPlp = 0;
+  //
+  if (aod) {
+    if ( !(nPlp=aod->GetNumberOfPileupVerticesTracks()) ) return kFALSE;
+    vtPrm = aod->GetPrimaryVertex();
+    if (vtPrm == aod->GetPrimaryVertexSPD()) return kTRUE; // there are pile-up vertices but no primary
+  }
+  else {
+    if ( !(nPlp=esd->GetNumberOfPileupVerticesTracks())) return kFALSE;
+    vtPrm = esd->GetPrimaryVertexTracks();
+    if (((AliESDVertex*)vtPrm)->GetStatus()!=1) return kTRUE; // there are pile-up vertices but no primary
+  }
+  //int bcPrim = vtPrm->GetBC();
+  //
+  for (int ipl=0;ipl<nPlp;ipl++) {
+    vtPlp = aod ? (const AliVVertex*)aod->GetPileupVertexTracks(ipl) : (const AliVVertex*)esd->GetPileupVertexTracks(ipl);
+    //
+    if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
+    if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
+    //  int bcPlp = vtPlp->GetBC();
+    //  if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2) return kTRUE; // pile-up from other BC
+    //
+    double wDst = GetWDist(vtPrm,vtPlp);
+    if (wDst<kMinWDist) continue;
+    //
+    return kTRUE; // pile-up: well separated vertices
+  }
+  //
+  return kFALSE;
+  //
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeFilterBits() {
+  //FilterBit 1
+  fFB1 = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+  //FilterBit1024
+  fFB1024 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
+  fFB1024->SetMinNCrossedRowsTPC(120);
+  fFB1024->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
+  fFB1024->SetMaxChi2PerClusterITS(36);
+  fFB1024->SetMaxFractionSharedTPCClusters(0.4);
+  fFB1024->SetMaxChi2TPCConstrainedGlobal(36);
+  fFB1024->SetEtaRange(-0.9,0.9);
+  fFB1024->SetPtRange(0.15, 1e10);
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::PassesFilterBit(AliESDtrack *track) {
+  Bool_t ret=kFALSE;
+  switch(fRFPFilterBit) {
+    case(1024):
+      ret = fFB1024->AcceptTrack(track);
+      break;
+    default:
+      ret = fFB1->AcceptTrack(track);
+  }
+  return ret;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::LoadVZEROResponse() {
+  if(fVZEResponse) {
+    TString run = fVZEResponse->GetTitle();
+    if( run.Atoi() == fRunNumber ) return;
+    fVZEResponse = NULL;
+  }
+  //==>loading
+  fVZEResponse = dynamic_cast<TH2D*> (fVZEload->FindObject( Form("%d",fRunNumber) ));
+  if(fVZEResponse) {
+    printf("New VZE calibration: run %d || %s -> Entries %.0f\n",fRunNumber, fVZEResponse->GetTitle(),fVZEResponse->GetEntries());
+    //=>external weights
+    for(int i=0;i!=64;++i) fVZEextW[i]=1;
+    if(!fVZEsave) {
+      Double_t minC = fCentPerMin, maxC = fCentPerMax;
+      if(fVZEmb) {
+       minC = 0;
+       maxC = 80;
+      }
+      Int_t ybinmin = fVZEResponse->GetYaxis()->FindBin(minC+1e-6);
+      Int_t ybinmax = fVZEResponse->GetYaxis()->FindBin(maxC-1e-6);
+      if(fSkipCentralitySelection) {
+       ybinmin=-1;
+       ybinmax=-1;
+      }
+      for(int i=0;i!=64;++i) fVZEextW[i] = fVZEResponse->Integral(i+1,i+1,ybinmin,ybinmax)/(maxC-minC);
+      //ring-wise normalization
+      Double_t ring[8];
+      for(int j=0; j!=8; ++j) {
+       ring[j]=0;
+       for(int i=0;i!=8;++i) ring[j] += fVZEextW[j*8+i]/8;
+      }
+      //disk-wise normalization
+      Double_t disk[2];
+      int xbinmin, xbinmax;
+      xbinmin = 1+8*fVZECa;
+      xbinmax = 8+8*fVZECb;
+      disk[0] = fVZEResponse->Integral(xbinmin,xbinmax,ybinmin,ybinmax)/(maxC-minC)/(xbinmax-xbinmin+1);
+      xbinmin = 33+8*fVZEAa;
+      xbinmax = 40+8*fVZEAb;
+      disk[1] = fVZEResponse->Integral(xbinmin,xbinmax,ybinmin,ybinmax)/(maxC-minC)/(xbinmax-xbinmin+1);
+      //for(int i=0;i!=64;++i) printf("CELL %d -> W = %f ||",i,fVZEextW[i]);
+      if(fVZEByDisk) {
+       for(int i=0;i!=64;++i) fVZEextW[i] = disk[i/32]/fVZEextW[i];
+      } else {
+       for(int i=0;i!=64;++i) fVZEextW[i] = ring[i/8]/fVZEextW[i];
+      }
+      //for(int i=0;i!=64;++i) printf(" W = %f \n",fVZEextW[i]);
+    }
+  } else {
+    printf("VZE calibration: requested but not found!!!\n");
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddVZEQA() {
+  TProfile2D *prof;
+  TH2D *tH2D;
+  TList *tList = new TList();
+  tList->SetName( "VZEQA" );
+  tList->SetOwner();
+  fList->Add( tList );
+  tH2D = new TH2D("EQU","EQU;VZEeqmult-VZEmult;cell",100,-5,+5,64,0,64); tList->Add( tH2D );
+  prof = new TProfile2D("LINbefCAL","LINbef;VZEcell;VZEeqmult;SPDtrkl", 64,0,64,350,0,700,0,10000); tList->Add( prof );
+  prof = new TProfile2D("LINaftCAL","LINaft;VZEcell;VZEeqmult;SPDtrkl", 64,0,64,350,0,700,0,10000); tList->Add( prof );
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillVZEQA() {
+  AliESDEvent *tESD = (AliESDEvent*) (InputEvent());
+  AliAODEvent *tAOD = (AliAODEvent*) (InputEvent());
+  if(fReadESD) {
+    if(!tESD) return;
+    //FillVZEQA(tESD);
+  } else {
+    if(!tAOD) return;
+    FillVZEQA(tAOD);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillVZEQA(AliAODEvent *tAOD) {
+  AliVVZERO *vzero = tAOD->GetVZEROData();
+  AliAODTracklets *tracklets = tAOD->GetTracklets();
+  if(!vzero) return;
+  if(!tracklets) return;
+  Double_t mult, eqmult;
+  Int_t trkl = tracklets->GetNumberOfTracklets();
+  for(int id=0; id!=64; ++id) {
+    mult = vzero->GetMultiplicity(id);
+    eqmult = tAOD->GetVZEROEqMultiplicity(id);
+    ((TH2D*) ((TList*) fList->FindObject("VZEQA"))->FindObject("EQU"))->Fill(eqmult-mult,id);
+    ((TProfile2D*) ((TList*) fList->FindObject("VZEQA"))->FindObject( "LINbefCAL" ))->Fill(id,eqmult,trkl,1);
+    ((TProfile2D*) ((TList*) fList->FindObject("VZEQA"))->FindObject( "LINaftCAL" ))->Fill(id,eqmult*fVZEextW[id],trkl,1);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddVZEROResponse() {
+  fVZEResponse = NULL;
+  AliVEvent *event = InputEvent();
+  if(!event) return;
+  Int_t thisrun = event->GetRunNumber();
+  fVZEResponse = new TH2D( Form("%d",thisrun), Form("%d;cell;CC",thisrun), 64,0,64, 110, -10, 100);
+  fList->Add(fVZEResponse);
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::SaveVZEROResponse() {
+  if(!fVZEResponse) return;
+  AliVEvent *event = InputEvent();
+  if(!event) return;
+  Double_t w;
+  // reject event with low ocupancy in VZERO
+  // for centralities below 60% this should not happen anyway
+  Double_t rejectEvent = kFALSE;
+  for(int id=0; id!=64; ++id) {
+    w = event->GetVZEROEqMultiplicity(id);
+    if(w<3) rejectEvent = kTRUE;
+  }
+  if(rejectEvent) return;
+  // saves weights
+  for(int id=0; id!=64; ++id) {
+    w = event->GetVZEROEqMultiplicity(id);
+    fVZEResponse->Fill(id,fThisCent,w);
+  }
+}
+//=======================================================================
+Int_t AliAnalysisTaskFlowStrangee::RefMult(AliAODEvent *tAOD, Int_t fb) {
+  Int_t found = 0;
+  for(int i=0; i!=tAOD->GetNumberOfTracks(); ++i) {
+    AliAODTrack *t = dynamic_cast<AliAODTrack*>(tAOD->GetTrack( i ));
+    if(!t) continue;
+    if( !t->TestFilterBit(fb) ) continue;
+    if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;
+    if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;
+    if( t->GetTPCNcls()<70 ) continue;
+    //if( t->GetTPCsignal()<10.0 ) continue;
+    if( t->Chi2perNDF()<0.2 ) continue;
+    ++found;
+  }
+  return found;
+}
+//=======================================================================
+Int_t AliAnalysisTaskFlowStrangee::RefMultTPC() {
+  AliAODEvent *ev = dynamic_cast<AliAODEvent*> (InputEvent());
+  if(!ev) return -1;
+  Int_t found = 0;
+  for(int i=0; i!=ev->GetNumberOfTracks(); ++i) {
+    AliAODTrack *t = dynamic_cast<AliAODTrack*>(ev->GetTrack( i ));
+    if(!t) continue;
+    if( !t->TestFilterBit(1) ) continue;
+    if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;
+    if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;
+    if( t->GetTPCNcls()<70 ) continue;
+    if( t->GetTPCsignal()<10.0 ) continue;
+    if( t->Chi2perNDF()<0.2 ) continue;    
+    ++found;
+  }
+  return found;
+}
+//=======================================================================
+Int_t AliAnalysisTaskFlowStrangee::RefMultGlobal() {
+  AliAODEvent *ev = dynamic_cast<AliAODEvent*> (InputEvent());
+  if(!ev) return -1;
+  Int_t found = 0;
+  for(int i=0; i!=ev->GetNumberOfTracks(); ++i) {
+    AliAODTrack *t = dynamic_cast<AliAODTrack*>(ev->GetTrack( i ));
+    if(!t) continue;
+    if( !t->TestFilterBit(16) ) continue;
+    if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;
+    if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;
+    if( t->GetTPCNcls()<70 ) continue;
+    if( t->GetTPCsignal()<10.0 ) continue;
+    if( t->Chi2perNDF()<0.1 ) continue;    
+    Double_t b[3], bcov[3];
+    if( !t->PropagateToDCA(ev->GetPrimaryVertex(),ev->GetMagneticField(),100,b,bcov) ) continue;
+    if( b[0]>+0.3 || b[0]<-0.3 || b[1]>+0.3 || b[1]<-0.3) continue;
+    ++found;
+  }
+  return found;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ResetContainers() {
+  if(fUseFP) {
+    fTPCevent->ClearFast();
+    fVZEevent->ClearFast();
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddTrackVn(TList *tList) {
+  TProfile *tProfile;
+  TH1D *tH1D;
+  // vze
+  tProfile = new TProfile("SP_uVZEA","u x Q_{VZEA}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_uVZEC","u x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_VZEAVZEC","Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_VZEATPC","Q_{VZEA} x Q_{TPC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_VZECTPC","Q_{VZEC} x Q_{TPC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // error
+  tProfile = new TProfile("SP_uVZEAuVZEC","u x Q_{VZEA} . u x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_uVZEAVZEAVZEC","u x Q_{VZEA} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_uVZECVZEAVZEC","u x Q_{VZEC} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // tpc
+  tProfile = new TProfile("SP_uTPCA","u x Q_{TPCA}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_uTPCC","u x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_TPCATPCC","Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // error
+  tProfile = new TProfile("SP_uTPCATPCATPCC","u x Q_{TPCA} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("SP_uTPCCTPCATPCC","u x Q_{TPCC} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // control
+  tH1D = new TH1D("QC_HistPt_P","HistPt_P",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_HistPt_Q","HistPt_Q",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  // qc
+  tProfile = new TProfile("QC_C2","QC_C2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_C4","QC_C4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_DC2","QC_DC2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_DC4","QC_DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_C2C4","QC_C2C4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_C2DC2","QC_C2DC2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_C2DC4","QC_C2DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_C4DC2","QC_C4DC2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_C4DC4","QC_C4DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_DC2DC4","QC_DC2DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // qc transient
+  tProfile = new TProfile("QC_pCos","QC_pCos",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_pSin","QC_pSin",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_qCos","QC_qCos",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_qSin","QC_qSin",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_q2hCos","QC_q2hCos",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile("QC_q2hSin","QC_q2hSin",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // measurements
+  tH1D = new TH1D("SP_vnVZEA","SP_vnVZEA",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("SP_vnVZEC","SP_vnVZEC",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("SP_vnTPCA","SP_vnTPCA",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("SP_vnTPCC","SP_vnTPCC",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_Cum2","QC_Cum2",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_Cum4","QC_Cum4",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_DCum2","QC_DCum2",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_DCum4","QC_DCum4",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("SP_vnVZEGA","SP_vnVZEGA",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("SP_vnVZEWA","SP_vnVZEWA",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("SP_vnTPCAA","SP_vnTPCAA",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_vn2","QC_vn2",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  tH1D = new TH1D("QC_vn4","QC_vn4",fPtBins,fPtBinEdge); tList->Add( tH1D );
+  if(fReadMC) {
+    TH2D *tH2D;
+    tProfile = new TProfile("MC_COSNDPHI","MC_COSNDPHI",fPtBins,fPtBinEdge,-3,+3); tList->Add( tProfile );
+    tH2D = new TH2D("MC_COSNDPHI_uQVZEA","MC_COSNDPHI_uQVZEA",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
+    tH2D = new TH2D("MC_COSNDPHI_uQVZEC","MC_COSNDPHI_uQVZEC",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
+    tH2D = new TH2D("MC_COSNDPHI_uQTPCA","MC_COSNDPHI_uQTPCA",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
+    tH2D = new TH2D("MC_COSNDPHI_uQTPCC","MC_COSNDPHI_uQTPCC",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::AddDecayVn(TList *tList) {
+  TProfile2D *tProfile;
+  TH2D *tH2D;
+  // decay
+  tH2D = new TH2D("DecayYield_PtMass","Decay_PtMass",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tProfile = new TProfile2D("DecayAvgPt_PtMass","Decay_PtMass",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tProfile ); tProfile->Sumw2();
+  // vze
+  tProfile = new TProfile2D("SP_uVZEA","u x Q_{VZEA}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_uVZEC","u x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_VZEAVZEC","Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_VZEATPC","Q_{VZEA} x Q_{TPC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_VZECTPC","Q_{VZEC} x Q_{TPC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // error
+  tProfile = new TProfile2D("SP_uVZEAuVZEC","u x Q_{VZEA} . u x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_uVZEAVZEAVZEC","u x Q_{VZEA} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_uVZECVZEAVZEC","u x Q_{VZEC} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // tpc
+  tProfile = new TProfile2D("SP_uTPCA","u x Q_{TPCA}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_uTPCC","u x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_TPCATPCC","Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // error
+  tProfile = new TProfile2D("SP_uTPCATPCATPCC","u x Q_{TPCA} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("SP_uTPCCTPCATPCC","u x Q_{TPCC} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // control
+  tH2D = new TH2D("QC_HistPt_P","HistPt_P",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_HistPt_Q","HistPt_Q",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  // qc
+  tProfile = new TProfile2D("QC_C2","QC_C2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_C4","QC_C4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_DC2","QC_DC2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_DC4","QC_DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_C2C4","QC_C2C4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_C2DC2","QC_C2DC2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_C2DC4","QC_C2DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_C4DC2","QC_C4DC2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_C4DC4","QC_C4DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_DC2DC4","QC_DC2DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // qc transient
+  tProfile = new TProfile2D("QC_pCos","QC_pCos",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_pSin","QC_pSin",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_qCos","QC_qCos",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_qSin","QC_qSin",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_q2hCos","QC_q2hCos",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  tProfile = new TProfile2D("QC_q2hSin","QC_q2hSin",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
+  // measurements
+  tH2D = new TH2D("SP_vnVZEA","SP_vnVZEA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("SP_vnVZEC","SP_vnVZEC",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("SP_vnTPCA","SP_vnTPCA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("SP_vnTPCC","SP_vnTPCC",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_Cum2","QC_Cum2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_Cum4","QC_Cum4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_DCum2","QC_DCum2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_DCum4","QC_DCum4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("SP_vnVZEGA","SP_vnVZEGA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("SP_vnVZEWA","SP_vnVZEWA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("SP_vnTPCAA","SP_vnTPCAA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_vn2","QC_vn2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  tH2D = new TH2D("QC_vn4","QC_vn4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
+  if(fReadMC) {
+    tProfile = new TProfile2D("MC_COSNDPHI","MC_COSNDPHI",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tProfile );
+  }
+}
+//=======================================================================
+TList* AliAnalysisTaskFlowStrangee::RebinDecayVn(Int_t nbins, Int_t *bins) {
+  TList *out = new TList();
+  out->SetOwner();
+  out->SetName( fList->GetName() );
+
+  TList *ori, *end;
+
+  ori = (TList*) fList->FindObject("Event");
+  out->Add( ori );
+
+  ori = (TList*) fList->FindObject("MakeQSpy");
+  out->Add( ori );
+
+  ori = (TList*) fList->FindObject("V0SAllVn");
+  end = RebinDecayVn(ori,nbins,bins);
+  end->SetName( ori->GetName() ); out->Add( end );
+
+  ori = (TList*) fList->FindObject("V0SSelVn");
+  end = RebinDecayVn(ori,nbins,bins);
+  end->SetName( ori->GetName() ); out->Add( end );
+
+  if(fReadMC) {
+    ori = (TList*) fList->FindObject("V0SMthVn");
+    end = RebinDecayVn(ori,nbins,bins);
+    end->SetName( ori->GetName() ); out->Add( end );
+
+    ori = (TList*) fList->FindObject("V0SMthPosPosVn");
+    end = RebinDecayVn(ori,nbins,bins);
+    end->SetName( ori->GetName() ); out->Add( end );
+
+    ori = (TList*) fList->FindObject("V0SMthNegNegVn");
+    end = RebinDecayVn(ori,nbins,bins);
+    end->SetName( ori->GetName() ); out->Add( end );
+
+    ori = (TList*) fList->FindObject("V0SMthPosNegVn");
+    end = RebinDecayVn(ori,nbins,bins);
+    end->SetName( ori->GetName() ); out->Add( end );
+
+    ori = (TList*) fList->FindObject("V0SUnMthVn");
+    end = RebinDecayVn(ori,nbins,bins);
+    end->SetName( ori->GetName() ); out->Add( end );
+  }
+
+  return out;
+}
+//=======================================================================
+TList* AliAnalysisTaskFlowStrangee::RebinDecayVn(TList *tList,Int_t nbins, Int_t *bins) {
+  // getting expected number of mass bins
+  int sum=0;
+  for(int i=0; i!=nbins; ++i) sum += bins[i];
+
+  TList *list = new TList();
+  list->SetOwner();
+
+  Int_t npt;
+  Double_t pt[200], mass[200];
+  TH2D *tH2D;
+
+  tH2D = ((TH2D*)tList->FindObject( "DecayYield_PtMass" ));
+  list->Add(tH2D); //keeping it as it is
+  int nmassbins = tH2D->GetNbinsY();
+  //consistency check
+  if( nmassbins!=sum  ) {
+    printf("Error: incompatible binning %d vs %d\nBYE\n",nmassbins,sum);
+    return NULL;
+  }
+  //reading pts
+  npt = tH2D->GetNbinsX();
+  for(int i=0; i!=npt+1; ++i) pt[i] = tH2D->GetXaxis()->GetBinLowEdge(i+1);
+  //making mass bins
+  for(int i=0,j=0; i!=nbins+1; ++i) {
+    mass[i] = tH2D->GetYaxis()->GetBinLowEdge(j+1);
+    j += bins[i];
+  }
+  //TProfile2D migrating info
+  TProfile2D *tProfileOld, *tProfileNew;
+  TString tprofiles[31] = {"DecayAvgPt_PtMass","SP_uVZEA","SP_uVZEC","SP_VZEAVZEC","SP_VZEATPC",
+                          "SP_VZECTPC","SP_uVZEAuVZEC","SP_uVZEAVZEAVZEC","SP_uVZECVZEAVZEC","SP_uTPCA",
+                          "SP_uTPCC","SP_TPCATPCC","SP_uTPCATPCATPCC","SP_uTPCCTPCATPCC","QC_C2",
+                          "QC_C4","QC_DC2","QC_DC4","QC_C2C4","QC_C2DC2",
+                          "QC_C2DC4","QC_C4DC2","QC_C4DC4","QC_DC2DC4","QC_pCos",
+                          "QC_pSin","QC_qCos","QC_qSin","QC_q2hCos","QC_q2hSin",
+                          "MC_COSNDPHI"};
+  for(int i=0; i!=31; ++i) {
+    tProfileOld = (TProfile2D*) tList->FindObject( tprofiles[i].Data() );
+    if(!tProfileOld) continue;
+    TArrayD *oldsw2 = tProfileOld->GetSumw2();
+    TArrayD *oldbsw2 = tProfileOld->GetBinSumw2();
+    tProfileNew = new TProfile2D( tprofiles[i].Data(), tprofiles[i].Data(),
+                                 npt,pt,nbins,mass,"s");
+    tProfileNew->Sumw2();
+    list->Add( tProfileNew );
+    TArrayD *newsw2 = tProfileNew->GetSumw2();
+    TArrayD *newbsw2 = tProfileNew->GetBinSumw2();
+    for(int x=1; x!=tProfileOld->GetNbinsX()+1; ++x) { //pt
+      for(int y=1; y!=tProfileNew->GetNbinsY()+1; ++y) { //mass
+       Double_t sContent=0;
+       Double_t sEntries=0;
+       Double_t sSqWeigh=0;
+       Double_t sSqBWeig=0;
+       Int_t binnew = tProfileNew->GetBin(x,y);
+       Double_t minmass = tProfileNew->GetYaxis()->GetBinLowEdge( y );
+       Double_t maxmass = tProfileNew->GetYaxis()->GetBinLowEdge( y+1 );
+       Int_t minbin = tProfileOld->GetYaxis()->FindBin( minmass+1e-10 );
+       Int_t maxbin = tProfileOld->GetYaxis()->FindBin( maxmass-1e-10 );
+       for(int k=minbin; k!=maxbin+1; ++k) {
+         Int_t binold = tProfileOld->GetBin(x,k);
+         Double_t wk = tProfileOld->GetBinEntries( binold );
+         Double_t yk = tProfileOld->GetBinContent( binold );
+         sEntries += wk;
+         sContent += wk*yk;
+         sSqWeigh += oldsw2->At(binold);
+         if(oldbsw2->GetSize()) sSqBWeig += oldbsw2->At(binold);
+       }
+       tProfileNew->SetBinEntries( binnew, sEntries );
+       tProfileNew->SetBinContent( binnew, sContent );
+       newsw2->SetAt(sSqWeigh, binnew);
+       if(oldbsw2->GetSize()) newbsw2->SetAt(sSqBWeig, binnew);
+      }
+    }
+    tProfileOld = NULL;
+  }
+  //TH2D all new blank
+  TString th2ds[15] = {"QC_HisPt_P","QC_HistPt_Q","SP_vnVZEA","SP_vnVZEC","SP_vnTPCA",
+                      "SP_vnTPCC","QC_Cum2","QC_Cum4","QC_DCum2","QC_DCum4",
+                      "SP_vnVZEGA","SP_vnVZEWA","SP_vnTPCAA","QC_vn2","QC_vn4"};
+  for(int i=0; i!=15; ++i) {
+    tH2D = new TH2D( th2ds[i].Data(),th2ds[i].Data(),
+                    npt,pt,nbins,mass);
+    list->Add(tH2D);
+  }
+  return list;
+
+  //int nmass = tH2Dold->GetNbinsY();
+
+  /*
+  // decay
+  TString nam[38] = {
+  for(int i=0; i!=38; ++i) {
+    tProfile = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( nam[i].Data() ));
+    if(i==o) { // binning
+      nxs = tProfile->GetXaxis()->GetNbins();
+      nys = tProfile->GetYaxis()->GetNbins();
+      if(pt) {
+       nxs = nbins;
+       *nx = *bins;
+       for(int y=0; y!=nys; ++y)
+         ny[y] = tProfile->GetYaxis()->GetBinLowEdge(y+1);
+      } else {
+       nys = nbins;
+       *ny = *bins;
+       for(int x=0; x!=nxs; ++x)
+         nx[x] = tProfile->GetXaxis()->GetBinLowEdge(x+1);
+      }
+    }
+    tProfileNew = new TProfile2D(tProfile->GetName(),tProfile->GetTitle(),nxs,nx,nys,ny,"s"); list->Add( tProfileNew );
+    if(pt) {
+      for(int y=0; y!=nys; ++y) {
+       
+       for(int x=0; x!=nxs; ++x) {
+       }
+      }
+    } else {
+
+    }
+  }
+  */
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::QCStoreTrackVn(TString name) {
+  // getting transients
+  TProfile *pCos = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ));
+  TProfile *pSin = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ));
+  TProfile *qCos = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ));
+  TProfile *qSin = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ));
+  TProfile *q2hCos = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ));
+  TProfile *q2hSin = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ));
+  if(fDebug) {
+    printf("**QCStoreTrackVn( %s )\n",name.Data());
+    printf(" Read %.0f entries in p set and %.0f entries in q set\n",pCos->GetEntries(),qCos->GetEntries());
+    printf(" pCos[5] %.16f | pSin[5] %.16f \n", pCos->GetBinContent(5), pSin->GetBinContent(5));
+    printf(" qCos[5] %.16f | qSin[5] %.16f \n", qCos->GetBinContent(5), qSin->GetBinContent(5));
+    printf(" q2hCos[5] %.16f | q2hSin[5] %.16f \n", q2hCos->GetBinContent(5), q2hSin->GetBinContent(5));
+  }
+  // filling {2} and {4} correlator
+  TProfile *c2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
+  TProfile *c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
+  TProfile *dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
+  TProfile *dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
+  TProfile *c2c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
+  TProfile *c2dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
+  TProfile *c2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
+  TProfile *c4dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
+  TProfile *c4dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
+  TProfile *dc2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
+  double tpc_qcos = fQTPCACos + fQTPCCCos;
+  double tpc_qsin = fQTPCASin + fQTPCCSin;
+  double tpc_qsqr = tpc_qcos*tpc_qcos + tpc_qsin*tpc_qsin;
+  double tpc_q2hsqr = fQTPC2hCos*fQTPC2hCos + fQTPC2hSin*fQTPC2hSin;
+  double tpc_qmul = fQTPCA + fQTPCC;
+  int n = c2->GetNbinsX();
+  for(int i=1; i!=n+1; ++i) {
+    double mp = pCos->GetBinEntries( i );
+    if( mp<1 ) { if(fDebug>2) printf(" bin %d:: mp (%.16f) < 1!\n",i,mp); continue; }
+    double mm1 = tpc_qmul*(tpc_qmul-1);
+    if( mm1<1e-100 ) { if(fDebug>2) printf(" bin %d:: mm1<1e-100!\n",i); continue; }
+    double mq = qCos->GetBinEntries( i );
+    double mpmmq = mp*tpc_qmul-mq;
+    if( mpmmq<1e-100 )  { if(fDebug>2) printf(" bin %d:: mpmmq<1e-100!\n",i); continue; }
+    double pt = c2->GetBinCenter( i );
+    double pcos = pCos->GetBinContent( i )*mp;
+    double psin = pSin->GetBinContent( i )*mp;
+    double qcos = qCos->GetBinContent( i )*mq;
+    double qsin = qSin->GetBinContent( i )*mq;
+    double q2hcos = q2hCos->GetBinContent( i )*mq;
+    double q2hsin = q2hSin->GetBinContent( i )*mq;
+    double pQ = pcos*tpc_qcos+psin*tpc_qsin;
+    double q2nQnQn = (qcos*tpc_qcos + qsin*tpc_qsin)*tpc_qcos + (qsin*tpc_qcos-qcos*tpc_qsin)*tpc_qsin;
+    double pnQnQ2n = (pcos*tpc_qcos - psin*tpc_qsin)*fQTPC2hCos + (psin*tpc_qcos+pcos*tpc_qsin)*fQTPC2hSin;
+    double tC2 = (tpc_qsqr-tpc_qmul)/mm1;
+    double tDC2 = (pQ-mq)/mpmmq;
+    c2->Fill( pt, tC2, mm1 );
+    dc2->Fill( pt, tDC2, mpmmq );
+    c2dc2->Fill( pt, tC2*tDC2, mm1*mpmmq );
+    double mm1m2m3 = tpc_qmul*(tpc_qmul-1)*(tpc_qmul-2)*(tpc_qmul-3);
+    if(mm1m2m3<1e-100) continue;
+    double mpm3mqm1m2 = (mp*tpc_qmul-3*mq)*(tpc_qmul-1)*(tpc_qmul-2);
+    if(mpm3mqm1m2<1e-100) continue;
+    double req2hqnqn = fQTPC2hCos*(tpc_qcos*tpc_qcos-tpc_qsin*tpc_qsin)+2*fQTPC2hSin*tpc_qcos*tpc_qsin;
+    double tC4 = (tpc_qsqr*tpc_qsqr + tpc_q2hsqr - 2*req2hqnqn - 2*(2*tpc_qsqr*(tpc_qmul-2)-tpc_qmul*(tpc_qmul-3)))/mm1m2m3;
+    double tDC4 = pQ*tpc_qsqr -q2nQnQn -pnQnQ2n -2*(tpc_qmul-1)*pQ -2*mq*(tpc_qsqr-tpc_qmul+3) +6*(qcos*tpc_qcos+qsin*tpc_qsin) +(q2hcos*fQTPC2hCos+q2hsin*fQTPC2hSin);
+    tDC4 /= mpm3mqm1m2;
+    c4->Fill( pt, tC4, mm1m2m3 );
+    dc4->Fill( pt, tDC4, mpm3mqm1m2 );
+    c2c4->Fill( pt, tC2*tC4, mm1*mm1m2m3 );
+    c2dc4->Fill( pt, tC2*tDC4, mm1*mpm3mqm1m2 );
+    c4dc2->Fill( pt, tC4*tDC2, mm1m2m3*mpmmq );
+    c4dc4->Fill( pt, tC4*tDC4, mm1m2m3*mpm3mqm1m2 );
+    dc2dc4->Fill( pt, tDC2*tDC4, mpmmq*mpm3mqm1m2 );
+  }
+  // clean for next event
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Reset();
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Reset();
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Reset();
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Reset();
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Reset();
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Reset();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::QCStoreDecayVn(TString name) {
+  // getting transients
+  TProfile2D *pCos = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ));
+  TProfile2D *pSin = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ));
+  TProfile2D *qCos = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ));
+  TProfile2D *qSin = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ));
+  TProfile2D *q2hCos = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ));
+  TProfile2D *q2hSin = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ));
+  if(fDebug) {
+    printf("**QCStoreTrackVn( %s )\n",name.Data());
+    printf(" Read %.0f entries in p set and %.0f entries in q set\n",pCos->GetEntries(),qCos->GetEntries());
+    printf(" pCos[5][5] %.16f | pSin[5][5] %.16f \n", pCos->GetBinContent(5,5), pSin->GetBinContent(5,5));
+    printf(" qCos[5][5] %.16f | qSin[5][5] %.16f \n", qCos->GetBinContent(5,5), qSin->GetBinContent(5,5));
+    printf(" q2hCos[5][5] %.16f | q2hSin[5][5] %.16f \n", q2hCos->GetBinContent(5,5), q2hSin->GetBinContent(5,5));
+  }
+  // filling {2} and {4} correlator
+  TProfile2D *c2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
+  TProfile2D *c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
+  TProfile2D *dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
+  TProfile2D *dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
+  TProfile2D *c2c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
+  TProfile2D *c2dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
+  TProfile2D *c2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
+  TProfile2D *c4dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
+  TProfile2D *c4dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
+  TProfile2D *dc2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
+  double tpc_qcos = fQTPCACos + fQTPCCCos;
+  double tpc_qsin = fQTPCASin + fQTPCCSin;
+  double tpc_qsqr = tpc_qcos*tpc_qcos + tpc_qsin*tpc_qsin;
+  double tpc_q2hsqr = fQTPC2hCos*fQTPC2hCos + fQTPC2hSin*fQTPC2hSin;
+  double tpc_qmul = fQTPCA + fQTPCC;
+  int n = c2->GetNbinsX();
+  int m = c2->GetNbinsY();
+  for(int i=1; i!=n+1; ++i) {
+    double pt = c2->GetXaxis()->GetBinCenter( i );
+    for(int j=1; j!=m+1; ++j) {
+      double ms = c2->GetYaxis()->GetBinCenter( j );
+      int k = pCos->GetBin(i,j);
+      double mp = pCos->GetBinEntries( k );
+      if( mp<1 ) { if(fDebug>2) printf(" bin %d,%d:: mp (%.16f) < 1!\n",i,j,mp); continue; }
+      double mm1 = tpc_qmul*(tpc_qmul-1);
+      if( mm1<1e-100 ) { if(fDebug>2) printf(" bin %d,%d:: mm1<1e-100!\n",i,j); continue; }
+      double mq = qCos->GetBinEntries( k );
+      double mpmmq = mp*tpc_qmul-mq;
+      if( mpmmq<1e-100 )  { if(fDebug>2) printf(" bin %d,%d:: mpmmq<1e-100!\n",i,j); continue; }
+      double pcos = pCos->GetBinContent( i,j )*mp;
+      double psin = pSin->GetBinContent( i,j )*mp;
+      double qcos = qCos->GetBinContent( i,j )*mq;
+      double qsin = qSin->GetBinContent( i,j )*mq;
+      double q2hcos = q2hCos->GetBinContent( i,j )*mq;
+      double q2hsin = q2hSin->GetBinContent( i,j )*mq;
+      double pQ = pcos*tpc_qcos+psin*tpc_qsin;
+      double q2nQnQn = (qcos*tpc_qcos + qsin*tpc_qsin)*tpc_qcos + (qsin*tpc_qcos-qcos*tpc_qsin)*tpc_qsin;
+      double pnQnQ2n = (pcos*tpc_qcos - psin*tpc_qsin)*fQTPC2hCos + (psin*tpc_qcos+pcos*tpc_qsin)*fQTPC2hSin;
+      double tC2 = (tpc_qsqr-tpc_qmul)/mm1;
+      double tDC2 = (pQ-mq)/mpmmq;
+      c2->Fill( pt, ms, tC2, mm1 );
+      dc2->Fill( pt, ms, tDC2, mpmmq );
+      c2dc2->Fill( pt, ms, tC2*tDC2, mm1*mpmmq );
+      double mm1m2m3 = tpc_qmul*(tpc_qmul-1)*(tpc_qmul-2)*(tpc_qmul-3);
+      if(mm1m2m3<1e-100) continue;
+      double mpm3mqm1m2 = (mp*tpc_qmul-3*mq)*(tpc_qmul-1)*(tpc_qmul-2);
+      if(mpm3mqm1m2<1e-100) continue;
+      double req2hqnqn = fQTPC2hCos*(tpc_qcos*tpc_qcos-tpc_qsin*tpc_qsin)+2*fQTPC2hSin*tpc_qcos*tpc_qsin;
+      double tC4 = (tpc_qsqr*tpc_qsqr + tpc_q2hsqr - 2*req2hqnqn - 2*(2*tpc_qsqr*(tpc_qmul-2)-tpc_qmul*(tpc_qmul-3)))/mm1m2m3;
+      double tDC4 = pQ*tpc_qsqr -q2nQnQn -pnQnQ2n -2*(tpc_qmul-1)*pQ -2*mq*(tpc_qsqr-tpc_qmul+3) +6*(qcos*tpc_qcos+qsin*tpc_qsin) +(q2hcos*fQTPC2hCos+q2hsin*fQTPC2hSin);
+      tDC4 /= mpm3mqm1m2;
+      c4->Fill( pt, ms, tC4, mm1m2m3 );
+      dc4->Fill( pt, ms, tDC4, mpm3mqm1m2 );
+      c2c4->Fill( pt, ms, tC2*tC4, mm1*mm1m2m3 );
+      c2dc4->Fill( pt, ms, tC2*tDC4, mm1*mpm3mqm1m2 );
+      c4dc2->Fill( pt, ms, tC4*tDC2, mm1m2m3*mpmmq );
+      c4dc4->Fill( pt, ms, tC4*tDC4, mm1m2m3*mpm3mqm1m2 );
+      dc2dc4->Fill( pt, ms, tDC2*tDC4, mpmmq*mpm3mqm1m2 );
+    }
+  }
+  // clean for next event
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Reset();
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Reset();
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Reset();
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Reset();
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Reset();
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Reset();
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillTrackVn(TString name,Double_t pt,Double_t phi,Double_t eta,Int_t fid) {
+  // reading vze qm
+  Double_t vzec_qmcos = fQVZECCos/fQVZEC;
+  Double_t vzec_qmsin = fQVZECSin/fQVZEC;
+  Double_t vzea_qmcos = fQVZEACos/fQVZEA;
+  Double_t vzea_qmsin = fQVZEASin/fQVZEA;
+  // reading tpc qm
+  Double_t tpcc_qmcos = fQTPCCCos/fQTPCC;
+  Double_t tpcc_qmsin = fQTPCCSin/fQTPCC;
+  Double_t tpca_qmcos = fQTPCACos/fQTPCA;
+  Double_t tpca_qmsin = fQTPCASin/fQTPCA;
+  Double_t qtpc = fQTPCA+fQTPCC;
+  Double_t tpc_qmcos = (fQTPCACos+fQTPCCCos)/qtpc;
+  Double_t tpc_qmsin = (fQTPCASin+fQTPCCSin)/qtpc;
+  // computing u
+  Double_t cosn = TMath::Cos(fHarmonic*phi);
+  Double_t sinn = TMath::Sin(fHarmonic*phi);
+  Double_t cos2n = TMath::Cos(2.0*fHarmonic*phi);
+  Double_t sin2n = TMath::Sin(2.0*fHarmonic*phi);
+  // Scalar Product
+  Double_t uQ, uQa, uQc, qaqc;
+  // filling flow with vze
+  qaqc = (vzea_qmcos*vzec_qmcos + vzea_qmsin*vzec_qmsin);
+  uQa = (cosn*vzea_qmcos + sinn*vzea_qmsin);
+  uQc = (cosn*vzec_qmcos + sinn*vzec_qmsin);
+  Double_t cosmc = TMath::Cos( fHarmonic*GetMCDPHI(phi) );
+  if(fReadMC) {
+    ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQVZEA" ))->Fill( cosmc,uQa );
+    ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQVZEC" ))->Fill( cosmc,uQc );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI" ))->Fill( pt,cosmc );
+  }
+  Double_t qaqt = (vzea_qmcos*tpc_qmcos + vzea_qmsin*tpc_qmsin);
+  Double_t qcqt = (vzec_qmcos*tpc_qmcos + vzec_qmsin*tpc_qmsin);
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" ))->Fill( pt,uQa,fQVZEA );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" ))->Fill( pt,uQc,fQVZEC );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" ))->Fill( pt,qaqc,fQVZEA*fQVZEC );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" ))->Fill( pt,qaqt,fQVZEA*qtpc );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" ))->Fill( pt,qcqt,fQVZEC*qtpc );
+  // error vze
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" ))->Fill( pt,uQa*uQc,fQVZEA*fQVZEC );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" ))->Fill( pt,uQa*qaqc,fQVZEA*fQVZEA*fQVZEC );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" ))->Fill( pt,uQc*qaqc,fQVZEC*fQVZEA*fQVZEC );
+  // filling flow with tpc
+  qaqc = (tpca_qmcos*tpcc_qmcos + tpca_qmsin*tpcc_qmsin);
+  if(eta<0) {
+    uQ = (cosn*tpca_qmcos + sinn*tpca_qmsin);
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" ))->Fill( pt,uQ,fQTPCA );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" ))->Fill( pt,uQ*qaqc,fQTPCA*fQTPCA*fQTPCC );
+    if(fReadMC) {
+      ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQTPCA" ))->Fill( cosmc,uQ );
+    }
+  } else {
+    uQ = (cosn*tpcc_qmcos + sinn*tpcc_qmsin);
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" ))->Fill( pt,uQ,fQTPCC );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" ))->Fill( pt,uQ*qaqc,fQTPCC*fQTPCA*fQTPCC );
+    if(fReadMC) {
+      ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQTPCC" ))->Fill( cosmc,uQ );
+    }
+  }
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" ))->Fill( pt,qaqc,fQTPCA*fQTPCC );
+  // QC
+  ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_P" ))->Fill( pt );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Fill( pt, cosn, 1.0 );
+  ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Fill( pt, sinn, 1.0 );
+  if(InQTPC(fid)) {
+    ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_Q" ))->Fill( pt );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Fill( pt, cosn, 1.0 );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Fill( pt, sinn, 1.0 );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Fill( pt, cos2n, 1.0 );
+    ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Fill( pt, sin2n, 1.0 );
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::FillDecayVn(TString name,Double_t ms,Double_t pt,Double_t phi,Double_t eta,Int_t fid1,Int_t fid2) {
+  ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "DecayYield_PtMass" ))->Fill( pt,ms );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "DecayAvgPt_PtMass" ))->Fill( pt,ms,pt );
+
+  // reading vze qm
+  Double_t vzec_qmcos = fQVZECCos/fQVZEC;
+  Double_t vzec_qmsin = fQVZECSin/fQVZEC;
+  Double_t vzea_qmcos = fQVZEACos/fQVZEA;
+  Double_t vzea_qmsin = fQVZEASin/fQVZEA;
+  // reading tpc qm
+  Double_t tpcc_qmcos = fQTPCCCos/fQTPCC;
+  Double_t tpcc_qmsin = fQTPCCSin/fQTPCC;
+  Double_t tpca_qmcos = fQTPCACos/fQTPCA;
+  Double_t tpca_qmsin = fQTPCASin/fQTPCA;
+  Double_t qtpc = fQTPCA+fQTPCC;
+  Double_t tpc_qmcos = (fQTPCACos+fQTPCCCos)/qtpc;
+  Double_t tpc_qmsin = (fQTPCASin+fQTPCCSin)/qtpc;
+  // computing u
+  Double_t cosn = TMath::Cos(fHarmonic*phi);
+  Double_t sinn = TMath::Sin(fHarmonic*phi);
+  Double_t cos2n = TMath::Cos(2.0*fHarmonic*phi);
+  Double_t sin2n = TMath::Sin(2.0*fHarmonic*phi);
+  // Scalar Product
+  Double_t uQ, uQa, uQc, qaqc;
+  // filling flow with vze
+  qaqc = (vzea_qmcos*vzec_qmcos + vzea_qmsin*vzec_qmsin);
+  uQa = (cosn*vzea_qmcos + sinn*vzea_qmsin);
+  uQc = (cosn*vzec_qmcos + sinn*vzec_qmsin);
+  Double_t cosmc = TMath::Cos( fHarmonic*GetMCDPHI(phi) );
+  if(fReadMC) {
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI" ))->Fill( pt,ms,cosmc );
+  }
+  Double_t qaqt = (vzea_qmcos*tpc_qmcos + vzea_qmsin*tpc_qmsin);
+  Double_t qcqt = (vzec_qmcos*tpc_qmcos + vzec_qmsin*tpc_qmsin);
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" ))->Fill( pt,ms,uQa,fQVZEA );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" ))->Fill( pt,ms,uQc,fQVZEC );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" ))->Fill( pt,ms,qaqc,fQVZEA*fQVZEC );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" ))->Fill( pt,ms,qaqt,fQVZEA*qtpc );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" ))->Fill( pt,ms,qcqt,fQVZEC*qtpc );
+  // error vze
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" ))->Fill( pt,ms,uQa*uQc,fQVZEA*fQVZEC );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" ))->Fill( pt,ms,uQa*qaqc,fQVZEA*fQVZEA*fQVZEC );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" ))->Fill( pt,ms,uQc*qaqc,fQVZEC*fQVZEA*fQVZEC );
+  // filling flow with tpc
+  qaqc = (tpca_qmcos*tpcc_qmcos + tpca_qmsin*tpcc_qmsin);
+  if(eta<0) {
+    uQ = (cosn*tpca_qmcos + sinn*tpca_qmsin);
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" ))->Fill( pt,ms,uQ,fQTPCA );
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" ))->Fill( pt,ms,uQ*qaqc,fQTPCA*fQTPCA*fQTPCC );
+  } else {
+    uQ = (cosn*tpcc_qmcos + sinn*tpcc_qmsin);
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" ))->Fill( pt,ms,uQ,fQTPCC );
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" ))->Fill( pt,ms,uQ*qaqc,fQTPCC*fQTPCA*fQTPCC );
+  }
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" ))->Fill( pt,ms,qaqc,fQTPCA*fQTPCC );
+  // QC
+  ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_P" ))->Fill( pt,ms );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Fill( pt, ms, cosn, 1.0 );
+  ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Fill( pt, ms, sinn, 1.0 );
+  if(InQTPC(fid1)||InQTPC(fid2)) {
+    ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_Q" ))->Fill( pt,ms );
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Fill( pt, ms, cosn, 1.0 );
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Fill( pt, ms, sinn, 1.0 );
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Fill( pt, ms, cos2n, 1.0 );
+    ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Fill( pt, ms, sin2n, 1.0 );
+  }
+}
+//=======================================================================
+Bool_t AliAnalysisTaskFlowStrangee::InQTPC(Int_t id) {
+  Bool_t ret = kFALSE;
+  for(int i=0; i!=fQTPCA_nTracks; ++i)
+    if(fQTPCA_fID[i]==id) {
+      ret=kTRUE;
+      break;
+    }
+  if(ret) return kTRUE;
+  for(int i=0; i!=fQTPCC_nTracks; ++i)
+    if(fQTPCC_fID[i]==id) {
+      ret=kTRUE;
+      break;
+    }
+  return ret;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ComputeTrackVn(TString name) {
+  TProfile *uQa, *uQc, *qaqc, *uQaqaqc, *uQcqaqc;
+  TArrayD *pasww, *pbsww, *pcsww;
+  //ScalarProducr TPC
+  printf("<<%s>> SP TPC\n",name.Data());
+  uQa  = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" );
+  uQc  = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" );
+  qaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" );
+  uQaqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" );
+  uQcqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" );
+  pasww = uQa->GetBinSumw2();
+  pbsww = uQc->GetBinSumw2();
+  pcsww = qaqc->GetBinSumw2();
+  //
+  TH1D *sptpca = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCA" );
+  TH1D *sptpcc = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCC" );
+  TH1D *sptpcaa = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCAA" );
+  //
+  for(Int_t i=1; i!=sptpcaa->GetNbinsX()+1; ++i) {
+    sptpcaa->SetBinContent(i,0);
+    sptpcaa->SetBinError(i,0);
+    sptpca->SetBinContent(i,0);
+    sptpca->SetBinError(i,0);
+    sptpcc->SetBinContent(i,0);
+    sptpcc->SetBinError(i,0);
+    double a = uQa->GetBinContent(i);
+    double b = uQc->GetBinContent(i);
+    double c = qaqc->GetBinContent(i);
+    //if(TMath::AreEqualAbs(a,0,1e-100)) continue;
+    //if(TMath::AreEqualAbs(b,0,1e-100)) continue;
+    if(c<1e-100) continue;
+    // nominal sptpca
+    double vna = a/TMath::Sqrt(c);
+    sptpca->SetBinContent(i,vna);
+    // nominal sptpcc
+    double vnc = b/TMath::Sqrt(c);
+    sptpcc->SetBinContent(i,vnc);
+    // nominal sptpc
+    double vn = (vna + vnc)/2.0;
+    sptpcaa->SetBinContent(i,vn);
+    // errors
+    double asw = uQa->GetBinEntries(i);
+    double bsw = uQc->GetBinEntries(i);
+    double csw = qaqc->GetBinEntries(i);
+    if(asw<1e-100||bsw<1e-100||csw<1e-100) continue;
+    double asww = pasww->At(i);
+    double bsww = pbsww->At(i);
+    double csww = pcsww->At(i);
+    if(asww<1e-100||bsww<1e-100||csww<1e-100) continue;
+    if((1<1e-100+asww/asw/asw)||(1<1e-100+bsww/bsw/bsw)||(1<1e-100+csww/csw/csw)) continue;
+    if(TMath::AreEqualAbs(asww,asw*asw,1e-100)||
+       TMath::AreEqualAbs(bsww,bsw*bsw,1e-100)||
+       TMath::AreEqualAbs(csww,csw*csw,1e-100)) continue;
+    double ac = uQaqaqc->GetBinContent(i);
+    double bc = uQcqaqc->GetBinContent(i);
+    double acsw = uQaqaqc->GetBinEntries(i);
+    double bcsw = uQcqaqc->GetBinEntries(i);
+    double ea = uQa->GetBinError(i)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
+    double eb = uQc->GetBinError(i)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
+    double ec = qaqc->GetBinError(i)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
+    //printf("%d >> ea^2 %.16f |||| asww %.16f | asw %.16f | 1-asww/asw/asw %.16f \n", i,ea, asww, asw, 1-asww/asw/asw);
+    //printf("%d >> eb^2 %.16f |||| bsww %.16f | bsw %.16f | 1-bsww/bsw/bsw %.16f \n", i,eb, bsww, bsw, 1-bsww/bsw/bsw);
+    //printf("%d >> ec^2 %.16f |||| csww %.16f | csw %.16f | 1-csww/csw/csw %.16f \n", i,ec, csww, csw, 1-csww/csw/csw);
+    double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
+    double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
+    double evna = 1.0/TMath::Abs(c) * ( ea*ea + vna*vna/TMath::Abs(c)/4.0*ec*ec - vna/TMath::Sqrt(c)*eac );
+    double evnc = 1.0/TMath::Abs(c) * ( eb*eb + vnc*vnc/TMath::Abs(c)/4.0*ec*ec - vnc/TMath::Sqrt(c)*ebc );
+    //printf("%d >> evna^2 %.16f |||| ea %.16f | ec %.16f | eac %.16f | c %.16f\n", i,evna, ea, ec, eac,c);
+    //printf("%d >> evnc^2 %.16f |||| eb %.16f | ec %.16f | ebc %.16f | c %.16f\n", i,evnc, eb, ec, ebc,c);
+    if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
+    if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
+    sptpca->SetBinError(i,evna);
+    sptpcc->SetBinError(i,evnc);
+    sptpcaa->SetBinError(i,TMath::Sqrt(evna*evna+evnc*evnc)/2.0);
+  }
+  //ScalarProduct VZE
+  printf("<<%s>> SP VZE\n",name.Data());
+  double cvzea2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEA"))->GetBinContent( 1 );
+  double cvzec2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEC"))->GetBinContent( 1 );
+  if( TMath::AreEqualAbs(cvzea2+cvzec2,0,1e-100) ) return;
+  uQa  = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" );
+  uQc  = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" );
+  qaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" );
+  uQaqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" );
+  uQcqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" );
+  pasww = uQa->GetBinSumw2();
+  pbsww = uQc->GetBinSumw2();
+  pcsww = qaqc->GetBinSumw2();
+  //
+  TProfile *qaqt = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" );
+  TProfile *qcqt = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" );
+  TProfile *uQauQc  = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" );
+  //
+  TH1D *spvzea = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEA" );
+  TH1D *spvzec = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEC" );
+  TH1D *spvzega = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEGA" );
+  TH1D *spvzewa = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEWA" );
+  for(Int_t i=1; i!=spvzewa->GetNbinsX()+1; ++i) {
+    spvzega->SetBinContent(i,0);
+    spvzega->SetBinError(i,0);
+    spvzewa->SetBinContent(i,0);
+    spvzewa->SetBinError(i,0);
+    spvzea->SetBinContent(i,0);
+    spvzea->SetBinError(i,0);
+    spvzec->SetBinContent(i,0);
+    spvzec->SetBinError(i,0);
+    double asw = uQa->GetBinEntries(i);
+    double bsw = uQc->GetBinEntries(i);
+    double csw = qaqc->GetBinEntries(i);
+    if(asw<1e-1||bsw<1e-1||csw<1e-1) continue;
+    double asww = pasww->At(i);
+    double bsww = pbsww->At(i);
+    double csww = pcsww->At(i);
+    if(asww<1e-1||bsww<1e-1||csww<1e-1) continue;
+    if((1<asww/asw/asw)||(1<bsww/bsw/bsw)||(1<csww/csw/csw)) continue;
+    double a = uQa->GetBinContent(i);
+    double b = uQc->GetBinContent(i);
+    double c = qaqc->GetBinContent(i);
+    double at = qaqt->GetBinContent(i);
+    double bt = qcqt->GetBinContent(i);
+    if(TMath::AreEqualAbs(a,0,1e-10)) continue;
+    if(TMath::AreEqualAbs(b,0,1e-10)) continue;
+    if(TMath::AreEqualAbs(c,0,1e-10)) continue;
+    if(TMath::AreEqualAbs(at,0,1e-10)) continue;
+    if(TMath::AreEqualAbs(bt,0,1e-10)) continue;
+    // nominal spvzea
+    double aa = c*at/bt;
+    if(aa<1e-100) continue;
+    double vna = a/TMath::Sqrt(aa);
+    spvzea->SetBinContent(i,vna);
+    // nominal spvzec
+    double bb = c*bt/at;
+    if(bb<1e-100) continue;
+    double vnc = b/TMath::Sqrt(bb);
+    spvzec->SetBinContent(i,vnc);
+    //nominal spvzewa
+    double vnwa = (cvzea2*vna + cvzec2*vnc) / (cvzea2+cvzec2);
+    spvzewa->SetBinContent(i,vnwa);
+    // nominal spvzega
+    double vnga = a*b/c;
+    if(vnga<1e-100) continue;
+    vnga = TMath::Sqrt(vnga);
+    spvzega->SetBinContent(i,vnga);
+    // errors
+    double ab = uQauQc->GetBinContent(i);
+    double ac = uQaqaqc->GetBinContent(i);
+    double bc = uQcqaqc->GetBinContent(i);
+    double absw = uQauQc->GetBinEntries(i);
+    double acsw = uQaqaqc->GetBinEntries(i);
+    double bcsw = uQcqaqc->GetBinEntries(i);
+    double ea = uQa->GetBinError(i)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
+    double eb = uQc->GetBinError(i)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
+    double ec = qaqc->GetBinError(i)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
+    if(TMath::AreEqualAbs(1,absw/asw/bsw,1e-100)||TMath::AreEqualAbs(1,bcsw/bsw/csw,1e-100)||TMath::AreEqualAbs(1,acsw/asw/csw,1e-100)) continue;
+    double eab = (ab-a*b)/(1-absw/asw/bsw)*absw/asw/bsw;
+    double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
+    double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
+    double nc, nec, neac, nebc;
+    nc = c*at/bt;
+    nec = ec*at/bt;
+    neac = eac*at/bt;
+    nebc = ebc*at/bt;
+    double evna = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*ea*ea + a*a/4.0*nec*nec - a*TMath::Abs(nc)*neac*neac );
+    nc = c*bt/at;
+    nec = ec*bt/at;
+    neac = eac*bt/at;
+    nebc = ebc*bt/at;
+    double evnc = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*eb*eb + b*b/4.0*nec*nec - b*TMath::Abs(nc)*nebc*nebc );
+    if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
+    if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
+    spvzea->SetBinError(i,evna);
+    spvzec->SetBinError(i,evnc);
+    double evnwa = TMath::Sqrt( cvzea2*cvzea2*evna*evna + cvzec2*cvzec2*evnc*evnc )/(cvzea2+cvzec2);
+    spvzewa->SetBinError(i,evnwa);
+    double evnga = 0.25/c/c * ( TMath::Abs(b*c/a)*ea*ea + TMath::Abs(a*c/b)*eb*eb + TMath::Abs(a*b/c)*ec*ec + 2*c*eab - 2*a*ebc - 2*b*eac );
+    if(evnga>1e-100) evnga = TMath::Sqrt(evnga); else evnga=0;
+    spvzega->SetBinError(i,evnga);
+  }
+  printf("<<%s>> QC TPC\n",name.Data());
+  //Qcumulants
+  TH1D *resC2 = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum2" );
+  TH1D *resC4 = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum4" );
+  TH1D *resDC2= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum2" );
+  TH1D *resDC4= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum4" );
+  TH1D *resvn2= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn2" );
+  TH1D *resvn4= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn4" );
+  //correlators
+  TProfile *c2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
+  TProfile *c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
+  TProfile *dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
+  TProfile *dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
+  TProfile *c2c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
+  TProfile *c2dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
+  TProfile *c2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
+  TProfile *c4dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
+  TProfile *c4dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
+  TProfile *dc2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
+  TArrayD *c2sww = c2->GetBinSumw2();
+  TArrayD *c4sww = c4->GetBinSumw2();
+  TArrayD *dc2sww= dc2->GetBinSumw2();
+  TArrayD *dc4sww= dc4->GetBinSumw2();
+  for(Int_t i=1; i!=resvn2->GetNbinsX()+1; ++i) {
+    // cn{2}
+    double v_c2sw = c2->GetBinEntries(i);
+    if(v_c2sw<1e-100) continue;
+    double v_c2sww = c2sww->At(i);
+    double v_c2 = c2->GetBinContent(i);
+    double e_c2 = TMath::Sqrt(v_c2sww)/v_c2sw*c2->GetBinError(i);
+    double cum2 = v_c2;
+    double ecum2= e_c2;
+    resC2->SetBinContent(i, cum2 );
+    resC2->SetBinError(i, ecum2 );
+    // cn{4}
+    double v_c4sw = c4->GetBinEntries(i);
+    if(v_c4sw<1e-100) continue;
+    double v_c4sww = c4sww->At(i);
+    double v_c4 = c4->GetBinContent(i);
+    double e_c4 = TMath::Sqrt(v_c4sww)/v_c4sw*c4->GetBinError(i);
+    double v_c2c4 = c2c4->GetBinContent(i);
+    double v_c2c4sw = c2c4->GetBinEntries(i);
+    if(TMath::AreEqualAbs(v_c2c4sw/v_c2sw/v_c4sw,1,1e-100)) continue;
+    double covc2c4 = v_c2c4sw/v_c2sw/v_c4sw*(v_c2c4 - v_c2*v_c4)/(1-v_c2c4sw/v_c2sw/v_c4sw);
+    double cum4 = v_c4 - 2*v_c2*v_c2;
+    double ecum4= 16.0*v_c2*v_c2*e_c2*e_c2 + e_c4*e_c4 - 8.0*v_c2*covc2c4;
+    if(ecum4<1e-100) continue;
+    ecum4 = TMath::Sqrt( ecum4 );
+    resC4->SetBinContent(i, cum4 );
+    resC4->SetBinError(i, ecum4 );
+    // dn{2}
+    double v_dc2sw = dc2->GetBinEntries(i);
+    if(v_dc2sw<1) continue;
+    double v_dc2 = dc2->GetBinContent(i);
+    double v_dc2sww = dc2sww->At(i);
+    double e_dc2 = TMath::Sqrt(v_dc2sww)/v_dc2sw*dc2->GetBinError(i);
+    double dcum2 = v_dc2;
+    double edcum2= e_dc2;
+    resDC2->SetBinContent(i, dcum2 );
+    resDC2->SetBinError(i, edcum2 );
+    // v2{2}
+    if(v_c2<1e-100) continue;
+    double dv22 = v_dc2/TMath::Sqrt(v_c2);
+    double v_c2dc2 = c2dc2->GetBinContent(i);
+    double v_c2dc2sw = c2dc2->GetBinEntries(i);
+    if(TMath::AreEqualAbs(v_c2dc2sw/v_c2sw/v_dc2sw,1,1e-100)) continue;
+    double covc2dc2 = v_c2dc2sw/v_c2sw/v_dc2sw*(v_c2dc2 - v_c2*v_dc2)/(1-v_c2dc2sw/v_c2sw/v_dc2sw);
+    double edv22 = 0.25/v_c2/v_c2/v_c2*(v_dc2*v_dc2*e_c2*e_c2 + 4*v_c2*v_c2*e_dc2*e_dc2 - 4*v_c2*v_dc2*covc2dc2);
+    //printf("%d >> dv22 %.16f || edv22^2 %.16f |||| v_c2dc2 %.16f | v_c2dc2sw %.16f | covc2dc2 %.16f \n", i,dv22,edv22,v_c2dc2,v_c2dc2sw,covc2dc2);
+    if(edv22<1e-100) continue;
+    edv22 = TMath::Sqrt(edv22);
+    resvn2->SetBinContent(i,dv22);
+    resvn2->SetBinError(i,edv22);
+    // dn{4}
+    double v_dc4sw = dc4->GetBinEntries(i);
+    if(v_dc4sw<1) continue;
+    double v_dc4 = dc4->GetBinContent(i);
+    double v_dc4sww = dc4sww->At(i);
+    double e_dc4 = TMath::Sqrt(v_dc4sww)/v_dc4sw*dc4->GetBinError(i);
+    double dcum4 = v_dc4 - 2*v_c2*v_dc2;
+    double v_c2dc4 = c2dc4->GetBinContent(i);
+    double v_c2dc4sw = c2dc4->GetBinEntries(i);
+    if(TMath::AreEqualAbs(v_c2dc4sw/v_c2sw/v_dc4sw,1,1e-100)) continue;
+    double covc2dc4 = v_c2dc4sw/v_c2sw/v_dc4sw*(v_c2dc4 - v_c2*v_dc4)/(1-v_c2dc4sw/v_c2sw/v_dc4sw);
+    double v_dc2dc4 = dc2dc4->GetBinContent(i);
+    double v_dc2dc4sw = dc2dc4->GetBinEntries(i);
+    if(TMath::AreEqualAbs(v_dc2dc4sw/v_dc2sw/v_dc4sw,1,1e-100)) continue;
+    double covdc2dc4 = v_dc2dc4sw/v_dc2sw/v_dc4sw*(v_dc2dc4 - v_dc2*v_dc4)/(1-v_dc2dc4sw/v_dc2sw/v_dc4sw);
+    double edcum4= ( +4.0*v_dc2*v_dc2*e_c2*e_c2
+                    +4.0*v_c2*v_c2*e_dc2*e_dc2
+                    +e_dc4*e_dc4
+                    +8.0*v_c2*v_dc2*covc2dc2
+                    -4.0*v_dc2*covc2dc4
+                    -4.0*v_c2*covdc2dc4 );
+    if(edcum4<1e-100) continue;
+    edcum4 = TMath::Sqrt(edcum4);
+    resDC4->SetBinContent(i, dcum4 );
+    resDC4->SetBinError(i, edcum4 );
+    // v2{4}
+    if(cum4>1e-100) continue;
+    double dv24 = -dcum4/TMath::Power(-cum4,0.75);
+    double dterm1 = 2*v_c2*v_c2*v_dc2 - 3*v_c2*v_dc4 + 2*v_c4*v_dc2;
+    double dterm2 = 9.0/16.0*dcum4*dcum4;
+    double dterm3 = 4.0*v_c2*v_c2*cum4*cum4;
+    double dterm4 = cum4*cum4;
+    double dterm5 = -3.0/2.0*dcum4*dterm1;
+    double dterm6 = -4.0*v_c2*cum4*dterm1;
+    double dterm7 = -2.0*cum4*dterm1;
+    double dterm8 = 3.0*v_c2*cum4*dcum4;
+    double dterm9 = 3.0/2.0*cum4*dcum4;
+    double dterm10= 4*v_c2*cum4*cum4;
+    double v_c4dc2 = c4dc2->GetBinContent(i);
+    double v_c4dc2sw = c4dc2->GetBinEntries(i);
+    if(TMath::AreEqualAbs(v_c4dc2sw/v_c4sw/v_dc2sw,1,1e-100)) continue;
+    double covc4dc2 = v_c4dc2sw/v_c4sw/v_dc2sw*(v_c4dc2 - v_c4*v_dc2)/(1-v_c4dc2sw/v_c4sw/v_dc2sw);
+    double v_c4dc4 = c4dc4->GetBinContent(i);
+    double v_c4dc4sw = c4dc4->GetBinEntries(i);
+    if(TMath::AreEqualAbs(v_c4dc4sw/v_c4sw/v_dc4sw,1,1e-100)) continue;
+    double covc4dc4 = v_c4dc4sw/v_c4sw/v_dc4sw*(v_c4dc4 - v_c4*v_dc4)/(1-v_c4dc4sw/v_c4sw/v_dc4sw);
+    double edv24= 1.0/TMath::Power(-cum4,3.5)*(+dterm1*dterm1*e_c2*e_c2
+                                              +dterm2*e_c4*e_c4
+                                              +dterm3*e_dc2*e_dc2
+                                              +dterm4*e_dc4*e_dc4
+                                              -dterm5*covc2c4
+                                              -dterm6*covc2dc2
+                                              +dterm7*covc2dc4
+                                              +dterm8*covc4dc2
+                                              -dterm9*covc4dc4
+                                              -dterm10*covdc2dc4);
+    if(edv24<1e-100) continue;
+    edv24 = TMath::Sqrt(edv24);
+    resvn4->SetBinContent(i,dv24);
+    resvn4->SetBinError(i,edv24);
+  }
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::ComputeDecayVn(TString name) {
+  TProfile2D *uQa, *uQc, *qaqc, *uQaqaqc, *uQcqaqc;
+  TArrayD *pasww, *pbsww, *pcsww;
+  //ScalarProducr TPC
+  printf("<<%s>> SP TPC\n",name.Data());
+  uQa  = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" );
+  uQc  = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" );
+  qaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" );
+  uQaqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" );
+  uQcqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" );
+  pasww = uQa->GetBinSumw2();
+  pbsww = uQc->GetBinSumw2();
+  pcsww = qaqc->GetBinSumw2();
+  //
+  TH2D *sptpca = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCA" );
+  TH2D *sptpcc = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCC" );
+  TH2D *sptpcaa = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCAA" );
+  //
+  for(Int_t i=1; i!=sptpcaa->GetNbinsX()+1; ++i) {
+    for(Int_t j=1; j!=sptpcaa->GetNbinsY()+1; ++j) {
+      sptpcaa->SetBinContent(i,j,0);
+      sptpcaa->SetBinError(i,j,0);
+      sptpca->SetBinContent(i,j,0);
+      sptpca->SetBinError(i,j,0);
+      sptpcc->SetBinContent(i,j,0);
+      sptpcc->SetBinError(i,j,0);
+      double a = uQa->GetBinContent(i,j);
+      double b = uQc->GetBinContent(i,j);
+      double c = qaqc->GetBinContent(i,j);
+      //if(TMath::AreEqualAbs(a,0,1e-100)) continue;
+      //if(TMath::AreEqualAbs(b,0,1e-100)) continue;
+      if(c<1e-100) {printf("skipping i=%d, j=%d due to c=%.16f\n",i,j,c); continue;}
+      // nominal sptpca
+      double vna = a/TMath::Sqrt(c);
+      sptpca->SetBinContent(i,j,vna);
+      // nominal sptpcc
+      double vnc = b/TMath::Sqrt(c);
+      sptpcc->SetBinContent(i,j,vnc);
+      // nominal sptpc
+      double vn = (vna + vnc)/2.0;
+      sptpcaa->SetBinContent(i,j,vn);
+      // errors
+      int k = sptpcaa->GetBin(i,j);
+      double asw = uQa->GetBinEntries(k);
+      double bsw = uQc->GetBinEntries(k);
+      double csw = qaqc->GetBinEntries(k);
+      if(asw<1e-100||bsw<1e-100||csw<1e-100) {printf("skipping i=%d, j=%d due to asw=%f or bsw=%f or csw=%f\n",i,j,asw,bsw,csw); continue;}
+      double asww = pasww->At(k);
+      double bsww = pbsww->At(k);
+      double csww = pcsww->At(k);
+      if(asww<1e-100||bsww<1e-100||csww<1e-100) {printf("skipping i=%d, j=%d due to asww=%f or bsww=%f or csww=%f\n",i,j,asww,bsww,csww); continue;}
+      if((1<1e-100+asww/asw/asw)||(1<1e-100+bsww/bsw/bsw)||(1<1e-100+csww/csw/csw)) {printf("skipping i=%d, j=%d due to COVa=%f or COVb=%f or COVc=%f\n",i,j,asww/asw/asw,bsww/bsw/bsw,csww/csw/csw); continue;}
+      if(TMath::AreEqualAbs(asww,asw*asw,1e-100)||
+        TMath::AreEqualAbs(bsww,bsw*bsw,1e-100)||
+        TMath::AreEqualAbs(csww,csw*csw,1e-100)) {printf("skipping i=%d, j=%d due to funny coincidence\n",i,j); continue;}
+      double ac = uQaqaqc->GetBinContent(i,j);
+      double bc = uQcqaqc->GetBinContent(i,j);
+      double acsw = uQaqaqc->GetBinEntries(k);
+      double bcsw = uQcqaqc->GetBinEntries(k);
+      double ea = uQa->GetBinError(i,j)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
+      double eb = uQc->GetBinError(i,j)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
+      double ec = qaqc->GetBinError(i,j)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
+      //printf("%d >> ea^2 %.16f |||| asww %.16f | asw %.16f | 1-asww/asw/asw %.16f \n", i,ea, asww, asw, 1-asww/asw/asw);
+      //printf("%d >> eb^2 %.16f |||| bsww %.16f | bsw %.16f | 1-bsww/bsw/bsw %.16f \n", i,eb, bsww, bsw, 1-bsww/bsw/bsw);
+      //printf("%d >> ec^2 %.16f |||| csww %.16f | csw %.16f | 1-csww/csw/csw %.16f \n", i,ec, csww, csw, 1-csww/csw/csw);
+      double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
+      double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
+      double evna = 1.0/TMath::Abs(c) * ( ea*ea + vna*vna/TMath::Abs(c)/4.0*ec*ec - vna/TMath::Sqrt(c)*eac );
+      double evnc = 1.0/TMath::Abs(c) * ( eb*eb + vnc*vnc/TMath::Abs(c)/4.0*ec*ec - vnc/TMath::Sqrt(c)*ebc );
+      //printf("%d >> evna^2 %.16f |||| ea %.16f | ec %.16f | eac %.16f | c %.16f\n", i,evna, ea, ec, eac,c);
+      //printf("%d >> evnc^2 %.16f |||| eb %.16f | ec %.16f | ebc %.16f | c %.16f\n", i,evnc, eb, ec, ebc,c);
+      if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
+      if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
+      sptpca->SetBinError(i,j,evna);
+      sptpcc->SetBinError(i,j,evnc);
+      sptpcaa->SetBinError(i,j,TMath::Sqrt(evna*evna+evnc*evnc)/2.0);
+    }
+  }
+  //ScalarProduct VZE
+  printf("<<%s>> SP VZE\n",name.Data());
+  double cvzea2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEA"))->GetBinContent( 1 );
+  double cvzec2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEC"))->GetBinContent( 1 );
+  if( TMath::AreEqualAbs(cvzea2+cvzec2,0,1e-100) ) return;
+  uQa  = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" );
+  uQc  = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" );
+  qaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" );
+  uQaqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" );
+  uQcqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" );
+  pasww = uQa->GetBinSumw2();
+  pbsww = uQc->GetBinSumw2();
+  pcsww = qaqc->GetBinSumw2();
+  //
+  TProfile2D *qaqt = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" );
+  TProfile2D *qcqt = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" );
+  TProfile2D *uQauQc  = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" );
+  //
+  TH2D *spvzea = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEA" );
+  TH2D *spvzec = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEC" );
+  TH2D *spvzega = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEGA" );
+  TH2D *spvzewa = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEWA" );
+  for(Int_t i=1; i!=spvzewa->GetNbinsX()+1; ++i) {
+    for(Int_t j=1; j!=spvzewa->GetNbinsY()+1; ++j) {
+      spvzega->SetBinContent(i,j,0);
+      spvzega->SetBinError(i,j,0);
+      spvzewa->SetBinContent(i,j,0);
+      spvzewa->SetBinError(i,j,0);
+      spvzea->SetBinContent(i,j,0);
+      spvzea->SetBinError(i,j,0);
+      spvzec->SetBinContent(i,j,0);
+      spvzec->SetBinError(i,j,0);
+      double a = uQa->GetBinContent(i,j);
+      double b = uQc->GetBinContent(i,j);
+      double c = qaqc->GetBinContent(i,j);
+      double at = qaqt->GetBinContent(i,j);
+      double bt = qcqt->GetBinContent(i,j);
+      if(TMath::AreEqualAbs(a,0,1e-100)) {printf("skipping A\n"); continue;}
+      if(TMath::AreEqualAbs(b,0,1e-100)) {printf("skipping B\n"); continue;}
+      if(TMath::AreEqualAbs(c,0,1e-100)) {printf("skipping C\n"); continue;}
+      if(TMath::AreEqualAbs(at,0,1e-100)) {printf("skipping AT\n"); continue;}
+      if(TMath::AreEqualAbs(bt,0,1e-100)) {printf("skipping CT\n"); continue;}
+      // nominal spvzea
+      double aa = c*at/bt;
+      if(aa<1e-100) {printf("AA\n"); continue;}
+      double vna = a/TMath::Sqrt(aa);
+      spvzea->SetBinContent(i,j,vna);
+      // nominal spvzec
+      double bb = c*bt/at;
+      if(bb<1e-100) {printf("BB\n"); continue;}
+      double vnc = b/TMath::Sqrt(bb);
+      spvzec->SetBinContent(i,j,vnc);
+      //nominal spvzewa
+      double vnwa = (cvzea2*vna + cvzec2*vnc) / (cvzea2+cvzec2);
+      spvzewa->SetBinContent(i,j,vnwa);
+      // nominal spvzega
+      double vnga = a*b/c;
+      if(vnga<1e-100) continue;
+      vnga = TMath::Sqrt(vnga);
+      spvzega->SetBinContent(i,j,vnga);
+      // errors
+      int k = spvzea->GetBin(i,j);
+      double asw = uQa->GetBinEntries(k);
+      double bsw = uQc->GetBinEntries(k);
+      double csw = qaqc->GetBinEntries(k);
+      if(asw<1e-100||bsw<1e-100||csw<1e-100) continue;
+      double asww = pasww->At(k);
+      double bsww = pbsww->At(k);
+      double csww = pcsww->At(k);
+      if(asww<1e-100||bsww<1e-100||csww<1e-100) continue;
+      if((1<asww/asw/asw)||(1<bsww/bsw/bsw)||(1<csww/csw/csw)) continue;
+      double ab = uQauQc->GetBinContent(i,j);
+      double ac = uQaqaqc->GetBinContent(i,j);
+      double bc = uQcqaqc->GetBinContent(i,j);
+      double absw = uQauQc->GetBinEntries(k);
+      double acsw = uQaqaqc->GetBinEntries(k);
+      double bcsw = uQcqaqc->GetBinEntries(k);
+      if(TMath::AreEqualAbs(1,absw/asw/bsw,1e-100)||TMath::AreEqualAbs(1,bcsw/bsw/csw,1e-100)||TMath::AreEqualAbs(1,acsw/asw/csw,1e-100)) continue;
+      double ea = uQa->GetBinError(i,j)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
+      double eb = uQc->GetBinError(i,j)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
+      double ec = qaqc->GetBinError(i,j)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
+      double eab = (ab-a*b)/(1-absw/asw/bsw)*absw/asw/bsw;
+      double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
+      double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
+      double nc, nec, neac, nebc;
+      nc = c*at/bt;
+      nec = ec*at/bt;
+      neac = eac*at/bt;
+      nebc = ebc*at/bt;
+      double evna = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*ea*ea + a*a/4.0*nec*nec - a*TMath::Abs(nc)*neac*neac );
+      nc = c*bt/at;
+      nec = ec*bt/at;
+      neac = eac*bt/at;
+      nebc = ebc*bt/at;
+      double evnc = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*eb*eb + b*b/4.0*nec*nec - b*TMath::Abs(nc)*nebc*nebc );
+      if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
+      if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
+      spvzea->SetBinError(i,j,evna);
+      spvzec->SetBinError(i,j,evnc);
+      double evnwa = TMath::Sqrt( cvzea2*cvzea2*evna*evna + cvzec2*cvzec2*evnc*evnc )/(cvzea2+cvzec2);
+      spvzewa->SetBinError(i,j,evnwa);
+      double evnga = 0.25/c/c * ( TMath::Abs(b*c/a)*ea*ea + TMath::Abs(a*c/b)*eb*eb + TMath::Abs(a*b/c)*ec*ec + 2*c*eab - 2*a*ebc - 2*b*eac );
+      if(evnga>1e-100) evnga = TMath::Sqrt(evnga); else evnga=0;
+      spvzega->SetBinError(i,j,evnga);
+    }
+  }
+  printf("<<%s>> QC TPC\n",name.Data());
+  //Qcumulants
+  TH2D *resC2 = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum2" );
+  TH2D *resC4 = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum4" );
+  TH2D *resDC2= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum2" );
+  TH2D *resDC4= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum4" );
+  TH2D *resvn2= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn2" );
+  TH2D *resvn4= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn4" );
+  //correlators
+  TProfile2D *c2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
+  TProfile2D *c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
+  TProfile2D *dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
+  TProfile2D *dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
+  TProfile2D *c2c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
+  TProfile2D *c2dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
+  TProfile2D *c2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
+  TProfile2D *c4dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
+  TProfile2D *c4dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
+  TProfile2D *dc2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
+  TArrayD *c2sww = c2->GetBinSumw2();
+  TArrayD *c4sww = c4->GetBinSumw2();
+  TArrayD *dc2sww= dc2->GetBinSumw2();
+  TArrayD *dc4sww= dc4->GetBinSumw2();
+  for(Int_t i=1; i!=resvn2->GetNbinsX()+1; ++i) {
+    for(Int_t j=1; j!=resvn2->GetNbinsY()+1; ++j) {
+      // cn{2}
+      int k = c2->GetBin(i,j);
+      double v_c2sw = c2->GetBinEntries(k);
+      if(v_c2sw<1e-100) continue;
+      double v_c2sww = c2sww->At(k);
+      double v_c2 = c2->GetBinContent(i,j);
+      double e_c2 = TMath::Sqrt(v_c2sww)/v_c2sw*c2->GetBinError(i,j);
+      double cum2 = v_c2;
+      double ecum2= e_c2;
+      resC2->SetBinContent(i,j, cum2 );
+      resC2->SetBinError(i,j, ecum2 );
+      // cn{4}
+      double v_c4sw = c4->GetBinEntries(k);
+      if(v_c4sw<1e-100) continue;
+      double v_c4sww = c4sww->At(k);
+      double v_c4 = c4->GetBinContent(i,j);
+      double e_c4 = TMath::Sqrt(v_c4sww)/v_c4sw*c4->GetBinError(i,j);
+      double v_c2c4 = c2c4->GetBinContent(i,j);
+      double v_c2c4sw = c2c4->GetBinEntries(k);
+      if(TMath::AreEqualAbs(v_c2c4sw/v_c2sw/v_c4sw,1,1e-100)) continue;
+      double covc2c4 = v_c2c4sw/v_c2sw/v_c4sw*(v_c2c4 - v_c2*v_c4)/(1-v_c2c4sw/v_c2sw/v_c4sw);
+      double cum4 = v_c4 - 2*v_c2*v_c2;
+      double ecum4= 16.0*v_c2*v_c2*e_c2*e_c2 + e_c4*e_c4 - 8.0*v_c2*covc2c4;
+      if(ecum4<1e-100) continue;
+      ecum4 = TMath::Sqrt( ecum4 );
+      resC4->SetBinContent(i,j, cum4 );
+      resC4->SetBinError(i,j, ecum4 );
+      // dn{2}
+      double v_dc2sw = dc2->GetBinEntries(k);
+      if(v_dc2sw<1) continue;
+      double v_dc2 = dc2->GetBinContent(i,j);
+      double v_dc2sww = dc2sww->At(k);
+      double e_dc2 = TMath::Sqrt(v_dc2sww)/v_dc2sw*dc2->GetBinError(i,j);
+      double dcum2 = v_dc2;
+      double edcum2= e_dc2;
+      resDC2->SetBinContent(i,j, dcum2 );
+      resDC2->SetBinError(i,j, edcum2 );
+      // v2{2}
+      if(v_c2<1e-100) continue;
+      double dv22 = v_dc2/TMath::Sqrt(v_c2);
+      double v_c2dc2 = c2dc2->GetBinContent(i,j);
+      double v_c2dc2sw = c2dc2->GetBinEntries(k);
+      if(TMath::AreEqualAbs(v_c2dc2sw/v_c2sw/v_dc2sw,1,1e-100)) continue;
+      double covc2dc2 = v_c2dc2sw/v_c2sw/v_dc2sw*(v_c2dc2 - v_c2*v_dc2)/(1-v_c2dc2sw/v_c2sw/v_dc2sw);
+      double edv22 = 0.25/v_c2/v_c2/v_c2*(v_dc2*v_dc2*e_c2*e_c2 + 4*v_c2*v_c2*e_dc2*e_dc2 - 4*v_c2*v_dc2*covc2dc2);
+      //printf("%d >> dv22 %.16f || edv22^2 %.16f |||| v_c2dc2 %.16f | v_c2dc2sw %.16f | covc2dc2 %.16f \n", i,dv22,edv22,v_c2dc2,v_c2dc2sw,covc2dc2);
+      if(edv22<1e-100) continue;
+      edv22 = TMath::Sqrt(edv22);
+      resvn2->SetBinContent(i,j,dv22);
+      resvn2->SetBinError(i,j,edv22);
+      // dn{4}
+      double v_dc4sw = dc4->GetBinEntries(k);
+      if(v_dc4sw<1) continue;
+      double v_dc4 = dc4->GetBinContent(i,j);
+      double v_dc4sww = dc4sww->At(k);
+      double e_dc4 = TMath::Sqrt(v_dc4sww)/v_dc4sw*dc4->GetBinError(i,j);
+      double dcum4 = v_dc4 - 2*v_c2*v_dc2;
+      double v_c2dc4 = c2dc4->GetBinContent(i,j);
+      double v_c2dc4sw = c2dc4->GetBinEntries(k);
+      if(TMath::AreEqualAbs(v_c2dc4sw/v_c2sw/v_dc4sw,1,1e-100)) continue;
+      double covc2dc4 = v_c2dc4sw/v_c2sw/v_dc4sw*(v_c2dc4 - v_c2*v_dc4)/(1-v_c2dc4sw/v_c2sw/v_dc4sw);
+      double v_dc2dc4 = dc2dc4->GetBinContent(i,j);
+      double v_dc2dc4sw = dc2dc4->GetBinEntries(k);
+      if(TMath::AreEqualAbs(v_dc2dc4sw/v_dc2sw/v_dc4sw,1,1e-100)) continue;
+      double covdc2dc4 = v_dc2dc4sw/v_dc2sw/v_dc4sw*(v_dc2dc4 - v_dc2*v_dc4)/(1-v_dc2dc4sw/v_dc2sw/v_dc4sw);
+      double edcum4= ( +4.0*v_dc2*v_dc2*e_c2*e_c2
+                      +4.0*v_c2*v_c2*e_dc2*e_dc2
+                      +e_dc4*e_dc4
+                      +8.0*v_c2*v_dc2*covc2dc2
+                      -4.0*v_dc2*covc2dc4
+                      -4.0*v_c2*covdc2dc4 );
+      if(edcum4<1e-100) continue;
+      edcum4 = TMath::Sqrt(edcum4);
+      resDC4->SetBinContent(i,j, dcum4 );
+      resDC4->SetBinError(i,j, edcum4 );
+      // v2{4}
+      if(cum4>1e-100) continue;
+      double dv24 = -dcum4/TMath::Power(-cum4,0.75);
+      double dterm1 = 2*v_c2*v_c2*v_dc2 - 3*v_c2*v_dc4 + 2*v_c4*v_dc2;
+      double dterm2 = 9.0/16.0*dcum4*dcum4;
+      double dterm3 = 4.0*v_c2*v_c2*cum4*cum4;
+      double dterm4 = cum4*cum4;
+      double dterm5 = -3.0/2.0*dcum4*dterm1;
+      double dterm6 = -4.0*v_c2*cum4*dterm1;
+      double dterm7 = -2.0*cum4*dterm1;
+      double dterm8 = 3.0*v_c2*cum4*dcum4;
+      double dterm9 = 3.0/2.0*cum4*dcum4;
+      double dterm10= 4*v_c2*cum4*cum4;
+      double v_c4dc2 = c4dc2->GetBinContent(i,j);
+      double v_c4dc2sw = c4dc2->GetBinEntries(k);
+      if(TMath::AreEqualAbs(v_c4dc2sw/v_c4sw/v_dc2sw,1,1e-100)) continue;
+      double covc4dc2 = v_c4dc2sw/v_c4sw/v_dc2sw*(v_c4dc2 - v_c4*v_dc2)/(1-v_c4dc2sw/v_c4sw/v_dc2sw);
+      double v_c4dc4 = c4dc4->GetBinContent(i,j);
+      double v_c4dc4sw = c4dc4->GetBinEntries(k);
+      if(TMath::AreEqualAbs(v_c4dc4sw/v_c4sw/v_dc4sw,1,1e-100)) continue;
+      double covc4dc4 = v_c4dc4sw/v_c4sw/v_dc4sw*(v_c4dc4 - v_c4*v_dc4)/(1-v_c4dc4sw/v_c4sw/v_dc4sw);
+      double edv24= 1.0/TMath::Power(-cum4,3.5)*(+dterm1*dterm1*e_c2*e_c2
+                                                +dterm2*e_c4*e_c4
+                                                +dterm3*e_dc2*e_dc2
+                                                +dterm4*e_dc4*e_dc4
+                                                -dterm5*covc2c4
+                                                -dterm6*covc2dc2
+                                                +dterm7*covc2dc4
+                                                +dterm8*covc4dc2
+                                                -dterm9*covc4dc4
+                                                -dterm10*covdc2dc4);
+      if(edv24<1e-100) continue;
+      edv24 = TMath::Sqrt(edv24);
+      resvn4->SetBinContent(i,j,dv24);
+      resvn4->SetBinError(i,j,edv24);
+    }
+  }
+}
+
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::OpenToyModel() {
+  fList = new TList();
+  fList->SetOwner();
+
+  TList *tList;
+  tList=new TList(); tList->SetName("ToyVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
+  AddMakeQSpy();
+
+  fRFPAminEta=-0.9;
+  fRFPAmaxEta=0.0;
+  fRFPCminEta=0.0;
+  fRFPCmaxEta=+0.9;
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::CloseToyModel() {
+  ComputeChi2VZERO();
+  ComputeDecayVn("ToyVn");
+}
+//=======================================================================
+void AliAnalysisTaskFlowStrangee::MakeToyEvent(  Int_t seed, Int_t m_decay,Double_t v_decay,
+                                               Double_t mass_decay_mu,Double_t mass_decay_sg,
+                                               Int_t m_bgr,Double_t v_bgr,
+                                               Int_t mtpc_a,Double_t v_tpca,Int_t mtpc_c,Double_t v_tpcc,
+                                               Int_t mvze_a,Double_t v_vzea,Int_t mvze_c,Double_t v_vzec ) {
+  gRandom->SetSeed( seed );
+  // QVectors
+  fMCEP = gRandom->Rndm()*TMath::Pi();
+  TF1 tf1_tpca( "dphitpca", Form("1+2*%f*TMath::Cos(2*x)",v_tpca),0,TMath::TwoPi() );
+  TF1 tf1_tpcc( "dphitpcc", Form("1+2*%f*TMath::Cos(2*x)",v_tpcc),0,TMath::TwoPi() );
+  TF1 tf1_vzea( "dphivzea", Form("1+2*%f*TMath::Cos(2*x)",v_vzea),0,TMath::TwoPi() );
+  TF1 tf1_vzec( "dphivzec", Form("1+2*%f*TMath::Cos(2*x)",v_vzec),0,TMath::TwoPi() );
+  TF1 tf1_decay( "dphidecay", Form("1+2*%f*TMath::Cos(2*x)",v_decay),0,TMath::TwoPi() );
+  TF1 tf1_bgr( "dphibgr", Form("1+2*%f*TMath::Cos(2*x)",v_bgr),0,TMath::TwoPi() );
+  Double_t phi, eta;
+  fQTPCACos=fQTPCASin=fQTPCA=0;
+  fQTPCCCos=fQTPCCSin=fQTPCC=0;
+  fQTPC2hCos=fQTPC2hSin=0;
+  fQVZEACos=fQVZEASin=fQVZEA=0;
+  fQVZECCos=fQVZECSin=fQVZEC=0;
+  for(int m=0; m!=mtpc_a; ++m) {
+    phi = tf1_tpca.GetRandom() + fMCEP;
+    if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
+    eta = gRandom->Rndm()*(fRFPAmaxEta-fRFPAminEta)+fRFPAminEta;
+    fQTPCACos += TMath::Cos(fHarmonic*phi);
+    fQTPCASin += TMath::Sin(fHarmonic*phi);
+    fQTPCA += 1;
+    fQTPC2hCos += TMath::Cos(2*fHarmonic*phi);
+    fQTPC2hSin += TMath::Sin(2*fHarmonic*phi);
+    fQTPCA_fID[m] = -99;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta );
+  }
+  for(int m=0; m!=mtpc_c; ++m) {
+    phi = tf1_tpcc.GetRandom() + fMCEP;
+    if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
+    eta = gRandom->Rndm()*(fRFPCmaxEta-fRFPCminEta)+fRFPCminEta;
+    fQTPCCCos += TMath::Cos(fHarmonic*phi);
+    fQTPCCSin += TMath::Sin(fHarmonic*phi);
+    fQTPCC += 1;
+    fQTPC2hCos += TMath::Cos(2*fHarmonic*phi);
+    fQTPC2hSin += TMath::Sin(2*fHarmonic*phi); 
+    fQTPCC_fID[m] = -99;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta );
+  }
+  for(int m=0; m!=mvze_a; ++m) {
+    phi = tf1_vzea.GetRandom() + fMCEP;
+    if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
+    eta = gRandom->Rndm()*2-3.5;
+    fQVZEACos += TMath::Cos(fHarmonic*phi);
+    fQVZEASin += TMath::Sin(fHarmonic*phi);
+    fQVZEA += 1;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta );
+  }
+  for(int m=0; m!=mvze_c; ++m) {
+    phi = tf1_vzec.GetRandom() + fMCEP;
+    if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
+    eta = gRandom->Rndm()*2+2.5;
+    fQVZECCos += TMath::Cos(fHarmonic*phi);
+    fQVZECSin += TMath::Sin(fHarmonic*phi);
+    fQVZEC += 1;
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta );
+  }
+  fQTPCA_nTracks = mtpc_a;
+  fQTPCC_nTracks = mtpc_c;
+  FillMakeQSpy();
+
+  //decays
+  double ptrange = fPtBinEdge[fPtBins] - fPtBinEdge[0];
+  double pt, mass;
+  for(int m=0; m!=m_decay; ++m) {
+    phi = tf1_decay.GetRandom() + fMCEP;
+    if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
+    eta = gRandom->Rndm()*1.6-0.8;
+    pt = gRandom->Rndm()*ptrange + fPtBinEdge[0];
+    mass = gRandom->Gaus(mass_decay_mu,mass_decay_sg);
+    FillDecayVn("ToyVn",mass,pt,phi,eta,+999,+999);
+  }
+  for(int m=0; m!=m_bgr; ++m) {
+    phi = tf1_bgr.GetRandom() + fMCEP;
+    if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
+    eta = gRandom->Rndm()*1.6-0.8;
+    pt = gRandom->Rndm()*ptrange + fPtBinEdge[0];
+    mass = gRandom->Rndm()*(fMaxMass-fMinMass)+fMinMass;
+    FillDecayVn("ToyVn",mass,pt,phi,eta,+999,+999);
+  }
+  QCStoreDecayVn("ToyVn");
+
+}
diff --git a/PWG/FLOW/Tasks/AliAnalysisTaskFlowStrangee.h b/PWG/FLOW/Tasks/AliAnalysisTaskFlowStrangee.h
new file mode 100644 (file)
index 0000000..49f512a
--- /dev/null
@@ -0,0 +1,438 @@
+/////////////////////////////////////////////////////
+// AliAnalysisTaskFlowStrange:
+// Analysis task to select K0/Lambda candidates for flow analysis.
+// Authors: Cristian Ivan (civan@cern.ch)
+//          Carlos Perez (cperez@cern.ch)
+//          Pawel Debski (pdebski@cern.ch)
+//////////////////////////////////////////////////////
+
+/* Copyright(c) 1998-1999, ALICExperiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+/* $Id: $ */
+
+#ifndef AliAnalysisTaskFlowStrangee_H
+#define AliAnalysisTaskFlowStrangee_H
+
+#include "AliAnalysisTaskSE.h"
+
+class TList;
+class TH2D;
+class TObjArray;
+class TClonesArray;
+class AliAODMCParticle;
+class AliESDtrackCuts;
+class AliFlowEventCuts;
+//class AliFlowTrackCuts;
+class AliPIDResponse;
+class AliESDEvent;
+class AliAODEvent;
+class AliAODv0;
+class AliESDv0;
+class AliVVertex;
+class AliFlowBayesianPID;
+class AliAODVertex;
+
+class AliAnalysisTaskFlowStrangee : public AliAnalysisTaskSE {
+ public:
+  enum Especie {kKZE=0,kLDA=1,kLDABAR=2,kLDAALL=3,kCHARGED=90,kPION=91,kKAON=92,kPROTON=93};
+  enum Econfig {kSpecie=1,kHarmonic,kReadMC,kSkipSelection};
+  AliAnalysisTaskFlowStrangee();
+  AliAnalysisTaskFlowStrangee(const Char_t *name);
+  virtual ~AliAnalysisTaskFlowStrangee();
+  virtual void UserCreateOutputObjects();
+  virtual void Exec(Option_t*);
+  virtual void UserExec(Option_t *);
+  virtual void Terminate(Option_t *);
+  virtual void MyUserExec(Option_t *);
+  virtual void MyUserCreateOutputObjects();
+  virtual void MyPrintConfig();
+  virtual void PrintConfig();
+
+  void SetHarmonic(Int_t val) {fHarmonic= val;}
+
+  void SetOutputList(TList *lst) {fList=lst;}
+  TList* GetOutputList() {return fList;}
+  TList* RunTerminateAgain(TList *lst);
+
+  void SetDebug(Int_t val=1) {fDebug = val;}
+  void SetQAlevel(Int_t qa) {fQAlevel = qa;}
+
+  void SetpA() {fRunOnpA = kTRUE;  fRunOnpp = kFALSE;}
+  void Setpp() {fRunOnpA = kFALSE; fRunOnpp = kTRUE; }
+  void SetReadESD(Bool_t val) {fReadESD=val;}
+  void SetReadMC(Bool_t val) {fReadMC=val;}
+
+  void SetAvoidExec(Bool_t val) {fAvoidExec=val;}
+  void SetVertexZcut(Double_t val) {fVertexZcut=val;}
+  void SetSkipCentralitySelection(Bool_t val) {fSkipCentralitySelection=val;}
+  void SetCentralityRange(TString val, Int_t m, Int_t M) {fCentMethod=val; fCentPerMin=m; fCentPerMax=M;}
+  void SetExtraEventRejection(Bool_t val) {fExtraEventRejection=val;}
+  void SetSkipTerminate(Bool_t val) {fSkipTerminate=val;}
+
+  void SetAddPiToMCReactionPlane(Bool_t val) {fAddPiToMCReactionPlane=val;}
+  void SetUseFlowPackage(Bool_t val) {fUseFP=val;}
+  void SetWhichPsi(Int_t val) {fWhichPsi=val;}
+  void SetStoreVZEResponse(Bool_t val) {fVZEsave=val;}
+  void LoadVZEResponse(TList *val, Bool_t val2=kFALSE, Bool_t val3=kTRUE) {fVZEload=val;fVZEmb=val2;fVZEByDisk=val3;}
+  void SetRFPFilterBit(Int_t val) {fRFPFilterBit=val;}
+  void SetRFPMinPt(Double_t val) {fRFPminPt=val;}
+  void SetRFPMaxPt(Double_t val) {fRFPmaxPt=val;}
+  void SetRFPAMinEta(Double_t val) {fRFPAminEta=val;}
+  void SetRFPAMaxEta(Double_t val) {fRFPAmaxEta=val;}
+  void SetRFPCMinEta(Double_t val) {fRFPCminEta=val;}
+  void SetRFPCMaxEta(Double_t val) {fRFPCmaxEta=val;}
+  void SetRFPTPCSignal(Double_t val) {fRFPTPCsignal=val;}
+  void SetRFPMaxIPxy(Double_t val) {fRFPmaxIPxy=val;}
+  void SetRFPMaxIPz(Double_t val) {fRFPmaxIPz=val;}
+  void SetRFPMinTPCCls(Int_t val) {fRFPTPCncls=val;}
+  void SetRFPVZERingRange(Int_t val1, Int_t val2, Int_t val3, Int_t val4)
+    {fVZECa=val1;fVZECb=val2;fVZEAa=val3;fVZEAb=val4;}
+  //void SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
+
+  void SetSkipSelection(Bool_t val) {fSkipSelection=val;}
+  void SetSkipVn(Bool_t val) {fSkipVn=val;}
+  void SetPostMatched(Int_t val) {fPostMatched=val;}
+  void SetK0L0(Int_t specie) {fSpecie=specie;}
+  void SetMass(Int_t n, Double_t m, Double_t M) {fMassBins=n;fMinMass=m;fMaxMass=M;}
+  void SetPtEdges(Int_t n, Double_t *p);
+  void SetOnline(Bool_t val) {fOnline=val;}
+  void SetHomemade(Bool_t val) {fHomemade=val;}
+  void SetExcludeTPCEdges(Bool_t value) {fExcludeTPCEdges=value;}
+  void SetMaxRapidity(Double_t val) {fDecayMaxRapidity=val;}
+  void SetMinEta(Double_t val) {fDecayMinEta=val;}
+  void SetMaxEta(Double_t val) {fDecayMaxEta=val;}
+  void SetMinPt(Double_t val) {fDecayMinPt=val;}
+  void SetMaxDCAdaughters(Double_t val) {fDecayMaxDCAdaughters=val;}
+  void SetMinCosinePointingAngleXY(Double_t val) {fDecayMinCosinePointingAngleXY=val;}
+  void SetMinQt(Double_t val, Bool_t val2=kTRUE) {fDecayMinQt=val; fDecayAPCutPie=val2;}
+  void SetStopPIDAtPt(Double_t val) {fDecayStopPIDAtPt=val;}
+  void SetMinRadXY(Double_t val) {fDecayMinRadXY=val;}
+  void SetMaxDecayLength(Double_t val) {fDecayMaxDecayLength=val;}
+  void SetMaxProductIPXY(Double_t val) {fDecayMaxProductIPXY=val;}
+
+  void SetDauMinNClsTPC(Int_t val) {fDaughterMinNClsTPC=val;}
+  void SetDauMinNClsITS(Int_t val) {fDaughterMinNClsITS=val;}
+  void SetDauMinXRows(Int_t val) {fDaughterMinXRows=val;}
+  void SetDauMaxChi2PerNClsTPC(Double_t val) {fDaughterMaxChi2PerNClsTPC=val;}
+  void SetDauMinXRowsOverNClsFTPC(Double_t val) {fDaughterMinXRowsOverNClsFTPC=val;}
+  void SetDauITSLayer(Int_t layer, Int_t config) {fDaughterITSConfig[layer]=config;}
+  void SetDauMinEta(Double_t val) {fDaughterMinEta=val;}
+  void SetDauMaxEta(Double_t val) {fDaughterMaxEta=val;}
+  void SetDauMinPt(Double_t val) {fDaughterMinPt=val;}
+  void SetDauMinImpactParameterXY(Double_t val) {fDaughterMinImpactParameterXY=val;}
+  void SetDauMaxNSigmaPID(Double_t val) {fDaughterMaxNSigmaPID=val;}
+  void SetDauUnTagProcedure(Bool_t val) {fDaughterUnTag=val;}
+  void SetDauSPDRequireAny(Bool_t val) {fDaughterSPDRequireAny=val;}
+  void SetDauITSrefit(Bool_t val) {fDaughterITSrefit=val;}
+
+  //newITScuts
+  void SetMaxSharedITSCluster(Int_t maxITSclusterShared){fmaxSharedITSCluster = maxITSclusterShared;}
+  void SetMaxChi2perITSCluster(Double_t maxITSChi2){fMaxchi2perITSCluster = maxITSChi2;}
+  void OpenToyModel();
+  void MakeToyEvent(Int_t seed=0, Int_t m_decay = 30, Double_t v_decay = 0.05,
+                   Double_t mass_decay_mu = 0.497648, Double_t mass_decay_sg = 0.01,
+                   Int_t m_bgr = 30, Double_t v_bgr = 0.08,
+                   Int_t mtpc_a = 300, Double_t v_tpca = 0.10, Int_t mtpc_c = 300, Double_t v_tpcc = 0.10,
+                   Int_t mvze_a = 300, Double_t v_vzea = 0.10, Int_t mvze_c = 300, Double_t v_vzec = 0.10 );
+  void CloseToyModel();
+  TList* RebinDecayVn(Int_t nbins, Int_t *bins);
+
+ private:
+  AliAnalysisTaskFlowStrangee(const AliAnalysisTaskFlowStrangee& analysisTask);
+  AliAnalysisTaskFlowStrangee& operator=(const AliAnalysisTaskFlowStrangee& analysisTask);
+  void AddQAEvents();
+  void AddQACandidates();
+
+  void MyNotifyRun();
+  Bool_t CalibrateEvent();
+  void Publish();
+  
+  void AddEventSpy(TString name);
+  void FillEventSpy(TString name);
+
+  Bool_t MinimumRequirementsAA(AliAODEvent *tAOD);
+  Bool_t AcceptAAEvent(AliESDEvent *tESD);
+  Bool_t AcceptAAEvent(AliAODEvent *tAOD);
+  Bool_t AcceptPPEvent(AliAODEvent *tAOD);
+  Bool_t AcceptPAEvent(AliAODEvent *tAOD);
+  Int_t GetReferenceMultiplicity();
+
+  void ReadStack(TClonesArray* mcArray);
+  void ReadFromESD(AliESDEvent *tESD);
+  void ReadFromAODv0(AliAODEvent *tAOD);
+
+  void ChargeParticles(AliAODEvent *tAOD);
+
+  void ComputePsi2(AliVEvent *event);
+  void AddMakeQSpy();
+  void FillMakeQSpy();
+  void ComputeChi2VZERO();
+  void MakeQVZE(AliVEvent *event);
+  void MakeQTPC(AliVEvent *event);
+  void MakeQTPC(AliESDEvent *event);
+  void MakeQTPC(AliAODEvent *event);
+  void AddTPCRFPSpy(TList *val);
+  Bool_t PassesRFPTPCCuts(AliESDtrack *myTrack, Double_t aodChi2NDF=0, Float_t aodipxy=0, Float_t aodipz=0);
+  void MakeQVectors();
+  void ResetContainers();
+
+  void AddCandidates();
+  TList* RebinDecayVn(TList *tList,Int_t nbins, Int_t *bins);
+
+  Double_t GetMCDPHI(Double_t phi);
+
+  Double_t CosThetaPointXY(AliESDv0 *me, const AliVVertex *vtx);
+  Double_t CosThetaPointXY(AliAODv0 *me, const AliVVertex *vtx);
+  Double_t DecayLengthXY(AliESDv0 *me, const AliVVertex *vtx);
+  Double_t DecayLengthXY(AliAODv0 *me, const AliVVertex *vtx);
+  Double_t DecayLength(AliESDv0 *me, const AliVVertex *vtx);
+  Double_t DecayLength(AliAODv0 *me, const AliVVertex *vtx);
+
+  void AddMCParticleSpy(TList *val);
+  void FillMCParticleSpy(TString listName, AliAODMCParticle *par);
+  void FillMCParticleSpy(TString listName, TParticle *par);
+
+  void AddCandidatesSpy(TList *val, Bool_t fillRes=kFALSE);
+  void FillCandidateSpy(TString listName, Bool_t fillRes=kFALSE);
+
+  void AddTrackSpy(TList *val, Bool_t fillRes=kFALSE);
+  void FillTrackSpy(TString listName, Bool_t fillRes=kFALSE);
+
+  void AddDecayVn(TList *val);
+  void FillDecayVn(TString listName,Double_t ms,Double_t pt,Double_t phi,Double_t eta,Int_t fid1,Int_t fid2);
+  void QCStoreDecayVn(TString name);
+  void ComputeDecayVn(TString listName);
+
+  void AddTrackVn(TList *val);
+  void FillTrackVn(TString listName,Double_t pt,Double_t phi,Double_t eta,Int_t fid);
+  void QCStoreTrackVn(TString name);
+  void ComputeTrackVn(TString listName);
+  Bool_t InQTPC(Int_t id);
+
+  void MakeFilterBits();
+  Bool_t PassesFilterBit(AliESDtrack *me);
+
+  void LoadTrack(AliESDtrack *myTrack, Double_t aodChi2NDF=0);
+  Bool_t AcceptDaughter(Bool_t strongITS=kTRUE,  Bool_t newITScuts=kFALSE);
+  Bool_t AcceptCandidate();
+  Bool_t PassesPIDCuts(AliESDtrack *myTrack, AliPID::EParticleType pid=AliPID::kProton);
+
+  Bool_t IsAtTPCEdge(Double_t phi,Double_t pt,Int_t charge,Double_t b);
+
+  void MakeTrack();
+  void PushBackFlowTrack(AliFlowEvent *event, Double_t pt, Double_t phi, Double_t eta, Double_t we, Int_t id);
+
+  Double_t GetWDist(const AliVVertex* v0, const AliVVertex* v1);
+  Bool_t plpMV(const AliVEvent *event);
+
+  void LoadVZEROResponse();
+  void AddVZEROResponse();
+  void SaveVZEROResponse();
+  void AddVZEQA();
+  void FillVZEQA();
+  void FillVZEQA(AliAODEvent *tAOD);
+
+  Int_t RefMult(AliAODEvent *tAOD, Int_t fb);
+  Int_t RefMultTPC();
+  Int_t RefMultGlobal();
+
+  AliPIDResponse *fPIDResponse; //! PID response object
+  AliESDtrackCuts *fFB1;        // filterbit cut equivalent
+  AliESDtrackCuts *fFB1024;     // filterbit cut equivalent
+  AliFlowEvent   *fTPCevent;    // flow event (needed here due to ev selection)
+  AliFlowEvent   *fVZEevent;    // flow event (needed here due to ev selection)
+  //  AliFlowTrackCuts* fCutsRP;
+
+  TObjArray      *fCandidates;  // array of selected candidates
+  TList          *fList;        // stores the final list of output histograms
+
+  Int_t fRunNumber; // current run number
+
+  Int_t fDebug;   // debug level
+  Int_t fQAlevel; // QA plots
+
+  Bool_t fReadESD;       // move back to ESD
+  Bool_t fReadMC;        // read MC files
+  Bool_t fAddPiToMCReactionPlane; // add pi randomly (MCTUNED)
+  Int_t fPostMatched;    // post only (un)matched particles
+  Bool_t fAvoidExec;     // avoids Exec
+  Bool_t fSkipSelection; // skip decay finder
+  Bool_t fSkipVn;        // skip flow computation
+  Bool_t fUseFP;         // flow package?
+  Bool_t fRunOnpA;       // make task compatible with pA event selection
+  Bool_t fRunOnpp;       // make task compatible with pp event selection
+  Bool_t fExtraEventRejection; // to reject pile up
+  Bool_t fSkipCentralitySelection; // to skip centrality
+  TString  fCentMethod; // CC
+  Int_t    fCentPerMin; // CC
+  Int_t    fCentPerMax; // CC
+  Double_t fThisCent;   // CC
+  Double_t fV0M; // V0M CC
+  Double_t fTRK; // TRK CC
+  Double_t fPriVtxZ; // vtxZ
+  Double_t fSPDVtxZ; // vtxZ
+  Int_t fSPDtracklets; // spd tracklets
+  Float_t fVZETotM; // vzero total multiplicity
+  Int_t fRefMultTPC; // tpc only multiplicity
+  Int_t fRefMultHyb; // hybrid multiplicity
+
+  Double_t fVertexZcut; // cut on main vertex Z
+
+  Bool_t fExcludeTPCEdges; // exclude TPC edges from single track selection
+
+  Int_t  fSpecie;   // K0=>0 L0=>1
+  Bool_t fOnline;   // change into online v0 finder
+  Bool_t fHomemade; // homemade v0 finder
+
+  Int_t fWhichPsi;  // detector for Psi2
+
+  Bool_t  fVZEsave; // make vze response
+  TList  *fVZEload; // adress to calibration file
+  TH2D   *fVZEResponse; // vze response vs centrality class
+  Double_t fVZEextW[64]; // vze weights
+  Bool_t  fVZEmb;   // integrate response (linearity)
+  Bool_t  fVZEByDisk; // normalized by disk
+  Int_t   fVZECa;   // start of V0C (ring number 0-3)
+  Int_t   fVZECb;   // end of V0C (ring number 0-3)
+  Int_t   fVZEAa;   // start of V0A (ring number 0-3)
+  Int_t   fVZEAb;   // end of V0A (ring number 0-3)
+  TList  *fVZEQA;   // address to qalist
+
+  Int_t fHarmonic;  // flow angle order
+  Double_t fPsi2;   // best estimation of Psi2
+  Double_t fMCEP;   // stores MC EP (when available)
+  // VZE QVector
+  Double_t fQVZEACos;
+  Double_t fQVZEASin;
+  Double_t fQVZECCos;
+  Double_t fQVZECSin;
+  Double_t fQVZEA;
+  Double_t fQVZEC;
+  Bool_t fVZEWarning;
+  // TPC QVector
+  Double_t fQTPCACos;
+  Double_t fQTPCASin;
+  Double_t fQTPCCCos;
+  Double_t fQTPCCSin;
+  Double_t fQTPC2hCos;
+  Double_t fQTPC2hSin;
+  Double_t fQTPCA;
+  Double_t fQTPCC;
+  Int_t fQTPCA_nTracks;
+  Int_t fQTPCC_nTracks;
+  Int_t fQTPCA_fID[2000];
+  Int_t fQTPCC_fID[2000];
+  Bool_t fSkipTerminate;
+
+  Int_t    fMassBins; // opens
+  Double_t fMinMass;  // mass
+  Double_t fMaxMass;  // window
+  Int_t fPtBins;        // to shrink
+  Double_t fPtBinEdge[100]; // output
+
+  Int_t fRFPFilterBit;    // RFP TPC
+  Double_t fRFPminPt;     // RFP TPC
+  Double_t fRFPmaxPt;     // RFP TPC
+  Double_t fRFPAminEta;   // RFP TPC
+  Double_t fRFPAmaxEta;   // RFP TPC
+  Double_t fRFPCminEta;   // RFP TPC
+  Double_t fRFPCmaxEta;   // RFP TPC
+  Double_t fRFPTPCsignal; // RFP TPC
+  Double_t fRFPmaxIPxy;   // RFP TPC
+  Double_t fRFPmaxIPz;    // RFP TPC
+  Int_t fRFPTPCncls;      // RFP TPC
+
+  Double_t fDecayMass;                  // DECAY
+  Double_t fDecayPhi;                   // DECAY
+  Double_t fDecayEta;                   // DECAY
+  Double_t fDecayPt;                    // DECAY
+  Double_t fDecayDCAdaughters;          // DECAY
+  Double_t fDecayCosinePointingAngleXY; // DECAY
+  Double_t fDecayRadXY;                 // DECAY
+  Double_t fDecayDecayLength;           // DECAY
+  Double_t fDecayDecayLengthLab;        // DECAY
+  Double_t fDecayQt;                    // DECAY
+  Double_t fDecayAlpha;                 // DECAY
+  Double_t fDecayRapidity;              // DECAY
+  Double_t fDecayProductIPXY;           // DECAY
+  Double_t fDecayIPneg;                 // DECAY
+  Double_t fDecayIPpos;                 // DECAY
+  Double_t fDecayXneg;                  // DECAY
+  Double_t fDecayXpos;                  // DECAY
+  Int_t    fDecayIDneg;                 // DECAY
+  Int_t    fDecayIDpos;                 // DECAY
+  Int_t    fDecayID;                    // DECAY
+
+  Double_t fDecayMatchOrigin;  // MC DECAY
+  Double_t fDecayMatchPhi;     // MC DECAY
+  Double_t fDecayMatchEta;     // MC DECAY
+  Double_t fDecayMatchPt;      // MC DECAY
+  Double_t fDecayMatchRadXY;   // MC DECAY
+
+  Double_t fDecayMinEta;                   // DECAY CUTS
+  Double_t fDecayMaxEta;                   // DECAY CUTS
+  Double_t fDecayMinPt;                    // DECAY CUTS
+  Double_t fDecayMaxDCAdaughters;          // DECAY CUTS
+  Double_t fDecayMinCosinePointingAngleXY; // DECAY CUTS
+  Double_t fDecayMinQt;                    // DECAY CUTS
+  Bool_t   fDecayAPCutPie;                 // DECAY CUTS
+  Double_t fDecayStopPIDAtPt;              // DECAY CUTS
+  Double_t fDecayMinRadXY;                 // DECAY CUTS
+  Double_t fDecayMaxDecayLength;           // DECAY CUTS
+  Double_t fDecayMaxProductIPXY;           // DECAY CUTS
+  Double_t fDecayMaxRapidity;              // DECAY CUTS
+
+  Double_t fDaughterPhi;               // DAUGHTER
+  Double_t fDaughterEta;               // DAUGHTER
+  Double_t fDaughterPt;                // DAUGHTER
+  Int_t    fDaughterNClsTPC;           // DAUGHTER
+  Int_t    fDaughterNClsITS;           // DAUGHTER
+  Int_t    fDaughterITSConfig[6];      // DAUGHTER
+  Int_t    fDaughterCharge;            // DAUGHTER
+  Int_t    fDaughterNFClsTPC;          // DAUGHTER
+  Int_t    fDaughterNSClsTPC;          // DAUGHTER
+  Double_t fDaughterChi2PerNClsTPC;    // DAUGHTER
+  Double_t fDaughterXRows;             // DAUGHTER
+  Float_t  fDaughterImpactParameterXY; // DAUGHTER
+  Float_t  fDaughterImpactParameterZ;  // DAUGHTER
+  UInt_t   fDaughterStatus;            // DAUGHTER
+  UChar_t  fDaughterITScm;             // DAUGHTER
+  Double_t fDaughterNSigmaPID;         // DAUGHTER
+  Int_t    fDaughterKinkIndex;         // DAUGHTER
+  Double_t fDaughterAtSecPhi;          // DAUGHTER
+  Double_t fDaughterAtSecEta;          // DAUGHTER
+  Double_t fDaughterAtSecPt;           // DAUGHTER
+
+ //newITScuts
+  Int_t    fsharedITSCluster;          // DAUGHTER 
+  Double_t fchi2perClusterITS;         // DAUGHTER 
+  Int_t    fcounterForSharedCluster;   // DAUGHTER
+
+  Double_t fDaughterMatchPhi;               // MC DAUGHTER
+  Double_t fDaughterMatchEta;               // MC DAUGHTER
+  Double_t fDaughterMatchPt;                // MC DAUGHTER
+  Float_t  fDaughterMatchImpactParameterXY; // MC DAUGHTER
+  Float_t  fDaughterMatchImpactParameterZ;  // MC DAUGHTER
+
+  Bool_t   fDaughterUnTag;             // UNTAG PROCEDURE
+
+  Double_t fDaughterMinEta;               // DAUGHTER CUTS
+  Double_t fDaughterMaxEta;               // DAUGHTER CUTS
+  Double_t fDaughterMinPt;                // DAUGHTER CUTS
+  Int_t    fDaughterMinNClsTPC;           // DAUGHTER CUTS
+  Int_t    fDaughterMinNClsITS;           // DAUGHTER CUTS
+  Int_t    fDaughterMinXRows;             // DAUGHTER CUTS
+  Double_t fDaughterMaxChi2PerNClsTPC;    // DAUGHTER CUTS
+  Double_t fDaughterMinXRowsOverNClsFTPC; // DAUGHTER CUTS
+  Double_t fDaughterMinImpactParameterXY; // DAUGHTER CUTS
+  Double_t fDaughterMaxNSigmaPID;         // DAUGHTER CUTS
+  Bool_t   fDaughterSPDRequireAny;        // DAUGHTER CUTS
+  Bool_t   fDaughterITSrefit;             // DAUGHTER CUTS
+  //newITScuts
+  Double_t fMaxchi2perITSCluster;        // DAUGHTER CUTS
+  Int_t fmaxSharedITSCluster;            // DAUGHTER CUTS
+
+  ClassDef(AliAnalysisTaskFlowStrangee, 6);
+};
+#endif
index f9aca94beba4e5b729318c0cdd10386174dfcb92..4b782c1bc2ecd84c26ec490b1cd94f2a4faa61e7 100644 (file)
@@ -218,6 +218,11 @@ fhistProtonEtaDistAfter(0)
 //fvalueSpecies(0)root
 {
     //Default Constructor
+    for(int i=0;i<150;i++){
+        fCutContour[i]= NULL;
+        fCutGraph[i]=NULL;
+    }
+
     //fCutContour[150]=NULL;
     //fCutGraph[150]=NULL;
     DefineInput(0,TChain::Class());
@@ -256,7 +261,10 @@ void AliAnalysisTaskPIDconfig::UserCreateOutputObjects()
     //input hander
     AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
     AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
-    if (!inputHandler) AliFatal("Input handler needed");
+    if (!inputHandler) {
+        AliFatal("Input handler needed");
+        return;         // to shut up coverity
+    }
     
     //pid response object
     fPIDResponse=inputHandler->GetPIDResponse();
@@ -292,13 +300,15 @@ void AliAnalysisTaskPIDconfig::UserExec(Option_t*){
     fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
     fESD = dynamic_cast<AliESDEvent*>(InputEvent());
     
-    Int_t ntracks=fAOD->GetNumberOfTracks();
     
     
     if(!(fESD || fAOD)){
         printf("ERROR: fESD & fAOD not available\n");
         return;
     }
+
+    Int_t ntracks=fAOD->GetNumberOfTracks();
+
     fVevent = dynamic_cast<AliVEvent*>(InputEvent());
     if (!fVevent) {
         printf("ERROR: fVevent not available\n");
index 853b6dadbbd1891af38b60f08e8b02723caa9981..3a263025e8fc037414beb03559454d76322db03a 100644 (file)
@@ -35,6 +35,7 @@
 // AliFlowTrack is made using MakeFlowTrack() method, its an 'object factory'
 // so caller needs to take care of the freshly created object.
 
+#include "TFile.h"
 #include <limits.h>
 #include <float.h>
 #include <TMatrix.h>
@@ -116,6 +117,8 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fCutMinimalTPCdedx(kFALSE),
   fMinimalTPCdedx(0.),
   fLinearizeVZEROresponse(kFALSE),
+  fCentralityPercentileMin(0.),
+  fCentralityPercentileMax(5.),
   fCutPmdDet(kFALSE),
   fPmdDet(0),
   fCutPmdAdc(kFALSE),
@@ -156,6 +159,7 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fAllowTOFmismatchFlag(kFALSE),
   fRequireStrictTOFTPCagreement(kFALSE),
   fCutRejectElectronsWithTPCpid(kFALSE),
+  fUseTPCTOFNsigmaCutContours(kFALSE),
   fProbBayes(0.0),
   fCurrCentr(0.0),
   fVZEROgainEqualization(NULL),
@@ -166,11 +170,14 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fChi3A(0x0),
   fChi3C(0x0),
   fPIDResponse(NULL),
-  fNsigmaCut2(9)
+  fNsigmaCut2(9),
+  fContoursFile(0),
+  fCutContourList(0),
+  fMaxITSclusterShared(0),
+  fMaxITSChi2(0)
 {
   //io constructor 
   SetPriors(); //init arrays
-  
   // New PID procedure (Bayesian Combined PID)
   // allocating here is necessary because we don't 
   // stream this member
@@ -181,7 +188,12 @@ AliFlowTrackCuts::AliFlowTrackCuts():
       fVZEROApol[i] = 0;
       fVZEROCpol[i] = 0;
   }
-  for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = kTRUE;
+  for(Int_t i(0); i < 8; i++){ fUseVZERORing[i] = kTRUE;}
+    
+  for(int i=0;i<50;i++){
+    fCutContour[i]= NULL;
+    fCutGraph[i]=NULL;
+  }
 
 }
 
@@ -227,6 +239,8 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fCutMinimalTPCdedx(kFALSE),
   fMinimalTPCdedx(0.),
   fLinearizeVZEROresponse(kFALSE),
+  fCentralityPercentileMin(0.),
+  fCentralityPercentileMax(5.),
   fCutPmdDet(kFALSE),
   fPmdDet(0),
   fCutPmdAdc(kFALSE),
@@ -267,6 +281,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fAllowTOFmismatchFlag(kFALSE),
   fRequireStrictTOFTPCagreement(kFALSE),
   fCutRejectElectronsWithTPCpid(kFALSE),
+  fUseTPCTOFNsigmaCutContours(kFALSE),
   fProbBayes(0.0),
   fCurrCentr(0.0),
   fVZEROgainEqualization(NULL),
@@ -277,9 +292,13 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fChi3A(0x0),
   fChi3C(0x0),
   fPIDResponse(NULL),
-  fNsigmaCut2(9)
+  fNsigmaCut2(9),
+  fContoursFile(0),
+  fCutContourList(0),
+  fMaxITSclusterShared(0),
+  fMaxITSChi2(0)
 {
-  //constructor 
+  //constructor
   SetTitle("AliFlowTrackCuts");
   fESDpid.GetTPCResponse().SetBetheBlochParameters( 0.0283086,
                                                     2.63394e+01,
@@ -287,7 +306,6 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
                                                     2.12543e+00,
                                                     4.88663e+00 );
   SetPriors(); //init arrays
-
   // New PID procedure (Bayesian Combined PID)
   fBayesianResponse = new AliFlowBayesianPID();
   fBayesianResponse->SetNewTrackParam();
@@ -296,7 +314,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
       fVZEROCpol[i] = 0;
   }
   for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = kTRUE;
-}
+  }
 
 //-----------------------------------------------------------------------
 AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
@@ -340,6 +358,8 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   fCutMinimalTPCdedx(that.fCutMinimalTPCdedx),
   fMinimalTPCdedx(that.fMinimalTPCdedx),
   fLinearizeVZEROresponse(that.fLinearizeVZEROresponse),
+  fCentralityPercentileMin(that.fCentralityPercentileMin),
+  fCentralityPercentileMax(that.fCentralityPercentileMax),
   fCutPmdDet(that.fCutPmdDet),
   fPmdDet(that.fPmdDet),
   fCutPmdAdc(that.fCutPmdAdc),
@@ -380,6 +400,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   fAllowTOFmismatchFlag(that.fAllowTOFmismatchFlag),
   fRequireStrictTOFTPCagreement(that.fRequireStrictTOFTPCagreement),
   fCutRejectElectronsWithTPCpid(that.fCutRejectElectronsWithTPCpid),
+  fUseTPCTOFNsigmaCutContours(that.fUseTPCTOFNsigmaCutContours),
   fProbBayes(0.0),
   fCurrCentr(0.0),
   fVZEROgainEqualization(NULL),
@@ -390,7 +411,11 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   fChi3A(0x0),
   fChi3C(0x0),
   fPIDResponse(that.fPIDResponse),
-  fNsigmaCut2(that.fNsigmaCut2)
+  fNsigmaCut2(that.fNsigmaCut2),
+  fContoursFile(0),
+  fCutContourList(0),
+  fMaxITSclusterShared(0),
+  fMaxITSChi2(0)
 {
   //copy constructor
   if (that.fTPCpidCuts) fTPCpidCuts = new TMatrixF(*(that.fTPCpidCuts));
@@ -398,6 +423,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   if (that.fAliESDtrackCuts) fAliESDtrackCuts = new AliESDtrackCuts(*(that.fAliESDtrackCuts));
   if (that.fMuonTrackCuts)   fMuonTrackCuts   = new AliMuonTrackCuts(*(that.fMuonTrackCuts));  // XZhang 20120604
   SetPriors(); //init arrays
+  if(fUseTPCTOFNsigmaCutContours) GetTPCTOFPIDContours();
   if (that.fQA) DefineHistograms();
   // would be neater via copy ctor of TArrayD
   fChi2A = new TArrayD(that.fChi2A->GetSize(), that.fChi2A->GetArray());
@@ -407,7 +433,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   // New PID procedure (Bayesian Combined PID)
   fBayesianResponse = new AliFlowBayesianPID();
   fBayesianResponse->SetNewTrackParam();
-
+    
   // VZERO gain calibration
   // no reason to init fVZEROgainEqualizationPerRing, will be initialized on node if necessary
   // pointer is set to NULL in initialization list of this constructor
@@ -417,6 +443,12 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
       fVZEROCpol[i] = 0.;
   }
   for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = that.fUseVZERORing[i];
+  
+    for(int i=0;i<50;i++){
+        fCutContour[i]= that.fCutContour[i];
+        fCutGraph[i]=that.fCutGraph[i];
+    }
+
 
 }
 
@@ -475,6 +507,8 @@ AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
   fCutMinimalTPCdedx=that.fCutMinimalTPCdedx;
   fMinimalTPCdedx=that.fMinimalTPCdedx;
   fLinearizeVZEROresponse=that.fLinearizeVZEROresponse;
+  fCentralityPercentileMin=that.fCentralityPercentileMin;
+  fCentralityPercentileMax=that.fCentralityPercentileMax;
   fCutPmdDet=that.fCutPmdDet;
   fPmdDet=that.fPmdDet;
   fCutPmdAdc=that.fCutPmdAdc;
@@ -520,9 +554,10 @@ AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
   fAllowTOFmismatchFlag=that.fAllowTOFmismatchFlag;
   fRequireStrictTOFTPCagreement=that.fRequireStrictTOFTPCagreement;
   fCutRejectElectronsWithTPCpid=that.fCutRejectElectronsWithTPCpid;
+  fUseTPCTOFNsigmaCutContours=that.fUseTPCTOFNsigmaCutContours;
   fProbBayes = that.fProbBayes;
   fCurrCentr = that.fCurrCentr;
-  
+    
   fApplyRecentering = that.fApplyRecentering;
   fVZEROgainEqualizationPerRing = that.fVZEROgainEqualizationPerRing;
 #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)           
@@ -531,6 +566,7 @@ AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
   //PH Lets try Clone, however the result might be wrong
   if (that.fVZEROgainEqualization) fVZEROgainEqualization = (TH1*)that.fVZEROgainEqualization->Clone();
 #endif
+    
   for(Int_t i(0); i < 4; i++) { // no use to copy these guys since they're only initialized on worked node
       fVZEROApol[i] = that.fVZEROApol[i];
       fVZEROCpol[i] = that.fVZEROCpol[i];
@@ -577,6 +613,11 @@ AliFlowTrackCuts::~AliFlowTrackCuts()
       delete fChi3C;
       fChi3C = 0x0;
   }
+  fContoursFile->Close();
+  for(int i=0;i<50;i++){
+     delete fCutContour[i];
+     delete fCutGraph[i];
+  }
 }
 
 //-----------------------------------------------------------------------
@@ -620,6 +661,8 @@ void AliFlowTrackCuts::SetEvent(AliVEvent* event, AliMCEvent* mcEvent)
   
   if(fPIDsource==kTOFbayesian) fBayesianResponse->SetDetAND(1);
   else if(fPIDsource==kTPCbayesian) fBayesianResponse->ResetDetOR(1);
+    
+  if(fUseTPCTOFNsigmaCutContours) GetTPCTOFPIDContours();
 }
 
 //-----------------------------------------------------------------------
@@ -1240,7 +1283,25 @@ Bool_t AliFlowTrackCuts::PassesAODcuts(const AliAODTrack* track, Bool_t passedFi
     {
       if (!PassesAODpidCut(track)) pass=kFALSE;
     }
-
+/*
+  if ( (track->IsOn(AliAODTrack::kITSin)) && (track->IsOn(AliAODTrack::kTOFpid)) ) {
+     Double_t c = TMath::C()*1.E-9;
+     Double_t length = -999., beta =-999, tofTime = -999., tof = -999.;
+     tofTime = track->GetTOFsignal();//in ps
+     length = track->GetIntegratedLength();
+        
+     tof = tofTime*1E-3; // ns
+     if (tof > 0 && length > 0){
+        length = length*0.01; // in meters
+         tof = tof*c;
+         beta = length/tof;
+         if (fQA){
+             QAbefore(18)->Fill(track->P()*track->Charge(),beta);
+             if(pass) QAafter(18)->Fill(track->P()*track->Charge(),beta);
+         }
+     }
+  }*/
   if (fQA) {
     // changed 04062014 used to be filled before possible PID cut
     Double_t momTPC = track->GetTPCmomentum();
@@ -1262,6 +1323,10 @@ Bool_t AliFlowTrackCuts::PassesAODcuts(const AliAODTrack* track, Bool_t passedFi
     if (pass) QAafter( 11)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kKaon]));
     QAbefore(12)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kProton]));
     if (pass) QAafter( 12)->Fill(track->P(),(track->GetTOFsignal()-time[AliPID::kProton]));
+      
+    //QAbefore(19)->Fill(track->P()*track->Charge(),track->GetDetPid()->GetTPCsignal());
+    //if(pass) QAafter(19)->Fill(track->P()*track->Charge(),track->GetDetPid()->GetTPCsignal());
+      
   }
 
 
@@ -1278,6 +1343,7 @@ Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
   track->GetImpactParameters(dcaxy,dcaz);
   const AliExternalTrackParam* pout = track->GetOuterParam();
   const AliExternalTrackParam* pin = track->GetInnerParam();
+  
   if (fIgnoreTPCzRange)
   {
     if (pin&&pout)
@@ -1343,6 +1409,13 @@ Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
     track->GetTPCpid(pidTPC);
     if (pidTPC[AliPID::kElectron]<fParticleProbability) pass=kFALSE;
   }
+    
+  Int_t counterForSharedCluster=MaxSharedITSClusterCuts(fMaxITSclusterShared, track);
+  if(counterForSharedCluster >= fMaxITSclusterShared) pass=kFALSE;
+    
+  Double_t chi2perClusterITS = MaxChi2perITSClusterCuts(fMaxITSChi2, track);
+  if(chi2perClusterITS >= fMaxITSChi2) pass=kFALSE;
+    
   if (fQA)
   {
     if (pass) QAafter(0)->Fill(track->GetP(),beta);
@@ -1427,6 +1500,7 @@ Int_t AliFlowTrackCuts::Count(AliVEvent* event)
   //calculate the number of track in given event.
   //if argument is NULL(default) take the event attached
   //by SetEvent()
+    
   Int_t multiplicity = 0;
   if (!event)
   {
@@ -2475,6 +2549,13 @@ void AliFlowTrackCuts::DefineHistograms()
 
   before->Add(new TH1F("KinkIndex",";Kink index;counts", 2, 0., 2.));//17
   after->Add(new TH1F("KinkIndex",";Kink index;counts", 2, 0., 2.));//17
+   /*
+  before->Add(new TH2F("Pionbeta",";p_{t}[GeV/c];#beta",kNbinsP,binsP,1000,0,1000 ));//18
+  after->Add(new TH2F("Pionbeta",";p_{t}[GeV/c];#beta",kNbinsP,binsP,1000,0,1000 ));//18
+    
+  before->Add(new TH2F("PiondEdX",";p_{t}[GeV/c];dE/dX",kNbinsP,binsP,1000,0,1000 ));//19
+  after->Add(new TH2F("PiondEdX",";p_{t}[GeV/c];dE/dX",kNbinsP,binsP,1000,0,1000 ));//19
+*/
   TH1::AddDirectory(adddirstatus);
 }
 
@@ -2632,6 +2713,9 @@ Bool_t AliFlowTrackCuts::PassesAODpidCut(const AliAODTrack* track )
   case kTPCTOFNsigma:
       if (!PassesTPCTOFNsigmaCut(track)) pass = kFALSE;
       break;
+  case kTPCTOFNsigmaPuritybased:
+      if(!PassesTPCTOFNsigmaCutPuritybased(track)) pass = kFALSE;
+      break;
   default:
     return kTRUE;
     break;
@@ -2792,6 +2876,7 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliAODTrack* track )
 
   //construct the pid index because it's not AliPID::EParticleType
   Int_t pid = 0;
+    cout<<"TOFbeta: fParticleID = "<<fParticleID<<endl;
   switch (fParticleID)
   {
     case AliPID::kPion:
@@ -3579,7 +3664,76 @@ Bool_t AliFlowTrackCuts::PassesTPCTOFNsigmaCut(const AliESDtrack* track)
     return (nsigma2 < fNsigmaCut2);
 
 }
+//-----------------------------------------------------------------------------
+Bool_t AliFlowTrackCuts::PassesTPCTOFNsigmaCutPuritybased(const AliAODTrack* track)
+{
+    // do a combined cut on the n sigma from tpc and tof based on purity of the identified particle. (Particle is selected if Purity>0.8)
+    // with information of the pid response object (needs pid response task)
 
+    if(!fPIDResponse) return kFALSE;
+    if(!track) return kFALSE;
+    if(!fUseTPCTOFNsigmaCutContours) return kFALSE;
+
+    
+    Bool_t pWithinRange = kFALSE;
+    Int_t p_bin = -999;
+    Double_t pBins[50];
+    for(int b=0;b<50;b++){pBins[b] = 0.1*b;}
+    for(int i=0;i<50;i++){
+        if(track->P()>pBins[i] && track->P()<(pBins[i+1])){
+            p_bin = i;
+        }
+    }
+    Int_t ispecie = 0;
+    switch (fParticleID)
+    {
+        case AliPID::kPion:
+            ispecie=0;
+            break;
+        case AliPID::kKaon:
+            ispecie=1;
+            break;
+        case AliPID::kProton:
+            ispecie=2;
+            break;
+        default:
+            return kFALSE;
+    }
+    
+    Double_t LowPtPIDTPCnsigLow_Pion[6] = {-3,-3,-3,-3,-3,-3};
+    Double_t LowPtPIDTPCnsigLow_Kaon[6] = {-3,-2,0,-1.8,-1.2,-0.8}; //for0.4<Pt<0.5 the purity is lower than 0.7
+    Double_t LowPtPIDTPCnsigHigh_Pion[6] ={2.4,3,3,3,2,1.4};
+    Double_t LowPtPIDTPCnsigHigh_Kaon[6] ={3,2.2,0,-0.2,1,1.8}; //for 0.4<Pt<0.5 he purity is lower than 0.7
+    
+    Double_t nSigmaTOF=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);
+    Double_t nSigmaTPC=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie);
+
+    
+    if ( (track->IsOn(AliAODTrack::kITSin)) && (track->IsOn(AliAODTrack::kTOFpid))){
+        if(p_bin<0) return kFALSE;
+        if(!fCutContour[p_bin]) cout<<"fCutContour[p_bin] does not exist"<<endl;
+        
+        if(p_bin==4 || p_bin>7){
+            if(fCutContour[p_bin]->IsInside(nSigmaTOF,nSigmaTPC)){
+                return kTRUE;
+            }
+            else{
+                return kFALSE;
+            }
+        }
+        
+        if(p_bin<8 && p_bin!=4){
+            if(fParticleID==AliPID::kPion && nSigmaTPC>LowPtPIDTPCnsigLow_Pion[p_bin-2] && nSigmaTPC<LowPtPIDTPCnsigHigh_Pion[p_bin-2]){
+                return kTRUE;
+            }
+            if(fParticleID==AliPID::kKaon && nSigmaTPC>LowPtPIDTPCnsigLow_Kaon[p_bin-2] && nSigmaTPC<LowPtPIDTPCnsigHigh_Kaon[p_bin-2]){return kTRUE;}
+            
+            if(fParticleID==AliPID::kProton && nSigmaTPC>-3 && nSigmaTPC<3){return kTRUE;}
+        }
+    }
+    
+    return kFALSE;
+}
 //-----------------------------------------------------------------------
 void AliFlowTrackCuts::SetPriors(Float_t centrCur){
  //set priors for the bayesian pid selection
@@ -4718,6 +4872,8 @@ const char* AliFlowTrackCuts::PIDsourceName(PIDsource s)
       return "TPCnuclei";
     case kTPCTOFNsigma:
       return "TPCTOFNsigma";
+    case kTPCTOFNsigmaPuritybased:
+      return "TPCTOFNsigmaPuritybased";
     default:
       return "NOPID";
   }
@@ -4923,6 +5079,85 @@ Long64_t AliFlowTrackCuts::Merge(TCollection* list)
   }
   return fQA->Merge(&tmplist);
 }
+//________________________________________________________________//
+void AliFlowTrackCuts::GetTPCTOFPIDContours()
+{
+    fContoursFile = TFile::Open(Form("$ALICE_ROOT/PWGCF/FLOW/database/PIDCutContours_%i-%i.root",fCentralityPercentileMin,fCentralityPercentileMax));
+    fCutContourList=(TDirectory*)fContoursFile->Get("Filterbit1");
+    if(!fCutContourList){printf("The contour file is empty"); return;}
+
+    Double_t pBinning[50];
+    for(int b=0;b<50;b++){pBinning[b]=b;}
+    TString species[3] = {"pion","kaon","proton"};
+    TList *Species_contours[3];
+    Int_t ispecie = 0;
+    for(ispecie = 0; ispecie < 3; ispecie++) {
+       Species_contours[ispecie] = (TList*)fCutContourList->Get(species[ispecie]);
+        if(!Species_contours[ispecie]) {
+            cout<<"Contours for species: "<<species[ispecie]<<" not found!!!"<<endl;
+            return;
+        }
+    }
+    Int_t iParticle = 0;
+
+    switch (fParticleID)
+    {
+        case AliPID::kPion:
+            iParticle=0;
+            break;
+        case AliPID::kKaon:
+            iParticle=1;
+            break;
+        case AliPID::kProton:
+            iParticle=2;
+            break;
+        default:
+            return;
+    }
+
+    
+    for(int i=0;i<50;i++){
+        TString Graph_Name = "contourlines_";
+        Graph_Name += species[iParticle];
+        Graph_Name += Form("%.f%.f-%i%icent",pBinning[i],pBinning[i]+1,fCentralityPercentileMin,fCentralityPercentileMax);
+        fCutGraph[i] = (TGraph*)Species_contours[iParticle]->FindObject(Graph_Name);
+        
+        if(!fCutGraph[i]){cout<<"Contour Graph does not exist"<<endl; continue;}
+        
+        fCutContour[i] = new TCutG(Graph_Name.Data(),fCutGraph[i]->GetN(),fCutGraph[i]->GetX(),fCutGraph[i]->GetY());
+        
+    }
+    
+}
+//__________________
+Int_t AliFlowTrackCuts::MaxSharedITSClusterCuts(Int_t maxITSclusterShared, AliESDtrack* track){
+    
+    Int_t counterForSharedCluster = 0;
+    for(int i =0;i<6;i++){
+        Bool_t sharedITSCluster = track->HasSharedPointOnITSLayer(i);
+        Bool_t PointOnITSLayer = track->HasPointOnITSLayer(i);
+        //   cout << "has a point???    " << PointOnITSLayer << "     is it shared or not??? "  << sharedITSCluster << endl;
+        if(sharedITSCluster == 1) counterForSharedCluster++;
+    }
+    //if(counterForSharedCluster >= maxITSclusterShared) pass=kFALSE;
+    
+    return counterForSharedCluster;
+
+}
+//___________________
+Double_t AliFlowTrackCuts::MaxChi2perITSClusterCuts(Double_t maxITSChi2, AliESDtrack* track){
+    
+    // cout << "  Total Shared Cluster ==   "  <<counterForSharedCluster<< endl;
+    Double_t chi2perClusterITS = track->GetITSchi2()/track->GetNcls(0);
+    //  cout << "  chi2perClusterITS ==   "  <<chi2perClusterITS <<endl;
+    
+    
+    //if(chi2perClusterITS >= maxITSChi2) pass=kFALSE;
+
+    return chi2perClusterITS;
+}
+
 
 
 
index 29b210af673c7baadcc82ad61fa0045e5e3c5899..b7c428583f0e4d2cc6d732adea29bc9037f6d5b9 100644 (file)
@@ -20,6 +20,8 @@
 #include "AliMuonTrackCuts.h"  // XZhang 20120604
 #include "AliPID.h"
 #include "AliESDpid.h"
+#include "TCutG.h"
+
 
 class TBrowser;
 class TArrayD;
@@ -91,10 +93,17 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
                    kTOFbetaSimple, //simple TOF only cut
                    kTPCbayesian, //bayesian cutTPC
                   kTPCNuclei,   // added by Natasha for Nuclei
-                   kTPCTOFNsigma // simple cut on combined tpc tof nsigma
+                   kTPCTOFNsigma, // simple cut on combined tpc tof nsigma
+                   kTPCTOFNsigmaPuritybased // purity>0.7 cut on combined tpc tof nsigma
                    };
 
   //setters (interface to AliESDtrackCuts)
+  Int_t MaxSharedITSClusterCuts(Int_t maxITSclusterShared, AliESDtrack* track);
+  Double_t MaxChi2perITSClusterCuts(Double_t maxITSChi2, AliESDtrack* track);
+
+  void SetMaxSharedITSCluster(Int_t b){fMaxITSclusterShared = b;}
+  void SetMaxChi2perITSCluster(Double_t b){fMaxITSChi2 = b;}
+    
   void SetMinNClustersTPC( Int_t a ) {fCutNClustersTPC=kTRUE; fNClustersTPCMin=a;}
   void SetMinNClustersITS( Int_t a ) {fCutNClustersITS=kTRUE; fNClustersITSMin=a;}
   void SetClusterRequirementITS( AliESDtrackCuts::Detector det,
@@ -239,6 +248,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   //PID
   void SetPID(AliPID::EParticleType pid, PIDsource s=kTOFpid, Double_t prob=0.9)
              {fParticleID=pid; fPIDsource=s; fParticleProbability=prob; fCutPID=kTRUE; InitPIDcuts();}
+  void SetTPCTOFNsigmaPIDCutContours(Bool_t b,Double_t cMin,Double_t cMax){fUseTPCTOFNsigmaCutContours = b; fCentralityPercentileMin=cMin; fCentralityPercentileMax=cMax;}
   AliPID::EParticleType GetParticleID() const {return fParticleID;}
   Bool_t GetCutPID() const {return fCutPID;}
   void SetTPCpidCuts(const TMatrixF* mat) {fTPCpidCuts=new TMatrixF(*mat);}
@@ -280,7 +290,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
   void Browse(TBrowser* b);
   Long64_t Merge(TCollection* list);
-  
+  void GetTPCTOFPIDContours();
   //gain equalization and recentering
   void SetVZEROgainEqualisation(TH1* g) {fVZEROgainEqualization=g;}
   void SetVZEROApol(Int_t ring, Float_t f) {fVZEROApol[ring]=f;}
@@ -333,9 +343,10 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Bool_t PassesNucleiSelection(const AliESDtrack* track);   // added by Natasha
   Bool_t PassesTPCTOFNsigmaCut(const AliAODTrack* track); 
   Bool_t PassesTPCTOFNsigmaCut(const AliESDtrack* track);
+  Bool_t PassesTPCTOFNsigmaCutPuritybased(const AliAODTrack* track);
   Bool_t TPCTOFagree(const AliVTrack *track);
   // end part added by F. Noferini
-
+    
   //the cuts
   AliESDtrackCuts* fAliESDtrackCuts; //alianalysis cuts
   AliMuonTrackCuts* fMuonTrackCuts;  // muon selection cuts // XZhang 20120604
@@ -377,6 +388,9 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Double_t fMinimalTPCdedx;       //value for minimal TPC dedx
   Bool_t fLinearizeVZEROresponse; //linearize VZERO response using AliESDUtil
   
+  Int_t fCentralityPercentileMin; //centrality min
+  Int_t fCentralityPercentileMax; //centrality max
+    
   Bool_t  fCutPmdDet;   //cut on PMD detector plane 
   Int_t   fPmdDet;      // value of PMD detector plane
   Bool_t  fCutPmdAdc;   //cut on cluster ADC
@@ -422,6 +436,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Bool_t fAllowTOFmismatchFlag; //allow TOFmismatch flag=1 in ESD
   Bool_t fRequireStrictTOFTPCagreement; //require stricter than TOFmismatch flag TOF-TPC agreement
   Bool_t fCutRejectElectronsWithTPCpid; //reject electrons with TPC pid
+  Bool_t fUseTPCTOFNsigmaCutContours;  // Flag to use purity based TPC-TOF nsigma cuts
 
   // part added by F. Noferini
   static const Int_t fgkPIDptBin = 20; // pT bins for priors
@@ -445,6 +460,24 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
   AliPIDResponse *fPIDResponse;            //! Pid reponse to manage Nsigma cuts
   Float_t fNsigmaCut2;                     // Number of sigma^2 (cut value) for TPC+TOF nsigma cut
+    
+    
+  //TPC TOF nsigma Purity based cut contours
+  TFile                 *fContoursFile;       //! contours file
+  TDirectory            *fCutContourList;     //! contour list
+  
+  Int_t  fMaxITSclusterShared;
+  Double_t  fMaxITSChi2;
+  
+    
+  TCutG                 *fCutContour[50];    //! TCutG contours
+  //TCutG                 *fCutContour_kaon[50];    //! TCutG contours
+  //TCutG                 *fCutContour_proton[50];    //! TCutG contours
+  TGraph                *fCutGraph[50];      //! graphs
+  //TGraph                *fCutGraph_kaon[50];      //! graphs
+  //TGraph                *fCutGraph_proton[50];      //! graphs
+    
+    
 
   ClassDef(AliFlowTrackCuts,15)
 };
index 6a2d947edcd2b689b80ba83bf22655ee643e6a2a..2a0ceb9826d13c519875adf752c1ec60445e76c5 100644 (file)
@@ -51,6 +51,7 @@ set(SRCS
   AliAnalysisTaskFittingQDistribution.cxx 
   AliAnalysisTaskFlowEvent.cxx 
   AliAnalysisTaskFlowStrange.cxx 
+  AliAnalysisTaskFlowStrangee.cxx
   AliAnalysisTaskFlowEventforRP.cxx 
   AliAnalysisTaskMixedHarmonics.cxx 
   AliAnalysisTaskNestedLoops.cxx 
index 0bdf635909fcaee1e1bf0719950a297c8eaf1ac3..ead3538a0b5f15df6741cbc9694a621d6040d06d 100644 (file)
@@ -21,6 +21,7 @@
 #pragma link C++ class AliAnalysisTaskFlowEvent+;
 #pragma link C++ class AliAnalysisTaskFlowEventforRP+;
 #pragma link C++ class AliAnalysisTaskFlowStrange+;
+#pragma link C++ class AliAnalysisTaskFlowStrangee+;
 #pragma link C++ class AliAnalysisTaskMixedHarmonics+;
 #pragma link C++ class AliAnalysisTaskNestedLoops+;
 #pragma link C++ class AliAnalysisTaskQAflow+;
index 3f1107b9d29fa7ad885c64b08dbb57bded4dcb98..ecbd97420f57c8a92215bc40ee8e696059e4f95e 100644 (file)
@@ -34,7 +34,8 @@ AliGlauberNucleon::AliGlauberNucleon():
   fY(0),
   fZ(0),
   fInNucleusA(0),
-  fNColl(0)
+  fNColl(0),
+  fSigNN(0.)
 {
   //def ctor
 }
index d673a9032fecd03d683ee8d2b9a19787e1a998e9..a9f241015ea4efd078c08b5a13bbe2afd4581c8b 100644 (file)
@@ -17,22 +17,22 @@ ClassImp(AliJSONBool)
 ClassImp(AliJSONString)
 ClassImp(AliJSONData)
 
-const char* AliJSONInt::ToString() const { 
+std::string AliJSONInt::ToString() const {
   std::stringstream stringbuilder;
   stringbuilder << fValue;
-  return stringbuilder.str().c_str();
+  return stringbuilder.str();
 }
 
-const char* AliJSONFloat::ToString() const {
+std::string AliJSONFloat::ToString() const {
   std::stringstream stringbuilder;
   stringbuilder << fValue;
-  return stringbuilder.str().c_str();
+  return stringbuilder.str();
 }
 
-const char* AliJSONDouble::ToString() const {
+std::string AliJSONDouble::ToString() const {
   std::stringstream stringbuilder;
   stringbuilder << fValue;
-  return stringbuilder.str().c_str();
+  return stringbuilder.str();
 }
 
 AliJSONData::AliJSONData(const char* key, const char* value):
@@ -53,7 +53,7 @@ AliJSONData::AliJSONData(const char* key, const char* value):
      fValue = new AliJSONString(value);
 }
 
-const char* AliJSONData::ToString() const {
+std::string AliJSONData::ToString() const {
   std::stringstream jsonbuilder;
   jsonbuilder << "\"" << GetName() << "\":\"" << fValue->ToString() << "\"";
   return jsonbuilder.str().c_str();
index dc929b7fc53f92d10bae30e4e25bcf26bf4b5333..5bdd29b00e2936ed333cf3c7ebf360be29783b0c 100644 (file)
@@ -9,7 +9,9 @@
 #define _ALIJSONDATA_H_
 
 #include <ostream>
+#include <string>
 #include <TNamed.h>
+#include <TString.h>
 
 /************************************************************
  *
@@ -22,7 +24,7 @@ public:
   AliJSONValue() {}
   virtual ~AliJSONValue() {}
 
-  virtual const char *ToString() const = 0;
+  virtual std::string ToString() const = 0;
 
   ClassDef(AliJSONValue,1);
 };
@@ -38,7 +40,7 @@ public:
   void SetValue(Int_t value) { fValue = value; }
   Int_t GetValue() const { return fValue; }
 
-  virtual const char *ToString() const ;
+  virtual std::string ToString() const ;
 private:
   Int_t fValue;
 
@@ -56,7 +58,7 @@ public:
   void SetValue(Float_t value) { fValue = value; }
   Float_t GetValue() const { return fValue; }
 
-  virtual const char *ToString() const;
+  virtual std::string ToString() const;
 private:
   Float_t fValue;
 
@@ -74,7 +76,7 @@ public:
   void SetValue(Double_t value) { fValue = value; }
   Double_t GetValue() const { return fValue; }
 
-  virtual const char *ToString() const;
+  virtual std::string ToString() const;
 private:
   Double_t fValue;
 
@@ -92,7 +94,7 @@ public:
   void SetValue(Bool_t value) { fValue = value; }
   Bool_t GetValue() const { return fValue; }
 
-  virtual const char *ToString() const { return fValue ? "true" : "false"; }
+  virtual std::string ToString() const { return fValue ? "true" : "false"; }
 private:
   Bool_t fValue;
 
@@ -110,7 +112,7 @@ public:
   void SetValue(const char * value) { fValue = value; }
   const char * GetValue() const { return fValue; }
 
-  virtual const char *ToString() const { return fValue; }
+  virtual std::string ToString() const { return std::string(fValue.Data()); }
 private:
   TString fValue;
 
@@ -141,7 +143,7 @@ public:
   }
 
   AliJSONValue *GetValue() const { return fValue; }
-  const char *ToString() const;
+  std::string ToString() const;
 
 protected:
   AliJSONData(const AliJSONData &ref);
index 49711aec0e889dd1d248fbd628c2d3b695ebf181..18d0568da3cc7233da2eb5ede98f956eb65d67df 100644 (file)
@@ -114,6 +114,8 @@ TList* AliJSONReader::Decode(const char* jsonstring) const {
   std::vector<AliJSONSyntaxTreeNode *> &daughters = ast->GetDaughters();
   for(std::vector<AliJSONSyntaxTreeNode *>::iterator it = daughters.begin(); it != daughters.end(); it++)
     AddNodeToList(*it, entries);
+  // Delete the syntax tree after being done
+  delete ast;
   return entries;
 }
 
index 4ec64e8cddd8a302b751c2092c0f56b46ca7cb99..ece81330455e21c6c5bba423cac8d55bfcf321ea 100644 (file)
@@ -93,6 +93,7 @@ void THistManager::CreateHistoGroup(const char *groupname, const char *parent) {
        THashList *parentgroup = FindGroup(parent);
        if(!parentgroup){
                Fatal("THistManager::CreateHistoGroup", "Parent group %s does not exist", parentgroup->GetName());
+               return;
        }
        THashList *childgroup = new THashList();
        childgroup->SetName(groupname);
@@ -114,10 +115,14 @@ void THistManager::CreateTH1(const char *name, const char *title, int nbins, dou
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH1", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH1", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH1D(hname.Data(), title, nbins, xmin, xmax));
 }
 
@@ -135,10 +140,14 @@ void THistManager::CreateTH1(const char *name, const char *title, int nbins, con
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH1", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH1", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH1D(hname.Data(), title, nbins, xbins));
 }
 
@@ -155,10 +164,14 @@ void THistManager::CreateTH1(const char *name, const char *title, const TArrayD
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH1", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH1", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH1D(hname.Data(), title, xbins.GetSize()-1, xbins.GetArray()));
 }
 
@@ -180,10 +193,14 @@ void THistManager::CreateTH2(const char *name, const char *title, int nbinsx, do
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH2", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH2", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH2D(hname.Data(), title, nbinsx, xmin, xmax, nbinsy, ymin, ymax));
 }
 
@@ -203,10 +220,14 @@ void THistManager::CreateTH2(const char *name, const char *title, int nbinsx, co
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH2", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH2", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH2D(hname.Data(), title, nbinsx, xbins, nbinsy, ybins));
 }
 
@@ -224,10 +245,14 @@ void THistManager::CreateTH2(const char *name, const char *title, const TArrayD
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH2", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH2", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH2D(hname.Data(), title, xbins.GetSize() - 1, xbins.GetArray(), ybins.GetSize() - 1, ybins.GetArray()));
 }
 
@@ -250,10 +275,14 @@ void THistManager::CreateTH3(const char* name, const char* title, int nbinsx, do
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH3", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH3", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH3D(hname.Data(), title, nbinsx, xmin, xmax, nbinsy, ymin, ymax, nbinsz, zmin, zmax));
 }
 
@@ -275,10 +304,13 @@ void THistManager::CreateTH3(const char* name, const char* title, int nbinsx, co
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH3", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH3", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+  }
        parent->Add(new TH3D(hname.Data(), title, nbinsx, xbins, nbinsy, ybins, nbinsz, zbins));
 }
 
@@ -297,10 +329,14 @@ void THistManager::CreateTH3(const char* name, const char* title, const TArrayD&
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTH3", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTH3", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new TH3D(hname.Data(), title, xbins.GetSize()-1, xbins.GetArray(), ybins.GetSize()-1, ybins.GetArray(), zbins.GetSize()-1, zbins.GetArray()));
 }
 
@@ -320,10 +356,14 @@ void THistManager::CreateTHnSparse(const char *name, const char *title, int ndim
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTHnSparse", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname.Data()))
+               return;
+       }
+       if(parent->FindObject(hname.Data())){
                Fatal("THistManager::CreateTHnSparse", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        parent->Add(new THnSparseD(hname.Data(), title, ndim, nbins, min, max));
 }
 
@@ -341,10 +381,14 @@ void THistManager::CreateTHnSparse(const char *name, const char *title, int ndim
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::CreateTHnSparse", "Parent %s does not exist", dirname.Data());
-       if(parent->FindObject(hname))
+               return;
+       }
+       if(parent->FindObject(hname)){
                Fatal("THistManager::CreateTHnSparse", "Object %s already exists in group %s does not exist", hname.Data(), dirname.Data());
+               return;
+       }
        TArrayD xmin(ndim), xmax(ndim);
        TArrayI nbins(ndim);
        for(int idim = 0; idim < ndim; ++idim){
@@ -369,12 +413,18 @@ void THistManager::SetObject(TObject * const o, const char *group) {
         * the object is not a histogram type
         */
        THashList *parent(FindGroup(group));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::SetObject", "Parent %s does not exist", strcmp(group, "/") ? group : "");
-       if(parent->FindObject(o->GetName()))
+               return;
+       }
+       if(parent->FindObject(o->GetName())){
                Fatal("THistManager::SetObject", "Parent %s does not exist", strcmp(group, "/") ? group : "");
-       if(!(dynamic_cast<THnBase *>(o) || dynamic_cast<TH1 *>(o)))
+               return;
+       }
+       if(!(dynamic_cast<THnBase *>(o) || dynamic_cast<TH1 *>(o))){
                Fatal("THistManager::SetObject",  "Object %s is not of a histogram type",o->GetName());
+               return;
+       }
        fHistos->Add(o);
 }
 
@@ -391,11 +441,15 @@ void THistManager::FillTH1(const char *name, double x, double weight) {
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
+       if(!parent){
                Fatal("THistManager::FillTH1", "Parnt group %s does not exist", dirname.Data());
+               return;
+       }
        TH1 *hist = dynamic_cast<TH1 *>(parent->FindObject(hname.Data()));
-       if(!hist)
+       if(!hist){
                Fatal("THistManager::FillTH1", "Histogram %s not found in parent group %s", hname.Data(), dirname.Data());
+               return;
+       }
        hist->Fill(x, weight);
 }
 
@@ -413,11 +467,15 @@ void THistManager::FillTH2(const char *name, double x, double y, double weight)
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
-               Fatal("THistManager::FillTH2", "Parnt group %s does not exist", dirname.Data());
+       if(!parent){
+               Fatal("THistManager::FillTH2", "Parent group %s does not exist", dirname.Data());
+               return;
+       }
        TH2 *hist = dynamic_cast<TH2 *>(parent->FindObject(hname.Data()));
-       if(!hist)
+       if(!hist){
                Fatal("THistManager::FillTH2", "Histogram %s not found in parent group %s", hname.Data(), dirname.Data());
+               return;
+       }
        hist->Fill(x, y, weight);
 }
 
@@ -434,11 +492,15 @@ void THistManager::FillTH2(const char *name, double *point, double weight) {
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
-               Fatal("THistManager::FillTH2", "Parnt group %s does not exist", dirname.Data());
+       if(!parent){
+               Fatal("THistManager::FillTH2", "Parent group %s does not exist", dirname.Data());
+               return;
+       }
        TH2 *hist = dynamic_cast<TH2 *>(parent->FindObject(hname.Data()));
-       if(!hist)
+       if(!hist){
                Fatal("THistManager::FillTH2", "Histogram %s not found in parent group %s", hname.Data(), dirname.Data());
+               return;
+       }
        hist->Fill(point[0], point[1], weight);
 }
 
@@ -457,11 +519,15 @@ void THistManager::FillTH3(const char* name, double x, double y, double z, doubl
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
-               Fatal("THistManager::FillTH3", "Parnt group %s does not exist", dirname.Data());
+       if(!parent){
+               Fatal("THistManager::FillTH3", "Parent group %s does not exist", dirname.Data());
+               return;
+       }
        TH3 *hist = dynamic_cast<TH3 *>(parent->FindObject(hname.Data()));
-       if(!hist)
+       if(!hist){
                Fatal("THistManager::FillTH3", "Histogram %s not found in parent group %s", hname.Data(), dirname.Data());
+               return;
+       }
        hist->Fill(x, y, z, weight);
 }
 
@@ -478,11 +544,15 @@ void THistManager::FillTH3(const char* name, const double* point, double weight)
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
-               Fatal("THistManager::FillTH3", "Parnt group %s does not exist", dirname.Data());
+       if(!parent){
+               Fatal("THistManager::FillTH3", "Parent group %s does not exist", dirname.Data());
+               return;
+       }
        TH3 *hist = dynamic_cast<TH3 *>(parent->FindObject(hname.Data()));
-       if(!hist)
+       if(!hist){
                Fatal("THistManager::FillTH3", "Histogram %s not found in parent group %s", hname.Data(), dirname.Data());
+               return;
+       }
        hist->Fill(point[0], point[1], point[2], weight);
 }
 
@@ -500,11 +570,15 @@ void THistManager::FillTHnSparse(const char *name, const double *x, double weigh
         */
        TString dirname(basename(name)), hname(histname(name));
        THashList *parent(FindGroup(dirname.Data()));
-       if(!parent)
-               Fatal("THistManager::FillTH3", "Parnt group %s does not exist", dirname.Data());
+       if(!parent){
+               Fatal("THistManager::FillTH3", "Parent group %s does not exist", dirname.Data());
+               return;
+       }
        THnSparseD *hist = dynamic_cast<THnSparseD *>(parent->FindObject(hname.Data()));
-       if(!hist)
+       if(!hist){
                Fatal("THistManager::FillTH3", "Histogram %s not found in parent group %s", hname.Data(), dirname.Data());
+               return;
+       }
        hist->Fill(x, weight);
 }
 
index b05ab209a236a1916a0bd7a723b6f325945de4bd..5453ade5852546598474ed932a0662040fb9ed62 100644 (file)
@@ -654,7 +654,7 @@ void AliAnalysisTaskFlowSingleMu::Terminate(Option_t *) {
   TString graphTypeName[3] = {"raw","correctStat","correctSyst"};
   Int_t drawOrder[3] = {0, 2, 1};
   TString drawOpt[3] = {"apz","pz","a2"};
-  Int_t nTypes = ( hasResolution ) ? 3 : 1;
+  const Int_t kNtypes = ( hasResolution ) ? 3 : 1;
 
   TString histoName = "", histoPattern = "";
   ///////////
@@ -672,8 +672,8 @@ void AliAnalysisTaskFlowSingleMu::Terminate(Option_t *) {
   for ( Int_t istep=0; istep<kNsteps; istep++ ) {
     for ( Int_t isrc = firstSrc; isrc <= lastSrc; ++isrc ) {
       TString baseName = Form("%s_%s", stepName[istep].Data(), fSrcKeys->At(isrc)->GetName());
-      TGraphErrors* flowVsCentrality[3];
-      for ( Int_t itype=0; itype<nTypes; itype++ ) {
+      TGraphErrors* flowVsCentrality[kNtypes];
+      for ( Int_t itype=0; itype<kNtypes; itype++ ) {
         histoName = Form("v2VsCentrality_%s_%s", baseName.Data(), graphTypeName[itype].Data());
         flowVsCentrality[itype] = new TGraphErrors();
         flowVsCentrality[itype]->SetName(histoName.Data());
@@ -688,8 +688,8 @@ void AliAnalysisTaskFlowSingleMu::Terminate(Option_t *) {
         TAxis* ptAxis = histo2D->GetYaxis();
         
         Int_t ipad = 0;
-        TGraphErrors* flowVsPt[3];
-        for ( Int_t itype=0; itype<nTypes; itype++ ) {
+        TGraphErrors* flowVsPt[kNtypes];
+        for ( Int_t itype=0; itype<kNtypes; itype++ ) {
           histoName = Form("v2VsPt_%s_%s", baseNameCent.Data(), graphTypeName[itype].Data());
           flowVsPt[itype] = new TGraphErrors();
           flowVsPt[itype]->SetName(histoName.Data());
@@ -720,7 +720,7 @@ void AliAnalysisTaskFlowSingleMu::Terminate(Option_t *) {
             func->FixParameter(1,0.);
           }
           projHisto->Fit(func,"R");
-          for ( Int_t itype=0; itype<nTypes; itype++ ) {
+          for ( Int_t itype=0; itype<kNtypes; itype++ ) {
             TGraphErrors* currGraph = ( ipt == 0 ) ? flowVsCentrality[itype] : flowVsPt[itype];
             Double_t resoVal = ( itype == 0 ) ? 1. : wgtReso[0][idx];
             Double_t resoErr = ( itype == 0 ) ? 0. : wgtReso[itype][idx];
@@ -748,7 +748,7 @@ void AliAnalysisTaskFlowSingleMu::Terminate(Option_t *) {
             currGraph->SetPointError(ipoint,xErr,yErr);
           } // loop on type
         } // loop on pt bins
-        for ( Int_t itype=0; itype<nTypes; itype++ ) {
+        for ( Int_t itype=0; itype<kNtypes; itype++ ) {
           Int_t currType = drawOrder[itype];
           if ( itype < 2 ) {
             currName = flowVsPt[currType]->GetName();
@@ -765,7 +765,7 @@ void AliAnalysisTaskFlowSingleMu::Terminate(Option_t *) {
           outList.Add(flowVsPt[currType]);
         } // loop on types
       } // loop on centrality
-      for ( Int_t itype=0; itype<nTypes; itype++ ) {
+      for ( Int_t itype=0; itype<kNtypes; itype++ ) {
         Int_t currType = drawOrder[itype];
         if ( flowVsCentrality[currType]->GetN() == 0 ) continue;
         if ( itype < 2 ) {
index 74b0964b7d0c8a776502bda5023df23281a7cec6..cd02c8f2098bd1b106b20d3bd044056e92446dae 100644 (file)
@@ -248,7 +248,12 @@ void AliAnalysisTaskSingleMu::ProcessEvent(TString physSel, const TObjArray& sel
       // (before ISR, FSR and kt kick) and the final state one.
       // The first muon is of course there only for information and should be rejected.
       // The Pythia code for initial state particles is 21
-      Bool_t isSelected = ( istep == kStepReconstructed ) ? fMuonTrackCuts->IsSelected(track) : ( TMath::Abs(track->PdgCode()) == 13 && AliAnalysisMuonUtility::GetStatusCode(track) != 21 );
+      // When running with POWHEG, Pythia puts the hard process input of POWHEG in the stack
+      // with state 21, and then re-add it to stack before applying ISR, FSR and kt kick.
+      // This muon produces the final state muon, and its status code is 11
+      // To avoid all problems, keep only final state muon (status code <10)
+      // FIXME: is the convention valid for other generators as well?
+      Bool_t isSelected = ( istep == kStepReconstructed ) ? fMuonTrackCuts->IsSelected(track) : ( TMath::Abs(track->PdgCode()) == 13 && AliAnalysisMuonUtility::GetStatusCode(track) < 10 );
       if ( ! isSelected ) continue;
       
       selectedTracks.AddAt(track,itrack);
@@ -456,10 +461,12 @@ void AliAnalysisTaskSingleMu::Terminate(Option_t *) {
         }
         TH1* histo = gridSparseArray[igrid]->Project(kHvarPt, kHvarEta);
         histo->SetName(Form("hPtEta_%s_%s_%s", gridSparseName[igrid].Data(), srcAxis->GetBinLabel(isrc), chargeNames[icharge].Data()));
+        histo->SetDirectory(0);
         if ( histo->Integral() > 0 ) histoList[icharge].Add(histo);
         for ( Int_t iproj=0; iproj<4; ++iproj ) {
           histo = gridSparseArray[igrid]->Project(iproj);
           histo->SetName(Form("proj%i_%s_%s_%s", iproj, gridSparseName[igrid].Data(), srcAxis->GetBinLabel(isrc), chargeNames[icharge].Data()));
+          histo->SetDirectory(0);
           if ( histo->Integral() > 0 ) histoList[icharge].Add(histo);
         } // loop on projections
       } // loop on grid sparse
@@ -493,6 +500,7 @@ void AliAnalysisTaskSingleMu::Terminate(Option_t *) {
     axisTitle.ReplaceAll("MuMinus","#mu^{-}");
     histo->GetYaxis()->SetTitle(axisTitle.Data());
     histo->SetStats(kFALSE);
+    histo->SetDirectory(0);
     histoListRatio.Add(histo);
   }
   
@@ -574,16 +582,14 @@ void AliAnalysisTaskSingleMu::Terminate(Option_t *) {
   evtSel = Form("trigger:%s/%s", trigClassName.Data(), countPhysSel.Data());
   fEventCounters->Print("centrality",evtSel.Data(),kTRUE);
   
-  
   TString outFilename = Form("/tmp/out%s.root", GetName());
+  printf("\nCreating file %s\n", outFilename.Data());
   TFile* outFile = new TFile(outFilename.Data(),"RECREATE");
   for ( Int_t icharge=0; icharge<3; icharge++ ) {
     histoList[icharge].Write();
   }
   histoListRatio.Write();
   outFile->Close();
-  printf("\nCreating file %s\n", outFilename.Data(
-         ));
   
   ///////////////////
   // Vertex method //
index a7e09fd40254016bdf807150eb4c9a27f1e1310f..865c8790a37adc45db70fc826ec9d73b14cf6ce0 100644 (file)
@@ -19,7 +19,7 @@ echo "############## memory : ##############"
 free -m
 echo "========================================="
 
-aliroot -b -q AODtrain.C\($1\)
+aliroot -b -q AODtrainsim.C\($1\)
 echo "======== AODtrain_merge.C finished with exit code: $? ========"
 echo "############## memory after: ##############"
 free -m
similarity index 90%
rename from PWG/muondep/AccEffTemplates/AODtrain.C
rename to PWG/muondep/AccEffTemplates/AODtrainsim.C
index 3d3f4b6821254b394be13706012c7e7b60c10458..60800621573efa9a028a8405fbd85c75b23e750b 100644 (file)
@@ -1,7 +1,7 @@
 // ### Settings that make sense when using the Alien plugin
 //==============================================================================
-Int_t       runOnData          = 1;       // Set to 1 if processing real data
-Int_t       iCollision         = 1;       // 0=pp, 1=Pb-Pb
+Int_t       runOnData          = 0;       // Set to 1 if processing real data
+Int_t       iCollision         = 0;       // 0=pp, 1=Pb-Pb
 //==============================================================================
 Bool_t      usePhysicsSelection = kFALSE; // use physics selection
 Bool_t      useTender           = kFALSE; // use tender wagon
@@ -36,7 +36,7 @@ TString configPWG3d2h = (iCollision==0)?"$ALICE_ROOT/PWG3/vertexingHF/ConfigVert
 :"$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF_highmult.C";
 
 // Temporaries.
-class AliOADBPhysicsSelection;                                                                                                                  
+class AliOADBPhysicsSelection;
 AliOADBPhysicsSelection *CreateOADBphysicsSelection();
 void AODmerge();
 void AddAnalysisTasks(Int_t);
@@ -46,13 +46,13 @@ Bool_t LoadLibrary(const char *);
 TChain *CreateChain();
 
 //______________________________________________________________________________
-void AODtrain(Int_t merge=0)
+void AODtrainsim(Int_t merge=0)
 {
   // Main analysis train macro.
   // merge = 0: production
   // merge = 1: intermediate merging
   // merge = 2: final merging + terminate
-  
+
   if (merge) {
     TGrid::Connect("alien://");
     if (!gGrid || !gGrid->IsConnected()) {
@@ -77,13 +77,13 @@ void AODtrain(Int_t merge=0)
   if (iPWG3vertexing) printf("=  PWG3 vertexing                                                =\n");
   if (iPWG3JPSIfilter) printf("=  PWG3 j/psi filter                                             =\n");
   if (iPWG3d2h) printf("=  PWG3 D0->2 hadrons QA                                     =\n");
-  
+
   // Load common libraries and set include path
   if (!LoadCommonLibraries()) {
     ::Error("AnalysisTrain", "Could not load common libraries");
     return;
   }
-  
+
   // Make the analysis manager and connect event handlers
   AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Production train");
   if (useSysInfo) mgr->SetNSysInfo(100);
@@ -91,18 +91,18 @@ void AODtrain(Int_t merge=0)
   if (!LoadAnalysisLibraries()) {
     ::Error("AnalysisTrain", "Could not load analysis libraries");
     return;
-  }   
-  
+  }
+
   // Create input handler (input container created automatically)
   // ESD input handler
   AliESDInputHandler *esdHandler = new AliESDInputHandler();
-  mgr->SetInputEventHandler(esdHandler);       
+  mgr->SetInputEventHandler(esdHandler);
   // Monte Carlo handler
   if (useMC) {
     AliMCEventHandler* mcHandler = new AliMCEventHandler();
     mgr->SetMCtruthEventHandler(mcHandler);
-    mcHandler->SetReadTR(useTR); 
-  }   
+    mcHandler->SetReadTR(useTR);
+  }
   // AOD output container, created automatically when setting an AOD handler
   if (iAODhandler) {
     // AOD output handler
@@ -112,7 +112,7 @@ void AODtrain(Int_t merge=0)
   }
   // Debugging if needed
   if (useDBG) mgr->SetDebugLevel(3);
-  
+
   AddAnalysisTasks(merge);
   if (merge) {
     AODmerge();
@@ -122,12 +122,12 @@ void AODtrain(Int_t merge=0)
       mgr->StartAnalysis("grid terminate",0);
     }
     return;
-  }   
-  // Run the analysis                                                                                                                     
+  }
+  // Run the analysis
   //
   TChain *chain = CreateChain();
   if (!chain) return;
-  
+
   TStopwatch timer;
   timer.Start();
   mgr->SetSkipTerminate(kTRUE);
@@ -136,13 +136,13 @@ void AODtrain(Int_t merge=0)
     mgr->StartAnalysis("local", chain);
   }
   timer.Print();
-}                                                                                                                                          
+}
+
+//______________________________________________________________________________
+void AddAnalysisTasks(Int_t merge){
+  // Add all analysis task wagons to the train
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
 
-//______________________________________________________________________________                                                           
-void AddAnalysisTasks(Int_t merge){                                                                                                                                          
-  // Add all analysis task wagons to the train                                                                                               
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();                                                                     
-  
   //
   // Tender and supplies. Needs to be called for every event.
   //
@@ -153,13 +153,13 @@ void AddAnalysisTasks(Int_t merge){
     AliAnalysisTaskSE *tender = AddTaskTender(useV0tender);
     //      tender->SetDebugLevel(2);
   }
-  
+
   if (usePhysicsSelection) {
     // Physics selection task
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
     mgr->RegisterExtraFile("event_stat.root");
     AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(kFALSE);
-    //      AliOADBPhysicsSelection * oadbDefaultPbPb = CreateOADBphysicsSelection();      
+    //      AliOADBPhysicsSelection * oadbDefaultPbPb = CreateOADBphysicsSelection();
     //      physSelTask->GetPhysicsSelection()->SetCustomOADBObjects(oadbDefaultPbPb,0,0);
     //      if (!merge) mgr->AddStatisticsTask(AliVEvent::kAny);
   }
@@ -169,18 +169,18 @@ void AddAnalysisTasks(Int_t merge){
     AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
     taskCentrality->SelectCollisionCandidates(AliVEvent::kAny);
   }
-  
+
   if (iMUONRefit) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG/muondep/AddTaskMuonRefit.C");
     AliAnalysisTaskMuonRefit* refit = AddTaskMuonRefit(-1., -1., kTRUE, -1., -1.);
     refit->RemoveMonoCathodClusters(kTRUE, kFALSE);
   }
-  
+
   if(iESDMCLabelAddition) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG/muondep/AddTaskESDMCLabelAddition.C");
     AliAnalysisTaskESDMCLabelAddition *esdmclabel = AddTaskESDMCLabelAddition();
   }
-  
+
   if (useMC && useTR && iMUONPerformance) {
     gROOT->LoadMacro("$ALICE_ROOT/PWGPP/MUON/dep/AddTaskMuonPerformance.C");
     AliAnalysisTaskMuonPerformance* muonPerformance = AddTaskMuonPerformance();
@@ -188,14 +188,14 @@ void AddAnalysisTasks(Int_t merge){
     muonPerformance->UseMCKinematics(kTRUE);
     muonPerformance->SetMCTrigLevelFromMatchTrk(kTRUE);
   }
-  
+
   if (iMUONEfficiency) {
     gROOT->LoadMacro("$ALICE_ROOT/PWGPP/MUON/dep/AddTaskMUONTrackingEfficiency.C");
     AliAnalysisTaskMuonTrackingEff* muonEfficiency = AddTaskMUONTrackingEfficiency(kTRUE, kTRUE);
     if (usePhysicsSelection) muonEfficiency->SelectCollisionCandidates(AliVEvent::kAny);
     muonEfficiency->UseMCLabel(kTRUE);
   }
-  
+
   if (iESDfilter) {
     //  ESD filter task configuration.
     gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C");
@@ -208,8 +208,8 @@ void AddAnalysisTasks(Int_t merge){
     } else {
       AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kTRUE,kTRUE,1100,muonMCMode); // others
     }
-    
-    if ( 0 && VAR_USE_ITS_RECO ) /* 0 for the moment to get this macro running also with AliRoot <= .... */      
+
+    if ( 0 && VAR_USE_ITS_RECO ) /* 0 for the moment to get this macro running also with AliRoot <= .... */
     {
       AliAnalysisTaskESDMuonFilter* muFilter = mgr->GetTask("ESD Muon Filter");
       if ( !muFilter )
@@ -221,9 +221,9 @@ void AddAnalysisTasks(Int_t merge){
         muFilter->SetWithSPDtracklets(kTRUE);
       }
     }
-  }   
-  
-  // ********** PWG3 wagons ******************************************************           
+  }
+
+  // ********** PWG3 wagons ******************************************************
   // PWG3 vertexing
   if (iPWG3vertexing) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/macros/AddTaskVertexingHF.C");
@@ -232,8 +232,8 @@ void AddAnalysisTasks(Int_t merge){
     if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED");
     else mgr->RegisterExtraFile("AliAOD.VertexingHF.root");
     taskvertexingHF->SelectCollisionCandidates(0);
-  }   
-  
+  }
+
   // PWG3 JPSI filtering (only pp)
   if (iPWG3JPSIfilter && (iCollision==0)) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG3/dielectron/macros/AddTaskJPSIFilter.C");
@@ -241,18 +241,18 @@ void AddAnalysisTasks(Int_t merge){
     if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "AliAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED");
     else mgr->RegisterExtraFile("AliAOD.Dielectron.root");
     taskJPSIfilter->SelectCollisionCandidates(0);
-  }   
-  
+  }
+
   // PWG3 D2h
-  if (iPWG3d2h) {   
+  if (iPWG3d2h) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/AddD2HTrain.C");
     TFile::Cp(gSystem->ExpandPathName(configPWG3d2h.Data()), "file:ConfigVertexingHF.C");
-    AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);                                 
+    AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);
   }
-  
+
   // ********** PWG4 wagons ******************************************************
   // Jet analysis
-  
+
   // Configurations flags, move up?
   TString kDeltaAODJetName = "AliAOD.Jets.root"; //
   Bool_t  kIsPbPb = (iCollision==0)?false:true; // can be more intlligent checking the name of the data set
@@ -263,7 +263,7 @@ void AddAnalysisTasks(Int_t merge){
   if (iJETAN) {
     gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJets.C");
     // Default jet reconstructor running on ESD's
-    AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction     
+    AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction
     if (!taskjets) ::Fatal("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED");
     if(kDeltaAODJetName.Length()>0) taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
     if (iJETANdelta) {
@@ -275,36 +275,36 @@ void AddAnalysisTasks(Int_t merge){
        taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction
        if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
-      // SICONE 
-      taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later....                                                                                  
+      // SICONE
+      taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later....
       if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       cTmp = taskjets->GetNonStdBranch();
       if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data());
-      
+
       // Add the clusters..
       gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetCluster.C");
       AliAnalysisTaskJetCluster *taskCl = 0;
       Float_t fCenUp = 0;
       Float_t fCenLo = 0;
       Float_t fTrackEtaWindow = 0.9;
-      taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip                                                                                 
+      taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip
       taskCl->SetBackgroundCalc(kTRUE);
       taskCl->SetNRandomCones(10);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       taskCl->SetGhostEtamax(fTrackEtaWindow);
       kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch());
-      
+
       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       taskCl->SetNRandomCones(10);
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
-      
+
       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
-      
+
       // DO THE BACKGROUND SUBTRACTION
       if(kIsPbPb&&kJetSubtractBranches.Length()){
        gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetBackgroundSubtract.C");
@@ -313,7 +313,7 @@ void AddAnalysisTasks(Int_t merge){
        taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
        if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
-    } 
+    }
   }
 }
 
@@ -322,9 +322,9 @@ Bool_t LoadCommonLibraries()
 {
   // Load common analysis libraries.
   if (!gSystem->Getenv("ALICE_ROOT")) {
-    ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot"); 
+    ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot");
     return kFALSE;
-  }   
+  }
   Bool_t success = kTRUE;
   // Load framework classes. Par option ignored here.
   success &= LoadLibrary("libSTEERBase.so");
@@ -340,9 +340,9 @@ Bool_t LoadCommonLibraries()
     ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries:    SUCCESS");
     ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s",
           gSystem->GetIncludePath());
-  } else {           
+  } else {
     ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries:    FAILED");
-  }   
+  }
   return success;
 }
 
@@ -353,12 +353,12 @@ Bool_t LoadAnalysisLibraries()
   if (useTender) {
     if (!LoadLibrary("TENDER") ||
        !LoadLibrary("TENDERSupplies")) return kFALSE;
-  }       
+  }
   if (iESDfilter || iPWG3MuonTrain) {
     if (!LoadLibrary("PWGmuon")) return kFALSE;
     //      if (!LoadLibrary("PWG3base")) return kFALSE;
     //      if (!LoadLibrary("PWG3muon")) return kFALSE;
-  }   
+  }
   if (iMUONRefit || iESDMCLabelAddition) {
     if (!LoadLibrary("PWGmuondep")) return kFALSE;
   }
@@ -376,17 +376,17 @@ Bool_t LoadAnalysisLibraries()
        !LoadLibrary("siscone") ||
        !LoadLibrary("SISConePlugin") ||
        !LoadLibrary("FASTJETAN")) return kFALSE;
-  }     
+  }
   // PWG3 Vertexing HF
   if (iPWG3vertexing || iPWG3d2h) {
     if (!LoadLibrary("PWG3base") ||
        !LoadLibrary("PWG3vertexingHF")) return kFALSE;
-  }   
+  }
   // PWG3 dielectron
   if (iPWG3JPSIfilter) {
     if (!LoadLibrary("PWG3dielectron")) return kFALSE;
-  }   
-  
+  }
+
   ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries", "Load other libraries:   SUCCESS");
   return kTRUE;
 }
@@ -400,7 +400,7 @@ Bool_t LoadLibrary(const char *module)
   if (!mod.Length()) {
     ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name");
     return kFALSE;
-  }   
+  }
   // If a library is specified, just load it
   if (mod.EndsWith(".so")) {
     mod.Remove(mod.Index(".so"));
@@ -410,16 +410,16 @@ Bool_t LoadLibrary(const char *module)
       return kFALSE;
     }
     return kTRUE;
-  } 
+  }
   // Check if the library is already loaded
-  if (strlen(gSystem->GetLibraries(module, "", kFALSE)) > 0) return kTRUE;    
+  if (strlen(gSystem->GetLibraries(module, "", kFALSE)) > 0) return kTRUE;
   result = gSystem->Load(Form("lib%s", module));
   if (result < 0) {
     ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load module %s", module);
     return kFALSE;
   }
   return kTRUE;
-}           
+}
 
 
 //______________________________________________________________________________
@@ -427,13 +427,13 @@ TChain *CreateChain()
 {
   // Create the input chain
   chain = new TChain("esdTree");
-  if (gSystem->AccessPathName("AliESDs.root")) 
+  if (gSystem->AccessPathName("AliESDs.root"))
     ::Error("AnalysisTrainNew.C::CreateChain", "File: AliESDs.root not in ./data dir");
-  else 
+  else
     chain->Add("AliESDs.root");
   if (chain->GetNtrees()) return chain;
   return NULL;
-}   
+}
 
 //______________________________________________________________________________
 void AODmerge()
@@ -442,7 +442,7 @@ void AODmerge()
   TStopwatch timer;
   timer.Start();
   TString outputDir = "wn.xml";
-  TString outputFiles = "AliAOD.root,AliAOD.Muons.root";
+  TString outputFiles = VAR_AOD_MERGE_FILES;
   TString mergeExcludes = "";
   TObjArray *list = outputFiles.Tokenize(",");
   TIter *iter = new TIter(list);
index 5a38e41e6f1aa92696bf5ab84aa6744b0fbe7fd4..03f68470b47a154b29d370c851a134143c733791 100644 (file)
@@ -1,4 +1,4 @@
-void sim(Int_t nev=100) 
+void sim(Int_t nev=VAR_EVENTS_PER_JOB)
 {
   if ( VAR_PURELY_LOCAL) {
     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1, AliMagF::k5kG));
diff --git a/PWG/muondep/AccEffTemplates/simrun.C b/PWG/muondep/AccEffTemplates/simrun.C
deleted file mode 100644 (file)
index 360ddc8..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// #define VERBOSEARGS
-// simrun.C
-{
-// set job and simulation variables as :
-// root.exe -b -q simrun.C  --run <x> --chunk <y> --event <n> 
-
-  int nrun = 0;
-  int nchunk = 0;
-  int nevent = 0;
-  int seed = 0;
-  Bool_t snapshot(kFALSE);
-  
-  char sseed[1024];
-  char srun[1024];
-  char schunk[1024];
-
-  sprintf(srun,"");
-  sprintf(schunk,"");
-
-  for (int i=0; i< gApplication->Argc();i++){
-#ifdef VERBOSEARGS
-    printf("Arg  %d:  %s\n",i,gApplication->Argv(i));
-#endif
-    if (!(strcmp(gApplication->Argv(i),"--run")))
-      nrun = atoi(gApplication->Argv(i+1));
-    sprintf(srun,"%d",nrun);
-
-    if (!(strcmp(gApplication->Argv(i),"--chunk")))
-      nchunk = atoi(gApplication->Argv(i+1));
-    sprintf(schunk,"%d",nchunk);
-
-    if (!(strcmp(gApplication->Argv(i),"--event")))
-      nevent = atoi(gApplication->Argv(i+1));
-
-    if (!(strcmp(gApplication->Argv(i),"--snapshot")))
-      snapshot = kTRUE;
-  }
-
-  seed = nrun * 10000 + nchunk;
-  sprintf(sseed,"%d",seed);
-
-  if (seed==0) {
-    fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-    fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
-    fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-  } else {
-    fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-    fprintf(stdout,"!!!  MC Seed is %d \n",seed);
-    fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-  }
-  
-// set the seed environment variable
-  gSystem->Setenv("CONFIG_SEED",sseed);
-  gSystem->Setenv("DC_RUN",srun); // used in AliSimulation.cxx
-  gSystem->Setenv("DC_EVENT",schunk); // Not used in Config.C (used for setting seed)
-  
-// Needed to produce simulated RAW data
-  gSystem->Setenv("ALIMDC_RAWDB1","./mdc1");
-  gSystem->Setenv("ALIMDC_RAWDB2","./mdc2");
-  gSystem->Setenv("ALIMDC_TAGDB","./mdc1/tag");
-  gSystem->Setenv("ALIMDC_RUNDB","./mdc1/meta");
-  cout<< "SIMRUN:: Run " << gSystem->Getenv("DC_RUN")
-          << " Chunk " << gSystem->Getenv("DC_EVENT")
-         << endl;
-
-  cout<<">>>>> SIMULATION <<<<<"<<endl;
-  if ( snapshot )
-  {
-    gSystem->Setenv("OCDB_SNAPSHOT_CREATE","kTRUE");
-    gSystem->Setenv("OCDB_SNAPSHOT_FILENAME","OCDB_sim.root");
-  }
-  
-  gSystem->Exec(Form("aliroot -b -q sim.C\\(%d\\) > sim.log 2>&1",nevent));
-  gSystem->Exec("mv syswatch.log simwatch.log");
-
-  if ( snapshot )
-  {
-    gSystem->Setenv("OCDB_SNAPSHOT_FILENAME","OCDB_rec.root");
-  }
-  
-  cout<<">>>>> RECONSTRUCTION <<<<<"<<endl;
-  
-  gSystem->Exec("aliroot -b -q rec.C > rec.log 2>&1");
-  
-  gSystem->Exec("mv syswatch.log recwatch.log");
-
-  if ( snapshot )
-  {
-    gSystem->Exec(Form("mkdir -p OCDB/%s",srun));
-    gSystem->Exec(Form("mv OCDB_*.root OCDB/%s/",srun));
-  }
-  else
-  {
-    //  cout<<">>>>> TAG <<<<<"<<endl;
-    //  gSystem->Exec("aliroot -b -q tag.C > tag.log 2>&1");
-  
-    cout<<">>>>> CHECK ESD <<<<<"<<endl;
-    gSystem->Exec("aliroot -b -q CheckESD.C > checkesd.log 2>&1");
-    cout<<">>>>> MAKE AOD <<<<<"<<endl;
-    gSystem->Exec("aliroot -b -q AODtrain.C > aod.log 2>&1");
-    cout<<">>>>> CHECK AOD <<<<<"<<endl;
-    gSystem->Exec("aliroot -b -q CheckAOD.C > checkaod.log 2>&1");
-  }
-  
-  return 0;
-}
diff --git a/PWG/muondep/AccEffTemplates/simrun.sh b/PWG/muondep/AccEffTemplates/simrun.sh
new file mode 100644 (file)
index 0000000..b547b09
--- /dev/null
@@ -0,0 +1,190 @@
+#!/bin/bash
+
+# set job and simulation variables as :
+# ./simrun.sh  --run <x> --event <y> --process <kPythia6/kPhojet/kPythia6ATLAS_Flat/kPythia6D6T> --field <kNoField/k5kG> --energy <900/2360/10000>
+
+function runcommand(){
+    echo -e "\n"
+    echo -e "\n" >&2
+
+    echo "* $1 : $2"
+    echo "* $1 : $2" >&2
+
+    time aliroot -b -q -x $2 >>$3 2>&1
+    exitcode=$?
+
+    expectedCode=${5-0}
+
+    if [ "$exitcode" -ne "$expectedCode" ]; then
+        echo "*! $2 failed with exitcode $exitcode, expecting $expectedCode"
+        echo "*! $2 failed with exitcode $exitcode, expecting $expectedCode" >&2
+        echo "$2 failed with exitcode $exitcode, expecting $expectedCode" > validation_error.message
+        exit ${4-$exitcode}
+    else
+        echo "* $2 finished with the expected exit code ($expectedCode), moving on"
+        echo "* $2 finished with the expected exit code ($expectedCode), moving on" >&2
+    fi
+}
+
+# Define the pt hard bin arrays
+pthardbin_loweredges=( 0 5 11 21 36 57 84 117 152 191 234 )
+pthardbin_higheredges=( 5 11 21 36 57 84 117 152 191 234 -1)
+
+CONFIG_SEED=""
+CONFIG_RUN_TYPE=""
+CONFIG_FIELD=""
+CONFIG_ENERGY=""
+CONFIG_PHYSICSLIST=""
+CONFIG_BMIN=""
+CONFIG_BMAX=""
+CONFIG_PTHARDBIN=""
+CONFIG_PTHARDMIN=""
+CONFIG_PTHARDMAX=""
+CONFIG_QUENCHING=""
+DC_RUN=""
+DC_EVENT=""
+EVENTS_PER_JOB=""
+
+RUNMODE=""
+
+while [ ! -z "$1" ]; do
+    option="$1"
+    shift
+
+    if [ "$option" = "--run" ]; then
+            DC_RUN="$1"
+            shift
+    elif [ "$option" = "--event" ]; then
+            DC_EVENT="$1"
+            shift
+    elif [ "$option" = "--process" ]; then
+            CONFIG_RUN_TYPE="$1"
+            shift
+    elif [ "$option" = "--field" ]; then
+            CONFIG_FIELD="$1"
+            shift
+    elif [ "$option" = "--energy" ]; then
+            CONFIG_ENERGY="$1"
+            shift
+    elif [ "$option" = "--physicslist" ]; then
+            CONFIG_PHYSICSLIST="$1"
+            shift
+    elif [ "$option" = "--bmin" ]; then
+            CONFIG_BMIN="$1"
+            shift
+    elif [ "$option" = "--bmax" ]; then
+            CONFIG_BMAX="$1"
+            shift
+    elif [ "$option" = "--pthardbin" ]; then
+            CONFIG_PTHARDBIN="$1"
+            shift
+    elif [ "$option" = "--quench" ]; then
+            CONFIG_QUENCHING="$1"
+            shift
+    elif [ "$option" = "--sdd" ]; then
+            RUNMODE="SDD"
+    elif [ "$option" = "--eventsPerJob" ]; then
+            EVENTS_PER_JOB="$1"
+            shift
+    fi
+done
+
+CONFIG_SEED=$((ALIEN_PROC_ID%1000000000))
+
+if [ "$CONFIG_SEED" -eq 0 ]; then
+    CONFIG_SEED=$(((DC_RUN*100000+DC_EVENT)%1000000000))
+    echo "* MC Seed is $CONFIG_SEED (based on run / counter : $DC_RUN / $DC_EVENT)"
+else
+    echo "* MC Seed is $CONFIG_SEED (based on AliEn job ID)"
+fi
+
+if [ "$CONFIG_SEED" -eq 0 ]; then
+    echo "*!  WARNING! Seeding variable for MC is 0 !" >&2
+fi
+
+echo "* b min is $CONFIG_BMIN"
+echo "* b max is $CONFIG_BMAX"
+echo "* pt hard bin is $CONFIG_PTHARDBIN"
+
+if [ ! -z "$CONFIG_PTHARDBIN" ]; then
+    # Define environmental vars for pt binning
+    CONFIG_PTHARDMIN=${pthardbin_loweredges[$CONFIG_PTHARDBIN]}
+    CONFIG_PTHARDMAX=${pthardbin_higheredges[$CONFIG_PTHARDBIN]}
+
+    echo "* pt hard from $CONFIG_PTHARDMIN to $CONFIG_PTHARDMAX"
+fi
+
+mkdir input
+mv galice.root ./input/galice.root
+mv Kinematics.root ./input/Kinematics.root
+ls input
+
+export CONFIG_SEED CONFIG_RUN_TYPE CONFIG_FIELD CONFIG_ENERGY CONFIG_PHYSICSLIST CONFIG_BMIN CONFIG_BMAX CONFIG_PTHARDBIN CONFIG_PTHARDMIN CONFIG_PTHARDMAX DC_RUN DC_EVENT
+
+export ALIMDC_RAWDB1="./mdc1"
+export ALIMDC_RAWDB2="./mdc2"
+export ALIMDC_TAGDB="./mdc1/tag"
+export ALIMDC_RUNDB="./mdc1/meta"
+
+if [ -f "$G4INSTALL/bin/geant4.sh" ]; then
+    echo "* Sourcing G4 environment from $G4INSTALL/bin/geant4.sh"
+    source $G4INSTALL/bin/geant4.sh
+fi
+
+echo "SIMRUN:: Run $DC_RUN Event $DC_EVENT Generator $CONFIG_RUN_TYPE Field $CONFIG_FIELD Energy $CONFIG_ENERGY Physicslist $CONFIG_PHYSICSLIST"
+
+simCommand="sim.C"
+if [ ! -z $EVENTS_PER_JOB ]; then
+  simCommand="sim.C($EVENTS_PER_JOB)"
+fi
+
+runcommand "SIMULATION" "$simCommand" sim.log 5
+mv syswatch.log simwatch.log
+
+runcommand "RECONSTRUCTION" "rec.C" rec.log 10
+mv syswatch.log recwatch.log
+
+runcommand "TAG" "tag.C" tag.log 50
+
+runcommand "CHECK ESD" "CheckESD.C" check.log 60 1
+
+rm -f *.RecPoints.root
+
+if [ "$RUNMODE" = "SDD" ]; then
+    if [ -f QAtrainsim_SDD.C ]; then
+            runcommand "Running the QA train" "QAtrainsim_SDD.C(\"_wSDD\",$DC_RUN)" qa.log 100
+
+            for file in *.stat; do
+                mv $file ../$file.qa_wSDD
+            done
+    fi
+
+    mv AliESDs.root AliESDs_wSDD.root
+    mv AliESDfriends.root AliESDfriends_wSDD.root
+
+    # Without SDD
+
+    for logfile in rec.log qa.log tag.log check.log recwatch.log; do
+            echo -e "\n\n* ------------ Without SDD ------------" >> $logfile
+    done
+
+    runcommand "RECONSTRUCTION without SDD" "recNoSDD.C" rec.log 11
+    cat syswatch.log >> recwatch.log
+    rm syswatch.log
+
+    runcommand "TAG without SDD" "tag.C" tag.log 51
+
+    runcommand "CHECK ESD without SDD" "CheckESD.C" check.log 61 1
+
+    if [ -f QAtrainsim_SDD.C ]; then
+            runcommand "Running the QA train without SDD" "QAtrainsim_SDD.C(\"\",$DC_RUN)" qa.log 101
+
+            for file in *.stat; do
+                mv $file ../$file.qa
+            done
+    fi
+fi
+
+rm -f *.RecPoints.root *.Hits.root *.Digits.root *.SDigits.root
+
+exit 0
diff --git a/PWG/muondep/AccEffTemplates/validation.sh b/PWG/muondep/AccEffTemplates/validation.sh
deleted file mode 100644 (file)
index 39f40b0..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-##################################################
-validateout=`dirname $0`
-validatetime=`date`
-validated="0";
-error=1
-if [ -z $validateout ]
-then
-    validateout="."
-fi
-
-cd $validateout;
-validateworkdir=`pwd`;
-
-echo "*******************************************************" >> stdout;
-echo "* AliRoot Validation Script V1.0                      *" >> stdout;
-echo "* Time:    $validatetime " >> stdout;
-echo "* Dir:     $validateout" >> stdout;
-echo "* Workdir: $validateworkdir" >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-echo "* Library path: $LD_LIBRARY_PATH" >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-echo "* Path: $PATH" >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-ls -la ./ >> stdout;
-echo "* ----------------------------------------------------*" >> stdout;
-
-##################################################
-#if [ -f rec.log ] && [ -f sim.log ] && [ -f check.log ] && [ -f tag.log ] && [ -f aod.log ] && [ -f *ESD.tag.root ]
-#if [ -f rec.log ] && [ -f sim.log ] && [ -f check.log ] && [ -f tag.log ] && [ -f aod.log ] && [ -f *ESD.tag.root ] && [ -f AnalysisResults.root ]
-if [ -f rec.log ] && [ -f sim.log ] && [ -f checkesd.log ] && [ -f checkaod.log ] && [ -f aod.log ]
-then
-sv=`grep -i  "Segmentation violation" *.log`
-if [ "$sv" = "" ]
-    then
-    sf=`grep -i  "Segmentation fault" *.log`
-    if [ "$sf" = "" ]
-        then
-        be=`grep -i  "Bus error" *.log`
-        if [ "$be" = "" ]
-            then
-            ab=`grep -i -w "Abort" *.log`
-            if [ "$ab" = "" ]
-                then
-                fp=`grep -i  "Floating point exception" *.log`
-                if [ "$fp" = "" ]
-                    then
-                    kl=`grep -i  "Killed" *.log`
-                    if [ "$kl" = "" ]
-                        then
-                        bf=`grep -i "busy flag cleared" *.log`
-                        if [ "$bf" = "" ]
-                            then
-                            ch=`grep -i "check of ESD was successfull" checkesd.log`
-                            if [ "$ch" = "" ]
-                            then
-                                echo "* #  The ESD was not successfully checked   *"  >>stdout;
-                            else
-                                ao=`grep -i "check of AOD was successfull" checkaod.log`
-                                if [ "$ao" = "" ]
-                                then
-                                    echo "* #  The AOD was not successfully checked   *"  >>stdout;
-                                else
-                                    echo "* ----------------   Job Validated  ------------------*" >> stdout;
-                                    echo "Removing log files which will not be needed then" >> stdout;
-                                    rm -f *.log
-                                    touch ok.log
-                                    error="0";
-                               fi
-                            fi
-                        fi
-                    fi
-                fi
-            fi
-        fi
-    fi
-fi
-else
-    echo "* ########## Job not validated - no rec.log or sim.log or checkaod.log or checkesd.log ###" >> stdout;
-    echo "* ########## Removing all ROOT files from the local directory, leaving only the logs ###" >> stdout;
-    rm -rf *.root
-fi
-if [ "$error" = "1" ]
-    then
-    echo "* ################   Job not validated ################" >> stdout;
-fi
-echo "* ----------------------------------------------------*" >> stdout;
-echo "*******************************************************" >> stdout;
-sleep 15;
-cd -
-exit $error
-
index 6ec70ad0c62a3135e0223e797dfd314761acd598..ed94d7bd55328a5ad592e3792fb47763a9eeb769 100644 (file)
@@ -461,7 +461,6 @@ Double_t AliAnalysisMuMuResult::GetErrorStat(const char* name, const char* subRe
       return TMath::Limits<Double_t>::Max();
     }
   }
-  return TMath::Limits<Double_t>::Max();
 }
 
 //_____________________________________________________________________________
index ab391e8a5f7ffd33f6f75095f97c283521155982..c262a37f71a5d94c34977cba89a8ce7800b20f22 100644 (file)
@@ -148,6 +148,7 @@ fUseAODMerging(kFALSE)
   SetLocalDirectory("Snapshot",LocalDir());
   
   SetVar("VAR_OCDB_PATH",Form("\"%s\"",ocdbPath.Data()));
+  SetVar("VAR_AOD_MERGE_FILES","\"AliAOD.root,AliAOD.Muons.root\"");
 
   SetVar("VAR_GENPARAM_INCLUDE","AliGenMUONlib.h");
   SetVar("VAR_GENPARAM_NPART","1");
@@ -284,6 +285,8 @@ fUseAODMerging(kFALSE)
     SetVar("VAR_TRIGGER_CONFIGURATION","p-p");
   }
 
+  SetVar("VAR_EVENTS_PER_JOB",Form("%i",fMaxEventsPerChunk));
+
   SetGenerator(generator);
   
   if (localOnly)
@@ -297,13 +300,13 @@ fUseAODMerging(kFALSE)
   
   AddToTemplateFileList("CheckESD.C");
   AddToTemplateFileList("CheckAOD.C");
-  AddToTemplateFileList("AODtrain.C");
-  AddToTemplateFileList("validation.sh");
+  AddToTemplateFileList("AODtrainsim.C");
+//  AddToTemplateFileList("validation.sh");
   
   AddToTemplateFileList("Config.C");
   AddToTemplateFileList("rec.C");
   AddToTemplateFileList("sim.C");
-  AddToTemplateFileList("simrun.C");
+  AddToTemplateFileList("simrun.sh");
   AddToTemplateFileList(RunJDLName().Data());
   
   UseExternalConfig(fExternalConfig);
@@ -384,7 +387,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateMergeJDL(const char* name) const
   
   if ( !final )
   {
-    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrain.C",RemoteDir().Data()));
+    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrainsim.C",RemoteDir().Data()));
     OutputToJDL(*os,"OutputDir",Form("%s/$1/Stage_$2/#alien_counter_03i#",RemoteDir().Data()));
     OutputToJDL(*os,"InputDataCollection",Form("%s/$1/Stage_$2.xml,nodownload",RemoteDir().Data()));
     OutputToJDL(*os,"split","se");
@@ -394,7 +397,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateMergeJDL(const char* name) const
   }
   else
   {
-    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrain.C",RemoteDir().Data()),
+    OutputToJDL(*os,"InputFile",Form("LF:%s/AODtrainsim.C",RemoteDir().Data()),
            Form("LF:%s/$1/wn.xml",RemoteDir().Data()));
     OutputToJDL(*os,"OutputDir",Form("%s/$1",RemoteDir().Data()));
   }
@@ -425,7 +428,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateRunJDL(const char* name) const
               
   OutputToJDL(*os,"Jobtag","comment: AliMuonAccEffSubmitter RUN $1");
 
-  OutputToJDL(*os,"split","production:1-$2");
+  OutputToJDL(*os,"split","production:$2-$3");
 
   OutputToJDL(*os,"Price","1");
   
@@ -440,7 +443,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateRunJDL(const char* name) const
   
   while ( ( file = static_cast<TObjString*>(next())) )
   {
-    if ( !file->String().Contains(".jdl",TString::kIgnoreCase) ||
+    if ( !file->String().Contains("jdl",TString::kIgnoreCase) &&
          !file->String().Contains("OCDB_") )
     {
       files.Add(new TObjString(Form("LF:%s/%s",RemoteDir().Data(),file->String().Data())));
@@ -465,7 +468,7 @@ Bool_t AliMuonAccEffSubmitter::GenerateRunJDL(const char* name) const
   {
     // keep only muon AODs and QA
     OutputToJDL(*os,"OutputArchive",  "log_archive.zip:stderr,stdout,*.log@disk=1",
-           "root_archive.zip:galice*.root,AliAOD.Muons.root,Merged.QA.Data.root@disk=2");
+           "root_archive.zip:AliAOD.Muons.root,Merged.QA.Data.root@disk=2");
   }
   else if ( CompactMode() == 2 )
   {
@@ -480,13 +483,13 @@ Bool_t AliMuonAccEffSubmitter::GenerateRunJDL(const char* name) const
     return kFALSE;
   }
   
-  OutputToJDL(*os,"splitarguments","simrun.C --run $1 --chunk #alien_counter# --event $3");
+  OutputToJDL(*os,"splitarguments","--run $1 --event #alien_counter# --eventsPerJob $4");
   
   OutputToJDL(*os,"Workdirectorysize","5000MB");
   
   OutputToJDL(*os,"JDLVariables","Packages","OutputDir");
 
-  OutputToJDL(*os,"Validationcommand",Form("%s/validation.sh",RemoteDir().Data()));
+  OutputToJDL(*os,"Validationcommand","/alice/validation/validation.sh");
 
   if ( GetVar("VAR_GENERATOR").Contains("pythia",TString::kIgnoreCase) )
   {
@@ -533,7 +536,7 @@ Bool_t AliMuonAccEffSubmitter::MakeOCDBSnapshots()
     }
     else
     {
-      gSystem->Exec(Form("aliroot -b -q -x simrun.C --run %d --snapshot",runNumber));
+      gSystem->Exec(Form("simrun.sh --run %d --snapshot",runNumber));
     
       if ( gSystem->AccessPathName(ocdbSim.Data()) )
       {
@@ -757,6 +760,8 @@ Bool_t AliMuonAccEffSubmitter::Run(const char* mode)
   
   if (!IsValid()) return kFALSE;
   
+  if ( fCompactMode == 1 ) SetVar("VAR_AOD_MERGE_FILES","\"AliAOD.Muons.root\"");
+
   TString smode(mode);
   smode.ToUpper();
   
@@ -942,26 +947,30 @@ Int_t AliMuonAccEffSubmitter::LocalTest()
     return 0;
   }
   
-  std::cout << "Generating script to execute : ./simrun.sh" << std::endl;
-  
-  std::ofstream out("simrun.sh");
-  
-  out << "#!/bin/bash" << std::endl;
-//  root.exe -b -q simrun.C  --run <x> --chunk <y> --event <n>
-  out << "root.exe -b -q simrun.C --run "<< runs[0] <<" --event " << fFixedNofEvents << std::endl;
-
-  out.close();
+//  std::cout << "Generating script to execute : ./simrun.sh" << std::endl;
+//
+//  std::ofstream out("simrun.sh");
+//
+//  out << "#!/bin/bash" << std::endl;
+////  root.exe -b -q simrun.C  --run <x> --chunk <y> --event <n>
+//  out << "root.exe -b -q simrun.C --run "<< runs[0] <<" --event " << fFixedNofEvents << std::endl;
+//
+//  out.close();
 
   gSystem->Exec("chmod +x simrun.sh");
+  gSystem->Exec("alien_cp alien:///alice/bin/aliroot_new file:");
+  gSystem->Exec("chmod u+x aliroot_new");
 
   std::cout << "Cleaning up left-over files from previous simulation/reconstructions" << std::endl;
-  
+
   gSystem->Exec("rm -rf TrackRefs.root *.SDigits*.root Kinematics.root *.Hits.root geometry.root gphysi.dat Run*.tag.root HLT*.root *.ps *.Digits.root *.RecPoints.root galice.root *QA*.root Trigger.root *.log AliESD* AliAOD* *.d *.so *.stat");
 
-  std::cout << "Executing the script : ./simrun.sh" << std::endl;
+  TString command = Form("./aliroot_new --run %i --event 1 --eventsPerJob %i", runs[0], fFixedNofEvents);
+
+  std::cout << "Executing the script : " << command.Data() << std::endl;
 
 
-  gSystem->Exec("./simrun.sh");
+  gSystem->Exec(command.Data());
   
   return 1;
 }
@@ -1113,7 +1122,7 @@ Int_t AliMuonAccEffSubmitter::Submit(Bool_t dryRun)
   //  cout << "number of generated events per MB event = " << ratio << endl;
   //  cout << endl;
   
-  std::cout << "run\tchunks\tevents" << std::endl;
+  std::cout << "run\tfirstChunk\tlastChunk\teventsPerJob" << std::endl;
   std::cout << "----------------------" << std::endl;
   
   Int_t nJobs(0);
@@ -1158,9 +1167,9 @@ Int_t AliMuonAccEffSubmitter::Submit(Bool_t dryRun)
     
     nEvts += nChunk*nEvtChunk;
     
-    std::cout << runNumber << "\t" << nChunk << "\t" << nEvtChunk << std::endl;
+    std::cout << runNumber << "\t1\t" << nChunk << "\t" << nEvtChunk << std::endl;
     
-    TString query(Form("submit %s %d %d %d", RunJDLName().Data(), runNumber, nChunk, nEvtChunk));
+    TString query(Form("submit %s %d %d %d", RunJDLName().Data(), runNumber, nChunk, nEvtChunk));
     
     std::cout << query.Data() << " ..." << std::flush;
     
index ef8df26e4f7133d783c042c84dac9381a5502c4f..1472879e3507f877a3bbdb991049ec039f0108af 100644 (file)
@@ -38,7 +38,7 @@ public:
   
   Int_t LocalTest();
   
-  TString RunJDLName() const { return "run.jdl"; }
+  TString RunJDLName() const { return "JDL"; }
 
   TString MergeJDLName(Bool_t final) const { return (final ? "AOD_merge_final.jdl" : "AOD_merge.jdl"); }
 
@@ -61,7 +61,7 @@ public:
   Bool_t SetGenerator(const char* generator);
 
   Int_t MaxEventsPerChunk() const { return fMaxEventsPerChunk; }
-  void SetMaxEventsPerChunk(Int_t n) { fMaxEventsPerChunk = n; }
+  void SetMaxEventsPerChunk(Int_t n) { fMaxEventsPerChunk = n; SetVar("VAR_EVENTS_PER_JOB", Form("%i",n)); }
 
   TString OCDBPath() const { return GetMapValue("OCDBPath"); }
   
index b84fd6a1fdfc6487c17acf88afe8816f2e4563db..cd5756fbf8cf1699cc959ee292ddb770e8122eba 100644 (file)
@@ -369,7 +369,7 @@ Bool_t AliMuonGridSubmitter::CopyTemplateFilesToLocal()
       if ( c )
       {
         Bool_t ok(kFALSE);
-        if ( stemplate.Contains(".jdl",TString::kIgnoreCase) )
+        if ( stemplate.EndsWith("jdl",TString::kIgnoreCase) )
         {
           ok = Generate(file->String().Data());
         }
index 0a77eec256c6a8ed74f5244b3795b640cfc80127..19bfdc1b68625ce297d54f29f7bba324ef9ce8e6 100644 (file)
@@ -92,3 +92,4 @@ install(FILES ${HDRS} DESTINATION include)
 
 # Installing the macros
 install(DIRECTORY . DESTINATION PWG/muondep FILES_MATCHING PATTERN "*.C")
+install(DIRECTORY . DESTINATION PWG/muondep FILES_MATCHING PATTERN "*.sh")
index c7e06cbd203e835e6e8416c81d9283f2ee4419df..08b51714bfc3387391fd4ffa9455191edcee372f 100644 (file)
@@ -245,7 +245,10 @@ void AliAnalysisTaskCFTree::UserExec(Option_t *){
     fMuons->Clear();
     for (Int_t iTrack = 0; iTrack < aod->GetNumberOfTracks(); iTrack++) {
       AliAODTrack* track = dynamic_cast<AliAODTrack*>(aod->GetTrack(iTrack));
-      if(!track) AliFatal("Not a standard AOD");
+      if(!track) {
+        AliWarning("Not a standard AOD");
+        continue;
+      }
       if (!track->IsMuonTrack()) continue;
       Float_t pt     = track->Pt();
       Float_t eta    = track->Eta();
@@ -279,6 +282,7 @@ void AliAnalysisTaskCFTree::UserExec(Option_t *){
       label = mcpart->GetMother();
       while (!isPrimary && label>=0) {
         mcpart = (AliVParticle*) fMCEvent->GetTrack(label);
+        if (!mcpart) continue;
         label = mcpart->GetMother();
         isPrimary = fMCEvent->IsPhysicalPrimary(label);
       }
index 6d784152380fe280c0409a82ff0f1753cbb206fd..a95af53333da9de2458295ac3eedc96143254dcc 100644 (file)
@@ -45,84 +45,84 @@ ClassImp(AliAnalysisTaskDiJetCorrelations)
 
 //_____________________| Constructor
 AliAnalysisTaskDiJetCorrelations::AliAnalysisTaskDiJetCorrelations():
-  AliAnalysisTaskSE(),
-  fSetSystemValue(kTRUE),
-  fRecoOrMontecarlo(kTRUE),
-  fReadMC(kFALSE),
-  fSetFilterBit(kTRUE),
-  fbit(272),
-  farrayMC(0),
-  fCentrOrMult(1),
-  fMinCentrality(0),
-  fMaxCentrality(100),
-  fTrigger1pTLowThr(0),
-  fTrigger1pTHighThr(0),
-  fTrigger2pTLowThr(0),
-  fTrigger2pTHighThr(0),
-  fCutResonances(kTRUE),
-  fCutConversions(kTRUE),
-  ftwoTrackEfficiencyCut(kTRUE),
-  fuseVarCentBins(kFALSE),
-  fuseVarPtBins(kFALSE),
-  fHistNEvents(0),
-  fHistT1CorrTrack(0),
-  fHistT2CorrTrack(0),
-  fOutputQA(0),
-  fOutputCorr(0),
-  f3DEffCor(0),
-  fPool(0x0),
-  fPoolMgr(0x0),
-  fMixedEvent(kTRUE),
-  fMEMaxPoolEvent(1000),
-  fMEMinTracks(20000),
-  fMEMinEventToMix(6),
-  fHistTrigDPhi(0x0),
-  fControlConvResT1(0x0),
-  fControlConvResT2(0x0),
-  fControlConvResMT1(0x0),
-  fControlConvResMT2(0x0)
+AliAnalysisTaskSE(),
+fSetSystemValue(kTRUE),
+fRecoOrMontecarlo(kTRUE),
+fReadMC(kFALSE),
+fSetFilterBit(kTRUE),
+fbit(272),
+farrayMC(0),
+fCentrOrMult(1),
+fMinCentrality(0),
+fMaxCentrality(100),
+fTrigger1pTLowThr(0),
+fTrigger1pTHighThr(0),
+fTrigger2pTLowThr(0),
+fTrigger2pTHighThr(0),
+fCutResonances(kTRUE),
+fCutConversions(kTRUE),
+ftwoTrackEfficiencyCut(kTRUE),
+fuseVarCentBins(kFALSE),
+fuseVarPtBins(kFALSE),
+fHistNEvents(0),
+fHistT1CorrTrack(0),
+fHistT2CorrTrack(0),
+fOutputQA(0),
+fOutputCorr(0),
+f3DEffCor(0),
+fPool(0x0),
+fPoolMgr(0x0),
+fMixedEvent(kTRUE),
+fMEMaxPoolEvent(1000),
+fMEMinTracks(20000),
+fMEMinEventToMix(6),
+fHistTrigDPhi(0x0),
+fControlConvResT1(0x0),
+fControlConvResT2(0x0),
+fControlConvResMT1(0x0),
+fControlConvResMT2(0x0)
 {
   for ( Int_t i = 0; i < 9; i++)fHistQA[i] = NULL;
 }
 
 //_____________________| Specific Constructor
 AliAnalysisTaskDiJetCorrelations::AliAnalysisTaskDiJetCorrelations(const char *name):
-  AliAnalysisTaskSE(name),
-  fSetSystemValue(kTRUE),
-  fRecoOrMontecarlo(kTRUE),
-  fReadMC(kFALSE),
-  fSetFilterBit(kTRUE),
-  fbit(272),
-  farrayMC(0),
-  fCentrOrMult(1),
-  fMinCentrality(0),
-  fMaxCentrality(100),
-  fTrigger1pTLowThr(0),
-  fTrigger1pTHighThr(0),
-  fTrigger2pTLowThr(0),
-  fTrigger2pTHighThr(0),
-  fCutResonances(kTRUE),
-  fCutConversions(kTRUE),
-  ftwoTrackEfficiencyCut(kTRUE),
-  fuseVarCentBins(kFALSE),
-  fuseVarPtBins(kFALSE),
-  fHistNEvents(0),
-  fHistT1CorrTrack(0),
-  fHistT2CorrTrack(0),
-  fOutputQA(0),
-  fOutputCorr(0),
-  f3DEffCor(0),
-  fPool(0x0),
-  fPoolMgr(0x0),
-  fMixedEvent(kTRUE),
-  fMEMaxPoolEvent(1000),
-  fMEMinTracks(2000),
-  fMEMinEventToMix(6),
-  fHistTrigDPhi(0x0),
-  fControlConvResT1(0x0),
-  fControlConvResT2(0x0),
-  fControlConvResMT1(0x0),
-  fControlConvResMT2(0x0)
+      AliAnalysisTaskSE(name),
+      fSetSystemValue(kTRUE),
+      fRecoOrMontecarlo(kTRUE),
+      fReadMC(kFALSE),
+      fSetFilterBit(kTRUE),
+      fbit(272),
+      farrayMC(0),
+      fCentrOrMult(1),
+      fMinCentrality(0),
+      fMaxCentrality(100),
+      fTrigger1pTLowThr(0),
+      fTrigger1pTHighThr(0),
+      fTrigger2pTLowThr(0),
+      fTrigger2pTHighThr(0),
+      fCutResonances(kTRUE),
+      fCutConversions(kTRUE),
+      ftwoTrackEfficiencyCut(kTRUE),
+      fuseVarCentBins(kFALSE),
+      fuseVarPtBins(kFALSE),
+      fHistNEvents(0),
+      fHistT1CorrTrack(0),
+      fHistT2CorrTrack(0),
+      fOutputQA(0),
+      fOutputCorr(0),
+      f3DEffCor(0),
+      fPool(0x0),
+      fPoolMgr(0x0),
+      fMixedEvent(kTRUE),
+      fMEMaxPoolEvent(1000),
+      fMEMinTracks(2000),
+      fMEMinEventToMix(6),
+      fHistTrigDPhi(0x0),
+      fControlConvResT1(0x0),
+      fControlConvResT2(0x0),
+      fControlConvResMT1(0x0),
+      fControlConvResMT2(0x0)
 {
   Info("AliAnalysisTaskDiJetCorrelations","Calling Constructor");
   for ( Int_t i = 0; i < 9; i++)fHistQA[i] = NULL;
@@ -133,44 +133,44 @@ AliAnalysisTaskDiJetCorrelations::AliAnalysisTaskDiJetCorrelations(const char *n
 
 //___________________________________| Copy Constructor
 AliAnalysisTaskDiJetCorrelations::AliAnalysisTaskDiJetCorrelations(const AliAnalysisTaskDiJetCorrelations &source):
-  AliAnalysisTaskSE(source),
-  fSetSystemValue(source.fSetSystemValue),
-  fRecoOrMontecarlo(source.fSetSystemValue),
-  fReadMC(source.fReadMC),
-  fSetFilterBit(source.fSetFilterBit),
-  fbit(source.fbit),
-  farrayMC(source.farrayMC),
-  fCentrOrMult(source.fCentrOrMult),
-  fMinCentrality(source.fMinCentrality),
-  fMaxCentrality(source.fMaxCentrality),
-  fTrigger1pTLowThr(source.fTrigger1pTLowThr),
-  fTrigger1pTHighThr(source.fTrigger1pTHighThr),
-  fTrigger2pTLowThr(source.fTrigger2pTLowThr),
-  fTrigger2pTHighThr(source.fTrigger2pTHighThr),
-  fCutResonances(source.fCutResonances),
-  fCutConversions(source.fCutConversions),
-  ftwoTrackEfficiencyCut(source.ftwoTrackEfficiencyCut),
-  fuseVarCentBins(source.fuseVarCentBins),
-  fuseVarPtBins(source.fuseVarPtBins),
-  fHistNEvents(source.fHistNEvents),
-  fHistT1CorrTrack(source.fHistT1CorrTrack),
-  fHistT2CorrTrack(source.fHistT2CorrTrack),
-  fOutputQA(source.fOutputQA),
-  fOutputCorr(source.fOutputCorr),
-  f3DEffCor(source.f3DEffCor),
-  fPool(source.fPool),
-  fPoolMgr(source.fPoolMgr),
-  fMixedEvent(source.fMixedEvent),
-  fMEMaxPoolEvent(source.fMEMaxPoolEvent),
-  fMEMinTracks(source.fMEMinTracks),
-  fMEMinEventToMix(source.fMEMinEventToMix),
-  fHistTrigDPhi(source.fHistTrigDPhi),
-  fControlConvResT1(source.fControlConvResT1),
-  fControlConvResT2(source.fControlConvResT2),
-  fControlConvResMT1(source.fControlConvResMT1),
-  fControlConvResMT2(source.fControlConvResMT2)
+      AliAnalysisTaskSE(source),
+      fSetSystemValue(source.fSetSystemValue),
+      fRecoOrMontecarlo(source.fSetSystemValue),
+      fReadMC(source.fReadMC),
+      fSetFilterBit(source.fSetFilterBit),
+      fbit(source.fbit),
+      farrayMC(source.farrayMC),
+      fCentrOrMult(source.fCentrOrMult),
+      fMinCentrality(source.fMinCentrality),
+      fMaxCentrality(source.fMaxCentrality),
+      fTrigger1pTLowThr(source.fTrigger1pTLowThr),
+      fTrigger1pTHighThr(source.fTrigger1pTHighThr),
+      fTrigger2pTLowThr(source.fTrigger2pTLowThr),
+      fTrigger2pTHighThr(source.fTrigger2pTHighThr),
+      fCutResonances(source.fCutResonances),
+      fCutConversions(source.fCutConversions),
+      ftwoTrackEfficiencyCut(source.ftwoTrackEfficiencyCut),
+      fuseVarCentBins(source.fuseVarCentBins),
+      fuseVarPtBins(source.fuseVarPtBins),
+      fHistNEvents(source.fHistNEvents),
+      fHistT1CorrTrack(source.fHistT1CorrTrack),
+      fHistT2CorrTrack(source.fHistT2CorrTrack),
+      fOutputQA(source.fOutputQA),
+      fOutputCorr(source.fOutputCorr),
+      f3DEffCor(source.f3DEffCor),
+      fPool(source.fPool),
+      fPoolMgr(source.fPoolMgr),
+      fMixedEvent(source.fMixedEvent),
+      fMEMaxPoolEvent(source.fMEMaxPoolEvent),
+      fMEMinTracks(source.fMEMinTracks),
+      fMEMinEventToMix(source.fMEMinEventToMix),
+      fHistTrigDPhi(source.fHistTrigDPhi),
+      fControlConvResT1(source.fControlConvResT1),
+      fControlConvResT2(source.fControlConvResT2),
+      fControlConvResMT1(source.fControlConvResMT1),
+      fControlConvResMT2(source.fControlConvResMT2)
 {
-  
+  for ( Int_t i = 0; i < 9; i++)fHistQA[i] = NULL;
 }
 
 //_____________________| Destructor
@@ -226,7 +226,7 @@ void AliAnalysisTaskDiJetCorrelations::UserCreateOutputObjects()
   fOutputQA = new TList();
   fOutputQA->SetOwner();
   fOutputQA->SetName("BasicQAHistograms");
-  
+
   fOutputCorr = new TList();
   fOutputCorr->SetOwner();
   fOutputCorr->SetName("CorrelationsHistograms");
@@ -246,7 +246,7 @@ void AliAnalysisTaskDiJetCorrelations::UserCreateOutputObjects()
   fHistNEvents->Sumw2();
   fHistNEvents->SetMinimum(0);
   fOutputQA->Add(fHistNEvents);
-  
+
   fHistT1CorrTrack = new TH1F("fHistT1CorrTrack", "T1 nCorr tracks ", 5, -0.5, 4.5);
   fHistT1CorrTrack->GetXaxis()->SetBinLabel(1,"nTrack Total");
   fHistT1CorrTrack->GetXaxis()->SetBinLabel(2,"after conversion");
@@ -257,7 +257,7 @@ void AliAnalysisTaskDiJetCorrelations::UserCreateOutputObjects()
   fHistT1CorrTrack->Sumw2();
   fHistT1CorrTrack->SetMinimum(0);
   fOutputQA->Add(fHistT1CorrTrack);
-  
+
   fHistT2CorrTrack = new TH1F("fHistT2CorrTrack", "T2 nCorr tracks ", 5, -0.5, 4.5);
   fHistT2CorrTrack->GetXaxis()->SetBinLabel(1,"nTrack Total");
   fHistT2CorrTrack->GetXaxis()->SetBinLabel(2,"after conversion");
@@ -268,15 +268,15 @@ void AliAnalysisTaskDiJetCorrelations::UserCreateOutputObjects()
   fHistT2CorrTrack->Sumw2();
   fHistT2CorrTrack->SetMinimum(0);
   fOutputQA->Add(fHistT2CorrTrack);
-  
+
   DefineHistoNames();
-  
+
   Bool_t DefPool = DefineMixedEventPool();
   if(!DefPool){
     AliInfo("UserCreateOutput: Pool is not define properly");
     return;
   }
-  
+
   PostData(1,fOutputQA);
   PostData(2,fOutputCorr);
 }
@@ -286,16 +286,16 @@ void AliAnalysisTaskDiJetCorrelations::UserCreateOutputObjects()
 void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *) 
 {
 
-    AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
-    if(!aod && AODEvent() && IsStandardAOD()) {
-        aod = dynamic_cast<AliAODEvent*> (AODEvent());
-    } else if(!aod)  {
-        printf("AliAnalysisTaskDiJetCorrelations::UserExec: AOD not found!\n");
-        return;
-    }
-  
+  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
+  if(!aod && AODEvent() && IsStandardAOD()) {
+    aod = dynamic_cast<AliAODEvent*> (AODEvent());
+  } else if(!aod)  {
+    printf("AliAnalysisTaskDiJetCorrelations::UserExec: AOD not found!\n");
+    return;
+  }
+
   fHistNEvents->Fill(0);
-  
+
   if(!fRecoOrMontecarlo){ // MC Kine
     farrayMC = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
     if(!farrayMC){
@@ -309,12 +309,12 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
       return;
     }
   }
-  
+
   if(!aod->GetPrimaryVertex()||TMath::Abs(aod->GetMagneticField())<0.001) return;
   Float_t bSign = 0;
   bSign = (aod->GetMagneticField() > 0) ? 1 : -1;
   fHistNEvents->Fill(1);
-  
+
   AliCentrality *centralityObj = 0x0;
   if(fSetSystemValue){ // pPb, PbPb
     centralityObj = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP();
@@ -334,7 +334,7 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
     fCentrOrMult = count;
   }
   fHistNEvents->Fill(2); //
-  
+
   AliAODVertex *vtxPrm = (AliAODVertex*)aod->GetPrimaryVertex();
   Bool_t isGoodVtx=kFALSE;
   TString primTitle = vtxPrm->GetTitle();
@@ -343,11 +343,11 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
     fHistNEvents->Fill(3);
   }
   if(!isGoodVtx) return;
-  
+
   Float_t zVertex = vtxPrm->GetZ();
   if (TMath::Abs(zVertex) > 10) return;
   fHistQA[0]->Fill(zVertex);
-  
+
   const AliAODVertex* vtxSPD = aod->GetPrimaryVertexSPD();
   if(vtxSPD->GetNContributors()<=0) return;
   TString vtxTyp = vtxSPD->GetTitle();
@@ -357,18 +357,18 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
   if(vtxTyp.Contains("vertexer:Z") && (zRes > 0.25)) return;
   if(TMath::Abs(vtxSPD->GetZ() - vtxPrm->GetZ()) > 0.5) return;
   fHistNEvents->Fill(4);
-   
+
   TObjArray* fTrackArray = new TObjArray;
   fTrackArray->SetOwner(kTRUE);
-  
+
   Double_t refmaxpT1 = -999, refmaxpT2 = -999;
   Double_t etaMaxpT1 = -999, etaMaxpT2 = -999;
   Double_t phiMaxpT1 = -999, phiMaxpT2 = -999;
-  Short_t Charge1, Charge2;
-  
+  Short_t Charge1=-999, Charge2=-999;
+
   TString typeData = "";
   TString SEorME = "";
-  
+
   if(fRecoOrMontecarlo){
     if(!fReadMC){
       typeData += "Data";//data
@@ -377,13 +377,13 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
   }else{
     typeData += "MCKn"; // MC Generations  
   }
-  
+
   if(!fMixedEvent){
     SEorME += "SE";
   }else if(fMixedEvent){
     SEorME += "ME";
   }
-  
+
   //Mixed Events..
   if(TMath::Abs(zVertex)>=10)AliInfo(Form("Event with Zvertex = %.2f cm out of pool bounds, SKIPPING",zVertex));
   if(fMixedEvent){
@@ -393,17 +393,17 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
       return;
     }
   }
-  
-  
+
+
   for (Int_t iTracks = 0; iTracks < aod->GetNumberOfTracks(); iTracks++){
-    
+
     AliAODTrack* fAodTracks = (AliAODTrack*)aod->GetTrack(iTracks);
     if (!fAodTracks)continue;
     if(fSetFilterBit) if (!fAodTracks->TestFilterBit(fbit)) continue;
-    
+
     if(fAodTracks->Eta() < -0.8 || fAodTracks->Eta() > 0.8)continue;
     if (fAodTracks->Pt() < 0.5 || fAodTracks->Pt() > 30.)continue;
-    
+
     fHistNEvents->Fill(5); 
     fHistQA[1]->Fill(fAodTracks->GetTPCClusterInfo(2,1));
     fHistQA[3]->Fill(fAodTracks->DCA());
@@ -412,182 +412,182 @@ void  AliAnalysisTaskDiJetCorrelations::UserExec(Option_t *)
     fHistQA[6]->Fill(fAodTracks->Pt());
     fHistQA[7]->Fill(fAodTracks->Phi());
     fHistQA[8]->Fill(fAodTracks->Eta());
-    
+
     if(fRecoOrMontecarlo){ // reconstruction of data and MC
       if(fReadMC){
-       // is track associated to particle ? if yes + implimenting the physical primary..
-       Int_t label = TMath::Abs(fAodTracks->GetLabel());
-       if (label<=0){
-         AliDebug(3,"Particle not matching MC label \n");
-         continue;
-       }
-       
-       AliAODMCParticle *mcPart  = (AliAODMCParticle*)fMCEvent->GetTrack(label);
-       if (!mcPart->IsPhysicalPrimary()) continue;
-       fTrackArray->Add(fAodTracks);
+        // is track associated to particle ? if yes + implimenting the physical primary..
+        Int_t label = TMath::Abs(fAodTracks->GetLabel());
+        if (label<=0){
+          AliDebug(3,"Particle not matching MC label \n");
+          continue;
+        }
+
+        AliAODMCParticle *mcPart  = (AliAODMCParticle*)fMCEvent->GetTrack(label);
+        if (!mcPart->IsPhysicalPrimary()) continue;
+        fTrackArray->Add(fAodTracks);
       }else
-       fTrackArray->Add(fAodTracks); //Storing all tracks for Data
+        fTrackArray->Add(fAodTracks); //Storing all tracks for Data
     }
-    
+
     if(fAodTracks->Pt() >= fTrigger1pTLowThr && fAodTracks->Pt()  <= fTrigger1pTHighThr){  
       if(fAodTracks->Pt() > refmaxpT1){
-       refmaxpT1 = fAodTracks->Pt();
-       etaMaxpT1 = fAodTracks->Eta();
-       phiMaxpT1 = fAodTracks->Phi();
-       Charge1 = fAodTracks->Charge();
-       fHistNEvents->Fill(6);
+        refmaxpT1 = fAodTracks->Pt();
+        etaMaxpT1 = fAodTracks->Eta();
+        phiMaxpT1 = fAodTracks->Phi();
+        Charge1 = fAodTracks->Charge();
+        fHistNEvents->Fill(6);
       }
     }
   }
-  
+
   if(!fMixedEvent)if(refmaxpT1 < fTrigger1pTLowThr || refmaxpT1 > fTrigger1pTHighThr)return;
   fHistNEvents->Fill(8);
-  
+
   for(Int_t entryT2=0; entryT2<fTrackArray->GetEntries(); entryT2++){
-    
+
     TObject* obj = fTrackArray->At(entryT2);
     AliAODTrack* fAodTracksT2 = (AliAODTrack*)obj;
-    
+
     if(fAodTracksT2->Pt() >= fTrigger2pTLowThr && fAodTracksT2->Pt()  <= fTrigger2pTHighThr){
-      
+
       Double_t phiT2 = fAodTracksT2->Phi();
       Double_t TrigDPhi = phiMaxpT1-phiT2;
-      
+
       Double_t TrigDPhi12 =  AssignCorrectPhiRange(TrigDPhi);
       Double_t B2BTrigDPhi = TMath::Abs(TrigDPhi12-TMath::Pi());
-      
+
       if(B2BTrigDPhi > (TMath::Pi())/8)continue;
       fHistTrigDPhi->Fill(B2BTrigDPhi);
-      
+
       if(fAodTracksT2->Pt() > refmaxpT2 ){
-       fHistNEvents->Fill(7);
-       refmaxpT2 = fAodTracksT2->Pt();
-       etaMaxpT2 = fAodTracksT2->Eta();
-       phiMaxpT2 = fAodTracksT2->Phi();
-       Charge2 = fAodTracksT2->Charge();      
+        fHistNEvents->Fill(7);
+        refmaxpT2 = fAodTracksT2->Pt();
+        etaMaxpT2 = fAodTracksT2->Eta();
+        phiMaxpT2 = fAodTracksT2->Phi();
+        Charge2 = fAodTracksT2->Charge();
       }
     }
   }
-  
+
   if(!fMixedEvent)if(refmaxpT2 < fTrigger2pTLowThr || refmaxpT2 > fTrigger2pTHighThr)return;
   fHistNEvents->Fill(9);
-  
+
   if (refmaxpT1 != -999 && refmaxpT2 != -999){
-    
+
     Double_t fCentZvtxpT1[3] = {refmaxpT1, fCentrOrMult, zVertex};
     if(!fMixedEvent)((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg1CentZvtxpT_%s_%s",typeData.Data(), SEorME.Data())))->Fill(fCentZvtxpT1);
-    
+
     Double_t fCentZvtxpT2[3] = {refmaxpT2, fCentrOrMult, zVertex};
     if(!fMixedEvent)((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg2CentZvtxpT_%s_%s",typeData.Data(), SEorME.Data())))->Fill(fCentZvtxpT2);
   }
-  
-  
+
+
   Int_t NofEventsinPool = 1; // SE
   if(TMath::Abs(zVertex)>=10)AliInfo(Form("Event with Zvertex = %.2f cm out of pool bounds, SKIPPING",zVertex));
-  
+
   if(fMixedEvent){
     //Bool_t execPool = ProcessMixedEventPool();
     NofEventsinPool = fPool->GetCurrentNEvents();
   }
-  
+
   for (Int_t jMix =0; jMix < NofEventsinPool; jMix++){
-    
+
     if(!fTrackArray) return;
     if(fMixedEvent)fTrackArray = fPool->GetEvent(jMix); //check twice this coding wise..
     Int_t NumberOfTracksStore = fTrackArray->GetEntriesFast();
-    
+
     for(int k=0; k < NumberOfTracksStore; k++){
-      
+
       TObject* obj2 = fTrackArray->At(k);
       AliAODTrack* fAodTracksAS = (AliAODTrack*) obj2;
       if(!fAodTracksAS) continue;
       if (fAodTracksAS->Pt() > refmaxpT1)continue;
-      
+
       if(fMixedEvent){
-       if(fAodTracksAS->Eta() < -0.8 || fAodTracksAS->Eta() > 0.8)continue;
-       if(fAodTracksAS->Pt() < 0.5 || fAodTracksAS->Pt() > 20)continue;
-       if(fSetFilterBit) if (!fAodTracksAS->TestFilterBit(fbit)) continue;
+        if(fAodTracksAS->Eta() < -0.8 || fAodTracksAS->Eta() > 0.8)continue;
+        if(fAodTracksAS->Pt() < 0.5 || fAodTracksAS->Pt() > 20)continue;
+        if(fSetFilterBit) if (!fAodTracksAS->TestFilterBit(fbit)) continue;
       }
-      
+
       if(fAodTracksAS->Pt() < refmaxpT1){
-       
-       Bool_t CutForConversionResonanceTrg1 = ConversionResonanceCut(refmaxpT1, phiMaxpT1, etaMaxpT1, Charge1, fAodTracksAS,fControlConvResT1, fHistT1CorrTrack);
-       if(fCutConversions || fCutResonances)if(!CutForConversionResonanceTrg1)continue;
-       
-       Bool_t CutForTwoTrackEffiTrg1 = TwoTrackEfficiencyCut(refmaxpT1, phiMaxpT1, etaMaxpT1, Charge1, fAodTracksAS, bSign);
-       if(ftwoTrackEfficiencyCut)if(!CutForTwoTrackEffiTrg1)continue;
-       fHistT1CorrTrack->Fill(4); //
-       
-       Double_t deltaPhi1  = phiMaxpT1 - fAodTracksAS->Phi();
-       Double_t deltaPhi1C = AssignCorrectPhiRange(deltaPhi1);
-       Double_t deltaEta1  = etaMaxpT1 - fAodTracksAS->Eta();
-        
-       Double_t ptLim_Sparse1 = 0.0 ;
-       Double_t ptTrack1 = fAodTracksAS->Pt();
-       ptLim_Sparse1 =((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg1CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->GetAxis(4)->GetXmax();
-       if(ptTrack1 > ptLim_Sparse1) ptTrack1 = ptLim_Sparse1-0.01; //filling all the pT in last bin
-        
-       Double_t CentzVtxDEtaDPhiTrg1[5] = {fCentrOrMult, zVertex, deltaEta1, deltaPhi1C, ptTrack1};
-       Double_t effvalueT1 = 1.0;//GetTrackbyTrackEffValue(fAodTracksAS, fCentrOrMult);
-       
-       ((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg1CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->Fill(CentzVtxDEtaDPhiTrg1, 1/effvalueT1);
-       
-       //Double_t fBasicsTrg1[5] = {fAodTracksAS->Pt(), fAodTracksAS->Eta(), fCentrOrMult, zVertex, fAodTracksAS->Phi()};
-       //if(!fMixedEvent)((THnSparseD*)fOutputQA->FindObject(Form("ThnTrg1BasicsPlots_%s_%s",typeData.Data(), SEorME.Data())))->Fill(fBasicsTrg1);
-        
+
+        Bool_t CutForConversionResonanceTrg1 = ConversionResonanceCut(refmaxpT1, phiMaxpT1, etaMaxpT1, Charge1, fAodTracksAS,fControlConvResT1, fHistT1CorrTrack);
+        if(fCutConversions || fCutResonances)if(!CutForConversionResonanceTrg1)continue;
+
+        Bool_t CutForTwoTrackEffiTrg1 = TwoTrackEfficiencyCut(refmaxpT1, phiMaxpT1, etaMaxpT1, Charge1, fAodTracksAS, bSign);
+        if(ftwoTrackEfficiencyCut)if(!CutForTwoTrackEffiTrg1)continue;
+        fHistT1CorrTrack->Fill(4); //
+
+        Double_t deltaPhi1  = phiMaxpT1 - fAodTracksAS->Phi();
+        Double_t deltaPhi1C = AssignCorrectPhiRange(deltaPhi1);
+        Double_t deltaEta1  = etaMaxpT1 - fAodTracksAS->Eta();
+
+        Double_t ptLim_Sparse1 = 0.0 ;
+        Double_t ptTrack1 = fAodTracksAS->Pt();
+        ptLim_Sparse1 =((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg1CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->GetAxis(4)->GetXmax();
+        if(ptTrack1 > ptLim_Sparse1) ptTrack1 = ptLim_Sparse1-0.01; //filling all the pT in last bin
+
+        Double_t CentzVtxDEtaDPhiTrg1[5] = {fCentrOrMult, zVertex, deltaEta1, deltaPhi1C, ptTrack1};
+        Double_t effvalueT1 = 1.0;//GetTrackbyTrackEffValue(fAodTracksAS, fCentrOrMult);
+
+        ((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg1CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->Fill(CentzVtxDEtaDPhiTrg1, 1/effvalueT1);
+
+        //Double_t fBasicsTrg1[5] = {fAodTracksAS->Pt(), fAodTracksAS->Eta(), fCentrOrMult, zVertex, fAodTracksAS->Phi()};
+        //if(!fMixedEvent)((THnSparseD*)fOutputQA->FindObject(Form("ThnTrg1BasicsPlots_%s_%s",typeData.Data(), SEorME.Data())))->Fill(fBasicsTrg1);
+
       }
-      
-      
+
+
       if (fAodTracksAS->Pt() < refmaxpT2){
-       
-       Bool_t CutForConversionResonanceTrg2 = ConversionResonanceCut(refmaxpT2, phiMaxpT2, etaMaxpT2, Charge2, fAodTracksAS,fControlConvResT2, fHistT2CorrTrack);
-       if(fCutConversions || fCutResonances)if(!CutForConversionResonanceTrg2)continue;
-       
-       Bool_t CutForTwoTrackEffiTrg2 = TwoTrackEfficiencyCut(refmaxpT2, phiMaxpT2, etaMaxpT2, Charge2, fAodTracksAS, bSign);
-       if(ftwoTrackEfficiencyCut)if(!CutForTwoTrackEffiTrg2)continue;  
-       fHistT2CorrTrack->Fill(4); //
-       
-       Double_t deltaPhi2 = phiMaxpT2 - fAodTracksAS->Phi();
-       Double_t deltaPhi2C =  AssignCorrectPhiRange(deltaPhi2);
-       Double_t deltaEta2 = etaMaxpT2 - fAodTracksAS->Eta();
-       
-       Double_t ptLim_Sparse2 = 0.0;
-       Double_t ptTrack2 = fAodTracksAS->Pt();
-       ptLim_Sparse2 =((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg2CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->GetAxis(4)->GetXmax();
-       if(ptTrack2 > ptLim_Sparse2) ptTrack2 = ptLim_Sparse2-0.01; //filling all the pT in last bin
-       
-       Double_t CentzVtxDEtaDPhiTrg2[5] = {fCentrOrMult, zVertex, deltaEta2, deltaPhi2C,ptTrack2};
-       Double_t effvalueT2 = 1.0;//GetTrackbyTrackEffValue(fAodTracksAS, fCentrOrMult);
-       
-       ((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg2CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->Fill(CentzVtxDEtaDPhiTrg2,1/effvalueT2);
-       
-       // Double_t fBasicsTrg2[5] = {fAodTracksAS->Pt(), fAodTracksAS->Eta(), fCentrOrMult, zVertex, fAodTracksAS->Phi()};
-       // if(!fMixedEvent)((THnSparseD*)fOutputQA->FindObject(Form("ThnTrg2BasicsPlots_%s_%s",typeData.Data(), SEorME.Data())))->Fill(fBasicsTrg2);
-       
+
+        Bool_t CutForConversionResonanceTrg2 = ConversionResonanceCut(refmaxpT2, phiMaxpT2, etaMaxpT2, Charge2, fAodTracksAS,fControlConvResT2, fHistT2CorrTrack);
+        if(fCutConversions || fCutResonances)if(!CutForConversionResonanceTrg2)continue;
+
+        Bool_t CutForTwoTrackEffiTrg2 = TwoTrackEfficiencyCut(refmaxpT2, phiMaxpT2, etaMaxpT2, Charge2, fAodTracksAS, bSign);
+        if(ftwoTrackEfficiencyCut)if(!CutForTwoTrackEffiTrg2)continue;
+        fHistT2CorrTrack->Fill(4); //
+
+        Double_t deltaPhi2 = phiMaxpT2 - fAodTracksAS->Phi();
+        Double_t deltaPhi2C =  AssignCorrectPhiRange(deltaPhi2);
+        Double_t deltaEta2 = etaMaxpT2 - fAodTracksAS->Eta();
+
+        Double_t ptLim_Sparse2 = 0.0;
+        Double_t ptTrack2 = fAodTracksAS->Pt();
+        ptLim_Sparse2 =((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg2CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->GetAxis(4)->GetXmax();
+        if(ptTrack2 > ptLim_Sparse2) ptTrack2 = ptLim_Sparse2-0.01; //filling all the pT in last bin
+
+        Double_t CentzVtxDEtaDPhiTrg2[5] = {fCentrOrMult, zVertex, deltaEta2, deltaPhi2C,ptTrack2};
+        Double_t effvalueT2 = 1.0;//GetTrackbyTrackEffValue(fAodTracksAS, fCentrOrMult);
+
+        ((THnSparseD*)fOutputCorr->FindObject(Form("ThnTrg2CentZvtxDEtaDPhi_%s_%s",typeData.Data(), SEorME.Data())))->Fill(CentzVtxDEtaDPhiTrg2,1/effvalueT2);
+
+        // Double_t fBasicsTrg2[5] = {fAodTracksAS->Pt(), fAodTracksAS->Eta(), fCentrOrMult, zVertex, fAodTracksAS->Phi()};
+        // if(!fMixedEvent)((THnSparseD*)fOutputQA->FindObject(Form("ThnTrg2BasicsPlots_%s_%s",typeData.Data(), SEorME.Data())))->Fill(fBasicsTrg2);
+
       }
     }
   }// event looop
-  
+
   // clone and give ownership to event pool
   TObjArray* tracksClone = (TObjArray*) fTrackArray->Clone();
   tracksClone->SetOwner(kTRUE);
   if(fMixedEvent && tracksClone->GetEntriesFast()>0)fPool->UpdatePool(tracksClone);
-  
+
   PostData(1, fOutputQA);
   PostData(2, fOutputCorr);  
   //delete f3DEffCor;
-  
+
 }
 
 //_____________________|Terminate
 void AliAnalysisTaskDiJetCorrelations::Terminate(Option_t *){
-  
+
   fOutputQA = dynamic_cast<TList*> (GetOutputData(1));
   if (!fOutputQA) {
     printf("ERROR: Output list not available\n");
     return;
   }
-  
+
   fOutputCorr = dynamic_cast<TList*> (GetOutputData(2));
   if (!fOutputCorr) {
     printf("ERROR: fOutputCorr not available\n");
@@ -598,7 +598,7 @@ void AliAnalysisTaskDiJetCorrelations::Terminate(Option_t *){
 
 //______________________________|  Cuts of Resonance and Conversions..
 Bool_t AliAnalysisTaskDiJetCorrelations::ConversionResonanceCut(Double_t refmaxpT, Double_t phiMaxpT, Double_t etaMaxpT, Double_t Charge, AliAODTrack* AodTracks, TH2F*fControlConvResT, TH1F* fHistTCorrTrack){
-  
+
   fHistTCorrTrack->Fill(0); //
   //Conversions
   if(fCutConversions && AodTracks->Charge() * Charge < 0){
@@ -610,7 +610,7 @@ Bool_t AliAnalysisTaskDiJetCorrelations::ConversionResonanceCut(Double_t refmaxp
     }
   }
   fHistTCorrTrack->Fill(1); //
-  
+
   //K0s
   if (fCutResonances && AodTracks->Charge() * Charge < 0){   
     Float_t mass = GetInvMassSquaredCheap(refmaxpT, etaMaxpT, phiMaxpT, AodTracks->Pt(), AodTracks->Eta(), AodTracks->Phi(), 0.1396, 0.1396);
@@ -622,7 +622,7 @@ Bool_t AliAnalysisTaskDiJetCorrelations::ConversionResonanceCut(Double_t refmaxp
     }
   }
   fHistTCorrTrack->Fill(2); //
-  
+
   //lambda
   if (fCutResonances && AodTracks->Charge() * Charge < 0){
     Float_t mass1 = GetInvMassSquaredCheap(refmaxpT, etaMaxpT, phiMaxpT, AodTracks->Pt(), AodTracks->Eta(), AodTracks->Phi(), 0.1396, 0.9383);
@@ -633,14 +633,14 @@ Bool_t AliAnalysisTaskDiJetCorrelations::ConversionResonanceCut(Double_t refmaxp
       fControlConvResT->Fill(2, mass1 - kLambdaMass * kLambdaMass);
       if(mass1 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass1 < (kLambdaMass+0.02)*(kLambdaMass+0.02))return kFALSE;  
     }
-    
+
     if (TMath::Abs(mass2 -kLambdaMass * kLambdaMass)  < 0.1){
       mass2 = GetInvMassSquared(refmaxpT, etaMaxpT, phiMaxpT, AodTracks->Pt(), AodTracks->Eta(), AodTracks->Phi(), 0.1396, 0.9383);
       fControlConvResT->Fill(2, mass2 - kLambdaMass * kLambdaMass);
       if(mass2 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass2 < (kLambdaMass+0.02)*(kLambdaMass+0.02))return kFALSE;
     }
   }
-  
+
   fHistTCorrTrack->Fill(3); //
   return kTRUE; 
 }
@@ -651,34 +651,34 @@ Bool_t AliAnalysisTaskDiJetCorrelations::TwoTrackEfficiencyCut(Double_t refmaxpT
   Float_t phi1 = phiMaxpT;
   Float_t eta1 = etaMaxpT;
   Float_t charge1 = Charge;
-  
+
   Float_t phi2 = AodTracks->Phi();
   Float_t eta2 = AodTracks->Eta();
   Float_t pt2  = AodTracks->Pt();
   Float_t charge2 = AodTracks->Charge();
-  
+
   Float_t deta = eta1 - eta2;
-  
+
   if (TMath::Abs(deta) < 0.02 * 2.5 * 3){
     Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSigntmp);
     Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSigntmp);
-    
+
     const Float_t kLimit = 0.02*3;
     Float_t dphistarminabs = 1e5;
     //Float_t dphistarmin = 1e5;
-  
+
     if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0){
       for (Double_t rad=0.8; rad<2.51; rad+=0.01){
-       Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSigntmp);
-       Float_t dphistarabs = TMath::Abs(dphistar);
-       if (dphistarabs < dphistarminabs){
-         //dphistarmin = dphistar;
-         dphistarminabs = dphistarabs;
-       }
+        Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSigntmp);
+        Float_t dphistarabs = TMath::Abs(dphistar);
+        if (dphistarabs < dphistarminabs){
+          //dphistarmin = dphistar;
+          dphistarminabs = dphistarabs;
+        }
       }
-       
+
       if (dphistarminabs < 0.02 && TMath::Abs(deta) < 0.02){
-       return kFALSE;
+        return kFALSE;
       }
     }
   }
@@ -688,7 +688,7 @@ Bool_t AliAnalysisTaskDiJetCorrelations::TwoTrackEfficiencyCut(Double_t refmaxpT
 
 //______________________________|  Nomenclature of Histograms
 void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
-  
+
   Double_t Pi = TMath::Pi();
   //QA histograms
   fHistQA[0] = new TH1F("fHistZVtx", "Z vertex distribution", 100, -15., 15.);
@@ -700,25 +700,25 @@ void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
   fHistQA[6] = new TH1F("fHistpT", "pT distribution",1000,0.,20.);
   fHistQA[7] = new TH1F("fHistPhi", "Phi distribution" , 100, -0.5, 2*Pi+0.5);
   fHistQA[8] = new TH1F("fHistEta", "Eta distribution" , 100, -2, 2);
-  
+
   for( Int_t i = 0; i < 9; i++)
-    {
-      fHistQA[i]->Sumw2();
-      fOutputQA->Add(fHistQA[i]);
-    }
-  
+  {
+    fHistQA[i]->Sumw2();
+    fOutputQA->Add(fHistQA[i]);
+  }
+
   //1 SE Distributuons Phi, Eta for Trg1 and Trg2
   fHistTrigDPhi = new TH1F("fHistTrigDPhi", " Trig Phi Difference Same",100, 0, 0.5);
   fHistTrigDPhi->Sumw2();
   fOutputQA->Add(fHistTrigDPhi);
-  
+
   fControlConvResT1 = new TH2F("fControlConvResT1", ";id;delta mass;T1", 3, -0.5, 2.5, 100, -0.1, 0.1);
   fControlConvResT2 = new TH2F("fControlConvResT2", ";id;delta mass;T2", 3, -0.5, 2.5, 100, -0.1, 0.1);
   fControlConvResT1->Sumw2();
   fControlConvResT2->Sumw2();
   fOutputQA->Add(fControlConvResT1);
   fOutputQA->Add(fControlConvResT2);
-  
+
   //Thnsprase Distributuons Phi, Eta for Trg1 and Trg2
   TString nameThnTrg1CentZvtxDEtaDPhi   = "ThnTrg1CentZvtxDEtaDPhi";
   TString nameThnTrg2CentZvtxDEtaDPhi   = "ThnTrg2CentZvtxDEtaDPhi";
@@ -727,7 +727,7 @@ void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
   TString nameThnAllBasicsPlots    = "ThnAllBasicsPlots" ;
   TString nameThnTrg1BasicsPlots    = "ThnTrg1BasicsPlots";
   TString nameThnTrg2BasicsPlots    = "ThnTrg2BasicsPlots";
-  
+
   if(fRecoOrMontecarlo){
     if(!fReadMC){ //data
       nameThnTrg1CentZvtxDEtaDPhi  += "_Data";
@@ -757,7 +757,7 @@ void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
     nameThnTrg1BasicsPlots  += "_MCKn";
     nameThnTrg2BasicsPlots  += "_MCKn";
   }
-  
+
   if(!fMixedEvent){
     nameThnTrg1CentZvtxDEtaDPhi  += "_SE";
     nameThnTrg2CentZvtxDEtaDPhi  += "_SE";
@@ -771,29 +771,29 @@ void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
     nameThnTrg2CentZvtxDEtaDPhi  += "_ME";
     nameThnTrg1CentZvtxpT  += "_ME";
     nameThnTrg2CentZvtxpT  += "_ME";
-    }
+  }
 
-    //For Trigger One --> cent, zvrtx, pT
+  //For Trigger One --> cent, zvrtx, pT
   Int_t    fBins12[5] = {12,      10,   16,               36, 11};
   Double_t  fMin12[5] = {0.0,   -10., -1.6, -0.5*TMath::Pi(), 0.0};
   Double_t  fMax12[5] = {100.1,  10.,  1.6,  1.5*TMath::Pi(), 6.00};
-  
+
   Int_t pTbinTrigger1 = Int_t(fTrigger1pTHighThr - fTrigger1pTLowThr);
   Int_t pTbinTrigger2 = Int_t(fTrigger2pTHighThr - fTrigger2pTLowThr);
-    
+
   Int_t   fBinsTrg1[3]   = {   12,      10,          pTbinTrigger1};
   Double_t fMinTrg1[3]   = {  0.0,   -10.0,      fTrigger1pTLowThr};
   Double_t fMaxTrg1[3]   = {  100.1,  10.0,   fTrigger1pTHighThr};
-  
+
   Int_t   fBinsTrg2[3]   = {   12,      10,        pTbinTrigger2};
   Double_t fMinTrg2[3]   = {  0.0,   -10.0,    fTrigger2pTLowThr};
   Double_t fMaxTrg2[3]   = {  100.1,    10.0,   fTrigger2pTHighThr};
-  
+
   Int_t   fBinsTrk[5]   = {  20,   16,    10,    10,  36};
   Double_t fMinTrk[5]   = { 0.0, -0.8,   0.0,  -10.,  0};
   Double_t fMaxTrk[5]   = {20.0,  0.8, 100.1,   10.,  2*TMath::Pi()};
-    // why the limits of DeltaPhi have been changed
-  
+  // why the limits of DeltaPhi have been changed
+
   THnSparseD *THnTrig1CentZvtxDEtaDPhi   = new THnSparseD(nameThnTrg1CentZvtxDEtaDPhi.Data(),"Cent-zVtx-DEta1-DPhi1",5, fBins12, fMin12, fMax12);
   THnSparseD *THnTrig2CentZvtxDEtaDPhi   = new THnSparseD(nameThnTrg2CentZvtxDEtaDPhi.Data(),"Cent-zVtx-DEta2-DPhi2",5, fBins12, fMin12, fMax12);
   THnSparseD *THnTrig1CentZvtxpT = new THnSparseD(nameThnTrg1CentZvtxpT.Data(),"Cent-Zvtx-pTtr1",3, fBinsTrg1, fMinTrg1, fMaxTrg1);
@@ -807,14 +807,14 @@ void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
     THnTrig1CentZvtxpT->GetAxis(0)->Set(nvarBinsCent, varBinsCent);
     THnTrig2CentZvtxpT->GetAxis(0)->Set(nvarBinsCent, varBinsCent);
   }
-    if(fuseVarPtBins){
-        const Int_t nvarBinspT = 11;
-        Double_t varBinspT[nvarBinspT+1] = {0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0};
-        THnTrig1CentZvtxDEtaDPhi->GetAxis(4)->Set(nvarBinspT, varBinspT);
-        THnTrig2CentZvtxDEtaDPhi->GetAxis(4)->Set(nvarBinspT, varBinspT);
-        
-    }
-    
+  if(fuseVarPtBins){
+    const Int_t nvarBinspT = 11;
+    Double_t varBinspT[nvarBinspT+1] = {0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0};
+    THnTrig1CentZvtxDEtaDPhi->GetAxis(4)->Set(nvarBinspT, varBinspT);
+    THnTrig2CentZvtxDEtaDPhi->GetAxis(4)->Set(nvarBinspT, varBinspT);
+
+  }
+
   THnTrig1CentZvtxDEtaDPhi->Sumw2();
   THnTrig2CentZvtxDEtaDPhi->Sumw2();
   THnTrig1CentZvtxpT->Sumw2();
@@ -823,7 +823,7 @@ void AliAnalysisTaskDiJetCorrelations::DefineHistoNames(){
   fOutputCorr->Add(THnTrig2CentZvtxDEtaDPhi);
   fOutputCorr->Add(THnTrig1CentZvtxpT);
   fOutputCorr->Add(THnTrig2CentZvtxpT);
-  
+
   THnSparseD *THnTrg1BasicsPlots = new THnSparseD(nameThnTrg1BasicsPlots.Data(),"pTtr1-Eta-Cent-zvtx-Phi",5, fBinsTrk, fMinTrk, fMaxTrk);
   THnSparseD *THnTrg2BasicsPlots = new THnSparseD(nameThnTrg2BasicsPlots.Data(),"pTtr2-Eta-Cent-zvtx-Phi",5, fBinsTrk, fMinTrk, fMaxTrk);
   THnSparseD *THnAllBasicsPlots = new THnSparseD(nameThnAllBasicsPlots.Data(),"pTtrk-Eta-Cent-zvtx-Phi",5, fBinsTrk, fMinTrk, fMaxTrk);  
index 02c3a790a645bdf69262ad737a96d9c954447d19..dd2eab7368bb2903ea778dd59d798c7227c6456e 100644 (file)
@@ -23,7 +23,6 @@
 #include "THnSparse.h"
 #include "TCanvas.h"
 #include "TRandom.h"
-
 #include <TROOT.h>
 #include <TChain.h>
 #include <TFile.h>
@@ -1122,12 +1121,20 @@ void  AliAnalysisTaskDptDptCorrelations::UserExec(Option_t */*option*/)
        }
       
       
-      if ( centrality < _centralityMin ||  
+      /* if ( centrality < _centralityMin ||  
           centrality > _centralityMax ||
           fabs(v0Centr-trkCentr)>5.0)         //only for PbPb centrality
+       {
+         return;
+         }*/
+
+      if ( centrality < _centralityMin ||  
+          centrality > _centralityMax )       //only for pPb centrality
        {
          return;
        }
+
+
       _eventAccounting->Fill(2);// count all events with right centrality
       
       // filter on z and xy vertex
index 89e5aba82887ee862990a017fb81effe04c37823..bb918f3c423feb756e00cd051e602a907cd020f3 100644 (file)
@@ -78,7 +78,6 @@ set(SRCS
     FourierDecomposition/AliPool.cxx
     MuonHadron/AliAnalysisTaskDiMuonCorrelations.cxx
     MuonHadron/AliAnalysisTaskMuonHadronCorrelations.cxx
-    PhiEffMC/AliAnalysisTaskPhiEffMc.cxx
     PidPid/AliAnalysisTaskPidPidCorrelations.cxx
     TriggerPID/AliAnalysisTaskPIDCORR.cxx
     TriggerPID/AliTwoParticlePIDCorr.cxx
index e3da9af70afcd4300d735929b87410eb010c309b..293d2cff528280348ad659c6ec539ed8f8975756 100644 (file)
@@ -47,7 +47,6 @@
 #pragma link C++ class LRCParticlePID+;
 #pragma link C++ class AliAnalysisTaskPidPidCorrelations+;
 #pragma link C++ class AliPidPidCorrelationReducedTrack+;
-#pragma link C++ class AliAnalysisTaskPhiEffMc+;
 #pragma link C++ class AliAnalysisTaskPythiaMpi+;
 #pragma link C++ class AliAnalysisTaskDiJetCorrelations+;
 #endif
diff --git a/PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.cxx b/PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.cxx
deleted file mode 100644 (file)
index 7724c49..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * 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   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-//-----------------------------------------------------------------
-//         AliAnalysisTaskPhiEffMc class
-//-----------------------------------------------------------------
-
-#include "TChain.h"
-#include "TTree.h"
-#include "TLegend.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TH3F.h"
-#include "THnSparse.h"
-#include "TCanvas.h"
-#include "TObjArray.h"
-#include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-#include "AliVTrack.h"
-#include "AliAODMCParticle.h"
-#include "AliVParticle.h"
-#include "AliAODEvent.h"
-#include "AliAODInputHandler.h"
-#include "AliAnalysisTaskPhiEffMc.h"
-#include "AliAnalysisTaskESDfilter.h"
-#include "AliAnalysisDataContainer.h"
-#include "AliCentrality.h"
-#include "TProof.h"
-#include "AliPID.h"
-#include "AliVEvent.h"
-#include "AliPIDResponse.h"
-#include "AliSpectraAODTrackCuts.h"
-#include "AliSpectraAODEventCuts.h"
-#include "AliStack.h"
-#include <TMCProcess.h>
-#include "AliAnalyseLeadingTrackUE.h"
-
-#include <iostream>
-
-using namespace std;
-
-ClassImp(AliAnalysisTaskPhiEffMc) 
-
-//________________________________________________________________________
-AliAnalysisTaskPhiEffMc::AliAnalysisTaskPhiEffMc(const char *name) : AliAnalysisTaskSE(name), 
-  fAOD(0x0), 
-  fIsMC(0),
-  fOutput(0x0),
-  fHelperPID(0x0),
-  fTrackCuts(0x0),
-  fEventCuts(0x0),
-  fPtCut(0.),
-  fDoPID(kTRUE)
-{
-  // Default constructor
-  
-
-  DefineInput(0, TChain::Class());
-  DefineOutput(1, TList::Class());
-  DefineOutput(2, AliHelperPID::Class());
-  DefineOutput(3, AliSpectraAODEventCuts::Class());
-  DefineOutput(4, AliSpectraAODTrackCuts::Class());
-}
-//________________________________________________________________________
-//________________________________________________________________________
-void AliAnalysisTaskPhiEffMc::UserCreateOutputObjects()
-{
-  Printf("\n\n\n\n\n\n In CreateOutput Object:");
-  
-  if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
-  if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
-  if (!fHelperPID)  AliFatal("HelperPID should be set in the steering macro");
-
-  fOutput = new TList();
-  fOutput->SetOwner();
-  fOutput->SetName("BlaBla");
-
-  // event histogram
-  const Int_t nEventDim = 4;
-  //                      cent  vz MCmult RecoMult
-  Int_t nEventBins[4] =   { 10,  41,  50,   50};
-  Double_t nEventMin[4] = {  0, -10,   0,    0};
-  Double_t nEventMax[4] = {100,  10, 100,  100};
-
-  THnSparseF* hEvent = new THnSparseF("hEvent", "hEvent", nEventDim, nEventBins, nEventMin, nEventMax);
-  hEvent->GetAxis(0)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hEvent->GetAxis(1)->SetTitle("v_{z} (cm)");
-  hEvent->GetAxis(2)->SetTitle("# MC particles");
-  hEvent->GetAxis(3)->SetTitle("# reconstructed tracks");
-  fOutput->Add(hEvent);
-
-  TH3F* hKcorr = new TH3F("hKcorr","hKcorr",100,0,10,100,0,10,100,0,10);
-  hKcorr->GetXaxis()->SetTitle("#phi p_{T} (GeV/c)");
-  hKcorr->GetYaxis()->SetTitle("k+ p_{T} (GeV/c)");
-  hKcorr->GetZaxis()->SetTitle("k- p_{T} (GeV/c)");
-  fOutput->Add(hKcorr);
-
-  // single charged particles -- bins for THnSparse histograms
-  const Int_t nTrackDim = 6;
-  //                                PID ID, pt, y, cent, eta, phi
-  Int_t    nTrackBins[nTrackDim] =   {   7, 50, 20,  10,  20, 30};
-  Double_t nTrackMin[nTrackDim] =    {-3.5,  0, -1,   0,  -1,  0};
-  Double_t nTrackMax[nTrackDim] =    { 3.5,  5,  1, 100,   1, 2*TMath::Pi()};
-
-  // single charged particles -- Monte Carlo particles
-  THnSparseF* hTrackMc = new THnSparseF("hTrackMc", "hTrackMc", nTrackDim, nTrackBins, nTrackMin, nTrackMax);
-  hTrackMc->GetAxis(0)->SetTitle("PID ID * Charge");
-  hTrackMc->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hTrackMc->GetAxis(2)->SetTitle("y");
-  hTrackMc->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hTrackMc->GetAxis(4)->SetTitle("#eta");
-  hTrackMc->GetAxis(5)->SetTitle("#phi (rad)");
-  fOutput->Add(hTrackMc);
-
-  // single charged particles -- reconstructed tracks
-  THnSparseF* hTrackReco = new THnSparseF("hTrackReco", "hTrackReco", nTrackDim, nTrackBins, nTrackMin, nTrackMax);
-  hTrackReco->GetAxis(0)->SetTitle("PID ID * Charge");
-  hTrackReco->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hTrackReco->GetAxis(2)->SetTitle("y");
-  hTrackReco->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hTrackReco->GetAxis(4)->SetTitle("#eta");
-  hTrackReco->GetAxis(5)->SetTitle("#phi (rad)");
-  fOutput->Add(hTrackReco);
-
-  // single charged particles -- Monte Carlo particles matched to reconstructed tracks
-  THnSparseF* hTrackMatch = new THnSparseF("hTrackMatch", "hTrackMatch", nTrackDim, nTrackBins, nTrackMin, nTrackMax);
-  hTrackMatch->GetAxis(0)->SetTitle("PID ID * Charge");
-  hTrackMatch->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hTrackMatch->GetAxis(2)->SetTitle("y");
-  hTrackMatch->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hTrackMatch->GetAxis(4)->SetTitle("#eta");
-  hTrackMatch->GetAxis(5)->SetTitle("#phi (rad)");
-  fOutput->Add(hTrackMatch);
-
-  // kaon pairs -- bins for THnSparse histograms
-  const Int_t nPairDim = 7;
-  //                             InvMass, pt, y, cent, eta, phi,          pair ID
-  Int_t    nPairBins[nPairDim] =   { 100, 50, 20,  10,  20, 30,              3};
-  Double_t nPairMin[nPairDim] =    {0.98,  0, -1,   0,  -1,  0,           -0.5};
-  Double_t nPairMax[nPairDim] =    { 1.1,  5,  1, 100,   1, 2*TMath::Pi(), 2.5};
-  // pair ID = 0 unlike sign k+k-
-  //           1 like sign pos k+k+
-  //           2 like sign neg k-k-
-
-  // kaon pairs -- Monte Carlo particles -- real phi's
-  THnSparseF* hPairMcPhi = new THnSparseF("hPairMcPhi", "hPairMcPhi", nPairDim, nPairBins, nPairMin, nPairMax);
-  hPairMcPhi->GetAxis(0)->SetTitle("Invariant Mass (GeV/c/c)");
-  hPairMcPhi->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hPairMcPhi->GetAxis(2)->SetTitle("y");
-  hPairMcPhi->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hPairMcPhi->GetAxis(4)->SetTitle("#eta");
-  hPairMcPhi->GetAxis(5)->SetTitle("#phi (rad)");
-  hPairMcPhi->GetAxis(6)->SetTitle("pair ID");
-  fOutput->Add(hPairMcPhi);
-
-  // kaon pairs -- Monte Carlo particles -- real phi's with kaon daughters that pass pt and eta cuts
-  THnSparseF* hPairMcPhiCuts = new THnSparseF("hPairMcPhiCuts", "hPairMcPhiCuts", nPairDim, nPairBins, nPairMin, nPairMax);
-  hPairMcPhiCuts->GetAxis(0)->SetTitle("Invariant Mass (GeV/c/c)");
-  hPairMcPhiCuts->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hPairMcPhiCuts->GetAxis(2)->SetTitle("y");
-  hPairMcPhiCuts->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hPairMcPhiCuts->GetAxis(4)->SetTitle("#eta");
-  hPairMcPhiCuts->GetAxis(5)->SetTitle("#phi (rad)");
-  hPairMcPhiCuts->GetAxis(6)->SetTitle("pair ID");
-  fOutput->Add(hPairMcPhiCuts);
-
-  // kaon pairs -- Monte Carlo particles -- phi's reconstructed from MC kaons
-  THnSparseF* hPairMc = new THnSparseF("hPairMc", "hPairMc", nPairDim, nPairBins, nPairMin, nPairMax);
-  hPairMc->GetAxis(0)->SetTitle("Invariant Mass (GeV/c/c)");
-  hPairMc->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hPairMc->GetAxis(2)->SetTitle("y");
-  hPairMc->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hPairMc->GetAxis(4)->SetTitle("#eta");
-  hPairMc->GetAxis(5)->SetTitle("#phi (rad)");
-  hPairMc->GetAxis(6)->SetTitle("pair ID");
-  fOutput->Add(hPairMc);
-
-  // kaon pairs -- reconstructed tracks
-  THnSparseF* hPairReco = new THnSparseF("hPairReco", "hPairReco", nPairDim, nPairBins, nPairMin, nPairMax);
-  hPairReco->GetAxis(0)->SetTitle("Invariant Mass (GeV/c/c)");
-  hPairReco->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hPairReco->GetAxis(2)->SetTitle("y");
-  hPairReco->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hPairReco->GetAxis(4)->SetTitle("#eta");
-  hPairReco->GetAxis(5)->SetTitle("#phi (rad)");
-  hPairReco->GetAxis(6)->SetTitle("pair ID");
-  fOutput->Add(hPairReco);
-
-  // kaon pairs -- Monte Carlo particles matched to reconstructed tracks
-  THnSparseF* hPairMatch = new THnSparseF("hPairMatch", "hPairMatch", nPairDim, nPairBins, nPairMin, nPairMax);
-  hPairMatch->GetAxis(0)->SetTitle("Invariant Mass (GeV/c/c)");
-  hPairMatch->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
-  hPairMatch->GetAxis(2)->SetTitle("y");
-  hPairMatch->GetAxis(3)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
-  hPairMatch->GetAxis(4)->SetTitle("#eta");
-  hPairMatch->GetAxis(5)->SetTitle("#phi (rad)");
-  hPairMatch->GetAxis(6)->SetTitle("pair ID");
-  fOutput->Add(hPairMatch);
-
-  PostData(1, fOutput);
-  PostData(2, fHelperPID);
-  PostData(3, fEventCuts);
-  PostData(4, fTrackCuts);
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskPhiEffMc::UserExec(Option_t *)
-{
-  // main event loop
-  fAOD = dynamic_cast<AliAODEvent*>(fInputEvent);
-  if (!fAOD) {
-    AliWarning("ERROR: AliAODEvent not available \n");
-    return;
-  }
-  
-  if (strcmp(fAOD->ClassName(), "AliAODEvent"))
-    {
-      AliFatal("Not processing AODs");
-    }
-
-  if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
-
-  Double_t cent = fEventCuts->GetCent();
-
-  THnSparseF* hEvent = (THnSparseF*)fOutput->FindObject("hEvent");
-  THnSparseF* hTrackMc = (THnSparseF*)fOutput->FindObject("hTrackMc");
-  THnSparseF* hTrackReco = (THnSparseF*)fOutput->FindObject("hTrackReco");
-  THnSparseF* hTrackMatch = (THnSparseF*)fOutput->FindObject("hTrackMatch");
-  THnSparseF* hPairMcPhi = (THnSparseF*)fOutput->FindObject("hPairMcPhi");
-  THnSparseF* hPairMcPhiCuts = (THnSparseF*)fOutput->FindObject("hPairMcPhiCuts");
-  THnSparseF* hPairMc = (THnSparseF*)fOutput->FindObject("hPairMc");
-  THnSparseF* hPairReco = (THnSparseF*)fOutput->FindObject("hPairReco");
-  THnSparseF* hPairMatch = (THnSparseF*)fOutput->FindObject("hPairMatch");
-  TH3F* hKcorr = (TH3F*)fOutput->FindObject("hKcorr");
-
-  TObjArray* kaonsPosMc = new TObjArray();
-  TObjArray* kaonsNegMc = new TObjArray();
-  TObjArray* kaonsPosData = new TObjArray();
-  TObjArray* kaonsNegData = new TObjArray();
-  TObjArray* kaonsPosGen = new TObjArray();
-  TObjArray* kaonsNegGen = new TObjArray();
-
-  Int_t nMc = 0; // number of charged MC particles which satisfy cuts (except PID)
-  Int_t nReco = 0; // number of reco tracks which satisfy cuts (except PID)
-
-  //MC Loop
-  TClonesArray *arrayMC = 0;
-  if (fIsMC)
-    {
-      arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());
-      if (!arrayMC) {
-       AliFatal("Error: MC particles branch not found!\n");
-      }
-
-
-      Int_t nMC = arrayMC->GetEntries();
-      for (Int_t iMC = 0; iMC < nMC; iMC++)
-       {
-         AliAODMCParticle *partMC = (AliAODMCParticle*) arrayMC->At(iMC);
-
-         if(partMC->Pt()<fPtCut) continue;
-         if(partMC->Eta()>fTrackCuts->GetEtaMax() || partMC->Eta()<fTrackCuts->GetEtaMin() ) continue;
-
-         // PDG codes: pion(211), kaon(+/-321), proton(2212), phi(333)
-
-         // make pt spectrum of only MC phis that decay to k+k-
-         if(partMC->GetPdgCode()==333)
-           {
-             if(partMC->GetNDaughters()==2)
-               {
-                 if(TMath::Abs(((AliAODMCParticle*) arrayMC->At(TMath::Abs(partMC->GetDaughter(0))))->GetPdgCode()) == 321 && TMath::Abs(((AliAODMCParticle*) arrayMC->At(TMath::Abs(partMC->GetDaughter(1))))->GetPdgCode()) == 321)
-                   {
-                     AliAODMCParticle *d1 = (AliAODMCParticle*) arrayMC->At(TMath::Abs(partMC->GetDaughter(0)));
-                     AliAODMCParticle *d2 = (AliAODMCParticle*) arrayMC->At(TMath::Abs(partMC->GetDaughter(1)));
-                     if(d1->Charge() > 0) hKcorr->Fill(partMC->Pt(),d1->Pt(),d2->Pt());
-                     else hKcorr->Fill(partMC->Pt(),d2->Pt(),d1->Pt());
-                     TLorentzVector *d3 = (TLorentzVector*)makePhi(d1,d2);
-                     // InvMass, pt, y, eta, phi, pair ID
-                     Double_t invMass = (d3->M2() > 0 ? sqrt(d3->M2()) : 0);
-                     if(invMass < 1.11)
-                       {
-                         Double_t varfill1[7] = {invMass, d3->Pt(), d3->Rapidity(), cent, d3->Eta(), (d3->Phi() > 0 ? d3->Phi() : d3->Phi()+2*TMath::Pi()), 0};
-                         hPairMcPhi->Fill(varfill1);
-                         if(d1->Pt()>fPtCut && d2->Pt()>fPtCut && d1->Eta()<fTrackCuts->GetEtaMax() && d1->Eta()>fTrackCuts->GetEtaMin() && d2->Eta()<fTrackCuts->GetEtaMax() && d2->Eta()>fTrackCuts->GetEtaMin())
-                           hPairMcPhiCuts->Fill(varfill1);
-                       }
-                     delete d3;
-                   }
-               }
-           }
-
-         if(partMC->Charge()==0) continue; // remove neutrals
-         if(!partMC->IsPhysicalPrimary()) continue;  // need to remove all non-final state particles
-
-         nMc++;
-
-         Int_t mcID = fHelperPID->GetParticleSpecies(partMC);
-         if(fDoPID && (mcID>3 || mcID < -3)) continue;
-         // PID ID, pt, y, eta, phi
-         Double_t varfill2[6] = {static_cast<Double_t>((partMC->Charge() > 0 ? mcID+1 : -1*(mcID+1))), partMC->Pt(), partMC->Y(), cent, partMC->Eta(), partMC->Phi()};
-         hTrackMc->Fill(varfill2);
-
-         if(!fDoPID || mcID == 1)
-           {
-             if(partMC->Charge() > 0) kaonsPosMc->Add(partMC);
-             else if(partMC->Charge() < 0) kaonsNegMc->Add(partMC);
-           }
-         
-       } // end MC track loop
-      
-      UnlikeSign(kaonsPosMc,kaonsNegMc,hPairMc,cent);
-      LikeSign(kaonsPosMc,kaonsNegMc,hPairMc,cent);
-    }
-
-
-  //track loop
-  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
-    AliAODTrack* track = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iTracks));
-    if(!track) AliFatal("Not a standard AOD");
-    if (!fTrackCuts->IsSelected(track,kTRUE)) continue;
-    if(track->Charge()==0) continue;
-    if(track->Pt()<fPtCut) continue;
-    if(track->Eta()>fTrackCuts->GetEtaMax() || track->Eta()<fTrackCuts->GetEtaMin()) continue;
-
-    nReco++;
-
-    Int_t dataID=fHelperPID->GetParticleSpecies(track,kTRUE);
-    if(fDoPID && (dataID>3 || dataID < -3)) continue;
-
-    // PID ID, pt, y, eta, phi
-    Double_t varfill3[6] = {static_cast<Double_t>((track->Charge() > 0 ? dataID+1 : -1*(dataID+1))), track->Pt(), track->Y(), cent, track->Eta(), track->Phi()};
-    hTrackReco->Fill(varfill3);
-
-    if(!fDoPID || dataID==1)
-      {
-       if(track->Charge() > 0) kaonsPosData->Add(track);
-       else if(track->Charge() < 0) kaonsNegData->Add(track);
-      }
-
-    if (fIsMC)
-      {
-       Int_t mcLabel = track->GetLabel();
-       AliAODMCParticle* tempMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(mcLabel));
-       if(!tempMC)
-         {
-           AliError("Cannot get MC particle");
-           continue; 
-         }
-       
-       Int_t genID = fHelperPID->GetParticleSpecies(tempMC);
-       if(fDoPID && (genID != dataID)) continue;
-       if(fDoPID && (genID>3 || genID < -3)) continue;
-
-       // PID ID, pt, y, eta, phi
-       Double_t varfill4[6] = {static_cast<Double_t>((track->Charge() > 0 ? genID+1 : -1*(genID+1))), track->Pt(), track->Y(), cent, track->Eta(), track->Phi()};
-       hTrackMatch->Fill(varfill4);
-
-       if(genID==1)
-         {
-           Int_t motherId = TMath::Abs(tempMC->GetMother());
-           
-           AliAODMCParticle* genMother = (AliAODMCParticle*)arrayMC->At(motherId);
-           if(!genMother) continue;
-           
-           if(genMother->GetPdgCode() != 333) continue;
-           
-           if(track->Charge() > 0)
-             {
-               for(Int_t k = 0; k < kaonsNegGen->GetEntriesFast(); k++)
-                 {
-                   AliVParticle* tempGenMatch = (AliVParticle*)kaonsNegGen->UncheckedAt(k);
-                   AliAODMCParticle* tempMatchMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(tempGenMatch->GetLabel()));
-                   if(!tempMatchMC) continue;
-                   if(tempMatchMC->GetMother() != motherId) continue;
-                   
-                   TLorentzVector*c = (TLorentzVector*)makePhi(track,tempGenMatch);
-                   Double_t invMass = (c->M2() > 0 ? sqrt(c->M2()) : 0);
-                   if(invMass < 1.11)
-                     {
-                       Double_t fillgen[7] = {invMass, c->Pt(), c->Rapidity(), cent, c->Eta(), (c->Phi() > 0 ? c->Phi() : c->Phi()+2*TMath::Pi()), 0};
-                       hPairMatch->Fill(fillgen);
-                     }
-                   delete c;
-                 } 
-             }
-           else if(track->Charge() < 0)
-             {
-               for(Int_t k = 0; k < kaonsPosGen->GetEntriesFast(); k++)
-                 {
-                   AliVParticle* tempGenMatch = (AliVParticle*)kaonsPosGen->UncheckedAt(k);
-                   AliAODMCParticle* tempMatchMC = (AliAODMCParticle*) arrayMC->At(TMath::Abs(tempGenMatch->GetLabel()));
-                   if(!tempMatchMC) continue;
-                   if(tempMatchMC->GetMother() != motherId) continue;
-                   
-                   TLorentzVector*c = (TLorentzVector*)makePhi(track,tempGenMatch);
-                   Double_t invMass = (c->M2() > 0 ? sqrt(c->M2()) : 0);
-                   if(invMass < 1.11)
-                     {
-                       Double_t fillgen2[7] = {invMass, c->Pt(), c->Rapidity(), cent, c->Eta(), (c->Phi() > 0 ? c->Phi() : c->Phi()+2*TMath::Pi()), 0};
-                       hPairMatch->Fill(fillgen2);
-                     }
-                   delete c;
-                 }
-             }
-           
-           if(track->Charge() > 0) kaonsPosGen->Add(track);
-           else if(track->Charge() < 0) kaonsNegGen->Add(track);
-         }
-      }
-       
-  } // end loop on tracks
-  
-  UnlikeSign(kaonsPosData,kaonsNegData,hPairReco,cent);
-  LikeSign(kaonsPosData,kaonsNegData,hPairReco,cent);
-  
-  Double_t varfill5[4] = {cent, fAOD->GetPrimaryVertex()->GetZ(), static_cast<Double_t>(nMc), static_cast<Double_t>(nReco)};
-  hEvent->Fill(varfill5);
-
-  kaonsPosMc->Clear();
-  kaonsNegMc->Clear();
-  kaonsPosData->Clear();
-  kaonsNegData->Clear();
-  kaonsPosGen->Clear();
-  kaonsNegGen->Clear();
-
-  if(kaonsPosMc) delete kaonsPosMc;
-  if(kaonsNegMc) delete kaonsNegMc;
-  if(kaonsPosData) delete kaonsPosData;
-  if(kaonsNegData) delete kaonsNegData;
-  if(kaonsPosGen) delete kaonsPosGen;
-  if(kaonsNegGen) delete kaonsNegGen;
-
-  PostData(1,fOutput);
-  PostData(2, fHelperPID);
-  PostData(3, fEventCuts);
-  PostData(4, fTrackCuts);
-  //Printf("............. end of Exec");
-  
-}
-
-//_________________________________________________________________
-void   AliAnalysisTaskPhiEffMc::Terminate(Option_t *)
-{
-  // Terminate analysis
-  //
-  fOutput = dynamic_cast<TList*>(GetOutputData(1));
-  if (!fOutput) {
-    printf("ERROR: fOutput not available\n");
-    return;
-  } 
-  
-    printf("AliAnalysisTaskPhiEffMc: Terminate() \n");
-  
-}
-
-//_________________________________________________________________
-void AliAnalysisTaskPhiEffMc::UnlikeSign(TObjArray* kaonsPos, TObjArray* kaonsNeg, THnSparseF* h, Double_t cent)
-{
-  Int_t countPos = kaonsPos->GetEntriesFast();
-  Int_t countNeg = kaonsNeg->GetEntriesFast();
-
-  if(countPos+countNeg < 2) return;
-
-  for(Int_t cp = 0; cp < countPos; cp++) // form k+k- pairs and compute invariant mass
-    {
-      AliVParticle* temp1 = (AliVParticle*)kaonsPos->UncheckedAt(cp);
-      for(Int_t cn = 0; cn < countNeg; cn++)
-       {
-         AliVParticle* temp2 = (AliVParticle*)kaonsNeg->UncheckedAt(cn);
-         TLorentzVector*c = (TLorentzVector*)makePhi(temp1,temp2);
-         // InvMass, pt, y, eta, phi, pair ID
-         Double_t invMass = (c->M2() > 0 ? sqrt(c->M2()) : 0);
-         if(invMass < 1.11)
-           {
-             Double_t varfill[7] = {invMass, c->Pt(), c->Rapidity(), cent, c->Eta(), (c->Phi() > 0 ? c->Phi() : c->Phi()+2*TMath::Pi()), 0};
-             h->Fill(varfill);
-           }
-         delete c;
-       }
-    }
-}
-
-void AliAnalysisTaskPhiEffMc::LikeSign(TObjArray* kaonsPos, TObjArray* kaonsNeg, THnSparseF* h, Double_t cent)
-{
-  Int_t countPos = kaonsPos->GetEntriesFast();
-  Int_t countNeg = kaonsNeg->GetEntriesFast();
-
-  if(countPos < 2 && countNeg < 2) return;
-
-  for(Int_t cp = 0; cp < countPos; cp++) // form k+k+ pairs and compute invariant mass
-    {
-      AliVParticle* temp1 = (AliVParticle*)kaonsPos->UncheckedAt(cp);
-      for(Int_t cn = cp+1; cn < countPos; cn++)
-       {
-         AliVParticle* temp2 = (AliVParticle*)kaonsPos->UncheckedAt(cn);
-         TLorentzVector*c = (TLorentzVector*)makePhi(temp1,temp2);
-         // InvMass, pt, y, eta, phi, pair ID
-         Double_t invMass = (c->M2() > 0 ? sqrt(c->M2()) : 0);
-         if(invMass < 1.11)
-           {
-             //cout << "y = " << 0.5*log((c->E()+c->Pz())/(c->E()-c->Pz())) << "   " << c->Rapidity() << endl;
-             //cout << "eta = " << -1.*log(tan(c->Theta()/2.)) << "   " << c->Eta() << endl;
-             Double_t varfill1[7] = {invMass, c->Pt(), c->Rapidity(), cent, c->Eta(), (c->Phi() > 0 ? c->Phi() : c->Phi()+2*TMath::Pi()), 1};
-             h->Fill(varfill1);
-           }
-         delete c;
-       }
-    }
-  for(Int_t cp = 0; cp < countNeg; cp++) // form k-k- pairs and compute invariant mass
-    {
-      AliVParticle* temp1 = (AliVParticle*)kaonsNeg->UncheckedAt(cp);
-      for(Int_t cn = cp+1; cn < countNeg; cn++)
-       {
-         AliVParticle* temp2 = (AliVParticle*)kaonsNeg->UncheckedAt(cn);
-         TLorentzVector*c = (TLorentzVector*)makePhi(temp1,temp2);
-         Double_t invMass = (c->M2() > 0 ? sqrt(c->M2()) : 0);
-         if(invMass < 1.11)
-           {
-             Double_t varfill2[7] = {invMass, c->Pt(), c->Rapidity(), cent, c->Eta(), (c->Phi() > 0 ? c->Phi() : c->Phi()+2*TMath::Pi()), 2};
-             h->Fill(varfill2);
-           }
-         delete c;
-       } 
-    }
-}
-
-TLorentzVector* AliAnalysisTaskPhiEffMc::makePhi(AliVParticle* p1, AliVParticle* p2)
-{
-  TLorentzVector* a = new TLorentzVector(p1->Px(),p1->Py(),p1->Pz(),sqrt(pow(p1->P(),2)+pow(4.93676999999999977e-01, 2)));
-  TLorentzVector* b = new TLorentzVector(p2->Px(),p2->Py(),p2->Pz(),sqrt(pow(p2->P(),2)+pow(4.93676999999999977e-01, 2)));
-  TLorentzVector* c = new TLorentzVector((*a)+(*b));
-  delete a;
-  delete b;
-  return c;
-}
-
diff --git a/PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.h b/PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.h
deleted file mode 100644 (file)
index 2934999..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef ALIANALYSISTASKPHIEFFMC_H
-#define ALIANALYSISTASKPHIEFFMC_H
-
-class TH1F;
-class TH2F;
-class TH3F;
-class THnSparse;
-class AliAODEvent;
-
-#include "AliAnalysisTaskSE.h"
-#include "AliHelperPID.h"
-#include "AliAnalyseLeadingTrackUE.h"
-class AliHelperPID;
-class AliSpectraAODTrackCuts;
-class AliSpectraAODEventCuts;
-class AliAnalyseLeadingTrackUE;
-
-class AliAnalysisTaskPhiEffMc : public AliAnalysisTaskSE
-{
- public:
-  
-  // constructors
- AliAnalysisTaskPhiEffMc() : AliAnalysisTaskSE(), 
-    fAOD(0x0),
-    fIsMC(0),
-    fOutput(0x0),
-    fHelperPID(0x0),
-    fTrackCuts(0x0),
-    fEventCuts(0x0),
-    fPtCut(0.),
-    fDoPID(kTRUE)
-      {}
-  AliAnalysisTaskPhiEffMc(const char *name);
-  virtual ~AliAnalysisTaskPhiEffMc() {}
-  
-  void SetIsMC(Bool_t isMC = kFALSE)    {fIsMC = isMC; }
-  Bool_t GetIsMC()           const           { return fIsMC;}
-  
-  virtual void   UserCreateOutputObjects();
-  virtual void   UserExec(Option_t *option);
-  virtual void   Terminate(Option_t *);
-  
-  void SetHelperPID(AliHelperPID* pid)                     { fHelperPID = pid; }
-  AliHelperPID                   * GetHelperPID()          { return fHelperPID; }
-
-  AliSpectraAODTrackCuts      * GetTrackCuts()         {  return fTrackCuts; }
-  AliSpectraAODEventCuts      * GetEventCuts()         {  return fEventCuts; }
-  void SetTrackCuts(AliSpectraAODTrackCuts * tc)       { fTrackCuts = tc; }
-  void SetEventCuts(AliSpectraAODEventCuts * vc)       { fEventCuts = vc; }
-
-  void UnlikeSign(TObjArray* kaonsPos, TObjArray* kaonsNeg, THnSparseF* h, Double_t cent = -1);
-  void LikeSign(TObjArray* kaonsPos, TObjArray* kaonsNeg, THnSparseF* h, Double_t cent = -1);
-  TLorentzVector* makePhi(AliVParticle* p1, AliVParticle* p2);
-
-  void SetPtCut(Double_t ptcut){fPtCut = ptcut;}
-  void SetDoPID(Bool_t dopid){fDoPID = dopid;}
-  Double_t GetPtCut(){return fPtCut;}
-  Bool_t GetDoPID(){return fDoPID;}
-
- private:
-  
-  AliAODEvent           *fAOD;         //! AOD object
-  Bool_t          fIsMC;// true if processing MC
-  TList *fOutput; //! tlist with output  
-  AliHelperPID                * fHelperPID;     // points to class for PID
-  AliSpectraAODTrackCuts      * fTrackCuts;     // Track Cuts
-  AliSpectraAODEventCuts      * fEventCuts;     // Event Cuts
-
-  Double_t fPtCut;  // min pt cut on tracks (pt cut in AliSpectraAODTrackCuts is max pt)
-  Bool_t fDoPID; // true -- do PID to select kaons, false -- no PID
-
-  AliAnalysisTaskPhiEffMc(const AliAnalysisTaskPhiEffMc&);
-  AliAnalysisTaskPhiEffMc& operator=(const AliAnalysisTaskPhiEffMc&);
-  
-  ClassDef(AliAnalysisTaskPhiEffMc, 3);
-};
-
-#endif
index 5ccb44760633fe0dce2b8889b38fab8dac596b07..849be0b93c0dcf87a171f2c103d260fc3d5b3b42 100644 (file)
@@ -59,6 +59,7 @@ AliJJetJtAnalysis::AliJJetJtAnalysis():
     , fTrkPtBin()
     , fTrkLimPtBin()
     , fdRBin()
+    , fiHist()
     , fhNumber()
     , fhKNumber()
     , fhJetPt()
@@ -84,6 +85,13 @@ AliJJetJtAnalysis::AliJJetJtAnalysis():
     , fhBgLogJtWeightBin()
     , fhBgJtWithPtCutWeightBinBin()
     , fhBgLogJtWithPtCutWeightBinBin()
+    , fhBgJtWithPtCutWeightBinBinSmallerR()
+    , fhBgLogJtWithPtCutWeightBinBinSmallerR()
+    , fhBgJtWithPtCutWeightBinBinDiffR()
+    , fhBgLogJtWithPtCutWeightBinBinDiffR()
+    , fhBgJtBinLimBin()
+    , fhBgJtWeightBinLimBin()
+    , fhBgLogJtWeightBinLimBin()
     , fhdeltaE()
     , fhdeltaN()
     , fhFullJetEChJetBin()
@@ -121,6 +129,7 @@ AliJJetJtAnalysis::AliJJetJtAnalysis( AliJCard * card ):
     , fTrkPtBin()
     , fTrkLimPtBin()
     , fdRBin()
+    , fiHist()
     , fhNumber()
     , fhKNumber()
     , fhJetPt()
@@ -146,6 +155,13 @@ AliJJetJtAnalysis::AliJJetJtAnalysis( AliJCard * card ):
     , fhBgLogJtWeightBin()
     , fhBgJtWithPtCutWeightBinBin()
     , fhBgLogJtWithPtCutWeightBinBin()
+    , fhBgJtWithPtCutWeightBinBinSmallerR()
+    , fhBgLogJtWithPtCutWeightBinBinSmallerR()
+    , fhBgJtWithPtCutWeightBinBinDiffR()
+    , fhBgLogJtWithPtCutWeightBinBinDiffR()
+    , fhBgJtBinLimBin()
+    , fhBgJtWeightBinLimBin()
+    , fhBgLogJtWeightBinLimBin()
     , fhdeltaE()
     , fhdeltaN()
     , fhFullJetEChJetBin()
@@ -183,6 +199,7 @@ AliJJetJtAnalysis::AliJJetJtAnalysis(const AliJJetJtAnalysis& ap) :
     , fTrkPtBin(ap.fTrkPtBin)
     , fTrkLimPtBin(ap.fTrkLimPtBin)
     , fdRBin(ap.fdRBin)
+    , fiHist(ap.fiHist)
     , fhNumber(ap.fhNumber)
     , fhKNumber(ap.fhKNumber)
     , fhJetPt(ap.fhJetPt)
@@ -208,6 +225,13 @@ AliJJetJtAnalysis::AliJJetJtAnalysis(const AliJJetJtAnalysis& ap) :
     , fhBgLogJtWeightBin(ap.fhBgLogJtWeightBin)
     , fhBgJtWithPtCutWeightBinBin(ap.fhBgJtWithPtCutWeightBinBin)
     , fhBgLogJtWithPtCutWeightBinBin(ap.fhBgLogJtWithPtCutWeightBinBin)
+    , fhBgJtWithPtCutWeightBinBinSmallerR(ap.fhBgJtWithPtCutWeightBinBinSmallerR)
+    , fhBgLogJtWithPtCutWeightBinBinSmallerR(ap.fhBgLogJtWithPtCutWeightBinBinSmallerR)
+    , fhBgJtWithPtCutWeightBinBinDiffR(ap.fhBgJtWithPtCutWeightBinBinDiffR)
+    , fhBgLogJtWithPtCutWeightBinBinDiffR(ap.fhBgLogJtWithPtCutWeightBinBinDiffR)
+    , fhBgJtBinLimBin(ap.fhBgJtBinLimBin)
+    , fhBgJtWeightBinLimBin(ap.fhBgJtWeightBinLimBin)
+    , fhBgLogJtWeightBinLimBin(ap.fhBgLogJtWeightBinLimBin)
     , fhdeltaE(ap.fhdeltaE)
     , fhdeltaN(ap.fhdeltaN)
     , fhFullJetEChJetBin(ap.fhFullJetEChJetBin)
@@ -257,8 +281,10 @@ void AliJJetJtAnalysis::UserCreateOutputObjects(){
     fDeltaRBorders = fCard->GetVector("DeltaRBorders");
 
        fEfficiency = new AliJEfficiency();
-       fEfficiency->SetMode( fCard->Get("EfficiencyMode") ); // 0:NoEff, 1:Period 2:RunNum 3:Auto
-       fEfficiency->SetDataPath("alien:///alice/cern.ch/user/d/djkim/legotrain/efficieny/data"); // Efficiency root file location local or alien
+    // 0:NoEff, 1:Period 2:RunNum 3:Auto
+       fEfficiency->SetMode( fCard->Get("EfficiencyMode") );
+    // Efficiency root file location local or alien
+       fEfficiency->SetDataPath("alien:///alice/cern.ch/user/d/djkim/legotrain/efficieny/data"); 
 
     TRegexp reg("R[0-9][0-9][0-9]");
     TRegexp reg2("[0-9][0-9][0-9]");
@@ -268,9 +294,6 @@ void AliJJetJtAnalysis::UserCreateOutputObjects(){
     nJetContainer = fJetFinderName.size();
     fJetBgListOfList.resize(nJetContainer, TClonesArray("AliJJet",100));
        for (int i=0; i<nJetContainer; i++){
-               //AliJJetJtHistos *histo = new AliJJetJtHistos(fCard);
-               //histo->CreateJetJtHistos();
-       //      fHistos.push_back( histo  );
         TString fullNameOfiJetContainer(fJetFinderName[i]);
         TString coneSizeName (fullNameOfiJetContainer(reg));
         TString coneSizeValue (coneSizeName(reg2));
@@ -291,20 +314,24 @@ void AliJJetJtAnalysis::UserCreateOutputObjects(){
     fTrkPtBin .Set("TrkPtBin","TrkPt","p_{T,constituent}:%.1f-%.1f").SetBin(fCard->GetVector("JetAssocPtBorders"));
     fTrkLimPtBin .Set("TrkLimitPtBin","TrkLimitPt","p_{T,Limit}<%.1f", AliJBin::kSingle).SetBin(fJetConstPtLowLimits->GetNoElements());
     fdRBin.Set("dRBin","dR","dR : %.1f - %.1f ").SetBin(fCard->GetVector("DeltaRBorders"));
+    fiHist.Set("iHist","iHist","iHist : %d ", AliJBin::kSingle).SetBin(10);
 
     fhNumber
-        << TH1D("hNumber","Number",6,0,6) << fJetFinderBin
+        << TH1D("hNumber","Number",6,0,6)
+        << fJetFinderBin
         <<"END";
-
     fhKNumber
-        << TH1D("hKNumber","KNumber",17,0,17) << fJetFinderBin
+        << TH1D("hKNumber","KNumber",17,0,17)
+        << fJetFinderBin
         <<"END";
 
     fhJetPt 
-        << TH1D("JetPt","",NBINS, LogBinsX ) << fJetFinderBin
+        << TH1D("JetPt","",NBINS, LogBinsX ) 
+        << fJetFinderBin
         <<"END";
     fhJetPtBin 
-        << TH1D("JetPtBin","",NBINS, LogBinsX ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("JetPtBin","",NBINS, LogBinsX ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
 
     int NBINSZ=150;
@@ -313,10 +340,12 @@ void AliJJetJtAnalysis::UserCreateOutputObjects(){
     for(int ij=0;ij<=NBINSZ;ij++) LogBinsZ[ij]=LimLZ*exp(ij*logBWZ);//
 
     fhZ 
-        << TH1D("Z","",NBINSZ, LogBinsZ ) << fJetFinderBin
+        << TH1D("Z","",NBINSZ, LogBinsZ ) 
+        << fJetFinderBin
         <<"END";
     fhZBin 
-        << TH1D("ZBin","",NBINSZ, LogBinsZ ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("ZBin","",NBINSZ, LogBinsZ ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
 
     int NBINSJt=150;
@@ -327,83 +356,133 @@ void AliJJetJtAnalysis::UserCreateOutputObjects(){
     double LimLJtW=TMath::Log(0.01), LimHJtW=TMath::Log(10);
 
     fhJt 
-        << TH1D("Jt","",NBINSJt, LogBinsJt ) << fJetFinderBin
+        << TH1D("Jt","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin
         <<"END";
     fhJtBin 
-        << TH1D("JtBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("JtBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
     fhJtWeightBin 
-        << TH1D("JtWeightBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("JtWeightBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
     fhLogJtWeightBin 
-        << TH1D("LogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("LogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
 
     fhJtWithPtCutWeightBinBin 
-        << TH1D("JtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
+        << TH1D("JtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkPtBin
         <<"END";
     fhLogJtWithPtCutWeightBinBin 
-        << TH1D("LogJtWeightBinBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
+        << TH1D("LogJtWeightBinBin","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkPtBin
         <<"END";
 
     fhJtBinLimBin 
-        << TH1D("JtBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
+        << TH1D("JtBinLimBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
         <<"END";
     fhJtWeightBinLimBin 
-        << TH1D("JtWeightBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
+        << TH1D("JtWeightBinLimBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
         <<"END";
     fhLogJtWeightBinLimBin 
-        << TH1D("LogJtWeightBinLimBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
+        << TH1D("LogJtWeightBinLimBin","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
         <<"END";
 
     fhJetBgPt 
-        << TH1D("JetBgPt","",NBINS, LogBinsX ) << fJetFinderBin
+        << TH1D("JetBgPt","",NBINS, LogBinsX ) 
+        << fJetFinderBin
         <<"END";
     fhJetBgPtBin 
-        << TH1D("JetBgPtBin","",NBINS, LogBinsX ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("JetBgPtBin","",NBINS, LogBinsX ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
     fhBgZ 
-        << TH1D("BgZ","",NBINSZ, LogBinsZ ) << fJetFinderBin
+        << TH1D("BgZ","",NBINSZ, LogBinsZ ) 
+        << fJetFinderBin
         <<"END";
     fhBgZBin 
-        << TH1D("BgZBin","",NBINSZ, LogBinsZ ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("BgZBin","",NBINSZ, LogBinsZ ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
 
 
     fhBgJt 
-        << TH1D("BgJt","",NBINSJt, LogBinsJt ) << fJetFinderBin
+        << TH1D("BgJt","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin
         <<"END";
     fhBgJtBin 
-        << TH1D("BgJtBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("BgJtBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
     fhBgJtWeightBin 
-        << TH1D("BgJtWeightBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("BgJtWeightBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
     fhBgLogJtWeightBin 
-        << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin
+        << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fJetFinderBin << fJetTriggerBin
         <<"END";
 
     fhBgJtWithPtCutWeightBinBin 
-        << TH1D("BgJtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
+        << TH1D("BgJtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkPtBin
         <<"END";
     fhBgLogJtWithPtCutWeightBinBin 
-        << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
+        << TH1D("BgLogJtWeightBinBin","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkPtBin
+        <<"END";
+
+    fhBgJtWithPtCutWeightBinBinSmallerR
+        << TH1D("BgJtWithPtCutWeightBinBinSmallerR","",NBINSJt, LogBinsJt ) 
+        << fiHist << fJetTriggerBin << fTrkPtBin 
+        <<"END";
+    fhBgLogJtWithPtCutWeightBinBinSmallerR 
+        << TH1D("BgLogJtWeightBinBinBinSmallerR","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fiHist << fJetTriggerBin << fTrkPtBin 
+        <<"END";
+
+    fhBgJtWithPtCutWeightBinBinDiffR
+        << TH1D("BgJtWithPtCutWeightBinBinDiffR","",NBINSJt, LogBinsJt ) 
+        << fiHist << fJetTriggerBin << fTrkPtBin 
+        <<"END";
+    fhBgLogJtWithPtCutWeightBinBinDiffR 
+        << TH1D("BgLogJtWeightBinBinBinDiffR","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fiHist << fJetTriggerBin << fTrkPtBin 
+        <<"END";
+
+    fhBgJtBinLimBin 
+        << TH1D("BgJtBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin 
+        << fJetTriggerBin << fTrkLimPtBin
+        <<"END";
+    fhBgJtWeightBinLimBin 
+        << TH1D("BgJtWeightBinLimBin","",NBINSJt, LogBinsJt ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
+        <<"END";
+    fhBgLogJtWeightBinLimBin 
+        << TH1D("BgLogJtWeightBinLimBin","",NBINSJtW, LimLJtW, LimHJtW ) 
+        << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
         <<"END";
 
     
     int NBINSdeltaN=40;
     double LimLdeltaN=-19.5, LimHdeltaN=19.5;
+   
     fhdeltaN
     << TH1D("hdeltaN","",NBINSdeltaN,LimLdeltaN,LimHdeltaN )
     << fJetTriggerBin << fdRBin <<"END";
 
     int NBINSdeltaE=400;
     double LimLdeltaE=-20, LimHdeltaE=20;
+
     fhdeltaE
     << TH1D("hdeltaE","",NBINSdeltaE,LimLdeltaE,LimHdeltaE )
     << fJetTriggerBin << fdRBin <<"END";
-
-
     fhFullJetEChJetBin 
         << TH1D("hFullJetEChJetBin","",NBINS, LogBinsX )  << fJetTriggerBin
         <<"END";
@@ -412,14 +491,13 @@ void AliJJetJtAnalysis::UserCreateOutputObjects(){
     fhFullChdRChJetBin 
         << TH1D("hFullChdRChJetBin","",nDR,xDR0,xDR1)  << fJetTriggerBin
         <<"END";
-
     fh2DFullEvsChEdN0
         << TH2D("h2DFullEvsChEdN0","",NBINS, LogBinsX, NBINS, LogBinsX )  
         <<"END";
-
     fh2DFullEvsChEdNnot0
         << TH2D("h2DFullEvsChEdNnot0","",NBINS, LogBinsX, NBINS, LogBinsX )  
         <<"END";
+
     fHMG->Print();
     fHMG->WriteConfig();
 
@@ -443,6 +521,25 @@ void AliJJetJtAnalysis::UserExec(){
         this->FillJtHistogram(Jets,i);
     }
 
+    //The Function should be called after calling "FillJtHistogram"
+    //FillBgJtWithSmallerR(Bg jet finder array, old R, new R )
+    //fJetBgListOfList[i] where {i=0-5;full0.4,full0.5,full0.6,Ch0.4,Ch0.5,Ch0.6}
+    //Caution!! these array number should be changed WHEN jet finders change
+    this->FillBgJtWithSmallerR(fJetBgListOfList[1], 1, 0.4,0);
+    this->FillBgJtWithSmallerR(fJetBgListOfList[2], 2, 0.4,1);
+    this->FillBgJtWithSmallerR(fJetBgListOfList[2], 2, 0.5,2);
+    this->FillBgJtWithSmallerR(fJetBgListOfList[4], 4, 0.4,3);
+    this->FillBgJtWithSmallerR(fJetBgListOfList[5], 5, 0.4,4);
+    this->FillBgJtWithSmallerR(fJetBgListOfList[5], 5, 0.5,5);
+   
+    //Fill jt with diff cone axes (old axis iContainer, new axis, iHist) 
+    this->FillBgJtWithDiffAxes(1, 0,0);
+    this->FillBgJtWithDiffAxes(2, 0,1);
+    this->FillBgJtWithDiffAxes(2, 1,2);
+    this->FillBgJtWithDiffAxes(4, 3,0);
+    this->FillBgJtWithDiffAxes(5, 3,1);
+    this->FillBgJtWithDiffAxes(5, 4,2);
+    //End.
 
     int iS1 = 0; //full 0.4
     int iS2 = 3; //Ch   0.4
@@ -458,8 +555,6 @@ void AliJJetJtAnalysis::UserExec(){
         jet1 = dynamic_cast<AliJJet*>( jetfinder1->At(ijet) );
         if (!jet1) continue;
         for (int jjet = 0; jjet<jetfinder2->GetEntriesFast(); jjet++){
-            cout<<"Check new system is working"<<endl;
-            cout<<"Check new system is working2"<<endl;
             jet2 = dynamic_cast<AliJJet*>( jetfinder2->At(jjet) );
             if (!jet2) continue;
             chEbin = GetBin(fJetTriggPtBorders,jet2->E());
@@ -492,9 +587,9 @@ void AliJJetJtAnalysis::WriteHistograms(){
 
     for (int i=0; i<nJetContainer; i++){
         TDirectory *nwd = gDirectory->mkdir(fJetFinderName[i]);
-        nwd->cd();
-        //fHistos[i]->WriteHistograms();
-        cwd->cd();
+        //Under the folder name, save objects
+        //nwd->cd();
+        //cwd->cd();
     }
 
 
@@ -505,10 +600,6 @@ void AliJJetJtAnalysis::WriteHistograms(){
 void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
 {      
 
-
-
-
-
     int iBin, iptaBin=0;
     int jBin=0;
     double pT = 0;
@@ -550,14 +641,13 @@ void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
             if (con->Pt()>conPtMax) conPtMax = con->Pt();
         }
 
-        for (int ii = fJetConstPtLowLimits->GetNoElements(); ii >= 1 ; ii--)   {       // could also be done using GetBin( ... )
-            if (conPtMax > (*fJetConstPtLowLimits)[ii]) {               // if JetConstPtLowLimits={a,...,b} -> ConPtBinBorders={a,...,b,c}
-                jBin = ii-1;                                                              // where c(>>b) is ''sufficiently'' high
+        for (int ii = fJetConstPtLowLimits->GetNoElements(); ii >= 1 ; ii--){   
+            if (conPtMax > (*fJetConstPtLowLimits)[ii]) {               
+                jBin = ii-1;                                               
                 break;
             }
         }
 
-
         //iConstituent loop for the iJet
         //jt, z are calcualted and filled  
         for (int icon = 0; icon<jet->GetConstituents()->GetEntries(); icon++){
@@ -576,19 +666,22 @@ void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
             fhJt[iContainer]->Fill( jt , effCorrection);
             fhJtBin[iContainer][iBin]->Fill( jt , effCorrection);
             fhJtWeightBin[iContainer][iBin]->Fill( jt, 1.0/jt * effCorrection );
-            fhLogJtWeightBin[iContainer][iBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
+            fhLogJtWeightBin[iContainer][iBin]
+                ->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
 
 
 
-            if (iptaBin < 0) continue;
-            fhJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( jt, 1.0/jt * effCorrection );
-            fhLogJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection);
+            fhJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]
+                ->Fill( jt, 1.0/jt * effCorrection );
+            fhLogJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]
+                ->Fill( TMath::Log(jt), 1.0/jt * effCorrection);
 
             for (int jj = 0; jj <= jBin ; jj++) {
                 fhJtBinLimBin[iContainer][iBin][jj]->Fill( jt, effCorrection );
-                fhJtWeightBinLimBin[iContainer][iBin][jj]->Fill( jt, 1.0/jt * effCorrection );
-                fhLogJtWeightBinLimBin[iContainer][iBin][jj]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
-                //histos->fHistosJT[0][0][iBin][jj]->Fill( TMath::Log(jt), 1.0/jt );
+                fhJtWeightBinLimBin[iContainer][iBin][jj]
+                    ->Fill( jt, 1.0/jt * effCorrection );
+                fhLogJtWeightBinLimBin[iContainer][iBin][jj]
+                    ->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
             }
 
         }
@@ -602,7 +695,8 @@ void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
         //if (Log )cout<<"Rs[order] = "<<Rs[order]<<" R = "<<R<<" Bg R area : "<<R_area<<endl;
 
         //Background jet (iBgJet) will be produced. This background jet is orthogonal to the iJet.  
-        //If there is another jJet, then iBgJet will be consecutevely moved not to have jJet in the cone size. 
+        //If there is another jJet, then iBgJet will be consecutevely moved not to 
+        //have jJet in the cone size. 
         if (Jets->GetEntries()>1){
             fhNumber[iContainer]->Fill(3.5);
             for (int j = 0; j<Jets->GetEntries(); j++){
@@ -648,7 +742,7 @@ void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
             if( iBin < 0 ) continue;
             fhJetBgPtBin[iContainer][iBin]->Fill( pT );
 
-
+            
             for (int icon = 0; icon<fTracks->GetEntries(); icon++){
                 AliJBaseTrack *track = dynamic_cast<AliJBaseTrack*>(fTracks->At(icon));
                 if (!track) continue;
@@ -678,14 +772,131 @@ void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
                 fhBgLogJtWeightBin[iContainer][iBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
 
                 if (iptaBin < 0) continue;
-                fhBgJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( jt, 1.0/jt * effCorrection );
-                fhBgLogJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
-            } 
+                fhBgJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]
+                    ->Fill( jt, 1.0/jt * effCorrection );
+                fhBgLogJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]
+                    ->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
+            }
+            
+            for (int ii = fJetConstPtLowLimits->GetNoElements(); ii >= 1 ; ii--)   {     
+                if (maxconpt > (*fJetConstPtLowLimits)[ii]) {   
+                    jBin = ii-1;
+                    break;
+                }
+            }
+            for (int icon =0; icon<jbg->GetConstituents()->GetEntries();icon++){
+                AliJBaseTrack *con = jbg->GetConstituent(icon);
+                z = (con->Vect()*jbg->Vect().Unit())/jbg->P();
+                pta = con->Pt();
+                iptaBin = GetBin(fJetAssocPtBorders, pta);
+                jt = (con->Vect()-z*jbg->Vect()).Mag();
+                if( iptaBin < 0 ) continue;
+                for (int jj = 0; jj <= jBin ; jj++) {
+                    fhBgJtBinLimBin[iContainer][iBin][jj]
+                        ->Fill( jt, effCorrection );
+                    fhBgJtWeightBinLimBin[iContainer][iBin][jj]
+                        ->Fill( jt, 1.0/jt * effCorrection );
+                    fhBgLogJtWeightBinLimBin[iContainer][iBin][jj]
+                        ->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
+                }
+            }
+            cout<<"check : trackN, contbgN = "<<  
+            fTracks->GetEntries() <<" "<<
+            jbg->GetConstituents()->GetEntries()<<endl;   
         }
 
 
     }
 }
 
+void AliJJetJtAnalysis::FillBgJtWithSmallerR(const TClonesArray &Jets,int iContainer, double nR, int iHist){
+    double iBin = -1, iptaBin = -1;
+    double pT=-1, z=-1,jt=-1,  pta=-1;
+    double effCorrection = -1;
+    for (int i = 0; i<Jets.GetEntries(); i++){
+        AliJJet *jet = dynamic_cast<AliJJet*>( Jets.At(i) );
+        pT = jet->Pt();
+        if (pT<(*fJetTriggPtBorders)[1]) continue;
+        iBin = GetBin(fJetTriggPtBorders,pT); // fill jetPt histos
+        if( iBin < 0 ) continue;
+
+        for (int icon = 0; icon<jet->GetConstituents()->GetEntries(); icon++){
+            AliJBaseTrack *con = jet->GetConstituent(icon);
+            z = (con->Vect()*jet->Vect().Unit())/jet->P();
+            pta = con->Pt();
+            con->SetTrackEff( fEfficiency->GetCorrection( pta, 5, fcent) );
+            effCorrection = 1.0/con->GetTrackEff();
+            iptaBin = GetBin(fJetAssocPtBorders, pta);
+            if( iptaBin < 0 ) continue;
+            if (jet->DeltaR(*con)>nR){
+                cout<<" old Bg R  : "<<fConeSizes[iContainer]
+                    <<" jet con R : "<<jet->DeltaR(*con)
+                    <<endl;
+                continue;
 
+            }
+            jt = (con->Vect()-z*jet->Vect()).Mag();
+            fhBgJtWithPtCutWeightBinBinSmallerR[iHist][iBin][iptaBin]
+                ->Fill( jt, 1.0/jt * effCorrection );
+            fhBgLogJtWithPtCutWeightBinBinSmallerR[iHist][iBin][iptaBin]
+                ->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
+        }
+
+
+    }
+
+
+}
+
+
+void AliJJetJtAnalysis::FillBgJtWithDiffAxes (
+      int iao
+    , int ian
+    , int iHist
+){
+
+    const TClonesArray &ao = fJetBgListOfList[iao];
+    const TClonesArray &an = fJetBgListOfList[ian];
+
+    double iBin = -1, iptaBin = -1;
+    double pT=-1, z=-1,jt=-1,  pta=-1;
+    double effCorrection = -1;
+     
+    for (int io = 0; io<ao.GetEntries(); io++){
+        AliJJet *jo = dynamic_cast<AliJJet*>( ao.At(io) );
+        for (int in = 0; in<an.GetEntries(); in++){
+            AliJJet *jn = dynamic_cast<AliJJet*>( an.At(in) );
+            if (jo->DeltaR(*jn) > fConeSizes[ian]) {
+                continue;
+            } else{
+                cout << "iao ian new axis delta R "
+                     << iao <<" "
+                     << ian <<" "
+                     << jo->DeltaR(*jn)
+                     <<endl;
+            }
+            pT = jn->Pt();
+            if (pT<(*fJetTriggPtBorders)[1]) continue;
+            iBin = GetBin(fJetTriggPtBorders,pT); // fill jetPt histos
+            if( iBin < 0 ) continue;
+
+            for (int ic = 0; ic<jo->GetConstituents()->GetEntries(); ic++){
+                AliJBaseTrack *con = jo->GetConstituent(ic);
+                if (jn->DeltaR(*con) > fConeSizes[ian]) continue;
+                z = (con->Vect()*jn->Vect().Unit())/jn->P();
+                pta = con->Pt();
+                con->SetTrackEff( fEfficiency->GetCorrection( pta, 5, fcent) );
+                effCorrection = 1.0/con->GetTrackEff();
+                iptaBin = GetBin(fJetAssocPtBorders, pta);
+                if( iptaBin < 0 ) continue;
+                jt = (con->Vect()-z*jn->Vect()).Mag();
+                fhBgJtWithPtCutWeightBinBinDiffR[iHist][iBin][iptaBin]
+                    ->Fill( jt, 1.0/jt * effCorrection );
+                fhBgLogJtWithPtCutWeightBinBinDiffR[iHist][iBin][iptaBin]
+                    ->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
+            }
+        }
+    }
+
+}
 
index 2f3fe09cb6b5fb7f20cc07f62ef2da163ae294fc..db0f8196d7ecd812c5c655a295dca982526ec4ed 100644 (file)
@@ -66,6 +66,12 @@ class AliJJetJtAnalysis{
 
         void ClearBeforeEvent();
         void FillJtHistogram( TObjArray *Jets, int iContainer );
+
+        void FillBgJtWithSmallerR(const TClonesArray &Jets,int iContainer, 
+            double nR, int iHist);
+
+        void FillBgJtWithDiffAxes (int iao, int ia, int iHist);
+
         void WriteHistograms();
         
         int GetBin(TVector *array, double val){
@@ -126,6 +132,7 @@ class AliJJetJtAnalysis{
         AliJBin fTrkPtBin; 
         AliJBin fTrkLimPtBin; 
         AliJBin fdRBin;
+        AliJBin fiHist;
         AliJTH1D fhNumber;
         AliJTH1D fhKNumber;
         AliJTH1D fhJetPt ;
@@ -153,6 +160,13 @@ class AliJJetJtAnalysis{
         AliJTH1D fhBgLogJtWeightBin;
         AliJTH1D fhBgJtWithPtCutWeightBinBin;
         AliJTH1D fhBgLogJtWithPtCutWeightBinBin;
+        AliJTH1D fhBgJtWithPtCutWeightBinBinSmallerR;
+        AliJTH1D fhBgLogJtWithPtCutWeightBinBinSmallerR;
+        AliJTH1D fhBgJtWithPtCutWeightBinBinDiffR;
+        AliJTH1D fhBgLogJtWithPtCutWeightBinBinDiffR;
+        AliJTH1D fhBgJtBinLimBin;
+        AliJTH1D fhBgJtWeightBinLimBin;
+        AliJTH1D fhBgLogJtWeightBinLimBin;
         
         AliJTH1D fhdeltaE;
         AliJTH1D fhdeltaN;
diff --git a/PWGCF/Correlations/macros/phieffmc/AddTaskPhiEffMc.C b/PWGCF/Correlations/macros/phieffmc/AddTaskPhiEffMc.C
deleted file mode 100644 (file)
index de0f04a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-AliAnalysisTaskPhiEffMc* AddTaskPhiEffMc(Bool_t mc=kFALSE,TString foldername){
-  
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) 
-    {
-      ::Error("AddAliAnalysisTaskPhiEffMc", "No analysis manager to connect to.");
-      return NULL;
-    }   
-  
-  // Check the analysis type using the event handlers connected to the analysis manager.
-  //==============================================================================
-  if (!mgr->GetInputEventHandler()) 
-    {
-      ::Error("AddTaskITSsaTracks", "This task requires an input event handler");
-      return NULL;
-    }   
-  
-  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
-  if(type.Contains("ESD"))
-    {
-      ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");
-      return NULL;
-    }
-  
-  AliAnalysisTaskPhiEffMc *task = new AliAnalysisTaskPhiEffMc("PhiEffMc");
-  
-  TString outputFileName = AliAnalysisManager::GetCommonFileName();
-  outputFileName += ":";
-  outputFileName += foldername;
-
-  cout<<"-------------- outputFileName:  "<<outputFileName<<endl;
-  
-  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();      
-  AliAnalysisDataContainer *coutputptA = mgr->CreateContainer("fOutput", TList::Class(), AliAnalysisManager::kOutputContainer,outputFileName);
-  AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer("cpidpt", AliHelperPID::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
-  AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("cvcutpt", AliSpectraAODEventCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
-  AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer("ctcutpt", AliSpectraAODTrackCuts::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
-  
-  //connect containers
-  mgr->ConnectInput(task, 0, cinput);
-  mgr->ConnectOutput(task, 1, coutputptA);
-  mgr->ConnectOutput(task, 2, coutputpt1);
-  mgr->ConnectOutput(task, 3, coutputpt2);
-  mgr->ConnectOutput(task, 4, coutputpt3);
-  mgr->AddTask(task);
-  return task;
-}
index 686663121df5dbcf13f2fcc2b9ab774d4986511d..92a5db740e399e7d1982a04e4d38c2e33dcc2608 100755 (executable)
@@ -2178,33 +2178,35 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
          
          Bool_t kExcludeParticle = kFALSE;
          Int_t gMotherIndex = particle->GetFirstMother();
-         if(gMotherIndex != -1) {
-           AliMCParticle* motherTrack = dynamic_cast<AliMCParticle *>(event->GetTrack(gMotherIndex));
-           if(motherTrack) {
-             TParticle *motherParticle = motherTrack->Particle();
-             if(motherParticle) {
-               Int_t pdgCodeOfMother = motherParticle->GetPdgCode();
-               //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {
-               if(pdgCodeOfMother == 113  // rho0
-                  || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
-                  // || pdgCodeOfMother == 221  // eta
-                  // || pdgCodeOfMother == 331  // eta'
-                  // || pdgCodeOfMother == 223  // omega
-                  // || pdgCodeOfMother == 333  // phi
-                  || pdgCodeOfMother == 311  || pdgCodeOfMother == -311 // K0
-                  // || pdgCodeOfMother == 313  || pdgCodeOfMother == -313 // K0*
-                  // || pdgCodeOfMother == 323  || pdgCodeOfMother == -323 // K+*
-                  || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
-                  || pdgCodeOfMother == 111  // pi0 Dalitz
-                  ) {
-                 kExcludeParticle = kTRUE;
-               }
-             }
-           }
+
+         if(TMath::Abs(particle->GetPdgCode()) != 321 || gMotherIndex != -1) {
+           // AliMCParticle* motherTrack = dynamic_cast<AliMCParticle *>(event->GetTrack(gMotherIndex));
+           // if(motherTrack) {
+           //   TParticle *motherParticle = motherTrack->Particle();
+           //   if(motherParticle) {
+           //  Int_t pdgCodeOfMother = motherParticle->GetPdgCode();
+           //  //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {
+           //  if(pdgCodeOfMother == 113  // rho0
+           //     || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
+           //     // || pdgCodeOfMother == 221  // eta
+           //     // || pdgCodeOfMother == 331  // eta'
+           //     // || pdgCodeOfMother == 223  // omega
+           //     // || pdgCodeOfMother == 333  // phi
+           //     || pdgCodeOfMother == 311  || pdgCodeOfMother == -311 // K0
+           //     // || pdgCodeOfMother == 313  || pdgCodeOfMother == -313 // K0*
+           //     // || pdgCodeOfMother == 323  || pdgCodeOfMother == -323 // K+*
+           //     || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
+           //     || pdgCodeOfMother == 111  // pi0 Dalitz
+           //     ) {
+           kExcludeParticle = kTRUE;
+           //  }
+           //        }
+           //}
          }
          
          //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi
          if(kExcludeParticle) continue;
+
        }
 
        //Exclude electrons with PDG
index f638b978563d4df26805b5ff40dd878678193166..772da041a35201415ca95a204d03acee7af1ba5f 100644 (file)
@@ -1871,6 +1871,69 @@ TH1D *AliBalancePsi::GetBalanceFunction1DFrom2D2pMethod(Bool_t bPhi,
   return gHistBalanceFunctionHistogram;
 }
 
+//____________________________________________________________________//
+TH1D *AliBalancePsi::GetTriggers(TString type,
+                                Double_t psiMin, 
+                                Double_t psiMax,
+                                Double_t vertexZMin,
+                                Double_t vertexZMax,
+                                Double_t ptTriggerMin,
+                                Double_t ptTriggerMax
+                                ) {
+
+  // Returns the 2D correlation function for "type"(PN,NP,PP,NN) pairs,
+  // does the division by event mixing inside,
+  // and averaging over several vertexZ and centrality bins
+
+  // security checks
+  if(type != "PN" && type != "NP" && type != "PP" && type != "NN" && type != "ALL"){
+    AliError("Only types allowed: PN,NP,PP,NN,ALL");
+    return NULL;
+  }
+
+  TH1D *gHist  = NULL;
+
+  // ranges (in bins) for vertexZ and centrality (psi)
+  Int_t binPsiMin    = fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->FindBin(psiMin+0.00001);
+  Int_t binPsiMax    = fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->FindBin(psiMax-0.00001);
+  Int_t binVertexMin = 0;
+  Int_t binVertexMax = 0;
+  if(fVertexBinning){
+    binVertexMin = fHistPN->GetGrid(0)->GetGrid()->GetAxis(5)->FindBin(vertexZMin+0.00001);
+    binVertexMax = fHistPN->GetGrid(0)->GetGrid()->GetAxis(5)->FindBin(vertexZMax-0.00001);
+  }  
+  Double_t binPsiLowEdge    = 0.;
+  Double_t binPsiUpEdge     = 1000.;
+  Double_t binVertexLowEdge = 0.;
+  Double_t binVertexUpEdge  = 1000.;
+
+   
+  // first set to range and then obtain histogram
+  if(type=="PN" || type=="PP"){
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
+    gHist = (TH1D*)fHistP->Project(0,1);
+  }
+  else if(type=="NP" || type=="NN"){
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
+    gHist = (TH1D*)fHistN->Project(0,1);
+  }
+  else if(type=="ALL"){
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
+    fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax-0.00001); 
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(vertexZMin,vertexZMax-0.00001); 
+    fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax-0.00001);
+    gHist = (TH1D*)fHistN->Project(0,1);
+    gHist->Add((TH1D*)fHistP->Project(0,1));
+  }
+
+  return gHist;
+}
 
 //____________________________________________________________________//
 TH2D *AliBalancePsi::GetCorrelationFunction(TString type,
index 27f1448513e8405e935e5d80680b85834620f339..68393b26c5da166d23a8914043ee2bd52faea934 100644 (file)
@@ -72,6 +72,14 @@ class AliBalancePsi : public TObject {
                        Float_t bSign,
                        Double_t kMultorCent = -100,
                        Double_t vertexZ = 0);
+
+  TH1D   *GetTriggers(TString type,
+                     Double_t psiMin, 
+                     Double_t psiMax,
+                     Double_t vertexZMin,
+                     Double_t vertexZMax,
+                     Double_t ptTriggerMin,
+                     Double_t ptTriggerMax);
   
   TH2D   *GetCorrelationFunction(TString type,
                                 Double_t psiMin, Double_t psiMax,
@@ -84,6 +92,7 @@ class AliBalancePsi : public TObject {
                                 AliBalancePsi *bMixed=NULL,
                                 Bool_t normToTrig = kFALSE,
                                 Double_t normalizationRangePhi = TMath::Pi()/6.);
+
   TH2D   *GetCorrelationFunctionPN(Double_t psiMin, Double_t psiMax,
                                   Double_t vertexZMin=-1,
                                   Double_t vertexZMax=-1,
index 9d4f9459dbd2e21c186bd01c039b538f11c84a30..cbc91eea22f35abf478fcf780fa3c35a52c467cc 100644 (file)
@@ -153,7 +153,7 @@ public:
 
     virtual void SetUseSparse( Bool_t flag )            { fUseSparse             = flag;  }
     virtual void SetUseAccumulatingHist( Bool_t flag )  { fUseAccumulatingHist   = flag;  }
-    inline Bool_t IsPhiInRange( Double_t phi, Double_t phiBoundMin, Double_t phiBoundMax );
+    Bool_t IsPhiInRange( Double_t phi, Double_t phiBoundMin, Double_t phiBoundMax );
 
     void SetCorrespondanceWithAliROOTpid();
     void ZeroPidArrays();
index b8e5ac289316c703df11d69e4c2cf2d76a1699e3..375efeb08ec77c63113353a3b7893285800ad61d 100644 (file)
@@ -1299,7 +1299,7 @@ void  AliEbyENetChargeFluctuationTask::CreateGroupHistos(const Char_t *name, con
 
 
   TString strTit(title);
-  Float_t etaRange[2] = {fEtaMin, fEtaMax};
+  Float_t etaRange[2] = {(Float_t)fEtaMin, (Float_t)fEtaMax};
   
   //TList *list[4];
   fPhyList->Add(new TList);
index 405d232a44f38b8c8faa6d916cc423822d7766ed..f90a4f0e8052fd283d34477e095058f7907b1721 100644 (file)
@@ -311,6 +311,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   hPP = (AliTHn*) list->FindObject(gHistPPname.Data());
   hNN = (AliTHn*) list->FindObject(gHistNNname.Data());
   hNN->Print();
+  hN->Print();
 
 
   //Create the AliBalancePsi object and fill it with the AliTHn objects
@@ -423,6 +424,10 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   TH2D *gHistNP[4];
   TH2D *gHistPP[4];
   TH2D *gHistNN[4];
+  TH1D *gHistTriggerPN;
+  TH1D *gHistTriggerNP;
+  TH1D *gHistTriggerPP;
+  TH1D *gHistTriggerNN;
   
   TCanvas *cPN[4];
   TCanvas *cNP[4];
@@ -491,6 +496,8 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
     else 
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   }
+
+  gHistTriggerPN = b->GetTriggers("PN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistPN[0] = b->GetCorrelationFunctionPN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistPN[0]->Rebin2D(rebinEta,rebinPhi);
@@ -706,6 +713,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   }
 
+  gHistTriggerNP = b->GetTriggers("NP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistNP[0] = b->GetCorrelationFunctionNP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistNP[0]->Rebin2D(rebinEta,rebinPhi);
@@ -921,6 +929,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   }
 
+  gHistTriggerPP = b->GetTriggers("PP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistPP[0] = b->GetCorrelationFunctionPP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistPP[0]->Rebin2D(rebinEta,rebinPhi);
@@ -1134,6 +1143,7 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
       histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})"; 
   } 
 
+  gHistTriggerNN = b->GetTriggers("NN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax);
   gHistNN[0] = b->GetCorrelationFunctionNN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
   if(rebinEta > 1 || rebinPhi > 1){
     gHistNN[0]->Rebin2D(rebinEta,rebinPhi);
@@ -1347,7 +1357,13 @@ void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
   newFileName += ".root";
 
   TFile *newFile = TFile::Open(newFileName.Data(),"recreate");
-  gHistPN[0]->SetName("gHistPNRaw"); gHistPN[0]->Write();
+
+  gHistTriggerPN->SetName("gHistPNTrigger"); gHistTriggerPN->Write();
+  gHistTriggerNP->SetName("gHistNPTrigger"); gHistTriggerNP->Write();
+  gHistTriggerPP->SetName("gHistPPTrigger"); gHistTriggerPP->Write();
+  gHistTriggerNN->SetName("gHistNNTrigger"); gHistTriggerNN->Write();
+
+  gHistPN[0]->SetName("gHistPNRaw"); gHistPN[0]->Write(); 
   gHistNP[0]->SetName("gHistNPRaw"); gHistNP[0]->Write();
   gHistPP[0]->SetName("gHistPPRaw"); gHistPP[0]->Write();
   gHistNN[0]->SetName("gHistNNRaw"); gHistNN[0]->Write();
index 80512f98ff6d8d0021a4587d732bab815c67f4db..485cb6dacf426033ff5df03d1fd6fe089cb8b837 100644 (file)
@@ -62,8 +62,9 @@ bool AliFemtoSpherocityEventCut::Pass(const AliFemtoEvent* event){
     //if(SumPt==0){return kFALSE;}
       if(MULT<3){return kFALSE;}
  
-       Double_t *pxA=new Double_t[MULT];
-       Double_t *pyA=new Double_t[MULT];
+       Double_t *pxA=new Double_t[MULT]();
+       Double_t *pyA=new Double_t[MULT]();
+
        Double_t sumapt=0;
        Int_t counter=0;
   
index 6fd5806973f1de87afa1f4735ca7d6941997be80..42088e869e6efbc3cdaf86dffe7786528000ac13 100755 (executable)
@@ -114,6 +114,10 @@ AliAnalysisTaskSE(),
   fQmean(),
   fDampStart(0),
   fDampStep(0),
+  fq2Binning(0),
+  fq2Index(0),
+  fq2CutLow(0.1),
+  fq2CutHigh(0.11),
   fTPCTOFboundry(0),
   fTOFboundry(0),
   fSigmaCutTPC(2.0),
@@ -159,10 +163,7 @@ AliAnalysisTaskSE(),
   fNormQPairSwitch_E2E3(),
   fMomResC2SC(0x0),
   fMomResC2MC(0x0),
-  fWeightmuonCorrection(0x0),
-  fPbPbc3FitEA(0x0),
-  fpPbc3FitEA(0x0),
-  fppc3FitEA(0x0)
+  fWeightmuonCorrection(0x0)
 {
   // Default constructor
   for(Int_t mb=0; mb<fMbins; mb++){
@@ -172,7 +173,6 @@ AliAnalysisTaskSE(),
          for(Int_t term=0; term<2; term++){
            
            Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2=0x0;
-           
            Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal = 0x0;
            Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared = 0x0;
            Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL = 0x0;
@@ -217,6 +217,13 @@ AliAnalysisTaskSE(),
     }// ED
   }// Mbin
   
+  // Initialze EA
+  for(Int_t i=0; i<2; i++){
+    fPbPbc3FitEA[i]=0x0;
+    fpPbc3FitEA[i]=0x0;
+    fppc3FitEA[i]=0x0;
+  }
+
   // Initialize FSI histograms
   for(Int_t i=0; i<13; i++){
     fFSIss[i]=0x0; 
@@ -231,13 +238,14 @@ AliAnalysisTaskSE(),
     }
   }
 
-  
-  for(Int_t i=0; i<6; i++){// EW/LG
-    for(Int_t j=0; j<50; j++){// GIndex
-      ExchangeAmp[i][j]=0x0;
+  for(Int_t FT=0; FT<2; FT++){// c3 or C3
+    for(Int_t i=0; i<7; i++){// EW/LG
+      for(Int_t j=0; j<50; j++){// GIndex
+       ExchangeAmp[i][j][FT]=0x0;
+      }
     }
   }
-  
+
 }
 //________________________________________________________________________
 AliFourPion::AliFourPion(const Char_t *name) 
@@ -308,6 +316,10 @@ AliFourPion::AliFourPion(const Char_t *name)
   fQmean(),
   fDampStart(0),
   fDampStep(0),
+  fq2Binning(0),
+  fq2Index(0),
+  fq2CutLow(0.1),
+  fq2CutHigh(0.11),
   fTPCTOFboundry(0),
   fTOFboundry(0),
   fSigmaCutTPC(2.0),
@@ -353,10 +365,7 @@ AliFourPion::AliFourPion(const Char_t *name)
   fNormQPairSwitch_E2E3(),
   fMomResC2SC(0x0),
   fMomResC2MC(0x0),
-  fWeightmuonCorrection(0x0),
-  fPbPbc3FitEA(0x0),
-  fpPbc3FitEA(0x0),
-  fppc3FitEA(0x0)
+  fWeightmuonCorrection(0x0)
 {
   // Main constructor
   fAODcase=kTRUE;
@@ -414,6 +423,13 @@ AliFourPion::AliFourPion(const Char_t *name)
     }// ED
   }// Mbin
   
+  // Initialze EA
+  for(Int_t i=0; i<2; i++){
+    fPbPbc3FitEA[i]=0x0;
+    fpPbc3FitEA[i]=0x0;
+    fppc3FitEA[i]=0x0;
+  }
+
   // Initialize FSI histograms
   for(Int_t i=0; i<13; i++){
     fFSIss[i]=0x0; 
@@ -426,10 +442,12 @@ AliFourPion::AliFourPion(const Char_t *name)
       fNormWeight[i][j]=0x0;
     }
   }
-  
-  for(Int_t i=0; i<6; i++){// EW/LG
-    for(Int_t j=0; j<50; j++){// GIndex
-      ExchangeAmp[i][j]=0x0;
+
+  for(Int_t FT=0; FT<2; FT++){// c3 or C3
+    for(Int_t i=0; i<7; i++){// EW/LG
+      for(Int_t j=0; j<50; j++){// GIndex
+       ExchangeAmp[i][j][FT]=0x0;
+      }
     }
   }
 
@@ -505,6 +523,10 @@ AliFourPion::AliFourPion(const AliFourPion &obj)
     fQmean(),
     fDampStart(obj.fDampStart),
     fDampStep(obj.fDampStep),
+    fq2Binning(obj.fq2Binning),
+    fq2Index(obj.fq2Index),
+    fq2CutLow(obj.fq2CutLow),
+    fq2CutHigh(obj.fq2CutHigh),
     fTPCTOFboundry(obj.fTPCTOFboundry),
     fTOFboundry(obj.fTOFboundry),
     fSigmaCutTPC(obj.fSigmaCutTPC),
@@ -550,13 +572,16 @@ AliFourPion::AliFourPion(const AliFourPion &obj)
     fNormQPairSwitch_E2E3(),
     fMomResC2SC(obj.fMomResC2SC),
     fMomResC2MC(obj.fMomResC2MC),
-    fWeightmuonCorrection(obj.fWeightmuonCorrection),
-    fPbPbc3FitEA(obj.fPbPbc3FitEA),
-    fpPbc3FitEA(obj.fpPbc3FitEA),
-    fppc3FitEA(obj.fppc3FitEA)
+    fWeightmuonCorrection(obj.fWeightmuonCorrection)
 {
   // Copy Constructor
   
+  for(Int_t i=0; i<2; i++){
+    fPbPbc3FitEA[i]=obj.fPbPbc3FitEA[i];
+    fpPbc3FitEA[i]=obj.fpPbc3FitEA[i];
+    fppc3FitEA[i]=obj.fppc3FitEA[i];
+  }
+  
   for(Int_t i=0; i<13; i++){
     fFSIss[i]=obj.fFSIss[i]; 
     fFSIos[i]=obj.fFSIos[i];
@@ -569,12 +594,14 @@ AliFourPion::AliFourPion(const AliFourPion &obj)
     }
   }
   
-  for(Int_t i=0; i<6; i++){// EW/LG
-    for(Int_t j=0; j<50; j++){// GIndex
-      ExchangeAmp[i][j]=obj.ExchangeAmp[i][j];
+  for(Int_t FT=0; FT<2; FT++){// c3 or C3
+    for(Int_t i=0; i<7; i++){// EW/LG
+      for(Int_t j=0; j<50; j++){// GIndex
+       ExchangeAmp[i][j][FT]=obj.ExchangeAmp[i][j][FT];
+      }
     }
   }
-  
+
 }
 //________________________________________________________________________
 AliFourPion &AliFourPion::operator=(const AliFourPion &obj) 
@@ -639,6 +666,10 @@ AliFourPion &AliFourPion::operator=(const AliFourPion &obj)
   fQstepWeights = obj.fQstepWeights;
   fDampStart = obj.fDampStart;
   fDampStep = obj.fDampStep;
+  fq2Binning = obj.fq2Binning;
+  fq2Index = obj.fq2Index;
+  fq2CutLow = obj.fq2CutLow;
+  fq2CutHigh = obj.fq2CutHigh;
   fTPCTOFboundry = obj.fTPCTOFboundry;
   fTOFboundry = obj.fTOFboundry;
   fSigmaCutTPC = obj.fSigmaCutTPC;
@@ -666,9 +697,12 @@ AliFourPion &AliFourPion::operator=(const AliFourPion &obj)
   fMomResC2SC = obj.fMomResC2SC;
   fMomResC2MC = obj.fMomResC2MC;
   fWeightmuonCorrection = obj.fWeightmuonCorrection;
-  fPbPbc3FitEA = obj.fPbPbc3FitEA;
-  fpPbc3FitEA = obj.fpPbc3FitEA;
-  fppc3FitEA = obj.fppc3FitEA;
+  
+  for(Int_t i=0; i<2; i++){
+    fPbPbc3FitEA[i]=obj.fPbPbc3FitEA[i];
+    fpPbc3FitEA[i]=obj.fpPbc3FitEA[i];
+    fppc3FitEA[i]=obj.fppc3FitEA[i];
+  }
   
   for(Int_t i=0; i<13; i++){
     fFSIss[i]=obj.fFSIss[i]; 
@@ -679,10 +713,12 @@ AliFourPion &AliFourPion::operator=(const AliFourPion &obj)
       fNormWeight[i][j]=obj.fNormWeight[i][j];
     }
   }
-  
-  for(Int_t i=0; i<6; i++){// EW/LG
-    for(Int_t j=0; j<50; j++){// GIndex
-      ExchangeAmp[i][j]=obj.ExchangeAmp[i][j];
+
+  for(Int_t FT=0; FT<2; FT++){// c3 or C3
+    for(Int_t i=0; i<7; i++){// EW/LG
+      for(Int_t j=0; j<50; j++){// GIndex
+       ExchangeAmp[i][j][FT]=obj.ExchangeAmp[i][j][FT];
+      }
     }
   }
 
@@ -703,9 +739,12 @@ AliFourPion::~AliFourPion()
   if(fMomResC2SC) delete fMomResC2SC;
   if(fMomResC2MC) delete fMomResC2MC;
   if(fWeightmuonCorrection) delete fWeightmuonCorrection;
-  if(fPbPbc3FitEA) delete fPbPbc3FitEA;
-  if(fpPbc3FitEA) delete fpPbc3FitEA;
-  if(fppc3FitEA) delete fppc3FitEA;
+  
+  for(Int_t i=0; i<2; i++){
+    if(fPbPbc3FitEA[i]) delete fPbPbc3FitEA[i];
+    if(fpPbc3FitEA[i]) delete fpPbc3FitEA[i];
+    if(fppc3FitEA[i]) delete fppc3FitEA[i];
+  }
   
   for(Int_t j=0; j<kMultLimitPbPb; j++){
     if(fLowQPairSwitch_E0E0[j]) delete [] fLowQPairSwitch_E0E0[j];
@@ -802,10 +841,12 @@ AliFourPion::~AliFourPion()
       if(fNormWeight[i][j]) delete fNormWeight[i][j];
     }
   }
-
-  for(Int_t i=0; i<6; i++){// EW/LG
-    for(Int_t j=0; j<50; j++){// GIndex
-      if(ExchangeAmp[i][j]) delete ExchangeAmp[i][j];
+  
+  for(Int_t FT=0; FT<2; FT++){// c3 or C3
+    for(Int_t i=0; i<7; i++){// EW/LG
+      for(Int_t j=0; j<50; j++){// GIndex
+       if(ExchangeAmp[i][j][FT]) delete ExchangeAmp[i][j][FT];
+      }
     }
   }
  
@@ -954,41 +995,44 @@ void AliFourPion::ParInit()
   // Pair-Exchange amplitudes from c3 fits
   TString *EWequation = new TString("[0]*exp(-pow(x*[1]/0.19733,2)/2.) * ( 1 + [2]/(6.*pow(2.,1.5))*(8*pow(x*[1]/0.19733,3) - 12*pow(x*[1]/0.19733,1)) + [3]/(24.*pow(2.,2))*(16*pow(x*[1]/0.19733,4) -48*pow(x*[1]/0.19733,2) + 12) + [4]/(120.*pow(2.,2.5))*(32.*pow(x*[1]/0.19733,5) - 160.*pow(x*[1]/0.19733,3) + 120*x*[1]/0.19733))");
   TString *LGequation = new TString("[0]*exp(-x*[1]/0.19733/2.) * ( 1 + [2]*(x*[1]/0.19733 - 1) + [3]/2.*(pow(x*[1]/0.19733,2) - 4*x*[1]/0.19733 + 2) + [4]/6.*(-pow(x*[1]/0.19733,3) + 9*pow(x*[1]/0.19733,2) - 18*x*[1]/0.19733 + 6))");
-
+  
   if(!fMCcase && !fTabulatePairs){
-    for(Int_t i=0; i<6; i++){// Rcoh index
-      for(Int_t j=0; j<50; j++){// G index
-       TString *nameEA=new TString("ExchangeAmp");
-       *nameEA += i;
-       *nameEA += j;
-       if(fEAtype==0) ExchangeAmp[i][j] = new TF1(nameEA->Data(), EWequation->Data(), 0,1.0);// Edgeworth
-       else ExchangeAmp[i][j] = new TF1(nameEA->Data(), LGequation->Data(), 0,1.0);// Laguerre
-       //
-       if(fCollisionType==0){
-         ExchangeAmp[i][j]->FixParameter(0, fPbPbc3FitEA->GetBinContent(i+1, 1, j+1));
-         ExchangeAmp[i][j]->FixParameter(1, fPbPbc3FitEA->GetBinContent(i+1, 2, j+1));
-         ExchangeAmp[i][j]->FixParameter(2, fPbPbc3FitEA->GetBinContent(i+1, 3, j+1));
-         ExchangeAmp[i][j]->FixParameter(3, fPbPbc3FitEA->GetBinContent(i+1, 4, j+1));
-         ExchangeAmp[i][j]->FixParameter(4, 0);
-       }else if(fCollisionType==1){
-         ExchangeAmp[i][j]->FixParameter(0, fpPbc3FitEA->GetBinContent(i+1, 1, j+1));
-         ExchangeAmp[i][j]->FixParameter(1, fpPbc3FitEA->GetBinContent(i+1, 2, j+1));
-         ExchangeAmp[i][j]->FixParameter(2, fpPbc3FitEA->GetBinContent(i+1, 3, j+1));
-         ExchangeAmp[i][j]->FixParameter(3, fpPbc3FitEA->GetBinContent(i+1, 4, j+1));
-         ExchangeAmp[i][j]->FixParameter(4, 0);
-       }else{
-         ExchangeAmp[i][j]->FixParameter(0, fppc3FitEA->GetBinContent(i+1, 1, j+1));
-         ExchangeAmp[i][j]->FixParameter(1, fppc3FitEA->GetBinContent(i+1, 2, j+1));
-         ExchangeAmp[i][j]->FixParameter(2, fppc3FitEA->GetBinContent(i+1, 3, j+1));
-         ExchangeAmp[i][j]->FixParameter(3, fppc3FitEA->GetBinContent(i+1, 4, j+1));
-         ExchangeAmp[i][j]->FixParameter(4, 0);
+    for(Int_t FT=0; FT<2; FT++){// c3 or C3
+      for(Int_t i=0; i<7; i++){// Rcoh index
+       for(Int_t j=0; j<50; j++){// G index
+         TString *nameEA=new TString("ExchangeAmp");
+         *nameEA += FT;
+         *nameEA += i;
+         *nameEA += j;
+         if(fEAtype==0) ExchangeAmp[i][j][FT] = new TF1(nameEA->Data(), EWequation->Data(), 0,1.0);// Edgeworth
+         else ExchangeAmp[i][j][FT] = new TF1(nameEA->Data(), LGequation->Data(), 0,1.0);// Laguerre
+         //
+         if(fCollisionType==0){
+           ExchangeAmp[i][j][FT]->FixParameter(0, fPbPbc3FitEA[FT]->GetBinContent(i+1, 1, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(1, fPbPbc3FitEA[FT]->GetBinContent(i+1, 2, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(2, fPbPbc3FitEA[FT]->GetBinContent(i+1, 3, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(3, fPbPbc3FitEA[FT]->GetBinContent(i+1, 4, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(4, 0);
+         }else if(fCollisionType==1){
+           ExchangeAmp[i][j][FT]->FixParameter(0, fpPbc3FitEA[FT]->GetBinContent(i+1, 1, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(1, fpPbc3FitEA[FT]->GetBinContent(i+1, 2, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(2, fpPbc3FitEA[FT]->GetBinContent(i+1, 3, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(3, fpPbc3FitEA[FT]->GetBinContent(i+1, 4, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(4, 0);
+         }else{
+           ExchangeAmp[i][j][FT]->FixParameter(0, fppc3FitEA[FT]->GetBinContent(i+1, 1, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(1, fppc3FitEA[FT]->GetBinContent(i+1, 2, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(2, fppc3FitEA[FT]->GetBinContent(i+1, 3, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(3, fppc3FitEA[FT]->GetBinContent(i+1, 4, j+1));
+           ExchangeAmp[i][j][FT]->FixParameter(4, 0);
+         }
        }
       }
     }
   }
   /////////////////////////////////////////////
   /////////////////////////////////////////////
-  
 }
 //________________________________________________________________________
 void AliFourPion::UserCreateOutputObjects()
@@ -1507,22 +1551,22 @@ void AliFourPion::UserCreateOutputObjects()
                  if(c1==0 && c2==0 && c3==0 && c4==0){
                    TString *nameBuildFromFits=new TString(namePC4->Data());
                    nameBuildFromFits->Append("_BuildFromFits");
-                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fBuildFromFits = new TH2D(nameBuildFromFits->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
+                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fBuildFromFits = new TH3D(nameBuildFromFits->Data(),"", 2,0.5,2.5, kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
                    fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fBuildFromFits);
                    //
                    TString *namePrimeBuildFromFits=new TString(namePC4->Data());
                    namePrimeBuildFromFits->Append("_PrimeBuildFromFits");
-                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPrimeBuildFromFits = new TH2D(namePrimeBuildFromFits->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
+                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPrimeBuildFromFits = new TH3D(namePrimeBuildFromFits->Data(),"", 2,0.5,2.5, kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
                    fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPrimeBuildFromFits);
                    //
                    TString *namePrimePrimeBuildFromFits=new TString(namePC4->Data());
                    namePrimePrimeBuildFromFits->Append("_PrimePrimeBuildFromFits");
-                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPrimePrimeBuildFromFits = new TH2D(namePrimePrimeBuildFromFits->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
+                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPrimePrimeBuildFromFits = new TH3D(namePrimePrimeBuildFromFits->Data(),"", 2,0.5,2.5, kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
                    fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPrimePrimeBuildFromFits);
                    //
                    TString *nameCumulantBuildFromFits=new TString(namePC4->Data());
                    nameCumulantBuildFromFits->Append("_CumulantBuildFromFits");
-                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fCumulantBuildFromFits = new TH2D(nameCumulantBuildFromFits->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
+                   Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fCumulantBuildFromFits = new TH3D(nameCumulantBuildFromFits->Data(),"", 2,0.5,2.5, kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0.,fQupperBoundQ4);
                    fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fCumulantBuildFromFits);
                  }
                }
@@ -1596,7 +1640,7 @@ void AliFourPion::UserCreateOutputObjects()
            nameDen->Append("_ED_");
            *nameDen += edB;
            
-           if(edB==0){
+           if(edB<=1){
              KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD = new TH3D(nameNum->Data(),"", kQbinsWeights,0.,fQupperBoundWeights, kQbinsWeights,0.,fQupperBoundWeights, kQbinsWeights,0.,fQupperBoundWeights);
              fOutputList->Add(KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD);
              
@@ -1670,7 +1714,10 @@ void AliFourPion::UserCreateOutputObjects()
   fOutputList->Add(fc4QSFitNum);
   TH2D *fc4QSFitDen = new TH2D("fc4QSFitDen","",7,0.5,7.5, fQbinsQ4,0.,fQupperBoundQ4);
   fOutputList->Add(fc4QSFitDen);
-  
+
+  TH3F *fq2Dist = new TH3F("fq2Dist","",fMbins,.5,fMbins+.5, 4,0.5,4.5, 200,0,10);
+  fOutputList->Add(fq2Dist);
+
   ////////////////////////////////////
   ///////////////////////////////////  
   
@@ -1691,7 +1738,6 @@ void AliFourPion::UserExec(Option_t *)
   fAOD = dynamic_cast<AliAODEvent*> (InputEvent());
   if (!fAOD) {Printf("ERROR: fAOD not available"); return;}
   
-  
   // Trigger Cut
   if(fAOD->GetRunNumber() >= 136851 && fAOD->GetRunNumber() <= 139517){// 10h data
   Bool_t isSelected1 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
@@ -1708,7 +1754,7 @@ void AliFourPion::UserExec(Option_t *)
     isSelected[3] = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kHighMult);
     if(!isSelected[fTriggerType] && !fMCcase) return;
   }
+
   ///////////////////////////////////////////////////////////
   const AliAODVertex *primaryVertexAOD;
   AliCentrality *centrality;// for AODs and ESDs
@@ -1730,7 +1776,7 @@ void AliFourPion::UserExec(Option_t *)
     }
   }
   
-
   UInt_t status=0;
   Int_t positiveTracks=0, negativeTracks=0;
   Int_t myTracks=0, pionCount=0, kaonCount=0, protonCount=0;
@@ -2134,6 +2180,39 @@ void AliFourPion::UserExec(Option_t *)
   
   if(fMbin==-1) {return;}
   
+  
+  //////////////////////////////////////////////////////////////////////////
+  // q2 vector
+  Float_t Qx[4]={0};
+  Float_t Qy[4]={0};
+  Float_t Mq[4]={0};
+  Float_t qVect2[4]={0};
+  Int_t q2index=0;
+  for(Int_t i=0; i<myTracks; i++){
+    if(fTempStruct[i].fPt < 0.25) q2index=0;
+    else if(fTempStruct[i].fPt < 0.35) q2index=1;
+    else if(fTempStruct[i].fPt < 0.45) q2index=2;
+    else q2index=3;
+    
+    Qx[q2index] += cos(2*fTempStruct[i].fPhi);
+    Qy[q2index] += sin(2*fTempStruct[i].fPhi);
+    Mq[q2index]++;
+  }
+  for(Int_t i=0; i<4; i++){ 
+    qVect2[i] = sqrt(pow(Qx[i],2)+pow(Qy[i],2)); 
+    if(Mq[i] > 0) qVect2[i] /= sqrt(Mq[i]);
+    ((TH3F*)fOutputList->FindObject("fq2Dist"))->Fill(fMbin+1, i+1, qVect2[i]);
+    //cout<<qVect2[i]<<"  "<<Mq[i]<<endl;
+  }
+  if(fq2Binning){// bin in q2
+    if(qVect2[fq2Index] < fq2CutLow) fEDbin = 0;
+    else if (qVect2[fq2Index] > fq2CutHigh) fEDbin = 1;
+    else return;
+  }
+  //////////////////////////////////////////////////////////////////////////
+
+
   ///////////////////
   // can only be called after fMbin has been set
   // Radius parameter only matters for Monte-Carlo data
@@ -2148,10 +2227,10 @@ void AliFourPion::UserExec(Option_t *)
   else {rBinForTPNMomRes=6;}
 
   //////////////////////////////////////////////////
-  fEDbin=0;// Extra Dimension bin (Kt, (Kt-Psi),....)
+  if(!fq2Binning) fEDbin=0;// Extra Dimension bin (Kt3, q2,....)
   //////////////////////////////////////////////////
   
-
+  
   
   ((TH1F*)fOutputList->FindObject("fEvents1"))->Fill(fMbin+1);
   ((TProfile*)fOutputList->FindObject("fAvgMult"))->Fill(fMbin+1., pionCount);
@@ -2178,7 +2257,7 @@ void AliFourPion::UserExec(Option_t *)
     }
   }
   
-  
+
   
   Float_t qinv12=0, qinv13=0, qinv14=0, qinv23=0, qinv24=0, qinv34=0;
   Float_t qout=0, qside=0, qlong=0;
@@ -2229,7 +2308,7 @@ void AliFourPion::UserExec(Option_t *)
   ////////////////////
   //Int_t PairCount[7]={0};
   //Int_t NormPairCount[7]={0};
-  Int_t KT3index=0, KT4index=0;
+  Int_t EDindex3=0, EDindex4=0;
 
   // reset to defaults
   for(Int_t i=0; i<fMultLimit; i++) {
@@ -2352,8 +2431,8 @@ void AliFourPion::UserExec(Option_t *)
              if(fGenerateSignal && en2==0) {
                Int_t chGroup2[2]={ch1,ch2};
                Float_t WInput = MCWeight(chGroup2, fRMax, ffcSqMRC, qinv12, kT12);
-             KT[kTbin].KY[kYbin].MB[fMbin].EDB[0].TwoPT[en2].fTerms2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong), WInput);
-             }else KT[kTbin].KY[kYbin].MB[fMbin].EDB[0].TwoPT[en2].fTerms2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong));
+               KT[kTbin].KY[kYbin].MB[fMbin].EDB[fEDbin].TwoPT[en2].fTerms2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong), WInput);
+             }else KT[kTbin].KY[kYbin].MB[fMbin].EDB[fEDbin].TwoPT[en2].fTerms2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong));
            }
          }
          
@@ -2450,15 +2529,22 @@ void AliFourPion::UserExec(Option_t *)
              SetFillBins3(ch1, ch2, ch3, 1, bin1, bin2, bin3, fill2, fill3, fill4);
              
              Float_t KT3 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2],2))/3.;
-             if(KT3<=fKT3transition) KT3index=0;
-             else KT3index=1;
+             if(!fq2Binning){
+               if(KT3<=fKT3transition) EDindex3=0;
+               else EDindex3=1;
+             }else{
+               EDindex3 = fEDbin;
+               if(KT3>fKT3transition) {
+                 EDindex3=2+fEDbin;
+               }
+             }
              
-             if(en2==0 && en3==0 && en4==0) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fNorm3->Fill(0);
-             if(en2==1 && en3==2 && en4==3) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fNorm3->Fill(0);
+             if(en2==0 && en3==0 && en4==0) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fNorm3->Fill(0);
+             if(en2==1 && en3==2 && en4==3) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fNorm3->Fill(0);
              if(en2==0 && en3==1 && en4==2) {
-               if(fill2) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fNorm3->Fill(0);
-               if(fill3) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fNorm3->Fill(0);
-               if(fill4) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fNorm3->Fill(0);
+               if(fill2) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fNorm3->Fill(0);
+               if(fill3) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fNorm3->Fill(0);
+               if(fill4) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fNorm3->Fill(0);
              }
              
              
@@ -2492,14 +2578,22 @@ void AliFourPion::UserExec(Option_t *)
                pVect4[3]=(fEvt+en4)->fTracks[l].fP[2];
                ch4 = Int_t(((fEvt+en4)->fTracks[l].fCharge + 1)/2.);
                Float_t KT4 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1]+pVect4[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2]+pVect4[2],2))/4.;
-               if(KT4<=fKT4transition) KT4index=0;
-               else KT4index=1;
                
+               if(!fq2Binning){
+                 if(KT4<=fKT4transition) EDindex4=0;
+                 else EDindex4=1;
+               }else{
+                 EDindex4 = fEDbin;
+                 if(KT4>fKT4transition) {
+                   EDindex4=2+fEDbin;
+                 }
+               }
+
                Bool_t FillTerms[13]={kFALSE};
                SetFillBins4(ch1, ch2, ch3, ch4, bin1, bin2, bin3, bin4, en2+en3+en4, FillTerms);
                //
                for(int ft=0; ft<13; ft++) {
-                 if(FillTerms[ft]) Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fNorm4->Fill(0.); 
+                 if(FillTerms[ft]) Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[ft].fNorm4->Fill(0.); 
                }
                
                
@@ -2803,9 +2897,16 @@ void AliFourPion::UserExec(Option_t *)
                SetFillBins3(ch1, ch2, ch3, 1, bin1, bin2, bin3, fill2, fill3, fill4);
                
                Float_t KT3 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2],2))/3.;
-               if(KT3<=fKT3transition) KT3index=0;
-               else KT3index=1;
-               
+               if(!fq2Binning){
+                 if(KT3<=fKT3transition) EDindex3=0;
+                 else EDindex3=1;
+               }else{
+                 EDindex3 = fEDbin;
+                 if(KT3>fKT3transition) {
+                   EDindex3=2+fEDbin;
+                 }
+               }
+
                FSICorr13 = FSICorrelation(ch1,ch3, qinv13);
                FSICorr23 = FSICorrelation(ch2,ch3, qinv23);
                if(!fGenerateSignal && !fMCcase) {
@@ -2826,61 +2927,61 @@ void AliFourPion::UserExec(Option_t *)
                if(ENsum==0) {
                  Float_t Winput=1.0;
                  if(fMCcase && fGenerateSignal) Winput = MCWeight3(1, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fTerms3->Fill(q3, Winput); 
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fKfactor->Fill(q3, 1/(FSICorr12*FSICorr13*FSICorr23), Winput);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fKfactorWeighted->Fill(q3, 1/(FSICorr12*FSICorr13*FSICorr23), MomResCorr12*MomResCorr13*MomResCorr23 * Winput);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fMeanQinv->Fill(q3, qinv12);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fMeanQinv->Fill(q3, qinv13);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fMeanQinv->Fill(q3, qinv23);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fTerms3->Fill(q3, Winput); 
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fKfactor->Fill(q3, 1/(FSICorr12*FSICorr13*FSICorr23), Winput);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fKfactorWeighted->Fill(q3, 1/(FSICorr12*FSICorr13*FSICorr23), MomResCorr12*MomResCorr13*MomResCorr23 * Winput);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fMeanQinv->Fill(q3, qinv12);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fMeanQinv->Fill(q3, qinv13);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[0].fMeanQinv->Fill(q3, qinv23);
                  if(bin1==bin2 && bin1==bin3){
-                   Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[0].fTerms33D->Fill(qinv12, qinv13, qinv23);
-                   Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[0].fKfactor3D->Fill(qinv12, qinv13, qinv23, 1/(FSICorr12*FSICorr13*FSICorr23));
+                   Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[0].fTerms33D->Fill(qinv12, qinv13, qinv23);
+                   Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[0].fKfactor3D->Fill(qinv12, qinv13, qinv23, 1/(FSICorr12*FSICorr13*FSICorr23));
                  }
                }
                if(ENsum==6) {
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTerms3->Fill(q3);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fMeanQinv->Fill(q3, qinv12);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fMeanQinv->Fill(q3, qinv13);
-                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fMeanQinv->Fill(q3, qinv23);
-                 if(bin1==bin2 && bin1==bin3) Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[4].fTerms33D->Fill(qinv12, qinv13, qinv23);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fTerms3->Fill(q3);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fMeanQinv->Fill(q3, qinv12);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fMeanQinv->Fill(q3, qinv13);
+                 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fMeanQinv->Fill(q3, qinv23);
+                 if(bin1==bin2 && bin1==bin3) Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[4].fTerms33D->Fill(qinv12, qinv13, qinv23);
                }
                if(ENsum==3){
                  Float_t Winput=1.0;
                  if(fill2) {
                    if(fMCcase && fGenerateSignal) Winput = MCWeight3(2, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fTerms3->Fill(q3, Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fMeanQinv->Fill(q3, qinv12);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fMeanQinv->Fill(q3, qinv13);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fMeanQinv->Fill(q3, qinv23);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fTerms3->Fill(q3, Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fMeanQinv->Fill(q3, qinv12);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fMeanQinv->Fill(q3, qinv13);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[1].fMeanQinv->Fill(q3, qinv23);
                    if(bin1==bin2 && bin1==bin3){
-                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[1].fTerms33D->Fill(qinv12, qinv13, qinv23);
-                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[1].fKfactor3D->Fill(qinv12, qinv13, qinv23, 1/(FSICorr12));
+                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[1].fTerms33D->Fill(qinv12, qinv13, qinv23);
+                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[1].fKfactor3D->Fill(qinv12, qinv13, qinv23, 1/(FSICorr12));
                    }
                  }if(fill3) {
                    if(fMCcase && fGenerateSignal) Winput = MCWeight3(3, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fTerms3->Fill(q3, Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fMeanQinv->Fill(q3, qinv12);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fMeanQinv->Fill(q3, qinv13);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fMeanQinv->Fill(q3, qinv23);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fTerms3->Fill(q3, Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fMeanQinv->Fill(q3, qinv12);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fMeanQinv->Fill(q3, qinv13);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[2].fMeanQinv->Fill(q3, qinv23);
                    if(bin1==bin2 && bin1==bin3){
-                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[2].fTerms33D->Fill(qinv13, qinv12, qinv23);
-                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[2].fKfactor3D->Fill(qinv13, qinv12, qinv23, 1/(FSICorr12));
+                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[2].fTerms33D->Fill(qinv13, qinv12, qinv23);
+                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[2].fKfactor3D->Fill(qinv13, qinv12, qinv23, 1/(FSICorr12));
                    }
                  }if(fill4) {
                    if(fMCcase && fGenerateSignal) Winput = MCWeight3(4, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fTerms3->Fill(q3, Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fMeanQinv->Fill(q3, qinv12);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fMeanQinv->Fill(q3, qinv13);
-                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fMeanQinv->Fill(q3, qinv23);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fTerms3->Fill(q3, Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fMeanQinv->Fill(q3, qinv12);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fMeanQinv->Fill(q3, qinv13);
+                   Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[3].fMeanQinv->Fill(q3, qinv23);
                    if(bin1==bin2 && bin1==bin3){
-                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[3].fTerms33D->Fill(qinv13, qinv23, qinv12);
-                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[KT3index].ThreePT[3].fKfactor3D->Fill(qinv13, qinv23, qinv12, 1/(FSICorr12));
+                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[3].fTerms33D->Fill(qinv13, qinv23, qinv12);
+                     Charge1[0].Charge2[0].Charge3[0].MB[fMbin].EDB[EDindex3].ThreePT[3].fKfactor3D->Fill(qinv13, qinv23, qinv12, 1/(FSICorr12));
                    }
                  }
                }
@@ -2914,7 +3015,7 @@ void AliFourPion::UserExec(Option_t *)
                    weight23CC[0] = ((weight23+1) - ffcSq*FSICorr23 - (1-ffcSq));
                    weight23CC[0] /= FSICorr23*ffcSq;
                    if(weight12CC[0] > 0 && weight13CC[0] > 0 && weight23CC[0] > 0){
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuild->Fill(1, q3, sqrt(weight12CC[0]*weight13CC[0]*weight23CC[0]));
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuild->Fill(1, q3, sqrt(weight12CC[0]*weight13CC[0]*weight23CC[0]));
                    }
                    // no Muon Correction
                    weight12CC[1] = ((weight12+1)*MomResCorr12 - ffcSq*FSICorr12 - (1-ffcSq));
@@ -2924,7 +3025,7 @@ void AliFourPion::UserExec(Option_t *)
                    weight23CC[1] = ((weight23+1)*MomResCorr23 - ffcSq*FSICorr23 - (1-ffcSq));
                    weight23CC[1] /= FSICorr23*ffcSq;
                    if(weight12CC[1] > 0 && weight13CC[1] > 0 && weight23CC[1] > 0){
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuild->Fill(2, q3, sqrt(weight12CC[1]*weight13CC[1]*weight23CC[1]));
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuild->Fill(2, q3, sqrt(weight12CC[1]*weight13CC[1]*weight23CC[1]));
                    }
                    // both Corrections
                    weight12CC[2] = ((weight12+1)*MomResCorr12 - ffcSq*FSICorr12 - (1-ffcSq));
@@ -2950,10 +3051,10 @@ void AliFourPion::UserExec(Option_t *)
                    weightTotal = sqrt(weight12CC[2]*weight13CC[2]*weight23CC[2]);
                    /////////////////////////////////////////////////////
                    if(Positive1stTripletWeights){
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuild->Fill(3, q3, weightTotal);
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuild->Fill(4, q3, 1);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuild->Fill(3, q3, weightTotal);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuild->Fill(4, q3, 1);
                    }else{
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuildNeg->Fill(4, q3, 1);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuildNeg->Fill(4, q3, 1);
                    }
                   
                    //
@@ -2982,9 +3083,9 @@ void AliFourPion::UserExec(Option_t *)
                        weightTotal += 2*G*pow(1-G,2)*(T12*T13*t23 + T12*T23*t13 + T13*T23*t12) + 2*pow(1-G,3)*T12*T13*T23;
                        
                        if(Positive1stTripletWeights){
-                         Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuild->Fill(FillBin, q3, weightTotal);
+                         Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuild->Fill(FillBin, q3, weightTotal);
                        }else{
-                         Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuildNeg->Fill(FillBin, q3, weightTotal);
+                         Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuildNeg->Fill(FillBin, q3, weightTotal);
                        }
                      }
                    }
@@ -2996,7 +3097,7 @@ void AliFourPion::UserExec(Option_t *)
                      weightTotalErr = pow(2 * sqrt(3) * weight12CC_e*weight13CC[2]*weight23CC[2] / sqrt(weight12CC[2]*weight13CC[2]*weight23CC[2]),2);
                      }
                      weightTotalErr += pow(weight12CC_e,2) + pow(weight13CC_e,2) + pow(weight23CC_e,2);
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fBuildErr->Fill(4, q3, weightTotalErr);*/
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[EDindex3].ThreePT[4].fBuildErr->Fill(4, q3, weightTotalErr);*/
                    
                  }// 1st r3 den check
                  
@@ -3010,26 +3111,26 @@ void AliFourPion::UserExec(Option_t *)
                  if(ENsum==0){
                    ((TH3D*)fOutputList->FindObject("fKT3DistTerm1"))->Fill(fMbin+1, KT3, q3);
                    if(q3<0.1){
-                     ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, KT3index, pt1);
-                     ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, KT3index, pt2);
-                     ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, KT3index, pt3);
+                     ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, EDindex3, pt1);
+                     ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, EDindex3, pt2);
+                     ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, EDindex3, pt3);
                    }
                  }
                  if(fMbin==0){
                    if(ENsum==0){
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(KT3index, q3, pt1);
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(KT3index, q3, pt2);
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(KT3index, q3, pt3);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(EDindex3, q3, pt1);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(EDindex3, q3, pt2);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(EDindex3, q3, pt3);
                    }
                    if(ENsum==3){
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(KT3index, q3, pt1);
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(KT3index, q3, pt2);
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(KT3index, q3, pt3);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(EDindex3, q3, pt1);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(EDindex3, q3, pt2);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(EDindex3, q3, pt3);
                    }
                    if(ENsum==6){
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(KT3index, q3, pt1);
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(KT3index, q3, pt2);
-                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(KT3index, q3, pt3);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(EDindex3, q3, pt1);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(EDindex3, q3, pt2);
+                     ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(EDindex3, q3, pt3);
                    }
                  }
                  
@@ -3126,8 +3227,8 @@ void AliFourPion::UserExec(Option_t *)
                      for(Int_t Riter=0; Riter<fRVALUES; Riter++){
                        Float_t Rvalue = fRstartMC+Riter;
                        Float_t WInput = MCWeight3(term, Rvalue, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[KT3index].ThreePT[term-1].fIdeal->Fill(Rvalue, q3MC, WInput*WSpectrum);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[KT3index].ThreePT[term-1].fSmeared->Fill(Rvalue, q3, WInput*WSpectrum);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[EDindex3].ThreePT[term-1].fIdeal->Fill(Rvalue, q3MC, WInput*WSpectrum);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[EDindex3].ThreePT[term-1].fSmeared->Fill(Rvalue, q3, WInput*WSpectrum);
                      }
                    }
                    
@@ -3202,8 +3303,15 @@ void AliFourPion::UserExec(Option_t *)
                  }
                  
                  Float_t KT4 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1]+pVect4[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2]+pVect4[2],2))/4.;
-                 if(KT4<=fKT4transition) KT4index=0;
-                 else KT4index=1;
+                 if(!fq2Binning){
+                   if(KT4<=fKT4transition) EDindex4=0;
+                   else EDindex4=1;
+                 }else{
+                   EDindex4 = fEDbin;
+                   if(KT4>fKT4transition) {
+                     EDindex4=2+fEDbin;
+                   }
+                 }
                  
                  FSICorr14 = FSICorrelation(ch1,ch4, qinv14);
                  FSICorr24 = FSICorrelation(ch2,ch4, qinv24);
@@ -3247,9 +3355,9 @@ void AliFourPion::UserExec(Option_t *)
                      MomResWeight = MomResCorr12 * MomResCorr34;
                    }else {FSIfactor = 1.0; MomResWeight = 1.0;}
                    if(FillTerms[ft]) {
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fTerms4->Fill(q4, WInput);
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fKfactor->Fill(q4, FSIfactor, WInput);
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fKfactorWeighted->Fill(q4, FSIfactor, MomResWeight*WInput);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[ft].fTerms4->Fill(q4, WInput);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[ft].fKfactor->Fill(q4, FSIfactor, WInput);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[ft].fKfactorWeighted->Fill(q4, FSIfactor, MomResWeight*WInput);
                    }
                  }
                  
@@ -3282,7 +3390,7 @@ void AliFourPion::UserExec(Option_t *)
                        weightTotal += sqrt(weight12CC[0]*weight14CC[0]*weight23CC[0]*weight34CC[0]);
                        weightTotal += sqrt(weight13CC[0]*weight14CC[0]*weight23CC[0]*weight24CC[0]);
                        weightTotal /= 3.;
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuild->Fill(1, q4, weightTotal);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuild->Fill(1, q4, weightTotal);
                      }
                      // no Muon Correction
                      weight14CC[1] = ((weight14+1)*MomResCorr14 - ffcSq*FSICorr14 - (1-ffcSq));
@@ -3296,7 +3404,7 @@ void AliFourPion::UserExec(Option_t *)
                        weightTotal += sqrt(weight12CC[1]*weight14CC[1]*weight23CC[1]*weight34CC[1]);
                        weightTotal += sqrt(weight13CC[1]*weight14CC[1]*weight23CC[1]*weight24CC[1]);
                        weightTotal /= 3.;
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuild->Fill(2, q4, weightTotal);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuild->Fill(2, q4, weightTotal);
                      }
                      // both corrections
                      weight14CC[2] = ((weight14+1)*MomResCorr14 - ffcSq*FSICorr14 - (1-ffcSq));
@@ -3310,7 +3418,7 @@ void AliFourPion::UserExec(Option_t *)
                      weight34CC[2] *= MuonCorr34;
                      
                      if(weight14CC[2] < 0 || weight24CC[2] < 0 || weight34CC[2] < 0) {// C2^QS can never be less than unity
-                       if(fMbin==0 && bin1==0 && KT4index==0) {
+                       if(fMbin==0 && bin1==0 && EDindex4==0) {
                          ((TH1D*)fOutputList->FindObject("fTPNRejects4pion1"))->Fill(q4, sqrt(fabs(weight12CC[2]*weight23CC[2]*weight34CC[2]*weight14CC[2])));
                        }
                        if(weight14CC[2] < 0) weight14CC[2]=0;
@@ -3324,42 +3432,47 @@ void AliFourPion::UserExec(Option_t *)
                      weightTotal += sqrt(weight13CC[2]*weight14CC[2]*weight23CC[2]*weight24CC[2]);
                      weightTotal /= 3.;
                      if(Positive1stTripletWeights && Positive2ndTripletWeights){
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuild->Fill(3, q4, weightTotal);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuild->Fill(4, q4, 1);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimeBuild->Fill(4, q4, 1);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimePrimeBuild->Fill(4, q4, 1);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fCumulantBuild->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuild->Fill(3, q4, weightTotal);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuild->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuild->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuild->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuild->Fill(4, q4, 1);
                      }else{
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuildNeg->Fill(3, q4, weightTotal);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuildNeg->Fill(4, q4, 1);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimeBuildNeg->Fill(4, q4, 1);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimePrimeBuildNeg->Fill(4, q4, 1);
-                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fCumulantBuildNeg->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildNeg->Fill(3, q4, weightTotal);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildNeg->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuildNeg->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuildNeg->Fill(4, q4, 1);
+                       Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuildNeg->Fill(4, q4, 1);
                      }
                    }// CollisionType==0
                    
-                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fBuildFromFits->Fill(4, q4, 1);
-                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fPrimeBuildFromFits->Fill(4, q4, 1);
-                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fPrimePrimeBuildFromFits->Fill(4, q4, 1);
-                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fCumulantBuildFromFits->Fill(4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildFromFits->Fill(1, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuildFromFits->Fill(1, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuildFromFits->Fill(1, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuildFromFits->Fill(1, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildFromFits->Fill(2, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuildFromFits->Fill(2, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuildFromFits->Fill(2, 4, q4, 1);
+                   Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuildFromFits->Fill(2, 4, q4, 1);
                    // Full Weight reconstruction
-                   for(Int_t type=0; type<2; type++){// C2 interpolation, c3 fit
+                   for(Int_t type=0; type<3; type++){// C2 interpolation, c3 fit, C3 fit
                      if(type==0 && fCollisionType!=0) continue;
-                     for(Int_t RcohIndex=0; RcohIndex<7; RcohIndex++){// Rcoh=0, then Rcoh=Rch
+                     for(Int_t RcohIndex=0; RcohIndex<7; RcohIndex++){// Rcoh=0,1,2,3,4,5 fm, then Rcoh=Rch
                        t12 = exp(-pow(RcohIndex/FmToGeV * qinv12,2)/2.);
                        t13 = exp(-pow(RcohIndex/FmToGeV * qinv13,2)/2.);
                        t14 = exp(-pow(RcohIndex/FmToGeV * qinv14,2)/2.);
                        t23 = exp(-pow(RcohIndex/FmToGeV * qinv23,2)/2.);
                        t24 = exp(-pow(RcohIndex/FmToGeV * qinv24,2)/2.);
                        t34 = exp(-pow(RcohIndex/FmToGeV * qinv34,2)/2.);
+                                               
                        for(Int_t GIndex=0; GIndex<25; GIndex++){// 25 is enough
                          Int_t FillBin = 5 + RcohIndex*25 + GIndex;
                          Float_t G = 0.02*GIndex;
                          
-                         if(RcohIndex!=6){
-                           if(type==0){
-                             Float_t a = pow(1-G,2);
-                             Float_t b = 2*G*(1-G);
+                         if(type==0){// From C2
+                           Float_t a = pow(1-G,2);
+                           Float_t b = 2*G*(1-G);
+                           if(RcohIndex!=6){
                              T12 = (-b*t12 + sqrt(pow(b*t12,2) + 4*a*weight12CC[2])) / (2*a);
                              T13 = (-b*t13 + sqrt(pow(b*t13,2) + 4*a*weight13CC[2])) / (2*a);
                              T14 = (-b*t14 + sqrt(pow(b*t14,2) + 4*a*weight14CC[2])) / (2*a);
@@ -3367,36 +3480,36 @@ void AliFourPion::UserExec(Option_t *)
                              T24 = (-b*t24 + sqrt(pow(b*t24,2) + 4*a*weight24CC[2])) / (2*a);
                              T34 = (-b*t34 + sqrt(pow(b*t34,2) + 4*a*weight34CC[2])) / (2*a);
                            }else{
-                             T12 = ExchangeAmp[RcohIndex][GIndex]->Eval(qinv12);
-                             T13 = ExchangeAmp[RcohIndex][GIndex]->Eval(qinv13);
-                             T14 = ExchangeAmp[RcohIndex][GIndex]->Eval(qinv14);
-                             T23 = ExchangeAmp[RcohIndex][GIndex]->Eval(qinv23);
-                             T24 = ExchangeAmp[RcohIndex][GIndex]->Eval(qinv24);
-                             T34 = ExchangeAmp[RcohIndex][GIndex]->Eval(qinv34);
-                           }
-                         }else {// Full Size
-                           if(type==0){
                              T12 = sqrt(weight12CC[2] / (1-G*G));
                              T13 = sqrt(weight13CC[2] / (1-G*G));
                              T14 = sqrt(weight14CC[2] / (1-G*G));
                              T23 = sqrt(weight23CC[2] / (1-G*G));
                              T24 = sqrt(weight24CC[2] / (1-G*G));
                              T34 = sqrt(weight34CC[2] / (1-G*G));
-                           }else{
-                             T12 = ExchangeAmp[0][0]->Eval(qinv12) / pow( float(pow(1-G,3) + 3*G*pow(1-G,2)), float(1/3.));
-                             T13 = ExchangeAmp[0][0]->Eval(qinv13) / pow( float(pow(1-G,3) + 3*G*pow(1-G,2)), float(1/3.));
-                             T14 = ExchangeAmp[0][0]->Eval(qinv14) / pow( float(pow(1-G,3) + 3*G*pow(1-G,2)), float(1/3.));
-                             T23 = ExchangeAmp[0][0]->Eval(qinv23) / pow( float(pow(1-G,3) + 3*G*pow(1-G,2)), float(1/3.));
-                             T24 = ExchangeAmp[0][0]->Eval(qinv24) / pow( float(pow(1-G,3) + 3*G*pow(1-G,2)), float(1/3.));
-                             T34 = ExchangeAmp[0][0]->Eval(qinv34) / pow( float(pow(1-G,3) + 3*G*pow(1-G,2)), float(1/3.));
+                             t12 = T12;
+                             t13 = T13;
+                             t14 = T14;
+                             t23 = T23;
+                             t24 = T24;
+                             t34 = T34;
+                           }
+                         }else{// from c3 or C3 fit
+                           T12 = ExchangeAmp[RcohIndex][GIndex][type-1]->Eval(qinv12);
+                           T13 = ExchangeAmp[RcohIndex][GIndex][type-1]->Eval(qinv13);
+                           T14 = ExchangeAmp[RcohIndex][GIndex][type-1]->Eval(qinv14);
+                           T23 = ExchangeAmp[RcohIndex][GIndex][type-1]->Eval(qinv23);
+                           T24 = ExchangeAmp[RcohIndex][GIndex][type-1]->Eval(qinv24);
+                           T34 = ExchangeAmp[RcohIndex][GIndex][type-1]->Eval(qinv34);
+                           if(RcohIndex==6){
+                             t12 = T12;
+                             t13 = T13;
+                             t14 = T14;
+                             t23 = T23;
+                             t24 = T24;
+                             t34 = T34;
                            }
-                           t12 = T12;
-                           t13 = T13;
-                           t14 = T14;
-                           t23 = T23;
-                           t24 = T24;
-                           t34 = T34;
                          }
+                                                                         
                          // Build the correlation functions
                          weightTotal = 2*G*(1-G)*(T12*t12 + T13*t13 + T14*t14 + T23*t23 + T24*t24 + T34*t34);// 2-pion
                          weightTotal += pow(1-G,2)*(T12*T12 + T13*T13 + T14*T14 + T23*T23 + T24*T24 + T34*T34);// 2-pion fully chaotic
@@ -3422,21 +3535,21 @@ void AliFourPion::UserExec(Option_t *)
                          
                          if(type==0){
                            if(Positive1stTripletWeights && Positive2ndTripletWeights){
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuild->Fill(FillBin, q4, weightTotal);
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimeBuild->Fill(FillBin, q4, weightPrime);
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimePrimeBuild->Fill(FillBin, q4, weightPrimePrime);
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fCumulantBuild->Fill(FillBin, q4, weightCumulant);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuild->Fill(FillBin, q4, weightTotal);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuild->Fill(FillBin, q4, weightPrime);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuild->Fill(FillBin, q4, weightPrimePrime);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuild->Fill(FillBin, q4, weightCumulant);
                            }else{
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuildNeg->Fill(FillBin, q4, weightTotal);
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimeBuildNeg->Fill(FillBin, q4, weightPrime);
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fPrimePrimeBuildNeg->Fill(FillBin, q4, weightPrimePrime);
-                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fCumulantBuildNeg->Fill(FillBin, q4, weightCumulant);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildNeg->Fill(FillBin, q4, weightTotal);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuildNeg->Fill(FillBin, q4, weightPrime);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuildNeg->Fill(FillBin, q4, weightPrimePrime);
+                             Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuildNeg->Fill(FillBin, q4, weightCumulant);
                            }
                          }else{
-                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fBuildFromFits->Fill(FillBin, q4, weightTotal);
-                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fPrimeBuildFromFits->Fill(FillBin, q4, weightPrime);
-                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fPrimePrimeBuildFromFits->Fill(FillBin, q4, weightPrimePrime);
-                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[KT4index].FourPT[12].fCumulantBuildFromFits->Fill(FillBin, q4, weightCumulant);
+                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildFromFits->Fill(type, FillBin, q4, weightTotal);
+                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimeBuildFromFits->Fill(type, FillBin, q4, weightPrime);
+                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fPrimePrimeBuildFromFits->Fill(type, FillBin, q4, weightPrimePrime);
+                           Charge1[0].Charge2[0].Charge3[0].Charge4[0].MB[fMbin].EDB[EDindex4].FourPT[12].fCumulantBuildFromFits->Fill(type, FillBin, q4, weightCumulant);
                          }
                          
                        }// GIndex 
@@ -3454,10 +3567,10 @@ void AliFourPion::UserExec(Option_t *)
                      }
                      weightTotalErr += 2*(pow(weight12CC_e*weight34CC[2],2) + pow(weight13CC_e*weight24CC[2],2) + pow(weight14CC_e*weight23CC[2],2));
                      weightTotalErr += pow(weight12CC_e,2) + pow(weight13CC_e,2) + pow(weight14CC_e,2) + pow(weight23CC_e,2) + pow(weight24CC_e,2) + pow(weight34CC_e,2);
-                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fBuildErr->Fill(4, q4, weightTotalErr);
+                     Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[EDindex4].FourPT[12].fBuildErr->Fill(4, q4, weightTotalErr);
                    */
                    // Radius estimations for c4
-                   if(fMbin==0 && KT4index==0){
+                   if(fMbin==0 && EDindex4==0){
                      for(Int_t Rindex=0; Rindex<7; Rindex++){
                        Float_t R = (6. + Rindex)/FmToGeV;
                        Float_t arg12=qinv12*R;
@@ -3490,38 +3603,38 @@ void AliFourPion::UserExec(Option_t *)
                    if(ENsum==0){
                      ((TH3D*)fOutputList->FindObject("fKT4DistTerm1"))->Fill(fMbin+1, KT4, q4);
                      if(q4<0.105){
-                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt1);
-                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt2);
-                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt3);
-                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt4);
+                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, EDindex4, pt1);
+                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, EDindex4, pt2);
+                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, EDindex4, pt3);
+                       ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, EDindex4, pt4);
                      }
                    }
                    if(fMbin==0){
                      if(ENsum==0){
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt1);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt2);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt3);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt4);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(EDindex4, q4, pt1);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(EDindex4, q4, pt2);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(EDindex4, q4, pt3);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(EDindex4, q4, pt4);
                      }else if(ENsum==1){
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt1);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt2);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt3);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt4);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(EDindex4, q4, pt1);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(EDindex4, q4, pt2);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(EDindex4, q4, pt3);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(EDindex4, q4, pt4);
                        }else if(ENsum==2){
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt1);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt2);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt3);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt4);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(EDindex4, q4, pt1);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(EDindex4, q4, pt2);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(EDindex4, q4, pt3);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(EDindex4, q4, pt4);
                      }else if(ENsum==3){
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt1);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt2);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt3);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt4);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(EDindex4, q4, pt1);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(EDindex4, q4, pt2);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(EDindex4, q4, pt3);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(EDindex4, q4, pt4);
                      }else{// 6
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt1);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt2);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt3);
-                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt4);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(EDindex4, q4, pt1);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(EDindex4, q4, pt2);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(EDindex4, q4, pt3);
+                       ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(EDindex4, q4, pt4);
                      }
                      
                    }
@@ -3632,8 +3745,8 @@ void AliFourPion::UserExec(Option_t *)
                        for(Int_t Riter=0; Riter<fRVALUES; Riter++){
                          Float_t Rvalue = fRstartMC+Riter;
                          Float_t WInput = MCWeight4(term, Rvalue, ffcSqMRC, chGroup4, QinvMCGroup4, kTGroup4);
-                         Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[KT4index].FourPT[term-1].fIdeal->Fill(Rvalue, q4MC, WInput*WSpectrum);
-                         Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[KT4index].FourPT[term-1].fSmeared->Fill(Rvalue, q4, WInput*WSpectrum);
+                         Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[EDindex4].FourPT[term-1].fIdeal->Fill(Rvalue, q4MC, WInput*WSpectrum);
+                         Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[EDindex4].FourPT[term-1].fSmeared->Fill(Rvalue, q4, WInput*WSpectrum);
                        }
                      }
                    
@@ -4698,15 +4811,18 @@ void AliFourPion::SetMuonCorrections(Bool_t legoCase, TH2D *tempMuon){
   cout<<"Done reading Muon file"<<endl;
 }
 //________________________________________________________________________
-void AliFourPion::Setc3FitEAs(Bool_t legoCase, TH3D *histoPbPb, TH3D *histopPb, TH3D *histopp){
+void AliFourPion::Setc3FitEAs(Bool_t legoCase, TH3D *histoPbPb[2], TH3D *histopPb[2], TH3D *histopp[2]){
+  
   if(legoCase){
     cout<<"LEGO call to Setc3FitEAs"<<endl;
-    fPbPbc3FitEA = (TH3D*)histoPbPb->Clone();
-    fpPbc3FitEA = (TH3D*)histopPb->Clone();
-    fppc3FitEA = (TH3D*)histopp->Clone();
-    fPbPbc3FitEA->SetDirectory(0);
-    fpPbc3FitEA->SetDirectory(0);
-    fppc3FitEA->SetDirectory(0);
+    for(Int_t FT=0; FT<2; FT++){
+      fPbPbc3FitEA[FT] = (TH3D*)histoPbPb[FT]->Clone();
+      fpPbc3FitEA[FT] = (TH3D*)histopPb[FT]->Clone();
+      fppc3FitEA[FT] = (TH3D*)histopp[FT]->Clone();
+      fPbPbc3FitEA[FT]->SetDirectory(0);
+      fpPbc3FitEA[FT]->SetDirectory(0);
+      fppc3FitEA[FT]->SetDirectory(0);
+    }
   }else{
     cout<<"non LEGO call to Setc3FitEAs"<<endl;
     TFile *EAfile = new TFile("c3EAfile.root","READ");
@@ -4714,12 +4830,21 @@ void AliFourPion::Setc3FitEAs(Bool_t legoCase, TH3D *histoPbPb, TH3D *histopPb,
       cout<<"No EA file found"<<endl;
       AliFatal("No EA file found.  Kill process.");
     }else {cout<<"Good EA File Found!"<<endl;}
-    fPbPbc3FitEA = (TH3D*)EAfile->Get("PbPbEA");
-    fpPbc3FitEA = (TH3D*)EAfile->Get("pPbEA");
-    fppc3FitEA = (TH3D*)EAfile->Get("ppEA");
-    fPbPbc3FitEA->SetDirectory(0);
-    fpPbc3FitEA->SetDirectory(0);
-    fppc3FitEA->SetDirectory(0);
+    for(Int_t FT=0; FT<2; FT++){
+      if(FT==0){
+       fPbPbc3FitEA[FT] = (TH3D*)EAfile->Get("PbPbEA_c3");
+       fpPbc3FitEA[FT] = (TH3D*)EAfile->Get("pPbEA_c3");
+       fppc3FitEA[FT] = (TH3D*)EAfile->Get("ppEA_c3");
+      }else{
+       fPbPbc3FitEA[FT] = (TH3D*)EAfile->Get("PbPbEA_C3");
+       fpPbc3FitEA[FT] = (TH3D*)EAfile->Get("pPbEA_C3");
+       fppc3FitEA[FT] = (TH3D*)EAfile->Get("ppEA_C3");
+      }
+      fPbPbc3FitEA[FT]->SetDirectory(0);
+      fpPbc3FitEA[FT]->SetDirectory(0);
+      fppc3FitEA[FT]->SetDirectory(0);
+    }
+    EAfile->Close();
   }
   cout<<"Done reading EA file"<<endl;
 }
index f0461875567732ba5ef57695d45086f8e294e3f9..886ffc4d6dbd5d9a196630afbe24736c816d26c6 100755 (executable)
@@ -62,7 +62,7 @@ class AliFourPion : public AliAnalysisTaskSE {
 
   static const Int_t fKbinsT   = 4;// Set fKstep as well !!!!
   static const Int_t fKbinsY   = 1;// Set fKstep as well !!!!
-  static const Int_t fEDbins   = 2;
+  static const Int_t fEDbins   = 4;
   static const Int_t fCentBins = 10;// 0-50%
   static const Int_t fMbinsMixing = 10;// 5% widths
   static const Int_t fRVALUES  = 7;// 7 EW radii (5-11) , was 8 Gaussian radii (3-10fm)
@@ -76,7 +76,7 @@ class AliFourPion : public AliAnalysisTaskSE {
   void SetMomResCorrections(Bool_t legoCase=kTRUE, TH2D *temp2DSC=0x0, TH2D *temp2DMC=0x0);
   void SetFSICorrelations(Bool_t legoCase=kTRUE, TH1D *tempss[12]=0x0, TH1D *tempos[12]=0x0);
   void SetMuonCorrections(Bool_t legoCase=kTRUE, TH2D *tempMuon=0x0);
-  void Setc3FitEAs(Bool_t legoCase=kTRUE, TH3D *histoPbPb=0x0, TH3D *histopPb=0x0, TH3D *histopp=0x0);
+  void Setc3FitEAs(Bool_t legoCase=kTRUE, TH3D *histoPbPb[2]=0x0, TH3D *histopPb[2]=0x0, TH3D *histopp[2]=0x0);
   //
   void SetMCdecision(Bool_t mc) {fMCcase = mc;}
   void SetTabulatePairs(Bool_t tabulate) {fTabulatePairs = tabulate;}
@@ -105,6 +105,10 @@ class AliFourPion : public AliAnalysisTaskSE {
   void SetNormLow(Float_t nl) {fNormQcutLow = nl;}
   void SetNormHigh(Float_t nh) {fNormQcutHigh = nh;}
   void SetFSIindexSmallSystem(Int_t ind) {fFSIindexSmallSystem = ind;}
+  void Setq2Binning(Bool_t qb) {fq2Binning = qb;}
+  void Setq2Index(Int_t q2i) {fq2Index = q2i;}
+  void Setq2CutLow(Float_t q2l) {fq2CutLow = q2l;}
+  void Setq2CutHigh(Float_t q2h) {fq2CutHigh = q2h;}
   //
   
 
@@ -219,10 +223,10 @@ class AliFourPion : public AliAnalysisTaskSE {
     //
     TH2D *fBuildErr; //!
     //
-    TH2D *fBuildFromFits; //!
-    TH2D *fPrimeBuildFromFits; //!
-    TH2D *fPrimePrimeBuildFromFits; //!
-    TH2D *fCumulantBuildFromFits; //!
+    TH3D *fBuildFromFits; //!
+    TH3D *fPrimeBuildFromFits; //!
+    TH3D *fPrimePrimeBuildFromFits; //!
+    TH3D *fCumulantBuildFromFits; //!
   };
   struct St_EDB {
     struct St5 TwoPT[2];
@@ -318,7 +322,10 @@ class AliFourPion : public AliAnalysisTaskSE {
   Float_t fQmean[kQbinsWeights];
   Float_t fDampStart;
   Float_t fDampStep;
-  
+  Bool_t fq2Binning;
+  Int_t fq2Index;
+  Float_t fq2CutLow;
+  Float_t fq2CutHigh;
   Float_t fTPCTOFboundry;
   Float_t fTOFboundry;
   Float_t fSigmaCutTPC;
@@ -372,13 +379,13 @@ class AliFourPion : public AliAnalysisTaskSE {
   TH2D *fMomResC2SC;
   TH2D *fMomResC2MC;
   TH2D *fWeightmuonCorrection;
-  TH3D *fPbPbc3FitEA;
-  TH3D *fpPbc3FitEA;
-  TH3D *fppc3FitEA;
+  TH3D *fPbPbc3FitEA[2];
+  TH3D *fpPbc3FitEA[2];
+  TH3D *fppc3FitEA[2];
   TH1D *fFSIss[13];
   TH1D *fFSIos[13];
   TH3F *fNormWeight[fKbinsT][fCentBins];
-  TF1 *ExchangeAmp[6][50];
+  TF1 *ExchangeAmp[7][50][2];
 
   ClassDef(AliFourPion, 1); 
 };
index a3aa6a4d62353ecd88425ed30dabc477777dad41..754c2759ce59e16c64d54f74d539734f84c43483 100755 (executable)
@@ -44,6 +44,11 @@ AliFourPion *AddTaskFourPion(
   FourPionTask->SetMaxPt(1.0);
   FourPionTask->SetKT3transition(0.3);
   FourPionTask->SetKT4transition(0.3);
+  FourPionTask->Setq2Binning(kFALSE);
+  FourPionTask->Setq2Index(0);
+  FourPionTask->Setq2CutLow(0.55);
+  FourPionTask->Setq2CutHigh(1.25);
+
   mgr->AddTask(FourPionTask);
 
 
@@ -96,12 +101,17 @@ AliFourPion *AddTaskFourPion(
       cout << "Requested file:" << inputFileEA << " was not opened. ABORT." << endl;
       return NULL;
     }
-    TH3D *PbPbEA = 0;
-    TH3D *pPbEA = 0;
-    TH3D *ppEA = 0;
-    PbPbEA = (TH3D*)inputFileEA->Get("PbPbEA");
-    pPbEA = (TH3D*)inputFileEA->Get("pPbEA");
-    ppEA = (TH3D*)inputFileEA->Get("ppEA");
+    TH3D *PbPbEA[2];
+    TH3D *pPbEA[2];
+    TH3D *ppEA[2];
+    PbPbEA[0] = (TH3D*)inputFileEA->Get("PbPbEA_c3");
+    pPbEA[0] = (TH3D*)inputFileEA->Get("pPbEA_c3");
+    ppEA[0] = (TH3D*)inputFileEA->Get("ppEA_c3");
+    //
+    PbPbEA[1] = (TH3D*)inputFileEA->Get("PbPbEA_C3");
+    pPbEA[1] = (TH3D*)inputFileEA->Get("pPbEA_C3");
+    ppEA[1] = (TH3D*)inputFileEA->Get("ppEA_C3");
+    //
     FourPionTask->Setc3FitEAs( kTRUE, PbPbEA, pPbEA, ppEA );
     ////////////////////////////////////////////////////
   }// TabulatePairs check
diff --git a/PWGCF/FLOW/macros/AddTaskFlowStrangee.C b/PWGCF/FLOW/macros/AddTaskFlowStrangee.C
new file mode 100644 (file)
index 0000000..2a78f03
--- /dev/null
@@ -0,0 +1,768 @@
+UInt_t SFT_gbTrigger;
+Bool_t SFT_gbReadESD;
+Bool_t SFT_gbReadMC;
+Int_t SFT_gbMatchMC;
+Bool_t SFT_gbAvoidExec;
+Bool_t SFT_gbSkipCentrality;
+Bool_t SFT_gbExtraEventCut;
+TString SFT_gbCentMethod;
+Int_t SFT_gbCentPerMin,SFT_gbCentPerMax;
+Bool_t SFT_gbRunPP;
+Bool_t SFT_gbRunPA;
+Int_t SFT_gbSpecie;
+Bool_t SFT_gbHomemade;
+Bool_t SFT_gbOnline;
+Int_t SFT_gbMinNClsTPC;
+Int_t SFT_gbMinNClsITS;
+Int_t SFT_gbMinXRows;
+Double_t SFT_gbMaxChi2PerNClsTPC;
+Double_t SFT_gbMinXRowsOverNClsFTPC;
+Double_t SFT_gbMinEta;
+Double_t SFT_gbMaxEta;
+Double_t SFT_gbMinPt;
+Double_t SFT_gbMinImpactParameterXY;
+Double_t SFT_gbMaxNSigmaPID;
+Double_t SFT_gbMaxRapidity;
+Double_t SFT_gbMaxDCAdaughters;
+Double_t SFT_gbMinCosinePointingAngleXY;
+Double_t SFT_gbPIDPt;
+Double_t SFT_gbMinQt;
+Bool_t   SFT_gbQtPie;
+Double_t SFT_gbMinRadXY;
+Double_t SFT_gbMaxDecayLength;
+Double_t SFT_gbMaxProductIPXY;
+Int_t SFT_gbDebug;
+Int_t SFT_gbQA;
+TString SFT_gbFolder;
+TString SFT_gbSuffix;
+TString SFT_gbStamp;
+Int_t SFT_gbRFPFilterBit;
+Double_t SFT_gbRFPminPt;
+Double_t SFT_gbRFPmaxPt;
+Double_t SFT_gbRFPAminEta;
+Double_t SFT_gbRFPAmaxEta;
+Double_t SFT_gbRFPCminEta;
+Double_t SFT_gbRFPCmaxEta;
+Double_t SFT_gbRFPTPCsignal;
+Double_t SFT_gbRFPmaxIPxy;
+Double_t SFT_gbRFPmaxIPz;
+Int_t SFT_gbRFPTPCncls;
+Bool_t SFT_gbAddPitoMCRP;
+Bool_t SFT_gbAllCC;
+Bool_t SFT_gbSkipSelection;
+Bool_t SFT_gbSkipVn;
+Int_t SFT_gbWhichPsi;
+Bool_t SFT_gbFlowPackage;
+Bool_t SFT_gbShrinkFP;
+Bool_t SFT_gbSPVZE;
+Bool_t SFT_gbSPTPC;
+Bool_t SFT_gbSPVZEhalf;
+Bool_t SFT_gbQCTPC;
+Bool_t SFT_gbMCEP;
+Int_t SFT_gbHarmonic;
+TString SFT_gbVZEload;
+Bool_t SFT_gbVZEsave;
+Bool_t SFT_gbVZEmb;
+Bool_t SFT_gbVZEpdisk;
+Int_t SFT_gbV0CRingMin;
+Int_t SFT_gbV0CRingMax;
+Int_t SFT_gbV0ARingMin;
+Int_t SFT_gbV0ARingMax;
+Int_t SFT_gbDauITS0On;
+Int_t SFT_gbDauITS1On;
+Int_t SFT_gbDauITS2On;
+Int_t SFT_gbDauITS3On;
+Int_t SFT_gbDauITS4On;
+Int_t SFT_gbDauITS5On;
+Bool_t SFT_gbDauSPDany;
+Bool_t SFT_gbDauITSrefit;
+Int_t SFT_gbmaxITSclusterShared;
+Double_t SFT_gbmaxITSChi2;
+
+Bool_t SFT_gbUntagDaughter;
+Int_t SFT_gbPostMatched;
+Double_t SFT_gbVertexZcut;
+
+
+void AddTaskFlowStrangee(TString configFile, TString alienaddress, Bool_t skipTerminate=kFALSE) {
+  Int_t ret = gSystem->Exec( Form("alien_cp %s/%s .",alienaddress.Data(),configFile.Data()) );
+  printf("FlowStrange copying from grid %d\n",ret);
+  AddTaskFlowStrangee(configFile,skipTerminate);
+}
+void AddTaskFlowStrangee(TString configFile, Bool_t skipTerminate=kFALSE) {
+  SFT_ReadConfig(configFile);
+  if(SFT_gbAllCC) {
+    int centMin[8] = {00,05,10,20,30,40,50,60};
+    int ncent=7;
+    if(SFT_gbRunPP) {
+      ncent=3;
+      centMin[0]=00;
+      centMin[1]=20;
+      centMin[2]=40;
+      centMin[3]=60;
+    } else if(SFT_gbRunPA) {
+      ncent=3;
+      centMin[0]=00;
+      centMin[1]=20;
+      centMin[2]=40;
+      centMin[3]=60;
+    }
+    TString antSuffix = SFT_gbSuffix;
+    for(int cc=0; cc!=ncent; ++cc) {
+      SFT_gbCentPerMin = centMin[cc];
+      SFT_gbCentPerMax = centMin[cc+1];
+      SFT_gbSuffix = Form("%s%02d%02d",antSuffix.Data(),SFT_gbCentPerMin,SFT_gbCentPerMax);
+      AddTaskFlowStrangee(skipTerminate);
+    }
+  } else {
+    AddTaskFlowStrangee(skipTerminate);
+  }
+}
+void AddTaskFlowStrangee(Bool_t skipTerminate) {
+  SFT_PrintConfig();
+
+  TString fileName = AliAnalysisManager::GetCommonFileName();
+  fileName.ReplaceAll(".root","");
+  SFT_gbStamp = SFT_gbFolder + SFT_gbSuffix;
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+
+  //-----------------STRANGE TASK----------------------------
+  AliAnalysisTaskFlowStrangee *taskSel = new AliAnalysisTaskFlowStrangee(Form("FS_%s",SFT_gbStamp.Data()) );
+  taskSel->SelectCollisionCandidates(SFT_gbTrigger);
+  taskSel->SetReadESD(SFT_gbReadESD);
+  taskSel->SetPostMatched(SFT_gbPostMatched);
+  taskSel->SetReadMC(SFT_gbReadMC);
+  taskSel->SetAvoidExec(SFT_gbAvoidExec);
+  taskSel->SetSkipCentralitySelection(SFT_gbSkipCentrality);
+  taskSel->SetSkipSelection(SFT_gbSkipSelection);
+  taskSel->SetSkipVn(SFT_gbSkipVn);
+  taskSel->SetExtraEventRejection(SFT_gbExtraEventCut);
+  taskSel->SetCentralityRange(SFT_gbCentMethod,SFT_gbCentPerMin,SFT_gbCentPerMax);
+  taskSel->SetSkipTerminate(skipTerminate);
+  taskSel->SetHarmonic(SFT_gbHarmonic);
+  Int_t npt = 24;
+  Double_t ptbin[25] = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8,
+                         2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4.0, 4.5, 5.0, 6.0,
+                         8.0, 10., 12., 16., 20.};
+  taskSel->SetPtEdges(npt,ptbin);
+  if(SFT_gbRunPP) taskSel->Setpp();
+  if(SFT_gbRunPA) taskSel->SetpA();
+  taskSel->SetDebug(SFT_gbDebug);
+  taskSel->SetK0L0(SFT_gbSpecie);
+  taskSel->SetOnline( SFT_gbOnline );
+  taskSel->SetMass( SFT_MassBins(SFT_gbSpecie),
+                    SFT_MinMass(SFT_gbSpecie),
+                    SFT_MaxMass(SFT_gbSpecie) );
+
+  taskSel->SetWhichPsi(SFT_gbWhichPsi);
+  taskSel->SetRFPFilterBit(SFT_gbRFPFilterBit);
+  taskSel->SetRFPMinPt(SFT_gbRFPminPt);
+  taskSel->SetRFPMaxPt(SFT_gbRFPmaxPt);
+  taskSel->SetRFPAMinEta(SFT_gbRFPAminEta);
+  taskSel->SetRFPAMaxEta(SFT_gbRFPAmaxEta);
+  taskSel->SetRFPCMinEta(SFT_gbRFPCminEta);
+  taskSel->SetRFPCMaxEta(SFT_gbRFPCmaxEta);
+  taskSel->SetRFPTPCSignal(SFT_gbRFPTPCsignal);
+  taskSel->SetRFPMaxIPxy(SFT_gbRFPmaxIPxy);
+  taskSel->SetRFPMaxIPz(SFT_gbRFPmaxIPz);
+  taskSel->SetRFPMinTPCCls(SFT_gbRFPTPCncls);
+
+  taskSel->SetAddPiToMCReactionPlane(SFT_gbAddPitoMCRP);
+  taskSel->SetDauUnTagProcedure(SFT_gbUntagDaughter);
+  taskSel->SetVertexZcut(SFT_gbVertexZcut);
+
+  taskSel->SetDauMinNClsTPC(SFT_gbMinNClsTPC);
+  taskSel->SetDauMinNClsITS(SFT_gbMinNClsITS);
+  taskSel->SetDauMinXRows(SFT_gbMinXRows);
+  taskSel->SetDauMaxChi2PerNClsTPC(SFT_gbMaxChi2PerNClsTPC);
+  taskSel->SetDauMinXRowsOverNClsFTPC(SFT_gbMinXRowsOverNClsFTPC);
+  taskSel->SetDauMinEta(SFT_gbMinEta);
+  taskSel->SetDauMaxEta(SFT_gbMaxEta);
+  taskSel->SetDauMinPt(SFT_gbMinPt);
+  taskSel->SetDauMinImpactParameterXY(SFT_gbMinImpactParameterXY);
+  taskSel->SetDauMaxNSigmaPID(SFT_gbMaxNSigmaPID);
+  taskSel->SetDauITSLayer(0,SFT_gbDauITS0On);
+  taskSel->SetDauITSLayer(1,SFT_gbDauITS1On);
+  taskSel->SetDauITSLayer(2,SFT_gbDauITS2On);
+  taskSel->SetDauITSLayer(3,SFT_gbDauITS3On);
+  taskSel->SetDauITSLayer(4,SFT_gbDauITS4On);
+  taskSel->SetDauITSLayer(5,SFT_gbDauITS5On);
+  taskSel->SetDauSPDRequireAny(SFT_gbDauSPDany);
+  taskSel->SetDauITSrefit(SFT_gbDauITSrefit);
+
+  //newITScuts
+  taskSel->SetMaxSharedITSCluster(SFT_gbmaxITSclusterShared);
+  taskSel->SetMaxChi2perITSCluster(SFT_gbmaxITSChi2);
+  
+  taskSel->SetMaxRapidity(SFT_gbMaxRapidity);
+  taskSel->SetMaxDCAdaughters(SFT_gbMaxDCAdaughters);
+  taskSel->SetMinCosinePointingAngleXY(SFT_gbMinCosinePointingAngleXY);
+  taskSel->SetMinQt(SFT_gbMinQt,SFT_gbQtPie);
+  taskSel->SetStopPIDAtPt(SFT_gbPIDPt);
+  taskSel->SetMinRadXY(SFT_gbMinRadXY);
+  taskSel->SetMaxDecayLength(SFT_gbMaxDecayLength);
+  taskSel->SetMaxProductIPXY(SFT_gbMaxProductIPXY);
+  taskSel->SetMinEta(SFT_gbMinEta);
+  taskSel->SetMaxEta(SFT_gbMaxEta);
+  taskSel->SetMinPt(SFT_gbMinPt);
+  taskSel->SetUseFlowPackage(SFT_gbFlowPackage);
+
+  taskSel->SetQAlevel(SFT_gbQA);
+  /*
+  AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",SFT_gbSuffix));
+  if(!cutsRP) {
+    //if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;
+    return 0x0;
+  }
+  cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks
+  cutsRP->SetVZEROgainEqualizationPerRing(kFALSE);
+  cutsRP->SetApplyRecentering(kTRUE);
+  taskSel->SetRPCuts(cutsRP);
+  */
+  
+  if(SFT_gbVZEload.Length()>4) {
+    TFile *ocalib = TFile::Open(SFT_gbVZEload);
+    if(ocalib->IsOpen()) {
+      TList *vzero = ocalib->Get("VZECALIB");
+      taskSel->LoadVZEResponse(vzero,SFT_gbVZEmb,SFT_gbVZEpdisk);
+    } else {
+      printf("ADDTASKFLOWSTRANGEE COULD NOT OPEN %s. NO VZE CALIBRATION LOADED!\n",SFT_gbVZEload.Data());
+    }
+  }
+  printf("Loading %d %d %d %d as VZE configuration\n",SFT_gbV0CRingMin, SFT_gbV0CRingMax, SFT_gbV0ARingMin, SFT_gbV0ARingMax);
+  taskSel->SetRFPVZERingRange( SFT_gbV0CRingMin, SFT_gbV0CRingMax, SFT_gbV0ARingMin, SFT_gbV0ARingMax );
+  taskSel->SetStoreVZEResponse(SFT_gbVZEsave);
+  
+
+  AliAnalysisDataContainer *cOutHist = mgr->CreateContainer(Form("FS_OH_%s",SFT_gbStamp.Data()),
+                                                           TList::Class(),
+                                                           AliAnalysisManager::kOutputContainer,
+                                                           Form("%s.root:Selector_%s",fileName.Data(),
+                                                                SFT_gbFolder.Data()));
+  AliAnalysisDataContainer *exc_TPC = mgr->CreateContainer( Form("FS_TPC_%s",SFT_gbStamp.Data()),
+                                                            AliFlowEventSimple::Class(),
+                                                            AliAnalysisManager::kExchangeContainer );
+  AliAnalysisDataContainer *exc_VZE = mgr->CreateContainer( Form("FS_VZE_%s",SFT_gbStamp.Data()),
+                                                            AliFlowEventSimple::Class(),
+                                                            AliAnalysisManager::kExchangeContainer );
+  mgr->AddTask(taskSel);
+  mgr->ConnectInput (taskSel,0,cinput1);
+  mgr->ConnectOutput(taskSel,1,cOutHist);
+  mgr->ConnectOutput(taskSel,2,exc_TPC);
+  mgr->ConnectOutput(taskSel,3,exc_VZE);
+
+  if(!SFT_gbFlowPackage) return;
+  if( (!SFT_gbQCTPC) && (!SFT_gbSPVZE) && (!SFT_gbSPTPC) ) return;
+  //-------------------FLOWPACKAGE TASKS----------------------------
+  AliFlowTrackSimpleCuts *filter[20], *filterhf[20][2]; // MASS BANDS
+  int mbs = SFT_MassBands(SFT_gbSpecie);
+  if(SFT_gbPostMatched) mbs = 1;
+  for(int mb=0; mb!=mbs; ++mb) {
+    filter[mb] = new AliFlowTrackSimpleCuts( Form("Filter_MB%d",mb) );
+    filter[mb]->SetEtaMin( -0.8 ); filter[mb]->SetEtaMax( +0.8 );
+    Double_t minmass = SFT_MassBandLowEdge(SFT_gbSpecie,mb);
+    Double_t maxmass = SFT_MassBandLowEdge(SFT_gbSpecie,mb+1);
+    if(SFT_gbPostMatched) maxmass = SFT_MassBandLowEdge(SFT_gbSpecie,SFT_MassBands(SFT_gbSpecie));
+    filter[mb]->SetMassMin( minmass ); filter[mb]->SetMassMax( maxmass );
+    //half window for POIs
+    filterhf[mb][0] = new AliFlowTrackSimpleCuts( Form("Filterhf0_MB%d",mb) );
+    filterhf[mb][0]->SetEtaMin( +0.0 ); filterhf[mb][0]->SetEtaMax( +0.8 );
+    filterhf[mb][0]->SetMassMin( minmass ); filterhf[mb][0]->SetMassMax( maxmass );
+    filterhf[mb][1] = new AliFlowTrackSimpleCuts( Form("Filterhf1_MB%d",mb) );
+    filterhf[mb][1]->SetEtaMin( -0.8 ); filterhf[mb][1]->SetEtaMax( -0.0 );
+    filterhf[mb][1]->SetMassMin( minmass ); filterhf[mb][1]->SetMassMax( maxmass );
+    if(SFT_gbQCTPC) {
+      SFT_AddQCmethod( Form("QCTPCMB%d",mb), exc_TPC, filter[mb]); // QC TPC
+    }
+    if(SFT_gbSPTPC) {
+      SFT_AddSPmethod( Form("SPTPCMB%d",mb), exc_TPC, filterhf[mb][0], "Qa" ); // SP TPC Qa
+      SFT_AddSPmethod( Form("SPTPCMB%d",mb), exc_TPC, filterhf[mb][1], "Qb" ); // SP TPC Qb
+      SFT_AddSPmethod( Form("SPTPC2MB%d",mb), exc_TPC, filterhf[mb][0], "Qa", 0.2 ); // SP TPC Qa
+      SFT_AddSPmethod( Form("SPTPC2MB%d",mb), exc_TPC, filterhf[mb][1], "Qb", 0.2 ); // SP TPC Qb
+      SFT_AddSPmethod( Form("SPTPC4MB%d",mb), exc_TPC, filterhf[mb][0], "Qa", 0.4 ); // SP TPC Qa
+      SFT_AddSPmethod( Form("SPTPC4MB%d",mb), exc_TPC, filterhf[mb][1], "Qb", 0.4 ); // SP TPC Qb
+    }
+    if(SFT_gbMCEP) {
+      SFT_AddMCEPmethod( Form("MCEPMB%d",mb), exc_TPC, filter[mb]); // MCEP TPC
+    }
+    if(SFT_gbSPVZE) {
+      if(SFT_gbSPVZEhalf) {
+       SFT_AddSPmethod( Form("SPVZEMB%d",mb), exc_VZE, filterhf[mb][0], "Qa", 1.0 ); // SP VZE Qa
+       SFT_AddSPmethod( Form("SPVZEMB%d",mb), exc_VZE, filterhf[mb][1], "Qb", 1.0 ); // SP VZE Qa
+      } else {
+       SFT_AddSPmethod( Form("SPVZEMB%d",mb), exc_VZE, filter[mb], "Qa", 1.0 ); // SP VZE Qa
+       SFT_AddSPmethod( Form("SPVZEMB%d",mb), exc_VZE, filter[mb], "Qb", 1.0 ); // SP VZE Qa
+      }
+    }
+  }
+}
+void SFT_AddMCEPmethod(char *name, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL) {
+  TString fileName = AliAnalysisManager::GetCommonFileName();
+  TString myFolder = Form("%sv%d",SFT_gbFolder.Data(),SFT_gbHarmonic);
+  TString myName = Form("%sv%d_%s",name,SFT_gbHarmonic,SFT_gbSuffix.Data());
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myName.Data()),
+                                                               AliFlowEventSimple::Class(),
+                                                               AliAnalysisManager::kExchangeContainer );
+  AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myName.Data()),
+                                                                    NULL, cutsPOI);
+  mgr->AddTask(tskFilter);
+  mgr->ConnectInput( tskFilter,0,flowEvent);
+  mgr->ConnectOutput(tskFilter,1,flowEvent2);
+  AliAnalysisDataContainer *outQC = mgr->CreateContainer( myName.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,
+                                                          Form("%s:FlowStrange_MCEP_%s",fileName.Data(),myFolder.Data()) );
+  AliAnalysisTaskMCEventPlane *tskQC = new AliAnalysisTaskMCEventPlane( Form("TaskMCEP_%s",myName.Data()) );
+  tskQC->SetHarmonic(SFT_gbHarmonic);
+  mgr->AddTask(tskQC);
+  mgr->ConnectInput( tskQC,0,flowEvent2);
+  mgr->ConnectOutput(tskQC,1,outQC);
+}
+void SFT_AddQCmethod(char *name, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL) {
+  TString fileName = AliAnalysisManager::GetCommonFileName();
+  TString myFolder = Form("%sv%d",SFT_gbFolder.Data(),SFT_gbHarmonic);
+  TString myName = Form("%sv%d_%s",name,SFT_gbHarmonic,SFT_gbSuffix.Data());
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myName.Data()),
+                                                               AliFlowEventSimple::Class(),
+                                                               AliAnalysisManager::kExchangeContainer );
+  AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myName.Data()),
+                                                                    NULL, cutsPOI);
+  mgr->AddTask(tskFilter);
+  mgr->ConnectInput( tskFilter,0,flowEvent);
+  mgr->ConnectOutput(tskFilter,1,flowEvent2);
+  AliAnalysisDataContainer *outQC = mgr->CreateContainer( myName.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,
+                                                          Form("%s:FlowStrange_QC_%s",fileName.Data(),myFolder.Data()) );
+  AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants( Form("TaskQCumulants_%s",myName.Data()),kFALSE );
+  tskQC->SetApplyCorrectionForNUA(kTRUE);
+  tskQC->SetHarmonic(SFT_gbHarmonic);
+  tskQC->SetBookOnlyBasicCCH(SFT_gbShrinkFP);
+  mgr->AddTask(tskQC);
+  mgr->ConnectInput( tskQC,0,flowEvent2);
+  mgr->ConnectOutput(tskQC,1,outQC);
+}
+void SFT_AddSPmethod(char *name, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL, char *Qvector, Double_t gap=0.0) {
+  TString fileName = AliAnalysisManager::GetCommonFileName();
+  TString myFolder = Form("%sv%d",SFT_gbFolder.Data(),SFT_gbHarmonic);
+  TString myNameSP = Form("%sv%d%s_%s",name,SFT_gbHarmonic,Qvector,SFT_gbSuffix.Data());
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myNameSP.Data()),
+                                                               AliFlowEventSimple::Class(),
+                                                               AliAnalysisManager::kExchangeContainer );
+  AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameSP.Data()),
+                                                                    NULL, cutsPOI);
+  tskFilter->SetSubeventEtaRange( -5.0, -gap, +gap, +5.0 );
+  mgr->AddTask(tskFilter);
+  mgr->ConnectInput( tskFilter,0,flowEvent);
+  mgr->ConnectOutput(tskFilter,1,flowEvent2);
+  AliAnalysisDataContainer *outSP = mgr->CreateContainer( myNameSP.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,
+                                                          Form("%s:FlowStrange_SP_%s",fileName.Data(),myFolder.Data()) );
+  AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct( Form("TaskScalarProduct_%s",myNameSP.Data()),kFALSE);
+  tskSP->SetApplyCorrectionForNUA(kTRUE);
+  tskSP->SetHarmonic(SFT_gbHarmonic);
+  tskSP->SetTotalQvector(Qvector);
+  tskSP->SetBookOnlyBasicCCH(SFT_gbShrinkFP);
+  mgr->AddTask(tskSP);
+  mgr->ConnectInput( tskSP,0,flowEvent2);
+  mgr->ConnectOutput(tskSP,1,outSP);
+}
+double SFT_MassBandLowEdge( int nv0, int mb ) {
+  if(nv0>10&&mb==0) return -5;
+  if(nv0>10&&mb==1) return +5;
+  switch(nv0) {
+  case(0):
+    double lowEdge[14]={0.398, 0.420, 0.444, 0.468, 0.486,
+                         0.490, 0.494, 0.498, 0.502, 0.506, 
+                         0.524, 0.548, 0.572, 0.598};
+    break;
+  default:
+    double lowEdge[13]={1.084, 1.094, 1.104, 1.110, 1.114,
+                       1.116, 1.118, 1.122, 1.128, 1.138,
+                       1.148, 1.158, 1.168};
+    break;
+  }
+  return lowEdge[mb];
+}
+int SFT_MassBands( int nv0 ) {
+  int bands=1;
+  switch(nv0) {
+  case(0):
+    bands = 13;
+    break;
+  default:
+    bands = 12;
+  }
+  if(nv0>10) bands=1;
+  return bands;
+}
+int SFT_MassBins( int nv0 ) {
+  int bins=100;
+  switch(nv0) {
+  case(0)://kZERO
+    bins=100;
+    break;
+  default://LAMBDA
+    bins=84;
+    break;
+  }
+  if(nv0>10) bins=100;//CHARGED
+  return bins;
+}
+double SFT_MinMass( int nv0 ) {
+  return SFT_MassBandLowEdge( nv0, 0 );
+}
+double SFT_MaxMass( int nv0 ) {
+  return SFT_MassBandLowEdge( nv0, SFT_MassBands(nv0) );
+}
+void SFT_PrintConfig() {
+  printf("***********************************\n");
+  printf("* STRANGE FLOW TASK CONFIGURATION *\n");
+  printf("* SUFFIX  %s *\n", SFT_gbSuffix.Data() );
+  printf("* TRIGGER  %d *\n", SFT_gbTrigger );
+  printf("* RUNPP  %d *\n", SFT_gbRunPP );
+  printf("* RUNPA  %d *\n", SFT_gbRunPA );
+  printf("* AVOIDEXEC  %d *\n", SFT_gbAvoidExec );
+  printf("* SKIPCENTRALITY  %d *\n", SFT_gbSkipCentrality );
+  printf("* ESD  %d *\n", SFT_gbReadESD );
+  printf("* MC  %d *\n", SFT_gbReadMC );
+  printf("* HARMONIC  %d *\n", SFT_gbHarmonic );
+  printf("* ADDPITOMCEP  %d *\n", SFT_gbAddPitoMCRP );
+  printf("* POSTMATCHED  %d *\n", SFT_gbPostMatched );
+  printf("* EXTRAEVENTCUT  %d *\n", SFT_gbExtraEventCut );
+  printf("* CENTMETHOD  %s *\n", SFT_gbCentMethod.Data() );
+  printf("* CENTPERMIN  %d *\n", SFT_gbCentPerMin );
+  printf("* CENTPERMAX  %d *\n", SFT_gbCentPerMax );
+  printf("* VERTEXZ  %f *\n", SFT_gbVertexZcut );
+  printf("* SPECIE  %d *\n", SFT_gbSpecie );
+  printf("* HOMEMADE  %d *\n", SFT_gbHomemade );
+  printf("* ONLINE  %d *\n", SFT_gbOnline );
+  printf("* MINNCLSTTPC  %d *\n", SFT_gbMinNClsTPC );
+  printf("* MINNCLSITS  %d *\n", SFT_gbMinNClsITS );
+  printf("* MINXROWS  %d *\n", SFT_gbMinXRows );
+  printf("* MAXCHI2NCLSTPC  %f *\n", SFT_gbMaxChi2PerNClsTPC );
+  printf("* MINXROWSNFCLSTPC  %f *\n", SFT_gbMinXRowsOverNClsFTPC );
+  printf("* MINETA  %f *\n", SFT_gbMinEta );
+  printf("* MAXETA  %f *\n", SFT_gbMaxEta );
+  printf("* MINPT  %f *\n", SFT_gbMinPt );
+  printf("* UNTAG  %f *\n", SFT_gbUntagDaughter );
+  printf("* MIND0XY  %f *\n", SFT_gbMinImpactParameterXY );
+  printf("* MAXSIGMAPID  %f *\n", SFT_gbMaxNSigmaPID );
+  printf("* MAXY  %f *\n", SFT_gbMaxRapidity );
+  printf("* MAXDCA  %f *\n", SFT_gbMaxDCAdaughters );
+  printf("* MINCTP  %f *\n", SFT_gbMinCosinePointingAngleXY );
+  printf("* MINQT  %f *\n", SFT_gbMinQt );
+  printf("* QTPIE  %f *\n", SFT_gbQtPie );
+  printf("* STOPPID  %f *\n", SFT_gbPIDPt );
+  printf("* MINRADXY  %f *\n", SFT_gbMinRadXY );
+  printf("* MAXDL  %f *\n", SFT_gbMaxDecayLength );
+  printf("* D0D0XY  %f *\n", SFT_gbMaxProductIPXY );
+  printf("* DEBUG  %d *\n", SFT_gbDebug );
+  printf("* QA  %d *\n", SFT_gbQA );
+  printf("* SKIPSELECTION  %d *\n", SFT_gbSkipSelection );
+  printf("* SKIPVN  %d *\n", SFT_gbSkipVn );
+  printf("* USEFP  %d *\n", SFT_gbFlowPackage );
+  printf("* SPVZE  %d *\n", SFT_gbSPVZE );
+  printf("* SPVZEHALF  %d *\n", SFT_gbSPVZEhalf );
+  printf("* SPTPC  %d *\n", SFT_gbSPTPC );
+  printf("* QCTPC  %d *\n", SFT_gbQCTPC );
+  printf("* MCEP  %d *\n", SFT_gbMCEP );
+  printf("* SHRINKFP  %d *\n", SFT_gbShrinkFP );
+  printf("* RFFILTERBIT  %d *\n", SFT_gbRFPFilterBit );
+  printf("* RFMINPT  %f *\n", SFT_gbRFPminPt );
+  printf("* RFMAXPT  %f *\n", SFT_gbRFPmaxPt );
+  printf("* RFCMINETA  %f *\n", SFT_gbRFPCminEta );
+  printf("* RFCMAXETA  %f *\n", SFT_gbRFPCmaxEta );
+  printf("* RFAMINETA  %f *\n", SFT_gbRFPAminEta );
+  printf("* RFAMAXETA  %f *\n", SFT_gbRFPAmaxEta );
+  printf("* RFTPCSIGNAL  %f *\n", SFT_gbRFPTPCsignal );
+  printf("* RFMAXIPXY  %f *\n", SFT_gbRFPmaxIPxy );
+  printf("* RFMAXIPZ  %f *\n", SFT_gbRFPmaxIPz );
+  printf("* RFTPCNCLS  %d *\n", SFT_gbRFPTPCncls );
+  printf("* RFVZEC_RingMin  %d *\n", SFT_gbV0CRingMin );
+  printf("* RFVZEC_RingMax  %d *\n", SFT_gbV0CRingMax );
+  printf("* RFVZEA_RingMin  %d *\n", SFT_gbV0ARingMin );
+  printf("* RFVZEA_RingMax  %d *\n", SFT_gbV0ARingMax );
+  printf("* WHICHPSI  %d *\n", SFT_gbWhichPsi );
+  printf("* VZELOAD  %s *\n", SFT_gbVZEload.Data() );
+  printf("* VZELINEAR  %d *\n", SFT_gbVZEmb );
+  printf("* VZEPERDISK  %d *\n", SFT_gbVZEpdisk );
+  printf("* VZESAVE  %d *\n", SFT_gbVZEsave );
+  printf("* DAUITS0  %d *\n", SFT_gbDauITS0On );
+  printf("* DAUITS1  %d *\n", SFT_gbDauITS1On );
+  printf("* DAUITS2  %d *\n", SFT_gbDauITS2On );
+  printf("* DAUITS3  %d *\n", SFT_gbDauITS3On );
+  printf("* DAUITS4  %d *\n", SFT_gbDauITS4On );
+  printf("* DAUITS5  %d *\n", SFT_gbDauITS5On );
+  printf("* DAUSPDANY  %d *\n", SFT_gbDauSPDany );
+  printf("* DAUITSrefit  %d *\n", SFT_gbDauITSrefit );
+
+  printf("* DAUmaxITSclusterShared  %d *\n", SFT_gbmaxITSclusterShared );
+  printf("* DAUmaxITSChi2  %f *\n", SFT_gbmaxITSChi2 );
+  printf("***********************************\n");
+}
+void SFT_ReadConfig(TString ipf) {
+  SFT_ResetVars();
+  printf("Reading %s\n",ipf.Data());
+  ifstream input(ipf.Data());
+  TString varname;
+  Double_t vardouble;
+  Int_t varint;
+  UInt_t varuint;
+  Bool_t varbool;
+  for(;input.good();) {
+    input >> varname;
+    if(!input.good()) {
+      break;
+    } else if(!varname.CompareTo("SUFFIX")) {
+      input >> SFT_gbSuffix;
+    } else if(!varname.CompareTo("TRIGGER")) {
+      input >> SFT_gbTrigger;
+    } else if(!varname.CompareTo("RUNPP")) {
+      input >> SFT_gbRunPP;
+    } else if(!varname.CompareTo("RUNPA")) {
+      input >> SFT_gbRunPA;
+    } else if(!varname.CompareTo("AVOIDEXEC")) {
+      input >> SFT_gbAvoidExec;
+    } else if(!varname.CompareTo("SKIPCENTRALITY")) {
+      input >> SFT_gbSkipCentrality;
+    } else if(!varname.CompareTo("ESD")) {
+      input >> SFT_gbReadESD;
+    } else if(!varname.CompareTo("MC")) {
+      input >> SFT_gbReadMC;
+    } else if(!varname.CompareTo("EXTRAEVENTCUT")) {
+      input >> SFT_gbExtraEventCut;
+    } else if(!varname.CompareTo("CENTMETHOD")) {
+      input >> SFT_gbCentMethod;
+    } else if(!varname.CompareTo("CENTPERMIN")) {
+      input >> SFT_gbCentPerMin;
+    } else if(!varname.CompareTo("CENTPERMAX")) {
+      input >> SFT_gbCentPerMax;
+    } else if(!varname.CompareTo("SPECIE")) {
+      input >> SFT_gbSpecie;
+    } else if(!varname.CompareTo("HOMEMADE")) {
+      input >> SFT_gbHomemade;
+    } else if(!varname.CompareTo("ONLINE")) {
+      input >> SFT_gbOnline;
+    } else if(!varname.CompareTo("MINNCLSTTPC")) {
+      input >> SFT_gbMinNClsTPC;
+    } else if(!varname.CompareTo("MINNCLSITS")) {
+      input >> SFT_gbMinNClsITS;
+    } else if(!varname.CompareTo("MINXROWS")) {
+      input >> SFT_gbMinXRows;
+    } else if(!varname.CompareTo("MAXCHI2NCLSTPC")) {
+      input >> SFT_gbMaxChi2PerNClsTPC;
+    } else if(!varname.CompareTo("MINXROWSNFCLSTPC")) {
+      input >> SFT_gbMinXRowsOverNClsFTPC;
+    } else if(!varname.CompareTo("MINETA")) {
+      input >> SFT_gbMinEta;
+    } else if(!varname.CompareTo("MAXETA")) {
+      input >> SFT_gbMaxEta;
+    } else if(!varname.CompareTo("MINPT")) {
+      input >> SFT_gbMinPt;
+    } else if(!varname.CompareTo("MIND0XY")) {
+      input >> SFT_gbMinImpactParameterXY;
+    } else if(!varname.CompareTo("MAXSIGMAPID")) {
+      input >> SFT_gbMaxNSigmaPID;
+    } else if(!varname.CompareTo("MAXY")) {
+      input >> SFT_gbMaxRapidity;
+    } else if(!varname.CompareTo("MAXDCA")) {
+      input >> SFT_gbMaxDCAdaughters;
+    } else if(!varname.CompareTo("MINCTP")) {
+      input >> SFT_gbMinCosinePointingAngleXY;
+    } else if(!varname.CompareTo("MINQT")) {
+      input >> SFT_gbMinQt;
+    } else if(!varname.CompareTo("QTPIE")) {
+      input >> SFT_gbQtPie;
+    } else if(!varname.CompareTo("STOPPID")) {
+      input >> SFT_gbPIDPt;
+    } else if(!varname.CompareTo("MINRADXY")) {
+      input >> SFT_gbMinRadXY;
+    } else if(!varname.CompareTo("MAXDL")) {
+      input >> SFT_gbMaxDecayLength;
+    } else if(!varname.CompareTo("D0D0XY")) {
+      input >> SFT_gbMaxProductIPXY;
+    } else if(!varname.CompareTo("DEBUG")) {
+      input >> SFT_gbDebug;
+    } else if(!varname.CompareTo("QA")) {
+      input >> SFT_gbQA;
+    } else if(!varname.CompareTo("SKIPSELECTION")) {
+      input >> SFT_gbSkipSelection;
+    } else if(!varname.CompareTo("SKIPVN")) {
+      input >> SFT_gbSkipVn;
+    } else if(!varname.CompareTo("USEFP")) {
+      input >> SFT_gbFlowPackage;
+    } else if(!varname.CompareTo("SPVZE")) {
+      input >> SFT_gbSPVZE;
+    } else if(!varname.CompareTo("SPTPC")) {
+      input >> SFT_gbSPTPC;
+    } else if(!varname.CompareTo("SPVZEHALF")) {      
+      input >> SFT_gbSPVZEhalf;
+    } else if(!varname.CompareTo("QCTPC")) {
+      input >> SFT_gbQCTPC;
+    } else if(!varname.CompareTo("MCEP")) {
+      input >> SFT_gbMCEP;
+    } else if(!varname.CompareTo("ADDPITOMCEP")) {
+      input >> SFT_gbAddPitoMCRP;
+    } else if(!varname.CompareTo("SHRINKFP")) {
+      input >> SFT_gbShrinkFP;
+    } else if(!varname.CompareTo("RFFILTERBIT")) {
+      input >> SFT_gbRFPFilterBit;
+    } else if(!varname.CompareTo("RFMINPT")) {
+      input >> SFT_gbRFPminPt;
+    } else if(!varname.CompareTo("RFMAXPT")) {
+      input >> SFT_gbRFPmaxPt;
+    } else if(!varname.CompareTo("RFCMINETA")) {
+      input >> SFT_gbRFPCminEta;
+    } else if(!varname.CompareTo("RFCMAXETA")) {
+      input >> SFT_gbRFPCmaxEta;
+    } else if(!varname.CompareTo("RFAMINETA")) {
+      input >> SFT_gbRFPAminEta;
+    } else if(!varname.CompareTo("RFAMAXETA")) {
+      input >> SFT_gbRFPAmaxEta;
+    } else if(!varname.CompareTo("RFTPCSIGNAL")) {
+      input >> SFT_gbRFPTPCsignal;
+    } else if(!varname.CompareTo("RFMAXIPXY")) {
+      input >> SFT_gbRFPmaxIPxy;
+    } else if(!varname.CompareTo("RFMAXIPZ")) {
+      input >> SFT_gbRFPmaxIPz;
+    } else if(!varname.CompareTo("RFTPCNCLS")) {
+      input >> SFT_gbRFPTPCncls;
+    } else if(!varname.CompareTo("VZELOAD")) {
+      input >> SFT_gbVZEload;
+    } else if(!varname.CompareTo("VZELINEAR")) {
+      input >> SFT_gbVZEmb;
+    } else if(!varname.CompareTo("VZEPERDISK")) {
+      input >> SFT_gbVZEpdisk;
+    } else if(!varname.CompareTo("VZESAVE")) {
+      input >> SFT_gbVZEsave;
+    } else if(!varname.CompareTo("ALLCC")) {
+      input >> SFT_gbAllCC;
+    } else if(!varname.CompareTo("UNTAG")) {
+      input >> SFT_gbUntagDaughter;
+    } else if(!varname.CompareTo("POSTMATCHED")) {
+      input >> SFT_gbPostMatched;
+    } else if(!varname.CompareTo("VERTEXZ")) {
+      input >> SFT_gbVertexZcut;
+    } else if(!varname.CompareTo("WHICHPSI")) {
+      input >> SFT_gbWhichPsi;
+    } else if(!varname.CompareTo("DAUITS0")) {
+      input >> SFT_gbDauITS0On;
+    } else if(!varname.CompareTo("DAUITS1")) {
+      input >> SFT_gbDauITS1On;
+    } else if(!varname.CompareTo("DAUITS2")) {
+      input >> SFT_gbDauITS2On;
+    } else if(!varname.CompareTo("DAUITS3")) {
+      input >> SFT_gbDauITS3On;
+    } else if(!varname.CompareTo("DAUITS4")) {
+      input >> SFT_gbDauITS4On;
+    } else if(!varname.CompareTo("DAUITS5")) {
+      input >> SFT_gbDauITS5On;
+    } else if(!varname.CompareTo("DAUSPDANY")) {
+      input >> SFT_gbDauSPDany;
+    } else if(!varname.CompareTo("DAUITSREFIT")) {
+      input >> SFT_gbDauITSrefit;
+    } else if(!varname.CompareTo("maxITSclusterShared")) {
+      input >> SFT_gbmaxITSclusterShared;
+    } else if(!varname.CompareTo("maxITSChi2")) {
+      input >> SFT_gbmaxITSChi2;
+    } else if(!varname.CompareTo("RFVZEC_RingMin")) {
+      input >> SFT_gbV0CRingMin;
+    } else if(!varname.CompareTo("RFVZEC_RingMax")) {
+      input >> SFT_gbV0CRingMax;
+    } else if(!varname.CompareTo("RFVZEA_RingMin")) {
+      input >> SFT_gbV0ARingMin;
+    } else if(!varname.CompareTo("RFVZEA_RingMax")) {
+      input >> SFT_gbV0ARingMax;
+    } else if(!varname.CompareTo("HARMONIC")) {
+      input >> SFT_gbHarmonic;
+    } else {
+      printf("I dont understand %s\n",varname.Data());
+    }
+  }
+}
+void SFT_ResetVars() {
+  SFT_gbTrigger=1;
+  SFT_gbReadESD=0;
+  SFT_gbReadMC=0;
+  SFT_gbMatchMC=0;
+  SFT_gbAvoidExec=0;
+  SFT_gbExtraEventCut=0;
+  SFT_gbCentMethod="V0MTRK";
+  SFT_gbCentPerMin=0;
+  SFT_gbCentPerMax=100;
+  SFT_gbRunPP=0;
+  SFT_gbRunPA=0;
+  SFT_gbSpecie=0;
+  SFT_gbHomemade=0;
+  SFT_gbOnline=0;
+  SFT_gbMinNClsTPC=70;
+  SFT_gbMinNClsITS=-1;
+  SFT_gbMinXRows=70;
+  SFT_gbMaxChi2PerNClsTPC=4.0;
+  SFT_gbMinXRowsOverNClsFTPC=0.8;
+  SFT_gbMinEta=-0.8;
+  SFT_gbMaxEta=+0.8;
+  SFT_gbMinPt=0.1;
+  SFT_gbMinImpactParameterXY=0.1;
+  SFT_gbMaxNSigmaPID=3.0;
+  SFT_gbMaxRapidity=0.5;
+  SFT_gbMaxDCAdaughters=1.0;
+  SFT_gbMinCosinePointingAngleXY=0.998;
+  SFT_gbMinQt=0.2;
+  SFT_gbQtPie=kTRUE;
+  SFT_gbPIDPt=3.0;
+  SFT_gbMinRadXY=5.0;
+  SFT_gbMaxDecayLength=3.0;
+  SFT_gbMaxProductIPXY=0.0;
+  SFT_gbDebug=0;
+  SFT_gbQA=0;
+  SFT_gbFolder="FlowStrange";
+  SFT_gbSuffix="NOTFOUND";
+  SFT_gbRFPFilterBit=1;
+  SFT_gbRFPminPt=0.2;
+  SFT_gbRFPmaxPt=5.0;
+  SFT_gbRFPCminEta=-0.8;
+  SFT_gbRFPCmaxEta=0.0;
+  SFT_gbRFPAminEta=0.0;
+  SFT_gbRFPAmaxEta=+0.8;
+  SFT_gbRFPTPCsignal=10;
+  SFT_gbRFPmaxIPxy=2.4;
+  SFT_gbRFPmaxIPz=3.2;
+  SFT_gbRFPTPCncls=70;
+  SFT_gbV0CRingMin=0;
+  SFT_gbV0CRingMax=3;
+  SFT_gbV0ARingMin=0;
+  SFT_gbV0ARingMax=3;
+  SFT_gbAllCC=0;
+  SFT_gbSkipSelection=0;
+  SFT_gbSkipVn=0;
+  SFT_gbWhichPsi=1;
+  SFT_gbFlowPackage=0;
+  SFT_gbSPVZE=0;
+  SFT_gbSPVZEhalf=kFALSE;
+  SFT_gbSPTPC=0;
+  SFT_gbQCTPC=0;
+  SFT_gbMCEP=0;
+  SFT_gbHarmonic=2;
+  SFT_gbVZEload="no";
+  SFT_gbVZEsave=0;
+  SFT_gbVZEmb=0;
+  SFT_gbVZEpdisk=0;
+  SFT_gbUntagDaughter=kTRUE;
+  SFT_gbPostMatched=kFALSE;
+  SFT_gbShrinkFP=kTRUE;
+  SFT_gbVertexZcut=10.0;
+  SFT_gbDauITS0On=-1;
+  SFT_gbDauITS1On=-1;
+  SFT_gbDauITS2On=-1;
+  SFT_gbDauITS3On=-1;
+  SFT_gbDauITS4On=-1;
+  SFT_gbDauITS5On=-1;
+  SFT_gbSkipCentrality=kFALSE;
+  SFT_gbAddPitoMCRP=kFALSE;
+  SFT_gbDauSPDany=kFALSE;
+  SFT_gbDauITSrefit=kFALSE;
+  SFT_gbmaxITSclusterShared=6;
+  SFT_gbmaxITSChi2=36.;
+}
index 259e38257aa484148eb8be4c0ff78948444823ec..a716a3b02ecb79daa22c20e1b5019ddf8694fafb 100644 (file)
@@ -17,10 +17,14 @@ void AddTaskPIDFlowSP(Int_t triggerSelectionString=AliVEvent::kMB,
                                    Int_t charge=0,
                                    Int_t MinTPCdedx = 10,
                                    Int_t ncentrality = 6,
+                                   Int_t maxITSCls = 7,
+                                   Double_t maxChi2ITSCls = 37,
                                    Bool_t doQA=kTRUE,
                                    Bool_t isPID = kTRUE,
                                    Bool_t VZERO = kFALSE, // use vzero sp method
                                    Bool_t is2011 = kFALSE,
+                                   Bool_t isAOD = kTRUE,
+                                   Bool_t UsePIDParContours = kFALSE,
                                    AliPID::EParticleType particleType=AliPID::kPion,
                                    AliFlowTrackCuts::PIDsource sourcePID=AliFlowTrackCuts::kTOFbayesian) {
 
@@ -115,12 +119,25 @@ for(int icentr=0;icentr<ncentr;icentr++){
     SP_POI[icentr] = DefinePOIcuts(icentr);
 
     SP_POI[icentr]->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
-    //SP_POI[icentr]->SetParamType(poitype);
+    if(!isAOD){
+        SP_POI[icentr]->SetMaxSharedITSCluster(maxITSCls);
+        SP_POI[icentr]->SetMaxChi2perITSCluster(maxChi2ITSCls);
+        SP_POI[icentr]->SetMinNClustersITS(2);
+        SP_POI[icentr]->SetRequireITSRefit(kTRUE);
+        SP_POI[icentr]->SetRequireTPCRefit(kTRUE);
+        SP_POI[icentr]->SetMaxDCAToVertexXY(0.3);
+        SP_POI[icentr]->SetMaxDCAToVertexZ(0.3);
+        SP_POI[icentr]->SetAcceptKinkDaughters(kFALSE);
+        SP_POI[icentr]->SetMinimalTPCdedx(10.);
+    }
     //SP_POI[icentr]->SetParamMix(poimix);
-    SP_POI[icentr]->SetPtRange(0.2,5.);//
+    SP_POI[icentr]->SetPtRange(0.2,6.);//
     SP_POI[icentr]->SetMinNClustersTPC(70);
     SP_POI[icentr]->SetMinChi2PerClusterTPC(0.1);
     SP_POI[icentr]->SetMaxChi2PerClusterTPC(4.0);
+    
+    
     if(!VZERO && Qvector=="Qa"){
         SP_POI[icentr]->SetEtaRange( +0.5*EtaGap, etamax );
         printf(" > NOTE: Using half TPC (Qa) as POI selection u < \n");
@@ -145,12 +162,16 @@ for(int icentr=0;icentr<ncentr;icentr++){
     //SP_POI->SetMaxNsigmaToVertex(1.e+10);
     //SP_POI->SetRequireSigmaToVertex(kFALSE);
     SP_POI[icentr]->SetAcceptKinkDaughters(kFALSE);
-    if(isPID) SP_POI[icentr]->SetPID(particleType, sourcePID);//particleType, sourcePID
+    if(isPID){
+        SP_POI[icentr]->SetPID(particleType, sourcePID);//particleType, sourcePID
+        SP_POI[icentr]->SetTPCTOFNsigmaPIDCutContours(UsePIDParContours,centrMin[icentr],centrMax[icentr]);
+    }
+    
     if (charge!=0) SP_POI[icentr]->SetCharge(charge);
     //SP_POI->SetAllowTOFmismatch(kFALSE);
     SP_POI[icentr]->SetRequireStrictTOFTPCagreement(kTRUE);
     SP_POI[icentr]->SetMinimalTPCdedx(MinTPCdedx);
-    SP_POI[icentr]->SetAODfilterBit(AODfilterBit);
+    if(isAOD) SP_POI[icentr]->SetAODfilterBit(AODfilterBit);
     SP_POI[icentr]->SetQA(doQA);
     SP_POI[icentr]->SetPriors((centrMin[icentr]+centrMax[icentr])*0.5);
 
@@ -170,7 +191,9 @@ for(int icentr=0;icentr<ncentr;icentr++){
     if(isPID){
         suffixName[icentr]+=AliFlowTrackCuts::PIDsourceName(sourcePID);
         suffixName[icentr]+="_";
-        suffixName[icentr]+=AliPID::ParticleName(particleType);//particleType
+        suffixName[icentr]+=uniqueStr;
+        suffixName[icentr]+="_";
+        //suffixName[icentr]+=AliPID::ParticleName(particleType);//particleType
     }
     else{
         suffixName[icentr]+="AllCharged";
@@ -342,11 +365,11 @@ AliFlowTrackCuts* DefineRPcuts(Int_t icentr){
     AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts(Form("RP_%d",icentr));
     return cutsRP;
 }
-AliFlowTrackCuts* DefinePOIcuts(Int_t icentr){
+AliFlowTrackCuts* DefinePOIcuts(Int_t    icentr){
     AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts(Form("POI_%d",icentr));
     return cutsPOI;
 }
 
-
+     
 
 
index b0759fe6e97606a586828864610a1a7d7b1e8232..61310defbd2ddb00a4a9df677b2c2a40b767010b 100644 (file)
@@ -1662,11 +1662,14 @@ Double_t AliAnalysisTaskEMCALIsoPhoton::GetTrackMatchedPt(Int_t matchIndex)
     return pt;
   }
   if(fESD){
-    if(!fPrTrCuts && !fCompTrCuts)
-      return pt;
-    if(!fPrTrCuts->IsSelected(track) && !fCompTrCuts->IsSelected(track))
-      return pt;
-    pt = track->Pt();
+    if(fPrTrCuts && fPrTrCuts->IsSelected(track))
+      pt = track->Pt();
+    else {
+      if(fCompTrCuts && fCompTrCuts->IsSelected(track))
+       pt = track->Pt();
+      else
+       return pt;
+    }
   }
   return pt;
 }
index 26d5b2005d6c7187648e99adb5333ed65bf35f23..c88527688d17aa659edc7b1b5475da960cbc6187 100644 (file)
@@ -202,6 +202,7 @@ AliAnalysisTaskEMCALPi0V2ShSh::AliAnalysisTaskEMCALPi0V2ShSh(const char *name) :
   // Constructor
   // Define input and output slots here
   // Input slot #0 works with a TChain
+  for(Int_t i = 0; i < 12;    i++)  fGeomMatrix[i] =  0;
   DefineInput(0, TChain::Class());
   // Output slot #0 id reserved by the base class for AOD
   // Output slot #1 writes into a TH1 container
index b42c31c8e5a0cb1df319ec63a8c1eb56fbf166bf..28f59d15dd7564715afb9a380a47946759cc0896 100644 (file)
@@ -1543,6 +1543,7 @@ void AliAnalysisTaskGammaCalo::ProcessAODMCParticles()
 {
        
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (AODMCTrackArray == NULL) return;
        
        // Loop over all primary MC particle
        for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
@@ -2164,6 +2165,8 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
        
        // Process True Mesons
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (AODMCTrackArray == NULL) return;
+       
        Bool_t isTruePi0                                = kFALSE;
        Bool_t isTrueEta                                = kFALSE;
        Bool_t isSameConvertedGamma     = kFALSE;
index bb28a48b67681b702f486c0328a3725e39898a89..cc105f9e8ec2fd8b2da898c841c0d68860e68f08 100644 (file)
@@ -2027,6 +2027,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidatesAOD(AliAODConversi
        }
        
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (AODMCTrackArray == NULL) return;
        AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
        AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
        fCharPhotonMCInfo = 0;
@@ -2187,6 +2188,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessAODMCParticles()
 {
        
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (AODMCTrackArray == NULL) return;
        
        // Loop over all primary MC particle
        for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
@@ -2785,6 +2787,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversio
        
        // Process True Mesons
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (AODMCTrackArray == NULL) return;
        Bool_t isTruePi0 = kFALSE;
        Bool_t isTrueEta = kFALSE;
        
@@ -2987,7 +2990,7 @@ void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
                for(Int_t nEventsInBG=0;nEventsInBG<fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
                        AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
-                       if(fMoveParticleAccordingToVertex == kTRUE){
+                       if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
                                bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
                        }
                        
@@ -2996,10 +2999,14 @@ void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
                                for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
                                        AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
                                        if(fMoveParticleAccordingToVertex == kTRUE){
-                                               MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+                                               if (bgEventVertex){
+                                                       MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+                                               }       
                                        }
                                        if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
-                                               RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
+                                               if (bgEventVertex){
+                                                       RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
+                                               }       
                                        }
                                        
                                        AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
@@ -3020,7 +3027,7 @@ void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
                for(Int_t nEventsInBG=0;nEventsInBG <fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
                        AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
                        if(previousEventV0s){
-                               if(fMoveParticleAccordingToVertex == kTRUE){
+                               if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0 ){
                                        bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
                                }
                                for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
@@ -3030,10 +3037,14 @@ void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
                                                AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
                                        
                                                if(fMoveParticleAccordingToVertex == kTRUE){
-                                                       MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+                                                       if (bgEventVertex){
+                                                               MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+                                                       }       
                                                }
                                                if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
-                                                       RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
+                                                       if (bgEventVertex){
+                                                               RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
+                                                       }       
                                                }
                                        
                                                AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
index 0e3178fcc4c2f65fab75ab93584739b21a60d57d..7c58715d865a678d543ff0473eb97b7fb19b9ea6 100644 (file)
@@ -788,13 +788,11 @@ void AliAnalysisTaskGammaConvFlow::Terminate(const Option_t *)
 void AliAnalysisTaskGammaConvFlow::ProcessPhotonCandidatesforV2()
 {
 
-       // Loop over Photon Candidates allocated by ReaderV1
-       
-       
+       // Loop over Photon Candidates allocated by ReaderV1    
        for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
                
                AliAODConversionPhoton *gammaForv2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
-
+               if (gammaForv2 == NULL) return;
                AliFlowTrack *sTrack = new AliFlowTrack();
                sTrack->SetForRPSelection(kFALSE);
                sTrack->SetForPOISelection(kTRUE);
index a83eaf3cf33c63b181e6d0e66f8c743cbb6e4e06..a34990cb3e13bd56870c5e2b4da67753a2fd3371 100644 (file)
@@ -131,6 +131,7 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
        hMCK0sWOWeightPt(NULL),
        hMCK0sPtY(NULL),
        hMCSecPi0PtvsSource(NULL),
+       hMCSecPi0RvsSource(NULL),
        hMCSecPi0Source(NULL),
        hMCSecEtaPt(NULL),
        hMCSecEtaSource(NULL),
@@ -281,6 +282,7 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
        hMCK0sWOWeightPt(NULL),
        hMCK0sPtY(NULL),
        hMCSecPi0PtvsSource(NULL),
+       hMCSecPi0RvsSource(NULL),
        hMCSecPi0Source(NULL),
        hMCSecEtaPt(NULL),
        hMCSecEtaSource(NULL),
@@ -388,7 +390,7 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
        for(Int_t iCut = 0; iCut<fnCuts;iCut++){
                if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
                        TString cutstringEvent  = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
-                       TString cutstringPhoton         = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
+                       TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
                        TString cutstringMeson  = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
                        
                        Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
@@ -703,6 +705,7 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects(){
                                hMCK0sWOWeightPt = new TH1F*[fnCuts];
                                hMCK0sPtY = new TH2F*[fnCuts];
                                hMCSecPi0PtvsSource= new TH2F*[fnCuts];
+                               hMCSecPi0RvsSource= new TH2F*[fnCuts];
                                hMCSecPi0Source = new TH1F*[fnCuts];
                                hMCSecEtaPt = new TH1F*[fnCuts];
                                hMCSecEtaSource = new TH1F*[fnCuts];
@@ -814,6 +817,10 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects(){
                                        hMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
                                        hMCSecPi0PtvsSource[iCut]->Sumw2();
                                        fMCList[iCut]->Add(hMCSecPi0PtvsSource[iCut]);
+                                       hMCSecPi0RvsSource[iCut] = new TH2F("MC_SecPi0_R3D_Source","MC_SecPi0_R3D_Source",500,0.0,20.,16,-0.5,15.5);
+                                       hMCSecPi0RvsSource[iCut]->Sumw2();
+                                       fMCList[iCut]->Add(hMCSecPi0RvsSource[iCut]);
+
                                        hMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
                                        hMCSecEtaPt[iCut]->Sumw2();
                                        fMCList[iCut]->Add(hMCSecEtaPt[iCut]);
@@ -871,15 +878,15 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects(){
 
                
                        if (fDoPhotonQA > 0){
-                       
-                                hESDTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
-                                fTrueList[iCut]->Add(hESDTrueConvGammaEta[iCut]);
-                                hESDTrueConvGammaR[iCut] = new TH1F("ESD_TrueConvGamma_R","ESD_TrueConvGamma_R",800,0,200);
-                                fTrueList[iCut]->Add(hESDTrueConvGammaR[iCut]);
-                                hESDTrueConvGammaRMC[iCut] = new TH1F("ESD_TrueConvGamma_RMC","ESD_TrueConvGamma_RMC",800,0,200);
-                                fTrueList[iCut]->Add(hESDTrueConvGammaRMC[iCut]);
-                                hESDTrueConvGammaPtMC[iCut] = new TH1F("ESD_TrueConvGamma_PtMC","ESD_TrueConvGamma_PtMC",250,0,25);
-                                fTrueList[iCut]->Add(hESDTrueConvGammaPtMC[iCut]);
+
+                               hESDTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
+                               fTrueList[iCut]->Add(hESDTrueConvGammaEta[iCut]);
+                               hESDTrueConvGammaR[iCut] = new TH1F("ESD_TrueConvGamma_R","ESD_TrueConvGamma_R",800,0,200);
+                               fTrueList[iCut]->Add(hESDTrueConvGammaR[iCut]);
+                               hESDTrueConvGammaRMC[iCut] = new TH1F("ESD_TrueConvGamma_RMC","ESD_TrueConvGamma_RMC",800,0,200);
+                               fTrueList[iCut]->Add(hESDTrueConvGammaRMC[iCut]);
+                               hESDTrueConvGammaPtMC[iCut] = new TH1F("ESD_TrueConvGamma_PtMC","ESD_TrueConvGamma_PtMC",250,0,25);
+                               fTrueList[iCut]->Add(hESDTrueConvGammaPtMC[iCut]);
                        }
                        
                        if(fDoMesonAnalysis){
@@ -1447,6 +1454,11 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
                magField =  -1.0;
        }
 
+       const AliVVertex* primVtxMC     = fMCEvent->GetPrimaryVertex();
+       Double_t mcProdVtxX     = primVtxMC->GetX();
+       Double_t mcProdVtxY     = primVtxMC->GetY();
+       Double_t mcProdVtxZ     = primVtxMC->GetZ();    
+       
        // Process True Photons
        TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
        TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
@@ -1480,8 +1492,6 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
        
        if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
 
-       
-       
        // True Photon
        if(fIsFromMBHeader){
                hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
@@ -1494,7 +1504,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
 
        }
        hESDTrueGammaPsiPairDeltaPhi[fiCut]->Fill(deltaPhi,TruePhotonCandidate->GetPsiPair());  
-       if(posDaughter->GetMother(0) <= fMCStack->GetNprimary()){
+       if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
                // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
                if(fIsFromMBHeader){
                        iPhotonMCInfo = 6;
@@ -1671,139 +1681,18 @@ void AliAnalysisTaskGammaConvV1::ProcessAODMCParticles()
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
 {
-       // Loop over all primary MC particle
-       for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
-               TParticle* particle = (TParticle *)fMCStack->Particle(i);
-               if (!particle) continue;
-
-               Int_t isMCFromMBHeader = -1;
-               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
-                       isMCFromMBHeader
-                               = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
-                       if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
-               }
-
-               if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
-               if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
-                       hMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
-                       if(particle->GetMother(0) >-1){ // Meson Decay Gamma
-                               switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
-                               case 111: // Pi0
-                               hMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
-                               break;
-                               case 113: // Rho0
-                               hMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
-                               break;
-                               case 221: // Eta
-                               hMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
-                               break;
-                               case 223: // Omega
-                               hMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
-                               break;
-                               case 331: // Eta'
-                               hMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
-                               break;
-                               case 333: // Phi
-                               hMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
-                               break;
-                               case 3212: // Sigma
-                               hMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
-                               break;
-                               }
-                       }
-               }
-               if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
-                       hMCConvGammaPt[fiCut]->Fill(particle->Pt());
-                       if (fDoPhotonQA > 0){
-                               hMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
-                               hMCConvGammaEta[fiCut]->Fill(particle->Eta());
-                       }
-               } // Converted MC Gamma
-               if(fDoMesonAnalysis){
-                       if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
-                               Double_t mesonY = 10.;
-                               if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
-                                       mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
-                               } else{
-                                       mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))
-                                       -((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
-                               }
-                               Float_t weightedK0s= 1;
-                               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
-                                       if (particle->Pt()>0.005){
-                                               weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
-                                               //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
-                                       }
-                               }
-                               if (fMCStack->IsPhysicalPrimary(i)){
-                                       hMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
-                                       hMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
-                                       hMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
-                               }       
-                       }
-                       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
-                               ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
-                               TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
-                               TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
-
-                               Float_t weighted= 1;
-                               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
-                                       if (particle->Pt()>0.005){
-                                               weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
-               //                   if(particle->GetPdgCode() == 221){
-               //                      cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
-               //                   }
-                                       }
-                               }
-                               Double_t mesonY = 10.;
-                               if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
-                                       mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
-                               } else {
-                                       mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))
-                                       -((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
-                               }
-                               Double_t alpha = -1;
-                               if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
-                                       alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
-                               }
-
-                               if(particle->GetPdgCode() == 111){
-                                       hMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
-                                       hMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
-                                       if (fDoMesonQA > 0){
-                                               hMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
-                                               hMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
-                                       }       
-                               } else if(particle->GetPdgCode() == 221){
-                                       hMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
-                                       hMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
-                                       if (fDoMesonQA > 0){
-                                               hMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
-                                               hMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
-                                       }       
-                               } 
-
-                               // Check the acceptance for both gammas
-                               if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
-                               ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE)  &&
-                               ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
-                               ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
-
-                                       if(particle->GetPdgCode() == 111){
-                                               hMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
-                                       } else if(particle->GetPdgCode() == 221){
-                                               hMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
-                                       }
-                               }
-                       }
-               }
-       }
-
-       if (fDoMesonQA){
-               for(Int_t i = fMCStack->GetNprimary(); i < fMCStack->GetNtrack(); i++) {
-                       TParticle* particle = (TParticle *)fMCStack->Particle(i);                       
+       const AliVVertex* primVtxMC     = fMCEvent->GetPrimaryVertex();
+       Double_t mcProdVtxX     = primVtxMC->GetX();
+       Double_t mcProdVtxY     = primVtxMC->GetY();
+       Double_t mcProdVtxZ     = primVtxMC->GetZ();
+//     cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
+       // Loop over all primary MC particle    
+       for(Int_t i = 0; i < fMCStack->GetNtrack(); i++) {
+               if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){ 
+                       TParticle* particle = (TParticle *)fMCStack->Particle(i);
                        if (!particle) continue;
 
+                       
                        Int_t isMCFromMBHeader = -1;
                        if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
                                isMCFromMBHeader
@@ -1811,8 +1700,69 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
                                if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
                        }
 
+                       if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
+                       if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
+                               hMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
+                               if(particle->GetMother(0) >-1){ // Meson Decay Gamma
+                                       switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
+                                               case 111: // Pi0
+                                               hMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                               case 113: // Rho0
+                                               hMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                               case 221: // Eta
+                                               hMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                               case 223: // Omega
+                                               hMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                               case 331: // Eta'
+                                               hMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                               case 333: // Phi
+                                               hMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                               case 3212: // Sigma
+                                               hMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
+                                               break;
+                                       }
+                               }
+                       }
+                       if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
+                               hMCConvGammaPt[fiCut]->Fill(particle->Pt());
+                               if (fDoPhotonQA > 0){
+                                       hMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
+                                       hMCConvGammaEta[fiCut]->Fill(particle->Eta());
+                               }
+                       } // Converted MC Gamma
                        if(fDoMesonAnalysis){
-                               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
+                               if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
+                                       Double_t mesonY = 10.;
+                                       if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
+                                               mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
+                                       } else{
+                                               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))
+                                               -((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
+                                       }
+                                       Float_t weightedK0s= 1;
+                                       if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
+                                               if (particle->Pt()>0.005){
+                                                       weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
+                                                       //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
+                                               }
+                                       }
+                                       if (fMCStack->IsPhysicalPrimary(i)){
+                                               hMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
+                                               hMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
+                                               hMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
+                                       }       
+                               }
+                               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                                       ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
+                                       TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
+                                       TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
+
                                        Float_t weighted= 1;
                                        if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
                                                if (particle->Pt()>0.005){
@@ -1822,19 +1772,91 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
                        //                   }
                                                }
                                        }
-                                       
-                                       if(particle->GetPdgCode() == 111){      
-                                               Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
-                                               Int_t source = GetSourceClassification(111,pdgCode);
-                                               hMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
-                                               hMCSecPi0Source[fiCut]->Fill(pdgCode);                                          
+                                       Double_t mesonY = 10.;
+                                       if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
+                                               mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
+                                       } else {
+                                               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))
+                                               -((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
+                                       }
+                                       Double_t alpha = -1;
+                                       if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
+                                               alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
+                                       }
+
+                                       if(particle->GetPdgCode() == 111){
+                                               hMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
+                                               hMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
+                                               if (fDoMesonQA > 0){
+                                                       hMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                                       hMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
+                                               }       
                                        } else if(particle->GetPdgCode() == 221){
-                                               Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
-                                               hMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
-                                               hMCSecEtaSource[fiCut]->Fill(pdgCode);
+                                               hMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
+                                               hMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
+                                               if (fDoMesonQA > 0){
+                                                       hMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                                       hMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
+                                               }       
                                        } 
+
+                                       // Check the acceptance for both gammas
+                                       if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
+                                       ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE)  &&
+                                       ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
+                                       ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
+
+                                               if(particle->GetPdgCode() == 111){
+                                                       hMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
+                                               } else if(particle->GetPdgCode() == 221){
+                                                       hMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
+                                               }
+                                       }
                                }
-                       }
+                       }       
+               } else {
+                       if (fDoMesonQA){
+                               TParticle* particle = (TParticle *)fMCStack->Particle(i);                       
+                               if (!particle) continue;
+
+                               Int_t isMCFromMBHeader = -1;
+                               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
+                                       isMCFromMBHeader
+                                               = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
+                                       if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
+                               }
+
+                               if(fDoMesonAnalysis){
+                                       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
+                                               Float_t weighted= 1;
+                                               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
+                                                       if (particle->Pt()>0.005){
+                                                               weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
+                               //                   if(particle->GetPdgCode() == 221){
+                               //                      cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
+                               //                   }
+                                                       }
+                                               }
+                                               
+                                               if(particle->GetPdgCode() == 111){      
+                                                       Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
+                                                       Int_t source = GetSourceClassification(111,pdgCode);
+                                                       hMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
+                                                       
+                                                       Double_t deltaX = particle->Vx() - mcProdVtxX;
+                                                       Double_t deltaY = particle->Vy() - mcProdVtxY;
+                                                       Double_t deltaZ = particle->Vz() - mcProdVtxZ;
+                                                       Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
+                                                       hMCSecPi0RvsSource[fiCut]->Fill(realRadius3D,source,weighted); // All MC Pi0
+                                                       hMCSecPi0Source[fiCut]->Fill(pdgCode);                                          
+                                               } else if(particle->GetPdgCode() == 221){
+                                                       Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
+                                                       hMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
+                                                       hMCSecEtaSource[fiCut]->Fill(pdgCode);
+                                               } 
+                                       }
+                               }
+                       }       
                }
        }
 }
@@ -1941,7 +1963,11 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
 void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
 {
        // Process True Mesons
-       AliStack *MCStack = fMCEvent->Stack();
+       const AliVVertex* primVtxMC     = fMCEvent->GetPrimaryVertex();
+       Double_t mcProdVtxX     = primVtxMC->GetX();
+       Double_t mcProdVtxY     = primVtxMC->GetY();
+       Double_t mcProdVtxZ     = primVtxMC->GetZ();    
+
        iMesonMCInfo = 0;
        if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
                Bool_t isTruePi0 = kFALSE;
@@ -1950,13 +1976,13 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                Bool_t isTrueEtaDalitz = kFALSE;
                Bool_t gamma0DalitzCand = kFALSE;
                Bool_t gamma1DalitzCand = kFALSE;
-               Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
+               Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCStack);
                Int_t gamma0MotherLabel = -1;
                if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                        // Daughters Gamma 0
-                       TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
-                       TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
-                       TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
+                       TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(fMCStack);
+                       TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(fMCStack);
+                       TParticle * gammaMC0 = (TParticle*)fMCStack->Particle(gamma0MCLabel);
                        if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){  // Electrons ...
                                if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
                                        if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
@@ -1974,13 +2000,13 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                        }
                }
                if(TrueGammaCandidate1->GetV0Index()<fInputEvent->GetNumberOfV0s()){
-                       Int_t gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(MCStack);
+                       Int_t gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCStack);
                        Int_t gamma1MotherLabel = -1;
                        if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                                // Daughters Gamma 1
-                               TParticle * negativeMC = (TParticle*)TrueGammaCandidate1->GetNegativeMCDaughter(MCStack);
-                               TParticle * positiveMC = (TParticle*)TrueGammaCandidate1->GetPositiveMCDaughter(MCStack);
-                               TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
+                               TParticle * negativeMC = (TParticle*)TrueGammaCandidate1->GetNegativeMCDaughter(fMCStack);
+                               TParticle * positiveMC = (TParticle*)TrueGammaCandidate1->GetPositiveMCDaughter(fMCStack);
+                               TParticle * gammaMC1 = (TParticle*)fMCStack->Particle(gamma1MCLabel);
                                if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){  // Electrons ...
                                        if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
                                                if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
@@ -1998,10 +2024,10 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                                }
                        }
                        if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
-                               if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
+                               if(((TParticle*)fMCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
                                        isTruePi0=kTRUE;
                                }
-                               if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
+                               if(((TParticle*)fMCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
                                        isTrueEta=kTRUE;
                                }
                        }
@@ -2036,40 +2062,43 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                                                }
                                        }
                                }   
-                               if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
-                                       Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0);
+                               
+                               Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, gamma0MotherLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ); 
+                               
+                               if(!isPrimary){ // Secondary Meson
+                                       Int_t secMotherLabel = ((TParticle*)fMCStack->Particle(gamma1MotherLabel))->GetMother(0);
                                        Float_t weightedSec= 1;
-                                       if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
+                                       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
                                                //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
                                        }
                                        hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                                        iMesonMCInfo = 2;
                                        if (secMotherLabel >-1){
-                                               if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
+                                               if(fMCStack->Particle(secMotherLabel)->GetPdgCode()==310){
                                                        iMesonMCInfo = 4;
                                                        hESDTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                                                        if (fDoMesonQA > 0)hESDTrueK0sWithPi0DaughterMCPt[fiCut]
-                                                                                       ->Fill(MCStack->Particle(secMotherLabel)->Pt());
+                                                                                       ->Fill(fMCStack->Particle(secMotherLabel)->Pt());
                                                }
-                                               if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221){
+                                               if(fMCStack->Particle(secMotherLabel)->GetPdgCode()==221){
                                                        iMesonMCInfo = 3;
                                                        hESDTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                                                        if (fDoMesonQA > 0)hESDTrueEtaWithPi0DaughterMCPt[fiCut]
-                                                                                       ->Fill(MCStack->Particle(secMotherLabel)->Pt());
+                                                                                       ->Fill(fMCStack->Particle(secMotherLabel)->Pt());
                                                }
-                                               if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122){
+                                               if(fMCStack->Particle(secMotherLabel)->GetPdgCode()==3122){
                                                        iMesonMCInfo = 7;
                                                        hESDTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                                                        if (fDoMesonQA > 0)hESDTrueLambdaWithPi0DaughterMCPt[fiCut]
-                                                                                       ->Fill(MCStack->Particle(secMotherLabel)->Pt());
+                                                                                       ->Fill(fMCStack->Particle(secMotherLabel)->Pt());
                                                }
                                        }
                                } else { // Only primary pi0 for efficiency calculation
                                        iMesonMCInfo = 6;
                                        Float_t weighted= 1;
                                        if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
-                                               if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
+                                               if (((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
                                                        weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
                //                      cout << "rec \t " <<gamma1MotherLabel << "\t" <<  weighted << endl;
                                                }
@@ -2081,10 +2110,10 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                                        
                                        if (fDoMesonQA > 0){
                                                if(isTruePi0){ // Only primary pi0 for resolution
-                                                       hESDTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
+                                                       hESDTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
                                                }
                                                if (isTrueEta){ // Only primary eta for resolution
-                                                       hESDTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
+                                                       hESDTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)fMCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
                                                }
                                        }
                                }
@@ -2251,7 +2280,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
                                                                                        ->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
                                        }
                                }
-                       }else{ // Only primary pi0 for efficiency calculation
+                       } else { // Only primary pi0 for efficiency calculation
                                Float_t weighted= 1;
                                iMesonMCInfo = 6;
                                if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
@@ -2349,8 +2378,8 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
                        for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
                                AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
-                               if(fMoveParticleAccordingToVertex == kTRUE){
-                               bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
+                               if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
+                                       bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
                                }
 
                                for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
@@ -2382,7 +2411,7 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                        for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
                                AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
                                if(previousEventV0s){
-                               if(fMoveParticleAccordingToVertex == kTRUE){
+                               if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
                                        bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
                                }
                                for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
index a7065738d94a61db7c82443918cd4f555f78330d..d9826673efeec1adb6fdb2cbb2439b0c2ee78708 100644 (file)
@@ -150,6 +150,7 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
                TH1F                                                            **hMCK0sWOWeightPt;                                                                     //!
                TH2F                                                            **hMCK0sPtY;                                                                            //!
                TH2F                                                            **hMCSecPi0PtvsSource;                                                          //!
+               TH2F                                                            **hMCSecPi0RvsSource;                                                           //!
                TH1F                                                            **hMCSecPi0Source;                                                                      //!
                TH1F                                                            **hMCSecEtaPt;                                                                          //!
                TH1F                                                            **hMCSecEtaSource;                                                                      //!
index 83a5ed3d0890bd59c697155d18481ecc799d05ef..9db8ecd434889614c9e57e38559e47967672a64b 100644 (file)
@@ -1694,12 +1694,14 @@ void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessPionCandidates(){
                                labelp=TMath::Abs(posPionCandidate->GetLabel());
                                fNegativeMCParticle = fMCStack->Particle(labeln);
                                fPositiveMCParticle = fMCStack->Particle(labelp);
+                               // check whether MC particles exist, else abort
+                               if (fNegativeMCParticle == NULL || fPositiveMCParticle == NULL) return;
+
                                motherlabeln = fNegativeMCParticle->GetMother(0);
                                motherlabelp = fPositiveMCParticle->GetMother(0);
-                               if( fPositiveMCParticle && fNegativeMCParticle) {
-                                       virtualPhoton->SetMCLabelPositive(labelp);
-                                       virtualPhoton->SetMCLabelNegative(labeln);
-                               }                               
+                               virtualPhoton->SetMCLabelPositive(labelp);
+                               virtualPhoton->SetMCLabelNegative(labeln);
+                       
                        }
                        
                        AliAODConversionPhoton *vParticle = new AliAODConversionPhoton(virtualPhoton); //To apply mass 2 pion mass cut
index 8e28f118a5858511a76e6265e495f7f442e8154e..f4f9df791129392bc6ea7ed177b91ac7f596dfdd 100644 (file)
@@ -256,6 +256,7 @@ void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
        
        if(!fV0Reader){
                printf("Error: No V0 Reader");
+               return;
        } // GetV0Reader
        
        
index 47e8ebaa1f18269c2161ab3b0c8d54b302aa1868..fcaa66bb132038a75a7951ed5f3bdda65289029f 100644 (file)
@@ -132,8 +132,8 @@ AliConvEventCuts::AliConvEventCuts(const char *name,const char *title) :
        fCaloTriggerPatchInfoName(""),
        fTriggersEMCAL(0),
        fTriggersEMCALSelected(-1),
-       fEMCALTrigInitialized(kFALSE)
-       
+       fEMCALTrigInitialized(kFALSE),
+       fSecProdBoundary(1.0)
 {
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
    fCutString=new TObjString((GetCutNumber()).Data());
@@ -210,7 +210,8 @@ AliConvEventCuts::AliConvEventCuts(const AliConvEventCuts &ref) :
        fCaloTriggerPatchInfoName(ref.fCaloTriggerPatchInfoName),
        fTriggersEMCAL(ref.fTriggersEMCAL),
        fTriggersEMCALSelected(ref.fTriggersEMCALSelected),
-       fEMCALTrigInitialized(kFALSE)
+       fEMCALTrigInitialized(kFALSE),
+       fSecProdBoundary(ref.fSecProdBoundary)
 {
    // Copy Constructor
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
@@ -1323,8 +1324,7 @@ Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEv
        if(!fIsHeavyIon)return kTRUE;
 
        if(fCentralityMin == fCentralityMax ) return kTRUE;//0-100%
-       else if(fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-100%
-
+       else if ( fCentralityMax==0) fCentralityMax=10; //CentralityRange = fCentralityMin-10*multfactor
        Double_t centrality=GetCentrality(event);
        if(centrality<0)return kFALSE;
 
@@ -1349,7 +1349,7 @@ Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEv
        }
 
        Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data()))->GetNumberOfPrimaryTracks();
-       Int_t PrimaryTracks10[10][2] =
+       Int_t PrimaryTracks10[11][2] =
                {
                        {9999,9999}, //  0
                        {1210, 928}, // 10
@@ -1360,9 +1360,10 @@ Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEv
                        { 106, 100}, // 60
                        {  51,  44}, // 70
                        {  21,  18}, // 80
-                       {   0,   0}  // 90
+                       {   0,   0},  // 90
+                       {   0,   0}  // 100 // only max accessible
                };
-       Int_t PrimaryTracks5a[10][2] =
+       Int_t PrimaryTracks5a[11][2] =
                {
                        {9999,9999}, // 0
                        {1485,1168}, // 5
@@ -1373,9 +1374,10 @@ Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEv
                        { 536, 435}, // 30
                        { 428, 350}, // 35
                        { 337, 276}, // 40
-                       { 260, 214}  // 45
+                       { 260, 214},  // 45
+                       { 0, 162}  // 50 only max accessible
                };
-       Int_t PrimaryTracks5b[10][2] =
+       Int_t PrimaryTracks5b[11][2] =
                {
                        { 260, 214}, // 45
                        { 197, 162}, // 50
@@ -1386,7 +1388,8 @@ Bool_t AliConvEventCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCEv
                        {  34,  29}, // 75
                        {  21,  18}, // 80
                        {  13,  11}, // 85
-                       {   0,   0}  // 90
+                       {   0,   0},  // 90
+                       {   0,   0}  // 100 only max accessible
                };
        Int_t column = 0;
        if(event->IsA()==AliESDEvent::Class()) column = 0;
@@ -1731,9 +1734,11 @@ void AliConvEventCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLis
        AliStack *fMCStack = 0x0;
        TClonesArray *fMCStackAOD = 0x0;
        if(MCEvent->IsA()==AliMCEvent::Class()){
-               cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
-               if(cHeader) headerFound = kTRUE;
-               if(dynamic_cast<AliMCEvent*>(MCEvent))fMCStack = dynamic_cast<AliStack*>(dynamic_cast<AliMCEvent*>(MCEvent)->Stack());
+               if(dynamic_cast<AliMCEvent*>(MCEvent)){
+                       cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
+                       if(cHeader) headerFound = kTRUE;
+                       fMCStack = dynamic_cast<AliStack*>(dynamic_cast<AliMCEvent*>(MCEvent)->Stack());
+               }       
        }
        if(MCEvent->IsA()==AliAODEvent::Class()){ // MCEvent is a AODEvent in case of AOD
                cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName()));
@@ -2361,3 +2366,97 @@ TClonesArray *AliConvEventCuts::GetArrayFromEvent(AliVEvent* fInputEvent, const
        }
        return arr;
 }
+
+//_________________________________________________________________________
+Bool_t AliConvEventCuts::IsConversionPrimaryESD( AliStack *MCStack, Int_t stackpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ){
+       
+       TParticle* particle = (TParticle *)MCStack->Particle(stackpos);
+       if (!particle) return kFALSE; 
+       if (particle->GetMother(0) != -1){
+               Double_t deltaX = particle->Vx() - prodVtxX;
+               Double_t deltaY = particle->Vy() - prodVtxY;
+               Double_t deltaZ = particle->Vz() - prodVtxZ;
+
+               Double_t realRadius2D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY);
+               Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
+               
+
+               Bool_t dalitzCand = kFALSE;
+               
+               TParticle* firstmother = (TParticle *)MCStack->Particle(particle->GetMother(0));
+               Int_t pdgCodeFirstMother                = firstmother->GetPdgCode();                    
+               Bool_t intDecay = kFALSE;
+               if ( pdgCodeFirstMother == 111 || pdgCodeFirstMother == 221 ) intDecay = kTRUE;
+               if ( intDecay && abs(particle->GetPdgCode()) == 11 ){
+                       dalitzCand = kTRUE;
+//                     cout << "dalitz candidate found" << endl;
+               }
+       
+               Int_t source = particle->GetMother(0);
+               Bool_t foundExcludedPart = kFALSE;
+               Bool_t foundShower = kFALSE;            
+               Int_t pdgCodeMotherPrev = 0;
+               Int_t pdgCodeMotherPPrevMother = 0;
+               Int_t depth = 0;
+               if (dalitzCand || realRadius3D < fSecProdBoundary ){
+//                     if (particle->GetPdgCode() == 22){
+//                             cout << endl << endl << "new particle: " << stackpos <<endl;
+//                             cout << particle->GetPdgCode() << "\t" << particle->R() << "\t" << realRadius2D << "\t" << realRadius3D << endl;
+//                     }
+                       while (depth < 20){
+                               TParticle* mother       = (TParticle *)MCStack->Particle(source);
+                               source                          = mother->GetMother(0); 
+//                             if (particle->GetPdgCode() == 22)cout << "Stackposition: "<< source << endl;
+                               Int_t pdgCodeMother             = mother->GetPdgCode();                 
+//                             if (particle->GetPdgCode() == 22)cout << "Previous mothers: " << pdgCodeMother << "\t"<< pdgCodeMotherPrev<< "\t" << pdgCodeMotherPPrevMother << endl;
+                               if (pdgCodeMother == pdgCodeMotherPrev && pdgCodeMother == pdgCodeMotherPPrevMother) depth = 20;
+                               if (abs(pdgCodeMother) == 11 && abs(pdgCodeMotherPrev) == 22 && abs(pdgCodeMotherPPrevMother) == 11 ){
+                                       foundShower = kTRUE;
+                                       depth =20;
+                               }       
+                               if (abs(pdgCodeMother) == 22 && abs(pdgCodeMotherPrev) == 11 && abs(pdgCodeMotherPPrevMother) == 22 ){
+                                       foundShower = kTRUE;
+                                       depth =20;
+                               }
+                               
+                               // particles to be excluded:
+                               // K0s          - 310  
+                               // K0l          - 130
+                               // K+/-         - 321
+                               // Lambda       - 3122
+                               // Sigma0       - 3212
+                               // Sigma+/-     - 3222, 3112
+                               // Cascades     - 3322, 3312    
+                               if (abs(pdgCodeMother) == 310   || abs(pdgCodeMother) == 130    || abs(pdgCodeMother) == 321  ||
+                                       abs(pdgCodeMother) == 3122      || abs(pdgCodeMother) == 3212   || abs(pdgCodeMother) == 3222 ||
+                                       abs(pdgCodeMother) == 3112      || abs(pdgCodeMother) == 3322   || abs(pdgCodeMother) == 3312 
+                               ) {
+                                       foundExcludedPart = kTRUE;
+                               }       
+//                             if (particle->GetPdgCode() == 22)cout << mother->GetPdgCode() << "\t" <<  source << "\t" << foundExcludedPart<< endl;
+                               pdgCodeMotherPPrevMother = pdgCodeMotherPrev;
+                               pdgCodeMotherPrev = pdgCodeMother;                      
+                               if (source == -1) depth = 20;
+                               
+//                             if (particle->GetPdgCode() == 22)cout << depth << endl;
+                               depth++;
+                       }       
+               }       
+               if (foundExcludedPart){
+//                     if (particle->GetPdgCode() == 22)cout << "This is definitely a secondary, manually excluded" << endl;
+                       return kFALSE;
+               } else if (dalitzCand){
+//                     if (particle->GetPdgCode() == 22)cout << "This was a decay via a virtual photon" << endl;
+                       return kTRUE;
+               } else if (foundShower){
+//                     if (particle->GetPdgCode() == 22)cout << "This is a shower" << endl;
+                       return kFALSE;                  
+               } else if (realRadius3D > fSecProdBoundary){
+//                     cout << "This is a secondary, to large production radius" << endl;
+                       return kFALSE;                  
+               }
+       }
+
+       return kTRUE;
+}      
+
index 5a1184d548a44defa2498e823b2ee025c9cac347..dcbff40af7831345ddb28f91706d82364667239e 100644 (file)
@@ -187,6 +187,8 @@ class AliConvEventCuts : public AliAnalysisCuts {
                Int_t           IsHeavyIon()                                                                                    { return fIsHeavyIon                                                                    ; }
                void            DoEtaShift(Bool_t doEtaShift)                                                   { fDoEtaShift = doEtaShift                                                              ; }
                
+               //MC particle flags - determine whether particle is primary or secondary
+               Bool_t IsConversionPrimaryESD( AliStack *MCStack, Int_t stackpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ); 
                
        protected:
                TList                                           *fHistograms;
@@ -256,6 +258,8 @@ class AliConvEventCuts : public AliAnalysisCuts {
                ULong_t                                         fTriggersEMCAL;                                                 // list of fired EMCAL triggers
                ULong_t                                         fTriggersEMCALSelected;                                 // list of accepted triggers
                Bool_t                                          fEMCALTrigInitialized;                                  // EMCAL triggers initialized
+               // Primary secondary distinction
+               Double_t                                        fSecProdBoundary;                                               // 3D radius of production (cm) for primary-secodary distinction
                
        private:
 
index 18db1a93440f86ae202d82fe2b11a044aa77d2f5..0658b23702642b7f8c630ed2d60d4d3a9bf76d69 100644 (file)
@@ -3579,45 +3579,48 @@ Bool_t AliConversionCuts::IsCentralitySelected(AliVEvent *event, AliVEvent *fMCE
    }
 
    Int_t nprimaryTracks = ((AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1"))->GetNumberOfPrimaryTracks();
-   Int_t PrimaryTracks10[10][2] =
-      {
-         {9999,9999}, //  0
-         {1210, 928}, // 10
-         { 817, 658}, // 20
-         { 536, 435}, // 30
-         { 337, 276}, // 40
-         { 197, 162}, // 50
-         { 106, 100}, // 60
-         {  51,  44}, // 70
-         {  21,  18}, // 80
-         {   0,   0}  // 90
-      };
-   Int_t PrimaryTracks5a[10][2] =
-      {
-         {9999,9999}, // 0
-         {1485,1168}, // 5
-         {1210, 928}, // 10
-         { 995, 795}, // 15
-         { 817, 658}, // 20
-         { 666, 538}, // 25
-         { 536, 435}, // 30
-         { 428, 350}, // 35
-         { 337, 276}, // 40
-         { 260, 214}  // 45
-      };
-   Int_t PrimaryTracks5b[10][2] =
-      {
-         { 260, 214}, // 45
-         { 197, 162}, // 50
-         { 147, 125}, // 55
-         { 106, 100}, // 60
-         {  75,  63}, // 65
-         {  51,  44}, // 70
-         {  34,  29}, // 75
-         {  21,  18}, // 80
-         {  13,  11}, // 85
-         {   0,   0}  // 90
-      };
+       Int_t PrimaryTracks10[11][2] =
+               {
+                       {9999,9999}, //  0
+                       {1210, 928}, // 10
+                       { 817, 658}, // 20
+                       { 536, 435}, // 30
+                       { 337, 276}, // 40
+                       { 197, 162}, // 50
+                       { 106, 100}, // 60
+                       {  51,  44}, // 70
+                       {  21,  18}, // 80
+                       {   0,   0},  // 90
+                       {   0,   0}  // 100 // only max accessible
+               };
+       Int_t PrimaryTracks5a[11][2] =
+               {
+                       {9999,9999}, // 0
+                       {1485,1168}, // 5
+                       {1210, 928}, // 10
+                       { 995, 795}, // 15
+                       { 817, 658}, // 20
+                       { 666, 538}, // 25
+                       { 536, 435}, // 30
+                       { 428, 350}, // 35
+                       { 337, 276}, // 40
+                       { 260, 214},  // 45
+                       { 0, 162}  // 50 only max accessible
+               };
+       Int_t PrimaryTracks5b[11][2] =
+               {
+                       { 260, 214}, // 45
+                       { 197, 162}, // 50
+                       { 147, 125}, // 55
+                       { 106, 100}, // 60
+                       {  75,  63}, // 65
+                       {  51,  44}, // 70
+                       {  34,  29}, // 75
+                       {  21,  18}, // 80
+                       {  13,  11}, // 85
+                       {   0,   0},  // 90
+                       {   0,   0}  // 100 only max accessible
+               };
    Int_t column = 0;
    if(event->IsA()==AliESDEvent::Class()) column = 0;
    if(event->IsA()==AliAODEvent::Class()) column = 1;
@@ -4078,9 +4081,11 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
        AliStack *fMCStack = 0x0;
        TClonesArray *fMCStackAOD = 0x0;
        if(MCEvent->IsA()==AliMCEvent::Class()){
-               cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
-               if(cHeader) headerFound = kTRUE;
-               if(dynamic_cast<AliMCEvent*>(MCEvent))fMCStack = dynamic_cast<AliStack*>(dynamic_cast<AliMCEvent*>(MCEvent)->Stack());
+               if (dynamic_cast<AliMCEvent*>(MCEvent)){
+                       cHeader = dynamic_cast<AliGenCocktailEventHeader*>(dynamic_cast<AliMCEvent*>(MCEvent)->GenEventHeader());
+                       if(cHeader) headerFound = kTRUE;
+                       fMCStack = dynamic_cast<AliStack*>(dynamic_cast<AliMCEvent*>(MCEvent)->Stack());
+               }       
        }
        if(MCEvent->IsA()==AliAODEvent::Class()){ // MCEvent is a AODEvent in case of AOD
                cHeaderAOD = dynamic_cast<AliAODMCHeader*>(MCEvent->FindListObject(AliAODMCHeader::StdBranchName()));
index e1262ca13437f69aa697be88f0e6c1bc91b0d47c..cc743504639f4e408e1e05aec4d70e9cee9b6d30 100644 (file)
@@ -291,6 +291,10 @@ Bool_t AliPrimaryPionCuts::PionIsSelected(AliESDtrack* lTrack){
        
        Float_t b[2];
        Float_t bCov[3];
+       if (lTrack == NULL){
+               if (fHistCutIndex) fHistCutIndex->Fill(kNoTracks);
+               return kFALSE;  
+       }   
        lTrack->GetImpactParameters(b,bCov);
 
        if (bCov[0]<=0 || bCov[2]<=0) {
@@ -305,10 +309,6 @@ Bool_t AliPrimaryPionCuts::PionIsSelected(AliESDtrack* lTrack){
 
        if (fHistCutIndex) fHistCutIndex->Fill(kPionIn);
 
-       if (lTrack == NULL){
-               if (fHistCutIndex) fHistCutIndex->Fill(kNoTracks);
-               return kFALSE;  
-       }   
        if (fHistTrackDCAxyPtbefore) fHistTrackDCAxyPtbefore->Fill(dcaToVertexXY,lTrack->Pt());
        if (fHistTrackDCAzPtbefore) fHistTrackDCAzPtbefore->Fill( dcaToVertexZ, lTrack->Pt());
        if (fHistTrackNFindClsPtTPCbefore) fHistTrackNFindClsPtTPCbefore->Fill( clsToF, lTrack->Pt());
index cf6349821e3dfc2f7dacbff74840d4ffb9f06aac..fa3476e4bf2fff2cdc3bdf3d9901b8a5e23bd7b9 100644 (file)
@@ -505,7 +505,7 @@ void AliAnalysisTaskPi0FlowMC::ConsiderPi0s()
       }
       if(ph2->IsDispOK()){
         FillHistogram(Form("hSingleDisp_cen%d",fCentBin),m,pt2, w) ;
-        if(ph1->IsntUnfolded()){
+        if(ph2->IsntUnfolded()){
           FillHistogram(Form("hSingleDispwou_cen%d",fCentBin),m,pt2, w) ;
        }
         FillHistogram(Form("hSingleDispcore_cen%d",fCentBin),mcore,ptcore2, w) ;
@@ -770,7 +770,7 @@ void AliAnalysisTaskPi0FlowMC::ConsiderPi0sMix()
         }
         if(ph2->IsDispOK()){
           FillHistogram(Form("hMiSingleDisp_cen%d",fCentBin),m,pt2, w) ;
-          if(ph1->IsntUnfolded()){
+          if(ph2->IsntUnfolded()){
             FillHistogram(Form("hMiSingleDispwou_cen%d",fCentBin),m,pt2, w) ;
          }
           FillHistogram(Form("hMiSingleDispcore_cen%d",fCentBin),mcore,ptcore2, w) ;
index 969bb9ba281ed631ac8efd4e1b920662fd21e3de..f428993293159f128dff042ec6c57994479581d1 100644 (file)
@@ -49,11 +49,11 @@ void AliAnalysisTaskPi0FlowMCParamWeights::UserCreateOutputObjects()
 
       sprintf(key,"hPi0%s_cen%d", pidNames[ipid],iBin);  
       hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key));
-      hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key);
+      if(hist) { hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key); }
 
       sprintf(key,"hMiPi0%s_cen%d", pidNames[ipid],iBin);  
       hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key));
-      hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key);
+      if(hist) { hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key); }
     }
   }
   
index 1540a0b408b44e5863eeb91438cf829290f4d2a1..ccce4b11d897e3cbad988014279ee4971ce712c9 100644 (file)
@@ -846,7 +846,6 @@ void AliAnalysisTaskDStarCorrelations::UserExec(Option_t *){
         Int_t NofEventsinPool = 1;
         if(fmixing) NofEventsinPool = fCorrelator->GetNofEventsInPool();
         
-        Bool_t *trackOrigin = NULL;
        // cout << "crash here 5" << endl;
         //************************************************** LOOP ON EVENTS IN EVENT POOL *****************************************************
         
@@ -922,6 +921,7 @@ void AliAnalysisTaskDStarCorrelations::UserExec(Option_t *){
                  
               
                  
+                Bool_t *trackOrigin = NULL;
                  
                  if(fmontecarlo) {trackOrigin = fAssocCuts->IsMCpartFromHF(label,fmcArray);
                      if(trackOrigin[4]) {/*cout << "Something is wrong with hadron in MC - skipping" << endl; */continue;}
@@ -1029,7 +1029,7 @@ void AliAnalysisTaskDStarCorrelations::UserExec(Option_t *){
                      }
                  }
                  
-                 
+                delete [] trackOrigin;
              } // end loop on associated tracks
             
         } // end loop on events in event pool
index 0cea99f043de1a2b26b2a281787a4a8b5910303e..437bcd96f0e578a6a4693372eeb2f5a47ae77a3b 100644 (file)
@@ -611,7 +611,10 @@ void AliAnalysisTaskSED0Correlations::UserExec(Option_t */*option*/)
     for(Int_t itrack=0; itrack<ntracks; itrack++) { // loop on tacks
       //    ... get the track
       AliAODTrack * track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrack));
-      if(!track) AliFatal("Not a standard AOD");
+      if(!track){
+       AliWarning("Error in casting to AOD track. Not a standard AOD?");
+       continue;
+      }
       if(TESTBIT(track->GetITSClusterMap(),2) || TESTBIT(track->GetITSClusterMap(),3) ){
        skipEvent=kTRUE;
        fNentries->Fill(16);
@@ -671,7 +674,10 @@ void AliAnalysisTaskSED0Correlations::UserExec(Option_t */*option*/)
 
     for(Int_t itrack=0; itrack<aod->GetNumberOfTracks(); itrack++) { // loop on tacks
       AliAODTrack * track = dynamic_cast<AliAODTrack*>(aod->GetTrack(itrack));
-      if(!track) AliFatal("Not a standard AOD");
+      if(!track){
+       AliWarning("Error in casting to AOD track. Not a standard AOD?");
+       continue;
+      }
       //rejection of tracks
       if(track->GetID() < 0) continue; //discard negative ID tracks
       if(track->Pt() < fPtThreshLow.at(0) || track->Pt() > fPtThreshUp.at(0)) continue; //discard tracks outside pt range for hadrons/K
index 29a313af9012f4106924dff2ab9bc14710eb51bd..46dfc9030ce1d6eb899bc0ee061697095722cb31 100644 (file)
@@ -513,6 +513,8 @@ void AliAnalysisTaskFlowTPCEMCalEP::UserExec(Option_t*)
 
     AliESDtrack *track = dynamic_cast<AliESDtrack*>(vparticle);
 
+    if(!track) continue;
+
     if (TMath::Abs(track->Eta())>0.7) continue;
  
     fTrackPtBefTrkCuts->Fill(track->Pt());
@@ -626,7 +628,7 @@ void AliAnalysisTaskFlowTPCEMCalEP::UserExec(Option_t*)
     if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
 
     if (m20>0.02 && m02>0.02){
-      Double_t corr[7]={iCent,iPt,fTPCnSigma,fEMCalnSigma,m02,dphi,cosdphi};
+      Double_t corr[7]={(Double_t)iCent,(Double_t)iPt,fTPCnSigma,fEMCalnSigma,m02,dphi,cosdphi};
       fCorr->Fill(corr);
     }
   
index 6c8a50092bdbca2655e140f4b63c3ba927ab1931..82ee31a82c06451e99dc1bad53ae980cf218f46e 100644 (file)
@@ -1177,7 +1177,8 @@ void AliAnalysisTaskHFECal::UserCreateOutputObjects()
   //fCuts->SetMinNClustersITS(3);
   fCuts->SetMinNClustersITS(2);
   fCuts->SetProductionVertex(0,50,0,50);
-  fCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+  //fCuts->SetCutITSpixel(AliHFEextraCuts::kAny); // default
+  fCuts->SetCutITSpixel(AliHFEextraCuts::kBoth);
   fCuts->SetCheckITSLayerStatus(kFALSE);
   fCuts->SetVertexRange(10.);
   fCuts->SetTOFPIDStep(kFALSE);
index bf058a2c9c5b14a58169e6b554ed4e841aa458e6..5aae994b886a131f2948adecf780018a361c7016 100644 (file)
@@ -1074,6 +1074,15 @@ AliCFDataGrid* AliHFEspectrum::SubtractBackground(Bool_t setBackground){
     TH1D *convCent[kCentrality-1];
     TH1D *nonHFECent[kCentrality-1]; 
     TH1D *subtractedCent[kCentrality-1];
+
+    for(Int_t initia=0; initia<(kCentrality-1); initia++) {
+      incElecCent[initia]=0x0;
+      charmCent[initia]=0x0;
+      convCent[initia]=0x0;
+      nonHFECent[initia]=0x0; 
+      subtractedCent[initia]=0x0;
+    }
+
     TH1D *measuredTH1Draw = (TH1D *) dataspectrumbeforesubstraction->Project(ptpr);
     CorrectFromTheWidth(measuredTH1Draw);
     if(fBeamType==1){
@@ -1218,6 +1227,7 @@ AliCFDataGrid* AliHFEspectrum::SubtractBackground(Bool_t setBackground){
         centRaw->cd(icent);
         gPad->SetLogx();
         gPad->SetLogy();
+       if(!incElecCent[icent-1] || !charmCent[icent-1] || !convCent[icent-1] || !nonHFECent[icent-1] || !subtractedCent[icent-1]) continue;
         incElecCent[icent-1]->GetXaxis()->SetRangeUser(0.4,8.);
         incElecCent[icent-1]->Draw("p");
         incElecCent[icent-1]->SetMarkerColor(1);
@@ -1260,7 +1270,7 @@ AliCFDataGrid* AliHFEspectrum::SubtractBackground(Bool_t setBackground){
 
   if(fDebugLevel > 0) {
 
-    Int_t ptprd;
+    Int_t ptprd=0;
     if(fBeamType==0) ptprd=0;
     if(fBeamType==1) ptprd=1;
     
@@ -1923,7 +1933,7 @@ AliCFDataGrid *AliHFEspectrum::CorrectV0Efficiency(AliCFDataGrid* const bgsubpec
 
   if(fDebugLevel > 0) {
 
-    Int_t ptpr;
+    Int_t ptpr=0;
     if(fBeamType==0) ptpr=0;
     if(fBeamType==1) ptpr=1;
     
@@ -2127,7 +2137,7 @@ TList *AliHFEspectrum::Unfold(AliCFDataGrid* const bgsubpectrum){
 
   if(fDebugLevel > 0) {
 
-    Int_t ptpr;
+    Int_t ptpr=0;
     if(fBeamType==0) ptpr=0;
     if(fBeamType==1) ptpr=1;
     
@@ -2233,7 +2243,7 @@ AliCFDataGrid *AliHFEspectrum::CorrectForEfficiency(AliCFDataGrid* const bgsubpe
 
   if(fDebugLevel > 0) {
 
-    Int_t ptpr;
+    Int_t ptpr=0;
     if(fBeamType==0) ptpr=0;
     if(fBeamType==1) ptpr=1;
     
diff --git a/PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.cxx b/PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.cxx
new file mode 100644 (file)
index 0000000..3c54494
--- /dev/null
@@ -0,0 +1,381 @@
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/////////////////////////////////////////////////////////////
+//
+// Class for AOD reconstructed heavy-flavour cascades 3prong
+// Used for Xic->pi Xi pi analysis
+//
+// Author: Y.S. Watanabe, wyosuke@cns.s.u-tokyo.ac.jp
+/////////////////////////////////////////////////////////////
+
+#include <TVector3.h>
+#include <TDatabasePDG.h>
+#include <TClonesArray.h>
+#include "AliAODMCParticle.h"
+#include "AliAODRecoDecay.h"
+#include "AliAODVertex.h"
+#include "AliAODRecoDecayHF3Prong.h"
+#include "AliAODRecoCascadeHF3Prong.h"
+
+ClassImp(AliAODRecoCascadeHF3Prong)
+
+//-----------------------------------------------------------------------------
+
+AliAODRecoCascadeHF3Prong::AliAODRecoCascadeHF3Prong() :
+AliAODRecoDecayHF3Prong()
+{
+  //
+  // Default Constructor
+  //
+}
+
+//-----------------------------------------------------------------------------
+AliAODRecoCascadeHF3Prong::AliAODRecoCascadeHF3Prong(AliAODVertex *vtx2, Short_t charge,
+                                                    Double_t *px, Double_t *py, Double_t *pz,
+                                                    Double_t *d0, Double_t *d0err, 
+                                                    Double_t *dca, Double_t sigvert,
+                                                    Double_t dist12,Double_t dist23):
+  AliAODRecoDecayHF3Prong(vtx2, px, py, pz, d0, d0err, dca,sigvert,dist12,dist23,charge)
+{
+  //
+  //  Constructor with AliAODVertex for decay vertex
+  //
+}
+
+//-----------------------------------------------------------------------------
+AliAODRecoCascadeHF3Prong::AliAODRecoCascadeHF3Prong(const AliAODRecoCascadeHF3Prong &source) :
+  AliAODRecoDecayHF3Prong(source)
+{
+  //
+  // Copy constructor
+  //
+}
+
+//-----------------------------------------------------------------------------
+AliAODRecoCascadeHF3Prong &AliAODRecoCascadeHF3Prong::operator=(const AliAODRecoCascadeHF3Prong &source)
+{
+  //
+  // assignment operator
+  //
+  if(&source == this) return *this;
+
+  AliAODRecoDecayHF3Prong::operator=(source);
+
+  return *this;
+}
+
+//-----------------------------------------------------------------------------
+AliAODRecoCascadeHF3Prong::~AliAODRecoCascadeHF3Prong()
+{
+  //
+  // Default Destructor
+  //
+}
+
+//----------------------------------------------------------------------------
+//Int_t AliAODRecoCascadeHF3Prong::MatchToMC(Int_t pdgabs,Int_t pdgabs3prong,
+//                                     Int_t *pdgDg,Int_t *pdgDg3prong,
+//                                  TClonesArray *mcArray, Bool_t isV0) const
+//{
+//  //
+//  // Check if this candidate is matched to a MC signal
+//  // If no, return -1
+//  // If yes, return label (>=0) of the AliAODMCParticle
+//  // 
+//
+//  Int_t ndg=GetNDaughters();
+//  if(ndg==0) {
+//    AliError("No daughters available");
+//    return -1;
+//  }
+//
+//  if ( isV0 &&
+//       ( (pdgDg[1]==2212 && pdgDg[0]==310) ||
+//      (pdgDg[1]==211 && pdgDg[0]==3122) ) ) {
+//    AliWarning(Form("Please, pay attention: first element in AliAODRecoCascadeHF3Prong object must be the bachelor and second one V0. Skipping! (pdgDg[0] = %d, (pdgDg[1] = %d)", pdgDg[0], pdgDg[1]));
+//    return -1;
+//  }
+//
+//  Int_t lab3Prong = -1;
+//
+//  if (!isV0) {
+//    AliAODRecoDecayHF2Prong *the2Prong = Get2Prong();
+//    lab2Prong = the2Prong->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
+//  } else {
+//    AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
+//    lab2Prong = theV0->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong); // the V0
+//  }
+//
+//  if(lab2Prong<0) return -1;
+//
+//  Int_t dgLabels[10]={0,0,0,0,0,0,0,0,0,0};
+//
+//  if (!isV0) {
+//    // loop on daughters and write labels
+//    for(Int_t i=0; i<ndg; i++) {
+//      AliVTrack *trk = dynamic_cast<AliVTrack*>(GetDaughter(i));
+//      if(!trk) continue;
+//      Int_t lab = trk->GetLabel();
+//      if(lab==-1) { // this daughter is the 2prong
+//     lab=lab2Prong;
+//      } else if(lab<-1) continue;
+//      dgLabels[i] = lab;
+//    }
+//  } else {
+//    AliVTrack *trk = dynamic_cast<AliVTrack*>(GetBachelor()); // the bachelor
+//    if (!trk) return -1;
+//    dgLabels[0] = trk->GetLabel();//TMath::Abs(trk->GetLabel());
+//    dgLabels[1] = lab2Prong;
+//  }
+//
+//  Int_t finalLabel = AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,2,2,pdgDg);
+//
+//  if (finalLabel>=0){
+//    // debug printouts for Lc->V0 bachelor case
+//
+//    if ( isV0 && (dgLabels[0]!=-1 && dgLabels[1]!=-1) ) {
+//      AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
+//      Bool_t onTheFly = theV0->GetOnFlyStatus();
+//      if (pdgDg[0]==2212 && pdgDg[1]==310) {
+//     AliAODMCParticle*k0s = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
+//     if(k0s){
+//       Int_t labK0 = k0s->GetMother();       
+//       AliAODMCParticle*k0bar = dynamic_cast<AliAODMCParticle*>(mcArray->At(labK0));
+//       if(k0bar){
+//         AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d) -> LabelK0S=%d (%d -> %d %d)",onTheFly,labK0,k0bar->GetPdgCode(),lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
+//         AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
+//                         finalLabel,pdgabs,
+//                         dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
+//       }
+//     }
+//      } else if (pdgDg[0]==211 && pdgDg[1]==3122) {
+//     AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d -> %d %d)",onTheFly,lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
+//     AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
+//                     finalLabel,pdgabs,
+//                   dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
+//      }
+//
+//    }
+//  }
+//
+//  return finalLabel;
+//
+//}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDcaXiDaughters() const
+{
+  //
+  // DCA between Xi daughters
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DcaXiDaughters();
+
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDcaV0Daughters() const
+{
+  //
+  // DCA between Cascade-V0 daughters
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DcaV0Daughters();
+
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDecayLength() const
+{
+  //
+  // Decay length of Xi
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+
+  if (!casc) 
+    return -1.;
+  AliAODVertex *vtxPrimary = GetPrimaryVtx();
+  Double_t posVtx[3] = {0.,0.,0.};
+  vtxPrimary->GetXYZ(posVtx);
+  return casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
+
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDecayLengthV0() const
+{
+  //
+  // Decay length of V0 from Xi
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DecayLengthV0();
+
+}
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascCosPointingAngle() const 
+{
+  //
+  // Xi pointing angle to primary vertex
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -999.;
+
+  AliAODVertex *vtxPrimary = GetPrimaryVtx();
+  Double_t posVtx[3] = {0.,0.,0.};
+  vtxPrimary->GetXYZ(posVtx);
+  return casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
+}
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascCosPointingAngleV0() const 
+{
+  //
+  // Cos pointing angle of V0 to Xi decay vertex
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -999.;
+  return casc->CosPointingAngle(casc->GetDecayVertexXi());
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDcaV0ToPrimVertex() const
+{
+  //
+  // DCA to primary vertex of Cascade-V0 
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DcaV0ToPrimVertex();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDcaPosToPrimVertex() const
+{
+  //
+  // DCA to primary vertex of Cascade-positive track
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DcaPosToPrimVertex();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDcaNegToPrimVertex() const
+{
+  //
+  // DCA to primary vertex of Cascade-negative track
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DcaNegToPrimVertex();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascDcaBachToPrimVertex() const
+{
+  //
+  // DCA to primary vertex of Cascade-Bachelor track
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->DcaBachToPrimVertex();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascMassXi() const
+{
+  //
+  // Xi mass
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->MassXi();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascMassLambda() const
+{
+  //
+  // Lambda mass of cascade-v0
+  //
+
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->MassLambda();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::CascMassAntiLambda() const
+{
+  //
+  // Anti-Lambda mass of cascade-v0
+  //
+       
+  AliAODcascade *casc = (AliAODcascade*)GetCascade();
+  if (!casc) 
+    return -1.;
+  return casc->MassAntiLambda();
+}
+
+//________________________________________________________________________
+Double_t AliAODRecoCascadeHF3Prong::XicCosPointingAngle() const
+{
+  //
+  // Xic pointing angle to primary vertex
+  //
+
+  AliAODVertex *vtxPrimary = GetPrimaryVtx();
+  AliAODVertex *vtxSecondary = GetSecondaryVtx();
+
+  Double_t dx = vtxSecondary->GetX()-vtxPrimary->GetX();
+  Double_t dy = vtxSecondary->GetY()-vtxPrimary->GetY();
+  Double_t dl = sqrt(dx*dx+dy*dy);
+
+  Double_t px = Px();
+  Double_t py = Py();
+  Double_t pt = Pt();
+
+  if(dl>0&&pt>0)
+    return (px*dx+py*dy)/pt/dl; 
+  else
+    return -9999.;
+}
diff --git a/PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.h b/PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.h
new file mode 100644 (file)
index 0000000..11dbaf6
--- /dev/null
@@ -0,0 +1,86 @@
+#ifndef ALIAODRECOCASCADEHF3PRONG_H
+#define ALIAODRECOCASCADEHF3PRONG_H
+/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */ 
+
+//***********************************************************
+// Class AliAODRecoCascadeHF3Prong
+// base class for AOD reconstructed heavy-flavour cascade 3Prong decays
+// (Xic+->pi Xi pi, ...)
+// The convention is: prong 0 is bachelor, prong 1 is cascade
+// prong 2 is bachelor
+//
+// Author: Y.S. Watanabe, wyosuke@cns.s.u-tokyo.ac.jp
+//***********************************************************
+
+#include <TRef.h>
+#include <TRefArray.h>
+#include <TClonesArray.h>
+#include <TClass.h>
+#include "AliAODVertex.h"
+#include "AliAODcascade.h"
+#include "AliAODv0.h"
+#include "AliAODRecoDecayHF3Prong.h"
+
+class AliAODRecoCascadeHF3Prong : public AliAODRecoDecayHF3Prong {
+
+ public:
+
+  AliAODRecoCascadeHF3Prong();
+  AliAODRecoCascadeHF3Prong(AliAODVertex *vtx2, Short_t charge,
+                           Double_t *px, Double_t *py, Double_t *pz,
+                           Double_t *d0, Double_t *d0err, 
+                           Double_t *dca, Double_t sigvert,
+                           Double_t dist12,Double_t dist23);
+  virtual ~AliAODRecoCascadeHF3Prong();
+
+  AliAODRecoCascadeHF3Prong(const AliAODRecoCascadeHF3Prong& source);
+  AliAODRecoCascadeHF3Prong& operator=(const AliAODRecoCascadeHF3Prong& source);
+
+  AliAODTrack* GetBachelor1() const {return (AliAODTrack*)GetDaughter(0);}
+  AliAODTrack* GetBachelor2() const {return (AliAODTrack*)GetDaughter(2);}
+  AliAODcascade* GetCascade() const {
+    if ( ! ((AliAODRecoDecay*)GetDaughter(1))->IsA()->InheritsFrom("AliAODcascade") ){
+      AliWarning("Object is not of type cascade");
+      return 0;
+    }
+    return (AliAODcascade*)GetDaughter(1);
+  }
+
+  AliAODTrack* GetCascadePositiveTrack() const { return  (AliAODTrack*)GetCascade()->GetDaughter(0);  }
+  AliAODTrack* GetCascadeNegativeTrack() const { return  (AliAODTrack*)GetCascade()->GetDaughter(1);  }
+  AliAODTrack* GetCascadeBachelorTrack() const { return  (AliAODTrack*)GetCascade()->GetDecayVertexXi()->GetDaughter(0);  }
+
+  // Xic invariant mass
+  Double_t InvMassPiXiPi() const {
+    UInt_t pdg[3]={211,3312,211}; return InvMass(3,pdg);
+  }
+
+  //  Int_t MatchToMC(Int_t pdgabs,Int_t pdgabs3prong,
+  //                  Int_t *pdgDg,Int_t *pdgDg3prong,
+  //                  TClonesArray *mcArray, Bool_t isV0=kFALSE) const;
+
+  Double_t CascDcaXiDaughters() const;
+  Double_t CascDcaV0Daughters() const;
+  Double_t CascDecayLength() const;
+  Double_t CascDecayLengthV0() const;
+  Double_t CascCosPointingAngle() const;
+  Double_t CascCosPointingAngleV0() const;
+  Double_t CascDcaV0ToPrimVertex() const;
+  Double_t CascDcaPosToPrimVertex() const;
+  Double_t CascDcaNegToPrimVertex() const;
+  Double_t CascDcaBachToPrimVertex() const;
+  Double_t CascMassXi() const;
+  Double_t CascMassLambda() const;
+  Double_t CascMassAntiLambda() const;
+
+  Double_t XicCosPointingAngle() const;
+
+ protected:
+
+  ClassDef(AliAODRecoCascadeHF3Prong, 1); // heavy-flavour cascade 3prong class
+};
+
+#endif
index d66ea5c7efd45e55772b9c019ff2e1d1d2f03378..b2a1de8d163a091f3e4bdddf1342e141aa610f6f 100644 (file)
@@ -94,6 +94,21 @@ AliAnalysisTaskCheckHFMCProd::AliAnalysisTaskCheckHFMCProd() : AliAnalysisTaskSE
   fReadMC(kTRUE)
 {
   //
+  for(Int_t i=0; i<5; i++){
+    fHistBYPtAllDecay[i]=0x0;
+    fHistYPtAllDecay[i]=0x0;
+    fHistYPtPromptAllDecay[i]=0x0;
+    fHistYPtFeeddownAllDecay[i]=0x0;
+    fHistYPtPrompt[i]=0x0;
+    fHistYPtFeeddown[i]=0x0;
+  }
+  for(Int_t i=0; i<2; i++){
+    fHistYPtD0byDecChannel[i]=0x0;
+    fHistYPtDplusbyDecChannel[i]=0x0;
+    fHistYPtDsbyDecChannel[i]=0x0;
+  }
+  fHistYPtDplusbyDecChannel[2]=0x0;
+
   DefineInput(0, TChain::Class());
   DefineOutput(1, TList::Class());
 }
index 73f9766c4448e9494f1d69465c5e63ce31f91672..3ec120ef81dd6928105f4df43c05d9f943c0c65d 100644 (file)
@@ -578,7 +578,10 @@ void AliAnalysisTaskCombinHF::UserExec(Option_t */*option*/){
   for(Int_t iTr=0; iTr<ntracks; iTr++){
     status[iTr]=0;
     AliAODTrack* track=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr));
-    if(!track) AliFatal("Not a standard AOD");
+    if(!track){
+      AliWarning("Error in casting track to AOD track. Not a standard AOD?");
+      continue;
+    }
     if(IsTrackSelected(track)) status[iTr]+=1;
     
     // PID
@@ -627,7 +630,10 @@ void AliAnalysisTaskCombinHF::UserExec(Option_t */*option*/){
  
   for(Int_t iTr1=0; iTr1<ntracks; iTr1++){
     AliAODTrack* trK=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr1));
-    if(!trK) AliFatal("Not a standard AOD");
+    if(!trK){
+      AliWarning("Error in casting track to AOD track. Not a standard AOD?");
+      continue;
+    }
     if((status[iTr1] & 1)==0) continue;
     if(fDoEventMixing>0){
       if(status[iTr1] & 2) fKaonTracks->AddLast(new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
@@ -645,7 +651,10 @@ void AliAnalysisTaskCombinHF::UserExec(Option_t */*option*/){
       if((status[iTr2] & 4)==0) continue;
       if(iTr1==iTr2) continue;
       AliAODTrack* trPi1=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr2));
-      if(!trPi1) AliFatal("Not a standard AOD");
+      if(!trPi1){
+       AliWarning("Error in casting track to AOD track. Not a standard AOD?");
+       continue;
+      }
       Int_t chargePi1=trPi1->Charge();
       trPi1->GetPxPyPz(tmpp);
       px[1] = tmpp[0];
@@ -670,7 +679,10 @@ void AliAnalysisTaskCombinHF::UserExec(Option_t */*option*/){
           if((status[iTr3] & 4)==0) continue;
           if(iTr1==iTr3) continue;
           AliAODTrack* trPi2=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr3));
-          if(!trPi2) AliFatal("Not a standard AOD");
+         if(!trPi2){
+           AliWarning("Error in casting track to AOD track. Not a standard AOD?");
+           continue;
+         }
           Int_t chargePi2=trPi2->Charge();
           if(chargePi2==chargeK) continue;
           nFiltered++;
@@ -820,7 +832,9 @@ Bool_t AliAnalysisTaskCombinHF::FillHistos(Int_t pdgD,Int_t nProngs, AliAODRecoD
               if(pdgCode==321){
                 fMassVsPtVsYSig->Fill(mass,pt,rapid);
                 AliAODMCParticle* dmes =  dynamic_cast<AliAODMCParticle*>(arrayMC->At(labD));
-                fPtVsYVsMultReco->Fill(dmes->Pt(),dmes->Y(),fMultiplicity);
+               if(dmes){
+                 fPtVsYVsMultReco->Fill(dmes->Pt(),dmes->Y(),fMultiplicity);
+               }
               }else{
                 fMassVsPtVsYRefl->Fill(mass,pt,rapid);
               }
index 326d65e66758d45162b9986760610e27c457b4e3..9553388e71d236a7377ec3858982ae584ef8978e 100644 (file)
@@ -125,6 +125,7 @@ AliAnalysisTaskSEDStarSpectra::AliAnalysisTaskSEDStarSpectra(const Char_t* name,
   Info("AliAnalysisTaskSEDStarSpectra","Calling Constructor");
 
   fCuts=cuts;
+  for(Int_t i=0;i<5;i++) fHistMassPtImpParTCDs[i]=0;
 
   DefineOutput(1,TList::Class());  //conters
   DefineOutput(2,TList::Class());  //All Entries output
index e7d698abcd4cb6f393737ed3accf9cf02f4a9325..af4fcd9f99d8c6365d61560fefa71bf50cc0367e 100644 (file)
@@ -3763,7 +3763,7 @@ Int_t AliAnalysisTaskSELc2V0bachelor::SearchForCommonMother(TClonesArray *mcArra
   AliDebug(2,Form("%s \n",stringaCheck2.Data()));
 
   delete [] labelMother;
-  delete pdgDg;
+  delete [] pdgDg;
 
   return pdgToBeReturned;
 
old mode 100755 (executable)
new mode 100644 (file)
index 8124202..ad399f7
@@ -261,9 +261,9 @@ class AliAnalysisTaskSELc2V0bachelorTMVA : public AliAnalysisTaskSE
   TH1F* fHistoMCLcK0SpGenAcc;         //! histo with MC Lc --> K0S + p
   TH1F* fHistoMCLcK0SpGenLimAcc;      //! histo with MC Lc --> K0S + p
 
-  ULong64_t fTriggerMask;                        //! mask to the trigger word returned by the physics selection
+  ULong64_t fTriggerMask;                        // mask to the trigger word returned by the physics selection
        
-  ClassDef(AliAnalysisTaskSELc2V0bachelorTMVA, 7); // class for Lc->p K0
+  ClassDef(AliAnalysisTaskSELc2V0bachelorTMVA, 8); // class for Lc->p K0
 };
 
 #endif
diff --git a/PWGHF/vertexingHF/AliAnalysisTaskSELc2pK0sfromAODtracks.cxx b/PWGHF/vertexingHF/AliAnalysisTaskSELc2pK0sfromAODtracks.cxx
new file mode 100644 (file)
index 0000000..7bb2144
--- /dev/null
@@ -0,0 +1,1051 @@
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appeuear in the supporting documentation. The authors make no claims   *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//
+//
+//               Lc->pK0s analysis code
+//
+//  Input: AOD
+//  Output: TTree or THnSparse (mass vs pT vs Centrality)
+//
+//  Cuts:
+//  TTree: very loose cut
+//  THnSparse: One THnSparse is created per cut. One cut is specified by
+//  an array of bits, each bit corresponds to a cut in "Cut" function.
+//  Use "AddCutStream" function to add a cut. 
+//
+//-------------------------------------------------------------------------
+//
+//                 Authors: Y.S Watanabe(a)
+//  (a) CNS, the University of Tokyo
+//  Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
+//-------------------------------------------------------------------------
+
+#include <TSystem.h>
+#include <TParticle.h>
+#include <TParticlePDG.h>
+#include <TH1F.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include <THnSparse.h>
+#include <TLorentzVector.h>
+#include <TTree.h>
+#include "TROOT.h"
+#include <TDatabasePDG.h>
+#include <AliAnalysisDataSlot.h>
+#include <AliAnalysisDataContainer.h>
+#include "AliStack.h"
+#include "AliMCEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliAODMCHeader.h"
+#include "AliAODHandler.h"
+#include "AliLog.h"
+#include "AliExternalTrackParam.h"
+#include "AliAODVertex.h"
+#include "AliESDVertex.h"
+#include "AliAODRecoDecay.h"
+#include "AliAODRecoDecayHF.h"
+#include "AliAODRecoCascadeHF.h"
+#include "AliESDtrack.h"
+#include "AliAODTrack.h"
+#include "AliAODv0.h"
+#include "AliAODcascade.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisTaskSELc2pK0sfromAODtracks.h"
+#include "AliPIDResponse.h"
+#include "AliPIDCombined.h"
+#include "AliTOFPIDResponse.h"
+#include "AliAODPidHF.h"
+#include "AliInputEventHandler.h"
+#include "AliESDtrackCuts.h"
+#include "AliNeutralTrackParam.h"
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+#include "AliExternalTrackParam.h"
+#include "AliESDtrack.h"
+#include "AliCentrality.h"
+#include "AliVertexerTracks.h"
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliAnalysisTaskSELc2pK0sfromAODtracks)
+
+//__________________________________________________________________________
+AliAnalysisTaskSELc2pK0sfromAODtracks::AliAnalysisTaskSELc2pK0sfromAODtracks() : 
+  AliAnalysisTaskSE(),
+  fUseMCInfo(kFALSE),
+  fOutput(0),
+  fOutputAll(0),
+  fListCuts(0),
+  fCEvents(0),
+  fHTrigger(0),
+  fHCentrality(0),
+  fProdCuts(0),
+  fAnalCuts(0),
+  fIsEventSelected(kFALSE),
+  fWriteVariableTree(kFALSE),
+  fVariablesTree(0),
+  fIspp(kFALSE),
+  fIspA(kFALSE),
+  fIsAA(kFALSE),
+  fIsMB(kFALSE),
+  fIsSemi(kFALSE),
+  fIsCent(kFALSE),
+  fIsINT7(kFALSE),
+  fIsEMC7(kFALSE),
+  fCandidateVariables(),
+  fVtx1(0),
+  fV1(0),
+  fBzkG(0),
+  fCentrality(0),
+  fTriggerCheck(0),
+  fHistoLcK0SpMass(),
+  fHistoBachPt(0),
+  fHistod0Bach(0),
+  fHistod0V0(0),
+  fHistod0d0(0),
+  fHistoV0CosPA(0),
+  fHistoProbProton(0),
+  fHistoDecayLength(0),
+  fHistoK0SMass(0)
+{
+  //
+  // Default Constructor. 
+  //
+}
+
+//___________________________________________________________________________
+AliAnalysisTaskSELc2pK0sfromAODtracks::AliAnalysisTaskSELc2pK0sfromAODtracks(const Char_t* name,
+                                                                            AliRDHFCutsLctopK0sfromAODtracks* prodCuts, 
+                                                                            AliRDHFCutsLctopK0sfromAODtracks* analCuts, 
+                                                                            Bool_t writeVariableTree) :
+  AliAnalysisTaskSE(name),
+  fUseMCInfo(kFALSE),
+  fOutput(0),
+  fOutputAll(0),
+  fListCuts(0),
+  fCEvents(0),
+  fHTrigger(0),
+  fHCentrality(0),
+  fProdCuts(prodCuts),
+  fAnalCuts(analCuts),
+  fIsEventSelected(kFALSE),
+  fWriteVariableTree(writeVariableTree),
+  fVariablesTree(0),
+  fIspp(kFALSE),
+  fIspA(kFALSE),
+  fIsAA(kFALSE),
+  fIsMB(kFALSE),
+  fIsSemi(kFALSE),
+  fIsCent(kFALSE),
+  fIsINT7(kFALSE),
+  fIsEMC7(kFALSE),
+  fCandidateVariables(),
+  fVtx1(0),
+  fV1(0),
+  fBzkG(0),
+  fCentrality(0),
+  fTriggerCheck(0),
+  fHistoLcK0SpMass(),
+  fHistoBachPt(0),
+  fHistod0Bach(0),
+  fHistod0V0(0),
+  fHistod0d0(0),
+  fHistoV0CosPA(0),
+  fHistoProbProton(0),
+  fHistoDecayLength(0),
+  fHistoK0SMass(0)
+{
+  //
+  // Constructor. Initialization of Inputs and Outputs
+  //
+  Info("AliAnalysisTaskSELc2pK0sfromAODtracks","Calling Constructor");
+
+  DefineOutput(1,TList::Class());  //conters
+  DefineOutput(2,TList::Class());
+  if(writeVariableTree){
+    DefineOutput(3,TTree::Class());  //My private output
+  }else{
+    DefineOutput(3,TList::Class());  //conters
+  }
+}
+
+//___________________________________________________________________________
+AliAnalysisTaskSELc2pK0sfromAODtracks::~AliAnalysisTaskSELc2pK0sfromAODtracks() {
+  //
+  // destructor
+  //
+  Info("~AliAnalysisTaskSELc2pK0sfromAODtracks","Calling Destructor");
+
+  if (fOutput) {
+    delete fOutput;
+    fOutput = 0;
+  }
+
+  if (fOutputAll) {
+    delete fOutputAll;
+    fOutputAll = 0;
+  }
+
+  if (fListCuts) {
+    delete fListCuts;
+    fListCuts = 0;
+  }
+
+
+  if (fProdCuts) {
+    delete fProdCuts;
+    fProdCuts = 0;
+  }
+
+  if (fAnalCuts) {
+    delete fAnalCuts;
+    fAnalCuts = 0;
+  }
+
+  if (fVariablesTree) {
+    delete fVariablesTree;
+    fVariablesTree = 0;
+  }
+
+}
+
+//_________________________________________________
+void AliAnalysisTaskSELc2pK0sfromAODtracks::Init() {
+  //
+  // Initialization
+  //
+  //
+
+  fIsEventSelected=kFALSE;
+
+  if (fDebug > 1) AliInfo("Init");
+
+  fListCuts = new TList();
+  fListCuts->SetOwner();
+  fListCuts->SetName("ListCuts");
+  fListCuts->Add(new AliRDHFCutsLctopK0sfromAODtracks(*fProdCuts));
+  fListCuts->Add(new AliRDHFCutsLctopK0sfromAODtracks(*fAnalCuts));
+  PostData(2,fListCuts);
+
+  return;
+}
+
+//_________________________________________________
+void AliAnalysisTaskSELc2pK0sfromAODtracks::UserExec(Option_t *)
+{
+  //
+  // UserExec
+  //
+
+  if (!fInputEvent) {
+    AliError("NO EVENT FOUND!");
+    return;
+  }
+  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
+
+  fCEvents->Fill(1);
+
+  //------------------------------------------------
+  // First check if the event has proper vertex and B
+  //------------------------------------------------
+       
+  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
+  if (!fVtx1) return;
+
+  Double_t pos[3],cov[6];
+  fVtx1->GetXYZ(pos);
+  fVtx1->GetCovarianceMatrix(cov);
+  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
+
+  fBzkG = (Double_t)aodEvent->GetMagneticField(); 
+  AliKFParticle::SetField(fBzkG);
+  if (TMath::Abs(fBzkG)<0.001) {
+    delete fV1;
+    return;
+  }
+  fCEvents->Fill(2);
+
+  //------------------------------------------------
+  // Event selection setting
+  //------------------------------------------------
+  if (fUseMCInfo)
+    fAnalCuts->SetTriggerClass("");
+
+  if ( !fUseMCInfo && fIspp) {
+    fAnalCuts->SetUsePhysicsSelection(kTRUE);
+    fAnalCuts->SetTriggerClass("");
+    fAnalCuts->SetTriggerMask(AliVEvent::kMB);
+  }
+
+  if ( !fUseMCInfo && fIspA) {
+    fAnalCuts->SetUsePhysicsSelection(kTRUE);
+    fAnalCuts->SetTriggerClass("");
+    fAnalCuts->SetTriggerMask(AliVEvent::kINT7);
+  }
+  if ( !fUseMCInfo && fIsAA) {
+    fAnalCuts->SetUsePhysicsSelection(kTRUE);
+    fAnalCuts->SetTriggerClass("");
+    fAnalCuts->SetTriggerMask(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral);
+  }
+
+  //------------------------------------------------
+  // Event selection 
+  //------------------------------------------------
+  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
+  if(!fIsTriggerNotOK) fCEvents->Fill(3);
+  fIsEventSelected = fAnalCuts->IsEventSelected(aodEvent); // better to initialize before CheckEventSelection call
+  if(!fIsEventSelected) {
+    delete fV1;
+    return;
+  }
+  fCEvents->Fill(4);
+
+  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
+  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
+  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral); 
+  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);  
+  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);   
+  fTriggerCheck = fIsMB+2*fIsSemi+4*fIsCent+8*fIsINT7+16*fIsEMC7;
+  if(fIsMB) fHTrigger->Fill(1);
+  if(fIsSemi) fHTrigger->Fill(2);
+  if(fIsCent) fHTrigger->Fill(3);
+  if(fIsINT7) fHTrigger->Fill(4);
+  if(fIsEMC7) fHTrigger->Fill(5);
+  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
+  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
+  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
+  if(fIsMB&fIsCent) fHTrigger->Fill(11);
+  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
+
+  if ( !fUseMCInfo && (fIsAA || fIspA)) {
+    AliCentrality *cent = aodEvent->GetCentrality();
+    fCentrality = cent->GetCentralityPercentile("V0M");
+  }
+  fHCentrality->Fill(fCentrality);
+
+  //------------------------------------------------
+  // Check if the event has v0 candidate
+  //------------------------------------------------
+  //Int_t nv0 = aodEvent->GetNumberOfV0s();
+  fCEvents->Fill(5);
+
+  //------------------------------------------------
+  // MC analysis setting
+  //------------------------------------------------
+  //  TClonesArray *mcArray = 0;
+  //  AliAODMCHeader *mcHeader=0;
+  //  if (fUseMCInfo) {
+  //    // MC array need for maching
+  //    mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+  //    if (!mcArray) {
+  //      AliError("Could not find Monte-Carlo in AOD");
+  //      return;
+  //    }
+  //    fCEvents->Fill(6); // in case of MC events
+  //
+  //    // load MC header
+  //    mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
+  //    if (!mcHeader) {
+  //      AliError("AliAnalysisTaskSELc2pK0sfromAODtracks::UserExec: MC header branch not found!\n");
+  //      return;
+  //    }
+  //    fCEvents->Fill(7); // in case of MC events
+  //
+  //    Double_t zMCVertex = mcHeader->GetVtxZ();
+  //    if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
+  //      AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
+  //      return;
+  //    } else {
+  //      fCEvents->Fill(17); // in case of MC events
+  //    }
+  //   }
+
+  //------------------------------------------------
+  // Main analysis done in this function
+  //------------------------------------------------
+  MakeAnalysis(aodEvent);
+
+
+  PostData(1,fOutput);
+  if(fWriteVariableTree){
+    PostData(3,fVariablesTree);
+  }else{
+    PostData(3,fOutputAll);
+  }
+
+  fIsEventSelected=kFALSE;
+
+  delete fV1;
+  return;
+}
+
+//________________________________________ terminate ___________________________
+void AliAnalysisTaskSELc2pK0sfromAODtracks::Terminate(Option_t*)
+{    
+  // The Terminate() function is the last function to be called during
+  // a query. It always runs on the client, it can be used to present
+  // the results graphically or save the results to file.
+  
+  //AliInfo("Terminate","");
+  AliAnalysisTaskSE::Terminate();
+  
+  fOutput = dynamic_cast<TList*> (GetOutputData(1));
+  if (!fOutput) {     
+    AliError("fOutput not available");
+    return;
+  }
+
+  if(!fWriteVariableTree){
+    fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
+    if (!fOutputAll) {     
+      AliError("fOutputAll not available");
+      return;
+    }
+  }
+
+  return;
+}
+
+//___________________________________________________________________________
+void AliAnalysisTaskSELc2pK0sfromAODtracks::UserCreateOutputObjects() 
+{ 
+  //
+  // UserCreateOutputObject
+  //
+  //AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
+
+  //------------------------------------------------
+  // output object setting
+  //------------------------------------------------
+  fOutput = new TList();
+  fOutput->SetOwner();
+  fOutput->SetName("chist0");
+  DefineGeneralHistograms(); // define general histograms
+  PostData(1,fOutput);
+
+  DefineTreeVariables();
+  if (fWriteVariableTree) {
+    PostData(3,fVariablesTree);
+  }else{
+    fOutputAll = new TList();
+    fOutputAll->SetOwner();
+    fOutputAll->SetName("anahisto");
+    DefineAnalysisHistograms(); // define general histograms
+    PostData(3,fOutputAll);
+  }
+
+
+  return;
+}
+
+//-------------------------------------------------------------------------------
+void AliAnalysisTaskSELc2pK0sfromAODtracks::MakeAnalysis
+(
+ AliAODEvent *aodEvent
+ )
+{
+  //
+  // Main Analysis part
+  //
+
+  Int_t nV0s= aodEvent->GetNumberOfV0s();
+  if (nV0s==0) {
+    return;
+  }
+  Int_t nTracks= aodEvent->GetNumberOfTracks();
+  if (nTracks==0) {
+    return;
+  }
+
+  //------------------------------------------------
+  // V0 loop 
+  //------------------------------------------------
+  for (Int_t iv0 = 0; iv0<nV0s; iv0++) {
+    AliAODv0 *v0 = aodEvent->GetV0(iv0);
+    if(!v0) continue;
+    if(!fProdCuts->SingleV0Cuts(v0,fVtx1)) continue;
+
+    AliAODTrack *cptrack =  (AliAODTrack*)(v0->GetDaughter(0));
+    AliAODTrack *cntrack =  (AliAODTrack*)(v0->GetDaughter(1));
+
+    //------------------------------------------------
+    // track loop 
+    //------------------------------------------------
+    for (Int_t itrk = 0; itrk<nTracks; itrk++) {
+      AliAODTrack *trk = (AliAODTrack*)aodEvent->GetTrack(itrk);
+      if(trk->GetID()<0) continue;
+      if(!fProdCuts->SingleTrkCuts(trk)) continue;
+
+      Int_t cpid = cptrack->GetID();
+      Int_t cnid = cntrack->GetID();
+      Int_t lpid = trk->GetID();
+      if((cpid==lpid)||(cnid==lpid)) continue;
+
+      if(!fProdCuts->SelectWithRoughCuts(v0,trk)) continue;
+
+      AliAODVertex *secVert = ReconstructSecondaryVertex(v0,trk,aodEvent);
+      if(!secVert) continue;
+
+      AliAODRecoCascadeHF *lcobj = MakeCascadeHF(v0,trk,aodEvent,secVert);
+      if(!lcobj) {
+       continue;
+      }
+
+      FillROOTObjects(lcobj);
+
+      lcobj->GetSecondaryVtx()->RemoveDaughters();
+      lcobj->UnsetOwnPrimaryVtx();
+      delete lcobj;lcobj=NULL;
+      delete secVert;
+    }
+  }
+
+}
+
+////-------------------------------------------------------------------------------
+void AliAnalysisTaskSELc2pK0sfromAODtracks::FillROOTObjects(AliAODRecoCascadeHF *lcobj) 
+{
+  //
+  // Fill histograms or tree depending on fWriteVariableTree 
+  //
+
+  AliAODTrack *trk = lcobj->GetBachelor();
+  AliAODv0 *v0 = lcobj->Getv0();
+
+  fCandidateVariables[ 0] = lcobj->InvMassLctoK0sP();
+  fCandidateVariables[ 1] = lcobj->Px();
+  fCandidateVariables[ 2] = lcobj->Py();
+  fCandidateVariables[ 3] = lcobj->Pz();
+  fCandidateVariables[ 4] = v0->MassK0Short();
+  fCandidateVariables[ 5] = lcobj->PxProng(0);
+  fCandidateVariables[ 6] = lcobj->PyProng(0);
+  fCandidateVariables[ 7] = lcobj->PzProng(0);
+  fCandidateVariables[ 8] = lcobj->PxProng(1);
+  fCandidateVariables[ 9] = lcobj->PyProng(1);
+  fCandidateVariables[10] = lcobj->PzProng(1);
+  fCandidateVariables[11] = fVtx1->GetX();
+  fCandidateVariables[12] = fVtx1->GetY();
+  fCandidateVariables[13] = fVtx1->GetZ();
+  fCandidateVariables[14] = fCentrality;
+  fCandidateVariables[15] = lcobj->DecayLengthXY();
+
+  Double_t nSigmaTPCpr=-9999.;
+  Double_t nSigmaTOFpr=-9999.;
+  Double_t probProton=-9999.;
+  if(fAnalCuts->GetIsUsePID())
+    {
+      fAnalCuts->GetPidHF()->GetnSigmaTPC(trk,4,nSigmaTPCpr);
+      fAnalCuts->GetPidHF()->GetnSigmaTOF(trk,4,nSigmaTOFpr);
+      probProton = fAnalCuts->GetProtonProbabilityTPCTOF(trk);
+      fCandidateVariables[16] = nSigmaTPCpr;
+      fCandidateVariables[17] = nSigmaTOFpr;
+      fCandidateVariables[18] = probProton;
+    }
+
+  if(fWriteVariableTree)
+    fVariablesTree->Fill();
+  else{
+    for(Int_t ic=0;ic < fAnalCuts->GetNCutsArray(); ic++)
+      {
+       fAnalCuts->SetCutsFromArray(ic);
+       if(fAnalCuts->IsSelected(lcobj,AliRDHFCuts::kCandidate))
+         {
+           Double_t cont[3];
+           cont[0] = lcobj->InvMassLctoK0sP();
+           cont[1] = lcobj->Pt();
+           cont[2] = fCentrality;
+           fHistoLcK0SpMass[ic]->Fill(cont);
+         }
+      }
+    fHistoBachPt->Fill(trk->Pt());
+    fHistod0Bach->Fill(lcobj->Getd0Prong(0));
+    fHistod0V0->Fill(lcobj->Getd0Prong(1));
+    fHistod0d0->Fill(lcobj->Getd0Prong(0)*lcobj->Getd0Prong(1));
+    fHistoV0CosPA->Fill(lcobj->CosV0PointingAngle());
+    fHistoProbProton->Fill(probProton);
+    fHistoDecayLength->Fill(lcobj->DecayLengthXY());
+    fHistoK0SMass->Fill(v0->MassK0Short());
+  }
+  return;
+}
+
+////-------------------------------------------------------------------------------
+void AliAnalysisTaskSELc2pK0sfromAODtracks::DefineTreeVariables() 
+{
+  //
+  // Define tree variables
+  //
+
+  const char* nameoutput = GetOutputSlot(3)->GetContainer()->GetName();
+  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
+  Int_t nVar = 19;
+  fCandidateVariables = new Float_t [nVar];
+  TString * fCandidateVariableNames = new TString[nVar];
+
+  fCandidateVariableNames[ 0]="InvMassLc2pK0s";
+  fCandidateVariableNames[ 1]="LcPx";
+  fCandidateVariableNames[ 2]="LcPy";
+  fCandidateVariableNames[ 3]="LcPz";
+  fCandidateVariableNames[ 4]="massK0Short";
+  fCandidateVariableNames[ 5]="V0Px";
+  fCandidateVariableNames[ 6]="V0Py";
+  fCandidateVariableNames[ 7]="V0Pz";
+  fCandidateVariableNames[ 8]="BachPx";
+  fCandidateVariableNames[ 9]="BachPy";
+  fCandidateVariableNames[10]="BachPz";
+  fCandidateVariableNames[11]="PrimVertx";
+  fCandidateVariableNames[12]="PrimVerty";
+  fCandidateVariableNames[13]="PrimVertz";
+  fCandidateVariableNames[14]="Centrality";
+  fCandidateVariableNames[15]="DecayLengthXY";
+  fCandidateVariableNames[16]="nSigmaTPCpr";
+  fCandidateVariableNames[17]="nSigmaTOFpr";
+  fCandidateVariableNames[18]="probProton";
+
+  for (Int_t ivar=0; ivar<nVar; ivar++) {
+    fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
+  }
+
+  return;
+}
+
+////__________________________________________________________________________
+void  AliAnalysisTaskSELc2pK0sfromAODtracks::DefineGeneralHistograms() {
+  //
+  // This is to define general histograms
+  //
+
+  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
+  fCEvents->SetStats(kTRUE);
+  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
+  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
+  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
+  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
+  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
+  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
+  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
+  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
+  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
+  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
+  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
+  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
+  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
+  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
+  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
+  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
+  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
+  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
+  //fCEvents->GetXaxis()->SetTitle("");
+  fCEvents->GetYaxis()->SetTitle("counts");
+
+  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
+  fHTrigger->SetStats(kTRUE);
+  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
+  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
+  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
+  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
+  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
+  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
+  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
+
+  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
+
+  fOutput->Add(fCEvents);
+  fOutput->Add(fHTrigger);
+  fOutput->Add(fHCentrality);
+
+  return;
+}
+//__________________________________________________________________________
+void  AliAnalysisTaskSELc2pK0sfromAODtracks::DefineAnalysisHistograms() 
+{
+  //
+  // Define analyis histograms
+  //
+       
+  //------------------------------------------------
+  // Basic histogram
+  //------------------------------------------------
+  Int_t bins_base[3]=          {80                             ,20             ,10};
+  Double_t xmin_base[3]={2.286-0.2,0           ,0.00};
+  Double_t xmax_base[3]={2.286+0.2,20. ,100};
+
+  for(Int_t i=0;i<fAnalCuts->GetNCutsArray();i++)
+    {
+      fHistoLcK0SpMass.push_back(new THnSparseF(Form("fHistoLcK0SpMass_Cut%d",i),Form("Cut%d",i),3,bins_base,xmin_base,xmax_base));
+      fOutputAll->Add(fHistoLcK0SpMass[i]);
+    }
+
+  //------------------------------------------------
+  // checking histograms
+  //------------------------------------------------
+  fHistoBachPt = new TH1F("fHistoBachPt","Bachelor p_{T}",100,0.0,5.0);
+  fOutputAll->Add(fHistoBachPt);
+  fHistod0Bach = new TH1F("fHistod0Bach","Bachelor d_{0}",100,-0.5,0.5);
+  fOutputAll->Add(fHistod0Bach);
+  fHistod0V0 = new TH1F("fHistod0V0","V_{0} d_{0}",100,-0.5,0.5);
+  fOutputAll->Add(fHistod0V0);
+  fHistod0d0 = new TH1F("fHistod0d0","d_{0} d_{0}",100,-0.5,0.5);
+  fOutputAll->Add(fHistod0d0);
+  fHistoV0CosPA=new TH1F("fHistoV0CosPA","V0->Second vertex cospa",100,-1.,1.0);
+  fOutputAll->Add(fHistoV0CosPA);
+  fHistoProbProton=new TH1F("fHistoProbProton","ProbProton",100,0.,1.0);
+  fOutputAll->Add(fHistoProbProton);
+  fHistoDecayLength=new TH1F("fHistoDecayLength","Decay Length",100,-0.1,0.1);
+  fOutputAll->Add(fHistoDecayLength);
+  fHistoK0SMass=new TH1F("fHistoK0SMass","K0S mass",100,0.497-0.05,0.497+0.05);
+  fOutputAll->Add(fHistoK0SMass);
+
+  return;
+}
+
+//________________________________________________________________________
+AliAODRecoCascadeHF* AliAnalysisTaskSELc2pK0sfromAODtracks::MakeCascadeHF(AliAODv0 *v0, AliAODTrack *part, AliAODEvent * aod, AliAODVertex *secVert) 
+{
+  //
+  // Create AliAODRecoCascadeHF object from the argument
+  //
+
+  if(!v0) return 0x0;
+  if(!part) return 0x0;
+  if(!aod) return 0x0;
+
+  //------------------------------------------------
+  // PrimaryVertex
+  //------------------------------------------------
+  AliAODVertex *primVertexAOD;
+  Bool_t unsetvtx = kFALSE;
+  if(fIspp){
+    primVertexAOD = CallPrimaryVertex(v0,part,aod);
+    if(!primVertexAOD){
+      primVertexAOD = fVtx1;
+    }else{
+      unsetvtx = kTRUE;
+    }
+  }else{
+    primVertexAOD = fVtx1;
+  }
+  if(!primVertexAOD) return 0x0;
+  Double_t posprim[3]; primVertexAOD->GetXYZ(posprim);
+
+  //------------------------------------------------
+  // DCA between tracks
+  //------------------------------------------------
+  AliESDtrack *esdtrack = new AliESDtrack((AliVTrack*)part);
+
+  AliNeutralTrackParam *trackV0=NULL;
+  const AliVTrack *trackVV0 = dynamic_cast<const AliVTrack*>(v0);
+  if(trackVV0)  trackV0 = new AliNeutralTrackParam(trackVV0);
+
+  Double_t xdummy, ydummy;
+  Double_t dca = esdtrack->GetDCA(trackV0,fBzkG,xdummy,ydummy);
+
+
+  //------------------------------------------------
+  // Propagate all tracks to the secondary vertex and calculate momentum there
+  //------------------------------------------------
+       
+  Double_t d0z0bach[2],covd0z0bach[3];
+  if(sqrt(pow(secVert->GetX(),2)+pow(secVert->GetY(),2))<1.){
+    part->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
+    trackV0->PropagateToDCA(secVert,fBzkG,kVeryBig);
+  }else{
+    part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
+    trackV0->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
+  }
+  Double_t momv0_new[3]={-9999,-9999,-9999.};
+  trackV0->GetPxPyPz(momv0_new);
+
+  Double_t px[2],py[2],pz[2];
+  px[0] = part->Px(); py[0] = part->Py(); pz[0] = part->Pz(); 
+  px[1] = momv0_new[0]; py[1] = momv0_new[1]; pz[1] = momv0_new[2]; 
+
+  //------------------------------------------------
+  // d0
+  //------------------------------------------------
+  Double_t d0[3],d0err[3];
+
+  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
+  d0[0]= d0z0bach[0];
+  d0err[0] = TMath::Sqrt(covd0z0bach[0]);
+
+  Double_t d0z0v0[2],covd0z0v0[3];
+  trackV0->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0v0,covd0z0v0);
+  d0[1]= d0z0v0[0];
+  d0err[1] = TMath::Sqrt(covd0z0v0[0]);
+
+  //------------------------------------------------
+  // Create AliAODRecoCascadeHF
+  //------------------------------------------------
+  Short_t charge = part->Charge();
+  AliAODRecoCascadeHF *theCascade = new AliAODRecoCascadeHF(secVert,charge,px,py,pz,d0,d0err,dca);
+  if(!theCascade)  
+    {
+      if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
+      if(esdtrack) delete esdtrack;
+      if(trackV0) delete trackV0;
+      return 0x0;
+    }
+  theCascade->SetOwnPrimaryVtx(primVertexAOD);
+  UShort_t id[2]={(UShort_t)part->GetID(),(UShort_t)trackV0->GetID()};
+  theCascade->SetProngIDs(2,id);
+
+  theCascade->GetSecondaryVtx()->AddDaughter(part);
+  theCascade->GetSecondaryVtx()->AddDaughter(v0);
+
+  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
+  if(esdtrack) delete esdtrack;
+  if(trackV0) delete trackV0;
+
+  return theCascade;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSELc2pK0sfromAODtracks::CallPrimaryVertex(AliAODv0 *v0, AliAODTrack *trk, AliAODEvent* aod)
+{
+  //
+  // Make an array of tracks which should not be used in primary vertex calculation and 
+  // Call PrimaryVertex function
+  //
+
+  TObjArray *TrackArray = new TObjArray(3);
+  
+  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk);
+  TrackArray->AddAt(cptrk1,0);
+  
+  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)v0->GetDaughter(0));
+  TrackArray->AddAt(cascptrack,1);
+  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)v0->GetDaughter(1));
+  TrackArray->AddAt(cascntrack,2);
+  
+  AliAODVertex *newvert  = PrimaryVertex(TrackArray,aod);
+  
+  for(Int_t i=0;i<3;i++)
+    {
+      AliESDtrack *tesd = (AliESDtrack*)TrackArray->UncheckedAt(i);
+      delete tesd;
+    }
+  TrackArray->Clear();
+  delete TrackArray;
+  
+  return newvert;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSELc2pK0sfromAODtracks::PrimaryVertex(const TObjArray *trkArray,
+                                                                  AliVEvent *event)
+{
+  //
+  //Used only for pp
+  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
+  //
+
+  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
+  Bool_t fRmTrksFromPrimVtx = kFALSE;
+
+  AliESDVertex *vertexESD = 0;
+  AliAODVertex *vertexAOD = 0;
+  
+  //vertexESD = new AliESDVertex(*fV1);
+  
+
+  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) { 
+    // primary vertex from the input event
+    
+    vertexESD = new AliESDVertex(*fV1);
+    
+  } else {
+    // primary vertex specific to this candidate
+    
+    Int_t nTrks = trkArray->GetEntriesFast();
+    AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
+    
+    if(fRecoPrimVtxSkippingTrks) { 
+      // recalculating the vertex
+      
+      if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
+       Float_t diamondcovxy[3];
+       event->GetDiamondCovXY(diamondcovxy);
+       Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
+       Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
+       AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
+       vertexer->SetVtxStart(diamond);
+       delete diamond; diamond=NULL;
+       if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter")) 
+         vertexer->SetOnlyFitter();
+      }
+      Int_t skipped[1000];
+      Int_t nTrksToSkip=0,id;
+      AliExternalTrackParam *t = 0;
+      for(Int_t i=0; i<nTrks; i++) {
+       t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
+       id = (Int_t)t->GetID();
+       if(id<0) continue;
+       skipped[nTrksToSkip++] = id;
+      }
+      // TEMPORARY FIX
+      // For AOD, skip also tracks without covariance matrix
+      Double_t covtest[21];
+      for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
+       AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
+       if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
+         id = (Int_t)vtrack->GetID();
+         if(id<0) continue;
+         skipped[nTrksToSkip++] = id;
+       }
+      }
+      for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
+      //
+      vertexer->SetSkipTracks(nTrksToSkip,skipped);
+      vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event); 
+      
+    } else if(fRmTrksFromPrimVtx && nTrks>0) { 
+      // removing the prongs tracks
+      
+      TObjArray rmArray(nTrks);
+      UShort_t *rmId = new UShort_t[nTrks];
+      AliESDtrack *esdTrack = 0;
+      AliESDtrack *t = 0;
+      for(Int_t i=0; i<nTrks; i++) {
+       t = (AliESDtrack*)trkArray->UncheckedAt(i);
+       esdTrack = new AliESDtrack(*t);
+       rmArray.AddLast(esdTrack);
+       if(esdTrack->GetID()>=0) {
+         rmId[i]=(UShort_t)esdTrack->GetID();
+       } else {
+         rmId[i]=9999;
+       }
+      }
+      Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
+      vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
+      delete [] rmId; rmId=NULL;
+      rmArray.Delete();
+      
+    }
+    
+    delete vertexer; vertexer=NULL;
+    if(!vertexESD) return vertexAOD;
+    if(vertexESD->GetNContributors()<=0) { 
+      //AliDebug(2,"vertexing failed"); 
+      delete vertexESD; vertexESD=NULL;
+      return vertexAOD;
+    }
+    
+    
+  }
+  
+  // convert to AliAODVertex
+  Double_t pos[3],cov[6],chi2perNDF;
+  vertexESD->GetXYZ(pos); // position
+  vertexESD->GetCovMatrix(cov); //covariance matrix
+  chi2perNDF = vertexESD->GetChi2toNDF();
+  delete vertexESD; vertexESD=NULL;
+  
+  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
+  
+  return vertexAOD;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSELc2pK0sfromAODtracks::ReconstructSecondaryVertex(AliAODv0 *v0, AliAODTrack *part, AliAODEvent * aod) 
+{
+  //
+  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
+  //
+  //------------------------------------------------
+  // PrimaryVertex
+  //------------------------------------------------
+  AliAODVertex *primVertexAOD;
+  Bool_t unsetvtx = kFALSE;
+  if(fIspp){
+    primVertexAOD = CallPrimaryVertex(v0,part,aod);
+    if(!primVertexAOD){
+      primVertexAOD = fVtx1;
+    }else{
+      unsetvtx = kTRUE;
+    }
+  }else{
+    primVertexAOD = fVtx1;
+  }
+  if(!primVertexAOD) return 0x0;
+
+  //------------------------------------------------
+  // Secondary vertex
+  //------------------------------------------------
+
+  Double_t LcPx = part->Px()+v0->Px();
+  Double_t LcPy = part->Py()+v0->Py();
+  Double_t LcPt = TMath::Sqrt(LcPx*LcPx+LcPy*LcPy);
+
+  Double_t d0z0[2],covd0z0[3];
+  part->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
+  Double_t x0 = primVertexAOD->GetX();
+  Double_t y0 = primVertexAOD->GetY();
+  Double_t px0 = LcPx/LcPt;
+  Double_t py0 = LcPy/LcPt;
+  Double_t tx[3];
+  part->GetXYZ(tx);
+  Double_t x1 = tx[0];
+  Double_t y1 = tx[1];
+  part->GetPxPyPz(tx);
+  Double_t px1 = tx[0];
+  Double_t py1 = tx[1];
+  Double_t pt1 = sqrt(px1*px1+py1*py1);
+  px1 = px1/pt1;
+  py1 = py1/pt1;
+
+  Double_t dx = x0 - x1;
+  Double_t dy = y0 - y1;
+
+  Double_t Delta = -px0*py1+py0*px1;
+  Double_t a0 = -9999.;
+  if(Delta!=0)
+    {
+      a0 = 1./Delta * (py1 * dx - px1 * dy);
+    }
+  Double_t neovertx = x0 + a0 * px0;
+  Double_t neoverty = y0 + a0 * py0;
+  Double_t z0 = primVertexAOD->GetZ();
+  Double_t neovertz = z0 + TMath::Abs(a0)*part->Pz()/part->Pt();
+
+  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
+
+  Double_t pos[3],cov[6],chi2perNDF;
+  pos[0]=neovertx;
+  pos[1]=neoverty;
+  pos[2]=neovertz;
+  cov[0]=0.0;
+  cov[1]=0.0;
+  cov[2]=0.0;
+  cov[3]=0.0;
+  cov[4]=0.0;
+  cov[5]=0.0;
+  chi2perNDF=0.0;
+  AliAODVertex *secVert = new AliAODVertex(pos,cov,chi2perNDF);
+  if(!secVert){
+    return 0x0;
+  }
+  return secVert;
+}
diff --git a/PWGHF/vertexingHF/AliAnalysisTaskSELc2pK0sfromAODtracks.h b/PWGHF/vertexingHF/AliAnalysisTaskSELc2pK0sfromAODtracks.h
new file mode 100644 (file)
index 0000000..8e816de
--- /dev/null
@@ -0,0 +1,123 @@
+#ifndef ALIANALYSISTASKSELC2PK0SFROMAODTRACKS_H
+#define ALIANALYSISTASKSELC2PK0SFROMAODTRACKS_H
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */ 
+
+#include "TROOT.h"
+#include "TSystem.h"
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAODEvent.h"
+#include "AliPID.h"
+#include "AliRDHFCutsLctopK0sfromAODtracks.h"
+
+class THnSparse;
+class TH1F;
+class TClonesArray;
+class AliAODRecoCascadeHF;
+class AliESDVertex;
+
+class AliAnalysisTaskSELc2pK0sfromAODtracks : public AliAnalysisTaskSE 
+{
+ public:
+  AliAnalysisTaskSELc2pK0sfromAODtracks();
+  AliAnalysisTaskSELc2pK0sfromAODtracks(const Char_t* name, AliRDHFCutsLctopK0sfromAODtracks* cuts, AliRDHFCutsLctopK0sfromAODtracks* cuts2, Bool_t writeVariableTree=kTRUE);
+  virtual ~AliAnalysisTaskSELc2pK0sfromAODtracks();
+
+  // Implementation of interface methods  
+  virtual void UserCreateOutputObjects();
+  virtual void Init();
+  virtual void LocalInit() {Init();}
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *option);
+
+  void FillROOTObjects(AliAODRecoCascadeHF *lcobj);
+  void MakeAnalysis(AliAODEvent *aod);
+
+
+  // set MC usage
+  void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
+  Bool_t GetMC() const {return fUseMCInfo;}
+
+  void SetIspp(Bool_t a) { fIspp=a; }
+  Bool_t GetIspp() { return fIspp; }
+  void SetIspA(Bool_t a) { fIspA=a; }
+  Bool_t GetIspA() { return fIspA; }
+  void SetIsAA(Bool_t a) { fIsAA=a; }
+  Bool_t GetIsAA() { return fIsAA; }
+
+  AliAODRecoCascadeHF* MakeCascadeHF(AliAODv0 *casc, AliAODTrack *trk, AliAODEvent *aod, AliAODVertex *vert);
+  AliAODVertex* ReconstructSecondaryVertex(AliAODv0 *casc, AliAODTrack *trk, AliAODEvent *aod);
+
+
+ private:
+
+  AliAnalysisTaskSELc2pK0sfromAODtracks(const AliAnalysisTaskSELc2pK0sfromAODtracks &source);
+  AliAnalysisTaskSELc2pK0sfromAODtracks& operator=(const AliAnalysisTaskSELc2pK0sfromAODtracks& source); 
+
+  void DefineTreeVariables();
+  void DefineGeneralHistograms();
+  void DefineAnalysisHistograms();
+
+  AliAODVertex *CallPrimaryVertex(AliAODv0 *v0, AliAODTrack *trk, AliAODEvent *evt);
+  AliAODVertex* PrimaryVertex(const TObjArray *trkArray,AliVEvent *event);
+
+  Bool_t fUseMCInfo;                 // Use MC info
+  TList *fOutput;                    //! User output slot 1 // general histos
+  TList *fOutputAll;                 //! User Output slot 3  //analysis histograms 
+  TList *fListCuts;                  //! User output slot 2 // Cuts 
+  TH1F *fCEvents;                    //! Histogram to check selected events
+  TH1F *fHTrigger;                   //! Histogram to check Trigger
+  TH1F *fHCentrality;                //! Histogram to check Centrality
+  AliRDHFCutsLctopK0sfromAODtracks *fProdCuts;// Cuts - sent to output slot 2
+  AliRDHFCutsLctopK0sfromAODtracks *fAnalCuts;// Cuts - sent to output slot 2
+  Bool_t fIsEventSelected;          // flag for event selected
+  Bool_t    fWriteVariableTree;     // flag to decide whether to write the candidate variables on a tree variables
+  TTree    *fVariablesTree;         //! tree of the candidate variables after track selection on output slot 4
+  Bool_t fIspp;       //ispp event 
+  Bool_t fIspA;       //ispA event 
+  Bool_t fIsAA;       //isAA event 
+  Bool_t fIsMB;       //MB trigger event
+  Bool_t fIsSemi;     //SemiCentral trigger event
+  Bool_t fIsCent;     //Central trigger event
+  Bool_t fIsINT7;     //INT7 trigger event
+  Bool_t fIsEMC7;     //EMC7 trigger event
+  Float_t *fCandidateVariables;   //! variables to be written to the tree
+  AliAODVertex *fVtx1;            // primary vertex
+  AliESDVertex *fV1;              // primary vertex
+  Double_t fBzkG;                 // magnetic field value [kG]
+  Float_t  fCentrality;           //Centrality
+  Float_t  fTriggerCheck;         //Stores trigger information
+
+  //--------------------- My histograms ------------------
+  std::vector<THnSparse*> fHistoLcK0SpMass;         //Lc mass spectra
+
+  TH1F* fHistoBachPt;      //! Bachelor pT histogram
+  TH1F* fHistod0Bach;      //! Bachelor d0 histogram
+  TH1F* fHistod0V0;        //! V0 d0 histogram
+  TH1F* fHistod0d0;        //! Bachelor d0 * V0 d0 histogram
+  TH1F* fHistoV0CosPA;     //! V0 cosine pointing angle to primary vertex
+  TH1F* fHistoProbProton;  //! Probability to be proton histogram
+  TH1F* fHistoDecayLength; //! Decay length histogram
+  TH1F* fHistoK0SMass;     //! K0s mass histogram
+
+
+  ClassDef(AliAnalysisTaskSELc2pK0sfromAODtracks,1); // class for Lc->p K0
+};
+#endif
+
diff --git a/PWGHF/vertexingHF/AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.cxx b/PWGHF/vertexingHF/AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.cxx
new file mode 100644 (file)
index 0000000..b107b23
--- /dev/null
@@ -0,0 +1,1359 @@
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appeuear in the supporting documentation. The authors make no claims   *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//
+//
+//               XicPlus2XiPiPi analysis code
+//
+//  Input: AOD
+//  Output: TTree or THnSparse (mass vs pT vs Centrality)
+//
+//  Cuts:
+//  TTree: very loose cut
+//  THnSparse: One THnSparse is created per cut. One cut is specified by
+//  an array of bits, each bit corresponds to a cut in "Cut" function.
+//
+//-------------------------------------------------------------------------
+//
+//                 Authors: Y.S Watanabe(a)
+//  (a) CNS, the University of Tokyo
+//  Contatcs: wyosuke@cns.s.u-tokyo.ac.jp
+//-------------------------------------------------------------------------
+
+#include <TSystem.h>
+#include <TParticle.h>
+#include <TParticlePDG.h>
+#include <THnSparse.h>
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TLorentzVector.h>
+#include <TTree.h>
+#include "TROOT.h"
+#include <TDatabasePDG.h>
+#include <AliAnalysisDataSlot.h>
+#include <AliAnalysisDataContainer.h>
+#include "AliStack.h"
+#include "AliMCEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliAODMCHeader.h"
+#include "AliAODHandler.h"
+#include "AliLog.h"
+#include "AliExternalTrackParam.h"
+#include "AliAODVertex.h"
+#include "AliESDVertex.h"
+#include "AliAODRecoDecay.h"
+#include "AliAODRecoDecayHF.h"
+#include "AliAODRecoCascadeHF3Prong.h"
+#include "AliESDtrack.h"
+#include "AliAODTrack.h"
+#include "AliAODv0.h"
+#include "AliAODcascade.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.h"
+#include "AliPIDResponse.h"
+#include "AliPIDCombined.h"
+#include "AliAODPidHF.h"
+#include "AliInputEventHandler.h"
+#include "AliESDtrackCuts.h"
+#include "AliNeutralTrackParam.h"
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+#include "AliExternalTrackParam.h"
+#include "AliCentrality.h"
+#include "AliVertexerTracks.h"
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks)
+
+//__________________________________________________________________________
+AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks() : 
+  AliAnalysisTaskSE(),
+  fUseMCInfo(kFALSE),
+  fOutput(0),
+  fOutputAll(0),
+  fListCuts(0),
+  fCEvents(0),
+  fHTrigger(0),
+  fHCentrality(0),
+  fProdCuts(0),
+  fAnalCuts(0),
+  fIsEventSelected(kFALSE),
+  fWriteVariableTree(kFALSE),
+  fVariablesTree(0),
+  fIspp(kFALSE),
+  fIspA(kFALSE),
+  fIsAA(kFALSE),
+  fIsMB(kFALSE),
+  fIsSemi(kFALSE),
+  fIsCent(kFALSE),
+  fIsINT7(kFALSE),
+  fIsEMC7(kFALSE),
+  fCandidateVariables(),
+  fVtx1(0),
+  fV1(0),
+  fBzkG(0),
+  fCentrality(0),
+  fTriggerCheck(0),
+  fHistoXicMass(),
+  fHistoDcaPi1Pi2(0),
+  fHistoDcaPiCasc(0),
+  fHistoLikeDecayLength(0),
+  fHistoLikeDecayLengthXY(0),
+  fHistoXicCosPAXY(0),
+  fHistoXiMass(0),
+  fHistoCascDcaXiDaughters(0),
+  fHistoCascDcaV0Daughters(0),
+  fHistoCascDcaV0ToPrimVertex(0),
+  fHistoCascDcaPosToPrimVertex(0),
+  fHistoCascDcaNegToPrimVertex(0),
+  fHistoCascDcaBachToPrimVertex(0),
+  fHistoCascCosPAXiPrim(0),
+  fHistoXiPt(0),
+  fHistoPiPt(0),
+  fHistoPid0(0),
+  fHistonSigmaTPCpi(0),
+  fHistonSigmaTOFpi(0),
+  fHistoProbPion(0)
+{
+  //
+  // Default Constructor. 
+  //
+}
+
+//___________________________________________________________________________
+AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks(const Char_t* name,
+                                                                                          AliRDHFCutsXicPlustoXiPiPifromAODtracks* prodCuts,
+                                                                                          AliRDHFCutsXicPlustoXiPiPifromAODtracks* analCuts, 
+                                                                                          Bool_t writeVariableTree) :
+  AliAnalysisTaskSE(name),
+  fUseMCInfo(kFALSE),
+  fOutput(0),
+  fOutputAll(0),
+  fListCuts(0),
+  fCEvents(0),
+  fHTrigger(0),
+  fHCentrality(0),
+  fProdCuts(prodCuts),
+  fAnalCuts(analCuts),
+  fIsEventSelected(kFALSE),
+  fWriteVariableTree(writeVariableTree),
+  fVariablesTree(0),
+  fIspp(kFALSE),
+  fIspA(kFALSE),
+  fIsAA(kFALSE),
+  fIsMB(kFALSE),
+  fIsSemi(kFALSE),
+  fIsCent(kFALSE),
+  fIsINT7(kFALSE),
+  fIsEMC7(kFALSE),
+  fCandidateVariables(),
+  fVtx1(0),
+  fV1(0),
+  fBzkG(0),
+  fCentrality(0),
+  fTriggerCheck(0),
+  fHistoXicMass(),
+  fHistoDcaPi1Pi2(0),
+  fHistoDcaPiCasc(0),
+  fHistoLikeDecayLength(0),
+  fHistoLikeDecayLengthXY(0),
+  fHistoXicCosPAXY(0),
+  fHistoXiMass(0),
+  fHistoCascDcaXiDaughters(0),
+  fHistoCascDcaV0Daughters(0),
+  fHistoCascDcaV0ToPrimVertex(0),
+  fHistoCascDcaPosToPrimVertex(0),
+  fHistoCascDcaNegToPrimVertex(0),
+  fHistoCascDcaBachToPrimVertex(0),
+  fHistoCascCosPAXiPrim(0),
+  fHistoXiPt(0),
+  fHistoPiPt(0),
+  fHistoPid0(0),
+  fHistonSigmaTPCpi(0),
+  fHistonSigmaTOFpi(0),
+  fHistoProbPion(0)
+{
+  //
+  // Constructor. Initialization of Inputs and Outputs
+  //
+  Info("AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks","Calling Constructor");
+  
+  DefineOutput(1,TList::Class());
+  DefineOutput(2,TList::Class());
+  if(writeVariableTree){
+    DefineOutput(3,TTree::Class());
+  }else{
+    DefineOutput(3,TList::Class());
+  }
+}
+
+//___________________________________________________________________________
+AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::~AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks() {
+  //
+  // destructor
+  //
+  Info("~AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks","Calling Destructor");
+  
+  
+  if (fOutput) {
+    delete fOutput;
+    fOutput = 0;
+  }
+  
+  if (fOutputAll) {
+    delete fOutputAll;
+    fOutputAll = 0;
+  }
+
+  if (fListCuts) {
+    delete fListCuts;
+    fListCuts = 0;
+  }
+  
+  
+  if (fAnalCuts) {
+    delete fAnalCuts;
+    fAnalCuts = 0;
+  }
+
+  if (fProdCuts) {
+    delete fProdCuts;
+    fProdCuts = 0;
+  }
+  
+  if (fVariablesTree) {
+    delete fVariablesTree;
+    fVariablesTree = 0;
+  }
+  
+  if(fCandidateVariables){
+    delete fCandidateVariables;
+    fCandidateVariables = 0;
+  }
+  
+}
+
+//_________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::Init() {
+  //
+  // Initialization
+  //
+  //
+  
+  //Copied from $ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF.C
+  
+  fIsEventSelected=kFALSE;
+  
+  if (fDebug > 1) AliInfo("Init");
+  
+  fListCuts = new TList();
+  fListCuts->SetOwner();
+  fListCuts->SetName("ListCuts");
+  fListCuts->Add(new AliRDHFCutsXicPlustoXiPiPifromAODtracks(*fProdCuts));
+  fListCuts->Add(new AliRDHFCutsXicPlustoXiPiPifromAODtracks(*fAnalCuts));
+  PostData(2,fListCuts);
+
+  return;
+}
+
+//_________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::UserExec(Option_t *)
+{
+  //
+  // UserExec code
+  //
+
+  if (!fInputEvent) {
+    AliError("NO EVENT FOUND!");
+    return;
+  }
+  AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
+  
+  
+  fCEvents->Fill(1);
+  //------------------------------------------------
+  // First check if the event has proper vertex and B
+  //------------------------------------------------
+  fVtx1 = (AliAODVertex*)aodEvent->GetPrimaryVertex();
+  if (!fVtx1) return;
+  
+  Double_t pos[3],cov[6];
+  fVtx1->GetXYZ(pos);
+  fVtx1->GetCovarianceMatrix(cov);
+  fV1 = new AliESDVertex(pos,cov,100.,100,fVtx1->GetName());
+  
+  fBzkG = (Double_t)aodEvent->GetMagneticField(); 
+  AliKFParticle::SetField(fBzkG);
+  if (TMath::Abs(fBzkG)<0.001) {
+    delete fV1;
+    return;
+  }
+  fCEvents->Fill(2);
+  
+  //------------------------------------------------
+  // Event selection setting 
+  //------------------------------------------------
+  if (fUseMCInfo)
+    fAnalCuts->SetTriggerClass("");
+  
+  if ( !fUseMCInfo && fIspp) {
+    fAnalCuts->SetUsePhysicsSelection(kTRUE);
+    fAnalCuts->SetTriggerClass("");
+    fAnalCuts->SetTriggerMask(AliVEvent::kMB);
+  }
+  
+  if ( !fUseMCInfo && fIspA) {
+    fAnalCuts->SetUsePhysicsSelection(kTRUE);
+    fAnalCuts->SetTriggerClass("");
+    fAnalCuts->SetTriggerMask(AliVEvent::kINT7);
+  }
+  if ( !fUseMCInfo && fIsAA) {
+    fAnalCuts->SetUsePhysicsSelection(kTRUE);
+    fAnalCuts->SetTriggerClass("");
+    fAnalCuts->SetTriggerMask(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral);
+  }
+  
+  //------------------------------------------------
+  // Event selection 
+  //------------------------------------------------
+  Bool_t fIsTriggerNotOK = fAnalCuts->IsEventRejectedDueToTrigger();
+  if(!fIsTriggerNotOK) fCEvents->Fill(3);
+  
+  
+  fIsEventSelected = fAnalCuts->IsEventSelected(aodEvent); 
+  if(!fIsEventSelected) {
+    //cout<<"Why: "<<fAnalCuts->GetWhyRejection()<<endl;
+    delete fV1;
+    return;
+  }
+  
+  //cout<<fabs(aodEvent->GetPrimaryVertex()->GetZ()-aodEvent->GetPrimaryVertexSPD()->GetZ())<<endl;
+  
+  fCEvents->Fill(4);
+  
+  fIsMB=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
+  fIsSemi=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
+  fIsCent=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral); 
+  fIsINT7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);  
+  fIsEMC7=(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);   
+  fTriggerCheck = fIsMB+2*fIsSemi+4*fIsCent+8*fIsINT7+16*fIsEMC7;
+  if(fIsMB) fHTrigger->Fill(1);
+  if(fIsSemi) fHTrigger->Fill(2);
+  if(fIsCent) fHTrigger->Fill(3);
+  if(fIsINT7) fHTrigger->Fill(4);
+  if(fIsEMC7) fHTrigger->Fill(5);
+  if(fIsMB|fIsSemi|fIsCent) fHTrigger->Fill(7);
+  if(fIsINT7|fIsEMC7) fHTrigger->Fill(8);
+  if(fIsMB&fIsSemi) fHTrigger->Fill(10);
+  if(fIsMB&fIsCent) fHTrigger->Fill(11);
+  if(fIsINT7&fIsEMC7) fHTrigger->Fill(12);
+  
+  if ( !fUseMCInfo && (fIsAA || fIspA)) {
+    AliCentrality *cent = aodEvent->GetCentrality();
+    fCentrality = cent->GetCentralityPercentile("V0M");
+  }
+  fHCentrality->Fill(fCentrality);
+  
+  //------------------------------------------------
+  // Check if the event has cascade candidate
+  //------------------------------------------------
+  Int_t ncasc = aodEvent->GetNumberOfCascades();
+  Int_t nselecasc = 0.;
+  for(Int_t ic=0;ic<ncasc;ic++){
+    AliAODcascade *casc = aodEvent->GetCascade(ic);
+    if(!fProdCuts) continue;
+    if(fProdCuts->SingleCascadeCuts(casc)) nselecasc++;
+  }
+  
+  if(nselecasc==0){
+    delete fV1;
+    return;
+  }
+  
+  fCEvents->Fill(5);
+  
+  //------------------------------------------------
+  // MC analysis setting
+  //------------------------------------------------
+  //  TClonesArray *mcArray = 0;
+  //  AliAODMCHeader *mcHeader=0;
+  //  if (fUseMCInfo) {
+  //    // MC array need for maching
+  //    mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+  //    if (!mcArray) {
+  //      AliError("Could not find Monte-Carlo in AOD");
+  //      delete fV1;
+  //      return;
+  //    }
+  //    fCEvents->Fill(6); // in case of MC events
+  //    
+  //    // load MC header
+  //    mcHeader = (AliAODMCHeader*)aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
+  //    if (!mcHeader) {
+  //      AliError("AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::UserExec: MC header branch not found!\n");
+  //      delete fV1;
+  //      return;
+  //    }
+  //    fCEvents->Fill(7); // in case of MC events
+  //    
+  //    Double_t zMCVertex = mcHeader->GetVtxZ();
+  //    if (TMath::Abs(zMCVertex) > fAnalCuts->GetMaxVtxZ()) {
+  //      AliDebug(2,Form("Event rejected: abs(zVtxMC)=%f > fAnalCuts->GetMaxVtxZ()=%f",zMCVertex,fAnalCuts->GetMaxVtxZ()));
+  //      delete fV1;
+  //      return;
+  //    } else {
+  //      fCEvents->Fill(17); // in case of MC events
+  //    }
+  //  }
+  
+  //------------------------------------------------
+  // Main analysis done in this function
+  //------------------------------------------------
+  MakeAnalysis(aodEvent);
+  
+  PostData(1,fOutput);
+  if(fWriteVariableTree){
+    PostData(3,fVariablesTree);
+  }else{
+    PostData(3,fOutputAll);
+  }
+  
+  fIsEventSelected=kFALSE;
+  
+  delete fV1;
+  return;
+}
+
+//________________________________________ terminate ___________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::Terminate(Option_t*)
+{    
+  // The Terminate() function is the last function to be called during
+  // a query. It always runs on the client, it can be used to present
+  // the results graphically or save the results to file.
+  
+  //AliInfo("Terminate","");
+  AliAnalysisTaskSE::Terminate();
+  
+  fOutput = dynamic_cast<TList*> (GetOutputData(1));
+  if (!fOutput) {     
+    AliError("fOutput not available");
+    return;
+  }
+  
+  if(!fWriteVariableTree){
+    fOutputAll = dynamic_cast<TList*> (GetOutputData(3));
+    if (!fOutputAll) {     
+      AliError("fOutputAll not available");
+      return;
+    }
+  }
+  
+  return;
+}
+
+//___________________________________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::UserCreateOutputObjects() 
+{ 
+  //
+  // UserCreateOutputObjects
+  //
+
+  AliInfo(Form("CreateOutputObjects of task %s\n", GetName()));
+  
+  //------------------------------------------------
+  // output object setting
+  //------------------------------------------------
+  fOutput = new TList();
+  fOutput->SetOwner();
+  fOutput->SetName("chist0");
+  DefineGeneralHistograms(); // define general histograms
+  PostData(1,fOutput);
+  
+  DefineTreeVariables();
+  if (fWriteVariableTree) {
+    PostData(3,fVariablesTree);
+  }else{
+    fOutputAll = new TList();
+    fOutputAll->SetOwner();
+    fOutputAll->SetName("anahisto");
+    DefineAnalysisHistograms(); // define general histograms
+    PostData(3,fOutputAll);
+  }
+
+
+  return;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::MakeAnalysis
+(
+ AliAODEvent *aodEvent
+ )
+{
+  //
+  // Main analysis part called from UserExec
+  //
+
+  Int_t nCascades= aodEvent->GetNumberOfCascades();
+  if (nCascades==0) {
+    return;
+  }
+  Int_t nTracks= aodEvent->GetNumberOfTracks();
+  if (nTracks==0) {
+    return;
+  }
+  
+  //------------------------------------------------
+  // Select good track before hand to save time
+  //------------------------------------------------
+  Bool_t  seleTrkFlags[nTracks];
+  Int_t nSeleTrks=0;
+  SelectTrack(aodEvent,nTracks,nSeleTrks,seleTrkFlags);
+  Bool_t  seleCascFlags[nCascades];
+  Int_t     nSeleCasc=0;
+  SelectCascade(aodEvent,nCascades,nSeleCasc,seleCascFlags);
+  
+  //------------------------------------------------
+  // Cascade loop 
+  //------------------------------------------------
+  for (Int_t icasc = 0; icasc<nCascades; icasc++) {
+    if(!seleCascFlags[icasc]) continue;
+    AliAODcascade *casc = aodEvent->GetCascade(icasc);
+    if(!casc) continue;
+    
+    AliAODTrack *cptrack =  (AliAODTrack*)(casc->GetDaughter(0));
+    AliAODTrack *cntrack =  (AliAODTrack*)(casc->GetDaughter(1));
+    AliAODTrack *cbtrack =  (AliAODTrack*)(casc->GetDecayVertexXi()->GetDaughter(0));
+    if(!cptrack || !cntrack || !cbtrack) continue;
+    
+    Int_t cpid = cptrack->GetID();
+    Int_t cnid = cntrack->GetID();
+    Int_t cbid = cbtrack->GetID();
+
+    if(cptrack->Charge()==0) continue;
+    if(cntrack->Charge()==0) continue;
+    if(cbtrack->Charge()==0) continue;
+
+    Short_t charge_casc = cptrack->Charge() + cntrack->Charge() + cbtrack->Charge();
+    
+    //------------------------------------------------
+    // Track1 loop 
+    //------------------------------------------------
+    for (Int_t itrk1 = 0; itrk1<nTracks-1; itrk1++) {
+      if(!seleTrkFlags[itrk1]) continue;
+      AliAODTrack *trk1 = (AliAODTrack*)aodEvent->GetTrack(itrk1);
+      if(!trk1||trk1->GetID()<0) continue;
+      
+      //------------------------------------------------
+      // Track2 loop 
+      //------------------------------------------------
+      for (Int_t itrk2 = itrk1+1; itrk2<nTracks; itrk2++) {
+       if(!seleTrkFlags[itrk2]) continue;
+       AliAODTrack *trk2 = (AliAODTrack*)aodEvent->GetTrack(itrk2);
+       if(!trk2||trk2->GetID()<0) continue;
+       
+       if(!SelectLikeSign(trk1,trk2)) continue;
+       
+       Int_t lpid1 = trk1->GetID();
+       Int_t lpid2 = trk2->GetID();
+       if((cpid==lpid1)||(cpid==lpid2)||(cnid==lpid1)||(cnid==lpid2)||(cbid==lpid1)||(cbid==lpid2)) continue;
+       
+       
+       Short_t charge_like1 = trk1->Charge();
+       Short_t charge_like2 = trk2->Charge();
+       Bool_t ok_charge = kFALSE;
+       if((charge_casc==-1)&&(charge_like1==1)&&(charge_like2==1)) ok_charge = kTRUE;
+       if((charge_casc==1)&&(charge_like1==-1)&&(charge_like2==-1)) ok_charge = kTRUE;
+       if(!ok_charge) continue;
+
+       //------------------------------------------------
+       // Roughly select good candidates to speed up
+       //------------------------------------------------
+       if(!fProdCuts->SelectWithRoughCuts(casc,trk1,trk2)) continue;
+
+       //------------------------------------------------
+       // Secondary vertex calculation
+       //------------------------------------------------
+       Double_t dispersion;
+       AliAODVertex *secVert = CallReconstructSecondaryVertex(trk1,trk2,dispersion);
+       if(!secVert) continue;
+
+       AliAODRecoCascadeHF3Prong *xicobj = MakeCascadeHF3Prong(casc,trk1,trk2,aodEvent,secVert,dispersion);
+       if(!xicobj) {
+         delete secVert;
+         continue;
+       }
+
+       FillROOTObjects(xicobj);
+
+       xicobj->GetSecondaryVtx()->RemoveDaughters();
+       xicobj->UnsetOwnPrimaryVtx();
+       delete xicobj;xicobj=NULL;
+       delete secVert;
+       
+      }//trk2
+    }//trk1
+  }//casc
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::FillROOTObjects(AliAODRecoCascadeHF3Prong *xicobj) 
+{
+  //
+  // Fill histogram or Tree depending on fWriteVariableTree flag
+  //
+
+  AliAODTrack *part1 = xicobj->GetBachelor1();
+  AliAODTrack *part2 = xicobj->GetBachelor2();
+  AliAODcascade *casc = xicobj->GetCascade();
+
+  fCandidateVariables[ 0] = xicobj->InvMassPiXiPi();
+  fCandidateVariables[ 1] = xicobj->Px();
+  fCandidateVariables[ 2] = xicobj->Py();
+  fCandidateVariables[ 3] = xicobj->Pz();
+  fCandidateVariables[ 4] = part1->Px();
+  fCandidateVariables[ 5] = part1->Py();
+  fCandidateVariables[ 6] = part1->Pz();
+  fCandidateVariables[ 7] = part2->Px();
+  fCandidateVariables[ 8] = part2->Py();
+  fCandidateVariables[ 9] = part2->Pz();
+  fCandidateVariables[10] = casc->MassXi();
+  fCandidateVariables[11] = casc->MomXiX();
+  fCandidateVariables[12] = casc->MomXiY();
+  fCandidateVariables[13] = casc->MomXiZ();
+  fCandidateVariables[14] = casc->MassLambda();
+  fCandidateVariables[15] = casc->MassAntiLambda();
+
+  fCandidateVariables[16] = fCentrality;
+  fCandidateVariables[17] = fVtx1->GetX();
+  fCandidateVariables[18] = fVtx1->GetY();
+  fCandidateVariables[19] = fVtx1->GetZ();
+  fCandidateVariables[20] = xicobj->GetOwnPrimaryVtx()->GetX();
+  fCandidateVariables[21] = xicobj->GetOwnPrimaryVtx()->GetY();
+  fCandidateVariables[22] = xicobj->GetOwnPrimaryVtx()->GetZ();
+
+  fCandidateVariables[23] = xicobj->CascDcaXiDaughters();
+  fCandidateVariables[24] = xicobj->CascDcaV0Daughters();
+  fCandidateVariables[25] = xicobj->CascDecayLength();
+  fCandidateVariables[26] = xicobj->CascCosPointingAngle();
+  fCandidateVariables[27] = xicobj->CascDcaV0ToPrimVertex();
+  fCandidateVariables[28] = xicobj->CascDcaPosToPrimVertex();
+  fCandidateVariables[29] = xicobj->CascDcaNegToPrimVertex();
+  fCandidateVariables[30] = xicobj->CascDcaBachToPrimVertex();
+  fCandidateVariables[31] = xicobj->CascDecayLengthV0();
+  fCandidateVariables[32] = xicobj->CascCosPointingAngleV0();
+
+  Double_t dca[3];
+  xicobj->GetDCAs(dca);
+  fCandidateVariables[33] = dca[0];
+  fCandidateVariables[34] = dca[1];
+  fCandidateVariables[35] = dca[2];
+  fCandidateVariables[36] = xicobj->Getd0Prong(0);
+  fCandidateVariables[37] = xicobj->Getd0Prong(2);
+  fCandidateVariables[38] = xicobj->Getd0Prong(1);
+
+  fCandidateVariables[39] = xicobj->DecayLength();
+  fCandidateVariables[40] = xicobj->DecayLengthXY();
+  fCandidateVariables[41] = xicobj->XicCosPointingAngle();
+
+  Double_t nSigmaTPCpi1=-9999.;
+  Double_t nSigmaTPCpi2=-9999.;
+  Double_t nSigmaTOFpi1=-9999.;
+  Double_t nSigmaTOFpi2=-9999.;
+  Double_t probPion1=-9999.;
+  Double_t probPion2=-9999.;
+
+  if(fAnalCuts->GetIsUsePID())
+    {
+      fAnalCuts->GetPidHF()->GetnSigmaTPC(part1,2,nSigmaTPCpi1);
+      fCandidateVariables[42] = nSigmaTPCpi1;
+      fAnalCuts->GetPidHF()->GetnSigmaTPC(part2,2,nSigmaTPCpi2);
+      fCandidateVariables[43] = nSigmaTPCpi2;
+      fAnalCuts->GetPidHF()->GetnSigmaTOF(part1,2,nSigmaTOFpi1);
+      fCandidateVariables[44] = nSigmaTOFpi1;
+      fAnalCuts->GetPidHF()->GetnSigmaTOF(part2,2,nSigmaTOFpi2);
+      fCandidateVariables[45] = nSigmaTOFpi2;
+
+      probPion1 =  fAnalCuts->GetPionProbabilityTPCTOF(part1);
+      probPion2 =  fAnalCuts->GetPionProbabilityTPCTOF(part2);
+      fCandidateVariables[46] = probPion1;
+      fCandidateVariables[47] = probPion2;
+    }
+
+  if(fWriteVariableTree)
+    fVariablesTree->Fill();
+  else{
+    for(Int_t ic=0;ic < fAnalCuts->GetNCutsArray(); ic++)
+      {
+       fAnalCuts->SetCutsFromArray(ic);
+       if(fAnalCuts->IsSelected(xicobj,AliRDHFCuts::kCandidate))
+         {
+           Double_t cont[3];
+           cont[0] = xicobj->InvMassPiXiPi();
+           cont[1] = xicobj->Pt();
+           cont[2] = fCentrality;
+           fHistoXicMass[ic]->Fill(cont);
+         }
+      }
+    fHistoDcaPi1Pi2->Fill(dca[2]);
+    fHistoDcaPiCasc->Fill(dca[0]);
+    fHistoDcaPiCasc->Fill(dca[1]);
+    fHistoLikeDecayLength->Fill(xicobj->DecayLength());
+    fHistoLikeDecayLengthXY->Fill(xicobj->DecayLengthXY());
+    fHistoXicCosPAXY->Fill(xicobj->XicCosPointingAngle());
+    fHistoXiMass->Fill(xicobj->CascMassXi());
+    fHistoCascDcaXiDaughters->Fill(xicobj->CascDcaXiDaughters());
+    fHistoCascDcaV0Daughters->Fill(xicobj->CascDcaV0Daughters());
+    fHistoCascDcaV0ToPrimVertex->Fill(xicobj->CascDcaV0ToPrimVertex());
+    fHistoCascDcaPosToPrimVertex->Fill(xicobj->CascDcaPosToPrimVertex());
+    fHistoCascDcaNegToPrimVertex->Fill(xicobj->CascDcaNegToPrimVertex());
+    fHistoCascDcaBachToPrimVertex->Fill(xicobj->CascDcaBachToPrimVertex());
+    fHistoCascCosPAXiPrim->Fill(xicobj->CascCosPointingAngle());
+    fHistoXiPt->Fill(xicobj->PtProng(1));
+    fHistoPiPt->Fill(xicobj->PtProng(0));
+    fHistoPiPt->Fill(xicobj->PtProng(2));
+    fHistoPid0->Fill(xicobj->Getd0Prong(0));
+    fHistoPid0->Fill(xicobj->Getd0Prong(2));
+    fHistonSigmaTPCpi->Fill(nSigmaTPCpi1);
+    fHistonSigmaTPCpi->Fill(nSigmaTPCpi2);
+    fHistonSigmaTOFpi->Fill(nSigmaTOFpi1);
+    fHistonSigmaTOFpi->Fill(nSigmaTOFpi2);
+    fHistoProbPion->Fill(probPion1);
+    fHistoProbPion->Fill(probPion2);
+       
+  }
+  return;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::DefineTreeVariables() 
+{
+  //
+  // This is to define tree variables
+  //
+  const char* nameoutput = GetOutputSlot(3)->GetContainer()->GetName();
+  fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
+  Int_t nVar = 48;
+  fCandidateVariables = new Float_t [nVar];
+  TString * fCandidateVariableNames = new TString[nVar];
+
+  fCandidateVariableNames[ 0]="InvMassXic";
+  fCandidateVariableNames[ 1]="XicPx";
+  fCandidateVariableNames[ 2]="XicPy";
+  fCandidateVariableNames[ 3]="XicPz";
+  fCandidateVariableNames[ 4]="Pi1Px";
+  fCandidateVariableNames[ 5]="Pi1Py";
+  fCandidateVariableNames[ 6]="Pi1Pz";
+  fCandidateVariableNames[ 7]="Pi2Px";
+  fCandidateVariableNames[ 8]="Pi2Py";
+  fCandidateVariableNames[ 9]="Pi2Pz";
+  fCandidateVariableNames[10]="MassXi";
+  fCandidateVariableNames[11]="XiPx";
+  fCandidateVariableNames[12]="XiPy";
+  fCandidateVariableNames[13]="XiPz";
+  fCandidateVariableNames[14]="MassLambda";
+  fCandidateVariableNames[15]="MassAntiLambda";
+
+  fCandidateVariableNames[16]="Centrality";
+  fCandidateVariableNames[17]="PrimVtxX";
+  fCandidateVariableNames[18]="PrimVtxY";
+  fCandidateVariableNames[19]="PrimVtxZ";
+  fCandidateVariableNames[20]="NewPrimVtxX";
+  fCandidateVariableNames[21]="NewPrimVtxY";
+  fCandidateVariableNames[22]="NewPrimVtxZ";
+
+  fCandidateVariableNames[23]="CascDcaXiDaughters";
+  fCandidateVariableNames[24]="CascDcaV0Daughters";
+  fCandidateVariableNames[25]="CascDecayLengthXi";
+  fCandidateVariableNames[26]="CascCosPointingAngleXi";
+  fCandidateVariableNames[27]="CascDcaV0ToPrimVertex";
+  fCandidateVariableNames[28]="CascDcaPosToPrimVertex";
+  fCandidateVariableNames[29]="CascDcaNegToPrimVertex";
+  fCandidateVariableNames[30]="CascDcaBachToPrimVertex";
+  fCandidateVariableNames[31]="CascDecayLengthV0";
+  fCandidateVariableNames[32]="CascCosPointingAngleV0";
+
+  fCandidateVariableNames[33]="DcaPi1Casc";
+  fCandidateVariableNames[34]="DcaPi2Casc";
+  fCandidateVariableNames[35]="DcaPi1Pi2";
+
+  fCandidateVariableNames[36]="Pi1d0";
+  fCandidateVariableNames[37]="Pi2d0";
+  fCandidateVariableNames[38]="Cascd0";
+
+  fCandidateVariableNames[39]="DecayLength";
+  fCandidateVariableNames[40]="DecayLengthXY";
+  fCandidateVariableNames[41]="XicCosPAXY";
+
+  fCandidateVariableNames[42]="nSigmaTPCpi1";
+  fCandidateVariableNames[43]="nSigmaTPCpi2";
+  fCandidateVariableNames[44]="nSigmaTOFpi1";
+  fCandidateVariableNames[45]="nSigmaTOFpi2";
+  fCandidateVariableNames[46]="probPion1";
+  fCandidateVariableNames[47]="probPion2";
+
+
+  for (Int_t ivar=0; ivar<nVar; ivar++) {
+    fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
+  }
+
+  return;
+}
+
+//__________________________________________________________________________
+void  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::DefineGeneralHistograms() {
+  //
+  // This is to define general histograms
+  //
+
+  fCEvents = new TH1F("fCEvents","conter",18,-0.5,17.5);
+  fCEvents->SetStats(kTRUE);
+  fCEvents->GetXaxis()->SetBinLabel(1,"X1");
+  fCEvents->GetXaxis()->SetBinLabel(2,"Analyzed events");
+  fCEvents->GetXaxis()->SetBinLabel(3,"AliAODVertex exists");
+  fCEvents->GetXaxis()->SetBinLabel(4,"TriggerOK");
+  fCEvents->GetXaxis()->SetBinLabel(5,"IsEventSelected");
+  fCEvents->GetXaxis()->SetBinLabel(6,"CascadesHF exists");
+  fCEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
+  fCEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
+  fCEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
+  fCEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
+  fCEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
+  fCEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
+  fCEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
+  fCEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
+  fCEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
+  fCEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
+  fCEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
+  fCEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnalCuts->GetMaxVtxZ()));
+  //fCEvents->GetXaxis()->SetTitle("");
+  fCEvents->GetYaxis()->SetTitle("counts");
+
+  fHTrigger = new TH1F("fHTrigger","counter",18,-0.5,17.5);
+  fHTrigger->SetStats(kTRUE);
+  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
+  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
+  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
+  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
+  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
+  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
+  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
+  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
+
+  fHCentrality = new TH1F("fHCentrality","conter",100,0.,100.);
+
+  fOutput->Add(fCEvents);
+  fOutput->Add(fHTrigger);
+  fOutput->Add(fHCentrality);
+
+  return;
+}
+
+//__________________________________________________________________________
+void  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::DefineAnalysisHistograms() 
+{
+  //
+  // Define histograms
+  //
+  
+  //------------------------------------------------
+  // Basic histograms
+  //------------------------------------------------
+  Int_t bins_base[3]=          {80                             ,20             ,10};
+  Double_t xmin_base[3]={2.468-0.2,0           ,0.00};
+  Double_t xmax_base[3]={2.468+0.2,20. ,100};
+  
+  for(Int_t i=0;i<fAnalCuts->GetNCutsArray();i++)
+    {
+      fHistoXicMass.push_back(new THnSparseF(Form("fHistoXicMass_Cut%d",i),Form("Cut%d",i),3,bins_base,xmin_base,xmax_base));
+      fOutputAll->Add(fHistoXicMass[i]);
+      
+    }
+  
+  //------------------------------------------------
+  // Checking histograms
+  //------------------------------------------------
+  fHistoDcaPi1Pi2 = new TH1F("fHistoDcaPi1Pi2","DCA (#pi_{1}-#pi_{2})",100,0.0,1.0);
+  fOutputAll->Add(fHistoDcaPi1Pi2);
+  fHistoDcaPiCasc = new TH1F("fHistoDcaPiCasc","DCA (#pi-#Xi)",100,0.0,1.0);
+  fOutputAll->Add(fHistoDcaPiCasc);
+  fHistoLikeDecayLength = new TH1F("fHistoLikeDecayLength","Decay Length (#pi-#pi)",100,0.,0.2);
+  fOutputAll->Add(fHistoLikeDecayLength);
+  fHistoLikeDecayLengthXY = new TH1F("fHistoLikeDecayLengthXY","Decay Length (#pi-#pi)",100,0.,0.2);
+  fOutputAll->Add(fHistoLikeDecayLengthXY);
+  fHistoXicCosPAXY = new TH1F("fHistoXicCosPAXY","#Xi_{c} cos(pa) ",100,-1.0,1.0);
+  fOutputAll->Add(fHistoXicCosPAXY);
+  fHistoXiMass=new TH1F("fHistoXiMass","#Xi^{-} Mass",100,1.322-0.05,1.322+0.05);
+  fOutputAll->Add(fHistoXiMass);
+  fHistoCascDcaXiDaughters=new TH1F("fHistoCascDcaXiDaughters","DCA #Xi daughters ",100,0.0,1.0);
+  fOutputAll->Add(fHistoCascDcaXiDaughters);
+  fHistoCascDcaV0Daughters=new TH1F("fHistoCascDcaV0Daughters","DCA #Xi daughters ",100,0.0,1.0);
+  fOutputAll->Add(fHistoCascDcaV0Daughters);
+  fHistoCascDcaV0ToPrimVertex=new TH1F("fHistoCascDcaV0ToPrimVertex","DCA V0 daughters ",100,0.0,1.0);
+  fOutputAll->Add(fHistoCascDcaV0ToPrimVertex);
+  fHistoCascDcaPosToPrimVertex=new TH1F("fHistoCascDcaPosToPrimVertex","DCA Pos-Prim ",100,0.0,1.0);
+  fOutputAll->Add(fHistoCascDcaPosToPrimVertex);
+  fHistoCascDcaNegToPrimVertex=new TH1F("fHistoCascDcaNegToPrimVertex","DCA Neg-Prim ",100,0.0,1.0);
+  fOutputAll->Add(fHistoCascDcaNegToPrimVertex);
+  fHistoCascDcaBachToPrimVertex=new TH1F("fHistoCascDcaBachToPrimVertex","DCA Bach-Prim ",100,0.0,1.0);
+  fOutputAll->Add(fHistoCascDcaBachToPrimVertex);
+  fHistoCascCosPAXiPrim=new TH1F("fHistoCascCosPAXiPrim","#Xi CosPA (prim)",100,0.8,1.0);
+  fOutputAll->Add(fHistoCascCosPAXiPrim);
+  fHistoXiPt=new TH1F("fHistoXiPt","#Xi^{-} p_{T}",100,0.,10.);
+  fOutputAll->Add(fHistoXiPt);
+  fHistoPiPt=new TH1F("fHistoPiPt","#pi p_{T}",100,0.,10);
+  fOutputAll->Add(fHistoPiPt);
+  fHistoPid0=new TH1F("fHistoPid0","#pi d_{0}",100,-0.1,0.1);
+  fOutputAll->Add(fHistoPid0);
+  fHistonSigmaTPCpi=new TH1F("fHistonSigmaTPCpi","n#sigma (TPC, pion)",100,-10.,10.);
+  fOutputAll->Add(fHistonSigmaTPCpi);
+  fHistonSigmaTOFpi=new TH1F("fHistonSigmaTOFpi","n#sigma (TOF, pion)",100,-10.,10.);
+  fOutputAll->Add(fHistonSigmaTOFpi);
+  fHistoProbPion=new TH1F("fHistoProbPion","Bayse Prob",100,0.0,1.);
+  fOutputAll->Add(fHistoProbPion);
+  
+  return;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags)
+{
+  //
+  // Select good tracks using fProdCuts (AliRDHFCuts object) and return the array of their ids
+  //
+  
+  //const Int_t entries = event->GetNumberOfTracks();
+  if(trkEntries==0) return;
+  
+  nSeleTrks=0;
+  for(Int_t i=0; i<trkEntries; i++) {
+    seleFlags[i] = kFALSE;
+    
+    AliVTrack *track;
+    track = (AliVTrack*)event->GetTrack(i);
+    
+    if(track->GetID()<0) continue;
+    Double_t covtest[21];
+    if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
+    
+    AliAODTrack *aodt = (AliAODTrack*)track;
+
+    if(!fProdCuts) continue;
+    if(fProdCuts->SingleTrkCuts(aodt)){
+      seleFlags[i]=kTRUE;
+      nSeleTrks++;
+    }
+  } // end loop on tracks
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::SelectCascade( const AliVEvent *event,Int_t nCascades,Int_t &nSeleCasc, Bool_t *seleCascFlags)
+{
+  //
+  // Select good cascade using fProdCuts (AliRDHFCuts object) and return the array of their ids
+  //
+
+  nSeleCasc = 0;
+  for(Int_t icasc=0;icasc<nCascades;icasc++)
+    {
+      seleCascFlags[icasc] = kFALSE;
+      AliAODcascade *casc = ((AliAODEvent*)event)->GetCascade(icasc);
+
+      if(!fProdCuts) continue;
+      if(fProdCuts->SingleCascadeCuts(casc)){
+       seleCascFlags[icasc] = kTRUE;
+       nSeleCasc++;
+      }
+    }
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::SelectLikeSign(AliAODTrack *trk1, AliAODTrack *trk2)
+{
+  //
+  // Select LikeSign tracks
+  //
+
+  if(trk1->Charge()!=trk2->Charge()) return kFALSE;
+  if(trk1->GetID()==trk2->GetID()) return kFALSE;
+  return kTRUE;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2, AliAODEvent* aod)
+{
+  //
+  // Make an array of tracks which should not be used in primary vertex calculation and 
+  // Call PrimaryVertex function
+  //
+
+  TObjArray *twoTrackArrayPlusXi = new TObjArray(5);
+  
+  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk1);
+  twoTrackArrayPlusXi->AddAt(cptrk1,0);
+  AliESDtrack *cptrk2 = new AliESDtrack((AliVTrack*)trk2);
+  twoTrackArrayPlusXi->AddAt(cptrk2,1);
+  
+  AliESDtrack *cascptrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(0));
+  twoTrackArrayPlusXi->AddAt(cascptrack,2);
+  AliESDtrack *cascntrack = new AliESDtrack((AliVTrack*)casc->GetDaughter(1));
+  twoTrackArrayPlusXi->AddAt(cascntrack,3);
+  AliESDtrack *cascbtrack = new AliESDtrack((AliVTrack*)casc->GetDecayVertexXi()->GetDaughter(0));
+  twoTrackArrayPlusXi->AddAt(cascbtrack,4);
+  
+  AliAODVertex *newvert  = PrimaryVertex(twoTrackArrayPlusXi,aod);
+  
+  for(Int_t i=0;i<5;i++)
+    {
+      AliESDtrack *tesd = (AliESDtrack*)twoTrackArrayPlusXi->UncheckedAt(i);
+      delete tesd;
+    }
+  twoTrackArrayPlusXi->Clear();
+  delete twoTrackArrayPlusXi;
+  
+  return newvert;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::CallReconstructSecondaryVertex(AliAODTrack *trk1, AliAODTrack *trk2, Double_t &dispersion)
+{
+  //
+  // Make an array of tracks which I want to use for vertex calculation and call ReconstructSecondaryVertex
+  //
+
+  TObjArray *trkArray;
+  trkArray= new TObjArray(2);
+  
+  AliESDtrack *cptrk1 = new AliESDtrack((AliVTrack*)trk1);
+  trkArray->AddAt(cptrk1,0);
+  AliESDtrack *cptrk2 = new AliESDtrack((AliVTrack*)trk2);
+  trkArray->AddAt(cptrk2,1);
+  
+  AliAODVertex *secvertex;
+  secvertex = ReconstructSecondaryVertex(trkArray,dispersion);
+  
+  for(Int_t i=0;i<2;i++)
+    {
+      AliESDtrack *tesd = (AliESDtrack*)trkArray->UncheckedAt(i);
+      delete tesd;
+    }
+  trkArray->Clear();
+  delete trkArray;
+  
+  return secvertex;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::PrimaryVertex(const TObjArray *trkArray,
+                                                                         AliVEvent *event)
+{
+  //
+  //Used only for pp
+  //copied from AliAnalysisVertexingHF (except for the following 3 lines)
+  //
+       
+  Bool_t fRecoPrimVtxSkippingTrks = kTRUE;
+  Bool_t fRmTrksFromPrimVtx = kFALSE;
+
+  AliESDVertex *vertexESD = 0;
+  AliAODVertex *vertexAOD = 0;
+  
+  //vertexESD = new AliESDVertex(*fV1);
+  
+
+  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) { 
+    // primary vertex from the input event
+    
+    vertexESD = new AliESDVertex(*fV1);
+    
+  } else {
+    // primary vertex specific to this candidate
+    
+    Int_t nTrks = trkArray->GetEntriesFast();
+    AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
+    
+    if(fRecoPrimVtxSkippingTrks) { 
+      // recalculating the vertex
+      
+      if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
+       Float_t diamondcovxy[3];
+       event->GetDiamondCovXY(diamondcovxy);
+       Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
+       Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
+       AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
+       vertexer->SetVtxStart(diamond);
+       delete diamond; diamond=NULL;
+       if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter")) 
+         vertexer->SetOnlyFitter();
+      }
+      Int_t skipped[1000];
+      Int_t nTrksToSkip=0,id;
+      AliExternalTrackParam *t = 0;
+      for(Int_t i=0; i<nTrks; i++) {
+       t = (AliExternalTrackParam*)trkArray->UncheckedAt(i);
+       id = (Int_t)t->GetID();
+       if(id<0) continue;
+       skipped[nTrksToSkip++] = id;
+      }
+      // TEMPORARY FIX
+      // For AOD, skip also tracks without covariance matrix
+      Double_t covtest[21];
+      for(Int_t j=0; j<event->GetNumberOfTracks(); j++) {
+       AliVTrack *vtrack = (AliVTrack*)event->GetTrack(j);
+       if(!vtrack->GetCovarianceXYZPxPyPz(covtest)) {
+         id = (Int_t)vtrack->GetID();
+         if(id<0) continue;
+         skipped[nTrksToSkip++] = id;
+       }
+      }
+      for(Int_t ijk=nTrksToSkip; ijk<1000; ijk++) skipped[ijk]=-1;
+      //
+      vertexer->SetSkipTracks(nTrksToSkip,skipped);
+      vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event); 
+      
+    } else if(fRmTrksFromPrimVtx && nTrks>0) { 
+      // removing the prongs tracks
+      
+      TObjArray rmArray(nTrks);
+      UShort_t *rmId = new UShort_t[nTrks];
+      AliESDtrack *esdTrack = 0;
+      AliESDtrack *t = 0;
+      for(Int_t i=0; i<nTrks; i++) {
+       t = (AliESDtrack*)trkArray->UncheckedAt(i);
+       esdTrack = new AliESDtrack(*t);
+       rmArray.AddLast(esdTrack);
+       if(esdTrack->GetID()>=0) {
+         rmId[i]=(UShort_t)esdTrack->GetID();
+       } else {
+         rmId[i]=9999;
+       }
+      }
+      Float_t diamondxy[2]={static_cast<Float_t>(event->GetDiamondX()),static_cast<Float_t>(event->GetDiamondY())};
+      vertexESD = vertexer->RemoveTracksFromVertex(fV1,&rmArray,rmId,diamondxy);
+      delete [] rmId; rmId=NULL;
+      rmArray.Delete();
+      
+    }
+    
+    delete vertexer; vertexer=NULL;
+    if(!vertexESD) return vertexAOD;
+    if(vertexESD->GetNContributors()<=0) { 
+      //AliDebug(2,"vertexing failed"); 
+      delete vertexESD; vertexESD=NULL;
+      return vertexAOD;
+    }
+    
+    
+  }
+  
+  // convert to AliAODVertex
+  Double_t pos[3],cov[6],chi2perNDF;
+  vertexESD->GetXYZ(pos); // position
+  vertexESD->GetCovMatrix(cov); //covariance matrix
+  chi2perNDF = vertexESD->GetChi2toNDF();
+  delete vertexESD; vertexESD=NULL;
+  
+  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF);
+  
+  return vertexAOD;
+}
+
+//________________________________________________________________________
+AliAODVertex* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::ReconstructSecondaryVertex(TObjArray *trkArray, Double_t &dispersion,Bool_t useTRefArray)
+{
+  //
+  // Reconstruct secondary vertex from trkArray (Copied from AliAnalysisVertexingHF)
+  //
+  
+  AliESDVertex *vertexESD = 0;
+  AliAODVertex *vertexAOD = 0;
+  
+  AliVertexerTracks *fVertexerTracks = new AliVertexerTracks(fBzkG);
+  
+  fVertexerTracks->SetVtxStart(fV1);
+  vertexESD = (AliESDVertex*)fVertexerTracks->VertexForSelectedESDTracks(trkArray);
+  
+  delete fVertexerTracks; fVertexerTracks=NULL;
+
+  if(!vertexESD) return vertexAOD;
+
+  if(vertexESD->GetNContributors()!=trkArray->GetEntriesFast()) { 
+    //AliDebug(2,"vertexing failed"); 
+    delete vertexESD; vertexESD=NULL;
+    return vertexAOD;
+  }
+  
+  Double_t vertRadius2=vertexESD->GetX()*vertexESD->GetX()+vertexESD->GetY()*vertexESD->GetY();
+  if(vertRadius2>8.){
+    // vertex outside beam pipe, reject candidate to avoid propagation through material
+    delete vertexESD; vertexESD=NULL;
+    return vertexAOD;
+  }
+  
+  
+  // convert to AliAODVertex
+  Double_t pos[3],cov[6],chi2perNDF;
+  vertexESD->GetXYZ(pos); // position
+  vertexESD->GetCovMatrix(cov); //covariance matrix
+  chi2perNDF = vertexESD->GetChi2toNDF();
+  dispersion = vertexESD->GetDispersion();
+  delete vertexESD; vertexESD=NULL;
+  
+  Int_t nprongs= (useTRefArray ? 0 : trkArray->GetEntriesFast());
+  vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
+  
+  return vertexAOD;
+}
+
+//________________________________________________________________________
+AliAODRecoCascadeHF3Prong* AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks::MakeCascadeHF3Prong(AliAODcascade *casc, AliAODTrack *part1, AliAODTrack *part2, AliAODEvent * aod, AliAODVertex *secVert, Double_t dispersion) 
+{
+  //
+  // Make AliAODRecoCascadeHF3Prong object from the arguments
+  //
+       
+  //------------------------------------------------
+  // PrimaryVertex
+  //------------------------------------------------
+  AliAODVertex *primVertexAOD;
+  Bool_t unsetvtx = kFALSE;
+  if(fIspp){
+    primVertexAOD = CallPrimaryVertex(casc,part1,part2,aod);
+    if(!primVertexAOD){
+      primVertexAOD = fVtx1;
+    }else{
+      unsetvtx = kTRUE;
+    }
+  }else{
+    primVertexAOD = fVtx1;
+  }
+  if(!primVertexAOD) return 0x0;
+  Double_t pos[3]; primVertexAOD->GetXYZ(pos);
+
+
+  //------------------------------------------------
+  // DCA between tracks
+  //------------------------------------------------
+  AliESDtrack *esdtrack1 = new AliESDtrack((AliVTrack*)part1);
+  AliESDtrack *esdtrack2 = new AliESDtrack((AliVTrack*)part2);
+  Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
+  xyz[0]=casc->DecayVertexXiX();
+  xyz[1]=casc->DecayVertexXiY();
+  xyz[2]=casc->DecayVertexXiZ();
+  pxpypz[0]=casc->MomXiX();
+  pxpypz[1]=casc->MomXiY();
+  pxpypz[2]=casc->MomXiZ();
+  casc->GetCovarianceXYZPxPyPz(cv);
+  sign=casc->ChargeXi();
+  AliExternalTrackParam        *trackCasc = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
+
+  Double_t xdummy, ydummy;
+  Double_t dcap1p2 = esdtrack1->GetDCA(esdtrack2,fBzkG,xdummy,ydummy);
+  if(fabs(dcap1p2)>fProdCuts->GetProdLikeSignDcaMax())
+    {
+      if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
+      if(esdtrack1) delete esdtrack1;
+      if(esdtrack2) delete esdtrack2;
+      if(trackCasc) delete trackCasc;
+      return 0x0;
+    }
+  Double_t dcap1casc = esdtrack1->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
+  Double_t dcap2casc = esdtrack2->GetDCA(trackCasc,fBzkG,xdummy,ydummy);
+  Double_t dca[3]={dcap1casc,dcap2casc,dcap1p2};
+
+  //------------------------------------------------
+  // Propagate all tracks to the secondary vertex and calculate momentum there
+  //------------------------------------------------
+
+  Double_t d0z0[2],covd0z0[3];
+  Double_t secR = TMath::Sqrt(secVert->GetX()*secVert->GetX()+secVert->GetY()*secVert->GetY());
+  if(secR<1.0){
+    part1->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0,covd0z0);
+    part2->PropagateToDCA(secVert,fBzkG,kVeryBig,d0z0,covd0z0);
+    trackCasc->PropagateToDCA(secVert,fBzkG,kVeryBig);
+  }else{
+    part1->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
+    part2->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
+    trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig);
+  }
+
+  Double_t momxi_new[3]={-9999,-9999,-9999.};
+  trackCasc->GetPxPyPz(momxi_new);
+
+  Double_t px[3],py[3],pz[3];
+  px[0] = part1->Px(); py[0] = part1->Py(); pz[0] = part1->Pz(); 
+  px[1] = momxi_new[0]; py[1] = momxi_new[1]; pz[1] = momxi_new[2]; 
+  px[2] = part2->Px(); py[2] = part2->Py(); pz[2] = part2->Pz(); 
+
+  //------------------------------------------------
+  // d0
+  //------------------------------------------------
+  Double_t d0[3],d0err[3];
+  part1->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
+  d0[0]= d0z0[0];
+  d0err[0] = TMath::Sqrt(covd0z0[0]);
+
+  trackCasc->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
+  d0[1]= d0z0[0];
+  d0err[1] = TMath::Sqrt(covd0z0[0]);//Do not know what to use
+
+  part2->PropagateToDCA(primVertexAOD,fBzkG,kVeryBig,d0z0,covd0z0);
+  d0[2]= d0z0[0];
+  d0err[2] = TMath::Sqrt(covd0z0[0]);
+
+
+  //------------------------------------------------
+  // Other stuff
+  //------------------------------------------------
+  Double_t dist12=0.0;//Vertex pi-casc not calculated
+  Double_t dist23=0.0;//Vertex pi-casc not calculated
+  Short_t charge=(Short_t)(part1->Charge()+trackCasc->Charge()+part2->Charge());
+
+  //------------------------------------------------
+  // Create AliAODRecoCascadeHF3Prong
+  //------------------------------------------------
+  AliAODRecoCascadeHF3Prong *theCascade = new AliAODRecoCascadeHF3Prong(secVert,charge,px,py,pz,d0,d0err,dca,dispersion,dist12,dist23);
+  if(!theCascade)  
+    {
+      if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
+      if(esdtrack1) delete esdtrack1;
+      if(esdtrack2) delete esdtrack2;
+      if(trackCasc) delete trackCasc;
+      return 0x0;
+    }
+  theCascade->SetOwnPrimaryVtx(primVertexAOD);
+  UShort_t id[3]={(UShort_t)part1->GetID(),(UShort_t)trackCasc->GetID(),(UShort_t)part2->GetID()};
+  theCascade->SetProngIDs(3,id);
+
+  theCascade->GetSecondaryVtx()->AddDaughter(part1);
+  theCascade->GetSecondaryVtx()->AddDaughter(casc);
+  theCascade->GetSecondaryVtx()->AddDaughter(part2);
+
+  if(unsetvtx) delete primVertexAOD; primVertexAOD=NULL;
+  if(esdtrack1) delete esdtrack1;
+  if(esdtrack2) delete esdtrack2;
+  if(trackCasc) delete trackCasc;
+
+  return theCascade;
+}
diff --git a/PWGHF/vertexingHF/AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.h b/PWGHF/vertexingHF/AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.h
new file mode 100644 (file)
index 0000000..f4c76f3
--- /dev/null
@@ -0,0 +1,140 @@
+#ifndef ALIANALYSISTASKSEXICPLUS2XIPIPIFROMAODTRACKS_H
+#define ALIANALYSISTASKSEXICPLUS2XIPIPIFROMAODTRACKS_H
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */ 
+
+#include "TROOT.h"
+#include "TSystem.h"
+
+#include "AliAnalysisTaskSE.h"
+#include "AliAODEvent.h"
+#include "AliPID.h"
+#include "AliRDHFCutsXicPlustoXiPiPifromAODtracks.h"
+
+class THnSparse;
+class TH1F;
+class TClonesArray;
+class AliAODRecoCascadeHF3Prong;
+class AliAODPidHF;
+class AliESDtrackCuts;
+class AliESDVertex;
+
+class AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks : public AliAnalysisTaskSE 
+{
+ public:
+  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks();
+  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks(const Char_t* name, AliRDHFCutsXicPlustoXiPiPifromAODtracks* cuts, AliRDHFCutsXicPlustoXiPiPifromAODtracks* cuts2, Bool_t writeVariableTree=kTRUE);
+  virtual ~AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks();
+
+  // Implementation of interface methods  
+  virtual void UserCreateOutputObjects();
+  virtual void Init();
+  virtual void LocalInit() {Init();}
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *option);
+
+  void FillROOTObjects(AliAODRecoCascadeHF3Prong *xicobj);
+  void MakeAnalysis(AliAODEvent *aod);
+
+  
+  // set MC usage
+  void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
+  Bool_t GetMC() const {return fUseMCInfo;}
+  
+  void   SetIspp(Bool_t a) { fIspp=a; }
+  Bool_t GetIspp() { return fIspp; }
+  void   SetIspA(Bool_t a) { fIspA=a; }
+  Bool_t GetIspA() { return fIspA; }
+  void   SetIsAA(Bool_t a) { fIsAA=a; }
+  Bool_t GetIsAA() { return fIsAA; }
+  
+  void SelectCascade( const AliVEvent *event,Int_t nCascades,Int_t &nSeleCasc, Bool_t *seleCascFlags);
+  void SelectTrack( const AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks,Bool_t *seleFlags);
+  Bool_t SelectLikeSign(AliAODTrack *trk1, AliAODTrack *trk2);
+  AliAODRecoCascadeHF3Prong* MakeCascadeHF3Prong(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2, AliAODEvent *aod, AliAODVertex *secvert, Double_t dispersion);
+  
+ private:
+  
+  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks(const AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks &source);
+  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks& operator=(const AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks& source); 
+  
+  void DefineTreeVariables();
+  void DefineGeneralHistograms();
+  void DefineAnalysisHistograms();
+
+  AliAODVertex *CallPrimaryVertex(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2, AliAODEvent *evt);
+  AliAODVertex* PrimaryVertex(const TObjArray *trkArray,AliVEvent *event);
+  AliAODVertex* CallReconstructSecondaryVertex(AliAODTrack *trk1, AliAODTrack *trk2,Double_t &disp);
+  AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray, Double_t &dispersion,Bool_t useTRefArray=kTRUE);
+  
+  Bool_t fUseMCInfo;          // Use MC info
+  TList *fOutput;             //! User output slot 1 // general histos
+  TList *fOutputAll;          //! User output slot 3 // Analysis histos
+  TList *fListCuts;           //! User output slot 2 // Cuts 
+  TH1F *fCEvents;             // Histogram to check selected events
+  TH1F *fHTrigger;            //Histograms to check trigger
+  TH1F *fHCentrality;         //histogram to check centrality
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks *fProdCuts;      // Cuts - sent to output slot 2
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks *fAnalCuts;      // Cuts - sent to output slot 2
+  Bool_t fIsEventSelected;           // flag for event selected
+  Bool_t    fWriteVariableTree;       // flag to decide whether to write the candidate variables on a tree variables
+  TTree    *fVariablesTree;           //! tree of the candidate variables after track selection on output slot 4
+  Bool_t fIspp;            //is pp run
+  Bool_t fIspA;            //is pA run
+  Bool_t fIsAA;            //is AA run
+  Bool_t fIsMB;            //Is MB event
+  Bool_t fIsSemi;          //is semi-central trigger event
+  Bool_t fIsCent;          //is central trigger event
+  Bool_t fIsINT7;          // is int7 trigger event
+  Bool_t fIsEMC7;          //is emc7 trigger event
+  Float_t *fCandidateVariables;     //! variables to be written to the tree
+  AliAODVertex *fVtx1;              // primary vertex
+  AliESDVertex *fV1;                // primary vertex
+  Double_t fBzkG;                   // magnetic field value [kG]
+  Float_t  fCentrality;             //centrality
+  Float_t  fTriggerCheck;           // Trigger information
+  
+  //--------------------- My histograms ------------------
+  std::vector<THnSparse* > fHistoXicMass;        //! xic mass spectra
+  
+  TH1F*  fHistoDcaPi1Pi2;                    //!  DCA between pions
+  TH1F*  fHistoDcaPiCasc;                    //! DCA between pi and cascade
+  TH1F*  fHistoLikeDecayLength;              //! Decay length
+  TH1F*  fHistoLikeDecayLengthXY;            //! Decay length in XY
+  TH1F*  fHistoXicCosPAXY;                   //! Xic cosine pointing angle
+  
+  TH1F*  fHistoXiMass;                       //! mass of xi
+  TH1F*  fHistoCascDcaXiDaughters;           //! DCA of xi daughgers
+  TH1F*  fHistoCascDcaV0Daughters;           //! DCA of v0 daughters
+  TH1F*  fHistoCascDcaV0ToPrimVertex;        //! DCA of v0 to primary vertex 
+  TH1F*  fHistoCascDcaPosToPrimVertex;       //! DCA of positive track to primary vertex 
+  TH1F*  fHistoCascDcaNegToPrimVertex;       //! DCA of negative track to primary vertex 
+  TH1F*  fHistoCascDcaBachToPrimVertex;      //! DCA of bachelor track to primary vertex 
+  TH1F*  fHistoCascCosPAXiPrim;              //! Cosine pointing angle of Xi to primary vertex
+  TH1F*  fHistoXiPt;                         //! Xi pt
+  
+  TH1F*  fHistoPiPt;                         //! Pion pT
+  TH1F*  fHistoPid0;                         //! pion d0
+  TH1F*  fHistonSigmaTPCpi;                  //! nSigma of TPC pion
+  TH1F*  fHistonSigmaTOFpi;                  //! nSigma of TOF pion
+  TH1F*  fHistoProbPion;                     //! Probability to be pion
+  
+  ClassDef(AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks,1); // class for Xic->Xipipi
+};
+#endif
+
index e806ed759bc1b4a91f974b60c8a002c99e1159c7..fc2f038cd2942f454536dd82ae748fef27b8a485 100644 (file)
@@ -854,6 +854,13 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetLabelArray()
       daughter1 = daughterTemp; // the V0 label
     }
 
+    if(!mcPartDaughter1){
+      AliDebug(2, "Null pointer to K0 particle, skipping!!");
+      delete [] fLabelArray;
+      fLabelArray = 0x0;
+      return checkCD;
+    }
+
     if (mcPartDaughter1->GetNDaughters()!=1) {
       AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
       delete [] fLabelArray;
index 404bf6c74fec297f121dc4c1d11a544b126fef5a..b0b5f746ffe65ef720dee696a62f5b74bc507e65 100644 (file)
@@ -168,8 +168,8 @@ AliHFPtSpectrum::AliHFPtSpectrum(const AliHFPtSpectrum &rhs):
   fParticleAntiParticle(rhs.fParticleAntiParticle),
   fIsEventPlane(rhs.fIsEventPlane),
   fnPtBins(rhs.fnPtBins),
-  fPtBinLimits(),
-  fPtBinWidths(),
+  fPtBinLimits(NULL),
+  fPtBinWidths(NULL),
   fhStatUncEffcSigma(NULL),
   fhStatUncEffbSigma(NULL),
   fhStatUncEffcFD(NULL),
@@ -186,6 +186,8 @@ AliHFPtSpectrum::AliHFPtSpectrum(const AliHFPtSpectrum &rhs):
     fTab[i] = rhs.fTab[i];
   }
 
+  fPtBinLimits = new Double_t[fnPtBins+1];
+  fPtBinWidths = new Double_t[fnPtBins];
   for(Int_t i=0; i<fnPtBins; i++){
     fPtBinLimits[i] = rhs.fPtBinLimits[i];
     fPtBinWidths[i] = rhs.fPtBinWidths[i];
@@ -251,6 +253,10 @@ AliHFPtSpectrum &AliHFPtSpectrum::operator=(const AliHFPtSpectrum &source){
   }
 
   fnPtBins = source.fnPtBins;
+  if(fPtBinLimits) delete fPtBinLimits;
+  if(fPtBinWidths) delete fPtBinWidths;
+  fPtBinLimits = new Double_t[fnPtBins+1];
+  fPtBinWidths = new Double_t[fnPtBins];
   for(Int_t i=0; i<fnPtBins; i++){
     fPtBinLimits[i] = source.fPtBinLimits[i];
     fPtBinWidths[i] = source.fPtBinWidths[i];
diff --git a/PWGHF/vertexingHF/AliRDHFCutsLctopK0sfromAODtracks.cxx b/PWGHF/vertexingHF/AliRDHFCutsLctopK0sfromAODtracks.cxx
new file mode 100644 (file)
index 0000000..ca28006
--- /dev/null
@@ -0,0 +1,593 @@
+/**************************************************************************
+ * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/////////////////////////////////////////////////////////////
+//
+// Class for cuts on AOD reconstructed Lc->p+K0s
+//
+// Modified by Y.S Watanabe - wyosuke@cns.s.u-tokyo.ac.jp
+//
+/////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+
+#include <TDatabasePDG.h>
+#include <TMath.h>
+
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+#include "AliPIDResponse.h"
+#include "AliRDHFCutsLctopK0sfromAODtracks.h"
+#include "AliAODRecoCascadeHF.h"
+#include "AliAODTrack.h"
+#include "AliESDtrack.h"
+#include "AliESDVertex.h"
+#include "AliAODVertex.h"
+#include "AliAODv0.h"
+#include "AliAODcascade.h"
+#include "AliESDv0.h"
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliRDHFCutsLctopK0sfromAODtracks)
+
+//--------------------------------------------------------------------------
+AliRDHFCutsLctopK0sfromAODtracks::AliRDHFCutsLctopK0sfromAODtracks(const char* name) :
+AliRDHFCuts(name),
+  fPIDStrategy(kNSigmaCuts),
+  fCombinedPIDThreshold(0.),
+  fUseOnTheFlyV0(kFALSE),
+  fProdTrackPtMin(0.3),
+  fProdTrackEtaRange(0.8),
+  fProdUseAODFilterBit(kTRUE),
+  fProdV0MassTolK0s(0.01),
+  fProdV0PtMin(0.5),
+  fProdV0CosPointingAngleToPrimVtxMin(0.99),
+  fProdV0DcaDaughtersMax(1.5),
+  fProdV0DaughterEtaRange(0.8),
+  fProdV0DaughterPtMin(0.0),
+  fProdV0DaughterTPCClusterMin(70),
+fProdRoughMassTol(0.25),
+fProdRoughPtMin(0.0),
+fnCuts(0),
+  fnTotalCutBins(1),
+  fCutsArray(0)
+{
+  //
+  // Default Constructor
+  //
+
+  const Int_t nvars=7;
+  SetNVars(nvars);
+  TString varNames[nvars]={"Lc inv. mass [GeV/c2]",                   //  0
+                          "Lc pT [GeV/c]", //1
+                          "Bachelor pT [GeV/c]", //2
+                          "Bachelor d0 [cm]", //3
+                          "V0 d0 [cm]", //4
+                          "K0s mass [GeV/c2]", //5
+                          "Decay Length XY [cm]" //6
+  };
+
+  Bool_t isUpperCut[nvars]={kTRUE,  //  0
+                           kFALSE, //1
+                           kFALSE, //2
+                           kTRUE, //3
+                           kTRUE, //4
+                           kTRUE, //5
+                           kFALSE //6
+  };
+  SetVarNames(nvars,varNames,isUpperCut);
+  Bool_t forOpt[nvars]={kFALSE, //  0
+                       kFALSE, //1
+                       kTRUE, //2
+                       kTRUE, //3
+                       kTRUE, //4
+                       kTRUE, //5
+                       kTRUE //6
+  };
+  SetVarsForOpt(nvars,forOpt);
+
+  Float_t limits[2]={0,999999999.};
+  SetPtBins(2,limits);
+}
+//--------------------------------------------------------------------------
+AliRDHFCutsLctopK0sfromAODtracks::AliRDHFCutsLctopK0sfromAODtracks(const AliRDHFCutsLctopK0sfromAODtracks &source) :
+  AliRDHFCuts(source),
+  fPIDStrategy(source.fPIDStrategy),
+  fCombinedPIDThreshold(source.fCombinedPIDThreshold),
+  fUseOnTheFlyV0(source.fUseOnTheFlyV0),
+  fProdTrackPtMin(source.fProdTrackPtMin),
+  fProdTrackEtaRange(source.fProdTrackEtaRange),
+  fProdUseAODFilterBit(source.fProdUseAODFilterBit),
+  fProdV0MassTolK0s(source.fProdV0MassTolK0s),
+  fProdV0PtMin(source.fProdV0PtMin),
+  fProdV0CosPointingAngleToPrimVtxMin(source.fProdV0CosPointingAngleToPrimVtxMin),
+  fProdV0DcaDaughtersMax(source.fProdV0DcaDaughtersMax),
+  fProdV0DaughterEtaRange(source.fProdV0DaughterEtaRange),
+  fProdV0DaughterPtMin(source.fProdV0DaughterPtMin),
+  fProdV0DaughterTPCClusterMin(source.fProdV0DaughterTPCClusterMin),
+  fProdRoughMassTol(source.fProdRoughMassTol),
+  fProdRoughPtMin(source.fProdRoughPtMin),
+  fnCuts(source.fnCuts),
+  fnTotalCutBins(source.fnTotalCutBins),
+  fCutsArray(0)
+{
+  //
+  // Copy constructor
+  //
+  if(source.fCutsArray) SetCutsArray(source.fnTotalCutBins,source.fCutsArray);
+}
+//--------------------------------------------------------------------------
+AliRDHFCutsLctopK0sfromAODtracks &AliRDHFCutsLctopK0sfromAODtracks::operator=(const AliRDHFCutsLctopK0sfromAODtracks &source)
+{
+  //
+  // assignment operator
+  //
+
+  if (this != &source) {
+    AliRDHFCuts::operator=(source);
+  }
+
+  fPIDStrategy = source.fPIDStrategy;
+  fCombinedPIDThreshold = source.fCombinedPIDThreshold;
+  fUseOnTheFlyV0 = source.fUseOnTheFlyV0;
+  fProdTrackPtMin = source.fProdTrackPtMin;
+  fProdTrackEtaRange = source.fProdTrackEtaRange;
+  fProdUseAODFilterBit = source.fProdUseAODFilterBit;
+  fProdV0MassTolK0s = source.fProdV0MassTolK0s;
+  fProdV0PtMin = source.fProdV0PtMin;
+  fProdV0CosPointingAngleToPrimVtxMin = source.fProdV0CosPointingAngleToPrimVtxMin;
+  fProdV0DcaDaughtersMax=source.fProdV0DcaDaughtersMax;
+  fProdV0DaughterEtaRange=source.fProdV0DaughterEtaRange;
+  fProdV0DaughterPtMin=source.fProdV0DaughterPtMin;
+  fProdV0DaughterTPCClusterMin=source.fProdV0DaughterTPCClusterMin;
+  fProdRoughMassTol = source.fProdRoughMassTol;
+  fProdRoughPtMin = source.fProdRoughPtMin;
+  
+  if(source.fnCuts) fnCuts = source.fnCuts;
+  if(source.fnTotalCutBins) fnTotalCutBins = source.fnCuts;
+  if(source.fCutsArray) SetCutsArray(source.fnTotalCutBins,source.fCutsArray);
+  
+  return *this;
+}
+
+//---------------------------------------------------------------------------
+AliRDHFCutsLctopK0sfromAODtracks::~AliRDHFCutsLctopK0sfromAODtracks() {
+  //
+  //  Default Destructor
+  //
+  
+  if(fCutsArray) delete[] fCutsArray;
+}
+
+//---------------------------------------------------------------------------
+void AliRDHFCutsLctopK0sfromAODtracks::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
+  //
+  // Fills in vars the values of the variables
+  //
+  
+  if (pdgdaughters[0]==-9999) return; // dummy
+
+  AliAODRecoCascadeHF* dd=(AliAODRecoCascadeHF*)d;
+  if(!dd){
+    AliError("No AliAODRecoCascadeHF object found\n");
+    return;
+  }
+  
+  if (nvars!=fnVarsForOpt) {
+    AliError("Cut object seems to have the wrong number of variables\n");
+    return;
+  }
+
+  //Double_t ptD=d->Pt();
+  //Int_t ptbin=PtBin(ptD);
+  Int_t iter=-1;
+
+  if(fVarsForOpt[0]){
+    iter++;
+    Double_t mlcPDG =  TDatabasePDG::Instance()->GetParticle(4122)->Mass();
+    vars[iter]= TMath::Abs(dd->InvMassLctoK0sP()-mlcPDG) ;
+  }
+  if(fVarsForOpt[1]){
+    iter++;
+    vars[iter]= dd->Pt();
+  }
+  if(fVarsForOpt[2]){
+    iter++;
+    AliAODTrack *part = dd->GetBachelor();
+    vars[iter]= part->Pt();
+  }
+  if(fVarsForOpt[3]){
+    iter++;
+    vars[iter]= dd->Getd0Prong(0);
+  }
+  if(fVarsForOpt[4]){
+    iter++;
+    vars[iter]= dd->Getd0Prong(1);
+  }
+  if(fVarsForOpt[5]){
+    iter++;
+    AliAODv0 *v0 = dd->Getv0();
+    vars[iter]= v0->MassK0Short();
+  }
+  if(fVarsForOpt[6]){
+    iter++;
+    vars[iter]= dd->DecayLengthXY();
+  }
+  
+  return;
+}
+
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsLctopK0sfromAODtracks::IsSelected(TObject* obj, Int_t selectionLevel) {
+  //
+  // Apply selection
+  //
+
+  if (!fCutsRD) {
+    AliFatal("Cut matrix not inizialized. Exit...");
+    return 0;
+  }
+
+  AliAODRecoCascadeHF* d=(AliAODRecoCascadeHF*)obj;
+  if(!d){
+    AliDebug(2,"AliAODRecoCascadeHF null");
+    return 0;
+  }
+
+  Double_t ptD=d->Pt();
+  if(ptD<fMinPtCand) return 0;
+  if(ptD>fMaxPtCand) return 0;
+
+  if (selectionLevel==AliRDHFCuts::kAll ||
+      selectionLevel==AliRDHFCuts::kTracks) {
+    //Performed in production stage
+  }
+
+  Int_t returnvalueCuts=1;
+  // selection on candidate
+  if (selectionLevel==AliRDHFCuts::kAll ||
+      selectionLevel==AliRDHFCuts::kCandidate) {
+    
+    Double_t pt=d->Pt();
+    Int_t ptbin=PtBin(pt);
+    if (ptbin==-1) {
+      return 0;
+    }
+    Bool_t okcand=kTRUE;
+    
+    Double_t mlcPDG =  TDatabasePDG::Instance()->GetParticle(4122)->Mass();
+    Double_t mk0sPDG =  TDatabasePDG::Instance()->GetParticle(310)->Mass();
+    AliAODTrack *part = d->GetBachelor();
+    AliAODv0 *v0 = d->Getv0();
+    
+    if(TMath::Abs(d->InvMassLctoK0sP()-mlcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(d->Pt() < fCutsRD[GetGlobalIndex(1,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(part->Pt() < fCutsRD[GetGlobalIndex(2,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(3,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(4,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(TMath::Abs(v0->MassK0Short()-mk0sPDG) > fCutsRD[GetGlobalIndex(5,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(d->DecayLengthXY() < fCutsRD[GetGlobalIndex(6,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    
+    if(!okcand)  return 0;
+    returnvalueCuts = 1;
+  }
+  
+  Int_t returnvaluePID=1;
+  if(selectionLevel==AliRDHFCuts::kAll ||
+     selectionLevel==AliRDHFCuts::kCandidate|| 
+     selectionLevel==AliRDHFCuts::kPID) {
+
+    switch(fPIDStrategy){
+    case kNSigmaCuts:
+      returnvaluePID = IsSelectedPID(d);
+      break;
+    case kCombinedCuts:
+      returnvaluePID = IsSelectedCombinedPID(d);
+      break;
+    }
+  }
+  
+  Int_t returnvalue = 0;
+  if(returnvalueCuts==1 && returnvaluePID==1) returnvalue=1;
+  
+  return returnvalue;
+}
+
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsLctopK0sfromAODtracks::IsSelectedPID(AliAODRecoDecayHF* obj) 
+{
+  //
+  // IsSelectedPID
+  //
+
+  if(!fUsePID || !obj) return 1;
+
+  AliAODRecoCascadeHF* dd=(AliAODRecoCascadeHF*)obj;
+  AliAODTrack *part = dd->GetBachelor();
+  
+  Int_t returnvalue=1;
+
+  if(fPidHF->GetPidResponse()==0x0){
+    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+    AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
+    AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
+    fPidHF->SetPidResponse(pidResp);
+  }
+
+  Int_t isProton=fPidHF->MakeRawPid(part,4); 
+  if(isProton<1) returnvalue = 0;
+  
+  return returnvalue;
+}
+
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsLctopK0sfromAODtracks::IsSelectedCombinedPID(AliAODRecoDecayHF* obj) {
+  //
+  // IsSelectedCombinedPID
+  //
+    
+  if(!fUsePID || !obj) {return 1;}
+
+  AliAODRecoCascadeHF* dd=(AliAODRecoCascadeHF*)obj;
+  AliAODTrack *part = dd->GetBachelor();
+  if(!part) return 0;
+
+  Int_t returnvalue=1;
+  Double_t probProton = GetProtonProbabilityTPCTOF(part);
+  if(probProton<fCombinedPIDThreshold) returnvalue = 0;
+
+  return returnvalue;
+}
+
+//________________________________________________________________________
+Double_t AliRDHFCutsLctopK0sfromAODtracks::GetProtonProbabilityTPCTOF(AliAODTrack* trk) 
+{
+  //
+  // Get Proton probability
+  //
+  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
+  Double_t prob1[AliPID::kSPECIES];
+  UInt_t detUsed1 = fPidHF->GetPidCombined()->ComputeProbabilities(trk, fPidHF->GetPidResponse(), prob1);
+  if (detUsed1 != (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask() ) 
+    { 
+      fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
+      detUsed1 = fPidHF->GetPidCombined()->ComputeProbabilities(trk, fPidHF->GetPidResponse(), prob1);
+    }
+  return prob1[AliPID::kProton];
+}
+
+//________________________________________________________________________
+Bool_t AliRDHFCutsLctopK0sfromAODtracks::SingleTrkCuts(AliAODTrack *trk)
+{
+  //
+  // Single Track Cut to be applied before object creation
+  //
+
+  if(trk->GetStatus()&AliESDtrack::kITSpureSA) return kFALSE;
+  if(!(trk->GetStatus()&AliESDtrack::kITSin)) return kFALSE;
+  if(fProdUseAODFilterBit && !trk->TestFilterMask(BIT(4))) return kFALSE;
+  if(fabs(trk->Eta())>fProdTrackEtaRange) return kFALSE;
+  if(trk->Pt()<fProdTrackPtMin) return kFALSE;
+
+  if(fUsePID)
+    {
+      if(fPidHF->GetPidResponse()==0x0){
+       AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+       AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
+       AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
+       fPidHF->SetPidResponse(pidResp);
+      }
+
+      Int_t isProton=fPidHF->MakeRawPid(trk,4); 
+      if(isProton<1) return kFALSE;
+    }
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliRDHFCutsLctopK0sfromAODtracks::SingleV0Cuts(AliAODv0 *v0, AliAODVertex *primVert)
+{
+  //
+  // Single V0 Cut to be applied before object creation
+  //
+
+  Bool_t onFlyV0 = v0->GetOnFlyStatus(); // on-the-flight V0s
+  if ( onFlyV0 && !fUseOnTheFlyV0 ) return kFALSE;
+
+  AliAODTrack *cptrack =  (AliAODTrack*)(v0->GetDaughter(0));
+  AliAODTrack *cntrack =  (AliAODTrack*)(v0->GetDaughter(1));
+  if(!cptrack || !cntrack) return kFALSE;
+  if ( cptrack->Charge() == cntrack->Charge() ) return kFALSE;
+  if(!(cptrack->GetStatus() & AliESDtrack::kTPCrefit) ||
+     !(cntrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
+  AliAODVertex *maybeKinkPos = (AliAODVertex*)cptrack->GetProdVertex();
+  AliAODVertex *maybeKinkNeg = (AliAODVertex*)cntrack->GetProdVertex();
+  if (maybeKinkPos->GetType()==AliAODVertex::kKink || maybeKinkNeg->GetType()==AliAODVertex::kKink) 
+    return kFALSE;
+
+  if ( ( ( cptrack->GetTPCClusterInfo(2,1) ) < (Float_t)fProdV0DaughterTPCClusterMin ) || 
+       ( ( cntrack->GetTPCClusterInfo(2,1) ) < (Float_t)fProdV0DaughterTPCClusterMin) ) return kFALSE;
+
+  Double_t massK0S = v0->MassK0Short();
+  Double_t mk0sPDG   = TDatabasePDG::Instance()->GetParticle(310)->Mass();
+  if(fabs(massK0S-mk0sPDG)>fProdV0MassTolK0s) return kFALSE;
+
+
+  if(TMath::Abs(v0->DcaV0Daughters())>fProdV0DcaDaughtersMax) return kFALSE;
+  Double_t posVtx[3] = {0.,0.,0.};
+  primVert->GetXYZ(posVtx);
+  Double_t cospav0 = v0->CosPointingAngle(posVtx); 
+  if(cospav0<fProdV0CosPointingAngleToPrimVtxMin) return kFALSE;
+  if(v0->Pt()<fProdV0PtMin) return kFALSE;
+  if(fabs(cptrack->Eta())>fProdV0DaughterEtaRange) return kFALSE;
+  if(fabs(cntrack->Eta())>fProdV0DaughterEtaRange) return kFALSE;
+  if(cptrack->Pt()<fProdV0DaughterPtMin) return kFALSE;
+  if(cntrack->Pt()<fProdV0DaughterPtMin) return kFALSE;
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliRDHFCutsLctopK0sfromAODtracks::SelectWithRoughCuts(AliAODv0 *v0, AliAODTrack *part)
+{
+  //
+  // Mass and pT Cut to be applied before object creation
+  //
+
+  Double_t mprPDG =  TDatabasePDG::Instance()->GetParticle(2212)->Mass();
+  Double_t mLcPDG =  TDatabasePDG::Instance()->GetParticle(4122)->Mass();
+
+  Double_t pxpr_init = part->Px();
+  Double_t pypr_init = part->Py();
+  Double_t pzpr_init = part->Pz();
+  Double_t Epr_init = sqrt(pxpr_init*pxpr_init+pypr_init*pypr_init+pzpr_init*pzpr_init+mprPDG*mprPDG);
+
+  Double_t pxv0_init = v0->Px();
+  Double_t pyv0_init = v0->Py();
+  Double_t pzv0_init = v0->Pz();
+  Double_t massv0_init = v0->MassK0Short();
+  Double_t Ev0_init = sqrt(pxv0_init*pxv0_init+pyv0_init*pyv0_init+pzv0_init*pzv0_init+massv0_init*massv0_init);
+
+  Double_t pxlc_init = pxpr_init+pxv0_init;
+  Double_t pylc_init = pypr_init+pyv0_init;
+  Double_t pzlc_init = pzpr_init+pzv0_init;
+  Double_t Elc_init = Epr_init+Ev0_init;
+  Double_t lcmass_init = sqrt(Elc_init*Elc_init-pxlc_init*pxlc_init-pylc_init*pylc_init-pzlc_init*pzlc_init);
+
+  if(lcmass_init<mLcPDG-fProdRoughMassTol || lcmass_init>mLcPDG+fProdRoughMassTol) return kFALSE;
+  if(sqrt(pxlc_init*pxlc_init+pylc_init*pylc_init)<fProdRoughPtMin) return kFALSE;
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+void AliRDHFCutsLctopK0sfromAODtracks::SetCutsArray(Int_t nCuts, Int_t nVars, Int_t nPtBins, Float_t ***cutsArray) 
+{
+  //
+  // store the cuts
+  //
+  if (nVars!=fnVars) {
+    AliError(" wrong number of variables\n");
+    return;
+  }
+  if (nCuts!=fnCuts) {
+    AliError(" wrong number of cuts\n");
+    return;
+  }
+  if (nPtBins!=fnPtBins) {
+    AliError(" wrong number of pT bin\n");
+    return;
+  }
+
+  if(!fCutsArray)
+    {
+      fnTotalCutBins = nCuts * nVars * nPtBins;
+      fCutsArray = new Float_t[fnTotalCutBins];
+    }
+
+  for(Int_t icuts=0;icuts<nCuts;icuts++){
+    for(Int_t iv=0;iv<nVars;iv++){
+      for(Int_t ip=0;ip<nPtBins;ip++){
+       Int_t gid = GetCutArrayID(icuts,iv,ip);
+       fCutsArray[gid] = cutsArray[icuts][iv][ip];
+      }
+    }
+  }
+  return;
+}
+
+//________________________________________________________________________
+void AliRDHFCutsLctopK0sfromAODtracks::SetCutsArray(Int_t nTotBins, Float_t *cutsArray) 
+{
+  //
+  // store the cuts
+  //
+
+  if (nTotBins!=fnVars*fnPtBins*fnCuts) {
+    AliError(" wrong number of variables\n");
+    return;
+  }
+
+  if(!fCutsArray)
+    {
+      fnTotalCutBins = fnCuts * fnVars * fnPtBins;
+      fCutsArray = new Float_t[fnTotalCutBins];
+    }
+
+  for(Int_t i=0;i<nTotBins;i++){
+    fCutsArray[i] = cutsArray[i];
+  }
+
+  return;
+}
+
+//________________________________________________________________________
+void AliRDHFCutsLctopK0sfromAODtracks::SetCutsFromArray(Int_t iCuts) 
+{
+  //
+  // Read Cuts from fCutsArray and update fCutsRD
+  //
+  Float_t** cutsarray;
+  cutsarray=new Float_t*[fnVars];
+  for(Int_t ic=0;ic<fnVars;ic++){cutsarray[ic]=new Float_t[fnPtBins];}
+
+  for(Int_t i=0;i<fnVars;i++){
+    for(Int_t j=0;j<fnPtBins;j++){
+      Int_t gid = GetCutArrayID(iCuts,i,j);
+      cutsarray[i][j] = fCutsArray[gid];
+    }
+  }
+  SetCuts(fnVars,fnPtBins,cutsarray);
+
+  for(Int_t ic=0;ic<fnVars;ic++){
+    delete[] cutsarray[ic];
+  }
+  delete[] cutsarray;
+}
+
+//________________________________________________________________________
+Int_t AliRDHFCutsLctopK0sfromAODtracks::GetCutArrayID(Int_t ic, Int_t iv, Int_t ip) 
+{
+  //
+  // Global index of fCutsArray
+  //
+  return ic*fnVars*fnPtBins+iv*fnPtBins+ip;
+}
diff --git a/PWGHF/vertexingHF/AliRDHFCutsLctopK0sfromAODtracks.h b/PWGHF/vertexingHF/AliRDHFCutsLctopK0sfromAODtracks.h
new file mode 100644 (file)
index 0000000..fe163ef
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef ALIRDHFCUTSLCTOPK0SFROMAODTRACKS_H
+#define ALIRDHFCUTSLCTOPK0SFROMAODTRACKS_H
+/* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//***********************************************************
+// Class AliRDHFCutsXictoPLUSXiPiPifromAODtracks
+// class for cuts on AOD reconstructed Lc-> pK0s
+//***********************************************************
+
+#include "AliRDHFCuts.h"
+
+class AliRDHFCutsLctopK0sfromAODtracks : public AliRDHFCuts
+{
+ public:
+
+  enum EPIDStrategy{
+    kNSigmaCuts,
+    kCombinedCuts
+  };
+
+  AliRDHFCutsLctopK0sfromAODtracks(const char* name="CutsLctopK0s");
+  virtual ~AliRDHFCutsLctopK0sfromAODtracks();
+  AliRDHFCutsLctopK0sfromAODtracks(const AliRDHFCutsLctopK0sfromAODtracks& source);
+  AliRDHFCutsLctopK0sfromAODtracks& operator=(const AliRDHFCutsLctopK0sfromAODtracks& source);
+
+  using AliRDHFCuts::GetCutVarsForOpt;
+  virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters);
+
+  using AliRDHFCuts::IsSelected;
+  virtual Int_t IsSelected(TObject* obj,Int_t selectionLevel);
+  using AliRDHFCuts::IsSelectedPID;
+  virtual Int_t IsSelectedPID(AliAODRecoDecayHF* obj);
+  Int_t IsSelectedCombinedPID(AliAODRecoDecayHF* obj);
+  Double_t GetProtonProbabilityTPCTOF(AliAODTrack *trk);
+
+  void SetPIDStrategy(EPIDStrategy pidStrategy){fPIDStrategy=pidStrategy;}
+  EPIDStrategy GetPIDStrategy() const {return fPIDStrategy;}
+  void SetCombinedPIDThreshold(Double_t a){fCombinedPIDThreshold=a;}
+  Double_t GetCombinedPIDThreshold(){return fCombinedPIDThreshold;}
+
+  void SetUseOnTheFlyV0(Bool_t a) { fUseOnTheFlyV0=a; }
+  Bool_t GetUseOnTheFlyV0() { return fUseOnTheFlyV0; }
+
+  Bool_t SingleTrkCuts(AliAODTrack *trk);
+  Bool_t SingleV0Cuts(AliAODv0 *v0, AliAODVertex *vert);
+  Bool_t SelectWithRoughCuts(AliAODv0 *v0, AliAODTrack *trk1);
+
+  void SetProdTrackPtMin(Double_t a){fProdTrackPtMin=a;}
+  void SetProdTrackEtaRange(Double_t a){fProdTrackEtaRange=a;}
+  void SetProdUseAODFilterBit(Bool_t a){fProdUseAODFilterBit=a;}
+  void SetProdV0MassTolK0s(Double_t a){fProdV0MassTolK0s=a;}
+  void SetProdV0PtMin(Double_t a){fProdV0PtMin=a;}
+  void SetProdV0CosPointingAngleToPrimVtxMin(Double_t a){fProdV0CosPointingAngleToPrimVtxMin=a;}
+  void SetProdV0DcaDaughtersMax(Double_t a){fProdV0DcaDaughtersMax=a;}
+  void SetProdV0DaughterEtaRange(Double_t a){fProdV0DaughterEtaRange=a;}
+  void SetProdV0DaughterPtMin(Double_t a){fProdV0DaughterPtMin=a;}
+  void SetProdV0DaughterTPCClusterMin(Double_t a){fProdV0DaughterTPCClusterMin=a;}
+  
+  void SetProdRoughMassTol(Double_t a){fProdRoughMassTol=a;}
+  void SetProdRoughPtMin(Double_t a){fProdRoughPtMin=a;}
+  
+  Double_t GetProdTrackPtMin(){return fProdTrackPtMin;}
+  Double_t GetProdTrackEtaRange(){return fProdTrackEtaRange;}
+  Bool_t   GetProdUseAODFilterBit(){return fProdUseAODFilterBit;}
+  Double_t GetProdV0MassTolK0s(){return fProdV0MassTolK0s;}
+  Double_t GetProdV0PtMin(){return fProdV0PtMin;}
+  Double_t GetProdV0CosPointingAngleToPrimVtxMin(){return fProdV0CosPointingAngleToPrimVtxMin;}
+  Double_t GetProdV0DcaDaughtersMax(){return fProdV0DcaDaughtersMax;}
+  Double_t GetProdV0DaughterEtaRange(){return fProdV0DaughterEtaRange;}
+  Double_t GetProdV0DaughterPtMin(){return fProdV0DaughterPtMin;}
+  Double_t GetProdV0DaughterTPCClusterMin(){return fProdV0DaughterTPCClusterMin;}
+  
+  Double_t GetProdRoughMassTol(){return fProdRoughMassTol;}
+  Double_t GetProdRoughPtMin(){return fProdRoughPtMin;}
+  
+  void  SetNCuts(Int_t ncuts){fnCuts=ncuts;}
+  Int_t GetNCutsArray(){return fnCuts;}
+  void  SetCutsArray(Int_t nCuts, Int_t nVars,Int_t nPtBins,Float_t ***cutsRD);
+  void  SetCutsArray(Int_t nTotBins,Float_t *cutsRD);
+  void  SetCutsFromArray(Int_t nCuts);
+  Int_t GetCutArrayID(Int_t ic,Int_t iv,Int_t ip);
+
+ protected:
+       
+ private:
+
+  EPIDStrategy fPIDStrategy;        //PID strategy
+  Double_t fCombinedPIDThreshold;   //Threshold used in  IsSelectedCombinedPID 
+  Bool_t   fUseOnTheFlyV0;          //Flag to check if we use on-the-fly v0
+  
+  Double_t fProdTrackPtMin;         //Minimum Track pT used before object creation
+  Double_t fProdTrackEtaRange;      //eta range used before object creation
+  Bool_t   fProdUseAODFilterBit;    //Flag for AOD filter Bit used before object creation
+  Double_t fProdV0MassTolK0s;       //K0s mass selection  used before object creation
+  Double_t fProdV0PtMin;            //Minimum K0s pT used before object creation
+  Double_t fProdV0CosPointingAngleToPrimVtxMin;//V0 pointing angle used before object creation
+  Double_t fProdV0DcaDaughtersMax;  //Max DCA between V0 daughters used before object creation
+  Double_t fProdV0DaughterEtaRange; //V0Daughter eta range used before object creation
+  Double_t fProdV0DaughterPtMin;    //V0 Daughter pT min used before object creation
+  Double_t fProdV0DaughterTPCClusterMin;//V0 daughter Minimum TPC cluster pT used before object creation
+  Double_t fProdRoughMassTol;       //Mass cut for Lc used before object creation
+  Double_t fProdRoughPtMin;         //pT cut for Lc used before object creation
+  
+  Int_t fnCuts;               //Number of Cuts defined 
+  Int_t fnTotalCutBins;       // fnCuts *fnVars * fnPtBins
+  Float_t *fCutsArray;        //[fnTotalCutBins]
+
+  ClassDef(AliRDHFCutsLctopK0sfromAODtracks,1);
+};
+
+#endif
diff --git a/PWGHF/vertexingHF/AliRDHFCutsXicPlustoXiPiPifromAODtracks.cxx b/PWGHF/vertexingHF/AliRDHFCutsXicPlustoXiPiPifromAODtracks.cxx
new file mode 100644 (file)
index 0000000..3f64815
--- /dev/null
@@ -0,0 +1,658 @@
+/**************************************************************************
+ * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/////////////////////////////////////////////////////////////
+//
+// Class for cuts on AOD reconstructed Lc->p+K0s
+//
+// Modified by Y.S Watanabe - wyosuke@cns.s.u-tokyo.ac.jp
+//
+/////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+
+#include <TDatabasePDG.h>
+#include <TMath.h>
+
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+#include "AliPIDResponse.h"
+#include "AliRDHFCutsXicPlustoXiPiPifromAODtracks.h"
+#include "AliAODRecoCascadeHF3Prong.h"
+#include "AliAODTrack.h"
+#include "AliESDtrack.h"
+#include "AliESDVertex.h"
+#include "AliAODVertex.h"
+#include "AliAODv0.h"
+#include "AliAODcascade.h"
+#include "AliESDv0.h"
+
+using std::cout;
+using std::endl;
+
+ClassImp(AliRDHFCutsXicPlustoXiPiPifromAODtracks)
+
+//--------------------------------------------------------------------------
+AliRDHFCutsXicPlustoXiPiPifromAODtracks::AliRDHFCutsXicPlustoXiPiPifromAODtracks(const char* name) :
+  AliRDHFCuts(name),
+  fPIDStrategy(kNSigmaCuts),
+  fCombinedPIDThreshold(0.),
+  fProdTrackPtMin(0.),
+  fProdTrackEtaRange(9999.),
+  fProdUseAODFilterBit(kTRUE),
+  fProdMassTolLambda(0.010),
+  fProdMassTolXi(0.008),
+  fProdRfidMinV0(0.6),
+  fProdRfidMaxV0(100.0),
+  fProdRfidMinXi(0.6),
+  fProdRfidMaxXi(100.0),
+  fProdLikeSignDcaMax(2.0),
+  fProdRoughMassTol(0.25),
+  fProdRoughPtMin(0.0),
+  fnCuts(0),
+  fnTotalCutBins(1),
+  fCutsArray(0)
+{
+  //
+  // Default Constructor
+  //
+
+  const Int_t nvars=13;
+  SetNVars(nvars);
+  TString varNames[nvars]={"Xic inv. mass [GeV/c2]",                   //  0
+                          "Xic Pt [GeV/c]", //1
+                          "Xi mass Tolrelance [GeV/c2]", //2
+                          "Lambda mass Tolrelance [GeV/c2]", //3
+                          "Max DCA pi-pi [cm]", //4
+                          "Max DCA pi-casc [cm]",//5
+                          "Max d0 pi [cm]",//6
+                          "Max d0 Xi [cm]",//7
+                          "Min d0 Xi-Bach [cm]",//8
+                          "Min d0 Xi-V0 [cm]",//9
+                          "Min Xic cosPA ",//10
+                          "Min DecayLengthXY ",//11
+                          "Min Bachelor pT"//12
+  };
+
+  Bool_t isUpperCut[nvars]={kTRUE,  //  0
+                           kFALSE, //1
+                           kTRUE, //2
+                           kTRUE, //3
+                           kTRUE, //4
+                           kTRUE, //5
+                           kTRUE, //6
+                           kTRUE, //7
+                           kFALSE, //8
+                           kFALSE, //9
+                           kFALSE, //10
+                           kFALSE,//11
+                           kFALSE //12
+  };
+  SetVarNames(nvars,varNames,isUpperCut);
+  Bool_t forOpt[nvars]={kFALSE, //  0
+                       kFALSE, //1
+                       kTRUE, //2
+                       kTRUE, //3
+                       kTRUE, //4
+                       kTRUE, //5
+                       kTRUE, //6
+                       kTRUE, //7
+                       kTRUE, //8
+                       kTRUE, //9
+                       kTRUE, //10
+                       kTRUE, //11
+                       kTRUE //12
+  };
+  SetVarsForOpt(nvars,forOpt);
+
+  Float_t limits[2]={0,999999999.};
+  SetPtBins(2,limits);
+}
+
+//--------------------------------------------------------------------------
+AliRDHFCutsXicPlustoXiPiPifromAODtracks::AliRDHFCutsXicPlustoXiPiPifromAODtracks(const AliRDHFCutsXicPlustoXiPiPifromAODtracks &source) :
+  AliRDHFCuts(source),
+  fPIDStrategy(source.fPIDStrategy),
+  fCombinedPIDThreshold(source.fCombinedPIDThreshold),
+  fProdTrackPtMin(source.fProdTrackPtMin),
+  fProdTrackEtaRange(source.fProdTrackEtaRange),
+  fProdUseAODFilterBit(source.fProdUseAODFilterBit),
+  fProdMassTolLambda(source.fProdMassTolLambda),
+  fProdMassTolXi(source.fProdMassTolXi),
+  fProdRfidMinV0(source.fProdRfidMinV0),
+  fProdRfidMaxV0(source.fProdRfidMaxV0),
+  fProdRfidMinXi(source.fProdRfidMinXi),
+  fProdRfidMaxXi(source.fProdRfidMaxXi),
+  fProdLikeSignDcaMax(source.fProdLikeSignDcaMax),
+  fProdRoughMassTol(source.fProdRoughMassTol),
+  fProdRoughPtMin(source.fProdRoughPtMin),
+  fnCuts(source.fnCuts),
+  fnTotalCutBins(source.fnTotalCutBins),
+  fCutsArray(0)
+{
+  //
+  // Copy constructor
+  //
+  if(source.fCutsArray) SetCutsArray(source.fnTotalCutBins,source.fCutsArray);
+}
+
+//--------------------------------------------------------------------------
+AliRDHFCutsXicPlustoXiPiPifromAODtracks &AliRDHFCutsXicPlustoXiPiPifromAODtracks::operator=(const AliRDHFCutsXicPlustoXiPiPifromAODtracks &source)
+{
+  //
+  // assignment operator
+  //
+
+  if (this != &source) {
+    AliRDHFCuts::operator=(source);
+  }
+
+  fPIDStrategy = source.fPIDStrategy;
+  fCombinedPIDThreshold = source.fCombinedPIDThreshold;
+  fProdUseAODFilterBit = source.fProdUseAODFilterBit;
+  fProdTrackPtMin = source.fProdTrackPtMin;
+  fProdTrackEtaRange = source.fProdTrackEtaRange;
+  fProdMassTolLambda = source.fProdMassTolLambda;
+  fProdMassTolXi = source.fProdMassTolXi;
+  fProdRfidMinV0 = source.fProdRfidMinV0;
+  fProdRfidMaxV0 = source.fProdRfidMaxV0;
+  fProdRfidMinXi = source.fProdRfidMinXi;
+  fProdRfidMaxXi = source.fProdRfidMaxXi;
+  fProdLikeSignDcaMax = source.fProdLikeSignDcaMax;
+  fProdRoughMassTol = source.fProdRoughMassTol;
+  fProdRoughPtMin = source.fProdRoughPtMin;
+  fnCuts = source.fnCuts;
+  fnTotalCutBins = source.fnCuts;
+  if(source.fCutsArray) SetCutsArray(source.fnTotalCutBins,source.fCutsArray);
+
+  return *this;
+}
+
+//---------------------------------------------------------------------------
+AliRDHFCutsXicPlustoXiPiPifromAODtracks::~AliRDHFCutsXicPlustoXiPiPifromAODtracks() {
+  //
+  //  Default Destructor
+  //
+  if(fCutsArray) delete[] fCutsArray;
+}
+
+//---------------------------------------------------------------------------
+void AliRDHFCutsXicPlustoXiPiPifromAODtracks::GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters) {
+  //
+  // Fills in vars the values of the variables
+  //
+
+  if (pdgdaughters[0]==-9999) return; // dummy
+
+  AliAODRecoCascadeHF3Prong* dd=(AliAODRecoCascadeHF3Prong*)d;
+  if(!dd){
+    AliDebug(2," No AliAODRecoCascadeHF3Prong object found\n");
+    return;
+  }
+
+  if (nvars!=fnVarsForOpt) {
+    AliError("AliRDHFCutsXicPlustoXiPiPifromAODtracks wrong number of variables\n");
+    return;
+  }
+
+  //Double_t ptD=d->Pt();
+  //Int_t ptbin=PtBin(ptD);
+  Int_t iter=-1;
+
+  if(fVarsForOpt[0]){
+    iter++;
+    Double_t mxicPDG =  TDatabasePDG::Instance()->GetParticle(4232)->Mass();
+    vars[iter]= TMath::Abs(dd->InvMassPiXiPi()-mxicPDG) ;
+  }
+  if(fVarsForOpt[1]){
+    iter++;
+    vars[iter]= dd->Pt();
+  }
+  if(fVarsForOpt[2]){
+    iter++;
+    Double_t mxiPDG =  TDatabasePDG::Instance()->GetParticle(3312)->Mass();
+    vars[iter]= TMath::Abs(dd->CascMassXi()-mxiPDG);
+  }
+  if(fVarsForOpt[3]){
+    iter++;
+    Double_t mLPDG =  TDatabasePDG::Instance()->GetParticle(3122)->Mass();
+    vars[iter]= TMath::Abs(dd->CascMassLambda()-mLPDG);
+  }
+  Double_t dca[3];
+  dd->GetDCAs(dca);
+  if(fVarsForOpt[4]){
+    iter++;
+    vars[iter]= dca[2];
+  }
+  if(fVarsForOpt[5]){
+    iter++;
+    vars[iter]= dca[0];
+  }
+  if(fVarsForOpt[6]){
+    iter++;
+    vars[iter]= dd->Getd0Prong(0);
+  }
+  if(fVarsForOpt[7]){
+    iter++;
+    vars[iter]= dd->Getd0Prong(1);
+  }
+  if(fVarsForOpt[8]){
+    iter++;
+    vars[iter]= dd->CascDcaBachToPrimVertex();
+  }
+  if(fVarsForOpt[9]){
+    iter++;
+    vars[iter]= dd->CascDcaV0ToPrimVertex();
+  }
+  if(fVarsForOpt[10]){
+    iter++;
+    vars[iter]= dd->XicCosPointingAngle();
+  }
+  if(fVarsForOpt[11]){
+    iter++;
+    vars[iter]= dd->DecayLengthXY();
+  }
+  if(fVarsForOpt[12]){
+    iter++;
+    vars[iter]= dd->PtProng(0);
+  }
+
+  return;
+}
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::IsSelected(TObject* obj,Int_t selectionLevel) 
+{
+  //
+  // Apply selection
+  //
+
+  if (!fCutsRD) {
+    AliFatal("Cut matrice not inizialized. Exit...");
+    return 0;
+  }
+
+  AliAODRecoCascadeHF3Prong* d=(AliAODRecoCascadeHF3Prong*)obj;
+  if(!d){
+    AliDebug(2," No AliAODRecoCascadeHF3Prong object found\n");
+    return 0;
+  }
+
+  Double_t ptD=d->Pt();
+  if(ptD<fMinPtCand) return 0;
+  if(ptD>fMaxPtCand) return 0;
+
+  if (selectionLevel==AliRDHFCuts::kAll ||
+      selectionLevel==AliRDHFCuts::kTracks) {
+    //Performed in production stage
+  }
+
+  Int_t returnvalueCuts=1;
+  // selection on candidate
+  if (selectionLevel==AliRDHFCuts::kAll ||
+      selectionLevel==AliRDHFCuts::kCandidate) {
+
+    Double_t pt=d->Pt();
+    Int_t ptbin=PtBin(pt);
+    if (ptbin==-1) {
+      return 0;
+    }
+    Bool_t okcand=kTRUE;
+
+    Double_t mLPDG =  TDatabasePDG::Instance()->GetParticle(3122)->Mass();
+    Double_t mxiPDG =  TDatabasePDG::Instance()->GetParticle(3312)->Mass();
+    Double_t mxicPDG =  TDatabasePDG::Instance()->GetParticle(4232)->Mass();
+    if(TMath::Abs(d->InvMassPiXiPi()-mxicPDG) > fCutsRD[GetGlobalIndex(0,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(d->Pt()< fCutsRD[GetGlobalIndex(1,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if(TMath::Abs(d->CascMassXi()-mxiPDG) > fCutsRD[GetGlobalIndex(2,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if((TMath::Abs(d->CascMassLambda()-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) &&(TMath::Abs(d->CascMassAntiLambda()-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) )
+      {
+       okcand = kFALSE;
+      }
+    Double_t dca[3];
+    d->GetDCAs(dca);
+    if(TMath::Abs(dca[2]) > fCutsRD[GetGlobalIndex(4,ptbin)])
+      {
+       okcand = kFALSE;
+      }
+    if((TMath::Abs(dca[0]) > fCutsRD[GetGlobalIndex(5,ptbin)]) && (TMath::Abs(dca[1]) > fCutsRD[GetGlobalIndex(5,ptbin)]) ) 
+      {
+       okcand = kFALSE;
+      }
+    if((TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) && (TMath::Abs(d->Getd0Prong(2)) > fCutsRD[GetGlobalIndex(6,ptbin)]) ) 
+      {
+       okcand = kFALSE;
+      }
+    if((TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(7,ptbin)])) 
+      {
+       okcand = kFALSE;
+      }
+    if((TMath::Abs(d->CascDcaBachToPrimVertex()) < fCutsRD[GetGlobalIndex(8,ptbin)])) 
+      {
+       okcand = kFALSE;
+      }
+    if((TMath::Abs(d->CascDcaV0ToPrimVertex()) < fCutsRD[GetGlobalIndex(9,ptbin)])) 
+      {
+       okcand = kFALSE;
+      }
+    if( d->XicCosPointingAngle() < fCutsRD[GetGlobalIndex(10,ptbin)]) 
+      {
+       okcand = kFALSE;
+      }
+    if( d->DecayLengthXY() < fCutsRD[GetGlobalIndex(11,ptbin)]) 
+      {
+       okcand = kFALSE;
+      }
+    if( d->PtProng(0) < fCutsRD[GetGlobalIndex(12,ptbin)] || d->PtProng(2) < fCutsRD[GetGlobalIndex(12,ptbin)]  ) 
+      {
+       okcand = kFALSE;
+      }
+
+    if(!okcand)  return 0;
+    returnvalueCuts = 1;
+  }
+
+  Int_t returnvaluePID=1;
+  if(selectionLevel==AliRDHFCuts::kAll ||
+     selectionLevel==AliRDHFCuts::kCandidate|| 
+     selectionLevel==AliRDHFCuts::kPID) {
+
+    switch(fPIDStrategy){
+    case kNSigmaCuts:
+      returnvaluePID = IsSelectedPID(d);
+      break;
+    case kCombinedCuts:
+      returnvaluePID = IsSelectedCombinedPID(d);
+      break;
+    }
+  }
+
+  Int_t returnvalue = 0;
+  if(returnvalueCuts==1 && returnvaluePID==1) returnvalue=1;
+
+  return returnvalue;
+}
+
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::IsSelectedPID(AliAODRecoDecayHF* obj) 
+{
+  //
+  //  PID selection
+  //
+
+  if(!fUsePID || !obj) return 1;
+
+  AliAODRecoCascadeHF3Prong* dd=(AliAODRecoCascadeHF3Prong*)obj;
+  AliAODTrack *part1 = dd->GetBachelor1();
+  AliAODTrack *part2 = dd->GetBachelor2();
+
+  Int_t returnvalue=1;
+
+  if(fPidHF->GetPidResponse()==0x0){
+    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+    AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
+    AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
+    fPidHF->SetPidResponse(pidResp);
+  }
+
+  Int_t isPion1=fPidHF->MakeRawPid(part1,2); 
+  Int_t isPion2=fPidHF->MakeRawPid(part2,2); 
+
+  if(isPion1<1) returnvalue = 0;
+  if(isPion2<1) returnvalue = 0;
+
+  return returnvalue;
+}
+
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::IsSelectedCombinedPID(AliAODRecoDecayHF* obj) {
+  //
+  //  Combined PID selection
+  //
+    
+  if(!fUsePID || !obj) {return 1;}
+
+  AliAODRecoCascadeHF3Prong* dd=(AliAODRecoCascadeHF3Prong*)obj;
+  AliAODTrack *part1 = dd->GetBachelor1();
+  AliAODTrack *part2 = dd->GetBachelor2();
+  if(!part1||!part2) return 0;
+
+  Int_t returnvalue=1;
+  Double_t probPion1 = GetPionProbabilityTPCTOF(part1);
+  Double_t probPion2 = GetPionProbabilityTPCTOF(part2);
+  if(probPion1<fCombinedPIDThreshold) returnvalue = 0;
+  if(probPion2<fCombinedPIDThreshold) returnvalue = 0;
+  return returnvalue;
+}
+
+//________________________________________________________________________
+Double_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::GetPionProbabilityTPCTOF(AliAODTrack* trk) 
+{
+  //
+  //  Get Pion Probablility
+  //
+  //fPidHF->GetPidCombined()->SetDefaultTPCPriors();
+  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
+  Double_t prob1[AliPID::kSPECIES];
+  UInt_t detUsed1 = fPidHF->GetPidCombined()->ComputeProbabilities(trk, fPidHF->GetPidResponse(), prob1);
+  if (detUsed1 != (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask() ) 
+    { 
+      fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
+      detUsed1 = fPidHF->GetPidCombined()->ComputeProbabilities(trk, fPidHF->GetPidResponse(), prob1);
+    }
+  return prob1[AliPID::kPion];
+}
+
+//________________________________________________________________________
+Bool_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::SingleTrkCuts(AliAODTrack *trk)
+{
+  //
+  //  Single Track Cut
+  //
+  
+  if(trk->GetStatus()&AliESDtrack::kITSpureSA) return kFALSE;
+  if(!(trk->GetStatus()&AliESDtrack::kITSin)) return kFALSE;
+
+  if(fProdUseAODFilterBit && !trk->TestFilterMask(BIT(4))) return kFALSE;
+  //   if(!fAnalCuts->IsDaughterSelected(trk,fV1,esdTrackCuts)) return kFALSE;
+  if(fabs(trk->Eta())>fProdTrackEtaRange) return kFALSE;
+  if(trk->Pt()<fProdTrackPtMin) return kFALSE;
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::SingleCascadeCuts(AliAODcascade *casc)
+{
+  //
+  //  Single Cascade Cut
+  //
+       
+  if(!casc) return kFALSE;
+
+  AliAODTrack *ptrack = (AliAODTrack*) (casc->GetDaughter(0));
+  AliAODTrack *ntrack = (AliAODTrack*) (casc->GetDaughter(1));
+  AliAODTrack *btrack = (AliAODTrack*) (casc->GetDecayVertexXi()->GetDaughter(0));
+  
+  if(!ptrack||!ntrack||!btrack) return kFALSE;
+
+  Double_t mLPDG =  TDatabasePDG::Instance()->GetParticle(3122)->Mass();
+  Double_t mxiPDG =  TDatabasePDG::Instance()->GetParticle(3312)->Mass();
+  
+  Double_t massLambda = casc->MassLambda();
+  Double_t massAntiLambda = casc->MassAntiLambda();
+  if(TMath::Abs(massLambda-mLPDG)>fProdMassTolLambda && TMath::Abs(massAntiLambda-mLPDG)>fProdMassTolLambda) 
+    return kFALSE;
+  
+  Double_t massXi = casc->MassXi();
+  if(TMath::Abs(massXi-mxiPDG)>fProdMassTolXi)
+    return kFALSE;
+  
+  Double_t lPosXi[3];
+  lPosXi[0] = casc->DecayVertexXiX();
+  lPosXi[1] = casc->DecayVertexXiY();
+  lPosXi[2] = casc->DecayVertexXiZ();
+  Double_t decayvertXi = TMath::Sqrt(lPosXi[0]*lPosXi[0]+lPosXi[1]*lPosXi[1]);
+  Double_t lPosV0[3];
+  lPosV0[0] = casc->DecayVertexV0X();
+  lPosV0[1] = casc->DecayVertexV0Y();
+  lPosV0[2] = casc->DecayVertexV0Z();
+  Double_t decayvertV0 = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
+  
+  if(decayvertV0<fProdRfidMinV0 || decayvertV0>fProdRfidMaxV0) return kFALSE;
+  if(decayvertXi<fProdRfidMinXi || decayvertXi>fProdRfidMaxXi) return kFALSE;
+  
+  return kTRUE;
+}
+
+//________________________________________________________________________
+Bool_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::SelectWithRoughCuts(AliAODcascade *casc, AliAODTrack *part1, AliAODTrack *part2)
+{
+  //
+  //  Select With Rough mass and pT cut before object creation
+  //
+
+  //Constants
+  Double_t mpiPDG =  TDatabasePDG::Instance()->GetParticle(211)->Mass();
+  Double_t mxiPDG =  TDatabasePDG::Instance()->GetParticle(3312)->Mass();
+  Double_t mxicPDG =  TDatabasePDG::Instance()->GetParticle(4232)->Mass();
+
+  Double_t pxpi1_init = part1->Px();
+  Double_t pypi1_init = part1->Py();
+  Double_t pzpi1_init = part1->Pz();
+  Double_t Epi1_init = sqrt(pxpi1_init*pxpi1_init+pypi1_init*pypi1_init+pzpi1_init*pzpi1_init+mpiPDG*mpiPDG);
+  Double_t pxpi2_init = part2->Px();
+  Double_t pypi2_init = part2->Py();
+  Double_t pzpi2_init = part2->Pz();
+  Double_t Epi2_init = sqrt(pxpi2_init*pxpi2_init+pypi2_init*pypi2_init+pzpi2_init*pzpi2_init+mpiPDG*mpiPDG);
+  Double_t pxcasc_init = casc->MomXiX();
+  Double_t pycasc_init = casc->MomXiY();
+  Double_t pzcasc_init = casc->MomXiZ();
+  Double_t Ecasc_init = sqrt(pxcasc_init*pxcasc_init+pycasc_init*pycasc_init+pzcasc_init*pzcasc_init+mxiPDG*mxiPDG);
+  Double_t pxxic_init = pxpi1_init+pxpi2_init+pxcasc_init;
+  Double_t pyxic_init = pypi1_init+pypi2_init+pycasc_init;
+  Double_t pzxic_init = pzpi1_init+pzpi2_init+pzcasc_init;
+  Double_t Exic_init = Epi1_init+Epi2_init+Ecasc_init;
+  Double_t xicmass_init = sqrt(Exic_init*Exic_init-pxxic_init*pxxic_init-pyxic_init*pyxic_init-pzxic_init*pzxic_init);
+  
+  if(xicmass_init<mxicPDG-fProdRoughMassTol || xicmass_init>mxicPDG+fProdRoughMassTol) return kFALSE;
+  if(sqrt(pxxic_init*pxxic_init+pyxic_init*pyxic_init)<fProdRoughPtMin) return kFALSE;
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+void AliRDHFCutsXicPlustoXiPiPifromAODtracks::SetCutsArray(Int_t nCuts, Int_t nVars, Int_t nPtBins, Float_t ***cutsArray) 
+{
+  //
+  // store the cuts
+  //
+  if (nVars!=fnVars) {
+    AliError(" wrong number of variables\n");
+    return;
+  }
+  if (nCuts!=fnCuts) {
+    AliError(" wrong number of cuts\n");
+    return;
+  }
+  if (nPtBins!=fnPtBins) {
+    AliError(" wrong number of pT bins\n");
+    return;
+  }
+
+  if(!fCutsArray)
+    {
+      fnTotalCutBins = nCuts * nVars * nPtBins;
+      fCutsArray = new Float_t[fnTotalCutBins];
+    }
+
+  for(Int_t icuts=0;icuts<nCuts;icuts++){
+    for(Int_t iv=0;iv<nVars;iv++){
+      for(Int_t ip=0;ip<nPtBins;ip++){
+       Int_t gid = GetCutArrayID(icuts,iv,ip);
+       fCutsArray[gid] = cutsArray[icuts][iv][ip];
+      }
+    }
+  }
+  return;
+}
+
+//________________________________________________________________________
+void AliRDHFCutsXicPlustoXiPiPifromAODtracks::SetCutsArray(Int_t nTotBins, Float_t *cutsArray) 
+{
+  //
+  // store the cuts
+  //
+  if (nTotBins!=fnVars*fnPtBins*fnCuts) {
+    AliError(" wrong number of variables\n");
+    return;
+  }
+
+  if(!fCutsArray)
+    {
+      fnTotalCutBins = fnCuts * fnVars * fnPtBins;
+      fCutsArray = new Float_t[fnTotalCutBins];
+    }
+
+  for(Int_t i=0;i<nTotBins;i++){
+    fCutsArray[i] = cutsArray[i];
+  }
+
+  return;
+}
+
+//________________________________________________________________________
+void AliRDHFCutsXicPlustoXiPiPifromAODtracks::SetCutsFromArray(Int_t iCuts) 
+{
+  //
+  //  Update fCutsRD
+  //
+
+  Float_t** cutsarray;
+  cutsarray=new Float_t*[fnVars];
+  for(Int_t ic=0;ic<fnVars;ic++){cutsarray[ic]=new Float_t[fnPtBins];}
+
+  for(Int_t i=0;i<fnVars;i++){
+    for(Int_t j=0;j<fnPtBins;j++){
+      Int_t gid = GetCutArrayID(iCuts,i,j);
+      cutsarray[i][j] = fCutsArray[gid];
+    }
+  }
+  SetCuts(fnVars,fnPtBins,cutsarray);
+
+  for(Int_t ic=0;ic<fnVars;ic++){
+    delete[] cutsarray[ic];
+  }
+  delete[] cutsarray;
+}
+
+//________________________________________________________________________
+Int_t AliRDHFCutsXicPlustoXiPiPifromAODtracks::GetCutArrayID(Int_t ic, Int_t iv, Int_t ip) 
+{
+  //
+  //  Get GlobalIndex of fCutsArray
+  //
+  return ic*fnVars*fnPtBins+iv*fnPtBins+ip;
+}
diff --git a/PWGHF/vertexingHF/AliRDHFCutsXicPlustoXiPiPifromAODtracks.h b/PWGHF/vertexingHF/AliRDHFCutsXicPlustoXiPiPifromAODtracks.h
new file mode 100644 (file)
index 0000000..b82edd3
--- /dev/null
@@ -0,0 +1,109 @@
+#ifndef ALIRDHFCUTSXICPLUSTOXIPIPIFROMAODTRACKS_H
+#define ALIRDHFCUTSXICPLUSTOXIPIPIFROMAODTRACKS_H
+/* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//***********************************************************
+// Class AliRDHFCutsXictoPLUSXiPiPifromAODtracks
+// class for cuts on AOD reconstructed Xic-> pi Xi pi
+//***********************************************************
+
+#include "AliRDHFCuts.h"
+
+class AliRDHFCutsXicPlustoXiPiPifromAODtracks : public AliRDHFCuts
+{
+ public:
+
+  enum EPIDStrategy{
+    kNSigmaCuts,
+    kCombinedCuts
+  };
+
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks(const char* name="CutsXicPlustoXiPiPi");
+  virtual ~AliRDHFCutsXicPlustoXiPiPifromAODtracks();
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks(const AliRDHFCutsXicPlustoXiPiPifromAODtracks& source);
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks& operator=(const AliRDHFCutsXicPlustoXiPiPifromAODtracks& source);
+
+  using AliRDHFCuts::GetCutVarsForOpt;
+  virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters);
+
+  using AliRDHFCuts::IsSelected;
+  virtual Int_t IsSelected(TObject* obj,Int_t selectionLevel);
+  using AliRDHFCuts::IsSelectedPID;
+  virtual Int_t IsSelectedPID(AliAODRecoDecayHF* obj);
+  Int_t IsSelectedCombinedPID(AliAODRecoDecayHF* obj);
+  Double_t GetPionProbabilityTPCTOF(AliAODTrack *trk);
+
+  void SetPIDStrategy(EPIDStrategy pidStrategy){fPIDStrategy=pidStrategy;}
+  EPIDStrategy GetPIDStrategy() const {return fPIDStrategy;}
+  void SetCombinedPIDThreshold(Double_t a){fCombinedPIDThreshold=a;}
+  Double_t GetCombinedPIDThreshold(){return fCombinedPIDThreshold;}
+
+
+  Bool_t SingleTrkCuts(AliAODTrack *trk);
+  Bool_t SingleCascadeCuts(AliAODcascade *casc);
+  Bool_t SelectWithRoughCuts(AliAODcascade *casc, AliAODTrack *trk1, AliAODTrack *trk2);
+
+  void SetProdTrackPtMin(Double_t a){fProdTrackPtMin=a;}
+  void SetProdTrackEtaRange(Double_t a){fProdTrackEtaRange=a;}
+  void SetProdUseAODFilterBit(Bool_t a){fProdUseAODFilterBit=a;}
+  void SetProdMassTolLambda(Double_t a){fProdMassTolLambda=a;}
+  void SetProdMassTolXi(Double_t a){fProdMassTolXi=a;}
+  void SetProdRfidMinV0(Double_t a){fProdRfidMinV0=a;}
+  void SetProdRfidMaxV0(Double_t a){fProdRfidMaxV0=a;}
+  void SetProdRfidMinXi(Double_t a){fProdRfidMinXi=a;}
+  void SetProdRfidMaxXi(Double_t a){fProdRfidMaxXi=a;}
+  void SetProdRoughMassTol(Double_t a){fProdRoughMassTol=a;}
+  void SetProdRoughPtMin(Double_t a){fProdRoughPtMin=a;}
+  void SetProdLikeSignDcaMax(Double_t a){fProdLikeSignDcaMax=a;}
+
+  Double_t GetProdTrackPtMin(){return fProdTrackPtMin;}
+  Double_t GetProdTrackEtaRange(){return fProdTrackEtaRange;}
+  Bool_t   GetProdUseAODFilterBit(){return fProdUseAODFilterBit;}
+  Double_t GetProdMassTolLambda(){return fProdMassTolLambda;}
+  Double_t GetProdMassTolXi(){return fProdMassTolXi;}
+  Double_t GetProdRfidMinV0(){return fProdRfidMinV0;}
+  Double_t GetProdRfidMaxV0(){return fProdRfidMaxV0;}
+  Double_t GetProdRfidMinXi(){return fProdRfidMinXi;}
+  Double_t GetProdRfidMaxXi(){return fProdRfidMaxXi;}
+  Double_t GetProdRoughMassTol(){return fProdRoughMassTol;}
+  Double_t GetProdRoughPtMin(){return fProdRoughPtMin;}
+  Double_t GetProdLikeSignDcaMax(){return fProdLikeSignDcaMax;}
+
+  void  SetNCuts(Int_t ncuts){fnCuts=ncuts;}
+  Int_t GetNCutsArray(){return fnCuts;}
+  void  SetCutsArray(Int_t nCuts, Int_t nVars,Int_t nPtBins,Float_t ***cutsRD);
+  void  SetCutsArray(Int_t nTotBins,Float_t *cutsRD);
+  void  SetCutsFromArray(Int_t nCuts);
+  Int_t GetCutArrayID(Int_t ic,Int_t iv,Int_t ip);
+
+ protected:
+       
+ private:
+
+  EPIDStrategy fPIDStrategy;        //PID Strategy
+  Double_t fCombinedPIDThreshold;   //PID threshold used in IsSelectedCombinedPID
+
+  Double_t fProdTrackPtMin;         //Minimum Bachelor pT 
+  Double_t fProdTrackEtaRange;      //Bachelor Eta range
+  Bool_t   fProdUseAODFilterBit;    //Use AODfilterBit or not
+  Double_t fProdMassTolLambda;      //Tolerance of Lambda mass from PDG value
+  Double_t fProdMassTolXi;          //Tolerance of Xi mass from PDG value
+  Double_t fProdRfidMinV0;          //Minimum Decay vertex of V0
+  Double_t fProdRfidMaxV0;          //Max Decay vertex of V0
+  Double_t fProdRfidMinXi;          //Minimum Decay vertex of Xi
+  Double_t fProdRfidMaxXi;          //Max Decay vertex of Xi
+  Double_t fProdLikeSignDcaMax;     //Maximum DCA of pions
+  Double_t fProdRoughMassTol;       //Tolerance of Xic mass from PDG value 
+  Double_t fProdRoughPtMin;         //Minimum pT of Xic
+
+  Int_t fnCuts;                    //Number of Cuts
+  Int_t fnTotalCutBins;            //fnCuts * fnvars * fnPtBins
+  Float_t *fCutsArray;             //[fnTotalCutBins]
+
+  ClassDef(AliRDHFCutsXicPlustoXiPiPifromAODtracks,1); 
+};
+
+#endif
index cc721e4635217d94228c0b15687aa5fa6929dbcc..ca27f2b8305fcd4f8f5293aec3ced182cb5676a3 100644 (file)
@@ -42,6 +42,7 @@ set(SRCS
   AliAODRecoDecayHF3Prong.cxx 
   AliAODRecoDecayHF4Prong.cxx 
   AliAODRecoCascadeHF.cxx 
+  AliAODRecoCascadeHF3Prong.cxx
   AliAODPidHF.cxx 
   AliRDHFCuts.cxx 
   AliVertexingHFUtils.cxx 
@@ -54,6 +55,8 @@ set(SRCS
   AliRDHFCutsLctoV0.cxx 
   AliRDHFCutsD0toKpipipi.cxx 
   AliRDHFCutsDStartoKpipi.cxx 
+  AliRDHFCutsLctopK0sfromAODtracks.cxx
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks.cxx
   AliAnalysisVertexingHF.cxx 
   AliAnalysisTaskSEVertexingHF.cxx 
   AliAnalysisTaskMEVertexingHF.cxx 
@@ -67,6 +70,8 @@ set(SRCS
   AliAnalysisTaskSELc2V0bachelor.cxx 
   AliAnalysisTaskSEDvsMultiplicity.cxx
   AliAnalysisTaskCheckHFMCProd.cxx
+  AliAnalysisTaskSELc2pK0sfromAODtracks.cxx
+  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks.cxx
   AliCFVertexingHF.cxx 
   AliCFVertexingHF2Prong.cxx 
   AliCFVertexingHF3Prong.cxx 
@@ -142,4 +147,4 @@ install(DIRECTORY
             macros
         DESTINATION PWGHF/vertexingHF/)
 
-install(DIRECTORY charmFlow DESTINATION PWGHF/vertexingHF)
\ No newline at end of file
+install(DIRECTORY charmFlow DESTINATION PWGHF/vertexingHF)
index 0a968b81eeedecbdf94f0ecabfd5173a785db717..fd9a1baad8a0a779e84cdebbe70a49385a5f17f1 100644 (file)
@@ -10,6 +10,7 @@
 #pragma link C++ class AliAODRecoDecayHF3Prong+;
 #pragma link C++ class AliAODRecoDecayHF4Prong+;
 #pragma link C++ class AliAODRecoCascadeHF+;
+#pragma link C++ class AliAODRecoCascadeHF3Prong+;
 #pragma link C++ class AliAODHFUtil+;
 #pragma link C++ class AliAODPidHF+;
 #pragma link C++ class AliRDHFCuts+;
@@ -23,6 +24,8 @@
 #pragma link C++ class AliRDHFCutsLctoV0+;
 #pragma link C++ class AliRDHFCutsD0toKpipipi+;
 #pragma link C++ class AliRDHFCutsDStartoKpipi+;
+#pragma link C++ class AliRDHFCutsLctopK0sfromAODtracks++;
+#pragma link C++ class AliRDHFCutsXicPlustoXiPiPifromAODtracks++;
 #pragma link C++ class AliAnalysisVertexingHF+;
 #pragma link C++ class AliAnalysisTaskSEVertexingHF+;
 #pragma link C++ class AliAnalysisTaskMEVertexingHF+;
@@ -36,6 +39,8 @@
 #pragma link C++ class AliAnalysisTaskSELc2V0bachelor+;
 #pragma link C++ class AliAnalysisTaskSEDvsMultiplicity+;
 #pragma link C++ class AliAnalysisTaskCheckHFMCProd+;
+#pragma link C++ class AliAnalysisTaskSELc2pK0sfromAODtracks++;
+#pragma link C++ class AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks++;
 #pragma link C++ class AliCFVertexingHF+;
 #pragma link C++ class AliCFVertexingHF2Prong+;
 #pragma link C++ class AliCFVertexingHF3Prong+;
index 77aaebc924b06eee74862917f3120ce2a312891b..c396184684a5b78439211f94058f098d1ef79e61 100644 (file)
@@ -50,8 +50,9 @@ const Float_t multmax_50_102 = 102;
 //----------------------------------------------------
 
 //AliCFTaskVertexingHF *AddTaskCFVertexingHF3ProngLc(const char* cutFile = "./cuts4LctopKpi.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 4122, Char_t isSign = 2)
-AliCFTaskVertexingHF *AddTaskCFVertexingHF3ProngLc(const char* cutFile = "./cuts4LctopKpi.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 4122, Char_t isSign = 2,UInt_t decayLc=AliCFTaskVertexingHF::kDelta,TString coutName="Delta")
+AliCFTaskVertexingHF *AddTaskCFVertexingHF3ProngLc(const char* cutFile = "./cuts4LctopKpi.root", Int_t configuration = AliCFTaskVertexingHF::kSnail, Bool_t isKeepDfromB=kFALSE, Bool_t isKeepDfromBOnly=kFALSE, Int_t pdgCode = 4122, Char_t isSign = 2,UInt_t decayLc=AliCFTaskVertexingHF::kDelta,TString coutName="Delta", const char* suffix = "")
 {
+       if(suffix!="") coutName+=Form("%s",suffix); //for subwagons containers 
        printf("Addig CF task using cuts from file %s\n",cutFile);
        if (configuration == AliCFTaskVertexingHF::kSnail){
                printf("The configuration is set to be SLOW --> all the variables will be used to fill the CF\n");
@@ -578,7 +579,9 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHF3ProngLc(const char* cutFile = "./cuts
        printf("CREATE TASK\n");
 
        // create the task
-       AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF("AliCFTaskVertexingHF",cutsLctopKpi);
+       TString combinedName; //for subwagons
+       combinedName.Form("AliCFTaskVertexingHF%s", suffix);
+       AliCFTaskVertexingHF *task = new AliCFTaskVertexingHF(combinedName,cutsLctopKpi);
        task->SetFillFromGenerated(kFALSE);
        task->SetDecayChannel(32);
        task->SetUseWeight(kFALSE);
diff --git a/PWGHF/vertexingHF/macros/AddTaskLc2pK0sfromAODtracks.C b/PWGHF/vertexingHF/macros/AddTaskLc2pK0sfromAODtracks.C
new file mode 100644 (file)
index 0000000..2ffbb90
--- /dev/null
@@ -0,0 +1,85 @@
+AliAnalysisTaskSELc2pK0sfromAODtracks *AddTaskLc2pK0sfromAODtracks(TString finname="",
+                                                                  Bool_t theMCon=kFALSE,
+                                                                  Bool_t writeVariableTree=kFALSE,
+                                                                  Int_t nTour=0
+                                                                  )
+
+{
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskLc2V0YW", "No analysis manager to connect to.");
+    return NULL;
+  }  
+
+  Bool_t stdcuts=kFALSE;
+  TFile* filecuts;
+  if( finname.EqualTo("") ) {
+    stdcuts=kTRUE; 
+  } else {
+    filecuts=TFile::Open(finname.Data());
+    if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
+      AliFatal("Input file not found : check your cut object");
+    }
+  }
+
+  AliRDHFCutsLctopK0sfromAODtracks* RDHFCutsLc2pK0sprod = new AliRDHFCutsLctopK0sfromAODtracks();
+  if (stdcuts) RDHFCutsLc2pK0sprod->SetStandardCutsPP2010();
+  else RDHFCutsLc2pK0sprod = (AliRDHFCutsLctopK0sfromAODtracks*)filecuts->Get("LcProductionCuts");
+  RDHFCutsLc2pK0sprod->SetName("LcProductionCuts");
+  RDHFCutsLc2pK0sprod->SetMinPtCandidate(-1.);
+  RDHFCutsLc2pK0sprod->SetMaxPtCandidate(10000.);
+  if (!RDHFCutsLc2pK0sprod) {
+    cout << "Specific AliRDHFCutsLc2pK0sprod not found\n";
+    return;
+  }
+  
+  AliRDHFCutsLctopK0sfromAODtracks* RDHFCutsLc2pK0sanal = new AliRDHFCutsLctopK0sfromAODtracks();
+  if (stdcuts) RDHFCutsLc2pK0sanal->SetStandardCutsPP2010();
+  else RDHFCutsLc2pK0sanal = (AliRDHFCutsLctopK0sfromAODtracks*)filecuts->Get("LcAnalysisCuts");
+  RDHFCutsLc2pK0sanal->SetName("LcAnalysisCuts");
+  RDHFCutsLc2pK0sanal->SetMinPtCandidate(-1.);
+  RDHFCutsLc2pK0sanal->SetMaxPtCandidate(10000.);
+  if (!RDHFCutsLc2pK0sanal) {
+    cout << "Specific AliRDHFCutsLc2pK0sanal not found\n";
+    return;
+  }
+
+
+  //CREATE THE TASK
+
+  printf("CREATE TASK\n");
+  AliAnalysisTaskSELc2pK0sfromAODtracks *task = new AliAnalysisTaskSELc2pK0sfromAODtracks("AliAnalysisTaskSELc2pK0sfromAODtracks",RDHFCutsLc2pK0sprod,RDHFCutsLc2pK0sanal,writeVariableTree);
+  task->SetIspp(kFALSE);
+  task->SetIspA(kFALSE);
+  task->SetIsAA(kTRUE);
+  task->SetMC(theMCon);
+  task->SetDebugLevel(1);
+
+
+  mgr->AddTask(task);
+
+  // Create and connect containers for input/output  
+  TString outputfile = AliAnalysisManager::GetCommonFileName();
+  outputfile += ":PWG3_D2H_Lc2pK0s_";
+  outputfile += nTour;
+
+  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
+
+  // ----- output data -----
+  AliAnalysisDataContainer *coutput1   = mgr->CreateContainer(Form("Lchist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
+  mgr->ConnectOutput(task,1,coutput1);
+  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Lc2pK0sCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
+  mgr->ConnectOutput(task,2,coutputLc2);
+
+  if (writeVariableTree) {
+    AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("Lc2pK0svariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
+    mgr->ConnectOutput(task,3,coutputLc3);
+  } else {
+    AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("LcAll%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
+    mgr->ConnectOutput(task,3,coutputLc3);
+  }
+
+  return task;
+
+}
diff --git a/PWGHF/vertexingHF/macros/AddTaskXicPlus2XiPiPifromAODtracks.C b/PWGHF/vertexingHF/macros/AddTaskXicPlus2XiPiPifromAODtracks.C
new file mode 100644 (file)
index 0000000..5bea456
--- /dev/null
@@ -0,0 +1,86 @@
+AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks *AddTaskXicPlus2XiPiPifromAODtracks(TString finname="",
+                                                                                Bool_t theMCon=kFALSE,
+                                                                                Bool_t writeVariableTree=kFALSE,
+                                                                                Int_t nTour=0
+                                                                                )
+
+{
+  
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskLc2V0YW", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  Bool_t stdcuts=kFALSE;
+  TFile* filecuts;
+  if( finname.EqualTo("") ) {
+    stdcuts=kTRUE; 
+  } else {
+    filecuts=TFile::Open(finname.Data());
+    if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
+      AliFatal("Input file not found : check your cut object");
+    }
+  }
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks* RDHFCutsXic2PiPiprod = new AliRDHFCutsXicPlustoXiPiPifromAODtracks();
+  if (stdcuts) RDHFCutsXic2PiPiprod->SetStandardCutsPP2010();
+  else RDHFCutsXic2PiPiprod = (AliRDHFCutsXicPlustoXiPiPifromAODtracks*)filecuts->Get("XicPlusProductionCuts");
+  RDHFCutsXic2PiPiprod->SetName("XicPlusProductionCuts");
+  RDHFCutsXic2PiPiprod->SetMinPtCandidate(2.);
+  RDHFCutsXic2PiPiprod->SetMaxPtCandidate(10000.);
+
+  if (!RDHFCutsXic2PiPiprod) {
+    cout << "Specific AliRDHFCutsXic2PiPiprod not found\n";
+    return;
+  }
+  
+  AliRDHFCutsXicPlustoXiPiPifromAODtracks* RDHFCutsXic2PiPianal = new AliRDHFCutsXicPlustoXiPiPifromAODtracks();
+  if (stdcuts) RDHFCutsXic2PiPianal->SetStandardCutsPP2010();
+  else RDHFCutsXic2PiPianal = (AliRDHFCutsXicPlustoXiPiPifromAODtracks*)filecuts->Get("XicPlusAnalysisCuts");
+  RDHFCutsXic2PiPianal->SetName("XicPlusAnalysisCuts");
+  RDHFCutsXic2PiPianal->SetMinPtCandidate(2.);
+  RDHFCutsXic2PiPianal->SetMaxPtCandidate(10000.);
+
+    
+  // mm let's see if everything is ok
+  if (!RDHFCutsXic2PiPianal) {
+    cout << "Specific AliRDHFCutsXic2PiPianal not found\n";
+    return;
+  }
+
+
+  //CREATE THE TASK
+  
+  printf("CREATE TASK\n");
+  AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks *task = new AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks("AliAnalysisTaskSEXicPlus2XiPiPifromAODtracks",RDHFCutsXic2PiPiprod,RDHFCutsXic2PiPianal,writeVariableTree);
+  task->SetIspp(kFALSE);
+  task->SetIspA(kFALSE);
+  task->SetIsAA(kTRUE);
+  task->SetMC(theMCon);
+  task->SetDebugLevel(1);
+  
+  mgr->AddTask(task);
+  
+  // Create and connect containers for input/output  
+  TString outputfile = AliAnalysisManager::GetCommonFileName();
+  outputfile += ":PWG3_D2H_XicPlus2XiPiPi_";
+  outputfile += nTour;
+  
+  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
+  
+  // ----- output data -----
+  AliAnalysisDataContainer *coutput1   = mgr->CreateContainer(Form("chist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
+  mgr->ConnectOutput(task,1,coutput1);
+  AliAnalysisDataContainer *coutputXic2 = mgr->CreateContainer(Form("XicPlus2XiPiPiCuts%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
+  mgr->ConnectOutput(task,2,coutputXic2);
+  if (writeVariableTree) {
+    AliAnalysisDataContainer *coutputXic3 = mgr->CreateContainer(Form("XicPlusvariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); 
+    mgr->ConnectOutput(task,3,coutputXic3);
+  }else{
+    AliAnalysisDataContainer *coutputXic3 = mgr->CreateContainer(Form("XicPlusAll%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
+    mgr->ConnectOutput(task,3,coutputXic3);
+  }
+  
+  return task;
+
+}
index f3efe7f41f8b4e0636a05a77c90e43616fdb9555..62656e9d004aaa0d5bbb0e67ae22cd1d4c5a9a8d 100644 (file)
@@ -953,6 +953,7 @@ JTJTEfficiency::JTJTEfficiency():
        fInputRoot(NULL),
        fCentBinAxis(0x0)
 {
+  for (Int_t i=0; i < 3; i++) fEffDir[i] = 0;
 
 }
 
@@ -971,6 +972,7 @@ JTJTEfficiency::JTJTEfficiency(const JTJTEfficiency& obj) :
 {
        // copy constructor TODO: handling of pointer members
        JUNUSED(obj);
+  for (Int_t i=0; i < 3; i++) fEffDir[i] = obj.fEffDir[i];
 }
 
 JTJTEfficiency& JTJTEfficiency::operator=(const JTJTEfficiency& obj){
@@ -1067,8 +1069,8 @@ bool JTJTEfficiency::Load(){
        fInputRoot = TFile::Open( fInputRootName);
        //fInputRoot = new TFile( fInputRootName,"READ");
        if( !fInputRoot ) {
-               cout<< "J_ERROR : "<<fInputRootName <<" does not exist"<<endl;
-               gSystem->Exit(1);
+               cout << "J_ERROR : %s does not exist" << fInputRootName << endl;
+                return false;
        }
 
        //fEffDir[0] = (TDirectory*)fInputRoot->Get("EffRE");
@@ -1077,14 +1079,14 @@ bool JTJTEfficiency::Load(){
        //iif( fEffDir[0] && fEffDir[1] && fEffDir[2] )
        if( !fEffDir[2] )
        {
-               cout<< "J_ERROR : Directory EFF is not exist"<<endl;
-               gSystem->Exit(1);
+               cout << "J_ERROR : Directory EFF is not exist"<<endl;
+                return false;
        }
 
        fCentBinAxis = (TAxis*)fEffDir[2]->Get("CentralityBin");
        if( !fCentBinAxis ){
-               cout<< "J_ERROR : No CentralityBin in directory"<<endl;
-               gSystem->Exit(1);
+               cout << "J_ERROR : No CentralityBin in directory" << endl;
+                return false;
        }
 
 
index 57910a91cd3dc7594a15ebf3263d8ca64c50763c..888b0424bd2b6a4605af68b11fcf9e3d948bf0b0 100644 (file)
@@ -46,7 +46,7 @@ AliAnalysisTask* AddTaskPtEMCalTriggerV1(
   }
 
   bool isSwapEta = TString(period).CompareTo("LHC13f") ? kFALSE : kTRUE;
-  EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTriggerV1 *pttriggertask = new EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTriggerV1("ptemcaltriggertask");
+  EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTriggerV1 *pttriggertask = new EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTriggerV1(Form("ptemcaltriggertask%s", ntrackcuts));
   //pttriggertask->SelectCollisionCandidates(AliVEvent::kINT7 | AliVEvent::kEMC7);                          // Select both INT7 or EMC7 triggered events
   pttriggertask->SelectCollisionCandidates(AliVEvent::kAny);
   if(isMC) pttriggertask->SetSwapThresholds();
@@ -123,7 +123,7 @@ AliAnalysisTask* AddTaskPtEMCalTriggerV1(
   printf("container name: %s\n", containerName.Data());
 
   AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-  AliAnalysisDataContainer *coutput = mgr->CreateContainer("results", TList::Class(),    AliAnalysisManager::kOutputContainer, containerName.Data());
+  AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("TriggerTracksResults%s", ntrackcuts), TList::Class(),    AliAnalysisManager::kOutputContainer, containerName.Data());
 
   //Connect input/output
   mgr->ConnectInput(pttriggertask, 0, cinput);
index 8294b0296f521cbc9c3c7759317e0a4a0a058218..c54d2380ee83e1c4e1161ac9dc82c0a583450165 100644 (file)
@@ -298,6 +298,8 @@ Bool_t AliAnalysisTaskEmcalJetV0CF::FillRecoInfo()
   Double_t dZNA = fCentInfo->GetCentralityPercentile("ZNA");
 
   THnSparseD *hs = dynamic_cast<THnSparseD*>(fListUserOutputs->FindObject("hsReco"));
+  if (!hs)
+    return kTRUE;  // should not happen; make Coverity happen
 //=============================================================================
 
   AliPicoV0MC *pV0 = 0;
@@ -395,6 +397,9 @@ Bool_t AliAnalysisTaskEmcalJetV0CF::FillKineInfo()
   Double_t dZNA = fCentInfo->GetCentralityPercentile("ZNA");
 
   THnSparseD *hs = dynamic_cast<THnSparseD*>(fListUserOutputs->FindObject("hsKine"));
+  if (!hs) {
+    return kTRUE; // Should not happen; make Coverity happy
+  }
 //=============================================================================
 
   AliStack *pStack = 0;
index 232aad51822fa1ebd461f599d96d16df71719845..42266a7beb765625893a07dba6f886b801b55897 100644 (file)
@@ -309,6 +309,7 @@ Bool_t AliAnalysisTaskEmcalJetV0Filter::Run()
   if (fPicoJetsClArrMC04) fPicoJetsClArrMC04->Delete();
 
   if (fPicoV0sClArr) fPicoV0sClArr->Delete();
+  else return kFALSE; // Should not happen, make Coverity happy
 
   if (!AliAnalysisTaskEmcalJet::Run()) return kFALSE;
 //=============================================================================
index a48ea796ac4cd18e4758cb53d100be53a5fe2be8..aaa23cf2f8401e5a5adb5dc70b47c0854d38de60 100644 (file)
@@ -1330,7 +1330,10 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsD0JetCorr(AliAODRecoDe
       point[6]=static_cast<Double_t>(bJetInEMCalAcc ? 1 : 0);
 
    }
-   
+   if(!point){
+      AliError(Form("Numer of THnSparse entries %d not valid", fNAxesBigSparse));
+      return;
+   }
    
    //Printf("Candidate in FillHistogramsD0JetCorr IsA %s", (candidate->IsA())->GetName());   
    Int_t isselected=fCuts->IsSelected(candidate,AliRDHFCuts::kAll,aodEvent);
@@ -1349,7 +1352,7 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsD0JetCorr(AliAODRecoDe
       if(fNAxesBigSparse==6 || fNAxesBigSparse==7) point[3]=masses[1];
       if(fSwitchOnSparses && (fSwitchOnOutOfConeAxis || fIsDInJet)) fhsDphiz->Fill(point,1.);
    }
-   
+   delete[] point;
 }
 
 //_______________________________________________________________________________
@@ -1401,11 +1404,16 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsDstarJetCorr(AliAODRec
       point[6]=static_cast<Double_t>(bJetInEMCalAcc ? 1 : 0);
    }
 
+   if(!point){
+      AliError(Form("Numer of THnSparse entries %d not valid", fNAxesBigSparse));
+      return;
+   }
+
    //if(fIsDInJet) hPtJetWithD->Fill(ptj,deltamass,ptD);
    
    FillMassHistograms(deltamass, ptD);
    if(fSwitchOnSparses && (fSwitchOnOutOfConeAxis || fIsDInJet)) fhsDphiz->Fill(point,1.);
-   
+   delete[] point;
 }
 
 //_______________________________________________________________________________
@@ -1452,6 +1460,10 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsMCGenDJetCorr(Double_t
       point[6]=static_cast<Double_t>(bJetInEMCalAcc ? 1 : 0);
    }
 
+   if(!point){
+      AliError(Form("Numer of THnSparse entries %d not valid", fNAxesBigSparse));
+      return;
+   }
 
    
    if(fNAxesBigSparse==9) point[4]=pdgmass;
@@ -1460,7 +1472,7 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsMCGenDJetCorr(Double_t
    //if(fIsDInJet) {
    //  hPtJetWithD->Fill(ptjet,pdgmass,ptD); // candidates within a jet
    //}
-   
+   delete[] point;
 }
 
 //_______________________________________________________________________________
@@ -1576,6 +1588,10 @@ void AliAnalysisTaskFlavourJetCorrelations::MCBackground(AliAODRecoDecayHF *cand
       point[5]=static_cast<Double_t>(bDInEMCalAcc ? 1 : 0);
       point[6]=static_cast<Double_t>(bJetInEMCalAcc ? 1 : 0);
    }
+   if(!point){
+      AliError(Form("Numer of THnSparse entries %d not valid", fNAxesBigSparse));
+      return;
+   }
 
    if(fCandidateType==kDstartoKpipi){
       AliAODRecoCascadeHF* dstarbg = (AliAODRecoCascadeHF*)candbg;
@@ -1614,6 +1630,7 @@ void AliAnalysisTaskFlavourJetCorrelations::MCBackground(AliAODRecoDecayHF *cand
       
       
    }
+   delete[] point;
 }
 
 //_______________________________________________________________________________
@@ -1862,7 +1879,7 @@ Bool_t AliAnalysisTaskFlavourJetCorrelations::IsDInJet(AliEmcalJet *thejet, AliA
         else testDeltaR=kFALSE;
       }
    }
-   
+   delete[] daughOutOfJet;
    delete[] charmDaugh;
    
    Bool_t result=0;
index 04e1c8a5b78978b01d4ba5d71b06c45d2bb4bd87..28ef47e195fe48562232c919e255d6351dacf9f2 100644 (file)
@@ -1585,6 +1585,11 @@ void AliAnalysisTaskSEPicoV0Maker::FillHistogramsMC()
 
   THnSparseD *hsV0 = dynamic_cast<THnSparseD*>(fOutputListMC->FindObject("hsV0"));
   THnSparseD *hsXi = dynamic_cast<THnSparseD*>(fOutputListMC->FindObject("hsXi"));
+
+  if (hsV0 == 0 || hsXi == 0) { // Keep Coverity happy
+    AliFatal("Cannot find hsV0 or hsXi; should not happen");
+    return;
+  }  // Keep Coverity happy
 //=============================================================================
 
   TParticle        *pESD = 0;
index d3e846bb9c86ee64dda62e926001842c1b09073b..5ccb2d18939d4c905e635aeca75075de21a2081c 100644 (file)
@@ -1244,7 +1244,10 @@ Int_t  AliAnalysisTaskJetCore::SelectTrigger(TList *list,Double_t minT,Double_t
      Int_t im2=0;
      for(int it = 0;it < aod->GetNumberOfTracks();++it){
       AliAODTrack *tr = dynamic_cast<AliAODTrack*>(aod->GetTrack(it));
-      if(!tr) AliFatal("Not a standard AOD");
+      if(!tr) {
+        AliFatal("Not a standard AOD");
+        return -1;
+      }
       Bool_t bGood = false;
       if(fFilterType == 0)bGood = true;
       else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
index 81c4bb3a18538785dc9440e9585281fbe3d16229..643f9903a965e8adf587f2f1ca25a681f81ee5c3 100644 (file)
@@ -136,11 +136,11 @@ AliAnalysisTaskPIDV0base::~AliAnalysisTaskPIDV0base()
   delete fV0KineCuts;
   fV0KineCuts = 0;
   
-  delete fV0tags;
+  delete [] fV0tags;
   fV0tags = 0;
   fNumTagsStored = 0;
   
-  delete fV0motherIndex;
+  delete [] fV0motherIndex;
   fV0motherIndex = 0;
   
   delete fAnaUtils;
@@ -469,10 +469,10 @@ void AliAnalysisTaskPIDV0base::ClearV0PIDlist()
   // Clear the PID tag list
   //
 
-  delete fV0tags;
+  delete [] fV0tags;
   fV0tags = 0;
   
-  delete fV0motherIndex;
+  delete [] fV0motherIndex;
   fV0motherIndex = 0;
   
   fNumTagsStored = 0;
index de45f764b2cc09544c0fbbca9e5bf32d35df4192..c060583f7de1efe2b14d9bded7236a2d80253575 100644 (file)
@@ -132,4 +132,3 @@ install(FILES ${HDRS} DESTINATION include)
 
 # Install macros
 install(DIRECTORY macros DESTINATION PWGLF/RESONANCES)
-install(FILES extra/AddTaskXiStar.C DESTINATION PWGLF/RESONANCES/extra)
\ No newline at end of file
index dff99c57cb10161d6ee80ba6015035046429bfdc..2f4d00768b80992e897660f2d12af4c89ae5d955 100644 (file)
@@ -1549,7 +1549,7 @@ void AliAnalysisTaskLambdaStar::ResoBufferTrack::GetShiftedPositionAtShiftedRadi
 //________________________________________________________________________
 void AliAnalysisTaskLambdaStar::ResoBufferTrack::Set(const AliAODTrack *track,const Float_t bfield,const Double_t priVtx[3]){
   // Overloaded function
-  Float_t priVtxPos[3]={priVtx[0],priVtx[1],priVtx[2]};
+  Float_t priVtxPos[3]={(Float_t)priVtx[0],(Float_t)priVtx[1],(Float_t)priVtx[2]};
   Set(track,bfield,priVtxPos);
 }
 
index fb6d82e2eb8d0c3aedae02f1a3adc19820e853a4..3dd47781fdcce6019174fae46ffea3d45f88882f 100644 (file)
@@ -78,3 +78,5 @@ install(TARGETS ${MODULE}
   ARCHIVE DESTINATION lib
   LIBRARY DESTINATION lib)
 install(FILES ${HDRS} DESTINATION include)
+install(FILES AddTaskXiStar.C DESTINATION PWGLF/RESONANCES/extra)
+install(FILES AddTaskLambda.C DESTINATION PWGLF/RESONANCES/extra)
index c1fb7cd3bb90c17b14fc6c43c9529778181036c1..257c973ab91c3a40abcf0be8c66c91500656cd36 100644 (file)
@@ -33,7 +33,6 @@ AliRsnMiniAnalysisTask * AddAnalysisTaskTPCKStar
    Float_t     maxDiffMultMix = 10.0,
    Float_t     maxDiffAngleMixDeg = 20.0,
    Int_t       aodN = 0,
-   Int_t       StdQualityCut_filterbit==10,
    TString     outNameSuffix = ""
 )
 {  
@@ -128,13 +127,13 @@ AliRsnMiniAnalysisTask * AddAnalysisTaskTPCKStar
    //
    // -- CONFIG ANALYSIS --------------------------------------------------------------------------
    if(!isMC){
-     gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStar.C");
-     if (!ConfigTPCanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, aodN, StdQualityCut_filterbit)) return 0x0;
+     gROOT->LoadMacro("ConfigTPCanalysisKStar.C");
+     if (!ConfigTPCanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, aodN)) return 0x0;
    }
    else {
-     gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarMC.C");
-     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, 313, aodN,StdQualityCut_filterbit)) return 0x0; //K*
-     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, -313, aodN,StdQualityCut_filterbit)) return 0x0; //anti-K* 
+     gROOT->LoadMacro("ConfigTPCanalysisKStarMC.C");
+     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0; //K*
+     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, -313, aodN)) return 0x0; //anti-K* 
    }
    
    
index d627562e35d362d8278ec6cbce5e8c9b4a1f95d2..bd329b4b5d61bb358216b84dda67db308215ae8e 100644 (file)
@@ -40,7 +40,6 @@ AliRsnMiniAnalysisTask * AddAnalysisTaskTPCKStarSyst
    Float_t     maxDiffMultMix = 10.0,
    Float_t     maxDiffAngleMixDeg = 20.0,
    Int_t       aodN = 0,
-   Int_t       StdQualityCut_filterbit==10,
    TString     outNameSuffix = ""
 )
 {  
@@ -62,15 +61,13 @@ AliRsnMiniAnalysisTask * AddAnalysisTaskTPCKStarSyst
      Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", (aodN==49)? "yes" : "no"));
      task->SetUseCentralityPatch(aodN==49);
    }
-
+   
    if(PbPb2011CentFlat)
      task->SetUseCentralityPatchPbPb2011(PbPb2011CentFlat);
-   //task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);                      
+   //task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);        
    task->SelectCollisionCandidates(triggerMask);
 
 
-
-
    if (isPP) 
      task->UseMultiplicity("QUALITY");
    else
@@ -139,26 +136,26 @@ AliRsnMiniAnalysisTask * AddAnalysisTaskTPCKStarSyst
    // -- CONFIG ANALYSIS --------------------------------------------------------------------------
    if((!isMC) && (!enableSyst)){
      gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStar.C");
-     if (!ConfigTPCanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, aodN, StdQualityCut_filterbit)) return 0x0;
+     if (!ConfigTPCanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, aodN)) return 0x0;
    }
    if((isMC) && (!enableSyst)) {
      gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarMC.C");
-     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, 313, aodN, StdQualityCut_filterbit)) return 0x0; //K*
-     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, -313, aodN, StdQualityCut_filterbit)) return 0x0; //anti-K* 
+     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0; //K*
+     if (!ConfigTPCanalysisKStarMC(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, -313, aodN)) return 0x0; //anti-K* 
    }
    
    //for systematic checks
    if((!isMC) && (enableSyst))
      {
-       gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarSyst.C");
-       if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, 313, aodN, StdQualityCut_filterbit)) return 0x0;  
+   gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarSyst.C");
+   if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0;  
      }
-   
+
    //for systematic checks
    if((isMC) && (enableSyst)) {
      gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTPCanalysisKStarSyst.C");
-     if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, 313, aodN, StdQualityCut_filterbit)) return 0x0; //K*
-     if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa,enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, -313, aodN, StdQualityCut_filterbit)) return 0x0; //anti-K* 
+     if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, 313, aodN)) return 0x0; //K*
+     if (!ConfigTPCanalysisKStarSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa,enableSyst, DCAxyFormula, dcazmax, minNcls, maxX2cls, minCrossedRows, maxClsCrossedRows, enableMonitor, isMC&IsMcTrueOnly, -313, aodN)) return 0x0; //anti-K* 
    }
    
    //
index b5d23d948f1c96b6b53e6749e181e10af1f46732..0f952337c6dabfe7c11e3d356e7149e049bfa419 100644 (file)
@@ -25,9 +25,8 @@ Bool_t ConfigTPCanalysisKStar
     Float_t                nsigmaKa = 2.0,
     Bool_t                 enableMonitor = kTRUE,
     Bool_t                 IsMcTrueOnly = kFALSE,
-    Int_t                  aodN = 0,
-    Int_t                  StdQualityCut_filterbit==10
-   )
+    Int_t                  aodN = 0
+)
 {
   // manage suffix
   if (strlen(suffix) > 0) suffix = Form("_%s", suffix);
@@ -42,51 +41,23 @@ Bool_t ConfigTPCanalysisKStar
   //cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCPbPb2010_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
   //cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCPbPb2010_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
   
-  //================================================
-  //2011 Standard Cuts
-  //high-pT
-  if(StdQualityCut_filterbit==10){
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kFALSE);
-    cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
-    
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kFALSE);
-    cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
-    
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kFALSE);
-    cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
-  }
+  //2011 High-pT cuts
+  cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
+  cutSetQ->SetUse2011StdQualityCuts(kTRUE);
 
-  //2011 Standard Cuts
-  if(StdQualityCut_filterbit==5){
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-    cutSetQ->SetUse2011StdQualityCuts(kTRUE);
-    
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-    cutSetPi->SetUse2011StdQualityCuts(kTRUE);
-    
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-    cutSetK->SetUse2011StdQualityCuts(kTRUE);
-  }
+  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
+  // cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
+  cutSetPi->SetUse2011StdQualityCuts(kTRUE);
   
-  //================================================
-  //2010 Standard Cuts
-  if(StdQualityCut_filterbit==00){
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-    cutSetQ->SetUse2011StdQualityCutsHighPt(kFALSE);
-    
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-    cutSetPi->SetUse2011StdQualityCutsHighPt(kFALSE);
-    
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-    cutSetK->SetUse2011StdQualityCutsHighPt(kFALSE);
-  }   
- //================================================
+  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
+  // cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
+  cutSetK->SetUse2011StdQualityCuts(kTRUE);
 
 
-    Int_t iCutQ = task->AddTrackCuts(cutSetQ);
-    Int_t iCutPi = task->AddTrackCuts(cutSetPi);
-    Int_t iCutK = task->AddTrackCuts(cutSetK);
-    
+  Int_t iCutQ = task->AddTrackCuts(cutSetQ);
+  Int_t iCutPi = task->AddTrackCuts(cutSetPi);
+  Int_t iCutK = task->AddTrackCuts(cutSetK);
+
   
   if(enableMonitor){
     Printf("======== Monitoring cut AliRsnCutSetDaughterParticle enabled");
index 7e293018587ad00702062013230da0a91e73b99e..d2b24f7957335749f9711463db68b42583e96d74 100644 (file)
@@ -26,8 +26,7 @@ Bool_t ConfigTPCanalysisKStarMC
     Bool_t                 enableMonitor = kTRUE,
     Bool_t                 IsMcTrueOnly = kFALSE,
     Int_t                  Pdg = 313,
-    Int_t                  aodN = 0,
-    Int_t                  StdQualityCut_filterbit==10
+    Int_t                  aodN = 0
 )
 {
   // manage suffix
@@ -45,54 +44,31 @@ Bool_t ConfigTPCanalysisKStarMC
 
 
   //2011 High-pT cuts                      
-  //cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-  //cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
-  //cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-  //cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
-  //cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-  //cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
-
-  //high-pT                                                                                                                                   
-  if(StdQualityCut_filterbit==10){
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kFALSE);
-    cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
-    
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kFALSE);
-    cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
-
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa,aodFilterBit,kFALSE);
-    cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
-  }
-
-  //2011 Standard Cuts                                                                                                                          
-  if(StdQualityCut_filterbit==5){
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-    cutSetQ->SetUse2011StdQualityCuts(kTRUE);
-
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-    cutSetPi->SetUse2011StdQualityCuts(kTRUE);
-
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-    cutSetK->SetUse2011StdQualityCuts(kTRUE);
-  }
-
-  //2010 Standard Cuts                                                                                                                
-  if(StdQualityCut_filterbit==00){
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-    cutSetQ->SetUse2011StdQualityCutsHighPt(kFALSE);
-
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-    cutSetPi->SetUse2011StdQualityCutsHighPt(kFALSE);
-
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-    cutSetK->SetUse2011StdQualityCutsHighPt(kFALSE);
-  }
+  /*cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
+  cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
+  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
+  cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
+  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
+  cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
+  */
+
+  //2011 High-pT cuts                                                                                                        
+  cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
+  cutSetQ->SetUse2011StdQualityCuts(kTRUE);
+
+  cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
+  // cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);                                                                                        
+  cutSetPi->SetUse2011StdQualityCuts(kTRUE);
+  
+  cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
+  //  cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);                                                                 
+  cutSetK->SetUse2011StdQualityCuts(kTRUE);
 
-  //================================
 
   Int_t iCutQ = task->AddTrackCuts(cutSetQ);
   Int_t iCutPi = task->AddTrackCuts(cutSetPi);
   Int_t iCutK = task->AddTrackCuts(cutSetK);
+
   
   if(enableMonitor){
     Printf("======== Monitoring cut AliRsnCutSetDaughterParticle enabled");
index 8eb0d88ed3b866d8bfbbd3caedaad4f343fd02e5..ddc75a4a236ab82600508ffde9b9b8a5d612284c 100644 (file)
@@ -24,17 +24,16 @@ Bool_t ConfigTPCanalysisKStarSyst
     Float_t                nsigmaPi = 2.0,
     Float_t                nsigmaKa = 2.0,
     Bool_t                 enableSyst = kFALSE,
-    Char_t DCAxyFormula[100] = "0.0182+0.035/pt^1.01",
-    Double_t    dcazmax = 3.2,
-    Double_t    minNcls = 70,
-    Double_t    maxX2cls = 5.0,
-    Double_t    minCrossedRows = 50.0,
-    Double_t    maxClsCrossedRows = 0.8,
+    Char_t                 DCAxyFormula[100] = "0.0182+0.035/pt^1.01",
+    Double_t               dcazmax = 3.2,
+    Double_t               minNcls = 70,
+    Double_t               maxX2cls = 5.0,
+    Double_t               minCrossedRows = 50.0,
+    Double_t               maxClsCrossedRows = 0.8,
     Bool_t                 enableMonitor = kTRUE,
     Bool_t                 IsMcTrueOnly = kFALSE,
     Int_t                  Pdg = 313,
-    Int_t                  aodN = 0,
-    Int_t                  StdQualityCut_filterbit==10
+    Int_t                  aodN = 0
 )
 {
   // manage suffix
@@ -54,7 +53,7 @@ Bool_t ConfigTPCanalysisKStarSyst
     trkQualityCut->SetCheckOnlyFilterBit(kFALSE);//tells the cut object to check all other cuts individually,
     trkQualityCut->SetDCARPtFormula(DCAxyFormula);
     trkQualityCut->SetDCAZmax(dcazmax);
-    //trkQualityCut->SetMinNCrossedRowsTPC(minCrossedRows, kTRUE);
+    trkQualityCut->SetMinNCrossedRowsTPC(minCrossedRows, kTRUE);
     trkQualityCut->SetMinNCrossedRowsOverFindableClsTPC(maxClsCrossedRows, kTRUE);
     trkQualityCut->SetTPCmaxChi2(maxX2cls);
     trkQualityCut->SetRejectKinkDaughters(kTRUE);
@@ -63,69 +62,27 @@ Bool_t ConfigTPCanalysisKStarSyst
     trkQualityCut->AddStatusFlag(AliESDtrack::kTPCin   , kTRUE);//already in defaults 2011
     trkQualityCut->AddStatusFlag(AliESDtrack::kTPCrefit, kTRUE);//already in defaults 2011
     trkQualityCut->AddStatusFlag(AliESDtrack::kITSrefit, kTRUE);//already in defaults 2011
-    trkQualityCut->SetTPCminNClusters(50);
+    //trkQualityCut->SetTPCminNClusters(70);
     trkQualityCut->SetPtRange(0.15, 20.0);
     trkQualityCut->SetEtaRange(-0.8, 0.8);
     
     trkQualityCut->Print();
 
-    //cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), trkQualityCut, AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0);
-    //cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), trkQualityCut, cutPiCandidate, AliPID::kPion, nsigmaPi);
-    //cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), trkQualityCut, cutKaCandidate, AliPID::kKaon, nsigmaKa);
-    
-    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kFALSE);
-    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kFALSE);
-    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kFALSE);
+    cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), trkQualityCut, AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0);
+    cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), trkQualityCut, cutPiCandidate, AliPID::kPion, nsigmaPi);
+    cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), trkQualityCut, cutKaCandidate, AliPID::kKaon, nsigmaKa);
+
     
   }
   else
     {
       //default cuts 2011
-    //cutSetQ= new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit);
-      //cutSetQ->SetUse2011StdQualityCuts(kTRUE);
-      //cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCPbPb2011_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
-      //cutSetPi->SetUse2011StdQualityCuts(kTRUE);
-      //cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCPbPb2011_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
-      //cutSetK->SetUse2011StdQualityCuts(kTRUE);
-
-      
-      //2011 Standard Cuts                                                                                                          
-      //high-pT                                                                                                                               
-      if(StdQualityCut_filterbit==10){
-       cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kFALSE);
-       cutSetQ->SetUse2011StdQualityCutsHighPt(kTRUE);
-       
-       cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kFALSE);
-       cutSetPi->SetUse2011StdQualityCutsHighPt(kTRUE);
-       
-       cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kFALSE);
-       cutSetK->SetUse2011StdQualityCutsHighPt(kTRUE);
-      }
-
-      //2011 Standard Cuts                                                                                                
-      if(StdQualityCut_filterbit==5){
-       cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-       cutSetQ->SetUse2011StdQualityCuts(kTRUE);
-       
-       cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-       cutSetPi->SetUse2011StdQualityCuts(kTRUE);
-       
-       cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-       cutSetK->SetUse2011StdQualityCuts(kTRUE);
-      }
-      
-      //2010 Standard Cuts                                                                                               
-      if(StdQualityCut_filterbit==00){
-       cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cutQ_bit%i",aodFilterBit), AliRsnCutSetDaughterParticle::kQualityStd2011HighPt, AliPID::kPion, -1.0, aodFilterBit, kTRUE);
-       cutSetQ->SetUse2011StdQualityCutsHighPt(kFALSE);
-
-       cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit,kTRUE);
-       cutSetPi->SetUse2011StdQualityCutsHighPt(kFALSE);
-
-       cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutPiCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit,kTRUE);
-       cutSetK->SetUse2011StdQualityCutsHighPt(kFALSE);
-      }
-    
+      cutSetQ  = new AliRsnCutSetDaughterParticle("cutQuality", AliRsnCutSetDaughterParticle::kQualityStd2011, AliPID::kPion, -1.0, aodFilterBit);
+      cutSetQ->SetUse2011StdQualityCuts(kTRUE);
+      cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPionTPCPbPb2011_%2.1fsigma",nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
+      cutSetPi->SetUse2011StdQualityCuts(kTRUE);
+      cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutKaonTPCPbPb2011_%2.1f2sigma",nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
+      cutSetK->SetUse2011StdQualityCuts(kTRUE);
     }
   
   
index 1c5e7407d74c88a7dea8ba3d2eb30331fc11474d..6eb5622342390ff9c35a4a31bbfa0954ba9bd968 100644 (file)
@@ -101,10 +101,125 @@ AliAnalysisTaskSE("taskITSsaSpectra"),
   Double_t xbins[kNbins+1]={0.08,0.10,0.12,0.14,0.16,0.18,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.0};
   for(Int_t iBin=0; iBin<kNbins+1; iBin++) fPtBinLimits[iBin]=xbins[iBin];
   fRandGener=new TRandom3(0);
+
+  for(Int_t j=0; j<3; j++){
+    fHistPosNSigmaSep[j]=0x0;
+    fHistNegNSigmaSep[j]=0x0;
+
+    fHistPrimMCpos[j]=0x0;
+    fHistPrimMCneg[j]=0x0;
+    fHistSecStrMCpos[j]=0x0;
+    fHistSecStrMCneg[j]=0x0;
+    fHistSecMatMCpos[j]=0x0;
+    fHistSecMatMCneg[j]=0x0;
+    fHistPrimMCposBefEvSel[j]=0x0;
+    fHistPrimMCposBefEvSelEtaY[j]=0x0;
+    fHistPrimMCposBefEvSelEta[j]=0x0;
+    fHistPrimMCnegBefEvSel[j]=0x0;
+    fHistPrimMCnegBefEvSelEtaY[j]=0x0;
+    fHistPrimMCnegBefEvSelEta[j]=0x0;
+    fHistSecStrMCposBefEvSel[j]=0x0;
+    fHistSecStrMCnegBefEvSel[j]=0x0;
+    fHistSecMatMCposBefEvSel[j]=0x0;
+    fHistSecMatMCnegBefEvSel[j]=0x0;
+    fHistPrimMCposReco[j]=0x0;
+    fHistPrimMCposRecoEtaY[j]=0x0;
+    fHistPrimMCnegReco[j]=0x0;
+    fHistPrimMCnegRecoEtaY[j]=0x0;
+    fHistSecStrMCposReco[j]=0x0;
+    fHistSecStrMCnegReco[j]=0x0;
+    fHistSecMatMCposReco[j]=0x0;
+    fHistSecMatMCnegReco[j]=0x0;
+  }
+
+  for(Int_t j=0; j<4; j++) fHistCharge[j]=0x0;
+
+  for(Int_t j=0; j<kNbins; j++){
+    fHistPosPi[j]=0x0;
+    fHistPosK[j]=0x0;
+    fHistPosP[j]=0x0;
+    fHistNegPi[j]=0x0;
+    fHistNegK[j]=0x0;
+    fHistNegP[j]=0x0;
+    fHistDCAPosPi[j]=0x0;
+    fHistDCAPosK[j]=0x0;
+    fHistDCAPosP[j]=0x0;
+    fHistDCANegPi[j]=0x0;
+    fHistDCANegK[j]=0x0;
+    fHistDCANegP[j]=0x0;
+    fHistMCPrimDCAPosPi[j]=0x0;
+    fHistMCPrimDCAPosK[j]=0x0;
+    fHistMCPrimDCAPosP[j]=0x0;
+    fHistMCPrimDCANegPi[j]=0x0;
+    fHistMCPrimDCANegK[j]=0x0;
+    fHistMCPrimDCANegP[j]=0x0;
+    fHistMCSecStDCAPosPi[j]=0x0;
+    fHistMCSecStDCAPosK[j]=0x0;
+    fHistMCSecStDCAPosP[j]=0x0;
+    fHistMCSecStDCANegPi[j]=0x0;
+    fHistMCSecStDCANegK[j]=0x0;
+    fHistMCSecStDCANegP[j]=0x0;
+    fHistMCSecMatDCAPosPi[j]=0x0;
+    fHistMCSecMatDCAPosK[j]=0x0;
+    fHistMCSecMatDCAPosP[j]=0x0;
+    fHistMCSecMatDCANegPi[j]=0x0;
+    fHistMCSecMatDCANegK[j]=0x0;
+    fHistMCSecMatDCANegP[j]=0x0;
+    fHistMCPosOtherHypPion[j]=0x0;
+    fHistMCPosOtherHypKaon[j]=0x0;
+    fHistMCPosOtherHypProton[j]=0x0;
+    fHistMCPosElHypPion[j]=0x0;
+    fHistMCPosElHypKaon[j]=0x0;
+    fHistMCPosElHypProton[j]=0x0;
+    fHistMCPosPiHypPion[j]=0x0;
+    fHistMCPosPiHypKaon[j]=0x0;
+    fHistMCPosPiHypProton[j]=0x0;
+    fHistMCPosKHypPion[j]=0x0;
+    fHistMCPosKHypKaon[j]=0x0;
+    fHistMCPosKHypProton[j]=0x0;
+    fHistMCPosPHypPion[j]=0x0;
+    fHistMCPosPHypKaon[j]=0x0;
+    fHistMCPosPHypProton[j]=0x0;
+    fHistMCNegOtherHypPion[j]=0x0;
+    fHistMCNegOtherHypKaon[j]=0x0;
+    fHistMCNegOtherHypProton[j]=0x0;
+    fHistMCNegElHypPion[j]=0x0;
+    fHistMCNegElHypKaon[j]=0x0;
+    fHistMCNegElHypProton[j]=0x0;
+    fHistMCNegPiHypPion[j]=0x0;
+    fHistMCNegPiHypKaon[j]=0x0;
+    fHistMCNegPiHypProton[j]=0x0;
+    fHistMCNegKHypPion[j]=0x0;
+    fHistMCNegKHypKaon[j]=0x0;
+    fHistMCNegKHypProton[j]=0x0;
+    fHistMCNegPHypPion[j]=0x0;
+    fHistMCNegPHypKaon[j]=0x0;
+    fHistMCNegPHypProton[j]=0x0;
+  }
+
+  for(Int_t j=0; j<3; j++){
+    fHistPosNSigmaMean[j]=0x0;
+    fHistPosNSigmaMCMean[j]=0x0;
+    fHistPosNSigmaPrimMean[j]=0x0;
+    fHistPosNSigmaPrimMCMean[j]=0x0;
+    fHistNegNSigmaMean[j]=0x0;
+    fHistNegNSigmaMCMean[j]=0x0;
+    fHistNegNSigmaPrimMean[j]=0x0;
+    fHistNegNSigmaPrimMCMean[j]=0x0;
+
+    fHistPosNSigma[j]=0x0;
+    fHistPosNSigmaMC[j]=0x0;
+    fHistPosNSigmaPrim[j]=0x0;
+    fHistPosNSigmaPrimMC[j]=0x0;
+    fHistNegNSigma[j]=0x0;
+    fHistNegNSigmaMC[j]=0x0;
+    fHistNegNSigmaPrim[j]=0x0;
+    fHistNegNSigmaPrimMC[j]=0x0;
+  }
+
   DefineInput(0, TChain::Class());
   DefineOutput(1, TList::Class());
   DefineOutput(2,TList::Class());
-  Printf("end of AliAnalysisTaskSEITSsaSpectra");
 }
 
 //___________________________________________________________________________
@@ -1287,10 +1402,14 @@ void AliAnalysisTaskSEITSsaSpectra::Terminate(Option_t *) {
   if (!fOutput) {
     printf("ERROR: fOutput not available\n");
     return;
-  } 
-  fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
-  printf("Number of Analyzed Events = %f\n",fHistNEvents->GetBinContent(1));
-  
+  }
+  if(fHistNEvents){
+    fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
+    printf("Number of Analyzed Events = %f\n",fHistNEvents->GetBinContent(1));
+  }else{
+    printf("ERROR: fHistNEvents not available\n");
+  }
+
   Printf("end of Terminate");
   return;
 }
index 81116b7a98c23865f74e4b1972f01dece91259a2..a307113f18eb4787c6b276b188b60fcc7fca979d 100644 (file)
@@ -23,113 +23,151 @@ class AliSpectraAODEventCuts;
 
 class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
 {
- public:
+public:
   // constructors
- AliAnalysisTaskV2AllChAOD() : AliAnalysisTaskSE(),
-    fAOD(0x0),
-    fTrackCuts(0x0),
-    fEventCuts(0x0),
-    fIsMC(0),
-    fCharge(0),
-    fVZEROside(0),
-    fOutput(0x0),
-    fOutput_lq(0x0),
-    fOutput_sq(0x0),
-    fnCentBins(20),
-    fnQvecBins(40),
-    fQvecUpperLim(100),
-    fCutLargeQperc(9.),
-    fCutSmallQperc(10.),
-    fEtaGapMin(-0.5),
-    fEtaGapMax(0.5),
-    fTrkBit(128),
-    fEtaCut(0.8),
-    fMinPt(0),
-    fMaxPt(20.0),
-    fMinTPCNcls(70),
-    fFillTHn(kTRUE),
-    fCentrality(0),
-    fQvector(0),
-    fQvector_lq(0),
-    fQvector_sq(0),
-    fResSP(0),
-    fResSP_vs_Cent(0),
-    f2partCumQA_vs_Cent(0),
-    f2partCumQB_vs_Cent(0),
-    fEta_vs_Phi_bef(0),
-    fEta_vs_PhiA(0),
-    fEta_vs_PhiB(0),
-    fResSP_lq(0),
-    fResSP_vs_Cent_lq(0),
-    f2partCumQA_vs_Cent_lq(0),
-    f2partCumQB_vs_Cent_lq(0),
-    fResSP_sq(0),
-    fResSP_vs_Cent_sq(0),
-    f2partCumQA_vs_Cent_sq(0),
-    f2partCumQB_vs_Cent_sq(0),
-    fResSP_inclusive(0),
-    fv2SPGap1A_inclusive_mb(0),
-    fv2SPGap1B_inclusive_mb(0),
-    fv2SPGap1A_inclusive_lq(0),
-    fv2SPGap1B_inclusive_lq(0),
-    fv2SPGap1A_inclusive_sq(0),
-    fv2SPGap1B_inclusive_sq(0),
-    fResSPmc_inclusive(0),
-    fv2SPGap1Amc_inclusive_mb(0),
-    fv2SPGap1Bmc_inclusive_mb(0),
-    fv2SPGap1Amc_inclusive_lq(0),
-    fv2SPGap1Bmc_inclusive_lq(0),
-    fv2SPGap1Amc_inclusive_sq(0),
-    fv2SPGap1Bmc_inclusive_sq(0),
-    fResGap1w(0),
-    fV2IntGap1w(0),
-    fIsRecoEff(0),
-    fRecoEffList(0),
-    fQvecGen(0),
-    fQgenType(0),
-    fnNchBins(400),
-       fDoCentrSystCentrality(0)
-      {}
+  AliAnalysisTaskV2AllChAOD() : AliAnalysisTaskSE(),
+  fAOD(0x0),
+  fTrackCuts(0x0),
+  fEventCuts(0x0),
+  fIsMC(0),
+  fCharge(0),
+  fVZEROside(0),
+  fOutput(0x0),
+  fOutput_lq(0x0),
+  fOutput_sq(0x0),
+  fnCentBins(20),
+  fnQvecBins(40),
+  fQvecUpperLim(100),
+  fCutLargeQperc(9.),
+  fCutSmallQperc(10.),
+  fEtaGapMin(-0.5),
+  fEtaGapMax(0.5),
+  fTrkBit(128),
+  fEtaCut(0.8),
+  fMinPt(0),
+  fMaxPt(20.0),
+  fMinTPCNcls(70),
+  fFillTHn(kTRUE),
+  fCentrality(0),
+  fQvector(0),
+  fQvector_lq(0),
+  fQvector_sq(0),
+  fResSP(0),
+  fResSP_vs_Cent(0),
+  f2partCumQA_vs_Cent(0),
+  f2partCumQB_vs_Cent(0),
+  fEta_vs_Phi_bef(0),
+  fEta_vs_PhiA(0),
+  fEta_vs_PhiB(0),
+  fResSP_lq(0),
+  fResSP_vs_Cent_lq(0),
+  f2partCumQA_vs_Cent_lq(0),
+  f2partCumQB_vs_Cent_lq(0),
+  fResSP_sq(0),
+  fResSP_vs_Cent_sq(0),
+  f2partCumQA_vs_Cent_sq(0),
+  f2partCumQB_vs_Cent_sq(0),
+  fResSP_inclusive(0),
+  fv2SPGap1A_inclusive_mb(0),
+  fv2SPGap1B_inclusive_mb(0),
+  fv2SPGap1A_inclusive_lq(0),
+  fv2SPGap1B_inclusive_lq(0),
+  fv2SPGap1A_inclusive_sq(0),
+  fv2SPGap1B_inclusive_sq(0),
+  fResSPmc_inclusive(0),
+  fv2SPGap1Amc_inclusive_mb(0),
+  fv2SPGap1Bmc_inclusive_mb(0),
+  fv2SPGap1Amc_inclusive_lq(0),
+  fv2SPGap1Bmc_inclusive_lq(0),
+  fv2SPGap1Amc_inclusive_sq(0),
+  fv2SPGap1Bmc_inclusive_sq(0),
+  fResGap1w(0),
+  fV2IntGap1w(0),
+  fIsRecoEff(0),
+  fRecoEffList(0),
+  fQvecGen(0),
+  fQgenType(0),
+  fnNchBins(400),
+  fDoCentrSystCentrality(0)
+{
+    for(Int_t j=0; j<9; j++){
+      fv2SPGap1A[j]=0x0;
+      fv2SPGap1B[j]=0x0;
+      fSinGap1Aq[j]=0x0;
+      fCosGap1Aq[j]=0x0;
+      fSinGap1Bq[j]=0x0;
+      fCosGap1Bq[j]=0x0;
+      fSinGap1A[j]=0x0;
+      fCosGap1A[j]=0x0;
+      fSinGap1B[j]=0x0;
+      fCosGap1B[j]=0x0;
+
+      fv2SPGap1A_lq[j]=0x0;
+      fv2SPGap1B_lq[j]=0x0;
+      fSinGap1Aq_lq[j]=0x0;
+      fCosGap1Aq_lq[j]=0x0;
+      fSinGap1Bq_lq[j]=0x0;
+      fCosGap1Bq_lq[j]=0x0;
+      fSinGap1A_lq[j]=0x0;
+      fCosGap1A_lq[j]=0x0;
+      fSinGap1B_lq[j]=0x0;
+      fCosGap1B_lq[j]=0x0;
+
+      fv2SPGap1A_sq[j]=0x0;
+      fv2SPGap1B_sq[j]=0x0;
+      fSinGap1Aq_sq[j]=0x0;
+      fCosGap1Aq_sq[j]=0x0;
+      fSinGap1Bq_sq[j]=0x0;
+      fCosGap1Bq_sq[j]=0x0;
+      fSinGap1A_sq[j]=0x0;
+      fCosGap1A_sq[j]=0x0;
+      fSinGap1B_sq[j]=0x0;
+      fCosGap1B_sq[j]=0x0;
+
+      fResSP_vs_Qvec[j]=0x0;
+      fV2IntGap1wq[j]=0x0;
+    }
+}
   AliAnalysisTaskV2AllChAOD(const char *name);
   virtual ~AliAnalysisTaskV2AllChAOD() {
     Printf("calling detructor of AliAnalysisTaskV2AllChAOD - To be implemented");
   }
-  
+
   void SetIsMC(Bool_t isMC = kFALSE)    {fIsMC = isMC; };
   Bool_t GetIsMC()           const           { return fIsMC;};
+
   void SetCharge(Int_t charge = 0)    {fCharge = charge; };
   Int_t GetCharge()           const           { return fCharge;};
-  
+
   void SetVZEROside(Int_t side = 0)    {fVZEROside = side; };
   Int_t GetVZEROside()           const           { return fVZEROside;};
-  
+
   virtual void   UserCreateOutputObjects();
   virtual void   UserExec(Option_t *option);
   virtual void   Terminate(Option_t *);
-  
+
   AliSpectraAODTrackCuts      * GetTrackCuts()         {  return fTrackCuts; }
   AliSpectraAODEventCuts      * GetEventCuts()         {  return fEventCuts; }
   TList                          * GetOutputList()         { return fOutput; }
-  
+
   void SetTrackCuts(AliSpectraAODTrackCuts * tc)       { fTrackCuts = tc; }
   void SetEventCuts(AliSpectraAODEventCuts * vc)       { fEventCuts = vc; }
   void SetnCentBins(Int_t val)                             { fnCentBins = val; }
   void SetnQvecBins(Int_t val)                             { fnQvecBins = val; }
   void SetQvecUpperLimit(Double_t val)                { fQvecUpperLim = val; }
-  
+
   void SetTrackBits(UInt_t TrackBits) {fTrkBit=TrackBits;}
   void SetEtaCut(Double_t val) {fEtaCut=val;}
   void SetMinPt(Double_t val) {fMinPt=val;}
   void SetMaxPt(Double_t val) {fMaxPt=val;}
   void SetMinTPCNcls(Double_t val) {fMinTPCNcls=val;}
-  
+
   Bool_t GetDCA(const AliAODTrack* trk, Double_t * p);
   void MCclosure(Double_t qvec);
-  
+
   void EnableRecoEff (Bool_t val) { fIsRecoEff = val; }
   Double_t GetRecoEff(Double_t pt, Int_t iC);
-  
+
   void SetRecoEffFile(TFile *f)    {
     TIter next(f->GetListOfKeys());
     TKey *key;
@@ -142,16 +180,16 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   void     SetEtaGap(Float_t etamin,Float_t etamax)   { fEtaGapMin = etamin; fEtaGapMax = etamax; }
   void     SetQvecCut(Float_t qmin,Float_t qmax)      { fCutSmallQperc = qmin; fCutLargeQperc = qmax; }
   void     SetFillTHn (Bool_t val) { fFillTHn = val; }
-  
+
   void SetQvecGen(Bool_t val) { fQvecGen = val; } //enable Qvec from generated
   void SetQgenType(Int_t val) { fQgenType = val ; } // type==0 qgen from tracks - type==1 qgen from vzero
 
   void SetnNchBins(Int_t val) { fnNchBins = val; }
-  
+
   void SetDoCentrSystCentrality(Bool_t val) { fDoCentrSystCentrality = val; } //enable systematic for centrality
 
- private:
-  
+private:
+
   AliAODEvent                   * fAOD;                         //! AOD object
   AliSpectraAODTrackCuts      * fTrackCuts;                   // Track Cuts
   AliSpectraAODEventCuts      * fEventCuts;                   // Event Cuts
@@ -164,21 +202,21 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   Int_t                            fnCentBins;                  // number of bins for the centrality axis
   Int_t                            fnQvecBins;                 // number of bins for the q vector axis
   Double_t                         fQvecUpperLim;             //Upper limit for Qvector
-  
+
   Int_t                            fCutLargeQperc; // cut on 10% large Q-vec events
   Int_t                            fCutSmallQperc; // cut on 10% small Q-vec events
-  
+
   Double_t fEtaGapMin;  // TBD
   Double_t fEtaGapMax;   // TBD
-  
+
   UInt_t    fTrkBit;   // TBD
   Double_t  fEtaCut;   // TBD
   Double_t  fMinPt;   // TBD
   Double_t  fMaxPt;   // TBD
   Double_t  fMinTPCNcls;   // TBD
-  
+
   Bool_t fFillTHn;   // TBD
-  
+
   TH1D * fCentrality;   //! TBD
   TH1D * fQvector;   //! TBD
   TH1D * fQvector_lq;   //! TBD
@@ -199,7 +237,7 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   TProfile*     fCosGap1Aq[9];      //! <cos> vs pT gap 1
   TProfile*     fSinGap1Bq[9];      //! <sin> vs pT gap 1
   TProfile*     fCosGap1Bq[9];      //! <cos> vs pT gap 1
-  
+
   TProfile*     fSinGap1A[9];      //! <sin> vs pT gap 1
   TProfile*     fCosGap1A[9];      //! <cos> vs pT gap 1
   TProfile*     fSinGap1B[9];      //! <sin> vs pT gap 1
@@ -220,7 +258,7 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   TProfile*     fCosGap1A_lq[9];      //! <cos> vs pT gap 1
   TProfile*     fSinGap1B_lq[9];      //! <sin> vs pT gap 1
   TProfile*     fCosGap1B_lq[9];      //! <cos> vs pT gap 1
-  
+
   //small q
   TProfile*     fResSP_sq;             //! resolution
   TProfile*     fResSP_vs_Cent_sq;   //! TBD
@@ -236,9 +274,9 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   TProfile*     fCosGap1A_sq[9];      //! <cos> vs pT gap 1
   TProfile*     fSinGap1B_sq[9];      //! <sin> vs pT gap 1
   TProfile*     fCosGap1B_sq[9];      //! <cos> vs pT gap 1
-  
+
   // MC closure test
-  
+
   TProfile* fResSP_inclusive;   //! TBD
   TProfile* fv2SPGap1A_inclusive_mb;   //! TBD
   TProfile* fv2SPGap1B_inclusive_mb;   //! TBD
@@ -246,7 +284,7 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   TProfile* fv2SPGap1B_inclusive_lq;   //! TBD
   TProfile* fv2SPGap1A_inclusive_sq;   //! TBD
   TProfile* fv2SPGap1B_inclusive_sq;   //! TBD
-  
+
   TProfile* fResSPmc_inclusive;   //! TBD
   TProfile* fv2SPGap1Amc_inclusive_mb;   //! TBD
   TProfile* fv2SPGap1Bmc_inclusive_mb;   //! TBD
@@ -254,27 +292,27 @@ class AliAnalysisTaskV2AllChAOD : public AliAnalysisTaskSE
   TProfile* fv2SPGap1Bmc_inclusive_lq;   //! TBD
   TProfile* fv2SPGap1Amc_inclusive_sq;   //! TBD
   TProfile* fv2SPGap1Bmc_inclusive_sq;   //! TBD
-  
+
   // v2 vs qvec...
-  
+
   TProfile*     fResGap1w;           //!
   TProfile*     fV2IntGap1w;         //! integrated v2 for gap 0.8 w
   TProfile*     fResSP_vs_Qvec[9];   //! TBD
   TProfile*     fV2IntGap1wq[9];     //!
-  
+
   Bool_t fIsRecoEff;   // TBD
   TList * fRecoEffList; // reconstruction efficiency file
-  
+
   Bool_t fQvecGen;  //enable Qvec from generated
   Int_t  fQgenType; // type==0 qgen from tracks - type==1 qgen from vzero
   Int_t  fnNchBins; //Ncharged
-  
+
   Bool_t fDoCentrSystCentrality; //systematic check on centrality estimation
 
-  
+
   AliAnalysisTaskV2AllChAOD(const AliAnalysisTaskV2AllChAOD&);
   AliAnalysisTaskV2AllChAOD& operator=(const AliAnalysisTaskV2AllChAOD&);
-  
+
   ClassDef(AliAnalysisTaskV2AllChAOD, 16);
 };
 
index c2a7b2f52c0254edf8bfab46b51a3191b2d57ecf..7bc70cc376aab6f7b41031d57ad01410a021aee8 100644 (file)
@@ -406,7 +406,9 @@ Double_t AliSpectraAODEventCuts::CalculateQVectorTPC(Double_t etaMin,Double_t et
                AliAODTrack* aodTrack = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iT));
                if(!aodTrack) AliFatal("Not a standard AOD");
                if (!aodTrack->TestFilterBit(128)) continue;  //FIXME track type hard coded -> TPC only constrained to the vertex
-               if (aodTrack->Eta() <etaMin || aodTrack->Eta() > etaMax)continue;
+               if (aodTrack->Eta() <etaMin || aodTrack->Eta() > etaMax)continue; //default: etaMin=-0.5. etaMax=0.5
+               if (aodTrack->Pt()<0.2 || aodTrack->Pt()>20.)continue; //FIXME add variable pt cut, pt cut as in https://aliceinfo.cern.ch/Notes/node/71
+               
                mult++;
                Qx2 += TMath::Cos(2*aodTrack->Phi());
                Qy2 += TMath::Sin(2*aodTrack->Phi());
@@ -714,7 +716,7 @@ Double_t AliSpectraAODEventCuts::GetQvecPercentile(Int_t v0side){
 
        if(fQvecCalibType==1){
                if(fNch<0.) return -999.;
-               ic = GetNchBin(fQvecIntegral);
+               if(fQvecIntegral)ic = GetNchBin(fQvecIntegral);
        } else ic = (Int_t)fCent; //fQvecIntegral: 1% centrality bin
 
        TH1D *h1D = (TH1D*)fQvecIntegral->ProjectionY("h1D",ic+1,ic+1);
@@ -818,7 +820,7 @@ Double_t AliSpectraAODEventCuts::CalculateQVectorMC(Int_t v0side, Int_t type=1){
                        Int_t iv0 = CheckVZEROchannel(v0side, partMC->Eta(), partMC->Phi());
 
                        //use the efficiecy as a weigth
-                       multv0mc[iv0] += fV0Aeff->GetFunction("f")->Eval(partMC->Pt());
+                       if(iv0>=0)multv0mc[iv0] += fV0Aeff->GetFunction("f")->Eval(partMC->Pt());
 
                        //calculate multiplicity for each vzero channell
                        //multv0mc[iv0]++;
@@ -937,7 +939,7 @@ Double_t AliSpectraAODEventCuts::GetQvecPercentileMC(Int_t v0side, Int_t type=1)
 
        if(fQvecCalibType==1){
                if(fNch<0.) return -999.;
-               ic = GetNchBin(fQgenIntegral);
+               if(fQgenIntegral)ic = GetNchBin(fQgenIntegral);
        } else ic = (Int_t)fCent; //fQvecIntegral: 1% centrality bin
 
        TH1D *h1D = (TH1D*)fQgenIntegral->ProjectionY("h1Dgen",ic+1,ic+1);
@@ -961,8 +963,8 @@ Double_t AliSpectraAODEventCuts::GetQvecPercentileMC(Int_t v0side, Int_t type=1)
                        fSplineArrayV0Cgen->AddAtAndExpand(spline,ic);
                }
        }
-
-       Double_t percentile = 100*spline->Eval(qvec);
+       Double_t percentile=-999.;
+       if(spline)percentile = 100*spline->Eval(qvec);
 
        if(percentile>100. || percentile<0.) return -999.;
 
index 82588caf3ef2fe1674f7e9c166dab88ba7e5c239..a408e0cb24d253f351cd731890071efea0bfac33 100644 (file)
@@ -356,7 +356,6 @@ Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
        
        TString par1name("cent");
        par1name+=fCentEstimator;
-       cout<<par1name.Data()<<endl;
        TParameter<Double_t>* par= dynamic_cast<TParameter<Double_t>*>(fAOD->FindListObject(par1name.Data()));
        if(par)
        {
@@ -414,6 +413,12 @@ Bool_t AliSpectraBothEventCuts::CheckMultiplicityCut()
                else
                {
                        AliESDEvent* esdevent=dynamic_cast<AliESDEvent*>(fAOD);
+                       if(!esdevent)
+                       {
+                               AliFatal("Not a standard ESD");
+                               return kFALSE;
+
+                       }
                        AliESDtrackCuts::MultEstTrackType estType = esdevent->GetPrimaryVertexTracks()->GetStatus() ? AliESDtrackCuts::kTrackletsITSTPC : AliESDtrackCuts::kTracklets;
                        Ncharged=AliESDtrackCuts::GetReferenceMultiplicity(esdevent,estType,fetarangeofmultiplicitycut);
                }
@@ -422,8 +427,17 @@ Bool_t AliSpectraBothEventCuts::CheckMultiplicityCut()
        {
                AliAODEvent* aodevent=0x0;
                aodevent=dynamic_cast<AliAODEvent*>(fAOD);
+               if(!aodevent)
+               {
+                       AliFatal("Not a standard AOD");
+                       return kFALSE;
+               }
                 AliAODHeader * header = dynamic_cast<AliAODHeader*>(aodevent->GetHeader());
-                if(!header) AliFatal("Not a standard AOD");
+                if(!header)
+               { 
+                       AliFatal("Not a standard AOD");
+                       return kFALSE;
+               }
 
                if(TMath::Abs(0.8-fetarangeofmultiplicitycut)<0.1)
                        Ncharged=header->GetRefMultiplicityComb08();
index 7349de2a26978bb16d0475647c82a935d27ae3c6..5974b1ef455f8c08a9887535f8849f6edf45f898 100644 (file)
@@ -69,7 +69,7 @@ void AliSpectraBothPID::FillQAHistos(AliSpectraBothHistoManager * hman, AliVTrac
 
        }
        Float_t tmppt=TMath::Min(trackCuts->GetPtTOFMatchingPion(),TMath::Min(trackCuts->GetPtTOFMatchingKaon(),trackCuts->GetPtTOFMatchingProton()));
-       if(track->Pt()>tmppt&&trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trackCuts->CheckTOFMatchingParticleType(kSpPion))
+       if(track->Pt()>=tmppt&&trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trackCuts->CheckTOFMatchingParticleType(kSpPion))
        {
     
                 hman->GetPIDHistogram(kHistPIDTOF)->Fill(track->P(),(track->GetTOFsignal()/100)*track->Charge()); // PID histo
@@ -222,36 +222,36 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
 
        if(trackCuts->GetUseTypeDependedTOFCut())
        {
-               if(trackCuts->CheckTOFMatchingParticleType(kSpPion)&&trk->Pt()>trackCuts->GetPtTOFMatchingPion())
+               if(trackCuts->CheckTOFMatchingParticleType(kSpPion)&&trk->Pt()>=trackCuts->GetPtTOFMatchingPion())
                {       
                        nsigmaTOFkPion   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kPion)+fshiftTOF); 
                        nsigmaTPCTOFkPion   = TMath::Sqrt((nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion)/2.);
                }
-               else if (trk->Pt()>trackCuts->GetPtTOFMatchingPion()) // tracks without proper flags
+               else if (trk->Pt()>=trackCuts->GetPtTOFMatchingPion()) // tracks without proper flags
                {
                        nsigmaTOFkPion   = 10000.0; 
                        nsigmaTPCTOFkPion   =10000.0;
 
                }       
                        
-               if(trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trk->Pt()>trackCuts->GetPtTOFMatchingKaon())
+               if(trackCuts->CheckTOFMatchingParticleType(kSpKaon)&&trk->Pt()>=trackCuts->GetPtTOFMatchingKaon())
                {       
                        nsigmaTOFkKaon   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kKaon)+fshiftTOF); 
                        nsigmaTPCTOFkKaon   = TMath::Sqrt((nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon)/2.);
                }
-               else if (trk->Pt()>trackCuts->GetPtTOFMatchingKaon()) // tracks without proper flags
+               else if (trk->Pt()>=trackCuts->GetPtTOFMatchingKaon()) // tracks without proper flags
                {
                        nsigmaTOFkKaon   = 10000.0; 
                        nsigmaTPCTOFkKaon   =10000.0;
 
                }       
 
-               if(trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trk->Pt()>trackCuts->GetPtTOFMatchingProton())
+               if(trackCuts->CheckTOFMatchingParticleType(kSpProton)&&trk->Pt()>=trackCuts->GetPtTOFMatchingProton())
                {       
                        nsigmaTOFkProton   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kProton)+fshiftTOF); 
                        nsigmaTPCTOFkProton   = TMath::Sqrt((nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton)/2.);
                }
-               else if (trk->Pt()>trackCuts->GetPtTOFMatchingProton()) // tracks without proper flags
+               else if (trk->Pt()>=trackCuts->GetPtTOFMatchingProton()) // tracks without proper flags
                {
                        nsigmaTOFkProton   = 10000.0; 
                        nsigmaTPCTOFkProton   =10000.0;
@@ -260,7 +260,7 @@ Int_t AliSpectraBothPID::GetParticleSpecie(AliSpectraBothHistoManager * hman,Ali
 
 
        }
-       else if(trk->Pt()>trackCuts->GetPtTOFMatching())
+       else if(trk->Pt()>=trackCuts->GetPtTOFMatching())
        {
                nsigmaTOFkProton = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kProton)+fshiftTOF);
                nsigmaTOFkKaon   = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(inEvHMain, AliPID::kKaon)+fshiftTOF); 
index 86cf2fe7676f78f257b26048ae95e55382f3eda8..1ac4f2dc95458103bbb5ede8af048a4aa7e0e25d 100644 (file)
@@ -514,7 +514,7 @@ void AliAnalysisTaskCTauPbPbaod::UserExec(Option_t *)
   Int_t mult=0;
   for (Int_t i=0; i<ntrk1; i++) {
     AliAODTrack *t=dynamic_cast<AliAODTrack*>(aod->GetTrack(i));
-    if(!t) AliFatal("Not a standard AOD");
+    if(!t) { AliFatal("Not a standard AOD"); return; }
     if (t->IsMuonTrack()) continue;
     if (!t->IsOn(AliAODTrack::kTPCrefit)) continue;
 
index e4875b9573cdfd707b62c78f01ebbba11eb2be9b..6ff5479f0852b7f1d9e6f3ea4a8c111bcd1c19e8 100644 (file)
@@ -292,5 +292,9 @@ install(FILES TRD/TRDPID/macros/AddTaskTRDPIDTree.C
 install(FILES ZDC/AddTaskZDCQA.C DESTINATION PWGPP/ZDC)
 install(FILES PilotTrain/AddTaskMuonQA.C DESTINATION PWGPP/PilotTrain/ )
 install(FILES VZERO/AddTaskVZEROPbPb.C DESTINATION PWGPP/VZERO/)
+install(DIRECTORY MUON/lite DESTINATION PWGPP/MUON FILES_MATCHING PATTERN "*.C")
+install(DIRECTORY scripts DESTINATION PWGPP USE_SOURCE_PERMISSIONS)
+install(DIRECTORY QA/scripts DESTINATION PWGPP/QA USE_SOURCE_PERMISSIONS)
+install(DIRECTORY QA/detectorQAscripts DESTINATION PWGPP/QA USE_SOURCE_PERMISSIONS)
 
 message(STATUS "PWGPP enabled")
index b772077329d4e98f373742b3bcc040caf291577d..4ce66c3344742132e8007125295e89e6e64a27d7 100644 (file)
@@ -45,7 +45,6 @@ secondsToSuicide=$(( 10*3600 ))
 
 #how to copy, default (empty string) uses alien_cp
 #copyMethod=tfilecp
-#copyScript=/hera/alice/aux/scripts/cron_scripts/alienSync/copyAlienFile.C
 
 #copyTimeout=600
 #copyTimeoutHard=1200
index 589740200de589f9209ef4046b6450a5e22dcc3d..92aa5f2429c44a5a33b209b629db69be678d6e29 100755 (executable)
@@ -236,7 +236,6 @@ main()
     #fi
     
     export copyMethod
-    export copyScript
     export copyTimeout
     export copyTimeoutHard
     echo copyFromAlien "$alienFile" "$tmpdestination"
@@ -506,11 +505,18 @@ copyFromAlien()
   dst=$2
   if [[ "$copyMethod" == "tfilecp" ]]; then
     if which timeout &>/dev/null; then
-      echo timeout $copyTimeout root -b -q "$copyScript(\"$src\",\"$dst\")"
-      timeout $copyTimeout root -b -q "$copyScript(\"$src\",\"$dst\")"
+      echo timeout $copyTimeout "TFile::Cp(\"$src\",\"$dst\")"
+      timeout $copyTimeout root -b <<EOF
+TGrid::Connect("alien://");
+TFile::Cp("${src}","${dst}");
+EOF
+
     else
-      echo root -b -q "$copyScript(\"$src\",\"$dst\")"
-      root -b -q "$copyScript(\"$src\",\"$dst\")"
+      echo "TFile::Cp(\"$src\",\"$dst\")"
+      root -b <<EOF
+TGrid::Connect("alien://");
+TFile::Cp("${src}","${dst}");
+EOF
     fi
   else
     if which timeout &>/dev/null; then
index 4f6f53f3849684068ad51354e8ef698d6e0a3c59..c0c72bbebcc984d593a44cee70f7d95c34f50512 100644 (file)
@@ -134,11 +134,11 @@ AliTPCPIDBase::~AliTPCPIDBase()
   delete fV0KineCuts;
   fV0KineCuts = 0;
   
-  delete fV0tags;
+  delete [] fV0tags;
   fV0tags = 0;
   fNumTagsStored = 0;
   
-  delete fV0motherIndex;
+  delete [] fV0motherIndex;
   fV0motherIndex = 0;
 }
 
@@ -411,10 +411,10 @@ void AliTPCPIDBase::ClearV0PIDlist()
   // Clear the PID tag list
   //
 
-  delete fV0tags;
+  delete [] fV0tags;
   fV0tags = 0;
   
-  delete fV0motherIndex;
+  delete [] fV0motherIndex;
   fV0motherIndex = 0;
   
   fNumTagsStored = 0;
index 366c3e948e5dcb88e241adf72f104c115d1d7dc3..915196d466a8c4a340dfc47ede7fbb06e10d71a7 100644 (file)
@@ -245,14 +245,14 @@ AliTPCcalibResidualPID::~AliTPCcalibResidualPID()
   delete fV0KineCuts;
   fV0KineCuts = 0;
   
-  delete fV0tags;
+  delete [] fV0tags;
   fV0tags = 0;
   fNumTagsStored = 0;
   
-  delete fV0motherIndex;
+  delete [] fV0motherIndex;
   fV0motherIndex = 0;
   
-  delete fV0motherPDG;
+  delete [] fV0motherPDG;
   fV0motherPDG = 0;
 }
 
@@ -3864,13 +3864,13 @@ void AliTPCcalibResidualPID::ClearV0PIDlist()
   // Clear the PID tag list
   //
 
-  delete fV0tags;
+  delete [] fV0tags;
   fV0tags = 0;
   
-  delete fV0motherIndex;
+  delete [] fV0motherIndex;
   fV0motherIndex = 0;
   
-  delete fV0motherPDG;
+  delete [] fV0motherPDG;
   fV0motherPDG = 0;
   
   fNumTagsStored = 0;
index 4a57d0323fb88965695213a764dafc3a71758a20..3e1d0d7df538d8fcfd6353561189c48b38325a4d 100644 (file)
@@ -300,7 +300,8 @@ void AliTRDPIDTree::FillTree(AliESDtrack *track, Int_t pdgfromv0, Int_t runnumbe
     if(!(hasTOFout && hasTOFtime)) return;
 
     // add kaons?
-    Double_t nSigmaTPC, nSigmaTOF;
+    Double_t nSigmaTPC = 0;
+    Double_t nSigmaTOF = 0;
 
     if(TMath::Abs(pdgfromv0)==11){
        nSigmaTPC=fPIDResponse->NumberOfSigmasTPC(track,AliPID::kElectron);
@@ -533,7 +534,7 @@ void AliTRDPIDTree::ClearV0PIDlist(){
   fV0pions->Clear();
   fV0protons->Clear();
 
-  delete fV0tags;
+  delete[] fV0tags;
   fV0tags = 0;
 
   fNumTagsStored = 0;
index 499ee6858e2e45f2eec1974cfeb5f8eff1fa7c8d..929eaa95499322a112afcb378439d8e7a88a2ea8 100644 (file)
@@ -935,7 +935,7 @@ void AliAnalysisTaskK0sBayes::Analyze(AliAODEvent* aodEvent)
       Float_t xTOfill2[] = {static_cast<Float_t>(fPtKs),static_cast<Float_t>(KpTrack->Eta()),static_cast<Float_t>(fPtKp),static_cast<Float_t>(fPtKn),static_cast<Float_t>(probP[2]),static_cast<Float_t>(probN[2]),static_cast<Float_t>(tofMatch1),static_cast<Float_t>(tofMatch2),static_cast<Float_t>(isTrue),static_cast<Float_t>(nSigmaComb),static_cast<Float_t>(nSigmaComb2),static_cast<Float_t>(deltaphi1),static_cast<Float_t>(deltaphi2),static_cast<Float_t>(fPsi)};
       
       Int_t ipt = 0;
-      while(fPtKsMin[ipt] < fPtKs && ipt < nPtBin){
+      while(ipt < nPtBin && fPtKsMin[ipt] < fPtKs){
        ipt++;
       }
       ipt--;
index d79414c8a289379e8398bd507a916b17198c5456..0b32ff3aeddcad3b8761d8b4378a94fa2935e755 100644 (file)
@@ -922,7 +922,7 @@ void AliAnalysisTaskLambdaBayes::Analyze(AliAODEvent* aodEvent)
       
 
       Int_t ipt = 0;
-      while(fPtLambdaMin[ipt] < fPtLambdaC && ipt < nPtBin){
+      while(ipt < nPtBin && fPtLambdaMin[ipt] < fPtLambdaC){
        ipt++;
       }
       ipt--;
index eeaa0a0a28bd64c9bf83384a47b9125246d5a321..12a75e41975776c543f7dcadcacd4194ca33e209 100644 (file)
@@ -907,7 +907,7 @@ void AliAnalysisTaskPhiBayes::Analyze(AliAODEvent* aodEvent)
       Float_t xTOfill2[] = {static_cast<Float_t>(fPtPhi),static_cast<Float_t>(KpTrack->Eta()),static_cast<Float_t>(fPtKp),static_cast<Float_t>(fPtKn),static_cast<Float_t>((fPidKp%128)*0.01),static_cast<Float_t>((fPidKn%128)*0.01),static_cast<Float_t>(tofMatch1),static_cast<Float_t>(tofMatch2),static_cast<Float_t>(isTrue),static_cast<Float_t>(nSigmaComb),static_cast<Float_t>(nSigmaComb2),static_cast<Float_t>(deltaphi1),static_cast<Float_t>(deltaphi2),static_cast<Float_t>(fPsi)};
       
       Int_t ipt = 0;
-      while(fPtPhiMin[ipt] < fPtPhi && ipt < nPtBin){
+      while(ipt < nPtBin && fPtPhiMin[ipt] < fPtPhi){
        ipt++;
       }
       ipt--;
index ac751b16d71ac2a0e5f71f6a949d93677928a6b9..5de647ed5448ee14494d46f18be7d523ca550021 100755 (executable)
@@ -181,7 +181,10 @@ setYear()
   local path=${2}
   [[ ${yearSource} -ne ${yearTarget} && -n ${yearTarget} && -n ${yearSource} ]] \
     && path=${2/\/"${yearTarget}"/\/"${yearSource}"}
-  echo ${path/\/\//\/}
+  path=${path/\/\//\/}
+  # The previous line would transform raw:// in raw:/
+  # The next fixes this
+  echo ${path/%:\//:\/\/}
   return 0
 }
 
index 6b9c76921c3a12c321e5c6efcbe66e5cb53b8688..8db5752f7cc8952d58950e7883282ddcd5e6b403 100644 (file)
@@ -327,8 +327,14 @@ void AliAnalysisTaskCDskimESD::UserExec(Option_t */*opt*/)
                        (AliMCEventHandler*)am->GetMCtruthEventHandler();
                TTree* treeK = mcHandler->TreeK();
                TTree* treeTR = mcHandler->TreeTR();
-               if (!treeK) AliFatal("TreeK not found!");
-               if (!treeTR) AliFatal("TreeTR not found!");
+               if (!treeK) {
+                       AliFatal("TreeK not found!");
+                       return;
+               }
+               if (!treeTR) {
+                       AliFatal("TreeTR not found!");
+                       return;
+               }
 
                fWrkDir = gDirectory;
                gDirectory = fKinematicsFile;
@@ -336,6 +342,10 @@ void AliAnalysisTaskCDskimESD::UserExec(Option_t */*opt*/)
                gDirectory->mkdir(dirName);
                gDirectory->cd(dirName);
                TTree* outputTreeK = treeK->CloneTree(); // copy the whole tree
+               if (!outputTreeK) {
+                       AliFatal("Could not clone TreeK!");
+                       return;
+               }
                outputTreeK->Write();
                treeK->CopyAddresses(outputTreeK, kTRUE); // separate clone again
                treeK->GetListOfClones()->Remove((TObject*)outputTreeK);
@@ -346,6 +356,10 @@ void AliAnalysisTaskCDskimESD::UserExec(Option_t */*opt*/)
                gDirectory->mkdir(dirName);
                gDirectory->cd(dirName);
                TTree* outputTreeTR = treeTR->CloneTree(); // copy the whole tree
+               if (!outputTreeTR) {
+                       AliFatal("Could not clone TreeTR");
+                       return;
+               }
                outputTreeTR->Write();
                treeTR->CopyAddresses(outputTreeTR, kTRUE); // separate clone again
                treeTR->GetListOfClones()->Remove((TObject*)outputTreeTR);
index 00005a7154c56d6a04716afef950f8f59e0d320f..52707afd6b015587d18a8b129d5c6eb094e6fa4c 100644 (file)
@@ -785,6 +785,11 @@ void SpaceShower::pT2nearQCDthreshold( BeamParticle& beam,
   double logM2Lambda2  = log( m2Massive / Lambda2 );
   double xPDFmotherOld = beam.xfISR(iSysNow, 21, xDaughter, 
     factorMultFac * m2Threshold);
+  if (xPDFmotherOld == 0) {
+    infoPtr->errorMsg("Error in SpaceShower::pT2nearQCDthreshold: "
+      "xPDFmotherOld is 0"); 
+    return; 
+  }
 
   // Variables used inside evolution loop. (Mainly dummy start values.)
   int    loop    = 0;
index 42f9425a8729c908f1bd546ccba150ce79efd4b0..47886e05d21f78e406d0c36d0a8b0324c8290a6b 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 164                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
+// $Rev:: 192                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:25 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -77,6 +77,9 @@ class Gammaavectormeson : public eventChannel
   int _VMinterferencemode;
   int _VMCoherence;
   int _ProductionMode;
+  int _TargetBeam; 
+  int N1;
+  int N2; 
   double _VMCoherenceFactor;
   double _VMgamma_em;
   double _VMNPT;
index de7b6f79f2ac8538fb57bc3f5cafff8419e65cf4..5a82db75b65dd9c90bd4cd143565e7b319cb1a4a 100644 (file)
@@ -73,7 +73,7 @@ class Gammagammaleptonpair : public eventChannel
   void pairMomentum(double w,double y,double &E,double &px,double &py,double&pz);
   double pp_1(double E);
   double pp_2(double E);
-  void twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double E,double W,double px0,double py0,double pz0,double &px1,double &py1,double&pz1,double &px2,double &py2,/*double &py2,*/double &pz2,int &iFbadevent);
+  void twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double E,double W,double px0,double py0,double pz0,double &px1,double &py1,double &pz1,double &pt1,double &px2,double &py2,double &pz2,double &pt2,double &mdec,int &iFbadevent);
   double thetalep(double W,double theta);
   void tauDecay(double &px1,double &py1,double &pz1,double &E1,double &px2,double &py2,double &pz2,double &E2);
   
index 344663dee166240f3c06ca88430e6bc0664982d3..0a8354e1345d56dbbfde11fbefe23df8f1896c5c 100644 (file)
@@ -70,7 +70,12 @@ class Gammagammasingle : public eventChannel
   
   void parentMomentum(double w,double y,double &E,double &px,double &py,double&pz);
   double pp(double E);
-  void twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double E,double W,double px0,double py0,double pz0,double &px1,double &py1,double&pz1,double &px2,double &py2,/*double &py2,*/double &pz2,int &iFbadevent);
+  void twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double E,double W,
+                   double px0,double py0,double pz0,
+                   double &px1,double &py1,double &pz1, double &pt1,
+                   double &px2,double &py2,double &pz2, double &pt2,
+                   double &mdec,
+                   int &iFbadevent);
   // void transform(double betax,double betay,double betaz,double &E,double &px,double &py,double &pz,int &iFbadevent);
   void thephi(double W,double px,double py,double pz,double E,double &theta,double &phi);
   
index ca33b830bc4a35098b582b9b51d1101d353de2ee..9fb0df20b6004fafea6806241915d27c8830744e 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 164                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
+// $Rev:: 192                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:25 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -60,10 +60,13 @@ public:
        // So just use the wide or narrow constructor to calculate it
        // wide/narrow will inherit this.
        double getcsgA(const double Egamma,
-                      const double W);
-       double photonFlux(const double Egamma);
+                      const double W,
+                       const int beam);
+       double photonFlux(const double Egamma,
+                       const int beam);
        double sigmagp(const double Wgp);
-       double sigma_A(const double sig_N);
+       double sigma_A(const double sig_N, 
+                       const int beam);
         double sigma_N(const double Wgp);
        double breitWigner(const double W,
                           const double C);
index 8755817556dfee573fa1a35d71ec12d6d506e1af..69381c1c16e5cd22a63cbd4e78e49a3717d74996 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 164                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
+// $Rev:: 192                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:25 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -52,11 +52,16 @@ class readLuminosity
   */
   double *_Warray;
   double *_Yarray;
-  double **_Farray;
+  double **_Farray; 
+  double **_Farray1;
+  double **_Farray2;
   
   double _f_max;
+  double _f_max1;
+  double _f_max2;
+
   double _fptarray[500][500];
-  //           inputParameters inputread;
+
   double _bwnormsave;
 
  protected:
index 0b48e7116704a63ff6c4975918e0e0c07c309a43..ac483d15c15cb2d0cf4e0b25bd3b3f62a4761e94 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 176                         $: revision of last commit
-// $Author:: jseger                   $: author of last commit
-// $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit
+// $Rev:: 193                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -188,7 +188,6 @@ beamBeamSystem::generateBreakupProbabilities()
         if (_beamBreakupMode == 7)
             printInfo << "Requiring breakup of one nucleus (Xn,0n). " << endl;
 
-        //pp may cause segmentation fault in here and it does not use this...
        double pOfB = 0;
        double b = bMin;
         double totRad = _beam1.nuclearRadius()+_beam2.nuclearRadius();
@@ -212,7 +211,7 @@ beamBeamSystem::generateBreakupProbabilities()
             {
                 if((1-pOfB)<_breakupCutOff)
                 {
- //                         std::cout << "Break off b: " << b << std::endl;
+//                         std::cout << "Break off b: " << b << std::endl;
 //                         std::cout << "Number of PofB bins: " << _breakupProbabilities.size() << std::endl;
                         break;
                 }
@@ -239,7 +238,7 @@ beamBeamSystem::generateBreakupProbabilities()
             b *= _breakupImpactParameterStep;
            pOfB = exp(-1 * _pHadronBreakup) * _pPhotonBreakup;
             _breakupProbabilities.push_back(pOfB);
-        }
+        } // End while(1)
     }
     else if (((_beam1.Z() == 1) && (_beam1.A() == 1)) || ((_beam2.Z() == 1) && (_beam2.A() == 1))) {  
       
@@ -282,21 +281,20 @@ beamBeamSystem::generateBreakupProbabilities()
 double
 beamBeamSystem::probabilityOfHadronBreakup(const double impactparameter)
 {
-       //      double pbreakup =0.; 
        //probability of hadron breakup, 
        //this is what is returned when the function is called
        double gamma = _beamLorentzGamma; 
        //input for gamma_em
        //this will need to be StarlightInputParameters::gamma or whatever
        double b = impactparameter;
-       int ap = _beam1.A();  
-       //Notice this is  taking from nucleus 1.Still assuming symmetric system?
+       int a1 = _beam1.A();  
+       int a2 = _beam2.A();  
 
        static int IFIRSTH = 0;
-       static double DELL=0., DELR=0., SIGNN=0., R1=0., A1=0., R2=0., RHO1=0.;
-       static double RHO2=0., NZ1=0., NZ2=0., NR1=0., NR2=0.,RR1=0., NY=0., NX=0.;
+       static double DELL=0., DELR=0., SIGNN=0., R1=0., A1=0., A2=0., R2=0., RHO1=0.;
+       static double RHO2=0., NZ1=0., NZ2=0., NR1=0., NR2=0.,RR1=0., RR2=0., NY=0., NX=0.;
        static double AN1=0., AN2=0.;
-       double delo=0.,RSQ=0.,Z1=0.,Y=0.,X=0.,XB=0.,RPU=0.,IRUP=0.,RTU=0.;
+       double delo=0.,RSQ=0.,Z1=0.,Z2=0.,Y=0.,X=0.,XB=0.,RPU=0.,IRUP=0.,RTU=0.;
        double IRUT=0.,T1=0.,T2=0.;
        static double DEN1[20002], DEN2[20002];
        if (IFIRSTH != 0) goto L100;
@@ -308,21 +306,25 @@ beamBeamSystem::probabilityOfHadronBreakup(const double impactparameter)
 
        //use two sigma_NN's. 52mb at rhic 100gev/beam, 88mb at LHC 2.9tev/beam, gamma is in cm system
        SIGNN = 5.2;
-       if ( gamma > 500. ) SIGNN = 8.8;
+       if ( gamma > 500. ) SIGNN = 8.8; 
        //use parameter from Constants
-       R1 = ( _beam1.nuclearRadius());  //remember _beam2? better way to do this generically
-       A1 = 0.535; //This is woodsaxonskindepth?
+       R1 = ( _beam1.nuclearRadius());  
+        R2 = ( _beam2.nuclearRadius());
+       A1 = 0.535; //This is woodsaxonskindepth
+        A2 = 0.535; 
        //write(6,12)r1,a1,signn  Here is where we could probably set this up asymmetrically R2=_beam2.nuclearRadius() and RHO2=ap2=_beam2.A()
-       R2 = R1;
-       RHO1 = ap;
-       RHO2 = RHO1;
+       // R2 = R1;
+       RHO1 = a1;
+       RHO2 = a2;
        NZ1  = ((R1+5.)/DELR);
        NR1  = NZ1;
        NZ2  = ((R2+5.)/DELR);
        NR2  = NZ2;
        RR1  = -DELR;
+        RR2  = -DELR; 
        NY   = ((R1+5.)/DELL);
        NX   = 2*NY;
+       // This calculates T_A(b) for beam 1 and stores it in DEN1[IR1] 
        for ( int IR1 = 1; IR1 <= NR1; IR1++) {
                DEN1[IR1] = 0.;
                RR1       = RR1+DELR;
@@ -332,21 +334,40 @@ beamBeamSystem::probabilityOfHadronBreakup(const double impactparameter)
                        Z1  = Z1+DELR;
                        RSQ = RR1*RR1+Z1*Z1;
                        DEN1[IR1] = DEN1[IR1]+1./(1.+exp((sqrt(RSQ)-R1)/A1));
-               }//for(IZ)
+               }
 
                DEN1[IR1] = DEN1[IR1]*2.*DELR;
-               DEN2[IR1] = DEN1[IR1];
-       }//for(IR)
+       }
+
+       // This calculates T_A(b) for beam 2 and stores it in DEN2[IR2] 
+       for ( int IR2 = 1; IR2 <= NR2; IR2++) {
+               DEN2[IR2] = 0.;
+               RR2       = RR2+DELR;
+               Z2        = -DELR/2;
+
+               for ( int IZ2 = 1; IZ2 <= NZ2; IZ2++) {
+                       Z2  = Z2+DELR;
+                       RSQ = RR2*RR2+Z2*Z2;
+                       DEN2[IR2] = DEN2[IR2]+1./(1.+exp((sqrt(RSQ)-R2)/A2));
+               }
+
+               DEN2[IR2] = DEN2[IR2]*2.*DELR;
+       }
 
        AN1 = 0.;
        RR1 = 0.;
+        RR2 = 0.;
     
        for ( int IR1 =1; IR1 <= NR1; IR1++) {
                RR1 = RR1+DELR;
                AN1 = AN1+RR1*DEN1[IR1]*DELR*2.*3.141592654;
-       }//for(IR)
+       }
+       for ( int IR2 =1; IR2 <= NR2; IR2++) {
+               RR2 = RR2+DELR;
+               AN2 = AN2+RR2*DEN2[IR2]*DELR*2.*3.141592654;
+       }
         
-       AN2 = AN1; //This will also probably need to be changed?
+       // AN2 = AN1; //This will also probably need to be changed?
 
        delo = .05;
        //.1 to turn mb into fm^2
index 86fcb4eb23b782db879745c4edeef861de7bbbc3..029e1fd34b31317eaafaedb5cf56124571ac9d24 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 176                         $: revision of last commit
-// $Author:: jseger                   $: author of last commit
-// $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit
+// $Rev:: 193                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -69,14 +69,12 @@ photonNucleusLuminosity::~photonNucleusLuminosity()
 //______________________________________________________________________________
 void photonNucleusLuminosity::photonNucleusDifferentialLuminosity()
 {
-       // double Av,Wgp,cs,cvma;
   double W,dW,dY;
   double Egamma,Y;
-  // double t,tmin,tmax;
   double testint,dndWdY;
   double csgA;
-  // double ax,bx;
   double C;  
+  int beam; 
 
   ofstream wylumfile;
   wylumfile.precision(15);
@@ -129,34 +127,41 @@ void photonNucleusLuminosity::photonNucleusDifferentialLuminosity()
   Eth=0.5*(((_wMin+starlightConstants::protonMass)*(_wMin
                                                            +starlightConstants::protonMass)-starlightConstants::protonMass*starlightConstants::protonMass)/
           (inputParametersInstance.protonEnergy()+sqrt(inputParametersInstance.protonEnergy()*
-                                              inputParametersInstance.protonEnergy()-starlightConstants::protonMass*starlightConstants::protonMass)));
-  
+                                              inputParametersInstance.protonEnergy()-starlightConstants::protonMass*starlightConstants::protonMass))); 
+
+  int A_1 = getbbs().beam1().A(); 
+  int A_2 = getbbs().beam2().A();
+
+  // Do this first for the case when the first beam is the photon emitter 
+  // Treat pA separately with defined beams 
+  // The variable beam (=1,2) defines which nucleus is the target 
   for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
 
     W = _wMin + double(i)*dW + 0.5*dW;
     
-    for(unsigned int j = 0; j <= _nYbins - 1; ++j) {
+    for(unsigned int j = 0; j <= _nYbins - 1; ++j) { 
 
       Y = -1.0*_yMax + double(j)*dY + 0.5*dY;
 
-      int A_1 = getbbs().beam1().A(); 
-      int A_2 = getbbs().beam2().A();
       if( A_2 == 1 && A_1 != 1 ){
-        // pA, first beam is the nucleus 
-        Egamma = 0.5*W*exp(-Y);
+        // pA, first beam is the nucleus and is in this case the target  
+        Egamma = 0.5*W*exp(-Y); 
+        beam = 1; 
       } else if( A_1 ==1 && A_2 != 1){
-        // pA, second beam is the nucleus 
+        // pA, second beam is the nucleus and is in this case the target 
         Egamma = 0.5*W*exp(Y); 
+        beam = 2; 
       } else {
         Egamma = 0.5*W*exp(Y);        
+        beam = 2; 
       }
 
       dndWdY = 0.; 
 
       if( Egamma > Eth && Egamma < maxPhotonEnergy() ){
 
-       csgA=getcsgA(Egamma,W);
-       dndWdY = Egamma*photonFlux(Egamma)*csgA*breitWigner(W,bwnorm);
+       csgA=getcsgA(Egamma,W,beam);
+        dndWdY = Egamma*photonFlux(Egamma,beam)*csgA*breitWigner(W,bwnorm);
 
       }
 
@@ -165,16 +170,49 @@ void photonNucleusLuminosity::photonNucleusDifferentialLuminosity()
     }
   }
 
+  // Repeat the loop for the case when the second beam is the photon emitter. 
+  // Don't repeat for pA
+  if( !( (A_2 == 1 && A_1 != 1) || (A_1 == 1 && A_2 != 1) ) ){ 
+    
+    for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
+
+      W = _wMin + double(i)*dW + 0.5*dW;
+    
+      for(unsigned int j = 0; j <= _nYbins - 1; ++j) {
+
+        Y = -1.0*_yMax + double(j)*dY + 0.5*dY;
+
+        beam = 1; 
+        Egamma = 0.5*W*exp(-Y);        
+
+        dndWdY = 0.; 
+        if( Egamma > Eth && Egamma < maxPhotonEnergy() ){
+
+         csgA=getcsgA(Egamma,W,beam);
+          dndWdY = Egamma*photonFlux(Egamma,beam)*csgA*breitWigner(W,bwnorm);
+
+        }
+
+        wylumfile << dndWdY << endl;
+
+      }
+    }
+  }
+
+  wylumfile << bwnorm << endl;
+  wylumfile << inputParametersInstance.parameterValueKey() << endl;
   wylumfile.close();
   
   if(inputParametersInstance.interferenceEnabled()==1) 
     pttablegen();
  
-  wylumfile.open("slight.txt",ios::app);
-  cout << "bwnorm: "<< bwnorm <<endl;
-  wylumfile << bwnorm << endl;
-  wylumfile << inputParametersInstance.parameterValueKey() << endl;
-  wylumfile.close();
+  //  wylumfile.open("slight.txt",ios::app);
+  // cout << "bwnorm: "<< bwnorm <<endl;
+  //wylumfile << bwnorm << endl;
+  //wylumfile << inputParametersInstance.parameterValueKey() << endl;
+  //wylumfile.close();
+
 }
 
 
@@ -240,6 +278,7 @@ void photonNucleusLuminosity::pttablegen()
   double NPT = inputParametersInstance.nmbPtBinsInterference();
   double gamma_em=inputParametersInstance.beamLorentzGamma();
   double mass= getChannelMass();
+  int beam; 
   
   //  loop over y from 0 (not -ymax) to yma
   
@@ -256,6 +295,7 @@ void photonNucleusLuminosity::pttablegen()
     //  Find the sigma(gammaA) for the two directions
     //  Photonuclear Cross Section 1
     //  Gamma-proton CM energy
+    beam=2; 
     
     Wgp=sqrt(2.*Egamma1*(Ep+sqrt(Ep*Ep-starlightConstants::protonMass*
                                 starlightConstants::protonMass))+starlightConstants::protonMass*starlightConstants::protonMass);
@@ -267,8 +307,7 @@ void photonNucleusLuminosity::pttablegen()
            /starlightConstants::alpha);
     
     // Calculate V.M.+nucleus cross section
-    
-    cvma=sigma_A(cs);
+    cvma=sigma_A(cs,beam);
     
     // Calculate Av = dsigma/dt(t=0) Note Units: fm**2/Gev**2
     
@@ -293,6 +332,7 @@ void photonNucleusLuminosity::pttablegen()
     sig_ga_1 = csgA;
           
     // Photonuclear Cross Section 2
+    beam=1; 
     
     Wgp=sqrt(2.*Egamma2*(Ep+sqrt(Ep*Ep-starlightConstants::protonMass*
                                 starlightConstants::protonMass))+starlightConstants::protonMass*starlightConstants::protonMass);
@@ -300,7 +340,7 @@ void photonNucleusLuminosity::pttablegen()
     cs=sqrt(16.*starlightConstants::pi*vmPhotonCoupling()*slopeParameter()*
            starlightConstants::hbarc*starlightConstants::hbarc*sigmagp(Wgp)/starlightConstants::alpha);
     
-    cvma=sigma_A(cs);
+    cvma=sigma_A(cs,beam);
     
     Av=(starlightConstants::alpha*cvma*cvma)/(16.*starlightConstants::pi
                                              *vmPhotonCoupling()*starlightConstants::hbarc*starlightConstants::hbarc);
index b95284d6499c675ca8d7ee455a8987a9a8d39725..576733a19d4b4fef583105dede443f6f333946cb 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 179                         $: revision of last commit
+// $Rev:: 193                         $: revision of last commit
 // $Author:: jnystrand                $: author of last commit
-// $Date:: 2014-09-11 20:58:05 +0200 #$: date of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //    Added incoherent t2-> pt2 selection.  Following pp selection scheme
@@ -65,6 +65,8 @@ Gammaavectormeson::Gammaavectormeson(beamBeamSystem& bbsystem):eventChannel(bbsy
        _VMCoherenceFactor=inputParametersInstance.coherentProduction();
         _ProductionMode=inputParametersInstance.productionMode();
 
+        N1 = 0; N2 = 0; 
+
        switch(_VMpidtest){
        case starlightConstants::RHO:
        case starlightConstants::RHOZEUS:
@@ -131,7 +133,7 @@ Gammaavectormeson::~Gammaavectormeson()
 //______________________________________________________________________________
 void Gammaavectormeson::pickwy(double &W, double &Y)
 {
-       double dW, dY, xw,xy,xtest;
+        double dW, dY, xw,xy,xtest,btest;
        int  IW,IY;
   
        dW = (_VMWmax-_VMWmin)/double(_VMnumw);
@@ -153,7 +155,32 @@ void Gammaavectormeson::pickwy(double &W, double &Y)
 
        if( xtest > _Farray[IW][IY] )
                goto L201pwy;
-  
+
+       // Determine the target nucleus 
+       // For pA this is given, for all other cases use the relative probabilities in _Farray1 and _Farray2 
+        if( _bbs.beam1().A()==1 && _bbs.beam2().A() != 1){ 
+           if( _ProductionMode == 2 ){
+            _TargetBeam = 2;
+          } else {
+             _TargetBeam = 1;
+           }
+        } else if(  _bbs.beam1().A() != 1 && _bbs.beam2().A()==1 ){
+           if( _ProductionMode == 2 ){
+            _TargetBeam = 1;
+          } else {
+             _TargetBeam = 2;
+           }
+        } else {
+          btest = randyInstance.Rndom();
+          if ( btest < _Farray1[IW][IY]/_Farray[IW][IY] ){
+            _TargetBeam = 2;
+            N2++;
+          }  else {
+            _TargetBeam = 1;
+            N1++; 
+          }
+        }
+       // cout<<"N1: "<<N1<<" N2; "<<N2<<endl;
 }         
 
 
@@ -432,17 +459,18 @@ void Gammaavectormeson::momenta(double W,double Y,double &E,double &px,double &p
            Egam = 0.5*W*exp(Y);
            Epom = 0.5*W*exp(-Y);
           }  
-        } else {
-         Egam = 0.5*W*exp(Y);
+        } else if ( _TargetBeam == 1 ) {
+         Egam = 0.5*W*exp(-Y);
+         Epom = 0.5*W*exp(Y);
+        } else { 
+          Egam = 0.5*W*exp(Y);
          Epom = 0.5*W*exp(-Y);
-        }
+       }
 
-        // cout<<" Y: "<<Y<<" W: "<<W<<" Egam: "<<Egam<<" Epom: "<<Epom<<endl; 
+        // cout<<" Y: "<<Y<<" W: "<<W<<" TargetBeam; "<<_TargetBeam<<" Egam: "<<Egam<<" Epom: "<<Epom<<endl; 
         pt1 = pTgamma(Egam);  
        phi1 = 2.*starlightConstants::pi*randyInstance.Rndom();
 
-       //      cout<<" pt1: "<<pt1<<endl; 
-
        if( (_bbs.beam1().A()==1 && _bbs.beam2().A()==1) || 
             (_ProductionMode == 4) ) {
            if( (_VMpidtest == starlightConstants::RHO) || (_VMpidtest == starlightConstants::RHOZEUS) || (_VMpidtest == starlightConstants::OMEGA)){
@@ -487,6 +515,8 @@ void Gammaavectormeson::momenta(double W,double Y,double &E,double &px,double &p
                   }else{
                     pt2 = 8.*xt*starlightConstants::hbarc/_bbs.beam2().nuclearRadius();  
                   }  
+                } else if (_TargetBeam==1) {
+                    pt2 = 8.*xt*starlightConstants::hbarc/_bbs.beam1().nuclearRadius();  
                 } else {
                     pt2 = 8.*xt*starlightConstants::hbarc/_bbs.beam2().nuclearRadius();  
                 }
@@ -513,27 +543,18 @@ void Gammaavectormeson::momenta(double W,double Y,double &E,double &px,double &p
                     }else{
                       comp = _bbs.beam2().formFactor(t2)*_bbs.beam2().formFactor(t2)*pt2;
                     }  
+                  } else if (_TargetBeam==1) {
+                    comp = _bbs.beam2().formFactor(t2)*_bbs.beam1().formFactor(t2)*pt2;
                   } else {
-                    comp = _bbs.beam2().formFactor(t2)*_bbs.beam2().formFactor(t2)*pt2;
+                    comp = _bbs.beam2().formFactor(t2)*_bbs.beam2().formFactor(t2)*pt2; 
                   }
              
                   if( xtest > comp ) goto L203vm;
                        }
 
-               /*
-               if(_VMCoherence==0 && (!(_bbs.beam2().Z()==1&&_bbs.beam2().A()==2))){
-                    //dsig/dt= exp(-_VMbslope*t)
-                    xtest = randyInstance.Rndom();//random()/(RAND_MAX+1.0);
-                    t2 = (-1./_VMbslope)*log(xtest);
-                    pt2 = sqrt(1.*t2);
-               }
-               */
-
        }//else end from pp
        phi2 = 2.*starlightConstants::pi*randyInstance.Rndom();//random()/(RAND_MAX+1.0);
 
-       //        cout<<" pt2: "<<pt2<<endl;  
-
        px1 = pt1*cos(phi1);
        py1 = pt1*sin(phi1);
        px2 = pt2*cos(phi2);
@@ -549,16 +570,19 @@ void Gammaavectormeson::momenta(double W,double Y,double &E,double &px,double &p
  
         // cout<< " Y = "<<Y<<" W = "<<W<<" Egam = "<<Egam<<" gamma = "<<_VMgamma_em<<endl; 
 
-       // Randomly choose to make pz negative 50% of the time
+       // Keep this special case for d+A 
        if(_bbs.beam2().Z()==1&&_bbs.beam2().A()==2){
                pz = -pz;
-       }else if( (_bbs.beam1().A()==1 && _bbs.beam2().A() != 1) || (_bbs.beam2().A()==1 && _bbs.beam1().A() != 1) ){
+       }
+
+        /*
+        else if( (_bbs.beam1().A()==1 && _bbs.beam2().A() != 1) || (_bbs.beam2().A()==1 && _bbs.beam1().A() != 1) ){
          // Don't switch      
         }
        else{
                if (randyInstance.Rndom() >= 0.5) pz = -pz;
        }
-
+        */
 }
 
 //______________________________________________________________________________
@@ -591,6 +615,8 @@ double Gammaavectormeson::pTgamma(double E)
       }else{
          singleformfactorCm=_bbs.beam1().formFactor(Cm*Cm+ereds);
       }  
+    } else if (_TargetBeam == 1) {
+      singleformfactorCm=_bbs.beam2().formFactor(Cm*Cm+ereds);
     } else {
       singleformfactorCm=_bbs.beam1().formFactor(Cm*Cm+ereds);
     }
@@ -616,6 +642,9 @@ double Gammaavectormeson::pTgamma(double E)
         pp = x*5.*starlightConstants::hbarc/_bbs.beam1().nuclearRadius(); 
         singleformfactorpp1=_bbs.beam1().formFactor(pp*pp+ereds);
       }  
+    } else if (_TargetBeam == 1) {
+        pp = x*5.*starlightConstants::hbarc/_bbs.beam2().nuclearRadius(); 
+        singleformfactorpp1=_bbs.beam1().formFactor(pp*pp+ereds);
     } else {
         pp = x*5.*starlightConstants::hbarc/_bbs.beam1().nuclearRadius(); 
         singleformfactorpp1=_bbs.beam1().formFactor(pp*pp+ereds);
@@ -647,6 +676,9 @@ double Gammaavectormeson::pTgamma(double E)
                 pp = x*5.*starlightConstants::hbarc/_bbs.beam1().nuclearRadius(); 
                 singleformfactorpp2=_bbs.beam1().formFactor(pp*pp+ereds);
               }  
+            } else if (_TargetBeam == 1) {
+              pp = x*5.*starlightConstants::hbarc/_bbs.beam2().nuclearRadius(); 
+              singleformfactorpp2=_bbs.beam1().formFactor(pp*pp+ereds);
             } else {
               pp = x*5.*starlightConstants::hbarc/_bbs.beam1().nuclearRadius(); 
               singleformfactorpp2=_bbs.beam1().formFactor(pp*pp+ereds);
@@ -664,8 +696,8 @@ void Gammaavectormeson::vmpt(double W,double Y,double &E,double &px,double &py,
                              int&) // tcheck (unused)
 {
        //    This function calculates momentum and energy of vector meson
-       //     given W and Y, including interference.
-       //     It gets the pt distribution from a lookup table.
+       //    given W and Y, including interference.
+       //    It gets the pt distribution from a lookup table.
        double dW=0.,dY=0.,yleft=0.,yfract=0.,xpt=0.,pt1=0.,ptfract=0.,pt=0.,pt2=0.,theta=0.;
        int IY=0,j=0;
   
@@ -674,7 +706,7 @@ void Gammaavectormeson::vmpt(double W,double Y,double &E,double &px,double &py,
   
        //  Y is already fixed; choose a pt
        //  Follow the approavh in pickwy.f
-       // in   _fptarray(IY,pt) IY=1 corresponds to Y=0, IY=numy/2 corresponds to +y
+       //  in  _fptarray(IY,pt) IY=1 corresponds to Y=0, IY=numy/2 corresponds to +y
   
        IY=int(fabs(Y)/dY);//+1;
        if (IY > (_VMnumy/2)-1){
@@ -683,17 +715,16 @@ void Gammaavectormeson::vmpt(double W,double Y,double &E,double &px,double &py,
   
        yleft=fabs(Y)-(IY)*dY;
        yfract=yleft*dY;
-                                                                                                                                  
+  
        xpt=randyInstance.Rndom(); //random()/(RAND_MAX+1.0);
-                                                                                                                                  
+        
        for(j=0;j<_VMNPT+1;j++){
                if (xpt < _fptarray[IY][j]) goto L60;
        }
  L60:
   
        //  now do linear interpolation - start with extremes
-  
-       if (j == 0){
+       if (j == 0){
                pt1=xpt/_fptarray[IY][j]*_VMdpt/2.;
                goto L80;
        }
@@ -703,8 +734,7 @@ void Gammaavectormeson::vmpt(double W,double Y,double &E,double &px,double &py,
        }
   
        //  we're in the middle
-  
-       ptfract=(xpt-_fptarray[IY][j])/(_fptarray[IY][j+1]-_fptarray[IY][j]);
+       ptfract=(xpt-_fptarray[IY][j])/(_fptarray[IY][j+1]-_fptarray[IY][j]);
        pt1=(j+1)*_VMdpt+ptfract*_VMdpt;
   
        //  at an extreme in y?
@@ -713,15 +743,14 @@ void Gammaavectormeson::vmpt(double W,double Y,double &E,double &px,double &py,
                goto L120;
        }
  L80:
-       //  interpolate in y repeat for next fractional y bin
-                                                                                                                                  
+
+       //  interpolate in y repeat for next fractional y bin      
        for(j=0;j<_VMNPT+1;j++){
                if (xpt < _fptarray[IY+1][j]) goto L90;
        }
  L90:
   
        //  now do linear interpolation - start with extremes
-                                                                                                                                  
        if (j == 0){
                pt2=xpt/_fptarray[IY+1][j]*_VMdpt/2.;
                goto L100;
@@ -732,27 +761,20 @@ void Gammaavectormeson::vmpt(double W,double Y,double &E,double &px,double &py,
        }
   
        //  we're in the middle
-                                                                                                                                  
        ptfract=(xpt-_fptarray[IY+1][j])/(_fptarray[IY+1][j+1]-_fptarray[IY+1][j]);
        pt2=(j+1)*_VMdpt+ptfract*_VMdpt;
-                                                                                                                                  
  L100:
-                                                                                                                                  
-       //  now interpolate in y
-                                                                                                                                  
+
+       //  now interpolate in y  
        pt=yfract*pt2+(1-yfract)*pt1;
-                                                                                                                                  
+
  L120:
-                                                                                                                                  
-       //  we have a pt
-                                                                                                                                  
+
+       //  we have a pt 
        theta=2.*starlightConstants::pi*randyInstance.Rndom();//(random()/(RAND_MAX+1.0))*2.*pi;
        px=pt*cos(theta);
        py=pt*sin(theta);
-                                                                                                                                  
-       //      I guess W is the mass of the vector meson (not necessarily
-       //      on-mass-shell), and E is the energy
-                                                                                                                                  
+
        E  = sqrt(W*W+pt*pt)*cosh(Y);
        pz = sqrt(W*W+pt*pt)*sinh(Y);
        //      randomly choose to make pz negative 50% of the time
index cdcb458130a36a58b0d8e720bfd2af35045da134..8413097db1f92e63281642ac89747b421c28fbb3 100644 (file)
@@ -385,17 +385,17 @@ double Gammagammaleptonpair::pp_2(double E)
 
 //______________________________________________________________________________
 void Gammagammaleptonpair::twoBodyDecay(starlightConstants::particleTypeEnum &ipid,
-                                    double  ,  // E (unused)
-                                    double  W,
-                                    double  px0, double  py0, double  pz0,
-                                    double& px1, double& py1, double& pz1,
-                                    double& px2, double& py2, double& pz2,
-                                    int&    iFbadevent)
+                                       double  ,  // E (unused)
+                                       double  W,
+                                       double  px0, double  py0, double  pz0,
+                                       double& px1, double& py1, double& pz1, double& E1,
+                                       double& px2, double& py2, double& pz2, double& E2,
+                                       double& mdec,
+                                       int&    iFbadevent)
 {
     //     This routine decays a particle into two particles of mass mdec,
     //     taking spin into account
 
-    double mdec=0.,E1=0.,E2=0.;
     double pmag, anglelep[20001];
     // double ytest=0.,dndtheta;
     double phi,theta,xtest,Ecm;
@@ -536,7 +536,8 @@ starlightConstants::event Gammagammaleptonpair::produceEvent(int &ievent)
     int iFbadevent=0;
     starlightConstants::particleTypeEnum ipid = starlightConstants::UNKNOWN;
        
-    double px2=0.,px1=0.,py2=0.,py1=0.,pz2=0.,pz1=0.;
+    double px2=0.,px1=0.,py2=0.,pt2=0.,py1=0.,pz2=0.,pz1=0.,pt1=0.;
+    double E1=0.,E2=0.,mdec=0.;
 //this function decays particles and writes events to a file
     //zero out the event structure
     leptonpair._numberOfTracks=0;
@@ -554,32 +555,25 @@ starlightConstants::event Gammagammaleptonpair::produceEvent(int &ievent)
     picky(rapidity);
 
     pairMomentum(comenergy,rapidity,pairE,pairmomx,pairmomy,pairmomz);
-    twoBodyDecay(ipid,pairE,comenergy,pairmomx,pairmomy,pairmomz,px1,py1,pz1,px2,py2,pz2,iFbadevent);
+    twoBodyDecay(ipid,pairE,comenergy,pairmomx,pairmomy,pairmomz,px1,py1,pz1,E1,px1,px2,py2,E2,mdec,iFbadevent);
     if (iFbadevent==0){
-       int q1=0,q2=0; 
-
-       double xtest = randyInstance.Rndom();//random()/(RAND_MAX+1.0);
-       if (xtest<0.5)
-       {
-           q1=1;
-           q2=-1;
-       }
-       else{
-           q1=-1;
-           q2=1;
-       }       
+      const bool xtest(randyInstance.Rndom() < 0.5);
+      const int charges[2] = {
+       ( xtest) ? +1 : -1,
+       (!xtest) ? -1 : +1
+      };
        leptonpair._numberOfTracks=2;//leptonpairs are two tracks...
        leptonpair.px[0]=px1;
        leptonpair.py[0]=py1;
        leptonpair.pz[0]=pz1;
        leptonpair._fsParticle[0]=ipid; 
-       leptonpair._charge[0]=q1;
+       leptonpair._charge[0]=charges[0];
 
        leptonpair.px[1]=px2;
        leptonpair.py[1]=py2;
        leptonpair.pz[1]=pz2;
        leptonpair._fsParticle[1]=ipid;
-       leptonpair._charge[1]=q2;
+       leptonpair._charge[1]=charges[1];
 
        ievent=ievent+1;
     }
@@ -602,7 +596,7 @@ upcEvent Gammagammaleptonpair::produceEvent()
    int iFbadevent=0;
    starlightConstants::particleTypeEnum ipid = starlightConstants::UNKNOWN;
    
-   double px2=0.,px1=0.,py2=0.,py1=0.,pz2=0.,pz1=0.,E2=0.,E1=0.;
+   double px2=0.,px1=0.,py2=0.,py1=0.,pz2=0.,pz1=0.,E2=0.,E1=0.,mdec=0.;
    bool accepted = false;
    do{ 
      //this function decays particles and writes events to a file
@@ -615,7 +609,7 @@ upcEvent Gammagammaleptonpair::produceEvent()
    
   
      _nmbAttempts++;
-     twoBodyDecay(ipid,pairE,comenergy,pairmomx,pairmomy,pairmomz,px1,py1,pz1,px2,py2,pz2,iFbadevent);
+     twoBodyDecay(ipid,pairE,comenergy,pairmomx,pairmomy,pairmomz,px1,py1,pz1,E1,px2,py2,pz2,E2,mdec,iFbadevent);
      double pt1chk = sqrt(px1*px1+py1*py1);
      double pt2chk = sqrt(px2*px2+py2*py2);
     
@@ -649,30 +643,18 @@ upcEvent Gammagammaleptonpair::produceEvent()
    //twoBodyDecay(ipid,pairE,comenergy,pairmomx,pairmomy,pairmomz,px1,py1,pz1,px2,py2,pz2,iFbadevent);
    
    if (iFbadevent==0){
-     int q1=0,q2=0; 
-     
-     double xtest = randyInstance.Rndom();//random()/(RAND_MAX+1.0);
-     if (xtest<0.5)
-       {
-        q1=1;
-        q2=-1;
-       }
-     else{
-       q1=-1;
-       q2=1;
-     }
+     const bool xtest(randyInstance.Rndom() < 0.5);
+     const int charges[2] = {
+       ( xtest) ? +1 : -1,
+       (!xtest) ? -1 : +1
+     };
 
      // The new stuff
-     double mlepton = getMass(); 
-     E1 = sqrt( mlepton*mlepton + px1*px1 + py1*py1 + pz1*pz1 ); 
-     E2 = sqrt( mlepton*mlepton + px2*px2 + py2*py2 + pz2*pz2 ); 
-
-     starlightParticle particle1(px1, py1, pz1, E1, starlightConstants::UNKNOWN, -q1*ipid, q1);
+     starlightParticle particle1(px1, py1, pz1, E1, mdec, -charges[0]*ipid, charges[0]);
      event.addParticle(particle1);
      
-     starlightParticle particle2(px2, py2, pz2, E2, starlightConstants::UNKNOWN, -q2*ipid, q2);
-     event.addParticle(particle2);
-     
+     starlightParticle particle2(px2, py2, pz2, E2, mdec, -charges[1]*ipid, charges[1]);
+     event.addParticle(particle2);     
     }
    return event;
 }
index 45875ff282654b764afd10774c1e7edc8bc39fb7..fa507dbe57d8b35c5316da779eca8f70a8d47fce 100644 (file)
@@ -327,12 +327,11 @@ double Gammagammasingle::pp(double E)
 
 
 //______________________________________________________________________________
-void Gammagammasingle::twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double /*E*/,double W,double px0,double py0,double pz0,double &px1,double &py1,double &pz1,double &px2,double &py2,double &pz2,int &iFbadevent)
+void Gammagammasingle::twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double /*E*/,double W,double px0,double py0,double pz0,double &px1,double &py1,double &pz1,double &E1,double &px2,double &py2,double &pz2,double &E2, double &mdec,int &iFbadevent)
 {
   //     This routine decays a particle into two particles of mass mdec,
   //     taking spin into account
   
-  double mdec=0.,E1=0.,E2=0.;
   double pmag,ytest=0.;
   double phi,theta,xtest,dndtheta,Ecm;
   double  betax,betay,betaz;
@@ -450,34 +449,19 @@ starlightConstants::event Gammagammasingle::produceEvent(int &/*ievent*/)
 //starlightConstants::event Gammagammasingle::produceEvent(int &ievent)
 upcEvent Gammagammasingle::produceEvent()
 {
-  //    cout << "NOT IMPLEMENTED!" << endl;
-        
-  //    return upcEvent();
-
+  upcEvent event;
+  
   //    returns the vector with the decay particles inside.
   //   onedecayparticle single;
-  starlightConstants::event single;
   double comenergy = 0.;
   double rapidity = 0.;
   double parentE = 0.;
   double parentmomx=0.,parentmomy=0.,parentmomz=0.;
 
-  //this function decays particles and writes events to a file
-  //zeroing out the event structure
-  single._numberOfTracks=0;
-  for(int i=0;i<4;i++){
-    single.px[i]=0.;
-    single.py[i]=0.;
-    single.pz[i]=0.;
-    single._fsParticle[i]=starlightConstants::UNKNOWN;
-    single._charge[i]=0;
-  }
-  
   pickw(comenergy);
   picky(rapidity);
   parentMomentum(comenergy,rapidity,parentE,parentmomx,parentmomy,parentmomz);
-  
-  
+    
   if(_GGsingInputpidtest != starlightConstants::F2 && _GGsingInputpidtest != starlightConstants::F2PRIME)
   {
 #ifdef ENABLE_PYTHIA
@@ -490,104 +474,83 @@ upcEvent Gammagammasingle::produceEvent()
   }
 
 
-  int ievent = 0;
   int iFbadevent=0;
-  starlightConstants::particleTypeEnum ipid = starlightConstants::UNKNOWN;
-  double px2=0.,px1=0.,py2=0.,py1=0.,pz2=0.,pz1=0.;
-  double px3=0.,px4=0.,py3=0.,py4=0.,pz3=0.,pz4=0.;
   //  double theta=0.,phi=0.;//angles from jetset
-  double xtest=0.,ztest=0.;
   switch(_GGsingInputpidtest){
-  case starlightConstants::ZOVERZ03:
+  case starlightConstants::ZOVERZ03: {
     //Decays into two pairs.
-    parentmomx=parentmomx/2.;
-    parentmomy=parentmomy/2.;
-    parentmomz=parentmomz/2.;
+    parentmomx /= 2.;
+    parentmomy /= 2.;
+    parentmomz /= 2.;
+    starlightConstants::particleTypeEnum ipid[2] = { starlightConstants::UNKNOWN };
+    double mdec[2] = { 0 };
+    double px[4] = { 0 };
+    double py[4] = { 0 };
+    double pz[4] = { 0 };
+    double pt[4] = { 0 };
     //Pair #1  
-    twoBodyDecay(ipid,parentE,comenergy,parentmomx,parentmomy,parentmomz,px1,py1,pz1,px2,py2,pz2,iFbadevent);
+    twoBodyDecay(ipid[0],parentE,comenergy,
+                parentmomx,parentmomy,parentmomz,
+                px[0],py[0],pz[0],pt[0],
+                px[1],py[1],pz[1],pt[1],
+                mdec[0],iFbadevent);
     //Pair #2
-    twoBodyDecay(ipid,parentE,comenergy,parentmomx,parentmomy,parentmomz,px3,py3,pz3,px4,py4,pz4,iFbadevent);
+    twoBodyDecay(ipid[1],parentE,comenergy,
+                parentmomx,parentmomy,parentmomz,
+                px[2],py[2],pz[2],pt[2],
+                px[3],py[3],pz[3],pt[3],
+                mdec[1],iFbadevent);
     //Now add them to vectors to be written out later.
                
-    single._numberOfTracks=4;//number of tracks per event
     if (iFbadevent==0){
-      xtest = randyInstance.Rndom();//random()/(RAND_MAX+1.0);
-      ztest = randyInstance.Rndom();
       //Assigning charges randomly.
-      if (xtest<0.5){
-       single._charge[0]=1;//q1=1;
-       single._charge[1]=-1;//q2=-1;
-      }
-      else{
-       single._charge[0]=1;//q1=-1;
-       single._charge[1]=-1;//q2=1;
-      }
-      if (ztest<0.5){
-       single._charge[2]=1;//q3=1;
-       single._charge[3]=-1;//q4=-1;
-      }
-      else{
-       single._charge[2]=-1;//q3=-1;
-       single._charge[3]=1;//q4=1;
-      }
-      //Track #1
-      single.px[0]=px1;
-      single.py[0]=py1;
-      single.pz[0]=pz1;
-      single._fsParticle[0]=ipid;
-      //Track #2                                                                                                                      
-      single.px[1]=px2;
-      single.py[1]=py2;
-      single.pz[1]=pz2;
-      single._fsParticle[1]=ipid;
-      //Track #3
-      single.px[2]=px3;
-      single.py[2]=py3;
-      single.pz[2]=pz3;
-      single._fsParticle[2]=ipid;
-      //Track #4
-      single.px[3]=px4;
-      single.py[3]=py4;
-      single.pz[3]=pz4;
-      single._fsParticle[3]=ipid;
-      
-      ievent=ievent+1;
-    }  
-    
+      const bool xtest(randyInstance.Rndom() < 0.5);
+      const bool ztest(randyInstance.Rndom() < 0.5);
+      const int charges[4] = {
+       ( xtest) ? +1 : -1,
+       (!xtest) ? -1 : +1,
+       ( ztest) ? +1 : -1,
+       (!ztest) ? -1 : +1,
+      };
+      for (int i=0; i<4; ++i) {
+       starlightParticle particle(px[i], py[i], pz[i], pt[i], mdec[i/2], charges[i]*ipid[i/2], charges[i]);    
+       event.addParticle(particle);
+      } 
+    }
     break;
+  }
   case starlightConstants::F2:
-  case starlightConstants::F2PRIME:
-    twoBodyDecay(ipid,parentE,comenergy,parentmomx,parentmomy,parentmomz,px1,py1,pz1,px2,py2,pz2,iFbadevent);
+  case starlightConstants::F2PRIME: {
+    double px[2] = { 0 };
+    double py[2] = { 0 };
+    double pz[2] = { 0 };
+    double pt[2] = { 0 };
+    double mdec  = 0;
+    starlightConstants::particleTypeEnum ipid = starlightConstants::UNKNOWN;
+    twoBodyDecay(ipid,parentE,comenergy,
+                parentmomx,parentmomy,parentmomz,
+                px[0],py[0],pz[0],pt[0],
+                px[1],py[1],pz[1],pt[1],
+                mdec,iFbadevent);
     
-    single._numberOfTracks=2;
-    if (iFbadevent==0){
-      xtest = randyInstance.Rndom();//random()/(RAND_MAX+1.0);
-      if (xtest<0.5){
-       single._charge[0]=1;//q1=1;
-       single._charge[1]=-1;//q2=-1;
+    if (iFbadevent==0) {
+      const double xtest = randyInstance.Rndom();
+      const int charges[2] = {
+       (xtest < 0.5) ? +1 : -1,
+       (xtest < 0.5) ? -1 : +1,
+      };
+      for (int i=0; i<2; ++i) {
+       starlightParticle particle(px[i], py[i], pz[i], pt[i], mdec, charges[i]*ipid, charges[i]);
+       event.addParticle(particle);
       }
-      else{
-       single._charge[0]=-1;//q1=-1;
-       single._charge[1]=1;//q2=1;
-      }        
-      //Track #1
-      single.px[0]=px1;
-      single.py[0]=py1;
-      single.pz[0]=pz1;
-      single._fsParticle[0]=ipid*single._charge[0]; 
-      //Track #2
-      single.px[1]=px2;
-      single.py[1]=py2;
-      single.pz[1]=pz2;
-      single._fsParticle[1]=ipid*single._charge[1];
-      ievent=ievent+1;
     }
     break;
+  }
   default:
     break;
   }
-  
-  return upcEvent(single);
+
+  return event;
 }
 
 
index d0927345ee3061d16eb227046b9967509dd2485d..6f72c7ca1632e47181c64f43bf11e55b7c674a4d 100644 (file)
@@ -66,13 +66,11 @@ incoherentPhotonNucleusLuminosity::~incoherentPhotonNucleusLuminosity()
 //______________________________________________________________________________
 void incoherentPhotonNucleusLuminosity::incoherentPhotonNucleusDifferentialLuminosity()
 {
-       // double Av,Wgp,cs,cvma;
   double W,dW,dY;
   double Egamma,Y;
-  // double t,tmin,tmax;
   double testint,dndWdY;
-  // double ax,bx;
   double C;  
+  int beam; 
 
   ofstream wylumfile;
   wylumfile.precision(15);
@@ -121,11 +119,13 @@ void incoherentPhotonNucleusLuminosity::incoherentPhotonNucleusDifferentialLumin
     Y = -1.0*_yMax + double(i)*dY + 0.5*dY;
     wylumfile << Y << endl;
   }
-  //  Eth=0.5*(((_wMin+starlightConstants::protonMass)*(_wMin
-  //                                                       +starlightConstants::protonMass)-starlightConstants::protonMass*starlightConstants::protonMass)/
-  //      (Ep + sqrt(Ep*Ep-starlightConstants::protonMass*starlightConstants::protonMass)));
-  
+
+  int A_1 = getbbs().beam1().A(); 
+  int A_2 = getbbs().beam2().A();
+
+  // Do this first for the case when the first beam is the photon emitter 
+  // Treat pA separately with defined beams 
+  // The variable beam (=1,2) defines which nucleus is the target 
   for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
 
     W = _wMin + double(i)*dW + 0.5*dW;
@@ -139,16 +139,17 @@ void incoherentPhotonNucleusLuminosity::incoherentPhotonNucleusDifferentialLumin
 
       Y = -1.0*_yMax + double(j)*dY + 0.5*dY;
 
-      int A_1 = getbbs().beam1().A(); 
-      int A_2 = getbbs().beam2().A();
       if( A_2 == 1 && A_1 != 1 ){
-        // pA, first beam is the nucleus 
+        // pA, first beam is the nucleus and photon emitter
         Egamma = 0.5*W*exp(Y);
+        beam = 2; 
       } else if( A_1 ==1 && A_2 != 1){
-        // pA, second beam is the nucleus 
+        // pA, second beam is the nucleus and photon emitter
         Egamma = 0.5*W*exp(-Y); 
+        beam = 1; 
       } else {
         Egamma = 0.5*W*exp(Y);        
+        beam = 2; 
       }
       
       dndWdY = 0.; 
@@ -165,17 +166,17 @@ void incoherentPhotonNucleusLuminosity::incoherentPhotonNucleusDifferentialLumin
           // localbmin = getbbs().beam2().nuclearRadius() + 0.7; 
           // localz = getbbs().beam2().Z(); 
          //   dndWdY = Egamma*localz*localz*nepoint(Egamma,localbmin)*localsig*breitWigner(W,bwnorm); 
-          dndWdY = Egamma*photonFlux(Egamma)*localsig*breitWigner(W,bwnorm); 
+          dndWdY = Egamma*photonFlux(Egamma,beam)*localsig*breitWigner(W,bwnorm); 
         }else if (A_2 ==1 && A_1 !=1){
           // localbmin = getbbs().beam1().nuclearRadius() + 0.7; 
           // localz = getbbs().beam1().Z(); 
          //   dndWdY = Egamma*localz*localz*nepoint(Egamma,localbmin)*localsig*breitWigner(W,bwnorm); 
-          dndWdY = Egamma*photonFlux(Egamma)*localsig*breitWigner(W,bwnorm); 
+          dndWdY = Egamma*photonFlux(Egamma,beam)*localsig*breitWigner(W,bwnorm); 
         }else{ 
           double csVN = sigma_N(Wgp);         
-          double csVA = sigma_A(csVN); 
+          double csVA = sigma_A(csVN,beam); 
           double csgA= (csVA/csVN)*sigmagp(Wgp); 
-          dndWdY = Egamma*photonFlux(Egamma)*csgA*breitWigner(W,bwnorm); 
+          dndWdY = Egamma*photonFlux(Egamma,beam)*csgA*breitWigner(W,bwnorm); 
         }
       }
 
@@ -184,12 +185,49 @@ void incoherentPhotonNucleusLuminosity::incoherentPhotonNucleusDifferentialLumin
     }
   }
 
+  // Repeat the loop for the case when the second beam is the photon emitter. 
+  // Don't repeat for pA
+  if( !( (A_2 == 1 && A_1 != 1) || (A_1 == 1 && A_2 != 1) ) ){ 
+    for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
+
+      W = _wMin + double(i)*dW + 0.5*dW;
+
+      double Ep = inputParametersInstance.protonEnergy();
+
+      Eth=0.5*(((W+starlightConstants::protonMass)*(W+starlightConstants::protonMass)-starlightConstants::protonMass*starlightConstants::protonMass)/
+          (Ep + sqrt(Ep*Ep-starlightConstants::protonMass*starlightConstants::protonMass)));
+    
+      for(unsigned int j = 0; j <= _nYbins - 1; ++j) {
+
+        Y = -1.0*_yMax + double(j)*dY + 0.5*dY;
+
+        beam = 1; 
+        Egamma = 0.5*W*exp(-Y);        
+      
+        dndWdY = 0.; 
+
+        if(Egamma > Eth){
+         if(Egamma > maxPhotonEnergy())Egamma = maxPhotonEnergy();
+          double Wgp = sqrt(2.*Egamma*(Ep+sqrt(Ep*Ep-starlightConstants::protonMass*
+                                 starlightConstants::protonMass))+starlightConstants::protonMass*starlightConstants::protonMass);
+
+          double csVN = sigma_N(Wgp);         
+          double csVA = sigma_A(csVN,beam); 
+          double csgA= (csVA/csVN)*sigmagp(Wgp); 
+          dndWdY = Egamma*photonFlux(Egamma,beam)*csgA*breitWigner(W,bwnorm); 
+        
+        }
+
+        wylumfile << dndWdY << endl;
+
+      }
+    }
+  }
+
   wylumfile << bwnorm << endl;
   wylumfile << inputParametersInstance.parameterValueKey() << endl;
   wylumfile.close();
   
-  // cout << "bwnorm: "<< bwnorm <<endl;
-
 }
 
 
index 8c0c57dfc54f1d3bac1b90b7aea1ae656c3a23cb..f119b51818e9200426f877ba16e15df90c7b118d 100644 (file)
@@ -66,19 +66,15 @@ incoherentVMCrossSection::crossSectionCalculation(const double)  // _bwnormsave
        // This subroutine calculates the vector meson cross section assuming
        // a narrow resonance.  For reference, see STAR Note 386.
   
-       // double Av,Wgp,cs,cvma;
        double W,dY;
        double y1,y2,y12,ega1,ega2,ega12;
         // double y1lab,y2lab,y12lab;
-       // double t,tmin,tmax;
-       double csgA1,csgA2,csgA12,int_r,dR,rate;
+       double csgA1,csgA2,csgA12,int_r,dR;
         double Wgp,csVN,csVA; 
         double Wgpm; 
        double tmp;
-       // double ax,bx;
        double Eth;
-       int    J,NY;
-       // int    K,NGAUSS;
+       int    J,NY,beam;
   
        NY   =  _narrowNumY;
        dY   = (_narrowYmax-_narrowYmin)/double(NY);
@@ -94,6 +90,12 @@ incoherentVMCrossSection::crossSectionCalculation(const double)  // _bwnormsave
   
        tmp = 0.0;
   
+        int A_1 = getbbs().beam1().A(); 
+        int A_2 = getbbs().beam2().A();
+
+        // Do this first for the case when the first beam is the photon emitter 
+        // Treat pA separately with defined beams 
+        // The variable beam (=1,2) defines which nucleus is the target 
        for(J=0;J<=(NY-1);J++){
     
                // This is the fdefault
@@ -101,9 +103,31 @@ incoherentVMCrossSection::crossSectionCalculation(const double)  // _bwnormsave
                y2  = _narrowYmin + double(J+1)*dY;
                y12 = 0.5*(y1+y2);
     
-               ega1  = 0.5*W*exp(y1);
-               ega2  = 0.5*W*exp(y2);
-               ega12 = 0.5*W*exp(y12);
+                if( A_2 == 1 && A_1 != 1 ){
+                  // pA, first beam is the nucleus and photon emitter
+                  // Egamma = 0.5*W*exp(Y);
+                 ega1  = 0.5*W*exp(y1);
+                 ega2  = 0.5*W*exp(y2);
+                 ega12 = 0.5*W*exp(y12);
+                  beam = 2; 
+                } else if( A_1 ==1 && A_2 != 1){
+                  // pA, second beam is the nucleus and photon emitter
+                  // Egamma = 0.5*W*exp(-Y); 
+                 ega1  = 0.5*W*exp(-y1);
+                 ega2  = 0.5*W*exp(-y2);
+                 ega12 = 0.5*W*exp(-y12);
+                  beam = 1; 
+                } else {
+                  // Egamma = 0.5*W*exp(Y);        
+                 ega1  = 0.5*W*exp(y1);
+                 ega2  = 0.5*W*exp(y2);
+                 ega12 = 0.5*W*exp(y12);
+                  beam = 2; 
+                }
+
+               // ega1  = 0.5*W*exp(y1);
+               // ega2  = 0.5*W*exp(y2);
+               // ega12 = 0.5*W*exp(y12);
 
                 // This is for checking things in the lab frame 
                 // y1lab  = _narrowYmin + double(J)*dY;
@@ -136,7 +160,7 @@ incoherentVMCrossSection::crossSectionCalculation(const double)  // _bwnormsave
                 Wgp = sqrt(2.*ega1*(_Ep+sqrt(_Ep*_Ep-starlightConstants::protonMass*starlightConstants::protonMass))
                                  +starlightConstants::protonMass*starlightConstants::protonMass);
                 csVN = sigma_N(Wgp);            
-                csVA = sigma_A(csVN); 
+                csVA = sigma_A(csVN,beam); 
                 csgA1 = (csVA/csVN)*sigmagp(Wgp); 
                 if( getbbs().beam1().A() == 1 || getbbs().beam2().A()==1 ){
                   csgA1 = sigmagp(Wgp);
@@ -147,7 +171,7 @@ incoherentVMCrossSection::crossSectionCalculation(const double)  // _bwnormsave
                                  +starlightConstants::protonMass*starlightConstants::protonMass);
                 Wgpm = Wgp; 
                 csVN = sigma_N(Wgp);            
-                csVA = sigma_A(csVN); 
+                csVA = sigma_A(csVN,beam); 
                 csgA12 = (csVA/csVN)*sigmagp(Wgp); 
                 if( getbbs().beam1().A() == 1 || getbbs().beam2().A()==1 ){
                   csgA12 = sigmagp(Wgp);
@@ -157,28 +181,118 @@ incoherentVMCrossSection::crossSectionCalculation(const double)  // _bwnormsave
                 Wgp = sqrt(2.*ega2*(_Ep+sqrt(_Ep*_Ep-starlightConstants::protonMass*starlightConstants::protonMass))
                                  +starlightConstants::protonMass*starlightConstants::protonMass);
                 csVN = sigma_N(Wgp);            
-                csVA = sigma_A(csVN); 
+                csVA = sigma_A(csVN,beam); 
                 csgA2 = (csVA/csVN)*sigmagp(Wgp); 
                 if( getbbs().beam1().A() == 1 || getbbs().beam2().A()==1 ){
                   csgA2 = sigmagp(Wgp);
                 }
 
-                dR = ega1*photonFlux(ega1)*csgA1;  
-                dR = dR + 4*ega12*photonFlux(ega12)*csgA12;
-                dR = dR + ega2*photonFlux(ega2)*csgA2; 
+                dR = ega1*photonFlux(ega1,beam)*csgA1;  
+                dR = dR + 4*ega12*photonFlux(ega12,beam)*csgA12;
+                dR = dR + ega2*photonFlux(ega2,beam)*csgA2; 
                 dR = dR*(dY/6.); 
 
                // cout<<" y: "<<y12<<" egamma: "<<ega12<<" flux: "<<photonFlux(ega12)<<" sigma_gA: "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*dR/dY<<endl;
                 // cout<<" y: "<<y12lab<<" egamma: "<<ega12<<" flux: "<<ega12*photonFlux(ega12)<<" W: "<<Wgpm<<" Wflux: "<<Wgpm*photonFlux(ega12)<<" sigma_gA (nb): "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*ega12*photonFlux(ega12)*csgA12<<endl;
 
                // The 2 accounts for the 2 beams    
-               if(getbbs().beam1().A()==getbbs().beam2().A()){
-                       dR  = 2.*dR;
-               }
+               //              if(getbbs().beam1().A()==getbbs().beam2().A()){
+               //      dR  = 2.*dR;
+               //}
 
                int_r = int_r+dR;
 
        }
-       rate=luminosity()*int_r;
+
+        // Repeat the loop for the case when the second beam is the photon emitter. 
+        // Don't repeat for pA
+        if( !( (A_2 == 1 && A_1 != 1) || (A_1 == 1 && A_2 != 1) ) ){ 
+         for(J=0;J<=(NY-1);J++){
+    
+               // This is the fdefault
+               y1  = _narrowYmin + double(J)*dY;
+               y2  = _narrowYmin + double(J+1)*dY;
+               y12 = 0.5*(y1+y2);
+    
+                beam = 1; 
+               ega1  = 0.5*W*exp(-y1);
+               ega2  = 0.5*W*exp(-y2);
+               ega12 = 0.5*W*exp(-y12);
+
+                // This is for checking things in the lab frame 
+                // y1lab  = _narrowYmin + double(J)*dY;
+                // y2lab  = _narrowYmin + double(J+1)*dY;
+                // y12lab = 0.5*(y1lab+y2lab);
+
+                // p+Pb
+                // y1 = y1lab + 0.465;
+                // y2 = y2lab + 0.465;
+                // y12 = y12lab + 0.465; 
+                // ega1  = 0.5*W*exp(y1);
+                // ega2  = 0.5*W*exp(y2);
+                // ega12 = 0.5*W*exp(y12);
+
+                // Pb+p
+                // y1 = y1lab - 0.465;
+                // y2 = y2lab - 0.465;
+                // y12 = y12lab - 0.465; 
+                // ega1  = 0.5*W*exp(-y1);
+                // ega2  = 0.5*W*exp(-y2);
+                // ega12 = 0.5*W*exp(-y12);
+
+    
+               if(ega2 < Eth)   
+                       continue;
+               if(ega1 > maxPhotonEnergy()) 
+                       continue;
+
+               // First point 
+                Wgp = sqrt(2.*ega1*(_Ep+sqrt(_Ep*_Ep-starlightConstants::protonMass*starlightConstants::protonMass))
+                                 +starlightConstants::protonMass*starlightConstants::protonMass);
+                csVN = sigma_N(Wgp);            
+                csVA = sigma_A(csVN,beam); 
+                csgA1 = (csVA/csVN)*sigmagp(Wgp); 
+                if( getbbs().beam1().A() == 1 || getbbs().beam2().A()==1 ){
+                  csgA1 = sigmagp(Wgp);
+                }
+
+               // Middle point 
+                Wgp = sqrt(2.*ega12*(_Ep+sqrt(_Ep*_Ep-starlightConstants::protonMass*starlightConstants::protonMass))
+                                 +starlightConstants::protonMass*starlightConstants::protonMass);
+                Wgpm = Wgp; 
+                csVN = sigma_N(Wgp);            
+                csVA = sigma_A(csVN,beam); 
+                csgA12 = (csVA/csVN)*sigmagp(Wgp); 
+                if( getbbs().beam1().A() == 1 || getbbs().beam2().A()==1 ){
+                  csgA12 = sigmagp(Wgp);
+                }
+
+               // Last point 
+                Wgp = sqrt(2.*ega2*(_Ep+sqrt(_Ep*_Ep-starlightConstants::protonMass*starlightConstants::protonMass))
+                                 +starlightConstants::protonMass*starlightConstants::protonMass);
+                csVN = sigma_N(Wgp);            
+                csVA = sigma_A(csVN,beam); 
+                csgA2 = (csVA/csVN)*sigmagp(Wgp); 
+                if( getbbs().beam1().A() == 1 || getbbs().beam2().A()==1 ){
+                  csgA2 = sigmagp(Wgp);
+                }
+
+                dR = ega1*photonFlux(ega1,beam)*csgA1;  
+                dR = dR + 4*ega12*photonFlux(ega12,beam)*csgA12;
+                dR = dR + ega2*photonFlux(ega2,beam)*csgA2; 
+                dR = dR*(dY/6.); 
+
+               // cout<<" y: "<<y12<<" egamma: "<<ega12<<" flux: "<<photonFlux(ega12)<<" sigma_gA: "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*dR/dY<<endl;
+                // cout<<" y: "<<y12lab<<" egamma: "<<ega12<<" flux: "<<ega12*photonFlux(ega12)<<" W: "<<Wgpm<<" Wflux: "<<Wgpm*photonFlux(ega12)<<" sigma_gA (nb): "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*ega12*photonFlux(ega12)*csgA12<<endl;
+
+               // The 2 accounts for the 2 beams    
+               // if(getbbs().beam1().A()==getbbs().beam2().A()){
+               //      dR  = 2.*dR;
+               //}
+
+               int_r = int_r+dR;
+
+         }
+        }
        cout<<" Cross section (mb): " <<10.*int_r<<endl;
 }
index f238c5cd53a7ee4af828e7314b68ec2fbc444e67..8d4529ebdb0569612cf692beaffa275b0850d9c4 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 164                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
+// $Rev:: 193                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -66,16 +66,11 @@ narrowResonanceCrossSection::crossSectionCalculation(const double)  // _bwnormsa
        // This subroutine calculates the vector meson cross section assuming
        // a narrow resonance.  For reference, see STAR Note 386.
   
-       // double Av,Wgp,cs,cvma;
        double W,dY;
        double y1,y2,y12,ega1,ega2,ega12;
-       // double t,tmin,tmax;
-       double csgA1,csgA2,csgA12,int_r,dR,rate;
-       double tmp;
-       // double ax,bx;
+       double csgA1,csgA2,csgA12,int_r,dR;
        double Eth;
-       int    J,NY;
-       // int    K,NGAUSS;
+       int    J,NY,beam;
   
        NY   =  _narrowNumY;
        dY   = (_narrowYmax-_narrowYmin)/double(NY);
@@ -88,47 +83,106 @@ narrowResonanceCrossSection::crossSectionCalculation(const double)  // _bwnormsa
   
        cout<<" gamma+nucleon  Threshold: "<<Eth<<endl;
        int_r=0.;
+
+        int A_1 = getbbs().beam1().A(); 
+        int A_2 = getbbs().beam2().A();
   
-       tmp = 0.0;
-  
+        // Do this first for the case when the first beam is the photon emitter 
+        // Treat pA separately with defined beams 
+        // The variable beam (=1,2) defines which nucleus is the target 
        for(J=0;J<=(NY-1);J++){
     
                y1  = _narrowYmin + double(J)*dY;
                y2  = _narrowYmin + double(J+1)*dY;
                y12 = 0.5*(y1+y2);
     
-               ega1  = 0.5*W*exp(y1);
-               ega2  = 0.5*W*exp(y2);
-               ega12 = 0.5*W*exp(y12);
+                if( A_2 == 1 && A_1 != 1 ){
+                  // pA, first beam is the nucleus and is in this case the target  
+                  // Egamma = 0.5*W*exp(-Y); 
+                  ega1  = 0.5*W*exp(-y1);
+                  ega2  = 0.5*W*exp(-y2);
+                  ega12 = 0.5*W*exp(-y12);
+                  beam = 1; 
+                } else if( A_1 ==1 && A_2 != 1){
+                  // pA, second beam is the nucleus and is in this case the target 
+                  // Egamma = 0.5*W*exp(Y); 
+                  ega1  = 0.5*W*exp(y1);
+                  ega2  = 0.5*W*exp(y2);
+                  ega12 = 0.5*W*exp(y12);
+                  beam = 2; 
+                } else {
+                  // Egamma = 0.5*W*exp(Y);        
+                  ega1  = 0.5*W*exp(y1);
+                  ega2  = 0.5*W*exp(y2);
+                  ega12 = 0.5*W*exp(y12);
+                  beam = 2; 
+                }
+
+               //              ega1  = 0.5*W*exp(y1);
+               //              ega2  = 0.5*W*exp(y2);
+               //              ega12 = 0.5*W*exp(y12);
     
                if(ega1 < Eth)   
                        continue;
                if(ega2 > maxPhotonEnergy()) 
                        continue;
 
-               csgA1=getcsgA(ega1,W);
+               csgA1=getcsgA(ega1,W,beam);
     
                // Middle Point                      =====>>>
-               csgA12=getcsgA(ega12,W); 
+               csgA12=getcsgA(ega12,W,beam); 
 
                // Second Point                      =====>>>
-               csgA2=getcsgA(ega2,W);
+               csgA2=getcsgA(ega2,W,beam);
     
                // Sum the contribution for this W,Y.
-               dR  = ega1*photonFlux(ega1)*csgA1;
-               dR  = dR + 4.*ega12*photonFlux(ega12)*csgA12;
-               dR  = dR + ega2*photonFlux(ega2)*csgA2;
-               tmp = tmp+2.*dR*(dY/6.);
+               dR  = ega1*photonFlux(ega1,beam)*csgA1;
+               dR  = dR + 4.*ega12*photonFlux(ega12,beam)*csgA12;
+               dR  = dR + ega2*photonFlux(ega2,beam)*csgA2;
                dR  = dR*(dY/6.);
 
-               // cout<<" y: "<<y12<<" egamma: "<<ega12<<" flux: "<<photonFlux(ega12)<<" sigma_gA: "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*dR/dY<<endl;
+               // cout<<" y: "<<y12<<" egamma: "<<ega12<<" flux: "<<photonFlux(ega12,beam)<<" sigma_gA: "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*dR/dY<<endl;
 
-               // The 2 accounts for the 2 beams
-               if(getbbs().beam1().A()==getbbs().beam2().A()){
-                       dR  = 2.*dR;
-               }
                int_r = int_r+dR;
        }
-       rate=luminosity()*int_r;
+
+        // Repeat the loop for the case when the second beam is the photon emitter. 
+        // Don't repeat for pA
+        if( !( (A_2 == 1 && A_1 != 1) || (A_1 == 1 && A_2 != 1) ) ){ 
+         for(J=0;J<=(NY-1);J++){
+    
+               y1  = _narrowYmin + double(J)*dY;
+               y2  = _narrowYmin + double(J+1)*dY;
+               y12 = 0.5*(y1+y2);
+    
+                beam = 1; 
+               ega1  = 0.5*W*exp(-y1);
+               ega2  = 0.5*W*exp(-y2);
+               ega12 = 0.5*W*exp(-y12);
+      
+               if(ega2 < Eth)   
+                       continue;
+               if(ega1 > maxPhotonEnergy()) 
+                       continue;
+
+               csgA1=getcsgA(ega1,W,beam);
+    
+               // Middle Point                      =====>>>
+               csgA12=getcsgA(ega12,W,beam); 
+
+               // Second Point                      =====>>>
+               csgA2=getcsgA(ega2,W,beam);
+    
+               // Sum the contribution for this W,Y.
+               dR  = ega1*photonFlux(ega1,beam)*csgA1;
+               dR  = dR + 4.*ega12*photonFlux(ega12,beam)*csgA12;
+               dR  = dR + ega2*photonFlux(ega2,beam)*csgA2;
+               dR  = dR*(dY/6.);
+
+               // cout<<" y: "<<y12<<" egamma: "<<ega12<<" flux: "<<photonFlux(ega12,beam)<<" sigma_gA: "<<10000000.*csgA12<<" dsig/dy (microb): "<<10000.*dR/dY<<endl;
+
+               int_r = int_r+dR;
+         }
+        }
        cout<<" Cross section (mb): " <<10.*int_r<<endl;
 }
index 8c281cf2512e04bff4518576f2565f55991180b1..044407b75a2542497c0989161ecc32c580c80a8d 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 189                         $: revision of last commit
-// $Author:: srklein                  $: author of last commit
-// $Date:: 2014-10-27 04:29:14 +0100 #$: date of last commit
+// $Rev:: 193                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -61,39 +61,8 @@ photonNucleusCrossSection::photonNucleusCrossSection(const beamBeamSystem& bbsys
           _productionMode    (inputParametersInstance.productionMode()    ),
          _sigmaNucleus      (_bbs.beam2().A()          )
 {
-       // define luminosity for various beam particles in units of 10^{26} cm^{-2} sec^{-1}
-       switch(_bbs.beam1().Z()) {
-       case 1:   // proton
-               _luminosity = 1.E8;
-               break;
-       case 8:   // O
-               _luminosity = 980.;
-               break;
-       case 14:  // Si
-               _luminosity = 440.;
-               break;
-       case 20:  // Ca
-               _luminosity = 2000.;
-               break;
-       case 29:  // Cu
-               _luminosity = 95.;
-               break;
-       case 49:  // Indium, uses same as Iodine
-               _luminosity = 27.;
-               break;
-       case 53:  // I
-               _luminosity = 27.;
-               break;
-       case 79:  // Au
-               _luminosity = 2.0;
-               break;
-       case 82:  // Pb
-               _luminosity = 1.;
-               break;
-       default:
-               printWarn << "luminosity is not defined for beam with Z = " << _bbs.beam1().Z()
-                         << ". using " << _luminosity << " 10^{26} cm^{-2} sec^{-1}" << endl;
-       }
+       // The _luminosity variable should note be used. Set it to 1.0 here. 
+        _luminosity = 1.0; 
 
        switch(_particleType) {
        case RHO:
@@ -201,8 +170,8 @@ photonNucleusCrossSection::photonNucleusCrossSection(const beamBeamSystem& bbsys
                     <<" GammaAcrosssection"<<endl;
        }
 
-        double maxradius = (_bbs.beam1().nuclearRadius()<_bbs.beam2().nuclearRadius())?_bbs.beam2().nuclearRadius():_bbs.beam1().nuclearRadius();
-       _maxPhotonEnergy = 5. * _beamLorentzGamma * hbarc/maxradius
+        // double maxradius = (_bbs.beam1().nuclearRadius()<_bbs.beam2().nuclearRadius())?_bbs.beam2().nuclearRadius():_bbs.beam1().nuclearRadius();
+       _maxPhotonEnergy = 12. * _beamLorentzGamma * hbarc/(_bbs.beam1().nuclearRadius()+_bbs.beam2().nuclearRadius())
 }
 
 
@@ -222,7 +191,8 @@ photonNucleusCrossSection::crossSectionCalculation(const double)
 //______________________________________________________________________________
 double
 photonNucleusCrossSection::getcsgA(const double Egamma,
-                                   const double W)
+                                   const double W, 
+                                   const int beam)
 {
        //This function returns the cross-section for photon-nucleus interaction 
        //producing vectormesons
@@ -230,7 +200,7 @@ photonNucleusCrossSection::getcsgA(const double Egamma,
        double Av,Wgp,cs,cvma;
        double t,tmin,tmax;
        double csgA,ax,bx;
-       int NGAUSS;                                                                                                                                       
+       int NGAUSS; 
   
        //     DATA FOR GAUSS INTEGRATION
        double xg[6] = {0, 0.1488743390, 0.4333953941, 0.6794095683, 0.8650633667, 0.9739065285};
@@ -266,20 +236,19 @@ photonNucleusCrossSection::getcsgA(const double Egamma,
                }
                csgA = 0.5 * (tmax - tmin) * csgA;
                csgA = Av * csgA;
-       }       else if (!_coherentProduction &&
-                        (!((_bbs.beam2().Z() == 1) && (_bbs.beam2().A() == 2)))) {  // incoherent AA interactions
+               //      }       else if (!_coherentProduction &&
+               //                       (!((_bbs.beam2().Z() == 1) && (_bbs.beam2().A() == 2)))) {  // incoherent AA interactions
                // For incoherent AA interactions, since incoherent treating it as gamma-p
                // Calculate the differential V.M.+proton cross section
-               csgA = 1.E-4 * _incoherentFactor * _sigmaNucleus * _slopeParameter * sigmagp(Wgp);
-
+               //              csgA = 1.E-4 * _incoherentFactor * _sigmaNucleus * _slopeParameter * sigmagp(Wgp);
        }       else {  // coherent AA interactions
                // For typical AA interactions.
                // Calculate V.M.+proton cross section
-               cs = sqrt(16. * pi * _vmPhotonCoupling * _slopeParameter * hbarc * hbarc * sigmagp(Wgp) / alpha);
+               cs = sqrt(16. * pi * _vmPhotonCoupling * _slopeParameter * hbarc * hbarc * sigmagp(Wgp) / alpha); 
     
                // Calculate V.M.+nucleus cross section
                // cvma = _bbs.beam1().A()*cs; 
-               cvma = sigma_A(cs); 
+               cvma = sigma_A(cs,beam); 
 
                // Calculate Av = dsigma/dt(t=0) Note Units: fm**s/Gev**2
                Av = (alpha * cvma * cvma) / (16. * pi * _vmPhotonCoupling * hbarc * hbarc);
@@ -300,7 +269,13 @@ photonNucleusCrossSection::getcsgA(const double Egamma,
                         }else if(A_2 ==1 && A_1 != 1){
                          csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
                         }else{     
-                         csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);
+                          if( beam==1 ){
+                           csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
+                          }else if(beam==2){
+                           csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);      
+                         }else{
+                           cout<<"Something went wrong here, beam= "<<beam<<endl; 
+                          }
                         }
 
                        t    = ax * (-xg[k]) + bx;
@@ -309,7 +284,13 @@ photonNucleusCrossSection::getcsgA(const double Egamma,
                         }else if(A_2 ==1 && A_1 != 1){
                          csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
                         }else{     
-                         csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);
+                          if( beam==1 ){
+                           csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
+                          }else if(beam==2){
+                           csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);      
+                         }else{
+                           cout<<"Something went wrong here, beam= "<<beam<<endl; 
+                          }
                         }
                }
                csgA = 0.5 * (tmax - tmin) * csgA;
@@ -322,7 +303,7 @@ photonNucleusCrossSection::getcsgA(const double Egamma,
 
 //______________________________________________________________________________
 double
-photonNucleusCrossSection::photonFlux(const double Egamma)
+photonNucleusCrossSection::photonFlux(const double Egamma, const int beam)
 {
        // This routine gives the photon flux as a function of energy Egamma
        // It works for arbitrary nuclei and gamma; the first time it is
@@ -331,27 +312,36 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
        // It returns dN_gamma/dE (dimensions 1/E), not dI/dE
        // energies are in GeV, in the lab frame
        // rewritten 4/25/2001 by SRK
-  
+
+        // NOTE: beam (=1,2) defines the photon TARGET
+
        double lEgamma,Emin,Emax;
        static double lnEmax, lnEmin, dlnE;
-       double stepmult,energy,rZ,rA;
+       // double stepmult,energy,rZ,rA;
+       double stepmult,energy,rZ;
        int nbstep,nrstep,nphistep,nstep;
        double bmin,bmax,bmult,biter,bold,integratedflux;
        double fluxelement,deltar,riter;
        double deltaphi,phiiter,dist;
        static double dide[401];
        double lnElt;
-       double rA2, rZ2; 
+       // double rA2, rZ2; 
        double flux_r; 
        double Xvar;
        int Ilt;
-       double RNuc=0.,RNuc2=0.,maxradius=0.;
+       double RNuc=0.,RSum=0.;
+
+       RSum=_bbs.beam1().nuclearRadius()+_bbs.beam2().nuclearRadius();
+        if( beam == 1){
+          rZ=double(_bbs.beam2().Z());
+          RNuc = _bbs.beam1().nuclearRadius();
+        } else { 
+         rZ=double(_bbs.beam1().Z());
+          RNuc = _bbs.beam2().nuclearRadius();
+        }
 
-       RNuc=_bbs.beam1().nuclearRadius();
-       RNuc2=_bbs.beam2().nuclearRadius();
-        maxradius =  (RNuc<RNuc2)?RNuc2:RNuc;
-       // static ->>> dide,lnEMax,lnEmin,dlnE
        static int  Icheck = 0;
+       static int  Ibeam  = 0; 
   
        //Check first to see if pp 
        if( _bbs.beam1().A()==1 && _bbs.beam2().A()==1 ){
@@ -359,7 +349,7 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
                double bmin = 0.5;
                double bmax = 5.0 + (5.0*_beamLorentzGamma*hbarc/Egamma);
                double dlnb = (log(bmax)-log(bmin))/(1.*nbsteps);
-
                double local_sum=0.0;
 
                // Impact parameter loop 
@@ -402,19 +392,13 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
                double flux_r=local_sum*pi; 
                return flux_r;
 
-               //    bmin = nuclearRadius+nuclearRadius;
-               //    flux_r = nepoint(Egamma,bmin);
-               //    return flux_r;
        }
 
-       //   first call?  - initialize - calculate photon flux
-       Icheck=Icheck+1;
-       if(Icheck > 1) goto L1000f;
+       //   first call or new beam?  - initialize - calculate photon flux
+       Icheck=Icheck+1; 
+       if(Icheck > 1 && beam == Ibeam ) goto L1000f; 
+        Ibeam = beam; 
   
-       rZ=double(_bbs.beam1().Z());
-       rA=double(_bbs.beam1().A());
-       rZ2=double(_bbs.beam2().Z());  //Sergey--dAu
-       rA2=double(_bbs.beam2().A());  //Sergey
   
        //  Nuclear breakup is done by PofB
        //  collect number of integration steps here, in one place
@@ -431,19 +415,18 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
        if (_beamLorentzGamma < 500) 
                Emin=1.E-3;
   
-       //  maximum energy is 6 times the cutoff
-       //      Emax=12.*hbarc*_beamLorentzGamma/RNuc;
-       Emax=6.*hbarc*_beamLorentzGamma/maxradius;
-  
+       //  maximum energy is 12 times the cutoff
+        Emax=_maxPhotonEnergy; 
+       // Emax=12.*hbarc*_beamLorentzGamma/RSum;
        //     >> lnEmin <-> ln(Egamma) for the 0th bin
        //     >> lnEmax <-> ln(Egamma) for the last bin
-  
-       lnEmin=log(Emin);
+       lnEmin=log(Emin);
        lnEmax=log(Emax);
-       dlnE=(lnEmax-lnEmin)/nstep;                                                                                                                  
+       dlnE=(lnEmax-lnEmin)/nstep; 
 
        cout<<" Calculating flux for photon energies from E= "<<Emin 
-           <<" to  "<<Emax<<"  GeV (CM frame) "<<endl;
+           <<" to  "<<Emax<<"  GeV (CM frame) for source nucleus with Z = "<<rZ<<endl;
 
 
        stepmult= exp(log(Emax/Emin)/double(nstep));
@@ -455,7 +438,7 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
                //  integrate flux over 2R_A < b < 2R_A+ 6* gamma hbar/energy
                //  use exponential steps
     
-               bmin=0.8*(RNuc+RNuc2); //Start slightly below 2*Radius 
+               bmin=0.8*RSum; //Start slightly below 2*Radius 
                bmax=bmin + 6.*hbarc*_beamLorentzGamma/energy;
     
                bmult=exp(log(bmax/bmin)/double(nbstep));
@@ -464,7 +447,7 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
     
                if (_bbs.beam2().Z()==1&&_bbs.beam1().A()==2){
                     //This is for deuteron-gold
-                    Xvar = (RNuc+RNuc2)*energy/(hbarc*(_beamLorentzGamma));
+                    Xvar = RSum*energy/(hbarc*(_beamLorentzGamma));
       
                     fluxelement = (2.0/pi)*rZ*rZ*alpha/
                         energy*(Xvar*bessel::dbesk0(Xvar)*bessel::dbesk1(Xvar)-(1/2)*Xvar*Xvar*
@@ -484,8 +467,8 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
                       }
 
                      int nbsteps = 400;
-                     double bmin = 0.7*(RNuc+RNuc2);
-                     double bmax = 2.0*(RNuc+RNuc2) + (8.0*_beamLorentzGamma*hbarc/energy);
+                     double bmin = 0.7*RSum;
+                     double bmax = 2.0*RSum + (8.0*_beamLorentzGamma*hbarc/energy);
                      double dlnb = (log(bmax)-log(bmin))/(1.*nbsteps);
 
                      double local_sum=0.0;
@@ -572,7 +555,8 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
             
                                                for( int jphi=1;jphi<= nphistep;jphi++){
                                                        phiiter=(double(jphi)-0.5)*deltaphi;
-                                                       //  dist is the distance from the center of the emitting nucleus to the point in question
+                                                       // dist is the distance from the center of the emitting nucleus 
+                                                       // to the point in question
                                                        dist=sqrt((biter+riter*cos(phiiter))*(biter+riter*
                                                                   cos(phiiter))+(riter*sin(phiiter))*(riter*sin(phiiter)));
                                                        Xvar=energy*dist/(hbarc*_beamLorentzGamma);  
@@ -593,9 +577,11 @@ photonNucleusCrossSection::photonFlux(const double Egamma)
                                //  multiply by volume element to get total flux in the volume element
                                fluxelement=fluxelement*2.*pi*biter*(biter-bold);
                                //  modulate by the probability of nuclear breakup as f(biter)
+                                // cout<<" jb: "<<jb<<" biter: "<<biter<<" fluxelement: "<<fluxelement<<endl; 
                                if (_beamBreakupMode > 1){
                                        fluxelement=fluxelement*_bbs.probabilityOfBreakup(biter);
                                }
+                                // cout<<" jb: "<<jb<<" biter: "<<biter<<" fluxelement: "<<fluxelement<<endl; 
                                integratedflux=integratedflux+fluxelement;
        
                        } //end loop over impact parameter 
@@ -670,9 +656,9 @@ photonNucleusCrossSection::nepoint(const double Egamma,
 double
 photonNucleusCrossSection::sigmagp(const double Wgp)
 {
-       //     >> Function for the gamma-proton --> VectorMeson
-       //     >> cross section. Wgp is the gamma-proton CM energy.
-       //     >> Unit for cross section: fm**2
+       // Function for the gamma-proton --> VectorMeson
+       // cross section. Wgp is the gamma-proton CM energy.
+       // Unit for cross section: fm**2
   
        double sigmagp_r=0.;
   
@@ -730,7 +716,7 @@ photonNucleusCrossSection::sigmagp(const double Wgp)
 
 //______________________________________________________________________________
 double
-photonNucleusCrossSection::sigma_A(const double sig_N)
+photonNucleusCrossSection::sigma_A(const double sig_N, const int beam)
 {                                                         
        // Nuclear Cross Section
        // sig_N,sigma_A in (fm**2) 
@@ -782,13 +768,19 @@ photonNucleusCrossSection::sigma_A(const double sig_N)
                   arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
                 }else if(A_2 == 1 && A_1 != 1){
                   arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
-                }else{ 
-                  arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
+                }else{
+                 // Check which beam is target 
+                  if( beam == 1 ){ 
+                    arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
+                  }else if( beam==2 ){
+                    arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
+                  }else{
+                    cout<<" Something went wrong here, beam= "<<beam<<endl; 
+                  } 
                 }
     
                Pint=1.0-exp(arg);
                sum=sum+2.*pi*b*Pint*ag[IB];
-
     
                b = 0.5*bmax*(-xg[IB])+0.5*bmax;
 
@@ -797,7 +789,14 @@ photonNucleusCrossSection::sigma_A(const double sig_N)
                 }else if(A_2 == 1 && A_1 != 1){
                   arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
                 }else{ 
-                  arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
+                 // Check which beam is target 
+                  if( beam == 1 ){ 
+                    arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
+                  }else if(beam==2){
+                    arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
+                  }else{
+                    cout<<" Something went wrong here, beam= "<<beam<<endl; 
+                  } 
                 }
 
                Pint=1.0-exp(arg);
index ccfe5c2ba3e5d3c189b203955ff29617dfb92bfa..72186c339f1dcd7fa00781e56d22875916141a77 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 164                         $: revision of last commit
-// $Author:: odjuvsla                 $: author of last commit
-// $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
+// $Rev:: 193                         $: revision of last commit
+// $Author:: jnystrand                $: author of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //    Added 18->19 for reading in the luminosity table
 #include "starlightconstants.h"
 #include "inputParameters.h"
 
-
 using namespace std;
 
 
 //______________________________________________________________________________
 readLuminosity::readLuminosity()//:inputread(input)
-: _Warray(0), _Yarray(0), _Farray(0)
+  : _Warray(0), _Yarray(0), _Farray(0), _Farray1(0), _Farray2(0)
 {
   //storing inputparameters into protected variables for the object to use them
   _ReadInputNPT=inputParametersInstance.nmbPtBinsInterference();
@@ -64,6 +63,8 @@ readLuminosity::~readLuminosity()
   if(_Warray) delete [] _Warray;
   if(_Yarray) delete [] _Yarray;
   if(_Farray) delete [] _Farray;
+  if(_Farray1) delete [] _Farray1;
+  if(_Farray2) delete [] _Farray2; 
 }
 
 
@@ -81,40 +82,87 @@ void readLuminosity::read()
       _Farray[i] = new double[_ReadInputnumy];
     }
   }
+  if(!_Farray1) 
+  {
+    _Farray1 = new double*[_ReadInputnumw];
+    for(int i = 0; i < _ReadInputnumw; i++)
+    {
+      _Farray1[i] = new double[_ReadInputnumy];
+    }
+  }
+  if(!_Farray2) 
+  {
+    _Farray2 = new double*[_ReadInputnumw];
+    for(int i = 0; i < _ReadInputnumw; i++)
+    {
+      _Farray2[i] = new double[_ReadInputnumy];
+    }
+  }
+
   double dummy[19]; //14//18
-//  double (*finterm)[starlightLimits::MAXWBINS]=new double[starlightLimits::MAXWBINS][starlightLimits::MAXYBINS];  
-  
+
+  //  double (*finterm)[starlightLimits::MAXWBINS]=new double[starlightLimits::MAXWBINS][starlightLimits::MAXYBINS];  
   //decreased from 1000*1000; too big! causes fault!
+
   double fpart =0.;
   double fptsum=0.;
   ifstream wylumfile;
 
   _f_max=0.0;
+  _f_max1=0.0;
+  _f_max2=0.0;
 
   wylumfile.open("slight.txt");
   for(int i=0;i < 19;i++){ // was 14; this is to account for sergei's additional parameters ie d-Au//was19
     wylumfile >> dummy[i];
   }
+  int A_1 = int(dummy[1]);
+  int A_2 = int(dummy[3]);
+
   for(int i=0;i<_ReadInputnumw;i++){
     wylumfile >> _Warray[i];
   }
   for(int i=0;i<_ReadInputnumy;i++){
     wylumfile >> _Yarray[i];
   }
-  for(int i=0;i<_ReadInputnumw;i++){
-    for(int j=0;j<_ReadInputnumy;j++){
-      wylumfile >> _Farray[i][j];
-      if( _Farray[i][j] > _f_max ) _f_max=_Farray[i][j];
+
+  if( (_ReadInputgg_or_gP == 1) || (A_2 == 1 && A_1 != 1) || (A_1 ==1 && A_2 != 1) ){ 
+    for(int i=0;i<_ReadInputnumw;i++){
+      for(int j=0;j<_ReadInputnumy;j++){
+        wylumfile >> _Farray[i][j];
+        if( _Farray[i][j] > _f_max ) _f_max=_Farray[i][j];
+      }
     }
-  }
-  //Normalize farray (JN 010402)
-  for(int i=0;i<_ReadInputnumw;i++){
-    for(int j=0;j<_ReadInputnumy;j++){
-      _Farray[i][j]=_Farray[i][j]/_f_max;
+    //Normalize farray 
+    for(int i=0;i<_ReadInputnumw;i++){
+      for(int j=0;j<_ReadInputnumy;j++){
+        _Farray[i][j]=_Farray[i][j]/_f_max;
+      }
+    }
+  } else {
+    for(int i=0;i<_ReadInputnumw;i++){
+      for(int j=0;j<_ReadInputnumy;j++){
+        wylumfile >> _Farray1[i][j];
+       //        if( _Farray1[i][j] > _f_max ) _f_max=_Farray1[i][j];
+      }
+    }
+    for(int i=0;i<_ReadInputnumw;i++){
+      for(int j=0;j<_ReadInputnumy;j++){
+        wylumfile >> _Farray2[i][j];
+        if( _Farray1[i][j] + _Farray2[i][j] > _f_max ) _f_max=(_Farray1[i][j] + _Farray2[i][j]);
+      }
+    }
+    //Normalize farray, farray1, farray2 
+    for(int i=0;i<_ReadInputnumw;i++){
+      for(int j=0;j<_ReadInputnumy;j++){
+        _Farray1[i][j]=_Farray1[i][j]/_f_max;
+        _Farray2[i][j]=_Farray2[i][j]/_f_max;
+        _Farray[i][j]=_Farray1[i][j]+_Farray2[i][j];
+      }
     }
   }
 
- if (_ReadInputgg_or_gP != 1 && _ReadInputinterferencemode != 0) {
 if (_ReadInputgg_or_gP != 1 && _ReadInputinterferencemode != 0) {
         // only numy/2 y bins here, from 0 (not -ymax) to ymax
         double **finterm  = new double*[starlightLimits::MAXWBINS];
         for (int i = 0; i < starlightLimits::MAXWBINS; i++) finterm[i] = new double[starlightLimits::MAXYBINS];
index 328f320476b16a76595c98099f53b08a26a33077..4af4ecc775a90d1ae1203d0be9d868de86f7134c 100644 (file)
@@ -20,9 +20,9 @@
 ///////////////////////////////////////////////////////////////////////////
 //
 // File and Version Information:
-// $Rev:: 191                         $: revision of last commit
+// $Rev:: 193                         $: revision of last commit
 // $Author:: jnystrand                $: author of last commit
-// $Date:: 2014-11-11 11:51:05 +0100 #$: date of last commit
+// $Date:: 2014-12-01 20:39:46 +0100 #$: date of last commit
 //
 // Description:
 //
@@ -69,28 +69,21 @@ wideResonanceCrossSection::crossSectionCalculation(const double bwnormsave)
        //     This subroutine calculates the cross-section assuming a wide
        //     (Breit-Wigner) resonance.
 
-       // double Av,Wgp,cs,cvma;
        double W,dW,dY;
        double y1,y2,y12,ega1,ega2,ega12;
-       // double t,tmin,tmax;
-       double csgA1,csgA2,csgA12,int_r,dR,rate;
-       double dsigdW,dsigdWalt,dndW,tmp;
+       double csgA1,csgA2,csgA12,int_r,dR;
+       double dsigdW,dsigdWalt,dndW;
        double dsigdW2;
-       // double ax,bx;
        double Eth;
-       int    I,J,NW,NY;
-       // int    K,NGAUSS;
-                                                                                                                                                      
-       // ----------------- !!!!!!!!!!!!!!!!!!!! -----------------------------
-                                                                                                                                                      
-       double bwnorm =bwnormsave;//used to transfer the bwnorm from the luminosity tables
-
-       // --------------------------------------------------------------------
-       //gamma+nucleon threshold.
+       int    I,J,NW,NY,beam;
+
+       double bwnorm = bwnormsave; //used to transfer the bwnorm from the luminosity tables
 
+        cout<<" in wideResonanceCrossSection, bwnorm: "<<bwnorm<<endl; 
+       //gamma+nucleon threshold.
        Eth=0.5*(((_wideWmin+protonMass)*(_wideWmin+protonMass)
                  -protonMass*protonMass)/(_Ep+sqrt(_Ep*_Ep-protonMass*protonMass)));
-                                                                                                                                                      
+                   
        NW   = 100;
        dW   = (_wideWmax-_wideWmin)/double(NW);
   
@@ -105,14 +98,19 @@ wideResonanceCrossSection::crossSectionCalculation(const double bwnormsave)
        }
   
        cout<<" Integrating over W from "<<_wideWmin<<" to "<<_wideWmax<<endl;
-                                                                                                                                                      
+
+        int A_1 = getbbs().beam1().A(); 
+        int A_2 = getbbs().beam2().A();
+
        int_r=0.;
  
+        // Do this first for the case when the first beam is the photon emitter 
+        // Treat pA separately with defined beams 
+        // The variable beam (=1,2) defines which nucleus is the target 
        for(I=0;I<=NW-1;I++){
     
                W = _wideWmin + double(I)*dW + 0.5*dW;
     
-               tmp = 0.0;
                dsigdW=0.0;
                dsigdW2=0.0;
                dsigdWalt=0.0;
@@ -123,41 +121,111 @@ wideResonanceCrossSection::crossSectionCalculation(const double bwnormsave)
                        y1  = _wideYmin + double(J)*dY;
                        y2  = _wideYmin + double(J+1)*dY;
                        y12 = 0.5*(y1+y2);
+
+                        if( A_2 == 1 && A_1 != 1 ){
+                          // pA, first beam is the nucleus and is in this case the target  
+                          // Egamma = 0.5*W*exp(-Y); 
+                          ega1  = 0.5*W*exp(-y1);
+                          ega2  = 0.5*W*exp(-y2);
+                          ega12 = 0.5*W*exp(-y12);
+                          beam = 1; 
+                        } else if( A_1 ==1 && A_2 != 1){
+                          // pA, second beam is the nucleus and is in this case the target 
+                          // Egamma = 0.5*W*exp(Y); 
+                          ega1  = 0.5*W*exp(y1);
+                          ega2  = 0.5*W*exp(y2);
+                          ega12 = 0.5*W*exp(y12);
+                          beam = 2; 
+                        } else {
+                          // Egamma = 0.5*W*exp(Y);        
+                          ega1  = 0.5*W*exp(y1);
+                          ega2  = 0.5*W*exp(y2);
+                          ega12 = 0.5*W*exp(y12);
+                          beam = 2; 
+                        }
       
-                       ega1  = 0.5*W*exp(y1);
-                       ega2  = 0.5*W*exp(y2);
-                       ega12 = 0.5*W*exp(y12);
+                       //                      ega1  = 0.5*W*exp(y1);
+                       //      ega2  = 0.5*W*exp(y2);
+                       //      ega12 = 0.5*W*exp(y12);
       
                        if(ega1 < Eth) continue;
                        if(ega2 > maxPhotonEnergy()) continue;
           
-                       csgA1=getcsgA(ega1,W);
+                       csgA1=getcsgA(ega1,W,beam);
 
                        //         >> Middle Point                      =====>>>
-                       csgA12=getcsgA(ega12,W);         
+                       csgA12=getcsgA(ega12,W,beam);         
 
                        //         >> Second Point                      =====>>>
-                       csgA2=getcsgA(ega2,W);
+                       csgA2=getcsgA(ega2,W,beam);
       
                        //>> Sum the contribution for this W,Y. The 2 accounts for the 2 beams
-                       dR  = ega1*photonFlux(ega1)*csgA1;
-                       dR  = dR + 4.*ega12*photonFlux(ega12)*csgA12;
-                       dR  = dR + ega2*photonFlux(ega2)*csgA2;
-                       tmp = tmp+2.*dR*(dY/6.);
+                       dR  = ega1*photonFlux(ega1,beam)*csgA1;
+                       dR  = dR + 4.*ega12*photonFlux(ega12,beam)*csgA12;
+                       dR  = dR + ega2*photonFlux(ega2,beam)*csgA2;
                        dR  = dR*(dY/6.)*breitWigner(W,bwnorm)*dW;
       
+                        // cout<<" W: "<<W<<" Y: "<<y12<<" dR: "<<dR<<endl;
                        //For identical beams, we double.  Either may emit photon/scatter
                        //For large differences in Z, we approx, that only beam1 emits photon
                        //and beam2 scatters, eg d-Au where beam1=au and beam2=d
-                       if(getbbs().beam1().A()==getbbs().beam2().A()){
-                               dR  = 2.*dR;
-                       }
+                       //if(getbbs().beam1().A()==getbbs().beam2().A()){
+                       //      dR  = 2.*dR;
+                       //}
                        int_r = int_r+dR;  
                }
        }
-                                                                                                                                                      
-       rate=luminosity()*int_r;
-  
+
+        // Repeat the loop for the case when the second beam is the photon emitter. 
+        // Don't repeat for pA
+        if( !( (A_2 == 1 && A_1 != 1) || (A_1 == 1 && A_2 != 1) ) ){ 
+         for(I=0;I<=NW-1;I++){
+    
+               W = _wideWmin + double(I)*dW + 0.5*dW;
+    
+               dsigdW=0.0;
+               dsigdW2=0.0;
+               dsigdWalt=0.0;
+               dndW=0.0;
+    
+               for(J=0;J<=NY-1;J++){
+      
+                       y1  = _wideYmin + double(J)*dY;
+                       y2  = _wideYmin + double(J+1)*dY;
+                       y12 = 0.5*(y1+y2);
+      
+                        beam = 1; 
+                       ega1  = 0.5*W*exp(-y1);
+                       ega2  = 0.5*W*exp(-y2);
+                       ega12 = 0.5*W*exp(-y12);
+      
+                       if(ega2 < Eth) continue;
+                       if(ega1 > maxPhotonEnergy()) continue;
+          
+                       csgA1=getcsgA(ega1,W,beam);
+
+                       //         >> Middle Point                      =====>>>
+                       csgA12=getcsgA(ega12,W,beam);         
+
+                       //         >> Second Point                      =====>>>
+                       csgA2=getcsgA(ega2,W,beam);
+      
+                       //>> Sum the contribution for this W,Y. The 2 accounts for the 2 beams
+                       dR  = ega1*photonFlux(ega1,beam)*csgA1;
+                       dR  = dR + 4.*ega12*photonFlux(ega12,beam)*csgA12;
+                       dR  = dR + ega2*photonFlux(ega2,beam)*csgA2;
+                       dR  = dR*(dY/6.)*breitWigner(W,bwnorm)*dW;
+      
+                       //For identical beams, we double.  Either may emit photon/scatter
+                       //For large differences in Z, we approx, that only beam1 emits photon
+                       //and beam2 scatters, eg d-Au where beam1=au and beam2=d
+                       // if(getbbs().beam1().A()==getbbs().beam2().A()){
+                       //      dR  = 2.*dR;
+                       // }
+                       int_r = int_r+dR;  
+               }
+         }
+        }
        cout<<" Cross section (mb): "<<10.*int_r<<endl;
-       cout<<" Production rate   : "<<rate<<" Hz"<<endl;
+
 }
index c8e80d319f6711af5a3263bd7774da2f3e55d5be..bc2180b9fe4f1426e8a30f5e768894d80ebab376 100644 (file)
@@ -301,11 +301,11 @@ Double_t AliBaseCalibViewer::GetLTM(Int_t n, Double_t *array, Double_t *sigma, D
   Double_t *ddata = new Double_t[n];
   Double_t mean = 0, lsigma = 0;
   UInt_t nPoints = 0;
-  for (UInt_t i = 0; i < (UInt_t)n; i++) {
+  for (Int_t i = 0; i < n; i++) {
     ddata[nPoints]= array[nPoints];
     nPoints++;
   }
-  Int_t hh = TMath::Min(TMath::Nint(fraction * nPoints), Int_t(n));
+  Int_t hh = TMath::Min(TMath::Nint(fraction * nPoints), n);
   AliMathBase::EvaluateUni(nPoints, ddata, mean, lsigma, hh);
   if (sigma) *sigma = lsigma;
   delete [] ddata;
index a4a408507bf887a4d0d97d52ae23d89c6cc525d6..ff93094ce2c93169ea95d43d77b83f60af55ff2d 100644 (file)
@@ -313,15 +313,23 @@ Bool_t AliESDHeader::IsTriggerInputFired(const char *name) const
   // Checks if the trigger input is fired 
  
   TNamed *trginput = (TNamed *)fTriggerInputsNames.FindObject(name);
-  if (!trginput) return kFALSE;
+  if (trginput == 0) return kFALSE;
 
   Int_t inputIndex = fTriggerInputsNames.IndexOf(trginput);
   if (inputIndex < 0) return kFALSE;
-  
-  if (fL0TriggerInputs & (1lu << inputIndex)) return kTRUE;
-  else if (fL1TriggerInputs & (1lu << (inputIndex-24))) return kTRUE;
-  else if (fL2TriggerInputs & (1u << (inputIndex-48))) return kTRUE;
-  else return kFALSE;
+  if(inputIndex < 24){
+    if (fL0TriggerInputs & (1lu << inputIndex)) return kTRUE;
+  } else if(inputIndex < 48){
+    if (fL1TriggerInputs & (1lu << (inputIndex-24))) return kTRUE;
+  } else if(inputIndex < 60){
+    if (fL2TriggerInputs & (1u << (inputIndex-48))) return kTRUE;
+  }
+  else {
+    AliError(Form("Index (%d) is outside the allowed range (0,59)!",inputIndex));
+    return kFALSE;
+  }
+  return kFALSE;
 }
 //________________________________________________________________________________
 Int_t  AliESDHeader::GetTriggerIREntries(Int_t int1, Int_t int2, Float_t deltaTime) const
index 631b25ea035b4ca81e8e8bfe5ac3dde1730f785d..b18671092cfe210c253ecbe29c3bfdaf199c6637 100644 (file)
@@ -29,7 +29,7 @@
 
 ClassImp(AliITSPIDResponse)
 
-AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC): 
+AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC):
   fRes(0.13),
   fKp1(15.77),
   fKp2(4.95),
@@ -71,11 +71,11 @@ AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC):
     fBBsaElectron[1]=38.5713;
     fBBsaElectron[2]=1.46462E-7;
     fBBsaElectron[3]=1.46462E-7;
-    fBBsaElectron[4]=4.40284E-7; 
+    fBBsaElectron[4]=4.40284E-7;
     fResolSA[0]=1.;   // 0 cluster tracks should not be used
     fResolSA[1]=0.25;  // rough values for tracks with 1
     fResolSA[2]=0.131;   // value from pp 2010 run (L. Milano, 16-Jun-11)
-    fResolSA[3]=0.113; // value from pp 2010 run 
+    fResolSA[3]=0.113; // value from pp 2010 run
     fResolSA[4]=0.104; // value from pp 2010 run
     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
     fResolTPCITSDeu3[0]=0.06918; // deuteron resolution vs p
@@ -96,6 +96,16 @@ AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC):
     fBBtpcits[2]=1.00;
     fBBtpcits[3]=0.964;
     fBBtpcits[4]=2.59;
+    fBBdeu[0]=88.22; // parameters for the deuteron - MC (LHC14a6)
+    fBBdeu[1]=-40.74;
+    fBBdeu[2]=107.2;
+    fBBdeu[3]=-8.962;
+    fBBdeu[4]=-0.766;
+    fBBtri[0]=100.7; //parameters for the triton - MC (LHC14a6)
+    fBBtri[1]=-68.56;
+    fBBtri[2]=128.2;
+    fBBtri[3]=-15.5;
+    fBBtri[4]=0.1833;
     fBBsa[0]=2.02078E7; //pure PHOBOS parameterization
     fBBsa[1]=14.0724;
     fBBsa[2]=3.84454E-7;
@@ -121,12 +131,24 @@ AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC):
     fResolSA[3]=0.109; // value from pp 2010 simulations
     fResolSA[4]=0.097; // value from pp 2010 simulations
     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
+    fResolTPCITSDeu3[0]=0.06853; // deuteron resolution vs p
+    fResolTPCITSDeu3[1]=0.01607; // 3 ITS clusters for PId
+    fResolTPCITSDeu3[2]=1.08; // value from PbPb 2010 run (July 2014)
+    fResolTPCITSDeu4[0]=0.06853;
+    fResolTPCITSDeu4[1]=0.01607;
+    fResolTPCITSDeu4[2]=1.08;
+    fResolTPCITSTri3[0]=0.07239; // triton resolution vs p
+    fResolTPCITSTri3[1]=0.0192; // 3 ITS clusters for PId
+    fResolTPCITSTri3[2]=1.12; // value from PbPb 2010 run (July 2014)
+    fResolTPCITSTri4[0]=0.07239; // triton resolution vs p
+    fResolTPCITSTri4[1]=0.0192; // 3 ITS clusters for PId
+    fResolTPCITSTri4[2]=1.12;
   }
 }
 
 /*
 //_________________________________________________________________________
-AliITSPIDResponse::AliITSPIDResponse(Double_t *param): 
+AliITSPIDResponse::AliITSPIDResponse(Double_t *param):
   fRes(param[0]),
   fKp1(15.77),
   fKp2(4.95),
@@ -138,9 +160,9 @@ AliITSPIDResponse::AliITSPIDResponse(Double_t *param):
   //  The main constructor
   //
   for (Int_t i=0; i<5;i++) {
-      fBBsa[i]=0.; 
+      fBBsa[i]=0.;
       fBBtpcits[i]=0.;
-      fResolSA[i]=0.; 
+      fResolSA[i]=0.;
       fResolTPCITS[i]=0.;
   }
 }
@@ -149,10 +171,10 @@ AliITSPIDResponse::AliITSPIDResponse(Double_t *param):
 //_________________________________________________________________________
 Double_t AliITSPIDResponse::BetheAleph(Double_t p, Double_t mass) const {
   //
-  // returns AliExternalTrackParam::BetheBloch normalized to 
+  // returns AliExternalTrackParam::BetheBloch normalized to
   // fgMIP at the minimum
   //
-  
+
   Double_t bb=
     AliExternalTrackParam::BetheBlochAleph(p/mass,fKp1,fKp2,fKp3,fKp4,fKp5);
   return bb;
@@ -171,7 +193,7 @@ Double_t AliITSPIDResponse::Bethe(Double_t bg, const Double_t * const par, Bool_
     eff=(bg-par[3])*(bg-par[3])+par[4];
   else
     eff=(par[2]-par[3])*(par[2]-par[3])+par[4];
-  
+
   if(gamma>=0. && beta>0.){
     if(isNuclei){
       //Parameterization for deuteron between 0.4 - 1.5 GeV/c; triton between 0.58 - 1.65 GeV/c
@@ -180,7 +202,7 @@ Double_t AliITSPIDResponse::Bethe(Double_t bg, const Double_t * const par, Bool_
       bb=(par[1]+2.0*TMath::Log(gamma)-beta*beta)*(par[0]/(beta*beta))*eff;
     }
   }
-  
+
   return bb;
 }
 
@@ -188,11 +210,11 @@ Double_t AliITSPIDResponse::Bethe(Double_t bg, const Double_t * const par, Bool_
 Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const {
 
   //OLD - Mantained for backward compatibility
-  //from the mass check --> Set the Particle Type
+  //from the MASS check --> Set the Particle Type
   //at the end use the method Bethe(Double_t p, AliPID::EParticleType species, Bool_t isSA) const to set the right parameter
 
   //
-  // returns AliExternalTrackParam::BetheBloch normalized to 
+  // returns AliExternalTrackParam::BetheBloch normalized to
   // fgMIP at the minimum
   //
 
@@ -205,16 +227,17 @@ Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const
   //NOTE
 
   AliPID::EParticleType species = AliPID::kPion;
-
-    if(TMath::AreEqualAbs(mass,AliPID::ParticleMass(0),0.00001)){
-      //if is an electron use a specific BB parameterization
-      //To be used only between 100 and 160 MeV/c
-      species=AliPID::kElectron;
+  Bool_t foundMatchingSpecies = kFALSE;
+  for (Int_t spec = 0; spec < AliPID::kSPECIESC; spec++) {
+    if (TMath::AreEqualAbs(mass,AliPID::ParticleMassZ(spec),0.001)){
+      species = (AliPID::EParticleType)spec;
+      foundMatchingSpecies = kTRUE;
+      break;
     }
+  }
+  if (!foundMatchingSpecies)
+    printf("Error AliITSPIDResponse::Bethe: Mass does not match any species. Assuming pion! Note that this function is deprecated!\n");
 
-    if(TMath::AreEqualAbs(mass,AliPID::ParticleMass(5),0.002)) species=AliPID::kDeuteron;
-    if(TMath::AreEqualAbs(mass,AliPID::ParticleMass(6),0.001)) species=AliPID::kTriton;
-  
     return Bethe(p,species,isSA);
 }
 
@@ -222,6 +245,7 @@ Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const
 Double_t AliITSPIDResponse::Bethe(Double_t p, AliPID::EParticleType species, Bool_t isSA) const
 {
   // NEW - to be used
+  // **** ATTENTION: the second parameter must be the PARTICLE TYPE you want to identify ****
   // Alternative bethe function assuming a particle type not a mass
   // should be slightly faster
   //
@@ -229,7 +253,7 @@ Double_t AliITSPIDResponse::Bethe(Double_t p, AliPID::EParticleType species, Boo
   const Double_t m=AliPID::ParticleMassZ(species);
   const Double_t bg=p/m;
   Bool_t isNuclei=kFALSE;
-  
+
   //NOTE
   //NOTE: if changes are made here, please also check the alternative function above
   //NOTE
@@ -259,23 +283,23 @@ Double_t AliITSPIDResponse::Bethe(Double_t p, AliPID::EParticleType species, Boo
 //_________________________________________________________________________
 Double_t AliITSPIDResponse::BetheITSsaHybrid(Double_t p, Double_t mass) const {
   //
-  // returns AliExternalTrackParam::BetheBloch normalized to 
-  // fgMIP at the minimum. The PHOBOS parameterization is used for beta*gamma>0.76. 
+  // returns AliExternalTrackParam::BetheBloch normalized to
+  // fgMIP at the minimum. The PHOBOS parameterization is used for beta*gamma>0.76.
   // For beta*gamma<0.76 a polinomial function is used
-  
+
   Double_t bg=p/mass;
   Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
   Double_t gamma=bg/beta;
   Double_t bb=1.;
-  
+
   Double_t par[9];
   //parameters for pi, K, p
   for(Int_t ip=0; ip<9;ip++) par[ip]=fBBsaHybrid[ip];
   //if it is an electron the PHOBOS part of the parameterization is tuned for e
   //in the range used for identification beta*gamma is >0.76 for electrons
   //To be used only between 100 and 160 MeV/c
-  if(mass>0.0005 && mass<0.00052)for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsaElectron[ip]; 
-  
+  if(mass>0.0005 && mass<0.00052)for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsaElectron[ip];
+
   if(gamma>=0. && beta>0. && bg>0.1){
     if(bg>0.76){//PHOBOS
       Double_t eff=1.0;
@@ -283,18 +307,18 @@ Double_t AliITSPIDResponse::BetheITSsaHybrid(Double_t p, Double_t mass) const {
        eff=(bg-par[3])*(bg-par[3])+par[4];
       else
        eff=(par[2]-par[3])*(par[2]-par[3])+par[4];
-      
+
       bb=(par[1]+2.0*TMath::Log(gamma)-beta*beta)*(par[0]/(beta*beta))*eff;
     }else{//Polinomial
       bb=par[5] + par[6]/bg + par[7]/(bg*bg) + par[8]/(bg*bg*bg);
     }
   }
-  return bb; 
+  return bb;
 }
 
 //_________________________________________________________________________
 Double_t AliITSPIDResponse::GetResolution(Double_t bethe,
-                                         Int_t nPtsForPid, 
+                                         Int_t nPtsForPid,
                                          Bool_t isSA,
                                          Double_t p,
                                          AliPID::EParticleType type) const {
@@ -314,13 +338,13 @@ Double_t AliITSPIDResponse::GetResolution(Double_t bethe,
   else{
     const Double_t *par=0x0;
     if(type==AliPID::kDeuteron){
-      if(nPtsForPid==3) par = fResolTPCITSDeu3;
       if(nPtsForPid==4) par = fResolTPCITSDeu4;
+      else par = fResolTPCITSDeu3;
       c=par[2];
       r=par[0]+par[1]*p;
     } else if(type==AliPID::kTriton){
-      if(nPtsForPid==3) par = fResolTPCITSTri3;
       if(nPtsForPid==4) par = fResolTPCITSTri4;
+      else par = fResolTPCITSTri3;
       c=par[2];
       r=par[0]+par[1]*p;
     } else{
@@ -342,7 +366,7 @@ void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Doubl
   const Int_t nPart= 4;
 
   static AliITSPidParams pars(isMC);  // Pid parametrisation parameters
-  
+
   Double_t itsProb[nPart] = {1,1,1,1}; // e, p, K, pi
 
   for (Int_t iLay = 0; iLay < nLay; iLay++) {
@@ -352,13 +376,13 @@ void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Doubl
     Float_t dedx = qclu[iLay];
     Float_t layProb = pars.GetLandauGausNorm(dedx,AliPID::kProton,mom,iLay+3);
     itsProb[0] *= layProb;
-    
+
     layProb = pars.GetLandauGausNorm(dedx,AliPID::kKaon,mom,iLay+3);
     itsProb[1] *= layProb;
-    
+
     layProb = pars.GetLandauGausNorm(dedx,AliPID::kPion,mom,iLay+3);
     itsProb[2] *= layProb;
-   
+
     layProb = pars.GetLandauGausNorm(dedx,AliPID::kElectron,mom,iLay+3);
     itsProb[3] *= layProb;
   }
@@ -397,9 +421,9 @@ Double_t AliITSPIDResponse::GetNumberOfSigmas( const AliVTrack* track, AliPID::E
   //check for ITS standalone tracks
   Bool_t isSA=kTRUE;
   if( track->GetStatus() & AliVTrack::kTPCin ) isSA=kFALSE;
-  
+
   const Float_t dEdx=track->GetITSsignal();
-  
+
   //TODO: in case of the electron, use the SA parametrisation,
   //      this needs to be changed if ITS provides a parametrisation
   //      for electrons also for ITS+TPC tracks
@@ -416,19 +440,19 @@ Double_t AliITSPIDResponse::GetSignalDelta( const AliVTrack* track, AliPID::EPar
   const Double_t chargeFactor = TMath::Power(AliPID::ParticleCharge(type),2.);
   Bool_t isSA=kTRUE;
   if( track->GetStatus() & AliVTrack::kTPCin ) isSA=kFALSE;
-  
+
   const Float_t dEdx=track->GetITSsignal();
-  
+
   //TODO: in case of the electron, use the SA parametrisation,
   //      this needs to be changed if ITS provides a parametrisation
   //      for electrons also for ITS+TPC tracks
-  
-  const Float_t bethe = Bethe(mom,AliPID::ParticleMassZ(type), isSA || (type==AliPID::kElectron))*chargeFactor;
+
+  const Float_t bethe = Bethe(mom,type, isSA || (type==AliPID::kElectron))*chargeFactor;
 
   Double_t delta=-9999.;
   if (!ratio) delta=dEdx-bethe;
   else if (bethe>1.e-20) delta=dEdx/bethe;
-  
+
   return delta;
 }
 
@@ -445,5 +469,5 @@ Int_t AliITSPIDResponse::GetParticleIdFromdEdxVsP(Float_t mom, Float_t signal, B
   Double_t bethepi=Bethe(mom,masspi,isSA);
   if(signal>(0.5*(bethepi+bethek))) return AliPID::kKaon;
   return AliPID::kPion;
-    
+
 }
index cfd7ef88db6a07e3a1a23fc3b129b184d6b4888c..cdf975769aae00383a33ce2fa58473cf60cd2f00 100644 (file)
@@ -2338,12 +2338,11 @@ AliPIDResponse::EDetPidStatus AliPIDResponse::GetComputeITSProbability  (const A
 
   Bool_t mismatch=kTRUE/*, heavy=kTRUE*/;
   for (Int_t j=0; j<nSpecies; j++) {
-    Double_t mass=AliPID::ParticleMassZ(j);//GeV/c^2
     const Double_t chargeFactor = TMath::Power(AliPID::ParticleCharge(j),2.);
-    Double_t bethe=fITSResponse.Bethe(momITS,mass)*chargeFactor;
     //TODO: in case of the electron, use the SA parametrisation,
     //      this needs to be changed if ITS provides a parametrisation
     //      for electrons also for ITS+TPC tracks
+    Double_t bethe=fITSResponse.Bethe(momITS,(AliPID::EParticleType)j,isSA || (j==(Int_t)AliPID::kElectron))*chargeFactor;
     Double_t sigma=fITSResponse.GetResolution(bethe,nPointsForPid,isSA || (j==(Int_t)AliPID::kElectron));
     if (TMath::Abs(dedx-bethe) > fRange*sigma) {
       p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
index 45423a5c82f6d7f2707e17ed3b07e6ce12eed8c9..1e3186a93f072101651c79837c306d3225722a47 100644 (file)
@@ -22,6 +22,7 @@
 //------------------------------------------------------------------------
 
 #include <TGeoBBox.h>
+#include <TGeoXtru.h>
 #include <TGeoCompositeShape.h>
 #include <TGeoGlobalMagField.h>
 #include <TGeoManager.h>
@@ -91,6 +92,7 @@ void AliFRAMEv3::CreateGeometry()
 //
   AliMatrix(idrotm[2087], -100.0,   0.0,  90.0,  270.,  -10.0,   0.0);
   AliMatrix(idrotm[2097],  -80.0,   0.0,  90.0,  270.,   10.0,   0.0);
+
 //
   AliMatrix(idrotm[2088],  90.0,  90.0, 90.0,  180.,   0.0,   0.0);
   AliMatrix(idrotm[2089],  90.0,  90.0, 90.0,    0.,   0.0,   0.0);
@@ -149,27 +151,32 @@ void AliFRAMEv3::CreateGeometry()
   jmod = 0;
 //
 // Constants 
-  const Float_t kEps   = 0.01;
+//
+  // Materials
   const Int_t   kAir   = idtmed[2004];
   const Int_t   kSteel = idtmed[2064];
   const Int_t   kAlu   = idtmed[2008];
   const Int_t   kG10   = idtmed[2021];
-  
+  // Angles 
+  const Float_t kEps     = 0.01;  
   const Float_t krad2deg = 180. / TMath::Pi();
   const Float_t kdeg2rad = 1. / krad2deg;
   const Float_t sin10    = TMath::Sin(10. * kdeg2rad);
+  const Float_t sin20    = TMath::Sin(20. * kdeg2rad);
   const Float_t tan10    = TMath::Tan(10. * kdeg2rad);
   const Float_t cos10    = TMath::Cos(10. * kdeg2rad);
-
-  const Float_t hR     = 286;     // distance of frame wrt vertex (tangential)
-  const Float_t iFrH   = 119.00;  // Height of inner frame 
-  const Float_t ringH  =   6.00;  // Height of the ring bars 
-  const Float_t ringW  =  10.00;  // Width  of the ring bars in z
+  // Dimensions
+  const Float_t hR     =  286.00;  // distance of frame wrt vertex (tangential)
+  const Float_t iFrH   =  119.00;  // Height of inner frame 
+  const Float_t ringH  =    6.00;  // Height of the ring bars 
+  const Float_t ringT  =    1.00;  // Thickness of bars   
+  const Float_t ringW  =   10.00;  // Width  of the ring bars in z
   // Positions of ring bars
   // outer
   const Float_t dymodU[3] = {71.5, 228.5, 339.5};
   // inner
   const Float_t dymodL[3] = {50.0, 175.0, 297.5};
+  //
   // orientation of web frame elements
   const Float_t dymodO[5] = {10., -40., 20., -27.1, 18.4};
   // Position of web frame elements
@@ -177,22 +184,26 @@ void AliFRAMEv3::CreateGeometry()
   for (Int_t ii = 0; ii < 5; ii++) {
     dymodW[ii] =  dymodW[ii]-3.*TMath::Tan(dymodO[ii]*kdeg2rad);
   }
+  //
   // radial length of web frame elements
-  const Float_t dHz    = 114.50;
+  const Float_t dHz    = 113./cos10 - 2. * sin10;
   // inner longitudinal bars 4 x 6 
   const Float_t longH  =   6.00; 
   const Float_t longW  =   4.00; 
+  const Float_t dext   =   sin10 * longW/2.+0.01;
+  const Float_t iFrH0  = iFrH + 2. * dext;
   // outer longitudianl bars 8 x 8
   const Float_t longOD =   8.0; 
   // length of inner longitudinal bars
   const Float_t longLI  = 615.;
+  const Float_t zE      = 376.5;
 //
 // Frame mother volume
 //
   TGeoPgon* shB77A = new TGeoPgon(0., 360., 18, 2);
   shB77A->SetName("shB77A");
-  shB77A->DefineSection( 0, -376.5, 280., 415.7);
-  shB77A->DefineSection( 1,  376.5, 280., 415.7);
+  shB77A->DefineSection( 0, -zE, 280., 415.7);
+  shB77A->DefineSection( 1,  zE, 280., 415.7);
   TGeoBBox* shB77B = new TGeoBBox(3.42, 2., 375.5);
   shB77B->SetName("shB77B");
   TGeoTranslation* trB77A = new TGeoTranslation("trB77A", +283.32, 0., 0.);
@@ -229,8 +240,8 @@ void AliFRAMEv3::CreateGeometry()
 
   ppgon[3] =   2.;
 
-  ppgon[4] = -350.;
-  ppgon[5] =  401.35;
+  ppgon[4] = -350.0;
+  ppgon[5] =  402.0;
   ppgon[6] =  415.6;
 
   ppgon[7] =  -ppgon[4]; 
@@ -241,27 +252,28 @@ void AliFRAMEv3::CreateGeometry()
 //  
 // Rings    
 //
-  dz = 2. * 410.2 * TMath::Sin(10.*kdeg2rad) - 2. *dol * TMath::Cos(10.*kdeg2rad)- 2. * doh * TMath::Tan(10.*kdeg2rad);
-  Float_t l1 = dz/2.;
-  Float_t l2 = dz/2.+2.*doh*TMath::Tan(10.*kdeg2rad);
+//  dz = 2. * 410.2 * TMath::Tan(10.*kdeg2rad) - 2. *dol * TMath::Cos(10.*kdeg2rad)- 2. * doh * TMath::Tan(10.*kdeg2rad);
+  dz = 2. * 410.2 * sin10 - 2. * dol * cos10 - 2. * doh * tan10;
+  Float_t l1 = dz / 2.;
+  Float_t l2 = dz / 2. + 2. * doh * tan10;
 
 
   TGeoVolumeAssembly* asBI42 = new TGeoVolumeAssembly("BI42");
  // Horizontal
-  ptrd1[0] =  l2 - 0.6 * TMath::Tan(10.*kdeg2rad);
+  ptrd1[0] =  l2 - 0.6 * tan10;
   ptrd1[1] =  l2;
   ptrd1[2] =  8.0 / 2.;
   ptrd1[3] =  0.6 / 2.;
   TVirtualMC::GetMC()->Gsvolu("BIH142", "TRD1", kSteel, ptrd1, 4);
   ptrd1[0] =  l1;
-  ptrd1[1] =  l1 + 0.6 * TMath::Tan(10.*kdeg2rad);
+  ptrd1[1] =  l1 + 0.6 * tan10;
   ptrd1[2] =  8.0 / 2.;
   ptrd1[3] =  0.6 / 2.;
   TVirtualMC::GetMC()->Gsvolu("BIH242", "TRD1", kSteel, ptrd1, 4);
 
   // Vertical 
-  ptrd1[0] =  l1 + 0.6 * TMath::Tan(10.*kdeg2rad);
-  ptrd1[1] =  l2 - 0.6 * TMath::Tan(10.*kdeg2rad);
+  ptrd1[0] =  l1 + 0.6 * tan10;
+  ptrd1[1] =  l2 - 0.6 * tan10;
   ptrd1[2] =  0.8 / 2.;
   ptrd1[3] =  6.8 / 2.;
   TVirtualMC::GetMC()->Gsvolu("BIV42", "TRD1", kSteel, ptrd1, 4);
@@ -289,18 +301,18 @@ void AliFRAMEv3::CreateGeometry()
   //
   pbox[0] =   3.37;
   pbox[1] =   2.0;
-  pbox[2] = 307.5;
+  pbox[2] = longLI / 2.;
   TVirtualMC::GetMC()->Gsvolu("B080", "BOX", kSteel, pbox, 3);
   pbox[0] =   2.78;
-  pbox[1] =   1.4;
-  pbox[2] = 307.5;
+  pbox[1] =   1.40;
+  pbox[2] =  longLI / 2.;
   TVirtualMC::GetMC()->Gsvolu("B081", "BOX", kAir, pbox, 3);
   TVirtualMC::GetMC()->Gspos("B081", 1, "B080",  0., 0., 0., 0, "ONLY");
 
   // Small 2nd reference plane elemenet 
    pbox[0] =   0.05;
    pbox[1] =   2.0;
-   pbox[2] = 307.5;
+   pbox[2] =  longLI / 2.;
    TVirtualMC::GetMC()->Gsvolu("BREF2", "BOX", kAir, pbox, 3);
    TVirtualMC::GetMC()->Gspos("BREF2", 1, "B080",  3.37 - 0.05, 0., 0., 0, "ONLY");
 
@@ -537,38 +549,69 @@ void AliFRAMEv3::CreateGeometry()
   TVirtualMC::GetMC()->Gspos("BM49", 8, "B076", -dx, -dy,  0., idrotm[2024], "ONLY");
 
 //
-// The internal frame
-//
+// The inner frame
 //
 //
 //  Mother Volumes
 //
-  ptrd1[0] =  (hR - longH/2.)             * TMath::Tan(10. * kdeg2rad);
-  ptrd1[1] =  (hR - longH/2. + iFrH )     * TMath::Tan(10. * kdeg2rad);;
-  ptrd1[2] =  376.5;  
-  ptrd1[3] =  iFrH / 2.;  
-  
-  Float_t r      = 342.0;
-  Float_t rout1  = 405.5;
-  Float_t rout2  = 411.55;
+  Float_t dd   = longW / 2. / cos10;
+
+
+  ptrd1[0] =  (hR - longH/2. - dext)   * tan10;
+  ptrd1[1] =  (hR - longH/2. + iFrH  + dext)  * tan10;
+  ptrd1[2] =  zE;  
+  ptrd1[3] =  iFrH0 / 2.;  
+
+  /*
+  Double_t xIF[10];
+  Double_t yIF[10];
+  xIF[0] = 0.; 
+  xIF[1] = ptrd1[0] - dd;
+  xIF[2] = ptrd1[0];
+  xIF[3] = ptrd1[1];
+  xIF[4] = ptrd1[1] - 4./cos10;
+  xIF[5] = 0.;
+  xIF[6] = - xIF[4];
+  xIF[7] = - xIF[3];
+  xIF[8] = - xIF[2];
+  xIF[9] = - xIF[1];
+  yIF[0] = -iFrH0/2.; 
+  yIF[1] = -iFrH0/2.;      
+  yIF[2] = -iFrH0/2. - 2. * sin10;
+  yIF[3] = +iFrH0/2. - 4. * sin10;
+  yIF[4] = +iFrH0/2.;
+  yIF[5] = +iFrH0/2.;
+  yIF[6] = yIF[4];
+  yIF[7] = yIF[3];
+  yIF[8] = yIF[2];
+  yIF[9] = yIF[1];
+  TGeoXtru* shIF = new TGeoXtru(2);
+  shIF->DefinePolygon(10, xIF, yIF);
+  shIF->DefineSection(0., -zE, 0., 0.);
+  shIF->DefineSection(1.,  zE, 0., 0.);
+  */
+  Float_t r      =  (hR - longH/2. + iFrH0/2. ); // was 342.
+  Float_t rout1  = 406.0;
+  Float_t rout2  = 412.3 - 4. * sin10;
   TString module[18];
-  
+  TGeoVolume* voIF[18];
   for (i = 0; i < 18; i++) {
 
       // Create volume i 
       char name[16];
+      // module numbering
       Int_t mod = i + 13;
       if (mod > 17) mod -= 18;
       snprintf(name, 16, "BSEGMO%d", mod);
+      //
+      //voIF[i] = new TGeoVolume(name, shIF, gGeoManager->GetMedium("FRAME_Air"));
       TVirtualMC::GetMC()->Gsvolu(name, "TRD1", kAir, ptrd1, 4);
       gGeoManager->GetVolume(name)->SetVisibility(kFALSE);
-
       module[i] = name;
       // Place volume i
-      Float_t phi1  = i * 20.;
-      Float_t phi2 = 270 + phi1;
+      Float_t phi1  =  i * 20.;
+      Float_t phi2  = 270 + phi1;
       if (phi2 >= 360.) phi2 -= 360.;
-      
       dx =  TMath::Sin(phi1*kdeg2rad)*r;
       dy = -TMath::Cos(phi1*kdeg2rad)*r;
       
@@ -578,7 +621,9 @@ void AliFRAMEv3::CreateGeometry()
       AliMatrix(idrotm[2034+i],  90.0, phi1, 0., 0., 90., phi2);  
       TGeoVolume* vol77 = gGeoManager->GetVolume("B077");
       TGeoVolume* volS  = gGeoManager->GetVolume(name);
+      //vol77->AddNode(volS, 1,  new TGeoTranslation(dx, dy, 0.));
       vol77->AddNode(volS, 1,  new TGeoCombiTrans(dx, dy, 0., rot));
+       
 
 //
 //    Position elements of outer Frame
@@ -605,19 +650,22 @@ void AliFRAMEv3::CreateGeometry()
 // Internal Frame rings
 //
 //
-//            60x60x5x6  for inner rings (I-beam)
-//           100x60x5    for front and rear rings
+//             60x60x5x6  for inner rings (I-beam)
+//            100x60x5    for front and rear rings
 //
 // Front and rear 
-  ptrd1[0] =  (hR - longH / 2.) * tan10 - longW / 2. / cos10;
-  ptrd1[1] =  (hR + longH / 2.) * tan10 - longW / 2. / cos10;
+//
+
+
+  ptrd1[0] =  (hR - longH / 2.) * tan10 - dd;
+  ptrd1[1] =  (hR + longH / 2.) * tan10 - dd;
   ptrd1[2] =  ringW / 2.;
   ptrd1[3] =  ringH / 2.;  
   
   TVirtualMC::GetMC()->Gsvolu("B072", "TRD1", kSteel, ptrd1, 4);
 
-  ptrd1[0] =  (hR - longH / 2. + 0.5) * tan10 - longW / 2. / cos10;
-  ptrd1[1] =  (hR + longH / 2. - 0.5) * tan10 - longW / 2. / cos10;
+  ptrd1[0] =  (hR - longH / 2. + 0.5) * tan10 - dd;
+  ptrd1[1] =  (hR + longH / 2. - 0.5) * tan10 - dd;
   ptrd1[2] =  ringW / 2. - 0.5;
   ptrd1[3] =  ringH / 2. - 0.5;  
 
@@ -628,27 +676,29 @@ void AliFRAMEv3::CreateGeometry()
 // Mother volume
   TGeoVolumeAssembly* asBI72 = new TGeoVolumeAssembly("BI72");
  // Horizontal
-  ptrd1[0] =  288.5* TMath::Sin(10.* kdeg2rad)  - 2.1;
-  ptrd1[1] =  289.0 * TMath::Sin(10.* kdeg2rad) - 2.1;
-  ptrd1[2] =  6./2.;
-  ptrd1[3] =  0.5/2.;
+  Float_t rIB1 = hR + ringH/2.;
+  Float_t rIB2 = hR - ringH/2.;
+  ptrd1[0] =  (rIB1 - ringT/2.) * sin10  - dd;
+  ptrd1[1] =  (rIB1           ) * sin10  - dd;
+  ptrd1[2] =  ringH / 2.;
+  ptrd1[3] =  ringT / 4.;
   TVirtualMC::GetMC()->Gsvolu("BIH172", "TRD1", kSteel, ptrd1, 4);
-  ptrd1[0] =  283.0 * TMath::Sin(10.* kdeg2rad) - 2.1;
-  ptrd1[1] =  283.5 * TMath::Sin(10.* kdeg2rad) - 2.1;
-  ptrd1[2] =  6./2.;
-  ptrd1[3] =  0.5/2.;
+  ptrd1[0] =  (rIB2           ) * sin10 - dd;
+  ptrd1[1] =  (rIB2 + ringT/2.) * sin10 - dd;
+  ptrd1[2] =  ringH/2.;
+  ptrd1[3] =  ringT/4.;
   TVirtualMC::GetMC()->Gsvolu("BIH272", "TRD1", kSteel, ptrd1, 4);
 
   // Vertical 
-  ptrd1[0] =  283.5 * TMath::Sin(10.* kdeg2rad) - 2.1;
-  ptrd1[1] =  288.5 * TMath::Sin(10.* kdeg2rad) - 2.1;
-  ptrd1[2] =  0.6/2.;
-  ptrd1[3] =  5./2.;
+  ptrd1[0] =  (rIB2 + ringT/2.) * sin10 - dd;
+  ptrd1[1] =  (rIB2 - ringT/2.) * sin10 - dd;
+  ptrd1[2] =  0.6 / 2.;
+  ptrd1[3] =  (ringH - ringT) / 2.;
   TVirtualMC::GetMC()->Gsvolu("BIV72", "TRD1", kSteel, ptrd1, 4);
   // Place 
   asBI72->AddNode(gGeoManager->GetVolume("BIV72"), 1,  new TGeoTranslation(0., 0., 0.));
-  asBI72->AddNode(gGeoManager->GetVolume("BIH172"), 1, new TGeoTranslation(0., 0.,  2.75));
-  asBI72->AddNode(gGeoManager->GetVolume("BIH272"), 1, new TGeoTranslation(0., 0., -2.75));
+  asBI72->AddNode(gGeoManager->GetVolume("BIH172"), 1, new TGeoTranslation(0., 0.,  (ringH/2. - ringT/4.)));
+  asBI72->AddNode(gGeoManager->GetVolume("BIH272"), 1, new TGeoTranslation(0., 0., -(ringH/2. - ringT/4.)));
 
 // Web frame
 //
@@ -662,15 +712,15 @@ void AliFRAMEv3::CreateGeometry()
   WebFrame("B363",  dHz, dymodO[3],  10.);
   WebFrame("B463",  dHz, dymodO[4],  10.);
 
-  dz = -iFrH / 2. + ringH / 2.+ kEps;
+  dz = -iFrH / 2. + ringH / 2.;
 
-  Float_t dz0 = longH / 2.;  
-  Float_t dx0 = (hR + dz0 + 113/2.) * tan10 - longW / 4. / cos10;
-  for (jmod = 0; jmod< 18; jmod++)
+  Float_t dz0 = longH / 2. - 2.*sin10;  
+  Float_t dx0 = (hR + iFrH/2.) * tan10 - longW / 4. / cos10;
+  for (jmod = 0; jmod < 18; jmod++)
   {
+//
 // ring bars
       for (i = 0; i < 3; i++) {
-       //      if ((i == 2) || (jmod ==0) || (jmod == 8)) { 
        if (i == 2) { 
          TVirtualMC::GetMC()->Gspos("B072", 6*jmod+i+1, module[jmod], 0,  dymodL[i], dz, 0, "ONLY");
          TVirtualMC::GetMC()->Gspos("B072", 6*jmod+i+4, module[jmod], 0, -dymodL[i], dz, idrotm[2070], "ONLY");      
@@ -681,52 +731,52 @@ void AliFRAMEv3::CreateGeometry()
        }
       }
   }
-  
+//  
 // outer diagonal web
 
   dy = dymodW[0] - (dHz/2.) * TMath::Tan(dymodO[0] * kdeg2rad);
   
   for (jmod = 0; jmod < 18; jmod++) {
-    TVirtualMC::GetMC()->Gspos("B063I",   4*jmod+1, module[jmod],  dx0,   dy, dz0, idrotm[2096], "ONLY");
-    TVirtualMC::GetMC()->Gspos("B063",   4*jmod+2, module[jmod],  dx0,  -dy, dz0, idrotm[2097], "ONLY");
-    TVirtualMC::GetMC()->Gspos("B063I",   4*jmod+3, module[jmod], -dx0,  -dy, dz0, idrotm[2087], "ONLY");
-    TVirtualMC::GetMC()->Gspos("B063",   4*jmod+4, module[jmod], -dx0,   dy, dz0, idrotm[2086], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B063I", 4*jmod+1, module[jmod],  dx0,   dy,  dz0, idrotm[2096], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B063",  4*jmod+2, module[jmod],  dx0,  -dy,  dz0, idrotm[2097], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B063I", 4*jmod+3, module[jmod], -dx0,  -dy,  dz0, idrotm[2087], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B063",  4*jmod+4, module[jmod], -dx0,   dy,  dz0, idrotm[2086], "ONLY");
   }
 
   dy = dymodW[1] - (dHz/2.)  * TMath::Tan(dymodO[1] * kdeg2rad);
 
   for (jmod = 0; jmod < 18; jmod++) {
-    TVirtualMC::GetMC()->Gspos("B163I",  4*jmod+1, module[jmod],  dx0,  -dy, dz0, idrotm[2096], "ONLY");
-    TVirtualMC::GetMC()->Gspos("B163",  4*jmod+2, module[jmod],  dx0,   dy, dz0, idrotm[2097], "ONLY");
-    TVirtualMC::GetMC()->Gspos("B163I",  4*jmod+3, module[jmod], -dx0,   dy, dz0, idrotm[2087], "ONLY");
-    TVirtualMC::GetMC()->Gspos("B163",  4*jmod+4, module[jmod], -dx0,  -dy, dz0, idrotm[2086], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B163I", 4*jmod+1, module[jmod],  dx0, -dy,  dz0, idrotm[2096], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B163",  4*jmod+2, module[jmod],  dx0,  dy,  dz0, idrotm[2097], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B163I", 4*jmod+3, module[jmod], -dx0,  dy,  dz0, idrotm[2087], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B163",  4*jmod+4, module[jmod], -dx0, -dy,  dz0, idrotm[2086], "ONLY");
   }
 
   dy = dymodW[2] - (dHz/2) * TMath::Tan(dymodO[2] * kdeg2rad);
-
-    for (jmod = 0; jmod < 18; jmod++) {
-      TVirtualMC::GetMC()->Gspos("B263I",  4*jmod+1, module[jmod],  dx0,   dy, dz0, idrotm[2096], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B263",  4*jmod+2, module[jmod],  dx0,  -dy, dz0, idrotm[2097], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B263I",  4*jmod+3, module[jmod], -dx0,  -dy, dz0, idrotm[2087], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B263",  4*jmod+4, module[jmod], -dx0,   dy, dz0, idrotm[2086], "ONLY");
+  
+  for (jmod = 0; jmod < 18; jmod++) {
+    TVirtualMC::GetMC()->Gspos("B263I", 4*jmod+1, module[jmod],  dx0,  dy,  dz0, idrotm[2096], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B263",  4*jmod+2, module[jmod],  dx0, -dy,  dz0, idrotm[2097], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B263I", 4*jmod+3, module[jmod], -dx0, -dy,  dz0, idrotm[2087], "ONLY");
+    TVirtualMC::GetMC()->Gspos("B263",  4*jmod+4, module[jmod], -dx0,  dy,  dz0, idrotm[2086], "ONLY");
   }
 
   dy = dymodW[3] -  (dHz/2.) * TMath::Tan(dymodO[3] * kdeg2rad);
 
     for (jmod = 0; jmod < 18; jmod++) {
-      TVirtualMC::GetMC()->Gspos("B363I",  4*jmod+1, module[jmod],  dx0,  -dy, dz0, idrotm[2096], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B363",  4*jmod+2, module[jmod],  dx0,   dy, dz0, idrotm[2097], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B363I",  4*jmod+3, module[jmod], -dx0,   dy, dz0, idrotm[2087], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B363",  4*jmod+4, module[jmod], -dx0,  -dy, dz0, idrotm[2086], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B363I", 4*jmod+1, module[jmod],  dx0, -dy,  dz0, idrotm[2096], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B363",  4*jmod+2, module[jmod],  dx0,  dy,  dz0, idrotm[2097], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B363I", 4*jmod+3, module[jmod], -dx0,  dy,  dz0, idrotm[2087], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B363",  4*jmod+4, module[jmod], -dx0, -dy,  dz0, idrotm[2086], "ONLY");
   }
 
   dy = dymodW[4] -  (dHz/2.) * TMath::Tan(dymodO[4] * kdeg2rad);
-
-    for (jmod = 0; jmod < 18; jmod++) {
-      TVirtualMC::GetMC()->Gspos("B463I",  4*jmod+1, module[jmod],  dx0,   dy, dz0, idrotm[2096], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B463",  4*jmod+2, module[jmod],  dx0,  -dy, dz0, idrotm[2097], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B463I",  4*jmod+3, module[jmod], -dx0,  -dy, dz0, idrotm[2087], "ONLY");
-      TVirtualMC::GetMC()->Gspos("B463",  4*jmod+4, module[jmod], -dx0,   dy, dz0, idrotm[2086], "ONLY");
+    
+  for (jmod = 0; jmod < 18; jmod++) {
+      TVirtualMC::GetMC()->Gspos("B463I", 4*jmod+1, module[jmod],  dx0,  dy, dz0, idrotm[2096], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B463",  4*jmod+2, module[jmod],  dx0, -dy, dz0, idrotm[2097], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B463I", 4*jmod+3, module[jmod], -dx0, -dy, dz0, idrotm[2087], "ONLY");
+      TVirtualMC::GetMC()->Gspos("B463",  4*jmod+4, module[jmod], -dx0,  dy, dz0, idrotm[2086], "ONLY");
   }
  
 // longitudinal bars (TPC rails attached)
@@ -741,7 +791,7 @@ void AliFRAMEv3::CreateGeometry()
 //
 //
 // 
-    Float_t lbox[3];
+    Double_t lbox[3];
     lbox[0] = longW  / 4.;
     lbox[2] = longH  / 2.;
     lbox[1] = longLI / 2.;
@@ -752,18 +802,18 @@ void AliFRAMEv3::CreateGeometry()
     TVirtualMC::GetMC()->Gsvolu("BA62", "BOX", kAir, lbox, 3); 
     TVirtualMC::GetMC()->Gspos("BA62", 1, "BA59", 0.25, 0.0, 0.0, 0, "ONLY");
 
-  dz = -iFrH / 2. + longH / 2. - 0.17;
-  dx = hR * tan10 - longW / 4. / cos(10);
-  for (jmod = 0; jmod < 18; jmod++) {
-      TVirtualMC::GetMC()->Gspos("BA59", 2*jmod+1, module[jmod],  49.31, 0.0, dz, idrotm[2096], "ONLY");
-      TVirtualMC::GetMC()->Gspos("BA59", 2*jmod+2, module[jmod], -49.31, 0.0, dz, idrotm[2087], "ONLY");
-  }
+    dz = -iFrH / 2. + longH / 2. - 1. * sin10;
+    dx = hR * tan10 - longW / 4. / cos10;
+    for (jmod = 0; jmod < 18; jmod++) {
+      TVirtualMC::GetMC()->Gspos("BA59", 2*jmod+1, module[jmod],  dx, 0.0, dz, idrotm[2096], "ONLY");
+      TVirtualMC::GetMC()->Gspos("BA59", 2*jmod+2, module[jmod], -dx, 0.0, dz, idrotm[2087], "ONLY");
+    }
   //
   // Rails for TRD
   //
   // Pos 1
   //
-  // angular 80deg profile
+  // angular 80 deg profile
   lbox[2] = 4.0;
   lbox[0] = 0.2;
   lbox[1] = longLI / 2.;
@@ -771,7 +821,7 @@ void AliFRAMEv3::CreateGeometry()
 
   ptrd1[0] =  3.;
   ptrd1[1] =  3. + 0.4 * tan10;
-  ptrd1[2] =  307.5;
+  ptrd1[2] =  longLI / 2.;
   ptrd1[3] =  0.2;  
   TVirtualMC::GetMC()->Gsvolu("BTRDR_11", "TRD1", kSteel, ptrd1, 4);
 
@@ -791,7 +841,7 @@ void AliFRAMEv3::CreateGeometry()
   lbox[0] = 2.0;
   lbox[1] = longLI / 2.;
   TVirtualMC::GetMC()->Gsvolu("BTRDR_14", "BOX",  kG10, lbox, 3); 
-  dz = -iFrH / 2. + longH / 2.;
+  dz = -iFrH / 2. + longH / 2.; 
   Float_t zpos = 80.;
   Int_t isec_1[11] = {0, 1, 2, 3, 4, 5, 13, 14, 15, 16, 17};
 
@@ -853,12 +903,12 @@ void AliFRAMEv3::CreateGeometry()
   // 40 x 14
   lbox[0] = 2.0;
   lbox[2] = 0.7;
-  lbox[1] = 307.5;
+  lbox[1] = longLI / 2.;
   TVirtualMC::GetMC()->Gsvolu("BTRDR_3", "BOX", kAlu, lbox, 3); 
 
   lbox[0] = 2.0;
   lbox[2] = 0.1;
-  lbox[1] = 307.5;
+  lbox[1] = longLI / 2.;
   TVirtualMC::GetMC()->Gsvolu("BTRDR_31", "BOX", kG10, lbox, 3); 
   TVirtualMC::GetMC()->Gspos("BTRDR_31", 1, "BTRDR_3",   0,  0.0, 0.6, 0, "ONLY");
   
@@ -871,6 +921,102 @@ void AliFRAMEv3::CreateGeometry()
      if (index > 1) TVirtualMC::GetMC()->Gspos("BTRDR_3", 2*jmod+1, module[jmod],   50.96-5-2.,  0.0, dz+3.7, 0, "ONLY");
      if (index < 7) TVirtualMC::GetMC()->Gspos("BTRDR_3", 2*jmod+2, module[jmod],  -50.96+5+2.,  0.0, dz+3.7, 0, "ONLY");
    }
+
+
+//                                                                                                                                
+// TOF Support Structures
+
+//                                                                                                                                 
+// Frame extension rectangular beams
+   lbox[0] = 6;
+   lbox[1] = 3.;
+   lbox[2] = 36.0;
+   TGeoVolume* voBTOFS1 = new TGeoVolume("BTOFS1", new TGeoBBox(lbox), gGeoManager->GetMedium("FRAME_Steel"));
+   lbox[0] = 5.5;
+   lbox[1] = 2.5;
+   lbox[2] = 36.0;
+   TGeoVolume* voBTOFS11 = new TGeoVolume("BTOFS11", new TGeoBBox(lbox), gGeoManager->GetMedium("FRAME_Air"));
+   voBTOFS1->AddNode(voBTOFS11, 1, gGeoIdentity);
+
+//                                                                                                                                 
+// Frame extension rectangular beams
+// upper clamps
+   TGeoXtru* shBTOFS2 = new TGeoXtru(2);
+   TGeoXtru* shBTOFS3 = new TGeoXtru(2);
+   
+   Double_t xxtru1[7];
+   Double_t yxtru1[7];
+   // 1
+   xxtru1[0] =  8.5;
+   yxtru1[0] =  4.5;
+   // 2
+   xxtru1[1] = -6.0;
+   yxtru1[1] =  4.5;
+   // 3
+   xxtru1[2] = -8.5;
+   yxtru1[2] =  4.5 - 2.5 * sin10;
+    // 4
+   xxtru1[3] = 8.5 - 14.5 / cos10;
+   yxtru1[3] = -6. - 14.5 * sin10;
+    // 5
+   xxtru1[4] = 8.5 - 10.5 / cos10;
+   yxtru1[4] = -6. - 10.5 * sin10;
+   // 6
+   xxtru1[5] = xxtru1[4] + 8. * sin10;
+   yxtru1[5] = yxtru1[4] - 8./cos10; 
+   // 7
+   xxtru1[6] =  8.5;
+   yxtru1[6] = -6.0;
+
+   Double_t xxtru2[7];
+   for (Int_t i = 0; i < 7; i++) xxtru2[i]  = -xxtru1[i];
+
+   shBTOFS2->DefinePolygon(7, xxtru1, yxtru1);
+   shBTOFS2->DefineSection(0, -4.);
+   shBTOFS2->DefineSection(1, +4.);
+
+   shBTOFS3->DefinePolygon(7, xxtru2, yxtru1);
+   shBTOFS3->DefineSection(0, -4.);
+   shBTOFS3->DefineSection(1, +4.);
+   TGeoVolume* voBTOFS2 = new TGeoVolume("BTOFS2", shBTOFS2, gGeoManager->GetMedium("FRAME_Steel"));
+   TGeoVolume* voBTOFS3 = new TGeoVolume("BTOFS3", shBTOFS3, gGeoManager->GetMedium("FRAME_Steel"));
+
+   lbox[0] = 5.5;
+   lbox[1] = 2.5;
+   lbox[2] = 4.0;
+   TGeoVolume* voBTOFS21 = new TGeoVolume("BTOFS21", new TGeoBBox(lbox), gGeoManager->GetMedium("FRAME_Air"));
+   voBTOFS2->AddNode(voBTOFS21, 1, gGeoIdentity);
+   voBTOFS3->AddNode(voBTOFS21, 2, gGeoIdentity);
+   TGeoVolumeAssembly* asTOFS00 = new TGeoVolumeAssembly("BTOFS00");                                                                                   
+   asTOFS00->AddNode(voBTOFS1, 1, gGeoIdentity);
+   asTOFS00->AddNode(voBTOFS2, 1, new TGeoTranslation(0., 0.,  40.));
+   asTOFS00->AddNode(voBTOFS2, 2, new TGeoTranslation(0., 0., -40.));
+
+   TGeoVolumeAssembly* asTOFS01 = new TGeoVolumeAssembly("BTOFS01");                                                                                   
+   asTOFS01->AddNode(voBTOFS1, 2, gGeoIdentity);
+   asTOFS01->AddNode(voBTOFS3, 1, new TGeoTranslation(0., 0.,  40.));
+   asTOFS01->AddNode(voBTOFS3, 2, new TGeoTranslation(0., 0., -40.));
+
+
+   asTOFS00->SetVisibility(1);
+   asTOFS01->SetVisibility(1);
+
+   for (i = 0; i < 18; i++) {
+     Float_t dx, dy;
+     Float_t phi1 = i * 20.;
+     Float_t phi2 = 270. + phi1;
+     TGeoRotation* rot1 = new TGeoRotation(Form("TOFS_R1_%d", i),  90.0, phi1, 90., phi2, 0., 0.);  
+     dx =  TMath::Sin((phi1+8.95) * kdeg2rad) * (rout2 + 12.);
+     dy = -TMath::Cos((phi1+8.95) * kdeg2rad) * (rout2 + 12.);
+     //     (gGeoManager->GetVolume("B076"))->AddNode(voBTOFS00, i+1,  new TGeoCombiTrans(dx, dy, 345., rot1));
+     (gGeoManager->GetVolume("B076"))->AddNode(asTOFS01, i,    new TGeoCombiTrans(dx, dy, 345.-53., rot1));
+     
+     dx =  TMath::Sin((phi1-8.95) * kdeg2rad) * (rout2 + 12.);
+     dy = -TMath::Cos((phi1-8.95) * kdeg2rad) * (rout2 + 12.);
+     //(gGeoManager->GetVolume("B076"))->AddNode(voBTOFS1, i+19,  new TGeoCombiTrans(dx, dy, 345., rot1));
+     (gGeoManager->GetVolume("B076"))->AddNode(asTOFS00, i,     new TGeoCombiTrans(dx, dy, 345.-53, rot1));
+   }
+
 //
 // Thermal shield
 //
@@ -1415,11 +1561,11 @@ void AliFRAMEv3::CreateMaterials()
 
   AliMixture(22, "G10", ag10, zg10, 1.7 , 4, wg10);
 
-  AliMixture(65, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
-  AliMixture(5, "AIR$      ", aAir, zAir, dAir,4, wAir);
+  AliMixture(65, "STEEL$", asteel, zsteel, 7.88, 4, wsteel);
+  AliMixture(5,  "AIR$      ", aAir, zAir, dAir,4, wAir);
   AliMaterial(9, "ALU      ", 26.98, 13., 2.7, 8.9, 37.2);
 
-  AliMedium(65, "Stainless Steel", 65, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(65, "Steel", 65, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   AliMedium( 5, "Air", 5, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   AliMedium( 9, "Aluminum", 9, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
   AliMedium(22, "G10", 22, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
diff --git a/T0/AliT0RawReader.cxx b/T0/AliT0RawReader.cxx
new file mode 100644 (file)
index 0000000..65e9a2e
--- /dev/null
@@ -0,0 +1,289 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id:  */
+
+//____________________________________________________________________
+//                                                                          
+// T0 
+// Class for reading T0 RAW data in TOF data format
+//
+#include "AliT0RawReader.h"
+#include "AliT0Parameters.h"
+#include "AliBitPacking.h"
+#include "TBits.h"
+
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "TArrayI.h"
+#include "AliLog.h"
+using std::cout;
+using std::endl;
+using std::ios_base;
+ClassImp(AliT0RawReader)
+  
+  AliT0RawReader::AliT0RawReader (AliRawReader *rawReader, Bool_t isOnline)
+    :  TTask("T0RawReader","read raw T0 data"),
+       fRawReader(rawReader),
+       fData(NULL),
+       fPosition(0),
+       fParam(NULL),
+       fIsOnline(isOnline),
+       fBunchID(0),
+       fPrintout(kFALSE)
+
+{
+  //
+// create an object to read T0raw digits
+  AliDebug(1,"Start ");
+  fRawReader->Reset();
+  fRawReader->Select("T0");
+  fParam = AliT0Parameters::Instance();  
+  if (fIsOnline)
+    fParam->InitIfOnline();
+  else 
+    fParam->Init();
+}
+ AliT0RawReader::~AliT0RawReader ()
+{
+  // 
+}
+/*
+AliT0RawReader::AliT0RawReader(const AliT0RawReader& o): TTask(o),
+     fRawReader(rawReader),
+       fData(NULL),
+       fPosition(0)
+{
+  //
+}
+*/
+
+
+Bool_t  AliT0RawReader::Next()
+{
+// read the next raw digit
+// returns kFALSE if there is no digit left
+//"LookUpTable":
+// Amplitude LED TRM=0; chain=0; TDC 0 -5        channel 0,2,4,6
+// Time CFD      TRM=0; chain=0; TDC 6 - 11      channel 0,2,4,6
+// mean time     TRM=0; chain=0; TDC 12          channel 0
+// T0A           TRM=0; chain=0; TDC 12          channel 2
+// T0C           TRM=0; chain=0; TDC 12          channel 4
+// vertex        TRM=0; chain=0; TDC 12          channel 6
+// mult QTC0        TRM=0; chain=0; TDC 13          channel 0
+// mult QTC1        TRM=0; chain=0; TDC 13          channel 2
+
+// Charge QTC0   TRM=1; chain=0; TDC 0 -5        channel 0,2,4,6
+// Charge QTC1   TRM=1; chain=0; TDC 6 - 11      channel 0,2,4,6
+// T0A trigger          TRM=1; chain=0; TDC 12          channel 0
+// T0C trigger          TRM=1; chain=0; TDC 12          channel 2
+// vertex trigger       TRM=1; chain=0; TDC 12          channel 4
+// trigger central      TRM=1; chain=0; TDC 13          channel 0
+// tigger semicenral    TRM=1; chain=0; TDC 13          channel 2
+//
+// allData array collect data from all channels in one :
+// allData[0] - allData[23] 24 CFD channels
+// allData[24] -   allData[47] 24 LED channels
+//  allData[48]  mean (T0) signal  
+// allData[49]   time difference (vertex)
+
+  UInt_t word;
+  Int_t time=0,  itdc=0, ichannel=0, uu; 
+  Int_t numberOfWordsInTRM=0, iTRM=0;
+  Int_t tdcTime, koef,hit=0;
+  Int_t koefhits[220];
+  Int_t trm_chain_header =  0x00000000;
+  Int_t  trm_chain_trailer =  0x10000000;
+  
+  UInt_t  filler =  0x70000000;
+  Bool_t correct=kTRUE;
+  Int_t header;
+
+  Int_t fNTRM = fParam->GetNumberOfTRMs();
+  for ( Int_t k=0; k<220; k++) {
+    koefhits[k]=0;
+    for ( Int_t jj=0; jj<5; jj++) {
+      fAllData[k][jj]=0;
+    }
+  }
+  do {
+    if (!fRawReader->ReadNextData(fData)) return kFALSE;
+  } while (fRawReader->GetDataSize() == 0);
+  
+  fPosition = 0;
+  //  cout.setf( ios_base::hex, ios_base::basefield );
+  if(fPrintout)
+    cout<<" CDH :: BC ID "<< (fRawReader->GetBCID())<<
+      " Event size"<<fRawReader->GetDataSize()<<
+      " orbit ID "<<fRawReader->GetOrbitID()<< 
+      " event index "<<fRawReader->GetEventIndex()<<
+      " event type " <<fRawReader->GetType()<<endl;
+  //DRM header
+    for (Int_t i=0; i<6; i++) {
+      word = GetNextWord();
+      if(fPrintout && i==0) cout<<" DRM header:: event words "<<AliBitPacking::UnpackWord(word,4, 20);
+      //  cout<<i<<" DRM header "<<word<<endl;
+      if (fPrintout && i==4 ) cout<<" L0BC ID "<< AliBitPacking::UnpackWord(word,4, 15)<<endl;
+      header = AliBitPacking::UnpackWord(word,28,31);
+      if( header !=4 ) 
+       {
+         AliWarning(Form(" !!!! wrong  DRM header  %x!!!!", word));
+         fRawReader->AddFatalErrorLog(kWrongDRMHeader,Form("w=%x",word));
+         break;
+       }
+    }
+    for (Int_t ntrm=0; ntrm< fNTRM; ntrm++)
+      {
+       //TRMheader  
+       word = GetNextWord();
+       if (word == filler )  word = GetNextWord(); 
+       //      cout<<" TRM "<<word<<endl;
+       header = AliBitPacking::UnpackWord(word,28,31);
+       if ( header != 4 )
+         {
+           AliWarning(Form(" !!!! wrong TRM header  %x!!!!", word));
+           fRawReader->AddMajorErrorLog(kWrongTRMHeader,Form("w=%x",word));
+           break;
+         }
+       numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16);
+       if(fPrintout) {
+         cout<<" TRM header :: event words "<<numberOfWordsInTRM;
+         cout<<" ACQ bits "<<AliBitPacking::UnpackWord(word,17,18);
+         cout<<" L bit "<<AliBitPacking::UnpackWord(word,19,19)<<endl;
+       }
+       iTRM=AliBitPacking::UnpackWord(word,0,3);
+       for( Int_t ichain=0; ichain<2; ichain++)
+         {
+           //chain header
+           word = GetNextWord();
+           uu = word & trm_chain_header;
+           if(uu != trm_chain_header) 
+             {
+               AliWarning(Form(" !!!! wrong CHAIN  0  header %x!!!!", word));
+               fRawReader->AddMajorErrorLog(kWrongChain0Header,Form("w=%x",word));
+               break;
+             }
+           fBunchID=AliBitPacking::UnpackWord(word,4,15);
+           if(fPrintout)
+             cout<<" chain "<< ichain<<" header:: BunchID  "<<fBunchID;
+           word = GetNextWord();
+           //   cout<<" next word "<<word<<endl;
+           tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+           //      for (; tdcTime==1; tdcTime) 
+           while(tdcTime==1)
+             {
+               correct = kTRUE;
+               itdc=AliBitPacking::UnpackWord(word,24,27);
+               ichannel=AliBitPacking::UnpackWord(word,21,23);
+               time=AliBitPacking::UnpackWord(word,0,20);
+               
+               koef = fParam->GetChannel(iTRM,itdc,ichain,ichannel);
+               if (koef != 0 ) 
+                if(fPrintout)
+                  cout<<"RawReader>> "<<"koef "<<koef<<" trm "<<iTRM<<
+                   " tdc "<<itdc<<" chain "<<ichain<<
+                   " channel "<<ichannel<<" time "<<time<<endl;
+               if (koef ==-1 ){
+                 AliWarning(Form("Incorrect lookup table ! "));
+                 fRawReader->AddMajorErrorLog(kIncorrectLUT);
+                 correct=kFALSE;
+               }
+               if(correct){
+                 hit=koefhits[koef];
+                 if(hit>4) {  
+                   AliDebug(10,Form("Too many hits for %i channel - %i ! ",koef,koefhits[koef] )); 
+                   hit=4;
+                 }
+                 fAllData[koef][hit]=time; 
+                 koefhits[koef]++;
+               }
+               word = GetNextWord();
+
+               tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+               
+             }
+           
+           uu = word&trm_chain_trailer;
+           if(uu != trm_chain_trailer )
+             {
+               AliWarning(Form(" !!!! wrong CHAIN 0 trailer %x !!!!", word));
+               fRawReader->AddMajorErrorLog(kWrongChain0Trailer,Form("w=%x",word));
+               break;
+             }
+           if(fPrintout)
+             cout<<"chain trailer:: event counter "<< AliBitPacking::UnpackWord(word,16,27)<<endl;
+         }
+            
+       word = GetNextWord(); //TRM trailer
+       if(fPrintout)   cout<<" TRM trailer "<<word<<endl;
+       header = AliBitPacking::UnpackWord(word,28,31);
+       if( header !=5 )
+         {
+           AliWarning(Form(" !!!! wrong TRM GLOBAL trailer  %x!!!!", word));
+           fRawReader->AddMajorErrorLog(kWrongTRMTrailer,Form("w=%x",word));
+           break;
+         }
+       if(fPrintout)
+         cout<<"  TRM trailer :: event counter "<< AliBitPacking::UnpackWord(word,16,27)<<endl;
+      } //TRM loop
+    word = GetNextWord(); //
+    if (word == filler )  word = GetNextWord(); 
+     header = AliBitPacking::UnpackWord(word,28,31);
+     if( header !=5 )
+       {
+        AliWarning(Form(" !!!! wrong DRM GLOBAL trailer  %x!!!!", word));
+        fRawReader->AddFatalErrorLog(kWrongDRMTrailer,Form("w=%x",word));
+      }
+     if(fPrintout)
+       cout<<" DRM trailer ::event counter "<< AliBitPacking::UnpackWord(word,4,15)<<endl;
+     cout.setf( ios_base::dec, ios_base::basefield );
+    
+     return kTRUE;
+}
+//_____________________________________________________________________________
+Int_t AliT0RawReader::GetPosition()
+{
+  // Sets the position in the
+  // input stream
+  if (((fRawReader->GetDataSize() * 8) % 32) != 0)
+    AliFatal(Form("Incorrect raw data size ! %d words are found !",fRawReader->GetDataSize()));
+  return (fRawReader->GetDataSize() * 8) / 32;
+}
+//_____________________________________________________________________________
+UInt_t AliT0RawReader::GetNextWord()
+{
+  // Read the next 32 bit word in backward direction
+  // The input stream access is given by fData and fPosition
+
+
+  //   fPosition--;
+  Int_t iBit = fPosition * 32;
+  Int_t iByte = iBit / 8;
+
+  UInt_t word = 0;
+  word  = fData[iByte+3]<<24;
+  word |= fData[iByte+2]<<16;
+  word |= fData[iByte+1]<<8;
+  word |= fData[iByte];
+   fPosition++;
+
+  return word;
+
+}
+
index 3da604d940400586d2cb3a5f7d94d2b1e01fb247..49838f5c0650d4bdc6cffadd171b263dc6439600 100644 (file)
@@ -52,7 +52,7 @@ generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
 
 # Generate the ROOT map
 # Dependecies
-set(LIBDEPS MathCore HIJING)
+set(LIBDEPS MathCore)
 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
 
 
@@ -75,4 +75,4 @@ install(TARGETS ${MODULE}
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
-install(FILES ${HDRS} DESTINATION include)
\ No newline at end of file
+install(FILES ${HDRS} DESTINATION include)
index e234e150c54b3b76eb419e87728ad8031b3bb889..f7d1df8d4f03bef339ac04dbd3bdd1f6cbc466ce 100644 (file)
@@ -512,9 +512,10 @@ void AliTOFT0::Exec(Option_t *option)
 
   /*const*/ Int_t kSize = 70+fHeadersFile.Length()+1;
   char outFileName[kSize];
-  strncpy(outFileName,"ht010tr120ps",kSize); // global time resolution has to be converted from Int_t to char
+  
+  strncpy(outFileName, "ht010tr120ps", sizeof("ht010tr120ps")); // global time resolution has to be converted from Int_t to char
                                       // in order to have in the output filename this parameter
-  strncat(outFileName,fHeadersFile,kSize);
+  strncat(outFileName, fHeadersFile, sizeof(fHeadersFile));
 
   if(fT0File.IsNull()) fT0File=outFileName;
 
index 5ddf3e209bc1bc8a619cdf5188a09deb0dd22385..58e5f4c15a00ce0097f0b88a56124cd7b87f728c 100644 (file)
 /*
-fbellini@cern.ch, last update on 12/07/2013
-- added average multi vs. run number trending plot
-Previous history - january 2012:
-- added flag for displaying reduced n. of trending plots
-- now producing tree run by run
-- new method to produce trending plots from list of trees
+  fbellini@cern.ch, last update on 09/01/2015
+  - cleanup and fixes for graphics
+  Previous history:
+  - added average multi vs. run number trending plot
+  - added flag for displaying reduced n. of trending plots
+  - now producing tree run by run
+  - new method to produce trending plots from list of trees
 */
 
 Int_t MakeTrendingTOFQA(char * runlist, Int_t year=2012, char *period="LHC12a", char* pass="cpass1", char* nameSuffix ="_barrel",Bool_t isMC=kTRUE, Int_t trainId=0, Bool_t displayAll=kTRUE, Bool_t includeStartTime=kTRUE){                                             
-       Int_t filesCounter=0;
+  Int_t filesCounter=0;
   
-       if (!runlist) {
-               printf("Invalid list of runs given as input: nothing done\n");
-               return 1;
-       }       
-       Int_t runNumber;
-       char infile[300]; 
-       char postFileName[20];
-       char treePostFileName[20];
+  if (!runlist) {
+    printf("Invalid list of runs given as input: nothing done\n");
+    return 1;
+  }    
+  Int_t runNumber;
+  char infile[300]; 
+  char postFileName[20];
+  char treePostFileName[20];
   
-       char trendFileName[100]; 
-       //Define trending output
-       if (trainId==0){
-         sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass);  
-       }else{
-         sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass);
-       }
-       TFile * trendFile=new TFile(trendFileName,"recreate");
-       FILE * files = fopen(runlist, "r") ; 
-
-       //create chain of treePostQA     
-       Long64_t nentries=100000, firstentry=0; 
-       TChain *chainTree = 0;
-       chainTree=new TChain("trendTree");
+  char trendFileName[100]; 
+  //Define trending output
+  if (trainId==0){
+    sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass);  
+  }else{
+    sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass);
+  }
+  TFile * trendFile=new TFile(trendFileName,"recreate");
+  FILE * files = fopen(runlist, "r") ; 
+
+  //create chain of treePostQA     
+  Long64_t nentries=100000, firstentry=0; 
+  TChain *chainTree = 0;
+  chainTree=new TChain("trendTree");
        
-       while (fscanf(files,"%d",&runNumber)==1 ){
+  while (fscanf(files,"%d",&runNumber)==1 ){
          
-         //get QAtrain output
-         if (trainId==0){
-           if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/%s/QAresults%s.root",year,period,runNumber,pass,nameSuffix);
-           else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QAresults%s.root",year,period,runNumber,nameSuffix);
-         } else{
-           if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults%s.root",year,period,runNumber,pass,trainId,nameSuffix);
-           else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QA%i/QAresults%s.root",year,period,runNumber,trainId,nameSuffix);
-         }
-
-         Printf("============== Opening QA file(s) for run %i =======================\n",runNumber);
+    //get QAtrain output
+    if (trainId==0){
+      if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/%s/QAresults%s.root",year,period,runNumber,pass,nameSuffix);
+      else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QAresults%s.root",year,period,runNumber,nameSuffix);
+    } else{
+      if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults%s.root",year,period,runNumber,pass,trainId,nameSuffix);
+      else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QA%i/QAresults%s.root",year,period,runNumber,trainId,nameSuffix);
+    }
+
+    Printf("============== Opening QA file(s) for run %i =======================\n",runNumber);
          
-         //run post-analysis
-         if (RunESDQApostAnalysis(infile,runNumber,isMC,kTRUE,displayAll,includeStartTime)==0){
-           filesCounter++;
-           sprintf(postFileName,"postQA_%i.root",runNumber);
-           sprintf(treePostFileName,"treePostQA_%i.root",runNumber);
+    //run post-analysis
+    if (RunESDQApostAnalysis(infile,runNumber,isMC,kTRUE,displayAll,includeStartTime)==0){
+      filesCounter++;
+      sprintf(postFileName,"postQA_%i.root",runNumber);
+      sprintf(treePostFileName,"treePostQA_%i.root",runNumber);
            
-           if (MakePostQAtree(runNumber, isMC, postFileName, treePostFileName, includeStartTime)==0){
-             chainTree->Add(treePostFileName); 
-             Printf("Tree chain has now %d entries ",(Int_t)chainTree->GetEntries());
-           } else {
-             Printf("Could not get tree with trending quantities for run %i: SKIPPING",runNumber);
-           
-         } else 
-           Printf("Post analysis not run on QA output %s", infile);
-       }
-       return  MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); 
+      if (MakePostQAtree(runNumber, isMC, postFileName, treePostFileName, includeStartTime)==0){
+       chainTree->Add(treePostFileName); 
+       Printf("Tree chain has now %d entries ",(Int_t)chainTree->GetEntries());
+      } else {
+       Printf("Could not get tree with trending quantities for run %i: SKIPPING",runNumber);
+      } 
+    } else 
+      Printf("Post analysis not run on QA output %s", infile);
+  }
+  return  MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); 
 }
 //-----------------------------------------------------------
 Int_t MakeTrendingHistoFromTreeList(char * fileList, TString treeName = "trendTree", Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE){    
 
-       Int_t filesCounter=0;
+  Int_t filesCounter=0;
   
-       if (!fileList) {
-               printf("Invalid list of runs given as input: nothing done\n");
-               return 1;
-       }       
-       char infile[300]; 
-       char trendFileName[100]; 
-       //Define trending output
-       sprintf(trendFileName,"trendingHistoTOFQA_%s.root",fileList);  
-       TFile * trendFile=new TFile(trendFileName,"recreate");
-       FILE * files = fopen(fileList, "r") ; 
-
-       //create chain of treePostQA
-       Long64_t nentries=100000, firstentry=0; 
-       TChain *chainTree =new TChain(treeName.Data());
+  if (!fileList) {
+    printf("Invalid list of runs given as input: nothing done\n");
+    return 1;
+  }    
+  char infile[300]; 
+  char trendFileName[100]; 
+  //Define trending output
+  sprintf(trendFileName,"trendingHistoTOFQA_%s.root",fileList);  
+  TFile * trendFile=new TFile(trendFileName,"recreate");
+  FILE * files = fopen(fileList, "r") ; 
+
+  //create chain of treePostQA
+  Long64_t nentries=100000, firstentry=0; 
+  TChain *chainTree =new TChain(treeName.Data());
        
-       while (fscanf(files,"%s",&infile)==1 ){   
-         if (!TFile::Open(infile,"r")) 
-           Printf("Error: cannot open file %s", infile);
-         Printf("============== Adding QA tree file %s to the chain",infile);
-         filesCounter++;         
-         chainTree->Add(infile); 
-       }
-       return  MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); 
+  while (fscanf(files,"%s",&infile)==1 ){        
+    if (!TFile::Open(infile,"r")) 
+      Printf("Error: cannot open file %s", infile);
+    Printf("============== Adding QA tree file %s to the chain",infile);
+    filesCounter++;      
+    chainTree->Add(infile); 
+  }
+  return  MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); 
 }
 
 //______________________________________________________________________________
 Int_t MakeTrendingFromTreeWithErrors(TChain * fin,char* trendFileName=NULL, Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE){
 
-       if (!trendFileName) 
-               return 3;
+  if (!trendFileName) 
+    return 3;
  
-       if (!fin) 
-               return 4;
-
-       Int_t runNumber;
-       Double_t avTime=0., peakTime=0., spreadTime=0., peakTimeErr=0., spreadTimeErr=0.,negTimeRatio=0.,
-               avRawTime=0., peakRawTime=0., spreadRawTime=0., peakRawTimeErr=0., spreadRawTimeErr=0., 
-               avTot=0., peakTot=0.,spreadTot=0.,  peakTotErr=0.,spreadTotErr=0.,
-               orphansRatio=0., avL=0., negLratio=0.,
-               effPt1=0., effPt2=0., matchEffLinFit1Gev=0.,matchEffLinFit1GevErr=0.;
-       Double_t avDiffTime=0.,peakDiffTime=0., spreadDiffTime=0.,peakDiffTimeErr=0., spreadDiffTimeErr=0.,avT0fillRes=0.;
+  if (!fin) 
+    return 4;
+
+  Int_t runNumber;
+  Double_t avTime=0., peakTime=0., spreadTime=0., peakTimeErr=0., spreadTimeErr=0.,negTimeRatio=0.,
+    avRawTime=0., peakRawTime=0., spreadRawTime=0., peakRawTimeErr=0., spreadRawTimeErr=0., 
+    avTot=0., peakTot=0.,spreadTot=0.,  peakTotErr=0.,spreadTotErr=0.,
+    orphansRatio=0., avL=0., negLratio=0.,
+    effPt1=0., effPt2=0., matchEffLinFit1Gev=0.,matchEffLinFit1GevErr=0.;
+  Double_t avDiffTime=0.,peakDiffTime=0., spreadDiffTime=0.,peakDiffTimeErr=0., spreadDiffTimeErr=0.,avT0fillRes=0.;
    
-       Double_t avT0A=0.,peakT0A=0., spreadT0A=0.,peakT0AErr=0., spreadT0AErr=0.;
-       Double_t avT0C=0.,peakT0C=0., spreadT0C=0.,peakT0CErr=0., spreadT0CErr=0.;
-       Double_t avT0AC=0.,peakT0AC=0., spreadT0AC=0.,peakT0ACErr=0., spreadT0ACErr=0.;
-       Double_t avT0res=0.,peakT0res=0., spreadT0res=0.,peakT0resErr=0., spreadT0resErr=0.;
-       Float_t avMulti=0;
-       Float_t fractionEventsWHits=0.0;
-       Double_t goodChannelRatio=0.0;
+  Double_t avT0A=0.,peakT0A=0., spreadT0A=0.,peakT0AErr=0., spreadT0AErr=0.;
+  Double_t avT0C=0.,peakT0C=0., spreadT0C=0.,peakT0CErr=0., spreadT0CErr=0.;
+  Double_t avT0AC=0.,peakT0AC=0., spreadT0AC=0.,peakT0ACErr=0., spreadT0ACErr=0.;
+  Double_t avT0res=0.,peakT0res=0., spreadT0res=0.,peakT0resErr=0., spreadT0resErr=0.;
+  Float_t avMulti=0;
+  Float_t fractionEventsWHits=0.0;
+  Double_t goodChannelRatio=0.0;
    
-       TTree * ttree = (TTree*) fin->CloneTree();
-       ttree->SetBranchAddress("run",&runNumber);
-       ttree->SetBranchAddress("avMulti",&avMulti);
-       ttree->SetBranchAddress("goodChannelsRatio",&goodChannelRatio);   
-       ttree->SetBranchAddress("avTime",&avTime); //mean time
-       ttree->SetBranchAddress("peakTime",&peakTime); //main peak time after fit
-       ttree->SetBranchAddress("spreadTime",&spreadTime); //spread of main peak of time after fit
-       ttree->SetBranchAddress("peakTimeErr",&peakTimeErr); //main peak time after fit error
-       ttree->SetBranchAddress("spreadTimeErr",&spreadTimeErr); //spread of main peak of time after fit error
+  TTree * ttree = (TTree*) fin->CloneTree();
+  ttree->SetBranchAddress("run",&runNumber);
+  ttree->SetBranchAddress("avMulti",&avMulti);
+  ttree->SetBranchAddress("goodChannelsRatio",&goodChannelRatio);   
+  ttree->SetBranchAddress("avTime",&avTime); //mean time
+  ttree->SetBranchAddress("peakTime",&peakTime); //main peak time after fit
+  ttree->SetBranchAddress("spreadTime",&spreadTime); //spread of main peak of time after fit
+  ttree->SetBranchAddress("peakTimeErr",&peakTimeErr); //main peak time after fit error
+  ttree->SetBranchAddress("spreadTimeErr",&spreadTimeErr); //spread of main peak of time after fit error
    
-       ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio
+  ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio
    
-       ttree->SetBranchAddress("avRawTime",&avRawTime); //mean raw time
-       ttree->SetBranchAddress("peakRawTime",&peakRawTime); //mean peak of raw time after fit
-       ttree->SetBranchAddress("spreadRawTime",&spreadRawTime); //spread of main peak of raw time after fit
-       ttree->SetBranchAddress("peakRawTimeErr",&peakRawTimeErr); //main peak raw  time after fit error
-       ttree->SetBranchAddress("spreadRawTimeErr",&spreadRawTimeErr); //spread of  raw main peak of time after fit error
+  ttree->SetBranchAddress("avRawTime",&avRawTime); //mean raw time
+  ttree->SetBranchAddress("peakRawTime",&peakRawTime); //mean peak of raw time after fit
+  ttree->SetBranchAddress("spreadRawTime",&spreadRawTime); //spread of main peak of raw time after fit
+  ttree->SetBranchAddress("peakRawTimeErr",&peakRawTimeErr); //main peak raw  time after fit error
+  ttree->SetBranchAddress("spreadRawTimeErr",&spreadRawTimeErr); //spread of  raw main peak of time after fit error
   
-       ttree->SetBranchAddress("avTot",&avTot); //main peak tot
-       ttree->SetBranchAddress("peakTot",&peakTot); // main peak of tot after fit
-       ttree->SetBranchAddress("spreadTot",&spreadTot); //spread of main peak of tot after fit
-       ttree->SetBranchAddress("peakTotErr",&peakTotErr); // main peak of tot after fit
-       ttree->SetBranchAddress("spreadTotErr",&spreadTotErr); //spread of main peak of tot after fit
+  ttree->SetBranchAddress("avTot",&avTot); //main peak tot
+  ttree->SetBranchAddress("peakTot",&peakTot); // main peak of tot after fit
+  ttree->SetBranchAddress("spreadTot",&spreadTot); //spread of main peak of tot after fit
+  ttree->SetBranchAddress("peakTotErr",&peakTotErr); // main peak of tot after fit
+  ttree->SetBranchAddress("spreadTotErr",&spreadTotErr); //spread of main peak of tot after fit
    
-       ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio
+  ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio
    
-       ttree->SetBranchAddress("avL",&avL); //mean track length
-       ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm
+  ttree->SetBranchAddress("avL",&avL); //mean track length
+  ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm
    
-       ttree->SetBranchAddress("effPt1",&effPt1);//matching eff at 1 GeV/c
-       ttree->SetBranchAddress("effPt2",&effPt2); //matching eff at 2 GeV/c
-       ttree->SetBranchAddress("matchEffLinFit1Gev",&matchEffLinFit1Gev);//matching eff fit param 
-       ttree->SetBranchAddress("matchEffLinFit1GevErr",&matchEffLinFit1GevErr);////matching eff fit param error
+  ttree->SetBranchAddress("effPt1",&effPt1);//matching eff at 1 GeV/c
+  ttree->SetBranchAddress("effPt2",&effPt2); //matching eff at 2 GeV/c
+  ttree->SetBranchAddress("matchEffLinFit1Gev",&matchEffLinFit1Gev);//matching eff fit param 
+  ttree->SetBranchAddress("matchEffLinFit1GevErr",&matchEffLinFit1GevErr);////matching eff fit param error
    
-       ttree->SetBranchAddress("avPiDiffTime",&avDiffTime); //mean t-texp
-       ttree->SetBranchAddress("peakPiDiffTime",&peakDiffTime); //main peak t-texp after fit
-       ttree->SetBranchAddress("spreadPiDiffTime",&spreadDiffTime); //spread of main peak t-texp after fit
-       ttree->SetBranchAddress("peakPiDiffTimeErr",&peakDiffTimeErr); //main peak t-texp after fit error
-       ttree->SetBranchAddress("spreadPiDiffTimeErr",&spreadDiffTimeErr); //spread of main peak of t-texp after fit error
+  ttree->SetBranchAddress("avPiDiffTime",&avDiffTime); //mean t-texp
+  ttree->SetBranchAddress("peakPiDiffTime",&peakDiffTime); //main peak t-texp after fit
+  ttree->SetBranchAddress("spreadPiDiffTime",&spreadDiffTime); //spread of main peak t-texp after fit
+  ttree->SetBranchAddress("peakPiDiffTimeErr",&peakDiffTimeErr); //main peak t-texp after fit error
+  ttree->SetBranchAddress("spreadPiDiffTimeErr",&spreadDiffTimeErr); //spread of main peak of t-texp after fit error
    
-       ttree->SetBranchAddress("avT0A",&avT0A); //main peak t0A
-       ttree->SetBranchAddress("peakT0A",&peakT0A); // main peak of t0A after fit
-       ttree->SetBranchAddress("spreadT0A",&spreadT0A); //spread of main peak of t0A after fit
-       ttree->SetBranchAddress("peakT0AErr",&peakT0AErr); // main peak of t0A after fit
-       ttree->SetBranchAddress("spreadT0AErr",&spreadT0AErr); //spread of main peak of t0A after fit
+  ttree->SetBranchAddress("avT0A",&avT0A); //main peak t0A
+  ttree->SetBranchAddress("peakT0A",&peakT0A); // main peak of t0A after fit
+  ttree->SetBranchAddress("spreadT0A",&spreadT0A); //spread of main peak of t0A after fit
+  ttree->SetBranchAddress("peakT0AErr",&peakT0AErr); // main peak of t0A after fit
+  ttree->SetBranchAddress("spreadT0AErr",&spreadT0AErr); //spread of main peak of t0A after fit
    
-       ttree->SetBranchAddress("avT0C",&avT0C); //main peak t0C
-       ttree->SetBranchAddress("peakT0C",&peakT0C); // main peak of t0C after fit
-       ttree->SetBranchAddress("spreadT0C",&spreadT0C); //spread of main peak of t0C after fit
-       ttree->SetBranchAddress("peakT0CErr",&peakT0CErr); // main peak of t0C after fit
-       ttree->SetBranchAddress("spreadT0CErr",&spreadT0CErr); //spread of main peak of t0C after fit
+  ttree->SetBranchAddress("avT0C",&avT0C); //main peak t0C
+  ttree->SetBranchAddress("peakT0C",&peakT0C); // main peak of t0C after fit
+  ttree->SetBranchAddress("spreadT0C",&spreadT0C); //spread of main peak of t0C after fit
+  ttree->SetBranchAddress("peakT0CErr",&peakT0CErr); // main peak of t0C after fit
+  ttree->SetBranchAddress("spreadT0CErr",&spreadT0CErr); //spread of main peak of t0C after fit
    
-       ttree->SetBranchAddress("avT0AC",&avT0AC); //main peak t0AC
-       ttree->SetBranchAddress("peakT0AC",&peakT0AC); // main peak of t0AC after fit
-       ttree->SetBranchAddress("spreadT0AC",&spreadT0AC); //spread of main peak of t0AC after fit
-       ttree->SetBranchAddress("peakT0ACErr",&peakT0ACErr); // main peak of t0AC after fit
-       ttree->SetBranchAddress("spreadT0ACErr",&spreadT0ACErr); //spread of main peak of t0AC after fit
+  ttree->SetBranchAddress("avT0AC",&avT0AC); //main peak t0AC
+  ttree->SetBranchAddress("peakT0AC",&peakT0AC); // main peak of t0AC after fit
+  ttree->SetBranchAddress("spreadT0AC",&spreadT0AC); //spread of main peak of t0AC after fit
+  ttree->SetBranchAddress("peakT0ACErr",&peakT0ACErr); // main peak of t0AC after fit
+  ttree->SetBranchAddress("spreadT0ACErr",&spreadT0ACErr); //spread of main peak of t0AC after fit
    
-       ttree->SetBranchAddress("avT0res",&avT0res); //main peak t0AC
-       ttree->SetBranchAddress("peakT0res",&peakT0res); // main peak of t0AC after fit
-       ttree->SetBranchAddress("spreadT0res",&spreadT0res); //spread of main peak of t0AC after fit
-       ttree->SetBranchAddress("peakT0resErr",&peakT0resErr); // main peak of t0AC after fit
-       ttree->SetBranchAddress("spreadT0resErr",&spreadT0resErr); //spread of main peak of t0AC after fit
-       ttree->SetBranchAddress("avT0fillRes",&avT0fillRes); //t0 fill res
-
-       Int_t nRuns=ttree->GetEntries();
-       TList lista;
+  ttree->SetBranchAddress("avT0res",&avT0res); //main peak t0AC
+  ttree->SetBranchAddress("peakT0res",&peakT0res); // main peak of t0AC after fit
+  ttree->SetBranchAddress("spreadT0res",&spreadT0res); //spread of main peak of t0AC after fit
+  ttree->SetBranchAddress("peakT0resErr",&peakT0resErr); // main peak of t0AC after fit
+  ttree->SetBranchAddress("spreadT0resErr",&spreadT0resErr); //spread of main peak of t0AC after fit
+  ttree->SetBranchAddress("avT0fillRes",&avT0fillRes); //t0 fill res
+
+  Int_t nRuns=ttree->GetEntries();
+  TList lista;
    
-       TH1F * hAvMulti=new TH1F("hAvMulti","Average multiplicity of matched tracks <N_{TOF}>;; <N_{TOF}>", nRuns,0., nRuns);//, 600, 0. , 600.);
-       hAvMulti->SetDrawOption("E1");
-       hAvMulti->SetMarkerStyle(20);
-       hAvMulti->SetMarkerColor(kBlue);
+  TH1F * hAvMulti=new TH1F("hAvMulti","Average multiplicity of matched tracks <N_{TOF}>;; <N_{TOF}>", nRuns,0., nRuns);//, 600, 0. , 600.);
+  hAvMulti->SetDrawOption("E1");
+  hAvMulti->SetMarkerStyle(20);
+  hAvMulti->SetMarkerColor(kBlue);
        
-       TH1F * hAvDiffTimeVsRun=new TH1F("hAvDiffTimeVsRun","Mean t-t_{exp} (no fit);run;<t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//, 600, 0. , 600.);
-       hAvDiffTimeVsRun->SetDrawOption("E1");
-       hAvDiffTimeVsRun->SetMarkerStyle(20);
-       hAvDiffTimeVsRun->SetMarkerColor(kBlue);
-       //   hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0);
-
-       TH1F * hPeakDiffTimeVsRun=new TH1F("hPeakDiffTimeVsRun","t-t_{exp} (gaussian fit) ;; <t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//,600, 0. , 600. );
-       hPeakDiffTimeVsRun->SetDrawOption("E1");
-       hPeakDiffTimeVsRun->SetMarkerStyle(20);
-       hPeakDiffTimeVsRun->SetMarkerColor(kBlue);
+  TH1F * hAvDiffTimeVsRun=new TH1F("hAvDiffTimeVsRun","Mean t-t_{exp} (no fit);run;<t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//, 600, 0. , 600.);
+  hAvDiffTimeVsRun->SetDrawOption("E1");
+  hAvDiffTimeVsRun->SetMarkerStyle(20);
+  hAvDiffTimeVsRun->SetMarkerColor(kBlue);
+  //   hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0);
+
+  TH1F * hPeakDiffTimeVsRun=new TH1F("hPeakDiffTimeVsRun","t-t_{exp} (gaussian fit) ;; <t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//,600, 0. , 600. );
+  hPeakDiffTimeVsRun->SetDrawOption("E1");
+  hPeakDiffTimeVsRun->SetMarkerStyle(20);
+  hPeakDiffTimeVsRun->SetMarkerColor(kBlue);
    
-       TH1F * hSpreadDiffTimeVsRun=new TH1F("hSpreadDiffTimeVsRun","#sigma(t-t_{exp}) (gaussian fit);; #sigma(t^{TOF}-t_{exp,#pi}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.);
-       hSpreadDiffTimeVsRun->SetDrawOption("E1");
-       hSpreadDiffTimeVsRun->SetMarkerStyle(20);
-       hSpreadDiffTimeVsRun->SetMarkerColor(kBlue);
-
-       TH1F * hAvTimeVsRun=new TH1F("hAvTimeVsRun","<t^{TOF}>;;<t^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.);
-       hAvTimeVsRun->SetDrawOption("E1");
-       hAvTimeVsRun->SetMarkerStyle(20);
-       hAvTimeVsRun->SetMarkerColor(kBlue);
-       //   hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0);
-
-       TH1F * hPeakTimeVsRun=new TH1F("hPeakTimeVsRun","Peak value of t^{TOF} (landau fit);;t_{peak}^{TOF} (ns)",nRuns,0., nRuns);//,600, 0. , 600. );
-       hPeakTimeVsRun->SetDrawOption("E1");
-       hPeakTimeVsRun->SetMarkerStyle(20);
-       hPeakTimeVsRun->SetMarkerColor(kBlue);
+  TH1F * hSpreadDiffTimeVsRun=new TH1F("hSpreadDiffTimeVsRun","#sigma(t-t_{exp}) (gaussian fit);; #sigma(t^{TOF}-t_{exp,#pi}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.);
+  hSpreadDiffTimeVsRun->SetDrawOption("E1");
+  hSpreadDiffTimeVsRun->SetMarkerStyle(20);
+  hSpreadDiffTimeVsRun->SetMarkerColor(kBlue);
+
+  TH1F * hAvTimeVsRun=new TH1F("hAvTimeVsRun","<t^{TOF}>;;<t^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.);
+  hAvTimeVsRun->SetDrawOption("E1");
+  hAvTimeVsRun->SetMarkerStyle(20);
+  hAvTimeVsRun->SetMarkerColor(kBlue);
+  //   hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0);
+
+  TH1F * hPeakTimeVsRun=new TH1F("hPeakTimeVsRun","Peak value of t^{TOF} (landau fit);;t_{peak}^{TOF} (ns)",nRuns,0., nRuns);//,600, 0. , 600. );
+  hPeakTimeVsRun->SetDrawOption("E1");
+  hPeakTimeVsRun->SetMarkerStyle(20);
+  hPeakTimeVsRun->SetMarkerColor(kBlue);
    
-       TH1F * hSpreadTimeVsRun=new TH1F("hSpreadTimeVsRun","Spread of t^{TOF} (landau fit);; #sigma(t^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.);
-       hSpreadTimeVsRun->SetDrawOption("E1");
-       hSpreadTimeVsRun->SetMarkerStyle(20);
-       hSpreadTimeVsRun->SetMarkerColor(kBlue);
+  TH1F * hSpreadTimeVsRun=new TH1F("hSpreadTimeVsRun","Spread of t^{TOF} (landau fit);; #sigma(t^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.);
+  hSpreadTimeVsRun->SetDrawOption("E1");
+  hSpreadTimeVsRun->SetMarkerStyle(20);
+  hSpreadTimeVsRun->SetMarkerColor(kBlue);
   
-       TH1F * hAvRawTimeVsRun=new TH1F("hAvRawTimeVsRun","Peak value of raw t^{TOF};;<t_{raw}^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.);
-       hAvRawTimeVsRun->SetDrawOption("E1");
-       hAvRawTimeVsRun->SetMarkerStyle(21);
-       hAvRawTimeVsRun->SetMarkerColor(kGreen);
-
-       TH1F * hPeakRawTimeVsRun=new TH1F("hPeakRawTimeVsRun","Peak value of raw t^{TOF} (landau fit);;t_{peak,raw}^{TOF} (ns)",nRuns,0., nRuns);//, 600, 0. , 600.);
-       hPeakRawTimeVsRun->SetDrawOption("E1");
-       hPeakRawTimeVsRun->SetMarkerStyle(21);
-       hPeakRawTimeVsRun->SetMarkerColor(kGreen);
-
-       TH1F * hSpreadRawTimeVsRun=new TH1F("hSpreadRawTimeVsRun","Spread of raw t^{TOF} (landau fit);;#sigma(t_{raw}^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.);
-       hSpreadRawTimeVsRun->SetDrawOption("E1");
-       hSpreadRawTimeVsRun->SetMarkerStyle(21);
-       hSpreadRawTimeVsRun->SetMarkerColor(kGreen);
+  TH1F * hAvRawTimeVsRun=new TH1F("hAvRawTimeVsRun","Peak value of raw t^{TOF};;<t_{raw}^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.);
+  hAvRawTimeVsRun->SetDrawOption("E1");
+  hAvRawTimeVsRun->SetMarkerStyle(21);
+  hAvRawTimeVsRun->SetMarkerColor(kGreen);
+
+  TH1F * hPeakRawTimeVsRun=new TH1F("hPeakRawTimeVsRun","Peak value of raw t^{TOF} (landau fit);;t_{peak,raw}^{TOF} (ns)",nRuns,0., nRuns);//, 600, 0. , 600.);
+  hPeakRawTimeVsRun->SetDrawOption("E1");
+  hPeakRawTimeVsRun->SetMarkerStyle(21);
+  hPeakRawTimeVsRun->SetMarkerColor(kGreen);
+
+  TH1F * hSpreadRawTimeVsRun=new TH1F("hSpreadRawTimeVsRun","Spread of raw t^{TOF} (landau fit);;#sigma(t_{raw}^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.);
+  hSpreadRawTimeVsRun->SetDrawOption("E1");
+  hSpreadRawTimeVsRun->SetMarkerStyle(21);
+  hSpreadRawTimeVsRun->SetMarkerColor(kGreen);
    
-       TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun","<ToT> (no fit);run;<ToT> (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
-       hAvTotVsRun->SetDrawOption("E1");
-       hAvTotVsRun->SetMarkerStyle(22);
+  TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun","<ToT> (no fit);run;<ToT> (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
+  hAvTotVsRun->SetDrawOption("E1");
+  hAvTotVsRun->SetMarkerStyle(22);
    
-       TH1F * hPeakTotVsRun=new TH1F("hPeakTotVsRun","<ToT> (gaussian fit);;ToT_{peak} (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
-       hPeakTotVsRun->SetDrawOption("E1");
-       hPeakTotVsRun->SetMarkerStyle(22);
+  TH1F * hPeakTotVsRun=new TH1F("hPeakTotVsRun","<ToT> (gaussian fit);;ToT_{peak} (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
+  hPeakTotVsRun->SetDrawOption("E1");
+  hPeakTotVsRun->SetMarkerStyle(22);
    
-       TH1F * hSpreadTotVsRun=new TH1F("hSpreadTotVsRun","#sigma(ToT) (gaussian fit);#sigma(ToT) (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
-       hSpreadTotVsRun->SetDrawOption("E1");
-       hSpreadTotVsRun->SetMarkerStyle(22);
+  TH1F * hSpreadTotVsRun=new TH1F("hSpreadTotVsRun","#sigma(ToT) (gaussian fit);#sigma(ToT) (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
+  hSpreadTotVsRun->SetDrawOption("E1");
+  hSpreadTotVsRun->SetMarkerStyle(22);
    
-       TH1F * hNegTimeRatioVsRun=new TH1F("hNegTimeRatioVsRun","Ratio of tracks with t^{TOF}<12.5 ns; ; ratio of tracks with t^{TOF}<12.5 ns (%)",nRuns, 0., nRuns);//, 100, 0. , 100.);
-       hNegTimeRatioVsRun->SetDrawOption("E");
-
-       TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","Ratio of orphans (hits with ToT=0); ; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.);
-       hOrphansRatioVsRun->SetDrawOption("E");
-
-       TH1F * hMeanLVsRun=new TH1F("hMeanLVsRun","Average track length;; <L> (cm)",nRuns, 0., nRuns);//, 350, 350. , 700.);
-       hMeanLVsRun->SetDrawOption("E");
-       TH1F * hNegLRatioVsRun=new TH1F("hNegLRatioVsRun","Ratio of tracks with L<350 cm;; ratio of tracks with L<350 cm (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.);
-       hNegLRatioVsRun->SetDrawOption("E");
-       TH1F * hMatchEffVsRun=new TH1F("hMatchEffVsRun","Matching efficiency (linear fit for p_{T}>1.0 GeV/c);;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.);
-       hMatchEffVsRun->SetDrawOption("E");
-       TH1F * hMatchEffVsRunNormToGoodCh=new TH1F("hMatchEffVsRunNormToGoodCh","Matching efficiency normalized to percentage of TOF good channels;;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.);
-       hMatchEffVsRunNormToGoodCh->SetDrawOption("E");
+  TH1F * hNegTimeRatioVsRun=new TH1F("hNegTimeRatioVsRun","Ratio of tracks with t^{TOF}<12.5 ns; ; ratio of tracks with t^{TOF}<12.5 ns (%)",nRuns, 0., nRuns);//, 100, 0. , 100.);
+  hNegTimeRatioVsRun->SetDrawOption("E");
+
+  TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","Ratio of orphans (hits with ToT=0); ; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.);
+  hOrphansRatioVsRun->SetDrawOption("E");
+
+  TH1F * hMeanLVsRun=new TH1F("hMeanLVsRun","Average track length;; <L> (cm)",nRuns, 0., nRuns);//, 350, 350. , 700.);
+  hMeanLVsRun->SetDrawOption("E");
+  TH1F * hNegLRatioVsRun=new TH1F("hNegLRatioVsRun","Ratio of tracks with L<350 cm;; ratio of tracks with L<350 cm (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.);
+  hNegLRatioVsRun->SetDrawOption("E");
+  TH1F * hMatchEffVsRun=new TH1F("hMatchEffVsRun","#epsilon_{match} (linear fit for p_{T}>1.0 GeV/c);;#epsilon_{match} (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.);
+  hMatchEffVsRun->SetDrawOption("E");
+  TH1F * hMatchEffVsRunNormToGoodCh=new TH1F("hMatchEffVsRunNormToGoodCh","#epsilon_{match} normalized to percentage of TOF good channels;;#epsilon_{match} (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.);
+  hMatchEffVsRunNormToGoodCh->SetDrawOption("E");
        
-       TH1F * hMatchEffVsRun1=new TH1F("hMatchEffVsRun1","Matching efficiency (value for p_{T}=1.0 GeV/c);;matching efficiency (pT=1.0 GeV/c)",nRuns, 0., nRuns);
-       hMatchEffVsRun1->SetDrawOption("E");
-       TH1F * hPeakT0AVsRun=new TH1F("hPeakT0AVsRun","Peak value of T0A (gaussian fit);;t0A (ps)",nRuns,0., nRuns);
-       TH1F * hPeakT0CVsRun=new TH1F("hPeakT0CVsRun","Peak value of T0C (gaussian fit);;t0AC (ps)",nRuns,0., nRuns);
-       TH1F * hPeakT0ACVsRun=new TH1F("hPeakT0ACVsRun","Peak value of T0AC (gaussian fit);;t0AC (ps)",nRuns,0., nRuns);
-       TH1F * hT0fillResVsRun=new TH1F("hT0fillResVsRun","t0_fill spread;;t0_spread (ps)",nRuns,0., nRuns);
+  TH1F * hMatchEffVsRun1=new TH1F("hMatchEffVsRun1","#epsilon_{match} (value for p_{T}=1.0 GeV/c);;#epsilon_{match} (pT=1.0 GeV/c)",nRuns, 0., nRuns);
+  hMatchEffVsRun1->SetDrawOption("E");
+  TH1F * hPeakT0AVsRun=new TH1F("hPeakT0AVsRun","Peak value of T0A (gaussian fit);;t0A (ps)",nRuns,0., nRuns);
+  TH1F * hPeakT0CVsRun=new TH1F("hPeakT0CVsRun","Peak value of T0C (gaussian fit);;t0AC (ps)",nRuns,0., nRuns);
+  TH1F * hPeakT0ACVsRun=new TH1F("hPeakT0ACVsRun","Peak value of T0AC (gaussian fit);;t0AC (ps)",nRuns,0., nRuns);
+  TH1F * hT0fillResVsRun=new TH1F("hT0fillResVsRun","t0_fill spread;;t0_spread (ps)",nRuns,0., nRuns);
        
        
-       lista.Add(hAvMulti);
-       lista.Add(hAvDiffTimeVsRun);
-       lista.Add(hPeakDiffTimeVsRun);
-       lista.Add(hSpreadDiffTimeVsRun);
-       lista.Add(hAvTimeVsRun);
-       lista.Add(hPeakTimeVsRun);
-       lista.Add(hSpreadTimeVsRun);
-       lista.Add(hAvRawTimeVsRun);
-       lista.Add(hPeakRawTimeVsRun);
-       lista.Add(hSpreadRawTimeVsRun); 
-       lista.Add(hAvTotVsRun);
-       lista.Add(hPeakTotVsRun);
-       lista.Add(hSpreadTotVsRun);
-       lista.Add(hNegTimeRatioVsRun);
-       lista.Add(hOrphansRatioVsRun);
-       lista.Add(hMeanLVsRun);
-       lista.Add(hNegLRatioVsRun);
-       lista.Add(hMatchEffVsRun);
-       lista.Add(hMatchEffVsRunNormToGoodCh);
-       lista.Add(hPeakT0AVsRun);
-       lista.Add(hPeakT0CVsRun);
-       lista.Add(hPeakT0ACVsRun);
-       lista.Add(hT0fillResVsRun);
-       char runlabel[6];
+  lista.Add(hAvMulti);
+  lista.Add(hAvDiffTimeVsRun);
+  lista.Add(hPeakDiffTimeVsRun);
+  lista.Add(hSpreadDiffTimeVsRun);
+  lista.Add(hAvTimeVsRun);
+  lista.Add(hPeakTimeVsRun);
+  lista.Add(hSpreadTimeVsRun);
+  lista.Add(hAvRawTimeVsRun);
+  lista.Add(hPeakRawTimeVsRun);
+  lista.Add(hSpreadRawTimeVsRun); 
+  lista.Add(hAvTotVsRun);
+  lista.Add(hPeakTotVsRun);
+  lista.Add(hSpreadTotVsRun);
+  lista.Add(hNegTimeRatioVsRun);
+  lista.Add(hOrphansRatioVsRun);
+  lista.Add(hMeanLVsRun);
+  lista.Add(hNegLRatioVsRun);
+  lista.Add(hMatchEffVsRun);
+  lista.Add(hMatchEffVsRunNormToGoodCh);
+  lista.Add(hPeakT0AVsRun);
+  lista.Add(hPeakT0CVsRun);
+  lista.Add(hPeakT0ACVsRun);
+  lista.Add(hT0fillResVsRun);
+  char runlabel[6];
    
-       for (Int_t irun=0;irun<nRuns;irun++){
-               ttree->GetEntry(irun);
+  for (Int_t irun=0;irun<nRuns;irun++){
+    ttree->GetEntry(irun);
     
-               sprintf(runlabel,"%i",runNumber);
+    sprintf(runlabel,"%i",runNumber);
     
-               hAvMulti->SetBinContent(irun+1, avMulti);
-               hAvMulti->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hAvMulti->SetBinContent(irun+1, avMulti);
+    hAvMulti->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime);
-               hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime);
+    hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime);
-               hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr);
-               hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime);
+    hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr);
+    hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime);
-               hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr);
-               hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime);
+    hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr);
+    hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hAvTimeVsRun->SetBinContent(irun+1, avTime);
-               hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hAvTimeVsRun->SetBinContent(irun+1, avTime);
+    hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hPeakTimeVsRun->SetBinContent(irun+1,peakTime);
-               hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr);
-               hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakTimeVsRun->SetBinContent(irun+1,peakTime);
+    hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr);
+    hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime);
-               hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr);
-               hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime);
+    hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr);
+    hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime);
-               hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime);
+    hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
     
-               hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime);
-               hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr);
-               hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime);
+    hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr);
+    hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime);
-               hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr);
-               hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime);
+    hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr);
+    hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hAvTotVsRun->SetBinContent(irun+1,avTot);
-               hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hAvTotVsRun->SetBinContent(irun+1,avTot);
+    hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hPeakTotVsRun->SetBinContent(irun+1,peakTot);
-               hPeakTotVsRun->SetBinError(irun+1,peakTotErr);
-               hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakTotVsRun->SetBinContent(irun+1,peakTot);
+    hPeakTotVsRun->SetBinError(irun+1,peakTotErr);
+    hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hSpreadTotVsRun->SetBinContent(irun+1,spreadTot);
-               hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr);
-               hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hSpreadTotVsRun->SetBinContent(irun+1,spreadTot);
+    hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr);
+    hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
     
-               hNegTimeRatioVsRun->SetBinContent(irun+1,negTimeRatio);
-               hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hNegTimeRatioVsRun->SetBinContent(irun+1,negTimeRatio);
+    hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
     
-               hOrphansRatioVsRun->SetBinContent(irun+1,orphansRatio);
-               hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hOrphansRatioVsRun->SetBinContent(irun+1,orphansRatio);
+    hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
     
-               hMeanLVsRun->SetBinContent(irun+1,avL);
-               hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hMeanLVsRun->SetBinContent(irun+1,avL);
+    hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
     
-               hNegLRatioVsRun->SetBinContent(irun+1,negLratio);
-               hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
-
-               hMatchEffVsRun->SetBinContent(irun+1,matchEffLinFit1Gev);
-               hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr);
-               hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
-               hMatchEffVsRun->SetLineColor(kRed);
-               hMatchEffVsRun->SetLineWidth(2);
-
-               if (goodChannelRatio>0)
-                 hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1,matchEffLinFit1Gev/goodChannelRatio);
-               else 
-                 hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1, 0.0);
-               hMatchEffVsRunNormToGoodCh->SetBinError(irun+1,matchEffLinFit1GevErr);
-               hMatchEffVsRunNormToGoodCh->GetXaxis()->SetBinLabel(irun+1,runlabel);
-               hMatchEffVsRunNormToGoodCh->SetLineColor(kBlue);
-               hMatchEffVsRunNormToGoodCh->SetLineWidth(2);
+    hNegLRatioVsRun->SetBinContent(irun+1,negLratio);
+    hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+
+    hMatchEffVsRun->SetBinContent(irun+1,matchEffLinFit1Gev);
+    hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr);
+    hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hMatchEffVsRun->SetLineColor(kRed);
+    hMatchEffVsRun->SetLineWidth(2);
+
+    if (goodChannelRatio>0)
+      hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1,matchEffLinFit1Gev/goodChannelRatio);
+    else 
+      hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1, 0.0);
+    hMatchEffVsRunNormToGoodCh->SetBinError(irun+1,matchEffLinFit1GevErr);
+    hMatchEffVsRunNormToGoodCh->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hMatchEffVsRunNormToGoodCh->SetLineColor(kBlue);
+    hMatchEffVsRunNormToGoodCh->SetLineWidth(2);
      
-               hPeakT0AVsRun->SetBinContent(irun+1,peakT0A);
-               hPeakT0AVsRun->SetBinError(irun+1,spreadT0A);
-               hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakT0AVsRun->SetBinContent(irun+1,peakT0A);
+    hPeakT0AVsRun->SetBinError(irun+1,spreadT0A);
+    hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hPeakT0CVsRun->SetBinContent(irun+1,peakT0C);
-               hPeakT0CVsRun->SetBinError(irun+1,spreadT0C);
-               hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakT0CVsRun->SetBinContent(irun+1,peakT0C);
+    hPeakT0CVsRun->SetBinError(irun+1,spreadT0C);
+    hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
     
-               hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC);
-               hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC);
-               hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+    hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC);
+    hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC);
+    hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
 
-               hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes);
-               hT0fillResVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
-       }
+    hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes);
+    hT0fillResVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
+  }
   
-       char  outfilename[200];
-       sprintf(outfilename, "trend_%s",trendFileName);
-       TFile * fout=new TFile(outfilename,"recreate");
-       fout->cd();
-       lista.Write();
-       fout->Close();
+  char  outfilename[200];
+  sprintf(outfilename, "trend_%s",trendFileName);
+  TFile * fout=new TFile(outfilename,"recreate");
+  fout->cd();
+  lista.Write();
+  fout->Close();
        
-       TString plotDir(Form("PlotsTrending"));
-       gSystem->Exec(Form("mkdir %s",plotDir.Data()));
+  TString plotDir(Form("PlotsTrending"));
+  gSystem->Exec(Form("mkdir %s",plotDir.Data()));
        
-       TCanvas* cPeakDiffTimeVsRun = new TCanvas("cPeakDiffTimeVsRun","cPeakDiffTimeVsRun", 50,50,750,550);
-       hPeakDiffTimeVsRun->GetYaxis()->SetRangeUser(-50.,50.);
-       hPeakDiffTimeVsRun->Draw();
-       cPeakDiffTimeVsRun->Print(Form("%s/cPeakDiffTimeVsRun.png",plotDir.Data()));
+  TCanvas* cPeakDiffTimeVsRun = new TCanvas("cPeakDiffTimeVsRun","cPeakDiffTimeVsRun", 50,50,750,550);
+  hPeakDiffTimeVsRun->GetYaxis()->SetRangeUser(-50.,50.);
+  hPeakDiffTimeVsRun->Draw();
+  cPeakDiffTimeVsRun->Print(Form("%s/cPeakDiffTimeVsRun.png",plotDir.Data()));
        
-       TCanvas* cSpreadDiffTimeVsRun = new TCanvas("cSpreadDiffTimeVsRun","cSpreadDiffTimeVsRun", 50,50,750,550);
-       hSpreadDiffTimeVsRun->GetYaxis()->SetRangeUser(200.,400.);
-       hSpreadDiffTimeVsRun->Draw();
-       cSpreadDiffTimeVsRun->Print(Form("%s/cSpreadDiffTimeVsRun.png",plotDir.Data()));
-
-       TCanvas* cMatchEffVsRun = new TCanvas("cMatchEffVsRun","cMatchEffVsRun",50, 50, 750,550);
-       hMatchEffVsRun->GetYaxis()->SetRangeUser(0.,1.);
-       hMatchEffVsRun->Draw();
-       cMatchEffVsRun->Print(Form("%s/cMatchEffVsRun.png",plotDir.Data()));
-
-       TCanvas* cMatchEffNormToGoodCh = new TCanvas("cMatchEffNormToGoodCh","cMatchEffNormToGoodCh",50, 50,750,550);
-       hMatchEffVsRunNormToGoodCh->GetYaxis()->SetRangeUser(0.,1.);
-       hMatchEffVsRunNormToGoodCh->Draw();
-       cMatchEffNormToGoodCh->Print(Form("%s/cMatchEffNormToGoodCh.png",plotDir.Data()));
+  TCanvas* cSpreadDiffTimeVsRun = new TCanvas("cSpreadDiffTimeVsRun","cSpreadDiffTimeVsRun", 50,50,750,550);
+  hSpreadDiffTimeVsRun->GetYaxis()->SetRangeUser(200.,400.);
+  hSpreadDiffTimeVsRun->Draw();
+  cSpreadDiffTimeVsRun->Print(Form("%s/cSpreadDiffTimeVsRun.png",plotDir.Data()));
+
+  TCanvas* cMatchEffVsRun = new TCanvas("cMatchEffVsRun","cMatchEffVsRun",50, 50, 750,550);
+  hMatchEffVsRun->GetYaxis()->SetRangeUser(0.,1.);
+  hMatchEffVsRun->Draw();
+  cMatchEffVsRun->Print(Form("%s/cMatchEffVsRun.png",plotDir.Data()));
+
+  TCanvas* cMatchEffNormToGoodCh = new TCanvas("cMatchEffNormToGoodCh","cMatchEffNormToGoodCh",50, 50,750,550);
+  hMatchEffVsRunNormToGoodCh->GetYaxis()->SetRangeUser(0.,1.);
+  hMatchEffVsRunNormToGoodCh->Draw();
+  cMatchEffNormToGoodCh->Print(Form("%s/cMatchEffNormToGoodCh.png",plotDir.Data()));
        
-       TCanvas* cPeakT0AVsRun = new TCanvas("cPeakT0AVsRun","cPeakT0AVsRun", 50,50,750,550);
-       hPeakT0AVsRun->Draw();
-       cPeakT0AVsRun->Print(Form("%s/cPeakT0AVsRun.png",plotDir.Data()));
-
-       TCanvas* cPeakT0CVsRun = new TCanvas("cPeakT0CVsRun","cPeakT0CVsRun", 50,50,750,550);
-       hPeakT0CVsRun->Draw();
-       cPeakT0CVsRun->Print(Form("%s/cPeakT0CVsRun.png",plotDir.Data()));
-
-       TCanvas* cPeakT0ACVsRun = new TCanvas("cPeakT0ACVsRun","cPeakT0ACVsRun", 50,50,750,550);
-       hPeakT0ACVsRun->Draw();
-       cPeakT0ACVsRun->Print(Form("%s/cPeakT0ACVsRun.png",plotDir.Data()));
-
-       TCanvas* cT0fillResVsRun = new TCanvas("cT0fillResVsRun","cT0fillResVsRun", 50,50,750,550);
-       hT0fillResVsRun->Draw();
-       cT0fillResVsRun->Print(Form("%s/cT0fillResVsRun.png",plotDir.Data()));
-
-       if (displayAll) {
-         TCanvas* cAvDiffTimeVsRun = new TCanvas("cAvDiffTimeVsRun","cAvDiffTimeVsRun",50,50,750,550);
-         gPad->SetGridx();
-         gPad->SetGridy();
-         hAvDiffTimeVsRun->Draw();
-         cAvDiffTimeVsRun->Print(Form("%s/cAvDiffTimeVsRun.png",plotDir.Data()));
+  TCanvas* cPeakT0AVsRun = new TCanvas("cPeakT0AVsRun","cPeakT0AVsRun", 50,50,750,550);
+  hPeakT0AVsRun->Draw();
+  cPeakT0AVsRun->Print(Form("%s/cPeakT0AVsRun.png",plotDir.Data()));
+
+  TCanvas* cPeakT0CVsRun = new TCanvas("cPeakT0CVsRun","cPeakT0CVsRun", 50,50,750,550);
+  hPeakT0CVsRun->Draw();
+  cPeakT0CVsRun->Print(Form("%s/cPeakT0CVsRun.png",plotDir.Data()));
+
+  TCanvas* cPeakT0ACVsRun = new TCanvas("cPeakT0ACVsRun","cPeakT0ACVsRun", 50,50,750,550);
+  hPeakT0ACVsRun->Draw();
+  cPeakT0ACVsRun->Print(Form("%s/cPeakT0ACVsRun.png",plotDir.Data()));
+
+  TCanvas* cT0fillResVsRun = new TCanvas("cT0fillResVsRun","cT0fillResVsRun", 50,50,750,550);
+  hT0fillResVsRun->Draw();
+  cT0fillResVsRun->Print(Form("%s/cT0fillResVsRun.png",plotDir.Data()));
+
+  if (displayAll) {
+    TCanvas* cAvDiffTimeVsRun = new TCanvas("cAvDiffTimeVsRun","cAvDiffTimeVsRun",50,50,750,550);
+    gPad->SetGridx();
+    gPad->SetGridy();
+    hAvDiffTimeVsRun->Draw();
+    cAvDiffTimeVsRun->Print(Form("%s/cAvDiffTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cAvTimeVsRun = new TCanvas("cAvTimeVsRun","cAvTimeVsRun", 50,50,750,550);
-         hAvTimeVsRun->Draw();
-         cAvTimeVsRun->Print(Form("%s/cAvTimeVsRun.png",plotDir.Data()));
+    TCanvas* cAvTimeVsRun = new TCanvas("cAvTimeVsRun","cAvTimeVsRun", 50,50,750,550);
+    hAvTimeVsRun->Draw();
+    cAvTimeVsRun->Print(Form("%s/cAvTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cPeakTimeVsRun = new TCanvas("cPeakTimeVsRun","cPeakTimeVsRun", 50,50,750,550);
-         hPeakTimeVsRun->Draw();
-         cPeakTimeVsRun->Print(Form("%s/cPeakTimeVsRun.png",plotDir.Data()));
+    TCanvas* cPeakTimeVsRun = new TCanvas("cPeakTimeVsRun","cPeakTimeVsRun", 50,50,750,550);
+    hPeakTimeVsRun->Draw();
+    cPeakTimeVsRun->Print(Form("%s/cPeakTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cSpreadTimeVsRun = new TCanvas("cSpreadTimeVsRun","cSpreadTimeVsRun", 50,50,750,550);
-         hSpreadTimeVsRun->Draw();
-         cSpreadTimeVsRun->Print(Form("%s/cSpreadTimeVsRun.png",plotDir.Data()));
+    TCanvas* cSpreadTimeVsRun = new TCanvas("cSpreadTimeVsRun","cSpreadTimeVsRun", 50,50,750,550);
+    hSpreadTimeVsRun->Draw();
+    cSpreadTimeVsRun->Print(Form("%s/cSpreadTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cAvRawTimeVsRun = new TCanvas("cAvRawTimeVsRun","cAvRawTimeVsRun", 50,50,750,550);
-         hAvRawTimeVsRun->Draw();
-         cAvRawTimeVsRun->Print(Form("%s/cAvRawTimeVsRun.png",plotDir.Data()));
+    TCanvas* cAvRawTimeVsRun = new TCanvas("cAvRawTimeVsRun","cAvRawTimeVsRun", 50,50,750,550);
+    hAvRawTimeVsRun->Draw();
+    cAvRawTimeVsRun->Print(Form("%s/cAvRawTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cPeakRawTimeVsRun = new TCanvas("cPeakRawTimeVsRun","cPeakRawTimeVsRun", 50,50,750,550);
-         hPeakRawTimeVsRun->Draw();
-         cPeakRawTimeVsRun->Print(Form("%s/cPeakRawTimeVsRun.png",plotDir.Data()));
+    TCanvas* cPeakRawTimeVsRun = new TCanvas("cPeakRawTimeVsRun","cPeakRawTimeVsRun", 50,50,750,550);
+    hPeakRawTimeVsRun->Draw();
+    cPeakRawTimeVsRun->Print(Form("%s/cPeakRawTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cSpreadRawTimeVsRun = new TCanvas("cSpreadRawTimeVsRun","cSpreadRawTimeVsRun", 50,50,750,550);
-         hSpreadRawTimeVsRun->Draw();
-         cSpreadRawTimeVsRun->Print(Form("%s/cSpreadRawTimeVsRun.png",plotDir.Data()));
+    TCanvas* cSpreadRawTimeVsRun = new TCanvas("cSpreadRawTimeVsRun","cSpreadRawTimeVsRun", 50,50,750,550);
+    hSpreadRawTimeVsRun->Draw();
+    cSpreadRawTimeVsRun->Print(Form("%s/cSpreadRawTimeVsRun.png",plotDir.Data()));
          
-         TCanvas* cAvTotVsRun = new TCanvas("cAvTotVsRun","cAvTotVsRun", 50,50,750,550);
-         hAvTotVsRun->Draw();
-         cAvTotVsRun->Print(Form("%s/cAvTotVsRun.png",plotDir.Data()));
+    TCanvas* cAvTotVsRun = new TCanvas("cAvTotVsRun","cAvTotVsRun", 50,50,750,550);
+    hAvTotVsRun->Draw();
+    cAvTotVsRun->Print(Form("%s/cAvTotVsRun.png",plotDir.Data()));
          
-         TCanvas* cPeakTotVsRun = new TCanvas("cPeakTotVsRun","cPeakTotVsRun", 50,50,750,550);
-         hPeakTotVsRun->Draw();
-         cPeakTotVsRun->Print(Form("%s/cPeakTotVsRun.png",plotDir.Data()));
+    TCanvas* cPeakTotVsRun = new TCanvas("cPeakTotVsRun","cPeakTotVsRun", 50,50,750,550);
+    hPeakTotVsRun->Draw();
+    cPeakTotVsRun->Print(Form("%s/cPeakTotVsRun.png",plotDir.Data()));
          
-         TCanvas* cSpreadTotVsRun = new TCanvas("cSpreadTotVsRun","cSpreadTotVsRun", 50,50,750,550);
-         hSpreadTotVsRun->Draw();
-         cSpreadTotVsRun->Print(Form("%s/cSpreadTotVsRun.png",plotDir.Data()));
+    TCanvas* cSpreadTotVsRun = new TCanvas("cSpreadTotVsRun","cSpreadTotVsRun", 50,50,750,550);
+    hSpreadTotVsRun->Draw();
+    cSpreadTotVsRun->Print(Form("%s/cSpreadTotVsRun.png",plotDir.Data()));
          
-         TCanvas* cNegTimeRatioVsRun = new TCanvas("cNegTimeRatioVsRun","cNegTimeRatioVsRun", 50,50,750,550);
-         hNegTimeRatioVsRun->Draw();
-         cNegTimeRatioVsRun->Print(Form("%s/cNegTimeRatioVsRun.png",plotDir.Data()));
+    TCanvas* cNegTimeRatioVsRun = new TCanvas("cNegTimeRatioVsRun","cNegTimeRatioVsRun", 50,50,750,550);
+    hNegTimeRatioVsRun->Draw();
+    cNegTimeRatioVsRun->Print(Form("%s/cNegTimeRatioVsRun.png",plotDir.Data()));
          
-         TCanvas* cOrphansRatioVsRun = new TCanvas("cOrphansRatioVsRun","cOrphansRatioVsRun", 50,50,750,550);
-         hOrphansRatioVsRun->Draw();
-         cOrphansRatioVsRun->Print(Form("%s/cOrphansRatioVsRun.png",plotDir.Data()));
+    TCanvas* cOrphansRatioVsRun = new TCanvas("cOrphansRatioVsRun","cOrphansRatioVsRun", 50,50,750,550);
+    hOrphansRatioVsRun->Draw();
+    cOrphansRatioVsRun->Print(Form("%s/cOrphansRatioVsRun.png",plotDir.Data()));
          
-         TCanvas* cMeanLVsRun = new TCanvas("cMeanLVsRun","cMeanLVsRun", 50,50,750,550);
-         hMeanLVsRun->Draw();
-         cMeanLVsRun->Print(Form("%s/cMeanLVsRun.png",plotDir.Data()));
+    TCanvas* cMeanLVsRun = new TCanvas("cMeanLVsRun","cMeanLVsRun", 50,50,750,550);
+    hMeanLVsRun->Draw();
+    cMeanLVsRun->Print(Form("%s/cMeanLVsRun.png",plotDir.Data()));
          
-         TCanvas* cNegLRatioVsRun = new TCanvas("cNegLRatioVsRun","cNegLRatioVsRun", 50,50,750,550);
-         hNegLRatioVsRun->Draw();
-         cNegLRatioVsRun->Print(Form("%s/cNegLRatioVsRun.png",plotDir.Data()));
-       }
+    TCanvas* cNegLRatioVsRun = new TCanvas("cNegLRatioVsRun","cNegLRatioVsRun", 50,50,750,550);
+    hNegLRatioVsRun->Draw();
+    cNegLRatioVsRun->Print(Form("%s/cNegLRatioVsRun.png",plotDir.Data()));
+  }
        
-       return 0;
+  return 0;
 }
 
 //-------------------------------------------------------------------------
 Int_t MakePostQAtree(Int_t runNumber, Bool_t isMC=kFALSE, char * postFileName="postQA.0.root",char * treePostFileName="treePostQA.0.root", Bool_t includeStartTime=kTRUE){  
   
-       TFile *postfile=TFile::Open(postFileName);
-       if (!postfile) {
-         printf("Post-analysis output not found - cannot perform trending analysis. Exiting.");
-         return -1;
-       }
-       Printf("==============  Getting post-analysis info for run %i ===============\n",runNumber);
-       TFile * trendFile=new TFile(treePostFileName,"recreate");
-
-       Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999.,
-               avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., 
-               avTot=-9999., peakTot=-9999.,spreadTot=-9999.,  peakTotErr=-9999.,spreadTotErr=-9999.,
-               orphansRatio=-9999., avL=-9999., negLratio=-9999.,
-               effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.;
+  TFile *postfile=TFile::Open(postFileName);
+  if (!postfile) {
+    printf("Post-analysis output not found - cannot perform trending analysis. Exiting.");
+    return -1;
+  }
+  Printf("==============  Getting post-analysis info for run %i ===============\n",runNumber);
+  TFile * trendFile=new TFile(treePostFileName,"recreate");
+
+  Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999.,
+    avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., 
+    avTot=-9999., peakTot=-9999.,spreadTot=-9999.,  peakTotErr=-9999.,spreadTotErr=-9999.,
+    orphansRatio=-9999., avL=-9999., negLratio=-9999.,
+    effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.;
   
-       Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.;
+  Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.;
   
-       Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.;
-       Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.;
-       Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.;
-       Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.;
-       Double_t avT0fillRes=-9999.;
-
-       Float_t avMulti=0;
-       Float_t fractionEventsWHits=-9999.;
-       /*number of good (HW ok && efficient && !noisy) TOF channels from OCDB*/
-       Double_t goodChannelRatio=0.0;
-
-       TTree * ttree=new TTree("trendTree","tree of trending variables");
-       ttree->Branch("run",&runNumber,"run/I");
-       ttree->Branch("avMulti",&avMulti,"avMulti/F");
-       ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F");
-       ttree->Branch("goodChannelsRatio",&goodChannelRatio,"goodChannelRatio/D");
-       ttree->Branch("avTime",&avTime,"avTime/D"); //mean time
-       ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit
-       ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit
-       ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error
-       ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error
-       ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio
+  Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.;
+  Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.;
+  Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.;
+  Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.;
+  Double_t avT0fillRes=-9999.;
+
+  Float_t avMulti=0;
+  Float_t fractionEventsWHits=-9999.;
+  /*number of good (HW ok && efficient && !noisy) TOF channels from OCDB*/
+  Double_t goodChannelRatio=0.0;
+
+  TTree * ttree=new TTree("trendTree","tree of trending variables");
+  ttree->Branch("run",&runNumber,"run/I");
+  ttree->Branch("avMulti",&avMulti,"avMulti/F");
+  ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F");
+  ttree->Branch("goodChannelsRatio",&goodChannelRatio,"goodChannelRatio/D");
+  ttree->Branch("avTime",&avTime,"avTime/D"); //mean time
+  ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit
+  ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit
+  ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error
+  ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error
+  ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio
   
-       ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time
-       ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit
-       ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit
-       ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw  time after fit error
-       ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of  raw main peak of time after fit error
+  ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time
+  ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit
+  ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit
+  ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw  time after fit error
+  ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of  raw main peak of time after fit error
   
-       ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot
-       ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit
-       ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit
-       ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit
-       ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit
+  ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot
+  ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit
+  ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit
+  ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit
+  ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit
   
-       ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio
-
-       ttree->Branch("avL",&avL,"avL/D"); //mean track length
-       ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm
-       ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c
-       ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c
-       ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param 
-       ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error
+  ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio
+
+  ttree->Branch("avL",&avL,"avL/D"); //mean track length
+  ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm
+  ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c
+  ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c
+  ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param 
+  ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error
   
-       ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp
-       ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit
-       ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit
-       ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error
-       ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error
-
-       ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A
-       ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit
-       ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit
-       ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit
-       ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit
-
-       ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C
-       ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit
-       ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit
-       ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit
-       ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit
+  ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp
+  ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit
+  ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit
+  ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error
+  ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error
+
+  ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A
+  ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit
+  ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit
+  ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit
+  ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit
+
+  ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C
+  ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit
+  ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit
+  ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit
+  ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit
  
-       ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC
-       ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit
-       ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit
-       ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit
-       ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit
+  ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC
+  ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit
+  ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit
+  ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit
+  ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit
  
-       ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC
-       ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit
-       ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit
-       ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit
-       ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit
-       ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res
-
-       //postfile->ls();
-       //save quantities for trending
-       goodChannelRatio=(Double_t)GetGoodTOFChannelsRatio(runNumber);
+  ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC
+  ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit
+  ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit
+  ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit
+  ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit
+  ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res
+
+  //postfile->ls();
+  //save quantities for trending
+  goodChannelRatio=(Double_t)GetGoodTOFChannelsRatio(runNumber);
        
-       //--------------------------------- Multiplicity ----------------------------------//
-       TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt");
-       if ((hMulti)&&(hMulti->GetEntries()>0)) {
-         avMulti=hMulti->GetMean();
-       }
+  //--------------------------------- Multiplicity ----------------------------------//
+  TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt");
+  if ((hMulti)&&(hMulti->GetEntries()>0)) {
+    avMulti=hMulti->GetMean();
+  }
        
-       //--------------------------------- T0F signal ----------------------------------//
+  //--------------------------------- T0F signal ----------------------------------//
        
-       TH1F*hTime=(TH1F*)postfile->Get("hTOFmatchedESDtime");
-       if ((hTime)&&(hTime->GetEntries()>0)) {
-         avTime=hTime->GetMean();
-         hTime->Fit("landau","","",0.,50.);
-         peakTime=(hTime->GetFunction("landau"))->GetParameter(1);
-         spreadTime=(hTime->GetFunction("landau"))->GetParameter(2);
-         peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1);
-         spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2);
+  TH1F*hTime=(TH1F*)postfile->Get("hTOFmatchedESDtime");
+  if ((hTime)&&(hTime->GetEntries()>0)) {
+    avTime=hTime->GetMean();
+    hTime->Fit("landau","","",0.,50.);
+    peakTime=(hTime->GetFunction("landau"))->GetParameter(1);
+    spreadTime=(hTime->GetFunction("landau"))->GetParameter(2);
+    peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1);
+    spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2);
          
-         negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral());
-         printf("Main peak time (landau): mean = %f +- %f\n",peakTime,peakTimeErr );
-         printf("Main peak time (landau): spread = %f +- %f\n",spreadTime,spreadTimeErr );
-         printf("Ratio of tracks with time<12.5 ns / total = %f\n",negTimeRatio );
+    negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral());
+    printf("Main peak time (landau): mean = %f +- %f\n",peakTime,peakTimeErr );
+    printf("Main peak time (landau): spread = %f +- %f\n",spreadTime,spreadTimeErr );
+    printf("Ratio of tracks with time<12.5 ns / total = %f\n",negTimeRatio );
          
-         //add integral of main peak over total
-       }
-       printf("---------------------------------------------------------------- \n");
-       TH1F * hRawTime = (TH1F*)postfile->Get("hTOFmatchedESDrawTime");
-       if ((hRawTime)&&(hRawTime->GetEntries()>0)){
-         avRawTime=hRawTime->GetMean();
-         if (!isMC){
-           hRawTime->Fit("landau","","",200.,250.);
-           peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1);
-           spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2);
-           peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1);
-           spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2);
-           printf("Main peak raw time (landau): mean = %f +- %f\n",peakTime,peakTimeErr );
-           printf("Main peak raw time (landau): spread = %f +- %f\n",spreadRawTime,spreadRawTimeErr );
-         } else {
-          printf("Reminder: Raw time not available in MC simulated data.");
-          }
-       }
+    //add integral of main peak over total
+  }
+  printf("---------------------------------------------------------------- \n");
+  TH1F * hRawTime = (TH1F*)postfile->Get("hTOFmatchedESDrawTime");
+  if ((hRawTime)&&(hRawTime->GetEntries()>0)){
+    avRawTime=hRawTime->GetMean();
+    if (!isMC){
+      hRawTime->Fit("landau","","",200.,250.);
+      peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1);
+      spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2);
+      peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1);
+      spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2);
+      printf("Main peak raw time (landau): mean = %f +- %f\n",peakTime,peakTimeErr );
+      printf("Main peak raw time (landau): spread = %f +- %f\n",spreadRawTime,spreadRawTimeErr );
+    } else {
+      printf("Reminder: Raw time not available in MC simulated data.");
+    }
+  }
        
-       printf("---------------------------------------------------------------- \n");
+  printf("---------------------------------------------------------------- \n");
       
-       TH1F * hTot = (TH1F*)postfile->Get("hTOFmatchedESDToT");
-       if ((hTot)&&(hTot->GetEntries()>0)){
-         avTot=hTot->GetMean();
-         hTot->Fit("gaus","","",0.,50.);
-         peakTot=(hTot->GetFunction("gaus"))->GetParameter(1);
-         spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2);
-         peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1);
-         spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2);
-         printf("Main peak ToT (gaus): mean = %f +- %f\n",peakTot,peakTotErr );
-         printf("Main peak ToT (gaus): spread = %f +- %f\n",spreadTot,spreadTotErr );  
-       }      
-       printf("---------------------------------------------------------------- \n");
-       TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio");
-       if (hOrphansRatio)
-         orphansRatio=hOrphansRatio->GetMean();
+  TH1F * hTot = (TH1F*)postfile->Get("hTOFmatchedESDToT");
+  if ((hTot)&&(hTot->GetEntries()>0)){
+    avTot=hTot->GetMean();
+    hTot->Fit("gaus","","",0.,50.);
+    peakTot=(hTot->GetFunction("gaus"))->GetParameter(1);
+    spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2);
+    peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1);
+    spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2);
+    printf("Main peak ToT (gaus): mean = %f +- %f\n",peakTot,peakTotErr );
+    printf("Main peak ToT (gaus): spread = %f +- %f\n",spreadTot,spreadTotErr );       
+  }      
+  printf("---------------------------------------------------------------- \n");
+  TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio");
+  if (hOrphansRatio)
+    orphansRatio=hOrphansRatio->GetMean();
        
-       TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength");
-       if (hL)
-         avL=hL->GetMean();
+  TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength");
+  if (hL)
+    avL=hL->GetMean();
        
-       TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio");
-       if (hLnegRatio)
-         negLratio=hLnegRatio->GetMean();
+  TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio");
+  if (hLnegRatio)
+    negLratio=hLnegRatio->GetMean();
        
-       //--------------------------------- matching eff ----------------------------------//
+  //--------------------------------- matching eff ----------------------------------//
        
-       //Double_t linFitEff1Param[3]={0.,0.,0.};
-       TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt");
-       if (hMatchingVsPt) {
-         if (hMatchingVsPt->GetEntries()>0){
-           hMatchingVsPt->Fit("pol0","","",1.0,5.);
-           hMatchingVsPt->Draw();
-           if (hMatchingVsPt->GetFunction("pol0")){
-             matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0);
-             matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0);       
-             printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr );
-           }
-         } else {
-           printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n");
-         }
-       } else {
-         printf("WARNING: cannot retrieve matching efficiency plot\n");
-       }
+  //Double_t linFitEff1Param[3]={0.,0.,0.};
+  TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt");
+  if (hMatchingVsPt) {
+    if (hMatchingVsPt->GetEntries()>0){
+      hMatchingVsPt->Fit("pol0","","",1.0,5.);
+      hMatchingVsPt->Draw();
+      if (hMatchingVsPt->GetFunction("pol0")){
+       matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0);
+       matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0);     
+       printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr );
+      }
+    } else {
+      printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n");
+    }
+  } else {
+    printf("WARNING: cannot retrieve matching efficiency plot\n");
+  }
        
-       //--------------------------------- t-texp ----------------------------------//
+  //--------------------------------- t-texp ----------------------------------//
        
-       TH1F*hPiDiffTime=(TH1F*)postfile->Get("hTOFmatchedExpTimePi");
-       if ((hPiDiffTime)&&(hPiDiffTime->GetEntries()>0)) {
-         avPiDiffTime=hPiDiffTime->GetMean();
-         hPiDiffTime->Fit("gaus","","",-1000.,500.);
-         if (hPiDiffTime->GetFunction("gaus")){
-           peakPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(1);
-           spreadPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(2);
-           peakPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(1);
-           spreadPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(2);
-           printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr );
-           printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr );
-         }
-       }
-       //--------------------------------- T0 detector ----------------------------------//
+  TH1F*hPiDiffTime=(TH1F*)postfile->Get("hTOFmatchedExpTimePi");
+  if ((hPiDiffTime)&&(hPiDiffTime->GetEntries()>0)) {
+    avPiDiffTime=hPiDiffTime->GetMean();
+    hPiDiffTime->Fit("gaus","","",-1000.,500.);
+    if (hPiDiffTime->GetFunction("gaus")){
+      peakPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(1);
+      spreadPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(2);
+      peakPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(1);
+      spreadPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(2);
+      printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr );
+      printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr );
+    }
+  }
+  //--------------------------------- T0 detector ----------------------------------//
        
-       TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA");
-       if ((hT0A)&&(hT0A->GetEntries()>0)) {
-         avT0A=hT0A->GetMean();
-         hT0A->Fit("gaus");
-         peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1);
-         spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2);
-         peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1);
-         spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2);     
-         printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr );
-         printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr );   
-         //add integral of main peak over total
-       }
+  TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA");
+  if ((hT0A)&&(hT0A->GetEntries()>0)) {
+    avT0A=hT0A->GetMean();
+    hT0A->Fit("gaus");
+    peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1);
+    spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2);
+    peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1);
+    spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2);  
+    printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr );
+    printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr );        
+    //add integral of main peak over total
+  }
        
-       TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC");
-       if ((hT0C)&&(hT0C->GetEntries()>0)) {
-         avT0C=hT0C->GetMean();
-         hT0C->Fit("gaus");
-         peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1);
-         spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2);
-         peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1);
-         spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2);     
-         printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr );
-         printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr );   
-         //add integral of main peak over total
-       }
+  TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC");
+  if ((hT0C)&&(hT0C->GetEntries()>0)) {
+    avT0C=hT0C->GetMean();
+    hT0C->Fit("gaus");
+    peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1);
+    spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2);
+    peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1);
+    spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2);  
+    printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr );
+    printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr );        
+    //add integral of main peak over total
+  }
        
-       TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND");
-       if ((hT0AC)&&(hT0AC->GetEntries()>0)) {
-         avT0AC=hT0AC->GetMean();
-         hT0AC->Fit("gaus");
-         peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1);
-         spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2);
-         peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1);
-         spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2);   
-         printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr );
-         printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr );        
-       }
+  TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND");
+  if ((hT0AC)&&(hT0AC->GetEntries()>0)) {
+    avT0AC=hT0AC->GetMean();
+    hT0AC->Fit("gaus");
+    peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1);
+    spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2);
+    peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1);
+    spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2);        
+    printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr );
+    printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr );     
+  }
       
-       TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes");
-       if ((hT0res)&&(hT0res->GetEntries()>0)) {
-         avT0res=hT0res->GetMean();
-         hT0res->Fit("gaus");
-         peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1);
-         spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2);
-         peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1);
-         spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2); 
-         printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr );
-         printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr );     
-         //add integral of main peak over total
-       }
+  TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes");
+  if ((hT0res)&&(hT0res->GetEntries()>0)) {
+    avT0res=hT0res->GetMean();
+    hT0res->Fit("gaus");
+    peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1);
+    spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2);
+    peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1);
+    spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2);      
+    printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr );
+    printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr );  
+    //add integral of main peak over total
+  }
        
-       TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes");
-       if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) {
-         avT0fillRes=hT0fillRes->GetMean();
-       }
+  TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes");
+  if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) {
+    avT0fillRes=hT0fillRes->GetMean();
+  }
        
-       ttree->Fill();
-       printf("==============  Saving trending quantities in tree for run %i ===============\n",runNumber);
-       if (postfile->IsOpen()) {
-         printf("Trying to close\n");
-         postfile->Close();
-       }  
-
-       trendFile->cd();
-       ttree->Write();
-       trendFile->Close();
-       return  0;
+  ttree->Fill();
+  printf("==============  Saving trending quantities in tree for run %i ===============\n",runNumber);
+  if (postfile->IsOpen()) {
+    printf("Trying to close\n");
+    postfile->Close();
+  }  
+
+  trendFile->cd();
+  ttree->Write();
+  trendFile->Close();
+  return  0;
 }
 
 //------------------------------------------------------------------------------------
 
 Int_t RunESDQApostAnalysis(char *qafilename=NULL, Int_t runNumber=-1, Bool_t isMC=kFALSE, Bool_t IsOnGrid=kFALSE, Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE) {
   
-       Bool_t debug=kFALSE;
+  Bool_t debug=kFALSE;
   
-       /*access qa PWGPP output files - saved locally or on grid as specified by the second argument */
+  /*access qa PWGPP output files - saved locally or on grid as specified by the second argument */
   
-       char defaultQAoutput[30]="QAresults.root";
-       if (IsOnGrid) TGrid::Connect("alien://");
-       TFile * fin= TFile::Open(qafilename,"r");
-       printf("Opening file %s\n",qafilename);
-       if (!fin) {
-               printf("ERROR: QA output not found. Exiting with status -1\n");
-               return 1;
-       } else {
-               printf("INFO: QA output file %s open. \n",fin->GetName());
-       }
+  char defaultQAoutput[30]="QAresults.root";
+  if (IsOnGrid) TGrid::Connect("alien://");
+  TFile * fin= TFile::Open(qafilename,"r");
+  printf("Opening file %s\n",qafilename);
+  if (!fin) {
+    printf("ERROR: QA output not found. Exiting with status -1\n");
+    return 1;
+  } else {
+    printf("INFO: QA output file %s open. \n",fin->GetName());
+  }
   
  
-       //access histograms lists
-       char tofQAdirName[15]="TOF_Performance";
-       char PIDqaListName[6]="PIDqa";
-       char genListName[15]="cGeneralTOFqa";
-       char t0ListName[15]="cTimeZeroTOFqa";
-       char pidListName[15]="cPIDTOFqa"; 
-       char posListName[15]="cPositiveTOFqa";
-       char negListName[15]="cNegativeTOFqa";
+  //access histograms lists
+  char tofQAdirName[15]="TOF_Performance";
+  char PIDqaListName[6]="PIDqa";
+  char genListName[15]="cGeneralTOFqa";
+  char t0ListName[15]="cTimeZeroTOFqa";
+  char pidListName[15]="cPIDTOFqa"; 
+  char posListName[15]="cPositiveTOFqa";
+  char negListName[15]="cNegativeTOFqa";
  
-       TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName);
-       TDirectoryFile * pidQAdir=(TDirectoryFile*)fin->Get(PIDqaListName);
-
-       if(debug){
-         printf("------------------------------------------------------------------\n");
-         tofQAdir->ls();
-         printf("------------------------------------------------------------------\n");
-         if(includeStartTime){
-           pidQAdir->ls();
-           printf("------------------------------------------------------------------\n");
-         }
-       }
+  TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName);
+  TDirectoryFile * pidQAdir=(TDirectoryFile*)fin->Get(PIDqaListName);
+
+  if(debug){
+    printf("------------------------------------------------------------------\n");
+    tofQAdir->ls();
+    printf("------------------------------------------------------------------\n");
+    if(includeStartTime){
+      pidQAdir->ls();
+      printf("------------------------------------------------------------------\n");
+    }
+  }
        
-       TList * generalList=(TList*)tofQAdir->Get(genListName);
-       TList  *timeZeroList=(TList*)tofQAdir->Get(t0ListName);
-       TList  *pidList=(TList*)tofQAdir->Get(pidListName);
-       TList  *posList=(TList*)tofQAdir->Get(posListName);
-       TList  *negList=(TList*)tofQAdir->Get(negListName);
-
-       if(!pidQAdir)
-         printf("WARNING: PIDqa histograms not available\n");
-       else{
-         TList  *pidListT0=(TList*)pidQAdir->Get(PIDqaListName);        
-         TList  *tofPidListT0=(TList*)pidListT0->FindObject("TOF");      
-       }
-       if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n");
-       if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n");
-       if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n");
-       if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n");
-       if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n");
-
-       if ( (!generalList) && (!timeZeroList) && (!pidList) ){
-               printf("ERROR: no QA available \n");
-               return 1;
-       }
+  TList * generalList=(TList*)tofQAdir->Get(genListName);
+  TList  *timeZeroList=(TList*)tofQAdir->Get(t0ListName);
+  TList  *pidList=(TList*)tofQAdir->Get(pidListName);
+  TList  *posList=(TList*)tofQAdir->Get(posListName);
+  TList  *negList=(TList*)tofQAdir->Get(negListName);
+
+  if(!pidQAdir)
+    printf("WARNING: PIDqa histograms not available\n");
+  else{
+    TList  *pidListT0=(TList*)pidQAdir->Get(PIDqaListName);        
+    TList  *tofPidListT0=(TList*)pidListT0->FindObject("TOF");      
+  }
+  if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n");
+  if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n");
+  if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n");
+  if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n");
+  if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n");
+
+  if ( (!generalList) && (!timeZeroList) && (!pidList) ){
+    printf("ERROR: no QA available \n");
+    return 1;
+  }
   
-       if (debug){
-               generalList->ls();
-               printf("------------------------------------------------------------------\n");
-               timeZeroList->ls();
-               printf("------------------------------------------------------------------\n");
-               pidList->ls();
-               printf("------------------------------------------------------------------\n");
-       }
-
-       /*set graphic style*/
-       gStyle->SetCanvasColor(kWhite);
-       gStyle->SetFrameFillColor(kWhite);
-       gStyle->SetFrameBorderMode(0);
-       gStyle->SetCanvasBorderMode(0);
-       gStyle->SetTitleFillColor(kWhite);
-       gStyle->SetTitleBorderSize(0)  ;
-       gStyle->SetTitleFont(42);
-       gStyle->SetTextFont(42);
-       //gStyle->SetPalette(1);
-       gStyle->SetStatColor(kWhite); 
-       gStyle->SetStatBorderSize(1);
-       gStyle->SetOptStat(0);
+  if (debug){
+    generalList->ls();
+    printf("------------------------------------------------------------------\n");
+    timeZeroList->ls();
+    printf("------------------------------------------------------------------\n");
+    pidList->ls();
+    printf("------------------------------------------------------------------\n");
+  }
+
+  /*set graphic style*/
+  gStyle->SetCanvasColor(kWhite);
+  gStyle->SetFrameFillColor(kWhite);
+  gStyle->SetFrameBorderMode(0);
+  gStyle->SetCanvasBorderMode(0);
+  gStyle->SetTitleFillColor(kWhite);
+  gStyle->SetTitleBorderSize(0)  ;
+  gStyle->SetTitleFont(42);
+  gStyle->SetTextFont(42);
+  //gStyle->SetPalette(1);
+  gStyle->SetStatColor(kWhite); 
+  gStyle->SetStatBorderSize(1);
+  gStyle->SetOptStat(0);
   
-       //DEFINE OUTPUT FILE 
-       char outfilename[60];
-       sprintf(outfilename,"postQA_%i.root",runNumber);
-       TFile * fout=new TFile(outfilename,"recreate");
-
-       TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1);
-       hRunNumber->Fill(runNumber);
-
-       //-------------------------------------------------------------
-       /*GENERAL MONITOR - MULTIPLICITY*/
-       TH1F*hMulti= (TH1F*) generalList->At(0);
-
-       TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.);
-       if (hMulti->GetEntries()<1) return 2;
-       Float_t fraction=0.0;
-       if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries());
-       else fraction=0.0;
-       hFractionEventsWhits->Fill(fraction*100.);
-       //-------------------------------------------------------------
-       /*GENERAL MONITOR - TIMING AND GEOMETRY*/
-       TH1F * hTime = (TH1F*) generalList->At(1);
-       if (hTime->GetEntries()<1) return 2;
-       hTime->SetMarkerStyle(8);
-       hTime->SetMarkerSize(0.7);
-       hTime->SetMarkerColor(kBlue);
-       hTime->SetLineColor(kBlue);
-       hTime->SetFillColor(kBlue);
-       hTime->SetFillStyle(3001);
-       hTime->Rebin(2);
-       hTime->GetYaxis()->SetTitle("matched tracks"); 
-       hTime->GetYaxis()->SetTitleOffset(1.35);
+  //DEFINE OUTPUT FILE 
+  char outfilename[60];
+  sprintf(outfilename,"postQA_%i.root",runNumber);
+  TFile * fout=new TFile(outfilename,"recreate");
+
+  TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1);
+  hRunNumber->Fill(runNumber);
+
+  //-------------------------------------------------------------
+  /*GENERAL MONITOR - MULTIPLICITY*/
+  TH1F*hMulti= (TH1F*) generalList->FindObject("hTOFmatchedPerEvt");
+
+  TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.);
+  if (hMulti->GetEntries()<1) return 2;
+  Float_t fraction=0.0;
+  if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries());
+  else fraction=0.0;
+  hFractionEventsWhits->Fill(fraction*100.);
+  //-------------------------------------------------------------
+  /*GENERAL MONITOR - TIMING AND GEOMETRY*/
+  TH1F * hTime = (TH1F*) generalList->FindObject("hTOFmatchedESDtime");
+  if (hTime->GetEntries()<1) return 2;
+  hTime->SetMarkerStyle(8);
+  hTime->SetMarkerSize(0.7);
+  hTime->SetMarkerColor(kBlue);
+  hTime->SetLineColor(kBlue);
+  hTime->SetFillColor(kBlue);
+  hTime->SetFillStyle(3001);
+  hTime->Rebin(2);
+  hTime->GetYaxis()->SetTitle("matched tracks"); 
+  hTime->GetYaxis()->SetTitleOffset(1.35);
  
-       TH1F * hRawTime = (TH1F*) generalList->At(2);
-       hRawTime->SetMarkerStyle(21);
-       hRawTime->SetMarkerSize(0.7);
-       hRawTime->SetMarkerColor(kGreen);
-       hRawTime->SetLineColor(kGreen);
-       hRawTime->SetFillColor(kGreen);
-       hRawTime->SetFillStyle(3001); 
-       hRawTime->Rebin(2);
-       hRawTime->GetYaxis()->SetTitle("matched tracks");
-       hRawTime->GetYaxis()->SetTitleOffset(1.35);
+  TH1F * hRawTime = (TH1F*) generalList->FindObject("hTOFmatchedESDrawTime");
+  hRawTime->SetMarkerStyle(21);
+  hRawTime->SetMarkerSize(0.7);
+  hRawTime->SetMarkerColor(kGreen);
+  hRawTime->SetLineColor(kGreen);
+  hRawTime->SetFillColor(kGreen);
+  hRawTime->SetFillStyle(3001); 
+  hRawTime->Rebin(2);
+  hRawTime->GetYaxis()->SetTitle("matched tracks");
+  hRawTime->GetYaxis()->SetTitleOffset(1.35);
   
-       TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC");
-       lTime->SetTextSize(0.04281433);
-       lTime->AddEntry(hRawTime, "raw","L");
-       lTime->AddEntry(hTime, "ESD","L"); 
-       lTime->SetFillColor(kWhite);
-       lTime->SetShadowColor(0);
-
-       TH1F * hTot = (TH1F*) generalList->At(3);
-       hTot->SetMarkerStyle(8);
-       hTot->SetMarkerSize(0.7);
-       hTot->SetMarkerColor(kViolet-3);
-       hTot->SetLineColor(kViolet-3);
-       hTot->SetFillColor(kViolet-3);
-       hTot->SetFillStyle(3001);
-       //hTime->SetDrawOption();
-       hTot->GetYaxis()->SetTitle("matched tracks");
-       hTot->GetYaxis()->SetTitleOffset(1.35);
+  TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC");
+  lTime->SetTextSize(0.04281433);
+  lTime->AddEntry(hRawTime, "raw","L");
+  lTime->AddEntry(hTime, "ESD","L"); 
+  lTime->SetFillColor(kWhite);
+  lTime->SetShadowColor(0);
+
+  TH1F * hTot = (TH1F*) generalList->FindObject("hTOFmatchedESDToT");
+  hTot->SetMarkerStyle(8);
+  hTot->SetMarkerSize(0.7);
+  hTot->SetMarkerColor(kViolet-3);
+  hTot->SetLineColor(kViolet-3);
+  hTot->SetFillColor(kViolet-3);
+  hTot->SetFillStyle(3001);
+  //hTime->SetDrawOption();
+  hTot->GetYaxis()->SetTitle("matched tracks");
+  hTot->GetYaxis()->SetTitleOffset(1.35);
   
   
-       char orphansTxt[200];
-       Float_t orphansRatio=0.0;
-       if (hTot->GetEntries()>1){
-               orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ;
-       }
-       sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio);
-       TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.);
-       hOrphansRatio->Fill(orphansRatio*100.);  
-
-
-       TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC");
-       //NDC sets coords relative to pad
-       tOrphans->SetBorderSize(0);
-       tOrphans->SetTextSize(0.045);
-       tOrphans->SetFillColor(0); //white background
-       tOrphans->SetTextAlign(12);
-       tOrphans->SetTextColor(kViolet-3);
-       tOrphans->AddText(orphansTxt);
+  char orphansTxt[200];
+  Float_t orphansRatio=0.0;
+  if (hTot->GetEntries()>1){
+    orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ;
+  }
+  sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio);
+  TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.);
+  hOrphansRatio->Fill(orphansRatio*100.);  
+
+
+  TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC");
+  //NDC sets coords relative to pad
+  tOrphans->SetBorderSize(0);
+  tOrphans->SetTextSize(0.045);
+  tOrphans->SetFillColor(0); //white background
+  tOrphans->SetTextAlign(12);
+  tOrphans->SetTextColor(kViolet-3);
+  tOrphans->AddText(orphansTxt);
       
-       TH1F * hL = (TH1F*) generalList->At(4);
-       hL->SetMarkerStyle(8);
-       hL->SetMarkerSize(0.7);
-       hL->SetMarkerColor(kOrange-3);
-       hL->SetLineColor(kOrange-3);
-       hL->SetFillColor(kOrange-3);
-       hL->SetFillStyle(3001);
-       //hTime->SetDrawOption();
-       hL->GetYaxis()->SetTitle("matched tracks");
-       hL->GetYaxis()->SetTitleOffset(1.35);
-
-       char negLengthTxt[200];
-       Float_t negLengthRatio=0.0;
-       if (hL->GetEntries()>1){
-               negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ;
-       }
-       sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio);
-       TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.);
-       hLnegRatio->Fill(negLengthRatio*100);
+  TH1F * hL = (TH1F*) generalList->FindObject("hTOFmatchedESDtrkLength");
+  hL->SetMarkerStyle(8);
+  hL->SetMarkerSize(0.7);
+  hL->SetMarkerColor(kOrange-3);
+  hL->SetLineColor(kOrange-3);
+  hL->SetFillColor(kOrange-3);
+  hL->SetFillStyle(3001);
+  //hTime->SetDrawOption();
+  hL->GetYaxis()->SetTitle("matched tracks");
+  hL->GetYaxis()->SetTitleOffset(1.35);
+
+  char negLengthTxt[200];
+  Float_t negLengthRatio=0.0;
+  if (hL->GetEntries()>1){
+    negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ;
+  }
+  sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio);
+  TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.);
+  hLnegRatio->Fill(negLengthRatio*100);
   
 
 
-       TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC");
-       //NDC sets coords relative to pad
-       tLength->SetBorderSize(0);
-       tLength->SetTextSize(0.04);
-       tLength->SetFillColor(0); //white background
-       tLength->SetTextAlign(11);
-       tLength->SetTextColor(kOrange-3);
-       tLength->AddText(negLengthTxt);
+  TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC");
+  //NDC sets coords relative to pad
+  tLength->SetBorderSize(0);
+  tLength->SetTextSize(0.04);
+  tLength->SetFillColor(0); //white background
+  tLength->SetTextAlign(11);
+  tLength->SetTextColor(kOrange-3);
+  tLength->AddText(negLengthTxt);
  
-       if (displayAll){
-               TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900);
-               cTrackProperties->Divide(2,2);
-               cTrackProperties->cd(1);
-               gPad->SetLogy();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hTime->Draw("BAR");
-               hRawTime ->Draw("BARsame");
-               lTime->Draw();  
-               cTrackProperties->cd(2);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               gPad->SetLogy();
-               hTot->Draw("BAR");
-               tOrphans->Draw(); 
-               cTrackProperties->cd(3);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               gPad->SetLogy();
-               hL->Draw("BAR");
-               tLength->Draw(); 
-       }
-       fout->cd();
-       hRunNumber->Write();
-       hMulti->Write();
-       hFractionEventsWhits->Write();
-       hTime->Write();
-       hRawTime->Write();
-       hTot->Write();
-       hOrphansRatio->Write();
-       hL->Write();
-       hLnegRatio->Write();
+  if (displayAll){
+    TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900);
+    cTrackProperties->Divide(2,2);
+    cTrackProperties->cd(1);
+    gPad->SetLogy();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    hTime->Draw("BAR");
+    hRawTime ->Draw("BARsame");
+    lTime->Draw();  
+    cTrackProperties->cd(2);
+    gPad->SetGridx();
+    gPad->SetGridy();
+    gPad->SetLogy();
+    hTot->Draw("BAR");
+    tOrphans->Draw(); 
+    cTrackProperties->cd(3);
+    gPad->SetGridx();
+    gPad->SetGridy();
+    gPad->SetLogy();
+    hL->Draw("BAR");
+    tLength->Draw(); 
+  }
+  fout->cd();
+  hRunNumber->Write();
+  hMulti->Write();
+  hFractionEventsWhits->Write();
+  hTime->Write();
+  hRawTime->Write();
+  hTot->Write();
+  hOrphansRatio->Write();
+  hL->Write();
+  hLnegRatio->Write();
   
-       TH2F* hDxPos4profile = (TH2F*) generalList->At(14);
-       TH2F* hDxNeg4profile = (TH2F*) generalList->At(13);
+  TH2F* hDxPos4profile = (TH2F*) generalList->FindObject("hTOFmatchedDxVsPtPos");
+  TH2F* hDxNeg4profile = (TH2F*) generalList->FindObject("hTOFmatchedDxVsPtNeg");
     
-       char profilename[30];
-       const Int_t ybinMin = 0;
-       const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ;
-       sprintf(profilename,"profDxPos");
-       TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax); 
-       sprintf(profilename,"profDxNeg");
-       profDxPos->SetLineWidth(2);
-       TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax); 
-       profDxNeg->SetLineWidth(2);  
+  char profilename[30];
+  const Int_t ybinMin = 0;
+  const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ;
+  sprintf(profilename,"profDxPos");
+  TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax); 
+  sprintf(profilename,"profDxNeg");
+  profDxPos->SetLineWidth(2);
+  TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax); 
+  profDxNeg->SetLineWidth(2);  
  
-       TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone();
-       profRatioPosOverNegDx->SetName("profRatioPosOverNegDx");
-       profRatioPosOverNegDx->Divide((TH1*) profDxNeg);
-       profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.);
-       profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.);
-       if (displayAll){
-               TCanvas *residuals= new TCanvas("residuals","residuals",900,450);
-               residuals->Divide(2,1);
-               residuals->cd(1);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.);
-               hDxPos4profile->Draw("colz");
-               profDxPos->SetLineColor(kRed);
-               profDxPos ->Draw("same");
-               residuals->cd(2);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.); 
-               hDxNeg4profile->Draw("colz");
-               profDxNeg->SetLineColor(kBlue);
-               profDxNeg->Draw("same"); 
-       }
-
-       fout->cd();
-       hDxPos4profile->Write();
-       hDxNeg4profile->Write();
-       profDxPos->Write();
-       profDxNeg->Write();
-       profRatioPosOverNegDx->Write();
-       //-------------------------------------------------------------
-       /* T0 DETECTOR MONITOR*/
-
-       TH1F * hT0AC = (TH1F*) timeZeroList->At(0);
-       hT0AC->SetMarkerStyle(8);
-       hT0AC->SetMarkerSize(0.7);
-       hT0AC->SetMarkerColor(kRed);
-       hT0AC->SetLineColor(kRed);
-       hT0AC->SetFillColor(kRed);
-       hT0AC->SetFillStyle(1001);
-       hT0AC->Rebin(2);
-       hT0AC->GetYaxis()->SetTitle("events"); 
-       hT0AC->GetYaxis()->SetTitleOffset(1.35);
-       hT0AC->GetXaxis()->SetLabelSize(0.03);
+  TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone();
+  profRatioPosOverNegDx->SetName("profRatioPosOverNegDx");
+  profRatioPosOverNegDx->Divide((TH1*) profDxNeg);
+  profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.);
+  profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.);
+
+  TCanvas *cPidPerformance= new TCanvas("cResiduals","residuals",900,450);
+  cResiduals->Divide(2,1);
+  cResiduals->cd(1);
+  gPad->SetGridx();
+  gPad->SetGridy();
+  hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.);
+  hDxPos4profile->SetTitle(Form("%i: Dx for positive tracks",runNumber));
+  hDxPos4profile->Draw("colz");
+  profDxPos->SetLineColor(kRed);
+  profDxPos ->Draw("same");
+  cResiduals->cd(2);
+  gPad->SetGridx();
+  gPad->SetGridy();
+  hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.);
+  hDxNeg4profile->SetTitle(Form("%i: Dx for negative tracks",runNumber));
+  hDxNeg4profile->Draw("colz");
+  profDxNeg->SetLineColor(kBlue);
+  profDxNeg->Draw("same");
+  
+  fout->cd();
+  hDxPos4profile->Write();
+  hDxNeg4profile->Write();
+  profDxPos->Write();
+  profDxNeg->Write();
+  profRatioPosOverNegDx->Write();
+  //-------------------------------------------------------------
+  /* T0 DETECTOR MONITOR*/
+
+  TH1F * hT0AC = (TH1F*) timeZeroList->FindObject("hEventT0DetAND");
+  hT0AC->SetMarkerStyle(8);
+  hT0AC->SetMarkerSize(0.7);
+  hT0AC->SetMarkerColor(kRed);
+  hT0AC->SetLineColor(kRed);
+  hT0AC->SetFillColor(kRed);
+  hT0AC->SetFillStyle(1001);
+  hT0AC->Rebin(2);
+  hT0AC->GetYaxis()->SetTitle("events"); 
+  hT0AC->GetYaxis()->SetTitleOffset(1.35);
+  hT0AC->GetXaxis()->SetLabelSize(0.03);
  
-       TH1F * hT0A = (TH1F*) timeZeroList->At(1);
-       hT0A->SetMarkerStyle(8);
-       hT0A->SetMarkerSize(0.7);
-       hT0A->SetMarkerColor(kBlue);
-       hT0A->SetLineColor(kBlue);
-       hT0A->SetFillColor(kBlue);
-       hT0A->SetFillStyle(1001);
-       hT0A->Rebin(2);
-       hT0A->GetYaxis()->SetTitle("events"); 
-       hT0A->GetYaxis()->SetTitleOffset(1.35);
-       hT0A->GetXaxis()->SetLabelSize(0.03);
-
-       TH1F * hT0C = (TH1F*) timeZeroList->At(2);
-       hT0C->SetMarkerStyle(8);
-       hT0C->SetMarkerSize(0.7);
-       hT0C->SetMarkerColor(kGreen);
-       hT0C->SetLineColor(kGreen);
-       hT0C->SetFillColor(kGreen);
-       hT0C->SetFillStyle(1001);
-       hT0C->Rebin(2);
-       hT0C->GetYaxis()->SetTitle("events"); 
-       hT0C->GetYaxis()->SetTitleOffset(1.35);
-       hT0C->GetXaxis()->SetLabelSize(0.03);
+  TH1F * hT0A = (TH1F*) timeZeroList->FindObject("hEventT0DetA");
+  hT0A->SetMarkerStyle(8);
+  hT0A->SetMarkerSize(0.7);
+  hT0A->SetMarkerColor(kBlue);
+  hT0A->SetLineColor(kBlue);
+  hT0A->SetFillColor(kBlue);
+  hT0A->SetFillStyle(1001);
+  hT0A->Rebin(2);
+  hT0A->GetYaxis()->SetTitle("events"); 
+  hT0A->GetYaxis()->SetTitleOffset(1.35);
+  hT0A->GetXaxis()->SetLabelSize(0.03);
+
+  TH1F * hT0C = (TH1F*) timeZeroList->FindObject("hEventT0DetC");
+  hT0C->SetMarkerStyle(8);
+  hT0C->SetMarkerSize(0.7);
+  hT0C->SetMarkerColor(kGreen);
+  hT0C->SetLineColor(kGreen);
+  hT0C->SetFillColor(kGreen);
+  hT0C->SetFillStyle(1001);
+  hT0C->Rebin(2);
+  hT0C->GetYaxis()->SetTitle("events"); 
+  hT0C->GetYaxis()->SetTitleOffset(1.35);
+  hT0C->GetXaxis()->SetLabelSize(0.03);
  
-       TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC");
-       lT0->SetTextSize(0.041);
-       lT0->AddEntry(hT0AC, "T0 A&C","L");
-       lT0->AddEntry(hT0A, "T0 A","L"); 
-       lT0->AddEntry(hT0C, "T0 C","L");
-       lT0->SetFillColor(kWhite);
-       lT0->SetShadowColor(0);
-  
-       TH1F * hT0res = (TH1F*) timeZeroList->At(3);
-       hT0res->GetXaxis()->SetLabelSize(0.03);
-       if (displayAll){
-               TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450);
-               cT0detector->Divide(2,1);
-               cT0detector->cd(1);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hT0AC->Draw("BAR");
-               hT0AC->SetTitle("timeZero measured by T0 detector");
-               hT0A ->Draw("BARsame");
-               hT0C ->Draw("BARsame");
-               lT0->Draw();  
-               cT0detector->cd(2);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               // gPad->SetLogy();
-               hT0res->Draw();
-               // myText1->Draw(); 
-               // cTrackProperties->cd(3);
-               // gPad->SetLogy();
-               // hL->Draw("BAR");
-               // myText2->Draw(); 
-       }
-
-       TH1F * hT0fillRes = (TH1F*) timeZeroList->At(8);
-       hT0fillRes->GetXaxis()->SetLabelSize(0.03);
-
-       fout->cd();
-       hT0AC->Write();
-       hT0A->Write();
-       hT0C->Write();
-       hT0res->Write();
-       hT0fillRes->Write();
-       lT0->Write();
+  TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC");
+  lT0->SetTextSize(0.041);
+  lT0->AddEntry(hT0AC, "T0 A&C","L");
+  lT0->AddEntry(hT0A, "T0 A","L"); 
+  lT0->AddEntry(hT0C, "T0 C","L");
+  lT0->SetFillColor(kWhite);
+  lT0->SetShadowColor(0);
   
+  TH1F * hT0res = (TH1F*) timeZeroList->FindObject("hT0DetRes");
+  hT0res->GetXaxis()->SetLabelSize(0.03);
+  if (displayAll){
+    TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450);
+    cT0detector->Divide(2,1);
+    cT0detector->cd(1);
+    gPad->SetGridx();
+    gPad->SetGridy();
+    hT0AC->Draw("BAR");
+    hT0AC->SetTitle("timeZero measured by T0 detector");
+    hT0A ->Draw("BARsame");
+    hT0C ->Draw("BARsame");
+    lT0->Draw();  
+    cT0detector->cd(2);
+    gPad->SetGridx();
+    gPad->SetGridy();
+    // gPad->SetLogy();
+    hT0res->Draw();
+    // myText1->Draw(); 
+    // cTrackProperties->cd(3);
+    // gPad->SetLogy();
+    // hL->Draw("BAR");
+    // myText2->Draw(); 
+  }
 
-       //-------------------------------------------------------------
-       /*MATCHING EFFICIENCY  MONITOR*/
+  TH1F * hT0fillRes = (TH1F*) timeZeroList->FindObject("hT0fillRes");
+  hT0fillRes->GetXaxis()->SetLabelSize(0.03);
 
-       //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. );
-  
-       TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. );
+  fout->cd();
+  hT0AC->Write();
+  hT0A->Write();
+  hT0C->Write();
+  hT0res->Write();
+  hT0fillRes->Write();
+  lT0->Write();
   
-       TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.);
+
+  //-------------------------------------------------------------
+  /*#epsilon_{match}  MONITOR*/
+
+  //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. );
   
-       TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28);
+  TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching eff. vs p_{T}; p_{T}(GeV/c); #epsilon_{match}", 50, 0., 5. );
   
-       /*/matching as function of p
-         TH1F * hDenom=(TH1F*)generalList->At(9); 
-         if (hDenom) {  
-         hMatchingVsP=(TH1F*) generalList->At(5); 
-         hMatchingVsP->Rebin(5);
-         hDenom->Rebin(5);
-         hMatchingVsP->Divide(hDenom);
-         hMatchingVsP->GetYaxis()->SetTitle("matching efficiency");
-         hMatchingVsP->SetTitle("TOF matching efficiency as function of momentum");
-         }*/
+  TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching eff. vs #eta; #eta; #epsilon_{match}", 20, -1., 1.);
   
-       //matching as function of pT
+  TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching eff. vs #phi; #phi(rad); #epsilon_{match}", 628, 0., 6.28);
+
+  //matching as function of pT  
+  TH1F * hDenom=(TH1F*)generalList->FindObject("hESDprimaryTrackPt"); 
+  if (hDenom) {  
+    hMatchingVsPt=(TH1F*) generalList->FindObject("hTOFmatchedESDPt"); 
+    hMatchingVsPt->Rebin(5);
+    hDenom->Rebin(5);
+    hMatchingVsPt->Divide(hDenom);
+    hMatchingVsPt->GetYaxis()->SetTitle("#epsilon_{match}");
+    hMatchingVsPt->SetTitle(Form("%i: TOF #epsilon_{match} vs p_{T}", runNumber));
+    hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); 
+  }
   
-       // hDenom->Clear();
-       TH1F * hDenom=(TH1F*)generalList->At(10); 
-       if (hDenom) {  
-               hMatchingVsPt=(TH1F*) generalList->At(6); 
-               hMatchingVsPt->Rebin(5);
-               hDenom->Rebin(5);
-               hMatchingVsPt->Divide(hDenom);
-               hMatchingVsPt->GetYaxis()->SetTitle("matching efficiency");
-               hMatchingVsPt->SetTitle("TOF matching efficiency as function of transverse momentum");
-               hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); 
-       }
+  //matching as function of eta
+  hDenom->Clear();
+  hDenom=(TH1F*)generalList->FindObject("hTOFprimaryESDeta"); 
+  if (hDenom) {  
+    hMatchingVsEta=(TH1F*) generalList->FindObject("hTOFmatchedESDeta"); 
+    hMatchingVsEta->Rebin(5);
+    hDenom->Rebin(5);
+    hMatchingVsEta->Divide(hDenom);
+    hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1);
+    hMatchingVsEta->GetYaxis()->SetTitle("#epsilon_{match}");
+    hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2);
+    hMatchingVsEta->SetTitle(Form("%i: TOF #epsilon_{match} vs #eta", runNumber));
+  }
+  //matching as function of phi
+  hDenom->Clear();
+  hDenom=(TH1F*)generalList->FindObject("hTOFprimaryESDphi"); 
+  if (hDenom) {  
+    hMatchingVsPhi=(TH1F*) generalList->FindObject("hTOFmatchedESDphi"); 
+    //hMatchingVsPhi->Rebin(5);
+    //hDenom->Rebin(5);
+    hMatchingVsPhi->Divide(hDenom);
+    hMatchingVsPhi->GetYaxis()->SetTitle("#epsilon_{match}");
+    hMatchingVsPhi->SetTitle(Form("%i: TOF #epsilon_{match} vs #phi", runNumber));
+    hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2);
+  }
+
+  TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",1000,600);
+  cMatchingPerformance->Divide(2,2);
+  cMatchingPerformance->cd(1);
+  gPad->SetGridx();
+  gPad->SetGridy();
+  hMatchingVsPt->Draw();
+  cMatchingPerformance->cd(2);
+  gPad->SetGridx();
+  gPad->SetGridy();
+  hMatchingVsEta->Draw();
+  cMatchingPerformance->cd(3);
+  gPad->SetGridx();
+  gPad->SetGridy();
+  hMatchingVsPhi->Draw();
   
-       //matching as function of eta
-       hDenom->Clear();
-       hDenom=(TH1F*)generalList->At(11); 
-       if (hDenom) {  
-               hMatchingVsEta=(TH1F*) generalList->At(7); 
-               hMatchingVsEta->Rebin(5);
-               hDenom->Rebin(5);
-               hMatchingVsEta->Divide(hDenom);
-               hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1);
-               hMatchingVsEta->GetYaxis()->SetTitle("matching efficiency");
-               hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2);
-               hMatchingVsEta->SetTitle("TOF matching efficiency as function of pseudorapidity");
-       }
-       //matching as function of phi
-       hDenom->Clear();
-       hDenom=(TH1F*)generalList->At(12); 
-       if (hDenom) {  
-               hMatchingVsPhi=(TH1F*) generalList->At(8); 
-               //hMatchingVsPhi->Rebin(5);
-               //hDenom->Rebin(5);
-               hMatchingVsPhi->Divide(hDenom);
-               hMatchingVsPhi->GetYaxis()->SetTitle("matching efficiency");
-               hMatchingVsPhi->SetTitle("TOF matching efficiency as function of phi");
-               hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2);
-       }
-       if (  displayAll){
-               TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",700,400);
-               cMatchingPerformance->Divide(2,2);
-               cMatchingPerformance->cd(1);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hMatchingVsPt->Draw();
-               cMatchingPerformance->cd(2);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hMatchingVsEta->Draw();
-               cMatchingPerformance->cd(3);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               hMatchingVsPhi->Draw();
-       }
-       fout->cd();
-       hMatchingVsPt->Write();
-       hMatchingVsEta->Write();
-       hMatchingVsPhi->Write();
+  TH2F* hTOFmatchedDzVsStrip = (TH2F*) generalList->FindObject("hTOFmatchedDzVsStrip");        
   
-       //----------------------------------------------------
-       /* PID PERFORMANCE MONITOR */
-
-       TH2F * hBetaP=(TH2F*)pidList->At(0);
-       if (hBetaP) hBetaP->GetYaxis()->SetRangeUser(0.,1.2);
-       else Printf("Plot hBetaP not available (old aliroot?)");
-       TH1F * hMass=(TH1F*)pidList->At(1);
-       if (hMass){
-         //hMass->SetMarkerColor(kBlue);
-         //hMass->SetLineColor(kBlue);
-         hMass->SetFillColor(kAzure+10);
-         hMass->SetFillStyle(1001);
-         hMass->Rebin(2);
-         hMass->GetYaxis()->SetTitle("tracks"); 
-         hMass->GetYaxis()->SetTitleOffset(1.35);
-         hMass->GetXaxis()->SetLabelSize(0.03);
-       } else 
-         Printf("Plot hMass not available (old aliroot?)");
+  fout->cd();
+  if (hMatchingVsPt) hMatchingVsPt->Write();
+  if (hMatchingVsEta) hMatchingVsEta->Write();
+  if (hMatchingVsPhi) hMatchingVsPhi->Write();
+  if (hTOFmatchedDzVsStrip)hTOFmatchedDzVsStrip->Write();
+
+  //----------------------------------------------------
+  /* PID PERFORMANCE MONITOR */
+
+  TH2F * hBetaP=(TH2F*)pidList->FindObject("hTOFmatchedESDpVsBeta");
+  if (hBetaP) hBetaP->GetYaxis()->SetRangeUser(0.,1.2);
+  else Printf("Plot hBetaP not available (old aliroot?)");
+  TH1F * hMass=(TH1F*)pidList->FindObject("hTOFmatchedMass");
+  if (hMass){
+    //hMass->SetMarkerColor(kBlue);
+    //hMass->SetLineColor(kBlue);
+    hMass->SetFillColor(kAzure+10);
+    hMass->SetFillStyle(1001);
+    hMass->Rebin(2);
+    hMass->GetYaxis()->SetTitle("tracks"); 
+    hMass->GetYaxis()->SetTitleOffset(1.35);
+    hMass->GetXaxis()->SetLabelSize(0.03);
+  } else 
+    Printf("Plot hMass not available (old aliroot?)");
        
-       TH1F * hPionDiff=(TH1F*)pidList->At(3); 
-
-       TH2F * hDiffTimePi=(TH2F*)pidList->At(4); 
-       if (!hDiffTimePi) {
-         Printf("Plot hDiffTimePi not available (old aliroot?)");
-       } else {
-         hDiffTimePi->SetTitle("PIONS t-t_{exp,#pi} (from tracking) vs. P");
-         hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.);
-         //hDiffTimePi->GetYaxis()->Rebin(2);//1 bin=10 ps
-       }
+  TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePiVsEta"); 
+
+  TH2F * hDiffTimePi=(TH2F*)pidList->FindObject("hTOFmatchedExpTimePiVsP"); 
+  if (!hDiffTimePi) {
+    Printf("Plot hDiffTimePi not available (old aliroot?)");
+  } else {
+    hDiffTimePi->SetTitle(Form("%i: PION t-t_{exp,#pi}",runNumber));
+    hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.);
+    //hDiffTimePi->GetYaxis()->Rebin(2);//1 bin=10 ps
+  }
        
-       TH2F * hDiffTimePiTh=(TH2F*)pidList->At(6); 
-       if (!hDiffTimePiTh) {
-         Printf("Plot hDiffTimePiTh not available (old aliroot?)");
-       } else {
-         hDiffTimePiTh->SetTitle("PIONS t-t_{exp,#pi} (theoretical) vs. P");
-         hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.); 
-         //hDiffTimePiTh->GetYaxis()->Rebin(2);//1 bin=10 ps
-       }
-
-       TH2F * hDiffTimeKa=(TH2F*)pidList->At(9); 
-       if (!hDiffTimeKa) {
-         Printf("Plot hDiffTimeKa not available (old aliroot?)");
-       } else {
-         hDiffTimeKa->SetTitle("KAONS t-t_{exp,K} (from tracking) vs. P");
-         hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.);
-         //hDiffTimeKa->GetYaxis()->Rebin(2);//1 bin=10 ps
-       }
-
-       TH2F * hDiffTimeKaTh=(TH2F*)pidList->At(11); 
-       if (!hDiffTimeKaTh) {
-         Printf("Plot hDiffTimeKaTh not available (old aliroot?)");
-       } else {
-         hDiffTimeKaTh->SetTitle("KAONS t-t_{exp,K} (theoretical) vs. P");
-         hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.);
-         //hDiffTimeKaTh->GetYaxis()->Rebin(2);//1 bin=10 ps
-       }
-
-       TH2F * hDiffTimePro=(TH2F*)pidList->At(14); 
-       if (!hDiffTimePro) {
-         Printf("Plot hDiffTimePro not available (old aliroot?)");
-       } else {
-         hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (from tracking) vs. P");
-         hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.);
-         //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
-       }
+  TH2F * hDiffTimePiTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimePiVsP"); 
+  if (!hDiffTimePiTh) {
+    Printf("Plot hDiffTimePiTh not available (old aliroot?)");
+  } else {
+    hDiffTimePiTh->SetTitle(Form("%i: PION t-t_{exp,#pi} (theoretical)",runNumber));
+    hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.);
+    //hDiffTimePiTh->GetYaxis()->Rebin(2);//1 bin=10 ps
+  }
+
+  TH2F * hDiffTimeKa=(TH2F*)pidList->FindObject("hTOFmatchedExpTimeKaVsP"); 
+  if (!hDiffTimeKa) {
+    Printf("Plot hDiffTimeKa not available (old aliroot?)");
+  } else {
+    hDiffTimeKa->SetTitle(Form("%i: KAON t-t_{exp,K}",runNumber));
+    hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.);
+    //hDiffTimeKa->GetYaxis()->Rebin(2);//1 bin=10 ps
+  }
+
+  TH2F * hDiffTimeKaTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimeKaVsP"); 
+  if (!hDiffTimeKaTh) {
+    Printf("Plot hDiffTimeKaTh not available (old aliroot?)");
+  } else {
+    hDiffTimeKaTh->SetTitle(Form("%i: KAON t-t_{exp,K} (theoretical)",runNumber));
+    hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.);
+    //hDiffTimeKaTh->GetYaxis()->Rebin(2);//1 bin=10 ps
+  }
+
+  TH2F * hDiffTimePro=(TH2F*)pidList->FindObject("hTOFmatchedExpTimeProVsP"); 
+  if (!hDiffTimePro) {
+    Printf("Plot hDiffTimePro not available (old aliroot?)");
+  } else {
+    hDiffTimePro->SetTitle(Form("%i: PROTON t-t_{exp,p}",runNumber));
+    hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.);
+    //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
+  }
        
-       TH2F * hDiffTimeProTh=(TH2F*)pidList->At(16); 
-       if (!hDiffTimeProTh) {
-         Printf("Plot hDiffTimeProTh not available (old aliroot?)");
-       } else {
-         hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (theoretical) vs. P");
-         hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.);
-         //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
-       }
-
-       if (displayAll){
-               TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800);
-               cPidPerformance->Divide(2,1);
-               cPidPerformance->cd(1);
-               gPad->SetGridy();
-               gPad->SetGridx();
-               gPad->SetLogz();
-               if (hBetaP) hBetaP->Draw("colz"); 
+  TH2F * hDiffTimeProTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimeProVsP"); 
+  if (!hDiffTimeProTh) {
+    Printf("Plot hDiffTimeProTh not available (old aliroot?)");
+  } else {
+    hDiffTimeProTh->SetTitle(Form("%i: PROTON t-t_{exp,p} (theoretical)",runNumber));
+    hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.);
+    //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
+  }
+
+
+  TCanvas *cPidPerformance =0x0;
+  TCanvas *cPidPerformance2 = 0x0;
+  TCanvas *cPidPerformanceTh = 0x0;
+  if (displayAll){
+    cPidPerformance = new TCanvas("cPidPerformance","summary of pid performance",800,800);
+    cPidPerformance->Divide(2,1);
+    cPidPerformance->cd(1);
+    gPad->SetGridy();
+    gPad->SetGridx();
+    gPad->SetLogz();
+    if (hBetaP) hBetaP->Draw("colz"); 
   
-               cPidPerformance->cd(2);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               gPad->SetLogy();
-               if (hMass) hMass->Draw("HIST BAR");
+    cPidPerformance->cd(2);
+    gPad->SetGridx();
+    gPad->SetGridy();
+    gPad->SetLogy();
+    if (hMass) hMass->Draw("HIST BAR");
   
-               gStyle->SetOptStat(10);
-               TCanvas *cPidPerformance2= new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700);
-               cPidPerformance2->Divide(2,2);
-               cPidPerformance2->cd(1);
-               gPad->SetLogz();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hDiffTimePi) hDiffTimePi->Draw("colz");
-               cPidPerformance2->cd(2);
-               gPad->SetLogz();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hDiffTimeKa) hDiffTimeKa->Draw("colz");
-               cPidPerformance2->cd(3);
-               gPad->SetLogz();
-               if (hDiffTimePro) hDiffTimePro->Draw("colz");
-
-               TCanvas *cPidPerformanceTh= new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700);
-               cPidPerformanceTh->Divide(2,2);
-               cPidPerformanceTh->cd(1);
-               gPad->SetLogz();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hDiffTimePiTh) hDiffTimePiTh->Draw("colz");
-               cPidPerformanceTh->cd(2);
-               gPad->SetLogz();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hDiffTimeKaTh) hDiffTimeKaTh->Draw("colz");
-               cPidPerformanceTh->cd(3);
-               gPad->SetLogz();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hDiffTimeProTh) hDiffTimeProTh->Draw("colz");
-       }
+    cPidPerformance2 = new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700);
+    gStyle->SetOptStat(10);
+    cPidPerformance2->Divide(2,2);
+    cPidPerformance2->cd(1);
+    gPad->SetLogz();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    if (hDiffTimePi) hDiffTimePi->Draw("colz");
+    cPidPerformance2->cd(2);
+    gPad->SetLogz();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    if (hDiffTimeKa) hDiffTimeKa->Draw("colz");
+    cPidPerformance2->cd(3);
+    gPad->SetLogz();
+    if (hDiffTimePro) hDiffTimePro->Draw("colz");
+
+    cPidPerformanceTh = new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700);
+    cPidPerformanceTh->Divide(2,2);
+    cPidPerformanceTh->cd(1);
+    gPad->SetLogz();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    if (hDiffTimePiTh) hDiffTimePiTh->Draw("colz");
+    cPidPerformanceTh->cd(2);
+    gPad->SetLogz();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    if (hDiffTimeKaTh) hDiffTimeKaTh->Draw("colz");
+    cPidPerformanceTh->cd(3);
+    gPad->SetLogz();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    if (hDiffTimeProTh) hDiffTimeProTh->Draw("colz");
+  }
   
-       TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi"); 
-       TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa"); 
-       TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro");
-       TH2F * hDiffTimeT0TOFPion1GeV=(TH2F*)pidList->FindObject("hTOFmatchedTimePion1GeV"); 
-
-       fout->cd();
-       if (hPionDiff) hPionDiff->Write();
-       if (hKaonDiff) hKaonDiff->Write();
-       if (hProtonDiff) hProtonDiff->Write();
-       if (hBetaP) hBetaP->Write();
-       if (hMass) hMass->Write();
-       if (hDiffTimeT0TOFPion1GeV) hDiffTimeT0TOFPion1GeV->Write();
-       if (hDiffTimePi) hDiffTimePi->Write();
-       if (hDiffTimeKa) hDiffTimeKa->Write();
-       if (hDiffTimePro) hDiffTimePro->Write();
-       if (hDiffTimePiTh) hDiffTimePiTh->Write();
-       if (hDiffTimeKaTh) hDiffTimeKaTh->Write();
-       if (hDiffTimeProTh) hDiffTimeProTh->Write();
-
-       //SIGMAS PID
-       TH2F * hSigmaPi=(TH2F*)pidList->At(7); 
-       TProfile * profSigmaPi = 0x0;
-       if (!hSigmaPi){
-         Printf("Plot hSigmaPi not available (old aliroot?)");
-       } else {
-         sprintf(profilename,"profSigmaPi");
-         hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.);
-         hSigmaPi->GetXaxis()->SetRangeUser(0.2,10.);  
-         profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename); 
-         profSigmaPi->SetLineWidth(2);
-         profSigmaPi->SetLineColor(kRed+2); 
-       }
-
-       TH2F * hSigmaKa=(TH2F*)pidList->At(12); 
-       TProfile * profSigmaKa = 0x0;
-       if (!hSigmaKa){
-         Printf("Plot hSigmaKa not available (old aliroot?)");
-       } else {
-         sprintf(profilename,"profSigmaKa");
-         hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.);
-         hSigmaKa->GetXaxis()->SetRangeUser(0.2,10.);
-         profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename); 
-         profSigmaKa->SetLineWidth(2);
-         profSigmaKa->SetLineColor(kBlue);  
-       }
+  TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi"); 
+  TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa"); 
+  TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro");
+  TH2F * hDiffTimeT0TOFPion1GeV=(TH2F*)pidList->FindObject("hTOFmatchedTimePion1GeV"); 
+
+  fout->cd();
+  if (hPionDiff) hPionDiff->Write();
+  if (hKaonDiff) hKaonDiff->Write();
+  if (hProtonDiff) hProtonDiff->Write();
+  if (hBetaP) hBetaP->Write();
+  if (hMass) hMass->Write();
+  if (hDiffTimeT0TOFPion1GeV) hDiffTimeT0TOFPion1GeV->Write();
+  if (hDiffTimePi) hDiffTimePi->Write();
+  if (hDiffTimeKa) hDiffTimeKa->Write();
+  if (hDiffTimePro) hDiffTimePro->Write();
+  if (hDiffTimePiTh) hDiffTimePiTh->Write();
+  if (hDiffTimeKaTh) hDiffTimeKaTh->Write();
+  if (hDiffTimeProTh) hDiffTimeProTh->Write();
+
+  //SIGMAS PID
+  TH2F * hSigmaPi=(TH2F*)pidList->FindObject("hTOFExpSigmaPi"); 
+  hSigmaPi->SetTitle(Form("%i: n#sigma_{TOF} pion vs p",runNumber));
+  //TProfile * profSigmaPi = 0x0;
+  if (!hSigmaPi){
+    Printf("Plot hSigmaPi not available (old aliroot?)");
+  } else {
+    hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.);
+    hSigmaPi->GetXaxis()->SetRangeUser(0.2,10.);       
+    //sprintf(profilename,"profSigmaPi");
+    //profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename);
+    //profSigmaPi->SetLineWidth(2);
+    //profSigmaPi->SetLineColor(kRed+2);
+    hSigmaPi->FitSlicesY();
+    TH1D * hSigmaPi_1 = (TH1D*)gDirectory->Get("hTOFExpSigmaPi_1");
+    TH1D * hSigmaPi_2 = (TH1D*)gDirectory->Get("hTOFExpSigmaPi_2");
+    hSigmaPi_1->SetLineColor(1);
+    hSigmaPi_1->SetLineWidth(2);
+    hSigmaPi_2->SetLineColor(2);
+    hSigmaPi_2->SetLineWidth(2);
+  }
+
+  TH2F * hSigmaKa=(TH2F*)pidList->FindObject("hTOFExpSigmaKa"); 
+  hSigmaKa->SetTitle(Form("%i: n#sigma_{TOF} kaon vs p",runNumber));
+    //TProfile * profSigmaKa = 0x0;
+  if (!hSigmaKa){
+    Printf("Plot hSigmaKa not available (old aliroot?)");
+  } else {
+    hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.);
+    hSigmaKa->GetXaxis()->SetRangeUser(0.2,10.);
+    //sprintf(profilename,"profSigmaKa");
+    //profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename);
+    //profSigmaKa->SetLineWidth(2);
+    //profSigmaKa->SetLineColor(kBlue);
+    hSigmaKa->FitSlicesY();
+    TH1D * hSigmaKa_1 = (TH1D*)gDirectory->Get("hTOFExpSigmaKa_1");
+    TH1D * hSigmaKa_2 = (TH1D*)gDirectory->Get("hTOFExpSigmaKa_2");
+    hSigmaKa_1->SetLineColor(1);
+    hSigmaKa_1->SetLineWidth(2);
+    hSigmaKa_2->SetLineColor(2);
+    hSigmaKa_2->SetLineWidth(2);
+  }
  
-       TH2F * hSigmaPro=(TH2F*)pidList->At(17); 
-       TProfile * profSigmaPro = 0x0;
-       if (!hSigmaPro){
-         Printf("Plot hSigmaPro not available (old aliroot?)");
-       } else {
-         sprintf(profilename,"profSigmaPro");
-         hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.);
-         hSigmaPro->GetXaxis()->SetRangeUser(0.2,10.);
-         profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename); 
-         profSigmaPro->SetLineWidth(2);
-         profSigmaPro->SetLineColor(kGreen+2);  
-       }
-
-       if(includeStartTime){                                                                  
-         if(pidQAdir){
-         TH2F * hSigmaPiT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_pion"); 
-         hSigmaPiT0->GetYaxis()->SetRangeUser(-5.,5.);
-         hSigmaPiT0->GetXaxis()->SetRangeUser(0.2,10.);
-         hSigmaPiT0->FitSlicesY();
-         TH1D * hSigmaPiT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_1");
-         TH1D * hSigmaPiT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_2");
-         hSigmaPiT0_1->SetLineColor(1);
-         hSigmaPiT0_1->SetLineWidth(2);
-         hSigmaPiT0_2->SetLineColor(2);
-         hSigmaPiT0_2->SetLineWidth(2);  
-
-         TH2F * hSigmaKaT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_kaon"); 
-         hSigmaKaT0->GetYaxis()->SetRangeUser(-5.,5.);
-         hSigmaKaT0->GetXaxis()->SetRangeUser(0.2,10.);
-         hSigmaKaT0->FitSlicesY();
-         TH1D * hSigmaKaT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_1");
-         TH1D * hSigmaKaT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_2");
-         hSigmaKaT0_1->SetLineColor(1);
-         hSigmaKaT0_1->SetLineWidth(2);
-         hSigmaKaT0_2->SetLineColor(2);
-         hSigmaKaT0_2->SetLineWidth(2); 
+  TH2F * hSigmaPro=(TH2F*)pidList->FindObject("hTOFExpSigmaPro"); 
+  hSigmaPro->SetTitle(Form("%i: n#sigma_{TOF} proton vs p",runNumber));
+  //TProfile * profSigmaPro = 0x0;
+  if (!hSigmaPro){
+    Printf("Plot hSigmaPro not available (old aliroot?)");
+  } else {
+    hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.);
+    hSigmaPro->GetXaxis()->SetRangeUser(0.2,10.);
+    //  sprintf(profilename,"profSigmaPro");
+    //profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename);
+    //profSigmaPro->SetLineWidth(2);
+    //profSigmaPro->SetLineColor(kGreen+2);
+    hSigmaPro->FitSlicesY();
+    TH1D * hSigmaPro_1 = (TH1D*)gDirectory->Get("hTOFExpSigmaPro_1");
+    TH1D * hSigmaPro_2 = (TH1D*)gDirectory->Get("hTOFExpSigmaPro_2");
+    hSigmaPro_1->SetLineColor(1);
+    hSigmaPro_1->SetLineWidth(2);
+    hSigmaPro_2->SetLineColor(2);
+    hSigmaPro_2->SetLineWidth(2);
+  }
+
+  if(includeStartTime && pidQAdir){
+    TH2F * hSigmaPiT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_pion");
+    hSigmaPiT0->SetTitle(Form("%i: n#sigma_{TOF} pion vs p, with start time",runNumber));
+    hSigmaPiT0->GetYaxis()->SetRangeUser(-5.,5.);
+    hSigmaPiT0->GetXaxis()->SetRangeUser(0.2,10.);
+    hSigmaPiT0->FitSlicesY();
+    TH1D * hSigmaPiT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_1");
+    TH1D * hSigmaPiT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_2");
+    hSigmaPiT0_1->SetLineColor(1);
+    hSigmaPiT0_1->SetLineWidth(2);
+    hSigmaPiT0_2->SetLineColor(2);
+    hSigmaPiT0_2->SetLineWidth(2);  
+
+    TH2F * hSigmaKaT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_kaon");
+    hSigmaKaT0->SetTitle(Form("%i: n#sigma_{TOF} kaon vs p, with start time",runNumber));
+    hSigmaKaT0->GetYaxis()->SetRangeUser(-5.,5.);
+    hSigmaKaT0->GetXaxis()->SetRangeUser(0.2,10.);
+    hSigmaKaT0->FitSlicesY();
+    TH1D * hSigmaKaT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_1");
+    TH1D * hSigmaKaT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_2");
+    hSigmaKaT0_1->SetLineColor(1);
+    hSigmaKaT0_1->SetLineWidth(2);
+    hSigmaKaT0_2->SetLineColor(2);
+    hSigmaKaT0_2->SetLineWidth(2); 
  
-         TH2F * hSigmaProT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_proton"); 
-         hSigmaProT0->GetYaxis()->SetRangeUser(-5.,5.);
-         hSigmaProT0->GetXaxis()->SetRangeUser(0.2,10.);
-         hSigmaProT0->FitSlicesY();
-         TH1D * hSigmaProT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_1");
-         TH1D * hSigmaProT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_2");
-         hSigmaProT0_1->SetLineColor(1);
-         hSigmaProT0_1->SetLineWidth(2);
-         hSigmaProT0_2->SetLineColor(2);
-         hSigmaProT0_2->SetLineWidth(2);
-         } 
-       }
-       if (displayAll){
-         
-               TLegend * lSigmaPid=new TLegend(0.75,0.75,0.95,0.95,"#sigma_{PID}");
-               lSigmaPid->AddEntry(profSigmaPi,"#pi^{#pm}","l");
-               lSigmaPid->AddEntry(profSigmaKa,"K^{#pm}","l");
-               lSigmaPid->AddEntry(profSigmaPro,"p^{#pm}","l");
+    TH2F * hSigmaProT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_proton");
+    hSigmaProT0->SetTitle(Form("%i: n#sigma_{TOF} proton vs p, with start time",runNumber));
+    hSigmaProT0->GetYaxis()->SetRangeUser(-5.,5.);
+    hSigmaProT0->GetXaxis()->SetRangeUser(0.2,10.);
+    hSigmaProT0->FitSlicesY();
+    TH1D * hSigmaProT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_1");
+    TH1D * hSigmaProT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_2");
+    hSigmaProT0_1->SetLineColor(1);
+    hSigmaProT0_1->SetLineWidth(2);
+    hSigmaProT0_2->SetLineColor(2);
+    hSigmaProT0_2->SetLineWidth(2);
+  } 
+       
          
-               TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400);
-               cPidPerformance3->Divide(3,1);
-               cPidPerformance3->cd(1);
-               gPad->SetLogz();
-               gPad->SetLogx();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hSigmaPi){
-                 hSigmaPi->Draw("colz");
-                 profSigmaPi->Draw("same");
-               }
-               cPidPerformance3->cd(2);
-               gPad->SetLogz();
-               gPad->SetLogx();
-               gPad->SetGridx();
-               gPad->SetGridy();
-               if (hSigmaKa){
-                 hSigmaKa->Draw("colz");
-                 profSigmaKa->Draw("same");
-               }
-               cPidPerformance3->cd(3);
-               gPad->SetGridx();
-               gPad->SetGridy();
-               gPad->SetLogz();
-               gPad->SetLogx();
-               if (hSigmaPro){
-                 hSigmaPro->Draw("colz");
-                 profSigmaPro->Draw("same");
-               }
-
-               if(includeStartTime){  
-                 if(pidQAdir){   
-                   TLine *l1=new TLine(0.,0.,5.,0.);
-                   TLine *l2=new TLine(0.,1.,5.,1.); 
-                   TCanvas *cPidPerformance3T0 = new TCanvas("cPidPerformance3T0","summary of pid performance - sigmas - with StartTime",1200,500);  
-                   cPidPerformance3T0->Divide(3,1);
-                   cPidPerformance3T0->cd(1);        
-                   gPad->SetLogz();
-                   gPad->SetLogx();
-                   gPad->SetGridx();
-                   gPad->SetGridy();
-                   hSigmaPiT0->Draw("colz");    
-                   hSigmaPiT0_1->Draw("same");
-                   hSigmaPiT0_2->Draw("same");
-                   l1->Draw("same");
-                   l2->Draw("same");
-                   cPidPerformance3T0->cd(2);
-                   gPad->SetLogz();
-                   gPad->SetLogx();
-                   gPad->SetGridx();
-                   gPad->SetGridy();
-                   hSigmaKaT0->Draw("colz");
-                   hSigmaKaT0_1->Draw("same");
-                   hSigmaKaT0_2->Draw("same");
-                   l1->Draw("same");
-                   l2->Draw("same");
-                   cPidPerformance3T0->cd(3);  
-                   gPad->SetLogz();
-                   gPad->SetLogx();
-                   gPad->SetGridx();
-                   gPad->SetGridy();
-                   hSigmaProT0->Draw("colz");
-                   hSigmaProT0_1->Draw("same");
-                   hSigmaProT0_2->Draw("same");
-                   l1->Draw("same");
-                   l2->Draw("same");                      
-               }
-       }
-       }
-
-       fout->cd();
-       if (hSigmaPi){
-         hSigmaPi->Write();
-         profSigmaPi->Write();
-       }
-       if (hSigmaKa){ 
-         hSigmaKa->Write();
-         profSigmaKa->Write();
-       }
-       if (hSigmaPro){
-         hSigmaPro->Write();
-         profSigmaPro->Write();
-       }
-       if(includeStartTime)
-         {
-           if(pidQAdir){
-             hSigmaPiT0->Write();
-             hSigmaKaT0->Write();
-             hSigmaProT0->Write();
+  TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400);
+  cPidPerformance3->Divide(3,1);
+  cPidPerformance3->cd(1);
+  gPad->SetLogz();
+  gPad->SetLogx();
+  gPad->SetGridx();
+  gPad->SetGridy();
+  if (hSigmaPi){
+    hSigmaPi->Draw("colz");
+    hSigmaPi_1->Draw("same");
+    hSigmaPi_2->Draw("same");
+    //profSigmaPi->Draw("same");
+  }
+  cPidPerformance3->cd(2);
+  gPad->SetLogz();
+  gPad->SetLogx();
+  gPad->SetGridx();
+  gPad->SetGridy();
+  if (hSigmaKa){
+    hSigmaKa->Draw("colz");
+    hSigmaKa_1->Draw("same");
+    hSigmaKa_2->Draw("same");
+    //profSigmaKa->Draw("same");
+  }
+  cPidPerformance3->cd(3);
+  gPad->SetGridx();
+  gPad->SetGridy();
+  gPad->SetLogz();
+  gPad->SetLogx();
+  if (hSigmaPro){
+    hSigmaPro->Draw("colz");
+    hSigmaPro_1->Draw("same");
+    hSigmaPro_2->Draw("same");
+    //profSigmaPro->Draw("same");
+  }
+
+  if(includeStartTime && pidQAdir){   
+    TLine *l1=new TLine(0.,0.,5.,0.);
+    TLine *l2=new TLine(0.,1.,5.,1.); 
+    TCanvas *cPidPerformance3T0 = new TCanvas("cPidPerformance3T0","summary of pid performance - sigmas - with StartTime",1200,500);  
+    cPidPerformance3T0->Divide(3,1);
+    cPidPerformance3T0->cd(1);        
+    gPad->SetLogz();
+    gPad->SetLogx();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    hSigmaPiT0->Draw("colz");    
+    hSigmaPiT0_1->Draw("same");
+    hSigmaPiT0_2->Draw("same");
+    l1->Draw("same");
+    l2->Draw("same");
+    cPidPerformance3T0->cd(2);
+    gPad->SetLogz();
+    gPad->SetLogx();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    hSigmaKaT0->Draw("colz");
+    hSigmaKaT0_1->Draw("same");
+    hSigmaKaT0_2->Draw("same");
+    l1->Draw("same");
+    l2->Draw("same");
+    cPidPerformance3T0->cd(3);  
+    gPad->SetLogz();
+    gPad->SetLogx();
+    gPad->SetGridx();
+    gPad->SetGridy();
+    hSigmaProT0->Draw("colz");
+    hSigmaProT0_1->Draw("same");
+    hSigmaProT0_2->Draw("same");
+    l1->Draw("same");
+    l2->Draw("same");                     
+  }
+
+  if (hSigmaPi){
+    hSigmaPi->Write();
+    hSigmaPi_1->Write();
+    hSigmaPi_2->Write();
+    //    profSigmaPi->Write();
+  }
+  if (hSigmaKa){ 
+    hSigmaKa->Write();
+    hSigmaKa_1->Write();
+    hSigmaKa_2->Write();
+//    profSigmaKa->Write();
+  }
+  if (hSigmaPro){
+    hSigmaPro->Write();
+    hSigmaPro_1->Write();
+    hSigmaPro_2->Write();
+//    profSigmaPro->Write();
+  }
+  if(includeStartTime && pidQAdir){
+    hSigmaPiT0->Write();
+    hSigmaKaT0->Write();
+    hSigmaProT0->Write();
       
-             hSigmaPiT0_1->Write();
-             hSigmaKaT0_1->Write();
-             hSigmaProT0_1->Write();
-
-             hSigmaPiT0_2->Write();
-             hSigmaKaT0_2->Write();
-             hSigmaProT0_2->Write();
-           }
-         }
-       TH2F* hTOFmatchedDzVsStrip = (TH2F*)generalList->FindObject("hTOFmatchedDzVsStrip");
-       
-       if (displayAll){
-         TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50,750,550);
-               gStyle->SetOptStat(0);
-               hTOFmatchedDzVsStrip->Draw("colz");
-               Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3);
-               Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3);
-               TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax);
-               hDzProfile->SetLineWidth(3);
-               hDzProfile->Draw("same");
-               cProfile->SetGridx();
-               cProfile->SetGridy();
-               TString plotDir(Form("Plots_run%d",runNumber));
-               gSystem->Exec(Form("mkdir %s",plotDir.Data()));
-               cPidPerformance3->Print(Form("%s/PID_sigmas.png",plotDir.Data()));
-               if(includeStartTime){
-                 if(pidQAdir)
-                   cPidPerformance3T0->Print(Form("%s/%i_PID_sigmaStartTime.png", plotDir.Data()));  
-               }
-               cPidPerformance->Print(Form("%s/PID.png",plotDir.Data()));
-               cPidPerformanceTh->Print(Form("%s/PID_theoreticalTimes.png",plotDir.Data()));
-               cPidPerformance2->Print(Form("%s/PID_ExpTimes.png",plotDir.Data()));
-               cMatchingPerformance->Print(Form("%s/Matching.png",plotDir.Data()));
-               cT0detector->Print(Form("%s/T0Detector.png",plotDir.Data()));
-               cTrackProperties->Print(Form("%s/TrackProperties.png",plotDir.Data()));
-               residuals->Print(Form("%s/Residuals.png",plotDir.Data()));
-               cProfile->Print(Form("%s/ProfileDZvsStripNumber.png",plotDir.Data()));
-       }
-       fout->cd();
-       hTOFmatchedDzVsStrip->Write();
-       fout->Close();
-       fin->Close();
-       return 0;
+    hSigmaPiT0_1->Write();
+    hSigmaKaT0_1->Write();
+    hSigmaProT0_1->Write();
+
+    hSigmaPiT0_2->Write();
+    hSigmaKaT0_2->Write();
+    hSigmaProT0_2->Write();
+  }
+    
+  TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50,750,550);
+  gStyle->SetOptStat(0);
+  hTOFmatchedDzVsStrip->SetTitle(Form("%i: Dz vs strip (#eta)",runNumber));
+  hTOFmatchedDzVsStrip->Draw("colz");
+  Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3);
+  Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3);
+  TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax);
+  hDzProfile->SetLineWidth(3);
+  hDzProfile->Draw("same");
+  cProfile->SetGridx();
+  cProfile->SetGridy();
+    
+  //Save png files
+  TString plotDir(Form("Plots_run%d",runNumber));
+  gSystem->Exec(Form("mkdir %s",plotDir.Data()));
+  cMatchingPerformance->Print(Form("%s/Matching.png",plotDir.Data()));
+  cResiduals->Print(Form("%s/Residuals.png",plotDir.Data()));
+  cProfile->Print(Form("%s/ProfileDZvsStripNumber.png",plotDir.Data()));
+  cPidPerformance3->Print(Form("%s/PID_sigmas.png",plotDir.Data()));
+  if(includeStartTime && pidQAdir)
+    cPidPerformance3T0->Print(Form("%s/%i_PID_sigmaStartTime.png", plotDir.Data()));
+  if (displayAll) {
+    cPidPerformance->Print(Form("%s/PID.png",plotDir.Data()));
+    cPidPerformance2->Print(Form("%s/PID_ExpTimes.png",plotDir.Data()));
+    cPidPerformanceTh->Print(Form("%s/PID_theoreticalTimes.png",plotDir.Data()));
+    cT0detector->Print(Form("%s/T0Detector.png",plotDir.Data()));
+    cTrackProperties->Print(Form("%s/TrackProperties.png",plotDir.Data()));
+  }
+  fout->cd();
+  fout->Close();
+  fin->Close();
+  return 0;
 }
 
 //----------------------------------------------------------
 char * SetQAtrainOutputName(Int_t run=0,Int_t year=2011,char *period="LHC11a", char* pass="cpass1",Int_t trainId=76){
   
-       char infile[200];
-       sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId);
-       return infile;
+  char infile[200];
+  sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId);
+  return infile;
   
 }
 
index 30e429c078addde2de33826192af8fc4a6f399ca..2b2b1700dc41ee4193aba41758a4b9ed4252a2e5 100644 (file)
@@ -1,18 +1,16 @@
-void AliBarrelRec_TPCparam(Int_t firstEvent=0,Int_t lastEvent=0) {
-  //
-  // Macro to create AliESDs.root using parametrized TPC tracking
-  // and AliITStrackerSA (MI + SA)
-  //
-  // Input files:
-  // - galice.root
-  // - Kinematics.root
-  // - TrackReferences.root
-  // - ITS.RecPoints.root (use AliRecontruction class)
-  // - ITS.Vertex.root (use $ALICE_ROOT/ITS/AliITSVertexerZTest.C)
-  //
-  // A. Dainese - INFN Legnaro
-  //
+/// \file AliBarrelRec_TPCparam.C
+/// \brief Macro to create AliESDs.root using parametrized TPC tracking and AliITStrackerSA (MI + SA)
+/// 
+/// Input files:
+/// - galice.root
+/// - Kinematics.root
+/// - TrackReferences.root
+/// - ITS.RecPoints.root (use AliRecontruction class)
+/// - ITS.Vertex.root (use $ALICE_ROOT/ITS/AliITSVertexerZTest.C)
+/// 
+/// \author A. Dainese - INFN Legnaro
 
+void AliBarrelRec_TPCparam(Int_t firstEvent=0,Int_t lastEvent=0) {
 
   Int_t  collcode = 1; // pp collisions
   Bool_t useMeanVtx = kFALSE;
index 8dc9373ed94536f88e8370819a1b228d069860bf..a4b670df2155b77f2aa2b7e946d9f3e4bfa83eaa 100644 (file)
@@ -1,24 +1,20 @@
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// This is a macro which measures the time delay of L1 trigger in TPC      //
-//                                                                         //
-// It reads the ESD tracks and fills histograms with the distance          //
-// between the primary vertex and the Z position                           //
-// of the point of closest approach between the track and the beam axis.   //
-// The processing of forward and backward tracks is done separately.       //
-// The corresponding histograms are fitted with gaussian and the           //
-// shifts of the Z positions are extracted.                                //
-// The L1 time delay is taken as an average of the forward and backward    //
-// (with opposite sign) shifts divided by the drift velocity.              //
-// We assume that the ESD tracks are obtained by the TPC tracking stand    //
-// alone.                                                                  //
-// The propagation to the vertex can be done either with or without        //
-// TGeoManager.                                                            //
-//                                                                         //
-// Cvetan.Cheshkov@cern.ch                                                 //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
+/// \file AliL1Delay.C
+/// \brief Macro that measures the time delay of L1 trigger in TPC
+/// 
+/// It reads the ESD tracks and fills histograms with the distance
+/// between the primary vertex and the Z position
+/// of the point of closest approach between the track and the beam axis.
+/// The processing of forward and backward tracks is done separately.
+/// The corresponding histograms are fitted with gaussian and the
+/// shifts of the Z positions are extracted.
+/// The L1 time delay is taken as an average of the forward and backward
+/// (with opposite sign) shifts divided by the drift velocity.
+/// We assume that the ESD tracks are obtained by the TPC tracking stand
+/// alone.
+/// The propagation to the vertex can be done either with or without
+/// TGeoManager.
+/// 
+/// \author Cvetan Cheshkov <Cvetan.Cheshkov@cern.ch>
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
   #include <TMath.h>
index d14b2c830c2055b804fbd1d01b74aebcd4067128..a33691b8eb62f4435114ddcec4d76df37625dc24 100644 (file)
@@ -8,20 +8,24 @@
 #include "AliTPCBuffer160.h"
 #endif
 
+/// \file AliTPCAltro.C
+
 int AliTPCAltro(Int_t eth=0){
-  //eth is a threshold.
-  //Digits stored into a file have an amplitude value greater than "eth"
-  Int_t offset=1; //this should be equal to the threshold
+
+  /// eth is a threshold.
+  /// Digits stored into a file have an amplitude value greater than "eth"
+
+  Int_t offset=1; ///< this should be equal to the threshold
   /*
     NB the amplitude values stored in the ALTRO file are shifted  by offset 
     because the range for each word goes from 0 to 1023, now due to zero suppression 
     values lower that the threshold never appear.
    */
 
-  Int_t PSecNumber=-1;  //Previous Sector number
-  Int_t PRowNumber=-1;  //Previous Row number  
-  Int_t PPadNumber=-1;  //Previous Pad number
-  Int_t PTimeBin=-1;    //Previous Time-Bin
+  Int_t PSecNumber=-1;  ///< Previous Sector number
+  Int_t PRowNumber=-1;  ///< Previous Row number
+  Int_t PPadNumber=-1;  ///< Previous Pad number
+  Int_t PTimeBin=-1;    ///< Previous Time-Bin
   Int_t BunchLength=0;
   //AliTPCBuffer160 is used in write mode to generate AltroFormat.dat file
   AliTPCBuffer160 Buffer("AltroFormat.dat",1); 
@@ -58,7 +62,7 @@ int AliTPCAltro(Int_t eth=0){
   digarr->ConnectTree(digitsTree);
   //ofstream ftxt("Data.txt");
   for (Int_t n=0; n<nrows; n++) {
-    Int_t sec,row; // sector and row number (in the TPC)
+    Int_t sec,row; ///< sector and row number (in the TPC)
     AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
     param->AdjustSectorRow(digrow->GetID(),sec,row);   
 
index fd2723e1f73e5261d37c4cefd12ae38a1c9ded63..08ce290ca8423ceb48f4d3080e64c3a6bdb0f441 100644 (file)
-////////////////////////////////////////////////////////////////////////
-//
-// name: AliTPCCmpNG.C 
-//
-// date: 24.09.2002
-// author: Jiri Chudoba
-// version: 1.0
-// description: 
-//        define a class TPCGenTrack
-//        save TPC related properties of tracks into a single tree
-//
-// input: 
-//        Int_t nEvents      ... nr of events to process
-//        Int_t firstEventNr ... first event number (starts from 0)
-//        char* fnRecTracks .. name of file with reconstructed tracks
-//        char* fnHits ... name of file with hits and Kine Tree
-//        char* fnDigits  ... name of file with digits
-//        char* fnTracks .. output file name, default genTracks.root
-//
-// How to use:
-//  Typical usage:
-//    .L AliTPCCmpNG.C+
-//    TPCFindGenTracks *t = new TPCFindGenTracks("galice.root","tpc.digits.root")
-//    t->Exec();
-//    .q
-//    aliroot
-//    .L  AliTPCCmpNG.C+
-//    TPCCmpTr *t2 = new TPCCmpTr("tpc.tracks.root","genTracks.root","cmpTracks.root");
-//    t2->Exec();
-//
-//  Details:
-//  ========
-//
-//  Step 1 - summurize information from simulation
-//  ===============================================
-//  Compile macro with ACLIC:
-//     .L AliTPCCmpNG.C+
-//  create an object TPCFindGenTracks, which processes information
-//  from simulations. As input it needs:
-//     object gAlice: to get magnetic field
-//     TreeK: to get parameters of generated particles
-//     TreeTR: to get track parameters at the TPC entry
-//     TreeD: to get number of digits and digits pattern
-//                for a given track in TPC
-//  These input objects can be in different files, gAlice, TreeK and
-//  TreeTR are in the file fnHits, TreeD in the file fnDigits (can be
-//  the same as fnHits. Output is written to the file fnRes 
-//  ("genTracks.root" by default). Use can specify number of 
-//  events to process and the first event number:
-//    TPCFindGenTracks *t = new TPCFindGenTracks("galice.root","tpc.digits.root","genTracks.root",1,0)
-//  The filenames in the example on previous line are defaults, user can 
-//  specify just the file name with gAlice object (and TreeTR and TreeK), 
-//  so equivalent shorter initialization is:
-//    TPCFindGenTracks *t = new TPCFindGenTracks("galice.root")
-//  The task is done by calling Exec() method:
-//    t->Exec();
-//  User can set different debug levels by invoking:
-//    t->SetDebug(debugLevel)
-//  Number of events to process and the first event number can be
-//  specified as parameters to Exec:
-//    t->Exec(nEvents, firstEvent)
-//  Then you have to quit root to get rid of problems with deleting gAlice
-//  object (it is not deleted, but read again in the following step):
-//
-//  Step 2 - compare reconstructed tracks with simulated
-//  ====================================================
-//
-//  Load (and compile) the macro:
-//   .L AliTPCCmpNG.C+
-//  Create object TPCCmpTr, which does the comparison. As input it requires 
-//  name of the file with reconstructed TPC tracks. You can specify 
-//  name of the file with genTrack tree (summarized info about simulation),
-//  file with gAlice object, output file name, number of events to process
-//  and first event number:
-//  TPCCmpTr *t2 = new TPCCmpTr("tpc.tracks.root","genTracks.root","cmpTracks.root","galice.root",1,0);
-//  The interface is quite similar to the TPCFindGenTracks class.
-//  Then just invoke Exec() method:
-//  t2->Exec();
-//
-//  Step 3 - study the results
-//  ==========================
-//  Load the outoput TTree and you can do Draw(), Scan() or other
-//  usual things to do with TTree:
-//  TFile *f = new TFile("cmpTracks.root")
-//  TTree *t = (TTree*)f->Get("TPCcmpTracks")
-//  t->Draw("fVDist[3]","fReconstructed")
-//
-// History:
-//
-// 24.09.02 - first version
-// 24.01.03 - v7, before change from TPC Special Hits to TrackReferences
-// 26.01.03 - change from TPC Special Hits to TrackReferences
-//            (loop over TreeTR instead of TreeH)
-// 28.01.03 - v8 last version before removing TPC special point
-// 28.01.03 - remove TPC special point, loop over TreeH 
-//            store TParticle and AliTrack
-// 29.01.03 - v9 last version before moving the loop over rec. tracks
-//            into separate step
-// 03.02.03 - rename to AliTPCCmpNG.C, remove the part with rec. tracks
-//            (will be addded in a macro AliTPCCmpTr.C
-//
-//
-////////////////////////////////////////////////////////////////////////
+/// \file AliTPCCmpNG.C
+/// 
+/// version: 1.0
+/// description:
+///        define a class TPCGenTrack
+///        save TPC related properties of tracks into a single tree
+/// 
+/// input:
+///        Int_t nEvents      ... nr of events to process
+///        Int_t firstEventNr ... first event number (starts from 0)
+///        char* fnRecTracks .. name of file with reconstructed tracks
+///        char* fnHits ... name of file with hits and Kine Tree
+///        char* fnDigits  ... name of file with digits
+///        char* fnTracks .. output file name, default genTracks.root
+/// 
+/// How to use:
+///  Typical usage:
+///    .L AliTPCCmpNG.C+
+///    TPCFindGenTracks *t = new TPCFindGenTracks("galice.root","tpc.digits.root")
+///    t->Exec();
+///    .q
+///    aliroot
+///    .L  AliTPCCmpNG.C+
+///    TPCCmpTr *t2 = new TPCCmpTr("tpc.tracks.root","genTracks.root","cmpTracks.root");
+///    t2->Exec();
+/// 
+///  Details:
+/// 
+///  Step 1 - summurize information from simulation
+/// 
+///  Compile macro with ACLIC:
+///     .L AliTPCCmpNG.C+
+///  create an object TPCFindGenTracks, which processes information
+///  from simulations. As input it needs:
+///     object gAlice: to get magnetic field
+///     TreeK: to get parameters of generated particles
+///     TreeTR: to get track parameters at the TPC entry
+///     TreeD: to get number of digits and digits pattern
+///                for a given track in TPC
+///  These input objects can be in different files, gAlice, TreeK and
+///  TreeTR are in the file fnHits, TreeD in the file fnDigits (can be
+///  the same as fnHits. Output is written to the file fnRes
+///  ("genTracks.root" by default). Use can specify number of
+///  events to process and the first event number:
+///    TPCFindGenTracks *t = new TPCFindGenTracks("galice.root","tpc.digits.root","genTracks.root",1,0)
+///  The filenames in the example on previous line are defaults, user can
+///  specify just the file name with gAlice object (and TreeTR and TreeK),
+///  so equivalent shorter initialization is:
+///    TPCFindGenTracks *t = new TPCFindGenTracks("galice.root")
+///  The task is done by calling Exec() method:
+///    t->Exec();
+///  User can set different debug levels by invoking:
+///    t->SetDebug(debugLevel)
+///  Number of events to process and the first event number can be
+///  specified as parameters to Exec:
+///    t->Exec(nEvents, firstEvent)
+///  Then you have to quit root to get rid of problems with deleting gAlice
+///  object (it is not deleted, but read again in the following step):
+/// 
+///  Step 2 - compare reconstructed tracks with simulated
+/// 
+///  Load (and compile) the macro:
+///   .L AliTPCCmpNG.C+
+///  Create object TPCCmpTr, which does the comparison. As input it requires
+///  name of the file with reconstructed TPC tracks. You can specify
+///  name of the file with genTrack tree (summarized info about simulation),
+///  file with gAlice object, output file name, number of events to process
+///  and first event number:
+///  TPCCmpTr *t2 = new TPCCmpTr("tpc.tracks.root","genTracks.root","cmpTracks.root","galice.root",1,0);
+///  The interface is quite similar to the TPCFindGenTracks class.
+///  Then just invoke Exec() method:
+///  t2->Exec();
+/// 
+///  Step 3 - study the results
+/// 
+///  Load the outoput TTree and you can do Draw(), Scan() or other
+///  usual things to do with TTree:
+///  TFile *f = new TFile("cmpTracks.root")
+///  TTree *t = (TTree*)f->Get("TPCcmpTracks")
+///  t->Draw("fVDist[3]","fReconstructed")
+/// 
+/// History:
+/// 
+/// 24.09.02 - first version
+/// 24.01.03 - v7, before change from TPC Special Hits to TrackReferences
+/// 26.01.03 - change from TPC Special Hits to TrackReferences
+///            (loop over TreeTR instead of TreeH)
+/// 28.01.03 - v8 last version before removing TPC special point
+/// 28.01.03 - remove TPC special point, loop over TreeH
+///            store TParticle and AliTrack
+/// 29.01.03 - v9 last version before moving the loop over rec. tracks
+///            into separate step
+/// 03.02.03 - rename to AliTPCCmpNG.C, remove the part with rec. tracks
+///            (will be addded in a macro AliTPCCmpTr.C
+/// 
+/// \author Jiri Chudoba
+/// \date 24.09.2002
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include "iostream.h"
@@ -246,14 +240,14 @@ class TPCGenInfo: public TObject {
 
 public:
   TPCGenInfo();
-  AliTrackReference *fTrackRef;   // track reference saved in the output tree
-  TParticle *fParticle;           // generated particle 
-  Int_t fLabel;                   // track label
+  AliTrackReference *fTrackRef;   ///< track reference saved in the output tree
+  TParticle *fParticle;           ///< generated particle
+  Int_t fLabel;                   ///< track label
 
-  Int_t fRowsWithDigitsInn;    // number of rows with digits in the inner sectors
-  Int_t fRowsWithDigits;       // number of rows with digits in the outer sectors
-  Int_t fRowsTrackLength;      // last - first row with digit
-  Int_t fDigitsInSeed;         // digits in the default seed rows
+  Int_t fRowsWithDigitsInn;    ///< number of rows with digits in the inner sectors
+  Int_t fRowsWithDigits;       ///< number of rows with digits in the outer sectors
+  Int_t fRowsTrackLength;      ///< last - first row with digit
+  Int_t fDigitsInSeed;         ///< digits in the default seed rows
 
   ClassDef(TPCGenInfo,1)  // container for 
 };
@@ -327,9 +321,8 @@ void digitRow::SetRow(Int_t row)
 ////////////////////////////////////////////////////////////////////////
 Bool_t digitRow::TestRow(Int_t row)
 {
-//
-// return kTRUE if row is on
-//
+/// return kTRUE if row is on
+
   Int_t iC = row/8;
   Int_t iB = row%8;
   return TESTBIT(fDig[iC],iB);
@@ -337,10 +330,9 @@ Bool_t digitRow::TestRow(Int_t row)
 ////////////////////////////////////////////////////////////////////////
 Int_t digitRow::RowsOn(Int_t upto)
 {
-//
-// returns number of rows with a digit  
-// count only rows less equal row number upto
-//
+/// returns number of rows with a digit
+/// count only rows less equal row number upto
+
   Int_t total = 0;
   for (Int_t i = 0; i<kgRowBytes; i++) {
     for (Int_t j = 0; j < 8; j++) {
@@ -353,9 +345,8 @@ Int_t digitRow::RowsOn(Int_t upto)
 ////////////////////////////////////////////////////////////////////////
 void digitRow::Reset()
 {
-//
-// resets all rows to zero
-//
+/// resets all rows to zero
+
   for (Int_t i = 0; i<kgRowBytes; i++) {
     fDig[i] <<= 8;
   }
@@ -363,10 +354,9 @@ void digitRow::Reset()
 ////////////////////////////////////////////////////////////////////////
 Int_t digitRow::Last()
 {
-//
-// returns the last row number with a digit
-// returns -1 if now digits 
-//
+/// returns the last row number with a digit
+/// returns -1 if now digits
+
   for (Int_t i = kgRowBytes-1; i>=0; i--) {
     for (Int_t j = 7; j >= 0; j--) {
       if TESTBIT(fDig[i],j) return i*8+j;
@@ -377,10 +367,9 @@ Int_t digitRow::Last()
 ////////////////////////////////////////////////////////////////////////
 Int_t digitRow::First()
 {
-//
-// returns the first row number with a digit
-// returns -1 if now digits 
-//
+/// returns the first row number with a digit
+/// returns -1 if now digits
+
   for (Int_t i = 0; i<kgRowBytes; i++) {
     for (Int_t j = 0; j < 8; j++) {
       if (TESTBIT(fDig[i],j)) return i*8+j;
@@ -425,50 +414,50 @@ public:
                    AliTPCParam *paramTPC);
 
 public:
-  Int_t fDebug;                   //! debug flag  
-  Int_t fEventNr;                 //! current event number
-  Int_t fLabel;                   //! track label
-  Int_t fNEvents;                 //! number of events to process
-  Int_t fFirstEventNr;            //! first event to process
-  Int_t fNParticles;              //! number of particles in TreeK
-  TTree *fTreeGenTracks;          //! output tree with generated tracks
-  char *fFnRes;                   //! output file name with stored tracks
-  char *fFnHits;                  //! input file name with hits
-  char *fFnDigits;                //! input file name with digits
-  TFile *fFileGenTracks;             //! output file with stored fTreeGenTracks
-  TFile *fFileHits;               //! input file with hits
-  TFile *fFileTreeD;              //! input file with digits
-  digitRow *fDigitRow;            //! pointer to the object saved in Branch
-  digitRow *fContainerDigitRow;   //! big container for partial information
-  AliTrackReference *fTrackRef;   //! track reference saved in the output tree
-  AliTrackReference *fContainerTR;//! big container for partial information
-  Int_t *fIndexTR;                //! index of particle label in the fContainerTR
-  Int_t fLastIndexTR;             //! last used index in fIndexTR
-
-  AliTPCParam* fParamTPC;         //! AliTPCParam
-
-  Double_t fVPrim[3];             //! primary vertex position
-  Double_t fVDist[4];             //! distance of the particle vertex from primary vertex
+  Int_t fDebug;                   //!< debug flag
+  Int_t fEventNr;                 //!< current event number
+  Int_t fLabel;                   //!< track label
+  Int_t fNEvents;                 //!< number of events to process
+  Int_t fFirstEventNr;            //!< first event to process
+  Int_t fNParticles;              //!< number of particles in TreeK
+  TTree *fTreeGenTracks;          //!< output tree with generated tracks
+  char *fFnRes;                   //!< output file name with stored tracks
+  char *fFnHits;                  //!< input file name with hits
+  char *fFnDigits;                //!< input file name with digits
+  TFile *fFileGenTracks;             //!< output file with stored fTreeGenTracks
+  TFile *fFileHits;               //!< input file with hits
+  TFile *fFileTreeD;              //!< input file with digits
+  digitRow *fDigitRow;            //!< pointer to the object saved in Branch
+  digitRow *fContainerDigitRow;   //!< big container for partial information
+  AliTrackReference *fTrackRef;   //!< track reference saved in the output tree
+  AliTrackReference *fContainerTR;//!< big container for partial information
+  Int_t *fIndexTR;                //!< index of particle label in the fContainerTR
+  Int_t fLastIndexTR;             //!< last used index in fIndexTR
+
+  AliTPCParam* fParamTPC;         //!< AliTPCParam
+
+  Double_t fVPrim[3];             //!< primary vertex position
+  Double_t fVDist[4];             //!< distance of the particle vertex from primary vertex
                                   // the fVDist[3] contains size of the 3-vector
-  TParticle *fParticle;           //! generated particle 
+  TParticle *fParticle;           //!< generated particle
 
-  Int_t fRowsWithDigitsInn;       //! number of rows with digits in the inner sectors
-  Int_t fRowsWithDigits;          //! number of rows with digits in the outer sectors
-  Int_t fRowsTrackLength;         //! last - first row with digit
-  Int_t fDigitsInSeed;            //! digits in the default seed rows
+  Int_t fRowsWithDigitsInn;       //!< number of rows with digits in the inner sectors
+  Int_t fRowsWithDigits;          //!< number of rows with digits in the outer sectors
+  Int_t fRowsTrackLength;         //!< last - first row with digit
+  Int_t fDigitsInSeed;            //!< digits in the default seed rows
 
 private:
 
 // some constants for the original non-pareller tracking (by Y.Belikov)
-  static const Int_t seedRow11 = 158;  // nRowUp - 1
-  static const Int_t seedRow12 = 139;  // nRowUp - 1 - (Int_t) 0.125*nRowUp
-  static const Int_t seedRow21 = 149;  // seedRow11 - shift
-  static const Int_t seedRow22 = 130;  // seedRow12 - shift
+  static const Int_t seedRow11 = 158;  ///< nRowUp - 1
+  static const Int_t seedRow12 = 139;  ///< nRowUp - 1 - (Int_t) 0.125*nRowUp
+  static const Int_t seedRow21 = 149;  ///< seedRow11 - shift
+  static const Int_t seedRow22 = 130;  ///< seedRow12 - shift
   static const Double_t kRaddeg = 180./TMath::Pi();
 
-  static const Int_t fgMaxIndexTR = 50000; // maximum number of tracks with a track ref
-  static const Int_t fgMaxParticles = 2000000; // maximum number of generated particles
-  static const Double_t fgPtCut = .001; // do not store particles with generated pT less than this
+  static const Int_t fgMaxIndexTR = 50000; ///< maximum number of tracks with a track ref
+  static const Int_t fgMaxParticles = 2000000; ///< maximum number of generated particles
+  static const Double_t fgPtCut = .001; ///< do not store particles with generated pT less than this
   static const Float_t fgTrackRefLocalXMax = 82.95;
   static const Float_t fgTrackRefLocalXMaxDelta = 500.; 
 
@@ -642,11 +631,9 @@ void TPCFindGenTracks::CloseOutputFile()
 ////////////////////////////////////////////////////////////////////////
 Int_t TPCFindGenTracks::TreeKLoop()
 {
-//
-// open the file with treeK
-// loop over all entries there and save information about some tracks
-//
-  
+/// open the file with treeK
+/// loop over all entries there and save information about some tracks
+
   fFileHits->cd();
   if (fDebug > 0) {
     cout<<"There are "<<fNParticles<<" primary and secondary particles in event "
@@ -714,10 +701,8 @@ Int_t TPCFindGenTracks::TreeKLoop()
 ////////////////////////////////////////////////////////////////////////
 Int_t TPCFindGenTracks::TreeDLoop()
 {
-//
-// open the file with treeD
-// loop over all entries there and save information about some tracks
-//
+/// open the file with treeD
+/// loop over all entries there and save information about some tracks
 
 
 //  Int_t nrow_up=fParamTPC->GetNRowUp();
@@ -783,10 +768,8 @@ Int_t TPCFindGenTracks::TreeDLoop()
 ////////////////////////////////////////////////////////////////////////
 Int_t TPCFindGenTracks::TreeTRLoop()
 {
-//
-// loop over TrackReferences and store the first one for each track
-//
-  
+/// loop over TrackReferences and store the first one for each track
+
   TTree *treeTR=gAlice->TreeTR();
   if (!treeTR) {
     cerr<<"TreeTR not found"<<endl;
@@ -893,51 +876,51 @@ public:
                    AliTPCParam *paramTPC);
 
 private:
-  digitRow *fDigitRow;            //! pointer to the object saved in Branch
-  Int_t fEventNr;                 //! current event number
-  Int_t fLabel;                   //! track label
-  Int_t fNEvents;                 //! number of events to process
-  Int_t fFirstEventNr;            //! first event to process
+  digitRow *fDigitRow;            //!< pointer to the object saved in Branch
+  Int_t fEventNr;                 //!< current event number
+  Int_t fLabel;                   //!< track label
+  Int_t fNEvents;                 //!< number of events to process
+  Int_t fFirstEventNr;            //!< first event to process
 
-  char *fFnCmp;                   //! output file name with cmp tracks
-  TFile *fFileCmp;                //! output file with cmp tracks
-  TTree *fTreeCmp;                //! output tree with cmp tracks
+  char *fFnCmp;                   //!< output file name with cmp tracks
+  TFile *fFileCmp;                //!< output file with cmp tracks
+  TTree *fTreeCmp;                //!< output tree with cmp tracks
 
-  char *fFnGenTracks;             //! input file name with gen tracks
+  char *fFnGenTracks;             //!< input file name with gen tracks
   TFile *fFileGenTracks;
   TTree *fTreeGenTracks;
 
-  char *fFnHits;                  //! input file name with gAlice object (needed for B)
-  TFile *fFileHits;               //! input file with gAlice
+  char *fFnHits;                  //!< input file name with gAlice object (needed for B)
+  TFile *fFileHits;               //!< input file with gAlice
 
-  char *fFnRecTracks;             //! input file name with tpc rec. tracks
-  TFile *fFileRecTracks;          //! input file with reconstructed tracks
-  TTree *fTreeRecTracks;          //! tree with reconstructed tracks
+  char *fFnRecTracks;             //!< input file name with tpc rec. tracks
+  TFile *fFileRecTracks;          //!< input file with reconstructed tracks
+  TTree *fTreeRecTracks;          //!< tree with reconstructed tracks
 
-  AliTPCtrack *fTPCTrack;         //! pointer to TPC track to connect branch
-  Int_t *fIndexRecTracks;         //! index of particle label in the TreeT_TPC
+  AliTPCtrack *fTPCTrack;         //!< pointer to TPC track to connect branch
+  Int_t *fIndexRecTracks;         //!< index of particle label in the TreeT_TPC
 
-  Int_t fRowsWithDigitsInn;       //! number of rows with digits in the inner sectors
-  Int_t fRowsWithDigits;          //! number of rows with digits in the outer sectors
-  Int_t fRowsTrackLength;         //! last - first row with digit
-  Int_t fDigitsInSeed;            //! digits in the default seed rows
-  TParticle *fParticle;           //! generated particle 
-  Double_t fVDist[4];             //! distance of the particle vertex from primary vertex
+  Int_t fRowsWithDigitsInn;       //!< number of rows with digits in the inner sectors
+  Int_t fRowsWithDigits;          //!< number of rows with digits in the outer sectors
+  Int_t fRowsTrackLength;         //!< last - first row with digit
+  Int_t fDigitsInSeed;            //!< digits in the default seed rows
+  TParticle *fParticle;           //!< generated particle
+  Double_t fVDist[4];             //!< distance of the particle vertex from primary vertex
                                   // the fVDist[3] contains size of the 3-vector
-  AliTrackReference *fTrackRef;   //! track reference saved in the output tree
-  Int_t   fReconstructed;         //! flag if track was reconstructed
-  AliTPCParam* fParamTPC;         //! AliTPCParam
+  AliTrackReference *fTrackRef;   //!< track reference saved in the output tree
+  Int_t   fReconstructed;         //!< flag if track was reconstructed
+  AliTPCParam* fParamTPC;         //!< AliTPCParam
 
-  Int_t fNParticles;              //! number of particles in the input tree genTracks
-  Int_t fDebug;                   //! debug flag  
+  Int_t fNParticles;              //!< number of particles in the input tree genTracks
+  Int_t fDebug;                   //!< debug flag
 
-  Int_t fNextTreeGenEntryToRead;    //! last entry already read from genTracks tree
-  TPCGenInfo *fGenInfo;           //! container for all the details
+  Int_t fNextTreeGenEntryToRead;    //!< last entry already read from genTracks tree
+  TPCGenInfo *fGenInfo;           //!< container for all the details
 
-  Double_t fRecPhi;         // reconstructed phi angle (0;2*kPI)
-  Double_t fLambda;         // reconstructed 
-  Double_t fRecPt_1;        // reconstructed 
-  Float_t fdEdx;           // reconstructed  dEdx      
+  Double_t fRecPhi;         ///< reconstructed phi angle (0;2*kPI)
+  Double_t fLambda;         ///< reconstructed
+  Double_t fRecPt_1;        ///< reconstructed
+  Float_t fdEdx;           ///< reconstructed  dEdx
 
 
   ClassDef(TPCCmpTr,1)    // class which creates and fills tree with TPCGenTrack objects
@@ -1077,10 +1060,9 @@ Int_t TPCCmpTr::Exec()
 ////////////////////////////////////////////////////////////////////////
 Bool_t TPCCmpTr::ConnectGenTree()
 {
-//
-// connect all branches from the genTracksTree
-// use the same variables as for the new cmp tree, it may work
-//
+/// connect all branches from the genTracksTree
+/// use the same variables as for the new cmp tree, it may work
+
   fFileGenTracks = TFile::Open(fFnGenTracks,"READ");
   if (!fFileGenTracks) {
     cerr<<"Error in ConnectGenTree: cannot open file "<<fFnGenTracks<<endl;
@@ -1168,9 +1150,7 @@ Float_t TPCCmpTr::TR2LocalX(AliTrackReference *trackRef,
 
 Int_t TPCCmpTr::TreeTLoop(Int_t eventNr)
 {
-//
-// loop over all TPC reconstructed tracks and store info in memory
-//
+/// loop over all TPC reconstructed tracks and store info in memory
 
   
   if (!fFileRecTracks) fFileRecTracks = TFile::Open(fFnRecTracks,"read");
@@ -1208,11 +1188,9 @@ Int_t TPCCmpTr::TreeTLoop(Int_t eventNr)
 ////////////////////////////////////////////////////////////////////////
 Int_t TPCCmpTr::TreeGenLoop(Int_t eventNr)
 {
-//
-// loop over all entries for a given event, find corresponding 
-// rec. track and store in the fTreeCmp
-//
-  
+/// loop over all entries for a given event, find corresponding
+/// rec. track and store in the fTreeCmp
+
   fFileGenTracks->cd();
   Int_t entry = fNextTreeGenEntryToRead;
   Double_t nParticlesTR = fTreeGenTracks->GetEntriesFast();
index a492f3f72bbdf1125bca5e5e0b978d75aca25ca7..9eec298fe7673742e4bcb45283758ffecd835e58 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-//
-// Combine cosmic track pairs (upper, lower) and do track fitting
-// oooooOOOOOooooo
-// oooooOOOOOooooo
-// oooooOOOOOooooo
-//
-//  Xianguo Lu <lu@physi.uni-heidelberg.de>
+
+/// \class AliTPCCombinedTrackfit
+/// 
+/// Combine cosmic track pairs (upper, lower) and do track fitting
+/// 
+/// \author Xianguo Lu <lu@physi.uni-heidelberg.de>
 
 #include <TAxis.h>
 #include <TCanvas.h>
@@ -43,9 +42,8 @@ AliTPCCombinedTrackfit::AliTPCCombinedTrackfit(const Int_t dlev, const TString t
   , fLeverArm(-999)
   , fFitNcls(-999), fMissNcls(-999), fPreChi2(-999)
 {
-  //
-  //Constructor
-  //
+  /// Constructor
+
   fInnerClusterUp.SetXYZ(-999,-999,-999);
   fInnerClusterLow.SetXYZ(-999,-999,-999);
 
@@ -55,9 +53,7 @@ AliTPCCombinedTrackfit::AliTPCCombinedTrackfit(const Int_t dlev, const TString t
 
 AliTPCCombinedTrackfit::~AliTPCCombinedTrackfit()
 {
-  //
-  //Destructor
-  //
+  /// Destructor
 
   delete fStreamer;
   
@@ -67,10 +63,8 @@ AliTPCCombinedTrackfit::~AliTPCCombinedTrackfit()
 
 Bool_t AliTPCCombinedTrackfit::CombineESDtracks(AliESDtrack * &trk0, AliESDtrack *&trk1)
 {
-  //
-  //Get TPCseeds from the 2 ESDtracks, swap TPCseeds and ESDTracks (if necessary) according to y (0:upper 1:lower), perform trackfit using TPCseeds
-  //if fStatus==0, i.e. combine is successful, swap of the ESDtracks is kept since pointer *& is used
-  //
+  /// Get TPCseeds from the 2 ESDtracks, swap TPCseeds and ESDTracks (if necessary) according to y (0:upper 1:lower), perform trackfit using TPCseeds
+  /// if fStatus==0, i.e. combine is successful, swap of the ESDtracks is kept since pointer *& is used
 
   IniCombineESDtracks();
 
@@ -95,10 +89,9 @@ Bool_t AliTPCCombinedTrackfit::CombineESDtracks(AliESDtrack * &trk0, AliESDtrack
 
 Bool_t AliTPCCombinedTrackfit::CombineTPCseeds(AliTPCseed * &seed0, AliTPCseed *&seed1)
 {
-  //
-  //same as AliTPCCombinedTrackfit::CombineESDtracks, except that the seeds are passed in from outside, which can be still unordered
-  //if fStatus==0, i.e. combine is successful, swap of the TPCseeds is kept since pointer *& is used
-  //
+  /// same as AliTPCCombinedTrackfit::CombineESDtracks, except that the seeds are passed in from outside, which can be still unordered
+  /// if fStatus==0, i.e. combine is successful, swap of the TPCseeds is kept since pointer *& is used
+
   IniCombineESDtracks();
 
   fSeedUp  = seed0;
@@ -121,17 +114,15 @@ Bool_t AliTPCCombinedTrackfit::CombineTPCseeds(AliTPCseed * &seed0, AliTPCseed *
 
 void AliTPCCombinedTrackfit::Print() const
 {
-  //
-  //print out variable values
-  //
+  /// print out variable values
+
   printf("Status %2d NclsU %3d NclsD %3d ZinnerU %7.2f ZinnerD %7.2f LeverArm %7.2f\n", fStatus, fSeedUp->GetNumberOfClusters(), fSeedLow->GetNumberOfClusters(), fInnerClusterUp.Z(), fInnerClusterLow.Z(), fLeverArm);
 }
 
 Double_t AliTPCCombinedTrackfit::ImpactParameter() const
 {
-  //
-  //calculate the impactparameter from (0,0,0)
-  //
+  /// calculate the impactparameter from (0,0,0)
+
   const TVector3 p0(0,0,0);
   const TVector3 va = p0 - fInnerClusterUp;
   const TVector3 vb = fInnerClusterLow - fInnerClusterUp;
@@ -143,9 +134,8 @@ Double_t AliTPCCombinedTrackfit::ImpactParameter() const
 
 Double_t AliTPCCombinedTrackfit::MinPhi() const
 {
-  //
-  //the smaller phi of the two tracks w.r.t. horizon
-  //
+  /// the smaller phi of the two tracks w.r.t. horizon
+
   Double_t fsp[] = {fabs(sin(fTrackparUp->Phi())), fabs(sin(fTrackparLow->Phi()))};;
   return asin(TMath::Min(fsp[0], fsp[1])) * TMath::RadToDeg();
 }
@@ -154,9 +144,7 @@ Double_t AliTPCCombinedTrackfit::MinPhi() const
 
 void AliTPCCombinedTrackfit::IniCombineESDtracks()
 {
-  //
-  //initialization, for reuse of the same AliTPCCombinedTrackfit instance
-  //
+  /// initialization, for reuse of the same AliTPCCombinedTrackfit instance
 
   fSeedUp = 0x0;
   fSeedLow = 0x0;
@@ -170,9 +158,7 @@ void AliTPCCombinedTrackfit::IniCombineESDtracks()
 
 void AliTPCCombinedTrackfit::CombineTPCseeds(Bool_t &kswap)
 {
-  //
-  //do combined trackfit using TPCseeds
-  //
+  /// do combined trackfit using TPCseeds
 
   if(
      !CheckNcls()
@@ -205,9 +191,7 @@ void AliTPCCombinedTrackfit::CombineTPCseeds(Bool_t &kswap)
 
 void AliTPCCombinedTrackfit::Update()
 {
-  //
-  //Update variables depending on the fit result
-  //
+  /// Update variables depending on the fit result
 
   if(fMissNcls || fFitNcls==0){
     fStatus = kFailPropagation;
@@ -245,11 +229,10 @@ void AliTPCCombinedTrackfit::Update()
 
 Bool_t AliTPCCombinedTrackfit::CheckLeverArm()
 {
-  //
-  //if lever arm is too short, no need to use combined track fit. 
-  //On the other hand, short lever arm from two tracks mostly means they are fake pairs.
-  //lever arm extents over one quadrant, e.g. (0,250)-(250,0): 250*sqrt(2)~350
-  //
+  /// if lever arm is too short, no need to use combined track fit.
+  /// On the other hand, short lever arm from two tracks mostly means they are fake pairs.
+  /// lever arm extents over one quadrant, e.g. (0,250)-(250,0): 250*sqrt(2)~350
+
   if(fLeverArm<fgkCutLeverArm){
     fStatus = kFailLeverArm;
     return kFALSE;
@@ -260,9 +243,7 @@ Bool_t AliTPCCombinedTrackfit::CheckLeverArm()
 
 Bool_t AliTPCCombinedTrackfit::AnaSeeds(Bool_t &kswap)
 {
-  //
-  //swap seeds (if necessary) so that (y of fSeedUp) > (y of fSeedLow)
-  //
+  /// swap seeds (if necessary) so that (y of fSeedUp) > (y of fSeedLow)
 
   //---------------------------------- navigate through all clusters ----------------------------------
   AliTPCseed ** seeds[]={&fSeedUp, &fSeedLow};
@@ -342,9 +323,8 @@ Bool_t AliTPCCombinedTrackfit::AnaSeeds(Bool_t &kswap)
 
 Bool_t AliTPCCombinedTrackfit::CheckNcls()
 {
-  //
-  //check number of clusters in TPCseed, for too small number MakeSeed will fail
-  //
+  /// check number of clusters in TPCseed, for too small number MakeSeed will fail
+
   if( fSeedUp->GetNumberOfClusters()<AliTPCCosmicUtils::fgkNclsMin || fSeedLow->GetNumberOfClusters()<AliTPCCosmicUtils::fgkNclsMin ){
     fStatus = kFailNclsMin;
     return kFALSE;
@@ -355,9 +335,8 @@ Bool_t AliTPCCombinedTrackfit::CheckNcls()
 
 Bool_t AliTPCCombinedTrackfit::GetTPCseeds(const AliESDtrack *trk0,  const AliESDtrack *trk1)
 {
-  //
-  //Get TPC seeds from ESDfriendTrack
-  //
+  /// Get TPC seeds from ESDfriendTrack
+
   fSeedUp  = AliTPCCosmicUtils::GetTPCseed(trk0);
   fSeedLow = AliTPCCosmicUtils::GetTPCseed(trk1);
 
index 7464c2b340666523e1a3b9a9f79246e1fecdbb3f..1c2e03342cb62fd418bc05dbf2fa50d6dcab18e2 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-//
-// Combine cosmic track pairs (upper, lower) and do track fitting
-//
-// ----- Usage:
-/*
-  fCombinedTrackfit = new AliTPCCombinedTrackfit(debuglevel, "anystring");
-
-  //order not important; will be internally ordered (potinters modified due to &) such that track0 is the upper one
-  //kfit = kTRUE: good fit, kFALSE: bad fit
-  const Bool_t kfit = fCombinedTrackfit->CombineESDtracks(esdtrack0, esdtrack1);
 
-  //status = 0 for good fit (i.e. kfit=kTRUE), non-0 for bad fit (i.e. kfit=kFALSE), see "enum CombineStatus" definition in header file
-  const Int_t status = fCombinedTrackfit->GetStatus(); 
+/// \class AliTPCCombinedTrackfit
+/// \brief Combine cosmic track pairs (upper, lower) and do track fitting.
+/// 
+/// Usage
+/// -----
+///
+/// ~~~{.cxx}
+/// fCombinedTrackfit = new AliTPCCombinedTrackfit(debuglevel, "anystring");
+///
+/// //order not important; will be internally ordered (potinters modified due to &) such that track0 is the upper one
+/// //kfit = kTRUE: good fit, kFALSE: bad fit
+/// const Bool_t kfit = fCombinedTrackfit->CombineESDtracks(esdtrack0, esdtrack1);
+///
+/// //status = 0 for good fit (i.e. kfit=kTRUE), non-0 for bad fit (i.e. kfit=kFALSE), see "enum CombineStatus" definition in header file
+/// const Int_t status = fCombinedTrackfit->GetStatus(); 
+///
+/// //in Analysis Task write when terminate 
+/// fCombinedTrackfit->GetStreamer()->GetFile()->Write();
+/// ~~~
+///
+/// Debug output
+/// ------------
+///
+/// For (debuglevel & 1)==1 && good fit, the following info saved:
+///
+/// ~~~{.cxx}
+///
+/// (*fStreamer)<<"TrackProp"<<
+///     "Tup.="<<fTrackparUp<<          //AliExternalTrackParam at uppermost cluster obtained by upward propagation
+///     "Tlow.="<<fTrackparLow<<        //AliExternalTrackParam at lowermost cluster obtained by downward propagation
+///     "icup.="<<&fInnerClusterUp<<    //TVector3 position of the innermost cluster of the upper track
+///     "iclow.="<<&fInnerClusterLow<<
+///     "leverarm="<<fLeverArm<<
+///     "ncl="<<fFitNcls<<              //number of clusters used in successful propagation  
+///     "nmiss="<<fMissNcls<<           //number of clusters failed in propagation, should always be 0 in this case.
+///     "chi2="<<fPreChi2<<             //chi2/nfit  
+///     "momup="<<  momup <<            //momentum at uppermost cluster with upward propagation
+///     "momlow="<< momlow <<           //momentum at lowermost cluster with downward propagation
+///     "ptup="<<   ptup <<
+///     "ptlow="<<  ptlow <<
+///     "\n";
+/// ~~~
+///
+/// For (debuglevel & 2)==1, debug info in `AliTPCCosmicUtils::FitKernel` saved
+///
+/// Efficiency
+/// ----------
+///
+/// For 2011 Feb. cosmic data nch=2 events, the kfit and status look like:
+/// 
+/// ~~~{.cxx}
+/// kfit,status (  0,   1):   68939 / 2611959 =   2.639%          //kFailGetTPCseeds
+/// kfit,status (  0,   2):   14886 / 2611959 =   0.570%          //not both tracks have ncl > AliTPCCosmicUtils::fgkNclsMin
+/// kfit,status (  0,   3):   53185 / 2611959 =   2.036%          //clusters in two tracks should be clearly separated in y, i.e. lowest cluster of upper track higher than highest cluster of lower track; otherwise fail
+/// kfit,status (  0,   4):   39841 / 2611959 =   1.525%          //fLeverArm<fgkCutLeverArm
+/// kfit,status (  0,   6):   12933 / 2611959 =   0.495%          //fail in propagation of at least one cluster
+/// kfit,status (  0,   7):   19994 / 2611959 =   0.765%          //chi2/nfit > fgkMaxChi2
+/// kfit,status (  1,   0): 2402181 / 2611959 =  91.969%          //i.e. 92% of nch=2 events are successfully fitted.
+/// ~~~
+/// 
+/// Resolution
+/// ----------
+///
+/// For muon momentum small than 20 GeV, energy loss in muon filter is visable when compaing fTrackparUp and fTrackparLow; energy loss estimated as 5 MeV/cm.
+/// Particle traversing muon filter can be rejected by requiring `fInnerClusterUp.fZ > -40 && fInnerClusterLow.fZ > -40`
+/// Momentum resolution is estimated by comparing the trackfit result by upward propagation through odd pad rows and that by downward propagation through even pad rows. Number of clusters used in this case is only half of that in normal usage.
+/// RMS of log10 p = 0.01 at 10 GeV/c, 0.1 at 100 GeV/c, 0.5 at 1 TeV/c.
+/// Muon filter deteriorates momentum resolution by about +0.01 (absolute value).
+///
+/// \author Xianguo Lu <lu@physi.uni-heidelberg.de>
 
-  //in Analysis Task write when terminate 
-  fCombinedTrackfit->GetStreamer()->GetFile()->Write();
-*/
-//
-// ----- Debug output:
-// for (debuglevel & 1)==1 && good fit, the following info saved:
-/*
-  (*fStreamer)<<"TrackProp"<<
-      "Tup.="<<fTrackparUp<<          //AliExternalTrackParam at uppermost cluster obtained by upward propagation
-      "Tlow.="<<fTrackparLow<<        //AliExternalTrackParam at lowermost cluster obtained by downward propagation
-      "icup.="<<&fInnerClusterUp<<    //TVector3 position of the innermost cluster of the upper track
-      "iclow.="<<&fInnerClusterLow<<
-      "leverarm="<<fLeverArm<<
-      "ncl="<<fFitNcls<<              //number of clusters used in successful propagation  
-      "nmiss="<<fMissNcls<<           //number of clusters failed in propagation, should always be 0 in this case.
-      "chi2="<<fPreChi2<<             //chi2/nfit  
-      "momup="<<  momup <<            //momentum at uppermost cluster with upward propagation
-      "momlow="<< momlow <<           //momentum at lowermost cluster with downward propagation
-      "ptup="<<   ptup <<
-      "ptlow="<<  ptlow <<
-      "\n";
- */
-// for (debuglevel & 2)==1, debug info in AliTPCCosmicUtils::FitKernel saved
-//
-// ----- Efficiency:
-// for 2011 Feb. cosmic data nch=2 events, the kfit and status look like:
-/*
-kfit,status (  0,   1):   68939 / 2611959 =   2.639%          //kFailGetTPCseeds
-kfit,status (  0,   2):   14886 / 2611959 =   0.570%          //not both tracks have ncl > AliTPCCosmicUtils::fgkNclsMin
-kfit,status (  0,   3):   53185 / 2611959 =   2.036%          //clusters in two tracks should be clearly separated in y, i.e. lowest cluster of upper track higher than highest cluster of lower track; otherwise fail
-kfit,status (  0,   4):   39841 / 2611959 =   1.525%          //fLeverArm<fgkCutLeverArm
-kfit,status (  0,   6):   12933 / 2611959 =   0.495%          //fail in propagation of at least one cluster
-kfit,status (  0,   7):   19994 / 2611959 =   0.765%          //chi2/nfit > fgkMaxChi2
-kfit,status (  1,   0): 2402181 / 2611959 =  91.969%          //i.e. 92% of nch=2 events are successfully fitted.
-*/
-//
-// ----- Resolution:
-// for muon momentum small than 20 GeV, energy loss in muon filter is visable when compaing fTrackparUp and fTrackparLow; energy loss estimated as 5 MeV/cm.
-// particle traversing muon filter can be rejected by requiring "fInnerClusterUp.fZ > -40 && fInnerClusterLow.fZ > -40"
-// momentum resolution is estimated by comparing the trackfit result by upward propagation through odd pad rows and that by downward propagation through even pad rows. Number of clusters used in this case is only half of that in normal usage.
-// RMS of log10 p = 0.01 at 10 GeV/c, 0.1 at 100 GeV/c, 0.5 at 1 TeV/c.
-// muon filter deteriorates momentum resolution by about +0.01 (absolute value).
-//
-//  Xianguo Lu <lu@physi.uni-heidelberg.de>
-//
 /*
 //in [cm]
 const Double_t _TPCZMIN = -250;
@@ -136,26 +149,26 @@ class AliTPCCombinedTrackfit
   void CombineTPCseeds(Bool_t &kswap);
   void Update();
 
-  TTreeSRedirector *fStreamer;     //!debug streamer
-  Int_t fDebugLevel;                    //debug level
+  TTreeSRedirector *fStreamer;     //!debug streamer
+  Int_t fDebugLevel;                    ///< debug level
 
-  AliTPCseed * fSeedUp;                         //TPC seed of upper track
-  AliTPCseed * fSeedLow;                        //TPC seed of lower track
-  AliExternalTrackParam * fTrackparUp;          //track param of upper track
-  AliExternalTrackParam * fTrackparLow;         //track param of lower track
+  AliTPCseed * fSeedUp;                         ///< TPC seed of upper track
+  AliTPCseed * fSeedLow;                        ///< TPC seed of lower track
+  AliExternalTrackParam * fTrackparUp;          ///< track param of upper track
+  AliExternalTrackParam * fTrackparLow;         ///< track param of lower track
 
-  Int_t fStatus;                               //status for CombineESDtracks/CombineTPCseeds: 0-successful, otherwise fail
+  Int_t fStatus;                               ///< status for CombineESDtracks/CombineTPCseeds: 0-successful, otherwise fail
   
-  TVector3 fInnerClusterUp;                    //xyz of the inner most TPC trackpoint of the Upper track
-  TVector3 fInnerClusterLow;                   //xyz of the inner most TPC trackpoint of the Lower track
-  Double_t fLeverArm;                          //transverse difference between upper most and lower most clusters
+  TVector3 fInnerClusterUp;                    ///< xyz of the inner most TPC trackpoint of the Upper track
+  TVector3 fInnerClusterLow;                   ///< xyz of the inner most TPC trackpoint of the Lower track
+  Double_t fLeverArm;                          ///< transverse difference between upper most and lower most clusters
 
-  Int_t fFitNcls;                              //number of TPC clusters successful in propagation (mean of the two propagation: upwards and downwards)
-  Int_t fMissNcls;                             //number of TPC clusters fail in propagation (sum of the two propagation)
-  Double_t fPreChi2;                           //Predicted chi2/nfit over the two propagation
+  Int_t fFitNcls;                              ///< number of TPC clusters successful in propagation (mean of the two propagation: upwards and downwards)
+  Int_t fMissNcls;                             ///< number of TPC clusters fail in propagation (sum of the two propagation)
+  Double_t fPreChi2;                           ///< Predicted chi2/nfit over the two propagation
 
-  static const Double_t fgkCutLeverArm = 350;  //minimum lever arm 350 ~ 250 * sqrt(2)
-  static const Double_t fgkMaxChi2 = 10;       //max. chi2/ncls
+  static const Double_t fgkCutLeverArm = 350;  ///< minimum lever arm 350 ~ 250 * sqrt(2)
+  static const Double_t fgkMaxChi2 = 10;       ///< max. chi2/ncls
 };
 
 #endif
index 822cf380a70292ea064c9dc040b574238dfddbba..0832dde5d6a9d4da98d4ef292c00e880d674395f 100644 (file)
@@ -5,6 +5,7 @@
 #include "AliTPCclusterMI.h"
 #endif
 
+/// \file AliTPCCompareTracks.C
 
 Int_t AliTPCCompareTracks(Int_t eventn, Bool_t all = kFALSE) {
    cerr<<"Comparing tracks...\n";
index e14f7cadace427589c90b6c0a94973e152bfb980..808179c6f902c6089d010769da3a98ada7cf57fa 100644 (file)
@@ -1,13 +1,11 @@
-/****************************************************************************
- *           Very important, delicate and rather obscure macro.             *
- *                                                                          *
- *               Creates list of "trackable" tracks,                        *
- *             calculates efficiency, resolutions etc.                      *
- *     There is a possibility to run this macro over several events.         *
- *                                                                          *
- *           Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                 *
- * with several nice improvements by: M.Ivanov, GSI, m.ivanov@gsi.de        *
- ****************************************************************************/
+/// \file AliTPCComparison.C
+/// \brief Very important, delicate and rather obscure macro
+///
+/// Creates list of "trackable" tracks, calculates efficiency, resolutions etc.
+///
+/// There is a possibility to run this macro over several events.
+///
+/// \author I.Belikov, CERN, Jouri.Belikov@cern.ch, M.Ivanov, GSI, m.ivanov@gsi.de
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
   #include <TMath.h>
@@ -158,7 +156,8 @@ Int_t AliTPCComparison
    event->ReadFromTree(esdTree);
 
 
-   //******* Loop over events *********
+  // ******* Loop over events *********
+
    Int_t e=0;
    while (esdTree->GetEvent(e)) {
       cout<<endl<<endl<<"********* Processing event number: "<<e<<"*******\n";
index 0ca82850f43316491d4e5e48a56a19d3421eaf42..a3572b421f689cd10c95cda5df3f49d196aa993d 100644 (file)
@@ -1,13 +1,12 @@
-/****************************************************************************
- *           Very important, delicate and rather obscure macro.             *
- *                                                                          *
- *               Creates list of "trackable" tracks,                        *
- *             sorts tracks for matching with the ITS,                      *
- *             calculates efficiency, resolutions etc.                      *
- *                                                                          *
- *           Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                 *
- * with several nice improvements by: M.Ivanov, GSI, m.ivanov@gsi.de        *
- ****************************************************************************/
+/// \file AliTPCComparison.C
+/// \brief Very important, delicate and rather obscure macro
+///
+/// Creates list of "trackable" tracks, sorts tracks for matching with the ITS,
+/// calculates efficiency, resolutions etc.
+///
+/// There is a possibility to run this macro over several events.
+///
+/// \author I.Belikov, CERN, Jouri.Belikov@cern.ch, M.Ivanov, GSI, m.ivanov@gsi.de
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include<fstream.h>
@@ -55,7 +54,9 @@ Int_t AliTPCComparison2(Int_t firstev=0, Int_t eventn=1) {
   /***********************************************************************/
 
   TFile *inkin = TFile::Open("rfio:galice.root");
-  //  if(gAlice)delete gAlice;   COMMENTED BECAUSE OF A BUG (IN COMPILED MODE)
+/// \file AliTPCComparison2.C
+///  if(gAlice)delete gAlice;   COMMENTED BECAUSE OF A BUG (IN COMPILED MODE)
+
   gAlice = (AliRun*)inkin->Get("gAlice");
   cout<<"AliRun object found on file "<<gAlice<<endl;
   AliKalmanTrack::SetFieldMap(gAlice->Field());
index 0b2ed795fe6538fd3a40e41b98b05eed255c8558..fc8aa658db221dd651c439ba4298e3e55c5f06af 100644 (file)
@@ -1,7 +1,10 @@
+/// \file AliTPCCreatePRF.C
+/// create prf
+/// with given parameters
+
 void AliTPCCreatePRF()
 { 
-  //create prf
-  //with given parameters
+
   TFile *f=TFile::Open("AliTPCprf2d.root","recreate");
   AliTPCPRF2D prf;
   prf.SetPad(0.4,0.75);
index bcf0335d73476269bdf06870b853cc1a5b013615..3346bca0742900d5865985220d46610fd50d2284 100644 (file)
@@ -1,7 +1,10 @@
+/// \file AliTPCCreatePRFGEM.C
+/// create prf
+/// with given parameters
+
 void AliTPCCreatePRFGEM()
 { 
-  //create prf
-  //with given parameters
+
   TFile *f=TFile::Open("AliTPCprf2dGEM.root","recreate");
   AliTPCPRF2D prf;
   prf.SetPad(0.4,0.75);
index e0c9aff5302e88a20b62bd25f9eefec4b8190031..e95846114b94644cebcc43abd6a9d8d63cfbaffc 100644 (file)
@@ -9,8 +9,9 @@
 
 
 void AliTPCDDL(Int_t eventNumber=0, Int_t eth=0){
-  //eth is a threshold.
-  //Digits stored into a file have an amplitude value greater than "eth"
+/// \file AliTPCDDL.C
+/// eth is a threshold.
+/// Digits stored into a file have an amplitude value greater than "eth"
 
   const char * inFile_new = "galice.root";
   AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","read");
index b5794d8fb05329460b2595ceec396e912616c062..cf2df0bcd2cd91611a907ae63b219bdf725bd2f4 100644 (file)
@@ -4,6 +4,7 @@
 #include "AliTPCCompression.h"
 #endif
 
+/// \file AliTPCDDLRawData.C
 
 void AliTPCDDLRawData(Int_t eventNumber=0, Int_t LDCsNumber=12){
   AliTPCDDLRawData *util=new AliTPCDDLRawData();
@@ -14,9 +15,9 @@ void AliTPCDDLRawData(Int_t eventNumber=0, Int_t LDCsNumber=12){
   util->SetVerbose(1);
   u->SetVerbose(1);  
   
-  //The Altro File "AltroFormatDDL.dat" is built from "AliTPCDDL.dat"
-  //util->RawDataAltro();
-  
+  // The Altro File "AltroFormatDDL.dat" is built from "AliTPCDDL.dat"
+  // util->RawDataAltro();
+
   /*
   //The file "AltroFormatDDL.dat" is converted in a txt file "AltroFormatDDL.txt"
   //that is used for debugging
index 2938ba01943338184a0c6ce38261ae8266b8d7dd..a9124f2cfb9557257e377927f7247362d9835c94 100644 (file)
@@ -1,6 +1,5 @@
-/****************************************************************************
- *           Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                 *
- ****************************************************************************/
+/// \file AliTPCDisplayDigits.C
+/// \author I.Belikov, CERN, Jouri.Belikov@cern.ch
 
 #ifndef __CINT__
 #include <Riostream.h>
index 759dfe9d3ec6389c05a1d343546ffa799c016b59..c711f90d6f8319dc0add149d028382ba6ce0520f 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-  Calculation of the Electric field:
-  Sollution of laplace equation in cartezian system, with boundary condition.
-  Se details:
-  http://web.mit.edu/6.013_book/www/chapter5/5.10.html
 
-
-*/
-
-/* $Id: AliTPCEfield.cxx 41275 2010-05-16 22:23:06Z marian $ */
+/// \class AliTPCEfield
+///
+/// Solution of Laplace equation in cartesian system, with boundary condition.
+///
+/// See details:
+/// http://web.mit.edu/6.013_book/www/chapter5/5.10.html
 
 #include "TTreeStream.h"
 #include "TMath.h"
@@ -30,8 +27,9 @@
 #include "TRandom.h"
 #include "AliTPCEfield.h"
 
+/// \cond CLASSIMP
 ClassImp(AliTPCEfield)
-
+/// \endcond
 
 AliTPCEfield* AliTPCEfield::fgInstance=0;
 
@@ -42,7 +40,8 @@ AliTPCEfield::AliTPCEfield():
   fIs2D(kTRUE),
   fWorkspace(0)   // file with trees, pictures ...
 {
-  //
+  /// 
+
   for (Int_t i=0; i<3; i++){
     fMin[i]=0; fMax[i]=0;
   }
@@ -57,7 +56,8 @@ AliTPCEfield::AliTPCEfield(const char* name, Int_t maxFreq, Bool_t is2D, Bool_t
   fUseLinear(useLinear),
   fWorkspace(0)   // file with trees, pictures ...
 {
-  //
+  /// 
+
   for (Int_t i=0; i<3; i++){
     fMin[i]=0; fMax[i]=0;
   }
@@ -67,15 +67,14 @@ AliTPCEfield::AliTPCEfield(const char* name, Int_t maxFreq, Bool_t is2D, Bool_t
 }
 
 void AliTPCEfield::MakeFitFunctions(Int_t maxFreq){
-  //
-  // fit functions = f(x,y,z) = fx(x)*fy(y)*fz(z)
-  // function can be of following types: 
-  // 0 - constant
-  // 1 - linear
-  // 2 - hypx
-  // 3 - hypy
-  // 4 - hypz
-  //
+  /// fit functions = \f$ f(x,y,z) = fx(x)*fy(y)*fz(z) \f$
+  /// function can be of following types:
+  /// 0 - constant
+  /// 1 - linear
+  /// 2 - hypx
+  /// 3 - hypy
+  /// 4 - hypz
+
   Int_t nfunctions=0;
   if (fIs2D)     nfunctions = 1+(maxFreq)*8;
   if (!fIs2D)    nfunctions = 1+(maxFreq)*8;
@@ -123,17 +122,15 @@ void AliTPCEfield::MakeFitFunctions(Int_t maxFreq){
 
 
 AliTPCEfield::~AliTPCEfield() {
-  //
-  // Destructor
-  //
+  /// Destructor
+
   if (fWorkspace) delete fWorkspace;
 }
 
 void AliTPCEfield::SetRange(Double_t x0, Double_t x1, Double_t y0, Double_t y1, Double_t z0,Double_t z1){
-  //
-  // Set the ranges - coordinates are rescaled in order to use proper
-  // cos,sin expansion in scaled space
-  //
+  /// Set the ranges - coordinates are rescaled in order to use proper
+  /// cos,sin expansion in scaled space
+
   fMin[0]=x0; fMax[0]=x1;
   fMin[1]=y0; fMax[1]=y1;
   fMin[2]=z0; fMax[2]=z1;
@@ -143,13 +140,12 @@ void AliTPCEfield::SetRange(Double_t x0, Double_t x1, Double_t y0, Double_t y1,
 
 
 void AliTPCEfield::AddBoundaryLine(Double_t x0,Double_t y0,Double_t z0,  Double_t v0, Double_t x1, Double_t y1, Double_t z1,Double_t v1, Int_t id, Int_t npoints){
-  //
-  // Add a e field boundary line
-  // From point (x0,y0) to point (x1,y1)
-  // Linear decrease of potential is assumed
-  // Boundary can be identified using boundary ID
-  // The line is written into tree Boundary
-  // 
+  /// Add a e field boundary line
+  /// From point (x0,y0) to point (x1,y1)
+  /// Linear decrease of potential is assumed
+  /// Boundary can be identified using boundary ID
+  /// The line is written into tree Boundary
+
   Double_t deltaX = (x1-x0);
   Double_t deltaY = (y1-y0);
   Double_t deltaZ = (z1-z0);
@@ -171,16 +167,15 @@ void AliTPCEfield::AddBoundaryLine(Double_t x0,Double_t y0,Double_t z0,  Double_
 }
 
 TTree * AliTPCEfield::GetTree(const char * tname){
-  //  
-  //
-  //
+  /// 
+
   return ((*fWorkspace)<<tname).GetTree();
 }
 
 Double_t AliTPCEfield::Field(Int_t ftype,  Double_t ifx, Double_t ify, Double_t ifz, Double_t x, Double_t y, Double_t z){
-  //
-  // Field component in 
-  // f frequency
+  /// Field component in
+  /// f frequency
+
   Double_t fx=1,fy=1,fz=1;
   const Double_t kEps=0.01;
   //
@@ -216,12 +211,9 @@ Double_t AliTPCEfield::Field(Int_t ftype,  Double_t ifx, Double_t ify, Double_t
 
 
 Double_t AliTPCEfield::FieldDn(Int_t ftype, Double_t ifx, Double_t ify, Double_t ifz, Int_t dn, Double_t x, Double_t y, Double_t z){
-  //
-  //
-  //
- //
-  // Field component in 
-  // f frequency
+ /// Field component in
+ /// f frequency
+
   Double_t fx=1,fy=1,fz=1;
   const Double_t kEps=0.01;
   //
@@ -266,12 +258,12 @@ Double_t AliTPCEfield::FieldDn(Int_t ftype, Double_t ifx, Double_t ify, Double_t
 
 
 Double_t AliTPCEfield::EvalField(Int_t ifun, Double_t x, Double_t y, Double_t z, Int_t type){
-  //
-  // Evaluate function ifun at position gx amd gy
-  // type == 0 - field
-  //      == 1 - Ex
-  //      == 2 - Ey
-  //      == 3 - Ez
+  /// Evaluate function ifun at position gx amd gy
+  /// type == 0 - field
+  ///      == 1 - Ex
+  ///      == 2 - Ey
+  ///      == 3 - Ez
+
   TMatrixD &mat    = *fFitFunctions;
   Int_t     fid   = TMath::Nint(mat(ifun,0));
   Double_t   ifx   = (mat(ifun,1));
@@ -284,12 +276,12 @@ Double_t AliTPCEfield::EvalField(Int_t ifun, Double_t x, Double_t y, Double_t z,
 }
 
 Double_t AliTPCEfield::Eval(Double_t x, Double_t y, Double_t z, Int_t type){
-  //
-  // Evaluate function ifun at position gx amd gy
-  // type == 0 - field
-  //      == 1 - Ex
-  //      == 2 - Ey
-  //      == 3 - Ez
+  /// Evaluate function ifun at position gx amd gy
+  /// type == 0 - field
+  ///      == 1 - Ex
+  ///      == 2 - Ey
+  ///      == 3 - Ez
+
   Double_t value=0;   
   Double_t lx= 2.*(x-(fMin[0]+fMax[0])*0.5)/fScale;
   Double_t ly= 2.*(y-(fMin[1]+fMax[1])*0.5)/fScale;
@@ -304,18 +296,16 @@ Double_t AliTPCEfield::Eval(Double_t x, Double_t y, Double_t z, Int_t type){
 }
 
 Double_t AliTPCEfield::EvalS(Double_t x, Double_t y, Double_t z,  Int_t type){
-  //
-  // static evaluation - possible to use it in the TF1 
-  //
+  /// static evaluation - possible to use it in the TF1
+
   return fgInstance->Eval(x,y,z,type);
 }
 
 void AliTPCEfield::FitField(){
-  //
-  // Fit the e field
-  // Minimize chi2 residuals at the boundary points 
-  // ?Tempoary sollution - integrals can be calculated analytically -
-  //
+  /// Fit the e field
+  /// Minimize chi2 residuals at the boundary points
+  /// ?Tempoary sollution - integrals can be calculated analytically -
+
   Int_t nfun=fFitFunctions->GetNrows();
   Double_t *fun =new Double_t[nfun];
   fFitter= new TLinearFitter(nfun, Form("hyp%d", nfun-1));
@@ -373,9 +363,8 @@ void AliTPCEfield::FitField(){
 
 
 TMatrixD* AliTPCEfield::MakeCorrelation(TMatrixD &matrix){
-  //
-  //
-  //
+  /// 
+
   Int_t nrows = matrix.GetNrows();
   TMatrixD * mat = new TMatrixD(nrows,nrows);
   for (Int_t irow=0; irow<nrows; irow++)
@@ -389,9 +378,8 @@ TMatrixD* AliTPCEfield::MakeCorrelation(TMatrixD &matrix){
 
 
 void AliTPCEfield::DumpField(Double_t gridSize, Double_t step){
-  //
-  //
-  //
+  /// 
+
   Double_t stepSize=0.001*fScale/fMaxFreq;
   //
   for (Double_t x = fMin[0]+stepSize; x<=fMax[0]-stepSize; x+=gridSize){
index 46408e60f703ca9fb0947dc31bf8daee62eef972..e32ea68461a0c140333a6cc25102600a08068d0b 100644 (file)
@@ -4,8 +4,8 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-/* $Id: AliTPCEfield.h 35613 2009-10-16 03:24:40Z marian $ */
-
+/// \class AliTPCEfield
+/// \brief Calculation of the electric field
 
 #include "TNamed.h"
 #include "TMatrixD.h"
@@ -21,7 +21,8 @@ public:
   void SetRange(Double_t x0, Double_t x1, Double_t y0, Double_t y1, Double_t z00,Double_t z1=0);
   void AddBoundaryLine(Double_t x0,Double_t y0, Double_t z0, Double_t v0, Double_t x1, Double_t y1, Double_t z1, Double_t v1, Int_t id=0, Int_t npoints=100);
   TTree * GetTree(const char * tname="Boundary");
-  //
+/// \class AliTPCEfield
+
   void MakeFitFunctions(Int_t maxFreq);
   void FitField();
   void DumpField(Double_t gridSize=5, Double_t step=0.5);
@@ -40,19 +41,19 @@ public:
   Double_t SinHNorm(Double_t x, Double_t norm){ return 0.5*(TMath::Exp(x-norm)-TMath::Exp(-x-norm));}
   Double_t CosHNorm(Double_t x, Double_t norm){ return 0.5*(TMath::Exp(x-norm)+TMath::Exp(-x-norm));}
  public:
-  Double_t fMin[3];      // range of coordinates from Min to Max
-  Double_t fMax[3];      //  
-  Double_t fScale;       // scaling factor
-  Int_t    fMaxFreq;     // maximal frequency of expansion
-  Bool_t   fIs2D;        // flag for 2D field
-  Bool_t   fUseLinear;   // flag to use also linear term of the field 
+  Double_t fMin[3];      ///< range of coordinates from Min to Max
+  Double_t fMax[3];      ///< 
+  Double_t fScale;       ///< scaling factor
+  Int_t    fMaxFreq;     ///< maximal frequency of expansion
+  Bool_t   fIs2D;        ///< flag for 2D field
+  Bool_t   fUseLinear;   ///< flag to use also linear term of the field
   //
-  TTreeSRedirector * fWorkspace;    //! workspace
-  TMatrixD  *fFitFunctions;         // fit function description
-  TVectorD  *fFitParam;             // fit parameters - coeficients
-  TMatrixD  *fFitCovar;             // fit covariance
-  TLinearFitter *fFitter;           // linear fitter - temporary solution - integrals to be calculated
-  static AliTPCEfield* fgInstance;  // instance of fied  - for visualization
+  TTreeSRedirector * fWorkspace;    //!< workspace
+  TMatrixD  *fFitFunctions;         ///< fit function description
+  TVectorD  *fFitParam;             ///< fit parameters - coeficients
+  TMatrixD  *fFitCovar;             ///< fit covariance
+  TLinearFitter *fFitter;           ///< linear fitter - temporary solution - integrals to be calculated
+  static AliTPCEfield* fgInstance;  ///< instance of fied  - for visualization
   ClassDef(AliTPCEfield,1)
 };
 
index 5f93a2a9ffc5b85a82781fda67439afd2690d1b2..57d298100003461fb3b238343958ceed65c3f805 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-////////////////////////////////////////////////////////////////////////////
-//                                                                        //
-// AliTPCExBConical class                                                   //
-// The class calculates the space point distortions due to the conical shape 
-// of ALICE TPC:
-//
-// Becasue of mechanical deformation ALICE TPC, chambers are misaligned in z direction
-// TPC has roughly conical shape
-//
-// For the moment ONLY efective correction used - NOT EDGE EFFECT calcualted //  
-//                                                           //
-//                     //
-// The class allows "effective Omega Tau" corrections.                    // 
-// 
-//                                                                        //
-// date: 02/05/2010                                                       //
-// Authors: Marian Ivanov, Jim Thomas, Magnus Mager, Stefan Rossegger     //
-//                                                                        //
-// Example usage:                                                         //
-//  AliTPCExBConical conical;                                                //
-//  conical.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB         //
-//  conical.SetXConical(0.001);   // set conical in X direction (in rad)     //
-//  // plot dRPhi distortions ...                                            //
-//  conical.CreateHistoDRPhiinZR(1.,100,100)->Draw("surf2");                //
-////////////////////////////////////////////////////////////////////////////
+/// \class AliTPCExBConical
+/// 
+/// Calculates the space point distortions due to the conical shape of ALICE TPC.
+/// 
+/// Becasue of mechanical deformation ALICE TPC, chambers are misaligned in z direction
+/// TPC has roughly conical shape
+/// 
+/// For the moment ONLY efective correction used - NOT EDGE EFFECT calcualted
+/// 
+/// The class allows "effective Omega Tau" corrections.
+/// 
+/// Example usage:
+///
+/// ~~~{.cxx}
+/// AliTPCExBConical conical;
+/// conical.SetOmegaTauT1T2(0.32,1.,1.); // values ideally from OCDB
+/// conical.SetXConical(0.001);   // set conical in X direction (in rad)
+/// // plot dRPhi distortions ...
+/// conical.CreateHistoDRPhiinZR(1.,100,100)->Draw("surf2");
+/// ~~~
+/// 
+/// \author Marian Ivanov, Jim Thomas, Magnus Mager, Stefan Rossegger
+/// \date 02/05/2010
+
 #include "AliMagF.h"
 #include "TGeoGlobalMagField.h"
 #include "AliTPCcalibDB.h"
@@ -63,25 +62,22 @@ AliTPCExBConical::AliTPCExBConical()
 }
 
 AliTPCExBConical::~AliTPCExBConical() {
-  //
-  // default destructor
-  //
+  /// default destructor
+
 }
 
 
 
 void AliTPCExBConical::Init() {
-  //
-  // Initialization funtion
-  //
-  
+  /// Initialization funtion
+
   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
   if (!magF) AliError("Magneticd field - not initialized");
-  Double_t bzField = magF->SolenoidField()/10.; //field in T
+  Double_t bzField = magF->SolenoidField()/10.; ///< field in T
   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
   if (!param) AliError("Parameters - not initialized");
-  Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
-  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t vdrift = param->GetDriftV()/1000000.; ///< [cm/us]   // From dataBase: to be updated: per second (ideally)
+  Double_t ezField = 400; ///< [V/cm]   // to be updated: never (hopefully)
   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
   // Correction Terms for effective omegaTau; obtained by a laser calibration run
   SetOmegaTauT1T2(wt,fT1,fT2);
@@ -90,16 +86,15 @@ void AliTPCExBConical::Init() {
 }
 
 void AliTPCExBConical::Update(const TTimeStamp &/*timeStamp*/) {
-  //
-  // Update function 
-  //
+  /// Update function
+
   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
   if (!magF) AliError("Magneticd field - not initialized");
-  Double_t bzField = magF->SolenoidField()/10.; //field in T
+  Double_t bzField = magF->SolenoidField()/10.; ///< field in T
   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
   if (!param) AliError("Parameters - not initialized");
-  Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
-  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t vdrift = param->GetDriftV()/1000000.; ///< [cm/us]   // From dataBase: to be updated: per second (ideally)
+  Double_t ezField = 400; ///< [V/cm]   // to be updated: never (hopefully)
   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
   // Correction Terms for effective omegaTau; obtained by a laser calibration run
   SetOmegaTauT1T2(wt,fT1,fT2);
@@ -110,9 +105,8 @@ void AliTPCExBConical::Update(const TTimeStamp &/*timeStamp*/) {
 
 
 void AliTPCExBConical::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
-  //
-  // Calculates the correction due conical shape
-  //   
+  /// Calculates the correction due conical shape
+
   AliTPCROC * calROC = AliTPCROC::Instance();
   const Double_t kRTPC0  =calROC->GetPadRowRadii(0,0);
   const Double_t kRTPC1  =calROC->GetPadRowRadii(36,calROC->GetNRows(36)-1);
@@ -136,10 +130,8 @@ void AliTPCExBConical::GetCorrection(const Float_t x[],const Short_t roc,Float_t
 }
 
 void AliTPCExBConical::Print(const Option_t* option) const {
-  //
-  // Print function to check the settings (e.g. the conical in the X direction)
-  // option=="a" prints the C0 and C1 coefficents for calibration purposes
-  //
+  /// Print function to check the settings (e.g. the conical in the X direction)
+  /// option=="a" prints the C0 and C1 coefficents for calibration purposes
 
   TString opt = option; opt.ToLower();
   printf("%s:%s\n",GetTitle(), GetName());
@@ -152,17 +144,15 @@ void AliTPCExBConical::Print(const Option_t* option) const {
 
 
 void AliTPCExBConical::SetConicalA(Float_t conicalA[3]){
-  //
-  // set paramters of conical shape - A side - obtained from alignment
-  //
+  /// set paramters of conical shape - A side - obtained from alignment
+
   fConicalA[0]= conicalA[0];  // constant
   fConicalA[1]= conicalA[1];  // cos 
   fConicalA[2]= conicalA[2];  // sin
 }
 void AliTPCExBConical::SetConicalC(Float_t conicalC[3]){
-  //
-  // set paramters of conical shape -C side obtained form the alignemnt
-  // 
+  /// set paramters of conical shape -C side obtained form the alignemnt
+
   fConicalC[0]= conicalC[0];  // constant
   fConicalC[1]= conicalC[1];  // cos 
   fConicalC[2]= conicalC[2];  // sin
index 547967ceddda51e1b373b8c8c66059b33684e914..241147e2acdf3aefa4bddba3ce2dd79bd36a4979 100644 (file)
@@ -4,12 +4,11 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-////////////////////////////////////////////////////////////////////////////
-//                                                                        //
-// AliTPCExBConical class                                                   //
-// date: 02/05/2010                                                       //
-// Authors: Maarian Ivanov, Jim Thomas, Magnus Mager, Stefan Rossegger                    //
-////////////////////////////////////////////////////////////////////////////
+/// \class AliTPCExBConical
+/// \brief Calculates the space point distortions due to the conical shape of ALICE TPC
+///
+/// \author Maarian Ivanov, Jim Thomas, Magnus Mager, Stefan Rossegger
+/// \date 02/05/2010
 
 #include "AliTPCCorrection.h"
 
@@ -48,11 +47,11 @@ protected:
   virtual void GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]);
 
 private:
-  Float_t fC1; // coefficient C1                 (compare Jim Thomas's notes for definitions)
-  Float_t fC2; // coefficient C2                 (compare Jim Thomas's notes for definitions)
-  Float_t  fConicalFactor;                  // empirical factor - transform conical angle to delta
-  Float_t  fConicalA[3];               // Conical shape parameterization A side
-  Float_t  fConicalC[3];               // Conical shape parameterization C side
+  Float_t fC1; ///< coefficient C1                 (compare Jim Thomas's notes for definitions)
+  Float_t fC2; ///< coefficient C2                 (compare Jim Thomas's notes for definitions)
+  Float_t  fConicalFactor;                  ///< empirical factor - transform conical angle to delta
+  Float_t  fConicalA[3];               ///< Conical shape parameterization A side
+  Float_t  fConicalC[3];               ///< Conical shape parameterization C side
 
   ClassDef(AliTPCExBConical,1);
 };
old mode 100755 (executable)
new mode 100644 (file)
index e27671010ab1404a2aa3c4512e6fd5ab57211137..2de42a1160840bdeaa9225cbac4ca78d70ede17d 100644 (file)
@@ -1,6 +1,7 @@
-////////////////////////////////////////////////
-// Dubna, 22 Jan 2003                         //
-////////////////////////////////////////////////
+/// \file AliTPCSavePID.C
+/// 
+/// \author Dubna, 22 Jan 2003
+
 Int_t AliTPCSavePID(Int_t emax=3) {
 ///////////////////////////////////////
 #include<fstream.h>
index 3c2cd4472c4e2361fc43e9cd0b1043499c920c3b..f15722c56ed2d859ead101b42ca399e872ac989a 100644 (file)
@@ -1,7 +1,8 @@
-///////////////////////////////////////////////////////////
-// Test macro for AliTPCtracksPid.root file            //
-// JINR Dubna Aug 2002                                   //
-///////////////////////////////////////////////////////////
+/// \file AliTPCScanPID.C
+/// \brief Test macro for AliTPCtracksPid.root file
+///
+/// \author JINR Dubna Aug 2002
+
 void
 AliTPCScanPID(Int_t evNumber2=3) {
   //................. Prepare histogramms ................
index 9dbdb6678575f3b521e0852a5f5be3fe5e3e0101..1a26192ac920d61204bdc939d8a03bebf7d9adc6 100644 (file)
@@ -8,41 +8,39 @@
 
 #endif
 
-// Marian Ivanov
-// test of the tpc merging using AliRunDigitizer and 
-// TPC  Hits2Digits, Hits2SDigits and SDigits2Digits macros
-
-// preparation  
-// 0. make 2 directorys - ev1 and ev2
-
-// 1.make hits, digits,sdigits and sdigits-digits in both directories 
-//  1.a  galice -b -q grun.C and produce hits
-//  1.b. cp galice.root galice.root.hits
-//  1.c  run AliTPCHits2Digits.C
-//  1.d  cp galice.root galice.root.digits
-//  1.e  copy back cp galice.root.hits galice.root
-//  1.f  run AliTPCSDigits2Digits.C
-//  1.g  cp galice.root  galice.root.sdigits
-//  1.h  run AliTPCSDigits2Digit.C 
-//  1.i  cp galice.root galice.root.dig2
-
-// 2. cp ev1/galice.root/galice.root.sdigit galice.root
-// 3. load this macro and run testmerge()
-
-// 4. run test function bellow to compare merged digits with original one
-// 5. to be  noticed output ftom testx() function - should be bigger than
-//    noise because in proces of digitisation we use different seed
-//    of random numbers for diffusion and gas gain
-//    -anyway in place where we have the signal should occur the signal in both casses
-//    - only the amplitude should be different - by factor of sqrt
-
+/// \file AliTPCTestMerge.C
+///
+/// test of the tpc merging using AliRunDigitizer and
+/// TPC  Hits2Digits, Hits2SDigits and SDigits2Digits macros
+/// preparation
+/// 0. make 2 directorys - ev1 and ev2
+/// 1.make hits, digits,sdigits and sdigits-digits in both directories
+///  1.a  galice -b -q grun.C and produce hits
+///  1.b. cp galice.root galice.root.hits
+///  1.c  run AliTPCHits2Digits.C
+///  1.d  cp galice.root galice.root.digits
+///  1.e  copy back cp galice.root.hits galice.root
+///  1.f  run AliTPCSDigits2Digits.C
+///  1.g  cp galice.root  galice.root.sdigits
+///  1.h  run AliTPCSDigits2Digit.C
+///  1.i  cp galice.root galice.root.dig2
+/// 2. cp ev1/galice.root/galice.root.sdigit galice.root
+/// 3. load this macro and run testmerge()
+/// 4. run test function bellow to compare merged digits with original one
+/// 5. to be  noticed output ftom testx() function - should be bigger than
+///    noise because in proces of digitisation we use different seed
+///    of random numbers for diffusion and gas gain
+///    -anyway in place where we have the signal should occur the signal in both casses
+///    - only the amplitude should be different - by factor of sqrt
+///
+/// \author Marian Ivanov
       
 void testmerge()
 {
-  // merge two example events
-  //
-  //it merge two events -one from current directory -second from directory ev2
-  
+  /// merge two example events
+  //
+  //it merge two events -one from current directory -second from directory ev2
+
   if(gAlice) delete gAlice;
   AliRunDigitizer * manager = new AliRunDigitizer(2,1);
   manager->SetTreeDTPCBaseName("TreeD_75x40_100x60_150x60_");
@@ -62,9 +60,10 @@ void testmerge()
 
 void drawmerged(Int_t sec, Int_t row, Int_t x1=-1, Int_t x2=-1, Int_t y1=-1, Int_t y2=-1)
 {
-  //if you think that there is memory leak -
-  //you are tru but othervise graphic doesn't work
-  // sec=0; row =0;
+  /// if you think that there is memory leak -
+  /// you are tru but othervise graphic doesn't work
+  /// sec=0; row =0;
+
   TFile * f = new TFile("galice.root");
   TFile * f1= new TFile("ev1/galice.root.digits");
   TFile * f2= new TFile("ev2/galice.root.digits");
@@ -140,8 +139,9 @@ void drawd(TFile * f, Int_t amp1, Int_t amp2)
 }
 
 void test1(){
-  //test of the merged digits
-  //compare merged digits with standard digits
+  /// test of the merged digits
+  /// compare merged digits with standard digits
+
   TFile f("galice.root");
   TFile f1("ev1/galice.root.digits");
   TFile f2("ev2/galice.root.digits");
@@ -180,8 +180,8 @@ void test1(){
 }
 
 void test5(){
-  //
-  //compare merged digits with digits obtained hits2sdig->sdigtodig
+  /// compare merged digits with digits obtained hits2sdig->sdigtodig
+
   TFile f("galice.root");
   TFile f1("ev1/galice.root.dig2");
   TFile f2("ev2/galice.root.dig2");
@@ -225,7 +225,8 @@ void test5(){
 }
 
 void test3(){
-  //test of the merged digits
+  /// test of the merged digits
+
   TFile f("galice.root");
   TFile f1("ev1/galice.root.sdigits");
   TFile f2("ev2/galice.root.sdigits");
@@ -270,8 +271,9 @@ void test3(){
 
 
 void TestSDigitsDig2(){
-  //test of the digits produced by the Hits2Digits 
-  //and Hits2SDigits - SDigits2Digits chain
+  /// test of the digits produced by the Hits2Digits
+  /// and Hits2SDigits - SDigits2Digits chain
+
   TFile f1("galice.root.digits");
   TFile f2("galice.root.dig2");
   //
@@ -323,8 +325,9 @@ void TestSDigitsDig2(){
 }
 
 void TestSDigitsDig1(){
-  //test of the digits produced by the Hits2Digits 
-  //and Hits2SDigits - SDigits2Digits chain
+  /// test of the digits produced by the Hits2Digits
+  /// and Hits2SDigits - SDigits2Digits chain
+
   TFile f1("galice.root.digits");
   TFile f2("galice.root.dig2");
   //
@@ -370,7 +373,8 @@ void TestSDigitsDig1(){
 
 
 void test4(){
-  //TPC internal test
+  /// TPC internal test
+
   TFile f1("galice.root.sdigits");
   TFile f2("galice.root.digits");
   TTree * tree1 = (TTree*)f1.Get("TreeS_75x40_100x60_150x60_0");
index 597cb47abffd856f00f93c2ee7bf45d5094bb86a..4af245c739a35e66e5c025dbd8e1af91491618d4 100644 (file)
@@ -1,7 +1,7 @@
-//
-// Process ESD tracks  - 
-// Extract TPC tracks  - write them to tree
-//
+/// \file AnalyzeESDtracks.C
+/// 
+/// \brief Process ESD tracks - extract TPC tracks - write them to tree
+
 /*
   .L AnalyzeESDtracks.C+
   .L AliGenInfo.C+
index 9f9cc0dc5728ecb03b63ac225190e81fac8e45b1..6cdceb9fbfcfd63dfb17f3579244349a70d527ca 100644 (file)
@@ -1,7 +1,12 @@
+/// \file ClassTree.C
+/// \brief Macro generated from canvas: ClassTree
+///
+/// \author ROOT version 2.21/07
+/// \date Tue Jun 1 17:01:38 1999
+
 void ClassTree()
 {
-//=========Macro generated from canvas: ClassTree/
-//=========  (Tue Jun  1 17:01:38 1999) by ROOT version 2.21/07
+
    TCanvas *ClassTree = new TCanvas("ClassTree", "",186,135,594,449);
    ClassTree->SetHighLightColor(2);
    ClassTree->Range(0,5,20,20);
index dda1da48af1dc21fbcc6613348ebfbe8d0625959..405d7f69ff8e4f039f5b85895bfcb1a2056ca4f0 100644 (file)
@@ -1,8 +1,13 @@
-// One can use the configuration macro in compiled mode by
-// root [0] gSystem->Load("libgeant321");
-// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
-//                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
-// root [0] .x grun.C(1,"ConfigKr.C++")
+/// \file ConfigKr.C
+///
+/// One can use the configuration macro in compiled mode by
+///
+/// ~~~{.c++}
+/// gSystem->Load("libgeant321");
+/// gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
+///                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
+/// .x grun.C(1,"ConfigKr.C++")
+/// ~~~
 
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include <Riostream.h>
index 39336ad241e4de8e028b8f019af62f059ee9ccd8..6d5a4ff750465d45b46f4bbee33cef62e2619601 100644 (file)
@@ -1,23 +1,19 @@
-
-/****************************************************************************
- *           Origin: A.Matyja amatyja@cern.ch                               *
- ****************************************************************************/
-
-/*
-
-  macro to create array of clusters from TPC digits
-  input files - galice.root 
-                digits.root - file with digits - usualy use link to galice.root
-                           - in splitted mode - neccesary to create link to proper file
-                           
-   output file - TPC.RecPoints.root
-
-
-//  Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything
-              
-*/
-
+/// \file FindKrClusters.C
+/// \brief Macro to create array of clusters from TPC digits
+///
+/// Input files:
+///
+/// * galice.root 
+/// * digits.root: file with digits - usualy use link to galice.root
+///   in splitted mode - neccesary to create link to proper file
+///
+/// Output file:
+///
+/// * TPC.RecPoints.root
+///
+/// Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything
+///
+/// \author A.Matyja amatyja@cern.ch
 
 #ifndef __CINT__
 #include <iostream.h>
index e9479d40dc8c590d38a9b35eac2670e4a7d86898..29421110abb549a9458f9ce7e15c203d1f55c3f1 100644 (file)
@@ -1,4 +1,4 @@
-//
+/// \file FindKrClustersRaw.C
 
 Int_t FindKrClusterCheck(const char *fileName="data.root");
 
index 4b9c638227fed43488e736a60d92b610470249ea..9da6f4fd5a18281e26f9bcc709d744b9d8483776 100644 (file)
@@ -12,8 +12,9 @@ class TLandauMean: public TObject {
 public:
   void Init(Int_t n, Float_t mean, Float_t sigma);  // initial parameters
   void Gener();          // gener sample 
-  //  void Anal();
-  //
+
+  // void Anal();
+
   Int_t fNSample;      // number of samples
   Float_t fLMean;        // landau mean
   Float_t fLSigma;       // landau sigma
@@ -38,8 +39,8 @@ ClassImp(TLandauMean)
 
 void TLandauMean::Init(Int_t n, Float_t mean, Float_t sigma)
 {
-  //
-  //init parameters
+  /// init parameters
+
   fNSample = n;
   fLMean   = mean;
   fLSigma  = sigma;
@@ -69,8 +70,8 @@ Float_t TLandauMean::Moment3(Float_t sumi1, Float_t sumi2, Float_t sumi3, Int_t
 
 void TLandauMean::Gener()
 {
-  // 
-  // generate sample
+  /// generate sample
+
   Float_t * buffer = new Float_t[fNSample];
   
   for (Int_t i=0;i<fNSample;i++) {
index 464acc8c59575fb00c4222f2a6617cf7c34454b1..7dc3521f9a5bacd675fd46ce3d32af15cc240c14 100644 (file)
@@ -1,7 +1,9 @@
-void MakeTPCAltroMapping(){
-  // Create TObjArray of TPC altro mapping objects and
-  // store it in the CDB
-  //
+/// \file MakeTPCAltroMapping.C
+///
+/// \brief Create TObjArray of TPC altro mapping objects and store it in the CDB
+
+void MakeTPCAltroMapping() {
+
   const char* macroname = "MakeTPCAltroMapping.C";
 
   TObjArray mappingsArray(6);
index 6d01a793353ffcb36eca61e3242d0c628ff6b961..353a6e2e562fb93c750169b2cfccb32142de0364 100644 (file)
@@ -1,6 +1,8 @@
+/// \file MakeTPCFullMisAlignment.C
+/// \brief Create TClonesArray of full misalignment objects for TPC
+
 void MakeTPCFullMisAlignment(){
-  // Create TClonesArray of full misalignment objects for TPC
-  //
+
   const char* macroname = "MakeTPCFullMisAlignment.C";
   // Activate CDB storage and load geometry from CDB
   AliCDBManager* cdb = AliCDBManager::Instance();
index 2462b0d983438f7e0e560b52cca3a19580639053..b622894decdf51039150b2d0fd6e54f4bb8faf19 100644 (file)
@@ -1,6 +1,8 @@
-void MakeTPCResMisAlignment(){
-  // Create TClonesArray of residual misalignment objects for TPC
-  //
+/// \file MakeTPCResMisAlignment.C
+/// \brief Create TClonesArray of residual misalignment objects for TPC
+
+void MakeTPCResMisAlignment() {
+
   const char* macroname = "MakeTPCResMisAlignment.C";
 
   // Activate CDB storage and load geometry from CDB
index 9661b4c5aece029e90d4ae2cd2b1f59327bd1d42..2ab697852c3615c3aec5e3d215b5084a7df843fd 100644 (file)
@@ -1,6 +1,8 @@
+/// \file MakeTPCZeroMisAlignment.C
+/// \brief Create TClonesArray of zero misalignment objects for TPC
+
 void MakeTPCZeroMisAlignment(){
-  // Create TClonesArray of zero misalignment objects for TPC
-  //
+
   const char* macroname = "MakeTPCZeroMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",100);
index baca15ee9cbba10a49ae5f7ca974e1f659474bc5..57b4f00cea3537c3a0ae73e8b70d7e9780c6a92c 100644 (file)
@@ -1,6 +1,7 @@
-AliTPCParam *SetTPCParamOptional(){
+/// \file SetTPCParamOptional.C
+/// \brief Optional set of parameters
 
-  // optional set of parameters
+AliTPCParam *SetTPCParamOptional(){
 
   AliTPCParam *par=new AliTPCParamSR;
   par->SetTitle("optional"); //This is a dummy code ! Just to change something
index 4ce603349c168f3180bdab52deaa3ed93dcbaf55..fd89e5865129756504ce8c5e87eca5512d2f194b 100644 (file)
@@ -213,7 +213,8 @@ void AliTPCLaserTrack::LoadTracks()
     fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack);
   }
 
-  delete arrLaserTracks;
+  //do not delete - the entry is cached in the OCDB manager and is cleaned up there
+  //delete arrLaserTracks;
 }
 
 
index f2b1446499f1068bd8f41a74d8c704e53d3d7b1d..530c2bd3a0ddb7ba2365ae15fc7b5a90b37e8c4a 100644 (file)
@@ -3349,7 +3349,16 @@ TTree* AliTPCcalibDButil::ConnectDistortionTrees(TString baseDir, TString  selec
   }
   TObjArray *arrInputTreesDistortionCalib = inputTreesDistortionCalib.Tokenize("\n");  
   //
+  TString treePrefix="";
   for (Int_t itree=0; itree<arrInputTreesDistortionCalib->GetEntriesFast(); ++itree) {
+    TString fstring = arrInputTreesDistortionCalib->At(itree)->GetName();
+    if (fstring.Index("Prefix:")==0){ //get tree descriptor
+      treePrefix=TString(&(fstring[7]));
+      continue;
+    }
+    if (fstring.Index("#")==0){  // ignore comment field
+      continue;
+    }
     TFile *finput= TFile::Open(arrInputTreesDistortionCalib->At(itree)->GetName());
     TString strFile=arrInputTreesDistortionCalib->At(itree)->GetName();
     TObjArray *path=strFile.Tokenize("/");
@@ -3362,7 +3371,12 @@ TTree* AliTPCcalibDButil::ConnectDistortionTrees(TString baseDir, TString  selec
       if (strstr(key->GetClassName(),"TTree")==0) continue;
       TTree * tree  = dynamic_cast<TTree*>(finput->Get(list->At(ikey)->GetName()));
       if (!tree) continue;
-      TString friendName=TString::Format("%s.%s.%s",path->At(plength-3)->GetName(),path->At(plength-2)->GetName(), tree->GetName()); 
+      TString friendName="";
+      if (treePrefix.Length()==0) {
+       friendName=TString::Format("%s.%s.%s",path->At(plength-3)->GetName(),path->At(plength-2)->GetName(), tree->GetName()); 
+      }else{
+       friendName=TString::Format("%s.%s",treePrefix.Data(), tree->GetName()); 
+      }
       ::Info("AliTPCcalibDButil::ConnectDistortionTrees","%s",friendName.Data());  
       if (tMain==0) {
        tMain=tree;
index 8e81dd8c758bbb8b5d5700330a3a0e18f5156b13..f8a6bea0e45f846028d97173c444ad06ed58e394 100644 (file)
@@ -57,14 +57,14 @@ void AliAnalysisTaskPt::ConnectInputData(Option_t *)
     */
 
     AliVEventHandler *esdH = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
-    TString classInputHandler = esdH->ClassName();
-
-    Printf("----> AliAnalysisTaskPt: ClassName of handler = %s", classInputHandler.Data());
+    TString classInputHandler;
 
     if (!esdH) {
       Printf("ERROR: Could not get ESDInputHandler");
     } 
     else {
+      classInputHandler = esdH->ClassName();
+      Printf("----> AliAnalysisTaskPt: ClassName of handler = %s", classInputHandler.Data());
       Printf("----> AliAnalysisTaskPt::ConnectInputData Getting the event from handler %p", esdH);
       fESD = esdH->GetEvent();
       if (fUseFriends){
index dab0215b5851feb2b9a8b0c3982ae42e6883bbaf..513786ae05d9bf151ed9fd93f7a374309b542bf8 100644 (file)
@@ -1,10 +1,12 @@
-/*
- .L AliGenInfo.C+
- .L TestAnalisys.C+
- AddChains(868);    // AddChains(runNumber);
-  Select();          // make default selection of data
-  MakePictures("pic868");
-*/
+/// \file TestAnalisys.C
+///
+/// ~~~{.cxx}
+/// .L AliGenInfo.C+
+/// .L TestAnalisys.C+
+/// AddChains(868);    // AddChains(runNumber);
+///  Select();          // make default selection of data
+///  MakePictures("pic868");
+/// ~~~
 
 #include "TFile.h"
 #include "TTree.h"
@@ -49,7 +51,7 @@ void P3Z(TCut cut0, TCut cut1,  char * description);
 void ResYZ(TCut cut0, TCut cut1,  char * description);
 void SysYX(TCut cut0,  char * description);
 void SysZX(TCut cut0,  char * description);
-//
+
 TProfile * ProfileMaxRow(TCut cut0, char *name, Int_t max);
 TProfile * ProfileMaxPhi(TCut cut0, char *name, Int_t max);
 TProfile * ProfileMaxZ(TCut cut0, char *name, Int_t max);
index 58184a46d3799084872f09b02c47e9d443956d69..47c6ff94bab9716d6347be1db63f3aaa0a8cbd73 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
-
-/*
-  Author : MI
-  macro to compare TClonesArray hits with interpolated hits
-  ConvertHits1 read 
-*/
+/// Macro to compare TClonesArray hits with interpolated hits
+/// ConvertHits1 read 
+///
+/// \author MI
 
 #include "alles.h"
 #include "AliObjectArray.h"
 #include "AliArrayBranch.h"
 #include "TestTPCTrackHits.h"
  
+/// \cond CLASSIMP
 ClassImp(AliTPChitD)
+/// \endcond
  
 void CompareHits(TClonesArray * arr, AliTPCTrackHits * myhits,  Bool_t debug, TClonesArray *arrd=0);
 AliTPCTrackHits * MakeTrack(TClonesArray * arr, TClonesArray * arrp, AliTPCTrackHits *myhits);
 
 void ConvertHits(const char * benchmark, Bool_t debug)
 {      
-  //
-  //convert - not parametrised hits stored in Clones array
-  //to
 
+  /// convert - not parametrised hits stored in Clones array
+  /// to
 
   TFile f("galice.root","update");  
   TClonesArray *arr = new TClonesArray("AliTPChit",100);
index a270aae5fa94faa56f1a747e54b7305ed764de89..652627c9504c1c5e08d1b6cd1b6153f19fdc3b57 100644 (file)
@@ -3,17 +3,18 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-/* $Id$ */
-
-
 void ConvertHits(const char * benchmark="0", Bool_t debug=kFALSE);
 void CompareHits(const char * benchmark="1", Bool_t debug=kFALSE);
 
+/// \class AliTPChitD
+/// \brief Macro to compare TClonesArray hits with interpolated hits
+/// \author MI
+
 class AliTPChitD : public AliTPChit {
 public:
   AliTPChit * GetDelta() {return &fDelta;}
 private:
-  AliTPChit fDelta;     //delta of hit information 
+  AliTPChit fDelta;     ///< delta of hit information
   ClassDef(AliTPChitD,1) 
 };
 #endif
index de411864d36b67f3f92824721fdfd9af78bddb27..188e8abca03b87bdb07555526170d7cdc46ffc00 100644 (file)
@@ -1,10 +1,8 @@
-//
-// example macro for reconstruction of the TPC raw data
-//
-// The path to the Calibration parameters is for the moment hard-wired in the code
-// Taken from /afs/
-//
-//
+/// \file recTPC.C
+/// \brief Example macro for reconstruction of the TPC raw data
+/// 
+/// The path to the Calibration parameters is for the moment hard-wired in the code
+/// Taken from /afs
 
 void recTPC(Int_t type, const char *filename="data.root")
 {
index ac4816f452cc7220ec4f8f9cf2dd54e460973496..e20ac3ce9b37a41871e3db89130cdd01804c741a 100644 (file)
@@ -244,8 +244,8 @@ Float_t AliTRDCommonParam::GetOmegaTau(Float_t vdrift)
   else if (IsXenon()) {
 
     Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
-    ib       = TMath::Max(  0,ib);
-    ib       = TMath::Min(kNb,ib);
+    ib       = TMath::Max(    0,ib);
+    ib       = TMath::Min(kNb-1,ib);
 
     Float_t alphaL = p0[ib] 
                    + p1[ib] * vdrift
@@ -305,8 +305,8 @@ Bool_t AliTRDCommonParam::GetDiffCoeff(Float_t &dl, Float_t &dt, Float_t vdrift)
     Float_t p3L[kNbL] = {  0.000195,  0.000189,  0.000195,  0.000182,  0.000169 };
     
     Int_t ibL = ((Int_t) (10 * (field - 0.15)));
-    ibL       = TMath::Max(   0,ibL);
-    ibL       = TMath::Min(kNbL,ibL);
+    ibL       = TMath::Max(     0,ibL);
+    ibL       = TMath::Min(kNbL-1,ibL);
     
     fDiffusionL = p0L[ibL] 
                 + p1L[ibL] * vdrift
@@ -321,8 +321,8 @@ Bool_t AliTRDCommonParam::GetDiffCoeff(Float_t &dl, Float_t &dt, Float_t vdrift)
     Float_t p3T[kNbT] = {  0.000131,  0.000122,  0.000111,  0.000098,  0.000085 };
 
     Int_t ibT= ((Int_t) (10 * (field - 0.15)));
-    ibT      = TMath::Max(   0,ibT);
-    ibT      = TMath::Min(kNbT,ibT);
+    ibT      = TMath::Max(     0,ibT);
+    ibT      = TMath::Min(kNbT-1,ibT);
 
     fDiffusionT = p0T[ibT] 
                 + p1T[ibT] * vdrift
index 1365c11f7a3d7dd228da3abc605685a329c5a0e9..99c57520d56daca938399c7dbfd02e69dc108e18 100644 (file)
@@ -56,7 +56,7 @@ generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
 
 # Generate the ROOT map
 # Dependecies
-set(LIBDEPS STEERBase STEER EVGEN Reflex Html TreePlayer XMLParser)
+set(LIBDEPS STEERBase STEER EVGEN Html TreePlayer XMLParser)
 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
 
 # Add a library to the project using the specified source files
index b95c7651e195c613bd55dec6ddd22a8982f4c951..417be9ff37aab23096c89cb3e0c9f4c0ffbf7284 100644 (file)
@@ -221,10 +221,12 @@ void AliZDCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) co
   // loop over digits
   Float_t tZN1Corr[10], tZP1Corr[10], tZN2Corr[10], tZP2Corr[10]; 
   for(Int_t i=0; i<10; i++) tZN1Corr[i] = tZP1Corr[i] = tZN2Corr[i] = tZP2Corr[i] = 0.;  
-  Float_t dZEM1Corr[2]={0,0}, dZEM2Corr[2]={0,0}, sPMRef1[2]={0,0}, sPMRef2[2]={0,0}; 
+  Float_t dZEM1Corr[2]={0,0}, dZEM2Corr[2]={0,0}, sPMRef1[]={0,0}, sPMRef2[2]={0,0}; 
   
   Int_t digNentries = digitsTree->GetEntries();
-  Float_t ootDigi[kNch]; Int_t i=0;
+  Float_t ootDigi[kNch]; 
+  for(int l=0; l<kNch; l++) ootDigi[l]=0.;
+  Int_t i=0;
   // -- Reading out-of-time signals (last kNch entries) for current event
   if(fPedSubMode==1){
     for(Int_t iDigit=kNch; iDigit<digNentries; iDigit++){
@@ -251,11 +253,11 @@ void AliZDCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) co
    }
    else pedindex = (det-1)/3+22;
    //
-   if(fPedSubMode==0){
+   if(fPedSubMode==0 && pedindex>-1){
      ped2SubHg = meanPed[pedindex];
      ped2SubLg = meanPed[pedindex+kNch];
    }
-   else if(fPedSubMode==1){
+   else if(fPedSubMode==1 && pedindex>-1){
      ped2SubHg = corrCoeff1[pedindex]*ootDigi[pedindex]+corrCoeff0[pedindex];
      ped2SubLg = corrCoeff1[pedindex+kNch]*ootDigi[pedindex+kNch]+corrCoeff0[pedindex+kNch];
    }
@@ -373,7 +375,7 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
   
   Float_t tZN1Corr[10], tZP1Corr[10], tZN2Corr[10], tZP2Corr[10]; 
   for(Int_t i=0; i<10; i++) tZN1Corr[i] = tZP1Corr[i] = tZN2Corr[i] = tZP2Corr[i] = 0.;
-  Float_t dZEM1Corr[2]={0,0}, dZEM2Corr[2]={0,0}, sPMRef1[2]={0,0}, sPMRef2[2]={0,0}; 
+  Float_t dZEM1Corr[2]={0,0}, dZEM2Corr[2]={0,0}, sPMRef1[]={0,0}, sPMRef2[2]={0,0}; 
 
   Bool_t isScalerOn=kFALSE;
   Int_t jsc=0, itdc=0, iprevtdc=-1, ihittdc=0;
index f20109311641975bb4faea1e825032865c1500fa..e01fa38249da2cd256ad9600cffeeb016c4eebae 100644 (file)
@@ -476,21 +476,7 @@ void AliZDCDigitizer::ReadPMTGains()
   }
   fclose(fdata);
   
-  if(((fBeamType.CompareTo("P-P")) == 0) || ((fBeamType.CompareTo("p-p")) == 0)){
-    for(int i=0; i<12; i++){
-      if(beam[i]==0 && fBeamEnergy!=0.){
-        if(det[i]!=31 && det[i]!=32){
-         for(Int_t j=0; j<5; j++) fPMGain[det[i]-1][j] = gain[i]*(aEne[i]/fBeamEnergy+bEne[i]);
-       }
-        else if(det[i] == 31) fPMGain[2][1] = gain[i]*(aEne[i]-fBeamEnergy*bEne[i]);
-       else if(det[i] == 32) fPMGain[2][2] = gain[i]*(aEne[i]-fBeamEnergy*bEne[i]);
-      }
-    }
-    //
-    printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for p-p @ %1.0f+%1.0f GeV: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
-       fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]);     
-  }
-  else if(((fBeamType.CompareTo("A-A")) == 0)){
+  if(((fBeamType.CompareTo("A-A")) == 0)){
     for(int i=0; i<12; i++){
       if(beam[i]==1){
         Float_t scalGainFactor = fBeamEnergy/2760.;
@@ -503,8 +489,8 @@ void AliZDCDigitizer::ReadPMTGains()
       }
      }  
      //
-     printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for Pb-Pb @ %1.0f+%1.0f A GeV: ZN(%1.0f), ZP(%1.0f), ZEM(%1.0f)\n",
-       fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1]);
+     printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for %s @ %1.0f+%1.0f A GeV: ZN(%1.0f), ZP(%1.0f), ZEM(%1.0f)\n",
+       fBeamType.Data(),fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1]);
   }
   else if(((fBeamType.CompareTo("p-A")) == 0) || ((fBeamType.CompareTo("P-A")) == 0)){
     for(int i=0; i<12; i++){
@@ -524,8 +510,8 @@ void AliZDCDigitizer::ReadPMTGains()
        }
       }
     }
-    printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for p-Pb: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
-       fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]);
+    printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for %s: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
+       fBeamType.Data(),fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]);
   }
   else if(((fBeamType.CompareTo("A-p")) == 0) || ((fBeamType.CompareTo("A-P")) == 0)){
     for(int i=0; i<12; i++){
@@ -545,9 +531,24 @@ void AliZDCDigitizer::ReadPMTGains()
        }
       }
     }
-    printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for Pb-p: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
-       fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]);
+    printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for %s: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
+       fBeamType.Data(),fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]);
   }
+  else{ // Setting pp gains as default value
+    for(int i=0; i<12; i++){
+      if(beam[i]==0 && fBeamEnergy!=0.){
+        if(det[i]!=31 && det[i]!=32){
+         for(Int_t j=0; j<5; j++) fPMGain[det[i]-1][j] = gain[i]*(aEne[i]/fBeamEnergy+bEne[i]);
+       }
+        else if(det[i] == 31) fPMGain[2][1] = gain[i]*(aEne[i]-fBeamEnergy*bEne[i]);
+       else if(det[i] == 32) fPMGain[2][2] = gain[i]*(aEne[i]-fBeamEnergy*bEne[i]);
+      }
+    }
+    //
+    printf("\n    AliZDCDigitizer::ReadPMTGains -> ZDC PMT gains for %s @ %1.0f+%1.0f GeV: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
+       fBeamType.Data(),fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]);     
+  }
+
 }
 
 //_____________________________________________________________________________
diff --git a/cmake/CMakeLists.example b/cmake/CMakeLists.example
new file mode 100644 (file)
index 0000000..d175edb
--- /dev/null
@@ -0,0 +1,245 @@
+# **************************************************************************
+# * Copyright(c) 1998-2015, ALICE Experiment at CERN, All rights reserved. *
+# *                                                                        *
+# * Author: The ALICE Off-line Project.                                    *
+# * Contributors are mentioned in the code where appropriate.              *
+# *                                                                        *
+# * 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   *
+# * copies and that both the copyright notice and this permission notice   *
+# * appear in the supporting documentation. The authors make no claims     *
+# * about the suitability of this software for any purpose. It is          *
+# * provided "as is" without express or implied warranty.                  *
+# **************************************************************************
+
+############################################################################
+# GENERAL SETTINGS                                                         #
+############################################################################
+
+# CMake configuration is controlled through CMakeLists files.
+#   - Normally a single CMakeLists files should contain a single target/library.
+#   - The file below tries to offer a standard format for generating libraries
+#     but full access to cmake functions and utilities is possible.
+#    - For any customization please use instructions provided by the minum cmake 
+#     version 2.8.11
+#     http://www.cmake.org/cmake/help/v2.8.11/cmake.html
+
+# Module name
+# Module name translates into library name
+# Ex: set(MODULE ANALYSIS)
+set(MODULE ModuleNameExample)
+
+# Module include folder
+#  - Add here all include folders containing headers that belong
+#    to this module. 
+#  - Do not add dependencies here
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+# For more information about include_directories please read 
+# documentation for minimum required version:
+# http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:include_directories
+# Ex: include_directories(${AliRoot_SOURCE_DIR}/ANALYS/${MODULE})
+include_directories()
+
+# Additional include folders in alphabetical order except ROOT
+#  - ROOT include folders are added by the FindROOT macro
+#  - To remove compilation warnings related to dependencies headers
+#    please add them as SYSTEM headers.
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+# For more information about include_directories please read 
+# documentation for minimum required version:
+# http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:include_directories
+# Ex: include_directories(${AliRoot_SOURCE_DIR}/STEER/STEERBase
+#                   )
+include_directories(
+                   )
+
+# Library sources in alphabetical order
+#  - Only these sources will be added to the library
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+# Ex:
+#set(SRCS
+#    AliAnalysisDataContainer.cxx
+#    AliAnalysisDataSlot.cxx
+#   )
+set(SRCS
+   )
+
+# Headers generated from sources list
+#  - This list is used mainly during dictionary generating and installation step,
+#    all source headers will be installed into $CMAKE_INSTALL_PREFIX/include
+#  - Note that it is possible to create your own custom list of headers, to add
+#    to the existing one or to delete from it. Change this variable as it suits
+#    the purpose of the library, but be sure you do not affect the dictionary 
+#    generation
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
+
+# Generating the dictionary
+#  - The name of the LinkDef has to be "${MODULE}LinkDef.h"
+#  - Using custom LinkDef names is for advanced users! If you are not sure
+#    how to generate the dictionary please contact aliroot-git-admins@cern.ch
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+get_directory_property(incdirs INCLUDE_DIRECTORIES)
+generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
+# End Generation the dictionary
+
+# Seting ROOT and AliRoot dependecies
+#  - Any ROOT symbols used in the current sources has to be added to the list of 
+#    dependecies. 
+#  - The mapping between ROOT symbols and libraries can be found inside the ROOT
+#    map files. If you are not sure which library contains a certain symbol grep
+#    the rootmap files for the symbol:
+# Ex:
+#       $ cd $ROOTSYS/lib
+#       $ grep TSelectorCint *.rootmap
+#         libTree.rootmap:Library.TSelectorCint:                      libTree.so libNet.so libRIO.so libThread.so
+#   TSelectorCint symbol belongs to Tree library and we add it to ROOT_DEPENDENCIES
+# Ex: set(ROOT_DEPENDENCIES Core Gpad Hist Net RIO Tree XMLParser)
+# Ex: set(ALIROOT_DEPENDENCIES STEERBase ANALYSIS)
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+set(ROOT_DEPENDENCIES)
+set(ALIROOT_DEPENDENCIES)
+
+# Generating the ROOT map
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+set(LIBDEPS ${ROOT_DEPENDENCIES} ${ALIROOT_DEPENDENCIES})
+generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
+# End Generating the ROOT map
+
+############################################################################
+# END GENERAL SETTINGS                                                     #
+############################################################################
+
+
+############################################################################
+# COMPILATION AND LINKING CUSTOM FLAGS                                    #
+############################################################################
+
+# Setting custom compilation and linking flags
+# Ex system dependent: Modify the way the library is build
+#       if(${CMAKE_SYSTEM} MATCHES Darwin)
+#               set(MODULE_LINK_FLAGS "-undefined dynamic_lookup")
+#       endif(${CMAKE_SYSTEM} MATCHES Darwin)
+#  - MODULE_COMPILE_FLAGS and MODULE_LINK_FLAGS will be used later for library
+#    generation
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+set(MODULE_COMPILE_FLAGS )
+set(MODULE_LINK_FLAGS )
+
+############################################################################
+# END COMPILATION AND LINKING  CUSTOM FLAGS                                #
+############################################################################
+
+
+############################################################################
+# LIBRARY CREATION                                                         #
+############################################################################
+
+# Two options are availabe when creating the libraries:
+#       - dynamic only libraries
+#       - dinamic and static libraries
+#         Static libraries are by used the DAs. If you are sure the library will 
+#         be used by the DAs it is mandatory to create the static version.
+#  - Use only one of the options at a time, DO NOT FORGET to delete the content
+#    that is not used
+
+############################################################################
+## 1. DYNAMIC LIBRARY CREATION - NO STATIC LIBRARY NEEDED                  #
+############################################################################
+
+# Create the dynamic library
+#  - DELETE if static libraries are neded and follow Dynamic/Static libraries 
+#    instructions
+#  - DELETE the dynamic/static block if only dynamic libraries are needed
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+add_library(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx)
+
+# Additional compilation flags
+set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS ${MODULE_COMPILE_FLAGS})
+
+# Additional linking flags
+set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${MODULE_LINK_FLAGS})
+
+# Link library to dependecies
+target_link_libraries(${MODULE} ${LIBDEPS})
+
+############################################################################
+## END DYNAMIC LIBRARY CREATION - NO STATIC LIBRARY NEEDED                 #
+############################################################################
+
+
+############################################################################
+## 2. DYNAMIC/STATIC LIBRARY CREATION                                      #
+############################################################################
+
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+#  - DELETE if no static libraries are needed
+#  - Create an object to be reused in case of static libraries 
+#    otherwise the sources will be compiled twice
+add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
+
+#  - Add a library to the project using the object
+add_library(${MODULE} SHARED $<TARGET_OBJECTS:${MODULE}-object>)
+
+# Setting the correct headers for the object as gathered from the dependencies
+target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
+set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
+
+# Additional compilation flags
+set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "")
+
+# Additional linking flags
+set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${MODULE_LINK_FLAGS})
+
+# Link library to dependecies
+target_link_libraries(${MODULE} ${LIBDEPS})
+
+# Create the static library only if ALIROOT_STATIC variable is set
+# ALIROOT_STATIC is automatically set by the DA flag
+if(ALIROOT_STATIC)
+    add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:${MODULE}-object>)
+    set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
+
+    # list of shared dependencies / the name of the variable containing the list of static ones
+    generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
+    target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root RootExtra)
+
+    # Public include folders that will be propagated to the dependecies
+    target_include_directories(${MODULE}-static PUBLIC ${incdirs})
+    
+    set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
+
+    # Installation
+    install(TARGETS ${MODULE}-static
+            ARCHIVE DESTINATION lib
+            LIBRARY DESTINATION lib)
+endif(ALIROOT_STATIC)
+
+############################################################################
+## END DYNAMIC/STATIC LIBRARY CREATION                                     #
+############################################################################
+
+############################################################################
+# END LIBRARY CREATION                                                     #
+############################################################################
+
+############################################################################
+# INSTALLATION                                                             #
+############################################################################
+
+# The installation step is copying files needed at runtime into CMAKE_INSTALL_PREFIX
+# DO NOT forget to install all macros needed to run Grid jobs or any files that are
+# needed as input.
+#  - If you are not sure how to proceed please contact aliroot-git-admins@cern.ch
+
+# Library installation into $CMAKE_INSTALL_PREFIX/lib
+install(TARGETS ${MODULE}
+        ARCHIVE DESTINATION lib
+        LIBRARY DESTINATION lib)
+
+# Header installation into $CMAKE_INSTALL_PREFIX/include
+install(FILES ${HDRS} DESTINATION include)
+
+# Macros installation
+install(DIRECTORY macros DESTINATION ${MODULE})
diff --git a/doxygen/.gitignore b/doxygen/.gitignore
new file mode 100644 (file)
index 0000000..519b3f4
--- /dev/null
@@ -0,0 +1 @@
+/debug/includes.txt
diff --git a/doxygen/CMakeLists.txt b/doxygen/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a38e031
--- /dev/null
@@ -0,0 +1,33 @@
+# **************************************************************************
+# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
+# *                                                                        *
+# * Author: The ALICE Off-line Project.                                    *
+# * Contributors are mentioned in the code where appropriate.              *
+# *                                                                        *
+# * 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   *
+# * copies and that both the copyright notice and this permission notice   *
+# * appear in the supporting documentation. The authors make no claims     *
+# * about the suitability of this software for any purpose. It is          *
+# * provided "as is" without express or implied warranty.                  *
+# **************************************************************************
+
+if(CAN_GENERATE_DOC)
+
+    # prepare Doxygen config from template
+    configure_file(
+        ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+        ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+        @ONLY
+    )
+
+    # generate doc in build dir by using "make doxygen"
+    add_custom_target(doxygen
+        ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        COMMENT "Generating AliRoot reference manual using Doxygen"
+        VERBATIM
+    )
+
+endif(CAN_GENERATE_DOC)
diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in
new file mode 100644 (file)
index 0000000..0b87c50
--- /dev/null
@@ -0,0 +1,2386 @@
+# Doxyfile 1.8.9
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = AliRoot
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         = "Git version: @GIT_SHORT_SHA1@"
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = 
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           = @CMAKE_CURRENT_SOURCE_DIR@/img/alice_logo_clearbg.png
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@/htmldoc
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        = @CMAKE_SOURCE_DIR@
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 2
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                = 
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      = 
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    = 
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            = 
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = NO
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = @CMAKE_SOURCE_DIR@/doxygen \
+                         @CMAKE_SOURCE_DIR@/TPC
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS          = *.h \
+                         *.cxx \
+                         *.icc \
+                         *.C \
+                         *.dox
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS = 
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# compiled with the --with-libclang option.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        = 
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  = 
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       = 
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 0
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 73
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 98
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               = 
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           = 
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     = 
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               = 
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   = 
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  = 
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  = 
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           = 
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = YES
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = YES
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     = 
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       = 
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       = 
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     = 
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           = 
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           = 
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET = 
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    = 
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             = 
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sf.net) file that captures the
+# structure of the code including all documentation. Note that this feature is
+# still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            = 
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               = 
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           = 
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               = @DOXYGEN_DOT_PATH@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           = 
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           = 
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           = 
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      = 
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  = 
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES
diff --git a/doxygen/debug/gen_list_includes.sh b/doxygen/debug/gen_list_includes.sh
new file mode 100755 (executable)
index 0000000..7957bac
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+cd "$( dirname "$0" )"
+find "$(cd ../..;pwd)" -name '*.h' | xargs -l dirname | sort -u | xargs -l -- echo -I > includes.txt
+cat includes.txt
diff --git a/doxygen/debug/run.sh b/doxygen/debug/run.sh
new file mode 100755 (executable)
index 0000000..40344d5
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+cd "${ALICE_ROOT}"/../src/
+
+# TPC
+Files=$( find TPC/ -maxdepth 1 -name '*.h' -or -name '*.cxx' -or -name '*.C' )
+
+while [[ $# -gt 0 ]] ; do
+  case "$1" in
+    -r) RestoreOnly=1 ;;
+    -x) DoxygenOnly=1 ;;
+    -d) Debug='--debug=debug' ;;
+    -o) Stdout='-o' ;;
+  esac
+  shift 1
+done
+
+cd "${ALICE_ROOT}"/../src/doxygen
+
+for F in ${Files[@]} ; do
+  F="${ALICE_ROOT}/../src/${F}"
+  [[ $DoxygenOnly != 1 ]] && git checkout "$F"
+  [[ $RestoreOnly != 1 ]] && ./thtml2doxy.py $Stdout $Debug $( cat debug/includes.txt ) "$F"
+done
diff --git a/doxygen/debug/test_idempotency.sh b/doxygen/debug/test_idempotency.sh
new file mode 100755 (executable)
index 0000000..a4458ff
--- /dev/null
@@ -0,0 +1,138 @@
+#!/bin/bash
+
+cd "$( dirname "$0" )"
+
+bin="${PWD}/../thtml2doxy.py"
+includeslist="${PWD}/includes.txt"
+
+function process_file() {
+
+  src="$1"
+  quiet="$2"  # set it to 1 to activate
+  stop="$3"  # set it to 1 to activate
+
+  quiet_flag='-d'
+  [[ $quiet == 1 ]] && quiet_flag=''
+
+  t=$( mktemp -d /tmp/thtml2doxy-XXXXX )
+  mkdir -p $t/pass1
+  mkdir -p $t/pass2
+
+  out1="${t}/pass1/$( basename "${src}" )"
+  out2="${t}/pass2/$( basename "${src}" )"
+
+  # pass1
+  cd "${t}/pass1"
+  "${bin}" -o $quiet_flag $(cat "${includeslist}") "${src}" > "${out1}"
+  r1=$?
+  if [[ $stop == 1 || $r1 != 0 ]] ; then
+    read -p "run1 terminated with ${r1}: type 'sh' to enter a shell..." ans
+    [[ "$ans" == 'sh' ]] && bash
+  fi
+
+  if [[ $r1 != 0 ]] ; then
+    # Abort here
+    echo "run1 broken (exitcode ${r1}), makes no sense to continue"
+    cd /
+    rm -rf "${t}"
+    return 1
+  fi
+
+  # pass2
+  cd "${t}/pass2"
+  "${bin}" -o $quiet_flag $(cat "${includeslist}") "${out1}" > "${out2}"
+  r2=$?
+  if [[ $stop == 1 || $r2 != 0 ]] ; then
+    read -p "run2 terminated with ${r2}: type 'sh' to enter a shell..." ans
+    [[ "$ans" == 'sh' ]] && bash
+  fi
+
+  if [[ $quiet != 1 ]] ; then
+
+    # diff1
+    echo '=== BEGIN DIFF1 ==='
+    diff -rupN "${src}" "${out1}" | pygmentize -ldiff
+    echo '=== END DIFF1 ==='
+    echo ''
+
+    # diff2
+    if [[ $r2 == 0 ]] ; then
+      echo '=== BEGIN DIFF2 ==='
+      diff -rupN "${out1}" "${out2}" | pygmentize -ldiff
+      echo '=== END DIFF2 ==='
+      echo ''
+    fi
+
+    # report
+    echo '=== BEGIN REPORT ==='
+    echo "run1: ${r1}"
+    echo "run2: ${r2}"
+    echo '=== END REPORT ==='
+    echo ''
+
+  else
+
+    # compact output
+    cya='\033[36m'
+    red='\033[31m'
+    gre='\033[32m'
+    non='\033[m'
+
+    r1s="r1:${red}fail${non}($r1)"
+    [[ $r1 == 0 ]] && r1s="r1:${gre}ok${non}"
+
+    r2s="r2:${red}fail${non}($r2)"
+    difs="diff:${red}fail${non}"
+    ndif=0
+    if [[ $r2 == 0 ]] ; then
+
+      r2s="r2:${gre}ok${non}"
+
+      diff -rupN "${out1}" "${out2}" > "${t}/diff2.txt"
+      ndif=$( cat "${t}/diff2.txt" | wc -l )
+      [[ $ndif == 0 ]] && difs="diff:${gre}ok${non}"
+
+    fi
+
+    echo -e "${cya}${src}${non} ${r1s} ${r2s} ${difs}"
+    if [[ $ndif != 0 ]] ; then
+      cat "${t}/diff2.txt" | pygmentize -ldiff
+
+      read -p "unexpected diffs found between run1 and run2: type 'sh' to enter a shell..." ans
+      [[ "$ans" == 'sh' ]] && bash
+
+      # Abort
+      cd /
+      rm -rf "${t}"
+      return 1
+
+    fi
+
+  fi
+
+  # cleanup
+  cd /
+  rm -rf "${t}"
+  return 0
+
+}
+
+if [[ ! -e "${includeslist}" ]] ; then
+  echo 'no list of includes found'
+  exit 1
+fi
+
+# e.g. all TPC files
+exec 3< <( find "${PWD}/../../TPC/" -name '*.h' )
+while read -r -u3 file ; do
+  #ext="${file##*.}"
+  #base="${file%.*}"
+  process_file "${file}" 1 0 || break
+done
+exec 3<&-
+
+# e.g. test single classes
+# class="${PWD}/../../TPC/TPCsim/AliTPC.cxx"
+# ext="${class##*.}"
+# base="${class%.*}"
+# process_file "${base}.cxx" 0 1
diff --git a/doxygen/img/alice_logo_clearbg.png b/doxygen/img/alice_logo_clearbg.png
new file mode 100644 (file)
index 0000000..46bdc36
Binary files /dev/null and b/doxygen/img/alice_logo_clearbg.png differ
diff --git a/doxygen/mainpage.dox b/doxygen/mainpage.dox
new file mode 100644 (file)
index 0000000..b47fa55
--- /dev/null
@@ -0,0 +1,34 @@
+/*!
+
+\mainpage AliRoot core documentation
+
+
+This is the AliRoot Core documentation. This documentation has been
+automatically generated from the AliRoot Core source code.
+
+Use the top bar to navigate between categories.
+
+
+\section installaliroot How to build AliRoot
+
+Please refer to the [official online
+documentation](https://dberzano.github.io/alice/install-aliroot).
+
+
+\section githowto Getting started with Git
+
+Please refer to our [Git tutorial](https://dberzano.github.io/alice/git).
+
+
+\section getsupport How to get support
+
+Use the official mailing lists, possibly in the following order:
+
+- alice-project-analysis-task-force@cern.ch: ALICE offline analysis task force
+- alice-analysis-operations@cern.ch: ALICE operational analysis issues
+- alice-off@cern.ch: the ALICE Offline Software
+
+You can subscribe to the mailing lists above by using the [CERN e-groups](https://e-groups.cern.ch/)
+web application.
+
+*/
diff --git a/doxygen/thtml2doxy.py b/doxygen/thtml2doxy.py
new file mode 100755 (executable)
index 0000000..a2c6472
--- /dev/null
@@ -0,0 +1,941 @@
+#!/usr/bin/env python
+
+## @package thtml2doxy_clang
+#  Translates THtml C++ comments to Doxygen using libclang as parser.
+#
+#  This code relies on Python bindings for libclang: libclang's interface is pretty unstable, and
+#  its Python bindings are unstable as well.
+#
+#  AST (Abstract Source Tree) traversal is performed entirely using libclang used as a C++ parser,
+#  instead of attempting to write a parser ourselves.
+#
+#  This code (expecially AST traversal) was inspired by:
+#
+#   - [Implementing a code generator with libclang](http://szelei.me/code-generator/)
+#     (this refers to API calls used here)
+#   - [Parsing C++ in Python with Clang](http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-with-clang)
+#     (outdated, API calls described there do not work anymore, but useful to understand some basic
+#     concepts)
+#
+#  Usage:
+#
+#    `thtml2doxy_clang [--stdout|-o] [-d] [--debug=DEBUG_LEVEL] file1 [file2 [file3...]]`
+#
+#  Parameters:
+#
+#   - `--stdout|-o`: output all on standard output instead of writing files in place
+#   - `-d`: enable debug mode (very verbose output)
+#   - `--debug=DEBUG_LEVEL`: set debug level to one of `DEBUG`, `INFO`, `WARNING`, `ERROR`,
+#     `CRITICAL`
+#
+#  @author Dario Berzano, CERN
+#  @date 2014-12-05
+
+
+import sys
+import os
+import re
+import logging
+import getopt
+import hashlib
+import clang.cindex
+
+
+## Brain-dead color output for terminal.
+class Colt(str):
+
+  def red(self):
+    return self.color('\033[31m')
+
+  def green(self):
+    return self.color('\033[32m')
+
+  def yellow(self):
+    return self.color('\033[33m')
+
+  def blue(self):
+    return self.color('\033[34m')
+
+  def magenta(self):
+    return self.color('\033[35m')
+
+  def cyan(self):
+    return self.color('\033[36m')
+
+  def color(self, c):
+    return c + self + '\033[m'
+
+
+## Comment.
+class Comment:
+
+  def __init__(self, lines, first_line, first_col, last_line, last_col, indent, func):
+    assert first_line > 0 and last_line >= first_line, 'Wrong line numbers'
+    self.lines = lines
+    self.first_line = first_line
+    self.first_col = first_col
+    self.last_line = last_line
+    self.last_col = last_col
+    self.indent = indent
+    self.func = func
+
+  def has_comment(self, line):
+    return line >= self.first_line and line <= self.last_line
+
+  def __str__(self):
+    return "<Comment for %s: [%d,%d:%d,%d] %s>" % (self.func, self.first_line, self.first_col, self.last_line, self.last_col, self.lines)
+
+
+## A data member comment.
+class MemberComment:
+
+  def __init__(self, text, comment_flag, array_size, first_line, first_col, func):
+    assert first_line > 0, 'Wrong line number'
+    assert comment_flag is None or comment_flag == '!' or comment_flag in [ '!', '||', '->' ]
+    self.lines = [ text ]
+    self.comment_flag = comment_flag
+    self.array_size = array_size
+    self.first_line = first_line
+    self.first_col = first_col
+    self.func = func
+
+  def is_transient(self):
+    return self.comment_flag == '!'
+
+  def is_dontsplit(self):
+    return self.comment_flag == '||'
+
+  def is_ptr(self):
+    return self.comment_flag == '->'
+
+  def has_comment(self, line):
+    return line == self.first_line
+
+  def __str__(self):
+
+    if self.is_transient():
+      tt = '!transient! '
+    elif self.is_dontsplit():
+      tt = '!dontsplit! '
+    elif self.is_ptr():
+      tt = '!ptr! '
+    else:
+      tt = ''
+
+    if self.array_size is not None:
+      ars = '[%s] ' % self.array_size
+    else:
+      ars = ''
+
+    return "<MemberComment for %s: [%d,%d] %s%s%s>" % (self.func, self.first_line, self.first_col, tt, ars, self.lines[0])
+
+
+## A dummy comment that removes comment lines.
+class RemoveComment(Comment):
+
+  def __init__(self, first_line, last_line):
+    assert first_line > 0 and last_line >= first_line, 'Wrong line numbers'
+    self.first_line = first_line
+    self.last_line = last_line
+    self.func = '<remove>'
+
+  def __str__(self):
+    return "<RemoveComment: [%d,%d]>" % (self.first_line, self.last_line)
+
+
+## Parses method comments.
+#
+#  @param cursor   Current libclang parser cursor
+#  @param comments Array of comments: new ones will be appended there
+def comment_method(cursor, comments):
+
+  # we are looking for the following structure: method -> compound statement -> comment, i.e. we
+  # need to extract the first comment in the compound statement composing the method
+
+  in_compound_stmt = False
+  expect_comment = False
+  emit_comment = False
+
+  comment = []
+  comment_function = cursor.spelling or cursor.displayname
+  comment_line_start = -1
+  comment_line_end = -1
+  comment_col_start = -1
+  comment_col_end = -1
+  comment_indent = -1
+
+  for token in cursor.get_tokens():
+
+    if token.cursor.kind == clang.cindex.CursorKind.COMPOUND_STMT:
+      if not in_compound_stmt:
+        in_compound_stmt = True
+        expect_comment = True
+        comment_line_end = -1
+    else:
+      if in_compound_stmt:
+        in_compound_stmt = False
+        emit_comment = True
+
+    # tkind = str(token.kind)[str(token.kind).index('.')+1:]
+    # ckind = str(token.cursor.kind)[str(token.cursor.kind).index('.')+1:]
+
+    if in_compound_stmt:
+
+      if expect_comment:
+
+        extent = token.extent
+        line_start = extent.start.line
+        line_end = extent.end.line
+
+        if token.kind == clang.cindex.TokenKind.PUNCTUATION and token.spelling == '{':
+          pass
+
+        elif token.kind == clang.cindex.TokenKind.COMMENT and (comment_line_end == -1 or (line_start == comment_line_end+1 and line_end-line_start == 0)):
+          comment_line_end = line_end
+          comment_col_end = extent.end.column
+
+          if comment_indent == -1 or (extent.start.column-1) < comment_indent:
+            comment_indent = extent.start.column-1
+
+          if comment_line_start == -1:
+            comment_line_start = line_start
+            comment_col_start = extent.start.column
+          comment.extend( token.spelling.split('\n') )
+
+          # multiline comments are parsed in one go, therefore don't expect subsequent comments
+          if line_end - line_start > 0:
+            emit_comment = True
+            expect_comment = False
+
+        else:
+          emit_comment = True
+          expect_comment = False
+
+    if emit_comment:
+
+      if comment_line_start > 0:
+
+        comment = refactor_comment( comment, infilename=str(cursor.location.file) )
+
+        if len(comment) > 0:
+          logging.debug("Comment found for function %s" % Colt(comment_function).magenta())
+          comments.append( Comment(comment, comment_line_start, comment_col_start, comment_line_end, comment_col_end, comment_indent, comment_function) )
+        else:
+          logging.debug('Empty comment found for function %s: collapsing' % Colt(comment_function).magenta())
+          comments.append( Comment([''], comment_line_start, comment_col_start, comment_line_end, comment_col_end, comment_indent, comment_function) )
+          #comments.append(RemoveComment(comment_line_start, comment_line_end))
+
+      else:
+        logging.warning('No comment found for function %s' % Colt(comment_function).magenta())
+
+      comment = []
+      comment_line_start = -1
+      comment_line_end = -1
+      comment_col_start = -1
+      comment_col_end = -1
+      comment_indent = -1
+
+      emit_comment = False
+      break
+
+
+## Parses comments to class data members.
+#
+#  @param cursor   Current libclang parser cursor
+#  @param comments Array of comments: new ones will be appended there
+def comment_datamember(cursor, comments):
+
+  # Note: libclang 3.5 seems to have problems parsing a certain type of FIELD_DECL, so we revert
+  # to a partial manual parsing. When parsing fails, the cursor's "extent" is not set properly,
+  # returning a line range 0-0. We therefore make the not-so-absurd assumption that the datamember
+  # definition is fully on one line, and we take the line number from cursor.location.
+
+  line_num = cursor.location.line
+  raw = None
+  prev = None
+  found = False
+
+  # Huge overkill: current line saved in "raw", previous in "prev"
+  with open(str(cursor.location.file)) as fp:
+    cur_line = 0
+    for raw in fp:
+      cur_line = cur_line + 1
+      if cur_line == line_num:
+        found = True
+        break
+      prev = raw
+
+  assert found, 'A line that should exist was not found in file' % cursor.location.file
+
+  recomm = r'(//(!|\|\||->)|///?)(\[([0-9,]+)\])?<?\s*(.*?)\s*$'
+  recomm_prevline = r'^\s*///\s*(.*?)\s*$'
+
+  mcomm = re.search(recomm, raw)
+  if mcomm:
+    # If it does not match, we do not have a comment
+    member_name = cursor.spelling;
+    comment_flag = mcomm.group(2)
+    array_size = mcomm.group(4)
+    text = mcomm.group(5)
+
+    col_num = mcomm.start()+1;
+
+    if array_size is not None and prev is not None:
+      # ROOT arrays with comments already converted to Doxygen have the member description on the
+      # previous line
+      mcomm_prevline = re.search(recomm_prevline, prev)
+      if mcomm_prevline:
+        text = mcomm_prevline.group(1)
+        comments.append(RemoveComment(line_num-1, line_num-1))
+
+    logging.debug('Comment found for member %s' % Colt(member_name).magenta())
+
+    comments.append( MemberComment(
+      text,
+      comment_flag,
+      array_size,
+      line_num,
+      col_num,
+      member_name ))
+
+
+## Parses class description (beginning of file).
+#
+#  The clang parser does not work in this case so we do it manually, but it is very simple: we keep
+#  the first consecutive sequence of single-line comments (//) we find - provided that it occurs
+#  before any other comment found so far in the file (the comments array is inspected to ensure
+#  this).
+#
+#  Multi-line comments (/* ... */) are not considered as they are commonly used to display
+#  copyright notice.
+#
+#  @param filename Name of the current file
+#  @param comments Array of comments: new ones will be appended there
+def comment_classdesc(filename, comments):
+
+  recomm = r'^\s*///?(\s*.*?)\s*/*\s*$'
+
+  reclass_doxy = r'(?i)^\s*\\(class|file):?\s*([^.]*)'
+  class_name_doxy = None
+
+  reauthor = r'(?i)^\s*\\?authors?:?\s*(.*?)\s*(,?\s*([0-9./-]+))?\s*$'
+  redate = r'(?i)^\s*\\?date:?\s*([0-9./-]+)\s*$'
+  author = None
+  date = None
+
+  comment_lines = []
+
+  start_line = -1
+  end_line = -1
+
+  line_num = 0
+
+  is_macro = filename.endswith('.C')
+
+  with open(filename, 'r') as fp:
+
+    for raw in fp:
+
+      line_num = line_num + 1
+
+      if raw.strip() == '' and start_line > 0:
+        # Skip empty lines
+        continue
+
+      stripped = strip_html(raw)
+      mcomm = re.search(recomm, stripped)
+      if mcomm:
+
+        if start_line == -1:
+
+          # First line. Check that we do not overlap with other comments
+          comment_overlaps = False
+          for c in comments:
+            if c.has_comment(line_num):
+              comment_overlaps = True
+              break
+
+          if comment_overlaps:
+            # No need to look for other comments
+            break
+
+          start_line = line_num
+
+        end_line = line_num
+        append = True
+
+        mclass_doxy = re.search(reclass_doxy, mcomm.group(1))
+        if mclass_doxy:
+          class_name_doxy = mclass_doxy.group(2)
+          append = False
+        else:
+          mauthor = re.search(reauthor, mcomm.group(1))
+          if mauthor:
+            author = mauthor.group(1)
+            if date is None:
+              # Date specified in the standalone \date field has priority
+              date = mauthor.group(3)
+            append = False
+          else:
+            mdate = re.search(redate, mcomm.group(1))
+            if mdate:
+              date = mdate.group(1)
+              append = False
+
+        if append:
+          comment_lines.append( mcomm.group(1) )
+
+      else:
+        if start_line > 0:
+          break
+
+  if class_name_doxy is None:
+
+    # No \class specified: guess it from file name
+    reclass = r'^(.*/)?(.*?)(\..*)?$'
+    mclass = re.search( reclass, filename )
+    if mclass:
+      class_name_doxy = mclass.group(2)
+    else:
+      assert False, 'Regexp unable to extract classname from file'
+
+  if start_line > 0:
+
+    # Prepend \class or \file specifier (and an empty line)
+    if is_macro:
+      comment_lines[:0] = [ '\\file ' + class_name_doxy + '.C' ]
+    else:
+      comment_lines[:0] = [ '\\class ' + class_name_doxy ]
+
+    # Append author and date if they exist
+    comment_lines.append('')
+
+    if author is not None:
+      comment_lines.append( '\\author ' + author )
+
+    if date is not None:
+      comment_lines.append( '\\date ' + date )
+
+    comment_lines = refactor_comment(comment_lines, do_strip_html=False, infilename=filename)
+    logging.debug('Comment found for class %s' % Colt(class_name_doxy).magenta())
+    comments.append(Comment(
+      comment_lines,
+      start_line, 1, end_line, 1,
+      0, class_name_doxy
+    ))
+
+  else:
+
+    logging.warning('No comment found for class %s' % Colt(class_name_doxy).magenta())
+
+
+## Traverse the AST recursively starting from the current cursor.
+#
+#  @param cursor    A Clang parser cursor
+#  @param filename  Name of the current file
+#  @param comments  Array of comments: new ones will be appended there
+#  @param recursion Current recursion depth
+def traverse_ast(cursor, filename, comments, recursion=0):
+
+  # libclang traverses included files as well: we do not want this behavior
+  if cursor.location.file is not None and str(cursor.location.file) != filename:
+    logging.debug("Skipping processing of included %s" % cursor.location.file)
+    return
+
+  text = cursor.spelling or cursor.displayname
+  kind = str(cursor.kind)[str(cursor.kind).index('.')+1:]
+
+  is_macro = filename.endswith('.C')
+
+  indent = ''
+  for i in range(0, recursion):
+    indent = indent + '  '
+
+  if cursor.kind in [ clang.cindex.CursorKind.CXX_METHOD, clang.cindex.CursorKind.CONSTRUCTOR,
+    clang.cindex.CursorKind.DESTRUCTOR, clang.cindex.CursorKind.FUNCTION_DECL ]:
+
+    # cursor ran into a C++ method
+    logging.debug( "%5d %s%s(%s)" % (cursor.location.line, indent, Colt(kind).magenta(), Colt(text).blue()) )
+    comment_method(cursor, comments)
+
+  elif not is_macro and cursor.kind in [ clang.cindex.CursorKind.FIELD_DECL, clang.cindex.CursorKind.VAR_DECL ]:
+
+    # cursor ran into a data member declaration
+    logging.debug( "%5d %s%s(%s)" % (cursor.location.line, indent, Colt(kind).magenta(), Colt(text).blue()) )
+    comment_datamember(cursor, comments)
+
+  else:
+
+    logging.debug( "%5d %s%s(%s)" % (cursor.location.line, indent, kind, text) )
+
+  for child_cursor in cursor.get_children():
+    traverse_ast(child_cursor, filename, comments, recursion+1)
+
+  if recursion == 0:
+    comment_classdesc(filename, comments)
+
+
+## Strip some HTML tags from the given string. Returns clean string.
+#
+#  @param s Input string
+def strip_html(s):
+  rehtml = r'(?i)</?(P|BR)/?>'
+  return re.sub(rehtml, '', s)
+
+
+## Remove garbage from comments and convert special tags from THtml to Doxygen.
+#
+#  @param comment An array containing the lines of the original comment
+def refactor_comment(comment, do_strip_html=True, infilename=None):
+
+  recomm = r'^(/{2,}|/\*)? ?(\s*.*?)\s*((/{2,})?\s*|\*/)$'
+  regarbage = r'^(?i)\s*([\s*=-_#]+|(Begin|End)_Html)\s*$'
+
+  # Support for LaTeX blocks spanning on multiple lines
+  relatex = r'(?i)^((.*?)\s+)?(BEGIN|END)_LATEX([.,;:\s]+.*)?$'
+  in_latex = False
+  latex_block = False
+
+  # Support for LaTeX blocks on a single line
+  reinline_latex = r'(?i)(.*)BEGIN_LATEX\s+(.*?)\s+END_LATEX(.*)$'
+
+  # Match <pre> (to turn it into the ~~~ Markdown syntax)
+  reblock = r'(?i)^(\s*)</?PRE>\s*$'
+
+  # Macro blocks for pictures generation
+  in_macro = False
+  current_macro = []
+  remacro = r'(?i)^\s*(BEGIN|END)_MACRO(\((.*?)\))?\s*$'
+
+  new_comment = []
+  insert_blank = False
+  wait_first_non_blank = True
+  for line_comment in comment:
+
+    # Check if we are in a macro block
+    mmacro = re.search(remacro, line_comment)
+    if mmacro:
+      if in_macro:
+        in_macro = False
+
+        # Dump macro
+        outimg = write_macro(infilename, current_macro) + '.png'
+        current_macro = []
+
+        # Insert image
+        new_comment.append( '![Picture from ROOT macro](%s)' % (outimg) )
+
+        logging.debug( 'Found macro for generating image %s' % Colt(outimg).magenta() )
+
+      else:
+        in_macro = True
+
+      continue
+    elif in_macro:
+      current_macro.append( line_comment )
+      continue
+
+    # Strip some HTML tags
+    if do_strip_html:
+      line_comment = strip_html(line_comment)
+
+    mcomm = re.search( recomm, line_comment )
+    if mcomm:
+      new_line_comment = mcomm.group(2)
+      mgarbage = re.search( regarbage, new_line_comment )
+
+      if new_line_comment == '' or mgarbage is not None:
+        insert_blank = True
+      else:
+        if insert_blank and not wait_first_non_blank:
+          new_comment.append('')
+        insert_blank = False
+        wait_first_non_blank = False
+
+        # Postprocessing: LaTeX formulas in ROOT format
+        # Marked by BEGIN_LATEX ... END_LATEX and they use # in place of \
+        # There can be several ROOT LaTeX forumlas per line
+        while True:
+          minline_latex = re.search( reinline_latex, new_line_comment )
+          if minline_latex:
+            new_line_comment = '%s\\f$%s\\f$%s' % \
+              ( minline_latex.group(1), minline_latex.group(2).replace('#', '\\'),
+                minline_latex.group(3) )
+          else:
+            break
+
+        # ROOT LaTeX: do we have a Begin/End_LaTeX block?
+        # Note: the presence of LaTeX "closures" does not exclude the possibility to have a begin
+        # block here left without a corresponding ending block
+        mlatex = re.search( relatex, new_line_comment )
+        if mlatex:
+
+          # before and after parts have been already stripped
+          l_before = mlatex.group(2)
+          l_after = mlatex.group(4)
+          is_begin = mlatex.group(3).upper() == 'BEGIN'  # if not, END
+
+          if l_before is None:
+            l_before = ''
+          if l_after is None:
+            l_after = ''
+
+          if is_begin:
+
+            # Begin of LaTeX part
+
+            in_latex = True
+            if l_before == '' and l_after == '':
+
+              # Opening tag alone: mark the beginning of a block: \f[ ... \f]
+              latex_block = True
+              new_comment.append( '\\f[' )
+
+            else:
+              # Mark the beginning of inline: \f$ ... \f$
+              latex_block = False
+              new_comment.append(
+                '%s \\f$%s' % ( l_before, l_after.replace('#', '\\') )
+              )
+
+          else:
+
+            # End of LaTeX part
+            in_latex = False
+
+            if latex_block:
+
+              # Closing a LaTeX block
+              if l_before != '':
+                new_comment.append( l_before.replace('#', '\\') )
+              new_comment.append( '\\f]' )
+              if l_after != '':
+                new_comment.append( l_after )
+
+            else:
+
+              # Closing a LaTeX inline
+              new_comment.append(
+                '%s\\f$%s' % ( l_before.replace('#', '\\'), l_after )
+              )
+
+          # Prevent appending lines (we have already done that)
+          new_line_comment = None
+
+        # If we are not in a LaTeX block, look for <pre> tags and transform them into Doxygen code
+        # blocks (using ~~~ ... ~~~). Only <pre> tags on a single line are supported
+        if new_line_comment is not None and not in_latex:
+
+          mblock = re.search( reblock, new_line_comment  )
+          if mblock:
+            new_comment.append( mblock.group(1)+'~~~' )
+            new_line_comment = None
+
+        if new_line_comment is not None:
+          if in_latex:
+            new_line_comment = new_line_comment.replace('#', '\\')
+          new_comment.append( new_line_comment )
+
+    else:
+      assert False, 'Comment regexp does not match'
+
+  return new_comment
+
+
+## Dumps an image-generating macro to the correct place. Returns a string with the image path,
+#  without the extension.
+#
+#  @param infilename  File name of the source file
+#  @param macro_lines Array of macro lines
+def write_macro(infilename, macro_lines):
+
+  # Calculate hash
+  digh = hashlib.sha1()
+  for l in macro_lines:
+    digh.update(l)
+    digh.update('\n')
+  short_digest = digh.hexdigest()[0:7]
+
+  outdir = '%s/imgdoc' % os.path.dirname(infilename)
+  outprefix = '%s/%s_%s' % (
+    outdir,
+    os.path.basename(infilename).replace('.', '_'),
+    short_digest
+  )
+  outmacro = '%s.C' % outprefix
+
+  # Make directory
+  if not os.path.isdir(outdir):
+    # do not catch: let everything die on error
+    logging.debug('Creating directory %s' % Colt(outdir).magenta())
+    os.mkdir(outdir)
+
+  # Create file (do not catch errors either)
+  with open(outmacro, 'w') as omfp:
+    logging.debug('Writing macro %s' % Colt(outmacro).magenta())
+    for l in macro_lines:
+      omfp.write(l)
+      omfp.write('\n')
+
+  return outprefix
+
+
+## Rewrites all comments from the given file handler.
+#
+#  @param fhin     The file handler to read from
+#  @param fhout    The file handler to write to
+#  @param comments Array of comments
+def rewrite_comments(fhin, fhout, comments):
+
+  line_num = 0
+  in_comment = False
+  skip_empty = False
+  comm = None
+  prev_comm = None
+
+  rindent = r'^(\s*)'
+
+
+  def dump_comment_block(cmt):
+   text_indent = ''
+   for i in range(0, cmt.indent):
+     text_indent = text_indent + ' '
+
+   for lc in cmt.lines:
+     fhout.write( "%s/// %s\n" % (text_indent, lc) );
+   fhout.write('\n')
+
+
+  for line in fhin:
+
+    line_num = line_num + 1
+
+    # Find current comment
+    prev_comm = comm
+    comm = None
+    for c in comments:
+      if c.has_comment(line_num):
+        comm = c
+
+    if comm:
+
+      if isinstance(comm, MemberComment):
+
+        # end comment block
+        if in_comment:
+          dump_comment_block(prev_comm)
+          in_comment = False
+
+        non_comment = line[ 0:comm.first_col-1 ]
+
+        if comm.array_size is not None or comm.is_dontsplit() or comm.is_ptr():
+
+          # This is a special case: comment will be split in two lines: one before the comment for
+          # Doxygen as "member description", and the other right after the comment on the same line
+          # to be parsed by ROOT's C++ parser
+
+          # Keep indent on the generated line of comment before member definition
+          mindent = re.search(rindent, line)
+
+          # Get correct comment flag, if any
+          if comm.comment_flag is not None:
+            cflag = comm.comment_flag
+          else:
+            cflag = ''
+
+          # Get correct array size, if any
+          if comm.array_size is not None:
+            asize = '[%s]' % comm.array_size
+          else:
+            asize = ''
+
+          # Write on two lines
+          fhout.write('%s/// %s\n%s//%s%s\n' % (
+            mindent.group(1),
+            comm.lines[0],
+            non_comment,
+            cflag,
+            asize
+          ))
+
+        else:
+
+          # Single-line comments with the "transient" flag can be kept on one line in a way that
+          # they are correctly interpreted by both ROOT and Doxygen
+
+          if comm.is_transient():
+            tt = '!'
+          else:
+            tt = '/'
+
+          fhout.write('%s//%s< %s\n' % (
+            non_comment,
+            tt,
+            comm.lines[0]
+          ))
+
+      elif isinstance(comm, RemoveComment):
+        # End comment block and skip this line
+        if in_comment:
+          dump_comment_block(prev_comm)
+          in_comment = False
+
+      elif prev_comm is None:
+
+        # Beginning of a new comment block of type Comment
+        in_comment = True
+
+        # Extract the non-comment part and print it if it exists
+        non_comment = line[ 0:comm.first_col-1 ].rstrip()
+        if non_comment != '':
+          fhout.write( non_comment + '\n' )
+
+    else:
+
+      if in_comment:
+
+        # We have just exited a comment block of type Comment
+        dump_comment_block(prev_comm)
+        in_comment = False
+        skip_empty = True
+
+      line_out = line.rstrip('\n')
+      if skip_empty:
+        skip_empty = False
+        if line_out.strip() != '':
+          fhout.write( line_out + '\n' )
+      else:
+        fhout.write( line_out + '\n' )
+
+
+## The main function.
+#
+#  Return value is the executable's return value.
+def main(argv):
+
+  # Setup logging on stderr
+  log_level = logging.INFO
+  logging.basicConfig(
+    level=log_level,
+    format='%(levelname)-8s %(funcName)-20s %(message)s',
+    stream=sys.stderr
+  )
+
+  # Parse command-line options
+  output_on_stdout = False
+  include_flags = []
+  try:
+    opts, args = getopt.getopt( argv, 'odI:', [ 'debug=', 'stdout' ] )
+    for o, a in opts:
+      if o == '--debug':
+        log_level = getattr( logging, a.upper(), None )
+        if not isinstance(log_level, int):
+          raise getopt.GetoptError('log level must be one of: DEBUG, INFO, WARNING, ERROR, CRITICAL')
+      elif o == '-d':
+        log_level = logging.DEBUG
+      elif o == '-o' or o == '--stdout':
+        output_on_stdout = True
+      elif o == '-I':
+        if os.path.isdir(a):
+          include_flags.extend( [ '-I', a ] )
+        else:
+          logging.fatal('Include directory not found: %s' % Colt(a).magenta())
+          return 2
+      else:
+        assert False, 'Unhandled argument'
+  except getopt.GetoptError as e:
+    logging.fatal('Invalid arguments: %s' % e)
+    return 1
+
+  logging.getLogger('').setLevel(log_level)
+
+  # Attempt to load libclang from a list of known locations
+  libclang_locations = [
+    '/usr/lib/llvm-3.5/lib/libclang.so.1',
+    '/usr/lib/libclang.so',
+    '/Library/Developer/CommandLineTools/usr/lib/libclang.dylib'
+  ]
+  libclang_found = False
+
+  for lib in libclang_locations:
+    if os.path.isfile(lib):
+      clang.cindex.Config.set_library_file(lib)
+      libclang_found = True
+      break
+
+  if not libclang_found:
+    logging.fatal('Cannot find libclang')
+    return 1
+
+  # Loop over all files
+  for fn in args:
+
+    logging.info('Input file: %s' % Colt(fn).magenta())
+    index = clang.cindex.Index.create()
+    clang_args = [ '-x', 'c++' ]
+    clang_args.extend( include_flags )
+    translation_unit = index.parse(fn, args=clang_args)
+
+    comments = []
+    traverse_ast( translation_unit.cursor, fn, comments )
+    for c in comments:
+
+      logging.debug("Comment found for entity %s:" % Colt(c.func).magenta())
+
+      if isinstance(c, MemberComment):
+
+        if c.is_transient():
+          flag_text = Colt('transient ').yellow()
+        elif c.is_dontsplit():
+          flag_text = Colt('dontsplit ').yellow()
+        elif c.is_ptr():
+          flag_text = Colt('ptr ').yellow()
+        else:
+          flag_text = ''
+
+        if c.array_size is not None:
+          array_text = Colt('arraysize=%s ' % c.array_size).yellow()
+        else:
+          array_text = ''
+
+        logging.debug(
+          "%s %s%s{%s}" % ( \
+            Colt("[%d,%d]" % (c.first_line, c.first_col)).green(),
+            flag_text,
+            array_text,
+            Colt(c.lines[0]).cyan()
+        ))
+
+      elif isinstance(c, RemoveComment):
+
+        logging.debug( Colt('[%d,%d]' % (c.first_line, c.last_line)).green() )
+
+      else:
+        for l in c.lines:
+          logging.debug(
+            Colt("[%d,%d:%d,%d] " % (c.first_line, c.first_col, c.last_line, c.last_col)).green() +
+            "{%s}" % Colt(l).cyan()
+          )
+
+    try:
+
+      if output_on_stdout:
+        with open(fn, 'r') as fhin:
+          rewrite_comments( fhin, sys.stdout, comments )
+      else:
+        fn_back = fn + '.thtml2doxy_backup'
+        os.rename( fn, fn_back )
+
+        with open(fn_back, 'r') as fhin, open(fn, 'w') as fhout:
+          rewrite_comments( fhin, fhout, comments )
+
+        os.remove( fn_back )
+        logging.info("File %s converted to Doxygen: check differences before committing!" % Colt(fn).magenta())
+    except (IOError,OSError) as e:
+      logging.error('File operation failed: %s' % e)
+
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit( main( sys.argv[1:] ) )
diff --git a/macros/ConfigRaw2015.C b/macros/ConfigRaw2015.C
new file mode 100644 (file)
index 0000000..82af081
--- /dev/null
@@ -0,0 +1,536 @@
+//
+// Configuration file for generating 2015 geometry
+//
+
+// To use this macro in compiled mode one first would need to do:
+// root [0] gSystem->Load("libgeant321");
+// root [1] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -Igeant3_src/TGeant3");
+//
+// However it is meant to be called in the following sequence:
+// root [0] AliCDBManager* cdb = AliCDBManager::Instance();
+// root [0] cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+// root [0] cdb->SetRun(200000);
+// root [0] gROOT->LoadMacro("ConfigRaw2015.C");
+// root [0] gInterpreter->ProcessLine(gAlice->GetConfigFunction());
+// root [0] gAlice->GetMCApp()->Init();
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <Riostream.h>
+#include <TRandom.h>
+#include <TDatime.h>
+#include <TSystem.h>
+#include <TVirtualMC.h>
+#include <TGeoGlobalMagField.h>
+#include <TGeant3TGeo.h>
+#include "STEER/STEER/AliRunLoader.h"
+#include "STEER/STEER/AliRun.h"
+#include "STEER/STEER/AliConfig.h"
+#include "STEER/STEER/AliSimulation.h"
+#include "PYTHIA6/AliPythia6/AliDecayerPythia.h"
+#include "PYTHIA6/AliPythia6/AliGenPythia.h"
+#include "TDPMjet/AliGenDPMjet.h"
+#include "STEER/STEERBase/AliMagF.h"
+#include "STRUCT/AliBODY.h"
+#include "STRUCT/AliMAG.h"
+#include "STRUCT/AliABSOv3.h"
+#include "STRUCT/AliDIPOv3.h"
+#include "STRUCT/AliHALLv3.h"
+#include "STRUCT/AliFRAMEv2.h"
+#include "STRUCT/AliSHILv3.h"
+#include "STRUCT/AliPIPEv3.h"
+#include "ITS/ITSsim/AliITSv11.h"
+#include "TPC/TPCsim/AliTPCv2.h"
+#include "TOF/TOFsim/AliTOFv6T0.h"
+#include "HMPID/HMPIDsim/AliHMPIDv3.h"
+#include "ZDC/ZDCsim/AliZDCv4.h"
+#include "TRD/TRDsim/AliTRDv1.h"
+#include "TRD/TRDbase/AliTRDgeometry.h"
+#include "FMD/FMDsim/AliFMDv1.h"
+#include "MUON/MUONsim/AliMUONv1.h"
+#include "PHOS/PHOSsim/AliPHOSv1.h"
+#include "PHOS/PHOSbase/AliPHOSSimParam.h"
+#include "PMD/PMDsim/AliPMDv1.h"
+#include "T0/T0sim/AliT0v1.h"
+#include "EMCAL/EMCALsim/AliEMCALv2.h"
+#include "ACORDE/ACORDEsim/AliACORDEv1.h"
+#include "VZERO/VZEROsim/AliVZEROv7.h"
+#include "AD/ADsim/AliADv1.h"
+#endif
+
+enum PDC06Proc_t 
+{
+  kPythia6, kPythia6D6T, kPhojet, kRunMax
+};
+
+const char * pprRunName[] = {
+    "kPythia6", "kPythia6D6T", "kPhojet" 
+};
+
+enum Mag_t
+{
+  kNoField, k5kG, kFieldMax
+};
+
+const char * pprField[] = {
+  "kNoField", "k5kG"
+};
+
+//--- Functions ---
+class AliGenPythia;
+AliGenerator *MbPythia();
+AliGenerator *MbPythiaTuneD6T();
+AliGenerator *MbPhojet();
+void ProcessEnvironmentVars();
+
+// Geterator, field, beam energy
+static PDC06Proc_t   proc     = kPhojet;
+static Mag_t         mag      = k5kG;
+static Float_t       energy   = 10000; // energy in CMS
+//========================//
+// Set Random Number seed //
+//========================//
+TDatime dt;
+static UInt_t seed    = dt.Get();
+
+// Comment line
+static TString comment;
+
+void Config()
+{
+    
+
+  // Get settings from environment variables
+  ProcessEnvironmentVars();
+
+  gRandom->SetSeed(seed);
+  cerr<<"Seed for random number generation= "<<seed<<endl; 
+
+  // Libraries required by geant321
+#if defined(__CINT__)
+  gSystem->Load("liblhapdf");      // Parton density functions
+  gSystem->Load("libEGPythia6");   // TGenerator interface
+  if (proc != kPythia6D6T) {
+      gSystem->Load("libpythia6");     // Pythia 6.2
+  } else {
+      gSystem->Load("libqpythia");     // Pythia 6.4
+  }
+  gSystem->Load("libAliPythia6");  // ALICE specific implementations
+  gSystem->Load("libgeant321");
+#endif
+
+  new TGeant3TGeo("C++ Interface to Geant3");
+
+  //=======================================================================
+  //  Create the output file
+
+   
+  AliRunLoader* rl=0x0;
+
+  cout<<"Config.C: Creating Run Loader ..."<<endl;
+  rl = AliRunLoader::Open("galice.root",
+                         AliConfig::GetDefaultEventFolderName(),
+                         "recreate");
+  if (rl == 0x0)
+    {
+      gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
+      return;
+    }
+  rl->SetCompressionLevel(2);
+  rl->SetNumberOfEventsPerFile(1000);
+  gAlice->SetRunLoader(rl);
+  // gAlice->SetGeometryFromFile("geometry.root");
+  // gAlice->SetGeometryFromCDB();
+  
+  // Set the trigger configuration: proton-proton
+  AliSimulation::Instance()->SetTriggerConfig("p-p");
+
+  //
+  //=======================================================================
+  // ************* STEERING parameters FOR ALICE SIMULATION **************
+  // --- Specify event type to be tracked through the ALICE setup
+  // --- All positions are in cm, angles in degrees, and P and E in GeV
+
+
+    gMC->SetProcess("DCAY",1);
+    gMC->SetProcess("PAIR",1);
+    gMC->SetProcess("COMP",1);
+    gMC->SetProcess("PHOT",1);
+    gMC->SetProcess("PFIS",0);
+    gMC->SetProcess("DRAY",0);
+    gMC->SetProcess("ANNI",1);
+    gMC->SetProcess("BREM",1);
+    gMC->SetProcess("MUNU",1);
+    gMC->SetProcess("CKOV",1);
+    gMC->SetProcess("HADR",1);
+    gMC->SetProcess("LOSS",2);
+    gMC->SetProcess("MULS",1);
+    gMC->SetProcess("RAYL",1);
+
+    Float_t cut = 1.e-3;        // 1MeV cut by default
+    Float_t tofmax = 1.e10;
+
+    gMC->SetCut("CUTGAM", cut);
+    gMC->SetCut("CUTELE", cut);
+    gMC->SetCut("CUTNEU", cut);
+    gMC->SetCut("CUTHAD", cut);
+    gMC->SetCut("CUTMUO", cut);
+    gMC->SetCut("BCUTE",  cut); 
+    gMC->SetCut("BCUTM",  cut); 
+    gMC->SetCut("DCUTE",  cut); 
+    gMC->SetCut("DCUTM",  cut); 
+    gMC->SetCut("PPCUTM", cut);
+    gMC->SetCut("TOFMAX", tofmax); 
+
+
+
+
+  //======================//
+  // Set External decayer //
+  //======================//
+  TVirtualMCDecayer* decayer = new AliDecayerPythia();
+  decayer->SetForceDecay(kAll);
+  decayer->Init();
+  gMC->SetExternalDecayer(decayer);
+
+  //=========================//
+  // Generator Configuration //
+  //=========================//
+  AliGenerator* gener = 0x0;
+  
+  if (proc == kPythia6) {
+      gener = MbPythia();
+  } else if (proc == kPythia6D6T) {
+      gener = MbPythiaTuneD6T();
+  } else if (proc == kPhojet) {
+      gener = MbPhojet();
+  }
+  
+  
+
+  // PRIMARY VERTEX
+  //
+  gener->SetOrigin(0., 0., 0.);    // vertex position
+  //
+  //
+  // Size of the interaction diamond
+  // Longitudinal
+  Float_t sigmaz  = 5.4 / TMath::Sqrt(2.); // [cm]
+  if (energy == 900)
+    sigmaz  = 10.5 / TMath::Sqrt(2.); // [cm]
+  //
+  // Transverse
+  Float_t betast  = 10;                 // beta* [m]
+  Float_t eps     = 3.75e-6;            // emittance [m]
+  Float_t gamma   = energy / 2.0 / 0.938272;  // relativistic gamma [1]
+  Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.;  // [cm]
+  printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
+    
+  gener->SetSigma(sigmaxy, sigmaxy, sigmaz);      // Sigma in (X,Y,Z) (cm) on IP position
+  gener->SetCutVertexZ(3.);        // Truncate at 3 sigma
+  gener->SetVertexSmear(kPerEvent);
+
+  gener->Init();
+
+  // FIELD
+  //
+  AliMagF* field = 0x0;
+  if (mag == kNoField) {
+    comment = comment.Append(" | L3 field 0.0 T");
+    field = new AliMagF("Maps","Maps", 0., 0., AliMagF::k5kGUniform,AliMagF::kBeamTypepp, energy/2.0);
+  } else if (mag == k5kG) {
+    comment = comment.Append(" | L3 field 0.5 T");
+    field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG,        AliMagF::kBeamTypepp, energy/2.0);
+  }
+  printf("\n \n Comment: %s \n \n", comment.Data());
+
+  TGeoGlobalMagField::Instance()->SetField(field);
+    
+  rl->CdGAFile();
+  
+  Int_t iABSO  = 1;
+  Int_t iACORDE= 1;
+  Int_t iAD    = 0;
+  Int_t iDIPO  = 1;
+  Int_t iEMCAL = 1;
+  Int_t iFMD   = 1;
+  Int_t iFRAME = 1;
+  Int_t iHALL  = 1;
+  Int_t iITS   = 1;
+  Int_t iMAG   = 1;
+  Int_t iMUON  = 1;
+  Int_t iPHOS  = 1;
+  Int_t iPIPE  = 1;
+  Int_t iPMD   = 1;
+  Int_t iHMPID = 1;
+  Int_t iSHIL  = 1;
+  Int_t iT0    = 1;
+  Int_t iTOF   = 1;
+  Int_t iTPC   = 1;
+  Int_t iTRD   = 1;
+  Int_t iVZERO = 1;
+  Int_t iZDC   = 1;
+  
+
+    //=================== Alice BODY parameters =============================
+    AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
+
+
+    if (iMAG)
+    {
+        //=================== MAG parameters ============================
+        // --- Start with Magnet since detector layouts may be depending ---
+        // --- on the selected Magnet dimensions ---
+        AliMAG *MAG = new AliMAG("MAG", "Magnet");
+    }
+
+
+    if (iABSO)
+    {
+        //=================== ABSO parameters ============================
+        AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
+    }
+
+    if (iDIPO)
+    {
+        //=================== DIPO parameters ============================
+
+        AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
+    }
+
+    if (iHALL)
+    {
+        //=================== HALL parameters ============================
+
+        AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
+    }
+
+
+    if (iFRAME)
+    {
+        //=================== FRAME parameters ============================
+
+        AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
+       FRAME->SetHoles(1);
+    }
+
+    if (iSHIL)
+    {
+        //=================== SHIL parameters ============================
+
+        AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
+    }
+
+
+    if (iPIPE)
+    {
+        //=================== PIPE parameters ============================
+
+        AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
+    }
+    if (iITS)
+    {
+        //=================== ITS parameters ============================
+
+       AliITS *ITS  = new AliITSv11("ITS","ITS v11");
+    }
+
+    if (iTPC)
+    {
+      //============================ TPC parameters =====================
+
+        AliTPC *TPC = new AliTPCv2("TPC", "Ne-CO2");
+    }
+
+
+    if (iTOF) {
+        //=================== TOF parameters ============================
+
+       AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+    }
+
+
+    if (iHMPID)
+    {
+        //=================== HMPID parameters ===========================
+
+        AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
+
+    }
+
+
+    if (iZDC)
+    {
+        //=================== ZDC parameters ============================
+
+        AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
+    }
+
+    if (iTRD)
+    {
+        //=================== TRD parameters ============================
+
+        AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
+       // SM indexing starts at 3h in positive direction. We assume all SM
+        // are installed (i.e. all SM missing last year: 4, 5, 12, 13, 14)
+        // AliTRDgeometry *geoTRD = TRD->GetGeometry();
+       // geoTRD->SetSMstatus(4,0);
+    }
+
+    if (iFMD)
+    {
+        //=================== FMD parameters ============================
+
+       AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
+   }
+
+    if (iMUON)
+    {
+        //=================== MUON parameters ===========================
+        // New MUONv1 version (geometry defined via builders)
+
+        AliMUON *MUON = new AliMUONv1("MUON", "default");
+    }
+
+    if (iPHOS)
+    {
+        //=================== PHOS parameters ===========================
+
+        AliPHOS *PHOS = new AliPHOSv1("PHOS", "Modules1234");
+    }
+
+
+    if (iPMD)
+    {
+        //=================== PMD parameters ============================
+
+        AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
+    }
+
+    if (iT0)
+    {
+        //=================== T0 parameters ============================
+        AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
+    }
+
+    if (iEMCAL)
+    {
+        //=================== EMCAL parameters ============================
+
+        AliEMCAL* EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE12SMV1_DCAL_8SM", kFALSE); 
+    }
+
+    if (iACORDE)
+    {
+        //=================== ACORDE parameters ============================
+
+        AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
+    }
+
+    if (iVZERO)
+    {
+        //=================== VZERO parameters ============================
+
+        AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
+    }
+
+    if (iAD)
+    {
+        //=================== AD parameters ============================
+
+        AliAD *AD = new AliADv1("AD", "The AD geometry");
+    }
+}
+//
+//           PYTHIA
+//
+
+AliGenerator* MbPythia()
+{
+      comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
+//
+//    Pythia
+      AliGenPythia* pythia = new AliGenPythia(-1); 
+      pythia->SetMomentumRange(0, 999999.);
+      pythia->SetThetaRange(0., 180.);
+      pythia->SetYRange(-12.,12.);
+      pythia->SetPtRange(0,1000.);
+      pythia->SetProcess(kPyMb);
+      pythia->SetEnergyCMS(energy);
+      
+      return pythia;
+}
+
+AliGenerator* MbPythiaTuneD6T()
+{
+      comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
+//
+//    Pythia
+      AliGenPythia* pythia = new AliGenPythia(-1); 
+      pythia->SetMomentumRange(0, 999999.);
+      pythia->SetThetaRange(0., 180.);
+      pythia->SetYRange(-12.,12.);
+      pythia->SetPtRange(0,1000.);
+      pythia->SetProcess(kPyMb);
+      pythia->SetEnergyCMS(energy);
+//    Tune
+//    109     D6T : Rick Field's CDF Tune D6T (NB: needs CTEQ6L pdfs externally)
+      pythia->SetTune(109);
+      pythia->SetStrucFunc(kCTEQ6l);
+//
+      return pythia;
+}
+
+AliGenerator* MbPhojet()
+{
+      comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
+//
+//    DPMJET
+#if defined(__CINT__)
+  gSystem->Load("libdpmjet");      // Parton density functions
+  gSystem->Load("libTDPMjet");      // Parton density functions
+#endif
+      AliGenDPMjet* dpmjet = new AliGenDPMjet(-1); 
+      dpmjet->SetMomentumRange(0, 999999.);
+      dpmjet->SetThetaRange(0., 180.);
+      dpmjet->SetYRange(-12.,12.);
+      dpmjet->SetPtRange(0,1000.);
+      dpmjet->SetProcess(kDpmMb);
+      dpmjet->SetEnergyCMS(energy);
+
+      return dpmjet;
+}
+
+void ProcessEnvironmentVars()
+{
+    // Run type
+    if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
+      for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
+       if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
+         proc = (PDC06Proc_t)iRun;
+         cout<<"Run type set to "<<pprRunName[iRun]<<endl;
+       }
+      }
+    }
+
+    // Field
+    if (gSystem->Getenv("CONFIG_FIELD")) {
+      for (Int_t iField = 0; iField < kFieldMax; iField++) {
+       if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0) {
+         mag = (Mag_t)iField;
+         cout<<"Field set to "<<pprField[iField]<<endl;
+       }
+      }
+    }
+
+    // Energy
+    if (gSystem->Getenv("CONFIG_ENERGY")) {
+      energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
+      cout<<"Energy set to "<<energy<<" GeV"<<endl;
+    }
+
+    // Random Number seed
+    if (gSystem->Getenv("CONFIG_SEED")) {
+      seed = atoi(gSystem->Getenv("CONFIG_SEED"));
+    }
+}