diff --git a/ANALYSIS/AliAnalysisManager.cxx b/ANALYSIS/AliAnalysisManager.cxx index ecd2bdfe9b7..0040cbcd7e4 100644 --- a/ANALYSIS/AliAnalysisManager.cxx +++ b/ANALYSIS/AliAnalysisManager.cxx @@ -454,11 +454,8 @@ void AliAnalysisManager::PackOutput(TList *target) if (strlen(filename) && !isManagedByHandler) { // Backup current folder TDirectory *opwd = gDirectory; - // File resident outputs. - // Check first if the file exists. - TString open_option = "RECREATE"; - if (!gSystem->AccessPathName(output->GetFileName())) open_option = "UPDATE"; - TFile *file = AliAnalysisManager::OpenFile(output, open_option, kTRUE); + // File resident outputs + TFile *file = AliAnalysisManager::OpenFile(output, "RECREATE", kTRUE); // Clear file list to release object ownership to user. file->Clear(); // Save data to file, then close. @@ -754,10 +751,6 @@ void AliAnalysisManager::Terminate() if (fOutputEventHandler) fOutputEventHandler ->TerminateIO(); if (fMCtruthEventHandler) fMCtruthEventHandler->TerminateIO(); TIter next1(fOutputs); - TString handlerFile = ""; - if (fOutputEventHandler) { - handlerFile = fOutputEventHandler->GetOutputFileName(); - } while ((output=(AliAnalysisDataContainer*)next1())) { // Special outputs or grid files have the files already closed and written. if (fMode == kGridAnalysis) continue; @@ -765,17 +758,13 @@ void AliAnalysisManager::Terminate() if (output->IsSpecialOutput() || output->IsRegisterDataset()) continue; } const char *filename = output->GetFileName(); - TString open_option = "RECREATE"; if (!(strcmp(filename, "default"))) continue; if (!strlen(filename)) continue; if (!output->GetData()) continue; TDirectory *opwd = gDirectory; TFile *file = output->GetFile(); if (!file) file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); - if (!file) { - if (handlerFile == filename && !gSystem->AccessPathName(filename)) open_option = "UPDATE"; - file = new TFile(filename, open_option); - } + if (!file) file = new TFile(filename, "RECREATE"); if (file->IsZombie()) { Error("Terminate", "Cannot open output file %s", filename); continue; @@ -1294,7 +1283,7 @@ TFile *AliAnalysisManager::OpenFile(AliAnalysisDataContainer *cont, const char * TString opt(option); opt.ToUpper(); if ((opt=="UPDATE") && (opt!=f->GetOption())) - ::Info("AliAnalysisManager::OpenFile", "File %s already opened in %s mode!", cont->GetFileName(), f->GetOption()); + ::Fatal("AliAnalysisManager::OpenFile", "File %s already opened, but not in UPDATE mode!", cont->GetFileName()); } else { f = TFile::Open(filename, option); } @@ -1338,7 +1327,7 @@ TFile *AliAnalysisManager::OpenProofFile(AliAnalysisDataContainer *cont, const c TString opt(option); opt.ToUpper(); if ((opt=="UPDATE") && (opt!=f->GetOption())) - ::Info("OpenProofFile", "File %s already opened in %s mode!", cont->GetFileName(), f->GetOption()); + Fatal("OpenProofFile", "File %s already opened, but not in UPDATE mode!", cont->GetFileName()); } else { f = new TFile(filename, option); } diff --git a/ANALYSIS/AliAnalysisTaskSE.cxx b/ANALYSIS/AliAnalysisTaskSE.cxx index 89c4051dd22..883257d7672 100644 --- a/ANALYSIS/AliAnalysisTaskSE.cxx +++ b/ANALYSIS/AliAnalysisTaskSE.cxx @@ -280,20 +280,12 @@ void AliAnalysisTaskSE::Exec(Option_t* option) // // Exec analysis of one event if (fDebug > 1) AliInfo("AliAnalysisTaskSE::Exec() \n"); -// - AliAODHandler* handler = (AliAODHandler*) - ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); - AliAODInputHandler* aodH = dynamic_cast(fInputHandler); -// -// Was event selected ? + Bool_t isSelected = kTRUE; if( fInputHandler ) { isSelected = fInputHandler->IsEventSelected(); fEntry = fInputHandler->GetReadEntry(); } - - if (handler) handler->SetFillAOD(isSelected); - // Notify the change of run number if (InputEvent()->GetRunNumber() != fCurrentRunNumber) { @@ -306,8 +298,9 @@ void AliAnalysisTaskSE::Exec(Option_t* option) if ( !((Entry()-1)%100) && fDebug > 0) AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry())); - - + AliAODHandler* handler = (AliAODHandler*) + ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); + AliAODInputHandler* aodH = dynamic_cast(fInputHandler); if (handler && aodH) { fMCEvent = aodH->MCEvent(); diff --git a/ANALYSIS/AliBackgroundSelection.cxx b/ANALYSIS/AliBackgroundSelection.cxx index e79494b42c1..fdd5bb3bd38 100644 --- a/ANALYSIS/AliBackgroundSelection.cxx +++ b/ANALYSIS/AliBackgroundSelection.cxx @@ -1,443 +1,442 @@ -#include "AliBackgroundSelection.h" -#include "TH2F.h" -#include "TList.h" -#include "AliLog.h" -#include "TString.h" -#include "AliESDInputHandlerRP.h" -#include "AliAnalysisManager.h" -#include "TTree.h" -#ifdef PASS1RECO -#include "../ITS/AliITSRecPoint.h" -#endif -#include "AliMultiplicity.h" - -ClassImp(AliBackgroundSelection) - -AliBackgroundSelection::AliBackgroundSelection(): - AliAnalysisCuts(), fOutputHist(0), fACut(0), fBCut(0), fDeltaPhiCut(10) -{ - - fOutputHist = new TList(); - fOutputHist->SetOwner(); - fACut = 65; - fBCut = 4; - fDeltaPhiCut = 10; // effectively disabling delta phi cut by default -} - -AliBackgroundSelection::AliBackgroundSelection(const char* name, const char* title): - AliAnalysisCuts(name,title), fOutputHist(0), fACut(0), fBCut(0), fDeltaPhiCut(10) -{ - - fOutputHist = new TList(); - fOutputHist->SetOwner(); - fACut = 65; - fBCut = 4; - fDeltaPhiCut = 10; // effectively disabling delta phi cut by default - -} - -AliBackgroundSelection::AliBackgroundSelection(const AliBackgroundSelection& obj) : AliAnalysisCuts(obj), -fOutputHist(0), fACut(0), fBCut(0), fDeltaPhiCut(0) -{ - - fOutputHist = obj.fOutputHist; - fACut = obj.fACut; - fBCut = obj.fBCut; - fDeltaPhiCut = obj.fDeltaPhiCut; -} - -AliBackgroundSelection::~AliBackgroundSelection() { - if(fOutputHist) { - delete fOutputHist; - fOutputHist = 0; - } - -} - -Bool_t AliBackgroundSelection::IsSelected(TObject* obj) -{ - - // reset fSelected - SetSelected(kFALSE); -#ifdef PASS1RECO - // Get rec points - AliESDInputHandlerRP* handlerRP = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); - if (!handlerRP) - AliFatal("Cannot get the AliESDInputHandlerRP"); - - TTree* itsClusterTree = handlerRP->GetTreeR("ITS"); - if (!itsClusterTree){ - AliError("Cannot get the ITS Cluster tree"); - return kFALSE; - } - // AliFatal("Cannot get the ITS Cluster tree"); - - TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint"); - TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints"); - - itsClusterBranch->SetAddress(&itsClusters); - - Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries(); -#endif - - AliESDEvent * esdEv = (AliESDEvent*) obj; - -#ifdef PASS1RECO - Float_t deltaPhi = 0.0; // deltaPhi is not available in pass1 - - // Get # spd clusters and of tracklets - Int_t spdClusters=0; - - - // loop over the its subdetectors - for (Int_t iIts=0; iIts < nItsSubs; iIts++) { - - if (!itsClusterTree->GetEvent(iIts)) - continue; - - Int_t nClusters = itsClusters->GetEntriesFast(); - - // loop over clusters - while (nClusters--) { - AliITSRecPoint* cluster = (AliITSRecPoint*) itsClusters->UncheckedAt(nClusters); - - Int_t layer = cluster->GetLayer(); - - if (layer < 3) { // SPD - spdClusters++; - } - } - } -#endif - - const AliMultiplicity* mult = esdEv->GetMultiplicity(); - if (!mult){ - AliFatal("No multiplicity object"); // TODO: Should this be fatal? - } - Int_t ntracklet = mult->GetNumberOfTracklets(); - -#ifndef PASS1RECO - // get deltaphi if vertexer z - Float_t deltaPhi = 0.0; - // Get Vertex - const AliESDVertex * vtxESD = esdEv->GetPrimaryVertexSPD(); - if(vtxESD) { - if (vtxESD->IsFromVertexerZ()) deltaPhi = vtxESD->GetDispersion(); // dispersion contains deltaphi in case of vertexer Z - } - else { - AliWarning("No Vertex"); - } - - - - // compute number of spd clusters - Float_t spdClusters = 0; - for(Int_t ilayer = 0; ilayer < 2; ilayer++){ - spdClusters += mult->GetNumberOfITSClusters(ilayer); - } -#endif - - // Check cuts - Bool_t isCvsTOk = kFALSE; - Bool_t isDeltaPhiOk = kFALSE; - - Float_t limit = fACut + ntracklet * fBCut; - if (spdClusters > limit) isCvsTOk = kFALSE; - else isCvsTOk = kTRUE ; - - if(deltaPhi > fDeltaPhiCut) isDeltaPhiOk = kFALSE; - else isDeltaPhiOk = kTRUE ; - - if (!isCvsTOk || !isDeltaPhiOk) SetSelected(kFALSE); - else SetSelected(kTRUE ); - - // Fill control histos for all trigger classes - TString trgClasses = esdEv->GetFiredTriggerClasses(); - TObjArray * tokens = trgClasses.Tokenize(" "); - TIter iter(tokens); - while(TObjString * tok = (TObjString*) iter.Next()){ - // clean up trigger name - TString trg = tok->GetString(); - trg.Strip(TString::kTrailing, ' '); - trg.Strip(TString::kLeading, ' '); - - // cluster vs tracklets - TH2F * hCvsT = GetClusterVsTrackletsHisto(trg.Data()); - TH2F * hCvsTa = GetClusterVsTrackletsHistoAccepted(trg.Data()); - hCvsT->Fill(ntracklet,spdClusters); - if(isCvsTOk) hCvsTa->Fill(ntracklet,spdClusters); - - // Delta phi - TH1F * hDeltaPhi = GetDeltaPhiHisto(trg.Data()); - TH1F * hDeltaPhia = GetDeltaPhiHistoAccepted(trg.Data()); - hDeltaPhi->Fill(deltaPhi); - if(isDeltaPhiOk) hDeltaPhia->Fill(deltaPhi); - } - if(tokens) delete tokens; - // return decision - -#ifdef PASS1RECO - if(itsClusters) { - itsClusters->Delete(); - delete itsClusters; - } -#endif - return Selected(); -} - - -void AliBackgroundSelection::Init(){ - - fACut = 65; - fBCut = 4; - -} - - -void AliBackgroundSelection::BookClusterVsTrackletsHisto(const char * trigger_name){ - - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - TH2F * h1 = new TH2F(GetClusterVsTrackletsHistoName(trigger_name),trigger_name, 50, -0.5, 49.5, 1000, -0.5, 999.5); - h1->SetXTitle("Tracklets"); - h1->SetYTitle("SPD Clusters"); - AliInfo(Form("Creating histos: %s, all and accepted", GetClusterVsTrackletsHistoName(trigger_name))); - - TH2F * h2 = new TH2F(GetClusterVsTrackletsHistoNameAccepted(trigger_name),TString(trigger_name)+ "(accepted)", - 50, -0.5, 49.5, 1000, -0.5, 999.5); - h2->SetXTitle("Tracklets"); - h2->SetYTitle("SPD Clusters"); - - fOutputHist->Add(h1); - fOutputHist->Add(h2); - - TH1::AddDirectory(oldStatus); - -} - -void AliBackgroundSelection::BookDeltaPhiHisto(const char * trigger_name){ - - Bool_t oldStatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - TH1F * h1 = new TH1F(GetDeltaPhiHistoName(trigger_name),trigger_name, 100,0,0.5); - h1->SetXTitle("#Delta #phi"); - AliInfo(Form("Creating histos: %s, all and accepted", GetDeltaPhiHistoName(trigger_name))); - - TH1F * h2 = new TH1F(GetDeltaPhiHistoNameAccepted(trigger_name),TString(trigger_name)+ "(accepted)", 100,0,0.5); - h2->SetXTitle("#Delta #phi"); - - - fOutputHist->Add(h1); - fOutputHist->Add(h2); - - TH1::AddDirectory(oldStatus); - -} - -TH2F * AliBackgroundSelection::GetClusterVsTrackletsHisto(const char * trigger_name){ - if(!fOutputHist) {AliError("List of histos not initialized");return 0;} - TH2F * h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoName(trigger_name)); - if(!h) { - BookClusterVsTrackletsHisto(trigger_name); - h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoName(trigger_name)); - } - return h; -} -TH1F * AliBackgroundSelection::GetDeltaPhiHisto(const char * trigger_name){ - if(!fOutputHist) {AliError("List of histos not initialized");return 0;} - TH1F * h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoName(trigger_name)); - if(!h) { - BookDeltaPhiHisto(trigger_name); - h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoName(trigger_name)); - } - return h; -} - -TH2F * AliBackgroundSelection::GetClusterVsTrackletsHistoAccepted(const char * trigger_name){ - - if(!fOutputHist) {AliError("List of histos not initialized");return 0;} - TH2F * h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoNameAccepted(trigger_name)); - if(!h) { - BookClusterVsTrackletsHisto(trigger_name); - h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoNameAccepted(trigger_name)); - } - return h; - -} - -TH1F * AliBackgroundSelection::GetDeltaPhiHistoAccepted(const char * trigger_name){ - - if(!fOutputHist) {AliError("List of histos not initialized");return 0;} - TH1F * h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoNameAccepted(trigger_name)); - if(!h) { - BookDeltaPhiHisto(trigger_name); - h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoNameAccepted(trigger_name)); - } - return h; - -} - -const char * AliBackgroundSelection::GetClusterVsTrackletsHistoName(const char * trigger_name){ - static TString str; - str = ("hCvsT"); - str = str+GetName()+"_"+trigger_name; - return str.Data(); -} - -const char * AliBackgroundSelection::GetClusterVsTrackletsHistoNameAccepted(const char * trigger_name){ - static TString str; - str = ("hCvsT"); - str = str+GetName()+"_"+trigger_name + "_accepted"; - return str.Data(); -} - -const char * AliBackgroundSelection::GetDeltaPhiHistoName(const char * trigger_name){ - static TString str; - str = ("hDeltaPhi"); - str = str+GetName()+"_"+trigger_name; - return str.Data(); -} - -const char * AliBackgroundSelection::GetDeltaPhiHistoNameAccepted(const char * trigger_name){ - static TString str; - str = ("hDeltaPhi"); - str = str+GetName()+"_"+trigger_name + "_accepted"; - return str.Data(); -} - -Long64_t AliBackgroundSelection::Merge(TCollection* list) -{ - // Merge a list of AliBackgroundSelection objects with this (needed for - // PROOF). - // Returns the number of merged objects (including this). - - // We have to make sure that all the list contain the same histos in - // the same order. We thus also have to sort the list (sorting is - // done by name in TList). - - AliInfo("Merging"); - - if (!list) - return 0; - - if (list->IsEmpty()) - return 1; - - TIterator* iter = list->MakeIterator(); - TObject* obj; - - // collections of all histograms - const Int_t nHists = 1; - TList collections[nHists]; - - Int_t count = 0; - // 1. Sort this list - fOutputHist->Sort(); - - while ((obj = iter->Next())) { - Bool_t foundDiffinThisIterStep = kFALSE; - // Printf("%d - %s",count, obj->GetName()); - AliBackgroundSelection* entry = dynamic_cast (obj); - if (entry == 0) - continue; - - TList * hlist = entry->fOutputHist; - - // Check if all histos in this fOutputHist are also in the one from entry and viceversa - // Use getters to automatically book non defined histos - - Bool_t areListsDifferent=kTRUE; - Int_t iloop = 0; - Int_t max_loops = hlist->GetSize() + fOutputHist->GetSize(); // In the worst case all of the histos will be different... - while(areListsDifferent) { - if(iloop>max_loops) AliFatal("Infinite Loop?"); - iloop++; - // sort - hlist->Sort(); - fOutputHist->Sort(); - // loop over the largest - - // loop over the largest - TObject * hist =0; - TIterator * iterlist = 0; - TList * thislist = 0; // the list over which I'm iterating (i.e. the largest) - TList * otherlist = 0; // the other list - - if (hlist->GetSize() >= fOutputHist->GetSize()) { - thislist = hlist; - otherlist = fOutputHist; - } - else{ - thislist = fOutputHist; - otherlist = hlist; - } - iterlist = thislist->MakeIterator(); - - while ((hist= iterlist->Next())){ - if(!otherlist->FindObject(hist->GetName())){ - AliInfo(Form("Adding object %s",hist->GetName())); - foundDiffinThisIterStep = kTRUE; - TH1 * hclone = (TH1*) hist->Clone(); - hclone->Reset(); - otherlist->Add(hclone); - } - } - - // re-sort before checking - hlist->Sort(); - fOutputHist->Sort(); - - // check if everything is fine - areListsDifferent=kFALSE; - if (hlist->GetSize() == fOutputHist->GetSize()) { - Int_t nhist = fOutputHist->GetSize(); - for(Int_t ihist = 0; ihist < nhist; ihist++){ - if(strcmp(fOutputHist->At(ihist)->GetName(),hlist->At(ihist)->GetName())) areListsDifferent = kTRUE; - } - } else { - areListsDifferent=kTRUE; - } - } - - // last check: if something is not ok die loudly - if (hlist->GetSize() != fOutputHist->GetSize()) { - AliFatal("Mismatching size!"); - } - Int_t nhist = fOutputHist->GetSize(); - for(Int_t ihist = 0; ihist < nhist; ihist++){ - if(strcmp(fOutputHist->At(ihist)->GetName(),hlist->At(ihist)->GetName())){ - AliFatal(Form("Mismatching histos: %s -> %s", fOutputHist->At(ihist)->GetName(),hlist->At(ihist)->GetName())); - } - } - - if (foundDiffinThisIterStep){ - iter->Reset(); // We found a difference: previous lists could - // also be affected... We start from scratch - Int_t n = 0; - collections[n++].Clear(); - count = 0; - } - else { -// AliInfo("hlist"); -// hlist->Print(); -// AliInfo("fOutputHist"); -// fOutputHist->Print(); - - Int_t n = 0; - collections[n++].Add(hlist); - - count++; - } - } - - Int_t n = 0; - fOutputHist->Merge(&collections[n++]); - - delete iter; - - return count+1; -} - - +#include "AliBackgroundSelection.h" +#include "TH2F.h" +#include "TList.h" +#include "AliLog.h" +#include "TString.h" +#include "AliESDInputHandlerRP.h" +#include "AliAnalysisManager.h" +#include "TTree.h" +#ifdef PASS1RECO +#include "../ITS/AliITSRecPoint.h" +#endif +#include "AliMultiplicity.h" + +ClassImp(AliBackgroundSelection) + +AliBackgroundSelection::AliBackgroundSelection(): + AliAnalysisCuts(), fOutputHist(0), fACut(0), fBCut(0), fDeltaPhiCut(0) +{ + + fOutputHist = new TList(); + fOutputHist->SetOwner(); + fACut = 65; + fBCut = 4; + fDeltaPhiCut = 0.02; +} + +AliBackgroundSelection::AliBackgroundSelection(const char* name, const char* title): + AliAnalysisCuts(name,title), fOutputHist(0), fACut(0), fBCut(0), fDeltaPhiCut(0) +{ + + fOutputHist = new TList(); + fOutputHist->SetOwner(); + fACut = 65; + fBCut = 4; + fDeltaPhiCut = 0.02; + +} + +AliBackgroundSelection::AliBackgroundSelection(const AliBackgroundSelection& obj) : AliAnalysisCuts(obj), +fOutputHist(0), fACut(0), fBCut(0), fDeltaPhiCut(0) +{ + + fOutputHist = obj.fOutputHist; + fACut = obj.fACut; + fBCut = obj.fBCut; + fDeltaPhiCut = obj.fDeltaPhiCut; +} + +AliBackgroundSelection::~AliBackgroundSelection() { + if(fOutputHist) { + delete fOutputHist; + fOutputHist = 0; + } + +} + +Bool_t AliBackgroundSelection::IsSelected(TObject* obj){ + + // reset fSelected + SetSelected(kFALSE); +#ifdef PASS1RECO + // Get rec points + AliESDInputHandlerRP* handlerRP = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); + if (!handlerRP) + AliFatal("Cannot get the AliESDInputHandlerRP"); + + TTree* itsClusterTree = handlerRP->GetTreeR("ITS"); + if (!itsClusterTree){ + AliError("Cannot get the ITS Cluster tree"); + return kFALSE; + } + // AliFatal("Cannot get the ITS Cluster tree"); + + TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint"); + TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints"); + + itsClusterBranch->SetAddress(&itsClusters); + + Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries(); +#endif + + AliESDEvent * esdEv = (AliESDEvent*) obj; + +#ifdef PASS1RECO + Float_t deltaPhi = 0.0; // deltaPhi is not available in pass1 + + // Get # spd clusters and of tracklets + Int_t spdClusters=0; + + + // loop over the its subdetectors + for (Int_t iIts=0; iIts < nItsSubs; iIts++) { + + if (!itsClusterTree->GetEvent(iIts)) + continue; + + Int_t nClusters = itsClusters->GetEntriesFast(); + + // loop over clusters + while (nClusters--) { + AliITSRecPoint* cluster = (AliITSRecPoint*) itsClusters->UncheckedAt(nClusters); + + Int_t layer = cluster->GetLayer(); + + if (layer < 3) { // SPD + spdClusters++; + } + } + } +#endif + + const AliMultiplicity* mult = esdEv->GetMultiplicity(); + if (!mult){ + AliFatal("No multiplicity object"); // TODO: Should this be fatal? + } + Int_t ntracklet = mult->GetNumberOfTracklets(); + +#ifndef PASS1RECO + // get deltaphi if vertexer z + Float_t deltaPhi = 0.0; + // Get Vertex + const AliESDVertex * vtxESD = esdEv->GetPrimaryVertexSPD(); + if(vtxESD) { + if (vtxESD->IsFromVertexerZ()) deltaPhi = vtxESD->GetDispersion(); // dispersion contains deltaphi in case of vertexer Z + } + else { + AliWarning("No Vertex"); + } + + + + // compute number of spd clusters + Float_t spdClusters = 0; + for(Int_t ilayer = 0; ilayer < 2; ilayer++){ + spdClusters += mult->GetNumberOfITSClusters(ilayer); + } +#endif + + // Check cuts + Bool_t isCvsTOk = kFALSE; + Bool_t isDeltaPhiOk = kFALSE; + + Float_t limit = fACut + ntracklet * fBCut; + if (spdClusters > limit) isCvsTOk = kFALSE; + else isCvsTOk = kTRUE ; + + if(deltaPhi > fDeltaPhiCut) isDeltaPhiOk = kFALSE; + else isDeltaPhiOk = kTRUE ; + + if (!isCvsTOk || !isDeltaPhiOk) SetSelected(kFALSE); + else SetSelected(kTRUE ); + + // Fill control histos for all trigger classes + TString trgClasses = esdEv->GetFiredTriggerClasses(); + TObjArray * tokens = trgClasses.Tokenize(" "); + TIter iter(tokens); + while(TObjString * tok = (TObjString*) iter.Next()){ + // clean up trigger name + TString trg = tok->GetString(); + trg.Strip(TString::kTrailing, ' '); + trg.Strip(TString::kLeading, ' '); + + // cluster vs tracklets + TH2F * hCvsT = GetClusterVsTrackletsHisto(trg.Data()); + TH2F * hCvsTa = GetClusterVsTrackletsHistoAccepted(trg.Data()); + hCvsT->Fill(ntracklet,spdClusters); + if(isCvsTOk) hCvsTa->Fill(ntracklet,spdClusters); + + // Delta phi + TH1F * hDeltaPhi = GetDeltaPhiHisto(trg.Data()); + TH1F * hDeltaPhia = GetDeltaPhiHistoAccepted(trg.Data()); + hDeltaPhi->Fill(deltaPhi); + if(isDeltaPhiOk) hDeltaPhia->Fill(deltaPhi); + } + if(tokens) delete tokens; + // return decision + +#ifdef PASS1RECO + if(itsClusters) { + itsClusters->Delete(); + delete itsClusters; + } +#endif + return Selected(); +} + + +void AliBackgroundSelection::Init(){ + + fACut = 65; + fBCut = 4; + +} + + +void AliBackgroundSelection::BookClusterVsTrackletsHisto(const char * trigger_name){ + + Bool_t oldStatus = TH1::AddDirectoryStatus(); + TH1::AddDirectory(kFALSE); + + TH2F * h1 = new TH2F(GetClusterVsTrackletsHistoName(trigger_name),trigger_name, 50, -0.5, 49.5, 1000, -0.5, 999.5); + h1->SetXTitle("Tracklets"); + h1->SetYTitle("SPD Clusters"); + AliInfo(Form("Creating histos: %s, all and accepted", GetClusterVsTrackletsHistoName(trigger_name))); + + TH2F * h2 = new TH2F(GetClusterVsTrackletsHistoNameAccepted(trigger_name),TString(trigger_name)+ "(accepted)", + 50, -0.5, 49.5, 1000, -0.5, 999.5); + h2->SetXTitle("Tracklets"); + h2->SetYTitle("SPD Clusters"); + + fOutputHist->Add(h1); + fOutputHist->Add(h2); + + TH1::AddDirectory(oldStatus); + +} + +void AliBackgroundSelection::BookDeltaPhiHisto(const char * trigger_name){ + + Bool_t oldStatus = TH1::AddDirectoryStatus(); + TH1::AddDirectory(kFALSE); + + TH1F * h1 = new TH1F(GetDeltaPhiHistoName(trigger_name),trigger_name, 100,0,0.5); + h1->SetXTitle("#Delta #phi"); + AliInfo(Form("Creating histos: %s, all and accepted", GetDeltaPhiHistoName(trigger_name))); + + TH1F * h2 = new TH1F(GetDeltaPhiHistoNameAccepted(trigger_name),TString(trigger_name)+ "(accepted)", 100,0,0.5); + h2->SetXTitle("#Delta #phi"); + + + fOutputHist->Add(h1); + fOutputHist->Add(h2); + + TH1::AddDirectory(oldStatus); + +} + +TH2F * AliBackgroundSelection::GetClusterVsTrackletsHisto(const char * trigger_name){ + if(!fOutputHist) {AliError("List of histos not initialized");return 0;} + TH2F * h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoName(trigger_name)); + if(!h) { + BookClusterVsTrackletsHisto(trigger_name); + h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoName(trigger_name)); + } + return h; +} +TH1F * AliBackgroundSelection::GetDeltaPhiHisto(const char * trigger_name){ + if(!fOutputHist) {AliError("List of histos not initialized");return 0;} + TH1F * h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoName(trigger_name)); + if(!h) { + BookDeltaPhiHisto(trigger_name); + h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoName(trigger_name)); + } + return h; +} + +TH2F * AliBackgroundSelection::GetClusterVsTrackletsHistoAccepted(const char * trigger_name){ + + if(!fOutputHist) {AliError("List of histos not initialized");return 0;} + TH2F * h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoNameAccepted(trigger_name)); + if(!h) { + BookClusterVsTrackletsHisto(trigger_name); + h = (TH2F*) fOutputHist->FindObject(GetClusterVsTrackletsHistoNameAccepted(trigger_name)); + } + return h; + +} + +TH1F * AliBackgroundSelection::GetDeltaPhiHistoAccepted(const char * trigger_name){ + + if(!fOutputHist) {AliError("List of histos not initialized");return 0;} + TH1F * h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoNameAccepted(trigger_name)); + if(!h) { + BookDeltaPhiHisto(trigger_name); + h = (TH1F*) fOutputHist->FindObject(GetDeltaPhiHistoNameAccepted(trigger_name)); + } + return h; + +} + +const char * AliBackgroundSelection::GetClusterVsTrackletsHistoName(const char * trigger_name){ + static TString str; + str = ("hCvsT"); + str = str+GetName()+"_"+trigger_name; + return str.Data(); +} + +const char * AliBackgroundSelection::GetClusterVsTrackletsHistoNameAccepted(const char * trigger_name){ + static TString str; + str = ("hCvsT"); + str = str+GetName()+"_"+trigger_name + "_accepted"; + return str.Data(); +} + +const char * AliBackgroundSelection::GetDeltaPhiHistoName(const char * trigger_name){ + static TString str; + str = ("hDeltaPhi"); + str = str+GetName()+"_"+trigger_name; + return str.Data(); +} + +const char * AliBackgroundSelection::GetDeltaPhiHistoNameAccepted(const char * trigger_name){ + static TString str; + str = ("hDeltaPhi"); + str = str+GetName()+"_"+trigger_name + "_accepted"; + return str.Data(); +} + +Long64_t AliBackgroundSelection::Merge(TCollection* list) +{ + // Merge a list of AliBackgroundSelection objects with this (needed for + // PROOF). + // Returns the number of merged objects (including this). + + // We have to make sure that all the list contain the same histos in + // the same order. We thus also have to sort the list (sorting is + // done by name in TList). + + AliInfo("Merging"); + + if (!list) + return 0; + + if (list->IsEmpty()) + return 1; + + TIterator* iter = list->MakeIterator(); + TObject* obj; + + // collections of all histograms + const Int_t nHists = 1; + TList collections[nHists]; + + Int_t count = 0; + // 1. Sort this list + fOutputHist->Sort(); + + while ((obj = iter->Next())) { + Bool_t foundDiffinThisIterStep = kFALSE; + // Printf("%d - %s",count, obj->GetName()); + AliBackgroundSelection* entry = dynamic_cast (obj); + if (entry == 0) + continue; + + TList * hlist = entry->fOutputHist; + + // Check if all histos in this fOutputHist are also in the one from entry and viceversa + // Use getters to automatically book non defined histos + + Bool_t areListsDifferent=kTRUE; + Int_t iloop = 0; + Int_t max_loops = hlist->GetSize() + fOutputHist->GetSize(); // In the worst case all of the histos will be different... + while(areListsDifferent) { + if(iloop>max_loops) AliFatal("Infinite Loop?"); + iloop++; + // sort + hlist->Sort(); + fOutputHist->Sort(); + // loop over the largest + + // loop over the largest + TObject * hist =0; + TIterator * iterlist = 0; + TList * thislist = 0; // the list over which I'm iterating (i.e. the largest) + TList * otherlist = 0; // the other list + + if (hlist->GetSize() >= fOutputHist->GetSize()) { + thislist = hlist; + otherlist = fOutputHist; + } + else{ + thislist = fOutputHist; + otherlist = hlist; + } + iterlist = thislist->MakeIterator(); + + while ((hist= iterlist->Next())){ + if(!otherlist->FindObject(hist->GetName())){ + AliInfo(Form("Adding object %s",hist->GetName())); + foundDiffinThisIterStep = kTRUE; + TH1 * hclone = (TH1*) hist->Clone(); + hclone->Reset(); + otherlist->Add(hclone); + } + } + + // re-sort before checking + hlist->Sort(); + fOutputHist->Sort(); + + // check if everything is fine + areListsDifferent=kFALSE; + if (hlist->GetSize() == fOutputHist->GetSize()) { + Int_t nhist = fOutputHist->GetSize(); + for(Int_t ihist = 0; ihist < nhist; ihist++){ + if(strcmp(fOutputHist->At(ihist)->GetName(),hlist->At(ihist)->GetName())) areListsDifferent = kTRUE; + } + } else { + areListsDifferent=kTRUE; + } + } + + // last check: if something is not ok die loudly + if (hlist->GetSize() != fOutputHist->GetSize()) { + AliFatal("Mismatching size!"); + } + Int_t nhist = fOutputHist->GetSize(); + for(Int_t ihist = 0; ihist < nhist; ihist++){ + if(strcmp(fOutputHist->At(ihist)->GetName(),hlist->At(ihist)->GetName())){ + AliFatal(Form("Mismatching histos: %s -> %s", fOutputHist->At(ihist)->GetName(),hlist->At(ihist)->GetName())); + } + } + + if (foundDiffinThisIterStep){ + iter->Reset(); // We found a difference: previous lists could + // also be affected... We start from scratch + Int_t n = 0; + collections[n++].Clear(); + count = 0; + } + else { +// AliInfo("hlist"); +// hlist->Print(); +// AliInfo("fOutputHist"); +// fOutputHist->Print(); + + Int_t n = 0; + collections[n++].Add(hlist); + + count++; + } + } + + Int_t n = 0; + fOutputHist->Merge(&collections[n++]); + + delete iter; + + return count+1; +} + + diff --git a/ANALYSIS/AliPhysicsSelection.cxx b/ANALYSIS/AliPhysicsSelection.cxx index e76baa5548b..e425a92b778 100644 --- a/ANALYSIS/AliPhysicsSelection.cxx +++ b/ANALYSIS/AliPhysicsSelection.cxx @@ -38,22 +38,6 @@ // To print statistics after processing use: // fPhysicsSelection->Print(); // -// Usually the class selects the trigger scheme by itself depending on the run number. -// Nevertheless, you can do that manually by calling AddCollisionTriggerClass() and AddBGTriggerClass() -// Example: -// To define the class CINT1B-ABCE-NOPF-ALL as collision trigger (those will be accepted as -// collision candidates when they pass the selection): -// AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #769 #3119"); -// To select on bunch crossing IDs in addition, use: -// AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #769 #3119"); -// To define the class CINT1A-ABCE-NOPF-ALL as a background trigger (those will only be counted -// for the control histograms): -// AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL"); -// You can also specify more than one trigger class in a string or you can require that some are *not* -// present. The following line would require CSMBA-ABCE-NOPF-ALL, but CSMBB-ABCE-NOPF-ALL is not allowed -// to be present: -// AddBGTriggerClass("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL"); -// // Origin: Jan Fiete Grosse-Oetringhaus, CERN //------------------------------------------------------------------------- @@ -83,9 +67,7 @@ AliPhysicsSelection::AliPhysicsSelection() : fTriggerAnalysis(), fBackgroundIdentification(0), fHistStatistics(0), - fHistBunchCrossing(0), - fSkipTriggerClassSelection(0), - fUsingCustomClasses(0) + fHistBunchCrossing(0) { // constructor @@ -123,9 +105,6 @@ Bool_t AliPhysicsSelection::CheckTriggerClass(const AliESDEvent* aEsd, const cha // format of trigger: +TRIGGER1 -TRIGGER2 // requires TRIGGER1 and rejects TRIGGER2 - Bool_t foundBCRequirement = kFALSE; - Bool_t foundCorrectBC = kFALSE; - TString str(trigger); TObjArray* tokens = str.Tokenize(" "); @@ -133,49 +112,28 @@ Bool_t AliPhysicsSelection::CheckTriggerClass(const AliESDEvent* aEsd, const cha { TString str2(((TObjString*) tokens->At(i))->String()); - if (str2[0] == '+' || str2[0] == '-') - { - Bool_t flag = (str2[0] == '+'); - - str2.Remove(0, 1); + if (str2[0] != '+' && str2[0] != '-') + AliFatal(Form("Invalid trigger syntax: %s", trigger)); - if (flag && !aEsd->IsTriggerClassFired(str2)) - { - AliDebug(AliLog::kDebug, Form("Rejecting event because trigger class %s is not present", str2.Data())); - delete tokens; - return kFALSE; - } - if (!flag && aEsd->IsTriggerClassFired(str2)) - { - AliDebug(AliLog::kDebug, Form("Rejecting event because trigger class %s is present", str2.Data())); - delete tokens; - return kFALSE; - } + Bool_t flag = (str2[0] == '+'); + + str2.Remove(0, 1); + + if (flag && !aEsd->IsTriggerClassFired(str2)) + { + AliDebug(AliLog::kDebug, Form("Rejecting event because trigger class %s is not present", str2.Data())); + delete tokens; + return kFALSE; } - else if (str2[0] == '#') + if (!flag && aEsd->IsTriggerClassFired(str2)) { - foundBCRequirement = kTRUE; - - str2.Remove(0, 1); - - Int_t bcNumber = str2.Atoi(); - AliDebug(AliLog::kDebug, Form("Checking for bunch crossing number %d", bcNumber)); - - if (aEsd->GetBunchCrossNumber() == bcNumber) - { - foundCorrectBC = kTRUE; - AliDebug(AliLog::kDebug, Form("Found correct bunch crossing %d", bcNumber)); - } + AliDebug(AliLog::kDebug, Form("Rejecting event because trigger class %s is present", str2.Data())); + delete tokens; + return kFALSE; } - else - AliFatal(Form("Invalid trigger syntax: %s", trigger)); } delete tokens; - - if (foundBCRequirement && !foundCorrectBC) - return kFALSE; - return kTRUE; } @@ -293,7 +251,7 @@ Bool_t AliPhysicsSelection::IsCollisionCandidate(const AliESDEvent* aEsd) fHistStatistics->Fill(15, i); fHistBunchCrossing->Fill(aEsd->GetBunchCrossNumber(), i); - if (i < fCollTrigClasses.GetEntries() || fSkipTriggerClassSelection) + if (i < fCollTrigClasses.GetEntries()) accept = kTRUE; } } @@ -343,7 +301,7 @@ Bool_t AliPhysicsSelection::Initialize(UInt_t runNumber) Int_t triggerScheme = GetTriggerScheme(runNumber); - if (!fUsingCustomClasses && fCurrentRun != -1 && triggerScheme != GetTriggerScheme(fCurrentRun)) + if (fCurrentRun != -1 && triggerScheme != GetTriggerScheme(fCurrentRun)) AliFatal("Processing several runs with different trigger schemes is not supported"); AliInfo(Form("Initializing for run %d", runNumber)); @@ -351,15 +309,12 @@ Bool_t AliPhysicsSelection::Initialize(UInt_t runNumber) // initialize first time? if (fCurrentRun == -1) { - if (fUsingCustomClasses) { - AliInfo("Using user-provided trigger classes"); - } else { - switch (triggerScheme) - { + switch (triggerScheme) + { case 0: fCollTrigClasses.Add(new TObjString("")); break; - + case 1: fCollTrigClasses.Add(new TObjString("+CINT1B-ABCE-NOPF-ALL")); fBGTrigClasses.Add(new TObjString("+CINT1A-ABCE-NOPF-ALL")); @@ -372,12 +327,11 @@ Bool_t AliPhysicsSelection::Initialize(UInt_t runNumber) fBGTrigClasses.Add(new TObjString("+CSMBA-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL")); fBGTrigClasses.Add(new TObjString("+CSMBC-ABCE-NOPF-ALL -CSMBB-ABCE-NOPF-ALL")); break; - + default: AliFatal(Form("Unsupported trigger scheme %d", triggerScheme)); - } } - + Int_t count = fCollTrigClasses.GetEntries() + fBGTrigClasses.GetEntries(); for (Int_t i=0; iGetXaxis()->GetBinCenter(j)); } } - - if (fUsingCustomClasses) - Printf("WARNING: Using custom trigger classes!"); - if (fSkipTriggerClassSelection) - Printf("WARNING: Skipping trigger class selection!"); } Long64_t AliPhysicsSelection::Merge(TCollection* list) diff --git a/ANALYSIS/AliPhysicsSelection.h b/ANALYSIS/AliPhysicsSelection.h index 95d9b64e56c..2098de8305b 100644 --- a/ANALYSIS/AliPhysicsSelection.h +++ b/ANALYSIS/AliPhysicsSelection.h @@ -17,7 +17,6 @@ #include #include -#include "TObjString.h" class AliESDEvent; class TH2F; @@ -36,21 +35,16 @@ class AliPhysicsSelection : public AliAnalysisCuts Bool_t IsCollisionCandidate(const AliESDEvent* aEsd); Bool_t Initialize(UInt_t runNumber); - void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; } - void SetSkipTriggerClassSelection(Bool_t flag = kTRUE) { fSkipTriggerClassSelection = flag; } - + void AddBackgroundIdentification(AliAnalysisCuts* background) { fBackgroundIdentification = background; } virtual void Print(Option_t* option = "") const; virtual Long64_t Merge(TCollection* list); void SaveHistograms(const char* folder = 0) const; - const TList* GetCollisionTriggerClasses() const { return &fCollTrigClasses; } - const TList* GetBGTriggerClasses() const { return &fBGTrigClasses; } - void AddCollisionTriggerClass(const char* className){ fCollTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; } - void AddBGTriggerClass(const char* className) { fBGTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; } - + TList* GetCollisionTriggerClasses() { return &fCollTrigClasses; } + TList* GetBGTriggerClasses() { return &fBGTrigClasses; } AliTriggerAnalysis* GetTriggerAnalysis() { return (fTriggerAnalysis.GetEntries() > 0) ? (AliTriggerAnalysis*) fTriggerAnalysis.At(0) : 0; } const TH2F* GetStatisticsHistogram() const { return fHistStatistics; } @@ -72,9 +66,6 @@ class AliPhysicsSelection : public AliAnalysisCuts TH2F* fHistStatistics; // how many events are cut away why TH2F* fHistBunchCrossing; // histograms of accepted bunch crossing numbers - Bool_t fSkipTriggerClassSelection; // flag that determines if the trigger classs selection is skipped - Bool_t fUsingCustomClasses; // flag that is set if costum trigger classes are defined - ClassDef(AliPhysicsSelection, 2) private: diff --git a/ANALYSIS/AliPhysicsSelectionTask.cxx b/ANALYSIS/AliPhysicsSelectionTask.cxx index 16cc3dbeb10..c1b297c96db 100644 --- a/ANALYSIS/AliPhysicsSelectionTask.cxx +++ b/ANALYSIS/AliPhysicsSelectionTask.cxx @@ -110,7 +110,7 @@ void AliPhysicsSelectionTask::Terminate(Option_t *) if (fPhysicsSelection) { fPhysicsSelection->Print(); - fPhysicsSelection->SaveHistograms(); + fPhysicsSelection->SaveHistograms("physics_selection"); } fout->Write(); diff --git a/ANALYSIS/macros/AddTaskPhysicsSelection.C b/ANALYSIS/macros/AddTaskPhysicsSelection.C index 289b82e9928..d3f560f7962 100644 --- a/ANALYSIS/macros/AddTaskPhysicsSelection.C +++ b/ANALYSIS/macros/AddTaskPhysicsSelection.C @@ -1,41 +1,43 @@ -AliPhysicsSelectionTask* AddTaskPhysicsSelection(Bool_t mCAnalysisFlag = kFALSE, Bool_t withBckgndRejection = kTRUE) -{ - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr) { - ::Error("AddTaskPhysicsSelection", "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("AddTaskPhysicsSelection", "This task requires an input event handler"); - return NULL; - } - TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" - - // Configure analysis - //=========================================================================== + + +AliPhysicsSelectionTask* AddTaskPhysicsSelection() { + + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + if (!mgr) { + ::Error("AddTaskPhysicsSelection", "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("AddTaskPhysicsSelection", "This task requires an input event handler"); + return NULL; + } + TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" + + // Configure analysis + //=========================================================================== - AliPhysicsSelectionTask *task = new AliPhysicsSelectionTask(""); + AliPhysicsSelectionTask *task= new AliPhysicsSelectionTask(""); mgr->AddTask(task); - - AliPhysicsSelection* physSel = task->GetPhysicsSelection(); - if (withBckgndRejection) - physSel->AddBackgroundIdentification(new AliBackgroundSelection()); - if (mCAnalysisFlag) - physSel->SetAnalyzeMC(); + + AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("cstatsout", - TList::Class(), - AliAnalysisManager::kOutputContainer, - "EventStat_temp.root"); + TList::Class(), + AliAnalysisManager::kOutputContainer, + "EventStat_temp.root"); + + mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); mgr->ConnectOutput(task,1,coutput1); return task; + } +//_____________________________________________________________________________ diff --git a/ANALYSIS/macros/AnalysisTrainNew.C b/ANALYSIS/macros/AnalysisTrainNew.C index 3ce71945ec2..8fd1d8914b5 100644 --- a/ANALYSIS/macros/AnalysisTrainNew.C +++ b/ANALYSIS/macros/AnalysisTrainNew.C @@ -16,8 +16,8 @@ // root[1] AnalysisTrainNew(ana_mode, plugin_mode, "train_default_/ConfigTrain.C") //================== TRAIN NAME ============================================ -TString train_name = "TR010_LHC09a7ESD"; // *CHANGE ME* (no blancs or special characters) -TString job_tag = "TR010: ESD+MC analysis -> AOD + delta AOD + histograms"; // *CHANGE ME* +TString train_name = "TR008_LHC09a2ESD"; // *CHANGE ME* (no blancs or special characters) +TString job_tag = "TR008: ESD+MC analysis -> AOD + delta AOD + histograms"; // *CHANGE ME* //============================================================================== // ### Settings that make sense in PROOF only @@ -31,8 +31,6 @@ TString proof_outdir = ""; // ### Settings that make sense when using the Alien plugin //============================================================================== -Int_t runOnData = 0; // Set to 1 if processing real data -Int_t iCollision = 0; // 0=pp, 1=Pb-Pb Bool_t usePLUGIN = kTRUE; // do not change Bool_t useProductionMode = kTRUE; // use the plugin in production mode // Usage of par files ONLY in grid mode and ONLY if the code is not available @@ -41,29 +39,26 @@ Bool_t useProductionMode = kTRUE; // use the plugin in production mode // AliRoot. Bool_t usePAR = kFALSE; // use par files for extra libs Bool_t useCPAR = kFALSE; // use par files for common libs -TString root_version = "v5-25-04-3"; // *CHANGE ME IF MORE RECENT IN GRID* -TString aliroot_version = "v4-18-16-AN"; // *CHANGE ME IF MORE RECENT IN GRID* +TString root_version = "v20091109-1"; // *CHANGE ME IF MORE RECENT IN GRID* +TString aliroot_version = "v4-18-11-AN"; // *CHANGE ME IF MORE RECENT IN GRID* // Change production base directory here -TString alien_datadir = "/alice/sim/PDC_09/LHC09a7"; +TString alien_datadir = "/alice/sim/PDC_08b/LHC09a2"; // AliEn output directory. If blank will become output_ -TString alien_outdir = "/alice/sim/PDC_09/LHC09a7/AOD"; +TString alien_outdir = "/alice/sim/PDC_08b/LHC09a2/AOD1"; // TString alien_outdir = ""; -// Output folder to write delta AOD's. Considered if not null. -TString outputSingleFolder = ""; -//TString outputSingleFolder = "deltas"; // Number of files merged in a chunk Int_t maxMergeFiles = 20; // Files that should not be merged -TString mergeExclude = "AliAOD.root AliAOD.VertexingHF.root AliAOD.Jets.root deltaAODPartCorr.root AliAOD.Muons.root resonances.root forward.root"; +TString mergeExclude = "AliAOD.root AliAOD.VertexingHF.root AliAOD.Jets.root deltaAODPartCorr.root forward.root resonances.root"; // Make replicas on the storages below -TString outputStorages = "disk=4"; +TString outputStorages = "ALICE::NIHAM::File,ALICE::CNAF::SE,ALICE::FZK::SE,ALICE::GSI::SE"; // Number of runs per master job Int_t nRunsPerMaster = 10; // Maximum number of files per job (gives size of AOD) -Int_t nFilesPerJob = 50; -// Int_t nFilesPerJob = 1; (AOD->delta AOD production case) +Int_t nFilesPerJob = 20; // Set the run range -Int_t run_range[2] = {80000, 80049}; // LHC09a7 *CHANGE ME* +Int_t run_range[2] = {80000, 80025}; // LHC09a1 *CHANGE ME* +//Int_t run_range[2] = {70000, 70000}; // ### Settings that make sense only for local analysis //============================================================================== // Change local xml dataset for local interactive analysis @@ -80,7 +75,6 @@ Bool_t useTR = kTRUE; // use track references Bool_t useCORRFW = kFALSE; // do not change Bool_t useAODTAGS = kFALSE; // use AOD tags Bool_t saveTrain = kTRUE; // save train configuration as: -Bool_t saveCanvases = kTRUE; // save canvases created in Terminate Bool_t saveProofToAlien = kFALSE; // save proof outputs in AliEn // train_[trainName]_ddMonthyyyy_time.C // ### Analysis modules to be included. Some may not be yet fully implemented. @@ -129,13 +123,13 @@ Int_t iPWG2kinkPhiESD = 1; // Kink resonances Phi ESD (PWG2) Int_t iPWG2kinkPhiMC = 1; // Kink resonances Phi MC (PWG2) Int_t iPWG2evchar = 1; // Event characteristics (PWG2) Int_t iPWG2unicor = 1; // Unicor analysis (PWG2) -Int_t iPWG2forward = 0; // FMD analysis (PWG2) +Int_t iPWG2forward = 1; // FMD analysis (PWG2) // ### Configuration macros used for each module //============================================================================== TString configPWG2femto = "$ALICE_ROOT/PWG2/FEMTOSCOPY/macros/Train/Train3/ConfigFemtoAnalysis.C"; //TString configPWG3d2h = "$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF_highmult.C"; -TString configPWG3d2h = "$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C"; +TString configPWG3d2h = "$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF_highmult.C"; // Temporaries. TString anaPars = ""; TString anaLibs = ""; @@ -281,7 +275,6 @@ void AnalysisTrainNew(const char *analysis_mode="grid", } // Debugging if needed if (useDBG) mgr->SetDebugLevel(3); - if (saveCanvases) mgr->SetSaveCanvases(kTRUE); //========================================================================== // Create the chain. In this example it is created only from ALIEN files but @@ -368,7 +361,7 @@ void AddAnalysisTasks() // cascades if (iPWG2checkcascade) { gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckCascade.C"); - AliAnalysisTaskCheckCascade *taskcheckcascade = AddTaskCheckCascade(iCollision,runOnData); + AliAnalysisTaskCheckCascade *taskcheckcascade = AddTaskCheckCascade(); if (!taskcheckcascade) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckCascade cannot run for this train conditions - EXCLUDED"); } // v0's @@ -511,8 +504,8 @@ void AddAnalysisTasks() // PWG2 resonances AliAnalysisManager::SetCommonFileName("resonances.root"); if (iPWG2res) { - gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsnNew.C"); - gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsnEffNew.C"); + gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsn.C"); + gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsnEff.C"); TString path = gROOT->GetMacroPath(); path += ":$ALICE_ROOT/PWG2/RESONANCES/macros/train"; gROOT->SetMacroPath(path); @@ -552,13 +545,10 @@ void AddAnalysisTasks() gROOT->LoadMacro("$ALICE_ROOT/PWG3/muon/AddPWG3MuonTrain.C"); // iESDAnalysis, iAODAnalysis -> flags to select if the train is AOD or ESD based // iMuonDistributions, iSingleMuonANAlysis -> flags to switch on/off analysis wagons - Int_t isESDAnalysis = (iAODanalysis)?0:1; - Int_t isAODAnalysis = (iAODanalysis)?1:0; - Int_t addMuonDistributions = 1; - Int_t addSingleMuonAnalysis = 1; - Int_t addMuonHFAnalysis = 1; - Int_t ntaskmuon = AddPWG3MuonTrain(isESDAnalysis,isAODAnalysis,addMuonDistributions,addSingleMuonAnalysis,addMuonHFAnalysis); - printf("Added %d muon tasks\n", ntaskmuon); + Bool_t iESDAnalysis = !iAODanalysis; + Bool_t iMuonDistributions = kTRUE; + Bool_t iSingleMuonAnalysis = kTRUE; + AddPWG3MuonTrain(iESDAnalysis,iAODanalysis,iMuonDistributions,iSingleMuonAnalysis); } // ********** PWG4 wagons ****************************************************** @@ -577,19 +567,17 @@ void AddAnalysisTasks() } } else { // AOD-based analysis. Add all reconstructors to write into delta AOD's - if (iJETANdelta) { - Int_t ntasksjets = AddTaskJetsDelta("AliAOD.Jets.root"); - if (ntasksjets) printf("Added %d jet reconstructors\n", ntasksjets); - } + if (iJETANdelta) AddTaskJetsDelta(); + AliAnalysisTaskJets * taskjets = AddTaskJets(); + taskjets->SetNonStdBranch("jetsAOD_UA1_04"); } } // PWG4 hadron correlations if (iPWG4partcorr) { - Bool_t isSimulation = (runOnData)?kFALSE:kTRUE; gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPartCorr.C"); - AliAnalysisTaskParticleCorrelation *taskpartcorrPHOS = AddTaskPartCorr("AOD", "PHOS", useMC, kFALSE, isSimulation); + AliAnalysisTaskParticleCorrelation *taskpartcorrPHOS = AddTaskPartCorr("AOD", "PHOS"); if (!taskpartcorrPHOS) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation PHOS cannot run for this train conditions - EXCLUDED"); - AliAnalysisTaskParticleCorrelation *taskpartcorrEMCAL = AddTaskPartCorr("AOD", "EMCAL", useMC, kFALSE, isSimulation); + AliAnalysisTaskParticleCorrelation *taskpartcorrEMCAL = AddTaskPartCorr("AOD", "EMCAL"); if (!taskpartcorrEMCAL) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation EMCAL cannot run for this train conditions - EXCLUDED"); mgr->RegisterExtraFile("deltaAODPartCorr.root"); } @@ -724,9 +712,15 @@ void CheckModuleFlags(const char *mode) { if (iPWG3hfe) ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG3hfe disabled on AOD's"); iPWG3hfe = 0; + if (iPWG3vertexing) + ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG3vertexing disabled on AOD's"); +// iPWG3vertexing = 0; if (iPWG4omega3pi) ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4omega3pi disabled on AOD's"); iPWG4omega3pi = 0; + if (iPWG4partcorr) + ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4partcorr disabled on AOD's"); + iPWG4partcorr = 0; } else { // ESD analysis if (!useMC) useTR = kFALSE; @@ -1175,13 +1169,12 @@ AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode) // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") plugin->SetRunMode(plugin_mode); if (useProductionMode) plugin->SetProductionMode(); - if (!outputSingleFolder.IsNull()) plugin->SetOutputSingleFolder(outputSingleFolder); plugin->SetJobTag(job_tag); plugin->SetNtestFiles(1); // plugin->SetPreferedSE("ALICE::NIHAM::File"); // Set versions of used packages // plugin->SetAPIVersion("V2.4"); - plugin->SetAPIVersion("V1.1x"); + plugin->SetAPIVersion("V1.0x"); plugin->SetROOTVersion(root_version); plugin->SetAliROOTVersion(aliroot_version); // Declare input data to be processed. @@ -1274,12 +1267,12 @@ AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode) listaods += mgr->GetExtraFiles(); listaods.ReplaceAll(" ", ","); } - if (listhists.Length()) listhists = Form("hist_archive.zip:%s@%s", listhists.Data(), outputStorages.Data()); - if (listaods.Length()) listaods = Form("aod_archive.zip:%s@%s", listaods.Data(), outputStorages.Data()); + if (listhists.Length()) listhists = Form("hist_archive.zip:%s@%s", listhists.Data(), outputStorages.Data());; + if (listaods.Length()) listaods = Form("aod_archive.zip:%s@%s", listaods.Data(), outputStorages.Data());; if (!listhists.Length() && !listaods.Length()) { ::Fatal("AnalysisTrainNew", "No task output !"); } - TString outputArchive = Form("log_archive.zip:stderr@%s", outputStorages.Data()); + TString outputArchive = "log_archive.zip:stdout,stderr@ALICE::CERN::SE"; if (listaods.Length()) { outputArchive += " "; outputArchive += listaods; diff --git a/EMCAL/AliCaloBunchInfo.cxx b/EMCAL/AliCaloBunchInfo.cxx deleted file mode 100644 index 22c2dc2bfe4..00000000000 --- a/EMCAL/AliCaloBunchInfo.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -#include "AliCaloBunchInfo.h" - -// Container class to hold information -// about of bunches. -// Used by the -// AliCaloRawAnalyzer -// classes -AliCaloBunchInfo::AliCaloBunchInfo( UInt_t start, Int_t length, const UShort_t * data ) : fStartTimebin(start), - fLength(length), - fkData(data) -{ - - -} - - - -AliCaloBunchInfo::~AliCaloBunchInfo() -{ - - -} - - - -AliCaloBunchInfo::AliCaloBunchInfo( const AliCaloBunchInfo & rhs) :fStartTimebin( rhs.fStartTimebin ), - fLength( rhs.fLength ), - fkData( rhs.fkData ) -{ - - -} - - - - -AliCaloBunchInfo& AliCaloBunchInfo::operator = ( const AliCaloBunchInfo & rhs) -{ - //This is just to get of compliation warning. Its not really needed - if(this != & rhs) - { - fStartTimebin = rhs.fStartTimebin; - fLength = rhs.fLength; - fkData = rhs.fkData; - } - return *this; -} - diff --git a/EMCAL/AliCaloBunchInfo.h b/EMCAL/AliCaloBunchInfo.h deleted file mode 100644 index 044722a5d68..00000000000 --- a/EMCAL/AliCaloBunchInfo.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef ALICALOBUNCHINFO_H -#define ALICALOBUNCHINFO_H - -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - -#include "Rtypes.h" - -// Container class to hold -// information about ALTRO -// Bunces from the altro stream. -// Each bunch has a start marker, ( fStartTimebin ) -// the number of ADC samples in the bunch fLength, and a pointer -// to the last (fStartTimebin + fLength ) time bin of the bunch. -// -class AliCaloBunchInfo -{ - public: - AliCaloBunchInfo( UInt_t starttimebin, Int_t length, const UShort_t * data ); - virtual ~AliCaloBunchInfo(); - - AliCaloBunchInfo( const AliCaloBunchInfo & rhs); - AliCaloBunchInfo & operator = ( const AliCaloBunchInfo & rhs); - - - UInt_t GetStartBin( ) const { return fStartTimebin;}; - Int_t GetLength() const { return fLength; }; - const UShort_t *GetData() const { return fkData; }; - - private: - AliCaloBunchInfo(); - UInt_t fStartTimebin; //Starttimebin as given by the ALTRO stream - Int_t fLength; //Length of the bunch - const UShort_t *fkData; //Pointer to the last data enetry of the bunch (data is reversed with respect to fStartTimebin) -}; - - - -#endif diff --git a/EMCAL/AliCaloFitResults.cxx b/EMCAL/AliCaloFitResults.cxx deleted file mode 100644 index 07317e17765..00000000000 --- a/EMCAL/AliCaloFitResults.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -#include "AliCaloFitResults.h" - - -// Container class to hold results from fitting -// as well as other methods for -// raw data signals extraction. The class memebers -// fChi2Sig, fNdfSig is only relevant if a fitting procedure is -// Applied. fStatus holds information on wether or not -// The signal was fitted sucessfully. fStatus might have a different meaning If other -// procedures than A different meaning Fitting is applied -AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, - const Short_t fitstatus, const Float_t amp, - const Float_t t0, const Float_t chi, - const Int_t ndf, Int_t minSig ) : fMaxSig(maxSig), - fPed(ped), - fStatus(fitstatus), - fAmpSig(amp), - fT0(t0), - fChi2Sig(chi), - fNdfSig(ndf), - fMinSig(minSig) -{ - - -} - - - - -AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Int_t minSig) : fMaxSig(maxSig), - fPed(-98), - fStatus( -1 ), - fAmpSig( -1 ), - fT0(-99), - fChi2Sig( -1 ), - fNdfSig( -1), - fMinSig (minSig) -{ - -} - - - -AliCaloFitResults::~AliCaloFitResults() -{ - -} - diff --git a/EMCAL/AliCaloFitResults.h b/EMCAL/AliCaloFitResults.h deleted file mode 100644 index 38378c2c7df..00000000000 --- a/EMCAL/AliCaloFitResults.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- mode: c++ -*- -#ifndef ALICALOFITRESULTS_H -#define ALICALOFITRESULTS_H -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -#include "Rtypes.h" - -// Container class to hold results from fitting -// as well as other methods for -// raw data signals extraction -class AliCaloFitResults -{ - public: - explicit AliCaloFitResults( const Int_t maxSig, - const Float_t ped, - const Short_t fitStatus, - const Float_t amp, - const Float_t t0, - const Float_t chi, - const Int_t ndf, - const Int_t minSig = -99); - - explicit AliCaloFitResults( const Int_t maxSig, const Int_t minSig ); - //AliCaloFitResults( const Int_t maxSig, const Int_t minSig ); - - - virtual ~AliCaloFitResults(); - Int_t GetMaxSig() const { return fMaxSig;}; - Float_t GetPed() const { return fPed;}; - Int_t GetMinSig() const { return fMinSig;}; - Int_t GetStatus() const { return fStatus;}; - Float_t GetAmp() const { return fAmpSig; }; - Float_t GetTof() const { return fT0; }; - Float_t GetChisSquare() const { return fChi2Sig;}; - Int_t GetNdf() const { return fNdfSig; }; - - private: - AliCaloFitResults(); - Int_t fMaxSig; //Maximum sample value ( 0 - 1023 ) - Float_t fPed; //Pedestal - Int_t fStatus; //Sucess or failure of fitting pocedure - Float_t fAmpSig; //Amplitude in entities of ADC counts - Float_t fT0; //Start time of signal in entities of sample intervals - Float_t fChi2Sig; //Chi Square of fit - Int_t fNdfSig; //Number of degrees of freedom of fit - Int_t fMinSig; //Pedestal -}; - -#endif diff --git a/EMCAL/AliCaloNeuralFit.cxx b/EMCAL/AliCaloNeuralFit.cxx deleted file mode 100644 index a2a9e1bbe23..00000000000 --- a/EMCAL/AliCaloNeuralFit.cxx +++ /dev/null @@ -1,1057 +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: $ */ - -//_________________________________________________________________________ -// Utility Class for Neural Network fit -// -// currently uses 5 input neurons -// network configured via TMultiLayerPerceptron -// -//*-- Author: Paola La Rocca (Catania) -// - -#include "AliCaloNeuralFit.h" -#include - - -Double_t AliCaloNeuralFit::Value -(int index, Double_t in0, Double_t in1, Double_t in2, Double_t in3, Double_t in4) -{ -// -// Compute the neural network answer, -// given the input values (taken from the signal TGraph) -// - - fInput0 = in0; - fInput1 = in1; - fInput2 = in2; - fInput3 = in3; - fInput4 = in4; - switch(index) - { - case 0: - return Neuron0x945d4f0(); - case 1: - return Neuron0x945f490(); - default: - return 0.; - } -} - -Double_t AliCaloNeuralFit::Neuron0x945cbe8() const -{ -// -// Input neuron. -// Just return activation value externally setted. -// - - return fInput0; -} - -Double_t AliCaloNeuralFit::Neuron0x945cd78() const -{ -// -// Input neuron. -// Just return activation value externally setted. -// - - return fInput1; -} - -Double_t AliCaloNeuralFit::Neuron0x945cf50() const -{ -// -// Input neuron. -// Just return activation value externally setted. -// - - return fInput2; -} - -Double_t AliCaloNeuralFit::Neuron0x945d128() const -{ -// -// Input neuron. -// Just return activation value externally setted. -// - - return fInput3; -} - -Double_t AliCaloNeuralFit::Neuron0x945d300() const -{ -// -// Input neuron. -// Just return activation value externally setted. -// - - return fInput4; -} - -Double_t AliCaloNeuralFit::Input0x945d620() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - - Double_t input = -0.508174; - input += Synapse0x943edb8(); - input += Synapse0x945d7d0(); - input += Synapse0x945d7f8(); - input += Synapse0x945d820(); - input += Synapse0x945d848(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945d620() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945d620(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945d870() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = 0.29145; - input += Synapse0x945da68(); - input += Synapse0x945da90(); - input += Synapse0x945dab8(); - input += Synapse0x945dae0(); - input += Synapse0x945db08(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945d870() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945d870(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945db30() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -0.132489; - input += Synapse0x945dd28(); - input += Synapse0x945dd50(); - input += Synapse0x945dd78(); - input += Synapse0x945dda0(); - input += Synapse0x945ddc8(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945db30() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945db30(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945ddf0() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -1.12891; - input += Synapse0x945dfe8(); - input += Synapse0x945e010(); - input += Synapse0x945e0c0(); - input += Synapse0x945e0e8(); - input += Synapse0x945e110(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945ddf0() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945ddf0(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945e138() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = 0.576896; - input += Synapse0x945e2e8(); - input += Synapse0x945e310(); - input += Synapse0x945e338(); - input += Synapse0x945e360(); - input += Synapse0x945e388(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945e138() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945e138(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945e3b0() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = 0.654194; - input += Synapse0x945e5a8(); - input += Synapse0x945e5d0(); - input += Synapse0x945e5f8(); - input += Synapse0x945e620(); - input += Synapse0x945e648(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945e3b0() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945e3b0(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945e670() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -0.356397; - input += Synapse0x945e868(); - input += Synapse0x945e890(); - input += Synapse0x945e8b8(); - input += Synapse0x945e038(); - input += Synapse0x945e060(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945e670() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945e670(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945e9e8() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -0.798487; - input += Synapse0x945ebe0(); - input += Synapse0x945ec08(); - input += Synapse0x945ec30(); - input += Synapse0x945ec58(); - input += Synapse0x945ec80(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945e9e8() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945e9e8(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945eca8() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -0.934985; - input += Synapse0x945eea0(); - input += Synapse0x945eec8(); - input += Synapse0x945eef0(); - input += Synapse0x945ef18(); - input += Synapse0x945ef40(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945eca8() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945eca8(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945ef68() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -0.457775; - input += Synapse0x945f160(); - input += Synapse0x945f188(); - input += Synapse0x945f1b0(); - input += Synapse0x945f1d8(); - input += Synapse0x945f200(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945ef68() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945ef68(); - return (tanh(input) * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945d4f0() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = 0.849942; - input += Synapse0x945f300(); - input += Synapse0x945f328(); - input += Synapse0x945f350(); - input += Synapse0x945f378(); - input += Synapse0x945f3a0(); - input += Synapse0x945f3c8(); - input += Synapse0x945f3f0(); - input += Synapse0x945f418(); - input += Synapse0x945f440(); - input += Synapse0x945f468(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945d4f0() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945d4f0(); - return (input * 1)+0; -} - -Double_t AliCaloNeuralFit::Input0x945f490() const -{ -// -// Hidden/Output neuron -// Compute the activation from linear combination of -// all neurons going into this, each one times its synaptic weight -// - Double_t input = -0.147416; - input += Synapse0x945f690(); - input += Synapse0x945f6b8(); - input += Synapse0x945f6e0(); - input += Synapse0x945f708(); - input += Synapse0x945f730(); - input += Synapse0x936a1f0(); - input += Synapse0x943ee18(); - input += Synapse0x945cb70(); - input += Synapse0x945cb98(); - input += Synapse0x945cbc0(); - return input; -} - -Double_t AliCaloNeuralFit::Neuron0x945f490() const -{ -// -// Hidden/Output neuron -// Return computed activation -// - Double_t input = Input0x945f490(); - return (input * 1)+0; -} - -Double_t AliCaloNeuralFit::Synapse0x943edb8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*-0.104546); -} - -Double_t AliCaloNeuralFit::Synapse0x945d7d0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*-0.0905177); -} - -Double_t AliCaloNeuralFit::Synapse0x945d7f8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*-0.143637); -} - -Double_t AliCaloNeuralFit::Synapse0x945d820() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*-0.413064); -} - -Double_t AliCaloNeuralFit::Synapse0x945d848() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*0.883744); -} - -Double_t AliCaloNeuralFit::Synapse0x945da68() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*-1.26724); -} - -Double_t AliCaloNeuralFit::Synapse0x945da90() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*-0.14136); -} - -Double_t AliCaloNeuralFit::Synapse0x945dab8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*0.27187); -} - -Double_t AliCaloNeuralFit::Synapse0x945dae0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*0.563302); -} - -Double_t AliCaloNeuralFit::Synapse0x945db08() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*1.38006); -} - -Double_t AliCaloNeuralFit::Synapse0x945dd28() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*-0.235737); -} - -Double_t AliCaloNeuralFit::Synapse0x945dd50() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*0.715314); -} - -Double_t AliCaloNeuralFit::Synapse0x945dd78() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*-0.893506); -} - -Double_t AliCaloNeuralFit::Synapse0x945dda0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*1.66689); -} - -Double_t AliCaloNeuralFit::Synapse0x945ddc8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*0.433463); -} - -Double_t AliCaloNeuralFit::Synapse0x945dfe8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*0.198835); -} - -Double_t AliCaloNeuralFit::Synapse0x945e010() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*1.67429); -} - -Double_t AliCaloNeuralFit::Synapse0x945e0c0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*-1.19328); -} - -Double_t AliCaloNeuralFit::Synapse0x945e0e8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*2.5465); -} - -Double_t AliCaloNeuralFit::Synapse0x945e110() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*0.153072); -} - -Double_t AliCaloNeuralFit::Synapse0x945e2e8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*0.0815823); -} - -Double_t AliCaloNeuralFit::Synapse0x945e310() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*0.0316826); -} - -Double_t AliCaloNeuralFit::Synapse0x945e338() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*0.617448); -} - -Double_t AliCaloNeuralFit::Synapse0x945e360() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*-0.749993); -} - -Double_t AliCaloNeuralFit::Synapse0x945e388() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*-0.980764); -} - -Double_t AliCaloNeuralFit::Synapse0x945e5a8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*-0.453657); -} - -Double_t AliCaloNeuralFit::Synapse0x945e5d0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*0.146578); -} - -Double_t AliCaloNeuralFit::Synapse0x945e5f8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*0.123041); -} - -Double_t AliCaloNeuralFit::Synapse0x945e620() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*0.189871); -} - -Double_t AliCaloNeuralFit::Synapse0x945e648() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*-0.153873); -} - -Double_t AliCaloNeuralFit::Synapse0x945e868() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*-0.0569668); -} - -Double_t AliCaloNeuralFit::Synapse0x945e890() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*-0.0208438); -} - -Double_t AliCaloNeuralFit::Synapse0x945e8b8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*-0.662575); -} - -Double_t AliCaloNeuralFit::Synapse0x945e038() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*-0.308952); -} - -Double_t AliCaloNeuralFit::Synapse0x945e060() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*-0.0591419); -} - -Double_t AliCaloNeuralFit::Synapse0x945ebe0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*0.203333); -} - -Double_t AliCaloNeuralFit::Synapse0x945ec08() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*-0.210458); -} - -Double_t AliCaloNeuralFit::Synapse0x945ec30() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*-0.46208); -} - -Double_t AliCaloNeuralFit::Synapse0x945ec58() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*-0.213809); -} - -Double_t AliCaloNeuralFit::Synapse0x945ec80() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*0.652572); -} - -Double_t AliCaloNeuralFit::Synapse0x945eea0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*0.53005); -} - -Double_t AliCaloNeuralFit::Synapse0x945eec8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*1.97055); -} - -Double_t AliCaloNeuralFit::Synapse0x945eef0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*-0.934772); -} - -Double_t AliCaloNeuralFit::Synapse0x945ef18() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*-0.253289); -} - -Double_t AliCaloNeuralFit::Synapse0x945ef40() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*-0.190109); -} - -Double_t AliCaloNeuralFit::Synapse0x945f160() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cbe8()*0.111492); -} - -Double_t AliCaloNeuralFit::Synapse0x945f188() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cd78()*0.928076); -} - -Double_t AliCaloNeuralFit::Synapse0x945f1b0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945cf50()*0.178153); -} - -Double_t AliCaloNeuralFit::Synapse0x945f1d8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d128()*-0.750558); -} - -Double_t AliCaloNeuralFit::Synapse0x945f200() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d300()*-1.40984); -} - -Double_t AliCaloNeuralFit::Synapse0x945f300() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d620()*-0.838377); -} - -Double_t AliCaloNeuralFit::Synapse0x945f328() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d870()*0.191143); -} - -Double_t AliCaloNeuralFit::Synapse0x945f350() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945db30()*-0.453988); -} - -Double_t AliCaloNeuralFit::Synapse0x945f378() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945ddf0()*-0.520562); -} - -Double_t AliCaloNeuralFit::Synapse0x945f3a0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e138()*-0.995398); -} - -Double_t AliCaloNeuralFit::Synapse0x945f3c8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e3b0()*-0.114216); -} - -Double_t AliCaloNeuralFit::Synapse0x945f3f0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e670()*-0.72899); -} - -Double_t AliCaloNeuralFit::Synapse0x945f418() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e9e8()*-0.453087); -} - -Double_t AliCaloNeuralFit::Synapse0x945f440() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945eca8()*0.0891431); -} - -Double_t AliCaloNeuralFit::Synapse0x945f468() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945ef68()*0.679937); -} - -Double_t AliCaloNeuralFit::Synapse0x945f690() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d620()*0.806704); -} - -Double_t AliCaloNeuralFit::Synapse0x945f6b8() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945d870()*-1.27447); -} - -Double_t AliCaloNeuralFit::Synapse0x945f6e0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945db30()*1.0306); -} - -Double_t AliCaloNeuralFit::Synapse0x945f708() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945ddf0()*2.09234); -} - -Double_t AliCaloNeuralFit::Synapse0x945f730() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e138()*0.0643316); -} - -Double_t AliCaloNeuralFit::Synapse0x936a1f0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e3b0()*-0.204933); -} - -Double_t AliCaloNeuralFit::Synapse0x943ee18() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e670()*0.423604); -} - -Double_t AliCaloNeuralFit::Synapse0x945cb70() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945e9e8()*1.00527); -} - -Double_t AliCaloNeuralFit::Synapse0x945cb98() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945eca8()*-1.54485); -} - -Double_t AliCaloNeuralFit::Synapse0x945cbc0() const -{ -// -// Synaptic connection -// Multiplies input times synaptic weight -// - return (Neuron0x945ef68()*0.540381); -} - diff --git a/EMCAL/AliCaloNeuralFit.h b/EMCAL/AliCaloNeuralFit.h deleted file mode 100644 index b90cefafdd7..00000000000 --- a/EMCAL/AliCaloNeuralFit.h +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef ALICALONEURALFIT_H -#define ALICALONEURALFIT_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* $Id: $ */ - -//_________________________________________________________________________ -// Utility Class for Neural Network fit -// -// currently uses 5 input neurons -// network configured via TMultiLayerPerceptron -// -//*-- Author: Paola La Rocca (Catania) -// - -#include - -class AliCaloNeuralFit : public TObject -{ -public: - AliCaloNeuralFit(): fInput0(0.0), fInput1(0.0), fInput2(0.0), fInput3(0.0), fInput4(0.0) {} - ~AliCaloNeuralFit() {} - Double_t Value(int index, Double_t in0, Double_t in1, Double_t in2, Double_t in3, Double_t in4); - Double_t Value(int index, Double_t* input) { return Value(index, input[0], input[1], input[2], input[3], input[4]); } -private: - Double_t fInput0; // neural network input neuron #1 - Double_t fInput1; // neural network input neuron #2 - Double_t fInput2; // neural network input neuron #3 - Double_t fInput3; // neural network input neuron #4 - Double_t fInput4; // neural network input neuron #5 - - // private functions as exported by TMultiLayerPerceptron - // containing the network data processing - Double_t Neuron0x945cbe8() const; - Double_t Neuron0x945cd78() const; - Double_t Neuron0x945cf50() const; - Double_t Neuron0x945d128() const; - Double_t Neuron0x945d300() const; - Double_t Input0x945d620() const; - Double_t Neuron0x945d620() const; - Double_t Input0x945d870() const; - Double_t Neuron0x945d870() const; - Double_t Input0x945db30() const; - Double_t Neuron0x945db30() const; - Double_t Input0x945ddf0() const; - Double_t Neuron0x945ddf0() const; - Double_t Input0x945e138() const; - Double_t Neuron0x945e138() const; - Double_t Input0x945e3b0() const; - Double_t Neuron0x945e3b0() const; - Double_t Input0x945e670() const; - Double_t Neuron0x945e670() const; - Double_t Input0x945e9e8() const; - Double_t Neuron0x945e9e8() const; - Double_t Input0x945eca8() const; - Double_t Neuron0x945eca8() const; - Double_t Input0x945ef68() const; - Double_t Neuron0x945ef68() const; - Double_t Input0x945d4f0() const; - Double_t Neuron0x945d4f0() const; - Double_t Input0x945f490() const; - Double_t Neuron0x945f490() const; - Double_t Synapse0x943edb8() const; - Double_t Synapse0x945d7d0() const; - Double_t Synapse0x945d7f8() const; - Double_t Synapse0x945d820() const; - Double_t Synapse0x945d848() const; - Double_t Synapse0x945da68() const; - Double_t Synapse0x945da90() const; - Double_t Synapse0x945dab8() const; - Double_t Synapse0x945dae0() const; - Double_t Synapse0x945db08() const; - Double_t Synapse0x945dd28() const; - Double_t Synapse0x945dd50() const; - Double_t Synapse0x945dd78() const; - Double_t Synapse0x945dda0() const; - Double_t Synapse0x945ddc8() const; - Double_t Synapse0x945dfe8() const; - Double_t Synapse0x945e010() const; - Double_t Synapse0x945e0c0() const; - Double_t Synapse0x945e0e8() const; - Double_t Synapse0x945e110() const; - Double_t Synapse0x945e2e8() const; - Double_t Synapse0x945e310() const; - Double_t Synapse0x945e338() const; - Double_t Synapse0x945e360() const; - Double_t Synapse0x945e388() const; - Double_t Synapse0x945e5a8() const; - Double_t Synapse0x945e5d0() const; - Double_t Synapse0x945e5f8() const; - Double_t Synapse0x945e620() const; - Double_t Synapse0x945e648() const; - Double_t Synapse0x945e868() const; - Double_t Synapse0x945e890() const; - Double_t Synapse0x945e8b8() const; - Double_t Synapse0x945e038() const; - Double_t Synapse0x945e060() const; - Double_t Synapse0x945ebe0() const; - Double_t Synapse0x945ec08() const; - Double_t Synapse0x945ec30() const; - Double_t Synapse0x945ec58() const; - Double_t Synapse0x945ec80() const; - Double_t Synapse0x945eea0() const; - Double_t Synapse0x945eec8() const; - Double_t Synapse0x945eef0() const; - Double_t Synapse0x945ef18() const; - Double_t Synapse0x945ef40() const; - Double_t Synapse0x945f160() const; - Double_t Synapse0x945f188() const; - Double_t Synapse0x945f1b0() const; - Double_t Synapse0x945f1d8() const; - Double_t Synapse0x945f200() const; - Double_t Synapse0x945f300() const; - Double_t Synapse0x945f328() const; - Double_t Synapse0x945f350() const; - Double_t Synapse0x945f378() const; - Double_t Synapse0x945f3a0() const; - Double_t Synapse0x945f3c8() const; - Double_t Synapse0x945f3f0() const; - Double_t Synapse0x945f418() const; - Double_t Synapse0x945f440() const; - Double_t Synapse0x945f468() const; - Double_t Synapse0x945f690() const; - Double_t Synapse0x945f6b8() const; - Double_t Synapse0x945f6e0() const; - Double_t Synapse0x945f708() const; - Double_t Synapse0x945f730() const; - Double_t Synapse0x936a1f0() const; - Double_t Synapse0x943ee18() const; - Double_t Synapse0x945cb70() const; - Double_t Synapse0x945cb98() const; - Double_t Synapse0x945cbc0() const; - - ClassDef(AliCaloNeuralFit,1) -}; - -#endif // AliCaloNeuralFit_h - diff --git a/EMCAL/AliCaloRawAnalyzer.cxx b/EMCAL/AliCaloRawAnalyzer.cxx deleted file mode 100644 index 524c296a74b..00000000000 --- a/EMCAL/AliCaloRawAnalyzer.cxx +++ /dev/null @@ -1,289 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -// Base class for extraction -// of signal amplitude and peak position -// From CALO Calorimeter RAW data (from the RCU) -// Contains some utilities for preparing / selecting -// Signals suitable for signal extraction -// By derived classes - -#include "AliLog.h" -#include "AliCaloRawAnalyzer.h" -#include "AliCaloBunchInfo.h" -#include "AliCaloFitResults.h" -#include "TMath.h" -#include -using namespace std; - - -AliCaloRawAnalyzer::AliCaloRawAnalyzer() : TObject(), - fMinTimeIndex(-1), - fMaxTimeIndex(-1), - fFitArrayCut(5), - fAmpCut(4), - fNsampleCut(5), - fIsZerosupressed( false ), - fVerbose( false ) -{ - //Comment - for(int i=0; i < MAXSAMPLES; i++ ) - { - fReversed[i] = 0; - } -} - -AliCaloRawAnalyzer::~AliCaloRawAnalyzer() -{ - -} - - -void -AliCaloRawAnalyzer::SetTimeConstraint(const int min, const int max ) -{ - //Require that the bin if the maximum ADC value is between min and max (timebin) - if( ( min > max ) || min > MAXSAMPLES || max > MAXSAMPLES ) - { - AliWarning( Form( "Attempt to set Invalid time bin range (Min , Max) = (%d, %d), Ingored", min, max ) ); - } - else - { - fMinTimeIndex = min; - fMaxTimeIndex = max; - } -} - - -UShort_t -AliCaloRawAnalyzer::Max(const UShort_t *data, const int length ) const -{ - //------------ - UShort_t tmpmax = data[0]; - - for(int i=0; i < length; i++) - { - if( tmpmax < data[i] ) - { - tmpmax = data[i]; - } - } - return tmpmax; -} - - -void -AliCaloRawAnalyzer::SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const -{ - //Selection of subset of data from one bunch that will be used for fitting or - //Peak finding. Go to the left and right of index of the maximum time bin - //Untile the ADC value is less that fFitArrayCut - int tmpfirst = maxindex; - int tmplast = maxindex; - - while(( tmpfirst ) > 0 && ( fData[tmpfirst] > fFitArrayCut )) - { - tmpfirst -- ; - } - - while(( tmplast ) < length && ( fData [tmplast] > fFitArrayCut )) - { - tmplast ++; - } - - *first = tmpfirst +1; - *last = tmplast -1; -} - - - -Float_t -AliCaloRawAnalyzer::ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/, double *outarray ) const -{ - //Time sample comes in reversed order, revers them back - //Subtract the baseline based on content of altrocfg1 and altrocfg2. - Int_t length = bunch->GetLength(); - const UShort_t *sig = bunch->GetData(); - - double ped = EvaluatePedestal( sig , length); - - for( int i=0; i < length; i++ ) - { - outarray[i] = sig[length -i -1] - ped; - } - - return ped; -} - - - -Float_t -AliCaloRawAnalyzer::EvaluatePedestal(const UShort_t * const data, const int /*length*/ ) const -{ - // double ped = 0; - double tmp = 0; - - if( fIsZerosupressed == false ) - { - for(int i=0; i < 5; i++ ) - { - tmp += data[i]; - } - } - return tmp/5; -} - - -short -AliCaloRawAnalyzer::Max( const AliCaloBunchInfo *const bunch , int *const maxindex ) const -{ - //comment - short tmpmax = -1; - int tmpindex = -1; - const UShort_t *sig = bunch->GetData(); - - for(int i=0; i < bunch->GetLength(); i++ ) - { - if( sig[i] > tmpmax ) - { - tmpmax = sig[i]; - tmpindex = i; - } - } - - if(maxindex != 0 ) - { - *maxindex = bunch->GetLength() -1 - tmpindex + bunch->GetStartBin(); - } - - return tmpmax; -} - - -int -AliCaloRawAnalyzer::SelectBunch( const vector &bunchvector,short *const maxampbin, short *const maxamplitude ) const -{ - //We select the bunch with the highest amplitude unless any time constraints is set - short max = -1; - short bunchindex = -1; - short maxall = -1; - int indx = -1; - - for(unsigned int i=0; i < bunchvector.size(); i++ ) - { - max = Max( &bunchvector.at(i), &indx ); - if( IsInTimeRange( indx) ) - { - if( max > maxall ) - { - maxall = max; - bunchindex = i; - } - } - } - - *maxampbin = indx; - *maxamplitude = max; - return bunchindex; -} - - -bool -AliCaloRawAnalyzer::IsInTimeRange( const int maxindex ) const -{ - // Ckeck if the index of the max ADC vaue is consistent with trigger. - if( ( fMinTimeIndex < 0 && fMaxTimeIndex < 0) ||fMaxTimeIndex < 0 ) - { - return true; - } - return ( maxindex < fMaxTimeIndex ) && ( maxindex > fMinTimeIndex ) ? true : false; -} - - -void -AliCaloRawAnalyzer::PrintBunches( const vector &bvctr ) const -{ - //comment - cout << __FILE__ << __LINE__<< "*************** Printing Bunches *******************" << endl; - cout << __FILE__ << __LINE__<< "*** There are " << bvctr.size() << ", bunches" << endl; - - for(unsigned int i=0; i < bvctr.size() ; i++ ) - { - PrintBunch( bvctr.at(i) ); - cout << " bunch = " << i << endl; - } - cout << __FILE__ << __LINE__<< "*************** Done ... *******************" << endl; -} - - -void -AliCaloRawAnalyzer::PrintBunch( const AliCaloBunchInfo &bunch ) const -{ - //comment - cout << __FILE__ << ":" << __LINE__ << endl; - cout << __FILE__ << __LINE__ << ", startimebin = " << bunch.GetStartBin() << ", length =" << bunch.GetLength() << endl; - const UShort_t *sig = bunch.GetData(); - - for ( Int_t j = 0; j < bunch.GetLength(); j++) - { - printf("%d\t", sig[j] ); - } - cout << endl; -} - - -AliCaloFitResults -AliCaloRawAnalyzer::Evaluate( const vector &/*bunchvector*/, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/) -{ // method to do the selection of what should possibly be fitted - // not implemented for base class - return AliCaloFitResults( 0, 0, 0, 0, 0, 0, 0 ); -} - - -int -AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index, Float_t & maxf, short & maxamp, short & maxampindex, Float_t & ped, int & first, int & last) -{ // method to do the selection of what should possibly be fitted - int nsamples = 0; - index = SelectBunch( bunchvector, &maxampindex, &maxamp ); // select the bunch with the highest amplitude unless any time constraints is set - - - if( index >= 0 && maxamp > fAmpCut) // something valid was found, and non-zero amplitude - { - // use more convenient numbering and possibly subtract pedestal - ped = ReverseAndSubtractPed( &(bunchvector.at(index)), altrocfg1, altrocfg2, fReversed ); - maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed ); - - if ( maxf > fAmpCut ) // possibly significant signal - { - // select array around max to possibly be used in fit - maxampindex -= bunchvector.at(index).GetStartBin(); // PTH - why isn't this index also reversed for call below? - SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxampindex , &first, &last); - - // sanity check: maximum should not be in first or last bin - // if we should do a fit - if (first!=maxampindex && last!=maxampindex) { - // calculate how many samples we have - nsamples = last - first + 1; - } - } - } - - return nsamples; -} - diff --git a/EMCAL/AliCaloRawAnalyzer.h b/EMCAL/AliCaloRawAnalyzer.h deleted file mode 100644 index 1a3029f56c3..00000000000 --- a/EMCAL/AliCaloRawAnalyzer.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef ALICALORAWANALYZER_H -#define ALICALORAWANALYZER_H -/************************************************************************** - * This file is property of and copyright by * - * the Relatvistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -//Base class for extraction -//of signal amplitude and peak position -//From CALO Calorimeter RAW data - - -#include "Rtypes.h" -#include "TObject.h" -#include -using namespace std; - -#define MAXSAMPLES 1008 //CRAP PTH -#include "AliCaloRawAnalyzer.h" - -class AliCaloBunchInfo; -class AliCaloFitResults; - - -class AliCaloRawAnalyzer : public TObject -{ - public: - AliCaloRawAnalyzer(); - virtual ~AliCaloRawAnalyzer(); - virtual AliCaloFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); - - void PrintBunches( const vector &bunchvector ) const; - void PrintBunch( const AliCaloBunchInfo &bunch ) const ; - - virtual int PreFitEvaluateSamples( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index, Float_t & maxf, short & maxamp, short & maxampindex, Float_t & ped, int & first, int & last); - void SetTimeConstraint(const int min, const int max ); - void SetVerbose(bool verbose = true){ fVerbose = verbose; }; - void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ; - void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ; - void SetFitArrayCut(const Int_t cut) { fFitArrayCut = cut ; } ; - void SetNsampleCut(const Int_t cut) { fNsampleCut = cut ; } ; - - // access to array info - Double_t GetReversed(const int i) const { return fReversed[i]; } - - protected: - short Max( const AliCaloBunchInfo *const bunch, int *const maxindex) const; - UShort_t Max(const UShort_t *data, const int length ) const; - bool IsInTimeRange( const int maxindex ) const; - Float_t ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const; - int SelectBunch( const vector &bunchvector, short *const maxampbin, short *const maxamplitude ) const; - void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const; - Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const; - - Double_t fReversed[MAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted) - - // private: - int fMinTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex - int fMaxTimeIndex; //The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex - int fFitArrayCut; //Cut on ADC value (after ped. subtraction) for signals used for fit - Float_t fAmpCut; //Max ADC - pedestal must be higher than this befor attemting to extract the amplitude - int fNsampleCut; //Minimum number of sample require before attemting to extract signal parameters - bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true - bool fVerbose; //Print debug information to std out if set to true - -}; - -#endif diff --git a/EMCAL/AliCaloRawAnalyzerCrude.cxx b/EMCAL/AliCaloRawAnalyzerCrude.cxx deleted file mode 100644 index 0ddd36e2596..00000000000 --- a/EMCAL/AliCaloRawAnalyzerCrude.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by the Experimental Nuclear * - * Physics Group, Dep. of Physics * - * University of Oslo, Norway, 2007 * - * * - * Author: Per Thomas Hille for the ALICE HLT Project.* - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to perthi@fys.uio.no * - * * - * 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. * - **************************************************************************/ -#include "AliCaloRawAnalyzerCrude.h" -#include "AliCaloFitResults.h" -#include "AliCaloBunchInfo.h" - - -AliCaloRawAnalyzerCrude::AliCaloRawAnalyzerCrude() -{ - -} - - -AliCaloRawAnalyzerCrude::~AliCaloRawAnalyzerCrude() -{ - -} - - -AliCaloFitResults -AliCaloRawAnalyzerCrude::Evaluate(const vector &bunchvector, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/) -{ - if( bunchvector.size() <= 0 ) - { - return AliCaloFitResults(-1, -1, -1, -1 , -1, -1, -1 ); - } - - Int_t amp = 0; - Float_t tof = -99; - const UShort_t *sig; - - double ped = EvaluatePedestal( bunchvector.at(0).GetData(), bunchvector.at(0).GetLength() ) ; - - for( unsigned int i= 0; i < bunchvector.size(); ++i) - { - sig = bunchvector.at(i).GetData(); - int length = bunchvector.at(i).GetLength(); - - for(int j = 0; j < length; j ++) - if( sig[j] > amp ) - { - amp = sig[j]; - tof = i; - } - } - - //:EvaluatePedestal(const UShort_t * const data, const int length ) - // double ped = EvaluatePedestal(sig, length) ; - return AliCaloFitResults(amp, ped, -1, amp - ped, tof, -1, -1 ); - -} //end Crude - - diff --git a/EMCAL/AliCaloRawAnalyzerLMS.cxx b/EMCAL/AliCaloRawAnalyzerLMS.cxx deleted file mode 100644 index 59e4691925c..00000000000 --- a/EMCAL/AliCaloRawAnalyzerLMS.cxx +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -// Extraction of amplitude and peak position -// FRom CALO raw data using -// least square fit for the -// Moment assuming identical and -// independent errors (equivalent with chi square) -// - -#include "AliCaloRawAnalyzerLMS.h" -#include "AliCaloBunchInfo.h" -#include "AliCaloFitResults.h" -#include "AliLog.h" -#include "TMath.h" -#include -#include "TF1.h" -#include "TGraph.h" - -using namespace std; - - -#define BAD 4 //CRAP PTH - - -AliCaloRawAnalyzerLMS::AliCaloRawAnalyzerLMS() : AliCaloRawAnalyzer(), - fkEulerSquared(7.389056098930650227), - fSig(0), - fTf1(0) -{ - //comment - for(int i=0; i < MAXSAMPLES; i++) - { - fXaxis[i] = i; - } - - fTf1 = new TF1( "myformula", "[0]*((x - [1])/2.35)^2*exp(-2*(x -[1])/2.35)", 0, 30 ); - // fTf1 = new TF1( "myformula", "[0]*((x - [1])/[2])^[3]*exp(-[3]*(x -[1])/[2])", 0, 30 ); - -} - - -AliCaloRawAnalyzerLMS::~AliCaloRawAnalyzerLMS() -{ - delete fTf1; -} - - - -AliCaloFitResults -AliCaloRawAnalyzerLMS::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) -{ - // Extracting signal parameters using fitting - short maxampindex; //index of maximum amplitude - short maxamp; //Maximum amplitude - int index = SelectBunch( bunchvector, &maxampindex, &maxamp ); - - if( index >= 0) - { - Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index)) , altrocfg1, altrocfg2, fReversed ); - int first; - int last; - Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed ); - - if ( maxf > fAmpCut ) - { - SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxampindex - bunchvector.at(index).GetStartBin(), &first, &last); - int nsamples = last - first; - - if( ( nsamples ) > fNsampleCut ) - { - - TGraph *graph = new TGraph( last - first, fXaxis, &fReversed[first] ); - fTf1->SetParameter(0, maxf*fkEulerSquared ); - fTf1->SetParameter(1, 0.2); - // fTf1->SetParameter(2, 2); - // fTf1->SetParameter(2, 3); - - // return AliCaloFitResults( -1 , -1 , -1, -1, -1, -1 , -1); - - Short_t tmpStatus = graph->Fit(fTf1, "Q0RW"); - - // return AliCaloFitResults( -1 , -1 , -1, -1, -1, -1 , -1); - - if( fVerbose == true ) - { - AliCaloRawAnalyzer::PrintBunch( bunchvector.at(index) ); - PrintFitResult( fTf1 ) ; - } - - delete graph; - return AliCaloFitResults( maxamp, ped , tmpStatus, - fTf1->GetParameter(0)/fkEulerSquared, - fTf1->GetParameter(1) + maxampindex, - fTf1->GetChisquare(), - fTf1->GetNDF()); - - - // delete graph; - - } - else - { - return AliCaloFitResults( maxamp, ped, -1, maxf, -1, -1, -1 ); - } - } - else - { - return AliCaloFitResults( maxamp , ped, -1, maxf, -1, -1, -1 ); - } - } - else - { - return AliCaloFitResults( -99, -99 ); - } - - return AliCaloFitResults( -99, -99 ); - -} - - -void -AliCaloRawAnalyzerLMS::PrintFitResult(const TF1 *f) const -{ - //comment - cout << endl; - cout << __FILE__ << __LINE__ << "Using this samplerange we get" << endl; - cout << __FILE__ << __LINE__ << "AMPLITUDE = " << f->GetParameter(0)/fkEulerSquared << ",.. !!!!" << endl; - cout << __FILE__ << __LINE__ << "TOF = " << f->GetParameter(1) << ",.. !!!!" << endl; - cout << __FILE__ << __LINE__ << "NDF = " << f->GetNDF() << ",.. !!!!" << endl; - // cout << __FILE__ << __LINE__ << "STATUS = " << f->GetStatus() << ",.. !!!!" << endl << endl; - cout << endl << endl; -} diff --git a/EMCAL/AliCaloRawAnalyzerLMS.h b/EMCAL/AliCaloRawAnalyzerLMS.h deleted file mode 100644 index edd625e1944..00000000000 --- a/EMCAL/AliCaloRawAnalyzerLMS.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef ALICALORAWANALYZERLMS_H -#define ALICALORAWANALYZERLMS_H -/************************************************************************** - * This file is property of and copyright by * - * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * - * * - * Primary Author: Per Thomas Hille * - * * - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to p.t.hille@fys.uio.no * - * * - * 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. * - **************************************************************************/ - - -// Extraction of amplitude and peak position -// FRom CALO raw data using -// Chi square fit - -#include "AliCaloRawAnalyzer.h" - - -class TF1; -class TGraph; - -class AliCaloRawAnalyzerLMS : public AliCaloRawAnalyzer -{ - public: - AliCaloRawAnalyzerLMS(); - virtual ~AliCaloRawAnalyzerLMS(); - virtual AliCaloFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); - void PrintFitResult(const TF1 *f) const; - - private: - AliCaloRawAnalyzerLMS(const AliCaloRawAnalyzerLMS & ); - AliCaloRawAnalyzerLMS & operator = (const AliCaloRawAnalyzerLMS &); - - double fXaxis[MAXSAMPLES]; //Axis if time bins, ( used by TGraph ) - const double fkEulerSquared; //e^2 = 7.389056098930650227 - TGraph *fSig; // Signale holding the data to be fitted. - TF1 *fTf1; // Analytical formula of the Semi Gaussian to be fitted - -}; - -#endif diff --git a/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx b/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx deleted file mode 100644 index f839260957e..00000000000 --- a/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx +++ /dev/null @@ -1,172 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by the Experimental Nuclear * - * Physics Group, Dep. of Physics * - * University of Oslo, Norway, 2007 * - * * - * Author: Per Thomas Hille for the ALICE HLT Project.* - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to perthi@fys.uio.no * - * * - * 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. * - **************************************************************************/ - -// The Peak-Finder algorithm -// The amplitude is extracted as a -// weighted sum of the samples using the -// best possible weights. -// The wights is calculated only once and the -// Actual extraction of amplitude and peak position -// Is done with a simple vector multiplication, allowing for -// Extreemely fast computations. - -#include "AliCaloRawAnalyzerPeakFinder.h" -#include "AliCaloBunchInfo.h" -#include "AliCaloFitResults.h" -#include -#include "unistd.h" -#include "TMath.h" -#include "AliLog.h" - -using namespace std; - -AliCaloRawAnalyzerPeakFinder::AliCaloRawAnalyzerPeakFinder() :AliCaloRawAnalyzer(), - fTof(0), - fAmp(0) -{ - //comment - - fNsampleCut = 5; - - for(int i=0; i < MAXSTART; i++) - { - for(int j=0; j < SAMPLERANGE; j++ ) - { - fPFAmpVectors[i][j] = new double[100]; - fPFTofVectors[i][j] = new double[100]; - - for(int k=0; k < 100; k++ ) - { - fPFAmpVectors[i][j][k] = 0; - fPFTofVectors[i][j][k] = 0; - } - } - } - LoadVectors(); -} - - -AliCaloRawAnalyzerPeakFinder::~AliCaloRawAnalyzerPeakFinder() -{ - //comment - for(int i=0; i < MAXSTART; i++) - { - for(int j=0; j < SAMPLERANGE; j++ ) - { - delete[] fPFAmpVectors[i][j]; - delete[] fPFTofVectors[i][j]; - } - } -} - - -AliCaloFitResults -AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) -{ - // Extracting the amplitude using the Peak-Finder algorithm - // The amplitude is a weighted sum of the samples using - // optimum weights. - - short maxampindex; //index of maximum amplitude - short maxamp; //Maximum amplitude - fAmp = 0; - int index = SelectBunch( bunchvector, &maxampindex, &maxamp ); - - if( index >= 0) - { - Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index)) , altrocfg1, altrocfg2, fReversed ); - Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed ); - - if( maxf < fAmpCut || ( maxamp - ped) > 900 ) // (maxamp - ped) > 900 = Close to saturation (use low gain then) - { - // cout << __FILE__ << __LINE__ <<":, maxamp = " << maxamp << ", ped = "<< ped << ",. maxf = "<< maxf << ", maxampindex = "<< maxampindex << endl; - return AliCaloFitResults( maxamp, ped, -1, maxf, maxampindex, -1, -1 ); - } - - int first; - int last; - - if ( maxf > fAmpCut ) - { - SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxampindex - bunchvector.at(index).GetStartBin(), &first, &last); - int nsamples = last - first; - if( ( nsamples ) >= fNsampleCut ) - { - int startbin = bunchvector.at(index).GetStartBin(); - int n = last -first; - int pfindex = n - fNsampleCut; - pfindex = pfindex > SAMPLERANGE ? SAMPLERANGE : pfindex; - - for(int i=0; i < SAMPLERANGE; i++ ) - { - int dt = maxampindex - startbin -2; - double tmp = fReversed[ dt +i]; - fAmp += fPFAmpVectors[0][pfindex][i]*tmp; - } - - return AliCaloFitResults( maxamp, ped , -1, fAmp, -1, -1, -1 ); - } - else - { - return AliCaloFitResults( maxamp, ped , -1, maxf, -1, -1, -1 ); - } - } - } - - // cout << __FILE__ << __LINE__ << "WARNING, returning amp = -1 " << endl; - - return AliCaloFitResults(-1, -1); -} - - -void -AliCaloRawAnalyzerPeakFinder::LoadVectors() -{ - //Read in the Peak finder vecors from file - for(int i = 0; i < MAXSTART ; i++) - { - for( int j=0; j < SAMPLERANGE; j++) - { - char filename[256]; - int n = j+fNsampleCut; - double start = (double)i+0.5; - sprintf(filename, "%s/EMCAL/vectors-emcal/start%.1fN%dtau0.235fs10dt1.0.txt", getenv("ALICE_ROOT"), start, n); - FILE *fp = fopen(filename, "r"); - - if(fp == 0) - { - AliFatal( Form( "could not open file: %s", filename ) ); - } - else - { - for(int m = 0; m < n ; m++ ) - { - fscanf(fp, "%lf\t", &fPFAmpVectors[i][j][m] ); - } - fscanf(fp, "\n"); - - for(int m = 0; m < n ; m++ ) - { - fscanf(fp, "%lf\t", &fPFTofVectors[i][j][m] ); - } - - fclose (fp); - } - } - } -} diff --git a/EMCAL/AliCaloRawAnalyzerPeakFinder.h b/EMCAL/AliCaloRawAnalyzerPeakFinder.h deleted file mode 100644 index d4ad5e60a34..00000000000 --- a/EMCAL/AliCaloRawAnalyzerPeakFinder.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef ALICALORAWANALYZERPEAKFINDER_H -#define ALICALORAWANALYZERPEAKFINDER_H - -/************************************************************************** - * This file is property of and copyright by the Experimental Nuclear * - * Physics Group, Dep. of Physics * - * University of Oslo, Norway, 2007 * - * * - * Author: Per Thomas Hille for the ALICE HLT Project.* - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to perthi@fys.uio.no * - * * - * 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. * - **************************************************************************/ - -// The Peak-Finder algorithm -// The amplitude is extracted as a -// weighted sum of the samples using the -// best possible weights. - - -#include "AliCaloRawAnalyzer.h" - -#define MAXSTART 3 -#define SAMPLERANGE 15 -#define SHIF 0.5 - -class AliCaloBunchInfo; - -class AliCaloRawAnalyzerPeakFinder : public AliCaloRawAnalyzer -{ - public: - AliCaloRawAnalyzerPeakFinder(); - virtual ~AliCaloRawAnalyzerPeakFinder(); - virtual AliCaloFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); - - private: - // AliCaloRawAnalyzerPeakFinder( const AliCaloRawAnalyzerPeakFinder & ); - // AliCaloRawAnalyzerPeakFinder & operator = ( const AliCaloRawAnalyzerPeakFinder & ); - - void LoadVectors(); - double *fPFAmpVectors[MAXSTART][SAMPLERANGE]; // Vectors for Amplitude extraction - double *fPFTofVectors[MAXSTART][SAMPLERANGE]; // Vectors for TOF extraction - double fTof; - double fAmp; - -}; - -#endif diff --git a/EMCAL/AliEMCALRawUtils.cxx b/EMCAL/AliEMCALRawUtils.cxx index edaf73a609e..57e55ad0468 100644 --- a/EMCAL/AliEMCALRawUtils.cxx +++ b/EMCAL/AliEMCALRawUtils.cxx @@ -49,7 +49,6 @@ class AliEMCALDigitizer; #include "AliEMCAL.h" #include "AliCaloCalibPedestal.h" #include "AliCaloFastAltroFitv0.h" -#include "AliCaloNeuralFit.h" ClassImp(AliEMCALRawUtils) @@ -79,7 +78,7 @@ AliEMCALRawUtils::AliEMCALRawUtils() fNoiseThreshold = 3; // 3 ADC counts is approx. noise level fNPedSamples = 4; // less than this value => likely pedestal samples fRemoveBadChannels = kTRUE; //Remove bad channels before fitting - fFittingAlgorithm = kFastFit;//kStandard; //kNeuralNet// Use default minuit fitter + fFittingAlgorithm = kFastFit;//kStandard; // Use default minuit fitter //Get Mapping RCU files from the AliEMCALRecParam const TObjArray* maps = AliEMCALRecParam::GetMappings(); @@ -554,7 +553,7 @@ void AliEMCALRawUtils::FitRaw(TGraph * gSig, TF1* signalF, const Int_t lastTimeB } } - // 1st step: we try to estimate the pedestal value + // 1st step: we try to estimate the pedestal value Int_t nPed = 0; for (Int_t index = 0; index < gSig->GetN(); index++) { gSig->GetPoint(index, ttime, signal) ; @@ -761,7 +760,7 @@ void AliEMCALRawUtils::FitRaw(TGraph * gSig, TF1* signalF, const Int_t lastTimeB case kFastFit: { //printf("FastFitter \n"); - Double_t eSignal = 1; // nominal 1 ADC error + Double_t eSignal = 0; Double_t dAmp = amp; Double_t eAmp = 0; Double_t dTime = time; @@ -774,59 +773,9 @@ void AliEMCALRawUtils::FitRaw(TGraph * gSig, TF1* signalF, const Int_t lastTimeB amp = dAmp; time = dTime * GetRawFormatTimeBinWidth(); //printf("FastFitter: Amp %f, time %g, eAmp %f, eTimeEstimate %g, chi2 %f\n",amp, time,eAmp,eTime,chi2); - break; - } //kFastFit - //---------------------------- - - case kNeuralNet: - { - // Extracts the amplitude and the time information using a Neural Network approach - // Author P. La Rocca - //printf("NeuralNet \n"); - Double_t input[5] = {0.}; - Double_t maxgraph = 0.; - Int_t maxindex = -10; - for (Int_t i=0; i < gSig->GetN(); i++) { - gSig->GetPoint(i, ttime, signal); - if(signal > maxgraph) { - maxgraph = signal; - maxindex = i; - } - } - if((maxindex-2) > -1 && (maxindex-2)< gSig->GetN()) { - gSig->GetPoint(maxindex-2, ttime, input[0]); - input[0] -= pedEstimate; - input[0] /= (globMaxSig - pedEstimate); - } - if((maxindex-1) > -1 && (maxindex-1)< gSig->GetN()) { - gSig->GetPoint(maxindex-1, ttime, input[1]); - input[1] -= pedEstimate; - input[1] /= (globMaxSig - pedEstimate); - } - if((maxindex) > -1 && (maxindex)< gSig->GetN()) { - gSig->GetPoint(maxindex, ttime, input[2]); - input[2] -= pedEstimate; - input[2] /= (globMaxSig - pedEstimate); - } - if((maxindex+1) > -1 && (maxindex+1)< gSig->GetN()) { - gSig->GetPoint(maxindex+1, ttime, input[3]); - input[3] -= pedEstimate; - input[3] /= (globMaxSig - pedEstimate); - } - if((maxindex+2) > -1 && (maxindex+2)< gSig->GetN()) { - gSig->GetPoint(maxindex+2, ttime, input[4]); - input[4] -= pedEstimate; - input[4] /= (globMaxSig - pedEstimate); - } - - AliCaloNeuralFit exportNN; - amp = exportNN.Value(0,input[0],input[1],input[2],input[3],input[4])*(globMaxSig - pedEstimate); - time = (exportNN.Value(1,input[0],input[1],input[2],input[3],input[4])+globMaxId) * fgTimeBins; - - - break; - } //kNeuralNet - //---------------------------- + break; + } //kFastFit + //---------------------------- }//switch fitting algorithms } // ampEstimate > fNoiseThreshold return; diff --git a/EMCAL/AliEMCALRawUtils.h b/EMCAL/AliEMCALRawUtils.h index 33d52523f7a..ef3cc2f744c 100644 --- a/EMCAL/AliEMCALRawUtils.h +++ b/EMCAL/AliEMCALRawUtils.h @@ -34,7 +34,7 @@ class AliEMCALRawUtils : public TObject { AliEMCALRawUtils(AliEMCALGeometry *pGeometry); virtual ~AliEMCALRawUtils(); - enum fitAlgorithm {kStandard = 0, kFastFit= 1, kNeuralNet = 2}; + enum fitAlgorithm {kStandard = 0, kFastFit= 1}; AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils); diff --git a/EMCAL/EMCALrecLinkDef.h b/EMCAL/EMCALrecLinkDef.h index e5ff0efc9c3..df34160e005 100644 --- a/EMCAL/EMCALrecLinkDef.h +++ b/EMCAL/EMCALrecLinkDef.h @@ -11,6 +11,5 @@ #pragma link C++ class AliEMCALPID+; #pragma link C++ class AliEMCALQADataMakerRec+; #pragma link C++ class AliEMCALAodCluster+; -#pragma link C++ class AliCaloNeuralFit+; #endif diff --git a/EMCAL/libEMCALrec.pkg b/EMCAL/libEMCALrec.pkg index e4312e7baca..35ae766be65 100644 --- a/EMCAL/libEMCALrec.pkg +++ b/EMCAL/libEMCALrec.pkg @@ -7,15 +7,7 @@ AliEMCALClusterizerv1.cxx \ AliEMCALTrack.cxx \ AliEMCALTracker.cxx \ AliEMCALPID.cxx \ -AliEMCALQADataMakerRec.cxx \ -AliEMCALAodCluster.cxx \ -AliCaloNeuralFit.cxx \ -AliCaloRawAnalyzer.cxx \ -AliCaloRawAnalyzerCrude.cxx \ -AliCaloRawAnalyzerLMS.cxx \ -AliCaloRawAnalyzerPeakFinder.cxx \ -AliCaloBunchInfo.cxx \ -AliCaloFitResults.cxx +AliEMCALQADataMakerRec.cxx AliEMCALAodCluster.cxx HDRS= $(SRCS:.cxx=.h) diff --git a/EVE/macros/visscan_init.C b/EVE/macros/visscan_init.C index 8ddabbdcd7b..fbd78758252 100644 --- a/EVE/macros/visscan_init.C +++ b/EVE/macros/visscan_init.C @@ -233,11 +233,6 @@ void visscan_init(const TString& cdburi = "", gEve->EditElement(g_trkcnt); gEve->Redraw3D(kTRUE); - - // Assure 3D view rotates around the origin. - gSystem->ProcessEvents(); - AliEveMultiView::Instance()->Get3DView()->GetGLViewer()->CurrentCamera().SetCenterVec(0,0,0); - AliEveMultiView::Instance()->Get3DView()->GetGLViewer()->RequestDraw(); } /******************************************************************************/ diff --git a/EVGEN/AliGenHalo.cxx b/EVGEN/AliGenHalo.cxx index 1789853515e..acaa53c8a4b 100644 --- a/EVGEN/AliGenHalo.cxx +++ b/EVGEN/AliGenHalo.cxx @@ -125,11 +125,6 @@ void AliGenHalo::Init() } else { printf("\n Opening of file %s failed, %p ! \n ", fFileName.Data(), (void*)fFile); } - - if (fNskip > 0) { - // Skip the first fNskip events - SkipEvents(); - } // // // @@ -257,22 +252,24 @@ void AliGenHalo::Generate() static Bool_t first = kTRUE; static Int_t oldID = -1; // - - if (first && (fNskip == 0)) ReadNextParticle(); - first = kFALSE; - oldID = fLossID; + if (first) { + ReadNextParticle(); + first = kFALSE; + oldID = fLossID; + } + + while(1) { // Push particle to stack mass = TDatabasePDG::Instance()->GetParticle(fPdg)->Mass(); - p0 = TMath::Sqrt(fEkin * fEkin + 2. * mass * fEkin); + p0 = TMath::Sqrt(fEkin * fEkin + 2.* mass * fEkin); txy = TMath::Sqrt(fDX * fDX + fDY * fDY); if (txy == 1.) { tz = 0; } else { tz = - TMath::Sqrt(1. - txy); } - p[0] = p0 * fDX; p[1] = p0 * fDY; p[2] = p0 * tz; @@ -281,8 +278,8 @@ void AliGenHalo::Generate() origin[1] = fYS; origin[2] = 1950.; - PushTrack(fTrackIt , -1, fPdg , p, origin, polar, fTS - 1950./2.9979e10, kPNoProcess, nt, fWS); - + PushTrack(fTrackIt , -1, fPdg , p, origin, polar, fTS, kPNoProcess, nt, fWS); + Int_t nc = ReadNextParticle(); if (fLossID != oldID || nc == 0) { @@ -364,20 +361,3 @@ Int_t AliGenHalo::ReadNextParticle() fTS *= 1.e-9; return (ncols); } - -void AliGenHalo::SkipEvents() -{ - // - // Skip the first fNskip events - Int_t skip = fNskip; - Int_t oldID = -1; - - while (skip >= 0) - { - ReadNextParticle(); - if (oldID != fLossID) { - oldID = fLossID; - skip--; - } - } -} diff --git a/EVGEN/AliGenHalo.h b/EVGEN/AliGenHalo.h index 72fbf3bcc24..b71e396a5cb 100644 --- a/EVGEN/AliGenHalo.h +++ b/EVGEN/AliGenHalo.h @@ -32,7 +32,6 @@ class AliGenHalo : public AliGenerator virtual void SetTimePerEvent(Float_t t = 1.e-4) {fTimePerEvent = t;} virtual void Draw(Option_t * opt=""); private: - virtual void SkipEvents(); virtual Int_t ReadNextParticle(); protected: FILE* fFile; // ! Pointer to file diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.cxx b/HLT/CALO/AliHLTCaloDecoderWrapper.cxx similarity index 61% rename from HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.cxx rename to HLT/CALO/AliHLTCaloDecoderWrapper.cxx index 7a9879df0fc..f178a38f1ef 100644 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.cxx +++ b/HLT/CALO/AliHLTCaloDecoderWrapper.cxx @@ -15,50 +15,52 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ +#include "AliHLTCaloDecoderWrapper.h" -#include "AliHLTEMCALRawAnalyzerLMSComponent.h" -#include "AliCaloRawAnalyzerLMS.h" -//Evaluation of Amplitude and Peak position using Least Mean Square (LMS) fit -//----------- -//----------- -//----------- -//----------- +/* +#include "AliAltroRawStreamV3.h" +#include "AliCaloRawStreamV3.h" +#include "AliRawReaderMemory.h" +*/ +#include "AliHLTDataTypes.h" -AliHLTEMCALRawAnalyzerLMSComponent gAliHLTEMCALRawAnalyzerLMSComponent; -AliHLTEMCALRawAnalyzerLMSComponent::AliHLTEMCALRawAnalyzerLMSComponent() : AliHLTEMCALRawAnalyzerComponent() +ClassImp(AliHLTCaloDecoderWrapper); + +AliHLTCaloDecoderWrapper::AliHLTCaloDecoderWrapper() : fAltroRawStream(0), + // fCaloRawStream(0), + fReaderMemory(0) { - // fAnalyzerPtr - fAnalyzerPtr = new AliCaloRawAnalyzerLMS(); + fReaderMemory = new AliRawReaderMemory(); } -AliHLTEMCALRawAnalyzerLMSComponent::~AliHLTEMCALRawAnalyzerLMSComponent() +AliHLTCaloDecoderWrapper::~AliHLTCaloDecoderWrapper() { - delete fAnalyzerPtr; -} +} -const char* -AliHLTEMCALRawAnalyzerLMSComponent::GetComponentID() +void +AliHLTCaloDecoderWrapper::SetMemory( AliHLTComponentBlockData *dtaptr ) { - return "EmcalRawLms"; + if ( fAltroRawStream != 0 ) + { + delete fAltroRawStream; + } + + fAltroRawStream = new AliCaloRawStreamV3( fReaderMemory, TString("PHOS")); + // fAltroRawStreamPtr = new AliAltroRawStreamV3( fReaderMemory, TString("PHOS")); + fReaderMemory->NextEvent(); + fAltroRawStream->NextDDL(); } -AliHLTComponent* -AliHLTEMCALRawAnalyzerLMSComponent::Spawn() -{ - return new AliHLTEMCALRawAnalyzerLMSComponent(); -} -int -AliHLTEMCALRawAnalyzerLMSComponent::Deinit() -{ - return 0; -} + + + diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.h b/HLT/CALO/AliHLTCaloDecoderWrapper.h similarity index 51% rename from HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.h rename to HLT/CALO/AliHLTCaloDecoderWrapper.h index 94e074f6429..d78da4d3be7 100644 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerLMSComponent.h +++ b/HLT/CALO/AliHLTCaloDecoderWrapper.h @@ -1,5 +1,5 @@ -#ifndef ALIHLTEMCALRAWANALYZERLMSCOMPONENT_H -#define ALIHLTEMCALRAWANALYZERLMSCOMPONENT_H +#ifndef ALIHLTCALODECODERWRAPPER_H +#define ALIHLTCALODECODERWRAPPER_H /************************************************************************** * This file is property of and copyright by the Experimental Nuclear * @@ -19,32 +19,41 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -//Evaluation of Amplitude and Peak position using Least Mean Square (LMS) fit -//----------- -//----------- -//----------- -//----------- +#include "Rtypes.h" -#include "AliHLTEMCALRawAnalyzerComponent.h" +/* +class AliAltroRawStreamV3; +class AliCaloRawStreamV3; +class AliRawReaderMemory; +*/ + +#include "AliAltroRawStreamV3.h" +#include "AliCaloRawStreamV3.h" +#include "AliRawReaderMemory.h" -class AliCaloRawAnalyzerLMS; +class AliHLTComponentBlockData; -// AliHLTEMCALRawAnalyzerLMSComponent.h: -class AliHLTEMCALRawAnalyzerLMSComponent : public AliHLTEMCALRawAnalyzerComponent -{ +class AliHLTCaloDecoderWrapper +{ public: - AliHLTEMCALRawAnalyzerLMSComponent(); - virtual ~AliHLTEMCALRawAnalyzerLMSComponent(); - virtual const char* GetComponentID() ; - virtual AliHLTComponent* Spawn(); - virtual int Deinit(); + AliHLTCaloDecoderWrapper(); + virtual ~AliHLTCaloDecoderWrapper(); + void SetMemory( AliHLTComponentBlockData *dtaptr ); + inline bool NextChannel ( ) { return fAltroRawStream->NextChannel(); }; + inline bool NextBunch ( ) { return fAltroRawStream->NextBunch(); }; + inline const UShort_t *GetSignals ( ) { return fAltroRawStream->GetSignals(); }; + inline Int_t GetHWAddress ( ) const { return fAltroRawStream->GetHWAddress();}; + inline Int_t GetBunchLength ( ) const { return fAltroRawStream->GetBunchLength(); }; + inline UInt_t GetStartTimeBin ( ) const { return fAltroRawStream->GetEndTimeBin(); }; + inline UInt_t GetEndTimeBin ( ) const { return fAltroRawStream->GetStartTimeBin(); }; private: - AliHLTEMCALRawAnalyzerLMSComponent ( const AliHLTEMCALRawAnalyzerLMSComponent &, TString det ); - AliHLTEMCALRawAnalyzerLMSComponent & operator = ( const AliHLTEMCALRawAnalyzerLMSComponent ); - // AliEMCALRawAnalyzerLMS *fRawAnalyzer; + AliAltroRawStreamV3 *fAltroRawStream; + // AliCaloRawStreamV3 *fCaloRawStream; + AliRawReaderMemory *fReaderMemory; + ClassDef(AliHLTCaloDecoderWrapper, 1); }; #endif diff --git a/HLT/CALO/AliHLTCaloLinkDef.h b/HLT/CALO/AliHLTCaloLinkDef.h index 293f3d02fb7..9ff5102e39a 100644 --- a/HLT/CALO/AliHLTCaloLinkDef.h +++ b/HLT/CALO/AliHLTCaloLinkDef.h @@ -15,7 +15,7 @@ //#pragma link C++ class AliHLTPHOSPulseGenerator+; #pragma link C++ class AliHLTCaloRawAnalyzerChiSquareFit+; #pragma link C++ class AliHLTCaloRawAnalyzerCrude+; -#pragma link C++ class AliHLTCaloRawAnalyzerComponentv3+; +//#pragma link C++ class AliHLTPHOSRawAnalyzerKLevel+; //#pragma link C++ class AliHLTPHOSRawAnalyzerLMS+; // #pragma link C++ class AliHLTPHOSRawAnalyzerPeakFinder+; // #pragma link C++ class AliHLTPHOSDigitMaker+; diff --git a/HLT/CALO/AliHLTCaloRawAnalyzer.cxx b/HLT/CALO/AliHLTCaloRawAnalyzer.cxx new file mode 100644 index 00000000000..e1fd4190751 --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzer.cxx @@ -0,0 +1,83 @@ +// $Id: AliHLTCALORawAnalyzer.cxx 34264 2009-08-14 18:29:23Z odjuvsla $ + +/************************************************************************** + * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Per Thomas Hille for the ALICE HLT 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. * + **************************************************************************/ + + +#include "AliHLTCaloRawAnalyzer.h" +#include "AliHLTCaloUtilities.h" + +AliHLTCaloRawAnalyzer:: AliHLTCaloRawAnalyzer():fDoCorrectBaselineUsingFirstFiveSamples(false), + fShortDataPtr(0), + fSampleFrequency(10), + fTau(2), + fDTof(99999), + fDAmpl(99999), + fUtilitiesPtr(0) + +{ + fUtilitiesPtr = new AliHLTCaloUtilities(); +} + + +AliHLTCaloRawAnalyzer::~AliHLTCaloRawAnalyzer() +{ + delete fUtilitiesPtr; +} + + +void +AliHLTCaloRawAnalyzer::SetCorrectBaselineUsingFirstFiveSamples() +{ + fDoCorrectBaselineUsingFirstFiveSamples = true; +} + + +void +AliHLTCaloRawAnalyzer::CorrectBaselineUsingFirstFiveSamples(UShort_t *data, const int length) +{ + UShort_t sumOfFirstFiveSamples = 0; + for(int i=0; i< 5; i++) + { + sumOfFirstFiveSamples += data[i]; + } + UShort_t valueToSubtract = sumOfFirstFiveSamples/5; + for(int j = 0; j < length; j++) + { + if( ( data[j] - valueToSubtract) > 0) + { + data[j] = data[j] - valueToSubtract; + } + else + { + data[j] = 0; + } + } +} + + +void +AliHLTCaloRawAnalyzer::SetData(const UShort_t *data, const int length) +{ + fShortDataPtr = const_cast(data); + if(fDoCorrectBaselineUsingFirstFiveSamples == true) + { + CorrectBaselineUsingFirstFiveSamples( fShortDataPtr, length ); + } + } + + + + diff --git a/HLT/CALO/AliHLTCaloRawAnalyzer.h b/HLT/CALO/AliHLTCaloRawAnalyzer.h new file mode 100644 index 00000000000..d1c5acc0681 --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzer.h @@ -0,0 +1,41 @@ +//-*- Mode: C++ -*- +#ifndef ALIHLTCALORAWANALYZER_H +#define ALIHLTCALORAWANALYZER_H +/* Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: AliHLTCALORawAnalyzer.h 34264 2009-08-14 18:29:23Z odjuvsla $ */ + +#include "Rtypes.h" +class AliHLTCaloUtilities; + +class AliHLTCaloRawAnalyzer +{ + public: + AliHLTCaloRawAnalyzer(); + virtual ~AliHLTCaloRawAnalyzer(); + void SetCorrectBaselineUsingFirstFiveSamples(); + void CorrectBaselineUsingFirstFiveSamples(UShort_t *data, const int length); + inline float GetTiming() const { return fDTof;}; + inline float GetEnergy() const { return fDAmpl;}; + void SetData(const UShort_t *data, const int length); + virtual void Evaluate(Int_t start = 0, Int_t lenght = 100) = 0; + + protected: + bool fDoCorrectBaselineUsingFirstFiveSamples; + UShort_t *fShortDataPtr; /** + +using std::cout; +using std::endl; + +ClassImp(AliHLTCaloRawAnalyzerChiSquareFit) + +AliHLTCaloRawAnalyzerChiSquareFit::AliHLTCaloRawAnalyzerChiSquareFit(const AliHLTCaloRawAnalyzerChiSquareFit&):AliHLTCaloRawAnalyzer() +{ + //comment +} + +AliHLTCaloRawAnalyzerChiSquareFit::AliHLTCaloRawAnalyzerChiSquareFit():AliHLTCaloRawAnalyzer() +{ + //comment +} + + +AliHLTCaloRawAnalyzerChiSquareFit::~AliHLTCaloRawAnalyzerChiSquareFit() +{ + +} //end AliHLTCaloRawAnalyzerChiSquareFit + + +void +AliHLTCaloRawAnalyzerChiSquareFit::Evaluate(int /*start*/, int /*length*/) +{ + /* + + */ + + //thats all for the moment +} //end FitChiSquareFit + + + + + diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerChiSquareFit.h b/HLT/CALO/AliHLTCaloRawAnalyzerChiSquareFit.h new file mode 100644 index 00000000000..4f25eb3d1ce --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerChiSquareFit.h @@ -0,0 +1,54 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTCALORawAnalyzerChiSquareFit.h 30036 2008-11-24 16:43:44Z odjuvsla $ + +#ifndef ALIHLTCALORAWANALYZERCHISQUAREFIT_H +#define ALIHLTCALORAWANALYZERCHISQUAREFIT_H +//#include +#include "TObject.h" +#include "AliHLTCaloRawAnalyzer.h" + +/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** + * The AliHLTCaloPeakfinder class is the class for extracting the basic signal parameters + * "timing" and "energy" from the CALO raw data. Physical data will for a given readout channel be + * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in + * calculation is of type double. + **/ + +class AliHLTCaloRawAnalyzerChiSquareFit : public AliHLTCaloRawAnalyzer +{ + public: + + AliHLTCaloRawAnalyzerChiSquareFit(); + AliHLTCaloRawAnalyzerChiSquareFit(const AliHLTCaloRawAnalyzerChiSquareFit & ); + + AliHLTCaloRawAnalyzerChiSquareFit & operator = (const AliHLTCaloRawAnalyzerChiSquareFit) + { + return *this; + } + + virtual ~AliHLTCaloRawAnalyzerChiSquareFit(); + + /** + * Extraction of timing and energy using Chi Square Fit. + * The. The parameters "start" and "length" defines a sub array of the data array + * that will be used for the the fit. If start+length must not exeed the total length + * of the Data array. "start" must be chosen as close as possible to t0. + * The baseline must also be subtracted. + * The length of "tVector" and "aVector" mus be equal to length. + * "index + length" must not exeed the length of the data array set in the constructor. + * @param start the start index of the subarray of the data array. + * @param length the number of samples to use starting from index + **/ + virtual void Evaluate(int start = 0, int length = 100); + + + private: + + ClassDef(AliHLTCaloRawAnalyzerChiSquareFit, 2) + +}; + +#endif diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.cxx b/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.cxx index 6c00c4a0636..d57cae94c5a 100644 --- a/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.cxx +++ b/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.cxx @@ -14,11 +14,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -//#include "AliHLTCaloRawAnalyzer.h" -#include "AliCaloRawAnalyzer.h" -#include "AliCaloBunchInfo.h" -#include "AliCaloFitResults.h" - +#include "AliHLTCaloRawAnalyzer.h" #include "AliHLTCaloRawAnalyzerComponentv3.h" #include "AliHLTCaloChannelDataHeaderStruct.h" #include "AliHLTCaloChannelDataStruct.h" @@ -32,19 +28,12 @@ #include "AliHLTCaloConstants.h" #include "AliHLTCaloRcuProcessor.h" - -//#include "AliCALOBunchInfo.h" -//AliCALORawAnalyzer - -#include -using namespace std; - ClassImp(AliHLTCaloRawAnalyzerComponentv3); AliHLTCaloRawAnalyzerComponentv3::AliHLTCaloRawAnalyzerComponentv3(TString det): AliHLTCaloConstantsHandler(det), AliHLTCaloRcuProcessor(), - // fCaloEventCount(0), + fCaloEventCount(0), fAnalyzerPtr(0), fMapperPtr(0), fkDoPushRawData(false), @@ -126,10 +115,14 @@ AliHLTCaloRawAnalyzerComponentv3::DoInit( int argc, const char** argv ) return -4; } */ + return iResult; } + + + int AliHLTCaloRawAnalyzerComponentv3::DoDeinit() { @@ -163,18 +156,16 @@ AliHLTCaloRawAnalyzerComponentv3::DoDeinit() } -/* const char* AliHLTCaloRawAnalyzerComponentv3::GetComponentID() { //comment return "CaloRawAnalyzerv3"; } -*/ - /* + void AliHLTCaloRawAnalyzerComponentv3::GetInputDataTypes( vector& list) { @@ -182,20 +173,16 @@ AliHLTCaloRawAnalyzerComponentv3::GetInputDataTypes( vector bvctr; + while( fAltroRawStreamPtr->NextBunch() == true ) { - bvctr.push_back( AliCaloBunchInfo( fAltroRawStreamPtr->GetStartTimeBin(), fAltroRawStreamPtr->GetBunchLength(), fAltroRawStreamPtr->GetSignals() ) ); - nSamples = fAltroRawStreamPtr->GetBunchLength(); if( fkDoPushRawData == true) { @@ -294,16 +279,20 @@ AliHLTCaloRawAnalyzerComponentv3::DoIt(const AliHLTComponentBlockData* iter, Ali return -1; } - // fAnalyzerPtr->SetData( firstBunchPtr, nSamples); - AliCaloFitResults res = fAnalyzerPtr->Evaluate( bvctr, fAltroRawStreamPtr->GetAltroCFG1(), fAltroRawStreamPtr->GetAltroCFG2() ); - + fAnalyzerPtr->SetData( firstBunchPtr, nSamples); + + fAnalyzerPtr->Evaluate(0, nSamples); + // fAnalyzerPtr->Evaluate(0, 25); + + // return 1; + // if(fAnalyzerPtr->GetTiming() > fMinPeakPosition && fAnalyzerPtr->GetTiming() < fMaxPeakPosition) { channelDataPtr->fChannelID = chId; - channelDataPtr->fEnergy = static_cast( res.GetAmp() ) - fOffset; + channelDataPtr->fEnergy = static_cast(fAnalyzerPtr->GetEnergy()) - fOffset; - channelDataPtr->fTime = static_cast( res.GetTof() ); + channelDataPtr->fTime = static_cast(fAnalyzerPtr->GetTiming()); channelDataPtr->fCrazyness = static_cast(crazyness); channelCount++; channelDataPtr++; // Updating position of the free output. diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.h b/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.h index b44ac6b0082..5d20ca086b1 100644 --- a/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.h +++ b/HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.h @@ -37,7 +37,7 @@ //#include "AliHLTCaloRcuProcessor.h" -class AliCaloRawAnalyzer; +class AliHLTCaloRawAnalyzer; class AliHLTCaloRcuCellEnergyDataStruct; class AliHLTCaloMapper; class AliHLTCaloSanityInspector; @@ -46,7 +46,6 @@ class AliHLTCaloDigitContainerDataStruct; class AliRawReaderMemory; class AliAltroRawStreamV3; - /** * @class AliHLTCaloRawAnalyzerComponentv3 * This the new and fast version of the component taking care of the decoding and energy and timing @@ -126,17 +125,13 @@ class AliHLTCaloRawAnalyzerComponentv3 : public AliHLTCaloConstantsHandler, publ virtual const char* GetComponentID() = 0; /** interface function, see @ref AliHLTComponent for description */ - // virtual void GetInputDataTypes( vector & list); - virtual void GetInputDataTypes( vector & list) = 0; - + virtual void GetInputDataTypes( vector & list); /** interface function, see @ref AliHLTComponent for description */ - // virtual AliHLTComponentDataType GetOutputDataType(); - virtual AliHLTComponentDataType GetOutputDataType() = 0; + virtual AliHLTComponentDataType GetOutputDataType(); /** interface function, see @ref AliHLTComponent for description */ - // virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); - virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) = 0 ; + virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); /** interface function, see @ref AliHLTComponent for description */ virtual AliHLTComponent* Spawn() = 0; @@ -163,10 +158,10 @@ class AliHLTCaloRawAnalyzerComponentv3 : public AliHLTCaloConstantsHandler, publ */ virtual Int_t DoIt(const AliHLTComponentBlockData* iter, AliHLTUInt8_t* outputPtr, const AliHLTUInt32_t size, UInt_t& totSize); - // unsigned long fCaloEventCount; + unsigned long fCaloEventCount; /** Pointer to an analyzer object used for raw data anlysis */ - AliCaloRawAnalyzer *fAnalyzerPtr; //COMMENT + AliHLTCaloRawAnalyzer *fAnalyzerPtr; //COMMENT //** Pointer to a mapper opbject */ AliHLTCaloMapper *fMapperPtr; //COMMENT diff --git a/EMCAL/AliCaloRawAnalyzerCrude.h b/HLT/CALO/AliHLTCaloRawAnalyzerCrude.cxx similarity index 53% rename from EMCAL/AliCaloRawAnalyzerCrude.h rename to HLT/CALO/AliHLTCaloRawAnalyzerCrude.cxx index b55ec9e06b0..8cd66c7146e 100644 --- a/EMCAL/AliCaloRawAnalyzerCrude.h +++ b/HLT/CALO/AliHLTCaloRawAnalyzerCrude.cxx @@ -1,14 +1,10 @@ -#ifndef ALICALORAWANALYZERCRUDE_H -#define ALICALORAWANALYZERCRUDE_H +// $Id: AliHLTCALORawAnalyzerCrude.cxx 34622 2009-09-04 13:22:01Z odjuvsla $ /************************************************************************** - * This file is property of and copyright by the Experimental Nuclear * - * Physics Group, Dep. of Physics * - * University of Oslo, Norway, 2007 * + * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * * * - * Author: Per Thomas Hille for the ALICE HLT Project.* + * Author: Per Thomas Hille for the ALICE HLT Project. * * Contributors are mentioned in the code where appropriate. * - * Please report bugs to perthi@fys.uio.no * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * @@ -19,20 +15,40 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -#include "AliCaloRawAnalyzer.h" +#include "AliHLTCaloRawAnalyzerCrude.h" -class AliCaloFitResults; -class AliCaloBunchInfo; +#include +using namespace std; -class AliCaloRawAnalyzerCrude : public AliCaloRawAnalyzer +ClassImp(AliHLTCaloRawAnalyzerCrude); + +AliHLTCaloRawAnalyzerCrude::AliHLTCaloRawAnalyzerCrude():AliHLTCaloRawAnalyzer() +{ + +} + + +AliHLTCaloRawAnalyzerCrude::~AliHLTCaloRawAnalyzerCrude() { - public: - virtual AliCaloFitResults Evaluate( const vector &bunchvector, - const UInt_t altrocfg1, const UInt_t altrocfg2 ); - AliCaloRawAnalyzerCrude(); - virtual ~AliCaloRawAnalyzerCrude(); -}; +} //end AliHLTCaloRawAnalyzerCrude + + +void +AliHLTCaloRawAnalyzerCrude::Evaluate(int start, int length) +{ + fDAmpl =0; + fDTof = 0; + int i=0; + + for(i=start; i fDAmpl ) + { + fDAmpl = fShortDataPtr[i]; + fDTof = i; + } + } +} //end Crude -#endif diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerCrude.h b/HLT/CALO/AliHLTCaloRawAnalyzerCrude.h new file mode 100644 index 00000000000..d201ba34075 --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerCrude.h @@ -0,0 +1,27 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTCaloRawAnalyzerCrude.h 34264 2009-08-14 18:29:23Z odjuvsla $ + +#ifndef ALIHLTCALORAWANALYZERCRUDE_H +#define ALIHLTCALORAWANALYZERCRUDE_H +#include "AliHLTCaloRawAnalyzer.h" + + +/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +class AliHLTCaloRawAnalyzerCrude : public AliHLTCaloRawAnalyzer +{ + + public: + AliHLTCaloRawAnalyzerCrude(); + virtual ~AliHLTCaloRawAnalyzerCrude(); + virtual void Evaluate(int start = 0, int lenght = 100); + +private: + + ClassDef(AliHLTCaloRawAnalyzerCrude, 1); + +}; + +#endif diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerCrudeComponent.cxx b/HLT/CALO/AliHLTCaloRawAnalyzerCrudeComponent.cxx new file mode 100644 index 00000000000..643fd56f982 --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerCrudeComponent.cxx @@ -0,0 +1,77 @@ +// $Id: AliHLTCaloRawAnalyzerCrudeComponent.cxx 29824 2008-11-10 13:43:55Z richterm $ + + +/************************************************************************** + * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Per Thomas Hille for the ALICE HLT 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. * + **************************************************************************/ + + +#include "AliHLTCaloRawAnalyzerCrudeComponent.h" +#include "AliHLTCaloRawAnalyzerCrude.h" + +ClassImp(AliHLTCaloRawAnalyzerCrudeComponent); + +//___________________________________________________________________________ +AliHLTCaloRawAnalyzerCrudeComponent::AliHLTCaloRawAnalyzerCrudeComponent(TString det) : +AliHLTCaloRawAnalyzerComponentv3(det) +{ + fAnalyzerPtr = new AliHLTCaloRawAnalyzerCrude(); +} + +//___________________________________________________________________________ +AliHLTCaloRawAnalyzerCrudeComponent::~AliHLTCaloRawAnalyzerCrudeComponent() +{ + if(fAnalyzerPtr) + { + delete fAnalyzerPtr; + fAnalyzerPtr = 0; + } +} + +//___________________________________________________________________________ +AliHLTCaloRawAnalyzerCrudeComponent::AliHLTCaloRawAnalyzerCrudeComponent(const AliHLTCaloRawAnalyzerCrudeComponent &, TString det ): +AliHLTCaloRawAnalyzerComponentv3(det) +{ + +} + +int +AliHLTCaloRawAnalyzerCrudeComponent::Deinit() +{ + + if(fAnalyzerPtr) + { + delete fAnalyzerPtr; + fAnalyzerPtr = 0; + } + Logging(kHLTLogInfo, "HLT", "Calo", ",AliHLTCaloRawAnalyzerCrudeComponent Deinit"); + return 0; +} + +//___________________________________________________________________________ +const char* +AliHLTCaloRawAnalyzerCrudeComponent::GetComponentID() +{ + return "CaloRawCrude"; +} + +//___________________________________________________________________________ + +/* +AliHLTComponent* +AliHLTCaloRawAnalyzerCrudeComponent::Spawn() +{ + return new AliHLTCaloRawAnalyzerCrudeComponent; +} +*/ diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerCrudeComponent.h b/HLT/CALO/AliHLTCaloRawAnalyzerCrudeComponent.h new file mode 100644 index 00000000000..3168e02293c --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerCrudeComponent.h @@ -0,0 +1,35 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTPHOSRawAnalyzerCrudeComponent.h 29824 2008-11-10 13:43:55Z richterm $ + +#ifndef ALIHLTCALORAWANALYZERCRUDECOMPONENT_H +#define ALIHLTCALORAWANALYZERCRUDECOMPONENT_H + +#include "AliHLTCaloRawAnalyzerComponentv3.h" + +/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + + +class AliHLTCaloRawAnalyzerCrudeComponent: public AliHLTCaloRawAnalyzerComponentv3 +{ + public: + AliHLTCaloRawAnalyzerCrudeComponent(TString det); + virtual ~AliHLTCaloRawAnalyzerCrudeComponent(); + AliHLTCaloRawAnalyzerCrudeComponent(const AliHLTCaloRawAnalyzerCrudeComponent &, TString det ); + // AliHLTCaloRawAnalyzerCrudeComponent & operator = (const AliHLTCaloRawAnalyzerCrudeComponent) + // { + // return *this; + // }; + + virtual int Deinit(); + virtual const char* GetComponentID(); + virtual AliHLTComponent* Spawn() = 0; + +private: + AliHLTCaloRawAnalyzerCrudeComponent(); + + ClassDef(AliHLTCaloRawAnalyzerCrudeComponent, 1); +}; + +#endif diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinder.cxx b/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinder.cxx new file mode 100644 index 00000000000..2d2288062af --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinder.cxx @@ -0,0 +1,157 @@ +// $Id: AliHLTCALORawAnalyzerPeakFinder.cxx 29824 2008-11-10 13:43:55Z richterm $ + +/************************************************************************** + * This file is property of and copyright by the Experimental Nuclear * + * Physics Group, Dep. of Physics * + * University of Oslo, Norway, 2007 * + * * + * Author: Per Thomas Hille for the ALICE HLT Project.* + * Contributors are mentioned in the code where appropriate. * + * Please report bugs to perthi@fys.uio.no * + * * + * 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. * + **************************************************************************/ + + + + +#include "AliHLTCaloRawAnalyzerPeakFinder.h" +//#include +#include +#include "AliHLTCaloUtilities.h" + +using std::cout; +using std::endl; + +ClassImp(AliHLTCaloRawAnalyzerPeakFinder) + + + +/** + * The AliHLTCaloRawAnalyzerPeakfinder class is the class for extracting the basic signal parameters + * "timing" and "energy" from the Calorimeter's raw data. Physical data will for a given readout channel be + * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in + * calculation is of type double. + **/ + +AliHLTCaloRawAnalyzerPeakFinder::AliHLTCaloRawAnalyzerPeakFinder():AliHLTCaloRawAnalyzer(), + fTVectorPtr(0), + fAVectorPtr(0), + fTVectorSize(0), + fAVectorSize(0) +// fUtilitiesPtr(0) +{ + // fUtilitiesPtr = new AliHLTCaloUtilities(); + // cout <<"PeakFinder:You cannot invoke the Fitter without arguments"< 900) + { + // Double_t tmpMax = MaxValue(const_cast(fIntDataPtr), tmpLength); removed 18 april 2008 + double tmpMax = fUtilitiesPtr->MaxValue(fShortDataPtr, tmpLength); + + if(tmpMax == 1023) + { + fDAmpl = tmpMax; + } + } + + fDTof = fDTof/fDAmpl; + + } +} //end Evaluate + + + + diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinder.h b/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinder.h new file mode 100644 index 00000000000..1d4d5b37d9c --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinder.h @@ -0,0 +1,86 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTCALORawAnalyzerPeakFinder.h 29824 2008-11-10 13:43:55Z richterm $ + +#ifndef ALIHLTCALORAWANALYZERPEAKFINDER_H +#define ALIHLTCALORAWANALYZERPEAKFINDER_H +/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//#include +//#include "TObject.h" +#include "AliHLTCaloRawAnalyzer.h" +//#include "AliHLTCaloBase.h" +//class AliHLTCaloUtilities; + +class AliHLTCaloRawAnalyzerPeakFinder : public AliHLTCaloRawAnalyzer +{ + public: + AliHLTCaloRawAnalyzerPeakFinder(); + // AliHLTCaloRawAnalyzerPeakFinder(const AliHLTCaloRawAnalyzerPeakFinder & ); + // AliHLTCaloRawAnalyzerPeakFinder & operator = (const AliHLTCaloRawAnalyzerPeakFinder &) + // { + // return *this; + // } + + virtual ~AliHLTCaloRawAnalyzerPeakFinder(); + + +/** +* Extraction of timing and energy using the Peakfinde Algorithm. +* The. The parameters "start" and "length" defines a sub array of the data array +* that will be used for the the fit. If start+length must not exeed the total length +* of the Data array. "start" must be chosen as close as possible to t0. +* The baseline must also be subtracted. +* The length of "tVector" and "aVector" mus be equal to length. +* "index + length" must not exeed the length of the data array set in the constructor. +* @param tVectPtr the peakfinder vector for timing +* @param size size in number of values of the time vector +*/ +// virtual void SetTVector(Double_t *tVectPtr =0, Int_t size = 0); + void SetTVector(Double_t *tVectPtr =0, Int_t size = 0); + + +/** +* Extraction of timing and energy using the Peakfinde Algorithm. +* The. The parameters "start" and "length" defines a sub array of the data array +* that will be used for the the fit. If start+length must not exeed the total length +* of the Data array. "start" must be chosen as close as possible to t0. +* The baseline must also be subtracted. +* The length of "tVector" and "aVector" mus be equal to length. +* "index + length" must not exeed the length of the data array set in the constructor. +* @param aVectPtr the peakfinder vector for timing +* @param size size in number of values of the time vector +*/ +// virtual void SetAVector(Double_t *aVectPtr =0, Int_t size =0); + void SetAVector(Double_t *aVectPtr =0, Int_t size =0); + +/** +* Extraction of timing and energy using the Peakfinde Algorithm. +* The. The parameters "start" and "length" defines a sub array of the data array +* that will be used for the the fit. If start+length must not exeed the total length +* of the Data array. "start" must be chosen as close as possible to t0. +* The baseline must also be subtracted. +* The length of "tVector" and "aVector" mus be equal to length. +* "index + length" must not exeed the length of the data array set in the constructor. +* @param start the start index of the subarray of the data array. +* @param length the number of samples to use starting from index +**/ + virtual void Evaluate(Int_t start = 0, Int_t length = 100); + + private: + AliHLTCaloRawAnalyzerPeakFinder(const AliHLTCaloRawAnalyzerPeakFinder & ); + AliHLTCaloRawAnalyzerPeakFinder & operator = (const AliHLTCaloRawAnalyzerPeakFinder &); + + Double_t *fTVectorPtr; //[1008] /**SetAVector(tmpAVector, nSamples); + fAnalyzerPtr->SetTVector(tmpTVector, nSamples); + fclose(fp); + delete [] tmpAVector; + delete [] tmpTVector; + return kTRUE; + } + + else + { + delete [] tmpAVector; + delete [] tmpTVector; + HLTFatal("ERROR: could not open PF vector file"); + return kFALSE; + } +} + */ + + +//___________________________________________________________________________________________________________ + +/* +AliHLTComponent* +AliHLTCaloRawAnalyzerPeakFinderComponent::Spawn() +{ + return new AliHLTCaloRawAnalyzerPeakFinderComponent; +} +*/ diff --git a/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinderComponent.h b/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinderComponent.h new file mode 100644 index 00000000000..6d573945faa --- /dev/null +++ b/HLT/CALO/AliHLTCaloRawAnalyzerPeakFinderComponent.h @@ -0,0 +1,50 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTPHOSRawAnalyzerPeakFinderComponent.h 29824 2008-11-10 13:43:55Z richterm $ + +#ifndef ALIHLTCALORAWANALYZERPEAKFINDERCOMPONENT_H +#define ALIHLTCALORAWANALYZERPEAKFINDERCOMPONENT_H + +/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + + +#include "AliHLTCaloRawAnalyzerComponentv3.h" + +class AliHLTCaloRawAnalyzerPeakFinderComponent: public AliHLTCaloRawAnalyzerComponentv3 +{ + public: + AliHLTCaloRawAnalyzerPeakFinderComponent(TString det); + virtual ~AliHLTCaloRawAnalyzerPeakFinderComponent(); + + virtual int Deinit(); + virtual const char* GetComponentID() = 0; + virtual AliHLTComponent* Spawn() = 0; + private: + // Bool_t LoadPFVector(); + // Bool_t LoadPFVector(int startindex, int Nsamples, int tau, int fs); + + // virtual const Bool_t LoadPFVector() = 0; + // virtual const Bool_t LoadPFVector(const int startindex, const int Nsamples, const int tau, const int fs) = 0; + + virtual Bool_t LoadPFVector() { return true; }; + virtual Bool_t LoadPFVector(const int /*startindex*/, const int /*Nsamples*/, const int /*tau*/, const int /*fs*/) { return true; }; + + AliHLTCaloRawAnalyzerPeakFinderComponent(const AliHLTCaloRawAnalyzerPeakFinderComponent &, TString det ); + + /* + AliHLTCaloRawAnalyzerPeakFinderComponent & operator = (const AliHLTCaloRawAnalyzerPeakFinderComponent) + { + return *this; + }; + */ + +private: + AliHLTCaloRawAnalyzerPeakFinderComponent(); + + ClassDef(AliHLTCaloRawAnalyzerPeakFinderComponent, 1); +}; + + + +#endif diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx b/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx index fb84eb88c69..1f86dc6ed44 100644 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx +++ b/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.cxx @@ -16,28 +16,17 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -// Base class fro anlyzing EMCAL raww data -// Further documentation found in base class -// -------------- -// -------------- -// -------------- -// -------------- - #include "AliHLTEMCALRawAnalyzerComponent.h" #include "AliHLTEMCALMapper.h" #include "AliHLTEMCALDefinitions.h" #include "AliHLTCaloChannelDataHeaderStruct.h" -//#include "unistd.h" - -//#include "TStopwatch.h" -//TStopwatch fgWatch; //CRAP PTH - -AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent() : AliHLTCaloRawAnalyzerComponentv3("EMCAL") +AliHLTEMCALRawAnalyzerComponent::AliHLTEMCALRawAnalyzerComponent() : +AliHLTCaloRawAnalyzerComponentv3("EMCAL") { - + } @@ -77,14 +66,12 @@ AliHLTEMCALRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, dou void AliHLTEMCALRawAnalyzerComponent::DoInit() { - // fgWatch.Start(); - + } bool AliHLTEMCALRawAnalyzerComponent::CheckInputDataType(const AliHLTComponentDataType &datatype) { - // Cheking if datatype is the correct one before processing if ( datatype == AliHLTEMCALDefinitions::fgkDDLRawDataType ) { return true; @@ -96,10 +83,12 @@ AliHLTEMCALRawAnalyzerComponent::CheckInputDataType(const AliHLTComponentDataTyp } + + void AliHLTEMCALRawAnalyzerComponent::InitMapping( const int specification ) { - //------------- + if ( fMapperPtr == 0 ) { fMapperPtr = new AliHLTEMCALMapper( specification ); @@ -112,33 +101,21 @@ AliHLTEMCALRawAnalyzerComponent::InitMapping( const int specification ) } } - int AliHLTEMCALRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector& outputBlocks ) { - //----------------------- - static int evntcnt = 0; - static double wlast = -1; - static double wcurrent = 0; - evntcnt ++; - /* - if( evntcnt %100 == 0 ) + + if( fPhosEventCount%300 == 0 ) { - - cout << __FILE__ << __LINE__ << " : Processing event " << evntcnt << endl; - wlast = wcurrent; - wcurrent = fgWatch.RealTime(); - cout << wlast << ":" << wcurrent << endl; - cout << __FILE__ << __LINE__ << "The event rate is " << 100/( wcurrent - wlast ) << " Hz" << endl; - fgWatch.Start(kFALSE); - // wlast = fgWatch.RealTime(); + cout << __FILE__<<__LINE__<< " Processing event " << fPhosEventCount << endl; } */ - + // Int_t blockSize = 0; + Int_t blockSize = -1; UInt_t totSize = 0; const AliHLTComponentBlockData* iter = NULL; @@ -154,8 +131,11 @@ AliHLTEMCALRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtDat else { InitMapping( iter->fSpecification); + blockSize = DoIt(iter, outputPtr, size, totSize); // Processing the block + // blockSize = 1; + if(blockSize == -1) // If the processing returns -1 we are out of buffer and return an error msg. { return -ENOBUFS; diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.h b/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.h index c6940b37cbc..731bea25e41 100644 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.h +++ b/HLT/EMCAL/AliHLTEMCALRawAnalyzerComponent.h @@ -19,12 +19,6 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -// Base class fro anlyzing EMCAL raww data -// Further documentation found in base class -// -------------- -// -------------- - - #include "AliHLTCaloRawAnalyzerComponentv3.h" //class AliHLTCaloMapper; diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.cxx b/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.cxx index 77ebfaff1cf..517754a99e3 100644 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.cxx +++ b/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.cxx @@ -15,29 +15,14 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - - -// Evaluation of amplitude using just the -// max ADC walu - pedestal, and pek position -// using the time index of the max -// amplitude -// ------------ -// ------------ - - #include "AliHLTEMCALRawAnalyzerCrudeComponent.h" -//#include "AliHLTCaloRawAnalyzerCrude.h" -#include "AliCaloRawAnalyzerCrude.h" - +#include "AliHLTCaloRawAnalyzerCrude.h" AliHLTEMCALRawAnalyzerCrudeComponent gAliHLTEMCALRawAnalyzerCrudeComponent; - -//AliHLTEMCALRawAnalyzerCrudeComponent::AliHLTEMCALRawAnalyzerCrudeComponent : AliHLTEMCALRawAnalyzerComponent() -AliHLTEMCALRawAnalyzerCrudeComponent::AliHLTEMCALRawAnalyzerCrudeComponent() : AliHLTEMCALRawAnalyzerComponent() +AliHLTEMCALRawAnalyzerCrudeComponent::AliHLTEMCALRawAnalyzerCrudeComponent() { - // fAnalyzerPtr = new AliHLTCaloRawAnalyzerCrude(); - fAnalyzerPtr = new AliCaloRawAnalyzerCrude(); + fAnalyzerPtr = new AliHLTCaloRawAnalyzerCrude(); } @@ -50,7 +35,7 @@ AliHLTEMCALRawAnalyzerCrudeComponent::~AliHLTEMCALRawAnalyzerCrudeComponent() const char* AliHLTEMCALRawAnalyzerCrudeComponent::GetComponentID() { - return "EmcalRawCrude"; + return "CaloRawCrude"; } diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.h b/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.h index c160af999a4..108e252b574 100644 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.h +++ b/HLT/EMCAL/AliHLTEMCALRawAnalyzerCrudeComponent.h @@ -18,18 +18,10 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -// Evaluation of amplitude using just the -// max ADC walu - pedestal, and pek position -// using the time index of the max -// amplitude - #include "AliHLTEMCALRawAnalyzerComponent.h" -//AliHLTCALORawAnalyzerCrudeComponent - class AliHLTEMCALRawAnalyzerCrudeComponent : public AliHLTEMCALRawAnalyzerComponent -//class AliHLTEMCALRawAnalyzerCrudeComponent : public AliHLTCALORawAnalyzerComponent { public: AliHLTEMCALRawAnalyzerCrudeComponent(); @@ -40,8 +32,9 @@ class AliHLTEMCALRawAnalyzerCrudeComponent : public AliHLTEMCALRawAnalyzerCompo private: AliHLTEMCALRawAnalyzerCrudeComponent( const AliHLTEMCALRawAnalyzerCrudeComponent & ); AliHLTEMCALRawAnalyzerCrudeComponent & operator = (const AliHLTEMCALRawAnalyzerCrudeComponent &); + // bool TestBoolConst() { return false; }; - // bool TestBool() {return false; }; + bool TestBool() {return false; }; diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.cxx b/HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.cxx deleted file mode 100644 index 64d930a1908..00000000000 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.cxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************** - * This file is property of and copyright by the Experimental Nuclear * - * Physics Group, Dep. of Physics * - * University of Oslo, Norway, 2007 * - * * - * Author: Per Thomas Hille for the ALICE HLT Project.* - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to perthi@fys.uio.no * - * * - * 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. * - **************************************************************************/ - -// Evaluation of amplitude and peak -// position using statisticall optimal -// weight of the samples -// --------------- -// --------------- - - -#include "AliHLTEMCALRawAnalyzerPeakFinderComponent.h" -#include "AliCaloRawAnalyzerPeakFinder.h" - - -AliHLTEMCALRawAnalyzerPeakFinderComponent gAliHLTEMCALRawAnalyzerPeakFinderComponent; - - -AliHLTEMCALRawAnalyzerPeakFinderComponent::AliHLTEMCALRawAnalyzerPeakFinderComponent (): AliHLTEMCALRawAnalyzerComponent() -{ - fAnalyzerPtr = new AliCaloRawAnalyzerPeakFinder(); -} - - -AliHLTEMCALRawAnalyzerPeakFinderComponent::~AliHLTEMCALRawAnalyzerPeakFinderComponent() -{ - -} - - -const char* -AliHLTEMCALRawAnalyzerPeakFinderComponent::GetComponentID() -{ - return "EmcalRawPeakFinder"; -} - - -AliHLTComponent* -AliHLTEMCALRawAnalyzerPeakFinderComponent::Spawn() -{ - return new AliHLTEMCALRawAnalyzerPeakFinderComponent(); -} - diff --git a/HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.h b/HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.h deleted file mode 100644 index bf372e0868a..00000000000 --- a/HLT/EMCAL/AliHLTEMCALRawAnalyzerPeakFinderComponent.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef ALIHLTEMCALRAWANALYZERPEAKFINDERCOMPONENT_H -#define ALIHLTEMCALRAWANALYZERPEAKFINDERCOMPONENT_H - -/************************************************************************** - * This file is property of and copyright by the Experimental Nuclear * - * Physics Group, Dep. of Physics * - * University of Oslo, Norway, 2007 * - * * - * Author: Per Thomas Hille for the ALICE HLT Project.* - * Contributors are mentioned in the code where appropriate. * - * Please report bugs to perthi@fys.uio.no * - * * - * 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. * - **************************************************************************/ - -// Evaluation of amplitude and peak -// position using statisticall optimal -// weight of the samples - -#include "AliHLTEMCALRawAnalyzerComponent.h" - - -class AliHLTEMCALRawAnalyzerPeakFinderComponent : public AliHLTEMCALRawAnalyzerComponent -{ - public: - AliHLTEMCALRawAnalyzerPeakFinderComponent(); - virtual ~AliHLTEMCALRawAnalyzerPeakFinderComponent(); - virtual const char* GetComponentID(); - virtual AliHLTComponent* Spawn(); - private: - AliHLTEMCALRawAnalyzerPeakFinderComponent( const AliHLTEMCALRawAnalyzerPeakFinderComponent & ); - AliHLTEMCALRawAnalyzerPeakFinderComponent & operator = (const AliHLTEMCALRawAnalyzerPeakFinderComponent &); -}; - -#endif diff --git a/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx b/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx index 0b6586d7f41..0b946ce81d9 100644 --- a/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx +++ b/HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx @@ -42,10 +42,7 @@ #include "AliHLTOUTHandlerChain.h" #include "AliRawReader.h" #include "AliRunLoader.h" -#include "AliRun.h" -#include "AliMUON.h" #include "TSystem.h" -#include "TObjArray.h" #include "TString.h" // The single global instance of the dimuon HLT agent. @@ -53,43 +50,11 @@ AliHLTMUONAgent AliHLTMUONAgent::fgkInstance; AliHLTOUTHandlerChain AliHLTMUONAgent::fgkESDMakerChain("libAliHLTMUON.so chains=dHLT-make-esd"); AliHLTOUTHandlerChain AliHLTMUONAgent::fgkRootifyDumpChain("libAliHLTMUON.so chains=dHLT-rootify-and-dump"); -Int_t AliHLTMUONAgent::fgMuonModuleLoaded = 0; ClassImp(AliHLTMUONAgent); -bool AliHLTMUONAgent::IsMuonModuleLoaded() -{ - // Checks to see if the MUON module is loaded or not. - - // If the check was already done then use the cached value. - if (fgMuonModuleLoaded > 0) return true; - if (fgMuonModuleLoaded < 0) return false; - - bool haveMuonModule = false; - if (gAlice != NULL) - { - // Search for a module in gAlice deriving from AliMUON. - TIter next(gAlice->Modules()); - TObject* mod = NULL; - while ((mod = next()) != NULL) - { - if (mod->IsA() == AliMUON::Class()) - { - fgMuonModuleLoaded = 1; - return true; - } - } - } - else - { - fgMuonModuleLoaded = -1; - return false; - } -} - - AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent("MUON") { /// @@ -145,10 +110,7 @@ const char* AliHLTMUONAgent::GetReconstructionChains(AliRawReader* rawReader, if (runloader != NULL) { - // IsMuonModuleLoaded() is used to check if the muon module was loaded - // If there is no AliMUON module in the simulation then do not run the - // MUON HLT chain. - if (IsMuonModuleLoaded() and runloader->GetLoader("MUONLoader") != NULL) + if (runloader->GetLoader("MUONLoader") != NULL) return "dHLT-sim"; } @@ -354,7 +316,7 @@ int AliHLTMUONAgent::CreateConfigurations( handler->CreateConfiguration("dHLT-sim-fromRaw-fullTracker", "BlockFilter", outputSrcsFull, ""); } - if (IsMuonModuleLoaded() and runloader != NULL) + if (runloader != NULL) { // Implement the dHLT-sim dHLT simulation chain reading from // simulated digits. diff --git a/HLT/MUON/OfflineInterface/AliHLTMUONAgent.h b/HLT/MUON/OfflineInterface/AliHLTMUONAgent.h index 6c473006e58..8b699eb116d 100644 --- a/HLT/MUON/OfflineInterface/AliHLTMUONAgent.h +++ b/HLT/MUON/OfflineInterface/AliHLTMUONAgent.h @@ -91,11 +91,6 @@ class AliHLTMUONAgent : public AliHLTModuleAgent * @param pInstance pointer to handler */ virtual int DeleteOutputHandler(AliHLTOUTHandler* pInstance); - - /** - * \returns true if a MUON module was added to gAlice. - */ - static bool IsMuonModuleLoaded(); private: // The following instance is used for automatic agent and component registration. @@ -104,8 +99,6 @@ class AliHLTMUONAgent : public AliHLTModuleAgent static AliHLTOUTHandlerChain fgkESDMakerChain; ///< Chain handler for converting dHLT raw data to ESD format. static AliHLTOUTHandlerChain fgkRootifyDumpChain; ///< Chain handler for converting dHLT raw data to ROOT objects and dumping to file. - static Int_t fgMuonModuleLoaded; ///< Cached flag for indicating if the MUON module was loaded for a simulation. - ClassDef(AliHLTMUONAgent, 0); // Dimuon HLT module agent which handles processing configurations. }; diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.cxx index 4c8e274088f..3e318cf8009 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.cxx @@ -34,44 +34,6 @@ #include "AliHLTMUONFullTracker.h" -#include - -#include "TMap.h" -#include "TString.h" -#include "TVector3.h" -#include "TMath.h" -#include "TGeoGlobalMagField.h" - -#include "AliMagF.h" -#include "AliCDBManager.h" -#include "AliGeomManager.h" -#include "AliGRPObject.h" - -#include "AliMUONTrackExtrap.h" -#include "AliMUONTrackParam.h" -#include "AliMUONTrackExtrap.h" -#include "AliMUONConstants.h" -#include "AliMUONGeometryTransformer.h" -#include "AliMUONTrackParam.h" - -#include "AliMpDDLStore.h" -#include "AliMpSegmentation.h" -#include "AliMpCDB.h" - -#include "AliCDBEntry.h" -#include "AliLog.h" - -#include "AliRunInfo.h" - -#include "AliHLTMUONConstants.h" -#include "AliHLTMUONDataTypes.h" -#include "AliHLTMUONUtils.h" -#include "AliHLTMUONRecHitsBlockStruct.h" -#include "AliHLTMUONTriggerRecordsBlockStruct.h" -#include "AliHLTMUONMansoTracksBlockStruct.h" - -using namespace std; - #ifdef PRINT_FULL #define PRINT_POINTS 1 #define PRINT_BACK 1 @@ -83,7 +45,7 @@ using namespace std; class AliHLTMUONFullTracker; -const Float_t AliHLTMUONFullTracker::fgkTrackDetCoordinate[3] = { +const Float_t AliHLTMUONFullTracker::TrackDetCoordinate[3] = { 155.179+20.0, 166.234+20.0, (AliMUONConstants::DefaultChamberZ(4)+ AliMUONConstants::DefaultChamberZ(5))/2.0 }; @@ -292,12 +254,10 @@ Bool_t AliHLTMUONFullTracker::Init() { /// Initilation to be called once, later can be used to set/load the CDB path/entries - //FIXME: remove the code for setting the magnetic field. This functionality is - // handled by the HLT framework. Doing so here can cause problems. if (AliGeomManager::GetGeometry() == NULL){ AliGeomManager::LoadGeometry(); AliGeomManager::ApplyAlignObjsFromCDB("GRP MUON"); - //InitGRP(); + InitGRP(); } AliMUONTrackExtrap::SetField(); @@ -374,7 +334,7 @@ Bool_t AliHLTMUONFullTracker::Run( Int_t /*iEvent*/,AliHLTMUONMansoTrackStruct * ///__________________________________________________________________________ -void AliHLTMUONFullTracker::Sub(const AliHLTMUONRecHitStruct *v1, const AliHLTMUONRecHitStruct *v2, AliHLTMUONRecHitStruct *v3) const +void AliHLTMUONFullTracker::Sub(AliHLTMUONRecHitStruct *v1, AliHLTMUONRecHitStruct *v2, AliHLTMUONRecHitStruct *v3) { /// Subtraction of position co-odinate of two space points @@ -385,7 +345,7 @@ void AliHLTMUONFullTracker::Sub(const AliHLTMUONRecHitStruct *v1, const AliHLTMU ///__________________________________________________________________________ -Double_t AliHLTMUONFullTracker::Angle(const AliHLTMUONRecHitStruct *v1, const AliHLTMUONRecHitStruct *v2) const +Double_t AliHLTMUONFullTracker::Angle(AliHLTMUONRecHitStruct *v1, AliHLTMUONRecHitStruct *v2) { ///Angle of a straight line formed using v1 and v2 @@ -405,7 +365,7 @@ Double_t AliHLTMUONFullTracker::Angle(const AliHLTMUONRecHitStruct *v1, const Al ///__________________________________________________________________________ -Bool_t AliHLTMUONFullTracker::FillOutData(AliHLTMUONMansoTrackStruct *track, AliHLTUInt32_t& size) const +Bool_t AliHLTMUONFullTracker::FillOutData(AliHLTMUONMansoTrackStruct *track, AliHLTUInt32_t& size) { ///Fill the output data pointers @@ -467,15 +427,15 @@ Bool_t AliHLTMUONFullTracker::SlatTrackSeg() Double_t anglediff,anglediff1,anglediff2; Double_t minAngle = 2.0; - Bool_t st5TrackletFound = false; - Bool_t ch9PointFound = false; - Bool_t ch8PointFound = false; - Bool_t st4TrackletFound = false; - Bool_t ch7PointFound = false; - Bool_t ch6PointFound = false; + Bool_t St5TrackletFound = false; + Bool_t Ch9PointFound = false; + Bool_t Ch8PointFound = false; + Bool_t St4TrackletFound = false; + Bool_t Ch7PointFound = false; + Bool_t Ch6PointFound = false; Int_t index1,index2,index3,index4; - IntPair cells[2][fgkMaxNofTracks]; ///cell array for 5 stn for given trigger + IntPair Cells[2][fgkMaxNofTracks]; ///cell array for 5 stn for given trigger Float_t maxXDeflectionExtrap = 10.0 + 4.0; ///simulation result 10.0 @@ -492,13 +452,13 @@ Bool_t AliHLTMUONFullTracker::SlatTrackSeg() for( Int_t itrig=0;itrig0 && nofBackChPoints>0){ for( Int_t itrackletback=0;itrackletback0){ for( Int_t itrackletback=0;itrackletback0){ for( Int_t itrackletback=0;itrackletback0 && nofBackChPoints>0){ for( Int_t itrackletfront=0;itrackletfront0){ for( Int_t itrackletfront=0;itrackletfront0){ for( Int_t itrackletfront=0;itrackletfrontfZ ; } - fExtrapSt3X[ibacktrackseg] = meanX1 + (fgkTrackDetCoordinate[2]-meanZ1)*(meanX2-meanX1)/(meanZ2-meanZ1); - fExtrapSt3Y[ibacktrackseg] = meanY1 + (fgkTrackDetCoordinate[2]-meanZ1)*(meanY2-meanY1)/(meanZ2-meanZ1); + fExtrapSt3X[ibacktrackseg] = meanX1 + (TrackDetCoordinate[2]-meanZ1)*(meanX2-meanX1)/(meanZ2-meanZ1); + fExtrapSt3Y[ibacktrackseg] = meanY1 + (TrackDetCoordinate[2]-meanZ1)*(meanY2-meanY1)/(meanZ2-meanZ1); fInclinationBack[ibacktrackseg] = (meanX2-meanX1)/(meanZ2-meanZ1) ; fNofConnectedfrontTrackSeg[ibacktrackseg] = 0; }///backtrigseg loop @@ -1332,8 +1292,8 @@ Bool_t AliHLTMUONFullTracker::QuadTrackSeg() meanZ2 = (fChPoint[2][ch2CellPoint[itrackletback]]->fZ + fChPoint[3][ch3CellPoint[itrackletback]]->fZ)/2.0 ; - expectSt3X = meanX2 + (fgkTrackDetCoordinate[2]-meanZ2)*(meanX2-meanX1)/(meanZ2-meanZ1); - expectSt3Y = meanY2 + (fgkTrackDetCoordinate[2]-meanZ2)*(meanY2-meanY1)/(meanZ2-meanZ1); + expectSt3X = meanX2 + (TrackDetCoordinate[2]-meanZ2)*(meanX2-meanX1)/(meanZ2-meanZ1); + expectSt3Y = meanY2 + (TrackDetCoordinate[2]-meanZ2)*(meanY2-meanY1)/(meanZ2-meanZ1); inclinationFront = (meanX2-meanX1)/(meanZ2-meanZ1) ; for( Int_t ibacktrackseg=0;ibacktracksegfY - fChPoint[1][ch1CellPoint[itrackletfront]]->fY) > diffDistStY ) continue; - expectSt3X = fChPoint[3][ibackpoint]->fX + (fgkTrackDetCoordinate[2] - fChPoint[3][ibackpoint]->fZ)* + expectSt3X = fChPoint[3][ibackpoint]->fX + (TrackDetCoordinate[2] - fChPoint[3][ibackpoint]->fZ)* (fChPoint[3][ibackpoint]->fX - fChPoint[1][ch1CellPoint[itrackletfront]]->fX)/ (fChPoint[3][ibackpoint]->fZ - fChPoint[1][ch1CellPoint[itrackletfront]]->fZ); - expectSt3Y = fChPoint[3][ibackpoint]->fY + (fgkTrackDetCoordinate[2] - fChPoint[3][ibackpoint]->fZ)* + expectSt3Y = fChPoint[3][ibackpoint]->fY + (TrackDetCoordinate[2] - fChPoint[3][ibackpoint]->fZ)* (fChPoint[3][ibackpoint]->fY - fChPoint[1][ch1CellPoint[itrackletfront]]->fY)/ (fChPoint[3][ibackpoint]->fZ - fChPoint[1][ch1CellPoint[itrackletfront]]->fZ); inclinationFront = (fChPoint[3][ibackpoint]->fX - fChPoint[1][ch1CellPoint[itrackletfront]]->fX)/ @@ -1454,10 +1414,10 @@ Bool_t AliHLTMUONFullTracker::QuadTrackSeg() fabsf(fChPoint[2][ifrontpoint]->fY - fChPoint[1][ch1CellPoint[itrackletfront]]->fY) > diffDistStY ) continue; - expectSt3X = fChPoint[2][ifrontpoint]->fX + (fgkTrackDetCoordinate[2] - fChPoint[2][ifrontpoint]->fZ)* + expectSt3X = fChPoint[2][ifrontpoint]->fX + (TrackDetCoordinate[2] - fChPoint[2][ifrontpoint]->fZ)* (fChPoint[2][ifrontpoint]->fX - fChPoint[1][ch1CellPoint[itrackletfront]]->fX)/ (fChPoint[2][ifrontpoint]->fZ - fChPoint[1][ch1CellPoint[itrackletfront]]->fZ); - expectSt3Y = fChPoint[2][ifrontpoint]->fY + (fgkTrackDetCoordinate[2] - fChPoint[2][ifrontpoint]->fZ)* + expectSt3Y = fChPoint[2][ifrontpoint]->fY + (TrackDetCoordinate[2] - fChPoint[2][ifrontpoint]->fZ)* (fChPoint[2][ifrontpoint]->fY - fChPoint[1][ch1CellPoint[itrackletfront]]->fY)/ (fChPoint[2][ifrontpoint]->fZ - fChPoint[1][ch1CellPoint[itrackletfront]]->fZ); inclinationFront = (fChPoint[2][ifrontpoint]->fX - fChPoint[1][ch1CellPoint[itrackletfront]]->fX)/ @@ -1541,10 +1501,10 @@ Bool_t AliHLTMUONFullTracker::QuadTrackSeg() fabsf(fChPoint[2][ch2CellPoint[itrackletback]]->fY - fChPoint[1][ibackpoint]->fY) > diffDistStY) continue; - expectSt3X = fChPoint[2][ch2CellPoint[itrackletback]]->fX + (fgkTrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* + expectSt3X = fChPoint[2][ch2CellPoint[itrackletback]]->fX + (TrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* (fChPoint[2][ch2CellPoint[itrackletback]]->fX - fChPoint[1][ibackpoint]->fX)/ (fChPoint[2][ch2CellPoint[itrackletback]]->fZ - fChPoint[1][ibackpoint]->fZ); - expectSt3Y = fChPoint[2][ch2CellPoint[itrackletback]]->fY + (fgkTrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* + expectSt3Y = fChPoint[2][ch2CellPoint[itrackletback]]->fY + (TrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* (fChPoint[2][ch2CellPoint[itrackletback]]->fY - fChPoint[1][ibackpoint]->fY)/ (fChPoint[2][ch2CellPoint[itrackletback]]->fZ - fChPoint[1][ibackpoint]->fZ); inclinationFront = (fChPoint[2][ch2CellPoint[itrackletback]]->fX - fChPoint[1][ibackpoint]->fX)/ @@ -1579,10 +1539,10 @@ Bool_t AliHLTMUONFullTracker::QuadTrackSeg() fabsf(fChPoint[2][ch2CellPoint[itrackletback]]->fY - fChPoint[0][ifrontpoint]->fY) > diffDistStY ) continue; - expectSt3X = fChPoint[2][ch2CellPoint[itrackletback]]->fX + (fgkTrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* + expectSt3X = fChPoint[2][ch2CellPoint[itrackletback]]->fX + (TrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* (fChPoint[2][ch2CellPoint[itrackletback]]->fX - fChPoint[0][ifrontpoint]->fX)/ (fChPoint[2][ch2CellPoint[itrackletback]]->fZ - fChPoint[0][ifrontpoint]->fZ); - expectSt3Y = fChPoint[2][ch2CellPoint[itrackletback]]->fY + (fgkTrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* + expectSt3Y = fChPoint[2][ch2CellPoint[itrackletback]]->fY + (TrackDetCoordinate[2] - fChPoint[2][ch2CellPoint[itrackletback]]->fZ)* (fChPoint[2][ch2CellPoint[itrackletback]]->fY - fChPoint[0][ifrontpoint]->fY)/ (fChPoint[2][ch2CellPoint[itrackletback]]->fZ - fChPoint[0][ifrontpoint]->fZ); inclinationFront = (fChPoint[2][ch2CellPoint[itrackletback]]->fX - fChPoint[0][ifrontpoint]->fX)/ @@ -1804,16 +1764,16 @@ Double_t AliHLTMUONFullTracker::TryOneCluster(const AliMUONTrackParam &trackPara ///__________________________________________________________________________ -Bool_t AliHLTMUONFullTracker::TryOneClusterFast(const AliMUONTrackParam &trackParam, const Cluster* cluster) const +Bool_t AliHLTMUONFullTracker::TryOneClusterFast(const AliMUONTrackParam &trackParam, Cluster* cluster) { //// Test the compatibility between the track and the cluster //// given the track resolution + the maximum-distance-to-track value //// and assuming linear propagation of the track: //// return kTRUE if they are compatibles - Float_t sigmaCutForTracking = 6.0; - Float_t maxNonBendingDistanceToTrack = 1.0; - Float_t maxBendingDistanceToTrack = 1.0; + Float_t SigmaCutForTracking = 6.0; + Float_t MaxNonBendingDistanceToTrack = 1.0; + Float_t MaxBendingDistanceToTrack = 1.0; Double_t dZ = cluster->fZ - trackParam.GetZ(); Double_t dX = cluster->fX - (trackParam.GetNonBendingCoor() + trackParam.GetNonBendingSlope() * dZ); @@ -1822,10 +1782,10 @@ Bool_t AliHLTMUONFullTracker::TryOneClusterFast(const AliMUONTrackParam &trackPa Double_t errX2 = kParamCov(0,0) + dZ * dZ * kParamCov(1,1) + 2. * dZ * kParamCov(0,1); Double_t errY2 = kParamCov(2,2) + dZ * dZ * kParamCov(3,3) + 2. * dZ * kParamCov(2,3); - Double_t dXmax = sigmaCutForTracking * TMath::Sqrt(errX2) + - maxNonBendingDistanceToTrack; - Double_t dYmax = sigmaCutForTracking * TMath::Sqrt(errY2) + - maxBendingDistanceToTrack; + Double_t dXmax = SigmaCutForTracking * TMath::Sqrt(errX2) + + MaxNonBendingDistanceToTrack; + Double_t dYmax = SigmaCutForTracking * TMath::Sqrt(errY2) + + MaxBendingDistanceToTrack; if (TMath::Abs(dX) > dXmax || TMath::Abs(dY) > dYmax) return kFALSE; @@ -1835,7 +1795,7 @@ Bool_t AliHLTMUONFullTracker::TryOneClusterFast(const AliMUONTrackParam &trackPa ///__________________________________________________________________________ void AliHLTMUONFullTracker::PropagateTracks(Double_t charge, Float_t& px, Float_t& py, Float_t& pz, - Float_t& xr, Float_t& yr, Float_t& zr, Float_t zprop) const + Float_t& xr, Float_t& yr, Float_t& zr, Float_t zprop) { /// /// propagate in magnetic field between hits of indices i1 and i2 @@ -1879,7 +1839,7 @@ void AliHLTMUONFullTracker::PropagateTracks(Double_t charge, Float_t& px, Float_ ///__________________________________________________________________________ -void AliHLTMUONFullTracker::OneStepHelix3(Double_t field, Double_t step, const Double_t *vect, Double_t *vout) const +void AliHLTMUONFullTracker::OneStepHelix3(Double_t field, Double_t step, Double_t *vect, Double_t *vout) { ////
   ////	******************************************************************
@@ -1961,7 +1921,7 @@ void AliHLTMUONFullTracker::OneStepHelix3(Double_t field, Double_t step, const D
 ///______________________________________________________________________________
 
 void AliHLTMUONFullTracker::OneStepRungekutta(Double_t charge, Double_t step,
-					      const Double_t* vect, Double_t* vout) const
+					      Double_t* vect, Double_t* vout)
 {
   ////	******************************************************************
   ////	*								 *
@@ -2208,8 +2168,6 @@ void AliHLTMUONFullTracker::OneStepRungekutta(Double_t charge, Double_t step,
 
 Bool_t AliHLTMUONFullTracker::SelectFront()
 {
-  // Track extrapolation through  dipole magnet to connect front and back track seg.
-
   Cluster clus1,clus2;
   Int_t minIndex=0,maxIndex=0;
   Int_t minCh=0,maxCh=0;
@@ -2561,15 +2519,14 @@ Double_t AliHLTMUONFullTracker::EnergyLossFluctuation2(Double_t pTotal, Double_t
 
 ///__________________________________________________________________________
 
-void AliHLTMUONFullTracker::LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd) const
+void AliHLTMUONFullTracker::LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd)
 {
   //// Track parameters (and their covariances if any) linearly extrapolated to the plane at "zEnd".
   //// On return, results from the extrapolation are updated in trackParam.
   
-  //if (trackParam->GetZ() == zEnd) return; // nothing to be done if same z
+  if (trackParam->GetZ() == zEnd) return; /// nothing to be done if same z
 
   Double_t dZ = zEnd - trackParam->GetZ();
-  if (dZ == 0) return; // nothing to be done if same z
   trackParam->SetNonBendingCoor(trackParam->GetNonBendingCoor() + trackParam->GetNonBendingSlope() * dZ);
   trackParam->SetBendingCoor(trackParam->GetBendingCoor() + trackParam->GetBendingSlope() * dZ);
   trackParam->SetZ(zEnd);
@@ -2577,8 +2534,6 @@ void AliHLTMUONFullTracker::LinearExtrapToZ(AliMUONTrackParam* trackParam, Doubl
 
 void AliHLTMUONFullTracker::CorrectELossEffectInAbsorber(AliMUONTrackParam* param, Double_t eLoss)
 {
-  // Energy loss coreection in front absorber.
-  
   Double_t nonBendingSlope = param->GetNonBendingSlope();
   Double_t bendingSlope = param->GetBendingSlope();
   param->SetInverseBendingMomentum(param->GetCharge() / (param->P() + eLoss) *
@@ -2697,15 +2652,15 @@ Bool_t AliHLTMUONFullTracker::ExtrapolateToOrigin(Bool_t extrap)
   Int_t minCh=0,maxCh=0;
   Int_t ifronttrackseg = -1;
   AliMUONTrackParam trackP;
-  Double_t slopeB, slopeNB;
+  Double_t BSlope, NBSlope;
   AliHLTMUONRecHitStruct p1,p2,pSeg1,pSeg2;
-  Double_t pyz = -1.0;
+  Double_t Pyz = -1.0;
   TVector3 v1,v2,v3,v4;
   Double_t eLoss1,eLoss2,eLoss3;
   Double_t b;
   Double_t zE,zB,dzE,dzB; 
-  Double_t f0,f1,f2;
-  Double_t f0Sum,f1Sum,f2Sum;
+  Double_t F0,F1,F2;
+  Double_t F0Sum,F1Sum,F2Sum;
   Double_t fXVertex=0.0,fYVertex=0.0,fZVertex=0.0;
   
   for( Int_t ibacktrackseg=0;ibacktracksegDump();
 
 
-  // Dealing with the magnetic field map
+  ///*** Dealing with the magnetic field map
   if ( TGeoGlobalMagField::Instance()->IsLocked() ) {
     if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) {
       HLTInfo("ExpertMode!!! GRP information will be ignored !\n");
@@ -2992,4 +2946,4 @@ Bool_t AliHLTMUONFullTracker::InitGRP()
 
   return kTRUE;
 } 
-*/
+
diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.h b/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.h
index bddd3324adc..3029bd490d9 100644
--- a/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.h
+++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTracker.h
@@ -4,21 +4,56 @@
  * ALICE Experiment at CERN, All rights reserved.                         *
  * See cxx source for full Copyright notice                               */
 /**********************************************************************
-// Created on : 08/12/2009
-// Purpose    : First version implementation of the Full tracker for dHLT.
-// Author     : Indranil Das, HEP Division, SINP
-// Email      : indra.das@saha.ac.in | indra.ehep@gmail.com
+ Created on : 08/12/2009
+ Purpose    : First version implementation of the Full tracker for dHLT.
+ Author     : Indranil Das, HEP Division, SINP
+ Email      : indra.das@saha.ac.in | indra.ehep@gmail.com
 **********************************************************************/
 
-#include "AliHLTLogging.h"
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include 
+
+#include "TMap.h"
+#include "TString.h"
+#include "TVector3.h"
+#include "TMath.h"
 #include "TMatrixD.h"
+#include "TGeoGlobalMagField.h"
+
+#include "AliMagF.h"
+#include "AliCDBManager.h"
+#include "AliGeomManager.h"
+#include "AliGRPObject.h"
+
+#include "AliMUONTrackExtrap.h"
+#include "AliMUONTrackParam.h"
+#include "AliMUONTrackExtrap.h"
+#include "AliMUONConstants.h"
+#include "AliMUONGeometryTransformer.h"
+#include "AliMUONTrackParam.h"
+
+#include "AliMpDDLStore.h"
+#include "AliMpSegmentation.h"
+#include "AliMpCDB.h"
+
+#include "AliCDBEntry.h"
+#include "AliLog.h"
+
+#include "AliRunInfo.h"
+
+#include "AliHLTLogging.h"
+
+#include "AliHLTMUONConstants.h"
+#include "AliHLTMUONDataTypes.h"
+#include "AliHLTMUONUtils.h"
+#include "AliHLTMUONDataBlockReader.h"
+#include "AliHLTMUONDataBlockWriter.h"
+#endif
+
+using namespace std;
 
 class AliHLTMUONConstants;
-class AliHLTMUONMansoTrackStruct;
-class AliHLTMUONTriggerRecordStruct;
-class AliHLTMUONRecHitStruct;
-class AliMUONGeometryTransformer;
-class AliMUONTrackParam;
 
 class AliHLTMUONFullTracker : public AliHLTLogging
 {
@@ -51,22 +86,22 @@ class AliHLTMUONFullTracker : public AliHLTLogging
 
   /// intger pair needed for QuadTrackSeg method
   struct IntPair{
-    Int_t fFirst,fSecond;  /// First and second element of the pair.
+    Int_t fFirst,fSecond;
   };
   ///Structure for internal track segments
   struct TrackSeg{
-    Int_t fIndex[4];    /// Index of the chamber rec hit point in fChPoint.
-    AliHLTInt32_t fTrigRec;  /// The corresponding trigger record ID.
+    Int_t fIndex[4];
+    AliHLTInt32_t fTrigRec;
   };
 
   ///Sructure for clusters
   struct Cluster{
-    Float_t fX,fY,fZ;       /// Cluster point X, Y, Z.
-    Float_t fErrX2,fErrY2;  /// The square of the uncertainty (variance) on X and Y.
+    Float_t fX,fY,fZ;
+    Float_t fErrX2,fErrY2;
   };
 
   
-  static const Float_t fgkTrackDetCoordinate[3]; /// set the constant value for third station position and size
+  static const Float_t TrackDetCoordinate[3]; /// set the constant value for third station position and size
   
   static const Double_t fgkAbsoedge[4] ;     /// edge of the absorber
   static const Double_t fgkRadLen[3] ;       /// radiation length of the main three matirials of the front absorber
@@ -80,30 +115,50 @@ class AliHLTMUONFullTracker : public AliHLTLogging
   static const Int_t fgkMaxNofTracks;           /// maximum number of allowed tracks
   static const Int_t fgkMaxNofConnectedTracks;  /// maximum number of back to front connected tracks
   
-  AliMUONGeometryTransformer *fChamberGeometryTransformer;   /// Pointer to AliMUONGeometryTransformer
+  /// Pointer to AliMUONGeometryTransformer
+  AliMUONGeometryTransformer *fChamberGeometryTransformer;
   
-  AliHLTMUONRecHitStruct ***fChPoint;  /// array of pointer to rechit data
-  AliHLTMUONTriggerRecordStruct **fChPoint11;   ///array of pointer to trigrec data
-  TrackSeg *fBackTrackSeg;  /// track segments at the rear part of the spectrometer
-  TrackSeg *fFrontTrackSeg;  /// track segments close the part of interaction point  of ALICE
+  /// array of pointer to rechit data
+  AliHLTMUONRecHitStruct ***fChPoint;
+  ///array of pointer to trigrec data
+  AliHLTMUONTriggerRecordStruct **fChPoint11;
+  /// track segments at the rear part of the spectrometer
+  TrackSeg *fBackTrackSeg;
+  /// track segments close the part of interaction point  of ALICE
+  TrackSeg *fFrontTrackSeg;
   
-  Float_t *fExtrapSt3X ;  /// Extrapolated x position in third station
-  Float_t *fExtrapSt3Y ;  /// Extrapolated y position in third station
-  Float_t *fInclinationBack;  /// values of inclination angle of back track segments
-
-  Int_t *fNofConnectedfrontTrackSeg ;  /// nof connected tracks in front direction for each back track segments
-  Int_t **fBackToFront;  /// Pointer to back to front segment mapping
-  Float_t *fCharge;  /// Charge of the tracks
-  Int_t *fNofPoints ;  /// Number of points for each stations
-  AliMUONTrackParam *fTrackParam ;  /// track parameters;
-
-  Int_t fTotNofPoints;  /// Total number of points received from all rechit source
-  Int_t fTotTrackSeg;  /// Total number of track segments
-  Int_t fNofCells[2];  /// Number of cells per station in QuadSeg
-  Bool_t fOverflowed;  /// Check if overflowed
-  Int_t fNofbackTrackSeg;  /// number of back track segments
-  Int_t fNoffrontTrackSeg;  /// number of front track segments
-  Int_t fNofConnected ;  /// number of connected track segments
+  /// Extrapolated x position in third station
+  Float_t *fExtrapSt3X ;
+  /// Extrapolated y position in third station
+  Float_t *fExtrapSt3Y ;
+  /// values of inclination angle of back track segments
+  Float_t *fInclinationBack;
+
+  /// nof connected tracks in front direction for each back track segments
+  Int_t *fNofConnectedfrontTrackSeg ;
+  /// Pointer to back to front segment mapping
+  Int_t **fBackToFront;
+  /// Charge of the tracks
+  Float_t *fCharge;
+  /// Number of points for each stations
+  Int_t *fNofPoints ;
+  /// track parameters;
+  AliMUONTrackParam *fTrackParam ;
+
+  /// Total number of points received from all rechit source
+  Int_t fTotNofPoints;
+  /// Total number of track segments
+  Int_t fTotTrackSeg;
+  /// Number of cells in QuadSeg
+  Int_t fNofCells[2]; // nof cell count per station
+  /// Check if overflowed
+  Bool_t fOverflowed;
+  /// number of back track segments
+  Int_t fNofbackTrackSeg;
+  /// number of front track segments
+  Int_t fNoffrontTrackSeg;
+  /// number of connected track segments
+  Int_t fNofConnected ;
 
   /// Slat Track segments 
   Bool_t SlatTrackSeg();
@@ -114,51 +169,51 @@ class AliHLTMUONFullTracker : public AliHLTLogging
   /// track extrapolation through  dipole magnet to connect front and back track seg
   Bool_t SelectFront();
   /// Propagate tracks
-  void PropagateTracks(Double_t charge, Float_t& px, Float_t& py, Float_t& pz,
-		       Float_t& xr, Float_t& yr, Float_t& zr, Float_t zprop) const;
+  void PropagateTracks(Double_t charge, Float_t& px, Float_t& py, Float_t& pz, 
+		       Float_t& xr, Float_t& yr, Float_t& zr, Float_t zprop);
   /// extrapolate to origin
-  Bool_t ExtrapolateToOrigin(Bool_t extrap);
+  Bool_t ExtrapolateToOrigin(Bool_t);
   /// Clean after each run
   Bool_t Clear();
 
 
   /// Angle calculate
-  Double_t Angle(const AliHLTMUONRecHitStruct *v1, const AliHLTMUONRecHitStruct *v2) const;
+  inline Double_t Angle(AliHLTMUONRecHitStruct *v1, AliHLTMUONRecHitStruct *v2);
   /// Subtracktion of two point
-  void Sub(const AliHLTMUONRecHitStruct *v1, const AliHLTMUONRecHitStruct *v2, AliHLTMUONRecHitStruct *v3) const;
+  inline void Sub(AliHLTMUONRecHitStruct *v1, AliHLTMUONRecHitStruct *v2, AliHLTMUONRecHitStruct *v3);
   /// Kalman Filter
-  Double_t KalmanFilter(AliMUONTrackParam &trackParamAtCluster, Cluster *cluster);
+  inline Double_t KalmanFilter(AliMUONTrackParam &trackParamAtCluster, Cluster *cluster);
   /// Try onecluster
-  Double_t TryOneCluster(const AliMUONTrackParam &trackParam, Cluster* cluster,
+  inline Double_t TryOneCluster(const AliMUONTrackParam &trackParam, Cluster* cluster,
 				AliMUONTrackParam &trackParamAtCluster, Bool_t updatePropagator);
-  Bool_t TryOneClusterFast(const AliMUONTrackParam &trackParam, const Cluster* cluster) const;
+  inline Bool_t TryOneClusterFast(const AliMUONTrackParam &trackParam, Cluster* cluster);
 
   /// MCS effect correction
-  void CorrectMCSEffectInAbsorber(AliMUONTrackParam* param,
+  inline void CorrectMCSEffectInAbsorber(AliMUONTrackParam* param,
 					 Double_t xVtx, Double_t yVtx, Double_t zVtx,
 					 Double_t absZBeg, 
 					 Double_t f1, Double_t f2);
   /// Covariant handling function
-  void Cov2CovP(const TMatrixD ¶m, TMatrixD &cov);
+  inline void Cov2CovP(const TMatrixD ¶m, TMatrixD &cov);
   /// Covariant handling function
-  void CovP2Cov(const TMatrixD ¶m, TMatrixD &covP);
+  inline void CovP2Cov(const TMatrixD ¶m, TMatrixD &covP);
   /// Energy loss coreection in front absorber
-  void CorrectELossEffectInAbsorber(AliMUONTrackParam* param, Double_t eLoss);
+  inline void CorrectELossEffectInAbsorber(AliMUONTrackParam* param, Double_t eLoss);
   /// Linear Extrapolation to Z position
-  void LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd) const;
+  inline void LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd);
   /// Energy loss
-  Double_t EnergyLossFluctuation2(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ);
+  inline Double_t EnergyLossFluctuation2(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ);
   /// Bethe Bloch formula of enrgy loss
-  Double_t BetheBloch(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ);
+  inline Double_t BetheBloch(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ);
   
   /// Runge Kutta method of track extrapolation through mag field
-  void OneStepRungekutta(Double_t charge, Double_t step, const Double_t* vect, Double_t* vout) const;
+  inline void OneStepRungekutta(Double_t charge, Double_t step,Double_t* vect, Double_t* vout);
   /// Helix3 method of track extrapolation through mag field
-  void OneStepHelix3(Double_t field, Double_t step, const Double_t *vect, Double_t *vout) const;
+  inline void OneStepHelix3(Double_t field, Double_t step, Double_t *vect, Double_t *vout);				  
   /// Initialise GRP when running without reconstruction chain
   Bool_t InitGRP();
   /// Fill the tracks to output pointer
-  Bool_t FillOutData(AliHLTMUONMansoTrackStruct *data, AliHLTUInt32_t& size) const;
+  Bool_t FillOutData(AliHLTMUONMansoTrackStruct *data, AliHLTUInt32_t& size);
   
 };
 #endif // ALIHLTMUONMANSOTRACKERFSM_H
diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTrackerComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTrackerComponent.cxx
index 38a7e76963b..5624be3d498 100644
--- a/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTrackerComponent.cxx
+++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONFullTrackerComponent.cxx
@@ -23,8 +23,6 @@ using namespace std;
 #endif
 
 #include "AliHLTMUONFullTrackerComponent.h"
-#include "AliHLTMUONDataBlockReader.h"
-#include "AliHLTMUONDataBlockWriter.h"
 #include "TString.h"
 #include "TObjString.h"
 #include "TObjArray.h"
diff --git a/HLT/libAliHLTCalo.pkg b/HLT/libAliHLTCalo.pkg
index bbdc29ae1ad..6c3bde3bb98 100644
--- a/HLT/libAliHLTCalo.pkg
+++ b/HLT/libAliHLTCalo.pkg
@@ -8,20 +8,26 @@ include $(MODDIR)/hlt.conf
 ## header files of all classes
 ## optionally, the link def file of the library is generated
 ## automatically from those header files
-CLASS_HDRS:= 	AliHLTCaloRawAnalyzerComponentv3.h \
-		AliHLTCaloUtilities.h \
-		AliHLTCaloMapper.h \
-		AliHLTCaloDefinitions.h \
-		AliHLTCaloSanityInspector.h \
-		AliHLTCaloSharedMemoryInterfacev2.h \
-		AliHLTCaloFourier.h \
-		AliHLTCaloConstantsHandler.h \
-		AliHLTCaloClusterizer.h \
-		AliHLTCaloDigitMaker.h \
-		AliHLTCaloClusterAnalyser.h \
-		AliHLTCaloRcuProcessor.h \
-		AliHLTCaloConstants.h \
-		AliHLTCaloProcessor.h
+CLASS_HDRS:= AliHLTCaloRawAnalyzerChiSquareFit.h \
+AliHLTCaloRawAnalyzerComponentv3.h \
+AliHLTCaloRawAnalyzerCrudeComponent.h \
+AliHLTCaloRawAnalyzerCrude.h \
+AliHLTCaloRawAnalyzer.h \
+AliHLTCaloRawAnalyzerPeakFinderComponent.h \
+AliHLTCaloRawAnalyzerPeakFinder.h \
+AliHLTCaloUtilities.h \
+AliHLTCaloMapper.h \
+AliHLTCaloDefinitions.h \
+AliHLTCaloSanityInspector.h \
+AliHLTCaloSharedMemoryInterfacev2.h \
+AliHLTCaloFourier.h \
+AliHLTCaloConstantsHandler.h \
+AliHLTCaloClusterizer.h \
+AliHLTCaloDigitMaker.h \
+AliHLTCaloClusterAnalyser.h \
+AliHLTCaloRcuProcessor.h \
+AliHLTCaloConstants.h \
+AliHLTCaloProcessor.h 
 
 ## all source files of this module
 ## all source files corresponding to the class headers
@@ -47,9 +53,7 @@ MODULE_DHDR:=
 ## AliRoot include paths
 EINCLUDE := HLT/BASE HLT/BASE/util STEER RAW HLT/PHOS EMCAL CALO PHOS
 
-## LIBRARY_DEP  := -lHLTbase -lCalo -CALOshuttle -lESD -lSTEER -lRAWDatarec -lEMCALrec
-LIBRARY_DEP  := -lHLTbase  -lEMCALrec   -lESD -lSTEER -lRAWDatarec 
-
+LIBRARY_DEP  := -lHLTbase -lCalo -CALOshuttle -lESD -lSTEER -lRAWDatarec
 
 ###############################################################################
 #
diff --git a/HLT/libAliHLTEMCAL.pkg b/HLT/libAliHLTEMCAL.pkg
index d3281c4cb0e..9feac43179b 100644
--- a/HLT/libAliHLTEMCAL.pkg
+++ b/HLT/libAliHLTEMCAL.pkg
@@ -8,8 +8,6 @@ CLASS_HDRS:= \
 	AliHLTEMCALRawAnalyzerComponent.h \
 	AliHLTEMCALMapper.h \
 	AliHLTEMCALRawAnalyzerCrudeComponent.h \
-	AliHLTEMCALRawAnalyzerLMSComponent.h \
-	AliHLTEMCALRawAnalyzerPeakFinderComponent.h \
 	AliHLTEMCALSharedMemoryInterface.h  \
 	AliHLTEMCALConstants.h
 # library sources
@@ -37,11 +35,10 @@ MODULE_DHDR:=
 
 EINCLUDE := HLT/BASE HLT/BASE/util HLT/EMCAL HLT/TPC HLT/TRD HLT/CALO EMCAL TPC TRD STEER RAW
 
-
 LIBRARY_DEP := -lHLTbase -lAliHLTUtil -lAliHLTCalo -lESD -lCDB  \
 	       -lEMCALrec -lEMCALsim -lEMCALbase -lEMCALUtils \
                -lTPCrec -lTPCbase -lTRDrec -lTRDbase \
-               -lSTEER -lSTEERBase -lRAWDatarec 
+               -lSTEER -lSTEERBase -lRAWDatarec
 
 ###############################################################################
 #
diff --git a/HLT/rec/AliHLTReconstructor.cxx b/HLT/rec/AliHLTReconstructor.cxx
index e9114feef63..0b61f5a0100 100644
--- a/HLT/rec/AliHLTReconstructor.cxx
+++ b/HLT/rec/AliHLTReconstructor.cxx
@@ -416,7 +416,7 @@ void AliHLTReconstructor::FillESD(TTree* /*digitsTree*/, TTree* /*clustersTree*/
 
     AliHLTOUTDigitReader* pHLTOUT=new AliHLTOUTDigitReader(esd->GetEventNumberInFile(), fpEsdManager);
     if (pHLTOUT) {
-      ProcessHLTOUT(pHLTOUT, esd, (pSystem->GetGlobalLoggingLevel()&kHLTLogDebug)!=0);
+      ProcessHLTOUT(pHLTOUT, esd);
       delete pHLTOUT;
     } else {
       AliError("error creating HLTOUT handler");
@@ -475,10 +475,6 @@ void AliHLTReconstructor::ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd, bo
       AliError("error processing HLTOUT");
     }
   }
-  if (bVerbose) {
-    AliInfo("HLT ESD content:");
-    esd->Print();
-  }
   pHLTOUT->Reset();
 }
 
diff --git a/HMPID/AliHMPIDParam.h b/HMPID/AliHMPIDParam.h
index c784f1c17c4..846ab4b7823 100644
--- a/HMPID/AliHMPIDParam.h
+++ b/HMPID/AliHMPIDParam.h
@@ -252,14 +252,9 @@ Double_t AliHMPIDParam::FindTemp(Double_t tLow,Double_t tHigh,Double_t y)
 //  Double_t gradT = (t2-t1)/SizePcY();  // linear gradient
 //  return gradT*y+t1;
   Double_t halfPadSize = 0.5*SizePadY();
-  Double_t result = tLow;
-  Double_t delta = (TMath::Log(tHigh)-TMath::Log(tLow));
-  if (TMath::Abs(delta)>0) {
-    Double_t gradT = (TMath::Log(SizePcY()) - TMath::Log(halfPadSize))/delta;
-    if(y<0) y = 0;
-    result += TMath::Power(y/halfPadSize,1./gradT);
-  }
-  return result;    
+  Double_t gradT = (TMath::Log(SizePcY()) - TMath::Log(halfPadSize))/(TMath::Log(tHigh)-TMath::Log(tLow));
+  if(y<0) y = 0;
+  return tLow + TMath::Power(y/halfPadSize,1./gradT);  
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 #endif
diff --git a/ITS/AliITSAlignMille2.cxx b/ITS/AliITSAlignMille2.cxx
index 15288db5355..cded35c2349 100644
--- a/ITS/AliITSAlignMille2.cxx
+++ b/ITS/AliITSAlignMille2.cxx
@@ -3763,4 +3763,3 @@ AliITSresponseSDD* AliITSAlignMille2::CreateSDDResponse()
   //
   return calibSDD;  
 }
-
diff --git a/ITS/AliITSOnlineSDDInjectors.cxx b/ITS/AliITSOnlineSDDInjectors.cxx
index 00a855729b0..c10c855fa8d 100644
--- a/ITS/AliITSOnlineSDDInjectors.cxx
+++ b/ITS/AliITSOnlineSDDInjectors.cxx
@@ -67,10 +67,8 @@ AliITSOnlineSDDInjectors::~AliITSOnlineSDDInjectors(){
 }
 //______________________________________________________________________
 void AliITSOnlineSDDInjectors::SetDefaults(){
-  for(Int_t i=0;i=0 && iLineGetPID();
 
-  if(pidOpt==1){
-    AliInfo("ITS LandauFitPID option has been selected\n");
-    ESDpid->SetITSPIDmethod(AliESDpid::kITSLikelihood);
-  }
-  else{
-    AliInfo("ITS default PID\n");
-    ESDpid->SetITSPIDmethod(AliESDpid::kITSTruncMean);
-  }
-}
 //______________________________________________________________________
 void AliITSReconstructor::Init() {
     // Initalize this constructor bet getting/creating the objects
@@ -168,6 +152,20 @@ AliTracker* AliITSReconstructor::CreateTracker() const
     sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
   }
 
+  Int_t pidOpt = GetRecoParam()->GetPID();
+
+  AliITSReconstructor* nc = const_cast(this);
+  /*
+  if(pidOpt==1){
+    Info("FillESD","ITS LandauFitPID option has been selected\n");
+    nc->fItsPID = new AliITSpidESD2();
+  }
+  else{
+    Info("FillESD","ITS default PID\n");
+    Double_t parITS[] = {79.,0.13, 5.}; //IB: this is  "pp tuning"
+    nc->fItsPID = new AliITSpidESD1(parITS);
+  }
+  */ 
   return tracker;
   
 }
@@ -231,7 +229,7 @@ AliVertexer* AliITSReconstructor::CreateVertexer() const
 
 //_____________________________________________________________________________
 void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree * /*clustersTree*/, 
-				  AliESDEvent* /* esd */) const
+				  AliESDEvent* esd) const
 {
 // make PID, find V0s and cascade
 /* Now done in AliESDpid
diff --git a/ITS/AliITSReconstructor.h b/ITS/AliITSReconstructor.h
index 692b07e03bd..4ee059f02dc 100644
--- a/ITS/AliITSReconstructor.h
+++ b/ITS/AliITSReconstructor.h
@@ -13,7 +13,6 @@
 #include "AliReconstructor.h"
 #include "AliITSRecoParam.h"
 
-class AliESDpid;
 class AliITSgeom;
 class AliTracker;
 class AliITStrackerMI;
@@ -24,7 +23,7 @@ class AliITSReconstructor: public AliReconstructor {
   AliITSReconstructor();
   virtual ~AliITSReconstructor();
   virtual void         Init();
-  virtual void         GetPidSettings(AliESDpid *ESDpid);
+  
   virtual void         Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const;
   virtual void         Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
 
@@ -33,7 +32,7 @@ class AliITSReconstructor: public AliReconstructor {
   virtual AliTracker*  CreateTrackleter() const;
 
   virtual void         FillESD(TTree* /*digitsTree*/, TTree* clustersTree, 
-			       AliESDEvent* /* esd */) const; 
+			       AliESDEvent* esd) const; 
   virtual void         FillESD(AliRawReader* /*rawReader*/, TTree* clustersTree, 
 			       AliESDEvent* esd) const
   {FillESD((TTree*)NULL, clustersTree, esd);}
diff --git a/ITS/AliITSTPArrayFit.cxx b/ITS/AliITSTPArrayFit.cxx
index 423ce275b08..ec6b6bf1393 100644
--- a/ITS/AliITSTPArrayFit.cxx
+++ b/ITS/AliITSTPArrayFit.cxx
@@ -44,6 +44,7 @@
 #include "AliITSgeomTGeo.h"
 #include "AliTracker.h"
 #include 
+#include 
 
 ClassImp(AliITSTPArrayFit)
 
@@ -85,7 +86,7 @@ Double_t AliITSTPArrayFit::fgRhoLITS[AliITSTPArrayFit::kMaxLrITS] = {
 
 //____________________________________________________
 AliITSTPArrayFit::AliITSTPArrayFit() :
-  fkPoints(0),fParSol(0),fBz(0),fCharge(0),fPntFirst(-1),
+  fPoints(0),fParSol(0),fBz(0),fCharge(0),fPntFirst(-1),
   fPntLast(-1),fNPBooked(0),fParAxis(-1),fCovI(0),fChi2NDF(0),
   fMaxIter(20),fIter(0),fEps(1e-6),fMass(0),fSwitch2Line(kFALSE),fMaxRforHelix(1.e6),
   fkAxID(0),fkAxCID(0),fCurT(0),
@@ -99,7 +100,7 @@ AliITSTPArrayFit::AliITSTPArrayFit() :
 
 //____________________________________________________
 AliITSTPArrayFit::AliITSTPArrayFit(Int_t np) :
-  fkPoints(0),fParSol(0),fBz(0),fCharge(0),fPntFirst(-1),
+  fPoints(0),fParSol(0),fBz(0),fCharge(0),fPntFirst(-1),
   fPntLast(-1),fNPBooked(np),fParAxis(-1),fCovI(0),fChi2NDF(0),
   fMaxIter(20),fIter(0),fEps(1e-6),fMass(0),fSwitch2Line(kFALSE),fMaxRforHelix(2.e3),
   fkAxID(0),fkAxCID(0),fCurT(0),fFirstPosT(0),fNElsPnt(0),fElsId(0),fElsDR(0)
@@ -115,7 +116,7 @@ AliITSTPArrayFit::AliITSTPArrayFit(Int_t np) :
 
 //____________________________________________________
 AliITSTPArrayFit::AliITSTPArrayFit(const AliITSTPArrayFit &src) : 
-  TObject(src),fkPoints(src.fkPoints),fParSol(0),fBz(src.fBz),
+  TObject(src),fPoints(src.fPoints),fParSol(0),fBz(src.fBz),
   fCharge(src.fCharge),fPntFirst(src.fPntFirst),fPntLast(src.fPntLast),fNPBooked(src.fNPBooked),
   fParAxis(src.fParAxis),fCovI(0),fChi2NDF(0),fMaxIter(20),fIter(0),fEps(0),fMass(src.fMass),
   fSwitch2Line(src.fSwitch2Line),fMaxRforHelix(src.fMaxRforHelix),fkAxID(0),fkAxCID(0),fCurT(0),
@@ -138,7 +139,7 @@ AliITSTPArrayFit &AliITSTPArrayFit::operator =(const AliITSTPArrayFit& src)
   // assignment operator
   if (this==&src) return *this;
   ((TObject*)this)->operator=(src);
-  fkPoints   = src.fkPoints;
+  fPoints   = src.fPoints;
   if (!fParSol) fParSol = new AliParamSolver(*src.fParSol);
   else *fParSol = *src.fParSol; 
   fBz       = src.fBz; 
@@ -180,7 +181,7 @@ void AliITSTPArrayFit::Reset()
 {
   // reset to process new track
   if (fParSol) fParSol->Clear();
-  fkPoints=0; 
+  fPoints=0; 
   fNElsPnt = 0;
   fFirstPosT = 0;
   //  fBz = 0;
@@ -197,7 +198,7 @@ void AliITSTPArrayFit::AttachPoints(const AliTrackPointArray* points, Int_t pfir
 {
   // create from piece of AliTrackPointArray
   Reset();
-  fkPoints = points;
+  fPoints = points;
   int np = points->GetNPoints();
   if (fNPBookedGetCov() + i*6; // pointer on cov.matrix
+    float *cov = (float*)fPoints->GetCov() + i*6; // pointer on cov.matrix
     //
     Double_t t0 = cov[kYY]*cov[kZZ] - cov[kYZ]*cov[kYZ];
     Double_t t1 = cov[kXY]*cov[kZZ] - cov[kXZ]*cov[kYZ];
@@ -337,7 +338,7 @@ Bool_t AliITSTPArrayFit::FitLineCrude()
   if (fParAxis<0) SetParAxis(ChoseParAxis());
   Double_t sZ=0,sZZ=0,sY=0,sYZ=0,sX=0,sXZ=0,det=0;
   //
-  const float *coord[3] = {fkPoints->GetX(),fkPoints->GetY(),fkPoints->GetZ()};
+  const float *coord[3] = {fPoints->GetX(),fPoints->GetY(),fPoints->GetZ()};
   const Float_t *varZ = coord[ fParAxis  ];
   const Float_t *varX = coord[ fkAxID[kX] ];
   const Float_t *varY = coord[ fkAxID[kY] ];
@@ -389,7 +390,7 @@ Int_t AliITSTPArrayFit::ChoseParAxis() const
   // select the variable with largest base as a parameter
   Double_t cmn[3]={1.e9,1.e9,1.e9},cmx[3]={-1.e9,-1.e9,-1.e9};
   //
-  const float *coord[3] = {fkPoints->GetX(),fkPoints->GetY(),fkPoints->GetZ()};
+  const float *coord[3] = {fPoints->GetX(),fPoints->GetY(),fPoints->GetZ()};
   for (int i=fPntFirst;i<=fPntLast;i++) {
     for (int j=3;j--;) {
       Double_t val = coord[j][i];
@@ -839,9 +840,9 @@ void AliITSTPArrayFit::GetResiduals(Double_t *res,Int_t ipnt) const
     return;
   }
   GetPosition(res,fCurT[ipnt]);
-  res[kX] -= fkPoints->GetX()[ipnt];
-  res[kY] -= fkPoints->GetY()[ipnt];
-  res[kZ] -= fkPoints->GetZ()[ipnt];
+  res[kX] -= fPoints->GetX()[ipnt];
+  res[kY] -= fPoints->GetY()[ipnt];
+  res[kZ] -= fPoints->GetZ()[ipnt];
 }
 
 //________________________________________________________________________________________________________
@@ -950,7 +951,7 @@ Bool_t AliITSTPArrayFit::FitHelixCrude(Int_t extQ)
   int np = fPntLast - fPntFirst + 1;
   if (np<3) { AliError("At least 3 points are needed for helix fit"); return kFALSE; }
   //
-  const float *x=fkPoints->GetX(),*y=fkPoints->GetY(),*z=fkPoints->GetZ(),*cov=fkPoints->GetCov();
+  const float *x=fPoints->GetX(),*y=fPoints->GetY(),*z=fPoints->GetZ(),*cov=fPoints->GetCov();
   //
   // linear circle fit --------------------------------------------------- >>>
   Double_t sxx=0,sxy=0,syy=0,sx=0,sy=0,rhs0=0,rhs1=0,rhs2=0,minR=1E9;
@@ -975,8 +976,8 @@ Bool_t AliITSTPArrayFit::FitHelixCrude(Int_t extQ)
     if (xxyyGetVolumeID()[i];
-      if (volid>0) lrid = fgkActiveLrITS[AliGeomManager::VolUIDToLayer(fkPoints->GetVolumeID()[i])-1];
+      int lrid,volid = fPoints->GetVolumeID()[i];
+      if (volid>0) lrid = fgkActiveLrITS[AliGeomManager::VolUIDToLayer(fPoints->GetVolumeID()[i])-1];
       else { // missing layer info, find from radius
 	double r = TMath::Sqrt(xxyy);
 	for (lrid=kMaxLrITS;lrid--;) if ( IsZero(r-fgkRLayITS[ lrid ],1.) ) break;
@@ -1154,7 +1155,7 @@ Bool_t AliITSTPArrayFit::FitHelixCrude(Int_t extQ)
 	normS[1] = -TMath::Sin(php);
 	normS[2] = 0;
       }
-      else GetNormal(normS,fkPoints->GetCov()+tID*6);   // vector normal to hit module
+      else GetNormal(normS,fPoints->GetCov()+tID*6);   // vector normal to hit module
       fElsDR[tID] = GetDRofELoss(t,cdip,fElsDR[tID],normS,ptot,etot);
     }
     //
@@ -1172,7 +1173,7 @@ Bool_t AliITSTPArrayFit::FitHelixCrude(Int_t extQ)
 	normS[1] = -TMath::Sin(php);
 	normS[2] = 0;	
       }
-      else GetNormal(normS,fkPoints->GetCov()+tID*6);   // vector normal to hit module
+      else GetNormal(normS,fPoints->GetCov()+tID*6);   // vector normal to hit module
       //
       fElsDR[tID] = GetDRofELoss(t,cdip,fElsDR[tID],normS,ptot,etot);
     }
@@ -1289,7 +1290,7 @@ Double_t AliITSTPArrayFit::FitHelix(Int_t extQ, Double_t extPT,Double_t extPTerr
     AliDebug(2,Form("Max number of %d iteration reached, Current chi2:%.3e, chi2 change %+.3e",iter,
 		    fChi2NDF,chiprev-fChi2NDF));
     for (int ip=fPntFirst;ip<=fPntLast;ip++)
-      AliDebug(2,Form("P%2d| %+.3e %+.3e %+.3e\n",ip,fkPoints->GetX()[ip],fkPoints->GetY()[ip],fkPoints->GetZ()[ip]));
+      AliDebug(2,Form("P%2d| %+.3e %+.3e %+.3e\n",ip,fPoints->GetX()[ip],fPoints->GetY()[ip],fPoints->GetZ()[ip]));
 
   }
   fIter = iter;
@@ -1313,7 +1314,7 @@ Double_t AliITSTPArrayFit::FitLine()
   //
   if (fParAxis<0) SetParAxis(ChoseParAxis());
   //
-  const float *xyzp[3]={fkPoints->GetX(),fkPoints->GetY(),fkPoints->GetZ()};
+  const float *xyzp[3]={fPoints->GetX(),fPoints->GetY(),fPoints->GetZ()};
   if (!IsCovInv()) InvertPointsCovMat();
   if (!FitLineCrude()) return -1; // get initial estimate, ignoring the errors
   //
@@ -1379,7 +1380,7 @@ Double_t AliITSTPArrayFit::FitLine()
     AliDebug(2,Form("Max number of %d iteration reached, Current chi2:%.3e, chi2 change %+.3e",iter,
 		    fChi2NDF,chiprev-fChi2NDF));
     for (int ip=fPntFirst;ip<=fPntLast;ip++)
-      AliDebug(2,Form("P%2d| %+.3e %+.3e %+.3e\n",ip,fkPoints->GetX()[ip],fkPoints->GetY()[ip],fkPoints->GetZ()[ip]));
+      AliDebug(2,Form("P%2d| %+.3e %+.3e %+.3e\n",ip,fPoints->GetX()[ip],fPoints->GetY()[ip],fPoints->GetZ()[ip]));
   }
   fIter = iter;
   SetFitDone();
@@ -1469,10 +1470,8 @@ Double_t AliITSTPArrayFit::GetLineSlope(Int_t axis) const
 //_____________________________________________________________
 void AliITSTPArrayFit::Print(Option_t *) const
 {
-  // print results of the fit
-  //
   const char kCxyz[] = "XYZ";
-  if (!fkPoints) return;
+  if (!fPoints) return;
   //
   printf("Track of %3d points in Bz=%+.1f |Fit ",fPntLast-fPntFirst+1,fBz);
   if ( IsFitDone() ) {
@@ -1626,5 +1625,3 @@ Double_t AliITSTPArrayFit::CalcParPCA(Int_t ipnt) const
   if (IsFieldON()) return GetParPCAHelix(xyz,covI);
   else             return GetParPCALine(xyz,covI);
 }
-
-
diff --git a/ITS/AliITSTPArrayFit.h b/ITS/AliITSTPArrayFit.h
index 869ba5ea63f..8f85913f5b0 100644
--- a/ITS/AliITSTPArrayFit.h
+++ b/ITS/AliITSTPArrayFit.h
@@ -61,7 +61,7 @@ class AliITSTPArrayFit : public TObject
   //
   void          AttachPoints(const AliTrackPointArray* points, Int_t pfirst=-1,Int_t plast=-1);
   Bool_t        SetFirstLast(Int_t pfirst=-1,Int_t plast=-1);
-  AliTrackPointArray* GetPoints()                           const {return (AliTrackPointArray*)fkPoints;}
+  AliTrackPointArray* GetPoints()                           const {return (AliTrackPointArray*)fPoints;}
   //
   void          SetBz(Double_t bz)                                {fBz = bz;}
   Double_t      GetBz()                                     const {return fBz;}
@@ -158,6 +158,7 @@ class AliITSTPArrayFit : public TObject
   //
  protected:
   void          InitAux();
+  Double_t      GetMachinePrec();
   Int_t         ChoseParAxis()                                              const;
   Double_t      GetParPCALine(const Double_t *xyz, const Double_t *covI=0)  const;
   Double_t      GetParPCAHelix(const Double_t *xyz, const Double_t *covI=0) const;
@@ -170,10 +171,10 @@ class AliITSTPArrayFit : public TObject
   Double_t      GetDRofELoss(Double_t t,Double_t cdip,Double_t rhoL,
 			     const Double_t *normS, Double_t &p,Double_t &e) const;
   static Bool_t IsZero(Double_t v,Double_t threshold = 1e-16)     {return TMath::Abs(v)GetX()[ip];
-  xyz[kY] = fkPoints->GetY()[ip];
-  xyz[kZ] = fkPoints->GetZ()[ip];
+  xyz[kX] = fPoints->GetX()[ip];
+  xyz[kY] = fPoints->GetY()[ip];
+  xyz[kZ] = fPoints->GetZ()[ip];
   return &xyz[0];
 }
 
@@ -252,4 +253,3 @@ inline Double_t AliITSTPArrayFit::Fit(Int_t extQ,Double_t extPT,Double_t extPTer
 
 
 #endif
-
diff --git a/ITS/AliITSVertexerZ.cxx b/ITS/AliITSVertexerZ.cxx
index 27fcad25bdc..a1051a270ac 100644
--- a/ITS/AliITSVertexerZ.cxx
+++ b/ITS/AliITSVertexerZ.cxx
@@ -309,12 +309,11 @@ void AliITSVertexerZ::VertexZFinder(TTree *itsClusterTree){
   if(hc->GetBinContent(hc->GetMaximumBin())<3)hc->Rebin(4);
   Int_t binmin,binmax;
   Int_t nPeaks=GetPeakRegion(hc,binmin,binmax);   
-  if(nPeaks==2)AliDebug(2,"2 peaks found");
+  if(nPeaks==2)AliWarning("2 peaks found");
   Float_t zm =0.;
   Float_t ezm =0.;
   Float_t lim1 = hc->GetBinLowEdge(binmin);
   Float_t lim2 = hc->GetBinLowEdge(binmax)+hc->GetBinWidth(binmax);
-  Float_t widthSR=lim2-lim1;
 
   if(nPeaks ==1 && (lim2-lim1)fTolerance);
-  if(nPeaks==2) ezm=widthSR;
   fCurrentVertex = new AliESDVertex(zm,ezm,ncontr);
   fCurrentVertex->SetTitle("vertexer: Z");
   fCurrentVertex->SetDispersion(fDiffPhiMax);
diff --git a/ITS/AliITStrackerMI.cxx b/ITS/AliITStrackerMI.cxx
index f586de63b26..8a3e2fbb3cc 100644
--- a/ITS/AliITStrackerMI.cxx
+++ b/ITS/AliITStrackerMI.cxx
@@ -4290,8 +4290,7 @@ void AliITStrackerMI::SetForceSkippingOfLayer() {
     if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(l)) fForceSkippingOfLayer[l] = 1;
     // check run info
 
-    if(eventInfo && 
-       AliITSReconstructor::GetRecoParam()->GetSkipSubdetsNotInTriggerCluster()) {
+    if(eventInfo) {
       AliDebug(2,Form("GetEventInfo->GetTriggerCluster: %s",eventInfo->GetTriggerCluster()));
       if(l==0 || l==1)  {
 	if(!strstr(eventInfo->GetTriggerCluster(),"ITSSPD")) fForceSkippingOfLayer[l] = 1;
diff --git a/ITS/AnalyzeSDDInjectorsAllMod.C b/ITS/AnalyzeSDDInjectorsAllMod.C
index 792e75769bc..f94e99eba1e 100644
--- a/ITS/AnalyzeSDDInjectorsAllMod.C
+++ b/ITS/AnalyzeSDDInjectorsAllMod.C
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -32,7 +31,7 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
 			       Int_t adcfreq=20, 
 			       Int_t nDDL=0, 
 			       Int_t firstEv=18, 
-			       Int_t lastEv=30,
+			       Int_t lastEv=20,
 			       Int_t jpad=20, 
 			       Int_t statuscut=7){
 
@@ -45,15 +44,10 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
   AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD();
   dmap->SetJun09Map();
 
-  TNtuple* ntsp=new TNtuple("ntsp","","mod:sid:an:stat:vall:v23:v13:v12:c1:c2:c3");
-  Float_t xnt[11];
   TH2F** histo = new TH2F*[kTotDDL*kModPerDDL*kSides];
   Int_t nWrittenEv[kTotDDL*kModPerDDL*kSides];
   TGraphErrors** gvel = new TGraphErrors*[kTotDDL*kModPerDDL*kSides];
   AliITSOnlineSDDInjectors **anal=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
-  AliITSOnlineSDDInjectors **anal23=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
-  AliITSOnlineSDDInjectors **anal13=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
-  AliITSOnlineSDDInjectors **anal12=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
   TH1F** hvdriftl=new TH1F*[260];  
   TH1F** hvdriftr=new TH1F*[260];  
   Char_t hisnam[20];
@@ -68,27 +62,10 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
       for(Int_t isid=0;isidSet40MHzConfig();
 	else anal[index]->Set20MHzConfig();
-
-	anal23[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid);
-	if(adcfreq==40) anal23[index]->Set40MHzConfig();
-	else anal23[index]->Set20MHzConfig();
-	anal23[index]->SetUseLine(0,kFALSE);
-
-	anal13[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid);
-	if(adcfreq==40) anal13[index]->Set40MHzConfig();
-	else anal13[index]->Set20MHzConfig();
-	anal13[index]->SetUseLine(1,kFALSE);
-
-	anal12[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid);
-	if(adcfreq==40) anal12[index]->Set40MHzConfig();
-	else anal12[index]->Set20MHzConfig();
-	anal12[index]->SetUseLine(2,kFALSE);
-
 	nWrittenEv[index]=0;
       }
     }
@@ -165,12 +142,9 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
 	for(Int_t isid=0;isidAnalyzeEvent(histo[index]); 
-	  anal23[index]->AnalyzeEvent(histo[index]); 
-	  anal13[index]->AnalyzeEvent(histo[index]); 
-	  anal12[index]->AnalyzeEvent(histo[index]); 
 	  nWrittenEv[index]++;
 	  Int_t iMod=dmap->GetModuleNumber(iddl,imod);
-	  if(iMod!=-1){	    
+	  if(iMod!=-1){
 	    for(Int_t ipad=0;ipad<33;ipad++){
 	      Int_t st=anal[index]->GetInjPadStatus(ipad);
 	      hanst->Fill(st);
@@ -178,18 +152,6 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
 		if(isid==0) hpad7l->Fill(ipad);
 		if(isid==1) hpad7r->Fill(ipad);
 	      }
-	      xnt[0]=(Float_t)iMod;
-	      xnt[1]=(Float_t)isid;
-	      xnt[2]=(Float_t)ipad;
-	      xnt[3]=(Float_t)st;
-	      xnt[4]=anal[index]->GetDriftSpeed(ipad);
-	      xnt[5]=anal23[index]->GetDriftSpeed(ipad);
-	      xnt[6]=anal13[index]->GetDriftSpeed(ipad);
-	      xnt[7]=anal12[index]->GetDriftSpeed(ipad);
-	      xnt[8]=anal[index]->GetCentroid(ipad,0);
-	      xnt[9]=anal[index]->GetCentroid(ipad,1);
-	      xnt[10]=anal[index]->GetCentroid(ipad,2);
-	      ntsp->Fill(xnt);
 	    }
 	    if(anal[index]->GetInjPadStatus(jpad)>=statuscut){
 	      Float_t vel=anal[index]->GetDriftSpeed(jpad);
@@ -244,7 +206,7 @@ void AnalyzeSDDInjectorsAllMod(Char_t *datafil,
   hpad7l->Scale(nfac);
   hpad7r->Scale(nfac);
 
-  TFile *outfil1=new TFile("DriftSpeedVsAnode.root","recreate");  
+  TFile *outfil1=new TFile("DriftSpeedVsAnode.root","recreate");
   for(Int_t iddl=0; iddlWrite();
   for(Int_t iMod=0; iMod<260; iMod++){
     outfil->cd();
     hvdriftl[iMod]->Write();    
diff --git a/ITS/ITSSDDBASda.cxx b/ITS/ITSSDDBASda.cxx
index e36874059ba..6a4546b9f7e 100644
--- a/ITS/ITSSDDBASda.cxx
+++ b/ITS/ITSSDDBASda.cxx
@@ -1,6 +1,6 @@
 /*
 - Contact: - prino@to.infn.it
-- Link: - alien:///alice/data/2009/LHC09c_SDD/000079094/raw/09000079094024.10.root
+- Link: - http://www.to.infn.it/~prino/alice/RawData/run11161.date
 - Run Type: - PEDESTAL_RUN
 - DA Type: - LDC
 - Number of events needed: > 10
diff --git a/ITS/ITSSDDGAINda.cxx b/ITS/ITSSDDGAINda.cxx
index a3df1967c52..36aea049d0c 100644
--- a/ITS/ITSSDDGAINda.cxx
+++ b/ITS/ITSSDDGAINda.cxx
@@ -1,10 +1,10 @@
 /*
 - Contact: - prino@to.infn.it
-- Link: - alien:///alice/data/2009/LHC09c_SDD/000079095/raw/09000079095024.10.root
+- Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date
 - Run Type: - PULSER_RUN
 - DA Type: - LDC
 - Number of events needed: >15
-- Input Files: - SDDbase_step1_ddl*c*_sid*.data (output of previous PEDESTAL run)
+- Input Files: - SDDbase_step1_ddl*c*_sid*.data
 - Output Files: - SDDbase_ddl*c*_sid*.data
 - Trigger types used: 
 */
diff --git a/ITS/ITSSDDINJda.cxx b/ITS/ITSSDDINJda.cxx
index 542be76ca64..12e4b4bdc98 100644
--- a/ITS/ITSSDDINJda.cxx
+++ b/ITS/ITSSDDINJda.cxx
@@ -1,6 +1,6 @@
 /*
 - Contact: - prino@to.infn.it
-- Link: - alien:///alice/data/2009/LHC09c_SDD/000079098/raw/09000079098024.10.root
+- Link: -
 - Run Type: - INJECTOR
 - DA Type: - LDC
 - Number of events needed: >20
diff --git a/MUON/AliMUONTriggerEfficiencyCells.cxx b/MUON/AliMUONTriggerEfficiencyCells.cxx
index bac6f88a0e5..652449d9f14 100755
--- a/MUON/AliMUONTriggerEfficiencyCells.cxx
+++ b/MUON/AliMUONTriggerEfficiencyCells.cxx
@@ -93,7 +93,7 @@ fFiredDisplayHistoList(0x0)
 }
 
 //__________________________________________________________________________
-AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const Char_t* filename, const Char_t* listname)
+AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const Char_t* filename)
 :
 TObject(),
 fCountHistoList(0x0),
@@ -108,7 +108,7 @@ fFiredDisplayHistoList(0x0)
   CheckConstants();
   Reset();
   InitHistos();
-  ReadFile(filename, listname);
+  ReadFile(filename);
 }
 
 
@@ -181,6 +181,9 @@ AliMUONTriggerEfficiencyCells& AliMUONTriggerEfficiencyCells::operator=(const Al
 AliMUONTriggerEfficiencyCells::~AliMUONTriggerEfficiencyCells()
 {
 ///  Destructor.
+
+  delete [] fBoardEfficiency;
+  delete [] fSlatEfficiency;
   Reset();
 }
 
@@ -214,13 +217,13 @@ AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bo
 
 
 //__________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::ReadFile(const Char_t* filename, const Char_t* listname)
+void AliMUONTriggerEfficiencyCells::ReadFile(const Char_t* filename)
 {
 ///  Reads a file containing the efficiency map.
 
   TString fileName = gSystem->ExpandPathName(filename);
   if(fileName.EndsWith(".root")){
-      ReadHistoBoards(fileName.Data(), listname);
+      ReadHistoBoards(fileName.Data());
       return;
   }
 
@@ -263,7 +266,7 @@ void AliMUONTriggerEfficiencyCells::ReadFileBoards(ifstream &file)
 
 
 //__________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, const Char_t* listname)
+void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename)
 {
 ///  Structure of file (.root) containing local board efficency
     TFile *file = new TFile(filename, "read");
@@ -277,31 +280,19 @@ void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, cons
     enum {kAllChEff, kChNonEff, kNumOfHistoTypes};
     TString histoTypeName[2] = {"CountInCh", "NonCountInCh"};
 
-    if ( ! fCountHistoList ) {
-      fCountHistoList = new TList();
-      fCountHistoList->SetOwner();
-    }
+    if(!fCountHistoList) fCountHistoList = new TList();
     else fCountHistoList->Delete();
-    if( ! fNoCountHistoList) {
-      fNoCountHistoList = new TList();
-      fNoCountHistoList->SetOwner();
-    }
+    if(!fNoCountHistoList) fNoCountHistoList = new TList();
     else fNoCountHistoList->Delete();
 
     TList *currList[2] = {fCountHistoList, fNoCountHistoList};
 
     TH1F *histo = 0x0;
-
-    TList* listInFile = 0x0;
-    TString listNameString(listname);
-    if ( ! listNameString.IsNull() )
-      listInFile = (TList*)file->Get(listname);
     
     for(Int_t cath=0; cathFindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
-	histo->SetDirectory(0);
+	histo = (TH1F*)file->Get(histoName.Data());
 	currList[hType]->Add(histo);
       }
     }
@@ -310,8 +301,7 @@ void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, cons
       for(Int_t ch=0; chFindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
-	  histo->SetDirectory(0);
+	  histo = (TH1F*)file->Get(histoName.Data());
 	  currList[hType]->Add(histo);
 	}
       }
@@ -321,15 +311,12 @@ void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, cons
       for(Int_t ch=0; chFindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
-	  histo->SetDirectory(0);
+	  histo = (TH1F*)file->Get(histoName.Data());
 	  currList[hType]->Add(histo);
 	}
       }
     }
 
-    file->Close();
-
     FillHistosFromList();
 }
 
diff --git a/MUON/AliMUONTriggerEfficiencyCells.h b/MUON/AliMUONTriggerEfficiencyCells.h
index fd8a64710cf..bb48381332e 100755
--- a/MUON/AliMUONTriggerEfficiencyCells.h
+++ b/MUON/AliMUONTriggerEfficiencyCells.h
@@ -21,7 +21,7 @@ class AliMUONTriggerEfficiencyCells : public TObject
 {
 public:
   AliMUONTriggerEfficiencyCells();
-  AliMUONTriggerEfficiencyCells(const Char_t* filename, const Char_t* listname="triggerChamberEff");
+  AliMUONTriggerEfficiencyCells(const Char_t* filename);
   AliMUONTriggerEfficiencyCells(TList *countHistoList, TList *noCountHistoList);
 
   AliMUONTriggerEfficiencyCells(const AliMUONTriggerEfficiencyCells& other); // copy constructor
@@ -47,7 +47,7 @@ class AliMUONTriggerEfficiencyCells : public TObject
                            // syntomatic of possible read-out problems in boards
 protected:
     void Reset(Bool_t resetAll = kTRUE);
-    void ReadFile(const Char_t* filename="$ALICE_ROOT/MUON/data/efficiencyCells.dat", const Char_t* listname="");
+    void ReadFile(const Char_t* filename="$ALICE_ROOT/MUON/data/efficiencyCells.dat");
     void CalculateEfficiency(Int_t trigger44, Int_t trigger34,
 			     Float_t &efficiency, Float_t &error,
 			     Bool_t failuresAsInput);
@@ -57,7 +57,7 @@ class AliMUONTriggerEfficiencyCells : public TObject
     void CheckConstants() const;
     Int_t FindChamberIndex(Int_t detElemId) const;
     void ReadFileBoards(ifstream &file);
-    void ReadHistoBoards(const Char_t* filename="MUON.TriggerEfficiencyMap.root", const Char_t* listname="triggerChamberEff");
+    void ReadHistoBoards(const Char_t* filename="MUON.TriggerEfficiencyMap.root");
     void InitHistos();
     void FillHistosFromList(Bool_t useMeanValues = kFALSE);
     Bool_t GetListsForCheck();
diff --git a/MUON/AliMUONTriggerIO.cxx b/MUON/AliMUONTriggerIO.cxx
index 86184b0ee52..bc6a4cf0360 100644
--- a/MUON/AliMUONTriggerIO.cxx
+++ b/MUON/AliMUONTriggerIO.cxx
@@ -686,23 +686,32 @@ AliMUONTriggerIO::WriteLocalMasks(const char* localFile, AliMUONVStore& localMas
     }   
 
     UShort_t maskBuffer[8];
-    Int_t localBoardIndex(0);
-    while (localBoardIndex < NofLocalBoards()) {
 
-      Int_t localBoardId = fRegionalTrigger.LocalBoardId(localBoardIndex);
+    TIter next(regionalConfig->CreateCrateIterator());
+    AliMUONTriggerCrateConfig* crate;
+    
+    while ( ( crate = static_cast(next()) ) )
+    {      
+      UShort_t mask = crate->GetMask(); // getting mask from current config
 
-      AliMUONVCalibParam* localMask = 
-	static_cast(localMasks.FindObject(localBoardId));
+      for (Int_t iLocal = 0; iLocal < crate->GetNofLocalBoards(); ++iLocal) 
+      {
+	Int_t localBoardId = crate->GetLocalBoardId(iLocal);
 
-      for (Int_t index = 0; index < 8; ++index) 
+	if ( (mask >> iLocal ) & 0x1 ) 
 	{
-	  maskBuffer[index] = localMask->ValueAsInt(index,0); 
-	}
-      
-      fwrite ( maskBuffer, 2, 8, fp); 
+	  AliMUONVCalibParam* localMask = 
+	      static_cast(localMasks.FindObject(localBoardId));
+
+	  for (Int_t index = 0; index < 8; ++index) 
+	  {
+	    maskBuffer[index] = localMask->ValueAsInt(index,0); 
+	  }
 
-      ++localBoardIndex;
+	  fwrite ( maskBuffer, 2, 8, fp); 
+	}
 
+      }
     }
 
     fclose(fp);
diff --git a/MUON/MUONTRGda.cxx b/MUON/MUONTRGda.cxx
index fe290175d3f..d3c02f05026 100644
--- a/MUON/MUONTRGda.cxx
+++ b/MUON/MUONTRGda.cxx
@@ -40,30 +40,27 @@ extern "C" {
 #include 
 #include 
 
+//AliRoot
 #include "AliRawReaderDate.h"
 
 #include "AliMpConstants.h"
 #include "AliMUONRawStreamTrigger.h"
 #include "AliMUONRawStreamTriggerHP.h"
 #include "AliMUONDarcHeader.h"
-#include "AliMUONRegHeader.h"
 #include "AliMUONDDLTrigger.h"
 #include "AliMUONVStore.h"
 #include "AliMUON1DArray.h"
 #include "AliMUONTriggerIO.h"
 #include "AliMUONRegionalTriggerConfig.h"
 #include "AliMUONGlobalCrateConfig.h"
-#include "AliMUONVCalibParam.h"
-#include "AliMUONCalibParamND.h"
-#include "AliMUONCalibParamNI.h"
-#include "AliMUONLocalStruct.h"
+#include "AliMUONTriggerCrateConfig.h"
 
+//ROOT
 #include "TString.h"
 #include "TSystem.h"
 #include "TStopwatch.h"
 #include "TROOT.h"
 #include "TPluginManager.h"
-#include "TArrayS.h"
 
 /// class for DA run parameters and DA working space
 class AliDAConfig : TObject {
@@ -78,7 +75,6 @@ class AliDAConfig : TObject {
     fSodFlag(0),
     fDAName(""),
     fDAFlag(0),
-    fDAMode(1),
     fGlobalFileName(""),
     fRegionalFileName(""),
     fLocalMaskFileName(""),
@@ -97,24 +93,19 @@ class AliDAConfig : TObject {
     fEventsD(0),
     fPrintLevel(0),
     fLocalMasks(0x0),
-    fLocalMasksDA(0x0),
     fRegionalMasks(0x0),
     fGlobalMasks(0x0),
     fTriggerIO(new AliMUONTriggerIO),
-    fAlgoNoisyInput(kFALSE),
-    fAlgoDeadcInput(kFALSE),
+    fAlgoNoisyInput(false),
+    fAlgoDeadcInput(false),
     fThrN(0.1),
     fThrD(0.9),
-    fThrLocN(0.1),
-    fThrLocD(0.9),
     fMinEvents(10),
     fSkipEvents(0),
     fMaxEvents(65535),
-    fWithWarnings(kFALSE),
-    fUseFastDecoder(kFALSE),
-    fNLocalBoard(AliMpConstants::TotalNofLocalBoards()+1),
-    fPatternStoreN(0x0),
-    fPatternStoreD(0x0)
+    fWithWarnings(false),
+    fUseFastDecoder(false),
+    fNLocalBoard(AliMpConstants::TotalNofLocalBoards()+1)
   {
     /// default constructor
     for (Int_t ii = 0; ii < kGlobalInputs; ii++) {
@@ -124,35 +115,16 @@ class AliDAConfig : TObject {
       }
     }
     fLocalMasks    = new AliMUON1DArray(fNLocalBoard);
-    fLocalMasksDA  = new AliMUON1DArray(fNLocalBoard);
     fRegionalMasks = new AliMUONRegionalTriggerConfig();
     fGlobalMasks   = new AliMUONGlobalCrateConfig();
-    fPatternStoreN = new AliMUON1DArray(fNLocalBoard);
-    fPatternStoreD = new AliMUON1DArray(fNLocalBoard);
-
-    // Generate local trigger masks store. All masks are set to FFFF
-    for (Int_t i = 1; i <= AliMpConstants::TotalNofLocalBoards(); i++) {
-      AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8,i,0,0);
-      for (Int_t x = 0; x < 2; x++) {
-	for (Int_t y = 0; y < 4; y++) {
-	  Int_t index = x*4+y;
-	  localBoard->SetValueAsInt(index,0,0xFFFF);
-	}
-      }
-      fLocalMasksDA->Add(localBoard);
-    }
-    
   }
 
   virtual ~AliDAConfig()
   {
     /// destructor
     delete fLocalMasks;
-    delete fLocalMasksDA;
     delete fRegionalMasks;
     delete fGlobalMasks; 
-    delete fPatternStoreN;
-    delete fPatternStoreD;
     delete fTriggerIO;
   }
   void PrintConfig()
@@ -184,8 +156,6 @@ class AliDAConfig : TObject {
   const Char_t* GetDAName() { return fDAName.Data(); }
      /// flag value of the Detector Algorithm field in MtgCurrent.dat
   Int_t GetDAFlag() const { return fDAFlag; }
-     /// DA active mode (GLOBAL or GLOBAL+LOCAL)
-  Int_t GetDAMode() const { return fDAMode; }
 
      /// global crate configuration file name
   const Char_t* GetGlobalFileName()    { return fGlobalFileName.Data(); }
@@ -220,8 +190,6 @@ class AliDAConfig : TObject {
 
      /// store for the masks for the local cards (own)
   AliMUONVStore*                GetLocalMasks()    const { return fLocalMasks; }
-     /// store for the DA-calculated masks for the local cards (own)
-  AliMUONVStore*                GetLocalMasksDA()  const { return fLocalMasksDA; }
      /// configuration object for the regional crate (own)
   AliMUONRegionalTriggerConfig* GetRegionalMasks() const { return fRegionalMasks; }
      /// configuration object for the global crate (own)
@@ -230,11 +198,6 @@ class AliDAConfig : TObject {
      /// read/write configurations, masks and LUT to/from online files (own)
   AliMUONTriggerIO* GetTriggerIO() const { return fTriggerIO; }
 
-     /// store for local strips patterns (noisy strips)
-  AliMUONVStore* GetPatternStoreN() const { return fPatternStoreN; }
-     /// store for local strips patterns (dead strips)
-  AliMUONVStore* GetPatternStoreD() const { return fPatternStoreD; }
-
      /// number of accumulated PHYSICS events for noisy channels analysis
   Int_t GetEventsN() const { return fEventsN; }
      /// number of accumulated CALIBRATION events for dead channels analysis
@@ -248,14 +211,10 @@ class AliDAConfig : TObject {
      /// select CALIBRATION events for dead channels analysis
   Bool_t GetAlgoDeadcInput() const { return fAlgoDeadcInput; }
 
-     /// threshold for noisy global inputs (fraction of events)
+     /// threshold for noisy inputs (fraction of events)
   Float_t GetThrN() const { return fThrN; }
-     /// threshold for dead global inputs (fraction of events)
+     /// threshold for dead inputs (fraction of events)
   Float_t GetThrD() const { return fThrD; }
-     /// threshold for noisy local strips (fraction of events)
-  Float_t GetThrLocN() const { return fThrLocN; }
-     /// threshold for dead local strips (fraction of events)
-  Float_t GetThrLocD() const { return fThrLocD; }
 
      /// minumum nr of events for rate calculation
   Int_t GetMinEvents()  const { return fMinEvents; }
@@ -288,8 +247,6 @@ class AliDAConfig : TObject {
   void SetDAName(Char_t *name) { fDAName = TString(name); }
      /// set the flag value of the Detector Algorithm field in MtgCurrent.dat
   void SetDAFlag(Int_t flag)   { fDAFlag = flag; }
-     /// set DA active mode, 1 = GLOBAL (default), 2 = GLOBAL and LOCAL
-  void SetDAMode(Int_t mode)   { fDAMode = mode; }
 
      /// set the global crate configuration file name
   void SetGlobalFileName(const Char_t *name)    { fGlobalFileName = TString(name); }
@@ -340,14 +297,10 @@ class AliDAConfig : TObject {
      /// select CALIBRATION events for dead channels analysis
   void SetAlgoDeadcInput(Bool_t val) { fAlgoDeadcInput = val; }
 
-     /// set the threshold for noisy global inputs (fraction of events)
+     /// set the threshold for noisy inputs (fraction of events)
   void SetThrN(Float_t val) { fThrN = val; }
-     /// set the threshold for dead global inputs (fraction of events)
+     /// set the threshold for dead inputs (fraction of events)
   void SetThrD(Float_t val) { fThrD = val; }
-     /// set the threshold for noisy local strips (fraction of events)
-  void SetThrLocN(Float_t val) { fThrLocN = val; }
-     /// set the threshold for dead local strips (fraction of events)
-  void SetThrLocD(Float_t val) { fThrLocD = val; }
 
      /// set the minumum nr of events for rate calculation
   void SetMinEvents(Int_t val)  { fMinEvents = val; }
@@ -357,14 +310,12 @@ class AliDAConfig : TObject {
   void SetSkipEvents(Int_t val) { fSkipEvents = val; }
 
      /// set/unset to show warnings from the raw data decoder
-  void SetWithWarnings() { fWithWarnings = kTRUE; }
+  void SetWithWarnings() { fWithWarnings = true; }
      /// set/unset the use of the high-performance (HP) decoder
-  void SetUseFastDecoder() { fUseFastDecoder = kTRUE; }
+  void SetUseFastDecoder() { fUseFastDecoder = true; }
 
     /// increment version of the global crate configuration file
   void IncGlobalFileVersion() { fGlobalFileVersion++; }
-    /// increment version of the local mask configuration file
-  void IncLocalMaskFileVersion() { fLocalMaskFileVersion++; }
     /// count skipped events
   void DecSkipEvents() { fSkipEvents--; }
 
@@ -384,13 +335,12 @@ class AliDAConfig : TObject {
 
   TString fDAName;  //!< name of the Detector Algorithm field in MtgCurrent.dat 
   Int_t   fDAFlag;  //!< flag value of the Detector Algorithm field in MtgCurrent.dat (enabled/disabled)
-  Int_t   fDAMode;  //!< DA active mode, GLOBAL or GLOBAL+LOCAL
 
-  TString fGlobalFileName;      //!< global crate configuration, file name
-  TString fRegionalFileName;    //!< regional crate configuration, file name
-  TString fLocalMaskFileName;   //!< masks for the local cards, file name
-  TString fLocalLutFileName;    //!< transverse momentum Look-Up-Table, file name
-  TString fSignatureFileName;   //!< signature file name
+  TString fGlobalFileName;    //!< global crate configuration, file name
+  TString fRegionalFileName;  //!< regional crate configuration, file name
+  TString fLocalMaskFileName; //!< masks for the local cards, file name
+  TString fLocalLutFileName;  //!< transverse momentum Look-Up-Table, file name
+  TString fSignatureFileName; //!< signature file name
 
   Int_t   fGlobalFileVersion;    //!< version of the global crate configuration in the detector DB
   Int_t   fRegionalFileVersion;  //!< version of the regional crate configuration in the detector DB
@@ -409,7 +359,6 @@ class AliDAConfig : TObject {
   Int_t   fPrintLevel;  //!< print verbosity of the DA
 
   AliMUONVStore*                fLocalMasks;    //!< store for the masks for the local cards
-  AliMUONVStore*                fLocalMasksDA;  //!< store for the DA-calculated masks for the local cards
   AliMUONRegionalTriggerConfig* fRegionalMasks; //!< configuration object for the regional crate
   AliMUONGlobalCrateConfig*     fGlobalMasks;   //!< configuration object for the global crate
 
@@ -418,10 +367,8 @@ class AliDAConfig : TObject {
   Bool_t fAlgoNoisyInput; //!< select PHYSICS events for noisy channels analysis
   Bool_t fAlgoDeadcInput; //!< select CALIBRATION events for dead channels analysis
 
-  Float_t fThrN;           //!< threshold for noisy global inputs (fraction of events)
-  Float_t fThrD;           //!< threshold for dead global inputs (fraction of events)
-  Float_t fThrLocN;        //!< threshold for noisy local strips (fraction of events)
-  Float_t fThrLocD;        //!< threshold for dead local strips (fraction of events)
+  Float_t fThrN;           //!< threshold for noisy inputs (fraction of events)
+  Float_t fThrD;           //!< threshold for dead inputs (fraction of events)
   Int_t   fMinEvents;      //!< minumum nr of events for rate calculation
   Int_t   fSkipEvents;     //!< number of events to skip from start
   Int_t   fMaxEvents;      //!< maximum number of events to analyze
@@ -434,9 +381,6 @@ class AliDAConfig : TObject {
 	 kGlobalInputLength = 32    //!< length in bits of a global input word
   };
 
-  AliMUONVStore *fPatternStoreN; //! store for local strips patterns
-  AliMUONVStore *fPatternStoreD; //! store for local strips patterns
-
   Int_t fAccGlobalInputN[kGlobalInputs][kGlobalInputLength]; //!< storage for global input (PHYSICS events)
   Int_t fAccGlobalInputD[kGlobalInputs][kGlobalInputLength]; //!< storage for global input (CALIBRATION events)
 
@@ -454,7 +398,7 @@ Bool_t ReadDAConfig(AliDAConfig& cfg)
     std::ifstream in(gSystem->ExpandPathName(file.Data()));
     if (!in.good()) {
       printf("Cannot open DA configuration file %s ; use default values.\n",file.Data());
-      return kTRUE;
+      return true;
     }
 
     TString tmp;
@@ -508,25 +452,7 @@ Bool_t ReadDAConfig(AliDAConfig& cfg)
     tmp = tmp(0,pos);
     if (tmp.Atoi() != 0) cfg.SetUseFastDecoder();
     
-    in.getline(line,80);  
-    tmp = line;
-    pos = tmp.First(" ");
-    tmp = tmp(0,pos);
-    cfg.SetThrLocN(tmp.Atof());
-
-    in.getline(line,80);  
-    tmp = line;
-    pos = tmp.First(" ");
-    tmp = tmp(0,pos);
-    cfg.SetThrLocD(tmp.Atof());
-
-    in.getline(line,80);  
-    tmp = line;
-    pos = tmp.First(" ");
-    tmp = tmp(0,pos);
-    cfg.SetDAMode(tmp.Atoi());
-
-    return kTRUE;
+    return true;
 
 }
 
@@ -552,7 +478,7 @@ void WriteLastCurrentFile(AliDAConfig& cfg, TString currentFile)
 }
 
 //___________________________________________________________________________________________
-Bool_t ReadCurrentFile(AliDAConfig& cfg, TString currentFile, Bool_t lastCurrentFlag = kFALSE)
+Bool_t ReadCurrentFile(AliDAConfig& cfg, TString currentFile, Bool_t lastCurrentFlag = false)
 {
     /// read last current file name and version
 
@@ -565,7 +491,7 @@ Bool_t ReadCurrentFile(AliDAConfig& cfg, TString currentFile, Bool_t lastCurrent
     std::ifstream in(gSystem->ExpandPathName(file.Data()));
     if (!in.good()) {
       printf("Cannot open last current file %s\n",currentFile.Data());
-      return kFALSE;
+      return false;
     }
     
     // read SOD 
@@ -659,7 +585,7 @@ Bool_t ReadCurrentFile(AliDAConfig& cfg, TString currentFile, Bool_t lastCurrent
     if (cfg.GetPrintLevel()) printf("Lut File Name: %s version: %d\n", 
 				    cfg.GetSignatureFileName(), cfg.GetSignatureFileVersion());
 
-    return kTRUE;
+    return true;
 }
 
 //_____________
@@ -667,9 +593,9 @@ void ReadFileNames(AliDAConfig& cfg)
 {
   /// if last current file does not exist than read current file
 
-  if (!ReadCurrentFile(cfg,cfg.GetLastCurrentFileName(), kTRUE)) 
+  if (!ReadCurrentFile(cfg,cfg.GetLastCurrentFileName(), true)) 
     {
-      ReadCurrentFile(cfg,cfg.GetCurrentFileName(), kTRUE);
+      ReadCurrentFile(cfg,cfg.GetCurrentFileName(), true);
     } 
   
   // any case read current file
@@ -696,8 +622,8 @@ Bool_t ExportFiles(AliDAConfig& cfg)
     // update files
     Int_t status = 0;
 
-    Bool_t modified = kFALSE;
-    Bool_t globalExported = kFALSE;
+    Bool_t modified = false;
+    Bool_t globalExported = false;
 
     ofstream out;
     TString fileExp("ExportedFiles.dat");
@@ -706,23 +632,23 @@ Bool_t ExportFiles(AliDAConfig& cfg)
     out.open(fileExp.Data());
     if (!out.good()) {
 	printf("Failed to create file: %s\n",file.Data());
-	return kFALSE;
+	return false;
     }      
 
     // check if MtgLastCurrent.dat exists
     // if not, do initial export of all files
-    Bool_t initFES = kFALSE;
+    Bool_t initFES = false;
     if (gSystem->AccessPathName("MtgLastCurrent.dat"))
-      initFES = kTRUE;
+      initFES = true;
     if (initFES) printf("Copy all configuration files to the FES.\n");
 
     file = cfg.GetLocalMaskFileName();  
     if ((cfg.GetLocalMaskFileLastVersion() != cfg.GetLocalMaskFileVersion()) || initFES) {
-      modified = kTRUE;
+      modified = true;
       status = daqDA_FES_storeFile(file.Data(), "LOCAL");
       if (status) {
 	printf("Failed to export file: %s\n",cfg.GetLocalMaskFileName());
-	return kFALSE;
+	return false;
       }
       if(cfg.GetPrintLevel()) printf("Export file: %s\n",cfg.GetLocalMaskFileName());
       out << cfg.GetLocalMaskFileName() << endl;
@@ -730,11 +656,11 @@ Bool_t ExportFiles(AliDAConfig& cfg)
 
     file = cfg.GetLocalLutFileName();
     if ((cfg.GetLocalLutFileLastVersion() != cfg.GetLocalLutFileVersion()) || initFES) {
-      modified = kTRUE;
+      modified = true;
       status = daqDA_FES_storeFile(file.Data(), "LUT");
       if (status) {
 	printf("Failed to export file: %s\n",cfg.GetLocalLutFileName());
-	return kFALSE;
+	return false;
       }
       if(cfg.GetPrintLevel()) printf("Export file: %s\n",cfg.GetLocalLutFileName());
       out << cfg.GetLocalLutFileName() << endl;
@@ -743,12 +669,12 @@ Bool_t ExportFiles(AliDAConfig& cfg)
 
     file = cfg.GetGlobalFileName();
     if ((cfg.GetGlobalFileLastVersion() != cfg.GetGlobalFileVersion()) || modified || initFES) {
-      modified = kTRUE;
-      globalExported = kTRUE;
+      modified = true;
+      globalExported = true;
       status = daqDA_FES_storeFile(file.Data(), "GLOBAL");
       if (status) {
 	printf("Failed to export file: %s\n",cfg.GetGlobalFileName());
-	return kFALSE;
+	return false;
       }
       if(cfg.GetPrintLevel()) printf("Export file: %s\n",cfg.GetGlobalFileName());
       out << cfg.GetGlobalFileName() << endl;
@@ -759,7 +685,7 @@ Bool_t ExportFiles(AliDAConfig& cfg)
       status = daqDA_FES_storeFile(file.Data(), "REGIONAL");
       if (status) {
 	printf("Failed to export file: %s\n",cfg.GetRegionalFileName());
-	return kFALSE;
+	return false;
       }
       if(cfg.GetPrintLevel()) printf("Export file: %s\n",cfg.GetRegionalFileName());
       out << cfg.GetRegionalFileName() << endl;
@@ -770,7 +696,7 @@ Bool_t ExportFiles(AliDAConfig& cfg)
 	status = daqDA_FES_storeFile(file.Data(), "GLOBAL");
 	if (status) {
 	  printf("Failed to export file: %s\n",cfg.GetGlobalFileName());
-	  return kFALSE;
+	  return false;
 	}
 	if(cfg.GetPrintLevel()) printf("Export file: %s\n",cfg.GetGlobalFileName());
 	out << cfg.GetGlobalFileName() << endl;
@@ -784,14 +710,14 @@ Bool_t ExportFiles(AliDAConfig& cfg)
     status = daqDA_FES_storeFile(fileExp.Data(), "EXPORTED");
     if (status) {
       printf("Failed to export file: %s\n", fileExp.Data());
-      return kFALSE;
+      return false;
     }
     if(cfg.GetPrintLevel()) printf("Export file: %s\n",fileExp.Data());
 
     // write last current file
     WriteLastCurrentFile(cfg,cfg.GetLastCurrentFileName());
 
-    return kTRUE;
+    return true;
 }
 
 //__________________
@@ -813,7 +739,7 @@ Bool_t ImportFiles(AliDAConfig& cfg)
     status = daqDA_DB_getFile(cfg.GetDAConfigFileName(), cfg.GetDAConfigFileName());
     if (status) {
       printf("Failed to get DA config file from DB: %s\n",cfg.GetDAConfigFileName());
-      return kFALSE;
+      return false;
     }
  
     ReadDAConfig(cfg);
@@ -821,7 +747,7 @@ Bool_t ImportFiles(AliDAConfig& cfg)
     status = daqDA_DB_getFile(cfg.GetCurrentFileName(), cfg.GetCurrentFileName());
     if (status) {
       printf("Failed to get current config file from DB: %s\n",cfg.GetCurrentFileName());
-      return kFALSE;
+      return false;
     }
     
     ReadFileNames(cfg);
@@ -829,28 +755,28 @@ Bool_t ImportFiles(AliDAConfig& cfg)
     status = daqDA_DB_getFile(cfg.GetGlobalFileName(), cfg.GetGlobalFileName());
     if (status) {
       printf("Failed to get current config file from DB: %s\n", cfg.GetGlobalFileName());
-      return kFALSE;
+      return false;
     }
 
     status = daqDA_DB_getFile(cfg.GetRegionalFileName(), cfg.GetRegionalFileName());
     if (status) {
       printf("Failed to get current config file from DB: %s\n",cfg.GetRegionalFileName());
-      return kFALSE;
+      return false;
     }
 
     status = daqDA_DB_getFile(cfg.GetLocalMaskFileName(), cfg.GetLocalMaskFileName());
     if (status) {
       printf("Failed to get current config file from DB: %s\n",cfg.GetLocalMaskFileName());
-      return kFALSE;
+      return false;
     }
 
     status = daqDA_DB_getFile(cfg.GetLocalLutFileName(), cfg.GetLocalLutFileName());
     if (status) {
       printf("Failed to get current config file from DB: %s\n",cfg.GetLocalLutFileName());
-      return kFALSE;
+      return false;
     }
  
-    return kTRUE;
+    return true;
 }
 
 //_____________
@@ -904,26 +830,26 @@ void UpdateGlobalMasks(AliDAConfig& cfg)
 
   Float_t rateN = 0.0, rateD = 0.0;
   UInt_t gmask[4], omask;
-  Bool_t noise, deadc, withEvN, withEvD, updated = kFALSE;
+  Bool_t noise, deadc, withEvN, withEvD, updated = false;
 
   for (Int_t ii = 0; ii < cfg.GetGlobalInputs(); ii++) {
     gmask[ii] = 0;
 
     for (Int_t ib = 0; ib < cfg.GetGlobalInputLength(); ib++) {
       // lsb -> msb
-      noise = kFALSE;
-      deadc = kFALSE;
-      withEvN = kFALSE;
-      withEvD = kFALSE;
+      noise = false;
+      deadc = false;
+      withEvN = false;
+      withEvD = false;
       if (cfg.GetEventsN() > cfg.GetMinEvents()) {
 	rateN = (Float_t)cfg.GetAccGlobalInputN(ii,ib)/(Float_t)cfg.GetEventsN();
 	noise = (rateN > cfg.GetThrN());	
-	withEvN = kTRUE;
+	withEvN = true;
       }
       if (cfg.GetEventsD() > cfg.GetMinEvents()) {
 	rateD = (Float_t)cfg.GetAccGlobalInputD(ii,ib)/(Float_t)cfg.GetEventsD();
 	deadc = (rateD < cfg.GetThrD());
-	withEvD = kTRUE;
+	withEvD = true;
       }
       if (!withEvN && !withEvD) {
 	// - copy the bit from the old mask
@@ -985,7 +911,7 @@ void UpdateGlobalMasks(AliDAConfig& cfg)
     printf("Global mask [%1d] %08x \n",ii,gmask[ii]);
     omask = cfg.GetGlobalMasks()->GetGlobalMask(ii);
     if (gmask[ii] != omask) {
-      updated = kTRUE;
+      updated = true;
       cfg.GetGlobalMasks()->SetGlobalMask(ii,gmask[ii]);
     }
   }
@@ -1019,202 +945,6 @@ void UpdateGlobalMasks(AliDAConfig& cfg)
   
 }
 
-//______________________________________________________________
-void UpdateLocalMask(AliDAConfig& cfg, Int_t localBoardId, Int_t connector, Int_t strip) 
-{
-
-  /// update local strip mask
-
-  AliMUONVCalibParam* localMask = 
-    static_cast(cfg.GetLocalMasksDA()->FindObject(localBoardId));
-  
-  UShort_t mask = static_cast(localMask->ValueAsInt(connector,0)); 
-  
-  mask &= ~(0x1 << strip); // set strip mask to zero
-  
-  localMask->SetValueAsInt(connector, 0, mask);  
-
-}
-
-//______________________________________________________________
-void MakePattern(AliDAConfig& cfg, Int_t localBoardId, const TArrayS& xPattern, const TArrayS& yPattern) 
-{
-  /// calculate the hit map for each strip in x and y direction
-  
-  AliMUONVCalibParam* pat = 0x0;
-
-  if (cfg.GetAlgoNoisyInput())
-    pat = static_cast(cfg.GetPatternStoreN()->FindObject(localBoardId));
-  if (cfg.GetAlgoDeadcInput())
-    pat = static_cast(cfg.GetPatternStoreD()->FindObject(localBoardId));
-
-  if (!pat) {
-    pat = new AliMUONCalibParamND(2, 64, localBoardId, 0, 0.);
-    if (cfg.GetAlgoNoisyInput())
-      cfg.GetPatternStoreN()->Add(pat);	
-    if (cfg.GetAlgoDeadcInput())
-      cfg.GetPatternStoreD()->Add(pat);	
-  }
-
-  for (Int_t i = 0; i < 4; ++i) {
-    for (Int_t j = 0; j < 16; ++j) {
-	
-      Int_t xMask = xPattern[i];
-      Int_t yMask = yPattern[i];
-      
-      Int_t index = 16*i + j;
-      Double_t patOcc = 0.;
-      
-      if ( (xMask >> j ) & 0x1 ) {
-	patOcc  = pat->ValueAsDouble(index, 0) + 1.;
-	pat->SetValueAsDouble(index, 0, patOcc);
-      }
-      if ( (yMask >> j ) & 0x1 ) {
-	patOcc  = pat->ValueAsDouble(index, 1) + 1.;
-	pat->SetValueAsDouble(index, 1, patOcc);
-      }
-    }
-  }
-
-}
-
-//______________________________________________________________
-void MakePatternStore(AliDAConfig& cfg) 
-{
-  /// analyse patterns for local strips (calculate occupancy)
-  
-#ifdef OFFLINE
-  gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/db");
-#endif
-
-  AliMUONVCalibParam* pat;
-  Int_t localBoardId = 0;
-  Int_t nEventsN = 0, nEventsD = 0;  
-  UShort_t strip = 0;
-  Int_t connector = 0;
-  Bool_t updated = kFALSE;
-  
-  if (cfg.GetEventsN() > cfg.GetMinEvents()) {
-    nEventsN = cfg.GetEventsN();
-  }
-  if (cfg.GetEventsD() > cfg.GetMinEvents()) {
-    nEventsD = cfg.GetEventsD();
-  }
-
-  // noisy strips
-  if (nEventsN > 0) {
-
-    TIter next(cfg.GetPatternStoreN()->CreateIterator());
-
-    while ( ( pat = dynamic_cast(next() ) ) ) {
-      
-      localBoardId  = pat->ID0();
-      
-      for (Int_t index = 0; index < pat->Size(); index++) {
-	
-	Double_t patXOcc  = pat->ValueAsDouble(index, 0)/(Double_t)nEventsN;
-	Double_t patYOcc  = pat->ValueAsDouble(index, 1)/(Double_t)nEventsN;
-	
-	pat->SetValueAsDouble(index, 0, patXOcc);
-	pat->SetValueAsDouble(index, 1, patYOcc);
-	
-	// check for x strip
-	if (patXOcc > cfg.GetThrLocN()) {
-	  strip  = index % 16;
-	  connector = index/16;
-	  UpdateLocalMask(cfg, localBoardId, connector, strip);
-	}
-	// check for y strip
-	if (patYOcc > cfg.GetThrLocN()) {
-	  strip  = index % 16;
-	  connector = index/16 + 4;
-	  UpdateLocalMask(cfg, localBoardId, connector, strip);
-	}
-	
-      }
-    }
-    
-  }
-  
-  // dead strips
-  if (nEventsD > 0) {
-
-    TIter next(cfg.GetPatternStoreD()->CreateIterator());
-
-    while ( ( pat = dynamic_cast(next() ) ) ) {
-      
-      localBoardId  = pat->ID0();
-      
-      for (Int_t index = 0; index < pat->Size(); index++) {
-	
-	Double_t patXOcc  = pat->ValueAsDouble(index, 0)/(Double_t)nEventsD;
-	Double_t patYOcc  = pat->ValueAsDouble(index, 1)/(Double_t)nEventsD;
-	
-	pat->SetValueAsDouble(index, 0, patXOcc);
-	pat->SetValueAsDouble(index, 1, patYOcc);
-	
-	// check for x strip
-	if (patXOcc < cfg.GetThrLocD()) {
-	  strip  = index % 16;
-	  connector = index/16;
-	  UpdateLocalMask(cfg, localBoardId, connector, strip);
-	}
-	// check for y strip
-	if (patYOcc < cfg.GetThrLocD()) {
-	  strip  = index % 16;
-	  connector = index/16 + 4;
-	  UpdateLocalMask(cfg, localBoardId, connector, strip);
-	}
-	
-      }
-    }
-    
-  }
-  
-  // check if the mask has changed from previous version
-  UShort_t maskDA, mask;
-  for (localBoardId = 1; localBoardId <= AliMpConstants::TotalNofLocalBoards(); localBoardId++) {
-    AliMUONVCalibParam* localMaskDA = static_cast(cfg.GetLocalMasksDA()->FindObject(localBoardId));
-    AliMUONVCalibParam* localMask = static_cast(cfg.GetLocalMasks()->FindObject(localBoardId));
-    for (connector = 0; connector < 8; connector++) {
-      maskDA = static_cast(localMaskDA->ValueAsInt(connector,0)); 
-      mask = static_cast(localMask->ValueAsInt(connector,0)); 
-      if (maskDA != mask) {
-	updated = kTRUE;
-	break;
-      }
-    }
-  }
-
-  Int_t status = 0;
-  if (updated) {
-
-    // update version
-    cfg.IncLocalMaskFileVersion();
-    
-    // don't change the file version ("-x.dat")
-    
-    cfg.GetTriggerIO()->WriteLocalMasks(cfg.GetLocalMaskFileName(),*cfg.GetLocalMasksDA(),cfg.GetRegionalMasks());
-
-    // write last current file
-    WriteLastCurrentFile(cfg,cfg.GetCurrentFileName());
-
-    status = daqDA_DB_storeFile(cfg.GetLocalMaskFileName(), cfg.GetLocalMaskFileName());
-    if (status) {
-      printf("Failed to export file to DB: %s\n",cfg.GetLocalMaskFileName());
-      return;
-    }
-    
-    status = daqDA_DB_storeFile(cfg.GetCurrentFileName(), cfg.GetCurrentFileName());
-    if (status) {
-      printf("Failed to export file to DB: %s\n",cfg.GetCurrentFileName());
-      return;
-    }
-
-  }
-
-}
-
 //*************************************************************//
 int main(Int_t argc, Char_t **argv) 
 {
@@ -1250,17 +980,10 @@ int main(Int_t argc, Char_t **argv)
 
     // containers
     // old decoder
-    AliMUONDDLTrigger*       ddlTrigger     = 0x0;
-    AliMUONDarcHeader*       darcHeader     = 0x0;
-    AliMUONRegHeader*        regHeader   = 0x0;
-    AliMUONLocalStruct*      localStruct = 0x0;
+    AliMUONDDLTrigger*       ddlTrigger  = 0x0;
+    AliMUONDarcHeader*       darcHeader  = 0x0;
     // new (fast) decoder
-    const AliMUONRawStreamTriggerHP::AliHeader*      darcHeaderHP  = 0x0;
-    const AliMUONRawStreamTriggerHP::AliLocalStruct* localStructHP = 0x0;
-
-    TArrayS xPattern(4);
-    TArrayS yPattern(4);
-    Int_t localBoardId = 0;
+    const AliMUONRawStreamTriggerHP::AliHeader* darcHeaderHP = 0x0;
 
     TStopwatch timers;
 
@@ -1343,7 +1066,7 @@ int main(Int_t argc, Char_t **argv)
     cout << "MUONTRGda : Reading data from file " << inputFile <GetDDL());
 
-	if (cfg.UseFastDecoder()) {
-	  darcHeaderHP = static_cast(rawStream)->GetHeaders();
-	  if (cfg.GetPrintLevel() == 2) printf("Global output (fast decoder) %x\n", (Int_t)darcHeaderHP->GetGlobalOutput());
-	  for (Int_t ig = 0; ig < cfg.GetGlobalInputs(); ig++) {
-	    globalInput[ig] = darcHeaderHP->GetGlobalInput(ig);
-	  }
-	  // loop over regional structure
-	  Int_t nReg = (Int_t)static_cast(rawStream)->GetRegionalHeaderCount();
-	  for(Int_t iReg = 0; iReg < nReg; iReg++) {
-	    // loop over local structures
-	    Int_t nLoc = (Int_t)static_cast(rawStream)->GetLocalStructCount(iReg);
-	    for(Int_t iLoc = 0; iLoc < nLoc; iLoc++) {
-	      localStructHP = static_cast(rawStream)->GetLocalStruct(iReg, iLoc);
-	      localBoardId = cfg.GetTriggerIO()->LocalBoardId(rawStream->GetDDL(),iReg,localStructHP->GetId());
-	      if (localBoardId > 0) {
-		localStructHP->GetXPattern(xPattern);
-		localStructHP->GetYPattern(yPattern);
-		MakePattern(cfg,localBoardId,xPattern,yPattern);
-	      }
- 	    }
-	  }
-	} else {
-	  ddlTrigger = rawStream->GetDDLTrigger();
-	  darcHeader = ddlTrigger->GetDarcHeader();
-	  if (cfg.GetPrintLevel() == 2) printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
-	  globalInput = darcHeader->GetGlobalInput();
-	  // loop over regional structure
-	  Int_t nReg = darcHeader->GetRegHeaderEntries();
-	  for(Int_t iReg = 0; iReg < nReg; iReg++) {
-	    regHeader = darcHeader->GetRegHeaderEntry(iReg);
-	    // loop over local structures
-	    Int_t nLoc = regHeader->GetLocalEntries();
-	    for(Int_t iLoc = 0; iLoc < nLoc; iLoc++) {  
-	      localStruct = regHeader->GetLocalEntry(iLoc);
-	      localBoardId = cfg.GetTriggerIO()->LocalBoardId(rawStream->GetDDL(),iReg,localStruct->GetId());
-	      if (localBoardId > 0) {
-		localStruct->GetXPattern(xPattern);
-		localStruct->GetYPattern(yPattern);
-		MakePattern(cfg,localBoardId,xPattern,yPattern);
-	      }
-	    }
-	  }
-	}
 	if (rawStream->GetDDL() == 0) {
+	  if (cfg.UseFastDecoder()) {
+	    darcHeaderHP = static_cast(rawStream)->GetHeaders();
+	    if (cfg.GetPrintLevel() == 2) printf("Global output (fast decoder) %x\n", (Int_t)darcHeaderHP->GetGlobalOutput());
+	    for (Int_t ig = 0; ig < cfg.GetGlobalInputs(); ig++) 
+	      globalInput[ig] = darcHeaderHP->GetGlobalInput(ig);
+	  } else {
+	    ddlTrigger = rawStream->GetDDLTrigger();
+	    darcHeader = ddlTrigger->GetDarcHeader();
+	    if (cfg.GetPrintLevel() == 2) printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
+	    globalInput = darcHeader->GetGlobalInput();
+	  }
 	  StoreGlobalInput(cfg,globalInput);
 	}
-	
+
       } // NextDDL
 
       delete rawReader;
@@ -1472,10 +1163,8 @@ int main(Int_t argc, Char_t **argv)
     } // while (1)
 
     // update configuration files ifrequested event types were found
-    if (doUpdate) {
-      if (cfg.GetDAMode() > 0) UpdateGlobalMasks(cfg);
-      if (cfg.GetDAMode() > 1) MakePatternStore(cfg);
-    }
+    if (doUpdate) 
+      UpdateGlobalMasks(cfg);
 
     timers.Stop();
 
@@ -1488,14 +1177,11 @@ int main(Int_t argc, Char_t **argv)
     cout << "MUONTRGda: Minumum nr of events for rate calculation: " << cfg.GetMinEvents() << endl;
     cout << "MUONTRGda: Maximum nr of analyzed events: " << cfg.GetMaxEvents() << endl;
     cout << "MUONTRGda: Skip events from start: " << cfg.GetSkipEvents() << endl;
-    cout << "MUONTRGda: Threshold for global noisy inputs: " << 100*cfg.GetThrN() << "%" << endl;
-    cout << "MUONTRGda: Threshold for global dead inputs: " << 100*cfg.GetThrD() << "%" << endl;
-    cout << "MUONTRGda: Threshold for local noisy inputs: " << 100*cfg.GetThrLocN() << "%" << endl;
-    cout << "MUONTRGda: Threshold for local dead inputs: " << 100*cfg.GetThrLocD() << "%" << endl;
+    cout << "MUONTRGda: Threshold for noisy inputs: " << 100*cfg.GetThrN() << "%" << endl;
+    cout << "MUONTRGda: Threshold for dead inputs: " << 100*cfg.GetThrD() << "%" << endl;
     cout << "MUONTRGda: Print level: " << cfg.GetPrintLevel() << endl;
     cout << "MUONTRGda: Show decoder warnings: " << cfg.WithWarnings() << endl;
     cout << "MUONTRGda: Use the fast decoder: " << cfg.UseFastDecoder() << endl;
-    cout << "MUONTRGda: DA mode (1=GLOBAL, 2=GLOBAL+LOCAL): " << cfg.GetDAMode() << endl;
 
     printf("MUONTRGda: Execution time : R:%7.2fs C:%7.2fs\n", timers.RealTime(), timers.CpuTime());
 
diff --git a/PWG0/dNdPt/AlidNdPtAnalysis.cxx b/PWG0/dNdPt/AlidNdPtAnalysis.cxx
index 4297b2ecfad..f2f57e5478f 100644
--- a/PWG0/dNdPt/AlidNdPtAnalysis.cxx
+++ b/PWG0/dNdPt/AlidNdPtAnalysis.cxx
@@ -993,7 +993,6 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
 
     Int_t entries = allChargedTracks->GetEntries();
     //printf("entries %d \n",entries);
-     Bool_t isCosmic = kFALSE;
 
     labelsAll = new Int_t[entries];
     labelsAcc = new Int_t[entries];
@@ -1004,6 +1003,13 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
       if(!track) continue;
       if(track->Charge()==0) continue;
 
+      /*
+      // cosmics analysis
+      if( GetParticleMode()==AlidNdPtHelper::kCosmics  && 
+          AlidNdPtHelper::IsCosmicTrack(allChargedTracks, track, i, accCuts, esdTrackCuts)==kFALSE ) 
+        continue;
+      */
+
       // only postive charged 
       if(GetParticleMode() == AlidNdPtHelper::kPlus && track->Charge() < 0) 
         continue;
@@ -1012,46 +1018,19 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
       if(GetParticleMode() == AlidNdPtHelper::kMinus && track->Charge() > 0) 
         continue;
 
-      // esd track selection 
-      if(!esdTrackCuts->AcceptTrack(track))
-       continue;
-
       FillHistograms(track,stack,AlidNdPtHelper::kAllTracks); 
       labelsAll[multAll] = TMath::Abs(track->GetLabel());
       multAll++;
 
+       //if(accCuts->AcceptTrack(track)) {
          //FillHistograms(track,stack,AlidNdPtHelper::kAccTracks); 
 	 //labelsAcc[multAcc] = TMath::Abs(track->GetLabel());
 	 //multAcc++;
 
-         // cosmics analysis
-         isCosmic = kFALSE;
-         if( GetParticleMode()==AlidNdPtHelper::kCosmics )
-         {
-           Int_t mult = 0;
-           if(accCuts->AcceptTrack(track) ) 
-	   { 
-             for(Int_t j=0; jAt(j);
-               if(!track1) continue;
-               if(track1->Charge()==0) continue;
-
-               if( esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) 
-               { 
-                 mult++;
-                 isCosmic = AlidNdPtHelper::IsCosmicTrack(track,track1);
-	       }
-	     }
-	   }
-	   if(isCosmic) 
-	      printf("evt. number %d , mult %d \n", esdEvent->GetEventNumberInFile(), mult);
-
-           if(!isCosmic) continue;
-         }
-
-	 if(GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtxUpdate) {
-	   // update track parameters
+         if(esdTrackCuts->AcceptTrack(track)) 
+	 {
+	   if(GetAnalysisMode() == AlidNdPtHelper::kTPCSPDvtxUpdate) {
+	     // update track parameters
              AliExternalTrackParam cParam;
 	     track->RelateToVertexTPC(esdEvent->GetPrimaryVertexSPD(),esdEvent->GetMagneticField(),kVeryBig,&cParam);
 	     track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance());
@@ -1061,8 +1040,8 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
 	       labelsRec[multRec] = TMath::Abs(track->GetLabel());
 	       multRec++;
 	     }  
-	  }
-          else {
+	   }
+           else {
              if(accCuts->AcceptTrack(track)) {
                FillHistograms(track,stack,AlidNdPtHelper::kRecTracks); 
 	       labelsRec[multRec] = TMath::Abs(track->GetLabel());
@@ -1070,7 +1049,8 @@ void AlidNdPtAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent *const mc
 	     }
 	   }
          }
-
+       //}
+     } 
      // fill track multiplicity histograms
      FillHistograms(allChargedTracks,labelsAll,multAll,labelsAcc,multAcc,labelsRec,multRec);
 
diff --git a/PWG0/dNdPt/AlidNdPtCorrection.cxx b/PWG0/dNdPt/AlidNdPtCorrection.cxx
index 56ddbc2b775..af2254e298c 100644
--- a/PWG0/dNdPt/AlidNdPtCorrection.cxx
+++ b/PWG0/dNdPt/AlidNdPtCorrection.cxx
@@ -666,7 +666,6 @@ void AlidNdPtCorrection::Process(AliESDEvent *esdEvent, AliMCEvent *mcEvent)
   TObjArray *allChargedTracks=0;
   Int_t multRec=0, multRecTemp=0;
   Int_t *labelsRec=0;
-  Bool_t isCosmic = kFALSE;
 
   if(isEventOK && isEventTriggered)
   {
@@ -693,7 +692,7 @@ void AlidNdPtCorrection::Process(AliESDEvent *esdEvent, AliMCEvent *mcEvent)
         continue;
 
       // cosmics analysis
-      isCosmic = kFALSE;
+      Bool_t isCosmic = kFALSE;
       if( GetParticleMode()==AlidNdPtHelper::kCosmics )
       {
           for(Int_t j=0; jAcceptTrack(track) && accCuts->AcceptTrack(track) && 
 	        esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) 
             { 
-              isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);
+              isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1, i, accCuts, esdTrackCuts);
 	    }
             if(isCosmic) 
 	    {
-	      Double_t vCosmicsHisto[3] = { track->Eta()+track1->Eta(), track->Phi()-track1->Phi(), track1->Pt() };
+	      Double_t vCosmicsHisto[3] = {track->Eta()+track1->Eta(), track->Phi()-track1->Phi(), track1->Pt()};
 	      fCosmicsHisto->Fill(vCosmicsHisto);
 	    }
 	  }
@@ -739,25 +738,6 @@ void AlidNdPtCorrection::Process(AliESDEvent *esdEvent, AliMCEvent *mcEvent)
       // track-level corrections
       if(esdTrackCuts->AcceptTrack(track)) 
       {
-        // cosmics analysis
-        isCosmic = kFALSE;
-        if( GetParticleMode()==AlidNdPtHelper::kCosmics )
-        {
-          for(Int_t j=0; jAt(j);
-            if(!track1) continue;
-            if(track1->Charge()==0) continue;
-
-            if( esdTrackCuts->AcceptTrack(track) && accCuts->AcceptTrack(track) && 
-	        esdTrackCuts->AcceptTrack(track1) && accCuts->AcceptTrack(track1) ) 
-            { 
-              isCosmic = AlidNdPtHelper::IsCosmicTrack(track, track1);
-	    }
-	  }
-          if(!isCosmic) continue;
-        }
-
          if (GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate) 
 	 {
 	   //
diff --git a/PWG0/dNdPt/AlidNdPtCutAnalysis.cxx b/PWG0/dNdPt/AlidNdPtCutAnalysis.cxx
index 57e2ab9c238..f93d27e7430 100644
--- a/PWG0/dNdPt/AlidNdPtCutAnalysis.cxx
+++ b/PWG0/dNdPt/AlidNdPtCutAnalysis.cxx
@@ -107,7 +107,7 @@ void AlidNdPtCutAnalysis::Init(){
   fEventCount->Sumw2();
 
   //Xv:Yv:Zv:ResZv:Mult
-  Double_t kFact = 1.0;
+  Double_t kFact = 0.1;
 
   Int_t binsRecEventHist[5]={80,80,100,80,150};
   Double_t minRecEventHist[5]={-3.*kFact,-3.*kFact,-35.,0.,0.}; 
@@ -132,8 +132,8 @@ void AlidNdPtCutAnalysis::Init(){
 
   //Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult
   Int_t binsRecMCEventHist[4]={100,100,100,150};
-  Double_t minRecMCEventHist[4]={-1.0*kFact,-1.0*kFact,-1.0*kFact,0.}; 
-  Double_t maxRecMCEventHist[4]={1.0*kFact,1.0*kFact,1.0*kFact,150.}; 
+  Double_t minRecMCEventHist[4]={-10.0*kFact,-10.0*kFact,-10.0*kFact,0.}; 
+  Double_t maxRecMCEventHist[4]={10.0*kFact,10.0*kFact,10.0*kFact,150.}; 
   fRecMCEventHist = new THnSparseF("fRecMCEventHist","mcXv-Xv:mcYv-Yv:mcZv-Zv:Mult",4,binsRecMCEventHist,minRecMCEventHist,maxRecMCEventHist);
   fRecMCEventHist->GetAxis(0)->SetTitle("mcXv-Xv (cm)");
   fRecMCEventHist->GetAxis(1)->SetTitle("mcYv-Yv (cm)");
diff --git a/PWG0/dNdPt/AlidNdPtHelper.cxx b/PWG0/dNdPt/AlidNdPtHelper.cxx
index b8f3e02b49c..ac9bfa570c9 100644
--- a/PWG0/dNdPt/AlidNdPtHelper.cxx
+++ b/PWG0/dNdPt/AlidNdPtHelper.cxx
@@ -290,13 +290,15 @@ return kFALSE;
 */
 
 //____________________________________________________________________
-Bool_t AlidNdPtHelper::IsCosmicTrack(AliESDtrack *track1, AliESDtrack *track2)
+Bool_t AlidNdPtHelper::IsCosmicTrack(AliESDtrack *track1, AliESDtrack *track2, Int_t /*trackIdx*/, AlidNdPtAcceptanceCuts *accCuts, AliESDtrackCuts *trackCuts)
 {
 //
 // check cosmic tracks
 //
   if(!track1) return kFALSE;
   if(!track2) return kFALSE;
+  if(!accCuts) return kFALSE;
+  if(!trackCuts) return kFALSE;
 
   /*
   if(track1->Pt() > 6. && track2->Pt() > 6. && (track1->Charge() + track2->Charge()) == 0 ) 
@@ -316,8 +318,7 @@ Bool_t AlidNdPtHelper::IsCosmicTrack(AliESDtrack *track1, AliESDtrack *track2)
       //  ((TMath::Abs(track1->Phi()-track2->Phi()) - TMath::Pi() )<0.004) && 
 
       if( (track1->Pt()-track2->Pt()) < 0.2 && track1->Pt() > 3.0 && 
-      	     (track1->Charge()+track2->Charge()) == 0 )
-      //if( track1->Pt() > 6. || track2->Pt() > 6. )
+	     (track1->Charge()+track2->Charge()) == 0 )
       {
         //printf("COSMIC  candidate \n");
 	/*
diff --git a/PWG0/dNdPt/AlidNdPtHelper.h b/PWG0/dNdPt/AlidNdPtHelper.h
index f298489febd..53cf59f3b60 100644
--- a/PWG0/dNdPt/AlidNdPtHelper.h
+++ b/PWG0/dNdPt/AlidNdPtHelper.h
@@ -49,7 +49,7 @@ class AlidNdPtHelper : public TObject
 
     static Bool_t IsPrimaryParticle(AliStack *stack, Int_t idx, ParticleMode particleMode);
     //static Bool_t IsCosmicTrack(TObjArray *allChargedTracks, AliESDtrack *track, Int_t trackIdx, AlidNdPtAcceptanceCuts *accCuts, AliESDtrackCuts *trackCuts);
-    static Bool_t IsCosmicTrack(AliESDtrack *track1, AliESDtrack *track2);
+    static Bool_t IsCosmicTrack(AliESDtrack *track1, AliESDtrack *track2, Int_t trackIdx, AlidNdPtAcceptanceCuts *accCuts, AliESDtrackCuts *trackCuts);
     static void PrintConf(AnalysisMode analysisMode, AliTriggerAnalysis::Trigger trigger);
     static Int_t ConvertPdgToPid(TParticle *particle);
 
diff --git a/PWG0/dNdPt/AlidNdPtTask.cxx b/PWG0/dNdPt/AlidNdPtTask.cxx
index 7c482113e05..c10a1df2246 100644
--- a/PWG0/dNdPt/AlidNdPtTask.cxx
+++ b/PWG0/dNdPt/AlidNdPtTask.cxx
@@ -71,24 +71,10 @@ AlidNdPtTask::~AlidNdPtTask()
 //____________________________________________________________________________
 Bool_t AlidNdPtTask::Notify()
 {
-  /*
   static Int_t count = 0;
   count++;
   Printf("Processing %d. file", count);
 
-  TChain *chain = (TChain*)GetInputData(0);
-  AliESDInputHandler *esdH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-  if (!esdH) {
-    Printf("ERROR: Could not get ESDInputHandler");
-    return kFALSE;
-  } else {
-    //Printf("esdH->Notify() %s", esdH->Notify());
-    //Printf("fTree->GetCurrentFile()->GetName() %s", fTree->GetCurrentFile()->GetName());
-    if(chain)
-    Printf("chain->GetCurrentFile()->GetName() %s %s", chain->GetCurrentFile()->GetName(),  );
-  }
-  */
-
 return kTRUE;
 }
 
diff --git a/PWG0/dNdPt/macros/CreatedNdPtTrackCuts.C b/PWG0/dNdPt/macros/CreatedNdPtTrackCuts.C
index 71d8bf612a1..b2adef48c63 100644
--- a/PWG0/dNdPt/macros/CreatedNdPtTrackCuts.C
+++ b/PWG0/dNdPt/macros/CreatedNdPtTrackCuts.C
@@ -514,7 +514,7 @@ AliESDtrackCuts* CreatedNdPtTrackCuts(Int_t cutMode=1, Bool_t fieldOn = kTRUE, B
   {
     // beta cuts (still under investigation)
     //minNClustersTPC = 50;
-    minNClustersTPC = 70;
+    minNClustersTPC = 90;
     maxChi2PerClusterTPC = 4.0;
     maxDCAtoVertexXY = 2.4; // cm
     maxDCAtoVertexZ  = 3.2; // cm
diff --git a/PWG1/ITS/AliAnalysisTaskITSTrackingCheck.cxx b/PWG1/ITS/AliAnalysisTaskITSTrackingCheck.cxx
index 6308e00f70f..cba5145afa5 100644
--- a/PWG1/ITS/AliAnalysisTaskITSTrackingCheck.cxx
+++ b/PWG1/ITS/AliAnalysisTaskITSTrackingCheck.cxx
@@ -945,7 +945,7 @@ Double_t AliAnalysisTaskITSTrackingCheck::ParticleImpParMC(TParticle *part,
   if(TMath::Abs(part->GetPdgCode())<100) charge*=-1.;
 
   if(px<0.000001) px=0.000001;     
-  Double_t rAnd=((10./2.99792458)*pt/TMath::Abs(bzT))*100.;
+  Double_t rAnd=((10./2.99792458)*pt/bzT)*100.;
   Double_t center[3],d0;
   center[0]=vx-(1./charge)*rAnd*(py/pt);
   center[1]=vy+(1./charge)*rAnd*(px/pt);
diff --git a/PWG1/global/AliAnalysisTaskVertexESD.cxx b/PWG1/global/AliAnalysisTaskVertexESD.cxx
index f1f552d7119..614b3816415 100644
--- a/PWG1/global/AliAnalysisTaskVertexESD.cxx
+++ b/PWG1/global/AliAnalysisTaskVertexESD.cxx
@@ -114,7 +114,7 @@ void AliAnalysisTaskVertexESD::UserCreateOutputObjects()
   fOutput = new TList;
   fOutput->SetOwner();
 
-  fNtupleVertexESD = new TNtuple("fNtupleVertexESD","vertices","run:tstamp:triggered:dndygen:xtrue:ytrue:ztrue:xSPD:xerrSPD:ySPD:yerrSPD:zSPD:zerrSPD:ntrksSPD:SPD3D:dphiSPD:xTPC:xerrTPC:yTPC:yerrTPC:zTPC:zerrTPC:ntrksTPC:constrTPC:xTRK:xerrTRK:yTRK:yerrTRK:zTRK:zerrTRK:ntrksTRK:constrTRK:ntrklets:nESDtracks:nITSrefit5or6:nTPCin:nTPCinEta09:SPD0cls:xTPCnc:xerrTPCnc:yTPCnc:yerrTPCnc:zTPCnc:zerrTPCnc:ntrksTPCnc:xTRKnc:xerrTRKnc:yTRKnc:yerrTRKnc:zTRKnc:zerrTRKnc:ntrksTRKnc:xTPCc:xerrTPCc:yTPCc:yerrTPCc:zTPCc:zerrTPCc:ntrksTPCc:xTRKc:xerrTRKc:yTRKc:yerrTRKc:zTRKc:zerrTRKc:ntrksTRKc");
+  fNtupleVertexESD = new TNtuple("fNtupleVertexESD","vertices","run:tstamp:xtrue:ytrue:ztrue:xSPD:xerrSPD:ySPD:yerrSPD:zSPD:zerrSPD:ntrksSPD:xTPC:xerrTPC:yTPC:yerrTPC:zTPC:zerrTPC:ntrksTPC:xTRK:xerrTRK:yTRK:yerrTRK:zTRK:zerrTRK:ntrksTRK:ntrklets:nESDtracks:nITSrefit5or6:nTPCin:nTPCinEta09:dndygen:triggered:SPD3D:SPD0cls:constrTRK:constrTPC");
 
   fOutput->Add(fNtupleVertexESD);
 
@@ -238,9 +238,6 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   //static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis();
   Bool_t eventTriggered = 0;//triggerAnalysis->IsTriggerFired(esdE, AliTriggerAnalysis::kSPDGFO /*| AliTriggerAnalysis::kOfflineFlag*/); 
 
-  // use response of AliPhysicsSelection
-  eventTriggered = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
-
   Int_t ntracks = esdE->GetNumberOfTracks();
   Int_t nITS5or6=0,nTPCin=0,nTPCinEta09=0;
   //printf("Tracks # = %d\n",esdE->GetNumberOfTracks());
@@ -259,6 +256,16 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   const AliESDVertex *tpcv=esdE->GetPrimaryVertexTPC();
   const AliESDVertex *trkv=esdE->GetPrimaryVertexTracks();
 
+  //Float_t tpccontrorig=tpcv->GetNContributors();
+
+  if(fRecoVtxTPC) {
+    tpcv = 0;
+    tpcv = ReconstructPrimaryVertexTPC();
+  }
+  if(fRecoVtxITSTPC) {
+    trkv = 0;
+    trkv = ReconstructPrimaryVertexITSTPC();
+  }
 
   const AliMultiplicity *alimult = esdE->GetMultiplicity();
   Int_t ntrklets=0,spd0cls=0;
@@ -301,17 +308,13 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   
 
   // fill ntuple
-  Int_t isize=66;
-  Float_t xnt[66]; for(Int_t iii=0;iiiGetRunNumber();
   xnt[index++]=(Float_t)esdE->GetTimeStamp();
-  xnt[index++]=(eventTriggered ? 1. : 0.);
-
-  xnt[index++]=(Float_t)dNchdy;
-
 
   xnt[index++]=mcVertex[0];
   xnt[index++]=mcVertex[1];
@@ -324,9 +327,6 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   xnt[index++]=spdv->GetZv();
   xnt[index++]=spdv->GetZRes();
   xnt[index++]=spdv->GetNContributors();
-  TString spdtitle = spdv->GetTitle();
-  xnt[index++]=(spdtitle.Contains("vertexer: 3D") ? 1. : 0.);
-  xnt[index++]=spdv->GetDispersion();
   
   xnt[index++]=tpcv->GetXv();
   xnt[index++]=tpcv->GetXRes();
@@ -335,8 +335,6 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   xnt[index++]=tpcv->GetZv();
   xnt[index++]=tpcv->GetZRes();
   xnt[index++]=tpcv->GetNContributors();
-  TString tpctitle = tpcv->GetTitle();
-  xnt[index++]=(tpctitle.Contains("WithConstraint") ? 1. : 0.);
   
   xnt[index++]=trkv->GetXv();
   xnt[index++]=trkv->GetXRes();
@@ -345,8 +343,7 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   xnt[index++]=trkv->GetZv();
   xnt[index++]=trkv->GetZRes();
   xnt[index++]=trkv->GetNContributors();// tpccontrorig;
-  TString trktitle = trkv->GetTitle();
-  xnt[index++]=(trktitle.Contains("WithConstraint") ? 1. : 0.);  
+  
 
   xnt[index++]=float(ntrklets);
   xnt[index++]=float(ntracks);
@@ -354,56 +351,23 @@ void AliAnalysisTaskVertexESD::UserExec(Option_t *)
   xnt[index++]=float(nTPCin);
   xnt[index++]=float(nTPCinEta09);
 
-  xnt[index++]=spd0cls;
+  xnt[index++]=float(dNchdy);
 
-  // add recalculated vertices TRK and TPC
+  xnt[index++]=(eventTriggered ? 1. : 0.);
 
-  if(fRecoVtxTPC) {
-    AliESDVertex *tpcvnc = ReconstructPrimaryVertexTPC(kFALSE);
-    xnt[index++]=tpcvnc->GetXv();
-    xnt[index++]=tpcvnc->GetXRes();
-    xnt[index++]=tpcvnc->GetYv();
-    xnt[index++]=tpcvnc->GetYRes();
-    xnt[index++]=tpcvnc->GetZv();
-    xnt[index++]=tpcvnc->GetZRes();
-    xnt[index++]=tpcvnc->GetNContributors();
-    delete tpcvnc; tpcvnc=0;
-    
-    AliESDVertex *tpcvc = ReconstructPrimaryVertexTPC(kTRUE);
-    xnt[index++]=tpcvc->GetXv();
-    xnt[index++]=tpcvc->GetXRes();
-    xnt[index++]=tpcvc->GetYv();
-    xnt[index++]=tpcvc->GetYRes();
-    xnt[index++]=tpcvc->GetZv();
-    xnt[index++]=tpcvc->GetZRes();
-    xnt[index++]=tpcvc->GetNContributors();
-    delete tpcvc; tpcvc=0;
-  }
+  TString spdtitle = spdv->GetTitle();
+  xnt[index++]=(spdtitle.Contains("vertexer: 3D") ? 1. : 0.);
 
-  if(fRecoVtxITSTPC) {
-    AliESDVertex *trkvnc = ReconstructPrimaryVertexITSTPC(kFALSE);
-    xnt[index++]=trkvnc->GetXv();
-    xnt[index++]=trkvnc->GetXRes();
-    xnt[index++]=trkvnc->GetYv();
-    xnt[index++]=trkvnc->GetYRes();
-    xnt[index++]=trkvnc->GetZv();
-    xnt[index++]=trkvnc->GetZRes();
-    xnt[index++]=trkvnc->GetNContributors();
-    delete trkvnc; trkvnc=0;
-    
-    AliESDVertex *trkvc = ReconstructPrimaryVertexITSTPC(kTRUE);
-    xnt[index++]=trkvc->GetXv();
-    xnt[index++]=trkvc->GetXRes();
-    xnt[index++]=trkvc->GetYv();
-    xnt[index++]=trkvc->GetYRes();
-    xnt[index++]=trkvc->GetZv();
-    xnt[index++]=trkvc->GetZRes();
-    xnt[index++]=trkvc->GetNContributors();
-    delete trkvc; trkvc=0;
-  }
+  xnt[index++]=spd0cls;
+
+  TString trktitle = trkv->GetTitle();
+  xnt[index++]=(trktitle.Contains("WithConstraint") ? 1. : 0.);
+
+  TString tpctitle = tpcv->GetTitle();
+  xnt[index++]=(tpctitle.Contains("WithConstraint") ? 1. : 0.);
 
 
-  if(index>isize) printf("AliAnalysisTaskVertexESD: ERROR, index!=isize\n");
+  if(index!=isize) printf("AliAnalysisTaskVertexESD: ERROR, index!=isize\n");
 
   if(fFillNtuple) fNtupleVertexESD->Fill(xnt);
   
@@ -430,36 +394,35 @@ void AliAnalysisTaskVertexESD::Terminate(Option_t *)
 }
 
 //_________________________________________________________________________
-AliESDVertex* AliAnalysisTaskVertexESD::ReconstructPrimaryVertexTPC(Bool_t constr) const {
+AliESDVertex* AliAnalysisTaskVertexESD::ReconstructPrimaryVertexTPC() const {
   // On the fly reco of TPC vertex from ESD
   AliESDEvent* evt = (AliESDEvent*) fInputEvent;
   AliVertexerTracks vertexer(evt->GetMagneticField());
   vertexer.SetTPCMode(); // defaults
-  Float_t diamondcovxy[3]; evt->GetDiamondCovXY(diamondcovxy);
-  Double_t pos[3]={evt->GetDiamondX(),evt->GetDiamondY(),0}; 
-  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
-  AliESDVertex *initVertex = new AliESDVertex(pos,cov,1.,1);
+  //vertexer.SetTPCMode(0.1,1.0,5.,0,1,3.,0.1,1.5);
+  Double_t pos[3]={+0.0220,-0.0340,+0.270}; 
+  Double_t err[3]={0.0200,0.0200,7.5};
+  AliESDVertex *initVertex = new AliESDVertex(pos,err);
   vertexer.SetVtxStart(initVertex);
   delete initVertex;
-  if(!constr) vertexer.SetConstraintOff();
+  vertexer.SetConstraintOff();
 
   return vertexer.FindPrimaryVertex(evt);
 }
 
 //_________________________________________________________________________
-AliESDVertex* AliAnalysisTaskVertexESD::ReconstructPrimaryVertexITSTPC(Bool_t constr) const {
+AliESDVertex* AliAnalysisTaskVertexESD::ReconstructPrimaryVertexITSTPC() const {
   // On the fly reco of ITS+TPC vertex from ESD
   AliESDEvent* evt = (AliESDEvent*) fInputEvent;
   AliVertexerTracks vertexer(evt->GetMagneticField());
   vertexer.SetITSMode(); // defaults
-  vertexer.SetMinClusters(4); // default is 5
-  Float_t diamondcovxy[3]; evt->GetDiamondCovXY(diamondcovxy);
-  Double_t pos[3]={evt->GetDiamondX(),evt->GetDiamondY(),0}; 
-  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
-  AliESDVertex *initVertex = new AliESDVertex(pos,cov,1.,1);
+  //vertexer.SetTPCMode(0.1,1.0,5.,0,1,3.,0.1,1.5);
+  Double_t pos[3]={+0.0220,-0.0340,+0.270}; 
+  Double_t err[3]={0.0200,0.0200,7.5};
+  AliESDVertex *initVertex = new AliESDVertex(pos,err);
   vertexer.SetVtxStart(initVertex);
   delete initVertex;
-  if(!constr) vertexer.SetConstraintOff();
+  vertexer.SetConstraintOff();
 
   // use only ITS-TPC or only ITS-SA tracks
   if(fOnlyITSTPCTracks || fOnlyITSSATracks) {
diff --git a/PWG1/global/AliAnalysisTaskVertexESD.h b/PWG1/global/AliAnalysisTaskVertexESD.h
index 213e0f9a98a..94fa2896abc 100644
--- a/PWG1/global/AliAnalysisTaskVertexESD.h
+++ b/PWG1/global/AliAnalysisTaskVertexESD.h
@@ -69,8 +69,8 @@ class AliAnalysisTaskVertexESD : public AliAnalysisTaskSE
 
   AliAnalysisTaskVertexESD(const AliAnalysisTaskVertexESD&); // not implemented
   AliAnalysisTaskVertexESD& operator=(const AliAnalysisTaskVertexESD&); // not implemented
-  AliESDVertex* ReconstructPrimaryVertexTPC(Bool_t constr=kFALSE) const;
-  AliESDVertex* ReconstructPrimaryVertexITSTPC(Bool_t constr=kFALSE) const;
+  AliESDVertex* ReconstructPrimaryVertexTPC() const;
+  AliESDVertex* ReconstructPrimaryVertexITSTPC() const;
   
   ClassDef(AliAnalysisTaskVertexESD,7); // primary vertex analysis
 };
diff --git a/PWG1/macros/AddTaskMTRchamberEfficiency.C b/PWG1/macros/AddTaskMTRchamberEfficiency.C
index f402eb48c8f..a577df8f2c7 100644
--- a/PWG1/macros/AddTaskMTRchamberEfficiency.C
+++ b/PWG1/macros/AddTaskMTRchamberEfficiency.C
@@ -11,17 +11,10 @@ AliAnalysisTaskTrigChEff *AddTaskMTRchamberEfficiency(Bool_t useGhosts = kFALSE)
   //==============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    ::Error("AddTaskMTRchamberEfficiency", "No analysis manager to connect to.");
+    ::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()) {
-    ::Error("AliAnalysisTaskTrigChEff", "This task requires an input event handler");
-    return NULL;
-  }
-
   // Create the task
   AliAnalysisTaskTrigChEff* taskTrigChEff = new AliAnalysisTaskTrigChEff("TriggerChamberEfficiency");
   taskTrigChEff->SetUseGhostTracks(useGhosts);
@@ -35,7 +28,7 @@ AliAnalysisTaskTrigChEff *AddTaskMTRchamberEfficiency(Bool_t useGhosts = kFALSE)
   // Attach input
   mgr->ConnectInput(taskTrigChEff,0,mgr->GetCommonInputContainer());
   // Attach output
-  mgr->ConnectOutput(taskTrigChEff,1,cOutputTrigChEff);
+  mgr->ConnectOutput(taskTrigChEff,0,cOutputTrigChEff);
   
   return taskTrigChEff;
 }
diff --git a/PWG2/FEMTOSCOPY/AliFemto/AliTwoTrackRes.cxx b/PWG2/FEMTOSCOPY/AliFemto/AliTwoTrackRes.cxx
deleted file mode 100644
index 7493dba4f85..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/AliTwoTrackRes.cxx
+++ /dev/null
@@ -1,357 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//345678901234567890123456789012345678901234567890123456789012345678901234567890
-//       1         2         3         4         5         6         7         8
-//
-// Tool to study two-track effects in ALICE for femtoscopic studies
-// J. Mercado. Last modified: 28.12.2009
-//
-////////////////////////////////////////////////////////////////////////////////
-
-#include "AliTwoTrackRes.h"
-#include 
-#include 
-#include "TMath.h"
-#include "TROOT.h"
-#include "TFile.h"
-#include "TChain.h"
-#include "TLeaf.h"
-#include "TNtuple.h"
-#include "TRandom2.h"
-
-ClassImp(AliTwoTrackRes)
-
-//______________________________________________________________________________
-// Constructor(s)
-
-AliTwoTrackRes::AliTwoTrackRes(const char *name) : 
-  AliAnalysisTask(name,""), fChain(0), fESDEvent(0), 
-  fOutContainer(0), fTrackCuts(0), fNTuple1(0), 
-  fNTuple2(0), fP1(), fP2(), fPb1(), fPb2(), fP(), fQ(), fTpcEnt1(), fTpcEnt2(), 
-  fTpcDist()
-{
-  DefineInput(0, TChain::Class());     // Slot input 0 reads from a TChain  
-  DefineOutput(0, TObjArray::Class()); // Slot output 0 writes into a TObjArray
-}
-
-AliTwoTrackRes::AliTwoTrackRes(const AliTwoTrackRes& aTwoTrackRes) : 
-  AliAnalysisTask(aTwoTrackRes), fChain(0), fESDEvent(0), fOutContainer(0), 
-  fTrackCuts(0), fNTuple1(0), fNTuple2(0), fP1(), fP2(), fPb1(), fPb2(), fP(), 
-  fQ(), fTpcEnt1(), fTpcEnt2(), fTpcDist()
-{
-  //Copy constructor
-  fChain = aTwoTrackRes.fChain;
-  fESDEvent = aTwoTrackRes.fESDEvent;
-  fOutContainer = aTwoTrackRes.fOutContainer;
-  fTrackCuts = aTwoTrackRes.fTrackCuts;
-  fNTuple1 = aTwoTrackRes.fNTuple1;
-  fNTuple2 = aTwoTrackRes.fNTuple2;
-  fP1 = aTwoTrackRes.fP1;
-  fP2 = aTwoTrackRes.fP2;
-  fPb1 = aTwoTrackRes.fPb1;
-  fPb2 = aTwoTrackRes.fPb2;
-  fP = aTwoTrackRes.fP;
-  fQ = aTwoTrackRes.fQ;
-  fTpcEnt1 = aTwoTrackRes.fTpcEnt1;
-  fTpcEnt2 = aTwoTrackRes.fTpcEnt2;
-  fTpcDist = aTwoTrackRes.fTpcDist;
-}
-
-AliTwoTrackRes& AliTwoTrackRes::operator=(const AliTwoTrackRes& aTwoTrackRes)
-{
-  // Assignment operator
-  if (this == &aTwoTrackRes)
-    return *this;
-  fChain = aTwoTrackRes.fChain;
-  fESDEvent = aTwoTrackRes.fESDEvent;
-  fOutContainer = aTwoTrackRes.fOutContainer;
-  fTrackCuts = aTwoTrackRes.fTrackCuts;
-  fNTuple1 = aTwoTrackRes.fNTuple1;
-  fNTuple2 = aTwoTrackRes.fNTuple2;
-  fP1 = aTwoTrackRes.fP1;
-  fP2 = aTwoTrackRes.fP2;
-  fPb1 = aTwoTrackRes.fPb1;
-  fPb2 = aTwoTrackRes.fPb2;
-  fP = aTwoTrackRes.fP;
-  fQ = aTwoTrackRes.fQ;
-  fTpcEnt1 = aTwoTrackRes.fTpcEnt1;
-  fTpcEnt2 = aTwoTrackRes.fTpcEnt2;
-  fTpcDist = aTwoTrackRes.fTpcDist;
-  return *this;
-}
-
-AliTwoTrackRes::~AliTwoTrackRes() {printf("AliTwoTrackRes destroyed\n");}
-
-void AliTwoTrackRes::ConnectInputData(Option_t *) {  
-//______________________________________________________________________________
-// Connect input data and initialize track cuts
-
-  fChain = (TChain*)GetInputData(0);
-  fESDEvent = new AliESDEvent();
-  fESDEvent->ReadFromTree(fChain);
-
-  // Cuts to select primary tracks (ITS+TPC)
-  fTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
-  Double_t cov1, cov2, cov3, cov4, cov5; // diagonal cov. matrix elements
-  Double_t nSigma;                       // max. DCA to primary vertex
-  Int_t minNClustersTPC;                 // min. number of clusters per TPC tracks
-  Double_t maxChi2PerClusterTPC;         // max. chi2 per cluster per TPC track  
-  Int_t cutMode = 1;                     // select cut mode
-  if (cutMode == 1) {
-  cov1 = 2; cov2 = 2; cov3 = 0.5; cov4 = 0.5; cov5 = 2;
-  nSigma = 3; minNClustersTPC = 100; maxChi2PerClusterTPC = 3.5;
-  fTrackCuts->SetMaxCovDiagonalElements(cov1, cov2, cov3, cov4, cov5);
-  fTrackCuts->SetMaxNsigmaToVertex(nSigma);
-  fTrackCuts->SetRequireSigmaToVertex(kTRUE);
-  fTrackCuts->SetRequireTPCRefit(kTRUE);
-  fTrackCuts->SetAcceptKinkDaughters(kFALSE);
-  fTrackCuts->SetMinNClustersTPC(minNClustersTPC);
-  fTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);  
-  TString tag("Global tracking");}
-}
-
-void AliTwoTrackRes::CreateOutputObjects() {
-//______________________________________________________________________________
-// Create output objects 
-
-  fNTuple1 = new TNtuple("nt1","True pairs",
-  "pt1:eta1:phi1:nsh1:pt2:eta2:phi2:nsh2:qinv:mindist:dist:corr:qfac");
-  fNTuple2 = new TNtuple("nt2","Mixed pairs",
-  "pt1:eta1:phi1:nsh1:pt2:eta2:phi2:nsh2:qinv:mindist:dist:corr:qfac");
-  Int_t c = 0;
-  fOutContainer = new TObjArray(2);
-  fOutContainer->AddAt(fNTuple1, c++);
-  fOutContainer->AddAt(fNTuple2, c++);
-}
-
-void AliTwoTrackRes::Exec(Option_t *) {
-//______________________________________________________________________________
-// Create true and mixed pairs keeping some track parameters
-
-  double bfield = 5.0;
-  static int nr=0;
-  if (nr == 0) printf("\tStarting event loop...\n");
-  printf("\rProcessing event %8d", nr);
-  Double_t mpi = 0.13957; // [GeV/c^2]
-  Double_t pidTrk1[AliPID::kSPECIES], pidTrk2[AliPID::kSPECIES];
-  Int_t tpcIn = 80;   // [cm]
-  Int_t tpcOut = 250; // [cm]
-  Double_t tdist[170];
-  Double_t tdistrot[170];
-  Double_t tpcEnt1[3], tpcEnt2[3], pos1[3];
-  TVector3 x1, x2, diff;
-  TBits clu1, clu2, sha1, sha2;
-  TRandom2 rnd;
-  Int_t  ntracks = fESDEvent->GetNumberOfTracks();
-  for(Int_t itrack = 0; itrack < ntracks; itrack++) {
-    AliESDtrack *track1 = fESDEvent->GetTrack(itrack);
-    AliExternalTrackParam *trp1 =  const_cast (track1->GetTPCInnerParam());
-    if (!trp1) continue;
-    if (!track1->IsOn(AliESDtrack::kTPCpid)) continue;
-    track1->GetTPCpid(pidTrk1);
-    Int_t q1 = trp1->Charge();
-    if (!((fTrackCuts->AcceptTrack(track1)) && (q1 == 1) && 
-	  (pidTrk1[AliPID::kPion]+pidTrk1[AliPID::kMuon] > 0.5))) continue;
-    if (!track1->GetInnerXYZ(tpcEnt1)) continue;
-    clu1 = track1->GetTPCClusterMap();
-    sha1 = track1->GetTPCSharedMap();
-    SetTr1(track1->Pt(), track1->Eta(), track1->Phi(), mpi);
-    SetTpcEnt1(tpcEnt1[0], tpcEnt1[1], tpcEnt1[2]);
-    for(Int_t jtrack = 0; jtrack < itrack; jtrack++) {
-      AliESDtrack *track2 = fESDEvent->GetTrack(jtrack);
-      AliExternalTrackParam *trp2 = const_cast (track2->GetTPCInnerParam());
-      if (!trp2) continue;
-      if (!track2->IsOn(AliESDtrack::kTPCpid)) continue;
-      track2->GetTPCpid(pidTrk2);
-      Int_t q2 = trp2->Charge();
-      if (!((fTrackCuts->AcceptTrack(track2)) && (q2 == 1) && 
-	    (pidTrk2[AliPID::kPion]+pidTrk2[AliPID::kMuon] > 0.5))) continue;
-      if (!track2->GetInnerXYZ(tpcEnt2)) continue;
-      clu2 = track2->GetTPCClusterMap();
-      sha2 = track2->GetTPCSharedMap();
-      SetTr2(track2->Pt(), track2->Eta(), track2->Phi(), mpi);
-      SetTpcEnt2(tpcEnt2[0], tpcEnt2[1], tpcEnt2[2]);
-      for (Int_t i = tpcIn; i < tpcOut; i++) { // Minimum distance 
-	trp1->GetDistance(trp2, (double) i, pos1, bfield);
-	x1.SetXYZ(pos1[0], pos1[1], pos1[2]);
-	tdist[i-tpcIn] = x1.Mag();
-	x1.SetXYZ(-pos1[0], -pos1[1], pos1[2]);
-	tdistrot[i-tpcIn] = x1.Mag();
-      }
-      Double_t maxdist = 0.0;
-      for (Int_t j = 0; j < tpcOut-tpcIn; j++) {
-	if (tdist[j] > maxdist) { maxdist = tdist[j]; }
-      }
-      Double_t mindist = maxdist;
-      int jmin=0;
-      for (Int_t j = 0; j < tpcOut-tpcIn; j++) {
-	if (tdist[j] < mindist) {jmin=j;  mindist = tdist[j]; }
-      }
-      //      Double_t mindist = MinDist(track1, track2);
-      Double_t dist = Dist();
-      Double_t dphi = DPhi();
-      Double_t deta = DEta();
-      Int_t    nsh1 = GetNSha(clu1, sha1);
-      Int_t    nsh2 = GetNSha(clu2, sha2);
-      Double_t corr = Corr(clu1, clu2, sha1, sha2);
-      Double_t qfac = Qfac(clu1, clu2, sha1, sha2);
-      if ((TMath::Abs(dphi)<0.35)&&(deta<0.35)) {
-	FillNTuple1(mindist,dist,corr,qfac,nsh1,nsh2);}    // True
-      Double_t tr2rot = RotTr2Phi();                // Rotate trck2
-      SetTr2(track2->Pt(), track2->Eta(), tr2rot, mpi);
-      tpcEnt2[0] = -tpcEnt2[0];
-      tpcEnt2[1] = -tpcEnt2[1];
-      Double_t distrot = Dist();
-      Double_t dphirot = DPhi();
-      Double_t mindistrot = 100000;
-      jmin=0;
-      for (Int_t j = 0; j < tpcOut-tpcIn; j++) {
-	if (tdistrot[j] < mindistrot) {jmin=j;  mindistrot = tdistrot[j]; }
-      }
-      if ((TMath::Abs(dphirot)<0.35)&&(deta<0.35)) {
-	if (rnd.Rndm() < 0.5) NoSwap();
-	else Swap(); 
-	FillNTuple2(mindistrot,distrot,corr,qfac,nsh1,nsh2);} // Mixed
-    }
-  }
-  PostData(0, fOutContainer);
-  nr++;
-}
-
-void AliTwoTrackRes::Terminate(Option_t *) {
-//______________________________________________________________________________
-// Write output and clean up
-
-  fOutContainer = (TObjArray*)GetOutputData(0);
-  TFile *f1  = new TFile( "twotrackres_femto.root", "RECREATE" );
-  fOutContainer->Write();
-  f1->Flush();
-  f1->Close();
-  delete f1;
-  delete fChain;
-  delete fNTuple1;
-  delete fNTuple2;
-  printf("\n");
-}
-
-//______________________________________________________________________________
-// Miscellaneous methods
-
-// Set tracks 
-void AliTwoTrackRes::SetTr1(double pt1, double eta1, double phi1, double m) {
-  fP1.SetPtEtaPhiM(pt1, eta1, phi1, m);}
-void AliTwoTrackRes::SetTr2(double pt2, double eta2, double phi2, double m) {
-  fP2.SetPtEtaPhiM(pt2, eta2, phi2, m);}
-
-// Set nominal TPC entrance coordinates
-void AliTwoTrackRes::SetTpcEnt1(double x1, double y1, double z1) {
-  fTpcEnt1.SetX(x1); fTpcEnt1.SetY(y1); fTpcEnt1.SetZ(z1);}
-void AliTwoTrackRes::SetTpcEnt2(double x2, double y2, double z2) {
-  fTpcEnt2.SetX(x2); fTpcEnt2.SetY(y2); fTpcEnt2.SetZ(z2);}
-
-double AliTwoTrackRes::MinDist(AliExternalTrackParam *trk1,
-			       AliExternalTrackParam *trk2) {
-// Calculate minimum track separation within the TPC
-
-  int tpcIn = 0;   // [cm]
-  int tpcOut = 170; // [cm]
-  double tdist[170], pos[3];
-  TVector3 x;
-  for (int i = tpcIn; i < tpcOut; i++) {
-    trk1->GetDistance(trk2, i, pos, 5000);
-    x.SetXYZ(pos[0], pos[1], pos[2]);
-    tdist[i-tpcIn] = x.Mag();
-  }
-  double maxdist = 0.0;
-  for (int j = 0; j < tpcOut-tpcIn; j++) {
-    if (tdist[j] > maxdist) { maxdist = tdist[j]; }
-  }
-  double mindist = maxdist;
-  for (int j = 0; j < tpcOut-tpcIn; j++) {
-    if (tdist[j] < mindist) { mindist = tdist[j]; }
-  }
-  return mindist;}
-
-int AliTwoTrackRes::GetNSha(TBits cl, TBits sh) {
-// Get number of shared clusters
-
-  int ncl = cl.GetNbits();
-  int sum = 0; 
-  for(int i = 0; i < ncl; i++) {
-    if (!cl.TestBitNumber(i)) continue;
-    int n = sh.TestBitNumber(i);
-    sum += n;}
-  return sum;}
-
-double AliTwoTrackRes::Corr(TBits cl1,  TBits cl2, TBits sh1, TBits sh2) {
-// Calculate correlation coefficient
-
-  int ncl1 = cl1.GetNbits();
-  int ncl2 = cl2.GetNbits();
-  double sumN = 0;  double sumX = 0;  double sumY = 0;
-  double sumXX = 0; double sumYY = 0; double sumXY = 0; double corr = -2.0;
-  for(int i = 0; i < ncl1 && i < ncl2; i++) {
-    if (!(cl1.TestBitNumber(i)&&cl2.TestBitNumber(i))) continue;
-    int x = sh1.TestBitNumber(i);
-    int y = sh2.TestBitNumber(i);
-    sumN += 1.0;
-    sumX += x;
-    sumY += y;
-    sumXX += x*x;
-    sumYY += y*y;
-    sumXY += x*y;
-  }
-  double meanX = sumX/sumN;
-  double meanY = sumY/sumN;
-  double meanXX = sumXX/sumN;
-  double meanYY = sumYY/sumN;
-  double meanXY = sumXY/sumN;
-  double sX = TMath::Sqrt(TMath::Abs(meanXX-meanX*meanX));
-  double sY = TMath::Sqrt(TMath::Abs(meanYY-meanY*meanY));
-  if (sX*sY!=0) corr = (meanXY-meanX*meanY)/(sX*sY);
-  return corr;}
-
-double AliTwoTrackRes::Qfac(TBits cl1,  TBits cl2, TBits sh1, TBits sh2) {
-// Quality factor from AliFemto 
-
-  int ncl1 = cl1.GetNbits();
-  int ncl2 = cl2.GetNbits();
-  int sumCls = 0; int sumSha = 0; int sumQ = 0;
-  double shfrac = 0; double qfactor = 0;
-  for(int i = 0; i < ncl1 && i < ncl2; i++) {
-    if (cl1.TestBitNumber(i) && cl2.TestBitNumber(i)) { // Both clusters
-      if (sh1.TestBitNumber(i) && sh2.TestBitNumber(i)) { // Shared
-	sumQ++;
-	sumCls+=2;
-	sumSha+=2;}
-      else {sumQ--; sumCls+=2;}
-    }
-    else if (cl1.TestBitNumber(i) || cl2.TestBitNumber(i)) { // Non shared
-      sumQ++;
-      sumCls++;}
-  }
-  if (sumCls>0) {
-    qfactor = sumQ*1.0/sumCls;
-    shfrac = sumSha*1.0/sumCls;
-  }
-  return qfactor;
-}
-
-// Rotate second track for mixed pairs
-double AliTwoTrackRes::RotTr2Phi() {
-  double rot = TVector2::Phi_mpi_pi(fP2.Phi()+TMath::Pi());
-  fTpcEnt2.SetPhi(TVector2::Phi_mpi_pi(fTpcEnt2.Phi()+TMath::Pi())); 
-  return rot;}
-
-// Fill NTuples
-void AliTwoTrackRes::FillNTuple1(double minsep, double sep, double corr, 
-				 double qf, int ns1, int ns2) {
-  fNTuple1->Fill(fP1.Pt(),fP1.Eta(),fP1.Phi(),ns1,fP2.Pt(),fP2.Eta(),
-		 fP2.Phi(),ns2,Qinv(),minsep,sep,corr,qf);}
-void AliTwoTrackRes::FillNTuple2(double minsep, double sep, double corr, 
-				 double qf, int ns1, int ns2) {
-  fNTuple2->Fill(fPb1.Pt(),fPb1.Eta(),fPb1.Phi(),ns1,fPb2.Pt(),fPb2.Eta(),
-		 fPb2.Phi(),ns2,Qinv(),minsep,sep,corr,qf);}
-
-//______________________________________________________________________________
-// EOF
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/AliTwoTrackRes.h b/PWG2/FEMTOSCOPY/AliFemto/AliTwoTrackRes.h
deleted file mode 100644
index f997736aba1..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/AliTwoTrackRes.h
+++ /dev/null
@@ -1,93 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//345678901234567890123456789012345678901234567890123456789012345678901234567890
-//       1         2         3         4         5         6         7         8
-//
-// Class AliTwoTrackRes 
-// J. Mercado. Last modified: 28.12.2009
-//
-////////////////////////////////////////////////////////////////////////////////
-
-#ifndef ALITWOTRACKRES_H
-#define ALITWOTRACKRES_H
-
-#include 
-#include 
-#include 
-#include 
-#include "TMath.h"
-#include "TBits.h"
-#include "TVector3.h"
-#include "TLorentzVector.h"
-#include "AliAnalysisTask.h"
-#include "AliESD.h"
-#include "AliESDEvent.h"
-#include "AliESDtrack.h"
-#include "AliESDtrackCuts.h"
-#include "AliExternalTrackParam.h"
-
-//______________________________________________________________________________
-class AliTwoTrackRes : public AliAnalysisTask {
-
-public:
-  
-  AliTwoTrackRes() : AliAnalysisTask("",""), fChain(0), fESDEvent(0), fOutContainer(0), 
-    fTrackCuts(0), fNTuple1(0), fNTuple2(0), fP1(), fP2(), fPb1(), fPb2(), fP(), 
-    fQ(), fTpcEnt1(), fTpcEnt2(), fTpcDist() {}
-  AliTwoTrackRes(const char *name);
-  AliTwoTrackRes(const AliTwoTrackRes& aTwoTrackRes);
-  virtual ~AliTwoTrackRes();
-
-  AliTwoTrackRes& operator=(const AliTwoTrackRes& aTwoTrackRes);
-
-  virtual void ConnectInputData(Option_t *);
-  virtual void CreateOutputObjects();
-  virtual void Exec(Option_t *opt = "");
-  virtual void Terminate(Option_t *opt = "");
-
-  void   SetTr1(double pt1, double eta1, double phi1, double m);
-  void   SetTr2(double pt2, double eta2, double phi2, double m);
-  void   SetTpcEnt1(double x1, double y1, double z1);
-  void   SetTpcEnt2(double x2, double y2, double z2);
-  double Qinv2()         {fQ = fP2 - fP1; return -1.*fQ.M2();}
-  double Qinv()          {return TMath::Sqrt(TMath::Abs(Qinv2()));}
-  double MinDist(AliExternalTrackParam *trk1, AliExternalTrackParam *trk2);
-  int    GetNSha(TBits cl, TBits sh);
-  double Corr(TBits cl1, TBits cl2, TBits sh1, TBits sh2);
-  double Qfac(TBits cl1, TBits cl2, TBits sh1, TBits sh2);
-  double RotTr2Phi();
-  double Dist()    {fTpcDist = fTpcEnt2 - fTpcEnt1; return fTpcDist.Mag();}
-  double DEta()    const {return TMath::Abs(fP2.Eta()-fP1.Eta());}
-  double DTheta()  const {return fP2.Theta()-fP1.Theta();}
-  double DPhi()    const {return TVector2::Phi_mpi_pi(fP2.Phi()-fP1.Phi());}
-  void   NoSwap()        {fPb1 = fP1; fPb2 = fP2;}
-  void   Swap()          {fPb1 = fP2; fPb2 = fP1;}
-  void   FillNTuple1(double minsep, double sep, double corr, double qf, 
-		     int ns1, int ns2);
-  void   FillNTuple2(double minsep, double sep, double corr, double qf, 
-		     int ns1, int ns2);
-
-private:
-
-  TTree           *fChain;        // Chain of ESD trees
-  AliESDEvent     *fESDEvent;     // Leaves
-  TObjArray       *fOutContainer; // Output data container
-  AliESDtrackCuts *fTrackCuts;    // Track cuts
-  TNtuple         *fNTuple1;      // True pairs
-  TNtuple         *fNTuple2;      // Mixed pairs
-  TLorentzVector  fP1;            // Four-momentum of track 1 (lab)
-  TLorentzVector  fP2;            // Four-momentum of track 2 (lab)
-  TLorentzVector  fPb1;           // Buffer single-track 1 for swapping
-  TLorentzVector  fPb2;           // Buffer single-track 2 for swapping
-  TLorentzVector  fP;             // Total four-momentum (lab)
-  TLorentzVector  fQ;             // Four-momentum difference (lab)
-  TVector3        fTpcEnt1;       // Nominal TPC entrance point track 1
-  TVector3        fTpcEnt2;       // Nominal TPC entrance point track 2
-  TVector3        fTpcDist;       // Nominal TPC entrance separation 
-
-  ClassDef(AliTwoTrackRes, 0);
-};
-#endif
-
-//______________________________________________________________________________
-// EOF
-
diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
index a0e9fa0a1c1..0c7c5b8e27a 100644
--- a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
+++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
@@ -368,14 +368,10 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *)
     if (!fCFManager2) {cout << "ERROR: No pointer to correction framework cuts! " << endl; return; }
 
     if (!fESD) { Printf("ERROR: fESD not available"); return;}
-    //check the offline trigger (check if the event has the correct trigger)
-    if (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected())
-      {
-	Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
-	
-	// analysis 
-	fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
-      }
+    Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+    
+    // analysis 
+    fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
   }
   // Fill the FlowEventSimple for ESD input combined with MC info  
   else if (fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1" ) {
diff --git a/PWG2/FLOW/macros/AddTaskFlow.C b/PWG2/FLOW/macros/AddTaskFlow.C
index b57505d69a2..d7e6bfbdcf9 100644
--- a/PWG2/FLOW/macros/AddTaskFlow.C
+++ b/PWG2/FLOW/macros/AddTaskFlow.C
@@ -10,133 +10,46 @@
 
 // SETTING THE CUTS
 
-//----------Event selection----------
-Bool_t UseMultCutforESD = kTRUE;
-//Bool_t UseMultCutforESD = kFALSE;
-const Int_t multminESD = 1;  //used for CORRFW cuts 
-const Int_t multmaxESD = 1000000; //used for CORRFW cuts 
-
-//Bool_t UseMultCut = kTRUE;
-Bool_t UseMultCut = kFALSE;
+// event selection
+const Int_t multminESD = 10;  //used for CORRFW cuts 
+const Int_t multmaxESD = 1000; //used for CORRFW cuts 
+//const Int_t multmaxESD = 1000000; //used for CORRFW cuts 
+
 const Int_t multmin = 10;     //used for AliFlowEventSimple (to set the centrality)
 const Int_t multmax = 40;     //used for AliFlowEventSimple (to set the centrality)
 //const Int_t multmin = 10;     //used for AliFlowEventSimple (to set the centrality)
 //const Int_t multmax = 1000000;     //used for AliFlowEventSimple (to set the centrality)
 
 
-//----------For RP selection----------
-//KINEMATICS (on generated and reconstructed tracks)
-Bool_t UseKineforRP =  kTRUE;
-const Double_t ptminRP = 0.0;
-const Double_t ptmaxRP = 10.0;
-const Double_t etaminRP  = -0.9;
-const Double_t etamaxRP  = 0.9;
-const Int_t    chargeRP = 1;  //not used
-
-//PID (on generated and reconstructed tracks)
+// For RP selection
+const Double_t ptmin1 = 0.0;
+const Double_t ptmax1 = 10.0;
+const Double_t ymin1  = -1.;
+const Double_t ymax1  = 1.;
+const Int_t mintrackrefsTPC1 = 2;
+const Int_t mintrackrefsITS1 = 3;
+const Int_t charge1 = 1;
 Bool_t UsePIDforRP = kFALSE;
-const Int_t PdgRP = 211;
-
-//TRACK QUALITY (on reconstructed tracks only)
-//see /CORRFW/AliCFTrackQualityCuts class
-Bool_t UseTrackQualityforRP =  kTRUE;
-const Int_t    minClustersTpcRP = 80;           //default = -1; 
-const Double_t maxChi2PerClusterTpcRP = 3.5;    //default = 1.e+09;
-const UShort_t minDedxClusterTpcRP = 0;
-const Int_t    minClustersItsRP = 2;            //panos
-const Double_t maxChi2PerClusterItsRP = 1.e+09; 
-const Int_t    minClustersTrdRP = -1;
-const Int_t    minTrackletTrdRP = -1;
-const Int_t    minTrackletTrdPidRP = -1;
-const Double_t maxChi2PerClusterTrdRP = 1.e+09;
-const ULong_t  statusRP = AliESDtrack::kTPCrefit;   //AliESDtrack::kTPCrefit &  AliESDtrack::kITSrefit 
-
-//PRIMARY (on reconstructed tracks only)
-//see /CORRFW/AliCFTrackIsPrimaryCuts class
-Bool_t UsePrimariesforRP = kTRUE;
-const Bool_t   spdVertexRP = kFALSE;
-const Bool_t   tpcVertexRP = kFALSE;
-const Float_t  minDcaToVertexXyRP = 0.;
-const Float_t  minDcaToVertexZRP = 0.;
-const Float_t  maxDcaToVertexXyRP = 2.4;         //default = 1.e+10;  //2.4;
-const Float_t  maxDcaToVertexZRP = 3.2;          //default = 1.e+10;  //3.2;
-const Bool_t   dcaToVertex2dRP = kFALSE;         //default = kFALSE;
-const Bool_t   absDcaToVertexRP = kTRUE;         //default = kTRUE;
-const Double_t minNSigmaToVertexRP = 0.;
-const Double_t maxNSigmaToVertexRP = 1.e+10; //3.; //1.e+10
-const Double_t maxSigmaDcaXySP = 1.e+10;
-const Double_t maxSigmaDcaZSP = 1.e+10;
-const Bool_t   requireSigmaToVertexSP = kFALSE;
-const Bool_t   acceptKinkDaughtersSP = kFALSE;  //default = kTRUE;
-
-//ACCEPTANCE (on generated tracks only : AliMCParticle)
-//see /CORRFW/AliCFAcceptanceCuts class
-Bool_t UseAcceptanceforRP =  kFALSE; 
-const Int_t  minTrackrefsItsRP = 0;//3;
-const Int_t  minTrackrefsTpcRP = 0;//2;
-const Int_t  minTrackrefsTrdRP = 0; 
-const Int_t  minTrackrefsTofRP = 0; 
-const Int_t  minTrackrefsMuonRP = 0; 
-//default for all is 0
-
-//----------For POI selection----------
-//KINEMATICS (on generated and reconstructed tracks)
-Bool_t UseKineforPOI = kTRUE;
-const Double_t ptminPOI = 0.0;
-const Double_t ptmaxPOI = 10.0;
-const Double_t etaminPOI  = -0.9;
-const Double_t etamaxPOI  = 0.9;
-const Int_t    chargePOI = 1;  //not used
-
-//PID (on generated and reconstructed tracks)
+const Int_t PDG1 = 211;
+const Int_t minclustersTPC1 = 50;
+const Int_t maxnsigmatovertex1 = 3;
+
+// For for POI selection
+const Double_t ptmin2 = 0.0;
+const Double_t ptmax2 = 10.0;
+const Double_t ymin2  = -1.;
+const Double_t ymax2  = 1.;
+const Int_t mintrackrefsTPC2 = 2;
+const Int_t mintrackrefsITS2 = 3;
+const Int_t charge2 = 1;
 Bool_t UsePIDforPOI = kFALSE;
-const Int_t PdgPOI = 321;
-
-//TRACK QUALITY (on reconstructed tracks only)
-//see /CORRFW/AliCFTrackQualityCuts class
-Bool_t UseTrackQualityforPOI = kTRUE;
-const Int_t    minClustersTpcPOI = 80;
-const Double_t maxChi2PerClusterTpcPOI = 3.5;    
-const UShort_t minDedxClusterTpcPOI = 0;
-const Int_t    minClustersItsPOI = 2;
-const Double_t maxChi2PerClusterItsPOI = 1.e+09;
-const Int_t    minClustersTrdPOI = -1;
-const Int_t    minTrackletTrdPOI = -1;
-const Int_t    minTrackletTrdPidPOI = -1;
-const Double_t maxChi2PerClusterTrdPOI = 1.e+09;
-const ULong_t  statusPOI = AliESDtrack::kTPCrefit;   
-
-//PRIMARY (on reconstructed tracks only)
-//see /CORRFW/AliCFTrackIsPrimaryCuts class
-Bool_t UsePrimariesforPOI = kTRUE;
-const Bool_t   spdVertexPOI = kFALSE;
-const Bool_t   tpcVertexPOI = kFALSE;
-const Float_t  minDcaToVertexXyPOI = 0.;
-const Float_t  minDcaToVertexZPOI = 0.;
-const Float_t  maxDcaToVertexXyPOI = 2.4;
-const Float_t  maxDcaToVertexZPOI = 3.2;
-const Bool_t   dcaToVertex2dPOI =  kFALSE;
-const Bool_t   absDcaToVertexPOI = kTRUE;
-const Double_t minNSigmaToVertexPOI = 0.;
-const Double_t maxNSigmaToVertexPOI = 1.e+10;  
-const Double_t maxSigmaDcaXyPOI = 1.e+10;
-const Double_t maxSigmaDcaZPOI = 1.e+10;
-const Bool_t   requireSigmaToVertexPOI = kFALSE;
-const Bool_t   acceptKinkDaughtersPOI = kFALSE;
-
-//ACCEPTANCE (on generated tracks only : AliMCParticle)
-//see /CORRFW/AliCFAcceptanceCuts class
-Bool_t UseAcceptanceforPOI = kFALSE;
-const Int_t minTrackrefsItsPOI = 3;
-const Int_t minTrackrefsTpcPOI = 2;
-const Int_t minTrackrefsTrdPOI = 0; 
-const Int_t minTrackrefsTofPOI = 0; 
-const Int_t minTrackrefsMuonPOI = 0; 
-
-
-//----------For Adding Flow to the Event----------
+const Int_t PDG2 = 321;
+const Int_t minclustersTPC2 = 50;
+const Int_t maxnsigmatovertex2 = 3;
+
+// For manipulating the event (for testing purposes)
 const Bool_t AddToEvent = kFALSE;
-Double_t ellipticFlow = 0.05;
+Double_t ellipticflow = 0.05;
 
 
 AliAnalysisTaskFlowEvent* AddTaskFlow(TString type, Bool_t* METHODS, Bool_t QA, Bool_t* WEIGHTS)
@@ -255,20 +168,18 @@ if (LYZ2PROD){
   if (QA) { 
     if(AddToEvent) { 
       taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kTRUE,1);
-      taskFE->SetEllipticFlowValue(ellipticFlow); }    //TEST
+      taskFE->SetEllipticFlowValue(ellipticflow); }    //TEST
     else {taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kTRUE); }
     taskFE->SetAnalysisType(type);
-    if (UseMultCut) {
-      taskFE->SetMinMult(multmin);
-      taskFE->SetMaxMult(multmax);}
+    taskFE->SetMinMult(multmin);
+    taskFE->SetMaxMult(multmax);
     mgr->AddTask(taskFE);
   }
   else { 
     taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kFALSE); 
     taskFE->SetAnalysisType(type);
-    if (UseMultCut) {
-      taskFE->SetMinMult(multmin);
-      taskFE->SetMaxMult(multmax); }
+    taskFE->SetMinMult(multmin);
+    taskFE->SetMaxMult(multmax);
     mgr->AddTask(taskFE);
   }
  
@@ -280,7 +191,7 @@ if (LYZ2PROD){
     TList* qaPOI = new TList();
   }
 
-  //----------Event cuts----------
+  //############# event cuts on multiplicity
   AliCFEventGenCuts* mcEventCuts = new AliCFEventGenCuts("mcEventCuts","MC-level event cuts");
   mcEventCuts->SetNTracksCut(multminESD,multmaxESD); 
   if (QA) { 
@@ -291,286 +202,209 @@ if (LYZ2PROD){
   if (QA) { 
     recEventCuts->SetQAOn(qaRP);
   }
-  
-  //----------Cuts for RP----------
-  //KINEMATICS (MC and reconstructed)
-  AliCFTrackKineCuts* mcKineCutsRP = new AliCFTrackKineCuts("mcKineCutsRP","MC-level kinematic cuts");
-  mcKineCutsRP->SetPtRange(ptminRP,ptmaxRP);
-  mcKineCutsRP->SetEtaRange(etaminRP,etamaxRP);
-  //mcKineCutsRP->SetChargeMC(chargeRP);
-  if (QA) { 
-    mcKineCutsRP->SetQAOn(qaRP);
-  }
 
-  AliCFTrackKineCuts *recKineCutsRP = new AliCFTrackKineCuts("recKineCutsRP","rec-level kine cuts");
-  recKineCutsRP->SetPtRange(ptminRP,ptmaxRP);
-  recKineCutsRP->SetEtaRange(etaminRP,etamaxRP);
-  //recKineCutsRP->SetChargeRec(chargeRP);
+  //############# cuts on MC
+  AliCFTrackKineCuts* mcKineCuts1 = new AliCFTrackKineCuts("mcKineCuts1","MC-level kinematic cuts");
+  mcKineCuts1->SetPtRange(ptmin1,ptmax1);
+  mcKineCuts1->SetRapidityRange(ymin1,ymax1);
+  //mcKineCuts1->SetChargeMC(charge1);
   if (QA) { 
-    recKineCutsRP->SetQAOn(qaRP);
+    mcKineCuts1->SetQAOn(qaRP);
   }
 
-  //PID (MC and reconstructed)
-  AliCFParticleGenCuts* mcGenCutsRP = new AliCFParticleGenCuts("mcGenCutsRP","MC particle generation cuts for RP");
-  mcGenCutsRP->SetRequireIsPrimary();
-  if (UsePIDforRP) {mcGenCutsRP->SetRequirePdgCode(PdgRP);}
+  AliCFTrackKineCuts* mcKineCuts2 = new AliCFTrackKineCuts("mcKineCuts2","MC-level kinematic cuts");
+  mcKineCuts2->SetPtRange(ptmin2,ptmax2);
+  mcKineCuts2->SetRapidityRange(ymin2,ymax2);
+  //mcKineCuts2->SetChargeMC(charge2);
   if (QA) { 
-    mcGenCutsRP->SetQAOn(qaRP);
+    mcKineCuts2->SetQAOn(qaPOI);
   }
-
-  int n_species = AliPID::kSPECIES ;
-  Double_t* prior = new Double_t[n_species];
   
-  prior[0] = 0.0244519 ;
-  prior[1] = 0.0143988 ;
-  prior[2] = 0.805747  ;
-  prior[3] = 0.0928785 ;
-  prior[4] = 0.0625243 ;
+  AliCFParticleGenCuts* mcGenCuts1 = new AliCFParticleGenCuts("mcGenCuts1","MC particle generation cuts for RP");
+  mcGenCuts1->SetRequireIsPrimary();
+  if (UsePIDforRP) {mcGenCuts1->SetRequirePdgCode(PDG1);}
+  if (QA) { 
+    mcGenCuts1->SetQAOn(qaRP);
+  }
   
-  AliCFTrackCutPid* cutPidRP = NULL;
-  if(UsePIDforRP) {
-    cutPidRP = new AliCFTrackCutPid("cutPidRP","ESD_PID for RP") ;
-    cutPidRP->SetPriors(prior);
-    cutPidRP->SetProbabilityCut(0.0);
-    cutPidRP->SetDetectors("TPC TOF");
-    switch(TMath::Abs(PDG1)) {
-    case 11   : cutPidRP->SetParticleType(AliPID::kElectron, kTRUE); break;
-    case 13   : cutPidRP->SetParticleType(AliPID::kMuon    , kTRUE); break;
-    case 211  : cutPidRP->SetParticleType(AliPID::kPion    , kTRUE); break;
-    case 321  : cutPidRP->SetParticleType(AliPID::kKaon    , kTRUE); break;
-    case 2212 : cutPidRP->SetParticleType(AliPID::kProton  , kTRUE); break;
-    default   : printf("UNDEFINED PID\n"); break;
-    }
-    if (QA) { 
-      cutPidRP->SetQAOn(qaRP); 
-    }
+  AliCFParticleGenCuts* mcGenCuts2 = new AliCFParticleGenCuts("mcGenCuts2","MC particle generation cuts for POI");
+  mcGenCuts2->SetRequireIsPrimary();
+  if (UsePIDforPOI) {mcGenCuts2->SetRequirePdgCode(PDG2);}
+  if (QA) { 
+    mcGenCuts2->SetQAOn(qaPOI);
+  }
+
+  //############# Acceptance Cuts  
+  AliCFAcceptanceCuts *mcAccCuts1 = new AliCFAcceptanceCuts("mcAccCuts1","MC acceptance cuts");
+  mcAccCuts1->SetMinNHitITS(mintrackrefsITS1);
+  mcAccCuts1->SetMinNHitTPC(mintrackrefsTPC1);
+  if (QA) { 
+    mcAccCuts1->SetQAOn(qaRP);
   }
   
-  //TRACK QUALITY
-  AliCFTrackQualityCuts *recQualityCutsRP = new AliCFTrackQualityCuts("recQualityCutsRP","rec-level quality cuts");
-  recQualityCutsRP->SetMinNClusterTPC(minClustersTpcRP);
-  //recQualityCutsRP->SetMinFoundClusterTPC(minFoundClustersTpcRP); //only for internal TPC QA
-  recQualityCutsRP->SetMaxChi2PerClusterTPC(maxChi2PerClusterTpcRP);
-  recQualityCutsRP->SetMinNdEdxClusterTPC(minDedxClusterTpcRP);     //to reject secondaries
-
-  recQualityCutsRP->SetMinNClusterITS(minClustersItsRP);
-  recQualityCutsRP->SetMaxChi2PerClusterITS(maxChi2PerClusterItsRP);
-
-  recQualityCutsRP->SetMinNClusterTRD(minClustersTrdRP);
-  recQualityCutsRP->SetMinNTrackletTRD(minTrackletTrdRP);
-  recQualityCutsRP->SetMinNTrackletTRDpid(minTrackletTrdPidRP);
-  recQualityCutsRP->SetMaxChi2PerTrackletTRD(maxChi2PerClusterTrdRP);
-  recQualityCutsRP->SetStatus(statusRP);  
+  AliCFAcceptanceCuts *mcAccCuts2 = new AliCFAcceptanceCuts("mcAccCuts2","MC acceptance cuts");
+  mcAccCuts2->SetMinNHitITS(mintrackrefsITS2);
+  mcAccCuts2->SetMinNHitTPC(mintrackrefsTPC2);
   if (QA) { 
-    recQualityCutsRP->SetQAOn(qaRP);
-  }
-
-  /* 
-  //How to set this?
-  void SetMaxCovDiagonalElements(Float_t c1=1.e+09, Float_t c2=1.e+09, Float_t c3=1.e+09, Float_t c4=1.e+09, Float_t c5=1.e+09)
-    {fCovariance11Max=c1;fCovariance22Max=c2;fCovariance33Max=c3;fCovariance44Max=c4;fCovariance55Max=c5;}
-  */
-
-  //PRIMARIES
-  AliCFTrackIsPrimaryCuts *recIsPrimaryCutsRP = new AliCFTrackIsPrimaryCuts("recIsPrimaryCutsRP","rec-level isPrimary cuts");
-  recIsPrimaryCutsRP->UseSPDvertex(spdVertexRP);
-  recIsPrimaryCutsRP->UseTPCvertex(tpcVertexRP);
-  recIsPrimaryCutsRP->SetMinDCAToVertexXY(minDcaToVertexXyRP); 
-  recIsPrimaryCutsRP->SetMinDCAToVertexZ(minDcaToVertexZRP);
-  recIsPrimaryCutsRP->SetMaxDCAToVertexXY(maxDcaToVertexXyRP);
-  recIsPrimaryCutsRP->SetMaxDCAToVertexZ(maxDcaToVertexZRP); 
-  recIsPrimaryCutsRP->SetDCAToVertex2D(dcaToVertex2dRP);
-  recIsPrimaryCutsRP->SetAbsDCAToVertex(absDcaToVertexRP);
-  recIsPrimaryCutsRP->SetMinNSigmaToVertex(minNSigmaToVertexRP); 
-  recIsPrimaryCutsRP->SetMaxNSigmaToVertex(maxNSigmaToVertexRP); 
-  recIsPrimaryCutsRP->SetMaxSigmaDCAxy(maxSigmaDcaXySP);
-  recIsPrimaryCutsRP->SetMaxSigmaDCAz(maxSigmaDcaZSP);
-  recIsPrimaryCutsRP->SetRequireSigmaToVertex(requireSigmaToVertexSP);
-  recIsPrimaryCutsRP->SetAcceptKinkDaughters(acceptKinkDaughtersSP);
+    mcAccCuts2->SetQAOn(qaPOI);
+  }
+  //############# Rec-Level kinematic cuts
+  AliCFTrackKineCuts *recKineCuts1 = new AliCFTrackKineCuts("recKineCuts1","rec-level kine cuts");
+  recKineCuts1->SetPtRange(ptmin1,ptmax1);
+  recKineCuts1->SetRapidityRange(ymin1,ymax1);
+  //recKineCuts1->SetChargeRec(charge1);
   if (QA) { 
-    recIsPrimaryCutsRP->SetQAOn(qaRP);
+    recKineCuts1->SetQAOn(qaRP);
   }
   
-  //ACCEPTANCE
-  AliCFAcceptanceCuts *mcAccCutsRP = new AliCFAcceptanceCuts("mcAccCutsRP","MC acceptance cuts");
-  mcAccCutsRP->SetMinNHitITS(minTrackrefsItsRP);
-  mcAccCutsRP->SetMinNHitTPC(minTrackrefsTpcRP);
-  mcAccCutsRP->SetMinNHitTRD(minTrackrefsTrdRP); 
-  mcAccCutsRP->SetMinNHitTOF(minTrackrefsTofRP);
-  mcAccCutsRP->SetMinNHitMUON(minTrackrefsMuonRP);
+  AliCFTrackKineCuts *recKineCuts2 = new AliCFTrackKineCuts("recKineCuts2","rec-level kine cuts");
+  recKineCuts2->SetPtRange(ptmin2,ptmax2);
+  recKineCuts2->SetRapidityRange(ymin2,ymax2);
+  //recKineCuts2->SetChargeRec(charge2);
   if (QA) { 
-    mcAccCutsRP->SetQAOn(qaRP);
+    recKineCuts2->SetQAOn(qaPOI);
   }
-
   
-  //----------Cuts for POI----------
-  //KINEMATICS (MC and reconstructed)
-  AliCFTrackKineCuts* mcKineCutsPOI = new AliCFTrackKineCuts("mcKineCutsPOI","MC-level kinematic cuts");
-  mcKineCutsPOI->SetPtRange(ptminPOI,ptmaxPOI);
-  mcKineCutsPOI->SetEtaRange(etaminPOI,etamaxPOI);
-  //mcKineCutsPOI->SetChargeMC(chargePOI);
+  AliCFTrackQualityCuts *recQualityCuts1 = new AliCFTrackQualityCuts("recQualityCuts1","rec-level quality cuts");
+  recQualityCuts1->SetMinNClusterTPC(minclustersTPC1);
+  recQualityCuts1->SetStatus(AliESDtrack::kITSrefit);
+  if (QA) { 
+    recQualityCuts1->SetQAOn(qaRP);
+  }
+  AliCFTrackQualityCuts *recQualityCuts2 = new AliCFTrackQualityCuts("recQualityCuts2","rec-level quality cuts");
+  recQualityCuts2->SetMinNClusterTPC(minclustersTPC2);
+  recQualityCuts2->SetStatus(AliESDtrack::kITSrefit);
   if (QA) { 
-    mcKineCutsPOI->SetQAOn(qaPOI);
+    recQualityCuts2->SetQAOn(qaPOI);
   }
   
-  AliCFTrackKineCuts *recKineCutsPOI = new AliCFTrackKineCuts("recKineCutsPOI","rec-level kine cuts");
-  recKineCutsPOI->SetPtRange(ptminPOI,ptmaxPOI);
-  recKineCutsPOI->SetEtaRange(etaminPOI,etamaxPOI);
-  //recKineCutsPOI->SetChargeRec(chargePOI);
+  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts1 = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts1","rec-level isPrimary cuts");
+  recIsPrimaryCuts1->SetMaxNSigmaToVertex(maxnsigmatovertex1);
   if (QA) { 
-    recKineCutsPOI->SetQAOn(qaPOI);
+    recIsPrimaryCuts1->SetQAOn(qaRP);
   }
   
-  //PID (MC and reconstructed)
-  AliCFParticleGenCuts* mcGenCutsPOI = new AliCFParticleGenCuts("mcGenCutsPOI","MC particle generation cuts for POI");
-  mcGenCutsPOI->SetRequireIsPrimary();
-  if (UsePIDforPOI) {mcGenCutsPOI->SetRequirePdgCode(PdgPOI);}
+  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts2 = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts2","rec-level isPrimary cuts");
+  recIsPrimaryCuts2->SetMaxNSigmaToVertex(maxnsigmatovertex2);
   if (QA) { 
-    mcGenCutsPOI->SetQAOn(qaPOI);
+    recIsPrimaryCuts2->SetQAOn(qaPOI);
   }
-
-  AliCFTrackCutPid* cutPidPOI = NULL;
+  
+  int n_species = AliPID::kSPECIES ;
+  Double_t* prior = new Double_t[n_species];
+  
+  prior[0] = 0.0244519 ;
+  prior[1] = 0.0143988 ;
+  prior[2] = 0.805747  ;
+  prior[3] = 0.0928785 ;
+  prior[4] = 0.0625243 ;
+  
+  AliCFTrackCutPid* cutPID1 = NULL;
+  if(UsePIDforRP) {
+    AliCFTrackCutPid* cutPID1 = new AliCFTrackCutPid("cutPID1","ESD_PID for RP") ;
+    cutPID1->SetPriors(prior);
+    cutPID1->SetProbabilityCut(0.0);
+    cutPID1->SetDetectors("TPC TOF");
+    switch(TMath::Abs(PDG1)) {
+    case 11   : cutPID1->SetParticleType(AliPID::kElectron, kTRUE); break;
+    case 13   : cutPID1->SetParticleType(AliPID::kMuon    , kTRUE); break;
+    case 211  : cutPID1->SetParticleType(AliPID::kPion    , kTRUE); break;
+    case 321  : cutPID1->SetParticleType(AliPID::kKaon    , kTRUE); break;
+    case 2212 : cutPID1->SetParticleType(AliPID::kProton  , kTRUE); break;
+    default   : printf("UNDEFINED PID\n"); break;
+    }
+    if (QA) { 
+      cutPID1->SetQAOn(qaRP); 
+    }
+  }
+  
+  AliCFTrackCutPid* cutPID2 = NULL;
   if (UsePIDforPOI) {
-    cutPidPOI = new AliCFTrackCutPid("cutPidPOI","ESD_PID for POI") ;
-    cutPidPOI->SetPriors(prior);
-    cutPidPOI->SetProbabilityCut(0.0);
-    cutPidPOI->SetDetectors("TPC TOF");
+    AliCFTrackCutPid* cutPID2 = new AliCFTrackCutPid("cutPID2","ESD_PID for POI") ;
+    cutPID2->SetPriors(prior);
+    cutPID2->SetProbabilityCut(0.0);
+    cutPID2->SetDetectors("TPC TOF");
     switch(TMath::Abs(PDG2)) {
-    case 11   : cutPidPOI->SetParticleType(AliPID::kElectron, kTRUE); break;
-    case 13   : cutPidPOI->SetParticleType(AliPID::kMuon    , kTRUE); break;
-    case 211  : cutPidPOI->SetParticleType(AliPID::kPion    , kTRUE); break;
-    case 321  : cutPidPOI->SetParticleType(AliPID::kKaon    , kTRUE); break;
-    case 2212 : cutPidPOI->SetParticleType(AliPID::kProton  , kTRUE); break;
+    case 11   : cutPID2->SetParticleType(AliPID::kElectron, kTRUE); break;
+    case 13   : cutPID2->SetParticleType(AliPID::kMuon    , kTRUE); break;
+    case 211  : cutPID2->SetParticleType(AliPID::kPion    , kTRUE); break;
+    case 321  : cutPID2->SetParticleType(AliPID::kKaon    , kTRUE); break;
+    case 2212 : cutPID2->SetParticleType(AliPID::kProton  , kTRUE); break;
     default   : printf("UNDEFINED PID\n"); break;
     }
     if (QA) { 
-      cutPidPOI->SetQAOn(qaPOI);
+      cutPID2->SetQAOn(qaPOI);
     }
   }
-
-  //TRACK QUALITY
-  AliCFTrackQualityCuts *recQualityCutsPOI = new AliCFTrackQualityCuts("recQualityCutsPOI","rec-level quality cuts");
-  recQualityCutsPOI->SetMinNClusterTPC(minClustersTpcPOI);
-  //recQualityCutsPOI->SetMinFoundClusterTPC(minFoundClustersTpcPOI); //only for internal TPC QA
-  recQualityCutsPOI->SetMaxChi2PerClusterTPC(maxChi2PerClusterTpcPOI);
-  recQualityCutsPOI->SetMinNdEdxClusterTPC(minDedxClusterTpcPOI);     //to reject secondaries
-
-  recQualityCutsPOI->SetMinNClusterITS(minClustersItsPOI);
-  recQualityCutsPOI->SetMaxChi2PerClusterITS(maxChi2PerClusterItsPOI);
-
-  recQualityCutsPOI->SetMinNClusterTRD(minClustersTrdPOI);
-  recQualityCutsPOI->SetMinNTrackletTRD(minTrackletTrdPOI);
-  recQualityCutsPOI->SetMinNTrackletTRDpid(minTrackletTrdPidPOI);
-  recQualityCutsPOI->SetMaxChi2PerTrackletTRD(maxChi2PerClusterTrdPOI);
-  recQualityCutsPOI->SetStatus(statusPOI); 
-  if (QA) { 
-    recQualityCutsPOI->SetQAOn(qaPOI);
-  }
-
-  //PRIMARIES
-  AliCFTrackIsPrimaryCuts *recIsPrimaryCutsPOI = new AliCFTrackIsPrimaryCuts("recIsPrimaryCutsPOI","rec-level isPrimary cuts");
-  recIsPrimaryCutsPOI->UseSPDvertex(spdVertexPOI);
-  recIsPrimaryCutsPOI->UseTPCvertex(tpcVertexPOI);
-  recIsPrimaryCutsPOI->SetMinDCAToVertexXY(minDcaToVertexXyPOI); 
-  recIsPrimaryCutsPOI->SetMinDCAToVertexZ(minDcaToVertexZPOI);
-  recIsPrimaryCutsPOI->SetMaxDCAToVertexXY(maxDcaToVertexXyPOI);
-  recIsPrimaryCutsPOI->SetMaxDCAToVertexZ(maxDcaToVertexZPOI); 
-  recIsPrimaryCutsPOI->SetDCAToVertex2D(dcaToVertex2dPOI);
-  recIsPrimaryCutsPOI->SetAbsDCAToVertex(absDcaToVertexPOI);
-  recIsPrimaryCutsPOI->SetMinNSigmaToVertex(minNSigmaToVertexPOI); 
-  recIsPrimaryCutsPOI->SetMaxNSigmaToVertex(maxNSigmaToVertexPOI); 
-  recIsPrimaryCutsPOI->SetMaxSigmaDCAxy(maxSigmaDcaXyPOI);
-  recIsPrimaryCutsPOI->SetMaxSigmaDCAz(maxSigmaDcaZPOI);
-  recIsPrimaryCutsPOI->SetRequireSigmaToVertex(requireSigmaToVertexPOI);
-  recIsPrimaryCutsPOI->SetAcceptKinkDaughters(acceptKinkDaughtersPOI);
-  if (QA) { 
-    recIsPrimaryCutsPOI->SetQAOn(qaPOI);
-  }
-
-  //ACCEPTANCE
-  AliCFAcceptanceCuts *mcAccCutsPOI = new AliCFAcceptanceCuts("mcAccCutsPOI","MC acceptance cuts");
-  mcAccCutsPOI->SetMinNHitITS(minTrackrefsItsPOI);
-  mcAccCutsPOI->SetMinNHitTPC(minTrackrefsTpcPOI);
-  mcAccCutsPOI->SetMinNHitTRD(minTrackrefsTrdPOI); 
-  mcAccCutsPOI->SetMinNHitTOF(minTrackrefsTofPOI);
-  mcAccCutsPOI->SetMinNHitMUON(minTrackrefsMuonPOI);
-  if (QA) { 
-    mcAccCutsPOI->SetQAOn(qaPOI);
-  }
-
-     
   
-  //----------Create Cut Lists----------
   printf("CREATE EVENT CUTS\n");
-  TObjArray* mcEventList = new TObjArray(0);  
-  if (UseMultCutforESD) mcEventList->AddLast(mcEventCuts);//cut on mult
+  TObjArray* mcEventList = new TObjArray(0);
+  mcEventList->AddLast(mcEventCuts);
     
   TObjArray* recEventList = new TObjArray(0);
-  if (UseMultCutforESD) recEventList->AddLast(recEventCuts);//cut on mult
+  recEventList->AddLast(recEventCuts);
 
   printf("CREATE MC KINE CUTS\n");
-  TObjArray* mcListRP = new TObjArray(0);
-  if (UseKineforRP) mcListRP->AddLast(mcKineCutsRP); //cut on pt/eta/phi
-  mcListRP->AddLast(mcGenCutsRP); //cut on primary and if (UsePIDforRP) MC PID
+  TObjArray* mcList1 = new TObjArray(0);
+  mcList1->AddLast(mcKineCuts1);
+  mcList1->AddLast(mcGenCuts1);
   
-  TObjArray* mcListPOI = new TObjArray(0);
-  if (UseKineforPOI) mcListPOI->AddLast(mcKineCutsPOI); //cut on pt/eta/phi
-  mcListPOI->AddLast(mcGenCutsPOI); //cut on primary and if (UsePIDforPOI) MC PID
+  TObjArray* mcList2 = new TObjArray(0);
+  mcList2->AddLast(mcKineCuts2);
+  mcList2->AddLast(mcGenCuts2);
   
-  printf("CREATE MC ACCEPTANCE CUTS\n");
-  TObjArray* accListRP = new TObjArray(0) ;
-  if (UseAcceptanceforRP) accListRP->AddLast(mcAccCutsRP); //cut on number of track references
+  printf("CREATE ACCEPTANCE CUTS\n");
+  TObjArray* accList1 = new TObjArray(0) ;
+  accList1->AddLast(mcAccCuts1);
   
-  TObjArray* accListPOI = new TObjArray(0) ;
-  if (UseAcceptanceforPOI) accListPOI->AddLast(mcAccCutsPOI); //cut on number of track references
+  TObjArray* accList2 = new TObjArray(0) ;
+  accList2->AddLast(mcAccCuts2);
   
-  printf("CREATE ESD RECONSTRUCTION CUTS\n");
-  TObjArray* recListRP = new TObjArray(0) ;
-  if (UseKineforRP)         recListRP->AddLast(recKineCutsRP); //cut on pt/eta/phi
-  if (UseTrackQualityforRP) recListRP->AddLast(recQualityCutsRP);
-  if (UsePrimariesforRP)    recListRP->AddLast(recIsPrimaryCutsRP); //cut if it is a primary
+  printf("CREATE RECONSTRUCTION CUTS\n");
+  TObjArray* recList1 = new TObjArray(0) ;
+  recList1->AddLast(recKineCuts1);
+  recList1->AddLast(recQualityCuts1);
+  recList1->AddLast(recIsPrimaryCuts1);
   
-  TObjArray* recListPOI = new TObjArray(0) ;
-  if (UseKineforPOI)         recListPOI->AddLast(recKineCutsPOI); //cut on pt/eta/phi
-  if (UseTrackQualityforPOI) recListPOI->AddLast(recQualityCutsPOI);
-  if (UsePrimariesforPOI)    recListPOI->AddLast(recIsPrimaryCutsPOI); //cut if it is a primary
+  TObjArray* recList2 = new TObjArray(0) ;
+  recList2->AddLast(recKineCuts2);
+  recList2->AddLast(recQualityCuts2);
+  recList2->AddLast(recIsPrimaryCuts2);
   
-  printf("CREATE ESD PID CUTS\n");
-  TObjArray* fPIDCutListRP = new TObjArray(0) ;
-  if(UsePIDforRP) {fPIDCutListRP->AddLast(cutPidRP);} //cut on ESD PID
+  printf("CREATE PID CUTS\n");
+  TObjArray* fPIDCutList1 = new TObjArray(0) ;
+  if(UsePIDforRP) {fPIDCutList1->AddLast(cutPID1);}
   
-  TObjArray* fPIDCutListPOI = new TObjArray(0) ;
-  if (UsePIDforPOI)  {fPIDCutListPOI->AddLast(cutPidPOI);} //cut on ESD PID
+  TObjArray* fPIDCutList2 = new TObjArray(0) ;
+  if (UsePIDforPOI)  {fPIDCutList2->AddLast(cutPID2);}
   
-
-  //----------Add Cut Lists to the CF Manager----------
   printf("CREATE INTERFACE AND CUTS\n");
-  AliCFManager* cfmgrRP = new AliCFManager();
-  cfmgrRP->SetNStepEvent(3);
-  cfmgrRP->SetEventCutsList(AliCFManager::kEvtGenCuts,mcEventList); 
-  cfmgrRP->SetEventCutsList(AliCFManager::kEvtRecCuts,recEventList); 
-  cfmgrRP->SetNStepParticle(4); 
-  cfmgrRP->SetParticleCutsList(AliCFManager::kPartGenCuts,mcListRP);
-  cfmgrRP->SetParticleCutsList(AliCFManager::kPartAccCuts,accListRP);
-  cfmgrRP->SetParticleCutsList(AliCFManager::kPartRecCuts,recListRP);
-  cfmgrRP->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutListRP);
+  AliCFManager* cfmgr1 = new AliCFManager();
+  cfmgr1->SetNStepEvent(3);
+  cfmgr1->SetEventCutsList(AliCFManager::kEvtGenCuts,mcEventList); 
+  cfmgr1->SetEventCutsList(AliCFManager::kEvtRecCuts,recEventList); 
+  cfmgr1->SetNStepParticle(4); 
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList1);
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartAccCuts,accList1);
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartRecCuts,recList1);
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList1);
   
-  AliCFManager* cfmgrPOI = new AliCFManager();
-  cfmgrPOI->SetNStepEvent(3);
-  cfmgrPOI->SetEventCutsList(AliCFManager::kEvtGenCuts,mcEventList); 
-  cfmgrPOI->SetEventCutsList(AliCFManager::kEvtRecCuts,recEventList); 
-  cfmgrPOI->SetNStepParticle(4); 
-  cfmgrPOI->SetParticleCutsList(AliCFManager::kPartGenCuts,mcListPOI);
-  cfmgrPOI->SetParticleCutsList(AliCFManager::kPartAccCuts,accListPOI);
-  cfmgrPOI->SetParticleCutsList(AliCFManager::kPartRecCuts,recListPOI);
-  cfmgrPOI->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutListPOI);
+  AliCFManager* cfmgr2 = new AliCFManager();
+  cfmgr1->SetNStepEvent(3);
+  cfmgr1->SetEventCutsList(AliCFManager::kEvtGenCuts,mcEventList); 
+  cfmgr1->SetEventCutsList(AliCFManager::kEvtRecCuts,recEventList); 
+  cfmgr2->SetNStepParticle(4); 
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList2);
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartAccCuts,accList2);
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartRecCuts,recList2);
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList2);
   
   if (QA) {
     taskFE->SetQAList1(qaRP);
     taskFE->SetQAList2(qaPOI);
   }
-  taskFE->SetCFManager1(cfmgrRP);
-  taskFE->SetCFManager2(cfmgrPOI);
+  taskFE->SetCFManager1(cfmgr1);
+  taskFE->SetCFManager2(cfmgr2);
 
 
 
diff --git a/PWG2/FLOW/macros/runFlowTask.C b/PWG2/FLOW/macros/runFlowTask.C
index ec60c269a18..77993329f8f 100644
--- a/PWG2/FLOW/macros/runFlowTask.C
+++ b/PWG2/FLOW/macros/runFlowTask.C
@@ -5,9 +5,6 @@ enum anaModes {mLocal,mLocalPAR,mPROOF,mGRID};
 
 // RUN SETTINGS
 
-//Boolean to run on ESD from real data or ESD from MC data
-Bool_t DATA = kFALSE;
-
 // Flow analysis method can be:(set to kTRUE or kFALSE)
 Bool_t SP       = kTRUE;
 Bool_t LYZ1SUM  = kTRUE;
@@ -32,14 +29,15 @@ Bool_t QA = kTRUE;
 Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)
 
 
-void runFlowTask(Int_t mode=mLocal, Int_t nRuns = -1, 
-		 //const Char_t* dataDir="/data/alice2/kolk/PP/data/LHC09d/104892/test", Int_t offset = 0)
-                 const Char_t* dataDir="/data/alice2/kolk/PP/LHC09d10/104873", Int_t offset = 0)
-//void runFlowTask(Int_t mode=mPROOF, Int_t nRuns = 1000000, 
+//void runFlowTask(Int_t mode=mLocal, Int_t nRuns = 100, 
+		 //const Char_t* dataDir="/data/alice2/kolk/PP/LHC09a4/81119", Int_t offset = 0)
+		 //const Char_t* dataDir="/data/alice2/kolk/Therminator_midcentral", Int_t offset = 0)
+		 //const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0)
+void runFlowTask(Int_t mode=mPROOF, Int_t nRuns = 1000000, 
 		 //const Char_t* dataDir="/COMMON/COMMON/LHC09a14_0.9TeV_0.5T", Int_t offset = 0)
 		 //const Char_t* dataDir="/COMMON/COMMON/LHC08c11_10TeV_0.5T", Int_t offset = 0)
 		 //const Char_t* dataDir="/PWG2/akisiel/Therminator_midcentral_ESD", Int_t offset=0)
-                 //const Char_t* dataDir="/COMMON/COMMON/LHC09a4_run8101X", Int_t offset = 0)
+                 const Char_t* dataDir="/COMMON/COMMON/LHC09a4_run8101X", Int_t offset = 0)
 
 
 {
@@ -84,15 +82,10 @@ void runFlowTask(Int_t mode=mLocal, Int_t nRuns = -1,
   
   
   //____________________________________________//
-  // Load the analysis task
+  // Load the tasks
   gROOT->LoadMacro("AddTaskFlow.C");
   AliAnalysisTaskFlowEvent* taskFE = AddTaskFlow(type,METHODS,QA,WEIGHTS);
-
-  //task to check the offline trigger
-  gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskPhysicsSelection.C");
-  AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection();
-  if (!DATA) {physicsSelTask->GetPhysicsSelection()->SetAnalyzeMC();}
-
+    
   //____________________________________________//
   // Run the analysis
   if (!mgr->InitAnalysis()) return;
diff --git a/PWG2/PWG2femtoscopyLinkDef.h b/PWG2/PWG2femtoscopyLinkDef.h
index a3b65ba440c..2c1937100fe 100644
--- a/PWG2/PWG2femtoscopyLinkDef.h
+++ b/PWG2/PWG2femtoscopyLinkDef.h
@@ -55,7 +55,7 @@
 #pragma link C++ class AliFemtoEventReaderAOD+;
 #pragma link C++ class AliFemtoEventReaderAODChain+;
 #pragma link C++ class AliFemtoAODTrackCut+;
+
 #pragma link C++ class AliAnalysisTaskFemto+;
-#pragma link C++ class AliTwoTrackRes+;
 
 #endif
diff --git a/PWG2/SPECTRA/AliProtonAnalysisBase.h b/PWG2/SPECTRA/AliProtonAnalysisBase.h
index 4afd998d07b..839aed9338e 100644
--- a/PWG2/SPECTRA/AliProtonAnalysisBase.h
+++ b/PWG2/SPECTRA/AliProtonAnalysisBase.h
@@ -72,18 +72,18 @@ class AliProtonAnalysisBase : public TObject {
   Double_t GetMaxX() const {return fMaxX;}
   Double_t GetMaxY() const {return fMaxY;}
 
-  //Trigger
   Bool_t IsEventTriggered(const AliESDEvent *esd,
 			  TriggerMode trigger = kMB2);
+  //void OfflineTriggerInit(UInt_t runNumber) {
   void OfflineTriggerInit() {
     kUseOfflineTrigger = kTRUE;
     fPhysicsSelection = new AliPhysicsSelection();
-    fPhysicsSelection->AddBackgroundIdentification(new AliBackgroundSelection());
+    //fPhysicsSelection->AddBackgroundIdentification(new AliBackgroundSelection());
     fPhysicsSelection->SetAnalyzeMC(fAnalysisMC);
+    //fPhysicsSelection->Initialize(runNumber);
   }
   Bool_t IsOfflineTriggerUsed() {return kUseOfflineTrigger;}
   AliPhysicsSelection *GetPhysicsSelectionObject() {return fPhysicsSelection;}
-
   Bool_t IsAccepted(AliESDEvent *esd,
 		    const AliESDVertex *vertex, 
 		    AliESDtrack *track);
diff --git a/PWG2/libPWG2femtoscopy.pkg b/PWG2/libPWG2femtoscopy.pkg
index a8b211258d1..f2307c53187 100644
--- a/PWG2/libPWG2femtoscopy.pkg
+++ b/PWG2/libPWG2femtoscopy.pkg
@@ -50,8 +50,7 @@ SRCS= FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx \
       FEMTOSCOPY/AliFemto/AliFemtoAODTrackCut.cxx \
       FEMTOSCOPY/AliFemto/AliFemtoCutMonitor.cxx \
       FEMTOSCOPY/AliFemto/AliFemtoCorrFctn.cxx \
-      FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx \
-      FEMTOSCOPY/AliFemto/AliTwoTrackRes.cxx
+      FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx
 
 HDRS= $(SRCS:.cxx=.h) 
 HDRS += FEMTOSCOPY/AliFemto/AliFmThreeVector.h \
diff --git a/PWG3/vertexingHF/AliAnalysisVertexingHF.cxx b/PWG3/vertexingHF/AliAnalysisVertexingHF.cxx
index 8c131357891..d341fe9ebba 100644
--- a/PWG3/vertexingHF/AliAnalysisVertexingHF.cxx
+++ b/PWG3/vertexingHF/AliAnalysisVertexingHF.cxx
@@ -1251,7 +1251,7 @@ AliAODVertex* AliAnalysisVertexingHF::PrimaryVertex(const TObjArray *trkArray,
 	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.};
+	Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.};
 	AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
 	vertexer->SetVtxStart(diamond);
 	delete diamond; diamond=NULL;
diff --git a/PWG3/vertexingHF/RunAnalysisAODVertexingHF.C b/PWG3/vertexingHF/RunAnalysisAODVertexingHF.C
index 51b6f4170e3..d309bbedfd6 100644
--- a/PWG3/vertexingHF/RunAnalysisAODVertexingHF.C
+++ b/PWG3/vertexingHF/RunAnalysisAODVertexingHF.C
@@ -164,7 +164,7 @@ void RunAnalysisAODVertexingHF()
 
   // Input
   AliAODInputHandler *inputHandler = new AliAODInputHandler();
-  if(analysisMode=="proof" ) {
+  if(analysisMode=="proof") {
     inputHandler->AddFriend("AliAOD.VertexingHF.root");
     if(saveProofToAlien) mgr->SetSpecialOutputLocation(proofOutdir);
   }
@@ -271,7 +271,7 @@ AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test",Bool_t useParFiles
    // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
    plugin->SetRunMode(pluginmode.Data());
    plugin->SetUser("dainesea");
-   plugin->SetNtestFiles(1);
+   plugin->SetNtestFiles(2);
    // Set versions of used packages
    plugin->SetAPIVersion("V2.4");
    plugin->SetROOTVersion("v5-24-00");
@@ -281,11 +281,10 @@ AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test",Bool_t useParFiles
    // Define production directory LFN
    //plugin->SetGridDataDir("/alice/cern.ch/user/r/rbala/newtrain/out_lhc08x/");
    //plugin->SetGridDataDir("/alice/cern.ch/user/m/mgheata/analysisESD/output_train_default_28May2009_09h33/");
-   plugin->SetGridDataDir("/alice/sim/PDC_08b/LHC09a2/AOD1/");
+   plugin->SetGridDataDir("/alice/sim/PDC_09/LHC09a5/AOD1/");
    // Set data search pattern
    plugin->SetDataPattern("AliAOD.root");
-   plugin->SetFriendChainName("./AliAOD.VertexingHF.root");
-   //plugin->SetFriendChainName("deltas/AliAOD.VertexingHF.root");
+   plugin->SetFriendChainName("AliAOD.VertexingHF.root");
    // ...then add run numbers to be considered
    //plugin->AddRunNumber(529007);
    //  or
@@ -305,7 +304,7 @@ AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test",Bool_t useParFiles
    //plugin->SetAnalysisSource("AliDStarJets.cxx");
    // Declare all libraries (other than the default ones for the framework. These will be
    // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
-   plugin->SetAdditionalLibs("libPWG3vertexingHF.so libPWG3base.so libPWG3muon.so");
+   plugin->SetAdditionalLibs("libPWG3vertexingHF.so libPWG3base.so libPWG3muon.so libPWG4PartCorrBase.so libPWG4PartCorrDep.so MakeAODInputChain.C"/* AliDStarJets.cxx AliDStarJets.h"*/);
    // use par files
    if(useParFiles) {
      plugin->EnablePackage("STEERBase.par");
@@ -317,6 +316,8 @@ AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test",Bool_t useParFiles
      plugin->EnablePackage("PWG3base.par");
      plugin->EnablePackage("PWG3vertexingHF.par");
      plugin->EnablePackage("PWG3muon.par");
+     plugin->EnablePackage("PWG4PartCorrBase.par");
+     plugin->EnablePackage("PWG4PartCorrDep.par");
    }
    plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/PWG3 -I$ALICE_ROOT/PWG3/vertexingHF -g");
    // Declare the output file names separated by blancs.
diff --git a/PWG4/JetTasks/AliAnalysisTaskJFSystematics.cxx b/PWG4/JetTasks/AliAnalysisTaskJFSystematics.cxx
index 90fbd3ca504..4735b2fd953 100644
--- a/PWG4/JetTasks/AliAnalysisTaskJFSystematics.cxx
+++ b/PWG4/JetTasks/AliAnalysisTaskJFSystematics.cxx
@@ -225,7 +225,7 @@ void AliAnalysisTaskJFSystematics::UserCreateOutputObjects()
       binLimitsPt[iPt] = 0.0;
     }
     else {// 1.0
-      binLimitsPt[iPt] =  binLimitsPt[iPt-1] + 1.0;
+      binLimitsPt[iPt] =  binLimitsPt[iPt-1] + 2.5;
     }
   }
   
@@ -310,21 +310,19 @@ void AliAnalysisTaskJFSystematics::UserCreateOutputObjects()
   fHistList->Add(fh1NRecJets);
   fHistList->Add(fh1PtRecIn);
   fHistList->Add(fh1PtRecOut);
+  fHistList->Add(fh1PtGenIn);
+  fHistList->Add(fh1PtGenOut);
+  fHistList->Add(fh2PtFGen);
+  fHistList->Add(fh2PhiFGen);
+  fHistList->Add(fh2EtaFGen);
+  fHistList->Add(fh2PtGenDeltaEta);
+  fHistList->Add(fh2PtGenDeltaPhi);
+  fHistList->Add(fh3RecOutEtaPhiPt);
+  fHistList->Add(fh3GenOutEtaPhiPt);      
+  fHistList->Add(fh3RecInEtaPhiPt);
+  fHistList->Add(fh3GenInEtaPhiPt);
+  fHistList->Add(fhnCorrelation);
 
-  if(fBranchGen.Length()>0){
-    fHistList->Add(fh1PtGenIn);
-    fHistList->Add(fh1PtGenOut);
-    fHistList->Add(fh2PtFGen);
-    fHistList->Add(fh2PhiFGen);
-    fHistList->Add(fh2EtaFGen);
-    fHistList->Add(fh2PtGenDeltaEta);
-    fHistList->Add(fh2PtGenDeltaPhi);
-    fHistList->Add(fh3RecOutEtaPhiPt);
-    fHistList->Add(fh3GenOutEtaPhiPt);      
-    fHistList->Add(fh3RecInEtaPhiPt);
-    fHistList->Add(fh3GenInEtaPhiPt);
-    fHistList->Add(fhnCorrelation);
-  }
 
   if(fAnalysisType==kSysJetOrder){
     // 
@@ -333,15 +331,12 @@ void AliAnalysisTaskJFSystematics::UserCreateOutputObjects()
       fHistList->Add(hTmp);
       hTmp = (TH1F*)fh1PtRecOut->Clone(Form("%s_%s%d",fh1PtRecOut->GetName(),fgkSysName[kSysJetOrder],i));
       fHistList->Add(hTmp);
-
-      if(fBranchGen.Length()>0){
-	hTmp = (TH1F*)fh1PtGenIn->Clone(Form("%s_%s%d",fh1PtGenIn->GetName(),fgkSysName[kSysJetOrder],i));
-	fHistList->Add(hTmp);
-	hTmp = (TH1F*)fh1PtGenOut->Clone(Form("%s_%s%d",fh1PtGenOut->GetName(),fgkSysName[kSysJetOrder],i));
-	fHistList->Add(hTmp);
-	THnSparseF *hnTmp = (THnSparseF*)fhnCorrelation->Clone(Form("%s_%s%d",fhnCorrelation->GetName(),fgkSysName[kSysJetOrder],i));
-	fHistList->Add(hnTmp);
-      }
+      hTmp = (TH1F*)fh1PtGenIn->Clone(Form("%s_%s%d",fh1PtGenIn->GetName(),fgkSysName[kSysJetOrder],i));
+      fHistList->Add(hTmp);
+      hTmp = (TH1F*)fh1PtGenOut->Clone(Form("%s_%s%d",fh1PtGenOut->GetName(),fgkSysName[kSysJetOrder],i));
+      fHistList->Add(hTmp);
+      THnSparseF *hnTmp = (THnSparseF*)fhnCorrelation->Clone(Form("%s_%s%d",fhnCorrelation->GetName(),fgkSysName[kSysJetOrder],i));
+      fHistList->Add(hnTmp);
     }
   }
 
@@ -505,7 +500,8 @@ void AliAnalysisTaskJFSystematics::UserExec(Option_t */*option*/)
   // Fetch the reconstructed jets...
   //
 
-
+  nRecJets = aodRecJets->GetEntries();
+  fh1NRecJets->Fill(nRecJets);
   nRecJets = TMath::Min(nRecJets,kMaxJets);
 
   for(int ir = 0;ir < nRecJets;++ir){
diff --git a/PWG4/JetTasks/AliAnalysisTaskJetServices.cxx b/PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
index cacac97d026..83dc75ca8c4 100644
--- a/PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
+++ b/PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
@@ -67,10 +67,9 @@ ClassImp(AliAnalysisTaskJetServices)
 
 AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(): AliAnalysisTaskSE(),
   fUseAODInput(kFALSE),
-  fUsePhysicsSelection(kFALSE),
-  fRealData(kFALSE),
   fAvgTrials(1),
   fZVtxCut(8.),
+  fRealData(kFALSE),
   fh1Xsec(0x0),
   fh1Trials(0x0),
   fh1PtHard(0x0),
@@ -89,10 +88,9 @@ AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(): AliAnalysisTaskSE(),
 AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(const char* name):
   AliAnalysisTaskSE(name),
   fUseAODInput(kFALSE),
-  fUsePhysicsSelection(kFALSE),
-  fRealData(kFALSE),
   fAvgTrials(1),
   fZVtxCut(8.),
+  fRealData(kFALSE),
   fh1Xsec(0x0),
   fh1Trials(0x0),
   fh1PtHard(0x0),
@@ -345,9 +343,9 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
       Bool_t cand = fInputHandler->IsEventSelected();
       if(cand){
 	fh2ESDTriggerCount->Fill(it,kSelectedALICE); 
+	fh2ESDTriggerCount->Fill(it,kSelected);
+	AliAnalysisHelperJetTasks::Selected(kTRUE,kTRUE);// select this event
       }
-      if(!fUsePhysicsSelection)cand =  AliAnalysisHelperJetTasks::IsTriggerFired(esd,AliAnalysisHelperJetTasks::kMB1);
-
       if(vtxESD->GetNContributors()>0){
 	if(esdTrig)fh2ESDTriggerCount->Fill(it,kTriggeredSPDVertex);
 	Float_t zvtx = vtxESD->GetZ();
diff --git a/PWG4/JetTasks/AliAnalysisTaskJetServices.h b/PWG4/JetTasks/AliAnalysisTaskJetServices.h
index 889ad867a9a..3db6154a2fb 100644
--- a/PWG4/JetTasks/AliAnalysisTaskJetServices.h
+++ b/PWG4/JetTasks/AliAnalysisTaskJetServices.h
@@ -46,7 +46,7 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     virtual void SetAODInput(Bool_t b){fUseAODInput = b;}
     virtual void SetRunRange(Float_t fLo,Float_t fUp){fRunRange[0] = fLo;fRunRange[1] = fUp;}
     virtual void SetRealData(Bool_t b){fRealData = b;}
-    virtual void SetUsePhysicsSelection(Bool_t b){fUsePhysicsSelection = b;}
+
     enum { kAllTriggered = 0,kTriggeredSPDVertex,kTriggeredVertexIn,kSelectedALICE,kSelectedALICEVertexIn,kSelected,kConstraints};
 
  private:
@@ -55,11 +55,10 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     AliAnalysisTaskJetServices& operator=(const AliAnalysisTaskJetServices&);
 
     Bool_t        fUseAODInput;        // take jet from input AOD not from ouptu AOD
-    Bool_t        fUsePhysicsSelection;// decide wether we take into account physicsselction task
-    Bool_t        fRealData;           // true for real data to allow correct trigger slection
     Float_t       fAvgTrials;          // Average number of trials
     Float_t       fZVtxCut;            // Average number of trials
     Float_t       fRunRange[2];        // only important for real data for 
+    Bool_t        fRealData;           // true for real data to allow correct trigger slection
     TProfile*     fh1Xsec;             // pythia cross section and trials
     TH1F*         fh1Trials;           // trials are added
     TH1F*         fh1PtHard;           // Pt har of the event...       
diff --git a/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx
index 6bd4c09d10d..a5f53f48230 100644
--- a/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx
+++ b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx
@@ -90,13 +90,6 @@ AliAnalysisTaskJetSpectrum2::AliAnalysisTaskJetSpectrum2(): AliAnalysisTaskSE(),
   fh1PtTrackRec(0x0),   
   fh1SumPtTrackRec(0x0),  
   fh1SumPtTrackAreaRec(0x0),  
-  fh1PtJetsRecIn(0x0),
-  fh1PtTracksRecIn(0x0),
-  fh1PtTracksGenIn(0x0),
-  fh2NRecJetsPt(0x0),
-  fh2NRecTracksPt(0x0),
-  fh2JetsLeadingPhiEta(0x0),
-  fh2TracksLeadingPhiEta(0x0),
   fHistList(0x0)  
 {
   for(int i = 0;i < kMaxStep*2;++i){
@@ -138,13 +131,6 @@ AliAnalysisTaskJetSpectrum2::AliAnalysisTaskJetSpectrum2(const char* name):
   fh1PtTrackRec(0x0),   
   fh1SumPtTrackRec(0x0),  
   fh1SumPtTrackAreaRec(0x0),  
-  fh1PtJetsRecIn(0x0),
-  fh1PtTracksRecIn(0x0),
-  fh1PtTracksGenIn(0x0),
-  fh2NRecJetsPt(0x0),
-  fh2NRecTracksPt(0x0),
-  fh2JetsLeadingPhiEta(0x0),
-  fh2TracksLeadingPhiEta(0x0),
   fHistList(0x0)
 {
 
@@ -231,7 +217,7 @@ void AliAnalysisTaskJetSpectrum2::UserCreateOutputObjects()
   Double_t binLimitsPhi[nBinPhi+1];
   for(Int_t iPhi = 0;iPhi<=nBinPhi;iPhi++){
     if(iPhi==0){
-      binLimitsPhi[iPhi] = -1.*TMath::Pi();
+      binLimitsPhi[iPhi] = -0.5*TMath::Pi();
     }
     else{
       binLimitsPhi[iPhi] = binLimitsPhi[iPhi-1] + 1/(Float_t)nBinPhi * TMath::Pi()*2;
@@ -270,20 +256,8 @@ void AliAnalysisTaskJetSpectrum2::UserCreateOutputObjects()
   fh1PtTrackRec = new TH1F("fh1PtTrackRec","Rec track P_T #eta < 0.9;p_{T} (GeV/c)",nBinPt,binLimitsPt);
   fh1SumPtTrackRec = new TH1F("fh1SumPtTrackRec","Sum Rec track P_T #eta <0.9;p_{T,sum} (GeV/c)",nBinPt,binLimitsPt);
   fh1SumPtTrackAreaRec = new TH1F("fh1SumPtTrackAreaRec","Sum Rec track P_T #eta <0.9 / 1.8 * 2 * 0.4*0.4;p_{T,sum} (GeV/c)",nBinPt,binLimitsPt);
-  
-  fh1PtJetsRecIn  = new TH1F("fh1PtJetsRecIn","Rec jets P_T;p_{T} (GeV/c)",nBinPt,binLimitsPt);
-  fh1PtTracksRecIn  = new TH1F("fh1PtTracksRecIn","Rec tracks P_T #eta < 0.9;p_{T} (GeV/c)",nBinPt,binLimitsPt);
-  fh1PtTracksGenIn  = new TH1F("fh1PtTracksRecIn","gen tracks P_T #eta < 0.9;p_{T} (GeV/c)",nBinPt,binLimitsPt);
 
-  fh2NRecJetsPt = new TH2F("fh2NRecJetsPt","Number of jets above threshhold;p_{T,cut} (GeV/c);N_{jets}",nBinPt,binLimitsPt,50,-0.5,49.5);
-  fh2NRecTracksPt = new TH2F("fh2NRecTracksPt","Number of tracks above threshhold;p_{T,cut} (GeV/c);N_{tracks}",nBinPt,binLimitsPt,50,-0.5,49.5);
   // 
-
-  fh2JetsLeadingPhiEta = new TH2F("fh2JetsLeadingPhiEta","delta eta vs delta phi to leading;#Delta#phi;#Delta#eta",
-				nBinPhi,binLimitsPhi,nBinEta,binLimitsEta);
-  fh2TracksLeadingPhiEta = new TH2F("fh2TracksLeadingPhiEta","delta eta vs delta phi to leading;#Delta#phi;#Delta#eta",
-				nBinPhi,binLimitsPhi,nBinEta,binLimitsEta);
-
   for(int ij = 0;ij < kMaxJets;++ij){
     fh1PtRecIn[ij] = new TH1F(Form("fh1PtRecIn_j%d",ij),"rec p_T input ;p_{T,rec}",nBinPt,binLimitsPt);
     fh1PtGenIn[ij] = new TH1F(Form("fh1PtGenIn_j%d",ij),"found p_T input ;p_{T,gen}",nBinPt,binLimitsPt);
@@ -291,7 +265,7 @@ void AliAnalysisTaskJetSpectrum2::UserCreateOutputObjects()
     fh2PhiPt[ij] =  new TH2F(Form("fh2PhiPtRec_j%d",ij),"Jet pt vs delta phi;#Delta#phi;p_{T,jet}",
 			     nBinPhi,binLimitsPhi,nBinPt,binLimitsPt);
 
-    fh2PhiEta[ij] =  new TH2F(Form("fh2PhiEtaRec_j%d",ij),"delta eta vs delta phi for jets;#Delta#phi;#Delta#eta",
+    fh2PhiEta[ij] =  new TH2F(Form("fh2PhiEtaRec_j%d",ij),"delta eta vs delta phi for jets;#Delta#phi;p_{T,jet}",
 			      nBinPhi,binLimitsPhi,nBinEta,binLimitsEta);
 
 
@@ -314,32 +288,21 @@ void AliAnalysisTaskJetSpectrum2::UserCreateOutputObjects()
     fHistList->Add(fh1PtHard);
     fHistList->Add(fh1PtHardNoW);
     fHistList->Add(fh1PtHardTrials);
-    if(fBranchGen.Length()>0){
-      fHistList->Add(fh1NGenJets);
-      fHistList->Add(fh1PtTracksGenIn);
-    }
-    fHistList->Add(fh1PtJetsRecIn);
-    fHistList->Add(fh1PtTracksRecIn);
+    fHistList->Add(fh1NGenJets);
     fHistList->Add(fh1NRecJets);
     fHistList->Add(fh1PtTrackRec);
     fHistList->Add(fh1SumPtTrackRec);
     fHistList->Add(fh1SumPtTrackAreaRec);
-    fHistList->Add(fh2NRecJetsPt);
-    fHistList->Add(fh2NRecTracksPt);
-    fHistList->Add(fh2JetsLeadingPhiEta );
-    fHistList->Add(fh2TracksLeadingPhiEta);
     for(int i = 0;iAdd(fhnJetContainer[i]);
     for(int ij = 0;ijAdd( fh1PtRecIn[ij]);
-      if(fBranchGen.Length()>0){
-	fHistList->Add( fh1PtGenIn[ij]);
-	fHistList->Add( fh2FragGen[ij]);
-	fHistList->Add( fh2FragLnGen[ij]);
-      }
+      fHistList->Add( fh1PtGenIn[ij]);
       fHistList->Add( fh2PhiPt[ij]);
       fHistList->Add( fh2PhiEta[ij]);
       fHistList->Add( fh2FragRec[ij]);
       fHistList->Add( fh2FragLnRec[ij]);
+      fHistList->Add( fh2FragGen[ij]);
+      fHistList->Add( fh2FragLnGen[ij]);
     }
     fHistList->Add(fhnCorrelation);
   }
@@ -502,7 +465,6 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
   GetListOfTracks(&recParticles,fTrackTypeRec);
   GetListOfTracks(&genParticles,fTrackTypeGen);
 
-
   if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__);
   fh1PtHard->Fill(ptHard,eventW);
   fh1PtHardNoW->Fill(ptHard,1);
@@ -527,8 +489,8 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
       nGenJets = iCount;
     }
     else{
-      if(fDebug>0)Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGen.Data());
-      if(fDebug>1)fAOD->Print();
+      Printf("%s:%d Generated jet branch %s not found",(char*)__FILE__,__LINE__,fBranchGen.Data());
+      fAOD->Print();
     }
   }
 
@@ -540,118 +502,9 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
 
   nRecJets = aodRecJets->GetEntries();
 
-  nRecJets = aodRecJets->GetEntries();
-  fh1NRecJets->Fill(nRecJets);
-
-  // Do something with the all rec jets
-  Int_t nRecOver = nRecJets;
-
-  // check that the jets are sorted
-  Float_t ptOld = 999999;
-  for(int ir = 0;ir < nRecJets;ir++){
-    AliAODJet *tmp = (AliAODJet*)(aodRecJets->At(ir));
-    Float_t tmpPt = tmp->Pt();
-    if(tmpPt>ptOld){
-      Printf("%s:%d Jets Not Sorted!! %d:%.3E %d%.3E",(char*)__FILE__,__LINE__,ir,tmpPt,ir-1,ptOld);
-    }
-    ptOld = tmpPt;
-  }
+  
 
 
-  if(nRecOver>0){
-    TIterator *recIter = aodRecJets->MakeIterator();
-    AliAODJet *tmpRec = (AliAODJet*)(recIter->Next());  
-    Float_t pt = tmpRec->Pt();
-    if(tmpRec){
-      for(int i = 1;i <= fh2NRecJetsPt->GetNbinsX();i++){
-	Float_t ptCut = fh2NRecJetsPt->GetXaxis()->GetBinCenter(i);
-	while(ptNext()); 
-	  if(tmpRec){
-	    pt = tmpRec->Pt();
-	  }
-	}
-	if(nRecOver<=0)break;
-	fh2NRecJetsPt->Fill(ptCut,nRecOver);
-      }
-    }
-    recIter->Reset();
-    AliAODJet *leading = (AliAODJet*)aodRecJets->At(0);
-    Float_t phi = leading->Phi();
-    if(phi<0)phi+=TMath::Pi()*2.;    
-    Float_t eta = leading->Eta();
-    while((tmpRec = (AliAODJet*)(recIter->Next()))){
-      Float_t tmpPt = tmpRec->Pt();
-      fh1PtJetsRecIn->Fill(tmpPt);
-      if(tmpRec==leading)continue;
-      // correlation
-      Float_t tmpPhi =  tmpRec->Phi();
-
-      if(tmpPhi<0)tmpPhi+=TMath::Pi()*2.;    
-      Float_t dPhi = phi - tmpRec->Phi();
-      if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
-      if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();      
-      Float_t dEta = eta - tmpRec->Eta();
-      fh2JetsLeadingPhiEta->Fill(dPhi,dEta);
-    }  
-    delete recIter;
-  }
-
-  Int_t nTrackOver = recParticles.GetSize();
-  // do the same for tracks and jets
-  if(nTrackOver>0){
-    TIterator *recIter = recParticles.MakeIterator();
-    AliVParticle *tmpRec = (AliVParticle*)(recIter->Next());  
-    Float_t pt = tmpRec->Pt();
-    //    Printf("Leading track p_t %3.3E",pt);
-    for(int i = 1;i <= fh2NRecTracksPt->GetNbinsX();i++){
-      Float_t ptCut = fh2NRecTracksPt->GetXaxis()->GetBinCenter(i);
-      while(ptNext()); 
-	if(tmpRec){
-	  pt = tmpRec->Pt();
-	}
-      }
-      if(nTrackOver<=0)break;
-      fh2NRecTracksPt->Fill(ptCut,nTrackOver);
-    }
-    
-    recIter->Reset();
-    AliVParticle *leading = (AliVParticle*)recParticles.At(0);
-    Float_t phi = leading->Phi();
-    if(phi<0)phi+=TMath::Pi()*2.;    
-    Float_t eta = leading->Eta();
-    while((tmpRec = (AliVParticle*)(recIter->Next()))){
-      Float_t tmpPt = tmpRec->Pt();
-      fh1PtTracksRecIn->Fill(tmpPt);
-      if(tmpRec==leading)continue;
-      // correlation
-      Float_t tmpPhi =  tmpRec->Phi();
-
-      if(tmpPhi<0)tmpPhi+=TMath::Pi()*2.;    
-      Float_t dPhi = phi - tmpRec->Phi();
-      if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
-      if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();      
-      Float_t dEta = eta - tmpRec->Eta();
-      fh2TracksLeadingPhiEta->Fill(dPhi,dEta);
-    }  
-    delete recIter;
-  }
-  
-  if(genParticles.GetSize()){
-    TIterator *genIter = genParticles.MakeIterator();
-    AliVParticle *tmpGen = 0;
-    while((tmpGen = (AliVParticle*)(genIter->Next()))){
-      if(TMath::Abs(tmpGen->Eta())<0.9){
-	Float_t tmpPt = tmpGen->Pt();
-	fh1PtTracksGenIn->Fill(tmpPt);
-      }  
-    }
-    delete genIter;
-  }
-  
   fh1NRecJets->Fill(nRecJets);
   nRecJets = TMath::Min(nRecJets,kMaxJets);
 
@@ -667,11 +520,11 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
   Int_t iGenIndex[kMaxJets];    // Index of the generated jet for i-th rec -1 if none
   Int_t iRecIndex[kMaxJets];    // Index of the rec jet for i-th gen -1 if none
   
-
-  for(int i = 0;i 10)Printf("%s:%d",(char*)__FILE__,__LINE__);
@@ -791,7 +644,7 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
 	  if(phi<0)phi+=TMath::Pi()*2.;    
 	  Float_t dPhi = phi - phiRec;
 	  Float_t dEta = eta - etaRec;
-	  if(dPhi<(-1.*TMath::Pi()))phiRec+=TMath::Pi()*2.;    
+	  if(dPhi<(-1.*TMath::Pi()/2))phiRec+=TMath::Pi()*2.;    
 	  fh2PhiPt[ir]->Fill(dPhi,ptRec,eventW);
 	  fh2PhiEta[ir]->Fill(dPhi,dEta,eventW);
 	}
@@ -928,7 +781,6 @@ Int_t  AliAnalysisTaskJetSpectrum2::GetListOfTracks(TList *list,Int_t type){
     for(int it = 0;it < aod->GetNumberOfTracks();++it){
       AliAODTrack *tr = aod->GetTrack(it);
       if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
-      if(TMath::Abs(tr->Eta())>0.9)continue;
       list->Add(tr);
       iCount++;
     }
@@ -971,7 +823,6 @@ Int_t  AliAnalysisTaskJetSpectrum2::GetListOfTracks(TList *list,Int_t type){
       }
     }
   }// AODMCparticle
-  list->Sort();
   return iCount;
 
 }
diff --git a/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.h b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.h
index 1501fa5cedb..b77ddc78fd2 100644
--- a/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.h
+++ b/PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.h
@@ -123,16 +123,6 @@ class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE
     TH1F*         fh1PtRecIn[kMaxJets];  // Jet pt for all this info is also in the THNsparse      
     TH1F*         fh1PtGenIn[kMaxJets];  // Jet pt with corellated generated jet    
 
-    TH1F*         fh1PtJetsRecIn;  // Jet pt for all jets
-    TH1F*         fh1PtTracksRecIn;  // track pt for all tracks
-    TH1F*         fh1PtTracksGenIn;  // track pt for all tracks
-
-
-    TH2F*         fh2NRecJetsPt;            // Number of found jets above threshold
-    TH2F*         fh2NRecTracksPt;          // Number of found tracks above threshold
-    TH2F*         fh2JetsLeadingPhiEta;     // jet corrlation with leading jet
-    TH2F*         fh2TracksLeadingPhiEta;   // jet corrlation with leading jet
-
     TH2F*         fh2PhiPt[kMaxJets];    // delta phi correlation of tracks with the jet      
     TH2F*         fh2PhiEta[kMaxJets];   // eta   phi correlation of tracks with the jet      
 
diff --git a/PWG4/JetTasks/AliAnalysisTaskUE.cxx b/PWG4/JetTasks/AliAnalysisTaskUE.cxx
index fafecc1ac1c..eadd451c62d 100644
--- a/PWG4/JetTasks/AliAnalysisTaskUE.cxx
+++ b/PWG4/JetTasks/AliAnalysisTaskUE.cxx
@@ -91,8 +91,7 @@ fAODjets(0x0),
 fListOfHistos(0x0),  
 fBinsPtInHist(30),     
 fMinJetPtInHist(0.),
-fMaxJetPtInHist(300.), 
-fIsNorm2Area(kTRUE),
+fMaxJetPtInHist(300.),  
 fUseMCParticleBranch(kFALSE),
 fConstrainDistance(kTRUE),
 fMinDistance(0.2),
@@ -139,18 +138,6 @@ fhRegionDiffSumPtVsEt(0x0),
 fhRegionAvePartPtMaxVsEt(0x0),
 fhRegionAvePartPtMinVsEt(0x0),
 fhRegionMaxPartPtMaxVsEt(0x0),
-fhRegForwardSumPtVsEt(0x0),
-fhRegForwardMultVsEt(0x0),
-fhRegBackwardSumPtVsEt(0x0),
-fhRegBackwardMultVsEt(0x0),
-fhRegForwardMult(0x0),
-fhRegForwardSumPtvsMult(0x0),
-fhRegBackwardMult(0x0),
-fhRegBackwardSumPtvsMult(0x0),
-fhRegForwardPartPtDistVsEt(0x0),
-fhRegBackwardPartPtDistVsEt(0x0),
-fhRegTransMult(0x0),
-fhRegTransSumPtVsMult(0x0),
 fh1Xsec(0x0),
 fh1Trials(0x0),
 fSettingsTree(0x0)//,   fhValidRegion(0x0)
@@ -475,31 +462,20 @@ fhNJets->Fill(nJets);
   }
   
   //fhEleadingPt->Fill( maxPtJet1 );
-
+  //Area for Normalization Purpose at Display histos
+  SetRegionArea(jetVect);
+  
   // ----------------------------------------------
   // Find max and min regions
   Double_t sumPtRegionPosit = 0.;
   Double_t sumPtRegionNegat = 0.;
-  Double_t sumPtRegionForward = 0;
-  Double_t sumPtRegionBackward = 0;
   Double_t maxPartPtRegion  = 0.;
   Int_t    nTrackRegionPosit = 0;
   Int_t    nTrackRegionNegat = 0;
-  Int_t    nTrackRegionForward = 0;
-  Int_t    nTrackRegionBackward = 0;
   static Double_t const  kPI     = TMath::Pi();
   static Double_t const  kTWOPI  = 2.*kPI;
   static Double_t const  k270rad = 270.*kPI/180.;
-  static Double_t const  k120rad = 120.*kPI/180.;
-  
-  //Area for Normalization Purpose at Display histos
-  // Forward and backward
-  Double_t normArea = 1.;
-  // Transverse
-  if (fIsNorm2Area) {
-    SetRegionArea(jetVect);
-    normArea =  2.*fTrackEtaCut*k120rad ;
-  } else fAreaReg = 1.;
+
   
   if (!fUseMCParticleBranch){
     fhEleadingPt->Fill( maxPtJet1 );
@@ -535,28 +511,18 @@ fhNJets->Fill(nJets);
       
       Int_t region = IsTrackInsideRegion( jetVect, &partVect );  
       
-      if (region == 1) {
+      if (region > 0) {
         if( maxPartPtRegion < part->Pt() ) maxPartPtRegion = part->Pt();
         sumPtRegionPosit += part->Pt();
         nTrackRegionPosit++;
         fhTransRegPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 );
       }
-      if (region == -1) {
+      if (region < 0) {
         if( maxPartPtRegion < part->Pt() ) maxPartPtRegion = part->Pt();
         sumPtRegionNegat += part->Pt();
         nTrackRegionNegat++;
         fhTransRegPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 );
       }
-      if (region == 2){ //forward
-        sumPtRegionForward += part->Pt();
-        nTrackRegionForward++;
-        fhRegForwardPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 );
-      }
-      if (region == -2){ //backward
-        sumPtRegionBackward += part->Pt();
-        nTrackRegionBackward++;
-        fhRegBackwardPartPtDistVsEt->Fill( part->Pt(), maxPtJet1 );
-      }
     }//end loop AOD tracks
   }
   else {
@@ -680,29 +646,18 @@ fhNJets->Fill(nJets);
         
         Int_t region = IsTrackInsideRegion( jetVectnew, &partVect );  
         
-        if (region == 1) {
+        if (region > 0) {
           if( maxPartPtRegion < mctrk->Pt() ) maxPartPtRegion = mctrk->Pt();
           sumPtRegionPosit += mctrk->Pt();
           nTrackRegionPosit++;
           fhTransRegPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
         }
-        if (region == -1) {
+        if (region < 0) {
           if( maxPartPtRegion < mctrk->Pt() ) maxPartPtRegion = mctrk->Pt();
           sumPtRegionNegat += mctrk->Pt();
           nTrackRegionNegat++;
           fhTransRegPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
         }
-        if (region == 2){ //forward
-          sumPtRegionForward += mctrk->Pt();
-          nTrackRegionForward++;
-          fhRegForwardPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
-        }
-        if (region == -2){ //backward
-          sumPtRegionBackward += mctrk->Pt();
-          nTrackRegionBackward++;
-          fhRegBackwardPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
-        }
-        
       }  // end loop stack Particles
       
     }else{//Try mc Particle
@@ -743,28 +698,18 @@ fhNJets->Fill(nJets);
         
         Int_t region = IsTrackInsideRegion( jetVectnew, &partVect );  
         
-        if (region == 1) { //right
+        if (region > 0) {
           if( maxPartPtRegion < mctrk->Pt() ) maxPartPtRegion = mctrk->Pt();
           sumPtRegionPosit += mctrk->Pt();
           nTrackRegionPosit++;
           fhTransRegPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
         }
-        if (region == -1) { //left
+        if (region < 0) {
           if( maxPartPtRegion < mctrk->Pt() ) maxPartPtRegion = mctrk->Pt();
           sumPtRegionNegat += mctrk->Pt();
           nTrackRegionNegat++;
           fhTransRegPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
         }
-        if (region == 2){ //forward
-          sumPtRegionForward += mctrk->Pt();
-          nTrackRegionForward++;
-          fhRegForwardPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
-        }
-        if (region == -2){ //backward
-          sumPtRegionBackward += mctrk->Pt();
-          nTrackRegionBackward++;
-          fhRegBackwardPartPtDistVsEt->Fill( mctrk->Pt(), maxPtJet1 );
-        }
         
       }//end loop AliAODMCParticle tracks
     }
@@ -806,21 +751,6 @@ fhNJets->Fill(nJets);
   // Compute pedestal like magnitudes
   fhRegionDiffSumPtVsEt->Fill(maxPtJet1, TMath::Abs(sumPtRegionPosit-sumPtRegionNegat)/(2.0*fAreaReg));
   fhRegionAveSumPtVsEt->Fill(maxPtJet1, (sumPtRegionPosit+sumPtRegionNegat)/(2.0*fAreaReg));
-  // Transverse as a whole
-  fhRegTransMult->Fill( maxPtJet1, nTrackRegionPosit + nTrackRegionNegat );
-  fhRegTransSumPtVsMult->Fill(maxPtJet1, nTrackRegionPosit + nTrackRegionNegat , sumPtRegionNegat + sumPtRegionPosit );
-  
-  // Fill Histograms for Forward and away side w.r.t. leading jet direction
-  // Pt dependence
-  fhRegForwardSumPtVsEt->Fill( maxPtJet1, sumPtRegionForward/normArea );
-  fhRegForwardMultVsEt->Fill( maxPtJet1, nTrackRegionForward/normArea );
-  fhRegBackwardSumPtVsEt->Fill( maxPtJet1, sumPtRegionBackward/normArea );
-  fhRegBackwardMultVsEt->Fill( maxPtJet1, nTrackRegionBackward/normArea );
-  // Multiplicity dependence
-  fhRegForwardMult->Fill(maxPtJet1, nTrackRegionForward );
-  fhRegForwardSumPtvsMult->Fill(maxPtJet1, nTrackRegionForward,sumPtRegionForward);
-  fhRegBackwardMult->Fill(maxPtJet1, nTrackRegionBackward );
-  fhRegBackwardSumPtvsMult->Fill(maxPtJet1, nTrackRegionBackward,sumPtRegionBackward);
   
 }
 
@@ -879,10 +809,8 @@ Int_t AliAnalysisTaskUE::IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVe
   if( fRegionType == 1 ) {
     if( TMath::Abs(partVect->Eta()) > fTrackEtaCut ) return 0;
     // transverse regions
-    if (jetVect[0].DeltaPhi(*partVect) < -k60rad && jetVect[0].DeltaPhi(*partVect) > -k120rad ) region = -1; //left
-    if (jetVect[0].DeltaPhi(*partVect) > k60rad && jetVect[0].DeltaPhi(*partVect) < k120rad ) region = 1;    //right
-    if (TMath::Abs(jetVect[0].DeltaPhi(*partVect)) < k60rad ) region = 2;    //forward
-    if (TMath::Abs(jetVect[0].DeltaPhi(*partVect)) > k120rad ) region = -2; //backward
+    if (jetVect[0].DeltaPhi(*partVect) < -k60rad && jetVect[0].DeltaPhi(*partVect) > -k120rad ) region = -1;
+    if (jetVect[0].DeltaPhi(*partVect) > k60rad && jetVect[0].DeltaPhi(*partVect) < k120rad ) region = 1;
     
   } else if( fRegionType == 2 ) {
     // Cone regions
@@ -919,7 +847,7 @@ Int_t AliAnalysisTaskUE::IsTrackInsideRegion(TVector3 *jetVect, TVector3 *partVe
     AliError("Unknow region type");
   
   // For debug (to be removed)
-  if( fDebug > 5 && region != 0 ) AliInfo(Form("Delta Phi = %3.2f region = %d \n", jetVect[0].DeltaPhi(*partVect), region)); //fhValidRegion->Fill( partVect->Eta()-jetVect[0].Eta(), jetVect[0].DeltaPhi(*partVect) );
+  //if( region != 0 )  fhValidRegion->Fill( partVect->Eta()-jetVect[0].Eta(), jetVect[0].DeltaPhi(*partVect) );
   
   return region;
 }
@@ -1217,88 +1145,15 @@ void  AliAnalysisTaskUE::CreateHistos()
   fhRegionMaxPartPtMaxVsEt->Sumw2();
   fListOfHistos->Add( fhRegionMaxPartPtMaxVsEt );    // At(20)
   
-  fhRegForwardSumPtVsEt = new TH1F("hRegForwardSumPtVsEt", "Forward #sum{p_{T}} vs Leading Jet P_{T}",  fBinsPtInHist, fMinJetPtInHist,   fMaxJetPtInHist);
-  fhRegForwardSumPtVsEt->SetXTitle("P_{T} (GeV/c)");
-  fhRegForwardSumPtVsEt->Sumw2();
-  fListOfHistos->Add( fhRegForwardSumPtVsEt );    // At(21)
-  
-  fhRegForwardMultVsEt = new TH1F("hRegForwardMultVsEt", "Forward #sum{N_{ch}} vs Leading Jet P_{T}",  fBinsPtInHist, fMinJetPtInHist,   fMaxJetPtInHist);
-  fhRegForwardMultVsEt->SetXTitle("P_{T} (GeV/c)");
-  fhRegForwardMultVsEt->Sumw2();
-  fListOfHistos->Add( fhRegForwardMultVsEt );    // At(22)
-  
-  fhRegBackwardSumPtVsEt = new TH1F("hRegBackwardSumPtVsEt", "Backward #sum{p_{T}} vs Leading Jet P_{T}",  fBinsPtInHist, fMinJetPtInHist,   fMaxJetPtInHist);
-  fhRegBackwardSumPtVsEt->SetXTitle("P_{T} (GeV/c)");
-  fhRegBackwardSumPtVsEt->Sumw2();
-  fListOfHistos->Add( fhRegBackwardSumPtVsEt );    // At(23)
-  
-  fhRegBackwardMultVsEt = new TH1F("hRegBackwardMultVsEt", "Backward #sum{N_{ch}} vs Leading Jet P_{T}",  fBinsPtInHist, fMinJetPtInHist,   fMaxJetPtInHist);
-  fhRegBackwardMultVsEt->SetXTitle("P_{T} (GeV/c)");
-  fhRegBackwardMultVsEt->Sumw2();
-  fListOfHistos->Add( fhRegBackwardMultVsEt );    // At(24)
-  
-  fhRegForwardMult = new TH2F("hRegForwardMult",      "N_{ch}^{forward}",  
-                              fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, 21, -0.5,   20.5);
-  fhRegForwardMult->SetXTitle("N_{ch tracks}");
-  fhRegForwardMult->Sumw2();
-  fListOfHistos->Add( fhRegForwardMult );           // At(25)
-  
-  fhRegForwardSumPtvsMult = new TH2F("hRegForwardSumPtvsMult", "Forward #Sigma p_{T} vs. Multiplicity ",  
-                                     fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, 21, -0.5,   20.5);
-  fhRegForwardSumPtvsMult->SetYTitle("#Sigma p_{T} (GeV/c)");  
-  fhRegForwardSumPtvsMult->SetXTitle("N_{charge}");
-  fhRegForwardSumPtvsMult->Sumw2();
-  fListOfHistos->Add( fhRegForwardSumPtvsMult );     // At(26);
-  
-  fhRegBackwardMult = new TH2F("hRegBackwardMult",      "N_{ch}^{backward}",  
-                               fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, 21, -0.5,   20.5);
-  fhRegBackwardMult->SetXTitle("N_{ch tracks}");
-  fhRegBackwardMult->Sumw2();
-  fListOfHistos->Add( fhRegBackwardMult );           // At(27)
-  
-  fhRegBackwardSumPtvsMult = new TH2F("hRegBackwardSumPtvsMult", "Backward #Sigma p_{T} vs. Multiplicity ",  
-                                      fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, 21, -0.5,   20.5);
-  fhRegBackwardSumPtvsMult->SetYTitle("#Sigma p_{T} (GeV/c)");  
-  fhRegBackwardSumPtvsMult->SetXTitle("N_{charge}");
-  fhRegBackwardSumPtvsMult->Sumw2();
-  fListOfHistos->Add( fhRegBackwardSumPtvsMult );     // At(28);
-  
-  fhRegForwardPartPtDistVsEt = new TH2F("hRegForwardPartPtDistVsEt", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading Jet P_{T}", fTrackEtaCut),
-                                       100,0.,50., fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist);
-  fhRegForwardPartPtDistVsEt->SetYTitle("Leading Jet P_{T}");
-  fhRegForwardPartPtDistVsEt->SetXTitle("p_{T}");
-  fhRegForwardPartPtDistVsEt->Sumw2();
-  fListOfHistos->Add( fhRegForwardPartPtDistVsEt );  // At(29) 
-  
-  fhRegBackwardPartPtDistVsEt = new TH2F("hRegBackwardPartPtDistVsEt", Form( "dN/dP_{T} |#eta|<%3.1f vs Leading Jet P_{T}", fTrackEtaCut),
-                                         100,0.,50., fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist);
-  fhRegBackwardPartPtDistVsEt->SetYTitle("Leading Jet P_{T}");
-  fhRegBackwardPartPtDistVsEt->SetXTitle("p_{T}");
-  fhRegBackwardPartPtDistVsEt->Sumw2();
-  fListOfHistos->Add( fhRegBackwardPartPtDistVsEt );  // At(30) 
-  
-  fhRegTransMult  = new TH2F("hRegTransMult",      "N_{ch}^{transv}",  
-                             fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, 21, -0.5,   20.5);
-  fhRegTransMult->SetXTitle("N_{ch tracks}");
-  fhRegTransMult->Sumw2();
-  fListOfHistos->Add( fhRegTransMult );           // At(31)
-  
-  fhRegTransSumPtVsMult = new TH2F("hRegTransSumPtVsMult", "Transverse #Sigma p_{T} vs. Multiplicity ",  
-                                   fBinsPtInHist, fMinJetPtInHist, fMaxJetPtInHist, 21, -0.5,   20.5);
-  fhRegTransSumPtVsMult->SetYTitle("#Sigma p_{T} (GeV/c)");  
-  fhRegTransSumPtVsMult->SetXTitle("N_{charge}");
-  fhRegTransSumPtVsMult->Sumw2();
-  fListOfHistos->Add( fhRegTransSumPtVsMult );     // At(32);
-  
   fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1); 
   fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
   fh1Xsec->Sumw2();
-  fListOfHistos->Add( fh1Xsec );            //At(33)
+  fListOfHistos->Add( fh1Xsec );            //At(21)
   
   fh1Trials = new TH1F("fh1Trials","trials from pyxsec.root",1,0,1);
   fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
   fh1Trials->Sumw2();
-  fListOfHistos->Add( fh1Trials ); //At(34)
+  fListOfHistos->Add( fh1Trials ); //At(22)
   
   fSettingsTree   = new TTree("UEAnalysisSettings","Analysis Settings in UE estimation");
   fSettingsTree->Branch("fFilterBit", &fFilterBit,"FilterBit/I");
@@ -1320,7 +1175,7 @@ void  AliAnalysisTaskUE::CreateHistos()
   fSettingsTree->Fill();
 
   
-  fListOfHistos->Add( fSettingsTree );    // At(35)
+  fListOfHistos->Add( fSettingsTree );    // At(23)
   
   /*   
    // For debug region selection
@@ -1364,8 +1219,6 @@ void  AliAnalysisTaskUE::Terminate(Option_t */*option*/)
     fhRegionMultMaxVsEt  = (TH1F*)fListOfHistos->At(14);
     fhRegionMultMinVsEt  = (TH1F*)fListOfHistos->At(15);
     fhRegionAveSumPtVsEt = (TH1F*)fListOfHistos->At(16);
-    fhRegForwardSumPtVsEt = (TH1F*)fListOfHistos->At(21);
-    fhRegBackwardSumPtVsEt = (TH1F*)fListOfHistos->At(23);
     
     //fhValidRegion  = (TH2F*)fListOfHistos->At(21);
     
@@ -1393,24 +1246,13 @@ void  AliAnalysisTaskUE::Terminate(Option_t */*option*/)
     
     c1->cd(3);
     TH1F *h4r = new TH1F("hRegionEtvsDiffPt" , "", fBinsPtInHist,  fMinJetPtInHist, fMaxJetPtInHist);
-    TH1F *h41r = new TH1F("hRegForwvsDiffPt" , "", fBinsPtInHist,  fMinJetPtInHist, fMaxJetPtInHist);
-    TH1F *h42r = new TH1F("hRegBackvsDiffPt" , "", fBinsPtInHist,  fMinJetPtInHist, fMaxJetPtInHist);
-    h41r->Divide(fhRegForwardSumPtVsEt,fhEleadingPt,1,1);
-    h42r->Divide(fhRegBackwardSumPtVsEt,fhEleadingPt,1,1);
     h4r->Divide(fhRegionAveSumPtVsEt,fhEleadingPt,1,1);
-    //h4r->Scale(2.); // make average
+    h4r->Scale(2.); // make average
     //h4r->Scale( areafactor );
     h4r->SetYTitle("#DeltaP_{T}^{90}");
     h4r->SetXTitle("P_{T} of Leading Jet (GeV/c)");
     h4r->SetMarkerStyle(20);
     h4r->DrawCopy("p");
-    h41r->SetXTitle("P_{T} of Leading Jet (GeV/c)");
-    h41r->SetMarkerStyle(22);
-    h41r->DrawCopy("p same");
-    h42r->SetXTitle("P_{T} of Leading Jet (GeV/c)");
-    h42r->SetMarkerStyle(23);
-    h42r->SetMarkerColor(kRed);
-    h42r->DrawCopy("p same");
     
     c1->cd(4);
     TH1F *h5r = new TH1F("hRegionMultMaxVsEtleading",   "",  fBinsPtInHist, fMinJetPtInHist,   fMaxJetPtInHist);
@@ -1473,7 +1315,6 @@ void  AliAnalysisTaskUE::Terminate(Option_t */*option*/)
     //fhMinRegMaxPtPart     = (TH1F*)fListOfHistos->At(6);
     fhMinRegSumPtvsMult   = (TH1F*)fListOfHistos->At(7);
     
-    
     // Canvas
     TCanvas* c3 = new TCanvas("c3"," pT dist",160,160,1200,800);
     c3->Divide(2,2);
diff --git a/PWG4/JetTasks/AliAnalysisTaskUE.h b/PWG4/JetTasks/AliAnalysisTaskUE.h
index 641be8eab04..2f6fb00f406 100644
--- a/PWG4/JetTasks/AliAnalysisTaskUE.h
+++ b/PWG4/JetTasks/AliAnalysisTaskUE.h
@@ -61,7 +61,6 @@ class  AliAnalysisTaskUE : public AliAnalysisTask
     void   SetConePosition(Int_t val)     { fConePosition= val; }
     void   SetUseSingleCharge()  { fUseSingleCharge = kTRUE; } 
     void   SetUseNegativeChargeType()        { fUsePositiveCharge = kFALSE; }
-    void   SetDoNotNormalizeQuantities()  { fIsNorm2Area = kFALSE; }
     // Jet cuts
     void   SetPtMinChPartJet( Double_t val )  { fChJetPtMin = val; }
     void   SetJet1EtaCut( Double_t val )      { fJet1EtaCut = val; }
@@ -101,7 +100,6 @@ class  AliAnalysisTaskUE : public AliAnalysisTask
     Int_t   fBinsPtInHist;     //  # bins for Pt histos range
     Double_t   fMinJetPtInHist;   //  min Jet Pt value for histo range
     Double_t   fMaxJetPtInHist;   //  max Jet Pt value for histo range
-    Bool_t     fIsNorm2Area;      // Apply Area Normalization to collected observables
     
     // For MC
     Bool_t fUseMCParticleBranch;  // Run Over mcparticles branch in AOD
@@ -199,19 +197,6 @@ class  AliAnalysisTaskUE : public AliAnalysisTask
     TH1F*  fhRegionAvePartPtMinVsEt; //!
     TH1F*  fhRegionMaxPartPtMaxVsEt; //!
     
-    TH1F*  fhRegForwardSumPtVsEt;    //!
-    TH1F*  fhRegForwardMultVsEt;     //!
-    TH1F*  fhRegBackwardSumPtVsEt;   //!
-    TH1F*  fhRegBackwardMultVsEt;    //!
-    TH2F*  fhRegForwardMult;         //!
-    TH2F*  fhRegForwardSumPtvsMult;  //!
-    TH2F*  fhRegBackwardMult;        //!
-    TH2F*  fhRegBackwardSumPtvsMult; //!
-    TH2F*  fhRegForwardPartPtDistVsEt; //!
-    TH2F*  fhRegBackwardPartPtDistVsEt; //!
-    TH2F*  fhRegTransMult;         //!
-    TH2F*  fhRegTransSumPtVsMult;    //!
-
     //        TH2F*  fhValidRegion; //! test to be canceled
     
     TProfile* fh1Xsec;               //!
diff --git a/PWG4/JetTasks/AliPWG4HighPtQAMC.cxx b/PWG4/JetTasks/AliPWG4HighPtQAMC.cxx
index 2b4566b6eec..ba33bbeb7f2 100644
--- a/PWG4/JetTasks/AliPWG4HighPtQAMC.cxx
+++ b/PWG4/JetTasks/AliPWG4HighPtQAMC.cxx
@@ -50,8 +50,7 @@ AliPWG4HighPtQAMC::AliPWG4HighPtQAMC(): AliAnalysisTask("AliPWG4HighPtQAMC", "")
   fESD(0), 
   fTrackCuts(0), 
   fTrackCutsITS(0),
-  fNEventAll(0),
-  fNEventSel(0),
+  fNEvent(0), 
   fPtAll(0),  
   fPtSel(0),  
   fPtAllminPtMCvsPtAll(0),
@@ -87,8 +86,7 @@ AliPWG4HighPtQAMC::AliPWG4HighPtQAMC(const char *name):
   fESD(0),
   fTrackCuts(),
   fTrackCutsITS(),
-  fNEventAll(0),
-  fNEventSel(0),
+  fNEvent(0),
   fPtAll(0),
   fPtSel(0),
   fPtAllminPtMCvsPtAll(0),
@@ -170,12 +168,10 @@ void AliPWG4HighPtQAMC::CreateOutputObjects() {
   Int_t fgkNPtBins=98;
   Float_t fgkPtMin=2.;
   Float_t fgkPtMax=100.;
-  Int_t fgkResPtBins=80;
+  Int_t fgkResPtBins=40;
 
-  fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
-  fHistList->Add(fNEventAll);
-  fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
-  fHistList->Add(fNEventSel);
+  fNEvent = new TH1F("fNEvent","NEvent",1,-0.5,0.5);
+  fHistList->Add(fNEvent);
   fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
   fHistList->Add(fPtAll);
   fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
@@ -192,13 +188,13 @@ void AliPWG4HighPtQAMC::CreateOutputObjects() {
   fPtAllminPtMCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
   fHistList->Add(fPtAllminPtMCvsPtAllNPointTPC);
 
-  fPtAllminPtMCvsPtAllDCAR = new TH3F("fPtAllminPtMCvsPtAllDCAR","PtAllminPtMCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
+  fPtAllminPtMCvsPtAllDCAR = new TH3F("fPtAllminPtMCvsPtAllDCAR","PtAllminPtMCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
   fPtAllminPtMCvsPtAllDCAR->SetXTitle("p_{t}^{MC}");
   fPtAllminPtMCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
   fPtAllminPtMCvsPtAllDCAR->SetZTitle("DCA_{R}");
   fHistList->Add(fPtAllminPtMCvsPtAllDCAR);
 
-  fPtAllminPtMCvsPtAllDCAZ = new TH3F("fPtAllminPtMCvsPtAllDCAZ","PtAllminPtMCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
+  fPtAllminPtMCvsPtAllDCAZ = new TH3F("fPtAllminPtMCvsPtAllDCAZ","PtAllminPtMCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
   fPtAllminPtMCvsPtAllDCAZ->SetXTitle("p_{t}^{MC}");
   fPtAllminPtMCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
   fPtAllminPtMCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
@@ -249,13 +245,13 @@ void AliPWG4HighPtQAMC::CreateOutputObjects() {
   fPtITSminPtMCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
   fHistListITS->Add(fPtITSminPtMCvsPtITSNPointTPC);
     
-  fPtITSminPtMCvsPtITSDCAR = new TH3F("fPtITSminPtMCvsPtITSDCAR","PtITSminPtMCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
+  fPtITSminPtMCvsPtITSDCAR = new TH3F("fPtITSminPtMCvsPtITSDCAR","PtITSminPtMCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
   fPtITSminPtMCvsPtITSDCAR->SetXTitle("p_{t}^{MC}");
   fPtITSminPtMCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
   fPtITSminPtMCvsPtITSDCAR->SetZTitle("DCA_{R}");
   fHistListITS->Add(fPtITSminPtMCvsPtITSDCAR);
   
-  fPtITSminPtMCvsPtITSDCAZ = new TH3F("fPtITSminPtMCvsPtITSDCAZ","PtITSminPtMCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
+  fPtITSminPtMCvsPtITSDCAZ = new TH3F("fPtITSminPtMCvsPtITSDCAZ","PtITSminPtMCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
   fPtITSminPtMCvsPtITSDCAZ->SetXTitle("p_{t}^{MC}");
   fPtITSminPtMCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
   fPtITSminPtMCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
@@ -307,38 +303,20 @@ void AliPWG4HighPtQAMC::Exec(Option_t *) {
   // Called for each event
   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::Exec \n"));  
   
-  // All events without selection
-  fNEventAll->Fill(0.);
-
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
     return;
   }
 
-  Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
-  if(!isSelected) { //Select collison candidates
-    AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
-    // Post output data
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
-    return;
-  }
-  
  AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
   if (!eventHandler) {
     AliDebug(2,Form("ERROR: Could not retrieve MC event handler"));
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
     return;
   }
 
   AliMCEvent* mcEvent = eventHandler->MCEvent();
   if (!mcEvent) {
     AliDebug(2,Form("ERROR: Could not retrieve MC event"));
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
     return;
   }
 
@@ -346,8 +324,6 @@ void AliPWG4HighPtQAMC::Exec(Option_t *) {
 
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
     return;
   }
 
@@ -356,33 +332,17 @@ void AliPWG4HighPtQAMC::Exec(Option_t *) {
   AliDebug(2,Form("MC particles stack: %d", stack->GetNtrack()));
 
   const AliESDVertex *vtx = fESD->GetPrimaryVertex();
+
   // Need vertex cut
-  if (vtx->GetNContributors() < 2) {
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
+  if (vtx->GetNContributors() < 2)
     return;
-  }
- double primVtx[3];
-  vtx->GetXYZ(primVtx);
-  //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
-  if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
-    // Post output data
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
-    return;
-  }
   
   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
 
   // Need to keep track of evts without vertex
-  fNEventSel->Fill(0.);
-
-  if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2)  {
-    PostData(0, fHistList);
-    PostData(1, fHistListITS);
-    return;
-  }
+  fNEvent->Fill(0.);
 
+  if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2) return;
   Int_t nTracks = fESD->GetNumberOfTracks();
   AliDebug(2,Form("nTracks %d", nTracks));
 
diff --git a/PWG4/JetTasks/AliPWG4HighPtQAMC.h b/PWG4/JetTasks/AliPWG4HighPtQAMC.h
index 0a5519da081..7e2e65c6639 100644
--- a/PWG4/JetTasks/AliPWG4HighPtQAMC.h
+++ b/PWG4/JetTasks/AliPWG4HighPtQAMC.h
@@ -58,8 +58,7 @@ class AliPWG4HighPtQAMC: public AliAnalysisTask {
   AliESDtrackCuts *fTrackCutsITS; // TrackCuts including ITSrefit
 
   
-  TH1F *fNEventAll;                            //! Event counter
-  TH1F *fNEventSel;                            //! Event counter
+  TH1F *fNEvent;                               //! Event counter
   TH1F *fPtAll;                                //! Pt spectrum all charged particles
   TH1F *fPtSel;                                //! Pt spectrum all selected charged particles by fTrackCuts
   TH2F *fPtAllminPtMCvsPtAll;                  //! Momentum resolution (global vs MC)
diff --git a/PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx b/PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
index c3c82e17c22..c0916d48000 100644
--- a/PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
+++ b/PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
@@ -22,8 +22,8 @@
 // Author : Marta Verweij - UU
 //-----------------------------------------------------------------------
 
-#ifndef ALIPWG4HIGHPTQATPCONLY_CXX
-#define ALIPWG4HIGHPTQATPCONLY_CXX
+#ifndef ALIPWG4HighPtQATPCONLY_CXX
+#define ALIPWG4HighPtQATPCONLY_CXX
 
 #include "AliPWG4HighPtQATPConly.h"
 
@@ -42,7 +42,7 @@
 #include "AliESDtrackCuts.h"
 #include "AliExternalTrackParam.h"
 #include "AliLog.h"
-//#include "AliAnalysisHelperJetTasks.h"
+#include "AliAnalysisHelperJetTasks.h"
 
 using namespace std; //required for resolving the 'cout' symbol
 
@@ -201,13 +201,13 @@ void AliPWG4HighPtQATPConly::CreateOutputObjects() {
   fPtAllminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPC);
 
-  fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
+  fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
   fPtAllminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{All}");
   fPtAllminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
   fPtAllminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
   fHistList->Add(fPtAllminPtTPCvsPtAllDCAR);
 
-  fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
+  fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
   fPtAllminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{All}");
   fPtAllminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
   fPtAllminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
@@ -258,13 +258,13 @@ void AliPWG4HighPtQATPConly::CreateOutputObjects() {
   fPtITSminPtTPCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPC);
     
-  fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
+  fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
   fPtITSminPtTPCvsPtITSDCAR->SetXTitle("p_{t}^{ITSrefit}");
   fPtITSminPtTPCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
   fPtITSminPtTPCvsPtITSDCAR->SetZTitle("DCA_{R}");
   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAR);
   
-  fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
+  fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
   fPtITSminPtTPCvsPtITSDCAZ->SetXTitle("p_{t}^{ITSrefit}");
   fPtITSminPtTPCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
   fPtITSminPtTPCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
@@ -321,38 +321,35 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
 
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
-    // Post output data
-     PostData(0, fHistList);
-     PostData(1, fHistListTPC);
-     PostData(2, fHistListITS);
     return;
   }
 
-  Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
-  if(!isSelected) { //Select collison candidates
+  //Trigger selection
+  AliAnalysisHelperJetTasks::Trigger trig;
+  trig = (AliAnalysisHelperJetTasks::Trigger)fTrigger;
+  if (AliAnalysisHelperJetTasks::IsTriggerFired(fESD,trig)){
+    AliDebug(2,Form(" Trigger Selection: event ACCEPTED ... "));
+  }else{
     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
     // Post output data
-     PostData(0, fHistList);
-     PostData(1, fHistListTPC);
-     PostData(2, fHistListITS);
+    PostData(0, fHistList);
+    PostData(1, fHistListTPC);
+    PostData(2, fHistListITS);
     return;
-  }
+  } 
 
+//  if(!fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL") || !fESD->IsTriggerClassFired("CSMBB-ABCE-NOPF-ALL")) return;
+  
   const AliESDVertex *vtx = fESD->GetPrimaryVertexTracks();
   // Need vertex cut
-  if (vtx->GetNContributors() < 2) {
-    // Post output data
-    PostData(0, fHistList);
-    PostData(1, fHistListTPC);
-    PostData(2, fHistListITS);
+  if (vtx->GetNContributors() < 2)
     return;
-  }
 
   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
   double primVtx[3];
   vtx->GetXYZ(primVtx);
   //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
-  if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
+  if(TMath::Abs(primVtx[0]>1.) || TMath::Abs(primVtx[1]>1.) || TMath::Abs(primVtx[2])>10.){
     // Post output data
     PostData(0, fHistList);
     PostData(1, fHistListTPC);
@@ -378,7 +375,10 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
     
     AliESDtrack *track = fESD->GetTrack(iTrack);
     AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
-    if(!track || !trackTPC) continue;
+    //    AliESDtrack *trackTPConly = fTrackCuts->GetTPCOnlyTrack(fESD,iTrack); 
+    if(!track) continue;
+    if(!trackTPC) continue;
+//     if(!trackTPConly) continue;
     Float_t pt = track->Pt();
     Float_t ptTPC = trackTPC->Pt();
     Float_t phi = track->Phi();
@@ -404,6 +404,7 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
     if (fTrackCuts->AcceptTrack(track)) {
 
       fPtSel->Fill(pt);
+      
       fPtSelTPC->Fill(ptTPC);
       fPtAllminPtTPCvsPtAll->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
       fPtAllminPtTPCvsPtAllNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCNcls());
@@ -433,7 +434,7 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
       fPtITSminPtTPCvsPtITSRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
     }//fTrackCutsITS loop
       
-}//ESD track loop
+  }//ESD track loop
    
   // Post output data
   PostData(0, fHistList);
diff --git a/PWG4/JetTasks/AliPWG4HighPtSpectra.cxx b/PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
index 3d837bc8434..f81bdde737b 100644
--- a/PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
+++ b/PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
@@ -24,37 +24,25 @@
 //-----------------------------------------------------------------------
 
 
-#ifndef ALIPWG4HIGHPTSPECTRA_CXX
-#define ALIPWG4HIGHPTSPECTRA_CXX
+#ifndef ALIPWG4HighPtSpectra_CXX
+#define ALIPWG4HighPtSpectra_CXX
 
 #include "AliPWG4HighPtSpectra.h"
 
-#include "TVector3.h"
-#include 
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TList.h"
-#include "TChain.h"
-#include "TH3F.h"
-
-#include "AliAnalysisManager.h"
-#include "AliESDInputHandler.h"
-#include "AliESDtrack.h"
-#include "AliESDtrackCuts.h"
-#include "AliExternalTrackParam.h"
-#include "AliLog.h"
-
 #include "AliStack.h"
 #include "TParticle.h"
 #include "TH1I.h"
 #include "AliMCEvent.h"
 #include "AliMCEventHandler.h"
+#include "AliAnalysisManager.h"
 #include "AliCFContainer.h"
+#include "TChain.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliExternalTrackParam.h"
+#include "AliESDInputHandler.h"
+#include "AliAnalysisHelperJetTasks.h"
 
-//#include "$ALICE_ROOT/PWG4/JetTasks/AliAnalysisHelperJetTasks.h"
-
-//#include 
 using namespace std; //required for resolving the 'cout' symbol
 
 ClassImp(AliPWG4HighPtSpectra)
@@ -62,14 +50,14 @@ ClassImp(AliPWG4HighPtSpectra)
 //__________________________________________________________________________
 AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpectra", ""), 
   fReadAODData(0),
-  fCFManagerPos(0x0),
-  fCFManagerNeg(0x0),
+  fCFManager(0x0),
   fESD(0),
   fTrackCuts(0),
   fTrigger(0),
   fHistList(0),
   fNEventAll(0),
   fNEventSel(0)
+  //  fHistEventsProcessed(0x0)
 {
   //
   //Default ctor
@@ -79,81 +67,78 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpe
 AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const Char_t* name) :
   AliAnalysisTask(name,""),
   fReadAODData(0),
-  fCFManagerPos(0x0),
-  fCFManagerNeg(0x0),
+  fCFManager(0x0),
   fESD(0),
-  fTrackCuts(),
+  fTrackCuts(),//new AliESDtrackCuts),
   fTrigger(0),
   fHistList(0),
   fNEventAll(0),
   fNEventSel(0)
+  //  fHistEventsProcessed(0x0)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
   //
-  AliDebug(2,Form("AliPWG4HighPtSpectra","Calling Constructor"));
+  AliDebug(2,Form("AliPWG4HighPtQAMC","Calling Constructor"));
   // Input slot #0 works with a TChain ESD
   DefineInput(0, TChain::Class());
   DefineOutput(0,TList::Class());
   DefineOutput(1,AliCFContainer::Class());
-  DefineOutput(2,AliCFContainer::Class());
 }
 
-// //___________________________________________________________________________
-// AliPWG4HighPtSpectra& AliPWG4HighPtSpectra::operator=(const AliPWG4HighPtSpectra& c) 
-// {
-//   //
-//   // Assignment operator
-//   //
-//   if (this!=&c) {
-//     AliAnalysisTask::operator=(c) ;
-//     fReadAODData = c.fReadAODData ;
-//     fCFManagerPos  = c.fCFManagerPos;
-//     fCFManagerNeg  = c.fCFManagerNeg;
-//     fHistList = c.fHistList;
-//     fNEventAll = c.fNEventAll;
-//     fNEventSel = c.fNEventSel;
-//   }
-//   return *this;
-// }
-
-// //___________________________________________________________________________
-// AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c) :
-//   AliAnalysisTask(c),
-//   fReadAODData(c.fReadAODData),
-//   fCFManagerPos(c.fCFManagerPos),
-//   fCFManagerNeg(c.fCFManagerNeg),
-//   fESD(c.fESD),
-//   fTrackCuts(c.fTrackCuts),
-//   fTrigger(c.fTrigger),
-//   fHistList(c.fHistList),
-//   fNEventAll(c.fNEventAll),
-//   fNEventSel(c.fNEventSel)
-// {
-//   //
-//   // Copy Constructor
-//   //
-// }
-
-// //___________________________________________________________________________
-// AliPWG4HighPtSpectra::~AliPWG4HighPtSpectra() {
-//   //
-//   //destructor
-//   //
-//   Info("~AliPWG4HighPtSpectra","Calling Destructor");
-//   if (fCFManagerPos)           delete fCFManagerPos ;
-//   if (fCFManagerNeg)           delete fCFManagerNeg ;
-//   if (fNEventAll)              delete fNEventAll ;
-//   if (fNEventSel)              delete fNEventSel ;
-// }
+//___________________________________________________________________________
+AliPWG4HighPtSpectra& AliPWG4HighPtSpectra::operator=(const AliPWG4HighPtSpectra& c) 
+{
+  //
+  // Assignment operator
+  //
+  if (this!=&c) {
+    AliAnalysisTask::operator=(c) ;
+    fReadAODData = c.fReadAODData ;
+    fCFManager  = c.fCFManager;
+    fHistList = c.fHistList;
+    fNEventAll = c.fNEventAll;
+    fNEventSel = c.fNEventSel;
+    //    fHistEventsProcessed = c.fHistEventsProcessed;
+  }
+  return *this;
+}
+
+//___________________________________________________________________________
+AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c) :
+  AliAnalysisTask(c),
+  fReadAODData(c.fReadAODData),
+  fCFManager(c.fCFManager),
+  fESD(c.fESD),
+  fTrackCuts(c.fTrackCuts),
+  fTrigger(c.fTrigger),
+  fHistList(c.fHistList),
+  fNEventAll(c.fNEventAll),
+  fNEventSel(c.fNEventSel)
+  //  fHistEventsProcessed(c.fHistEventsProcessed)
+{
+  //
+  // Copy Constructor
+  //
+}
+
+//___________________________________________________________________________
+AliPWG4HighPtSpectra::~AliPWG4HighPtSpectra() {
+  //
+  //destructor
+  //
+  Info("~AliPWG4HighPtSpectra","Calling Destructor");
+  if (fCFManager)           delete fCFManager ;
+  if (fNEventAll) delete fNEventAll ;
+  if (fNEventSel) delete fNEventSel ;
+}
 //________________________________________________________________________
 void AliPWG4HighPtSpectra::ConnectInputData(Option_t *) 
 {
   // Connect ESD here
   // Called once
   AliDebug(2,Form(">> AliPWG4HighPtSpectra::ConnectInputData \n"));
-  //  cout << "cout >> AliPWG4HighPtSpectra::ConnectInputData" << endl;
-  printf(">> AliPWG4HighPtSpectra::ConnectInputData \n");
+  //  printf(">> AliPWG4HighPtSpectra::ConnectInputData \n");
 
   TTree* tree = dynamic_cast (GetInputData(0));
   if (!tree) {
@@ -164,14 +149,13 @@ void AliPWG4HighPtSpectra::ConnectInputData(Option_t *)
     
     if (!esdH) {
       AliDebug(2,Form("ERROR: Could not get ESDInputHandler"));
-    } else {
+    } else
       fESD = esdH->GetEvent();
-    }
   }
-  
+ 
 }
 //_________________________________________________
-void AliPWG4HighPtSpectra::Exec(Option_t *)
+void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
 {
   //
   // Main loop function
@@ -183,38 +167,33 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
 
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
-    PostData(0,fHistList);
-    PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
     return;
   }
 
-  Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
-  if(!isSelected) { //Select collison candidates
+  //Trigger selection
+  AliAnalysisHelperJetTasks::Trigger trig;
+  trig = (AliAnalysisHelperJetTasks::Trigger)fTrigger;
+  if (AliAnalysisHelperJetTasks::IsTriggerFired(fESD,trig)){
+    AliDebug(2,Form(" Trigger Selection: event ACCEPTED ... "));
+  }else{
     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
     PostData(0,fHistList);
-    PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
+    PostData(1,fCFManager->GetParticleContainer());
     return;
-  }
+  } 
+  //  if(!fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL") || !fESD->IsTriggerClassFired("CSMBB-ABCE-NOPF-ALL")) return;
 
   // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
   // This handler can return the current MC event
-  
-  AliMCEventHandler *eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
-  //  AliMCEventHandler* eventHandler = (AliMCEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
-  
+  AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
   AliStack* stack = 0x0;
   AliMCEvent* mcEvent = 0x0;
-  
+
   if(eventHandler) {
     mcEvent = eventHandler->MCEvent();
     if (!mcEvent) {
       AliDebug(2,Form("ERROR: Could not retrieve MC event"));
-      PostData(0,fHistList);
-      PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
-    return;
+      return;
     }
     
     AliDebug(2,Form("MC particles: %d", mcEvent->GetNumberOfTracks()));
@@ -225,49 +204,30 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
   }
   
   const AliESDVertex *vtx = fESD->GetPrimaryVertex();
-  AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
   // Need vertex cut
-  if (vtx->GetNContributors() < 2) {
+  if (vtx->GetNContributors() < 2){
     PostData(0,fHistList);
-    PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
+    PostData(1,fCFManager->GetParticleContainer());
     return;
   }
-  
   double primVtx[3];
   vtx->GetXYZ(primVtx);
-  if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
+  if(TMath::Abs(primVtx[0]>1. )|| TMath::Abs(primVtx[1]>1.) || TMath::Abs(primVtx[2]>10.)){
     PostData(0,fHistList);
-    PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
-    return;
-  }
-  
-  if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2){ 
-    // Post output data
-    PostData(0,fHistList);
-    PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
+    PostData(1,fCFManager->GetParticleContainer());
     return;
   }
+  AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
+
   Int_t nTracks = fESD->GetNumberOfTracks();
   AliDebug(2,Form("nTracks %d", nTracks));
 
-  if(!fTrackCuts) { 
-    // Post output data
-    PostData(0,fHistList);
-    PostData(1,fCFManagerPos->GetParticleContainer());
-    PostData(2,fCFManagerNeg->GetParticleContainer());
-    return;
-  }
-
   // Selected events for analysis
   fNEventSel->Fill(0.);
-  
-  
-  Double_t containerInputRec[5] ;
-  Double_t containerInputTPConly[5];
-  Double_t containerInputMC[5];
+
+  Double_t containerInputRec[1] ;
+  Double_t containerInputTPConly[1] ;
+  Double_t containerInputMC[1] ;
   //Now go to rec level
   for (Int_t iTrack = 0; iTrackGetTPCInnerParam();
       if(!track || !trackTPC) continue;
 
-      Float_t dca2D, dcaZ;
-      track->GetImpactParameters(dca2D,dcaZ);
-      Float_t dca2DTPC, dcaZTPC;
-      track->GetImpactParametersTPC(dca2DTPC,dcaZTPC); 
-      Float_t chi2PerClusterTPC = -1.;
-      Float_t nClustersTPC = track->GetTPCNcls();//track->GetTPCclusters(0);
-      if(nClustersTPC!=0.) chi2PerClusterTPC = track->GetTPCchi2()/nClustersTPC;
-
+    
       //fill the container
       containerInputRec[0] = track->Pt();
-      containerInputRec[1] = track->Phi();
-      containerInputRec[2] = track->Eta();
-      containerInputRec[3] = dca2D;
-      containerInputRec[4] = chi2PerClusterTPC;
-
       containerInputTPConly[0] = trackTPC->Pt();
-      containerInputTPConly[1] = trackTPC->Phi();
-      containerInputTPConly[2] = trackTPC->Eta();
-      containerInputTPConly[3] = dca2DTPC/10.; //Divide by 10 in order to store in same containter. Should be corrected back when looking at output.
-      containerInputTPConly[4] = chi2PerClusterTPC;//TPC;
 
       if (fTrackCuts->AcceptTrack(track)) {
-	if(track->GetSign()>0.) {
-	  fCFManagerPos->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
-	  fCFManagerPos->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
-	}
-	if(track->GetSign()<0.) {
-	  fCFManagerNeg->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
-	  fCFManagerNeg->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
-	}
+	fCFManager->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
+	fCFManager->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
 	
-  	
 	//Only fill the secondary particle container if MC information is available
 	if(eventHandler) {
 	  Int_t label = TMath::Abs(track->GetLabel());
 	  TParticle *particle = stack->Particle(label) ;
 	  if(!particle) continue;
 	  containerInputMC[0] = particle->Pt();      
-	  containerInputMC[1] = particle->Phi();      
-	  containerInputMC[2] = particle->Eta();  
-	  containerInputMC[3] = 0.0;      
-	  containerInputMC[4] = 0.0;  
-
-	  if(particle->GetPDG()->Charge()>0.) {
-	    fCFManagerPos->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
-	  }
-	  if(particle->GetPDG()->Charge()<0.) {
-	    fCFManagerNeg->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
-	  }
-
+	  fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
 	  if (!stack->IsPhysicalPrimary(label) ) {
-	    if(particle->GetPDG()->Charge()>0.) {
-	      fCFManagerPos->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
-	    }
-	    if(particle->GetPDG()->Charge()<0.) {
-	      fCFManagerNeg->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
-	    }
+	    fCFManager->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
 	  }
 	}
-	
       }
       
     }
-  
 
-  
   if(eventHandler) {
     for(int iPart = 1; iPart<(mcEvent->GetNumberOfTracks()); iPart++)//stack->GetNprimary();
       {
@@ -351,29 +269,21 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)
 	
 	//fill the container
 	containerInputMC[0] = mcPart->Pt();
-	containerInputMC[1] = mcPart->Phi();      
-	containerInputMC[2] = mcPart->Eta();  
-	containerInputMC[3] = 0.0;
-	containerInputMC[4] = 0.0;
-
+	
+	if (!fCFManager->CheckParticleCuts(3,mcPart)) continue ;
+	
 	int counter;
-
-	if(mcPart->Charge()>0. && fCFManagerPos->CheckParticleCuts(3,mcPart)) {
-	  Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
-	  if(trackLengthTPC>80.) fCFManagerPos->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
-	}
-	if(mcPart->Charge()<0. && fCFManagerNeg->CheckParticleCuts(3,mcPart)) {
-	  Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
-	  if(trackLengthTPC>80.) fCFManagerNeg->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
-	}
+	
+	Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
+	
+	if(trackLengthTPC>80.) fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
+	
       }
   }
-  
-   
-  PostData(0,fHistList);
-  PostData(1,fCFManagerPos->GetParticleContainer());
-  PostData(2,fCFManagerNeg->GetParticleContainer());
-  
+
+   PostData(0,fHistList);
+   PostData(1,fCFManager->GetParticleContainer());
+
 }
 
 
@@ -383,6 +293,8 @@ void AliPWG4HighPtSpectra::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.
+
+
 }
 
 //___________________________________________________________________________
@@ -392,9 +304,6 @@ void AliPWG4HighPtSpectra::CreateOutputObjects() {
   //
   AliDebug(2,Form("CreateOutputObjects","CreateOutputObjects of task %s", GetName()));
 
-  Bool_t oldStatus = TH1::AddDirectoryStatus();
-  TH1::AddDirectory(kFALSE); 
-
   //slot #1
   OpenFile(0);
   fHistList = new TList();
@@ -403,8 +312,6 @@ void AliPWG4HighPtSpectra::CreateOutputObjects() {
   fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
   fHistList->Add(fNEventSel);
 
-  TH1::AddDirectory(oldStatus);   
-
 }
 
 #endif
diff --git a/PWG4/JetTasks/AliPWG4HighPtSpectra.h b/PWG4/JetTasks/AliPWG4HighPtSpectra.h
index 36cd12ff1e7..e9661573bee 100644
--- a/PWG4/JetTasks/AliPWG4HighPtSpectra.h
+++ b/PWG4/JetTasks/AliPWG4HighPtSpectra.h
@@ -27,7 +27,7 @@ class TH1I;
 class TH1F;
 class TH1D;
 class TFile ;
-//class AliCFManager;
+class AliCFManager;
 class AliESDtrackCuts;
 class AliESDEvent;
 
@@ -35,18 +35,18 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
  public:
 
   enum {
-    kStepReconstructed        = 0,
+    kStepReconstructed    = 0,
     kStepReconstructedTPCOnly = 1,
-    kStepSecondaries          = 2,
-    kStepMCtrackable          = 3,
-    kStepReconstructedMC      = 4
+    kStepSecondaries      = 2,
+    kStepMCtrackable      = 3,
+    kStepReconstructedMC    = 4
   };
 
   AliPWG4HighPtSpectra();
   AliPWG4HighPtSpectra(const Char_t* name);
-  // AliPWG4HighPtSpectra& operator= (const AliPWG4HighPtSpectra& c);
-  //  AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c);
-  ~AliPWG4HighPtSpectra() {;};
+  AliPWG4HighPtSpectra& operator= (const AliPWG4HighPtSpectra& c);
+  AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c);
+  virtual ~AliPWG4HighPtSpectra();
 
   // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
   virtual void   ConnectInputData(Option_t *);
@@ -55,11 +55,9 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
   virtual void   Terminate(Option_t *);
 
   // CORRECTION FRAMEWORK RELATED FUNCTIONS
-  void     SetCFManagerPos(const AliCFManager* io1) {fCFManagerPos = io1;}   // global correction manager 
-  const AliCFManager * GetCFManagerPos() const {return fCFManagerPos;}           // get corr manager 
-  void     SetCFManagerNeg(const AliCFManager* io2) {fCFManagerNeg = io2;}   // global correction manager 
-  const AliCFManager * GetCFManagerNeg() const {return fCFManagerNeg;}            // get corr manager
-  
+  void     SetCFManager(const AliCFManager* io) {fCFManager = io;}   // global correction manager
+  const AliCFManager * GetCFManager() const {return fCFManager;}           // get corr manager
+
   //AliESDtrackCuts setters
   void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
   //Select the trigger
@@ -70,23 +68,20 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
   void   SetReadAODData(Bool_t flag=kTRUE) {fReadAODData=flag;}
   
  protected:
-  Bool_t              fReadAODData ;       // flag for AOD/ESD input files
-  const AliCFManager  *fCFManagerPos    ;  // pointer to the CF manager for positive charged particles
-  const AliCFManager  *fCFManagerNeg    ;  // pointer to the CF manager for negative charged particles
- 
+  Bool_t              fReadAODData ;    // flag for AOD/ESD input files
+  const AliCFManager  *fCFManager    ;  // pointer to the CF manager
+
   AliESDEvent *fESD;              //! ESD object
   //AliESDtrackCuts options. Must be setted in AddTaskPWG4HighPtQAMC.C. They correspond with different steps in container.
   AliESDtrackCuts *fTrackCuts;    // trackCuts applied
   Int_t fTrigger;                 //Trigger flag as defined in AliAnalysisHelperJetTasks.h 
 
  private:
- AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra&);
- AliPWG4HighPtSpectra& operator=(const AliPWG4HighPtSpectra&);
-
 
   // Histograms
   //Number of events
-  TList *fHistList;            //! List of output histograms
+  TList *fHistList;            // List of output histograms
+  //  TH1I  *fHistEventsProcessed; // simple histo for monitoring the number of events processed
   TH1F *fNEventAll;            //! Event counter
   TH1F *fNEventSel;            //! Event counter: Selected events for analysis
 
diff --git a/PWG4/PartCorrDep/AliAnaOmegaToPi0Gamma.cxx b/PWG4/PartCorrDep/AliAnaOmegaToPi0Gamma.cxx
index 771502b9945..aa5cea33ecc 100644
--- a/PWG4/PartCorrDep/AliAnaOmegaToPi0Gamma.cxx
+++ b/PWG4/PartCorrDep/AliAnaOmegaToPi0Gamma.cxx
@@ -47,7 +47,9 @@ fEventsList(0),
 fVtxZCut(0), fCent(0), fRp(0), fBadChDist(0),
 fNVtxZBin(0), fNCentBin(0), fNRpBin(0), fNBadChDistBin(0), fNpid(0),
 fNmaxMixEv(0), fPi0Mass(0),
-fPi0MassWindow(0),fPi0OverOmegaPtCut(0),fGammaOverOmegaPtCut(0),
+fPi0MassWindow(0),
+fNbinsPt(0),fPtBegin(0),fPtEnd(0),
+fNbinsM(0),fMinM(0),fMaxM(0),
 fhEtalon(0),
 fRealOmega(0), fMixAOmega(0),
 fMixBOmega(0), fMixCOmega(0),
@@ -72,7 +74,8 @@ fNVtxZBin(ex.fNVtxZBin), fNCentBin(ex.fNCentBin), fNRpBin(ex.fNRpBin),
 fNBadChDistBin(ex.fNBadChDistBin),fNpid(ex.fNpid),
 fNmaxMixEv(ex.fNmaxMixEv), fPi0Mass(ex.fPi0Mass),
 fPi0MassWindow(ex.fPi0MassWindow),
-fPi0OverOmegaPtCut(ex.fPi0OverOmegaPtCut),fGammaOverOmegaPtCut(ex.fGammaOverOmegaPtCut),
+fNbinsPt(ex.fNbinsPt),fPtBegin(ex.fPtBegin),fPtEnd(ex.fPtEnd),
+fNbinsM(ex.fNbinsM),fMinM(ex.fMinM),fMaxM(ex.fMaxM),
 fhEtalon(ex.fhEtalon),
 fRealOmega(ex.fRealOmega), fMixAOmega(ex.fMixAOmega),
 fMixBOmega(ex.fMixBOmega), fMixCOmega(ex.fMixCOmega),
@@ -113,9 +116,10 @@ AliAnaOmegaToPi0Gamma & AliAnaOmegaToPi0Gamma::operator = (const AliAnaOmegaToPi
    fNmaxMixEv =ex.fNmaxMixEv;
    fPi0Mass=ex.fPi0Mass;
    fPi0MassWindow=ex.fPi0MassWindow;
-   fPi0OverOmegaPtCut=ex.fPi0OverOmegaPtCut;
-   fGammaOverOmegaPtCut=ex.fGammaOverOmegaPtCut;
 
+   fNbinsPt=ex.fNbinsPt;fPtBegin=ex.fPtBegin;fPtEnd=ex.fPtEnd;
+   fNbinsM=ex.fNbinsM;fMinM=ex.fMinM;fMaxM=ex.fMaxM;
+   
    fhEtalon=ex.fhEtalon;
    fRealOmega=ex.fRealOmega;
    fMixAOmega=ex.fMixAOmega;
@@ -172,8 +176,13 @@ void AliAnaOmegaToPi0Gamma::InitParameters()
 
   fPi0Mass=0.13498;
   fPi0MassWindow=0.015;
-  fPi0OverOmegaPtCut=0.8;
-  fGammaOverOmegaPtCut=0.3;
+  fNbinsPt=200;
+  fPtBegin=0;
+  fPtEnd=20;
+  fNbinsM=100;  //mass bin number, min and max
+  fMinM=0;
+  fMaxM=1;
+
   fNVtxZBin=1;
   fNCentBin=1;
   fNRpBin=1;
@@ -181,7 +190,8 @@ void AliAnaOmegaToPi0Gamma::InitParameters()
   fNpid=3;
 
   fVtxZCut = new Double_t [fNVtxZBin];
-  for(Int_t i=0;iSetXTitle("P_{T} (GeV)") ;
   fhEtalon->SetYTitle("m_{inv} (GeV)") ;
-*/
+
 }
 
 
 //______________________________________________________________________________
 TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
-{ 
-
-  Int_t nptbins   = GetHistoPtBins();
-  Float_t ptmax   = GetHistoPtMax();
-  Float_t ptmin  = GetHistoPtMin();
-
-  Int_t nmassbins = GetHistoMassBins();
-  Float_t massmin = GetHistoMassMin();
-  Float_t massmax = GetHistoMassMax();
-
-  fhEtalon = new TH2F("hEtalon","Histo with binning parameters", nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ;
-  fhEtalon->SetXTitle("P_{T} (GeV)") ;
-  fhEtalon->SetYTitle("m_{inv} (GeV)") ;
- 
+{  
  // store them in fOutputContainer
  fEventsList = new TList*[fNVtxZBin*fNCentBin*fNRpBin];
  for(Int_t i=0;iClone(key);
                      fRealOmega[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fRealOmega[index]->SetName(key) ;
@@ -274,7 +264,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fRealOmega[index]);
 
 		     sprintf(key,"MAPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixA Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixA Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixAOmega[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixAOmega[index]->SetName(key) ;
@@ -282,7 +272,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixAOmega[index]);
 
 		     sprintf(key,"MBPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixB Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixB Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixBOmega[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixBOmega[index]->SetName(key) ;
@@ -290,7 +280,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixBOmega[index]);
 
 		     sprintf(key,"MCPi0Gamma_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixC Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixC Pi0GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixCOmega[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixCOmega[index]->SetName(key) ;
@@ -298,7 +288,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixCOmega[index]);
 
 		     sprintf(key,"RPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s Real Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s Real Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fRealOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fRealOmega1[index]->SetName(key) ;
@@ -306,7 +296,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fRealOmega1[index]);
 
                      sprintf(key,"MAPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixA Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixA Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixAOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixAOmega1[index]->SetName(key) ;
@@ -314,7 +304,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixAOmega1[index]);
 
                      sprintf(key,"MBPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixB Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixB Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixBOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixBOmega1[index]->SetName(key) ;
@@ -322,7 +312,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixBOmega1[index]);
 
                      sprintf(key,"MCPi0Gamma1_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixC Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixC Pi0(A<0.7)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixCOmega1[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixCOmega1[index]->SetName(key) ;
@@ -330,7 +320,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixCOmega1[index]);
 
 		     sprintf(key,"RPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s Real Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s Real Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fRealOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fRealOmega2[index]->SetName(key) ;
@@ -338,7 +328,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fRealOmega2[index]);
 
                      sprintf(key,"MAPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixA Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixA Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixAOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixAOmega2[index]->SetName(key) ;
@@ -346,7 +336,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixAOmega2[index]);
 
                      sprintf(key,"MBPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixB Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixB Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixBOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixBOmega2[index]->SetName(key) ;
@@ -354,7 +344,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
                      outputContainer->Add(fMixBOmega2[index]);
 
                      sprintf(key,"MCPi0Gamma2_Vz%dC%dRp%dPid%dDist%d",i,j,k,ipid,idist);
-                     sprintf(title, "%s MixC Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%dcm",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
+                     sprintf(title, "%s MixC Pi0(A<0.8)GammaIVM vz_%2.1f_ct_%2.1f_Rp_%2.1f_pid_%d_dist_%d",detector,fVtxZCut[i],fCent[j],fRp[k],ipid,fBadChDist[idist]);
                      fhEtalon->Clone(key);
                      fMixCOmega2[index]=(TH2F*)fhEtalon->Clone(key) ;
                      fMixCOmega2[index]->SetName(key) ;
@@ -369,7 +359,7 @@ TList * AliAnaOmegaToPi0Gamma::GetCreateOutputObjects()
  if(IsDataMC()){
     sprintf(key, "%sOmegaPri",detector);
     sprintf(title,"primary #omega in %s",detector);
-    fhOmegaPriPt=new TH1F(key, title,nptbins,ptmin,ptmax);
+    fhOmegaPriPt=new TH1F(key, title,fNbinsPt,fPtBegin,fPtEnd);
     fhOmegaPriPt->GetXaxis()->SetTitle("P_{T}");
     fhOmegaPriPt->GetYaxis()->SetTitle("dN/P_{T}");
     outputContainer->Add(fhOmegaPriPt);
@@ -461,10 +451,11 @@ void AliAnaOmegaToPi0Gamma::MakeAnalysisFillHistograms()
  Double_t vert[]={0,0,0} ;
  GetReader()->GetVertex(vert);
  Int_t curEventBin =0;
-
- Int_t ivtxzbin=(Int_t)TMath::Abs(vert[2])/10;
- if(ivtxzbin>=fNVtxZBin)return;
-
+ Int_t ivtxzbin = -1;
+ for(Int_t i=0;i=(fVtxZCut[i]-10)) ivtxzbin=i;
+     if(TMath::Abs(vert[2])At(j));
 	     TLorentzVector dph3(photon3->Px(),photon3->Py(),photon3->Pz(),photon3->E());
 	     Int_t lab3=photon3->GetCaloLabel(0);
-             Double_t pi0gammapt=(vpi0+dph3).Pt();
-             Double_t pi0gammamass=(vpi0+dph3).M();
-             Double_t pi0OverOmegaPtRatio =vpi0.Pt()/pi0gammapt; 
-             Double_t gammaOverOmegaPtRatio= dph3.Pt()/pi0gammapt;
-
-             //pi0, gamma pt cut             
-             if(pi0OverOmegaPtRatio>fPi0OverOmegaPtCut || 
-                gammaOverOmegaPtRatioDistToBad()>=fBadChDist[idist] &&
 			   photon3->DistToBad()>=fBadChDist[idist] ){
 			 
+			   Double_t pi0gammapt=(vpi0+dph3).Pt();
+			   Double_t pi0gammamass=(vpi0+dph3).M();
 			   //fill the histograms
 			   fRealOmega[index]->Fill(pi0gammapt,pi0gammamass); 
 			   if(pi0asy<0.7) fRealOmega1[index]->Fill(pi0gammapt,pi0gammamass);
@@ -592,15 +577,6 @@ void AliAnaOmegaToPi0Gamma::MakeAnalysisFillHistograms()
 	     for(Int_t mix1=0;mix1GetEntries();mix1++){
                 AliAODPWG4Particle *mix1ph = (AliAODPWG4Particle*) (ev2->At(mix1));     
 		TLorentzVector vmixph(mix1ph->Px(),mix1ph->Py(),mix1ph->Pz(),mix1ph->E());
-                Double_t pi0gammapt=(vpi0+vmixph).Pt();
-                Double_t pi0gammamass=(vpi0+vmixph).M();
-                Double_t pi0OverOmegaPtRatio =vpi0.Pt()/pi0gammapt;
-                Double_t gammaOverOmegaPtRatio= vmixph.Pt()/pi0gammapt;
-
-              //pi0, gamma pt cut             
-               if(pi0OverOmegaPtRatio>fPi0OverOmegaPtCut || 
-                  gammaOverOmegaPtRatioDistToBad()>=fBadChDist[idist] &&
                           mix1ph->DistToBad()>=fBadChDist[idist] ){
 
+                          Double_t pi0gammapt=(vpi0+vmixph).Pt();
+                          Double_t pi0gammamass=(vpi0+vmixph).M();
 		 	  //fill the histograms
 			  fMixAOmega[index]->Fill(pi0gammapt,pi0gammamass);
                           if(pi0asy<0.7)fMixAOmega1[index]->Fill(pi0gammapt,pi0gammamass);
@@ -648,13 +626,6 @@ void AliAnaOmegaToPi0Gamma::MakeAnalysisFillHistograms()
 		    
                     Double_t pi0gammapt=(vph1+vph2+vph3).Pt();
                     Double_t pi0gammamass=(vph1+vph2+vph3).M(); 
-                    Double_t pi0OverOmegaPtRatio =(vph1+vph2).Pt()/pi0gammapt;
-                    Double_t gammaOverOmegaPtRatio= vph3.Pt()/pi0gammapt;
-
-                   //pi0, gamma pt cut             
-                   if(pi0OverOmegaPtRatio>fPi0OverOmegaPtCut ||
-                       gammaOverOmegaPtRatiofPi0OverOmegaPtCut ||
-                          gammaOverOmegaPtRatioDivide(2, 2);
 
   cvsIVM->cd(1);
-  char dec[128];
-  sprintf(dec,"h2Real_%s",fInputAODGammaName.Data());
-  TH2F * h2Real= (TH2F*)fRealOmega[0]->Clone(dec);
+  TH2F * h2Real= new TH2F(*fRealOmega[0]);
   h2Real->GetXaxis()->SetRangeUser(4,6);
   TH1F * hRealOmega = (TH1F*) h2Real->ProjectionY();
   hRealOmega->SetTitle("RealPi0Gamma 4Draw();
 
   cvsIVM->cd(2);
-  sprintf(dec,"hMixA_%s",fInputAODGammaName.Data());
-  TH2F *h2MixA= (TH2F*)fMixAOmega[0]->Clone(dec);
+  TH2F *h2MixA= new TH2F(*fMixAOmega[0]);
   h2MixA->GetXaxis()->SetRangeUser(4,6);
   TH1F * hMixAOmega = (TH1F*) h2MixA->ProjectionY();
   hMixAOmega->SetTitle("MixA 4Draw();
 
   cvsIVM->cd(3);
-  sprintf(dec,"hMixB_%s",fInputAODGammaName.Data());
-  TH2F * h2MixB= (TH2F*)fMixBOmega[0]->Clone(dec);
+  TH2F * h2MixB=new TH2F(*fMixBOmega[0]);
   h2MixB->GetXaxis()->SetRangeUser(4,6);
   TH1F * hMixBOmega = (TH1F*) h2MixB->ProjectionY();
   hMixBOmega->SetTitle("MixB 4Draw();
 
   cvsIVM->cd(4);
-  sprintf(dec,"hMixC_%s",fInputAODGammaName.Data());
-  TH2F *h2MixC= (TH2F*)fMixCOmega[0]->Clone(dec);
+  TH2F *h2MixC= new TH2F(*fMixCOmega[0]);
   h2MixC->GetXaxis()->SetRangeUser(4,6);
   TH1F * hMixCOmega = (TH1F*) h2MixC->ProjectionY();
   hMixCOmega->SetTitle("MixC 4SetRecEtaWindow(0.2);
+    js = AddTaskJetSpectrum2("jetsAOD_UA107","jetsAODMC_UA107",filterMask);
   }
+  js = AddTaskJetSpectrum2("jets","jetsAOD_FASTJET04",filterMask);
+  js = AddTaskJetSpectrum2("jetsAOD_FASTJET04","",filterMask);
+  js = AddTaskJetSpectrum2("jetsAOD_FASTKT04","",filterMask);
+  js = AddTaskJetSpectrum2("jetsAOD_UA107","",filterMask);
+  js->SetRecEtaWindow(0.2);
+
   return js;
 }
 
 
-AliAnalysisTaskJetSpectrum2 *AddTaskJetSpectrum2(char* bRec,char* bGen ,UInt_t filterMask,Int_t iPhysicsSelection)
+AliAnalysisTaskJetSpectrum2 *AddTaskJetSpectrum2(char* bRec,char* bGen ,UInt_t filterMask)
 {
 // Creates a jet fider task, configures it and adds it to the analysis manager.
 
@@ -82,7 +81,7 @@ AliAnalysisTaskJetSpectrum2 *AddTaskJetSpectrum2(char* bRec,char* bGen ,UInt_t f
        pwg4spec->SetTrackTypeGen(AliAnalysisTaskJetSpectrum2::kTrackAODOut);
      }
    }
-   if(iPhysicsSelection)pwg4spec->SelectCollisionCandidates();
+   pwg4spec->SelectCollisionCandidates();
 
    mgr->AddTask(pwg4spec);
      
diff --git a/PWG4/macros/AddTaskJets.C b/PWG4/macros/AddTaskJets.C
index 1bfbb718d7b..4d3f85b528b 100644
--- a/PWG4/macros/AddTaskJets.C
+++ b/PWG4/macros/AddTaskJets.C
@@ -58,9 +58,9 @@ Int_t AddTaskJetsDelta(char *nonStdFile,UInt_t filterMask,Bool_t kUseAODMC,UInt_
   Int_t iCount = 0;
 
   // Jet Fidners Selected by run flag first bit 2^0 second by 2^1 etc
-  const char *cJF[13]        = {"UA1","UA1","UA1","CDF","DA","SISCONE","FASTJET","FASTKT","UA1LO","FASTKT","FASTKT","FASTKT","FASTKT"};
-  const Float_t radius[13]   = {  0.4,  0.7,  1.0,  0.7, 0.7,      0.4,      0.4,     0.4,    0.7,    0.1 ,    0.2 ,    0.6 ,    0.8 };
-  UInt_t  flag[13]           = {    6,    7,    7,    7,   7,        7,        7,       7,      7,      7 ,      7 ,      7 ,      7 };
+  const char *cJF[9]        = {"UA1","UA1","UA1","CDF","DA","SISCONE","FASTJET","FASTKT","UA1LO"};
+  const Float_t radius[9]   = {  0.4,  0.7,  1.0,  0.7, 0.7,      0.4,      0.4,     0.4,    0.7};
+  UInt_t  flag[9]           = {    6,    7,    7,    7,   7,        7,        7,       7,      7};
   // flag[5] = 0; // set siscone to 0 for proof mode...
   // flag first bit AOD, second bit AODMC2 third bit AODMC2
   // i.e. 7 all, 6 only MC2 and MC
@@ -69,7 +69,7 @@ Int_t AddTaskJetsDelta(char *nonStdFile,UInt_t filterMask,Bool_t kUseAODMC,UInt_
 
   
 
-  for(int i = 0; i< 13;i++){
+  for(int i = 0; i< 9;i++){
     if(!(runFlag&(1<GetInputEventHandler()) {
-      ::Error("AddTaskKMeans", "This task requires an input event handler");
-      return NULL;
-   }
-
-   // Create the task and configure it.
-   //===========================================================================
-
-   AliAnalysisTaskKMeans *taskKMeans = new AliAnalysisTaskKMeans("K-Means Analysis");
-   taskKMeans->SetDebugLevel(0);
-   AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
-   esdTrackCutsL->SetMinNClustersTPC(50);
-   esdTrackCutsL->SetRequireTPCRefit(kTRUE);
-   esdTrackCutsL->SetRequireITSRefit(kTRUE);
-   esdTrackCutsL->SetMaxDCAToVertexXY(3.);
-   esdTrackCutsL->SetMaxDCAToVertexZ(3.);
-   esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);
-   taskKMeans->SetCuts(esdTrackCutsL);
-   mgr->AddTask(taskKMeans);
-
-   AliAnalysisDataContainer* cout_kmeans = mgr->CreateContainer("KMeans", TList::Class(),AliAnalysisManager::kOutputContainer,
-     Form("%s:PWG4_KMeans", AliAnalysisManager::GetCommonFileName()));
-
-   // 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
-   //==============================================================================
-   mgr->ConnectInput  (taskKMeans, 0, mgr->GetCommonInputContainer());
-   mgr->ConnectOutput (taskKMeans, 1, cout_kmeans);
-
-   return taskKMeans;
-}
diff --git a/PWG4/macros/AddTaskPWG4HighPtQAMC.C b/PWG4/macros/AddTaskPWG4HighPtQAMC.C
index 779ba62c3ad..249a9681259 100644
--- a/PWG4/macros/AddTaskPWG4HighPtQAMC.C
+++ b/PWG4/macros/AddTaskPWG4HighPtQAMC.C
@@ -1,8 +1,8 @@
 //DEFINITION OF A FEW CONSTANTS
 
-AliPWG4HighPtQAMC* AddTaskPWG4HighPtQAMC()
+AliPWG4HighPtQAMC* AddTaskPWG4HighPtQAMC()//)
 {
-  // Creates HighPtQAMC analysis task and adds it to the analysis manager.
+  // Creates a proton analysis task and adds it to the analysis manager.
   
   // A. Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
@@ -34,7 +34,7 @@ AliPWG4HighPtQAMC* AddTaskPWG4HighPtQAMC()
   trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCuts->SetPtRange(0.15, 1e10);//
-  trackCuts->SetMinNClustersTPC(70);//
+  trackCuts->SetMinNClustersTPC(50);//
   trackCuts->SetMaxChi2PerClusterTPC(3.5);//
   //trackCuts->SetRequireITSRefit(kTRUE);
   trackCuts->SetMaxDCAToVertexXY(2.4);
@@ -47,7 +47,7 @@ AliPWG4HighPtQAMC* AddTaskPWG4HighPtQAMC()
   trackCutsITS->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCutsITS->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCutsITS->SetPtRange(0.15, 1e10);//
-  trackCutsITS->SetMinNClustersTPC(70);//
+  trackCutsITS->SetMinNClustersTPC(50);//
   trackCutsITS->SetMaxChi2PerClusterTPC(3.5);//
   trackCutsITS->SetRequireITSRefit(kTRUE);
   trackCutsITS->SetMaxDCAToVertexXY(2.4);
diff --git a/PWG4/macros/AddTaskPWG4HighPtQATPConly.C b/PWG4/macros/AddTaskPWG4HighPtQATPConly.C
index 12791644dc4..420c57d9293 100644
--- a/PWG4/macros/AddTaskPWG4HighPtQATPConly.C
+++ b/PWG4/macros/AddTaskPWG4HighPtQATPConly.C
@@ -2,13 +2,13 @@
 
 AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//)
 {
-  // Creates HighPtQATPConly analysis task and adds it to the analysis manager.
+  // Creates a proton analysis task and adds it to the analysis manager.
   
   // A. Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    Error("AddTaskPWG4HighPtQATPConly", "No analysis manager to connect to.");
+    Error("AddTaskPWG4HighPtSpectra", "No analysis manager to connect to.");
     return NULL;
   }  
 
@@ -16,7 +16,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//)
   //    manager. The availability of MC handler can also be checked here.
   //==============================================================================
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskPWG4HighPtQATPConly", "This task requires an input event handler");
+    ::Error("AddTaskPWG4HighPtTPConly", "This task requires an input event handler");
     return NULL;
   }  
   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
@@ -34,7 +34,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//)
   trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCuts->SetPtRange(0.15, 1e10);//
-  trackCuts->SetMinNClustersTPC(70);//
+  trackCuts->SetMinNClustersTPC(50);//
   trackCuts->SetMaxChi2PerClusterTPC(3.5);//
   //trackCuts->SetRequireITSRefit(kTRUE);
   trackCuts->SetMaxDCAToVertexXY(2.4);
@@ -47,7 +47,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//)
   trackCutsITS->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCutsITS->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCutsITS->SetPtRange(0.15, 1e10);//
-  trackCutsITS->SetMinNClustersTPC(70);//
+  trackCutsITS->SetMinNClustersTPC(50);//
   trackCutsITS->SetMaxChi2PerClusterTPC(3.5);//
   trackCutsITS->SetRequireITSRefit(kTRUE);
   trackCutsITS->SetMaxDCAToVertexXY(2.4);
@@ -58,8 +58,8 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//)
   AliPWG4HighPtQATPConly *taskPWG4QA = new AliPWG4HighPtQATPConly("AliPWG4HighPtQATPConly");
   taskPWG4QA->SetCuts(trackCuts);
   taskPWG4QA->SetCutsITS(trackCutsITS);
+  taskPWG4QA->SelectTrigger(AliAnalysisHelperJetTasks::kMB1); 
   
- 
   // E. 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
   //==============================================================================
@@ -73,7 +73,7 @@ AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//)
   AliAnalysisDataContainer *cout_hist1 = mgr->CreateContainer("qa_histsTPC", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
   AliAnalysisDataContainer *cout_hist2 = mgr->CreateContainer("qa_histsITS", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  
 
- 
+
   mgr->AddTask(taskPWG4QA);
 
   mgr->ConnectInput(taskPWG4QA,0,mgr->GetCommonInputContainer());
diff --git a/PWG4/macros/AddTaskPWG4HighPtSpectra.C b/PWG4/macros/AddTaskPWG4HighPtSpectra.C
index dbd38f1648b..f59823164d3 100644
--- a/PWG4/macros/AddTaskPWG4HighPtSpectra.C
+++ b/PWG4/macros/AddTaskPWG4HighPtSpectra.C
@@ -1,29 +1,14 @@
 //DEFINITION OF A FEW CONSTANTS
-const Float_t ptmin =  2.0 ;
-const Float_t ptmax =  50.0 ;
-const Float_t phimin = 0.;
-const Float_t phimax = 2.*TMath::Pi();
-const Float_t etamin = -0.9;
-const Float_t etamax = 0.9;
-const Float_t dcarmin = -0.2;
-const Float_t dcarmax = 0.2;
-const Float_t chi2TPCmin = 0.0;
-const Float_t chi2TPCmax = 3.5;
-
-const Float_t ptmin1 =  ptmin ;
-const Float_t ptmax1 =  10.0 ;
-const Float_t ptmin2 =  ptmax1 ;
-const Float_t ptmax2 =  20.0 ;
-const Float_t ptmin3 =  ptmax2 ;
-const Float_t ptmax3 =  ptmax ;
-
-const Int_t   mintrackrefsTPC = 1;
-const Int_t   mintrackrefsITS = 1;
-const Int_t   charge  = 1;
+const Double_t ptmin =  2.0 ;
+const Double_t ptmax =  100.0 ;
+
+const Int_t    mintrackrefsTPC = 1;
+const Int_t    mintrackrefsITS = 1;
+const Int_t    charge  = 1 ;
 
 AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//)
 {
-  // Creates HighPtSpectra analysis task and adds it to the analysis manager.
+  // Creates a HighPtSpectra analysis task and adds it to the analysis manager.
   
   // A. Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
@@ -37,7 +22,7 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//)
   //    manager. The availability of MC handler can also be checked here.
   //==============================================================================
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskPWG4HighPtSpectra", "This task requires an input event handler");
+    ::Error("AddTaskHighPtSpectra", "This task requires an input event handler");
     return NULL;
   }  
   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
@@ -45,77 +30,36 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//)
 
   // C. Create the task, add it to manager.
   //===========================================================================
- //CONTAINER DEFINITION
+  //CONTAINER DEFINITION
   Info("AliPWG4HighPtSpectra","SETUP CONTAINER");
   //the sensitive variables, their indices
-  UInt_t ipt   = 0;
-  UInt_t iphi  = 1;
-  UInt_t ieta  = 2;
-  UInt_t idcar = 3;
-  UInt_t ichi2TPC = 4;
-
+  UInt_t ipt = 0;
   //Setting up the container grid... 
-  UInt_t nstep = 5; //Steps/Modes for containers
+  UInt_t nstep = 5 ; //Steps/Modes for containers
   Int_t kStepReconstructed = 0;
   Int_t kStepReconstructedTPCOnly = 1;
   Int_t kStepSecondaries = 2;
   Int_t kStepMCtrackable = 3;
   Int_t kStepReconstructedMC = 4;
-  
-  const Int_t nvar   = 5; //number of variables on the grid:pt
-  const Int_t nbin11 = (int)(ptmax1-ptmin1);
-  const Int_t nbin12 = (int)((ptmax2-ptmin2)/2.)+nbin11;
-  const Int_t nbin13 = (int)((ptmax3-ptmin3)/5.)+nbin12;
-  const Int_t nbin1  = nbin13; //bins in pt 98 
-  const Int_t nbin2  =  18;//36; //bins in phi
-  const Int_t nbin3  =  9; //bins in eta
-  const Int_t nbin4  =  80; //bins in DCAR
-  const Int_t nbin5  =  35; //bins in Chi2/#NclusTPC
 
+  const Int_t nvar   = 1; //number of variables on the grid:pt
+  const Int_t nbin1  = 98; //bins in pt 98 
+ 
   //arrays for the number of bins in each dimension
   Int_t iBin[nvar];
   iBin[0]=nbin1;
-  iBin[1]=nbin2;
-  iBin[2]=nbin3;
-  iBin[3]=nbin4;
-  iBin[4]=nbin5;
-  
+
   //arrays for lower bounds :
   Double_t *binLim1=new Double_t[nbin1+1];
-  Double_t *binLim2=new Double_t[nbin2+1];
-  Double_t *binLim3=new Double_t[nbin3+1];
-  Double_t *binLim4=new Double_t[nbin4+1];
-  Double_t *binLim5=new Double_t[nbin5+1];
-
-  //values for bin lower bounds 
-  for(Int_t i=0; i<=nbin1; i++) {
-    if(i<=nbin11) binLim1[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;  
-    if(i<=nbin12 && i>nbin11) binLim1[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;  
-    if(i<=nbin13 && i>nbin12) binLim1[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;  
-  }
-  //  for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ;  
-  for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)phimin + (phimax-phimin)/nbin2*(Double_t)i ;
-  for(Int_t i=0; i<=nbin3; i++) binLim3[i]=(Double_t)etamin + (etamax-etamin)/nbin3*(Double_t)i ;  
-  for(Int_t i=0; i<=nbin4; i++) binLim4[i]=(Double_t)dcarmin + (dcarmax-dcarmin)/nbin4*(Double_t)i ;
-  for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)chi2TPCmin + (chi2TPCmax-chi2TPCmin)/nbin5*(Double_t)i ;
-  
-
-  AliCFContainer* containerPos = new AliCFContainer("containerPos","container for positive tracks",nstep,nvar,iBin);
-  //setting the bin limits
-  containerPos -> SetBinLimits(ipt,binLim1);
-  containerPos -> SetBinLimits(iphi,binLim2);
-  containerPos -> SetBinLimits(ieta,binLim3);
-  containerPos -> SetBinLimits(idcar,binLim4);
-  containerPos -> SetBinLimits(ichi2TPC,binLim5);
 
-  AliCFContainer* containerNeg = new AliCFContainer("containerNeg","container for negative tracks",nstep,nvar,iBin);
+  //values for bin lower bounds
+  for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ; 
+ 
+  //one "container" for MC
+  AliCFContainer* container = new AliCFContainer("container","container for tracks",nstep,nvar,iBin);
   //setting the bin limits
-  containerNeg -> SetBinLimits(ipt,binLim1);
-  containerNeg -> SetBinLimits(iphi,binLim2);
-  containerNeg -> SetBinLimits(ieta,binLim3);
-  containerNeg -> SetBinLimits(idcar,binLim4);
-  containerNeg -> SetBinLimits(ichi2TPC,binLim5);
-  
+  container -> SetBinLimits(ipt,binLim1);
+ 
   //CREATE THE  CUTS -----------------------------------------------
   //Use AliESDtrackCuts
   AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
@@ -125,16 +69,16 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//)
   trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
   trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
   trackCuts->SetPtRange(0.15, 1e10);//
-  trackCuts->SetMinNClustersTPC(70);//
+  trackCuts->SetMinNClustersTPC(50);//
   trackCuts->SetMaxChi2PerClusterTPC(3.5);//
   trackCuts->SetRequireITSRefit(kTRUE);
   trackCuts->SetMaxDCAToVertexXY(2.4);
   trackCuts->SetMaxDCAToVertexZ(3.2);
   trackCuts->SetDCAToVertex2D(kTRUE);
-
- // Gen-Level kinematic cuts
+ 
+  // Gen-Level kinematic cuts
   AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
-  mcKineCuts->SetPtRange(0.15,1e10);
+  mcKineCuts->SetPtRange(0.15,1e10); 
   mcKineCuts->SetRapidityRange(-0.9,0.9);//-0.5,0.5);
   mcKineCuts->SetRequireIsCharged(kTRUE);
 
@@ -155,29 +99,19 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//)
 
   //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
   printf("CREATE INTERFACE AND CUTS\n");
-  AliCFManager* manPos = new AliCFManager("manPos","Manager for Positive tracks") ;
-  manPos->SetParticleContainer(containerPos);
-  manPos->SetParticleCutsList(0,recList);
-  manPos->SetParticleCutsList(1,recTPConlyList);
-  manPos->SetParticleCutsList(2,secList);
-  manPos->SetParticleCutsList(3,mcList);
-  manPos->SetParticleCutsList(4,recMCList);
-
-  AliCFManager* manNeg = new AliCFManager("manNeg","Manager for Negative tracks") ;
-  manNeg->SetParticleContainer(containerNeg);
-  manNeg->SetParticleCutsList(0,recList);
-  manNeg->SetParticleCutsList(1,recTPConlyList);
-  manNeg->SetParticleCutsList(2,secList);
-  manNeg->SetParticleCutsList(3,mcList);
-  manNeg->SetParticleCutsList(4,recMCList);
-
-
-  printf("Create task AliPWG4HighPtSpectra\n");
+  AliCFManager* man = new AliCFManager() ;
+  man->SetParticleContainer(container);
+  man->SetParticleCutsList(0,recList);
+  man->SetParticleCutsList(1,recTPConlyList);
+  man->SetParticleCutsList(2,secList);
+  man->SetParticleCutsList(3,mcList);
+  man->SetParticleCutsList(4,recMCList);
+
+
   AliPWG4HighPtSpectra *taskPWG4HighPtSpectra = new AliPWG4HighPtSpectra("taskPWG4HighPtSpectra");
   taskPWG4HighPtSpectra->SetCuts(trackCuts);
-  taskPWG4HighPtSpectra->SetCFManagerPos(manPos); //here is set the CF manager
-  taskPWG4HighPtSpectra->SetCFManagerNeg(manNeg); //here is set the CF manager
-
+  taskPWG4HighPtSpectra->SetCFManager(man); //here is set the CF manager
+  taskPWG4HighPtSpectra->SelectTrigger(AliAnalysisHelperJetTasks::kMB1); 
 
   // E. 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
@@ -188,18 +122,14 @@ AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//)
 //  char *outputfile = "outputAliPWG4HighPtSpectraTestTrain.root";
   TString outputfile = AliAnalysisManager::GetCommonFileName();
   outputfile += ":PWG4_HighPtSpectra"; 
-  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0HighPtSpectra", TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0HighPtSpectra", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
-  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("ccontainer1HighPtSpectra", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
-
-
+  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0", TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+ 
   mgr->AddTask(taskPWG4HighPtSpectra);
 
   mgr->ConnectInput(taskPWG4HighPtSpectra,0,mgr->GetCommonInputContainer());
   mgr->ConnectOutput(taskPWG4HighPtSpectra,0,coutput0);
   mgr->ConnectOutput(taskPWG4HighPtSpectra,1,coutput1);
-  mgr->ConnectOutput(taskPWG4HighPtSpectra,2,coutput2);
-
 
   // Return task pointer at the end
   return taskPWG4HighPtSpectra;
diff --git a/PWG4/macros/AddTaskPartCorr.C b/PWG4/macros/AddTaskPartCorr.C
index d20c4cf71bb..88cb238db64 100644
--- a/PWG4/macros/AddTaskPartCorr.C
+++ b/PWG4/macros/AddTaskPartCorr.C
@@ -73,16 +73,16 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   AliFiducialCut * fidCut1stYear = new AliFiducialCut();
   fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
   if(kSimulation){
-    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
-    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
-    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
-    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+		fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+		fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+		fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+		fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
   } 
   else{
-    fidCut1stYear->DoEMCALFiducialCut(kFALSE) ;
-    fidCut1stYear->DoPHOSFiducialCut(kFALSE) ;
+		fidCut1stYear->DoEMCALFiducialCut(kFALSE) ;
+		fidCut1stYear->DoPHOSFiducialCut(kFALSE) ;
   }	
-  
+	
 //  AliFiducialCut * fidCut = new AliFiducialCut();
 //  fidCut->DoCTSFiducialCut(kFALSE) ;
 //  fidCut->DoEMCALFiducialCut(kTRUE) ;
@@ -95,8 +95,8 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   else  qa->SwitchOffDataMC() ;
   qa->AddToHistogramsName("AnaCaloQA_");
   if(kSimulation){
-    qa->SetFiducialCut(fidCut1stYear);
-    qa->SwitchOnFiducialCut();
+	  qa->SetFiducialCut(fidCut1stYear);
+	  qa->SwitchOnFiducialCut();
   }
   if(qa=="PHOS") qa->SetNumberOfModules(3); //PHOS first year
   else  qa->SetNumberOfModules(4); //EMCAL first year
@@ -104,12 +104,12 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   qa->SetHistoPtRangeAndNBins(0, 50, 500) ;
   qa->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
   if(calorimeter == "PHOS"){
-    qa->SetHistoEtaRangeAndNBins(-0.13, 0.13, 100) ;
-    qa->SetHistoPhiRangeAndNBins(250*TMath::DegToRad(), 330*TMath::DegToRad() , 200) ;
+	  qa->SetHistoEtaRangeAndNBins(-0.13, 0.13, 100) ;
+	  qa->SetHistoPhiRangeAndNBins(250*TMath::DegToRad(), 330*TMath::DegToRad() , 200) ;
   }
   else if(calorimeter == "EMCAL"){
-    qa->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
-    qa->SetHistoPhiRangeAndNBins(70*TMath::DegToRad(), 130*TMath::DegToRad(), 200) ;
+	  qa->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
+	  qa->SetHistoPhiRangeAndNBins(70*TMath::DegToRad(), 130*TMath::DegToRad(), 200) ;
   }
   qa->SetHistoMassRangeAndNBins(0., 0.6, 300) ;
   qa->SetHistoAsymmetryRangeAndNBins(0., 1. , 25) ;
@@ -127,6 +127,8 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   // --------------------
   // --- Pi0 Analysis ---
   // --------------------
+	
+	
 
   AliAnaPhoton *anaphoton1 = new AliAnaPhoton();
   anaphoton1->SetDebug(-1); //10 for lots of messages
@@ -182,7 +184,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   
   AliAnaPhoton *anaphoton2 = new AliAnaPhoton();
   anaphoton2->SetDebug(-1); //10 for lots of messages
-  anaphoton2->SetMinPt(0.);
+  anaphoton2->SetMinPt(2);
   anaphoton2->SetCaloPID(pid);
   anaphoton2->SetCalorimeter(calorimeter);
   if(kUseKinematics) anaphoton2->SwitchOnDataMC() ;//Access MC stack and fill more histograms
@@ -211,7 +213,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   
   AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
   anaisol->SetDebug(-1);
-  anaisol->SetMinPt(0);
+  anaisol->SetMinPt(2);
   anaisol->SetInputAODName(Form("Photons%s",calorimeter.Data()));
   anaisol->SetCalorimeter(calorimeter);
   if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
@@ -317,7 +319,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
   anapi0ebe->SetDebug(-1);//10 for lots of messages
   anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
-  anapi0ebe->SetMinPt(0);
+  anapi0ebe->SetMinPt(2);
   anapi0ebe->SetCalorimeter(calorimeter);
   anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
   anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
@@ -333,7 +335,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   
   AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
   anaisolpi0->SetDebug(-1);
-  anaisolpi0->SetMinPt(0);
+  anaisolpi0->SetMinPt(2);
   anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
   anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
   anaisolpi0->SetCalorimeter(calorimeter);
@@ -409,29 +411,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
   if(kPrintSettings) anacorrhadronisopi0->Print("");
- 
-  //analysis the omega->pi0+gamma
-  AliAnaOmegaToPi0Gamma *anaomegaToPi0Gamma = new AliAnaOmegaToPi0Gamma();
-  anaomegaToPi0Gamma->SetDebug(-1);//10 for lots of messages
-  anaomegaToPi0Gamma->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
-  anaomegaToPi0Gamma->SetInputAODPhotonName(Form("Photons%s",calorimeter.Data()));
-  anaomegaToPi0Gamma->SetNPID(2);
-  anaomegaToPi0Gamma->SetNVtxZ(2);
-  anaomegaToPi0Gamma->SetNBadChDist(3);
-  anaomegaToPi0Gamma->SetNEventsMixed(4);
-  if(calorimeter.Data()=="PHOS")
-           anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.008); // PHOS
-  else if(calorimeter.Data()=="EMCAL")
-           anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.012); // EMCAL 
-  anaomegaToPi0Gamma->SetHistoPtRangeAndNBins(0, 20, 200) ;
-  anaomegaToPi0Gamma->SetHistoMassRangeAndNBins(0, 1, 200) ;
-  anaomegaToPi0Gamma->SetPi0OverOmegaPtCut(0.8);
-  anaomegaToPi0Gamma->SetGammaOverOmegaPtCut(0.2);
-  if(kUseKinematics) anaomegaToPi0Gamma->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else anaomegaToPi0Gamma->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-  anaomegaToPi0Gamma->AddToHistogramsName(Form("AnaOmegaToPi0Gamma%s_",calorimeter.Data()));
-  anaomegaToPi0Gamma->Print("");
- 
+  
   // #### Configure Maker ####
   AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
   maker->SetReader(reader);//pointer to reader
@@ -447,8 +427,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   maker->AddAnalysis(anaisolpi0,9);
   maker->AddAnalysis(anacorrhadronpi0,10);
   maker->AddAnalysis(anacorrhadronisopi0,11);
-  maker->AddAnalysis(anaomegaToPi0Gamma,12);  
- 
+  
   maker->SetAnaDebug(-1)  ;
   maker->SwitchOnHistogramsMaker()  ;
   maker->SwitchOnAODsMaker()  ;
diff --git a/PWG4/macros/AddTaskTaggedPhotons.C b/PWG4/macros/AddTaskTaggedPhotons.C
deleted file mode 100644
index 2a9fbb7fa3c..00000000000
--- a/PWG4/macros/AddTaskTaggedPhotons.C
+++ /dev/null
@@ -1,42 +0,0 @@
-AliAnalysisTaskTaggedPhotons* AddTaskTaggedPhotons(Bool_t bPHOS = kFALSE)
-{
-  // Creates an tagged photons task, 
-  // configures it and adds it to the analysis manager.
-
-  // Get the pointer to the existing analysis manager via the static access method.
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
-    ::Error("AddTaskTaggedPhotons", "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("AddTaskTaggedPhotons", "This task requires an input event handler");
-    return NULL;
-  }
-  
-  // Add task
-  
-  TString det;
-  if(bPHOS)det = "PHOS";
-  else det = "EMCAL";
-  
-  AliAnalysisTaskTaggedPhotons * task = new AliAnalysisTaskTaggedPhotons(Form("Tagged%s",det.Data()));
-  task->SetPHOS(bPHOS);
-  mgr->AddTask(task);
-
-
-
-  TString outputfile = AliAnalysisManager::GetCommonFileName();                                                              
-  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("tagged%s",det.Data()), TList::Class(),
-							    AliAnalysisManager::kOutputContainer, Form("%s:PWG4_tagged%s",outputfile.Data(),det.Data()));
-  mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
-  mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
-
-  mgr->ConnectOutput (task,    1, coutput2 );
-  
-  return task;
-}
-
-
diff --git a/PWG4/macros/AddTaskomega3pi.C b/PWG4/macros/AddTaskomega3pi.C
index a0987c89248..f5311a7b13c 100644
--- a/PWG4/macros/AddTaskomega3pi.C
+++ b/PWG4/macros/AddTaskomega3pi.C
@@ -26,7 +26,7 @@ AliAnalysisTaskOmegaPi0PiPi* AddTaskomega3pi()
 
 
   TString outputfile = AliAnalysisManager::GetCommonFileName();
-  AliAnalysisDataContainer *coutput = mgr->CreateContainer("omega3pi", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PWG4_omega3pi",outputfile.Data()));
+  AliAnalysisDataContainer *coutput = mgr->CreateContainer("PWG4_omega3pi", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:omega3pi",outputfile.Data()));
   
   // Connect input/output
   mgr->ConnectInput(omegaTask, 0, cinput);
diff --git a/PWG4/macros/AnalysisTrainPWG4Jets.C b/PWG4/macros/AnalysisTrainPWG4Jets.C
index 0e14f0b0510..6aa0b21fdd7 100644
--- a/PWG4/macros/AnalysisTrainPWG4Jets.C
+++ b/PWG4/macros/AnalysisTrainPWG4Jets.C
@@ -62,7 +62,6 @@ Bool_t      kSaveTrain          = kFALSE;  // save train configuration as:
 //==============================================================================
 Int_t       iJETAN             = 1;      // Jet analysis (PWG4) // 1 write standard 2 write non-standard jets, 3 wrtie both
 Int_t       iDIJETAN           = 1;
-Int_t       iJETANLib          = 1;
 Int_t       iPWG1QASym         = 0;      // Eva's QA task compiled on the fly...
 Int_t       iPWG4JetTasks      = 0;      // all jet tasks flag for lib laoding
 Int_t       iPWG4JetServices   = 0;      // jet spectrum analysis
@@ -73,14 +72,11 @@ Int_t       iPWG4PtQAMC        = 0;      // Marta's QA tasks
 Int_t       iPWG4PtSpectra     = 0;      // Marta's QA tasks 
 Int_t       iPWG4PtQATPC       = 0;      // Marta's QA tasks 
 Int_t       iPWG4ThreeJets     = 0;      // Sona's thrust task
-Int_t       iPWG4KMeans        = 0;      // Andreas' KMeans task 
-Int_t       iPWG4PartCorrLibs  = 0;      // Gustavo's part corr analysis
 Int_t       iPWG4PartCorr      = 0;      // Gustavo's part corr analysis
-Int_t       iPWG4Tagged        = 0;      // Gustavo's part corr analysis
 Int_t       iPWG4omega3pi      = 0;      // Omega to 3 pi analysis (PWG4) 
 Int_t       iPWG4GammaConv     = 0;      // Gamma Conversio
 Int_t       kHighPtFilterMask  = 16;     // change depending on the used AOD Filter
-TString     kDeltaAODJetName   = "AliAOD.Jets.root";     
+TString     kDeltaAODJetName   = "AliAOD.Jet.root";     
 TString     kDeltaAODPartCorrName   = "deltaAODPartCorr.root";     
 
 
@@ -189,9 +185,7 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
    printf(":: use PWG4 Pt Spectra   %d\n",iPWG4PtSpectra);
    printf(":: use PWG4 Pt QA TPC    %d\n",iPWG4PtQATPC);     
    printf(":: use PWG4 Three Jets   %d\n",iPWG4ThreeJets);
-   printf(":: use PWG4 KMeans       %d\n",iPWG4KMeans);
    printf(":: use PWG4 Part Corr    %d\n",iPWG4PartCorr);
-   printf(":: use PWG4 Tagged       %d\n",iPWG4Tagged);
    printf(":: use PWG4 omega to 3 pions %d\n",iPWG4omega3pi);
 
    printf(":: use PWG4 Gamma Conv   %d\n",iPWG4GammaConv);
@@ -228,8 +222,6 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
    // AOD input handler
       AliAODInputHandler *aodH = new AliAODInputHandler();
       mgr->SetInputEventHandler(aodH);
-      if (iPWG4JetTasks) aodH->AddFriend(Form("deltas/%s",kDeltaAODJetName.Data()));
-      if (iPWG4PartCorr) aodH->AddFriend(Form("deltas/%s"kDeltaAODJetName.Data()));
    } else {   
    // ESD input handler
       AliESDInputHandler *esdHandler = new AliESDInputHandler();
@@ -304,12 +296,7 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
       gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJets.C");
       AliAnalysisTaskJets *taskjets = 0;
       if(iJETAN&1)taskjets = AddTaskJets(kHighPtFilterMask); 
-      if(iJETAN&2){
-	UInt_t selection = 0;
-	if(!kFillAOD) selection = 0xffffff;
-	else selection = 1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9;
-	AddTaskJetsDelta(kDeltaAODJetName.Data(),kHighPtFilterMask,kUseAODMC,selection); 
-      }
+      if(iJETAN&2)AddTaskJetsDelta(kDeltaAODJetName.Data(),kHighPtFilterMask,kUseAODMC,0xfffffff); 
       if (!taskjets) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED");
    }
 
@@ -344,35 +331,17 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
      if(kGridRunRange[0]>0)taskjetServ->SetRunRange(kGridRunRange[0],kGridRunRange[1]);
      else taskjetServ->SetRunRange(104000,105000);
      if(!kIsMC) taskjetServ->SetRealData(kTRUE);
-     if(!iPhysicsSelection)taskjetServ->SetUsePhysicsSelection(kFALSE);
    }
 
 
    if(iPWG4JetSpectrum){
      gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetSpectrum2.C");
      AliAnalysisTaskJetSpectrum2 *taskjetSpectrum = 0;
-     if(iPWG4JetSpectrum&1){
-       taskjetSpectrum = AddTaskJetSpectrum2("jets","",kHighPtFilterMask,iPhysicsSelection);      
-       if(!iAODanalysis){
-	 taskjetSpectrum = AddTaskJetSpectrum2("jets","tracks32",32,iPhysicsSelection);       // tmp hack to give it a different name
-	 taskjetSpectrum = AddTaskJetSpectrum2("jets","tracks64",64,iPhysicsSelection);      
-       }
-     }
+     if(iPWG4JetSpectrum&1)taskjetSpectrum = AddTaskJetSpectrum2("jets","",kHighPtFilterMask);      
      if (!taskjetSpectrum) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJetSpectrum2 cannot run for this train conditions - EXCLUDED");
-     if(iPWG4JetSpectrum&2){
-       UInt_t selection = 0;
-       if(!iAODanalysis) selection = 0xffffff;
-       else selection = 1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<7|1<<8|1<<9;
-       AddTaskJetSpectrum2Delta(kHighPtFilterMask,kUseAODMC,iPhysicsSelection,selection);
-     }
-     if(iJETAN&3&&!kFillAOD&!iAODanalysis){
-       AddTaskJetSpectrum2("jetsAOD_FASTKT01","",kHighPtFilterMask,iPhysicsSelection);
-       AddTaskJetSpectrum2("jetsAOD_FASTKT02","",kHighPtFilterMask,iPhysicsSelection);
-       AddTaskJetSpectrum2("jetsAOD_FASTKT06","",kHighPtFilterMask,iPhysicsSelection);
-       AddTaskJetSpectrum2("jetsAOD_FASTKT08","",kHighPtFilterMask,iPhysicsSelection);
-     }
+     if(iPWG4JetSpectrum&2)AddTaskJetSpectrum2Delta(kHighPtFilterMask,kUseAODMC);
      if(kUseMC)taskjetSpectrum->SetAnalysisType( AliAnalysisTaskJetSpectrum2::kAnaMCESD);
-     taskjetSpectrum->SetDebugLevel(0);
+     taskjetSpectrum->SetDebugLevel(1);
    }
 
    if(iPWG4UE){
@@ -416,12 +385,6 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
      if (!taskPtSpectra) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskPtSpectra cannot run for this train conditions - EXCLUDED");
    }
 
-   if(iPWG4KMeans){
-     gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskKMeans.C");
-     AliAnalysisTaskKMeans *taskKMeans = AddTaskKMeans();
-     if (!taskKMeans) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskKMenans cannot run for this train conditions - EXCLUDED");
-   }
-
    if(iPWG4PartCorr){
      gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPartCorr.C");
      AliAnalysisTaskParticleCorrelation *taskpartcorrPHOS = AddTaskPartCorr("AOD", "PHOS",kUseMC,kFALSE,kIsMC);
@@ -431,13 +394,6 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
      if(kDeltaAODPartCorrName.Length()>0)mgr->RegisterExtraFile(kDeltaAODPartCorrName.Data()); // hmm this is written anyway.... but at least we do not register it...
    } 
 
-   if(iPWG4Tagged){
-     gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskTaggedPhotons.C");
-     AliAnalysisTaskTaggedPhotons * taskTagged = AddTaskTaggedPhotons(kFALSE); // EMCAL
-     //     taskTagged = AddTaskTaggedPhotons(kTRUE); // PHOS 
-     if (!taskTagged) ::Warning("AnalysisTrainNew", "AliAnalysisTaskTaggedPhotons  cannot run for this train conditions - EXCLUDED");     
-   }
-
    if (iPWG4omega3pi) {
      gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C");
      AliAnalysisTaskOmegaPi0PiPi *taskomega3pi = AddTaskomega3pi();
@@ -452,7 +408,7 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
       TString cdir = gSystem->WorkingDirectory();
       gSystem->ChangeDirectory(gSystem->ExpandPathName("$ALICE_ROOT/PWG4/macros/"));
       //      TString gcArguments = "-run-on-train -run-jet -run-chic -run-neutralmeson -run-cf";
-      TString gcArguments = "-run-on-train -run-jet -run-neutralmeson -run-cf -use-own-xyz -bg-off";
+      TString gcArguments = "-run-on-train -run-jet -run-neutralmeson -run-cf -use-own-xyz";
       if(!kIsMC)gcArguments += " -mc-off";
       AliAnalysisTaskGammaConversion * taskGammaConversion = AddTaskGammaConversion(gcArguments,mgr->GetCommonInputContainer());
       gSystem->ChangeDirectory(cdir);
@@ -607,18 +563,15 @@ void CheckModuleFlags(const char *mode) {
       iPWG4PtQATPC        = 0;
       if( iPWG4PtSpectra)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 PtQAMC disabled in analysis on AOD's");
       iPWG4PtSpectra     = 0;
-      if(iPWG4KMeans)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4KMeans disabled on AOD's");
-      iPWG4KMeans       = 0;
       if (iPWG4PartCorr)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4partcorr disabled on AOD's");
       iPWG4PartCorr = 0;
-      if (iPWG4Tagged)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4tagged disabled on AOD's");
-      iPWG4Tagged = 0;
       if (iPWG4omega3pi)
 	::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4omega3pi disabled on AOD's");
       iPWG4omega3pi = 0;
       if(iPWG1QASym)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG1 QA Sym disabled in analysis on AOD's");
       if (iPWG4GammaConv)::Info("AnalysisPWG4Jets.C::CheckModuleFlags", "PWG4gammaconv disabled on AOD's");
       iPWG4GammaConv = 0;   
+
       iPWG1QASym     = 0;
    } else {   
    // ESD analysis
@@ -646,8 +599,7 @@ void CheckModuleFlags(const char *mode) {
       }
    }
    iPWG4JetTasks = iPWG4JetServices||iPWG4JetSpectrum||iPWG4UE||iPWG4PtQAMC||iPWG4PtSpectra||iPWG4PtQATPC||iPWG4ThreeJets;
-   iPWG4PartCorrLibs = iPWG4PartCorr||iPWG4Tagged;
-   iJETANLib = iPWG4JetTasks||iJETAN||iDIJETAN;
+
    if (iESDfilter) {iAODhandler=1;}
    if (kUseKinefilter && !kUseMC) kUseKinefilter = kFALSE;
    if (kUseAODTags && !iAODhandler) kUseAODTags = kFALSE;
@@ -811,9 +763,7 @@ Bool_t LoadAnalysisLibraries(const char *mode)
           !LoadLibrary("PWG3muon", mode, kTRUE)) return kFALSE;
    }   
    // JETAN
-   if (iJETANLib) {
-     // this part needs some rework in case we do not need the fastjed finders for processing
-     if (!LoadLibrary("JETAN", mode, kTRUE)) return kFALSE;
+   if (iJETAN||iDIJETAN) {
      if (!strcmp(mode, "PROOF")){
        gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libCGAL.so\"\)", kTRUE); 
        gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libfastjet.so\"\)", kTRUE); 
@@ -821,7 +771,8 @@ Bool_t LoadAnalysisLibraries(const char *mode)
        // gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libsiscone.so\"\)", kTRUE); 
        gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libSISConePlugin.so\"\)", kTRUE);      
      }
-     if(!kUsePAR){ 
+     if (!LoadLibrary("JETAN", mode, kTRUE)) return kFALSE;
+     if(!kUsePAR){
        if (!LoadLibrary("CGAL", mode, kTRUE)) return kFALSE;
        if (!LoadLibrary("fastjet", mode, kTRUE)) return kFALSE;
        if (!LoadLibrary("siscone", mode, kTRUE)) return kFALSE;
@@ -848,7 +799,7 @@ Bool_t LoadAnalysisLibraries(const char *mode)
      //  gSystem->AddIncludePath("-I$ALICE_ROOT/include/JetTasks"); // ugly hack!!
      if(!LoadSource(Form("%s/PWG4/JetTasks/AliAnalysisTaskEta.cxx",gSystem->ExpandPathName("$ALICE_ROOT")), mode, kTRUE))return kFALSE;
    }
-   if (iPWG4PartCorrLibs) {   
+   if (iPWG4PartCorr) {   
       if (!LoadLibrary("EMCALUtils", mode, kTRUE) ||
           !LoadLibrary("PHOSUtils", mode, kTRUE) ||
           !LoadLibrary("PWG4PartCorrBase", mode, kTRUE) ||
@@ -965,13 +916,13 @@ Bool_t LoadSource(const char *source, const char *mode, Bool_t rec=kFALSE)
      Printf("LoadSources:: Loading...  path %s",basename.Data());
      switch (imode) {
      case 0:
-       result = gROOT->LoadMacro(Form("%s.cxx++g",basename.Data()));
+       result = gROOT->LoadMacro(Form("%s.cxx+g",basename.Data()));
        break;
      case 1:
-       result = gProof->LoadMacro(Form("%s.cxx++g",basename.Data()));
+       result = gProof->LoadMacro(Form("%s.cxx+g",basename.Data()));
        break;
      case 2:
-       result = gROOT->LoadMacro(Form("%s.cxx++g",basename.Data()));
+       result = gROOT->LoadMacro(Form("%s.cxx+g",basename.Data()));
        if (rec){
 	 // what we want to compile
 	 anaSources += Form("%s.cxx ",basename.Data()); 
diff --git a/PWG4/macros/ConfigAnalysisOmegaToPi0Gamma.C b/PWG4/macros/ConfigAnalysisOmegaToPi0Gamma.C
index aebe6c67aad..251b5a2197f 100644
--- a/PWG4/macros/ConfigAnalysisOmegaToPi0Gamma.C
+++ b/PWG4/macros/ConfigAnalysisOmegaToPi0Gamma.C
@@ -1,3 +1,4 @@
+
 AliAnaPartCorrMaker*  ConfigAnalysis()
 {
 	//
@@ -7,13 +8,13 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
 	printf("ConfigAnalysis() \n");
 	printf("======================== \n");
 	
-	//Detector Fidutial Cuts
+	//Detector Fiducial Cuts
 	AliFiducialCut * fidCut = new AliFiducialCut();
-	fidCut->DoCTSFiducialCut(kTRUE) ;
+	fidCut->DoCTSFiducialCut(kFALSE) ;
 	fidCut->DoEMCALFiducialCut(kTRUE) ;
 	fidCut->DoPHOSFiducialCut(kTRUE) ;
 	
-	fidCut->SetSimpleCTSFiducialCut(0.9,0.,360.);
+	//fidCut->SetSimpleCTSFiducialCut(0.9,0.,360.);
 	fidCut->SetSimpleEMCALFiducialCut(0.7,80.,190.);
 	fidCut->SetSimplePHOSFiducialCut(0.12,220.,320.);
 	
@@ -28,14 +29,18 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
 	//Switch on or off the detectors information that you want
 	reader->SwitchOnPHOS();
 	reader->SwitchOnEMCAL();
-	reader->SwitchOnCTS();
+	reader->SwitchOffCTS();
 	
 	//Min particle pT
-	reader->SetEMCALPtMin(0.5); 
-	reader->SetPHOSPtMin(0.5);
-	reader->SetCTSPtMin(0.5);
+	reader->SetEMCALPtMin(0.2); 
+	reader->SetPHOSPtMin(0.2);
+	//reader->SetCTSPtMin(0.2);
 	
 	reader->SetFiducialCut(fidCut);
+		
+	//Remove the temporal AODs we create.	
+	reader->SwitchOnCleanStdAOD();	
+	
 	reader->Print("");
 	
 	
@@ -54,7 +59,7 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
 
 	AliAnaPhoton *anaphoton = new AliAnaPhoton();
         anaphoton->SetDebug(-1); //10 for lots of messages
-        anaphoton->SetMinPt(0.1);
+        anaphoton->SetMinPt(0.2);
         anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
         anaphoton->SetCaloPID(pid);
 //        anaphoton->SetFiducialCut(fidCut); //More acceptance selections if needed at this level
@@ -77,41 +82,44 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
 	// >>> Second Analysis <<<
 	
 	AliNeutralMesonSelection *nms = new AliNeutralMesonSelection();
-	nms->SetInvMassCutRange(0.11, 0.16)	;
+	nms->SetInvMassCutRange(0.1, 0.17)	;
 	nms->KeepNeutralMesonSelectionHistos(kTRUE);
 	//Set Histrograms bins and ranges
+	nms->SetHistoERangeAndNBins(0, 50, 100) ;
+	nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
+	nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
+	nms->SetHistoIMRangeAndNBins(0, 0.4, 100) ;  
 
-	AliAnaPi0EbE *anapi0EbE = new AliAnaPi0EbE();
-	anapi0EbE->SetDebug(-1);//10 for lots of messages
-	anapi0EbE->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
-	anapi0EbE->SetInputAODName("PhotonsPHOS");
-	anapi0EbE->SetOutputAODName("Pi0sPHOS");
-	anapi0EbE->SetOutputAODClassName("AliAODPWG4Particle");
-	anapi0EbE->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-	anapi0EbE->SetNeutralMesonSelection(nms);
-	anapi0EbE->AddToHistogramsName("AnaPi0EbEPHOS_");
+	AliAnaPi0EbE *anapi0 = new AliAnaPi0EbE();
+	anapi0->SetDebug(-1);//10 for lots of messages
+	anapi0->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
+	anapi0->SetInputAODName("PhotonsPHOS");
+	anapi0->SetOutputAODName("Pi0sPHOS");
+	anapi0->SetOutputAODClassName("AliAODPWG4Particle");
+	anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
+	anapi0->SetNeutralMesonSelection(nms);
+	anapi0->AddToHistogramsName("AnaPi0EbEPHOS_");
 	//Set Histrograms bins and ranges
-
-	anapi0EbE->Print("");
+	anapi0->SetHistoPtRangeAndNBins(0, 50, 100) ;
+	anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+	anapi0->SetHistoEtaRangeAndNBins(-0.2, 0.2, 100) ;
+	anapi0->Print("");
 	
         AliAnaOmegaToPi0Gamma *anaomega = new AliAnaOmegaToPi0Gamma();
         anaomega->SetDebug(-1);//10 for lots of messages
         anaomega->SetInputAODName("Pi0sPHOS");
         anaomega->SetInputAODPhotonName("PhotonsPHOS");
-	anaomega->SetNPID(2);
-        anaomega->SetNVtxZ(2);
-        anaomega->SetNBadChDist(1);
+	anaomega->SetNPID(3);
         anaomega->SetNEventsMixed(4);
-        anaomega->SetPi0MassPeakWidthCut(0.008); //
-        anaomega->SetHistoPtRangeAndNBins(0, 10, 200) ;
-        anaomega->SetHistoMassRangeAndNBins(0, 1, 200) ;
-        anaomega->SetPi0OverOmegaPtCut(0.8);
-        anaomega->SetGammaOverOmegaPtCut(0.2);
+        anaomega->SetNPtBinsMinMax(200,0,20.);
+        anaomega->SetNMassBinsMinMas(200,0,1.);
+        anaomega->SetPi0MassPeakWidthCut(0.015);
         anaomega->SwitchOnFiducialCut();
-        anaomega->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-        anaomega->AddToHistogramsName("AnaOmegaToPi0GammaPHOS_");
+        anaomega->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+        anaomega->AddToHistogramsName("AnaNeuPHOS_");
         anaomega->Print("");
 
+
 //for EMCAL
         AliCaloPID * pid1 = new AliCaloPID();
         // use selection with simple weights
@@ -123,7 +131,7 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
 
         AliAnaPhoton *anaphoton1 = new AliAnaPhoton();
         anaphoton1->SetDebug(-1); //10 for lots of messages
-        anaphoton1->SetMinPt(0.1);
+        anaphoton1->SetMinPt(0.2);
         anaphoton1->SetMinDistanceToBadChannel(2, 4, 5);
         anaphoton1->SetCaloPID(pid);
         anaphoton1->SetCalorimeter("EMCAL");
@@ -141,41 +149,46 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
         anaphoton1->Print("");
 
 	AliNeutralMesonSelection *nms1 = new AliNeutralMesonSelection();
-        nms1->SetInvMassCutRange(0.11, 0.16)     ;
+        nms1->SetInvMassCutRange(0.1, 0.17)     ;
         nms1->KeepNeutralMesonSelectionHistos(kTRUE);
         //Set Histrograms bins and ranges
+        nms1->SetHistoERangeAndNBins(0, 50, 100) ;
+        nms1->SetHistoPtRangeAndNBins(0, 50, 100) ;
+        nms1->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
+        nms1->SetHistoIMRangeAndNBins(0, 0.4, 100) ;
 
-        AliAnaPi0EbE *anapi0EbEEbE1 = new AliAnaPi0EbE();
-        anapi0EbEEbE1->SetDebug(-1);//10 for lots of messages
-        anapi0EbEEbE1->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
-        anapi0EbEEbE1->SetInputAODName("PhotonsEMCAL");
-        anapi0EbEEbE1->SetOutputAODName("Pi0sEMCAL");
-        anapi0EbEEbE1->SetOutputAODClassName("AliAODPWG4Particle");
-        anapi0EbEEbE1->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-        anapi0EbEEbE1->SetNeutralMesonSelection(nms1);
-        anapi0EbEEbE1->AddToHistogramsName("AnaPi0EbEEMCAL_");
-        //Set Histrograms bins and ranges
-        anapi0EbEEbE1->Print("");
 
+        AliAnaPi0EbE *anapi01 = new AliAnaPi0EbE();
+        anapi01->SetDebug(-1);//10 for lots of messages
+        anapi01->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
+        anapi01->SetInputAODName("PhotonsEMCAL");
+        anapi01->SetOutputAODName("Pi0sEMCAL");
+        anapi01->SetOutputAODClassName("AliAODPWG4Particle");
+        anapi01->SwitchOffDataMC() ;//Access MC stack and fill more histograms
+        anapi01->SetNeutralMesonSelection(nms1);
+        anapi01->AddToHistogramsName("AnaPi0EbEEMCAL_");
+        //Set Histrograms bins and ranges
+        anapi01->SetHistoPtRangeAndNBins(0, 50, 100) ;
+        anapi01->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+        anapi01->SetHistoEtaRangeAndNBins(-0.8, 0.8, 100) ;
+        anapi01->Print("");
 
         AliAnaOmegaToPi0Gamma *anaomega1 = new AliAnaOmegaToPi0Gamma();
         anaomega1->SetDebug(-1);//10 for lots of messages
         anaomega1->SetInputAODName("Pi0sEMCAL");
         anaomega1->SetInputAODPhotonName("PhotonsEMCAL");
-        anaomega1->SetNPID(2);
-        anaomega1->SetNVtxZ(2);
-        anaomega1->SetNBadChDist(1);
+        anaomega1->SetNPID(3);
         anaomega1->SetNEventsMixed(4);
+        //anaomega1->SetNAsyBinsMinMax(200,0,1.);
+        anaomega1->SetNPtBinsMinMax(200,0,20.);
+        anaomega1->SetNMassBinsMinMas(200,0,1.);
         anaomega1->SetPi0MassPeakWidthCut(0.015);
-        anaomega1->SetHistoPtRangeAndNBins(0, 10, 200) ;
-        anaomega1->SetHistoMassRangeAndNBins(0, 1, 200) ;
-        anaomega1->SetPi0OverOmegaPtCut(0.8);
-        anaomega1->SetGammaOverOmegaPtCut(0.2);
         anaomega1->SwitchOnFiducialCut();
-        anaomega1->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-        anaomega1->AddToHistogramsName("AnaOmegaToPi0GammaEMCAL_");
+        anaomega1->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+        anaomega1->AddToHistogramsName("AnaNeuEMCAL_");
         anaomega1->Print("");
 
+
 	//---------------------------------------------------------------------
 	// Set  analysis algorithm and reader
 	//---------------------------------------------------------------------
@@ -183,12 +196,12 @@ AliAnaPartCorrMaker*  ConfigAnalysis()
 	maker->SetReader(reader);//pointer to reader
 	maker->SetAnaDebug(0);
 	maker->AddAnalysis(anaphoton,0);
-	maker->AddAnalysis(anapi0EbE,1);
+	maker->AddAnalysis(anapi0,1);
        	maker->AddAnalysis(anaomega,2);
 
         maker->AddAnalysis(anaphoton1,3);
-        maker->AddAnalysis(anapi0EbEEbE1,4);
-        maker->AddAnalysis(anaomega1,5);
+        maker->AddAnalysis(anapi01,4);
+       maker->AddAnalysis(anaomega1,5);
 
 	maker->SwitchOnHistogramsMaker()  ;
 	maker->SwitchOnAODsMaker()  ;
diff --git a/STEER/AliESDCaloCluster.cxx b/STEER/AliESDCaloCluster.cxx
index 4554b97fbe8..4c411ae4947 100644
--- a/STEER/AliESDCaloCluster.cxx
+++ b/STEER/AliESDCaloCluster.cxx
@@ -46,7 +46,6 @@ AliESDCaloCluster::AliESDCaloCluster() :
   fM20(0),
   fM02(0),
   fEmcCpvDistance(1024),
-  fTrackDx(1024),fTrackDz(1024),
   fDistToBadChannel(1024),
   fID(0),
   fNExMax(0),
@@ -76,8 +75,6 @@ AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
   fM20(clus.fM20),
   fM02(clus.fM02),
   fEmcCpvDistance(clus.fEmcCpvDistance),
-  fTrackDx(clus.fTrackDx),
-  fTrackDz(clus.fTrackDz),
   fDistToBadChannel(clus.fDistToBadChannel),
   fID(clus.fID),
   fNExMax(clus.fNExMax),
@@ -128,8 +125,6 @@ AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
   fM20 = source.fM20;
   fM02 = source.fM02;
   fEmcCpvDistance = source.fEmcCpvDistance;
-  fTrackDx= source.fTrackDx ;
-  fTrackDz= source.fTrackDz ;
   fDistToBadChannel = source.fDistToBadChannel ;
   for(Int_t i=0; iGetLabel();
-    if (flags==kTPCin)  {
-      fTPCInner=new AliExternalTrackParam(*t); 
-      fTPCnclsIter1=t->GetNumberOfClusters();    
-      fTPCchi2Iter1=t->GetChi2();
-    }
+    if (flags==kTPCin)  fTPCInner=new AliExternalTrackParam(*t);
     if (!fIp) fIp=new AliExternalTrackParam(*t);
     else 
       fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
@@ -2223,11 +2190,3 @@ void AliESDtrack::GetITSdEdxSamples(Double_t *s) const {
   //
   for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];
 }
-
-
-UShort_t   AliESDtrack::GetTPCnclsS(Int_t i0,Int_t i1) const{
-  //
-  // get number of shared clusters
-  //
-  return  fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
-}
diff --git a/STEER/AliESDtrack.h b/STEER/AliESDtrack.h
index 75336db72b1..5fae811c7ee 100644
--- a/STEER/AliESDtrack.h
+++ b/STEER/AliESDtrack.h
@@ -49,8 +49,7 @@ class AliESDtrack : public AliExternalTrackParam {
     kTOFin=0x1000,kTOFout=0x2000,kTOFrefit=0x4000,kTOFpid=0x8000,
     kHMPIDout=0x10000,kHMPIDpid=0x20000,
     kEMCALmatch=0x40000,
-    kPHOSmatch=0x200000,
-    kTRDbackup =0x80000,
+    kTRDbackup=0x80000,
     kTRDStop=0x20000000,
     kESDpid=0x40000000,
     kTIME=0x80000000,
@@ -204,12 +203,8 @@ class AliESDtrack : public AliExternalTrackParam {
      for (Int_t i=0;i<4;i++) fTPCPoints[i]=points[i];
   }
   void    SetTPCPointsF(UChar_t  findable){fTPCnclsF = findable;}
-  void    SetTPCPointsFIter1(UChar_t  findable){fTPCnclsFIter1 = findable;}
   UShort_t   GetTPCNcls() const { return fTPCncls;}
   UShort_t   GetTPCNclsF() const { return fTPCnclsF;}
-  UShort_t   GetTPCNclsIter1() const { return fTPCnclsIter1;}
-  UShort_t   GetTPCNclsFIter1() const { return fTPCnclsFIter1;}
-  UShort_t   GetTPCnclsS(Int_t i0=0,Int_t i1=159) const;
   Double_t GetTPCPoints(Int_t i) const {return fTPCPoints[i];}
   void    SetKinkIndexes(Int_t points[3]) {
      for (Int_t i=0;i<3;i++) fKinkIndexes[i] = points[i];
@@ -224,7 +219,6 @@ class AliESDtrack : public AliExternalTrackParam {
   Double_t GetTPCsignalSigma() const {return fTPCsignalS;}
   UShort_t GetTPCsignalN() const {return fTPCsignalN;}
   Double_t GetTPCchi2() const {return fTPCchi2;}
-  Double_t GetTPCchi2Iter1() const {return fTPCchi2Iter1;}
   UShort_t   GetTPCclusters(Int_t *idx) const;
   Double_t GetTPCdensity(Int_t row0, Int_t row1) const;
   Int_t   GetTPCLabel() const {return fTPCLabel;}
@@ -326,18 +320,10 @@ class AliESDtrack : public AliExternalTrackParam {
   Bool_t  IsPureITSStandalone() const {return fFlags&kITSpureSA;}
 
 
-  Int_t GetEMCALcluster() {return fCaloIndex;}
-  void SetEMCALcluster(Int_t index) {fCaloIndex=index;}
+  Int_t GetEMCALcluster() {return fEMCALindex;}
+  void SetEMCALcluster(Int_t index) {fEMCALindex=index;}
   Bool_t IsEMCAL() const {return fFlags&kEMCALmatch;}
 
-  Int_t GetPHOScluster() {return fCaloIndex;}
-  void SetPHOScluster(Int_t index) {fCaloIndex=index;}
-  Bool_t IsPHOS() const {return fFlags&kPHOSmatch;}
-  Double_t GetPHOSdx()const{return fCaloDx ;}
-  Double_t GetPHOSdz()const{return fCaloDz ;}
-  void SetPHOSdxdz(Double_t dx, Double_t dz){fCaloDx=dx,fCaloDz=dz;}
-
-
   void SetTrackPointArray(AliTrackPointArray *points) {
     fFriendTrack->SetTrackPointArray(points);
   }
@@ -398,7 +384,7 @@ class AliESDtrack : public AliExternalTrackParam {
   Int_t     fTOFindex;       // index of the assigned TOF cluster
   Int_t     fHMPIDqn;         // 1000000*number of photon clusters + QDC
   Int_t     fHMPIDcluIdx;     // 1000000*chamber id + cluster idx of the assigned MIP cluster
-  Int_t     fCaloIndex;       // index of associated EMCAL/PHOS cluster (AliESDCaloCluster)
+  Int_t     fEMCALindex;     // index of associated EMCAL cluster (AliESDCaloCluster)
 
 
   Int_t     fKinkIndexes[3]; // array of indexes of posible kink candidates 
@@ -431,7 +417,6 @@ class AliESDtrack : public AliExternalTrackParam {
 
   Double32_t   fITSchi2;        // [0.,0.,8] chi2 in the ITS
   Double32_t   fTPCchi2;        // [0.,0.,8] chi2 in the TPC
-  Double32_t   fTPCchi2Iter1;  // [0.,0.,8] chi2 in the TPC
   Double32_t   fTRDchi2;        // [0.,0.,8] chi2 in the TRD
   Double32_t   fTOFchi2;        // [0.,0.,8] chi2 in the TOF
   Double32_t fHMPIDchi2;        // [0.,0.,8] chi2 in the HMPID
@@ -456,9 +441,6 @@ class AliESDtrack : public AliExternalTrackParam {
   Double32_t fTOFsignalDx;    // local x  of track's impact on the TOF pad 
   Double32_t fTOFInfo[10];    //! TOF informations
 
-  Double32_t fCaloDx ;        // [0.,0.,8] distance to calorimeter cluster in calo plain (phi direction)
-  Double32_t fCaloDz ;        // [0.,0.,8] distance to calorimeter cluster in calo plain (z direction)
-
   Double32_t fHMPIDtrkX;       // x of the track impact, LORS 
   Double32_t fHMPIDtrkY;       // y of the track impact, LORS 
   Double32_t fHMPIDmipX;       // x of the MIP in LORS
@@ -468,8 +450,6 @@ class AliESDtrack : public AliExternalTrackParam {
   UShort_t fTPCncls;       // number of clusters assigned in the TPC
   UShort_t fTPCnclsF;      // number of findable clusters in the TPC
   UShort_t fTPCsignalN;    // number of points used for dEdx
-  UShort_t fTPCnclsIter1;  // number of clusters assigned in the TPC - iteration 1
-  UShort_t fTPCnclsFIter1; // number of findable clusters in the TPC - iteration 1
 
   Char_t  fITSncls;        // number of clusters assigned in the ITS
   UChar_t fITSClusterMap;  // map of clusters, one bit per a layer
@@ -487,7 +467,7 @@ class AliESDtrack : public AliExternalTrackParam {
  private:
 
   AliESDtrack & operator=(const AliESDtrack & );
-  ClassDef(AliESDtrack,56)  //ESDtrack 
+  ClassDef(AliESDtrack,54)  //ESDtrack 
 };
 
 
diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx
index 120c00f3b44..88c6f08632c 100644
--- a/STEER/AliReconstruction.cxx
+++ b/STEER/AliReconstruction.cxx
@@ -1495,6 +1495,7 @@ void AliReconstruction::SlaveBegin(TTree*)
   ftree = new TTree("esdTree", "Tree with ESD objects");
   fesd = new AliESDEvent();
   fesd->CreateStdContent();
+  if (fesd->GetESDRun()) ((AliESDRun*)fesd->GetESDRun())->SetBeamEnergyIsSqrtSHalfGeV();
   // add a so far non-std object to the ESD, this will
   // become part of the std content
   fesd->AddObject(new AliESDHLTDecision);
@@ -1520,6 +1521,7 @@ void AliReconstruction::SlaveBegin(TTree*)
   fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects");
   fhltesd = new AliESDEvent();
   fhltesd->CreateStdContent();
+  if (fhltesd->GetESDRun()) ((AliESDRun*)fhltesd->GetESDRun())->SetBeamEnergyIsSqrtSHalfGeV();
   // read the ESD template from CDB
   // HLT is allowed to put non-std content to its ESD, the non-std
   // objects need to be created before invocation of WriteToTree in
@@ -1697,9 +1699,6 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
     fesd->SetMagneticField(AliTracker::GetBz());
     fhltesd->SetMagneticField(AliTracker::GetBz());
     //
-    ((AliESDRun*)fesd->GetESDRun())->SetBeamEnergyIsSqrtSHalfGeV();
-    ((AliESDRun*)fhltesd->GetESDRun())->SetBeamEnergyIsSqrtSHalfGeV();
-    //
     AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
     if (fld) { // set info needed for field initialization
       fesd->SetCurrentL3(fld->GetCurrentSol());
diff --git a/T0/AliT0RawData.cxx b/T0/AliT0RawData.cxx
index 8e38d8939cc..5198958443a 100644
--- a/T0/AliT0RawData.cxx
+++ b/T0/AliT0RawData.cxx
@@ -143,7 +143,6 @@ AliT0RawData::~AliT0RawData()
   delete fADC1;
   delete fTimeLED;
   delete fADC0;
-  delete fFile;
 }
 
 //_____________________________________________________________________________
diff --git a/THijing/AliGenHijing.cxx b/THijing/AliGenHijing.cxx
index 1f825224b05..645b05da9ed 100644
--- a/THijing/AliGenHijing.cxx
+++ b/THijing/AliGenHijing.cxx
@@ -231,7 +231,6 @@ void AliGenHijing::Generate()
   fTrials = 0;
   
   for (j = 0;j < 3; j++) origin0[j] = fOrigin[j];
-
   if(fVertexSmear == kPerEvent) {
       Vertex();
       for (j=0; j < 3; j++) origin0[j] = fVertex[j];
@@ -239,7 +238,6 @@ void AliGenHijing::Generate()
 
 
   Float_t sign = (fRandomPz && (Rndm() < 0.5))? -1. : 1.;
-
   while(1)
   {
 //    Generate one event
@@ -369,12 +367,10 @@ void AliGenHijing::Generate()
 	      origin[0] = origin0[0]+iparticle->Vx()/10;
 	      origin[1] = origin0[1]+iparticle->Vy()/10;
 	      origin[2] = origin0[2]+iparticle->Vz()/10;
-	      if (TestBit(kVertexRange)) {
-		  tof = kconv * iparticle->T() + sign * origin0[2] / 2.99792458e10;
-	      } else {
-		  tof = kconv * iparticle->T();
-		  if (fPileUpTimeWindow > 0.) tof += tInt;
-	      }
+//	      tof = kconv * iparticle->T() + sign * origin0[2] / 3.e10;
+	      tof = kconv * iparticle->T();
+	      if (fPileUpTimeWindow > 0.) tof += tInt;
+	      
 	      imo = -1;
 	      TParticle* mother = 0;
 	      if (hasMother) {
@@ -560,7 +556,6 @@ void AliGenHijing::MakeHeader()
     ((AliGenHijingEventHeader*) header)->SetSpectators(fProjectileSpecn, fProjectileSpecp,
     						       fTargetSpecn,fTargetSpecp);
     ((AliGenHijingEventHeader*) header)->SetReactionPlaneAngle(fHijing->GetHINT1(20));
-//    printf("Impact Parameter %13.3f \n", fHijing->GetHINT1(19));
     
 
 
diff --git a/TPC/AliTPCRecoParam.cxx b/TPC/AliTPCRecoParam.cxx
index d3f83de2600..2fe09e9097e 100644
--- a/TPC/AliTPCRecoParam.cxx
+++ b/TPC/AliTPCRecoParam.cxx
@@ -62,7 +62,6 @@ AliTPCRecoParam::AliTPCRecoParam():
   fCtgRange(1.05),       
   fMaxSnpTracker(0.95),
   fMaxSnpTrack(0.999),
-  fUseOuterDetectors(kFALSE),
   fDumpSignal(kFALSE),
   fFirstBin(0),
   fLastBin(-1),
@@ -105,12 +104,8 @@ AliTPCRecoParam::AliTPCRecoParam():
   for (Int_t i=0;i<5;i++) fSystematicErrors[i]=0;
   fCutSharedClusters[0]=0.5; // maximal allowed fraction of shared clusters - shorter track
   fCutSharedClusters[1]=0.25; // maximal allowed fraction of shared clusters - longer  track
-  fClusterMaxRange[0]=1;     // y - pad      range
+  fClusterMaxRange[0]=0;     // y - pad      range
   fClusterMaxRange[1]=1;     // z - time bin range
-  fKinkAngleCutChi2[0]=9;    // angular cut for kink finder - to create a kink
-                             // ~ about 5 % rate  for high pt kink finder
-  fKinkAngleCutChi2[1]=12;    // angular cut for kink finder - to use the partial track                             // form kink 
-                             // ~ about 2 % rate  for high pt kink finder
 }
 
 //_____________________________________________________________________________
diff --git a/TPC/AliTPCRecoParam.h b/TPC/AliTPCRecoParam.h
index 7f7dbfb5783..6e88d77e010 100644
--- a/TPC/AliTPCRecoParam.h
+++ b/TPC/AliTPCRecoParam.h
@@ -22,8 +22,6 @@ class AliTPCRecoParam : public AliDetectorRecoParam
   Double_t GetCtgRange() const     { return fCtgRange;}
   Double_t GetMaxSnpTracker() const{ return fMaxSnpTracker;}
   Double_t GetMaxSnpTrack() const  { return fMaxSnpTrack;}
-  Bool_t   GetUseOuterDetectors() const { return fUseOuterDetectors;}
-  void     SetUseOuterDetectors(Bool_t flag)  { fUseOuterDetectors=flag;}
   Double_t GetCutSharedClusters(Int_t index)const { return fCutSharedClusters[index];}
   void  SetCutSharedClusters(Int_t index, Float_t value){ fCutSharedClusters[index]=value;}
   Int_t GetClusterMaxRange(Int_t index)const { return fClusterMaxRange[index];}
@@ -57,8 +55,6 @@ class AliTPCRecoParam : public AliDetectorRecoParam
   Int_t    GetLastSeedRowSec()       const  { return fLastSeedRowSec;} 
   void     SetDoKinks(Bool_t on)   { fBKinkFinder=on; }
   Bool_t   GetDoKinks() const      { return fBKinkFinder;}
-  Double_t GetKinkAngleCutChi2(Int_t index) const {return fKinkAngleCutChi2[index];}
-  void     SetKinkAngleCutChi2(Int_t index,Double_t value) {fKinkAngleCutChi2[index]=value;}
   Float_t  GetMaxC()    const      { return fMaxC;}
   Bool_t   GetSpecialSeeding() const { return fBSpecialSeeding;}
   //
@@ -109,7 +105,6 @@ class AliTPCRecoParam : public AliDetectorRecoParam
   Double_t fCtgRange;        // +-fCtgRange is the ctg(Theta) window used for clusterization and tracking (MI) 
   Double_t fMaxSnpTracker;   // max sin of local angle  - for TPC tracker
   Double_t fMaxSnpTrack;     // max sin of local angle  - for track 
-  Bool_t   fUseOuterDetectors; // switch - to use the outer detectors
   //
   //
   Double_t fCutSharedClusters[2]; // cut value - maximal amount  of shared clusters  
@@ -134,8 +129,7 @@ class AliTPCRecoParam : public AliDetectorRecoParam
   //
   Float_t  fMaxC;            // maximal curvature for tracking
   Bool_t   fBSpecialSeeding; // special seeding with big inclination angles allowed (for Cosmic and laser)
-  Bool_t   fBKinkFinder;       // do kink finder reconstruction
-  Double_t fKinkAngleCutChi2[2];   // angular cut for kinks
+  Bool_t   fBKinkFinder;     // do kink finder reconstruction
   Int_t    fLastSeedRowSec;     // Most Inner Row to make seeding for secondaries
   //
   // Correction switches
@@ -158,10 +152,10 @@ class AliTPCRecoParam : public AliDetectorRecoParam
 
   Bool_t fUseTOFCorrection;  // switch - kTRUE use TOF correction kFALSE - do not use
   //
-  //  misscalibration 
+  //  misscalibration
   //
   Double_t fSystematicErrors[5];  //systematic errors in the track parameters - to be added to TPC covariance matrix    
-  ClassDef(AliTPCRecoParam, 9)
+  ClassDef(AliTPCRecoParam, 7)
 };
 
 
diff --git a/TPC/AliTPCcalibCosmic.cxx b/TPC/AliTPCcalibCosmic.cxx
index aabc636cee4..790d30876ca 100644
--- a/TPC/AliTPCcalibCosmic.cxx
+++ b/TPC/AliTPCcalibCosmic.cxx
@@ -332,9 +332,9 @@ void AliTPCcalibCosmic::Process(AliESDEvent *event) {
     Printf("ERROR: ESD not available");
     return;
   }  
-  AliESDfriend *esdFriend=static_cast(event->FindListObject("AliESDfriend"));
-  if (!esdFriend) {
-   Printf("ERROR: esdFriend not available");
+  AliESDfriend *ESDfriend=static_cast(event->FindListObject("AliESDfriend"));
+  if (!ESDfriend) {
+   Printf("ERROR: ESDfriend not available");
    return;
   }
    
@@ -528,7 +528,7 @@ void AliTPCcalibCosmic::FindPairs(AliESDEvent *event) {
   // Track1 is choosen in lower TPC part
   //
   if (GetDebugLevel()>20) printf("Hallo world: Im here\n");
-  AliESDfriend *esdFriend=static_cast(event->FindListObject("AliESDfriend"));
+  AliESDfriend *ESDfriend=static_cast(event->FindListObject("AliESDfriend"));
   Int_t ntracks=event->GetNumberOfTracks(); 
   TObjArray  tpcSeeds(ntracks);
   if (ntracks==0) return;
@@ -549,7 +549,7 @@ void AliTPCcalibCosmic::FindPairs(AliESDEvent *event) {
    if (ntracks>4 && TMath::Abs(trackIn->GetTgl())<0.0015) continue;  // filter laser 
 
 
-   AliESDfriendTrack *friendTrack = esdFriend->GetTrack(i);
+   AliESDfriendTrack *friendTrack = ESDfriend->GetTrack(i);
    TObject *calibObject;
    AliTPCseed *seed = 0;
    for (Int_t l=0;(calibObject=friendTrack->GetCalibObject(l));++l) {
@@ -761,7 +761,7 @@ void  AliTPCcalibCosmic::FillAcordeHist(AliESDtrack *upperTrack) {
   // Pt cut to select straight tracks which can be easily propagated to ACORDE which is outside the magnetic field
   if (upperTrack->Pt() < 10 || upperTrack->GetTPCNcls() < 80) return;
     
-  const Double_t acordePlane = 850.; // distance of the central Acorde detectors to the beam line at y =0
+  const Double_t AcordePlane = 850.; // distance of the central Acorde detectors to the beam line at y =0
   const Double_t roof = 210.5;       // distance from x =0 to end of magnet roof
 
   Double_t r[3];
@@ -769,16 +769,16 @@ void  AliTPCcalibCosmic::FillAcordeHist(AliESDtrack *upperTrack) {
   Double_t d[3];
   upperTrack->GetDirection(d);
   Double_t x,z;
-  z = r[2] + (d[2]/d[1])*(acordePlane - r[1]);
-  x = r[0] + (d[0]/d[1])*(acordePlane - r[1]);
+  z = r[2] + (d[2]/d[1])*(AcordePlane - r[1]);
+  x = r[0] + (d[0]/d[1])*(AcordePlane - r[1]);
   
   if (x > roof) {
-    x = r[0] + (d[0]/(d[0]+d[1]))*(acordePlane+roof-r[0]-r[1]);
-    z = r[2] + (d[2]/(d[0]+d[1]))*(acordePlane+roof-r[0]-r[1]);
+    x = r[0] + (d[0]/(d[0]+d[1]))*(AcordePlane+roof-r[0]-r[1]);
+    z = r[2] + (d[2]/(d[0]+d[1]))*(AcordePlane+roof-r[0]-r[1]);
   }
   if (x < -roof) {
-    x = r[0] + (d[0]/(d[1]-d[0]))*(acordePlane+roof+r[0]-r[1]);	      
-    z = r[2] + (d[2]/(d[1]-d[0]))*(acordePlane+roof+r[0]-r[1]);
+    x = r[0] + (d[0]/(d[1]-d[0]))*(AcordePlane+roof+r[0]-r[1]);	      
+    z = r[2] + (d[2]/(d[1]-d[0]))*(AcordePlane+roof+r[0]-r[1]);
   } 
 
   fModules->Fill(z, x);
diff --git a/TPC/AliTPCcalibCosmic.h b/TPC/AliTPCcalibCosmic.h
index 64bb3b96e52..11c7c806f29 100644
--- a/TPC/AliTPCcalibCosmic.h
+++ b/TPC/AliTPCcalibCosmic.h
@@ -43,20 +43,20 @@ class AliTPCcalibCosmic:public AliTPCcalibBase {
 
 
   //
-  TH1F   *          GetHistNTracks() const {return fHistNTracks;};
-  TH1F   *          GetHistClusters() const {return fClusters;};
-  TH2F   *          GetHistAcorde()const {return fModules;};
-  TH1F   *          GetHistPt() const {return fHistPt;};
-  TH2F   *          GetHistDeDx() const {return fDeDx;};
-  TH1F   *          GetHistMIP() const {return fDeDxMIP;};
+  TH1F   *          GetHistNTracks(){return fHistNTracks;};
+  TH1F   *          GetHistClusters(){return fClusters;};
+  TH2F   *          GetHistAcorde(){return fModules;};
+  TH1F   *          GetHistPt(){return fHistPt;};
+  TH2F   *          GetHistDeDx(){return fDeDx;};
+  TH1F   *          GetHistMIP(){return fDeDxMIP;};
   //
-  Double_t          GetMIPvalue()const {return fMIPvalue;};
+  Double_t          GetMIPvalue(){return fMIPvalue;};
   //
   static void       BinLogX(TH1 * h);   // method for correct histogram binning
   static void       BinLogX(THnSparse * h, Int_t axisDim);   // method for correct histogram binning
 
-  void     Process(AliESDtrack *track, Int_t runNo=-1) {AliTPCcalibBase::Process(track,runNo);};
-  void     Process(AliTPCseed *track)  {return AliTPCcalibBase::Process(track);}
+  void     Process(AliESDtrack *track, Int_t runNo=-1){AliTPCcalibBase::Process(track,runNo);};
+  void     Process(AliTPCseed *track){return AliTPCcalibBase::Process(track);}
   
   //
   // Performance histograms
diff --git a/TPC/AliTPCcalibDButil.cxx b/TPC/AliTPCcalibDButil.cxx
index 02037dd3897..80050f8536c 100644
--- a/TPC/AliTPCcalibDButil.cxx
+++ b/TPC/AliTPCcalibDButil.cxx
@@ -55,8 +55,6 @@
 #include "AliMathBase.h"
 #include "AliRelAlignerKalman.h"
 
-const Float_t kAlmost0=1.e-30;
-
 ClassImp(AliTPCcalibDButil)
 AliTPCcalibDButil::AliTPCcalibDButil() :
   TObject(),
@@ -164,7 +162,7 @@ void AliTPCcalibDButil::UpdateFromCalibDB()
 }
 //_____________________________________________________________________________________
 void AliTPCcalibDButil::ProcessCEdata(const char* fitFormula, TVectorD &fitResultsA, TVectorD &fitResultsC,
-                                      Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad * const outCE)
+                                      Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad *outCE)
 {
   //
   // Process the CE data for this run
@@ -225,7 +223,7 @@ void AliTPCcalibDButil::ProcessCEdata(const char* fitFormula, TVectorD &fitResul
         if (ipad==0||ipad==npads-1) rocOut->SetValue(irow,ipad,1);
         Float_t valTmean=rocData->GetValue(irow,ipad);
         //exclude values that are exactly 0
-        if ( !(TMath::Abs(valTmean)>kAlmost0) ) {
+        if (valTmean==0) {
           rocOut->SetValue(irow,ipad,1);
           ++noutliersCE;
         }
@@ -376,7 +374,7 @@ void AliTPCcalibDButil::ProcessNoiseData(TVectorD &vNoiseMean, TVectorD &vNoiseM
         if (rocMasked && rocMasked->GetValue(irow,ipad)) continue;
         Float_t noiseVal=noiseROC->GetValue(irow,ipad);
         //check if noise==0
-        if (noiseValGetCalROC(isec);
       Float_t mean=rocPulTmean->GetMean(rocOut);
       //treat case where a whole partition is masked
-      if ( TMath::Abs(mean)GetMean();
+      if (mean==0) mean=rocPulTmean->GetMean();
       if (model==1) {
         Int_t type=isec/18;
         mean=vMean[type];
@@ -879,7 +877,7 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub
           //This should be the most precise guess in that case.
           if (rocOut->GetValue(irow,ipad)) {
             time=GetMeanAltro(rocPulTmean,irow,ipad,rocOut);
-            if ( TMath::Abs(time)SetValue(irow,ipad,val);
@@ -914,7 +912,7 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub
       rocTime0->GlobalFit(rocOutCE,kFALSE,vFitROC,mFitROC,chi2);
       AliTPCCalROC *rocCEfit=AliTPCCalROC::CreateGlobalFitCalROC(vFitROC, isec);
       Float_t mean=rocPulTmean->GetMean(rocOutPul);
-      if ( TMath::Abs(mean)GetMean();
+      if (mean==0) mean=rocPulTmean->GetMean();
       UInt_t nrows=rocTime0->GetNrows();
       for (UInt_t irow=0;irowGetNPads(irow);
@@ -938,9 +936,6 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub
 //_____________________________________________________________________________________
 Float_t AliTPCcalibDButil::GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC *rocOut)
 {
-  //
-  // GetMeanAlto information
-  //
   if (roc==0) return 0.;
   const Int_t sector=roc->GetSector();
   AliTPCROC *tpcRoc=AliTPCROC::Instance();
@@ -1281,7 +1276,7 @@ const Int_t AliTPCcalibDButil::GetReferenceRun(const char* type) const{
   return (const Int_t)str->GetString().Atoi();
 }
 //_____________________________________________________________________________________
-AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPCCalPad * const ceOut, Float_t minSignal, Float_t cutTrmsMin,  Float_t cutTrmsMax, Float_t cutMaxDistT){
+AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPCCalPad *ceOut, Float_t minSignal, Float_t cutTrmsMin,  Float_t cutTrmsMax, Float_t cutMaxDistT){
   //
   // Author:  marian.ivanov@cern.ch
   //
@@ -1351,7 +1346,7 @@ AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPC
         //2. exclude edge pads
         if (ipad==0||ipad==npads-1) rocOut->SetValue(irow,ipad,1);
         //exclude values that are exactly 0
-        if ( TMath::Abs(valTmean)SetValue(irow,ipad,1);
           ++noutliersCE;
         }
@@ -1386,7 +1381,7 @@ AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPC
 }
 
 
-AliTPCCalPad *AliTPCcalibDButil::CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad * const pulserOut,Float_t cutTime, Float_t cutnRMSQ, Float_t cutnRMSrms){
+AliTPCCalPad *AliTPCcalibDButil::CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad *pulserOut,Float_t cutTime, Float_t cutnRMSQ, Float_t cutnRMSrms){
   //
   // Author: marian.ivanov@cern.ch
   //
@@ -2084,7 +2079,7 @@ TGraph* AliTPCcalibDButil::FilterGraphMedianAbs(TGraph * graph, Float_t cut,Doub
 
 
 
-TGraphErrors* AliTPCcalibDButil::FilterGraphMedianErr(TGraphErrors * const graph, Float_t sigmaCut,Double_t &medianY){
+TGraphErrors* AliTPCcalibDButil::FilterGraphMedianErr(TGraphErrors * graph, Float_t sigmaCut,Double_t &medianY){
   //
   // filter outlyer measurement
   // Only points with normalized errors median +- sigmaCut filtered
@@ -2186,7 +2181,7 @@ void AliTPCcalibDButil::SmoothGraph(TGraph *graph, Double_t delta){
   delete[] outy;
 }
 
-Double_t AliTPCcalibDButil::EvalGraphConst(TGraph * const graph, Double_t xref){
+Double_t AliTPCcalibDButil::EvalGraphConst(TGraph *graph, Double_t xref){
   //
   // Use constant interpolation outside of range 
   //
@@ -2303,7 +2298,7 @@ Float_t  AliTPCcalibDButil::FilterTemperature(AliTPCSensorTempArray *tempArray,
 }
 
 
-void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutSigma, TTreeSRedirector * const pcstream){
+void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutSigma, TTreeSRedirector *pcstream){
   //
   // Filter CE data
   // Input parameters:
@@ -2505,7 +2500,7 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS
 }
 
 
-void AliTPCcalibDButil::FilterTracks(Int_t run, Double_t cutSigma, TTreeSRedirector * const pcstream){
+void AliTPCcalibDButil::FilterTracks(Int_t run, Double_t cutSigma, TTreeSRedirector *pcstream){
   //
   // Filter Drift velocity measurement using the tracks
   // 0.  remove outlyers - error based
@@ -2603,7 +2598,7 @@ Double_t AliTPCcalibDButil::GetLaserTime0(Int_t run, Int_t timeStamp, Int_t delt
 
 
 
-void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT, Double_t cutSigma, Double_t minVd, Double_t maxVd, TTreeSRedirector * const pcstream){
+void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT, Double_t cutSigma, Double_t minVd, Double_t maxVd, TTreeSRedirector *pcstream){
   //
   // Filter Goofie data
   // goofieArray - points will be filtered
@@ -2773,7 +2768,7 @@ void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t d
 
 
 
-TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray * const array, Float_t minFraction, Int_t minStat, Float_t maxvd){
+TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray *array, Float_t minFraction, Int_t minStat, Float_t maxvd){
   //
   // Make a statistic matrix
   // Input parameters:
@@ -2817,7 +2812,7 @@ TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray * const array, Float_t
 }
 
 
-TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray * const array, const TMatrixD & stat, Bool_t direction, Float_t sigmaCut){
+TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *array,TMatrixD & stat, Bool_t direction, Float_t sigmaCut){
   //
   // Smooth the array of AliRelKalmanAlign - detector alignment and drift calibration)
   // Input:
@@ -2876,7 +2871,7 @@ TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray * const array, const TMa
   return sArray;
 }
 
-TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray * const arrayP, TObjArray * const arrayM){
+TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *arrayP, TObjArray *arrayM){
   //
   // Merge 2 RelKalman arrays
   // Input:
diff --git a/TPC/AliTPCcalibDButil.h b/TPC/AliTPCcalibDButil.h
index dfcc27d4b53..0f843254292 100644
--- a/TPC/AliTPCcalibDButil.h
+++ b/TPC/AliTPCcalibDButil.h
@@ -1,5 +1,5 @@
-#ifndef ALITPCCALIBDBUTIL_H
-#define ALITPCCALIBDBUTIL_H
+#ifndef AliTPCCALIBDBUTIL_H
+#define AliTPCCALIBDBUTIL_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
@@ -32,8 +32,6 @@ class AliTPCdataQA;
 class TGraphErrors;
 class TTreeSRedirector;
 class AliTPCCalROC;
-
-
 class AliTPCcalibDButil : public TObject
 {
 public:
@@ -43,7 +41,7 @@ class AliTPCcalibDButil : public TObject
   void UpdateFromCalibDB();
   //data processing functions
   void ProcessCEdata(const char* fitFormula, TVectorD &fitResultsA, TVectorD &fitResultsC,
-                     Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad * const outCE=0);
+                     Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad *outCE=0);
   void ProcessCEgraphs(TVectorD &vecTEntries, TVectorD &vecTMean, TVectorD &vecTRMS, TVectorD &vecTMedian,
                        TVectorD &vecQEntries, TVectorD &vecQMean, TVectorD &vecQRMS, TVectorD &vecQMedian,
                        Float_t &driftTimeA, Float_t &driftTimeC );
@@ -61,7 +59,7 @@ class AliTPCcalibDButil : public TObject
   
   //getter preprocess information
   Int_t GetNPulserOutliers() const {return fNpulserOutliers;}
-  Float_t GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC * const rocOut=0x0);
+  Float_t GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC *rocOut=0x0);
   AliTPCCalPad *GetPulserOutlierMap() const {return fPulserOutlier;}
 
   //getters ref data
@@ -89,7 +87,7 @@ class AliTPCcalibDButil : public TObject
   
   
   //setters for pad by pad information
-  void SetPulserData(AliTPCCalPad * const tmean, AliTPCCalPad * const trms=0x0, AliTPCCalPad * const qmean=0x0)
+  void SetPulserData(AliTPCCalPad *tmean, AliTPCCalPad *trms=0x0, AliTPCCalPad *qmean=0x0)
                 {fPulserTmean=tmean; fPulserTrms=trms; fPulserQmean=qmean;}
   void SetCEData(AliTPCCalPad *tmean, AliTPCCalPad *trms=0x0, AliTPCCalPad *qmean=0x0)
                 {fCETmean=tmean; fCETrms=trms; fCEQmean=qmean;}
@@ -117,8 +115,8 @@ class AliTPCcalibDButil : public TObject
   //
   // create outlyer maps
   //
-  AliTPCCalPad *CreateCEOutlyerMap(Int_t &noutliersCE, AliTPCCalPad * const ceOut=0, Float_t minSignal=10, Float_t cutTrmsMin=0.9, Float_t cutTrmsMax=1.2, Float_t cutMaxDistT=0.7);
-  AliTPCCalPad *CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad * const pulserOut=0, Float_t cutTime=3, Float_t cutnRMSQ=5, Float_t cutnRMSrms=5);
+  AliTPCCalPad *CreateCEOutlyerMap(Int_t &noutliersCE, AliTPCCalPad *ceOut=0, Float_t minSignal=10, Float_t cutTrmsMin=0.9, Float_t cutTrmsMax=1.2, Float_t cutMaxDistT=0.7);
+  AliTPCCalPad *CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad *pulserOut=0, Float_t cutTime=3, Float_t cutnRMSQ=5, Float_t cutnRMSrms=5);
   //
   AliTPCCalPad *CreatePadTime0CE(TVectorD &fitResultsA, TVectorD&fitResultsC, Int_t &nOut, Double_t &chi2A, Double_t &chi2C, const char *dumpfile=0);
   //
@@ -134,14 +132,14 @@ class AliTPCcalibDButil : public TObject
   // graph tools
   //
   static Double_t GetLaserTime0(Int_t run, Int_t timeStamp, Int_t deltaT, Int_t side);
-  static TGraph* FilterGraphMedian(TGraph * const graph, Float_t sigmaCut, Double_t &medianY);
+  static TGraph* FilterGraphMedian(TGraph * graph, Float_t sigmaCut, Double_t &medianY);
   static TGraph* FilterGraphMedianAbs(TGraph * graph, Float_t cut, Double_t &medianY);
   static TGraphErrors* FilterGraphMedianErr(TGraphErrors * graph, Float_t sigmaCut,Double_t &medianY);
   //
   static void Sort(TGraph *graph);
   static void SmoothGraph(TGraph *graph, Double_t delta);
   static Int_t     GetNearest(TGraph *graph, Double_t xref, Double_t &dx, Double_t &y);
-  static Double_t EvalGraphConst(TGraph * const graph, Double_t xref);
+  static Double_t EvalGraphConst(TGraph *graph, Double_t xref);
   //
   // Filter sensors
   //
@@ -149,14 +147,14 @@ class AliTPCcalibDButil : public TObject
   //
   // Filter AliRelAlignmentKalman - Alignment/Drift velocity
   //
-  static TMatrixD* MakeStatRelKalman(TObjArray * const array, Float_t minFraction, Int_t minStat, Float_t maxvd);
-  static TObjArray *SmoothRelKalman(TObjArray * const array,const TMatrixD & stat, Bool_t direction, Float_t sigmaCut);
-  static TObjArray *SmoothRelKalman(TObjArray * const arrayP, TObjArray * const arrayM);
-  static void FilterCE(Double_t deltaT=100, Double_t cutAbs=10, Double_t cutSigma=4., TTreeSRedirector * const pcstream=0);
-  static void FilterTracks(Int_t run, Double_t cutSigma=20., TTreeSRedirector * const pcstream=0);
+  static TMatrixD* MakeStatRelKalman(TObjArray *array, Float_t minFraction, Int_t minStat, Float_t maxvd);
+  static TObjArray *SmoothRelKalman(TObjArray *array,TMatrixD & stat, Bool_t direction, Float_t sigmaCut);
+  static TObjArray *SmoothRelKalman(TObjArray *arrayP, TObjArray *arrayM);
+  static void FilterCE(Double_t deltaT=100, Double_t cutAbs=10, Double_t cutSigma=4., TTreeSRedirector *pcstream=0);
+  static void FilterTracks(Int_t run, Double_t cutSigma=20., TTreeSRedirector *pcstream=0);
   static Float_t FilterTemperature(AliTPCSensorTempArray *tempArray, Double_t ymin=15, Double_t ymax=22, Double_t sigmaCut=5); 
 
-  static   void FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT=2, Double_t cutSigma=4.,  Double_t minVdn=8.5, Double_t maxVdn=9.05, TTreeSRedirector * const pcstream=0);
+  static   void FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT=2, Double_t cutSigma=4.,  Double_t minVdn=8.5, Double_t maxVdn=9.05, TTreeSRedirector *pcstream=0);
   static Double_t  GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0);
   static Double_t  GetVDriftTPC(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0);
   static Double_t  GetVDriftTPCLaserTracks(Double_t &dist,Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2);
@@ -224,10 +222,11 @@ class AliTPCcalibDButil : public TObject
   //
   // filters  
   
+public:
   TArrayI fRuns;                         // run list with OCDB info
   TArrayI fRunsStart;                    // start time for given run
   TArrayI fRunsStop;                     // stop time for given run
-  
+private:
   AliTPCcalibDButil (const AliTPCcalibDButil& );
   AliTPCcalibDButil& operator= (const AliTPCcalibDButil& );
 
diff --git a/TPC/AliTPCtrack.cxx b/TPC/AliTPCtrack.cxx
index 8569db95076..d5f388e86db 100644
--- a/TPC/AliTPCtrack.cxx
+++ b/TPC/AliTPCtrack.cxx
@@ -29,8 +29,7 @@
 #include "AliESDtrack.h"
 #include "AliESDVertex.h"
 #include "TTreeStream.h"
-#include  "AliTPCRecoParam.h"
-#include  "AliTPCReconstructor.h"
+
 ClassImp(AliTPCtrack)
 
 //_________________________________________________________________________
@@ -150,19 +149,18 @@ AliTPCtrack::AliTPCtrack(const AliESDtrack& t, TTreeSRedirector *pcstream) :
   //
   // choose parameters to start
   //
-  const AliTPCRecoParam * recoParam = AliTPCReconstructor::GetRecoParam();
   Int_t reject=0;
   AliExternalTrackParam param(t);
   const AliExternalTrackParam  *tpcout=(t.GetFriendTrack())? ((AliESDfriendTrack*)(t.GetFriendTrack()))->GetTPCOut():0;
   const AliExternalTrackParam  *tpcin = t.GetInnerParam();
   const AliExternalTrackParam  *tpc=(tpcout)?tpcout:tpcin;
   if (!tpc) tpc=¶m;
-  Bool_t isOK=recoParam->GetUseOuterDetectors();
+  Bool_t isOK=kTRUE;
   if (param.GetCovariance()[0]>kmaxC[0]*kmaxC[0]) isOK=kFALSE;
   if (param.GetCovariance()[2]>kmaxC[1]*kmaxC[1]) isOK=kFALSE;
   if (param.GetCovariance()[5]>kmaxC[2]*kmaxC[2]) isOK=kFALSE;
   if (param.GetCovariance()[9]>kmaxC[3]*kmaxC[3]) isOK=kFALSE;
-  if (!isOK ){
+  if (!isOK){
     param=*tpc;
     isOK=kTRUE;
     reject=1;
diff --git a/TPC/AliTPCtrackerMI.cxx b/TPC/AliTPCtrackerMI.cxx
index efae996c0c6..92ec14affde 100644
--- a/TPC/AliTPCtrackerMI.cxx
+++ b/TPC/AliTPCtrackerMI.cxx
@@ -67,7 +67,7 @@
 //
 // The tracker itself can be debugged  - the information about tracks can be stored in several // phases of the reconstruction
 // To enable storage of the TPC tracks in the ESD friend track
-// use AliTPCReconstructor::SetStreamLevel(n); 
+// use AliTPCReconstructor::SetStreamLevel(n); where nis bigger 0
 //
 // The debug level -  different procedure produce tree for numerical debugging
 //                    To enable them set AliTPCReconstructor::SetStreamLevel(n); where nis bigger 1
@@ -95,14 +95,12 @@
 // There are several places in the code which can be numerically debuged
 // This code is keeped in order to enable code development and to check the calibration implementtion
 //
-//      1. ErrParam stream  - dump information about 
+//      1. ErrParam stream (Log level 9) - dump information about 
 //         1.a) cluster
 //         2.a) cluster error estimate
 //         3.a) cluster shape estimate
 //
 //
-//  Debug streamer levels:
-//  
 //-------------------------------------------------------
 
 
@@ -308,7 +306,7 @@ Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluste
   Double_t rdistance2  = rdistancey2+rdistancez2;
   //Int_t  accept =0;
   
-  if (AliTPCReconstructor::StreamLevel()>2 && seed->GetNumberOfClusters()>20) {
+  if (AliTPCReconstructor::StreamLevel()>1 && seed->GetNumberOfClusters()>20) {
     Float_t rmsy2 = seed->GetCurrentSigmaY2();
     Float_t rmsz2 = seed->GetCurrentSigmaZ2();
     Float_t rmsy2p30 = seed->GetCMeanSigmaY2p30();
@@ -323,7 +321,7 @@ Int_t AliTPCtrackerMI::AcceptCluster(AliTPCseed * seed, AliTPCclusterMI * cluste
     gcl[0]=gclf[0];    gcl[1]=gclf[1];    gcl[2]=gclf[2];
 
     
-    if (AliTPCReconstructor::StreamLevel()>2) {
+    if (AliTPCReconstructor::StreamLevel()>0) {
     (*fDebugStreamer)<<"ErrParam"<<
       "Cl.="<GetLabel();
@@ -5010,30 +5008,6 @@ void  AliTPCtrackerMI::FindKinks(TObjArray * array, AliESDEvent *esd)
 	kink->SetShapeFactor(shapesum/sum);
       }      
       //      esd->AddKink(kink);
-      //
-      //      kink->SetMother(paramm);
-      //kink->SetDaughter(paramd);
- 
-      Double_t chi2P2 = paramm.GetParameter()[2]-paramd.GetParameter()[2];
-      chi2P2*=chi2P2;
-      chi2P2/=paramm.GetCovariance()[5]+paramd.GetCovariance()[5];
-      Double_t chi2P3 = paramm.GetParameter()[3]-paramd.GetParameter()[3];
-      chi2P3*=chi2P3;
-      chi2P3/=paramm.GetCovariance()[9]+paramd.GetCovariance()[9];
-      //
-      if (AliTPCReconstructor::StreamLevel()>1) {
-	(*fDebugStreamer)<<"kinkLpt"<<
-	  "chi2P2="<GetKinkAngleCutChi2(0)){
-	continue;
-      }
-      //
       kinks->AddLast(kink);
       kink = new AliKink;
       ncandidates++;
@@ -5960,36 +5934,11 @@ Int_t  AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP
     delete seed1;
     return 0;
   }
-
   //  Float_t anglesigma = TMath::Sqrt(param0[index].fC22+param0[index].fC33+param1[index].fC22+param1[index].fC33);
   
   kink.SetMother(param0[index]);
   kink.SetDaughter(param1[index]);
   kink.Update();
-
-  Double_t chi2P2 = param0[index].GetParameter()[2]-param1[index].GetParameter()[2];
-  chi2P2*=chi2P2;
-  chi2P2/=param0[index].GetCovariance()[5]+param1[index].GetCovariance()[5];
-  Double_t chi2P3 = param0[index].GetParameter()[3]-param1[index].GetParameter()[3];
-  chi2P3*=chi2P3;
-  chi2P3/=param0[index].GetCovariance()[9]+param1[index].GetCovariance()[9];
-  //
-  if (AliTPCReconstructor::StreamLevel()>1) {
-    (*fDebugStreamer)<<"kinkHpt"<<
-      "chi2P2="<GetKinkAngleCutChi2(0)){
-    delete seed0;
-    delete seed1;
-    return 0; 
-  }
-
-
   row0    = GetRowNumber(kink.GetR());   
   kink.SetTPCRow0(row0);
   kink.SetLabel(CookLabel(seed0,0.5,0,row0),0);
@@ -6004,12 +5953,9 @@ Int_t  AliTPCtrackerMI::CheckKinkPoint(AliTPCseed*seed,AliTPCseed &mother, AliTP
   daughter = param1[index];
   daughter.SetLabel(kink.GetLabel(1));  
   param0[index].Reset(kTRUE);
-  FollowProlongation(param0[index],0);    
+  FollowProlongation(param0[index],0);  
   mother = param0[index];
   mother.SetLabel(kink.GetLabel(0));
-  if ( chi2P2+chi2P3GetKinkAngleCutChi2(1)){
-    mother=*seed;
-  }
   delete seed0;
   delete seed1;
   //
@@ -6134,10 +6080,10 @@ Int_t AliTPCtrackerMI::Clusters2Tracks() {
   RemoveUsed2(fSeeds,0.85,0.85,0);
   if (AliTPCReconstructor::GetRecoParam()->GetDoKinks()) FindKinks(fSeeds,fEvent);
   //FindCurling(fSeeds, fEvent,0);  
-  if (AliTPCReconstructor::StreamLevel()>5)  FindMultiMC(fSeeds, fEvent,-1); // find multi found tracks
+  if (AliTPCReconstructor::StreamLevel()>2)  FindMultiMC(fSeeds, fEvent,-1); // find multi found tracks
   RemoveUsed2(fSeeds,0.5,0.4,20);
   FindSplitted(fSeeds, fEvent,0); // find multi found tracks
-  if (AliTPCReconstructor::StreamLevel()>5)  FindMultiMC(fSeeds, fEvent,0); // find multi found tracks
+  if (AliTPCReconstructor::StreamLevel()>2)  FindMultiMC(fSeeds, fEvent,0); // find multi found tracks
 
  //  //
 //   // refit short tracks
diff --git a/VZERO/AliVZEROCalibData.cxx b/VZERO/AliVZEROCalibData.cxx
index 713a0c587e5..9bd61de9da3 100644
--- a/VZERO/AliVZEROCalibData.cxx
+++ b/VZERO/AliVZEROCalibData.cxx
@@ -27,8 +27,6 @@
 
 #include "AliDCSValue.h"
 #include "AliVZEROCalibData.h"
-#include "AliVZERODataDCS.h"
-#include "AliLog.h"
 
 ClassImp(AliVZEROCalibData)
 
@@ -67,7 +65,6 @@ void AliVZEROCalibData::Reset()
 //________________________________________________________________
 AliVZEROCalibData::AliVZEROCalibData(const char* name)
 {
-  // Constructor
    TString namst = "Calib_";
    namst += name;
    SetName(namst.Data());
@@ -198,70 +195,70 @@ void AliVZEROCalibData::SetParameter(TString name, Int_t val){
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetPedestal(const Float_t* Pedestal)
+void AliVZEROCalibData::SetPedestal(Float_t* Pedestal)
 {
   if(Pedestal) for(int t=0; t<128; t++) fPedestal[t] = Pedestal[t];
   else for(int t=0; t<128; t++) fPedestal[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetSigma(const Float_t* Sigma)
+void AliVZEROCalibData::SetSigma(Float_t* Sigma)
 {
   if(Sigma) for(int t=0; t<128; t++) fSigma[t] = Sigma[t];
   else for(int t=0; t<128; t++) fSigma[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetADCmean(const Float_t* ADCmean) 
+void AliVZEROCalibData::SetADCmean(Float_t* ADCmean) 
 {
   if(ADCmean) for(int t=0; t<128; t++) fADCmean[t] = ADCmean[t];
   else for(int t=0; t<128; t++) fADCmean[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetADCsigma(const Float_t* ADCsigma) 
+void AliVZEROCalibData::SetADCsigma(Float_t* ADCsigma) 
 {
   if(ADCsigma) for(int t=0; t<128; t++) fADCsigma[t] = ADCsigma[t];
   else for(int t=0; t<128; t++) fADCsigma[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetMeanHV(const Float_t* MeanHV) 
+void AliVZEROCalibData::SetMeanHV(Float_t* MeanHV) 
 {
   if(MeanHV) for(int t=0; t<64; t++) fMeanHV[t] = MeanHV[t];
   else for(int t=0; t<64; t++) fMeanHV[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetWidthHV(const Float_t* WidthHV) 
+void AliVZEROCalibData::SetWidthHV(Float_t* WidthHV) 
 {
   if(WidthHV) for(int t=0; t<64; t++) fWidthHV[t] = WidthHV[t];
   else for(int t=0; t<64; t++) fWidthHV[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetDeadMap(const Bool_t* deadMap) 
+void AliVZEROCalibData::SetDeadMap(Bool_t* deadMap) 
 {
   if(deadMap) for(int t=0; t<64; t++) fDeadChannel[t] = deadMap[t];
   else for(int t=0; t<64; t++) fDeadChannel[t] = kFALSE;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetGain(const Float_t* Gain) 
+void AliVZEROCalibData::SetGain(Float_t* Gain) 
 {
   if(Gain) for(int t=0; t<128; t++) fGain[t] = Gain[t];
   else for(int t=0; t<128; t++) fGain[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetTimeOffset(const Float_t* TimeOffset) 
+void AliVZEROCalibData::SetTimeOffset(Float_t* TimeOffset) 
 {
   if(TimeOffset) for(int t=0; t<64; t++) fTimeOffset[t] = TimeOffset[t];
   else for(int t=0; t<64; t++) fTimeOffset[t] = 0.0;
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetTimeGain(const Float_t* TimeGain) 
+void AliVZEROCalibData::SetTimeGain(Float_t* TimeGain) 
 {
   if(TimeGain) for(int t=0; t<64; t++) fTimeGain[t] = TimeGain[t];
   else for(int t=0; t<64; t++) fTimeGain[t] = 0.0;
@@ -273,7 +270,7 @@ Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) const {
 	// Computes the MIP conversion factor - MIP per ADC channel - 
 	// Argument passed is the PM number (aliroot numbering)
 	
-	Float_t p0[64] = {
+	Float_t P0[64] = {
 		7.094891, 7.124938, 7.089708, 7.098169, 7.094482, 7.147250, 7.170978, 7.183392, 
 		7.145760, 7.148096, 7.153840, 7.143544, 7.186069, 7.194580, 7.203516, 7.195176, 
 		7.188333, 7.198607, 7.209412, 7.226565, 7.221695, 7.205132, 7.191238, 7.227724, 
@@ -282,7 +279,7 @@ Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) const {
 		7.024667, 7.124784, 7.123442, 7.129744, 7.110671, 7.143031, 7.139439, 7.178109, 
 		7.247803, 7.139396, 7.293809, 7.094454, 6.992198, 7.206448, 7.244765, 7.056197, 
 		7.263595, 7.138569, 7.089582, 7.215683, 7.266183, 7.165123, 7.243276, 7.235135 };
-	Float_t p1[64] = {
+	Float_t P1[64] = {
 		0.135569, 0.146405, 0.142425, 0.144278, 0.142307, 0.141648, 0.128477, 0.138239, 
 		0.144173, 0.143419, 0.143572, 0.144482, 0.138024, 0.136542, 0.135955, 0.138537, 
 		0.148521, 0.141999, 0.139627, 0.130014, 0.134970, 0.135635, 0.139094, 0.140634, 
@@ -293,11 +290,11 @@ Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) const {
 		0.146489, 0.143279, 0.145230, 0.147203, 0.147333, 0.144979, 0.148597, 0.138985 };
 	
 	// High Voltage retrieval from Calibration Data Base:  
-	Float_t  hv = fMeanHV[channel];  
-	Float_t mip = -1;
-	if (hv>0)
-	  mip = 0.6/TMath::Exp((TMath::Log(hv) - p0[channel] )/p1[channel]);
-	return mip; 
+	Float_t  HV = fMeanHV[channel];  
+	Float_t MIP = -1;
+	if (HV>0)
+	  MIP = 0.6/TMath::Exp((TMath::Log(HV) - P0[channel] )/P1[channel]);
+	return MIP; 
 	
 }
 //________________________________________________________________
diff --git a/VZERO/AliVZEROCalibData.h b/VZERO/AliVZEROCalibData.h
index f2fbe8542b0..0663eeb102f 100644
--- a/VZERO/AliVZEROCalibData.h
+++ b/VZERO/AliVZEROCalibData.h
@@ -11,8 +11,8 @@
 ////////////////////////////////////////////////
 
 #include "TNamed.h"
-
-class AliVZERODataDCS;
+#include "AliVZERO.h"
+#include "AliVZERODataDCS.h"
 
 class AliVZEROCalibData: public TNamed {
 
@@ -56,26 +56,26 @@ class AliVZEROCalibData: public TNamed {
   Float_t  GetWidthResolution(Int_t board ) const  {return ((board>=0 && boardLoad("libMinuit");
   gSystem->Load("libProof");
 
+  // Uncomment the following line for macosx
+  // Waiting for a better solution
+  //  gSystem->Load("libg2c_sh");
+
   gSystem->Load("libGeom");
   gSystem->Load("libVMC");
 
@@ -65,13 +69,15 @@ void loadlibsrec ()
   gSystem->Load("libEMCALbase");
   gSystem->Load("libEMCALsim");
   gSystem->Load("libEMCALrec");
+
+  // The following lines have to be commented on Darwin
+  // for the moment due to cross dependencies
   gSystem->Load("libTPCbase");
   gSystem->Load("libTPCrec");
   gSystem->Load("libTPCsim");
   gSystem->Load("libITSbase");
   gSystem->Load("libITSsim");
   gSystem->Load("libITSrec");
-  gSystem->Load("libSTAT");
   gSystem->Load("libTRDbase");
   gSystem->Load("libTRDsim");
   gSystem->Load("libTRDrec");
diff --git a/macros/loadlibssim.C b/macros/loadlibssim.C
index 6f7ef567369..5130991c558 100644
--- a/macros/loadlibssim.C
+++ b/macros/loadlibssim.C
@@ -11,6 +11,9 @@ void loadlibssim ()
   gSystem->Load("libMinuit");
   gSystem->Load("libProof");
 
+  // Uncomment the following line for macosx
+  // Waiting for a better solution
+  //  gSystem->Load("libg2c_sh");
   gSystem->Load("libmicrocern");
   gSystem->Load("liblhapdf");
   gSystem->Load("libpythia6");
@@ -70,20 +73,19 @@ void loadlibssim ()
   gSystem->Load("libVZERObase");
   gSystem->Load("libVZEROrec");
   gSystem->Load("libVZEROsim");
-  gSystem->Load("libEMCALUtils");
   gSystem->Load("libEMCALbase");
   gSystem->Load("libEMCALsim");
 
+  // The following lines have to be commented on Darwin
+  // for the moment due to cross dependencies
   gSystem->Load("libTPCbase");
   gSystem->Load("libTPCsim");
   gSystem->Load("libTPCrec");
   gSystem->Load("libITSbase");
   gSystem->Load("libITSsim");
   gSystem->Load("libITSrec"); // Needed by libAliHLTITS
-  gSystem->Load("libSTAT");
   gSystem->Load("libTRDbase");
   gSystem->Load("libTRDsim");
-  gSystem->Load("libTRDrec"); // Needed by libAliHLTTRD
   gSystem->Load("libTOFbase");
   gSystem->Load("libTOFrec");
   gSystem->Load("libTOFsim");
diff --git a/prod/fpprod/Config.C b/prod/fpprod/Config.C
index f249cfe18ae..de3764a9680 100644
--- a/prod/fpprod/Config.C
+++ b/prod/fpprod/Config.C
@@ -435,7 +435,7 @@ void Config()
     {
         //=================== EMCAL parameters ============================
 
-        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEAR");
+        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
     }
 
      if (iACORDE)
diff --git a/test/pileup/Config.C b/test/pileup/Config.C
index dc4a1ec2e99..45ef8ed42c7 100644
--- a/test/pileup/Config.C
+++ b/test/pileup/Config.C
@@ -447,7 +447,7 @@ void Config()
     {
         //=================== EMCAL parameters ============================
 
-        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEAR");
+        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
     }
 
      if (iACORDE)
diff --git a/test/pploadlibs/Config.C b/test/pploadlibs/Config.C
index ac408dda258..d306804867a 100644
--- a/test/pploadlibs/Config.C
+++ b/test/pploadlibs/Config.C
@@ -510,7 +510,7 @@ void Config()
     if (iEMCAL)
     {
         //=================== EMCAL parameters ============================
-        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEAR");
+        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
     }
 
      if (iACORDE)
diff --git a/test/pploadlibs/runtest.sh b/test/pploadlibs/runtest.sh
index c8822ebf655..21d30cf3e73 100755
--- a/test/pploadlibs/runtest.sh
+++ b/test/pploadlibs/runtest.sh
@@ -10,9 +10,7 @@ fi
 rm -rf *.root *.dat *.log fort* hlt hough raw* *~
 
 ${REXE} -b -q sim.C      2>&1 | tee sim.log
-mv syswatch.log simwatch.log
 ${REXE} -b -q rec.C      2>&1 | tee rec.log
-mv syswatch.log recwatch.log
 ${REXE} -b -q ${ALICE_ROOT}/STEER/CreateAODfromESD.C 2>&1 | tee aod.log