X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PWGGA%2FCaloTrackCorrelations%2Fmacros%2FAddTaskCaloTrackCorr.C;h=f577450b48cfeab4336825d059039a146d92f447;hb=f35a36aca009c8b3b9e8b15d279f0c44c3414dfb;hp=610544b761e011c796759db7c6e9a6f989e028aa;hpb=0ce3960d353b2ed8f01daf3a1be6486efa0bb2a9;p=u%2Fmrichter%2FAliRoot.git diff --git a/PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C b/PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C index 610544b761e..f577450b48c 100644 --- a/PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C +++ b/PWGGA/CaloTrackCorrelations/macros/AddTaskCaloTrackCorr.C @@ -3,144 +3,243 @@ Bool_t kPrint = kFALSE; Bool_t kSimulation = kFALSE; Bool_t kUseKinematics = kFALSE; Bool_t kOutputAOD = kFALSE; -Int_t kRunNumber = 0; +Bool_t kEventSelection= kFALSE; +Bool_t kExotic = kTRUE; +Bool_t kNonLinearity = kFALSE; Int_t kYears = 2011; TString kCollisions = "pp"; TString kTrig = "EMC7" ; TString kClusterArray = ""; -TString kData = "ESD"; +TString kData = ""; // MC or deltaAOD TString kInputDataType = "ESD"; TString kCalorimeter = "EMCAL"; +Bool_t kTM = kTRUE; +Bool_t kRecalTM = kTRUE; +Int_t kMinCen = -1; +Int_t kMaxCen = -1; +TString kName = ""; +Int_t kDebug = -1; +Bool_t kQA = kFALSE; +Bool_t kHadronAN = kFALSE; +Bool_t kCalibE = kTRUE; +Bool_t kCalibT = kTRUE; +Bool_t kBadMap = kTRUE; +Bool_t kTender = kFALSE; +Bool_t kMix = kFALSE; +Int_t kRunNumber = -1; -AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr( - const TString data = "AOD", - const TString calorimeter = "EMCAL", - const Bool_t printSettings = kFALSE, - const Bool_t simulation = kFALSE, - const Bool_t outputAOD = kFALSE, - const TString outputfile = "", - const Int_t year = 2010, - const Int_t run = 0, - const TString col = "pp", - const TString trigger = "MB", - const TString clustersArray = "V1" - ) +AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr(const TString data = "", + const TString calorimeter = "EMCAL", + const Bool_t simulation = kFALSE, + const Bool_t eventsel = kFALSE, + const Bool_t exotic = kTRUE, + const Bool_t nonlin = kFALSE, + TString outputfile = "", + const Int_t year = 2010, + const TString col = "pp", + const TString trigger = "MB", + const TString clustersArray = "V1", + const Bool_t mix = kTRUE, + const Bool_t recaltm = kTRUE, + const Bool_t tm = kTRUE, + const Int_t minCen = -1, + const Int_t maxCen = -1, + const Bool_t qaan = kFALSE, + const Bool_t hadronan = kFALSE, + const Bool_t calibE = kTRUE, + const Bool_t badmap = kTRUE, + const Bool_t calibT = kTRUE, + const Bool_t tender = kFALSE, + const Bool_t outputAOD = kFALSE, + const Bool_t printSettings = kFALSE, + const Double_t scaleFactor = -1, + const Int_t runNumber = -1 + ) { - // Creates a PartCorr task, configures it and adds it to the analysis manager. + // Creates a CaloTrackCorr task, configures it and adds it to the analysis manager. kPrint = printSettings; kSimulation = simulation; - kRunNumber = run; kYears = year; kCollisions = col; + kExotic = exotic; + kNonLinearity = nonlin; kTrig = trigger; kClusterArray = clustersArray; kData = data; kCalorimeter = calorimeter; kOutputAOD = outputAOD; + kTM = tm; + kRecalTM = recaltm; + kMinCen = minCen; + kMaxCen = maxCen; + kEventSelection= eventsel; + kQA = qaan; + kHadronAN = hadronan; + kCalibE = calibE; + kCalibT = calibT; + kBadMap = badmap; + kTender = tender; + kMix = mix; + kRunNumber = runNumber; // Get the pointer to the existing analysis manager via the static access method. AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { + if (!mgr) + { ::Error("AddTask", "No analysis manager to connect to."); return NULL; } // Check the analysis type using the event handlers connected to the analysis manager. - if (!mgr->GetInputEventHandler()) { + if (!mgr->GetInputEventHandler()) + { ::Error("AddTask", "This task requires an input event handler"); return NULL; } + + // Make sure the B field is enabled for track selection, some cuts need it + ((AliInputEventHandler*)mgr->GetInputEventHandler())->SetNeedField(kTRUE); + kInputDataType = "AOD"; if(!kData.Contains("delta")) kInputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" - if(kSimulation) { + if(kSimulation) + { kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; if (!kUseKinematics && data=="AOD" && kInputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ... } cout<<"********* ACCESS KINE? "<=0) kName+=Form("Cen%d_%d",kMinCen,kMaxCen); + + printf("<<<< NAME: %s >>>>>\n",kName.Data()); + // #### Configure analysis #### AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker(); + maker->SetScaleFactor(scaleFactor); // for MC, negative (not scaled) by default + // General frame setting and configuration maker->SetReader (ConfigureReader() ); maker->SetCaloUtils(ConfigureCaloUtils()); // Analysis tasks setting and configuration Int_t n = 0;//Analysis number, order is important - maker->AddAnalysis(ConfigureQAAnalysis() , n++); // Isolation settings Int_t partInCone = AliIsolationCut::kNeutralAndCharged; // kOnlyCharged; - Int_t thresType = AliIsolationCut::kSumPtFracIC; // kPtThresIC; + Int_t thresType = AliIsolationCut::kPtThresIC;// AliIsolationCut::kSumPtFracIC ; + Float_t cone = -1; + Float_t pth = -1; + + // Photon analysis - if(kClusterArray=="" && kCalorimeter!="PHOS") + maker->AddAnalysis(ConfigurePhotonAnalysis(), n++); // Photon cluster selection + + // Invariant mass analysis Put here to tag selected photons as decay + maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, invariant mass and photon tagging from decay + maker->AddAnalysis(ConfigurePi0EbEAnalysis("Eta", AliAnaPi0EbE::kIMCalo), n++); // Eta event by event selection, invariant mass and photon tagging from decay + + // Photon analysis + maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType,cone, pth), n++); // Photon isolation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kFALSE), n++); // Gamma hadron correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated gamma hadron correlation + //maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType,kTRUE), n++); // Photon multi isolation, leave it the last + + + // Split cluster analysis + if(kCalorimeter == "EMCAL") + { + maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kSSCalo), n++); // Pi0 event by event selection, cluster splitting + maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS", partInCone,thresType,cone, pth), n++); // Pi0 isolation, cluster splits + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SS" ,kFALSE), n++); // Pi0 hadron correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SS" ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation + //maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SS", partInCone,thresType,kTRUE), n++); // Pi0 multi isolation, split cluster + maker->AddAnalysis(ConfigureInClusterIMAnalysis(kTRUE , kTRUE ), n++); + } + + // Invariant mass analysis + maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0SideBand", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, and photon tagging from decay + maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0", partInCone,thresType,cone, pth), n++); // Pi0 isolation, invariant mass + maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0SideBand", partInCone,thresType,cone, pth), n++); // Pi0 isolation, side band + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0" ,kFALSE), n++); // Pi0 hadron correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0" ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SideBand" ,kFALSE), n++); // Pi0 hadron correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0SideBand" ,kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated pi0 hadron correlation + //maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0", partInCone,thresType,kTRUE), n++); // Pi0 multi isolation, invariant mass, leave it the last + + if(kHadronAN) { - //Trigger on tracks, do only once, tracks do not depend on clusterizer maker->AddAnalysis(ConfigureChargedAnalysis(), n++); // track selection - maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",partInCone,thresType), n++); // track isolation + maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",AliIsolationCut::kOnlyCharged,thresType,cone, pth), n++); // track isolation maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kFALSE), n++); // track-track correlation - maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kTRUE) , n++); // Isolated track-track correlation - } - else + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Hadron",kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated track-track correlation + //maker->AddAnalysis(ConfigureIsolationAnalysis("Hadron",partInCone,thresType,kTRUE), n++);// Hadron multi isolation + } + + // Analysis with ghost triggers, only for Min Bias like events + if( kTrig.Contains("INT") || kTrig.Contains("Central") || kTrig.Contains("MB") ) { - maker->AddAnalysis(ConfigurePhotonAnalysis(), n++); // Photon cluster selection - maker->AddAnalysis(ConfigurePi0Analysis() , n++); // Pi0 invariant mass analysis - maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCalo), n++); // Pi0 event by event selection, and photon tagging from decay - maker->AddAnalysis(ConfigurePi0EbEAnalysis("Eta", AliAnaPi0EbE::kIMCalo), n++); // Eta event by event selection, and photon tagging from decay - - maker->AddAnalysis(ConfigureIsolationAnalysis("Photon", partInCone,thresType), n++); // Photon isolation - maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0", partInCone,thresType), n++); // Pi0 isolation - - maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kFALSE), n++); // Gamma hadron correlation - maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Photon",kTRUE) , n++); // Isolated gamma hadron correlation - maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0" ,kFALSE), n++); // Pi0 hadron correlation - maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("Pi0" ,kTRUE) , n++); // Isolated pi0 hadron correlation - /* - if(kInputDataType=="ESD"){ - printf("* Configure conversion analysis in part corr\n"); - maker->AddAnalysis(ConfigurePi0EbEAnalysis("Pi0", AliAnaPi0EbE::kIMCaloTracks), n++); // Pi0 (calo+conversion) event by event selection, - // and photon tagging from decay, need to execute at the same time conversions analysis - maker->AddAnalysis(ConfigureIsolationAnalysis("Pi0Conv",partInCone,thresType), n++); // Pi0 (Calo+Conv) isolation + maker->AddAnalysis(ConfigureRandomTriggerAnalysis(), n++); + maker->AddAnalysis(ConfigureIsolationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()), partInCone,thresType,cone, pth), n++); // Ghost trigger isolation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()),kFALSE), n++); // Ghost trigger hadron correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()),kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated ghost hadron correlation + //maker->AddAnalysis(ConfigureIsolationAnalysis(Form("RandomTrigger%s",kCalorimeter.Data()), partInCone,thresType,kTRUE), n++); // Ghost multi isolation + + if(kHadronAN) + { + maker->AddAnalysis(ConfigureRandomTriggerAnalysis("CTS"), n++); // track selection + maker->AddAnalysis(ConfigureIsolationAnalysis("RandomTriggerCTS",AliIsolationCut::kOnlyCharged,thresType,cone, pth), n++); // track isolation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("RandomTriggerCTS",kFALSE), n++); // track-track correlation + maker->AddAnalysis(ConfigureHadronCorrelationAnalysis("RandomTriggerCTS",kTRUE,partInCone,thresType, cone, pth) , n++); // Isolated track-track correlation + //maker->AddAnalysis(ConfigureIsolationAnalysis("RandomTriggerCTS",AliIsolationCut::kOnlyCharged,thresType,kTRUE), n++); // Ghost multi isolation } - */ } - - maker->SetAnaDebug(-1) ; + + if(kQA) maker->AddAnalysis(ConfigureQAAnalysis(),n++); + + maker->SetAnaDebug(kDebug) ; maker->SwitchOnHistogramsMaker() ; if(kData.Contains("delta")) maker->SwitchOffAODsMaker() ; else maker->SwitchOnAODsMaker() ; - + if(kPrint) maker->Print(""); - printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, kCalorimeter.Data()); + if(kSimulation) maker->SwitchOffDataControlHistograms(); + printf("<< End Configuration of %d analysis for calorimeter %s >>\n",n, kCalorimeter.Data()); + // Create task - AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("PartCorr%s_Trig%s_Cl%s",kCalorimeter.Data(),kTrig.Data(),kClusterArray.Data())); + AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CaloTrackCorr%s",kName.Data())); task->SetConfigFileName(""); //Don't configure the analysis via configuration file. - //task->SetDebugLevel(-1); - task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work + task->SetDebugLevel(kDebug); + task->SetBranches("ESD:AliESDRun.,AliESDHeader"); task->SetAnalysisMaker(maker); mgr->AddTask(task); //Create containers - if(outputfile.Length()==0)outputfile = AliAnalysisManager::GetCommonFileName(); + if(outputfile.Length()==0) outputfile = AliAnalysisManager::GetCommonFileName(); - AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("%s_Trig%s_Cl%s",kCalorimeter.Data(),kTrig.Data(),kClusterArray.Data()), TList::Class(), + AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(kName, TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s",outputfile.Data())); - AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts_Trig%s_Cl%s",kCalorimeter.Data(),kTrig.Data(), kClusterArray.Data()), TList::Class(), + AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("Param_%s",kName.Data()), TList::Class(), AliAnalysisManager::kParamContainer, - Form("%s",outputfile.Data())); + "AnalysisParameters.root"); + // Create ONLY the output containers for the data produced by the task. // Get and connect other common input/output containers via the manager as below //============================================================================== @@ -150,27 +249,11 @@ AliAnalysisTaskCaloTrackCorrelation *AddTaskCaloTrackCorr( mgr->ConnectOutput (task, 1, cout_pc); mgr->ConnectOutput (task, 2, cout_cuts); - - if(kTrig=="EMC7"){ - printf("PartCorr trigger EMC7\n"); - task->SelectCollisionCandidates(AliVEvent::kEMC7); - } - else if (kTrig=="INT7"){ - printf("PartCorr trigger INT7\n"); - task->SelectCollisionCandidates(AliVEvent::kINT7); - } - else if(kTrig=="EMC1"){ - printf("PartCorr trigger EMC1\n"); - task->SelectCollisionCandidates(AliVEvent::kEMC1); - } - else if(kTrig=="MB"){ - printf("PartCorr trigger MB\n"); - task->SelectCollisionCandidates(AliVEvent::kMB); - } - else if(kTrig=="PHOS"){ - printf("PartCorr trigger PHOS\n"); - task->SelectCollisionCandidates(AliVEvent::kPHI7); - } + if(!kMix) + { + UInt_t mask = SetTriggerMaskFromName(); + task->SelectCollisionCandidates(mask); + } return task; } @@ -180,12 +263,28 @@ AliCaloTrackReader * ConfigureReader() { AliCaloTrackReader * reader = 0; - if (kData.Contains("AOD")) reader = new AliCaloTrackAODReader(); - else if(kData=="ESD") reader = new AliCaloTrackESDReader(); - else if(kData=="MC" && - kInputDataType == "ESD") reader = new AliCaloTrackMCReader(); - - reader->SetDebug(-1);//10 for lots of messages + if (kInputDataType == "ESD"&& kData=="MC" ) + reader = new AliCaloTrackMCReader(); + else if(kInputDataType=="AOD" || kData.Contains("AOD")) + reader = new AliCaloTrackAODReader(); + else if(kInputDataType=="ESD") + reader = new AliCaloTrackESDReader(); + else + printf("AliCaloTrackReader::ConfigureReader() - Data combination not known kData=%s, kInputData=%s\n",kData.Data(),kInputDataType.Data()); + + reader->SetDebug(kDebug);//10 for lots of messages + + /* + if(kSimulation) + { + // Event rejection cuts for jet-jet simulations + reader->SetPtHardAndJetPtComparison(kTRUE); + reader->SetPtHardAndJetPtFactor(4); + + reader->SetPtHardAndClusterPtComparison(kTRUE); + reader->SetPtHardAndClusterPtFactor(1.5); + } + */ //Delta AOD? //reader->SetDeltaAODFileName(""); @@ -208,39 +307,125 @@ AliCaloTrackReader * ConfigureReader() //------------------------ //Min cluster/track E - reader->SetEMCALEMin(0.5); + reader->SetEMCALEMin(0.3); reader->SetEMCALEMax(1000); reader->SetPHOSEMin(0.3); reader->SetPHOSEMax(1000); - reader->SetCTSPtMin(0.1); + reader->SetCTSPtMin(0.2); reader->SetCTSPtMax(1000); + + // Time cuts + if(kSimulation) + { + reader->SwitchOffUseTrackTimeCut(); + reader->SwitchOffUseParametrizedTimeCut(); + reader->SwitchOffUseEMCALTimeCut(); + reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut + } + else + { + if(kCalibT) + { + printf("Set time cut parameters for run %d\n",kRunNumber); + reader->SwitchOnUseEMCALTimeCut(); + reader->SwitchOnUseParametrizedTimeCut(); + + //Absolute window + reader->SetEMCALTimeCut(-25,20); + + //Parametrization + if (kRunNumber >= 151636 && kRunNumber <= 155384 ) + { + printf("Set time parameters for LHC11c"); + reader->SetEMCALParametrizedMinTimeCut(0,-5 ); reader->SetEMCALParametrizedMinTimeCut(1,-1 ); reader->SetEMCALParametrizedMinTimeCut(2, 1.87); reader->SetEMCALParametrizedMinTimeCut(3, 0.4); + reader->SetEMCALParametrizedMaxTimeCut(0, 3.5); reader->SetEMCALParametrizedMaxTimeCut(1, 50); reader->SetEMCALParametrizedMaxTimeCut(2, 0.15); reader->SetEMCALParametrizedMaxTimeCut(3, 1.6); + } + else if(kRunNumber >= 156447 && kRunNumber <= 159635 ) + { + printf("Set time parameters for LHC11d"); + reader->SetEMCALParametrizedMinTimeCut(0,-5); reader->SetEMCALParametrizedMinTimeCut(1,-1 ); reader->SetEMCALParametrizedMinTimeCut(2, 3.5 ); reader->SetEMCALParametrizedMinTimeCut(3, 1. ); + reader->SetEMCALParametrizedMaxTimeCut(0, 5); reader->SetEMCALParametrizedMaxTimeCut(1, 50); reader->SetEMCALParametrizedMaxTimeCut(2, 0.45); reader->SetEMCALParametrizedMaxTimeCut(3, 1.25); + } + else + { + reader->SwitchOffUseParametrizedTimeCut(); + } + } + else + { + reader->SwitchOffUseParametrizedTimeCut(); + reader->SwitchOffUseEMCALTimeCut(); + reader->SetEMCALTimeCut(-1e10,1e10); // Open time cut + } + } - reader->SwitchOffFiducialCut(); - + reader->SwitchOnFiducialCut(); + reader->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ; + // Tracks reader->SwitchOnCTS(); - if(kInputDataType=="ESD"){ - gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/CreateTrackCutsPWG4.C"); - AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWG4(10041004); //no ITSrefit - reader->SetTrackCuts(esdTrackCuts); + reader->SwitchOffRejectNoTrackEvents(); + + reader->SwitchOffRecalculateVertexBC(); + reader->SwitchOffVertexBCEventSelection(); + + reader->SwitchOffUseTrackTimeCut(); + reader->SetTrackTimeCut(0,50); + + reader->SwitchOffUseTrackDCACut(); + //reader->SetTrackDCACut(0,0.0105); + //reader->SetTrackDCACut(1,0.035); + //reader->SetTrackDCACut(2,1.1); + + if(kInputDataType=="ESD") + { + gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C"); + //AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10041004); + //reader->SetTrackCuts(esdTrackCuts); + //reader->SwitchOnConstrainTrackToVertex(); + + if(kYears>2010) + { + //Hybrids 2011 + AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10001008); + reader->SetTrackCuts(esdTrackCuts); + AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10011008); + reader->SetTrackComplementaryCuts(esdTrackCuts2); + } + else + { + //Hybrids 2010 + AliESDtrackCuts * esdTrackCuts = CreateTrackCutsPWGJE(10001006); + reader->SetTrackCuts(esdTrackCuts); + AliESDtrackCuts * esdTrackCuts2 = CreateTrackCutsPWGJE(10041006); + reader->SetTrackComplementaryCuts(esdTrackCuts2); + } } - else if(kInputDataType=="AOD"){ - reader->SetTrackFilterMask(128); // Filter bit, not mask + else if(kInputDataType=="AOD") + { + //reader->SetTrackFilterMask(128); // Filter bit, not mask, use if off hybrid + reader->SwitchOnAODHybridTrackSelection(); // Check that the AODs have Hybrids!!!! + reader->SetTrackStatus(AliVTrack::kITSrefit); + //reader->SwitchOnTrackHitSPDSelection(); // Check that the track has at least a hit on the SPD, not much sense to use for hybrid or TPC only tracks } // Calorimeter reader->SetEMCALClusterListName(kClusterArray); - if(kClusterArray == "") { + if(kClusterArray == "" && !kTender) + { printf("**************** Standard EMCAL clusters branch analysis **************** \n"); reader->SwitchOnClusterRecalculation(); // Check in ConfigureCaloUtils that the recalibration and bad map are ON } - else { + else + { printf("**************** Input for analysis is Clusterizer %s **************** \n", kClusterArray.Data()); reader->SwitchOffClusterRecalculation(); } + if(!kNonLinearity) reader->SwitchOffClusterELinearityCorrection(); + //if(kCalorimeter == "EMCAL") { reader->SwitchOnEMCALCells(); reader->SwitchOnEMCAL(); @@ -251,7 +436,8 @@ AliCaloTrackReader * ConfigureReader() //} // for case data="deltaAOD", no need to fill the EMCAL/PHOS cluster lists - if(kData.Contains("delta")){ + if(kData.Contains("delta")) + { reader->SwitchOffEMCAL(); reader->SwitchOffPHOS(); reader->SwitchOffEMCALCells(); @@ -262,39 +448,62 @@ AliCaloTrackReader * ConfigureReader() // Event selection //----------------- - // Settings for LHC11a - if(kRunNumber > 140000 && kRunNumber < = 146860){ - if(kClusterArray == "") reader->SwitchOnLEDEventsRemoval(); - reader->RejectFastClusterEvents(); - printf("Reader: Reject LED events and Fast cluster\n"); - } - + //reader->RejectFastClusterEvents() ; + + // Event triggered selection settings + reader->SwitchOnTriggerPatchMatching(); + reader->SwitchOnBadTriggerEventsRemoval(); // only if SwitchOnTriggerPatchMatching(); + reader->SwitchOnUnMatchedTriggerEventsRemoval(); // only if SwitchOnBadTriggerEventsRemoval(); + //reader->SwitchOffTriggerClusterTimeRecal() ; + + reader->SetTriggerPatchTimeWindow(8,9); // L0 + if (kRunNumber < 146861) reader->SetEventTriggerL0Threshold(3.); + else if(kRunNumber < 154000) reader->SetEventTriggerL0Threshold(4.); + else if(kRunNumber < 165000) reader->SetEventTriggerL0Threshold(5.5); + + //redefine for other periods, triggers + //if(!kUseKinematics) reader->SetFiredTriggerClassName("CEMC7EGA-B-NOPF-CENTNOTRD"); // L1 Gamma - if (kCollisions=="pp" ) { - if(kRunNumber < 140000) reader->SwitchOnEventSelection(); // remove pileup by default - else reader->SwitchOffEventSelection(); - reader->SwitchOffV0ANDSelection() ; // and besides v0 AND - reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex - reader->SetZvertexCut(50.); // Open cut + // For mixing with AliAnaParticleHadronCorrelation switch it off + if(kMix) + { + reader->SwitchOffEventTriggerAtSE(); + UInt_t mask = SetTriggerMaskFromName(); + reader->SetEventTriggerMask(mask); // Only for mixing and SwitchOffEventTriggerAtSE(); + //reader->SetMixEventTriggerMask(AliVEvent::kMB); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT + reader->SetMixEventTriggerMask(AliVEvent::kAnyINT); // Careful, not all productions work with kMB, try kINT7, kINT1, kAnyINT + + printf("---Trigger selection done in AliCaloTrackReader!!!\n"); + } + else + reader->SwitchOnEventTriggerAtSE(); + + reader->SetZvertexCut(10.); // Open cut + reader->SwitchOnPrimaryVertexSelection(); // and besides primary vertex + + if(kEventSelection) + { + reader->SwitchOnEventPileUpRejection(); // remove pileup by default + reader->SwitchOnV0ANDSelection() ; // and besides v0 AND + } + else + { + reader->SwitchOffPileUpEventRejection();// remove pileup by default + reader->SwitchOffV0ANDSelection() ; // and besides v0 AND } - else if(kCollisions=="PbPb") { - reader->SwitchOffEventSelection(); // remove pileup by default - reader->SwitchOffV0ANDSelection() ; // and besides v0 AND - reader->SwitchOffPrimaryVertexSelection(); // and besides primary vertex - reader->SetZvertexCut(10.); // Centrality defined in this range. + if(kCollisions=="PbPb") + { // Centrality reader->SetCentralityClass("V0M"); - reader->SetCentralityOpt(10); // 10 (c= 0-10, 10-20 ...), 20 (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..) - reader->SetCentralityBin(-1,-1); // Accept all events, if not select range + reader->SetCentralityOpt(100); // 10 (c= 0-10, 10-20 ...), 20 (c= 0-5, 5-10 ...) or 100 (c= 1, 2, 3 ..) + reader->SetCentralityBin(kMinCen,kMaxCen); // Accept all events, if not select range - // Event plane (only used in AliAnaPi0 for the moment) - reader->SetEventPlaneMethod("Q"); + // Event plane (only used in Maker and mixing for AliAnaPi0/AliAnaHadronCorrelation for the moment) + reader->SetEventPlaneMethod("V0"); } - reader->SetImportGeometryFromFile(kTRUE); - if(kPrint) reader->Print(""); return reader; @@ -306,117 +515,86 @@ AliCalorimeterUtils* ConfigureCaloUtils() { AliCalorimeterUtils *cu = new AliCalorimeterUtils; - cu->SetDebug(-1); + cu->SetDebug(kDebug); // Remove clusters close to borders, at least max energy cell is 1 cell away cu->SetNumberOfCellsFromEMCALBorder(1); cu->SetNumberOfCellsFromPHOSBorder(2); - if(kClusterArray == "") - cu->SwitchOffRecalculateClusterTrackMatching(); // Done in clusterization - else - cu->SwitchOnRecalculateClusterTrackMatching(); + // Search of local maxima in cluster + if(kCollisions=="pp") + { + cu->SetLocalMaximaCutE(0.1); + cu->SetLocalMaximaCutEDiff(0.03); + if(kName.Contains("150")) + { + printf("Reclusterize with 150 threshold, set PbPb settings\n"); + cu->SetLocalMaximaCutE(0.2); + cu->SetLocalMaximaCutEDiff(0.03); + } + } + else + { + cu->SetLocalMaximaCutE(0.2); + cu->SetLocalMaximaCutEDiff(0.03); + } + + cu->SwitchOffClusterPlot(); + + if(kRecalTM) cu->SwitchOnRecalculateClusterTrackMatching(); // Done in clusterization + else cu->SwitchOffRecalculateClusterTrackMatching(); cu->SwitchOnBadChannelsRemoval() ; //EMCAL settings - if(kCalorimeter=="EMCAL"){ - - if(kYears==2010) cu->SetEMCALGeometryName("EMCAL_FIRSTYEARV1"); - else cu->SetEMCALGeometryName("EMCAL_COMPLETEV1"); - - AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils(); - - Bool_t bCalib = kTRUE; - Bool_t bBadMap= kTRUE; - cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering - - TGeoHMatrix* matrix[12]; - gROOT->LoadMacro("ConfigureEMCALRecoUtils.C"); - ConfigureEMCALRecoUtils( - recou, - kSimulation, - matrix, - "",//AODB path, default - kRunNumber, - kPass, - bCalib, - bBadMap - ); - - printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn()); - printf("ConfigureCaloUtils() - EMCAL BadMap ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn()); - - //Alignment matrices - cu->SwitchOffLoadOwnEMCALGeometryMatrices(); - /* - for (Int_t mod=0;mod<12;mod++) - { - //((TGeoHMatrix*) mobj->At(mod))->Print(); - cu->SetEMCALGeometryMatrixInSM(matrix[mod],mod); - } - */ - - // Non linearity - if(kCollisions=="pp" ) { // Do only for pp for the moment - cu->SwitchOnCorrectClusterLinearity(); - if(!kSimulation) recou->SetNonLinearityFunction(AliEMCALRecoUtils::kBeamTestCorrected); - else recou->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC); - } - - recou->SwitchOnRejectExoticCell(); // on for QA cells - recou->SwitchOffRejectExoticCluster(); // Done in clusterizer - - } - else { // PHOS settings - - Int_t run2010 = kRunNumber; - //Use a fixed run number from year 2010 for 2011 runs, not available yet. - if(kRunNumber > 140000) run2010 = 139000; - - // Bad map - - AliOADBContainer badmapContainer(Form("phosBadMap")); - TString fileName="$ALICE_ROOT/OADB/PHOS/PHOSBadMaps.root"; - //if(path!="") fileName=path+"PHOSBadMaps.root"; - badmapContainer.InitFromFile((char*)fileName.Data(),"phosBadMap"); - //Use a fixed run number from year 2010, this year not available yet. - TObjArray *maps = (TObjArray*)badmapContainer.GetObject(run2010,"phosBadMap"); - if(!maps){ - printf("Can not read Bad map for run %d. \n You may choose to use your map with ForceUsingBadMap()\n",run2010) ; - } - else{ - printf("Setting PHOS bad map with name %s \n",maps->GetName()) ; - for(Int_t mod=1; mod<5;mod++){ - TH2I *hbmPH = cu->GetPHOSChannelStatusMap(mod); - - if(hbmPH) - delete hbmPH ; - hbmPH=(TH2I*)maps->At(mod); - - if(hbmPH) hbmPH->SetDirectory(0); - - cu->SetPHOSChannelStatusMap(mod-1,hbmPH); - } - } + + if(!kSimulation) + cu->SwitchOnLoadOwnEMCALGeometryMatrices(); + + AliEMCALRecoUtils * recou = cu->GetEMCALRecoUtils(); + + if(!kSimulation) + { + cu->SwitchOnRecalibration(); // Check the reader if it is taken into account during filtering + if(kClusterArray == "" && !kTender) cu->SwitchOnRunDepCorrection(); + } + + gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C"); + ConfigureEMCALRecoUtils(recou, + kSimulation, + kExotic, + kTRUE,//kNonLinearity, + kCalibE, + kBadMap, + kCalibT); + //recou->SetExoticCellDiffTimeCut(50.); + + + if( kNonLinearity ) + { + printf("ConfigureCaloUtils() - Apply non linearity to EMCAL\n"); + cu->SwitchOnCorrectClusterLinearity(); + } - //Alignment matrices - cu->SwitchOffLoadOwnPHOSGeometryMatrices(); - /* - fileName="$ALICE_ROOT/OADB/PHOS/PHOSGeometry.root"; - //if(path!="") fileName=path+"PHOSGeometry.root"; - AliOADBContainer geomContainer("phosGeo"); - geomContainer.InitFromFile((char*)fileName.Data(),"PHOSRotationMatrixes"); - TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(run2010,"PHOSRotationMatrixes"); - for (Int_t mod=0;mod<5;mod++) - { - printf("PHOS matrices mod %d, %p\n",mod,((TGeoHMatrix*)matrixes->At(mod))); - //((TGeoHMatrix*) mobj->At(mod))->Print(); - cu->SetPHOSGeometryMatrixInSM(((TGeoHMatrix*)matrixes->At(mod)),mod); - } - */ - }// PHOS + printf("ConfigureCaloUtils() - EMCAL Recalibration ON? %d %d\n",recou->IsRecalibrationOn(), cu->IsRecalibrationOn()); + printf("ConfigureCaloUtils() - EMCAL BadMap ON? %d %d\n",recou->IsBadChannelsRemovalSwitchedOn(), cu->IsBadChannelsRemovalSwitchedOn()); + + + if(kCalorimeter=="PHOS") + { + if (kYears < 2014) cu->SetNumberOfSuperModulesUsed(3); + else cu->SetNumberOfSuperModulesUsed(4); + } + else + { + if (kYears == 2010) cu->SetNumberOfSuperModulesUsed(4); //EMCAL first year + else if (kYears < 2014) cu->SetNumberOfSuperModulesUsed(10); + else cu->SetNumberOfSuperModulesUsed(20); + } + // PHOS + cu->SwitchOffLoadOwnPHOSGeometryMatrices(); + if(kPrint) cu->Print(""); return cu; @@ -427,259 +605,651 @@ AliCalorimeterUtils* ConfigureCaloUtils() AliAnaPhoton* ConfigurePhotonAnalysis() { - AliAnaPhoton *anaphoton = new AliAnaPhoton(); - anaphoton->SetDebug(-1); //10 for lots of messages + AliAnaPhoton *ana = new AliAnaPhoton(); + ana->SetDebug(kDebug); //10 for lots of messages // cluster selection cuts - anaphoton->SwitchOffFiducialCut(); - - anaphoton->SetCalorimeter(kCalorimeter); + ana->SwitchOffFiducialCut(); + + ana->SetCalorimeter(kCalorimeter); - if(kCalorimeter == "PHOS"){ - anaphoton->SetNCellCut(2);// At least 2 cells - anaphoton->SetMinPt(0.3); - anaphoton->SetMinDistanceToBadChannel(2, 4, 5); - anaphoton->SetTimeCut(-2000,2000); // open cut + if(kCalorimeter == "PHOS") + { + ana->SetNCellCut(2);// At least 3 cells + ana->SetMinPt(0.3); + ana->SetMinDistanceToBadChannel(2, 4, 5); + ana->SetTimeCut(-1e10,1e10); // open cut } - else {//EMCAL - anaphoton->SetNCellCut(1);// At least 2 cells - anaphoton->SetMinPt(0.5); // avoid mip peak at E = 260 MeV - anaphoton->SetMaxPt(1000); - anaphoton->SetTimeCut(-1000,1000); // open cut, usual time window of [425-825] ns if time recalibration is off + else + {//EMCAL + ana->SetNCellCut(1);// At least 2 cells + ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV + ana->SetMaxEnergy(1000); + ana->SetTimeCut(-1e10,1e10); // open cut, usual time window of [425-825] ns if time recalibration is off // restrict to less than 100 ns when time calibration is on - anaphoton->SetMinDistanceToBadChannel(1, 2, 3); // For filtered AODs, new releases. + ana->SetMinDistanceToBadChannel(2, 4, 6); + + // NLM cut, used in all, exclude clusters with more than 2 maxima + // Not needed if M02 cut is already strong or clusterizer V2 + ana->SetNLMCut(1, 2) ; } - anaphoton->SwitchOnTrackMatchRejection() ; + if(kTM) + { + ana->SwitchOnTrackMatchRejection() ; + ana->SwitchOffTMHistoFill() ; + } + else + { + ana->SwitchOffTrackMatchRejection() ; + ana->SwitchOnTMHistoFill() ; + } //PID cuts (shower shape) - anaphoton->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian - AliCaloPID* caloPID = anaphoton->GetCaloPID(); + ana->SwitchOnCaloPID(); // do PID selection, unless specified in GetCaloPID, selection not based on bayesian + AliCaloPID* caloPID = ana->GetCaloPID(); //Not used in bayesian //EMCAL - caloPID->SetEMCALLambda0CutMax(0.30); + caloPID->SetEMCALLambda0CutMax(0.27); caloPID->SetEMCALLambda0CutMin(0.10); caloPID->SetEMCALDEtaCut(0.025); - caloPID->SetEMCALDPhiCut(0.05); - // In case of official AODs when dX and dZ was not stored, open the cuts - // and rely on having a match recorded. In case of reclusterization, try. - if(kData=="AOD" && kClusterArray==""){ - caloPID->SetEMCALDEtaCut(2000); - caloPID->SetEMCALDPhiCut(2000); - } - + caloPID->SetEMCALDPhiCut(0.030); + //PHOS caloPID->SetPHOSDispersionCut(2.5); caloPID->SetPHOSRCut(2.); - if(kData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored + if(kInputData=="AOD") caloPID->SetPHOSRCut(2000.); // Open cut since dX, dZ not stored + + ana->SwitchOffFillShowerShapeHistograms(); // Filled before photon shower shape selection + if(!kSimulation)ana->SwitchOnFillPileUpHistograms(); + //if(!kSimulation) ana->SwitchOnFillEMCALBCHistograms(); + + // Input / output delta AOD settings - if(kCalorimeter=="PHOS"){ - caloPID->SetHistoDEtaRangeAndNBins(-200, 200, 200); // dZ - caloPID->SetHistoDPhiRangeAndNBins(-200, 200, 200); // dX + if(!kData.Contains("delta")) + { + ana->SetOutputAODName(Form("Photon%s",kName.Data())); + ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); + //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done } + else ana->SetInputAODName(Form("Photon%s",kName.Data())); - //caloPID->SetTOFCut(10000000); // Not used, only to set PID bits + //Set Histograms name tag, bins and ranges - anaphoton->SwitchOffFillShowerShapeHistograms(); // Filled before photon shower shape selection + ana->AddToHistogramsName(Form("AnaPhoton_TM%d_",kTM)); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below - // Input / output delta AOD settings + // Number of particle type MC histograms + ana->FillNOriginHistograms(20); + ana->FillNPrimaryHistograms(20); - if(!kData.Contains("delta")) { - anaphoton->SetOutputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); - //anaphoton->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done - } - else anaphoton->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); + ana->SwitchOnRealCaloAcceptance(); // primary particle acceptance histograms + ConfigureMC(ana); - //Set Histograms name tag, bins and ranges + if(kPrint) ana->Print(""); - anaphoton->AddToHistogramsName("AnaPhoton_"); - SetHistoRangeAndNBins(anaphoton->GetHistogramRanges()); // see method below + return ana; - // Number of particle type MC histograms - anaphoton->FillNOriginHistograms(8); - anaphoton->FillNPrimaryHistograms(4); +} + +//________________________________________________________________ +AliAnaEMCALTriggerClusters* ConfigureEMCALTriggerClusterAnalysis() +{ + // For filling all histograms meaninfully, in the reader, time cut must be off + // and bad triggered events not rejected, and of course analyze triggered events. + + AliAnaEMCALTriggerClusters *ana = new AliAnaEMCALTriggerClusters(); + ana->SetDebug(kDebug); //10 for lots of messages + + // cluster selection cuts - if(kSimulation) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anaphoton->SwitchOffDataMC() ; + ana->SwitchOffFiducialCut(); + ana->SetNCellCut(1);// At least 2 cells + ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV + ana->SetMaxEnergy(1000); + ana->SetM02(1, 2) ; + ana->SwitchOnTrackMatchRejection() ; + + ana->AddToHistogramsName("EMCTriggerClusters_"); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + if(kPrint) ana->Print(""); + + return ana; + +} - if(kPrint) anaphoton->Print(""); +//___________________________________________________ +AliAnaClusterPileUp* ConfigureClusterPileUpAnalysis() +{ + // For filling all histograms meaninfully, in the reader, time cut must be off + // and bad triggered events in different BC not rejected + + AliAnaClusterPileUp *ana = new AliAnaClusterPileUp(); + ana->SetDebug(kDebug); //10 for lots of messages - return anaphoton; + // cluster selection cuts + + ana->SwitchOffFiducialCut(); + ana->SetNCellCut(1);// At least 2 cells + ana->SetMinEnergy(0.3); // avoid mip peak at E = 260 MeV + ana->SetMaxEnergy(1000); + + ana->AddToHistogramsName("ClusterPileUp_"); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + if(kPrint) ana->Print(""); + + return ana; } -//_______________________________________________ -AliAnaChargedParticles* ConfigureChargedAnalysis() +//________________________________________________________________________________ +AliAnaElectron* ConfigureElectronAnalysis() { - AliAnaChargedParticles *anatrack = new AliAnaChargedParticles(); - anatrack->SetDebug(-1); //10 for lots of messages + AliAnaElectron *ana = new AliAnaElectron(); + ana->SetDebug(kDebug); //10 for lots of messages - // selection cuts + ana->FillAODWithElectrons(); + //ana->FillAODWithHadrons(); + //ana->FillAODWithAny(); - anatrack->SetDebug(-1);//10 for lots of messages - anatrack->SetMinPt(5.); - anatrack->SwitchOffFiducialCut(); + if(kCalorimeter == "PHOS") + { + ana->SetNCellCut(2);// At least 2 cells + ana->SetMinPt(0.3); + ana->SetMinDistanceToBadChannel(2, 4, 5); + } + else + {//EMCAL + ana->SetNCellCut(1);// At least 2 cells + ana->SetMinPt(0.5); // no effect minium EMCAL cut. + ana->SetMaxPt(100); + //ana->SetTimeCut(400,900);// Time window of [400-900] ns + ana->SetMinDistanceToBadChannel(2, 4, 6); + } - // Input / output delta AOD settings + //Electron selection cuts with tracks + ana->SetEOverP(0.85, 1.2); + + // TO DO, find a more suitable way to set this + if (kRunNumber < 146861) ana->SetdEdxCut(72, 90); + else if(kRunNumber < 154000) ana->SetdEdxCut(54, 70); + else ana->SetdEdxCut(74, 90); + + if(kSimulation) ana->SetdEdxCut(80, 100); + + ana->SetCalorimeter(kCalorimeter); + + ana->SwitchOnCaloPID(); + + AliCaloPID* caloPID = ana->GetCaloPID(); + + caloPID->SetEMCALLambda0CutMax(0.27); + caloPID->SetEMCALLambda0CutMin(0.10); + + ana->SwitchOffFillShowerShapeHistograms(); + ana->SwitchOffFillWeightHistograms() ; + ana->SwitchOffFiducialCut(); - if(!kData.Contains("delta")) { - anatrack->SetOutputAODName(Form("Hadron%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - anatrack->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); - //anaphoton->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done + if(!kData.Contains("delta")) + { + ana->SetOutputAODName(Form("Electron%s",kName.Data())); + ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); } - else anatrack->SetInputAODName(Form("Hadron%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - printf("Set Hadron%s_Trig%s_Cl%s\n",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data()); + else ana->SetInputAODName(Form("Electron%s",kName.Data())); + //Set Histograms name tag, bins and ranges - anatrack->AddToHistogramsName("AnaHadrons_"); - SetHistoRangeAndNBins(anatrack->GetHistogramRanges()); // see method below - - if(kSimulation) anatrack->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anatrack->SwitchOffDataMC() ; + ana->AddToHistogramsName(Form("AnaElectron_TM%d_",kTM)); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + ConfigureMC(ana); - if(kPrint) anatrack->Print(""); + if(kPrint) ana->Print(""); - return anatrack; + return ana ; } +//__________________________________________________________________________________________ +AliAnaRandomTrigger* ConfigureRandomTriggerAnalysis(TString detector = "") +{ + + AliAnaRandomTrigger *ana = new AliAnaRandomTrigger(); + ana->SetDebug(kDebug); //10 for lots of messages + + if(detector=="") detector = kCalorimeter; + ana->SetDetector(detector); + + // selection cuts + ana->SetMinPt(4.); + ana->SetMaxPt(51.); + + if (detector=="EMCAL") + { + ana->SetEtaCut(-0.71,0.71); + ana->SetPhiCut(100*TMath::DegToRad(), 160*TMath::DegToRad()); + } + else if(detector=="PHOS") + { + ana->SetEtaCut(-0.13,0.13); + ana->SetPhiCut(260*TMath::DegToRad(), 320*TMath::DegToRad()); + } + else if(detector=="CTS") + { + ana->SetEtaCut(-0.9,0.9); + ana->SetPhiCut(0, TMath::TwoPi()); + } + + // AOD branch + if(!kData.Contains("delta")) + { + ana->SetOutputAODName(Form("RandomTrigger%s%s",detector.Data(),kName.Data())); + ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); + } + else + ana->SetInputAODName(Form("RandomTrigger%s%s",detector.Data(),kName.Data())); + + printf("Set RandomTrigger%s%s\n",detector.Data(),kName.Data()); + + //Set Histograms name tag, bins and ranges + + ana->AddToHistogramsName(Form("AnaRandomTrigger%s_",detector.Data())); + + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + if(detector=="CTS") + { + ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ; + ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ; + } + + if(kPrint) ana->Print(""); + + return ana; + +} -//_______________________________ -AliAnaPi0* ConfigurePi0Analysis() +//__________________________________________________________________________________________ +AliAnaInsideClusterInvariantMass* ConfigureInClusterIMAnalysis(Bool_t useSS = kTRUE, Bool_t useAsy = kFALSE) { + AliAnaInsideClusterInvariantMass *ana = new AliAnaInsideClusterInvariantMass(); + ana->SetDebug(kDebug); //10 for lots of messages + + // selection cuts + + ana->SetMinEnergy(6); + ana->SetMaxEnergy(200.); + ana->SetMinNCells(6); // check same as in calopid - AliAnaPi0 *anapi0 = new AliAnaPi0(); + ana->SetCalorimeter(kCalorimeter); + ana->SwitchOnSplitClusterDistToBad(); - anapi0->SetDebug(-1);//10 for lots of messages - if(kPrint) anapi0->Print(""); + ana->SwitchOffFillSSWeightHistograms() ; + ana->SetNWeightForShowerShape(0); + //ana->SetWeightForShowerShape(0, 4.6); + + ana->SwitchOnFillNCellHistograms(); + ana->SwitchOffFillEbinHistograms(); + if(!useSS && !useAsy) ana->SwitchOnFillEbinHistograms(); + + if(!kTM) + { + ana->SwitchOnFillTMHistograms(); + ana->SwitchOnFillTMResidualHistograms(); + } + else + { + ana->SwitchOffFillTMHistograms(); + ana->SwitchOffFillTMResidualHistograms(); + } - // Input delta AOD settings - anapi0->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); + //printf("Set correction slope for SS weight \n"); + //ana->SetWCorrectionParameter(0.07); + //ana->SetNECellCutForShowerShape(0); + //ana->SetECellCutForShowerShape(0, 0.07); + //ana->SetECellCutForShowerShape(1, 0.1); + //ana->SetECellCutForShowerShape(2, 0.2); - // Calorimeter settings - anapi0->SetCalorimeter(kCalorimeter); - if(kCalorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year - else { - if(kYears==2010) anapi0->SetNumberOfModules(4); //EMCAL first year - else anapi0->SetNumberOfModules(10); + if(kSimulation) + { + ana->SwitchOnFillMCPrimaryHistograms() ; + ana->SwitchOffFillMCOverlapHistograms() ; // Off when possible + if(!useSS && !useAsy) ana->SwitchOnFillMCOverlapHistograms() ; } - //settings for pp collision mixing - anapi0->SwitchOnOwnMix(); //Off when mixing done with general mixing frame + AliCaloPID* caloPID = ana->GetCaloPID(); + caloPID->SetEMCALDEtaCut(0.025); + caloPID->SetEMCALDPhiCut(0.030); + caloPID->SetClusterSplittingM02Cut(0,100000); // use parametrized cut, not fixed + + caloPID->SetPi0MassRange(0.11, 0.18); + caloPID->SetEtaMassRange(0.40, 0.60); + caloPID->SetPhotonMassRange(0.00, 0.08); + + caloPID->SetSplitWidthSigma(3.); // cut at 3 sigma of the mean pi0 peak. + + caloPID->SetClusterSplittingMinNCells(6); + + if(kCollisions=="PbPb" || kName.Contains("150")) + { + caloPID->SetClusterSplittingMinNCells(4); + ana->SetMinNCells(4); + caloPID->SetPi0MassShiftHighECell(0.005); + if(kCollisions=="PbPb") ana->SwitchOnFillHighMultHistograms(); + } - // Cuts - if(kCalorimeter=="EMCAL") anapi0->SetPairTimeCut(70); + ana->AddToHistogramsName("AnaInClusterIM_"); - if (kCollisions=="pp" ) { - anapi0->SetNCentrBin(1); - anapi0->SetNZvertBin(10); - anapi0->SetNRPBin(1); - anapi0->SetNMaxEvMix(100); - anapi0->SwitchOffSMCombinations(); - anapi0->SwitchOffMultipleCutAnalysis(); + if(useAsy) + { + caloPID->SwitchOnSplitAsymmetryCut() ; } - else if(kCollisions=="PbPb") { - anapi0->SetNCentrBin(10); - anapi0->SetNZvertBin(10); - anapi0->SetNRPBin(4); - anapi0->SetNMaxEvMix(10); - anapi0->SwitchOffSMCombinations(); + else + { + printf("InClusterIM: Do not apply Asy cut on merged pi0 in cluster analysis \n"); + caloPID->SwitchOffSplitAsymmetryCut() ; + ana->AddToHistogramsName("AnaInClusterIM_OpenAsy_"); } - //Set Histograms name tag, bins and ranges + if(!useSS) + { + printf("InClusterIM: Do not apply SS cut on merged pi0 in cluster analysis \n"); + caloPID->SwitchOffSplitShowerShapeCut() ; + ana->AddToHistogramsName("AnaInClusterIM_OpenSS_"); + } + else caloPID->SwitchOnSplitShowerShapeCut() ; - anapi0->AddToHistogramsName("AnaPi0_"); - SetHistoRangeAndNBins(anapi0->GetHistogramRanges()); // see method below + if(!useAsy && !useSS) + { + printf("InClusterIM: Do not apply SS and Asy cut on merged pi0 in cluster analysis \n"); + ana->AddToHistogramsName("AnaInClusterIM_OpenSS_OpenAsy_"); + } + + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + ConfigureMC(ana); - if(kSimulation) anapi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anapi0->SwitchOffDataMC() ; + if(kPrint) ana->Print(""); + + return ana; + +} - return anapi0; +//_______________________________________________ +AliAnaChargedParticles* ConfigureChargedAnalysis() +{ + + AliAnaChargedParticles *ana = new AliAnaChargedParticles(); + ana->SetDebug(kDebug); //10 for lots of messages + + // selection cuts + + ana->SetMinPt(0.5); + ana->SwitchOnFiducialCut(); + ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.8, 0, 360) ; //more restrictive cut in reader and after in isolation + + ana->SwitchOnFillVertexBC0Histograms() ; + if(!kSimulation) ana->SwitchOnFillPileUpHistograms(); + + // Input / output delta AOD settings + + if(!kData.Contains("delta")) + { + ana->SetOutputAODName(Form("Hadron%s",kName.Data())); + ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); + //ana->SetOutputAODClassName("AliAODPWG4Particle"); // use if no correlation done + } + else + ana->SetInputAODName(Form("Hadron%s",kName.Data())); + printf("Set Hadron%s\n",kName.Data()); + + //Set Histograms name tag, bins and ranges + + ana->AddToHistogramsName("AnaHadrons_"); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ; + ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ; + + ConfigureMC(ana); + + if(kPrint) ana->Print(""); + + return ana; } + //_____________________________________________________ -AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle, - Int_t analysis) +AliAnaPi0EbE* ConfigurePi0EbEAnalysis(TString particle, + Int_t analysis, Bool_t useSS = kTRUE, Bool_t useAsy = kTRUE) { - AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE(); - anapi0ebe->SetDebug(-1);//10 for lots of messages + AliAnaPi0EbE *ana = new AliAnaPi0EbE(); + ana->SetDebug(kDebug);//10 for lots of messages - anapi0ebe->SetAnalysisType(analysis); + ana->SetAnalysisType(analysis); TString opt = ""; - if(analysis==AliAnaPi0EbE::kIMCaloTracks) opt = "Conv"; - if(analysis==AliAnaPi0EbE::kSSCalo) opt = "SS"; + if(analysis == AliAnaPi0EbE::kIMCaloTracks) opt = "Conv"; + if(analysis == AliAnaPi0EbE::kSSCalo) opt = "SS"; - anapi0ebe->SwitchOffFillWeightHistograms(); - anapi0ebe->SetMinPt(0.5); - if(kCalorimeter=="EMCAL")anapi0ebe->SetPairTimeCut(20); - anapi0ebe->SetCalorimeter(kCalorimeter); + if(analysis == AliAnaPi0EbE::kIMCalo && kCalorimeter=="EMCAL" && !kSimulation) ana->SetPairTimeCut(100); + if(analysis == AliAnaPi0EbE::kIMCaloTracks) ana->SetInputAODGammaConvName("PhotonsCTS"); + + // Common settings for all 3 type of analysis - // Input / output delta AOD settings + ana->SwitchOnSelectedClusterHistoFill(); + + ana->SetCalorimeter(kCalorimeter); + + //Set Histograms name tag, bins and ranges + ana->AddToHistogramsName(Form("Ana%s%sEbE_TM%d_",particle.Data(),opt.Data(),kTM)); + + // Specific settings for different type of analysis - anapi0ebe->SetInputAODName(Form("Photon%s_Trig%s_Cl%s",kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - if(!kInputDataType.Contains("delta")) { - anapi0ebe->SetOutputAODName(Form("%s%s%s_Trig%s_Cl%s",particle.Data(), opt.Data(), kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); + ana->SwitchOffFillWeightHistograms(); + if(!kSimulation) ana->SwitchOnFillPileUpHistograms(); + + if(kTM) + { + //printf("--->>>REMOVE MATCHED Pi0\n"); + ana->SwitchOnTrackMatchRejection() ; + ana->SwitchOffTMHistoFill() ; } - else anapi0ebe->SetInputAODName(Form("%s%s%s_Trig%s_Cl%s",particle.Data(),opt.Data(),kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); + else + { + //printf("---->>>ACCEPT MATCHED Pi0\n"); + ana->SwitchOffTrackMatchRejection() ; + ana->SwitchOnTMHistoFill() ; + } + + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + //ana->SwitchOnFillEMCALBCHistograms(); - if(analysis == AliAnaPi0EbE::kIMCaloTracks) anapi0ebe->SetInputAODGammaConvName("PhotonsCTS"); + if(kPrint) ana->Print(""); - if(analysis!=AliAnaPi0EbE::kSSCalo){ + ConfigureMC(ana); + + if(!kInputDataType.Contains("delta")) + { + ana->SetOutputAODName(Form("%s%s%s",particle.Data(), opt.Data(), kName.Data())); + ana->SetOutputAODClassName("AliAODPWG4ParticleCorrelation"); + + } + else + ana->SetInputAODName(Form("%s%s%s",particle.Data(),opt.Data(),kName.Data())); + + if(analysis!=AliAnaPi0EbE::kSSCalo) + { + // Input / output delta AOD settings - AliNeutralMesonSelection *nms = anapi0ebe->GetNeutralMesonSelection(); + ana->SetInputAODName(Form("Photon%s",kName.Data())); + + AliNeutralMesonSelection *nms = ana->GetNeutralMesonSelection(); nms->SetParticle(particle); + + // Tighten a bit mass cut with respect to default window + if(particle=="Pi0") nms->SetInvMassCutRange(0.120,0.150); + if(particle=="Eta") nms->SetInvMassCutRange(0.520,0.580); + + //if(!particle.Contains("SideBand")) nms->SwitchOnAngleSelection(); + //else nms->SwitchOnAngleSelection(); + nms->SwitchOffAngleSelection(); + if(particle.Contains("Pi0SideBand")) // For pi0, do not consider left band + nms->SetSideBandCutRanges(-1,0,0.180,0.220); + nms->KeepNeutralMesonSelectionHistos(kTRUE); //nms->SetAngleMaxParam(2,0.2); - nms->SetHistoERangeAndNBins(0, 20, 100) ; + nms->SetHistoERangeAndNBins(0, 20, 80) ; //nms->SetHistoIMRangeAndNBins(0, 1, 400); } + else + { // cluster splitting settings + ana->SetMinEnergy(6); + ana->SetMaxEnergy(200.); + + ana->SetNLMMinEnergy(0, 10); + ana->SetNLMMinEnergy(1, 6); + ana->SetNLMMinEnergy(2, 6); + + ana->SetMinDistanceToBadChannel(2, 4, 6); // only use the first one + ana->SwitchOnSplitClusterDistToBad(); + + ana->SetTimeCut(-1e10,1e10); // Open time cut + + // NLM cut, used in all, exclude clusters with more than 2 maxima + ana->SetNLMCut(1, 2) ; + + AliCaloPID* caloPID = ana->GetCaloPID(); + + caloPID->SetSplitWidthSigma(3.); // cut at 3 sigma of the mean pi0 peak. + + if(!useSS) + { + printf("Do not apply SS cut on merged pi0 analysis \n"); + caloPID->SwitchOffSplitShowerShapeCut() ; + ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenSS_TM%d_",particle.Data(),opt.Data(),kTM)); + ana->SetOutputAODName(Form("%s%s%s_OpenSS",particle.Data(), opt.Data(), kName.Data())); + caloPID->SetClusterSplittingM02Cut(0.1,10000); + } + else + { + caloPID->SetClusterSplittingM02Cut(0.3,5); // Do the selection in the analysis class and not in the PID method to fill SS histograms + caloPID->SwitchOnSplitShowerShapeCut() ; + } + + if(useAsy) caloPID->SwitchOnSplitAsymmetryCut() ; + else + { + caloPID->SwitchOffSplitAsymmetryCut() ; + if(!useSS) + { + ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenSS_OpenAsy_TM%d_",particle.Data(),opt.Data(),kTM)); + ana->SetOutputAODName(Form("%s%s%s_OpenSS_OpenAsy",particle.Data(), opt.Data(), kName.Data())); + } + else + { + ana->AddToHistogramsName(Form("Ana%s%sEbE_OpenAsy_TM%d_",particle.Data(),opt.Data(),kTM)); + ana->SetOutputAODName(Form("%s%s%s_OpenAsy",particle.Data(), opt.Data(), kName.Data())); + } + } + + //For Pi0 only if SwitchOnSimpleSplitMassCut() + caloPID->SetPi0MassRange(0.10, 0.18); + caloPID->SetEtaMassRange(0.40, 0.60); + caloPID->SetPhotonMassRange(0.00, 0.08); + + caloPID->SetClusterSplittingMinNCells(6); + + //caloPID->SetSplitEnergyFractionMinimum(0, 0.95); + //caloPID->SetSplitEnergyFractionMinimum(1, 0.95); + //caloPID->SetSplitEnergyFractionMinimum(2, 0.8); + + if(kCollisions=="PbPb" || kName.Contains("150")) + { + caloPID->SetClusterSplittingMinNCells(4); + caloPID->SetPi0MassShiftHighECell(0.005); + } + } - //Set Histograms name tag, bins and ranges - - anapi0ebe->AddToHistogramsName(Form("Ana%s%sEbE_",particle.Data(),opt.Data())); - SetHistoRangeAndNBins(anapi0ebe->GetHistogramRanges()); // see method below - - if(kSimulation) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anapi0ebe->SwitchOffDataMC() ; - - if(kPrint) anapi0ebe->Print(""); - - return anapi0ebe; + return ana; } -//___________________________________________________________________ +//____________________________________________________________________________________________________ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon", Int_t partInCone = AliIsolationCut::kOnlyCharged, Int_t thresType = AliIsolationCut::kSumPtFracIC, + Float_t cone = 0.3, + Float_t pth = 0.3, Bool_t multi = kFALSE) { - AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation(); - anaisol->SetDebug(-1); + AliAnaParticleIsolation *ana = new AliAnaParticleIsolation(); + //ana->SetDebug(kDebug); + ana->SetDebug(kDebug); - anaisol->SetMinPt(5); + ana->SwitchOnFiducialCut(); + //Avoid borders of EMCal + if(kCalorimeter=="EMCAL") + ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.6, 86, 174) ; + + // Same Eta as EMCal, cut in phi if EMCAL was triggering + if(particle=="Hadron" || particle.Contains("CTS")) + { + // if(kTrig.Contains("EMC")) + // ana->GetFiducialCut()->SetSimpleCTSFiducialCut (0.6, 260, 360) ; + // else + ana->GetFiducialCut()->SetSimpleCTSFiducialCut (0.6, 0, 360) ; + } + + ana->SetMinPt(5); // Input / output delta AOD settings - anaisol->SetInputAODName(Form("%s%s_Trig%s_Cl%s",particle.Data(),kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - anaisol->SetAODObjArrayName(Form("IC%s",particle.Data())); + ana->SetInputAODName(Form("%s%s",particle.Data(),kName.Data())); + ana->SetAODObjArrayName(Form("IC%s_%s",particle.Data(),kName.Data())); + + ana->SetCalorimeter(kCalorimeter); - anaisol->SetCalorimeter(kCalorimeter); + if(!kTM) ana->SwitchOnTMHistoFill(); + else ana->SwitchOffTMHistoFill(); + ana->SwitchOffSSHistoFill(); + if(!kSimulation) ana->SwitchOnFillPileUpHistograms(); + //Do settings for main isolation cut class - AliIsolationCut * ic = anaisol->GetIsolationCut(); - ic->SetConeSize(0.4); - ic->SetPtThreshold(0.5); + AliIsolationCut * ic = ana->GetIsolationCut(); + ic->SetDebug(kDebug); + + if(cone >0 && pth > 0) + { + ic->SetPtThreshold(pth); + ic->SetConeSize(cone); + } + else + { + if(kCollisions=="pp") + { + ic->SetPtThreshold(0.5); + ic->SetConeSize(0.4); + } + if(kCollisions=="PbPb") + { + ic->SetPtThreshold(3.); + //ic->SetPtThreshold(1.); + ic->SetConeSize(0.3); + } + } + ic->SetPtFraction(0.1); ic->SetSumPtThreshold(1.0) ; ic->SetParticleTypeInCone(partInCone); @@ -687,71 +1257,241 @@ AliAnaParticleIsolation* ConfigureIsolationAnalysis(TString particle="Photon", //Do or not do isolation with previously produced AODs. //No effect if use of SwitchOnSeveralIsolation() - anaisol->SwitchOffReIsolation(); + ana->SwitchOffReIsolation(); + //Multiple IC - if(multi) anaisol->SwitchOnSeveralIsolation() ; - else anaisol->SwitchOffSeveralIsolation() ; + if(multi) + { + ic->SetConeSize(1.); // Take all for first iteration + ic->SetPtThreshold(100);// Take all for first iteration + ana->SwitchOnSeveralIsolation() ; + ana->SetAODObjArrayName(Form("MultiIC%sTM%d",particle.Data(),kTM)); + + ana->SetNCones(4); + ana->SetNPtThresFrac(4); + ana->SetConeSizes(0,0.3); ana->SetConeSizes(1,0.4); + ana->SetConeSizes(2,0.5); ana->SetConeSizes(3,0.6); + ana->SetPtThresholds(0, 0.5); ana->SetPtThresholds(1, 1); ana->SetPtThresholds(2, 2); + ana->SetPtFractions (0, 0.05) ; ana->SetPtFractions (1, 0.1); ana->SetPtFractions (2, 0.2) ; ana->SetPtFractions (3, 0.3) ; + ana->SetSumPtThresholds(0, 1) ; ana->SetSumPtThresholds(1, 3) ; ana->SetSumPtThresholds(2, 5); ana->SetSumPtThresholds(3, 7) ; + + ana->SwitchOffTMHistoFill(); + ana->SwitchOffSSHistoFill(); + } + else + ana->SwitchOffSeveralIsolation() ; + + AliCaloPID* caloPID = ana->GetCaloPID(); + caloPID->SetEMCALDEtaCut(0.025); + caloPID->SetEMCALDPhiCut(0.030); //Set Histograms name tag, bins and ranges - anaisol->AddToHistogramsName(Form("AnaIsol%s_",particle.Data())); - SetHistoRangeAndNBins(anaisol->GetHistogramRanges()); // see method below + if(!multi)ana->AddToHistogramsName(Form("AnaIsol%s_TM%d_",particle.Data(),kTM)); + else ana->AddToHistogramsName(Form("AnaMultiIsol%s_TM%d_",particle.Data(),kTM)); + + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below - if(kPrint) ic ->Print(""); - if(kPrint) anaisol->Print(""); + if(particle=="Hadron" || particle.Contains("CTS")) + { + ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ; + ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ; + } + + ana->SwitchOnRealCaloAcceptance(); // primary particle acceptance histograms + ConfigureMC(ana); - if(kSimulation) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anaisol->SwitchOffDataMC() ; + if(kPrint) ic ->Print(""); + if(kPrint) ana->Print(""); - return anaisol; + return ana; } //___________________________________________________________________________________ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString particle, - Int_t bIsolated) + Bool_t bIsolated, + Int_t partInCone = AliIsolationCut::kOnlyCharged, + Int_t thresType = AliIsolationCut::kSumPtFracIC, + Float_t cone = 0.3, + Float_t pth = 0.3) { - AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation(); - anacorrhadron->SetDebug(-1); + AliAnaParticleHadronCorrelation *ana = new AliAnaParticleHadronCorrelation(); + ana->SetDebug(kDebug); + + ana->SwitchOnAbsoluteLeading(); // Select trigger leading particle of all the selected tracks + ana->SwitchOffNearSideLeading(); // Select trigger leading particle of all the particles at +-90 degrees, default - anacorrhadron->SetMinimumTriggerPt(5); - anacorrhadron->SetAssociatedPtRange(0.2,200); + //ana->SwitchOnLeadHadronSelection(); + //ana->SetLeadHadronPhiCut(TMath::DegToRad()*100., TMath::DegToRad()*260.); + //ana->SetLeadHadronPtCut(0.5, 100); + + ana->SetTriggerPtRange(5,100); + ana->SetAssociatedPtRange(0.2,100); + //ana->SetDeltaPhiCutRange( TMath::Pi()/2,3*TMath::Pi()/2 ); //[90 deg, 270 deg] + ana->SetDeltaPhiCutRange (TMath::DegToRad()*120.,TMath::DegToRad()*240.); + ana->SetUeDeltaPhiCutRange(TMath::DegToRad()*60. ,TMath::DegToRad()*120.); + ana->SwitchOnFillEtaGapHistograms(); + + ana->SetNAssocPtBins(9); + ana->SetAssocPtBinLimit(0, 0.2) ; + ana->SetAssocPtBinLimit(1, 0.5) ; + ana->SetAssocPtBinLimit(2, 1) ; + ana->SetAssocPtBinLimit(3, 2) ; + ana->SetAssocPtBinLimit(4, 3) ; + ana->SetAssocPtBinLimit(5, 4) ; + ana->SetAssocPtBinLimit(6, 6) ; + ana->SetAssocPtBinLimit(7, 10) ; + ana->SetAssocPtBinLimit(8, 30) ; + ana->SetAssocPtBinLimit(9, 200) ; + //ana->SwitchOnFillPtImbalancePerPtABinHistograms(); + + ana->SelectIsolated(bIsolated); // do correlation with isolated photons + + if(bIsolated) + { + //Do settings for main isolation cut class + AliIsolationCut * ic = ana->GetIsolationCut(); + ic->SetDebug(kDebug); + + if(cone >0 && pth > 0) + { + ic->SetPtThreshold(pth); + ic->SetConeSize(cone); + } + else + { + if(kCollisions=="pp") + { + ic->SetPtThreshold(0.5); + ic->SetConeSize(0.4); + } + if(kCollisions=="PbPb") + { + ic->SetPtThreshold(3.); + //ic->SetPtThreshold(1.); + ic->SetConeSize(0.3); + } + } + + ic->SetPtFraction(0.1); + ic->SetSumPtThreshold(1.0) ; + ic->SetParticleTypeInCone(partInCone); + ic->SetICMethod(thresType); + + } + + // Mixing with own pool + if(kMix) + { + ana->SwitchOnOwnMix(); + ana->SwitchOnFillNeutralInMixedEvent(); + } + else + ana->SwitchOffOwnMix(); + + ana->SetNZvertBin(20); + ana->SwitchOffCorrelationVzBin() ; + ana->SwitchOffFillHighMultiplicityHistograms(); + + if(kCollisions=="pp") + { + ana->SetNMaxEvMix(100); + ana->SwitchOnTrackMultBins(); + ana->SetNTrackMultBin(10); // same as SetNCentrBin(10); + ana->SetNRPBin(1); + } + else + { + ana->SetNMaxEvMix(10); + ana->SwitchOffTrackMultBins(); // centrality bins + ana->SetNCentrBin(3); + ana->SetNRPBin(3); + if(kName.Contains("60_90")) + { + printf("*** Set mixing for peripheral\n"); + ana->SetNMaxEvMix(50); + ana->SetNCentrBin(2); + } + } + + ana->SwitchOnFiducialCut(); + + //Avoid borders of EMCal, same as for isolation + if(kCalorimeter=="EMCAL") + ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.6, 86, 174) ; + + // Same Eta as EMCal, cut in phi if EMCAL was triggering + if(particle=="Hadron" || particle.Contains("CTS")) + { + //if(kTrig.Contains("EMC")) + // ana->GetFiducialCut()->SetSimpleCTSFiducialCut (0.6, 260, 360) ; + //else + ana->GetFiducialCut()->SetSimpleCTSFiducialCut (0.6, 0, 360) ; + } // Input / output delta AOD settings - anacorrhadron->SetInputAODName(Form("%s%s_Trig%s_Cl%s",particle.Data(),kCalorimeter.Data(), kTrig.Data(),kClusterArray.Data())); - anacorrhadron->AddToHistogramsName(Form("Ana%sHadronCorrIso%d_",particle.Data(),bIsolated)); - anacorrhadron->SetAODObjArrayName(Form("%sHadronCorrIso%d",particle.Data(),bIsolated)); + ana->SetInputAODName(Form("%s%s",particle.Data(),kName.Data())); + ana->SetAODObjArrayName(Form("%sHadronCorrIso%d_%s",particle.Data(),bIsolated,kName.Data())); + + // Fill extra plots on tagged decay photons + // If trigger is pi0/eta found with invariant mass, get the decays + // If trigger is photon, check if it was tagged as decay previously + if(particle!="Hadron" ) + { + if(particle.Contains("Pi0") || particle.Contains("Eta")) + { + ana->SwitchOffPi0TriggerDecayCorr(); + ana->SwitchOffDecayTriggerDecayCorr(); + } + else + { + ana->SwitchOffPi0TriggerDecayCorr(); + ana->SwitchOnDecayTriggerDecayCorr(); // Make sure pi0 decay tagging runs before this task + } + } + else + { + ana->SwitchOffPi0TriggerDecayCorr(); + ana->SwitchOffDecayTriggerDecayCorr(); + } + + if(particle=="Photon") + { + printf("**** SET M02 limits *** \n"); + ana->SetM02Cut(0.1,0.27); + } - anacorrhadron->SelectIsolated(bIsolated); // do correlation with isolated photons + // if triggering on PHOS and EMCAL is on + //if(kCalorimeter=="PHOS") ana->SwitchOnNeutralCorr(); + ana->SwitchOffNeutralCorr(); // Do only correlation with TPC - anacorrhadron->SwitchOnDecayCorr(); - anacorrhadron->SetMultiBin(1); - anacorrhadron->SwitchOffNeutralCorr(); - anacorrhadron->SwitchOffEventSelection(); - anacorrhadron->SetDeltaPhiCutRange(1.5,4.5); + ana->SwitchOffHMPIDCorrelation(); - anacorrhadron->SwitchOnSeveralUECalculation(); - anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3); + ana->SwitchOffFillBradHistograms(); - //if(kCalorimeter=="PHOS"){ - //Correlate with particles in EMCAL - //anacorrhadron->SwitchOnCaloPID(); - //anacorrhadron->SwitchOnCaloPIDRecalculation(); - //} + // Underlying event + ana->SwitchOnSeveralUECalculation(); + ana->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3); //Set Histograms name tag, bins and ranges - anacorrhadron->AddToHistogramsName(Form("Ana%sHadronCorr_Iso%d_",particle.Data(),bIsolated)); - SetHistoRangeAndNBins(anacorrhadron->GetHistogramRanges()); // see method below + ana->AddToHistogramsName(Form("Ana%sHadronCorr_Iso%d_TM%d_",particle.Data(),bIsolated,kTM)); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below + + if(particle=="Hadron" || particle.Contains("CTS")) + { + ana->GetHistogramRanges()->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ; + ana->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ; + } - if(kSimulation) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anacorrhadron->SwitchOffDataMC() ; + ConfigureMC(ana); - if(kPrint) anacorrhadron->Print(""); + if(kPrint) ana->Print(""); - return anacorrhadron; + return ana; } @@ -759,126 +1499,253 @@ AliAnaParticleHadronCorrelation* ConfigureHadronCorrelationAnalysis(TString part AliAnaCalorimeterQA* ConfigureQAAnalysis() { - AliAnaCalorimeterQA *anaQA = new AliAnaCalorimeterQA(); - //anaQA->SetDebug(10); //10 for lots of messages - anaQA->SetCalorimeter(kCalorimeter); + AliAnaCalorimeterQA *ana = new AliAnaCalorimeterQA(); + ana->SetDebug(kDebug); //10 for lots of messages + ana->SetCalorimeter(kCalorimeter); - anaQA->SetTimeCut(-1000,1000); // Open time cut + ana->SetTimeCut(-1e10,1e10); // Open time cut // Study inter detector correlation (PHOS, EMCAL, Tracks, V0) - if(kCalorimeter=="PHOS" && kTrig=="PHOS"){ - anaQA->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON - } - if(kCalorimeter=="EMCAL" && kClusterArray==""){ - anaQA->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON - } - else { - anaQA->SwitchOffCorrelation(); - } + if(kCalorimeter=="PHOS" && kTrig=="PHOS") + ana->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON + if(kCalorimeter=="EMCAL" && kClusterArray=="") + ana->SwitchOnCorrelation(); // make sure you switch in the reader PHOS and EMCAL cells and clusters if option is ON + else + ana->SwitchOffCorrelation(); // Study exotic clusters PHOS and EMCAL - if(kClusterArray==""){ - anaQA->SwitchOnStudyBadClusters() ; - } - else { - anaQA->SwitchOffStudyBadClusters() ; - } + if(kClusterArray=="") ana->SwitchOnStudyBadClusters() ; + else ana->SwitchOffStudyBadClusters() ; - anaQA->SwitchOffFiducialCut(); - anaQA->SwitchOffFillAllTH3Histogram(); - anaQA->SwitchOffFillAllPositionHistogram(); - anaQA->SwitchOffFillAllPositionHistogram2(); - anaQA->SwitchOffStudyBadClusters(); - anaQA->SwitchOffStudyClustersAsymmetry(); - anaQA->SwitchOffStudyWeight(); - anaQA->SwitchOffFillAllTrackMatchingHistogram(); - if(kCalorimeter=="EMCAL") - { - if(kYears==2010) - anaQA->SetNumberOfModules(4); - else{ - anaQA->SetNumberOfModules(10); - } - } - else - {//PHOS - anaQA->SetNumberOfModules(3); - } + ana->SwitchOffFiducialCut(); + ana->SwitchOffFillAllTH3Histogram(); + ana->SwitchOffFillAllPositionHistogram(); + ana->SwitchOffFillAllPositionHistogram2(); + if(!kExotic)ana->SwitchOnStudyBadClusters(); + else ana->SwitchOffStudyBadClusters(); + ana->SwitchOffStudyClustersAsymmetry(); + ana->SwitchOffStudyWeight(); + ana->SwitchOnFillAllTrackMatchingHistogram(); + ana->SwitchOnFillAllCellTimeHisto() ; + + ana->AddToHistogramsName("QA_"); //Begining of histograms name + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below - anaQA->AddToHistogramsName("QA_"); //Begining of histograms name - SetHistoRangeAndNBins(anaQA->GetHistogramRanges()); // see method below + ConfigureMC(ana); + + if(kPrint) ana->Print(""); + + return ana; + +} + +//________________________________________________________________ +AliAnaGeneratorKine* ConfigureGenKineAnalysis() +{ + // Analysis for parton, jets correlation with photon and pi0 + + AliAnaGeneratorKine *ana = new AliAnaGeneratorKine(); + ana->SetDebug(kDebug); //10 for lots of messages + + // Trigger detector, acceptance and pT cut + ana->SetTriggerDetector("EMCAL"); + ana->SetMinPt(10); // Trigger photon, pi0 minimum pT + ana->GetFiducialCutForTrigger()->SetSimpleEMCALFiducialCut(0.6, 85, 175); + + // Particles associated to trigger or isolation cone acceptance and pT cut + ana->SetCalorimeter("EMCAL"); + ana->SetMinChargedPt(0.2); + ana->SetMinNeutralPt(0.3); + ana->GetFiducialCut()->SetSimpleEMCALFiducialCut(0.65, 81, 179); + ana->GetFiducialCut()->SetSimpleCTSFiducialCut(0.9, 0, 360); + + // Isolation paramters + AliIsolationCut * ic = ana->GetIsolationCut(); + ic->SetDebug(kDebug); + ic->SetPtThreshold(0.5); + ic->SetConeSize(0.5); + ic->SetSumPtThreshold(1.0) ; + ic->SetICMethod(AliIsolationCut::kPtThresIC); // kSumPtIC - if(kSimulation) anaQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. - else anaQA->SwitchOffDataMC() ; + ana->AddToHistogramsName("AnaGenKine_"); + SetHistoRangeAndNBins(ana->GetHistogramRanges()); // see method below - if(kPrint) anaQA->Print(""); + if(kPrint) ana->Print(""); - return anaQA; + return ana; } //________________________________________________________ -void SetHistoRangeAndNBins (AliHistogramRanges* ana) +void ConfigureMC(AliAnaCaloTrackCorrBaseClass* ana) +{ + if(kSimulation) ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet. + else ana->SwitchOffDataMC() ; + + //Set here generator name, default pythia + //ana->GetMCAnalysisUtils()->SetMCGenerator(""); +} + +//________________________________________________________ +void SetHistoRangeAndNBins (AliHistogramRanges* histoRanges) { // Set common bins for all analysis and MC histograms filling - ana->SetHistoPtRangeAndNBins(0, 100, 250) ; // Energy and pt histograms + histoRanges->SetHistoPtRangeAndNBins(0, 100, 200) ; // Energy and pt histograms - if(kCalorimeter=="EMCAL"){ - if(kYears==2010){ - ana->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ; - ana->SetHistoXRangeAndNBins(-230,90,120); // QA - ana->SetHistoYRangeAndNBins(370,450,40); // QA + if(kCalorimeter=="EMCAL") + { + if(kYears==2010) + { + histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 122*TMath::DegToRad(), 78) ; + histoRanges->SetHistoXRangeAndNBins(-230,90,120); // QA + histoRanges->SetHistoYRangeAndNBins(370,450,40); // QA } - else { - ana->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ; - ana->SetHistoXRangeAndNBins(-600,90,200); // QA - ana->SetHistoYRangeAndNBins(100,450,100); // QA + else if(kYears==2011) + { + histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 182*TMath::DegToRad(), 108) ; + histoRanges->SetHistoXRangeAndNBins(-600,90,200); // QA + histoRanges->SetHistoYRangeAndNBins(100,450,100); // QA } - - ana->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ; - } - else{ - ana->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ; - ana->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ; - + else + { + histoRanges->SetHistoPhiRangeAndNBins(78*TMath::DegToRad(), 190*TMath::DegToRad(), 122) ; + histoRanges->SetHistoXRangeAndNBins(-100,90,200); // QA + histoRanges->SetHistoYRangeAndNBins(50,450,100); // QA + } + + histoRanges->SetHistoEtaRangeAndNBins(-0.72, 0.72, 144) ; } - - if(kClusterArray=="" && kCalorimeter!="PHOS"){ // Tracks analysis - ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 200) ; - ana->SetHistoEtaRangeAndNBins(-1.5, 1.5, 300) ; + else + { + histoRanges->SetHistoPhiRangeAndNBins(260*TMath::DegToRad(), 320*TMath::DegToRad(), 60) ; + histoRanges->SetHistoEtaRangeAndNBins(-0.13, 0.13, 130) ; } - ana->SetHistoShowerShapeRangeAndNBins(0, 3, 300); + histoRanges->SetHistoShowerShapeRangeAndNBins(-0.1, 4.9, 500); - // Invariant mass analysis - ana->SetHistoMassRangeAndNBins(0., 1., 200) ; - ana->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ; + // Invariant mass histoRangeslysis + histoRanges->SetHistoMassRangeAndNBins(0., 1., 200) ; + histoRanges->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ; // check if time calibration is on - ana->SetHistoTimeRangeAndNBins(-1000.,1000,1000); - ana->SetHistoDiffTimeRangeAndNBins(-200, 200, 800); + histoRanges->SetHistoTimeRangeAndNBins(-1000.,1000,1000); + histoRanges->SetHistoDiffTimeRangeAndNBins(-200, 200, 800); // track-cluster residuals - ana->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,100); - ana->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,100); - + histoRanges->SetHistoTrackResidualEtaRangeAndNBins(-0.15,0.15,300); + histoRanges->SetHistoTrackResidualPhiRangeAndNBins(-0.15,0.15,300); + histoRanges->SetHistodRRangeAndNBins(0.,0.15,150);//QA + // QA, electron, charged - ana->SetHistoPOverERangeAndNBins(0,10.,100); - ana->SetHistodEdxRangeAndNBins(0.,200.,200); + histoRanges->SetHistoPOverERangeAndNBins(0,2.,200); + histoRanges->SetHistodEdxRangeAndNBins(0.,200.,200); // QA - ana->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId - ana->SetHistodRRangeAndNBins(0.,TMath::Pi(),150); - ana->SetHistoRatioRangeAndNBins(0.,2.,100); - ana->SetHistoVertexDistRangeAndNBins(0.,500.,500); - ana->SetHistoNClusterCellRangeAndNBins(0,500,500); - ana->SetHistoZRangeAndNBins(-400,400,200); - ana->SetHistoRRangeAndNBins(400,450,25); - ana->SetHistoV0SignalRangeAndNBins(0,5000,500); - ana->SetHistoV0MultiplicityRangeAndNBins(0,5000,500); - ana->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500); + histoRanges->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId + histoRanges->SetHistoVertexDistRangeAndNBins(0.,500.,500); + histoRanges->SetHistoZRangeAndNBins(-400,400,200); + histoRanges->SetHistoRRangeAndNBins(400,450,25); + histoRanges->SetHistoV0SignalRangeAndNBins(0,5000,500); + histoRanges->SetHistoV0MultiplicityRangeAndNBins(0,5000,500); + + // QA, correlation + if(kCollisions=="PbPb") + { + histoRanges->SetHistoNClusterCellRangeAndNBins(0,100,100); + histoRanges->SetHistoNClustersRangeAndNBins(0,500,50); + histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,2000,200); + } + else + { + histoRanges->SetHistoNClusterCellRangeAndNBins(0,50,50); + histoRanges->SetHistoNClustersRangeAndNBins(0,50,50); + histoRanges->SetHistoTrackMultiplicityRangeAndNBins(0,200,200); + } + + // xE, zT + histoRanges->SetHistoRatioRangeAndNBins(0.,2.,200); + histoRanges->SetHistoHBPRangeAndNBins (0.,10.,200); + + // Isolation + histoRanges->SetHistoPtInConeRangeAndNBins(0, 50 , 250); + histoRanges->SetHistoPtSumRangeAndNBins (0, 100, 250); } +//_____________________________ +UInt_t SetTriggerMaskFromName() +{ + if(kTrig=="EMC7") + { + printf("CaloTrackCorr trigger EMC7\n"); + return AliVEvent::kEMC7; + } + else if (kTrig=="INT7") + { + printf("CaloTrackCorr trigger INT7\n"); + return AliVEvent::kINT7; + } + else if(kTrig=="EMC1") + { + printf("CaloTrackCorr trigger EMC1\n"); + return AliVEvent::kEMC1; + } + else if(kTrig=="MB") + { + printf("CaloTrackCorr trigger MB\n"); + return AliVEvent::kMB; + } + else if(kTrig=="PHOS") + { + printf("CaloTrackCorr trigger PHOS\n"); + return AliVEvent::kPHI7; + } + else if(kTrig=="PHOSPb") + { + printf("CaloTrackCorr trigger PHOSPb\n"); + return AliVEvent::kPHOSPb; + } + else if(kTrig=="AnyINT") + { + printf("CaloTrackCorr trigger AnyINT\n"); + return AliVEvent::kAnyINT; + } + else if(kTrig=="INT") + { + printf("CaloTrackCorr trigger AnyINT\n"); + return AliVEvent::kAny; + } + else if(kTrig=="EMCEGA") + { + printf("CaloTrackCorr trigger EMC Gamma\n"); + return AliVEvent::kEMCEGA; + } + else if(kTrig=="EMCEJE") + { + printf("CaloTrackCorr trigger EMC Jet\n"); + return AliVEvent::kEMCEJE; + } + else if(kTrig=="Central") + { + printf("CaloTrackCorr trigger Central\n"); + return (AliVEvent::kCentral | AliVEvent::kMB); + } + else if(kTrig=="CentralEGA") + { + printf("CaloTrackCorr trigger Central+EMCEGA\n"); + return (AliVEvent::kCentral | AliVEvent::kEMCEGA); + } + else if(kTrig=="SemiCentral") + { + printf("CaloTrackCorr trigger SemiCentral\n"); + return (AliVEvent::kSemiCentral | AliVEvent::kMB); + } + else if(kTrig=="SemiOrCentral") + { + printf("CaloTrackCorr trigger SemiCentral Or Central\n"); + return (AliVEvent::kSemiCentral | AliVEvent::kCentral | AliVEvent::kMB); + } +} +